diff --git a/Dockerfile b/Dockerfile index 94b8cdfa2..ac824113f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & unzip \ vbindiff \ vim \ - clang-tidy-11 \ - clang-format-11 \ + clang-tidy-14 \ + clang-format-14 \ libpng-dev && \ apt clean && \ rm -rf /var/lib/apt/lists/* diff --git a/Jenkinsfile b/Jenkinsfile index a627ead7c..15a40c7eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -84,7 +84,7 @@ pipeline { } stage('Report Progress') { when { - branch 'master' + branch 'main' } steps { sh 'mkdir reports' @@ -96,7 +96,7 @@ pipeline { } stage('Update Progress') { when { - branch 'master' + branch 'main' } agent{ label 'zeldaret_website' diff --git a/Makefile b/Makefile index 89eeb21d2..e08d983c8 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ FULL_DISASM ?= 0 RUN_CC_CHECK ?= 1 # Dump build object files OBJDUMP_BUILD ?= 0 +# Force asm processor to run on every file +ASM_PROC_FORCE ?= 0 # Number of threads to disassmble, extract, and compress with N_THREADS ?= $(shell nproc) @@ -92,6 +94,10 @@ ASM_PROC := python3 tools/asm-processor/build.py ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp --convert-statics=global-with-filename +ifneq ($(ASM_PROC_FORCE), 0) + ASM_PROC_FLAGS += --force +endif + IINC := -Iinclude -Isrc -Iassets -Ibuild -I. ifeq ($(KEEP_MDEBUG),0) @@ -117,6 +123,7 @@ MKLDSCRIPT := tools/buildtools/mkldscript YAZ0 := tools/buildtools/yaz0 ZAPD := tools/ZAPD/ZAPD.out FADO := tools/fado/fado.elf +MAKEYAR := tools/buildtools/makeyar OPTFLAGS := -O2 -g3 ASFLAGS := -march=vr4300 -32 -Iinclude @@ -184,9 +191,11 @@ C_FILES := $(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS_C_FILES),$(wildcard S_FILES := $(shell grep -F "build/asm" spec | sed 's/.*build\/// ; s/\.o\".*/.s/') \ $(shell grep -F "build/data" spec | sed 's/.*build\/// ; s/\.o\".*/.s/') BASEROM_FILES := $(shell grep -F "build/baserom" spec | sed 's/.*build\/// ; s/\.o\".*//') +ARCHIVES_O := $(shell grep -F ".yar.o" spec | sed 's/.*include "// ; s/\.o\".*/.o/') 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) + $(foreach f,$(BASEROM_FILES),build/$f.o) \ + $(ARCHIVES_O) OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' ) @@ -198,8 +207,7 @@ DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) $(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN_DIRS),build/$(dir))) # directory flags -build/src/boot_O2/%.o: OPTFLAGS := -O2 -build/src/boot_O2_g3/%.o: OPTFLAGS := -O2 -g3 +build/src/boot/O2/%.o: OPTFLAGS := -O2 build/src/libultra/os/%.o: OPTFLAGS := -O1 build/src/libultra/voice/%.o: OPTFLAGS := -O2 @@ -216,8 +224,8 @@ build/assets/%.o: OPTFLAGS := -O1 build/assets/%.o: ASM_PROC_FLAGS := # file flags -build/src/boot_O2_g3/fault.o: CFLAGS += -trapuv -build/src/boot_O2_g3/fault_drawer.o: CFLAGS += -trapuv +build/src/boot/fault.o: CFLAGS += -trapuv +build/src/boot/fault_drawer.o: CFLAGS += -trapuv build/src/code/jpegutils.o: OPTFLAGS := -O2 build/src/code/jpegdecoder.o: OPTFLAGS := -O2 @@ -230,8 +238,8 @@ build/src/libultra/libc/llcvt.o: OPTFLAGS := -O1 build/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32 # cc & asm-processor -build/src/boot_O2/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- -build/src/boot_O2_g3/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +build/src/boot/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +build/src/boot/O2/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- build/src/libultra/%.o: CC := $(CC_OLD) # Needed at least until voice is decompiled @@ -303,9 +311,10 @@ setup: $(MAKE) -C tools python3 tools/fixbaserom.py python3 tools/extract_baserom.py + python3 tools/decompress_yars.py assets: - python3 extract_assets.py -j $(N_THREADS) + python3 extract_assets.py -j $(N_THREADS) -Z Wno-hardcoded-pointer ## Assembly generation disasm: @@ -344,6 +353,10 @@ build/assets/%.o: assets/%.c $(OBJCOPY_BIN) $(RM_MDEBUG) +build/assets/archives/%.yar.o: build/assets/archives/%.o + $(MAKEYAR) $< $(@:.yar.o=.yar.bin) $(@:.yar.o=.symbols.o) + $(OBJCOPY) -I binary -O elf32-big $(@:.yar.o=.yar.bin) $@ + build/baserom/%.o: baserom/% $(OBJCOPY) -I binary -O elf32-big $< $@ @@ -392,3 +405,6 @@ build/assets/%.jpg.inc.c: assets/%.jpg $(ZAPD) bren -eh -i $< -o $@ -include $(DEP_FILES) + +# Print target for debugging +print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true diff --git a/README.md b/README.md index d94b47950..89d651dbd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![Build Status][jenkins-badge]][jenkins] [![Decompilation Progress][progress-badge]][progress] [![Contributors][contributors-badge]][contributors] [![Discord Channel][discord-badge]][discord] -[jenkins]: https://jenkins.deco.mp/job/MM/job/master -[jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FMM%2Fjob%2Fmaster +[jenkins]: https://jenkins.deco.mp/job/MM/job/main +[jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FMM%2Fjob%2Fmain [progress]: https://zelda64.dev/games/mm [progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/assets/csv/progress-mm-shield.json diff --git a/assets/xml/archives/icon_item_24_static.xml b/assets/xml/archives/icon_item_24_static.xml new file mode 100644 index 000000000..2997b546b --- /dev/null +++ b/assets/xml/archives/icon_item_24_static.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/icon_item_static.xml b/assets/xml/archives/icon_item_static.xml new file mode 100644 index 000000000..3480d704a --- /dev/null +++ b/assets/xml/archives/icon_item_static.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/item_name_static.xml b/assets/xml/archives/item_name_static.xml new file mode 100644 index 000000000..da0b903a0 --- /dev/null +++ b/assets/xml/archives/item_name_static.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/map_grand_static.xml b/assets/xml/archives/map_grand_static.xml new file mode 100644 index 000000000..d5d80bdd6 --- /dev/null +++ b/assets/xml/archives/map_grand_static.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/map_i_static.xml b/assets/xml/archives/map_i_static.xml new file mode 100644 index 000000000..dbb64185d --- /dev/null +++ b/assets/xml/archives/map_i_static.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/map_name_static.xml b/assets/xml/archives/map_name_static.xml new file mode 100644 index 000000000..fe392eb03 --- /dev/null +++ b/assets/xml/archives/map_name_static.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/archives/schedule_dma_static.xml b/assets/xml/archives/schedule_dma_static.xml new file mode 100644 index 000000000..c71bdb413 --- /dev/null +++ b/assets/xml/archives/schedule_dma_static.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/schedule_static.xml b/assets/xml/interface/schedule_static.xml index 68b097d51..cf87038ce 100644 --- a/assets/xml/interface/schedule_static.xml +++ b/assets/xml/interface/schedule_static.xml @@ -12,6 +12,7 @@ + @@ -30,9 +31,29 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/interface/week_static.xml b/assets/xml/interface/week_static.xml index 12cc885fa..e2b098410 100644 --- a/assets/xml/interface/week_static.xml +++ b/assets/xml/interface/week_static.xml @@ -1,7 +1,7 @@ - - - + + + diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 8a78a1709..37fb3fc61 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1,77 +1,90 @@  - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1146,7 +1159,7 @@ - + @@ -1210,8 +1223,8 @@ - - + + @@ -1268,7 +1281,7 @@ - + @@ -1288,8 +1301,8 @@ - - + + @@ -1473,9 +1486,9 @@ - - - + + + diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml index fb17e4e75..8bc8aa5e3 100644 --- a/assets/xml/objects/object_ani.xml +++ b/assets/xml/objects/object_ani.xml @@ -8,32 +8,32 @@ - + - + - + - + - + - + - + - + - + diff --git a/assets/xml/objects/object_az.xml b/assets/xml/objects/object_az.xml index ea6fd5e7d..42e5bdc61 100644 --- a/assets/xml/objects/object_az.xml +++ b/assets/xml/objects/object_az.xml @@ -64,8 +64,8 @@ - - + + diff --git a/assets/xml/objects/object_bal.xml b/assets/xml/objects/object_bal.xml index a31c0e29f..c98ffb43d 100644 --- a/assets/xml/objects/object_bal.xml +++ b/assets/xml/objects/object_bal.xml @@ -1,81 +1,94 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bba.xml b/assets/xml/objects/object_bba.xml index c3a5d0424..54706c2e3 100644 --- a/assets/xml/objects/object_bba.xml +++ b/assets/xml/objects/object_bba.xml @@ -52,18 +52,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index 272968b8d..9008fb381 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -1,62 +1,79 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -73,6 +90,8 @@ + + @@ -84,6 +103,8 @@ + + @@ -107,6 +128,8 @@ + + diff --git a/assets/xml/objects/object_big_fwall.xml b/assets/xml/objects/object_big_fwall.xml index bb8b838be..f1becbe8e 100644 --- a/assets/xml/objects/object_big_fwall.xml +++ b/assets/xml/objects/object_big_fwall.xml @@ -1,6 +1,7 @@  + - - + + diff --git a/assets/xml/objects/object_bigpo.xml b/assets/xml/objects/object_bigpo.xml index e10052e3c..fbde9e8e5 100644 --- a/assets/xml/objects/object_bigpo.xml +++ b/assets/xml/objects/object_bigpo.xml @@ -1,47 +1,63 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bombf.xml b/assets/xml/objects/object_bombf.xml index f27d67bc1..ca635875b 100644 --- a/assets/xml/objects/object_bombf.xml +++ b/assets/xml/objects/object_bombf.xml @@ -1,11 +1,14 @@  - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_boss02.xml b/assets/xml/objects/object_boss02.xml index 8a80a57f2..0f2fdd052 100644 --- a/assets/xml/objects/object_boss02.xml +++ b/assets/xml/objects/object_boss02.xml @@ -36,13 +36,13 @@ - - - + + + - - - + + + diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml index f4def4991..0b4ab9aa2 100644 --- a/assets/xml/objects/object_boss03.xml +++ b/assets/xml/objects/object_boss03.xml @@ -5,7 +5,7 @@ whip assets, along with an unused duplicate of the small fishes. --> - + @@ -69,12 +69,12 @@ - + - - + + diff --git a/assets/xml/objects/object_boss07.xml b/assets/xml/objects/object_boss07.xml index ac2f9afc1..2d3aa4fa1 100644 --- a/assets/xml/objects/object_boss07.xml +++ b/assets/xml/objects/object_boss07.xml @@ -10,7 +10,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -150,13 +150,13 @@ - - - - + + + + - + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index c0603a6cf..8bb2b7efe 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -11,12 +11,12 @@ - - - - - - + + + + + + @@ -24,7 +24,7 @@ - + diff --git a/assets/xml/objects/object_comb.xml b/assets/xml/objects/object_comb.xml index d2b00b0dd..2bea4db20 100644 --- a/assets/xml/objects/object_comb.xml +++ b/assets/xml/objects/object_comb.xml @@ -1,8 +1,12 @@  + - - - - + + + + + + + diff --git a/assets/xml/objects/object_dblue_object.xml b/assets/xml/objects/object_dblue_object.xml index 08cb20ec3..63d28bd33 100644 --- a/assets/xml/objects/object_dblue_object.xml +++ b/assets/xml/objects/object_dblue_object.xml @@ -14,7 +14,7 @@ - + diff --git a/assets/xml/objects/object_dinofos.xml b/assets/xml/objects/object_dinofos.xml index 435d60e95..c3c575b0f 100644 --- a/assets/xml/objects/object_dinofos.xml +++ b/assets/xml/objects/object_dinofos.xml @@ -1,71 +1,76 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dkjail_obj.xml b/assets/xml/objects/object_dkjail_obj.xml index d0d2775c3..0827c3814 100644 --- a/assets/xml/objects/object_dkjail_obj.xml +++ b/assets/xml/objects/object_dkjail_obj.xml @@ -1,9 +1,10 @@  + - - - - + + + + diff --git a/assets/xml/objects/object_dnj.xml b/assets/xml/objects/object_dnj.xml index 3b4f27579..f7f9d830c 100644 --- a/assets/xml/objects/object_dnj.xml +++ b/assets/xml/objects/object_dnj.xml @@ -59,7 +59,7 @@ - + diff --git a/assets/xml/objects/object_dnk.xml b/assets/xml/objects/object_dnk.xml index b085eed28..0e35b1f97 100644 --- a/assets/xml/objects/object_dnk.xml +++ b/assets/xml/objects/object_dnk.xml @@ -33,7 +33,7 @@ - + diff --git a/assets/xml/objects/object_dns.xml b/assets/xml/objects/object_dns.xml index e5d91326f..903dfba6c 100644 --- a/assets/xml/objects/object_dns.xml +++ b/assets/xml/objects/object_dns.xml @@ -25,7 +25,7 @@ " Format="rgba16" Width="8" Height="8" Offset="0x28E8" /> - + diff --git a/assets/xml/objects/object_dnt.xml b/assets/xml/objects/object_dnt.xml index 9f3fcf996..658720258 100644 --- a/assets/xml/objects/object_dnt.xml +++ b/assets/xml/objects/object_dnt.xml @@ -1,91 +1,106 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dog.xml b/assets/xml/objects/object_dog.xml index 0e3d318b4..d0f306b24 100644 --- a/assets/xml/objects/object_dog.xml +++ b/assets/xml/objects/object_dog.xml @@ -3,13 +3,13 @@ - + - + diff --git a/assets/xml/objects/object_dor01.xml b/assets/xml/objects/object_dor01.xml index 9708d97c6..727949d60 100644 --- a/assets/xml/objects/object_dor01.xml +++ b/assets/xml/objects/object_dor01.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_dor02.xml b/assets/xml/objects/object_dor02.xml index 3cc3d1411..402fdd499 100644 --- a/assets/xml/objects/object_dor02.xml +++ b/assets/xml/objects/object_dor02.xml @@ -1,6 +1,7 @@  + - + diff --git a/assets/xml/objects/object_dor04.xml b/assets/xml/objects/object_dor04.xml index 4e78d9efe..afb348c7d 100644 --- a/assets/xml/objects/object_dor04.xml +++ b/assets/xml/objects/object_dor04.xml @@ -1,6 +1,7 @@  + - + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml index da6ce5e87..e4757de31 100644 --- a/assets/xml/objects/object_ds2n.xml +++ b/assets/xml/objects/object_ds2n.xml @@ -7,22 +7,22 @@ - + - + - + - + - - - + + + @@ -49,9 +49,9 @@ - - - + + + @@ -70,23 +70,23 @@ - + - + - + - + - + diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml index 91b9a55fb..b321240cc 100644 --- a/assets/xml/objects/object_dy_obj.xml +++ b/assets/xml/objects/object_dy_obj.xml @@ -1,51 +1,62 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -55,42 +66,46 @@ + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index a7ca81b55..c28ae3c81 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -1,13 +1,16 @@  - - + + + - - - - - + + + + + + + diff --git a/assets/xml/objects/object_eg.xml b/assets/xml/objects/object_eg.xml index 26e5c86bc..a79ff6332 100644 --- a/assets/xml/objects/object_eg.xml +++ b/assets/xml/objects/object_eg.xml @@ -34,20 +34,20 @@ - - - - - - - - + + + + + + + + - - + + diff --git a/assets/xml/objects/object_f40_switch.xml b/assets/xml/objects/object_f40_switch.xml index 7e7fb5b1c..6be5a5bd5 100644 --- a/assets/xml/objects/object_f40_switch.xml +++ b/assets/xml/objects/object_f40_switch.xml @@ -1,9 +1,10 @@  + - - - - - + + + + + diff --git a/assets/xml/objects/object_f52_obj.xml b/assets/xml/objects/object_f52_obj.xml index 697a5b100..0da643be0 100644 --- a/assets/xml/objects/object_f52_obj.xml +++ b/assets/xml/objects/object_f52_obj.xml @@ -1,10 +1,10 @@  - - + + - - + + diff --git a/assets/xml/objects/object_famos.xml b/assets/xml/objects/object_famos.xml index 186e2b59b..f62604424 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_firefly.xml b/assets/xml/objects/object_firefly.xml index acdcedb1d..93e5640b6 100644 --- a/assets/xml/objects/object_firefly.xml +++ b/assets/xml/objects/object_firefly.xml @@ -1,54 +1,83 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index 918c0eb5f..318cb53d5 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -1,162 +1,315 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + + + + + + + + - + + + + + + + + + + + - + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + - - + + + + + + + + + - + + + + + + + + + + + + + - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_fr.xml b/assets/xml/objects/object_fr.xml index f7fa4354b..3262c6782 100644 --- a/assets/xml/objects/object_fr.xml +++ b/assets/xml/objects/object_fr.xml @@ -1,67 +1,68 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fsn.xml b/assets/xml/objects/object_fsn.xml index 37867dc32..5ca67c207 100644 --- a/assets/xml/objects/object_fsn.xml +++ b/assets/xml/objects/object_fsn.xml @@ -6,10 +6,10 @@ - + - + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml index fb41a85e8..c70db90e8 100644 --- a/assets/xml/objects/object_fu.xml +++ b/assets/xml/objects/object_fu.xml @@ -1,52 +1,61 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_funen.xml b/assets/xml/objects/object_funen.xml index 7a0410008..0f9d0a484 100644 --- a/assets/xml/objects/object_funen.xml +++ b/assets/xml/objects/object_funen.xml @@ -1,6 +1,7 @@  + - - + + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index a9c930215..db123e78c 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -3,16 +3,16 @@ - - - - - - - + + + + + + + - + diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml index 5590677ea..3b5dfa4ea 100644 --- a/assets/xml/objects/object_geldb.xml +++ b/assets/xml/objects/object_geldb.xml @@ -1,78 +1,84 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gg.xml b/assets/xml/objects/object_gg.xml index f7483e338..45fe1b172 100644 --- a/assets/xml/objects/object_gg.xml +++ b/assets/xml/objects/object_gg.xml @@ -39,19 +39,19 @@ - + - - - - - - - - - - - + + + + + + + + + + + @@ -72,6 +72,6 @@ - + diff --git a/assets/xml/objects/object_ghaka.xml b/assets/xml/objects/object_ghaka.xml index 6ca9a32b0..91ae8fa4f 100644 --- a/assets/xml/objects/object_ghaka.xml +++ b/assets/xml/objects/object_ghaka.xml @@ -1,12 +1,12 @@  - + - + - + diff --git a/assets/xml/objects/object_gi_sword_4.xml b/assets/xml/objects/object_gi_sword_4.xml index 7732259c6..082c27e2a 100644 --- a/assets/xml/objects/object_gi_sword_4.xml +++ b/assets/xml/objects/object_gi_sword_4.xml @@ -1,14 +1,14 @@  - + - - - + + + - - - - + + + + diff --git a/assets/xml/objects/object_gk.xml b/assets/xml/objects/object_gk.xml index b36aef153..40abd45a2 100644 --- a/assets/xml/objects/object_gk.xml +++ b/assets/xml/objects/object_gk.xml @@ -19,10 +19,10 @@ - + - - + + @@ -43,17 +43,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index 757e652c9..45da7754a 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -1,15 +1,15 @@  - - + + - - - - - + + + + + @@ -31,7 +31,7 @@ - + @@ -71,8 +71,8 @@ - - - + + + diff --git a/assets/xml/objects/object_gm.xml b/assets/xml/objects/object_gm.xml index 50c852ade..80edb8aeb 100644 --- a/assets/xml/objects/object_gm.xml +++ b/assets/xml/objects/object_gm.xml @@ -1,6 +1,6 @@  + - - + diff --git a/assets/xml/objects/object_goroiwa.xml b/assets/xml/objects/object_goroiwa.xml index e6ddfe7c1..df6aa04bb 100644 --- a/assets/xml/objects/object_goroiwa.xml +++ b/assets/xml/objects/object_goroiwa.xml @@ -1,26 +1,26 @@  - + - - - - - - - - + + + + + + + + - - - - - + + + + + diff --git a/assets/xml/objects/object_goronswitch.xml b/assets/xml/objects/object_goronswitch.xml index a6a0f996f..2f7592664 100644 --- a/assets/xml/objects/object_goronswitch.xml +++ b/assets/xml/objects/object_goronswitch.xml @@ -1,10 +1,10 @@  - - - - - + + + + + diff --git a/assets/xml/objects/object_ha.xml b/assets/xml/objects/object_ha.xml index 94973c809..860b592df 100644 --- a/assets/xml/objects/object_ha.xml +++ b/assets/xml/objects/object_ha.xml @@ -1,135 +1,162 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_haka_obj.xml b/assets/xml/objects/object_haka_obj.xml index 57f34f0d1..2746eb690 100644 --- a/assets/xml/objects/object_haka_obj.xml +++ b/assets/xml/objects/object_haka_obj.xml @@ -1,14 +1,14 @@  - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_hakaisi.xml b/assets/xml/objects/object_hakaisi.xml index 227fc4cf8..c0e200ea7 100644 --- a/assets/xml/objects/object_hakaisi.xml +++ b/assets/xml/objects/object_hakaisi.xml @@ -5,11 +5,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_hakugin_demo.xml b/assets/xml/objects/object_hakugin_demo.xml index 8c8b5837c..1de3cd695 100644 --- a/assets/xml/objects/object_hakugin_demo.xml +++ b/assets/xml/objects/object_hakugin_demo.xml @@ -1,9 +1,9 @@  - - - - + + + + diff --git a/assets/xml/objects/object_hakugin_obj.xml b/assets/xml/objects/object_hakugin_obj.xml index b4badbd1d..883a954a6 100644 --- a/assets/xml/objects/object_hakugin_obj.xml +++ b/assets/xml/objects/object_hakugin_obj.xml @@ -1,7 +1,7 @@  - + @@ -10,27 +10,27 @@ - + - + - + - + - + @@ -40,7 +40,7 @@ - + @@ -50,11 +50,11 @@ - + - - - + + + @@ -63,22 +63,22 @@ - + - + - + - + - + - + - + diff --git a/assets/xml/objects/object_hana.xml b/assets/xml/objects/object_hana.xml index 3812a4ff5..872bdc806 100644 --- a/assets/xml/objects/object_hana.xml +++ b/assets/xml/objects/object_hana.xml @@ -1,13 +1,19 @@  + - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_harfgibud.xml b/assets/xml/objects/object_harfgibud.xml index 99578e996..437e3b70d 100644 --- a/assets/xml/objects/object_harfgibud.xml +++ b/assets/xml/objects/object_harfgibud.xml @@ -3,11 +3,11 @@ - - - - - + + + + + @@ -61,11 +61,11 @@ - - - + + + - + @@ -121,11 +121,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_hariko.xml b/assets/xml/objects/object_hariko.xml index 5cb2d8328..9af628304 100644 --- a/assets/xml/objects/object_hariko.xml +++ b/assets/xml/objects/object_hariko.xml @@ -1,8 +1,8 @@  - - + + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml index 9271520b7..cbee285e3 100644 --- a/assets/xml/objects/object_hata.xml +++ b/assets/xml/objects/object_hata.xml @@ -1,39 +1,50 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hgdoor.xml b/assets/xml/objects/object_hgdoor.xml index e897103bf..8a0bb4c70 100644 --- a/assets/xml/objects/object_hgdoor.xml +++ b/assets/xml/objects/object_hgdoor.xml @@ -3,11 +3,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_hintnuts.xml b/assets/xml/objects/object_hintnuts.xml index 483623988..99ea55d87 100644 --- a/assets/xml/objects/object_hintnuts.xml +++ b/assets/xml/objects/object_hintnuts.xml @@ -1,6 +1,6 @@  - + @@ -10,7 +10,7 @@ - + @@ -28,13 +28,13 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_horse_game_check.xml b/assets/xml/objects/object_horse_game_check.xml index 1ea72ac57..fd5e2f398 100644 --- a/assets/xml/objects/object_horse_game_check.xml +++ b/assets/xml/objects/object_horse_game_check.xml @@ -8,9 +8,9 @@ - + - + diff --git a/assets/xml/objects/object_horse_link_child.xml b/assets/xml/objects/object_horse_link_child.xml index 60178badb..535ea1d86 100644 --- a/assets/xml/objects/object_horse_link_child.xml +++ b/assets/xml/objects/object_horse_link_child.xml @@ -1,4 +1,5 @@  + @@ -9,10 +10,13 @@ - - - - + + + + + + + @@ -20,16 +24,20 @@ - - - - - - - - - + + + + + + + + + + + + + @@ -76,14 +84,17 @@ - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_hs.xml b/assets/xml/objects/object_hs.xml index 19ea49b6b..be333f1dc 100644 --- a/assets/xml/objects/object_hs.xml +++ b/assets/xml/objects/object_hs.xml @@ -1,9 +1,9 @@  - - - + + + @@ -30,12 +30,12 @@ - + - + - + @@ -44,8 +44,8 @@ - + - + diff --git a/assets/xml/objects/object_hsstump.xml b/assets/xml/objects/object_hsstump.xml index f94f0ed4e..f8e466603 100644 --- a/assets/xml/objects/object_hsstump.xml +++ b/assets/xml/objects/object_hsstump.xml @@ -1,10 +1,10 @@  - + - + diff --git a/assets/xml/objects/object_hunsui.xml b/assets/xml/objects/object_hunsui.xml index 878bf704d..a97f8f094 100644 --- a/assets/xml/objects/object_hunsui.xml +++ b/assets/xml/objects/object_hunsui.xml @@ -1,12 +1,12 @@  - + - - + + - + diff --git a/assets/xml/objects/object_ice_block.xml b/assets/xml/objects/object_ice_block.xml index dd25c06d5..4b5cd47d4 100644 --- a/assets/xml/objects/object_ice_block.xml +++ b/assets/xml/objects/object_ice_block.xml @@ -1,23 +1,23 @@  - - + + - + - - + + - - + + diff --git a/assets/xml/objects/object_icefloe.xml b/assets/xml/objects/object_icefloe.xml index 2427052af..0440fa4bb 100644 --- a/assets/xml/objects/object_icefloe.xml +++ b/assets/xml/objects/object_icefloe.xml @@ -1,7 +1,7 @@  - + - + diff --git a/assets/xml/objects/object_icicle.xml b/assets/xml/objects/object_icicle.xml index 4f7bab8a2..d3275aa46 100644 --- a/assets/xml/objects/object_icicle.xml +++ b/assets/xml/objects/object_icicle.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 352b82487..66df1e9ed 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -1,34 +1,34 @@  - - - - - - - - - - - + + + + + + + + + + + - - + + - + - - - + + + - + @@ -52,25 +52,25 @@ - - - + + + - - + + - - - - - + + + + + - - - - - - + + + + + + diff --git a/assets/xml/objects/object_ikana_obj.xml b/assets/xml/objects/object_ikana_obj.xml index e0490a349..0b67e7757 100644 --- a/assets/xml/objects/object_ikana_obj.xml +++ b/assets/xml/objects/object_ikana_obj.xml @@ -1,38 +1,38 @@  - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - - + + - - - - - - - - + + + + + + + + - + @@ -58,10 +58,10 @@ - - - - + + + + diff --git a/assets/xml/objects/object_ikn_demo.xml b/assets/xml/objects/object_ikn_demo.xml index 53d5c65a1..bbb803499 100644 --- a/assets/xml/objects/object_ikn_demo.xml +++ b/assets/xml/objects/object_ikn_demo.xml @@ -1,7 +1,7 @@  - + @@ -44,13 +44,13 @@ - - - - - - - + + + + + + + @@ -64,19 +64,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -90,18 +90,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ikninside_obj.xml b/assets/xml/objects/object_ikninside_obj.xml index 98ae6d34f..26d1e1206 100644 --- a/assets/xml/objects/object_ikninside_obj.xml +++ b/assets/xml/objects/object_ikninside_obj.xml @@ -1,15 +1,15 @@  - - + + - + - + @@ -22,27 +22,27 @@ - - - - - - - - + + + + + + + + - - + + - - - + + + - + diff --git a/assets/xml/objects/object_iknv_obj.xml b/assets/xml/objects/object_iknv_obj.xml index 58926c0e3..5c54c71da 100644 --- a/assets/xml/objects/object_iknv_obj.xml +++ b/assets/xml/objects/object_iknv_obj.xml @@ -24,19 +24,19 @@ - - + + - - + + - - + + - - - - + + + + @@ -57,14 +57,14 @@ - + - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_in.xml b/assets/xml/objects/object_in.xml index 15b2382aa..ee7ceb3a0 100644 --- a/assets/xml/objects/object_in.xml +++ b/assets/xml/objects/object_in.xml @@ -1,10 +1,10 @@  - - - + + + - + @@ -113,21 +113,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_in2.xml b/assets/xml/objects/object_in2.xml index bcd04091b..e903185b4 100644 --- a/assets/xml/objects/object_in2.xml +++ b/assets/xml/objects/object_in2.xml @@ -1,6 +1,6 @@  - + @@ -67,16 +67,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_ishi.xml b/assets/xml/objects/object_ishi.xml index 6e48cf5f4..5f53b90ac 100644 --- a/assets/xml/objects/object_ishi.xml +++ b/assets/xml/objects/object_ishi.xml @@ -1,6 +1,7 @@  + - - + + diff --git a/assets/xml/objects/object_js.xml b/assets/xml/objects/object_js.xml index 1335b8287..6d93f7ac2 100644 --- a/assets/xml/objects/object_js.xml +++ b/assets/xml/objects/object_js.xml @@ -1,10 +1,10 @@  - - - - - + + + + + @@ -40,6 +40,6 @@ - + diff --git a/assets/xml/objects/object_jso.xml b/assets/xml/objects/object_jso.xml index a397311c4..d94ffdafe 100644 --- a/assets/xml/objects/object_jso.xml +++ b/assets/xml/objects/object_jso.xml @@ -1,122 +1,147 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ka.xml b/assets/xml/objects/object_ka.xml index 69ea2d929..914617b41 100644 --- a/assets/xml/objects/object_ka.xml +++ b/assets/xml/objects/object_ka.xml @@ -1,6 +1,7 @@  + - + @@ -59,11 +60,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_kaizoku_obj.xml b/assets/xml/objects/object_kaizoku_obj.xml index 9ae61accf..c13f32125 100644 --- a/assets/xml/objects/object_kaizoku_obj.xml +++ b/assets/xml/objects/object_kaizoku_obj.xml @@ -1,22 +1,22 @@  - + - - + + - - + + - + @@ -27,15 +27,15 @@ - - - + + + - + - + diff --git a/assets/xml/objects/object_kamejima.xml b/assets/xml/objects/object_kamejima.xml index cce285475..272a541be 100644 --- a/assets/xml/objects/object_kamejima.xml +++ b/assets/xml/objects/object_kamejima.xml @@ -5,29 +5,29 @@ - + - + - - + + - - - + + + - + - + @@ -88,12 +88,12 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_kanban.xml b/assets/xml/objects/object_kanban.xml index b821aa288..e5baa90ee 100644 --- a/assets/xml/objects/object_kanban.xml +++ b/assets/xml/objects/object_kanban.xml @@ -1,18 +1,19 @@  + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kbt.xml b/assets/xml/objects/object_kbt.xml index 102aed91d..bf6078da8 100644 --- a/assets/xml/objects/object_kbt.xml +++ b/assets/xml/objects/object_kbt.xml @@ -1,16 +1,16 @@  - - - - - - - - - - - + + + + + + + + + + + @@ -69,7 +69,7 @@ - - + + diff --git a/assets/xml/objects/object_keikoku_demo.xml b/assets/xml/objects/object_keikoku_demo.xml index 3a0a20b65..b9433a48f 100644 --- a/assets/xml/objects/object_keikoku_demo.xml +++ b/assets/xml/objects/object_keikoku_demo.xml @@ -7,21 +7,21 @@ - + - + - + - + - + diff --git a/assets/xml/objects/object_keikoku_obj.xml b/assets/xml/objects/object_keikoku_obj.xml index ff5a6899c..b6d61e91f 100644 --- a/assets/xml/objects/object_keikoku_obj.xml +++ b/assets/xml/objects/object_keikoku_obj.xml @@ -8,19 +8,19 @@ - + - + - + - + diff --git a/assets/xml/objects/object_kepn_koya.xml b/assets/xml/objects/object_kepn_koya.xml index 893892d25..cc14f0556 100644 --- a/assets/xml/objects/object_kepn_koya.xml +++ b/assets/xml/objects/object_kepn_koya.xml @@ -1,7 +1,7 @@  - - + + @@ -13,6 +13,6 @@ - + diff --git a/assets/xml/objects/object_kgy.xml b/assets/xml/objects/object_kgy.xml index 5bbf17793..b83234b8c 100644 --- a/assets/xml/objects/object_kgy.xml +++ b/assets/xml/objects/object_kgy.xml @@ -1,13 +1,13 @@  - - - - - - - - + + + + + + + + @@ -39,10 +39,10 @@ - + - + @@ -68,7 +68,7 @@ - - + + diff --git a/assets/xml/objects/object_kibako.xml b/assets/xml/objects/object_kibako.xml index 43276080a..2cdd6ce36 100644 --- a/assets/xml/objects/object_kibako.xml +++ b/assets/xml/objects/object_kibako.xml @@ -2,8 +2,8 @@ - + - + diff --git a/assets/xml/objects/object_kibako2.xml b/assets/xml/objects/object_kibako2.xml index 4b6ce5ac7..180038e82 100644 --- a/assets/xml/objects/object_kibako2.xml +++ b/assets/xml/objects/object_kibako2.xml @@ -4,11 +4,11 @@ - - + + - - + + diff --git a/assets/xml/objects/object_kin2_obj.xml b/assets/xml/objects/object_kin2_obj.xml index d36766ee4..6e63f19cd 100644 --- a/assets/xml/objects/object_kin2_obj.xml +++ b/assets/xml/objects/object_kin2_obj.xml @@ -4,32 +4,28 @@ Piece, bookshelves and chests of drawers. --> - + + - - - - + + + - + + + - - - - + + + - - + + + - - - - - - - - - + + + diff --git a/assets/xml/objects/object_kinsta1_obj.xml b/assets/xml/objects/object_kinsta1_obj.xml index 48d40c527..d2a55b04d 100644 --- a/assets/xml/objects/object_kinsta1_obj.xml +++ b/assets/xml/objects/object_kinsta1_obj.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_kinsta2_obj.xml b/assets/xml/objects/object_kinsta2_obj.xml index f27778b1a..66bec962d 100644 --- a/assets/xml/objects/object_kinsta2_obj.xml +++ b/assets/xml/objects/object_kinsta2_obj.xml @@ -1,6 +1,7 @@  + - - + + diff --git a/assets/xml/objects/object_kitan.xml b/assets/xml/objects/object_kitan.xml index edc2e5cc6..cd7db0005 100644 --- a/assets/xml/objects/object_kitan.xml +++ b/assets/xml/objects/object_kitan.xml @@ -1,8 +1,8 @@  - - - + + + diff --git a/assets/xml/objects/object_knight.xml b/assets/xml/objects/object_knight.xml index fa0e900e4..2a8595627 100644 --- a/assets/xml/objects/object_knight.xml +++ b/assets/xml/objects/object_knight.xml @@ -1,49 +1,57 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -101,14 +109,14 @@ - - + + - + @@ -201,11 +209,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_kumo30.xml b/assets/xml/objects/object_kumo30.xml index 24e8d3974..3a74c0988 100644 --- a/assets/xml/objects/object_kumo30.xml +++ b/assets/xml/objects/object_kumo30.xml @@ -1,12 +1,12 @@  - - + + - + diff --git a/assets/xml/objects/object_kusa.xml b/assets/xml/objects/object_kusa.xml index 36c61f364..362e47114 100644 --- a/assets/xml/objects/object_kusa.xml +++ b/assets/xml/objects/object_kusa.xml @@ -1,6 +1,6 @@  - - + + diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index f500ba141..6295d7b1d 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -1,17 +1,17 @@  - - - - - - - - - - - - + + + + + + + + + + + + @@ -82,12 +82,12 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_kzsaku.xml b/assets/xml/objects/object_kzsaku.xml index 4cfce2de2..fa157409e 100644 --- a/assets/xml/objects/object_kzsaku.xml +++ b/assets/xml/objects/object_kzsaku.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_ladder.xml b/assets/xml/objects/object_ladder.xml index 6e42412ec..2fc01e5bf 100644 --- a/assets/xml/objects/object_ladder.xml +++ b/assets/xml/objects/object_ladder.xml @@ -1,13 +1,23 @@  + - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_last_obj.xml b/assets/xml/objects/object_last_obj.xml index 03dbddcf2..bd452a408 100644 --- a/assets/xml/objects/object_last_obj.xml +++ b/assets/xml/objects/object_last_obj.xml @@ -1,21 +1,21 @@  - + - - + + - - + + - + diff --git a/assets/xml/objects/object_lastday.xml b/assets/xml/objects/object_lastday.xml index e447edfbf..4c6b5fdb4 100644 --- a/assets/xml/objects/object_lastday.xml +++ b/assets/xml/objects/object_lastday.xml @@ -3,13 +3,13 @@ - + - + - + - + diff --git a/assets/xml/objects/object_lbfshot.xml b/assets/xml/objects/object_lbfshot.xml index 325ddf49e..881f877b6 100644 --- a/assets/xml/objects/object_lbfshot.xml +++ b/assets/xml/objects/object_lbfshot.xml @@ -1,9 +1,9 @@  - - + + - + diff --git a/assets/xml/objects/object_lightblock.xml b/assets/xml/objects/object_lightblock.xml index 207b03020..07c5da688 100644 --- a/assets/xml/objects/object_lightblock.xml +++ b/assets/xml/objects/object_lightblock.xml @@ -1,9 +1,10 @@  + - - - - - + + + + + diff --git a/assets/xml/objects/object_lightswitch.xml b/assets/xml/objects/object_lightswitch.xml index 0a374033b..a8b26bc51 100644 --- a/assets/xml/objects/object_lightswitch.xml +++ b/assets/xml/objects/object_lightswitch.xml @@ -1,11 +1,12 @@  - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_link_goron.xml b/assets/xml/objects/object_link_goron.xml index 76017884e..b6dd7fe6f 100644 --- a/assets/xml/objects/object_link_goron.xml +++ b/assets/xml/objects/object_link_goron.xml @@ -42,7 +42,7 @@ - + @@ -72,10 +72,10 @@ - + - + @@ -90,7 +90,7 @@ - + diff --git a/assets/xml/objects/object_link_zora.xml b/assets/xml/objects/object_link_zora.xml index 5833293b8..be4c54274 100644 --- a/assets/xml/objects/object_link_zora.xml +++ b/assets/xml/objects/object_link_zora.xml @@ -80,7 +80,7 @@ - + diff --git a/assets/xml/objects/object_lotus.xml b/assets/xml/objects/object_lotus.xml index b9f40033c..923218811 100644 --- a/assets/xml/objects/object_lotus.xml +++ b/assets/xml/objects/object_lotus.xml @@ -4,6 +4,6 @@ - + diff --git a/assets/xml/objects/object_mamenoki.xml b/assets/xml/objects/object_mamenoki.xml index 9ce4644c3..9fa5b6832 100644 --- a/assets/xml/objects/object_mamenoki.xml +++ b/assets/xml/objects/object_mamenoki.xml @@ -1,9 +1,9 @@  - - - - + + + + diff --git a/assets/xml/objects/object_maruta.xml b/assets/xml/objects/object_maruta.xml index e61e1162b..c44907b1d 100644 --- a/assets/xml/objects/object_maruta.xml +++ b/assets/xml/objects/object_maruta.xml @@ -3,14 +3,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_mastergolon.xml b/assets/xml/objects/object_mastergolon.xml index 35eb9d285..481fb7cde 100644 --- a/assets/xml/objects/object_mastergolon.xml +++ b/assets/xml/objects/object_mastergolon.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_masterzoora.xml b/assets/xml/objects/object_masterzoora.xml index f21b99b50..5a72744da 100644 --- a/assets/xml/objects/object_masterzoora.xml +++ b/assets/xml/objects/object_masterzoora.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_milkbar.xml b/assets/xml/objects/object_milkbar.xml index 38bec140b..f3e732514 100644 --- a/assets/xml/objects/object_milkbar.xml +++ b/assets/xml/objects/object_milkbar.xml @@ -1,27 +1,27 @@  - + - + - + - + - + - - + + @@ -33,12 +33,12 @@ - + - - + + diff --git a/assets/xml/objects/object_mir_ray.xml b/assets/xml/objects/object_mir_ray.xml index 962982322..c0b1cf6f2 100644 --- a/assets/xml/objects/object_mir_ray.xml +++ b/assets/xml/objects/object_mir_ray.xml @@ -1,7 +1,7 @@  - + diff --git a/assets/xml/objects/object_mk.xml b/assets/xml/objects/object_mk.xml index 087fcc9e0..0db6c703d 100644 --- a/assets/xml/objects/object_mk.xml +++ b/assets/xml/objects/object_mk.xml @@ -1,45 +1,46 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mkk.xml b/assets/xml/objects/object_mkk.xml index 17f36f323..445d26f0d 100644 --- a/assets/xml/objects/object_mkk.xml +++ b/assets/xml/objects/object_mkk.xml @@ -1,15 +1,16 @@  + - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_mm.xml b/assets/xml/objects/object_mm.xml index 43e8e930b..b7b727d4e 100644 --- a/assets/xml/objects/object_mm.xml +++ b/assets/xml/objects/object_mm.xml @@ -1,10 +1,10 @@  - - - - - + + + + + @@ -32,9 +32,9 @@ - - - + + + @@ -55,14 +55,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_mnk.xml b/assets/xml/objects/object_mnk.xml index d585972c0..794069ee7 100644 --- a/assets/xml/objects/object_mnk.xml +++ b/assets/xml/objects/object_mnk.xml @@ -1,7 +1,7 @@  - + @@ -9,11 +9,11 @@ - - - - - + + + + + @@ -23,32 +23,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -73,7 +73,12 @@ - + + + + + + @@ -104,14 +109,14 @@ - - - - - - - - + + + + + + + + @@ -121,6 +126,6 @@ - + diff --git a/assets/xml/objects/object_moonend.xml b/assets/xml/objects/object_moonend.xml index 666e9e07c..4e4b5a6f2 100644 --- a/assets/xml/objects/object_moonend.xml +++ b/assets/xml/objects/object_moonend.xml @@ -34,7 +34,7 @@ - + diff --git a/assets/xml/objects/object_moonston.xml b/assets/xml/objects/object_moonston.xml index 58a920522..2945469f2 100644 --- a/assets/xml/objects/object_moonston.xml +++ b/assets/xml/objects/object_moonston.xml @@ -4,8 +4,8 @@ along with its associated fire trail. --> - - + + diff --git a/assets/xml/objects/object_ms.xml b/assets/xml/objects/object_ms.xml index 93828c76f..1b3f86145 100644 --- a/assets/xml/objects/object_ms.xml +++ b/assets/xml/objects/object_ms.xml @@ -1,32 +1,43 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml index 37886e8f5..a72b184c1 100644 --- a/assets/xml/objects/object_mu.xml +++ b/assets/xml/objects/object_mu.xml @@ -1,11 +1,11 @@  - - - - - + + + + + @@ -58,6 +58,6 @@ - + diff --git a/assets/xml/objects/object_niw.xml b/assets/xml/objects/object_niw.xml index 157d2b302..db47a439f 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_ob.xml b/assets/xml/objects/object_ob.xml index aa95db9bc..1efe524b4 100644 --- a/assets/xml/objects/object_ob.xml +++ b/assets/xml/objects/object_ob.xml @@ -55,20 +55,20 @@ - + - + - + - + diff --git a/assets/xml/objects/object_obj_chan.xml b/assets/xml/objects/object_obj_chan.xml index 8469110e4..0b378e8c1 100644 --- a/assets/xml/objects/object_obj_chan.xml +++ b/assets/xml/objects/object_obj_chan.xml @@ -1,13 +1,14 @@  + - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_obj_tokeidai.xml b/assets/xml/objects/object_obj_tokeidai.xml index 09e070254..94a302ea4 100644 --- a/assets/xml/objects/object_obj_tokeidai.xml +++ b/assets/xml/objects/object_obj_tokeidai.xml @@ -36,7 +36,7 @@ - + @@ -68,11 +68,11 @@ - + - + diff --git a/assets/xml/objects/object_obj_yasi.xml b/assets/xml/objects/object_obj_yasi.xml index a8e153edd..34ace132e 100644 --- a/assets/xml/objects/object_obj_yasi.xml +++ b/assets/xml/objects/object_obj_yasi.xml @@ -3,10 +3,10 @@ - - - - + + + + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index cc00b50a1..6b0755905 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -15,14 +15,12 @@ - - - - - - - - + + + + + + @@ -51,14 +49,11 @@ - - + - - - - - + + + diff --git a/assets/xml/objects/object_racetsubo.xml b/assets/xml/objects/object_racetsubo.xml index 6558fcbe5..08a17d00a 100644 --- a/assets/xml/objects/object_racetsubo.xml +++ b/assets/xml/objects/object_racetsubo.xml @@ -1,11 +1,12 @@  + - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_random_obj.xml b/assets/xml/objects/object_random_obj.xml index 9b9986ca1..509ed86c7 100644 --- a/assets/xml/objects/object_random_obj.xml +++ b/assets/xml/objects/object_random_obj.xml @@ -1,6 +1,7 @@  + - - + + diff --git a/assets/xml/objects/object_redead_obj.xml b/assets/xml/objects/object_redead_obj.xml index fd286d6e7..8460579b3 100644 --- a/assets/xml/objects/object_redead_obj.xml +++ b/assets/xml/objects/object_redead_obj.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_rotlift.xml b/assets/xml/objects/object_rotlift.xml index da5db27d7..c2acf0540 100644 --- a/assets/xml/objects/object_rotlift.xml +++ b/assets/xml/objects/object_rotlift.xml @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/assets/xml/objects/object_rr.xml b/assets/xml/objects/object_rr.xml index dbdba55c5..df974bb35 100644 --- a/assets/xml/objects/object_rr.xml +++ b/assets/xml/objects/object_rr.xml @@ -1,8 +1,8 @@  - - - - + + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index 72510149c..7d5823a50 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -17,7 +17,7 @@ - + @@ -74,12 +74,12 @@ - + - + diff --git a/assets/xml/objects/object_sdn.xml b/assets/xml/objects/object_sdn.xml index 8271480be..bcc1f7637 100644 --- a/assets/xml/objects/object_sdn.xml +++ b/assets/xml/objects/object_sdn.xml @@ -3,19 +3,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -33,17 +33,17 @@ - - - - - - - - - - - + + + + + + + + + + + @@ -61,6 +61,6 @@ - + diff --git a/assets/xml/objects/object_sekihig.xml b/assets/xml/objects/object_sekihig.xml index bb995bed4..de104df55 100644 --- a/assets/xml/objects/object_sekihig.xml +++ b/assets/xml/objects/object_sekihig.xml @@ -1,16 +1,19 @@  + - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihil.xml b/assets/xml/objects/object_sekihil.xml index fb9903875..3dbb57774 100644 --- a/assets/xml/objects/object_sekihil.xml +++ b/assets/xml/objects/object_sekihil.xml @@ -1,16 +1,19 @@  + - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihin.xml b/assets/xml/objects/object_sekihin.xml index 104f5f133..300a9ad58 100644 --- a/assets/xml/objects/object_sekihin.xml +++ b/assets/xml/objects/object_sekihin.xml @@ -1,17 +1,19 @@  + - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihiz.xml b/assets/xml/objects/object_sekihiz.xml index 9563d8b42..806279c98 100644 --- a/assets/xml/objects/object_sekihiz.xml +++ b/assets/xml/objects/object_sekihiz.xml @@ -1,9 +1,10 @@  + - - - - - + + + + + diff --git a/assets/xml/objects/object_shn.xml b/assets/xml/objects/object_shn.xml index c4b256f68..3e39b2eff 100644 --- a/assets/xml/objects/object_shn.xml +++ b/assets/xml/objects/object_shn.xml @@ -79,11 +79,11 @@ - - + + - - + + diff --git a/assets/xml/objects/object_sichitai_obj.xml b/assets/xml/objects/object_sichitai_obj.xml index d1179beab..03bc4f7f3 100644 --- a/assets/xml/objects/object_sichitai_obj.xml +++ b/assets/xml/objects/object_sichitai_obj.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index 78413a9de..b1afaf353 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -1,64 +1,65 @@  + - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/assets/xml/objects/object_snowwd.xml b/assets/xml/objects/object_snowwd.xml index c61d07beb..9bb2209d9 100644 --- a/assets/xml/objects/object_snowwd.xml +++ b/assets/xml/objects/object_snowwd.xml @@ -1,9 +1,9 @@  - - - - - + + + + + diff --git a/assets/xml/objects/object_stk.xml b/assets/xml/objects/object_stk.xml index a6f00c89b..eccbbb3a1 100644 --- a/assets/xml/objects/object_stk.xml +++ b/assets/xml/objects/object_stk.xml @@ -23,13 +23,13 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_tanron1.xml b/assets/xml/objects/object_tanron1.xml index 99a39e534..d5ec3be03 100644 --- a/assets/xml/objects/object_tanron1.xml +++ b/assets/xml/objects/object_tanron1.xml @@ -1,6 +1,6 @@  + - - + diff --git a/assets/xml/objects/object_tanron4.xml b/assets/xml/objects/object_tanron4.xml index 491e9a587..ea342d448 100644 --- a/assets/xml/objects/object_tanron4.xml +++ b/assets/xml/objects/object_tanron4.xml @@ -1,30 +1,30 @@  - + - - - - - + + + + + - - + + - - - - - - - - - - + + + + + + + + + + - + diff --git a/assets/xml/objects/object_thiefbird.xml b/assets/xml/objects/object_thiefbird.xml index 5a4cec335..52165cb89 100644 --- a/assets/xml/objects/object_thiefbird.xml +++ b/assets/xml/objects/object_thiefbird.xml @@ -40,13 +40,13 @@ - + - + @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_tl.xml b/assets/xml/objects/object_tl.xml index 7f0cfd756..3230f87f2 100644 --- a/assets/xml/objects/object_tl.xml +++ b/assets/xml/objects/object_tl.xml @@ -1,61 +1,87 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tree.xml b/assets/xml/objects/object_tree.xml index 9d5fb66dd..89e3984c5 100644 --- a/assets/xml/objects/object_tree.xml +++ b/assets/xml/objects/object_tree.xml @@ -1,9 +1,9 @@  - - - - - + + + + + diff --git a/assets/xml/objects/object_tro.xml b/assets/xml/objects/object_tro.xml index 773182c58..0a4a3ea8b 100644 --- a/assets/xml/objects/object_tro.xml +++ b/assets/xml/objects/object_tro.xml @@ -1,14 +1,18 @@  - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tsubo.xml b/assets/xml/objects/object_tsubo.xml index 46aacd873..8bbebfc85 100644 --- a/assets/xml/objects/object_tsubo.xml +++ b/assets/xml/objects/object_tsubo.xml @@ -1,9 +1,10 @@  + - - - - - + + + + + diff --git a/assets/xml/objects/object_visiblock.xml b/assets/xml/objects/object_visiblock.xml index d714338fc..cae048322 100644 --- a/assets/xml/objects/object_visiblock.xml +++ b/assets/xml/objects/object_visiblock.xml @@ -1,8 +1,9 @@  + - - - - + + + + diff --git a/assets/xml/objects/object_vm.xml b/assets/xml/objects/object_vm.xml index bf13f3b40..8fb9fde20 100644 --- a/assets/xml/objects/object_vm.xml +++ b/assets/xml/objects/object_vm.xml @@ -1,30 +1,41 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wdor01.xml b/assets/xml/objects/object_wdor01.xml index ffc3327bb..b18158a14 100644 --- a/assets/xml/objects/object_wdor01.xml +++ b/assets/xml/objects/object_wdor01.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_wdor02.xml b/assets/xml/objects/object_wdor02.xml index 9cb35ddb8..f192bf8f5 100644 --- a/assets/xml/objects/object_wdor02.xml +++ b/assets/xml/objects/object_wdor02.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_wdor03.xml b/assets/xml/objects/object_wdor03.xml index c23f87037..545a68242 100644 --- a/assets/xml/objects/object_wdor03.xml +++ b/assets/xml/objects/object_wdor03.xml @@ -1,7 +1,8 @@  + - - - + + + diff --git a/assets/xml/objects/object_wdor04.xml b/assets/xml/objects/object_wdor04.xml index 07ad601dd..d47e78a8e 100644 --- a/assets/xml/objects/object_wdor04.xml +++ b/assets/xml/objects/object_wdor04.xml @@ -2,6 +2,6 @@ - + diff --git a/assets/xml/objects/object_yb.xml b/assets/xml/objects/object_yb.xml index 3bbfc7cce..6c0ae86df 100644 --- a/assets/xml/objects/object_yb.xml +++ b/assets/xml/objects/object_yb.xml @@ -8,10 +8,10 @@ - + - + @@ -19,10 +19,10 @@ - + - + @@ -39,23 +39,24 @@ - + - + + - + - + - + diff --git a/assets/xml/objects/object_zg.xml b/assets/xml/objects/object_zg.xml index e5cb1dd5d..6ff35fe48 100644 --- a/assets/xml/objects/object_zg.xml +++ b/assets/xml/objects/object_zg.xml @@ -1,8 +1,8 @@  - - - - + + + + diff --git a/assets/xml/objects/object_zl1.xml b/assets/xml/objects/object_zl1.xml index 2b8a101bc..ed7fbf987 100644 --- a/assets/xml/objects/object_zl1.xml +++ b/assets/xml/objects/object_zl1.xml @@ -1,90 +1,117 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zl4.xml b/assets/xml/objects/object_zl4.xml index 73ebb8606..2c5eff1ef 100644 --- a/assets/xml/objects/object_zl4.xml +++ b/assets/xml/objects/object_zl4.xml @@ -93,7 +93,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -118,7 +118,7 @@ - + diff --git a/assets/xml/objects/object_zod.xml b/assets/xml/objects/object_zod.xml index 45fb179cc..a926e6ef9 100644 --- a/assets/xml/objects/object_zod.xml +++ b/assets/xml/objects/object_zod.xml @@ -24,9 +24,9 @@ - - - + + + diff --git a/assets/xml/objects/object_zog.xml b/assets/xml/objects/object_zog.xml index 8d9e6ebdb..b6d9d26ed 100644 --- a/assets/xml/objects/object_zog.xml +++ b/assets/xml/objects/object_zog.xml @@ -19,7 +19,7 @@ - + diff --git a/assets/xml/objects/object_zos.xml b/assets/xml/objects/object_zos.xml index a1364a842..5b3b12345 100644 --- a/assets/xml/objects/object_zos.xml +++ b/assets/xml/objects/object_zos.xml @@ -6,7 +6,7 @@ - + diff --git a/assets/xml/objects/object_zov.xml b/assets/xml/objects/object_zov.xml index 440782f10..31b9bcd7b 100644 --- a/assets/xml/objects/object_zov.xml +++ b/assets/xml/objects/object_zov.xml @@ -1,81 +1,90 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Mm2.xml b/assets/xml/overlays/ovl_En_Mm2.xml index 5d0be627f..81457d849 100644 --- a/assets/xml/overlays/ovl_En_Mm2.xml +++ b/assets/xml/overlays/ovl_En_Mm2.xml @@ -8,7 +8,7 @@ - + diff --git a/assets/xml/overlays/ovl_En_Syateki_Okuta.xml b/assets/xml/overlays/ovl_En_Syateki_Okuta.xml index 0e5054c19..aa38c8533 100644 --- a/assets/xml/overlays/ovl_En_Syateki_Okuta.xml +++ b/assets/xml/overlays/ovl_En_Syateki_Okuta.xml @@ -7,7 +7,7 @@ - - + + diff --git a/assets/xml/scenes/Z2_00KEIKOKU/Z2_00KEIKOKU.xml b/assets/xml/scenes/Z2_00KEIKOKU/Z2_00KEIKOKU.xml index 3cf73a255..9c1a84c8c 100644 --- a/assets/xml/scenes/Z2_00KEIKOKU/Z2_00KEIKOKU.xml +++ b/assets/xml/scenes/Z2_00KEIKOKU/Z2_00KEIKOKU.xml @@ -2,6 +2,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/BUILDING_MACOS.md b/docs/BUILDING_MACOS.md index 8a5aa20a3..cf93acbf2 100644 --- a/docs/BUILDING_MACOS.md +++ b/docs/BUILDING_MACOS.md @@ -11,17 +11,20 @@ For macOS, use Homebrew to install the following dependencies: * python3 * libpng * bash -* clang-format 11 You can install them with the following commands: ```bash brew update -brew install coreutils make python3 libpng bash clang-format@11 +brew install coreutils make python3 libpng bash ``` (The repository expects Homebrew-installed programs to be either linked correctly in `$PATH` etc. or in their default locations.) +Homebrew does not have clang-format-14 but MacPorts does + +(Have been unable to confirm actual commands with somone that has a Mac) + ## Building mips-linux-binutils The following instructions are written for MacOS users but should apply to any Unix-like system, with maybe some modifications at the end regarding the bash_profile. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 2f4c9854a..f5a042846 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -4,19 +4,19 @@ Thanks for helping us reverse engineer *The Legend of Zelda: Majora's Mask* for All contributions are welcome. This is a group effort, and even small contributions can make a difference. Some tasks also don't require much knowledge to get started. This document is meant to be a set of tips and guidelines for contributing to the project. -For general information about the project, see [our readme](https://github.com/zeldaret/mm/blob/master/README.md). +For general information about the project, see [our readme](https://github.com/zeldaret/mm/blob/main/README.md). Most discussions happen on our [Discord Server](https://discord.zelda64.dev) where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects. ## Useful Links -- [Installation guide](https://github.com/zeldaret/mm/blob/master/README.md#installation) - Instructions for getting this repository set up and built on your machine. +- [Installation guide](https://github.com/zeldaret/mm/blob/main/README.md#installation) - Instructions for getting this repository set up and built on your machine. - [Style Guide](STYLE.md) - Description of the project style that we ask contributors to adhere to. - [Code Review Guidelines](REVIEWING.md) - These are the guidelines that reviewers will be using when reviewing your code. Good to be familiar with these before submitting your code. - [Zelda 64 Reverse Engineering Website](https://zelda64.dev/games/mm) - Our homepage, with FAQ and progress graph :chart_with_upwards_trend:. - [MM decomp tutorial](tutorial/contents.md) Detailed tutorial for learning in general how decomp works and how to decompile a small, simple file. -- [Introduction to OOT decomp](https://github.com/zeldaret/oot/blob/master/docs/tutorial/contents.md) - The tutorial the MM one was based on. For OOT, but largely applicable to MM as well. Covers slightly different topics, including how to get your data OK with `vbindiff`. +- [Introduction to OOT decomp](https://github.com/zeldaret/oot/blob/main/docs/tutorial/contents.md) - The tutorial the MM one was based on. For OOT, but largely applicable to MM as well. Covers slightly different topics, including how to get your data OK with `vbindiff`. - The `#resources` channel on the Discord contains many more links on specific details of decompiling IDO MIPS code. ## Getting Started @@ -37,7 +37,7 @@ This project only uses *publicly available code*. ### Environment Setup -Get started by following the [installation guide in the readme](https://github.com/zeldaret/mm/blob/master/README.md#installation). +Get started by following the [installation guide in the readme](https://github.com/zeldaret/mm/blob/main/README.md#installation). You should be able to build a matching ROM before you start making any changes. ### First Contribution @@ -110,7 +110,7 @@ See the [Style Guide](STYLE.md) for more details on documentation style. Before opening a PR, walk through the following steps to ensure that your code conforms to the style guide and conventions. - `make` successfully builds a matching ROM. -- `./format.sh` was run to apply standard formatting. +- `./format.py` was run to apply standard formatting. - No new compiler warnings were introduced during the build process. - Can be verified locally by running `tools/warnings_count/check_new_warnings.sh` - New variables & functions should follow standard naming conventions. @@ -142,8 +142,8 @@ Project leads are responsible for ensuring that these conventions are followed. ### Some git notes -- You should work on a branch on your fork separate from your copy of master: it is always useful to have a clean master branch around if you need to fix something. -- When a PR is merged into master, it may conflict with your work. While your branch is private (in particular, not used for a PR), you can rebase, but when your branch is public/used for a PR always merge master instead of rebasing: it makes it much easier for people to understand what you changed since the last review. +- You should work on a branch on your fork separate from your copy of main: it is always useful to have a clean main branch around if you need to fix something. +- When a PR is merged into main, it may conflict with your work. While your branch is private (in particular, not used for a PR), you can rebase, but when your branch is public/used for a PR always merge main instead of rebasing: it makes it much easier for people to understand what you changed since the last review. - We squash commits when merging, so your commit history does not have to be completely spotless. Throughout the PR process, you (the author) should update the rows on the appropriate Google Sheets with the appropriate information as the decompilation process progresses. diff --git a/docs/REVIEWING.md b/docs/REVIEWING.md index 8b70f2711..3fc160729 100644 --- a/docs/REVIEWING.md +++ b/docs/REVIEWING.md @@ -5,7 +5,7 @@ We encourage all contributors to participate in code review: this is your codeba Every review submitted helps us keep code quality high and code merged in more quickly. This document is meant to be a set of tips and guidelines for reviewers of pull requests to the project. -For general information about the project, see [our readme](https://github.com/zeldaret/mm/blob/master/README.md). +For general information about the project, see [our readme](https://github.com/zeldaret/mm/blob/main/README.md). Most discussions happen on our [Discord Server](https://discord.zelda64.dev) where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects. @@ -30,7 +30,7 @@ You should first famiiarise yourself with our [Contributing guide](CONTRIBUTING. - [ ] Jenkins build is successful. - [ ] `make` builds a matching ROM. - - [ ] `format.sh` was run. + - [ ] `format.py` was run. - [ ] `spec` contains correct relocation files. - [ ] Any new compiler warnings that were added are required for matching. Ensure there is good reason if the warnings files have changed. - [ ] Files with `NON_MATCHING` functions have equivalent behaviour. diff --git a/docs/STYLE.md b/docs/STYLE.md index 0cf1d051b..616c4a8cc 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -140,7 +140,7 @@ Damage flag enums are not being used at present: we want to wait until we have a Pre-C99, commas at the end of the last item in an enum will cause a compiler warning, so leave them off. -All compound flag lists (e.g. `ACTOR_FLAG_4 | ACTOR_FLAG_8`) should be listed in *ascending* order +All compound flag lists (e.g. `ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_FRIENDLY`) should be listed in *ascending* order ## Arrays diff --git a/docs/tools.md b/docs/tools.md index 5005f7f93..c307382f9 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -198,29 +198,27 @@ Fixes line endings in the repo to Linux style (LF), which is required for the bu ### `format.py` -Formats all C files in the repo using `clang-format-11`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer. +Formats all C files in the repo using `clang-format-14`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer. You can specify how many threads you would like this to run with by adding the `-jN` flag. Where N is the number of threads. By default this will run using 1 thread (i.e. `-j1`). -`clang-11` is available in many native package managers, but if not try: +`clang-14` is available in many native package managers, but if not try: Linux: Download llvm's setup script, run it, than install normally ```bash wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh -sudo ./llvm.sh 11 +sudo ./llvm.sh 14 rm llvm.sh -sudo apt install clang-format-11 clang-tidy-11 clang-apply-replacements-11 +sudo apt install clang-format-14 clang-tidy-14 clang-apply-replacements-14 ``` Mac: -Install with brew, than create symlinks for `clang-tidy` and `clang-apply-replacements` to use properly -```bash -brew install llvm clang-format-11 -ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" -ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements" -``` +Brew does not have clang-format-14, but MacPorts does. + +(Have been unable to confirm actual commands with somone that has a Mac) + ## External tools @@ -273,7 +271,7 @@ Probably the best of the Nintendo 64 texture viewing programs. It is quite simpl ### Z64Utils -Basically essential for convenient analysis of object files. Can analyse and display DisplayLists, some textures, skeletons, animations, and a few other resources. Download from . +Basically essential for convenient analysis of object files. Can analyse and display DisplayLists, some textures, skeletons, animations, and a few other resources. Download from . ## Retired tools diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index aa4ba3621..83d55f7ad 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -94,7 +94,7 @@ void func_80952734(EnMs* this, PlayState* play) { if (this->actor.xzDistToPlayer < 90.0f) { if (ABS_ALT(temp_v1) < 0x2000) { - func_800B8614(&this->actor, play, 90.0f); + Actor_OfferTalk(&this->actor, play, 90.0f); } } } @@ -104,7 +104,7 @@ void func_80952734(EnMs* this, PlayState* play) { void func_809529AC(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); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80952A1C; } else { Actor_OfferGetItem(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); @@ -116,7 +116,7 @@ void func_80952A1C(EnMs* this, PlayState* play) { Message_ContinueTextbox(play, 0x936U); this->actionFunc = func_809527F8; } else { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); } } @@ -181,23 +181,23 @@ void func_809527F8(EnMs* this, PlayState* play) { if (temp_v0_2 != 1) { } - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); // Duplicate return node #17. Try simplifying control flow for better match return; } Message_CloseTextbox(play); if ((s32) gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } if ((s32) gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); return; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -277,24 +277,24 @@ block_11: if ((s32) gSaveContext.save.saveInfo.playerData.rupees >= 0xA) { goto block_13; } - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; block_13: if ((s32) gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] < 0x14) { goto block_15; } - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); return; block_15: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); block_17: return; @@ -315,17 +315,17 @@ The simplest sort of block label to eliminate is one that is only used once, and if ((s32) gSaveContext.save.saveInfo.playerData.rupees >= 0xA) { goto block_13; } - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; block_13: ``` -Currently, this says to jump over the code block `play_sound...` if the condition in the if is satisfied. In non-goto terms, this means that the block should be run if the condition is *not* satisfied. This also illustrates a general property of goto-only mode: you have to reverse the senses of all of the ifs. Therefore the appropriate approach is to swap the if round, put the code block inside, and remove the goto and the label: +Currently, this says to jump over the code block `Audio_PlaySfx...` if the condition in the if is satisfied. In non-goto terms, this means that the block should be run if the condition is *not* satisfied. This also illustrates a general property of goto-only mode: you have to reverse the senses of all of the ifs. Therefore the appropriate approach is to swap the if round, put the code block inside, and remove the goto and the label: ```C if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } @@ -379,23 +379,23 @@ block_11: Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); return; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); block_17: return; @@ -448,23 +448,23 @@ block_11: Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); return; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); } ``` @@ -498,17 +498,17 @@ So let us rewrite the entire second half as a switch: Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); return; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -517,7 +517,7 @@ So let us rewrite the entire second half as a switch: case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); break; } @@ -534,13 +534,13 @@ There's a couple of other obvious things here: Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -549,7 +549,7 @@ There's a couple of other obvious things here: case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); break; } @@ -599,13 +599,13 @@ block_7: Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -614,7 +614,7 @@ block_7: case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); break; } @@ -664,13 +664,13 @@ void func_809527F8(EnMs* this, PlayState* play) { Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -679,7 +679,7 @@ void func_809527F8(EnMs* this, PlayState* play) { case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); break; } @@ -716,13 +716,13 @@ void func_809527F8(EnMs* this, PlayState* play) { Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { - play_sound(0x4806U); + Audio_PlaySfx(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; @@ -731,7 +731,7 @@ void func_809527F8(EnMs* this, PlayState* play) { case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934U); break; } diff --git a/docs/tutorial/beginning_decomp.md b/docs/tutorial/beginning_decomp.md index 591f12a2b..2685f9276 100644 --- a/docs/tutorial/beginning_decomp.md +++ b/docs/tutorial/beginning_decomp.md @@ -175,7 +175,7 @@ The Init function sets up the various components of the actor when it is first l The first stage of decompilation is done by a program called mips_to_c, often referred to as mips2c, which constructs a C interpretation of the assembly code based on reading it very literally. This means that considerable cleanup will be required to turn it into something that firstly compiles at all, and secondly looks like a human wrote it, let alone a Zelda developer from the late '90s. -The web version of mips2c can be found [here](https://simonsoftware.se/other/mips_to_c.py). This was [covered in the OoT tutorial](https://github.com/zeldaret/oot/blob/master/docs/tutorial/beginning_decomp.md). We shall instead use the repository. Clone [the mips_to_c repository](https://github.com/matt-kempster/mips_to_c) into a separate directory (we will assume on the same level as the `mm/` directory). Since it's Python, we don't have to do any compilation or anything in the mips_to_c directory. +The web version of mips2c can be found [here](https://simonsoftware.se/other/mips_to_c.py). This was [covered in the OoT tutorial](https://github.com/zeldaret/oot/blob/main/docs/tutorial/beginning_decomp.md). We shall instead use the repository. Clone [the mips_to_c repository](https://github.com/matt-kempster/mips_to_c) into a separate directory (we will assume on the same level as the `mm/` directory). Since it's Python, we don't have to do any compilation or anything in the mips_to_c directory. Since the actor depends on the rest of the codebase, we can't expect to get much intelligible out of mips2c without giving it some context. We make this using a Python script in the `tools` directory called `m2ctx.py`, so run @@ -686,7 +686,7 @@ as our first guess. This doesn't look unreasonable... the question is, does it m Once preliminary cleanup and struct filling is done, most time spent matching functions is done by comparing the original code with the code you have compiled. This is aided by a program called `diff.py`. -In order to use `diff.py` with the symbol names, we need a copy of the code to compare against. In MM this is done as part of `make init`, and you can regenerate the `expected` directory (which is simply a known-good copy of `build` directory) by running `make diff-init`, which will check for an OK ROM and copy the build directory over. (Of course you need an OK ROM to do this; worst-case, you can checkout master and do a complete rebuild to get it). (You need to remake `expected` if you want to diff a function you have renamed: `diff.py` looks in the mapfiles for the function name, which won't work if the name has changed!) +In order to use `diff.py` with the symbol names, we need a copy of the code to compare against. In MM this is done as part of `make init`, and you can regenerate the `expected` directory (which is simply a known-good copy of `build` directory) by running `make diff-init`, which will check for an OK ROM and copy the build directory over. (Of course you need an OK ROM to do this; worst-case, you can checkout main and do a complete rebuild to get it). (You need to remake `expected` if you want to diff a function you have renamed: `diff.py` looks in the mapfiles for the function name, which won't work if the name has changed!) Now, we run diff on the function name: in the main directory, diff --git a/docs/tutorial/data.md b/docs/tutorial/data.md index 6884ebb12..07ea8cfac 100644 --- a/docs/tutorial/data.md +++ b/docs/tutorial/data.md @@ -27,7 +27,7 @@ Both approaches have their advantages and disadvantages. ## Data first -This way is good for smaller actors with little data. The OoT tutorial [covers this in plenty of detail](https://github.com/zeldaret/oot/blob/master/docs/tutorial/data.md), and the process in MM is essentially identical, so we won't go over it here. +This way is good for smaller actors with little data. The OoT tutorial [covers this in plenty of detail](https://github.com/zeldaret/oot/blob/main/docs/tutorial/data.md), and the process in MM is essentially identical, so we won't go over it here. ## Extern and data last diff --git a/docs/tutorial/diff_and_permuter.md b/docs/tutorial/diff_and_permuter.md index 2b5d41e30..e8d0f59f7 100644 --- a/docs/tutorial/diff_and_permuter.md +++ b/docs/tutorial/diff_and_permuter.md @@ -2,7 +2,7 @@ This document is intended as a step-by-step demonstration of matching a reasonably complex function using the diff script `diff.py` and the decomp permuter, both included in the repo. For general information on both see [the tools documentation](../tools.md). -Until such time as someone finds a suitable function, you can look at the OoT tutorial: [here for diff.py](https://github.com/zeldaret/oot/blob/master/docs/tutorial/beginning_decomp.md#diff) and [here for the permuter](https://github.com/zeldaret/oot/blob/master/docs/tutorial/other_functions.md#the-permuter). +Until such time as someone finds a suitable function, you can look at the OoT tutorial: [here for diff.py](https://github.com/zeldaret/oot/blob/main/docs/tutorial/beginning_decomp.md#diff) and [here for the permuter](https://github.com/zeldaret/oot/blob/main/docs/tutorial/other_functions.md#the-permuter). staticVtx * (1 - scale * vtxSurfacePerturbation) - dynamicVtx->n.ob[j] += (s16)( - ((staticVtx->n.ob[j] - (s32)(scale * staticVtx->n.ob[j] * this->vtxSurfacePerturbation[i])) - - dynamicVtx->n.ob[j]) * - invWindupPunchTimer); + dynamicVtx->n.ob[j] += (s16)(((staticVtx->n.ob[j] - (s32)(scale * staticVtx->n.ob[j] * + this->vtxSurfacePerturbation[i])) - + dynamicVtx->n.ob[j]) * + invWindupPunchTimer); } } else { // loop over x, y, z @@ -1897,7 +1898,7 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) { sBigslimeTargetVtx[vtxIceUpdate - 4].n.a = sBigslimeTargetVtx[vtxIceUpdate].n.a; } - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->freezeTimer == 0) { EnBigslime_BreakIntoMinislime(this, play); @@ -1980,7 +1981,7 @@ void EnBigslime_Melt(EnBigslime* this, PlayState* play) { EffectSsIceSmoke_Spawn(play, &iceSmokePos, &iceSmokeVelocity, &gZeroVec3f, 600); } - func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); for (i = 159; i >= 0; i--) { sBigslimeTargetVtx[i + 2].n.a = sBigslimeTargetVtx[i].n.a; } @@ -1988,7 +1989,7 @@ void EnBigslime_Melt(EnBigslime* this, PlayState* play) { if (this->meltCounter == 100) { EnBigslime_SetTargetVtxFromPreFrozen(this); } else if (this->meltCounter == 50) { - play->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } } @@ -2039,7 +2040,7 @@ void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->gekkoCollider.base.acFlags |= AC_ON; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->jumpTimer--; @@ -2101,7 +2102,7 @@ void EnBigslime_IdleLookAround(EnBigslime* this, PlayState* play) { s16 yawDiff; this->idleTimer--; - if (this->isAnimUpdate) { + if (this->isAnimFinished) { if (Rand_ZeroOne() < 0.25f) { Animation_PlayOnce(&this->skelAnime, &gGekkoLookAroundAnim); } else { @@ -2137,7 +2138,7 @@ void EnBigslime_IdleNoticePlayer(EnBigslime* this, PlayState* play) { if (this->skelAnime.curFrame > 10.0f) { Math_ScaledStepToS(yaw, this->gekkoYaw, 0x800); } - if (this->isAnimUpdate) { + if (this->isAnimFinished) { EnBigslime_SetupJumpGekko(this); } } @@ -2158,7 +2159,7 @@ void EnBigslime_ThrowMinislime(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_THROW_SLIME); this->minislimeToThrow->actor.params = MINISLIME_GEKKO_THROW; } - if (this->isAnimUpdate) { + if (this->isAnimFinished) { jumpTimerStored = this->jumpTimer; // Stores jumpTimer so it doesn't get overwritten back to 100 EnBigslime_SetupJumpGekko(this); this->jumpTimer = jumpTimerStored; @@ -2286,7 +2287,7 @@ void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gGekkoSwimForwardAnim); this->formBigslimeCutsceneTimer--; Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_COMBINE); - } else if (this->isAnimUpdate) { + } else if (this->isAnimFinished) { this->formBigslimeCutsceneTimer--; if (this->formBigslimeCutsceneTimer == 0) { Animation_PlayLoop(&this->skelAnime, &gGekkoSwimUpAnim); @@ -2351,7 +2352,7 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { this->minislime[i]->actor.params = MINISLIME_DEFEAT_IDLE; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; EnBigslime_GekkoThaw(this, play); this->actionFunc = EnBigslime_CutsceneDefeat; } @@ -2601,7 +2602,7 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, PlayState* play) { if (randFloat < 0.15f) { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); } else if (randFloat < 0.3f) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_SMALL); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_JAR_SMALL); } this->itemDropTimer = 40; } @@ -2635,10 +2636,10 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } else { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, - this->gekkoCollider.info.bumper.hitPos.x, - this->gekkoCollider.info.bumper.hitPos.y, - this->gekkoCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn( + &play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->gekkoCollider.info.bumper.hitPos.x, + this->gekkoCollider.info.bumper.hitPos.y, this->gekkoCollider.info.bumper.hitPos.z, 0, + 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } } else if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_ICE) { EnBigslime_GekkoFreeze(this); @@ -2670,10 +2671,10 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } else { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, - this->gekkoCollider.info.bumper.hitPos.x, - this->gekkoCollider.info.bumper.hitPos.y, - this->gekkoCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn( + &play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->gekkoCollider.info.bumper.hitPos.x, + this->gekkoCollider.info.bumper.hitPos.y, this->gekkoCollider.info.bumper.hitPos.z, 0, + 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } } EnBigslime_SetupDamageGekko(this, true); @@ -2764,7 +2765,7 @@ void EnBigslime_UpdateEffects(EnBigslime* this) { this->gekkoDrawDmgEffScale = 0.375f * (this->gekkoDrawDmgEffAlpha + 1.0f); this->gekkoDrawDmgEffScale = CLAMP_MAX(this->gekkoDrawDmgEffScale, 0.75f); } else if (!Math_StepToF(&this->gekkoDrawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -2776,13 +2777,13 @@ void EnBigslime_UpdateBigslime(Actor* thisx, PlayState* play) { Vec3f vtxMin; if (play->envCtx.lightSettingOverride == 3) { - play->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } - func_8019F540(1); + Audio_SetSfxUnderwaterReverb(true); this->dynamicVtxState ^= 1; EnBigslime_DynamicVtxCopyState(this); - this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); + this->isAnimFinished = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { EnBigslime_ApplyDamageEffectBigslime(this, play); } else { @@ -2821,11 +2822,11 @@ void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) { s32 pad; if (play->envCtx.lightSettingOverride == 3) { - play->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } - func_8019F540(0); - this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); + Audio_SetSfxUnderwaterReverb(false); + this->isAnimFinished = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { EnBigslime_ApplyDamageEffectGekko(this, play); } else { @@ -3032,26 +3033,37 @@ void EnBigslime_DrawBigslime(Actor* thisx, PlayState* play) { EnBigslime_DrawGekko(&this->actor, play); } +static s8 sLimbToBodyParts[GEKKO_LIMB_MAX] = { + BODYPART_NONE, // GEKKO_LIMB_NONE + BODYPART_NONE, // GEKKO_LIMB_ROOT + GEKKO_BODYPART_WAIST, // GEKKO_LIMB_WAIST + BODYPART_NONE, // GEKKO_LIMB_LEFT_THIGH + GEKKO_BODYPART_LEFT_SHIN, // GEKKO_LIMB_LEFT_SHIN + BODYPART_NONE, // GEKKO_LIMB_LEFT_ANKLE + GEKKO_BODYPART_LEFT_FOOT, // GEKKO_LIMB_LEFT_FOOT + BODYPART_NONE, // GEKKO_LIMB_RIGHT_THIGH + GEKKO_BODYPART_RIGHT_SHIN, // GEKKO_LIMB_RIGHT_SHIN + BODYPART_NONE, // GEKKO_LIMB_RIGHT_ANKLE + GEKKO_BODYPART_RIGHT_FOOT, // GEKKO_LIMB_RIGHT_FOOT + BODYPART_NONE, // GEKKO_LIMB_TORSO + GEKKO_BODYPART_LEFT_UPPER_ARM, // GEKKO_LIMB_LEFT_UPPER_ARM + GEKKO_BODYPART_LEFT_FOREARM, // GEKKO_LIMB_LEFT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_LEFT_WRIST + GEKKO_BODYPART_LEFT_HAND, // GEKKO_LIMB_LEFT_HAND + GEKKO_BODYPART_RIGHT_UPPER_ARM, // GEKKO_LIMB_RIGHT_UPPER_ARM + GEKKO_BODYPART_RIGHT_FOREARM, // GEKKO_LIMB_RIGHT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_RIGHT_WRIST + GEKKO_BODYPART_RIGHT_HAND, // GEKKO_LIMB_RIGHT_HAND + BODYPART_NONE, // GEKKO_LIMB_HEAD + GEKKO_BODYPART_JAW, // GEKKO_LIMB_JAW + BODYPART_NONE, // GEKKO_LIMB_LEFT_EYE + BODYPART_NONE, // GEKKO_LIMB_RIGHT_EYE +}; + +// Some kind of offset for the position of the Gekkos right foot +static Vec3f sRightFootOffsetRef = { 1500.0f, 2200.0f, 0.0f }; + void EnBigslime_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - /* value -1: Limb Not used - * value 0: GEKKO_LIMB_WAIST - * value 1: GEKKO_LIMB_L_SHIN - * value 2: GEKKO_LIMB_L_FOOT - * value 3: GEKKO_LIMB_R_SHIN - * value 4: GEKKO_LIMB_R_FOOT - * value 5: GEKKO_LIMB_L_UPPER_ARM - * value 6: GEKKO_LIMB_L_FOREARM - * value 7: GEKKO_LIMB_L_HAND - * value 8: GEKKO_LIMB_R_UPPER_ARM - * value 9: GEKKO_LIMB_R_FOREARM - * value 10: GEKKO_LIMB_R_HAND - * value 11: GEKKO_LIMB_JAW - */ - static s8 limbPosIndex[] = { - -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, 6, -1, 7, 8, 9, -1, 10, -1, 11, -1, -1, - }; - // Some kind of offset for the position of the Gekkos right foot - static Vec3f rightFootOffsetRef = { 1500.0f, 2200.0f, 0.0f }; EnBigslime* this = THIS; Vec3f rightFootOffset; @@ -3060,12 +3072,12 @@ void EnBigslime_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* this->actor.focus.rot.y = this->gekkoRot.y; } - if (limbPosIndex[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[limbPosIndex[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->gekkoBodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == GEKKO_LIMB_RIGHT_ANKLE) { - Matrix_MultVec3f(&rightFootOffsetRef, &rightFootOffset); + Matrix_MultVec3f(&sRightFootOffsetRef, &rightFootOffset); this->gekkoCollider.dim.pos.y = rightFootOffset.y; } } @@ -3118,7 +3130,7 @@ void EnBigslime_DrawGekko(Actor* thisx, PlayState* play) { EnBigslime_DrawShatteringEffects(this, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->gekkoBodyPartsPos, GEKKO_BODYPART_MAX, this->gekkoScale * (999.99991f / 7.0f) * this->gekkoDrawDmgEffScale, this->gekkoDrawDmgEffFrozenSteamScale, this->gekkoDrawDmgEffAlpha, this->gekkoDrawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 8f2b5bee3..4f09998bc 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -57,7 +57,7 @@ typedef struct EnBigslime { /* 0x0220 */ Vec3s morphTable[GEKKO_LIMB_MAX]; /* 0x02B0 */ u8 minislimeState; /* 0x02B1 */ u8 dynamicVtxState; // Toggles between two states of dynamic Vtx - /* 0x02B2 */ u8 isAnimUpdate; + /* 0x02B2 */ u8 isAnimFinished; /* 0x02B3 */ union { u8 formBigslimeTimer; // Bigslime will start forming when timer reaches 0 u8 minislimeCounter; @@ -106,7 +106,7 @@ typedef struct EnBigslime { Vec3f frozenPos; Vec3f subCamDistToFrog; // Used to zoom into frogs as Gekko despawns/Frog spawns }; - /* 0x02F8 */ Vec3f limbPos[12]; + /* 0x02F8 */ Vec3f gekkoBodyPartsPos[GEKKO_BODYPART_MAX]; /* 0x0388 */ f32 gekkoDrawDmgEffAlpha; /* 0x038C */ f32 gekkoDrawDmgEffScale; /* 0x0390 */ f32 gekkoDrawDmgEffFrozenSteamScale; 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 745e3b3e7..a9f290371 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 @@ -6,7 +6,7 @@ #include "z_en_bji_01.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBji01*)thisx) @@ -15,20 +15,15 @@ void EnBji01_Destroy(Actor* thisx, PlayState* play); void EnBji01_Update(Actor* thisx, PlayState* play); void EnBji01_Draw(Actor* thisx, PlayState* play); -void func_809CCE98(EnBji01* this, PlayState* play); void func_809CCEE8(EnBji01* this, PlayState* play); void func_809CD028(EnBji01* this, PlayState* play); void EnBji01_DialogueHandler(EnBji01* this, PlayState* play); -void func_809CCDE0(EnBji01* this, PlayState* play); void func_809CD634(EnBji01* this, PlayState* play); void EnBji01_DoNothing(EnBji01* this, PlayState* play); void func_809CD6C0(EnBji01* this, PlayState* play); void func_809CD70C(EnBji01* this, PlayState* play); void func_809CD77C(EnBji01* this, PlayState* play); -s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnBji01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); - ActorInit En_Bji_01_InitVars = { ACTOR_EN_BJI_01, ACTORCAT_NPC, @@ -61,12 +56,20 @@ static ColliderCylinderInit sCylinderInit = { { 18, 64, 0, { 0, 0, 0 } }, }; -/* Animations struct */ -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 */ - { &object_bji_Anim_00066C, 1.0f, ANIMMODE_ONCE, -5.0f }, /* Scratching chin? */ +typedef enum { + /* -1 */ SHIKASHI_ANIM_NONE = -1, + /* 0 */ SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE, + /* 1 */ SHIKASHI_ANIM_BREATHE, + /* 2 */ SHIKASHI_ANIM_TALK, + /* 3 */ SHIKASHI_ANIM_SCRATCH_CHIN, + /* 4 */ SHIKASHI_ANIM_MAX +} ShikashiAnimation; + +static AnimationSpeedInfo sAnimationSpeedInfo[SHIKASHI_ANIM_MAX] = { + { &object_bji_Anim_000FDC, 1.0f, ANIMMODE_LOOP, 0.0f }, // SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE + { &object_bji_Anim_005B58, 1.0f, ANIMMODE_LOOP, 10.0f }, // SHIKASHI_ANIM_BREATHE + { &object_bji_Anim_000AB0, 1.0f, ANIMMODE_LOOP, 0.0f }, // SHIKASHI_ANIM_TALK + { &object_bji_Anim_00066C, 1.0f, ANIMMODE_ONCE, -5.0f }, // SHIKASHI_ANIM_SCRATCH_CHIN }; void func_809CCDE0(EnBji01* this, PlayState* play) { @@ -82,7 +85,8 @@ void func_809CCDE0(EnBji01* this, PlayState* play) { } void func_809CCE98(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE, + &this->animIndex); this->actor.textId = 0; this->actionFunc = func_809CCEE8; } @@ -97,7 +101,7 @@ void func_809CCEE8(EnBji01* this, PlayState* play) { } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; func_809CD028(this, play); } else { @@ -109,7 +113,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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 60.0f, 10.0f, PLAYER_IA_NONE); } } @@ -119,7 +123,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { switch (this->actor.params) { case SHIKASHI_TYPE_DEFAULT: case SHIKASHI_TYPE_FINISHED_CONVERSATION: - switch (gSaveContext.save.playerForm) { + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_10)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { @@ -132,6 +136,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_17_10); } break; + case PLAYER_FORM_HUMAN: if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->textId = 0x236A; @@ -142,6 +147,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_74_10); } break; + case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_08)) { @@ -151,31 +157,39 @@ void func_809CD028(EnBji01* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_75_08); } break; + + default: + break; } break; + case SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE: - switch (gSaveContext.save.playerForm) { + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { this->textId = 0x5F2; } else { this->textId = 0x5F1; } - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, - PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); break; + case PLAYER_FORM_HUMAN: this->textId = 0x5F7; break; + case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: switch (CURRENT_DAY) { case 1: this->textId = 0x5E9; break; + case 2: this->textId = 0x5EA; break; + case 3: timeUntilMoonCrash = TIME_UNTIL_MOON_CRASH; if (timeUntilMoonCrash < CLOCK_TIME_F(1, 0)) { @@ -184,11 +198,21 @@ void func_809CD028(EnBji01* this, PlayState* play) { this->textId = 0x5EB; } break; + + default: + break; } + break; + + default: + break; } break; + + default: + break; } - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); this->actionFunc = EnBji01_DialogueHandler; } @@ -201,51 +225,67 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { Message_StartTextbox(play, this->textId, &this->actor); } break; + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_CloseTextbox(play); func_809CD634(this, play); break; + case 1: - func_8019F230(); - switch (gSaveContext.save.playerForm) { + Audio_PlaySfx_MessageCancel(); + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: Message_ContinueTextbox(play, 0x5F0); break; + case PLAYER_FORM_HUMAN: Message_ContinueTextbox(play, 0x5F8); break; + case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: Message_ContinueTextbox(play, 0x5E1); break; + + default: + break; } break; + + default: + break; } } break; + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; switch (play->msgCtx.currentTextId) { case 0x5DE: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 3, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + SHIKASHI_ANIM_SCRATCH_CHIN, &this->animIndex); Message_ContinueTextbox(play, 0x5DF); break; + case 0x5E4: Message_ContinueTextbox(play, 0x5E7); break; + case 0x5E5: Message_ContinueTextbox(play, 0x5E0); break; + case 0x5E7: Message_ContinueTextbox(play, 0x5E5); break; + case 0x5DC: case 0x5DD: case 0x5DF: @@ -256,10 +296,12 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { case 0x5F5: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0x5F0: case 0x5F6: Message_ContinueTextbox(play, 0x5EF); break; + case 0x5E1: case 0x5E8: case 0x5E9: @@ -275,17 +317,24 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; func_809CCE98(this, play); break; + + default: + break; } } break; + case TEXT_STATE_DONE: this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; this->actor.flags &= ~ACTOR_FLAG_10000; func_809CCE98(this, play); break; + + default: + break; } - if ((this->animIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + if ((this->animIndex == SHIKASHI_ANIM_SCRATCH_CHIN) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); } } @@ -304,7 +353,7 @@ void EnBji01_DoNothing(EnBji01* this, PlayState* play) { } void func_809CD6C0(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); this->actionFunc = func_809CD70C; } @@ -332,9 +381,9 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.child = NULL; - this->animIndex = -1; + this->animIndex = SHIKASHI_ANIM_NONE; Actor_SetScale(&this->actor, 0.01f); SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); @@ -377,7 +426,8 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { - if (--this->blinkSeqIndex < 0) { + this->blinkSeqIndex--; + if (this->blinkSeqIndex < 0) { this->blinkSeqIndex = 4; this->blinkTimer = (Rand_ZeroOne() * 60.0f) + 20.0f; } else { @@ -406,10 +456,14 @@ s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* rot->x += this->torsoXRotStep; rot->z += this->torsoZRotStep; break; + case SHIKASHI_LIMB_HEAD: rot->x += this->headXRotStep; rot->z += this->headZRotStep; break; + + default: + break; } return false; } 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 ef5c9c0e2..ed68e212f 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -6,7 +6,7 @@ #include "z_en_bjt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnBjt*)thisx) @@ -87,16 +87,17 @@ typedef enum { /* 2 */ TOILET_HAND_ANIM_WAGGING_FINGER, // Wrong /* 3 */ TOILET_HAND_ANIM_THUMBS_UP, // Right /* 4 */ TOILET_HAND_ANIM_OPEN_HAND, - /* 5 */ TOILET_HAND_ANIM_FIST // i.e. holding the reward + /* 5 */ TOILET_HAND_ANIM_FIST, // i.e. holding the reward + /* 6 */ TOILET_HAND_ANIM_MAX } ToiletHandAnimation; -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 }, - /* 3 */ { &gToiletHandThumbsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 4 */ { &gToiletHandOpenHandAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 5 */ { &gToiletHandFistAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +static AnimationInfoS sAnimationInfo[TOILET_HAND_ANIM_MAX] = { + { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TOILET_HAND_ANIM_WAITING + { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_WAITING_MORPH + { &gToiletHandWaggingFingerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_WAGGING_FINGER + { &gToiletHandThumbsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_THUMBS_UP + { &gToiletHandOpenHandAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_OPEN_HAND + { &gToiletHandFistAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_FIST }; void EnBjt_UpdateSkelAnime(EnBjt* this) { @@ -106,10 +107,10 @@ void EnBjt_UpdateSkelAnime(EnBjt* this) { s32 EnBjt_ChangeAnim(EnBjt* this, s32 animIndex) { s32 changeAnim = false; - s32 changed = false; + s32 didAnimChange = false; if ((animIndex == TOILET_HAND_ANIM_WAITING) || (animIndex == TOILET_HAND_ANIM_WAITING_MORPH)) { - if (!((this->animIndex == TOILET_HAND_ANIM_WAITING) || (this->animIndex == TOILET_HAND_ANIM_WAITING_MORPH))) { + if ((this->animIndex != TOILET_HAND_ANIM_WAITING) && (this->animIndex != TOILET_HAND_ANIM_WAITING_MORPH)) { changeAnim = true; } } else if (this->animIndex != animIndex) { @@ -118,11 +119,11 @@ s32 EnBjt_ChangeAnim(EnBjt* this, s32 animIndex) { if (changeAnim) { this->animIndex = animIndex; - changed = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->animPlaySpeed = this->skelAnime.playSpeed; } - return changed; + return didAnimChange; } void EnBjt_UpdateCollision(EnBjt* this, PlayState* play) { @@ -275,9 +276,9 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { break; case TOILET_HAND_BEHAVIOUR_TAKE_ITEM: - if (player->exchangeItemId != PLAYER_IA_NONE) { - EnBjt_TakeItem(player->exchangeItemId); - player->exchangeItemId = PLAYER_IA_NONE; + if (player->exchangeItemAction != PLAYER_IA_NONE) { + EnBjt_TakeItem(player->exchangeItemAction); + player->exchangeItemAction = PLAYER_IA_NONE; } if (EnBjt_Vanish(this)) { this->timer = 60; @@ -319,9 +320,10 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { s32 EnBjt_CheckTalk(EnBjt* this, PlayState* play) { s32 ret = false; - if ((this->stateFlags & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (((this->stateFlags & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->stateFlags |= TOILET_HAND_STATE_TALKING; - SubS_UpdateFlags(&this->stateFlags, 0, 7); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->msgEventCallback = EnBjt_ChooseBehaviour; this->behaviour = 0; this->actionFunc = EnBjt_Talk; @@ -364,7 +366,7 @@ void EnBjt_Talk(EnBjt* this, PlayState* play) { if (func_8010BF58(&this->actor, play, sMsgEventScript, this->msgEventCallback, &this->msgEventArg4)) { this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; - SubS_UpdateFlags(&this->stateFlags, 3, 7); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->stateFlags &= ~TOILET_HAND_STATE_TALKING; this->msgEventArg4 = 0; this->actionFunc = EnBjt_FollowSchedule; @@ -383,7 +385,7 @@ void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { if (scheduleOutput.result == TOILET_HAND_SCH_AVAILABLE) { if (this->stateFlags & TOILET_HAND_STATE_APPEARING) { if (EnBjt_Appear(this)) { - SubS_UpdateFlags(&this->stateFlags, 3, 7); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } } else if (this->stateFlags & TOILET_HAND_STATE_VANISHING) { EnBjt_Vanish(this); @@ -391,7 +393,7 @@ void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { // Vanish if player goes too far away or heart piece given if ((fabsf(this->actor.playerHeightRel) > 70.0f) || (this->actor.xzDistToPlayer > 140.0f) || CHECK_WEEKEVENTREG(WEEKEVENTREG_90_80)) { - SubS_UpdateFlags(&this->stateFlags, 0, 7); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->playedSfx = false; this->stateFlags &= ~TOILET_HAND_STATE_VISIBLE; this->stateFlags |= TOILET_HAND_STATE_VANISHING; @@ -446,7 +448,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, PLAYER_IA_NONE, this->stateFlags & 7); + SubS_Offer(&this->actor, play, 60.0f, 10.0f, PLAYER_IA_NONE, this->stateFlags & SUBS_OFFER_MODE_MASK); Actor_SetFocus(&this->actor, 26.0f); EnBjt_UpdateCollision(this, play); } diff --git a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c index bd4b0e499..6abc25f79 100644 --- a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c +++ b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c @@ -6,7 +6,7 @@ #include "z_en_boj_01.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBoj01*)thisx) @@ -29,9 +29,12 @@ ActorInit En_Boj_01_InitVars = { void EnBoj01_Init(Actor* thisx, PlayState* play) { } + void EnBoj01_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj01_Update(Actor* thisx, PlayState* play) { } + void EnBoj01_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c index 89f6ba0cb..ccf96aa67 100644 --- a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c +++ b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c @@ -6,7 +6,7 @@ #include "z_en_boj_02.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBoj02*)thisx) @@ -29,9 +29,12 @@ ActorInit En_Boj_02_InitVars = { void EnBoj02_Init(Actor* thisx, PlayState* play) { } + void EnBoj02_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj02_Update(Actor* thisx, PlayState* play) { } + void EnBoj02_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c index 0c55b79a6..ee00b2b5c 100644 --- a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c +++ b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c @@ -6,7 +6,7 @@ #include "z_en_boj_03.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBoj03*)thisx) @@ -29,9 +29,12 @@ ActorInit En_Boj_03_InitVars = { void EnBoj03_Init(Actor* thisx, PlayState* play) { } + void EnBoj03_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj03_Update(Actor* thisx, PlayState* play) { } + void EnBoj03_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c index 7fe308520..8ef2c98ea 100644 --- a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c +++ b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c @@ -6,7 +6,7 @@ #include "z_en_boj_04.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBoj04*)thisx) @@ -29,9 +29,12 @@ ActorInit En_Boj_04_InitVars = { void EnBoj04_Init(Actor* thisx, PlayState* play) { } + void EnBoj04_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj04_Update(Actor* thisx, PlayState* play) { } + void EnBoj04_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c index da6816840..ccb7f1cef 100644 --- a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c +++ b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c @@ -6,7 +6,7 @@ #include "z_en_boj_05.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBoj05*)thisx) @@ -29,9 +29,12 @@ ActorInit En_Boj_05_InitVars = { void EnBoj05_Init(Actor* thisx, PlayState* play) { } + void EnBoj05_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj05_Update(Actor* thisx, PlayState* play) { } + void EnBoj05_Draw(Actor* thisx, PlayState* play) { } 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 b388421b7..2f76201c5 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -6,6 +6,7 @@ #include "z_en_bom.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -138,7 +139,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.cylHeight = 10; this->flashSpeedScale = 7; - this->isPowderKeg = ENBOM_GETX_1(&this->actor); + this->isPowderKeg = ENBOM_GET_1(&this->actor); if (this->isPowderKeg) { play->actorCtx.flags |= ACTORCTX_FLAG_0; this->timer = gSaveContext.powderKegTimer; @@ -151,19 +152,19 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); if (!this->isPowderKeg) { - Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit1, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit1, this->collider2Elements); this->collider1.dim.radius = 6; this->collider1.dim.height = 11; } else { - Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); this->collider1.dim.radius = 20; this->collider1.dim.height = 36; func_80872648(play, &this->actor.world.pos); } - this->collider3.info.toucher.damage += ENBOM_GETZ_FF00(thisx); + this->collider2Elements[0].info.toucher.damage += ENBOM_GET_FF00(thisx); this->actor.shape.rot.z &= 0xFF; - if (ENBOM_GETZ_80(&this->actor)) { + if (ENBOM_GET_80(&this->actor)) { this->actor.shape.rot.z |= 0xFF00; } @@ -355,28 +356,28 @@ void EnBom_Explode(EnBom* this, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } - if (play->envCtx.lightSettings.diffuseColor1[0] != 0) { - play->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.adjLightSettings.light1Color[0] != 0) { + play->envCtx.adjLightSettings.light1Color[0] -= 25; } - if (play->envCtx.lightSettings.diffuseColor1[1] != 0) { - play->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.adjLightSettings.light1Color[1] != 0) { + play->envCtx.adjLightSettings.light1Color[1] -= 25; } - if (play->envCtx.lightSettings.diffuseColor1[2] != 0) { - play->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.adjLightSettings.light1Color[2] != 0) { + play->envCtx.adjLightSettings.light1Color[2] -= 25; } - if (play->envCtx.lightSettings.ambientColor[0] != 0) { - play->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[0] != 0) { + play->envCtx.adjLightSettings.ambientColor[0] -= 25; } - if (play->envCtx.lightSettings.ambientColor[1] != 0) { - play->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[1] != 0) { + play->envCtx.adjLightSettings.ambientColor[1] -= 25; } - if (play->envCtx.lightSettings.ambientColor[2] != 0) { - play->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[2] != 0) { + play->envCtx.adjLightSettings.ambientColor[2] -= 25; } if (this->timer == 0) { @@ -493,10 +494,10 @@ void EnBom_Update(Actor* thisx, PlayState* play) { EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } if (this->isPowderKeg) { - func_801A0810(&thisx->projectedPos, NA_SE_IT_BIG_BOMB_IGNIT - SFX_FLAG, - (this->flashSpeedScale == 7) ? 0 - : (this->flashSpeedScale == 3) ? 1 - : 2); + Audio_PlaySfx_AtPosWithChannelIO(&thisx->projectedPos, NA_SE_IT_BIG_BOMB_IGNIT - SFX_FLAG, + (this->flashSpeedScale == 7) ? 0 + : (this->flashSpeedScale == 3) ? 1 + : 2); } else { Actor_PlaySfx(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); } @@ -543,14 +544,16 @@ void EnBom_Update(Actor* thisx, PlayState* play) { if (Actor_HasParent(thisx, play)) { effPos.y += 30.0f; } + //! @note Assumes `isPowderKeg` values aligns with clearTag params. + //! Here, 0/1 are small/large explosions respectively. Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y - 10.0f, effPos.z, 0, 0, 0, - this->isPowderKeg); + CLEAR_TAG_PARAMS(this->isPowderKeg)); Actor_RequestQuakeAndRumble(thisx, play, sQuakeY[this->isPowderKeg], sQuakeDurations[this->isPowderKeg]); - play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = - play->envCtx.lightSettings.diffuseColor1[2] = 250; - play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = - play->envCtx.lightSettings.ambientColor[2] = 250; + play->envCtx.adjLightSettings.light1Color[0] = play->envCtx.adjLightSettings.light1Color[1] = + play->envCtx.adjLightSettings.light1Color[2] = 250; + play->envCtx.adjLightSettings.ambientColor[0] = play->envCtx.adjLightSettings.ambientColor[1] = + play->envCtx.adjLightSettings.ambientColor[2] = 250; Camera_AddQuake(&play->mainCamera, 2, 11, 8); thisx->params = BOMB_TYPE_EXPLOSION; this->timer = 10; @@ -579,16 +582,17 @@ void EnBom_Update(Actor* thisx, PlayState* play) { if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != BOMB_TYPE_EXPLOSION)) { if (thisx->depthInWater >= 20.0f) { - Vec3f sp54; + Vec3f effPos; - sp54.x = thisx->world.pos.x; - sp54.y = thisx->world.pos.y + thisx->depthInWater; - sp54.z = thisx->world.pos.z; - EffectSsGRipple_Spawn(play, &sp54, 70, 500, 0); - EffectSsGRipple_Spawn(play, &sp54, 70, 500, 10); - sp54.y += 10.0f; - EffectSsGSplash_Spawn(play, &sp54, NULL, NULL, 1, 500); - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp54.x, sp54.y, sp54.z, 0, 0, 1, 200); + effPos.x = thisx->world.pos.x; + effPos.y = thisx->world.pos.y + thisx->depthInWater; + effPos.z = thisx->world.pos.z; + EffectSsGRipple_Spawn(play, &effPos, 70, 500, 0); + EffectSsGRipple_Spawn(play, &effPos, 70, 500, 10); + effPos.y += 10.0f; + EffectSsGSplash_Spawn(play, &effPos, NULL, NULL, 1, 500); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y, effPos.z, 0, 0, 1, + CLEAR_TAG_PARAMS(CLEAR_TAG_SMOKE)); SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 30, NA_SE_IT_BOMB_UNEXPLOSION); this->unk_1F4 = 0.0f; thisx->velocity.y = (KREG(83) * 0.1f) + -2.0f; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index d11547230..723c11e8a 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -7,9 +7,9 @@ struct EnBom; typedef void (*EnBomActionFunc)(struct EnBom*, PlayState*); -#define ENBOM_GETX_1(thisx) ((thisx)->shape.rot.x & 1) -#define ENBOM_GETZ_80(thisx) ((thisx)->shape.rot.z & 0x80) -#define ENBOM_GETZ_FF00(thisx) (((thisx)->shape.rot.z & 0xFF00) >> 8) +#define ENBOM_GET_1(thisx) ((thisx)->shape.rot.x & 1) +#define ENBOM_GET_80(thisx) ((thisx)->shape.rot.z & 0x80) +#define ENBOM_GET_FF00(thisx) (((thisx)->shape.rot.z & 0xFF00) >> 8) typedef enum BombType { /* 0 */ BOMB_TYPE_BODY, @@ -26,7 +26,7 @@ typedef struct EnBom { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider1; /* 0x190 */ ColliderJntSph collider2; - /* 0x1B0 */ ColliderJntSphElement collider3; + /* 0x1B0 */ ColliderJntSphElement collider2Elements[1]; /* 0x1F0 */ s16 timer; /* 0x1F2 */ s16 flashSpeedScale; /* 0x1F4 */ f32 unk_1F4; 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 19f2e1d9b..061081bc1 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 @@ -7,7 +7,7 @@ #include "z_en_bom_bowl_man.h" #include "objects/object_cs/object_cs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnBomBowlMan*)thisx) @@ -49,16 +49,75 @@ ActorInit En_Bom_Bowl_Man_InitVars = { (ActorFunc)EnBomBowlMan_Draw, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, &object_cs_Anim_003EE4, - &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, &object_cs_Anim_001708, - &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMBOWLMAN_ANIM_NONE = -1, + /* 0x00 */ ENBOMBOWLMAN_ANIM_0, + /* 0x01 */ ENBOMBOWLMAN_ANIM_1, + /* 0x02 */ ENBOMBOWLMAN_ANIM_2, + /* 0x03 */ ENBOMBOWLMAN_ANIM_3, + /* 0x04 */ ENBOMBOWLMAN_ANIM_4, + /* 0x05 */ ENBOMBOWLMAN_ANIM_5, + /* 0x06 */ ENBOMBOWLMAN_ANIM_6, + /* 0x07 */ ENBOMBOWLMAN_ANIM_7, + /* 0x08 */ ENBOMBOWLMAN_ANIM_8, + /* 0x09 */ ENBOMBOWLMAN_ANIM_9, + /* 0x0A */ ENBOMBOWLMAN_ANIM_10, + /* 0x0B */ ENBOMBOWLMAN_ANIM_11, + /* 0x0C */ ENBOMBOWLMAN_ANIM_12, + /* 0x0D */ ENBOMBOWLMAN_ANIM_13, + /* 0x0E */ ENBOMBOWLMAN_ANIM_14, + /* 0x0F */ ENBOMBOWLMAN_ANIM_15, + /* 0x10 */ ENBOMBOWLMAN_ANIM_16, + /* 0x11 */ ENBOMBOWLMAN_ANIM_17, + /* 0x12 */ ENBOMBOWLMAN_ANIM_18, + /* 0x13 */ ENBOMBOWLMAN_ANIM_19, + /* 0x14 */ ENBOMBOWLMAN_ANIM_MAX +} EnBomBowlManAnimation; + +static AnimationHeader* sAnimations[ENBOMBOWLMAN_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBOWLMAN_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMBOWLMAN_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMBOWLMAN_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMBOWLMAN_ANIM_3 + &object_cs_Anim_002044, // ENBOMBOWLMAN_ANIM_4 + &object_cs_Anim_01007C, // ENBOMBOWLMAN_ANIM_5 + &object_cs_Anim_00349C, // ENBOMBOWLMAN_ANIM_6 + &object_cs_Anim_004960, // ENBOMBOWLMAN_ANIM_7 + &object_cs_Anim_005128, // ENBOMBOWLMAN_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMBOWLMAN_ANIM_9 + &object_cs_Anim_001A1C, // ENBOMBOWLMAN_ANIM_10 + &object_cs_Anim_003EE4, // ENBOMBOWLMAN_ANIM_11 + &object_cs_Anim_00478C, // ENBOMBOWLMAN_ANIM_12 + &object_cs_Anim_00433C, // ENBOMBOWLMAN_ANIM_13 + &object_cs_Anim_0060E8, // ENBOMBOWLMAN_ANIM_14 + &object_cs_Anim_001708, // ENBOMBOWLMAN_ANIM_15 + &object_cs_Anim_005DC4, // ENBOMBOWLMAN_ANIM_16 + &object_cs_Anim_0026B0, // ENBOMBOWLMAN_ANIM_17 + &object_cs_Anim_0036B0, // ENBOMBOWLMAN_ANIM_18 + &object_cs_Anim_0031C4, // ENBOMBOWLMAN_ANIM_19 }; -u8 D_809C6178[] = { - 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, +static u8 sAnimationModes[ENBOMBOWLMAN_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_0 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_1 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_2 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_3 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_4 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_5 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_6 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_7 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_8 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_9 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_10 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_11 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_12 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_13 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_14 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_15 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_16 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_17 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_18 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_19 }; u16 D_809C618C[] = { 0x710, 0x711, 0x715, 0x716, 0x717, 0x718 }; @@ -77,10 +136,10 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, - this->morphTable, 21); + this->morphTable, OBJECT_CS_LIMB_MAX); this->unk_2F6 = ENBOMBOWLMAN_GET_F0(&this->actor); this->unk_2F4 = ENBOMBOWLMAN_GET_F(&this->actor); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { @@ -112,37 +171,37 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void func_809C493C(EnBomBowlMan* this, s32 arg1, f32 arg2) { - this->unk_2F8 = arg1; - this->unk_2C4 = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[this->unk_2F8], arg2, 0.0f, this->unk_2C4, D_809C6178[this->unk_2F8], - -4.0f); +void EnBomBowlMan_ChangeAnim(EnBomBowlMan* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_809C49CC(EnBomBowlMan* this) { - if ((this->unk_2F8 == 5) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0xB) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_11) && (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0x12) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0xF) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMBOWLMAN_ANIM_15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2F8 == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMBOWLMAN_ANIM_6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -171,7 +230,7 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { s8 code; func_809C4B50(this); - func_809C493C(this, 0, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.bomberCode); i++) { Math_Vec3f_Copy(&sp7C, &this->actor.home.pos); @@ -199,7 +258,7 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { CutsceneManager_Queue(this->csId1); } - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_290 = this->actor.yawTowardsPlayer; CLEAR_WEEKEVENTREG(WEEKEVENTREG_73_10); @@ -252,12 +311,12 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); break; case 1: D_809C6104 = 0; - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2C0 = 2; if ((player->transformation == PLAYER_FORM_HUMAN) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { @@ -274,7 +333,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { } else { this->unk_2C0 = 3; play->msgCtx.msgLength = 0; - func_809C493C(this, 1, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_1, 1.0f); D_809C6100 = 1; if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); @@ -302,7 +361,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { CutsceneManager_Stop(this->csId1); } play->msgCtx.msgLength = 0; - func_809C493C(this, 1, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_1, 1.0f); D_809C6100 = 1; this->actionFunc = func_809C5B1C; sp28 = true; @@ -315,6 +374,9 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C51B4; sp28 = true; break; + + default: + break; } if (!sp28) { @@ -331,7 +393,7 @@ void func_809C51B4(EnBomBowlMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((play->msgCtx.bombersNotebookEventQueueCount == 0) && - ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { + ((play->msgCtx.msgMode == MSGMODE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { play->nextEntrance = Entrance_CreateFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -352,7 +414,7 @@ void func_809C52B4(EnBomBowlMan* this) { this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.world.pos.x = 1340.0f; this->actor.world.pos.z = -1795.0f; this->unk_29C = 3; @@ -378,7 +440,7 @@ void func_809C53A4(EnBomBowlMan* this) { this->actor.draw = EnBomBowlMan_Draw; this->actor.world.pos.x = 1360.0f; this->actor.world.pos.z = -1870.0f; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); this->unk_29C = 3; this->actionFunc = func_809C5408; } @@ -404,7 +466,7 @@ void func_809C5524(EnBomBowlMan* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { this->actor.textId = 0x72F; } - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_809C5598; } @@ -424,14 +486,14 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x715; } else if (this->actor.textId == 0x715) { func_800B7298(play, &this->actor, PLAYER_CSMODE_END); - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); func_809C59A4(this, play); return; } else if (this->actor.textId == 0x716) { this->actor.textId = 0x735; } else if (this->actor.textId == 0x735) { this->unk_2C2 = 0; - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_LEARNED_SECRET_CODE); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_BOMBERS_NOTEBOOK); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_BOMBERS); @@ -449,7 +511,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { if (this->unk_2C2 == 0) { if ((play->msgCtx.bombersNotebookEventQueueCount == 0) && - ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { + ((play->msgCtx.msgMode == MSGMODE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { this->unk_2C2 = 1; func_809C4B6C(this); if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { @@ -460,7 +522,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } else { CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); } } } else if (this->unk_2C2 == 1) { @@ -472,7 +534,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } else { CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); } } else { Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 2000, 10); @@ -510,7 +572,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) { } else { this->actor.textId = 0x716; } - func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_809C5AA4; } else { Actor_OfferGetItem(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); @@ -525,7 +587,7 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C5598; } } else { - func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); } } @@ -543,33 +605,33 @@ void func_809C5B1C(EnBomBowlMan* this, PlayState* play) { void func_809C5BA0(EnBomBowlMan* this) { if (this->unk_2F4 != 0) { - func_809C493C(this, 0, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); } else { - this->unk_2F8 = 0; + this->animIndex = ENBOMBOWLMAN_ANIM_0; } this->unk_29C = 2; this->actionFunc = func_809C5BF4; } void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { - f32 sp2C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Camera* subCam; - if ((D_809C6104 != 0) && (this->unk_2F8 != 15)) { - func_809C493C(this, 15, 1.0f); + if ((D_809C6104 != 0) && (this->animIndex != ENBOMBOWLMAN_ANIM_15)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_15, 1.0f); } - if ((this->unk_2F8 == 15) && (this->unk_2C4 <= sp2C)) { - func_809C493C(this, 0, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_15) && (curFrame >= this->animEndFrame)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); } if (D_809C6100 != 0) { - if ((this->unk_2F8 == 0) && (D_809C6100 == (this->unk_2F4 + 1))) { - func_809C493C(this, 11, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_0) && (D_809C6100 == (this->unk_2F4 + 1))) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_11, 1.0f); } - if ((this->unk_2F8 == 11) && (this->unk_2C4 <= sp2C)) { - func_809C493C(this, 12, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_11) && (curFrame >= this->animEndFrame)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_12, 1.0f); D_809C6100++; } @@ -581,7 +643,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { Message_CloseTextbox(play); Camera_SetTargetActor(subCam, &this->unk_2D8[0]->actor); - func_809C493C(this, 13, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_13, 1.0f); D_809C6100 = 0; if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2C0 = 5; @@ -638,19 +700,19 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomBowlMan* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_CS_LIMB_0F) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; } - if ((limbIndex == 19) && (this->unk_2F6 == ENBOMBOWLMAN_F0_2)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2F6 == ENBOMBOWLMAN_F0_2)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2F6 == ENBOMBOWLMAN_F0_0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2F6 == ENBOMBOWLMAN_F0_0)) { *dList = NULL; } return false; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index df515ef4f..b6b749076 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -2,6 +2,7 @@ #define Z_EN_BOM_BOWL_MAN_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomBowlMan; @@ -19,8 +20,8 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); typedef struct EnBomBowlMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomBowlManActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -41,7 +42,7 @@ typedef struct EnBomBowlMan { /* 0x2BE */ UNK_TYPE1 unk2BE[2]; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; - /* 0x2C4 */ f32 unk_2C4; + /* 0x2C4 */ f32 animEndFrame; /* 0x2C8 */ f32 unk_2C8; /* 0x2CC */ s16 csIdList[2]; /* 0x2D0 */ s16 csId1; @@ -54,7 +55,7 @@ typedef struct EnBomBowlMan { /* 0x2F2 */ s16 unk_2F2; /* 0x2F4 */ s16 unk_2F4; /* 0x2F6 */ s16 unk_2F6; - /* 0x2F8 */ s32 unk_2F8; + /* 0x2F8 */ s32 animIndex; } EnBomBowlMan; // size = 0x2FC #endif // Z_EN_BOM_BOWL_MAN_H 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 ee00081db..4409a7316 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 @@ -58,7 +58,7 @@ static ColliderSphereInit sSphereInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000 * BOMBCHU_SCALE, ICHAIN_STOP), }; @@ -180,8 +180,8 @@ void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.shape.rot.y = player->actor.shape.rot.y; - this->actor.flags |= ACTOR_FLAG_1; - func_800B8EF4(play, &this->actor); + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + Actor_PlaySfx_SurfaceBomb(play, &this->actor); this->isMoving = true; this->actor.speed = 8.0f; @@ -313,7 +313,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) { } if (this->isMoving) { - func_800B8F98(&this->actor, NA_SE_IT_BOMBCHU_MOVE - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_IT_BOMBCHU_MOVE - SFX_FLAG); } if (this->actor.speed != 0.0f) { diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index ef30692e6..5d45ffc55 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -5,6 +5,7 @@ */ #include "z_en_bombal.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "assets/objects/object_fusen/object_fusen.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -63,7 +64,7 @@ void EnBombal_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); this->actor.colChkInfo.mass = 0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.colChkInfo.health = 1; this->scale = 0.1f; this->csId = this->actor.csId; @@ -105,7 +106,7 @@ void func_80C05B3C(EnBombal* this, PlayState* play) { void func_80C05C44(EnBombal* this, PlayState* play) { s32 phi_s0 = false; s32 i; - Vec3f pos; + Vec3f effPos; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { @@ -126,13 +127,13 @@ void func_80C05C44(EnBombal* this, PlayState* play) { } if (phi_s0) { - Math_Vec3f_Copy(&pos, &this->actor.world.pos); - pos.y += 60.0f; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, pos.x, pos.y, pos.z, 255, 255, 200, - CLEAR_TAG_LARGE_EXPLOSION); + Math_Vec3f_Copy(&effPos, &this->actor.world.pos); + effPos.y += 60.0f; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y, effPos.z, 255, 255, 200, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_EXPLOSION)); for (i = 0; i < 100; i++) { - EnBombal_InitEffects(this, &pos, 10); + EnBombal_InitEffects(this, &effPos, 10); } SET_WEEKEVENTREG(WEEKEVENTREG_83_04); @@ -194,24 +195,24 @@ void EnBombal_Draw(Actor* thisx, PlayState* play) { void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay) { s16 i; - EnBombalEffect* sPtr = this->effects; + EnBombalEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (!sPtr->isEnabled) { - sPtr->isEnabled = true; - sPtr->pos = *pos; - sPtr->alphaFadeDelay = fadeDelay; - sPtr->alpha = 255; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->pos = *pos; + effect->alphaFadeDelay = fadeDelay; + effect->alpha = 255; - sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->velocity.x = Rand_ZeroOne() - 0.5f; - sPtr->velocity.y = Rand_ZeroOne() - 0.5f; - sPtr->velocity.z = Rand_ZeroOne() - 0.5f; + effect->velocity.x = Rand_ZeroOne() - 0.5f; + effect->velocity.y = Rand_ZeroOne() - 0.5f; + effect->velocity.z = Rand_ZeroOne() - 0.5f; - sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; + effect->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; return; } } @@ -219,23 +220,23 @@ void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay) { void EnBombal_UpdateEffects(EnBombal* this, PlayState* play) { s32 i; - EnBombalEffect* sPtr = this->effects; + EnBombalEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (sPtr->isEnabled) { - sPtr->pos.x += sPtr->velocity.x; - sPtr->pos.y += sPtr->velocity.y; - sPtr->pos.z += sPtr->velocity.z; - sPtr->velocity.x += sPtr->accel.x; - sPtr->velocity.y += sPtr->accel.y; - sPtr->velocity.z += sPtr->accel.z; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; - if (sPtr->alphaFadeDelay != 0) { - sPtr->alphaFadeDelay--; + if (effect->alphaFadeDelay != 0) { + effect->alphaFadeDelay--; } else { - sPtr->alpha -= 10; - if (sPtr->alpha < 10) { - sPtr->isEnabled = 0; + effect->alpha -= 10; + if (effect->alpha < 10) { + effect->isEnabled = 0; } } } @@ -245,17 +246,17 @@ void EnBombal_UpdateEffects(EnBombal* this, PlayState* play) { void EnBombal_DrawEffects(EnBombal* this, PlayState* play) { s16 i; GraphicsContext* gfxCtx = play->state.gfxCtx; - EnBombalEffect* sPtr = this->effects; + EnBombalEffect* effect = this->effects; OPEN_DISPS(gfxCtx); Gfx_SetupDL25_Opa(gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (sPtr->isEnabled != 0) { - Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); - Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_20); @@ -266,7 +267,7 @@ void EnBombal_DrawEffects(EnBombal* this, PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, effect->alpha); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 55f7ff281..4f4b15545 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -6,9 +6,8 @@ #include "z_en_bombers.h" #include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" -#include "objects/object_cs/object_cs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnBombers*)thisx) @@ -57,18 +56,66 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -AnimationHeader* D_80C0479C[] = { - &gBomberIdleAnim, &object_cs_Anim_0053F4, &object_cs_Anim_01007C, &object_cs_Anim_00349C, - &object_cs_Anim_004960, &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, - &object_cs_Anim_003EE4, &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, - &object_cs_Anim_001708, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, - &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMBERS_ANIM_NONE = -1, + /* 0x00 */ ENBOMBERS_ANIM_0, + /* 0x01 */ ENBOMBERS_ANIM_1, + /* 0x02 */ ENBOMBERS_ANIM_2, + /* 0x03 */ ENBOMBERS_ANIM_3, + /* 0x04 */ ENBOMBERS_ANIM_4, + /* 0x05 */ ENBOMBERS_ANIM_5, + /* 0x06 */ ENBOMBERS_ANIM_6, + /* 0x07 */ ENBOMBERS_ANIM_7, + /* 0x08 */ ENBOMBERS_ANIM_8, + /* 0x09 */ ENBOMBERS_ANIM_9, + /* 0x0A */ ENBOMBERS_ANIM_10, + /* 0x0B */ ENBOMBERS_ANIM_11, + /* 0x0C */ ENBOMBERS_ANIM_12, + /* 0x0D */ ENBOMBERS_ANIM_13, + /* 0x0E */ ENBOMBERS_ANIM_14, + /* 0x0F */ ENBOMBERS_ANIM_15, + /* 0x10 */ ENBOMBERS_ANIM_16, + /* 0x11 */ ENBOMBERS_ANIM_MAX +} EnBombersAnimation; + +static AnimationHeader* sAnimations[ENBOMBERS_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBERS_ANIM_0 + &object_cs_Anim_0053F4, // ENBOMBERS_ANIM_1 + &object_cs_Anim_01007C, // ENBOMBERS_ANIM_2 + &object_cs_Anim_00349C, // ENBOMBERS_ANIM_3 + &object_cs_Anim_004960, // ENBOMBERS_ANIM_4 + &object_cs_Anim_005128, // ENBOMBERS_ANIM_5 + &object_cs_Anim_004C1C, // ENBOMBERS_ANIM_6 + &object_cs_Anim_001A1C, // ENBOMBERS_ANIM_7 + &object_cs_Anim_003EE4, // ENBOMBERS_ANIM_8 + &object_cs_Anim_00478C, // ENBOMBERS_ANIM_9 + &object_cs_Anim_00433C, // ENBOMBERS_ANIM_10 + &object_cs_Anim_0060E8, // ENBOMBERS_ANIM_11 + &object_cs_Anim_001708, // ENBOMBERS_ANIM_12 + &object_cs_Anim_005DC4, // ENBOMBERS_ANIM_13 + &object_cs_Anim_0026B0, // ENBOMBERS_ANIM_14 + &object_cs_Anim_0036B0, // ENBOMBERS_ANIM_15 + &object_cs_Anim_0031C4, // ENBOMBERS_ANIM_16 }; -u8 D_80C047E0[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMBERS_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBERS_ANIM_0 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_1 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_2 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_3 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_4 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_5 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_6 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_7 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_8 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_9 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_10 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_11 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_12 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_13 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_14 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_15 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_16 }; #include "overlays/ovl_En_Bombers/ovl_En_Bombers.c" @@ -95,9 +142,9 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -1.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, - this->morphtable, 21); + this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.01f); this->unk_2BC = ENBOMBERS_GET_F0(&this->actor); @@ -154,21 +201,21 @@ void EnBombers_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80C03824(EnBombers* this, s32 arg1, f32 arg2) { - this->unk_2C4 = arg1; - this->unk_2B0 = Animation_GetLastFrame(D_80C0479C[arg1]); - Animation_Change(&this->skelAnime, D_80C0479C[this->unk_2C4], arg2, 0.0f, this->unk_2B0, D_80C047E0[this->unk_2C4], - -10.0f); +void EnBombers_ChangeAnim(EnBombers* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -10.0f); } void func_80C038B4(EnBombers* this) { - if ((this->unk_2C4 == 2) && + if ((this->animIndex == ENBOMBERS_ANIM_2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2C4 == 15) && + if ((this->animIndex == ENBOMBERS_ANIM_15) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); @@ -210,6 +257,9 @@ void func_80C039A8(EnBombers* this, PlayState* play) { this->actor.textId = 0x744; } break; + + default: + break; } } @@ -242,7 +292,7 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp60))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C, &colPoly, true, false, false, true, &sp48)) { - func_80C03824(this, 2, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_2, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp60); this->unk_2AA = Rand_S16Offset(30, 50); this->unk_2A0++; @@ -265,9 +315,9 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { false, true, &sp48)) { this->unk_2A8 = 0; if (Rand_ZeroOne() < 0.5f) { - func_80C03824(this, 16, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_16, 1.0f); } else { - func_80C03824(this, 0, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2A0 = 0; this->unk_2B4 = 0.0f; @@ -281,9 +331,9 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { if ((this->unk_2AA == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2A8 = Rand_S16Offset(20, 20); if (!(this->unk_2A8 & 1)) { - func_80C03824(this, 16, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_16, 1.0f); } else { - func_80C03824(this, 0, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2A0 = 0; this->unk_2B4 = 0.0f; @@ -293,13 +343,16 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { Math_ApproachF(&this->unk_2B4, 1.0f, 0.3f, 0.5f); } break; + + default: + break; } - if (!Text_GetFaceReaction(play, 0x12)) { + if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS) == 0) { func_80C039A8(this, play); } else { this->unk_2A6 = TEXT_STATE_5; - this->actor.textId = Text_GetFaceReaction(play, 0x12); + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -308,13 +361,13 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { this->collider.dim.height = 60; func_80C03F64(this); } else { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } void func_80C03F64(EnBombers* this) { this->unk_2A4 = this->actor.yawTowardsPlayer; - func_80C03824(this, 1, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); this->unk_2C0 = 1; this->actionFunc = func_80C03FAC; } @@ -334,6 +387,9 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + + default: + break; } if ((this->unk_2A6 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { @@ -347,11 +403,11 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { sp2A = 1; } else if (this->actor.textId == 0x740) { if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->actor.textId = 0x742; sp2A = 1; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actor.textId = 0x741; sp2A = 1; } @@ -367,13 +423,13 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { sp2A = 1; } else if (this->actor.textId == 0x74C) { if (play->msgCtx.choiceIndex == 1) { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actor.textId = 0x737; sp2A = 1; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->actor.textId = 0x74D; - func_80C03824(this, 14, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_14, 1.0f); sp2A = 1; } } else if (this->actor.textId == 0x744) { @@ -409,6 +465,9 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case ENBOMBERS_F_4: SET_WEEKEVENTREG(WEEKEVENTREG_74_08); break; + + default: + break; } SET_WEEKEVENTREG(WEEKEVENTREG_73_40); } @@ -422,13 +481,16 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case 1: Message_ContinueTextbox(play, this->actor.textId); break; + + default: + break; } } } void func_80C042F8(EnBombers* this) { - if (this->unk_2C4 != 6) { - func_80C03824(this, 6, 1.0f); + if (this->animIndex != ENBOMBERS_ANIM_6) { + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); } this->actor.textId = 0x72D; this->unk_28E = 0x1F40; @@ -442,7 +504,7 @@ void func_80C04354(EnBombers* this, PlayState* play) { this->unk_28E = 0; this->actionFunc = func_80C043C8; } else { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h index 1585613ce..500fff573 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h @@ -2,6 +2,7 @@ #define Z_EN_BOMBERS_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBombers; @@ -23,8 +24,8 @@ typedef enum { typedef struct EnBombers { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphtable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombersActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -39,14 +40,14 @@ typedef struct EnBombers { /* 0x2A8 */ s16 unk_2A8; /* 0x2AA */ s16 unk_2AA; /* 0x2AC */ s16 unk_2AC; - /* 0x2B0 */ f32 unk_2B0; + /* 0x2B0 */ f32 animEndFrame; /* 0x2B4 */ f32 unk_2B4; /* 0x2B8 */ s16 unk_2B8; /* 0x2BA */ s16 unk_2BA; /* 0x2BC */ s16 unk_2BC; /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ s16 unk_2C0; - /* 0x2C4 */ s32 unk_2C4; + /* 0x2C4 */ s32 animIndex; /* 0x2C8 */ ColliderCylinder collider; } EnBombers; // size = 0x314 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 81e8723e0..b8795c3f2 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -6,7 +6,7 @@ #include "z_en_bombers2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnBombers2*)thisx) @@ -19,7 +19,6 @@ void func_80C04BA0(EnBombers2* this, PlayState* play); void func_80C04D8C(EnBombers2* this, PlayState* play); void func_80C0520C(EnBombers2* this, PlayState* play); void func_80C04B40(EnBombers2* this); -void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed); void func_80C04D00(EnBombers2* this); void func_80C050B8(EnBombers2* this, PlayState* play); @@ -59,14 +58,36 @@ static ColliderCylinderInit sCylinderInit = { { 35, 30, 0, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_0053F4, &object_cs_Anim_01007C, &object_cs_Anim_00349C, - &object_cs_Anim_0060E8, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, +typedef enum { + /* -1 */ ENBOMBERS_ANIM_NONE = -1, + /* 0 */ ENBOMBERS_ANIM_0, + /* 1 */ ENBOMBERS_ANIM_1, + /* 2 */ ENBOMBERS_ANIM_2, + /* 3 */ ENBOMBERS_ANIM_3, + /* 4 */ ENBOMBERS_ANIM_4, + /* 5 */ ENBOMBERS_ANIM_5, + /* 6 */ ENBOMBERS_ANIM_6, + /* 7 */ ENBOMBERS_ANIM_MAX +} EnBombersAnimation; + +static AnimationHeader* sAnimations[ENBOMBERS_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBERS_ANIM_0 + &object_cs_Anim_0053F4, // ENBOMBERS_ANIM_1 + &object_cs_Anim_01007C, // ENBOMBERS_ANIM_2 + &object_cs_Anim_00349C, // ENBOMBERS_ANIM_3 + &object_cs_Anim_0060E8, // ENBOMBERS_ANIM_4 + &object_cs_Anim_005DC4, // ENBOMBERS_ANIM_5 + &object_cs_Anim_0026B0, // ENBOMBERS_ANIM_6 }; -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMBERS_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBERS_ANIM_0 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_1 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_2 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_3 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_4 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_5 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_6 }; static Gfx sSetPrimColorDL[] = { @@ -90,9 +111,9 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->morphTable, - this->jointTable, OBJECT_CS_LIMB_MAX); - this->actor.targetMode = 6; + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + this->morphTable, OBJECT_CS_LIMB_MAX); + this->actor.targetMode = TARGET_MODE_6; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) || (gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2))) { @@ -115,20 +136,20 @@ void EnBombers2_Destroy(Actor* thisx, PlayState* play) { } void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed) { - f32 lastFrame; + f32 endFrame; this->animIndex = animIndex; - lastFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); - this->lastAnimFrame = lastFrame; - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, lastFrame, + endFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + this->lastAnimFrame = endFrame; + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, endFrame, sAnimationModes[this->animIndex], -10.0f); } void func_80C04B40(EnBombers2* this) { if (this->unk_2AC == 0) { - EnBombers2_ChangeAnim(this, 4, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_4, 1.0f); } else { - EnBombers2_ChangeAnim(this, 0, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2C0 = 0; this->actionFunc = func_80C04BA0; @@ -149,19 +170,23 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { this->textIdIndex = 1; this->talkState = TEXT_STATE_5; break; + case PLAYER_FORM_DEKU: case PLAYER_FORM_HUMAN: this->textIdIndex = 2; this->talkState = TEXT_STATE_5; break; + + default: + break; } if (this->unk_2AC != 0) { this->textIdIndex = 7; } this->actor.textId = sTextIds[this->textIdIndex]; - if (Text_GetFaceReaction(play, 0x15) != 0) { - this->actor.textId = Text_GetFaceReaction(play, 0x15); + if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD) != 0) { + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -171,20 +196,20 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { return; } if (yawDiffAbs < 0x3BB5) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } void func_80C04D00(EnBombers2* this) { if ((this->textIdIndex == 0) || (this->textIdIndex == 1)) { - EnBombers2_ChangeAnim(this, 5, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_5, 1.0f); } else { - EnBombers2_ChangeAnim(this, 1, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); } this->unk_2A8 = 0; if (this->unk_2AC != 0) { - EnBombers2_ChangeAnim(this, 6, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); } this->unk_2C0 = 1; this->actionFunc = func_80C04D8C; @@ -192,13 +217,13 @@ void func_80C04D00(EnBombers2* this) { void func_80C04D8C(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 temp = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; - if ((this->unk_2AC == 0) && (this->lastAnimFrame <= temp)) { + if ((this->unk_2AC == 0) && (curFrame >= this->lastAnimFrame)) { if (!(this->unk_2A8 & 1)) { - EnBombers2_ChangeAnim(this, 1, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); } else { - EnBombers2_ChangeAnim(this, 5, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_5, 1.0f); } this->unk_2A8++; this->unk_2A8 &= 1; @@ -207,10 +232,12 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { case PLAYER_FORM_HUMAN: this->unk_28E = -0xFA0; break; + case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + default: break; } @@ -240,7 +267,7 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { return; } } - if (Text_GetFaceReaction(play, 0x15) != 0) { + if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD) != 0) { this->unk_28E = 0; Message_CloseTextbox(play); func_80C04B40(this); @@ -256,12 +283,14 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { Message_CloseTextbox(play); func_80C04B40(this); break; + case 2: this->textIdIndex = 3; this->actor.textId = sTextIds[this->textIdIndex]; Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_15; break; + case 3: for (j = 0; j < ARRAY_COUNT(this->correctDigitSlots); j++) { this->correctDigitSlots[j] = false; @@ -272,16 +301,21 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; + case 4: this->textIdIndex = 5; this->actor.textId = sTextIds[this->textIdIndex]; Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; + case 6: play->msgCtx.msgLength = 0; func_80C050B8(this, play); break; + + default: + break; } } } @@ -291,7 +325,7 @@ void func_80C050B8(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 homeYawToPlayer; - EnBombers2_ChangeAnim(this, 2, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_2, 1.0f); this->unk_2A8 = 0; homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); Math_Vec3f_Copy(&this->unk_29C, &this->actor.world.pos); @@ -328,7 +362,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { Message_CloseTextbox(play); this->talkState = TEXT_STATE_5; this->textIdIndex = 7; - EnBombers2_ChangeAnim(this, 6, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); this->unk_2A8 = 0; this->unk_2C0 = 1; SET_WEEKEVENTREG(WEEKEVENTREG_73_80); @@ -355,7 +389,7 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { if (this->unk_2B2 != 0) { this->unk_2B2--; } - if ((this->animIndex == 2) && + if ((this->animIndex == ENBOMBERS_ANIM_2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); @@ -392,11 +426,11 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { this->actor.world.pos.x = (Math_SinS((this->actor.world.rot.y + 0x8000)) * 26.0f) + sp34.x; temp_f4 = Math_CosS(this->actor.world.rot.y + 0x8000) * 26.0f; this->actor.world.pos.z = temp_f4 + sp34.z; - this->collider.dim.radius = 0x23; - this->collider.dim.height = 0x1E; + this->collider.dim.radius = 35; + this->collider.dim.height = 30; } else { - this->collider.dim.radius = 0xA; - this->collider.dim.height = 0x19; + this->collider.dim.radius = 10; + this->collider.dim.height = 25; } Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index 9e6f6b577..f02c5eccb 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -2,7 +2,6 @@ #define Z_EN_BOMBERS2_H #include "global.h" - #include "objects/object_cs/object_cs.h" struct EnBombers2; @@ -12,8 +11,8 @@ typedef void (*EnBombers2ActionFunc)(struct EnBombers2*, PlayState*); typedef struct EnBombers2 { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x188 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; - /* 0x206 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombers2ActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index cc9ac1e2c..92dfe8418 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -6,9 +6,10 @@ #include "z_en_bombf.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_bombf/object_bombf.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10) #define THIS ((EnBombf*)thisx) @@ -109,7 +110,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play2) { thisx->focus.pos = thisx->world.pos; thisx->colChkInfo.cylRadius = 10; thisx->colChkInfo.cylHeight = 10; - thisx->targetMode = 0; + thisx->targetMode = TARGET_MODE_0; if (ENBOMBF_GET(thisx) == ENBOMBF_0) { this->timer = 140; @@ -117,7 +118,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play2) { thisx->gravity = -1.5f; func_800BC154(play, &play->actorCtx, thisx, 3); thisx->colChkInfo.mass = 200; - thisx->flags &= ~ACTOR_FLAG_1; + thisx->flags &= ~ACTOR_FLAG_TARGETABLE; EnBombf_SetupAction(this, func_808AEE3C); } else { thisx->colChkInfo.mass = MASS_IMMOVABLE; @@ -157,7 +158,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { this->timer = 180; this->unk_204 = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_PL_PULL_UP_ROCK); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { player->actor.child = NULL; player->heldActor = NULL; @@ -177,7 +178,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { bombf->unk_1F8 = 1; bombf->timer = 0; this->timer = 180; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_204 = 0.0f; } } @@ -188,7 +189,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { if (bombf != NULL) { bombf->timer = 100; this->timer = 180; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_204 = 0.0f; } } else { @@ -208,7 +209,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { if (this->timer == 0) { this->unk_204 += 0.05f; if (this->unk_204 >= 1.0f) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } } @@ -239,7 +240,7 @@ void func_808AEE3C(EnBombf* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 1.5f, 0.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - func_800B8EF4(play, &this->actor); + Actor_PlaySfx_SurfaceBomb(play, &this->actor); if (this->actor.velocity.y < -6.0f) { this->actor.velocity.y *= -0.3f; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; @@ -272,28 +273,28 @@ void func_808AEFD4(EnBombf* this, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } - if (play->envCtx.lightSettings.diffuseColor1[0] != 0) { - play->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.adjLightSettings.light1Color[0] != 0) { + play->envCtx.adjLightSettings.light1Color[0] -= 25; } - if (play->envCtx.lightSettings.diffuseColor1[1] != 0) { - play->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.adjLightSettings.light1Color[1] != 0) { + play->envCtx.adjLightSettings.light1Color[1] -= 25; } - if (play->envCtx.lightSettings.diffuseColor1[2] != 0) { - play->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.adjLightSettings.light1Color[2] != 0) { + play->envCtx.adjLightSettings.light1Color[2] -= 25; } - if (play->envCtx.lightSettings.ambientColor[0] != 0) { - play->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[0] != 0) { + play->envCtx.adjLightSettings.ambientColor[0] -= 25; } - if (play->envCtx.lightSettings.ambientColor[1] != 0) { - play->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[1] != 0) { + play->envCtx.adjLightSettings.ambientColor[1] -= 25; } - if (play->envCtx.lightSettings.ambientColor[2] != 0) { - play->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[2] != 0) { + play->envCtx.adjLightSettings.ambientColor[2] -= 25; } if (this->timer == 0) { @@ -313,7 +314,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { Vec3f sp8C = { 0.0f, 0.0f, 0.0f }; Vec3f sp80 = { 0.0f, 0.1f, 0.0f }; Vec3f sp74 = { 0.0f, 0.0f, 0.0f }; - Vec3f sp68; + Vec3f effPos; Vec3f sp5C = { 0.0f, 0.6f, 0.0f }; Color_RGBA8 sp58 = { 255, 255, 255, 255 }; EnBombf* this = THIS; @@ -375,16 +376,16 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { if (this->unk_1F8 != 0) { sp5C.y = 0.2f; - sp68 = this->actor.world.pos; - sp68.y += 25.0f; + effPos = this->actor.world.pos; + effPos.y += 25.0f; if (this->timer < 127) { if ((play->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(play, &this->actor, &sp68, &sp8C, &sp74); + EffectSsGSpk_SpawnFuse(play, &this->actor, &effPos, &sp8C, &sp74); } Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); - sp68.y += 3.0f; - func_800B0DE0(play, &sp68, &sp8C, &sp5C, &sp58, &sp58, 0x32, 5); + effPos.y += 3.0f; + func_800B0DE0(play, &effPos, &sp8C, &sp5C, &sp58, &sp58, 0x32, 5); } if ((this->timer == 3) || (this->timer == 30) || (this->timer == 50) || (this->timer == 70)) { @@ -402,21 +403,21 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { } if (this->timer == 0) { - sp68 = this->actor.world.pos; - sp68.y += 10.0f; + effPos = this->actor.world.pos; + effPos.y += 10.0f; if (Actor_HasParent(&this->actor, play)) { - sp68.y += 30.0f; + effPos.y += 30.0f; } - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp68.x, sp68.y, sp68.z, 0, 0, 0, - CLEAR_TAG_SMALL_EXPLOSION); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y, effPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_EXPLOSION)); Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = - play->envCtx.lightSettings.diffuseColor1[2] = 250; - play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = - play->envCtx.lightSettings.ambientColor[2] = 250; + play->envCtx.adjLightSettings.light1Color[0] = play->envCtx.adjLightSettings.light1Color[1] = + play->envCtx.adjLightSettings.light1Color[2] = 250; + play->envCtx.adjLightSettings.ambientColor[0] = play->envCtx.adjLightSettings.ambientColor[1] = + play->envCtx.adjLightSettings.ambientColor[2] = 250; Camera_AddQuake(&play->mainCamera, 2, 11, 8); @@ -477,8 +478,8 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { if (ENBOMBF_GET(&this->actor) != ENBOMBF_0) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_bombf_DL_000340); - gSPDisplayList(POLY_OPA_DISP++, object_bombf_DL_000530); + gSPDisplayList(POLY_OPA_DISP++, gBombFlowerLeavesDL); + gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBaseLeavesDL); Matrix_Translate(0.0f, 1000.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->unk_204, this->unk_204, this->unk_204, MTXMODE_APPLY); @@ -495,7 +496,7 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gfx)); } - gSPDisplayList(POLY_OPA_DISP++, object_bombf_DL_000408); + gSPDisplayList(POLY_OPA_DISP++, gBombFlowerBombAndSparkDL); } else { Collider_UpdateSpheres(0, &this->colliderJntSph); } 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 229a1e695..cb8d48d3e 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -6,9 +6,8 @@ #include "overlays/actors/ovl_En_Bombal/z_en_bombal.h" #include "z_en_bomjima.h" -#include "objects/object_cs/object_cs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnBomjima*)thisx) @@ -99,18 +98,75 @@ u16 D_80C00A70[] = { u16 D_80C00A8C[] = { 0x736, 0x737, 0x738, 0x74E }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, &object_cs_Anim_003EE4, - &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, &object_cs_Anim_001708, - &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMJIMA_ANIM_NONE = -1, + /* 0x00 */ ENBOMJIMA_ANIM_0, + /* 0x01 */ ENBOMJIMA_ANIM_1, + /* 0x02 */ ENBOMJIMA_ANIM_2, + /* 0x03 */ ENBOMJIMA_ANIM_3, + /* 0x04 */ ENBOMJIMA_ANIM_4, + /* 0x05 */ ENBOMJIMA_ANIM_5, + /* 0x06 */ ENBOMJIMA_ANIM_6, + /* 0x07 */ ENBOMJIMA_ANIM_7, + /* 0x08 */ ENBOMJIMA_ANIM_8, + /* 0x09 */ ENBOMJIMA_ANIM_9, + /* 0x0A */ ENBOMJIMA_ANIM_10, + /* 0x0B */ ENBOMJIMA_ANIM_11, + /* 0x0C */ ENBOMJIMA_ANIM_12, + /* 0x0D */ ENBOMJIMA_ANIM_13, + /* 0x0E */ ENBOMJIMA_ANIM_14, + /* 0x0F */ ENBOMJIMA_ANIM_15, + /* 0x10 */ ENBOMJIMA_ANIM_16, + /* 0x11 */ ENBOMJIMA_ANIM_17, + /* 0x12 */ ENBOMJIMA_ANIM_18, + /* 0x13 */ ENBOMJIMA_ANIM_19, + /* 0x16 */ ENBOMJIMA_ANIM_MAX +} EnBomjimaAnimation; + +static AnimationHeader* sAnimations[ENBOMJIMA_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMJIMA_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMJIMA_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMJIMA_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMJIMA_ANIM_3 + &object_cs_Anim_002044, // ENBOMJIMA_ANIM_4 + &object_cs_Anim_01007C, // ENBOMJIMA_ANIM_5 + &object_cs_Anim_00349C, // ENBOMJIMA_ANIM_6 + &object_cs_Anim_004960, // ENBOMJIMA_ANIM_7 + &object_cs_Anim_005128, // ENBOMJIMA_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMJIMA_ANIM_9 + &object_cs_Anim_001A1C, // ENBOMJIMA_ANIM_10 + &object_cs_Anim_003EE4, // ENBOMJIMA_ANIM_11 + &object_cs_Anim_00478C, // ENBOMJIMA_ANIM_12 + &object_cs_Anim_00433C, // ENBOMJIMA_ANIM_13 + &object_cs_Anim_0060E8, // ENBOMJIMA_ANIM_14 + &object_cs_Anim_001708, // ENBOMJIMA_ANIM_15 + &object_cs_Anim_005DC4, // ENBOMJIMA_ANIM_16 + &object_cs_Anim_0026B0, // ENBOMJIMA_ANIM_17 + &object_cs_Anim_0036B0, // ENBOMJIMA_ANIM_18 + &object_cs_Anim_0031C4, // ENBOMJIMA_ANIM_19 }; -u8 D_80C00AE4[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMJIMA_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_0 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_1 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_2 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_3 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_4 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_5 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_6 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_7 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_8 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_9 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_10 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_11 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_12 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_13 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_14 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_15 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_16 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_17 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_18 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_19 }; s16 D_80C00AF8[] = { @@ -129,7 +185,7 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->unk_2E6 = ENBOMJIMA_GET_F0(&this->actor); this->unk_2E4 = ENBOMJIMA_GET_F(&this->actor); Actor_SetScale(&this->actor, 0.01f); @@ -205,34 +261,37 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { case 3: this->actor.textId = D_80C00A8C[this->unk_2C8]; break; + + default: + break; } } -void func_80BFE494(EnBomjima* this, s32 animIndex, f32 playSpeed) { +void EnBomjima_ChangeAnim(EnBomjima* this, s32 animIndex, f32 playSpeed) { this->animIndex = animIndex; - this->animLastFrame = Animation_GetLastFrame(sAnimations[animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animLastFrame, - D_80C00AE4[this->animIndex], -4.0f); + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_80BFE524(EnBomjima* this) { - if ((this->animIndex == 5) && + if ((this->animIndex == ENBOMJIMA_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->animIndex == 18) && + if ((this->animIndex == ENBOMJIMA_ANIM_18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMJIMA_ANIM_15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMJIMA_ANIM_6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -247,7 +306,7 @@ void func_80BFE65C(EnBomjima* this) { } void func_80BFE67C(EnBomjima* this, PlayState* play) { - f32 sp84 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; f32 x; f32 z; s16 abs; @@ -272,7 +331,7 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C, &sp50, true, false, false, true, &sp4C)) { - func_80BFE494(this, 5, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_5, 1.0f); Math_Vec3f_Copy(&this->unk_2A4, &sp54); this->unk_2BE = Rand_S16Offset(30, 50); this->unk_2A2++; @@ -281,7 +340,7 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { break; case 1: - if (sp84 >= 0.0f) { + if (curFrame >= 0.0f) { this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 10, 2000, 20); } @@ -297,9 +356,9 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { false, true, &sp4C)) { this->unk_2C0 = 0; if (Rand_ZeroOne() < 0.5f) { - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } else { - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } this->unk_2A2 = 0; this->unk_2D0 = 0.0f; @@ -313,13 +372,13 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { if ((this->unk_2BE == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2C0 = Rand_S16Offset(20, 20); if (!(this->unk_2C0 & 1)) { - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } else { - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } this->unk_2A2 = 0; this->unk_2D0 = 0.0f; - } else if (sp84 >= 0.0f) { + } else if (curFrame >= 0.0f) { Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, this->unk_2D0); Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, this->unk_2D0); Math_ApproachF(&this->unk_2D0, 1.0f, 0.3f, 0.5f); @@ -349,7 +408,7 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { } void func_80BFEB1C(EnBomjima* this) { - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); func_80BFE65C(this); this->action = EN_BOMJIMA_ACTION_0; this->actionFunc = func_80BFEB64; @@ -379,8 +438,8 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { } } - if (Text_GetFaceReaction(play, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(play, 0x11); + if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) { + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -390,7 +449,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { } if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } if ((this->bombal->actor.update == NULL) || (this->bombal->actor.colChkInfo.health == 0)) { @@ -400,7 +459,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { switch (this->unk_2A2) { case 0: - func_80BFE494(this, 4, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_4, 1.0f); this->unk_29A = -7000; this->unk_2A2++; break; @@ -430,7 +489,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { this->unk_2BC++; if (((s16)Rand_ZeroFloat(2.0f) + 3) < this->unk_2BC) { - func_80BFE494(this, 5, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_5, 1.0f); this->unk_29A = 0; Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos); this->unk_2A4.x += Rand_CenteredFloat(150.0f); @@ -456,7 +515,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { void func_80BFEFF0(EnBomjima* this) { this->bombal = NULL; - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); func_80BFE65C(this); this->action = EN_BOMJIMA_ACTION_1; this->actionFunc = func_80BFF03C; @@ -483,14 +542,14 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) { void func_80BFF120(EnBomjima* this) { func_80BFE65C(this); this->cutsceneTimer = 30; - func_80BFE494(this, 6, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_6, 1.0f); this->cutsceneEnded = false; this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; } void func_80BFF174(EnBomjima* this, PlayState* play) { - f32 sp2C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Player* player = GET_PLAYER(play); if (this->cutsceneTimer == 1) { @@ -498,8 +557,8 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { this->cutsceneEnded = true; } - if (Text_GetFaceReaction(play, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(play, 0x11); + if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) { + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -510,10 +569,10 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); - if ((this->animLastFrame <= sp2C) && (this->unk_2BC < 5)) { + if ((curFrame >= this->animEndFrame) && (this->unk_2BC < 5)) { this->unk_2BC++; - if (this->animIndex != 19) { - func_80BFE494(this, 19, 1.0f); + if (this->animIndex != ENBOMJIMA_ANIM_19) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } } @@ -557,12 +616,12 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { if (this->unk_2BC >= 5) { func_80BFE67C(this, play); } - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } void func_80BFF3F0(EnBomjima* this) { - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->action = EN_BOMJIMA_ACTION_3; this->actionFunc = func_80BFF430; } @@ -570,7 +629,7 @@ void func_80BFF3F0(EnBomjima* this) { void func_80BFF430(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->animLastFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBAL, this->unk_2B0.x, this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0); @@ -598,7 +657,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { Player* player = GET_PLAYER(play); - func_8019F208(); + Audio_PlaySfx_MessageDecide(); func_80BFE65C(this); this->unk_28E = 0; this->unk_29A = 0; @@ -609,14 +668,14 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { this->actor.textId = D_80C00A70[this->unk_2C8]; } Message_ContinueTextbox(play, this->actor.textId); - play_sound(NA_SE_SY_FOUND); - func_80BFE494(this, 15, 1.0f); + Audio_PlaySfx(NA_SE_SY_FOUND); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->action = EN_BOMJIMA_ACTION_5; this->actionFunc = func_80BFF6CC; } else { Player* player = GET_PLAYER(play); - func_8019F230(); + Audio_PlaySfx_MessageCancel(); func_80BFE65C(this); this->unk_2C8 = 10; if (player->transformation == PLAYER_FORM_DEKU) { @@ -635,10 +694,10 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->animLastFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); this->actionFunc = func_80BFF754; } } @@ -727,7 +786,7 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { gSaveContext.save.saveInfo.bombersCaughtOrder[3] = 0; gSaveContext.save.saveInfo.bombersCaughtOrder[4] = 0; - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); this->unk_2C8 = 9; if (player->transformation == PLAYER_FORM_DEKU) { @@ -743,7 +802,7 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { void func_80BFFB40(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); D_80C009F0 = 100; this->unk_2DC = 0; this->actionFunc = func_80BFFBC4; @@ -753,8 +812,8 @@ void func_80BFFB40(EnBomjima* this, PlayState* play) { void func_80BFFBC4(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if ((this->animIndex != 1) && (this->animLastFrame <= curFrame)) { - func_80BFE494(this, 1, 1.0f); + if ((this->animIndex != ENBOMJIMA_ANIM_1) && (curFrame >= this->animEndFrame)) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); } if ((D_80C009F4 != 0) && (this->unk_2C2 == 0)) { @@ -780,7 +839,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { void func_80BFFCFC(EnBomjima* this) { func_80BFE65C(this); - func_80BFE494(this, 18, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_18, 1.0f); this->action = EN_BOMJIMA_ACTION_6; this->actionFunc = func_80BFFD48; } @@ -795,7 +854,7 @@ void func_80BFFD48(EnBomjima* this, PlayState* play) { if (sqrtf(SQ(this->actor.world.pos.x - this->unk_2A4.x) + SQ(this->actor.world.pos.z - this->unk_2A4.z)) < 4.0f) { D_80C009F0++; this->unk_2DC = this->actor.parent->world.rot.y; - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); this->actionFunc = func_80BFFE48; } } @@ -807,7 +866,7 @@ void func_80BFFE48(EnBomjima* this, PlayState* play) { if (D_80C009F0 >= 100) { if (this->unk_2E4 != 4) { - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->unk_2DC = 0; func_80BFE65C(this); this->actionFunc = func_80BFFF54; @@ -815,7 +874,7 @@ void func_80BFFE48(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->unk_290, 10000, 1, 5000, 0); if (D_80C009F0 >= 103) { this->unk_2DC = 0; - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); func_80BFE65C(this); this->actionFunc = func_80BFFF54; } @@ -837,22 +896,22 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { } if (this->unk_2E4 != 4) { - if ((this->animIndex != 0) && (this->animLastFrame <= curFrame)) { + if ((this->animIndex != ENBOMJIMA_ANIM_0) && (curFrame >= this->animEndFrame)) { D_80C009F0++; - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } - } else if ((this->animIndex != 8) && (this->animLastFrame <= curFrame)) { - func_80BFE494(this, 8, 1.0f); + } else if ((this->animIndex != ENBOMJIMA_ANIM_8) && (curFrame >= this->animEndFrame)) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_8, 1.0f); D_80C009F4 = 1; } - if (this->animIndex == 8) { + if (this->animIndex == ENBOMJIMA_ANIM_8) { if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); D_80C009F4 = 2; } - if ((this->animLastFrame <= curFrame) && (this->unk_2C0 == 0)) { + if ((curFrame >= this->animEndFrame) && (this->unk_2C0 == 0)) { this->unk_2C0 = 10; } @@ -864,7 +923,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { void func_80C0011C(EnBomjima* this) { func_80BFE65C(this); - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); this->action = EN_BOMJIMA_ACTION_7; this->actionFunc = func_80C00168; } @@ -881,20 +940,20 @@ void func_80C00168(EnBomjima* this, PlayState* play) { func_80BFE32C(this, play, 0); func_80BFE67C(this, play); - if (Text_GetFaceReaction(play, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(play, 0x11); + if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) { + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2DC = this->actor.yawTowardsPlayer; func_80C00234(this); } else { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } void func_80C00234(EnBomjima* this) { - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); this->collider.dim.radius = 15; this->collider.dim.height = 40; func_80BFE65C(this); @@ -903,16 +962,16 @@ void func_80C00234(EnBomjima* this) { void func_80C00284(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 sp28 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); if (((this->action == EN_BOMJIMA_ACTION_0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || (this->unk_2CA == 1)) && - (this->animLastFrame <= sp28)) { + (curFrame >= this->animEndFrame)) { if (!(this->unk_2BC & 1)) { - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); } else { - func_80BFE494(this, 16, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_16, 1.0f); } this->unk_2BC++; this->unk_2BC &= 1; @@ -927,6 +986,9 @@ void func_80C00284(EnBomjima* this, PlayState* play) { case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + + default: + break; } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -966,10 +1028,10 @@ void func_80C00284(EnBomjima* this, PlayState* play) { if (this->unk_2C8 == 10) { func_80BFE65C(this); this->unk_28E = 0; - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; - return; + break; } this->unk_2C8++; @@ -995,9 +1057,12 @@ void func_80C00284(EnBomjima* this, PlayState* play) { this->actor.textId = D_80C00A8C[this->unk_2C8]; Message_ContinueTextbox(play, this->actor.textId); if (this->unk_2C8 >= 2) { - func_80BFE494(this, 17, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_17, 1.0f); } break; + + default: + break; } } } @@ -1055,24 +1120,24 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) { s32 EnBomjima_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjima* this = THIS; - if (limbIndex == 8) { + if (limbIndex == OBJECT_CS_LIMB_08) { rot->z += this->unk_294; } - if ((limbIndex == 15) && (this->unk_2E6 == 2)) { + if ((limbIndex == OBJECT_CS_LIMB_0F) && (this->unk_2E6 == 2)) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; rot->z += this->unk_288; } - if ((limbIndex == 19) && (this->unk_2E6 == 2)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2E6 == 2)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2E6 == 0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2E6 == 0)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index b8196b344..15b4b10fb 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -2,6 +2,7 @@ #define Z_EN_BOMJIMA_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomjima; @@ -13,8 +14,8 @@ typedef void (*EnBomjimaActionFunc)(struct EnBomjima*, PlayState*); typedef struct EnBomjima { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomjimaActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -38,7 +39,7 @@ typedef struct EnBomjima { /* 0x2C6 */ s16 unk_2C6; /* 0x2C8 */ s16 unk_2C8; /* 0x2CA */ s16 unk_2CA; - /* 0x2CC */ f32 animLastFrame; + /* 0x2CC */ f32 animEndFrame; /* 0x2D0 */ f32 unk_2D0; /* 0x2D4 */ s16 csIdList[2]; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? 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 fbdcb860f..2e1984651 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -6,9 +6,8 @@ #include "z_en_bomjimb.h" #include "overlays/actors/ovl_En_Niw/z_en_niw.h" -#include "objects/object_cs/object_cs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnBomjimb*)thisx) @@ -72,20 +71,81 @@ static ColliderCylinderInit sCylinderInit = { { 20, 30, 0, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_002930, &object_cs_Anim_001A1C, - &object_cs_Anim_003EE4, &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, - &object_cs_Anim_001708, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, - &object_cs_Anim_0031C4, &object_cs_Anim_010B68, +typedef enum { + /* -1 */ ENBOMJIMB_ANIM_NONE = -1, + /* 0x00 */ ENBOMJIMB_ANIM_0, + /* 0x01 */ ENBOMJIMB_ANIM_1, + /* 0x02 */ ENBOMJIMB_ANIM_2, + /* 0x03 */ ENBOMJIMB_ANIM_3, + /* 0x04 */ ENBOMJIMB_ANIM_4, + /* 0x05 */ ENBOMJIMB_ANIM_5, + /* 0x06 */ ENBOMJIMB_ANIM_6, + /* 0x07 */ ENBOMJIMB_ANIM_7, + /* 0x08 */ ENBOMJIMB_ANIM_8, + /* 0x09 */ ENBOMJIMB_ANIM_9, + /* 0x0A */ ENBOMJIMB_ANIM_10, + /* 0x0B */ ENBOMJIMB_ANIM_11, + /* 0x0C */ ENBOMJIMB_ANIM_12, + /* 0x0D */ ENBOMJIMB_ANIM_13, + /* 0x0E */ ENBOMJIMB_ANIM_14, + /* 0x0F */ ENBOMJIMB_ANIM_15, + /* 0x10 */ ENBOMJIMB_ANIM_16, + /* 0x11 */ ENBOMJIMB_ANIM_17, + /* 0x12 */ ENBOMJIMB_ANIM_18, + /* 0x13 */ ENBOMJIMB_ANIM_19, + /* 0x14 */ ENBOMJIMB_ANIM_20, + /* 0x15 */ ENBOMJIMB_ANIM_21, + /* 0x16 */ ENBOMJIMB_ANIM_MAX +} EnBomjimbAnimation; + +static AnimationHeader* sAnimations[ENBOMJIMB_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMJIMB_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMJIMB_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMJIMB_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMJIMB_ANIM_3 + &object_cs_Anim_002044, // ENBOMJIMB_ANIM_4 + &object_cs_Anim_01007C, // ENBOMJIMB_ANIM_5 + &object_cs_Anim_00349C, // ENBOMJIMB_ANIM_6 + &object_cs_Anim_004960, // ENBOMJIMB_ANIM_7 + &object_cs_Anim_005128, // ENBOMJIMB_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMJIMB_ANIM_9 + &object_cs_Anim_002930, // ENBOMJIMB_ANIM_10 + &object_cs_Anim_001A1C, // ENBOMJIMB_ANIM_11 + &object_cs_Anim_003EE4, // ENBOMJIMB_ANIM_12 + &object_cs_Anim_00478C, // ENBOMJIMB_ANIM_13 + &object_cs_Anim_00433C, // ENBOMJIMB_ANIM_14 + &object_cs_Anim_0060E8, // ENBOMJIMB_ANIM_15 + &object_cs_Anim_001708, // ENBOMJIMB_ANIM_16 + &object_cs_Anim_005DC4, // ENBOMJIMB_ANIM_17 + &object_cs_Anim_0026B0, // ENBOMJIMB_ANIM_18 + &object_cs_Anim_0036B0, // ENBOMJIMB_ANIM_19 + &object_cs_Anim_0031C4, // ENBOMJIMB_ANIM_20 + &object_cs_Anim_010B68, // ENBOMJIMB_ANIM_21 }; -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, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMJIMB_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_0 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_1 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_2 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_3 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_4 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_5 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_6 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_7 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_8 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_9 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_10 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_11 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_12 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_13 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_14 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_15 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_16 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_17 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_18 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_19 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_20 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_21 }; void EnBomjimb_Init(Actor* thisx, PlayState* play) { @@ -97,7 +157,7 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); this->unk_2C6 = ENBOMJIMB_GET_F0(&this->actor); @@ -151,6 +211,9 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play) { return; } break; + + default: + break; } } @@ -174,30 +237,30 @@ void EnBomjimb_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -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, - sAnimationModes[this->unk_2DC], -4.0f); +void EnBomjimb_ChangeAnim(EnBomjimb* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_80C011CC(EnBomjimb* this) { - if ((this->unk_2DC == 5) && + if ((this->animIndex == ENBOMJIMB_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2DC == 19) && + if ((this->animIndex == ENBOMJIMB_ANIM_19) && (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2DC == 18) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMJIMB_ANIM_18) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2DC == 7) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMJIMB_ANIM_7) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -281,7 +344,7 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp48, &sp60, &colPoly, true, false, false, true, &sp44)) { - func_80C0113C(this, 5, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_5, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp48); this->unk_2B0 = Rand_S16Offset(30, 50); this->unk_2CC++; @@ -303,9 +366,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { false, true, &sp44)) { this->unk_2AE = 0; if (Rand_ZeroOne() < 0.5f) { - func_80C0113C(this, 20, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_20, 1.0f); } else { - func_80C0113C(this, 0, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_0, 1.0f); } this->unk_2CC = 0; this->unk_2B4 = 0.0f; @@ -319,9 +382,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { if ((this->unk_2B0 == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2AE = Rand_S16Offset(20, 20); if (!(this->unk_2AE & 1)) { - func_80C0113C(this, 20, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_20, 1.0f); } else { - func_80C0113C(this, 0, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_0, 1.0f); } this->unk_2CC = 0; this->unk_2B4 = 0.0f; @@ -331,6 +394,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { Math_ApproachF(&this->unk_2B4, 1.0f, 0.3f, 0.5f); } break; + + default: + break; } if (player->stateFlags3 != PLAYER_STATE3_1000000) { @@ -353,7 +419,7 @@ void func_80C01984(EnBomjimb* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 2); if (this->unk_2E4 != NULL) { - func_80C0113C(this, 11, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_11, 1.0f); } this->unk_2CA = 0; this->actionFunc = func_80C01A24; @@ -425,7 +491,7 @@ void func_80C01C18(EnBomjimb* this, PlayState* play) { } void func_80C01CD0(EnBomjimb* this, PlayState* play) { - f32 sp3C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad[2]; if ((this->unk_2E4 != NULL) && ((this->unk_2E4->update == NULL) || Actor_HasParent(this->unk_2E4, play))) { @@ -436,17 +502,17 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { return; } - if (this->unk_2DC != 7) { + if (this->animIndex != ENBOMJIMB_ANIM_7) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_294), 1, 3000, 0); Math_ApproachF(&this->actor.world.pos.x, this->unk_294.x, 0.3f, 2.0f); Math_ApproachF(&this->actor.world.pos.z, this->unk_294.z, 0.3f, 2.0f); if (sqrtf(SQ(this->actor.world.pos.x - this->unk_294.x) + SQ(this->actor.world.pos.z - this->unk_294.z)) < 3.0f) { - func_80C0113C(this, 7, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_7, 1.0f); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_294); } - } else if (this->unk_2B8 <= sp3C) { + } else if (curFrame >= this->animEndFrame) { this->actor.draw = NULL; } @@ -487,7 +553,7 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { void func_80C01FD4(EnBomjimb* this) { this->actor.textId = 0x72D; - func_80C0113C(this, 9, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_9, 1.0f); this->unk_2CA = 4; this->actionFunc = func_80C0201C; } @@ -509,12 +575,12 @@ void func_80C0201C(EnBomjimb* this, PlayState* play) { this->unk_2CA = 10; this->actionFunc = func_80C02A14; } else { - func_800B8614(&this->actor, play, 40.0f); + Actor_OfferTalk(&this->actor, play, 40.0f); } } void func_80C02108(EnBomjimb* this) { - func_80C0113C(this, 6, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_6, 1.0f); this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80C012E0(this); @@ -544,11 +610,11 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { return; } - if (this->unk_2DC == 6) { + if (this->animIndex == ENBOMJIMB_ANIM_6) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2B8 <= curFrame) { - func_80C0113C(this, 19, 2.0f); + if (curFrame >= this->animEndFrame) { + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_19, 2.0f); } return; } @@ -590,7 +656,7 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { this->actor.world.rot.y = this->unk_2D6 + this->unk_2D4; - if (SurfaceType_GetSceneExitIndex(&play->colCtx, sp58, sp5C)) { + if (SurfaceType_GetSceneExitIndex(&play->colCtx, sp58, sp5C) != 0) { s16 temp = BINANG_SUB(this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x8000); if (temp < 0) { @@ -609,7 +675,7 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { } void func_80C0250C(EnBomjimb* this) { - func_80C0113C(this, 15, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_15, 1.0f); this->unk_2D4 = 0; this->actor.speed = 0.0f; this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); @@ -629,7 +695,7 @@ void func_80C02570(EnBomjimb* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); - func_80C0113C(this, 19, 2.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_19, 2.0f); this->actionFunc = func_80C0217C; } else if ((player->stateFlags3 == PLAYER_STATE3_1000000) || (this->actor.xzDistToPlayer > 410.0f)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 3000, 0); @@ -639,7 +705,7 @@ void func_80C02570(EnBomjimb* this, PlayState* play) { void func_80C0267C(EnBomjimb* this) { func_80C012E0(this); - func_80C0113C(this, 8, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_8, 1.0f); this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->unk_2AE = 40; @@ -662,9 +728,9 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { Player* player = GET_PLAYER(play); func_80C012E0(this); - func_80C0113C(this, 21, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_21, 1.0f); if ((player->transformation != PLAYER_FORM_DEKU) && (player->transformation != PLAYER_FORM_HUMAN)) { - func_80C0113C(this, 17, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_17, 1.0f); Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= PLAYER_STATE1_10000000; player->actor.freezeTimer = 3; @@ -676,7 +742,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { if (((player->transformation == PLAYER_FORM_DEKU) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10)) || ((player->transformation == PLAYER_FORM_HUMAN) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02))) { - func_80C0113C(this, 17, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_17, 1.0f); Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= PLAYER_STATE1_10000000; player->actor.freezeTimer = 3; @@ -722,6 +788,9 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_76_10); SET_WEEKEVENTREG(WEEKEVENTREG_11_10); break; + + default: + break; } if (!Play_InCsMode(play)) { @@ -738,15 +807,15 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2DC == 21) { + if (this->animIndex == ENBOMJIMB_ANIM_21) { player->actor.freezeTimer = 3; - if (this->unk_2B8 <= curFrame) { - func_80C0113C(this, 9, 1.0f); + if (curFrame >= this->animEndFrame) { + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_9, 1.0f); } return; } - if ((this->unk_2CA == 8) && (this->unk_2DC == 9)) { + if ((this->unk_2CA == 8) && (this->animIndex == ENBOMJIMB_ANIM_9)) { player->actor.freezeTimer = 3; if (this->unk_2E0 == 0) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { @@ -756,7 +825,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { } } - if ((this->unk_2DC == 15) && (this->unk_2CA == 8)) { + if ((this->animIndex == ENBOMJIMB_ANIM_15) && (this->unk_2CA == 8)) { player->actor.freezeTimer = 3; } @@ -873,20 +942,20 @@ void EnBomjimb_Update(Actor* thisx, PlayState* play2) { s32 EnBomjimb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjimb* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_CS_LIMB_0F) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; rot->z += this->unk_288; } - if ((limbIndex == 19) && (this->unk_2C8 != ENBOMJIMB_F_0)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2C8 != ENBOMJIMB_F_0)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2C8 == ENBOMJIMB_F_0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2C8 == ENBOMJIMB_F_0)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h index a784e335d..9e2bb9cc5 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h @@ -2,6 +2,7 @@ #define Z_EN_BOMJIMB_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomjimb; @@ -28,8 +29,8 @@ typedef enum { typedef struct EnBomjimb { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomjimbActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -42,7 +43,7 @@ typedef struct EnBomjimb { /* 0x2B0 */ s16 unk_2B0; /* 0x2B2 */ s16 unk_2B2; /* 0x2B4 */ f32 unk_2B4; - /* 0x2B8 */ f32 unk_2B8; + /* 0x2B8 */ f32 animEndFrame; /* 0x2BC */ UNK_TYPE1 unk2BC[4]; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; @@ -55,7 +56,7 @@ typedef struct EnBomjimb { /* 0x2D4 */ s16 unk_2D4; /* 0x2D6 */ s16 unk_2D6; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; - /* 0x2DC */ s32 unk_2DC; + /* 0x2DC */ s32 animIndex; /* 0x2E0 */ u8 unk_2E0; /* 0x2E4 */ Actor* unk_2E4; /* 0x2E8 */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index f9b5b3d41..c89179e8b 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -52,7 +52,7 @@ static ColliderQuadInit sQuadInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_S8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_S8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_STOP), }; @@ -213,7 +213,7 @@ void func_808A2918(EnBoom* this, PlayState* play) { Actor_SetSpeeds(&this->actor, 12.0f); Actor_MoveWithGravity(&this->actor); func_808A24DC(this, play); - func_800B9010(&this->actor, NA_SE_IT_BOOMERANG_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_IT_BOOMERANG_FLY - SFX_FLAG); if ((this->collider.base.atFlags & AT_HIT) && (((this->collider.base.at->id == ACTOR_EN_ITEM00) && (this->collider.base.at->params != ITEM00_HEART_CONTAINER) && diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 044f54334..8157d09c6 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -69,18 +69,7 @@ ActorInit En_Box_InitVars = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_STOP), -}; - -typedef struct { - /* 0x0 */ f32 data[5]; -} EnBox_PlaybackSpeed; // 0x14 - -static EnBox_PlaybackSpeed sPlaybackSpeed = { { 1.5f, 1.0f, 1.5f, 1.0f, 1.5f } }; - -static AnimationHeader* sBigChestAnimations[5] = { - &gBoxBigChestOpenAdultAnim, &gBoxBigChestOpenGoronAnim, &gBoxBigChestOpenAdultAnim, - &gBoxBigChestOpenDekuAnim, &gBoxBigChestOpenChildAnim, + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_STOP), }; void EnBox_SetupAction(EnBox* this, EnBoxActionFunc func) { @@ -191,12 +180,12 @@ void EnBox_Init(Actor* thisx, PlayState* play) { EnBox* this = THIS; s16 csId; CollisionHeader* colHeader; - f32 animFrame; - f32 animFrameEnd; + f32 startFrame; + f32 endFrame; colHeader = NULL; - animFrame = 0.0f; - animFrameEnd = Animation_GetLastFrame(&gBoxChestOpenAnim); + startFrame = 0.0f; + endFrame = Animation_GetLastFrame(&gBoxChestOpenAnim); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gBoxChestCol, &colHeader); @@ -227,7 +216,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; - animFrame = animFrameEnd; + startFrame = endFrame; } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL)) && !Flags_GetSwitch(play, this->switchFlag)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); @@ -283,7 +272,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gBoxChestSkel, &gBoxChestOpenAnim, this->jointTable, this->morphTable, OBJECT_BOX_CHEST_LIMB_MAX); - Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, animFrame, animFrameEnd, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); if (Actor_IsSmallChest(this)) { Actor_SetScale(&this->dyna.actor, 0.0075f); Actor_SetFocus(&this->dyna.actor, 20.0f); @@ -364,7 +353,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; EnBox_SetupAction(this, EnBox_WaitOpen); } - Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_BOUND); + Audio_PlaySfx_AtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_BOUND); EnBox_SpawnDust(this, play); } yDiff = this->dyna.actor.world.pos.y - this->dyna.actor.floorHeight; @@ -419,7 +408,7 @@ void func_80868AFC(EnBox* this, PlayState* play) { EnBox_SetupAction(this, func_80868B74); this->unk_1A0 = 0; func_80867FBC(&this->unk_1F4, play, (this->movementFlags & ENBOX_MOVE_0x80) != 0); - Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); + Audio_PlaySfx_AtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } } @@ -434,7 +423,7 @@ void func_80868B74(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.y += 1.25f; } this->unk_1A0++; - if ((this->csId1 != -1) && CutsceneManager_GetCurrentCsId() == this->csId1) { + if ((this->csId1 != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->csId1)) { if (this->unk_1A0 == 2) { func_800B724C(play, &this->dyna.actor, PLAYER_CSMODE_4); } else if (this->unk_1A0 == 22) { @@ -452,32 +441,40 @@ void func_80868B74(EnBox* this, PlayState* play) { } void EnBox_WaitOpen(EnBox* this, PlayState* play) { + static AnimationHeader* sBigChestAnimations[PLAYER_FORM_MAX] = { + &gBoxBigChestOpenAdultAnim, // PLAYER_FORM_FIERCE_DEITY + &gBoxBigChestOpenGoronAnim, // PLAYER_FORM_GORON + &gBoxBigChestOpenAdultAnim, // PLAYER_FORM_ZORA + &gBoxBigChestOpenDekuAnim, // PLAYER_FORM_DEKU + &gBoxBigChestOpenChildAnim, // PLAYER_FORM_HUMAN + }; s32 pad; - AnimationHeader* animHeader; - f32 frameCount; - f32 playbackSpeed; - EnBox_PlaybackSpeed playbackSpeedTable; - Player* player; - Vec3f offset; + AnimationHeader* anim; + f32 endFrame; + f32 playSpeed; this->alpha = 255; this->movementFlags |= ENBOX_MOVE_IMMOBILE; if ((this->unk_1EC != 0) && ((this->csId2 < 0) || (CutsceneManager_GetCurrentCsId() == this->csId2) || (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { if (this->unk_1EC < 0) { - animHeader = &gBoxChestOpenAnim; - playbackSpeed = 1.5f; + anim = &gBoxChestOpenAnim; + playSpeed = 1.5f; } else { - u8 playerForm; + f32 sPlaybackSpeeds[PLAYER_FORM_MAX] = { + 1.5f, // PLAYER_FORM_FIERCE_DEITY + 1.0f, // PLAYER_FORM_GORON + 1.5f, // PLAYER_FORM_ZORA + 1.0f, // PLAYER_FORM_DEKU + 1.5f, // PLAYER_FORM_HUMAN + }; - playbackSpeedTable = sPlaybackSpeed; - playerForm = gSaveContext.save.playerForm; - animHeader = sBigChestAnimations[playerForm]; - playbackSpeed = playbackSpeedTable.data[playerForm]; + anim = sBigChestAnimations[GET_PLAYER_FORM]; + playSpeed = sPlaybackSpeeds[GET_PLAYER_FORM]; } - frameCount = Animation_GetLastFrame(animHeader); - Animation_Change(&this->skelAnime, animHeader, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); + endFrame = Animation_GetLastFrame(anim); + Animation_Change(&this->skelAnime, anim, playSpeed, 0.0f, endFrame, ANIMMODE_ONCE, 0.0f); EnBox_SetupAction(this, EnBox_Open); if (this->unk_1EC > 0) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DEMO_TRE_LGT, @@ -496,9 +493,11 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { Flags_SetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)); } } else { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + Vec3f offset; + Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); - if (offset.z > -50.0f && offset.z < 0.0f && fabsf(offset.y) < 10.0f && fabsf(offset.x) < 20.0f && + if ((offset.z > -50.0f) && (offset.z < 0.0f) && (fabsf(offset.y) < 10.0f) && (fabsf(offset.x) < 20.0f) && Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { if (((this->getItemId == GI_HEART_PIECE) || (this->getItemId == GI_BOTTLE)) && Flags_GetCollectible(play, this->collectableFlag)) { @@ -540,7 +539,8 @@ void EnBox_Open(EnBox* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_ELFORG, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, - STRAY_FAIRY_PARAMS(ENBOX_GET_CHEST_FLAG(&this->dyna.actor), 0, STRAY_FAIRY_TYPE_CHEST)); + STRAY_FAIRY_PARAMS(ENBOX_GET_CHEST_FLAG(&this->dyna.actor), STRAY_FAIRY_AREA_CLOCK_TOWN, + STRAY_FAIRY_TYPE_CHEST)); } else if (this->movementFlags & ENBOX_MOVE_0x40) { this->movementFlags &= ~ENBOX_MOVE_0x40; } @@ -550,17 +550,16 @@ void EnBox_Open(EnBox* this, PlayState* play) { s32 bgId; u16 sfxId = 0; - if (Animation_OnFrame(&this->skelAnime, gSaveContext.save.playerForm == PLAYER_FORM_DEKU ? 14.0f : 30.0f)) { + if (Animation_OnFrame(&this->skelAnime, GET_PLAYER_FORM == PLAYER_FORM_DEKU ? 14.0f : 30.0f)) { sfxId = NA_SE_EV_TBOX_UNLOCK; - } else if (Animation_OnFrame(&this->skelAnime, - gSaveContext.save.playerForm == PLAYER_FORM_DEKU ? 15.0f : 90.0f)) { + } else if (Animation_OnFrame(&this->skelAnime, GET_PLAYER_FORM == PLAYER_FORM_DEKU ? 15.0f : 90.0f)) { sfxId = NA_SE_EV_TBOX_OPEN; } - if (sfxId != 0) { - Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, sfxId); + if (sfxId != NA_SE_NONE) { + Audio_PlaySfx_AtPos(&this->dyna.actor.projectedPos, sfxId); } - if (this->skelAnime.jointTable[3].z > 0) { - this->unk_1A8 = (0x7D00 - this->skelAnime.jointTable[3].z) * 0.00006f; + if (this->skelAnime.jointTable[OBJECT_BOX_CHEST_LIMB_03].z > 0) { + this->unk_1A8 = (0x7D00 - this->skelAnime.jointTable[OBJECT_BOX_CHEST_LIMB_03].z) * 0.00006f; if (this->unk_1A8 < 0.0f) { this->unk_1A8 = 0.0f; } else if (this->unk_1A8 > 1.0f) { @@ -583,7 +582,7 @@ void EnBox_SpawnIceSmoke(EnBox* this, PlayState* play) { this->iceSmokeTimer++; //! @bug sfxId should be NA_SE_EN_MIMICK_BREATH, but uses OoT's sfxId value - func_800B9010(&this->dyna.actor, NA_SE_EN_LAST3_COIL_ATTACK_OLD - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EN_LAST3_COIL_ATTACK_OLD - SFX_FLAG); if (Rand_ZeroOne() < 0.3f) { randomf = 2.0f * Rand_ZeroOne() - 1.0f; pos = this->dyna.actor.world.pos; diff --git a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c index 6c6e832c8..cdcf0879f 100644 --- a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c +++ b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c @@ -8,7 +8,7 @@ #include "z64rumble.h" #include "z64shrink_window.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) #define THIS ((EnBsb*)thisx) diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.c b/src/overlays/actors/ovl_En_Bu/z_en_bu.c index 043f1ebb7..ad26cf99d 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.c +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.c @@ -6,7 +6,7 @@ #include "z_en_bu.h" -#define FLAGS (ACTOR_FLAG_1) +#define FLAGS (ACTOR_FLAG_TARGETABLE) #define THIS ((EnBu*)thisx) diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 92d56eec5..7453c6d79 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -6,7 +6,7 @@ #include "z_en_bubble.h" -#define FLAGS (ACTOR_FLAG_1) +#define FLAGS (ACTOR_FLAG_TARGETABLE) #define THIS ((EnBubble*)thisx) @@ -77,7 +77,7 @@ void EnBubble_SetDimensions(EnBubble* this, f32 dim) { f32 z; f32 norm; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, 1.0f); this->actor.shape.yOffset = 16.0f; this->modelRotSpeed = 16.0f; @@ -144,7 +144,7 @@ s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { &sEffectEnvColor, Rand_S16Offset(100, 50), 25, 0); } Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; return Rand_S16Offset(90, 60); } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index ce859ad53..d27aaf679 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -5,6 +5,7 @@ */ #include "z_en_butte.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -164,8 +165,8 @@ void EnButte_Init(Actor* thisx, PlayState* play) { s32 pad; EnButte* this = THIS; - if (ENBUTTE_GET(&this->actor) == ENBUTTE_MINUS1) { - this->actor.params = ENBUTTE_0; + if (BUTTERFLY_GET(&this->actor) == BUTTERFLY_MINUS1) { + this->actor.params = BUTTERFLY_0; } this->actor.world.rot.y = Rand_Next(); @@ -173,12 +174,12 @@ void EnButte_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_ProcessInitChain(&this->actor, sInitChain); - if ((ENBUTTE_GET_1(&this->actor) & 0xFF) == ENBUTTE_1) { + if ((BUTTERFLY_GET_1(&this->actor) & 0xFF) == BUTTERFLY_1) { this->actor.uncullZoneScale = 200.0f; } SkelAnime_Init(play, &this->skelAnime, &gameplay_field_keep_Skel_002FA0, &gameplay_field_keep_Anim_001D20, - this->jointTable, this->morphTable, 8); + this->jointTable, this->morphTable, BUTTERFLY_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colldierElements); @@ -286,7 +287,7 @@ void func_8091C794(EnButte* this, PlayState* play) { func_8091C0A0(this, &D_8091D324[this->unk_24E]); } - if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (player->heldItemAction == PLAYER_IA_STICK) && + if ((BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) && (player->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_252 <= 0) && ((Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z) < SQ(120.0f)) || @@ -355,8 +356,8 @@ void func_8091CBB4(EnButte* this, PlayState* play) { distSq = Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z); - if ((player->heldItemAction != PLAYER_IA_STICK) || !(fabsf(player->actor.speed) < 1.8f) || (this->unk_252 > 0) || - !(distSq < SQ(320.0f))) { + if ((player->heldItemAction != PLAYER_IA_DEKU_STICK) || !(fabsf(player->actor.speed) < 1.8f) || + (this->unk_252 > 0) || !(distSq < SQ(320.0f))) { func_8091C748(this); } else if ((distSq > SQ(240.0f)) && (Math3D_XZDistanceSquared(player->meleeWeaponInfo[0].tip.x, player->meleeWeaponInfo[0].tip.z, @@ -381,7 +382,7 @@ void func_8091CFB4(EnButte* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); } else if (this->unk_24C == 4) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, - this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, 2); + this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, FAIRY_PARAMS(FAIRY_TYPE_2, false, 0)); this->unk_250 = 0; } else if (this->unk_24C <= 0) { func_8091D070(this); @@ -415,7 +416,7 @@ void EnButte_Update(Actor* thisx, PlayState* play) { this->unk_256 += 0x1000; this->unk_258 += 0x600; - if (ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) { + if (BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) { if (GET_PLAYER(play)->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0) { if (this->unk_252 > 0) { this->unk_252--; @@ -450,7 +451,7 @@ void EnButte_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } - if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (this->actionFunc == func_8091CFB4)) { + if ((BUTTERFLY_GET_1(&this->actor) == BUTTERFLY_1) && (this->actionFunc == func_8091CFB4)) { func_8091C178(this, play); } } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 4bcaf440c..39c24a533 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -2,25 +2,28 @@ #define Z_EN_BUTTE_H #include "global.h" +#include "objects/gameplay_field_keep/gameplay_field_keep.h" struct EnButte; typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); -#define ENBUTTE_GET(thisx) ((thisx)->params) -#define ENBUTTE_GET_1(thisx) ((thisx)->params & 1) +#define BUTTERFLY_GET(thisx) ((thisx)->params) +#define BUTTERFLY_GET_1(thisx) ((thisx)->params & 1) -#define ENBUTTE_MINUS1 -1 -#define ENBUTTE_0 0 -#define ENBUTTE_1 1 +#define BUTTERFLY_MINUS1 -1 +#define BUTTERFLY_0 0 +#define BUTTERFLY_1 1 + +#define BUTTERFLY_PARAMS(param) (param) typedef struct EnButte { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colldierElements[1]; /* 0x1A4 */ SkelAnime skelAnime; - /* 0x1E8 */ Vec3s jointTable[8]; - /* 0x218 */ Vec3s morphTable[8]; + /* 0x1E8 */ Vec3s jointTable[BUTTERFLY_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[BUTTERFLY_LIMB_MAX]; /* 0x248 */ EnButteActionFunc actionFunc; /* 0x24C */ s16 unk_24C; /* 0x24E */ u8 unk_24E; 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 8e3e907bb..89e73c9a6 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 @@ -7,7 +7,7 @@ #include "z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnClearTag*)thisx) @@ -422,7 +422,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { Vec3f vel; Vec3f accel; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (thisx->params >= 0) { this->activeTimer = 70; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -435,7 +435,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { if (thisx->params != CLEAR_TAG_SPLASH) { // Initialize isolated light ray effect - if (thisx->params == CLEAR_TAG_SMALL_LIGHT_RAYS || thisx->params == CLEAR_TAG_LARGE_LIGHT_RAYS) { + if ((thisx->params == CLEAR_TAG_SMALL_LIGHT_RAYS) || (thisx->params == CLEAR_TAG_LARGE_LIGHT_RAYS)) { for (i = 0; i < 54; i++) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); @@ -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(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); + Audio_PlaySfx_AtPosWithReverb(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); case 2: if (player->actor.world.pos.z > 0.0f) { player->actor.world.pos.z = 290.0f; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index 677fcc698..9498e8e25 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -5,6 +5,18 @@ struct EnClearTag; +#define CLEAR_TAG_PARAMS(type) (type) + +typedef enum { + /* 0x00 */ CLEAR_TAG_SMALL_EXPLOSION, + /* 0x01 */ CLEAR_TAG_LARGE_EXPLOSION, + /* 0x02 */ CLEAR_TAG_POP, + /* 0x03 */ CLEAR_TAG_SMALL_LIGHT_RAYS, + /* 0x04 */ CLEAR_TAG_LARGE_LIGHT_RAYS, + /* 0x23 */ CLEAR_TAG_SPLASH = 35, + /* 0xC8 */ CLEAR_TAG_SMOKE = 200 +} ClearTagType; + typedef struct EnClearTagEffect { /* 0x00 */ u8 type; /* 0x01 */ u8 actionTimer; 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 8eb9eb839..c55169218 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 @@ -7,7 +7,7 @@ #include "z_en_cne_01.h" #include "objects/object_cne/object_cne.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnCne01*)thisx) @@ -115,8 +115,7 @@ void EnCne01_UpdateModel(EnCne01* this, PlayState* play) { Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1); Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1); } - SubS_FillLimbRotTables(play, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, - ARRAY_COUNT(this->enHy.limbRotTableY)); + SubS_UpdateFidgetTables(play, this->enHy.fidgetTableY, this->enHy.fidgetTableZ, ENHY_LIMB_MAX); EnHy_UpdateCollider(&this->enHy, play); } @@ -142,14 +141,14 @@ 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, PLAYER_IA_MAGIC_BEANS); + Actor_OfferTalkExchangeEquiCylinder(&this->enHy.actor, play, 30.0f, PLAYER_IA_MAGIC_BEANS); } return true; } void EnCne01_FinishInit(EnHy* this, PlayState* play) { if (EnHy_Init(this, play, &gCneSkel, ENHY_ANIM_OS_ANIME_11)) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnCne01_Draw; this->waitingOnInit = false; if (ENCNE01_GET_PATH_INDEX(&this->actor) == ENCNE01_PATH_INDEX_NONE) { @@ -196,6 +195,9 @@ void EnCne01_Talk(EnHy* this, PlayState* play) { this->actionFunc = this->prevActionFunc; this->prevActionFunc = NULL; break; + + default: + break; } } @@ -203,20 +205,20 @@ void EnCne01_Init(Actor* thisx, PlayState* play) { s32 pad; EnCne01* this = THIS; - this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_OS_ANIME, play); - this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); - this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); - this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); + this->enHy.animObjectSlot = SubS_GetObjectSlot(OBJECT_OS_ANIME, play); + this->enHy.headObjectSlot = SubS_GetObjectSlot(OBJECT_CNE, play); + this->enHy.skelUpperObjectSlot = SubS_GetObjectSlot(OBJECT_CNE, play); + this->enHy.skelLowerObjectSlot = SubS_GetObjectSlot(OBJECT_CNE, play); - if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || - (this->enHy.skelLowerObjIndex < 0)) { + if ((this->enHy.animObjectSlot <= OBJECT_SLOT_NONE) || (this->enHy.headObjectSlot <= OBJECT_SLOT_NONE) || + (this->enHy.skelUpperObjectSlot <= OBJECT_SLOT_NONE) || (this->enHy.skelLowerObjectSlot <= OBJECT_SLOT_NONE)) { Actor_Kill(&this->enHy.actor); } this->enHy.actor.draw = NULL; Collider_InitCylinder(play, &this->enHy.collider); Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->enHy.actor.flags &= ~ACTOR_FLAG_1; + this->enHy.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH_INDEX(&this->enHy.actor), ENCNE01_PATH_INDEX_NONE); this->enHy.waitingOnInit = true; Actor_SetScale(&this->enHy.actor, 0.01f); @@ -241,21 +243,21 @@ void EnCne01_Update(Actor* thisx, PlayState* play) { s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnCne01* this = THIS; - s8 bodyPart; + s8 bodyPartIndex; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - bodyPart = gEnHyBodyParts[limbIndex]; - if (bodyPart >= 0) { - Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPart]); + bodyPartIndex = gEnHyLimbToBodyParts[limbIndex]; + if (bodyPartIndex > BODYPART_NONE) { + Matrix_MultVec3f(&zeroVec, &this->enHy.bodyPartsPos[bodyPartIndex]); } if (limbIndex == CNE_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.headObjectSlot].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.headObjectSlot].segment); *dList = gCneHeadBrownHairDL; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelLowerObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } @@ -277,8 +279,8 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if ((limbIndex == CNE_LIMB_TORSO) || (limbIndex == CNE_LIMB_LEFT_UPPER_ARM) || (limbIndex == CNE_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (s16)(Math_SinS(this->enHy.limbRotTableY[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->enHy.limbRotTableZ[limbIndex]) * 200.0f); + rot->y += (s16)(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f); } return false; @@ -292,8 +294,8 @@ void EnCne01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == CNE_LIMB_RIGHT_FOOT) { OPEN_DISPS(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->enHy.skelUpperObjectSlot].segment); CLOSE_DISPS(play->state.gfxCtx); } @@ -328,8 +330,8 @@ void EnCne01_Draw(Actor* thisx, PlayState* play) { *shadowTexIter++ = 0; } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, - ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts); + SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, ENHY_BODYPART_MAX, + gEnHyShadowSizes, gEnHyParentShadowBodyParts); } SubS_DrawShadowTex(&this->enHy.actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index fa6349871..0c10f72cd 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -6,6 +6,7 @@ #include "z_en_col_man.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_100000) @@ -59,14 +60,11 @@ ActorInit En_Col_Man_InitVars = { (ActorFunc)NULL, }; -static Color_RGBA8 primColor = { 60, 50, 20, 255 }; -static Color_RGBA8 envColor = { 40, 30, 30, 255 }; - void EnColMan_Init(Actor* thisx, PlayState* play) { EnColMan* this = THIS; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->scale = (BREG(55) / 1000.0f) + 0.01f; switch (this->actor.params) { @@ -76,10 +74,12 @@ void EnColMan_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); func_80AFDD60(this); break; + case EN_COL_MAN_FALLING_ROCK: ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); func_80AFDF60(this); break; + case EN_COL_MAN_CUTSCENE_BOMB: case EN_COL_MAN_GAMEPLAY_BOMB: func_80AFE234(this); @@ -155,6 +155,8 @@ void func_80AFDF60(EnColMan* this) { } void func_80AFDFB4(EnColMan* this, PlayState* play) { + static Color_RGBA8 sPrimColor = { 60, 50, 20, 255 }; + static Color_RGBA8 sEnvColor = { 40, 30, 30, 255 }; s32 i; Vec3f velocity; Vec3f accel; @@ -179,7 +181,7 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) { accel.z = 0.0f; accel.x = 0.0f; - func_800B0EB0(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, + func_800B0EB0(play, &this->actor.world.pos, &velocity, &accel, &sPrimColor, &sEnvColor, Rand_ZeroFloat(50.0f) + 60.0f, 30, Rand_ZeroFloat(5.0f) + 20.0f); } @@ -200,7 +202,7 @@ void func_80AFE25C(EnColMan* this, PlayState* play) { if (this->actor.params == EN_COL_MAN_CUTSCENE_BOMB) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.parent->world.pos.x, this->actor.parent->world.pos.y, this->actor.parent->world.pos.z, 0, 0, 0, - CLEAR_TAG_SMALL_EXPLOSION); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_EXPLOSION)); } else { 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, diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index aa74c5007..5a234c05e 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -7,7 +7,7 @@ #include "z_en_cow.h" #include "z64horse.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnCow*)thisx) @@ -127,13 +127,14 @@ void EnCow_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, EN_COW_TYPE_TAIL); - this->animationTimer = Rand_ZeroFloat(1000.0f) + 40.0f; - this->animationCycle = 0; - this->actor.targetMode = 6; + this->animTimer = Rand_ZeroFloat(1000.0f) + 40.0f; + this->animCycle = 0; + this->actor.targetMode = TARGET_MODE_6; gHorsePlayedEponasSong = false; func_801A5080(4); break; + case EN_COW_TYPE_TAIL: SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, COW_TAIL_LIMB_MAX); @@ -145,8 +146,11 @@ void EnCow_Init(Actor* thisx, PlayState* play) { EnCow_SetTailPos(this); - this->actor.flags &= ~ACTOR_FLAG_1; - this->animationTimer = Rand_ZeroFloat(1000.0f) + 40.0f; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + this->animTimer = Rand_ZeroFloat(1000.0f) + 40.0f; + break; + + default: break; } @@ -167,10 +171,10 @@ void EnCow_Destroy(Actor* thisx, PlayState* play) { } void EnCow_UpdateAnimation(EnCow* this, PlayState* play) { - if (this->animationTimer > 0) { - this->animationTimer--; + if (this->animTimer > 0) { + this->animTimer--; } else { - this->animationTimer = Rand_ZeroFloat(500.0f) + 40.0f; + this->animTimer = Rand_ZeroFloat(500.0f) + 40.0f; Animation_Change(&this->skelAnime, &gCowChewAnim, 1.0f, this->skelAnime.curFrame, Animation_GetLastFrame(&gCowChewAnim), ANIMMODE_ONCE, 1.0f); } @@ -178,23 +182,23 @@ void EnCow_UpdateAnimation(EnCow* this, PlayState* play) { if (!(this->flags & EN_COW_FLAG_PLAYER_HAS_APPROACHED)) { this->flags |= EN_COW_FLAG_PLAYER_HAS_APPROACHED; if (this->skelAnime.animation == &gCowChewAnim) { - this->animationTimer = 0; + this->animTimer = 0; } } } - this->animationCycle++; - if (this->animationCycle > 0x30) { - this->animationCycle = 0; + this->animCycle++; + if (this->animCycle > 0x30) { + this->animCycle = 0; } - if (this->animationCycle < 0x20) { - this->actor.scale.x = ((Math_SinS(this->animationCycle * 0x400) * (1.0f / 100.0f)) + 1.0f) * 0.01f; + if (this->animCycle < 0x20) { + this->actor.scale.x = ((Math_SinS(this->animCycle * 0x400) * (1.0f / 100.0f)) + 1.0f) * 0.01f; } else { this->actor.scale.x = 0.01f; } - if (this->animationCycle > 0x10) { - this->actor.scale.y = ((Math_SinS((this->animationCycle * 0x400) - 0x4000) * (1.0f / 100.0f)) + 1.0f) * 0.01f; + if (this->animCycle > 0x10) { + this->actor.scale.y = ((Math_SinS((this->animCycle * 0x400) - 0x4000) * (1.0f / 100.0f)) + 1.0f) * 0.01f; } else { this->actor.scale.y = 0.01f; } @@ -256,7 +260,7 @@ void EnCow_Talk(EnCow* this, PlayState* play) { } } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 170.0f); + Actor_OfferTalk(&this->actor, play, 170.0f); this->actor.textId = 0x32C8; //! @bug textId is reset to this no matter the intial value } @@ -264,7 +268,7 @@ void EnCow_Talk(EnCow* this, PlayState* play) { } void EnCow_Idle(EnCow* this, PlayState* play) { - if ((play->msgCtx.ocarinaMode == 0) || (play->msgCtx.ocarinaMode == 4)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_NONE) || (play->msgCtx.ocarinaMode == OCARINA_MODE_END)) { if (gHorsePlayedEponasSong) { if (this->flags & EN_COW_FLAG_WONT_GIVE_MILK) { this->flags &= ~EN_COW_FLAG_WONT_GIVE_MILK; @@ -274,7 +278,7 @@ void EnCow_Idle(EnCow* this, PlayState* play) { gHorsePlayedEponasSong = false; this->actionFunc = EnCow_Talk; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 170.0f); + Actor_OfferTalk(&this->actor, play, 170.0f); this->actor.textId = 0x32C8; // Text to give milk after playing Epona's Song. EnCow_UpdateAnimation(this, play); @@ -298,7 +302,7 @@ void EnCow_Idle(EnCow* this, PlayState* play) { this->actor.textId = 0x32CA; // Text if you don't have an empty bottle. } this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 170.0f); + Actor_OfferTalk(&this->actor, play, 170.0f); this->actionFunc = EnCow_Talk; } } else { @@ -310,10 +314,10 @@ void EnCow_Idle(EnCow* this, PlayState* play) { } void EnCow_DoTail(EnCow* this, PlayState* play) { - if (this->animationTimer > 0) { - this->animationTimer--; + if (this->animTimer > 0) { + this->animTimer--; } else { - this->animationTimer = Rand_ZeroFloat(200.0f) + 40.0f; + this->animTimer = Rand_ZeroFloat(200.0f) + 40.0f; Animation_Change(&this->skelAnime, &gCowTailIdleAnim, 1.0f, this->skelAnime.curFrame, Animation_GetLastFrame(&gCowTailIdleAnim), ANIMMODE_ONCE, 1.0f); } @@ -323,7 +327,7 @@ void EnCow_DoTail(EnCow* this, PlayState* play) { if (!(this->flags & EN_COW_FLAG_PLAYER_HAS_APPROACHED)) { this->flags |= EN_COW_FLAG_PLAYER_HAS_APPROACHED; if (this->skelAnime.animation == &gCowTailIdleAnim) { - this->animationTimer = 0; + this->animTimer = 0; } } } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.h b/src/overlays/actors/ovl_En_Cow/z_en_cow.h index 200ec5bec..b4a88a6fc 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -27,8 +27,8 @@ typedef struct EnCow { /* 0x0244 */ Vec3s morphTable[COW_LIMB_MAX]; /* 0x0268 */ Vec3s headTilt; /* 0x026E */ u16 flags; - /* 0x0270 */ u16 animationTimer; - /* 0x0272 */ u16 animationCycle; + /* 0x0270 */ u16 animTimer; + /* 0x0272 */ u16 animCycle; /* 0x0274 */ EnCowActionFunc actionFunc; } EnCow; // size = 0x278 diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 4c88b84cb..ca1f1db13 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -5,8 +5,9 @@ */ #include "z_en_crow.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnCrow*)thisx) @@ -129,7 +130,7 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); - Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); @@ -137,7 +138,7 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { sDeadCount = 0; if (this->actor.parent != NULL) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } EnCrow_SetupFlyIdle(this); } @@ -158,11 +159,11 @@ void EnCrow_SetupFlyIdle(EnCrow* this) { void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 dist; - s32 onInitialAnimFrame; + s32 onAnimFirstFrame; s16 yaw; SkelAnime_Update(&this->skelAnime); - onInitialAnimFrame = Animation_OnFrame(&this->skelAnime, 0.0f); + onAnimFirstFrame = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 3.0f; if ((this->actor.parent != NULL) && (this->actor.parent->home.rot.z == 0)) { @@ -171,7 +172,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { dist = Actor_WorldDistXZToPoint(&this->actor, &this->actor.parent->world.pos); } else { dist = 450.0f; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -180,7 +181,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { this->yawTarget = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } - if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->yawTarget, 5, 0x300, 0x10) == 0) && onInitialAnimFrame && + if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->yawTarget, 5, 0x300, 0x10) == 0) && onAnimFirstFrame && (Rand_ZeroOne() < 0.1f)) { yaw = (Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y); @@ -200,7 +201,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { this->pitchTarget = Rand_S16Offset(0x800, 0x800); } - if ((Math_SmoothStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0xA, 0x100, 8) == 0) && onInitialAnimFrame && + if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0xA, 0x100, 8) && onAnimFirstFrame && (Rand_ZeroOne() < 0.1f)) { if (this->actor.home.pos.y < this->actor.world.pos.y) { this->pitchTarget -= Rand_S16Offset(0x400, 0x400); @@ -289,7 +290,7 @@ void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 4, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, GUAY_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -317,7 +318,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements->info.bumper.hitPos.x, this->collider.elements->info.bumper.hitPos.y, this->collider.elements->info.bumper.hitPos.z, 0, 0, - 0, CLEAR_TAG_SMALL_LIGHT_RAYS); + 0, CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 4.0f; @@ -455,7 +456,7 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) { scaleTarget = 0.01f; } if (Math_StepToF(&this->actor.scale.x, scaleTarget, scaleTarget * 0.1f)) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.flags &= ~ACTOR_FLAG_10; this->actor.colChkInfo.health = 1; EnCrow_SetupFlyIdle(this); @@ -465,8 +466,8 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) { } void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { - if (this->collider.base.acFlags & AT_HIT) { - this->collider.base.acFlags &= ~AT_HIT; + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements->info); if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_STUN) { @@ -480,7 +481,7 @@ void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { } else { this->actor.colChkInfo.health = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Enemy_StartFinishingBlow(play, &this->actor); EnCrow_SetupDamaged(this, play); } @@ -529,7 +530,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, height); - if ((this->actor.colChkInfo.health != 0) && (Animation_OnFrame(&this->skelAnime, 3.0f))) { + if ((this->actor.colChkInfo.health != 0) && Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } if (this->drawDmgEffAlpha > 0.0f) { @@ -542,7 +543,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = this->drawDmgEffFrozenSteamScale; } } else if (!Math_StepToF(&this->drawDmgEffScale, 0.5f, 0.5f * 0.025f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -564,7 +565,7 @@ void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot EnCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_BODY) { - Matrix_MultVecX(2500.0f, this->bodyPartsPos); + Matrix_MultVecX(2500.0f, &this->bodyPartsPos[GUAY_BODYPART_BODY]); } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_TAIL)) { Matrix_MultZero(&this->bodyPartsPos[(limbIndex >> 1) - 1]); @@ -577,7 +578,7 @@ void EnCrow_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, GUAY_BODYPART_MAX, this->actor.scale.x * 100.0f * this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 527f822f6..fca2cc0b0 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -13,6 +13,14 @@ struct EnCrow; typedef void (*EnCrowActionFunc)(struct EnCrow*, PlayState*); +typedef enum GuayBodyPart { + /* 0 */ GUAY_BODYPART_BODY, + /* 1 */ GUAY_BODYPART_RIGHT_WING_TIP, + /* 2 */ GUAY_BODYPART_LEFT_WING_TIP, + /* 3 */ GUAY_BODYPART_TAIL, + /* 4 */ GUAY_BODYPART_MAX +} GuayBodyPart; + typedef struct EnCrow { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -24,8 +32,8 @@ typedef struct EnCrow { /* 0x194 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; /* 0x1CA */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x200 */ ColliderJntSph collider; - /* 0x220 */ ColliderJntSphElement colliderItems[1]; - /* 0x260 */ Vec3f bodyPartsPos[4]; + /* 0x220 */ ColliderJntSphElement colliderElements[1]; + /* 0x260 */ Vec3f bodyPartsPos[GUAY_BODYPART_MAX]; /* 0x290 */ f32 drawDmgEffAlpha; /* 0x294 */ f32 drawDmgEffFrozenSteamScale; /* 0x298 */ f32 drawDmgEffScale; 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 25013327a..d9147aa26 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -5,9 +5,8 @@ */ #include "z_en_dai.h" -#include "objects/object_dai/object_dai.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) #define THIS ((EnDai*)thisx) @@ -127,50 +126,64 @@ s32 func_80B3E5B4(EnDai* this, PlayState* play) { return 0; } -s32 func_80B3E5DC(EnDai* this, s32 arg1) { - 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 }, - { &object_dai_Anim_000CEC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dai_Anim_0069DC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dai_Anim_00563C, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dai_Anim_00563C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dai_Anim_002E58, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dai_Anim_006590, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - }; +typedef enum { + /* -1 */ ENDAI_ANIM_NONE = -1, + /* 0 */ ENDAI_ANIM_0, + /* 1 */ ENDAI_ANIM_1, + /* 2 */ ENDAI_ANIM_2, + /* 3 */ ENDAI_ANIM_3, + /* 4 */ ENDAI_ANIM_4, + /* 5 */ ENDAI_ANIM_5, + /* 6 */ ENDAI_ANIM_6, + /* 7 */ ENDAI_ANIM_7, + /* 8 */ ENDAI_ANIM_8, + /* 9 */ ENDAI_ANIM_MAX +} EnDaiAnimation; - s32 phi_v1 = false; - s32 ret = false; +static AnimationInfoS sAnimationInfo[ENDAI_ANIM_MAX] = { + { &object_dai_Anim_0079E4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDAI_ANIM_0 + { &object_dai_Anim_0079E4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDAI_ANIM_1 + { &object_dai_Anim_007354, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDAI_ANIM_2 + { &object_dai_Anim_000CEC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDAI_ANIM_3 + { &object_dai_Anim_0069DC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDAI_ANIM_4 + { &object_dai_Anim_00563C, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENDAI_ANIM_5 + { &object_dai_Anim_00563C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDAI_ANIM_6 + { &object_dai_Anim_002E58, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDAI_ANIM_7 + { &object_dai_Anim_006590, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDAI_ANIM_8 +}; - switch (arg1) { - case 0: - case 1: - if ((this->unk_A70 != 0) && (this->unk_A70 != 1)) { - phi_v1 = true; +s32 EnDai_ChangeAnim(EnDai* this, s32 animIndex) { + s32 changeAnim = false; + s32 didAnimChange = false; + + switch (animIndex) { + case ENDAI_ANIM_0: + case ENDAI_ANIM_1: + if ((this->animIndex != ENDAI_ANIM_0) && (this->animIndex != ENDAI_ANIM_1)) { + changeAnim = true; } break; - case 5: - case 6: - if ((this->unk_A70 != 5) && (this->unk_A70 != 6)) { - phi_v1 = true; + case ENDAI_ANIM_5: + case ENDAI_ANIM_6: + if ((this->animIndex != ENDAI_ANIM_5) && (this->animIndex != ENDAI_ANIM_6)) { + changeAnim = true; } break; default: - if (arg1 != this->unk_A70) { - phi_v1 = true; + if (this->animIndex != animIndex) { + changeAnim = true; } break; } - if (phi_v1) { - this->unk_A70 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); + if (changeAnim) { + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); } - return ret; + return didAnimChange; } s32 func_80B3E69C(EnDai* this, PlayState* play) { @@ -202,12 +215,11 @@ s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 func_80B3E7C8(EnDai* this, PlayState* play) { s32 ret = false; - if (this->unk_1CE & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_1CE, 0, 7); - this->actionFunc = func_80B3EF90; - ret = true; - } + if (((this->unk_1CE & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_1CE, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->actionFunc = func_80B3EF90; + ret = true; } return ret; @@ -240,19 +252,19 @@ static s32 D_80B3FC8C[] = { 0x920C0F0C, 0x930C1211, 0x5520100E, 0x0C940C12, 0x10000000, }; +static f32 D_80B3FCB4[] = { + 1.0f, 6.0f, 16.0f, 19.0f, 46.0f, 48.0f, 50.0f, 52.0f, 54.0f, 1.0f, 6.0f, 36.0f, +}; + +static f32 D_80B3FCE4[] = { + 5.0f, 15.0f, 18.0f, 45.0f, 47.0f, 49.0f, 51.0f, 53.0f, 55.0f, 5.0f, 35.0f, 45.0f, +}; + +static s16 D_80B3FD14[] = { + 4, 5, 2, 0, 4, 5, 2, 5, 4, 4, 5, 2, +}; + s16 func_80B3E8BC(EnDai* this, s32 cueId) { - static f32 D_80B3FCB4[] = { - 1.0f, 6.0f, 16.0f, 19.0f, 46.0f, 48.0f, 50.0f, 52.0f, 54.0f, 1.0f, 6.0f, 36.0f, - }; - - static f32 D_80B3FCE4[] = { - 5.0f, 15.0f, 18.0f, 45.0f, 47.0f, 49.0f, 51.0f, 53.0f, 55.0f, 5.0f, 35.0f, 45.0f, - }; - - static s16 D_80B3FD14[] = { - 4, 5, 2, 0, 4, 5, 2, 5, 4, 4, 5, 2, - }; - s32 i; s32 end; @@ -267,7 +279,7 @@ s16 func_80B3E8BC(EnDai* this, s32 cueId) { } while (i < end) { - if ((D_80B3FCB4[i] <= this->skelAnime.curFrame) && (D_80B3FCE4[i] >= this->skelAnime.curFrame)) { + if ((this->skelAnime.curFrame >= D_80B3FCB4[i]) && (this->skelAnime.curFrame <= D_80B3FCE4[i])) { return D_80B3FD14[i]; } i++; @@ -286,7 +298,7 @@ s32 func_80B3E96C(EnDai* this, PlayState* play) { ((this->unk_1DC == 0) || Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame))) { switch (this->unk_1DC) { case 0: - func_80B3E5DC(this, 2); + EnDai_ChangeAnim(this, ENDAI_ANIM_2); this->unk_1DC++; break; @@ -294,22 +306,25 @@ s32 func_80B3E96C(EnDai* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_SNOWSTORM_HARD); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WEATHER_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0x1388, 0x708, 0x3E8, 0); - func_80B3E5DC(this, 3); + EnDai_ChangeAnim(this, ENDAI_ANIM_3); this->unk_1DC++; break; case 2: - func_80B3E5DC(this, 4); + EnDai_ChangeAnim(this, ENDAI_ANIM_4); this->unk_1DC++; break; case 3: - func_80B3E5DC(this, 1); + EnDai_ChangeAnim(this, ENDAI_ANIM_1); this->unk_1F0 = D_80B3FBF0; this->unk_1FC = D_80B3FBF0; this->unk_1DC = 0; this->unk_1DA = Rand_S16Offset(20, 20); break; + + default: + break; } } else if (this->unk_1DC == 2) { sp50.x = sp50.y = 0.0f; @@ -337,30 +352,30 @@ void func_80B3EC10(f32 arg0, Vec3f arg1, f32 arg2, Vec3f arg3, f32 arg4, Vec3f* arg5->z = ((arg3.z - arg1.z) * temp_f0) + arg1.z; } +static f32 D_80B3FD2C[] = { + 6.0f, 11.0f, 15.0f, 0.0f, 12.0f, 17.0f, 0.0f, 3.0f, +}; + +static f32 D_80B3FD4C[] = { + 8.0f, 15.0f, 24.0f, 4.0f, 17.0f, 26.0f, 3.0f, 7.0f, +}; + +static s16 D_80B3FD6C[] = { + 1, 1, 1, 2, 2, 2, 3, 3, +}; + +static Vec3f D_80B3FD7C[] = { + { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8f, 0.8f }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, + { 1.0f, 0.8f, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8f, 0.9f }, { 1.0f, 1.0f, 1.0f }, +}; + s32 func_80B3EC84(EnDai* this) { - static f32 D_80B3FD2C[] = { - 6.0f, 11.0f, 15.0f, 0.0f, 12.0f, 17.0f, 0.0f, 3.0f, - }; - - static f32 D_80B3FD4C[] = { - 8.0f, 15.0f, 24.0f, 4.0f, 17.0f, 26.0f, 3.0f, 7.0f, - }; - - static s16 D_80B3FD6C[] = { - 1, 1, 1, 2, 2, 2, 3, 3, - }; - - static Vec3f D_80B3FD7C[] = { - { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8f, 0.8f }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, - { 1.0f, 0.8f, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8f, 0.9f }, { 1.0f, 1.0f, 1.0f }, - }; - s32 i; s32 ret = false; for (i = 0; i < ARRAY_COUNT(D_80B3FD6C); i++) { - if ((this->unk_1DC == D_80B3FD6C[i]) && (D_80B3FD2C[i] < this->skelAnime.curFrame) && - (D_80B3FD4C[i] >= this->skelAnime.curFrame)) { + if ((this->unk_1DC == D_80B3FD6C[i]) && (this->skelAnime.curFrame > D_80B3FD2C[i]) && + (this->skelAnime.curFrame <= D_80B3FD4C[i])) { func_80B3EC10(D_80B3FD2C[i], D_80B3FD7C[i], D_80B3FD4C[i], D_80B3FD7C[i + 1], this->skelAnime.curFrame, &this->unk_1F0); ret = true; @@ -371,20 +386,20 @@ s32 func_80B3EC84(EnDai* this) { return ret; } +static f32 D_80B3FDE8[] = { 22.0f, 0.0f, 0.0f }; + +static f32 D_80B3FDF4[] = { 29.0f, 3.0f, 9.0f }; + +static s16 D_80B3FE00[] = { 1, 2, 3 }; + +static Vec3f D_80B3FE08[] = { + { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.2f, 1.2f }, + { 1.0f, 0.7f, 0.8f }, + { 1.0f, 1.0f, 1.0f }, +}; + s32 func_80B3ED88(EnDai* this) { - static f32 D_80B3FDE8[] = { 22.0f, 0.0f, 0.0f }; - - static f32 D_80B3FDF4[] = { 29.0f, 3.0f, 9.0f }; - - static s16 D_80B3FE00[] = { 1, 2, 3 }; - - static Vec3f D_80B3FE08[] = { - { 1.0f, 1.0f, 1.0f }, - { 1.0f, 1.2f, 1.2f }, - { 1.0f, 0.7f, 0.8f }, - { 1.0f, 1.0f, 1.0f }, - }; - s32 i; s32 ret = false; @@ -414,22 +429,22 @@ void func_80B3EE8C(EnDai* this, PlayState* play) { void func_80B3EEDC(EnDai* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY)) { - func_80B3E5DC(this, 1); + EnDai_ChangeAnim(this, ENDAI_ANIM_1); this->actionFunc = func_80B3EE8C; } else if (!(player->stateFlags2 & PLAYER_STATE2_8000000)) { func_80B3E96C(this, play); this->unk_A6C = 0; } else if (this->unk_A6C == 0) { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); this->unk_A6C = 1; } } void func_80B3EF90(EnDai* this, PlayState* play) { if (func_8010BF58(&this->actor, play, D_80B3FC8C, NULL, &this->unk_1D0)) { - SubS_UpdateFlags(&this->unk_1CE, 3, 7); + SubS_SetOfferMode(&this->unk_1CE, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_1D0 = 0; this->actionFunc = func_80B3F00C; } else { @@ -441,9 +456,9 @@ void func_80B3F00C(EnDai* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80B3F044(EnDai* this, PlayState* play) { - static s32 D_80B3FE38[] = { - 0, 0, 6, 7, 8, +void EnDai_HandleCutscene(EnDai* this, PlayState* play) { + static s32 sCsAnimIndex[] = { + ENDAI_ANIM_0, ENDAI_ANIM_0, ENDAI_ANIM_6, ENDAI_ANIM_7, ENDAI_ANIM_8, }; s32 cueChannel = 0; s32 cueId; @@ -452,7 +467,7 @@ void func_80B3F044(EnDai* this, PlayState* play) { cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_472); cueId = play->csCtx.actorCues[cueChannel]->id; if (this->cueId != (u8)cueId) { - func_80B3E5DC(this, D_80B3FE38[cueId]); + EnDai_ChangeAnim(this, sCsAnimIndex[cueId]); switch (cueId) { case 1: this->unk_1E0 = 0.0f; @@ -465,6 +480,9 @@ void func_80B3F044(EnDai* this, PlayState* play) { case 3: this->unk_1CE &= ~0x80; break; + + default: + break; } } this->cueId = cueId; @@ -506,6 +524,9 @@ void func_80B3F044(EnDai* this, PlayState* play) { } this->unk_1D6 = func_80B3E8BC(this, this->cueId); break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); @@ -515,18 +536,19 @@ void EnDai_Init(Actor* thisx, PlayState* play) { EnDai* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19); - this->unk_A70 = -1; - func_80B3E5DC(this, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, + OBJECT_DAI_LIMB_MAX); + this->animIndex = ENDAI_ANIM_NONE; + EnDai_ChangeAnim(this, ENDAI_ANIM_0); Actor_SetScale(&this->actor, 0.2f); - this->actor.targetMode = 10; + this->actor.targetMode = TARGET_MODE_10; this->unk_1F0 = D_80B3FBF0; this->unk_1FC = D_80B3FBF0; this->unk_1CE = 0; this->unk_1D6 = 0; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { - SubS_UpdateFlags(&this->unk_1CE, 3, 7); + SubS_SetOfferMode(&this->unk_1CE, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_1CE |= 0x80; this->unk_1CD = 0xFF; this->actionFunc = func_80B3F00C; @@ -539,7 +561,7 @@ void EnDai_Init(Actor* thisx, PlayState* play) { } this->unk_1CD = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_1CE |= (0x100 | 0x20); this->unk_1CE |= 0x80; this->actionFunc = func_80B3EEDC; @@ -554,7 +576,7 @@ void EnDai_Update(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); if (!func_80B3E7C8(this, play) && func_80B3E69C(this, play)) { - func_80B3F044(this, play); + EnDai_HandleCutscene(this, play); SkelAnime_Update(&this->skelAnime); func_80B3E834(this); func_80B3E460(this); @@ -564,7 +586,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, PLAYER_IA_NONE, this->unk_1CE & 7); + SubS_Offer(&this->actor, play, 0.0f, 0.0f, PLAYER_IA_NONE, this->unk_1CE & SUBS_OFFER_MODE_MASK); } func_80B3E460(this); } @@ -579,11 +601,11 @@ s32 EnDai_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p *dList = NULL; } - if (limbIndex == 11) { + if (limbIndex == OBJECT_DAI_LIMB_0B) { Matrix_MultVec3f(&gZeroVec3f, &this->unk_1E4); } - if (limbIndex == 10) { + if (limbIndex == OBJECT_DAI_LIMB_0A) { *dList = NULL; } @@ -598,7 +620,7 @@ void EnDai_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, MtxF sp24; switch (limbIndex) { - case 11: + case OBJECT_DAI_LIMB_0B: D_80B3FE4C.x = sREG(0); D_80B3FE4C.y = sREG(1); D_80B3FE4C.z = sREG(2); @@ -609,9 +631,12 @@ void EnDai_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->unk_1D4 = BINANG_SUB(sp64.y, 0x4000); break; - case 10: + case OBJECT_DAI_LIMB_0A: Matrix_Get(&this->unk_18C); break; + + default: + break; } } @@ -619,19 +644,22 @@ void EnDai_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** EnDai* this = THIS; switch (limbIndex) { - case 9: + case OBJECT_DAI_LIMB_09: if (this->unk_1CE & 0x100) { func_80B3EC84(this); } Matrix_Scale(this->unk_1F0.x, this->unk_1F0.y, this->unk_1F0.z, MTXMODE_APPLY); break; - case 2: + case OBJECT_DAI_LIMB_02: if (this->unk_1CE & 0x100) { func_80B3ED88(this); } Matrix_Scale(this->unk_1FC.x, this->unk_1FC.y, this->unk_1FC.z, MTXMODE_APPLY); break; + + default: + break; } } @@ -678,7 +706,6 @@ void func_80B3F920(EnDai* this, PlayState* play) { object_dai_Tex_0107B0, object_dai_Tex_010FB0, object_dai_Tex_0117B0, object_dai_Tex_010FB0, object_dai_Tex_011FB0, object_dai_Tex_0127B0, }; - s32 pad; this->unk_1CE |= 0x40; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.h b/src/overlays/actors/ovl_En_Dai/z_en_dai.h index 35928388f..90456b833 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.h +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.h @@ -2,6 +2,7 @@ #define Z_EN_DAI_H #include "global.h" +#include "objects/object_dai/object_dai.h" struct EnDai; @@ -39,11 +40,11 @@ typedef struct EnDai { /* 0x1E4 */ Vec3f unk_1E4; /* 0x1F0 */ Vec3f unk_1F0; /* 0x1FC */ Vec3f unk_1FC; - /* 0x208 */ Vec3s jointTable[19]; - /* 0x27A */ Vec3s morphTable[19]; + /* 0x208 */ Vec3s jointTable[OBJECT_DAI_LIMB_MAX]; + /* 0x27A */ Vec3s morphTable[OBJECT_DAI_LIMB_MAX]; /* 0x2EC */ EnDaiEffect effects[EN_DAI_EFFECT_COUNT]; /* 0xA6C */ s32 unk_A6C; - /* 0xA70 */ s32 unk_A70; + /* 0xA70 */ s32 animIndex; } EnDai; // size = 0xA74 #endif // Z_EN_DAI_H 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 2c232f096..ddf98cd3d 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -5,9 +5,8 @@ */ #include "z_en_daiku.h" -#include "objects/object_daiku/object_daiku.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDaiku*)thisx) @@ -57,15 +56,42 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &object_daiku_Anim_002FA0, &object_daiku_Anim_00ACD0, &object_daiku_Anim_00C92C, - &object_daiku_Anim_000C44, &object_daiku_Anim_00C234, &object_daiku_Anim_000600, - &object_daiku_Anim_001114, &object_daiku_Anim_00B690, &object_daiku_Anim_00BEAC, +typedef enum { + /* -1 */ ENDAIKU_ANIM_NONE = -1, + /* 0 */ ENDAIKU_ANIM_0, + /* 1 */ ENDAIKU_ANIM_1, + /* 2 */ ENDAIKU_ANIM_2, + /* 3 */ ENDAIKU_ANIM_3, + /* 4 */ ENDAIKU_ANIM_4, + /* 5 */ ENDAIKU_ANIM_5, + /* 6 */ ENDAIKU_ANIM_6, + /* 7 */ ENDAIKU_ANIM_7, + /* 8 */ ENDAIKU_ANIM_8, + /* 9 */ ENDAIKU_ANIM_MAX +} EnDaiAnimation; + +static AnimationHeader* sAnimations[ENDAIKU_ANIM_MAX] = { + &object_daiku_Anim_002FA0, // ENDAIKU_ANIM_0 + &object_daiku_Anim_00ACD0, // ENDAIKU_ANIM_1 + &object_daiku_Anim_00C92C, // ENDAIKU_ANIM_2 + &object_daiku_Anim_000C44, // ENDAIKU_ANIM_3 + &object_daiku_Anim_00C234, // ENDAIKU_ANIM_4 + &object_daiku_Anim_000600, // ENDAIKU_ANIM_5 + &object_daiku_Anim_001114, // ENDAIKU_ANIM_6 + &object_daiku_Anim_00B690, // ENDAIKU_ANIM_7 + &object_daiku_Anim_00BEAC, // ENDAIKU_ANIM_8 }; -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, +static u8 sAnimationModes[ENDAIKU_ANIM_MAX] = { + ANIMMODE_LOOP, // ENDAIKU_ANIM_0 + ANIMMODE_LOOP, // ENDAIKU_ANIM_1 + ANIMMODE_LOOP, // ENDAIKU_ANIM_2 + ANIMMODE_LOOP, // ENDAIKU_ANIM_3 + ANIMMODE_ONCE, // ENDAIKU_ANIM_4 + ANIMMODE_LOOP, // ENDAIKU_ANIM_5 + ANIMMODE_LOOP, // ENDAIKU_ANIM_6 + ANIMMODE_ONCE, // ENDAIKU_ANIM_7 + ANIMMODE_ONCE, // ENDAIKU_ANIM_8 }; void EnDaiku_Init(Actor* thisx, PlayState* play) { @@ -73,7 +99,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_278 = ENDAIKU_GET_FF(&this->actor); if (this->unk_278 == ENDAIKU_PARAM_FF_3) { @@ -105,17 +131,20 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { case ENDAIKU_PARAM_FF_1: SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, - this->jointTable, this->morphTable, 17); + this->jointTable, this->morphTable, OBJECT_DAIKU_LIMB_MAX); break; case ENDAIKU_PARAM_FF_2: SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_00B690, - this->jointTable, this->morphTable, 17); + this->jointTable, this->morphTable, OBJECT_DAIKU_LIMB_MAX); break; case ENDAIKU_PARAM_FF_3: SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_001114, - this->jointTable, this->morphTable, 17); + this->jointTable, this->morphTable, OBJECT_DAIKU_LIMB_MAX); + break; + + default: break; } @@ -128,9 +157,10 @@ void EnDaiku_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -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, sAnimationModes[arg1], -4.0f); +void EnDaiku_ChangeAnim(EnDaiku* this, s32 animIndex) { + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->animEndFrame, + sAnimationModes[animIndex], -4.0f); } void func_809437C8(EnDaiku* this) { @@ -147,15 +177,18 @@ void func_80943820(EnDaiku* this) { switch (this->unk_278) { case 0: case 1: - func_8094373C(this, 0); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_0); break; case 2: - func_8094373C(this, 7); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_7); break; case 3: - func_8094373C(this, 6); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_6); + break; + + default: break; } @@ -167,7 +200,7 @@ void func_80943820(EnDaiku* this) { } void func_809438F8(EnDaiku* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad; s32 day = gSaveContext.save.day - 1; s32 pad2; @@ -188,11 +221,11 @@ void func_809438F8(EnDaiku* this, PlayState* play) { return; } - if ((this->unk_278 == ENDAIKU_PARAM_FF_2) && (this->unk_284 <= currentFrame)) { + if ((this->unk_278 == ENDAIKU_PARAM_FF_2) && (curFrame >= this->animEndFrame)) { if (Rand_ZeroOne() < 0.5f) { - func_8094373C(this, 7); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_7); } else { - func_8094373C(this, 8); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_8); } } @@ -224,7 +257,7 @@ void func_809438F8(EnDaiku* this, PlayState* play) { this->unk_280 = this->actor.yawTowardsPlayer; if ((this->unk_278 == ENDAIKU_PARAM_FF_1) || (this->unk_278 == ENDAIKU_PARAM_FF_2) || (angle <= 0x2890)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } } @@ -235,13 +268,13 @@ void func_80943BC0(EnDaiku* this) { } void func_80943BDC(EnDaiku* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; - if ((this->unk_278 == ENDAIKU_PARAM_FF_2) && (this->unk_284 <= currentFrame)) { + if ((this->unk_278 == ENDAIKU_PARAM_FF_2) && (curFrame >= this->animEndFrame)) { if (Rand_ZeroOne() < 0.5f) { - func_8094373C(this, 7); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_7); } else { - func_8094373C(this, 8); + EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_8); } } @@ -291,7 +324,7 @@ void EnDaiku_Update(Actor* thisx, PlayState* play) { s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDaiku* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_DAIKU_LIMB_0F) { rot->x += this->unk_260; rot->z += this->unk_25E; } @@ -310,11 +343,11 @@ void EnDaiku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == 15) { + if (limbIndex == OBJECT_DAIKU_LIMB_0F) { gSPDisplayList(POLY_OPA_DISP++, D_809440D4[this->unk_278]); } - if ((this->unk_278 == ENDAIKU_PARAM_FF_3) && (limbIndex == 8)) { + if ((this->unk_278 == ENDAIKU_PARAM_FF_3) && (limbIndex == OBJECT_DAIKU_LIMB_08)) { gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_008EC8); } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index ff88c8c9a..60275bbfa 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -2,6 +2,7 @@ #define Z_EN_DAIKU_H #include "global.h" +#include "objects/object_daiku/object_daiku.h" struct EnDaiku; @@ -22,8 +23,8 @@ typedef enum { typedef struct EnDaiku { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[OBJECT_DAIKU_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[OBJECT_DAIKU_LIMB_MAX]; /* 0x254 */ EnDaikuActionFunc actionFunc; /* 0x258 */ Path* path; /* 0x25C */ s16 unk_25C; @@ -39,7 +40,7 @@ typedef struct EnDaiku { /* 0x27E */ s16 unk_27E; /* 0x280 */ s16 unk_280; /* 0x282 */ s16 unk_282; - /* 0x284 */ f32 unk_284; + /* 0x284 */ f32 animEndFrame; /* 0x288 */ s16 pathIndex; /* 0x28A */ s16 unk_28A; /* 0x28C */ s16 unk_28C; diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 311b6d216..1e322650e 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -9,7 +9,7 @@ #include "objects/object_daiku/object_daiku.h" #include "objects/object_bombiwa/object_bombiwa.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDaiku2*)thisx) @@ -83,10 +83,10 @@ void EnDaiku2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, this->jointTable, - this->morphTable, 17); - this->actor.targetMode = 0; + this->morphTable, OBJECT_DAIKU_LIMB_MAX); + this->actor.targetMode = TARGET_MODE_0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->unk_278 = ENDAIKU2_GET_7F(&this->actor); + this->switchFlag = ENDAIKU2_GET_SWITCH_FLAG(&this->actor); this->pathIndex = ENDAIKU2_GET_PATH_INDEX(&this->actor); this->path = SubS_GetPathByIndex(play, this->pathIndex, ENDAIKU2_PATH_INDEX_NONE); this->unk_280 = ENDAIKU2_GET_8000(&this->actor); @@ -97,9 +97,9 @@ void EnDaiku2_Init(Actor* thisx, PlayState* play) { return; } - if (this->unk_278 == ENDAIKU2_GET_7F_127) { - this->unk_278 = ENDAIKU2_GET_7F_MINUS1; - } else if (Flags_GetSwitch(play, this->unk_278)) { + if (this->switchFlag == 0x7F) { + this->switchFlag = -1; + } else if (Flags_GetSwitch(play, this->switchFlag)) { this->unk_25C = this->path->count - 1; func_80BE61D0(this); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_268); @@ -120,25 +120,61 @@ void EnDaiku2_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80BE6408(EnDaiku2* this, s32 arg1) { - static AnimationHeader* sAnimations[] = { - &object_daiku_Anim_002FA0, &object_daiku_Anim_00ACD0, &object_daiku_Anim_00C92C, &object_daiku_Anim_000C44, - &object_daiku_Anim_00C234, &object_daiku_Anim_000600, &object_daiku_Anim_001114, &object_daiku_Anim_00B690, - &object_daiku_Anim_001A24, &object_daiku_Anim_002134, &object_daiku_Anim_00D328, - }; - static u8 D_80BE7958[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - }; - f32 sp34 = 1.0f; +typedef enum { + /* -1 */ ENDAIKU2_ANIM_NONE = -1, + /* 0 */ ENDAIKU2_ANIM_0, + /* 1 */ ENDAIKU2_ANIM_1, + /* 2 */ ENDAIKU2_ANIM_2, + /* 3 */ ENDAIKU2_ANIM_3, + /* 4 */ ENDAIKU2_ANIM_4, + /* 5 */ ENDAIKU2_ANIM_5, + /* 6 */ ENDAIKU2_ANIM_6, + /* 7 */ ENDAIKU2_ANIM_7, + /* 8 */ ENDAIKU2_ANIM_8, + /* 9 */ ENDAIKU2_ANIM_9, + /* 10 */ ENDAIKU2_ANIM_10, + /* 11 */ ENDAIKU2_ANIM_MAX, + /* 11 */ ENDAIKU2_ANIM_11 = ENDAIKU2_ANIM_MAX // for object_daiku_Anim_002134 set external to `EnDaiku2_ChangeAnim` +} EnDaiAnimation; - this->unk_276 = arg1; - this->unk_284 = Animation_GetLastFrame(sAnimations[this->unk_276]); - if (this->unk_276 == 3) { - sp34 = 2.0f; +static AnimationHeader* sAnimations[ENDAIKU2_ANIM_MAX] = { + &object_daiku_Anim_002FA0, // ENDAIKU2_ANIM_0 + &object_daiku_Anim_00ACD0, // ENDAIKU2_ANIM_1 + &object_daiku_Anim_00C92C, // ENDAIKU2_ANIM_2 + &object_daiku_Anim_000C44, // ENDAIKU2_ANIM_3 + &object_daiku_Anim_00C234, // ENDAIKU2_ANIM_4 + &object_daiku_Anim_000600, // ENDAIKU2_ANIM_5 + &object_daiku_Anim_001114, // ENDAIKU2_ANIM_6 + &object_daiku_Anim_00B690, // ENDAIKU2_ANIM_7 + &object_daiku_Anim_001A24, // ENDAIKU2_ANIM_8 + &object_daiku_Anim_002134, // ENDAIKU2_ANIM_9 + &object_daiku_Anim_00D328, // ENDAIKU2_ANIM_10 +}; + +static u8 sAnimationModes[ENDAIKU2_ANIM_MAX] = { + ANIMMODE_LOOP, // ENDAIKU2_ANIM_0 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_1 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_2 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_3 + ANIMMODE_ONCE, // ENDAIKU2_ANIM_4 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_5 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_6 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_7 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_8 + ANIMMODE_ONCE, // ENDAIKU2_ANIM_9 + ANIMMODE_LOOP, // ENDAIKU2_ANIM_10 +}; + +void EnDaiku2_ChangeAnim(EnDaiku2* this, s32 animIndex) { + f32 playSpeed = 1.0f; + + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + if (this->animIndex == ENDAIKU2_ANIM_3) { + playSpeed = 2.0f; } - Animation_Change(&this->skelAnime, sAnimations[this->unk_276], sp34, 0.0f, this->unk_284, D_80BE7958[this->unk_276], - -4.0f); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } s32 func_80BE64C0(EnDaiku2* this, PlayState* play) { @@ -149,7 +185,7 @@ s32 func_80BE64C0(EnDaiku2* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); bomb = (EnBom*)Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVES, BREG(7) + 240.0f); Math_Vec3f_Copy(&this->actor.world.pos, &sp30); - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && !Flags_GetSwitch(play, this->unk_278) && (bomb != NULL) && + if ((this->switchFlag >= 0) && !Flags_GetSwitch(play, this->switchFlag) && (bomb != NULL) && (bomb->actor.id == ACTOR_EN_BOM)) { if (!bomb->isPowderKeg) { this->actor.textId = 0x32D3; @@ -170,7 +206,7 @@ void func_80BE65B4(EnDaiku2* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_02)) { this->unk_28A = 6; } - func_80BE6408(this, 8); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_8); break; case 1: @@ -178,21 +214,24 @@ void func_80BE65B4(EnDaiku2* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_04)) { this->unk_28A = 7; } - func_80BE6408(this, 8); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_8); break; case 2: this->unk_28A = 4; this->unk_264 = 1.0f; - func_80BE6408(this, 10); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); + break; + + default: break; } this->unk_264 = 1.0f; - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->unk_28A = 5; - if (this->unk_276 != 10) { - func_80BE6408(this, 10); + if (this->animIndex != ENDAIKU2_ANIM_10) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); } } @@ -201,7 +240,7 @@ void func_80BE65B4(EnDaiku2* this, PlayState* play) { } void func_80BE66E4(EnDaiku2* this, PlayState* play) { - f32 sp9C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 sp98 = gSaveContext.save.day - 1; s32 i; Vec3f sp88; @@ -212,10 +251,10 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.home.rot.y, 1, 0xBB8, 0x0); if (sp98 != 2) { - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->unk_28A = 5; - if (this->unk_276 != 10) { - func_80BE6408(this, 10); + if (this->animIndex != ENDAIKU2_ANIM_10) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); } } } @@ -232,8 +271,8 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) { return; } - func_800B8614(&this->actor, play, 80.0f); - if ((this->unk_276 == 8) && Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_OfferTalk(&this->actor, play, 80.0f); + if ((this->animIndex == ENDAIKU2_ANIM_8) && Animation_OnFrame(&this->skelAnime, 6.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_ROCK_BROKEN); for (i = 0; i < 10; i++) { @@ -260,22 +299,22 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) { temp_v0 = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); if (temp_v0 > 0x2890) { if (sp98 != 2) { - if ((this->unk_276 == 5) || (this->unk_276 == 9)) { - func_80BE6408(this, 10); - } else if ((this->unk_276 == 10) && (this->unk_284 <= sp9C)) { - this->unk_284 = Animation_GetLastFrame(&object_daiku_Anim_002134); - Animation_Change(&this->skelAnime, &object_daiku_Anim_002134, -1.0f, this->unk_284, 0.0f, ANIMMODE_ONCE, - -4.0f); - this->unk_276 = 11; - } else if ((this->unk_276 == 11) && (sp9C <= 0.0f)) { - func_80BE6408(this, 8); + if ((this->animIndex == ENDAIKU2_ANIM_5) || (this->animIndex == ENDAIKU2_ANIM_9)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); + } else if ((this->animIndex == ENDAIKU2_ANIM_10) && (curFrame >= this->animEndFrame)) { + this->animEndFrame = Animation_GetLastFrame(&object_daiku_Anim_002134); + Animation_Change(&this->skelAnime, &object_daiku_Anim_002134, -1.0f, this->animEndFrame, 0.0f, + ANIMMODE_ONCE, -4.0f); + this->animIndex = ENDAIKU2_ANIM_11; + } else if ((this->animIndex == ENDAIKU2_ANIM_11) && (curFrame <= 0.0f)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_8); } } } else if (sp98 != 2) { - if ((this->unk_276 != 9) && (this->unk_276 != 10)) { - func_80BE6408(this, 9); - } else if ((this->unk_276 == 9) && (this->unk_284 <= sp9C)) { - func_80BE6408(this, 10); + if ((this->animIndex != ENDAIKU2_ANIM_9) && (this->animIndex != ENDAIKU2_ANIM_10)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_9); + } else if ((this->animIndex == ENDAIKU2_ANIM_9) && (curFrame >= this->animEndFrame)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); } } } @@ -284,10 +323,10 @@ void func_80BE6B40(EnDaiku2* this, PlayState* play) { s32 day = gSaveContext.save.day; this->unk_288 = 1; - if ((day != 3) && Flags_GetSwitch(play, this->unk_278)) { + if ((day != 3) && Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = func_80BE6BC0; } else { - func_80BE6408(this, 5); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_5); this->actionFunc = func_80BE6BC0; } } @@ -315,6 +354,9 @@ void func_80BE6BC0(EnDaiku2* this, PlayState* play) { case 1: SET_WEEKEVENTREG(WEEKEVENTREG_64_04); break; + + default: + break; } func_80BE65B4(this, play); } @@ -322,7 +364,7 @@ void func_80BE6BC0(EnDaiku2* this, PlayState* play) { } void func_80BE6CFC(EnDaiku2* this) { - func_80BE6408(this, 3); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_3); this->unk_288 = 2; this->actionFunc = func_80BE6D40; this->unk_264 = 0.0f; @@ -350,18 +392,18 @@ void func_80BE6D40(EnDaiku2* this, PlayState* play) { } func_80BE61D0(this); } - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } void func_80BE6EB0(EnDaiku2* this) { - func_80BE6408(this, 2); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_2); this->unk_274 = 0; this->unk_288 = 3; this->actionFunc = func_80BE6EF0; } void func_80BE6EF0(EnDaiku2* this, PlayState* play) { - f32 sp5C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad[4]; Vec3f sp40; s16 var; @@ -372,7 +414,7 @@ void func_80BE6EF0(EnDaiku2* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.home.rot.y, 1, 0xBB8, 0x0); - if (this->unk_284 <= sp5C) { + if (curFrame >= this->animEndFrame) { this->unk_274 = 1; } @@ -387,14 +429,14 @@ void func_80BE6EF0(EnDaiku2* this, PlayState* play) { 4.0f) && (this->path != NULL)) { if (!func_80BE64C0(this, play)) { - if (this->unk_276 != 3) { - func_80BE6408(this, 3); + if (this->animIndex != ENDAIKU2_ANIM_3) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_3); } - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->unk_28A = 5; - if (this->unk_276 != 10) { - func_80BE6408(this, 10); + if (this->animIndex != ENDAIKU2_ANIM_10) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_10); } func_80BE65B4(this, play); return; @@ -421,24 +463,24 @@ void func_80BE6EF0(EnDaiku2* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_268, &sp40); } } - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } void func_80BE71A0(EnDaiku2* this) { - func_80BE6408(this, 9); + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_9); this->actionFunc = func_80BE71D8; } void func_80BE71D8(EnDaiku2* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; if (func_80BE64C0(this, play)) { func_80BE6CFC(this); - } else if ((this->unk_276 == 9) && (this->unk_284 <= currentFrame)) { - func_80BE6408(this, 0); - } else if ((this->unk_276 == 0) && (this->unk_284 <= currentFrame)) { - func_80BE6408(this, 5); - } else if ((this->unk_276 == 5) && (this->unk_284 <= currentFrame)) { + } else if ((this->animIndex == ENDAIKU2_ANIM_9) && (curFrame >= this->animEndFrame)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_0); + } else if ((this->animIndex == ENDAIKU2_ANIM_0) && (curFrame >= this->animEndFrame)) { + EnDaiku2_ChangeAnim(this, ENDAIKU2_ANIM_5); + } else if ((this->animIndex == ENDAIKU2_ANIM_5) && (curFrame >= this->animEndFrame)) { func_80BE65B4(this, play); } } @@ -468,13 +510,13 @@ void EnDaiku2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r Gfx_SetupDL25_Opa(play->state.gfxCtx); - if (limbIndex == 14) { + if (limbIndex == OBJECT_DAIKU_LIMB_0E) { Matrix_Scale(this->unk_260, this->unk_260, this->unk_260, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_009638); } - if (limbIndex == 15) { + if (limbIndex == OBJECT_DAIKU_LIMB_0F) { gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_00A390); } @@ -540,16 +582,16 @@ void func_80BE7718(EnDaiku2* this, PlayState* play) { s32 i; GraphicsContext* gfxCtx = play->state.gfxCtx; EnDaiku2Effect* effect = this->effects; - s32 objectIdx; + s32 objectSlot; OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA); - if ((objectIdx >= 0) && Object_IsLoaded(&play->objectCtx, objectIdx)) { + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOMBIWA); + if ((objectSlot > OBJECT_SLOT_NONE) && Object_IsLoaded(&play->objectCtx, objectSlot)) { gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index 58fc26b9a..c047b6577 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -2,23 +2,18 @@ #define Z_EN_DAIKU2_H #include "global.h" +#include "objects/object_daiku/object_daiku.h" struct EnDaiku2; typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); -#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F) +#define ENDAIKU2_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define ENDAIKU2_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x3F) #define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1) #define ENDAIKU2_PATH_INDEX_NONE 0x3F -typedef enum { - /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, - /* 0 */ ENDAIKU2_GET_7F_0, - /* 127 */ ENDAIKU2_GET_7F_127 = 127 -} EnDaiku2Param; - typedef struct EnDaiku2Effect { /* 0x00 */ u8 isEnabled; /* 0x04 */ Vec3f unk_04; @@ -34,8 +29,8 @@ typedef struct EnDaiku2Effect { typedef struct EnDaiku2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[OBJECT_DAIKU_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[OBJECT_DAIKU_LIMB_MAX]; /* 0x254 */ EnDaiku2ActionFunc actionFunc; /* 0x258 */ Path* path; /* 0x25C */ s16 unk_25C; @@ -43,12 +38,12 @@ typedef struct EnDaiku2 { /* 0x264 */ f32 unk_264; /* 0x268 */ Vec3f unk_268; /* 0x274 */ s16 unk_274; - /* 0x276 */ s16 unk_276; - /* 0x278 */ s16 unk_278; + /* 0x276 */ s16 animIndex; + /* 0x278 */ s16 switchFlag; /* 0x27A */ s16 pathIndex; /* 0x27C */ UNK_TYPE1 unk_27C[0x4]; /* 0x280 */ s32 unk_280; - /* 0x284 */ f32 unk_284; + /* 0x284 */ f32 animEndFrame; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; /* 0x28C */ EnDaiku2Effect effects[EN_DAIKU2_EFFECT_COUNT]; diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c index de02f44ad..ca7fd6a3b 100644 --- a/src/overlays/actors/ovl_En_Death/z_en_death.c +++ b/src/overlays/actors/ovl_En_Death/z_en_death.c @@ -7,7 +7,7 @@ #include "z_en_death.h" #include "z64rumble.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE) #define THIS ((EnDeath*)thisx) @@ -133,7 +133,7 @@ static InitChainEntry D_808C9A60[] = { ICHAIN_VEC3F(scale, 0, ICHAIN_CONTINUE), ICHAIN_S8(hintId, TATL_HINT_ID_GOMESS, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 5, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_STOP), }; #endif diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 422b35e87..aa0b0ff5f 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -5,10 +5,11 @@ */ #include "z_en_dekubaba.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnDekubaba*)thisx) @@ -221,7 +222,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 4; // Big Deku Baba hint does not exist in MM this->actor.hintId = TATL_HINT_ID_BIO_DEKU_BABA; - this->actor.targetMode = 2; + this->actor.targetMode = TARGET_MODE_2; } else { this->size = 1.0f; @@ -229,7 +230,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } this->actor.hintId = TATL_HINT_ID_DEKU_BABA; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; } EnDekubaba_SetupWait(this); @@ -280,7 +281,7 @@ void EnDekubaba_SetFireLightEffects(EnDekubaba* this, PlayState* play, s32 index sphElement = &this->collider.elements[index]; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sphElement->info.bumper.hitPos.x, sphElement->info.bumper.hitPos.y, sphElement->info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_SMALL_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } } @@ -300,8 +301,8 @@ void EnDekubaba_SpawnIceEffects(EnDekubaba* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 4, - this->size * 0.3f, this->size * 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DEKUBABA_BODYPART_MAX, 4, this->size * 0.3f, + this->size * 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -342,7 +343,7 @@ void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { this->actor.world.pos.z = this->actor.home.pos.z; this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; - if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f * this->size) && + if ((this->timer == 0) && (this->actor.xzDistToPlayer < (200.0f * this->size)) && (fabsf(this->actor.playerHeightRel) < 30.0f * this->size)) { EnDekubaba_SetupGrow(this); } @@ -429,7 +430,7 @@ void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { 1, HAHEN_OBJECT_DEFAULT, 10, NULL); if (this->timer == 0) { - if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 240.0f * this->size) { + if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < (240.0f * this->size)) { EnDekubaba_SetupPrepareLunge(this); } else { EnDekubaba_SetupRetract(this); @@ -867,7 +868,7 @@ void EnDekubaba_PrunedSomersaultDie(EnDekubaba* this, PlayState* play) { this->actor.scale.y = 0.0f; this->actor.scale.x = 0.0f; this->actor.speed = 0.0f; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, (s32)(this->size * 12.0f), (s32)(this->size * 5.0f), 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } @@ -914,10 +915,10 @@ void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play) { (s32)(this->size * 100.0f)); if (!this->actor.dropFlag) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_DEKU_NUTS_1); if (this->actor.params == DEKUBABA_BIG) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_DEKU_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_DEKU_NUTS_1); } } else { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x30); @@ -941,7 +942,7 @@ void EnDekubaba_SetupStunnedVertical(EnDekubaba* this) { if (this->timer == 1) { Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); - this->timer = 0x28; + this->timer = 40; } else { Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 0.0f, 0.0f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); @@ -1059,7 +1060,7 @@ void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play) { return; } - Actor_OfferGetItemNearby(&this->actor, play, GI_STICKS_1); + Actor_OfferGetItemNearby(&this->actor, play, GI_DEKU_STICKS_1); } /* Update and associated functions */ @@ -1214,7 +1215,7 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1236,7 +1237,7 @@ void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); - for (i = 1; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + for (i = DEKUBABA_BODYPART_1; i < DEKUBABA_BODYPART_MAX; i++) { Matrix_MultZero(&this->bodyPartsPos[i]); } @@ -1292,7 +1293,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { } } - Matrix_MultZero(&this->bodyPartsPos[i + 1]); + Matrix_MultZero(&this->bodyPartsPos[DEKUBABA_BODYPART_1 + i]); } CLOSE_DISPS(play->state.gfxCtx); @@ -1308,7 +1309,7 @@ void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, PlayState* play) { Collider_UpdateSpheres(55, &this->collider); Collider_UpdateSpheres(56, &this->collider); - Matrix_MultZero(&this->bodyPartsPos[3]); + Matrix_MultZero(&this->bodyPartsPos[DEKUBABA_BODYPART_3]); CLOSE_DISPS(play->state.gfxCtx); } @@ -1348,7 +1349,7 @@ void EnDekubaba_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - Math_Vec3f_Copy(&this->bodyPartsPos[0], &this->actor.world.pos); + Math_Vec3f_Copy(&this->bodyPartsPos[DEKUBABA_BODYPART_0], &this->actor.world.pos); if (this->actionFunc != EnDekubaba_DeadStickDrop) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, @@ -1381,7 +1382,7 @@ void EnDekubaba_Draw(Actor* thisx, PlayState* play) { } CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DEKUBABA_BODYPART_MAX, this->drawDmgEffScale * this->size, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index b1c7f98bc..b29dbe8db 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -13,6 +13,14 @@ typedef enum { /* 1 */ DEKUBABA_BIG } DekuBabaType; +typedef enum DekuBabaBodyPart { + /* 0 */ DEKUBABA_BODYPART_0, + /* 1 */ DEKUBABA_BODYPART_1, + /* 2 */ DEKUBABA_BODYPART_2, + /* 3 */ DEKUBABA_BODYPART_3, + /* 4 */ DEKUBABA_BODYPART_MAX +} DekuBabaBodyPart; + typedef struct EnDekubaba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,7 +35,7 @@ typedef struct EnDekubaba { /* 0x1FC */ f32 drawDmgEffAlpha; /* 0x200 */ f32 drawDmgEffScale; /* 0x204 */ f32 drawDmgEffFrozenSteamScale; - /* 0x208 */ Vec3f bodyPartsPos[4]; + /* 0x208 */ Vec3f bodyPartsPos[DEKUBABA_BODYPART_MAX]; /* 0x238 */ CollisionPoly* boundFloor; /* 0x23C */ ColliderJntSph collider; /* 0x25C */ ColliderJntSphElement colliderElements[7]; diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index cef97a8b0..4fb015365 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -5,10 +5,11 @@ */ #include "z_en_dekunuts.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnDekunuts*)thisx) @@ -130,11 +131,11 @@ void EnDekunuts_Init(Actor* thisx, PlayState* play) { } if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->collider.base.colType = COLTYPE_NONE; this->collider.info.bumperFlags |= (BUMP_NO_HITMARK | BUMP_NO_SWORD_SFX | BUMP_NO_DAMAGE | BUMP_NO_AT_INFO); } else if (this->actor.params == ENDEKUNUTS_GET_FF00_2) { - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; } func_808BD428(this); @@ -149,7 +150,7 @@ void EnDekunuts_Destroy(Actor* thisx, PlayState* play) { void func_808BD348(EnDekunuts* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.55f; - this->drawDmgEffFrozenSteamScale = 0.82500005f; + this->drawDmgEffFrozenSteamScale = 825.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->collider.base.colType = COLTYPE_HIT3; this->unk_190 = 80; @@ -161,7 +162,7 @@ void func_808BD3B4(EnDekunuts* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 8, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENDEKUNUTS_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -610,7 +611,7 @@ void func_808BE73C(EnDekunuts* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_SMALL_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == 5) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffAlpha = 4.0f; @@ -660,7 +661,7 @@ void EnDekunuts_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); } else if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) && !Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, (33.0f / 1600.0f))) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -670,22 +671,22 @@ s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec f32 arg1; f32 arg2; f32 arg3; - f32 currentFrame; + f32 curFrame; if (this->actionFunc == func_808BDA4C) { if (limbIndex == DEKU_SCRUB_LIMB_SNOUT) { - currentFrame = this->skelAnime.curFrame; - if (currentFrame <= 6.0f) { - arg2 = 1.0f - (currentFrame * 0.0833f); - arg1 = (currentFrame * 0.1167f) + 1.0f; - arg3 = (currentFrame * 0.1167f) + 1.0f; - } else if (currentFrame <= 7.0f) { - currentFrame -= 6.0f; - arg2 = 0.5f + currentFrame; - arg1 = 1.7f - (currentFrame * 0.7f); - arg3 = 1.7f - (currentFrame * 0.7f); - } else if (currentFrame <= 10.0f) { - arg2 = 1.5f - ((currentFrame - 7.0f) * 0.1667f); + curFrame = this->skelAnime.curFrame; + if (curFrame <= 6.0f) { + arg2 = 1.0f - (curFrame * 0.0833f); + arg1 = (curFrame * 0.1167f) + 1.0f; + arg3 = (curFrame * 0.1167f) + 1.0f; + } else if (curFrame <= 7.0f) { + curFrame -= 6.0f; + arg2 = 0.5f + curFrame; + arg1 = 1.7f - (curFrame * 0.7f); + arg3 = 1.7f - (curFrame * 0.7f); + } else if (curFrame <= 10.0f) { + arg2 = 1.5f - ((curFrame - 7.0f) * 0.1667f); arg1 = 1.0f; arg3 = 1.0f; } else { @@ -699,28 +700,42 @@ s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec return false; } +static s8 sLimbToBodyParts[DEKU_SCRUB_LIMB_MAX] = { + BODYPART_NONE, // DEKU_SCRUB_LIMB_NONE + BODYPART_NONE, // DEKU_SCRUB_LIMB_BODY + BODYPART_NONE, // DEKU_SCRUB_LIMB_HEAD + ENDEKUNUTS_BODYPART_3, // DEKU_SCRUB_LIMB_HEADDRESS + BODYPART_NONE, // DEKU_SCRUB_LIMB_CREST + ENDEKUNUTS_BODYPART_0, // DEKU_SCRUB_LIMB_SNOUT + BODYPART_NONE, // DEKU_SCRUB_LIMB_LEFT_LEG + ENDEKUNUTS_BODYPART_1, // DEKU_SCRUB_LIMB_LEFT_FOOT + BODYPART_NONE, // DEKU_SCRUB_LIMB_RIGHT_LEG + ENDEKUNUTS_BODYPART_2, // DEKU_SCRUB_LIMB_RIGHT_FOOT +}; + +static Vec3f D_808BEFA4[] = { + { -1500.0f, 0.0f, -1700.0f }, // ENDEKUNUTS_BODYPART_4 + { -1500.0f, 0.0f, 1700.0f }, // ENDEKUNUTS_BODYPART_5 + { -2500.0f, -2000.0f, 0.0f }, // ENDEKUNUTS_BODYPART_6 + { -1000.0f, 1000.0f, 0.0f }, // ENDEKUNUTS_BODYPART_7 +}; + void EnDekunuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_808BEF98[] = { - -1, -1, -1, 3, -1, 0, -1, 1, -1, 2, 0, 0, - }; - static Vec3f D_808BEFA4[] = { - { -1500.0f, 0.0f, -1700.0f }, { -1500.0f, 0.0f, 1700.0f }, { -2500.0f, -2000.0f, 0.0f }, - { -1000.0f, 1000.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, - }; EnDekunuts* this = THIS; s32 i; Vec3f* ptr1; Vec3f* ptr2; - s32 value = D_808BEF98[limbIndex]; + s32 bodyPartIndex = sLimbToBodyParts[limbIndex]; - if (value != -1) { - if (value < 3) { - Matrix_MultVecX(1000.0f, &this->limbPos[value]); + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= ENDEKUNUTS_BODYPART_2) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { - Matrix_MultZero(&this->limbPos[value]); + // ENDEKUNUTS_BODYPART_3 + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); ptr1 = &D_808BEFA4[0]; - ptr2 = &this->limbPos[value + 1]; - for (i = value + 1; i < ARRAY_COUNT(this->limbPos); i++) { + ptr2 = &this->bodyPartsPos[bodyPartIndex + 1]; + for (i = bodyPartIndex + 1; i < ENDEKUNUTS_BODYPART_MAX; i++) { Matrix_MultVec3f(ptr1, ptr2); ptr1++, ptr2++; } @@ -744,6 +759,6 @@ void EnDekunuts_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } Gfx_DrawDListOpa(play, gDekuScrubFlowerDL); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENDEKUNUTS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index 248f758ac..9580cb3e6 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -17,6 +17,18 @@ typedef enum { /* 0xFF */ ENDEKUNUTS_GET_FF00_FF = 0xFF } EnDekunutsParam; +typedef enum DekunutsBodyPart { + /* 0 */ ENDEKUNUTS_BODYPART_0, + /* 1 */ ENDEKUNUTS_BODYPART_1, + /* 2 */ ENDEKUNUTS_BODYPART_2, + /* 3 */ ENDEKUNUTS_BODYPART_3, + /* 4 */ ENDEKUNUTS_BODYPART_4, + /* 5 */ ENDEKUNUTS_BODYPART_5, + /* 6 */ ENDEKUNUTS_BODYPART_6, + /* 7 */ ENDEKUNUTS_BODYPART_7, + /* 8 */ ENDEKUNUTS_BODYPART_MAX +} DekunutsBodyPart; + typedef struct EnDekunuts { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +44,7 @@ typedef struct EnDekunuts { /* 0x210 */ f32 drawDmgEffAlpha; /* 0x214 */ f32 drawDmgEffScale; /* 0x218 */ f32 drawDmgEffFrozenSteamScale; - /* 0x21C */ Vec3f limbPos[8]; + /* 0x21C */ Vec3f bodyPartsPos[ENDEKUNUTS_BODYPART_MAX]; /* 0x27C */ ColliderCylinder collider; } EnDekunuts; // size = 0x2C8 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 faacd7510..86d8524be 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 @@ -6,7 +6,7 @@ #include "z_en_demo_heishi.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDemoheishi*)thisx) @@ -15,20 +15,10 @@ void EnDemoheishi_Destroy(Actor* thisx, PlayState* play); void EnDemoheishi_Update(Actor* thisx, PlayState* play); void EnDemoheishi_Draw(Actor* thisx, PlayState* play); -void EnDemoheishi_ChangeAnim(EnDemoheishi* this, s32 animIndex); void EnDemoheishi_SetupIdle(EnDemoheishi* this); void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play); void EnDemoheishi_SetupTalk(EnDemoheishi* this); 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_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; ActorInit En_Demo_heishi_InitVars = { ACTOR_EN_DEMO_HEISHI, @@ -68,10 +58,10 @@ void EnDemoheishi_Init(Actor* thisx, PlayState* play) { EnDemoheishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWaveAnim, this->jointTable, this->morphTable, SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); EnDemoheishi_SetupIdle(this); @@ -83,18 +73,35 @@ void EnDemoheishi_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliderCylinder); } -void EnDemoheishi_ChangeAnim(EnDemoheishi* this, s32 animIndex) { - static AnimationHeader* sAnimations[] = { - &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, - }; - 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, - }; +typedef enum { + /* 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, + /* 5 */ DEMOHEISHI_ANIM_MAX +} EnDemoheishiAnimation; +static AnimationHeader* sAnimations[DEMOHEISHI_ANIM_MAX] = { + &gSoldierStandHandOnHipAnim, // DEMOHEISHI_ANIM_STAND_HAND_ON_HIP + &gSoldierCheerWithSpearAnim, // DEMOHEISHI_ANIM_CHEER_WITH_SPEAR + &gSoldierWaveAnim, // DEMOHEISHI_ANIM_WAVE + &gSoldierSitAndReachAnim, // DEMOHEISHI_ANIM_SIT_AND_REACH + &gSoldierStandUpAnim, // DEMOHEISHI_ANIM_STAND_UP +}; + +static u8 sAnimationModes[DEMOHEISHI_ANIM_MAX] = { + ANIMMODE_LOOP, // DEMOHEISHI_ANIM_STAND_HAND_ON_HIP + ANIMMODE_LOOP, // DEMOHEISHI_ANIM_CHEER_WITH_SPEAR + ANIMMODE_LOOP, // DEMOHEISHI_ANIM_WAVE + ANIMMODE_LOOP, // DEMOHEISHI_ANIM_SIT_AND_REACH + ANIMMODE_ONCE, // DEMOHEISHI_ANIM_STAND_UP +}; + +void EnDemoheishi_ChangeAnim(EnDemoheishi* this, s32 animIndex) { this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -10.0f); } @@ -132,7 +139,7 @@ void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnDemoheishi_SetupTalk(this); } else if (absYawDiff <= 0x4BB8) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h index 9d9714b95..8c1a576f5 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h @@ -22,7 +22,7 @@ typedef struct EnDemoheishi { /* 0x262 */ s16 headRotZTarget; /* 0x264 */ s32 animIndex; /* 0x268 */ s16 timer; - /* 0x26C */ f32 frameCount; + /* 0x26C */ f32 animEndFrame; /* 0x270 */ s16 isTalking; /* 0x272 */ s16 textIdIndex; /* 0x274 */ ColliderCylinder colliderCylinder; 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 46c6de979..bd0139222 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -7,7 +7,7 @@ #include "z_en_dg.h" #include "overlays/actors/ovl_En_Aob_01/z_en_aob_01.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_800000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_800000) #define THIS ((EnDg*)thisx) @@ -185,33 +185,41 @@ typedef enum { /* 16 */ DOG_ANIM_MAX } DogAnimation; -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 }, - { &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, - { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, - { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, - { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, +static AnimationInfoS sAnimationInfo[DOG_ANIM_MAX] = { + { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DOG_ANIM_WALK_AFTER_TALKING + { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // DOG_ANIM_WALK + { &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DOG_ANIM_RUN + { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // DOG_ANIM_BARK + { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // DOG_ANIM_SIT_DOWN_ONCE + { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, // DOG_ANIM_SIT_DOWN + { &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // DOG_ANIM_LYING_DOWN_START_1 + { &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // DOG_ANIM_LYING_DOWN_LOOP + { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, // DOG_ANIM_LYING_DOWN_START_2 + { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, // DOG_ANIM_LYING_DOWN_START_3 + { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, // DOG_ANIM_LYING_DOWN_START_4 + { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, // DOG_ANIM_WALK_BACKWARDS + { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DOG_ANIM_JUMP + { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // DOG_ANIM_LONG_JUMP + { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // DOG_ANIM_JUMP_ATTACK + { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, // DOG_ANIM_SWIM }; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP), }; -void EnDg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { - f32 frameCount; +void EnDg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animInfo, s32 animIndex) { + f32 endFrame; - animationInfo += animIndex; - if (animationInfo->frameCount < 0) { - frameCount = Animation_GetLastFrame(animationInfo->animation); + animInfo += animIndex; + if (animInfo->frameCount < 0) { + endFrame = Animation_GetLastFrame(animInfo->animation); } else { - frameCount = animationInfo->frameCount; + endFrame = animInfo->frameCount; } - Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed + (BREG(88) * 0.1f), - animationInfo->startFrame, frameCount, animationInfo->mode, animationInfo->morphFrames); + Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed + (BREG(88) * 0.1f), animInfo->startFrame, + endFrame, animInfo->mode, animInfo->morphFrames); } void EnDg_UpdateCollision(EnDg* this, PlayState* play) { @@ -483,11 +491,11 @@ void EnDg_TryPickUp(EnDg* this, PlayState* play) { } EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SIT_DOWN); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); this->actionFunc = EnDg_SetupTalk; } else { this->actionFunc = EnDg_Held; @@ -508,7 +516,7 @@ s32 EnDg_FindFollowerForBremenMask(PlayState* play) { while (enemy != NULL) { if (enemy->id == ACTOR_EN_DG) { - if (enemy->isTargeted) { + if (enemy->isLockedOn) { sBremenMaskFollowerIndex = ((EnDg*)enemy)->index; return true; } @@ -1233,7 +1241,7 @@ void EnDg_JumpOutOfWater(EnDg* this, PlayState* play) { void EnDg_Held(EnDg* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->grabState = DOG_GRAB_STATE_THROWN_OR_SITTING_AFTER_THROW; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (sIsAnyDogHeld) { this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; sIsAnyDogHeld = false; @@ -1280,7 +1288,7 @@ void EnDg_SetupTalk(EnDg* this, PlayState* play) { EnDg_StartTextBox(this, play); this->actionFunc = EnDg_Talk; } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -1304,7 +1312,7 @@ void EnDg_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, ENDG_GET_PATH_INDEX(&this->actor), ENDG_PATH_INDEX_NONE); Actor_SetScale(&this->actor, 0.0075f); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actor.gravity = -3.0f; this->timer = Rand_S16Offset(60, 60); this->dogFlags = DOG_FLAG_NONE; 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 e24e2691b..22c247c1f 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -5,9 +5,9 @@ */ #include "z_en_dinofos.h" -#include "objects/object_dinofos/object_dinofos.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_400) #define THIS ((EnDinofos*)thisx) @@ -241,11 +241,11 @@ static DamageTable sDamageTable = { static CollisionCheckInfoInit sColChkInfoInit = { 4, 40, 100, 80 }; -static TexturePtr D_8089E33C[] = { - object_dinofos_Tex_008E30, - object_dinofos_Tex_009030, - object_dinofos_Tex_009230, - object_dinofos_Tex_009030, +static TexturePtr sEyeTextures[] = { + gDinolfosEyeOpenTex, + gDinolfosEyeHalfTex, + gDinolfosEyeClosedTex, + gDinolfosEyeHalfTex, }; static s16 sCsId = CS_ID_NONE; @@ -274,12 +274,12 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElement); Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dinofos_Skel_009570, &object_dinofos_Anim_002E40, - this->jointTable, this->morphTable, 21); + SkelAnime_InitFlex(play, &this->skelAnime, &gDinolfosSkel, &gDinolfosIdleAnim, this->jointTable, this->morphTable, + DINOLFOS_LIMB_MAX); if (D_8089E364 == 0) { - for (i = 0; i < ARRAY_COUNT(D_8089E33C); i++) { - D_8089E33C[i] = Lib_SegmentedToVirtual(D_8089E33C[i]); + for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); } D_8089E364 = 1; } @@ -378,7 +378,7 @@ void func_8089AC70(EnDinofos* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.55f; this->colliderJntSph.base.colType = COLTYPE_HIT3; - this->drawDmgEffFrozenSteamScale = 0.82500005f; + this->drawDmgEffFrozenSteamScale = 825.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->unk_290 = 80; this->actor.flags &= ~ACTOR_FLAG_400; @@ -390,7 +390,7 @@ void func_8089ACEC(EnDinofos* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderJntSph.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 12, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DINOFOS_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -439,7 +439,7 @@ s32 func_8089AE00(EnDinofos* this, PlayState* play) { } if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && - this->actor.isTargeted && (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && + this->actor.isLockedOn && (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && Player_IsFacingActor(&this->actor, 0x2000, play)) { if (Rand_ZeroOne() < 0.5f) { func_8089C024(this, 2); @@ -450,8 +450,8 @@ s32 func_8089AE00(EnDinofos* this, PlayState* play) { return true; } - if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && - (player->unk_AE7 == 1) && (this->unk_28B == 0)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && (player->actionVar1 == 1) && + (this->unk_28B == 0)) { this->unk_28B = 1; for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { this->colliderJntSph.elements[i].info.bumper.dmgFlags &= ~0x400; @@ -466,9 +466,8 @@ void func_8089B100(EnDinofos* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f sp3C; - Animation_Change(&this->skelAnime, &object_dinofos_Anim_001CCC, 1.0f, - Animation_GetLastFrame(&object_dinofos_Anim_001CCC), - Animation_GetLastFrame(&object_dinofos_Anim_001CCC), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gDinolfosJumpAnim, 1.0f, Animation_GetLastFrame(&gDinolfosJumpAnim), + Animation_GetLastFrame(&gDinolfosJumpAnim), ANIMMODE_ONCE, 0.0f); func_800BE33C(&subCam->eye, &subCam->at, &this->unk_29A, true); Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &sp3C); this->unk_2BC.x = player->actor.world.pos.x + (0.4f * sp3C.x); @@ -533,7 +532,7 @@ void func_8089B4A4(EnDinofos* this) { if (this->unk_290 < 10) { Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00C974); + Animation_PlayOnce(&this->skelAnime, &gDinolfosIntroAnim); this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; this->unk_2BC.y = this->actor.floorHeight + 11.0f; this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z; @@ -559,12 +558,12 @@ void func_8089B580(EnDinofos* this, PlayState* play) { Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); 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); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); } } if ((play->sceneId == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { - play->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } if (SkelAnime_Update(&this->skelAnime)) { @@ -573,7 +572,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } void func_8089B6E8(EnDinofos* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_dinofos_Anim_009B70, -3.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosCryAnim, -3.0f); this->actionFunc = func_8089B72C; } @@ -591,7 +590,7 @@ void func_8089B72C(EnDinofos* this, PlayState* play) { } void func_8089B7B0(EnDinofos* this) { - Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_002E40, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gDinolfosIdleAnim, -4.0f); this->unk_290 = (s32)Rand_ZeroFloat(20.0f) + 40; this->unk_292 = 30; this->actor.speed = 0.0f; @@ -619,7 +618,7 @@ void func_8089B8B0(EnDinofos* this, PlayState* play) { f32 phi_f0; if (this->actionFunc != func_8089B98C) { - Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_000580, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gDinolfosWalkAnim, -4.0f); if (Actor_OtherIsTargeted(play, &this->actor)) { phi_f0 = 170.0f; } else { @@ -674,7 +673,7 @@ void func_8089B98C(EnDinofos* this, PlayState* play) { void func_8089BAC0(EnDinofos* this) { if (this->actionFunc != func_8089BB60) { - Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_000580, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gDinolfosWalkAnim, -4.0f); this->actor.speed = 0.0f; } if (BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y) > 0) { @@ -715,8 +714,8 @@ void func_8089BBB4(EnDinofos* this, PlayState* play) { if (this->actionFunc == func_8089D1E0) { this->skelAnime.playSpeed = this->actor.speed * 0.166666671634f; } else { - Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speed * 0.166666671634f, 0.0f, - 0.0f, ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->skelAnime, &gDinolfosSidestepAnim, this->actor.speed * 0.166666671634f, 0.0f, 0.0f, + ANIMMODE_LOOP, -4.0f); } this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); @@ -795,10 +794,10 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { void func_8089C024(EnDinofos* this, s32 arg1) { if (arg1 == 0) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_dinofos_Anim_001CCC, 2.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosJumpAnim, 2.0f); func_8089AD70(this); } else { - Animation_MorphToPlayOnce(&this->skelAnime, &object_dinofos_Anim_001CCC, -1.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosJumpAnim, -1.0f); if ((arg1 == 2) || (arg1 == 3)) { this->colliderJntSph.base.acFlags &= ~AC_ON; func_8089AD70(this); @@ -862,10 +861,10 @@ void func_8089C2A8(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_290++; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1800); - if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animation == &object_dinofos_Anim_001CCC)) { + if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animation == &gDinolfosJumpAnim)) { this->colliderQuad.base.atFlags |= AT_ON; this->colliderJntSph.base.acFlags |= AC_ON; - Animation_Change(&this->skelAnime, &object_dinofos_Anim_0025B4, 1.0f, 7.0f, 13.0f, ANIMMODE_ONCE, -2.0f); + Animation_Change(&this->skelAnime, &gDinolfosAttackAnim, 1.0f, 7.0f, 13.0f, ANIMMODE_ONCE, -2.0f); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -876,9 +875,9 @@ void func_8089C2A8(EnDinofos* this, PlayState* play) { void func_8089C398(EnDinofos* this) { if (this->actionFunc != func_8089C2A8) { - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_000AF0); + Animation_PlayOnce(&this->skelAnime, &gDinolfosLandAnim); } else { - this->skelAnime.endFrame = Animation_GetLastFrame(&object_dinofos_Anim_0025B4); + this->skelAnime.endFrame = Animation_GetLastFrame(&gDinolfosAttackAnim); } if (this->actor.speed < 0.0f) { @@ -905,7 +904,7 @@ void func_8089C44C(EnDinofos* this, PlayState* play) { } void func_8089C4F8(EnDinofos* this) { - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0025B4); + Animation_PlayOnce(&this->skelAnime, &gDinolfosAttackAnim); this->colliderQuad.base.atFlags &= ~AT_BOUNCED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->unk_290 = 0; @@ -936,8 +935,8 @@ void func_8089C56C(EnDinofos* this, PlayState* play) { } void func_8089C690(EnDinofos* this) { - Animation_Change(&this->skelAnime, &object_dinofos_Anim_0025B4, -1.0f, this->skelAnime.curFrame, 0.0f, - ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gDinolfosAttackAnim, -1.0f, this->skelAnime.curFrame, 0.0f, ANIMMODE_ONCE, + 0.0f); this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); if (this->actionFunc != func_8089C2A8) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -987,7 +986,7 @@ void func_8089C7B8(EnDinofos* this, PlayState* play) { } void func_8089C87C(EnDinofos* this, s32 arg1) { - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00D21C); + Animation_PlayOnce(&this->skelAnime, &gDinolfosHitAnim); func_800BE5CC(&this->actor, &this->colliderJntSph, arg1); this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); this->actor.speed = 10.0f; @@ -1020,7 +1019,7 @@ void func_8089C938(EnDinofos* this, PlayState* play) { } void func_8089CA14(EnDinofos* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_dinofos_Anim_001040, -5.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosFireStartAnim, -5.0f); this->colliderJntSph.base.acFlags |= AC_ON; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1041,7 +1040,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { s32 i; Sphere16* worldSphere; - Animation_PlayLoop(&this->skelAnime, &object_dinofos_Anim_0013C0); + Animation_PlayLoop(&this->skelAnime, &gDinolfosFireLoopAnim); this->unk_290 = 20; this->actor.speed = 0.0f; this->colliderJntSph.base.atFlags |= AT_ON; @@ -1049,9 +1048,9 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { worldSphere = &this->colliderJntSph.elements[i].dim.worldSphere; - worldSphere->center.x = this->limbPos[10].x; - worldSphere->center.y = this->limbPos[10].y; - worldSphere->center.z = this->limbPos[10].z; + worldSphere->center.x = this->bodyPartsPos[DINOFOS_BODYPART_JAW].x; + worldSphere->center.y = this->bodyPartsPos[DINOFOS_BODYPART_JAW].y; + worldSphere->center.z = this->bodyPartsPos[DINOFOS_BODYPART_JAW].z; } if (play->sceneId == SCENE_MITURIN) { @@ -1086,8 +1085,9 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { sp7C.x = 0.9f * temp_f20; sp7C.y = Rand_CenteredFloat(0.6f) + 1.4f; sp7C.z = 0.9f * temp_f22; - func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); - EffectSsDFire_Spawn(play, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, + 3, 8); for (end = 6, i = 3; i > 0; i--) { if (this->unk_290 < (20 + -(i * 2))) { @@ -1100,9 +1100,11 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { dim = &this->colliderJntSph.elements[i].dim; temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; - dim->worldSphere.center.x = (s32)this->limbPos[10].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); - dim->worldSphere.center.y = (s32)this->limbPos[10].y + (s32)dim->modelSphere.center.y; - dim->worldSphere.center.z = (s32)this->limbPos[10].z + (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z); + dim->worldSphere.center.x = + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); + dim->worldSphere.center.y = (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].y + (s32)dim->modelSphere.center.y; + dim->worldSphere.center.z = + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].z + (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z); } if (this->unk_290 != 0) { @@ -1113,10 +1115,10 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { } void func_8089CF00(EnDinofos* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0017B8); + Animation_PlayOnce(&this->skelAnime, &gDinolfosFireEndAnim); this->colliderJntSph.base.atFlags &= ~AT_ON; if (play->sceneId == SCENE_MITURIN) { - play->envCtx.lightSettingOverride = 255; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } this->actionFunc = func_8089CF70; } @@ -1128,8 +1130,8 @@ void func_8089CF70(EnDinofos* this, PlayState* play) { } void func_8089CFAC(EnDinofos* this) { - Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00ABD0); - this->actor.flags &= ~ACTOR_FLAG_1; + Animation_PlayOnce(&this->skelAnime, &gDinolfosDieAnim); + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1168,7 +1170,7 @@ void func_8089D11C(EnDinofos* this, s16 arg1) { } else { this->actor.speed = 15.0f; } - Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speed * (1.0f / 7.5f), 0.0f, 0.0f, + Animation_Change(&this->skelAnime, &gDinolfosSidestepAnim, this->actor.speed * (1.0f / 7.5f), 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); this->unk_292 = 10; @@ -1287,7 +1289,7 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { func_8089ACEC(this, play); func_8089AD70(this); if (play->sceneId == SCENE_MITURIN) { - play->envCtx.lightSettingOverride = 255; + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); @@ -1332,7 +1334,8 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderJntSph.elements[i].info.bumper.hitPos.x, this->colliderJntSph.elements[i].info.bumper.hitPos.y, - this->colliderJntSph.elements[i].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->colliderJntSph.elements[i].info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } func_8089C87C(this, i); return true; @@ -1345,7 +1348,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnDinofos* this = THIS; s32 pad; - Vec3f sp30; + Vec3f bodyPartPos; if (this->actionFunc != func_8089C7B8) { func_8089A900(this); @@ -1362,10 +1365,11 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_40); if (this->actionFunc != func_8089C7B8) { if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { - if (!((play->gameplayFrames % 4) & 1)) { - Math_Vec3f_Copy(&sp30, &this->limbPos[1 + (play->gameplayFrames % 4)]); - sp30.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(play, &sp30, 100, 320, 0); + if (((play->gameplayFrames % 4) & 1) == 0) { + Math_Vec3f_Copy(&bodyPartPos, + &this->bodyPartsPos[DINOFOS_BODYPART_LEFT_CLAWS + (play->gameplayFrames % 4)]); + bodyPartPos.y = this->actor.world.pos.y + this->actor.depthInWater; + EffectSsGRipple_Spawn(play, &bodyPartPos, 100, 320, 0); } } if (this->actionFunc != func_8089D018) { @@ -1377,7 +1381,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { Math_ScaledStepToS(&this->unk_28E, 0, 2000); } - Math_Vec3f_Copy(&this->actor.focus.pos, &this->limbPos[4]); + Math_Vec3f_Copy(&this->actor.focus.pos, &this->bodyPartsPos[DINOFOS_BODYPART_UPPER_BODY]); this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_28E; if (this->colliderJntSph.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); @@ -1398,7 +1402,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * (11.0f / 40.0f); this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1406,20 +1410,42 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { s32 func_8089DC4C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnDinofos* this = THIS; - if (limbIndex == 16) { + if (limbIndex == DINOLFOS_LIMB_HEAD) { rot->y -= this->unk_28E; } return 0; } +static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; +static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; +static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; + +static s8 sLimbToBodyParts[DINOLFOS_LIMB_MAX] = { + BODYPART_NONE, // DINOLFOS_LIMB_NONE + BODYPART_NONE, // DINOLFOS_LIMB_LOWER_BODY + DINOFOS_BODYPART_LEFT_UPPER_LEG, // DINOLFOS_LIMB_LEFT_UPPER_LEG + BODYPART_NONE, // DINOLFOS_LIMB_LEFT_LOWER_LEG + DINOFOS_BODYPART_LEFT_CLAWS, // DINOLFOS_LIMB_LEFT_CLAWS + DINOFOS_BODYPART_RIGHT_UPPER_LEG, // DINOLFOS_LIMB_RIGHT_UPPER_LEG + BODYPART_NONE, // DINOLFOS_LIMB_RIGHT_LOWER_LEG + DINOFOS_BODYPART_RIGHT_CLAWS, // DINOLFOS_LIMB_RIGHT_CLAWS + DINOFOS_BODYPART_UPPER_BODY, // DINOLFOS_LIMB_UPPER_BODY + BODYPART_NONE, // DINOLFOS_LIMB_LEFT_UPPER_ARM + DINOFOS_BODYPART_LEFT_FOREARM, // DINOLFOS_LIMB_LEFT_FOREARM + DINOFOS_BODYPART_LEFT_HAND, // DINOLFOS_LIMB_LEFT_HAND + BODYPART_NONE, // DINOLFOS_LIMB_RIGHT_UPPER_ARM + DINOFOS_BODYPART_RIGHT_FOREARM, // DINOLFOS_LIMB_RIGHT_FOREARM + DINOFOS_BODYPART_RIGHT_HAND, // DINOLFOS_LIMB_RIGHT_HAND + BODYPART_NONE, // DINOLFOS_LIMB_NECK + DINOFOS_BODYPART_HEAD, // DINOLFOS_LIMB_HEAD + DINOFOS_BODYPART_JAW, // DINOLFOS_LIMB_JAW + BODYPART_NONE, // DINOLFOS_LIMB_UPPER_TAIL + DINOFOS_BODYPART_LOWER_TAIL, // DINOLFOS_LIMB_LOWER_TAIL + BODYPART_NONE, // DINOLFOS_LIMB_KNIFE +}; + void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; - static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; - static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; - static s8 D_8089E3B0[] = { - -1, -1, 0, -1, 1, 2, -1, 3, 4, -1, 5, 6, -1, 7, 8, -1, 9, 10, -1, 11, -1, - }; EnDinofos* this = THIS; Vec3f sp80; Vec3f sp74; @@ -1430,11 +1456,11 @@ void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto MtxF* sp48; Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); - if (D_8089E3B0[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_8089E3B0[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if ((limbIndex == 14) && (this->unk_292 != this->unk_290) && + if ((limbIndex == DINOLFOS_LIMB_RIGHT_HAND) && (this->unk_292 != this->unk_290) && ((this->actionFunc == func_8089C56C) || (this->actionFunc == func_8089C2A8))) { Math_Vec3f_Copy(&sp74, &this->colliderQuad.dim.quad[0]); Math_Vec3f_Copy(&sp80, &this->colliderQuad.dim.quad[1]); @@ -1447,13 +1473,13 @@ void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto this->unk_292 = this->unk_290; } - if (limbIndex == 4) { + if (limbIndex == DINOLFOS_LIMB_LEFT_CLAWS) { Matrix_MultVecX(300.0f, &this->actor.shape.feetPos[0]); - } else if (limbIndex == 7) { + } else if (limbIndex == DINOLFOS_LIMB_RIGHT_CLAWS) { Matrix_MultVecX(300.0f, &this->actor.shape.feetPos[1]); } - if ((limbIndex == 16) && (this->actionFunc == func_8089B580)) { + if ((limbIndex == DINOLFOS_LIMB_HEAD) && (this->actionFunc == func_8089B580)) { if ((this->skelAnime.curFrame > 38.0f) && (this->skelAnime.curFrame <= 55.0f) && (this->unk_292 != this->unk_290)) { sp48 = Matrix_GetCurrent(); @@ -1463,7 +1489,8 @@ void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto sp4C.x -= sp48->mf[3][0]; sp4C.y -= sp48->mf[3][1]; sp4C.z -= sp48->mf[3][2]; - EffectSsDFire_Spawn(play, &this->limbPos[10], &sp4C, &gZeroVec3f, 30, 22, 255 - (sp58 * 20), 20, 3, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp4C, &gZeroVec3f, 30, 22, + 255 - (sp58 * 20), 20, 3, 8); this->unk_292 = this->unk_290; } } @@ -1478,7 +1505,7 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); func_800B8050(&this->actor, play, 0); - gSPSegment(POLY_OPA_DISP++, 0x08, D_8089E33C[this->unk_289]); + gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->unk_289]); gDPSetEnvColor(POLY_OPA_DISP++, 20, 40, 40, 255); Scene_SetRenderModeXlu(play, 0, 1); @@ -1489,7 +1516,7 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); func_800B8118(&this->actor, play, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, D_8089E33C[this->unk_289]); + gSPSegment(POLY_XLU_DISP++, 0x08, sEyeTextures[this->unk_289]); gDPSetEnvColor(POLY_XLU_DISP++, 20, 40, 40, this->unk_288); Scene_SetRenderModeXlu(play, 1, 2); @@ -1498,7 +1525,7 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DINOFOS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index 4284d5595..dd39135ae 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -2,16 +2,33 @@ #define Z_EN_DINOFOS_H #include "global.h" +#include "objects/object_dinofos/object_dinofos.h" struct EnDinofos; typedef void (*EnDinofosActionFunc)(struct EnDinofos*, PlayState*); +typedef enum EnDinofosBodyPart { + /* 0 */ DINOFOS_BODYPART_LEFT_UPPER_LEG, + /* 1 */ DINOFOS_BODYPART_LEFT_CLAWS, + /* 2 */ DINOFOS_BODYPART_RIGHT_UPPER_LEG, + /* 3 */ DINOFOS_BODYPART_RIGHT_CLAWS, + /* 4 */ DINOFOS_BODYPART_UPPER_BODY, + /* 5 */ DINOFOS_BODYPART_LEFT_FOREARM, + /* 6 */ DINOFOS_BODYPART_LEFT_HAND, + /* 7 */ DINOFOS_BODYPART_RIGHT_FOREARM, + /* 8 */ DINOFOS_BODYPART_RIGHT_HAND, + /* 9 */ DINOFOS_BODYPART_HEAD, + /* 10 */ DINOFOS_BODYPART_JAW, + /* 11 */ DINOFOS_BODYPART_LOWER_TAIL, + /* 12 */ DINOFOS_BODYPART_MAX +} EnDinofosBodyPart; + typedef struct EnDinofos { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[DINOLFOS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[DINOLFOS_LIMB_MAX]; /* 0x284 */ EnDinofosActionFunc actionFunc; /* 0x288 */ u8 unk_288; /* 0x289 */ u8 unk_289; @@ -33,7 +50,7 @@ typedef struct EnDinofos { /* 0x2B8 */ f32 drawDmgEffFrozenSteamScale; /* 0x2BC */ Vec3f unk_2BC; /* 0x2C8 */ Vec3f unk_2C8; - /* 0x2D4 */ Vec3f limbPos[12]; + /* 0x2D4 */ Vec3f bodyPartsPos[DINOFOS_BODYPART_MAX]; /* 0x364 */ ColliderJntSph colliderJntSph; /* 0x384 */ ColliderJntSphElement colliderJntSphElement[9]; /* 0x5C4 */ ColliderQuad colliderQuad; diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c index 9413b046c..e30ee26ab 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c @@ -6,7 +6,7 @@ #include "z_en_dnh.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDnh*)thisx) @@ -16,9 +16,32 @@ void EnDnh_Update(Actor* thisx, PlayState* play); void EnDnh_Draw(Actor* thisx, PlayState* play); void func_80A50F38(EnDnh* this, PlayState* play); -void func_80A50F9C(EnDnh* this, PlayState* play); +void EnDnh_DoNothing(EnDnh* this, PlayState* play); + +UNK_TYPE D_80A51250[] = { + 0x000C0800, 0x080E0862, 0x0C111101, 0x10040005, 0x0E08670C, 0x10001402, 0x007A0019, 0x1000300E, 0x08590C25, + 0x000D0018, 0x0F08630C, 0x12060043, 0x00001300, 0x430C0700, 0x000E088D, 0x0C190007, 0x0F088D0C, 0x19000012, + 0x11191009, 0x00001000, 0x1A100016, 0x0E085A11, 0x1A100C0F, 0x085B0C0F, 0x085C0C05, 0x00060024, 0x00060E08, + 0x5B19FFEE, 0x300F085E, 0x0C08000A, 0x00050F08, 0x750C1014, 0xFFF60F08, 0x600C1211, 0x19100900, 0x0010310F, + 0x085F0C10, 0x00192000, 0x49001A10, 0x003D0E08, 0x68111A10, 0x0C0F0869, 0x0C0F086A, 0x0C0F086B, 0x0C0F086C, + 0x0C050000, 0x00190000, 0x300E086E, 0x1119201C, 0x03201D03, 0x401D0380, 0x1D04010C, 0x12090000, 0x10310E08, + 0x6D0C100E, 0x08700C19, 0xFFCB0019, 0x2000070E, 0x08710C19, 0xFFBB0E08, 0x720C0F08, 0x730C0500, 0x00001700, + 0x0008000A, 0x0006320F, 0x08750C10, 0x3014FFF6, 0x001A4000, 0x0919FFA8, 0x310E0874, 0x0C100E08, 0x76111920, + 0x1C03201D, 0x03401D03, 0x801D0401, 0x0C120900, 0x00100000, +}; + +UNK_TYPE D_80A51384[] = { + 0x0E08610C, + 0x16100000, +}; + +UNK_TYPE D_80A5138C[] = { + 0x1B034000, 0x67001A40, 0x003A1B03, 0x80001A0E, 0x087C0C00, 0x5B20000A, 0x0F087E0C, 0x115B2019, + 0x004E0F08, 0x7B0C1900, 0x470E087D, 0x0C120600, 0x0C000013, 0x000C0C07, 0x00000E08, 0x7E0C111A, + 0x4019002C, 0x1B038000, 0x0B0E087A, 0x0C0F087B, 0x0C19001C, 0x0E08780C, 0x12060005, 0x00001300, + 0x050C0700, 0x000E0879, 0x0C190004, 0x0E08770C, 0x1D03201D, 0x03401D03, 0x801D0401, 0x16100000, +}; -#if 0 ActorInit En_Dnh_InitVars = { ACTOR_EN_DNH, ACTORCAT_NPC, @@ -31,28 +54,142 @@ ActorInit En_Dnh_InitVars = { (ActorFunc)EnDnh_Draw, }; -#endif +typedef enum { + /* 0 */ ENDNH_ANIM_HEAD_MOVING, + /* 1 */ ENDNH_ANIM_MAX +} EnDnhAnimation; -extern UNK_TYPE D_06002950; +static AnimationInfoS sAnimationInfo[ENDNH_ANIM_MAX] = { + { &gKoumeKioskHeadMovingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNH_ANIM_HEAD_MOVING +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50D40.s") +static TexturePtr sEyeTextures[] = { + gKoumeKioskEyeOpenTex, + gKoumeKioskEyeHalfTex, + gKoumeKioskEyeClosedTex, + gKoumeKioskEyeHalfTex, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50DF8.s") +s32 func_80A50D40(Actor* actor, PlayState* play) { + func_800B7298(play, actor, PLAYER_CSMODE_WAIT); + if (CHECK_EVENTINF(EVENTINF_35)) { + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 6); + } else { + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6); + } + gSaveContext.nextCutsceneIndex = 0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; + gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE_SLOW; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); + CLEAR_EVENTINF(EVENTINF_50); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50E40.s") +void* func_80A50DF8(EnDnh* this, PlayState* play) { + switch (this->unk198) { + case 1: + return D_80A51384; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50EC0.s") + case 2: + return D_80A5138C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50F38.s") + default: + return D_80A51250; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50F9C.s") +s32 func_80A50E40(EnDnh* this, PlayState* play) { + if (((this->unk18C & SUBS_OFFER_MODE_MASK) == SUBS_OFFER_MODE_NONE) || + !Actor_ProcessTalkRequest(&this->actor, &play->state)) { + return 0; + } + SubS_SetOfferMode(&this->unk18C, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->msgEventScript = func_80A50DF8(this, play); + this->actionFunc = func_80A50F38; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Init.s") +s32 func_80A50EC0(EnDnh* this) { + if (DECR(this->blinkTimer) == 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex >= ARRAY_COUNT(sEyeTextures)) { + this->blinkTimer = Rand_S16Offset(30, 30); + this->eyeTexIndex = 0; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Destroy.s") +void func_80A50F38(EnDnh* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->unk194)) { + SubS_SetOfferMode(&this->unk18C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + this->unk194 = 0; + this->unk198 = 0; + this->actionFunc = EnDnh_DoNothing; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Update.s") +void EnDnh_DoNothing(EnDnh* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A51168.s") +void EnDnh_Init(Actor* thisx, PlayState* play) { + EnDnh* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Draw.s") + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_Init(play, &this->skelAnime, &gKoumeKioskSkel, NULL, this->jointTable, this->morphTable, + KOUME_KIOSK_LIMB_MAX); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, ENDNH_ANIM_HEAD_MOVING); + this->actor.shape.yOffset = 1100.0f; + + if (gSaveContext.save.entrance != ENTRANCE(TOURIST_INFORMATION, 1)) { + SubS_SetOfferMode(&this->unk18C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + this->unk198 = 0; + } else { + SubS_SetOfferMode(&this->unk18C, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); + this->unk198 = CHECK_EVENTINF(EVENTINF_35) ? 2 : 1; + } + + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { + this->actor.draw = NULL; + } + + this->msgEventCallback = func_80A50D40; + this->unk194 = 0; + this->actionFunc = EnDnh_DoNothing; +} + +void EnDnh_Destroy(Actor* thisx, PlayState* play) { +} + +void EnDnh_Update(Actor* thisx, PlayState* play) { + EnDnh* this = THIS; + + func_80A50E40(this, play); + this->actionFunc(this, play); + func_80A50EC0(this); + SkelAnime_Update(&this->skelAnime); + SubS_Offer(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk18C & SUBS_OFFER_MODE_MASK); + Actor_SetFocus(&this->actor, 26.0f); +} + +s32 EnDnh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnDnh* this = THIS; + + if (limbIndex == KOUME_KIOSK_LIMB_HEAD) { + Matrix_Translate(0.0f, this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY); + } + return false; +} + +void EnDnh_Draw(Actor* thisx, PlayState* play) { + EnDnh* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Opa(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex])); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDnh_OverrideLimbDraw, NULL, + &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h index c2331d777..3aa83d154 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h @@ -2,15 +2,27 @@ #define Z_EN_DNH_H #include "global.h" +#include "objects/object_tro/object_tro.h" struct EnDnh; typedef void (*EnDnhActionFunc)(struct EnDnh*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnDnh { /* 0x000 */ Actor actor; /* 0x144 */ EnDnhActionFunc actionFunc; - /* 0x148 */ char unk_148[0x74]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ u16 unk18C; + /* 0x190 */ s32 msgEventScript; + /* 0x194 */ s32 unk194; + /* 0x198 */ s16 unk198; + /* 0x19A */ UNK_TYPE1 pad19A[0x2]; + /* 0x19C */ s16 blinkTimer; + /* 0x19E */ s16 eyeTexIndex; + /* 0x1A0 */ MsgEventFunc msgEventCallback; + /* 0x1A4 */ Vec3s jointTable[KOUME_KIOSK_LIMB_MAX]; + /* 0x1B0 */ Vec3s morphTable[KOUME_KIOSK_LIMB_MAX]; } EnDnh; // size = 0x1BC #endif // Z_EN_DNH_H 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 216ca0031..0dab8ff45 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -5,11 +5,8 @@ */ #include "z_en_dnk.h" -#include "objects/object_dnk/object_dnk.h" -#include "objects/object_hintnuts/object_hintnuts.h" -#include "objects/object_dekunuts/object_dekunuts.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDnk*)thisx) @@ -17,7 +14,7 @@ void EnDnk_Init(Actor* thisx, PlayState* play); void EnDnk_Destroy(Actor* thisx, PlayState* play); void EnDnk_Update(Actor* thisx, PlayState* play); -void func_80A51890(EnDnk* this, PlayState* play); +void EnDnk_HandleCutscene(EnDnk* this, PlayState* play); void EnDnk_DoNothing(EnDnk* this, PlayState* play); void func_80A52018(Actor* thisx, PlayState* play); void func_80A52134(EnDnk* this, PlayState* play); @@ -93,66 +90,108 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -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 }, - { &gDekuPalaceGuardAttackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPalaceGuardDigAnim, 1.0f, -1, -1, ANIMMODE_ONCE, 0 }, - { &gDekuPalaceGuardDigAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPalaceGuardJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPalaceGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuPalaceGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPalaceGuardHappyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_hintnuts_Anim_000168, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_hintnuts_Anim_0024CC, 1.0f, -1, -1, ANIMMODE_ONCE, 0 }, - { &object_hintnuts_Anim_0024CC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_hintnuts_Anim_0026C4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_hintnuts_Anim_002894, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_hintnuts_Anim_002B90, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_hintnuts_Anim_002F7C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_hintnuts_Anim_002F7C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_hintnuts_Anim_003128, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_hintnuts_Anim_003128, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_hintnuts_Anim_0029BC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_hintnuts_Anim_002E84, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubSpitAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubDamageAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuScrubDieAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuScrubUnburrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuScrubLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuScrubIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuScrubIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubPantingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuScrubRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuScrubStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +typedef enum { + /* -1 */ ENDNK_ANIM_NONE = -1, + /* 0 */ ENDNK_ANIM_0, + /* 1 */ ENDNK_ANIM_1, + /* 2 */ ENDNK_ANIM_2, + /* 3 */ ENDNK_ANIM_3, + /* 4 */ ENDNK_ANIM_4, + /* 5 */ ENDNK_ANIM_5, + /* 6 */ ENDNK_ANIM_6, + /* 7 */ ENDNK_ANIM_7, + /* 8 */ ENDNK_ANIM_8, + /* 9 */ ENDNK_ANIM_9, + /* 10 */ ENDNK_ANIM_10, + /* 11 */ ENDNK_ANIM_11, + /* 12 */ ENDNK_ANIM_12, + /* 13 */ ENDNK_ANIM_13, + /* 14 */ ENDNK_ANIM_14, + /* 15 */ ENDNK_ANIM_15, + /* 16 */ ENDNK_ANIM_16, + /* 17 */ ENDNK_ANIM_17, + /* 18 */ ENDNK_ANIM_18, + /* 19 */ ENDNK_ANIM_19, + /* 20 */ ENDNK_ANIM_20, + /* 21 */ ENDNK_ANIM_21, + /* 22 */ ENDNK_ANIM_22, + /* 23 */ ENDNK_ANIM_23, + /* 24 */ ENDNK_ANIM_24, + /* 25 */ ENDNK_ANIM_25, + /* 26 */ ENDNK_ANIM_26, + /* 27 */ ENDNK_ANIM_27, + /* 28 */ ENDNK_ANIM_28, + /* 29 */ ENDNK_ANIM_29, + /* 30 */ ENDNK_ANIM_30, + /* 31 */ ENDNK_ANIM_31, + /* 32 */ ENDNK_ANIM_32, + /* 33 */ ENDNK_ANIM_33, + /* 34 */ ENDNK_ANIM_34, + /* 35 */ ENDNK_ANIM_35, + /* 36 */ ENDNK_ANIM_MAX +} EnDnkAnimation; + +static AnimationInfoS sAnimationInfo[ENDNK_ANIM_MAX] = { + { &gDekuPalaceGuardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENDNK_ANIM_0 + { &gDekuPalaceGuardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_1 + { &gDekuPalaceGuardWaitAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_2 + { &gDekuPalaceGuardAttackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_3 + { &gDekuPalaceGuardDigAnim, 1.0f, -1, -1, ANIMMODE_ONCE, 0 }, // ENDNK_ANIM_4 + { &gDekuPalaceGuardDigAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_5 + { &gDekuPalaceGuardJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_6 + { &gDekuPalaceGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_7 + { &gDekuPalaceGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_8 + { &gDekuPalaceGuardHappyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_9 + { &object_hintnuts_Anim_000168, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_10 + { &object_hintnuts_Anim_0024CC, 1.0f, -1, -1, ANIMMODE_ONCE, 0 }, // ENDNK_ANIM_11 + { &object_hintnuts_Anim_0024CC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_12 + { &object_hintnuts_Anim_0026C4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_13 + { &object_hintnuts_Anim_002894, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_14 + { &object_hintnuts_Anim_002B90, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_15 + { &object_hintnuts_Anim_002F7C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_16 + { &object_hintnuts_Anim_002F7C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_17 + { &object_hintnuts_Anim_003128, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_18 + { &object_hintnuts_Anim_003128, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_19 + { &object_hintnuts_Anim_0029BC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_20 + { &object_hintnuts_Anim_002E84, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_21 + { &gDekuScrubSpitAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_22 + { &gDekuScrubDamageAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_23 + { &gDekuScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENDNK_ANIM_24 + { &gDekuScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_25 + { &gDekuScrubDieAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_26 + { &gDekuScrubUnburrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_27 + { &gDekuScrubLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_28 + { &gDekuScrubUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENDNK_ANIM_29 + { &gDekuScrubIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_30 + { &gDekuScrubIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_31 + { &gDekuScrubPantingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_32 + { &gDekuScrubRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_33 + { &gDekuScrubRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENDNK_ANIM_34 + { &gDekuScrubStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENDNK_ANIM_35 }; -s32 func_80A514F0(SkelAnime* skelAnime, s16 animIndex) { - s16 frame; - s16 frameCount; - s32 sp30 = false; +s32 EnDnk_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { + s16 startFrame; + s16 endFrame; + s32 didAnimChange = false; if (animIndex >= 0) { if (animIndex < ARRAY_COUNT(sAnimationInfo)) { - sp30 = true; - frameCount = sAnimationInfo[animIndex].frameCount; - if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + didAnimChange = true; + endFrame = sAnimationInfo[animIndex].frameCount; + if (endFrame < 0) { + endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } - frame = sAnimationInfo[animIndex].startFrame; - if (frame < 0) { - frame = frameCount; + startFrame = sAnimationInfo[animIndex].startFrame; + if (startFrame < 0) { + startFrame = endFrame; } - Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, frame, - frameCount, sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + startFrame, endFrame, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } } - return sp30; + return didAnimChange; } s32 func_80A515C4(EnDnk* this) { @@ -170,29 +209,29 @@ s32 func_80A515C4(EnDnk* this) { } void func_80A51648(EnDnk* this, PlayState* play) { - if (SubS_IsObjectLoaded(this->unk_28E, play) == true) { - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_28E].segment); + if (SubS_IsObjectLoaded(this->objectSlot, play) == true) { + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); this->actor.draw = func_80A52018; - this->actor.objBankIndex = this->unk_28E; + this->actor.objectSlot = this->objectSlot; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); switch (ENDNK_GET_3(&this->actor)) { case ENDNK_GET_3_0: SkelAnime_Init(play, &this->skelAnime, &gDekuPalaceGuardSkel, NULL, this->jointTable, this->morphTable, DEKU_PALACE_GUARD_LIMB_MAX); - func_80A514F0(&this->skelAnime, 7); + EnDnk_ChangeAnim(&this->skelAnime, ENDNK_ANIM_7); break; case ENDNK_GET_3_1: SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, NULL, this->jointTable, - this->morphTable, 10); - func_80A514F0(&this->skelAnime, 18); + this->morphTable, OBJECT_HINTNUTS_LIMB_MAX); + EnDnk_ChangeAnim(&this->skelAnime, ENDNK_ANIM_18); break; case ENDNK_GET_3_2: SkelAnime_Init(play, &this->skelAnime, &gDekuScrubSkel, NULL, this->jointTable, this->morphTable, DEKU_SCRUB_LIMB_MAX); - func_80A514F0(&this->skelAnime, 35); + EnDnk_ChangeAnim(&this->skelAnime, ENDNK_ANIM_35); break; } @@ -200,19 +239,19 @@ void func_80A51648(EnDnk* this, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (ENDNK_GET_3C(&this->actor) == 4) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); - this->actionFunc = func_80A51890; + this->actionFunc = EnDnk_HandleCutscene; Actor_SetScale(&this->actor, 0.1f); } else { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnDnk_DoNothing; Actor_SetScale(&this->actor, 0.01f); } } } -void func_80A51890(EnDnk* this, PlayState* play) { +void EnDnk_HandleCutscene(EnDnk* this, PlayState* play) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_126)) { Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_126)); } @@ -224,22 +263,23 @@ void EnDnk_DoNothing(EnDnk* this, PlayState* play) { void EnDnk_Init(Actor* thisx, PlayState* play) { EnDnk* this = THIS; - this->unk_28E = -1; + this->objectSlot = OBJECT_SLOT_NONE; + switch (ENDNK_GET_3(&this->actor)) { case ENDNK_GET_3_1: - this->unk_28E = SubS_GetObjectIndex(OBJECT_HINTNUTS, play); + this->objectSlot = SubS_GetObjectSlot(OBJECT_HINTNUTS, play); break; case ENDNK_GET_3_0: - this->unk_28E = SubS_GetObjectIndex(OBJECT_DNK, play); + this->objectSlot = SubS_GetObjectSlot(OBJECT_DNK, play); break; case ENDNK_GET_3_2: - this->unk_28E = SubS_GetObjectIndex(OBJECT_DEKUNUTS, play); + this->objectSlot = SubS_GetObjectSlot(OBJECT_DEKUNUTS, play); break; } - if (this->unk_28E >= 0) { + if (this->objectSlot > OBJECT_SLOT_NONE) { this->actionFunc = func_80A51648; } else { Actor_Kill(&this->actor); @@ -284,7 +324,7 @@ void func_80A51AA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto Vec3f sp44; Vec3s sp3C; - if (limbIndex == 2) { + if (limbIndex == DEKU_PALACE_GUARD_LIMB_HEAD) { Matrix_MultVec3f(&sp50, &sp44); Matrix_Get(&sp5C); Matrix_MtxFToYXZRot(&sp5C, &sp3C, false); @@ -360,7 +400,9 @@ void func_80A51DA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto Vec3f sp44; Vec3s sp3C; - if (limbIndex == 2) { + // Note: Also for `limbIndex == OBJECT_HINTNUTS_LIMB_02` + // Assumes `OBJECT_HINTNUTS_LIMB_02` is the same value as `DEKU_SCRUB_LIMB_HEAD` + if (limbIndex == DEKU_SCRUB_LIMB_HEAD) { Matrix_MultVec3f(&sp50, &sp44); Matrix_Get(&sp5C); Matrix_MtxFToYXZRot(&sp5C, &sp3C, false); @@ -419,17 +461,20 @@ void func_80A52018(Actor* thisx, PlayState* play) { case ENDNK_GET_3_2: func_80A51FC0(this, play); break; + + default: + break; } } void func_80A52074(EnDnk* this, PlayState* play) { switch (play->csCtx.curFrame) { case 80: - func_8019F128(NA_SE_EN_DEKNUTS_DANCE1); + Audio_PlaySfx_2(NA_SE_EN_DEKNUTS_DANCE1); break; case 123: - func_8019F128(NA_SE_EN_DEKNUTS_DANCE2); + Audio_PlaySfx_2(NA_SE_EN_DEKNUTS_DANCE2); break; case 438: @@ -439,10 +484,13 @@ void func_80A52074(EnDnk* this, PlayState* play) { case 493: Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); break; + + default: + break; } if ((play->csCtx.curFrame >= 198) && (play->csCtx.curFrame < 438)) { - func_8019F128(NA_SE_EN_DEKNUTS_DANCE - SFX_FLAG); + Audio_PlaySfx_2(NA_SE_EN_DEKNUTS_DANCE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h index 57467b3f1..8b0900ae7 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h @@ -2,6 +2,9 @@ #define Z_EN_DNK_H #include "global.h" +#include "objects/object_dnk/object_dnk.h" +#include "objects/object_hintnuts/object_hintnuts.h" +#include "objects/object_dekunuts/object_dekunuts.h" struct EnDnk; @@ -18,17 +21,19 @@ typedef enum { /* 4 */ ENDNK_GET_3_4 } EnDnkParam; +#define DNK_LIMB_MAX MAX(MAX((s32)DEKU_PALACE_GUARD_LIMB_MAX, (s32)OBJECT_HINTNUTS_LIMB_MAX), (s32)DEKU_SCRUB_LIMB_MAX) + typedef struct EnDnk { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnDnkActionFunc actionFunc; /* 0x18C */ UNK_TYPE1 unk_18C[0x4]; /* 0x190 */ ColliderCylinder collider; - /* 0x1DC */ Vec3s jointTable[11]; - /* 0x21E */ Vec3s morphTable[11]; - /* 0x260 */ Gfx* unk_260[11]; + /* 0x1DC */ Vec3s jointTable[DNK_LIMB_MAX]; + /* 0x21E */ Vec3s morphTable[DNK_LIMB_MAX]; + /* 0x260 */ Gfx* unk_260[DEKU_PALACE_GUARD_LIMB_MAX]; /* 0x28C */ u16 unk_28C; - /* 0x28E */ s8 unk_28E; + /* 0x28E */ s8 objectSlot; /* 0x290 */ s16 unk_290; /* 0x292 */ s16 unk_292; /* 0x294 */ s16 unk_294; 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 904a18e62..d32f2f3f4 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -12,7 +12,7 @@ #include "overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnDno*)thisx) @@ -44,6 +44,7 @@ s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); typedef enum { + /* -1 */ EN_DNO_ANIM_NONE = -1, /* 0 */ EN_DNO_ANIM_START_RACE_START, /* 1 */ EN_DNO_ANIM_START_RACE_END, /* 2 */ EN_DNO_ANIM_FLY, @@ -63,30 +64,31 @@ typedef enum { /* 16 */ EN_DNO_ANIM_IMPLORE_START, /* 17 */ EN_DNO_ANIM_SHOCK_START, /* 18 */ EN_DNO_ANIM_SHOCK_LOOP, - /* 19 */ EN_DNO_ANIM_GRIEVE + /* 19 */ EN_DNO_ANIM_GRIEVE, + /* 20 */ EN_DNO_ANIM_MAX } EnDnoAnimation; -static AnimationSpeedInfo sAnimations[] = { - { &gDekuButlerStartRaceStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerStartRaceEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerFlyAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerFarewellAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerGreetingAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerGreetingWithCandleAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerPrayerLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerCloseParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerOpenParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerImploreLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerImploreEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerTalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerTalkWithParasolAndCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerIdleWithCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerPrayerStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerImploreStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerShockStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &gDekuButlerShockLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &gDekuButlerGrieveAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, +static AnimationSpeedInfo sAnimationSpeedInfo[EN_DNO_ANIM_MAX] = { + { &gDekuButlerStartRaceStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_START_RACE_START + { &gDekuButlerStartRaceEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_START_RACE_END + { &gDekuButlerFlyAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_FLY + { &gDekuButlerFarewellAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_FAREWELL + { &gDekuButlerGreetingAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_GREETING + { &gDekuButlerGreetingWithCandleAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_GREETING_WITH_CANDLE + { &gDekuButlerPrayerLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_PRAYER_LOOP + { &gDekuButlerCloseParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_CLOSE_PARASOL + { &gDekuButlerOpenParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_OPEN_PARASOL + { &gDekuButlerImploreLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_IMPLORE_LOOP + { &gDekuButlerImploreEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_IMPLORE_END + { &gDekuButlerTalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_TALK + { &gDekuButlerTalkWithParasolAndCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_TALK_WITH_PARSOL_AND_CANDLE + { &gDekuButlerIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_IDLE + { &gDekuButlerIdleWithCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_IDLE_WITH_CANDLE + { &gDekuButlerPrayerStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_PRAYER_START + { &gDekuButlerImploreStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_IMPLORE_START + { &gDekuButlerShockStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, // EN_DNO_ANIM_SHOCK_START + { &gDekuButlerShockLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_SHOCK_LOOP + { &gDekuButlerGrieveAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, // EN_DNO_ANIM_GRIEVE }; ActorInit En_Dno_InitVars = { @@ -236,10 +238,10 @@ void EnDno_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); - Animation_Change(&this->skelAnime, sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation), - sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].mode, - sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].morphFrames); + Animation_Change(&this->skelAnime, sAnimationSpeedInfo[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationSpeedInfo[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation), + sAnimationSpeedInfo[EN_DNO_ANIM_IDLE_WITH_CANDLE].mode, + sAnimationSpeedInfo[EN_DNO_ANIM_IDLE_WITH_CANDLE].morphFrames); this->unk_3BE = 0x3E93; this->unk_3C0 = 60.0f; this->unk_3B0 = 0; @@ -252,8 +254,8 @@ void EnDno_Init(Actor* thisx, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_93_02)) { Actor_Kill(thisx); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IDLE_WITH_CANDLE, &this->animIndex); thisx->room = -1; gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); @@ -267,7 +269,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { Actor_Kill(thisx); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); this->unk_460 = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ); if (this->unk_460 == NULL) { @@ -296,7 +298,7 @@ void EnDno_Destroy(Actor* thisx, PlayState* play) { void func_80A71B04(EnDno* this, PlayState* play) { this->unk_452 = 0; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_GRIEVE, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_GRIEVE, &this->animIndex); this->actionFunc = EnDno_DoNothing; } @@ -309,15 +311,15 @@ void func_80A71B68(EnDno* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_27_01)) { if (!(this->unk_3B0 & 0x20)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_PRAYER_LOOP, &this->animIndex); this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, this->unk_460); } } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); } } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); } this->actionFunc = func_80A71C3C; } @@ -326,23 +328,26 @@ void func_80A71C3C(EnDno* this, PlayState* play) { switch (this->animIndex) { case EN_DNO_ANIM_IMPLORE_LOOP: case EN_DNO_ANIM_IMPLORE_START: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_END, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IMPLORE_END, + &this->animIndex); break; case EN_DNO_ANIM_FAREWELL: case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, + &this->animIndex); } break; case EN_DNO_ANIM_TALK: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_START, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_PRAYER_START, + &this->animIndex); break; case EN_DNO_ANIM_PRAYER_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_PRAYER_LOOP, &this->animIndex); } @@ -350,6 +355,9 @@ void func_80A71C3C(EnDno* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, this->unk_460), 2, 0xE38, 0x222); break; + + default: + break; } if ((this->animIndex == EN_DNO_ANIM_IDLE) && (this->actor.xzDistToPlayer <= 120.0f)) { @@ -364,11 +372,11 @@ void func_80A71C3C(EnDno* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; func_80A71E54(this, play); } else if (this->actor.xzDistToPlayer < 60.0f) { - func_800B8614(&this->actor, play, 60.0f); + Actor_OfferTalk(&this->actor, play, 60.0f); } } @@ -404,8 +412,8 @@ void func_80A71F18(EnDno* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xE38)) { switch (this->textId) { case 0x80B: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_START, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IMPLORE_START, &this->animIndex); case 0x811: Message_StartTextbox(play, this->textId, &this->actor); @@ -414,15 +422,18 @@ void func_80A71F18(EnDno* this, PlayState* play) { case 0x80C: case 0x80F: if (this->animIndex == EN_DNO_ANIM_IDLE) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_GREETING, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_GREETING, &this->animIndex); } else if ((this->animIndex == EN_DNO_ANIM_GREETING) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_TALK, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_TALK, &this->animIndex); Message_StartTextbox(play, this->textId, &this->actor); } break; + + default: + break; } } break; @@ -432,8 +443,8 @@ void func_80A71F18(EnDno* this, PlayState* play) { switch (this->animIndex) { case EN_DNO_ANIM_IMPLORE_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_LOOP, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IMPLORE_LOOP, &this->animIndex); } Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, this->unk_460), 0x71C); @@ -442,11 +453,14 @@ void func_80A71F18(EnDno* this, PlayState* play) { case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { Message_CloseTextbox(play); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); func_80A71B68(this, play); } break; + + default: + break; } } break; @@ -459,27 +473,30 @@ void func_80A71F18(EnDno* this, PlayState* play) { switch (this->animIndex) { case EN_DNO_ANIM_IMPLORE_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_LOOP, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IMPLORE_LOOP, &this->animIndex); } break; case EN_DNO_ANIM_IMPLORE_LOOP: if (Message_ShouldAdvance(play)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_END, - &this->animIndex); - play->msgCtx.msgMode = 0x44; + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IMPLORE_END, &this->animIndex); + play->msgCtx.msgMode = MSGMODE_PAUSED; } break; case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { Message_CloseTextbox(play); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); func_80A71B68(this, play); } break; + + default: + break; } break; @@ -497,11 +514,11 @@ void func_80A71F18(EnDno* this, PlayState* play) { case 0x80E: if (this->animIndex == EN_DNO_ANIM_TALK) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_FAREWELL, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_FAREWELL, &this->animIndex); } else if (this->animIndex == EN_DNO_ANIM_FAREWELL) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE, &this->animIndex); } } else if ((this->animIndex == EN_DNO_ANIM_IDLE) && Message_ShouldAdvance(play)) { @@ -526,16 +543,19 @@ void func_80A71F18(EnDno* this, PlayState* play) { switch (this->animIndex) { case EN_DNO_ANIM_TALK: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_START, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_PRAYER_START, &this->animIndex); break; case EN_DNO_ANIM_PRAYER_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_PRAYER_LOOP, &this->animIndex); } break; + + default: + break; } break; @@ -545,6 +565,9 @@ void func_80A71F18(EnDno* this, PlayState* play) { func_80A71B68(this, play); } break; + + default: + break; } break; } @@ -552,7 +575,8 @@ void func_80A71F18(EnDno* this, PlayState* play) { void func_80A72438(EnDno* this, PlayState* play) { this->unk_452 = 1; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE_WITH_CANDLE, + &this->animIndex); this->actor.textId = 0; if (Flags_GetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor))) { this->unk_454 = 1.0f; @@ -568,12 +592,13 @@ void func_80A724B8(EnDno* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80A725E0(this, play); } else if (this->actor.xzDistToPlayer < 60.0f) { - func_800B8614(&this->actor, play, 60.0f); + Actor_OfferTalk(&this->actor, play, 60.0f); } } void func_80A7256C(EnDno* this, PlayState* play) { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_MINUS1); } void func_80A72598(EnDno* this, PlayState* play) { @@ -598,7 +623,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 0: if (this->animIndex == EN_DNO_ANIM_IDLE_WITH_CANDLE) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_GREETING_WITH_CANDLE, &this->animIndex); } } else if ((this->animIndex == EN_DNO_ANIM_GREETING_WITH_CANDLE) && @@ -610,8 +635,8 @@ void func_80A725F8(EnDno* this, PlayState* play) { } else { Message_StartTextbox(play, 0x800, &this->actor); } - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, - &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + EN_DNO_ANIM_IDLE_WITH_CANDLE, &this->animIndex); } break; @@ -625,6 +650,9 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 3: Message_StartTextbox(play, 0x804, &this->actor); break; + + default: + break; } break; @@ -646,7 +674,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_TALK_WITH_PARSOL_AND_CANDLE, &this->animIndex); Message_StartTextbox(play, 0x803, &this->actor); } @@ -660,10 +688,10 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 0x800: case 0x801: if (Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = MSGMODE_PAUSED; this->unk_452 = 1; this->unk_454 = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_OPEN_PARASOL, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_OPEN_PARASOL, &this->animIndex); } break; @@ -690,7 +718,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 0x804: if (this->animIndex == EN_DNO_ANIM_IDLE_WITH_CANDLE) { if (Message_ShouldAdvance(play)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_GREETING_WITH_CANDLE, &this->animIndex); if (!(this->unk_3B0 & 0x40)) { func_80A72CF8(this, play); @@ -719,7 +747,8 @@ void func_80A725F8(EnDno* this, PlayState* play) { } void func_80A72AE4(EnDno* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_START_RACE_START, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_START_RACE_START, + &this->animIndex); func_80A714B4(this, play); this->actionFunc = func_80A72B3C; } @@ -746,9 +775,10 @@ void func_80A72BA4(EnDno* this, PlayState* play) { } void func_80A72C04(EnDno* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_START_RACE_START, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_START_RACE_START, + &this->animIndex); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); Math_Vec3f_Copy(&this->unk_334, &this->actor.world.pos); SubS_ActorPathing_Init(play, &this->unk_334, &this->actor, &this->actorPath, play->setupPathList, EN_DNO_GET_7F(&this->actor), 1, 0, 1, 0); @@ -825,26 +855,29 @@ s32 EnDno_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { } void func_80A730A0(EnDno* this, PlayState* play) { - s32 phi_a2; + s32 nextAnimIndex; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - phi_a2 = -1; + nextAnimIndex = EN_DNO_ANIM_NONE; switch (this->animIndex) { case EN_DNO_ANIM_START_RACE_START: if (this->unk_44E >= 20) { - phi_a2 = EN_DNO_ANIM_START_RACE_END; + nextAnimIndex = EN_DNO_ANIM_START_RACE_END; } else { this->unk_44E = 20; } break; case EN_DNO_ANIM_START_RACE_END: - phi_a2 = EN_DNO_ANIM_FLY; + nextAnimIndex = EN_DNO_ANIM_FLY; + break; + + default: break; } - if (phi_a2 >= 0) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->animIndex); + if (nextAnimIndex > EN_DNO_ANIM_NONE) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, nextAnimIndex, &this->animIndex); } } @@ -861,7 +894,7 @@ void func_80A730A0(EnDno* this, PlayState* play) { this->unk_3AE += 1000; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; func_80A715DC(this, play); - func_800B9010(&this->actor, NA_SE_EV_BUTLER_FRY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_BUTLER_FRY - SFX_FLAG); if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_PERMANENT) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actorPath.curPoint); this->actor.speed = 0.0f; @@ -874,7 +907,7 @@ void func_80A730A0(EnDno* this, PlayState* play) { void func_80A73244(EnDno* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->unk_328 = 2; this->actor.speed = 0.0f; Flags_UnsetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor)); @@ -890,11 +923,12 @@ void func_80A732C8(EnDno* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C)) { this->unk_3B0 |= 4; this->unk_44E = 3; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_CLOSE_PARASOL, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_CLOSE_PARASOL, + &this->animIndex); } } else if (this->unk_44E == 3) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_IDLE_WITH_CANDLE, &this->animIndex); func_80A72438(this, play); } else { @@ -914,8 +948,8 @@ void func_80A732C8(EnDno* this, PlayState* play) { } void func_80A73408(EnDno* this, PlayState* play) { - s32 phi_a2; - u8 sp33 = true; + s32 nextAnimIndex; + u8 changeAnim = true; s32 cueChannel; if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_475)) { @@ -923,32 +957,36 @@ void func_80A73408(EnDno* this, PlayState* play) { if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - phi_a2 = 13; + nextAnimIndex = EN_DNO_ANIM_IDLE; break; case 2: - phi_a2 = 17; + nextAnimIndex = EN_DNO_ANIM_SHOCK_START; break; default: - phi_a2 = 0; - sp33 = false; + nextAnimIndex = EN_DNO_ANIM_START_RACE_START; + changeAnim = false; break; } - if (sp33) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->animIndex); + if (changeAnim) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, nextAnimIndex, &this->animIndex); } } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } - if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && - (this->animIndex == EN_DNO_ANIM_SHOCK_START)) { - //! FAKE: - if (1) {} + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + switch (this->animIndex) { + case EN_DNO_ANIM_SHOCK_START: + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, EN_DNO_ANIM_SHOCK_LOOP, + &this->animIndex); + break; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_SHOCK_LOOP, &this->animIndex); + default: + break; + } } } @@ -978,7 +1016,7 @@ s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p EnDno* this = THIS; *dList = NULL; - if (limbIndex == 9) { + if (limbIndex == DEKU_BUTLER_LIMB_EYES) { rot->x += this->unk_466; } return false; @@ -996,36 +1034,47 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (*dList != NULL) { switch (this->unk_452) { case 0: - if ((limbIndex != 25) && (limbIndex != 26) && (limbIndex != 13) && (limbIndex != 15) && - (limbIndex != 16) && (limbIndex != 14)) { + if ((limbIndex != DEKU_BUTLER_LIMB_CANDLE) && (limbIndex != DEKU_BUTLER_LIMB_CANDLE_WICK) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_HANDLE) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_LOWER_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_MIDDLE_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_UPPER_PETALS)) { phi_v0 = true; } break; case 1: - if ((limbIndex != 26) && (limbIndex != 13) && (limbIndex != 15) && (limbIndex != 16) && - (limbIndex != 14)) { + if ((limbIndex != DEKU_BUTLER_LIMB_CANDLE_WICK) && (limbIndex != DEKU_BUTLER_LIMB_PARASOL_HANDLE) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_LOWER_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_MIDDLE_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_UPPER_PETALS)) { phi_v0 = true; } break; case 2: - if ((limbIndex != 15) && (limbIndex != 16)) { + if ((limbIndex != DEKU_BUTLER_LIMB_PARASOL_LOWER_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_MIDDLE_PETALS)) { phi_v0 = true; } break; case 3: - if ((limbIndex != 16) && (limbIndex != 14)) { + if ((limbIndex != DEKU_BUTLER_LIMB_PARASOL_MIDDLE_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_UPPER_PETALS)) { phi_v0 = true; } break; case 4: - if ((limbIndex != 15) && (limbIndex != 14)) { + if ((limbIndex != DEKU_BUTLER_LIMB_PARASOL_LOWER_PETALS) && + (limbIndex != DEKU_BUTLER_LIMB_PARASOL_UPPER_PETALS)) { phi_v0 = true; } break; + + default: + break; } } @@ -1033,7 +1082,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - if (limbIndex == 13) { + if (limbIndex == DEKU_BUTLER_LIMB_PARASOL_HANDLE) { Matrix_Scale(this->unk_454, this->unk_454, this->unk_454, MTXMODE_APPLY); Matrix_RotateXS(this->unk_45C, MTXMODE_APPLY); } @@ -1046,7 +1095,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, CLOSE_DISPS(play->state.gfxCtx); } - if ((this->unk_3B0 & 1) && (limbIndex == 26)) { + if ((this->unk_3B0 & 1) && (limbIndex == DEKU_BUTLER_LIMB_CANDLE_WICK)) { u32 frames; OPEN_DISPS(play->state.gfxCtx); 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 1dd5dac34..2518cbc47 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -9,7 +9,7 @@ #include "z_en_dnp.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnDnp*)thisx) @@ -25,11 +25,11 @@ void func_80B3D3F8(EnDnp* this, PlayState* play); void func_80B3D558(EnDnp* this, PlayState* play); typedef enum { - /* 0 */ EN_DNP_EYE_OPEN, - /* 1 */ EN_DNP_EYE_HALF, - /* 2 */ EN_DNP_EYE_CLOSED, - /* 3 */ EN_DNP_EYE_ANGRY, - /* 4 */ EN_DNP_EYE_MAX + /* 0 */ DEKU_PRINCESS_EYE_OPEN, + /* 1 */ DEKU_PRINCESS_EYE_HALF, + /* 2 */ DEKU_PRINCESS_EYE_CLOSED, + /* 3 */ DEKU_PRINCESS_EYE_ANGRY, + /* 4 */ DEKU_PRINCESS_EYE_MAX } EnDnpEyeIndex; ActorInit En_Dnp_InitVars = { @@ -67,62 +67,63 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum { - /* -1 */ EN_DNP_ANIM_NONE = -1, - /* 0 */ EN_DNP_ANIM_JUMP_KICK, // Can be triggered by a cutscene, but no cutscene in the final game does so - /* 1 */ EN_DNP_ANIM_HURRY, - /* 2 */ EN_DNP_ANIM_CUTSCENE_HURRY, - /* 3 */ EN_DNP_ANIM_HURRY_END, - /* 4 */ EN_DNP_ANIM_SCOLD, // Unused - /* 5 */ EN_DNP_ANIM_LAUGH_START, - /* 6 */ EN_DNP_ANIM_LAUGH_LOOP, - /* 7 */ EN_DNP_ANIM_TURN_AROUND, - /* 8 */ EN_DNP_ANIM_BOW, - /* 9 */ EN_DNP_ANIM_RUN, // Unused - /* 10 */ EN_DNP_ANIM_THINK_START, - /* 11 */ EN_DNP_ANIM_THINK_LOOP, - /* 12 */ EN_DNP_ANIM_ARMS_TOGETHER_START, - /* 13 */ EN_DNP_ANIM_ARMS_TOGETHER_LOOP, - /* 14 */ EN_DNP_ANIM_GREETING, - /* 15 */ EN_DNP_ANIM_IDLE, - /* 16 */ EN_DNP_ANIM_CUTSCENE_IDLE, - /* 17 */ EN_DNP_ANIM_UNUSED_WALK, // Unused - /* 18 */ EN_DNP_ANIM_WALK, // Can be triggered by a cutscene, but no cutscene in the final game does so - /* 19 */ EN_DNP_ANIM_ANGRY_START, - /* 20 */ EN_DNP_ANIM_ANGRY_LOOP, - /* 21 */ EN_DNP_ANIM_JUMP, - /* 22 */ EN_DNP_ANIM_BOUNCE_START, - /* 23 */ EN_DNP_ANIM_BOUNCE_LOOP, - /* 24 */ EN_DNP_ANIM_GLARE_START, - /* 25 */ EN_DNP_ANIM_GLARE_LOOP -} EnDnpAnimation; + /* -1 */ DEKU_PRINCESS_ANIM_NONE = -1, + /* 0 */ DEKU_PRINCESS_ANIM_JUMP_KICK, // Can be triggered by a cutscene, but no cutscene in the final game does so + /* 1 */ DEKU_PRINCESS_ANIM_HURRY, + /* 2 */ DEKU_PRINCESS_ANIM_CUTSCENE_HURRY, + /* 3 */ DEKU_PRINCESS_ANIM_HURRY_END, + /* 4 */ DEKU_PRINCESS_ANIM_SCOLD, // Unused + /* 5 */ DEKU_PRINCESS_ANIM_LAUGH_START, + /* 6 */ DEKU_PRINCESS_ANIM_LAUGH_LOOP, + /* 7 */ DEKU_PRINCESS_ANIM_TURN_AROUND, + /* 8 */ DEKU_PRINCESS_ANIM_BOW, + /* 9 */ DEKU_PRINCESS_ANIM_RUN, // Unused + /* 10 */ DEKU_PRINCESS_ANIM_THINK_START, + /* 11 */ DEKU_PRINCESS_ANIM_THINK_LOOP, + /* 12 */ DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START, + /* 13 */ DEKU_PRINCESS_ANIM_ARMS_TOGETHER_LOOP, + /* 14 */ DEKU_PRINCESS_ANIM_GREETING, + /* 15 */ DEKU_PRINCESS_ANIM_IDLE, + /* 16 */ DEKU_PRINCESS_ANIM_CUTSCENE_IDLE, + /* 17 */ DEKU_PRINCESS_ANIM_UNUSED_WALK, // Unused + /* 18 */ DEKU_PRINCESS_ANIM_WALK, // Can be triggered by a cutscene, but no cutscene in the final game does so + /* 19 */ DEKU_PRINCESS_ANIM_ANGRY_START, + /* 20 */ DEKU_PRINCESS_ANIM_ANGRY_LOOP, + /* 21 */ DEKU_PRINCESS_ANIM_JUMP, + /* 22 */ DEKU_PRINCESS_ANIM_BOUNCE_START, + /* 23 */ DEKU_PRINCESS_ANIM_BOUNCE_LOOP, + /* 24 */ DEKU_PRINCESS_ANIM_GLARE_START, + /* 25 */ DEKU_PRINCESS_ANIM_GLARE_LOOP, + /* 26 */ DEKU_PRINCESS_ANIM_MAX +} DekuPrincessAnimation; -static AnimationInfoS sAnimationInfo[] = { - { &gDekuPrincessJumpKickAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessHurryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuPrincessHurryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessHurryEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessScoldAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessLaughStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessLaughLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuPrincessBowAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessThinkStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessThinkLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessArmsTogetherStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessArmsTogetherLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessGreetingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuPrincessIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuPrincessAngryStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessAngryLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuPrincessBounceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuPrincessBounceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuPrincessGlareStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuPrincessGlareLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +static AnimationInfoS sAnimationInfo[DEKU_PRINCESS_ANIM_MAX] = { + { &gDekuPrincessJumpKickAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_JUMP_KICK + { &gDekuPrincessHurryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DEKU_PRINCESS_ANIM_HURRY + { &gDekuPrincessHurryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_CUTSCENE_HURRY + { &gDekuPrincessHurryEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_HURRY_END + { &gDekuPrincessScoldAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_SCOLD + { &gDekuPrincessLaughStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_LAUGH_START + { &gDekuPrincessLaughLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_LAUGH_LOOP + { &gDekuPrincessTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_PRINCESS_ANIM_TURN_AROUND + { &gDekuPrincessBowAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_BOW + { &gDekuPrincessRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_RUN + { &gDekuPrincessThinkStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_THINK_START + { &gDekuPrincessThinkLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_THINK_LOOP + { &gDekuPrincessArmsTogetherStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START + { &gDekuPrincessArmsTogetherLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_ARMS_TOGETHER_LOOP + { &gDekuPrincessGreetingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_GREETING + { &gDekuPrincessIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DEKU_PRINCESS_ANIM_IDLE + { &gDekuPrincessIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_CUTSCENE_IDLE + { &gDekuPrincessWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_UNUSED_WALK + { &gDekuPrincessWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DEKU_PRINCESS_ANIM_WALK + { &gDekuPrincessAngryStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_ANGRY_START + { &gDekuPrincessAngryLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_ANGRY_LOOP + { &gDekuPrincessJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_PRINCESS_ANIM_JUMP + { &gDekuPrincessBounceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_PRINCESS_ANIM_BOUNCE_START + { &gDekuPrincessBounceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_BOUNCE_LOOP + { &gDekuPrincessGlareStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_PRINCESS_ANIM_GLARE_START + { &gDekuPrincessGlareLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_PRINCESS_ANIM_GLARE_LOOP }; static s32 D_80B3DE58[] = { @@ -130,39 +131,40 @@ static s32 D_80B3DE58[] = { }; s32 func_80B3CA20(EnDnp* this) { - if ((this->animIndex == EN_DNP_ANIM_CUTSCENE_HURRY) || (this->animIndex == EN_DNP_ANIM_RUN)) { + if ((this->animIndex == DEKU_PRINCESS_ANIM_CUTSCENE_HURRY) || (this->animIndex == DEKU_PRINCESS_ANIM_RUN)) { if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } - } else if ((this->animIndex == EN_DNP_ANIM_GLARE_START) || (this->animIndex == EN_DNP_ANIM_TURN_AROUND)) { + } else if ((this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_TURN_AROUND)) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } - } else if (this->animIndex == EN_DNP_ANIM_GREETING) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_GREETING) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } - } else if (this->animIndex == EN_DNP_ANIM_BOW) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_BOW) { if (Animation_OnFrame(&this->skelAnime, 9.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } - } else if ((this->animIndex == EN_DNP_ANIM_UNUSED_WALK) && (this->animIndex == EN_DNP_ANIM_WALK)) { + } else if ((this->animIndex == DEKU_PRINCESS_ANIM_UNUSED_WALK) && (this->animIndex == DEKU_PRINCESS_ANIM_WALK)) { //! @bug: Impossible to reach, && should be an || if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } - } else if (this->animIndex == EN_DNP_ANIM_JUMP) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_JUMP) { if (Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } - } else if (this->animIndex == EN_DNP_ANIM_BOUNCE_LOOP) { + } else if (this->animIndex == DEKU_PRINCESS_ANIM_BOUNCE_LOOP) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } @@ -172,14 +174,14 @@ s32 func_80B3CA20(EnDnp* this) { } s32 EnDnp_ChangeAnim(EnDnp* this, s32 animIndex) { - s32 ret = false; + s32 didAnimChange = false; - if (animIndex != this->animIndex) { + if (this->animIndex != animIndex) { this->animIndex = animIndex; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); } - return ret; + return didAnimChange; } void func_80B3CC80(EnDnp* this, PlayState* play) { @@ -194,9 +196,9 @@ void func_80B3CC80(EnDnp* this, PlayState* play) { void func_80B3CD1C(EnDnp* this) { if ((this->unk_322 & 0x80) && (DECR(this->blinkTimer) == 0)) { this->eyeIndex++; - if (this->eyeIndex >= EN_DNP_EYE_MAX) { + if (this->eyeIndex >= DEKU_PRINCESS_EYE_MAX) { this->blinkTimer = Rand_S16Offset(30, 30); - this->eyeIndex = EN_DNP_EYE_OPEN; + this->eyeIndex = DEKU_PRINCESS_EYE_OPEN; } } } @@ -245,13 +247,14 @@ s32 func_80B3CEC0(EnDnp* this, PlayState* play) { s32 func_80B3CF60(EnDnp* this, PlayState* play) { s32 ret = false; - if ((this->unk_322 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_322, 0, 7); + if (((this->unk_322 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_322 |= 8; this->actionFunc = func_80B3D3F8; ret = true; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) && Actor_HasParent(&this->actor, play)) { - SubS_UpdateFlags(&this->unk_322, 0, 7); + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_322 &= ~0x500; this->actor.parent = NULL; this->unk_32E = 0; @@ -268,15 +271,15 @@ s32 func_80B3D044(EnDnp* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_322 & 0x200)) { this->unk_322 |= (0x200 | 0x10); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->cueId = 255; } - SubS_UpdateFlags(&this->unk_322, 0, 7); + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->actionFunc = func_80B3D11C; ret = true; } else if (this->unk_322 & 0x200) { - this->actor.flags |= ACTOR_FLAG_1; - SubS_UpdateFlags(&this->unk_322, 3, 7); + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_322 &= ~(0x200 | 0x10); this->actionFunc = func_80B3D2D4; } @@ -285,12 +288,12 @@ s32 func_80B3D044(EnDnp* this, PlayState* play) { } void func_80B3D11C(EnDnp* this, PlayState* play) { - static s32 sCsAnimations[] = { - EN_DNP_ANIM_JUMP_KICK, EN_DNP_ANIM_CUTSCENE_IDLE, EN_DNP_ANIM_GREETING, - EN_DNP_ANIM_THINK_START, EN_DNP_ANIM_WALK, EN_DNP_ANIM_ARMS_TOGETHER_START, - EN_DNP_ANIM_LAUGH_START, EN_DNP_ANIM_TURN_AROUND, EN_DNP_ANIM_CUTSCENE_HURRY, - EN_DNP_ANIM_ANGRY_START, EN_DNP_ANIM_JUMP, EN_DNP_ANIM_BOUNCE_START, - EN_DNP_ANIM_GLARE_START, EN_DNP_ANIM_BOW, + static s32 sCsAnimIndex[] = { + DEKU_PRINCESS_ANIM_JUMP_KICK, DEKU_PRINCESS_ANIM_CUTSCENE_IDLE, DEKU_PRINCESS_ANIM_GREETING, + DEKU_PRINCESS_ANIM_THINK_START, DEKU_PRINCESS_ANIM_WALK, DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START, + DEKU_PRINCESS_ANIM_LAUGH_START, DEKU_PRINCESS_ANIM_TURN_AROUND, DEKU_PRINCESS_ANIM_CUTSCENE_HURRY, + DEKU_PRINCESS_ANIM_ANGRY_START, DEKU_PRINCESS_ANIM_JUMP, DEKU_PRINCESS_ANIM_BOUNCE_START, + DEKU_PRINCESS_ANIM_GLARE_START, DEKU_PRINCESS_ANIM_BOW, }; s32 cueChannel; s32 cueId; @@ -304,28 +307,31 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_101); cueId = play->csCtx.actorCues[cueChannel]->id; if (this->cueId != (u8)cueId) { - EnDnp_ChangeAnim(this, sCsAnimations[cueId]); - if (this->animIndex == EN_DNP_ANIM_CUTSCENE_IDLE) { + EnDnp_ChangeAnim(this, sCsAnimIndex[cueId]); + if (this->animIndex == DEKU_PRINCESS_ANIM_CUTSCENE_IDLE) { this->unk_322 |= 8; } else { this->unk_322 &= ~8; } - if (this->animIndex == EN_DNP_ANIM_ANGRY_START) { + if (this->animIndex == DEKU_PRINCESS_ANIM_ANGRY_START) { Actor_PlaySfx(&this->actor, NA_SE_VO_DHVO04); } - if (this->animIndex == EN_DNP_ANIM_GLARE_START) { + if (this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START) { this->unk_322 &= ~0x80; - this->eyeIndex = EN_DNP_EYE_ANGRY; + this->eyeIndex = DEKU_PRINCESS_EYE_ANGRY; this->blinkTimer = 0; } } this->cueId = cueId; - if (((this->animIndex == EN_DNP_ANIM_THINK_START) || (this->animIndex == EN_DNP_ANIM_ARMS_TOGETHER_START) || - (this->animIndex == EN_DNP_ANIM_LAUGH_START) || (this->animIndex == EN_DNP_ANIM_ANGRY_START) || - (this->animIndex == EN_DNP_ANIM_BOUNCE_START) || (this->animIndex == EN_DNP_ANIM_GLARE_START)) && + if (((this->animIndex == DEKU_PRINCESS_ANIM_THINK_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_ARMS_TOGETHER_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_LAUGH_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_ANGRY_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_BOUNCE_START) || + (this->animIndex == DEKU_PRINCESS_ANIM_GLARE_START)) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnDnp_ChangeAnim(this, this->animIndex + 1); } @@ -355,14 +361,14 @@ 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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 9999.9f, 9999.9f, PLAYER_IA_MINUS1); } } } void func_80B3D3F8(EnDnp* this, PlayState* play) { if (func_8010BF58(&this->actor, play, D_80B3DE58, NULL, &this->unk_328)) { - SubS_UpdateFlags(&this->unk_322, 3, 7); + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_322 &= ~8; this->actionFunc = func_80B3D2D4; } else { @@ -374,8 +380,8 @@ void func_80B3D47C(EnDnp* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.scale.x, 0.0085f, 0.1f, 0.01f, 0.001f); if ((s32)(this->actor.scale.x * 10000.0f) >= 85) { - this->actor.flags |= ACTOR_FLAG_1; - SubS_UpdateFlags(&this->unk_322, 3, 7); + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_322 &= ~0x10; this->unk_322 |= 0x400; this->actor.scale.x = 0.0085f; @@ -400,32 +406,32 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 16.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gDekuPrincessSkel, NULL, this->jointTable, this->morphTable, DEKU_PRINCESS_LIMB_MAX); - this->animIndex = EN_DNP_ANIM_NONE; - EnDnp_ChangeAnim(this, EN_DNP_ANIM_IDLE); + this->animIndex = DEKU_PRINCESS_ANIM_NONE; + EnDnp_ChangeAnim(this, DEKU_PRINCESS_ANIM_IDLE); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->unk_322 = 0; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->unk_322 |= (0x100 | 0x80 | 0x10); this->actor.gravity = -1.0f; - if (EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_RELEASED_FROM_BOTTLE) { - this->actor.flags &= ~ACTOR_FLAG_1; - Actor_SetScale(&this->actor, 0.00085000007f); - SubS_UpdateFlags(&this->unk_322, 0, 7); + if (DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE) { + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + Actor_SetScale(&this->actor, 0.85f * 0.001f); + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.csId = 16; this->actionFunc = func_80B3D47C; - } else if (((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_WOODFALL_TEMPLE) && + } else if (((DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_WOODFALL_TEMPLE) && !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) || - ((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_DEKU_KINGS_CHAMBER) && + ((DEKU_PRINCESS_GET_TYPE(&this->actor) == DEKU_PRINCESS_TYPE_DEKU_KINGS_CHAMBER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20))) { Actor_SetScale(&this->actor, 0.0085f); - SubS_UpdateFlags(&this->unk_322, 3, 7); + SubS_SetOfferMode(&this->unk_322, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_322 |= 0x400; if ((play->sceneId == SCENE_MITURIN) && CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40)) { this->unk_322 |= 0x20; - EnDnp_ChangeAnim(this, EN_DNP_ANIM_HURRY); + EnDnp_ChangeAnim(this, DEKU_PRINCESS_ANIM_HURRY); } this->actionFunc = func_80B3D2D4; } else { @@ -462,7 +468,7 @@ void EnDnp_Update(Actor* thisx, PlayState* play) { if ((this->unk_322 & 0x400) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { Actor_OfferGetItem(&this->actor, play, GI_MAX, sp2C, sp28); } - func_8013C964(&this->actor, play, sp2C, sp28, PLAYER_IA_NONE, this->unk_322 & 7); + SubS_Offer(&this->actor, play, sp2C, sp28, PLAYER_IA_NONE, this->unk_322 & SUBS_OFFER_MODE_MASK); Actor_SetFocus(&this->actor, 30.0f); func_80B3CC80(this, play); } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h index 9b02f19d3..4bd0fe14c 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h @@ -8,12 +8,14 @@ struct EnDnp; typedef void (*EnDnpActionFunc)(struct EnDnp*, PlayState*); -#define EN_DNP_GET_TYPE(thisx) ((thisx)->params & 7) +#define DEKU_PRINCESS_GET_TYPE(thisx) ((thisx)->params & 7) + +#define DEKU_PRINCESS_PARAMS(type) ((type) & 7) typedef enum { - /* 0 */ EN_DNP_TYPE_WOODFALL_TEMPLE, - /* 1 */ EN_DNP_TYPE_RELEASED_FROM_BOTTLE, - /* 2 */ EN_DNP_TYPE_DEKU_KINGS_CHAMBER + /* 0 */ DEKU_PRINCESS_TYPE_WOODFALL_TEMPLE, + /* 1 */ DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE, + /* 2 */ DEKU_PRINCESS_TYPE_DEKU_KINGS_CHAMBER } EnDnpType; typedef struct EnDnp { 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 667f1eafb..cd25a835b 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -9,7 +9,7 @@ #include "z_en_dnq.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDnq*)thisx) @@ -59,27 +59,52 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimationInfo[] = { - { &gDekuKingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gDekuKingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingSurpriseAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingJumpedOnStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuKingJumpedOnLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingJumpedOnEndAnim, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuKingJumpedOnEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingLyingDownTwitchAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingWailLoopAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingFootStampStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingFootStampLoopAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingWailStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingMarchAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuKingSpinScepterAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDekuKingIntimidateAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingPointScepterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingJumpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingLaughAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gDekuKingFootStampLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gDekuKingLaughAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +typedef enum { + /* -1 */ DEKU_KING_ANIM_NONE = -1, + /* 0 */ DEKU_KING_ANIM_IDLE, + /* 1 */ DEKU_KING_ANIM_IDLE_MORPH, + /* 2 */ DEKU_KING_ANIM_SURPRISE, + /* 3 */ DEKU_KING_ANIM_JUMPED_ON_START, + /* 4 */ DEKU_KING_ANIM_JUMPED_ON_LOOP, + /* 5 */ DEKU_KING_ANIM_JUMPED_ON_END, + /* 6 */ DEKU_KING_ANIM_JUMPED_ON_END_MORPH, + /* 7 */ DEKU_KING_ANIM_LYING_DOWN_TWITCH, + /* 8 */ DEKU_KING_ANIM_WAIL, + /* 9 */ DEKU_KING_ANIM_FOOT_STAMP_START, + /* 10 */ DEKU_KING_ANIM_FOOT_STAMP_ONCE, + /* 11 */ DEKU_KING_ANIM_WAIL_START, + /* 12 */ DEKU_KING_ANIM_MARCH, + /* 13 */ DEKU_KING_ANIM_SPIN_SCEPTER, + /* 14 */ DEKU_KING_ANIM_INTIMIDATE, + /* 15 */ DEKU_KING_ANIM_POINT_SCEPTER, + /* 16 */ DEKU_KING_ANIM_JUMP, + /* 17 */ DEKU_KING_ANIM_LAUGH_ONCE, + /* 18 */ DEKU_KING_ANIM_FOOT_STAMP_LOOP, + /* 19 */ DEKU_KING_ANIM_LAUGH_LOOP, + /* 36 */ ENDNQ_ANIM_MAX +} EnDnkAnimation; + +static AnimationInfoS sAnimationInfo[ENDNQ_ANIM_MAX] = { + { &gDekuKingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // DEKU_KING_ANIM_IDLE + { &gDekuKingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_IDLE_MORPH + { &gDekuKingSurpriseAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_SURPRISE + { &gDekuKingJumpedOnStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_KING_ANIM_JUMPED_ON_START + { &gDekuKingJumpedOnLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_JUMPED_ON_LOOP + { &gDekuKingJumpedOnEndAnim, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_KING_ANIM_JUMPED_ON_END + { &gDekuKingJumpedOnEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_JUMPED_ON_END_MORPH + { &gDekuKingLyingDownTwitchAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_LYING_DOWN_TWITCH + { &gDekuKingWailLoopAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_WAIL + { &gDekuKingFootStampStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_FOOT_STAMP_START + { &gDekuKingFootStampLoopAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_FOOT_STAMP_ONCE + { &gDekuKingWailStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_WAIL_START + { &gDekuKingMarchAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_KING_ANIM_MARCH + { &gDekuKingSpinScepterAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // DEKU_KING_ANIM_SPIN_SCEPTER + { &gDekuKingIntimidateAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_INTIMIDATE + { &gDekuKingPointScepterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_POINT_SCEPTER + { &gDekuKingJumpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_JUMP + { &gDekuKingLaughAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // DEKU_KING_ANIM_LAUGH_ONCE + { &gDekuKingFootStampLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_FOOT_STAMP_LOOP + { &gDekuKingLaughAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // DEKU_KING_ANIM_LAUGH_LOOP }; s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) { @@ -87,30 +112,30 @@ s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) { 480.0f, 0x38E3); } -s32 func_80A5257C(EnDnq* this, s32 arg1) { - s32 phi_v1 = false; - s32 ret = false; +s32 EnDnq_ChangeAnim(EnDnq* this, s32 animIndex) { + s32 changeAnim = false; + s32 didAnimChange = false; - if ((arg1 == 0) || (arg1 == 1)) { - switch (this->unk_398) { - case 0: - case 1: + if ((animIndex == DEKU_KING_ANIM_IDLE) || (animIndex == DEKU_KING_ANIM_IDLE_MORPH)) { + switch (this->animIndex) { + case DEKU_KING_ANIM_IDLE: + case DEKU_KING_ANIM_IDLE_MORPH: break; default: - phi_v1 = true; + changeAnim = true; break; } - } else if (arg1 != this->unk_398) { - phi_v1 = true; + } else if (this->animIndex != animIndex) { + changeAnim = true; } - if (phi_v1) { - this->unk_398 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); + if (changeAnim) { + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); } - return ret; + return didAnimChange; } void func_80A52604(EnDnq* this, PlayState* play) { @@ -123,18 +148,18 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_37C & 0x20)) { - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->cueId = 255; this->unk_37C |= 0x20; } - SubS_UpdateFlags(&this->unk_37C, 0, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); ret = true; } else { if (this->unk_37C & 0x20) { - this->picto.actor.flags |= ACTOR_FLAG_1; + this->picto.actor.flags |= ACTOR_FLAG_TARGETABLE; this->cueId = 255; this->unk_37C &= ~0x20; - SubS_UpdateFlags(&this->unk_37C, 3, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } } @@ -143,45 +168,48 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { s32 func_80A526F8(EnDnq* this) { if (this->unk_386 == 0) { - func_80A5257C(this, 8); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_WAIL); this->unk_38C = ((s32)(Rand_ZeroOne() * 100.0f) % 4) + 3; this->unk_388 = 0; this->unk_386 = 1; } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - switch (this->unk_398) { - case 8: + switch (this->animIndex) { + case DEKU_KING_ANIM_WAIL: if (DECR(this->unk_38C) == 0) { - func_80A5257C(this, 9); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_FOOT_STAMP_START); } break; - case 9: - func_80A5257C(this, 10); + case DEKU_KING_ANIM_FOOT_STAMP_START: + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_FOOT_STAMP_ONCE); this->unk_38C = ((s32)(Rand_ZeroOne() * 100.0f) % 3) + 2; break; - case 10: + case DEKU_KING_ANIM_FOOT_STAMP_ONCE: if (DECR(this->unk_38C) == 0) { this->unk_388++; if ((this->unk_38C != 0) || (this->unk_388 < 2)) { - func_80A5257C(this, 11); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_WAIL_START); } else { - func_80A5257C(this, 17); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_LAUGH_ONCE); this->unk_38C = 4; } } break; - case 11: - func_80A5257C(this, 8); + case DEKU_KING_ANIM_WAIL_START: + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_WAIL); this->unk_38C = ((s32)(Rand_ZeroOne() * 100.0f) % 4) + 3; break; - case 17: + case DEKU_KING_ANIM_LAUGH_ONCE: if (DECR(this->unk_38C) == 0) { this->unk_386 = 0; } break; + + default: + break; } if (this->unk_386 != 0) { @@ -197,7 +225,7 @@ s32 func_80A52944(EnDnq* this) { s16 phi_v1 = 0; if (this->unk_386 == 0) { - func_80A5257C(this, 12); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_MARCH); this->unk_38C = 1; this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; this->unk_386 = 1; @@ -206,7 +234,7 @@ s32 func_80A52944(EnDnq* this) { } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_386++; if (this->unk_386 >= 6) { - func_80A5257C(this, 12); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_MARCH); this->unk_386 = 1; phi_v1 = this->unk_38C * 0x2000; } else if (this->unk_386 <= 3) { @@ -214,7 +242,7 @@ s32 func_80A52944(EnDnq* this) { this->skelAnime.curFrame = 0.0f; phi_v1 = this->unk_38C * 0x2000; } else { - func_80A5257C(this, 13); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_SPIN_SCEPTER); this->skelAnime.curFrame = 0.0f; } this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; @@ -227,7 +255,8 @@ s32 func_80A52944(EnDnq* this) { s32 func_80A52A78(EnDnq* this, PlayState* play) { static s32 D_80A535DC[] = { - 17, 12, 14, 13, 16, + DEKU_KING_ANIM_LAUGH_ONCE, DEKU_KING_ANIM_MARCH, DEKU_KING_ANIM_INTIMIDATE, + DEKU_KING_ANIM_SPIN_SCEPTER, DEKU_KING_ANIM_JUMP, }; if (this->unk_38A == 0) { @@ -247,7 +276,7 @@ s32 func_80A52A78(EnDnq* this, PlayState* play) { this->unk_388 += 3; this->unk_388 %= 5; } - func_80A5257C(this, D_80A535DC[this->unk_388]); + EnDnq_ChangeAnim(this, D_80A535DC[this->unk_388]); this->skelAnime.curFrame = 0.0f; } @@ -257,36 +286,39 @@ s32 func_80A52A78(EnDnq* this, PlayState* play) { s32 func_80A52B68(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 temp = play->msgCtx.currentTextId; + u16 textId = play->msgCtx.currentTextId; if ((player->stateFlags1 & PLAYER_STATE1_40) && (player->talkActor == &this->picto.actor)) { - switch (temp) { + switch (textId) { case 0x89B: - func_80A5257C(this, 18); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_FOOT_STAMP_LOOP); break; case 0x89E: - func_80A5257C(this, 19); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_LAUGH_LOOP); break; case 0x898: case 0x89F: - func_80A5257C(this, 16); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_JUMP); break; case 0x899: case 0x89D: - func_80A5257C(this, 14); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_INTIMIDATE); break; case 0x89A: case 0x89C: - func_80A5257C(this, 15); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_POINT_SCEPTER); + break; + + default: break; } this->unk_39C = 1; } else if (this->unk_39C != 0) { - func_80A5257C(this, 0); + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_IDLE); this->unk_39C = 0; this->unk_37E = 0; this->unk_386 = 0; @@ -323,8 +355,9 @@ 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->picto.actor, &play->state)) { - SubS_UpdateFlags(&this->unk_37C, 0, 7); + if (((this->unk_37C & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_380 = func_80A52CF8(this, play); this->actionFunc = func_80A52FB8; ret = true; @@ -338,9 +371,9 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { s16 yaw = this->picto.actor.yawTowardsPlayer - this->picto.actor.world.rot.y; if (yaw <= 0x3800) { - SubS_UpdateFlags(&this->unk_37C, 3, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->unk_37C, 0, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { @@ -379,7 +412,7 @@ void func_80A52FB8(EnDnq* this, PlayState* play) { s16 sp2E = this->picto.actor.yawTowardsPlayer; if (func_8010BF58(&this->picto.actor, play, this->unk_380, NULL, &this->unk_1E0)) { - SubS_UpdateFlags(&this->unk_37C, 3, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_386 = 0; this->actionFunc = func_80A52DC8; } else { @@ -387,9 +420,11 @@ void func_80A52FB8(EnDnq* this, PlayState* play) { } } -void func_80A53038(EnDnq* this, PlayState* play) { - static s32 D_80A535FC[] = { - 0, 1, 2, 3, 5, 6, +void EnDnq_HandleCutscene(EnDnq* this, PlayState* play) { + static s32 sCsAnimIndex[] = { + DEKU_KING_ANIM_IDLE, DEKU_KING_ANIM_IDLE_MORPH, + DEKU_KING_ANIM_SURPRISE, DEKU_KING_ANIM_JUMPED_ON_START, + DEKU_KING_ANIM_JUMPED_ON_END, DEKU_KING_ANIM_JUMPED_ON_END_MORPH, }; s32 cueChannel; u32 cueId; @@ -398,17 +433,18 @@ void func_80A53038(EnDnq* this, PlayState* play) { cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_105); cueId = play->csCtx.actorCues[cueChannel]->id; if (this->cueId != (u8)cueId) { - func_80A5257C(this, D_80A535FC[cueId]); + EnDnq_ChangeAnim(this, sCsAnimIndex[cueId]); this->cueId = cueId; } - if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) { + if ((this->animIndex == DEKU_KING_ANIM_JUMPED_ON_LOOP) && Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_KINGNUTS_DAMAGE); } - if (((this->unk_398 == 3) || (this->unk_398 == 6)) && + if (((this->animIndex == DEKU_KING_ANIM_JUMPED_ON_START) || + (this->animIndex == DEKU_KING_ANIM_JUMPED_ON_END_MORPH)) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A5257C(this, this->unk_398 + 1); + EnDnq_ChangeAnim(this, this->animIndex + 1); } Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, cueChannel); @@ -421,15 +457,15 @@ void EnDnq_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->picto.actor.shape, 0.0f, NULL, 14.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gDekuKingSkel, NULL, this->jointTable, this->morphTable, DEKU_KING_LIMB_MAX); - this->unk_398 = -1; - func_80A5257C(this, 0); + this->animIndex = DEKU_KING_ANIM_NONE; + EnDnq_ChangeAnim(this, DEKU_KING_ANIM_IDLE); 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->picto.actor.targetMode = TARGET_MODE_1; this->unk_386 = 0; this->unk_37C = 0; - SubS_UpdateFlags(&this->unk_37C, 3, 7); + SubS_SetOfferMode(&this->unk_37C, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80)) { this->unk_3A4 = 1; } else { @@ -449,7 +485,7 @@ void EnDnq_Update(Actor* thisx, PlayState* play) { EnDnq* this = THIS; if (!func_80A52D44(this, play) && func_80A52648(this, play)) { - func_80A53038(this, play); + EnDnq_HandleCutscene(this, play); SkelAnime_Update(&this->skelAnime); } else { this->actionFunc(this, play); @@ -458,8 +494,8 @@ void EnDnq_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->picto.actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); - func_8013C964(&this->picto.actor, play, this->unk_390, fabsf(this->picto.actor.playerHeightRel) + 1.0f, - PLAYER_IA_NONE, this->unk_37C & 7); + SubS_Offer(&this->picto.actor, play, this->unk_390, fabsf(this->picto.actor.playerHeightRel) + 1.0f, + PLAYER_IA_NONE, this->unk_37C & SUBS_OFFER_MODE_MASK); this->picto.actor.xzDistToPlayer = this->unk_394; Actor_SetFocus(&this->picto.actor, 46.0f); func_80A52604(this, play); 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 6ede37a55..ddb6616a2 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h @@ -29,7 +29,7 @@ typedef struct EnDnq { /* 0x38C */ s16 unk_38C; /* 0x390 */ f32 unk_390; /* 0x394 */ f32 unk_394; - /* 0x398 */ s32 unk_398; + /* 0x398 */ s32 animIndex; /* 0x39C */ s32 unk_39C; /* 0x3A0 */ UNK_TYPE1 unk_3A0[0x4]; /* 0x3A4 */ s32 unk_3A4; 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 d662e7e55..02777ec44 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -6,7 +6,7 @@ #include "z_en_dns.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnDns*)thisx) @@ -19,20 +19,6 @@ void func_8092D330(EnDns* this, PlayState* play); void EnDns_DoNothing(EnDns* this, PlayState* play); void func_8092D4D8(EnDns* this, PlayState* play); -typedef enum { - /* 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, 0x00172000, 0x050E0831, 0x0C100E08, 0x220C1000, 0x00172000, 0x050E0832, 0x0C100E08, 0x230C1000, @@ -73,60 +59,75 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -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 }, - { &gKingsChamberDekuGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gKingsChamberDekuGuardSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKingsChamberDekuGuardSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKingsChamberDekuGuardRunStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKingsChamberDekuGuardRunLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKingsChamberDekuGuardDanceAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKingsChamberDekuGuardFlipAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, +typedef enum { + /* -1 */ EN_DNS_ANIM_NONE = -1, + /* 0 */ EN_DNS_ANIM_IDLE, + /* 1 */ EN_DNS_ANIM_IDLE_MORPH, + /* 2 */ EN_DNS_ANIM_WALK, + /* 3 */ EN_DNS_ANIM_WALK_MORPH, + /* 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 AnimationInfoS sAnimationInfo[EN_DNS_ANIM_MAX] = { + { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_DNS_ANIM_IDLE + { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // EN_DNS_ANIM_IDLE_MORPH + { &gKingsChamberDekuGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_DNS_ANIM_WALK + { &gKingsChamberDekuGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // EN_DNS_ANIM_WALK_MORPH + { &gKingsChamberDekuGuardSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_DNS_ANIM_SURPRISE_START + { &gKingsChamberDekuGuardSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_DNS_ANIM_SURPRISE_LOOP + { &gKingsChamberDekuGuardRunStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_DNS_ANIM_RUN_START + { &gKingsChamberDekuGuardRunLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_DNS_ANIM_RUN_LOOP + { &gKingsChamberDekuGuardDanceAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_DNS_ANIM_DANCE + { &gKingsChamberDekuGuardFlipAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_DNS_ANIM_FLIP }; void func_8092C5C0(EnDns* this) { s32 pad; - if (((this->animIndex == EN_DNS_ANIM_WALK_1) || (this->animIndex == EN_DNS_ANIM_WALK_2) || + if (((this->animIndex == EN_DNS_ANIM_WALK) || (this->animIndex == EN_DNS_ANIM_WALK_MORPH) || (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_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } } -s32 func_8092C63C(EnDns* this, s32 arg1) { - s32 phi_v1 = false; - s32 ret = false; +s32 EnDns_ChangeAnim(EnDns* this, s32 animIndex) { + s32 changeAnim = false; + s32 didAnimChange = false; - switch (arg1) { - 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; + switch (animIndex) { + case EN_DNS_ANIM_IDLE: + case EN_DNS_ANIM_IDLE_MORPH: + if ((this->animIndex != EN_DNS_ANIM_IDLE) && (this->animIndex != EN_DNS_ANIM_IDLE_MORPH)) { + changeAnim = true; } break; - 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; + case EN_DNS_ANIM_WALK: + case EN_DNS_ANIM_WALK_MORPH: + if ((this->animIndex != EN_DNS_ANIM_WALK) && (this->animIndex != EN_DNS_ANIM_WALK_MORPH)) { + changeAnim = true; } break; default: - if (this->animIndex != arg1) { - phi_v1 = true; + if (this->animIndex != animIndex) { + changeAnim = true; } } - if (phi_v1) { - this->animIndex = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); + if (changeAnim) { + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); } - return ret; + return didAnimChange; } void func_8092C6FC(EnDns* this, PlayState* play) { @@ -200,9 +201,10 @@ s32* func_8092C9BC(EnDns* this, PlayState* play) { case ENDNS_GET_7_3: return &D_8092DCB0[12]; - } - return 0; + default: + return NULL; + } } s32 EnDns_GetCueType(EnDns* this) { @@ -218,30 +220,30 @@ s32 EnDns_GetCueType(EnDns* this) { case ENDNS_GET_7_3: return CS_CMD_ACTOR_CUE_468; - } - return 0; + default: + return 0; + } } s32 func_8092CAD0(EnDns* this, PlayState* play) { s32 ret = false; - if (this->unk_2C6 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_2C6, 0, 7); - this->unk_2C6 &= ~0x10; - if (ENDNS_GET_4000(&this->actor)) { - this->unk_2F0 = 0.0f; - if (this->unk_2D2 != 0) { - this->unk_2F0 = this->skelAnime.curFrame; - func_8092C63C(this, EN_DNS_ANIM_WALK_1); - } - this->unk_2DA = this->actor.world.rot.y; + if (((this->unk_2C6 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->unk_2C6 &= ~0x10; + if (ENDNS_GET_4000(&this->actor)) { + this->animCurFrame = 0.0f; + if (this->unk_2D2 != 0) { + this->animCurFrame = this->skelAnime.curFrame; + EnDns_ChangeAnim(this, EN_DNS_ANIM_WALK); } - this->unk_1E0 = func_8092C9BC(this, play); - this->actionFunc = func_8092D4D8; - ret = true; + this->unk_2DA = this->actor.world.rot.y; } + this->unk_1E0 = func_8092C9BC(this, play); + this->actionFunc = func_8092D4D8; + ret = true; } return ret; } @@ -252,15 +254,15 @@ s32 func_8092CB98(EnDns* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_2C6 & 0x80)) { this->cueType = EnDns_GetCueType(this); - this->actor.flags &= ~ACTOR_FLAG_1; - SubS_UpdateFlags(&this->unk_2C6, 0, 7); + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_2C6 |= 0x80; this->cueId = 255; } phi_v1 = 1; } else if (this->unk_2C6 & 0x80) { - this->actor.flags |= ACTOR_FLAG_1; - SubS_UpdateFlags(&this->unk_2C6, 3, 7); + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2C6 &= ~0x80; } return phi_v1; @@ -306,13 +308,13 @@ s32 func_8092CCEC(EnDns* this, PlayState* play) { s32 func_8092CE38(EnDns* this) { static s32 D_8092DE00[] = { EN_DNS_ANIM_DANCE, EN_DNS_ANIM_DANCE, EN_DNS_ANIM_FLIP }; - s16 frame; + s16 rotVelocity; s32 pad; Vec3f sp2C; s32 ret = false; if ((this->unk_2C6 & 0x200) || Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_8092C63C(this, D_8092DE00[this->unk_2D2]); + EnDns_ChangeAnim(this, D_8092DE00[this->unk_2D2]); this->unk_2C6 &= ~0x200; this->skelAnime.curFrame = 0.0f; if (this->unk_2D2 == 2) { @@ -331,10 +333,10 @@ s32 func_8092CE38(EnDns* this) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_JUMP); } else if (this->skelAnime.curFrame < 13.0f) { - frame = this->skelAnime.curFrame; + rotVelocity = this->skelAnime.curFrame; this->actor.shape.rot.y = this->actor.world.rot.y; - frame *= 2520; - this->actor.shape.rot.y += frame; + rotVelocity *= 0x9D8; + this->actor.shape.rot.y += rotVelocity; this->unk_2E4 -= -(40.0f / 13.0f); } } else { @@ -384,7 +386,7 @@ void func_8092D108(EnDns* this, PlayState* play) { 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++, gKingsChamberDekuGuardDekuFlower); + gSPDisplayList(POLY_OPA_DISP++, gKingsChamberDekuGuardDekuFlowerDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -401,15 +403,15 @@ void func_8092D1B8(EnDns* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) && !CHECK_EVENTINF(EVENTINF_15) && func_8092CC68(play)) { player->stateFlags1 |= PLAYER_STATE1_20; this->unk_2C6 |= 0x100; - SubS_UpdateFlags(&this->unk_2C6, 4, 7); - play_sound(NA_SE_SY_FOUND); + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); + Audio_PlaySfx(NA_SE_SY_FOUND); SET_EVENTINF(EVENTINF_15); this->unk_2F4 = func_8092CCEC; - func_8092C63C(this, EN_DNS_ANIM_WALK_1); + EnDns_ChangeAnim(this, EN_DNS_ANIM_WALK); this->actionFunc = EnDns_DoNothing; } else if (CHECK_EVENTINF(EVENTINF_16)) { func_8092CCEC(this, play); - func_8092C63C(this, EN_DNS_ANIM_WALK_1); + EnDns_ChangeAnim(this, EN_DNS_ANIM_WALK); this->actionFunc = func_8092D330; } Math_ApproachS(&this->actor.shape.rot.y, sp22, 3, 0x2AA8); @@ -451,16 +453,16 @@ 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_ANIM_WALK_1); + EnDns_ChangeAnim(this, EN_DNS_ANIM_WALK); } } else if (func_8010BF58(&this->actor, play, this->unk_1E0, this->unk_2F4, &this->unk_1DC)) { - SubS_UpdateFlags(&this->unk_2C6, 3, 7); + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2F4 = NULL; if (ENDNS_GET_4000(&this->actor)) { if (!CHECK_EVENTINF(EVENTINF_15)) { - this->skelAnime.curFrame = this->unk_2F0; + this->skelAnime.curFrame = this->animCurFrame; this->actor.world.rot.y = this->unk_2DA; - func_8092C63C(this, EN_DNS_ANIM_DANCE); + EnDns_ChangeAnim(this, EN_DNS_ANIM_DANCE); } this->unk_2CC = 0; this->unk_2CE = 0; @@ -472,10 +474,10 @@ void func_8092D4D8(EnDns* this, PlayState* play) { } } -void func_8092D5E8(EnDns* this, PlayState* play) { - static s32 D_8092DE0C[] = { - EN_DNS_ANIM_IDLE_1, - EN_DNS_ANIM_IDLE_1, +void EnDns_HandleCutscene(EnDns* this, PlayState* play) { + static s32 sCsAnimIndex[] = { + EN_DNS_ANIM_IDLE, + EN_DNS_ANIM_IDLE, EN_DNS_ANIM_SURPRISE_START, EN_DNS_ANIM_RUN_START, }; @@ -486,13 +488,13 @@ void func_8092D5E8(EnDns* this, PlayState* play) { cueChannel = Cutscene_GetCueChannel(play, this->cueType); cueId = play->csCtx.actorCues[cueChannel]->id; if (this->cueId != (u8)cueId) { - func_8092C63C(this, D_8092DE0C[cueId]); + EnDns_ChangeAnim(this, sCsAnimIndex[cueId]); this->cueId = cueId; } 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->animIndex + 1); + EnDns_ChangeAnim(this, this->animIndex + 1); } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); @@ -510,16 +512,16 @@ 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->animIndex = -1; - func_8092C63C(this, EN_DNS_ANIM_WALK_1); + this->animIndex = EN_DNS_ANIM_NONE; + EnDns_ChangeAnim(this, EN_DNS_ANIM_WALK); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.gravity = -0.8f; this->unk_2D2 = 0; this->unk_2C6 = 0; - SubS_UpdateFlags(&this->unk_2C6, 3, 7); + SubS_SetOfferMode(&this->unk_2C6, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2C6 |= (0x40 | 0x10); this->unk_2C6 |= 0x200; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80)) { @@ -542,7 +544,7 @@ void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = THIS; if (!func_8092CAD0(this, play) && func_8092CB98(this, play)) { - func_8092D5E8(this, play); + EnDns_HandleCutscene(this, play); SkelAnime_Update(&this->skelAnime); func_8092C5C0(this); } else { @@ -551,7 +553,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, UPDBGCHECKINFO_FLAG_4); - func_8013C964(&this->actor, play, 80.0f, 40.0f, PLAYER_IA_NONE, this->unk_2C6 & 7); + SubS_Offer(&this->actor, play, 80.0f, 40.0f, PLAYER_IA_NONE, this->unk_2C6 & SUBS_OFFER_MODE_MASK); 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 ade8b6174..5b926f9db 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -28,7 +28,7 @@ typedef struct EnDns { /* 0x1D8 */ u8 cueId; /* 0x1DC */ s32 unk_1DC; /* 0x1E0 */ s32* unk_1E0; - /* 0x1E4 */ Gfx* unk_1E4[13]; + /* 0x1E4 */ Gfx* unk_1E4[KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX]; /* 0x218 */ Vec3f unk_218; /* 0x224 */ Vec3s unk_224; /* 0x22A */ Vec3s jointTable[KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX]; @@ -50,7 +50,7 @@ typedef struct EnDns { /* 0x2E4 */ f32 unk_2E4; /* 0x2E8 */ UNK_TYPE1 unk_2E8[0x4]; /* 0x2EC */ f32 unk_2EC; - /* 0x2F0 */ f32 unk_2F0; + /* 0x2F0 */ f32 animCurFrame; /* 0x2F4 */ EnDnsFunc unk_2F4; /* 0x2F8 */ s32 animIndex; /* 0x2FC */ s32 unk_2FC; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 6149a7360..c85cdf6ee 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -7,9 +7,9 @@ #include "z_en_dodongo.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Bombf/z_en_bombf.h" -#include "objects/object_dodongo/object_dodongo.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnDodongo*)thisx) @@ -296,7 +296,7 @@ void EnDodongo_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&this->unk_314, &gOneVec3f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); SkelAnime_Init(play, &this->skelAnime, &object_dodongo_Skel_008318, &object_dodongo_Anim_004C20, this->jointTable, - this->morphTable, 31); + this->morphTable, OBJECT_DODONGO_LIMB_MAX); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Collider_InitAndSetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); @@ -408,7 +408,8 @@ void func_80876BD0(EnDodongo* this, PlayState* play, s32 arg2) { this->drawDmgEffAlpha = 4.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider1.elements[arg2].info.bumper.hitPos.x, this->collider1.elements[arg2].info.bumper.hitPos.y, - this->collider1.elements[arg2].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->collider1.elements[arg2].info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } } @@ -430,7 +431,8 @@ void func_80876D28(EnDodongo* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider1.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 9, 2, this->unk_334 * 0.3f, this->unk_334 * 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DODONGO_BODYPART_MAX, 2, this->unk_334 * 0.3f, + this->unk_334 * 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -446,7 +448,7 @@ void func_80876DC4(EnDodongo* this, PlayState* play) { f32 temp_f22; f32 temp_f20; - Math_Vec3f_Copy(&sp68, &this->limbPos[0]); + Math_Vec3f_Copy(&sp68, &this->bodyPartsPos[DODONGO_BODYPART_0]); sp66 = ((s32)Rand_Next() >> 0x12) + this->actor.shape.rot.y; temp_f20 = Math_CosS(sp66); temp_f22 = Math_SinS(sp66); @@ -494,8 +496,8 @@ void func_80876DC4(EnDodongo* this, PlayState* play) { sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f22 * this->unk_334; func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); - sp68.x = this->limbPos[0].x + (temp_f20 * 6.0f * this->unk_334); - sp68.z = this->limbPos[0].z - (temp_f22 * 6.0f * this->unk_334); + sp68.x = this->bodyPartsPos[DODONGO_BODYPART_0].x + (temp_f20 * 6.0f * this->unk_334); + sp68.z = this->bodyPartsPos[DODONGO_BODYPART_0].z - (temp_f22 * 6.0f * this->unk_334); sp80.x *= -1.0f; sp80.z = sp80.z * -1.0f; sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334; @@ -621,9 +623,9 @@ void func_808777A8(EnDodongo* this) { for (i = 0; i < ARRAY_COUNT(this->collider3Elements); i++) { sph = &this->collider3.elements[i].dim.worldSphere; - sph->center.x = this->limbPos[0].x; - sph->center.y = this->limbPos[0].y; - sph->center.z = this->limbPos[0].z; + sph->center.x = this->bodyPartsPos[DODONGO_BODYPART_0].x; + sph->center.y = this->bodyPartsPos[DODONGO_BODYPART_0].y; + sph->center.z = this->bodyPartsPos[DODONGO_BODYPART_0].z; sph->radius = 0; } @@ -645,7 +647,7 @@ void func_8087784C(EnDodongo* this, PlayState* play) { } if (func_8087721C(this)) { - func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); frame = this->skelAnime.curFrame - 29.0f; end = frame >> 1; if (end > 3) { @@ -657,10 +659,12 @@ void func_8087784C(EnDodongo* this, PlayState* play) { temp_f12 = Math_CosS(this->actor.shape.rot.y) * this->unk_334; for (i = 0; i < end; i++, element++) { - element->dim.worldSphere.center.x = this->limbPos[0].x + (element->dim.modelSphere.center.z * temp_f2); + element->dim.worldSphere.center.x = + this->bodyPartsPos[DODONGO_BODYPART_0].x + (element->dim.modelSphere.center.z * temp_f2); element->dim.worldSphere.center.y = - this->limbPos[0].y + (element->dim.modelSphere.center.y * this->unk_334); - element->dim.worldSphere.center.z = this->limbPos[0].z + (element->dim.modelSphere.center.z * temp_f12); + this->bodyPartsPos[DODONGO_BODYPART_0].y + (element->dim.modelSphere.center.y * this->unk_334); + element->dim.worldSphere.center.z = + this->bodyPartsPos[DODONGO_BODYPART_0].z + (element->dim.modelSphere.center.z * temp_f12); element->dim.worldSphere.radius = element->dim.modelSphere.radius; } @@ -668,10 +672,10 @@ void func_8087784C(EnDodongo* this, PlayState* play) { D_80879348.x = 2.5f * temp_f2; D_80879348.y = this->unk_334 * 1.4f; D_80879348.z = 2.5f * temp_f12; - EffectSsDFire_Spawn(play, &this->limbPos[0], &D_80879354, &D_80879348, this->unk_334 * 100.0f, - this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DODONGO_BODYPART_0], &D_80879354, &D_80879348, + this->unk_334 * 100.0f, this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8); } else if ((this->skelAnime.curFrame >= 2.0f) && (this->skelAnime.curFrame <= 20.0f)) { - func_800B9010(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); } if (SkelAnime_Update(&this->skelAnime)) { @@ -771,13 +775,13 @@ void func_80877E60(EnDodongo* this, PlayState* play) { } else { sp5E = this->unk_334 * 50.0f; sp5C = this->unk_334 * 5.0f; - Math_Vec3f_Copy(&sp64, &this->limbPos[0]); + Math_Vec3f_Copy(&sp64, &this->bodyPartsPos[DODONGO_BODYPART_0]); func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); sp64.x -= Math_CosS(this->actor.shape.rot.y) * 6.0f * this->unk_334; sp64.z += Math_SinS(this->actor.shape.rot.y) * 6.0f * this->unk_334; func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); - sp64.x = (2.0f * this->limbPos[0].x) - sp64.x; - sp64.z = (2.0f * this->limbPos[0].z) - sp64.z; + sp64.x = (2.0f * this->bodyPartsPos[DODONGO_BODYPART_0].x) - sp64.x; + sp64.z = (2.0f * this->bodyPartsPos[DODONGO_BODYPART_0].z) - sp64.z; func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); } } @@ -798,20 +802,20 @@ void func_80877E60(EnDodongo* this, PlayState* play) { void func_80878354(EnDodongo* this) { s32 pad; - AnimationHeader* sp18; + AnimationHeader* anim; s16 yDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; this->unk_306 = (0xFFFF - ABS_ALT(yDiff)) / 15; if (yDiff >= 0) { - sp18 = &object_dodongo_Anim_0042C4; + anim = &object_dodongo_Anim_0042C4; this->unk_306 = -this->unk_306; } else { - sp18 = &object_dodongo_Anim_003B14; + anim = &object_dodongo_Anim_003B14; } Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_TAIL); - Animation_PlayOnceSetSpeed(&this->skelAnime, sp18, 2.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, anim, 2.0f); this->timer = 0; this->collider1.base.atFlags |= AT_ON; this->unk_304 = -1; @@ -894,7 +898,7 @@ void func_80878724(EnDodongo* this) { this->timer = 0; this->unk_304 = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_DEAD); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->actionFunc = func_808787B0; @@ -1053,7 +1057,7 @@ void EnDodongo_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f; this->drawDmgEffScale = (this->drawDmgEffScale > 0.75f) ? 0.75f : this->drawDmgEffScale; } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1061,41 +1065,74 @@ void EnDodongo_Update(Actor* thisx, PlayState* play2) { s32 EnDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDodongo* this = THIS; - if (limbIndex == 1) { + if (limbIndex == OBJECT_DODONGO_LIMB_01) { pos->z += 1000.0f; - } else if ((limbIndex == 15) || (limbIndex == 16)) { + } else if ((limbIndex == OBJECT_DODONGO_LIMB_0F) || (limbIndex == OBJECT_DODONGO_LIMB_10)) { Matrix_Scale(this->unk_314.x, this->unk_314.y, this->unk_314.z, MTXMODE_APPLY); } return false; } +static Vec3f D_80879370 = { 1800.0f, 1200.0f, 0.0f }; +static Vec3f D_8087937C = { 1500.0f, 300.0f, 0.0f }; + +static s8 sLimbToBodyParts[OBJECT_DODONGO_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_DODONGO_LIMB_NONE + BODYPART_NONE, // OBJECT_DODONGO_LIMB_01 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_02 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_03 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_04 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_05 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_06 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_07 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_08 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_09 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0A + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0B + BODYPART_NONE, // OBJECT_DODONGO_LIMB_0C + DODONGO_BODYPART_2, // OBJECT_DODONGO_LIMB_0D + DODONGO_BODYPART_3, // OBJECT_DODONGO_LIMB_0E + DODONGO_BODYPART_4, // OBJECT_DODONGO_LIMB_0F + BODYPART_NONE, // OBJECT_DODONGO_LIMB_10 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_11 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_12 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_13 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_14 + DODONGO_BODYPART_5, // OBJECT_DODONGO_LIMB_15 + DODONGO_BODYPART_6, // OBJECT_DODONGO_LIMB_16 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_17 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_18 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_19 + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1A + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1B + DODONGO_BODYPART_7, // OBJECT_DODONGO_LIMB_1C + DODONGO_BODYPART_8, // OBJECT_DODONGO_LIMB_1D + BODYPART_NONE, // OBJECT_DODONGO_LIMB_1E +}; + void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80879370 = { 1800.0f, 1200.0f, 0.0f }; - static Vec3f D_8087937C = { 1500.0f, 300.0f, 0.0f }; - static s8 D_80879388[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, - -1, -1, -1, -1, -1, 5, 6, -1, -1, -1, -1, -1, 7, 8, -1, 0, - }; EnDodongo* this = THIS; Collider_UpdateSpheres(limbIndex, &this->collider1); Collider_UpdateSpheres(limbIndex, &this->collider2); - if (D_80879388[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80879388[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if (limbIndex == 7) { + if (limbIndex == OBJECT_DODONGO_LIMB_07) { Matrix_MultVec3f(&D_80879370, &this->unk_308); - Matrix_MultVec3f(&D_8087937C, &this->limbPos[0]); + Matrix_MultVec3f(&D_8087937C, &this->bodyPartsPos[DODONGO_BODYPART_0]); Matrix_MultZero(&this->actor.focus.pos); - Matrix_MultVecY(-200.0f, &this->limbPos[1]); - } else if (limbIndex == 13) { + Matrix_MultVecY(-200.0f, &this->bodyPartsPos[DODONGO_BODYPART_1]); + } else if (limbIndex == OBJECT_DODONGO_LIMB_0D) { Matrix_MultVecX(1600.0f, &this->unk_320); } - if ((limbIndex == 30) && (this->actionFunc == func_80878424) && (this->timer != this->unk_304)) { - EffectBlure_AddVertex(Effect_GetByIndex(this->unk_338), &this->unk_320, &this->limbPos[4]); + if ((limbIndex == OBJECT_DODONGO_LIMB_1E) && (this->actionFunc == func_80878424) && + (this->timer != this->unk_304)) { + EffectBlure_AddVertex(Effect_GetByIndex(this->unk_338), &this->unk_320, + &this->bodyPartsPos[DODONGO_BODYPART_4]); this->unk_304 = this->timer; } } @@ -1106,7 +1143,7 @@ void EnDodongo_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, EnDodongo_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DODONGO_BODYPART_MAX, this->drawDmgEffScale * this->unk_334, this->drawDmgEffFrozenSteamScale * this->unk_334, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index 3cc80b0d1..33e580539 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -2,16 +2,30 @@ #define Z_EN_DODONGO_H #include "global.h" +#include "objects/object_dodongo/object_dodongo.h" struct EnDodongo; typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); +typedef enum DodongoBodyPart { + /* 0 */ DODONGO_BODYPART_0, + /* 1 */ DODONGO_BODYPART_1, + /* 2 */ DODONGO_BODYPART_2, + /* 3 */ DODONGO_BODYPART_3, + /* 4 */ DODONGO_BODYPART_4, + /* 5 */ DODONGO_BODYPART_5, + /* 6 */ DODONGO_BODYPART_6, + /* 7 */ DODONGO_BODYPART_7, + /* 8 */ DODONGO_BODYPART_8, + /* 9 */ DODONGO_BODYPART_MAX +} DodongoBodyPart; + typedef struct EnDodongo { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[31]; - /* 0x242 */ Vec3s morphTable[31]; + /* 0x188 */ Vec3s jointTable[OBJECT_DODONGO_LIMB_MAX]; + /* 0x242 */ Vec3s morphTable[OBJECT_DODONGO_LIMB_MAX]; /* 0x2FC */ EnDodongoActionFunc actionFunc; /* 0x300 */ u8 drawDmgEffType; /* 0x302 */ s16 timer; @@ -27,7 +41,7 @@ typedef struct EnDodongo { /* 0x33C */ f32 drawDmgEffAlpha; /* 0x340 */ f32 drawDmgEffScale; /* 0x344 */ f32 drawDmgEffFrozenSteamScale; - /* 0x348 */ Vec3f limbPos[9]; + /* 0x348 */ Vec3f bodyPartsPos[DODONGO_BODYPART_MAX]; /* 0x3B4 */ ColliderJntSph collider1; /* 0x3D4 */ ColliderJntSphElement collider1Elements[10]; /* 0x654 */ ColliderJntSph collider2; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 60d0ec673..3451af722 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -5,7 +5,7 @@ */ #include "z_en_door.h" -#include "objects/object_mkk/object_mkk.h" +#include "objects/object_kinsta2_obj/object_kinsta2_obj.h" #include "objects/object_dor01/object_dor01.h" #include "objects/object_dor02/object_dor02.h" #include "objects/object_dor03/object_dor03.h" @@ -294,7 +294,7 @@ typedef struct { /* 0x4 */ s16 objectId; } EnDoorInfo; // size = 0x6 -static EnDoorInfo sObjInfo[] = { +static EnDoorInfo sObjectInfo[] = { { SCENE_MITURIN, 0x01, OBJECT_NUMA_OBJ }, { SCENE_TENMON_DAI, 0x02, OBJECT_DOR01 }, { SCENE_00KEIKOKU, 0x02, OBJECT_DOR01 }, @@ -347,46 +347,77 @@ static EnDoorInfo sObjInfo[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_U16(shape.rot.x, 0, ICHAIN_CONTINUE), ICHAIN_U16(shape.rot.z, 0, ICHAIN_STOP), }; -static AnimationHeader* sAnimations[] = { - &gameplay_keep_Anim_020658, &gameplay_keep_Anim_022CA8, &gameplay_keep_Anim_020658, &gameplay_keep_Anim_022E68, - &gameplay_keep_Anim_0204B4, &gameplay_keep_Anim_022BE8, &gameplay_keep_Anim_022D90, &gameplay_keep_Anim_022BE8, - &gameplay_keep_Anim_022FF0, &gameplay_keep_Anim_0205A0, +static AnimationHeader* sAnimations[2 * PLAYER_FORM_MAX] = { + // left + &gameplay_keep_Anim_020658, // PLAYER_FORM_FIERCE_DEITY + &gameplay_keep_Anim_022CA8, // PLAYER_FORM_GORON + &gameplay_keep_Anim_020658, // PLAYER_FORM_ZORA + &gameplay_keep_Anim_022E68, // PLAYER_FORM_DEKU + &gameplay_keep_Anim_0204B4, // PLAYER_FORM_HUMAN + // right + &gameplay_keep_Anim_022BE8, // PLAYER_FORM_FIERCE_DEITY + &gameplay_keep_Anim_022D90, // PLAYER_FORM_GORON + &gameplay_keep_Anim_022BE8, // PLAYER_FORM_ZORA + &gameplay_keep_Anim_022FF0, // PLAYER_FORM_DEKU + &gameplay_keep_Anim_0205A0, // PLAYER_FORM_HUMAN }; -static u8 sAnimOpenFrames[10] = { - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +static u8 sAnimOpenFrames[2 * PLAYER_FORM_MAX] = { + // left + 25, // PLAYER_FORM_FIERCE_DEITY + 25, // PLAYER_FORM_GORON + 25, // PLAYER_FORM_ZORA + 25, // PLAYER_FORM_DEKU + 25, // PLAYER_FORM_HUMAN + // right + 25, // PLAYER_FORM_FIERCE_DEITY + 25, // PLAYER_FORM_GORON + 25, // PLAYER_FORM_ZORA + 25, // PLAYER_FORM_DEKU + 25, // PLAYER_FORM_HUMAN }; -static u8 sAnimCloseFrames[10] = { - 60, 60, 60, 70, 70, 60, 60, 60, 60, 70, +static u8 sAnimCloseFrames[2 * PLAYER_FORM_MAX] = { + // left + 60, // PLAYER_FORM_FIERCE_DEITY + 60, // PLAYER_FORM_GORON + 60, // PLAYER_FORM_ZORA + 70, // PLAYER_FORM_DEKU + 70, // PLAYER_FORM_HUMAN + // right + 60, // PLAYER_FORM_FIERCE_DEITY + 60, // PLAYER_FORM_GORON + 60, // PLAYER_FORM_ZORA + 60, // PLAYER_FORM_DEKU + 70, // PLAYER_FORM_HUMAN }; static Gfx* D_808679A4[14][2] = { { gDoorLeftDL, gDoorRightDL }, { gWoodfallDoorDL, gWoodfallDoorDL }, - { object_dor01_DL_000448, object_dor01_DL_000448 }, + { gObservatoryLabDoorDL, gObservatoryLabDoorDL }, { gZoraHallDoorDL, gZoraHallDoorDL }, { gSwampDoorDL, gSwampDoorDL }, { gMagicHagPotionShopDoorDL, gMagicHagPotionShopDoorDL }, - { object_wdor01_DL_000548, object_wdor01_DL_000548 }, // Lottery Shop / Curiosity Shop / Mayor's House Door - { object_wdor02_DL_000548, object_wdor02_DL_000548 }, // Trading Post / Post Office Door - { object_wdor03_DL_000548, object_wdor03_DL_000548 }, // Stockpot Inn & Swordsman's School Door + { gLotteryCuriosityShopMayorHouseDoorDL, gLotteryCuriosityShopMayorHouseDoorDL }, + { gPostOfficeTradingPostDoorDL, gPostOfficeTradingPostDoorDL }, + { gInnSchoolDoorDL, gInnSchoolDoorDL }, { gMilkBarDoorDL, gMilkBarDoorDL }, { gMusicBoxHouseDoorDL, gMusicBoxHouseDoorDL }, { gPiratesFortressDoorDL, gPiratesFortressDoorDL }, - { object_mkk_DL_000310, object_mkk_DL_000310 }, + { gOceansideSpiderHouseDoorDL, gOceansideSpiderHouseDoorDL }, { gFieldWoodDoorLeftDL, gFieldWoodDoorRightDL }, }; void EnDoor_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; - s32 objectBankIndex; - EnDoorInfo* objectInfo = &sObjInfo[0]; + s32 objectSlot; + EnDoorInfo* objectInfo = &sObjectInfo[0]; EnDoor* this = THIS; s32 i; @@ -394,7 +425,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { this->doorType = ENDOOR_GET_TYPE(thisx); - this->switchFlag = ENDOOR_GET_PARAM_7F(thisx); + this->switchFlag = ENDOOR_GET_SWITCH_FLAG(thisx); if ((this->doorType == ENDOOR_TYPE_7) && (this->switchFlag == 0)) { DynaPolyActor_Init(&this->knobDoor.dyna, 0); DynaPolyActor_LoadMesh(play, &this->knobDoor.dyna, &gDoorCol); @@ -402,31 +433,32 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { SkelAnime_Init(play, &this->knobDoor.skelAnime, &gDoorSkel, &gameplay_keep_Anim_020658, this->limbTable, this->limbTable, DOOR_LIMB_MAX); if (this->doorType == ENDOOR_TYPE_5) { - objectInfo = &sObjInfo[17 + this->switchFlag]; + objectInfo = &sObjectInfo[17 + this->switchFlag]; } else { - for (i = 0; i < ARRAY_COUNT(sObjInfo) - 34; i++, objectInfo++) { + for (i = 0; i < ARRAY_COUNT(sObjectInfo) - 34; i++, objectInfo++) { if (play->sceneId == objectInfo->sceneId) { break; } } - if ((i >= ARRAY_COUNT(sObjInfo) - 34) && (Object_GetIndex(&play->objectCtx, GAMEPLAY_FIELD_KEEP) >= 0)) { + if ((i >= ARRAY_COUNT(sObjectInfo) - 34) && + (Object_GetSlot(&play->objectCtx, GAMEPLAY_FIELD_KEEP) > OBJECT_SLOT_NONE)) { objectInfo++; } } this->knobDoor.dlIndex = objectInfo->dListIndex; - objectBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); - if (objectBankIndex < 0) { - objectInfo = &sObjInfo[15]; - objectBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); - if (objectBankIndex != 0) { + objectSlot = Object_GetSlot(&play->objectCtx, objectInfo->objectId); + if (objectSlot <= OBJECT_SLOT_NONE) { + objectInfo = &sObjectInfo[15]; + objectSlot = Object_GetSlot(&play->objectCtx, objectInfo->objectId); + if (objectSlot != 0) { Actor_Kill(&this->knobDoor.dyna.actor); return; } } - this->knobDoor.requiredObjBankIndex = objectBankIndex; + this->knobDoor.objectSlot = objectSlot; this->knobDoor.dlIndex = objectInfo->dListIndex; // Set twice? - if (this->knobDoor.dyna.actor.objBankIndex == this->knobDoor.requiredObjBankIndex) { + if (this->knobDoor.dyna.actor.objectSlot == this->knobDoor.objectSlot) { func_80866A5C(this, play); } else { this->actionFunc = func_80866A5C; @@ -449,8 +481,8 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) { } void func_80866A5C(EnDoor* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->knobDoor.requiredObjBankIndex)) { - this->knobDoor.dyna.actor.objBankIndex = this->knobDoor.requiredObjBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->knobDoor.objectSlot)) { + this->knobDoor.dyna.actor.objectSlot = this->knobDoor.objectSlot; this->actionFunc = func_80866B20; this->knobDoor.dyna.actor.world.rot.y = 0; if (this->doorType == ENDOOR_TYPE_1) { @@ -638,8 +670,9 @@ s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { s32 pad; - temp = (this->knobDoor.dyna.actor.shape.rot.y + this->knobDoor.skelAnime.jointTable[3].z + rot->z) - - Math_Vec3f_Yaw(&play->view.eye, &this->knobDoor.dyna.actor.world.pos); + temp = + (this->knobDoor.dyna.actor.shape.rot.y + this->knobDoor.skelAnime.jointTable[DOOR_LIMB_3].z + rot->z) - + Math_Vec3f_Yaw(&play->view.eye, &this->knobDoor.dyna.actor.world.pos); *dList = (ABS_ALT(temp) < 0x4000) ? dl[0] : dl[1]; } else { @@ -656,7 +689,7 @@ s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnDoor_Draw(Actor* thisx, PlayState* play) { EnDoor* this = THIS; - if (this->knobDoor.dyna.actor.objBankIndex == this->knobDoor.requiredObjBankIndex) { + if (this->knobDoor.dyna.actor.objectSlot == this->knobDoor.objectSlot) { OPEN_DISPS(play->state.gfxCtx); if ((this->doorType == ENDOOR_TYPE_7) && (this->switchFlag == 0)) { diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h index 03dc31ab6..5ea0b7df3 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -10,7 +10,7 @@ struct EnDoor; typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*); #define ENDOOR_GET_TYPE(thisx) (((thisx)->params >> 7) & 7) -#define ENDOOR_GET_PARAM_7F(thisx) (((thisx)->params) & 0x7F) +#define ENDOOR_GET_SWITCH_FLAG(thisx) (((thisx)->params) & 0x7F) typedef enum EnDoorType { /* 0 */ ENDOOR_TYPE_0, diff --git a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c index d48bfd359..c6c1b312e 100644 --- a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c +++ b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c @@ -58,7 +58,7 @@ typedef struct { /* 0x4 */ s16 objectId; } EnDoorEtcInfo; // size = 0x6 -EnDoorEtcInfo sObjInfo[] = { +EnDoorEtcInfo sObjectInfo[] = { { SCENE_MITURIN, 1, OBJECT_NUMA_OBJ }, { -1, 0, GAMEPLAY_KEEP }, { -1, 13, GAMEPLAY_FIELD_KEEP }, @@ -79,7 +79,7 @@ EnDoorEtcInfo sObjInfo[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_U16(shape.rot.x, 0, ICHAIN_CONTINUE), ICHAIN_U16(shape.rot.z, 0, ICHAIN_STOP), @@ -87,8 +87,8 @@ static InitChainEntry sInitChain[] = { void EnDoorEtc_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; - s32 objectIndex; - EnDoorEtcInfo* objectInfo = sObjInfo; + s32 objectSlot; + EnDoorEtcInfo* objectInfo = sObjectInfo; s32 i; EnDoorEtc* this = THIS; @@ -101,16 +101,16 @@ void EnDoorEtc_Init(Actor* thisx, PlayState* play2) { break; } } - if ((i >= 15) && (Object_GetIndex(&play->objectCtx, GAMEPLAY_FIELD_KEEP) >= 0)) { + if ((i >= 15) && (Object_GetSlot(&play->objectCtx, GAMEPLAY_FIELD_KEEP) > OBJECT_SLOT_NONE)) { objectInfo++; } - objectIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); - if (objectIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, objectInfo->objectId); + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->knobDoor.dyna.actor); } else { - this->knobDoor.requiredObjBankIndex = objectIndex; + this->knobDoor.objectSlot = objectSlot; this->knobDoor.dlIndex = objectInfo->dListIndex; - if (this->knobDoor.dyna.actor.objBankIndex == this->knobDoor.requiredObjBankIndex) { + if (this->knobDoor.dyna.actor.objectSlot == this->knobDoor.objectSlot) { EnDoorEtc_WaitForObject(this, play); } else { this->actionFunc = EnDoorEtc_WaitForObject; @@ -139,9 +139,9 @@ s32 EnDoorEtc_IsDistanceGreater(Vec3f* a, Vec3f* b, f32 c) { } void EnDoorEtc_WaitForObject(EnDoorEtc* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->knobDoor.requiredObjBankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->knobDoor.objectSlot)) { this->knobDoor.dyna.actor.flags &= ~ACTOR_FLAG_10; - this->knobDoor.dyna.actor.objBankIndex = this->knobDoor.requiredObjBankIndex; + this->knobDoor.dyna.actor.objectSlot = this->knobDoor.objectSlot; this->actionFunc = func_80AC2354; this->knobDoor.dyna.actor.draw = EnDoorEtc_Draw; } @@ -193,8 +193,8 @@ void func_80AC21A0(EnDoorEtc* this, PlayState* play) { } } if ((this->knobDoor.dyna.actor.textId == 0x239B) && - Flags_GetSwitch(play, ENDOORETC_GET_SWITCHFLAG(&this->knobDoor.dyna.actor))) { - Flags_UnsetSwitch(play, ENDOORETC_GET_SWITCHFLAG(&this->knobDoor.dyna.actor)); + Flags_GetSwitch(play, ENDOORETC_GET_SWITCH_FLAG(&this->knobDoor.dyna.actor))) { + Flags_UnsetSwitch(play, ENDOORETC_GET_SWITCH_FLAG(&this->knobDoor.dyna.actor)); this->actionFunc = func_80AC2154; this->knobDoor.dyna.actor.textId = 0x1800; // "It won't budge!" this->unk_1F4 |= 1; diff --git a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h index 9cd63248f..c0bbdf98b 100644 --- a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h +++ b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h @@ -6,7 +6,7 @@ struct EnDoorEtc; -#define ENDOORETC_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define ENDOORETC_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) typedef void (*EnDoorEtcActionFunc)(struct EnDoorEtc*, PlayState*); 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 fae9fc4fc..59d504705 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -5,8 +5,9 @@ */ #include "z_en_dragon.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnDragon*)thisx) @@ -24,13 +25,6 @@ void EnDragon_SetupAttack(EnDragon* this); void EnDragon_Attack(EnDragon* this, PlayState* play); void EnDragon_Dead(EnDragon* this, PlayState* play); -typedef enum { - /* 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, /* 1 */ DEEP_PYTHON_EXTEND_STATE_FULLY_EXTENDED, @@ -214,7 +208,7 @@ void EnDragon_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 4; this->actor.colChkInfo.damageTable = &sDamageTable; - this->actor.targetMode = 0xA; + this->actor.targetMode = TARGET_MODE_10; Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.scale = this->collider.elements[1].dim.scale = this->collider.elements[2].dim.scale = @@ -255,26 +249,39 @@ void EnDragon_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -static AnimationHeader* sAnimations[] = { - &gDeepPythonSmallSideSwayAnim, - &gDeepPythonLargeSideSwayAnim, - &gDeepPythonVerticalSwayAnim, - &gDeepPythonSmallSideSwayAnim, +typedef enum { + /* 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, + /* 4 */ DEEP_PYTHON_ANIM_MAX +} DeepPythonAnimation; + +static AnimationHeader* sAnimations[DEEP_PYTHON_ANIM_MAX] = { + &gDeepPythonSmallSideSwayAnim, // DEEP_PYTHON_ANIM_SMALL_SIDE_SWAY + &gDeepPythonLargeSideSwayAnim, // DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY + &gDeepPythonVerticalSwayAnim, // DEEP_PYTHON_ANIM_VERTICAL_SWAY + &gDeepPythonSmallSideSwayAnim, // DEEP_PYTHON_ANIM_IDLE }; -static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE }; +static u8 sAnimationModes[DEEP_PYTHON_ANIM_MAX] = { + ANIMMODE_LOOP, // DEEP_PYTHON_ANIM_SMALL_SIDE_SWAY + ANIMMODE_LOOP, // DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY + ANIMMODE_ONCE, // DEEP_PYTHON_ANIM_VERTICAL_SWAY + ANIMMODE_ONCE, // DEEP_PYTHON_ANIM_IDLE +}; void EnDragon_ChangeAnim(EnDragon* this, s32 animIndex) { f32 startFrame; this->animIndex = animIndex; - this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); startFrame = 0.0f; if (this->animIndex == DEEP_PYTHON_ANIM_IDLE) { - startFrame = this->endFrame; + startFrame = this->animEndFrame; } - Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, startFrame, this->endFrame, + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, startFrame, this->animEndFrame, sAnimationModes[this->animIndex], -4.0f); } @@ -369,7 +376,7 @@ void EnDragon_SetupExtend(EnDragon* this) { void EnDragon_Extend(EnDragon* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s16 yaw; EnDragon_SpawnBubbles(this, play, this->jawPos); @@ -409,7 +416,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { Math_SmoothStepToS(&this->jawZRotation, 0, 5, 0xBB8, 0x14); SkelAnime_Update(&this->skelAnime); if (this->state == DEEP_PYTHON_EXTEND_STATE_FULLY_EXTENDED) { - if (currentFrame < this->endFrame) { + if (curFrame < this->animEndFrame) { return; } @@ -419,7 +426,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { yaw = ABS_ALT(BINANG_SUB(Math_Vec3f_Yaw(&this->jawPos, &player->actor.world.pos), this->actor.shape.rot.y)); if (yaw < 0x5000) { // Player is in front of the jaw - if ((this->endFrame <= currentFrame) && (this->largeSwayWaitTimer == 0)) { + if ((curFrame >= this->animEndFrame) && (this->largeSwayWaitTimer == 0)) { if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } @@ -432,7 +439,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { // Player is in behind the jaw if (this->state == DEEP_PYTHON_EXTEND_STATE_REPEAT_LARGE_SWAY) { EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_SMALL_SIDE_SWAY); - this->largeSwayWaitTimer = Rand_ZeroFloat(20.0f) + this->endFrame; + this->largeSwayWaitTimer = Rand_ZeroFloat(20.0f) + this->animEndFrame; this->state = DEEP_PYTHON_EXTEND_STATE_REPEAT_SMALL_SWAY; } @@ -541,7 +548,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { play->unk_18770(play, player); player->actor.parent = &this->actor; - player->unk_AE8 = 50; + player->actionVar2 = 50; this->action = DEEP_PYTHON_ACTION_GRAB; Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_EAT); EnDragon_SetupAttack(this); @@ -561,7 +568,7 @@ void EnDragon_SetupAttack(EnDragon* this) { void EnDragon_Attack(EnDragon* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f pos; // used as both the extended position and the camera eye Vec3f subCamAt; @@ -602,7 +609,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.y, pos.y, 0.3f, 200.0f); Math_ApproachF(&this->actor.world.pos.z, pos.z, 0.3f, 200.0f); - if ((this->state <= DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) { + if ((this->state <= DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) { Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BITE); if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); @@ -611,7 +618,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { this->state++; } - if (((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) || + if (((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) || (!(player->stateFlags2 & PLAYER_STATE2_80)) || ((this->collider.elements[0].info.bumperFlags & BUMP_HIT)) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT) || (this->collider.elements[2].info.bumperFlags & BUMP_HIT)) { @@ -619,12 +626,12 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { this->grabWaitTimer = 30; CutsceneManager_Stop(this->grabCsId); if (player->stateFlags2 & PLAYER_STATE2_80) { - player->unk_AE8 = 100; + player->actionVar2 = 100; } this->actor.flags &= ~ACTOR_FLAG_100000; - if ((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) { + if ((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) { this->timer = 3; this->actionFunc = EnDragon_RetreatOnceTimerEnds; } else { @@ -638,7 +645,7 @@ void EnDragon_SetupDead(EnDragon* this, PlayState* play) { CutsceneManager_Queue(this->deathCsId); } else { CutsceneManager_StartWithPlayerCs(this->deathCsId, &this->actor); - this->endFrame = Animation_GetLastFrame(&gDeepPythonSmallSideSwayAnim); + this->animEndFrame = Animation_GetLastFrame(&gDeepPythonSmallSideSwayAnim); Animation_Change(&this->skelAnime, &gDeepPythonSmallSideSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); this->timer = 20; this->actionFunc = EnDragon_Dead; @@ -682,7 +689,8 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { seahorsePos.y += -100.0f + BREG(33); seahorsePos.z += (Math_CosS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, - seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.csId, + seahorsePos.z, 0, this->actor.shape.rot.y, 0, + SEAHORSE_PARAMS(SEAHORSE_TYPE_1, 0, 0), this->actor.csId, this->actor.halfDaysBits, NULL)) { SET_WEEKEVENTREG(WEEKEVENTREG_13_01); switch (this->pythonIndex) { @@ -743,7 +751,7 @@ void EnDragon_UpdateDamage(EnDragon* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_DEAD); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_100000; this->action = DEEP_PYTHON_ACTION_SETUP_DEAD; this->actionFunc = EnDragon_SetupDead; 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 a35c8fa9b..fa0979389 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h @@ -53,8 +53,7 @@ typedef struct EnDragon { /* 0x2C8 */ s16 subCamId; /* 0x2CA */ s16 grabTimer; // Counts up from the time a grab starts until the time the actor begins attacking /* 0x2CC */ s16 unk_2CC; // Initialized, but never used - /* 0x2CE */ UNK_TYPE1 unk_2CE[0x2]; - /* 0x2D0 */ f32 endFrame; + /* 0x2D0 */ f32 animEndFrame; /* 0x2D4 */ f32 scale; /* 0x2D8 */ UNK_TYPE1 unk_2D8[0x4]; /* 0x2DC */ ColliderJntSph collider; 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 9fc28c952..e067b57b4 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,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimationInfo = { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; +typedef enum { + /* 0 */ WEDDING_DRESS_MANNEQUIN_ANIM_IDLE, + /* 1 */ WEDDING_DRESS_MANNEQUIN_ANIM_MAX +} WeddingDressMannequinAnimation; + +static AnimationInfoS sAnimationInfo[WEDDING_DRESS_MANNEQUIN_ANIM_MAX] = { + { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // WEDDING_DRESS_MANNEQUIN_ANIM_IDLE +}; void EnDrs_CollisionUpdate(EnDrs* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); @@ -61,11 +68,11 @@ void EnDrs_CollisionUpdate(EnDrs* this, PlayState* play) { void EnDrs_Setup(EnDrs* this, PlayState* play) { s32 pad[2]; - if ((this->moonMaskObjBankIndex >= 0) && SubS_IsObjectLoaded(this->moonMaskObjBankIndex, play)) { + if ((this->moonMaskObjectSlot > OBJECT_SLOT_NONE) && SubS_IsObjectLoaded(this->moonMaskObjectSlot, 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, &sAnimationInfo, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, WEDDING_DRESS_MANNEQUIN_ANIM_IDLE); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); @@ -80,7 +87,7 @@ void EnDrs_Idle(EnDrs* this, PlayState* play) { void EnDrs_Init(Actor* thisx, PlayState* play) { EnDrs* this = THIS; - this->moonMaskObjBankIndex = SubS_GetObjectIndex(OBJECT_MSMO, play); + this->moonMaskObjectSlot = SubS_GetObjectSlot(OBJECT_MSMO, play); this->actionFunc = EnDrs_Setup; } @@ -103,17 +110,17 @@ void EnDrs_Update(Actor* thisx, PlayState* play) { void EnDrs_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDrs* this = THIS; PlayState* play = play2; - s8 temp = this->moonMaskObjBankIndex; - s8 temp2 = this->actor.objBankIndex; + s8 temp = this->moonMaskObjectSlot; + s8 temp2 = this->actor.objectSlot; // Anju removes the Moon Mask at the start of the Couple's Mask cutscene // after that it will no longer be rendered. if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_87_02) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { OPEN_DISPS(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[temp].segment); gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp2].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[temp2].segment); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.h b/src/overlays/actors/ovl_En_Drs/z_en_drs.h index d811ae780..3c9803bf5 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.h +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.h @@ -16,7 +16,7 @@ typedef struct EnDrs { /* 0x18C */ ColliderCylinder collider; /* 0x1D8 */ Vec3s jointTable[WEDDING_DRESS_MANNEQUIN_LIMB_MAX]; /* 0x1F0 */ Vec3s morphTable[WEDDING_DRESS_MANNEQUIN_LIMB_MAX]; - /* 0x208 */ s8 moonMaskObjBankIndex; + /* 0x208 */ s8 moonMaskObjectSlot; } EnDrs; // size = 0x20C */ #endif // Z_EN_DRS_H 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 6c6b40318..8287c0680 100644 --- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c +++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c @@ -9,7 +9,7 @@ #include "z_en_ds2n.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnDs2n*)thisx) @@ -32,23 +32,24 @@ ActorInit En_Ds2n_InitVars = { (ActorFunc)EnDs2n_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gDs2nIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ ENDS2N_ANIM_IDLE, + /* 1 */ ENDS2N_ANIM_MAX +} EnDs2nAnimation; + +static AnimationInfo sAnimationInfo[ENDS2N_ANIM_MAX] = { + { &gDs2nIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENDS2N_ANIM_IDLE }; -static Vec3f sZeroVec = { 0, 0, 0 }; - -static TexturePtr sEyeTextures[] = { gDs2nEyeOpenTex, gDs2nEyeHalfTex, gDs2nEyeClosedTex }; - void EnDs2n_SetupIdle(EnDs2n* this) { this->blinkTimer = 20; this->blinkState = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENDS2N_ANIM_IDLE); this->actionFunc = EnDs2n_Idle; } void EnDs2n_Idle(EnDs2n* this, PlayState* play) { - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, DS2N_LIMB_MAX); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, DS2N_LIMB_MAX); } void EnDs2n_UpdateEyes(EnDs2n* this) { @@ -70,7 +71,7 @@ void EnDs2n_Init(Actor* thisx, PlayState* play) { EnDs2n* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gDs2nSkeleton, &gDs2nIdleAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gDs2nSkel, &gDs2nIdleAnim, NULL, NULL, 0); EnDs2n_SetupIdle(this); } @@ -103,12 +104,12 @@ s32 EnDs2n_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnDs2n_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDs2n* this = THIS; - Vec3f focusOffset = sZeroVec; + Vec3f focusOffset = { 0.0f, 0.0f, 0.0f }; if ((limbIndex == DS2N_LIMB_HIPS) || (limbIndex == DS2N_LIMB_LEFT_UPPER_ARM) || (limbIndex == DS2N_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (s16)Math_SinS(this->limbRotTableY[limbIndex]) * 0xC8; - rot->z += (s16)Math_CosS(this->limbRotTableZ[limbIndex]) * 0xC8; + rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200; + rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200; } if (limbIndex == DS2N_LIMB_HEAD) { @@ -116,6 +117,8 @@ void EnDs2n_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot } } +static TexturePtr sEyeTextures[] = { gDs2nEyeOpenTex, gDs2nEyeHalfTex, gDs2nEyeClosedTex }; + void EnDs2n_Draw(Actor* thisx, PlayState* play) { EnDs2n* this = THIS; diff --git a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h index f2a6c0725..4e759be0b 100644 --- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h +++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h @@ -13,8 +13,8 @@ typedef struct EnDs2n { /* 0x144 */ ColliderCylinder collider; // unused /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnDs2nActionFunc actionFunc; - /* 0x1D8 */ s16 limbRotTableY[DS2N_LIMB_MAX]; - /* 0x1FE */ s16 limbRotTableZ[DS2N_LIMB_MAX]; + /* 0x1D8 */ s16 fidgetTableY[DS2N_LIMB_MAX]; + /* 0x1FE */ s16 fidgetTableZ[DS2N_LIMB_MAX]; /* 0x224 */ Vec3s headRot; /* 0x22A */ Vec3s chestRot; // set by function, but not applied in limbdraw /* 0x230 */ s16 blinkState; diff --git a/src/overlays/actors/ovl_En_Dt/z_en_dt.c b/src/overlays/actors/ovl_En_Dt/z_en_dt.c index 0ac7dcb4b..e82d6d6e3 100644 --- a/src/overlays/actors/ovl_En_Dt/z_en_dt.c +++ b/src/overlays/actors/ovl_En_Dt/z_en_dt.c @@ -6,7 +6,7 @@ #include "z_en_dt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnDt*)thisx) diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 06b4308a0..b8dea95a0 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -16,8 +16,8 @@ void EnDyExtra_Destroy(Actor* thisx, PlayState* play); void EnDyExtra_Update(Actor* thisx, PlayState* play); void EnDyExtra_Draw(Actor* thisx, PlayState* play); -void func_80A61334(EnDyExtra* this, PlayState* play); -void func_80A613C8(EnDyExtra* this, PlayState* play); +void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play); +void EnDyExtra_Fall(EnDyExtra* this, PlayState* play); ActorInit En_Dy_Extra_InitVars = { ACTOR_EN_DY_EXTRA, @@ -41,35 +41,35 @@ void EnDyExtra_Init(Actor* thisx, PlayState* play) { this->actor.scale.x = 0.025f; this->actor.scale.y = 0.039f; this->actor.scale.z = 0.025f; - this->unk160 = this->actor.world.pos; + this->initPos = this->actor.world.pos; this->actor.gravity = -0.2f; - this->unk150 = 1.0f; - this->unk14C = 0x3C; - this->actionFunc = func_80A61334; + this->alphaScale = 1.0f; + this->timer = 60; + this->actionFunc = EnDyExtra_WaitForTrigger; } -void func_80A61334(EnDyExtra* this, PlayState* play) { +void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->actor.world.pos.y < -85.0f) { this->actor.velocity.y = 0.0f; } - if ((this->unk14C == 0) && (this->unk14A != 0)) { - this->unk14C = 0x32; - this->actionFunc = func_80A613C8; + if ((this->timer == 0) && this->trigger) { + this->timer = 50; + this->actionFunc = EnDyExtra_Fall; } } -void func_80A613C8(EnDyExtra* this, PlayState* play) { +void EnDyExtra_Fall(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); - if ((this->unk14C == 0) || (this->unk150 < 0.02f)) { + if ((this->timer == 0) || (this->alphaScale < 0.02f)) { Actor_Kill(&this->actor); return; } - this->unk150 -= 0.02f; + this->alphaScale -= 0.02f; if (this->actor.world.pos.y < -85.0f) { this->actor.velocity.y = 0.0f; @@ -79,36 +79,40 @@ void func_80A613C8(EnDyExtra* this, PlayState* play) { void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = THIS; - DECR(this->unk14C); + DECR(this->timer); Actor_PlaySfx(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); } +static Color_RGBA8 sPrimColors[] = { + { 255, 255, 170, 255 }, { 255, 170, 255, 255 }, { 255, 255, 170, 255 }, + { 170, 255, 255, 255 }, { 255, 255, 170, 255 }, +}; + +static Color_RGBA8 sEnvColors[] = { + { 255, 100, 0, 255 }, { 255, 0, 100, 255 }, { 100, 255, 0, 255 }, { 0, 100, 255, 255 }, { 255, 230, 0, 255 } +}; + +static u8 sAlphaTypeIndices[] = { + 2, 1, 1, 2, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2, 0, +}; + void EnDyExtra_Draw(Actor* thisx, PlayState* play) { - static Color_RGBA8 D_80A61740[] = { - { 255, 255, 170, 255 }, { 255, 170, 255, 255 }, { 255, 255, 170, 255 }, - { 170, 255, 255, 255 }, { 255, 255, 170, 255 }, - }; - static Color_RGBA8 D_80A61754[] = { - { 255, 100, 0, 255 }, { 255, 0, 100, 255 }, { 100, 255, 0, 255 }, { 0, 100, 255, 255 }, { 255, 230, 0, 255 } - }; - static u8 D_80A61768[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, - 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00 }; - EnDyExtra* this = THIS; s32 pad; + EnDyExtra* this = THIS; GraphicsContext* gfxCtx = play->state.gfxCtx; - Vtx* vertices = Lib_SegmentedToVirtual(object_dy_obj_Vtx_00DD40); + Vtx* vertices = Lib_SegmentedToVirtual(gGreatFairySpiralBeamVtx); s32 i; - u8 unk[3]; + u8 alphas[3]; - unk[0] = 0.0f; - unk[1] = (s8)(this->unk150 * 240.0f); - unk[2] = (s8)(this->unk150 * 255.0f); + alphas[0] = 0.0f; + alphas[1] = (s32)(this->alphaScale * 240.0f); + alphas[2] = (s32)(this->alphaScale * 255.0f); - for (i = 0; i < 27; i++) { - if (D_80A61768[i]) { - vertices[i].v.cn[3] = unk[D_80A61768[i]]; + for (i = 0; i < ARRAY_COUNT(sAlphaTypeIndices); i++) { + if (sAlphaTypeIndices[i]) { + vertices[i].v.cn[3] = alphas[sAlphaTypeIndices[i]]; } } @@ -120,10 +124,10 @@ void EnDyExtra_Draw(Actor* thisx, PlayState* play) { play->state.frames * -8, 0x10, 0x10)); gDPPipeSync(POLY_XLU_DISP++); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].r, D_80A61740[this->type].g, - D_80A61740[this->type].b, 255); - gDPSetEnvColor(POLY_XLU_DISP++, D_80A61754[this->type].r, D_80A61754[this->type].g, D_80A61754[this->type].b, 128); - gSPDisplayList(POLY_XLU_DISP++, object_dy_obj_DL_00DEF0); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sPrimColors[this->type].r, sPrimColors[this->type].g, + sPrimColors[this->type].b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->type].r, sEnvColors[this->type].g, sEnvColors[this->type].b, 128); + gSPDisplayList(POLY_XLU_DISP++, gGreatFairySpiralBeamDL); CLOSE_DISPS(gfxCtx); } 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 0e5d8614b..f36b12051 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 @@ -11,12 +11,11 @@ typedef struct EnDyExtra { /* 0x000 */ Actor actor; /* 0x144 */ EnDyExtraActionFunc actionFunc; /* 0x148 */ s16 type; - /* 0x14A */ s16 unk14A; - /* 0x14C */ s16 unk14C; - /* 0x14E */ s16 unk14E; - /* 0x150 */ f32 unk150; - /* 0x154 */ UNK_TYPE1 unk154[0xC]; - /* 0x160 */ Vec3f unk160; + /* 0x14A */ s16 trigger; + /* 0x14C */ s16 timer; + /* 0x150 */ f32 alphaScale; + /* 0x154 */ Vec3f scale; // not used, leftover from OoT + /* 0x160 */ Vec3f initPos; // set and not used } EnDyExtra; // size = 0x16C #endif // Z_EN_DY_EXTRA_H diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 1a54c8c33..775a14eb5 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -7,11 +7,12 @@ #include "z_en_egol.h" #include "objects/object_eg/object_eg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "overlays/actors/ovl_En_Estone/z_en_estone.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" +#include "overlays/actors/ovl_En_Estone/z_en_estone.h" #include "overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_80000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_80000000) #define THIS ((EnEgol*)thisx) @@ -40,25 +41,6 @@ typedef enum { /* 3 */ EYEGORE_EFFECT_DEBRIS } EnEgolEffectType; -typedef enum { - /* 0 */ EYEGORE_ANIM_STAND, - /* 1 */ EYEGORE_ANIM_WALK, - /* 2 */ EYEGORE_ANIM_SLAM, - /* 3 */ EYEGORE_ANIM_SLAM_WAIT, - /* 4 */ EYEGORE_ANIM_SLAM_END, - /* 5 */ EYEGORE_ANIM_DAMAGED, - /* 6 */ EYEGORE_ANIM_DEATH, - /* 7 */ EYEGORE_ANIM_LASER, - /* 8 */ EYEGORE_ANIM_LASER_END, // unused - /* 9 */ EYEGORE_ANIM_STUNNED, - /* 10 */ EYEGORE_ANIM_STUN_END, - /* 11 */ EYEGORE_ANIM_RETREAT, - /* 12 */ EYEGORE_ANIM_SIT, - /* 13 */ EYEGORE_ANIM_LEFT_PUNCH, - /* 14 */ EYEGORE_ANIM_RIGHT_PUNCH, - /* 15 */ EYEGORE_ANIM_MAX -} EnEgolAnimation; - typedef enum { /* 0 */ EYEGORE_LASER_OFF, /* 1 */ EYEGORE_LASER_START, @@ -305,23 +287,66 @@ ActorInit En_Egol_InitVars = { (ActorFunc)EnEgol_Draw, }; -void EnEgol_ChangeAnim(EnEgol* this, s32 animation) { - static AnimationHeader* sAnimations[EYEGORE_ANIM_MAX] = { - &gEyegoreStandAnim, &gEyegoreWalkAnim, &gEyegoreSlamAnim, - &gEyegoreSlamWaitAnim, &gEyegoreSlamEndAnim, &gEyegoreDamagedAnim, - &gEyegoreDeathAnim, &gEyegoreLaserAnim, &gEyegoreUnusedLaserEndAnim, - &gEyegoreStunnedAnim, &gEyegoreStunEndAnim, &gEyegoreRetreatAnim, - &gEyegoreSitAnim, &gEyegoreLeftPunchAnim, &gEyegoreRightPunchAnim, - }; - static u8 sAnimModes[EYEGORE_ANIM_MAX] = { - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, - }; - this->animation = animation; - this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animation]); - Animation_Change(&this->skelAnime, sAnimations[this->animation], 1.0f, 0.0f, this->animEndFrame, - sAnimModes[this->animation], 0.0f); +typedef enum { + /* 0 */ EYEGORE_ANIM_STAND, + /* 1 */ EYEGORE_ANIM_WALK, + /* 2 */ EYEGORE_ANIM_SLAM, + /* 3 */ EYEGORE_ANIM_SLAM_WAIT, + /* 4 */ EYEGORE_ANIM_SLAM_END, + /* 5 */ EYEGORE_ANIM_DAMAGED, + /* 6 */ EYEGORE_ANIM_DEATH, + /* 7 */ EYEGORE_ANIM_LASER, + /* 8 */ EYEGORE_ANIM_LASER_END, // unused + /* 9 */ EYEGORE_ANIM_STUNNED, + /* 10 */ EYEGORE_ANIM_STUN_END, + /* 11 */ EYEGORE_ANIM_RETREAT, + /* 12 */ EYEGORE_ANIM_SIT, + /* 13 */ EYEGORE_ANIM_LEFT_PUNCH, + /* 14 */ EYEGORE_ANIM_RIGHT_PUNCH, + /* 15 */ EYEGORE_ANIM_MAX +} EnEgolAnimation; + +static AnimationHeader* sAnimations[EYEGORE_ANIM_MAX] = { + &gEyegoreStandAnim, // EYEGORE_ANIM_STAND + &gEyegoreWalkAnim, // EYEGORE_ANIM_WALK + &gEyegoreSlamAnim, // EYEGORE_ANIM_SLAM + &gEyegoreSlamWaitAnim, // EYEGORE_ANIM_SLAM_WAIT + &gEyegoreSlamEndAnim, // EYEGORE_ANIM_SLAM_END + &gEyegoreDamagedAnim, // EYEGORE_ANIM_DAMAGED + &gEyegoreDeathAnim, // EYEGORE_ANIM_DEATH + &gEyegoreLaserAnim, // EYEGORE_ANIM_LASER + &gEyegoreUnusedLaserEndAnim, // EYEGORE_ANIM_LASER_END + &gEyegoreStunnedAnim, // EYEGORE_ANIM_STUNNED + &gEyegoreStunEndAnim, // EYEGORE_ANIM_STUN_END + &gEyegoreRetreatAnim, // EYEGORE_ANIM_RETREAT + &gEyegoreSitAnim, // EYEGORE_ANIM_SIT + &gEyegoreLeftPunchAnim, // EYEGORE_ANIM_LEFT_PUNCH + &gEyegoreRightPunchAnim, // EYEGORE_ANIM_RIGHT_PUNCH +}; + +static u8 sAnimationModes[EYEGORE_ANIM_MAX] = { + ANIMMODE_ONCE, // EYEGORE_ANIM_STAND + ANIMMODE_LOOP, // EYEGORE_ANIM_WALK + ANIMMODE_ONCE, // EYEGORE_ANIM_SLAM + ANIMMODE_ONCE, // EYEGORE_ANIM_SLAM_WAIT + ANIMMODE_ONCE, // EYEGORE_ANIM_SLAM_END + ANIMMODE_ONCE, // EYEGORE_ANIM_DAMAGED + ANIMMODE_ONCE, // EYEGORE_ANIM_DEATH + ANIMMODE_ONCE, // EYEGORE_ANIM_LASER + ANIMMODE_ONCE, // EYEGORE_ANIM_LASER_END + ANIMMODE_ONCE, // EYEGORE_ANIM_STUNNED + ANIMMODE_ONCE, // EYEGORE_ANIM_STUN_END + ANIMMODE_LOOP, // EYEGORE_ANIM_RETREAT + ANIMMODE_ONCE, // EYEGORE_ANIM_SIT + ANIMMODE_ONCE, // EYEGORE_ANIM_LEFT_PUNCH + ANIMMODE_ONCE, // EYEGORE_ANIM_RIGHT_PUNCH +}; + +void EnEgol_ChangeAnim(EnEgol* this, s32 animIndex) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], 0.0f); } void EnEgol_FootstepEffects(EnEgol* this, PlayState* play, f32 leftFootFrame, f32 rightFootFrame) { @@ -456,7 +481,7 @@ void EnEgol_Init(Actor* thisx, PlayState* play) { EYEGORE_SET_SPH_DIM(this->bodyCollider.elements[4], 300, 200, 0, 25, 1.0f); EYEGORE_SET_SPH_DIM(this->bodyCollider.elements[5], 2100, -300, 0, 37, 1.0f); - this->switchFlag = EYEGORE_GET_SWITCH(&this->actor); + this->switchFlag = EYEGORE_GET_SWITCH_FLAG(&this->actor); if (this->switchFlag == 0x7F) { this->switchFlag = -1; } @@ -908,7 +933,7 @@ void EnEgol_Slam(EnEgol* this, PlayState* play) { } EnEgol_DestroyBlocks(this, play, this->rightHandPos, this->leftHandPos); } - if (this->animEndFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnEgol_SetupSlamWait(this); } else if ((this->skelAnime.curFrame <= 17.0f) && (this->skelAnime.curFrame >= 10.0f)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); @@ -1034,7 +1059,7 @@ void EnEgol_Damaged(EnEgol* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEAD); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_100000; this->actionFunc = EnEgol_StartDeathCutscene; } @@ -1085,7 +1110,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { s32 i; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_EXPLOSION)); this->waitTimer = 30; Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); this->action = EYEGORE_ACTION_DEAD; @@ -1128,7 +1153,7 @@ void EnEgol_CollisionCheck(EnEgol* this, PlayState* play) { if ((this->action == EYEGORE_ACTION_STUNNED) || (this->action == EYEGORE_ACTION_SLAM_WAIT)) { 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); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); this->dmgEffectTimer = 20; reaction = EYEGORE_HIT_DAMAGE; } else if ((this->action >= EYEGORE_ACTION_WALK) && (this->action <= EYEGORE_ACTION_STUN_END) && @@ -1195,10 +1220,10 @@ void EnEgol_Update(Actor* thisx, PlayState* play) { if ((ABS_ALT(angleToFacing) > 0x1888) && (ABS_ALT(angleBehind) > 0x2000) && (this->actor.xzDistToPlayer < 100.0f)) { if (angleToFacing < 0) { - if (this->animation != EYEGORE_ANIM_LEFT_PUNCH) { + if (this->animIndex != EYEGORE_ANIM_LEFT_PUNCH) { EnEgol_ChangeAnim(this, EYEGORE_ANIM_LEFT_PUNCH); } - } else if (this->animation != EYEGORE_ANIM_RIGHT_PUNCH) { + } else if (this->animIndex != EYEGORE_ANIM_RIGHT_PUNCH) { EnEgol_ChangeAnim(this, EYEGORE_ANIM_RIGHT_PUNCH); } this->chargingLaser = false; @@ -1435,10 +1460,10 @@ void EnEgol_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot (limbIndex == EYEGORE_LIMB_RIGHT_HAND) || (limbIndex == EYEGORE_LIMB_UPPER_EYELID) || (limbIndex == EYEGORE_LIMB_LOWER_EYELID) || (limbIndex == EYEGORE_LIMB_HIPS) || (limbIndex == EYEGORE_LIMB_LEFT_SHIN) || (limbIndex == EYEGORE_LIMB_RIGHT_SHIN)) { - Matrix_MultZero(&this->limbPos[this->limbPosIndex]); - this->limbPosIndex++; - if (this->limbPosIndex >= ARRAY_COUNT(this->limbPos)) { - this->limbPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EYEGORE_BODYPART_MAX) { + this->bodyPartIndex = 0; } } Collider_UpdateSpheres(limbIndex, &this->bodyCollider); @@ -1461,7 +1486,7 @@ void EnEgol_Draw(Actor* thisx, PlayState* play2) { if (this->dmgEffectTimer != 0) { f32 drawDmgEffAlpha = 0.05f * this->dmgEffectTimer; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EYEGORE_BODYPART_MAX, 0.8f, 0.8f, drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); } if (this->laserState >= EYEGORE_LASER_FIRE) { diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.h b/src/overlays/actors/ovl_En_Egol/z_en_egol.h index e85e4b98a..0861ce580 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.h +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.h @@ -9,7 +9,7 @@ struct EnEgol; typedef void (*EnEgolActionFunc)(struct EnEgol*, PlayState*); #define EYEGORE_GET_PATH_INDEX(thisx) ((thisx)->params & 0x3F) -#define EYEGORE_GET_SWITCH(thisx) (((thisx)->params >> 6) & 0x7F) +#define EYEGORE_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 0x7F) #define EYEGORE_PATH_INDEX_NONE 0x3F @@ -29,6 +29,22 @@ typedef struct { /* 0x38 */ f32 scale; } EnEgolEffect; // size = 0x3C +typedef enum EyegoreBodyPart { + /* 0 */ EYEGORE_BODYPART_0, + /* 1 */ EYEGORE_BODYPART_1, + /* 2 */ EYEGORE_BODYPART_2, + /* 3 */ EYEGORE_BODYPART_3, + /* 4 */ EYEGORE_BODYPART_4, + /* 5 */ EYEGORE_BODYPART_5, + /* 6 */ EYEGORE_BODYPART_6, + /* 7 */ EYEGORE_BODYPART_7, + /* 8 */ EYEGORE_BODYPART_8, + /* 9 */ EYEGORE_BODYPART_9, + /* 10 */ EYEGORE_BODYPART_10, + /* 11 */ EYEGORE_BODYPART_11, + /* 12 */ EYEGORE_BODYPART_MAX +} EyegoreBodyPart; + typedef struct EnEgol { /* 0x0000 */ Actor actor; /* 0x0144 */ SkelAnime skelAnime; @@ -43,10 +59,10 @@ typedef struct EnEgol { /* 0x02B4 */ s16 headRot; /* 0x02BA */ s16 switchFlag; /* 0x02BC */ s16 dmgEffectTimer; - /* 0x02C0 */ Vec3f limbPos[12]; - /* 0x0350 */ s16 limbPosIndex; + /* 0x02C0 */ Vec3f bodyPartsPos[EYEGORE_BODYPART_MAX]; + /* 0x0350 */ s16 bodyPartIndex; /* 0x0352 */ s16 pathIndex; - /* 0x0354 */ s32 animation; + /* 0x0354 */ s32 animIndex; /* 0x0358 */ u8 isRetreating; /* 0x035C */ f32 animEndFrame; /* 0x0360 */ f32 wakeupRange; 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 3dc6e4a72..53864ab9c 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -5,7 +5,6 @@ */ #include "z_en_elf.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) @@ -298,7 +297,7 @@ void func_8088CC48(EnElf* this, PlayState* play) { func_8088CBAC(this, play); this->unk_25C = 0; this->disappearTimer = 240; - if ((this->fairyFlags & 0x400) && Flags_GetCollectible(play, this->unk_260)) { + if ((this->fairyFlags & 0x400) && Flags_GetCollectible(play, this->collectibleFlag)) { Actor_Kill(&this->actor); } } @@ -320,11 +319,11 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { EnElf* this = THIS; Player* player = GET_PLAYER(play); s32 colorConfig; - s32 params; + s32 fairyType; Actor_ProcessInitChain(thisx, sInitChain); SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, - this->morphTable, 7); + this->morphTable, FAIRY_LIMB_MAX); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); thisx->shape.shadowAlpha = 255; @@ -340,15 +339,15 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_240 = 0.0f; colorConfig = 0; - this->unk_260 = ENELF_GET_FE00(&this->actor); - params = ENELF_GET_F(&this->actor); - if (thisx->params & 0x100) { + this->collectibleFlag = FAIRY_GET_COLLECTIBLE_FLAG(&this->actor); + fairyType = FAIRY_GET_TYPE(&this->actor); + if (FAIRY_GET_BOOL_PARAM(thisx)) { this->fairyFlags |= 0x400; } - this->actor.params = params; - switch (params) { - case 0: + this->actor.params = fairyType; + switch (fairyType) { + case FAIRY_TYPE_0: thisx->room = -1; EnElf_SetupAction(this, func_8088E850); func_8088C51C(this, 0); @@ -364,7 +363,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_266 = QuestHint_GetTatlTextId(play); break; - case 1: + case FAIRY_TYPE_1: colorConfig = -1; gSaveContext.jinxTimer = 0; EnElf_SetupAction(this, func_8088E0F0); @@ -376,7 +375,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_250 = 0.0f; break; - case 5: + case FAIRY_TYPE_5: colorConfig = -1; EnElf_SetupAction(this, func_8088E484); this->unk_254 = 0.0f; @@ -387,7 +386,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->unk_250 = 7.0f; break; - case 7: + case FAIRY_TYPE_7: this->fairyFlags |= 0x200; thisx->shape.shadowDraw = ActorShadow_DrawWhiteCircle; this->fairyFlags |= 0x100; @@ -397,7 +396,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 2: + case FAIRY_TYPE_2: this->fairyFlags |= 0x100; colorConfig = -1; this->fairyFlags |= 0x800; @@ -406,7 +405,7 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 6: + case FAIRY_TYPE_6: colorConfig = -1; this->fairyFlags |= 0x800; this->fairyFlags |= 0x2000; @@ -414,25 +413,25 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { func_8088CC48(this, play); break; - case 9: + case FAIRY_TYPE_9: this->fairyFlags |= 0x1000; - case 10: + case FAIRY_TYPE_10: colorConfig = -2; func_8088CC48(this, play); break; - case 8: + case FAIRY_TYPE_8: Actor_Kill(thisx); return; - case 3: + case FAIRY_TYPE_3: colorConfig = Rand_ZeroFloat(11.99f) + 1.0f; EnElf_SetupAction(this, func_8088E018); func_8088C51C(this, 0); break; - case 4: + case FAIRY_TYPE_4: EnElf_SetupAction(this, func_8088E0E0); func_8088C51C(this, 6); this->fairyFlags |= 8; @@ -441,10 +440,13 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { for (i = 0; i < 8; i++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, thisx->world.pos.x, thisx->world.pos.y - 30.0f, - thisx->world.pos.z, 0, 0, 0, 6); + thisx->world.pos.z, 0, 0, 0, FAIRY_PARAMS(FAIRY_TYPE_6, false, 0)); } } break; + + default: + break; } this->unk_23C = 3.0f; @@ -652,14 +654,14 @@ void func_8088DD34(EnElf* this, PlayState* play) { func_8088CBAC(this, play); if (this->fairyFlags & 0x800) { - this->unk_224.y = player->bodyPartsPos[0].y; + this->unk_224.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y; } func_8088D8D0(this, &this->unk_224); func_8088D9BC(this, play); if (Actor_HasParent(&this->actor, play)) { if (this->fairyFlags & 0x400) { - Flags_SetCollectible(play, this->unk_260); + Flags_SetCollectible(play, this->collectibleFlag); } Actor_Kill(&this->actor); return; @@ -689,7 +691,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { this->unk_246 = 0; EnElf_SetupAction(this, func_8088E0F0); if (this->fairyFlags & 0x400) { - Flags_SetCollectible(play, this->unk_260); + Flags_SetCollectible(play, this->collectibleFlag); } return; } @@ -742,7 +744,7 @@ void func_8088E0F0(EnElf* this, PlayState* play) { if (this->unk_250 < 2.0f) { this->unk_250 += 0.1f; } else { - gSaveContext.healthAccumulator = 160; + gSaveContext.healthAccumulator = 0xA0; this->unk_246++; } break; @@ -882,7 +884,7 @@ void func_8088E60C(EnElf* this, PlayState* play) { void func_8088E850(EnElf* this, PlayState* play) { Vec3f nextPos; Player* player = GET_PLAYER(play); - Actor* arrowPointedActor; + Actor* targetFairyActor; f32 xScale; f32 distFromLinksHead; u32 cueChannel; @@ -968,15 +970,15 @@ void func_8088E850(EnElf* this, PlayState* play) { break; default: - arrowPointedActor = play->actorCtx.targetContext.arrowPointedActor; + targetFairyActor = play->actorCtx.targetCtx.fairyActor; if ((player->stateFlags1 & PLAYER_STATE1_40) && (player->talkActor != NULL)) { Math_Vec3f_Copy(&nextPos, &player->talkActor->focus.pos); } else { - Math_Vec3f_Copy(&nextPos, &play->actorCtx.targetContext.unk0); + Math_Vec3f_Copy(&nextPos, &play->actorCtx.targetCtx.fairyPos); } nextPos.y += 1500.0f * this->actor.scale.y; - if (arrowPointedActor != NULL) { + if (targetFairyActor != NULL) { func_8088DB4C(this, &nextPos, 0.0f, 30.0f, 0.2f); if (this->actor.speed >= 5.0f) { func_8088F5F4(this, play, 0x10); @@ -1037,7 +1039,7 @@ void func_8088EF18(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* curCol } void func_8088EFA4(EnElf* this, PlayState* play) { - Actor* arrayPointerActor = play->actorCtx.targetContext.arrowPointedActor; + Actor* targetFairyActor = play->actorCtx.targetCtx.fairyActor; Player* player = GET_PLAYER(play); f32 transitionRate; @@ -1062,35 +1064,35 @@ void func_8088EFA4(EnElf* this, PlayState* play) { this->outerColor.b = 80.0f; this->outerColor.a = 0.0f; } - } else if (play->actorCtx.targetContext.unk40 != 0.0f) { + } else if (play->actorCtx.targetCtx.fairyMoveProgressFactor != 0.0f) { this->unk_268 = 0; this->unk_238 = 1.0f; if (!this->unk_269) { Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); } } else if (this->unk_268 == 0) { - if ((arrayPointerActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetContext.unk0) < 50.0f)) { + if ((targetFairyActor == NULL) || + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetCtx.fairyPos) < 50.0f)) { this->unk_268 = 1; } } else if (this->unk_238 != 0.0f) { if (Math_StepToF(&this->unk_238, 0.0f, 0.25f)) { - this->innerColor = play->actorCtx.targetContext.fairyInner; - this->outerColor = play->actorCtx.targetContext.fairyOuter; + this->innerColor = play->actorCtx.targetCtx.fairyInnerColor; + this->outerColor = play->actorCtx.targetCtx.fairyOuterColor; } else { transitionRate = 0.25f / this->unk_238; - func_8088EF18(&this->innerColor, &play->actorCtx.targetContext.fairyInner, &this->innerColor, + func_8088EF18(&this->innerColor, &play->actorCtx.targetCtx.fairyInnerColor, &this->innerColor, transitionRate); - func_8088EF18(&this->outerColor, &play->actorCtx.targetContext.fairyOuter, &this->outerColor, + func_8088EF18(&this->outerColor, &play->actorCtx.targetCtx.fairyOuterColor, &this->outerColor, transitionRate); } } if (this->fairyFlags & 1) { - if ((arrayPointerActor == NULL) || (player->targetedActor == NULL)) { + if ((targetFairyActor == NULL) || (player->lockOnActor == NULL)) { this->fairyFlags ^= 1; } - } else if ((arrayPointerActor != NULL) && (player->targetedActor != NULL)) { + } else if ((targetFairyActor != NULL) && (player->lockOnActor != NULL)) { u8 temp = this->unk_269; u16 targetSfxId = (this->unk_269 == 0) ? NA_SE_NONE : NA_SE_NONE; @@ -1103,7 +1105,7 @@ void func_8088EFA4(EnElf* this, PlayState* play) { void func_8088F214(EnElf* this, PlayState* play) { s32 sp34; - Actor* arrowPointedActor; + Actor* targetFairyActor; Player* player = GET_PLAYER(play); s32 pad; @@ -1132,14 +1134,14 @@ void func_8088F214(EnElf* this, PlayState* play) { } } else if (this->unk_264 & 8) { sp34 = 1; - func_800B9010(&this->actor, NA_SE_EV_BELL_ANGER - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_BELL_ANGER - SFX_FLAG); } else { - arrowPointedActor = play->actorCtx.targetContext.arrowPointedActor; + targetFairyActor = play->actorCtx.targetCtx.fairyActor; if (player->stateFlags1 & PLAYER_STATE1_400) { sp34 = 10; this->unk_25C = 100; - } else if ((arrowPointedActor == NULL) || (arrowPointedActor->category == 4)) { - if (arrowPointedActor != NULL) { + } else if ((targetFairyActor == NULL) || (targetFairyActor->category == ACTORCAT_NPC)) { + if (targetFairyActor != NULL) { this->unk_25C = 100; player->stateFlags2 |= PLAYER_STATE2_100000; sp34 = 0; @@ -1278,13 +1280,13 @@ void func_8088FA38(EnElf* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->fairyFlags & 0x10) { - refPos = play->actorCtx.targetContext.unk0; + refPos = play->actorCtx.targetCtx.fairyPos; if (this->unk_234 != NULL) { refPos = this->unk_234->world.pos; } else { - if ((player->targetedActor == NULL) || (&player->actor == player->targetedActor) || - (&this->actor == player->targetedActor) || (this->unk_264 & 4)) { + if ((player->lockOnActor == NULL) || (&player->actor == player->lockOnActor) || + (&this->actor == player->lockOnActor) || (this->unk_264 & 4)) { refPos.x = player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); refPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f; @@ -1321,7 +1323,7 @@ void func_8088FC34(EnElf* this, PlayState* play) { } else { Math_StepToF(&this->unk_240, 1.0f, 0.05f); } - func_800FD2B4(play, SQ(this->unk_240), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); + Environment_AdjustLights(play, SQ(this->unk_240), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); } } @@ -1367,11 +1369,11 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { if (play->msgCtx.currentTextId == 0x202) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); break; case 1: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); break; } } @@ -1460,7 +1462,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { gSaveContext.save.saveInfo.playerData.tatlTimer = 0; } - if ((player->tatlTextId == 0) && (player->targetedActor == NULL)) { + if ((player->tatlTextId == 0) && (player->lockOnActor == NULL)) { if ((gSaveContext.save.saveInfo.playerData.tatlTimer >= 600) && (gSaveContext.save.saveInfo.playerData.tatlTimer <= 3000)) { player->tatlTextId = QuestHint_GetTatlTextId(play); @@ -1472,7 +1474,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { } if (Actor_ProcessTalkRequest(thisx, &play->state)) { - func_8019FDC8(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); + Audio_PlaySfx_AtPosWithReverb(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); thisx->focus.pos = thisx->world.pos; if (thisx->textId == QuestHint_GetTatlTextId(play)) { @@ -1519,8 +1521,8 @@ void func_8089010C(Actor* thisx, PlayState* play) { this->elfMsg = NULL; this->timer++; - if ((this->unk_240 >= 0.0f) && - func_800FD2B4(play, SQ(this->unk_240) * this->unk_240, player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f)) { + if ((this->unk_240 >= 0.0f) && Environment_AdjustLights(play, SQ(this->unk_240) * this->unk_240, + player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f)) { Math_StepToF(&this->unk_240, -0.05f, 0.05f); } @@ -1554,7 +1556,7 @@ s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Vec3f sp34; f32 scale; - if (limbIndex == 6) { + if (limbIndex == FAIRY_LIMB_6) { scale = ((Math_SinS(this->timer * 4096) * 0.1f) + 1.0f) * 0.012f; if (this->fairyFlags & 0x200) { scale *= 2.0f; @@ -1566,8 +1568,11 @@ s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); } + //! @note: `limbIndex` extends past `FAIRY_LIMB_MAX`. + //! This code was copied from OoT despite the number of limbs decreasing. + //! In OoT, this was intented to not draw wings for big fairies if ((this->fairyFlags & 0x200) && - ((limbIndex == 4) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 14))) { + ((limbIndex == FAIRY_LIMB_4) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 14))) { *dList = NULL; } return false; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index 18e444e97..dbc1e191d 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -2,20 +2,38 @@ #define Z_EN_ELF_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" struct EnElf; typedef void (*EnElfActionFunc)(struct EnElf*, PlayState*); typedef void (*EnElfUnkFunc)(struct EnElf*, PlayState*); -#define ENELF_GET_F(thisx) ((thisx)->params & 0xF) -#define ENELF_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define FAIRY_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define FAIRY_GET_BOOL_PARAM(thisx) ((thisx)->params & 0x100) +#define FAIRY_GET_COLLECTIBLE_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) + +#define FAIRY_PARAMS(type, boolParam, collectibleFlag) (((type) /* & 0xF */) | (((boolParam) & 0x1) << 8) | ((((collectibleFlag) & 0x7F) << 9) & 0xFE00)) + +typedef enum { + /* 0x0 */ FAIRY_TYPE_0, + /* 0x1 */ FAIRY_TYPE_1, + /* 0x2 */ FAIRY_TYPE_2, + /* 0x3 */ FAIRY_TYPE_3, + /* 0x4 */ FAIRY_TYPE_4, + /* 0x5 */ FAIRY_TYPE_5, + /* 0x6 */ FAIRY_TYPE_6, + /* 0x7 */ FAIRY_TYPE_7, + /* 0x8 */ FAIRY_TYPE_8, + /* 0x9 */ FAIRY_TYPE_9, + /* 0xA */ FAIRY_TYPE_10 +} FairyType; typedef struct EnElf { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[7]; - /* 0x1B2 */ Vec3s morphTable[7]; + /* 0x188 */ Vec3s jointTable[FAIRY_LIMB_MAX]; + /* 0x1B2 */ Vec3s morphTable[FAIRY_LIMB_MAX]; /* 0x1DC */ Color_RGBAf innerColor; /* 0x1EC */ Color_RGBAf outerColor; /* 0x1FC */ LightInfo lightInfoGlow; @@ -39,7 +57,7 @@ typedef struct EnElf { /* 0x25A */ u16 timer; /* 0x25C */ s16 unk_25C; /* 0x25E */ s16 disappearTimer; - /* 0x260 */ s16 unk_260; + /* 0x260 */ s16 collectibleFlag; /* 0x262 */ u16 fairyFlags; /* 0x264 */ u16 unk_264; /* 0x266 */ u16 unk_266; @@ -49,15 +67,4 @@ typedef struct EnElf { /* 0x270 */ EnElfActionFunc actionFunc; } EnElf; // size = 0x274 -typedef enum { - /* 0 */ ENELF_TYPE_0, - /* 1 */ ENELF_TYPE_1, - /* 2 */ ENELF_TYPE_2, - /* 3 */ ENELF_TYPE_3, - /* 4 */ ENELF_TYPE_4, - /* 5 */ ENELF_TYPE_5, - /* 6 */ ENELF_TYPE_6, - /* 7 */ ENELF_TYPE_7 -} FairyType; - #endif // Z_EN_ELF_H diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index 2584a1c73..c9d86e4f6 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Elforg/z_en_elforg.h" #include "objects/object_bubble/object_bubble.h" -#define FLAGS (ACTOR_FLAG_1) +#define FLAGS (ACTOR_FLAG_TARGETABLE) #define THIS ((EnElfbub*)thisx) @@ -56,7 +56,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) { EnElfbub* this = THIS; Actor* childActor; - if (Flags_GetSwitch(play, ENELFBUB_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENELFBUB_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -73,16 +73,17 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - childActor = Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_ELFORG, this->actor.world.pos.x, this->actor.world.pos.y + 12.0f, - this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, - STRAY_FAIRY_PARAMS(ENELFBUB_GET_SWITCHFLAG(&this->actor), 0, STRAY_FAIRY_TYPE_BUBBLE)); + childActor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELFORG, this->actor.world.pos.x, + this->actor.world.pos.y + 12.0f, this->actor.world.pos.z, this->actor.world.rot.x, + this->actor.world.rot.y, this->actor.world.rot.z, + STRAY_FAIRY_PARAMS(ENELFBUB_GET_SWITCH_FLAG(&this->actor), + STRAY_FAIRY_AREA_CLOCK_TOWN, STRAY_FAIRY_TYPE_BUBBLE)); if (childActor != NULL) { childActor->parent = &this->actor; } this->oscillationAngle = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void EnElfbub_Destroy(Actor* thisx, PlayState* play) { @@ -140,6 +141,7 @@ void EnElfbub_Idle(EnElfbub* this, PlayState* play) { void EnElfbub_Update(Actor* thisx, PlayState* play) { EnElfbub* this = THIS; + Collider_UpdateCylinder(&this->actor, &this->collider); this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->actor.shape.yOffset); diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h index 50c6bd672..d115ab91c 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h @@ -3,7 +3,7 @@ #include "global.h" -#define ENELFBUB_GET_SWITCHFLAG(thisx) ((((thisx)->params) & 0xFE00) >> 9) +#define ENELFBUB_GET_SWITCH_FLAG(thisx) ((((thisx)->params) & 0xFE00) >> 9) struct EnElfbub; diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index cacef3f4d..3eb2e357b 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -1,11 +1,38 @@ -/* - * File: z_en_elfgrp.c +/** + * @file z_en_elfgrp.c * Overlay: ovl_En_Elfgrp - * Description: Group of Stray Fairies in Fairy Fountain + * Description: Manager for group of Stray Fairies and Great Fairy in Fairy's Fountains + * + * There are many different quantities associated to the Stray Fairies in each of the 3 places (missing, in the + * Fountain, held by Player) + * - Total number of fairies (always 25 in the original game) + * - Original number in the Fountain (24 for Clock Town Fairy Fountain, 10 for the other 4) + * - Current number in the Fountain (bitpacked in Fountain scene flags, see below) + * - Total number found (stored in save context) + * - Current number held (i.e. found but not returned) + * + * The permanentSceneFlags for Fairy Fountains used in this actor are of the form + * ```c + * struct { + * u32 clockTown : 1; + * u32 fountains[4] : 5; + * } FairyFountains; + * ``` + * where arg1 is: + * - 0: Clock Town + * - 1: Woodfall, + * - 2: Snowhead, + * - 3: Great Bay, + * - 4: Ikana + * + * Clock Town is handled separately, and then the fountains are looked up with manual array indexing + * + * @note Clock Town is handled separately in a number of places */ #include "z_en_elfgrp.h" #include "overlays/actors/ovl_En_Elforg/z_en_elforg.h" +#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #define FLAGS (ACTOR_FLAG_10) @@ -17,24 +44,28 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play); void EnElfgrp_Destroy(Actor* thisx, PlayState* play); void EnElfgrp_Update(Actor* thisx, PlayState* play); -s32 func_80A39BD0(PlayState* play, s32 arg2); -s32 func_80A39C1C(PlayState* play, s32 arg1); -void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3); -void func_80A3A0AC(EnElfgrp* this, PlayState* play); -void func_80A3A0F4(EnElfgrp* this, PlayState* play); -void func_80A3A210(EnElfgrp* this, PlayState* play); -void func_80A3A274(EnElfgrp* this, PlayState* play); +s32 EnElfgrp_GetHeldFairiesCount(PlayState* play, s32 type); +s32 EnElfgrp_GetFountainFairiesCount(PlayState* play, s32 type); +void EnElfgrp_SpawnStrayFairies(EnElfgrp* this, PlayState* play, s32 count, s32 fairyType); void func_80A3A398(EnElfgrp* this, PlayState* play); -void func_80A3A484(EnElfgrp* this, PlayState* play); -void func_80A3A4AC(EnElfgrp* this, PlayState* play); void func_80A3A520(EnElfgrp* this, PlayState* play); -void func_80A3A600(EnElfgrp* this, PlayState* play); -void func_80A3A610(EnElfgrp* this, PlayState* play); -void func_80A3A6F4(EnElfgrp* this, PlayState* play); -void func_80A3A77C(EnElfgrp* this, PlayState* play); +void EnElfgrp_DoNothing(EnElfgrp* this, PlayState* play); void func_80A3A7FC(EnElfgrp* this, PlayState* play); void func_80A3A8F8(EnElfgrp* this, PlayState* play); +// State flags +#define ELFGRP_STATE_0 (1 << 0) +#define ELFGRP_STATE_1 (1 << 1) +#define ELFGRP_STATE_2 (1 << 2) +#define ELFGRP_STATE_3 (1 << 3) +#define ELFGRP_STATE_4 (1 << 4) + +// Used for the type in EnElfgrp_SpawnStrayFairies +typedef enum ElfgrpSpawnedFairyTypes { + /* 0 */ SPAWNED_STRAY_FAIRY_TYPE_PRESENT, // STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN + /* 1 */ SPAWNED_STRAY_FAIRY_TYPE_RETURNING // STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN +} ElfgrpSpawnedFairyTypes; + ActorInit En_Elfgrp_InitVars = { ACTOR_EN_ELFGRP, ACTORCAT_PROP, @@ -47,7 +78,15 @@ ActorInit En_Elfgrp_InitVars = { (ActorFunc)NULL, }; -void func_80A396B0(EnElfgrp* this, s32 numCutscenes) { +/** + * Set the actor's cutscene id to a later one, or -1 if run out. + * + * @note This is only expected to be called in Init when this actor has the first cutscene set, but can also work for + * later cutscenes if \p numCutscenes is set correcly. + * + * @param numCutscenes Number of cutscenes in the list to skip forward to set this one. + */ +void EnElfgrp_SetCutscene(EnElfgrp* this, s32 numCutscenes) { while (numCutscenes > 0) { if (this->actor.csId == CS_ID_NONE) { break; @@ -61,115 +100,123 @@ void func_80A396B0(EnElfgrp* this, s32 numCutscenes) { void EnElfgrp_Init(Actor* thisx, PlayState* play) { s32 pad; EnElfgrp* this = THIS; - s32 sp24; + s32 numberInFountain; - this->unk_147 = ENELFGRP_GET(&this->actor); + this->type = ENELFGRP_GET_TYPE(&this->actor); this->unk_148 = 0; - this->unk_14A = 0; + this->stateFlags = 0; this->actor.focus.pos.y += 40.0f; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - switch (this->unk_147) { - case ENELFGRP_1: - case ENELFGRP_2: - case ENELFGRP_3: - case ENELFGRP_4: - this->unk_148 = this->unk_147 - 1; - sp24 = func_80A39C1C(play, this->unk_147); - this->unk_146 = 1 << this->unk_147; + switch (this->type) { + case ENELFGRP_TYPE_POWER: + case ENELFGRP_TYPE_WISDOM: + case ENELFGRP_TYPE_COURAGE: + case ENELFGRP_TYPE_KINDNESS: + this->unk_148 = this->type - 1; + numberInFountain = EnElfgrp_GetFountainFairiesCount(play, this->type); + this->talkedOnceFlag = 1 << this->type; - if (sp24 < 25) { - func_80A39DC8(this, play, sp24, 0); + if (numberInFountain < STRAY_FAIRY_TOTAL) { + EnElfgrp_SpawnStrayFairies(this, play, numberInFountain, SPAWNED_STRAY_FAIRY_TYPE_PRESENT); } - if (sp24 >= 25) { + if (numberInFountain >= STRAY_FAIRY_TOTAL) { this->actionFunc = func_80A3A520; - func_80A396B0(this, 2); - return; + EnElfgrp_SetCutscene(this, 2); + break; } - if ((func_80A39BD0(play, this->unk_147) + sp24) >= 25) { + if ((EnElfgrp_GetHeldFairiesCount(play, this->type) + numberInFountain) >= STRAY_FAIRY_TOTAL) { this->actionFunc = func_80A3A398; - switch (this->unk_147) { - case ENELFGRP_1: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_02)) { - func_80A396B0(this, 1); + switch (this->type) { + case ENELFGRP_TYPE_POWER: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_OBTAINED_GREAT_SPIN_ATTACK)) { + EnElfgrp_SetCutscene(this, 1); } else { - this->unk_14A |= 4; + this->stateFlags |= ELFGRP_STATE_2; } break; - case ENELFGRP_2: + case ENELFGRP_TYPE_WISDOM: if (gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired == true) { - func_80A396B0(this, 1); + EnElfgrp_SetCutscene(this, 1); } break; - case ENELFGRP_3: + case ENELFGRP_TYPE_COURAGE: if (gSaveContext.save.saveInfo.playerData.doubleDefense) { - func_80A396B0(this, 1); + EnElfgrp_SetCutscene(this, 1); } break; - case ENELFGRP_4: + case ENELFGRP_TYPE_KINDNESS: if (INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) == ITEM_SWORD_GREAT_FAIRY) { - func_80A396B0(this, 1); + EnElfgrp_SetCutscene(this, 1); } else { - this->unk_14A |= 0x10; + this->stateFlags |= ELFGRP_STATE_4; } break; + + default: + break; } - } else if (func_80A39BD0(play, this->unk_147)) { + } else if (EnElfgrp_GetHeldFairiesCount(play, this->type)) { this->actionFunc = func_80A3A7FC; - this->actor.textId = (this->unk_147 * 3) + 0x581; + this->actor.textId = (this->type * 3) + 0x581; } else { this->actionFunc = func_80A3A8F8; - if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->unk_146)) { - this->actor.textId = (this->unk_147 * 3) + 0x580; + + if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->talkedOnceFlag)) { // talked for first time + this->actor.textId = (this->type * 3) + 0x580; } else { - this->actor.textId = (this->unk_147 * 3) + 0x57F; + this->actor.textId = (this->type * 3) + 0x57F; } } break; - default: - sp24 = func_80A39C1C(play, 0); - this->unk_146 = ENELFGRP_1; - if (sp24 >= 25) { + default: // ENELFGRP_TYPE_MAGIC + numberInFountain = EnElfgrp_GetFountainFairiesCount(play, ENELFGRP_TYPE_MAGIC); + this->talkedOnceFlag = 1 << ENELFGRP_TYPE_MAGIC; + + if (numberInFountain >= STRAY_FAIRY_TOTAL) { this->actionFunc = func_80A3A520; - if ((this->actor.home.rot.z != 0) && Flags_GetSwitch(play, this->actor.home.rot.z)) { - this->actionFunc = func_80A3A600; + + if ((ENELFGRP_GET_SWITCHFLAG_ROT(&this->actor) != 0) && + Flags_GetSwitch(play, ENELFGRP_GET_SWITCHFLAG_ROT(&this->actor))) { + this->actionFunc = EnElfgrp_DoNothing; } else if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { - func_80A396B0(this, 4); + EnElfgrp_SetCutscene(this, 4); } else if (INV_CONTENT(ITEM_MASK_DEKU) != ITEM_MASK_DEKU) { - func_80A396B0(this, 5); + EnElfgrp_SetCutscene(this, 5); } else { - this->unk_14A |= 2; - func_80A396B0(this, 6); + this->stateFlags |= ELFGRP_STATE_1; + EnElfgrp_SetCutscene(this, 6); } } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_80)) { - func_80A39DC8(this, play, 24, 0); + EnElfgrp_SpawnStrayFairies(this, play, STRAY_FAIRY_TOTAL - 1, SPAWNED_STRAY_FAIRY_TYPE_PRESENT); this->actionFunc = func_80A3A398; + if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { - func_80A396B0(this, 2); + EnElfgrp_SetCutscene(this, 2); } else { - func_80A396B0(this, 3); - this->unk_14A |= 2; + EnElfgrp_SetCutscene(this, 3); + this->stateFlags |= ELFGRP_STATE_1; } } else if (gSaveContext.save.saveInfo.playerData.isMagicAcquired == true) { - func_80A396B0(this, 1); + EnElfgrp_SetCutscene(this, 1); } } else { - func_80A39DC8(this, play, 24, 0); + EnElfgrp_SpawnStrayFairies(this, play, STRAY_FAIRY_TOTAL - 1, SPAWNED_STRAY_FAIRY_TYPE_PRESENT); this->actionFunc = func_80A3A8F8; - if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->unk_146)) { + if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->talkedOnceFlag)) { this->actor.textId = 0x580; } else { this->actor.textId = 0x578; } - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); } break; } @@ -178,116 +225,119 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { void EnElfgrp_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80A39BD0(PlayState* play, s32 arg2) { - if ((arg2 < 1) || (arg2 >= 5)) { +// Number of Stray Fairies currently held by Player +s32 EnElfgrp_GetHeldFairiesCount(PlayState* play, s32 type) { + if ((type <= ENELFGRP_TYPE_MAGIC) || (type > ENELFGRP_TYPE_KINDNESS)) { return 0; } - return (((void)0, gSaveContext.save.saveInfo.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(play, arg2)) + 10; + // Number in fountain originally + total number collected - number currently in fountain + return (STRAY_FAIRY_TOTAL - STRAY_FAIRY_SCATTERED_TOTAL) + + ((void)0, gSaveContext.save.saveInfo.inventory.strayFairies[type - 1]) - + EnElfgrp_GetFountainFairiesCount(play, type); } -s32 func_80A39C1C(PlayState* play, s32 arg1) { - // the permanentSceneFlags access here is in the form - // struct { - // u32 clockTown : 1; - // u32 fountains[4] : 5; - // } FairyFountains; - // where arg1 is: - // 0: clocktown - // 1: woodfall, - // 2: snowhead, - // 3: great bay, - // 4: stone tower - // clocktown is handled separately, and then the fountains are looked up as array indexing +// Number of Stray Fairies in currently in Fountain +s32 EnElfgrp_GetFountainFairiesCount(PlayState* play, s32 type) { + s32 numberInFountain; - s32 temp_v1; - - if ((arg1 < 0) || (arg1 >= 5)) { + if ((type < ENELFGRP_TYPE_MAGIC) || (type > ENELFGRP_TYPE_KINDNESS)) { return 0; } - if (arg1 == 0) { + if (type == ENELFGRP_TYPE_MAGIC) { if (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 1) { - return 25; + return STRAY_FAIRY_TOTAL; + } else { + return STRAY_FAIRY_TOTAL - 1; } - return 24; } - temp_v1 = (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; - if (temp_v1 < 10) { - temp_v1 = 10; - } else if (temp_v1 > 25) { - temp_v1 = 25; + numberInFountain = + (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 >> (((type - 1) * 5) + 1)) & 0x1F; + if (numberInFountain < STRAY_FAIRY_TOTAL - STRAY_FAIRY_SCATTERED_TOTAL) { + numberInFountain = STRAY_FAIRY_TOTAL - STRAY_FAIRY_SCATTERED_TOTAL; + } else if (numberInFountain > STRAY_FAIRY_TOTAL) { + numberInFountain = STRAY_FAIRY_TOTAL; } - return temp_v1; + return numberInFountain; } -void func_80A39CD4(PlayState* play, s32 arg1, s32 arg2) { - if ((arg1 < 0) || (arg1 > 4) || (arg2 < 10) || (arg2 > 25)) { +// Update number of Stray Fairies in Fountain +void EnElfgrp_SetFountainFairiesCount(PlayState* play, s32 type, s32 newCount) { + if ((type < ENELFGRP_TYPE_MAGIC) || (type > ENELFGRP_TYPE_KINDNESS) || + (newCount < (STRAY_FAIRY_TOTAL - STRAY_FAIRY_SCATTERED_TOTAL)) || (newCount > STRAY_FAIRY_TOTAL)) { return; } - if (arg1 == 0) { - if (arg2 == 25) { + if (type == ENELFGRP_TYPE_MAGIC) { + if (newCount == STRAY_FAIRY_TOTAL) { gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= 1; } else { gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~1; } } else { - gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((type * 5) - 4)); + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= newCount << ((type * 5) - 4); } } -void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) { +void EnElfgrp_SpawnStrayFairies(EnElfgrp* this, PlayState* play, s32 count, s32 fairyType) { s32 pad; s32 i; - Actor* elforg; - s32 params; - Vec3f sp6C; + Actor* strayFairy; + s32 strayFairyParams; + Vec3f spawnCenterPos; Player* player = GET_PLAYER(play); - if (arg3 == 0) { - this->unk_14A |= 8; + if (fairyType == 0) { + this->stateFlags |= ELFGRP_STATE_3; } - if (arg3 == 0) { - sp6C = this->actor.world.pos; - sp6C.y += 20.0f; - params = STRAY_FAIRY_PARAMS(0, this->unk_147, STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN); + if (fairyType == 0) { + spawnCenterPos = this->actor.world.pos; + spawnCenterPos.y += 20.0f; + strayFairyParams = STRAY_FAIRY_PARAMS(0, this->type, STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN); } else { - sp6C = player->actor.world.pos; - sp6C.y += 20.0f; - params = STRAY_FAIRY_PARAMS(0, this->unk_147, STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN); + spawnCenterPos = player->actor.world.pos; + spawnCenterPos.y += 20.0f; + strayFairyParams = STRAY_FAIRY_PARAMS(0, this->type, STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN); } - for (i = 0; i < arg2; i++) { - elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, Rand_CenteredFloat(20.0f) + sp6C.x, sp6C.y, - Rand_CenteredFloat(20.0f) + sp6C.z, 0, 0, 0, params); - if (elforg == NULL) { + for (i = 0; i < count; i++) { + strayFairy = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, Rand_CenteredFloat(20.0f) + spawnCenterPos.x, + spawnCenterPos.y, Rand_CenteredFloat(20.0f) + spawnCenterPos.z, 0, 0, 0, strayFairyParams); + + if (strayFairy == NULL) { continue; } - elforg->home.pos.x = this->actor.home.pos.x; - elforg->home.pos.y = this->actor.home.pos.y + 20.0f; - elforg->home.pos.z = this->actor.home.pos.z; + strayFairy->home.pos.x = this->actor.home.pos.x; + strayFairy->home.pos.y = this->actor.home.pos.y + 20.0f; + strayFairy->home.pos.z = this->actor.home.pos.z; } } -s32 func_80A39F50(PlayState* play) { +/** + * Tell any spawned Stray Fairies to come to the Fountain center. + * + * @return s32 always 0 + */ +s32 EnElfgrp_SummonStrayFairies(PlayState* play) { Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - EnElforg* elfOrg; + EnElforg* strayFairy; while (itemAction != NULL) { if ((itemAction->id != ACTOR_EN_ELFORG) || ((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) && - (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) { + (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN))) { itemAction = itemAction->next; continue; } - elfOrg = (EnElforg*)itemAction; - if (!(elfOrg->strayFairyFlags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME)) { - elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME; + strayFairy = (EnElforg*)itemAction; + if (!(strayFairy->strayFairyFlags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME)) { + strayFairy->strayFairyFlags |= STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME; } itemAction = itemAction->next; } @@ -295,50 +345,58 @@ s32 func_80A39F50(PlayState* play) { return 0; } -s32 func_80A39FBC(PlayState* play) { +/** + * Make the Stray Fairies in the fountain spin quickly when healing Player. + * + * @return s32 time to spend in healing action. + */ +s32 EnElfgrp_SpinStrayFairies(PlayState* play) { Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - EnElforg* elfOrg; - s32 phi_v1 = 30; + EnElforg* strayFairy; + s32 timer = 30; while (itemAction != NULL) { if ((itemAction->id != ACTOR_EN_ELFORG) || ((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) && - (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) { + (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN))) { itemAction = itemAction->next; continue; } - elfOrg = (EnElforg*)itemAction; - if (!(elfOrg->strayFairyFlags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN)) { - elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; - if (phi_v1 >= 100) { - return phi_v1; + strayFairy = (EnElforg*)itemAction; + if (!(strayFairy->strayFairyFlags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN)) { + strayFairy->strayFairyFlags |= STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; + if (timer >= 100) { + return timer; } - elfOrg->secondaryTimer = phi_v1; - phi_v1 += 5; + strayFairy->secondaryTimer = timer; + timer += 5; } itemAction = itemAction->next; } - return phi_v1; + return timer; } -void func_80A3A044(PlayState* play) { +/** + * Tell the Stray Fairies to disappear, before reviving the Great Fairy + */ +void EnElfgrp_VanishStrayFairies(PlayState* play) { Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - EnElforg* elfOrg; + EnElforg* strayFairy; while (itemAction != NULL) { if ((itemAction->id != ACTOR_EN_ELFORG) || ((STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN) && - (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN))) { + (STRAY_FAIRY_TYPE(itemAction) != STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN))) { itemAction = itemAction->next; continue; } - elfOrg = (EnElforg*)itemAction; - elfOrg->actor.home.rot.x = 0x14; - elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS; + strayFairy = (EnElforg*)itemAction; + STRAY_FAIRY_SPARKLE_COUNT(&strayFairy->actor) = 20; + strayFairy->strayFairyFlags |= STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS; itemAction = itemAction->next; } @@ -346,68 +404,73 @@ void func_80A3A044(PlayState* play) { void func_80A3A0AC(EnElfgrp* this, PlayState* play) { if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_100)) { - this->actionFunc = func_80A3A600; + this->actionFunc = EnElfgrp_DoNothing; CutsceneManager_Stop(this->actor.csId); } } void func_80A3A0F4(EnElfgrp* this, PlayState* play) { - if (this->unk_144 == 10) { - play_sound(NA_SE_SY_WHITE_OUT_T); - if (ENELFGRP_GET(&this->actor) < ENELFGRP_4) { + if (this->timer == 10) { + Audio_PlaySfx(NA_SE_SY_WHITE_OUT_T); + if (ENELFGRP_GET_TYPE(&this->actor) < ENELFGRP_TYPE_KINDNESS) { Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, - ENELFGRP_GET(&this->actor) + ENELFGRP_4); - } else { + ENELFGRP_GET_TYPE(&this->actor) + DEMO_EFFECT_TYPE_LIGHT_BASE); + } else { // ENELFGRP_TYPE_KINDNESS Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, 4); + this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, + DEMO_EFFECT_TYPE_LIGHT_DARK_YELLOW); } } - if ((this->unk_144 > 10) && (this->unk_14A & 1)) { - func_800B9010(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); + if ((this->timer > 10) && (this->stateFlags & ELFGRP_STATE_0)) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); } - if (this->unk_144 == 0) { + if (this->timer == 0) { this->actionFunc = func_80A3A0AC; } } void func_80A3A210(EnElfgrp* this, PlayState* play) { - if (this->unk_144 == 0) { + if (this->timer == 0) { this->actionFunc = func_80A3A0F4; - func_80A3A044(play); - this->unk_144 = 30; + EnElfgrp_VanishStrayFairies(play); + this->timer = 30; } - if (this->unk_14A & 1) { - func_800B9010(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); + if (this->stateFlags & ELFGRP_STATE_0) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); } } void func_80A3A274(EnElfgrp* this, PlayState* play) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_100)) { - if (this->unk_14A & 1) { - func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); + if (this->stateFlags & ELFGRP_STATE_0) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_100)]->id) { case 2: - if (!(this->unk_14A & 1)) { - if (this->unk_147 == ENELFGRP_0) { - func_80A39DC8(this, play, 1, 1); + if (!(this->stateFlags & ELFGRP_STATE_0)) { + if (this->type == ENELFGRP_TYPE_MAGIC) { // Clock Town + EnElfgrp_SpawnStrayFairies(this, play, 1, SPAWNED_STRAY_FAIRY_TYPE_RETURNING); } else { - func_80A39DC8(this, play, func_80A39BD0(play, this->unk_147), 1); + EnElfgrp_SpawnStrayFairies(this, play, EnElfgrp_GetHeldFairiesCount(play, this->type), + SPAWNED_STRAY_FAIRY_TYPE_RETURNING); } - this->unk_14A |= 1; - func_80A39CD4(play, this->unk_147, 25); + this->stateFlags |= ELFGRP_STATE_0; + EnElfgrp_SetFountainFairiesCount(play, this->type, STRAY_FAIRY_TOTAL); } break; case 3: - func_80A39F50(play); + EnElfgrp_SummonStrayFairies(play); this->actionFunc = func_80A3A210; - this->unk_144 = 90; + this->timer = 90; + break; + + default: break; } } @@ -417,28 +480,30 @@ void func_80A3A398(EnElfgrp* this, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = func_80A3A274; - Flags_UnsetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); - if (this->unk_14A & 2) { + Flags_UnsetSwitch(play, ENELFGRP_GET_SWITCH_FLAG_PARAMS(&this->actor)); + + if (this->stateFlags & ELFGRP_STATE_1) { Item_Give(play, ITEM_MASK_GREAT_FAIRY); } - if ((this->unk_14A & 4) != 0) { - SET_WEEKEVENTREG(WEEKEVENTREG_23_02); + if (this->stateFlags & ELFGRP_STATE_2) { + SET_WEEKEVENTREG(WEEKEVENTREG_OBTAINED_GREAT_SPIN_ATTACK); } - if (this->unk_14A & 0x10) { + if (this->stateFlags & ELFGRP_STATE_4) { Item_Give(play, ITEM_SWORD_GREAT_FAIRY); } - this->unk_14A &= ~8; + + this->stateFlags &= ~ELFGRP_STATE_3; } else if (this->actor.xzDistToPlayer < 350.0f) { CutsceneManager_Queue(this->actor.csId); } } void func_80A3A484(EnElfgrp* this, PlayState* play) { - if (this->unk_144 == 0) { + if (this->timer == 0) { this->actionFunc = func_80A3A0F4; - this->unk_144 = 30; + this->timer = 30; } } @@ -448,51 +513,51 @@ void func_80A3A4AC(EnElfgrp* this, PlayState* play) { if (cueId == 3) { this->actionFunc = func_80A3A484; - this->unk_144 = 90; + this->timer = 90; } } } void func_80A3A520(EnElfgrp* this, PlayState* play) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_103)) { - this->actionFunc = func_80A3A600; + this->actionFunc = EnElfgrp_DoNothing; } else if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = func_80A3A4AC; - Flags_SetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ENELFGRP_GET_SWITCH_FLAG_PARAMS(&this->actor)); - if (this->unk_14A & 2) { + if (this->stateFlags & ELFGRP_STATE_1) { Item_Give(play, ITEM_MASK_GREAT_FAIRY); } - if (this->actor.home.rot.z != 0) { - Flags_SetSwitch(play, this->actor.home.rot.z); + if (ENELFGRP_GET_SWITCHFLAG_ROT(&this->actor) != 0) { + Flags_SetSwitch(play, ENELFGRP_GET_SWITCHFLAG_ROT(&this->actor)); } } else if (this->actor.xzDistToPlayer < 350.0f) { CutsceneManager_Queue(this->actor.csId); } } -void func_80A3A600(EnElfgrp* this, PlayState* play) { +void EnElfgrp_DoNothing(EnElfgrp* this, PlayState* play) { } -void func_80A3A610(EnElfgrp* this, PlayState* play) { +void EnElfgrp_HealPlayer(EnElfgrp* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->unk_144 == 60) { + if (this->timer == 60) { Magic_Add(play, MAGIC_FILL_TO_CAPACITY); - gSaveContext.healthAccumulator = 320; + gSaveContext.healthAccumulator = 0x140; } - if (this->unk_144 > 0) { + if (this->timer > 0) { player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_GROUP_HEAL - SFX_FLAG); } else { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_20000000; - this->actionFunc = func_80A3A600; - this->unk_14A |= 8; + this->actionFunc = EnElfgrp_DoNothing; + this->stateFlags |= ELFGRP_STATE_3; } } @@ -503,9 +568,9 @@ void func_80A3A6F4(EnElfgrp* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; - this->unk_144 = func_80A39FBC(play); - this->actionFunc = func_80A3A610; - this->unk_14A &= ~8; + this->timer = EnElfgrp_SpinStrayFairies(play); + this->actionFunc = EnElfgrp_HealPlayer; + this->stateFlags &= ~ELFGRP_STATE_3; } } @@ -515,28 +580,30 @@ void func_80A3A77C(EnElfgrp* this, PlayState* play) { player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk_144 = func_80A39FBC(play); - this->actionFunc = func_80A3A610; - this->unk_14A &= ~8; + this->timer = EnElfgrp_SpinStrayFairies(play); + this->actionFunc = EnElfgrp_HealPlayer; + this->stateFlags &= ~ELFGRP_STATE_3; } } void func_80A3A7FC(EnElfgrp* this, PlayState* play) { - s32 temp_s0; + s32 curTotalFairies; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->talkedOnceFlag; this->actionFunc = func_80A3A6F4; - temp_s0 = func_80A39BD0(play, this->unk_147); - func_80A39DC8(this, play, temp_s0, 1); - temp_s0 += func_80A39C1C(play, this->unk_147); - if (temp_s0 > 25) { - temp_s0 = 25; + + curTotalFairies = EnElfgrp_GetHeldFairiesCount(play, this->type); + EnElfgrp_SpawnStrayFairies(this, play, curTotalFairies, SPAWNED_STRAY_FAIRY_TYPE_RETURNING); + curTotalFairies += EnElfgrp_GetFountainFairiesCount(play, this->type); + if (curTotalFairies > STRAY_FAIRY_TOTAL) { + curTotalFairies = STRAY_FAIRY_TOTAL; } - func_80A39CD4(play, this->unk_147, temp_s0); + + EnElfgrp_SetFountainFairiesCount(play, this->type, curTotalFairies); } else if (this->actor.xzDistToPlayer < 280.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } @@ -545,29 +612,29 @@ void func_80A3A8F8(EnElfgrp* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->talkedOnceFlag; this->actionFunc = func_80A3A6F4; return; } - if (this->unk_147 != ENELFGRP_0) { - if (func_80A39BD0(play, this->unk_147) > 0) { + if (this->type != ENELFGRP_TYPE_MAGIC) { + if (EnElfgrp_GetHeldFairiesCount(play, this->type) > 0) { this->actionFunc = func_80A3A7FC; return; } } if (this->actor.xzDistToPlayer < 30.0f) { - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { this->actor.flags &= ~ACTOR_FLAG_10000; player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_80A3A77C; - gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->talkedOnceFlag; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } else { this->actor.flags &= ~ACTOR_FLAG_10000; @@ -579,11 +646,11 @@ void EnElfgrp_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->unk_14A & 8) { + if (this->stateFlags & ELFGRP_STATE_3) { Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); } - if (this->unk_144 != 0) { - this->unk_144--; + if (this->timer != 0) { + this->timer--; } } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h index 692a76d82..90f73a8a6 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h @@ -2,29 +2,32 @@ #define Z_EN_ELFGRP_H #include "global.h" +#include "overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h" struct EnElfgrp; typedef void (*EnElfgrpActionFunc)(struct EnElfgrp*, PlayState*); -#define ENELFGRP_GET(thisx) ((thisx)->params & 0xF) -#define ENELFGRP_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define ENELFGRP_GET_TYPE(thisx) ((thisx)->params & 0xF) //!< Same type as Great Fairies +#define ENELFGRP_GET_SWITCH_FLAG_PARAMS(thisx) (((thisx)->params & 0xFE00) >> 9) +#define ENELFGRP_GET_SWITCHFLAG_ROT(thisx) ((thisx)->home.rot.z) -typedef enum { - /* 0 */ ENELFGRP_0, - /* 2 */ ENELFGRP_1, - /* 2 */ ENELFGRP_2, - /* 3 */ ENELFGRP_3, - /* 4 */ ENELFGRP_4 -} EnElfgrpParam; +typedef enum ElfgrpType { + /* 0 */ ENELFGRP_TYPE_MAGIC = GREAT_FAIRY_TYPE_MAGIC, + /* 1 */ ENELFGRP_TYPE_POWER = GREAT_FAIRY_TYPE_POWER, + /* 2 */ ENELFGRP_TYPE_WISDOM = GREAT_FAIRY_TYPE_WISDOM, + /* 3 */ ENELFGRP_TYPE_COURAGE = GREAT_FAIRY_TYPE_COURAGE, + /* 4 */ ENELFGRP_TYPE_KINDNESS = GREAT_FAIRY_TYPE_KINDNESS, + /* 5 */ ENELFGRP_TYPE_MAX +} ElfgrpType; typedef struct EnElfgrp { /* 0x000 */ Actor actor; - /* 0x144 */ s16 unk_144; - /* 0x146 */ u8 unk_146; - /* 0x147 */ u8 unk_147; - /* 0x148 */ s8 unk_148; - /* 0x14A */ u16 unk_14A; + /* 0x144 */ s16 timer; + /* 0x146 */ u8 talkedOnceFlag; + /* 0x147 */ u8 type; + /* 0x148 */ s8 unk_148; // set and not used + /* 0x14A */ u16 stateFlags; /* 0x14C */ EnElfgrpActionFunc actionFunc; } EnElfgrp; // size = 0x150 diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 9b65ae2a6..3dc3cd7bc 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -87,7 +87,7 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { break; case STRAY_FAIRY_TYPE_COLLECTIBLE: - if (Flags_GetCollectible(play, STRAY_FAIRY_FLAG(thisx))) { + if (Flags_GetCollectible(play, STRAY_FAIRY_GET_FLAG(thisx))) { Actor_Kill(thisx); return; } @@ -96,11 +96,11 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { case STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN: case STRAY_FAIRY_TYPE_BUBBLE: case STRAY_FAIRY_TYPE_CHEST: - case STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN: + case STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN: break; default: - if (Flags_GetSwitch(play, STRAY_FAIRY_FLAG(thisx))) { + if (Flags_GetSwitch(play, STRAY_FAIRY_GET_FLAG(thisx))) { Actor_Kill(thisx); return; } @@ -121,7 +121,7 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { this->targetDistanceFromHome = Rand_ZeroFloat(100.0f) + 50.0f; break; - case STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN: + case STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN: EnElforg_InitializeParams(this); this->actionFunc = EnElforg_TurnInFairy; this->secondaryTimer = 60; @@ -164,7 +164,7 @@ void EnElforg_Destroy(Actor* thisx, PlayState* play) { void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) { static Vec3f sVelocity = { 0.0f, -0.05f, 0.0f }; - static Vec3f sAcceleration = { 0.0f, -0.025f, 0.0f }; + static Vec3f sAccel = { 0.0f, -0.025f, 0.0f }; static Color_RGBA8 sPrimColors[] = { { 255, 235, 220, 255 }, { 255, 220, 220, 255 }, { 220, 255, 220, 255 }, { 220, 220, 255, 255 }, { 255, 255, 200, 255 }, @@ -182,8 +182,8 @@ void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) { index = (this->area < STRAY_FAIRY_AREA_CLOCK_TOWN || this->area >= STRAY_FAIRY_AREA_MAX) ? STRAY_FAIRY_AREA_CLOCK_TOWN : this->area; - EffectSsKirakira_SpawnDispersed(play, &pos, &sVelocity, &sAcceleration, &sPrimColors[index], &sEnvColors[index], - 1000, life); + EffectSsKirakira_SpawnDispersed(play, &pos, &sVelocity, &sAccel, &sPrimColors[index], &sEnvColors[index], 1000, + life); } void EnElforg_ApproachTargetYPosition(EnElforg* this, Vec3f* targetPos) { @@ -216,7 +216,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) { s16 angleAdjustment; s16 targetAngle; - this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9); + this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer * 0x200); EnElforg_ApproachTargetYPosition(this, homePos); xDifference = this->actor.world.pos.x - homePos->x; zDifference = this->actor.world.pos.z - homePos->z; @@ -245,7 +245,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) { void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) { s16 targetAngle; - this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9); + this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer * 0x200); EnElforg_ApproachTargetYPosition(this, targetPos); targetAngle = Math_Atan2S_XY(-(this->actor.world.pos.z - targetPos->z), -(this->actor.world.pos.x - targetPos->x)); @@ -273,7 +273,7 @@ void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) { EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloating; } else { - this->actor.shape.yOffset += 10.0f * Math_SinS(this->timer << 9); + this->actor.shape.yOffset += 10.0f * Math_SinS(this->timer * 0x200); this->actor.world.pos = this->actor.parent->world.pos; this->actor.world.pos.y += 12.0f; } @@ -324,6 +324,7 @@ void EnElforg_TurnInFairy(EnElforg* this, PlayState* play) { void EnElforg_QuicklyCircleFairyFountain(EnElforg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnElforg_MoveToTargetFairyFountain(this, &this->actor.home.pos); + if (this->secondaryTimer <= 30) { this->actionFunc = EnElforg_TurnInFairy; } @@ -367,9 +368,9 @@ void EnElforg_FreeFloatingFairyFountain(EnElforg* this, PlayState* play) { if (this->strayFairyFlags & STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS) { // This happens right before the Great Fairy appears once all // Stray Fairies are saved. - if (this->actor.home.rot.x > 0) { + if (STRAY_FAIRY_SPARKLE_COUNT(&this->actor) > 0) { EnElforg_SpawnSparkles(this, play, 10); - this->actor.home.rot.x--; + STRAY_FAIRY_SPARKLE_COUNT(&this->actor)--; } Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); @@ -383,28 +384,30 @@ void EnElforg_CirclePlayer(EnElforg* this, PlayState* play) { s32 pad; Actor* playerActor = &GET_PLAYER(play)->actor; Player* player = GET_PLAYER(play); - f32 distanceFromPlayer; + f32 orbitRadius; - if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { - distanceFromPlayer = 40.0f; + if (GET_PLAYER_FORM == PLAYER_FORM_GORON) { + orbitRadius = 40.0f; } else { - distanceFromPlayer = 20.0f; + orbitRadius = 20.0f; } - this->actor.world.pos.x = (Math_SinS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.x; - this->actor.world.pos.z = (Math_CosS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.z; + this->actor.world.pos.x = (Math_SinS(this->timer * 0x1000) * orbitRadius) + playerActor->world.pos.x; + this->actor.world.pos.z = (Math_CosS(this->timer * 0x1000) * orbitRadius) + playerActor->world.pos.z; this->actor.world.pos.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y; + EnElforg_SpawnSparkles(this, play, 16); } void EnElforg_FairyCollected(EnElforg* this, PlayState* play) { EnElforg_CirclePlayer(this, play); + if (this->timer > 80) { Actor_Kill(&this->actor); return; } - func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } void EnElforg_SetupFairyCollected(EnElforg* this, PlayState* play) { @@ -424,8 +427,10 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, PlayState* play) { Player* player = GET_PLAYER(play); EnElforg_CirclePlayer(this, play); + player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; + if (Actor_TextboxIsClosing(&this->actor, play)) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_20000000; @@ -435,7 +440,7 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, PlayState* play) { return; } - func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); if (CutsceneManager_GetCurrentCsId() != CS_ID_GLOBAL_TALK) { if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { CutsceneManager_Start(CS_ID_GLOBAL_TALK, &this->actor); @@ -451,6 +456,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); + if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->targetSpeedXZ = 5.0f; @@ -461,21 +467,23 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { } scaledYDistance = this->actor.playerHeightRel - (this->actor.shape.yOffset * this->actor.scale.y); + if (!Player_InCsMode(play)) { if ((this->actor.xzDistToPlayer < 30.0f) && (scaledYDistance < 12.0f) && (scaledYDistance > -68.0f)) { EnElforg_SetupFairyCollected(this, play); Health_ChangeBy(play, 0x30); + switch (STRAY_FAIRY_TYPE(&this->actor)) { case STRAY_FAIRY_TYPE_COLLECTIBLE: - Flags_SetCollectible(play, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetCollectible(play, STRAY_FAIRY_GET_FLAG(&this->actor)); break; case STRAY_FAIRY_TYPE_CHEST: - Flags_SetTreasure(play, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetTreasure(play, STRAY_FAIRY_GET_FLAG(&this->actor)); break; default: - Flags_SetSwitch(play, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetSwitch(play, STRAY_FAIRY_GET_FLAG(&this->actor)); break; } @@ -493,7 +501,8 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { gSaveContext.save.saveInfo.inventory.strayFairies[gSaveContext.dungeonIndex]++; // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); - if (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { + if (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= + STRAY_FAIRY_SCATTERED_TOTAL) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } } @@ -502,9 +511,10 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); func_80ACCBB8(this, play); + if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { if (!(this->strayFairyFlags & STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED)) { - play_sound(NA_SE_SY_FAIRY_MASK_SUCCESS); + Audio_PlaySfx(NA_SE_SY_FAIRY_MASK_SUCCESS); } this->strayFairyFlags |= STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED; @@ -627,6 +637,7 @@ void EnElforg_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); + switch (this->area) { case STRAY_FAIRY_AREA_WOODFALL: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyWoodfallTexAnim)); @@ -644,7 +655,7 @@ void EnElforg_Draw(Actor* thisx, PlayState* play) { AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyStoneTowerTexAnim)); break; - default: + default: // STRAY_FAIRY_AREA_CLOCK_TOWN AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyClockTownTexAnim)); break; } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h index 798982b09..f4da3cd5e 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h @@ -2,36 +2,41 @@ #define Z_EN_ELFORG_H #include "global.h" +#include "overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h" #include "objects/gameplay_keep/gameplay_keep.h" #define STRAY_FAIRY_TYPE(thisx) ((thisx)->params & 0xF) #define STRAY_FAIRY_GET_NON_DUNGEON_AREA(thisx) (((thisx)->params & 0x1C0) >> 6) -#define STRAY_FAIRY_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) -#define STRAY_FAIRY_PARAMS(flag, nonDungeonArea, type) (((flag & 0x7F) << 9) | ((nonDungeonArea & 7) << 6) | (type & 0xF)) +#define STRAY_FAIRY_GET_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) +#define STRAY_FAIRY_SPARKLE_COUNT(thisx) ((thisx)->home.rot.x) + +//! @note `nonDungeonArea` does not always use the enum +#define STRAY_FAIRY_PARAMS(flag, nonDungeonArea, type) ((((flag) & 0x7F) << 9) | (((nonDungeonArea) & 7) << 6) | ((type) & 0xF)) #define STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME (1 << 0) #define STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS (1 << 1) #define STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN (1 << 2) #define STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED (1 << 3) -typedef enum { - /* 0 */ STRAY_FAIRY_TYPE_FREE_FLOATING, // The ones just floating around - /* 1 */ STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN, // The ones already present when you enter a Fairy Fountain - /* 2 */ STRAY_FAIRY_TYPE_BUBBLE, // The ones trapped in bubbles - /* 3 */ STRAY_FAIRY_TYPE_CLOCK_TOWN, // The free-floating Stray Fairies in Clock Town - /* 4 */ STRAY_FAIRY_TYPE_ENEMY, // The ones trapped inside enemies - /* 5 */ STRAY_FAIRY_TYPE_COLLIDER, // Unused in retail. The fairy is hidden until the collider is hit - /* 6 */ STRAY_FAIRY_TYPE_CHEST, // The ones in treasure chests - /* 7 */ STRAY_FAIRY_TYPE_COLLECTIBLE, // The ones in boxes, pots, beehives, etc. - /* 8 */ STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN // The ones you "turn in" by walking into a Fairy Fountain +typedef enum StrayFairyType { + /* 0 */ STRAY_FAIRY_TYPE_FREE_FLOATING, // The ones just floating around + /* 1 */ STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN, // The ones already present when you enter a Fairy Fountain + /* 2 */ STRAY_FAIRY_TYPE_BUBBLE, // The ones trapped in bubbles + /* 3 */ STRAY_FAIRY_TYPE_CLOCK_TOWN, // The free-floating Stray Fairies in Clock Town + /* 4 */ STRAY_FAIRY_TYPE_ENEMY, // The ones trapped inside enemies + /* 5 */ STRAY_FAIRY_TYPE_COLLIDER, // Unused in retail. The fairy is hidden until the collider is hit + /* 6 */ STRAY_FAIRY_TYPE_CHEST, // The ones in treasure chests + /* 7 */ STRAY_FAIRY_TYPE_COLLECTIBLE, // The ones in boxes, pots, beehives, etc. + /* 8 */ STRAY_FAIRY_TYPE_RETURNING_TO_FOUNTAIN // The ones you "turn in" by walking into a Fairy Fountain } StrayFairyType; -typedef enum { - /* 0 */ STRAY_FAIRY_AREA_CLOCK_TOWN, - /* 1 */ STRAY_FAIRY_AREA_WOODFALL, - /* 2 */ STRAY_FAIRY_AREA_SNOWHEAD, - /* 3 */ STRAY_FAIRY_AREA_GREAT_BAY, - /* 4 */ STRAY_FAIRY_AREA_STONE_TOWER, +// Corresponds to the Great Fairy types +typedef enum StrayFairyArea { + /* 0 */ STRAY_FAIRY_AREA_CLOCK_TOWN = GREAT_FAIRY_TYPE_MAGIC, + /* 1 */ STRAY_FAIRY_AREA_WOODFALL = GREAT_FAIRY_TYPE_POWER, + /* 2 */ STRAY_FAIRY_AREA_SNOWHEAD = GREAT_FAIRY_TYPE_WISDOM, + /* 3 */ STRAY_FAIRY_AREA_GREAT_BAY = GREAT_FAIRY_TYPE_COURAGE, + /* 4 */ STRAY_FAIRY_AREA_STONE_TOWER = GREAT_FAIRY_TYPE_KINDNESS, /* 5 */ STRAY_FAIRY_AREA_MAX } StrayFairyArea; diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 737ffd2d3..22a28ed43 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -38,10 +38,10 @@ static s16 sActorIds[] = { }; static s16 sActorParams[] = { - EN_GRASSHOPPER_PARAMS(EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED), // EN_ENCOUNT1_GRASSHOPPER - WALLMASTER_PARAMS(WALLMASTER_TYPE_TIMER_ONLY, 0, false), // EN_ENCOUNT1_WALLMASTER - ENPR2_PARAMS(1, 0), // EN_ENCOUNT1_SKULLFISH - ENPR2_PARAMS(3, 0) // EN_ENCOUNT1_SKULLFISH_2 + DRAGONFLY_PARAMS(DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED), // EN_ENCOUNT1_GRASSHOPPER + WALLMASTER_PARAMS(WALLMASTER_TYPE_TIMER_ONLY, 0, false), // EN_ENCOUNT1_WALLMASTER + ENPR2_PARAMS(1, 0), // EN_ENCOUNT1_SKULLFISH + ENPR2_PARAMS(3, 0) // EN_ENCOUNT1_SKULLFISH_2 }; void EnEncount1_Init(Actor* thisx, PlayState* play) { @@ -71,7 +71,7 @@ void EnEncount1_Init(Actor* thisx, PlayState* play) { this->spawnTotalMax = -1; this->spawnDistanceMax = -1.0f; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnEncount1_SpawnActor; } @@ -142,6 +142,9 @@ void EnEncount1_SpawnActor(EnEncount1* this, PlayState* play) { Actor_Kill(&this->actor); } break; + + default: + break; } actorId = sActorIds[this->type]; 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 ad2f48c7f..c840c33e1 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -5,6 +5,7 @@ */ #include "z_en_encount2.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_fusen/object_fusen.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -20,7 +21,7 @@ void EnEncount2_Draw(Actor* thisx, PlayState* play); void EnEncount2_Idle(EnEncount2* this, PlayState* play); void EnEncount2_Popped(EnEncount2* this, PlayState* play); void EnEncount2_Die(EnEncount2* this, PlayState* play); -void EnEncount2_SetIdle(EnEncount2* this); +void EnEncount2_SetupIdle(EnEncount2* this); void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay); void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play); void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play); @@ -111,7 +112,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; Collider_InitAndSetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colElement); - this->dyna.actor.targetMode = 6; + this->dyna.actor.targetMode = TARGET_MODE_6; this->dyna.actor.colChkInfo.health = 1; this->scale = 0.1f; this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor); @@ -120,19 +121,19 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->switchFlag = -1; } - if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->dyna.actor); return; } - this->collider.elements->dim.modelSphere.radius = 0x39; + this->collider.elements->dim.modelSphere.radius = 57; this->collider.elements->dim.scale = 1.0f; this->collider.elements->dim.modelSphere.center.x = 0; this->collider.elements->dim.modelSphere.center.y = -4; this->collider.elements->dim.modelSphere.center.z = 0; this->dyna.actor.colChkInfo.damageTable = &sDamageTable; - EnEncount2_SetIdle(this); + EnEncount2_SetupIdle(this); } void EnEncount2_Destroy(Actor* thisx, PlayState* play) { @@ -142,7 +143,7 @@ void EnEncount2_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void EnEncount2_SetIdle(EnEncount2* this) { +void EnEncount2_SetupIdle(EnEncount2* this) { this->isPopped = false; this->actionFunc = EnEncount2_Idle; } @@ -151,6 +152,7 @@ void EnEncount2_Idle(EnEncount2* this, PlayState* play) { this->oscillationAngle += 1500.0f; this->dyna.actor.velocity.y = Math_SinS(this->oscillationAngle); Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f); + if ((this->collider.base.acFlags & AC_HIT) && (this->dyna.actor.colChkInfo.damageEffect == 0xE)) { this->dyna.actor.colChkInfo.health = 0; this->isPopped = true; @@ -160,15 +162,15 @@ void EnEncount2_Idle(EnEncount2* this, PlayState* play) { void EnEncount2_Popped(EnEncount2* this, PlayState* play) { s32 i; - Vec3f curPos; + Vec3f effPos; - Math_Vec3f_Copy(&curPos, &this->dyna.actor.world.pos); - curPos.y += 60.0f; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, curPos.x, curPos.y, curPos.z, 255, 255, 200, - CLEAR_TAG_LARGE_EXPLOSION); + Math_Vec3f_Copy(&effPos, &this->dyna.actor.world.pos); + effPos.y += 60.0f; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y, effPos.z, 255, 255, 200, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_EXPLOSION)); for (i = 0; i < ARRAY_COUNT(this->effects) / 2; ++i) { - EnEncount2_InitEffects(this, &curPos, 10); + EnEncount2_InitEffects(this, &effPos, 10); } Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); @@ -216,24 +218,24 @@ void EnEncount2_Draw(Actor* thisx, PlayState* play) { void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { s16 i; - EnEncount2Effect* sPtr = this->effects; + EnEncount2Effect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (!sPtr->isEnabled) { - sPtr->isEnabled = true; - sPtr->pos = *pos; - sPtr->alphaFadeDelay = fadeDelay; - sPtr->alpha = 255; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->pos = *pos; + effect->alphaFadeDelay = fadeDelay; + effect->alpha = 255; - sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; + effect->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->velocity.x = Rand_ZeroOne() - 0.5f; - sPtr->velocity.y = Rand_ZeroOne() - 0.5f; - sPtr->velocity.z = Rand_ZeroOne() - 0.5f; + effect->velocity.x = Rand_ZeroOne() - 0.5f; + effect->velocity.y = Rand_ZeroOne() - 0.5f; + effect->velocity.z = Rand_ZeroOne() - 0.5f; - sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; + effect->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; return; } } @@ -241,23 +243,23 @@ void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { s32 i; - EnEncount2Effect* sPtr = this->effects; + EnEncount2Effect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (sPtr->isEnabled) { - sPtr->pos.x += sPtr->velocity.x; - sPtr->pos.y += sPtr->velocity.y; - sPtr->pos.z += sPtr->velocity.z; - sPtr->velocity.x += sPtr->accel.x; - sPtr->velocity.y += sPtr->accel.y; - sPtr->velocity.z += sPtr->accel.z; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; - if (sPtr->alphaFadeDelay != 0) { - sPtr->alphaFadeDelay--; + if (effect->alphaFadeDelay != 0) { + effect->alphaFadeDelay--; } else { - sPtr->alpha -= 10; - if (sPtr->alpha < 10) { - sPtr->isEnabled = 0; + effect->alpha -= 10; + if (effect->alpha < 10) { + effect->isEnabled = 0; } } } @@ -266,24 +268,24 @@ void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play) { s16 i; - EnEncount2Effect* sPtr; + EnEncount2Effect* effect; GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - sPtr = this->effects; + effect = this->effects; Gfx_SetupDL25_Opa(gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { - if (sPtr->isEnabled) { - Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); - Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_20); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gSun1Tex)); gSPDisplayList(POLY_XLU_DISP++, gSunSparkleMaterialDL); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, effect->alpha); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c index b2d172cfc..fa37bcb38 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c @@ -5,6 +5,7 @@ */ #include "z_en_encount3.h" +#include "objects/object_big_fwall/object_big_fwall.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) @@ -12,14 +13,15 @@ void EnEncount3_Init(Actor* thisx, PlayState* play); void EnEncount3_Destroy(Actor* thisx, PlayState* play); -void EnEncount3_Update(Actor* thisx, PlayState* play); +void EnEncount3_Update(Actor* thisx, PlayState* play2); void EnEncount3_Draw(Actor* thisx, PlayState* play); +void func_809AD058(EnEncount3* this); + void func_809AD084(EnEncount3* this, PlayState* play); void func_809AD194(EnEncount3* this, PlayState* play); void func_809AD1EC(EnEncount3* this, PlayState* play); -#if 0 ActorInit En_Encount3_InitVars = { ACTOR_EN_ENCOUNT3, ACTORCAT_ENEMY, @@ -32,22 +34,174 @@ ActorInit En_Encount3_InitVars = { (ActorFunc)EnEncount3_Draw, }; -#endif +s32 D_809AD810 = false; -extern UNK_TYPE D_060009A0; +void EnEncount3_Init(Actor* thisx, PlayState* play) { + EnEncount3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Init.s") + this->unk14A = ENCOUNT3_GET_SPAWN_INDEX(thisx); + this->childParams = ENCOUNT3_GET_PARAM_F80(thisx); + this->switchFlag = ENCOUNT3_GET_SWITCH_FLAG(thisx); + this->csId = this->actor.csId; + this->unk16C = ENCOUNT3_GET_ROTZ(thisx) * 10.0f; + if (this->unk16C < 10.0f) { + this->unk16C = 10.0f; + } else if (this->unk16C > 1000.0f) { + this->unk16C = 1000.0f; + } + if (this->switchFlag == 0x7F) { + this->switchFlag = -1; + } + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { + Actor_Kill(&this->actor); + } + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + func_809AD058(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Destroy.s") +void EnEncount3_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD058.s") +void func_809AD058(EnEncount3* this) { + this->childActorId = ACTOR_EN_JSO; + this->unk150 = 1; + this->timer = 30; + this->actionFunc = func_809AD084; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD084.s") +void func_809AD084(EnEncount3* this, PlayState* play) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { + Actor_Kill(&this->actor); + return; + } + if (!(this->unk16C < this->actor.xzDistToPlayer) && (Player_GetMask(play) == PLAYER_MASK_GARO) && !D_809AD810) { + if (this->timer > 0) { + this->timer--; + } else { + this->child = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, this->childActorId, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->childParams); + if (this->child != NULL) { + this->unk14E++; + D_809AD810 = true; + this->actionFunc = func_809AD194; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD194.s") +void func_809AD194(EnEncount3* this, PlayState* play) { + if (this->unk14E == 0) { + this->unk178 = 0.0f; + if (this->switchFlag >= 0) { + Flags_SetSwitch(play, this->switchFlag); + } + this->actionFunc = func_809AD1EC; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD1EC.s") +void func_809AD1EC(EnEncount3* this, PlayState* play) { + if (this->unk174 < 0.002f) { + D_809AD810 = false; + Actor_Kill(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Update.s") +void EnEncount3_Update(Actor* thisx, PlayState* play2) { + EnEncount3* this = THIS; + f32 new_var; + PlayState* play = play2; + Player* player = GET_PLAYER(play); + f32 sp3C; + f32 sp38; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Draw.s") + this->actionFunc(this, play); + if (this->actionFunc == func_809AD194) { + new_var = this->unk16C * 0.52f; + if (new_var < this->actor.xzDistToPlayer) { + this->unk178 = ((this->unk16C * 0.03125f) * 0.001f) + 0.1f; + } else { + this->unk178 = 0.06f; + } + + if (((this->unk16C + 50.0f) + BREG(0)) < this->actor.xzDistToPlayer) { + if (this->actionFunc == func_809AD194) { + this->unk148 = 0; + this->unk178 = 0.0f; + D_809AD810 = false; + if (((this->child != NULL) && (this->child->update != NULL)) && (this->child->colChkInfo.health > 0)) { + Actor_Kill(this->child); + this->child = NULL; + } + func_809AD058(this); + } + } else if (this->unk16C < this->actor.xzDistToPlayer) { + s16 i; + + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { + player->flameTimers[i] = Rand_S16Offset(0, 200); + } + player->isBurning = true; + + sp3C = this->actor.world.pos.x - player->actor.world.pos.x; + sp38 = this->actor.world.pos.z - player->actor.world.pos.z; + if (!Play_InCsMode(play)) { + func_800B8D50(play, &this->actor, 10.0f, Math_Atan2S_XY(sp38, sp3C), 0.0f, 1); + } + } + this->child->colChkInfo = this->child->colChkInfo; + } + + this->unk168 = this->unk16C; + this->unk168 /= 7666.0f; + if (this->actionFunc != func_809AD194) { + Math_ApproachZeroF(&this->unk170, 0.3f, 10.0f); + Math_ApproachZeroF(&this->unk160, 0.3f, 5.0f); + if (this->unk160 < 1.0f) { + play->unk_18880 = 0; + } + } else if (this->unk148 != 0) { + Math_ApproachF(&this->unk170, 255.0f, 0.4f, 10.0f); + Math_ApproachF(&this->unk160, 60.0f, 0.3f, 5.0f); + } + Math_ApproachF(&this->unk174, this->unk178, 0.3f, 0.03f); + + this->unk164 = this->unk160 / 60.0f; + if (this->unk164 != 0.0f) { + play->envCtx.adjLightSettings.fogNear = (960 - play->envCtx.lightSettings.fogNear) * this->unk164; + play->envCtx.adjLightSettings.fogColor[0] = (40.0f - play->envCtx.lightSettings.fogColor[0]) * this->unk164; + play->envCtx.adjLightSettings.fogColor[1] = (10.0f - play->envCtx.lightSettings.fogColor[1]) * this->unk164; + play->envCtx.adjLightSettings.fogColor[2] = (0.0f - play->envCtx.lightSettings.fogColor[2]) * this->unk164; + } +} + +void EnEncount3_Draw(Actor* thisx, PlayState* play) { + EnEncount3* this = THIS; + s32 pad; + + if (this->unk170 > 0.0f) { + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Xlu(play->state.gfxCtx); + Matrix_Push(); + + gDPPipeSync(POLY_XLU_DISP++); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s32)play->gameplayFrames, 0, 0x20, 0x40, 1, + (s32)play->gameplayFrames * -2, (s32)play->gameplayFrames * -8, 0x20, 0x20)); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 200, 0, (s8)this->unk170); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); + + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y - 40.0f, this->actor.world.pos.z, + MTXMODE_NEW); + Matrix_Scale(this->unk168, this->unk174, this->unk168, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gRingOfFireDL); + + Matrix_Pop(); + CLOSE_DISPS(play->state.gfxCtx); + } +} diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h index 9ebc87303..9e8bd01ad 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h @@ -7,10 +7,36 @@ struct EnEncount3; typedef void (*EnEncount3ActionFunc)(struct EnEncount3*, PlayState*); +#define ENCOUNT3_GET_SPAWN_INDEX(thisx) (((thisx)->params >> 0xC) & 0xF) +#define ENCOUNT3_GET_PARAM_F80(thisx) (((thisx)->params >> 7) & 0x1F) +#define ENCOUNT3_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) + +#define ENCOUNT3_GET_ROTZ(thisx) ((thisx)->world.rot.z) + typedef struct EnEncount3 { /* 0x000 */ Actor actor; /* 0x144 */ EnEncount3ActionFunc actionFunc; - /* 0x148 */ char unk_148[0x84]; + /* 0x148 */ u8 unk148; + /* 0x14A */ s16 unk14A; + /* 0x14C */ UNK_TYPE1 pad14C[0x2]; + /* 0x14E */ s16 unk14E; + /* 0x150 */ s16 unk150; + /* 0x152 */ s16 unk152; + /* 0x154 */ s16 childActorId; + /* 0x156 */ s16 unk156; + /* 0x158 */ s16 childParams; + /* 0x15A */ s16 csId; + /* 0x15C */ s16 switchFlag; + /* 0x15E */ s16 timer; + /* 0x160 */ f32 unk160; + /* 0x164 */ f32 unk164; + /* 0x168 */ f32 unk168; + /* 0x16C */ f32 unk16C; + /* 0x170 */ f32 unk170; + /* 0x174 */ f32 unk174; + /* 0x178 */ f32 unk178; + /* 0x17C */ Actor* child; + /* 0x180 */ UNK_TYPE1 unk180[0x4C]; } EnEncount3; // size = 0x1CC #endif // Z_EN_ENCOUNT3_H diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c index 5e28850c6..077273309 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c @@ -53,7 +53,7 @@ void EnEncount4_Init(Actor* thisx, PlayState* play) { return; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_809C3FD8; } @@ -72,11 +72,12 @@ void func_809C3FD8(EnEncount4* this, PlayState* play) { while (actor != NULL) { if (actor->id != ACTOR_EN_BSB) { actor = actor->next; - } else { - this->captainKeeta = (EnBsb*)actor; - this->actionFunc = func_809C4078; - break; + continue; } + + this->captainKeeta = (EnBsb*)actor; + this->actionFunc = func_809C4078; + break; } } } @@ -145,15 +146,16 @@ void func_809C42A8(EnEncount4* this, PlayState* play) { if ((this->captainKeeta->actor.id != ACTOR_EN_BSB) || (captainKeeta->actor.update == NULL)) { Actor_Kill(&this->actor); } - return; - } else if (this->unk_14E >= 2) { + } + + if (this->unk_14E >= 2) { this->timer = 100; this->actionFunc = func_809C464C; - return; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_40) || (this->unk_14C >= 2) || - (this->actor.xzDistToPlayer > 240.0f)) { + } + + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_40) || (this->unk_14C >= 2) || (this->actor.xzDistToPlayer > 240.0f)) { return; } @@ -167,7 +169,7 @@ void func_809C42A8(EnEncount4* this, PlayState* play) { } pos.y = yIntersect; - yRot = (s32)Rand_ZeroFloat(512.0f) + this->actor.world.rot.y + 0x3800; + yRot = (s32)Rand_ZeroFloat(0x200) + this->actor.world.rot.y + 0x3800; if (this->unk_14C != 0) { yRot += 0x8000; } diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index 6121cce9d..c281bd61f 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -5,9 +5,8 @@ */ #include "z_en_ending_hero.h" -#include "objects/object_dt/object_dt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero*)thisx) @@ -16,8 +15,8 @@ void EnEndingHero_Destroy(Actor* thisx, PlayState* play); void EnEndingHero_Update(Actor* thisx, PlayState* play); void EnEndingHero_Draw(Actor* thisx, PlayState* play); -void func_80C1E748(EnEndingHero* this); -void func_80C1E764(EnEndingHero* this, PlayState* play); +void EnEndingHero1_SetupIdle(EnEndingHero* this); +void EnEndingHero1_Idle(EnEndingHero* this, PlayState* play); ActorInit En_Ending_Hero_InitVars = { ACTOR_EN_ENDING_HERO, @@ -36,23 +35,23 @@ void EnEndingHero_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_dt_Skel_00B0CC, &object_dt_Anim_000BE0, this->jointTable, - this->morphTable, 15); + this->morphTable, OBJECT_DT_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - func_80C1E748(this); + EnEndingHero1_SetupIdle(this); } void EnEndingHero_Destroy(Actor* thisx, PlayState* play) { } -void func_80C1E748(EnEndingHero* this) { - this->unk244 = 1; - this->actionFunc = func_80C1E764; +void EnEndingHero1_SetupIdle(EnEndingHero* this) { + this->isIdle = true; + this->actionFunc = EnEndingHero1_Idle; } -void func_80C1E764(EnEndingHero* this, PlayState* play) { +void EnEndingHero1_Idle(EnEndingHero* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } @@ -60,7 +59,7 @@ void EnEndingHero_Update(Actor* thisx, PlayState* play) { EnEndingHero* this = THIS; if (this->unk240 == 0) { - this->unk242 += 1; + this->unk242++; if (this->unk242 > 2) { this->unk242 = 0; this->unk240 = (s16)Rand_ZeroFloat(60.0f) + 0x14; diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h index 6049e3449..21f5266e7 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h @@ -2,6 +2,7 @@ #define Z_EN_ENDING_HERO_H #include "global.h" +#include "objects/object_dt/object_dt.h" struct EnEndingHero; @@ -10,12 +11,12 @@ typedef void (*EnEndingHeroActionFunc)(struct EnEndingHero*, PlayState*); typedef struct EnEndingHero { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[15]; - /* 0x1E2 */ Vec3s morphTable[15]; + /* 0x188 */ Vec3s jointTable[OBJECT_DT_LIMB_MAX]; + /* 0x1E2 */ Vec3s morphTable[OBJECT_DT_LIMB_MAX]; /* 0x23C */ EnEndingHeroActionFunc actionFunc; /* 0x240 */ s16 unk240; /* 0x242 */ s16 unk242; - /* 0x244 */ u16 unk244; + /* 0x244 */ u16 isIdle; } EnEndingHero; // size = 0x248 #endif // Z_EN_ENDING_HERO_H diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c index 604bcd583..31bc4be65 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c +++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c @@ -5,9 +5,8 @@ */ #include "z_en_ending_hero2.h" -#include "objects/object_bai/object_bai.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero2*)thisx) @@ -16,8 +15,8 @@ void EnEndingHero2_Destroy(Actor* thisx, PlayState* play); void EnEndingHero2_Update(Actor* thisx, PlayState* play); void EnEndingHero2_Draw(Actor* thisx, PlayState* play); -void func_80C232E8(EnEndingHero2* this); -void func_80C23304(EnEndingHero2* this, PlayState* play); +void EnEndingHero2_SetupIdle(EnEndingHero2* this); +void EnEndingHero2_Idle(EnEndingHero2* this, PlayState* play); ActorInit En_Ending_Hero2_InitVars = { ACTOR_EN_ENDING_HERO2, @@ -36,23 +35,23 @@ void EnEndingHero2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, - this->morphTable, 20); + this->morphTable, OBJECT_BAI_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - func_80C232E8(this); + EnEndingHero2_SetupIdle(this); } void EnEndingHero2_Destroy(Actor* thisx, PlayState* play) { } -void func_80C232E8(EnEndingHero2* this) { - this->unk27C = 1; - this->actionFunc = func_80C23304; +void EnEndingHero2_SetupIdle(EnEndingHero2* this) { + this->isIdle = true; + this->actionFunc = EnEndingHero2_Idle; } -void func_80C23304(EnEndingHero2* this, PlayState* play) { +void EnEndingHero2_Idle(EnEndingHero2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h index 2ad3b4914..4f18b8e22 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h +++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h @@ -2,6 +2,7 @@ #define Z_EN_ENDING_HERO2_H #include "global.h" +#include "objects/object_bai/object_bai.h" struct EnEndingHero2; @@ -10,10 +11,10 @@ typedef void (*EnEndingHero2ActionFunc)(struct EnEndingHero2*, PlayState*); typedef struct EnEndingHero2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[20]; - /* 0x200 */ Vec3s morphTable[20]; + /* 0x188 */ Vec3s jointTable[OBJECT_BAI_LIMB_MAX]; + /* 0x200 */ Vec3s morphTable[OBJECT_BAI_LIMB_MAX]; /* 0x278 */ EnEndingHero2ActionFunc actionFunc; - /* 0x27C */ u16 unk27C; + /* 0x27C */ u16 isIdle; } EnEndingHero2; // size = 0x280 #endif // Z_EN_ENDING_HERO2_H diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c index e95d8a6a7..bfca5a5b5 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c @@ -5,9 +5,8 @@ */ #include "z_en_ending_hero3.h" -#include "objects/object_toryo/object_toryo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero3*)thisx) @@ -16,8 +15,8 @@ void EnEndingHero3_Destroy(Actor* thisx, PlayState* play); void EnEndingHero3_Update(Actor* thisx, PlayState* play); void EnEndingHero3_Draw(Actor* thisx, PlayState* play); -void func_80C23518(EnEndingHero3* this); -void func_80C23534(EnEndingHero3* this, PlayState* play); +void EnEndingHero3_SetupIdle(EnEndingHero3* this); +void EnEndingHero3_Idle(EnEndingHero3* this, PlayState* play); ActorInit En_Ending_Hero3_InitVars = { ACTOR_EN_ENDING_HERO3, @@ -36,23 +35,23 @@ void EnEndingHero3_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable, - this->morphTable, 17); + this->morphTable, OBJECT_TORYO_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - func_80C23518(this); + EnEndingHero3_SetupIdle(this); } void EnEndingHero3_Destroy(Actor* thisx, PlayState* play) { } -void func_80C23518(EnEndingHero3* this) { - this->unk258 = 1; - this->actionFunc = func_80C23534; +void EnEndingHero3_SetupIdle(EnEndingHero3* this) { + this->isIdle = true; + this->actionFunc = EnEndingHero3_Idle; } -void func_80C23534(EnEndingHero3* this, PlayState* play) { +void EnEndingHero3_Idle(EnEndingHero3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h index 0887df1ab..21aaa079e 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h @@ -2,6 +2,7 @@ #define Z_EN_ENDING_HERO3_H #include "global.h" +#include "objects/object_toryo/object_toryo.h" struct EnEndingHero3; @@ -10,10 +11,10 @@ typedef void (*EnEndingHero3ActionFunc)(struct EnEndingHero3*, PlayState*); typedef struct EnEndingHero3 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[OBJECT_TORYO_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[OBJECT_TORYO_LIMB_MAX]; /* 0x254 */ EnEndingHero3ActionFunc actionFunc; - /* 0x258 */ u16 unk258; + /* 0x258 */ u16 isIdle; } EnEndingHero3; // size = 0x25C #endif // Z_EN_ENDING_HERO3_H diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c index 39fd515b1..b75e0f21c 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c @@ -5,9 +5,8 @@ */ #include "z_en_ending_hero4.h" -#include "objects/object_sdn/object_sdn.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero4*)thisx) @@ -16,8 +15,8 @@ void EnEndingHero4_Destroy(Actor* thisx, PlayState* play); void EnEndingHero4_Update(Actor* thisx, PlayState* play); void EnEndingHero4_Draw(Actor* thisx, PlayState* play); -void func_80C23748(EnEndingHero4* this); -void func_80C23764(EnEndingHero4* this, PlayState* play); +void EnEndingHero4_SetupIdle(EnEndingHero4* this); +void EnEndingHero4_Idle(EnEndingHero4* this, PlayState* play); ActorInit En_Ending_Hero4_InitVars = { ACTOR_EN_ENDING_HERO4, @@ -36,23 +35,23 @@ void EnEndingHero4_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierCheerWithSpear, this->jointTable, - this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierCheerWithSpearAnim, this->jointTable, + this->morphTable, SOLDIER_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - func_80C23748(this); + EnEndingHero4_SetupIdle(this); } void EnEndingHero4_Destroy(Actor* thisx, PlayState* play) { } -void func_80C23748(EnEndingHero4* this) { - this->unk258 = 1; - this->actionFunc = func_80C23764; +void EnEndingHero4_SetupIdle(EnEndingHero4* this) { + this->isIdle = true; + this->actionFunc = EnEndingHero4_Idle; } -void func_80C23764(EnEndingHero4* this, PlayState* play) { +void EnEndingHero4_Idle(EnEndingHero4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h index 4cada4183..e52b41124 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h @@ -2,6 +2,7 @@ #define Z_EN_ENDING_HERO4_H #include "global.h" +#include "objects/object_sdn/object_sdn.h" struct EnEndingHero4; @@ -10,10 +11,10 @@ typedef void (*EnEndingHero4ActionFunc)(struct EnEndingHero4*, PlayState*); typedef struct EnEndingHero4 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[SOLDIER_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[SOLDIER_LIMB_MAX]; /* 0x254 */ EnEndingHero4ActionFunc actionFunc; - /* 0x258 */ u16 unk258; + /* 0x258 */ u16 isIdle; } EnEndingHero4; // size = 0x25C #endif // Z_EN_ENDING_HERO4_H diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c index dd656f903..2120f0a27 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c @@ -5,9 +5,8 @@ */ #include "z_en_ending_hero5.h" -#include "objects/object_daiku/object_daiku.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero5*)thisx) @@ -16,8 +15,8 @@ void EnEndingHero5_Destroy(Actor* thisx, PlayState* play); void EnEndingHero5_Update(Actor* thisx, PlayState* play); void EnEndingHero5_Draw(Actor* thisx, PlayState* play); -void func_80C23980(EnEndingHero5* this); -void func_80C2399C(EnEndingHero5* this, PlayState* play); +void EnEndingHero5_SetupIdle(EnEndingHero5* this); +void EnEndingHero5_Idle(EnEndingHero5* this, PlayState* play); ActorInit En_Ending_Hero5_InitVars = { ACTOR_EN_ENDING_HERO5, @@ -36,24 +35,24 @@ void EnEndingHero5_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, this->jointTable, - this->morphTable, 17); + this->morphTable, OBJECT_DAIKU_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); this->unk25C = this->actor.params; - func_80C23980(this); + EnEndingHero5_SetupIdle(this); } void EnEndingHero5_Destroy(Actor* thisx, PlayState* play) { } -void func_80C23980(EnEndingHero5* this) { - this->unk258 = 1; - this->actionFunc = func_80C2399C; +void EnEndingHero5_SetupIdle(EnEndingHero5* this) { + this->isIdle = true; + this->actionFunc = EnEndingHero5_Idle; } -void func_80C2399C(EnEndingHero5* this, PlayState* play) { +void EnEndingHero5_Idle(EnEndingHero5* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } @@ -75,7 +74,7 @@ void EnEndingHero5_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == 15) { + if (limbIndex == OBJECT_DAIKU_LIMB_0F) { gSPDisplayList(POLY_OPA_DISP++, D_80C23BF0[this->unk25C]); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h index 9e3dab09e..fec2d112a 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h @@ -2,6 +2,7 @@ #define Z_EN_ENDING_HERO5_H #include "global.h" +#include "objects/object_daiku/object_daiku.h" struct EnEndingHero5; @@ -10,10 +11,10 @@ typedef void (*EnEndingHero5ActionFunc)(struct EnEndingHero5*, PlayState*); typedef struct EnEndingHero5 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[17]; - /* 0x1EE */ Vec3s morphTable[17]; + /* 0x188 */ Vec3s jointTable[OBJECT_DAIKU_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[OBJECT_DAIKU_LIMB_MAX]; /* 0x254 */ EnEndingHero5ActionFunc actionFunc; - /* 0x258 */ u16 unk258; + /* 0x258 */ u16 isIdle; /* 0x25C */ s32 unk25C; } EnEndingHero5; // size = 0x260 diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index 9c5bbf42e..47312b722 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -5,13 +5,8 @@ */ #include "z_en_ending_hero6.h" -#include "objects/object_dt/object_dt.h" -#include "objects/object_daiku/object_daiku.h" -#include "objects/object_bai/object_bai.h" -#include "objects/object_toryo/object_toryo.h" -#include "objects/object_sdn/object_sdn.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnEndingHero6*)thisx) @@ -20,7 +15,6 @@ void EnEndingHero6_Destroy(Actor* thisx, PlayState* play); void EnEndingHero6_Update(Actor* thisx, PlayState* play); void EnEndingHero6_Draw(Actor* thisx, PlayState* play); -void EnEndingHero6_InitSkelAnime(EnEndingHero6* this, s32 npcIndex); void EnEndingHero6_SetupIdle(EnEndingHero6* this); void EnEndingHero6_Idle(EnEndingHero6* this, PlayState* play); @@ -36,29 +30,64 @@ ActorInit En_Ending_Hero6_InitVars = { (ActorFunc)EnEndingHero6_Draw, }; -static FlexSkeletonHeader* sSkeletons[] = { - &object_dt_Skel_00B0CC, &object_bai_Skel_007908, &object_toryo_Skel_007150, &gSoldierSkel, - &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, - &object_daiku_Skel_00A850, +typedef enum { + /* 0 */ ENDING_HERO6_TYPE_DT, + /* 1 */ ENDING_HERO6_TYPE_BAI, + /* 2 */ ENDING_HERO6_TYPE_TORYO, + /* 3 */ ENDING_HERO6_TYPE_SOLDIER, + /* 4 */ ENDING_HERO6_TYPE_DAIKU_RED, + /* 5 */ ENDING_HERO6_TYPE_DAIKU_BLUE, + /* 6 */ ENDING_HERO6_TYPE_DAIKU_GREEN, + /* 7 */ ENDING_HERO6_TYPE_DAIKU_PURPLE, + /* 8 */ ENDING_HERO6_TYPE_DAIKU_ORANGE, + /* 9 */ ENDING_HERO6_TYPE_MAX +} EndingHero6Type; + +static FlexSkeletonHeader* sSkeletons[ENDING_HERO6_TYPE_MAX] = { + &object_dt_Skel_00B0CC, // ENDING_HERO6_TYPE_DT + &object_bai_Skel_007908, // ENDING_HERO6_TYPE_BAI + &object_toryo_Skel_007150, // ENDING_HERO6_TYPE_TORYO + &gSoldierSkel, // ENDING_HERO6_TYPE_SOLDIER + &object_daiku_Skel_00A850, // ENDING_HERO6_TYPE_DAIKU_RED + &object_daiku_Skel_00A850, // ENDING_HERO6_TYPE_DAIKU_BLUE + &object_daiku_Skel_00A850, // ENDING_HERO6_TYPE_DAIKU_GREEN + &object_daiku_Skel_00A850, // ENDING_HERO6_TYPE_DAIKU_PURPLE + &object_daiku_Skel_00A850, // ENDING_HERO6_TYPE_DAIKU_ORANGE }; -static AnimationHeader* sAnimations[] = { - &object_dt_Anim_000BE0, &object_bai_Anim_0011C0, &object_toryo_Anim_000E50, - &gSoldierCheerWithSpear, &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0, - &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0, +static AnimationHeader* sAnimations[ENDING_HERO6_TYPE_MAX] = { + &object_dt_Anim_000BE0, // ENDING_HERO6_TYPE_DT + &object_bai_Anim_0011C0, // ENDING_HERO6_TYPE_BAI + &object_toryo_Anim_000E50, // ENDING_HERO6_TYPE_TORYO + &gSoldierCheerWithSpearAnim, // ENDING_HERO6_TYPE_SOLDIER + &object_daiku_Anim_002FA0, // ENDING_HERO6_TYPE_DAIKU_RED + &object_daiku_Anim_002FA0, // ENDING_HERO6_TYPE_DAIKU_BLUE + &object_daiku_Anim_002FA0, // ENDING_HERO6_TYPE_DAIKU_GREEN + &object_daiku_Anim_002FA0, // ENDING_HERO6_TYPE_DAIKU_PURPLE + &object_daiku_Anim_002FA0, // ENDING_HERO6_TYPE_DAIKU_ORANGE }; -static s32 sLimbCounts[] = { 15, 20, 17, 17, 17, 17, 17, 17, 17 }; +static s32 sLimbCounts[ENDING_HERO6_TYPE_MAX] = { + OBJECT_DT_LIMB_MAX, // ENDING_HERO6_TYPE_DT + OBJECT_BAI_LIMB_MAX, // ENDING_HERO6_TYPE_BAI + OBJECT_TORYO_LIMB_MAX, // ENDING_HERO6_TYPE_TORYO + SOLDIER_LIMB_MAX, // ENDING_HERO6_TYPE_SOLDIER + OBJECT_DAIKU_LIMB_MAX, // ENDING_HERO6_TYPE_DAIKU_RED + OBJECT_DAIKU_LIMB_MAX, // ENDING_HERO6_TYPE_DAIKU_BLUE + OBJECT_DAIKU_LIMB_MAX, // ENDING_HERO6_TYPE_DAIKU_GREEN + OBJECT_DAIKU_LIMB_MAX, // ENDING_HERO6_TYPE_DAIKU_PURPLE + OBJECT_DAIKU_LIMB_MAX, // ENDING_HERO6_TYPE_DAIKU_ORANGE +}; void EnEndingHero6_Init(Actor* thisx, PlayState* play) { EnEndingHero6* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->npcIndex], sAnimations[this->npcIndex], - this->jointTable, this->morphTable, sLimbCounts[this->npcIndex]); + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->type], sAnimations[this->type], this->jointTable, + this->morphTable, sLimbCounts[this->type]); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); EnEndingHero6_SetupIdle(this); } @@ -66,15 +95,16 @@ void EnEndingHero6_Init(Actor* thisx, PlayState* play) { void EnEndingHero6_Destroy(Actor* thisx, PlayState* play) { } -void EnEndingHero6_InitSkelAnime(EnEndingHero6* this, s32 npcIndex) { - this->animIndex = npcIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[npcIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.f, this->frameCount, ANIMMODE_LOOP, 0.0f); +void EnEndingHero6_ChangeAnim(EnEndingHero6* this, s32 type) { + this->animIndex = type; + this->animEndFrame = Animation_GetLastFrame(sAnimations[type]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.f, this->animEndFrame, ANIMMODE_LOOP, + 0.0f); } void EnEndingHero6_SetupIdle(EnEndingHero6* this) { - EnEndingHero6_InitSkelAnime(this, this->npcIndex); - this->isIdle = 1; + EnEndingHero6_ChangeAnim(this, this->type); + this->isIdle = true; this->actionFunc = EnEndingHero6_Idle; } @@ -107,16 +137,21 @@ void EnEndingHero6_Update(Actor* thisx, PlayState* play) { } void EnEndingHero6_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Gfx* D_80C2426C[] = { object_daiku_DL_0070C0, object_daiku_DL_006FB0, object_daiku_DL_006E80, - object_daiku_DL_006D70, object_daiku_DL_00A390 }; + static Gfx* D_80C2426C[] = { + object_daiku_DL_0070C0, // ENDING_HERO6_TYPE_DAIKU_RED + object_daiku_DL_006FB0, // ENDING_HERO6_TYPE_DAIKU_BLUE + object_daiku_DL_006E80, // ENDING_HERO6_TYPE_DAIKU_GREEN + object_daiku_DL_006D70, // ENDING_HERO6_TYPE_DAIKU_PURPLE + object_daiku_DL_00A390, // ENDING_HERO6_TYPE_DAIKU_ORANGE + }; EnEndingHero6* this = THIS; - s32 index; + s32 daikuIndex; OPEN_DISPS(play->state.gfxCtx); - if ((this->npcIndex >= 4) && (limbIndex == 15)) { - index = this->npcIndex - 4; - gSPDisplayList(POLY_OPA_DISP++, D_80C2426C[index]); + if ((this->type >= ENDING_HERO6_TYPE_DAIKU_RED) && (limbIndex == OBJECT_DAIKU_LIMB_0F)) { + daikuIndex = this->type - ENDING_HERO6_TYPE_DAIKU_RED; + gSPDisplayList(POLY_OPA_DISP++, D_80C2426C[daikuIndex]); } CLOSE_DISPS(play->state.gfxCtx); @@ -130,33 +165,33 @@ void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { EnEndingHero6* this = THIS; s32 index = 0; - if (this->isIdle == 1) { + if (this->isIdle == true) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); - if ((this->objectIndex >= 0) && Object_IsLoaded(&play->objectCtx, this->objectIndex)) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectIndex].segment); + if ((this->objectSlot > OBJECT_SLOT_NONE) && Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlot].segment); - switch (this->npcIndex) { - case 4: + switch (this->type) { + case ENDING_HERO6_TYPE_DAIKU_RED: gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); break; - case 5: + case ENDING_HERO6_TYPE_DAIKU_BLUE: gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); break; - case 6: + case ENDING_HERO6_TYPE_DAIKU_GREEN: gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); break; - case 7: + case ENDING_HERO6_TYPE_DAIKU_PURPLE: gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); break; - case 8: + case ENDING_HERO6_TYPE_DAIKU_ORANGE: gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255); break; @@ -164,7 +199,7 @@ void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { break; } - if (this->npcIndex == 0) { + if (this->type == ENDING_HERO6_TYPE_DT) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); if (this->eyeState < 3) { diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h index 76af1d67f..3ec5698e0 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h @@ -2,24 +2,36 @@ #define Z_EN_ENDING_HERO6_H #include "global.h" +#include "objects/object_dt/object_dt.h" +#include "objects/object_daiku/object_daiku.h" +#include "objects/object_bai/object_bai.h" +#include "objects/object_toryo/object_toryo.h" +#include "objects/object_sdn/object_sdn.h" struct EnEndingHero6; typedef void (*EnEndingHero6ActionFunc)(struct EnEndingHero6*, PlayState*); +#define ENDING_HERO6_LIMB_MAX \ + MAX(MAX(MAX(MAX((s32)OBJECT_DT_LIMB_MAX, \ + (s32)OBJECT_BAI_LIMB_MAX), \ + (s32)OBJECT_TORYO_LIMB_MAX), \ + (s32)SOLDIER_LIMB_MAX), \ + (s32)OBJECT_DAIKU_LIMB_MAX) + typedef struct EnEndingHero6 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[20]; - /* 0x200 */ Vec3s morphTable[20]; + /* 0x188 */ Vec3s jointTable[ENDING_HERO6_LIMB_MAX]; + /* 0x200 */ Vec3s morphTable[ENDING_HERO6_LIMB_MAX]; /* 0x278 */ EnEndingHero6ActionFunc actionFunc; /* 0x27C */ s32 animIndex; - /* 0x280 */ s32 npcIndex; - /* 0x284 */ s8 objectIndex; + /* 0x280 */ s32 type; + /* 0x284 */ s8 objectSlot; /* 0x286 */ s16 timer; /* 0x288 */ s16 blinkTimer; /* 0x28A */ s16 eyeState; - /* 0x28C */ f32 frameCount; + /* 0x28C */ f32 animEndFrame; /* 0x290 */ s16 isIdle; } EnEndingHero6; // size = 0x294 diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c index 64bfdaecc..a40bf8718 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -75,7 +75,7 @@ void EnEstone_Init(Actor* thisx, PlayState* play) { this->scale = (Rand_ZeroFloat(1.0f) * 0.005f) + 0.005f; this->actor.velocity.y = Rand_ZeroFloat(10.0f) + 15.0f; this->actor.gravity = -2.0f; - } else { + } else { // ENESTONE_TYPE_SMALL this->actor.speed = Rand_ZeroFloat(3.0f) + 1.0f; this->scale = (Rand_ZeroFloat(1.0f) * 0.003f) + 0.003f; this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 7.0f; 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 03989b01f..33a6bf992 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -16,6 +16,7 @@ */ #include "z_en_fall.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_fall/object_fall.h" #include "objects/object_fall2/object_fall2.h" #include "objects/object_lodmoon/object_lodmoon.h" @@ -114,6 +115,9 @@ void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, PlayState* play) { this->actor.home.pos.y - (finalDayRelativeHeight * 6700.0f * (this->scale * 6.25f)); } break; + + default: + break; } } @@ -128,7 +132,7 @@ void EnFall_RisingDebris_ResetEffects(EnFall* this) { void EnFall_Init(Actor* thisx, PlayState* play) { EnFall* this = THIS; - s32 objectIndex; + s32 objectSlot; this->eyeGlowIntensity = 0.0f; this->flags = 0; @@ -161,27 +165,27 @@ void EnFall_Init(Actor* thisx, PlayState* play) { case EN_FALL_TYPE_LODMOON_NO_LERP: case EN_FALL_TYPE_LODMOON: case EN_FALL_TYPE_LODMOON_INVERTED_STONE_TOWER: - objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LODMOON); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LODMOON); break; case EN_FALL_TYPE_MOONS_TEAR: - objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_MOONSTON); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MOONSTON); break; case EN_FALL_TYPE_STOPPED_MOON_OPEN_MOUTH: - objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_FALL2); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FALL2); break; default: - objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_FALL); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FALL); break; } - if (objectIndex < 0) { + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } - this->objIndex = objectIndex; + this->objectSlot = objectSlot; this->actionFunc = EnFall_Setup; } @@ -206,8 +210,8 @@ Actor* EnFall_MoonsTear_GetTerminaFieldMoon(PlayState* play) { void EnFall_Setup(EnFall* this, PlayState* play) { Actor* moon; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - this->actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; this->actionFunc = EnFall_Moon_PerformDefaultActions; switch (EN_FALL_TYPE(&this->actor)) { case EN_FALL_TYPE_TITLE_SCREEN_MOON: @@ -353,6 +357,9 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { case 9: play->csCtx.curFrame--; break; + + default: + break; } } } @@ -391,6 +398,9 @@ void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* case 4: this->actor.draw = EnFall_OpenMouthMoon_Draw; break; + + default: + break; } } } @@ -405,6 +415,9 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 4: this->actor.draw = NULL; break; + + default: + break; } } @@ -423,9 +436,12 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 1303: Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; + + default: + break; } if (play->csCtx.curFrame >= 1145) { - func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; @@ -442,18 +458,24 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 737: Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; + + default: + break; } if (play->csCtx.curFrame >= 650) { - func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; + + default: + break; } } } void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_OKUJOU)) { - func_800B9010(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); } } @@ -524,11 +546,11 @@ void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -2); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_EXPLOSION)); this->actor.draw = NULL; this->actionFunc = EnFall_MoonsTear_DoNothing; } else { - func_800B9010(&this->actor, NA_SE_EV_MOONSTONE_FALL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_MOONSTONE_FALL - SFX_FLAG); } } } @@ -539,20 +561,20 @@ void EnFall_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } +static u8 sAlphaTableIndices[] = { + 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 0, 1, 1, 1, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 0, 1, 1, 1, 4, 4, 1, + 1, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 4, 0, 4, 4, 0, 4, 4, 1, 1, 1, 1, + 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 4, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, + 1, 4, 4, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, + 2, 0, 0, 1, 0, 2, 0, 0, 2, 1, 2, 0, 1, 0, 1, 0, 0, 1, 2, 2, 0, 0, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, + 0, 0, 2, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, +}; + /** * Updates the alpha for every vertex in the fire ball so that some parts of * the sphere are more transparent or opaque than others. */ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { - static u8 sAlphaTableIndex[] = { - 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 0, 1, 1, 1, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 0, 1, 1, 1, 4, 4, 1, - 1, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 4, 0, 4, 4, 0, 4, 4, 1, 1, 1, 1, - 1, 1, 3, 3, 0, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 4, 4, 0, 4, 0, 1, 1, 1, 3, 0, 3, 3, 0, 0, 1, 1, 1, 1, 1, - 1, 4, 4, 0, 4, 4, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, - 2, 0, 0, 1, 0, 2, 0, 0, 2, 1, 2, 0, 1, 0, 1, 0, 0, 1, 2, 2, 0, 0, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, - 0, 0, 2, 0, 2, 2, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 0, 0, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, - }; - s32 pad; u8 perVertexAlphaTable[5]; Vtx* vertices = Lib_SegmentedToVirtual(gMoonFireballVtx); @@ -567,8 +589,8 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { perVertexAlphaTable[3] = (s8)(104.0f * fireballAlpha); perVertexAlphaTable[4] = (s8)(54.0f * fireballAlpha); - for (i = 0; i < ARRAY_COUNT(sAlphaTableIndex); i++, vertices++) { - vertices->v.cn[3] = perVertexAlphaTable[sAlphaTableIndex[i]]; + for (i = 0; i < ARRAY_COUNT(sAlphaTableIndices); i++, vertices++) { + vertices->v.cn[3] = perVertexAlphaTable[sAlphaTableIndices[i]]; } } @@ -627,7 +649,7 @@ void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { } if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_450) && (this->fireballAlpha > 0)) { - func_8019F128(NA_SE_EV_MOON_FALL_LAST - SFX_FLAG); + Audio_PlaySfx_2(NA_SE_EV_MOON_FALL_LAST - SFX_FLAG); } Actor_SetScale(&this->actor, this->scale * 1.74f); } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.h b/src/overlays/actors/ovl_En_Fall/z_en_fall.h index 60bb7ec33..dde56ce91 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.h +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.h @@ -30,7 +30,7 @@ typedef struct EnFall { /* 0x000 */ Actor actor; /* 0x144 */ s16 dayStartTime; /* 0x146 */ s16 currentDay; - /* 0x148 */ u8 objIndex; + /* 0x148 */ u8 objectSlot; /* 0x14C */ f32 scale; /* 0x150 */ union { f32 eyeGlowIntensity; diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index bdf742ec3..8ba7c66bc 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -15,11 +15,8 @@ void EnFall2_Destroy(Actor* thisx, PlayState* play); void EnFall2_Update(Actor* thisx, PlayState* play); void EnFall2_Draw(Actor* thisx, PlayState* play); -void func_80C1B724(f32 arg0); void EnFall2_DoNothing(EnFall2* this, PlayState* play); -void func_80C1B9D4(EnFall2* this, PlayState* play); -void func_80C1B8F0(EnFall2* this); -void func_80C1B9D4(EnFall2* this, PlayState* play); +void EnFall2_HandleCutscene(EnFall2* this, PlayState* play); ActorInit En_Fall2_InitVars = { ACTOR_EN_FALL2, @@ -43,7 +40,7 @@ void EnFall2_Init(Actor* thisx, PlayState* play) { func_801835EC(&this->skeletonInfo, object_fall2_Blob_005EF4); this->unk2DC = Lib_SegmentedToVirtual(object_fall2_Matanimheader_008840); Actor_SetScale(&this->actor, 0.02f); - this->actionFunc = func_80C1B9D4; + this->actionFunc = EnFall2_HandleCutscene; this->cueType = CS_CMD_ACTOR_CUE_561; this->alphaLevel = 0.0f; } @@ -54,7 +51,7 @@ void EnFall2_Destroy(Actor* thisx, PlayState* play) { func_8018349C(&this->skeletonInfo); } -u8 sAlphaTableIndices[] = { +static u8 sAlphaTableIndices[] = { 0, 2, 0, 0, 4, 0, 4, 4, 2, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 2, 0, 4, 2, 2, 0, 4, 4, 4, 4, 0, 2, 2, 4, 0, 2, 0, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 4, 4, 4, 2, 2, 0, 4, 4, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 4, 4, 4, 4, 4, 2, 2, 0, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 0, 2, 2, 4, 4, 4, 4, 4, 4, @@ -106,6 +103,7 @@ void func_80C1B8F0(EnFall2* this) { this->alphaLevel = 1.0f; } break; + case 2: if (this->alphaLevel > 0.0f) { this->alphaLevel -= 0.1f; @@ -120,10 +118,13 @@ void func_80C1B8F0(EnFall2* this) { } this->actor.scale.z = this->actor.scale.x; } + + default: + break; } } -void func_80C1B9D4(EnFall2* this, PlayState* play) { +void EnFall2_HandleCutscene(EnFall2* this, PlayState* play) { func_80183DE0(&this->skeletonInfo); if (Cutscene_IsCueInChannel(play, this->cueType)) { Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); @@ -133,7 +134,7 @@ void func_80C1B9D4(EnFall2* this, PlayState* play) { } func_80C1B8F0(this); if (this->alphaLevel > 0.0f) { - func_800B9010(&this->actor, NA_SE_EV_MOON_LIGHT_PILLAR - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_MOON_LIGHT_PILLAR - SFX_FLAG); } } else { this->actor.draw = NULL; 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 269866ff0..8219a23a3 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnFamos*)thisx) @@ -18,9 +18,6 @@ void EnFamos_Destroy(Actor* thisx, PlayState* play); void EnFamos_Update(Actor* thisx, PlayState* play); void EnFamos_Draw(Actor* thisx, PlayState* play); -void EnFamos_SetupAttackDebris(EnFamos* this); -void EnFamos_SetupDeathDebris(EnFamos* this); -s32 EnFamos_IsPlayerSeen(EnFamos* this, PlayState* play); void EnFamos_SetupStillIdle(EnFamos* this); void EnFamos_StillIdle(EnFamos* this, PlayState* play); void EnFamos_SetupPathingIdle(EnFamos* this); @@ -49,7 +46,6 @@ void EnFamos_SetupDeathExplosion(EnFamos* this); void EnFamos_DeathExplosion(EnFamos* this, PlayState* play); void EnFamos_SetupDeathFade(EnFamos* this); void EnFamos_DeathFade(EnFamos* this, PlayState* play); -void EnFamos_DrawDebris(EnFamos* this, PlayState* play); ActorInit En_Famos_InitVars = { ACTOR_EN_FAMOS, @@ -177,7 +173,7 @@ void EnFamos_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawSquare, 30.0f); - SkelAnime_Init(play, &this->skelAnime, &gFamosSkeleton, &gFamosIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gFamosSkel, &gFamosIdleAnim, this->jointTable, this->morphTable, FAMOS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); @@ -232,9 +228,9 @@ void EnFamos_SetupAttackDebris(EnFamos* this) { rock->velocity.x = randFloat * Math_CosS(randOffset) * Math_SinS(randVelDirection); rock->velocity.y = Math_SinS(randOffset) * randFloat + 3.0f; rock->velocity.z = randFloat * Math_CosS(randOffset) * Math_CosS(randVelDirection); - rock->rotation.x = (s32)Rand_Next() >> 0x10; - rock->rotation.y = (s32)Rand_Next() >> 0x10; - rock->rotation.z = (s32)Rand_Next() >> 0x10; + rock->rot.x = (s32)Rand_Next() >> 0x10; + rock->rot.y = (s32)Rand_Next() >> 0x10; + rock->rot.z = (s32)Rand_Next() >> 0x10; rock->pos.x = (Math_SinS(randVelDirection) * 20.0f) + this->actor.world.pos.x; rock->pos.y = this->actor.floorHeight; rock->pos.z = (Math_CosS(randVelDirection) * 20.0f) + this->actor.world.pos.z; @@ -261,9 +257,9 @@ void EnFamos_SetupDeathDebris(EnFamos* this) { rock->velocity.x = randFloat * Math_CosS(randSmaller) * Math_SinS(randVelDirection); rock->velocity.y = Math_SinS(randSmaller) * randFloat + 4.5f; rock->velocity.z = randFloat * Math_CosS(randSmaller) * Math_CosS(randVelDirection); - rock->rotation.x = (s32)Rand_Next() >> 0x10; - rock->rotation.y = (s32)Rand_Next() >> 0x10; - rock->rotation.z = (s32)Rand_Next() >> 0x10; + rock->rot.x = (s32)Rand_Next() >> 0x10; + rock->rot.y = (s32)Rand_Next() >> 0x10; + rock->rot.z = (s32)Rand_Next() >> 0x10; rock->pos.x = Math_SinS(randVelDirection) * 20.0f + this->actor.world.pos.x; rock->pos.y = Rand_CenteredFloat(60.0f) + (this->actor.world.pos.y + 40.0f); rock->pos.z = Math_CosS(randVelDirection) * 20.0f + this->actor.world.pos.z; @@ -290,9 +286,9 @@ void EnFamos_UpdateBobbingHeight(EnFamos* this) { this->actor.world.pos.y = (Math_SinS(this->hoverTimer * 0x888) * 10.0f) + this->baseHeight; if (ABS_ALT(this->flipRot) > 0x4000) { // is famos upside down - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); } } @@ -463,9 +459,9 @@ void EnFamos_SetupAlert(EnFamos* this) { void EnFamos_Alert(EnFamos* this, PlayState* play) { if (ABS_ALT(this->flipRot) > 0x4000) { - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); } this->stateTimer--; @@ -501,7 +497,7 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { Math_StepToF(&this->actor.speed, 6.0f, 0.5f); surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough + if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && ((surfaceType != FLOOR_PROPERTY_12) && (surfaceType != FLOOR_PROPERTY_13))) { EnFamos_SetupAttackAim(this); @@ -520,7 +516,7 @@ void EnFamos_SetupAttackAim(EnFamos* this) { } void EnFamos_AttackAim(EnFamos* this, PlayState* play) { - func_800B9010(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); if (SkelAnime_Update(&this->skelAnime)) { EnFamos_SetupAttack(this); } @@ -574,7 +570,7 @@ void EnFamos_Attack(EnFamos* this, PlayState* play) { EnFamos_SetupAttackRebound(this); } } else { - func_800B9010(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); } } @@ -612,9 +608,9 @@ void EnFamos_AttackRebound(EnFamos* this, PlayState* play) { Math_StepToF(&this->actor.speed, 5.0f, 0.3f); if (this->actor.speed > 1.0f) { if (ABS_ALT(this->flipRot) > 0x4000) { - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FAMOS_FLOAT - SFX_FLAG); } } @@ -710,7 +706,7 @@ void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { void EnFamos_SetupDeathFade(EnFamos* this) { EnFamos_SetupDeathDebris(this); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.shape.shadowDraw = NULL; this->actionFunc = EnFamos_DeathFade; this->actor.speed = 0.0f; @@ -736,9 +732,9 @@ void EnFamos_UpdateDebrisPosRot(EnFamos* this) { for (i = 0; i < ARRAY_COUNT(this->rocks); i++, rock++) { rock->velocity.y -= 1.0f; Math_Vec3f_Sum(&rock->pos, &rock->velocity, &rock->pos); - rock->rotation.x += (s16)((Rand_Next() >> 0x17) + 0x700); - rock->rotation.y += (s16)((Rand_Next() >> 0x17) + 0x900); - rock->rotation.z += (s16)((Rand_Next() >> 0x17) + 0xB00); + rock->rot.x += (s16)((Rand_Next() >> 0x17) + 0x700); + rock->rot.y += (s16)((Rand_Next() >> 0x17) + 0x900); + rock->rot.z += (s16)((Rand_Next() >> 0x17) + 0xB00); } } @@ -788,7 +784,7 @@ void EnFamos_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->emblemCollider.base); } - if (this->collider2.base.atFlags & AC_ON) { + if (this->collider2.base.atFlags & AT_ON) { Collider_UpdateCylinder(&this->actor, &this->collider2); this->collider2.dim.pos.y = this->actor.floorHeight; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); @@ -842,7 +838,7 @@ void EnFamos_DrawDebris(EnFamos* this, PlayState* play) { rock = &this->rocks[0]; for (i = 0; i < ARRAY_COUNT(this->rocks); i++, rock++) { - Matrix_SetTranslateRotateYXZ(rock->pos.x, rock->pos.y, rock->pos.z, &rock->rotation); + Matrix_SetTranslateRotateYXZ(rock->pos.x, rock->pos.y, rock->pos.z, &rock->rot); Matrix_Scale(rock->scale, rock->scale, rock->scale, MTXMODE_APPLY); gSPMatrix(&dispOpa[3 + i * 2], Matrix_NewMtx(play->state.gfxCtx), 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 468356376..955b4b31f 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.h +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.h @@ -11,8 +11,8 @@ typedef void (*EnFamosActionFunc)(struct EnFamos*, PlayState*); typedef struct EnFamosRock { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; - /* 0x18 */ Vec3s rotation; - /* 0x20 */ f32 scale; + /* 0x18 */ Vec3s rot; + /* 0x20 */ f32 scale; } EnFamosRock; // size = 0x24 #define FAMOS_GET_PATH_INDEX(thisx) ((thisx)->params) 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 491d3c499..3da9f2673 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -5,10 +5,9 @@ */ #include "z_en_fg.h" -#include "objects/object_fr/object_fr.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_200 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_4000) #define THIS ((EnFg*)thisx) @@ -20,9 +19,18 @@ void EnFg_Draw(Actor* thisx, PlayState* play); void EnFg_Jump(EnFg* this, PlayState* play); void EnFg_DoNothing(EnFg* this, PlayState* play); void EnFg_Knockback(EnFg* this, PlayState* play); -void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos); -void EnFg_UpdateDust(EnFgEffectDust* dustEffect); -void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect); +void EnFg_AddDust(BetaFrogEffectDust* dustEffect, Vec3f* pos); +void EnFg_UpdateDust(BetaFrogEffectDust* dustEffect); +void EnFg_DrawDust(PlayState* play, BetaFrogEffectDust* dustEffect); + +typedef enum { + /* 0 */ BETAFROG_DMGEFFECT_NONE, + /* 1 */ BETAFROG_DMGEFFECT_EXPLOSION, // Bomb or bombchu, not powderkeg + /* 2 */ BETAFROG_DMGEFFECT_DEKUSTICK, + /* 3 */ BETAFROG_DMGEFFECT_HOOKSHOT, + /* 4 */ BETAFROG_DMGEFFECT_ARROW, + /* 5 */ BETAFROG_DMGEFFECT_ICEARROW +} BetaFrogDamageEffect; ActorInit En_Fg_InitVars = { ACTOR_EN_FG, @@ -95,29 +103,37 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -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 }, +typedef enum { + /* -1 */ BETAFROG_ANIM_NONE = -1, + /* 0 */ BETAFROG_ANIM_IDLE, + /* 1 */ BETAFROG_ANIM_IDLE_MORPH, + /* 2 */ BETAFROG_ANIM_DANCE, + /* 3 */ BETAFROG_ANIM_JUMP, + /* 4 */ BETAFROG_ANIM_MAX +} BetaFrogAnimation; + +static AnimationInfoS sAnimationInfo[BETAFROG_ANIM_MAX] = { + { &gFrogIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // BETAFROG_ANIM_IDLE + { &gFrogIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // BETAFROG_ANIM_IDLE_MORPH + { &gFrogDanceAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // BETAFROG_ANIM_DANCE + { &gFrogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // BETAFROG_ANIM_JUMP }; s32 EnFg_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { - s16 frameCount; - s32 ret; + s16 endFrame; + s32 didAnimChange = false; - ret = false; - if ((animIndex >= 0) && (animIndex < 4)) { - ret = true; - frameCount = sAnimationInfo[animIndex].frameCount; - if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + if ((animIndex > BETAFROG_ANIM_NONE) && (animIndex < BETAFROG_ANIM_MAX)) { + didAnimChange = true; + endFrame = sAnimationInfo[animIndex].frameCount; + if (endFrame < 0) { + endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, - sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].startFrame, endFrame, sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); } - return ret; + return didAnimChange; } void func_80A2D348(EnFg* this, PlayState* play) { @@ -130,7 +146,7 @@ void func_80A2D348(EnFg* this, PlayState* play) { } } -void func_80A2D3D4(EnFg* this, PlayState* play) { +void EnFg_UpdateSkelAnime(EnFg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } @@ -144,28 +160,28 @@ u8 EnFg_UpdateHealth(EnFg* this) { } s32 EnFg_GetDamageEffect(EnFg* this) { - s32 ret = 0; + s32 ret = BETAFROG_DMGEFFECT_NONE; if (this->collider.base.acFlags & AC_HIT) { switch (this->actor.colChkInfo.damageEffect) { case 1: - ret = FG_DMGEFFECT_DEKUSTICK; + ret = BETAFROG_DMGEFFECT_DEKUSTICK; break; case 15: - ret = FG_DMGEFFECT_HOOKSHOT; + ret = BETAFROG_DMGEFFECT_HOOKSHOT; break; case 14: - ret = FG_DMGEFFECT_ARROW; + ret = BETAFROG_DMGEFFECT_ARROW; break; case 3: - ret = FG_DMGEFFECT_ICEARROW; + ret = BETAFROG_DMGEFFECT_ICEARROW; break; default: - ret = FG_DMGEFFECT_EXPLOSION; + ret = BETAFROG_DMGEFFECT_EXPLOSION; break; } this->collider.base.acFlags &= ~AC_HIT; @@ -180,8 +196,8 @@ void EnFg_Idle(EnFg* this, PlayState* play) { s16 rotX; switch (EnFg_GetDamageEffect(this)) { - case FG_DMGEFFECT_DEKUSTICK: - this->actor.flags &= ~ACTOR_FLAG_1; + case BETAFROG_DMGEFFECT_DEKUSTICK: + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_1); this->skelAnime.playSpeed = 0.0f; this->actor.shape.shadowDraw = NULL; @@ -192,11 +208,11 @@ void EnFg_Idle(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_HOOKSHOT: + case BETAFROG_DMGEFFECT_HOOKSHOT: break; - case FG_DMGEFFECT_ARROW: - this->actor.flags &= ~ACTOR_FLAG_1; + case BETAFROG_DMGEFFECT_ARROW: + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->skelAnime.playSpeed = 0.0f; rotY = this->collider.base.ac->world.rot.y; rotX = this->collider.base.ac->world.rot.x; @@ -209,10 +225,10 @@ void EnFg_Idle(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_EXPLOSION: - this->actor.flags &= ~ACTOR_FLAG_1; + case BETAFROG_DMGEFFECT_EXPLOSION: + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); - this->actor.params = FG_BLACK; + this->actor.params = BETAFROG_BLACK; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); @@ -228,7 +244,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { default: if (DECR(this->timer) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); - EnFg_ChangeAnim(&this->skelAnime, 3); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_JUMP); this->actor.velocity.y = 10.0f; this->timer = Rand_S16Offset(30, 30); this->actionFunc = EnFg_Jump; @@ -244,8 +260,8 @@ void EnFg_Jump(EnFg* this, PlayState* play) { s16 rotX; switch (EnFg_GetDamageEffect(this)) { - case FG_DMGEFFECT_ARROW: - this->actor.flags &= ~ACTOR_FLAG_1; + case BETAFROG_DMGEFFECT_ARROW: + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; rotY = ac->world.rot.y; @@ -259,14 +275,14 @@ void EnFg_Jump(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; break; - case FG_DMGEFFECT_HOOKSHOT: + case BETAFROG_DMGEFFECT_HOOKSHOT: break; - case FG_DMGEFFECT_EXPLOSION: - this->actor.flags &= ~ACTOR_FLAG_1; + case BETAFROG_DMGEFFECT_EXPLOSION: + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); - EnFg_ChangeAnim(&this->skelAnime, 0); - this->actor.params = FG_BLACK; + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_IDLE); + this->actor.params = BETAFROG_BLACK; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); @@ -286,7 +302,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { } if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - EnFg_ChangeAnim(&this->skelAnime, 0); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_IDLE); this->actionFunc = EnFg_Idle; this->actor.velocity.y = 0.0f; } else { @@ -325,8 +341,8 @@ void EnFg_Init(Actor* thisx, PlayState* play) { EnFg* this = THIS; 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_ChangeAnim(&this->skelAnime, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFrogSkel, NULL, this->jointTable, this->morphTable, FROG_LIMB_MAX); + EnFg_ChangeAnim(&this->skelAnime, BETAFROG_ANIM_IDLE); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); @@ -360,7 +376,7 @@ void EnFg_Update(Actor* thisx, PlayState* play) { } } - func_80A2D3D4(this, play); + EnFg_UpdateSkelAnime(this, play); EnFg_UpdateDust(&this->dustEffect[0]); func_80A2D348(this, play); } @@ -368,12 +384,12 @@ void EnFg_Update(Actor* thisx, PlayState* play) { s32 EnFg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == FROG_LIMB_RIGHT_EYE) || (limbIndex == FROG_LIMB_LEFT_EYE)) { *dList = NULL; } if (this->actor.colChkInfo.health == 0) { - if ((limbIndex == 5) || (limbIndex == 9)) { + if ((limbIndex == FROG_LIMB_RIGHT_IRIS) || (limbIndex == FROG_LIMB_LEFT_IRIS)) { *dList = NULL; } } @@ -383,9 +399,9 @@ s32 EnFg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; s16 pad; - Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == FROG_LIMB_RIGHT_EYE) || (limbIndex == FROG_LIMB_LEFT_EYE)) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -397,8 +413,8 @@ void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 4) { - Matrix_MultVec3f(&vec1, &this->actor.focus.pos); + if (limbIndex == FROG_LIMB_HEAD) { + Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); } } @@ -406,8 +422,12 @@ void EnFg_Draw(Actor* thisx, PlayState* play) { EnFg* this = THIS; s32 pad; Color_RGBA8 envColor[] = { - { 200, 170, 0, 255 }, { 0, 170, 200, 255 }, { 210, 120, 100, 255 }, - { 120, 130, 230, 255 }, { 190, 190, 190, 255 }, { 0, 0, 0, 255 }, + { 200, 170, 0, 255 }, // BETAFROG_YELLOW + { 0, 170, 200, 255 }, // BETAFROG_CYAN + { 210, 120, 100, 255 }, // BETAFROG_PINK + { 120, 130, 230, 255 }, // BETAFROG_BLUE + { 190, 190, 190, 255 }, // BETAFROG_WHITE + { 0, 0, 0, 255 }, // BETAFROG_BLACK }; Matrix_Push(); @@ -420,16 +440,16 @@ void EnFg_Draw(Actor* thisx, PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, envColor[this->actor.params].r, envColor[this->actor.params].g, envColor[this->actor.params].b, envColor[this->actor.params].a); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(object_fr_Tex_0059A0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(object_fr_Tex_0059A0)); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gFrogIrisOpenTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(gFrogIrisOpenTex)); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFg_OverrideLimbDraw, EnFg_PostLimbDraw, &this->actor); CLOSE_DISPS(play->state.gfxCtx); } -void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { - Vec3f vel = { 0.0f, 3.0f, 0.0f }; +void EnFg_AddDust(BetaFrogEffectDust* dustEffect, Vec3f* pos) { + Vec3f velocity = { 0.0f, 3.0f, 0.0f }; Vec3f unk_20 = { 0.0f, 0.0f, 0.0f }; s32 i; @@ -437,8 +457,8 @@ void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { if (!dustEffect->type) { dustEffect->type = true; dustEffect->timer = 16; - dustEffect->pos = *worldPos; - dustEffect->velocity = vel; + dustEffect->pos = *pos; + dustEffect->velocity = velocity; dustEffect->unk_20 = unk_20; dustEffect->xyScale = 0.4f; break; @@ -446,7 +466,7 @@ void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { } } -void EnFg_UpdateDust(EnFgEffectDust* dustEffect) { +void EnFg_UpdateDust(BetaFrogEffectDust* dustEffect) { s32 i; for (i = 0; i < 10; i++, dustEffect++) { @@ -463,7 +483,7 @@ static TexturePtr sDustTextures[] = { gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex, }; -void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { +void EnFg_DrawDust(PlayState* play, BetaFrogEffectDust* dustEffect) { s16 i; s16 alpha; s16 index; @@ -480,7 +500,7 @@ void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { if (!firstDone) { POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, object_fr_DL_00B328); + gSPDisplayList(POLY_XLU_DISP++, gFrogDustMaterialDL); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); firstDone = true; } @@ -494,7 +514,7 @@ void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = 0.5f * dustEffect->timer; gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[index])); - gSPDisplayList(POLY_XLU_DISP++, object_fr_DL_00B338); + gSPDisplayList(POLY_XLU_DISP++, gFrogDustModelDL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.h b/src/overlays/actors/ovl_En_Fg/z_en_fg.h index a1917b9bc..42d4936ee 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.h +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.h @@ -2,6 +2,7 @@ #define Z_EN_FG_H #include "global.h" +#include "objects/object_fr/object_fr.h" struct EnFg; @@ -9,22 +10,13 @@ typedef void (*EnFgActionFunc)(struct EnFg*, PlayState*); // Based on the envColor data. Related to params but mostly unused. typedef enum { - /* 0 */ FG_YELLOW, - /* 1 */ FG_CYAN, - /* 2 */ FG_PINK, - /* 3 */ FG_BLUE, - /* 4 */ FG_WHITE, - /* 5 */ FG_BLACK // All frogs are blackened when hit by an explosion -} FrogType; - -typedef enum { - /* 0 */ FG_DMGEFFECT_NONE, - /* 1 */ FG_DMGEFFECT_EXPLOSION, // Bomb or bombchu, not powderkeg - /* 2 */ FG_DMGEFFECT_DEKUSTICK, - /* 3 */ FG_DMGEFFECT_HOOKSHOT, - /* 4 */ FG_DMGEFFECT_ARROW, - /* 5 */ FG_DMGEFFECT_ICEARROW -} FrogDamageEffect; + /* 0 */ BETAFROG_YELLOW, + /* 1 */ BETAFROG_CYAN, + /* 2 */ BETAFROG_PINK, + /* 3 */ BETAFROG_BLUE, + /* 4 */ BETAFROG_WHITE, + /* 5 */ BETAFROG_BLACK // All frogs are blackened when hit by an explosion +} BetaFrogType; typedef struct { /* 0x00 */ u8 type; @@ -35,18 +27,18 @@ typedef struct { /* 0x20 */ Vec3f unk_20; // Likely acceleration, set to 0 but unused /* 0x2C */ Vec3f velocity; /* 0x38 */ UNK_TYPE1 unk_38[0x4]; -} EnFgEffectDust; // size = 0x3C +} BetaFrogEffectDust; // size = 0x3C typedef struct EnFg { /* 0x000 */ Actor actor; /* 0x144 */ EnFgActionFunc actionFunc; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ Vec3s jointTable[24]; - /* 0x268 */ Vec3s morphTable[24]; + /* 0x1D8 */ Vec3s jointTable[FROG_LIMB_MAX]; + /* 0x268 */ Vec3s morphTable[FROG_LIMB_MAX]; /* 0x2F8 */ s16 timer; /* 0x2FA */ s16 bounceCounter; - /* 0x2FC */ EnFgEffectDust dustEffect[10]; + /* 0x2FC */ BetaFrogEffectDust dustEffect[10]; } EnFg; // size = 0x554 #endif // Z_EN_FG_H diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 90801ef44..1e8425412 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -29,9 +29,12 @@ ActorInit En_Fire_Rock_InitVars = { void EnFireRock_Init(Actor* thisx, PlayState* play) { } + void EnFireRock_Destroy(Actor* thisx, PlayState* play) { } + void EnFireRock_Update(Actor* thisx, PlayState* play) { } + void EnFireRock_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index fd3b723d8..6b9d031df 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -5,10 +5,10 @@ */ #include "z_en_firefly.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" -#include "objects/object_firefly/object_firefly.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnFirefly*)thisx) @@ -125,7 +125,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 4000, ICHAIN_STOP), }; @@ -134,8 +134,8 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(play, &this->skelAnime, &object_firefly_Skel_0018B8, &object_firefly_Anim_00017C, this->jointTable, - this->morphTable, 28); + SkelAnime_Init(play, &this->skelAnime, &gFireKeeseSkel, &gFireKeeseFlyAnim, this->jointTable, this->morphTable, + FIRE_KEESE_LIMB_MAX); Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -180,7 +180,7 @@ void EnFirefly_SpawnIceEffects(EnFirefly* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 3, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, KEESE_BODYPART_MAX, 2, 0.2f, 0.2f); } } @@ -282,7 +282,7 @@ void EnFirefly_SetupFlyIdle(EnFirefly* this) { } void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { - s32 isSkelAnimeUpdated; + s32 onAnimFirstFrame; f32 rand; SkelAnime_Update(&this->skelAnime); @@ -290,11 +290,11 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { this->timer--; } - isSkelAnimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); + onAnimFirstFrame = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; if (!EnFirefly_ReturnToPerch(this, play) && !EnFirefly_SeekTorch(this, play)) { - if (isSkelAnimeUpdated) { + if (onAnimFirstFrame) { rand = Rand_ZeroOne(); if (rand < 0.5f) { @@ -340,7 +340,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { this->timer = 40; this->actor.velocity.y = 0.0f; - Animation_Change(&this->skelAnime, &object_firefly_Anim_00017C, 0.0f, 6.0f, 6.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gFireKeeseFlyAnim, 0.0f, 6.0f, 6.0f, ANIMMODE_ONCE, 0.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); this->actor.flags |= ACTOR_FLAG_10; @@ -361,7 +361,7 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { this->drawDmgEffScale = 0.55f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_SMALL_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 4.0f; @@ -658,7 +658,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { } else { Enemy_StartFinishingBlow(play, &this->actor); this->actor.colChkInfo.health = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; // Negate effects of fire on Fire Keese and Ice on Ice Keese if (((this->currentType == KEESE_FIRE) && (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_FIRE)) || @@ -730,7 +730,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.275f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.55f / 40.0f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } @@ -747,7 +747,7 @@ s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 if (this->isInvisible && (play->actorCtx.lensMaskSize != LENS_MASK_ACTIVE_SIZE)) { *dList = NULL; - } else if (limbIndex == 1) { + } else if (limbIndex == FIRE_KEESE_LIMB_ROOT) { pos->y += 2300.0f; } return false; @@ -768,11 +768,11 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* s32 pad; EnFirefly* this = THIS; - if ((this->currentType != KEESE_FIRE) && (limbIndex == 27)) { - gSPDisplayList((*gfx)++, object_firefly_DL_001678); + if ((this->currentType != KEESE_FIRE) && (limbIndex == FIRE_KEESE_LIMB_HEAD)) { + gSPDisplayList((*gfx)++, gKeeseRedEyesDL); } else if ((this->lastDrawnFrame != play->gameplayFrames) && ((this->auraType == KEESE_AURA_FIRE) || (this->auraType == KEESE_AURA_ICE)) && - ((limbIndex == 15) || (limbIndex == 21))) { + ((limbIndex == FIRE_KEESE_LIMB_LEFT_WING_END) || (limbIndex == FIRE_KEESE_LIMB_RIGHT_WING_END_ROOT))) { if (this->actionFunc != EnFirefly_Die) { Matrix_MultZero(&auraPos); auraPos.x += Rand_ZeroFloat(5.0f); @@ -781,7 +781,7 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* auraScaleStep = -40; auraLife = 3; } else { - if (limbIndex == 15) { + if (limbIndex == FIRE_KEESE_LIMB_LEFT_WING_END) { auraPos.x = Math_SinS(9100 * this->timer) * this->timer + this->actor.world.pos.x; auraPos.z = Math_CosS(9100 * this->timer) * this->timer + this->actor.world.pos.z; } else { @@ -806,12 +806,12 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* auraLife); } - if (limbIndex == 15) { - Matrix_MultZero(&this->limbPos[0]); - } else if (limbIndex == 21) { - Matrix_MultZero(&this->limbPos[1]); - } else if (limbIndex == 10) { - Matrix_MultZero(&this->limbPos[2]); + if (limbIndex == FIRE_KEESE_LIMB_LEFT_WING_END) { + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_LEFT_WING_END]); + } else if (limbIndex == FIRE_KEESE_LIMB_RIGHT_WING_END_ROOT) { + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_RIGHT_WING_END_ROOT]); + } else if (limbIndex == FIRE_KEESE_LIMB_BODY) { + Matrix_MultZero(&this->bodyPartsPos[KEESE_BODYPART_BODY]); } } @@ -844,7 +844,7 @@ void EnFirefly_Draw(Actor* thisx, PlayState* play) { POLY_OPA_DISP = gfx; } - Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, NULL, this->bodyPartsPos, KEESE_BODYPART_MAX, this->drawDmgEffScale * this->actor.scale.y * 200.0f, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); this->lastDrawnFrame = play->gameplayFrames; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index 6ac9fb008..6174c2e87 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -2,6 +2,7 @@ #define Z_EN_FIREFLY_H #include "global.h" +#include "objects/object_firefly/object_firefly.h" struct EnFirefly; @@ -17,6 +18,13 @@ typedef enum { #define KEESE_INVISIBLE (1 << 0xF) #define KEESE_GET_MAIN_TYPE(thisx) ((thisx)->params & 0x7FFF) +typedef enum KeeseBodyPart { + /* 0 */ KEESE_BODYPART_LEFT_WING_END, + /* 1 */ KEESE_BODYPART_RIGHT_WING_END_ROOT, + /* 2 */ KEESE_BODYPART_BODY, + /* 3 */ KEESE_BODYPART_MAX +} KeeseBodyPart; + typedef struct EnFirefly { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,14 +35,14 @@ typedef struct EnFirefly { /* 0x18F */ u8 drawDmgEffType; /* 0x190 */ s16 timer; /* 0x192 */ s16 pitchTarget; - /* 0x194 */ Vec3s jointTable[28]; - /* 0x23C */ Vec3s morphTable[28]; + /* 0x194 */ Vec3s jointTable[FIRE_KEESE_LIMB_MAX]; + /* 0x23C */ Vec3s morphTable[FIRE_KEESE_LIMB_MAX]; /* 0x2E4 */ f32 maxAltitude; /* 0x2E8 */ f32 drawDmgEffAlpha; /* 0x2E8 */ f32 drawDmgEffScale; /* 0x2E8 */ f32 drawDmgEffFrozenSteamScale; /* 0x2F4 */ u32 lastDrawnFrame; - /* 0x2F8 */ Vec3f limbPos[3]; + /* 0x2F8 */ Vec3f bodyPartsPos[KEESE_BODYPART_MAX]; /* 0x31C */ ColliderSphere collider; } EnFirefly; // size = 0x374 diff --git a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c index 00a0d4d9d..3459faf40 100644 --- a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c +++ b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c @@ -6,7 +6,8 @@ #include "z_en_firefly2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnFirefly2*)thisx) diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 0331ec347..0a7e892a7 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -5,7 +5,6 @@ */ #include "z_en_fish.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0x00000000 @@ -206,7 +205,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { } SkelAnime_InitFlex(play, &this->skelAnime, &gameplay_keep_Skel_02F028, &gameplay_keep_Anim_02F0EC, this->jointTable, - this->morphTable, 7); + this->morphTable, FISH_LIMB_MAX); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = this->unk_25C * 30.0f; diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 2a348051e..e0837779d 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -2,6 +2,7 @@ #define Z_EN_FISH_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" struct EnFish; @@ -14,13 +15,15 @@ typedef enum { /* 2 */ ENFISH_2 } EnFishParam; +#define FISH_PARAMS(param) (param) + typedef struct EnFish { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colliderElements[1]; /* 0x1A4 */ SkelAnime skelAnime; - /* 0x1E8 */ Vec3s jointTable[7]; - /* 0x212 */ Vec3s morphTable[7]; + /* 0x1E8 */ Vec3s jointTable[FISH_LIMB_MAX]; + /* 0x212 */ Vec3s morphTable[FISH_LIMB_MAX]; /* 0x23C */ EnFishUnkFunc unkFunc; /* 0x240 */ s16 unk_240; /* 0x242 */ s16 unk_242; 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 923cfeef2..645ad7300 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -8,9 +8,8 @@ #include "overlays/actors/ovl_En_Mushi2/z_en_mushi2.h" #include "z_en_fish2.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_fb/object_fb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnFish2*)thisx) @@ -44,7 +43,7 @@ void func_80B2B180(EnFish2* this, PlayState* play); static s32 D_80B2B2E0 = 0; static s32 D_80B2B2E4 = 0; -static s32 D_80B2B2E8 = 0; +static s32 D_80B2B2E8 = false; static s32 D_80B2B2EC = 0; static s32 D_80B2B2F0 = 0; static Actor* D_80B2B2F4 = NULL; @@ -102,29 +101,51 @@ static ColliderJntSphInit sJntSphInit = { static f32 D_80B2B370[] = { 0.01f, 0.012f, 0.014f, 0.017f }; static f32 D_80B2B380[] = { 0.019f, 0.033f }; -void func_80B28370(EnFish2* this, s32 arg0) { - static AnimationHeader* D_80B2B388[] = { - &object_fb_Anim_0013AC, &object_fb_Anim_0007D4, &object_fb_Anim_0006D8, - &object_fb_Anim_0006D8, &object_fb_Anim_001174, &object_fb_Anim_000ACC, - }; - static u8 D_80B2B3A0[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, - }; - f32 sp34; +typedef enum { + /* 0 */ FISH2_ANIM_0, + /* 1 */ FISH2_ANIM_1, + /* 2 */ FISH2_ANIM_2, + /* 3 */ FISH2_ANIM_3, + /* 4 */ FISH2_ANIM_4, + /* 5 */ FISH2_ANIM_5, + /* 6 */ FISH2_ANIM_MAX +} Fish2Animation; - this->unk_2AC = arg0; - this->unk_2CC = Animation_GetLastFrame(&D_80B2B388[arg0]->common); - sp34 = 0.0f; - if (this->unk_2AC == 3) { - sp34 = Animation_GetLastFrame(&D_80B2B388[this->unk_2AC]->common) - 21.0f; +static AnimationHeader* sAnimations[FISH2_ANIM_MAX] = { + &object_fb_Anim_0013AC, // FISH2_ANIM_0 + &object_fb_Anim_0007D4, // FISH2_ANIM_1 + &object_fb_Anim_0006D8, // FISH2_ANIM_2 + &object_fb_Anim_0006D8, // FISH2_ANIM_3 + &object_fb_Anim_001174, // FISH2_ANIM_4 + &object_fb_Anim_000ACC, // FISH2_ANIM_5 +}; + +static u8 sAnimationModes[FISH2_ANIM_MAX] = { + ANIMMODE_LOOP, // FISH2_ANIM_0 + ANIMMODE_LOOP, // FISH2_ANIM_1 + ANIMMODE_ONCE, // FISH2_ANIM_2 + ANIMMODE_ONCE, // FISH2_ANIM_3 + ANIMMODE_ONCE, // FISH2_ANIM_4 + ANIMMODE_ONCE, // FISH2_ANIM_5 +}; + +void EnFish2_ChangeAnim(EnFish2* this, s32 animIndex) { + f32 startFrame; + + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(&sAnimations[animIndex]->common); + + startFrame = 0.0f; + if (this->animIndex == FISH2_ANIM_3) { + startFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common) - 21.0f; } - if (this->unk_2AC == 2) { - this->unk_2CC = Animation_GetLastFrame(&D_80B2B388[this->unk_2AC]->common) - 21.0f; + if (this->animIndex == FISH2_ANIM_2) { + this->animEndFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common) - 21.0f; } - Animation_Change(&this->skelAnime, D_80B2B388[this->unk_2AC], 1.0f, sp34, this->unk_2CC, D_80B2B3A0[this->unk_2AC], - -10.0f); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->animEndFrame, + sAnimationModes[this->animIndex], -10.0f); } s32 func_80B28478(EnFish2* this) { @@ -160,7 +181,7 @@ void EnFish2_Init(Actor* thisx, PlayState* play) { if (this->actor.params == 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_fb_Skel_006190, &object_fb_Anim_0013AC, this->jointTable, - this->morphTable, 24); + this->morphTable, OBJECT_FB_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_344 == 0) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_81_10)) { @@ -309,7 +330,7 @@ void func_80B289DC(EnFish2* this, PlayState* play) { } void func_80B28B5C(EnFish2* this) { - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->unk_2B4 = 0; this->unk_348 = 0; this->unk_2C4 = 0; @@ -387,7 +408,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f); } - if ((D_80B2B2E8 == 0) && (D_80B2B2E0 != 2)) { + if (!D_80B2B2E8 && (D_80B2B2E0 != 2)) { while (itemAction != NULL) { if ((itemAction->id != ACTOR_EN_FISH) && (itemAction->id != ACTOR_EN_MUSHI2)) { itemAction = itemAction->next; @@ -426,7 +447,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { itemAction = itemAction->next; } - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -457,7 +478,7 @@ void func_80B29194(EnFish2* this) { this->unk_34A = 0; this->unk_340 = (s32)Rand_ZeroOne() & 1; - func_80B28370(this, 1); + EnFish2_ChangeAnim(this, FISH2_ANIM_1); this->actionFunc = func_80B29250; } @@ -482,15 +503,15 @@ void func_80B29250(EnFish2* this, PlayState* play) { } void func_80B2938C(EnFish2* this) { - func_80B28370(this, 5); + EnFish2_ChangeAnim(this, FISH2_ANIM_5); this->unk_348 = 0; this->actionFunc = func_80B293C4; } void func_80B293C4(EnFish2* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; - if (func_80B28478(this) == 0) { + if (!func_80B28478(this)) { func_80B287F4(this, 1); Math_ApproachF(&this->actor.speed, (*D_80B2B380 - this->unk_330) * 1000.0f, 0.3f, 0.3f); @@ -500,8 +521,8 @@ void func_80B293C4(EnFish2* this, PlayState* play) { this->actor.speed = 1.0f; } - if (this->unk_2CC <= currentFrame) { - func_80B28370(this, 1); + if (curFrame >= this->animEndFrame) { + EnFish2_ChangeAnim(this, FISH2_ANIM_1); if (this->unk_2B0 == 0) { this->actionFunc = func_80B29250; } else { @@ -536,7 +557,7 @@ void func_80B2951C(EnFish2* this) { void func_80B295A4(EnFish2* this, PlayState* play) { s32 i; - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad; Vec3f sp60; @@ -551,9 +572,9 @@ void func_80B295A4(EnFish2* this, PlayState* play) { for (i = 0; i < 2; i++) { EffectSsBubble_Spawn(play, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); } - } else if (this->unk_2CC <= currentFrame) { - if (this->unk_2AC != 5) { - func_80B28370(this, 5); + } else if (curFrame >= this->animEndFrame) { + if (this->animIndex != FISH2_ANIM_5) { + EnFish2_ChangeAnim(this, FISH2_ANIM_5); } else if (this->unk_2C8 == 0) { func_80B29778(this); } else { @@ -566,7 +587,7 @@ void func_80B295A4(EnFish2* this, PlayState* play) { } void func_80B29778(EnFish2* this) { - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->unk_2B4 = 0; this->unk_2C4 = 0; this->unk_2B6 = this->unk_2B4; @@ -645,12 +666,12 @@ void func_80B297FC(EnFish2* this, PlayState* play) { case 2: phi_f0 = 0.1f; - + // fallthrough case 4: if (phi_f0 == 0) { phi_f0 = 0.3f; } - + // fallthrough case 6: if (phi_f0 == 0) { phi_f0 = 0.5f; @@ -676,12 +697,12 @@ void func_80B297FC(EnFish2* this, PlayState* play) { case 3: phi_f0 = 1.3f; - + // fallthrough case 5: if (phi_f0 == 0) { phi_f0 = 1.5f; } - + // fallthrough case 7: if (phi_f0 == 0) { phi_f0 = 1.7f; @@ -754,7 +775,7 @@ void func_80B29E5C(EnFish2* this, PlayState* play) { if (&this->actor != prop) { this->unk_350 = prop; this->unk_2B0 = D_80B2B2E8 = 1; - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); this->actionFunc = func_80B29EE4; break; } @@ -868,7 +889,7 @@ void func_80B2A23C(EnFish2* this, PlayState* play) { } void func_80B2A448(EnFish2* this) { - func_80B28370(this, 4); + EnFish2_ChangeAnim(this, FISH2_ANIM_4); this->unk_2B4 = 0; this->unk_2C4 = 0; this->unk_2B6 = this->unk_2B4; @@ -877,10 +898,10 @@ void func_80B2A448(EnFish2* this) { } void func_80B2A498(EnFish2* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f sp80; - if ((this->unk_2AC == 4) && Animation_OnFrame(&this->skelAnime, 13.0f)) { + if ((this->animIndex == FISH2_ANIM_4) && Animation_OnFrame(&this->skelAnime, 13.0f)) { Actor* temp_v0; Math_Vec3f_Copy(&sp80, &this->unk_318); @@ -899,7 +920,7 @@ void func_80B2A498(EnFish2* this, PlayState* play) { } } - if ((this->unk_2AC == 4) && + if ((this->animIndex == FISH2_ANIM_4) && (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 31.0f))) { WaterBox* sp78; @@ -920,12 +941,12 @@ void func_80B2A498(EnFish2* this, PlayState* play) { } } - if ((this->unk_2CC <= currentFrame) && (this->unk_2AC == 4)) { + if ((curFrame >= this->animEndFrame) && (this->animIndex == FISH2_ANIM_4)) { D_80B2B2E0 = 0; D_80B2B2E4 = 3; this->actor.world.pos.x = this->unk_324.x; this->actor.world.pos.z = this->unk_324.z; - func_80B28370(this, 0); + EnFish2_ChangeAnim(this, FISH2_ANIM_0); } } @@ -1004,7 +1025,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { } } - if ((D_80B2B2E8 == 0) && (this->actionFunc == func_80B28C14)) { + if (!D_80B2B2E8 && (this->actionFunc == func_80B28C14)) { s32 temp_s0_2 = this->unk_344 * 2; f32 phi_f2 = 0.0f; f32 phi_f20 = 0; @@ -1029,7 +1050,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { } } - if (D_80B2B2E8 == 0) { + if (!D_80B2B2E8) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1039,7 +1060,7 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { s32 EnFish2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFish2* this = THIS; - if ((limbIndex == 20) || (limbIndex == 21)) { + if ((limbIndex == OBJECT_FB_LIMB_14) || (limbIndex == OBJECT_FB_LIMB_15)) { *dList = NULL; } @@ -1050,7 +1071,7 @@ void EnFish2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EnFish2* this = THIS; s32 pad; - if ((limbIndex == 20) || (limbIndex == 21)) { + if ((limbIndex == OBJECT_FB_LIMB_14) || (limbIndex == OBJECT_FB_LIMB_15)) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -1064,11 +1085,11 @@ void EnFish2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 14) { + if (limbIndex == OBJECT_FB_LIMB_0E) { Matrix_MultVec3f(&gZeroVec3f, &this->unk_318); } - if (limbIndex == 17) { + if (limbIndex == OBJECT_FB_LIMB_11) { Matrix_MultVec3f(&gZeroVec3f, &this->unk_300); } 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 20b1ff21b..a324e0bab 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -2,6 +2,7 @@ #define Z_EN_FISH2_H #include "global.h" +#include "objects/object_fb/object_fb.h" struct EnFish2; @@ -18,46 +19,46 @@ typedef struct { } EnFish2UnkStruct; // size = 0x24 typedef struct EnFish2 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ SkelAnime skelAnime; - /* 0x0188 */ Vec3s jointTable[24]; - /* 0x0218 */ Vec3s morphTable[24]; - /* 0x02A8 */ EnFish2ActionFunc actionFunc; - /* 0x02AC */ s32 unk_2AC; - /* 0x02B0 */ s32 unk_2B0; - /* 0x02B4 */ s16 unk_2B4; - /* 0x02B6 */ s16 unk_2B6; - /* 0x02B8 */ s16 unk_2B8; - /* 0x02BA */ s16 csIdList[3]; - /* 0x02C0 */ s32 unk_2C0; - /* 0x02C4 */ s32 unk_2C4; - /* 0x02C8 */ u8 unk_2C8; - /* 0x02CA */ s16 subCamId; - /* 0x02CC */ f32 unk_2CC; - /* 0x02D0 */ UNK_TYPE1 unk_2D0[0x4]; - /* 0x02D4 */ f32 unk_2D4; - /* 0x02D8 */ f32 unk_2D8; - /* 0x02DC */ Vec3f subCamEye; - /* 0x02E8 */ Vec3f subCamAt; - /* 0x02F4 */ Vec3f unk_2F4; - /* 0x0300 */ Vec3f unk_300; - /* 0x030C */ Vec3f unk_30C; - /* 0x0318 */ Vec3f unk_318; - /* 0x0324 */ Vec3f unk_324; - /* 0x0330 */ f32 unk_330; - /* 0x0334 */ f32 unk_334; - /* 0x0338 */ f32 unk_338; - /* 0x033C */ f32 unk_33C; - /* 0x0340 */ s32 unk_340; - /* 0x0344 */ s32 unk_344; - /* 0x0348 */ s16 unk_348; - /* 0x034A */ s16 unk_34A; - /* 0x034C */ s16 unk_34C; - /* 0x0350 */ Actor* unk_350; - /* 0x0354 */ struct EnFish2* unk_354; - /* 0x0358 */ ColliderJntSph collider; - /* 0x0378 */ ColliderJntSphElement colliderElements[2]; - /* 0x03F8 */ EnFish2UnkStruct unk_3F8[200]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[OBJECT_FB_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[OBJECT_FB_LIMB_MAX]; + /* 0x2A8 */ EnFish2ActionFunc actionFunc; + /* 0x2AC */ s32 animIndex; + /* 0x2B0 */ s32 unk_2B0; + /* 0x2B4 */ s16 unk_2B4; + /* 0x2B6 */ s16 unk_2B6; + /* 0x2B8 */ s16 unk_2B8; + /* 0x2BA */ s16 csIdList[3]; + /* 0x2C0 */ s32 unk_2C0; + /* 0x2C4 */ s32 unk_2C4; + /* 0x2C8 */ u8 unk_2C8; + /* 0x2CA */ s16 subCamId; + /* 0x2CC */ f32 animEndFrame; + /* 0x2D0 */ UNK_TYPE1 unk_2D0[0x4]; + /* 0x2D4 */ f32 unk_2D4; + /* 0x2D8 */ f32 unk_2D8; + /* 0x2DC */ Vec3f subCamEye; + /* 0x2E8 */ Vec3f subCamAt; + /* 0x2F4 */ Vec3f unk_2F4; + /* 0x300 */ Vec3f unk_300; + /* 0x30C */ Vec3f unk_30C; + /* 0x318 */ Vec3f unk_318; + /* 0x324 */ Vec3f unk_324; + /* 0x330 */ f32 unk_330; + /* 0x334 */ f32 unk_334; + /* 0x338 */ f32 unk_338; + /* 0x33C */ f32 unk_33C; + /* 0x340 */ s32 unk_340; + /* 0x344 */ s32 unk_344; + /* 0x348 */ s16 unk_348; + /* 0x34A */ s16 unk_34A; + /* 0x34C */ s16 unk_34C; + /* 0x350 */ Actor* unk_350; + /* 0x354 */ struct EnFish2* unk_354; + /* 0x358 */ ColliderJntSph collider; + /* 0x378 */ ColliderJntSphElement colliderElements[2]; + /* 0x3F8 */ EnFish2UnkStruct unk_3F8[200]; } EnFish2; // size = 0x2018 #endif // Z_EN_FISH2_H 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 20edbcbc2..9e442b637 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -4,6 +4,7 @@ * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ +#include "prevent_bss_reordering.h" #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -791,7 +792,7 @@ FishingFishInit sFishInits[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; @@ -831,11 +832,10 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 75.0f; - thisx->flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + thisx->flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); if (sLinkAge != 1) { - // HIGH_SCORE(HS_FISHING) from OoT - if (gSaveContext.save.saveInfo.unk_EC0 & 0x1000) { + if (HIGH_SCORE(HS_FISHING) & 0x1000) { D_8090CD08 = 0; } else { D_8090CD08 = 1; @@ -853,18 +853,18 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); if (sLinkAge == 1) { - if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F) { - D_809171CC = gSaveContext.save.saveInfo.unk_EC0 & 0x7F; + if (HIGH_SCORE(HS_FISHING) & 0x7F) { + D_809171CC = HIGH_SCORE(HS_FISHING) & 0x7F; } else { D_809171CC = 40.0f; } - } else if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) { - D_809171CC = (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) >> 0x18; + } else if (HIGH_SCORE(HS_FISHING) & 0x7F000000) { + D_809171CC = (HIGH_SCORE(HS_FISHING) & 0x7F000000) >> 0x18; } else { D_809171CC = 45.0f; } - D_809171D1 = (gSaveContext.save.saveInfo.unk_EC0 & 0xFF0000) >> 0x10; + D_809171D1 = (HIGH_SCORE(HS_FISHING) & 0xFF0000) >> 0x10; if ((D_809171D1 & 7) == 7) { play->roomCtx.unk7A[0] = 90; D_809171CA = 1; @@ -948,8 +948,8 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { thisx->bgCheckFlags |= BGCHECKFLAG_PLAYER_800; // Added in MM if ((thisx->params < 115) || (thisx->params == 200)) { - SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); - Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, NULL, NULL, 0); + Animation_MorphToLoop(&this->skelAnime, &gFishingBassAnim, 0.0f); } else { SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); @@ -960,8 +960,8 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { if (thisx->params == 200) { this->unk_150 = 100; func_800BC154(play, &play->actorCtx, thisx, ACTORCAT_PROP); - thisx->targetMode = 0; - thisx->flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + thisx->targetMode = TARGET_MODE_0; + thisx->flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } else { this->unk_150 = 10; @@ -2181,7 +2181,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { D_8091726C = 0.5f; D_80917268 = Rand_ZeroFloat(1.9f); sFishMouthOffset.y = 500.0f; - Audio_PlaySfxAtPos(&D_8090D614, NA_SE_IT_SWORD_SWING_HARD); + Audio_PlaySfx_AtPos(&D_8090D614, NA_SE_IT_SWORD_SWING_HARD); } } break; @@ -2201,7 +2201,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { D_80917238.x *= 0.9f; D_80917238.z *= 0.9f; if (D_8090CD0C == 0) { - play_sound(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG); + Audio_PlaySfx(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG); } } @@ -2258,8 +2258,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { D_809101D0 = 0.0; } else { Math_ApproachF(&D_809101C4, 0.0f, 1.0f, 0.05f); - Audio_PlaySfxAtPos(&D_8090D614, - NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT + Audio_PlaySfx_AtPos(&D_8090D614, + NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT } } else { f32 sp7C = WATER_SURFACE_Y(play); @@ -2278,7 +2278,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { if ((sLurePos.y <= sp7C) && (sp7C < spE0) && (sp7C == WATER_SURFACE_Y(play))) { D_80917264 = 10; - Audio_PlaySfxAtPos(&D_8090D614, NA_SE_EV_BOMB_DROP_WATER); + Audio_PlaySfx_AtPos(&D_8090D614, NA_SE_EV_BOMB_DROP_WATER); D_80917248.y = 0.0f; D_80917238.y *= 0.2f; @@ -2304,8 +2304,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } } else { Math_ApproachZeroF(&D_809101C4, 1.0f, 0.05f); - Audio_PlaySfxAtPos(&D_8090D614, - NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT + Audio_PlaySfx_AtPos(&D_8090D614, + NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT } } @@ -2409,7 +2409,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { D_8091725C = 0.5f; D_809101C0 += (fabsf(sp70) * 7.5f); - func_8019FAD8(&D_8090D614, NA_SE_EV_LURE_MOVE_W, (sp70 * 1.999f * 0.25f) + 0.75f); + Audio_PlaySfx_AtPosWithFreq(&D_8090D614, NA_SE_EV_LURE_MOVE_W, (sp70 * 1.999f * 0.25f) + 0.75f); if (D_80917206 == 2) { D_80917278.y = 5.0f * sp70; @@ -2445,7 +2445,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sLureRot.x = 0.0f; if (CHECK_BTN_ALL(input->press.button, BTN_B)) { D_809101C0 += 6.0f; - Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); + Audio_PlaySfx_AtPos(&D_8090D614, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); } } else { if (D_809101C0 > 150.0f) { @@ -2531,11 +2531,11 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { if (CHECK_BTN_ALL(input->cur.button, BTN_A)) { if (CHECK_BTN_ALL(input->cur.button, BTN_R)) { D_809101C0 += 1.5f; - play_sound(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG); + Audio_PlaySfx(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG); Math_ApproachF(&D_809101D0, 1000.0f, 1.0f, 2.0f); } else { D_809101C0 += D_8091726C; - play_sound(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG); + Audio_PlaySfx(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG); Math_ApproachF(&D_809101D0, 1000.0f, 1.0f, 0.2f); } @@ -2592,7 +2592,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } else { D_809101C0 += D_8091726C; } - play_sound(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG); + Audio_PlaySfx(NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG); } if ((D_809171FE & 0x1F) == 0) { @@ -2611,6 +2611,9 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sReelLinePos[LINE_SEG_COUNT - 1].z = sLurePos.z; D_809101C4 = 2.0f; break; + + default: + break; } } @@ -2795,8 +2798,8 @@ void func_80903C60(EnFishing* this, u8 arg1) { void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { if (sLinkAge == 1) { - if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F) { - if (gSaveContext.save.saveInfo.unk_EC0 & 0x80) { + if (HIGH_SCORE(HS_FISHING) & 0x7F) { + if (HIGH_SCORE(HS_FISHING) & 0x80) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -2804,8 +2807,8 @@ void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { } else { this->actor.textId = 0x40AE; } - } else if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) { - if (gSaveContext.save.saveInfo.unk_EC0 & 0x80000000) { + } else if (HIGH_SCORE(HS_FISHING) & 0x7F000000) { + if (HIGH_SCORE(HS_FISHING) & 0x80000000) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -2816,17 +2819,17 @@ void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { if (this->unk_1CB == 0) { if (this->unk_1CC == 0) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { D_8090CCF8 = D_809171CC; this->unk_1CB = 1; } else { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } else { this->unk_1CC--; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } else if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1CB = 0; @@ -2879,9 +2882,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((D_80917200 != 0) || (sSubCamId != SUB_CAM_ID_DONE) || ((player->actor.world.pos.z > 1150.0f) && (this->unk_150 != 100))) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (D_8090CD14 != 0) { if (D_80917202 == 0) { this->actor.focus.pos = sLurePos; @@ -3091,7 +3094,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (D_80917206 == 2) { func_809038A4(this, input); } else { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } break; @@ -3128,7 +3131,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (D_80917206 == 2) { func_809038A4(this, input); } else { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } break; @@ -3171,7 +3174,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_1AC.z = Rand_ZeroFloat(50.0f); } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; break; case -2: @@ -3209,7 +3212,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } Math_ApproachF(&this->unk_1A8, 2048.0f, 1.0f, 128.0f); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } break; @@ -3480,7 +3483,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else if (sp124 < 10.0f) { if (sLurePos.y > (WATER_SURFACE_Y(play) - 10.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_OUT_WATER); - play_sound(NA_SE_PL_CATCH_BOOMERANG); + Audio_PlaySfx(NA_SE_PL_CATCH_BOOMERANG); } func_809033F0(this, play, false); @@ -3556,7 +3559,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Rumble_Override(0.0f, temp2, 120, 5); D_809171F4 = 40; D_80911E28 = 10; - play_sound(NA_SE_IT_FISHING_HIT); + Audio_PlaySfx(NA_SE_IT_FISHING_HIT); } } @@ -3745,8 +3748,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((D_80917272 == 0) && (D_80917274 == 0)) { // Assignment of OoT's D_80B7E086 here removed in MM - if (((sLinkAge == 1) && (gSaveContext.save.saveInfo.unk_EC0 & 0x400)) || - ((sLinkAge != 1) && (gSaveContext.save.saveInfo.unk_EC0 & 0x800))) { + if (((sLinkAge == 1) && (HIGH_SCORE(HS_FISHING) & 0x400)) || + ((sLinkAge != 1) && (HIGH_SCORE(HS_FISHING) & 0x800))) { // Assignment of OoT's D_80B7A67C here removed in MM, this is now an empty branch } } else { @@ -3892,6 +3895,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } break; + case 1: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { @@ -3909,6 +3913,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } break; + + default: + break; } } @@ -3924,10 +3931,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { SkelAnime_Free(&this->skelAnime, play); if (this->unk_148 == 0) { - SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, 0, 0, 0); - Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, NULL, NULL, 0); + Animation_MorphToLoop(&this->skelAnime, &gFishingBassAnim, 0.0f); } else { - SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, + 0); Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); } } @@ -4169,32 +4177,33 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } -s32 EnFishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnFishing_BassOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 13) { + if (limbIndex == FISHING_BASS_LIMB_JAW) { rot->z -= this->unk_168 - 11000; - } else if ((limbIndex == 2) || (limbIndex == 3)) { + } else if ((limbIndex == FISHING_BASS_LIMB_MIDDLE_SEGMENT_ROOT) || + (limbIndex == FISHING_BASS_LIMB_BACK_SEGMENT_ROOT)) { rot->y += this->unk_164; - } else if (limbIndex == 4) { + } else if (limbIndex == FISHING_BASS_LIMB_END_ROOT) { rot->y += this->unk_16E; - } else if (limbIndex == 0xE) { + } else if (limbIndex == FISHING_BASS_LIMB_RIGHT_PECTORAL_FIN) { rot->y -= this->unk_16A; - } else if (limbIndex == 0xF) { + } else if (limbIndex == FISHING_BASS_LIMB_LEFT_PECTORAL_FIN) { rot->y += this->unk_16A; - } else if (limbIndex == 8) { + } else if (limbIndex == FISHING_BASS_LIMB_TOP_REAR_FIN) { rot->y += this->unk_16C; - } else if (limbIndex == 9) { + } else if (limbIndex == FISHING_BASS_LIMB_BOTTOM_REAR_FIN) { rot->y -= this->unk_16C; } return false; } -void EnFishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFishing_BassPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 13) { + if (limbIndex == FISHING_BASS_LIMB_JAW) { Matrix_MultVec3f(&sFishMouthOffset, &this->fishMouthPos); } } @@ -4202,11 +4211,11 @@ void EnFishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec s32 EnFishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 3) { + if (limbIndex == FISHING_LOACH_LIMB_MIDDLE_SEGMENT) { rot->y += this->unk_1C4[0]; - } else if (limbIndex == 4) { + } else if (limbIndex == FISHING_LOACH_LIMB_LOWER_BACK_FIN) { rot->y += this->unk_1C4[1]; - } else if (limbIndex == 5) { + } else if (limbIndex == FISHING_LOACH_LIMB_TAIL_FIN) { rot->y += this->unk_1C4[2]; } @@ -4217,7 +4226,7 @@ void EnFishing_LoachPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve static Vec3f sLoachMouthOffset = { 500.0f, 500.0f, 0.0f }; EnFishing* this = THIS; - if (limbIndex == 11) { + if (limbIndex == FISHING_LOACH_LIMB_JAW) { Matrix_MultVec3f(&sLoachMouthOffset, &this->fishMouthPos); } } @@ -4238,7 +4247,7 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, 0.0f, this->unk_164 * 10.0f * 0.01f, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnFishing_FishOverrideLimbDraw, EnFishing_FishPostLimbDraw, &this->actor); + EnFishing_BassOverrideLimbDraw, EnFishing_BassPostLimbDraw, &this->actor); } else { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); Matrix_RotateYF(BINANG_TO_RAD(this->unk_164), MTXMODE_APPLY); @@ -4306,7 +4315,7 @@ void EnFishing_UpdatePondProps(PlayState* play) { actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { - if (!((actor->id == ACTOR_EN_FISHING) && (actor->params >= 100))) { + if ((actor->id != ACTOR_EN_FISHING) || (actor->params < 100)) { actor = actor->next; } else { EnFishing_HandleReedContact(prop, &actor->world.pos); @@ -4320,7 +4329,7 @@ void EnFishing_UpdatePondProps(PlayState* play) { actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { - if (!((actor->id == ACTOR_EN_FISHING) && (actor->params >= 100))) { + if ((actor->id != ACTOR_EN_FISHING) || (actor->params < 100)) { actor = actor->next; } else { EnFishing_HandleLilyPadContact(prop, &actor->world.pos, ((EnFishing*)actor)->unk_149); @@ -4685,7 +4694,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 0: if (D_809171FC == 0) { if (sLinkAge != 1) { - if ((gSaveContext.save.saveInfo.unk_EC0 & 0x100) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x200)) { + if ((HIGH_SCORE(HS_FISHING) & 0x100) && !(HIGH_SCORE(HS_FISHING) & 0x200)) { this->actor.textId = 0x4093; } else { this->actor.textId = 0x407B; @@ -4703,15 +4712,15 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (D_809171FC == 0) { this->unk_154 = 1; if (sLinkAge != 1) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x200; + HIGH_SCORE(HS_FISHING) |= 0x200; } else { - gSaveContext.save.saveInfo.unk_EC0 |= 0x100; + HIGH_SCORE(HS_FISHING) |= 0x100; } } else { this->unk_154 = 10; } } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } break; @@ -4735,10 +4744,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { this->unk_154 = 3; } break; + case 1: Message_ContinueTextbox(play, 0x2D); this->unk_154 = 3; break; + + default: + break; } } break; @@ -4771,9 +4784,13 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { Message_ContinueTextbox(play, 0x4080); this->unk_154 = 5; break; + case 1: Message_ContinueTextbox(play, 0x407F); break; + + default: + break; } } break; @@ -4788,8 +4805,8 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { D_8090CD04 = 20; this->unk_154 = 0; - if ((gSaveContext.save.saveInfo.unk_EC0 & 0xFF0000) < 0xFF0000) { - gSaveContext.save.saveInfo.unk_EC0 += 0x10000; + if ((HIGH_SCORE(HS_FISHING) & 0xFF0000) < 0xFF0000) { + HIGH_SCORE(HS_FISHING) += 0x10000; } } break; @@ -4806,9 +4823,13 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { D_8090CD0C = 0; this->unk_154 = 20; break; + case 1: this->unk_154 = 0; break; + + default: + break; } } } else { @@ -4839,6 +4860,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } Message_ContinueTextbox(play, this->actor.textId); break; + case 1: if (D_8090CD00 > 36000) { D_8090CD00 = 30000; @@ -4870,6 +4892,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 0; break; + case 2: if (D_809171D8 == 0) { Message_ContinueTextbox(play, 0x4085); @@ -4878,6 +4901,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 22; break; + + default: + break; } } } @@ -4898,29 +4924,29 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (sLinkAge == 1) { f32 temp; - gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF00; - gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F); - temp = (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) >> 0x18; + HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00; + HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F); + temp = (HIGH_SCORE(HS_FISHING) & 0x7F000000) >> 0x18; if (temp < D_809171CC) { - gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF; - gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F) << 0x18; + HIGH_SCORE(HS_FISHING) &= 0xFFFFFF; + HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x80000000; + HIGH_SCORE(HS_FISHING) |= 0x80000000; } } if (D_809171D2 == 2) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x80; + HIGH_SCORE(HS_FISHING) |= 0x80; this->unk_154 = 0; break; } } else { - gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF; - gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F) << 0x18; + HIGH_SCORE(HS_FISHING) &= 0xFFFFFF; + HIGH_SCORE(HS_FISHING) |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x80000000; + HIGH_SCORE(HS_FISHING) |= 0x80000000; this->unk_154 = 0; break; } @@ -4937,14 +4963,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } if (sLinkAge == 1) { - if ((D_809171CC >= 50.0f) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x400)) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x400; + if ((D_809171CC >= 50.0f) && !(HIGH_SCORE(HS_FISHING) & 0x400)) { + HIGH_SCORE(HS_FISHING) |= 0x400; getItemId = GI_HEART_PIECE; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } } else { - if ((D_809171CC >= 60.0f) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x800)) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x800; + if ((D_809171CC >= 60.0f) && !(HIGH_SCORE(HS_FISHING) & 0x800)) { + HIGH_SCORE(HS_FISHING) |= 0x800; getItemId = GI_SKULL_TOKEN; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } @@ -4975,6 +5001,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 0: this->unk_154 = 0; break; + case 1: if (D_809171D8 == 0) { Message_ContinueTextbox(play, 0x4085); @@ -4983,6 +5010,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->unk_154 = 22; break; + + default: + break; } } break; @@ -5019,6 +5049,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } } break; + + default: + break; } } @@ -5061,9 +5094,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { SkelAnime_Update(&this->skelAnime); if ((D_8090CD04 != 0) || Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_20); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_20); } if ((this->actor.xzDistToPlayer < 120.0f) || Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { @@ -5107,9 +5140,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if (D_8090CD08 == 0) { - gSaveContext.save.saveInfo.unk_EC0 |= 0x1000; + HIGH_SCORE(HS_FISHING) |= 0x1000; } else if (D_8090CD08 == 1) { - gSaveContext.save.saveInfo.unk_EC0 &= ~0x1000; + HIGH_SCORE(HS_FISHING) &= ~0x1000; } if (D_8090CCFC != 0) { @@ -5149,7 +5182,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSinkingLureLocation = 0; D_8090CD4C = 20; Rumble_Override(0.0f, 150, 10, 10); - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } @@ -5223,9 +5256,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if ((D_809171DC == 0) || (D_809171DC == 3)) { - play_sound(NA_SE_SY_CAMERA_ZOOM_DOWN); + Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_DOWN); } else { - play_sound(NA_SE_SY_CAMERA_ZOOM_UP); + Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP); } } } @@ -5281,8 +5314,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { Cutscene_StopManual(play, &play->csCtx); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; - func_800F6834(play, 0); - play->envCtx.lightSettings.fogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjLightSettings.fogNear = 0; player->unk_B28 = -5; D_80917200 = 5; break; @@ -5323,8 +5356,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; D_8090CD50 = 30; - func_800F6834(play, 0); - play->envCtx.lightSettings.fogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjLightSettings.fogNear = 0; } break; @@ -5427,8 +5460,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_80917200 = 5; D_8090CD54 = 0; D_809171F6 = 20; - func_800F6834(play, 0); - play->envCtx.lightSettings.fogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjLightSettings.fogNear = 0; } } } @@ -5443,15 +5476,15 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { - func_800F6834(play, 1); + Environment_EnableUnderwaterLights(play, 1); if (D_809171CA != 0) { - play->envCtx.lightSettings.fogNear = -0xB2; + play->envCtx.adjLightSettings.fogNear = -178; } else { - play->envCtx.lightSettings.fogNear = -0x2E; + play->envCtx.adjLightSettings.fogNear = -46; } } else { - func_800F6834(play, 0); - play->envCtx.lightSettings.fogNear = 0; + Environment_EnableUnderwaterLights(play, 0); + play->envCtx.adjLightSettings.fogNear = 0; } } @@ -5501,10 +5534,10 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { if (Rand_ZeroOne() < 0.5f) { D_8090CCD4 = Rand_ZeroFloat(10.0f) + 5.0f; - play->envCtx.unk_E1 = 1; + play->envCtx.stormRequest = STORM_REQUEST_START; } else { D_8090CCD4 = 0; - play->envCtx.unk_E1 = 2; + play->envCtx.stormRequest = STORM_REQUEST_STOP; } } @@ -5526,7 +5559,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { Math_ApproachF(&D_8090CCDC.z, target, 1.0f, 5.0f); if (D_8090CCDC.z < 1500.0f) { - func_8019FAD8(&D_8090CCDC, NA_SE_EV_RAIN - SFX_FLAG, D_8090CCE8); + Audio_PlaySfx_AtPosWithFreq(&D_8090CCDC, NA_SE_EV_RAIN - SFX_FLAG, D_8090CCE8); } if (D_8090CCD4 != 0) { @@ -5535,8 +5568,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { Math_ApproachZeroF(&D_8090CCD8, 1.0f, 2.0f); } - play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = - play->envCtx.lightSettings.diffuseColor1[2] = D_8090CCD8; + play->envCtx.adjLightSettings.light1Color[0] = play->envCtx.adjLightSettings.light1Color[1] = + play->envCtx.adjLightSettings.light1Color[2] = D_8090CCD8; if ((u8)D_8090CCD0 > 0) { s32 pad; @@ -5570,9 +5603,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, &sProjectedW); - Audio_PlaySfxAtPos(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); + Audio_PlaySfx_AtPos(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); - if (gSaveContext.options.language == 0) { // Added in MM + if (gSaveContext.options.language == LANGUAGE_JPN) { // Added in MM gSaveContext.minigameScore = D_8090CCF8; } else { gSaveContext.minigameScore = (SQ((f32)D_8090CCF8) * 0.0036f) + 0.5f; @@ -5582,7 +5615,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { s32 EnFishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; - if (limbIndex == 8) { // Head + if (limbIndex == FISHING_OWNER_LIMB_HEAD) { rot->x -= this->unk_15C; } @@ -5590,7 +5623,7 @@ s32 EnFishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, } void EnFishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - if (limbIndex == 8) { // Head + if (limbIndex == FISHING_OWNER_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 3cf6385e0..bd706810d 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -5,8 +5,9 @@ */ #include "z_en_floormas.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnFloormas*)thisx) @@ -134,17 +135,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -static Vec3f D_808D3900[] = { - { 25.0f, 45.0f, -7.0f }, { 25.0f, 40.0f, -12.0f }, { 25.0f, 35.0f, -2.0f }, - { 10.0f, 20.0f, -4.0f }, { 15.0f, 25.0f, -2.0f }, -}; - -static s8 D_808D393C[] = { - -1, -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, -1, 3, -1, 4, -1, -1, 5, -1, -1, -1, 6, 7, -1, 8, -}; - -static Color_RGBA8 D_808D3958 = { 0, 255, 0, 0 }; - void EnFloormas_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnFloormas* this = THIS; @@ -169,7 +159,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { if (this->actor.params == ENFLOORMAS_GET_7FFF_10) { this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_808D2AA8; return; } @@ -234,7 +224,7 @@ void func_808D0930(EnFloormas* this, PlayState* play) { void func_808D09CC(EnFloormas* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.55f; - this->drawDmgEffFrozenSteamScale = 0.82500005f; + this->drawDmgEffFrozenSteamScale = 825.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->collider.base.colType = COLTYPE_HIT3; this->unk_18E = 80; @@ -247,7 +237,7 @@ void func_808D0A48(EnFloormas* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, 2, this->actor.scale.x * 30.000002f, this->actor.scale.x * 20.0f); if (this->actor.scale.x > 0.009f) { this->actor.flags |= ACTOR_FLAG_400; @@ -306,15 +296,15 @@ void func_808D0CE4(EnFloormas* this) { } void func_808D0D70(EnFloormas* this, PlayState* play) { - s32 temp_v0; + s32 onAnimFirstFrame; SkelAnime_Update(&this->skelAnime); - temp_v0 = Animation_OnFrame(&this->skelAnime, 0.0f); - if ((temp_v0 != 0) && (this->unk_18E != 0)) { + onAnimFirstFrame = Animation_OnFrame(&this->skelAnime, 0.0f); + if (onAnimFirstFrame && (this->unk_18E != 0)) { this->unk_18E--; } - if ((temp_v0 != 0) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || + if (onAnimFirstFrame || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_WALK); } @@ -389,7 +379,7 @@ void func_808D108C(EnFloormas* this) { } void func_808D11BC(EnFloormas* this, PlayState* play) { - f32 frame; + f32 curFrame; f32 sp30; f32 sp2C; @@ -406,8 +396,8 @@ void func_808D11BC(EnFloormas* this, PlayState* play) { } } - frame = this->skelAnime.curFrame; - if ((frame >= 7.0f) && (frame < 22.0f)) { + curFrame = this->skelAnime.curFrame; + if ((curFrame >= 7.0f) && (curFrame < 22.0f)) { sp30 = Math_SinS(this->actor.shape.rot.y + 0x4268); sp2C = Math_CosS(this->actor.shape.rot.y + 0x4268); this->actor.shape.rot.y += this->unk_190; @@ -454,7 +444,7 @@ void func_808D14DC(EnFloormas* this, PlayState* play) { sp28.x = Math_SinS(this->actor.shape.rot.y - 0x6000) * 7.0f; sp28.z = Math_CosS(this->actor.shape.rot.y - 0x6000) * 7.0f; func_800B1210(play, &sp34, &sp28, &gZeroVec3f, 0x1C2, 0x64); - func_800B9010(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING - SFX_FLAG); } void func_808D161C(EnFloormas* this) { @@ -583,7 +573,7 @@ void func_808D19D4(EnFloormas* this) { void func_808D1B44(EnFloormas* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (SkelAnime_Update(&this->skelAnime)) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->unk_194 = 50; func_808D0C14(this); } @@ -711,11 +701,19 @@ void func_808D2040(EnFloormas* this, PlayState* play) { } } +static Vec3f D_808D3900[PLAYER_FORM_MAX] = { + { 25.0f, 45.0f, -7.0f }, // PLAYER_FORM_FIERCE_DEITY + { 25.0f, 40.0f, -12.0f }, // PLAYER_FORM_GORON + { 25.0f, 35.0f, -2.0f }, // PLAYER_FORM_ZORA + { 10.0f, 20.0f, -4.0f }, // PLAYER_FORM_DEKU + { 15.0f, 25.0f, -2.0f }, // PLAYER_FORM_HUMAN +}; + void func_808D217C(EnFloormas* this, Player* player) { Vec3f* ptr; Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 1.0f, 36.0f, 45.0f, ANIMMODE_ONCE, -3.0f); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_808D08D0(this); @@ -758,7 +756,7 @@ void func_808D22C8(EnFloormas* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.velocity.y = 6.0f; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.speed = -3.0f; func_808D1740(this); } else if ((this->unk_190 % 20) == 0) { @@ -886,7 +884,7 @@ void func_808D2764(EnFloormas* this, PlayState* play) { } } - func_800B9010(&this->actor, NA_SE_EN_FLOORMASTER_RESTORE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FLOORMASTER_RESTORE - SFX_FLAG); } void func_808D2A20(EnFloormas* this) { @@ -901,7 +899,7 @@ void func_808D2A20(EnFloormas* this) { Actor_Kill(&this->actor); } else { this->actor.draw = NULL; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_10); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10); this->actionFunc = func_808D2AA8; } } @@ -1027,7 +1025,7 @@ void func_808D2E34(EnFloormas* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_DEAD); } Enemy_StartFinishingBlow(play, &this->actor); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else if (this->actor.colChkInfo.damage != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_DAMAGE); } @@ -1069,8 +1067,8 @@ void func_808D2E34(EnFloormas* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - (this->actor.scale.x > 0.009f) ? CLEAR_TAG_LARGE_LIGHT_RAYS - : CLEAR_TAG_SMALL_LIGHT_RAYS); + (this->actor.scale.x > 0.009f) ? CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS) + : CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } func_808D2B18(this); } @@ -1141,7 +1139,7 @@ void EnFloormas_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.275f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1159,16 +1157,44 @@ s32 EnFloormas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec return false; } +static s8 sLimbToBodyParts[WALLMASTER_LIMB_MAX] = { + BODYPART_NONE, // WALLMASTER_LIMB_NONE + BODYPART_NONE, // WALLMASTER_LIMB_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_HAND + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_ROOT + ENFLOORMAS_BODYPART_0, // WALLMASTER_LIMB_INDEX_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_MIDDLE + ENFLOORMAS_BODYPART_1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_ROOT + ENFLOORMAS_BODYPART_2, // WALLMASTER_LIMB_RING_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_MIDDLE + ENFLOORMAS_BODYPART_3, // WALLMASTER_LIMB_RING_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_ROOT + ENFLOORMAS_BODYPART_4, // WALLMASTER_LIMB_MIDDLE_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_MIDDLE + ENFLOORMAS_BODYPART_5, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_WRIST_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_WRIST + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_ROOT + ENFLOORMAS_BODYPART_6, // WALLMASTER_LIMB_THUMB_PROXIMAL + ENFLOORMAS_BODYPART_7, // WALLMASTER_LIMB_THUMB_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_MIDDLE + ENFLOORMAS_BODYPART_8, // WALLMASTER_LIMB_THUMB_DISTAL +}; + void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnFloormas* this = THIS; - if (D_808D393C[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_808D393C[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WALLMASTER_LIMB_WRIST) { - Matrix_MultVecX(1000.0f, &this->limbPos[9]); - Matrix_MultVecX(-1000.0f, &this->limbPos[10]); + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[ENFLOORMAS_BODYPART_9]); + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[ENFLOORMAS_BODYPART_10]); } else if (limbIndex == WALLMASTER_LIMB_HAND) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); @@ -1183,6 +1209,8 @@ void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } } +static Color_RGBA8 D_808D3958 = { 0, 255, 0, 0 }; + void EnFloormas_Draw(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; @@ -1202,7 +1230,7 @@ void EnFloormas_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, 100.0f * (this->drawDmgEffScale * this->actor.scale.x), 100.0f * (this->drawDmgEffFrozenSteamScale * this->actor.scale.x), this->drawDmgEffAlpha, this->drawDmgEffType); @@ -1227,7 +1255,7 @@ void func_808D3754(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, this->drawDmgEffScale * this->actor.scale.x * 100.0f, this->drawDmgEffFrozenSteamScale * this->actor.scale.x * 100.0f, this->drawDmgEffAlpha, this->drawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h index 628cad4f6..ac9b1954e 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h @@ -18,6 +18,21 @@ typedef enum { /* 0x40 */ ENFLOORMAS_GET_7FFF_40 = 0x40 } EnFloormasParam; +typedef enum EnFloormasBodyPart { + /* 0 */ ENFLOORMAS_BODYPART_0, + /* 1 */ ENFLOORMAS_BODYPART_1, + /* 2 */ ENFLOORMAS_BODYPART_2, + /* 3 */ ENFLOORMAS_BODYPART_3, + /* 4 */ ENFLOORMAS_BODYPART_4, + /* 5 */ ENFLOORMAS_BODYPART_5, + /* 6 */ ENFLOORMAS_BODYPART_6, + /* 7 */ ENFLOORMAS_BODYPART_7, + /* 8 */ ENFLOORMAS_BODYPART_8, + /* 9 */ ENFLOORMAS_BODYPART_9, + /* 10 */ ENFLOORMAS_BODYPART_10, + /* 11 */ ENFLOORMAS_BODYPART_MAX +} EnFloormasBodyPart; + typedef struct EnFloormas { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +47,7 @@ typedef struct EnFloormas { /* 0x2C4 */ f32 drawDmgEffAlpha; /* 0x2C8 */ f32 drawDmgEffScale; /* 0x2CC */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D0 */ Vec3f limbPos[11]; + /* 0x2D0 */ Vec3f bodyPartsPos[ENFLOORMAS_BODYPART_MAX]; /* 0x354 */ ColliderCylinder collider; } EnFloormas; // size = 0x3A0 diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 0b645b302..07e4d60b9 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -29,7 +29,7 @@ ActorInit En_Fr_InitVars = { void EnFr_Init(Actor* thisx, PlayState* play) { EnFr* this = THIS; - if (Flags_GetSwitch(play, ENFR_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENFR_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -43,7 +43,7 @@ void EnFr_Destroy(Actor* thisx, PlayState* play) { void EnFr_Update(Actor* thisx, PlayState* play) { EnFr* this = THIS; - if (Flags_GetSwitch(play, ENFR_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENFR_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/src/overlays/actors/ovl_En_Fr/z_en_fr.h index 27682ce40..0227608fb 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -5,7 +5,7 @@ struct EnFr; -#define ENFR_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define ENFR_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define ENFR_GET_TARGETMODE(thisx) (((thisx)->params >> 7) & 0xF) typedef struct EnFr { 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 89bf08d7b..ec8c09b71 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -7,7 +7,7 @@ #include "z_en_fsn.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnFsn*)thisx) @@ -52,6 +52,18 @@ typedef enum { /* 2 */ ENFSN_CUTSCENESTATE_PLAYING } EnFsnCutsceneState; +ActorInit En_Fsn_InitVars = { + ACTOR_EN_FSN, + ACTORCAT_NPC, + FLAGS, + OBJECT_FSN, + sizeof(EnFsn), + (ActorFunc)EnFsn_Init, + (ActorFunc)EnFsn_Destroy, + (ActorFunc)EnFsn_Update, + (ActorFunc)EnFsn_Draw, +}; + typedef enum { /* 0 */ FSN_ANIM_IDLE, /* 1 */ FSN_ANIM_SCRATCH_BACK, @@ -69,32 +81,20 @@ typedef enum { /* 13 */ FSN_ANIM_MAX } FsnAnimation; -ActorInit En_Fsn_InitVars = { - ACTOR_EN_FSN, - ACTORCAT_NPC, - FLAGS, - OBJECT_FSN, - sizeof(EnFsn), - (ActorFunc)EnFsn_Init, - (ActorFunc)EnFsn_Destroy, - (ActorFunc)EnFsn_Update, - (ActorFunc)EnFsn_Draw, -}; - -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 }, - { &gFsnTurnAroundAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandsOnCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandsOnCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnHandOnFaceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnHandOnFaceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnLeanForwardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnLeanForwardLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnSlamCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gFsnSlamCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gFsnMakeOfferAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, +static AnimationInfoS sAnimationInfo[FSN_ANIM_MAX] = { + { &gFsnIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_IDLE + { &gFsnScratchBackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_SCRATCH_BACK + { &gFsnTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_TURN_AROUND_FORWARD + { &gFsnTurnAroundAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_TURN_AROUND_REVERSE + { &gFsnHandsOnCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_HANDS_ON_COUNTER_START + { &gFsnHandsOnCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_HANDS_ON_COUNTER_LOOP + { &gFsnHandOnFaceStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_HAND_ON_FACE_START + { &gFsnHandOnFaceLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_HAND_ON_FACE_LOOP + { &gFsnLeanForwardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_LEAN_FORWARD_START + { &gFsnLeanForwardLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_LEAN_FORWARD_LOOP + { &gFsnSlamCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_SLAM_COUNTER_START + { &gFsnSlamCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // FSN_ANIM_SLAM_COUNTER_LOOP + { &gFsnMakeOfferAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // FSN_ANIM_MAKE_OFFER }; static ColliderCylinderInit sCylinderInit = { @@ -126,7 +126,7 @@ static Vec3f sShopItemPositions[3] = { s32 EnFsn_TestItemSelected(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || @@ -224,7 +224,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); if (ENFSN_IS_SHOP(&this->actor)) { this->actor.textId = 0; } @@ -295,14 +295,14 @@ void EnFsn_CursorLeftRight(EnFsn* this) { this->cursorIndex = cursorScan; break; } else if (cursorScan == 0) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); this->drawCursor = 0; this->actionFunc = EnFsn_LookToShopkeeperFromShelf; break; } } } else { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); this->drawCursor = 0; this->actionFunc = EnFsn_LookToShopkeeperFromShelf; if (this->itemIds[cursorScan] != -1) { @@ -312,9 +312,10 @@ void EnFsn_CursorLeftRight(EnFsn* this) { } } -s16 EnFsn_GetThirdDayItemId(void) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04) && (CURRENT_DAY == 3)) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { +s16 EnFsn_GetSpecialItemId(void) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM) && (CURRENT_DAY == 3)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD)) { return SI_BOMB_BAG_30_1; } return SI_MASK_ALL_NIGHT; @@ -353,7 +354,7 @@ s32 EnFsn_HasItemsToSell(void) { } if ((STOLEN_ITEM_1 != STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 != STOLEN_ITEM_NONE) || - !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { + !CHECK_WEEKEVENTREG(WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM)) { return true; } @@ -368,7 +369,7 @@ void EnFsn_GetShopItemIds(EnFsn* this) { this->stolenItem1 = this->stolenItem2 = 0; this->itemIds[0] = this->itemIds[1] = this->itemIds[2] = 0; - itemId = EnFsn_GetThirdDayItemId(); + itemId = EnFsn_GetSpecialItemId(); this->itemIds[this->totalSellingItems] = itemId; if (itemId != SI_NONE) { this->totalSellingItems++; @@ -409,7 +410,7 @@ void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; @@ -456,12 +457,13 @@ void EnFsn_UpdateCursorPos(EnFsn* this, PlayState* play) { s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (CURRENT_DAY != 3) { this->actor.textId = 0x29FB; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM)) { this->actor.textId = 0x29FF; - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD)) { this->actor.textId = 0x29D7; } else { this->actor.textId = 0x29D8; @@ -470,7 +472,7 @@ s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, PlayState* play) { return true; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; Message_StartTextbox(play, this->actor.textId, &this->actor); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_CURIOSITY_SHOP_MAN); @@ -490,13 +492,13 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, PlayState* play, Input* input) { if (!this->items[this->cursorIndex]->isOutOfStock) { this->prevActionFunc = this->actionFunc; Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; this->drawCursor = 0; this->actionFunc = EnFsn_SelectItem; } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } return true; } @@ -743,8 +745,9 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { if (this->animIndex == FSN_ANIM_HANDS_ON_COUNTER_START) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (curFrame == frameCount) { + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + + if (curFrame == endFrame) { this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -773,13 +776,13 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { } else if (((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= 15.0f)) && (player->actor.world.pos.y > 0.0f) && ((player->actor.world.pos.z >= -35.0f) && (player->actor.world.pos.z <= -20.0f))) { - func_800B8614(&this->actor, play, 400.0f); + Actor_OfferTalk(&this->actor, play, 400.0f); } } void EnFsn_Haggle(EnFsn* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->flags & ENFSN_ANGRY) { this->flags &= ~ENFSN_ANGRY; @@ -799,7 +802,7 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { if (this->animIndex == FSN_ANIM_MAKE_OFFER) { - if (curFrame == frameCount) { + if (curFrame == endFrame) { this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { @@ -863,7 +866,7 @@ void EnFsn_StartBuying(EnFsn* this, PlayState* play) { break; case 0x29CF: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; this->actionFunc = EnFsn_SetupDeterminePrice; break; @@ -889,9 +892,10 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { break; case 0x29D2: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_04)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM)) { this->actor.textId = 0x2A01; - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD)) { this->actor.textId = 0x29D3; } else { this->actor.textId = 0x29D4; @@ -916,7 +920,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->isSelling = true; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -926,7 +930,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { break; case 1: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->isSelling = false; this->actor.textId = 0x29CE; EnFsn_HandleLookToShopkeeperBuyingCutscene(this); @@ -959,10 +963,10 @@ void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) { if (itemAction > PLAYER_IA_NONE) { buttonItem = GET_CUR_FORM_BTN_ITEM(player->heldItemButton); - this->price = (buttonItem < ITEM_MOON_TEAR) ? gItemPrices[buttonItem] : 0; + this->price = (buttonItem < ITEM_MOONS_TEAR) ? gItemPrices[buttonItem] : 0; if (this->price > 0) { player->actor.textId = 0x29EF; - player->exchangeItemId = buttonItem; + player->exchangeItemAction = buttonItem; this->actionFunc = EnFsn_MakeOffer; } else { player->actor.textId = 0x29CF; @@ -990,8 +994,8 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { if (talkState == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); - play->msgCtx.msgMode = 0x43; + Audio_PlaySfx_MessageDecide(); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { CutsceneManager_Stop(this->csId); @@ -1025,8 +1029,8 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { break; case 1: - func_8019F230(); - player->exchangeItemId = PLAYER_IA_NONE; + Audio_PlaySfx_MessageCancel(); + player->exchangeItemAction = PLAYER_IA_NONE; this->actionFunc = EnFsn_SetupDeterminePrice; break; } @@ -1082,7 +1086,7 @@ void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_ConverseBackroom; } } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1151,7 +1155,7 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) { EnFsn_CursorLeftRight(this); if (this->cursorIndex != prevCursorIdx) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } @@ -1188,19 +1192,19 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_2: - func_8019F208(); - SET_WEEKEVENTREG(WEEKEVENTREG_33_04); + Audio_PlaySfx_MessageDecide(); + SET_WEEKEVENTREG(WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM); // fallthrough case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item = this->items[this->cursorIndex]; item->buyFanfareFunc(play, item); Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; @@ -1218,13 +1222,13 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { break; case CANBUY_RESULT_NEED_RUPEES: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_ContinueTextbox(play, 0x29F0); this->actionFunc = EnFsn_PlayerCannotBuy; break; case CANBUY_RESULT_CANNOT_GET_NOW: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_ContinueTextbox(play, 0x29DD); this->actionFunc = EnFsn_PlayerCannotBuy; break; @@ -1242,7 +1246,7 @@ void EnFsn_SetupEndInteraction(EnFsn* this, PlayState* play) { if (play->msgCtx.bombersNotebookEventQueueCount == 0) { EnFsn_EndInteraction(this, play); } else { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; } } else { @@ -1263,7 +1267,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actionFunc = this->prevActionFunc; Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); break; @@ -1301,14 +1305,14 @@ void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->actor.textId = 0xFF; Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_DeterminePrice; break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; Message_StartTextbox(play, this->actor.textId, &this->actor); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_CURIOSITY_SHOP_MAN); @@ -1323,7 +1327,7 @@ void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { if (play->msgCtx.bombersNotebookEventQueueCount == 0) { EnFsn_EndInteraction(this, play); } else { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; } } else { @@ -1351,7 +1355,7 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->isSelling = false; this->actor.textId = 0x29CE; Message_StartTextbox(play, this->actor.textId, &this->actor); @@ -1359,7 +1363,7 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; Message_StartTextbox(play, this->actor.textId, &this->actor); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_CURIOSITY_SHOP_MAN); @@ -1374,7 +1378,7 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { if (play->msgCtx.bombersNotebookEventQueueCount == 0) { EnFsn_EndInteraction(this, play); } else { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; } } else { @@ -1398,7 +1402,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_LookToShelf; func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -1420,8 +1424,8 @@ void EnFsn_IdleBackroom(EnFsn* this, PlayState* play) { this->textId = 0; EnFsn_HandleConversationBackroom(this, play); this->actionFunc = EnFsn_ConverseBackroom; - } else if (this->actor.xzDistToPlayer < 100.0f || this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); + } else if (this->actor.xzDistToPlayer < 100.0f || this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -1429,12 +1433,12 @@ void EnFsn_ConverseBackroom(EnFsn* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->flags & ENFSN_END_CONVERSATION) { this->flags &= ~ENFSN_END_CONVERSATION; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnFsn_IdleBackroom; } else if (this->flags & ENFSN_GIVE_ITEM) { this->flags &= ~ENFSN_GIVE_ITEM; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnFsn_GiveItem; } else { @@ -1470,17 +1474,16 @@ void EnFsn_Init(Actor* thisx, PlayState* play) { EnFsn* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - - // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml SkelAnime_InitFlex(play, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable, - FSN_LIMB_MAX + 1); + ENFSN_LIMB_MAX); + if (ENFSN_IS_SHOP(&this->actor)) { this->actor.shape.rot.y = BINANG_ROT180(this->actor.shape.rot.y); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; EnFsn_GetCutscenes(this); EnFsn_InitShop(this, play); } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) || CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) || CHECK_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD)) { Actor_Kill(&this->actor); return; } @@ -1488,8 +1491,8 @@ void EnFsn_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->blinkTimer = 20; this->eyeTexIndex = 0; - this->actor.flags |= ACTOR_FLAG_1; - this->actor.targetMode = 0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_0; this->animIndex = FSN_ANIM_IDLE; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnFsn_IdleBackroom; @@ -1508,7 +1511,7 @@ void EnFsn_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk27A, this->actor.focus.pos); - SubS_FillLimbRotTables(play, this->limbRotYTable, this->limbRotZTable, ARRAY_COUNT(this->limbRotYTable)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENFSN_LIMB_MAX); EnFsn_Blink(this); if (ENFSN_IS_SHOP(&this->actor) && EnFsn_HasItemsToSell()) { EnFsn_UpdateJoystickInputState(this, play); @@ -1630,7 +1633,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) { s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFsn* this = THIS; - s32 limbRotTableIdx; + s32 fidgetIndex; if (limbIndex == FSN_LIMB_HEAD) { Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); @@ -1638,24 +1641,24 @@ s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p if (ENFSN_IS_BACKROOM(&this->actor)) { switch (limbIndex) { case FSN_LIMB_TORSO: - limbRotTableIdx = 0; + fidgetIndex = 0; break; case FSN_LIMB_LEFT_HAND: - limbRotTableIdx = 1; + fidgetIndex = 1; break; case FSN_LIMB_HEAD: - limbRotTableIdx = 2; + fidgetIndex = 2; break; default: - limbRotTableIdx = 9; + fidgetIndex = 9; break; } - if (limbRotTableIdx < 9) { - rot->y += (s16)(Math_SinS(this->limbRotYTable[limbRotTableIdx]) * 200.0f); - rot->z += (s16)(Math_CosS(this->limbRotZTable[limbRotTableIdx]) * 200.0f); + if (fidgetIndex < 9) { + rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f); } } if (limbIndex == FSN_LIMB_TOUPEE) { 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 f214dcbd9..22133322e 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h @@ -13,6 +13,8 @@ #define ENFSN_ANGRY (1 << 8) #define ENFSN_CALM_DOWN (1 << 9) +#define ENFSN_LIMB_MAX FSN_LIMB_MAX + 1 // Note: adding 1 to FSN_LIMB_MAX due to bug in the skeleton, see bug in object_fsn.xml + struct EnFsn; typedef void (*EnFsnActionFunc)(struct EnFsn*, PlayState*); @@ -24,12 +26,12 @@ typedef struct EnFsn { /* 0x1D4 */ EnFsnActionFunc actionFunc; /* 0x1D8 */ EnFsnActionFunc prevActionFunc; // Used to return to correct browsing function /* 0x1DC */ ColliderCylinder collider; - /* 0x228 */ s16 limbRotYTable[19]; - /* 0x24E */ s16 limbRotZTable[19]; + /* 0x228 */ s16 fidgetTableY[ENFSN_LIMB_MAX]; + /* 0x24E */ s16 fidgetTableZ[ENFSN_LIMB_MAX]; /* 0x274 */ Vec3s headRot; /* 0x27A */ Vec3s unk27A; // Set but never used - /* 0x280 */ Vec3s jointTable[FSN_LIMB_MAX + 1]; // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml - /* 0x2F2 */ Vec3s morphTable[FSN_LIMB_MAX + 1]; + /* 0x280 */ Vec3s jointTable[ENFSN_LIMB_MAX]; + /* 0x2F2 */ Vec3s morphTable[ENFSN_LIMB_MAX]; /* 0x364 */ s16 eyeTexIndex; /* 0x366 */ s16 blinkTimer; /* 0x368 */ s16 cutsceneState; 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 bfc157fcb..6a68f283a 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -9,10 +9,10 @@ #include "overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h" #include "overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#include "objects/object_mu/object_mu.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnFu*)thisx) @@ -73,13 +73,31 @@ 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 sAnimationInfo[] = { +typedef enum { + /* 0 */ HONEY_DARLING_ANIM_IDLE, + /* 1 */ HONEY_DARLING_ANIM_CUP_CHEEKS, + /* 2 */ HONEY_DARLING_ANIM_HUG, + /* 3 */ HONEY_DARLING_ANIM_GAME_DANCE, + /* 4 */ HONEY_DARLING_ANIM_HOLD_HANDS_MORPH, + /* 5 */ HONEY_DARLING_ANIM_HOLD_HANDS, + /* 6 */ HONEY_DARLING_ANIM_SURPRISE, + /* 7 */ HONEY_DARLING_ANIM_MAX +} HoneyAndDarlingAnimation; + +static AnimationInfo sAnimationInfo[HONEY_DARLING_ANIM_MAX] = { + // HONEY_DARLING_ANIM_IDLE { &gHoneyAndDarlingIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_CUP_CHEEKS { &gHoneyAndDarlingCupCheeksLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_HUG { &gHoneyAndDarlingHugLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + // HONEY_DARLING_ANIM_GAME_DANCE { &gHoneyAndDarlingGameDanceLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + // HONEY_DARLING_ANIM_HOLD_HANDS_MORPH { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + // HONEY_DARLING_ANIM_HOLD_HANDS { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + // HONEY_DARLING_ANIM_SURPRISE { &gHoneyAndDarlingSurpiseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, }; @@ -111,7 +129,7 @@ void func_809616E0(EnFu* this, PlayState* play) { s16 spA0 = false; Vec3f sp94; - if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && (CURRENT_DAY == 3)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_DEKU) && (CURRENT_DAY == 3)) { spA0 = true; } this->unk_54C = 0; @@ -200,7 +218,7 @@ void EnFu_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.gravity = -0.2f; this->actor.shape.rot.y += 0x4000; this->actor.world.rot = this->actor.shape.rot; @@ -213,7 +231,7 @@ void EnFu_Init(Actor* thisx, PlayState* play) { this->unk_54E = 0; this->unk_550 = 0; func_809622FC(this); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; func_809619D0(this, play); if (CURRENT_DAY == 2) { Vec3f sp40 = this->actor.child->home.pos; @@ -371,7 +389,7 @@ void func_8096209C(EnFu* this, PlayState* play) { } void func_809622FC(EnFu* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_CUP_CHEEKS); this->actionFunc = func_80962340; } @@ -385,7 +403,7 @@ void func_80962340(EnFu* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->unk_54A == 2) { if (this->unk_552 == 0x287D) { - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { Message_StartTextbox(play, 0x287E, &this->actor); this->unk_552 = 0x287E; } else if ((CURRENT_DAY == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && @@ -418,9 +436,9 @@ void func_80962340(EnFu* this, PlayState* play) { } func_809628BC(this); } else if (this->unk_54A == 2) { - func_800B8614(&this->actor, play, 500.0f); + Actor_OfferTalk(&this->actor, play, 500.0f); } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_SUB(this->actor.child->shape.rot.y, 0x4000), 10, 3000, 100); } @@ -432,16 +450,16 @@ void func_80962588(EnFu* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.save.saveInfo.playerData.rupees >= 10) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-10); func_80963DE4(this, play); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2873, &this->actor); this->unk_552 = 0x2873; } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x2872, &this->actor); this->unk_552 = 0x2872; } @@ -538,7 +556,7 @@ void func_80962660(EnFu* this, PlayState* play) { Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; this->unk_53C = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_GAME_DANCE); Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { @@ -617,6 +635,9 @@ void func_809628D0(EnFu* this, PlayState* play) { } } break; + + default: + break; } if (talkState != TEXT_STATE_3) { @@ -644,7 +665,7 @@ void func_80962A10(EnFu* this, PlayState* play) { return; } - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); player->stateFlags1 &= ~PLAYER_STATE1_20; Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); if (this->unk_546 == 1) { @@ -653,7 +674,7 @@ void func_80962A10(EnFu* this, PlayState* play) { this->unk_546 = 1; } - if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && gSaveContext.save.saveInfo.playerData.isMagicAcquired) { + if ((GET_PLAYER_FORM == PLAYER_FORM_DEKU) && gSaveContext.save.saveInfo.playerData.isMagicAcquired) { Magic_Add(play, MAGIC_FILL_TO_CAPACITY); } @@ -680,7 +701,7 @@ void func_80962BCC(EnFu* this, PlayState* play) { return; } - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); player->stateFlags1 &= ~PLAYER_STATE1_20; player->stateFlags3 |= PLAYER_STATE3_400000; Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); @@ -711,7 +732,7 @@ void func_80962D60(EnFu* this, PlayState* play) { return; } - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); player->stateFlags1 &= ~PLAYER_STATE1_20; player->stateFlags3 |= PLAYER_STATE3_400000; Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); @@ -737,7 +758,7 @@ void func_80962EBC(EnFu* this, PlayState* play) { void func_80962F10(EnFu* this) { this->unk_548 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; SET_WEEKEVENTREG(WEEKEVENTREG_08_01); this->actionFunc = func_80962F4C; } @@ -748,7 +769,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { switch (this->unk_542) { case 0: - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { player->stateFlags3 |= PLAYER_STATE3_400; } break; @@ -760,6 +781,9 @@ void func_80962F4C(EnFu* this, PlayState* play) { case 2: play->unk_1887D = 30; break; + + default: + break; } if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) { @@ -821,7 +845,7 @@ void func_8096326C(EnFu* this, PlayState* play) { } void func_809632D0(EnFu* this) { - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } @@ -833,7 +857,7 @@ void func_809632D0(EnFu* this) { mizu->unk_160 = 0; } - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80963350; } @@ -897,7 +921,7 @@ void func_80963630(EnFu* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_20) && (CURRENT_DAY == 3) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_40)) { Message_StartTextbox(play, 0x2884, &this->actor); this->unk_552 = 0x2884; @@ -918,7 +942,7 @@ void func_80963630(EnFu* this, PlayState* play) { this->actor.child->freezeTimer = 0; func_809628BC(this); - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { switch (CURRENT_DAY) { case 1: SET_WEEKEVENTREG(WEEKEVENTREG_22_10); @@ -931,12 +955,15 @@ void func_80963630(EnFu* this, PlayState* play) { case 3: SET_WEEKEVENTREG(WEEKEVENTREG_22_40); break; + + default: + break; } } player->stateFlags1 &= ~PLAYER_STATE1_20; } else { this->actor.child->freezeTimer = 10; - func_800B85E0(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); } } @@ -969,46 +996,46 @@ s32 func_80963810(PlayState* play, Vec3f pos) { s32 func_809638F8(PlayState* play) { s32 ret = true; - if (play->envCtx.lightSettings.diffuseColor1[0] > 25) { - play->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.adjLightSettings.light1Color[0] > 25) { + play->envCtx.adjLightSettings.light1Color[0] -= 25; ret = false; } else { - play->envCtx.lightSettings.diffuseColor1[0] = 0; + play->envCtx.adjLightSettings.light1Color[0] = 0; } - if (play->envCtx.lightSettings.diffuseColor1[1] > 25) { - play->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.adjLightSettings.light1Color[1] > 25) { + play->envCtx.adjLightSettings.light1Color[1] -= 25; ret = false; } else { - play->envCtx.lightSettings.diffuseColor1[1] = 0; + play->envCtx.adjLightSettings.light1Color[1] = 0; } - if (play->envCtx.lightSettings.diffuseColor1[2] > 25) { - play->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.adjLightSettings.light1Color[2] > 25) { + play->envCtx.adjLightSettings.light1Color[2] -= 25; ret = false; } else { - play->envCtx.lightSettings.diffuseColor1[2] = 0; + play->envCtx.adjLightSettings.light1Color[2] = 0; } - if (play->envCtx.lightSettings.ambientColor[0] > 25) { - play->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[0] > 25) { + play->envCtx.adjLightSettings.ambientColor[0] -= 25; ret = false; } else { - play->envCtx.lightSettings.ambientColor[0] = 0; + play->envCtx.adjLightSettings.ambientColor[0] = 0; } - if (play->envCtx.lightSettings.ambientColor[1] > 25) { - play->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[1] > 25) { + play->envCtx.adjLightSettings.ambientColor[1] -= 25; ret = false; } else { - play->envCtx.lightSettings.ambientColor[1] = 0; + play->envCtx.adjLightSettings.ambientColor[1] = 0; } - if (play->envCtx.lightSettings.ambientColor[2] > 25) { - play->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.adjLightSettings.ambientColor[2] > 25) { + play->envCtx.adjLightSettings.ambientColor[2] -= 25; ret = false; } else { - play->envCtx.lightSettings.ambientColor[2] = 0; + play->envCtx.adjLightSettings.ambientColor[2] = 0; } return ret; } @@ -1016,7 +1043,7 @@ s32 func_809638F8(PlayState* play) { void func_809639D0(EnFu* this, PlayState* play) { switch (CURRENT_DAY) { case 1: - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Message_StartTextbox(play, 0x2853, &this->actor); this->unk_552 = 0x2853; @@ -1038,7 +1065,7 @@ void func_809639D0(EnFu* this, PlayState* play) { break; case 2: - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { Message_StartTextbox(play, 0x286F, &this->actor); this->unk_552 = 0x286F; } else if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { @@ -1067,8 +1094,8 @@ void func_809639D0(EnFu* this, PlayState* play) { break; case 3: - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { func_80963EAC(this, play); } else { Message_StartTextbox(play, 0x2841, &this->actor); @@ -1112,13 +1139,16 @@ void func_809639D0(EnFu* this, PlayState* play) { this->unk_552 = 0x286D; } break; + + default: + break; } } void func_80963DE4(EnFu* this, PlayState* play) { switch (this->unk_542) { case 0: - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { Message_StartTextbox(play, 0x2875, &this->actor); this->unk_552 = 0x2875; } else { @@ -1136,6 +1166,9 @@ void func_80963DE4(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x287B, &this->actor); this->unk_552 = 0x287B; break; + + default: + break; } } @@ -1215,7 +1248,7 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x2842: case 0x2844: case 0x2848: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_CUP_CHEEKS); break; case 0x2840: @@ -1241,21 +1274,24 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x286B: case 0x286D: case 0x2871: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HOLD_HANDS_MORPH); break; case 0x2860: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HOLD_HANDS); break; case 0x285F: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_SURPRISE); break; case 0x287E: case 0x2880: case 0x2883: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HONEY_DARLING_ANIM_HUG); + break; + + default: break; } } @@ -1348,13 +1384,13 @@ void EnFu_Update(Actor* thisx, PlayState* play) { s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFu* this = THIS; - if (limbIndex == 9) { + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { Matrix_Translate(1600.0f, 300.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->unk_524[1], MTXMODE_APPLY); Matrix_RotateZS(this->unk_524[0], MTXMODE_APPLY); Matrix_RotateYS(this->unk_524[2], MTXMODE_APPLY); Matrix_Translate(-1600.0f, -300.0f, 0.0f, MTXMODE_APPLY); - } else if (limbIndex == 20) { + } else if (limbIndex == HONEY_AND_DARLING_LIMB_WOMAN_HEAD) { Matrix_Translate(1800.0f, 200.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->unk_52A[1], MTXMODE_APPLY); Matrix_RotateZS(this->unk_52A[0], MTXMODE_APPLY); @@ -1369,9 +1405,9 @@ void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, static Vec3f D_80964C34 = { -3500.0f, 0.0f, 0.0f }; EnFu* this = THIS; - if (limbIndex == 9) { + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { Matrix_MultVec3f(&D_80964C28, &this->unk_508); - } else if (limbIndex == 20) { + } else if (limbIndex == HONEY_AND_DARLING_LIMB_WOMAN_HEAD) { Matrix_MultVec3f(&D_80964C34, &this->unk_514); } } 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 44f769a8c..ecd4878c2 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -2,6 +2,7 @@ #define Z_EN_FU_H #include "global.h" +#include "objects/object_mu/object_mu.h" #include "overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h" struct EnFu; @@ -27,8 +28,8 @@ typedef struct EnFu { /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnFuActionFunc actionFunc; - /* 0x1D8 */ Vec3s jointTable[21]; - /* 0x256 */ Vec3s morphTable[21]; + /* 0x1D8 */ Vec3s jointTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x256 */ Vec3s morphTable[HONEY_AND_DARLING_LIMB_MAX]; /* 0x2D4 */ BgFuMizu* unk_2D4; /* 0x2D8 */ EnFuUnkStruct unk_2D8[10]; /* 0x508 */ Vec3f unk_508; diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c index 576e307b2..8aa3909f7 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c @@ -138,9 +138,9 @@ s32 func_80ACF8B8(EnFuKago* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); return true; - } else { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); return false; } diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 52e947dbd..c7066cf30 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -373,7 +373,7 @@ s32 func_80ACF04C(EnFuMato* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); fu->unk_548++; - if ((fu->unk_542 == 2) || (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { + if ((fu->unk_542 == 2) || (GET_PLAYER_FORM == PLAYER_FORM_DEKU)) { fu->unk_546 = 1; func_80ACE680(this); } else { diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 71f980d47..0bf2f3544 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -9,7 +9,7 @@ #include "objects/object_fz/object_fz.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnFz*)thisx) @@ -157,7 +157,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, TATL_HINT_ID_FREEZARD, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1400, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -180,7 +180,7 @@ void EnFz_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_BC8 = 0; this->unk_BCF = 0; this->unk_BCC = 1; @@ -401,7 +401,7 @@ void func_80932C98(EnFz* this, PlayState* play) { } if (this->unk_BCE != 0) { - if (ENFZ_GET_8000(&this->actor) && (this->collider1.base.atFlags & AC_HIT)) { + if (ENFZ_GET_8000(&this->actor) && (this->collider1.base.atFlags & AT_HIT)) { this->unk_BCD = 0; this->unk_BBC = 0.0f; this->collider1.base.acFlags &= ~AC_HIT; @@ -472,7 +472,7 @@ void func_80933014(EnFz* this) { void func_809330D4(EnFz* this) { this->unk_BD6 = 2; this->unk_BCE = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80933104; } @@ -543,7 +543,7 @@ void func_80933324(EnFz* this) { this->unk_BCA = 40; this->unk_BCC = 1; this->unk_BCE = 1; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.gravity = -1.0f; this->actionFunc = func_80933368; } @@ -607,7 +607,7 @@ void func_809334B8(EnFz* this, PlayState* play) { if (this->unk_BCA > 10) { sp3F = 0; sp3C = 150; - func_800B9010(&this->actor, NA_SE_EN_FREEZAD_BREATH - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FREEZAD_BREATH - SFX_FLAG); if ((this->unk_BCA - 10) < 16) { sp3C = (this->unk_BCA * 10) - 100; } @@ -653,7 +653,7 @@ void func_809336C0(EnFz* this, PlayState* play) { this->unk_BCC = 1; this->unk_BCE = 0; this->unk_BD8 = 1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_BD7 = 0; this->unk_BCA = 60; func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); @@ -671,7 +671,7 @@ void func_80933790(EnFz* this) { this->unk_BD6 = 3; this->unk_BCE = 0; this->unk_BD8 = 1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; this->unk_BBC = 0.0f; this->actionFunc = func_809337D4; @@ -702,7 +702,7 @@ void func_8093389C(EnFz* this) { this->unk_BCA = 40; this->unk_BCC = 1; this->unk_BCE = 1; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.gravity = -1.0f; this->actionFunc = func_809338E0; } @@ -723,7 +723,7 @@ void func_809338E0(EnFz* this, PlayState* play) { sp3F = 0; sp3C = 150; - func_800B9010(&this->actor, NA_SE_EN_FREEZAD_BREATH - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FREEZAD_BREATH - SFX_FLAG); if ((this->unk_BC6 & 0x3F) >= 0x30) { sp3C = 630 - ((this->unk_BC6 & 0x3F) * 10); @@ -763,7 +763,7 @@ void func_80933AF4(EnFz* this) { this->unk_BCA = 40; this->unk_BCC = 1; this->unk_BCE = 1; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.gravity = -1.0f; this->actionFunc = func_80933B38; } @@ -863,14 +863,14 @@ void EnFz_Draw(Actor* thisx, PlayState* play) { if (this->drawDmgEffTimer > 0) { s32 pad2[6]; - Vec3f limbPos[2]; + Vec3f bodyPartsPos[2]; s32 pad3; - limbPos[0] = this->actor.world.pos; - limbPos[1] = this->actor.world.pos; - limbPos[0].y += 20.0f; - limbPos[1].y += 40.0f; - Actor_DrawDamageEffects(play, NULL, limbPos, ARRAY_COUNT(limbPos), this->drawDmgEffScale * 4.0f, 0.5f, + bodyPartsPos[0] = this->actor.world.pos; + bodyPartsPos[1] = this->actor.world.pos; + bodyPartsPos[0].y += 20.0f; + bodyPartsPos[1].y += 40.0f; + Actor_DrawDamageEffects(play, NULL, bodyPartsPos, ARRAY_COUNT(bodyPartsPos), this->drawDmgEffScale * 4.0f, 0.5f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); } 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 add0814bd..481c155b4 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -208,7 +208,7 @@ void EnGakufu_GiveReward(EnGakufu* this, PlayState* play) { s32 hour; s32 i; - play_sound(NA_SE_SY_CORRECT_CHIME); + Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); hour = TIME_TO_HOURS_F(gSaveContext.save.time); for (i = 0; i < 3; i++) { diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index b9936c53c..97567e5f4 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -16,12 +16,12 @@ void EnGamelupy_Destroy(Actor* thisx, PlayState* play); void EnGamelupy_Update(Actor* thisx, PlayState* play); void EnGamelupy_Draw(Actor* thisx, PlayState* play); -void func_80AF6958(EnGamelupy* this, PlayState* play); -void func_80AF69A8(EnGamelupy* this, PlayState* play); -void func_80AF6A78(EnGamelupy* this, PlayState* play); -void func_80AF6944(EnGamelupy* this); -void func_80AF6994(EnGamelupy* this); -void func_80AF6A38(EnGamelupy* this); +void EnGamelupy_FindSharedMemory(EnGamelupy* this, PlayState* play); +void EnGamelupy_Idle(EnGamelupy* this, PlayState* play); +void EnGamelupy_Collected(EnGamelupy* this, PlayState* play); +void EnGamelupy_SetupFindSharedMemory(EnGamelupy* this); +void EnGamelupy_SetupIdle(EnGamelupy* this); +void EnGamelupy_SetupCollected(EnGamelupy* this); ActorInit En_Gamelupy_InitVars = { ACTOR_EN_GAMELUPY, @@ -74,15 +74,15 @@ void EnGamelupy_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.gravity = -0.5f; this->actor.shape.rot.y = Rand_Next(); - this->unk_19C = 0; - this->unk_19E = 0; - this->unk_1A0 = 0x7D0; - if (this->actor.params == 1) { - this->rupeeIndex = 1; + this->collectedTimer = 0; + this->sparklesAngle = 0; + this->sparklesAngleStep = 0x7D0; + if (EN_GAMELUPY_GET_TYPE(&this->actor) == ENGAMELUPY_TYPE_BLUE) { + this->type = ENGAMELUPY_TYPE_BLUE; } else { - this->rupeeIndex = 0; + this->type = ENGAMELUPY_TYPE_GREEN; } - func_80AF6944(this); + EnGamelupy_SetupFindSharedMemory(this); } void EnGamelupy_Destroy(Actor* thisx, PlayState* play) { @@ -91,77 +91,77 @@ void EnGamelupy_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80AF6854(EnGamelupy* this, PlayState* play) { - Vec3f sp4C; - Vec3f sp40; - Vec3f sp30; +void EnGamelupy_SpawnSparkles(EnGamelupy* this, PlayState* play) { + Vec3f pos; + Vec3f accel; + Vec3f velocity; - sp4C = this->actor.world.pos; - sp30.x = Math_SinS(this->unk_19E) * 3.0f; - sp30.y = 5.5f; - sp30.z = Math_CosS(this->unk_19E) * 3.0f; - sp40.x = -0.05f * sp30.x; - sp40.y = -0.4f; - sp40.z = -0.05f * sp30.z; - EffectSsKirakira_SpawnDispersed(play, &sp4C, &sp30, &sp40, &sPrimColor, &sEnvColor, 3000, 40); - this->unk_19E += this->unk_1A0; + pos = this->actor.world.pos; + velocity.x = Math_SinS(this->sparklesAngle) * 3.0f; + velocity.y = 5.5f; + velocity.z = Math_CosS(this->sparklesAngle) * 3.0f; + accel.x = -0.05f * velocity.x; + accel.y = -0.4f; + accel.z = -0.05f * velocity.z; + EffectSsKirakira_SpawnDispersed(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, 3000, 40); + this->sparklesAngle += this->sparklesAngleStep; } -void func_80AF6944(EnGamelupy* this) { - this->actionFunc = func_80AF6958; +void EnGamelupy_SetupFindSharedMemory(EnGamelupy* this) { + this->actionFunc = EnGamelupy_FindSharedMemory; } -void func_80AF6958(EnGamelupy* this, PlayState* play) { - s16* unk_198 = func_800B6680(play, ACTOR_EN_GAMELUPY); +void EnGamelupy_FindSharedMemory(EnGamelupy* this, PlayState* play) { + s16* minigameScore = Actor_FindSharedMemoryEntry(play, ACTOR_EN_GAMELUPY); - if (unk_198 != NULL) { - this->unk_198 = unk_198; - func_80AF6994(this); + if (minigameScore != NULL) { + this->minigameScore = minigameScore; + EnGamelupy_SetupIdle(this); } } -void func_80AF6994(EnGamelupy* this) { - this->actionFunc = func_80AF69A8; +void EnGamelupy_SetupIdle(EnGamelupy* this) { + this->actionFunc = EnGamelupy_Idle; } -void func_80AF69A8(EnGamelupy* this, PlayState* play) { +void EnGamelupy_Idle(EnGamelupy* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { - *this->unk_198 += 50; - if (this->rupeeIndex == 1) { + *this->minigameScore += ENGAMELUPY_POINTS; + if (this->type == ENGAMELUPY_TYPE_BLUE) { Rupees_ChangeBy(5); } else { Rupees_ChangeBy(1); } - func_80AF6A38(this); + EnGamelupy_SetupCollected(this); } this->actor.shape.rot.y += 0x1F4; } -void func_80AF6A38(EnGamelupy* this) { - this->unk_19C = 0; +void EnGamelupy_SetupCollected(EnGamelupy* this) { + this->collectedTimer = 0; this->actor.gravity = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_SY_GET_RUPY); - this->actionFunc = func_80AF6A78; + this->actionFunc = EnGamelupy_Collected; } -void func_80AF6A78(EnGamelupy* this, PlayState* play) { +void EnGamelupy_Collected(EnGamelupy* this, PlayState* play) { f32 scale; Player* player = GET_PLAYER(play); - if (this->unk_19C > 30) { + if (this->collectedTimer > 30) { Actor_Kill(&this->actor); } else { - this->unk_19C++; + this->collectedTimer++; this->actor.world.pos = player->actor.world.pos; this->actor.world.pos.y += 40.0f; - scale = (30.0f - this->unk_19C) * 0.001f; + scale = (30.0f - this->collectedTimer) * 0.001f; Actor_SetScale(&this->actor, scale); - func_80AF6854(this, play); + EnGamelupy_SpawnSparkles(this, play); } this->actor.shape.rot.y += 0x3E8; } -void func_80AF6B40(EnGamelupy* this, PlayState* play) { +void EnGamelupy_UpdateCollision(EnGamelupy* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -172,7 +172,7 @@ void EnGamelupy_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8); - func_80AF6B40(this, play); + EnGamelupy_UpdateCollision(this, play); } void EnGamelupy_Draw(Actor* thisx, PlayState* play) { @@ -184,7 +184,7 @@ void EnGamelupy_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); func_800B8050(&this->actor, play, 0); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[this->rupeeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[this->type])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h index 5d45f3168..d9e5d2b7d 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h @@ -5,17 +5,27 @@ struct EnGamelupy; +#define ENGAMELUPY_POINTS 50 + typedef void (*EnGamelupyActionFunc)(struct EnGamelupy*, PlayState*); +#define EN_GAMELUPY_GET_TYPE(thisx) ((thisx)->params) + +typedef enum { + /* 0 */ ENGAMELUPY_TYPE_GREEN, + /* 1 */ ENGAMELUPY_TYPE_BLUE, + /* 2 */ ENGAMELUPY_TYPE_MAX +} EnGamelupyType; + typedef struct EnGamelupy { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ EnGamelupyActionFunc actionFunc; - /* 0x194 */ s32 rupeeIndex; - /* 0x198 */ s16* unk_198; - /* 0x19C */ s16 unk_19C; - /* 0x19E */ s16 unk_19E; - /* 0x1A0 */ s16 unk_1A0; + /* 0x194 */ s32 type; + /* 0x198 */ s16* minigameScore; // Pointer to shared memory location with actor EnLiftNuts + /* 0x19C */ s16 collectedTimer; + /* 0x19E */ s16 sparklesAngle; + /* 0x1A0 */ s16 sparklesAngleStep; } EnGamelupy; // size = 0x1A4 #endif // Z_EN_GAMELUPY_H 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 11fa876d4..e7d8e9032 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -5,9 +5,8 @@ */ #include "z_en_gb2.h" -#include "objects/object_ps/object_ps.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnGb2*)thisx) @@ -163,7 +162,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14E4; } - if (gSaveContext.save.saveInfo.playerData.health > 48) { + if (gSaveContext.save.saveInfo.playerData.health > 0x30) { return 0x14D2; } @@ -171,7 +170,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14D3; case 0x14E4: - if (gSaveContext.save.saveInfo.playerData.health > 48) { + if (gSaveContext.save.saveInfo.playerData.health > 0x30) { return 0x14D2; } @@ -193,8 +192,10 @@ u16 func_80B0F7FC(EnGb2* this) { case 0x14D9: return 0x14DA; + + default: + return 0; } - return 0; } u16 func_80B0F8F8(EnGb2* this) { @@ -213,8 +214,10 @@ u16 func_80B0F8F8(EnGb2* this) { case 0x14E1: return 0x14E2; + + default: + return 0; } - return 0; } u16 func_80B0F97C(EnGb2* this) { @@ -236,8 +239,10 @@ u16 func_80B0F97C(EnGb2* this) { case 0x14FA: this->unk_26C |= 2; return 0x14FB; + + default: + return 0; } - return 0; } void func_80B0FA04(EnGb2* this) { @@ -262,17 +267,19 @@ s32 func_80B0FA48(EnGb2* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_40)) { this->unk_26E = 0x14EB; return false; + } else { + this->unk_26E = 0x14EE; + return true; } - this->unk_26E = 0x14EE; - return true; - } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) { - this->unk_26E = 0x14EF; - return false; - } else { - this->unk_26E = 0x14F4; - return true; + default: + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) { + this->unk_26E = 0x14EF; + return false; + } else { + this->unk_26E = 0x14F4; + return true; + } } } @@ -314,12 +321,14 @@ u16 func_80B0FB24(EnGb2* this) { case 0x14F2: this->unk_26C |= 2; return 0x14F3; + + default: + return 0; } - return 0; } void func_80B0FBF0(EnGb2* this, PlayState* play) { - Vec3f sp90[4] = { + Vec3f sp90[] = { { 120.0f, 0.0f, 800.0f }, { -120.0f, 0.0f, 750.0f }, { 60.0f, 0.0f, 750.0f }, @@ -355,7 +364,7 @@ void func_80B0FD8C(EnGb2* this, PlayState* play) { } void func_80B0FE18(PlayState* play) { - func_800FD750(NA_BGM_MINI_BOSS); + Environment_ForcePlaySequence(NA_BGM_MINI_BOSS); play->nextEntrance = ENTRANCE(GHOST_HUT, 1); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; @@ -370,8 +379,8 @@ void func_80B0FE7C(PlayState* play) { } void func_80B0FEBC(EnGb2* this, PlayState* play) { - if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { - play->msgCtx.ocarinaMode = 4; + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; SET_EVENTINF(EVENTINF_47); this->unk_26E = 0x14D1; this->unk_288 = 10; @@ -380,8 +389,8 @@ void func_80B0FEBC(EnGb2* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B0FFA8; - } else if ((this->actor.xzDistToPlayer < 300.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 300.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } @@ -391,7 +400,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_26E = 0x14D1; this->unk_288 = 30; @@ -408,41 +417,47 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_288) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; Message_StartTextbox(play, this->unk_26E, &this->actor); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->unk_26E = 0x14D8; Message_StartTextbox(play, this->unk_26E, &this->actor); } break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->unk_26E = 0x14D6; this->unk_26C |= 2; Message_StartTextbox(play, this->unk_26E, &this->actor); break; + + default: + break; } } else if (this->unk_26E == 0x14DA) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-this->unk_288); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = func_80B11344; break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->unk_26E = 0x14DB; this->unk_26C |= 2; Message_StartTextbox(play, this->unk_26E, &this->actor); break; + + default: + break; } } } @@ -505,7 +520,7 @@ void func_80B10344(EnGb2* this, PlayState* play) { } } - if (gSaveContext.save.saveInfo.playerData.health < 49) { + if (gSaveContext.save.saveInfo.playerData.health <= 0x30) { gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; SET_EVENTINF(EVENTINF_46); SET_EVENTINF(EVENTINF_45); @@ -543,7 +558,7 @@ void func_80B10584(EnGb2* this, PlayState* play) { this->actionFunc = func_80B10634; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } @@ -553,7 +568,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_26C &= ~2; if (this->unk_26E == 0x14DD) { @@ -576,14 +591,14 @@ void func_80B10634(EnGb2* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_288) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; Message_StartTextbox(play, this->unk_26E, &this->actor); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-this->unk_288); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = func_80B11344; @@ -591,11 +606,14 @@ void func_80B10634(EnGb2* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->unk_26E = 0x14E3; this->unk_26C |= 2; Message_StartTextbox(play, this->unk_26E, &this->actor); break; + + default: + break; } } } @@ -641,7 +659,7 @@ void func_80B109DC(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B10634; } else { - func_800B85E0(&this->actor, play, 300.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 300.0f, PLAYER_IA_MINUS1); } } @@ -663,16 +681,19 @@ void func_80B10A48(EnGb2* this, PlayState* play) { case ENGB2_7_2: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); if (this->unk_26E == 0x14FB) { - Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); + Flags_SetSwitch(play, ENGB2_GET_SWITCH_FLAG(&this->actor)); Actor_Kill(&this->actor); return; } this->actor.draw = NULL; this->unk_26C |= 0x100; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80B111AC; break; + + default: + break; } } } @@ -697,9 +718,9 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { this->csIdIndex = 1; this->unk_26C &= ~0x40; this->actionFunc = func_80B10DAC; - } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isTargeted) { + } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isLockedOn) { this->unk_26C |= 0x40; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } else { this->unk_26C &= ~0x40; @@ -719,7 +740,7 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { if (!(this->unk_26C & 0x80)) { this->actor.flags |= ACTOR_FLAG_10000; this->unk_26C |= 0x20; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } } @@ -731,7 +752,7 @@ void func_80B10DAC(EnGb2* this, PlayState* play) { if (this->csIdIndex != 2) { this->actionFunc = func_80B10E98; } else { - Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); + Flags_SetSwitch(play, ENGB2_GET_SWITCH_FLAG(&this->actor)); this->actionFunc = func_80B10868; } } else { @@ -750,12 +771,12 @@ void func_80B10E98(EnGb2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { this->unk_26C &= ~2; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if ((this->unk_26E != 0x14E8) && (this->unk_26E != 0x14EA)) { CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->actionFunc = func_80B10B5C; - } else if (Flags_GetSwitch(play, ENGB2_GET_7F8(&this->actor))) { + } else if (Flags_GetSwitch(play, ENGB2_GET_SWITCH_FLAG(&this->actor))) { this->actionFunc = func_80B10A48; } else { CutsceneManager_Stop(this->csIdList[this->csIdIndex]); @@ -786,14 +807,14 @@ void func_80B11048(EnGb2* this, PlayState* play) { this->actionFunc = func_80B10DAC; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } } void func_80B110F8(EnGb2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_26C &= ~2; this->actionFunc = func_80B10A48; @@ -844,7 +865,7 @@ void func_80B11268(EnGb2* this, PlayState* play) { if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && Flags_GetClear(play, 5)) { this->unk_28A = 0xFF; this->unk_26C &= ~0x100; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnGb2_Draw; this->unk_26E = 0x14F9; this->actionFunc = func_80B11048; @@ -861,7 +882,7 @@ void func_80B11344(EnGb2* this, PlayState* play) { } static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_4, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 2200, ICHAIN_STOP), }; @@ -877,7 +898,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { this->actor.room = -1; Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &object_ps_Skel_007230, &object_ps_Anim_00049C, this->jointTable, - this->morphTable, 12); + this->morphTable, OBJECT_PS_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); @@ -915,7 +936,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { return; } - if (Flags_GetSwitch(play, ENGB2_GET_7F8(thisx))) { + if (Flags_GetSwitch(play, ENGB2_GET_SWITCH_FLAG(thisx))) { Actor_Kill(&this->actor); return; } @@ -929,7 +950,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { case ENGB2_7_2: this->csIdIndex = 0; this->csIdList[0] = this->actor.csId; - if (Flags_GetSwitch(play, ENGB2_GET_7F8(thisx))) { + if (Flags_GetSwitch(play, ENGB2_GET_SWITCH_FLAG(thisx))) { Actor_Kill(&this->actor); return; } @@ -943,7 +964,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_76_80)) { this->actor.draw = NULL; this->unk_26C |= 0x100; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80B111AC; } else { this->unk_28A = 255; @@ -981,11 +1002,11 @@ s32 EnGb2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Gfx** gfx) { EnGb2* this = THIS; - if (limbIndex == 7) { + if (limbIndex == OBJECT_PS_LIMB_07) { Matrix_RotateYS(this->unk_270.y, MTXMODE_APPLY); } - if (limbIndex == 1) { + if (limbIndex == OBJECT_PS_LIMB_01) { *dList = NULL; } @@ -996,7 +1017,7 @@ void EnGb2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnGb2* this = THIS; Vec3f sp18 = { 2400.0f, 0.0f, 0.0f }; - if (limbIndex == 7) { + if (limbIndex == OBJECT_PS_LIMB_07) { Matrix_MultVec3f(&sp18, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h index a257ab3d4..e59eecee0 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h @@ -2,13 +2,14 @@ #define Z_EN_GB2_H #include "global.h" +#include "objects/object_ps/object_ps.h" struct EnGb2; typedef void (*EnGb2ActionFunc)(struct EnGb2*, PlayState*); #define ENGB2_GET_7(thisx) ((thisx)->params & 7) -#define ENGB2_GET_7F8(thisx) (((thisx)->params & 0x7F8) >> 3) +#define ENGB2_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x7F8) >> 3) typedef enum { /* 0 */ ENGB2_7_0, @@ -19,8 +20,8 @@ typedef enum { typedef struct EnGb2 { /* 0x0000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[12]; - /* 0x1D0 */ Vec3s morphTable[12]; + /* 0x188 */ Vec3s jointTable[OBJECT_PS_LIMB_MAX]; + /* 0x1D0 */ Vec3s morphTable[OBJECT_PS_LIMB_MAX]; /* 0x218 */ EnGb2ActionFunc actionFunc; /* 0x21C */ ColliderCylinder collider; /* 0x268 */ Actor* unk_268; 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 c78f14048..c83305a8c 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -6,7 +6,7 @@ #include "z_en_ge1.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnGe1*)thisx) @@ -69,10 +69,11 @@ typedef enum { /* 6 */ GERUDO_WHITE_ANIM_EXCITED_CLAPPING, /* 7 */ GERUDO_WHITE_ANIM_SALUTE, /* 8 */ GERUDO_WHITE_ANIM_LEADING_BOAT, - /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY + /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY, + /* 10 */ GERUDO_WHITE_ANIM_MAX } GerudoWhiteAnimation; -void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames); +void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames); void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play); void EnGe1_Wait(EnGe1* this, PlayState* play); void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play); @@ -86,7 +87,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { 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; + this->picto.actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->picto.actor, 0.01f); this->animIndex = this->cueId = -1; // GERUDO_WHITE_ANIM_NONE this->stateFlags = 0; @@ -112,7 +113,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { 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; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; break; } @@ -127,8 +128,8 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) { - static AnimationHeader* sAnimations[] = { +void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames) { + static AnimationHeader* sAnimations[GERUDO_WHITE_ANIM_MAX] = { &gGerudoWhiteArmsFoldedAnim, // GERUDO_WHITE_ANIM_ARMS_FOLDED, &gGerudoWhiteUnfoldingArmsAnim, // GERUDO_WHITE_ANIM_UNFOLDING_ARMS &gGerudoWhiteStandingHeadBowedAnim, // GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, @@ -154,7 +155,7 @@ void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) { default: Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames); + Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames); break; } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index facc4def2..45d304aaf 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -6,7 +6,7 @@ #include "z_en_ge2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_80000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_80000000) #define THIS ((EnGe2*)thisx) @@ -97,7 +97,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->picto.actor.world.rot.x = this->picto.actor.shape.rot.x = 0; this->picto.actor.world.rot.z = this->picto.actor.shape.rot.z = 0; - this->picto.actor.targetMode = 6; + this->picto.actor.targetMode = TARGET_MODE_6; this->stateFlags = 0; this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; this->cueId = -1; @@ -119,7 +119,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { switch (GERUDO_PURPLE_GET_TYPE(&this->picto.actor)) { case GERUDO_PURPLE_TYPE_BOAT_SENTRY: Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, 0.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, 0.0f); this->actionFunc = EnGe2_GuardStationary; this->picto.actor.speed = 0.0f; this->picto.actor.uncullZoneForward = 4000.0f; @@ -185,7 +185,8 @@ s32 EnGe2_LookForPlayer(PlayState* play, Actor* actor, Vec3f* pos, s16 yaw, s16 return false; } - if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[7], &posResult, &outPoly, false)) { + if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly, + false)) { return false; } else { return true; @@ -342,18 +343,18 @@ s32 EnGe2_FollowPathWithoutGravity(EnGe2* this) { /* Action and helper functions */ void EnGe2_SpawnEffects(EnGe2* this, PlayState* play) { - static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f }; - static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; - static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 }; - static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 }; + static Vec3f sEffectVelocity = { 0.0f, -0.05f, 0.0f }; + static Vec3f sEffectAccel = { 0.0f, -0.025f, 0.0f }; + static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 0 }; + static Color_RGBA8 sEffectEnvColor = { 255, 150, 0, 0 }; s16 effectAngle = play->state.frames * 0x2800; Vec3f effectPos; effectPos.x = (Math_CosS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.x; effectPos.y = this->picto.actor.focus.pos.y + 10.0f; effectPos.z = (Math_SinS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.z; - EffectSsKirakira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor, - 1000, 16); + EffectSsKirakira_SpawnDispersed(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, + &sEffectEnvColor, 1000, 16); } void EnGe2_Scream(EnGe2* this) { @@ -395,7 +396,7 @@ void EnGe2_SetupCapturePlayer(EnGe2* this) { this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_CapturePlayer; Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); } void EnGe2_Charge(EnGe2* this, PlayState* play) { @@ -428,7 +429,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) { if (this->picto.actor.shape.rot.y == this->picto.actor.yawTowardsPlayer) { Animation_Change(&this->skelAnime, &gGerudoPurpleChargingAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleChargingAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleChargingAnim), ANIMMODE_LOOP, -8.0f); this->timer = 50; this->picto.actor.speed = 4.0f; this->actionFunc = EnGe2_Charge; @@ -437,7 +438,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) { void EnGe2_SetupLookAround(EnGe2* this) { Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); this->timer = 60; this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_LookAround; @@ -463,7 +464,7 @@ void EnGe2_KnockedOut(EnGe2* this, PlayState* play) { this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); this->stateFlags &= ~GERUDO_PURPLE_STATE_KO; - this->picto.actor.flags |= ACTOR_FLAG_1; + this->picto.actor.flags |= ACTOR_FLAG_TARGETABLE; } } @@ -478,27 +479,27 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 visionRange = gSaveContext.save.isNight ? 200.0f : 280.0f; - if (player->csMode == 0x1A) { + if (player->csMode == PLAYER_CSMODE_26) { this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_SetupCharge; Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); this->stateFlags |= GERUDO_PURPLE_STATE_CAPTURING; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_80_08)) { this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_TurnToPlayerFast; Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); } else if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos, this->picto.actor.shape.rot.y, 0x1800, visionRange, this->verticalDetectRange)) { if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { this->picto.actor.speed = 0.0f; - func_800B7298(play, &this->picto.actor, 0x1A); - func_801000A4(NA_SE_SY_FOUND); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + Lib_PlaySfx(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x1194, &this->picto.actor); this->actionFunc = EnGe2_SetupCharge; Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); } } else if (this->collider.base.acFlags & AC_HIT) { if ((this->collider.info.acHitInfo != NULL) && @@ -509,12 +510,12 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) { this->stateFlags |= GERUDO_PURPLE_STATE_STUNNED; } else { Animation_Change(&this->skelAnime, &gGerudoPurpleFallingToGroundAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), 2, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), ANIMMODE_ONCE, -8.0f); this->timer = 200; this->picto.actor.speed = 0.0f; this->actionFunc = EnGe2_KnockedOut; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->stateFlags |= GERUDO_PURPLE_STATE_KO; } } else if (this->picto.actor.home.rot.x == 0) { @@ -542,7 +543,7 @@ void EnGe2_LookAround(EnGe2* this, PlayState* play) { } else { this->actionFunc = EnGe2_Walk; Animation_Change(&this->skelAnime, &gGerudoPurpleWalkingAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), ANIMMODE_LOOP, -8.0f); this->headRot.y = 0; this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; } @@ -601,13 +602,14 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { switch (cueId) { case ENGE2_CUEID_BEEHIVE_PATROL: Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f); EnGe2_GetNextPath(this, play); break; case ENGE2_CUEID_BEEHIVE_RUN_AWAY: Animation_Change(&this->skelAnime, &gGerudoPurpleRunningAwayCutsceneAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), 0, -5.0f); + Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), ANIMMODE_LOOP, + -5.0f); this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); break; @@ -616,11 +618,13 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { break; case ENGE2_CUEID_GBT_ENTR_STAND_STILL: - Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f); + Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, + ANIMMODE_ONCE, 0.0f); break; case ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY: - Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, 2, 0.0f); + Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, + ANIMMODE_ONCE, 0.0f); EnGe2_SetupBlownAwayPath(this, play); this->stateFlags |= GERUDO_PURPLE_STATE_DISABLE_MOVEMENT; this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); @@ -678,8 +682,8 @@ void EnGe2_GuardStationary(EnGe2* this, PlayState* play) { if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos, this->picto.actor.shape.rot.y, 0x4000, 720.0f, this->verticalDetectRange)) { if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { - func_800B7298(play, &this->picto.actor, 0x1A); - func_801000A4(NA_SE_SY_FOUND); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + Lib_PlaySfx(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x1194, &this->picto.actor); this->timer = 50; EnGe2_SetupCapturePlayer(this); diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 1f680e9e8..21f207e7c 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -1,12 +1,12 @@ /* * File: z_en_ge3.c * Overlay: ovl_En_Ge3 - * Description: Aviel + * Description: Aviel, leader of the Gerudo Pirates */ #include "z_en_ge3.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_80000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_80000000) #define THIS ((EnGe3*)thisx) @@ -15,7 +15,26 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play); void EnGe3_Update(Actor* thisx, PlayState* play); void EnGe3_Draw(Actor* thisx, PlayState* play); -#if 0 +void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames); +void EnGe3_SetupPath(EnGe3* this, PlayState* play); +void EnGe3_Idle(EnGe3* this, PlayState* play); +void EnGe3_AveilsChamberIdle(EnGe3* this, PlayState* play); +s32 EnGe3_ValidatePictograph(PlayState* play, Actor* thisx); + +typedef enum GerudoAveilAnimation { + /* -1 */ GERUDO_AVEIL_ANIM_NONE = -1, + /* 0 */ GERUDO_AVEIL_ANIM_STAND, + /* 1 */ GERUDO_AVEIL_ANIM_WALK, + /* 2 */ GERUDO_AVEIL_ANIM_HAND_ON_HIP_WAIT, + /* 3 */ GERUDO_AVEIL_ANIM_TURN_HEAD, + /* 4 */ GERUDO_AVEIL_ANIM_WAIT, + /* 5 */ GERUDO_AVEIL_ANIM_DEMAND, + /* 6 */ GERUDO_AVEIL_ANIM_DISMISS, + /* 7 */ GERUDO_AVEIL_ANIM_BEG, + /* 8 */ GERUDO_AVEIL_ANIM_RUN_AWAY, + /* 9 */ GERUDO_AVEIL_ANIM_MAX +} GerudoAveilAnimation; + ActorInit En_Ge3_InitVars = { ACTOR_EN_GE3, ACTORCAT_NPC, @@ -28,49 +47,386 @@ ActorInit En_Ge3_InitVars = { (ActorFunc)EnGe3_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809A0DA0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x01000222, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x01000222, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 20, 50, 0, { 0, 0, 0 } }, }; -#endif +void EnGe3_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnGe3* this = THIS; -extern ColliderCylinderInit D_809A0DA0; + ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, + GERUDO_RED_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gGerudoRedHandOnHipWaitAnim); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); -extern UNK_TYPE D_0600A808; + this->animIndex = GERUDO_AVEIL_ANIM_NONE; + this->cueId = GERUDO_AVEIL_CUEID_NONE; + this->picto.validationFunc = EnGe3_ValidatePictograph; + EnGe3_SetupPath(this, play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/EnGe3_Init.s") + if (GERUDO_AVEIL_GET_TYPE(&this->picto.actor) == GERUDO_AVEIL_TYPE_AVEILS_CHAMBER) { + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_HAND_ON_HIP_WAIT, ANIMMODE_LOOP, 0.0f); + this->actionFunc = EnGe3_AveilsChamberIdle; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/EnGe3_Destroy.s") + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_83_02)) { + Actor_Kill(&this->picto.actor); + return; + } + } else { + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_WALK, ANIMMODE_LOOP, 0.0f); + this->actionFunc = EnGe3_Idle; + this->picto.actor.speed = 1.5f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A0070.s") + this->stateFlags = 0; + this->picto.actor.targetMode = 6; + this->picto.actor.terminalVelocity = -4.0f; + this->picto.actor.gravity = -1.0f; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_80_08); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A00F8.s") +void EnGe3_Destroy(Actor* thisx, PlayState* play) { + EnGe3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A020C.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A024C.s") +void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames) { + static AnimationHeader* sAnimations[GERUDO_AVEIL_ANIM_MAX] = { + &gGerudoRedStandAnim, // GERUDO_AVEIL_ANIM_STAND + &gGerudoRedWalkAnim, // GERUDO_AVEIL_ANIM_WALK + &gGerudoRedHandOnHipWaitAnim, // GERUDO_AVEIL_ANIM_HAND_ON_HIP_WAIT + &gGerudoRedTurnHeadAnim, // GERUDO_AVEIL_ANIM_TURN_HEAD + &gGerudoRedWaitAnim, // GERUDO_AVEIL_ANIM_WAIT + &gGerudoRedDemandAnim, // GERUDO_AVEIL_ANIM_DEMAND + &gGerudoRedDismissAnim, // GERUDO_AVEIL_ANIM_DISMISS + &gGerudoRedBegAnim, // GERUDO_AVEIL_ANIM_BEG + &gGerudoRedRunAwayAnim, // GERUDO_AVEIL_ANIM_RUN_AWAY + }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A0350.s") + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames); + this->animIndex = animIndex; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A03AC.s") +void EnGe3_LookAtPlayer(EnGe3* this, PlayState* play) { + s16 yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A03FC.s") + if ((ABS_ALT(yawDiff) <= 0x2300) && (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); + Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 0x1838, 0x64); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A04D0.s") +void EnGe3_SetupPath(EnGe3* this, PlayState* play) { + this->curPointIndex = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A0820.s") + if (GERUDO_AVEIL_GET_PATH(&this->picto.actor) != GERUDO_AVEIL_PATH_INDEX_NONE) { + this->path = &play->setupPathList[GERUDO_AVEIL_GET_PATH(&this->picto.actor)]; + } else { + this->path = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A08A4.s") +/** + * @return true if no path or reached end of path + */ +s32 EnGe3_FollowPath(EnGe3* this) { + Path* path = this->path; + Vec3s* curPoint; + f32 diffX; + f32 diffZ; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/EnGe3_Update.s") + if (path == NULL) { + return true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A096C.s") + curPoint = Lib_SegmentedToVirtual(path->points); + curPoint += this->curPointIndex; + diffX = curPoint->x - this->picto.actor.world.pos.x; + diffZ = curPoint->z - this->picto.actor.world.pos.z; + this->picto.actor.world.rot.y = Math_Atan2S(diffX, diffZ); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0x7D0, 0xC8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A0A14.s") + if ((SQ(diffX) + SQ(diffZ)) < SQ(10.0f)) { + this->curPointIndex++; + if (this->curPointIndex >= path->count) { + return true; + } + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/func_809A0C60.s") +void EnGe3_Scream(EnGe3* this) { + if ((s32)Rand_ZeroFloat(2.0f) == 0) { + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO00); + } else { + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO01); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge3/EnGe3_Draw.s") +void EnGe3_Idle(EnGe3* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnGe3_LookAtPlayer(this, play); + + if (EnGe3_FollowPath(this)) { + EnGe3_SetupPath(this, play); + } +} + +void EnGe3_ThrowPlayerOut(EnGe3* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x400, 0x100); + + if (this->actionTimer > 0) { + this->actionTimer--; + } else if (play->nextEntrance != play->setupExitList[GERUDO_AVEIL_GET_EXIT(&this->picto.actor)]) { + play->nextEntrance = play->setupExitList[GERUDO_AVEIL_GET_EXIT(&this->picto.actor)]; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_38; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_80_08); + } +} + +void EnGe3_AveilsChamberIdle(EnGe3* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime) && (this->cueId == GERUDO_AVEIL_CUEID_INSTRUCT)) { + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_WAIT, ANIMMODE_ONCE, 0.0f); + } + + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_108)) { + s16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_108)]->id; + + if (this->cueId != GERUDO_AVEIL_CUEID_BEEHIVE_RUN_AWAY) { + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_108)); + } + + if (this->cueId != cueId) { + this->cueId = cueId; + switch (this->cueId) { + // Both cutscenes + case GERUDO_AVEIL_CUEID_WAIT: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_HAND_ON_HIP_WAIT, ANIMMODE_LOOP, 0.0f); + break; + + // Instructing expedition leader cutscene + case GERUDO_AVEIL_CUEID_PAUSE: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_TURN_HEAD, ANIMMODE_ONCE, 0.0f); + this->skelAnime.playSpeed = 0.0f; + break; + + case GERUDO_AVEIL_CUEID_INSTRUCT: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_TURN_HEAD, ANIMMODE_ONCE, 0.0f); + break; + + case GERUDO_AVEIL_CUEID_DEMAND: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_DEMAND, ANIMMODE_LOOP, 0.0f); + break; + + case GERUDO_AVEIL_CUEID_DISMISS: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_DISMISS, ANIMMODE_ONCE, 0.0f); + break; + + case GERUDO_AVEIL_CUEID_BEG: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_BEG, ANIMMODE_LOOP, 0.0f); + break; + + // Fleeing from bees cutscene + case GERUDO_AVEIL_CUEID_BEEHIVE_RUN_AWAY: + EnGe3_ChangeAnim(this, GERUDO_AVEIL_ANIM_RUN_AWAY, ANIMMODE_LOOP, 0.0f); + this->picto.actor.speed = 5.0f; + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + break; + + case GERUDO_AVEIL_CUEID_BEEHIVE_VANISH: + Actor_Kill(&this->picto.actor); + break; + + default: + break; + } + + SkelAnime_Update(&this->skelAnime); + } + } else if ((this->picto.actor.xzDistToPlayer < 700.0f) && (fabsf(this->picto.actor.playerHeightRel) < 100.0f) && + !Play_InCsMode(play)) { + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_26); + Lib_PlaySfx(NA_SE_SY_FOUND); + + if (Player_GetMask(play) == PLAYER_MASK_STONE) { // Not fooled by Stone Mask + Message_StartTextbox(play, 0x11AF, &this->picto.actor); + } else { + Message_StartTextbox(play, 0x11AE, &this->picto.actor); + } + + this->actionFunc = EnGe3_ThrowPlayerOut; + this->actionTimer = 50; + SET_WEEKEVENTREG(WEEKEVENTREG_80_08); + } + + if (this->cueId == GERUDO_AVEIL_CUEID_BEEHIVE_RUN_AWAY) { + this->picto.actor.speed = 5.0f; + EnGe3_FollowPath(this); + + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe3_Scream(this); + } + } +} + +void EnGe3_UpdateColliderAndMove(Actor* thisx, PlayState* play) { + s32 pad; + EnGe3* this = THIS; + + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_MoveWithGravity(&this->picto.actor); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_4); +} + +void EnGe3_Blink(EnGe3* this, PlayState* play) { + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); + } + + this->eyeIndex = this->blinkTimer; + + if (this->eyeIndex >= 3) { + this->eyeIndex = 0; + } +} + +void EnGe3_Update(Actor* thisx, PlayState* play) { + EnGe3* this = THIS; + + EnGe3_UpdateColliderAndMove(&this->picto.actor, play); + this->actionFunc(this, play); + EnGe3_Blink(this, play); +} + +s32 EnGe3_ValidatePictograph(PlayState* play, Actor* thisx) { + s32 ret = Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 400.0f, -1); + + ret |= Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 1200.0f, -1); + + return ret; +} + +s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnGe3* this = THIS; + + switch (limbIndex) { + case GERUDO_RED_LIMB_VEIL: + case GERUDO_RED_LIMB_RIGHT_SWORD: + case GERUDO_RED_LIMB_LEFT_SWORD: + *dList = NULL; + return false; + + case GERUDO_RED_LIMB_HEAD: + rot->x += this->headRot.y; + // fallthrough + default: + // This is required since EnGe3 shares a skeleton with EnKaizoku; it avoids stale colours being used in the + // displaylists. + OPEN_DISPS(play->state.gfxCtx); + + switch (limbIndex) { + case GERUDO_RED_LIMB_NECK: + break; + + case GERUDO_RED_LIMB_HEAD: + gDPPipeSync(POLY_OPA_DISP++); + gDPSetEnvColor(POLY_OPA_DISP++, 80, 60, 10, 255); + break; + + case GERUDO_RED_LIMB_RIGHT_SWORD: + case GERUDO_RED_LIMB_LEFT_SWORD: + gDPPipeSync(POLY_OPA_DISP++); + gDPSetEnvColor(POLY_OPA_DISP++, 140, 170, 230, 255); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + break; + + default: + gDPPipeSync(POLY_OPA_DISP++); + gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); + break; + } + + CLOSE_DISPS(play->state.gfxCtx); + + if (this->animIndex == GERUDO_AVEIL_ANIM_HAND_ON_HIP_WAIT) { + // Fidget + if ((limbIndex == GERUDO_RED_LIMB_RIGHT_FOREARM) || (limbIndex == GERUDO_RED_LIMB_LEFT_FOREARM) || + (limbIndex == GERUDO_RED_LIMB_TORSO)) { + s32 temp = limbIndex * 50; + + // required to match + rot->y = rot->y + (s32)(Math_SinS(play->state.frames * (temp + 0x814)) * 200.0f); + rot->z = rot->z + (s32)(Math_CosS(play->state.frames * (temp + 0x940)) * 200.0f); + } + } + break; + } + return false; +} + +void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnGe3* this = THIS; + Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f }; + + if (limbIndex == GERUDO_RED_LIMB_HEAD) { + Matrix_MultVec3f(&sFocusOffset, &this->picto.actor.focus.pos); + } +} + +void EnGe3_Draw(Actor* thisx, PlayState* play) { + static TexturePtr sEyeTextures[] = { + gGerudoRedEyeOpenTex, + gGerudoRedEyeHalfTex, + gGerudoRedEyeClosedTex, + }; + s32 pad; + EnGe3* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL37_Opa(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); + func_800B8050(&this->picto.actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGe3_OverrideLimbDraw, EnGe3_PostLimbDraw, &this->picto.actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index 909ed7599..f2611e408 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -2,14 +2,54 @@ #define Z_EN_GE3_H #include "global.h" +#include "z64snap.h" +#include "objects/object_geldb/object_geldb.h" struct EnGe3; typedef void (*EnGe3ActionFunc)(struct EnGe3*, PlayState*); +#define GERUDO_AVEIL_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) +#define GERUDO_AVEIL_GET_EXIT(thisx) (((thisx)->params & 0x1F0) >> 4) +#define GERUDO_AVEIL_GET_TYPE(thisx) ((thisx)->params & 1) + +#define GERUDO_AVEIL_PATH_INDEX_NONE 0x3F + +typedef enum GerudoAveilType { + /* 0 */ GERUDO_AVEIL_TYPE_0, // Unused, just walks forwards + /* 1 */ GERUDO_AVEIL_TYPE_AVEILS_CHAMBER +} GerudoAveilType; + +typedef enum GerudoAveilCueId { + /* -1 */ GERUDO_AVEIL_CUEID_NONE = -1, + /* 0 */ GERUDO_AVEIL_CUEID_0, // Unused + /* 1 */ GERUDO_AVEIL_CUEID_WAIT, + /* 2 */ GERUDO_AVEIL_CUEID_PAUSE, + /* 3 */ GERUDO_AVEIL_CUEID_INSTRUCT, + /* 4 */ GERUDO_AVEIL_CUEID_DEMAND, + /* 5 */ GERUDO_AVEIL_CUEID_DISMISS, + /* 6 */ GERUDO_AVEIL_CUEID_BEG, + /* 7 */ GERUDO_AVEIL_CUEID_BEEHIVE_RUN_AWAY, + /* 8 */ GERUDO_AVEIL_CUEID_BEEHIVE_VANISH +} GerudoAveilCueId; + typedef struct EnGe3 { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x1D8]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ ColliderCylinder collider; + /* 0x194 */ SkelAnime skelAnime; + /* 0x1D8 */ Vec3s jointTable[GERUDO_RED_LIMB_MAX]; + /* 0x268 */ Vec3s morphTable[GERUDO_RED_LIMB_MAX]; + /* 0x2F8 */ s16 eyeIndex; + /* 0x2FA */ s16 blinkTimer; + /* 0x2FC */ Path* path; + /* 0x300 */ s32 curPointIndex; + /* 0x304 */ Vec3s headRot; + /* 0x30A */ Vec3s torsoRot; + /* 0x310 */ s16 stateFlags; // Set and not used, named based on OoT use + /* 0x312 */ s16 animIndex; + /* 0x314 */ s16 cueId; + /* 0x316 */ s16 actionTimer; + /* 0x318 */ s16 screamTimer; /* 0x31C */ EnGe3ActionFunc actionFunc; } EnGe3; // size = 0x320 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 6621ecc93..10c8b5037 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -7,12 +7,11 @@ #include "z_en_geg.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_oF1d_map/object_oF1d_map.h" #include "objects/object_taisou/object_taisou.h" #include "objects/object_hakugin_demo/object_hakugin_demo.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnGeg*)thisx) @@ -126,68 +125,112 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -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 }, - { &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +typedef enum { + /* -1 */ ENGEG_ANIM_NONE = -1, + /* 0x00 */ ENGEG_ANIM_0, + /* 0x01 */ ENGEG_ANIM_1, + /* 0x02 */ ENGEG_ANIM_2, + /* 0x03 */ ENGEG_ANIM_3, + /* 0x04 */ ENGEG_ANIM_4, + /* 0x05 */ ENGEG_ANIM_5, + /* 0x06 */ ENGEG_ANIM_6, + /* 0x07 */ ENGEG_ANIM_7, + /* 0x08 */ ENGEG_ANIM_8, + /* 0x09 */ ENGEG_ANIM_9, + /* 0x0A */ ENGEG_ANIM_10, + /* 0x0B */ ENGEG_ANIM_11, + /* 0x0C */ ENGEG_ANIM_12, + /* 0x0D */ ENGEG_ANIM_13, + /* 0x0E */ ENGEG_ANIM_14, + /* 0x0F */ ENGEG_ANIM_15, + /* 0x10 */ ENGEG_ANIM_16, + /* 0x11 */ ENGEG_ANIM_17, + /* 0x12 */ ENGEG_ANIM_18, + /* 0x13 */ ENGEG_ANIM_19, + /* 0x14 */ ENGEG_ANIM_20, + /* 0x15 */ ENGEG_ANIM_MAX +} EnGegAnimation; + +static AnimationInfoS sAnimationInfo[ENGEG_ANIM_MAX] = { + { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_0 + { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_1 + { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_2 + { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_3 + { &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_4 + { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_5 + { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_6 + { &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_7 + { &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_8 + { &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_9 + { &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_10 + { &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_11 + { &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_12 + { &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_13 + { &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_14 + { &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_15 + { &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_16 + { &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_17 + { &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_18 + { &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_19 + { &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_20 }; u16 func_80BB16D0(EnGeg* this) { switch (this->unk_496) { case 0xD5E: return 0xD5F; + case 0xD5F: return 0xD60; + case 0xD60: return 0xD61; + case 0xD62: return 0xD63; + case 0xD64: return 0xD65; + case 0xD66: return 0xD67; + case 0xD67: return 0xD68; + case 0xD68: return 0xD69; + case 0xD6A: return 0xD6B; + case 0xD6B: return 0xD6C; + case 0xD6C: return 0xD6D; + case 0xD6E: return 0xD6F; + case 0xD70: return 0xD71; + case 0xD71: return 0xD72; + case 0xD73: return 0xD74; + case 0xD74: return 0xD75; + case 0xD89: return 0xD8A; + + default: + return 0; } - return 0; } void func_80BB178C(EnGeg* this, PlayState* play) { @@ -372,14 +415,14 @@ s32 func_80BB1D64(EnGeg* this, PlayState* play) { return true; } -void func_80BB1FCC(EnGeg* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment); +void EnGeg_UpdateSkelAnime(EnGeg* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); SkelAnime_Update(&this->skelAnime); } -void func_80BB2020(EnGeg* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_4AC); +void EnGeg_ChangeAnim(EnGeg* this, PlayState* play) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } s32 func_80BB2088(EnGeg* this, PlayState* play) { @@ -393,7 +436,7 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) { } if (Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7FF8) && - ((this->unk_4AC == 5) || ((this->unk_4AC == 13) && (this->unk_496 == 0xD69)))) { + ((this->animIndex == ENGEG_ANIM_5) || ((this->animIndex == ENGEG_ANIM_13) && (this->unk_496 == 0xD69)))) { this->unk_230 |= 2; func_80BB1D64(this, play); } else { @@ -411,16 +454,16 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) { } void func_80BB217C(EnGeg* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->unk_248)) { - this->unk_4AC = 5; - func_80BB2020(this, play); + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->animIndex = ENGEG_ANIM_5; + EnGeg_ChangeAnim(this, play); Actor_SetScale(&this->actor, 0.01f); this->unk_230 = 0; this->actor.shape.shadowScale = 20.0f; this->actor.gravity = -1.0f; func_80BB1C1C(this); this->actionFunc = func_80BB221C; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; } } @@ -449,7 +492,7 @@ void func_80BB221C(EnGeg* this, PlayState* play) { } else if (this->actor.xzDistToPlayer < 300.0f) { this->unk_230 |= 4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } else { this->unk_230 &= ~4; @@ -459,8 +502,8 @@ void func_80BB221C(EnGeg* this, PlayState* play) { Message_StartTextbox(play, this->unk_496, &this->actor); this->unk_230 &= ~8; this->actionFunc = func_80BB27D4; - } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 300.0f); + } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 300.0f); this->unk_230 |= 8; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { @@ -473,7 +516,7 @@ void func_80BB221C(EnGeg* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); this->unk_230 |= 8; } } @@ -507,10 +550,10 @@ void func_80BB2520(EnGeg* this, PlayState* play) { break; case 0xD66: - this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); - if (this->unk_248 >= 0) { - this->unk_4AC = 19; - func_80BB2020(this, play); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); + if (this->objectSlot > OBJECT_SLOT_NONE) { + this->animIndex = ENGEG_ANIM_19; + EnGeg_ChangeAnim(this, play); } this->unk_230 |= 0x20; this->actionFunc = func_80BB2944; @@ -525,13 +568,16 @@ void func_80BB2520(EnGeg* this, PlayState* play) { case 0xD72: case 0xD75: case 0xD8B: - this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); - if (this->unk_248 >= 0) { - this->unk_4AC = 4; - func_80BB2020(this, play); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); + if (this->objectSlot > OBJECT_SLOT_NONE) { + this->animIndex = ENGEG_ANIM_4; + EnGeg_ChangeAnim(this, play); } this->actionFunc = func_80BB2E00; break; + + default: + break; } } else { if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { @@ -552,11 +598,14 @@ void func_80BB26EC(EnGeg* this, PlayState* play) { case 0xD61: CutsceneManager_Stop(this->csId); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; this->actionFunc = func_80BB221C; return; + + default: + break; } this->unk_496 = func_80BB16D0(this); @@ -568,14 +617,14 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD63: - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB221C; break; case 0xD69: this->nextCsId = this->csIdList[6]; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB2520; break; @@ -583,7 +632,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { case 0xD6D: case 0xD6F: case 0xD8A: - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB31B8; break; @@ -591,7 +640,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { case 0xD72: case 0xD75: case 0xD8B: - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; this->nextCsId = this->csIdList[7]; @@ -609,16 +658,16 @@ 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(sAnimationInfo[this->unk_4AC].animation); + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (this->unk_4AC == 19) { - if (curFrame == lastFrame) { - this->unk_4AC = 6; - func_80BB2020(this, play); + if (this->animIndex == ENGEG_ANIM_19) { + if (curFrame == endFrame) { + this->animIndex = ENGEG_ANIM_6; + EnGeg_ChangeAnim(this, play); } } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD67) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->nextCsId = this->csIdList[4]; this->actionFunc = func_80BB2520; @@ -635,7 +684,7 @@ void func_80BB2A54(EnGeg* this, PlayState* play) { CutsceneManager_Stop(this->csId); this->unk_230 &= ~0x10; this->unk_244 = 65; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB347C; } else { @@ -664,10 +713,10 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->unk_496 = 0xD68; Message_ContinueTextbox(play, this->unk_496); - this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); - if (this->unk_248 >= 0) { - this->unk_4AC = 13; - func_80BB2020(this, play); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_TAISOU); + if (this->objectSlot > OBJECT_SLOT_NONE) { + this->animIndex = ENGEG_ANIM_13; + EnGeg_ChangeAnim(this, play); } this->actionFunc = func_80BB27D4; } else { @@ -700,25 +749,25 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { this->unk_4E0--; } AudioSfx_LowerSfxSettingsReverb(&this->actor.projectedPos, true); - func_8019F4AC(&this->actor.projectedPos, NA_SE_EN_GOLON_SIRLOIN_EAT - SFX_FLAG); + Audio_PlaySfx_WithSfxSettingsReverb(&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(sAnimationInfo[this->unk_4AC].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (this->unk_4AC == 2) { + if (this->animIndex == ENGEG_ANIM_2) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (sp2E == sp2C) { + if (curFrame == endFrame) { CutsceneManager_Stop(this->csId); - this->unk_4AC = 20; - func_80BB2020(this, play); + this->animIndex = ENGEG_ANIM_20; + EnGeg_ChangeAnim(this, play); this->actionFunc = func_80BB30B4; } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_STAND_IMT); } - } else if (this->unk_4AC == 4) { + } else if (this->animIndex == ENGEG_ANIM_4) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { this->unk_230 |= 1; this->actor.shape.yOffset = 14.0f; @@ -740,11 +789,11 @@ void func_80BB2F7C(EnGeg* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 150.0f) && (fabsf(this->actor.playerHeightRel) < 10.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->unk_4AC = 2; + this->animIndex = ENGEG_ANIM_2; this->actor.speed = 0.0f; this->unk_230 &= ~1; this->actor.shape.yOffset = 0.0f; - func_80BB2020(this, play); + EnGeg_ChangeAnim(this, play); this->actionFunc = func_80BB2E00; } else { this->actor.speed = 5.0f; @@ -753,7 +802,7 @@ void func_80BB2F7C(EnGeg* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_230 & 0x80) { - func_800B9010(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); } else { this->unk_230 |= 0x80; Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); @@ -777,7 +826,7 @@ void func_80BB30B4(EnGeg* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer < 150.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); } } @@ -813,7 +862,7 @@ void func_80BB32AC(EnGeg* this, PlayState* play) { Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB27D4; } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -845,7 +894,7 @@ void func_80BB3318(EnGeg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - func_800B9010(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); } void func_80BB347C(EnGeg* this, PlayState* play) { @@ -877,8 +926,8 @@ void EnGeg_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.update != NULL) { - this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); - if (this->unk_248 < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); } } @@ -902,10 +951,10 @@ void EnGeg_Update(Actor* thisx, PlayState* play) { EnGeg* this = THIS; this->actionFunc(this, play); - func_80BB1FCC(this, play); + EnGeg_UpdateSkelAnime(this, play); func_80BB2088(this, play); func_80BB1C8C(this); - SubS_FillLimbRotTables(play, this->unk_238, this->unk_232, ARRAY_COUNT(this->unk_238)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGEG_FIDGET_TABLE_LEN); func_80BB1D04(this); func_80BB178C(this, play); } diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.h b/src/overlays/actors/ovl_En_Geg/z_en_geg.h index 71639bdac..5d2990a09 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.h +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.h @@ -2,11 +2,14 @@ #define Z_EN_GEG_H #include "global.h" +#include "objects/object_oF1d_map/object_oF1d_map.h" struct EnGeg; typedef void (*EnGegActionFunc)(struct EnGeg*, PlayState*); +#define ENGEG_FIDGET_TABLE_LEN 3 + typedef struct EnGeg { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -14,15 +17,15 @@ typedef struct EnGeg { /* 0x18C */ ColliderCylinder colliderCylinder; /* 0x1D8 */ ColliderSphere colliderSphere; /* 0x230 */ u16 unk_230; - /* 0x232 */ s16 unk_232[3]; - /* 0x238 */ s16 unk_238[3]; + /* 0x232 */ s16 fidgetTableZ[ENGEG_FIDGET_TABLE_LEN]; + /* 0x238 */ s16 fidgetTableY[ENGEG_FIDGET_TABLE_LEN]; /* 0x23E */ s16 unk_23E; /* 0x240 */ s16 unk_240; /* 0x242 */ s16 unk_242; /* 0x244 */ s16 unk_244; - /* 0x248 */ s32 unk_248; - /* 0x24C */ Vec3s jointTable[18]; - /* 0x2B8 */ Vec3s morphTable[18]; + /* 0x248 */ s32 objectSlot; + /* 0x24C */ Vec3s jointTable[GORON_LIMB_MAX]; + /* 0x2B8 */ Vec3s morphTable[GORON_LIMB_MAX]; /* 0x324 */ UNK_TYPE1 unk324[0x144]; /* 0x468 */ s16 unk_468; /* 0x46A */ s16 unk_46A; @@ -36,7 +39,7 @@ typedef struct EnGeg { /* 0x498 */ s16 csId; /* 0x49A */ s16 nextCsId; /* 0x49C */ s16 csIdList[8]; - /* 0x4AC */ s32 unk_4AC; + /* 0x4AC */ s32 animIndex; /* 0x4B0 */ s16 unk_4B0; /* 0x4B4 */ Vec3f unk_4B4; /* 0x4C0 */ Vec3f unk_4C0[2]; 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 e9e37ddb4..5a0f0f3f2 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -6,9 +6,8 @@ #include "z_en_gg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_gg/object_gg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnGg*)thisx) @@ -95,15 +94,44 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -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 }, - { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, - { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f }, - { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f }, - { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, - { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f }, +typedef enum { + /* -1 */ ENGG_ANIM_NONE = -1, + /* 0x00 */ ENGG_ANIM_0, + /* 0x01 */ ENGG_ANIM_1, + /* 0x02 */ ENGG_ANIM_2, + /* 0x03 */ ENGG_ANIM_3, + /* 0x04 */ ENGG_ANIM_4, + /* 0x05 */ ENGG_ANIM_5, + /* 0x06 */ ENGG_ANIM_6, + /* 0x07 */ ENGG_ANIM_7, + /* 0x08 */ ENGG_ANIM_8, + /* 0x09 */ ENGG_ANIM_9, + /* 0x0A */ ENGG_ANIM_10, + /* 0x0B */ ENGG_ANIM_11, + /* 0x0C */ ENGG_ANIM_12, + /* 0x0D */ ENGG_ANIM_13, + /* 0x0E */ ENGG_ANIM_14, + /* 0x0F */ ENGG_ANIM_15, + /* 0x10 */ ENGG_ANIM_MAX +} EnGgAnimation; + +static AnimationInfo sAnimationInfo[ENGG_ANIM_MAX] = { + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_0 + { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_1 + { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_2 + { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_3 + { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_4 + { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_5 + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_6 + { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_7 + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_8 + { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_9 + { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_10 + { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_11 + { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_12 + { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_13 + { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_14 + { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_15 }; void func_80B34F70(EnGg* this) { @@ -149,7 +177,7 @@ void func_80B35108(EnGg* this, PlayState* play) { } void func_80B351A4(EnGg* this) { - if ((this->unk_2E6 == 2) || (this->unk_2E6 == 3)) { + if ((this->animIndex == ENGG_ANIM_2) || (this->animIndex == ENGG_ANIM_3)) { this->unk_2E2 = 3; } else { s16 temp = this->unk_2E4 - 1; @@ -170,57 +198,57 @@ void func_80B351A4(EnGg* this) { void func_80B35250(EnGg* this) { this->unk_2E4 = 20; this->unk_2E2 = 0; - this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + this->animIndex = ENGG_ANIM_0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0); this->actionFunc = func_80B35450; } void func_80B352A4(EnGg* this, PlayState* play) { - s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E6].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (sp26 == lastFrame) { + if (curFrame == endFrame) { switch (this->actor.textId) { case 0xCE5: - this->unk_2E6 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + this->animIndex = ENGG_ANIM_1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_1); break; case 0xCE6: case 0xCEC: - this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + this->animIndex = ENGG_ANIM_0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0); break; case 0xCE8: - this->unk_2E6 = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + this->animIndex = ENGG_ANIM_2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_2); break; case 0xCE9: - this->unk_2E6 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + this->animIndex = ENGG_ANIM_3; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_3); break; case 0xCED: case 0xCEE: - this->unk_2E6 = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + this->animIndex = ENGG_ANIM_4; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4); break; default: - this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + this->animIndex = ENGG_ANIM_0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0); break; } SET_WEEKEVENTREG(WEEKEVENTREG_19_80); this->actionFunc = func_80B3556C; - } else if ((this->unk_2E6 == 0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) { - if (sp26 < (lastFrame - 1)) { + } else if ((this->animIndex == ENGG_ANIM_0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) { + if (curFrame < (endFrame - 1)) { this->skelAnime.playSpeed = 2.0f; } else { - this->unk_2E6 = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + this->animIndex = ENGG_ANIM_4; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4); } } } @@ -238,10 +266,10 @@ void func_80B35450(EnGg* this, PlayState* play) { this->actionFunc = func_80B352A4; } else if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 50.0f)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->actor.textId = 0xCEE; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->actor.textId = 0xCE5; } } @@ -249,8 +277,8 @@ void func_80B35450(EnGg* this, PlayState* play) { void func_80B3556C(EnGg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - if (this->unk_2E6 == 4) { - play->msgCtx.msgMode = 0x43; + if (this->animIndex == ENGG_ANIM_4) { + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_308 = 0; this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; @@ -275,47 +303,43 @@ void func_80B35634(EnGg* this, PlayState* play) { switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->unk_2DA = 0; - this->unk_2E6 = 0; + this->csAnimIndex = ENGG_ANIM_0; + this->animIndex = ENGG_ANIM_0; break; case 2: - this->unk_2DA = 9; - this->unk_2E6 = 9; + this->csAnimIndex = ENGG_ANIM_9; + this->animIndex = ENGG_ANIM_9; break; case 3: - this->unk_2DA = 10; - this->unk_2E6 = 10; + this->csAnimIndex = ENGG_ANIM_10; + this->animIndex = ENGG_ANIM_10; break; case 4: - do { - this->unk_344.unk_30 = this->unk_2DA = 11; - } while (0); - this->unk_2E6 = 11; + this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_11; + this->animIndex = ENGG_ANIM_11; func_80B364D4(&this->unk_344, play); break; case 5: - do { - this->unk_344.unk_30 = this->unk_2DA = 12; - } while (0); - this->unk_2E6 = 12; + this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_12; + //! FAKE: + if (1) {} + this->animIndex = ENGG_ANIM_12; break; case 6: - do { - this->unk_344.unk_30 = this->unk_2DA = 13; - } while (0); - this->unk_2E6 = 13; + this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_13; + //! FAKE: + if (1) {} + this->animIndex = ENGG_ANIM_13; break; case 7: - do { - this->unk_344.unk_30 = this->unk_2DA = 14; - } while (0); - this->unk_2E6 = 14; + this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_14; + this->animIndex = ENGG_ANIM_14; func_80B364D4(&this->unk_344, play); break; @@ -324,13 +348,13 @@ void func_80B35634(EnGg* this, PlayState* play) { return; default: - this->unk_2DA = 0; + this->csAnimIndex = ENGG_ANIM_0; break; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2DA); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex); } - if (this->unk_2DA == 14) { + if (this->csAnimIndex == ENGG_ANIM_14) { func_80B358D8(this, play); } @@ -345,16 +369,22 @@ u16 func_80B357F0(EnGg* this) { switch (this->actor.textId) { case 0xCE5: return 0xCE6; + case 0xCE6: return 0xCE8; + case 0xCE8: return 0xCE9; + case 0xCE9: return 0xCEC; + case 0xCEC: return 0xCED; + + default: + return 0; } - return 0; } void func_80B3584C(EnGg* this) { @@ -366,12 +396,12 @@ void func_80B3584C(EnGg* this) { } void func_80B358D8(EnGg* this, PlayState* play) { - s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2DA].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation); - if ((this->unk_2E6 == 14) && (sp1E == lastFrame)) { - this->unk_2E6 = 15; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 15); + if ((this->animIndex == ENGG_ANIM_14) && (curFrame == endFrame)) { + this->animIndex = ENGG_ANIM_15; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_15); } } @@ -379,8 +409,8 @@ void func_80B35968(EnGg* this, PlayState* play) { if (this->unk_344.unk_34 != NULL) { this->unk_344.unk_34(&this->unk_344, play); } else { - if ((this->unk_2DA == 11) || (this->unk_2DA == 14)) { - this->unk_344.unk_30 = this->unk_2DA; + if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_14)) { + this->unk_344.animIndex = this->csAnimIndex; } func_80B363E8(&this->unk_344, play, &this->unk_320, &this->unk_32C, &this->unk_338); } @@ -393,13 +423,13 @@ void func_80B359DC(EnGg* this, PlayState* play) { if (this->unk_306 == 0) { if (player->stateFlags2 & PLAYER_STATE2_8000000) { this->unk_306 = 1; - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } } else if (!(player->stateFlags2 & PLAYER_STATE2_8000000)) { this->unk_306 = 0; } - if ((player->transformation == PLAYER_FORM_HUMAN) && (play->msgCtx.ocarinaMode == 3) && + if ((player->transformation == PLAYER_FORM_HUMAN) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { SET_WEEKEVENTREG(WEEKEVENTREG_19_80); @@ -433,7 +463,7 @@ void func_80B35B24(EnGgStruct* ptr, PlayState* play) { } void func_80B35B44(EnGgStruct* ptr, PlayState* play) { - if (ptr->unk_30 == 0xE) { + if (ptr->animIndex == ENGG_ANIM_14) { ptr->unk_40++; if (ptr->unk_40 > 0x46) { ptr->unk_48 = 1; @@ -455,13 +485,13 @@ void func_80B35B44(EnGgStruct* ptr, PlayState* play) { ptr->unk_44 = 0x37; } } - } else if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12)) { + } else if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12)) { ptr->unk_40++; if (ptr->unk_40 > 0x46) { ptr->unk_48 = 1; ptr->unk_40 = 0; } - } else if (ptr->unk_30 == 0xD) { + } else if (ptr->animIndex == ENGG_ANIM_13) { ptr->unk_48 = 0; ptr->unk_40++; if (ptr->unk_40 > 0x46) { @@ -496,7 +526,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) { sp74 = ptr->unk_40 % temp; ptr->unk_40 = sp74; phi_s7 = 0x46; - } else if (ptr->unk_30 == 0xD) { + } else if (ptr->animIndex == ENGG_ANIM_13) { sp74 = ptr->unk_40; phi_s7 = 0x46; } else { @@ -519,6 +549,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) { temp_f26 = ptr->unk_00.z + (ptr->unk_18.z * temp_f20) + (0.5f * ptr->unk_24.z * temp_f20 * temp_f20); temp_f20 = Rand_ZeroOne() * 0.003f; + //! FAKE: if (1) {} Matrix_Translate(temp_f22, temp_f24, temp_f26, MTXMODE_NEW); @@ -630,9 +661,9 @@ void func_80B363E8(EnGgStruct* ptr, PlayState* play, Vec3f* arg1, Vec3f* arg2, V ptr->unk_00.x += -4.0f; ptr->unk_0C.x += 4.0f; - if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12) || (ptr->unk_30 == 13)) { + if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12) || (ptr->animIndex == ENGG_ANIM_13)) { ptr->unk_38 = func_80B35C84; - } else if (ptr->unk_30 == 14) { + } else if (ptr->animIndex == ENGG_ANIM_14) { ptr->unk_38 = func_80B3610C; } } @@ -655,7 +686,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, - this->morphTable, 20); + this->morphTable, OBJECT_GG_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -685,26 +716,28 @@ void EnGg_Update(Actor* thisx, PlayState* play) { if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } else { this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { if (play->csCtx.state == CS_STATE_IDLE) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } else { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } if ((play->csCtx.state == CS_STATE_IDLE) && - ((this->unk_2DA != 14) && (this->unk_2DA != 11) && (this->unk_2DA != 12) && (this->unk_2DA != 13))) { + ((this->csAnimIndex != ENGG_ANIM_14) && (this->csAnimIndex != ENGG_ANIM_11) && + (this->csAnimIndex != ENGG_ANIM_12) && (this->csAnimIndex != ENGG_ANIM_13))) { func_80B364D4(&this->unk_344, play); } - if (((this->unk_2DA == 14) || (this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) && + if (((this->csAnimIndex == ENGG_ANIM_14) || (this->csAnimIndex == ENGG_ANIM_11) || + (this->csAnimIndex == ENGG_ANIM_12) || (this->csAnimIndex == ENGG_ANIM_13)) && (this->unk_309 == 1)) { func_80B35968(this, play); } @@ -738,7 +771,7 @@ s32 EnGg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po Gfx** gfx) { EnGg* this = THIS; - if (limbIndex == 2) { + if (limbIndex == OBJECT_GG_LIMB_02) { Matrix_RotateZS(this->unk_2E8, MTXMODE_APPLY); } return false; @@ -750,12 +783,13 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp30 = { 0.0f, 0.0f, 0.0f }; Vec3f sp24 = { 0.0f, 0.0f, 0.0f }; - if (this->unk_2DA == 14) { + if (this->csAnimIndex == ENGG_ANIM_14) { sp30.y = 3.0f; sp30.z = -1.0f; sp24.y = -0.07f; this->unk_309 = 1; - } else if ((this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) { + } else if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_12) || + (this->csAnimIndex == ENGG_ANIM_13)) { sp30.x = 3.0f; sp24.x = 0.5f; this->unk_309 = 1; @@ -763,7 +797,7 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->unk_309 = 0; } - if (limbIndex == 4) { + if (limbIndex == OBJECT_GG_LIMB_04) { Matrix_MultVec3f(&D_80B36DF0, &this->unk_320); Matrix_Push(); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.h b/src/overlays/actors/ovl_En_Gg/z_en_gg.h index 802024897..436d5a4ab 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.h +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.h @@ -2,6 +2,7 @@ #define Z_EN_GG_H #include "global.h" +#include "objects/object_gg/object_gg.h" struct EnGg; struct EnGgStruct; @@ -14,7 +15,7 @@ typedef struct EnGgStruct { /* 0x0C */ Vec3f unk_0C; /* 0x18 */ Vec3f unk_18; /* 0x24 */ Vec3f unk_24; - /* 0x30 */ u8 unk_30; + /* 0x30 */ u8 animIndex; /* 0x34 */ EnGgUnkFunc unk_34; /* 0x38 */ EnGgUnkFunc unk_38; /* 0x3C */ s32 unk_3C; @@ -30,16 +31,16 @@ typedef struct EnGg { /* 0x1D4 */ EnGgActionFunc actionFunc; /* 0x1D8 */ Vec3s unk_1D8; /* 0x1DE */ Vec3s unk_1DE; - /* 0x1E4 */ Vec3s jointTable[20]; - /* 0x25C */ Vec3s morphTable[20]; + /* 0x1E4 */ Vec3s jointTable[OBJECT_GG_LIMB_MAX]; + /* 0x25C */ Vec3s morphTable[OBJECT_GG_LIMB_MAX]; /* 0x2D4 */ UNK_TYPE1 unk_2D4[0x6]; - /* 0x2DA */ u8 unk_2DA; + /* 0x2DA */ u8 csAnimIndex; /* 0x2DB */ u8 cueId; /* 0x2DC */ s16 csId; /* 0x2DE */ UNK_TYPE1 unk2DE[4]; /* 0x2E2 */ s16 unk_2E2; /* 0x2E4 */ s16 unk_2E4; - /* 0x2E6 */ s16 unk_2E6; + /* 0x2E6 */ s16 animIndex; /* 0x2E8 */ s16 unk_2E8; /* 0x2EA */ UNK_TYPE1 unk2EA[0x1A]; /* 0x304 */ s16 unk_304; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 3540b1a24..3b6d62775 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -5,9 +5,8 @@ */ #include "z_en_gg2.h" -#include "objects/object_gg/object_gg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnGg2*)thisx) @@ -39,15 +38,44 @@ ActorInit En_Gg2_InitVars = { (ActorFunc)EnGg2_Draw, }; -AnimationInfo D_80B3BF00[] = { - { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f }, - { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f }, - { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, - { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, - { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f }, - { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f }, - { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, - { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f }, +typedef enum { + /* -1 */ ENGG2_ANIM_NONE = -1, + /* 0x00 */ ENGG2_ANIM_0, + /* 0x01 */ ENGG2_ANIM_1, + /* 0x02 */ ENGG2_ANIM_2, + /* 0x03 */ ENGG2_ANIM_3, + /* 0x04 */ ENGG2_ANIM_4, + /* 0x05 */ ENGG2_ANIM_5, + /* 0x06 */ ENGG2_ANIM_6, + /* 0x07 */ ENGG2_ANIM_7, + /* 0x08 */ ENGG2_ANIM_8, + /* 0x09 */ ENGG2_ANIM_9, + /* 0x0A */ ENGG2_ANIM_10, + /* 0x0B */ ENGG2_ANIM_11, + /* 0x0C */ ENGG2_ANIM_12, + /* 0x0D */ ENGG2_ANIM_13, + /* 0x0E */ ENGG2_ANIM_14, + /* 0x0F */ ENGG2_ANIM_15, + /* 0x10 */ ENGG2_ANIM_MAX +} EnGg2Animation; + +static AnimationInfo sAnimationInfo[ENGG2_ANIM_MAX] = { + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_0 + { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_1 + { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_2 + { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_3 + { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_4 + { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_5 + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_6 + { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_7 + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_8 + { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_9 + { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_10 + { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_11 + { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_12 + { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_13 + { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_14 + { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_15 }; Color_RGBA8 D_80B3C080 = { 255, 255, 255, 255 }; @@ -116,38 +144,38 @@ void func_80B3ADD8(EnGg2* this) { void func_80B3AE60(EnGg2* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(D_80B3BF00[this->unk_2EE].animation); + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (curFrame == lastFrame) { - switch (this->unk_2EE) { - case 0: - this->unk_2EE = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 1); + if (curFrame == endFrame) { + switch (this->animIndex) { + case ENGG2_ANIM_0: + this->animIndex = ENGG2_ANIM_1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_1); this->actionFunc = func_80B3B0A0; break; - case 1: - case 8: - this->unk_2EE = 5; - this->actor.flags &= ~ACTOR_FLAG_1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5); + case ENGG2_ANIM_1: + case ENGG2_ANIM_8: + this->animIndex = ENGG2_ANIM_5; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5); this->actionFunc = func_80B3B120; break; - case 5: - this->unk_2EE = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + case ENGG2_ANIM_5: + this->animIndex = ENGG2_ANIM_6; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0); this->actionFunc = func_80B3B21C; break; - case 6: - this->unk_2EE = 7; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5); + case ENGG2_ANIM_6: + this->animIndex = ENGG2_ANIM_7; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5); this->actionFunc = func_80B3B294; break; default: - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0); this->actionFunc = func_80B3AFB0; break; } @@ -160,7 +188,7 @@ void func_80B3AFB0(EnGg2* this, PlayState* play) { this->actionFunc = func_80B3AE60; } else if ((this->actor.xzDistToPlayer < 100.0f) && (this->actor.xzDistToPlayer > 50.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->actor.textId = 0xCE4; } } @@ -173,7 +201,7 @@ void func_80B3B05C(EnGg2* this, PlayState* play) { void func_80B3B0A0(EnGg2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_2F0 = 0; this->actionFunc = func_80B3B5D4; @@ -338,7 +366,7 @@ f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { void func_80B3B8A4(EnGg2* this) { f32 sp1C; - if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) { + if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) { this->unk_2F2 += 0x62C; sp1C = 1100.0f; } else { @@ -368,7 +396,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, - this->morphTable, 20); + this->morphTable, OBJECT_GG_LIMB_MAX); this->path = SubS_GetPathByIndex(play, ENGG2_GET_PATH_INDEX(&this->actor), ENGG2_PATH_INDEX_NONE); this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->unk_2F0 = 0; @@ -384,15 +412,15 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); - this->unk_2EE = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->animIndex = ENGG2_ANIM_0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0); this->actionFunc = func_80B3AFB0; } else if (play->sceneId == SCENE_17SETUGEN) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); - this->unk_2EE = 8; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->animIndex = ENGG2_ANIM_8; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0); this->actionFunc = func_80B3B05C; } else { Actor_Kill(&this->actor); @@ -401,8 +429,8 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); - this->unk_2EE = 8; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->animIndex = ENGG2_ANIM_8; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0); this->actionFunc = func_80B3B05C; } else { Actor_Kill(&this->actor); @@ -423,13 +451,13 @@ void EnGg2_Update(Actor* thisx, PlayState* play) { if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; - this->actor.flags |= ACTOR_FLAG_1; - if ((this->unk_2EE == 5) && (this->unk_2EE == 7)) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + if ((this->animIndex == ENGG2_ANIM_5) && (this->animIndex == ENGG2_ANIM_7)) { + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } else { this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } this->actionFunc(this, play); @@ -441,8 +469,8 @@ void EnGg2_Update(Actor* thisx, PlayState* play) { func_80B3B8A4(this); Actor_TrackPlayer(play, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos); - if ((this->unk_2EE == 5) || (this->unk_2EE == 7)) { - func_800B9010(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG); + if ((this->animIndex == ENGG2_ANIM_5) || (this->animIndex == ENGG2_ANIM_7)) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG); if ((play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) && ((play->state.frames % 4) == 0)) { func_80B3B4B0(this, play); } @@ -454,12 +482,12 @@ void EnGg2_Update(Actor* thisx, PlayState* play) { s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGg2* this = THIS; - if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) { - if (limbIndex == 1) { + if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) { + if (limbIndex == OBJECT_GG_LIMB_01) { Matrix_RotateYS(this->unk_2F6, MTXMODE_APPLY); } - if (limbIndex == 2) { + if (limbIndex == OBJECT_GG_LIMB_02) { Matrix_RotateZS(this->unk_2F4, MTXMODE_APPLY); } } @@ -469,7 +497,7 @@ s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void func_80B3BDC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGg2* this = THIS; - if (limbIndex == 4) { + if (limbIndex == OBJECT_GG_LIMB_04) { Matrix_MultVec3f(&D_80B3C0A0, &this->unk_304); } } diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h index 83b4bad42..dd68c20b1 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h @@ -2,6 +2,7 @@ #define Z_EN_GG2_H #include "global.h" +#include "objects/object_gg/object_gg.h" struct EnGg2; @@ -20,14 +21,14 @@ typedef struct EnGg2 { /* 0x1DC */ s32 unk_1DC; /* 0x1E0 */ Vec3s unk_1E0; /* 0x1E6 */ Vec3s unk_1E6; - /* 0x1EC */ Vec3s jointTable[20]; - /* 0x264 */ Vec3s morphTable[20]; + /* 0x1EC */ Vec3s jointTable[OBJECT_GG_LIMB_MAX]; + /* 0x264 */ Vec3s morphTable[OBJECT_GG_LIMB_MAX]; /* 0x2DC */ UNK_TYPE1 unk2DC[0x8]; /* 0x2E4 */ s16 csId; /* 0x2E6 */ UNK_TYPE1 unk2E6[4]; /* 0x2EA */ s16 unk_2EA; /* 0x2EC */ s16 unk_2EC; - /* 0x2EE */ s16 unk_2EE; + /* 0x2EE */ s16 animIndex; /* 0x2F0 */ u8 unk_2F0; /* 0x2F1 */ u8 unk_2F1; /* 0x2F2 */ s16 unk_2F2; 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 29f7059a5..d68e6902f 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -28,10 +28,45 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play); #define GIANT_TYPE_IS_CLOCK_TOWER_FAILURE(type) \ (type >= GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE && type <= GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE) +/** + * Used as values for cueId. The UNKNOWN ones are never used in-game. + */ +typedef enum { + /* 0 */ GIANT_CUEID_NONE, + /* 1 */ GIANT_CUEID_IDLE, + /* 2 */ GIANT_CUEID_WALKING, + /* 3 */ GIANT_CUEID_LOOKING_UP, + /* 4 */ GIANT_CUEID_RAISING_ARMS, + /* 5 */ GIANT_CUEID_STRUGGLING, + /* 6 */ GIANT_CUEID_FALLING_OVER, + /* 7 */ GIANT_CUEID_IDLE_FADE_IN, + /* 8 */ GIANT_CUEID_TALKING, + /* 9 */ GIANT_CUEID_DONE_TALKING, + /* 10 */ GIANT_CUEID_TEACHING_OATH_TO_ORDER, + /* 11 */ GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER, + /* 12 */ GIANT_CUEID_UNKNOWN_12, + /* 13 */ GIANT_CUEID_UNKNOWN_13, + /* 14 */ GIANT_CUEID_UNKNOWN_14, + /* 15 */ GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER +} GiantCueId; + +ActorInit En_Giant_InitVars = { + ACTOR_EN_GIANT, + ACTORCAT_NPC, + FLAGS, + OBJECT_GIANT, + sizeof(EnGiant), + (ActorFunc)EnGiant_Init, + (ActorFunc)EnGiant_Destroy, + (ActorFunc)EnGiant_Update, + (ActorFunc)EnGiant_Draw, +}; + /** * These values are used to index into sAnimations to pick the appropriate animation. */ typedef enum { + /* -1 */ GIANT_ANIM_NONE = -1, /* 0 */ GIANT_ANIM_LOOK_UP_START, /* 1 */ GIANT_ANIM_LOOK_UP_LOOP, /* 2 */ GIANT_ANIM_FALLING_OVER, @@ -50,49 +85,26 @@ typedef enum { /* 15 */ GIANT_ANIM_MAX } GiantAnimation; -/** - * Used as values for cueId. The UNKNOWN ones are never used in-game. - */ -typedef enum { - /* 0 */ GIANT_CUE_ID_NONE, - /* 1 */ GIANT_CUE_ID_IDLE, - /* 2 */ GIANT_CUE_ID_WALKING, - /* 3 */ GIANT_CUE_ID_LOOKING_UP, - /* 4 */ GIANT_CUE_ID_RAISING_ARMS, - /* 5 */ GIANT_CUE_ID_STRUGGLING, - /* 6 */ GIANT_CUE_ID_FALLING_OVER, - /* 7 */ GIANT_CUE_ID_IDLE_FADE_IN, - /* 8 */ GIANT_CUE_ID_TALKING, - /* 9 */ GIANT_CUE_ID_DONE_TALKING, - /* 10 */ GIANT_CUE_ID_TEACHING_OATH_TO_ORDER, - /* 11 */ GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER, - /* 12 */ GIANT_CUE_ID_UNKNOWN_12, - /* 13 */ GIANT_CUE_ID_UNKNOWN_13, - /* 14 */ GIANT_CUE_ID_UNKNOWN_14, - /* 15 */ GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER -} GiantCueId; - -ActorInit En_Giant_InitVars = { - ACTOR_EN_GIANT, - ACTORCAT_NPC, - FLAGS, - OBJECT_GIANT, - sizeof(EnGiant), - (ActorFunc)EnGiant_Init, - (ActorFunc)EnGiant_Destroy, - (ActorFunc)EnGiant_Update, - (ActorFunc)EnGiant_Draw, -}; - -static AnimationHeader* sAnimations[] = { - &gGiantLookUpStartAnim, &gGiantLookUpLoopAnim, &gGiantFallingOverAnim, &gGiantRaisedArmsStartAnim, - &gGiantRaisedArmsLoopAnim, &gGiantStruggleStartAnim, &gGiantStruggleLoopAnim, &gGiantIdleAnim, - &gGiantWalkingAnim, &gGiantBigCallStartAnim, &gGiantBigCallLoopAnim, &gGiantBigCallEndAnim, - &gGiantSmallCallStartAnim, &gGiantSmallCallLoopAnim, &gGiantSmallCallEndAnim, +static AnimationHeader* sAnimations[GIANT_ANIM_MAX] = { + &gGiantLookUpStartAnim, // GIANT_ANIM_LOOK_UP_START + &gGiantLookUpLoopAnim, // GIANT_ANIM_LOOK_UP_LOOP + &gGiantFallingOverAnim, // GIANT_ANIM_FALLING_OVER + &gGiantRaisedArmsStartAnim, // GIANT_ANIM_RAISED_ARMS_START + &gGiantRaisedArmsLoopAnim, // GIANT_ANIM_RAISED_ARMS_LOOP + &gGiantStruggleStartAnim, // GIANT_ANIM_STRUGGLE_START + &gGiantStruggleLoopAnim, // GIANT_ANIM_STRUGGLE_LOOP + &gGiantIdleAnim, // GIANT_ANIM_IDLE_LOOP + &gGiantWalkingAnim, // GIANT_ANIM_WALKING_LOOP + &gGiantBigCallStartAnim, // GIANT_ANIM_BIG_CALL_START + &gGiantBigCallLoopAnim, // GIANT_ANIM_BIG_CALL_LOOP + &gGiantBigCallEndAnim, // GIANT_ANIM_BIG_CALL_END + &gGiantSmallCallStartAnim, // GIANT_ANIM_SMALL_CALL_START + &gGiantSmallCallLoopAnim, // GIANT_ANIM_SMALL_CALL_LOOP + &gGiantSmallCallEndAnim, // GIANT_ANIM_SMALL_CALL_END }; void EnGiant_ChangeAnim(EnGiant* this, s16 animIndex) { - if (animIndex >= GIANT_ANIM_LOOK_UP_START && animIndex < GIANT_ANIM_MAX) { + 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, @@ -160,7 +172,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable, GIANT_LIMB_MAX); EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); - this->cueId = GIANT_CUE_ID_NONE; + this->cueId = GIANT_CUEID_NONE; this->actionFunc = EnGiant_PerformCutsceneActions; this->actor.draw = NULL; this->alpha = 0; @@ -275,58 +287,58 @@ void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimIndex) */ void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) { switch (this->cueId) { - case GIANT_CUE_ID_IDLE: + case GIANT_CUEID_IDLE: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CUE_ID_WALKING: + case GIANT_CUEID_WALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; - case GIANT_CUE_ID_STRUGGLING: + case GIANT_CUEID_STRUGGLING: EnGiant_ChangeAnim(this, GIANT_ANIM_STRUGGLE_START); break; - case GIANT_CUE_ID_FALLING_OVER: + case GIANT_CUEID_FALLING_OVER: EnGiant_ChangeAnim(this, GIANT_ANIM_FALLING_OVER); break; - case GIANT_CUE_ID_IDLE_FADE_IN: + case GIANT_CUEID_IDLE_FADE_IN: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); this->alpha = 0; break; - case GIANT_CUE_ID_TALKING: + case GIANT_CUEID_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_START); break; - case GIANT_CUE_ID_DONE_TALKING: + case GIANT_CUEID_DONE_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_END); break; - case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER: + case GIANT_CUEID_TEACHING_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_START); break; - case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER: + case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_END); break; - case GIANT_CUE_ID_UNKNOWN_12: + case GIANT_CUEID_UNKNOWN_12: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CUE_ID_UNKNOWN_13: + case GIANT_CUEID_UNKNOWN_13: EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; - case GIANT_CUE_ID_UNKNOWN_14: + case GIANT_CUEID_UNKNOWN_14: if (this->animIndex != GIANT_ANIM_WALKING_LOOP) { EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); } break; - case GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER: + case GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER: Animation_Change(&this->skelAnime, &gGiantRaisedArmsStartAnim, 0.0f, Animation_GetLastFrame(&gGiantRaisedArmsStartAnim) - 1.0f, Animation_GetLastFrame(&gGiantRaisedArmsStartAnim), ANIMMODE_ONCE, 0.0f); @@ -339,14 +351,16 @@ void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) { void EnGiant_UpdateAlpha(EnGiant* this) { switch (this->cueId) { - case GIANT_CUE_ID_FALLING_OVER: + case GIANT_CUEID_FALLING_OVER: if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) { this->alpha -= 12; } break; - case GIANT_CUE_ID_UNKNOWN_14: + + case GIANT_CUEID_UNKNOWN_14: this->alpha -= 12; break; + default: if (this->alpha < 255) { this->alpha += 8; @@ -363,36 +377,37 @@ void EnGiant_UpdateAlpha(EnGiant* this) { */ void EnGiant_PlayAndUpdateAnimation(EnGiant* this) { if (SkelAnime_Update(&this->skelAnime) && - (this->animIndex != GIANT_ANIM_FALLING_OVER || this->cueId != GIANT_CUE_ID_FALLING_OVER)) { + ((this->animIndex != GIANT_ANIM_FALLING_OVER) || (this->cueId != GIANT_CUEID_FALLING_OVER))) { EnGiant_ChangeAnim(this, this->animIndex); + switch (this->cueId) { - case GIANT_CUE_ID_LOOKING_UP: + case GIANT_CUEID_LOOKING_UP: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START); break; - case GIANT_CUE_ID_RAISING_ARMS: + case GIANT_CUEID_RAISING_ARMS: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START); break; - case GIANT_CUE_ID_STRUGGLING: + case GIANT_CUEID_STRUGGLING: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START); break; - case GIANT_CUE_ID_FALLING_OVER: + case GIANT_CUEID_FALLING_OVER: // Unused EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER); break; - case GIANT_CUE_ID_TALKING: + case GIANT_CUEID_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP); break; - case GIANT_CUE_ID_DONE_TALKING: - case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER: + case GIANT_CUEID_DONE_TALKING: + case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER: + case GIANT_CUEID_TEACHING_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP); break; @@ -415,11 +430,11 @@ void EnGiant_PlaySound(EnGiant* this) { if ((this->sfxId != 0xFFFF) && (((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); + Actor_PlaySfx_Flagged(&this->actor, this->sfxId); } 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); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_KYOJIN_SIGN - SFX_FLAG); } } } @@ -445,8 +460,8 @@ void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) { } EnGiant_PlaySound(this); - if (this->cueId == GIANT_CUE_ID_STRUGGLING) { - func_800B9010(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG); + if (this->cueId == GIANT_CUEID_STRUGGLING) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG); } EnGiant_PlayAndUpdateAnimation(this); } 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 b40c2287a..2a5e6712a 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 @@ -5,9 +5,8 @@ */ #include "z_en_ginko_man.h" -#include "objects/object_boj/object_boj.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnGinkoMan*)thisx) @@ -47,21 +46,22 @@ typedef enum { /* 1 */ GINKO_ANIM_SITTING, /* 2 */ GINKO_ANIM_REACHING, /* 3 */ GINKO_ANIM_AMAZED, - /* 4 */ GINKO_ANIM_ADVERTISING + /* 4 */ GINKO_ANIM_ADVERTISING, // looking around for customers + /* 5 */ GINKO_ANIM_MAX } 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 }, - { &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // looking around for customers - { &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, +static AnimationInfo sAnimationInfo[GINKO_ANIM_MAX] = { + { &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_LEGSMACKING + { &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_SITTING + { &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // GINKO_ANIM_REACHING + { &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_AMAZED + { &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_ADVERTISING }; void EnGinkoMan_Init(Actor* thisx, PlayState* play) { EnGinkoMan* this = THIS; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actor.uncullZoneForward = 400.0f; Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.cylRadius = 100; @@ -71,7 +71,7 @@ void EnGinkoMan_Init(Actor* thisx, PlayState* play) { this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET; this->serviceFee = 0; SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_0043F0, this->jointTable, - this->morphTable, 16); + this->morphTable, OBJECT_BOJ_LIMB_MAX); EnGinkoMan_SetupIdle(this); } @@ -79,7 +79,7 @@ void EnGinkoMan_Destroy(Actor* thisx, PlayState* play) { } void EnGinkoMan_SetupIdle(EnGinkoMan* this) { - this->actor.flags |= ACTOR_FLAG_1; // targetable + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); this->actionFunc = EnGinkoMan_Idle; } @@ -89,7 +89,7 @@ void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SwitchAnimation(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { + if (HS_GET_BANK_RUPEES() == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x44C, &this->actor); this->curTextId = 0x44C; // would you like to make an account @@ -97,15 +97,15 @@ void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play) { 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? + this->curTextId = 0x467; } else { Message_StartTextbox(play, 0x466, &this->actor); - this->curTextId = 0x466; // What's this? You need somethin'? + this->curTextId = 0x466; } } EnGinkoMan_SetupDialogue(this); } else if (ABS_ALT(yaw) < 0x1555) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -116,25 +116,26 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { } switch (this->curTextId) { - case 0x44C: // "Hey there, little guy! Won't you deposit some Rupees? (first dialogue) + case 0x44C: Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08)) { Message_StartTextbox(play, 0x44E, &this->actor); - this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" + this->curTextId = 0x44E; } else { Message_StartTextbox(play, 0x44D, &this->actor); - this->curTextId = - 0x44D; // "For example, if you deposit 200 Rupees, you'll get an item that holds a lot of Rupees." + this->curTextId = 0x44D; } break; - case 0x44D: // "For example, if you deposit 200 Rupees, you'll get an item that holds a lot of Rupees." + + case 0x44D: Message_StartTextbox(play, 0x44E, &this->actor); - this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" + this->curTextId = 0x44E; break; - case 0x44F: // "...So, what'll it be? Deposit Rupees Don't deposit Rupees" + + case 0x44F: Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x450, &this->actor); - this->curTextId = 0x450; // "How much? How much? [rupee prompt] + this->curTextId = 0x450; break; case 0x453: // you deposited a tiny amount @@ -142,59 +143,61 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { case 0x455: // you deposited a lot if (this->isNewAccount == true) { this->isNewAccount = false; - if (this->curTextId != 0x453) { // "That's it? That ain't nothing at all, big spender! + if (this->curTextId != 0x453) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); } Message_StartTextbox(play, 0x461, &this->actor); - this->curTextId = 0x461; // So, little guy, what's your name? + this->curTextId = 0x461; } else { - if (this->curTextId == 0x453) { // "That's it? That ain't nothing at all, big spender! + if (this->curTextId == 0x453) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); } - play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = HS_GET_BANK_RUPEES(); Message_StartTextbox(play, 0x45A, &this->actor); - this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" + this->curTextId = 0x45A; } break; - case 0x456: // "Is that so? Think about it, little guy!" - case 0x459: // "Heyyy! You don't have that much! + + case 0x456: + case 0x459: Message_StartTextbox(play, 0x44E, &this->actor); - this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" + this->curTextId = 0x44E; break; - case 0x45A: // "All right, little guy, now I've got a total of [rupees] from you!" - if (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && + + case 0x45A: + if ((HS_GET_BANK_RUPEES() >= 200) && (this->previousBankValue < 200) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_40)) { SET_WEEKEVENTREG(WEEKEVENTREG_59_40); Message_StartTextbox(play, 0x45B, &this->actor); - this->curTextId = 0x45B; // "What's this? You've already saved up 200 Rupees!?! - } else if (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 1000) && - ((this->previousBankValue) < 1000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) { + this->curTextId = 0x45B; + } else if ((HS_GET_BANK_RUPEES() >= 1000) && (this->previousBankValue < 1000) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) { SET_WEEKEVENTREG(WEEKEVENTREG_59_80); Message_StartTextbox(play, 0x45C, &this->actor); - this->curTextId = 0x45C; // "What's this? You've already saved up 1000 Rupees!?! - } else if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { + this->curTextId = 0x45C; + } else if (HS_GET_BANK_RUPEES() >= 5000) { if ((this->previousBankValue < 5000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_60_01)) { SET_WEEKEVENTREG(WEEKEVENTREG_60_01); 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.saveInfo.bankRupees & 0xFFFF)) { + this->curTextId = 0x45D; + } else if (this->previousBankValue < (s16)HS_GET_BANK_RUPEES()) { 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..." + this->curTextId = 0x45E; } else { 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!" + this->curTextId = 0x460; } } else { 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!" + this->curTextId = 0x460; } break; + case 0x45B: // given 200 reward case 0x45C: // given 1000 reward case 0x45D: // given 5000 reward @@ -203,273 +206,290 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupBankAward(this); EnGinkoMan_BankAward(this, play); break; - case 0x461: // So, little guy, what's your name? + + case 0x461: Message_StartTextbox(play, 0x462, &this->actor); - this->curTextId = 0x462; // Hmm... Link is it? + this->curTextId = 0x462; break; - case 0x462: // Hmm.. Link is it? + + case 0x462: Message_StartTextbox(play, 0x463, &this->actor); - this->curTextId = 0x463; // Got it... I won't forget your deposits. Let me stamp you + this->curTextId = 0x463; break; - case 0x463: // Got it... I won't forget your deposits. Let me stamp you + + case 0x463: Message_StartTextbox(play, 0x464, &this->actor); - this->curTextId = 0x464; // Hey, relax! It doesn't leave any marks + this->curTextId = 0x464; break; - case 0x464: // Hey, relax! It doesn't leave any marks - play->msgCtx.msgMode = 0x44; + + case 0x464: + play->msgCtx.msgMode = MSGMODE_PAUSED; EnGinkoMan_SetupStamp(this); // stamp player break; - case 0x465: // "There! Now I'll know you when I see you!" + + case 0x465: Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); - play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = HS_GET_BANK_RUPEES(); Message_StartTextbox(play, 0x45A, &this->actor); - this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" + this->curTextId = 0x45A; break; - case 0x466: // What's this? You need somethin'? - case 0x467: // "What's this? You need somethin' on a day like this? You haven't evacuated yet? + + case 0x466: + case 0x467: Message_StartTextbox(play, 0x468, &this->actor); - this->curTextId = 0x468; // " Deposit Rupees Withdraw Rupees Nothing really" + this->curTextId = 0x468; break; - case 0x469: // "Excuse me, but let me take a look at you..." + + case 0x469: EnGinkoMan_SetupStamp(this); // stamp player break; - case 0x46A: // "Ah, yes...[Link]. If I remember, you're the little guy who deposited [rupees]." - case 0x46C: // "Ah, yes...[Link], right? If I remember, you're the little guy who deposited [rupees]." - case 0x47E: // "Your deposits total [rupees]." + + case 0x46A: + case 0x46C: + case 0x47E: if (this->choiceDepositWithdrawl == GINKOMAN_CHOICE_DEPOSIT) { - if ((u32)(gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { + if (HS_GET_BANK_RUPEES() >= 5000) { Message_StartTextbox(play, 0x45F, &this->actor); - this->curTextId = 0x45F; // "Excuuuse me! But I can't take anymore deposits! + this->curTextId = 0x45F; } else if (gSaveContext.save.saveInfo.playerData.rupees == 0) { Message_StartTextbox(play, 0x458, &this->actor); - this->curTextId = - 0x458; // "Hmm...You play mean jokes, little guy! You haven't even got a single Rupee! + this->curTextId = 0x458; } else { Message_StartTextbox(play, 0x479, &this->actor); - this->curTextId = 0x479; // "Well, are you gonna make a deposit?" + this->curTextId = 0x479; } } else if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(play, 0x46D, &this->actor); - // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just rumors!" + this->curTextId = 0x46D; } else { // GINKOMAN_CHOICE_WITHDRAWL Message_StartTextbox(play, 0x46B, &this->actor); - this->curTextId = 0x46B; // "So..." + this->curTextId = 0x46B; } this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET; break; - case 0x46B: // So... + + case 0x46B: Message_StartTextbox(play, 0x46E, &this->actor); - this->curTextId = 0x46E; // "How much do you want? [rupee prompt] + this->curTextId = 0x46E; break; - case 0x46D: // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just - // rumors!" + + case 0x46D: Message_StartTextbox(play, 0x46B, &this->actor); - this->curTextId = 0x46B; // So... + this->curTextId = 0x46B; break; - case 0x470: // "Is that so? Come back and deposit some after saving up a bunch!" + + case 0x470: if (Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->isStampChecked = false; EnGinkoMan_SetupIdle(this); // change to waiting for approach } break; - case 0x476: // "...You haven't deposited that many Rupees, so that much isn't available for withdrawal. Do the - // math! + + case 0x476: 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 + // fallthrough + case 0x475: + case 0x47C: + case 0x47D: Message_StartTextbox(play, 0x468, &this->actor); - this->curTextId = 0x468; // " Deposit Rupees Withdraw Rupees Nothing really" + this->curTextId = 0x468; break; - case 0x472: // "What's this? It's a waste to take out such a tiny bit! ...But if you say so!" - case 0x473: // Use it wisely... - case 0x474: // "Aw, you're taking out all that? If you spend it like that, it'll all be gone before you know - // it!" - if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { + + case 0x472: + case 0x473: + case 0x474: + if (HS_GET_BANK_RUPEES() == 0) { Message_StartTextbox(play, 0x478, &this->actor); - // "Look, little guy, all the Rupees you deposited are gone, so you can't use that stamp anymore." this->curTextId = 0x478; } else { - play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = HS_GET_BANK_RUPEES(); Message_StartTextbox(play, 0x45A, &this->actor); - this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" + this->curTextId = 0x45A; } break; - case 0x477: // "...You know, at this time of day there's a 4 Rupee service charge on withdrawals!" + + case 0x477: Message_StartTextbox(play, 0x471, &this->actor); - this->curTextId = 0x471; // "Are you really withdrawing [rupees selected]? Y/n" + this->curTextId = 0x471; this->serviceFee = play->msgCtx.unk1206C; break; - case 0x479: // Well, are you gonna make a deposit? + + case 0x479: Message_StartTextbox(play, 0x44F, &this->actor); - this->curTextId = 0x44F; // "All right! So..." + this->curTextId = 0x44F; + break; + + default: break; } } -// actionfunc: wait for player dialogue input void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { if (!Message_ShouldAdvance(play)) { return; } switch (this->curTextId) { - case 0x44E: // "...So, what'll it be? + case 0x44E: if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { - play_sound(NA_SE_SY_ERROR); + if (HS_GET_BANK_RUPEES() >= 5000) { + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x45F, &this->actor); this->curTextId = 0x45F; // bank full, cannot accept more } else { if (gSaveContext.save.saveInfo.playerData.rupees > 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x44F, &this->actor); - this->curTextId = 0x44F; // "All right! so..." + this->curTextId = 0x44F; } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x458, &this->actor); this->curTextId = 0x458; // you haven't even gotten a single rup } } } else { // GINKOMAN_CHOICE_NO - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x451, &this->actor); - this->curTextId = 0x451; // dont say that, come on, trust me! + this->curTextId = 0x451; } break; - case 0x452: // Really? are you really depositing rupees? + + case 0x452: if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.bankRupeesSelected) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x459, &this->actor); - this->curTextId = 0x459; // HEY you dont have that much + this->curTextId = 0x459; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (play->msgCtx.bankRupeesSelected >= 100) { Message_StartTextbox(play, 0x455, &this->actor); - this->curTextId = 0x455; // You're really going to be give me that much? Rich little guy! + this->curTextId = 0x455; } else if (play->msgCtx.bankRupeesSelected >= 10) { Message_StartTextbox(play, 0x454, &this->actor); - this->curTextId = 0x454; // Seriously? that's a lot. A lot! + this->curTextId = 0x454; } else { 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 + this->curTextId = 0x453; } - if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { + if (HS_GET_BANK_RUPEES() == 0) { this->isNewAccount = true; } Rupees_ChangeBy(-play->msgCtx.bankRupeesSelected); - this->previousBankValue = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; - gSaveContext.save.saveInfo.bankRupees = - ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) + play->msgCtx.bankRupeesSelected) | - (gSaveContext.save.saveInfo.bankRupees & 0xFFFF0000); + this->previousBankValue = HS_GET_BANK_RUPEES(); + HS_SET_BANK_RUPEES(HS_GET_BANK_RUPEES() + play->msgCtx.bankRupeesSelected); } } else { // GINKOMAN_CHOICE_NO - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); - if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { + if (HS_GET_BANK_RUPEES() == 0) { Message_StartTextbox(play, 0x456, &this->actor); - this->curTextId = 0x456; // Is that so? think about it + this->curTextId = 0x456; } else { Message_StartTextbox(play, 0x47D, &this->actor); - this->curTextId = 0x47D; // is that so? think it over + this->curTextId = 0x47D; } } break; - case 0x468: // Deposit OR withdrawl OR cancel screen + + case 0x468: if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_CANCEL) { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x470, &this->actor); - this->curTextId = 0x470; // "Is that so? Come back and deposit some after saving up a bunch!" + this->curTextId = 0x470; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->choiceDepositWithdrawl = play->msgCtx.choiceIndex; if (!this->isStampChecked) { this->isStampChecked = true; Message_StartTextbox(play, 0x469, &this->actor); - this->curTextId = 0x469; // "Excuse me, but let me take a look at you..." + this->curTextId = 0x469; } else { Message_StartTextbox(play, 0x47E, &this->actor); - this->curTextId = 0x47E; // "Your deposits total [rupees]." + this->curTextId = 0x47E; } } break; - case 0x471: // Are you really withdrawling [selected rupees]? + + case 0x471: if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((s32)((gSaveContext.save.saveInfo.bankRupees & 0xFFFF)) < - ((s32)(play->msgCtx.bankRupeesSelected + this->serviceFee))) { - play_sound(NA_SE_SY_ERROR); + if ((s32)HS_GET_BANK_RUPEES() < (play->msgCtx.bankRupeesSelected + this->serviceFee)) { + Audio_PlaySfx(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x476, &this->actor); - this->curTextId = 0x476; // you dont have enough deposited to withdrawl + this->curTextId = 0x476; } else if (CUR_CAPACITY(UPG_WALLET) < (play->msgCtx.bankRupeesSelected + gSaveContext.save.saveInfo.playerData.rupees)) { // check if wallet is big enough - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x475, &this->actor); - this->curTextId = 0x475; // You can't hold that many in your wallet + this->curTextId = 0x475; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (play->msgCtx.bankRupeesSelected >= 100) { Message_StartTextbox(play, 0x474, &this->actor); - this->curTextId = 0x474; // Aw, you're taking out all that? + this->curTextId = 0x474; } else if (play->msgCtx.bankRupeesSelected >= 10) { Message_StartTextbox(play, 0x473, &this->actor); - this->curTextId = 0x473; // use it wisely + this->curTextId = 0x473; } else { Message_StartTextbox(play, 0x472, &this->actor); - this->curTextId = 0x472; // It's a waste to take out such a tiny bit + this->curTextId = 0x472; } - this->previousBankValue = (s16)(gSaveContext.save.saveInfo.bankRupees & 0xFFFF); - gSaveContext.save.saveInfo.bankRupees = - (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) - play->msgCtx.bankRupeesSelected) - - this->serviceFee) | - (gSaveContext.save.saveInfo.bankRupees & 0xFFFF0000); + this->previousBankValue = HS_GET_BANK_RUPEES(); + HS_SET_BANK_RUPEES(HS_GET_BANK_RUPEES() - play->msgCtx.bankRupeesSelected - this->serviceFee); Rupees_ChangeBy(play->msgCtx.bankRupeesSelected); } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x47C, &this->actor); - this->curTextId = 0x47C; // "Is that so? Think it over, little guy! So what are you gonna do?" + this->curTextId = 0x47C; } break; + + default: + break; } } void EnGinkoMan_WaitForRupeeCount(EnGinkoMan* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (this->curTextId) { - case 0x450: // "How much? How much?" [rupee prompt] Set the amount with [Control Stick] and + case 0x450: if (play->msgCtx.bankRupeesSelected == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x457, &this->actor); - this->curTextId = 0x457; // Zero Rupees? Cruel joke! + this->curTextId = 0x457; } else { Message_StartTextbox(play, 0x452, &this->actor); - this->curTextId = 0x452; // Really? are you really depositing [x]? Y/n + this->curTextId = 0x452; } break; - case 0x46E: // "How much do you want?" [rupee prompt] Set the amount with [Control Stick] + + case 0x46E: if (play->msgCtx.bankRupeesSelected == 0) { Message_StartTextbox(play, 0x46F, &this->actor); - this->curTextId = 0x46F; // "Zero Rupees?!? That's a cruel joke!" + this->curTextId = 0x46F; } else if (gSaveContext.save.isNight == true) { Message_StartTextbox(play, 0x477, &this->actor); - this->curTextId = 0x477; // "...You know, at this time of day there's a 4 Rupee service charge... + this->curTextId = 0x477; } else { Message_StartTextbox(play, 0x471, &this->actor); - this->curTextId = 0x471; // "Are you really withdrawing [rupees selected]? Y/n + this->curTextId = 0x471; this->serviceFee = 0; } break; + + default: + break; } } } @@ -523,13 +543,13 @@ void EnGinkoMan_BankAward(EnGinkoMan* this, PlayState* play) { // Parent is the player when starting to receive the award this->actor.parent = NULL; EnGinkoMan_SetupBankAward2(this); - } else if (this->curTextId == 0x45B) { // "Whats this, you already saved up 200?" + } else if (this->curTextId == 0x45B) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08)) { Actor_OfferGetItem(&this->actor, play, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } - } else if (this->curTextId == 0x45C) { // "Whats this, you already saved up 5000?" + } else if (this->curTextId == 0x45C) { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_08)) { Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); @@ -547,8 +567,6 @@ void EnGinkoMan_SetupBankAward2(EnGinkoMan* this) { void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08) && (this->curTextId == 0x45B)) { - // "What's this? You've already saved up 200 Rupees!?! Well, little guy, here's your special gift. Take - // it!" SET_WEEKEVENTREG(WEEKEVENTREG_10_08); Message_StartTextbox(play, 0x47A, &this->actor); this->curTextId = 0x47A; // Message after receiving reward for depositing 200 rupees. @@ -567,7 +585,7 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupIdle(this); } } else { - func_800B85E0(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); } } @@ -577,29 +595,32 @@ void EnGinkoMan_SetupStamp(EnGinkoMan* this) { } void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play) { - if ((this->curTextId == 0x464) // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt." - && (Animation_OnFrame(&this->skelAnime, 10.0f))) { + if ((this->curTextId == 0x464) && Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); // "stamp" } 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." + case 0x464: 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!" + this->curTextId = 0x465; break; - case 0x469: // "Excuse me, but let me take a look at you..." + + case 0x469: Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); - play->msgCtx.bankRupees = (gSaveContext.save.saveInfo.bankRupees & 0xFFFF); + play->msgCtx.bankRupees = HS_GET_BANK_RUPEES(); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(play, 0x46C, &this->actor); - this->curTextId = 0x46C; // "Ah, yes...[Link], right? + this->curTextId = 0x46C; } else { Message_StartTextbox(play, 0x46A, &this->actor); - this->curTextId = 0x46A; // "Ah, yes...[Link]. + this->curTextId = 0x46A; } break; + + default: + break; } EnGinkoMan_SetupDialogue(this); @@ -643,16 +664,16 @@ void EnGinkoMan_Update(Actor* thisx, PlayState* play) { s32 EnGinkoMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGinkoMan* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_BOJ_LIMB_0F) { *dList = object_boj_DL_00B1D8; } - if (limbIndex == 15) { + if (limbIndex == OBJECT_BOJ_LIMB_0F) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->limb15Rot.y, MTXMODE_APPLY); Matrix_RotateZS(this->limb15Rot.x, MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); - } else if (limbIndex == 8) { + } else if (limbIndex == OBJECT_BOJ_LIMB_08) { Matrix_RotateXS(-this->limb8Rot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->limb8Rot.x, MTXMODE_APPLY); } 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 b8a19d0f3..48ef4bdb1 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 @@ -2,6 +2,7 @@ #define Z_EN_GINKO_MAN_H #include "global.h" +#include "objects/object_boj/object_boj.h" struct EnGinkoMan; @@ -11,8 +12,8 @@ typedef struct EnGinkoMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnGinkoManActionFunc actionFunc; - /* 0x18C */ Vec3s jointTable[0x10]; - /* 0x1EC */ Vec3s morphTable[0x10]; + /* 0x18C */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX]; + /* 0x1EC */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX]; /* 0x24C */ Vec3s limb15Rot; /* 0x252 */ Vec3s limb8Rot; /* 0x258 */ s16 curTextId; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 1859cf83f..5481d8a70 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -6,7 +6,7 @@ #include "z_en_girla.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnGirlA*)thisx) @@ -78,12 +78,12 @@ static ShopItemEntry sShopItemEntries[] = { EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare }, { OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x06AE, 0x06AF, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero, EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare }, - { OBJECT_GI_STICK, GID_STICK, NULL, 1, 0x06B4, 0x06B5, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick, + { OBJECT_GI_STICK, GID_DEKU_STICK, NULL, 1, 0x06B4, 0x06B5, GI_DEKU_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick, EnGirlA_BuyFanfare }, { OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, func_800B8050, 30, 0x06B8, 0x06B9, GI_ARROWS_30, EnGirlA_CanBuyArrows, EnGirlA_BuyArrows, EnGirlA_BuyFanfare }, - { OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0x06B0, 0x06B1, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts, - EnGirlA_BuyFanfare }, + { OBJECT_GI_NUTS, GID_DEKU_NUTS, func_800B8118, 10, 0x06B0, 0x06B1, GI_DEKU_NUTS_10, EnGirlA_CanBuyNuts, + EnGirlA_BuyNuts, EnGirlA_BuyFanfare }, { OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x06AC, 0x06AD, GI_POTION_RED, EnGirlA_CanBuyPotionRed, EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare }, { OBJECT_GI_BOTTLE_04, GID_FAIRY, func_800B8050, 1, 0x06D3, 0x06D4, GI_FAIRY, EnGirlA_CanBuyFairy, @@ -94,9 +94,9 @@ static ShopItemEntry sShopItemEntries[] = { EnGirlA_BuyArrows, EnGirlA_BuyFanfare }, { OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0x06CF, 0x06D0, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen, EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare }, - { OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0x06CD, 0x06CE, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts, - EnGirlA_BuyFanfare }, - { OBJECT_GI_STICK, GID_STICK, NULL, 1, 0x06D1, 0x06D2, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick, + { OBJECT_GI_NUTS, GID_DEKU_NUTS, func_800B8118, 10, 0x06CD, 0x06CE, GI_DEKU_NUTS_10, EnGirlA_CanBuyNuts, + EnGirlA_BuyNuts, EnGirlA_BuyFanfare }, + { OBJECT_GI_STICK, GID_DEKU_STICK, NULL, 1, 0x06D1, 0x06D2, GI_DEKU_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick, EnGirlA_BuyFanfare }, { OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x06CB, 0x06CC, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero, EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare }, @@ -165,8 +165,8 @@ void EnGirlA_InitObjIndex(EnGirlA* this, PlayState* play) { return; } - this->objIndex = Object_GetIndex(&play->objectCtx, sShopItemEntries[params].objectId); - if (this->objIndex < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, sShopItemEntries[params].objectId); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -205,13 +205,13 @@ s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM)) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_10)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_FREE_BLUE_POTION)) { return CANBUY_RESULT_SUCCESS_2; } if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { @@ -234,13 +234,13 @@ s32 EnGirlA_CanBuyArrows(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this) { - if ((CUR_CAPACITY(UPG_NUTS) != 0) && (CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT))) { + if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (CUR_CAPACITY(UPG_DEKU_NUTS) <= AMMO(ITEM_DEKU_NUT))) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } - if (Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) { + if (Item_CheckObtainability(ITEM_DEKU_NUT) == ITEM_NONE) { return CANBUY_RESULT_SUCCESS_1; } return CANBUY_RESULT_SUCCESS_2; @@ -257,13 +257,13 @@ s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { - if ((CUR_CAPACITY(UPG_STICKS) != 0) && (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS))) { + if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= CUR_CAPACITY(UPG_DEKU_STICKS))) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } - if (Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) { + if (Item_CheckObtainability(ITEM_DEKU_STICK) == ITEM_NONE) { return CANBUY_RESULT_SUCCESS_1; } return CANBUY_RESULT_SUCCESS_2; @@ -415,11 +415,11 @@ void EnGirlA_BuyArrows(PlayState* play, EnGirlA* this) { void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this) { switch (this->itemParams) { case 5: - Item_Give(play, ITEM_NUTS_5); + Item_Give(play, ITEM_DEKU_NUTS_5); break; case 10: - Item_Give(play, ITEM_NUTS_10); + Item_Give(play, ITEM_DEKU_NUTS_10); break; default: @@ -434,7 +434,7 @@ void EnGirlA_BuyShieldHero(PlayState* play, EnGirlA* this) { } void EnGirlA_BuyStick(PlayState* play, EnGirlA* this) { - Item_Give(play, ITEM_STICK); + Item_Give(play, ITEM_DEKU_STICK); Rupees_ChangeBy(-play->msgCtx.unk1206C); } @@ -564,9 +564,9 @@ void EnGirlA_InitalUpdate(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; ShopItemEntry* shopItem = &sShopItemEntries[params]; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { this->actor.flags &= ~ACTOR_FLAG_10; - this->actor.objBankIndex = this->objIndex; + this->actor.objectSlot = this->objectSlot; this->actor.textId = shopItem->descriptionTextId; this->choiceTextId = shopItem->choiceTextId; @@ -585,7 +585,7 @@ void EnGirlA_InitalUpdate(EnGirlA* this, PlayState* play) { this->itemParams = shopItem->params; this->drawFunc = shopItem->drawFunc; this->getItemDrawId = shopItem->getItemDrawId; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, 0.25f); this->actor.shape.yOffset = 24.0f; this->actor.shape.shadowScale = 4.0f; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index e155ef6df..f289e31d5 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -27,7 +27,7 @@ typedef struct EnGirlA { /* 0x000 */ Actor actor; /* 0x144 */ UNK_TYPE1 unk144[0x44]; /* 0x188 */ EnGirlAActionFunc actionFunc; - /* 0x18C */ s8 objIndex; + /* 0x18C */ s8 objectSlot; /* 0x190 */ EnGirlAActionFunc mainActionFunc; /* 0x194 */ s32 isInitialized; /* 0x198 */ u16 choiceTextId; 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 1db4d7c5b..c631b24e3 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -5,9 +5,8 @@ */ #include "z_en_gk.h" -#include "objects/object_gk/object_gk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnGk*)thisx) @@ -102,14 +101,38 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -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 }, - { &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, 2, 0.0f }, - { &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, 2, 0.0f }, - { &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, - { &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, 0, 0.0f }, +typedef enum { + /* -1 */ ENGK_ANIM_NONE = -1, + /* 0x0 */ ENGK_ANIM_0, + /* 0x1 */ ENGK_ANIM_1, + /* 0x2 */ ENGK_ANIM_2, + /* 0x3 */ ENGK_ANIM_3, + /* 0x4 */ ENGK_ANIM_4, + /* 0x5 */ ENGK_ANIM_5, + /* 0x6 */ ENGK_ANIM_6, + /* 0x7 */ ENGK_ANIM_7, + /* 0x8 */ ENGK_ANIM_8, + /* 0x9 */ ENGK_ANIM_9, + /* 0xA */ ENGK_ANIM_10, + /* 0xB */ ENGK_ANIM_11, + /* 0xC */ ENGK_ANIM_12, + /* 0xD */ ENGK_ANIM_MAX +} EnGkAnimation; + +static AnimationInfo sAnimationInfo[ENGK_ANIM_MAX] = { + { &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_0 + { &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_1 + { &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_2 + { &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_3 + { &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_4 + { &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_5 + { &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_6 + { &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_7 + { &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_8 + { &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_9 + { &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_10 + { &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_11 + { &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_12 }; Color_RGBA8 D_80B533A0 = { 255, 255, 255, 255 }; @@ -124,18 +147,24 @@ u16 func_80B50410(EnGk* this, PlayState* play) { switch (this->unk_31C) { case 0xE7A: return 0xE7B; + case 0xE7B: return 0xE7C; + case 0xE7C: return 0xE7D; + case 0xE7D: return 0xE7E; + case 0xE7E: return 0xE7F; + case 0xE7F: SET_WEEKEVENTREG(WEEKEVENTREG_40_80); this->unk_1E4 |= 1; return 0xE80; + default: return 0xE7A; } @@ -147,16 +176,21 @@ u16 func_80B50410(EnGk* this, PlayState* play) { switch (this->unk_31C) { case 0xE82: return 0xE83; + case 0xE83: return 0xE7D; + case 0xE7D: return 0xE7E; + case 0xE7E: return 0xE7F; + case 0xE7F: SET_WEEKEVENTREG(WEEKEVENTREG_41_01); this->unk_1E4 |= 1; return 0xE80; + default: return 0xE82; } @@ -197,10 +231,12 @@ u16 func_80B50410(EnGk* this, PlayState* play) { switch (this->unk_31C) { case 0xE85: return 0xE86; + case 0xE86: SET_WEEKEVENTREG(WEEKEVENTREG_41_02); this->unk_1E4 |= 1; return 0xE87; + default: return 0xE85; } @@ -208,9 +244,9 @@ u16 func_80B50410(EnGk* this, PlayState* play) { this->unk_1E4 |= 1; return 0xE87; } - } else { - return 0; } + + return 0; } u16 func_80B50710(EnGk* this) { @@ -229,8 +265,10 @@ u16 func_80B50710(EnGk* this) { this->unk_1E4 |= 0x10; this->unk_1E4 |= 1; return 0xE8C; + + default: + return 0; } - return 0; } void func_80B507A0(EnGk* this, PlayState* play) { @@ -250,17 +288,17 @@ s32 func_80B50854(EnGk* this, PlayState* play) { if (!(this->unk_1E4 & 0x40)) { if (player->stateFlags2 & PLAYER_STATE2_8000000) { this->unk_1E4 |= 0x40; - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } } else if (!(player->stateFlags2 & PLAYER_STATE2_8000000)) { this->unk_1E4 &= ~0x40; } - if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY)) { - Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); - this->unk_2E4 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Flags_SetSwitch(play, ENGK_GET_SWITCH_FLAG(&this->actor)); + this->animIndex = ENGK_ANIM_3; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_3); this->actionFunc = func_80B521E8; return true; } @@ -285,12 +323,13 @@ void func_80B509A8(EnGk* this, PlayState* play) { this->unk_30C.y += Rand_ZeroOne(); this->unk_30C.z += 2.0f * Rand_Centered(); - if (this->unk_2E4 == 0) { + if (this->animIndex == ENGK_ANIM_0) { sp4C.x = 0.0f; sp4C.z = 0.0f; sp4C.y = -1.2f; phi_s1 = 25; - } else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) { + } else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) || + (this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) { sp4C.x = 0.0f; sp4C.z = 0.0f; sp4C.y = -0.5f; @@ -307,28 +346,28 @@ void func_80B50B38(EnGk* this, PlayState* play) { s16 i; s16 temp; - switch (this->unk_2E4) { - case 0: + switch (this->animIndex) { + case ENGK_ANIM_0: this->unk_2E0 = 3; for (i = 0; i < 2; i++) { func_80B509A8(this, play); } break; - case 2: + case ENGK_ANIM_2: this->unk_2E0 = 3; func_80B509A8(this, play); break; - case 1: - case 3: - case 12: + case ENGK_ANIM_1: + case ENGK_ANIM_3: + case ENGK_ANIM_12: this->unk_2E0 = 2; break; - case 9: - case 10: - case 11: + case ENGK_ANIM_9: + case ENGK_ANIM_10: + case ENGK_ANIM_11: this->unk_2E0 = 3; func_80B509A8(this, play); break; @@ -483,22 +522,22 @@ s32 func_80B5123C(EnGk* this, PlayState* play) { } void func_80B51308(EnGk* this, PlayState* play) { - s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_31A].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation); - if ((this->unk_2E4 == 7) && (sp1E == lastFrame)) { - this->unk_2E4 = 8; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + if ((this->animIndex == ENGK_ANIM_7) && (curFrame == endFrame)) { + this->animIndex = ENGK_ANIM_8; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_8); } } void func_80B51398(EnGk* this, PlayState* play) { - s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[9].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[9].animation); - if ((this->unk_2E4 == 9) && (sp1E == lastFrame)) { - this->unk_2E4 = 10; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10); + if ((this->animIndex == ENGK_ANIM_9) && (curFrame == endFrame)) { + this->animIndex = ENGK_ANIM_10; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_10); } } @@ -506,7 +545,7 @@ void func_80B51410(EnGk* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 100.0f) { - if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY_INTRO)) { this->unk_1E4 |= 0x20; } @@ -534,8 +573,6 @@ void func_80B51510(EnGk* this, PlayState* play) { s32 pad; s32 cueChannel; - if (this) {} - if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_479)) { cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_479); @@ -543,45 +580,48 @@ void func_80B51510(EnGk* this, PlayState* play) { this->cueId = play->csCtx.actorCues[cueChannel]->id; switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->unk_31A = 0; - this->unk_2E4 = 0; + this->csAnimIndex = ENGK_ANIM_0; + this->animIndex = ENGK_ANIM_0; break; case 2: - this->unk_31A = 2; - this->unk_2E4 = 2; + this->csAnimIndex = ENGK_ANIM_2; + this->animIndex = ENGK_ANIM_2; break; case 3: - this->unk_31A = 7; - this->unk_2E4 = 7; + this->csAnimIndex = ENGK_ANIM_7; + this->animIndex = ENGK_ANIM_7; break; case 4: - this->unk_31A = 3; - this->unk_2E4 = 3; + this->csAnimIndex = ENGK_ANIM_3; + this->animIndex = ENGK_ANIM_3; break; case 5: - this->unk_31A = 1; - this->unk_2E4 = 1; + this->csAnimIndex = ENGK_ANIM_1; + this->animIndex = ENGK_ANIM_1; this->unk_1E4 |= 0x80; this->actionFunc = func_80B5227C; break; case 6: - this->unk_31A = 12; - this->unk_2E4 = 12; + this->csAnimIndex = ENGK_ANIM_12; + this->animIndex = ENGK_ANIM_12; break; case 7: - Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); + Flags_SetSwitch(play, ENGK_GET_SWITCH_FLAG(&this->actor)); + break; + + default: break; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_31A); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex); } - if (this->unk_31A == 7) { + if (this->csAnimIndex == ENGK_ANIM_7) { func_80B51308(this, play); } @@ -593,44 +633,47 @@ void func_80B51510(EnGk* this, PlayState* play) { } void func_80B51698(EnGk* this, PlayState* play) { - s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (sp26 == lastFrame) { - switch (this->unk_2E4) { - case 0: - this->unk_2E4 = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + if (curFrame == endFrame) { + switch (this->animIndex) { + case ENGK_ANIM_0: + this->animIndex = ENGK_ANIM_2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_2); this->actionFunc = func_80B5216C; break; - case 2: - this->unk_2E4 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + case ENGK_ANIM_2: + this->animIndex = ENGK_ANIM_0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0); this->actionFunc = func_80B5202C; break; + + default: + break; } } } void func_80B51760(EnGk* this, PlayState* play) { - s16 sp2E = this->skelAnime.curFrame; - s16 lastFrame; + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame; - if (this->unk_2E4 == 11) { - lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); - if (sp2E == lastFrame) { - this->unk_2E4 = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4); + if (this->animIndex == ENGK_ANIM_11) { + endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + if (curFrame == endFrame) { + this->animIndex = ENGK_ANIM_5; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } - } else if (this->unk_2E4 == 10) { - lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); - if (sp2E == lastFrame) { - this->unk_2E4 = 11; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4); + } else if (this->animIndex == ENGK_ANIM_10) { + endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + if (curFrame == endFrame) { + this->animIndex = ENGK_ANIM_11; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } } else { - if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { + if (Flags_GetSwitch(play, ENGK_GET_SWITCH_FLAG(&this->actor))) { SET_WEEKEVENTREG(WEEKEVENTREG_40_40); this->actionFunc = func_80B51D9C; return; @@ -642,12 +685,12 @@ void func_80B51760(EnGk* this, PlayState* play) { Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B51970; if (this->unk_31C == 0xE81) { - this->unk_2E4 = 0; + this->animIndex = ENGK_ANIM_0; this->unk_1E4 |= 2; } - } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && + } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) && (gSaveContext.save.entrance != ENTRANCE(GORON_RACETRACK, 1))) { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } if (this->unk_1E4 & 4) { @@ -672,7 +715,7 @@ void func_80B51970(EnGk* this, PlayState* play) { if (this->unk_1E4 & 1) { this->unk_1E4 &= ~1; this->unk_1E4 &= ~4; - if (this->unk_2E4 == 10) { + if (this->animIndex == ENGK_ANIM_10) { this->unk_1E4 &= ~2; } this->actionFunc = func_80B51760; @@ -689,11 +732,11 @@ void func_80B51970(EnGk* this, PlayState* play) { } if (this->unk_1E4 & 2) { - func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); - if (this->unk_2E4 != 10) { - if (this->unk_2E4 != 9) { - this->unk_2E4 = 9; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); + Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); + if (this->animIndex != ENGK_ANIM_10) { + if (this->animIndex != ENGK_ANIM_9) { + this->animIndex = ENGK_ANIM_9; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9); } else { func_80B51398(this, play); } @@ -702,7 +745,7 @@ void func_80B51970(EnGk* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->unk_2E4 == 6) { + if (this->animIndex == ENGK_ANIM_6) { func_80B50954(this); } } @@ -716,7 +759,7 @@ void func_80B51B40(EnGk* this, PlayState* play) { this->unk_1E4 &= ~1; this->unk_1E4 &= ~4; - if (this->unk_2E4 == 10) { + if (this->animIndex == ENGK_ANIM_10) { this->unk_1E4 &= ~2; } @@ -741,25 +784,28 @@ void func_80B51B40(EnGk* this, PlayState* play) { } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->unk_31C = 0xE8E; Message_StartTextbox(play, this->unk_31C, &this->actor); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->unk_31C = 0xE8A; Message_StartTextbox(play, this->unk_31C, &this->actor); break; + + default: + break; } } if (this->unk_1E4 & 2) { - func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); - if (this->unk_2E4 != 10) { - if (this->unk_2E4 != 9) { - this->unk_2E4 = 9; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); + Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); + if (this->animIndex != ENGK_ANIM_10) { + if (this->animIndex != ENGK_ANIM_9) { + this->animIndex = ENGK_ANIM_9; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9); } else { func_80B51398(this, play); } @@ -777,8 +823,8 @@ void func_80B51D9C(EnGk* this, PlayState* play) { CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); if (this->unk_1E4 & 4) { this->unk_1E4 &= ~4; - this->unk_2E4 = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + this->animIndex = ENGK_ANIM_6; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_6); this->actionFunc = func_80B51EA4; } else { this->unk_1E4 |= 4; @@ -832,7 +878,7 @@ void func_80B51EA4(EnGk* this, PlayState* play) { void func_80B51FD0(EnGk* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON)) { if (this->unk_1E4 & 2) { - func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); + Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } else { this->unk_1E4 |= 2; } @@ -850,8 +896,8 @@ void func_80B5202C(EnGk* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SET_WEEKEVENTREG(WEEKEVENTREG_24_80); this->actionFunc = func_80B51698; - } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); if (player->transformation == PLAYER_FORM_GORON) { this->actor.textId = 0xE74; } else { @@ -860,9 +906,9 @@ void func_80B5202C(EnGk* this, PlayState* play) { } if (this->unk_1E4 & 2) { - if ((play->msgCtx.ocarinaMode != 1) && (play->msgCtx.ocarinaMode != 3) && + if ((play->msgCtx.ocarinaMode != OCARINA_MODE_ACTIVE) && (play->msgCtx.ocarinaMode != OCARINA_MODE_EVENT) && (play->csCtx.state == CS_STATE_IDLE)) { - func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); + Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } } else { this->unk_1E4 |= 2; @@ -872,28 +918,28 @@ void func_80B5202C(EnGk* this, PlayState* play) { void func_80B5216C(EnGk* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80B51698; } } void func_80B521E8(EnGk* this, PlayState* play) { - s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (sp1E == lastFrame) { - this->unk_2E4 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + if (curFrame == endFrame) { + this->animIndex = ENGK_ANIM_1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_1); this->actionFunc = func_80B5227C; } } void func_80B5227C(EnGk* this, PlayState* play) { - s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if ((sp26 + 1) == lastFrame) { + if (curFrame == (endFrame - 1)) { func_800B14D4(play, 20.0f, &this->actor.home.pos); this->unk_350 = 60; if (!(this->unk_1E4 & 0x80)) { @@ -919,7 +965,7 @@ void func_80B52340(EnGk* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -947,6 +993,9 @@ void func_80B52430(EnGk* this, PlayState* play) { this->unk_1E4 &= ~4; this->actionFunc = func_80B51760; return; + + default: + break; } } @@ -980,7 +1029,7 @@ void func_80B525E0(EnGk* this, PlayState* play) { Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B52430; } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1004,7 +1053,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { EnGk* this = THIS; SkelAnime_InitFlex(play, &this->skelAnime, &object_gk_Skel_0079C0, &object_gk_Anim_00787C, this->jointTable, - this->morphTable, 20); + this->morphTable, OBJECT_GK_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -1018,16 +1067,16 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; if (ENGK_GET_F(&this->actor) == ENGK_F_1) { - this->unk_2E4 = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + this->animIndex = ENGK_ANIM_5; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_5); if (play->sceneId == SCENE_17SETUGEN2) { - if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { + if (Flags_GetSwitch(play, ENGK_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); - } else { - this->csId = this->actor.csId; - this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE); - this->actionFunc = func_80B51760; + return; } + this->csId = this->actor.csId; + this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE); + this->actionFunc = func_80B51760; } else if (play->sceneId == SCENE_GORONRACE) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { @@ -1048,16 +1097,16 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80B51FD0; this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { Actor_Kill(&this->actor); } } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON)) { - this->unk_2E4 = 0; + this->animIndex = ENGK_ANIM_0; this->csId = this->actor.csId; this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0); this->actionFunc = func_80B5202C; } else { this->actionFunc = func_80B52654; @@ -1110,7 +1159,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, sp28.x = 1100.0f; sp28.z = -500.0f; - if (this->unk_2E4 == 0) { + if (this->animIndex == ENGK_ANIM_0) { sp34.y = -100.0f; sp28.y = -100.0f; @@ -1120,7 +1169,8 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, sp4C = sp40; sp4C.x *= -1.0f; - } else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) { + } else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) || + (this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) { sp34.y = 400.0f; sp28.y = 400.0f; @@ -1132,7 +1182,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, sp4C.x *= -1.0f; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_GK_LIMB_11) { if (ENGK_GET_F(&this->actor) == ENGK_F_1) { phi_f0 = 100.0f; } else { @@ -1163,7 +1213,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { s32 phi_v1; switch (limbIndex) { - case 18: + case OBJECT_GK_LIMB_12: if (this->unk_1E4 & 8) { phi_v1 = true; } else { @@ -1190,7 +1240,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { Matrix_Push(); break; - case 9: + case OBJECT_GK_LIMB_09: if (this->unk_1E4 & 8) { phi_v1 = true; } else { @@ -1215,6 +1265,9 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { Matrix_Push(); break; + + default: + break; } } @@ -1259,8 +1312,9 @@ void EnGk_Draw(Actor* thisx, PlayState* play) { if (ENGK_GET_F(&this->actor) != ENGK_F_2) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); - if ((this->unk_2E4 == 0) || (this->unk_2E4 == 1) || (this->unk_2E4 == 2) || (this->unk_2E4 == 3) || - (this->unk_2E4 == 4)) { + if ((this->animIndex == ENGK_ANIM_0) || (this->animIndex == ENGK_ANIM_1) || + (this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_3) || + (this->animIndex == ENGK_ANIM_4)) { pos.x = this->actor.world.pos.x - 15.0f; pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.h b/src/overlays/actors/ovl_En_Gk/z_en_gk.h index 130b97675..b9d237cd5 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.h +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.h @@ -2,6 +2,7 @@ #define Z_EN_GK_H #include "global.h" +#include "objects/object_gk/object_gk.h" struct EnGk; @@ -9,7 +10,7 @@ typedef void (*EnGkActionFunc)(struct EnGk*, PlayState*); #define ENGK_GET_F(thisx) ((thisx)->params & 0xF) #define ENGK_GET_PATH_INDEX(thisx) (((thisx)->params & 0xF0) >> 4) -#define ENGK_GET_3F00(thisx) (((thisx)->params & 0x3F00) >> 8) +#define ENGK_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x3F00) >> 8) #define ENGK_PATH_INDEX_NONE 0xF @@ -32,17 +33,17 @@ typedef struct EnGk { /* 0x1E4 */ u16 unk_1E4; /* 0x1E8 */ Path* path; /* 0x1EC */ s32 unk_1EC; - /* 0x1F0 */ Vec3s jointTable[20]; - /* 0x1F0 */ Vec3s morphTable[20]; + /* 0x1F0 */ Vec3s jointTable[OBJECT_GK_LIMB_MAX]; + /* 0x1F0 */ Vec3s morphTable[OBJECT_GK_LIMB_MAX]; /* 0x2E0 */ s16 unk_2E0; /* 0x2E2 */ s16 unk_2E2; - /* 0x2E4 */ s16 unk_2E4; + /* 0x2E4 */ s16 animIndex; /* 0x2E8 */ Vec3f unk_2E8; /* 0x2F4 */ Vec3f unk_2F4; /* 0x300 */ Vec3f unk_300; /* 0x30C */ Vec3f unk_30C; /* 0x318 */ s16 csId; - /* 0x31A */ u8 unk_31A; + /* 0x31A */ u8 csAnimIndex; /* 0x31B */ u8 cueId; /* 0x31C */ u16 unk_31C; /* 0x31E */ s16 unk_31E; 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 bcdb20431..ca38f91ef 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -6,9 +6,8 @@ #include "z_en_gm.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/object_in2/object_in2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnGm*)thisx) @@ -209,20 +208,38 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -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 }, - { &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 }, - { &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +typedef enum { + /* -1 */ ENGM_ANIM_NONE = -1, + /* 0x0 */ ENGM_ANIM_0, + /* 0x1 */ ENGM_ANIM_1, + /* 0x2 */ ENGM_ANIM_2, + /* 0x3 */ ENGM_ANIM_3, + /* 0x4 */ ENGM_ANIM_4, + /* 0x5 */ ENGM_ANIM_5, + /* 0x6 */ ENGM_ANIM_6, + /* 0x7 */ ENGM_ANIM_7, + /* 0x8 */ ENGM_ANIM_8, + /* 0x9 */ ENGM_ANIM_9, + /* 0xA */ ENGM_ANIM_10, + /* 0xB */ ENGM_ANIM_11, + /* 0xC */ ENGM_ANIM_12, + /* 0xD */ ENGM_ANIM_MAX +} EnGmAnimation; + +static AnimationInfoS sAnimationInfo[ENGM_ANIM_MAX] = { + { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_0 + { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_1 + { &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_2 + { &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_3 + { &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_4 + { &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_5 + { &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_6 + { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_7 + { &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_8 + { &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGM_ANIM_9 + { &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_10 + { &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_11 + { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_12 }; Actor* func_8094DEE0(EnGm* this, PlayState* play, u8 arg2, s16 arg3) { @@ -286,43 +303,43 @@ EnDoor* func_8094DF90(PlayState* play, s32 arg1) { return SubS_FindDoor(play, phi_a1); } -s32 func_8094DFF8(EnGm* this, PlayState* play) { - s32 ret = false; +s32 EnGm_UpdateSkelAnime(EnGm* this, PlayState* play) { + s32 isAnimFinished = false; - if (this->unk_262 < 0) { + if (this->objectSlot <= OBJECT_SLOT_NONE) { return false; } - if (this->unk_262 >= 0) { - this->skelAnime.playSpeed = this->unk_3A8; - ret = SkelAnime_Update(&this->skelAnime); + if (this->objectSlot > OBJECT_SLOT_NONE) { + this->skelAnime.playSpeed = this->animPlaySpeed; + isAnimFinished = SkelAnime_Update(&this->skelAnime); } - return ret; + return isAnimFinished; } -s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { - s8 tmp = this->unk_262; - s32 phi_v1 = false; - s32 ret = false; +s32 EnGm_ChangeAnim(EnGm* this, PlayState* play, s32 animIndex) { + s8 tmp = this->objectSlot; + s32 changeAnim = false; + s32 didAnimChange = false; - if ((arg2 == 0) || (arg2 == 1)) { - if ((this->unk_3E8 != 0) && (this->unk_3E8 != 1)) { - phi_v1 = true; + if ((animIndex == ENGM_ANIM_0) || (animIndex == ENGM_ANIM_1)) { + if ((this->animIndex != ENGM_ANIM_0) && (this->animIndex != ENGM_ANIM_1)) { + changeAnim = true; } - } else if (arg2 != this->unk_3E8) { - phi_v1 = true; + } else if (this->animIndex != animIndex) { + changeAnim = true; } - if (phi_v1) { + if (changeAnim) { if (tmp >= 0) { - this->unk_3E8 = arg2; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2); - this->unk_3A8 = this->skelAnime.playSpeed; + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + this->animPlaySpeed = this->skelAnime.playSpeed; } } - return ret; + return didAnimChange; } s32 func_8094E0F8(EnGm* this, PlayState* play) { @@ -330,7 +347,7 @@ s32 func_8094E0F8(EnGm* this, PlayState* play) { if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.status == 0)) { this->unk_260 = play->roomCtx.curRoom.num; - this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); + this->objectSlot = SubS_GetObjectSlot(OBJECT_IN2, play); this->actor.draw = NULL; this->unk_3FC = 1; } @@ -339,7 +356,7 @@ s32 func_8094E0F8(EnGm* this, PlayState* play) { return false; } - if ((this->unk_262 < 0) || !SubS_IsObjectLoaded(this->unk_262, play)) { + if ((this->objectSlot <= OBJECT_SLOT_NONE) || !SubS_IsObjectLoaded(this->objectSlot, play)) { ret = true; } else { this->actor.draw = EnGm_Draw; @@ -486,6 +503,9 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { this->unk_3E0++; ret = true; break; + + default: + break; } return ret; @@ -502,7 +522,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { switch (this->unk_3E0) { case 0: Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); - func_8094E054(this, play, 2); + EnGm_ChangeAnim(this, play, ENGM_ANIM_2); this->unk_3E2 = 0; this->unk_3E0++; break; @@ -558,6 +578,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { this->unk_3E2 = 0; this->unk_3E0++; break; + case 9: sp48 = this->actor.world.rot.y; this->unk_3E2++; @@ -565,13 +586,16 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, sp48, 3, 0x2AA8); this->unk_3A4 &= ~0x20; } else { - func_8094E054(this, play, 1); + EnGm_ChangeAnim(this, play, ENGM_ANIM_1); this->actor.shape.rot.y = sp48; this->unk_3E0++; this->unk_3E2 = 0; ret = true; } break; + + default: + break; } return ret; } @@ -639,7 +663,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) { break; } Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); - func_8094E054(this, play, 2); + EnGm_ChangeAnim(this, play, ENGM_ANIM_2); this->unk_3E2 = 0; this->unk_3E0++; @@ -669,7 +693,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, oldYaw, 3, 0x2AA8); this->unk_3A4 &= ~0x20; } else { - func_8094E054(this, play, 1); + EnGm_ChangeAnim(this, play, ENGM_ANIM_1); this->actor.shape.rot.y = oldYaw; this->unk_3E2 = 0; this->unk_3E0++; @@ -732,28 +756,27 @@ s32* func_8094EDBC(EnGm* this, PlayState* play) { s32 func_8094EE84(EnGm* this, PlayState* play) { s32 ret = false; - if (this->unk_3A4 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_3A4, 0, 7); - this->unk_3E0 = 0; - this->unk_3E4 = NULL; - this->actor.child = this->unk_268; - this->unk_264 = func_8094EDBC(this, play); + if (((this->unk_3A4 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->unk_3E0 = 0; + this->unk_3E4 = NULL; + this->actor.child = this->unk_268; + this->unk_264 = func_8094EDBC(this, play); - if ((this->unk_258 == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { - this->unk_3A4 |= 0x20; - } else if ((this->unk_258 != 1) && (this->unk_258 != 5) && (this->unk_258 != 7)) { - this->unk_3A4 |= 0x20; - } - - if ((this->unk_258 == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01)) { - this->unk_3A4 &= ~0x20; - } - - this->actionFunc = func_80950DB8; - ret = true; + if ((this->unk_258 == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { + this->unk_3A4 |= 0x20; + } else if ((this->unk_258 != 1) && (this->unk_258 != 5) && (this->unk_258 != 7)) { + this->unk_3A4 |= 0x20; } + + if ((this->unk_258 == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01)) { + this->unk_3A4 &= ~0x20; + } + + this->actionFunc = func_80950DB8; + ret = true; } return ret; } @@ -764,7 +787,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { if (this->unk_3F8 == 0) { if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) { - func_8094E054(this, play, 0); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); this->unk_258 = 255; } this->cueId = 255; @@ -822,7 +845,7 @@ void func_8094F0E0(EnGm* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_268->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_268)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_268)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_268->focus.pos); } @@ -880,9 +903,9 @@ void func_8094F3D0(EnGm* this, PlayState* play) { } s32 func_8094F4EC(EnGm* this, PlayState* play) { - if ((this->unk_258 != 6) && (this->unk_3E8 == 12)) { + if ((this->unk_258 != 6) && (this->animIndex == ENGM_ANIM_12)) { this->unk_3A4 &= ~0x2000; - func_8094E054(this, play, 8); + EnGm_ChangeAnim(this, play, ENGM_ANIM_8); } return true; } @@ -898,30 +921,30 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { if (this->unk_3A6 != sp32) { switch (sp32) { case 0x2B13: - func_8094E054(this, play, 2); + EnGm_ChangeAnim(this, play, ENGM_ANIM_2); break; case 0x2B14: case 0x2B18: - func_8094E054(this, play, 0); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); break; case 0x2B16: - func_8094E054(this, play, 1); + EnGm_ChangeAnim(this, play, ENGM_ANIM_1); break; case 0x2B15: - func_8094E054(this, play, 5); + EnGm_ChangeAnim(this, play, ENGM_ANIM_5); break; case 0x2B17: - func_8094E054(this, play, 6); + EnGm_ChangeAnim(this, play, ENGM_ANIM_6); break; default: - if ((this->unk_3E8 == 7) || (this->unk_3E8 == 8)) { + if ((this->animIndex == ENGM_ANIM_7) || (this->animIndex == ENGM_ANIM_8)) { this->unk_3A4 |= 0x2000; - func_8094E054(this, play, 12); + EnGm_ChangeAnim(this, play, ENGM_ANIM_12); } break; } @@ -942,6 +965,9 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { this->unk_268 = toto; } break; + + default: + break; } if (sp32 == 0x2AA8) { @@ -964,7 +990,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { this->unk_18C(this, play); } - if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) && + if ((this->animIndex == ENGM_ANIM_6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) && Animation_OnFrame(&this->skelAnime, 20.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); } @@ -1037,10 +1063,10 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_3B8 = scheduleOutput->time1 - scheduleOutput->time0; this->unk_3BA = sp56 - scheduleOutput->time0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; - func_8094E054(this, play, 7); + EnGm_ChangeAnim(this, play, ENGM_ANIM_7); this->actor.gravity = 0.0f; ret = true; } @@ -1085,10 +1111,10 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk_3A4 &= ~0x8; this->unk_3A4 &= ~0x10; - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; - func_8094E054(this, play, 7); + EnGm_ChangeAnim(this, play, ENGM_ANIM_7); this->actor.gravity = -1.0f; ret = true; } @@ -1102,10 +1128,10 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TAB)) { if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); - func_8094E054(this, play, 0); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); } else { - func_8094E054(this, play, 9); + EnGm_ChangeAnim(this, play, ENGM_ANIM_9); this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE; } this->unk_3A4 |= 0x100; @@ -1119,8 +1145,8 @@ s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { - func_8094E054(this, play, 11); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + EnGm_ChangeAnim(this, play, ENGM_ANIM_11); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; ret = true; @@ -1135,8 +1161,8 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { - func_8094E054(this, play, 11); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + EnGm_ChangeAnim(this, play, ENGM_ANIM_11); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_268 = al; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_20)) { this->unk_3C8 = 2; @@ -1173,15 +1199,15 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp3C, &sp30); if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D9C); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; - func_8094E054(this, play, 0); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); func_8094E278(play); } else { Math_Vec3f_Copy(&this->actor.world.pos, &sp30); - func_8094E054(this, play, 9); + EnGm_ChangeAnim(this, play, ENGM_ANIM_9); this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE; } this->unk_400 = 0; @@ -1200,10 +1226,10 @@ s32 func_80950088(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951DA8); Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DB4); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3A4 |= (0x2000 | 0x100); this->unk_3A4 |= 0x200; - func_8094E054(this, play, 12); + EnGm_ChangeAnim(this, play, ENGM_ANIM_12); return true; } @@ -1215,10 +1241,10 @@ s32 func_80950120(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951DBC); Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DC8); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3A4 |= (0x800 | 0x100); this->unk_3A4 |= 0x200; - func_8094E054(this, play, 4); + EnGm_ChangeAnim(this, play, ENGM_ANIM_4); return true; } @@ -1230,24 +1256,24 @@ s32 func_809501B8(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951DD0); Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DDC); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - this->actor.targetMode = 6; - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + this->actor.targetMode = TARGET_MODE_6; + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3A4 |= (0x1000 | 0x100); this->unk_3A4 |= 0x200; this->unk_3C8 = 3; this->unk_3CA = 3; this->unk_3CC = 8; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->unk_3B4 = 60.0f; - func_8094E054(this, play, 10); + EnGm_ChangeAnim(this, play, ENGM_ANIM_10); return true; } s32 func_80950280(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 phi_v1; - this->actor.flags |= ACTOR_FLAG_1; - this->actor.targetMode = 0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_0; this->unk_3A4 = 0; this->unk_3C8 = 0; this->unk_3CA = 0; @@ -1335,11 +1361,11 @@ s32 func_80950388(EnGm* this, PlayState* play) { s32 func_809503F8(EnGm* this, PlayState* play) { s32 pad; - if (this->unk_3E8 == 9) { + if (this->animIndex == ENGM_ANIM_9) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - SubS_UpdateFlags(&this->unk_3A4, 3, 7); - func_8094E054(this, play, 0); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); } else { AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } @@ -1349,7 +1375,8 @@ s32 func_809503F8(EnGm* this, PlayState* play) { s32 func_80950490(EnGm* this, PlayState* play) { static s32 D_80951DE4[] = { - 1, 5, 5, 1, 6, 5, 1, 5, 6, 1, 5, 6, + ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_5, ENGM_ANIM_1, ENGM_ANIM_6, ENGM_ANIM_5, + ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6, ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6, }; s32 pad; @@ -1359,32 +1386,32 @@ s32 func_80950490(EnGm* this, PlayState* play) { this->unk_3CA = 1; this->unk_3CC = 8; this->unk_400 = 1; - func_8094E054(this, play, 3); + EnGm_ChangeAnim(this, play, ENGM_ANIM_3); } return false; } this->unk_400 = 0; - switch (this->unk_3E8) { - case 9: + switch (this->animIndex) { + case ENGM_ANIM_9: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; - func_8094E054(this, play, 0); + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); func_8094E278(play); } else { AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } break; - case 5: - case 6: + case ENGM_ANIM_5: + case ENGM_ANIM_6: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_8094E054(this, play, D_80951DE4[this->unk_3F4]); + EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]); this->unk_3F4++; this->unk_3F4 %= 12; this->unk_3DE = Rand_S16Offset(30, 30); @@ -1393,7 +1420,7 @@ s32 func_80950490(EnGm* this, PlayState* play) { default: if (DECR(this->unk_3DE) == 0) { - func_8094E054(this, play, D_80951DE4[this->unk_3F4]); + EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]); this->unk_3F4++; this->unk_3F4 %= 12; this->unk_3DE = Rand_S16Offset(30, 30); @@ -1434,10 +1461,11 @@ s32 func_80950690(EnGm* this, PlayState* play) { break; case 8: + default: break; } - SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGM_FIDGET_TABLE_LEN); return false; } @@ -1575,6 +1603,9 @@ void func_80950C24(EnGm* this, PlayState* play) { case 30: func_8095097C(this, play); break; + + default: + break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); @@ -1588,11 +1619,11 @@ void func_80950CDC(EnGm* this, PlayState* play) { if (!Schedule_RunScript(play, D_80951820, &sp20) || ((this->unk_258 != sp20.result) && !func_80950280(this, play, &sp20))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sp20.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_258 = sp20.result; this->unk_268 = func_8094F074(this, play); @@ -1606,7 +1637,7 @@ void func_80950DB8(EnGm* this, PlayState* play) { Actor* al; if (func_8010BF58(&this->actor, play, this->unk_264, this->unk_3E4, &this->unk_25C)) { - SubS_UpdateFlags(&this->unk_3A4, 3, 7); + SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); if ((this->unk_258 == 2) && (al != NULL) && (al->update != NULL)) { this->unk_268 = al; @@ -1626,11 +1657,11 @@ void func_80950DB8(EnGm* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp34, &sp40), 4, 0x2AA8); } } - SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGM_FIDGET_TABLE_LEN); } void func_80950F2C(EnGm* this, PlayState* play) { - s32 sp50[] = { 0, 0, 3, 2 }; + s32 csAnimIndex[] = { ENGM_ANIM_0, ENGM_ANIM_0, ENGM_ANIM_3, ENGM_ANIM_2 }; Player* player = GET_PLAYER(play); s32 pad; Vec3f sp3C; @@ -1645,7 +1676,7 @@ void func_80950F2C(EnGm* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); } this->cueId = cueId; - func_8094E054(this, play, sp50[cueId]); + EnGm_ChangeAnim(this, play, csAnimIndex[cueId]); } if ((this->cueId == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) { @@ -1671,9 +1702,10 @@ void EnGm_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, 20); - this->unk_3E8 = -1; - func_8094E054(this, play, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, + OBJECT_IN2_LIMB_MAX); + this->animIndex = ENGM_ANIM_NONE; + EnGm_ChangeAnim(this, play, ENGM_ANIM_0); Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); @@ -1699,7 +1731,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) { if (!func_8094E0F8(this, play)) { if (!func_8094EE84(this, play) && func_8094EFC4(this, play)) { func_80950F2C(this, play); - func_8094DFF8(this, play); + EnGm_UpdateSkelAnime(this, play); func_8094E2D0(this); return; } @@ -1709,10 +1741,10 @@ void EnGm_Update(Actor* thisx, PlayState* play) { func_8094F53C(this, play); if (this->unk_258 != 0) { - func_8094DFF8(this, play); + EnGm_UpdateSkelAnime(this, play); func_8094E2D0(this); func_8094F2E8(this); - func_8013C964(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & 7); + SubS_Offer(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & SUBS_OFFER_MODE_MASK); 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, UPDBGCHECKINFO_FLAG_4); @@ -1725,33 +1757,33 @@ void EnGm_Update(Actor* thisx, PlayState* play) { s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; EnGm* this = THIS; - s32 phi_v0; + s32 fidgetIndex; - if (limbIndex == 16) { + if (limbIndex == OBJECT_IN2_LIMB_10) { func_8094F3D0(this, play); } switch (limbIndex) { - case 9: - phi_v0 = 0; + case OBJECT_IN2_LIMB_09: + fidgetIndex = 0; break; - case 10: - phi_v0 = 1; + case OBJECT_IN2_LIMB_0A: + fidgetIndex = 1; break; - case 13: - phi_v0 = 2; + case OBJECT_IN2_LIMB_0D: + fidgetIndex = 2; break; default: - phi_v0 = 9; + fidgetIndex = 9; break; } - if ((this->unk_3A4 & 0x2000) && (phi_v0 < 9)) { - rot->y += (s16)(Math_SinS(this->unk_3D8[phi_v0]) * 200.0f); - rot->z += (s16)(Math_CosS(this->unk_3D2[phi_v0]) * 200.0f); + if ((this->unk_3A4 & 0x2000) && (fidgetIndex < 9)) { + rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f); } return false; @@ -1764,20 +1796,20 @@ void EnGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp30; s32 pad2; - if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == 16)) { + if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == OBJECT_IN2_LIMB_10)) { Matrix_MultVec3f(&D_80951E24, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } OPEN_DISPS(play->state.gfxCtx); - if ((limbIndex == 15) && (this->unk_3A4 & 0x800)) { + if ((limbIndex == OBJECT_IN2_LIMB_0F) && (this->unk_3A4 & 0x800)) { gSPDisplayList(POLY_OPA_DISP++, object_in2_DL_007528); } CLOSE_DISPS(play->state.gfxCtx); - if (limbIndex == 9) { + if (limbIndex == OBJECT_IN2_LIMB_09) { Matrix_MultVec3f(&gZeroVec3f, &sp30); Math_Vec3f_ToVec3s(&this->colliderSphere.dim.worldSphere.center, &sp30); } @@ -1800,7 +1832,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { overrideRot = false; } - if (limbIndex == 16) { + if (limbIndex == OBJECT_IN2_LIMB_10) { SubS_UpdateLimb(BINANG_ADD(this->unk_3BC + this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3BE + this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_290, &this->unk_2A8, stepRot, overrideRot); @@ -1811,7 +1843,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { Matrix_RotateXS(this->unk_2A8.x, MTXMODE_APPLY); Matrix_RotateZS(this->unk_2A8.z, MTXMODE_APPLY); Matrix_Push(); - } else if (limbIndex == 9) { + } else if (limbIndex == OBJECT_IN2_LIMB_09) { SubS_UpdateLimb(BINANG_ADD(this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_29C, &this->unk_2AE, stepRot, overrideRot); Matrix_Pop(); @@ -1825,11 +1857,13 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } void EnGm_Draw(Actor* thisx, PlayState* play) { - static TexturePtr D_80951E30[] = { object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828, - object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68 }; + static TexturePtr D_80951E30[] = { + object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828, + object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68, + }; EnGm* this = THIS; - if ((this->unk_258 != 0) && (this->unk_262 >= 0)) { + if ((this->unk_258 != 0) && (this->objectSlot > OBJECT_SLOT_NONE)) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 760c9d91c..e5785d837 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -2,6 +2,7 @@ #define Z_EN_GM_H #include "global.h" +#include "objects/object_in2/object_in2.h" struct EnGm; @@ -11,6 +12,8 @@ typedef void (*EnGmUnkFunc2)(struct EnGm*, PlayState*); #define ENGM_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) +#define ENGM_FIDGET_TABLE_LEN 3 + typedef struct EnGm { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -30,7 +33,7 @@ typedef struct EnGm { /* 0x25C */ s32 unk_25C; /* 0x260 */ s8 unk_260; /* 0x261 */ s8 unk_261; - /* 0x262 */ s8 unk_262; + /* 0x262 */ s8 objectSlot; /* 0x264 */ s32* unk_264; /* 0x268 */ Actor* unk_268; /* 0x26C */ UNK_TYPE1 unk_26C[0xC]; @@ -40,11 +43,11 @@ typedef struct EnGm { /* 0x29C */ Vec3f unk_29C; /* 0x2A8 */ Vec3s unk_2A8; /* 0x2AE */ Vec3s unk_2AE; - /* 0x2B4 */ Vec3s jointTable[20]; - /* 0x32C */ Vec3s morphTable[20]; + /* 0x2B4 */ Vec3s jointTable[OBJECT_IN2_LIMB_MAX]; + /* 0x32C */ Vec3s morphTable[OBJECT_IN2_LIMB_MAX]; /* 0x3A4 */ u16 unk_3A4; /* 0x3A6 */ u16 unk_3A6; - /* 0x3A8 */ f32 unk_3A8; + /* 0x3A8 */ f32 animPlaySpeed; /* 0x3AC */ f32 unk_3AC; /* 0x3B0 */ f32 unk_3B0; /* 0x3B4 */ f32 unk_3B4; @@ -61,13 +64,13 @@ typedef struct EnGm { /* 0x3CC */ s16 unk_3CC; /* 0x3CE */ s16 unk_3CE; /* 0x3D0 */ s16 unk_3D0; - /* 0x3D2 */ s16 unk_3D2[3]; - /* 0x3D8 */ s16 unk_3D8[3]; + /* 0x3D2 */ s16 fidgetTableZ[ENGM_FIDGET_TABLE_LEN]; + /* 0x3D8 */ s16 fidgetTableY[ENGM_FIDGET_TABLE_LEN]; /* 0x3DE */ s16 unk_3DE; /* 0x3E0 */ s16 unk_3E0; /* 0x3E2 */ s16 unk_3E2; /* 0x3E4 */ EnGmUnkFunc unk_3E4; - /* 0x3E8 */ s32 unk_3E8; + /* 0x3E8 */ s32 animIndex; /* 0x3EC */ UNK_TYPE1 unk3EC[0x4]; /* 0x3F0 */ s32 prevTalkState; /* 0x3F4 */ s32 unk_3F4; 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 216d5c301..691703307 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -20,7 +20,8 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) + #define THIS ((EnGo*)thisx) #define ENGO_STANDING_Y_OFFSET 0.0f // Actor shape offset in use when a Goron is in any standing state. @@ -81,8 +82,8 @@ typedef enum EnGoEffectType { /* 7 */ ENGO_EFFECT_STEAM = ENGO_EFFECT_STEAM_MIN } EnGoEffectType; -typedef enum EnGoAnimationIndex { - /* -1 */ ENGO_ANIM_INVALID = -1, +typedef enum EnGoAnimation { + /* -1 */ ENGO_ANIM_NONE = -1, /* 0 */ ENGO_ANIM_GORON_MIN, /* 0 */ ENGO_ANIM_LYINGDOWNIDLE = ENGO_ANIM_GORON_MIN, /* 1 */ ENGO_ANIM_LYINGDOWNIDLE_IMM, @@ -94,92 +95,21 @@ typedef enum EnGoAnimationIndex { /* 7 */ ENGO_ANIM_DROPKEG, /* 8 */ ENGO_ANIM_COVEREARS, /* 9 */ ENGO_ANIM_SHIVERINGSURPRISED, - /* 10 */ ENGO_ANIM_ATHLETICS_MIN, - /* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN, - /* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE, - /* 12 */ ENGO_ANIM_SHAKE_LIMBS, - /* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND, - /* 14 */ ENGO_ANIM_SITTING_STRETCH, - /* 15 */ ENGO_ANIM_CHEER, - /* 16 */ ENGO_ANIM_SHOUT, - /* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH, - /* 18 */ ENGO_ANIM_SPRING_MIN, - /* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN, - /* 19 */ ENGO_ANIM_SHOW_LOOPED, - /* 20 */ ENGO_ANIM_LOOK_AROUND, - /* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED -} EnGoAnimationIndex; - -EnGoEffect* EnGo_InitSteam(EnGoEffect effect[], Vec3f pos, Vec3f accel, Vec3f velocity, f32 scale, f32 deltaScale, - s32 maxFrames); -void EnGo_DrawSteam(EnGoEffect effect[], PlayState* play2); - -void EnGo_InitDust(EnGoEffect effect[], Vec3f pos, Vec3f accel, Vec3f vel, f32 scale, f32 deltaScale, s32 maxFrames, - EnGoEffectType parentEffectType); -void EnGo_DrawDust(EnGoEffect effect[], PlayState* play2); - -void EnGo_InitSnow(EnGoEffect effect[], Vec3f pos); -void EnGo_UpdateSnow(EnGoEffect* effect, f32 dustConversionHeight); -void EnGo_DrawSnow(EnGoEffect effect[], PlayState* play, Gfx* material, Gfx* model, u8 effectType); - -void EnGo_UpdateEffects(EnGo* this); -void EnGo_DrawEffects(EnGo* this, PlayState* play); - -s32 EnGo_CanSnowballHurtPlayer(PlayState* play); -s32 EnGo_IsFallingAsleep(EnGo* this, PlayState* play); - -s32 EnGo_UpdateFocus(EnGo* this); - -void EnGo_UpdateSnowballCollider(EnGo* this, PlayState* play); -void EnGo_UpdateMedigoronCollider(EnGo* this, PlayState* play); -void EnGo_UpdateRolledUpCollider(EnGo* this, PlayState* play); -void EnGo_UpdateFrozenCollider(EnGo* this, PlayState* play); -void EnGo_UpdateStandingCollider(EnGo* this, PlayState* play); -void EnGo_UpdateCollider(EnGo* this, PlayState* play); - -s32 EnGo_UpdateTalking(EnGo* this, PlayState* play); -s32 EnGo_DetectCollisions(EnGo* this, PlayState* play); -s32 EnGo_UpdateSpringArrivalCutscene(EnGo* this, PlayState* play); -s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play); -s32 EnGo_UpdateSfx(EnGo* this, PlayState* play); -s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex); -void EnGo_UpdateEyes(EnGo* this); - -void EnGo_UpdateShiverSurprisedAnimation(EnGo* this, PlayState* play); -s32 EnGo_UpdateGraveyardAttentionTargetAndReactions(EnGo* this, PlayState* play); -s32 EnGo_UpdateRotationToTarget(EnGo* this, PlayState* play); -s32 EnGo_UpdateAttentionTargetAndReactions(EnGo* this, PlayState* play); - -void EnGo_GravemakerIdle(EnGo* this, PlayState* play); -void EnGo_FrozenIdle(EnGo* this, PlayState* play); -Actor* EnGo_FindGravemaker(EnGo* this, PlayState* play); - -void EnGo_UpdateMedigoronColliderRadius(EnGo* this, PlayState* play, s32 isGivenPowderKeg); -s32 EnGo_ChangeCutscene(EnGo* this, s16 csId); - -s32 EnGo_HandleGatekeeperPoundCutscene(EnGo* this, f32 initialVelocity, f32 maxDistortion, s32 maxHangtime); -void EnGo_AddGatekeeperPoundQuake(PlayState* play, s16 speed, s16 verticalMag, s16 countdown); -void EnGo_CreateGatekeeperPoundEffects(EnGo* this, PlayState* play); -void EnGo_DrawIceBlockWhenFrozen(EnGo* this, PlayState* play, f32 scale, f32 alpha); -void EnGo_MakeSteam(EnGo* this); - -s32 EnGo_HandleOpenShrineCutscene(Actor* thisx, PlayState* play); -s32 EnGo_HandleGivePowderKegCutscene(Actor* thisx, PlayState* play); - -void EnGo_ChangeToStretchingAnimation(EnGo* this, PlayState* play); -void EnGo_ChangeToSpectatingAnimation(EnGo* this, PlayState* play); -void EnGo_ChangeToFrozenAnimation(EnGo* this, PlayState* play); -void EnGo_ChangeToSnowballAnimation(EnGo* this, PlayState* play); -void EnGo_ChangeToCoveringEarsAnimation(EnGo* this, PlayState* play); -void EnGo_ChangeToShiveringAnimation(EnGo* this, PlayState* play); - -void EnGo_SetupAthletic(EnGo* this, PlayState* play); -void EnGo_SetupSpectator(EnGo* this, PlayState* play); -void EnGo_SetupGatekeeper(EnGo* this, PlayState* play); -void EnGo_SetupGraveyardGoron(EnGo* this, PlayState* play); -void EnGo_SetupShrineGoron(EnGo* this, PlayState* play); -void EnGo_SetupMedigoron(EnGo* this, PlayState* play); -void EnGo_SetupInitialAction(EnGo* this, PlayState* play); + /* 10 */ ENGO_ANIM_ATHLETICS_MIN, + /* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN, + /* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE, + /* 12 */ ENGO_ANIM_SHAKE_LIMBS, + /* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND, + /* 14 */ ENGO_ANIM_SITTING_STRETCH, + /* 15 */ ENGO_ANIM_CHEER, + /* 16 */ ENGO_ANIM_SHOUT, + /* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH, + /* 18 */ ENGO_ANIM_SPRING_MIN, + /* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN, + /* 19 */ ENGO_ANIM_SHOW_LOOPED, + /* 20 */ ENGO_ANIM_LOOK_AROUND, + /* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED +} EnGoAnimation; void EnGo_Idle(EnGo* this, PlayState* play); void EnGo_Sleep(EnGo* this, PlayState* play); @@ -191,8 +121,6 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play); void EnGo_Snowball(EnGo* this, PlayState* play); -s32* EnGo_GetMsgEventScript(EnGo* this, PlayState* play); - void EnGo_Talk(EnGo* this, PlayState* play); // MsgEvent script for the Goron who made Darmani's grave in the mountain village. @@ -381,7 +309,7 @@ static DamageTable sDamageTable = { /** * Animations used in the actor. * - * @see EnGoAnimationIndex + * @see EnGoAnimation */ static AnimationInfoS sAnimationInfo[] = { @@ -461,6 +389,7 @@ void EnGo_DrawSteam(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) { f32 alpha; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); for (i = 0; i < ENGO_EFFECT_COUNT; i++, effect++) { if (effect->type != ENGO_EFFECT_STEAM) { @@ -554,6 +483,7 @@ void EnGo_DrawDust(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) { f32 alpha; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); for (i = 0; i < ENGO_EFFECT_COUNT; i++, effect++) { if ((effect->type < ENGO_EFFECT_DUST_MIN) || (effect->type >= ENGO_EFFECT_STEAM_MIN)) { @@ -599,14 +529,13 @@ void EnGo_DrawDust(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) { * @param effect The EnGoEffect table * @param pos Position around which the effects appear */ -void EnGo_InitSnow(EnGoEffect effect[ENGO_EFFECT_COUNT], Vec3f pos) { - static u8 effectIndexToSnowEffectTable[] = { +void EnGo_InitSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], Vec3f pos) { + static u8 sEffectIndexToSnowEffectTable[ENGO_SNOW_EFFECT_COUNT] = { ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2, ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2, ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2, ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2, }; - EnGoEffect* dustEffects = &effect[ENGO_SNOW_EFFECT_COUNT]; s32 i; Vec3f randRelativeToWorldPos; @@ -641,7 +570,7 @@ void EnGo_InitSnow(EnGoEffect effect[ENGO_EFFECT_COUNT], Vec3f pos) { effect->alphaDenom = effect->alphaNumer = 1; // Assign a snow effect value of 'ENGO_EFFECT_SNOW1'/'2'/'3' - effect->type = effectIndexToSnowEffectTable[i]; + effect->type = sEffectIndexToSnowEffectTable[i]; // Initialize the parameters for the paired element randRelativeToWorldPos.x = ((Rand_ZeroOne() - 0.5f) * 80.0f) + effect->pos.x; @@ -722,7 +651,9 @@ void EnGo_DrawSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], PlayState* play, G u8 isMaterialSet = false; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + for (i = 0; i < ENGO_SNOW_EFFECT_COUNT; i++, effect++) { if (effect->type != effectType) { continue; @@ -817,7 +748,7 @@ s32 EnGo_IsFallingAsleep(EnGo* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 isFallingAsleep = false; - if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) && (this->sleepState == ENGO_AWAKE) && (this->actor.xzDistToPlayer < 400.0f)) || (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON) && (play->sceneId == SCENE_16GORON_HOUSE) && @@ -959,7 +890,8 @@ void EnGo_UpdateCollider(EnGo* this, PlayState* play) { * @return True if talking */ s32 EnGo_UpdateTalking(EnGo* this, PlayState* play) { - if (!(this->actionFlags & 7) || !Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (((this->actionFlags & SUBS_OFFER_MODE_MASK) == SUBS_OFFER_MODE_NONE) || + !Actor_ProcessTalkRequest(&this->actor, &play->state)) { return false; } @@ -976,7 +908,7 @@ s32 EnGo_UpdateTalking(EnGo* this, PlayState* play) { this->actionFlags |= ENGO_FLAG_EYES_OPEN; } - SubS_UpdateFlags(&this->actionFlags, 0, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->cutsceneState = 0; this->gatekeeperAnimState = 0; this->interruptedActionFunc = this->actionFunc; @@ -1021,19 +953,19 @@ s32 EnGo_UpdateSpringArrivalCutscene(EnGo* this, PlayState* play) { if ((ENGO_GET_TYPE(&this->actor) == ENGO_GRAVEYARD) && (play->csCtx.state != CS_STATE_IDLE) && (this->actor.draw != NULL) && (play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { - if (this->springArrivalCutsceneActive == false) { - this->actor.flags &= ~ACTOR_FLAG_1; + if (!this->springArrivalCutsceneActive) { + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->springArrivalCueId = 255; this->springArrivalCutsceneActive = true; this->interruptedActionFunc = this->actionFunc; } - SubS_UpdateFlags(&this->actionFlags, 0, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->actionFunc = EnGo_HandleSpringArrivalCutscene; } else if (this->springArrivalCutsceneActive) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->springArrivalCueId = 255; this->springArrivalCutsceneActive = false; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->actionFunc = this->interruptedActionFunc; } @@ -1045,27 +977,27 @@ s32 EnGo_UpdateSpringArrivalCutscene(EnGo* this, PlayState* play) { * * @return True if non-repeating animation has finished */ -s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) { - s8 objIndex = this->actor.objBankIndex; +s32 EnGo_UpdateSkelAnime(EnGo* this, PlayState* play) { + s8 objectSlot = this->actor.objectSlot; s8 extraObjIndex = -1; - s32 ret = false; + s32 isAnimFinished = false; - if ((this->curAnimIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) { - extraObjIndex = this->hakuginDemoObjIndex; - } else if ((this->curAnimIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) { - extraObjIndex = this->taisouObjIndex; - } else if (this->curAnimIndex < ENGO_ANIM_ATHLETICS_MIN) { - extraObjIndex = this->actor.objBankIndex; + if ((this->animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjectSlot > OBJECT_SLOT_NONE)) { + extraObjIndex = this->hakuginDemoObjectSlot; + } else if ((this->animIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjectSlot > OBJECT_SLOT_NONE)) { + extraObjIndex = this->taisouObjectSlot; + } else if (this->animIndex < ENGO_ANIM_ATHLETICS_MIN) { + extraObjIndex = this->actor.objectSlot; } if (extraObjIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment); - this->skelAnime.playSpeed = this->curAnimPlaySpeed; - ret = SkelAnime_Update(&this->skelAnime); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); + this->skelAnime.playSpeed = this->animPlaySpeed; + isAnimFinished = SkelAnime_Update(&this->skelAnime); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } - return ret; + return isAnimFinished; } /** @@ -1073,7 +1005,7 @@ s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) { */ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) { if (play->csCtx.state == CS_STATE_IDLE) { - if (this->curAnimIndex == ENGO_ANIM_ROLL) { + if (this->animIndex == ENGO_ANIM_ROLL) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE); } @@ -1081,7 +1013,7 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT); } - } else if ((this->curAnimIndex == ENGO_ANIM_UNROLL) || (this->curAnimIndex == ENGO_ANIM_UNROLL_IMM)) { + } else if ((this->animIndex == ENGO_ANIM_UNROLL) || (this->animIndex == ENGO_ANIM_UNROLL_IMM)) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE_OFF); } @@ -1105,28 +1037,28 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) { * * @return True if animation was changed */ -s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex) { - s8 objIndex = this->actor.objBankIndex; +s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimation animIndex) { + s8 objectSlot = this->actor.objectSlot; s8 extraObjIndex = -1; - s32 ret = false; + s32 didAnimChange = false; - if ((animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) { - extraObjIndex = this->hakuginDemoObjIndex; - } else if ((animIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) { - extraObjIndex = this->taisouObjIndex; + if ((animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjectSlot > OBJECT_SLOT_NONE)) { + extraObjIndex = this->hakuginDemoObjectSlot; + } else if ((animIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjectSlot > OBJECT_SLOT_NONE)) { + extraObjIndex = this->taisouObjectSlot; } else if (animIndex < ENGO_ANIM_ATHLETICS_MIN) { - extraObjIndex = this->actor.objBankIndex; + extraObjIndex = this->actor.objectSlot; } if (extraObjIndex >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment); - this->curAnimIndex = animIndex; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); - this->curAnimPlaySpeed = this->skelAnime.playSpeed; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[extraObjIndex].segment); + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + this->animPlaySpeed = this->skelAnime.playSpeed; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } - return ret; + return didAnimChange; } /** @@ -1243,7 +1175,7 @@ s32 EnGo_UpdateRotationToTarget(EnGo* this, PlayState* play) { Math_Vec3f_Copy(&thisPos, &this->actor.focus.pos); if (this->attentionTarget->id == ACTOR_PLAYER) { - targetPos.y = ((Player*)this->attentionTarget)->bodyPartsPos[7].y + 3.0f; + targetPos.y = ((Player*)this->attentionTarget)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&targetPos, &this->attentionTarget->focus.pos); } @@ -1294,13 +1226,13 @@ void EnGo_GravemakerIdle(EnGo* this, PlayState* play) { s16 deltaYaw = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); if ((fabsf(this->actor.playerHeightRel) > 20.0f) || (this->actor.xzDistToPlayer > 300.0f)) { - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else if ((player->transformation != PLAYER_FORM_GORON) || (ABS_ALT(deltaYaw) >= 0x1C70) || CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_GRAVEMAKER_AS_GORON) || CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_THAWED_GRAVEYARD_GORON)) { - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->actionFlags, 4, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); } } @@ -1309,9 +1241,9 @@ void EnGo_GravemakerIdle(EnGo* this, PlayState* play) { */ void EnGo_FrozenIdle(EnGo* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_THAWED_GRAVEYARD_GORON)) { - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->actionFlags, 4, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); } } @@ -1719,14 +1651,14 @@ void EnGo_ChangeToStretchingAnimation(EnGo* this, PlayState* play) { EnGo_ChangeAnim(this, play, sSubtypeToAnimIndex[subtypeLookup]); // Move the sitting Goron forward, since their spawn location is the same as their standing counterpart. - if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) { + if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) { Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &sStretchingGoronOffset, &newSittingStretcherPos); Math_Vec3f_Copy(&this->actor.world.pos, &newSittingStretcherPos); } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, this->scaleFactor); this->sleepState = ENGO_AWAKE; this->actionFlags = 0; @@ -1750,7 +1682,7 @@ void EnGo_ChangeToSpectatingAnimation(EnGo* this, PlayState* play) { animFrame = Rand_ZeroOne() * this->skelAnime.endFrame; this->skelAnime.curFrame = animFrame; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, this->scaleFactor); this->sleepState = ENGO_AWAKE; this->actionFlags = 0; @@ -1769,7 +1701,7 @@ void EnGo_ChangeToSpectatingAnimation(EnGo* this, PlayState* play) { void EnGo_ChangeToFrozenAnimation(EnGo* this, PlayState* play) { Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInitFrozen); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->curAnimIndex = -1; + this->animIndex = ENGO_ANIM_NONE; EnGo_ChangeAnim(this, play, ENGO_ANIM_SHIVER); this->sleepState = ENGO_AWAKE; this->iceBlockScale = (this->scaleFactor / 0.01f) * 0.9f; @@ -1814,7 +1746,7 @@ void EnGo_ChangeToCoveringEarsAnimation(EnGo* this, PlayState* play) { Actor_SetScale(&this->actor, this->scaleFactor); this->actionFlags = 0; this->actor.gravity = -1.0f; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->sleepState = ENGO_AWAKE; this->actionFlags |= ENGO_FLAG_LOST_ATTENTION; this->blinkTimer = 0; @@ -1833,7 +1765,7 @@ void EnGo_ChangeToShiveringAnimation(EnGo* this, PlayState* play) { Actor_SetScale(&this->actor, this->scaleFactor); this->actionFlags = 0; this->actor.gravity = -1.0f; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->sleepState = ENGO_AWAKE; this->actionFlags |= ENGO_FLAG_LOST_ATTENTION; this->actionFlags |= ENGO_FLAG_EYES_OPEN; @@ -1851,7 +1783,7 @@ void EnGo_ChangeToShiveringAnimation(EnGo* this, PlayState* play) { void EnGo_SetupAthletic(EnGo* this, PlayState* play) { if (((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 0)) || (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2))) && - (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE))) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { EnGo_ChangeToStretchingAnimation(this, play); this->actionFunc = EnGo_Idle; } else { @@ -1944,11 +1876,11 @@ void EnGo_SetupMedigoron(EnGo* this, PlayState* play) { EnGo_ChangeAnim(this, play, ENGO_ANIM_LYINGDOWNIDLE); this->scaleFactor *= ENGO_MEDIGORON_SCALE_MULTIPLIER; Actor_SetScale(&this->actor, this->scaleFactor); - this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.targetMode = 3; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_3; this->actionFlags = 0; this->actor.gravity = -1.0f; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->actionFlags |= ENGO_FLAG_LOST_ATTENTION; this->actionFlags |= ENGO_FLAG_EYES_OPEN; this->msgEventFunc = EnGo_HandleGivePowderKegCutscene; @@ -1961,13 +1893,13 @@ void EnGo_SetupMedigoron(EnGo* this, PlayState* play) { void EnGo_SetupInitialAction(EnGo* this, PlayState* play) { EffectTireMarkInit tireMarkInit = { 0, 62, { 0, 0, 15, 100 } }; - if (((this->taisouObjIndex < 0) || SubS_IsObjectLoaded(this->taisouObjIndex, play)) || - ((this->hakuginDemoObjIndex < 0) || SubS_IsObjectLoaded(this->hakuginDemoObjIndex, play))) { + if (((this->taisouObjectSlot <= OBJECT_SLOT_NONE) || SubS_IsObjectLoaded(this->taisouObjectSlot, play)) || + ((this->hakuginDemoObjectSlot <= OBJECT_SLOT_NONE) || SubS_IsObjectLoaded(this->hakuginDemoObjectSlot, play))) { 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); - this->curAnimIndex = ENGO_ANIM_INVALID; + this->animIndex = ENGO_ANIM_NONE; EnGo_ChangeAnim(this, play, ENGO_ANIM_UNROLL); this->actor.draw = EnGo_Draw; @@ -1976,7 +1908,7 @@ void EnGo_SetupInitialAction(EnGo* this, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Effect_Add(play, &this->indexEffect, EFFECT_TIRE_MARK, 0, 0, &tireMarkInit); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->scaleFactor = ENGO_NORMAL_SCALE; this->msgEventFunc = NULL; @@ -2034,7 +1966,7 @@ void EnGo_Idle(EnGo* this, PlayState* play) { } else if (ENGO_GET_TYPE(&this->actor) != ENGO_MEDIGORON) { // All others besides the Medigoron in the Powder Keg Shop can fall asleep if (EnGo_IsFallingAsleep(this, play)) { - SubS_UpdateFlags(&this->actionFlags, 0, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->sleepState = ENGO_ASLEEP_POS; this->actionFunc = EnGo_Sleep; } else if (ENGO_GET_TYPE(&this->actor) == ENGO_GRAVEYARD) { @@ -2052,9 +1984,9 @@ void EnGo_Idle(EnGo* this, PlayState* play) { } } else if (ENGO_GET_TYPE(&this->actor) == ENGO_ATHLETIC) { if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)) < 0x3FFC) { - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->actionFlags, 0, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } } } @@ -2107,7 +2039,7 @@ void EnGo_Sleep(EnGo* this, PlayState* play) { } this->snorePhase += 0x400; this->actor.shape.yOffset = (this->actor.scale.y / this->scaleFactor) * ENGO_ROLLEDUP_Y_OFFSET; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } } else if ((this->actor.xzDistToPlayer >= 240.0f) || (this->actor.playerHeightRel >= 20.0f) || (this->sleepState != ENGO_AWAKE)) { @@ -2118,7 +2050,7 @@ void EnGo_Sleep(EnGo* this, PlayState* play) { this->actor.shape.yOffset = ENGO_STANDING_Y_OFFSET; } - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN); Math_ApproachS(&this->actor.shape.rot.y, targetRot, 4, 0x2AA8); } @@ -2131,7 +2063,8 @@ void EnGo_Frozen(EnGo* this, PlayState* play) { Actor* actorCollidedWith = this->colliderCylinder.base.ac; if ((this->actionFlags & ENGO_FLAG_HIT_BY_OTHER) && - (((actorCollidedWith != NULL) && (actorCollidedWith->id == ACTOR_OBJ_AQUA) && AQUA_HOT(actorCollidedWith)) || + (((actorCollidedWith != NULL) && (actorCollidedWith->id == ACTOR_OBJ_AQUA) && + (AQUA_GET_TYPE(actorCollidedWith) != AQUA_TYPE_COLD)) || (this->actor.colChkInfo.damageEffect == ENGO_DMGEFF_FIRE))) { this->actionFunc = EnGo_AwaitThaw; } @@ -2162,7 +2095,7 @@ void EnGo_Thaw(EnGo* this, PlayState* play) { EnGo_ChangeToShiveringAnimation(this, play); if ((ENGO_GET_TYPE(&this->actor) == ENGO_GRAVEYARD) && (ENGO_GET_SUBTYPE(&this->actor) == ENGO_GRAVEYARD_FROZEN)) { - SubS_UpdateFlags(&this->actionFlags, 4, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); EnGo_ChangeToShiveringAnimation(otherGoron, play); otherGoron->actionFunc = EnGo_Idle; } @@ -2235,14 +2168,14 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play) { switch (this->springArrivalCueId) { case 3: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && - (this->curAnimIndex == ENGO_ANIM_LOOK_AROUND)) { + (this->animIndex == ENGO_ANIM_LOOK_AROUND)) { EnGo_ChangeAnim(this, play, ENGO_ANIM_LOOK_AROUND_LOOPED); } break; case 4: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && - (this->curAnimIndex == ENGO_ANIM_SHOW)) { + (this->animIndex == ENGO_ANIM_SHOW)) { EnGo_ChangeAnim(this, play, ENGO_ANIM_SHOW_LOOPED); } break; @@ -2313,7 +2246,7 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play) { } } - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN); Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } @@ -2458,7 +2391,7 @@ void EnGo_Talk(EnGo* this, PlayState* play) { Math_Vec3f_Copy(&thisPos, &this->actor.world.pos); Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&thisPos, &targetPos), 4, 0x2AA8); } - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN); return; } @@ -2470,7 +2403,7 @@ void EnGo_Talk(EnGo* this, PlayState* play) { } this->actionFlags &= ~ENGO_FLAG_ENGAGED; - SubS_UpdateFlags(&this->actionFlags, 3, 7); + SubS_SetOfferMode(&this->actionFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->msgScriptResumePos = 0; this->actionFlags |= ENGO_FLAG_LOST_ATTENTION; this->actionFunc = this->interruptedActionFunc; @@ -2479,8 +2412,8 @@ void EnGo_Talk(EnGo* this, PlayState* play) { void EnGo_Init(Actor* thisx, PlayState* play) { EnGo* this = THIS; - this->taisouObjIndex = SubS_GetObjectIndex(OBJECT_TAISOU, play); - this->hakuginDemoObjIndex = SubS_GetObjectIndex(OBJECT_HAKUGIN_DEMO, play); + this->taisouObjectSlot = SubS_GetObjectSlot(OBJECT_TAISOU, play); + this->hakuginDemoObjectSlot = SubS_GetObjectSlot(OBJECT_HAKUGIN_DEMO, play); this->actionFunc = EnGo_SetupInitialAction; } @@ -2506,7 +2439,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { if (!(this->actionFlags & ENGO_FLAG_FROZEN)) { EnGo_UpdateEyes(this); - EnGo_UpdateAnimationToCurrent(this, play); + EnGo_UpdateSkelAnime(this, play); EnGo_UpdateAttentionTargetAndReactions(this, play); EnGo_UpdateSfx(this, play); } @@ -2518,10 +2451,10 @@ void EnGo_Update(Actor* thisx, PlayState* play) { } else { xzRange = this->colliderCylinder.dim.radius + 40; } - func_8013C964(&this->actor, play, xzRange, 20.0f, PLAYER_IA_NONE, this->actionFlags & 7); + SubS_Offer(&this->actor, play, xzRange, 20.0f, PLAYER_IA_NONE, this->actionFlags & SUBS_OFFER_MODE_MASK); } else if ((this->actionFlags & ENGO_FLAG_ROLLED_UP) && (this->sleepState != ENGO_AWAKE)) { xzRange = this->colliderCylinder.dim.radius + 40; - func_8013C964(&this->actor, play, xzRange, 20.0f, PLAYER_IA_NONE, this->actionFlags & 7); + SubS_Offer(&this->actor, play, xzRange, 20.0f, PLAYER_IA_NONE, this->actionFlags & SUBS_OFFER_MODE_MASK); } if ((ENGO_GET_TYPE(&this->actor) != ENGO_MEDIGORON) && (ENGO_GET_TYPE(&this->actor) != ENGO_SPECTATOR) && @@ -2568,7 +2501,7 @@ void EnGo_Draw_NoSkeleton(EnGo* this, PlayState* play) { s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGo* this = THIS; Vec3f worldPos; - s32 rotTableIndex; + s32 fidgetIndex; if ((ENGO_GET_TYPE(&this->actor) == ENGO_MEDIGORON) && (limbIndex == GORON_LIMB_BODY)) { Matrix_MultZero(&worldPos); @@ -2578,25 +2511,25 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po switch (limbIndex) { case GORON_LIMB_BODY: - rotTableIndex = 0; + fidgetIndex = 0; break; case GORON_LIMB_LEFT_UPPER_ARM: - rotTableIndex = 1; + fidgetIndex = 1; break; case GORON_LIMB_RIGHT_UPPER_ARM: - rotTableIndex = 2; + fidgetIndex = 2; break; default: - rotTableIndex = 9; + fidgetIndex = 9; break; } - if ((this->actionFlags & ENGO_FLAG_STANDING) && (rotTableIndex < 9)) { - rot->y += (s16)(Math_SinS(this->limbRotTableY[rotTableIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->limbRotTableZ[rotTableIndex]) * 200.0f); + if ((this->actionFlags & ENGO_FLAG_STANDING) && (fidgetIndex < 9)) { + rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f); } return false; } @@ -2666,7 +2599,7 @@ void EnGo_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex])); - if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) { + if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) { Matrix_Translate(0.0f, 0.0f, -4000.0f, MTXMODE_APPLY); } SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index 5162a4f77..d6173d6b2 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -15,6 +15,8 @@ typedef s32 (*MsgEventFunc)(Actor*, PlayState*); #define ENGO_PATH_INDEX_NONE 0xFF +#define ENGO_FIDGET_TABLE_LEN 3 + #define ENGO_SNOW_EFFECT_COUNT 16 #define ENGO_OTHER_EFFECT_COUNT 16 #define ENGO_EFFECT_COUNT (ENGO_SNOW_EFFECT_COUNT + ENGO_OTHER_EFFECT_COUNT) @@ -91,8 +93,8 @@ typedef struct EnGo { /* 0x1E0 */ ColliderCylinder unusedCylinder; /* 0x22C */ ColliderSphere colliderSphere; /* 0x284 */ Path* gatekeeperPath; - /* 0x288 */ s8 taisouObjIndex; - /* 0x289 */ s8 hakuginDemoObjIndex; + /* 0x288 */ s8 taisouObjectSlot; + /* 0x289 */ s8 hakuginDemoObjectSlot; /* 0x28C */ s32 msgScriptResumePos; /* 0x290 */ Vec3f headPos; /* 0x29C */ Vec3f bodyPos; @@ -104,7 +106,7 @@ typedef struct EnGo { /* 0x390 */ u16 actionFlags; /* 0x392 */ u16 lastTextId; /* 0x394 */ u8 springArrivalCueId; - /* 0x398 */ f32 curAnimPlaySpeed; + /* 0x398 */ f32 animPlaySpeed; /* 0x39C */ f32 iceBlockScale; /* 0x3A0 */ f32 iceBlockAlpha; /* 0x3A4 */ f32 scaleFactor; @@ -126,11 +128,11 @@ typedef struct EnGo { /* 0x3C2 */ s16 cutsceneDelayTimer; /* 0x3C4 */ s16 gatekeeperAnimState; /* 0x3C6 */ s16 harmlessTimer; - /* 0x3C8 */ s16 limbRotTableZ[3]; - /* 0x3CE */ s16 limbRotTableY[3]; + /* 0x3C8 */ s16 fidgetTableZ[ENGO_FIDGET_TABLE_LEN]; + /* 0x3CE */ s16 fidgetTableY[ENGO_FIDGET_TABLE_LEN]; /* 0x3D4 */ s16 surprisePhase; /* 0x3D8 */ MsgEventFunc msgEventFunc; - /* 0x3DC */ s32 curAnimIndex; + /* 0x3DC */ s32 animIndex; /* 0x3E0 */ UNK_TYPE1 unk3E0[0x4]; /* 0x3E4 */ s32 indexPathPoint; /* 0x3E8 */ s32 indexEffect; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 148b2d116..aa6eb041f 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -674,6 +674,7 @@ void func_80940090(EnGoroiwa* this, PlayState* play) { sp10C.x = this->actor.world.pos.x; sp10C.y = this->actor.world.pos.y + this->unk_1DC; sp10C.z = this->actor.world.pos.z; + //! FAKE: if (1) {} spD8 = spEC * 150.0f; spA8 = 0x10000 / spD8; @@ -1117,8 +1118,8 @@ void func_809419D0(EnGoroiwa* this) { void func_80941A10(EnGoroiwa* this, PlayState* play) { static EnGoroiwaUnkFunc D_80942E94[] = { - &func_8093F498, - &func_8093F34C, + func_8093F498, + func_8093F34C, }; static u16 D_80942E9C[][2] = { { NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG }, @@ -1507,6 +1508,9 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { this->actor.floorBgId = 50; } break; + + default: + break; } func_8093FAA4(this, play); diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index bfd2d19ab..90b39f860 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -5,9 +5,10 @@ */ #include "z_en_grasshopper.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnGrasshopper*)thisx) @@ -42,99 +43,171 @@ void EnGrasshopper_UpdateEffects(EnGrasshopper* this, PlayState* play); void EnGrasshopper_DrawEffects(EnGrasshopper* this, PlayState* play); typedef enum { - /* 0 */ EN_GRASSHOPPER_ACTION_FLY, - /* 1 */ EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES, - /* 2 */ EN_GRASSHOPPER_ACTION_BANK, - /* 3 */ EN_GRASSHOPPER_ACTION_BOUNCED, - /* 4 */ EN_GRASSHOPPER_ACTION_DECIDE_ACTION, - /* 5 */ EN_GRASSHOPPER_ACTION_APPROACH_PLAYER, - /* 6 */ EN_GRASSHOPPER_ACTION_ATTACK, - /* 7 */ EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK, - /* 8 */ EN_GRASSHOPPER_ACTION_DAMAGED, - /* 9 */ EN_GRASSHOPPER_ACTION_DEAD, - /* 10 */ EN_GRASSHOPPER_ACTION_FALL + /* 0 */ DRAGONFLY_ACTION_FLY, + /* 1 */ DRAGONFLY_ACTION_ROAM_IN_CIRCLES, + /* 2 */ DRAGONFLY_ACTION_BANK, + /* 3 */ DRAGONFLY_ACTION_BOUNCED, + /* 4 */ DRAGONFLY_ACTION_DECIDE_ACTION, + /* 5 */ DRAGONFLY_ACTION_APPROACH_PLAYER, + /* 6 */ DRAGONFLY_ACTION_ATTACK, + /* 7 */ DRAGONFLY_ACTION_WAIT_AFTER_ATTACK, + /* 8 */ DRAGONFLY_ACTION_DAMAGED, + /* 9 */ DRAGONFLY_ACTION_DEAD, + /* 10 */ DRAGONFLY_ACTION_FALL } EnGrasshopperAction; typedef enum { - /* 0 */ EN_GRASSHOPPER_DECISION_ATTACK, - /* 1 */ EN_GRASSHOPPER_DECISION_FLY, - /* 2 */ EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES // Never used in the final game + /* 0 */ DRAGONFLY_DECISION_ATTACK, + /* 1 */ DRAGONFLY_DECISION_FLY, + /* 2 */ DRAGONFLY_DECISION_ROAM_IN_CIRCLES // Never used in the final game } EnGrasshopperNextAction; typedef enum { - /* 0 */ EN_GRASSHOPPER_BANK_STATE_BANKING, - /* 1 */ EN_GRASSHOPPER_BANK_STATE_DONE + /* 0 */ DRAGONFLY_BANK_STATE_BANKING, + /* 1 */ DRAGONFLY_BANK_STATE_DONE } EnGrasshopperBankState; typedef enum { - /* 0 */ EN_GRASSHOPPER_ANIM_RAISE_TAIL, - /* 1 */ EN_GRASSHOPPER_ANIM_LOWER_TAIL, - /* 2 */ EN_GRASSHOPPER_ANIM_FLY, - /* 3 */ EN_GRASSHOPPER_ANIM_ATTACK, - /* 4 */ EN_GRASSHOPPER_ANIM_HOVER, - /* 5 */ EN_GRASSHOPPER_ANIM_DAMAGE, - /* 6 */ EN_GRASSHOPPER_ANIM_DEAD, - /* 7 */ EN_GRASSHOPPER_ANIM_FALL -} EnGrasshopperAnim; + /* 0 */ DRAGONFLY_ANIM_RAISE_TAIL, + /* 1 */ DRAGONFLY_ANIM_LOWER_TAIL, + /* 2 */ DRAGONFLY_ANIM_FLY, + /* 3 */ DRAGONFLY_ANIM_ATTACK, + /* 4 */ DRAGONFLY_ANIM_HOVER, + /* 5 */ DRAGONFLY_ANIM_DAMAGE, + /* 6 */ DRAGONFLY_ANIM_DEAD, + /* 7 */ DRAGONFLY_ANIM_FALL, + /* 8 */ DRAGONFLY_ANIM_MAX +} DragonflyAnimation; static s32 sOccupiedIndices[] = { false, false, false, false, false, }; -static s8 sLimbIndexToShadowBodyPartsIndex[DRAGONFLY_LIMB_MAX] = { - -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, 6, 7, -1, 8, 9, -1, 10, 11, -1, 12, 13, -1, -1, -1, +static s8 sLimbToShadowBodyParts[DRAGONFLY_LIMB_MAX] = { + BODYPART_NONE, // DRAGONFLY_LIMB_NONE + BODYPART_NONE, // DRAGONFLY_LIMB_ROOT + DRAGONFLY_SHADOW_BODYPART_0, // DRAGONFLY_LIMB_TAIL_SEGMENT_1 + DRAGONFLY_SHADOW_BODYPART_1, // DRAGONFLY_LIMB_TAIL_SEGMENT_2 + DRAGONFLY_SHADOW_BODYPART_2, // DRAGONFLY_LIMB_TAIL_SEGMENT_3 + DRAGONFLY_SHADOW_BODYPART_3, // DRAGONFLY_LIMB_TAIL_SEGMENT_4 + DRAGONFLY_SHADOW_BODYPART_4, // DRAGONFLY_LIMB_TAIL_TIP + DRAGONFLY_SHADOW_BODYPART_5, // DRAGONFLY_LIMB_THORAX + BODYPART_NONE, // DRAGONFLY_LIMB_LEFT_WING + BODYPART_NONE, // DRAGONFLY_LIMB_RIGHT_WING + DRAGONFLY_SHADOW_BODYPART_6, // DRAGONFLY_LIMB_BACK_LEFT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_7, // DRAGONFLY_LIMB_BACK_LEFT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_BACK_LEFT_FOOT + DRAGONFLY_SHADOW_BODYPART_8, // DRAGONFLY_LIMB_BACK_RIGHT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_9, // DRAGONFLY_LIMB_BACK_RIGHT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_BACK_RIGHT_FOOT + DRAGONFLY_SHADOW_BODYPART_10, // DRAGONFLY_LIMB_FRONT_LEFT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_11, // DRAGONFLY_LIMB_FRONT_LEFT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_FRONT_LEFT_FOOT + DRAGONFLY_SHADOW_BODYPART_12, // DRAGONFLY_LIMB_FRONT_RIGHT_UPPER_LEG + DRAGONFLY_SHADOW_BODYPART_13, // DRAGONFLY_LIMB_FRONT_RIGHT_LOWER_LEG + BODYPART_NONE, // DRAGONFLY_LIMB_FRONT_RIGHT_FOOT + BODYPART_NONE, // DRAGONFLY_LIMB_HEAD + BODYPART_NONE, // DRAGONFLY_LIMB_JAW }; -static s8 sParentBodyParts[DRAGONFLY_LIMB_MAX] = { - -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, -1, 12, -1, -1, -1, +// Should be `DRAGONFLY_SHADOW_BODYPART_MAX` +static s8 sParentShadowBodyParts[DRAGONFLY_LIMB_MAX] = { + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_0 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_1 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_2 + DRAGONFLY_SHADOW_BODYPART_0, // DRAGONFLY_SHADOW_BODYPART_3 + DRAGONFLY_SHADOW_BODYPART_1, // DRAGONFLY_SHADOW_BODYPART_4 + DRAGONFLY_SHADOW_BODYPART_2, // DRAGONFLY_SHADOW_BODYPART_5 + DRAGONFLY_SHADOW_BODYPART_3, // DRAGONFLY_SHADOW_BODYPART_6 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_7 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_8 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_9 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_10 + DRAGONFLY_SHADOW_BODYPART_6, // DRAGONFLY_SHADOW_BODYPART_11 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_12 + BODYPART_NONE, // DRAGONFLY_SHADOW_BODYPART_13 + DRAGONFLY_SHADOW_BODYPART_8, // + BODYPART_NONE, // + BODYPART_NONE, // + DRAGONFLY_SHADOW_BODYPART_10, // + BODYPART_NONE, // + BODYPART_NONE, // + DRAGONFLY_SHADOW_BODYPART_12, // + BODYPART_NONE, // + BODYPART_NONE, // + BODYPART_NONE, // }; +// Should be `DRAGONFLY_SHADOW_BODYPART_MAX` static u8 sShadowSizes[DRAGONFLY_LIMB_MAX] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, // DRAGONFLY_SHADOW_BODYPART_0 + 0, // DRAGONFLY_SHADOW_BODYPART_1 + 0, // DRAGONFLY_SHADOW_BODYPART_2 + 0, // DRAGONFLY_SHADOW_BODYPART_3 + 0, // DRAGONFLY_SHADOW_BODYPART_4 + 0, // DRAGONFLY_SHADOW_BODYPART_5 + 0, // DRAGONFLY_SHADOW_BODYPART_6 + 0, // DRAGONFLY_SHADOW_BODYPART_7 + 0, // DRAGONFLY_SHADOW_BODYPART_8 + 0, // DRAGONFLY_SHADOW_BODYPART_9 + 0, // DRAGONFLY_SHADOW_BODYPART_10 + 0, // DRAGONFLY_SHADOW_BODYPART_11 + 0, // DRAGONFLY_SHADOW_BODYPART_12 + 0, // DRAGONFLY_SHADOW_BODYPART_13 + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // + 0, // }; typedef enum { - /* 0x0 */ EN_GRASSHOPPER_DMGEFF_IMMUNE, // Deals no damage - /* 0x2 */ EN_GRASSHOPPER_DMGEFF_FIRE = 0x2, // Damages and sets the Dragonfly on fire - /* 0x3 */ EN_GRASSHOPPER_DMGEFF_FREEZE, // Damages and freezes the Dragonfly in ice - /* 0x4 */ EN_GRASSHOPPER_DMGEFF_LIGHT_ORB, // Damages and surrounds the Dragonfly with light orbs - /* 0xE */ EN_GRASSHOPPER_DMGEFF_HOOK = 0xE, // If hit by the Hookshot, it pulls the Dragonfly towards the player - /* 0xF */ EN_GRASSHOPPER_DMGEFF_NONE // Deals regular damage with no extra effect + /* 0x0 */ DRAGONFLY_DMGEFF_IMMUNE, // Deals no damage + /* 0x2 */ DRAGONFLY_DMGEFF_FIRE = 0x2, // Damages and sets the Dragonfly on fire + /* 0x3 */ DRAGONFLY_DMGEFF_FREEZE, // Damages and freezes the Dragonfly in ice + /* 0x4 */ DRAGONFLY_DMGEFF_LIGHT_ORB, // Damages and surrounds the Dragonfly with light orbs + /* 0xE */ DRAGONFLY_DMGEFF_HOOK = 0xE, // If hit by the Hookshot, it pulls the Dragonfly towards the player + /* 0xF */ DRAGONFLY_DMGEFF_NONE // Deals regular damage with no extra effect } EnDragonflyDamageEffect; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku Stick */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Horse trample */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Explosives */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora boomerang */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Normal arrow */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Hookshot */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_HOOK), - /* Goron punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Sword */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Goron pound */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_NONE), - /* Fire arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FIRE), - /* Ice arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FREEZE), - /* Light arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_LIGHT_ORB), - /* Goron spikes */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku spin */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku bubble */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Deku launch */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_NONE), - /* UNK_DMG_0x12 */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora barrier */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Normal shield */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Light ray */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Thrown object */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Zora punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Spin attack */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), - /* Sword beam */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Normal Roll */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Unblockable */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), - /* Powder Keg */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_HOOK), + /* Deku Nut */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku Stick */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Explosives */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Hookshot */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_HOOK), + /* Goron punch */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, DRAGONFLY_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora barrier */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Light ray */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Thrown object */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Normal Roll */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Unblockable */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DRAGONFLY_DMGEFF_IMMUNE), + /* Powder Keg */ DMG_ENTRY(1, DRAGONFLY_DMGEFF_HOOK), }; ActorInit En_Grasshopper_InitVars = { @@ -192,7 +265,7 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { s32 i; this->actor.hintId = TATL_HINT_ID_DRAGONFLY; - this->actor.targetMode = 4; + this->actor.targetMode = TARGET_MODE_4; this->actor.colChkInfo.mass = 60; this->actor.colChkInfo.health = 2; @@ -210,7 +283,7 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 1.0f); this->actor.colChkInfo.damageTable = &sDamageTable; Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.home.pos); - this->action = EN_GRASSHOPPER_ACTION_FLY; + this->action = DRAGONFLY_ACTION_FLY; this->index = -1; for (i = 0; i < ARRAY_COUNT(sOccupiedIndices); i++) { @@ -228,12 +301,12 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gDragonflySkel, &gDragonflyFlyAnim, this->jointTable, this->morphTable, DRAGONFLY_LIMB_MAX); - this->type = EN_GRASSHOPPER_GET_TYPE(&this->actor); - if (this->type < EN_GRASSHOPPER_TYPE_UNUSED_NORMAL) { - this->type = EN_GRASSHOPPER_TYPE_NORMAL; + this->type = DRAGONFLY_GET_TYPE(&this->actor); + if (this->type < DRAGONFLY_TYPE_UNUSED_NORMAL) { + this->type = DRAGONFLY_TYPE_NORMAL; } - if (this->type != EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + if (this->type != DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED) { this->dragonflyScale = 0.01f; } else { this->dragonflyScale = 0.0f; @@ -261,70 +334,70 @@ void EnGrasshopper_Destroy(Actor* thisx, PlayState* play) { sOccupiedIndices[this->index] = false; } -static AnimationHeader* sAnimations[] = { - &gDragonflyRaiseTailAnim, // EN_GRASSHOPPER_ANIM_RAISE_TAIL - &gDragonflyLowerTailAnim, // EN_GRASSHOPPER_ANIM_LOWER_TAIL - &gDragonflyFlyAnim, // EN_GRASSHOPPER_ANIM_FLY - &gDragonflyAttackAnim, // EN_GRASSHOPPER_ANIM_ATTACK - &gDragonflyHoverAnim, // EN_GRASSHOPPER_ANIM_HOVER - &gDragonflyDamageAnim, // EN_GRASSHOPPER_ANIM_DAMAGE - &gDragonflyDeadAnim, // EN_GRASSHOPPER_ANIM_DEAD - &gDragonflyFallAnim, // EN_GRASSHOPPER_ANIM_FALL +static AnimationHeader* sAnimations[DRAGONFLY_ANIM_MAX] = { + &gDragonflyRaiseTailAnim, // DRAGONFLY_ANIM_RAISE_TAIL + &gDragonflyLowerTailAnim, // DRAGONFLY_ANIM_LOWER_TAIL + &gDragonflyFlyAnim, // DRAGONFLY_ANIM_FLY + &gDragonflyAttackAnim, // DRAGONFLY_ANIM_ATTACK + &gDragonflyHoverAnim, // DRAGONFLY_ANIM_HOVER + &gDragonflyDamageAnim, // DRAGONFLY_ANIM_DAMAGE + &gDragonflyDeadAnim, // DRAGONFLY_ANIM_DEAD + &gDragonflyFallAnim, // DRAGONFLY_ANIM_FALL }; -static u8 sAnimationModes[] = { - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_RAISE_TAIL - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_LOWER_TAIL - ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_FLY - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_ATTACK - ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_HOVER - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DAMAGE - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DEAD - ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_FALL +static u8 sAnimationModes[DRAGONFLY_ANIM_MAX] = { + ANIMMODE_ONCE, // DRAGONFLY_ANIM_RAISE_TAIL + ANIMMODE_ONCE, // DRAGONFLY_ANIM_LOWER_TAIL + ANIMMODE_LOOP, // DRAGONFLY_ANIM_FLY + ANIMMODE_ONCE, // DRAGONFLY_ANIM_ATTACK + ANIMMODE_LOOP, // DRAGONFLY_ANIM_HOVER + ANIMMODE_ONCE, // DRAGONFLY_ANIM_DAMAGE + ANIMMODE_ONCE, // DRAGONFLY_ANIM_DEAD + ANIMMODE_ONCE, // DRAGONFLY_ANIM_FALL }; void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) { f32 morphFrames; - this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); morphFrames = 0.0f; - if ((animIndex == EN_GRASSHOPPER_ANIM_ATTACK) || (animIndex == EN_GRASSHOPPER_ANIM_HOVER) || - (animIndex == EN_GRASSHOPPER_ANIM_DAMAGE)) { + if ((animIndex == DRAGONFLY_ANIM_ATTACK) || (animIndex == DRAGONFLY_ANIM_HOVER) || + (animIndex == DRAGONFLY_ANIM_DAMAGE)) { morphFrames = -3.0f; } - Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->endFrame, sAnimationModes[animIndex], - morphFrames); + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->animEndFrame, + sAnimationModes[animIndex], morphFrames); } void EnGrasshopper_RaiseTail(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_RAISE_TAIL); - if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { - this->decision = EN_GRASSHOPPER_DECISION_FLY; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_RAISE_TAIL); + if (this->decision != DRAGONFLY_DECISION_ROAM_IN_CIRCLES) { + this->decision = DRAGONFLY_DECISION_FLY; } - this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; + this->action = DRAGONFLY_ACTION_DECIDE_ACTION; this->actionFunc = EnGrasshopper_DecideAction; } void EnGrasshopper_LowerTail(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_LOWER_TAIL); - this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_LOWER_TAIL); + this->action = DRAGONFLY_ACTION_DECIDE_ACTION; + this->decision = DRAGONFLY_DECISION_ATTACK; this->actionFunc = EnGrasshopper_DecideAction; } void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (curFrame >= this->endFrame) { - if (this->decision == EN_GRASSHOPPER_DECISION_ATTACK) { + if (curFrame >= this->animEndFrame) { + if (this->decision == DRAGONFLY_DECISION_ATTACK) { EnGrasshopper_SetupAttack(this); } else { Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.world.pos); this->flyingHomePos.y = this->actor.floorHeight + 90.0f; - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); - if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FLY); + if (this->decision != DRAGONFLY_DECISION_ROAM_IN_CIRCLES) { if (Player_GetMask(play) == PLAYER_MASK_STONE) { EnGrasshopper_SetupFly(this); } else { @@ -332,8 +405,8 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { } } else { this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; + this->decision = DRAGONFLY_DECISION_ATTACK; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } @@ -342,9 +415,9 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupFly(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FLY); this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y; - this->action = EN_GRASSHOPPER_ACTION_FLY; + this->action = DRAGONFLY_ACTION_FLY; this->actionFunc = EnGrasshopper_Fly; } @@ -357,8 +430,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); diffX = this->flyingHomePos.x - this->actor.world.pos.x; diffZ = this->flyingHomePos.z - this->actor.world.pos.z; - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { this->bobPhase += 0xAF0; this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); @@ -376,8 +448,8 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { this->shouldTurn = false; } - //! @bug Unreachable code. To get here, the type must NOT be EN_GRASSHOPPER_TYPE_WOODFALL - if (this->type == EN_GRASSHOPPER_TYPE_WOODFALL) { + //! @bug Unreachable code. To get here, the type must NOT be DRAGONFLY_TYPE_WOODFALL + if (this->type == DRAGONFLY_TYPE_WOODFALL) { if (sqrtf(SQ(this->actor.world.pos.x) + SQ(this->actor.world.pos.z)) < 600.0f) { this->shouldTurn = true; } @@ -402,12 +474,12 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; targetSpeed = (this->index * 0.1f) + 4.0f; Math_ApproachF(&this->actor.speed, targetSpeed, 0.4f, 0.7f); - Math_ApproachF(&this->rotationalVelocity, 2000.0f, 1.0f, 50.0f); - Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); + Math_ApproachF(&this->angularVelocity, 2000.0f, 1.0f, 50.0f); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->angularVelocity, 5); if (this->timer == 0) { if (Rand_ZeroFloat(1.0f) < 0.3f) { this->waitTimer = Rand_S16Offset(10, 10); - this->rotationalVelocity = 0.0f; + this->angularVelocity = 0.0f; } this->targetRot.y = Math_Atan2S(diffX, diffZ); @@ -477,8 +549,8 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupBank(EnGrasshopper* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); this->targetBankRot.y = this->actor.world.rot.y + 0x8000; - this->action = EN_GRASSHOPPER_ACTION_BANK; - this->bankState = EN_GRASSHOPPER_BANK_STATE_BANKING; + this->action = DRAGONFLY_ACTION_BANK; + this->bankState = DRAGONFLY_BANK_STATE_BANKING; this->actor.speed = 2.0f; this->actionFunc = EnGrasshopper_Bank; } @@ -490,25 +562,28 @@ void EnGrasshopper_SetupBank(EnGrasshopper* this) { void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); switch (this->bankState) { - case EN_GRASSHOPPER_BANK_STATE_BANKING: + case DRAGONFLY_BANK_STATE_BANKING: Math_SmoothStepToS(&this->actor.world.rot.y, this->targetBankRot.y, 0x64, 0x3E8, 0x3E8); Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 0x64, 0x1F40, 0xBB8); if (fabsf(this->actor.world.rot.y - (f32)this->targetBankRot.y) < 10.0f) { this->postBankTimer = 100; - this->bankState = EN_GRASSHOPPER_BANK_STATE_DONE; + this->bankState = DRAGONFLY_BANK_STATE_DONE; } break; - case EN_GRASSHOPPER_BANK_STATE_DONE: + case DRAGONFLY_BANK_STATE_DONE: Math_SmoothStepToS(&this->actor.world.rot.z, 0, 0x64, 0x1F40, 0xBB8); if (this->postBankTimer == 0) { this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; - this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; + this->decision = DRAGONFLY_DECISION_ATTACK; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } break; + + default: + break; } } @@ -519,7 +594,7 @@ void EnGrasshopper_SetupBounced(EnGrasshopper* this) { this->targetRot.y = -this->actor.yawTowardsPlayer; this->timer = Rand_S16Offset(30, 30); this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; - this->action = EN_GRASSHOPPER_ACTION_BOUNCED; + this->action = DRAGONFLY_ACTION_BOUNCED; this->actionFunc = EnGrasshopper_Bounced; } @@ -535,11 +610,11 @@ void EnGrasshopper_Bounced(EnGrasshopper* this, PlayState* play) { Math_ApproachF(&this->actor.speed, targetSpeed, 0.4f, 0.8f); Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); this->targetRot.z *= 0.8f; - Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->angularVelocity, 5); if (this->timer == 0) { this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); this->timer = 0; - this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; + this->action = DRAGONFLY_ACTION_ROAM_IN_CIRCLES; this->waitTimer = this->timer; this->actionFunc = EnGrasshopper_RoamInCircles; } @@ -550,7 +625,7 @@ void EnGrasshopper_SetupApproachPlayer(EnGrasshopper* this, PlayState* play) { Player* player = GET_PLAYER(play); this->timer = 50; - this->action = EN_GRASSHOPPER_ACTION_APPROACH_PLAYER; + this->action = DRAGONFLY_ACTION_APPROACH_PLAYER; this->approachSpeed = 0.0f; this->targetApproachPos.x = (Math_SinS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.x; this->targetApproachPos.z = (Math_CosS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.z; @@ -601,7 +676,7 @@ void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupAttack(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_ATTACK); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_ATTACK); this->approachSpeed = 0.0f; Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); this->actor.speed = 3.0f; @@ -609,7 +684,7 @@ void EnGrasshopper_SetupAttack(EnGrasshopper* this) { this->collider.elements[0].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); this->collider.elements[1].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_ATTACK); - this->action = EN_GRASSHOPPER_ACTION_ATTACK; + this->action = DRAGONFLY_ACTION_ATTACK; this->actionFunc = EnGrasshopper_Attack; } @@ -664,17 +739,17 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.y, this->targetApproachPos.y, 0.1f, this->approachSpeed); Math_ApproachF(&this->approachSpeed, 10.0f, 0.1f, 1.0f); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); - if (curFrame >= this->endFrame) { + if (curFrame >= this->animEndFrame) { EnGrasshopper_SetupWaitAfterAttack(this); } } void EnGrasshopper_SetupWaitAfterAttack(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_HOVER); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_HOVER); this->bobPhase += 0xAF0; this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); - this->action = EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK; + this->action = DRAGONFLY_ACTION_WAIT_AFTER_ATTACK; this->waitTimer = 20; this->actor.speed = 0.0f; this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); @@ -697,9 +772,9 @@ void EnGrasshopper_WaitAfterAttack(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { Vec3f damagedVelocity; - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DAMAGE); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_DAMAGE); this->actor.speed = 0.0f; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->approachSpeed = 0.0f; this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); @@ -708,13 +783,13 @@ void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { 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.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - this->action = EN_GRASSHOPPER_ACTION_DAMAGED; + this->action = DRAGONFLY_ACTION_DAMAGED; this->actionFunc = EnGrasshopper_Damaged; } @@ -726,7 +801,7 @@ void EnGrasshopper_Damaged(EnGrasshopper* this, PlayState* play) { } void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DEAD); + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_DEAD); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.speed = 0.0f; this->approachSpeed = 0.0f; @@ -741,7 +816,7 @@ void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_DEAD); - this->action = EN_GRASSHOPPER_ACTION_DEAD; + this->action = DRAGONFLY_ACTION_DEAD; this->actionFunc = EnGrasshopper_Dead; } @@ -755,20 +830,20 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->drawDmgEffTimer < 2)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - if (curFrame >= this->endFrame) { + if (curFrame >= this->animEndFrame) { this->actor.flags &= ~ACTOR_FLAG_10; EnGrasshopper_SetupFall(this); } } void EnGrasshopper_SetupFall(EnGrasshopper* this) { - EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FALL); - this->action = EN_GRASSHOPPER_ACTION_FALL; + EnGrasshopper_ChangeAnim(this, DRAGONFLY_ANIM_FALL); + this->action = DRAGONFLY_ACTION_FALL; this->actor.speed = 0.0f; this->approachSpeed = 0.0f; this->actionFunc = EnGrasshopper_Fall; @@ -810,7 +885,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { (((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.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, 2, 0.3f, 0.2f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -852,15 +927,15 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT)) { this->collider.base.acFlags &= ~AC_HIT; - if ((this->action != EN_GRASSHOPPER_ACTION_DAMAGED) && (this->action != EN_GRASSHOPPER_ACTION_DEAD) && - (this->action != EN_GRASSHOPPER_ACTION_FALL)) { - if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_NONE) { + if ((this->action != DRAGONFLY_ACTION_DAMAGED) && (this->action != DRAGONFLY_ACTION_DEAD) && + (this->action != DRAGONFLY_ACTION_FALL)) { + if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_NONE) { attackDealsDamage = true; - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FIRE) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_FIRE) { this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; attackDealsDamage = true; - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FREEZE) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_FREEZE) { if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_BLUE_FIRE) || (this->drawDmgEffTimer == 0)) { Actor_ApplyDamage(&this->actor); attackDealsDamage = false; @@ -874,12 +949,12 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { EnGrasshopper_SetupDead(this, play); return; } - } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_LIGHT_ORB) { + } else if (this->actor.colChkInfo.damageEffect == DRAGONFLY_DMGEFF_LIGHT_ORB) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, 255, COLORFILTER_BUFFLAG_OPA, 25); this->drawDmgEffTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, - this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); attackDealsDamage = true; } } @@ -919,14 +994,14 @@ void EnGrasshopper_Update(Actor* thisx, PlayState* play) { Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); Math_ApproachZeroF(&this->damagedVelocity.y, 1.0f, 2.0f); Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); - if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->action != DRAGONFLY_ACTION_FALL) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } this->actor.shape.rot.z = this->actor.world.rot.z; - if (this->type == EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + if (this->type == DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED) { f32 targetScale = this->type * 0.01f; if (targetScale >= 0.018f) { @@ -936,15 +1011,15 @@ void EnGrasshopper_Update(Actor* thisx, PlayState* play) { Math_ApproachF(&this->dragonflyScale, targetScale, 0.1f, 0.01f); } - if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->action != EN_GRASSHOPPER_ACTION_APPROACH_PLAYER)) { + if ((this->action != DRAGONFLY_ACTION_FALL) && (this->action != DRAGONFLY_ACTION_APPROACH_PLAYER)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 5, 0x3E8, 5); } EnGrasshopper_UpdateEffects(this, play); - if ((this->action != EN_GRASSHOPPER_ACTION_DEAD) && (this->action != EN_GRASSHOPPER_ACTION_FALL)) { + if ((this->action != DRAGONFLY_ACTION_DEAD) && (this->action != DRAGONFLY_ACTION_FALL)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if ((this->action == EN_GRASSHOPPER_ACTION_APPROACH_PLAYER) || (this->action == EN_GRASSHOPPER_ACTION_ATTACK)) { + if ((this->action == DRAGONFLY_ACTION_APPROACH_PLAYER) || (this->action == DRAGONFLY_ACTION_ATTACK)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -957,10 +1032,9 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec Matrix_Push(); - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { - if ((s8)(sLimbIndexToShadowBodyPartsIndex[limbIndex] >= 0)) { - Matrix_MultVec3f(&sZeroVec3f, &this->shadowBodyPartsPos[sLimbIndexToShadowBodyPartsIndex[limbIndex]]); + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { + if ((s8)(sLimbToShadowBodyParts[limbIndex] > BODYPART_NONE)) { + Matrix_MultVec3f(&sZeroVec3f, &this->shadowBodyPartsPos[sLimbToShadowBodyParts[limbIndex]]); } } @@ -971,6 +1045,7 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } Collider_UpdateSpheres(limbIndex, &this->collider); + if ((limbIndex == DRAGONFLY_LIMB_ROOT) || (limbIndex == DRAGONFLY_LIMB_TAIL_SEGMENT_2) || (limbIndex == DRAGONFLY_LIMB_TAIL_TIP) || (limbIndex == DRAGONFLY_LIMB_BACK_LEFT_UPPER_LEG) || (limbIndex == DRAGONFLY_LIMB_BACK_RIGHT_UPPER_LEG) || (limbIndex == DRAGONFLY_LIMB_FRONT_LEFT_UPPER_LEG) || @@ -982,25 +1057,20 @@ void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec // While checking for DRAGONFLY_LIMB_ROOT twice is not a bug by itself, it causes another bug below. (limbIndex == DRAGONFLY_LIMB_ROOT)) { //! @bug: This code only works properly if all 12 elements of bodyPartsPos are updated every frame, since - //! otherwise bodyPartsPosIndex will be non-zero at the end of a frame. Despite the fact that there are 12 + //! otherwise bodyPartIndex will be non-zero at the end of a frame. Despite the fact that there are 12 //! checks in the above if-statement, only 9 of them are valid and non-duplicate, so only 9 elements of //! bodyPartsPos are updated on each frame. As a result, three elements in bodyPartsPos will either be (0, 0, 0) //! or be a value carried over from the previous frame. - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= DRAGONFLY_BODYPART_MAX) { + this->bodyPartIndex = 0; } } Matrix_Pop(); } -// We need to pass in 14 into SubS_GenShadowTex for the bodyPartsNum, NOT the actual size of the -// parent body parts array. This is both necessary to match and to prevent extra dots from being -// drawn with the shadow. -#define SHADOW_BODY_PARTS_NUM 14 - void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { EnGrasshopper* this = THIS; s32 i; @@ -1010,17 +1080,17 @@ void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnGrasshopper_PostLimbDraw, &this->actor); - if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && - (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((this->type != DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && (this->type != DRAGONFLY_TYPE_WOODFALL)) { Matrix_RotateXS(0, MTXMODE_NEW); for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) { - *shadowTexIter++ = 0; + *shadowTexIter = 0; + shadowTexIter++; } for (i = 0; i < 5; i++) { SubS_GenShadowTex(this->shadowBodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, - SHADOW_BODY_PARTS_NUM, sShadowSizes, sParentBodyParts); + DRAGONFLY_SHADOW_BODYPART_MAX, sShadowSizes, sParentShadowBodyParts); //! FAKE: Needed to fix some regs and stack //! https://decomp.me/scratch/4wJBW if ((shadowTex && shadowTex) && shadowTex) {} @@ -1045,9 +1115,8 @@ void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, DRAGONFLY_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } EnGrasshopper_DrawEffects(this, play); diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h index 049091393..a07091dd8 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h @@ -4,20 +4,20 @@ #include "global.h" #include "objects/object_grasshopper/object_grasshopper.h" -#define EN_GRASSHOPPER_GET_TYPE(thisx) ((thisx)->params) +#define DRAGONFLY_GET_TYPE(thisx) ((thisx)->params) -#define EN_GRASSHOPPER_PARAMS(type) (type) +#define DRAGONFLY_PARAMS(type) (type) struct EnGrasshopper; typedef void (*EnGrasshopperActionFunc)(struct EnGrasshopper*, PlayState*); typedef enum EnGrasshopperType { - /* -1 */ EN_GRASSHOPPER_TYPE_UNUSED_NORMAL = -1, // Acts exactly like EN_GRASSHOPPER_TYPE_NORMAL - /* 0 */ EN_GRASSHOPPER_TYPE_NORMAL, - /* 1 */ EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED, // Spawned by EnEncount1 - /* 2 */ EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM, - /* 3 */ EN_GRASSHOPPER_TYPE_WOODFALL + /* -1 */ DRAGONFLY_TYPE_UNUSED_NORMAL = -1, // Acts exactly like DRAGONFLY_TYPE_NORMAL + /* 0 */ DRAGONFLY_TYPE_NORMAL, + /* 1 */ DRAGONFLY_TYPE_GROWS_WHEN_SPAWNED, // Spawned by EnEncount1 + /* 2 */ DRAGONFLY_TYPE_WOODFALL_TEMPLE_FINAL_ROOM, + /* 3 */ DRAGONFLY_TYPE_WOODFALL } EnGrasshopperType; typedef struct EnGrasshopperEffect { @@ -30,7 +30,41 @@ typedef struct EnGrasshopperEffect { /* 0x2E */ s16 lightningIndex; } EnGrasshopperEffect; // size = 0x30 -#define EN_GRASSHOPPER_EFFECT_COUNT 100 +#define DRAGONFLY_EFFECT_COUNT 100 + +typedef enum EnGrasshopperBodyPart { + /* 0 */ DRAGONFLY_BODYPART_0, + /* 1 */ DRAGONFLY_BODYPART_1, + /* 2 */ DRAGONFLY_BODYPART_2, + /* 3 */ DRAGONFLY_BODYPART_3, + /* 4 */ DRAGONFLY_BODYPART_4, + /* 5 */ DRAGONFLY_BODYPART_5, + /* 6 */ DRAGONFLY_BODYPART_6, + /* 7 */ DRAGONFLY_BODYPART_7, + /* 8 */ DRAGONFLY_BODYPART_8, + /* 9 */ DRAGONFLY_BODYPART_9, + /* 10 */ DRAGONFLY_BODYPART_10, + /* 11 */ DRAGONFLY_BODYPART_11, + /* 12 */ DRAGONFLY_BODYPART_MAX +} EnGrasshopperBodyPart; + +typedef enum EnGrasshopperShadowBodyPart { + /* 0 */ DRAGONFLY_SHADOW_BODYPART_0, + /* 1 */ DRAGONFLY_SHADOW_BODYPART_1, + /* 2 */ DRAGONFLY_SHADOW_BODYPART_2, + /* 3 */ DRAGONFLY_SHADOW_BODYPART_3, + /* 4 */ DRAGONFLY_SHADOW_BODYPART_4, + /* 5 */ DRAGONFLY_SHADOW_BODYPART_5, + /* 6 */ DRAGONFLY_SHADOW_BODYPART_6, + /* 7 */ DRAGONFLY_SHADOW_BODYPART_7, + /* 8 */ DRAGONFLY_SHADOW_BODYPART_8, + /* 9 */ DRAGONFLY_SHADOW_BODYPART_9, + /* 10 */ DRAGONFLY_SHADOW_BODYPART_10, + /* 11 */ DRAGONFLY_SHADOW_BODYPART_11, + /* 12 */ DRAGONFLY_SHADOW_BODYPART_12, + /* 13 */ DRAGONFLY_SHADOW_BODYPART_13, + /* 14 */ DRAGONFLY_SHADOW_BODYPART_MAX +} EnGrasshopperShadowBodyPart; typedef struct EnGrasshopper { /* 0x0000 */ Actor actor; @@ -48,16 +82,16 @@ typedef struct EnGrasshopper { /* 0x02B8 */ s16 drawDmgEffType; /* 0x02BC */ f32 drawDmgEffScale; /* 0x02C0 */ f32 drawDmgEffFrozenSteamScale; - /* 0x02C4 */ Vec3f bodyPartsPos[12]; - /* 0x0354 */ s16 bodyPartsPosIndex; + /* 0x02C4 */ Vec3f bodyPartsPos[DRAGONFLY_BODYPART_MAX]; + /* 0x0354 */ s16 bodyPartIndex; /* 0x0356 */ s16 splashCount; /* 0x0358 */ s16 action; /* 0x035A */ s16 index; // Has a minor effect on speed for some reason. /* 0x035C */ s16 bankState; /* 0x035E */ s16 type; /* 0x0360 */ f32 dragonflyScale; - /* 0x0364 */ f32 rotationalVelocity; - /* 0x0368 */ f32 endFrame; + /* 0x0364 */ f32 angularVelocity; + /* 0x0368 */ f32 animEndFrame; /* 0x036C */ f32 approachSpeed; /* 0x0370 */ f32 baseFlyHeight; /* 0x0374 */ f32 targetPosY; @@ -68,13 +102,13 @@ typedef struct EnGrasshopper { /* 0x03B4 */ Vec3f targetApproachPos; /* 0x03C0 */ Vec3f tailTipPos; /* 0x03CC */ Vec3f effectBasePos; - /* 0x03D8 */ Vec3f shadowBodyPartsPos[DRAGONFLY_LIMB_MAX]; + /* 0x03D8 */ Vec3f shadowBodyPartsPos[DRAGONFLY_LIMB_MAX]; // Should be `DRAGONFLY_SHADOW_BODYPART_MAX` /* 0x04F8 */ f32 waterSurface; /* 0x04FC */ Vec3f damagedVelocity; /* 0x0508 */ Vec3s targetBankRot; /* 0x0510 */ ColliderJntSph collider; /* 0x0530 */ ColliderJntSphElement colliderElements[2]; - /* 0x0570 */ EnGrasshopperEffect effects[EN_GRASSHOPPER_EFFECT_COUNT]; + /* 0x0570 */ EnGrasshopperEffect effects[DRAGONFLY_EFFECT_COUNT]; } EnGrasshopper; // size = 0x1870 #endif // Z_EN_GRASSHOPPER_H 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 6f6f2cad9..17f8cbb1d 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -6,10 +6,11 @@ #include "z_en_gs.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "objects/object_gs/object_gs.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnGs*)thisx) @@ -142,12 +143,12 @@ void EnGs_Init(Actor* thisx, PlayState* play) { this->unk_204 = 1; this->unk_198 = this->actor.world.rot.z; this->unk_195 = ENGS_GET_1F(thisx); - this->unk_196 = ENGS_GET_FE0(thisx); + this->switchFlag = ENGS_GET_SWITCH_FLAG(thisx); this->actor.params = ENGS_GET_F000(thisx); this->actor.world.rot.z = 0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->unk_216 = 0; this->unk_218 = 0; this->unk_200 = 1.0f; @@ -184,8 +185,8 @@ 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], - PLAYER_IA_NONE, 0x2000, 0x2000); + SubS_OfferTalkExchangeFacing(&this->actor, play, D_8099A408[this->actor.params], + D_8099A408[this->actor.params], PLAYER_IA_NONE, 0x2000, 0x2000); } } @@ -249,6 +250,9 @@ void func_80997E4C(EnGs* this, PlayState* play) { case ENGS_2: this->unk_210 = this->unk_195 + 0x20F7; break; + + default: + break; } Message_ContinueTextbox(play, this->unk_210); break; @@ -259,6 +263,9 @@ void func_80997E4C(EnGs* this, PlayState* play) { } } break; + + default: + break; } } @@ -270,35 +277,37 @@ void func_80997FF0(EnGs* this, PlayState* play) { } void func_80998040(EnGs* this, PlayState* play) { - func_80152434(play, 1); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY); this->actionFunc = func_8099807C; } void func_8099807C(EnGs* this, PlayState* play) { switch (play->msgCtx.ocarinaMode) { - case 3: + case OCARINA_MODE_EVENT: switch (play->msgCtx.lastPlayedSong) { case OCARINA_SONG_HEALING: case OCARINA_SONG_EPONAS: - if (!Flags_GetSwitch(play, this->unk_196)) { + if (!Flags_GetSwitch(play, this->switchFlag)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 2); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, + FAIRY_PARAMS(FAIRY_TYPE_2, false, 0)); Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - Flags_SetSwitch(play, this->unk_196); + Flags_SetSwitch(play, this->switchFlag); } break; case OCARINA_SONG_STORMS: - if (!Flags_GetSwitch(play, this->unk_196)) { + if (!Flags_GetSwitch(play, this->switchFlag)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 7); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, + FAIRY_PARAMS(FAIRY_TYPE_7, false, 0)); Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - Flags_SetSwitch(play, this->unk_196); + Flags_SetSwitch(play, this->switchFlag); } break; case OCARINA_SONG_SONATA: - if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { + if ((this->actor.params == ENGS_1) && (GET_PLAYER_FORM == PLAYER_FORM_DEKU)) { this->unk_194 = 1; this->unk_19C = 5; this->unk_19A |= 1; @@ -308,7 +317,7 @@ void func_8099807C(EnGs* this, PlayState* play) { break; case OCARINA_SONG_NEW_WAVE: - if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { + if ((this->actor.params == ENGS_1) && (GET_PLAYER_FORM == PLAYER_FORM_ZORA)) { this->unk_194 = 3; this->unk_19C = 5; this->unk_19A |= 1; @@ -318,7 +327,7 @@ void func_8099807C(EnGs* this, PlayState* play) { break; case OCARINA_SONG_GORON_LULLABY: - if ((this->actor.params == ENGS_1) && (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { + if ((this->actor.params == ENGS_1) && (GET_PLAYER_FORM == PLAYER_FORM_GORON)) { this->unk_194 = 2; this->unk_19C = 5; this->unk_19A |= 1; @@ -326,16 +335,22 @@ void func_8099807C(EnGs* this, PlayState* play) { func_809984F4(this, play); } break; + + default: + break; } break; - case 0: - case 4: + case OCARINA_MODE_NONE: + case OCARINA_MODE_END: func_80998300(this, play); - case 26: + case OCARINA_MODE_APPLY_DOUBLE_SOT: func_80997D14(this, play); break; + + default: + break; } } @@ -441,6 +456,9 @@ void func_8099874C(EnGs* this, PlayState* play) { case 4: phi_v0 = func_809995A4(this, play); break; + + default: + break; } if (phi_v0 == 0) { @@ -480,6 +498,9 @@ void func_8099874C(EnGs* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_77_20); } break; + + default: + break; } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_10)) { @@ -751,16 +772,16 @@ void func_80999584(Color_RGB8* arg0, Color_RGB8* arg1) { } s32 func_809995A4(EnGs* this, PlayState* play) { - static Color_RGB8 flashColours[] = { + static Color_RGB8 sFlashColours[] = { { 255, 50, 50 }, { 50, 50, 255 }, { 255, 255, 255 }, }; - static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f }; - static Color_RGBA8 dustPrim = { 200, 200, 200, 128 }; - static Color_RGBA8 dustEnv = { 100, 100, 100, 0 }; - static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f }; + static Vec3f sDustAccel = { 0.0f, -0.3f, 0.0f }; + static Color_RGBA8 sDustPrimColor = { 200, 200, 200, 128 }; + static Color_RGBA8 sDustEnvColor = { 100, 100, 100, 0 }; + static Vec3f sBomb2Velocity = { 0.0f, 0.0f, 0.0f }; + static Vec3f sBomb2Accel = { 0.0f, 0.0f, 0.0f }; s32 sp7C = -1; if (this->unk_19D == 0) { @@ -781,20 +802,20 @@ s32 func_809995A4(EnGs* this, PlayState* play) { u8 pad; this->unk_1D4--; - func_80999584(&this->unk_1FA, &flashColours[2]); + func_80999584(&this->unk_1FA, &sFlashColours[2]); if (this->unk_1D4 < 80) { if ((this->unk_1D4 % 20) < 8) { if (this->unk_1D4 < 20) { if ((this->unk_1D4 % 20) == 7) { - func_80999584(&this->unk_1FA, &flashColours[0]); + func_80999584(&this->unk_1FA, &sFlashColours[0]); this->unk_1F4 = this->unk_1FA; - play_sound(NA_SE_SY_WARNING_COUNT_E); + Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_E); this->unk_200 = 0.0f; } } else if ((this->unk_1D4 % 20) == 7) { - func_80999584(&this->unk_1FA, &flashColours[1]); + func_80999584(&this->unk_1FA, &sFlashColours[1]); this->unk_1F4 = this->unk_1FA; - play_sound(NA_SE_SY_WARNING_COUNT_N); + Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_N); this->unk_200 = 0.0f; } } @@ -823,10 +844,11 @@ s32 func_809995A4(EnGs* this, PlayState* play) { sp6C.y = this->actor.world.pos.y + 7.0f; sp6C.z = this->actor.world.pos.z + (2.0f * sp60.z); - func_800B0EB0(play, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, 15); + func_800B0EB0(play, &sp6C, &sp60, &sDustAccel, &sDustPrimColor, &sDustEnvColor, + Rand_ZeroFloat(50.0f) + 200.0f, 40, 15); } - func_800B9010(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); if (this->unk_1D4++ >= 40) { this->unk_19A |= 0x10; @@ -853,13 +875,13 @@ s32 func_809995A4(EnGs* this, PlayState* play) { sp54.y = this->actor.world.pos.y; sp54.z = this->actor.world.pos.z; Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - EffectSsBomb2_SpawnLayered(play, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20); + EffectSsBomb2_SpawnLayered(play, &sp54, &sBomb2Velocity, &sBomb2Accel, 100, 20); this->unk_1D4 = 10; this->unk_19A |= 8; this->unk_216 = 0; this->actionFunc = func_80999A8C; } else { - func_800B9010(&this->actor, NA_SE_EV_STONE_LAUNCH - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_STONE_LAUNCH - SFX_FLAG); } Actor_MoveWithGravity(&this->actor); @@ -924,7 +946,7 @@ void func_80999BC8(Actor* thisx, PlayState* play2) { EnGs* this = THIS; s32 pad; - if (this->actor.isTargeted && !func_801A5100()) { + if (this->actor.isLockedOn && !func_801A5100()) { this->unk_19D = 0; this->unk_19A |= 1; func_80999AC0(this); @@ -1008,7 +1030,7 @@ void EnGs_Update(Actor* thisx, PlayState* play) { EnGs* this = THIS; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; this->collider.base.acFlags &= ~AC_HIT; func_80997DEC(this, play); @@ -1044,7 +1066,7 @@ void EnGs_Update(Actor* thisx, PlayState* play) { Math_StepToF(&this->unk_200, 1.0f, 0.02f); } func_80997AFC(this->unk_194, &this->unk_1F7); - Lib_LerpRGB(&this->unk_1F4, &this->unk_1F7, this->unk_200, &this->unk_1FA); + Color_RGB8_Lerp(&this->unk_1F4, &this->unk_1F7, this->unk_200, &this->unk_1FA); if (this->unk_200 >= 1.0f) { this->unk_1F4 = this->unk_1FA; } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index b7af0c582..ffeb3083e 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -8,7 +8,7 @@ struct EnGs; typedef void (*EnGsActionFunc)(struct EnGs*, PlayState*); #define ENGS_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENGS_GET_FE0(thisx) (((thisx)->params >> 5) & 0x7F) +#define ENGS_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 5) & 0x7F) #define ENGS_GET_F000(thisx) (((thisx)->params >> 0xC) & 0xF) typedef enum { @@ -24,7 +24,7 @@ typedef struct EnGs { /* 0x190 */ EnGsActionFunc actionFunc; /* 0x194 */ s8 unk_194; /* 0x195 */ u8 unk_195; - /* 0x196 */ u8 unk_196; + /* 0x196 */ u8 switchFlag; /* 0x197 */ s8 unk_197; /* 0x198 */ s16 unk_198; /* 0x19A */ s16 unk_19A; 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 ea93d617f..92e3bf306 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 @@ -7,7 +7,7 @@ #include "z_en_guard_nuts.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_100000 | ACTOR_FLAG_80000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_100000 | ACTOR_FLAG_80000000) #define THIS ((EnGuardNuts*)thisx) @@ -61,18 +61,32 @@ s32 sGuardCount = 0; s32 D_80ABBE20 = 0; -static u16 sTextIDs[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C }; +static u16 sTextIds[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C }; s16 D_80ABBE38[] = { 0x0000, 0x0000, 0x0002, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0002 }; -static AnimationHeader* sAnimations[] = { - &gDekuPalaceGuardWaitAnim, - &gDekuPalaceGuardWalkAnim, - &gDekuPalaceGuardDigAnim, - &gDekuPalaceGuardWalkAnim, +typedef enum { + /* -1 */ GUARD_NUTS_ANIM_NONE = -1, + /* 0 */ GUARD_NUTS_ANIM_WAIT_HEAD_TILT, + /* 1 */ GUARD_NUTS_ANIM_WALK, + /* 2 */ GUARD_NUTS_ANIM_DIG, + /* 3 */ GUARD_NUTS_ANIM_WALK_2, + /* 4 */ GUARD_NUTS_ANIM_MAX +} EnGuardNutsAnimation; + +static AnimationHeader* sAnimations[GUARD_NUTS_ANIM_MAX] = { + &gDekuPalaceGuardWaitAnim, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT + &gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK + &gDekuPalaceGuardDigAnim, // GUARD_NUTS_ANIM_DIG + &gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK_2 }; -static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE }; +static u8 sAnimationModes[GUARD_NUTS_ANIM_MAX] = { + ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT + ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WALK + ANIMMODE_ONCE, // GUARD_NUTS_ANIM_DIG + ANIMMODE_ONCE, // GUARD_NUTS_ANIM_WALK_2 +}; static TexturePtr sEyeTextures[] = { gDekuPalaceGuardEyeOpenTex, @@ -80,13 +94,6 @@ static TexturePtr sEyeTextures[] = { gDekuPalaceGuardEyeClosedTex, }; -typedef enum { - /* 0 */ WAIT_HEAD_TILT_ANIM, - /* 1 */ WALK_ANIM, - /* 2 */ DIG_ANIM, - /* 3 */ WALK_ANIM_2 -} EnGuardNutsAnim; - typedef enum { /* 0 */ GUARD_NUTS_WAIT_STATE, /* 1 */ GUARD_NUTS_TALKING_STATE, @@ -101,7 +108,7 @@ void EnGuardNuts_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gDekuPalaceGuardSkel, &gDekuPalaceGuardWaitAnim, this->jointTable, this->morphTable, DEKU_PALACE_GUARD_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.015f); Math_Vec3f_Copy(&this->guardPos, &this->actor.world.pos); @@ -123,20 +130,20 @@ void EnGuardNuts_Destroy(Actor* thisx, PlayState* play) { } /** - * @brief Changes the animation to the provided index. Updates animIndex and animFrameCount for the animation. + * @brief Changes the animation to the provided index. Updates animIndex and animEndFrame for the animation. * * @param this * @param animIndex the index of sAnimations to change to */ 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, + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -2.0f); } void EnGuardNuts_SetupWait(EnGuardNuts* this) { - EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM); + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT); this->state = GUARD_NUTS_WAIT_STATE; this->actionFunc = EnGuardNuts_Wait; } @@ -169,22 +176,22 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) { // No place for an outsider this->guardTextIndex = 3; } - this->actor.textId = sTextIDs[this->guardTextIndex]; + this->actor.textId = sTextIds[this->guardTextIndex]; phi_a1 = this->actor.world.rot.y; if (D_80ABBE20 == 2) { EnGuardNuts_Burrow(this, play); return; } if (D_80ABBE20 == 1) { - if (this->animIndex != WALK_ANIM) { - EnGuardNuts_ChangeAnim(this, WALK_ANIM); + if (this->animIndex != GUARD_NUTS_ANIM_WALK) { + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK); } phi_a1 = (this->actor.home.rot.y + 0x8000); } if (fabsf((f32)(this->actor.shape.rot.y - phi_a1)) < 100.0f) { this->actor.shape.rot.y = phi_a1; - if ((D_80ABBE20 == 1) && (this->animIndex != WALK_ANIM_2)) { - EnGuardNuts_ChangeAnim(this, WALK_ANIM_2); + if ((D_80ABBE20 == 1) && (this->animIndex != GUARD_NUTS_ANIM_WALK_2)) { + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK_2); } } else { Math_SmoothStepToS(&this->actor.shape.rot.y, phi_a1, 1, 0xBB8, 0); @@ -195,11 +202,11 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) { this->targetHeadPos.y = -this->targetHeadPos.y; } } - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } void func_80ABB540(EnGuardNuts* this) { - EnGuardNuts_ChangeAnim(this, WALK_ANIM); + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK); this->targetHeadPos.x = this->targetHeadPos.y = 0; this->timer = 16; this->state = GUARD_NUTS_TALKING_STATE; @@ -216,7 +223,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { if (fabsf((this->actor.shape.rot.y - yaw)) < 100.0f) { this->actor.shape.rot.y = yaw; curFrame = this->skelAnime.curFrame; - if ((curFrame < this->animFrameCount) || (this->guardTextIndex >= 7)) { + if ((curFrame < this->animEndFrame) || (this->guardTextIndex >= 7)) { SkelAnime_Update(&this->skelAnime); } } else { @@ -226,8 +233,8 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { this->targetHeadPos.y = 0; this->targetHeadPos.x = 0; - if ((this->guardTextIndex == 3) && (this->animIndex == WAIT_HEAD_TILT_ANIM)) { - EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM); + if ((this->guardTextIndex == 3) && (this->animIndex == GUARD_NUTS_ANIM_WAIT_HEAD_TILT)) { + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT); } if (Message_ShouldAdvance(play)) { if (D_80ABBE38[this->guardTextIndex] != 1) { @@ -238,7 +245,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { EnGuardNuts_Burrow(this, play); } else { this->guardTextIndex++; - Message_StartTextbox(play, sTextIDs[this->guardTextIndex], &this->actor); + Message_StartTextbox(play, sTextIds[this->guardTextIndex], &this->actor); if (D_80ABBE38[this->guardTextIndex] == 2) { D_80ABBE20 = 1; } @@ -271,7 +278,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play) { Vec3f digPos; - EnGuardNuts_ChangeAnim(this, DIG_ANIM); + EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_DIG); Math_Vec3f_Copy(&digPos, &this->actor.world.pos); digPos.y = this->actor.floorHeight; EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); @@ -287,7 +294,7 @@ void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - if (this->animFrameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { this->state = GUARD_NUTS_BURROWED_STATE; this->actionFunc = EnGuardNuts_Unburrow; this->actor.world.rot.y = this->actor.home.rot.y; @@ -322,13 +329,14 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) { s32 pad; if (this->blinkTimer == 0) { - if (++(this->eyeState) >= 3) { + this->eyeState++; + if (this->eyeState >= 3) { this->eyeState = 0; this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - if ((this->animIndex == WALK_ANIM) && - ((Animation_OnFrame(&this->skelAnime, 1.0f)) || (Animation_OnFrame(&this->skelAnime, 5.0f)))) { + if ((this->animIndex == GUARD_NUTS_ANIM_WALK) && + (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } @@ -381,7 +389,7 @@ void EnGuardNuts_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gDekuPalaceGuardFlower); + gSPDisplayList(POLY_OPA_DISP++, gDekuPalaceGuardFlowerDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h index 8cbe26f03..e07e70eaf 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h @@ -25,7 +25,7 @@ typedef struct EnGuardNuts { /* 0x228 */ Vec3f guardPos; /* 0x234 */ Vec3s headRot; /* 0x23A */ Vec3s targetHeadPos; - /* 0x240 */ f32 animFrameCount; + /* 0x240 */ f32 animEndFrame; /* 0x244 */ ColliderCylinder collider; } EnGuardNuts; // size = 0x290 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 cb9545d7a..b3ae6bbeb 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -5,9 +5,8 @@ */ #include "z_en_guruguru.h" -#include "objects/object_fu/object_fu.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnGuruguru*)thisx) @@ -62,20 +61,38 @@ static ColliderCylinderInit sCylinderInit = { { 15, 20, 0, { 0, 0, 0 } }, }; -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 }; +typedef enum { + /* 0 */ GURU_GURU_ANIM_PLAY_STILL, + /* 1 */ GURU_GURU_ANIM_PLAY_MOVE_HEAD, + /* 2 */ GURU_GURU_ANIM_MAX +} GuruGuruAnimation; + +static AnimationHeader* sAnimations[GURU_GURU_ANIM_MAX] = { + &gGuruGuruPlayStillAnim, // GURU_GURU_ANIM_PLAY_STILL + &gGuruGuruPlayAndMoveHeadAnim, // GURU_GURU_ANIM_PLAY_MOVE_HEAD +}; + +static u8 sAnimationModes[GURU_GURU_ANIM_MAX] = { + ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_STILL + ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_MOVE_HEAD +}; + +static f32 sPlaySpeeds[GURU_GURU_ANIM_MAX] = { + 1.0f, // GURU_GURU_ANIM_PLAY_STILL + 1.0f, // GURU_GURU_ANIM_PLAY_MOVE_HEAD +}; + +static TexturePtr sEyeTextures[] = { gGuruGuruEyeClosedTex, gGuruGuruEyeAngryTex }; +static TexturePtr sMouthTextures[] = { gGuruGuruMouthOpenTex, gGuruGuruMouthAngryTex }; void EnGuruguru_Init(Actor* thisx, PlayState* play) { EnGuruguru* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_fu_Skel_006C90, &object_fu_Anim_000B04, this->jointTable, - this->morphTable, 16); - this->actor.targetMode = 0; + SkelAnime_InitFlex(play, &this->skelAnime, &gGuruGuruSkel, &gGuruGuruPlayStillAnim, this->jointTable, + this->morphTable, GURU_GURU_LIMB_MAX); + this->actor.targetMode = TARGET_MODE_0; if (this->actor.params != 2) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } @@ -85,7 +102,7 @@ void EnGuruguru_Init(Actor* thisx, PlayState* play) { } else if (this->actor.params == 2) { this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnGuruguru_DoNothing; } else { Actor_Kill(&this->actor); @@ -106,8 +123,8 @@ void EnGuruguru_Destroy(Actor* thisx, PlayState* play) { } 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, + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->animEndFrame, sAnimationModes[animIndex], -4.0f); } @@ -115,7 +132,7 @@ void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play) { } void func_80BC6E10(EnGuruguru* this) { - EnGuruguru_ChangeAnim(this, 0); + EnGuruguru_ChangeAnim(this, GURU_GURU_ANIM_PLAY_STILL); this->textIdIndex = 0; this->unk270 = 0; if (this->actor.params == 0) { @@ -167,7 +184,7 @@ void func_80BC6F14(EnGuruguru* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80BC701C(this, play); } else if (yaw <= 0x2890) { - func_800B8614(&this->actor, play, 60.0f); + Actor_OfferTalk(&this->actor, play, 60.0f); } } @@ -295,7 +312,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->unk268 = 0; SET_WEEKEVENTREG(WEEKEVENTREG_38_40); this->actionFunc = func_80BC7520; @@ -309,7 +326,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); } } @@ -333,12 +350,12 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) { if (this->actor.params == 2) { if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) { - func_801A1DB8(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f); + Audio_PlaySubBgmAtPosWithFilter(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f); } return; } if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 200.0f) { - func_801A1D44(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f); + Audio_PlaySubBgmAtPos(&this->actor.projectedPos, NA_BGM_SONG_OF_STORMS, 540.0f); } if (this->unusedTimer != 0) { this->unusedTimer--; @@ -373,7 +390,7 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) { s32 EnGuruguru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGuruguru* this = THIS; - if (limbIndex == 14) { + if (limbIndex == GURU_GURU_LIMB_HEAD) { rot->x += this->headXRot; rot->z += this->headZRot; } 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 0158e3ddc..4913d4124 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h @@ -2,6 +2,7 @@ #define Z_EN_GURUGURU_H #include "global.h" +#include "objects/object_fu/object_fu.h" struct EnGuruguru; @@ -10,8 +11,8 @@ typedef void (*EnGuruguruActionFunc)(struct EnGuruguru*, PlayState*); typedef struct EnGuruguru { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[16]; - /* 0x1E8 */ Vec3s morphTable[16]; + /* 0x188 */ Vec3s jointTable[GURU_GURU_LIMB_MAX]; + /* 0x1E8 */ Vec3s morphTable[GURU_GURU_LIMB_MAX]; /* 0x248 */ EnGuruguruActionFunc actionFunc; /* 0x24C */ s16 headZRot; /* 0x24E */ s16 headXRot; @@ -22,7 +23,7 @@ typedef struct EnGuruguru { /* 0x264 */ s16 unusedTimer; // set to 6 and decremented, but never has any effect /* 0x266 */ s16 unk266; /* 0x268 */ s16 unk268; - /* 0x26C */ f32 frameCount; + /* 0x26C */ f32 animEndFrame; /* 0x270 */ u8 unk270; /* 0x272 */ s16 unk272; // set, but never used /* 0x274 */ s16 textIdIndex; 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 4294a8320..85000e5cb 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -149,40 +149,41 @@ void func_80B22FA8(EnHanabiStruct* arg0, PlayState* play2) { gSPDisplayList(POLY_XLU_DISP++, gSunSparkleMaterialDL); sp53 = 0xFF; - if (sp53) {} for (i = 0; i < 400; i++, arg0++) { - if (arg0->unk_00 == 1) { - Matrix_Translate(arg0->unk_08.x, arg0->unk_08.y, arg0->unk_08.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - if (arg0->unk_01 < 40) { - Matrix_Scale(arg0->unk_04 * 0.025f * arg0->unk_01, arg0->unk_04 * 0.025f * arg0->unk_01, 1.0f, - MTXMODE_APPLY); - } else { - Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY); - } - Matrix_RotateZS(play->gameplayFrames * 4864, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - if (sp53 != arg0->unk_02) { - gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40[arg0->unk_02], D_80B23C40[arg0->unk_02 + 1], - D_80B23C40[arg0->unk_02 + 2], 255); - - sp53 = arg0->unk_02; - } - - if (arg0->unk_01 < 6) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1], - D_80B23C2C[arg0->unk_02 + 2], arg0->unk_01 * 50); - } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1], - D_80B23C2C[arg0->unk_02 + 2], 255); - } - - gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL); + if (arg0->unk_00 != 1) { + continue; } + + Matrix_Translate(arg0->unk_08.x, arg0->unk_08.y, arg0->unk_08.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + if (arg0->unk_01 < 40) { + Matrix_Scale(arg0->unk_04 * 0.025f * arg0->unk_01, arg0->unk_04 * 0.025f * arg0->unk_01, 1.0f, + MTXMODE_APPLY); + } else { + Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY); + } + Matrix_RotateZS(play->gameplayFrames * 4864, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (sp53 != arg0->unk_02) { + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40[arg0->unk_02], D_80B23C40[arg0->unk_02 + 1], + D_80B23C40[arg0->unk_02 + 2], 255); + + sp53 = arg0->unk_02; + } + + if (arg0->unk_01 < 6) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1], + D_80B23C2C[arg0->unk_02 + 2], arg0->unk_01 * 50); + } else { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1], + D_80B23C2C[arg0->unk_02 + 2], 255); + } + + gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL); } CLOSE_DISPS(gfxCtx); @@ -193,6 +194,7 @@ void EnHanabi_Init(Actor* thisx, PlayState* play2) { EnHanabi* this = THIS; s32 i; + //! FAKE: if (1) {} Actor_SetScale(thisx, 1.0f); @@ -326,7 +328,7 @@ void func_80B23934(EnHanabi* this, PlayState* play) { if ((gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 1)) && (gSaveContext.sceneLayer == 7)) { if (play->csCtx.curFrame > 1650) { func_80B236C8(this, play); - func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered3(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index e5b806b90..b22949cb0 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -33,13 +33,12 @@ void EnHata_Init(Actor* thisx, PlayState* play) { s32 rand; f32 endFrame; - SkelAnime_Init(play, &this->skelAnime, &object_hata_Skel_002FD0, NULL, this->jointTable, this->morphTable, - OBJECT_HATA_LIMB_MAX); - endFrame = Animation_GetLastFrame(&object_hata_Anim_000444); - Animation_Change(&this->skelAnime, &object_hata_Anim_000444, 1.0f, 0.0f, endFrame, ANIMMODE_LOOP, 0.0f); + SkelAnime_Init(play, &this->skelAnime, &gFlagpoleSkel, NULL, this->jointTable, this->morphTable, FLAGPOLE_LIMB_MAX); + endFrame = Animation_GetLastFrame(&gFlagpoleFlapAnim); + Animation_Change(&this->skelAnime, &gFlagpoleFlapAnim, 1.0f, 0.0f, endFrame, ANIMMODE_LOOP, 0.0f); rand = Rand_ZeroFloat(endFrame); this->skelAnime.curFrame = rand; - DynaPolyActor_LoadMesh(play, &this->dyna, &object_hata_Colheader_0000C0); + DynaPolyActor_LoadMesh(play, &this->dyna, &gFlagpoleCol); Actor_SetScale(&this->dyna.actor, 0.013f); this->dyna.actor.uncullZoneScale = 500.0f; this->dyna.actor.uncullZoneDownward = 500.0f; @@ -63,10 +62,10 @@ void EnHata_Update(Actor* thisx, PlayState* play2) { this->skelAnime.playSpeed = 2.75f * phi_fv0; this->skelAnime.playSpeed += 1.0f + Rand_ZeroFloat(1.25f); - sp34.x = play->envCtx.windDir.x; - sp34.y = play->envCtx.windDir.y + ((1.0f - phi_fv0) * 240.0f); + sp34.x = play->envCtx.windDirection.x; + sp34.y = play->envCtx.windDirection.y + ((1.0f - phi_fv0) * 240.0f); sp34.y = CLAMP(sp34.y, -118.0f, 118.0f); - sp34.z = play->envCtx.windDir.z; + sp34.z = play->envCtx.windDirection.z; phi_fv0 = CLAMP(phi_fv0, 0.1f, 0.4f); Math_ApproachF(&this->unk_2A4.x, sp34.x, phi_fv0, 1000.0f); @@ -84,7 +83,7 @@ void EnHata_Update(Actor* thisx, PlayState* play2) { s32 EnHata_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHata* this = THIS; - if ((limbIndex == OBJECT_HATA_LIMB_04) || (limbIndex == OBJECT_HATA_LIMB_0D)) { + if ((limbIndex == FLAGPOLE_LIMB_FLAG1_HOIST_END_BASE) || (limbIndex == FLAGPOLE_LIMB_FLAG2_HOIST_END_BASE)) { rot->y += this->unk_29C; rot->z += this->unk_2A0; } diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.h b/src/overlays/actors/ovl_En_Hata/z_en_hata.h index 155460f60..60e3edba8 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.h +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.h @@ -9,8 +9,8 @@ struct EnHata; typedef struct EnHata { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ SkelAnime skelAnime; - /* 0x1A0 */ Vec3s jointTable[OBJECT_HATA_LIMB_MAX]; - /* 0x21E */ Vec3s morphTable[OBJECT_HATA_LIMB_MAX]; + /* 0x1A0 */ Vec3s jointTable[FLAGPOLE_LIMB_MAX]; + /* 0x21E */ Vec3s morphTable[FLAGPOLE_LIMB_MAX]; /* 0x29C */ s16 unk_29C; /* 0x29E */ UNK_TYPE1 pad_29E[2]; /* 0x2A0 */ s16 unk_2A0; 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 a335e39d2..650d4c69d 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -6,7 +6,7 @@ #include "z_en_heishi.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnHeishi*)thisx) @@ -20,14 +20,6 @@ void EnHeishi_SetHeadRotation(EnHeishi* this); void EnHeishi_SetupIdle(EnHeishi* this); void EnHeishi_Idle(EnHeishi* this, PlayState* play); -typedef enum { - /* 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; - ActorInit En_Heishi_InitVars = { ACTOR_EN_HEISHI, ACTORCAT_NPC, @@ -64,7 +56,7 @@ void EnHeishi_Init(Actor* thisx, PlayState* play) { EnHeishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWaveAnim, this->jointTable, this->morphTable, SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->paramsCopy = this->actor.params; @@ -84,7 +76,7 @@ void EnHeishi_Init(Actor* thisx, PlayState* play) { } } - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; @@ -97,19 +89,36 @@ void EnHeishi_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliderCylinder); } +typedef enum EnHeishiAnimation { + /* 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, + /* 5 */ HEISHI_ANIM_MAX +} EnHeishiAnimation; + +static AnimationHeader* sAnimations[HEISHI_ANIM_MAX] = { + &gSoldierStandHandOnHipAnim, // HEISHI_ANIM_STAND_HAND_ON_HIP + &gSoldierCheerWithSpearAnim, // HEISHI_ANIM_CHEER_WITH_SPEAR + &gSoldierWaveAnim, // HEISHI_ANIM_WAVE + &gSoldierSitAndReachAnim, // HEISHI_ANIM_SIT_AND_REACH + &gSoldierStandUpAnim, // HEISHI_ANIM_STAND_UP +}; + +static u8 sAnimationModes[HEISHI_ANIM_MAX] = { + ANIMMODE_LOOP, // HEISHI_ANIM_STAND_HAND_ON_HIP + ANIMMODE_LOOP, // HEISHI_ANIM_CHEER_WITH_SPEAR + ANIMMODE_LOOP, // HEISHI_ANIM_WAVE + ANIMMODE_LOOP, // HEISHI_ANIM_SIT_AND_REACH + ANIMMODE_ONCE, // HEISHI_ANIM_STAND_UP +}; + void EnHeishi_ChangeAnim(EnHeishi* this, s32 animIndex) { - static AnimationHeader* sAnimations[] = { - &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, - }; - 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, - }; this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -10.0f); } diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h index 1758ceae6..4d886cb3c 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h @@ -25,7 +25,7 @@ typedef struct EnHeishi { /* 0x26C */ s32 shouldSetHeadRotation; /* 0x270 */ s16 timer; /* 0x272 */ s16 yawTowardsPlayer; - /* 0x274 */ f32 frameCount; + /* 0x274 */ f32 animEndFrame; /* 0x278 */ s16 unk278; // set and not used /* 0x27C */ UNK_TYPE1 unk_27C[0x8]; /* 0x284 */ ColliderCylinder colliderCylinder; 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 180bf8cab..648b63b6b 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -6,7 +6,7 @@ #include "z_en_hg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) #define THIS ((EnHg*)thisx) @@ -29,17 +29,6 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play); s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); -typedef enum { - /* 0 */ HG_ANIM_IDLE, - /* 1 */ HG_ANIM_LURCH_FORWARD, - /* 2 */ HG_ANIM_RECOIL, - /* 3 */ HG_ANIM_LEAN_FORWARD, - /* 4 */ HG_ANIM_REACH_FORWARD, - /* 5 */ HG_ANIM_CURL_UP, - /* 6 */ HG_ANIM_CROUCHED_PANIC, - /* 7 */ HG_ANIM_PANIC -} HgAnimation; - typedef enum { /* 0 */ HG_CS_FIRST_ENCOUNTER, /* 1 */ HG_CS_GET_MASK, @@ -118,15 +107,27 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, 0x80, }; -static AnimationInfo sAnimationInfo[] = { - { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ HG_ANIM_IDLE, + /* 1 */ HG_ANIM_LURCH_FORWARD, + /* 2 */ HG_ANIM_RECOIL, + /* 3 */ HG_ANIM_LEAN_FORWARD, + /* 4 */ HG_ANIM_REACH_FORWARD, + /* 5 */ HG_ANIM_CURL_UP, + /* 6 */ HG_ANIM_CROUCHED_PANIC, + /* 7 */ HG_ANIM_PANIC, + /* 8 */ HG_ANIM_MAX +} HgAnimation; + +static AnimationInfo sAnimationInfo[HG_ANIM_MAX] = { + { &gPamelasFatherIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_IDLE + { &gPamelasFatherLurchForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_LURCH_FORWARD + { &gPamelasFatherRecoilFromHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HG_ANIM_RECOIL + { &gPamelasFatherLeanForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_LEAN_FORWARD + { &gPamelasFatherReachForwardAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_REACH_FORWARD + { &gPamelasFatherCurlUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HG_ANIM_CURL_UP + { &gPamelasFatherCrouchedPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_CROUCHED_PANIC + { &gPamelasFatherPanicAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HG_ANIM_PANIC }; static u32 sHasSoundPlayed = false; @@ -145,7 +146,7 @@ void EnHg_Init(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { Actor_Kill(&this->actor); } - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actor.colChkInfo.health = 0; this->actor.gravity = -1.0f; for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { @@ -192,7 +193,7 @@ void EnHg_ChasePlayer(EnHg* this, PlayState* play) { s32 pad; this->actor.speed = 1.6f; - if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { + if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) || ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) { Actor_MoveWithGravity(&this->actor); @@ -233,10 +234,9 @@ void EnHg_ReactToHit(EnHg* this, PlayState* play) { void EnHg_HandleTatlDialog(EnHg* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - // "...Sort of looks different..." Message_StartTextbox(play, 0x24F, &this->actor); } else { - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } } } @@ -245,7 +245,7 @@ void EnHg_PlayRedeadSfx(EnHg* this, PlayState* play) { if (this->actor.colChkInfo.health == 1) { if ((this->actionFunc == EnHg_ChasePlayer) || (this->actionFunc == EnHg_ReactToHit) || (this->actionFunc == EnHg_ChasePlayerWait)) { - func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_LOOP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_LOOP - SFX_FLAG); } } } @@ -295,7 +295,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { this->csIdList[3] = play->csCtx.actorCues[cueChannel]->id; switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->animIndex = 0; + this->animIndex = HG_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_IDLE); break; @@ -315,7 +315,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { this->csIdList[2] = 0; this->animIndex = HG_ANIM_PANIC; if ((this->csIdIndex == HG_CS_GET_MASK) || (this->csIdIndex == HG_CS_SONG_OF_HEALING)) { - func_8019F128(NA_SE_EN_HALF_REDEAD_TRANS); + Audio_PlaySfx_2(NA_SE_EN_HALF_REDEAD_TRANS); } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_PANIC); break; @@ -329,6 +329,9 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_75_20); Actor_Kill(&this->actor); break; + + default: + break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->animIndex) { @@ -341,25 +344,31 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { this->animIndex = HG_ANIM_CROUCHED_PANIC; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_CROUCHED_PANIC); break; + + default: + break; } } switch (this->animIndex) { case HG_ANIM_LEAN_FORWARD: case HG_ANIM_REACH_FORWARD: - func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_LOOP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_LOOP - SFX_FLAG); break; case HG_ANIM_CURL_UP: case HG_ANIM_CROUCHED_PANIC: - func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); break; case HG_ANIM_PANIC: if ((this->csIdIndex == HG_CS_FIRST_ENCOUNTER) || (this->csIdIndex == HG_CS_SUBSEQUENT_ENCOUNTER)) { - func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); } break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); @@ -382,16 +391,15 @@ void EnHg_WaitForPlayerAction(EnHg* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_8000000) { if (!sHasSoundPlayed) { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } sHasSoundPlayed = true; } else { sHasSoundPlayed = false; } - if (play->msgCtx.ocarinaMode == 3) { - if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { + if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { if (INV_CONTENT(ITEM_MASK_GIBDO) == ITEM_MASK_GIBDO) { this->csIdIndex = HG_CS_SONG_OF_HEALING; } else { 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 f6c90f6b4..c4d9c0371 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -6,7 +6,7 @@ #include "z_en_hgo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnHgo*)thisx) @@ -38,16 +38,6 @@ typedef enum { /* 2 */ HGO_EYE_CLOSED } EyeState; -typedef enum { - /* 0 */ HGO_ANIM_ARMS_FOLDED, - /* 1 */ HGO_ANIM_ASTONISHED, - /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG, - /* 3 */ HGO_ANIM_CONSOLE, - /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP, - /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT, - /* 6 */ HGO_ANIM_TOSS -} HgoAnimation; - ActorInit En_Hgo_InitVars = { ACTOR_EN_HGO, ACTORCAT_NPC, @@ -60,14 +50,25 @@ ActorInit En_Hgo_InitVars = { (ActorFunc)EnHgo_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ HGO_ANIM_ARMS_FOLDED, + /* 1 */ HGO_ANIM_ASTONISHED, + /* 2 */ HGO_ANIM_KNEEL_DOWN_AND_HUG, + /* 3 */ HGO_ANIM_CONSOLE, + /* 4 */ HGO_ANIM_CONSOLE_HEAD_UP, + /* 5 */ HGO_ANIM_REACH_DOWN_TO_LIFT, + /* 6 */ HGO_ANIM_TOSS, + /* 7 */ HGO_ANIM_MAX +} HgoAnimation; + +static AnimationInfo sAnimationInfo[HGO_ANIM_MAX] = { + { &gPamelasFatherArmsFoldedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // HGO_ANIM_ARMS_FOLDED + { &gPamelasFatherAstonishedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_ASTONISHED + { &gPamelasFatherKneelDownAndHugAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_KNEEL_DOWN_AND_HUG + { &gPamelasFatherConsoleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE + { &gPamelasFatherConsoleHeadUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_CONSOLE_HEAD_UP + { &gPamelasFatherReachDownToLiftAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // HGO_ANIM_REACH_DOWN_TO_LIFT + { &gPamelasFatherTossAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // HGO_ANIM_TOSS }; static ColliderCylinderInit sCylinderInit = { @@ -102,13 +103,14 @@ void EnHgo_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&thisx->colChkInfo, NULL, &sColChkInfoInit); - thisx->targetMode = 6; + thisx->targetMode = TARGET_MODE_6; this->eyeIndex = 0; this->blinkTimer = 0; this->textId = 0; this->talkFlags = TALK_FLAG_NONE; this->isInCutscene = false; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { EnHgo_SetupTalk(this); } else { @@ -124,7 +126,7 @@ void EnHgo_Destroy(Actor* thisx, PlayState* play) { } void EnHgo_SetupDoNothing(EnHgo* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnHgo_DoNothing; } @@ -143,7 +145,7 @@ void EnHgo_UpdateCollision(EnHgo* this, PlayState* play) { } void EnHgo_SetupTalk(EnHgo* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED); this->actionFunc = EnHgo_Talk; } @@ -159,7 +161,7 @@ void EnHgo_Talk(EnHgo* this, PlayState* play) { Message_StartTextbox(play, 0x15A7, &this->actor); this->textId = 0x15A7; // can I research that mask } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { if (!(this->talkFlags & TALK_FLAG_HAS_SPOKEN_WITH_HUMAN)) { this->talkFlags |= TALK_FLAG_HAS_SPOKEN_WITH_HUMAN; Message_StartTextbox(play, 0x158F, &this->actor); @@ -180,7 +182,7 @@ void EnHgo_Talk(EnHgo* this, PlayState* play) { } EnHgo_SetupDialogueHandler(this); } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -206,6 +208,9 @@ void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play) { EnHgo_SetupTalk(this); } break; + + default: + break; } Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x71C, 0xB6); @@ -271,6 +276,9 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) { Message_CloseTextbox(play); EnHgo_SetupTalk(this); break; + + default: + break; } } } @@ -285,40 +293,42 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = HGO_ANIM_ARMS_FOLDED; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ARMS_FOLDED); break; case 2: this->actor.draw = EnHgo_Draw; this->animIndex = HGO_ANIM_ASTONISHED; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_ASTONISHED); break; case 3: this->animIndex = HGO_ANIM_KNEEL_DOWN_AND_HUG; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_KNEEL_DOWN_AND_HUG); break; case 4: this->animIndex = HGO_ANIM_CONSOLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE); break; case 5: this->animIndex = HGO_ANIM_CONSOLE_HEAD_UP; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE_HEAD_UP); break; case 6: this->animIndex = HGO_ANIM_REACH_DOWN_TO_LIFT; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_REACH_DOWN_TO_LIFT); + break; + + default: break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->animIndex) { case HGO_ANIM_ASTONISHED: - if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && - (this->isInCutscene == false)) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && !this->isInCutscene) { this->isInCutscene = true; if ((gSaveContext.sceneLayer == 0) && ((play->csCtx.scriptIndex == 2) || (play->csCtx.scriptIndex == 4))) { @@ -329,12 +339,15 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { case HGO_ANIM_KNEEL_DOWN_AND_HUG: this->animIndex = HGO_ANIM_CONSOLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_CONSOLE); break; case HGO_ANIM_REACH_DOWN_TO_LIFT: this->animIndex = HGO_ANIM_TOSS; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HGO_ANIM_TOSS); + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index 8ad694a11..48f75aa68 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -6,9 +6,8 @@ #include "z_en_hidden_nuts.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_hintnuts/object_hintnuts.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_2000000) #define THIS ((EnHiddenNuts*)thisx) @@ -63,15 +62,41 @@ static ColliderCylinderInit sCylinderInit = { { 30, 20, 0, { 0, 0, 0 } }, }; -static AnimationHeader* D_80BDC0FC[] = { - &object_hintnuts_Anim_000168, &object_hintnuts_Anim_0024CC, &object_hintnuts_Anim_0026C4, - &object_hintnuts_Anim_002894, &object_hintnuts_Anim_002B90, &object_hintnuts_Anim_002F7C, - &object_hintnuts_Anim_003128, &object_hintnuts_Anim_0029BC, &object_hintnuts_Anim_0024CC, +typedef enum EnHiddenNutsAnimation { + /* 0 */ ENHIDDENNUTS_ANIM_0, + /* 1 */ ENHIDDENNUTS_ANIM_1, + /* 2 */ ENHIDDENNUTS_ANIM_2, + /* 3 */ ENHIDDENNUTS_ANIM_3, + /* 4 */ ENHIDDENNUTS_ANIM_4, + /* 5 */ ENHIDDENNUTS_ANIM_5, + /* 6 */ ENHIDDENNUTS_ANIM_6, + /* 7 */ ENHIDDENNUTS_ANIM_7, + /* 8 */ ENHIDDENNUTS_ANIM_8, + /* 9 */ ENHIDDENNUTS_ANIM_MAX +} EnHiddenNutsAnimation; + +static AnimationHeader* sAnimations[ENHIDDENNUTS_ANIM_MAX] = { + &object_hintnuts_Anim_000168, // ENHIDDENNUTS_ANIM_0 + &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_1 + &object_hintnuts_Anim_0026C4, // ENHIDDENNUTS_ANIM_2 + &object_hintnuts_Anim_002894, // ENHIDDENNUTS_ANIM_3 + &object_hintnuts_Anim_002B90, // ENHIDDENNUTS_ANIM_4 + &object_hintnuts_Anim_002F7C, // ENHIDDENNUTS_ANIM_5 + &object_hintnuts_Anim_003128, // ENHIDDENNUTS_ANIM_6 + &object_hintnuts_Anim_0029BC, // ENHIDDENNUTS_ANIM_7 + &object_hintnuts_Anim_0024CC, // ENHIDDENNUTS_ANIM_8 }; -u8 D_80BDC120[] = { - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, +static u8 sAnimationModes[ENHIDDENNUTS_ANIM_MAX] = { + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_0 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_1 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_2 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_3 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_4 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_5 + ANIMMODE_LOOP, // ENHIDDENNUTS_ANIM_6 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_7 + ANIMMODE_ONCE, // ENHIDDENNUTS_ANIM_8 }; void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { @@ -79,16 +104,16 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC, - this->jointTable, this->morphTable, 10); + this->jointTable, this->morphTable, OBJECT_HINTNUTS_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->pathIndex = ENHIDDENNUTS_GET_PATH_INDEX(&this->actor); - this->switchFlag = ENHIDDENNUTS_GET_SWITCHFLAG(&this->actor); + this->switchFlag = ENHIDDENNUTS_GET_SWITCH_FLAG(&this->actor); if (this->switchFlag == 0x7F) { this->switchFlag = -1; @@ -116,27 +141,29 @@ void EnHiddenNuts_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80BDB1B4(EnHiddenNuts* this, s32 arg1) { - f32 sp34; - f32 sp30; +void EnHiddenNuts_ChangeAnim(EnHiddenNuts* this, s32 animIndex) { + f32 startFrame; + f32 morphFrames; - this->unk_220 = arg1; - sp34 = 0.0f; - sp30 = -4.0f; - this->unk_22C = Animation_GetLastFrame(D_80BDC0FC[arg1]); - if (this->unk_220 == 1) { - sp34 = this->unk_22C; - sp30 = 0.0f; + this->animIndex = animIndex; + startFrame = 0.0f; + morphFrames = -4.0f; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + + if (this->animIndex == ENHIDDENNUTS_ANIM_1) { + startFrame = this->animEndFrame; + morphFrames = 0.0f; } - Animation_Change(&this->skelAnime, D_80BDC0FC[this->unk_220], 1.0f, sp34, this->unk_22C, D_80BDC120[this->unk_220], - sp30); + + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, startFrame, this->animEndFrame, + sAnimationModes[this->animIndex], morphFrames); } void func_80BDB268(EnHiddenNuts* this) { this->actor.textId = 0x234; this->unk_228 = 1600.0f; this->actor.shape.yOffset = 1600.0f; - func_80BDB1B4(this, 1); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_1); this->unk_21A = 0; this->actionFunc = func_80BDB2B8; } @@ -148,12 +175,12 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); if (player->stateFlags2 & PLAYER_STATE2_8000000) { - if (this->unk_20A == 0) { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); - this->unk_20A = 1; + if (!this->unk_20A) { + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); + this->unk_20A = true; } } else { - this->unk_20A = 0; + this->unk_20A = false; } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -183,13 +210,13 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { } if (!(this->actor.xzDistToPlayer > 120.0f)) { - if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_SONATA)) { - play->msgCtx.ocarinaMode = 4; + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_SONATA)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; func_80BDB788(this); } else if (func_801A5100() == 2) { func_80BDB788(this); } else { - func_800B8614(&this->actor, play, BREG(13) + 100.0f); + Actor_OfferTalk(&this->actor, play, BREG(13) + 100.0f); } } } @@ -263,20 +290,20 @@ void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) { EffectSsHahen_SpawnBurst(play, &sp3C, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); - func_80BDB1B4(this, 7); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_7); this->actionFunc = func_80BDB8F4; } void func_80BDB8F4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { func_80BDB930(this); } } void func_80BDB930(EnHiddenNuts* this) { - func_80BDB1B4(this, 3); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_3); this->unk_21A = 3; this->unk_228 = 500.0f; this->actionFunc = func_80BDB978; @@ -290,7 +317,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUT_FAINT); } - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { this->unk_224++; if (this->unk_224 >= 2) { func_80BDBA28(this, play); @@ -301,7 +328,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) { void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { Vec3f sp44; - func_80BDB1B4(this, 2); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_2); this->unk_228 = 0.0f; Math_Vec3f_Copy(&sp44, &this->actor.world.pos); @@ -326,10 +353,10 @@ void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { s32 pad[3]; - f32 sp58 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; WaterBox* sp54; f32 sp50; - s16 sp4E = 0; + s16 sp4E = false; Vec3f sp40; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && @@ -346,23 +373,23 @@ void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER); - sp4E = 1; + sp4E = true; } } - if ((sp4E != 0) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || - Animation_OnFrame(&this->skelAnime, 10.0f))) { + if (sp4E && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || + Animation_OnFrame(&this->skelAnime, 10.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C), 1, 0x1388, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x3E8, 0); - if (this->unk_220 == 2) { - if (this->unk_22C <= sp58) { + if (this->animIndex == ENHIDDENNUTS_ANIM_2) { + if (curFrame >= this->animEndFrame) { this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; - func_80BDB1B4(this, 6); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_6); } } else { Math_ApproachF(&this->actor.world.pos.x, this->unk_20C.x, 0.5f, @@ -387,7 +414,7 @@ void func_80BDBE70(EnHiddenNuts* this, PlayState* play) { if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); } - func_80BDB1B4(this, 8); + EnHiddenNuts_ChangeAnim(this, ENHIDDENNUTS_ANIM_8); this->unk_21A = 5; this->actionFunc = func_80BDBED4; } @@ -396,7 +423,7 @@ void func_80BDBED4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Vec3f sp38; - if (this->unk_22C <= curFrame) { + if (curFrame >= this->animEndFrame) { Math_Vec3f_Copy(&sp38, &this->actor.world.pos); sp38.y = this->actor.floorHeight; diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h index 03a0a52b7..7df4b5f01 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h @@ -2,12 +2,13 @@ #define Z_EN_HIDDEN_NUTS_H #include "global.h" +#include "objects/object_hintnuts/object_hintnuts.h" struct EnHiddenNuts; typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*); -#define ENHIDDENNUTS_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define ENHIDDENNUTS_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define ENHIDDENNUTS_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x1F) #define ENHIDDENNUTS_PATH_INDEX_NONE 0x1F @@ -16,8 +17,8 @@ typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*); typedef struct EnHiddenNuts { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[10]; - /* 0x1C4 */ Vec3s morphTable[10]; + /* 0x188 */ Vec3s jointTable[OBJECT_HINTNUTS_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[OBJECT_HINTNUTS_LIMB_MAX]; /* 0x200 */ EnHiddenNutsActionFunc actionFunc; /* 0x204 */ Path* path; /* 0x208 */ s16 unk_208; @@ -27,11 +28,11 @@ typedef struct EnHiddenNuts { /* 0x21A */ s16 unk_21A; /* 0x21C */ s16 switchFlag; /* 0x21E */ s16 pathIndex; - /* 0x220 */ s32 unk_220; + /* 0x220 */ s32 animIndex; /* 0x224 */ s16 unk_224; /* 0x226 */ s16 csId; /* 0x228 */ f32 unk_228; - /* 0x22C */ f32 unk_22C; + /* 0x22C */ f32 animEndFrame; /* 0x230 */ UNK_TYPE1 unk230[4]; /* 0x234 */ ColliderCylinder collider; } EnHiddenNuts; // size = 0x280 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 1a0105788..86cb7235d 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 @@ -6,9 +6,8 @@ #include "z_en_hint_skb.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_skb/object_skb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnHintSkb*)thisx) @@ -126,20 +125,37 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -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 }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, +typedef enum StalchildHintAnimation { + /* 0 */ STALCHILD_HINT_ANIM_WALK, + /* 1 */ STALCHILD_HINT_ANIM_STAND_UP_MORPH_1, + /* 2 */ STALCHILD_HINT_ANIM_ATTACK, + /* 3 */ STALCHILD_HINT_ANIM_STAGGER_MORPH_4, + /* 4 */ STALCHILD_HINT_ANIM_COLLAPSE, + /* 5 */ STALCHILD_HINT_ANIM_SIT_LAUGH, + /* 6 */ STALCHILD_HINT_ANIM_SIT_TAP_TOES, + /* 7 */ STALCHILD_HINT_ANIM_SWING_ON_BRANCH, + /* 8 */ STALCHILD_HINT_ANIM_STAND_UP_MORPH_8, + /* 9 */ STALCHILD_HINT_ANIM_STAND_UP_MORPH_16, + /* 10 */ STALCHILD_HINT_ANIM_STAGGER_MORPH_8, + /* 11 */ STALCHILD_HINT_ANIM_SALUTE, + /* 12 */ STALCHILD_HINT_ANIM_IDLE, + /* 13 */ STALCHILD_HINT_ANIM_MAX +} StalchildHintAnimation; + +static AnimationInfo sAnimationInfo[STALCHILD_HINT_ANIM_MAX] = { + { &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // STALCHILD_HINT_ANIM_WALK + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // STALCHILD_HINT_ANIM_STAND_UP_MORPH_1 + { &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, // STALCHILD_HINT_ANIM_ATTACK + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // STALCHILD_HINT_ANIM_STAGGER_MORPH_4 + { &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // STALCHILD_HINT_ANIM_COLLAPSE + { &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // STALCHILD_HINT_ANIM_SIT_LAUGH + { &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // STALCHILD_HINT_ANIM_SIT_TAP_TOES + { &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // STALCHILD_HINT_ANIM_SWING_ON_BRANCH + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // STALCHILD_HINT_ANIM_STAND_UP_MORPH_8 + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, // STALCHILD_HINT_ANIM_STAND_UP_MORPH_16 + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // STALCHILD_HINT_ANIM_STAGGER_MORPH_8 + { &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // STALCHILD_HINT_ANIM_SALUTE + { &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // STALCHILD_HINT_ANIM_IDLE }; static InitChainEntry sInitChain[] = { @@ -152,8 +168,8 @@ void EnHintSkb_Init(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, - this->morphtable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildSitLaughAnim, this->jointTable, this->morphTable, + STALCHILD_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElement); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -181,7 +197,7 @@ void func_80C1FE20(EnHintSkb* this, PlayState* play) { } void func_80C1FE30(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_WALK); this->actor.speed = 1.6f; this->actionFunc = func_80C1FE80; } @@ -200,7 +216,7 @@ void func_80C1FE80(EnHintSkb* this, PlayState* play) { void func_80C1FF30(EnHintSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speed = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_ATTACK); this->actionFunc = func_80C1FF88; } @@ -224,7 +240,7 @@ void func_80C1FF88(EnHintSkb* this, PlayState* play) { } void func_80C2003C(EnHintSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_Anim_002190, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &gStalchildAttackAnim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionFunc = func_80C200B8; @@ -261,7 +277,7 @@ void func_80C2016C(EnHintSkb* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); - } else if (this->skelAnime.animation == &object_skb_Anim_00697C) { + } else if (this->skelAnime.animation == &gStalchildSitLaughAnim) { func_80C1FE0C(this); } else if (func_80C21414(this)) { func_80C1FF30(this); @@ -272,14 +288,14 @@ void func_80C2016C(EnHintSkb* this, PlayState* play) { } void func_80C20274(EnHintSkb* this) { - if (this->skelAnime.animation == &object_skb_Anim_00697C) { + if (this->skelAnime.animation == &gStalchildSitLaughAnim) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAND_UP_MORPH_8); this->actor.gravity = -1.0f; this->actor.speed = 1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAGGER_MORPH_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -4.0f; } @@ -317,7 +333,7 @@ void func_80C20334(EnHintSkb* this, PlayState* play) { } void func_80C20484(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_COLLAPSE); this->unk_3E8 |= 4; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; @@ -349,7 +365,7 @@ void func_80C20590(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAGGER_MORPH_4); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -376,7 +392,7 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAGGER_MORPH_4); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -400,21 +416,21 @@ void func_80C2077C(EnHintSkb* this, PlayState* play) { this->unk_3DC = 1; Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; - if (this->skelAnime.animation == &object_skb_Anim_00697C) { - play->msgCtx.msgMode = 0x44; + if (this->skelAnime.animation == &gStalchildSitLaughAnim) { + play->msgCtx.msgMode = MSGMODE_PAUSED; this->actor.speed = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAND_UP_MORPH_8); } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_SALUTE); Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; } func_80C208BC(this); } else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -449,6 +465,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { case TEXT_STATE_NONE: case TEXT_STATE_1: case TEXT_STATE_CLOSING: + default: break; } @@ -463,11 +480,11 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { } } - if ((this->skelAnime.animation == &object_skb_Anim_003584) && + if ((this->skelAnime.animation == &gStalchildStandUpAnim) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_WALK); } } @@ -521,12 +538,12 @@ void func_80C20A74(EnHintSkb* this, PlayState* play) { void func_80C20B88(EnHintSkb* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->unk_3E8 |= 0x10; Message_StartTextbox(play, 0x1150, &this->actor); this->unk_3E6 = 0x1150; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x1152, &this->actor); this->unk_3E6 = 0x1152; } @@ -542,7 +559,7 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { case 0x1147: Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_SALUTE); break; case 0x1148: @@ -578,6 +595,9 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { func_80C2075C(this); } break; + + default: + break; } } @@ -586,21 +606,21 @@ void func_80C20D64(EnHintSkb* this, PlayState* play) { (this->actionFunc == func_80C1FE80)) { if (this->actionFunc != func_80C2077C) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; if (this->actionFunc == func_80C1FE80) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_IDLE); } func_80C2075C(this); } } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); this->actor.hintId = TATL_HINT_ID_STALCHILD; this->actor.textId = 0; - if (this->skelAnime.animation == &object_skb_Anim_00697C) { + if (this->skelAnime.animation == &gStalchildSitLaughAnim) { func_80C1FE0C(this); } else { func_80C1FE30(this); @@ -682,6 +702,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->unk_3E8 |= 1; func_80C20274(this); break; + case 3: if (this->actor.colChkInfo.health != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); @@ -695,6 +716,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); func_80C20540(this); break; + case 4: this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; @@ -702,14 +724,14 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAGGER_MORPH_4); func_80C2066C(this); break; case 12: case 14: this->unk_3E8 |= 1; - + // fallthrough case 15: if ((player->meleeWeaponAnimation == PLAYER_MWA_RIGHT_SLASH_1H) || (player->meleeWeaponAnimation == PLAYER_MWA_LEFT_COMBO_2H) || @@ -717,11 +739,11 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)) { this->unk_3E8 |= 1; } - + // fallthrough case 13: Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, STALCHILD_HINT_ANIM_STAGGER_MORPH_4); func_80C20274(this); break; @@ -731,6 +753,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { case 8: case 9: case 10: + default: break; } } @@ -783,26 +806,26 @@ void func_80C21468(EnHintSkb* this, PlayState* play) { static Color_RGBA8 D_80C21E48 = { 200, 200, 255, 255 }; static Vec3f D_80C21E4C = { 0.0f, -1.0f, 0.0f }; Vec3f sp84; - s32 phi_s4; + s32 bodyPartsCount; s16 temp_s1; s32 i; if (this->unk_3E8 & 2) { - phi_s4 = ARRAY_COUNT(this->limbPos) - 1; + bodyPartsCount = ENHINTSKB_BODYPART_MAX - 1; } else { - phi_s4 = ARRAY_COUNT(this->limbPos); + bodyPartsCount = ENHINTSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < phi_s4; i++) { - temp_s1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + temp_s1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(temp_s1) * 3.0f; sp84.z = Math_CosS(temp_s1) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); } } @@ -850,7 +873,7 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 EnHintSkb* this = THIS; f32 temp_f10; - if (limbIndex == 11) { + if (limbIndex == STALCHILD_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); temp_f10 = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f; @@ -859,13 +882,13 @@ s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 gDPSetEnvColor(POLY_OPA_DISP++, (s16)temp_f10, (s16)temp_f10, (s16)temp_f10, 255); CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 10) { + } else if (limbIndex == STALCHILD_LIMB_RIBCAGE) { Matrix_MultZero(&this->actor.focus.pos); - } else if ((limbIndex == 12) && (this->unk_3DE == 1)) { + } else if ((limbIndex == STALCHILD_LIMB_LOWER_JAW) && (this->unk_3DE == 1)) { Matrix_RotateZS(0x71C, MTXMODE_APPLY); } - if (((limbIndex == 11) || (limbIndex == 12)) && (this->unk_3E8 & 2)) { + if (((limbIndex == STALCHILD_LIMB_HEAD) || (limbIndex == STALCHILD_LIMB_LOWER_JAW)) && (this->unk_3E8 & 2)) { *dList = NULL; } @@ -879,23 +902,28 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if (!(this->unk_3E8 & 8)) { Collider_UpdateSpheres(limbIndex, &this->collider); - if ((limbIndex == 11) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) { + if ((limbIndex == STALCHILD_LIMB_HEAD) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) { Actor_SpawnBodyParts(&this->actor, play, 1, dList); this->unk_3E8 |= 2; - } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && ((limbIndex != 11) || !(this->unk_3E8 & 1)) && - (limbIndex != 12)) { + } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && + ((limbIndex != STALCHILD_LIMB_HEAD) || !(this->unk_3E8 & 1)) && + (limbIndex != STALCHILD_LIMB_LOWER_JAW)) { Actor_SpawnBodyParts(&this->actor, play, 1, dList); } if (this->drawDmgEffTimer != 0) { - if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || - (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || - (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; - } else if ((limbIndex == 11) && !(this->unk_3E8 & 2)) { - Matrix_MultVec3f(&D_80C21E70, &this->limbPos[this->limbCount]); - this->limbCount++; + if ((limbIndex == STALCHILD_LIMB_PELVIS) || (limbIndex == STALCHILD_LIMB_RIGHT_THIGH) || + (limbIndex == STALCHILD_LIMB_RIGHT_SHIN) || (limbIndex == STALCHILD_LIMB_RIGHT_FOOT) || + (limbIndex == STALCHILD_LIMB_LEFT_THIGH) || (limbIndex == STALCHILD_LIMB_LEFT_SHIN) || + (limbIndex == STALCHILD_LIMB_LEFT_FOOT) || (limbIndex == STALCHILD_LIMB_RIGHT_UPPER_ARM) || + (limbIndex == STALCHILD_LIMB_RIGHT_LOWER_ARM) || (limbIndex == STALCHILD_LIMB_RIGHT_HAND) || + (limbIndex == STALCHILD_LIMB_LEFT_UPPER_ARM) || (limbIndex == STALCHILD_LIMB_LEFT_LOWER_ARM) || + (limbIndex == STALCHILD_LIMB_LEFT_HAND)) { + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; + } else if ((limbIndex == STALCHILD_LIMB_HEAD) && !(this->unk_3E8 & 2)) { + Matrix_MultVec3f(&D_80C21E70, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -904,13 +932,13 @@ void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnHintSkb_Draw(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintSkb_OverrideLimbDraw, EnHintSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if (this->unk_3E8 & 4) { diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h index 22f72084d..d29dd7fbf 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h @@ -2,6 +2,7 @@ #define Z_EN_HINT_SKB_H #include "global.h" +#include "objects/object_skb/object_skb.h" struct EnHintSkb; @@ -9,18 +10,36 @@ typedef void (*EnHintSkbActionFunc)(struct EnHintSkb*, PlayState*); #define ENHINTSKB_GET_FF(thisx) ((thisx)->params & 0xFF) +typedef enum EnHintSkbBodyPart { + /* 0 */ ENHINTSKB_BODYPART_0, + /* 1 */ ENHINTSKB_BODYPART_1, + /* 2 */ ENHINTSKB_BODYPART_2, + /* 3 */ ENHINTSKB_BODYPART_3, + /* 4 */ ENHINTSKB_BODYPART_4, + /* 5 */ ENHINTSKB_BODYPART_5, + /* 6 */ ENHINTSKB_BODYPART_6, + /* 7 */ ENHINTSKB_BODYPART_7, + /* 8 */ ENHINTSKB_BODYPART_8, + /* 9 */ ENHINTSKB_BODYPART_9, + /* 10 */ ENHINTSKB_BODYPART_10, + /* 11 */ ENHINTSKB_BODYPART_11, + /* 12 */ ENHINTSKB_BODYPART_12, + /* 13 */ ENHINTSKB_BODYPART_13, + /* 14 */ ENHINTSKB_BODYPART_MAX +} EnHintSkbBodyPart; + typedef struct EnHintSkb { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colliderElement[2]; /* 0x1E4 */ SkelAnime skelAnime; /* 0x228 */ EnHintSkbActionFunc actionFunc; - /* 0x22C */ Vec3f limbPos[14]; + /* 0x22C */ Vec3f bodyPartsPos[ENHINTSKB_BODYPART_MAX]; /* 0x2D4 */ f32 drawDmgEffAlpha; /* 0x2D8 */ f32 drawDmgEffScale; - /* 0x2DC */ s32 limbCount; - /* 0x2E0 */ Vec3s jointTable[20]; - /* 0x358 */ Vec3s morphtable[20]; + /* 0x2DC */ s32 bodyPartsCount; + /* 0x2E0 */ Vec3s jointTable[STALCHILD_LIMB_MAX]; + /* 0x358 */ Vec3s morphTable[STALCHILD_LIMB_MAX]; /* 0x3D0 */ UNK_TYPE1 unk3D0[0xC]; /* 0x3DC */ s16 unk_3DC; /* 0x3DE */ s16 unk_3DE; diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c index c76d92106..208708c58 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c @@ -56,7 +56,7 @@ void EnHitTag_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnHitTag_WaitForHit; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); - if (Flags_GetSwitch(play, ENHITTAG_GET_SWITCHFLAG(thisx))) { + if (Flags_GetSwitch(play, ENHITTAG_GET_SWITCH_FLAG(thisx))) { Actor_Kill(&this->actor); } } @@ -72,7 +72,7 @@ void EnHitTag_WaitForHit(EnHitTag* this, PlayState* play) { s32 i; if (this->collider.base.acFlags & AC_HIT) { - play_sound(NA_SE_SY_GET_RUPY); + Audio_PlaySfx(NA_SE_SY_GET_RUPY); Actor_Kill(&this->actor); dropLocation.x = this->actor.world.pos.x; dropLocation.y = this->actor.world.pos.y; 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 e2effa078..645c95465 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) (((thisx)->params & 0xFE00) >> 9) +#define ENHITTAG_GET_SWITCH_FLAG(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 ed3fe65b9..d715e4c7d 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -161,7 +161,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { } if (this == sInstancePlayingSound) { - func_800B9010(&this->actor, NA_SE_EV_INVISIBLE_MONKEY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_INVISIBLE_MONKEY - SFX_FLAG); } } if ((play->transitionTrigger != TRANS_TRIGGER_OFF) || (play->transitionMode != TRANS_MODE_OFF)) { 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 787a40da7..eaf49d673 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -40,10 +40,10 @@ void EnHorse_StartReversing(EnHorse* this); void EnHorse_StartLowJump(EnHorse* this, PlayState* play); void EnHorse_StartHighJump(EnHorse* this, PlayState* play); void EnHorse_InitInactive(EnHorse* this); -void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames); +void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames); void EnHorse_ResetIdleAnimation(EnHorse* this); void EnHorse_StartIdleRidable(EnHorse* this); -void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames); +void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames); void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play); void EnHorse_InitIngoHorse(EnHorse* this); void EnHorse_UpdateIngoHorseAnim(EnHorse* this); @@ -109,28 +109,56 @@ typedef struct { /* 0x4 */ RaceWaypoint* waypoints; } RaceInfo; // size = 0x8 -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* sEponaAnimations[ENHORSE_ANIM_MAX] = { + &gEponaIdleAnim, // ENHORSE_ANIM_IDLE + &gEponaWhinnyAnim, // ENHORSE_ANIM_WHINNY + &object_horse_link_child_Anim_005F64, // ENHORSE_ANIM_STOPPING + &object_horse_link_child_Anim_004DE8, // ENHORSE_ANIM_REARING + &gEponaWalkAnim, // ENHORSE_ANIM_WALK + &gEponaTrotAnim, // ENHORSE_ANIM_TROT + &gEponaGallopAnim, // ENHORSE_ANIM_GALLOP + &object_horse_link_child_Anim_0035B0, // ENHORSE_ANIM_LOW_JUMP + &object_horse_link_child_Anim_003D38, // ENHORSE_ANIM_HIGH_JUMP }; -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* sHniAnimations[ENHORSE_ANIM_MAX] = { + &gHorseIdleAnim, // ENHORSE_ANIM_IDLE + &gHorseShakeHeadAnim, // ENHORSE_ANIM_WHINNY + &gHorseStopAnim, // ENHORSE_ANIM_STOPPING + &gHorseWhinnyAnim, // ENHORSE_ANIM_REARING @TODO: Does not line up + &gHorseWalkAnim, // ENHORSE_ANIM_WALK + &gHorseTrotAnim, // ENHORSE_ANIM_TROT + &gHorseGallopAnim, // ENHORSE_ANIM_GALLOP + &gHorseJumpLowAnim, // ENHORSE_ANIM_LOW_JUMP + &gHorseJumpHighAnim, // ENHORSE_ANIM_HIGH_JUMP }; -static AnimationHeader** sAnimationHeaders[] = { - NULL, NULL, sEponaAnimations, sHniAnimations, sHniAnimations, +static AnimationHeader** sAnimationHeaders[HORSE_TYPE_MAX] = { + NULL, // HORSE_TYPE_EPONA + NULL, // HORSE_TYPE_HNI + sEponaAnimations, // HORSE_TYPE_2 + sHniAnimations, // HORSE_TYPE_BANDIT + sHniAnimations, // HORSE_TYPE_DONKEY }; -static f32 sPlaybackSpeeds[] = { - 2.0f / 3.0f, 2.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, +static f32 sPlaybackSpeeds[ENHORSE_ANIM_MAX] = { + 2.0f / 3.0f, // ENHORSE_ANIM_IDLE + 2.0f / 3.0f, // ENHORSE_ANIM_WHINNY + 3.0f / 3.0f, // ENHORSE_ANIM_STOPPING + 3.0f / 3.0f, // ENHORSE_ANIM_REARING + 3.0f / 3.0f, // ENHORSE_ANIM_WALK + 3.0f / 3.0f, // ENHORSE_ANIM_TROT + 3.0f / 3.0f, // ENHORSE_ANIM_GALLOP + 2.0f / 3.0f, // ENHORSE_ANIM_LOW_JUMP + 2.0f / 3.0f, // ENHORSE_ANIM_HIGH_JUMP }; -static SkeletonHeader* sSkeletonHeaders[] = { - NULL, NULL, &object_horse_link_child_Skel_00A480, NULL, NULL, +static SkeletonHeader* sSkeletonHeaders[HORSE_TYPE_MAX] = { + NULL, // HORSE_TYPE_EPONA + NULL, // HORSE_TYPE_HNI + &gEponaSkel, // HORSE_TYPE_2 + NULL, // HORSE_TYPE_BANDIT + NULL, // HORSE_TYPE_DONKEY }; ActorInit En_Horse_InitVars = { @@ -478,9 +506,9 @@ void EnHorse_PlayWalkingSound(EnHorse* this) { } if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_WALK); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_WALK); } this->soundTimer++; @@ -492,17 +520,17 @@ void EnHorse_PlayWalkingSound(EnHorse* this) { void func_8087C178(EnHorse* this) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } void func_8087C1C0(EnHorse* this) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } @@ -561,16 +589,17 @@ void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { !(this->stateFlags & ENHORSE_SANDDUST_SOUND)) { this->stateFlags |= ENHORSE_SANDDUST_SOUND; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } - } else if ((this->animIndex == 3) && (this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) { + } else if ((this->animIndex == ENHORSE_ANIM_REARING) && (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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } } } @@ -663,7 +692,7 @@ s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_IDLE) || (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) || - (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != PLAYER_CSMODE_0)) { + (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != PLAYER_CSMODE_NONE)) { return false; } return true; @@ -709,7 +738,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->type = HORSE_TYPE_DONKEY; this->unk_528 = 80.0f; this->boostSpeed = 12; - if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { + if ((this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HA)) <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -719,8 +748,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->type = HORSE_TYPE_2; this->unk_528 = 64.8f; this->boostSpeed = 15; - if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HORSE_LINK_CHILD)) < 0) { - thisx->objBankIndex = Object_Spawn(&play->objectCtx, OBJECT_HORSE_LINK_CHILD); + if ((this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HORSE_LINK_CHILD)) <= OBJECT_SLOT_NONE) { + thisx->objectSlot = Object_SpawnPersistent(&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->animIndex]); @@ -731,7 +760,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } else if (ENHORSE_IS_BANDIT_TYPE(&this->actor)) { this->type = HORSE_TYPE_BANDIT; this->boostSpeed = 12; - if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { + if ((this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HA)) <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -831,7 +860,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } - this->animIndex = 0; + this->animIndex = ENHORSE_ANIM_IDLE; this->numBoosts = 6; this->boostRegenTime = 0; this->postDrawFunc = NULL; @@ -919,17 +948,17 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { void func_8087D540(Actor* thisx, PlayState* play) { EnHorse* this = THIS; - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnHorse_Update; if (this->unk_1EC & 1) { if (this->type == HORSE_TYPE_BANDIT) { - SkelAnime_InitFlex(play, &this->skin.skelAnime, &object_ha_Skel_008C68, NULL, this->jointTable, - this->morphTable, OBJECT_HA_1_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skin.skelAnime, &gHorseBanditSkel, NULL, this->jointTable, + this->morphTable, HORSE_BANDIT_LIMB_MAX); } else { - SkelAnime_InitFlex(play, &this->skin.skelAnime, &object_ha_Skel_0150D8, NULL, this->jointTable, - this->morphTable, OBJECT_HA_2_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skin.skelAnime, &gDonkeySkel, NULL, this->jointTable, this->morphTable, + DONKEY_LIMB_MAX); } } else { Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); @@ -1114,9 +1143,9 @@ void EnHorse_StartMountedIdle(EnHorse* this) { if (!(this->stateFlags & ENHORSE_SANDDUST_SOUND)) { this->stateFlags |= ENHORSE_SANDDUST_SOUND; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } } } @@ -1166,9 +1195,9 @@ void EnHorse_MountedIdleWhinny(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][1]), ANIMMODE_ONCE, -3.0f); if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); } } } @@ -1451,9 +1480,9 @@ void EnHorse_StartRearing(EnHorse* this) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } Rumble_Request(0.0f, 180, 20, 100); @@ -1465,9 +1494,9 @@ void EnHorse_StartRearing(EnHorse* this) { this->stateFlags &= ~ENHORSE_LAND2_SOUND; if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } @@ -1485,9 +1514,9 @@ void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { if (!(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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } Rumble_Request(0.0f, 180, 20, 100); } @@ -1525,9 +1554,9 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } Rumble_Request(0.0f, 180, 20, 100); @@ -1537,9 +1566,9 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { } if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); } Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, 0.0f, @@ -1562,9 +1591,9 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { ((gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0)) || (Cutscene_GetSceneLayer(play) == 0))) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } Rumble_Request(0.0f, 180, 20, 100); @@ -1695,9 +1724,9 @@ void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { this->riderPos.y -= ((y * 0.01f) * this->unk_528) * 0.01f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } Rumble_Request(0.0f, 170, 10, 10); } @@ -1754,9 +1783,9 @@ void EnHorse_LowJump(EnHorse* this, PlayState* play) { ((curFrame > 17.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; @@ -1793,9 +1822,9 @@ void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_CALC_RIDER_POS; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } Rumble_Request(0.0f, 170, 10, 10); } @@ -1851,9 +1880,9 @@ void EnHorse_HighJump(EnHorse* this, PlayState* play) { ((curFrame > 23.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; @@ -1879,7 +1908,7 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) { gHorsePlayedEponasSong = false; if (EnHorse_Spawn(this, play)) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } this->stateFlags &= ~ENHORSE_INACTIVE; } @@ -1895,37 +1924,37 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) { } } -void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { +void EnHorse_PlayIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) { this->action = ENHORSE_ACTION_IDLE; this->actor.speed = 0.0f; - if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNY) && (anim != ENHORSE_ANIM_REARING)) { - anim = ENHORSE_ANIM_IDLE; + if ((animIndex != ENHORSE_ANIM_IDLE) && (animIndex != ENHORSE_ANIM_WHINNY) && (animIndex != ENHORSE_ANIM_REARING)) { + animIndex = ENHORSE_ANIM_IDLE; } - if (sAnimationHeaders[this->type][anim] == NULL) { - anim = ENHORSE_ANIM_IDLE; + if (sAnimationHeaders[this->type][animIndex] == NULL) { + animIndex = ENHORSE_ANIM_IDLE; } - if (anim != this->animIndex) { - this->animIndex = anim; - if (anim == ENHORSE_ANIM_IDLE) { + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + if (animIndex == ENHORSE_ANIM_IDLE) { this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; } else { 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); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); } } } 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); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } this->stateFlags &= ~ENHORSE_LAND2_SOUND; @@ -1937,8 +1966,8 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta } } -void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames) { - EnHorse_PlayIdleAnimation(this, anim, morphFrames, this->curFrame); +void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 animIndex, f32 morphFrames) { + EnHorse_PlayIdleAnimation(this, animIndex, morphFrames, this->curFrame); } void EnHorse_ResetIdleAnimation(EnHorse* this) { @@ -1960,18 +1989,18 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { if (!func_8087C38C(play, this, &this->actor.world.pos)) { if (EnHorse_Spawn(this, play)) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); } this->followTimer = 0; EnHorse_SetFollowAnimation(this, play); } } else { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); } this->followTimer = 0; EnHorse_StartMovingAnimation(this, 6, -3.0f, 0.0f); @@ -1994,16 +2023,16 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { } } -void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { +void EnHorse_StartMovingAnimation(EnHorse* this, s32 animIndex, f32 morphFrames, f32 startFrames) { 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 ((animIndex != ENHORSE_ANIM_TROT) && (animIndex != ENHORSE_ANIM_GALLOP) && (animIndex != ENHORSE_ANIM_WALK)) { + animIndex = ENHORSE_ANIM_WALK; } - if (anim != this->animIndex) { - this->animIndex = anim; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, morphFrames); @@ -2014,38 +2043,38 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 } void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { - s32 anim = ENHORSE_ANIM_WALK; + s32 animIndex = ENHORSE_ANIM_WALK; f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else if (!(distToPlayer <= 300.0f) && (distToPlayer <= 400.0f)) { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } if (this->animIndex == ENHORSE_ANIM_GALLOP) { if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } } else if (this->animIndex == ENHORSE_ANIM_TROT) { if (distToPlayer > 400.0f) { - anim = ENHORSE_ANIM_GALLOP; + animIndex = ENHORSE_ANIM_GALLOP; } else if (distToPlayer < 300.0f) { - anim = ENHORSE_ANIM_WALK; + animIndex = ENHORSE_ANIM_WALK; } else { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } } else if (this->animIndex == ENHORSE_ANIM_WALK) { if (distToPlayer > 300.0f) { - anim = ENHORSE_ANIM_TROT; + animIndex = ENHORSE_ANIM_TROT; } else { - anim = ENHORSE_ANIM_WALK; + animIndex = ENHORSE_ANIM_WALK; } } - EnHorse_StartMovingAnimation(this, anim, -3.0f, 0.0f); + EnHorse_StartMovingAnimation(this, animIndex, -3.0f, 0.0f); } void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { @@ -2081,9 +2110,9 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { if ((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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } } } else { @@ -2113,9 +2142,9 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { EnHorse_StartIdleRidable(this); if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } } @@ -2144,13 +2173,13 @@ void EnHorse_InitIngoHorse(EnHorse* this) { this->actor.speed = 0.0f; EnHorse_UpdateIngoHorseAnim(this); if (this->stateFlags & ENHORSE_DRAW) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); } } void EnHorse_SetIngoAnimation(s32 animIndex, f32 curFrame, s32 arg2, s16* animIndexOut) { *animIndexOut = sIngoAnimIndices[animIndex]; - if (arg2 == ENIN_ANIM_1) { + if (arg2 == 1) { if (animIndex == ENHORSE_ANIM_TROT) { *animIndexOut = ENIN_ANIM_4; } else if (animIndex == ENHORSE_ANIM_GALLOP) { @@ -2193,16 +2222,16 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else { animSpeed = 1.0f; @@ -2271,9 +2300,9 @@ void func_80881290(EnHorse* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->jumpStartY = this->actor.world.pos.y; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } Rumble_Request(0.0f, 170, 10, 10); } @@ -2281,7 +2310,7 @@ void func_80881290(EnHorse* this, PlayState* play) { void func_80881398(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - s32 animeUpdated; + s32 isAnimFinished; f32 curFrame; this->stateFlags |= ENHORSE_JUMPING; @@ -2289,7 +2318,7 @@ void func_80881398(EnHorse* this, PlayState* play) { this->actor.speed = 14.0f; } - animeUpdated = SkelAnime_Update(&this->skin.skelAnime); + isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); curFrame = this->skin.skelAnime.curFrame; if (curFrame > 23.0f) { @@ -2308,12 +2337,12 @@ void func_80881398(EnHorse* this, PlayState* play) { this->actor.world.pos.y = this->jumpStartY + (y * 0.01f * this->unk_528 * 0.01f); } - if (animeUpdated || ((curFrame > 17.0f) && - (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { + if (isAnimFinished || ((curFrame > 17.0f) && + (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; @@ -2344,7 +2373,7 @@ void func_80881634(EnHorse* this) { this->actor.speed = 0.0f; func_8088168C(this); if (this->stateFlags & ENHORSE_DRAW) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); } } @@ -2383,16 +2412,16 @@ void func_8088168C(EnHorse* this) { } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else { animSpeed = 1.0f; @@ -2462,10 +2491,10 @@ void func_808819D8(EnHorse* this, PlayState* play) { } if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) { - this->rider->unk488 = 7; + this->rider->animIndex2 = ENIN_ANIM2_7; } else { EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1, - &this->rider->unk488); + &this->rider->animIndex2); } } @@ -2526,9 +2555,9 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_ANIM_HIGH_JUMP; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } Rumble_Request(0.0f, 170, 10, 10); } @@ -2576,9 +2605,9 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { this->cutsceneFlags |= 1; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; @@ -2605,9 +2634,9 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->stateFlags &= ~ENHORSE_LAND2_SOUND; if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, @@ -2620,9 +2649,9 @@ void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { if (!(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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } } } @@ -2698,9 +2727,9 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cu if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, @@ -2713,9 +2742,9 @@ void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { if (!(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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } } } @@ -2870,17 +2899,17 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } Rumble_Request(0.0f, 60, 8, 255); } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } Rumble_Request(0.0f, 120, 8, 255); } else { @@ -2957,15 +2986,15 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { f32 playerDistToHome; f32 distToPlayer; s32 nextAnimIndex = this->animIndex; - s32 animFinished; + s32 isAnimFinished; s16 yaw; if (gHorsePlayedEponasSong || (this->type == HORSE_TYPE_HNI)) { EnHorse_StartIdleRidable(this); if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); } } @@ -3036,7 +3065,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; } - animFinished = SkelAnime_Update(&this->skin.skelAnime); + isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); if (((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) && ((nextAnimIndex == ENHORSE_ANIM_GALLOP) || (nextAnimIndex == ENHORSE_ANIM_TROT) || @@ -3049,7 +3078,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { } else if (this->animIndex == ENHORSE_ANIM_TROT) { func_8087C178(this); } - } else if (animFinished) { + } else if (isAnimFinished) { if (nextAnimIndex == ENHORSE_ANIM_GALLOP) { func_8087C1C0(this); } else if (nextAnimIndex == ENHORSE_ANIM_TROT) { @@ -3070,9 +3099,9 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { 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); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); } } } @@ -3144,7 +3173,7 @@ void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->cueId = 3; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00A8DC, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00A8DC), ANIMMODE_ONCE, -3.0f); - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { @@ -3163,7 +3192,7 @@ void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { if (Animation_OnFrame(&this->skin.skelAnime, Animation_GetLastFrame(&object_horse_link_child_Anim_00AD08) - 1.0f)) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } SkelAnime_Update(&this->skin.skelAnime); } @@ -3209,7 +3238,7 @@ void func_80884314(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->cueId = 7; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00D178, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00D178), ANIMMODE_ONCE, 0.0f); - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { @@ -3409,7 +3438,7 @@ void func_80884E0C(EnHorse* this, PlayState* play) { 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); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } this->unk_57C = this->actor.world.pos; @@ -3418,10 +3447,10 @@ void func_80884E0C(EnHorse* this, PlayState* play) { this->unk_56C = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos); if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) { - this->rider->unk488 = 7; + this->rider->animIndex2 = ENIN_ANIM2_7; } else { EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1, - &this->rider->unk488); + &this->rider->animIndex2); } pos = this->actor.world.pos; @@ -3494,7 +3523,7 @@ 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->animIndex != 3) {} + if (this->animIndex != ENHORSE_ANIM_REARING) {} } else if (this->action != ENHORSE_ACTION_MOUNTED_REARING) { if (this->stateFlags & ENHORSE_JUMPING) { this->stateFlags &= ~ENHORSE_JUMPING; @@ -3742,9 +3771,9 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if (this->actor.speed > 4.0f) { this->actor.speed -= 1.0f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } } } @@ -3759,9 +3788,9 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if (this->actor.speed > 2.0f) { this->actor.speed -= 1.0f; if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } } } else { @@ -4011,9 +4040,9 @@ void func_80886C00(EnHorse* this, PlayState* play) { } } else if ((this->stateFlags & ENHORSE_DRAW) && (Rand_ZeroOne() < 0.1f)) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } } @@ -4027,7 +4056,7 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { this->numBoosts++; if (!EN_HORSE_CHECK_4(this)) { - play_sound(NA_SE_SY_CARROT_RECOVER); + Audio_PlaySfx(NA_SE_SY_CARROT_RECOVER); } if (this->numBoosts < 6) { @@ -4042,7 +4071,7 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { this->numBoosts = 6; if (!EN_HORSE_CHECK_4(this)) { - play_sound(NA_SE_SY_CARROT_RECOVER); + Audio_PlaySfx(NA_SE_SY_CARROT_RECOVER); } } } @@ -4050,9 +4079,9 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { if (this->boostTimer == 8) { if ((Rand_ZeroOne() < 0.25f) && (this->stateFlags & ENHORSE_DRAW)) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } } @@ -4118,7 +4147,7 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) { } conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - conveyorDir = (conveyorDir * 0x400) - this->actor.world.rot.y; + conveyorDir = CONVEYOR_DIRECTION_TO_BINANG(conveyorDir) - this->actor.world.rot.y; if (conveyorDir > 0x640) { this->actor.world.rot.y += 0x640; } else if (conveyorDir < -0x640) { @@ -4253,9 +4282,9 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { if ((this->colliderJntSph.base.acFlags & AC_HIT) && (this->stateFlags & ENHORSE_DRAW)) { if (this->type == HORSE_TYPE_2) { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { - Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } @@ -4633,9 +4662,9 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* skin) { static TexturePtr D_80889204[] = { - object_horse_link_child_Tex_001D28, - object_horse_link_child_Tex_001928, - object_horse_link_child_Tex_001B28, + gEponaEyeOpenTex, + gEponaEyeHalfTex, + gEponaEyeClosedTex, }; static u8 D_80889210[] = { 0, 1, 2, 1 }; EnHorse* this = THIS; 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 3cfc1fb54..8213bed6a 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -93,7 +93,8 @@ typedef enum EnHorseAnimation { /* 5 */ ENHORSE_ANIM_TROT, /* 6 */ ENHORSE_ANIM_GALLOP, /* 7 */ ENHORSE_ANIM_LOW_JUMP, - /* 8 */ ENHORSE_ANIM_HIGH_JUMP + /* 8 */ ENHORSE_ANIM_HIGH_JUMP, + /* 9 */ ENHORSE_ANIM_MAX } EnHorseAnimation; typedef enum HorseType { @@ -101,7 +102,8 @@ typedef enum HorseType { /* 1 */ HORSE_TYPE_HNI, /* 2 */ HORSE_TYPE_2, /* 3 */ HORSE_TYPE_BANDIT, - /* 4 */ HORSE_TYPE_DONKEY // Cremia's donkey + /* 4 */ HORSE_TYPE_DONKEY, // Cremia's donkey + /* 5 */ HORSE_TYPE_MAX } HorseType; #define ENHORSE_PARAM_BANDIT 0x2000 @@ -148,7 +150,7 @@ typedef struct EnHorse { /* 0x148 */ s32 noInputTimer; /* 0x14C */ s32 noInputTimerMax; /* 0x150 */ s32 type; - /* 0x154 */ s8 bankIndex; + /* 0x154 */ s8 objectSlot; /* 0x158 */ Skin skin; /* 0x1E8 */ s32 stateFlags; /* 0x1EC */ s32 unk_1EC; @@ -206,8 +208,8 @@ typedef struct EnHorse { /* 0x3E4 */ UNK_TYPE1 unk_3E4[0x4]; /* 0x3E8 */ f32 unk_3E8; /* 0x3EC */ s16 unk_3EC; - /* 0x3EE */ Vec3s jointTable[OBJECT_HA_1_LIMB_MAX]; - /* 0x48A */ Vec3s morphTable[OBJECT_HA_1_LIMB_MAX]; + /* 0x3EE */ Vec3s jointTable[HORSE_BANDIT_LIMB_MAX]; + /* 0x48A */ Vec3s morphTable[HORSE_BANDIT_LIMB_MAX]; /* 0x528 */ f32 unk_528; /* 0x52C */ s32 unk_52C; /* 0x530 */ s32 cueChannel; 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 c7a2edaaa..7fbd43a54 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 @@ -7,6 +7,7 @@ #include "z_en_horse_game_check.h" #include "z64horse.h" #include "objects/object_horse_game_check/object_horse_game_check.h" +#include "debug.h" #define FLAGS (ACTOR_FLAG_10) @@ -128,13 +129,13 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_4)); if (this->horse1 == NULL) { - __assert("../z_en_horse_game_check.c", 1517); + _dbg_hungup("../z_en_horse_game_check.c", 1517); } this->horse2 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_5)); if (this->horse2 == NULL) { - __assert("../z_en_horse_game_check.c", 1526); + _dbg_hungup("../z_en_horse_game_check.c", 1526); } this->unk_17C = -1; @@ -250,7 +251,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_4); @@ -283,7 +284,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x40000)) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_3); @@ -316,7 +317,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x02000000)) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); this->unk_164 |= 0x02000000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_3); @@ -345,7 +346,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x800)) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); this->unk_164 |= 0x800; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_2); diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 0217e8fa8..78d6f8624 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -1,7 +1,8 @@ /* * File: z_en_horse_link_child.c * Overlay: ovl_En_Horse_Link_Child - * Description: Child Epona + * Description: Child Epona from OoT, when player learns Epona's song + * (Unused in MM and broken) */ #include "z_en_horse_link_child.h" @@ -17,15 +18,17 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play); void EnHorseLinkChild_Update(Actor* thisx, PlayState* play); void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play); -void func_808DEA0C(EnHorseLinkChild* this, PlayState* play); -void func_808DEB14(EnHorseLinkChild* this, PlayState* play); -void func_808DECA0(EnHorseLinkChild* this); -void func_808DED40(EnHorseLinkChild* this, PlayState* play); -void func_808DEFE8(EnHorseLinkChild* this); -void func_808DF194(EnHorseLinkChild* this, PlayState* play); -void func_808DF620(EnHorseLinkChild* this, PlayState* play); -void func_808DF788(EnHorseLinkChild* this); -void func_808DF838(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex); +void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this); +void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_SetupLonLonIdle(EnHorseLinkChild* this); +void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_SetupActionFunc5(EnHorseLinkChild* this); +void EnHorseLinkChild_ActionFunc5(EnHorseLinkChild* this, PlayState* play); +void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this); +void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play); ActorInit En_Horse_Link_Child_InitVars = { ACTOR_EN_HORSE_LINK_CHILD, @@ -39,10 +42,22 @@ ActorInit En_Horse_Link_Child_InitVars = { (ActorFunc)EnHorseLinkChild_Draw, }; -AnimationHeader* D_808DFEC0[] = { &object_horse_link_child_Anim_006D44, &object_horse_link_child_Anim_007468 }; +typedef enum { + /* 0 */ OOT_CHILD_EPONA_ANIM_IDLE, // head down + pawing + /* 1 */ OOT_CHILD_EPONA_ANIM_WHINNY, // head shake + /* 2 */ OOT_CHILD_EPONA_ANIM_WALK, // slow + /* 3 */ OOT_CHILD_EPONA_ANIM_TROT, // mid + /* 4 */ OOT_CHILD_EPONA_ANIM_GALLOP, // fast + /* 5 */ OOT_CHILD_EPONA_ANIM_MAX +} OoTEponaAnimation; -AnimationHeader* D_808DFEC8[] = { &object_horse_link_child_Anim_007D50, &object_horse_link_child_Anim_0043AC, - &object_horse_link_child_Anim_002F98 }; +static AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = { + &gEponaIdleAnim, // OOT_CHILD_EPONA_ANIM_IDLE + &gEponaWhinnyAnim, // OOT_CHILD_EPONA_ANIM_WHINNY + &gEponaWalkAnim, // OOT_CHILD_EPONA_ANIM_WALK + &gEponaTrotAnim, // OOT_CHILD_EPONA_ANIM_TROT + &gEponaGallopAnim, // OOT_CHILD_EPONA_ANIM_GALLOP +}; static ColliderJntSphElementInit sJntSphElementsInit[] = { { @@ -73,96 +88,123 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_HEAVY }; -s32 D_808DFF10[] = { 1, 19 }; +// the animation frames that should have sfx +static s32 sAnimSoundFrames[] = { 1, 19 }; -f32 D_808DFF18[] = { 1.0f, 1.0f, 1.5f, 1.5f, 1.5f }; +static f32 sAnimPlaySpeeds[OOT_CHILD_EPONA_ANIM_MAX] = { + 1.0f, // OOT_CHILD_EPONA_ANIM_IDLE + 1.0f, // OOT_CHILD_EPONA_ANIM_WHINNY + 1.5f, // OOT_CHILD_EPONA_ANIM_WALK + 1.5f, // OOT_CHILD_EPONA_ANIM_TROT + 1.5f // OOT_CHILD_EPONA_ANIM_GALLOP +}; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -EnHorseLinkChildUnkFunc D_808DFF30[] = { - func_808DEA0C, func_808DED40, func_808DEB14, func_808DF194, func_808DF838, func_808DF620, +typedef enum { + /* 0 */ OOT_CHILD_EPONA_ACTION_0, // unfinished + /* 1 */ OOT_CHILD_EPONA_ACTION_GREET_PLAYER, // approaching + /* 2 */ OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER, + /* 3 */ OOT_CHILD_EPONA_ACTION_LONLON_IDLE, + /* 4 */ OOT_CHILD_EPONA_ACTION_4, + /* 5 */ OOT_CHILD_EPONA_ACTION_5, + /* 6 */ OOT_CHILD_EPONA_ACTION_MAX +} OoTEponaAction; + +static EnHorseLinkChildActionFunc sActionFuncs[] = { + EnHorseLinkChild_ActionFunc0, // OOT_CHILD_EPONA_ACTION_0 + EnHorseLinkChild_GreetPlayer, // OOT_CHILD_EPONA_ACTION_GREET_PLAYER + EnHorseLinkChild_WaitForPlayer, // OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER + EnHorseLinkChild_LonLonIdle, // OOT_CHILD_EPONA_ACTION_LONLON_IDLE + EnHorseLinkChild_ActionFunc4, // OOT_CHILD_EPONA_ACTION_4 + EnHorseLinkChild_ActionFunc5, // OOT_CHILD_EPONA_ACTION_5 }; -TexturePtr D_808DFF48[] = { object_horse_link_child_Tex_001D28, object_horse_link_child_Tex_001928, - object_horse_link_child_Tex_001B28 }; +static TexturePtr sEyeTextures[] = { gEponaEyeOpenTex, gEponaEyeHalfTex, gEponaEyeClosedTex }; -s8 D_808DFF54[] = { 0, 1, 2, 1 }; +s8 sEyeTextureIndexOverride[] = { 0, 1, 2, 1 }; -void func_808DE5C0(EnHorseLinkChild* this) { - if ((D_808DFF10[this->unk_1E8] < this->skin.skelAnime.curFrame) && - ((this->unk_1E8 != 0) || !(D_808DFF10[1] < this->skin.skelAnime.curFrame))) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK); - this->unk_1E8++; - if (this->unk_1E8 >= 2) { - this->unk_1E8 = 0; +// This plays the walking/gallop sfx, which needs to be timed based on horse speed, +// this is only used for animation OOT_CHILD_EPONA_ANIM_WALK +void EnHorseLinkChild_PlayWalkingSound(EnHorseLinkChild* this) { + if ((sAnimSoundFrames[this->footstepCounter] < this->skin.skelAnime.curFrame) && + ((this->footstepCounter != 0) || !(sAnimSoundFrames[1] < this->skin.skelAnime.curFrame))) { + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK); + + this->footstepCounter++; + if (this->footstepCounter >= 2) { + this->footstepCounter = 0; } } } -void func_808DE660(EnHorseLinkChild* this) { - if (this->unk_148 == 2) { - func_808DE5C0(this); +void EnHorseLinkChild_PlaySound(EnHorseLinkChild* this) { + if (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK) { + EnHorseLinkChild_PlayWalkingSound(this); } else if (this->skin.skelAnime.curFrame == 0.0f) { - if ((this->unk_148 == 3) || (this->unk_148 == 4)) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); - } else if (this->unk_148 == 1) { + if ((this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || (this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP)) { + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); + } else if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) { if (Rand_ZeroOne() > 0.5f) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_GROAN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_GROAN); } else { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } } } } -f32 func_808DE728(EnHorseLinkChild* this) { - f32 phi_fv1; +f32 EnHorseLinkChild_GetAnimSpeed(EnHorseLinkChild* this) { + f32 animSpeed; - if (this->unk_148 == 2) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 2.0f); - } else if (this->unk_148 == 3) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 3.0f); - } else if (this->unk_148 == 4) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 5.0f); + if (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK) { + animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 2.0f); + } else if (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) { + animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 3.0f); + } else if (this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) { + animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 5.0f); } else { - phi_fv1 = D_808DFF18[this->unk_148]; + animSpeed = sAnimPlaySpeeds[this->animIndex]; } - return phi_fv1; + + return animSpeed; } void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Actor_SetScale(&this->actor, 0.00648f); + Actor_SetScale(&this->actor, 64.8f * 0.0001f); this->actor.gravity = -3.5f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f); - this->unk_144 = 1; + this->action = OOT_CHILD_EPONA_ACTION_GREET_PLAYER; this->actor.speed = 0.0f; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(&play->state, &this->skin, &object_horse_link_child_Skel_00A480, &object_horse_link_child_Anim_002F98); - this->unk_148 = 0; - Animation_PlayOnce(&this->skin.skelAnime, D_808DFEC0[0]); + Skin_Init(&play->state, &this->skin, &gEponaSkel, &gEponaGallopAnim); + this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; + + // this gets overwritten by EnHorseLinkChild_SetupLonLonIdle below + Animation_PlayOnce(&this->skin.skelAnime, sAnimations[OOT_CHILD_EPONA_ANIM_IDLE]); Collider_InitCylinder(play, &this->colldierCylinder); Collider_InitJntSph(play, &this->colliderJntSph); Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - this->unk_1E8 = 0; - this->unk_1E4 = 0; + this->footstepCounter = 0; + this->eyeTexIndex = 0; - if (gSaveContext.sceneLayer >= 4) { - func_808DEFE8(this); + if (gSaveContext.sceneLayer >= 4) { // IS_CUTSCENE_LAYER in OoT + EnHorseLinkChild_SetupLonLonIdle(this); } else { - func_808DEFE8(this); + EnHorseLinkChild_SetupLonLonIdle(this); } this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0; @@ -176,303 +218,322 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->colliderJntSph); } -void func_808DE9A8(EnHorseLinkChild* this) { - this->unk_144 = 0; - this->unk_148++; - if (this->unk_148 >= ARRAY_COUNT(D_808DFF18)) { - this->unk_148 = 0; +void EnHorseLinkChild_SetupActionFunc0(EnHorseLinkChild* this) { + this->action = OOT_CHILD_EPONA_ACTION_0; + this->animIndex++; + if (this->animIndex >= OOT_CHILD_EPONA_ANIM_MAX) { + this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } - Animation_PlayOnce(&this->skin.skelAnime, D_808DFEC0[this->unk_148]); - this->skin.skelAnime.playSpeed = func_808DE728(this); + Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animIndex]); + this->skin.skelAnime.playSpeed = EnHorseLinkChild_GetAnimSpeed(this); } -void func_808DEA0C(EnHorseLinkChild* this, PlayState* play) { +/** + * Mostly broken + */ +void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play) { this->actor.speed = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { - func_808DE9A8(this); + EnHorseLinkChild_SetupActionFunc0(this); } } -void func_808DEA54(EnHorseLinkChild* this, s32 arg1) { - this->unk_144 = 2; +void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 animIndex) { + this->action = OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER; this->actor.speed = 0.0f; - if ((arg1 != 0) && (arg1 != 1)) { - arg1 = 0; + if ((animIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (animIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) { + animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } - if (arg1 != this->unk_148) { - this->unk_148 = arg1; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } } -void func_808DEB14(EnHorseLinkChild* this, PlayState* play) { - f32 sp44 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); - s32 phi_v0; +/** + * Waiting for the player to get close, to notice and begin to approach the player. + */ +void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) { + f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); + s32 animIndex; if (SkelAnime_Update(&this->skin.skelAnime)) { - if ((sp44 < 1000.0f) && (sp44 > 70.0f)) { - func_808DECA0(this); + if ((distToPlayer < 1000.0f) && (distToPlayer > 70.0f)) { + EnHorseLinkChild_SetupGreetPlayer(this); return; } - if (this->unk_148 == 1) { - phi_v0 = 0; + if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) { + animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } else { - phi_v0 = 1; + animIndex = OOT_CHILD_EPONA_ANIM_WHINNY; } - if (phi_v0 != this->unk_148) { - this->unk_148 = phi_v0; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f); } } } -void func_808DECA0(EnHorseLinkChild* this) { - this->unk_144 = 1; - this->unk_148 = 0; +void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this) { + this->action = OOT_CHILD_EPONA_ACTION_GREET_PLAYER; + this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; this->actor.speed = 0.0f; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } -void func_808DED40(EnHorseLinkChild* this, PlayState* play) { - f32 temp_fv0; - s16 temp_a0; - s32 phi_v0; +/** + * Chasing the player down. + */ +void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) { + f32 distToPlayer; + s16 yawTowardPlayerDiff; + s32 animIndex; - if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { - temp_a0 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; - if (temp_a0 > 0x12C) { + if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || + (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) { + yawTowardPlayerDiff = + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + if (yawTowardPlayerDiff > 0x12C) { this->actor.world.rot.y += 0x12C; - } else if (temp_a0 < -0x12C) { + } else if (yawTowardPlayerDiff < -0x12C) { this->actor.world.rot.y -= 0x12C; } else { - this->actor.world.rot.y += temp_a0; + this->actor.world.rot.y += yawTowardPlayerDiff; } this->actor.shape.rot.y = this->actor.world.rot.y; } if (SkelAnime_Update(&this->skin.skelAnime)) { - temp_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); - if (temp_fv0 > 1000.0f) { - func_808DEA54(this, 0); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); + if (distToPlayer > 1000.0f) { + EnHorseLinkChild_SetupWaitForPlayer(this, 0); return; } - if ((temp_fv0 < 1000.0f) && (temp_fv0 >= 300.0f)) { - phi_v0 = 4; + if ((distToPlayer < 1000.0f) && (distToPlayer >= 300.0f)) { + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; - } else if ((temp_fv0 < 300.0f) && (temp_fv0 >= 150.0f)) { - phi_v0 = 3; + } else if ((distToPlayer < 300.0f) && (distToPlayer >= 150.0f)) { + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; - } else if ((temp_fv0 < 150.0f) && (temp_fv0 >= 70.0f)) { - phi_v0 = 2; - this->unk_1E8 = 0; + } else if ((distToPlayer < 150.0f) && (distToPlayer >= 70.0f)) { + animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->footstepCounter = 0; this->actor.speed = 2.0f; } else { - func_808DEA54(this, 1); + EnHorseLinkChild_SetupWaitForPlayer(this, 1); return; } - if (phi_v0 != this->unk_148) { - this->unk_148 = phi_v0; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f); } } } -void func_808DEFE8(EnHorseLinkChild* this) { - this->unk_144 = 3; - this->unk_148 = 0; +void EnHorseLinkChild_SetupLonLonIdle(EnHorseLinkChild* this) { + this->action = OOT_CHILD_EPONA_ACTION_LONLON_IDLE; + this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; this->actor.speed = 0.0f; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } void func_808DF088(EnHorseLinkChild* this, PlayState* play) { - if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { + if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || + (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) { Player* player = GET_PLAYER(play); - s16 sp32; - s32 phi_v0; + s16 newYawDiff; + s32 newYawDir; s32 pad; if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) { - sp32 = player->actor.shape.rot.y; + newYawDiff = player->actor.shape.rot.y; if (Actor_WorldYawTowardActor(&this->actor, &player->actor) > 0) { - phi_v0 = 1; + newYawDir = 1; } else { - phi_v0 = -1; + newYawDir = -1; } - sp32 += (phi_v0 << 0xE); + newYawDiff += (newYawDir * 0x4000); } else { - sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y; + newYawDiff = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y; } - if (sp32 > 0x12C) { + if (newYawDiff > 0x12C) { this->actor.world.rot.y += 0x12C; - } else if (sp32 < -0x12C) { + } else if (newYawDiff < -0x12C) { this->actor.world.rot.y += -0x12C; } else { - this->actor.world.rot.y += sp32; + this->actor.world.rot.y += newYawDiff; } this->actor.shape.rot.y = this->actor.world.rot.y; } } -void func_808DF194(EnHorseLinkChild* this, PlayState* play) { +/** + * Idle in one spot, waiting for player to finish getting Epona song. + * However, the flag was not migrated from OoT corectly, so it checks for the wrong flag. + */ +void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) { Player* player; - f32 sp50; - s32 sp4C; - s32 sp48; + f32 distToPlayer; + s32 isAnimFinished; + s32 animIndex; func_808DF088(this, play); player = GET_PLAYER(play); - sp50 = Actor_WorldDistXZToActor(&this->actor, &player->actor); - sp48 = this->unk_148; - sp4C = SkelAnime_Update(&this->skin.skelAnime); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor); + animIndex = this->animIndex; + isAnimFinished = SkelAnime_Update(&this->skin.skelAnime); - if ((sp4C != 0) || (this->unk_148 == 1) || (this->unk_148 == 0)) { - // The carry-over of this flag from OoT was not done correctly + if (isAnimFinished || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) || + (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE)) { + //! @bug: The carry-over of this flag from OoT was not done correctly if (CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_ZORA_HALL)) { - f32 sp44 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); + f32 distToHome = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); s32 pad; if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) > 250.0f) { - if (sp44 >= 300.0f) { - sp48 = 4; + if (distToHome >= 300.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; - } else if ((sp44 < 300.0f) && (sp44 >= 150.0f)) { - sp48 = 3; + } else if ((distToHome < 300.0f) && (distToHome >= 150.0f)) { + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; - } else if ((sp44 < 150.0f) && (sp44 >= 70.0f)) { - sp48 = 2; - this->unk_1E8 = 0; + } else if ((distToHome < 150.0f) && (distToHome >= 70.0f)) { + animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->footstepCounter = 0; this->actor.speed = 2.0f; } else { this->actor.speed = 0.0f; - if (this->unk_148 == 0) { - sp48 = (sp4C == 1) ? 1 : 0; + if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - sp48 = (sp4C == 1) ? 0 : 1; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } - } else if (sp50 < 200.0f) { - sp48 = 4; + } else if (distToPlayer < 200.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; - } else if (sp50 < 300.0f) { - sp48 = 3; + } else if (distToPlayer < 300.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; - } else if (sp50 < 400.0f) { - sp48 = 2; - this->unk_1E8 = 0; + } else if (distToPlayer < 400.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->footstepCounter = 0; this->actor.speed = 2.0f; } else { this->actor.speed = 0.0f; - if (this->unk_148 == 0) { - sp48 = (sp4C == 1) ? 1 : 0; + if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - sp48 = (sp4C == 1) ? 0 : 1; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } } else { this->actor.speed = 0.0f; - if (this->unk_148 == 0) { - sp48 = (sp4C == 1) ? 1 : 0; + if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) { + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE; } else { - sp48 = (sp4C == 1) ? 0 : 1; + animIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY; } } } - if ((sp48 != this->unk_148) || (sp4C == 1)) { - this->unk_148 = sp48; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + if ((this->animIndex != animIndex) || (isAnimFinished == true)) { + this->animIndex = animIndex; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), - this->skin.skelAnime.curFrame, Animation_GetLastFrame(D_808DFEC0[this->unk_148]), + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + this->skin.skelAnime.curFrame, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f); } } -void func_808DF560(EnHorseLinkChild* this) { - this->unk_144 = 5; +void EnHorseLinkChild_SetupActionFunc5(EnHorseLinkChild* this) { + this->action = OOT_CHILD_EPONA_ACTION_5; if (Rand_ZeroOne() > 0.5f) { - this->unk_148 = 0; + this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE; } else { - this->unk_148 = 1; + this->animIndex = OOT_CHILD_EPONA_ANIM_WHINNY; } gHorsePlayedEponasSong = false; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f); } -void func_808DF620(EnHorseLinkChild* this, PlayState* play) { - s16 sp36; +void EnHorseLinkChild_ActionFunc5(EnHorseLinkChild* this, PlayState* play) { + s16 yawTowardsPlayer; if (gHorsePlayedEponasSong) { gHorsePlayedEponasSong = false; - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); - func_808DF788(this); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); + EnHorseLinkChild_SetupActionFunc4(this); return; } this->actor.speed = 0.0f; - sp36 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + yawTowardsPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; - if ((Math_CosS(sp36) < 0.7071f) && (this->unk_148 == 2)) { + if ((Math_CosS(yawTowardsPlayer) < 0.7071f) && (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) { Horse_RotateToPoint(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C); } if (SkelAnime_Update(&this->skin.skelAnime)) { - if (Math_CosS(sp36) < 0.0f) { - this->unk_148 = 2; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], D_808DFF18[this->unk_148], 0.0f, - Animation_GetLastFrame(D_808DFEC8[0]), ANIMMODE_ONCE, -5.0f); + if (Math_CosS(yawTowardsPlayer) < 0.0f) { + this->animIndex = OOT_CHILD_EPONA_ANIM_WALK; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], sAnimPlaySpeeds[this->animIndex], + 0.0f, Animation_GetLastFrame(sAnimations[OOT_CHILD_EPONA_ANIM_WALK]), ANIMMODE_ONCE, + -5.0f); } else { - func_808DF560(this); + EnHorseLinkChild_SetupActionFunc5(this); } } } -void func_808DF788(EnHorseLinkChild* this) { - this->unk_1DC = 0; - this->unk_144 = 4; - this->unk_148 = 2; - this->unk_1E0 = 0; +void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this) { + this->timer = 0; + this->action = OOT_CHILD_EPONA_ACTION_4; + this->animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->isReturningHome = false; this->actor.speed = 2.0f; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } -void func_808DF838(EnHorseLinkChild* this, PlayState* play) { +void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 phi_fv0; - s32 phi_v0; + f32 distToTargetPos; + s32 animIndex; - this->unk_1DC++; - if (this->unk_1DC > 300) { - this->unk_1E0 = 1; + this->timer++; + if (this->timer > 300) { + this->isReturningHome = true; } - if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { - if (this->unk_1E0 == 0) { + if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || + (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) { + if (!this->isReturningHome) { Horse_RotateToPoint(&this->actor, &player->actor.world.pos, 0x12C); } else { Horse_RotateToPoint(&this->actor, &this->actor.home.pos, 0x12C); @@ -480,46 +541,46 @@ void func_808DF838(EnHorseLinkChild* this, PlayState* play) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - if (this->unk_1E0 == 0) { - phi_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); + if (!this->isReturningHome) { + distToTargetPos = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); } else { - phi_fv0 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); + distToTargetPos = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); } - if (this->unk_1E0 == 0) { - if (phi_fv0 >= 300.0f) { - phi_v0 = 4; + if (!this->isReturningHome) { + if (distToTargetPos >= 300.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; - } else if (phi_fv0 >= 150.0f) { - phi_v0 = 3; + } else if (distToTargetPos >= 150.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; } else { - phi_v0 = 2; - this->unk_1E8 = 0; + animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->footstepCounter = 0; this->actor.speed = 2.0f; } - } else if (phi_fv0 >= 300.0f) { - phi_v0 = 4; + } else if (distToTargetPos >= 300.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_GALLOP; this->actor.speed = 6.0f; - } else if (phi_fv0 >= 150.0f) { - phi_v0 = 3; + } else if (distToTargetPos >= 150.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_TROT; this->actor.speed = 4.0f; - } else if (phi_fv0 >= 70.0f) { - phi_v0 = 2; - this->unk_1E8 = 0; + } else if (distToTargetPos >= 70.0f) { + animIndex = OOT_CHILD_EPONA_ANIM_WALK; + this->footstepCounter = 0; this->actor.speed = 2.0f; } else { - func_808DF560(this); + EnHorseLinkChild_SetupActionFunc5(this); return; } - if (phi_v0 != this->unk_148) { - this->unk_148 = phi_v0; - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f); } else { - Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, - Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), + 0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f); } } } @@ -528,7 +589,8 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { s32 pad; EnHorseLinkChild* this = THIS; - D_808DFF30[this->unk_144](this, play); + sActionFuncs[this->action](this, play); + Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | @@ -537,19 +599,19 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - if ((Rand_ZeroOne() < 0.025f) && (this->unk_1E4 == 0)) { - this->unk_1E4++; - } else if (this->unk_1E4 > 0) { - this->unk_1E4++; - if (this->unk_1E4 >= 4) { - this->unk_1E4 = 0; + if ((Rand_ZeroOne() < 0.025f) && (this->eyeTexIndex == 0)) { + this->eyeTexIndex++; + } else if (this->eyeTexIndex > 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex >= 4) { + this->eyeTexIndex = 0; } } Collider_UpdateCylinder(&this->actor, &this->colldierCylinder); CollisionCheck_SetOC(play, &play->colChkCtx, &this->colldierCylinder.base); - func_808DE660(this); + EnHorseLinkChild_PlaySound(this); } void EnHorseLinkChild_PostSkinDraw(Actor* thisx, PlayState* play, Skin* skin) { @@ -581,9 +643,9 @@ s32 EnHorseLinkChild_OverrideSkinDraw(Actor* thisx, PlayState* play, s32 limbInd OPEN_DISPS(play->state.gfxCtx); if (limbIndex == OBJECT_HORSE_LINK_CHILD_LIMB_0D) { - u8 index = D_808DFF54[this->unk_1E4]; + u8 index = sEyeTextureIndexOverride[this->eyeTexIndex]; - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808DFF48[index])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[index])); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h index 62fac6a63..0d5e30165 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h @@ -6,17 +6,17 @@ struct EnHorseLinkChild; -typedef void (*EnHorseLinkChildUnkFunc)(struct EnHorseLinkChild*, PlayState*); +typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, PlayState*); typedef struct EnHorseLinkChild { /* 0x000 */ Actor actor; - /* 0x144 */ s32 unk_144; - /* 0x148 */ s32 unk_148; + /* 0x144 */ s32 action; // index to action func list + /* 0x148 */ s32 animIndex; /* 0x14C */ Skin skin; - /* 0x1DC */ s32 unk_1DC; - /* 0x1DC */ s32 unk_1E0; - /* 0x1E4 */ u8 unk_1E4; - /* 0x1E8 */ s32 unk_1E8; + /* 0x1DC */ s32 timer; + /* 0x1DC */ s32 isReturningHome; + /* 0x1E4 */ u8 eyeTexIndex; + /* 0x1E8 */ s32 footstepCounter; // two sfx per animation loop /* 0x1EC */ ColliderCylinder colldierCylinder; /* 0x238 */ ColliderJntSph colliderJntSph; /* 0x258 */ ColliderJntSphElement colliderJntSphElements[1]; 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 648a13d46..ef991495a 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -6,7 +6,7 @@ #include "z_en_hs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnHs*)thisx) @@ -74,7 +74,7 @@ void EnHs_Init(Actor* thisx, PlayState* play) { EnHs* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gHsSkeleton, &gHsIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gHsSkel, &gHsIdleAnim, this->jointTable, this->morphTable, OBJECT_HS_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gHsIdleAnim); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -87,7 +87,7 @@ void EnHs_Init(Actor* thisx, PlayState* play) { } this->stateFlags = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; func_80952C50(this, play); } @@ -110,7 +110,7 @@ void EnHs_UpdateChickPos(Vec3f* dst, Vec3f src, f32 offset) { Math_Vec3f_Diff(&src, dst, &diff); - distance = SQ(diff.x) + SQ(diff.z); // gets un-squared after we check if we are too close + distance = SQXZ(diff); // gets un-squared after we check if we are too close if (SQ(offset) > distance) { return; @@ -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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { this->stateFlags |= 8; if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { @@ -176,20 +176,20 @@ void func_80953098(EnHs* this, PlayState* play) { void func_80953180(EnHs* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x33F4: // text: laughing that they are all roosters (!) - case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood + case 0x33F4: // laughing that they are all roosters (!) + case 0x33F6: // Grog regrets not being able to see his chicks reach adult hood Message_CloseTextbox(play); this->actionFunc = func_8095345C; break; - case 0x33F7: // text: notice his chicks are grown up, happy, wants to give you bunny hood + case 0x33F7: // notice his chicks are grown up, happy, wants to give you bunny hood this->actor.flags &= ~ACTOR_FLAG_10000; Message_CloseTextbox(play); this->actionFunc = func_80953098; func_80953098(this, play); break; - case 0x33F9: // text: laughing that they are all roosters (.) + case 0x33F9: // laughing that they are all roosters (.) this->actor.flags &= ~ACTOR_FLAG_10000; Message_CloseTextbox(play); this->actionFunc = func_8095345C; @@ -264,10 +264,10 @@ 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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); this->stateFlags |= 1; } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x2000, play)) { - func_800B8614(&this->actor, play, 130.0f); + Actor_OfferTalk(&this->actor, play, 130.0f); this->stateFlags |= 1; } else { this->stateFlags &= ~1; @@ -341,6 +341,9 @@ s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } break; + + default: + break; } return false; } diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 8273d8789..07a6748af 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -6,7 +6,7 @@ #include "z_en_hs2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnHs2*)thisx) 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 abdf870b9..3006c7bfe 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -6,9 +6,8 @@ #include "z_en_ig.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/object_dai/object_dai.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnIg*)thisx) @@ -143,17 +142,32 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -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 }, - { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +typedef enum EnIgAnimation { + /* -1 */ ENIG_ANIM_NONE = -1, + /* 0 */ ENIG_ANIM_0, + /* 1 */ ENIG_ANIM_1, + /* 2 */ ENIG_ANIM_2, + /* 3 */ ENIG_ANIM_3, + /* 4 */ ENIG_ANIM_4, + /* 5 */ ENIG_ANIM_5, + /* 6 */ ENIG_ANIM_6, + /* 7 */ ENIG_ANIM_7, + /* 8 */ ENIG_ANIM_8, + /* 9 */ ENIG_ANIM_9, + /* 10 */ ENIG_ANIM_MAX +} EnIgAnimation; + +static AnimationInfoS sAnimationInfo[ENIG_ANIM_MAX] = { + { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_0 + { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_1 + { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_2 + { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_3 + { &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_4 + { &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_5 + { &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_6 + { &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIG_ANIM_7 + { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_8 + { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_9 }; Actor* func_80BF1150(EnIg* this, PlayState* play, u8 actorCat, s16 actorId) { @@ -204,44 +218,44 @@ EnDoor* func_80BF1200(PlayState* play, s32 arg1) { return SubS_FindDoor(play, phi_a1); } -void func_80BF1258(EnIg* this) { - this->skelAnime.playSpeed = this->unk_3D4; +void EnIg_UpdateSkelAnime(EnIg* this) { + this->skelAnime.playSpeed = this->animPlaySpeed; SkelAnime_Update(&this->skelAnime); } -s32 func_80BF1284(EnIg* this, s32 arg1) { - s32 phi_v1 = false; - s32 ret = false; +s32 EnIg_ChangeAnim(EnIg* this, s32 animIndex) { + s32 changeAnim = false; + s32 didAnimChange = false; - switch (arg1) { - case 0: - case 1: - if ((this->unk_3FC != 0) && (this->unk_3FC != 1)) { - phi_v1 = true; + switch (animIndex) { + case ENIG_ANIM_0: + case ENIG_ANIM_1: + if ((this->animIndex != ENIG_ANIM_0) && (this->animIndex != ENIG_ANIM_1)) { + changeAnim = true; } break; - case 2: - case 3: - if ((this->unk_3FC != 2) && (this->unk_3FC != 3)) { - phi_v1 = true; + case ENIG_ANIM_2: + case ENIG_ANIM_3: + if ((this->animIndex != ENIG_ANIM_2) && (this->animIndex != ENIG_ANIM_3)) { + changeAnim = true; } break; default: - if (arg1 != this->unk_3FC) { - phi_v1 = true; + if (this->animIndex != animIndex) { + changeAnim = true; } break; } - if (phi_v1) { - this->unk_3FC = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); - this->unk_3D4 = this->skelAnime.playSpeed; + if (changeAnim) { + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + this->animPlaySpeed = this->skelAnime.playSpeed; } - return ret; + return didAnimChange; } void func_80BF1354(EnIg* this, PlayState* play) { @@ -286,7 +300,7 @@ void func_80BF14B0(EnIg* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_2A8->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_2A8)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_2A8)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_2A8->focus.pos); } @@ -358,16 +372,18 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { switch (this->unk_3F6) { case 0: - if (func_80BF16C8(this, csId)) { - case 2: - case 4: - if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), - this->actor.child); - } - this->unk_3F6++; - ret = true; + if (!func_80BF16C8(this, csId)) { + break; } + // fallthrough + case 2: + case 4: + if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), + this->actor.child); + } + this->unk_3F6++; + ret = true; break; case 1: @@ -387,6 +403,9 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { this->unk_3F6++; ret = true; break; + + default: + break; } return ret; } @@ -420,29 +439,28 @@ s32* func_80BF1920(EnIg* this, PlayState* play) { s32 func_80BF19A0(EnIg* this, PlayState* play) { s32 ret = false; - if (this->unk_3D0 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_3D0, 0, 7); - this->unk_3F6 = 0; - this->unk_3F8 = NULL; - this->actor.child = this->unk_2A8; - this->unk_29C = func_80BF1920(this, play); - if ((this->scheduleResult != 2) && (this->scheduleResult != 3) && (this->scheduleResult != 4)) { - this->unk_3D0 |= 0x20; - } - this->actionFunc = func_80BF2BD4; - ret = true; + if (((this->unk_3D0 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->unk_3F6 = 0; + this->unk_3F8 = NULL; + this->actor.child = this->unk_2A8; + this->unk_29C = func_80BF1920(this, play); + if ((this->scheduleResult != 2) && (this->scheduleResult != 3) && (this->scheduleResult != 4)) { + this->unk_3D0 |= 0x20; } + this->actionFunc = func_80BF2BD4; + ret = true; } return ret; } void func_80BF1A60(EnIg* this, PlayState* play) { if (this->unk_3F4 == 0) { - func_80BF1284(this, 4); + EnIg_ChangeAnim(this, ENIG_ANIM_4); this->unk_3F4++; } else if ((this->unk_3F4 == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80BF1284(this, 5); + EnIg_ChangeAnim(this, ENIG_ANIM_5); this->unk_3F4++; } } @@ -450,7 +468,7 @@ void func_80BF1A60(EnIg* this, PlayState* play) { s32 func_80BF1AE0(EnIg* this, PlayState* play) { switch (this->scheduleResult) { case 3: - func_80BF1284(this, 0); + EnIg_ChangeAnim(this, ENIG_ANIM_0); break; case 10: @@ -458,7 +476,10 @@ s32 func_80BF1AE0(EnIg* this, PlayState* play) { case 12: case 13: case 14: - func_80BF1284(this, 2); + EnIg_ChangeAnim(this, ENIG_ANIM_2); + break; + + default: break; } return true; @@ -472,8 +493,8 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400 | PLAYER_STATE1_800)) { this->unk_3D0 |= 0x400; if (this->unk_3D2 != temp) { - if ((this->unk_3FC == 2) || (this->unk_3FC == 3)) { - func_80BF1284(this, 0); + if ((this->animIndex == ENIG_ANIM_2) || (this->animIndex == ENIG_ANIM_3)) { + EnIg_ChangeAnim(this, ENIG_ANIM_0); } if ((temp == 0x28B0) || (temp == 0x28B7)) { @@ -485,7 +506,10 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { } else if (this->unk_3D0 & 0x400) { this->unk_3D2 = 0; this->unk_3D0 &= ~0x400; + + //! FAKE: if (1) {} + func_80BF1AE0(this, play); } @@ -530,8 +554,8 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 sp2C = 0; if (func_80BF1C44(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) { - func_80BF1284(this, 0); - SubS_UpdateFlags(&this->unk_3D0, 3, 7); + EnIg_ChangeAnim(this, ENIG_ANIM_0); + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3D0 |= 0x20; this->unk_3D0 |= 0x100; sp2C = true; @@ -574,9 +598,9 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_3E0 = scheduleOutput->time1 - scheduleOutput->time0; this->unk_3E2 = sp56 - scheduleOutput->time0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_3D0 |= 0x100; - func_80BF1284(this, 3); + EnIg_ChangeAnim(this, ENIG_ANIM_3); this->actor.gravity = 0.0f; ret = true; } @@ -625,9 +649,9 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_3D0 &= ~0x8; this->unk_3D0 &= ~0x10; - SubS_UpdateFlags(&this->unk_3D0, 3, 7); + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3D0 |= 0x100; - func_80BF1284(this, 2); + EnIg_ChangeAnim(this, ENIG_ANIM_2); this->actor.gravity = -1.0f; ret = true; } @@ -661,17 +685,20 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { case 2: this->actor.home.rot.y = this->actor.world.rot.y; this->actor.home.rot.y += 0x8000; - SubS_UpdateFlags(&this->unk_3D0, 3, 7); + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3D0 |= 0x100; - func_80BF1284(this, 1); + EnIg_ChangeAnim(this, ENIG_ANIM_1); break; case 4: this->actor.world.rot.y += 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; - SubS_UpdateFlags(&this->unk_3D0, 3, 7); + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3D0 |= 0x100; - func_80BF1284(this, 8); + EnIg_ChangeAnim(this, ENIG_ANIM_8); + break; + + default: break; } ret = true; @@ -682,9 +709,9 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->unk_3D0 = 0; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; switch (scheduleOutput->result) { case 5: @@ -711,6 +738,9 @@ s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { case 3: ret = func_80BF1D78(this, play, scheduleOutput); break; + + default: + break; } return ret; } @@ -766,6 +796,7 @@ s32 func_80BF25E8(EnIg* this, PlayState* play) { s32 pad; SubS_TimePathing_FillKnots(knots, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER); + if (!(this->unk_3D0 & 8)) { timePathTargetPos = gZeroVec3f; SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, @@ -831,11 +862,11 @@ s32 func_80BF293C(EnIg* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, this->actor.home.rot.y, 3, 0x2AA8); } else { this->actor.world.rot.y = this->actor.home.rot.y; - func_80BF1284(this, 7); + EnIg_ChangeAnim(this, ENIG_ANIM_7); } - } else if ((this->unk_3FC == 7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_UpdateFlags(&this->unk_3D0, 3, 7); - func_80BF1284(this, 9); + } else if ((this->animIndex == ENIG_ANIM_7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + EnIg_ChangeAnim(this, ENIG_ANIM_9); } return true; } @@ -869,6 +900,9 @@ void func_80BF2A50(EnIg* this, PlayState* play) { case 4: func_80BF2890(this, play); break; + + default: + break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } @@ -881,11 +915,11 @@ void func_80BF2AF8(EnIg* this, PlayState* play) { if (!Schedule_RunScript(play, D_80BF3260, &sp20) || ((this->scheduleResult != sp20.result) && !func_80BF2368(this, play, &sp20))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sp20.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_2A8 = func_80BF146C(this, play); this->scheduleResult = sp20.result; @@ -898,7 +932,7 @@ void func_80BF2BD4(EnIg* this, PlayState* play) { Vec3f sp2C; if (func_8010BF58(&this->actor, play, this->unk_29C, this->unk_3F8, &this->unk_2A0)) { - SubS_UpdateFlags(&this->unk_3D0, 3, 7); + SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3D0 &= ~0x20; this->unk_3D0 |= 0x200; this->unk_3EE = 20; @@ -917,9 +951,10 @@ void EnIg_Init(Actor* thisx, PlayState* play) { EnIg* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19); - this->unk_3FC = -1; - func_80BF1284(this, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, + OBJECT_DAI_LIMB_MAX); + this->animIndex = ENIG_ANIM_NONE; + EnIg_ChangeAnim(this, ENIG_ANIM_0); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); Collider_InitAndSetSphere(play, &this->collider2, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); @@ -947,10 +982,10 @@ void EnIg_Update(Actor* thisx, PlayState* play) { func_80BF1B40(this, play); if (this->scheduleResult != 0) { - func_80BF1258(this); + EnIg_UpdateSkelAnime(this); func_80BF13E4(this); func_80BF15EC(this); - func_8013C964(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk_3D0 & 7); + SubS_Offer(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk_3D0 & SUBS_OFFER_MODE_MASK); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80BF1354(this, play); @@ -961,7 +996,7 @@ s32 EnIg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po Gfx** gfx) { EnIg* this = THIS; - if (limbIndex == 10) { + if (limbIndex == OBJECT_DAI_LIMB_0A) { *dList = NULL; } return false; @@ -974,7 +1009,7 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnIg* this = THIS; Vec3f sp2C; - if (limbIndex == 11) { + if (limbIndex == OBJECT_DAI_LIMB_0B) { Matrix_MultVec3f(&D_80BF3528, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); @@ -982,17 +1017,17 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gSPDisplayList((*gfx)++, object_dai_DL_0087B8); } - if (limbIndex == 12) { + if (limbIndex == OBJECT_DAI_LIMB_0C) { gSPDisplayList((*gfx)++, object_dai_DL_0089D8); } - if (limbIndex == 9) { + if (limbIndex == OBJECT_DAI_LIMB_09) { gSPDisplayList((*gfx)++, object_dai_DL_008B00); Matrix_MultVec3f(&D_80BF351C, &sp2C); Math_Vec3f_ToVec3s(&this->collider2.dim.worldSphere.center, &sp2C); } - if (limbIndex == 10) { + if (limbIndex == OBJECT_DAI_LIMB_0A) { Matrix_Get(&this->unk_190); } } @@ -1014,7 +1049,7 @@ void EnIg_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** stepRot = false; } - if (limbIndex == 9) { + if (limbIndex == OBJECT_DAI_LIMB_09) { SubS_UpdateLimb(this->unk_3E8 + 0x4000, this->unk_3EA + this->actor.shape.rot.y + 0x4000, &this->unk_2D4, &this->unk_2E6, stepRot, overrideRot); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.h b/src/overlays/actors/ovl_En_Ig/z_en_ig.h index 274338a11..71c7c509d 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.h +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.h @@ -2,6 +2,7 @@ #define Z_EN_IG_H #include "global.h" +#include "objects/object_dai/object_dai.h" struct EnIg; @@ -38,11 +39,11 @@ typedef struct EnIg { /* 0x2D4 */ Vec3f unk_2D4; /* 0x2E0 */ UNK_TYPE1 unk2E0[0x6]; /* 0x2E6 */ Vec3s unk_2E6; - /* 0x2EC */ Vec3s jointTable[19]; - /* 0x35E */ Vec3s morphTable[19]; + /* 0x2EC */ Vec3s jointTable[OBJECT_DAI_LIMB_MAX]; + /* 0x35E */ Vec3s morphTable[OBJECT_DAI_LIMB_MAX]; /* 0x3D0 */ u16 unk_3D0; /* 0x3D2 */ u16 unk_3D2; - /* 0x3D4 */ f32 unk_3D4; + /* 0x3D4 */ f32 animPlaySpeed; /* 0x3D8 */ UNK_TYPE1 unk3D8[0x8]; /* 0x3E0 */ s16 unk_3E0; /* 0x3E2 */ s16 unk_3E2; @@ -57,7 +58,7 @@ typedef struct EnIg { /* 0x3F4 */ s16 unk_3F4; /* 0x3F6 */ s16 unk_3F6; /* 0x3F8 */ EnIgUnkFunc unk_3F8; - /* 0x3FC */ s32 unk_3FC; + /* 0x3FC */ s32 animIndex; /* 0x400 */ UNK_TYPE1 unk400[0x8]; /* 0x408 */ s32 unk_408; } EnIg; // size = 0x40C 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 a116c323a..7f3ed6de4 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -6,8 +6,9 @@ #include "z_en_ik.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnIk*)thisx) @@ -53,14 +54,14 @@ typedef struct { /* 0x4 */ s16 unk04; } EnIkUnkStruct; // size = 0x8 -EnIkUnkStruct sIronKnuckleArmorMarkings[] = { - { gIronKnuckleHelmetMarkingDL, 0x0000 }, - { gIronKnuckleFrontTorsoArmorMarkingDL, 0x0000 }, - { gIronKnuckleRearTorsoArmorMarkingDL, 0x7FFF }, - { gIronKnuckleRivetsMarking2DL, 0x4000 }, - { gIronKnuckleRivetsMarking1DL, 0xC000 }, - { NULL, 0x4000 }, - { NULL, 0xC000 }, +EnIkUnkStruct sIronKnuckleArmorMarkings[IRON_KNUCKLE_ARMOR_BODYPART_MAX] = { + { gIronKnuckleHelmetMarkingDL, 0x0000 }, // IRON_KNUCKLE_ARMOR_BODYPART_HELMET + { gIronKnuckleFrontTorsoArmorMarkingDL, 0x0000 }, // IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT + { gIronKnuckleRearTorsoArmorMarkingDL, 0x7FFF }, // IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK + { gIronKnuckleRivetsMarking2DL, 0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON + { gIronKnuckleRivetsMarking1DL, -0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON + { NULL, 0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON + { NULL, -0x4000 }, // IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON }; // sIronKnuckleArmorType[PARAM_VALUE][ARMOR_SECTIONS] @@ -265,7 +266,7 @@ void EnIk_Init(Actor* thisx, PlayState* play) { this->morphTable, IRON_KNUCKLE_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->shieldColliderItems); + Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->shieldColliderElements); Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableArmor, &sColChkInfoInit); this->actor.params = IK_GET_ARMOR_TYPE(&this->actor); @@ -306,7 +307,7 @@ void EnIk_Thaw(EnIk* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, IRON_KNUCKLE_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -317,7 +318,7 @@ void EnIk_HitArmor(EnIk* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderCylinder.info.bumper.hitPos.x, this->colliderCylinder.info.bumper.hitPos.y, this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } s32 EnIk_IsChangingAction(EnIk* this, PlayState* play) { @@ -355,7 +356,7 @@ s32 EnIk_ChooseAttack(EnIk* this) { void EnIk_CheckActions(EnIk* this, PlayState* play) { if (!EnIk_IsChangingAction(this, play) && !EnIk_ChooseAttack(this)) { - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { EnIk_SetupRun(this); } else { EnIk_SetupWalk(this); @@ -364,15 +365,15 @@ void EnIk_CheckActions(EnIk* this, PlayState* play) { } void EnIk_SetupIdle(EnIk* this) { - f32 frameCount = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); + f32 endFrame = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->timer = 10; } else { this->timer = 0; } - Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, frameCount, frameCount, - ANIMMODE_ONCE, this->timer); + Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE, + this->timer); this->actionFunc = EnIk_Idle; this->actor.speed = 0.0f; } @@ -454,13 +455,13 @@ void EnIk_SetupVerticalAttack(EnIk* this) { f32 playbackSpeed; this->actor.speed = 0.0f; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { playbackSpeed = 1.5f; } else { playbackSpeed = 1.2f; } Animation_Change(&this->skelAnime, &gIronKnuckleVerticalAttackAnim, playbackSpeed, 0.0f, - Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), 3, -4.0f); + Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), ANIMMODE_ONCE_INTERP, -4.0f); this->timer = 0; this->blurEffectSpawnLock = -1; this->actionFunc = EnIk_VerticalAttack; @@ -486,7 +487,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { this->colliderQuad.base.atFlags |= AT_ON; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; } } else { @@ -537,12 +538,12 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { f32 phi_f2; this->timer++; - if ((Animation_OnFrame(&this->skelAnime, 1.0f)) || (Animation_OnFrame(&this->skelAnime, 13.0f))) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } if (((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 9.0f)) || ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f))) { - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x5DC); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->skelAnime.curFrame > 12.0f) { @@ -566,7 +567,7 @@ void EnIk_SetupSingleHorizontalAttack(EnIk* this) { f32 playSpeed; this->actor.speed = 0.0f; - if (this->drawArmorFlags) { + if (this->drawArmorFlags != 0) { this->actor.world.rot.z = 0x1000; playSpeed = 1.3f; } else { @@ -794,7 +795,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTableNoArmor; Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); EnIk_SetupCutscene(this); - } else if (this->drawArmorFlags) { + } else if (this->drawArmorFlags != 0) { if (this->actor.colChkInfo.damageEffect == DMG_EFF_ICE) { EnIk_Freeze(this); EnIk_SetupFrozen(this); @@ -921,38 +922,95 @@ void EnIk_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = this->drawDmgEffScale; } } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.65f, 0.01625f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } EnIk_UpdateArmor(this, play); } -s8 D_8092C1A8[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3, 5, 4, 6, 1, 2, -1, -1, 0, 0, +static s8 sLimbToArmorBodyParts[IRON_KNUCKLE_LIMB_MAX] = { + BODYPART_NONE, // IRON_KNUCKLE_LIMB_NONE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_CENTER + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_RIGHT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_LEG + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_LEFT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_LEG + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_BODY_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UNK_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD_ROOT + IRON_KNUCKLE_ARMOR_BODYPART_HELMET, // IRON_KNUCKLE_LIMB_HELMET_ARMOR + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_UPPER_ARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_HAND + IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_LEFT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_RIGHT_PAULDRON + IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT + IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TORSO + BODYPART_NONE, // IRON_KNUCKLE_LIMB_WAIST }; s32 EnIk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnIk* this = THIS; - if (this->drawArmorFlags) { - if (D_8092C1A8[limbIndex] > 0) { + if (this->drawArmorFlags != 0) { + if (sLimbToArmorBodyParts[limbIndex] >= IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT) { *dList = NULL; } } return false; } -void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_8092C1C8 = { 2000.0f, -200.0f, -5200.0f }; - static Vec3f D_8092C1D4 = { 300.0f, -200.0f, 0.0f }; - static s8 limbPosIndex[] = { - -1, -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, -1, 6, -1, -1, 7, - -1, -1, 8, -1, 9, 10, -1, 11, -1, 12, -1, -1, -1, -1, 0, 0, - }; +static Vec3f D_8092C1C8 = { 2000.0f, -200.0f, -5200.0f }; +static Vec3f D_8092C1D4 = { 300.0f, -200.0f, 0.0f }; +static s8 sLimbToBodyParts[IRON_KNUCKLE_LIMB_MAX] = { + BODYPART_NONE, // IRON_KNUCKLE_LIMB_NONE + BODYPART_NONE, // IRON_KNUCKLE_LIMB_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TASSET_CENTER + IRON_KNUCKLE_BODYPART_TASSET_RIGHT, // IRON_KNUCKLE_LIMB_TASSET_RIGHT + IRON_KNUCKLE_BODYPART_RIGHT_LEG, // IRON_KNUCKLE_LIMB_RIGHT_LEG + IRON_KNUCKLE_BODYPART_RIGHT_FOOT, // IRON_KNUCKLE_LIMB_RIGHT_FOOT + IRON_KNUCKLE_BODYPART_TASSET_LEFT, // IRON_KNUCKLE_LIMB_TASSET_LEFT + IRON_KNUCKLE_BODYPART_LEFT_LEG, // IRON_KNUCKLE_LIMB_LEFT_LEG + IRON_KNUCKLE_BODYPART_LEFT_FOOT, // IRON_KNUCKLE_LIMB_LEFT_FOOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_BODY_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UNK_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD_ROOT + IRON_KNUCKLE_BODYPART_HELMET_ARMOR, // IRON_KNUCKLE_LIMB_HELMET_ARMOR + BODYPART_NONE, // IRON_KNUCKLE_LIMB_HEAD + BODYPART_NONE, // IRON_KNUCKLE_LIMB_RIGHT_UPPER_ARM + IRON_KNUCKLE_BODYPART_RIGHT_FOREARM, // IRON_KNUCKLE_LIMB_RIGHT_FOREARM + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE_ROOT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_AXE + IRON_KNUCKLE_BODYPART_RIGHT_HAND, // IRON_KNUCKLE_LIMB_RIGHT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_LEFT_UPPER_ARM + IRON_KNUCKLE_BODYPART_LEFT_FOREARM, // IRON_KNUCKLE_LIMB_LEFT_FOREARM + IRON_KNUCKLE_BODYPART_LEFT_HAND, // IRON_KNUCKLE_LIMB_LEFT_HAND + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON + IRON_KNUCKLE_BODYPART_LOWER_LEFT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_LEFT_PAULDRON + BODYPART_NONE, // IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON + IRON_KNUCKLE_BODYPART_LOWER_RIGHT_PAULDRON, // IRON_KNUCKLE_LIMB_LOWER_RIGHT_PAULDRON + BODYPART_NONE, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT + BODYPART_NONE, // IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK + BODYPART_NONE, // IRON_KNUCKLE_LIMB_TORSO + BODYPART_NONE, // IRON_KNUCKLE_LIMB_WAIST +}; + +void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnIk* this = THIS; - s32 index = D_8092C1A8[limbIndex]; + s32 armorBodyPart = sLimbToArmorBodyParts[limbIndex]; Gfx* xlu; IronKnuckleEffect* ikEffect; s16 sp76; @@ -963,15 +1021,16 @@ void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, MtxF* mf; if (this->drawArmorFlags == 0x1) { - if (index > 0) { - ikEffect = &this->effects[index]; + if (armorBodyPart >= IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT) { + ikEffect = &this->effects[armorBodyPart]; mf = Matrix_GetCurrent(); ikEffect->pos.x = mf->mf[3][0]; ikEffect->pos.y = mf->mf[3][1]; ikEffect->pos.z = mf->mf[3][2]; Matrix_MtxFToYXZRot(mf, &ikEffect->rot, false); ikEffect->enabled = true; - sp76 = sIronKnuckleArmorMarkings[index].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); + sp76 = + sIronKnuckleArmorMarkings[armorBodyPart].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); ikEffect->vel.x = Math_SinS(sp76) * 5.0f; ikEffect->vel.y = 6.0f; ikEffect->vel.z = Math_CosS(sp76) * 5.0f; @@ -1003,18 +1062,19 @@ void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->blurEffectSpawnLock = this->timer; } - if (limbPosIndex[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[limbPosIndex[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if ((index == 0) || - ((index != -1) && (this->drawArmorFlags == 0) && (sIronKnuckleArmorMarkings[index].unk00 != 0))) { + if ((armorBodyPart == IRON_KNUCKLE_ARMOR_BODYPART_HELMET) || + ((armorBodyPart != BODYPART_NONE) && (this->drawArmorFlags == 0) && + (sIronKnuckleArmorMarkings[armorBodyPart].unk00 != NULL))) { OPEN_DISPS(play->state.gfxCtx); xlu = POLY_XLU_DISP; gSPMatrix(&xlu[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&xlu[1], sIronKnuckleArmorMarkings[index].unk00); + gSPDisplayList(&xlu[1], sIronKnuckleArmorMarkings[armorBodyPart].unk00); POLY_XLU_DISP = &xlu[2]; CLOSE_DISPS(play->state.gfxCtx); @@ -1094,7 +1154,7 @@ void EnIk_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } func_800BC620(&this->actor.focus.pos, &sScale, 255, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, IRON_KNUCKLE_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 3489329b1..a6d56bca6 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -24,6 +24,34 @@ typedef struct { /* 0x24 */ s32 enabled; } IronKnuckleEffect; // size = 0x28 +typedef enum IronKnuckleBodyPart { + /* 0 */ IRON_KNUCKLE_BODYPART_TASSET_RIGHT, + /* 1 */ IRON_KNUCKLE_BODYPART_RIGHT_LEG, + /* 2 */ IRON_KNUCKLE_BODYPART_RIGHT_FOOT, + /* 3 */ IRON_KNUCKLE_BODYPART_TASSET_LEFT, + /* 4 */ IRON_KNUCKLE_BODYPART_LEFT_LEG, + /* 5 */ IRON_KNUCKLE_BODYPART_LEFT_FOOT, + /* 6 */ IRON_KNUCKLE_BODYPART_HELMET_ARMOR, + /* 7 */ IRON_KNUCKLE_BODYPART_RIGHT_FOREARM, + /* 8 */ IRON_KNUCKLE_BODYPART_RIGHT_HAND, + /* 9 */ IRON_KNUCKLE_BODYPART_LEFT_FOREARM, + /* 10 */ IRON_KNUCKLE_BODYPART_LEFT_HAND, + /* 11 */ IRON_KNUCKLE_BODYPART_LOWER_LEFT_PAULDRON, + /* 12 */ IRON_KNUCKLE_BODYPART_LOWER_RIGHT_PAULDRON, + /* 13 */ IRON_KNUCKLE_BODYPART_MAX +} IronKnuckleBodyPart; + +typedef enum IronKnuckleArmorBodyPart { + /* 0 */ IRON_KNUCKLE_ARMOR_BODYPART_HELMET, + /* 1 */ IRON_KNUCKLE_ARMOR_BODYPART_CHEST_FRONT, + /* 2 */ IRON_KNUCKLE_ARMOR_BODYPART_CHEST_BACK, + /* 3 */ IRON_KNUCKLE_ARMOR_BODYPART_UPPER_LEFT_PAULDRON, + /* 4 */ IRON_KNUCKLE_ARMOR_BODYPART_UPPER_RIGHT_PAULDRON, + /* 5 */ IRON_KNUCKLE_ARMOR_BODYPART_LOWER_LEFT_PAULDRON, + /* 6 */ IRON_KNUCKLE_ARMOR_BODYPART_LOWER_RIGHT_PAULDRON, + /* 7 */ IRON_KNUCKLE_ARMOR_BODYPART_MAX +} IronKnuckleArmorBodyPart; + typedef struct EnIk { /* 0x0000 */ Actor actor; /* 0x0144 */ SkelAnime skelAnime; @@ -40,12 +68,12 @@ typedef struct EnIk { /* 0x0304 */ f32 drawDmgEffAlpha; /* 0x0308 */ f32 drawDmgEffScale; /* 0x030C */ f32 drawDmgEffFrozenSteamScale; - /* 0x0310 */ Vec3f limbPos[13]; + /* 0x0310 */ Vec3f bodyPartsPos[IRON_KNUCKLE_BODYPART_MAX]; /* 0x03AC */ ColliderCylinder colliderCylinder; /* 0x03F8 */ ColliderQuad colliderQuad; /* 0x0478 */ ColliderTris colliderTris; - /* 0x0498 */ ColliderTrisElement shieldColliderItems[2]; - /* 0x0550 */ IronKnuckleEffect effects[7]; + /* 0x0498 */ ColliderTrisElement shieldColliderElements[2]; + /* 0x0550 */ IronKnuckleEffect effects[IRON_KNUCKLE_ARMOR_BODYPART_MAX]; } EnIk; // size = 0x668 #endif // Z_EN_IK_H diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index ca764b134..54b21b7ba 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -6,10 +6,9 @@ #include "z_en_in.h" #include "z64horse.h" -#include "objects/object_in/object_in.h" #include "overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnIn*)thisx) @@ -119,25 +118,25 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -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 }, - { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, +static AnimationInfoS sAnimationInfo[ENIN_ANIM_MAX] = { + { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_0 + { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_1 + { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_2 + { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_3 + { &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_4 + { &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_5 + { &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_6 + { &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_7 + { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_8 + { &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_9 + { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_10 + { &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_11 + { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_12 + { &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_13 + { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_14 + { &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIN_ANIM_15 + { &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_16 + { &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIN_ANIM_17 }; static TrackOptionsSet sTrackOptions = { @@ -148,20 +147,20 @@ static TrackOptionsSet sTrackOptions = { }; s32 EnIn_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { - s16 frameCount; - s32 ret = false; + s16 endFrame; + s32 didAnimChange = false; - if ((animIndex >= 0) && (animIndex < 18)) { - ret = true; - frameCount = sAnimationInfo[animIndex].frameCount; - if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + if ((animIndex > ENIN_ANIM_NONE) && (animIndex < ENIN_ANIM_MAX)) { + didAnimChange = true; + endFrame = sAnimationInfo[animIndex].frameCount; + if (endFrame < 0) { + endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, - sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].startFrame, endFrame, sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); } - return ret; + return didAnimChange; } s32 func_808F3178(EnIn* this, PlayState* play) { @@ -253,7 +252,7 @@ void func_808F3414(EnIn* this, PlayState* play) { } func_808F322C(this, 3); func_808F3178(this, play); - SubS_FillLimbRotTables(play, this->unk376, this->unk39E, ARRAY_COUNT(this->unk376)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, OBJECT_IN_LIMB_MAX); } void func_808F35AC(EnIn* this, PlayState* play) { @@ -299,28 +298,37 @@ void func_808F3690(EnIn* this, PlayState* play) { } void func_808F374C(EnIn* this, PlayState* play) { - AnimationHeader* sAnimations[] = { - &object_in_Anim_015E38, &object_in_Anim_016A60, &object_in_Anim_0177AC, &object_in_Anim_016484, - &object_in_Anim_0170DC, &object_in_Anim_018240, &object_in_Anim_0187C8, &object_in_Anim_0198A8, + AnimationHeader* sAnimations[ENIN_ANIM2_MAX] = { + &object_in_Anim_015E38, // ENIN_ANIM2_0 + &object_in_Anim_016A60, // ENIN_ANIM2_1 + &object_in_Anim_0177AC, // ENIN_ANIM2_2 + &object_in_Anim_016484, // ENIN_ANIM2_3 + &object_in_Anim_0170DC, // ENIN_ANIM2_4 + &object_in_Anim_018240, // ENIN_ANIM2_5 + &object_in_Anim_0187C8, // ENIN_ANIM2_6 + &object_in_Anim_0198A8, // ENIN_ANIM2_7 }; - if (this->skelAnime.animation == &object_in_Anim_016484 || this->skelAnime.animation == &object_in_Anim_0170DC) { + if ((this->skelAnime.animation == &object_in_Anim_016484) || + (this->skelAnime.animation == &object_in_Anim_0170DC)) { if (Animation_OnFrame(&this->skelAnime, 8.0f)) { - func_8019F88C(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2); + Audio_PlaySfx_Randomized(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2); if (Rand_ZeroOne() < 0.3f) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_INGO_HORSE_NEIGH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_IT_INGO_HORSE_NEIGH); } - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_LASH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_IT_LASH); } } - if (this->skelAnime.animation == &object_in_Anim_0198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) { + + if ((this->skelAnime.animation == &object_in_Anim_0198A8) && Animation_OnFrame(&this->skelAnime, 20.0f)) { Actor_PlaySfx(&this->actor, NA_SE_VO_IN_CRY_0); } + if (SkelAnime_Update(&this->skelAnime)) { - this->unk488 %= ARRAY_COUNT(sAnimations); - this->unk486 = this->unk488; - Animation_Change(&this->skelAnime, sAnimations[this->unk488], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[this->unk488]), ANIMMODE_ONCE, -10.0f); + this->animIndex2 %= ENIN_ANIM2_MAX; + this->unk486 = this->animIndex2; + Animation_Change(&this->skelAnime, sAnimations[this->animIndex2], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[this->animIndex2]), ANIMMODE_ONCE, -10.0f); } } @@ -345,7 +353,7 @@ void func_808F395C(EnIn* this, PlayState* play) { this->actionFunc = func_808F5A34; this->unk48C = 1; } else { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } } @@ -397,7 +405,7 @@ void func_808F3AD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -408,7 +416,7 @@ void func_808F3B40(EnIn* this, PlayState* play) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_808F3AD4; - textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4; + textId = (gSaveContext.save.day != 3) ? 0x3481 : 0x34A4; this->actor.textId = textId; } else { Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); @@ -421,7 +429,7 @@ void func_808F3BD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -445,7 +453,7 @@ void func_808F3CD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -479,10 +487,9 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { switch (arg2) { case 0: - if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || - (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (GET_PLAYER_FORM == PLAYER_FORM_GORON)) { textId = 0x345C; - } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { textId = 0x3460; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_15_08)) { textId = 0x3458; @@ -500,10 +507,9 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { break; case 3: - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { textId = 0x3485; - } else if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || - (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { + } else if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (GET_PLAYER_FORM == PLAYER_FORM_GORON)) { textId = 0x3484; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_04)) { textId = 0x346D; @@ -513,10 +519,9 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { break; case 4: - if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || - (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (GET_PLAYER_FORM == PLAYER_FORM_GORON)) { textId = 0x348A; - } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { textId = 0x348B; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_01)) { textId = 0x3486; @@ -536,10 +541,9 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { break; case 7: - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { textId = 0x34A8; - } else if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || - (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { + } else if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (GET_PLAYER_FORM == PLAYER_FORM_GORON)) { textId = 0x34A7; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_04)) { textId = 0x3495; @@ -597,7 +601,7 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) Actor* thisx = &this->actor; if (msgCtx->choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { Rupees_ChangeBy(-play->msgCtx.unk1206C); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { @@ -608,11 +612,11 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) Actor_ContinueText(play, thisx, 0x3475); } } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Actor_ContinueText(play, thisx, 0x3473); } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ContinueText(play, thisx, 0x3472); } return 0; @@ -623,7 +627,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, s32 fee = (play->msgCtx.unk1206C != 0xFFFF) ? play->msgCtx.unk1206C : 10; if (msgCtx->choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (gSaveContext.save.saveInfo.playerData.rupees >= fee) { Rupees_ChangeBy(-fee); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { @@ -640,7 +644,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, } } } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); if (arg4 != 0) { Actor_ContinueText(play, &this->actor, 0x3473); } else { @@ -648,7 +652,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, } } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ContinueText(play, &this->actor, 0x3472); } return 0; @@ -792,7 +796,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3466: if (msgCtx->choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; @@ -804,12 +808,12 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Actor_ContinueText(play, &this->actor, 0x3468); ret = false; } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ContinueText(play, &this->actor, 0x3467); ret = false; } @@ -875,7 +879,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3475: SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START); - func_800FD750(NA_BGM_HORSE); + Environment_ForcePlaySequence(NA_BGM_HORSE); play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; play->transitionTrigger = TRANS_TRIGGER_START; @@ -887,7 +891,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_808F4150(play, this, arg2, msgCtx); ret = false; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x3479); ret = false; @@ -963,6 +967,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x347E: func_808F35D8(this, play); if (Inventory_HasEmptyBottle()) { @@ -1094,7 +1099,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3490: if (msgCtx->choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; @@ -1106,12 +1111,12 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Actor_ContinueText(play, &this->actor, 0x3468); ret = false; } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ContinueText(play, &this->actor, 0x3491); ret = false; } @@ -1171,7 +1176,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3475: SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START); - func_800FD750(NA_BGM_HORSE); + Environment_ForcePlaySequence(NA_BGM_HORSE); play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1246,7 +1251,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_808F4270(play, this, arg2, msgCtx, 1); ret = false; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Actor_ContinueText(play, &this->actor, 0x349C); ret = false; } @@ -1333,7 +1338,6 @@ s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { s16 rotDiff; s16 yawDiff; - Player* player; if (*arg3 == 4) { return 0; @@ -1353,9 +1357,8 @@ s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { return 1; } if (*arg3 == 1) { - s32 requiredScopeTemp; + Player* player = GET_PLAYER(play); - player = GET_PLAYER(play); func_808F5994(this, play, &player->actor.world.pos, 0xC80); } else { rotDiff = this->actor.home.rot.y - this->actor.world.rot.y; @@ -1381,14 +1384,14 @@ s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { if (yawDiff >= 0x4300) { return 0; } - if (this->actor.xyzDistToPlayerSq > SQ(160.0f) && !this->actor.isTargeted) { + if (this->actor.xyzDistToPlayerSq > SQ(160.0f) && !this->actor.isLockedOn) { return 0; } if (this->actor.xyzDistToPlayerSq <= SQ(80.0f)) { - if (func_800B8614(&this->actor, play, 80.0f)) { + if (Actor_OfferTalk(&this->actor, play, 80.0f)) { this->actor.textId = func_808F3DD4(play, this, arg2); } - } else if (func_800B863C(&this->actor, play)) { + } else if (Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play)) { this->actor.textId = func_808F3DD4(play, this, arg2); } return 0; @@ -1437,7 +1440,7 @@ void func_808F5A94(EnIn* this, PlayState* play) { void func_808F5B58(EnIn* this, PlayState* play) { if (Horse_IsActive(play, &play->actorCtx)) { - if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || + if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) { if (gSaveContext.save.day == 3) { func_808F5728(play, this, 6, &this->unk48C); @@ -1445,8 +1448,8 @@ void func_808F5B58(EnIn* this, PlayState* play) { func_808F5728(play, this, 2, &this->unk48C); } } - } else if (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER || - (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) { + } else if ((Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER) || + ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) { if (gSaveContext.save.day == 3) { func_808F5728(play, this, 4, &this->unk48C); } else { @@ -1459,7 +1462,7 @@ void func_808F5C98(EnIn* this, PlayState* play) { if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_END) { this->actionFunc = func_808F5B58; } - if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || + if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) { if (gSaveContext.save.day != 3) { func_808F5728(play, this, 2, &this->unk48C); @@ -1491,7 +1494,8 @@ 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); + SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, + OBJECT_IN_LIMB_MAX); EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0); Collider_InitCylinder(play, &this->colliderCylinder); Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); @@ -1506,7 +1510,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { } if ((type == ENIN_HORSE_RIDER_YELLOW_SHIRT) || (type == ENIN_HORSE_RIDER_BLUE_SHIRT)) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - this->unk488 = 1; + this->animIndex2 = ENIN_ANIM2_1; Animation_Change(&this->skelAnime, &object_in_Anim_016A60, 1.0f, 0.0f, Animation_GetLastFrame(&object_in_Anim_016A60), ANIMMODE_ONCE, 0.0f); Actor_SetScale(&this->actor, 0.01f); @@ -1630,41 +1634,41 @@ void func_808F6334(EnIn* this, PlayState* play) { s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnIn* this = THIS; s32 pad; - Gfx* sp50[] = { - NULL, - NULL, - object_in_DL_0149A8, - object_in_DL_014AE0, - object_in_DL_014C30, - object_in_DL_0145D8, - object_in_DL_014710, - object_in_DL_014860, - object_in_DL_014420, - object_in_DL_012A78, - object_in_DL_013DE0, - object_in_DL_013F10, - object_in_DL_014040, - object_in_DL_0137A0, - object_in_DL_0138D0, - object_in_DL_013A00, - object_in_DL_012DF8, - object_in_DL_013670, - object_in_DL_013540, - object_in_DL_013440, + Gfx* sp50[OBJECT_IN_LIMB_MAX] = { + NULL, // OBJECT_IN_LIMB_NONE + NULL, // OBJECT_IN_LIMB_01 + object_in_DL_0149A8, // OBJECT_IN_LIMB_02 + object_in_DL_014AE0, // OBJECT_IN_LIMB_03 + object_in_DL_014C30, // OBJECT_IN_LIMB_04 + object_in_DL_0145D8, // OBJECT_IN_LIMB_05 + object_in_DL_014710, // OBJECT_IN_LIMB_06 + object_in_DL_014860, // OBJECT_IN_LIMB_07 + object_in_DL_014420, // OBJECT_IN_LIMB_08 + object_in_DL_012A78, // OBJECT_IN_LIMB_09 + object_in_DL_013DE0, // OBJECT_IN_LIMB_0A + object_in_DL_013F10, // OBJECT_IN_LIMB_0B + object_in_DL_014040, // OBJECT_IN_LIMB_0C + object_in_DL_0137A0, // OBJECT_IN_LIMB_0D + object_in_DL_0138D0, // OBJECT_IN_LIMB_0E + object_in_DL_013A00, // OBJECT_IN_LIMB_0F + object_in_DL_012DF8, // OBJECT_IN_LIMB_10 + object_in_DL_013670, // OBJECT_IN_LIMB_11 + object_in_DL_013540, // OBJECT_IN_LIMB_12 + object_in_DL_013440, // OBJECT_IN_LIMB_13 }; - if ((this->unk23C != 0) && (limbIndex != 16)) { + if ((this->unk23C != 0) && (limbIndex != OBJECT_IN_LIMB_10)) { if (sp50[limbIndex] != NULL) { *dList = sp50[limbIndex]; } } - if ((this->unk4AC & 4) && (limbIndex == 16)) { + if ((this->unk4AC & 4) && (limbIndex == OBJECT_IN_LIMB_10)) { *dList = object_in_DL_01C528; } OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == 16) { + if (limbIndex == OBJECT_IN_LIMB_10) { TexturePtr sp38[] = { object_in_Tex_0035E0, object_in_Tex_004820, object_in_Tex_004C20, object_in_Tex_0043E0 }; gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp38[this->unk482])); @@ -1675,31 +1679,34 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po CLOSE_DISPS(play->state.gfxCtx); - if (limbIndex == 16) { + if (limbIndex == OBJECT_IN_LIMB_10) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); func_808F6334(this, play); } - if (limbIndex == 9) { + + if (limbIndex == OBJECT_IN_LIMB_09) { Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY); Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY); } - if ((limbIndex == 9) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += (s16)(Math_SinS(this->unk376[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->unk39E[limbIndex]) * 200.0f); + + if ((limbIndex == OBJECT_IN_LIMB_09) || (limbIndex == OBJECT_IN_LIMB_0A) || (limbIndex == OBJECT_IN_LIMB_0D)) { + rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f); } + if (this->unk4AC & 0x40) { - if (limbIndex == 18) { + if (limbIndex == OBJECT_IN_LIMB_12) { rot->x = 0x1F40; rot->y = -0x3E8; rot->z = 0x1D4C; - } else if (limbIndex == 17) { + } else if (limbIndex == OBJECT_IN_LIMB_11) { rot->x = -0x1F40; rot->y = 0x3E8; rot->z = 0x1D4C; - } else if (limbIndex == 19) { + } else if (limbIndex == OBJECT_IN_LIMB_13) { rot->x = 0; rot->y = 0x7FFF; rot->z = -0x2328; @@ -1713,26 +1720,26 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp50 = { 1600.0f, 0.0f, 0.0f }; Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; - if (limbIndex == 16) { + if (limbIndex == OBJECT_IN_LIMB_10) { Matrix_MultVec3f(&sp50, &this->unk4B4); Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk4B4); } if (this->unk23D == 0) { Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); - if (limbIndex == 4) { + if (limbIndex == OBJECT_IN_LIMB_04) { Matrix_MultVec3f(&sp44, &this->unk248); } - if (limbIndex == 7) { + if (limbIndex == OBJECT_IN_LIMB_07) { Matrix_MultVec3f(&sp44, &this->unk254); } if (this->unk23C == 0) { if (!(this->unk4AC & 8)) { OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == 12) { + if (limbIndex == OBJECT_IN_LIMB_0C) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007A70); } - if (limbIndex == 15) { + if (limbIndex == OBJECT_IN_LIMB_0F) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } @@ -1743,7 +1750,7 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (this->unk4AC & 0x20) { OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == 12) { + if (limbIndex == OBJECT_IN_LIMB_0C) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } 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 6f4dd5d95..ab774606a 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -2,6 +2,7 @@ #define Z_EN_IN_H #include "global.h" +#include "assets/objects/object_in/object_in.h" struct EnIn; @@ -15,7 +16,13 @@ typedef enum { /* 4 */ ENIN_BLUE_SHIRT } EnInType; -typedef enum { +#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF) +#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE + +#define ENIN_PATH_INDEX_NONE 0x3F + +typedef enum EnInAnimation { + /* -1 */ ENIN_ANIM_NONE = -1, /* 0 */ ENIN_ANIM_0, /* 1 */ ENIN_ANIM_1, /* 2 */ ENIN_ANIM_2, @@ -33,13 +40,22 @@ typedef enum { /* 14 */ ENIN_ANIM_14, /* 15 */ ENIN_ANIM_15, /* 16 */ ENIN_ANIM_16, - /* 17 */ ENIN_ANIM_17 + /* 17 */ ENIN_ANIM_17, + /* 18 */ ENIN_ANIM_MAX } EnInAnimation; -#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF) -#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE - -#define ENIN_PATH_INDEX_NONE 0x3F +typedef enum EnInAnimation2 { + /* -1 */ ENIN_ANIM2_NONE = -1, + /* 0 */ ENIN_ANIM2_0, + /* 1 */ ENIN_ANIM2_1, + /* 2 */ ENIN_ANIM2_2, + /* 3 */ ENIN_ANIM2_3, + /* 4 */ ENIN_ANIM2_4, + /* 5 */ ENIN_ANIM2_5, + /* 6 */ ENIN_ANIM2_6, + /* 7 */ ENIN_ANIM2_7, + /* 8 */ ENIN_ANIM2_MAX +} EnInAnimation2; typedef struct EnIn { /* 0x000 */ Actor actor; @@ -57,19 +73,19 @@ typedef struct EnIn { /* 0x254 */ Vec3f unk254; /* 0x260 */ u8 unk260; /* 0x261 */ u8 unk261; - /* 0x262 */ Vec3s jointTable[20]; - /* 0x2DA */ Vec3s morphTable[20]; + /* 0x262 */ Vec3s jointTable[OBJECT_IN_LIMB_MAX]; + /* 0x2DA */ Vec3s morphTable[OBJECT_IN_LIMB_MAX]; /* 0x352 */ Vec3s trackTarget; /* 0x358 */ Vec3s headRot; /* 0x35E */ Vec3s torsoRot; /* 0x364 */ UNK_TYPE1 unk364[0x12]; - /* 0x376 */ s16 unk376[20]; - /* 0x39E */ s16 unk39E[20]; + /* 0x376 */ s16 fidgetTableY[OBJECT_IN_LIMB_MAX]; + /* 0x39E */ s16 fidgetTableZ[OBJECT_IN_LIMB_MAX]; /* 0x3C6 */ UNK_TYPE1 unk3C6[0xBC]; /* 0x482 */ s16 unk482; /* 0x484 */ s16 unk484; /* 0x486 */ s16 unk486; - /* 0x488 */ s16 unk488; + /* 0x488 */ s16 animIndex2; /* 0x48A */ u16 unk48A; /* 0x48C */ s32 unk48C; /* 0x490 */ UNK_TYPE1 unk490[0x4]; diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 6a51e9486..9d8667f0a 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -5,7 +5,6 @@ */ #include "z_en_insect.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0x00000000 @@ -132,7 +131,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play) { func_8091A8A0(this); SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable, - this->morphTable, 24); + this->morphTable, BUG_LIMB_MAX); Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); @@ -278,7 +277,9 @@ void func_8091B07C(EnInsect* this, PlayState* play) { yaw -= 0x2000; } + //! FAKE: if (play) {} + Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 0x7D0); } diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h index ea4025414..4fd2985f1 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -2,6 +2,7 @@ #define Z_EN_INSECT_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" struct EnInsect; @@ -9,13 +10,15 @@ typedef void (*EnInsectActionFunc)(struct EnInsect*, PlayState*); #define ENINSECT_GET_1(thisx) ((thisx)->params & 1) +#define ENINSECT_PARAMS(param) (param) + typedef struct EnInsect { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colliderElements[1]; /* 0x1A4 */ SkelAnime skelAnime; - /* 0x1E8 */ Vec3s jointTable[24]; - /* 0x278 */ Vec3s morphTable[24]; + /* 0x1E8 */ Vec3s jointTable[BUG_LIMB_MAX]; + /* 0x278 */ Vec3s morphTable[BUG_LIMB_MAX]; /* 0x308 */ EnInsectActionFunc actionFunc; /* 0x30C */ u16 unk_30C; /* 0x30E */ s16 unk_30E; diff --git a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c index 6a73eceec..8efc69c14 100644 --- a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c +++ b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c @@ -1,9 +1,21 @@ /* * File: z_en_invadepoh_demo.c * Overlay: ovl_En_Invadepoh_Demo - * Description: + * Description: Aliens cutscene actors + * + * This actor is responsible for handling the characters that appear in two cutscenes: + * 1. The cutscene where Romani introduces the aliens to the player. + * 2. The cutscene where the aliens abduct the cows and Romani from the barn. + * + * To be more specific, this actor has five variations: + * 1. An alien + * 2. Romani + * 3. A cow (minus the tail) + * 4. The UFO (which appears as a spinning ball of light) + * 5. A cow tail */ +#include "sys_cfb.h" #include "z_en_invadepoh_demo.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,14 +27,72 @@ void EnInvadepohDemo_Destroy(Actor* thisx, PlayState* play); void EnInvadepohDemo_Update(Actor* thisx, PlayState* play); void EnInvadepohDemo_Draw(Actor* thisx, PlayState* play); -void func_80C19AB4(EnInvadepohDemo* this, PlayState* play); -void func_80C19D00(EnInvadepohDemo* this, PlayState* play); -void func_80C19D48(EnInvadepohDemo* this, PlayState* play); -void func_80C19E04(EnInvadepohDemo* this, PlayState* play); -void func_80C19EC0(EnInvadepohDemo* this, PlayState* play); -void func_80C19F7C(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_DoNothing(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Alien_Init(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Romani_Init(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_Init(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Ufo_Init(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_CowTail_Init(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_Destroy(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_CowTail_Destroy(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Alien_Idle(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Alien_FollowPath(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Romani_Idle(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Romani_FollowPath(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_Idle(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_FollowPath(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Ufo_Idle(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Ufo_FollowPath(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_SelectCueAction(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_CowTail_Idle(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Alien_WaitForObject(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Romani_WaitForObject(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_WaitForObject(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_CowTail_WaitForObject(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Alien_Draw(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Romani_Draw(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Cow_Draw(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_Ufo_Draw(EnInvadepohDemo* this, PlayState* play); +void EnInvadepohDemo_CowTail_Draw(EnInvadepohDemo* this, PlayState* play); + +#define DRAW_FLAG_SHOULD_DRAW 1 +#define EN_INVADEPOH_DEMO_CUEID_NONE -1 + +typedef enum { + /* 0 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_DO_NOTHING, + /* 1 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_IDLE, + /* 2 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_1, + /* 3 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_2, + /* 4 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_3, + /* 5 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_4, + /* 6 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_5, // Doesn't seem to be actually used in the final game + /* 7 */ EN_INVADEPOH_DEMO_ALIEN_CUEID_MAX +} EnInvadepohDemoAlienCueId; + +typedef enum { + /* 0 */ EN_INVADEPOH_DEMO_ROMANI_CUEID_DO_NOTHING, + /* 1 */ EN_INVADEPOH_DEMO_ROMANI_CUEID_IDLE, + /* 2 */ EN_INVADEPOH_DEMO_ROMANI_CUEID_FOLLOW_PATH, + /* 3 */ EN_INVADEPOH_DEMO_ROMANI_CUEID_MAX +} EnInvadepohDemoRomaniCueId; + +typedef enum { + /* 0 */ EN_INVADEPOH_DEMO_COW_CUEID_DO_NOTHING, + /* 1 */ EN_INVADEPOH_DEMO_COW_CUEID_IDLE, + /* 2 */ EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_1, + /* 3 */ EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_2, + /* 4 */ EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_3, + /* 5 */ EN_INVADEPOH_DEMO_COW_CUEID_MAX +} EnInvadepohDemoCowCueId; + +typedef enum { + /* 0 */ EN_INVADEPOH_DEMO_UFO_CUEID_DO_NOTHING, + /* 1 */ EN_INVADEPOH_DEMO_UFO_CUEID_IDLE_1, + /* 2 */ EN_INVADEPOH_DEMO_UFO_CUEID_FOLLOW_PATH, + /* 3 */ EN_INVADEPOH_DEMO_UFO_CUEID_IDLE_2, // Doesn't seem to be actually used in the final game + /* 4 */ EN_INVADEPOH_DEMO_UFO_CUEID_MAX +} EnInvadepohDemoUfoCueId; -#if 0 ActorInit En_Invadepoh_Demo_InitVars = { ACTOR_EN_INVADEPOH_DEMO, ACTORCAT_PROP, @@ -35,134 +105,710 @@ ActorInit En_Invadepoh_Demo_InitVars = { (ActorFunc)EnInvadepohDemo_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1AA74[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_CONTINUE), +static s32 sCueTypes[EN_INVADEPOH_DEMO_TYPE_MAX] = { + CS_CMD_ACTOR_CUE_553, // EN_INVADEPOH_DEMO_TYPE_ALIEN + CS_CMD_ACTOR_CUE_554, // EN_INVADEPOH_DEMO_TYPE_ROMANI + CS_CMD_ACTOR_CUE_563, // EN_INVADEPOH_DEMO_TYPE_COW + CS_CMD_ACTOR_CUE_555, // EN_INVADEPOH_DEMO_TYPE_UFO + CS_CAM_STOP, // EN_INVADEPOH_DEMO_TYPE_COW_TAIL +}; + +static InitChainEntry sAlienInitChain[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1AA88[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), +static InitChainEntry sRomaniInitChain[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1AAA0[] = { +static InitChainEntry sCowInitChain[] = { ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1AAB0[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), - ICHAIN_VEC3S(shape.rot, 0, ICHAIN_CONTINUE), - ICHAIN_F32(terminalVelocity, -100, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 800, ICHAIN_STOP), +static InitChainEntry sUfoInitChain[] = { + ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_CONTINUE), + ICHAIN_F32(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 800, ICHAIN_STOP), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1AAC8[] = { +static InitChainEntry sCowTailInitChain[] = { ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -#endif +static EnInvadepohDemoFunc sInitFuncs[EN_INVADEPOH_DEMO_TYPE_MAX] = { + EnInvadepohDemo_Alien_Init, // EN_INVADEPOH_DEMO_TYPE_ALIEN + EnInvadepohDemo_Romani_Init, // EN_INVADEPOH_DEMO_TYPE_ROMANI + EnInvadepohDemo_Cow_Init, // EN_INVADEPOH_DEMO_TYPE_COW + EnInvadepohDemo_Ufo_Init, // EN_INVADEPOH_DEMO_TYPE_UFO + EnInvadepohDemo_CowTail_Init, // EN_INVADEPOH_DEMO_TYPE_COW_TAIL +}; -extern InitChainEntry D_80C1AA74[]; -extern InitChainEntry D_80C1AA88[]; -extern InitChainEntry D_80C1AAA0[]; -extern InitChainEntry D_80C1AAB0[]; -extern InitChainEntry D_80C1AAC8[]; +static EnInvadepohDemoFunc sDestroyFuncs[EN_INVADEPOH_DEMO_TYPE_MAX] = { + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_TYPE_ALIEN + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_TYPE_ROMANI + EnInvadepohDemo_Cow_Destroy, // EN_INVADEPOH_DEMO_TYPE_COW + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_TYPE_UFO + EnInvadepohDemo_CowTail_Destroy, // EN_INVADEPOH_DEMO_TYPE_COW_TAIL +}; -extern UNK_TYPE D_06000560; -extern UNK_TYPE D_06001D80; -extern UNK_TYPE D_06004264; -extern UNK_TYPE D_06004E98; -extern UNK_TYPE D_06011FC8; -extern UNK_TYPE D_06016588; +static EnInvadepohDemoFunc sAlienCueActionCsFuncs[EN_INVADEPOH_DEMO_ALIEN_CUEID_MAX] = { + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_ALIEN_CUEID_DO_NOTHING + EnInvadepohDemo_Alien_Idle, // EN_INVADEPOH_DEMO_ALIEN_CUEID_IDLE + EnInvadepohDemo_Alien_FollowPath, // EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_1 + EnInvadepohDemo_Alien_FollowPath, // EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_2 + EnInvadepohDemo_Alien_FollowPath, // EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_3 + EnInvadepohDemo_Alien_FollowPath, // EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_4 + EnInvadepohDemo_Alien_FollowPath, // EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_5 +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C192A0.s") +static EnInvadepohDemoFunc sRomaniCueActionCsFuncs[EN_INVADEPOH_DEMO_ROMANI_CUEID_MAX] = { + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_ROMANI_CUEID_DO_NOTHING + EnInvadepohDemo_Romani_Idle, // EN_INVADEPOH_DEMO_ROMANI_CUEID_IDLE + EnInvadepohDemo_Romani_FollowPath, // EN_INVADEPOH_DEMO_ROMANI_CUEID_FOLLOW_PATH +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C192B0.s") +static EnInvadepohDemoFunc sCowCueActionCsFuncs[EN_INVADEPOH_DEMO_COW_CUEID_MAX] = { + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_COW_CUEID_DO_NOTHING + EnInvadepohDemo_Cow_Idle, // EN_INVADEPOH_DEMO_COW_CUEID_IDLE + EnInvadepohDemo_Cow_FollowPath, // EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_1 + EnInvadepohDemo_Cow_FollowPath, // EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_2 + EnInvadepohDemo_Cow_FollowPath, // EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_3 +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19334.s") +static EnInvadepohDemoFunc sUfoCueActionCsFuncs[EN_INVADEPOH_DEMO_UFO_CUEID_MAX] = { + EnInvadepohDemo_DoNothing, // EN_INVADEPOH_DEMO_UFO_CUEID_DO_NOTHING + EnInvadepohDemo_Ufo_Idle, // EN_INVADEPOH_DEMO_UFO_CUEID_IDLE_1 + EnInvadepohDemo_Ufo_FollowPath, // EN_INVADEPOH_DEMO_UFO_CUEID_FOLLOW_PATH + EnInvadepohDemo_Ufo_Idle, // EN_INVADEPOH_DEMO_UFO_CUEID_IDLE_2 +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C193A8.s") +static EnInvadepohDemoFunc sDrawFuncs[EN_INVADEPOH_DEMO_TYPE_MAX] = { + EnInvadepohDemo_Alien_Draw, // EN_INVADEPOH_DEMO_TYPE_ALIEN + EnInvadepohDemo_Romani_Draw, // EN_INVADEPOH_DEMO_TYPE_ROMANI + EnInvadepohDemo_Cow_Draw, // EN_INVADEPOH_DEMO_TYPE_COW + EnInvadepohDemo_Ufo_Draw, // EN_INVADEPOH_DEMO_TYPE_UFO + EnInvadepohDemo_CowTail_Draw, // EN_INVADEPOH_DEMO_TYPE_COW_TAIL +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19454.s") +MtxF sAlienLeftEyeBeamMtxF; +MtxF sAlienRightEyeBeamMtxF; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19498.s") +void EnInvadepohDemo_DoNothing(EnInvadepohDemo* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1950C.s") +void EnInvadepohDemo_Alien_Init(EnInvadepohDemo* this, PlayState* play) { + Actor_ProcessInitChain(&this->actor, sAlienInitChain); + this->actor.flags = ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000; + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_UCH); + if (this->objectSlot <= OBJECT_SLOT_NONE) { + Actor_Kill(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19548.s") + this->actionFunc = EnInvadepohDemo_Alien_WaitForObject; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19564.s") +void EnInvadepohDemo_Romani_Init(EnInvadepohDemo* this, PlayState* play) { + Actor_ProcessInitChain(&this->actor, sRomaniInitChain); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MA1); + if (this->objectSlot <= OBJECT_SLOT_NONE) { + Actor_Kill(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19590.s") + this->actionFunc = EnInvadepohDemo_Romani_WaitForObject; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1965C.s") +void EnInvadepohDemo_Cow_Init(EnInvadepohDemo* this, PlayState* play) { + Actor_ProcessInitChain(&this->actor, sCowInitChain); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH_DEMO, 0.0f, 0.0f, 0.0f, 0, 0, 0, + EN_INVADEPOH_DEMO_TYPE_COW_TAIL); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_COW); + if (this->objectSlot <= OBJECT_SLOT_NONE) { + Actor_Kill(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19688.s") + this->actionFunc = EnInvadepohDemo_Cow_WaitForObject; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19754.s") +void EnInvadepohDemo_Ufo_Init(EnInvadepohDemo* this, PlayState* play) { + Actor_ProcessInitChain(&this->actor, sUfoInitChain); + this->actionFunc = EnInvadepohDemo_SelectCueAction; + this->drawFlags |= DRAW_FLAG_SHOULD_DRAW; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1985C.s") +void EnInvadepohDemo_CowTail_Init(EnInvadepohDemo* this, PlayState* play) { + Actor_ProcessInitChain(&this->actor, sCowTailInitChain); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_COW); + if (this->objectSlot <= OBJECT_SLOT_NONE) { + Actor_Kill(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1987C.s") + this->actionFunc = EnInvadepohDemo_CowTail_WaitForObject; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C199BC.s") +void EnInvadepohDemo_Cow_Destroy(EnInvadepohDemo* this, PlayState* play) { + Actor* thisx = &this->actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C199EC.s") + if (thisx->child != NULL) { + thisx->child->parent = NULL; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19AB4.s") + Actor_Kill(thisx->child); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19D00.s") +void EnInvadepohDemo_CowTail_Destroy(EnInvadepohDemo* this, PlayState* play) { + if (this->actor.parent != NULL) { + this->actor.parent->child = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19D48.s") +void EnInvadepohDemo_Alien_Idle(EnInvadepohDemo* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19E04.s") +void EnInvadepohDemo_Alien_FollowPath(EnInvadepohDemo* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s32 pathCount = path->count; + Vec3s* points = Lib_SegmentedToVirtual(path->points); + Vec3f point; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19EC0.s") + if (pathCount != 0) { + Math_Vec3s_ToVec3f(&point, &points[this->pointIndex]); + if (Math_Vec3f_StepTo(&this->actor.world.pos, &point, this->speed) < this->speed) { + this->pointIndex++; + if (this->pointIndex >= pathCount) { + Actor_Kill(&this->actor); + } + } else { + SkelAnime_Update(&this->skelAnime); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C19F7C.s") +void EnInvadepohDemo_Romani_Idle(EnInvadepohDemo* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A038.s") +void EnInvadepohDemo_Romani_FollowPath(EnInvadepohDemo* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s32 pathCount = path->count; + Vec3s* points = Lib_SegmentedToVirtual(path->points); + Vec3f point; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A070.s") + if (pathCount != 0) { + Math_Vec3s_ToVec3f(&point, &points[this->pointIndex]); + if (Math_Vec3f_StepTo(&this->actor.world.pos, &point, this->speed) < this->speed) { + this->pointIndex++; + if (this->pointIndex >= pathCount) { + Actor_Kill(&this->actor); + } + } else { + SkelAnime_Update(&this->skelAnime); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A168.s") +/** + * Positions the cow tail actor at the appropriate spot on the cow's body and rotates it to + * match the cow's rotation. This function is also responsible for playing the cow's animation. + */ +void EnInvadepohDemo_Cow_UpdateCommon(EnInvadepohDemo* this, PlayState* play) { + s32 pad; + MtxF mtx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A244.s") + if (this->actor.child != NULL) { + Matrix_Push(); + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + &this->actor.shape.rot); + Matrix_Translate(0.0f, 57.0f, -36.0f, MTXMODE_APPLY); + Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); + Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); + Matrix_MultZero(&this->actor.child->world.pos); + Matrix_Get(&mtx); + Matrix_MtxFToYXZRot(&mtx, &this->actor.child->shape.rot, false); + Matrix_Pop(); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A590.s") + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A650.s") +void EnInvadepohDemo_Cow_Idle(EnInvadepohDemo* this, PlayState* play) { + EnInvadepohDemo_Cow_UpdateCommon(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A670.s") +void EnInvadepohDemo_Cow_FollowPath(EnInvadepohDemo* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s32 pathCount = path->count; + Vec3s* points = Lib_SegmentedToVirtual(path->points); + Vec3f point; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A6C8.s") + if (pathCount != 0) { + if (((this->cueId == EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_1) && (play->csCtx.curFrame == 343)) || + ((this->cueId == EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_2) && (play->csCtx.curFrame == 421)) || + ((this->cueId == EN_INVADEPOH_DEMO_COW_CUEID_FOLLOW_PATH_3) && (play->csCtx.curFrame == 521))) { + Actor_PlaySfx(&this->actor, NA_SE_EV_COW_CRY); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/func_80C1A854.s") + Math_Vec3s_ToVec3f(&point, &points[this->pointIndex]); + if (Math_Vec3f_StepTo(&this->actor.world.pos, &point, this->speed) < this->speed) { + this->pointIndex++; + if (this->pointIndex >= pathCount) { + Actor_Kill(&this->actor); + } + } else { + EnInvadepohDemo_Cow_UpdateCommon(this, play); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/EnInvadepohDemo_Init.s") +void EnInvadepohDemo_Ufo_Idle(EnInvadepohDemo* this, PlayState* play) { + this->ufoRotZ += 0x258; + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_UFO_FLY - SFX_FLAG); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/EnInvadepohDemo_Destroy.s") +void EnInvadepohDemo_Ufo_FollowPath(EnInvadepohDemo* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s32 pathCount = path->count; + Vec3s* points = Lib_SegmentedToVirtual(path->points); + Vec3f point; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/EnInvadepohDemo_Update.s") + if (pathCount != 0) { + this->ufoRotZ += 0x258; + Math_Vec3s_ToVec3f(&point, &points[this->pointIndex]); + if (Math_Vec3f_StepTo(&this->actor.world.pos, &point, this->speed) < this->speed) { + this->pointIndex++; + if (this->pointIndex >= pathCount) { + Actor_Kill(&this->actor); + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh_Demo/EnInvadepohDemo_Draw.s") +/** + * Updates the actor's cue ID if certain conditions are met and calls a function based + * on their current cue ID. Specifically, cows and aliens offset the cue ID from their + * cue channel (which applies to *all* aliens/cows, not just this specific actor), then + * they compare this offset value to a value read from their params. If these two values + * match, the actor's cue ID is updated. + * + * The distinction between a "global" cue ID from the cue channel and a "local" cue ID + * specific to an instance of this actor is used to prevent all the cows or aliens from + * moving along the path at once. The cow or alien waits in a stationary "idle" state + * until the "global" cue ID changes to a specific value; if the cue ID offset matches + * what this actor specifies in its params, then that acts like a signal to tell the + * actor to update the "local" cue ID and start moving. The other cows or aliens in + * the scene should have different params, meaning the cue ID offset will not match; + * they will thus ignore this "global" cue ID change and remain idle. + */ +void EnInvadepohDemo_SelectCueAction(EnInvadepohDemo* this, PlayState* play) { + CsCmdActorCue* cue; + s32 cueIdOffset; + + if (Cutscene_IsCueInChannel(play, sCueTypes[this->type])) { + this->cueChannel = Cutscene_GetCueChannel(play, sCueTypes[this->type]); + cue = play->csCtx.actorCues[this->cueChannel]; + + switch (this->type) { + case EN_INVADEPOH_DEMO_TYPE_UFO: + if (this->cueId != cue->id) { + if (cue->id == EN_INVADEPOH_DEMO_UFO_CUEID_FOLLOW_PATH) { + Actor_PlaySfx(&this->actor, NA_SE_EV_UFO_DASH); + } + + this->cueId = cue->id; + } + break; + + case EN_INVADEPOH_DEMO_TYPE_ROMANI: + if (this->cueId != cue->id) { + this->cueId = cue->id; + } + break; + + case EN_INVADEPOH_DEMO_TYPE_ALIEN: + if (cue->id > EN_INVADEPOH_DEMO_ALIEN_CUEID_IDLE) { + cueIdOffset = cue->id - EN_INVADEPOH_DEMO_ALIEN_CUEID_FOLLOW_PATH_1; + if (this->cueIdOffset != cueIdOffset) { + break; + } + } + + if (this->cueId != cue->id) { + this->cueId = cue->id; + } + break; + + case EN_INVADEPOH_DEMO_TYPE_COW: + if (cue->id > EN_INVADEPOH_DEMO_COW_CUEID_IDLE) { + cueIdOffset = cue->id - EN_INVADEPOH_DEMO_COW_CUEID_IDLE; + if (this->cueIdOffset != cueIdOffset) { + break; + } + } + + if (this->cueId != cue->id) { + this->cueId = cue->id; + } + break; + + default: + break; + } + + switch (this->type) { + case EN_INVADEPOH_DEMO_TYPE_UFO: + sUfoCueActionCsFuncs[this->cueId](this, play); + break; + + case EN_INVADEPOH_DEMO_TYPE_ALIEN: + sAlienCueActionCsFuncs[this->cueId](this, play); + break; + + case EN_INVADEPOH_DEMO_TYPE_ROMANI: + sRomaniCueActionCsFuncs[this->cueId](this, play); + break; + + case EN_INVADEPOH_DEMO_TYPE_COW: + sCowCueActionCsFuncs[this->cueId](this, play); + break; + + default: + break; + } + } +} + +void EnInvadepohDemo_CowTail_Idle(EnInvadepohDemo* this, PlayState* play) { + if (this->actor.parent == NULL) { + Actor_Kill(&this->actor); + return; + } + + SkelAnime_Update(&this->skelAnime); +} + +void EnInvadepohDemo_Alien_WaitForObject(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; + Actor_SetObjectDependency(play, &this->actor); + this->drawFlags |= DRAW_FLAG_SHOULD_DRAW; + this->actionFunc = EnInvadepohDemo_SelectCueAction; + SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, + ALIEN_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gAlienFloatAnim); + } +} + +void EnInvadepohDemo_Romani_WaitForObject(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; + Actor_SetObjectDependency(play, &this->actor); + this->drawFlags |= DRAW_FLAG_SHOULD_DRAW; + this->actionFunc = EnInvadepohDemo_SelectCueAction; + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniAbductedAnim, this->jointTable, + this->morphTable, ROMANI_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gRomaniAbductedAnim); + } +} + +void EnInvadepohDemo_Cow_WaitForObject(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; + Actor_SetObjectDependency(play, &this->actor); + this->drawFlags |= DRAW_FLAG_SHOULD_DRAW; + this->actionFunc = EnInvadepohDemo_SelectCueAction; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, &gCowMooAnim, this->jointTable, this->morphTable, + COW_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); + } +} + +void EnInvadepohDemo_CowTail_WaitForObject(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; + Actor_SetObjectDependency(play, &this->actor); + this->drawFlags |= DRAW_FLAG_SHOULD_DRAW; + this->actionFunc = EnInvadepohDemo_CowTail_Idle; + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, &gCowTailSwishAnim, this->jointTable, + this->morphTable, COW_TAIL_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); + } +} + +void EnInvadepohDemo_Ufo_UpdateMatrixTranslation(Vec3f* translation) { + MtxF* currentMatrix = Matrix_GetCurrent(); + + currentMatrix->xw = translation->x; + currentMatrix->yw = translation->y; + currentMatrix->zw = translation->z; +} + +s32 EnInvadepohDemo_Ufo_ShouldDrawLensFlare(PlayState* play, Vec3f* pos) { + Vec3f projectedPos; + f32 invW; + + Actor_GetProjectedPos(play, pos, &projectedPos, &invW); + if ((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f) && (fabsf(projectedPos.y * invW) < 1.0f)) { + f32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + f32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; + + if (wZ < SysCfb_GetZBufferInt(screenPosX, screenPosY)) { + return true; + } + } + + return false; +} + +void EnInvadepohDemo_Alien_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + if (limbIndex == ALIEN_LIMB_LEFT_EYE) { + Matrix_Push(); + Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); + Matrix_RotateYS(-0x3830, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + Matrix_Get(&sAlienLeftEyeBeamMtxF); + Matrix_Pop(); + } else if (limbIndex == ALIEN_LIMB_RIGHT_EYE) { + Matrix_Push(); + Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); + Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); + Matrix_Get(&sAlienRightEyeBeamMtxF); + Matrix_Pop(); + } +} + +void EnInvadepohDemo_Alien_Draw(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + Mtx* mtx; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Xlu(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + Matrix_Push(); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gAlienEmptyTexAnim)); + Scene_SetRenderModeXlu(play, 0, 1); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnInvadepohDemo_Alien_PostLimbDraw, &this->actor, POLY_OPA_DISP); + + // In EnInvadepoh, the eye beam alpha is controlled by an instance variable, and there is an if-block that checks + // to see if this variable is not zero. In this actor, the eye beam alpha is hardcoded, but this block is still + // necessary to prevent reordering; this is likely a result of copy-pasting from EnInvadepoh. + if (true) { + Gfx* gfx; + + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gAlienEyeBeamTexAnim)); + + OPEN_DISPS(play->state.gfxCtx); + + gfx = POLY_XLU_DISP; + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0xFF, 240, 180, 100, 60); + gDPSetEnvColor(gfx++, 255, 255, 255, 150); + Matrix_Mult(&sAlienLeftEyeBeamMtxF, MTXMODE_NEW); + + mtx = Matrix_NewMtx(play->state.gfxCtx); + + if (mtx != NULL) { + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, gAlienEyeBeamDL); + Matrix_Mult(&sAlienRightEyeBeamMtxF, MTXMODE_NEW); + + mtx = Matrix_NewMtx(play->state.gfxCtx); + + if (mtx != NULL) { + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, gAlienEyeBeamDL); + POLY_XLU_DISP = gfx; + } + } + + CLOSE_DISPS(play->state.gfxCtx); + } + + CLOSE_DISPS(play->state.gfxCtx); + + // In EnInvadepoh, the code to draw the light flash checks an instance variable which is set to true if the actor + // should draw. In this actor, an equivalent variable is checked in EnInvadepohDemo_Draw, so it isn't checked here. + // However, this block is still necessary to prevent reordering; this is likely a result of copy-pasting from + // EnInvadepoh. Similarly, this function requires a lot of extra stack space for unused variables; the names and + // types of these variables are inferred from EnInvadepoh's version of this code. + if (true) { + Gfx* gfx; + Vec3f glowOffset; + Vec3f glowPos; // unused, inferred from EnInvadepoh + s32 glowAlpha; // unused, inferred from EnInvadepoh + + OPEN_DISPS(play->state.gfxCtx); + + gfx = POLY_XLU_DISP; + gfx = Gfx_SetupDL20_NoCD(gfx); + + gDPSetDither(gfx++, G_CD_NOISE); + gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, + 0); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); + Matrix_MultVecZ(90.0f, &glowOffset); + Matrix_Translate(this->actor.world.pos.x + glowOffset.x, this->actor.world.pos.y + glowOffset.y + 25.0f, + this->actor.world.pos.z + glowOffset.z, MTXMODE_NEW); + Matrix_Scale(0.15f, 0.15f, 0.15f, MTXMODE_APPLY); + gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); + gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, 100); + + mtx = Matrix_NewMtx(play->state.gfxCtx); + + if (mtx != NULL) { + gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); + POLY_XLU_DISP = gfx; + } + + CLOSE_DISPS(play->state.gfxCtx); + } + + Matrix_Pop(); +} + +void EnInvadepohDemo_Romani_Draw(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Opa(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&gRomaniEyeSadTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(&gRomaniMouthHangingOpenTex)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnInvadepohDemo_Cow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + if (limbIndex == COW_LIMB_NOSE_RING) { + *dList = NULL; + } + + return false; +} + +void EnInvadepohDemo_Cow_Draw(EnInvadepohDemo* this, PlayState* play) { + Gfx_SetupDL37_Opa(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnInvadepohDemo_Cow_OverrideLimbDraw, NULL, &this->actor); +} + +void EnInvadepohDemo_Ufo_Draw(EnInvadepohDemo* this, PlayState* play) { + s32 pad[2]; + Vec3f flashPos = gZeroVec3f; + Mtx* mtx; + + flashPos.x = this->actor.world.pos.x; + flashPos.y = this->actor.world.pos.y; + flashPos.z = this->actor.world.pos.z; + EnInvadepohDemo_Ufo_UpdateMatrixTranslation(&flashPos); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateZS(this->ufoRotZ, MTXMODE_APPLY); + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Xlu(play->state.gfxCtx); + mtx = Matrix_NewMtx(play->state.gfxCtx); + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); + gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); + } + + CLOSE_DISPS(play->state.gfxCtx); + + if (EnInvadepohDemo_Ufo_ShouldDrawLensFlare(play, &flashPos)) { + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, flashPos, 20.0f, 9.0f, 0, 0); + } +} + +void EnInvadepohDemo_CowTail_Draw(EnInvadepohDemo* this, PlayState* play) { + Gfx_SetupDL37_Opa(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); +} + +void EnInvadepohDemo_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnInvadepohDemo* this = THIS; + + this->cueIdOffset = EN_INVADEPOH_DEMO_GET_CUEID_OFFSET(&this->actor); + this->type = EN_INVADEPOH_DEMO_GET_TYPE(&this->actor); + if ((this->type < EN_INVADEPOH_DEMO_TYPE_ALIEN) || (this->type > EN_INVADEPOH_DEMO_TYPE_COW_TAIL)) { + Actor_Kill(&this->actor); + return; + } + + if (this->type == EN_INVADEPOH_DEMO_TYPE_UFO) { + this->actor.world.rot.z = 0; + this->speed = EN_INVADEPOH_DEMO_GET_SPEED(&this->actor); + this->actor.shape.rot.z = this->actor.world.rot.z; + } else { + this->actor.world.rot.z = 0; + this->speed = EN_INVADEPOH_DEMO_GET_SPEED(&this->actor) / 10.0f; + this->actor.shape.rot.z = this->actor.world.rot.z; + } + + this->drawFlags = 0; + this->cueId = EN_INVADEPOH_DEMO_CUEID_NONE; + this->ufoRotZ = 0; + this->pathIndex = EN_INVADEPOH_DEMO_GET_PATH_INDEX(&this->actor); + this->pointIndex = 0; + this->objectSlot = OBJECT_SLOT_NONE; + sInitFuncs[this->type](this, play); +} + +void EnInvadepohDemo_Destroy(Actor* thisx, PlayState* play) { + s32 pad; + EnInvadepohDemo* this = THIS; + + sDestroyFuncs[this->type](this, play); +} + +void EnInvadepohDemo_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnInvadepohDemo* this = THIS; + + this->actionFunc(this, play); +} + +void EnInvadepohDemo_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnInvadepohDemo* this = THIS; + + if ((this->cueId != EN_INVADEPOH_DEMO_CUEID_NONE) && (this->drawFlags & DRAW_FLAG_SHOULD_DRAW)) { + sDrawFuncs[this->type](this, play); + } +} diff --git a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h index ff13ca668..92e35b39f 100644 --- a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h +++ b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h @@ -2,15 +2,54 @@ #define Z_EN_INVADEPOH_DEMO_H #include "global.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_cow/object_cow.h" +#include "assets/objects/object_ma1/object_ma1.h" +#include "assets/objects/object_uch/object_uch.h" + +typedef enum { + /* 0 */ EN_INVADEPOH_DEMO_TYPE_ALIEN, + /* 1 */ EN_INVADEPOH_DEMO_TYPE_ROMANI, + /* 2 */ EN_INVADEPOH_DEMO_TYPE_COW, + /* 3 */ EN_INVADEPOH_DEMO_TYPE_UFO, + /* 4 */ EN_INVADEPOH_DEMO_TYPE_COW_TAIL, + /* 5 */ EN_INVADEPOH_DEMO_TYPE_MAX +} EnInvadepohDemoType; + +#define EN_INVADEPOH_DEMO_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define EN_INVADEPOH_DEMO_GET_CUEID_OFFSET(thisx) (((thisx)->params >> 11) & 0x7) +#define EN_INVADEPOH_DEMO_GET_PATH_INDEX(thisx) (((thisx)->params >> 4) & 0x7F) +#define EN_INVADEPOH_DEMO_GET_SPEED(thisx) ((thisx)->shape.rot.z) struct EnInvadepohDemo; typedef void (*EnInvadepohDemoActionFunc)(struct EnInvadepohDemo*, PlayState*); +// This actor has multiple arrays of function pointers which are used for things like +// Init, Destroy, Draw, and something similar to an Update function. Some of these +// functions do not have any stack space for a recast temp, which means that they must +// take an EnInvadepohDemo pointer, not an Actor pointer. In other words, these +// functions are not ActorFuncs. This typedef is used for these arrays of function +// pointers to better distinguish them from "actual" action functions, even if they +// have the exact same signature. +typedef void (*EnInvadepohDemoFunc)(struct EnInvadepohDemo*, PlayState*); + typedef struct EnInvadepohDemo { /* 0x000 */ Actor actor; /* 0x144 */ EnInvadepohDemoActionFunc actionFunc; - /* 0x148 */ char unk_148[0x180]; + /* 0x148 */ s32 type; // "type" + /* 0x14C */ f32 speed; + /* 0x150 */ s32 cueChannel; + /* 0x154 */ s32 cueId; // "demo_mode" + /* 0x158 */ s32 pathIndex; + /* 0x15C */ s32 pointIndex; + /* 0x160 */ s32 objectSlot; + /* 0x164 */ s32 drawFlags; // Only has one flag to control whether or not to draw + /* 0x168 */ s32 cueIdOffset; + /* 0x16C */ s16 ufoRotZ; + /* 0x170 */ SkelAnime skelAnime; + /* 0x1B4 */ Vec3s jointTable[ROMANI_LIMB_MAX]; + /* 0x23E */ Vec3s morphTable[ROMANI_LIMB_MAX]; } EnInvadepohDemo; // size = 0x2C8 #endif // Z_EN_INVADEPOH_DEMO_H diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c index d2aceba29..dcecdac43 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c @@ -62,23 +62,26 @@ void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { switch (INVISIBLERUPPE_GET_3(&this->actor)) { case 0: - play_sound(NA_SE_SY_GET_RUPY); + Audio_PlaySfx(NA_SE_SY_GET_RUPY); Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN); break; case 1: - play_sound(NA_SE_SY_GET_RUPY); + Audio_PlaySfx(NA_SE_SY_GET_RUPY); Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_BLUE); break; case 2: - play_sound(NA_SE_SY_GET_RUPY); + Audio_PlaySfx(NA_SE_SY_GET_RUPY); Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED); break; + + default: + break; } - if (this->unk_190 >= 0) { - Flags_SetSwitch(play, this->unk_190); + if (this->switchFlag >= 0) { + Flags_SetSwitch(play, this->switchFlag); } this->actionFunc = func_80C259E8; @@ -93,13 +96,13 @@ void EnInvisibleRuppe_Init(Actor* thisx, PlayState* play) { s32 pad; EnInvisibleRuppe* this = THIS; - this->unk_190 = INVISIBLERUPPE_GET_1FC(&this->actor); + this->switchFlag = INVISIBLERUPPE_GET_SWITCH_FLAG(&this->actor); - if (this->unk_190 == 0x7F) { - this->unk_190 = -1; + if (this->switchFlag == 0x7F) { + this->switchFlag = -1; } - if ((this->unk_190 >= 0) && Flags_GetSwitch(play, this->unk_190)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h index d703a3511..2257a649a 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h @@ -8,12 +8,12 @@ struct EnInvisibleRuppe; typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, PlayState*); #define INVISIBLERUPPE_GET_3(thisx) ((thisx)->params & 3) -#define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->params & 0x1FC) >> 2) +#define INVISIBLERUPPE_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x1FC) >> 2) typedef struct EnInvisibleRuppe { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; - /* 0x190 */ s16 unk_190; + /* 0x190 */ s16 switchFlag; /* 0x192 */ s16 unk_192; /* 0x194 */ EnInvisibleRuppeActionFunc actionFunc; } EnInvisibleRuppe; // size = 0x198 diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index da813182e..44967e4bd 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -10,6 +10,7 @@ #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_ishi/object_ishi.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000) @@ -70,7 +71,7 @@ static EnIshiUnkFunc2 D_8095F6D8[] = { func_8095D804, func_8095DABC }; static EnIshiUnkFunc D_8095F6E0[] = { func_8095DDA8, func_8095DE9C }; -static s16 D_8095F6E8[] = { GAMEPLAY_FIELD_KEEP, OBJECT_ISHI }; +static s16 sObjectIds[] = { GAMEPLAY_FIELD_KEEP, OBJECT_ISHI }; static ColliderCylinderInit sCylinderInit[] = { { @@ -172,7 +173,7 @@ s32 func_8095D758(EnIshi* this, PlayState* play, f32 arg2) { void func_8095D804(Actor* thisx, PlayState* play) { EnIshi* this = THIS; s32 i; - s16 temp; + s16 objectId; Gfx* phi_s4; Vec3f spC4; Vec3f spB8; @@ -180,10 +181,10 @@ void func_8095D804(Actor* thisx, PlayState* play) { if (!ENISHI_GET_8(&this->actor)) { phi_s4 = gameplay_field_keep_DL_0066B0; } else { - phi_s4 = object_ishi_DL_0009B0; + phi_s4 = gSmallRockDL; } - temp = D_8095F6E8[ENISHI_GET_8(&this->actor)]; + objectId = sObjectIds[ENISHI_GET_8(&this->actor)]; for (i = 0; i < ARRAY_COUNT(D_8095F74C); i++) { spB8.x = ((Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.world.pos.x; @@ -206,7 +207,7 @@ void func_8095D804(Actor* thisx, PlayState* play) { spC4.z += (Rand_ZeroOne() - 0.5f) * 11.0f; EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -420, ((s32)Rand_Next() > 0) ? 65 : 33, 30, 5, 0, D_8095F74C[i], - 3, 10, 40, -1, temp, phi_s4); + 3, 10, 40, -1, objectId, phi_s4); } } @@ -309,7 +310,7 @@ void func_8095DFF0(EnIshi* this, PlayState* play) { s16 temp_v1_2; if (temp >= 0) { - sp3C = Item_DropCollectible(play, &this->actor.world.pos, temp | (ENISHI_GET_FE00(&this->actor) << 8)); + sp3C = Item_DropCollectible(play, &this->actor.world.pos, temp | (ENISHI_GET_FLAG(&this->actor) << 8)); if (sp3C != NULL) { Matrix_Push(); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); @@ -353,8 +354,9 @@ void func_8095E204(EnIshi* this, PlayState* play) { for (i = 0; i < 3; i++) { if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.csId, this->actor.halfDaysBits, NULL) == NULL) { + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + ENINSECT_PARAMS(true), this->actor.csId, this->actor.halfDaysBits, + NULL) == NULL) { break; } } @@ -397,7 +399,7 @@ void EnIshi_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, D_8095F6B8[sp34]); func_8095D6E0(&this->actor, play); - if ((sp34 == 1) && Flags_GetSwitch(play, ENISHI_GET_FE00(&this->actor))) { + if ((sp34 == 1) && Flags_GetSwitch(play, ENISHI_GET_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -423,8 +425,8 @@ void EnIshi_Init(Actor* thisx, PlayState* play) { this->unk_197 |= 1; } - this->unk_196 = Object_GetIndex(&play->objectCtx, D_8095F6E8[ENISHI_GET_8(&this->actor)]); - if (this->unk_196 < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[ENISHI_GET_8(&this->actor)]); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -444,8 +446,8 @@ void func_8095E5AC(EnIshi* this) { } void func_8095E5C0(EnIshi* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->unk_196)) { - this->actor.objBankIndex = this->unk_196; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; this->actor.flags &= ~ACTOR_FLAG_10; if (!ENISHI_GET_8(&this->actor)) { this->actor.draw = func_8095F61C; @@ -535,7 +537,7 @@ void func_8095E95C(EnIshi* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; if (ENISHI_GET_1(&this->actor) == 1) { - Flags_SetSwitch(play, ENISHI_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ENISHI_GET_FLAG(&this->actor)); } func_8095EA70(this); func_8095E14C(this); @@ -761,5 +763,5 @@ void func_8095F61C(Actor* thisx, PlayState* play) { } void func_8095F654(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, object_ishi_DL_0009B0); + Gfx_DrawDListOpa(play, gSmallRockDL); } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index 65381f638..fe1898c13 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -16,7 +16,7 @@ typedef void (*EnIshiUnkFunc2)(Actor*, PlayState*); #define ENISHI_GET_70(thisx) (((thisx)->params >> 4) & 7) #define ENISHI_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) #define ENISHI_GET_100(thisx) (((thisx)->params >> 8) & 1) -#define ENISHI_GET_FE00(thisx) (((thisx)->params >> 9) & 0x7F) +#define ENISHI_GET_FLAG(thisx) (((thisx)->params >> 9) & 0x7F) typedef struct EnIshi { /* 0x000 */ Actor actor; @@ -24,7 +24,7 @@ typedef struct EnIshi { /* 0x190 */ EnIshiActionFunc actionFunc; /* 0x194 */ s8 unk_194; /* 0x195 */ s8 unk_195; - /* 0x196 */ s8 unk_196; + /* 0x196 */ s8 objectSlot; /* 0x197 */ u8 unk_197; } EnIshi; // size = 0x198 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 fcbd26b2f..6bf6b4434 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -5,9 +5,8 @@ */ #include "z_en_ja.h" -#include "objects/object_boj/object_boj.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnJa*)thisx) @@ -89,27 +88,41 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -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 }, +typedef enum EnJaAnimation { + /* -1 */ ENJA_ANIM_NONE = -1, + /* 0 */ ENJA_ANIM_0, + /* 1 */ ENJA_ANIM_1, + /* 2 */ ENJA_ANIM_2, + /* 3 */ ENJA_ANIM_3, + /* 4 */ ENJA_ANIM_4, + /* 5 */ ENJA_ANIM_5, + /* 6 */ ENJA_ANIM_MAX +} EnJaAnimation; + +static AnimationInfoS sAnimationInfo[ENJA_ANIM_MAX] = { + { &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_0 + { &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_1 + { &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_2 + { &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_3 + { &object_boj_Anim_004078, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_4 + { &object_boj_Anim_005CE4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_5 }; -void func_80BC1900(EnJa* this) { - this->skelAnime.playSpeed = this->unk_344; +void EnJa_UpdateSkelAnime(EnJa* this) { + this->skelAnime.playSpeed = this->animPlaySpeed; SkelAnime_Update(&this->skelAnime); } -s32 func_80BC192C(EnJa* this, s32 arg1) { - s32 ret = false; +s32 EnJa_ChangeAnim(EnJa* this, s32 animIndex) { + s32 didAnimChange = false; - if (arg1 != this->unk_36C) { - this->unk_36C = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); - this->unk_344 = this->skelAnime.playSpeed; + if (this->animIndex != animIndex) { + this->animIndex = animIndex; + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + this->animPlaySpeed = this->skelAnime.playSpeed; } - return ret; + return didAnimChange; } void func_80BC1984(EnJa* this, PlayState* play) { @@ -123,8 +136,9 @@ void func_80BC1984(EnJa* this, PlayState* play) { s32 func_80BC19FC(EnJa* this, PlayState* play) { s32 ret = false; - if ((this->unk_340 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_340, 0, 7); + if (((this->unk_340 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->actionFunc = func_80BC22F4; ret = true; } @@ -243,9 +257,9 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80BC1AE0(this, play)) { - SubS_UpdateFlags(&this->unk_340, 3, 7); + SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_340 |= 0x10; - func_80BC192C(this, 5); + EnJa_ChangeAnim(this, ENJA_ANIM_5); func_80BC2EA4(this); ret = true; } @@ -257,11 +271,11 @@ s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { if (func_80BC1AE0(this, play)) { if (ENJA_GET_3(&this->actor) == 0) { - func_80BC192C(this, 1); + EnJa_ChangeAnim(this, ENJA_ANIM_1); } else { - func_80BC192C(this, 4); + EnJa_ChangeAnim(this, ENJA_ANIM_4); } - SubS_UpdateFlags(&this->unk_340, 3, 7); + SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->actor.shape.shadowDraw = NULL; this->unk_340 |= 0x50; ret = true; @@ -283,6 +297,9 @@ s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { case 2: ret = func_80BC203C(this, play, scheduleOutput); break; + + default: + break; } return ret; } @@ -305,11 +322,11 @@ void func_80BC21A8(EnJa* this, PlayState* play) { if (!Schedule_RunScript(play, D_80BC35F0, &sp18) || ((this->unk_1D8.unk_00 != sp18.result) && !func_80BC20D0(this, play, &sp18))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sp18.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_1D8.unk_00 = sp18.result; func_80BC2150(this, play); @@ -328,14 +345,16 @@ s32* func_80BC2274(EnJa* this, PlayState* play) { return D_80BC362C; } return D_80BC366C; + + default: + return D_80BC360C; } - return D_80BC360C; } void func_80BC22F4(EnJa* this, PlayState* play) { if (func_8010BF58(&this->actor, play, func_80BC2274(this, play), this->unk_368, &this->unk_1D8.unk_04)) { this->unk_340 &= ~8; - SubS_UpdateFlags(&this->unk_340, 3, 7); + SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_1D8.unk_04 = 0; this->unk_340 |= 0x10; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -347,16 +366,17 @@ void EnJa_Init(Actor* thisx, PlayState* play) { EnJa* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, 16); - this->unk_36C = -1; - func_80BC192C(this, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, + OBJECT_BOJ_LIMB_MAX); + this->animIndex = ENJA_ANIM_NONE; + EnJa_ChangeAnim(this, ENJA_ANIM_0); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.uncullZoneForward = 800.0f; this->actor.gravity = 0.0f; - SubS_UpdateFlags(&this->unk_340, 0, 7); + SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_340 |= 0x10; this->unk_1D8.unk_00 = 0; this->unk_368 = NULL; @@ -379,13 +399,13 @@ void EnJa_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->unk_1D8.unk_00 != 0) { - func_80BC1900(this); + EnJa_UpdateSkelAnime(this); func_80BC1A68(this); func_80BC1D70(this, play); radius = this->collider.dim.radius + 30; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_340 & 7); + SubS_Offer(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_340 & SUBS_OFFER_MODE_MASK); if (this->unk_1D8.unk_00 != 2) { Actor_MoveWithGravity(&this->actor); @@ -402,7 +422,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) { s32 EnJa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnJa* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_BOJ_LIMB_0F) { func_80BC1E40(this, play); } return false; @@ -418,10 +438,10 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnJa* this = THIS; s32 pad2; - if (limbIndex == 15) { + if (limbIndex == OBJECT_BOJ_LIMB_0F) { Matrix_MultVec3f(&D_80BC3780, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); - } else if ((this->unk_340 & 0x40) && (limbIndex == 11)) { + } else if ((this->unk_340 & 0x40) && (limbIndex == OBJECT_BOJ_LIMB_0B)) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -436,8 +456,9 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } if (this->unk_1D8.unk_00 == 1) { - if ((limbIndex == 11) && (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) || - ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) { + if ((limbIndex == OBJECT_BOJ_LIMB_0B) && + (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) || + ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) { OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -474,7 +495,7 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 14) { + } else if (limbIndex == OBJECT_BOJ_LIMB_0E) { if ((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 18.0f)) { OPEN_DISPS(play->state.gfxCtx); @@ -540,8 +561,8 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { overrideRot = false; } - if (limbIndex != 8) { - if (limbIndex == 15) { + switch (limbIndex) { + case OBJECT_BOJ_LIMB_0F: SubS_UpdateLimb(this->unk_354 + this->unk_358 + 0x4000, this->unk_356 + this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1EC, &this->unk_274, stepRot, overrideRot); @@ -552,17 +573,22 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { Matrix_RotateXS(this->unk_274.x, MTXMODE_APPLY); Matrix_RotateZS(this->unk_274.z, MTXMODE_APPLY); Matrix_Push(); - } - } else { - SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8, - &this->unk_27A, stepRot, overrideRot); - Matrix_Pop(); - Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY); - Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY); - Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY); - Matrix_Push(); + break; + + case OBJECT_BOJ_LIMB_08: + SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8, + &this->unk_27A, stepRot, overrideRot); + Matrix_Pop(); + Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY); + Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY); + Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY); + Matrix_Push(); + break; + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.h b/src/overlays/actors/ovl_En_Ja/z_en_ja.h index 00746ec63..fcbbf485f 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.h +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.h @@ -2,6 +2,7 @@ #define Z_EN_JA_H #include "global.h" +#include "objects/object_boj/object_boj.h" struct EnJa; @@ -37,10 +38,10 @@ typedef struct EnJa { /* 0x234 */ EnJaStruct unk_234[4]; /* 0x274 */ Vec3s unk_274; /* 0x27A */ Vec3s unk_27A; - /* 0x280 */ Vec3s jointTable[16]; - /* 0x2E0 */ Vec3s morphTable[16]; + /* 0x280 */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX]; + /* 0x2E0 */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX]; /* 0x340 */ u16 unk_340; - /* 0x344 */ f32 unk_344; + /* 0x344 */ f32 animPlaySpeed; /* 0x348 */ f32 unk_348; /* 0x34C */ f32 unk_34C; /* 0x350 */ UNK_TYPE1 unk350[0x4]; @@ -55,7 +56,7 @@ typedef struct EnJa { /* 0x364 */ s16 unk_364; /* 0x366 */ s16 unk_366; /* 0x368 */ void* unk_368; - /* 0x36C */ s32 unk_36C; + /* 0x36C */ s32 animIndex; /* 0x370 */ UNK_TYPE1 unk_370[4]; /* 0x374 */ s32 prevTalkState; } EnJa; // size = 0x378 diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 314e94d1b..c66c9a355 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -122,7 +122,7 @@ void EnJcMato_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); Collider_InitSphere(play, &this->collider); Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); - this->collider.dim.worldSphere.radius = 0xF; + this->collider.dim.worldSphere.radius = 15; this->actor.colChkInfo.damageTable = &sDamageTable; Actor_SetScale(&this->actor, 0.008f); this->hitFlag = false; 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 449acf212..4573bdcf5 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -7,7 +7,7 @@ #include "z_en_jg.h" #include "overlays/actors/ovl_En_S_Goro/z_en_s_goro.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnJg*)thisx) @@ -34,29 +34,6 @@ s32 EnJg_GetNextTextId(EnJg* this); s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play); void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play); -typedef enum { - /* 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 { /* 0 */ EN_JG_ACTION_FIRST_THAW, /* 1 */ EN_JG_ACTION_SPAWNING, @@ -133,26 +110,49 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -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 }, - { &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, - { &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 }, - { &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, - { &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, - { &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 }, - { &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 }, - { &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +typedef enum EnJgAnimation { + /* 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; + +static AnimationInfoS sAnimationInfo[EN_JG_ANIM_MAX] = { + { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_IDLE + { &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK + { &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WAVING + { &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SHAKING_HEAD + { &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 }, // EN_JG_ANIM_SURPRISE_START + { &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SURPRISE_LOOP + { &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_ANGRY + { &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_START + { &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_LOOP + { &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK_2 + { &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_TAKING_OUT_DRUM + { &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DRUM_IDLE + { &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_PLAYING_DRUM + { &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_THINKING + { &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_REMEMBERING + { &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_STRONG_REMEMBERING + { &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DEPRESSED + { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CUTSCENE_IDLE + { &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CRADLE }; static Vec3f sSfxPos = { 0.0f, 0.0f, 0.0f }; @@ -340,6 +340,9 @@ void EnJg_SetupTalk(EnJg* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; + + default: + break; } } @@ -352,8 +355,8 @@ void EnJg_GoronShrineIdle(EnJg* this, PlayState* play) { this->flags |= FLAG_LOOKING_AT_PLAYER; Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_GoronShrineTalk; - } else if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isTargeted)) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isLockedOn)) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->textId = EnJg_GetStartingConversationTextId(this, play); } } @@ -362,7 +365,7 @@ void EnJg_GoronShrineTalk(EnJg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if ((this->textId == 0xDCC) || (this->textId == 0xDDD) || (this->textId == 0xDE0)) { // There is nothing more to say after these lines, so end the current conversation. - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_GoronShrineIdle; @@ -417,17 +420,17 @@ 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(sAnimationInfo[this->animIndex].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->animIndex == EN_JG_ANIM_SURPRISE_START) { - if (currentFrame == lastFrame) { + if (curFrame == endFrame) { this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } } else if (this->animIndex == EN_JG_ANIM_SURPRISE_LOOP) { if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->animIndex = EN_JG_ANIM_WALK; @@ -472,11 +475,11 @@ 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(sAnimationInfo[this->animIndex].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); u16 temp; - if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (currentFrame == lastFrame)) { + if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (curFrame == endFrame)) { this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -485,7 +488,7 @@ void EnJg_Talk(EnJg* this, PlayState* play) { temp = this->textId; if ((temp == 0xDB4) || (temp == 0xDB5) || (temp == 0xDC4) || (temp == 0xDC6)) { // There is nothing more to say after these lines, so end the current conversation. - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; @@ -497,12 +500,12 @@ void EnJg_Talk(EnJg* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_24_80)) { // The player hasn't talked to the Goron Child at least once, so they can't learn // the Lullaby Intro. End the current conversation with the player. - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; - } else if ((CHECK_WEEKEVENTREG(WEEKEVENTREG_24_40)) || - (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO))) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_40) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || + CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO)) { // The player already has the Lullaby or Lullaby Intro, so say "I'm counting on you" this->textId = EnJg_GetNextTextId(this); Message_StartTextbox(play, this->textId, &this->actor); @@ -511,7 +514,7 @@ void EnJg_Talk(EnJg* this, PlayState* play) { // To get to this point, the player *has* talked to the Goron Child, but doesn't // already have the Lullaby or Lullaby Intro. End the current conversation and // start the cutscene that teaches the Lullaby Intro. - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->csId = EnJg_GetCsIdForTeachingLullabyIntro(this); @@ -542,13 +545,13 @@ void EnJg_SetupWalk(EnJg* this, PlayState* play) { } void EnJg_Freeze(EnJg* this, PlayState* play) { - s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->action == EN_JG_ACTION_SPAWNING) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; this->freezeTimer = 1000; - this->skelAnime.curFrame = lastFrame; + this->skelAnime.curFrame = endFrame; 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); @@ -557,7 +560,7 @@ void EnJg_Freeze(EnJg* this, PlayState* play) { this->actionFunc = EnJg_FrozenIdle; } else if (this->animIndex == EN_JG_ANIM_FROZEN_START) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; - if (currentFrame == lastFrame) { + if (curFrame == endFrame) { 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, @@ -594,15 +597,15 @@ void EnJg_FrozenIdle(EnJg* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x236, &this->actor); // The old Goron is frozen solid! this->actionFunc = EnJg_EndFrozenInteraction; - } else if (this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if (this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } } void EnJg_EndFrozenInteraction(EnJg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnJg_FrozenIdle; } @@ -631,7 +634,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->cutsceneAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE; + this->csAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE; if (this->drum != NULL) { Actor_Kill(this->drum); this->drum = NULL; @@ -639,50 +642,49 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { break; case 2: - this->cutsceneAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM; + this->csAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM; break; case 3: - this->cutsceneAnimIndex = EN_JG_ANIM_DRUM_IDLE; + this->csAnimIndex = EN_JG_ANIM_DRUM_IDLE; break; case 4: - this->cutsceneAnimIndex = EN_JG_ANIM_PLAYING_DRUM; + this->csAnimIndex = EN_JG_ANIM_PLAYING_DRUM; break; case 5: - this->cutsceneAnimIndex = EN_JG_ANIM_THINKING; + this->csAnimIndex = EN_JG_ANIM_THINKING; break; case 6: - this->cutsceneAnimIndex = EN_JG_ANIM_REMEMBERING; + this->csAnimIndex = EN_JG_ANIM_REMEMBERING; break; case 7: - this->cutsceneAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING; + this->csAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING; break; case 8: - this->cutsceneAnimIndex = EN_JG_ANIM_DEPRESSED; + this->csAnimIndex = EN_JG_ANIM_DEPRESSED; break; case 9: - this->cutsceneAnimIndex = EN_JG_ANIM_CRADLE; + this->csAnimIndex = EN_JG_ANIM_CRADLE; break; default: - this->cutsceneAnimIndex = EN_JG_ANIM_IDLE; + this->csAnimIndex = EN_JG_ANIM_IDLE; break; } - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->cutsceneAnimIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->csAnimIndex); } - if ((!(this->flags & FLAG_DRUM_SPAWNED)) && - (((this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && (Animation_OnFrame(&this->skelAnime, 14.0f)) && + if (!(this->flags & FLAG_DRUM_SPAWNED) && + (((this->csAnimIndex == 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->csAnimIndex == EN_JG_ANIM_DRUM_IDLE) || (this->csAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) && (this->action == EN_JG_ACTION_LULLABY_INTRO_CS)))) { this->flags |= FLAG_DRUM_SPAWNED; this->drum = Actor_SpawnAsChildAndCutscene( @@ -691,11 +693,11 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { this->actor.params, this->actor.csId, this->actor.halfDaysBits, NULL); } - if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) { + if (this->csAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) { if (Animation_OnFrame(&this->skelAnime, 23.0f)) { - Audio_PlaySfxAtPos(&sSfxPos, NA_SE_EV_WOOD_BOUND_S); + Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_WOOD_BOUND_S); } else if (Animation_OnFrame(&this->skelAnime, 38.0f)) { - Audio_PlaySfxAtPos(&sSfxPos, NA_SE_EV_OBJECT_SLIDE); + Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_OBJECT_SLIDE); } } } else { @@ -899,8 +901,8 @@ void EnJg_SpawnBreath(EnJg* this, PlayState* play) { * handing it off to EnJg_Freeze. */ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) { - s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->flags |= FLAG_LOOKING_AT_PLAYER; @@ -917,18 +919,18 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_SetupTalk; } else { - if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isTargeted)) { - func_800B863C(&this->actor, play); + if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isLockedOn)) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); if (this->action == EN_JG_ACTION_FIRST_THAW) { this->textId = EnJg_GetStartingConversationTextId(this, play); } } this->freezeTimer--; - if ((this->freezeTimer <= 0) && (currentFrame == lastFrame)) { + if ((this->freezeTimer <= 0) && (curFrame == endFrame)) { this->animIndex = EN_JG_ANIM_FROZEN_START; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); - Audio_PlaySfxAtPos(&sSfxPos, NA_SE_EV_FREEZE_S); + Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_FREEZE_S); this->actionFunc = EnJg_Freeze; } } 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 b63f34dce..30c84973c 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h @@ -35,7 +35,7 @@ typedef struct EnJg { /* 0x3B0 */ Vec3f breathVelocity; /* 0x3BC */ Vec3f breathAccel; /* 0x3C8 */ s16 csId; - /* 0x3CA */ u8 cutsceneAnimIndex; + /* 0x3CA */ u8 csAnimIndex; /* 0x3CB */ u8 cueId; /* 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 b023bf688..aba7cdeeb 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 @@ -7,7 +7,7 @@ #include "z_en_jgame_tsn.h" #include "overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnJgameTsn*)thisx) @@ -48,10 +48,18 @@ ActorInit En_Jgame_Tsn_InitVars = { (ActorFunc)EnJgameTsn_Draw, }; -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 }, +typedef enum EnJgameTsnAnimation { + /* -1 */ ENJGAMETSN_ANIM_NONE = -1, + /* 0 */ ENJGAMETSN_ANIM_0, + /* 1 */ ENJGAMETSN_ANIM_1, + /* 2 */ ENJGAMETSN_ANIM_2, + /* 3 */ ENJGAMETSN_ANIM_MAX +} EnJgameTsnAnimation; + +static AnimationInfo sAnimationInfo[ENJGAMETSN_ANIM_MAX] = { + { &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_0 + { &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_1 + { &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_2 }; static ColliderCylinderInit sCylinderInit = { @@ -90,7 +98,7 @@ void EnJgameTsn_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.velocity.y = 0.0f; @@ -145,7 +153,7 @@ void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) { } void func_80C13B74(EnJgameTsn* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0); this->actionFunc = func_80C13BB8; } @@ -156,15 +164,15 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { if (this->actor.flags & ACTOR_FLAG_10000) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1); Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else if (gSaveContext.minigameScore < 20) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1); Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x10A3, &this->actor); this->unk_300 = 0x10A3; } @@ -174,24 +182,23 @@ 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, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1); Message_StartTextbox(play, 0x1095, &this->actor); this->unk_300 = 0x1095; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1); Message_StartTextbox(play, 0x1096, &this->actor); this->unk_300 = 0x1096; } func_80C14030(this); } else if (this->actor.flags & ACTOR_FLAG_10000) { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } else { - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(player->stateFlags1 & PLAYER_STATE1_2000) && - (this->unk_2FE == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && - func_80C149B0(play, &this->unk_1F8)) { + (this->unk_2FE == 0) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) && func_80C149B0(play, &this->unk_1F8)) { this->unk_2FE = 1; func_80C13E6C(this); } else if (!(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { @@ -212,17 +219,17 @@ 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, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1); Message_StartTextbox(play, 0x1098, &this->actor); this->unk_300 = 0x1098; } func_80C14030(this); } else { - func_800B8614(&this->actor, play, 1000.0f); + Actor_OfferTalk(&this->actor, play, 1000.0f); } } @@ -274,6 +281,9 @@ void func_80C14044(EnJgameTsn* this, PlayState* play) { func_80C13B74(this); } break; + + default: + break; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x71C, 0xB6); @@ -336,7 +346,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_2FC++; if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && func_80C149B0(play, &this->unk_200)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x109F, &this->actor); this->unk_300 = 0x109F; player->stateFlags1 |= PLAYER_STATE1_20; @@ -345,7 +355,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { func_80C14030(this); } else if ((player->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) || (player->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x10A0, &this->actor); this->unk_300 = 0x10A0; player->stateFlags1 |= PLAYER_STATE1_20; @@ -402,7 +412,7 @@ void func_80C14610(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x10A4; func_80C14030(this); } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -414,12 +424,12 @@ void func_80C14684(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x109E; Rupees_ChangeBy(-20); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x109D, &this->actor); this->unk_300 = 0x109D; } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x109C, &this->actor); this->unk_300 = 0x109C; } @@ -462,7 +472,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { break; case 0x109A: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0); Message_StartTextbox(play, 0x109B, &this->actor); this->unk_300 = 0x109B; break; @@ -491,6 +501,9 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { func_80C14540(this); func_80C14554(this, play); break; + + default: + break; } } } diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 350f4ae82..7d5185935 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -6,7 +6,7 @@ #include "z_en_js.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnJs*)thisx) @@ -117,6 +117,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_84_20); } break; + case 1: case 2: case 3: @@ -130,6 +131,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) { return; } break; + case 5: case 6: case 7: @@ -137,6 +139,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) { this->maskType = ENJS_GET_TYPE(&this->actor) - 4; this->actionFunc = func_8096A104; break; + default: break; } @@ -153,6 +156,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) { case 0: Play_DisableMotionBlur(); break; + case 5: case 6: case 7: @@ -161,6 +165,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) { func_80969400(ENJS_GET_TYPE(&this->actor)); } break; + default: break; } @@ -414,6 +419,7 @@ s32 func_809692A8(s32 arg0) { return false; } return true; + case 5: case 6: case 7: @@ -422,6 +428,7 @@ s32 func_809692A8(s32 arg0) { return false; } return true; + default: return false; } @@ -441,6 +448,7 @@ s32 func_8096933C(s32 arg0) { } else { return true; } + case 5: case 6: case 7: @@ -451,6 +459,7 @@ s32 func_8096933C(s32 arg0) { } else { return true; } + default: return false; } @@ -576,16 +585,21 @@ void func_80969898(EnJs* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x2215)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x2217); break; + case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x2216); break; + + default: + break; } } break; + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { @@ -593,45 +607,52 @@ void func_80969898(EnJs* this, PlayState* play) { this->unk_2B8 |= 1; if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) { Message_ContinueTextbox(play, 0x220F); - break; + } else { + Message_ContinueTextbox(play, 0x220D); } - Message_ContinueTextbox(play, 0x220D); break; + case 0x220D: case 0x2213: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0x220E: Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969748; break; + case 0x2210: case 0x2211: case 0x2212: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969748; break; + case 0x2214: case 0x2217: if (!func_809695FC(this, play)) { func_80969494(this, play); - break; } break; + default: func_80969494(this, play); break; } } break; + + default: + break; } } void func_80969AA0(EnJs* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { textId = 0x220B; } else { textId = 0x2215; @@ -671,7 +692,7 @@ void func_80969B5C(EnJs* this, PlayState* play) { this->unk_2B4 = 0.0f; func_80969AA0(this, play); } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } func_80968CB8(this); } @@ -726,16 +747,19 @@ void func_80969DA4(EnJs* this, PlayState* play) { ((play->msgCtx.currentTextId == 0x2219) || (play->msgCtx.currentTextId == 0x221E))) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (!func_809695FC(this, play)) { func_809694E8(this, play); - break; } break; + case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + + default: + break; } } break; @@ -745,69 +769,84 @@ void func_80969DA4(EnJs* this, PlayState* play) { case 0x221B: if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) { Message_ContinueTextbox(play, 0x2219); - break; + } else { + Message_ContinueTextbox(play, 0x221C); } - Message_ContinueTextbox(play, 0x221C); break; + case 0x2224: case 0x2226: case 0x2228: case 0x222A: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0x2225: case 0x2227: case 0x2229: case 0x222B: if (!func_809695FC(this, play)) { func_809694E8(this, play); - break; } break; + case 0x2222: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0x2223: switch (ENJS_GET_TYPE(&this->actor)) { case 5: Message_ContinueTextbox(play, 0x2224); break; + case 6: Message_ContinueTextbox(play, 0x2226); break; + case 7: Message_ContinueTextbox(play, 0x2228); break; + case 8: Message_ContinueTextbox(play, 0x222A); break; + + default: + break; } break; + case 0x221C: Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969C54; break; + case 0x221D: case 0x2220: case 0x2221: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969C54; break; + default: func_809694E8(this, play); break; } } break; + + default: + break; } } void func_8096A080(EnJs* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { textId = 0x2218; } else { textId = 0x221B; @@ -830,14 +869,14 @@ void func_8096A104(EnJs* this, PlayState* play) { this->actionFunc = func_80969DA4; func_8096A080(this, play); } else if (func_80968DD0(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } void func_8096A184(EnJs* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { textId = 0x220B; } else if (func_80968E38(0) >= 20) { textId = 0x2202; @@ -858,7 +897,7 @@ void func_8096A1E8(EnJs* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_84_20); func_809696EC(this, 0); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -870,7 +909,7 @@ void func_8096A2C0(EnJs* this, PlayState* play) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_8096A1E8; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { Actor_OfferGetItem(&this->actor, play, GI_MASK_FIERCE_DEITY, 10000.0f, 1000.0f); } @@ -886,11 +925,14 @@ void func_8096A38C(EnJs* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); + break; + + default: break; } @@ -902,9 +944,13 @@ void func_8096A38C(EnJs* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f); this->unk_2B8 |= 0x10; break; + case 1: Message_ContinueTextbox(play, 0x21FD); break; + + default: + break; } break; @@ -914,9 +960,13 @@ void func_8096A38C(EnJs* this, PlayState* play) { Message_ContinueTextbox(play, 0x2200); func_809696EC(this, 0); break; + case 1: Message_ContinueTextbox(play, 0x21FF); break; + + default: + break; } break; @@ -927,13 +977,21 @@ void func_8096A38C(EnJs* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f); this->unk_2B8 |= 0x10; break; + case 1: Message_ContinueTextbox(play, 0x2204); break; + + default: + break; } + + default: + break; } } break; + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { @@ -962,7 +1020,6 @@ void func_8096A38C(EnJs* this, PlayState* play) { break; case 0x2201: - case 0x220A: if (!func_809695FC(this, play)) { func_80969530(this, play); @@ -975,6 +1032,9 @@ void func_8096A38C(EnJs* this, PlayState* play) { } } break; + + default: + break; } } @@ -1003,7 +1063,7 @@ void func_8096A6F4(EnJs* this, PlayState* play) { } if (!(this->unk_2B8 & 8) && (this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x1000)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } diff --git a/src/overlays/actors/ovl_En_Jso/z_en_jso.c b/src/overlays/actors/ovl_En_Jso/z_en_jso.c index f36629d27..43a27759f 100644 --- a/src/overlays/actors/ovl_En_Jso/z_en_jso.c +++ b/src/overlays/actors/ovl_En_Jso/z_en_jso.c @@ -6,7 +6,7 @@ #include "z_en_jso.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnJso*)thisx) diff --git a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c index b7ad94d93..b9bdbe6b9 100644 --- a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c +++ b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c @@ -6,7 +6,9 @@ #include "z_en_jso2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_100000 | ACTOR_FLAG_80000000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_100000 | \ + ACTOR_FLAG_80000000) #define THIS ((EnJso2*)thisx) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index d572c1331..abba3efac 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -5,8 +5,9 @@ */ #include "z_en_kaizoku.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_100000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_100000) #define THIS ((EnKaizoku*)thisx) @@ -252,13 +253,13 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { EffectBlureInit1 blureInit; this->picto.actor.hintId = TATL_HINT_ID_PIRATE; - this->picto.actor.targetMode = 3; + this->picto.actor.targetMode = TARGET_MODE_3; this->picto.actor.colChkInfo.mass = 80; ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawFeet, 0.0f); this->unk_2CA = this->picto.actor.world.rot.z; this->picto.actor.colChkInfo.health = 8; this->exitIndex = KAIZOKU_GET_EXIT_INDEX(&this->picto.actor); - this->switchFlag = KAIZOKU_GET_SWITCHFLAG(&this->picto.actor); + this->switchFlag = KAIZOKU_GET_SWITCH_FLAG(&this->picto.actor); if (this->unk_2CA >= 2) { this->unk_2CA = 0; @@ -285,7 +286,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); Actor_SetScale(&this->picto.actor, 0.0125f); this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->switchFlag == 127) { this->switchFlag = -1; } @@ -441,8 +442,8 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { void EnKaizoku_ChangeAnim(EnKaizoku* this, EnKaizokuAnimation animIndex) { this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], 0.0f); } @@ -480,7 +481,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); - func_800B7298(play, &this->picto.actor, 0x15); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_21); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; @@ -498,7 +499,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; Message_StartTextbox(play, D_80B8A8D0[sp54], &this->picto.actor); this->unk_2C8++; - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); Math_Vec3f_Copy(&this->subCamEye, &this->unk_5C8); @@ -537,7 +538,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; this->picto.actor.velocity.y = 0.0f; - func_800B7298(play, &this->picto.actor, 4); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_4); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ONGND); @@ -552,7 +553,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { break; case 3: - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { sp54 = this->unk_2CA * 4 + this->unk_2C8; if (Player_GetMask(play) == PLAYER_MASK_STONE) { if (D_80B8A8D0[sp54] == 0x11A5) { @@ -594,7 +595,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 6: Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f); - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { this->unk_598 = 7; this->unk_2F8.x = 1.0f; this->unk_59C++; @@ -608,13 +609,13 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 7: if (this->unk_598 == 0) { - func_800B7298(play, &this->picto.actor, 6); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); CutsceneManager_Stop(this->csId); this->unk_59C = 0; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags &= ~ACTOR_FLAG_100000; this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; - this->picto.actor.flags |= ACTOR_FLAG_1; + this->picto.actor.flags |= ACTOR_FLAG_TARGETABLE; func_80B872A4(this); } break; @@ -673,10 +674,10 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); } - func_800B7298(play, &this->picto.actor, 0x60); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_96); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->unk_2B2 = 30; - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_598 = 0; this->unk_59C = 0; this->unk_2D8 = 0; @@ -699,7 +700,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { switch (this->unk_59C) { case 0: - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14); this->unk_2C8 = 3; this->unk_598 = 0; @@ -708,7 +709,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { break; case 1: - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { s32 textId; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); @@ -723,7 +724,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { case 2: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_800B7298(play, &this->picto.actor, 6); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); CutsceneManager_Stop(this->csId); this->subCamId = SUB_CAM_ID_DONE; play->nextEntrance = play->setupExitList[this->exitIndex]; @@ -786,7 +787,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { break; case 1: - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { if (this->unk_2D9 == 0) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); this->unk_2D9 = 1; @@ -798,7 +799,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_18); - func_800B7298(play, &this->picto.actor, 0x85); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_133); this->unk_5A0 = 0; this->unk_598 = 0; this->unk_59C++; @@ -842,7 +843,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { 255; } - if ((this->frameCount <= curFrame) && (this->unk_5A0 >= 0x28)) { + if ((curFrame >= this->animEndFrame) && (this->unk_5A0 >= 0x28)) { this->picto.actor.draw = NULL; this->unk_598 = 10; Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); @@ -864,7 +865,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { play->envCtx.fillScreen = false; this->unk_59C = 0; this->subCamId = SUB_CAM_ID_DONE; - func_800B7298(play, &this->picto.actor, 6); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); CutsceneManager_Stop(this->csId); if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); @@ -1126,7 +1127,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { } this->unk_2D8 = 0; - if ((this->frameCount <= curFrame) && + if ((curFrame >= this->animEndFrame) && (this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; @@ -1156,7 +1157,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; this->unk_2D8 = 0; - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { func_80B88910(this); @@ -1206,7 +1207,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { } this->unk_2D8 = 0; - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); @@ -1251,7 +1252,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; this->unk_2D8 = 0; - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { this->picto.actor.speed = 0.0f; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); @@ -1403,22 +1404,20 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { if (this->skelAnime.curFrame <= 8.0f) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - } else { - if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - this->swordState = 1; - this->picto.actor.speed = 10.0f; - Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); - } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) { - this->picto.actor.speed = 0.0f; - } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { - this->swordState = -1; - } + } else if (Animation_OnFrame(&this->skelAnime, 13.0f)) { + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); + this->swordState = 1; + this->picto.actor.speed = 10.0f; + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); + } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) { + this->picto.actor.speed = 0.0f; + } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { + this->swordState = -1; } this->unk_2D8 = 0; - if ((this->frameCount <= curFrame) && (this->unk_2D0 < 2)) { + if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; @@ -1610,8 +1609,7 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, - 0.7f, 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; @@ -1633,8 +1631,7 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && (this->unk_2B8 != 0)) { - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, - 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; @@ -1684,11 +1681,11 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { } this->picto.actor.speed = 0.0f; this->unk_2D8 = 1; - func_800B7298(play, &this->picto.actor, 0x7B); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_123); Enemy_StartFinishingBlow(play, &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->picto.actor.flags &= ~ACTOR_FLAG_400; this->unk_598 = 0; this->unk_59C = 0; @@ -1713,8 +1710,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { if (this->unk_2B8 == 0) { return; } - Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, - 0.4f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); this->unk_2B8 = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1757,7 +1753,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); - if (this->frameCount <= curFrame) { + if (curFrame >= this->animEndFrame) { this->unk_2D8 = 0; func_80B86B58(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -1908,7 +1904,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->picto.actor.focus.pos.x, this->picto.actor.focus.pos.y, this->picto.actor.focus.pos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); sp64 = 1; } break; @@ -2116,11 +2112,11 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* (limbIndex == KAIZOKU_LIMB_0D) || (limbIndex == KAIZOKU_LIMB_0F) || (limbIndex == KAIZOKU_LIMB_11) || (limbIndex == KAIZOKU_LIMB_12) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_14) || (limbIndex == KAIZOKU_LIMB_15) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_17)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + this->bodyPartIndex++; + if (this->bodyPartIndex >= KAIZOKU_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -2166,7 +2162,7 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 6366c4f7f..423819eb3 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -6,7 +6,7 @@ #include "objects/object_kz/object_kz.h" #define KAIZOKU_GET_EXIT_INDEX(thisx) ((thisx)->params & 0x3F) -#define KAIZOKU_GET_SWITCHFLAG(thisx) (((thisx)->params >> 6) & 0x7F) +#define KAIZOKU_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 0x7F) struct EnKaizoku; @@ -35,6 +35,25 @@ typedef enum EnKaizokuAnimation { /* 19 */ EN_KAIZOKU_ANIM_MAX } EnKaizokuAnimation; +typedef enum EnKaizokuBodyPart { + /* 0 */ KAIZOKU_BODYPART_0, + /* 1 */ KAIZOKU_BODYPART_1, + /* 2 */ KAIZOKU_BODYPART_2, + /* 3 */ KAIZOKU_BODYPART_3, + /* 4 */ KAIZOKU_BODYPART_4, + /* 5 */ KAIZOKU_BODYPART_5, + /* 6 */ KAIZOKU_BODYPART_6, + /* 7 */ KAIZOKU_BODYPART_7, + /* 8 */ KAIZOKU_BODYPART_8, + /* 9 */ KAIZOKU_BODYPART_9, + /* 10 */ KAIZOKU_BODYPART_10, + /* 11 */ KAIZOKU_BODYPART_11, + /* 12 */ KAIZOKU_BODYPART_12, + /* 13 */ KAIZOKU_BODYPART_13, + /* 14 */ KAIZOKU_BODYPART_14, + /* 15 */ KAIZOKU_BODYPART_MAX +} EnKaizokuBodyPart; + typedef struct EnKaizoku { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; @@ -61,16 +80,16 @@ typedef struct EnKaizoku { /* 0x2D6 */ s16 csId; /* 0x2D8 */ u8 unk_2D8; /* 0x2D9 */ u8 unk_2D9; - /* 0x2DC */ f32 frameCount; + /* 0x2DC */ f32 animEndFrame; /* 0x2E0 */ f32 unk_2E0; /* 0x2E4 */ EnKaizokuAnimation animIndex; - /* 0x2E8 */ s32 bodyPartsPosIndex; + /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 unk_2EC; /* 0x2F0 */ f32 unk_2F0; /* 0x2F4 */ s16 unk_2F4; /* 0x2F8 */ Vec3f unk_2F8; /* 0x304 */ Vec3f unk_304; - /* 0x310 */ Vec3f bodyPartsPos[15]; + /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; /* 0x3C4 */ Vec3f unk_3C4; /* 0x3D0 */ s32 blureIndex; /* 0x3D4 */ ColliderCylinder bodyCollider; 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 fc8d3d201..a3d0e4608 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -8,7 +8,7 @@ #include "z_en_kakasi.h" #include "objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnKakasi*)thisx) @@ -121,18 +121,32 @@ typedef enum { /* 5 */ ENKAKASI_ANIM_ARMS_CROSSED_STILL, // arms crossed but still, also some noise sfx /* 6 */ ENKAKASI_ANIM_WAVE, // "wave" short sideways shake, stops early, partial? unused? /* 7 */ ENKAKASI_ANIM_SLOWROLL, // partial bounch, ends looking left, OFFER anim takes over - /* 8 */ ENKAKASI_ANIM_IDLE // slow stretching wiggle, ends in regular position + /* 8 */ ENKAKASI_ANIM_IDLE, // slow stretching wiggle, ends in regular position + /* 9 */ ENKAKASI_ANIM_MAX } EnKakasiAnimation; -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 AnimationHeader* sAnimations[ENKAKASI_ANIM_MAX] = { + &object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING + &object_ka_Anim_00686C, // ENKAKASI_ANIM_SIDEWAYS_SHAKING + &object_ka_Anim_0081A4, // ENKAKASI_ANIM_HOPPING_REGULAR + &object_ka_Anim_007B90, // ENKAKASI_ANIM_SPIN_REACH_OFFER + &object_ka_Anim_0071EC, // ENKAKASI_ANIM_TWIRL + &object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_STILL + &object_ka_Anim_00686C, // ENKAKASI_ANIM_WAVE + &object_ka_Anim_0081A4, // ENKAKASI_ANIM_SLOWROLL + &object_ka_Anim_000214, // ENKAKASI_ANIM_IDLE }; -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, +static u8 sAnimationModes[ENKAKASI_ANIM_MAX] = { + ANIMMODE_LOOP, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING + ANIMMODE_LOOP, // ENKAKASI_ANIM_SIDEWAYS_SHAKING + ANIMMODE_LOOP, // ENKAKASI_ANIM_HOPPING_REGULAR + ANIMMODE_ONCE, // ENKAKASI_ANIM_SPIN_REACH_OFFER + ANIMMODE_ONCE, // ENKAKASI_ANIM_TWIRL + ANIMMODE_ONCE, // ENKAKASI_ANIM_ARMS_CROSSED_STILL + ANIMMODE_ONCE, // ENKAKASI_ANIM_WAVE + ANIMMODE_ONCE, // ENKAKASI_ANIM_SLOWROLL + ANIMMODE_ONCE, // ENKAKASI_ANIM_IDLE }; void EnKakasi_Destroy(Actor* thisx, PlayState* play) { @@ -147,7 +161,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { s32 i; 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); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->songSummonDist = KAKASI_GET_SUMMON_DISTANCE(&this->picto.actor) * 20.0f; if (this->songSummonDist < 40.0f) { @@ -156,7 +170,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { this->unkHeight = (this->picto.actor.world.rot.z * 20.0f) + 60.0f; this->picto.actor.world.rot.z = 0; - this->picto.actor.targetMode = 0; + this->picto.actor.targetMode = TARGET_MODE_0; if ((this->picto.actor.world.rot.x > 0) && (this->picto.actor.world.rot.x < 8)) { this->picto.actor.targetMode = KAKASI_GET_TARGETMODE(thisx); } @@ -197,9 +211,9 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { void EnKakasi_ChangeAnim(EnKakasi* this, s32 animIndex) { this->animIndex = animIndex; - this->animeFrameCount = Animation_GetLastFrame(&sAnimations[this->animIndex]->common); + this->animEndFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common); // 1: regular playback speed, 0: starting frame - Animation_Change(&this->skelanime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animeFrameCount, + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -4.0f); } @@ -209,24 +223,24 @@ s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { void EnKakasi_CheckAnimationSfx(EnKakasi* this) { if ((this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING) || (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL)) { - if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } if ((this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) || (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { - if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { + if (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } - if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 9.0f) || - Animation_OnFrame(&this->skelanime, 16.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 9.0f) || + Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); } - if (Animation_OnFrame(&this->skelanime, 18.0f)) { + if (Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } if ((this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER) || (this->animIndex == ENKAKASI_ANIM_TWIRL)) { - if (Animation_OnFrame(&this->skelanime, 1.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } } @@ -274,9 +288,10 @@ void func_8096FAAC(EnKakasi* this, PlayState* play) { * goes off every frame of song teach, but... doing what? */ void func_8096FBB8(EnKakasi* this, PlayState* play) { - if ((play->msgCtx.unk12048 == 0) || (play->msgCtx.unk12048 == 1) || (play->msgCtx.unk12048 == 2) || - (play->msgCtx.unk12048 == 3) || (play->msgCtx.unk12048 == 4)) { - // why not 0 < x < 4? fewer branches + if ((play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_A) || (play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_DOWN) || + (play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_RIGHT) || + (play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_LEFT) || + (play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_UP)) { this->unk190++; } if ((this->unk190 != 0) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { @@ -286,7 +301,7 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) { this->unk190 = 8; } if (this->unk190 != 0) { - Math_ApproachF(&this->skelanime.playSpeed, 1.0f, 0.1f, 0.2f); + Math_ApproachF(&this->skelAnime.playSpeed, 1.0f, 0.1f, 0.2f); this->picto.actor.shape.rot.y += 0x800; } } @@ -318,7 +333,7 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnKakasi_RegularDialogue; } else { - func_800B8500(&this->picto.actor, play, 9999.9f, 9999.9f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->picto.actor, play, 9999.9f, 9999.9f, PLAYER_IA_MINUS1); } } } @@ -330,19 +345,19 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { } void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { - u32 saveContextDay = gSaveContext.save.day; + u32 day = gSaveContext.save.day; s16 x; s16 y; // first talk to scarecrow dialogue this->picto.actor.textId = 0x1644; if (func_800B8718(&this->picto.actor, &play->state)) { - this->skelanime.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; EnKakasi_SetupSongTeach(this, play); return; } if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { - this->skelanime.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; EnKakasi_SetupDialogue(this); return; } @@ -352,23 +367,23 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { (y < SCREEN_HEIGHT) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { // faster shaking EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } - } else if ((saveContextDay == 3) && gSaveContext.save.isNight) { - this->skelanime.playSpeed = 1.0f; + } else if ((day == 3) && gSaveContext.save.isNight) { + this->skelAnime.playSpeed = 1.0f; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_ChangeAnim(this, 1); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } } else if (this->animIndex != ENKAKASI_ANIM_IDLE) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_IDLE); } if (this->picto.actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->picto.actor, play, 100.0f); + Actor_OfferTalk(&this->picto.actor, play, 100.0f); func_800B874C(&this->picto.actor, play, 100.0f, 80.0f); } } @@ -386,12 +401,12 @@ void EnKakasi_SetupDialogue(EnKakasi* this) { } void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { - u32 saveContextDay = gSaveContext.save.day; - f32 currentAnimeFrame = this->skelanime.curFrame; + u32 day = gSaveContext.save.day; + f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 2000, 0); // if first dialogue - if ((this->picto.actor.textId != 0x1644) && (this->animeFrameCount <= currentAnimeFrame) && + if ((this->picto.actor.textId != 0x1644) && (curFrame >= this->animEndFrame) && (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -400,8 +415,9 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { // if dialogue: oh sorry come back again 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) { + if ((curFrame >= this->animEndFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) { + this->unkCounter1A4++; + if (this->unkCounter1A4 >= 2) { this->unkCounter1A4 = 0; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); } @@ -512,19 +528,19 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->talkState = TEXT_STATE_5; if (play->msgCtx.choiceIndex == 1) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); 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) { + } else if ((day == 3) && gSaveContext.save.isNight) { this->picto.actor.textId = 0x164F; } else { this->picto.actor.textId = 0x1652; } EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); 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 @@ -559,7 +575,7 @@ void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { */ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_80152434(play, 0x35); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING); this->unkState1A8 = 0; if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); @@ -616,12 +632,11 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { func_8096FAAC(this, play); func_8096FBB8(this, play); - if (play->msgCtx.ocarinaMode == 4) { // song failed + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { // song failed this->unk190 = 0; this->unkCounter1A4 = 0; CutsceneManager_Stop(this->csIdList[0]); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_YASE_DEAD); - if (this) {} this->unkState196 = 2; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.textId = 0x1647; @@ -630,9 +645,9 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); this->actionFunc = EnKakasi_RegularDialogue; - } else if (play->msgCtx.ocarinaMode == 3) { // song success + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { // song success this->postTeachTimer = 30; - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); this->actionFunc = EnKakasi_PostSongLearnTwirl; } @@ -640,21 +655,20 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { } void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { - f32 animeFrame = this->skelanime.curFrame; + f32 curFrame = this->skelAnime.curFrame; if ((this->postTeachTimer == 0) && (this->animIndex != ENKAKASI_ANIM_TWIRL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } - if ((this->postTeachTimer == 0) && (this->animIndex == ENKAKASI_ANIM_TWIRL) && - (this->animeFrameCount <= animeFrame)) { + if ((this->postTeachTimer == 0) && (this->animIndex == ENKAKASI_ANIM_TWIRL) && (curFrame >= this->animEndFrame)) { EnKakasi_SetupPostSongLearnDialogue(this, play); } } void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { CutsceneManager_Stop(this->csIdList[0]); - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; this->unk190 = 0; this->unkCounter1A4 = 0; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); @@ -668,7 +682,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 tempAnimFrame = this->skelanime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f vec3fCopy; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); @@ -684,7 +698,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if ((this->picto.actor.textId == 0x1648) && (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) && - (this->animeFrameCount <= tempAnimFrame)) { + (curFrame >= this->animEndFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -692,7 +706,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if ((this->picto.actor.textId == 0x164B) && (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) && - (this->animeFrameCount <= tempAnimFrame)) { + (curFrame >= this->animEndFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -772,10 +786,10 @@ 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 AudioSfx_StopById + Audio_PlaySfx_MessageDecide(); this->picto.actor.textId = 0x164A; } else { - func_8019F230(); // play 0x480A sfx (cancel) and calls AudioSfx_StopById + Audio_PlaySfx_MessageCancel(); this->picto.actor.textId = 0x1661; } } @@ -819,11 +833,10 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) { } void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { - f32 currentFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f localVec3f; Player* player; - currentFrame = this->skelanime.curFrame; EnKakasi_CheckPlayerPosition(this, play); 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; @@ -857,7 +870,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { case 1: // end of twirl, start shaking back and forth - if ((this->unk204 == 0) && (this->animeFrameCount <= currentFrame)) { + if ((this->unk204 == 0) && (curFrame >= this->animEndFrame)) { this->unk204 = 0x14; this->unk190++; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); @@ -944,7 +957,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.respawnFlag = -4; - SET_EVENTINF(EVENTINF_27); + SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP); } else { gSaveContext.save.time = CLOCK_TIME(18, 0); gSaveContext.respawnFlag = -8; @@ -1041,9 +1054,9 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && (this->picto.actor.xzDistToPlayer < this->songSummonDist) && - ((BREG(1) != 0) || (play->msgCtx.ocarinaMode == 0xD))) { + ((BREG(1) != 0) || (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_SCARECROW_SPAWN))) { this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; this->actionFunc = EnKakasi_SetupRiseOutOfGround; } } @@ -1101,7 +1114,7 @@ void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = EnKakasi_RisenDialogue; } else { - func_800B8614(&this->picto.actor, play, 70.0f); + Actor_OfferTalk(&this->picto.actor, play, 70.0f); } } @@ -1118,7 +1131,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; s32 pad; - SkelAnime_Update(&this->skelanime); + SkelAnime_Update(&this->skelAnime); if (this->picto.actor.draw != NULL) { EnKakasi_CheckAnimationSfx(this); } @@ -1155,7 +1168,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnKakasi* this = THIS; - if (limbIndex == 4) { + if (limbIndex == OBJECT_KA_LIMB_04) { Matrix_MultVec3f(&gZeroVec3f, &this->unk1BC); } } @@ -1163,6 +1176,6 @@ void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; Gfx_SetupDL25_Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, 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 cff35d183..689e475b2 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -11,7 +11,7 @@ typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*); typedef struct EnKakasi { /* 0x000 */ PictoActor picto; /* 0x148 */ EnKakasiActionFunc actionFunc; - /* 0x14C */ SkelAnime skelanime; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ s16 unk190; // camera index for song teaching angles? /* 0x192 */ s16 postTeachTimer; /* 0x194 */ s16 aboveGroundStatus; // from params, changed to 2 in init @@ -22,7 +22,7 @@ typedef struct EnKakasi { /* 0x1A8 */ s32 unkState1A8; /* 0x1AC */ s16 talkState; /* 0x1AE */ s16 csIdList[3]; - /* 0x1B4 */ f32 animeFrameCount; + /* 0x1B4 */ f32 animEndFrame; /* 0x1B8 */ f32 unkHeight; /* 0x1BC */ Vec3f unk1BC; // set by post limbdraw func for one limb /* 0x1C8 */ UNK_TYPE1 pad1C8[0x3C]; diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index 820dd1f4e..8171e56b4 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -1,13 +1,13 @@ /* * File: z_en_kame.c * Overlay: ovl_En_Kame - * Description: Snapper Turtle + * Description: Snapper */ #include "z_en_kame.h" -#include "objects/object_tl/object_tl.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnKame*)thisx) @@ -16,30 +16,46 @@ void EnKame_Destroy(Actor* thisx, PlayState* play); void EnKame_Update(Actor* thisx, PlayState* play); void EnKame_Draw(Actor* thisx, PlayState* play); -void func_80AD70A0(EnKame* this); -void func_80AD70EC(EnKame* this, PlayState* play); -void func_80AD71B4(EnKame* this); -void func_80AD7254(EnKame* this, PlayState* play); -void func_80AD73A8(EnKame* this); -void func_80AD7424(EnKame* this, PlayState* play); -void func_80AD76CC(EnKame* this); -void func_80AD7798(EnKame* this, PlayState* play); -void func_80AD792C(EnKame* this); -void func_80AD7948(EnKame* this, PlayState* play); -void func_80AD7B18(EnKame* this); -void func_80AD7B90(EnKame* this, PlayState* play); -void func_80AD7D40(EnKame* this, PlayState* play); -void func_80AD7DA4(EnKame* this); -void func_80AD7E0C(EnKame* this, PlayState* play); -void func_80AD7EC0(EnKame* this); -void func_80AD7F10(EnKame* this, PlayState* play); -void func_80AD7FF8(EnKame* this, PlayState* play); -void func_80AD810C(EnKame* this, PlayState* play); -void func_80AD8148(EnKame* this, PlayState* play); -void func_80AD825C(EnKame* this, PlayState* play); -void func_80AD8364(EnKame* this); -void func_80AD8388(EnKame* this, PlayState* play); -void func_80AD8D64(Actor* thisx, PlayState* play); +void EnKame_SetupIdle(EnKame* this); +void EnKame_Idle(EnKame* this, PlayState* play); +void EnKame_SetupWalk(EnKame* this); +void EnKame_Walk(EnKame* this, PlayState* play); +void EnKame_SetupRetreatIntoShell(EnKame* this); +void EnKame_RetreatIntoShell(EnKame* this, PlayState* play); +void EnKame_SetupPrepareToAttack(EnKame* this); +void EnKame_PrepareToAttack(EnKame* this, PlayState* play); +void EnKame_SetupAttack(EnKame* this); +void EnKame_Attack(EnKame* this, PlayState* play); +void EnKame_SetupEmergeFromShell(EnKame* this); +void EnKame_EmergeFromShell(EnKame* this, PlayState* play); +void EnKame_Flip(EnKame* this, PlayState* play); +void EnKame_SetupStruggle(EnKame* this); +void EnKame_Struggle(EnKame* this, PlayState* play); +void EnKame_SetupFlipUpright(EnKame* this); +void EnKame_FlipUpright(EnKame* this, PlayState* play); +void EnKame_Stunned(EnKame* this, PlayState* play); +void EnKame_Damaged(EnKame* this, PlayState* play); +void EnKame_SetupDead(EnKame* this, PlayState* play); +void EnKame_Dead(EnKame* this, PlayState* play); +void EnKame_SetupBurstIntoFlames(EnKame* this); +void EnKame_BurstIntoFlames(EnKame* this, PlayState* play); +void EnKame_DrawSpikedSnapper(Actor* thisx, PlayState* play); + +// This enum is used for when the Snapper is forcibly flipped +// by one of the player's attacks. It is *not* used for when +// the Snapper flips itself upright. +typedef enum { + /* 0 */ EN_KAME_FLIP_TYPE_UPSIDE_DOWN, + /* 1 */ EN_KAME_FLIP_TYPE_RIGHTSIDE_UP +} EnKameFlipType; + +typedef enum { + /* 0 */ EN_KAME_EYE_OPEN, + /* 1 */ EN_KAME_EYE_HALF_CLOSING, + /* 2 */ EN_KAME_EYE_CLOSED, + /* 3 */ EN_KAME_EYE_HALF_OPENING, + /* 4 */ EN_KAME_EYE_MAX +} EnKameEyeTexture; ActorInit En_Kame_InitVars = { ACTOR_EN_KAME, @@ -75,43 +91,54 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 3, 15, 30, 80 }; +typedef enum { + /* 0x0 */ EN_KAME_DMGEFF_NONE, // Has no special effect + /* 0x1 */ EN_KAME_DMGEFF_STUN, // Cannot damage the Snapper, but stuns it for 40 frames + /* 0x2 */ EN_KAME_DMGEFF_FIRE, // Sets the Snapper on fire + /* 0x3 */ EN_KAME_DMGEFF_FREEZE, // Stuns the Snapper for 80 frames and surrounds it with ice + /* 0x4 */ EN_KAME_DMGEFF_LIGHT_ORB, // Surrounds the snapper with light orbs + /* 0x5 */ EN_KAME_DMGEFF_ELECTRIC_STUN, // Similar to EN_KAME_DMGEFF_STUN, but also applies an electric effect + /* 0xD */ EN_KAME_DMGEFF_HOOKSHOT = 0xD, // Cannot damage the Snapper, but pulls the player towards it + /* 0xE */ EN_KAME_DMGEFF_INSTANT_KILL, // Instantly kills the Snapper if it hits, even when it is rightside-up + /* 0xF */ EN_KAME_DMGEFF_FLIP_OVER // Flips over Snappers if they are rightside-up +} EnKameDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0xF), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xD), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0xF), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(0, 0x1), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0xE), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0xF), + /* Deku Nut */ DMG_ENTRY(0, EN_KAME_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, EN_KAME_DMGEFF_FLIP_OVER), + /* Zora boomerang */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(0, EN_KAME_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, EN_KAME_DMGEFF_FLIP_OVER), + /* Fire arrow */ DMG_ENTRY(2, EN_KAME_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, EN_KAME_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, EN_KAME_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(0, EN_KAME_DMGEFF_STUN), + /* Deku bubble */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, EN_KAME_DMGEFF_INSTANT_KILL), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, EN_KAME_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, EN_KAME_DMGEFF_ELECTRIC_STUN), + /* Normal shield */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, EN_KAME_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_KAME_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, EN_KAME_DMGEFF_FLIP_OVER), }; -static TexturePtr D_80AD8E34[] = { object_tl_Tex_0055A0, object_tl_Tex_0057A0, object_tl_Tex_0059A0, - object_tl_Tex_0057A0 }; +static TexturePtr sEyeTextures[] = { gSnapperEyeOpenTex, gSnapperEyeHalfTex, gSnapperEyeClosedTex, gSnapperEyeHalfTex }; static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, TATL_HINT_ID_SNAPPER, ICHAIN_CONTINUE), @@ -119,30 +146,31 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 3500, ICHAIN_STOP), }; -static s32 D_80AD8E50 = false; +static s32 sTexturesDesegmented = false; void EnKame_Init(Actor* thisx, PlayState* play) { EnKame* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime1, &object_tl_Skel_007C70, &object_tl_Anim_004210, this->jointTable1, - this->morphTable1, 13); - SkelAnime_InitFlex(play, &this->skelAnime2, &object_tl_Skel_001A50, &object_tl_Anim_000B30, this->jointTable2, - this->morphTable2, 4); + SkelAnime_InitFlex(play, &this->snapperSkelAnime, &gSnapperSkel, &gSnapperIdleAnim, this->snapperJointTable, + this->snapperMorphTable, SNAPPER_LIMB_MAX); + SkelAnime_InitFlex(play, &this->spikedSnapperSkelAnime, &gSpikedSnapperSkel, &gSpikedSnapperIdleAnim, + this->spikedSnapperJointTable, this->spikedSnapperMorphTable, SPIKED_SNAPPER_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 55.0f); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (!D_80AD8E50) { + if (!sTexturesDesegmented) { s32 i; - for (i = 0; i < ARRAY_COUNT(D_80AD8E34); i++) { - D_80AD8E34[i] = Lib_SegmentedToVirtual(D_80AD8E34[i]); + for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); } - D_80AD8E50 = true; + + sTexturesDesegmented = true; } - func_80AD70A0(this); + EnKame_SetupIdle(this); } void EnKame_Destroy(Actor* thisx, PlayState* play) { @@ -151,141 +179,170 @@ void EnKame_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80AD6F34(EnKame* this) { - if (this->unk_29C != 0) { - this->unk_29C++; - if (this->unk_29C == 4) { - this->unk_29C = 0; +void EnKame_Blink(EnKame* this) { + if (this->eyeIndex != EN_KAME_EYE_OPEN) { + this->eyeIndex++; + if (this->eyeIndex == EN_KAME_EYE_MAX) { + this->eyeIndex = EN_KAME_EYE_OPEN; } } else if (Rand_ZeroOne() < 0.05f) { - this->unk_29C = 1; + this->eyeIndex = EN_KAME_EYE_HALF_CLOSING; } } -void func_80AD6F9C(EnKame* this) { +void EnKame_Freeze(EnKame* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.6f; - this->drawDmgEffFrozenSteamScale = 0.90000004f; + this->drawDmgEffFrozenSteamScale = 900.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->collider.base.colType = COLTYPE_HIT3; - this->unk_2A2 = 80; + this->stunTimer = 80; this->actor.flags &= ~ACTOR_FLAG_400; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } -void func_80AD7018(EnKame* this, PlayState* play) { +void EnKame_Thaw(EnKame* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, SNAPPER_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } -void func_80AD70A0(EnKame* this) { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_004210, -5.0f); +void EnKame_SetupIdle(EnKame* this) { + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperIdleAnim, -5.0f); this->actor.speed = 0.0f; - this->actionFunc = func_80AD70EC; + this->actionFunc = EnKame_Idle; } -void func_80AD70EC(EnKame* this, PlayState* play) { +/** + * Plays the idle animation, then starts walking once the animation is over. If the player gets close enough to + * the Snapper without the Stone Mask equipped, it will retreat into its shell to begin attacking them. + */ +void EnKame_Idle(EnKame* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Animation_OnFrame(&this->skelAnime1, 10.0f)) { + if (Animation_OnFrame(&this->snapperSkelAnime, 10.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_VOICE); - this->unk_2A0 = 40; + this->voiceTimer = 40; } if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & PLAYER_STATE1_800000) && (this->actor.xzDistToPlayer < 240.0f)) { - func_80AD73A8(this); - } else if (SkelAnime_Update(&this->skelAnime1)) { - func_80AD71B4(this); + EnKame_SetupRetreatIntoShell(this); + } else if (SkelAnime_Update(&this->snapperSkelAnime)) { + EnKame_SetupWalk(this); } } -void func_80AD71B4(EnKame* this) { - Animation_MorphToLoop(&this->skelAnime1, &object_tl_Anim_00823C, -5.0f); +void EnKame_SetupWalk(EnKame* this) { + Animation_MorphToLoop(&this->snapperSkelAnime, &gSnapperWalkAnim, -5.0f); this->actor.speed = 0.5f; - this->unk_29E = Animation_GetLastFrame(&object_tl_Anim_00823C) * ((s32)Rand_ZeroFloat(5.0f) + 3); - this->unk_2A4 = this->actor.shape.rot.y; + this->timer = Animation_GetLastFrame(&gSnapperWalkAnim) * ((s32)Rand_ZeroFloat(5.0f) + 3); + this->targetRotY = this->actor.shape.rot.y; this->collider.base.acFlags |= (AC_HARD | AC_ON); this->collider.base.colType = COLTYPE_HARD; - this->actionFunc = func_80AD7254; + this->actionFunc = EnKame_Walk; } -void func_80AD7254(EnKame* this, PlayState* play) { +/** + * Walk semi-randomly around the Snapper's home until the timer reaches 0, then transition back to being idle. + * If the player gets close enough to the Snapper without the Stone Mask equipped, it will retreat into its + * shell to begin attacking them. + */ +void EnKame_Walk(EnKame* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & PLAYER_STATE1_800000) && (this->actor.xzDistToPlayer < 240.0f)) { - func_80AD73A8(this); + EnKame_SetupRetreatIntoShell(this); return; } - SkelAnime_Update(&this->skelAnime1); + SkelAnime_Update(&this->snapperSkelAnime); - if (this->unk_2A4 != this->actor.shape.rot.y) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_2A4, 0x100); + if (this->targetRotY != this->actor.shape.rot.y) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetRotY, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 40.0f) { - this->unk_2A4 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); + this->targetRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); } - this->unk_29E--; - if (this->unk_29E == 0) { - func_80AD70A0(this); - } else if (Animation_OnFrame(&this->skelAnime1, 0.0f) || Animation_OnFrame(&this->skelAnime1, 15.0f)) { + this->timer--; + if (this->timer == 0) { + EnKame_SetupIdle(this); + } else if (Animation_OnFrame(&this->snapperSkelAnime, 0.0f) || Animation_OnFrame(&this->snapperSkelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_WALK); } } -void func_80AD73A8(EnKame* this) { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_001C68, -3.0f); - this->unk_29E = 0; - this->unk_2AC = 1.0f; - this->unk_2A8 = 1.0f; +void EnKame_SetupRetreatIntoShell(EnKame* this) { + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperRetreatIntoShellAnim, -3.0f); + this->timer = 0; + this->limbScaleY = 1.0f; + this->limbScaleXZ = 1.0f; this->actor.speed = 0.0f; - if (this->unk_2A0 == 0) { + + // If the Snapper recently played this same sound effect while it was idle, don't play it again. + if (this->voiceTimer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_VOICE); } - this->actionFunc = func_80AD7424; + + this->actionFunc = EnKame_RetreatIntoShell; } -void func_80AD7424(EnKame* this, PlayState* play) { +/** + * Plays the animation of the Snapper retreating its shell, and scales its limbs appropriately to + * make it appear like its head and legs are going into the shell. Once the animation is over, the + * Snapper will either prepare for an attack (if the player is close enough and not wearing the + * Stone Mask), or it will emerge from its shell. + */ +void EnKame_RetreatIntoShell(EnKame* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (SkelAnime_Update(&this->skelAnime1)) { + if (SkelAnime_Update(&this->snapperSkelAnime)) { if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & PLAYER_STATE1_800000) && - ((this->unk_29E == 0) || (this->actor.xzDistToPlayer < 120.0f))) { - func_80AD76CC(this); + ((this->timer == 0) || (this->actor.xzDistToPlayer < 120.0f))) { + EnKame_SetupPrepareToAttack(this); } else { - this->unk_29E--; - if (this->unk_29E == 0) { - func_80AD7B18(this); + this->timer--; + if (this->timer == 0) { + EnKame_SetupEmergeFromShell(this); } } - } else if (this->skelAnime1.curFrame > 2.0f) { - this->unk_2AC = 1.5f - ((this->skelAnime1.curFrame - 2.0f) * (7.0f / 30)); - this->unk_2A8 = 1.5f - ((this->skelAnime1.curFrame - 2.0f) * (1.0f / 12)); + } else if (this->snapperSkelAnime.curFrame > 2.0f) { + this->limbScaleY = 1.5f - ((this->snapperSkelAnime.curFrame - 2.0f) * (7.0f / 30)); + this->limbScaleXZ = 1.5f - ((this->snapperSkelAnime.curFrame - 2.0f) * (1.0f / 12)); } else { - f32 frame = this->skelAnime1.curFrame; + f32 curFrame = this->snapperSkelAnime.curFrame; - this->unk_2AC = (0.25f * frame) + 1.0f; - this->unk_2A8 = (0.25f * frame) + 1.0f; + this->limbScaleY = (0.25f * curFrame) + 1.0f; + this->limbScaleXZ = (0.25f * curFrame) + 1.0f; } } -void func_80AD7568(EnKame* this) { - this->actor.speed = this->unk_2A6 * (5.0f / 7552); - this->actor.shape.rot.z = this->unk_2A6 * 0.11016949f; +/** + * Sets the Snapper's speed and z-rotation based on its angular velocity. When the Snapper is done with the first + * part of its attack, it will slowly "wind up" before moving back to its home; by setting the speed to be a multiple + * of its angular velocity, the Snapper will smootly ramp up its speed during the "wind up". As for the z-rotation, + * setting it in this manner gives the Snapper a subtle, almost-imperceptible tilt as it spins. + */ +void EnKame_SetAttackSpeed(EnKame* this) { + this->actor.speed = this->angularVelocityY * (5.0f / 0x1D80); + this->actor.shape.rot.z = this->angularVelocityY * (13.0f / 118.0f); } -void func_80AD75A8(EnKame* this, PlayState* play) { - static Color_RGBA8 D_80AD8E54 = { 250, 250, 250, 255 }; - static Color_RGBA8 D_80AD8E58 = { 180, 180, 180, 255 }; - static Vec3f D_80AD8E5C = { 0.0f, 0.75f, 0.0f }; +/** + * If the Snapper is moving quickly enough over certain surface materials, this function will spawn dirt or snow-colored + * dust on even-numbered frames. Additionally, this function is also responsible for playing the Snapper's spinning + * sound effect if its angular velocity is large enough. + */ +void EnKame_ProcessAttackEffects(EnKame* this, PlayState* play) { + static Color_RGBA8 sSnowPrimColor = { 250, 250, 250, 255 }; + static Color_RGBA8 sSnowEnvColor = { 180, 180, 180, 255 }; + static Vec3f sVelocity = { 0.0f, 0.75f, 0.0f }; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed >= 3.0f)) { if ((play->gameplayFrames % 2) == 0) { @@ -293,144 +350,190 @@ void func_80AD75A8(EnKame* this, PlayState* play) { SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) { - func_800B1210(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, 550, 100); + func_800B1210(play, &this->actor.world.pos, &sVelocity, &gZeroVec3f, 550, 100); } else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) { - func_800B0DE0(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, &D_80AD8E54, &D_80AD8E58, 550, - 100); + func_800B0DE0(play, &this->actor.world.pos, &sVelocity, &gZeroVec3f, &sSnowPrimColor, &sSnowEnvColor, + 550, 100); } } } - if (this->unk_2A6 > 0x1200) { - func_800B9010(&this->actor, NA_SE_EN_PAMET_ROLL - SFX_FLAG); + if (this->angularVelocityY > 0x1200) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PAMET_ROLL - SFX_FLAG); } } -void func_80AD76CC(EnKame* this) { +void EnKame_SetupPrepareToAttack(EnKame* this) { + // The Snapper's attack can be divided into roughly two phases: + // - Charging towards the player + // - Going back to their home + // This if-statement is checking which of the two is the current phase. If the Snapper is in the first + // phase of the attack, then it just finished retreating into its shell, and it hasn't switched to its + // "spiked" form yet. Thus, we check the draw function here to determine which phase the Snapper is in. if (this->actor.draw == EnKame_Draw) { - this->actor.draw = func_80AD8D64; - this->unk_2A6 = 0x3B00; - this->unk_2AC = 0.5f; - func_80AD7568(this); - this->unk_29E = 15; + this->actor.draw = EnKame_DrawSpikedSnapper; + this->angularVelocityY = 0x3B00; + this->spikesScale = 0.5f; + EnKame_SetAttackSpeed(this); + this->timer = 15; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); - this->unk_2BC.y = this->actor.home.pos.y - 100.0f; + // As stated above, we could tell this was the first phase of the Snapper's attack because it hadn't + // changed its draw function to the "spiked" version yet. However, we won't be able to check the draw + // function in the future, because we just changed it; we need some other way to tell which phase of + // the attack the Snapper is in. Setting the targetPos's y-position here to something less than the + // home's y-position will be used as a signal in future functions to indicate this is the first phase + // of the attack. Nothing looks at the y-position of the targetPos, so we can use it however we want, + // and during the second phase of the attack, the Snapper's home position is copied into targetPos, + // including the y-position; the targetPos's y-position will *only* differ from the home's y-position + // during the first phase of the attack due to the code below. + this->targetPos.y = this->actor.home.pos.y - 100.0f; } else { this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - Math_Vec3f_Copy(&this->unk_2BC, &this->actor.home.pos); - this->unk_29E = 0; + Math_Vec3f_Copy(&this->targetPos, &this->actor.home.pos); + this->timer = 0; } + this->actor.flags |= ACTOR_FLAG_10; - this->actionFunc = func_80AD7798; + this->actionFunc = EnKame_PrepareToAttack; } -void func_80AD7798(EnKame* this, PlayState* play) { - if (this->unk_29E == 15) { - this->unk_2AC += 0.2f; - if (this->unk_2AC > 1.1f) { - this->unk_29E--; +/** + * This function gradually increases the angular velocity to 0x3B00 and does a few other miscellaneous tasks (e.g., + * scaling the spikes up and making the Snapper face the player for the first phase of the attack) before attacking. + */ +void EnKame_PrepareToAttack(EnKame* this, PlayState* play) { + // In EnKame_SetupPrepareToAttack, the timer is set to 15 if it was the first phase of the attack, so this is yet + // another way of checking the current phase. Gradually scale the spikes up, and once they reach their full size, + // enable AT collisions so the Snapper can damage the player. + if (this->timer == 15) { + this->spikesScale += 0.2f; + if (this->spikesScale > 1.1f) { + this->timer--; this->collider.base.atFlags |= AT_ON; - this->unk_2AC = 1.0f; + this->spikesScale = 1.0f; } - } else if (this->unk_29E > 0) { - this->unk_29E--; - } else if (Math_ScaledStepToS(&this->unk_2A6, 0x3B00, (s32)(this->unk_2A6 * 0.09f) + 45)) { - if (this->unk_2BC.y < this->actor.home.pos.y) { + } else if (this->timer > 0) { + this->timer--; + } else if (Math_ScaledStepToS(&this->angularVelocityY, 0x3B00, (s32)(this->angularVelocityY * 0.09f) + 45)) { + // If it's the first phase of the attack, rotate the Snapper to face the player and set the targetPos to a + // fixed position in that direction. This will make them charge towards the player once they start moving. + if (this->targetPos.y < this->actor.home.pos.y) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->unk_2BC.x = (Math_SinS(this->actor.world.rot.y) * 360.0f) + this->actor.world.pos.x; - this->unk_2BC.z = (Math_CosS(this->actor.world.rot.y) * 360.0f) + this->actor.world.pos.z; + this->targetPos.x = (Math_SinS(this->actor.world.rot.y) * 360.0f) + this->actor.world.pos.x; + this->targetPos.z = (Math_CosS(this->actor.world.rot.y) * 360.0f) + this->actor.world.pos.z; } - func_80AD792C(this); + + EnKame_SetupAttack(this); } - this->actor.shape.rot.y += this->unk_2A6; + this->actor.shape.rot.y += this->angularVelocityY; - if (!(this->unk_2BC.y < this->actor.home.pos.y) || (this->actionFunc != func_80AD7798)) { - func_80AD7568(this); + // Calling EnKame_SetAttackSpeed will set the Snapper's speed based on its current angular velocity; since we are + // gradually scaling up the angular velocity, this would gradually scale up the speed as well. However, during the + // first phase of the attack, the Snapper should wait in place until it reaches its maximum angular velocity. This + // check will prevent us from changing the Snapper's speed during the first phase until we're just about to attack. + if (!(this->targetPos.y < this->actor.home.pos.y) || (this->actionFunc != EnKame_PrepareToAttack)) { + EnKame_SetAttackSpeed(this); } - func_80AD75A8(this, play); + + EnKame_ProcessAttackEffects(this, play); } -void func_80AD792C(EnKame* this) { - this->unk_29E = -1; - this->actionFunc = func_80AD7948; +void EnKame_SetupAttack(EnKame* this) { + this->targetAngularVelocityY = -1; + this->actionFunc = EnKame_Attack; } -void func_80AD7948(EnKame* this, PlayState* play) { - s32 temp_v1; +/** + * Moves the Snapper towards its target while spinning until it hits a wall or reaches the target. Once that happens, + * the Snapper will either reduce its angular velocity to 0x300 and prepare for the second phase of the attack (if the + * Snapper is currently in the first phase), or it will reduce its angular velocity to 0 and emerge from its shell (if + * the Snapper is currently in the second phase). + */ +void EnKame_Attack(EnKame* this, PlayState* play) { + this->actor.shape.rot.y += this->angularVelocityY; + EnKame_ProcessAttackEffects(this, play); - this->actor.shape.rot.y += this->unk_2A6; - func_80AD75A8(this, play); + if (this->targetAngularVelocityY == -1) { + s32 absYawToTarget; + s16 yawToTarget = Actor_WorldYawTowardPoint(&this->actor, &this->targetPos) - this->actor.world.rot.y; - if (this->unk_29E == -1) { - s16 temp_v0 = Actor_WorldYawTowardPoint(&this->actor, &this->unk_2BC) - this->actor.world.rot.y; + absYawToTarget = ABS_ALT(yawToTarget); - temp_v1 = ABS_ALT(temp_v0); - - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (temp_v1 > 0x3000) || - (Actor_WorldDistXZToPoint(&this->actor, &this->unk_2BC) < 50.0f)) { + // If the yaw toward the targetPos is too large, that indicates the Snapper probably moved + // beyond its target (in other words, the target is now "behind" the Snapper). + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (absYawToTarget > 0x3000) || + (Actor_WorldDistXZToPoint(&this->actor, &this->targetPos) < 50.0f)) { s8 pad; - if (this->unk_2BC.y < this->actor.home.pos.y) { - this->unk_29E = 0x300; + if (this->targetPos.y < this->actor.home.pos.y) { + this->targetAngularVelocityY = 0x300; } else { - this->unk_29E = 0; + this->targetAngularVelocityY = 0; } } return; } - if (Math_ScaledStepToS(&this->unk_2A6, this->unk_29E, (s32)(this->unk_2A6 * 0.09f) + 45)) { - if (this->unk_29E == 0) { - if (this->unk_2AC >= 1.0f) { + if (Math_ScaledStepToS(&this->angularVelocityY, this->targetAngularVelocityY, + (s32)(this->angularVelocityY * 0.09f) + 45)) { + if (this->targetAngularVelocityY == 0) { + if (this->spikesScale >= 1.0f) { Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); } - this->unk_2AC -= 0.1f; + + this->spikesScale -= 0.1f; this->collider.base.atFlags &= ~AT_ON; - if (this->unk_2AC < 0.5f) { + if (this->spikesScale < 0.5f) { this->actor.flags &= ~ACTOR_FLAG_10; - func_80AD7B18(this); + EnKame_SetupEmergeFromShell(this); } } else { - func_80AD76CC(this); + EnKame_SetupPrepareToAttack(this); } } - func_80AD7568(this); + + EnKame_SetAttackSpeed(this); } -void func_80AD7B18(EnKame* this) { +void EnKame_SetupEmergeFromShell(EnKame* this) { this->actor.draw = EnKame_Draw; - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_0031DC, -3.0f); + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperEmergeFromShellAnim, -3.0f); this->actor.speed = 0.0f; - this->unk_2AC = 0.1f; - this->unk_2A8 = 1.0f; + this->limbScaleY = 0.1f; + this->limbScaleXZ = 1.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_80AD7B90; + this->actionFunc = EnKame_EmergeFromShell; } -void func_80AD7B90(EnKame* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime1)) { - func_80AD71B4(this); - } else if (this->skelAnime1.curFrame > 7.0f) { - this->unk_2AC = 1.5f - ((this->skelAnime1.curFrame - 7.0f) * (1.0f / 6)); - this->unk_2A8 = 1.5f - ((this->skelAnime1.curFrame - 7.0f) * (1.0f / 6)); +/** + * Plays the animation of the Snapper emerging from its shell, and scales its limbs appropriately to + * make it appear like its head and legs are coming out of the shell. Once the animation is over, this + * will make the Snapper start walking again. + */ +void EnKame_EmergeFromShell(EnKame* this, PlayState* play) { + if (SkelAnime_Update(&this->snapperSkelAnime)) { + EnKame_SetupWalk(this); + } else if (this->snapperSkelAnime.curFrame > 7.0f) { + this->limbScaleY = 1.5f - ((this->snapperSkelAnime.curFrame - 7.0f) * (1.0f / 6)); + this->limbScaleXZ = 1.5f - ((this->snapperSkelAnime.curFrame - 7.0f) * (1.0f / 6)); } else { - f32 frame = this->skelAnime1.curFrame; + f32 curFrame = this->snapperSkelAnime.curFrame; - this->unk_2AC = (0.2f * frame) + 0.1f; - this->unk_2A8 = ((1.0f / 14) * frame) + 1.0f; + this->limbScaleY = (0.2f * curFrame) + 0.1f; + this->limbScaleXZ = ((1.0f / 14) * curFrame) + 1.0f; } } -void func_80AD7C54(EnKame* this) { - if (this->actionFunc == func_80AD7E0C) { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_0035EC, -3.0f); - this->unk_29E = 1; +void EnKame_SetupFlip(EnKame* this) { + if (this->actionFunc == EnKame_Struggle) { + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperBouncedUprightAnim, -3.0f); + this->flipType = EN_KAME_FLIP_TYPE_RIGHTSIDE_UP; this->collider.info.bumper.dmgFlags &= ~0x8000; } else { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_0039C0, -3.0f); - this->unk_29E = 0; + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperFlipOverAnim, -3.0f); + this->flipType = EN_KAME_FLIP_TYPE_UPSIDE_DOWN; this->collider.info.bumper.dmgFlags |= 0x8000; } @@ -442,158 +545,199 @@ void func_80AD7C54(EnKame* this) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.shape.rot.z = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_REVERSE); - this->actionFunc = func_80AD7D40; + this->actionFunc = EnKame_Flip; } -void func_80AD7D40(EnKame* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime1)) { - if (this->unk_29E == 1) { - func_80AD71B4(this); +/** + * If the Snapper is flipped upside-down, this will make it struggle for 200 frames once the flip animation ends. + * If the Snapper is flipped rightside-up, this will make it start walking once the flip animation ends. + */ +void EnKame_Flip(EnKame* this, PlayState* play) { + if (SkelAnime_Update(&this->snapperSkelAnime)) { + if (this->flipType == EN_KAME_FLIP_TYPE_RIGHTSIDE_UP) { + EnKame_SetupWalk(this); } else { - this->unk_29E = 200; - func_80AD7DA4(this); + this->timer = 200; + EnKame_SetupStruggle(this); } } } -void func_80AD7DA4(EnKame* this) { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_0027D8, -3.0f); +void EnKame_SetupStruggle(EnKame* this) { + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperWiggleLegsAnim, -3.0f); this->collider.base.acFlags |= AC_ON; this->collider.base.acFlags &= ~AC_HARD; this->collider.base.colType = COLTYPE_HIT6; this->actor.speed = 0.0f; - this->actionFunc = func_80AD7E0C; + this->actionFunc = EnKame_Struggle; } -void func_80AD7E0C(EnKame* this, PlayState* play) { - if (this->unk_29E > 0) { - this->unk_29E--; - if (SkelAnime_Update(&this->skelAnime1)) { +/** + * Plays various struggling animations until the timer reaches 0, then it flips itself upright. + */ +void EnKame_Struggle(EnKame* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + if (SkelAnime_Update(&this->snapperSkelAnime)) { if (Rand_ZeroOne() > 0.5f) { - Animation_PlayOnce(&this->skelAnime1, &object_tl_Anim_0027D8); + Animation_PlayOnce(&this->snapperSkelAnime, &gSnapperWiggleLegsAnim); } else { - Animation_PlayOnce(&this->skelAnime1, &object_tl_Anim_002F88); + Animation_PlayOnce(&this->snapperSkelAnime, &gSnapperFailToFlipUprightAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_ROAR); } } } else { - func_80AD7EC0(this); + EnKame_SetupFlipUpright(this); } } -void func_80AD7EC0(EnKame* this) { - Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_002510, -3.0f); +void EnKame_SetupFlipUpright(EnKame* this) { + Animation_MorphToPlayOnce(&this->snapperSkelAnime, &gSnapperFlipUprightAnim, -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_WAKEUP); - this->actionFunc = func_80AD7F10; + this->actionFunc = EnKame_FlipUpright; } -void func_80AD7F10(EnKame* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime1)) { +/** + * Plays the animation of the Snapper flipping itself upright, then transitions back to walking. + */ +void EnKame_FlipUpright(EnKame* this, PlayState* play) { + if (SkelAnime_Update(&this->snapperSkelAnime)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - func_80AD71B4(this); - } else if (this->skelAnime1.curFrame >= 10.0f) { + EnKame_SetupWalk(this); + } else if (this->snapperSkelAnime.curFrame >= 10.0f) { + // This is the part of the animation where the Snapper starts to flip itself + // upright. During this flip, this actor needs to manually control when + // ActorShadow_DrawCircle is called, so the shadowDraw pointer is set to NULL. + // See EnKame_PostLimbDraw and EnKame_Draw for more information. this->actor.shape.shadowDraw = NULL; this->collider.base.acFlags &= ~AC_ON; this->collider.info.bumper.dmgFlags &= ~0x8000; } } -void func_80AD7FA4(EnKame* this) { +void EnKame_SetupStunned(EnKame* this) { this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } + func_800BE504(&this->actor, &this->collider); - this->actionFunc = func_80AD7FF8; + this->actionFunc = EnKame_Stunned; } -void func_80AD7FF8(EnKame* this, PlayState* play) { - if (this->unk_2A2 != 0) { - this->unk_2A2--; +/** + * Stops the Snapper's animation and locks it in place until the stun timer reaches zero. After that, the + * Snapper either dies (if the attack that stunned it reduced its health to 0) or goes back to struggling. + * If the Snapper dies in this state, it skips the "finishing blow" screen flash and game freeze. + */ +void EnKame_Stunned(EnKame* this, PlayState* play) { + if (this->stunTimer != 0) { + this->stunTimer--; } - if (this->unk_2A2 == 0) { - func_80AD7018(this, play); + if (this->stunTimer == 0) { + EnKame_Thaw(this, play); if (this->actor.colChkInfo.health == 0) { - func_80AD8148(this, NULL); + EnKame_SetupDead(this, NULL); } else { this->actor.world.rot.y = this->actor.shape.rot.y; - func_80AD7DA4(this); + EnKame_SetupStruggle(this); } } } -void func_80AD8060(EnKame* this) { - s16 lastFrame = Animation_GetLastFrame(&object_tl_Anim_0008B4); +void EnKame_SetupDamaged(EnKame* this) { + s16 endFrame = Animation_GetLastFrame(&gSnapperDamageAnim); - Animation_Change(&this->skelAnime1, &object_tl_Anim_0008B4, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -3.0f); - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, lastFrame); + Animation_Change(&this->snapperSkelAnime, &gSnapperDamageAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE, -3.0f); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, endFrame); Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DAMAGE); this->collider.base.acFlags &= ~AC_ON; - this->actionFunc = func_80AD810C; + this->actionFunc = EnKame_Damaged; } -void func_80AD810C(EnKame* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime1)) { - func_80AD7DA4(this); +/** + * Plays the damaged animation, then goes back to struggling to flip itself upright. + */ +void EnKame_Damaged(EnKame* this, PlayState* play) { + if (SkelAnime_Update(&this->snapperSkelAnime)) { + EnKame_SetupStruggle(this); } } -void func_80AD8148(EnKame* this, PlayState* play) { - Animation_PlayLoop(&this->skelAnime1, &object_tl_Anim_000AF4); +void EnKame_SetupDead(EnKame* this, PlayState* play) { + Animation_PlayLoop(&this->snapperSkelAnime, &gSnapperDeathAnim); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); this->collider.base.acFlags &= ~AC_ON; this->collider.base.atFlags &= ~AT_ON; this->collider.base.atFlags &= ~(AC_HARD | AC_HIT); this->actor.velocity.y = 15.0f; this->actor.speed = 1.5f; + + // This allows callers of this function to skip the "finishing blow" screen flash and game freeze as well + // as the rotation that happens if the Snapper is killed by a projectile. Only EnKame_Stunned calls this + // while passing NULL instead of play; in practice, this means that the only way to skip this code is to + // kill the Snapper with an Ice Arrow, since that's the only attack that both stuns it and deals damage. if (play != NULL) { Enemy_StartFinishingBlow(play, &this->actor); - if (this->actor.draw == func_80AD8D64) { + if (this->actor.draw == EnKame_DrawSpikedSnapper) { this->actor.draw = EnKame_Draw; } else { func_800BE504(&this->actor, &this->collider); } } + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DEAD); - this->unk_29E = 0; - this->actionFunc = func_80AD825C; + this->timer = 0; + this->actionFunc = EnKame_Dead; } -void func_80AD825C(EnKame* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime1); +/** + * Launches the Snapper into the air and spins it around wildly. Makes the Snapper + * burst into flames once it touches the ground. + */ +void EnKame_Dead(EnKame* this, PlayState* play) { + SkelAnime_Update(&this->snapperSkelAnime); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_LAND); - func_80AD8364(this); + EnKame_SetupBurstIntoFlames(this); } else { - if (this->unk_29E == 1) { + //! @bug unreachable code: EnKame_SetupDead sets this variable to 0, and no other code that runs + //! while the Snapper is in this state will change it to anything else. + if (this->timer == 1) { this->actor.colorFilterTimer = 100; } else if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_NONE, 255, COLORFILTER_BUFFLAG_OPA, 100); } + this->actor.shape.rot.x += Rand_S16Offset(0x700, 0x1400); this->actor.shape.rot.y += (s16)Rand_ZeroFloat(5120.0f); this->actor.shape.rot.z += Rand_S16Offset(0x700, 0x1400); } } -void func_80AD8364(EnKame* this) { - this->unk_29E = 20; +void EnKame_SetupBurstIntoFlames(EnKame* this) { + this->timer = 20; this->actor.speed = 0.0f; - this->actionFunc = func_80AD8388; + this->actionFunc = EnKame_BurstIntoFlames; } -void func_80AD8388(EnKame* this, PlayState* play) { - Vec3f sp34; +/** + * After waiting for the timer to reach 0, this function gradually shrinks the actor + * and spawns blue flames around it. Once the Snapper shrinks enough, this drops a + * random item and kills the actor. + */ +void EnKame_BurstIntoFlames(EnKame* this, PlayState* play) { + Vec3f flamePos; - SkelAnime_Update(&this->skelAnime1); + SkelAnime_Update(&this->snapperSkelAnime); this->actor.colorFilterTimer = 100; - if (this->unk_29E > 0) { - this->unk_29E--; - if (this->unk_29E == 0) { + if (this->timer > 0) { + this->timer--; + if (this->timer == 0) { SoundSource_PlaySfxEachFrameAtFixedWorldPos(play, &this->actor.world.pos, 21, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } @@ -606,14 +750,15 @@ void func_80AD8388(EnKame* this, PlayState* play) { this->actor.scale.y = this->actor.scale.x; this->actor.scale.z = this->actor.scale.x; } - sp34.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x; - sp34.y = this->actor.world.pos.y + 15.0f; - sp34.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z; - func_800B3030(play, &sp34, &gZeroVec3f, &gZeroVec3f, 100, 0, 2); + + flamePos.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x; + flamePos.y = this->actor.world.pos.y + 15.0f; + flamePos.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z; + func_800B3030(play, &flamePos, &gZeroVec3f, &gZeroVec3f, 100, 0, 2); } } -void func_80AD84C0(EnKame* this, PlayState* play) { +void EnKame_UpdateDamage(EnKame* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -623,63 +768,64 @@ void func_80AD84C0(EnKame* this, PlayState* play) { return; } - func_80AD7018(this, play); - if (this->actor.colChkInfo.damageEffect == 13) { + EnKame_Thaw(this, play); + if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_HOOKSHOT) { return; } - if (this->actor.colChkInfo.damageEffect == 14) { - func_80AD8148(this, play); - } else if (this->actor.colChkInfo.damageEffect == 15) { + if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_INSTANT_KILL) { + EnKame_SetupDead(this, play); + } else if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_FLIP_OVER) { if (this->collider.base.acFlags & AC_HARD) { - func_80AD7C54(this); + EnKame_SetupFlip(this); } else if (!Actor_ApplyDamage(&this->actor)) { - func_80AD8148(this, play); + EnKame_SetupDead(this, play); } else { - func_80AD8060(this); + EnKame_SetupDamaged(this); } - } else if ((this->actionFunc == func_80AD70EC) || (this->actionFunc == func_80AD7254)) { - func_80AD73A8(this); - this->unk_29E = 21; + } else if ((this->actionFunc == EnKame_Idle) || (this->actionFunc == EnKame_Walk)) { + EnKame_SetupRetreatIntoShell(this); + this->timer = 21; } else if (!(this->collider.base.acFlags & AC_HARD)) { - if (this->actor.colChkInfo.damageEffect == 5) { - this->unk_2A2 = 40; + if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_ELECTRIC_STUN) { + this->stunTimer = 40; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffScale = 0.6f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; - func_80AD7FA4(this); - } else if (this->actor.colChkInfo.damageEffect == 1) { - this->unk_2A2 = 40; + EnKame_SetupStunned(this); + } else if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_STUN) { + this->stunTimer = 40; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); - func_80AD7FA4(this); - } else if (this->actor.colChkInfo.damageEffect == 3) { - func_80AD6F9C(this); + EnKame_SetupStunned(this); + } else if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_FREEZE) { + EnKame_Freeze(this); if (!Actor_ApplyDamage(&this->actor)) { - this->unk_2A2 = 3; + this->stunTimer = 3; this->collider.base.acFlags &= ~AC_ON; } - func_80AD7FA4(this); + + EnKame_SetupStunned(this); } else { - if (this->actor.colChkInfo.damageEffect == 2) { + if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_FIRE) { this->drawDmgEffScale = 0.6f; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - } else if (this->actor.colChkInfo.damageEffect == 4) { + } else if (this->actor.colChkInfo.damageEffect == EN_KAME_DMGEFF_LIGHT_ORB) { this->drawDmgEffScale = 0.6f; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } if (!Actor_ApplyDamage(&this->actor)) { - func_80AD8148(this, play); + EnKame_SetupDead(this, play); } else { - func_80AD8060(this); + EnKame_SetupDamaged(this); } } } @@ -687,8 +833,8 @@ void func_80AD84C0(EnKame* this, PlayState* play) { if ((play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f)) && (this->collider.base.acFlags & AC_ON)) { - func_80AD7018(this, play); - func_80AD7C54(this); + EnKame_Thaw(this, play); + EnKame_SetupFlip(this); } } @@ -696,22 +842,21 @@ void EnKame_Update(Actor* thisx, PlayState* play) { s32 pad; EnKame* this = THIS; - func_80AD6F34(this); + EnKame_Blink(this); - if (this->unk_2A0 != 0) { - this->unk_2A0--; - } + DECR(this->voiceTimer); - func_80AD84C0(this, play); + EnKame_UpdateDamage(this, play); if ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.atFlags & AT_BOUNCED)) { this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); - func_80AD76CC(this); - if (Actor_WorldDistXZToPoint(&this->actor, &this->unk_2BC) < 50.0f) { + EnKame_SetupPrepareToAttack(this); + if (Actor_WorldDistXZToPoint(&this->actor, &this->targetPos) < 50.0f) { this->collider.base.atFlags &= ~AT_ON; } - this->unk_2A6 = 0x3B00; - func_80AD7568(this); + + this->angularVelocityY = 0x3B00; + EnKame_SetAttackSpeed(this); } this->actionFunc(this, play); @@ -721,6 +866,8 @@ void EnKame_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); + // When the Snapper is in the middle of the animation where it's flipping upright, + // setting the focus and updating the collider is handled in EnKame_Draw instead. if (this->actor.shape.shadowDraw != NULL) { Actor_SetFocus(&this->actor, 25.0f); Collider_UpdateCylinder(&this->actor, &this->collider); @@ -745,102 +892,149 @@ void EnKame_Update(Actor* thisx, PlayState* play) { } else { this->drawDmgEffScale = this->drawDmgEffScale; } - } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.6f, 0.015000001f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.6f, 15.0f * 0.001f)) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } -s32 func_80AD8A48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnKame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKame* this = THIS; - if ((this->actionFunc == func_80AD7424) || (this->actionFunc == func_80AD7B90)) { - if (limbIndex == 2) { - Matrix_Scale(this->unk_2A8, this->unk_2AC, this->unk_2A8, MTXMODE_APPLY); - } else if ((limbIndex == 11) || (limbIndex == 9) || (limbIndex == 7) || (limbIndex == 5)) { - Matrix_Scale(this->unk_2A8, this->unk_2AC, this->unk_2AC, MTXMODE_APPLY); + if ((this->actionFunc == EnKame_RetreatIntoShell) || (this->actionFunc == EnKame_EmergeFromShell)) { + if (limbIndex == SNAPPER_LIMB_HEAD) { + Matrix_Scale(this->limbScaleXZ, this->limbScaleY, this->limbScaleXZ, MTXMODE_APPLY); + } else if ((limbIndex == SNAPPER_LIMB_BACK_RIGHT_LEG) || (limbIndex == SNAPPER_LIMB_BACK_LEFT_LEG) || + (limbIndex == SNAPPER_LIMB_FRONT_RIGHT_LEG) || (limbIndex == SNAPPER_LIMB_FRONT_LEFT_LEG)) { + Matrix_Scale(this->limbScaleXZ, this->limbScaleY, this->limbScaleY, MTXMODE_APPLY); } } + return false; } -void func_80AD8AF8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80AD8E68[] = { - { 1500.0f, 0.0f, -2000.0f }, { 1500.0f, 0.0f, 2000.0f }, { 1500.0f, 2000.0f, 0.0f }, - { 1500.0f, -2000.0f, 0.0f }, { 2500.0f, 0.0f, 0.0f }, - }; - static s8 D_80AD8EA4[] = { -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, 3, -1, 4 }; +/** + * Five of the entries in the body parts array are used for rendering + * multiple effects on the Snapper's body limb. The positions of these + * effects are offset from the body limb using the values in this array. + */ +static Vec3f sBodyLimbBodyPartOffsets[] = { + { 1500.0f, 0.0f, -2000.0f }, // SNAPPER_BODYPART_BODY_1 + { 1500.0f, 0.0f, 2000.0f }, // SNAPPER_BODYPART_BODY_2 + { 1500.0f, 2000.0f, 0.0f }, // SNAPPER_BODYPART_BODY_3 + { 1500.0f, -2000.0f, 0.0f }, // SNAPPER_BODYPART_BODY_4 + { 2500.0f, 0.0f, 0.0f }, // SNAPPER_BODYPART_BODY_5 +}; + +static s8 sLimbToBodyParts[SNAPPER_LIMB_MAX] = { + BODYPART_NONE, // SNAPPER_LIMB_NONE + BODYPART_NONE, // SNAPPER_LIMB_BODY + BODYPART_NONE, // SNAPPER_LIMB_HEAD + SNAPPER_BODYPART_JAW, // SNAPPER_LIMB_JAW + BODYPART_NONE, // SNAPPER_LIMB_EYES + BODYPART_NONE, // SNAPPER_LIMB_FRONT_LEFT_LEG + SNAPPER_BODYPART_FRONT_LEFT_FOOT, // SNAPPER_LIMB_FRONT_LEFT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_FRONT_RIGHT_LEG + SNAPPER_BODYPART_FRONT_RIGHT_FOOT, // SNAPPER_LIMB_FRONT_RIGHT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_BACK_LEFT_LEG + SNAPPER_BODYPART_BACK_LEFT_FOOT, // SNAPPER_LIMB_BACK_LEFT_FOOT + BODYPART_NONE, // SNAPPER_LIMB_BACK_RIGHT_LEG + SNAPPER_BODYPART_BACK_RIGHT_FOOT, // SNAPPER_LIMB_BACK_RIGHT_FOOT +}; + +void EnKame_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnKame* this = THIS; - if (D_80AD8EA4[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80AD8EA4[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if (limbIndex == 1) { + if (limbIndex == SNAPPER_LIMB_BODY) { s32 i; - Vec3f* ptr; - Vec3f* ptr2; + Vec3f* bodyPartsPosPtr; + Vec3f* bodyLimbOffsetsPtr; + // When the Snapper is flipping itself upright, the animation will make it appear + // as if it is jumping off the ground. This is purely visual, though, so if we do + // nothing, the actor's position won't actually change during this apparent "jump", + // which causes certain things like the circle shadow and the actor's focus to look + // incorrect. To fix this, we temporarily adjust the actor's position during this + // animation so that everything looks correct. This position change is overridden + // at the end of EnKame_Draw, so from the perspective of most other functions, + // nothing really changes. if (this->actor.shape.shadowDraw == NULL) { Matrix_MultZero(&this->actor.world.pos); } - ptr2 = D_80AD8E68; - ptr = &this->limbPos[5]; - for (i = 0; i < ARRAY_COUNT(D_80AD8E68); i++) { - Matrix_MultVec3f(ptr2, ptr); - ptr2++; - ptr++; + bodyLimbOffsetsPtr = sBodyLimbBodyPartOffsets; + bodyPartsPosPtr = &this->bodyPartsPos[SNAPPER_BODYPART_BODY_1]; + for (i = 0; i < ARRAY_COUNT(sBodyLimbBodyPartOffsets); i++) { + Matrix_MultVec3f(bodyLimbOffsetsPtr, bodyPartsPosPtr); + bodyLimbOffsetsPtr++; + bodyPartsPosPtr++; } } } void EnKame_Draw(Actor* thisx, PlayState* play) { EnKame* this = THIS; - Vec3f sp40; + Vec3f originalPos; - if (this->actor.shape.shadowDraw == 0) { - Math_Vec3f_Copy(&sp40, &this->actor.world.pos); + // If the Snapper is flipping itself upright, we'll update its position inside EnKame_PostLimbDraw + // to make it better match the "jump" that it does in the animation. We want to make sure that its + // original position is restored before we exit this function, however, so we save it here before + // we ever call EnKame_PostLimbDraw. + if (this->actor.shape.shadowDraw == NULL) { + Math_Vec3f_Copy(&originalPos, &this->actor.world.pos); } OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, D_80AD8E34[this->unk_29C]); + gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->eyeIndex]); - SkelAnime_DrawFlexOpa(play, this->skelAnime1.skeleton, this->skelAnime1.jointTable, this->skelAnime1.dListCount, - func_80AD8A48, func_80AD8AF8, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + SkelAnime_DrawFlexOpa(play, this->snapperSkelAnime.skeleton, this->snapperSkelAnime.jointTable, + this->snapperSkelAnime.dListCount, EnKame_OverrideLimbDraw, EnKame_PostLimbDraw, + &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, SNAPPER_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); + // The Snapper is in the middle of the animation where it's flipping upright, and we updated its position + // in EnKame_PostLimbDraw as explained earlier. We draw the circle shadow, set the focus, and update its + // collider; all of these rely on the Snapper's position being updated earlier to match the "jump" that it + // does in its animation. Once we're done, we restore the Snappper's position back to what it was before + // because we want other functions to act like the position never changed. if (this->actor.shape.shadowDraw == NULL) { ActorShadow_DrawCircle(&this->actor, NULL, play); Actor_SetFocus(&this->actor, 25.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - Math_Vec3f_Copy(&this->actor.world.pos, &sp40); + Math_Vec3f_Copy(&this->actor.world.pos, &originalPos); } CLOSE_DISPS(play->state.gfxCtx); } -s32 Enkame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnKame_SpikedSnapperOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { EnKame* this = THIS; - if (limbIndex == 1) { + if (limbIndex == SPIKED_SNAPPER_LIMB_BODY) { pos->y -= 700.0f; } - if ((this->unk_2AC != 1.0f) && (limbIndex == 3)) { - Matrix_Scale(1.0f, this->unk_2AC, this->unk_2AC, MTXMODE_APPLY); + if ((this->spikesScale != 1.0f) && (limbIndex == SPIKED_SNAPPER_LIMB_SPIKES)) { + Matrix_Scale(1.0f, this->spikesScale, this->spikesScale, MTXMODE_APPLY); } + return false; } -void func_80AD8D64(Actor* thisx, PlayState* play) { +void EnKame_DrawSpikedSnapper(Actor* thisx, PlayState* play) { EnKame* this = THIS; Gfx_SetupDL25_Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime2.skeleton, this->skelAnime2.jointTable, this->skelAnime2.dListCount, - Enkame_OverrideLimbDraw, NULL, &this->actor); + SkelAnime_DrawFlexOpa(play, this->spikedSnapperSkelAnime.skeleton, this->spikedSnapperSkelAnime.jointTable, + this->spikedSnapperSkelAnime.dListCount, EnKame_SpikedSnapperOverrideLimbDraw, NULL, + &this->actor); } diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.h b/src/overlays/actors/ovl_En_Kame/z_en_kame.h index b6ebc3a23..2ca2f4047 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.h +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.h @@ -2,34 +2,56 @@ #define Z_EN_KAME_H #include "global.h" +#include "objects/object_tl/object_tl.h" struct EnKame; typedef void (*EnKameActionFunc)(struct EnKame*, PlayState*); +typedef enum SnapperBodyPart { + /* 0 */ SNAPPER_BODYPART_JAW, + /* 1 */ SNAPPER_BODYPART_FRONT_LEFT_FOOT, + /* 2 */ SNAPPER_BODYPART_FRONT_RIGHT_FOOT, + /* 3 */ SNAPPER_BODYPART_BACK_LEFT_FOOT, + /* 4 */ SNAPPER_BODYPART_BACK_RIGHT_FOOT, + /* 5 */ SNAPPER_BODYPART_BODY_1, + /* 6 */ SNAPPER_BODYPART_BODY_2, + /* 7 */ SNAPPER_BODYPART_BODY_3, + /* 8 */ SNAPPER_BODYPART_BODY_4, + /* 9 */ SNAPPER_BODYPART_BODY_5, + /* 10 */ SNAPPER_BODYPART_MAX +} SnapperBodyPart; + typedef struct EnKame { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelAnime1; - /* 0x188 */ Vec3s jointTable1[13]; - /* 0x1D6 */ Vec3s morphTable1[13]; - /* 0x224 */ SkelAnime skelAnime2; - /* 0x268 */ Vec3s jointTable2[4]; - /* 0x280 */ Vec3s morphTable2[4]; + /* 0x144 */ SkelAnime snapperSkelAnime; + /* 0x188 */ Vec3s snapperJointTable[SNAPPER_LIMB_MAX]; + /* 0x1D6 */ Vec3s snapperMorphTable[SNAPPER_LIMB_MAX]; + /* 0x224 */ SkelAnime spikedSnapperSkelAnime; + /* 0x268 */ Vec3s spikedSnapperJointTable[SPIKED_SNAPPER_LIMB_MAX]; + /* 0x280 */ Vec3s spikedSnapperMorphTable[SPIKED_SNAPPER_LIMB_MAX]; /* 0x298 */ EnKameActionFunc actionFunc; - /* 0x29C */ u8 unk_29C; + /* 0x29C */ u8 eyeIndex; /* 0x29D */ u8 drawDmgEffType; - /* 0x29E */ s16 unk_29E; - /* 0x2A0 */ s16 unk_2A0; - /* 0x2A2 */ s16 unk_2A2; - /* 0x2A4 */ s16 unk_2A4; - /* 0x2A6 */ s16 unk_2A6; - /* 0x2A8 */ f32 unk_2A8; - /* 0x2AC */ f32 unk_2AC; + /* 0x29E */ union { + s16 timer; + s16 targetAngularVelocityY; + s16 flipType; + }; + /* 0x2A0 */ s16 voiceTimer; + /* 0x2A2 */ s16 stunTimer; + /* 0x2A4 */ s16 targetRotY; + /* 0x2A6 */ s16 angularVelocityY; + /* 0x2A8 */ f32 limbScaleXZ; + /* 0x2AC */ union { + f32 limbScaleY; // used the Snapper's regular form (i.e., when it's walking around on its legs) + f32 spikesScale; // used for the Snapper's "spiked" form + }; /* 0x2B0 */ f32 drawDmgEffAlpha; /* 0x2B4 */ f32 drawDmgEffScale; /* 0x2B8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2BC */ Vec3f unk_2BC; - /* 0x2C8 */ Vec3f limbPos[10]; + /* 0x2BC */ Vec3f targetPos; // this actor relies on the y-position of this variable to be set in a specific way, see EnKame_SetupPrepareToAttack + /* 0x2C8 */ Vec3f bodyPartsPos[SNAPPER_BODYPART_MAX]; /* 0x340 */ ColliderCylinder collider; } EnKame; // size = 0x38C diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index ff7e4bb08..cd34383be 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -8,7 +8,7 @@ #include "objects/object_kanban/object_kanban.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnKanban*)thisx) @@ -50,8 +50,9 @@ static ColliderCylinderInit sCylinderInit = { }; static u16 sPartFlags[] = { - PART_UPPER_LEFT, PART_LEFT_UPPER, PART_LEFT_LOWER, PART_RIGHT_UPPER, PART_RIGHT_LOWER, PART_LOWER_LEFT, - PART_UPPER_RIGHT, PART_LOWER_RIGHT, PART_POST_UPPER, PART_POST_LOWER, PART_POST_STAND, + PART_UPPER_SIDE_LEFT, PART_LEFT_SIDE_UPPER, PART_LEFT_SIDE_LOWER, PART_RIGHT_SIDE_UPPER, + PART_RIGHT_SIDE_LOWER, PART_LOWER_SIDE_LEFT, PART_UPPER_SIDE_RIGHT, PART_LOWER_SIDE_RIGHT, + PART_POST_UPPER, PART_POST_LOWER, PART_POST_STAND, }; static Vec3f sPieceOffsets[] = { @@ -145,8 +146,8 @@ void EnKanban_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->actor.params != ENKANBAN_PIECE) { - this->actor.targetMode = 0; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.targetMode = TARGET_MODE_0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->unk_19A = Rand_ZeroFloat(1.9f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -186,7 +187,7 @@ void func_80954BE8(EnKanban* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->msgFlag = true; } else { - func_800B8614(&this->actor, play, 68.0f); + Actor_OfferTalk(&this->actor, play, 68.0f); } } } else { @@ -226,7 +227,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { } if (this->zTargetTimer == 1) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } if (this->partFlags == 0xFFFF) { @@ -289,40 +290,48 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->zTargetTimer = 10; } - if ((piece->partFlags & PART_UPPER_LEFT) && (piece->partFlags & PART_LOWER_RIGHT)) { + if ((piece->partFlags & PART_UPPER_SIDE_LEFT) && (piece->partFlags & PART_LOWER_SIDE_RIGHT)) { piece->pieceType = PIECE_WHOLE_SIGN; - } else if ((piece->partFlags & PART_LEFT_UPPER) && (piece->partFlags & PART_RIGHT_UPPER)) { + } else if ((piece->partFlags & PART_LEFT_SIDE_UPPER) && + (piece->partFlags & PART_RIGHT_SIDE_UPPER)) { piece->pieceType = PIECE_UPPER_HALF; - } else if ((piece->partFlags & PART_LEFT_LOWER) && (piece->partFlags & PART_RIGHT_LOWER)) { + } else if ((piece->partFlags & PART_LEFT_SIDE_LOWER) && + (piece->partFlags & PART_RIGHT_SIDE_LOWER)) { piece->pieceType = PIECE_LOWER_HALF; - } else if ((piece->partFlags & PART_UPPER_RIGHT) && (piece->partFlags & PART_LOWER_RIGHT)) { + } else if ((piece->partFlags & PART_UPPER_SIDE_RIGHT) && + (piece->partFlags & PART_LOWER_SIDE_RIGHT)) { piece->pieceType = PIECE_RIGHT_HALF; - } else if ((piece->partFlags & PART_UPPER_LEFT) && (piece->partFlags & PART_LOWER_LEFT)) { + } else if ((piece->partFlags & PART_UPPER_SIDE_LEFT) && + (piece->partFlags & PART_LOWER_SIDE_LEFT)) { piece->pieceType = PIECE_LEFT_HALF; - } else if ((piece->partFlags & PART_UPPER_LEFT) && (piece->partFlags & PART_LEFT_UPPER)) { + } else if ((piece->partFlags & PART_UPPER_SIDE_LEFT) && + (piece->partFlags & PART_LEFT_SIDE_UPPER)) { piece->pieceType = PIECE_2ND_QUAD; - } else if ((piece->partFlags & PART_UPPER_RIGHT) && (piece->partFlags & PART_RIGHT_UPPER)) { + } else if ((piece->partFlags & PART_UPPER_SIDE_RIGHT) && + (piece->partFlags & PART_RIGHT_SIDE_UPPER)) { piece->pieceType = PIECE_1ST_QUAD; - } else if ((piece->partFlags & PART_LEFT_LOWER) && (piece->partFlags & PART_LOWER_LEFT)) { + } else if ((piece->partFlags & PART_LEFT_SIDE_LOWER) && + (piece->partFlags & PART_LOWER_SIDE_LEFT)) { piece->pieceType = PIECE_3RD_QUAD; - } else if ((piece->partFlags & PART_RIGHT_LOWER) && (piece->partFlags & PART_LOWER_RIGHT)) { + } else if ((piece->partFlags & PART_RIGHT_SIDE_LOWER) && + (piece->partFlags & PART_LOWER_SIDE_RIGHT)) { piece->pieceType = PIECE_4TH_QUAD; - } else if (piece->partFlags & PART_UPPER_LEFT) { - piece->pieceType = PIECE_UPPER_LEFT; - } else if (piece->partFlags & PART_LEFT_UPPER) { - piece->pieceType = PIECE_LEFT_UPPER; - } else if (piece->partFlags & PART_LEFT_LOWER) { - piece->pieceType = PIECE_LEFT_LOWER; - } else if (piece->partFlags & PART_LOWER_LEFT) { - piece->pieceType = PIECE_LOWER_LEFT; - } else if (piece->partFlags & PART_UPPER_RIGHT) { - piece->pieceType = PIECE_UPPER_RIGHT; - } else if (piece->partFlags & PART_RIGHT_UPPER) { - piece->pieceType = PIECE_RIGHT_UPPER; - } else if (piece->partFlags & PART_RIGHT_LOWER) { - piece->pieceType = PIECE_RIGHT_LOWER; - } else if (piece->partFlags & PART_LOWER_RIGHT) { - piece->pieceType = PIECE_LOWER_RIGHT; + } else if (piece->partFlags & PART_UPPER_SIDE_LEFT) { + piece->pieceType = PIECE_UPPER_SIDE_LEFT; + } else if (piece->partFlags & PART_LEFT_SIDE_UPPER) { + piece->pieceType = PIECE_LEFT_SIDE_UPPER; + } else if (piece->partFlags & PART_LEFT_SIDE_LOWER) { + piece->pieceType = PIECE_LEFT_SIDE_LOWER; + } else if (piece->partFlags & PART_LOWER_SIDE_LEFT) { + piece->pieceType = PIECE_LOWER_SIDE_LEFT; + } else if (piece->partFlags & PART_UPPER_SIDE_RIGHT) { + piece->pieceType = PIECE_UPPER_SIDE_RIGHT; + } else if (piece->partFlags & PART_RIGHT_SIDE_UPPER) { + piece->pieceType = PIECE_RIGHT_SIDE_UPPER; + } else if (piece->partFlags & PART_RIGHT_SIDE_LOWER) { + piece->pieceType = PIECE_RIGHT_SIDE_LOWER; + } else if (piece->partFlags & PART_LOWER_SIDE_RIGHT) { + piece->pieceType = PIECE_LOWER_SIDE_RIGHT; } else if (piece->partFlags & PART_POST_UPPER) { piece->pieceType = PIECE_POST_UPPER; } else if (piece->partFlags & PART_POST_LOWER) { @@ -377,7 +386,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { piece->direction = -1; } piece->airTimer = 100; - piece->actor.flags &= ~ACTOR_FLAG_1; + piece->actor.flags &= ~ACTOR_FLAG_TARGETABLE; piece->actor.flags |= ACTOR_FLAG_2000000; this->cutMarkTimer = 5; Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_STRIKE); @@ -393,7 +402,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer > 500.0f) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->partFlags = 0xFFFF; } @@ -610,7 +619,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { } } - Math_ApproachS(&this->actor.shape.rot.x, this->direction << 0xE, 1, 0x2000); + Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); } else { this->actor.shape.rot.y += this->spinVel.y; this->actor.shape.rot.x += this->direction * 0x7D0; @@ -824,16 +833,17 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { switch (this->ocarinaFlag) { case 0: - if (play->msgCtx.ocarinaMode == 1) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE) { this->ocarinaFlag = 1; } break; case 1: - if ((play->msgCtx.ocarinaMode == 4) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_END) && + (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING)) { this->actionState = ENKANBAN_REPAIR; this->bounceX = 1; - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } break; @@ -877,7 +887,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { ((pDiff + yDiff + rDiff + this->spinRot.x + this->spinRot.z) == 0) && (this->floorRot.x == 0.0f) && (this->floorRot.z == 0.0f)) { signpost->partFlags |= this->partFlags; - signpost->actor.flags |= ACTOR_FLAG_1; + signpost->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_Kill(&this->actor); return; } @@ -890,9 +900,9 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { } static Gfx* sDisplayLists[] = { - object_kanban_DL_000CB0, object_kanban_DL_000DB8, object_kanban_DL_000E78, object_kanban_DL_000F38, - object_kanban_DL_000FF8, object_kanban_DL_0010B8, object_kanban_DL_0011C0, object_kanban_DL_0012C8, - object_kanban_DL_0013D0, object_kanban_DL_001488, object_kanban_DL_001540, + gSignUpperSideLeftModelDL, gSignLeftSideUpperModelDL, gSignLeftSideLowerModelDL, gSignRightSideUpperModelDL, + gSignRightSideLowerModelDL, gSignLowerSideLeftModelDL, gSignUpperSideRightModelDL, gSignLowerSideRightModelDL, + gSignPostUpperModelDL, gSignPostLowerModelDL, gSignPostStandModelDL, }; #include "z_en_kanban_gfx.c" @@ -923,7 +933,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_kanban_DL_000C30); + gSPDisplayList(POLY_OPA_DISP++, gSignMaterialDL); if (this->actionState != ENKANBAN_SIGN) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -982,7 +992,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, this->cutMarkAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 150, 0); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, object_kanban_DL_001630); + gSPDisplayList(POLY_XLU_DISP++, gSignParticleDL); } } diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.h b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.h index e54bb3fad..43b3b61fb 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.h +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.h @@ -5,22 +5,22 @@ struct EnKanban; -#define PART_UPPER_LEFT (1 << 0) -#define PART_LEFT_UPPER (1 << 1) -#define PART_LEFT_LOWER (1 << 2) -#define PART_RIGHT_UPPER (1 << 3) -#define PART_RIGHT_LOWER (1 << 4) -#define PART_LOWER_LEFT (1 << 5) -#define PART_UPPER_RIGHT (1 << 6) -#define PART_LOWER_RIGHT (1 << 7) +#define PART_UPPER_SIDE_LEFT (1 << 0) +#define PART_LEFT_SIDE_UPPER (1 << 1) +#define PART_LEFT_SIDE_LOWER (1 << 2) +#define PART_RIGHT_SIDE_UPPER (1 << 3) +#define PART_RIGHT_SIDE_LOWER (1 << 4) +#define PART_LOWER_SIDE_LEFT (1 << 5) +#define PART_UPPER_SIDE_RIGHT (1 << 6) +#define PART_LOWER_SIDE_RIGHT (1 << 7) #define PART_POST_UPPER (1 << 8) #define PART_POST_LOWER (1 << 9) #define PART_POST_STAND (1 << 10) -#define LEFT_HALF (PART_UPPER_LEFT | PART_LEFT_UPPER | PART_LEFT_LOWER | PART_LOWER_LEFT) -#define RIGHT_HALF (PART_UPPER_RIGHT | PART_RIGHT_UPPER | PART_RIGHT_LOWER | PART_LOWER_RIGHT) -#define UPPER_HALF (PART_POST_UPPER | PART_UPPER_RIGHT | PART_RIGHT_UPPER | PART_UPPER_LEFT | PART_LEFT_UPPER) -#define UPPERLEFT_HALF (PART_POST_UPPER | PART_UPPER_RIGHT | PART_LEFT_LOWER | PART_UPPER_LEFT | PART_LEFT_UPPER) -#define UPPERRIGHT_HALF (PART_POST_UPPER | PART_UPPER_RIGHT | PART_RIGHT_UPPER | PART_UPPER_LEFT | PART_RIGHT_LOWER) +#define LEFT_HALF (PART_UPPER_SIDE_LEFT | PART_LEFT_SIDE_UPPER | PART_LEFT_SIDE_LOWER | PART_LOWER_SIDE_LEFT) +#define RIGHT_HALF (PART_UPPER_SIDE_RIGHT | PART_RIGHT_SIDE_UPPER | PART_RIGHT_SIDE_LOWER | PART_LOWER_SIDE_RIGHT) +#define UPPER_HALF (PART_POST_UPPER | PART_UPPER_SIDE_RIGHT | PART_RIGHT_SIDE_UPPER | PART_UPPER_SIDE_LEFT | PART_LEFT_SIDE_UPPER) +#define UPPERLEFT_HALF (PART_POST_UPPER | PART_UPPER_SIDE_RIGHT | PART_LEFT_SIDE_LOWER | PART_UPPER_SIDE_LEFT | PART_LEFT_SIDE_UPPER) +#define UPPERRIGHT_HALF (PART_POST_UPPER | PART_UPPER_SIDE_RIGHT | PART_RIGHT_SIDE_UPPER | PART_UPPER_SIDE_LEFT | PART_RIGHT_SIDE_LOWER) #define ALL_PARTS (LEFT_HALF | RIGHT_HALF | PART_POST_UPPER | PART_POST_LOWER) typedef enum { @@ -42,14 +42,14 @@ typedef enum { /* 6 */ PIECE_1ST_QUAD, /* 7 */ PIECE_3RD_QUAD, /* 8 */ PIECE_4TH_QUAD, - /* 9 */ PIECE_UPPER_LEFT, - /* 10 */ PIECE_LEFT_UPPER, - /* 11 */ PIECE_LEFT_LOWER, - /* 12 */ PIECE_LOWER_LEFT, - /* 13 */ PIECE_UPPER_RIGHT, - /* 14 */ PIECE_RIGHT_UPPER, - /* 15 */ PIECE_RIGHT_LOWER, - /* 16 */ PIECE_LOWER_RIGHT, + /* 9 */ PIECE_UPPER_SIDE_LEFT, + /* 10 */ PIECE_LEFT_SIDE_UPPER, + /* 11 */ PIECE_LEFT_SIDE_LOWER, + /* 12 */ PIECE_LOWER_SIDE_LEFT, + /* 13 */ PIECE_UPPER_SIDE_RIGHT, + /* 14 */ PIECE_RIGHT_SIDE_UPPER, + /* 15 */ PIECE_RIGHT_SIDE_LOWER, + /* 16 */ PIECE_LOWER_SIDE_RIGHT, /* 17 */ PIECE_POST_UPPER, /* 18 */ PIECE_POST_LOWER, /* 100 */ PIECE_OTHER = 100 diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 34b3d6405..903b1232b 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -5,10 +5,11 @@ */ #include "z_en_karebaba.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnKarebaba*)thisx) @@ -137,7 +138,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 1, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_STOP), }; void EnKarebaba_Init(Actor* thisx, PlayState* play) { @@ -176,18 +177,18 @@ void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { } void EnKarebaba_SpawnIceEffects(EnKarebaba* this, PlayState* play) { - s32 limbPosCount; + s32 bodyPartsCount; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; if (this->actor.params == KAREBABA_MINI) { - limbPosCount = 1; + bodyPartsCount = 1; } else { - limbPosCount = 4; + bodyPartsCount = KAREBABA_BODYPART_MAX; } - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, limbPosCount, 4, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, bodyPartsCount, 4, 0.3f, 0.2f); } } @@ -203,7 +204,7 @@ void EnKarebaba_SetDamageEffects(EnKarebaba* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->hurtCollider.info.bumper.hitPos.x, this->hurtCollider.info.bumper.hitPos.y, this->hurtCollider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_SMALL_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == KAREBABA_DMGEFF_ICE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.75f; @@ -419,7 +420,7 @@ void EnKarebaba_Dying(EnKarebaba* this, PlayState* play) { this->actor.scale.y = 0.0f; this->actor.scale.x = 0.0f; this->actor.speed = 0.0f; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } @@ -451,7 +452,7 @@ void EnKarebaba_Dying(EnKarebaba* this, PlayState* play) { void EnKarebaba_SetupShrinkDie(EnKarebaba* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->timer = 3; } @@ -466,7 +467,7 @@ void EnKarebaba_ShrinkDie(EnKarebaba* this, PlayState* play) { } } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_DEKU_NUTS_1); EnKarebaba_SetupDead(this); } else { EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); @@ -499,7 +500,7 @@ void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play) { if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { EnKarebaba_SetupDead(this); } else { - Actor_OfferGetItemNearby(&this->actor, play, GI_STICKS_1); + Actor_OfferGetItemNearby(&this->actor, play, GI_DEKU_STICKS_1); } } @@ -550,7 +551,7 @@ void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play) { if (this->timer == 20) { this->actor.flags &= ~ACTOR_FLAG_10; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); if (this->actor.params == ENKAREBABA_1) { func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } @@ -595,7 +596,7 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = this->drawDmgEffScale; } } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } @@ -653,7 +654,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; s32 i; s32 stemSections; - s16 limbCount; + s16 bodyPartsCount; f32 scale = 0.01f; OPEN_DISPS(play->state.gfxCtx); @@ -693,7 +694,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sStemDLists[i]); - Matrix_MultZero(&this->bodyPartsPos[1 + i]); + Matrix_MultZero(&this->bodyPartsPos[KAREBABA_BODYPART_1 + i]); if ((i == 0) && (this->actionFunc == EnKarebaba_Dying)) { Matrix_MultZero(&this->actor.focus.pos); } @@ -719,18 +720,18 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); - Matrix_MultZero(&this->bodyPartsPos[3]); + Matrix_MultZero(&this->bodyPartsPos[KAREBABA_BODYPART_3]); } func_800AE5A0(play); if (this->actor.params == KAREBABA_MINI) { - limbCount = 1; + bodyPartsCount = 1; } else { - limbCount = ARRAY_COUNT(this->bodyPartsPos); + bodyPartsCount = KAREBABA_BODYPART_MAX; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, limbCount, this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, bodyPartsCount, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); if (this->boundFloor != 0) { diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index 045bef42a..f0edcdd0b 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -14,6 +14,14 @@ typedef enum { /* 2 */ KAREBABA_MINI } KarebabaType; +typedef enum KarebabaBodyPart { + /* 0 */ KAREBABA_BODYPART_0, + /* 1 */ KAREBABA_BODYPART_1, + /* 2 */ KAREBABA_BODYPART_2, + /* 3 */ KAREBABA_BODYPART_3, + /* 4 */ KAREBABA_BODYPART_MAX +} KarebabaBodyPart; + typedef struct EnKarebaba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -25,7 +33,7 @@ typedef struct EnKarebaba { /* 0x1F0 */ f32 drawDmgEffAlpha; /* 0x1F4 */ f32 drawDmgEffScale; /* 0x1F8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x1FC */ Vec3f bodyPartsPos[4]; + /* 0x1FC */ Vec3f bodyPartsPos[KAREBABA_BODYPART_MAX]; /* 0x22C */ CollisionPoly* boundFloor; /* 0x230 */ ColliderCylinder attackCollider; /* 0x27C */ ColliderCylinder hurtCollider; diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index cfd27fbb0..01e781ecb 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -6,7 +6,7 @@ #include "z_en_kbt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnKbt*)thisx) @@ -17,11 +17,28 @@ void EnKbt_Draw(Actor* thisx, PlayState* play); s32 func_80B33E64(PlayState* play); s32 func_80B33E8C(PlayState* play); -void func_80B33EF0(EnKbt* this, s16 arg1); +void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex); Actor* func_80B3403C(PlayState* play); void func_80B34314(EnKbt* this, PlayState* play); void func_80B34598(EnKbt* this, PlayState* play); +typedef enum EnKbtAnimation { + /* 0 */ ENKBT_ANIM_0, + /* 1 */ ENKBT_ANIM_1, + /* 2 */ ENKBT_ANIM_2, + /* 3 */ ENKBT_ANIM_3, + /* 4 */ ENKBT_ANIM_4, + /* 5 */ ENKBT_ANIM_5, + /* 6 */ ENKBT_ANIM_6, + /* 7 */ ENKBT_ANIM_7, + /* 8 */ ENKBT_ANIM_8, + /* 9 */ ENKBT_ANIM_9, + /* 10 */ ENKBT_ANIM_10, + /* 11 */ ENKBT_ANIM_11, + /* 12 */ ENKBT_ANIM_12, + /* 13 */ ENKBT_ANIM_MAX +} EnKbtAnimation; + ActorInit En_Kbt_InitVars = { ACTOR_EN_KBT, ACTORCAT_NPC, @@ -44,13 +61,13 @@ void EnKbt_Init(Actor* thisx, PlayState* play) { this->actor.home.rot.z = 0; this->unk_27E = 4; this->unk_27F = 0; - this->unk_280 = 13; + this->animIndex = ENKBT_ANIM_MAX; this->unk_282 = 13; this->unk_278 = func_80B3403C(play); this->unk_284 = 0; this->actor.textId = 0; if (func_80B33E64(play)) { - func_80B33EF0(this, 6); + EnKbt_ChangeAnim(this, ENKBT_ANIM_6); this->unk_282 = 11; if (func_80B33E8C(play)) { this->actor.textId = 0xC50; @@ -60,11 +77,11 @@ void EnKbt_Init(Actor* thisx, PlayState* play) { } this->actionFunc = func_80B34314; } else { - func_80B33EF0(this, 0); + EnKbt_ChangeAnim(this, ENKBT_ANIM_0); this->unk_282 = 0; this->actionFunc = func_80B34598; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void EnKbt_Destroy(Actor* thisx, PlayState* play) { @@ -82,27 +99,48 @@ s32 func_80B33E8C(PlayState* play) { return false; } -void func_80B33EF0(EnKbt* this, s16 arg1) { - static AnimationHeader* sAnimations[] = { - &object_kbt_Anim_000670, &object_kbt_Anim_001674, &object_kbt_Anim_002084, &object_kbt_Anim_000FE8, - &object_kbt_Anim_001940, &object_kbt_Anim_00E7BC, &object_kbt_Anim_00F0C8, &object_kbt_Anim_002710, - &object_kbt_Anim_002DE0, &object_kbt_Anim_003414, &object_kbt_Anim_003D24, &object_kbt_Anim_001BF4, - &object_kbt_Anim_002084, +void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex) { + static AnimationHeader* sAnimations[ENKBT_ANIM_MAX] = { + &object_kbt_Anim_000670, // ENKBT_ANIM_0 + &object_kbt_Anim_001674, // ENKBT_ANIM_1 + &object_kbt_Anim_002084, // ENKBT_ANIM_2 + &object_kbt_Anim_000FE8, // ENKBT_ANIM_3 + &object_kbt_Anim_001940, // ENKBT_ANIM_4 + &object_kbt_Anim_00E7BC, // ENKBT_ANIM_5 + &object_kbt_Anim_00F0C8, // ENKBT_ANIM_6 + &object_kbt_Anim_002710, // ENKBT_ANIM_7 + &object_kbt_Anim_002DE0, // ENKBT_ANIM_8 + &object_kbt_Anim_003414, // ENKBT_ANIM_9 + &object_kbt_Anim_003D24, // ENKBT_ANIM_10 + &object_kbt_Anim_001BF4, // ENKBT_ANIM_11 + &object_kbt_Anim_002084, // ENKBT_ANIM_12 }; - u8 sp38[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, + u8 animationModes[ENKBT_ANIM_MAX] = { + ANIMMODE_LOOP, // ENKBT_ANIM_0 + ANIMMODE_LOOP, // ENKBT_ANIM_1 + ANIMMODE_ONCE, // ENKBT_ANIM_2 + ANIMMODE_LOOP, // ENKBT_ANIM_3 + ANIMMODE_ONCE, // ENKBT_ANIM_4 + ANIMMODE_LOOP, // ENKBT_ANIM_5 + ANIMMODE_LOOP, // ENKBT_ANIM_6 + ANIMMODE_LOOP, // ENKBT_ANIM_7 + ANIMMODE_LOOP, // ENKBT_ANIM_8 + ANIMMODE_LOOP, // ENKBT_ANIM_9 + ANIMMODE_LOOP, // ENKBT_ANIM_10 + ANIMMODE_ONCE, // ENKBT_ANIM_11 + ANIMMODE_ONCE, // ENKBT_ANIM_12 }; - if (arg1 != this->unk_280) { - if (arg1 >= 12) { - Animation_Change(&this->skelAnime, sAnimations[arg1], -1.0f, - Animation_GetLastFrame(sAnimations[arg1]) - 1.0f, 0.0f, sp38[arg1], -5.0f); + if (this->animIndex != animIndex) { + if (animIndex >= ENKBT_ANIM_12) { + Animation_Change(&this->skelAnime, sAnimations[animIndex], -1.0f, + Animation_GetLastFrame(sAnimations[animIndex]) - 1.0f, 0.0f, animationModes[animIndex], + -5.0f); } else { - Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[arg1]), - sp38[arg1], -5.0f); + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[animIndex]), animationModes[animIndex], -5.0f); } - this->unk_280 = arg1; + this->animIndex = animIndex; } } @@ -124,11 +162,11 @@ void func_80B34078(EnKbt* this) { if (this->unk_284 > 0) { this->unk_284--; } else { - switch (this->unk_280) { - case 2: + switch (this->animIndex) { + case ENKBT_ANIM_2: switch (this->unk_282) { case 0: - func_80B33EF0(this, 12); + EnKbt_ChangeAnim(this, ENKBT_ANIM_12); break; case 5: @@ -136,21 +174,24 @@ void func_80B34078(EnKbt* this) { break; default: - func_80B33EF0(this, 5); + EnKbt_ChangeAnim(this, ENKBT_ANIM_5); break; } break; - case 12: - func_80B33EF0(this, 0); + case ENKBT_ANIM_12: + EnKbt_ChangeAnim(this, ENKBT_ANIM_0); this->actor.home.rot.z = 0; break; - case 4: - func_80B33EF0(this, 1); + case ENKBT_ANIM_4: + EnKbt_ChangeAnim(this, ENKBT_ANIM_1); this->unk_27E = 2; this->actor.home.rot.z = 0; break; + + default: + break; } } } @@ -169,74 +210,75 @@ void func_80B3415C(EnKbt* this) { switch (this->unk_282) { case 0: - if ((this->unk_280 != 2) && (this->unk_280 != 12)) { - func_80B33EF0(this, 0); + if ((this->animIndex != ENKBT_ANIM_2) && (this->animIndex != ENKBT_ANIM_12)) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_0); } break; case 1: - func_80B33EF0(this, 2); + EnKbt_ChangeAnim(this, ENKBT_ANIM_2); this->unk_282 = 0; break; case 2: - if (this->unk_280 != 12) { - func_80B33EF0(this, 3); + if (this->animIndex != ENKBT_ANIM_12) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_3); } break; case 3: - if (this->unk_280 != 1) { - func_80B33EF0(this, 4); + if (this->animIndex != ENKBT_ANIM_1) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_4); } break; case 10: - func_80B33EF0(this, 11); + EnKbt_ChangeAnim(this, ENKBT_ANIM_11); break; case 4: - func_80B33EF0(this, 2); + EnKbt_ChangeAnim(this, ENKBT_ANIM_2); this->unk_282 = 6; break; case 6: - if (this->unk_280 != 2) { - func_80B33EF0(this, 5); + if (this->animIndex != ENKBT_ANIM_2) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_5); } break; case 11: - func_80B33EF0(this, 6); + EnKbt_ChangeAnim(this, ENKBT_ANIM_6); break; case 7: - if (this->unk_280 != 2) { - func_80B33EF0(this, 7); + if (this->animIndex != ENKBT_ANIM_2) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_7); } break; case 8: - if (this->unk_280 != 2) { - func_80B33EF0(this, 8); + if (this->animIndex != ENKBT_ANIM_2) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_8); } break; case 9: - if (this->unk_280 != 2) { - func_80B33EF0(this, 9); + if (this->animIndex != ENKBT_ANIM_2) { + EnKbt_ChangeAnim(this, ENKBT_ANIM_9); } break; case 12: - func_80B33EF0(this, 10); + EnKbt_ChangeAnim(this, ENKBT_ANIM_10); + break; + + default: break; } } void func_80B34314(EnKbt* this, PlayState* play) { - s32 playerForm; - func_80B34078(this); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -250,10 +292,9 @@ void func_80B34314(EnKbt* this, PlayState* play) { } else if (this->actor.xzDistToPlayer < 250.0f) { if ((this->unk_278 != NULL) && (this->unk_278->xzDistToPlayer < 250.0f)) { if (this->unk_27C & 4) { - playerForm = gSaveContext.save.playerForm; - if (((playerForm ^ 0) != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) && - (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) && - (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) { + if ((GET_PLAYER_FORM != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) && + (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) && + (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) { this->actor.textId = 0xC38; } else if (CURRENT_DAY == 3) { this->actor.textId = 0xC39; @@ -264,19 +305,29 @@ void func_80B34314(EnKbt* this, PlayState* play) { } } - if (this->actor.textId != 0xC37) { - if (((this->actor.textId == 0xC4E) || (this->actor.textId == 0xC4F) || (this->actor.textId == 0xC50)) && - (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN)) { - this->actor.textId = 0xC37; - } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - if (func_80B33E8C(play)) { - this->actor.textId = 0xC50; - } else { - this->actor.textId = 0xC4E; - } + switch (this->actor.textId) { + case 0xC4E: + case 0xC4F: + case 0xC50: + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { + this->actor.textId = 0xC37; + } + break; + + case 0xC37: + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { + if (func_80B33E8C(play)) { + this->actor.textId = 0xC50; + } else { + this->actor.textId = 0xC4E; + } + } + break; + + default: + break; } - func_800B8614(&this->actor, play, 260.0f); + Actor_OfferTalk(&this->actor, play, 260.0f); } } func_80B3415C(this); @@ -320,7 +371,7 @@ void func_80B34598(EnKbt* this, PlayState* play) { this->unk_27E = 4; this->unk_27F = 0; this->unk_282 = 0; - func_80B33EF0(this, 12); + EnKbt_ChangeAnim(this, ENKBT_ANIM_12); break; case 0x6: @@ -404,26 +455,26 @@ void func_80B34598(EnKbt* this, PlayState* play) { case 0xC35: this->unk_27E = 4; this->unk_27F = 0; - func_80B33EF0(this, 2); + EnKbt_ChangeAnim(this, ENKBT_ANIM_2); this->unk_282 = 5; break; case 0xC36: this->unk_27E = 1; this->unk_27F = 1; - func_80B33EF0(this, 7); + EnKbt_ChangeAnim(this, ENKBT_ANIM_7); this->unk_282 = 7; break; case 0xC37: - func_80B33EF0(this, 10); + EnKbt_ChangeAnim(this, ENKBT_ANIM_10); this->unk_27E = 0; this->unk_27F = 1; break; case 0xC38: case 0xC39: - func_80B33EF0(this, 7); + EnKbt_ChangeAnim(this, ENKBT_ANIM_7); this->unk_27E = 0; this->unk_27F = 1; break; @@ -510,6 +561,9 @@ void func_80B34598(EnKbt* this, PlayState* play) { this->unk_27F = 1; this->unk_282 = 12; break; + + default: + break; } this->actor.textId = 0; diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h index eb491bf28..9a7a5cdf0 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h @@ -17,7 +17,7 @@ typedef struct EnKbt { /* 0x27C */ u16 unk_27C; /* 0x27E */ u8 unk_27E; /* 0x27F */ u8 unk_27F; - /* 0x280 */ s16 unk_280; + /* 0x280 */ s16 animIndex; /* 0x282 */ s16 unk_282; /* 0x284 */ s16 unk_284; /* 0x288 */ EnKbtActionFunc actionFunc; 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 fbb8346e5..31d98abf0 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 @@ -6,9 +6,9 @@ #include "z_en_kendo_js.h" #include "overlays/actors/ovl_En_Maruta/z_en_maruta.h" -#include "objects/object_js/object_js.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnKendoJs*)thisx) @@ -71,12 +71,21 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -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 }, +typedef enum EnKendoJsAnimation { + /* 0 */ ENKENDOJS_ANIM_0, + /* 1 */ ENKENDOJS_ANIM_1, + /* 2 */ ENKENDOJS_ANIM_2, + /* 3 */ ENKENDOJS_ANIM_3, + /* 4 */ ENKENDOJS_ANIM_4, + /* 5 */ ENKENDOJS_ANIM_MAX +} EnKendoJsAnimation; + +static AnimationInfo sAnimationInfo[ENKENDOJS_ANIM_MAX] = { + { &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_0 + { &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_1 + { &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_2 + { &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENKENDOJS_ANIM_3 + { &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_4 }; s16 D_80B27CE0[][3] = { @@ -109,7 +118,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable, - this->morphTable, 13); + this->morphTable, OBJECT_JS_LIMB_MAX); if ((CURRENT_DAY == 3) && !((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) { @@ -119,7 +128,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { this->actor.home.rot.z, 0x10); Actor_Kill(&this->actor); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_4); } } else if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) { Actor_Kill(&this->actor); @@ -133,7 +142,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { this->unk_274 = Lib_SegmentedToVirtual(path->points); } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; this->actor.child = NULL; @@ -169,8 +178,8 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) { Message_StartTextbox(play, 0x273C, &this->actor); this->unk_288 = 0x273C; - } else if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - switch (gSaveContext.save.playerForm) { + } else if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: phi_v0 = 0; break; @@ -211,7 +220,7 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { func_80B26AE8(this); } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -220,16 +229,16 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2); } else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-play->msgCtx.unk1206C); Message_StartTextbox(play, 0x2719, &this->actor); this->unk_288 = 0x2719; @@ -238,16 +247,16 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { case 1: if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2); } else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk12070) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-play->msgCtx.unk12070); Message_StartTextbox(play, 0x273A, &this->actor); this->unk_288 = 0x273A; @@ -255,9 +264,12 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { break; case 2: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x2717, &this->actor); this->unk_288 = 0x2717; + + default: + break; } } } @@ -309,6 +321,9 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) { func_80B276C4(this); func_80B276D8(this, play); break; + + default: + break; } } @@ -331,7 +346,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, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3); } if ((this->unk_288 == 0x272E) || (this->unk_288 == 0x272F) || (this->unk_288 == 0x2730)) { @@ -346,6 +361,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) { case TEXT_STATE_1: case TEXT_STATE_CLOSING: case TEXT_STATE_3: + default: break; } } @@ -442,6 +458,9 @@ s32 func_80B26BF8(EnKendoJs* this, PlayState* play) { return 1; } break; + + default: + break; } return 2; } @@ -476,6 +495,9 @@ s32 func_80B26F6C(EnKendoJs* this, PlayState* play) { return true; } break; + + default: + break; } return false; } @@ -500,7 +522,7 @@ void func_80B27030(EnKendoJs* this, PlayState* play) { this->unk_288 = 0x271A; func_80B26AE8(this); } else { - func_800B8614(&this->actor, play, 800.0f); + Actor_OfferTalk(&this->actor, play, 800.0f); } } } @@ -522,7 +544,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, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3); } this->unk_286 = 2; Message_CloseTextbox(play); @@ -547,7 +569,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; Message_StartTextbox(play, 0x2729, &this->actor); this->unk_288 = 0x2729; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2); break; default: @@ -563,7 +585,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, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_1); } if (this->unk_284 == 7) { @@ -612,7 +634,7 @@ void func_80B274BC(EnKendoJs* this, PlayState* play) { return; } - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); func_80B279F0(this, play, ((u8)Rand_Next() % 3) + 1); func_80B279F0(this, play, ((u8)Rand_Next() % 3) + 4); this->unk_290 = 0; @@ -676,7 +698,7 @@ void func_80B27774(EnKendoJs* this, PlayState* play) { func_80B26AE8(this); player->stateFlags1 &= ~PLAYER_STATE1_20; } else { - func_800B85E0(&this->actor, play, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 1000.0f, PLAYER_IA_MINUS1); } } @@ -763,7 +785,7 @@ void EnKendoJs_Update(Actor* thisx, PlayState* play) { s32 EnKendoJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKendoJs* this = THIS; - if (limbIndex == 12) { + if (limbIndex == OBJECT_JS_LIMB_0C) { rot->y -= this->unk_278.y; } return false; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h index 1992f7234..8602550e0 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h @@ -2,6 +2,7 @@ #define Z_EN_KENDO_JS_H #include "global.h" +#include "objects/object_js/object_js.h" struct EnKendoJs; @@ -17,8 +18,8 @@ typedef struct EnKendoJs { /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnKendoJsActionFunc actionFunc; - /* 0x1D8 */ Vec3s jointTable[13]; - /* 0x226 */ Vec3s morphTable[13]; + /* 0x1D8 */ Vec3s jointTable[OBJECT_JS_LIMB_MAX]; + /* 0x226 */ Vec3s morphTable[OBJECT_JS_LIMB_MAX]; /* 0x274 */ Vec3s* unk_274; /* 0x278 */ Vec3s unk_278; /* 0x27E */ Vec3s unk_27E; 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 e80807b08..5f180a285 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -5,10 +5,9 @@ */ #include "z_en_kgy.h" -#include "objects/object_kgy/object_kgy.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnKgy*)thisx) @@ -17,7 +16,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 animIndex, u8 mode, f32 morphFrames); +void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames); EnKbt* EnKgy_FindZubora(PlayState* play); ObjIcePoly* EnKgy_FindIceBlock(PlayState* play); void func_80B40D30(PlayState* play); @@ -31,6 +30,21 @@ void func_80B425A0(EnKgy* this, PlayState* play); void func_80B42714(EnKgy* this, PlayState* play); void func_80B42D28(EnKgy* this, PlayState* play); +typedef enum EnKgyAnimation { + /* -1 */ ENKGY_ANIM_NONE = -1, + /* 0 */ ENKGY_ANIM_0, + /* 1 */ ENKGY_ANIM_1, + /* 2 */ ENKGY_ANIM_2, + /* 3 */ ENKGY_ANIM_3, + /* 4 */ ENKGY_ANIM_4, + /* 5 */ ENKGY_ANIM_5, + /* 6 */ ENKGY_ANIM_6, + /* 7 */ ENKGY_ANIM_7, + /* 8 */ ENKGY_ANIM_8, + /* 9 */ ENKGY_ANIM_9, + /* 10 */ ENKGY_ANIM_MAX +} EnKgyAnimation; + ActorInit En_Kgy_InitVars = { ACTOR_EN_KGY, ACTORCAT_NPC, @@ -50,39 +64,39 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); SkelAnime_InitFlex(play, &this->skelAnime, &object_kgy_Skel_00F910, &object_kgy_Anim_004B98, this->jointTable, - this->morphTable, 23); - this->unk_2D2 = -1; + this->morphTable, OBJECT_KGY_LIMB_MAX); + this->animIndex = ENKGY_ANIM_NONE; this->unk_29C = 0; this->unk_2E4 = 0; - this->unk_2E2 = -1; + this->animIndex2 = ENKGY_ANIM_NONE; this->zubora = EnKgy_FindZubora(play); this->iceBlock = EnKgy_FindIceBlock(play); - Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); - if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || + Flags_UnsetSwitch(play, ENKGY_GET_SWITCH_FLAG(&this->actor) + 1); + if (Flags_GetSwitch(play, ENKGY_GET_SWITCH_FLAG(&this->actor)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { - Flags_SetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); + Flags_SetSwitch(play, ENKGY_GET_SWITCH_FLAG(&this->actor) + 1); play->envCtx.lightSettingOverride = 1; SET_WEEKEVENTREG(WEEKEVENTREG_21_01); if (!func_80B40D64(play)) { - EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); + EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0); this->actionFunc = func_80B425A0; this->actor.textId = 0xC35; } else if (!func_80B40DB4(play)) { - EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0); + EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0); this->actionFunc = func_80B419B0; this->actor.textId = 0xC4E; this->unk_29C |= 1; this->getItemId = GI_RUPEE_10; } else { - EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); + EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0); this->actionFunc = func_80B42714; this->actor.textId = 0xC50; } } else { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_80)) { - EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); + EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0); } else { - EnKgy_ChangeAnim(this, 0, ANIMMODE_LOOP, 0); + EnKgy_ChangeAnim(this, ENKGY_ANIM_0, ANIMMODE_LOOP, 0); } this->actionFunc = func_80B42D28; } @@ -100,7 +114,7 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.z, 255, 64, 64, -1); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_300 = -1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void EnKgy_Destroy(Actor* thisx, PlayState* play) { @@ -109,21 +123,28 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) { LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -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, - &object_kgy_Anim_001EA4, &object_kgy_Anim_003D88, - }; +static AnimationHeader* sAnimations[ENKGY_ANIM_MAX] = { + &object_kgy_Anim_004B98, // ENKGY_ANIM_0 + &object_kgy_Anim_0008FC, // ENKGY_ANIM_1 + &object_kgy_Anim_00292C, // ENKGY_ANIM_2 + &object_kgy_Anim_0042E4, // ENKGY_ANIM_3 + &object_kgy_Anim_0101F0, // ENKGY_ANIM_4 + &object_kgy_Anim_001764, // ENKGY_ANIM_5 + &object_kgy_Anim_003334, // ENKGY_ANIM_6 + &object_kgy_Anim_010B84, // ENKGY_ANIM_7 + &object_kgy_Anim_001EA4, // ENKGY_ANIM_8 + &object_kgy_Anim_003D88, // ENKGY_ANIM_9 +}; +void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) { Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames); - this->unk_2D2 = animIndex; + Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames); + this->animIndex = animIndex; } -void func_80B40BC0(EnKgy* this, s16 arg1) { - if (arg1 != this->unk_2D2) { - EnKgy_ChangeAnim(this, arg1, ANIMMODE_LOOP, -5.0f); +void EnKgy_ChangeAnimLoopMorph(EnKgy* this, s16 animIndex) { + if (this->animIndex != animIndex) { + EnKgy_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f); } } @@ -218,13 +239,13 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { if (this->unk_2E4 > 0) { this->unk_2E4--; - if ((this->unk_2E4 == 0) && (this->unk_2E2 >= 0)) { - if (this->unk_2E2 == 3) { - EnKgy_ChangeAnim(this, 3, ANIMMODE_ONCE, -5.0f); + if ((this->unk_2E4 == 0) && (this->animIndex2 > ENKGY_ANIM_NONE)) { + if (this->animIndex2 == ENKGY_ANIM_3) { + EnKgy_ChangeAnim(this, ENKGY_ANIM_3, ANIMMODE_ONCE, -5.0f); } else { - func_80B40BC0(this, this->unk_2E2); + EnKgy_ChangeAnimLoopMorph(this, this->animIndex2); } - this->unk_2E2 = -1; + this->animIndex2 = ENKGY_ANIM_NONE; } } @@ -258,14 +279,14 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { switch (this->actor.textId) { case 0xC22: this->unk_2E4 = 20; - this->unk_2E2 = 3; + this->animIndex2 = ENKGY_ANIM_3; break; case 0xC43: if (func_80B40D64(play)) { - func_80B40BC0(this, 7); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7); } else { - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); } this->unk_2E4 = 30; this->actionFunc = func_80B41A48; @@ -273,7 +294,10 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { case 0xC52: case 0xC54: - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); + break; + + default: break; } } @@ -288,7 +312,7 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { if (this->unk_2E8 == 0) { if ((this->actor.textId == 0xC1D) || (this->actor.textId == 0xC2D)) { this->unk_2E4 = 20; - this->unk_2E2 = 3; + this->animIndex2 = ENKGY_ANIM_3; func_80B40EBC(this, play, this->actor.textId); } else { func_80B40EBC(this, play, this->actor.textId); @@ -339,6 +363,9 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { } this->csIdIndex = 4; break; + + default: + break; } } @@ -361,7 +388,7 @@ void func_80B413C8(EnKgy* this) { } s32 func_80B41460(void) { - if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || + if ((GET_PLAYER_FORM != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) && (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) { return 0xC38; @@ -419,16 +446,16 @@ void func_80B4163C(EnKgy* this, PlayState* play) { this->actor.focus.pos = this->unk_2A8; if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_2D2 == 6) { + if (this->animIndex == ENKGY_ANIM_6) { if (this->getItemId > GI_NONE) { - EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0.0f); + EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0.0f); this->getItemId--; } else { - EnKgy_ChangeAnim(this, 9, ANIMMODE_ONCE, -5.0f); + EnKgy_ChangeAnim(this, ENKGY_ANIM_9, ANIMMODE_ONCE, -5.0f); this->getItemId = (s32)Rand_ZeroFloat(GI_RUPEE_PURPLE - GI_RUPEE_BLUE) + GI_RUPEE_BLUE; } } else { - EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, -5.0f); + EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, -5.0f); } SkelAnime_Update(&this->skelAnime); } @@ -446,6 +473,9 @@ void func_80B4163C(EnKgy* this, PlayState* play) { this->unk_300 = 200; Actor_PlaySfx(&this->actor, NA_SE_EV_SWORD_FORGE); break; + + default: + break; } this->lightInfo.params.point.radius = this->unk_300; @@ -587,7 +617,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -596,7 +626,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { Actor_OfferGetItem(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } @@ -608,11 +638,11 @@ void func_80B41E18(EnKgy* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 3)) { - func_80B40BC0(this, 4); + if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_3)) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); } - if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && func_80B40E54(this) == 0) { + if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0)) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { @@ -623,35 +653,44 @@ void func_80B41E18(EnKgy* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); func_80B40E74(this, play, 0xC3F); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); func_80B40E74(this, play, 0xC42); Rupees_ChangeBy(-play->msgCtx.unk1206C); } break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); func_80B40EBC(this, play, textId); break; + + default: + break; } break; case 0xC3E: switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); func_80B40E74(this, play, func_80B41460()); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); func_80B40E74(this, play, 0xC3C); break; + + default: + break; } break; + + default: + break; } } break; @@ -683,13 +722,13 @@ void func_80B41E18(EnKgy* this, PlayState* play) { this->actionFunc = func_80B425A0; func_80B413C8(this); func_80B40E18(this, 5); - func_80B40BC0(this, 4); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); this->actor.textId = 0xC35; break; case 0xC3A: func_80B40E74(this, play, func_80B41528(play)); - func_80B40BC0(this, 4); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); break; case 0xC3C: @@ -745,7 +784,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC46: case 0xC55: Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; this->unk_29C &= ~0x8; play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); @@ -758,9 +797,9 @@ void func_80B41E18(EnKgy* this, PlayState* play) { break; case 0xC47: - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); if (this->unk_29C & 8) { - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; this->unk_29C &= ~8; } func_80B40EBC(this, play, textId); @@ -780,7 +819,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC4A: case 0xC4B: - func_80B40BC0(this, 4); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); Message_CloseTextbox(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC4B; @@ -817,9 +856,15 @@ void func_80B41E18(EnKgy* this, PlayState* play) { func_80B413C8(this); func_80B40E18(this, 8); break; + + default: + break; } } break; + + default: + break; } } @@ -844,11 +889,11 @@ void func_80B425A0(EnKgy* this, PlayState* play) { this->actor.focus.pos = this->unk_2A8; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B41E18; - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); } else if (this->actor.xzDistToPlayer < 200.0f) { - func_800B8614(&this->actor, play, 210.0f); + Actor_OfferTalk(&this->actor, play, 210.0f); } } @@ -887,11 +932,11 @@ void func_80B427C8(EnKgy* this, PlayState* play) { u16 textId; if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_2D2 == 5) { - func_80B40BC0(this, 7); + if (this->animIndex == ENKGY_ANIM_5) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7); } - if (this->unk_2D2 == 3) { - func_80B40BC0(this, 4); + if (this->animIndex == ENKGY_ANIM_3) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); } } @@ -923,33 +968,36 @@ void func_80B427C8(EnKgy* this, PlayState* play) { this->actionFunc = func_80B41C54; func_80B413C8(this); func_80B40E18(this, 6); - func_80B40BC0(this, 4); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); this->actor.textId = 0xC3A; break; + + default: + break; } } func_80B40EE8(this, play); } void func_80B4296C(EnKgy* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) { - func_80B40BC0(this, 2); + if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2); } this->actor.focus.pos = this->unk_2A8; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B427C8; - if (this->unk_2D2 == 4) { - func_80B40BC0(this, 7); + if (this->animIndex == ENKGY_ANIM_4) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7); } else { - EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f); + EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f); } func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); this->actor.flags &= ~ACTOR_FLAG_10000; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_NONE); } } @@ -958,12 +1006,12 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_2D2 == 5) { - func_80B40BC0(this, 1); + if (this->animIndex == ENKGY_ANIM_5) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); } - if (this->unk_2D2 == 3) { - func_80B40BC0(this, 4); + if (this->animIndex == ENKGY_ANIM_3) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4); } } @@ -995,7 +1043,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { case 0xC20: case 0xC28: - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); play->msgCtx.msgLength = 0; this->unk_29C |= 4; this->unk_2E8 = 3; @@ -1027,7 +1075,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { case 0xC2A: this->unk_2E4 = 20; - this->unk_2E2 = 3; + this->animIndex2 = ENKGY_ANIM_3; func_80B40EBC(this, play, this->actor.textId); break; @@ -1038,43 +1086,46 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { func_80B413C8(this); func_80B40E18(this, 1); break; + + default: + break; } } func_80B40EE8(this, play); } void func_80B42D28(EnKgy* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) { - func_80B40BC0(this, 2); + if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) { + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2); } this->actor.focus.pos = this->unk_2A8; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B42A8C; if (this->actor.textId == 0xC2D) { - func_80B40BC0(this, 1); + EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1); } else { - EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f); + EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f); SET_WEEKEVENTREG(WEEKEVENTREG_20_80); } func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); } else { - if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor))) { + if (Flags_GetSwitch(play, ENKGY_GET_SWITCH_FLAG(&this->actor))) { this->actor.textId = 0xC30; this->actionFunc = func_80B4296C; SET_WEEKEVENTREG(WEEKEVENTREG_21_01); } else if (this->actor.xzDistToPlayer < 200.0f) { - if (this->unk_2D2 == 4) { + if (this->animIndex == ENKGY_ANIM_4) { this->actor.textId = 0xC2D; } else { this->actor.textId = 0xC1D; } - func_800B8614(&this->actor, play, 210.0f); + Actor_OfferTalk(&this->actor, play, 210.0f); } - if ((this->unk_2D2 == 0) && (this->actor.xzDistToPlayer < 200.0f)) { - EnKgy_ChangeAnim(this, 8, ANIMMODE_ONCE, 5.0f); + if ((this->animIndex == ENKGY_ANIM_0) && (this->actor.xzDistToPlayer < 200.0f)) { + EnKgy_ChangeAnim(this, ENKGY_ANIM_8, ANIMMODE_ONCE, 5.0f); } } } @@ -1085,7 +1136,7 @@ void EnKgy_Update(Actor* thisx, PlayState* play) { Vec3s sp30; this->actionFunc(this, play); - if (this->unk_2D2 == 2) { + if (this->animIndex == ENKGY_ANIM_2) { sp30.z = 0; sp30.y = 0; sp30.x = 0; @@ -1100,14 +1151,14 @@ s32 EnKgy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p EnKgy* this = THIS; if (!(this->unk_29C & 1)) { - if (limbIndex == 17) { + if (limbIndex == OBJECT_KGY_LIMB_11) { *dList = NULL; } - } else if (limbIndex == 16) { + } else if (limbIndex == OBJECT_KGY_LIMB_10) { *dList = NULL; } - if (limbIndex == 11) { + if (limbIndex == OBJECT_KGY_LIMB_0B) { rot->x += this->unk_2CC.y; } @@ -1119,11 +1170,11 @@ void EnKgy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, static Vec3f D_80B432E4 = { 3000.0f, 4000.0f, 300.0f }; EnKgy* this = THIS; - if (limbIndex == 11) { + if (limbIndex == OBJECT_KGY_LIMB_0B) { Matrix_MultVec3f(&D_80B432D8, &this->unk_2A8); } - if (limbIndex == 16) { + if (limbIndex == OBJECT_KGY_LIMB_10) { Matrix_MultVec3f(&D_80B432E4, &this->unk_2C0); } } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h index 94f2aabd5..9cd6f6848 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h @@ -2,6 +2,7 @@ #define Z_EN_KGY_H #include "global.h" +#include "objects/object_kgy/object_kgy.h" #include "overlays/actors/ovl_En_Kbt/z_en_kbt.h" #include "overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h" @@ -10,13 +11,13 @@ struct EnKgy; typedef void (*EnKgyActionFunc)(struct EnKgy*, PlayState*); #define ENKGY_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENKGY_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define ENKGY_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) typedef struct EnKgy { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[23]; - /* 0x212 */ Vec3s morphTable[23]; + /* 0x188 */ Vec3s jointTable[OBJECT_KGY_LIMB_MAX]; + /* 0x212 */ Vec3s morphTable[OBJECT_KGY_LIMB_MAX]; /* 0x29C */ u16 unk_29C; /* 0x2A0 */ EnKbt* zubora; /* 0x2A4 */ ObjIcePoly* iceBlock; @@ -24,10 +25,10 @@ typedef struct EnKgy { /* 0x2B4 */ Vec3f unk_2B4; /* 0x2C0 */ Vec3f unk_2C0; /* 0x2CC */ Vec3s unk_2CC; - /* 0x2D2 */ s16 unk_2D2; + /* 0x2D2 */ s16 animIndex; /* 0x2D4 */ s16 csIdList[6]; /* 0x2E0 */ s16 csIdIndex; - /* 0x2E2 */ s16 unk_2E2; + /* 0x2E2 */ s16 animIndex2; /* 0x2E4 */ s16 unk_2E4; /* 0x2E6 */ s16 unk_2E6; /* 0x2E8 */ s16 unk_2E8; diff --git a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c index c9d40c1e7..d1edd3880 100644 --- a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c +++ b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c @@ -6,7 +6,7 @@ #include "z_en_kitan.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnKitan*)thisx) diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c index 0d80d6020..fd4bc7a5b 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c @@ -7,7 +7,7 @@ #include "z_en_knight.h" #include "z64shrink_window.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnKnight*)thisx) diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 77c7e1dc9..24fa855c5 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -9,7 +9,7 @@ #include "z_en_kujiya.h" #include "objects/object_kujiya/object_kujiya.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnKujiya*)thisx) @@ -46,21 +46,21 @@ ActorInit En_Kujiya_InitVars = { (ActorFunc)EnKujiya_Draw, }; -#define CHECK_LOTTERY_NUMBERS \ - (((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0]) == \ - ((((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF00) >> 8)) && \ - ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][1]) == \ - ((((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF0) >> 4)) && \ - ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][2]) == \ - (((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF))) +#define CHECK_LOTTERY_NUMBERS() \ + (((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0]) == \ + ((HS_GET_LOTTERY_CODE_GUESS() & 0xF00) >> 8)) && \ + ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][1]) == \ + ((HS_GET_LOTTERY_CODE_GUESS() & 0xF0) >> 4)) && \ + ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][2]) == \ + (HS_GET_LOTTERY_CODE_GUESS() & 0xF))) void EnKujiya_Init(Actor* thisx, PlayState* play) { EnKujiya* this = THIS; Actor_SetScale(&this->actor, 0.1f); - this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.targetMode = 6; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_6; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; @@ -104,7 +104,7 @@ void EnKujiya_Wait(EnKujiya* this, PlayState* play) { (this->actor.shape.rot.y == 0)) { EnKujiya_SetupTurnToOpen(this); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -112,17 +112,17 @@ void EnKujiya_HandlePlayerChoice(EnKujiya* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { // Buy if (gSaveContext.save.saveInfo.playerData.rupees < 10) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2B62, &this->actor); this->textId = 0x2B62; // Not enough Rupees } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-10); Message_StartTextbox(play, 0x2B5F, &this->actor); this->textId = 0x2B5F; // Enter number } } else { // Don't buy - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x2B5E, &this->actor); this->textId = 0x2B5E; // Too bad } @@ -159,7 +159,7 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) { break; case 0x2B65: - if (CHECK_LOTTERY_NUMBERS) { + if (CHECK_LOTTERY_NUMBERS()) { Message_StartTextbox(play, 0x2B66, &this->actor); this->textId = 0x2B66; // Won 50 Rupees } else { @@ -173,6 +173,9 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) { EnKujiya_SetupGivePrize(this); EnKujiya_GivePrize(this, play); break; + + default: + break; } } } @@ -207,6 +210,9 @@ void EnKujiya_Talk(EnKujiya* this, PlayState* play) { this->textId = 0x2B60; // Will announce winning numbers after 6 } break; + + default: + break; } } @@ -251,6 +257,9 @@ s32 EnKujiya_CheckBoughtTicket(void) { return true; } break; + + default: + break; } return false; } @@ -268,6 +277,9 @@ void EnKujiya_SetBoughtTicket(void) { case 3: SET_WEEKEVENTREG(WEEKEVENTREG_33_40); break; + + default: + break; } } @@ -287,6 +299,9 @@ void EnKujiya_UnsetBoughtTicket(void) { case 3: CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_40); break; + + default: + break; } } @@ -314,7 +329,7 @@ void EnKujiya_TurnToOpen(EnKujiya* this, PlayState* play) { this->timer++; } } else { - func_800B9010(&this->actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG); } } @@ -342,7 +357,7 @@ void EnKujiya_TurnToClosed(EnKujiya* this, PlayState* play) { this->timer++; } } else { - func_800B9010(&this->actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG); } } 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 16ce97153..dafd131ee 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -4,11 +4,11 @@ * Description: Grass / Bush */ -#include "prevent_bss_reordering.h" #include "z_en_kusa.h" #include "objects/object_kusa/object_kusa.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000) @@ -70,7 +70,7 @@ ActorInit En_Kusa_InitVars = { (ActorFunc)NULL, }; -static s16 objectIds[] = { GAMEPLAY_FIELD_KEEP, OBJECT_KUSA, OBJECT_KUSA, OBJECT_KUSA }; +static s16 sObjectIds[] = { GAMEPLAY_FIELD_KEEP, OBJECT_KUSA, OBJECT_KUSA, OBJECT_KUSA }; static ColliderCylinderInit sCylinderInit = { { @@ -251,8 +251,8 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { } } 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_PARAM_3F(&this->actor)); + } else { // ENKUSA_TYPE_GRASS_2 + collectible = func_800A8150(KUSA_GET_PARAM_FC(&this->actor)); if (collectible >= 0) { collectableParams = KUSA_GET_COLLECTIBLE_ID(&this->actor); Item_DropCollectible(play, &this->actor.world.pos, (collectableParams << 8) | collectible); @@ -307,7 +307,7 @@ void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) & 7; EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 0x50, - -1, 1, gKakeraLeafMiddle); + -1, 1, gKakeraLeafMiddleDL); pos.x = this->actor.world.pos.x + (directon->x * this->actor.scale.x * 40.0f); pos.y = this->actor.world.pos.y + (directon->y * this->actor.scale.y * 40.0f) + 10.0f; @@ -319,7 +319,7 @@ void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) % 7; EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 0x50, - -1, 1, gKakeraLeafTip); + -1, 1, gKakeraLeafTipDL); } } @@ -327,9 +327,9 @@ void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { u32 numBugs; for (numBugs = 0; numBugs < 3; numBugs++) { - Actor* bug = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.csId, this->actor.halfDaysBits, 0); + Actor* bug = Actor_SpawnAsChildAndCutscene( + &play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, ENINSECT_PARAMS(true), this->actor.csId, this->actor.halfDaysBits, 0); if (bug == NULL) { break; @@ -393,8 +393,8 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { this->isInWater |= 1; } - this->objIndex = Object_GetIndex(&play->objectCtx, objectIds[(KUSA_GET_TYPE(&this->actor))]); - if (this->objIndex < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[(KUSA_GET_TYPE(&this->actor))]); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -428,7 +428,7 @@ void EnKusa_SetupWaitObject(EnKusa* this) { void EnKusa_WaitObject(EnKusa* this, PlayState* play) { s32 pad; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { s32 kusaType = KUSA_GET_TYPE(&this->actor); if (this->isCut) { @@ -441,7 +441,7 @@ void EnKusa_WaitObject(EnKusa* this, PlayState* play) { } else { this->actor.draw = EnKusa_DrawGrass; } - this->actor.objBankIndex = this->objIndex; + this->actor.objectSlot = this->objectSlot; this->actor.flags &= ~ACTOR_FLAG_10; } } @@ -571,6 +571,9 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { EnKusa_SetupUprootedWaitRegrow(this); this->actor.shape.shadowDraw = NULL; break; + + default: + break; } } else { @@ -621,9 +624,13 @@ void EnKusa_SetupCut(EnKusa* this) { case ENKUSA_TYPE_GRASS_2: this->actionFunc = EnKusa_DoNothing; break; + case ENKUSA_TYPE_REGROWING_GRASS: this->actionFunc = EnKusa_CutWaitRegrow; break; + + default: + break; } this->timer = 0; } @@ -729,7 +736,7 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { EnKusa* this = THIS; if (this->isCut) { - Gfx_DrawDListOpa(play, gKusaStump); + Gfx_DrawDListOpa(play, gKusaStumpDL); } else { if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && (this->actionFunc == EnKusa_WaitForInteract)) { @@ -737,6 +744,6 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } } - Gfx_DrawDListOpa(play, gKusaSprout); + Gfx_DrawDListOpa(play, gKusaSproutDL); } } 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 b231f3e0e..9e46f8b22 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -7,6 +7,19 @@ struct EnKusa; typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); +#define KUSA_GET_TYPE(thisx)((thisx)->params & 0x3) + +// `ENKUSA_TYPE_BUSH` and `ENKUSA_TYPE_GRASS` +#define KUSA_GET_RAND_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0xF) +#define KUSA_GET_PARAM_0C(thisx) (((thisx)->params >> 12) & 1) + +// `ENKUSA_TYPE_REGROWING_GRASS`, `ENKUSA_TYPE_BUSH` and `ENKUSA_TYPE_GRASS` +#define KUSA_SHOULD_SPAWN_BUGS(thisx) (((thisx)->params >> 4) & 1) + +// `ENKUSA_TYPE_GRASS_2` +#define KUSA_GET_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0x7F) +#define KUSA_GET_PARAM_FC(thisx) (((thisx)->params >> 2) & 0x3F) + typedef enum { /* 0 */ ENKUSA_TYPE_BUSH, /* 1 */ ENKUSA_TYPE_REGROWING_GRASS, @@ -14,24 +27,28 @@ typedef enum { /* 3 */ ENKUSA_TYPE_GRASS_2 } EnKusaType; +#define KUSA_BUSH_PARAMS(spawnBugs, randCollectibleId, param0C) \ + ((ENKUSA_TYPE_BUSH & 0x3) | (((spawnBugs) & 1) << 4) | (((randCollectibleId) & 0xF) << 8) | (((param0C) & 1) << 12)) + +#define KUSA_REGROWING_GRASS_PARAMS(spawnBugs) \ + ((ENKUSA_TYPE_REGROWING_GRASS & 0x3) | (((spawnBugs) & 1) << 4)) + +#define KUSA_GRASS_PARAMS(spawnBugs, randCollectibleId, param0C) \ + ((ENKUSA_TYPE_GRASS & 0x3) | (((spawnBugs) & 1) << 4) | (((randCollectibleId) & 0xF) << 8) | (((param0C) & 1) << 12)) + +#define KUSA_GRASS_2_PARAMS(paramFC, collectibleId) \ + ((ENKUSA_TYPE_GRASS_2 & 0x3) | (((paramFC) & 0x3F) << 2) | (((collectibleId) & 0x7F) << 8)) + + typedef struct EnKusa { /* 0x000 */ Actor actor; /* 0x144 */ EnKusaActionFunc actionFunc; /* 0x148 */ ColliderCylinder collider; /* 0x194 */ u8 timer; - /* 0x195 */ s8 objIndex; + /* 0x195 */ s8 objectSlot; /* 0x196 */ s8 kusaMtxIdx; /* 0x197 */ u8 isCut; /* 0x198 */ u8 isInWater; } EnKusa; // size = 0x19C -#define KUSA_GET_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0x7F) -#define KUSA_GET_RAND_COLLECTIBLE_ID(thisx) (((thisx)->params >> 8) & 0xF) -#define KUSA_SHOULD_SPAWN_BUGS(thisx) (((thisx)->params >> 0x4) & 1) -#define KUSA_GET_PARAM_0C(thisx) (((thisx)->params >> 0xC) & 0x1) -#define KUSA_GET_PARAM_3F(thisx) (((thisx)->params >> 0x2) & 0x3F) - - -#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.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index cfc3efdc0..e471eb8f7 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -4,6 +4,7 @@ * Description: Keaton grass */ +#include "prevent_bss_reordering.h" #include "z_en_kusa2.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -111,7 +112,7 @@ void func_80A5B160(EnKusa2* this, PlayState* play) { } for (i = 1; i < ARRAY_COUNT(this->unk_194); i++) { - temp_s1 = (i << 0xD) - 0x2000; + temp_s1 = (i * 0x2000) - 0x2000; if (this->unk_194[i] == NULL) { ptr = &this->unk_194[i]; actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( @@ -1314,8 +1315,8 @@ void EnKusa2_Update(Actor* thisx, PlayState* play) { void func_80A5E6F0(Actor* thisx, PlayState* play) { static Gfx* D_80A5EB68[] = { - gKakeraLeafTip, - gKakeraLeafMiddle, + gKakeraLeafTipDL, + gKakeraLeafMiddleDL, }; EnKusa2* this = THIS; s32 i; diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index fd7795f7c..b9044ea38 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -5,8 +5,9 @@ */ #include "z_en_lift_nuts.h" +#include "overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnLiftNuts*)thisx) @@ -15,39 +16,38 @@ void EnLiftNuts_Destroy(Actor* thisx, PlayState* play); void EnLiftNuts_Update(Actor* thisx, PlayState* play); void EnLiftNuts_Draw(Actor* thisx, PlayState* play); -void func_80AEA910(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_HandleConversation5(EnLiftNuts* this, PlayState* play); -s32 func_80AE9B8C(void); -void func_80AE9F28(EnLiftNuts* this); -void func_80AE9F70(EnLiftNuts* this, PlayState* play); -void func_80AEA044(EnLiftNuts* this, PlayState* play); -void func_80AEA0B4(EnLiftNuts* this); -void func_80AEA128(EnLiftNuts* this, PlayState* play); -void func_80AEA1A0(EnLiftNuts* this, PlayState* play); -void func_80AEABF0(EnLiftNuts* this); -void func_80AEAC64(EnLiftNuts* this, PlayState* play); -void func_80AEACF8(EnLiftNuts* this, PlayState* play); -void func_80AEAEAC(EnLiftNuts* this); -void func_80AEAF14(EnLiftNuts* this, PlayState* play); -void func_80AEAF8C(EnLiftNuts* this); -void func_80AEAFA0(EnLiftNuts* this, PlayState* play); -void func_80AEB114(EnLiftNuts* this); -void func_80AEB148(EnLiftNuts* this, PlayState* play); -void func_80AEB1C8(EnLiftNuts* this); -void func_80AEB230(EnLiftNuts* this, PlayState* play); -void func_80AEB280(EnLiftNuts* this); -void func_80AEB294(EnLiftNuts* this, PlayState* play); -void func_80AEB3E0(EnLiftNuts* this, PlayState* play); -void func_80AEB428(EnLiftNuts* this, PlayState* play); -void func_80AEB584(EnLiftNuts* this); -void func_80AEB598(EnLiftNuts* this, PlayState* play); -void func_80AEB684(EnLiftNuts* this); -void func_80AEB698(EnLiftNuts* this, PlayState* play); -void func_80AEB828(EnLiftNuts* this); -void func_80AEB8A4(EnLiftNuts* this, PlayState* play); -void func_80AEB934(EnLiftNuts* this, PlayState* play); -void func_80AEB974(EnLiftNuts* this); -void func_80AEB9E0(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupIdleHidden(EnLiftNuts* this); +void EnLiftNuts_IdleHidden(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_Burrow(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupIdle(EnLiftNuts* this); +void EnLiftNuts_RiseUp(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_Idle(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupStartConversation(EnLiftNuts* this); +void EnLiftNuts_StartConversation(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_HandleConversation(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupMove(EnLiftNuts* this); +void EnLiftNuts_Move(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupMovePlayer(EnLiftNuts* this); +void EnLiftNuts_MovePlayer(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupStartGame(EnLiftNuts* this); +void EnLiftNuts_StartGame(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupStartGameImmediately(EnLiftNuts* this); +void EnLiftNuts_StartGameImmediately(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupRunGame(EnLiftNuts* this); +void EnLiftNuts_RunGame(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupEndGame(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_EndGame(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupGiveReward(EnLiftNuts* this); +void EnLiftNuts_GiveReward(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupResumeConversation(EnLiftNuts* this); +void EnLiftNuts_ResumeConversation(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_SetupStartHiding(EnLiftNuts* this); +void EnLiftNuts_StartHiding(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_Hide(EnLiftNuts* this, PlayState* play); +void EnLiftNuts_UpdateEyes(EnLiftNuts* this); +void EnLiftNuts_SpawnDust(EnLiftNuts* this, PlayState* play); ActorInit En_Lift_Nuts_InitVars = { ACTOR_EN_LIFT_NUTS, @@ -61,34 +61,54 @@ ActorInit En_Lift_Nuts_InitVars = { (ActorFunc)EnLiftNuts_Draw, }; -static AnimationInfo sAnimations[] = { - { &object_dnt_Anim_005488, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_00B0B4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_004AA0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_0029E8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_005CA8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &object_dnt_Anim_0038CC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_003CC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &object_dnt_Anim_0012F4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_004700, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_001BC8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_003438, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -2.0f }, - { &object_dnt_Anim_001E2C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_000994, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_002268, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &object_dnt_Anim_002F08, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_00577C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_dnt_Anim_004E38, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_0029E8, 1.0f, 4.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_dnt_Anim_0029E8, 1.0f, 8.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, +typedef enum { + /* 0 */ ENLIFTNUTS_ANIM_STANDING, + /* 1 */ ENLIFTNUTS_ANIM_WALK, + /* 2 */ ENLIFTNUTS_ANIM_RISE_UP, + /* 3 */ ENLIFTNUTS_ANIM_BURROW_LONG, + /* 4 */ ENLIFTNUTS_ANIM_EXCITED_START, + /* 5 */ ENLIFTNUTS_ANIM_EXCITED_LOOP, + /* 6 */ ENLIFTNUTS_ANIM_EXCITED_END, + /* 7 */ ENLIFTNUTS_ANIM_TAKE_OFF_HAT, + /* 8 */ ENLIFTNUTS_ANIM_FLY_START, + /* 9 */ ENLIFTNUTS_ANIM_FLY_LOOP, + /* 10 */ ENLIFTNUTS_ANIM_SHOCKED_START, + /* 11 */ ENLIFTNUTS_ANIM_SHOCKED_SHAKE_HEAD, + /* 12 */ ENLIFTNUTS_ANIM_SHOCKED_POUND, + /* 13 */ ENLIFTNUTS_ANIM_SHOCKED_END, + /* 14 */ ENLIFTNUTS_ANIM_THINK, + /* 15 */ ENLIFTNUTS_ANIM_BOB, + /* 16 */ ENLIFTNUTS_ANIM_JUMP, + /* 17 */ ENLIFTNUTS_ANIM_BURROW_HALF, + /* 18 */ ENLIFTNUTS_ANIM_BURROW_SHORT, + /* 19 */ ENLIFTNUTS_ANIM_MAX +} EnLiftNutsAnimation; + +static AnimationInfo sAnimations[ENLIFTNUTS_ANIM_MAX] = { + { &gBusinessScrubStandingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubWalkAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubRiseUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubBurrowAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubExcitedStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gBusinessScrubExcitedLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubExcitedEndAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gBusinessScrubTakeOffHatAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubFlyStartAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubFlyLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubShockedStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -2.0f }, + { &gBusinessScrubShockedShakeHeadAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubShockedPoundAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubShockedEndAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gBusinessScrubThinkAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubBobAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gBusinessScrubJumpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubBurrowAnim, 1.0f, 4.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gBusinessScrubBurrowAnim, 1.0f, 8.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, }; -Gfx* D_80AEBF18[] = { - object_dnt_DL_008290, - object_dnt_DL_001350, - object_dnt_DL_001420, - NULL, -}; +Gfx* sEyeTextures[] = { gBusinessScrubEyesDL, gBusinessScrubEyesWideDL, gBusinessScrubEyesSquintDL }; + +static s32 sPad = 0; static ColliderCylinderInit sCylinderInit = { { @@ -112,48 +132,54 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -void func_80AE9A20(EnLiftNuts* this, PlayState* play) { - static s16 D_80AEBF60 = 0; - static s32 D_80AEBF64 = false; +void EnLiftNuts_AddSharedMemoryEntry(EnLiftNuts* this, PlayState* play) { + static s16 sMinigameScore = 0; + static s32 sAddedSharedMemory = false; - if (!D_80AEBF64) { - func_800B6584(play, ACTOR_EN_GAMELUPY, &D_80AEBF60, sizeof(s16)); - D_80AEBF64 = true; + if (!sAddedSharedMemory) { + Actor_AddSharedMemoryEntry(play, ACTOR_EN_GAMELUPY, &sMinigameScore, sizeof(s16)); + sAddedSharedMemory = true; } - this->ptr_1EC = &D_80AEBF60; + this->minigameScore = &sMinigameScore; } -void func_80AE9A80(EnLiftNuts* this, PlayState* play) { - static s16 D_80AEBF68 = false; +void EnLiftNuts_FreeSharedMemoryEntry(EnLiftNuts* this, PlayState* play) { + static s16 sFreedSharedMemory = false; - if (!D_80AEBF68) { - func_800B6608(play, ACTOR_EN_GAMELUPY); - D_80AEBF68 = true; + if (!sFreedSharedMemory) { + Actor_FreeSharedMemoryEntry(play, ACTOR_EN_GAMELUPY); + sFreedSharedMemory = true; } } -s32 func_80AE9AC4(EnLiftNuts* this, s32 arg1) { - static s32 D_80AEBF6C = 0; +typedef enum { + /* 0 */ ENLIFTNUTS_AUTOTALK_MODE_CHECK_OFF, + /* 1 */ ENLIFTNUTS_AUTOTALK_MODE_SET_ON, + /* 2 */ ENLIFTNUTS_AUTOTALK_MODE_SET_OFF +} EnLiftNutsAutotalkMode; - switch (arg1) { - case 0: - if (D_80AEBF6C == 0) { +s32 EnLiftNuts_Autotalk(EnLiftNuts* this, EnLiftNutsAutotalkMode mode) { + static s32 sIsAutotalkOn = false; + + switch (mode) { + case ENLIFTNUTS_AUTOTALK_MODE_CHECK_OFF: + if (!sIsAutotalkOn) { return true; } break; - case 1: - if (D_80AEBF6C == 0) { - this->unk_34E = 1; - D_80AEBF6C = 1; + case ENLIFTNUTS_AUTOTALK_MODE_SET_ON: + if (!sIsAutotalkOn) { + this->autotalk = true; + sIsAutotalkOn = true; return true; } break; - case 2: - if (D_80AEBF6C == 1) { - this->unk_34E = 0; - D_80AEBF6C = 0; + case ENLIFTNUTS_AUTOTALK_MODE_SET_OFF: + if (sIsAutotalkOn == true) { + this->autotalk = false; + sIsAutotalkOn = false; return true; } break; @@ -161,60 +187,93 @@ s32 func_80AE9AC4(EnLiftNuts* this, s32 arg1) { default: break; } + return false; } -s32 func_80AE9B4C(s32 arg0, s32 arg1) { - static s32 D_80AEBF70 = 0; +typedef enum { + /* 0 */ ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, + /* 1 */ ENLIFTNUTS_MINIGAME_STATE_MODE_SET +} EnLiftNutsMiniGameStateMode; - if (arg0 == 0) { - if (D_80AEBF70 == arg1) { +typedef enum { + /* 0 */ ENLIFTNUTS_MINIGAME_STATE_NONE, + /* 1 */ ENLIFTNUTS_MINIGAME_STATE_STARTING, + /* 2 */ ENLIFTNUTS_MINIGAME_STATE_RUNNING, + /* 3 */ ENLIFTNUTS_MINIGAME_STATE_AFTER, + /* 4 */ ENLIFTNUTS_MINIGAME_STATE_HIDING +} EnLiftNutsMiniGameState; + +/** + * Will either check or set the current minigame state based on the given mode + * + * @return boolean, based on the mode + * ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK: true if the current minigame state equals the provided state, false otherwise + * ENLIFTNUTS_MINIGAME_STATE_MODE_SET: true if the minigame state was set succesfully to the provided state, false + * otherwise + */ +s32 EnLiftNuts_MinigameState(EnLiftNutsMiniGameStateMode mode, EnLiftNutsMiniGameState state) { + static EnLiftNutsMiniGameState sMinigameState = ENLIFTNUTS_MINIGAME_STATE_NONE; + + if (mode == ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK) { + if (sMinigameState == state) { return true; } - } else if (arg0 == 1) { - D_80AEBF70 = arg1; + } else if (mode == ENLIFTNUTS_MINIGAME_STATE_MODE_SET) { + sMinigameState = state; return true; } return false; } -s32 func_80AE9B8C() { - s32 ret = 0; +s32 EnLiftNuts_GetNumDaysWon(void) { + s32 numDays = 0; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { - ret = 1; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1)) { + numDays++; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20)) { - ret++; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2)) { + numDays++; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_40)) { - ret++; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_3)) { + numDays++; } - return ret; + return numDays; } -void func_80AE9BCC(EnLiftNuts* this, PlayState* play) { - if ((this->actionFunc != func_80AEB934) && (this->actionFunc != func_80AEB8A4) && - (this->actionFunc != func_80AEACF8) && (this->actionFunc != func_80AEAC64) && - (this->actionFunc != func_80AEA044) && (this->actionFunc != func_80AEB598) && - (this->actionFunc != func_80AEB698) && !func_80AE9B4C(0, 3) && (func_80AE9B8C() == 3) && - (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && (this->actor.xzDistToPlayer < 150.0f)) { - func_80AEB828(this); +/** + * Will check if the actor should hide, and if so starts hiding. + */ +void EnLiftNuts_TryHide(EnLiftNuts* this, PlayState* play) { + if (((this->actionFunc == EnLiftNuts_Hide) || (this->actionFunc == EnLiftNuts_StartHiding) || + (this->actionFunc == EnLiftNuts_HandleConversation) || (this->actionFunc == EnLiftNuts_StartConversation) || + (this->actionFunc == EnLiftNuts_Burrow) || (this->actionFunc == EnLiftNuts_GiveReward) || + (this->actionFunc == EnLiftNuts_ResumeConversation))) { + return; + } + + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_AFTER)) { + return; + } + + if ((EnLiftNuts_GetNumDaysWon() == 3) && (GET_PLAYER_FORM == PLAYER_FORM_DEKU) && + (this->actor.xzDistToPlayer < 150.0f)) { + EnLiftNuts_SetupStartHiding(this); } } void EnLiftNuts_Init(Actor* thisx, PlayState* play) { + s32 pad; EnLiftNuts* this = THIS; Path* path; - Vec3s* pathPos; - s32 pad; + Vec3s* points; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_0029E8, this->jointTable, - this->morphTable, OBJECT_DNT_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubBurrowAnim, this->jointTable, + this->morphTable, BUSINESS_SCRUB_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); @@ -227,32 +286,32 @@ void EnLiftNuts_Init(Actor* thisx, PlayState* play) { this->actor.home.pos = bgActor->actor.world.pos; } } - this->actor.targetMode = 0; - this->unk_354 = 0; - this->unk_34E = 0; - this->unk_356 = 0; - this->unk_1E4 = 0; - this->unk_1E8 = 0; + this->actor.targetMode = TARGET_MODE_0; + this->timer = 0; + this->autotalk = false; + this->isFirstTimeHiding = false; + this->eyeTexIndex = 0; + this->unk1E8 = 0; this->actor.gravity = -2.0f; - path = &play->setupPathList[ENLIFTNUTS_GET_FF00(&this->actor)]; - pathPos = Lib_SegmentedToVirtual(path->points); - this->vec_1D8.x = pathPos->x; - this->vec_1D8.y = pathPos->y; - this->vec_1D8.z = pathPos->z; - func_80AE9A20(this, play); + path = &play->setupPathList[ENLIFTNUTS_GET_PATH_INDEX(&this->actor)]; + points = Lib_SegmentedToVirtual(path->points); + this->waypointPos.x = points[0].x; + this->waypointPos.y = points[0].y; + this->waypointPos.z = points[0].z; + EnLiftNuts_AddSharedMemoryEntry(this, play); if (!Flags_GetSwitch(play, 0x41)) { - func_80AE9B4C(1, 0); - func_80AE9F28(this); - } else if (func_80AE9AC4(this, 0)) { + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_NONE); + EnLiftNuts_SetupIdleHidden(this); + } else if (EnLiftNuts_Autotalk(this, ENLIFTNUTS_AUTOTALK_MODE_CHECK_OFF)) { Player* player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; - func_80AE9AC4(this, 1); - func_80AE9B4C(1, 3); - func_80AEA0B4(this); + EnLiftNuts_Autotalk(this, ENLIFTNUTS_AUTOTALK_MODE_SET_ON); + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_AFTER); + EnLiftNuts_SetupIdle(this); } else { - func_80AE9F28(this); + EnLiftNuts_SetupIdleHidden(this); } } @@ -260,77 +319,79 @@ void EnLiftNuts_Destroy(Actor* thisx, PlayState* play) { EnLiftNuts* this = THIS; Collider_DestroyCylinder(play, &this->collider); - func_80AE9A80(this, play); + EnLiftNuts_FreeSharedMemoryEntry(this, play); } -void func_80AE9F28(EnLiftNuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 18); - this->actionFunc = func_80AE9F70; - this->unk_354 = 0; +void EnLiftNuts_SetupIdleHidden(EnLiftNuts* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BURROW_SHORT); + this->actionFunc = EnLiftNuts_IdleHidden; + this->timer = 0; } -void func_80AE9F70(EnLiftNuts* this, PlayState* play) { - if (this->unk_354 < 40) { - this->unk_354++; +void EnLiftNuts_IdleHidden(EnLiftNuts* this, PlayState* play) { + if (this->timer < 40) { + this->timer++; } else if (this->actor.xzDistToPlayer < 100.0f) { - func_80AEA0B4(this); + EnLiftNuts_SetupIdle(this); } } -void func_80AE9FC8(EnLiftNuts* this) { - if (this->actionFunc == func_80AEA1A0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 17); +void EnLiftNuts_SetupBurrow(EnLiftNuts* this) { + if (this->actionFunc == EnLiftNuts_Idle) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BURROW_HALF); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BURROW_LONG); } Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actionFunc = func_80AEA044; + this->actionFunc = EnLiftNuts_Burrow; } -void func_80AEA044(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_Burrow(EnLiftNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80AE9F28(this); + EnLiftNuts_SetupIdleHidden(this); } else if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - func_80AEB9E0(this, play); + EnLiftNuts_SpawnDust(this, play); } } -void func_80AEA0B4(EnLiftNuts* this) { - if (func_80AE9B4C(0, 1)) { - this->actionFunc = func_80AEA1A0; +void EnLiftNuts_SetupIdle(EnLiftNuts* this) { + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_STARTING)) { + this->actionFunc = EnLiftNuts_Idle; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_RISE_UP); Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actionFunc = func_80AEA128; + this->actionFunc = EnLiftNuts_RiseUp; } } -void func_80AEA128(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_RiseUp(EnLiftNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 15); - this->actionFunc = func_80AEA1A0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BOB); + this->actionFunc = EnLiftNuts_Idle; } else if (Animation_OnFrame(&this->skelAnime, 8.0f)) { - func_80AEB9E0(this, play); + EnLiftNuts_SpawnDust(this, play); } } -void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { - if ((func_80AE9B4C(0, 3) || func_80AE9B4C(0, 1)) && (this->unk_34E == 1)) { +void EnLiftNuts_Idle(EnLiftNuts* this, PlayState* play) { + if ((EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_AFTER) || + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_STARTING)) && + (this->autotalk == true)) { this->actor.flags |= ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer > 120.0f) { - func_80AE9FC8(this); + EnLiftNuts_SetupBurrow(this); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - if (func_80AE9B4C(0, 0)) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_NONE)) { switch (CURRENT_DAY) { case 1: if ((gSaveContext.save.time > CLOCK_TIME(23, 30)) || (gSaveContext.save.time <= CLOCK_TIME(6, 0))) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1)) { Message_StartTextbox(play, 0x27D9, &this->actor); this->textId = 0x27D9; } else { @@ -345,13 +406,13 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2)) { Message_StartTextbox(play, 0x27DB, &this->actor); this->textId = 0x27DB; break; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1)) { Message_StartTextbox(play, 0x27DC, &this->actor); this->textId = 0x27DC; } else { @@ -366,13 +427,13 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { (gSaveContext.save.time <= CLOCK_TIME(6, 0))) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_40)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_3)) { Message_StartTextbox(play, 0x27DE, &this->actor); this->textId = 0x27DE; - } else if (func_80AE9B8C() == 2) { + } else if (EnLiftNuts_GetNumDaysWon() == 2) { Message_StartTextbox(play, 0x27DF, &this->actor); this->textId = 0x27DF; - } else if (func_80AE9B8C() == 1) { + } else if (EnLiftNuts_GetNumDaysWon() == 1) { Message_StartTextbox(play, 0x27E0, &this->actor); this->textId = 0x27E0; } else { @@ -381,13 +442,14 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { } break; } - } else if (func_80AE9B4C(0, 3)) { + } else if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, + ENLIFTNUTS_MINIGAME_STATE_AFTER)) { if (Flags_GetSwitch(play, 0x40)) { Flags_UnsetSwitch(play, 0x40); Inventory_SaveDekuPlaygroundHighScore(4); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && - (CURRENT_DAY == 3)) { - this->unk_354 = 0; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2) && (CURRENT_DAY == 3)) { + this->timer = 0; Message_StartTextbox(play, 0x27F4, &this->actor); this->textId = 0x27F4; } else { @@ -411,7 +473,7 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { } Flags_UnsetSwitch(play, 0x41); this->actor.flags &= ~ACTOR_FLAG_10000; - } else if (!Flags_GetSwitch(play, 0x42)) { + } else if (!Flags_GetSwitch(play, 0x42)) { // Explain Rules Flags_SetSwitch(play, 0x42); Message_StartTextbox(play, 0x27E6, &this->actor); this->textId = 0x27E6; @@ -440,18 +502,18 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { Message_StartTextbox(play, 0x27D8, &this->actor); this->textId = 0x27D8; } - func_80AEABF0(this); - } else if (func_80AE9AC4(this, 0) || (this->unk_34E == 1)) { - if (this->unk_34E == 1) { - func_800B8614(&this->actor, play, 200.0f); + EnLiftNuts_SetupStartConversation(this); + } else if (EnLiftNuts_Autotalk(this, ENLIFTNUTS_AUTOTALK_MODE_CHECK_OFF) || (this->autotalk == true)) { + if (this->autotalk == true) { + Actor_OfferTalk(&this->actor, play, 200.0f); } else if (this->actor.playerHeightRel >= -13.0f) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000, 0x500); } -void func_80AEA7A4(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_HandleConversationChoice(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { @@ -459,19 +521,19 @@ void func_80AEA7A4(EnLiftNuts* this, PlayState* play) { case 0x27E2: if (play->msgCtx.choiceIndex == 0) { // Yes if (gSaveContext.save.saveInfo.playerData.rupees >= 10) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x27E5, &this->actor); this->textId = 0x27E5; Rupees_ChangeBy(-10); } else { - play_sound(NA_SE_SY_ERROR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Audio_PlaySfx(NA_SE_SY_ERROR); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); Message_StartTextbox(play, 0x27E4, &this->actor); this->textId = 0x27E4; } } else { - func_8019F230(); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Audio_PlaySfx_MessageCancel(); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); Message_StartTextbox(play, 0x27E3, &this->actor); this->textId = 0x27E3; } @@ -480,20 +542,21 @@ void func_80AEA7A4(EnLiftNuts* this, PlayState* play) { case 0x238D: if (play->msgCtx.choiceIndex == 0) { // Yes player->stateFlags1 |= PLAYER_STATE1_20; - func_80AEB1C8(this); + EnLiftNuts_SetupStartGameImmediately(this); } else { - func_80AE9FC8(this); + EnLiftNuts_SetupBurrow(this); } break; default: - func_80AE9FC8(this); + EnLiftNuts_SetupBurrow(this); break; } } } -void func_80AEA910(EnLiftNuts* this, PlayState* play) { +// TODO: name based on TEXT_STATE_5 +void EnLiftNuts_HandleConversation5(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { @@ -513,17 +576,17 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { case 0x27E3: case 0x27E4: - func_80AE9FC8(this); + EnLiftNuts_SetupBurrow(this); break; case 0x27E5: Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; - func_80AEAEAC(this); + EnLiftNuts_SetupMove(this); break; case 0x27E6: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); switch (CURRENT_DAY) { case 1: Message_StartTextbox(play, 0x27E7, &this->actor); @@ -555,19 +618,19 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { case 0x27FA: Message_CloseTextbox(play); player->stateFlags1 &= ~PLAYER_STATE1_20; - func_80AEB114(this); + EnLiftNuts_SetupStartGame(this); break; case 0x27EE: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0x10); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_JUMP); Message_StartTextbox(play, 0x27EF, &this->actor); this->textId = 0x27EF; break; case 0x27EF: Message_CloseTextbox(play); - func_80AEB584(this); - func_80AEB598(this, play); + EnLiftNuts_SetupGiveReward(this); + EnLiftNuts_GiveReward(this, play); break; case 0x27F1: @@ -576,22 +639,22 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { break; case 0x27F2: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); Message_StartTextbox(play, 0x27F3, &this->actor); this->textId = 0x27F3; break; case 0x27F4: Message_CloseTextbox(play); - func_80AEB584(this); - func_80AEB598(this, play); + EnLiftNuts_SetupGiveReward(this); + EnLiftNuts_GiveReward(this, play); break; case 0x27F5: Message_CloseTextbox(play); - func_80AE9B4C(1, 0); + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_NONE); player->stateFlags1 &= ~PLAYER_STATE1_20; - func_80AE9FC8(this); + EnLiftNuts_SetupBurrow(this); break; case 0x27F9: @@ -605,54 +668,54 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { } } -void func_80AEABF0(EnLiftNuts* this) { - this->unk_354 = 0; +void EnLiftNuts_SetupStartConversation(EnLiftNuts* this) { + this->timer = 0; - if (this->actionFunc != func_80AEB698) { - if (func_80AE9B4C(0, 0)) { + if (this->actionFunc != EnLiftNuts_ResumeConversation) { + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_NONE)) { Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 16); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_JUMP); } - this->actionFunc = func_80AEAC64; + this->actionFunc = EnLiftNuts_StartConversation; } -void func_80AEAC64(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_StartConversation(EnLiftNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if ((this->textId == 0x27EE) || (this->textId == 0x27F4) || (this->textId == 0x27F5)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 10); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_SHOCKED_START); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_STANDING); } - this->actionFunc = func_80AEACF8; + this->actionFunc = EnLiftNuts_HandleConversation; } } -void func_80AEACF8(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_HandleConversation(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - func_80AEA7A4(this, play); + case TEXT_STATE_CHOICE: + EnLiftNuts_HandleConversationChoice(this, play); break; - case 5: - func_80AEA910(this, play); + case TEXT_STATE_5: + EnLiftNuts_HandleConversation5(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { player->stateFlags1 &= ~PLAYER_STATE1_20; - func_80AE9FC8(this); - func_80AE9AC4(this, 2); - if (func_80AE9B4C(0, 3)) { - func_80AE9B4C(1, 0); + EnLiftNuts_SetupBurrow(this); + EnLiftNuts_Autotalk(this, ENLIFTNUTS_AUTOTALK_MODE_SET_OFF); + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_AFTER)) { + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_NONE); } } break; @@ -665,22 +728,22 @@ void func_80AEACF8(EnLiftNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->textId) { case 0x27EE: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_SHOCKED_SHAKE_HEAD); break; case 0x27EF: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); break; case 0x27F4: - if (this->unk_354 == 0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); - this->unk_354++; - } else if (this->unk_354 == 4) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); - this->unk_354 = 0; + if (this->timer == 0) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_SHOCKED_SHAKE_HEAD); + this->timer++; + } else if (this->timer == 4) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_SHOCKED_POUND); + this->timer = 0; } else { - this->unk_354++; + this->timer++; } break; @@ -688,106 +751,111 @@ void func_80AEACF8(EnLiftNuts* this, PlayState* play) { break; } } - func_80AEB974(this); + EnLiftNuts_UpdateEyes(this); } -void func_80AEAEAC(EnLiftNuts* this) { +void EnLiftNuts_SetupMove(EnLiftNuts* this) { this->actor.speed = 2.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - func_80AE9AC4(this, 1); - func_80AE9B4C(1, 1); - this->actionFunc = func_80AEAF14; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); + EnLiftNuts_Autotalk(this, ENLIFTNUTS_AUTOTALK_MODE_SET_ON); + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_STARTING); + this->actionFunc = EnLiftNuts_Move; } -void func_80AEAF14(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_Move(EnLiftNuts* this, PlayState* play) { f32 dist; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 10, 0x1000, 0x500); - dist = Math_Vec3f_StepTo(&this->actor.world.pos, &this->vec_1D8, this->actor.speed); + dist = Math_Vec3f_StepTo(&this->actor.world.pos, &this->waypointPos, this->actor.speed); this->actor.world.pos.y += this->actor.gravity; if (dist == 0.0f) { - func_80AEAF8C(this); + EnLiftNuts_SetupMovePlayer(this); } } -void func_80AEAF8C(EnLiftNuts* this) { - this->actionFunc = func_80AEAFA0; +void EnLiftNuts_SetupMovePlayer(EnLiftNuts* this) { + this->actionFunc = EnLiftNuts_MovePlayer; } -void func_80AEAFA0(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_MovePlayer(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 dist; - f32 temp_fv0; + f32 magnitude; + s16 playerYaw; s16 yaw; - s16 sp28; s16 yawDiff; - sp28 = this->actor.yawTowardsPlayer - 0x8000; - yaw = Math_Vec3f_Yaw(&player->actor.world.pos, &this->actor.home.pos); - yawDiff = yaw - sp28; + yaw = this->actor.yawTowardsPlayer - 0x8000; + playerYaw = Math_Vec3f_Yaw(&player->actor.world.pos, &this->actor.home.pos); + yawDiff = playerYaw - yaw; dist = Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos); if (this->actor.xzDistToPlayer < dist) { if (ABS_ALT(yawDiff) < 0x2000) { - yaw = (yawDiff > 0) ? (yaw + 0x2000) : (yaw - 0x2000); + playerYaw = (yawDiff > 0) ? (playerYaw + 0x2000) : (playerYaw - 0x2000); } } + if (dist < 5.0f) { - temp_fv0 = 10.0f; + magnitude = 10.0f; } else if (dist < 30.0f) { - temp_fv0 = 40.0f; + magnitude = 40.0f; } else { - temp_fv0 = 80.0f; + magnitude = 80.0f; } - play->actorCtx.unk268 = 1; - func_800B6F20(play, &play->actorCtx.unk_26C, temp_fv0, yaw); + play->actorCtx.unk268 = true; + func_800B6F20(play, &play->actorCtx.unk_26C, magnitude, playerYaw); + if (dist < 5.0f) { - func_80AEA0B4(this); + EnLiftNuts_SetupIdle(this); } } -void func_80AEB114(EnLiftNuts* this) { +void EnLiftNuts_SetupStartGame(EnLiftNuts* this) { Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); - this->actionFunc = func_80AEB148; + this->actionFunc = EnLiftNuts_StartGame; } -void func_80AEB148(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_StartGame(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags3 & PLAYER_STATE3_200) { this->actor.speed = 2.0f; SET_EVENTINF(EVENTINF_34); - Interface_StartTimer(4, 0); - func_80AE9B4C(1, 2); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_RUNNING); Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); - func_80AEB280(this); + EnLiftNuts_SetupRunGame(this); } } -void func_80AEB1C8(EnLiftNuts* this) { +/** + * Does not wait for the player to pop out of the flower to start the minigame. + */ +void EnLiftNuts_SetupStartGameImmediately(EnLiftNuts* this) { this->actor.speed = 2.0f; SET_EVENTINF(EVENTINF_34); - Interface_StartTimer(4, 0); - func_80AE9B4C(1, 2); - this->actionFunc = func_80AEB230; + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_RUNNING); + this->actionFunc = EnLiftNuts_StartGameImmediately; } -void func_80AEB230(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_StartGameImmediately(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) { player->stateFlags1 &= ~PLAYER_STATE1_20; - func_80AEB280(this); + EnLiftNuts_SetupRunGame(this); } } -void func_80AEB280(EnLiftNuts* this) { - this->actionFunc = func_80AEB294; +void EnLiftNuts_SetupRunGame(EnLiftNuts* this) { + this->actionFunc = EnLiftNuts_RunGame; } -void func_80AEB294(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_RunGame(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (player->actor.floorBgId == BG_ACTOR_MAX) && @@ -795,10 +863,10 @@ void func_80AEB294(EnLiftNuts* this, PlayState* play) { (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120))) { player->stateFlags1 |= PLAYER_STATE1_20; Flags_SetSwitch(play, 0x41); - func_80AEB3E0(this, play); + EnLiftNuts_SetupEndGame(this, play); } - if (*this->ptr_1EC == 300) { + if (*this->minigameScore == (ENGAMELUPY_POINTS * 6)) { player->stateFlags1 |= PLAYER_STATE1_20; if (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]) < @@ -806,33 +874,33 @@ void func_80AEB294(EnLiftNuts* this, PlayState* play) { Flags_SetSwitch(play, 0x40); } Flags_SetSwitch(play, 0x41); - func_80AEB3E0(this, play); + EnLiftNuts_SetupEndGame(this, play); } } -void func_80AEB3E0(EnLiftNuts* this, PlayState* play) { - play_sound(NA_SE_SY_FOUND); - this->unk_354 = 0; +void EnLiftNuts_SetupEndGame(EnLiftNuts* this, PlayState* play) { + Audio_PlaySfx(NA_SE_SY_FOUND); + this->timer = 0; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - this->actionFunc = func_80AEB428; + this->actionFunc = EnLiftNuts_EndGame; } -void func_80AEB428(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_EndGame(EnLiftNuts* this, PlayState* play) { s32 pad; - if (this->unk_354 == 10) { + if (this->timer == 10) { if (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]) > gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { Message_StartTextbox(play, 0x27EA, &this->actor); this->textId = 0x27EA; - } else if (*this->ptr_1EC == 300) { + } else if (*this->minigameScore == (ENGAMELUPY_POINTS * 6)) { Message_StartTextbox(play, 0x27F8, &this->actor); this->textId = 0x27F8; } else { Message_StartTextbox(play, 0x27EC, &this->actor); this->textId = 0x27EC; } - } else if (this->unk_354 == 30) { + } else if (this->timer == 30) { CLEAR_EVENTINF(EVENTINF_34); gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = ENTRANCE(DEKU_SCRUB_PLAYGROUND, 1); gSaveContext.nextCutsceneIndex = 0; @@ -841,40 +909,45 @@ void func_80AEB428(EnLiftNuts* this, PlayState* play) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; } - this->unk_354++; + this->timer++; } -void func_80AEB584(EnLiftNuts* this) { - this->actionFunc = func_80AEB598; +void EnLiftNuts_SetupGiveReward(EnLiftNuts* this) { + this->actionFunc = EnLiftNuts_GiveReward; } -void func_80AEB598(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_GiveReward(EnLiftNuts* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && (CURRENT_DAY == 3) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_14_80)) { - SET_WEEKEVENTREG(WEEKEVENTREG_14_80); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2) && (CURRENT_DAY == 3) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_DEKU_PLAYGROUND_HEART_PIECE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_DEKU_PLAYGROUND_HEART_PIECE); } - func_80AEB684(this); - } else if ((this->textId == 0x27F4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_14_80)) { + EnLiftNuts_SetupResumeConversation(this); + } else if ((this->textId == 0x27F4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_DEKU_PLAYGROUND_HEART_PIECE)) { Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } -void func_80AEB684(EnLiftNuts* this) { - this->actionFunc = func_80AEB698; +void EnLiftNuts_SetupResumeConversation(EnLiftNuts* this) { + this->actionFunc = EnLiftNuts_ResumeConversation; } -void func_80AEB698(EnLiftNuts* this, PlayState* play) { +/** + * Resumes the current conversation after giving player the reward for winning the minigame. + */ +void EnLiftNuts_ResumeConversation(EnLiftNuts* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_10) && CHECK_WEEKEVENTREG(WEEKEVENTREG_14_20) && (CURRENT_DAY == 3)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 13); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2) && (CURRENT_DAY == 3)) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_SHOCKED_END); Message_StartTextbox(play, 0x27F5, &this->actor); this->textId = 0x27F5; - } else if (func_80AE9B8C() > 0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + } else if (EnLiftNuts_GetNumDaysWon() > 0) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_WALK); Message_StartTextbox(play, 0x27F0, &this->actor); this->textId = 0x27F0; } else { @@ -882,86 +955,85 @@ void func_80AEB698(EnLiftNuts* this, PlayState* play) { this->textId = 0x27F1; } this->actor.flags &= ~ACTOR_FLAG_10000; - func_80AEABF0(this); + EnLiftNuts_SetupStartConversation(this); switch (CURRENT_DAY) { case 1: - SET_WEEKEVENTREG(WEEKEVENTREG_14_10); + SET_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1); break; case 2: - SET_WEEKEVENTREG(WEEKEVENTREG_14_20); + SET_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2); break; case 3: - SET_WEEKEVENTREG(WEEKEVENTREG_14_40); + SET_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_3); break; default: break; } } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } -void func_80AEB828(EnLiftNuts* this) { - if (!func_80AE9B4C(0, 4)) { - func_80AE9B4C(1, 4); - this->unk_356 = 1; +void EnLiftNuts_SetupStartHiding(EnLiftNuts* this) { + if (!EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_HIDING)) { + EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_SET, ENLIFTNUTS_MINIGAME_STATE_HIDING); + this->isFirstTimeHiding = true; } - if (this->actionFunc == func_80AE9F70) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 15); + if (this->actionFunc == EnLiftNuts_IdleHidden) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BOB); } - this->unk_354 = 0; - this->actionFunc = func_80AEB8A4; + this->timer = 0; + this->actionFunc = EnLiftNuts_StartHiding; } -void func_80AEB8A4(EnLiftNuts* this, PlayState* play) { - if (this->unk_354 == 22) { - if (this->unk_356 == 1) { +void EnLiftNuts_StartHiding(EnLiftNuts* this, PlayState* play) { + if (this->timer == 22) { + if (this->isFirstTimeHiding == true) { Message_StartTextbox(play, 0x27F6, &this->actor); this->textId = 0x27F6; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 17); - this->actionFunc = func_80AEB934; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, ENLIFTNUTS_ANIM_BURROW_HALF); + this->actionFunc = EnLiftNuts_Hide; } - this->unk_354++; + this->timer++; } -void func_80AEB934(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_Hide(EnLiftNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - func_80AEB9E0(this, play); + EnLiftNuts_SpawnDust(this, play); } } -void func_80AEB974(EnLiftNuts* this) { - s16 textId = this->textId; - - switch (textId) { - default: - this->unk_1E4 = 0; - break; - +void EnLiftNuts_UpdateEyes(EnLiftNuts* this) { + switch (this->textId) { case 0x27EE: case 0x27EF: - this->unk_1E4 = 1; + this->eyeTexIndex = 1; break; case 0x27F5: - this->unk_1E4 = 2; + this->eyeTexIndex = 2; break; case 0x27F4: - if (this->unk_354 == 0) { - this->unk_1E4 = 2; - break; + if (this->timer == 0) { + this->eyeTexIndex = 2; + } else { + this->eyeTexIndex = 1; } - this->unk_1E4 = 1; + break; + + default: + this->eyeTexIndex = 0; + break; } } -void func_80AEB9E0(EnLiftNuts* this, PlayState* play) { - Vec3f worldPos = this->actor.world.pos; +void EnLiftNuts_SpawnDust(EnLiftNuts* this, PlayState* play) { + Vec3f pos = this->actor.world.pos; Vec3f velocity; Vec3f accel; Color_RGBA8 primColor = { 170, 130, 90, 255 }; @@ -978,11 +1050,11 @@ void func_80AEB9E0(EnLiftNuts* this, PlayState* play) { accel.x = -0.2f * velocity.x; accel.z = -0.2f * velocity.z; - func_800B0EB0(play, &worldPos, &velocity, &accel, &primColor, &envColor, 80, 25, 10); + func_800B0EB0(play, &pos, &velocity, &accel, &primColor, &envColor, 80, 25, 10); } } -void func_80AEBB30(EnLiftNuts* this, PlayState* play) { +void EnLiftNuts_UpdateCollision(EnLiftNuts* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -992,35 +1064,37 @@ void EnLiftNuts_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actionFunc(this, play); - func_80AEBB30(this, play); - Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); - func_80AE9BCC(this, play); + EnLiftNuts_UpdateCollision(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); + EnLiftNuts_TryHide(this, play); - if (func_80AE9B4C(0, 2)) { - thisx->flags &= ~ACTOR_FLAG_1; + if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_RUNNING)) { + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } s32 EnLiftNuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnLiftNuts* this = THIS; - if ((limbIndex == OBJECT_DNT_LIMB_0F) || (limbIndex == OBJECT_DNT_LIMB_10) || (limbIndex == OBJECT_DNT_LIMB_15) || - (limbIndex == OBJECT_DNT_LIMB_17) || (limbIndex == OBJECT_DNT_LIMB_18) || (limbIndex == OBJECT_DNT_LIMB_15) || - (limbIndex == OBJECT_DNT_LIMB_1B)) { + if ((limbIndex == BUSINESS_SCRUB_LIMB_RIGHT_HAND_HAT) || (limbIndex == BUSINESS_SCRUB_LIMB_RIGHT_HAND_BAG) || + (limbIndex == BUSINESS_SCRUB_LIMB_LEFT_HAND_BAG) || (limbIndex == BUSINESS_SCRUB_LIMB_SCALP) || + (limbIndex == BUSINESS_SCRUB_LIMB_HAIR) || (limbIndex == BUSINESS_SCRUB_LIMB_LEFT_HAND_BAG) || + (limbIndex == BUSINESS_SCRUB_LIMB_LEFT_ARM_BAG)) { *dList = NULL; } - if (limbIndex == OBJECT_DNT_LIMB_1A) { - *dList = D_80AEBF18[this->unk_1E4]; + if (limbIndex == BUSINESS_SCRUB_LIMB_EYES) { + *dList = sEyeTextures[this->eyeTexIndex]; } return false; } void EnLiftNuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f sFocusOffset = { 0.0f, 0.0f, 0.0f }; + EnLiftNuts* this = THIS; - if (limbIndex == OBJECT_DNT_LIMB_19) { - Matrix_MultVec3f(&sFocusOffset, &thisx->focus.pos); + if (limbIndex == BUSINESS_SCRUB_LIMB_HAT) { + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h index 9a54132a4..2ee5897bd 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h @@ -8,25 +8,25 @@ struct EnLiftNuts; typedef void (*EnLiftNutsActionFunc)(struct EnLiftNuts*, PlayState*); -#define ENLIFTNUTS_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) +#define ENLIFTNUTS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) typedef struct EnLiftNuts { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnLiftNutsActionFunc actionFunc; - /* 0x1D8 */ Vec3f vec_1D8; - /* 0x1E4 */ s32 unk_1E4; - /* 0x1E8 */ s32 unk_1E8; - /* 0x1EC */ s16* ptr_1EC; - /* 0x1F0 */ Vec3s jointTable[OBJECT_DNT_LIMB_MAX]; - /* 0x298 */ Vec3s morphTable[OBJECT_DNT_LIMB_MAX]; + /* 0x1D8 */ Vec3f waypointPos; + /* 0x1E4 */ s32 eyeTexIndex; + /* 0x1E8 */ s32 unk1E8; // Set but never used + /* 0x1EC */ s16* minigameScore; // Pointer to shared memory location with actor EnGamelupy + /* 0x1F0 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x298 */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX]; /* 0x340 */ UNK_TYPE1 unk_340[0xC]; /* 0x34C */ s16 textId; - /* 0x34E */ s16 unk_34E; + /* 0x34E */ s16 autotalk; /* 0x350 */ UNK_TYPE1 unk_350[0x4]; - /* 0x354 */ s16 unk_354; - /* 0x356 */ s16 unk_356; + /* 0x354 */ s16 timer; // Frame counter used for various different things + /* 0x356 */ s16 isFirstTimeHiding; } EnLiftNuts; // size = 0x358 #endif // Z_EN_LIFT_NUTS_H 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 f3c3f4705..065a58cf5 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -70,7 +70,7 @@ void EnLight_Init(Actor* thisx, PlayState* play) { if (ENLIGHT_GET_800(&this->actor)) { this->actor.update = func_80865F38; - if (ENLIGHT_GET_1000(&this->actor) && Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { + if (ENLIGHT_GET_1000(&this->actor) && Flags_GetSwitch(play, ENLIGHT_SWITCH_FLAG(&this->actor))) { Actor_SetScale(&this->actor, 0.0f); } } else if (ENLIGHT_GET_2000(&this->actor)) { @@ -124,7 +124,7 @@ void func_80865F38(Actor* thisx, PlayState* play) { s32 sp2C = false; if (ENLIGHT_GET_1000(&this->actor)) { - if (Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENLIGHT_SWITCH_FLAG(&this->actor))) { Math_StepToF(&sp30, 1.0f, 0.05f); sp2C = true; } else { @@ -134,7 +134,7 @@ void func_80865F38(Actor* thisx, PlayState* play) { } Math_StepToF(&sp30, 0.0f, 0.05f); } - } else if (Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { + } else if (Flags_GetSwitch(play, ENLIGHT_SWITCH_FLAG(&this->actor))) { if (sp30 < 0.1f) { Actor_SetScale(&this->actor, 0.0f); sp30 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.h b/src/overlays/actors/ovl_En_Light/z_en_light.h index 17762d7fa..25e1b5851 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.h +++ b/src/overlays/actors/ovl_En_Light/z_en_light.h @@ -8,7 +8,7 @@ struct EnLight; #define ENLIGHT_GET_1(thisx) ((thisx)->params & 1) #define ENLIGHT_GET_F(thisx) ((thisx)->params & 0xF) #define ENLIGHT_GET_800(thisx) ((thisx)->params & 0x800) -#define ENLIGHT_SWITCHFLAG(thisx) (((thisx)->params & 0x7F0) >> 4) +#define ENLIGHT_SWITCH_FLAG(thisx) (((thisx)->params & 0x7F0) >> 4) #define ENLIGHT_GET_1000(thisx) ((thisx)->params & 0x1000) #define ENLIGHT_GET_2000(thisx) ((thisx)->params & 0x2000) #define ENLIGHT_GET_4000(thisx) ((thisx)->params & 0x4000) 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 908bbf374..880f48e82 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 @@ -109,7 +109,7 @@ void EnLookNuts_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->pathIndex = LOOKNUTS_GET_PATH_INDEX(&this->actor); @@ -358,10 +358,10 @@ void EnLookNuts_Update(Actor* thisx, PlayState* play) { if (!(player->stateFlags3 & PLAYER_STATE3_100) && !Play_InCsMode(play)) { Math_Vec3f_Copy(&this->headRotTarget, &gZeroVec3f); this->state = PALACE_GUARD_RUNNING_TO_PLAYER; - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); func_800B7298(play, &this->actor, PLAYER_CSMODE_26); D_80A6862C = 1; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_10); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10); this->actor.gravity = 0.0f; EnLookNuts_DetectedPlayer(this, play); } else { diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 463c5b327..89b9fcfff 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -119,7 +119,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { this->collider.dim.yShift = -20; this->timer = 8; this->scroll = 0.0f; - this->actor.world.pos = player->bodyPartsPos[0]; + this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->lightColorFrac = 0.0f; this->adjustLightsArg1 = 0.0f; this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; @@ -143,11 +143,11 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_20000; this->isCharging = false; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_OBTAINED_GREAT_SPIN_ATTACK)) { player->unk_B08 = 1.0f; this->collider.info.toucher.damage = sDamages[this->type + ENMTHUNDER_TYPE_MAX]; this->subtype = ENMTHUNDER_SUBTYPE_SPIN_GREAT; - if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRY_SWORD) { + if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRYS_SWORD) { this->scaleTarget = 6; } else if (this->type == ENMTHUNDER_TYPE_GILDED_SWORD) { this->scaleTarget = 4; @@ -158,7 +158,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { player->unk_B08 = 0.5f; this->collider.info.toucher.damage = sDamages[this->type]; this->subtype = ENMTHUNDER_SUBTYPE_SPIN_REGULAR; - if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRY_SWORD) { + if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRYS_SWORD) { this->scaleTarget = 4; } else if (this->type == ENMTHUNDER_TYPE_GILDED_SWORD) { this->scaleTarget = 3; @@ -203,7 +203,7 @@ void EnMThunder_Destroy(Actor* thisx, PlayState* play) { } void EnMThunder_AdjustLights(PlayState* play, f32 arg1) { - func_800FD2B4(play, arg1, 850.0f, 0.2f, 0.0f); + Environment_AdjustLights(play, arg1, 850.0f, 0.2f, 0.0f); } void EnMThunder_Spin_AttackNoMagic(EnMThunder* this, PlayState* play) { @@ -230,7 +230,7 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) { Actor* child = this->actor.child; this->unk1B0 = player->unk_B08; - this->actor.world.pos = player->bodyPartsPos[0]; + this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; if (!this->isCharging && (player->unk_B08 >= 0.1f)) { @@ -276,7 +276,7 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) { if (player->unk_B08 < 0.85f) { this->collider.info.toucher.damage = sDamages[this->type]; this->subtype = ENMTHUNDER_SUBTYPE_SPIN_REGULAR; - if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRY_SWORD) { + if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRYS_SWORD) { this->scaleTarget = 4; } else if (this->type == ENMTHUNDER_TYPE_GILDED_SWORD) { this->scaleTarget = 3; @@ -286,7 +286,7 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) { } else { this->collider.info.toucher.damage = sDamages[this->type + ENMTHUNDER_TYPE_MAX]; this->subtype = ENMTHUNDER_SUBTYPE_SPIN_GREAT; - if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRY_SWORD) { + if (this->type == ENMTHUNDER_TYPE_GREAT_FAIRYS_SWORD) { this->scaleTarget = 6; } else if (this->type == ENMTHUNDER_TYPE_GILDED_SWORD) { this->scaleTarget = 4; @@ -336,11 +336,11 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) { } if (player->unk_B08 > 0.85f) { - func_8019F900(&player->actor.projectedPos, 2); + Audio_PlaySfx_SwordCharge(&player->actor.projectedPos, 2); } else if (player->unk_B08 > 0.15f) { - func_8019F900(&player->actor.projectedPos, 1); + Audio_PlaySfx_SwordCharge(&player->actor.projectedPos, 1); } else if (player->unk_B08 > 0.1f) { - func_8019F900(&player->actor.projectedPos, 0); + Audio_PlaySfx_SwordCharge(&player->actor.projectedPos, 0); } if (Play_InCsMode(play)) { @@ -380,8 +380,8 @@ void EnMThunder_Spin_Attack(EnMThunder* this, PlayState* play) { } if (this->timer > 0) { - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; this->timer--; } diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h index 9842eeb78..1068173e7 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h @@ -12,7 +12,7 @@ typedef enum { /* 0x00 */ ENMTHUNDER_TYPE_KOKIRI_SWORD, /* 0x01 */ ENMTHUNDER_TYPE_RAZOR_SWORD, /* 0x02 */ ENMTHUNDER_TYPE_GILDED_SWORD, - /* 0x03 */ ENMTHUNDER_TYPE_GREAT_FAIRY_SWORD, + /* 0x03 */ ENMTHUNDER_TYPE_GREAT_FAIRYS_SWORD, /* 0x80 */ ENMTHUNDER_TYPE_UNK = 0x80 } EnMThunderType; 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 29a09cd90..516112d3d 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -6,7 +6,7 @@ #include "z_en_ma4.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) #define THIS ((EnMa4*)thisx) @@ -193,7 +193,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->unk_334 = 0; this->hasBow = true; @@ -350,7 +350,7 @@ void EnMa4_Wait(EnMa4* this, PlayState* play) { EnMa4_SetupDialogueHandler(this); } else if (this->type != MA4_TYPE_ALIENS_WON || ABS_ALT(yaw) < 0x4000) { if (!(player->stateFlags1 & PLAYER_STATE1_800000)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } } @@ -361,11 +361,11 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { switch (this->textId) { case 0x3339: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x333A, &this->actor); this->textId = 0x333A; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x333B, &this->actor); this->textId = 0x333B; } @@ -373,12 +373,12 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3341: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); SET_WEEKEVENTREG(WEEKEVENTREG_PROMISED_TO_HELP_WITH_THEM); Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 0, 1); Message_StartTextbox(play, 0x3342, &this->actor); this->textId = 0x3342; @@ -389,12 +389,12 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3346: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); SET_WEEKEVENTREG(WEEKEVENTREG_PROMISED_TO_HELP_WITH_THEM); Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 0, 1); Message_StartTextbox(play, 0x3342, &this->actor); this->textId = 0x3342; @@ -403,11 +403,11 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3347: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x3348, &this->actor); this->textId = 0x3348; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_ROMANI); @@ -418,7 +418,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { // Yes s32 aux; - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x334E, &this->actor); this->textId = 0x334E; if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { @@ -426,7 +426,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { } Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_ROMANI); } else { // No. - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 0, 0); Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; @@ -435,11 +435,11 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3354: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 1, 0); Message_StartTextbox(play, 0x3355, &this->actor); this->textId = 0x3355; @@ -450,18 +450,18 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3356: // "Try again?" if (play->msgCtx.choiceIndex == 0) { // Yes - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_CloseTextbox(play); EnMa4_SetupBeginHorsebackGame(this); } else { // No if (this->type == MA4_TYPE_ALIENS_DEFEATED) { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(play, 0x3357, &this->actor); this->textId = 0x3357; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_ROMANI); } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 4, 2); Message_StartTextbox(play, 0x335B, &this->actor); this->textId = 0x335B; @@ -472,11 +472,11 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { case 0x3359: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnMa4_SetFaceExpression(this, 4, 2); Message_StartTextbox(play, 0x335A, &this->actor); this->textId = 0x335A; @@ -608,7 +608,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { break; case 0x3358: - if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { + if ((GET_PLAYER_FORM != PLAYER_FORM_HUMAN) || !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { Message_StartTextbox(play, 0x335C, &this->actor); this->textId = 0x335C; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_ROMANI); @@ -683,7 +683,7 @@ void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) { Message_StartTextbox(play, 0x336E, &this->actor); this->actionFunc = EnMa4_HorsebackGameTalking; } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(115)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -839,7 +839,7 @@ void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); sCueId = 99; this->hasBow = true; EnMa4_SetupEndEponasSongCs(this); @@ -861,7 +861,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -883,7 +883,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { switch (this->type) { case MA4_TYPE_DAY1: - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(play, 0x3337, &this->actor); @@ -916,9 +916,9 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x336D; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { + if ((s32)time < HS_GET_HORSE_BACK_BALLOON_TIME()) { // [Score] New record! - gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; + HS_SET_HORSE_BACK_BALLOON_TIME(time); EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; @@ -939,7 +939,7 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { break; case MA4_TYPE_ALIENS_DEFEATED: - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_80)) { EnMa4_SetFaceExpression(this, 3, 3); Message_StartTextbox(play, 0x3337, &this->actor); @@ -960,8 +960,8 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x3356; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { - gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; + if ((s32)time < HS_GET_HORSE_BACK_BALLOON_TIME()) { + HS_SET_HORSE_BACK_BALLOON_TIME(time); EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; @@ -987,9 +987,9 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x3356; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { + if ((s32)time < HS_GET_HORSE_BACK_BALLOON_TIME()) { // New record - gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; + HS_SET_HORSE_BACK_BALLOON_TIME(time); Message_StartTextbox(play, 0x335D, &this->actor); this->textId = 0x335D; } else { 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 5dd713019..72fcc61d6 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 @@ -7,7 +7,7 @@ #include "z_en_ma_yto.h" #include "overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) #define THIS ((EnMaYto*)thisx) @@ -147,7 +147,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { EnMaYto* this = THIS; s32 pad; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->unk200 = 0; this->unk310 = 0; this->unk320 = 0; @@ -268,7 +268,7 @@ void EnMaYto_ChooseAction(EnMaYto* this, PlayState* play) { break; case MA_YTO_TYPE_DINNER: - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; EnMaYto_SetupDinnerWait(this); break; @@ -405,7 +405,7 @@ void EnMaYto_DefaultWait(EnMaYto* this, PlayState* play) { EnMaYto_DefaultStartDialogue(this, play); EnMaYto_SetupDefaultDialogueHandler(this); } else if (ABS_ALT(direction) < 0x1555) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -449,13 +449,13 @@ void EnMaYto_DefaultDialogueHandler(EnMaYto* this, PlayState* play) { void EnMaYto_DefaultHandlePlayerChoice(EnMaYto* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { // Yes - func_8019F208(); + Audio_PlaySfx_MessageDecide(); EnMaYto_SetFaceExpression(this, 0, 3); // "Milk Road is fixed!" Message_StartTextbox(play, 0x3392, &this->actor); this->textId = 0x3392; } else { // No - func_8019F230(); + Audio_PlaySfx_MessageCancel(); // "Don't lie!" Message_StartTextbox(play, 0x3391, &this->actor); this->textId = 0x3391; @@ -525,14 +525,14 @@ void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { EnMaYto_DinnerStartDialogue(this, play); EnMaYto_SetupDinnerDialogueHandler(this); } else if (ABS_ALT(direction) < 0x4000) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); child = this->actor.child; if ((child != NULL) && (CURRENT_DAY != 2)) { s16 childDirection = child->shape.rot.y - child->yawTowardsPlayer; if (ABS_ALT(childDirection) < 0x4000) { - func_800B8614(child, play, 120.0f); + Actor_OfferTalk(child, play, 120.0f); } } } @@ -577,13 +577,13 @@ void EnMaYto_DinnerDialogueHandler(EnMaYto* this, PlayState* play) { void EnMaYto_DinnerHandlePlayerChoice(EnMaYto* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { // Yes - func_8019F208(); + Audio_PlaySfx_MessageDecide(); EnMaYto_SetFaceExpression(this, 0, 3); // "Milk Road is fixed!" Message_StartTextbox(play, 0x3399, &this->actor); this->textId = 0x3399; } else { // No - func_8019F230(); + Audio_PlaySfx_MessageCancel(); // "Don't lie!" Message_StartTextbox(play, 0x3398, &this->actor); this->textId = 0x3398; @@ -723,11 +723,11 @@ void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { EnMaYto_BarnStartDialogue(this, play); EnMaYto_SetupBarnDialogueHandler(this); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM) || (ABS_ALT(direction) < 0x2000)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); child = this->actor.child; if (child != NULL) { - func_800B8614(child, play, 100.0f); + Actor_OfferTalk(child, play, 100.0f); } } } @@ -914,7 +914,7 @@ void EnMaYto_AfterMilkRunInit(EnMaYto* this, PlayState* play) { EnMaYto_SetupAfterMilkRunDialogueHandler(this); } else { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } } @@ -1006,7 +1006,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play) { EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); } } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -1109,7 +1109,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) { void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { if (CURRENT_DAY == 1) { - if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(play, 0x235D, &this->actor); @@ -1168,7 +1168,7 @@ void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play) { switch (CURRENT_DAY) { case 1: - if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(play, 0x235D, &this->actor); 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 bb9c9c926..651f8115f 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 @@ -6,7 +6,7 @@ #include "z_en_ma_yts.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) #define THIS ((EnMaYts*)thisx) @@ -137,12 +137,12 @@ void func_80B8D12C(EnMaYts* this, PlayState* play) { void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { switch (this->type) { case MA_YTS_TYPE_BARN: - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; EnMaYts_ChangeAnim(this, 0); break; case MA_YTS_TYPE_SITTING: - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; // Day 1 or "Winning" the alien invasion if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { EnMaYts_ChangeAnim(this, 14); @@ -152,13 +152,13 @@ void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { break; case MA_YTS_TYPE_SLEEPING: - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.draw = EnMaYts_DrawSleeping; EnMaYts_ChangeAnim(this, 0); break; case MA_YTS_TYPE_ENDCREDITS: - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; EnMaYts_ChangeAnim(this, 0); break; @@ -302,7 +302,7 @@ void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { s16 sp26 = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (!(gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_65_80)) { // Saying to non-human Link: "Cremia went to town." SET_WEEKEVENTREG(WEEKEVENTREG_65_80); @@ -349,7 +349,7 @@ void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { } EnMaYts_SetupDialogueHandler(this); } else if (ABS_ALT(sp26) < 0x4000) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } 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 0cce91c73..f9ad697ce 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -240,7 +240,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { if (!CutsceneFlags_Get(play, 4)) { - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; this->unk11F00 = 0; this->unk11F02 = 30; @@ -387,7 +387,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { if (gOpeningEntranceIndex >= 2) { gOpeningEntranceIndex = 0; } - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); gSaveContext.gameMode = GAMEMODE_FILE_SELECT; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; @@ -430,7 +430,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_START) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; } } @@ -707,7 +707,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { s16 step; // Set segment 6 to the object, since this will be read by OVERLAY_DISP where it is not set by default. - gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment); Gfx_SetupDL39_Ptr(&gfx); diff --git a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c index 659ef4cb3..f19dbae14 100644 --- a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c +++ b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h" #include "objects/object_maruta/object_maruta.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10) #define THIS ((EnMaruta*)thisx) @@ -214,7 +214,7 @@ void EnMaruta_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.1f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 50.0f; @@ -285,7 +285,7 @@ void func_80B372CC(EnMaruta* this, PlayState* play) { if ((this->actor.parent != NULL) && (this->actor.parent->id == ACTOR_EN_KENDO_JS)) { EnKendoJs* kendoJs = (EnKendoJs*)this->actor.parent; - kendoJs->unk_292 = this->actor.isTargeted; + kendoJs->unk_292 = this->actor.isLockedOn; } } @@ -322,7 +322,7 @@ void func_80B37428(EnMaruta* this, PlayState* play) { } void func_80B374B8(EnMaruta* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->actionFunc != func_80B37428) { this->unk_21E = 0; this->actor.gravity = -2.0f; @@ -422,7 +422,7 @@ void func_80B37590(EnMaruta* this, PlayState* play) { this->unk_21A |= 0xFF; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80B37950; } diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c index d47992114..f4e66b7b4 100644 --- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c +++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c @@ -6,7 +6,7 @@ #include "z_en_minideath.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMinideath*)thisx) 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 94590f5b6..ce3beaa2a 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -5,10 +5,9 @@ */ #include "z_en_minifrog.h" -#include "objects/object_fr/object_fr.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMinifrog*)thisx) @@ -60,17 +59,20 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 12, 14, MASS_IMMOVABLE }; -// sEyeTextures??? -static TexturePtr D_808A4D74[] = { - object_fr_Tex_0059A0, - object_fr_Tex_005BA0, +static TexturePtr sEyeTextures[] = { + gFrogIrisOpenTex, + gFrogIrisClosedTex, }; -static u16 isFrogReturnedFlags[] = { - 0, WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, WEEKEVENTREG_33_02, +static u16 sIsFrogReturnedFlags[] = { + 0, // FROG_YELLOW + WEEKEVENTREG_32_40, // FROG_CYAN + WEEKEVENTREG_32_80, // FROG_PINK + WEEKEVENTREG_33_01, // FROG_BLUE + WEEKEVENTREG_33_02, // FROG_WHITE }; -static s32 isInitialized = false; +static s32 sIsInitialized = false; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -800, ICHAIN_STOP), @@ -82,33 +84,33 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, &object_fr_Anim_001534, this->jointTable, - this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &gFrogSkel, &gFrogIdleAnim, this->jointTable, this->morphTable, + FROG_LIMB_MAX); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (!isInitialized) { - for (i = 0; i < ARRAY_COUNT(D_808A4D74); i++) { - D_808A4D74[i] = Lib_SegmentedToVirtual(D_808A4D74[i]); + if (!sIsInitialized) { + for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); } - isInitialized = true; + sIsInitialized = true; } this->frogIndex = (this->actor.params & 0xF); if (this->frogIndex >= 5) { - this->frogIndex = MINIFROG_YELLOW; + this->frogIndex = FROG_YELLOW; } this->actor.speed = 0.0f; this->actionFunc = EnMinifrog_Idle; - this->jumpState = MINIFROG_STATE_GROUND; + this->jumpState = FROG_STATE_GROUND; this->flags = 0; this->timer = 0; if (1) {} - if (!EN_MINIFROG_IS_RETURNED(&this->actor)) { - if ((this->frogIndex == MINIFROG_YELLOW) || CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { + if (!EN_FROG_IS_RETURNED(&this->actor)) { + if ((this->frogIndex == FROG_YELLOW) || CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { Actor_Kill(&this->actor); return; } @@ -118,7 +120,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->actor.textId = 0xD81; this->actor.colChkInfo.mass = 30; } else { // Frogs in mountain village - if (this->frogIndex == MINIFROG_YELLOW) { + if (this->frogIndex == FROG_YELLOW) { this->actor.textId = 0; this->actionFunc = EnMinifrog_SetupYellowFrogDialog; @@ -130,10 +132,10 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->frog = NULL; } else { this->frog = EnMinifrog_GetFrog(play); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; // Frog has been returned - if (CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex])) { + if (CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { this->actionFunc = EnMinifrog_SetupNextFrogInit; } else { this->actor.draw = NULL; @@ -148,7 +150,7 @@ void EnMinifrog_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); if (this->flags & 0x100) { - func_801A1F88(); + Audio_StopSequenceAtDefaultPos(); } } @@ -167,9 +169,9 @@ EnMinifrog* EnMinifrog_GetFrog(PlayState* play) { } void EnMinifrog_SetJumpState(EnMinifrog* this) { - if (this->jumpState == MINIFROG_STATE_GROUND) { - this->jumpState = MINIFROG_STATE_JUMP; - Animation_Change(&this->skelAnime, &object_fr_Anim_0007BC, 1.0f, 0.0f, 7.0f, ANIMMODE_ONCE, -5.0f); + if (this->jumpState == FROG_STATE_GROUND) { + this->jumpState = FROG_STATE_JUMP; + Animation_Change(&this->skelAnime, &gFrogJumpAnim, 1.0f, 0.0f, 7.0f, ANIMMODE_ONCE, -5.0f); } } @@ -185,21 +187,25 @@ void EnMinifrog_JumpTimer(EnMinifrog* this) { void EnMinifrog_Jump(EnMinifrog* this) { SkelAnime_Update(&this->skelAnime); switch (this->jumpState) { - case MINIFROG_STATE_JUMP: + case FROG_STATE_JUMP: if (Animation_OnFrame(&this->skelAnime, 4.0f)) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 6.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); - this->jumpState = MINIFROG_STATE_AIR; + this->jumpState = FROG_STATE_AIR; } break; - case MINIFROG_STATE_AIR: + + case FROG_STATE_AIR: if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->jumpState = MINIFROG_STATE_GROUND; - Animation_MorphToLoop(&this->skelAnime, &object_fr_Anim_001534, -2.5f); + this->jumpState = FROG_STATE_GROUND; + Animation_MorphToLoop(&this->skelAnime, &gFrogIdleAnim, -2.5f); SkelAnime_Update(&this->skelAnime); } break; + + default: + break; } } @@ -219,7 +225,7 @@ static Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { Vec3f pos; Vec3f vec5; - Vec3f vel; + Vec3f velocity; Vec3f accel; s16 yaw; s16 pitch; @@ -233,16 +239,16 @@ void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { vec5.z = this->actor.world.pos.z - (5.0f * Math_CosS(yaw) * Math_CosS(pitch)); for (i = 0; i < 5; i++) { - vel.x = Rand_CenteredFloat(4.0f); - vel.y = Rand_CenteredFloat(4.0f); - vel.z = Rand_CenteredFloat(4.0f); - accel.x = -vel.x * 0.1f; - accel.y = -vel.y * 0.1f; - accel.z = -vel.z * 0.1f; - pos.x = vec5.x + vel.x; - pos.y = vec5.y + vel.y; - pos.z = vec5.z + vel.z; - func_800B0F80(play, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); + velocity.x = Rand_CenteredFloat(4.0f); + velocity.y = Rand_CenteredFloat(4.0f); + velocity.z = Rand_CenteredFloat(4.0f); + accel.x = -velocity.x * 0.1f; + accel.y = -velocity.y * 0.1f; + accel.z = -velocity.z * 0.1f; + pos.x = vec5.x + velocity.x; + pos.y = vec5.y + velocity.y; + pos.z = vec5.z + velocity.z; + func_800B0F80(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); } } @@ -269,7 +275,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { Message_ContinueTextbox(play, 0xD86); } - SET_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex]); + SET_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex]); break; case 0xD85: @@ -324,7 +330,7 @@ void EnMinifrog_Idle(EnMinifrog* this, PlayState* play) { } } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && (Player_GetMask(play) == PLAYER_MASK_DON_GERO)) { - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } @@ -366,20 +372,25 @@ void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, PlayState* play) { void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { EnMinifrog_CheckChoirSuccess(this, play); - return; // necessary to match - } else if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + return; + } + + if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { CutsceneManager_Start(CS_ID_GLOBAL_TALK, NULL); EnMinifrog_CheckChoirSuccess(this, play); - return; // necessary to match - } else if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->actor.csId)) { + return; + } + + if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->actor.csId)) { CutsceneManager_Stop(this->actor.csId); CutsceneManager_Queue(CS_ID_GLOBAL_TALK); - return; // necessary to match - } else { - CutsceneManager_Queue(CS_ID_GLOBAL_TALK); + return; } + + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } void EnMinifrog_NextFrogMissing(EnMinifrog* this, PlayState* play) { @@ -398,8 +409,8 @@ void EnMinifrog_NextFrogReturned(EnMinifrog* this, PlayState* play) { this->timer--; } else { this->actionFunc = EnMinifrog_ContinueChoirCutscene; - this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | - 0x2 << MINIFROG_WHITE); + this->flags &= ~((0x2 << FROG_YELLOW) | (0x2 << FROG_CYAN) | (0x2 << FROG_PINK) | (0x2 << FROG_BLUE) | + (0x2 << FROG_WHITE)); play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } } @@ -409,11 +420,11 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); frogIndex = func_801A39F8(); - if (frogIndex != MINIFROG_INVALID) { - if (frogIndex == MINIFROG_YELLOW) { + if (frogIndex != FROG_NONE) { + if (frogIndex == FROG_YELLOW) { EnMinifrog_SetJumpState(this); } else { - this->actor.home.rot.z = frogIndex; // This is strange to store the frog index in home z rotation + this->actor.home.rot.z = frogIndex; } if (!(this->flags & (0x2 << frogIndex))) { @@ -427,10 +438,10 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { this->actionFunc = EnMinifrog_NextFrogMissing; this->timer = 60; this->actor.home.rot.y = Actor_WorldYawTowardActor(&this->actor, &this->frog->actor); - func_801A1F88(); + Audio_StopSequenceAtDefaultPos(); this->flags &= ~0x100; - this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | - 0x2 << MINIFROG_WHITE); + this->flags &= + ~(0x2 << FROG_YELLOW | 0x2 << FROG_CYAN | 0x2 << FROG_PINK | 0x2 << FROG_BLUE | 0x2 << FROG_WHITE); play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } else if (this->timer <= 0) { this->actionFunc = EnMinifrog_NextFrogReturned; @@ -449,7 +460,7 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, PlayState* play) { CutsceneManager_Start(this->actor.csId, &this->actor); this->actionFunc = EnMinifrog_SetupNextFrogChoir; this->timer = 5; - func_801A1F00(3, NA_BGM_FROG_SONG); + Audio_PlaySequenceAtDefaultPos(SEQ_PLAYER_BGM_SUB, NA_BGM_FROG_SONG); this->flags |= 0x100; play->setPlayerTalkAnim(play, &gPlayerAnim_pn_gakkiplay, ANIMMODE_LOOP); } else { @@ -464,7 +475,7 @@ void EnMinifrog_EndChoir(EnMinifrog* this, PlayState* play) { Message_StartTextbox(play, 0xD7E, &this->actor); this->actionFunc = EnMinifrog_YellowFrogDialog; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -475,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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_NONE); } else { Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } @@ -489,14 +500,18 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // Yes - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->actionFunc = EnMinifrog_BeginChoirCutscene; play->msgCtx.msgLength = 0; break; + case 1: // No - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0xD7E); break; + + default: + break; } } break; @@ -510,16 +525,19 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; SET_WEEKEVENTREG(WEEKEVENTREG_34_01); break; + case 0xD78: case 0xD79: case 0xD7A: case 0xD7F: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + case 0xD77: this->actionFunc = EnMinifrog_BeginChoirCutscene; play->msgCtx.msgLength = 0; break; + case 0xD7C: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_35_80)) { // Obtained Heart Piece Message_ContinueTextbox(play, 0xD7E); @@ -528,11 +546,13 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_35_80); } break; + case 0xD7D: Message_CloseTextbox(play); this->actionFunc = EnMinifrog_GetFrogHP; EnMinifrog_GetFrogHP(this, play); break; + case 0xD7B: case 0xD7E: default: @@ -543,6 +563,9 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { } } break; + + default: + break; } } @@ -563,7 +586,7 @@ void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, PlayState* play) { (Player_IsFacingActor(&this->actor, 0x3000, play) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_10000)) && Player_GetMask(play) == PLAYER_MASK_DON_GERO) { - func_800B8614(&this->actor, play, 160.0f); + Actor_OfferTalk(&this->actor, play, 160.0f); } } @@ -592,11 +615,11 @@ void EnMinifrog_UpdateMissingFrog(Actor* thisx, PlayState* play) { } s32 EnMinifrog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 1) { + if (limbIndex == FROG_LIMB_LOWER_BODY) { pos->z -= 500.0f; } - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == FROG_LIMB_RIGHT_EYE) || (limbIndex == FROG_LIMB_LEFT_EYE)) { *dList = NULL; } @@ -606,7 +629,7 @@ s32 EnMinifrog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMinifrog* this = THIS; - if ((limbIndex == 7) || (limbIndex == 8)) { + if ((limbIndex == FROG_LIMB_RIGHT_EYE) || (limbIndex == FROG_LIMB_LEFT_EYE)) { OPEN_DISPS(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); @@ -616,13 +639,17 @@ void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* CLOSE_DISPS(play->state.gfxCtx); } - if (limbIndex == 4) { + if (limbIndex == FROG_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); } } -static Color_RGBA8 sEnMinifrogColor[] = { - { 200, 170, 0, 255 }, { 0, 170, 200, 255 }, { 210, 120, 100, 255 }, { 120, 130, 230, 255 }, { 190, 190, 190, 255 }, +static Color_RGBA8 sFrogEnvColors[] = { + { 200, 170, 0, 255 }, // FROG_YELLOW + { 0, 170, 200, 255 }, // FROG_CYAN + { 210, 120, 100, 255 }, // FROG_PINK + { 120, 130, 230, 255 }, // FROG_BLUE + { 190, 190, 190, 255 }, // FROG_WHITE }; void EnMinifrog_Draw(Actor* thisx, PlayState* play) { @@ -632,9 +659,9 @@ void EnMinifrog_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - envColor = &sEnMinifrogColor[this->frogIndex]; - gSPSegment(POLY_OPA_DISP++, 0x08, D_808A4D74[0]); - gSPSegment(POLY_OPA_DISP++, 0x09, D_808A4D74[0]); + envColor = &sFrogEnvColors[this->frogIndex]; + gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[0]); + gSPSegment(POLY_OPA_DISP++, 0x09, sEyeTextures[0]); gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, envColor->a); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMinifrog_OverrideLimbDraw, EnMinifrog_PostLimbDraw, &this->actor); diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h index 3e321cc56..a2752c830 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h @@ -2,33 +2,34 @@ #define Z_EN_MINIFROG_H #include "global.h" +#include "objects/object_fr/object_fr.h" struct EnMinifrog; typedef void (*EnMinifrogActionFunc)(struct EnMinifrog*, PlayState*); -#define EN_MINIFROG_IS_RETURNED(thisx) ((((thisx)->params) & 0xF0) >> 4) +#define EN_FROG_IS_RETURNED(thisx) ((((thisx)->params) & 0xF0) >> 4) typedef enum { - /* 0x00 */ MINIFROG_YELLOW, // Mountain Village - /* 0x01 */ MINIFROG_CYAN, // Woodfall Temple - /* 0x02 */ MINIFROG_PINK, // Great Bay Temple - /* 0x03 */ MINIFROG_BLUE, // Southern Swamp - /* 0x04 */ MINIFROG_WHITE, // Laundry Pool - /* 0xFF */ MINIFROG_INVALID = 0xFF // -1 -} MinifrogType; + /* 0x00 */ FROG_YELLOW, // Mountain Village + /* 0x01 */ FROG_CYAN, // Woodfall Temple + /* 0x02 */ FROG_PINK, // Great Bay Temple + /* 0x03 */ FROG_BLUE, // Southern Swamp + /* 0x04 */ FROG_WHITE, // Laundry Pool + /* 0xFF */ FROG_NONE = 0xFF // -1 +} FrogType; typedef enum { - /* 0 */ MINIFROG_STATE_JUMP, - /* 1 */ MINIFROG_STATE_AIR, - /* 2 */ MINIFROG_STATE_GROUND -} MinifrogJumpState; + /* 0 */ FROG_STATE_JUMP, + /* 1 */ FROG_STATE_AIR, + /* 2 */ FROG_STATE_GROUND +} FrogJumpState; typedef struct EnMinifrog { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[24]; - /* 0x218 */ Vec3s morphTable[24]; + /* 0x188 */ Vec3s jointTable[FROG_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[FROG_LIMB_MAX]; /* 0x2A8 */ EnMinifrogActionFunc actionFunc; /* 0x2AC */ struct EnMinifrog* frog; /* 0x2B0 */ s16 frogIndex; diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 68d08b223..0f44becad 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -7,7 +7,7 @@ #include "z_en_minislime.h" #include "overlays/actors/ovl_En_Bigslime/z_en_bigslime.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200) #define THIS ((EnMinislime*)thisx) @@ -121,7 +121,7 @@ static DamageTable sDamageTable = { void EnMinislime_Init(Actor* thisx, PlayState* play) { EnMinislime* this = THIS; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->id = this->actor.params; @@ -306,14 +306,9 @@ void EnMinislime_SetupIceArrowDamage(EnMinislime* this) { } void EnMinislime_IceArrowDamage(EnMinislime* this, PlayState* play) { - f32 invFrozenTimer; - s32 pad; - f32 randFloat; - s32 randSign; - if (this->frozenTimer == 80) { this->frozenAlpha += 10; - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (this->frozenAlpha >= 200) { this->frozenAlpha = 200; this->frozenTimer--; @@ -324,11 +319,11 @@ void EnMinislime_IceArrowDamage(EnMinislime* this, PlayState* play) { Math_Vec3f_Copy(&this->shakeRefPos, &this->actor.world.pos); } else if (this->frozenTimer > 0) { if ((this->frozenTimer < 20) || ((this->frozenTimer < 40) && ((this->frozenTimer % 2) != 0))) { - s32 requiredScopeTemp; + f32 invFrozenTimer = 1.0f / this->frozenTimer; + s32 pad; + f32 randFloat = Rand_ZeroFloat(invFrozenTimer); + s32 randSign = Rand_ZeroOne() < 0.5f ? -1 : 1; - invFrozenTimer = 1.0f / this->frozenTimer; - randFloat = Rand_ZeroFloat(invFrozenTimer); - randSign = Rand_ZeroOne() < 0.5f ? -1 : 1; this->actor.world.pos.x = randSign * (invFrozenTimer + randFloat) + this->shakeRefPos.x; randFloat = Rand_ZeroFloat(invFrozenTimer); randSign = Rand_ZeroOne() < 0.5f ? -1 : 1; @@ -371,7 +366,7 @@ void EnMinislime_FireArrowDamage(EnMinislime* this, PlayState* play) { this->frozenAlpha = 10 * this->meltTimer; } - func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); if (this->meltTimer == 0) { EnMinislime_SetupIdle(this); } @@ -605,7 +600,7 @@ void EnMinislime_DefeatMelt(EnMinislime* this, PlayState* play) { EnMinislime_AddIceSmokeEffect(this, play); } - func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); if (Math_StepToF(&this->actor.scale.y, 0.001f, 0.00075f)) { if ((this->actor.shape.shadowAlpha - 4) <= 0) { this->actor.shape.shadowAlpha = 0; 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 92a3ff91e..0c9f545f1 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -6,7 +6,7 @@ #include "z_en_mk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMk*)thisx) @@ -57,8 +57,8 @@ static ColliderCylinderInit sCylinderInit = { s32 func_809592E0(EnMk* this, s16 index) { AnimationHeader* sAnimations[] = { - &object_mk_Anim_001C38, &object_mk_Anim_000438, &object_mk_Anim_0007D8, - &object_mk_Anim_0010F4, &object_mk_Anim_001964, + &gMarineResearcherIdleAnim, &gMarineResearcherHeadWaggleAnim, &gMarineResearcherYellAnim, + &gMarineResearcherShakeInFearAnim, &gMarineResearcherStrokeChinAnim, }; if (index == this->unk_27C) { @@ -82,8 +82,8 @@ void EnMk_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -4.0f; this->actor.gravity = -1.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_006CA0, &object_mk_Anim_001C38, this->jointTable, - this->morphTable, OBJECT_MK_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gMarineResearcherSkel, &gMarineResearcherIdleAnim, this->jointTable, + this->morphTable, MARINE_RESEARCHER_LIMB_MAX); this->unk_27C = -1; func_809592E0(this, 0); @@ -95,7 +95,7 @@ void EnMk_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80959E18; this->unk_27A = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; if (func_80959524(play) < 7) { this->unk_27A |= 2; @@ -135,6 +135,9 @@ void func_8095954C(EnMk* this, PlayState* play) { case 5: func_809592E0(this, play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1); break; + + default: + break; } } else { func_809592E0(this, 0); @@ -144,7 +147,7 @@ void func_8095954C(EnMk* this, PlayState* play) { void func_80959624(EnMk* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (this->unk_27A & 4) { textId = 0xFB9; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { @@ -191,7 +194,7 @@ void func_80959774(EnMk* this, PlayState* play) { func_80959624(this, play); this->actionFunc = func_809596A0; } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 130.0f); + Actor_OfferTalk(&this->actor, play, 130.0f); } func_8095954C(this, play); @@ -209,7 +212,7 @@ void func_80959844(EnMk* this, PlayState* play) { } else if (func_80959524(play) >= 7) { textId = 0xFB3; } else { - switch (gSaveContext.save.playerForm) { + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_10)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { @@ -365,7 +368,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 350.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -409,9 +412,9 @@ void func_80959E18(EnMk* this, PlayState* play) { } if (func_800B8718(&this->actor, &play->state)) { - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; this->actionFunc = func_80959D28; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { this->actor.csId = this->csIdList[0]; SET_WEEKEVENTREG(WEEKEVENTREG_20_40); Item_Give(play, ITEM_SONG_NOVA); @@ -427,7 +430,7 @@ void func_80959E18(EnMk* this, PlayState* play) { this->actionFunc = func_80959C94; } else if ((this->actor.xzDistToPlayer < 120.0f) && (ABS_ALT(sp22) <= 0x4300)) { this->unk_27A |= 1; - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { func_800B874C(&this->actor, play, 200.0f, 100.0f); } @@ -460,7 +463,7 @@ void EnMk_Update(Actor* thisx, PlayState* play) { s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMk* this = THIS; - if (limbIndex == OBJECT_MK_LIMB_0B) { + if (limbIndex == MARINE_RESEARCHER_LIMB_HEAD) { rot->y -= this->unk_270.y; rot->z += this->unk_270.x; } @@ -472,7 +475,7 @@ Vec3f D_8095A2A0 = { 1000.0f, -100.0f, 0.0f }; void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMk* this = THIS; - if (limbIndex == OBJECT_MK_LIMB_0B) { + if (limbIndex == MARINE_RESEARCHER_LIMB_HEAD) { Matrix_MultVec3f(&D_8095A2A0, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h index 518b0406d..9d32e9374 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h @@ -12,8 +12,8 @@ typedef struct EnMk { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; - /* 0x1D4 */ Vec3s jointTable[OBJECT_MK_LIMB_MAX]; - /* 0x222 */ Vec3s morphTable[OBJECT_MK_LIMB_MAX]; + /* 0x1D4 */ Vec3s jointTable[MARINE_RESEARCHER_LIMB_MAX]; + /* 0x222 */ Vec3s morphTable[MARINE_RESEARCHER_LIMB_MAX]; /* 0x270 */ Vec3s unk_270; /* 0x276 */ s16 csIdList[2]; /* 0x27A */ u16 unk_27A; 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 4e9af5578..a6d8eb8bb 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -7,7 +7,7 @@ #include "z_en_mkk.h" #include "objects/object_mkk/object_mkk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnMkk*)thisx) @@ -128,8 +128,8 @@ static Color_RGBA8 sEffPrimColors[] = { { 50, 50, 50, 255 }, { 255, 255, 255, 25 static Color_RGBA8 sEffEnvColors[] = { { 200, 200, 200, 255 }, { 255, 255, 255, 255 } }; 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 }, + { gBlackBoeBodyMaterialDL, gBlackBoeBodyModelDL, gBlackBoeEndDL, gBlackBoeEyesDL }, + { gWhiteBoeBodyMaterialDL, gWhiteBoeBodyModelDL, gWhiteBoeEndDL, gWhiteBoeEyesDL }, }; static Color_RGBA8 D_80A4F7C4[] = { @@ -195,7 +195,7 @@ void EnMkk_Destroy(Actor* thisx, PlayState* play) { void func_80A4E0CC(EnMkk* this) { this->alpha = 0; this->unk_14B |= 3; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80A4E100; } @@ -211,7 +211,7 @@ void func_80A4E100(EnMkk* this, PlayState* play) { this->primColorSelect = 3; this->collider.base.acFlags |= AC_ON; this->alpha = 255; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->unk_14B &= ~4; func_80A4E190(this); @@ -275,7 +275,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { } this->actor.shape.rot.y = (s32)(Math_SinF(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; - func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); if (sp20) { this->unk_14B &= ~2; func_80A4E190(this); @@ -310,7 +310,7 @@ void func_80A4E60C(EnMkk* this, PlayState* play) { void func_80A4E67C(EnMkk* this) { this->unk_14B |= 1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_10; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD); @@ -433,7 +433,7 @@ void EnMkk_Update(Actor* thisx, PlayState* play) { if (this->collider.base.atFlags & AT_ON) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->collider.base.acFlags & AT_ON) { + if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); @@ -442,7 +442,7 @@ void EnMkk_Update(Actor* thisx, PlayState* play) { void func_80A4EDF0(EnMkk* this) { this->alpha = 0; this->unk_14B |= 3; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.draw = NULL; this->actor.update = func_80A4F16C; this->actor.gravity = -0.5f; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 5c6adcd8a..64cc47ad8 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -69,7 +69,7 @@ void EnMm2_WaitForRead(EnMm2* this, PlayState* play) { Message_StartTextbox(play, 0x277B, &this->actor); this->actionFunc = EnMm2_Reading; } else if ((this->actor.xzDistToPlayer < 60.0f) && (Player_IsFacingActor(&this->actor, 0x3000, play))) { - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } 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 ab387771c..f544dd2d2 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -7,7 +7,7 @@ #include "z_en_mm3.h" #include "objects/object_mm/object_mm.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMm3*)thisx) @@ -94,7 +94,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.parent = NULL; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->unk_1DC = 1; this->unk_2B4 = 0; this->unk_2AE = 0; @@ -133,7 +133,7 @@ void func_80A6F2C8(EnMm3* this, PlayState* play) { this->unk_2B4 = 0x278A; func_80A6F9C8(this); } else if (func_80A6F22C(this)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->unk_2A0.x, 0, 5, 0x1000, 0x100); @@ -149,23 +149,23 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { if (this->unk_2B2 & 0x20) { if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; Rupees_ChangeBy(-play->msgCtx.unk1206C); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x279C, &this->actor); this->unk_2B4 = 0x279C; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); } } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x278F, &this->actor); this->unk_2B4 = 0x278F; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); @@ -175,18 +175,18 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { case 0x279A: if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; Rupees_ChangeBy(-play->msgCtx.unk1206C); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x279C, &this->actor); this->unk_2B4 = 0x279C; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_StartTextbox(play, 0x279B, &this->actor); this->unk_2B4 = 0x279B; Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); @@ -305,7 +305,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } } } @@ -348,7 +348,7 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { Interface_StartPostmanTimer(0, POSTMAN_MINIGAME_BUNNY_HOOD_OFF); } Message_CloseTextbox(play); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); func_80A6FBA0(this); } else { CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); @@ -406,15 +406,15 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { this->unk_2AC = 7; gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_OFF; this->actor.flags &= ~ACTOR_FLAG_10000; - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); func_80A6F9C8(this); } else { - func_800B8614(&this->actor, play, this->actor.xzDistToPlayer + 10.0f); + Actor_OfferTalk(&this->actor, play, this->actor.xzDistToPlayer + 10.0f); func_80123E90(play, &this->actor); if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { - play_sound(NA_SE_SY_STOPWATCH_TIMER_INF - SFX_FLAG); + Audio_PlaySfx(NA_SE_SY_STOPWATCH_TIMER_INF - SFX_FLAG); } else { - play_sound(NA_SE_SY_STOPWATCH_TIMER_3 - SFX_FLAG); + Audio_PlaySfx(NA_SE_SY_STOPWATCH_TIMER_3 - SFX_FLAG); } } } @@ -453,13 +453,13 @@ void func_80A6FEEC(EnMm3* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80A6F9C8(this); } else { - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } s32 func_80A6FFAC(EnMm3* this, PlayState* play) { - switch (gSaveContext.save.playerForm) { - case 4: + switch (GET_PLAYER_FORM) { + case PLAYER_FORM_HUMAN: if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { if (this->unk_2B2 & 0x10) { return true; @@ -469,31 +469,34 @@ s32 func_80A6FFAC(EnMm3* this, PlayState* play) { } break; - case 3: + case PLAYER_FORM_DEKU: if (this->unk_2B2 & 2) { return true; } break; - case 2: + case PLAYER_FORM_ZORA: if (this->unk_2B2 & 4) { return true; } break; - case 1: + case PLAYER_FORM_GORON: if (this->unk_2B2 & 8) { return true; } break; + + default: + break; } return false; } void func_80A70084(EnMm3* this, PlayState* play) { - switch (gSaveContext.save.playerForm) { - case 4: + switch (GET_PLAYER_FORM) { + case PLAYER_FORM_HUMAN: if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { this->unk_2B2 |= 0x10; this->unk_2B2 |= 1; @@ -502,17 +505,20 @@ void func_80A70084(EnMm3* this, PlayState* play) { } break; - case 3: + case PLAYER_FORM_DEKU: this->unk_2B2 |= 2; break; - case 2: + case PLAYER_FORM_ZORA: this->unk_2B2 |= 4; break; - case 1: + case PLAYER_FORM_GORON: this->unk_2B2 |= 8; break; + + default: + break; } } 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 ef064969e..82e25a95d 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c @@ -6,7 +6,7 @@ #include "z_en_mnk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMnk*)thisx) @@ -15,8 +15,34 @@ void EnMnk_Destroy(Actor* thisx, PlayState* play); void EnMnk_Update(Actor* thisx, PlayState* play); void EnMnk_Draw(Actor* thisx, PlayState* play); -#if 0 -ActorInit En_Mnk_InitVars = { +// Draw funcs +void EnMnk_MonkeyTiedUp_Draw(Actor* thisx, PlayState* play); +void EnMnk_MonkeyHanging_Draw(Actor* thisx, PlayState* play); + +// Action funcs +void EnMnk_Monkey_WaitToRunAndWaitAtEachPoint(EnMnk* this, PlayState* play); +void EnMnk_MonkeyTiedUp_Wait(EnMnk* this, PlayState* play); +void EnMnk_MonkeyHanging_StruggleBeforeDunk(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitToTalkAfterRun(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitForPlayerApproach(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitToFollowPath(EnMnk* this, PlayState* play); +void EnMnk_MonkeyTiedUp_WaitUnused(EnMnk* this, PlayState* play); +void EnMnk_MonkeyTiedUp_WaitForInstrument(EnMnk* this, PlayState* play); +void EnMnk_MonkeyTiedUp_WaitForCutRope(EnMnk* this, PlayState* play); +void EnMnk_MonkeyHanging_WaitAfterDunk(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitToTalkAfterSaved(EnMnk* this, PlayState* play); + +void EnMnk_DoNothing(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitOutsideWoods(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitOutsideChamber(EnMnk* this, PlayState* play); +void EnMnk_Monkey_WaitToGuideThroughWoods(EnMnk* this, PlayState* play); +void func_80AB9084(EnMnk* this, PlayState* play); +void func_80AB92CC(EnMnk* this, PlayState* play); + +s32 EnMnk_ValidatePictograph(PlayState* play, Actor* thisx); +s32 EnMnk_AlreadyExists(EnMnk* this, PlayState* play); + +const ActorInit En_Mnk_InitVars = { ACTOR_EN_MNK, ACTORCAT_NPC, FLAGS, @@ -28,191 +54,2198 @@ ActorInit En_Mnk_InitVars = { (ActorFunc)EnMnk_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80AB9D10 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x01000200, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x01000200, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 15, 30, 0, { 0, 0, 0 } }, }; -#endif - -extern ColliderCylinderInit D_80AB9D10; - -extern UNK_TYPE D_06003584; -extern UNK_TYPE D_060082C8; -extern UNK_TYPE D_06008814; -extern UNK_TYPE D_06009CC0; -extern UNK_TYPE D_060105DC; - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4D10.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4E34.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4E58.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4E88.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4F68.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB4F8C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB50B0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB50D4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5148.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB51C8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB52E8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_Init.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_Destroy.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5A64.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") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5BCC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5C14.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5C74.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5CD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5F6C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB60FC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB61E8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6304.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB63CC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB64B8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB65F4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB675C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6870.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6920.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB69C8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6AF8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6B78.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6BE4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6E08.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6EB0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB6F98.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7108.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7204.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB72BC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7354.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB740C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7488.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7504.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB75A4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7620.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB76B0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB794C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7AC8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7B20.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7DCC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB7E50.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8040.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB80BC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB81D8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8478.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB852C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB85C8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8644.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB86AC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8750.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8878.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8968.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB89F8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8A74.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8B18.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8BD4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8C60.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8CFC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8E4C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8EF4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB8FD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB9084.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB92CC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB94E4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_Update.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB96A0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB96E8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB9708.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB973C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB977C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB97B4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB99D4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_Draw.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB9BAC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB9C4C.s") +typedef enum { + /* 0 */ MONKEY_TIEDUP_ANIM_NONE = -1, + /* 0 */ MONKEY_TIEDUP_ANIM_KICKAROUND, + /* 1 */ MONKEY_TIEDUP_ANIM_KICKUPANDDOWN, + /* 2 */ MONKEY_TIEDUP_ANIM_SHH, + /* 3 */ MONKEY_TIEDUP_ANIM_SING, + /* 4 */ MONKEY_TIEDUP_ANIM_SMALLCLAPFEET, + /* 5 */ MONKEY_TIEDUP_ANIM_LARGECLAPFEET, + /* 6 */ MONKEY_TIEDUP_ANIM_SHAKEHEAD, + /* 7 */ MONKEY_TIEDUP_ANIM_WAIT, + /* 8 */ MONKEY_TIEDUP_ANIM_CONFUSED +} MonkeyTiedUpAnim; + +typedef enum { + /* 0 */ MONKEY_HANGING_ANIM_FREEZE, + /* 1 */ MONKEY_HANGING_ANIM_RISE, + /* 2 */ MONKEY_HANGING_ANIM_STRUGGLE +} MonkeyHangingAnim; + +typedef enum { + /* 0 */ MONKEY_FOLLOWPATH_RESULT_FOLLOWING, + /* 1 */ MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_REACHEDPOINT, + /* 2 */ MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_FINISHEDPATH, + /* 3 */ MONKEY_FOLLOWPATH_RESULT_LONGRANGE_REACHEDPOINT, + /* 4 */ MONKEY_FOLLOWPATH_RESULT_LONGRANGE_FINISHEDPATH +} MonkeyFollowPathResult; + +#define MONKEY_FOLLOWPATH_FLAGS_REACHNEXTPOINT (1 << 0) +#define MONKEY_FOLLOWPATH_FLAGS_LONGRANGE (1 << 1) + +AnimationHeader* sMonkeyTiedUpAnimations[] = { + &object_mnk_Anim_00D1C8, &object_mnk_Anim_00CD4C, &object_mnk_Anim_00C23C, + &object_mnk_Anim_00F248, &object_mnk_Anim_00F9A4, &object_mnk_Anim_00FE34, + &object_mnk_Anim_00EC44, &object_mnk_Anim_010298, &object_mnk_Anim_00CAE8, +}; + +AnimationHeader* sMonkeyTiedUpPoleAnimations[] = { + &object_mnk_Anim_003584, &object_mnk_Anim_005194, &object_mnk_Anim_0052C4, + &object_mnk_Anim_003854, &object_mnk_Anim_005390, &object_mnk_Anim_005414, + &object_mnk_Anim_0037E8, &object_mnk_Anim_0054B4, &object_mnk_Anim_003504, +}; + +AnimationHeader* sMonkeyHangingAnimations[] = { + &object_mnk_Anim_0062D8, + &object_mnk_Anim_007380, + &gMonkeyHangingStruggleAnim, +}; + +AnimationHeader* sMonkeyHangingRopeAnimations[] = { + &object_mnk_Anim_01C1B8, + &object_mnk_Anim_01C1F8, + &gMonkeyHangingRopeStruggleAnim, +}; + +AnimationHeader* sMonkeyAnimations[] = { + &object_mnk_Anim_0105DC, &object_mnk_Anim_009FE0, &object_mnk_Anim_0099B0, &object_mnk_Anim_0095B4, + &object_mnk_Anim_0095B4, &object_mnk_Anim_00B864, &object_mnk_Anim_00B864, &object_mnk_Anim_009CC0, + &object_mnk_Anim_009CC0, &object_mnk_Anim_008814, &object_mnk_Anim_005A08, &object_mnk_Anim_01A4F8, + &object_mnk_Anim_01B468, &object_mnk_Anim_01BB0C, &object_mnk_Anim_01C17C, +}; + +u32 D_80AB9DD8[] = { 2, 2, 3, 4, 5, 6, 100 }; + +Color_RGBA8 sMonkeyHangingSplashPrimColor = { 255, 255, 155, 255 }; +Color_RGBA8 sMonkeyHangingSplashEnvColor = { 255, 100, 0, 255 }; + +static Vec3f sMonkeyFocusPosOffset = { 300.0f, 400.0f, 0.0f }; + +TexturePtr sMonkeyFaceTextures[] = { + object_mnk_Tex_015020, object_mnk_Tex_015920, object_mnk_Tex_016120, object_mnk_Tex_016920, + object_mnk_Tex_017120, object_mnk_Tex_017920, object_mnk_Tex_018120, +}; + +void EnMnk_MonkeyTiedUp_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) { + Animation_Change(&this->skelAnime, sMonkeyTiedUpAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sMonkeyTiedUpAnimations[animIndex]->common), animMode, morphFrames); + Animation_Change(&this->propSkelAnime, sMonkeyTiedUpPoleAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sMonkeyTiedUpPoleAnimations[animIndex]->common), animMode, morphFrames); + + switch (animIndex) { + case MONKEY_TIEDUP_ANIM_KICKAROUND: + this->unk_3E0 = 5; + break; + + case MONKEY_TIEDUP_ANIM_SHAKEHEAD: + this->unk_3E0 = 4; + break; + + case MONKEY_TIEDUP_ANIM_SING: + case MONKEY_TIEDUP_ANIM_CONFUSED: + this->unk_3E0 = 6; + break; + + default: + this->unk_3E0 = 0; + break; + } + this->animIndex = animIndex; +} + +void EnMnk_MonkeyTiedUp_SetAnim(EnMnk* this, s32 animIndex) { + EnMnk_MonkeyTiedUp_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f); +} + +void EnMnk_MonkeyTiedUp_SetNewAnim(EnMnk* this, s32 animIndex) { + if (this->animIndex != animIndex) { + EnMnk_MonkeyTiedUp_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f); + } +} + +void EnMnk_MonkeyHanging_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) { + Animation_Change(&this->skelAnime, sMonkeyHangingAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sMonkeyHangingAnimations[animIndex]->common), animMode, morphFrames); + Animation_Change(&this->propSkelAnime, sMonkeyHangingRopeAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sMonkeyHangingRopeAnimations[animIndex]->common), animMode, morphFrames); + this->animIndex = animIndex; +} + +void EnMnk_MonkeyHanging_SetAnim(EnMnk* this, s32 animIndex) { + EnMnk_MonkeyHanging_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f); +} + +void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) { + s32 pad; + + if (animIndex == 100) { + animIndex = (s32)Rand_ZeroFloat(3.99f) + 7; + } + if ((animIndex == 4) || (animIndex == 6)) { + Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], -1.0f, + Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), 0.0f, animMode, morphFrames); + } else { + Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), animMode, morphFrames); + } + this->unk_3E0 = 0; + this->animIndex = animIndex; +} + +void EnMnk_Monkey_SetAnim(EnMnk* this, s32 animIndex) { + EnMnk_Monkey_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f); +} + +void EnMnk_Monkey_SetupWaitToRunAndWaitAtEachPoint(EnMnk* this, PlayState* play) { + this->picto.actor.textId = 0x7D8; + this->actionFunc = EnMnk_Monkey_WaitToRunAndWaitAtEachPoint; + this->destPointIndex = 0; + this->flags |= MONKEY_FLAGS_1 | MONKEY_FLAGS_2; + this->flags &= ~MONKEY_FLAGS_40; + Animation_PlayLoop(&this->skelAnime, &object_mnk_Anim_008814); + this->picto.actor.velocity.y = 0.0f; + this->picto.actor.terminalVelocity = 0.0f; + this->picto.actor.gravity = 0.0f; +} + +void EnMnk_Monkey_StartInvisible(EnMnk* this, PlayState* play) { + this->picto.actor.draw = NULL; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; + this->collider.dim.radius = 100; + this->flags |= MONKEY_FLAGS_8; + this->flags |= MONKEY_FLAGS_20; + if ((MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) && + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + Actor_Kill(&this->picto.actor); + return; + } +} + +void EnMnk_MonkeyTiedUp_Init(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + s16 csId; + s32 i; + + this->actionFunc = EnMnk_MonkeyTiedUp_Wait; + this->picto.actor.flags |= ACTOR_FLAG_2000000; + SkelAnime_InitFlex(play, &this->propSkelAnime, &gMonkeyTiedUpPoleSkel, &object_mnk_Anim_003584, + this->propJointTable, this->propMorphTable, OBJECT_MNK_1_LIMB_MAX); + this->cueId = 4; + this->animIndex = MONKEY_TIEDUP_ANIM_NONE; + EnMnk_MonkeyTiedUp_ChangeAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND, ANIMMODE_ONCE, 0.0f); + this->picto.actor.draw = EnMnk_MonkeyTiedUp_Draw; + this->picto.actor.shape.shadowDraw = NULL; + this->flags |= MONKEY_FLAGS_1 | MONKEY_FLAGS_2 | MONKEY_FLAGS_20 | MONKEY_FLAGS_200; + csId = this->picto.actor.csId; + + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->picto.actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->picto.actor.csId); + } + } + + this->csId = CS_ID_NONE; + this->picto.actor.csId = this->csIdList[0]; +} + +void EnMnk_MonkeyHanging_Init(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + func_800BC154(play, &play->actorCtx, &this->picto.actor, ACTORCAT_PROP); + this->actionFunc = EnMnk_MonkeyHanging_StruggleBeforeDunk; + this->picto.actor.textId = 0x8E8; + SkelAnime_InitFlex(play, &this->propSkelAnime, &gMonkeyHangingRopeSkel, &gMonkeyHangingStruggleAnim, + this->propJointTable, this->propMorphTable, OBJECT_MNK_3_LIMB_MAX); + EnMnk_MonkeyHanging_ChangeAnim(this, MONKEY_HANGING_ANIM_STRUGGLE, ANIMMODE_LOOP, 0.0f); + this->unk_3E0 = 5; + this->picto.actor.draw = EnMnk_MonkeyHanging_Draw; + this->picto.actor.shape.shadowDraw = NULL; + this->flags |= MONKEY_FLAGS_1 | MONKEY_FLAGS_2 | MONKEY_FLAGS_20; + this->approachPlayerRadius = -0.3f; + this->unk_3C8 = 60; + play->envCtx.lightSettingOverride = 1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_08); +} + +void EnMnk_Init(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + s32 pad; + + Actor_SetScale(&this->picto.actor, 0.012f); + ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f); + this->actionFunc = EnMnk_DoNothing; + SkelAnime_InitFlex(play, &this->skelAnime, &gMonkeySkel, &object_mnk_Anim_0105DC, this->jointTable, + this->morphTable, OBJECT_MNK_2_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &object_mnk_Anim_0105DC); + this->flags = 0; + this->unk_3D4 = 0; + this->unk_3E0 = 0; + this->unk_3CC = 0; + this->unk_3CE = 0; + this->cueId = 0; + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + this->picto.actor.colChkInfo.cylRadius = 40; + this->picto.actor.velocity.y = -9.0f; + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.gravity = -1.0f; + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + this->pathIndex = MONKEY_GET_PATH_INDEX(thisx); + this->approachPlayerRadius = 0.0f; + if (this->pathIndex == MONKEY_PATH_INDEX_NONE) { + this->pathIndex = PATH_INDEX_NONE; + } + + switch (MONKEY_GET_TYPE(thisx)) { + case MONKEY_0: + if (!Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor)) || + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor) + 1) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80)) { + Actor_Kill(&this->picto.actor); + return; + } + break; + + case MONKEY_OUTSIDEWOODS: + case MONKEY_OUTSIDEPALACE: + if (Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_OUTSIDECHAMBER: + if (Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_29_80)) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_TIED_UP: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_HANGING: + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_09_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_8: + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_29_80)) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_AFTER_SAVED: + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_29_80)) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_BY_WITCH: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_02) || CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME) || + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + Actor_Kill(thisx); + return; + } + break; + + case MONKEY_WOODS_GUIDE: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_02) || CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { + Actor_Kill(thisx); + return; + } + if (EnMnk_AlreadyExists(this, play)) { + Actor_Kill(thisx); + return; + } + break; + + default: + break; + } + + switch (MONKEY_GET_TYPE(thisx)) { + case MONKEY_0: + EnMnk_Monkey_SetupWaitToRunAndWaitAtEachPoint(this, play); + break; + + case MONKEY_OUTSIDEWOODS: + this->actionFunc = EnMnk_Monkey_WaitOutsideWoods; + CLEAR_EVENTINF(EVENTINF_25); + CLEAR_EVENTINF(EVENTINF_26); + this->picto.actor.textId = 0x7D0; + EnMnk_Monkey_StartInvisible(this, play); + break; + + case MONKEY_OUTSIDECHAMBER: + this->picto.actor.textId = 0x7D3; + this->actionFunc = EnMnk_Monkey_WaitOutsideChamber; + EnMnk_Monkey_StartInvisible(this, play); + this->collider.dim.radius = 120; + break; + + case MONKEY_BY_WITCH: + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitToFollowPath; + this->unk_3C8 = 0; + this->flags |= MONKEY_FLAGS_2; + this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; + this->picto.actor.velocity.y = 0.0f; + this->picto.actor.terminalVelocity = 0.0f; + this->picto.actor.gravity = 0.0f; + break; + + case MONKEY_OUTSIDEPALACE: + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitToFollowPath; + this->unk_3C8 = 0; + break; + + case MONKEY_TIED_UP: + EnMnk_MonkeyTiedUp_Init(thisx, play); + break; + + case MONKEY_HANGING: + EnMnk_MonkeyHanging_Init(thisx, play); + break; + + case MONKEY_WOODS_GUIDE: + this->picto.actor.room = -1; + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitToGuideThroughWoods; + this->unk_3C8 = 0; + this->destPointIndex = 0; + + switch (this->picto.actor.home.rot.x) { + case 1: + this->picto.actor.textId = 0x7DD; + break; + + case 2: + this->picto.actor.textId = 0x7DE; + break; + + default: + this->picto.actor.textId = 0x7DC; + break; + } + break; + + case MONKEY_8: + this->actionFunc = func_80AB9084; + this->cueId = 0; + break; + + case MONKEY_AFTER_SAVED: + EnMnk_Monkey_SetAnim(this, 0); + this->unk_3C8 = 0; + this->actionFunc = EnMnk_Monkey_WaitToTalkAfterSaved; + this->picto.actor.textId = 0x8E5; + break; + + case MONKEY_10: + this->actionFunc = func_80AB92CC; + this->cueId = 0; + break; + + default: + this->actionFunc = EnMnk_DoNothing; + break; + } + + this->picto.actor.world.rot.x = this->picto.actor.world.rot.z = 0; + this->picto.actor.shape.rot.x = this->picto.actor.shape.rot.z = 0; + this->picto.validationFunc = EnMnk_ValidatePictograph; +} + +void EnMnk_Destroy(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); + if ((MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_TIED_UP) && (this->flags & MONKEY_FLAGS_2000)) { + Item_Give(play, ITEM_SONG_SONATA); + CLEAR_EVENTINF(EVENTINF_24); + } +} + +s32 EnMnk_AlreadyExists(EnMnk* this, PlayState* play) { + Actor* thisActor = &this->picto.actor; + Actor* nextActor = NULL; + Actor* curActor; + + while (true) { + curActor = SubS_FindActor(play, nextActor, ACTORCAT_NPC, ACTOR_EN_MNK); + if ((curActor != NULL) && (curActor != thisActor)) { + if ((thisActor->home.pos.x == curActor->home.pos.x) && (thisActor->home.pos.y == curActor->home.pos.y) && + (thisActor->home.pos.z == curActor->home.pos.z)) { + return true; + } + nextActor = curActor->next; + continue; + } + + if ((curActor != NULL) && (curActor->next != NULL)) { + nextActor = curActor->next; + continue; + } + + return false; + }; +} + +s32 EnMnk_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, PICTO_VALID_MONKEY, &thisx->focus.pos, &thisx->shape.rot, 50.0f, 500.0f, + -1); +} + +void EnMnk_PlayWalkSfx(EnMnk* this) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_VO_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_WALK); + } +} + +void EnMnk_PlayWaterWalkSfx(EnMnk* this) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_VO_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_WALK_WATER); + } +} + +void EnMnk_SpawnWaterEffects(EnMnk* this, PlayState* play) { + Vec3f* effSpawnPos = &this->picto.actor.world.pos; + + EffectSsGRipple_Spawn(play, effSpawnPos, 150, 500, 0); + EffectSsGSplash_Spawn(play, effSpawnPos, NULL, NULL, 0, 200); +} + +void EnMnk_StartNextPath(EnMnk* this, PlayState* play) { + s32 pathIndex; + + EnMnk_Monkey_SetAnim(this, 1); + pathIndex = this->pathIndex; + this->picto.actor.speed = 0.0f; + if (pathIndex != PATH_INDEX_NONE) { + this->path = &play->setupPathList[pathIndex]; + } else { + this->path = NULL; + } +} + +s32 EnMnk_FollowPath(EnMnk* this, u16 flags) { + Path* path; + Vec3s* destPoint; + f32 dx; + f32 dz; + f32 distSq; + s16 arcTan; + + if (this->path == NULL) { + return MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_REACHEDPOINT; + } + + path = this->path; + destPoint = &((Vec3s*)Lib_SegmentedToVirtual(path->points))[this->destPointIndex]; + dx = destPoint->x - this->picto.actor.world.pos.x; + dz = destPoint->z - this->picto.actor.world.pos.z; + arcTan = Math_Atan2S_XY(dz, dx); + Math_SmoothStepToS(&this->picto.actor.world.rot.y, arcTan, 2, 0xBB8, 0xC8); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + arcTan -= this->picto.actor.world.rot.y; + + if (ABS_ALT(arcTan) < 0x3E8) { + if (this->picto.actor.speed < 7.5f) { + this->picto.actor.speed += 1.5f; + } + } else { + if (this->picto.actor.speed > 4.0f) { + this->picto.actor.speed -= 1.5f; + } else if (this->picto.actor.speed < 2.0f) { + this->picto.actor.speed += 1.5f; + } + } + + distSq = SQ(dx) + SQ(dz); + if (distSq < SQ(8.0f)) { + this->destPointIndex++; + this->picto.actor.world.pos.x = destPoint->x; + this->picto.actor.world.pos.z = destPoint->z; + if (this->destPointIndex >= path->count) { + return MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_FINISHEDPATH; + } + if (flags & MONKEY_FOLLOWPATH_FLAGS_REACHNEXTPOINT) { + return MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_REACHEDPOINT; + } + } else if ((flags & MONKEY_FOLLOWPATH_FLAGS_LONGRANGE) && (distSq < SQ(20.0f))) { + this->destPointIndex++; + if (this->destPointIndex >= path->count) { + return MONKEY_FOLLOWPATH_RESULT_LONGRANGE_FINISHEDPATH; + } + if (flags & MONKEY_FOLLOWPATH_FLAGS_REACHNEXTPOINT) { + return MONKEY_FOLLOWPATH_RESULT_LONGRANGE_REACHEDPOINT; + } + } + return MONKEY_FOLLOWPATH_RESULT_FOLLOWING; +} + +void func_80AB5F6C(EnMnk* this) { + s32 pad; + u32 animIndex; + + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + SkelAnime_Update(&this->skelAnime); + + if ((s32)this->skelAnime.curFrame == 0) { + if (this->unk_3C8 < 0) { + EnMnk_Monkey_ChangeAnim(this, 100, ANIMMODE_LOOP, 0.0f); + this->unk_3C8++; + } else if (this->unk_3C8 > 0) { + this->unk_3C8--; + } else { + + do { + animIndex = D_80AB9DD8[(s32)Rand_ZeroFloat(7.0f)]; + } while (animIndex == this->unk_3D4); + + EnMnk_Monkey_ChangeAnim(this, animIndex, ANIMMODE_LOOP, 0.0f); + + switch (animIndex) { + case 100: + this->unk_3C8 = -(s32)(Rand_ZeroFloat(6.0f) + 6.0f); + break; + + case 2: + this->unk_3C8 = Rand_ZeroFloat(6.0f) + 6.0f; + break; + + default: + this->unk_3C8 = Rand_ZeroFloat(2.0f) + 1.0f; + break; + } + + this->unk_3D4 = animIndex; + } + } +} + +void func_80AB60FC(EnMnk* this, PlayState* play) { + f32 depthInWater; + + SkelAnime_Update(&this->skelAnime); + if (EnMnk_FollowPath(this, 0) != MONKEY_FOLLOWPATH_RESULT_FOLLOWING) { + this->pathIndex = this->path->additionalPathIndex; + if (this->pathIndex == ADDITIONAL_PATH_INDEX_NONE) { + Flags_SetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor) + 1); + Actor_Kill(&this->picto.actor); + return; + } + } + + depthInWater = this->picto.actor.depthInWater; + if (depthInWater > 0.0f) { + this->picto.actor.world.pos.y += depthInWater; + if ((s32)this->skelAnime.curFrame == 0) { + EnMnk_SpawnWaterEffects(this, play); + } + EnMnk_PlayWaterWalkSfx(this); + return; + } + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + EnMnk_PlayWalkSfx(this); + } +} + +void func_80AB61E8(EnMnk* this, PlayState* play) { + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x7D9: + Message_ContinueTextbox(play, 0x7DA); + EnMnk_Monkey_SetAnim(this, 3); + break; + + case 0x7DA: + Message_ContinueTextbox(play, 0x7DB); + EnMnk_Monkey_SetAnim(this, 2); + break; + + case 0x7DB: + Message_CloseTextbox(play); + EnMnk_StartNextPath(this, play); + this->destPointIndex = 0; + this->actionFunc = func_80AB60FC; + this->picto.actor.velocity.y = -20.0f; + this->picto.actor.terminalVelocity = -20.0f; + break; + + default: + break; + } + } + SkelAnime_Update(&this->skelAnime); +} + +void func_80AB6304(EnMnk* this, PlayState* play) { + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + this->flags |= MONKEY_FLAGS_4; + } + + SkelAnime_Update(&this->skelAnime); + if (this->flags & MONKEY_FLAGS_4) { + Message_ContinueTextbox(play, 0x7D9); + EnMnk_Monkey_SetAnim(this, 7); + this->actionFunc = func_80AB61E8; + this->flags &= ~MONKEY_FLAGS_4; + } +} + +void func_80AB63CC(EnMnk* this, PlayState* play) { + s32 pad; + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + this->flags |= MONKEY_FLAGS_4; + } + + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + + if (SkelAnime_Update(&this->skelAnime)) { + Animation_PlayLoop(&this->skelAnime, &object_mnk_Anim_008814); + this->actionFunc = func_80AB6304; + } + + if (this->picto.actor.velocity.y < 0.0f) { + this->flags &= ~MONKEY_FLAGS_2; + } + + if (Animation_OnFrame(&this->skelAnime, 5.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_VO_JOY); + } +} + +void func_80AB64B8(EnMnk* this, PlayState* play) { + if (!(this->flags & MONKEY_FLAGS_8)) { + SkelAnime_Update(&this->skelAnime); + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + } + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->picto.actor.flags &= ~ACTOR_FLAG_10000; + this->actionFunc = func_80AB63CC; + EnMnk_Monkey_ChangeAnim(this, 9, ANIMMODE_ONCE, -5.0f); + this->picto.actor.velocity.y = 3.6f; + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.gravity = -0.4f; + this->flags &= ~MONKEY_FLAGS_1; + this->flags &= ~MONKEY_FLAGS_4; + } else if (this->picto.actor.xzDistToPlayer < 100.0f) { + this->picto.actor.flags |= ACTOR_FLAG_10000; + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } else { + this->picto.actor.flags &= ~ACTOR_FLAG_10000; + } +} + +void EnMnk_Monkey_RunAndWaitAtEachPoint(EnMnk* this, PlayState* play) { + MonkeyFollowPathResult followPathResult; + + SkelAnime_Update(&this->skelAnime); + followPathResult = + EnMnk_FollowPath(this, MONKEY_FOLLOWPATH_FLAGS_REACHNEXTPOINT | MONKEY_FOLLOWPATH_FLAGS_LONGRANGE); + if (followPathResult != MONKEY_FOLLOWPATH_RESULT_FOLLOWING) { + if ((followPathResult == MONKEY_FOLLOWPATH_RESULT_SHORTRANGE_FINISHEDPATH) || + (followPathResult == MONKEY_FOLLOWPATH_RESULT_LONGRANGE_FINISHEDPATH)) { + this->pathIndex = this->path->additionalPathIndex; + if (this->pathIndex == ADDITIONAL_PATH_INDEX_NONE) { + this->pathIndex = PATH_INDEX_NONE; + } + this->path = &play->setupPathList[this->pathIndex]; + this->destPointIndex = 0; + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = func_80AB64B8; + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.velocity.y = 0.0f; + this->picto.actor.speed = 0.0f; + this->picto.actor.gravity = -1.0f; + } else if (this->picto.actor.xzDistToPlayer > 160.0f) { + this->actionFunc = EnMnk_Monkey_WaitToRunAndWaitAtEachPoint; + this->flags |= MONKEY_FLAGS_1 | MONKEY_FLAGS_2; + this->picto.actor.speed = 0.0f; + EnMnk_Monkey_SetAnim(this, 9); + return; + } + } + + if (this->flags & MONKEY_FLAGS_40) { + EnMnk_PlayWalkSfx(this); + } else { + if ((s32)this->skelAnime.curFrame == 0) { + EnMnk_SpawnWaterEffects(this, play); + } + EnMnk_PlayWaterWalkSfx(this); + } +} + +void EnMnk_Monkey_WaitToRunAndWaitAtEachPoint(EnMnk* this, PlayState* play) { + s32 pad[2]; + + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + SkelAnime_Update(&this->skelAnime); + + if (this->picto.actor.xzDistToPlayer < 160.0f) { + this->flags |= MONKEY_FLAGS_80; + EnMnk_StartNextPath(this, play); + this->actionFunc = EnMnk_Monkey_RunAndWaitAtEachPoint; + this->flags &= ~MONKEY_FLAGS_1; + this->flags &= ~MONKEY_FLAGS_2; + } + + if (!(this->flags & MONKEY_FLAGS_40)) { + if (((s32)this->skelAnime.curFrame == 0) || Animation_OnFrame(&this->skelAnime, 14.0f)) { + EnMnk_SpawnWaterEffects(this, play); + } + } + + if (Animation_OnFrame(&this->skelAnime, 5.0f)) { + if ((this->unk_3D4 % 4) != 0) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_VO_JOY); + } + this->unk_3D4++; + } +} + +void EnMnk_Monkey_TalkAfterRun(EnMnk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + this->flags |= MONKEY_FLAGS_4; + Message_CloseTextbox(play); + } + + if (SkelAnime_Update(&this->skelAnime)) { + if (this->flags & MONKEY_FLAGS_4) { + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitToTalkAfterRun; + } else { + Animation_PlayOnce(&this->skelAnime, &object_mnk_Anim_009CC0); + } + } +} + +void EnMnk_Monkey_WaitToTalkAfterRun(EnMnk* this, PlayState* play) { + s32 pad[2]; + + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + SkelAnime_Update(&this->skelAnime); + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + Animation_PlayOnce(&this->skelAnime, &object_mnk_Anim_009CC0); + this->actionFunc = EnMnk_Monkey_TalkAfterRun; + this->flags &= ~MONKEY_FLAGS_4; + } else if (this->picto.actor.xzDistToPlayer < 100.0f) { + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } +} + +void EnMnk_Monkey_Run(EnMnk* this, PlayState* play) { + s32 switchFlag; + + SkelAnime_Update(&this->skelAnime); + if (EnMnk_FollowPath(this, MONKEY_FOLLOWPATH_FLAGS_LONGRANGE) != MONKEY_FOLLOWPATH_RESULT_FOLLOWING) { + EnMnk_Monkey_SetAnim(this, 0); + this->picto.actor.velocity.y = -9.0f; + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.gravity = -1.0f; + this->picto.actor.speed = 0.0f; + if (MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDECHAMBER) { + switchFlag = MONKEY_GET_SWITCH_FLAG(&this->picto.actor); + if (switchFlag != 0x7F) { + Flags_SetSwitch(play, switchFlag + 1); + } + Actor_Kill(&this->picto.actor); + } else { + this->picto.actor.textId = 0x7D2; + this->actionFunc = EnMnk_Monkey_WaitToTalkAfterRun; + } + } + + if (this->picto.actor.depthInWater > 0.0f) { + this->picto.actor.world.pos.y += this->picto.actor.depthInWater; + if ((s32)this->skelAnime.curFrame == 0) { + EnMnk_SpawnWaterEffects(this, play); + } + EnMnk_PlayWaterWalkSfx(this); + } else if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + EnMnk_PlayWalkSfx(this); + } +} + +void EnMnk_Monkey_WaitToRun(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (CHECK_EVENTINF(EVENTINF_25)) { + EnMnk_StartNextPath(this, play); + this->destPointIndex = 0; + this->actionFunc = EnMnk_Monkey_Run; + this->collider.dim.radius = 15; + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + this->flags &= ~MONKEY_FLAGS_8; + } +} + +void EnMnk_Monkey_SetupRunAfterTalk(EnMnk* this, PlayState* play) { + Message_CloseTextbox(play); + EnMnk_StartNextPath(this, play); + this->destPointIndex = 0; + this->actionFunc = EnMnk_Monkey_Run; + this->collider.dim.radius = 15; + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + this->unk_3E0 = 0; + this->flags &= ~MONKEY_FLAGS_8; +} + +void EnMnk_Monkey_TalkAfterApproach(EnMnk* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime)) { + EnMnk_Monkey_ChangeAnim(this, 100, ANIMMODE_ONCE, 0.0f); + SkelAnime_Update(&this->skelAnime); + } + + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { + case 1: + Audio_PlaySfx_MessageDecide(); + EnMnk_Monkey_ChangeAnim(this, 10, ANIMMODE_ONCE, -5.0f); + Message_ContinueTextbox(play, 0x7D7); + break; + + case 0: + Audio_PlaySfx_MessageCancel(); + EnMnk_Monkey_SetAnim(this, 7); + Message_ContinueTextbox(play, 0x7D6); + this->unk_3E0 = 6; + break; + } + } + break; + + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x7D0: + EnMnk_Monkey_SetAnim(this, 3); + Message_ContinueTextbox(play, 0x7D1); + this->unk_3E0 = 5; + break; + + case 0x7D3: + case 0x7D6: + EnMnk_Monkey_SetAnim(this, 3); + Message_ContinueTextbox(play, 0x7D4); + break; + + case 0x7D1: + EnMnk_Monkey_SetAnim(this, 7); + Message_ContinueTextbox(play, 0x7D2); + this->unk_3E0 = 4; + break; + + case 0x7D4: + EnMnk_Monkey_SetAnim(this, 5); + Message_ContinueTextbox(play, 0x7D5); + this->unk_3E0 = 6; + break; + + case 0x7D2: + SET_EVENTINF(EVENTINF_25); + EnMnk_Monkey_SetupRunAfterTalk(this, play); + SET_WEEKEVENTREG(WEEKEVENTREG_79_02); + break; + + case 0x7D7: + EnMnk_Monkey_SetupRunAfterTalk(this, play); + SET_WEEKEVENTREG(WEEKEVENTREG_08_02); + break; + + default: + break; + } + } + break; + + default: + break; + } +} + +void EnMnk_Monkey_MoveRelativeToPlayer(EnMnk* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s16 angleToPlayer = Math_Atan2S_XY(player->actor.world.pos.z - this->picto.actor.home.pos.z, + player->actor.world.pos.x - this->picto.actor.home.pos.x); + + this->picto.actor.shape.rot.y = angleToPlayer; + + if (this->flags & MONKEY_FLAGS_10) { + this->picto.actor.shape.rot.y = (this->picto.actor.shape.rot.y + 0x8000) & 0xFFFF; + } + + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; + this->picto.actor.world.pos.x = + (Math_SinS(angleToPlayer) * this->approachPlayerRadius) + this->picto.actor.home.pos.x; + this->picto.actor.world.pos.z = + (Math_CosS(angleToPlayer) * this->approachPlayerRadius) + this->picto.actor.home.pos.z; +} + +void EnMnk_Monkey_UnapproachPlayer(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + this->approachPlayerRadius -= 5.0f; + EnMnk_Monkey_MoveRelativeToPlayer(this, play); + if (this->approachPlayerRadius < 4.0f) { + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitForPlayerApproach; + this->flags &= ~MONKEY_FLAGS_10; + this->approachPlayerRadius = 0.0f; + } + EnMnk_PlayWalkSfx(this); + if ((MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDEWOODS) && + (MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) && + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + EnMnk_Monkey_SetAnim(this, 2); + this->actionFunc = EnMnk_Monkey_WaitToRun; + } +} + +void EnMnk_Monkey_WaitToTalkAfterApproach(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnMnk_Monkey_MoveRelativeToPlayer(this, play); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + if (MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDECHAMBER) { + EnMnk_Monkey_SetAnim(this, 2); + } else { + EnMnk_Monkey_SetAnim(this, 5); + } + this->unk_3E0 = 6; + this->actionFunc = EnMnk_Monkey_TalkAfterApproach; + if (MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) { + Flags_SetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor)); + } + } else if ((MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDEWOODS) && + (MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) && + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + EnMnk_Monkey_SetAnim(this, 2); + this->actionFunc = EnMnk_Monkey_WaitToRun; + } else if (this->picto.actor.xzDistToPlayer > 150.0f) { + EnMnk_Monkey_SetAnim(this, 1); + this->flags |= MONKEY_FLAGS_10; + this->actionFunc = EnMnk_Monkey_UnapproachPlayer; + } else if (this->picto.actor.xzDistToPlayer < 100.0f) { + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } +} + +void EnMnk_Monkey_ApproachPlayer(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + this->approachPlayerRadius += 5.0f; + EnMnk_Monkey_MoveRelativeToPlayer(this, play); + + if (this->approachPlayerRadius > 84.0f) { + if (MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDECHAMBER) { + EnMnk_Monkey_SetAnim(this, 7); + } else { + EnMnk_Monkey_SetAnim(this, 2); + } + this->actionFunc = EnMnk_Monkey_WaitToTalkAfterApproach; + } + + EnMnk_PlayWalkSfx(this); + + if ((MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDEWOODS) && + (MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) && + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + EnMnk_Monkey_SetAnim(this, 2); + this->actionFunc = EnMnk_Monkey_WaitToRun; + } +} + +void EnMnk_Monkey_WaitForPlayerApproach(EnMnk* this, PlayState* play) { + EnMnk_Monkey_MoveRelativeToPlayer(this, play); + SkelAnime_Update(&this->skelAnime); + + if (this->picto.actor.xzDistToPlayer < 200.0f) { + EnMnk_Monkey_SetAnim(this, 1); + this->actionFunc = EnMnk_Monkey_ApproachPlayer; + } + + if ((MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDEWOODS) && + (MONKEY_GET_SWITCH_FLAG(&this->picto.actor) != 0x7F) && + Flags_GetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor))) { + EnMnk_Monkey_SetAnim(this, 2); + this->actionFunc = EnMnk_Monkey_WaitToRun; + } +} + +void EnMnk_Monkey_Drop(EnMnk* this, PlayState* play) { + if (((this->picto.actor.world.pos.y - this->picto.actor.home.pos.y) < 40.0f) && + SkelAnime_Update(&this->skelAnime)) { + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitForPlayerApproach; + + if (MONKEY_GET_TYPE(&this->picto.actor) == MONKEY_OUTSIDEWOODS) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_WALK); + } + } +} + +void EnMnk_Monkey_SetupDrop(EnMnk* this) { + this->flags &= ~MONKEY_FLAGS_20; + this->picto.actor.world.pos.y = this->picto.actor.home.pos.y + 200.0f; + this->actionFunc = EnMnk_Monkey_Drop; + this->picto.actor.velocity.y = -10.0f; + this->picto.actor.terminalVelocity = -10.0f; + this->picto.actor.flags |= ACTOR_FLAG_TARGETABLE; + this->picto.actor.draw = EnMnk_Draw; + Animation_Change(&this->skelAnime, &object_mnk_Anim_008814, 1.0f, 10.0f, + Animation_GetLastFrame(&object_mnk_Anim_008814), ANIMMODE_ONCE, 0.0f); +} + +void EnMnk_Monkey_WaitOutsideWoods(EnMnk* this, PlayState* play) { + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + + if (((this->picto.actor.xzDistToPlayer < 200.0f) && CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) || + CHECK_EVENTINF(EVENTINF_26)) { + SET_EVENTINF(EVENTINF_26); + EnMnk_Monkey_SetupDrop(this); + } +} + +void EnMnk_Monkey_WaitOutsideChamber(EnMnk* this, PlayState* play) { + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + if ((this->picto.actor.xzDistToPlayer < 200.0f) && + ((CHECK_WEEKEVENTREG(WEEKEVENTREG_18_01) || CHECK_WEEKEVENTREG(WEEKEVENTREG_88_01)) && (play->curSpawn != 0))) { + EnMnk_Monkey_SetupDrop(this); + } +} + +void EnMnk_Monkey_FollowPathAndWait(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (EnMnk_FollowPath(this, MONKEY_FOLLOWPATH_FLAGS_LONGRANGE) != MONKEY_FOLLOWPATH_RESULT_FOLLOWING) { + this->pathIndex = this->path->additionalPathIndex; + if (this->pathIndex == ADDITIONAL_PATH_INDEX_NONE) { + Flags_SetSwitch(play, MONKEY_GET_SWITCH_FLAG(&this->picto.actor)); + Actor_Kill(&this->picto.actor); + return; + } + EnMnk_Monkey_SetAnim(this, 0); + this->actionFunc = EnMnk_Monkey_WaitToFollowPath; + this->picto.actor.speed = 0.0f; + } + EnMnk_PlayWalkSfx(this); +} + +void EnMnk_Monkey_WaitToFollowPath(EnMnk* this, PlayState* play) { + if ((this->picto.actor.playerHeightRel > -10.0f) && (this->picto.actor.xzDistToPlayer < 160.0f)) { + EnMnk_StartNextPath(this, play); + this->destPointIndex = 0; + this->actionFunc = EnMnk_Monkey_FollowPathAndWait; + } else { + func_80AB5F6C(this); + } +} + +s32 EnMnk_PlayerIsInTalkRange(EnMnk* this, PlayState* play) { + s32 absYawTowardsPlayer; + + if ((this->picto.actor.xzDistToPlayer < 100.0f) && (this->picto.actor.xzDistToPlayer > 20.0f)) { + absYawTowardsPlayer = ABS_ALT(this->picto.actor.yawTowardsPlayer); + if ((absYawTowardsPlayer > 0x4000) && Player_IsFacingActor(&this->picto.actor, 0x3000, play)) { + return true; + } + } + return false; +} + +void EnMnk_MonkeyTiedUp_TeachSong(EnMnk* this, PlayState* play) { + s32 pad; + + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + switch (play->msgCtx.currentTextId) { + case 0x8D9: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + break; + + case 0x8DC: + case 0x8DF: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND); + break; + + case 0x8DD: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_SMALLCLAPFEET); + this->unk_3E0 = 5; + break; + + case 0x8DE: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + break; + + case 0x8E0: + case 0x1B66: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_LARGECLAPFEET); + break; + + case 0x8E1: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + break; + + case 0x1B5C: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_SING); + break; + + case 0x8E2: + EnMnk_MonkeyTiedUp_SetNewAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND); + this->unk_3E0 = 0; + break; + + default: + break; + } + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && !(this->flags & MONKEY_FLAGS_4000) && + Message_ShouldAdvance(play)) { + + switch (play->msgCtx.choiceIndex) { + case 1: + this->picto.actor.csId = this->csIdList[5]; + this->csId = 5; + SET_WEEKEVENTREG(WEEKEVENTREG_09_80); + this->flags |= MONKEY_FLAGS_2000; + Audio_PlaySfx_MessageDecide(); + break; + + case 0: + Audio_PlaySfx_MessageCancel(); + this->picto.actor.csId = this->csIdList[4]; + this->csId = 4; + break; + + default: + break; + } + this->flags |= MONKEY_FLAGS_4000; + } + + if (this->picto.actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->picto.actor.csId)) { + this->flags &= ~MONKEY_FLAGS_4000; + CutsceneManager_StartWithPlayerCs(this->picto.actor.csId, &this->picto.actor); + + switch (this->csId) { + case 2: + this->csId = 3; + break; + + case 4: + this->csId = 3; + break; + + case 5: + this->csId = 6; + break; + + default: + this->picto.actor.csId = CS_ID_NONE; + return; + } + this->picto.actor.csId = this->csIdList[this->csId]; + } else { + CutsceneManager_Queue(this->picto.actor.csId); + } + } +} + +void EnMnk_MonkeyTiedUp_ReactToWrongInstrument(EnMnk* this, PlayState* play) { + Actor* actor = &this->picto.actor; + + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x8D4: + case 0x8DA: + case 0x8DB: + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyTiedUp_WaitForInstrument; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_WAIT); + if (this->csId != CS_ID_NONE) { + CutsceneManager_Stop(this->csId); + this->picto.actor.csId = this->csIdList[0]; + this->csId = CS_ID_NONE; + return; + } + break; + + case 0x8D5: + Message_ContinueTextbox(play, 0x8DA); + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + break; + + case 0x8D6: + Message_ContinueTextbox(play, 0x8DB); + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + break; + + default: + break; + } + } + + if (actor->csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(actor->csId)) { + CutsceneManager_Start(actor->csId, actor); + + this->csId = actor->csId; + actor->csId = (actor->csId == this->csIdList[0]) ? this->csIdList[1] : CS_ID_NONE; + } else { + CutsceneManager_Queue(actor->csId); + } + } +} + +void EnMnk_MonkeyTiedUp_TalkUnused(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + if (Actor_TextboxIsClosing(&this->picto.actor, play)) { + this->actionFunc = EnMnk_MonkeyTiedUp_WaitUnused; + } +} + +void EnMnk_MonkeyTiedUp_TransitionAfterTalk(EnMnk* this, PlayState* play) { + s32 pad; + + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + if (play->msgCtx.currentTextId == 0x8CD) { + if (this->skelAnime.curFrame <= 17.0f) { + this->unk_3E0 = 0; + } else { + this->unk_3E0 = 2; + } + } + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x8CA: + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + if (play->curSpawn != 1) { + Message_ContinueTextbox(play, 0x8CB); + SET_WEEKEVENTREG(WEEKEVENTREG_88_01); + } else { + Message_ContinueTextbox(play, 0x8EB); + this->flags |= MONKEY_FLAGS_1000; + } + break; + + case 0x8CB: + case 0x8EB: + case 0x8EC: + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyTiedUp_Wait; + this->cueId = 4; + EnMnk_MonkeyTiedUp_ChangeAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND, ANIMMODE_ONCE, -5.0f); + break; + + case 0x8CC: + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHH); + this->unk_3E0 = 2; + Message_ContinueTextbox(play, 0x8CD); + break; + + case 0x8CD: + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + Message_ContinueTextbox(play, 0x8CE); + break; + + case 0x8CE: + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + Message_ContinueTextbox(play, 0x8CF); + break; + + case 0x8CF: + case 0x8D0: + case 0x8D1: + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyTiedUp_WaitForCutRope; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + break; + + case 0x8D3: + if ((gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) || + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyTiedUp_WaitForInstrument; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_WAIT); + } else { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + Message_ContinueTextbox(play, 0x8D7); + } + break; + + case 0x8D2: + case 0x8D7: + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyTiedUp_WaitForInstrument; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_WAIT); + break; + + default: + break; + } + } +} + +void EnMnk_MonkeyTiedUp_WaitUnused(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_MonkeyTiedUp_TalkUnused; + this->unk_3E0 = 0; + } else if (EnMnk_PlayerIsInTalkRange(this, play)) { + this->picto.actor.textId = 0x8E2; + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } +} + +void EnMnk_MonkeyTiedUp_WaitForInstrument(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (func_800B8718(&this->picto.actor, &play->state)) { + switch (gSaveContext.save.playerForm) { + case PLAYER_FORM_HUMAN: + case PLAYER_FORM_FIERCE_DEITY: + this->picto.actor.textId = 0x8D4; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + break; + + case PLAYER_FORM_GORON: + this->picto.actor.textId = 0x8D5; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + break; + + case PLAYER_FORM_ZORA: + this->picto.actor.textId = 0x8D6; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + break; + + case PLAYER_FORM_DEKU: + this->picto.actor.textId = 0x8D8; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + this->actionFunc = EnMnk_MonkeyTiedUp_TeachSong; + this->csId = 2; + SET_EVENTINF(EVENTINF_24); + this->picto.actor.csId = this->csIdList[2]; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; + CutsceneManager_Queue(this->csIdList[2]); + return; + + default: + this->picto.actor.textId = 0x8D4; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + break; + } + this->actionFunc = EnMnk_MonkeyTiedUp_ReactToWrongInstrument; + this->picto.actor.csId = this->csIdList[0]; + Message_StartTextbox(play, this->picto.actor.textId, NULL); + CutsceneManager_Queue(this->picto.actor.csId); + } else if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_MonkeyTiedUp_TransitionAfterTalk; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND); + } else if (EnMnk_PlayerIsInTalkRange(this, play)) { + this->picto.actor.textId = 0x8D3; + Actor_OfferTalk(&this->picto.actor, play, 100.0f); + func_800B874C(&this->picto.actor, play, 100.0f, 100.0f); + } +} + +void EnMnk_MonkeyTiedUp_TalkAfterCutRope(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_MonkeyTiedUp_TransitionAfterTalk; + this->picto.actor.flags &= ~ACTOR_FLAG_10000; + } else { + Actor_OfferTalk(&this->picto.actor, play, 150.0f); + } +} + +void EnMnk_MonkeyTiedUp_WaitForCutRope(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) || + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHH); + this->unk_3E0 = 5; + } else { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_CONFUSED); + } + this->actionFunc = EnMnk_MonkeyTiedUp_TransitionAfterTalk; + } else if (this->collider.base.acFlags & AC_HIT) { + this->actionFunc = EnMnk_MonkeyTiedUp_TalkAfterCutRope; + this->picto.actor.textId = 0x8D2; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + this->picto.actor.flags |= ACTOR_FLAG_10000; + } else if (EnMnk_PlayerIsInTalkRange(this, play)) { + if ((gSaveContext.save.playerForm != PLAYER_FORM_FIERCE_DEITY) && + (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN)) { + this->picto.actor.textId = 0x8D1; + } else { + this->picto.actor.textId = 0x8D0; + } + Actor_OfferTalk(&this->picto.actor, play, 100.0f); + } +} + +void EnMnk_MonkeyTiedUp_Wait(EnMnk* this, PlayState* play) { + s32 pad; + + SkelAnime_Update(&this->skelAnime); + if (SkelAnime_Update(&this->propSkelAnime)) { + this->cueId--; + if (this->cueId < 0) { + this->cueId = 4; + EnMnk_MonkeyTiedUp_ChangeAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND, ANIMMODE_ONCE, -5.0f); + } else if (this->cueId == 0) { + EnMnk_MonkeyTiedUp_ChangeAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD, ANIMMODE_ONCE, -5.0f); + } else { + EnMnk_MonkeyTiedUp_ChangeAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND, ANIMMODE_ONCE, 0.0f); + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + } + } + if (func_800B8718(&this->picto.actor, &play->state)) { + this->picto.actor.textId = 0x8D8; + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + this->actionFunc = EnMnk_MonkeyTiedUp_TeachSong; + this->csId = 2; + SET_EVENTINF(EVENTINF_24); + this->picto.actor.csId = this->csIdList[2]; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; + CutsceneManager_Queue(this->csIdList[2]); + } else if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (this->picto.actor.textId == 0x8EC) { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_SHAKEHEAD); + } else { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKAROUND); + } + } else { + EnMnk_MonkeyTiedUp_SetAnim(this, MONKEY_TIEDUP_ANIM_KICKUPANDDOWN); + } + this->actionFunc = EnMnk_MonkeyTiedUp_TransitionAfterTalk; + } else if (EnMnk_PlayerIsInTalkRange(this, play)) { + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (this->flags & MONKEY_FLAGS_1000) { + this->picto.actor.textId = 0x8EC; + } else { + this->picto.actor.textId = 0x8CA; + } + func_800B874C(&this->picto.actor, play, 100.0f, 100.0f); + } else { + this->picto.actor.textId = 0x8CC; + } + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } else if ((play->curSpawn != 1) && (this->picto.actor.xzDistToPlayer < 140.0f) && + Player_IsFacingActor(&this->picto.actor, 0x3000, play)) { + this->picto.actor.textId = 0x8CA; + Actor_OfferTalk(&this->picto.actor, play, 140.0f); + } +} + +void EnMnk_MonkeyHanging_WaitForTextboxAfterDunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + if (this->flags & MONKEY_FLAGS_800) { + this->flags &= ~MONKEY_FLAGS_800; + CutsceneManager_Stop(this->picto.actor.csId); + } + Message_CloseTextbox(play); + this->actionFunc = EnMnk_MonkeyHanging_WaitAfterDunk; + func_800B7298(play, NULL, PLAYER_CSMODE_END); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_08); + } +} + +void EnMnk_MonkeyHanging_RaiseFromDunk2(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (this->unk_3C8 > 0) { + this->unk_3D0 -= 0x320; + this->approachPlayerRadius -= 0.01f; + this->unk_3C8--; + } else { + this->unk_3C8 = 240; + this->actionFunc = EnMnk_MonkeyHanging_WaitForTextboxAfterDunk; + EnMnk_MonkeyHanging_SetAnim(this, MONKEY_HANGING_ANIM_FREEZE); + Message_ContinueTextbox(play, 0x8EA); + } +} + +void EnMnk_MonkeyHanging_PauseDuringDunk2(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + if (this->unk_3C8 > 0) { + this->unk_3C8--; + } else { + this->unk_3C8 = 60; + this->actionFunc = EnMnk_MonkeyHanging_RaiseFromDunk2; + EnMnk_MonkeyHanging_ChangeAnim(this, MONKEY_HANGING_ANIM_RISE, ANIMMODE_ONCE, -5.0f); + this->unk_3E0 = 3; + } +} + +void EnMnk_MonkeyHanging_MakeSplash(EnMnk* this, PlayState* play) { + Vec3f effSpawnPos; + + Math_Vec3f_Copy(&effSpawnPos, &this->picto.actor.focus.pos); + effSpawnPos.y += 20.0f; + EffectSsGSplash_Spawn(play, &effSpawnPos, &sMonkeyHangingSplashPrimColor, &sMonkeyHangingSplashEnvColor, 0, 300); +} + +void EnMnk_MonkeyHanging_Dunk2(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (this->unk_3C8 > 0) { + this->unk_3D0 += 0x320; + this->approachPlayerRadius += 0.01f; + this->unk_3C8--; + if (this->unk_3C8 == 0xA) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_BOMB_DROP_WATER); + EnMnk_MonkeyHanging_MakeSplash(this, play); + } + } else { + this->unk_3C8 = 20; + this->actionFunc = EnMnk_MonkeyHanging_PauseDuringDunk2; + } +} + +void EnMnk_MonkeyHanging_Plead(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x8E8: + Message_ContinueTextbox(play, 0x8E9); + break; + + case 0x8E9: + this->actionFunc = EnMnk_MonkeyHanging_Dunk2; + Message_CloseTextbox(play); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_WAIT); + this->unk_3C8 = 60; + break; + + default: + break; + } + } + if (!(this->flags & MONKEY_FLAGS_800)) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->picto.actor.csId); + } else if (CutsceneManager_IsNext(this->picto.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->picto.actor.csId, &this->picto.actor); + this->flags |= MONKEY_FLAGS_800; + } else { + CutsceneManager_Queue(this->picto.actor.csId); + } + } +} + +void EnMnk_MonkeyHanging_WaitAfterDunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_MonkeyHanging_Plead; + CutsceneManager_Queue(this->picto.actor.csId); + SET_WEEKEVENTREG(WEEKEVENTREG_83_08); + EnMnk_MonkeyHanging_SetAnim(this, MONKEY_HANGING_ANIM_STRUGGLE); + this->unk_3E0 = 5; + } else if (this->unk_3C8 > 0) { + this->unk_3C8--; + if (this->picto.actor.isLockedOn && (this->picto.actor.csId != CS_ID_NONE)) { + Actor_OfferTalk(&this->picto.actor, play, 1000.0f); + } + } else { + this->unk_3C8 = 240; + this->actionFunc = EnMnk_MonkeyHanging_StruggleBeforeDunk; + EnMnk_MonkeyHanging_SetAnim(this, MONKEY_HANGING_ANIM_STRUGGLE); + this->unk_3E0 = 5; + } +} + +void EnMnk_MonkeyHanging_RaiseFromDunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (this->unk_3C8 > 0) { + this->unk_3D0 -= 0x320; + this->approachPlayerRadius -= 0.01f; + this->unk_3C8--; + } else { + this->unk_3C8 = 240; + this->actionFunc = EnMnk_MonkeyHanging_WaitAfterDunk; + EnMnk_MonkeyHanging_SetAnim(this, MONKEY_HANGING_ANIM_FREEZE); + } +} + +void EnMnk_MonkeyHanging_PauseDuringDunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (this->unk_3C8 > 0) { + this->unk_3C8--; + } else { + this->unk_3C8 = 60; + this->actionFunc = EnMnk_MonkeyHanging_RaiseFromDunk; + EnMnk_MonkeyHanging_ChangeAnim(this, MONKEY_HANGING_ANIM_RISE, ANIMMODE_ONCE, -5.0f); + this->unk_3E0 = 3; + } +} + +void EnMnk_MonkeyHanging_Dunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (this->unk_3C8 > 0) { + this->unk_3D0 += 0x320; + this->approachPlayerRadius += 0.01f; + this->unk_3C8--; + if (this->unk_3C8 == 0xA) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_BOMB_DROP_WATER); + EnMnk_MonkeyHanging_MakeSplash(this, play); + } + } else { + this->unk_3C8 = 20; + this->actionFunc = EnMnk_MonkeyHanging_PauseDuringDunk; + } +} + +void EnMnk_MonkeyHanging_StruggleBeforeDunk(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->propSkelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_MonkeyHanging_Plead; + CutsceneManager_Queue(this->picto.actor.csId); + SET_WEEKEVENTREG(WEEKEVENTREG_83_08); + } else if (this->unk_3C8 > 0) { + this->unk_3C8--; + if (this->picto.actor.isLockedOn) { + Actor_OfferTalk(&this->picto.actor, play, 1000.0f); + } + } else { + this->unk_3C8 = 60; + this->actionFunc = EnMnk_MonkeyHanging_Dunk; + } +} + +void EnMnk_Monkey_GuideThroughWoods(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + + if (EnMnk_FollowPath(this, 0) != MONKEY_FOLLOWPATH_RESULT_FOLLOWING) { + this->pathIndex = this->path->additionalPathIndex; + if (this->pathIndex == ADDITIONAL_PATH_INDEX_NONE) { + Actor_Kill(&this->picto.actor); + return; + } + this->path = &play->setupPathList[this->pathIndex]; + this->destPointIndex = 0; + } + EnMnk_PlayWalkSfx(this); +} + +void EnMnk_Monkey_TalkBeforeGuideThroughWoods(EnMnk* this, PlayState* play) { + Math_SmoothStepToS(&this->picto.actor.world.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0xBB8, 0xC8); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0xBB8, 0xC8); + SkelAnime_Update(&this->skelAnime); + + if (Actor_TextboxIsClosing(&this->picto.actor, play)) { + EnMnk_StartNextPath(this, play); + this->actionFunc = EnMnk_Monkey_GuideThroughWoods; + this->flags |= MONKEY_FLAGS_8000; + } +} + +void EnMnk_Monkey_SetupTalkBeforeGuideThroughWoods(EnMnk* this) { + switch ((u32)Rand_ZeroFloat(6.0f)) { + case 0: + EnMnk_Monkey_SetAnim(this, 3); + break; + + case 1: + EnMnk_Monkey_SetAnim(this, 4); + break; + + case 2: + EnMnk_Monkey_SetAnim(this, 5); + break; + + case 3: + EnMnk_Monkey_SetAnim(this, 6); + break; + + case 4: + EnMnk_Monkey_SetAnim(this, 2); + break; + + default: + EnMnk_Monkey_SetAnim(this, 7); + break; + } + this->actionFunc = EnMnk_Monkey_TalkBeforeGuideThroughWoods; +} + +void EnMnk_Monkey_WaitToGuideThroughWoods(EnMnk* this, PlayState* play) { + func_80AB5F6C(this); + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + EnMnk_Monkey_SetupTalkBeforeGuideThroughWoods(this); + } else if (this->picto.actor.isLockedOn || (this->picto.actor.xzDistToPlayer < 100.0f)) { + Actor_OfferTalk(&this->picto.actor, play, 120.0f); + } + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { + Actor_Kill(&this->picto.actor); + } +} + +void EnMnk_Monkey_TalkAfterSaved(EnMnk* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x8E5: + Message_ContinueTextbox(play, 0x8E6); + EnMnk_Monkey_SetAnim(this, 3); + break; + + case 0x8E6: + Message_ContinueTextbox(play, 0x8E7); + EnMnk_Monkey_SetAnim(this, 5); + break; + + case 0x8E7: + Message_CloseTextbox(play); + this->actionFunc = EnMnk_Monkey_WaitToTalkAfterSaved; + EnMnk_Monkey_SetAnim(this, 0); + break; + + default: + break; + } + } +} + +void EnMnk_Monkey_WaitToTalkAfterSaved(EnMnk* this, PlayState* play) { + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; + this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; + SkelAnime_Update(&this->skelAnime); + + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { + this->actionFunc = EnMnk_Monkey_TalkAfterSaved; + EnMnk_Monkey_SetAnim(this, 7); + } else if ((this->picto.actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->picto.actor, 0x3000, play)) { + Actor_OfferTalk(&this->picto.actor, play, 110.0f); + } +} + +void func_80AB9084(EnMnk* this, PlayState* play) { + s16 cueId = 0; + + if (SkelAnime_Update(&this->skelAnime)) { + switch (this->cueId) { + case 2: + EnMnk_Monkey_SetAnim(this, 0xD); + break; + + case 3: + EnMnk_Monkey_SetAnim(this, 0); + break; + + case 4: + EnMnk_Monkey_SetAnim(this, 0); + break; + + default: + break; + } + SkelAnime_Update(&this->skelAnime); + SET_WEEKEVENTREG(WEEKEVENTREG_29_80); + } + + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_106)) { + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_106)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_106)]->id; + } + + if ((cueId == 0) && (this->animIndex != 0)) { + EnMnk_Monkey_SetAnim(this, 0); + } else if (this->cueId != cueId) { + switch (cueId) { + case 1: + EnMnk_Monkey_ChangeAnim(this, 0, ANIMMODE_LOOP, 0.0f); + break; + + case 2: + EnMnk_Monkey_ChangeAnim(this, 12, ANIMMODE_ONCE, 0.0f); + this->unk_3E0 = 6; + break; + + case 3: + EnMnk_Monkey_ChangeAnim(this, 11, ANIMMODE_ONCE, 0.0f); + break; + + case 4: + EnMnk_Monkey_ChangeAnim(this, 14, ANIMMODE_ONCE, -5.0f); + break; + + default: + break; + } + this->cueId = cueId; + } + + if (this->animIndex == 11) { + if ((this->skelAnime.curFrame >= 8.0f) && (this->skelAnime.curFrame < 14.0f)) { + this->unk_3E0 = 2; + } else { + this->unk_3E0 = 0; + } + if (Animation_OnFrame(&this->skelAnime, 8.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_MONKEY_VO_REWARD); + } + } +} + +void func_80AB92CC(EnMnk* this, PlayState* play) { + s16 cueId = 0; + + if (SkelAnime_Update(&this->skelAnime)) { + switch (this->cueId) { + case 2: + EnMnk_Monkey_SetAnim(this, 0xD); + break; + + case 3: + EnMnk_Monkey_SetAnim(this, 0); + break; + + case 4: + EnMnk_Monkey_SetAnim(this, 0); + break; + + default: + break; + } + SkelAnime_Update(&this->skelAnime); + } + + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_106)) { + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_106)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_106)]->id; + } + + if ((cueId == 0) && (this->animIndex != 0)) { + EnMnk_Monkey_SetAnim(this, 0); + } else if (this->cueId != cueId) { + switch (cueId) { + case 1: + EnMnk_Monkey_ChangeAnim(this, 0, ANIMMODE_LOOP, 0.0f); + break; + + case 2: + EnMnk_Monkey_ChangeAnim(this, 12, ANIMMODE_ONCE, 0.0f); + this->unk_3E0 = 6; + break; + + case 3: + EnMnk_Monkey_ChangeAnim(this, 11, ANIMMODE_ONCE, 0.0f); + break; + + case 4: + EnMnk_Monkey_ChangeAnim(this, 14, ANIMMODE_ONCE, -5.0f); + break; + + default: + break; + } + this->cueId = cueId; + } + if (this->animIndex == 11) { + if ((this->skelAnime.curFrame >= 8.0f) && (this->skelAnime.curFrame < 14.0f)) { + this->unk_3E0 = 2; + } else { + this->unk_3E0 = 0; + } + } +} + +void EnMnk_DoNothing(EnMnk* this, PlayState* play) { +} + +void EnMnk_Update(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + if (!(this->flags & MONKEY_FLAGS_1)) { + Actor_MoveWithGravity(&this->picto.actor); + } + if (!(this->flags & MONKEY_FLAGS_2)) { + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 20.0f, 25.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->flags |= MONKEY_FLAGS_40; + } + } + + this->actionFunc(this, play); + + if (!(this->flags & MONKEY_FLAGS_20)) { + if (!(this->flags & MONKEY_FLAGS_8)) { + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + if (this->flags & MONKEY_FLAGS_200) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); + } + + this->blinkFrame = this->blinkTimer; + if (this->blinkFrame >= 3) { + this->blinkFrame = 0; + } + + if (this->flags & MONKEY_FLAGS_80) { + s8 csId = this->picto.actor.csId; + + if (csId == CS_ID_NONE) { + this->flags &= ~MONKEY_FLAGS_80; + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(this->picto.actor.csId, &this->picto.actor); + this->picto.actor.csId = CutsceneManager_GetAdditionalCsId(this->picto.actor.csId); + } else { + CutsceneManager_Queue(this->picto.actor.csId); + } + } +} + +s32 EnMnk_Monkey_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnMnk* this = THIS; + + if (limbIndex == OBJECT_MNK_2_LIMB_03) { + rot->x += this->unk_3CC; + rot->z += this->unk_3CE; + } + return false; +} + +s32 EnMnk_MonkeyTiedUp_PropOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + if (limbIndex == OBJECT_MNK_1_LIMB_01) { + *dList = NULL; + } + return false; +} + +s32 EnMnk_MonkeyHanging_PropOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + if ((limbIndex == OBJECT_MNK_3_LIMB_01) || (limbIndex == OBJECT_MNK_3_LIMB_02) || + (limbIndex == OBJECT_MNK_3_LIMB_03)) { + *dList = NULL; + } + return false; +} + +void EnMnk_Monkey_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnMnk* this = THIS; + + if (limbIndex == OBJECT_MNK_2_LIMB_04) { + Matrix_MultVec3f(&sMonkeyFocusPosOffset, &this->picto.actor.focus.pos); + } +} + +void EnMnk_MonkeyTiedUp_PropPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnMnk* this = THIS; + + if (limbIndex == OBJECT_MNK_1_LIMB_04) { + Matrix_Get(&this->unk_36C); + } +} + +void EnMnk_MonkeyHanging_PropPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnMnk* this = THIS; + + switch (limbIndex) { + case OBJECT_MNK_3_LIMB_01: + if (*dList != NULL) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_RotateZS(this->cueId, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, *dList); + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } + break; + + case OBJECT_MNK_3_LIMB_02: + if (*dList != NULL) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Scale(this->approachPlayerRadius + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, *dList); + + CLOSE_DISPS(play->state.gfxCtx); + } + break; + + case OBJECT_MNK_3_LIMB_03: + if (*dList != NULL) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Scale(1.0f, 1.0f / (this->approachPlayerRadius + 1.0f), 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, *dList); + + CLOSE_DISPS(play->state.gfxCtx); + } + Matrix_Get(&this->unk_36C); + break; + + default: + break; + } +} + +void EnMnk_Monkey_DrawFace(EnMnk* this, PlayState* play) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL37_Opa(play->state.gfxCtx); + + switch (this->unk_3E0) { + case 4: + case 5: + case 6: + if (this->blinkFrame != 2) { + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sMonkeyFaceTextures[this->unk_3E0])); + } else { + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sMonkeyFaceTextures[this->blinkFrame])); + } + return; + + case 2: + case 3: + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sMonkeyFaceTextures[this->unk_3E0])); + return; + + default: + break; + } + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sMonkeyFaceTextures[this->blinkFrame])); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnMnk_Draw(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + EnMnk_Monkey_DrawFace(this, play); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnMnk_Monkey_OverrideLimbDraw, EnMnk_Monkey_PostLimbDraw, &this->picto.actor); +} + +void EnMnk_MonkeyTiedUp_Draw(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + SkelAnime_DrawFlexOpa(play, this->propSkelAnime.skeleton, this->propSkelAnime.jointTable, + this->propSkelAnime.dListCount, EnMnk_MonkeyTiedUp_PropOverrideLimbDraw, + EnMnk_MonkeyTiedUp_PropPostLimbDraw, &this->picto.actor); + EnMnk_Monkey_DrawFace(this, play); + Matrix_Mult(&this->unk_36C, MTXMODE_NEW); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnMnk_Monkey_OverrideLimbDraw, EnMnk_Monkey_PostLimbDraw, &this->picto.actor); +} + +void EnMnk_MonkeyHanging_Draw(Actor* thisx, PlayState* play) { + EnMnk* this = THIS; + + SkelAnime_DrawFlexOpa(play, this->propSkelAnime.skeleton, this->propSkelAnime.jointTable, + this->propSkelAnime.dListCount, EnMnk_MonkeyHanging_PropOverrideLimbDraw, + EnMnk_MonkeyHanging_PropPostLimbDraw, &this->picto.actor); + EnMnk_Monkey_DrawFace(this, play); + Matrix_Mult(&this->unk_36C, MTXMODE_NEW); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnMnk_Monkey_OverrideLimbDraw, EnMnk_Monkey_PostLimbDraw, &this->picto.actor); +} 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 e2f739ada..a9493208f 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h @@ -2,15 +2,82 @@ #define Z_EN_MNK_H #include "global.h" +#include "objects/object_mnk/object_mnk.h" #include "z64snap.h" struct EnMnk; typedef void (*EnMnkActionFunc)(struct EnMnk*, PlayState*); +typedef void (*EnMnkFunc)(PlayState*, struct EnMnk*); + +#define MONKEY_GET_TYPE(thisx) (((thisx)->params & 0x780) >> 7) +#define MONKEY_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) +#define MONKEY_GET_PATH_INDEX(thisx) (((thisx)->params & 0xF800) >> 11) + +#define MONKEY_PATH_INDEX_NONE 0x1F + +typedef enum { + /* 0 */ MONKEY_0, + /* 1 */ MONKEY_OUTSIDEWOODS, + /* 2 */ MONKEY_BY_WITCH, + /* 3 */ MONKEY_OUTSIDECHAMBER, + /* 4 */ MONKEY_OUTSIDEPALACE, + /* 5 */ MONKEY_TIED_UP, + /* 6 */ MONKEY_HANGING, + /* 7 */ MONKEY_WOODS_GUIDE, + /* 8 */ MONKEY_8, + /* 9 */ MONKEY_AFTER_SAVED, + /* 10 */ MONKEY_10 +} MonkeyType; + +#define MONKEY_FLAGS_1 (1 << 0) +#define MONKEY_FLAGS_2 (1 << 1) +#define MONKEY_FLAGS_4 (1 << 2) +#define MONKEY_FLAGS_8 (1 << 3) +#define MONKEY_FLAGS_10 (1 << 4) +#define MONKEY_FLAGS_20 (1 << 5) +#define MONKEY_FLAGS_40 (1 << 6) +#define MONKEY_FLAGS_80 (1 << 7) +#define MONKEY_FLAGS_100 (1 << 8) +#define MONKEY_FLAGS_200 (1 << 9) +#define MONKEY_FLAGS_400 (1 << 10) +#define MONKEY_FLAGS_800 (1 << 11) +#define MONKEY_FLAGS_1000 (1 << 12) +#define MONKEY_FLAGS_2000 (1 << 13) +#define MONKEY_FLAGS_4000 (1 << 14) +#define MONKEY_FLAGS_8000 (1 << 15) + +#define MONKEY_PROP_LIMB_MAX MAX((s32)OBJECT_MNK_1_LIMB_MAX, (s32)OBJECT_MNK_3_LIMB_MAX) typedef struct EnMnk { /* 0x000 */ PictoActor picto; - /* 0x148 */ char unk_148[0x2A0]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ Vec3s jointTable[OBJECT_MNK_2_LIMB_MAX]; + /* 0x216 */ Vec3s morphTable[OBJECT_MNK_2_LIMB_MAX]; + /* 0x2A0 */ SkelAnime propSkelAnime; + /* 0x2E4 */ Vec3s propJointTable[MONKEY_PROP_LIMB_MAX]; + /* 0x302 */ Vec3s propMorphTable[MONKEY_PROP_LIMB_MAX]; + /* 0x320 */ ColliderCylinder collider; + /* 0x36C */ MtxF unk_36C; + /* 0x3AC */ Path* path; + /* 0x3B0 */ s16 csIdList[6]; + /* 0x3BC */ s16 csId; + /* 0x3BE */ s16 animIndex; + /* 0x3C0 */ s32 destPointIndex; + /* 0x3C4 */ s32 pathIndex; + /* 0x3C8 */ s32 unk_3C8; + /* 0x3CC */ s16 unk_3CC; // beard x rot? + /* 0x3CE */ s16 unk_3CE; // beard y rot? + /* 0x3D0 */ union { + s16 cueId; // Tied monkey + s16 unk_3D0; // Hanging monkey + }; + /* 0x3D4 */ u32 unk_3D4; + /* 0x3D8 */ f32 approachPlayerRadius; + /* 0x3DC */ s16 blinkFrame; + /* 0x3DE */ s16 blinkTimer; + /* 0x3E0 */ s32 unk_3E0; + /* 0x3E4 */ u16 flags; /* 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 732fc9b3b..d17a8b98c 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -7,7 +7,7 @@ #include "z_en_ms.h" #include "objects/object_ms/object_ms.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnMs*)thisx) @@ -53,7 +53,7 @@ static ColliderCylinderInitType1 sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; @@ -61,7 +61,7 @@ void EnMs_Init(Actor* thisx, PlayState* play) { EnMs* this = THIS; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ms_Skel_003DC0, &object_ms_Anim_0005EC, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, this->morphTable, 9); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); @@ -92,7 +92,7 @@ void EnMs_Wait(EnMs* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMs_Talk; } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS_ALT(yawDiff) < 0x2000)) { - func_800B8614(&this->actor, play, 90.0f); + Actor_OfferTalk(&this->actor, play, 90.0f); } } @@ -119,13 +119,13 @@ void EnMs_Talk(EnMs* this, PlayState* play) { case 0: // yes Message_CloseTextbox(play); if (gSaveContext.save.saveInfo.playerData.rupees < 10) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_ContinueTextbox(play, 0x935); // "[...] You don't have enough Rupees." } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); Message_ContinueTextbox(play, 0x937); // "[...] You can't carry anymore." } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); Rupees_ChangeBy(-10); this->actionFunc = EnMs_Sell; @@ -134,7 +134,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { case 1: // no default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x934); // "[...] Well, if your mood changes [...]" break; } @@ -149,7 +149,8 @@ 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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); this->actionFunc = EnMs_TalkAfterPurchase; } else { Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); @@ -161,7 +162,8 @@ void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { Message_ContinueTextbox(play, 0x936); // "You can plant 'em whenever you want [...]" this->actionFunc = EnMs_Talk; } else { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index db05f0d61..016f779e9 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 @@ -318,7 +318,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); - play->envCtx.unk_E4 = 0xFE; + play->envCtx.timeSeqState = TIMESEQ_REQUEST; player->stateFlags1 &= ~PLAYER_STATE1_20; } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { this->timer = 0; @@ -361,14 +361,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { if (EnMttag_IsInFinishLine(playerPos)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_11); this->actionFunc = EnMttag_RaceFinish; } else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_12); @@ -456,7 +456,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { // Exit the race - func_8019F230(); + Audio_PlaySfx_MessageCancel(); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; EnMttag_ExitRace(play, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK); CLEAR_EVENTINF(EVENTINF_13); @@ -466,7 +466,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { } // Keep racing - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_CloseTextbox(play); func_800B7298(play, &this->actor, PLAYER_CSMODE_END); CLEAR_EVENTINF(EVENTINF_13); diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 98b01d728..5ee8a68e0 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -103,7 +103,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 20, ICHAIN_STOP), }; -static f32 D_80A6BA14[] = { 0.06f, 0.1f, 0.13f }; +f32 D_80A6BA14[] = { + 0.06f, // ENMUSHI2_0 + 0.1f, // ENMUSHI2_1 + 0.13f, // ENMUSHI2_2 +}; void func_80A687A0(EnMushi2* this) { MtxF* matrix = Matrix_GetCurrent(); @@ -743,10 +747,10 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) { s32 sp3C; Actor_ProcessInitChain(&this->actor, sInitChain); - if (!ENMUSHI2_GET_3(&this->actor)) { + if (ENMUSHI2_GET_3(&this->actor) == ENMUSHI2_0) { func_80A68A78(this, play); } - this->actor.shape.rot.y += Rand_S16Offset(-2000, 4000); + this->actor.shape.rot.y += Rand_S16Offset(-0x7D0, 0xFA0); this->actor.home.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; func_80A68F24(this); @@ -759,7 +763,8 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = 30; sp3C = func_80A69EE4(this, play); - if ((sp3C == 0) && func_80A68860(this, play) && func_80A68910(this, play) && !ENMUSHI2_GET_3(&this->actor)) { + if ((sp3C == 0) && func_80A68860(this, play) && func_80A68910(this, play) && + (ENMUSHI2_GET_3(&this->actor) == ENMUSHI2_0)) { func_80A6A024(this); } diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h index 1a776a52a..e0c381133 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h @@ -9,6 +9,14 @@ typedef void (*EnMushi2ActionFunc)(struct EnMushi2*, PlayState*); #define ENMUSHI2_GET_3(thisx) ((thisx)->params & 3) +#define ENMUSHI2_PARAMS(param) ((param) & 3) + +typedef enum { + /* 0 */ ENMUSHI2_0, + /* 1 */ ENMUSHI2_1, + /* 2 */ ENMUSHI2_2 +} EnMush2Param; + typedef struct { /* 0x0 */ s16 unk_00; /* 0x2 */ s16 unk_02; 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 6eceb89d6..5ed82cbc2 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -7,7 +7,7 @@ #include "z_en_muto.h" #include "objects/object_toryo/object_toryo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnMuto*)thisx) @@ -87,7 +87,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) { } } - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); EnMuto_SetupIdle(this); @@ -177,7 +177,7 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) { } } - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } void EnMuto_SetupDialogue(EnMuto* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 79c2e5cba..7ac6a3b58 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -7,7 +7,7 @@ #include "z_en_nb.h" #include "objects/object_nb/object_nb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnNb*)thisx) @@ -26,9 +26,6 @@ s32 func_80BC00AC(Actor* thisx, PlayState* play); s32 func_80BC01DC(Actor* thisx, PlayState* play); #define EN_NB_FLAG_NONE (0) -#define EN_NB_FLAG_1 (1 << 0) -#define EN_NB_FLAG_2 (1 << 1) -#define EN_NB_FLAG_4 (1 << 2) #define EN_NB_FLAG_8 (1 << 3) #define EN_NB_FLAG_10 (1 << 4) #define EN_NB_FLAG_20 (1 << 5) @@ -369,7 +366,7 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) { gSaveContext.save.time = CLOCK_TIME(8, 0); Sram_IncrementDay(); } else { - func_800FE658(120.0f); + Environment_SetTimeJump(120.0f); } this->behaviour++; @@ -403,18 +400,17 @@ u8* func_80BC045C(EnNb* this, PlayState* play) { s32 func_80BC04FC(EnNb* this, PlayState* play) { s32 ret = false; - if (this->stateFlags & (EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4)) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->stateFlags |= EN_NB_FLAG_20; - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_NONE, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); - this->behaviour = ENNB_BEHAVIOUR_0; - this->msgEventCallback = NULL; - this->actor.child = this->unk_1E8; - this->msgEventScript = func_80BC045C(this, play); - this->stateFlags |= EN_NB_FLAG_20; - this->actionFunc = func_80BC0EAC; - ret = true; - } + if (((this->stateFlags & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->stateFlags |= EN_NB_FLAG_20; + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->behaviour = ENNB_BEHAVIOUR_0; + this->msgEventCallback = NULL; + this->actor.child = this->unk_1E8; + this->msgEventScript = func_80BC045C(this, play); + this->stateFlags |= EN_NB_FLAG_20; + this->actionFunc = func_80BC0EAC; + ret = true; } return ret; } @@ -459,7 +455,7 @@ void func_80BC06C4(EnNb* this) { if (this->unk_1E8->id == ACTOR_PLAYER) { player = (Player*)this->unk_1E8; - sp40.y = player->bodyPartsPos[7].y + 3.0f; + sp40.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_1E8->focus.pos); } @@ -576,7 +572,7 @@ s32 func_80BC0B98(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 success = false; if (EnNb_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AN) != NULL) { - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_1 | EN_NB_FLAG_2, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->stateFlags |= EN_NB_FLAG_20; EnNb_ChangeAnim(this, EN_NB_ANIM_0); success = true; @@ -587,9 +583,9 @@ s32 func_80BC0B98(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80BC0C0C(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) { if (!CHECK_EVENTINF(EVENTINF_43)) { - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_1 | EN_NB_FLAG_2, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_4, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); } EnNb_ChangeAnim(this, EN_NB_ANIM_0); @@ -599,8 +595,8 @@ s32 func_80BC0C0C(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 EnNb_ProcessScheduleOutput(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 success; - this->actor.flags |= ACTOR_FLAG_1; - this->actor.targetMode = 0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_0; this->stateFlags = EN_NB_FLAG_NONE; this->unk_274 = 40.0f; @@ -644,16 +640,16 @@ void EnNb_FollowSchedule(EnNb* this, PlayState* play) { scheduleOutput.result = EN_NB_SCH_1; EnNb_ProcessScheduleOutput(this, play, &scheduleOutput); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } else if (!Schedule_RunScript(play, sScheduleScript, &scheduleOutput) || ((this->scheduleResult != scheduleOutput.result) && !EnNb_ProcessScheduleOutput(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = EN_NB_SCH_NONE; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->scheduleResult = scheduleOutput.result; @@ -668,7 +664,7 @@ void func_80BC0EAC(EnNb* this, PlayState* play) { CLEAR_EVENTINF(EVENTINF_43); } - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_1 | EN_NB_FLAG_2, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); if (this->scheduleResult != EN_NB_SCH_2) { this->stateFlags &= ~EN_NB_FLAG_20; } @@ -696,7 +692,7 @@ void EnNb_Init(Actor* thisx, PlayState* play) { this->stateFlags = EN_NB_FLAG_NONE; if (CHECK_EVENTINF(EVENTINF_43)) { - SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_4, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); } else { CLEAR_EVENTINF(EVENTINF_42); CLEAR_EVENTINF(EVENTINF_43); @@ -724,8 +720,8 @@ void EnNb_Update(Actor* thisx, PlayState* play) { EnNb_UpdateSkelAnime(this); func_80BC0800(this); if (Actor_IsFacingPlayer(&this->actor, 0x38E0)) { - func_8013C964(&this->actor, play, this->unk_274, 30.0f, ITEM_OCARINA, - this->stateFlags & (EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4)); + SubS_Offer(&this->actor, play, this->unk_274, 30.0f, PLAYER_IA_NONE, + this->stateFlags & SUBS_OFFER_MODE_MASK); } func_80BBFF24(this, play); } diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 755385d00..a6301a495 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -7,7 +7,7 @@ #include "z_en_neo_reeba.h" #include "objects/object_rb/object_rb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200) #define THIS ((EnNeoReeba*)thisx) @@ -133,7 +133,7 @@ void EnNeoReeba_Init(Actor* thisx, PlayState* play) { } this->actor.colChkInfo.damageTable = &sDamageTable; - this->actor.targetMode = 2; + this->actor.targetMode = TARGET_MODE_2; this->actor.hintId = TATL_HINT_ID_LEEVER; this->actor.gravity = -0.5f; @@ -160,7 +160,7 @@ void EnNeoReeba_Destroy(Actor* thisx, PlayState* play) { } void EnNeoReeba_SetupWaitUnderground(EnNeoReeba* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.draw = NULL; this->actionTimer = 10; this->actionFunc = EnNeoReeba_WaitUnderground; @@ -248,7 +248,7 @@ void EnNeoReeba_SetupRise(EnNeoReeba* this) { this->sinkRiseRate = 300.0f; this->skelAnime.playSpeed = 2.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnNeoReeba_RiseOutOfGround; } @@ -446,7 +446,7 @@ void EnNeoReeba_SetupDeathEffects(EnNeoReeba* this) { this->rotationSpeed = 3640.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DEAD); this->actionFunc = EnNeoReeba_PlayDeathEffects; @@ -610,29 +610,29 @@ void EnNeoReeba_UpdatePosition(EnNeoReeba* this, PlayState* play) { void EnNeoReeba_DrawFrozenEffects(EnNeoReeba* this, PlayState* play) { s32 i; - f32 limbPosScale = 10.0f; + f32 bodyPartPosScaleXZ = 10.0f; f32 phi_f2 = 20.0f; f32 drawEffectScale = 0.8f; if (EN_NEO_REEBA_IS_LARGE(&this->actor)) { - limbPosScale *= 1.5f; + bodyPartPosScaleXZ *= 1.5f; phi_f2 *= 1.5f; drawEffectScale *= 1.5f; } - for (i = 0; i < ARRAY_COUNT(this->limbPos) - 1; i++) { - this->limbPos[i] = this->actor.world.pos; + for (i = 0; i <= EN_NEO_REEBA_BODYPART_2; i++) { + this->bodyPartsPos[i] = this->actor.world.pos; - this->limbPos[i].x += limbPosScale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].z += limbPosScale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].y += 5.0f; + this->bodyPartsPos[i].x += bodyPartPosScaleXZ * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].z += bodyPartPosScaleXZ * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].y += 5.0f; } - this->limbPos[ARRAY_COUNT(this->limbPos) - 1] = this->actor.world.pos; - this->limbPos[ARRAY_COUNT(this->limbPos) - 1].y += phi_f2; + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3] = this->actor.world.pos; + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3].y += phi_f2; this->drawEffectScale = drawEffectScale; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), drawEffectScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_NEO_REEBA_BODYPART_MAX, drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } @@ -646,15 +646,15 @@ void EnNeoReeba_DrawEffects(EnNeoReeba* this, PlayState* play) { if ((this->drawEffectType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawEffectType == ACTOR_DRAW_DMGEFF_LIGHT_ORBS) || (this->drawEffectType == ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL)) { - for (i = 0; i < ARRAY_COUNT(this->limbPos) - 1; i++) { - this->limbPos[i] = this->actor.world.pos; - this->limbPos[i].x += scale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].z += scale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); - this->limbPos[i].y += -20.0f; + for (i = 0; i <= EN_NEO_REEBA_BODYPART_2; i++) { + this->bodyPartsPos[i] = this->actor.world.pos; + this->bodyPartsPos[i].x += scale * Math_SinS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].z += scale * Math_CosS(BINANG_ADD(this->actor.shape.rot.y, i * 0x5555)); + this->bodyPartsPos[i].y += -20.0f; } - this->limbPos[ARRAY_COUNT(this->limbPos) - 1] = this->actor.world.pos; - Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawEffectScale, 0.5f, + this->bodyPartsPos[EN_NEO_REEBA_BODYPART_3] = this->actor.world.pos; + Actor_DrawDamageEffects(play, NULL, this->bodyPartsPos, EN_NEO_REEBA_BODYPART_MAX, this->drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } } @@ -672,8 +672,8 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < EN_NEO_REEBA_BODYPART_MAX; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); xVel = Math_SinS(yaw) * 3.0f; zVel = Math_CosS(yaw) * 3.0f; @@ -681,7 +681,8 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play) { iceVel.x = (Rand_Centered() * 3.0f) + xVel; iceVel.z = (Rand_Centered() * 3.0f) + zVel; iceVel.y = (Rand_ZeroOne() * 6.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, + 30); } } } diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h index 2cd24c88e..1be3d2c4a 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h @@ -10,6 +10,14 @@ struct EnNeoReeba; typedef void (*EnNeoReebaActionFunc)(struct EnNeoReeba*, PlayState*); +typedef enum EnNeoReebaBodyPart { + /* 0 */ EN_NEO_REEBA_BODYPART_0, + /* 1 */ EN_NEO_REEBA_BODYPART_1, + /* 2 */ EN_NEO_REEBA_BODYPART_2, + /* 3 */ EN_NEO_REEBA_BODYPART_3, + /* 4 */ EN_NEO_REEBA_BODYPART_MAX +} EnNeoReebaBodyPart; + typedef struct EnNeoReeba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -19,7 +27,7 @@ typedef struct EnNeoReeba { /* 0x2AC */ EnNeoReebaActionFunc actionFunc; /* 0x2B0 */ Vec3f targetPos; /* 0x2BC */ Vec3f velToTarget; - /* 0x2C8 */ Vec3f limbPos[4]; + /* 0x2C8 */ Vec3f bodyPartsPos[EN_NEO_REEBA_BODYPART_MAX]; /* 0x2F8 */ f32 sinkRiseRate; /* 0x2FC */ f32 rotationSpeed; /* 0x300 */ f32 drawEffectAlpha; 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 0e96590d5..fa8771862 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -88,7 +88,7 @@ static ColliderCylinderInit sCylinderInit = { void EnNiw_Init(Actor* thisx, PlayState* play) { static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; @@ -104,11 +104,11 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { this->niwType = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.flags |= ACTOR_FLAG_1; // targetable ON + this->actor.flags |= ACTOR_FLAG_TARGETABLE; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelanime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gNiwSkel, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Math_Vec3f_Copy(&this->unk2A4, &this->actor.world.pos); Math_Vec3f_Copy(&this->unk2B0, &this->actor.world.pos); @@ -133,7 +133,7 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->heldTimer = 30; - this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->niwState = NIW_STATE_HELD; this->actionFunc = EnNiw_Held; this->actor.speed = 0.0f; @@ -331,7 +331,7 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { } void EnNiw_SetupIdle(EnNiw* this) { - Animation_Change(&this->skelanime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, + Animation_Change(&this->skelAnime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, -10.0f); this->niwState = NIW_STATE_IDLE; this->actionFunc = EnNiw_Idle; @@ -349,7 +349,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->sfxTimer1 = 30; this->heldTimer = 30; - this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->niwState = NIW_STATE_HELD; this->actor.speed = 0.0f; this->actionFunc = EnNiw_Held; @@ -446,7 +446,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.z = 0; rotZ = this->actor.shape.rot.z; this->niwState = NIW_STATE_FALLING; - this->actor.flags |= ACTOR_FLAG_1; // targetable ON + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnNiw_Thrown; this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; @@ -464,7 +464,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.x = rotZ; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Math_Vec3f_Copy(&this->unk2BC, &D_808934DC); - this->actor.flags |= ACTOR_FLAG_1; // targetable ON + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnNiw_Thrown; } @@ -502,7 +502,7 @@ void EnNiw_Thrown(EnNiw* this, PlayState* play) { this->sfxTimer1 = 30; this->unk2EC = 0; this->heldTimer = 30; - this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->niwState = NIW_STATE_HELD; this->actionFunc = EnNiw_Held; this->actor.speed = 0.0f; @@ -614,7 +614,7 @@ void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play) { if (this->cuccoStormTimer == 0) { this->cuccoStormTimer = 10; this->yawTowardsPlayer = this->actor.yawTowardsPlayer; - this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->niwState = NIW_STATE_ANGRY3; this->actionFunc = EnNiw_CuccoStorm; } @@ -636,7 +636,7 @@ void EnNiw_CuccoStorm(EnNiw* this, PlayState* play) { } void EnNiw_SetupRunAway(EnNiw* this) { - Animation_Change(&this->skelanime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, + Animation_Change(&this->skelAnime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, -10.0f); this->isRunningRight = Rand_ZeroFloat(1.99f); this->niwState = NIW_STATE_RUNNING; @@ -943,7 +943,7 @@ void EnNiw_Draw(Actor* thisx, PlayState* play) { EnNiw* this = THIS; Gfx_SetupDL25_Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiw_OverrideLimbDraw, NULL, &this->actor); EnNiw_DrawFeathers(this, play); } 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 06f487800..769a67c17 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -24,7 +24,7 @@ typedef struct { typedef struct EnNiw { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelanime; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[NIW_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[NIW_LIMB_MAX]; /* 0x248 */ EnNiwActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c index 3b2659d1e..f5e35f478 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c @@ -7,7 +7,7 @@ #include "z_en_nnh.h" #include "objects/object_nnh/object_nnh.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnNnh*)thisx) @@ -59,7 +59,7 @@ void EnNnh_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; EnNnh_SetupWaitForDialogue(this); @@ -80,7 +80,7 @@ void EnNnh_WaitForDialogue(EnNnh* this, PlayState* play) { Message_StartTextbox(play, 0x228, &this->actor); EnNnh_SetupDialogue(this); } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -104,10 +104,11 @@ void EnNnh_Update(Actor* thisx, PlayState* play) { } void EnNnh_Draw(Actor* thisx, PlayState* play) { - GraphicsContext* gfxCtx = play->state.gfxCtx; - s32 pad; + OPEN_DISPS(play->state.gfxCtx); - Gfx_SetupDL25_Opa(gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, gButlerSonMainBodyDL); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gButlerSonMainBodyDL); + + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index bf3216fd5..f8673c307 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -80,7 +80,7 @@ void EnNutsball_Destroy(Actor* thisx, PlayState* play) { } void EnNutsball_InitColliderParams(EnNutsball* this) { - this->collider.base.atFlags &= ~AT_TYPE_ENEMY & ~AT_BOUNCED & ~AT_HIT; + this->collider.base.atFlags &= ~(AT_HIT | AT_TYPE_ENEMY | AT_BOUNCED); this->collider.base.atFlags |= AT_TYPE_PLAYER; this->collider.info.toucher.dmgFlags = 0x400000; this->collider.info.toucher.damage = 2; 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 2f8914edc..83a8be394 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -58,11 +58,11 @@ Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; void EnNwc_Init(Actor* thisx, PlayState* play) { - s32 niwObjectIndex; + s32 niwObjectSlot; EnNwc* this = THIS; - niwObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_NIW); - if (niwObjectIndex < 0) { + niwObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_NIW); + if (niwObjectSlot <= OBJECT_SLOT_NONE) { // niw object does not exist, we need it for tranformation, despawn Actor_Kill(&this->actor); return; @@ -75,8 +75,8 @@ void EnNwc_Init(Actor* thisx, PlayState* play) { return; } - this->niwObjectIndex = niwObjectIndex; - this->nwcObjectIndex = this->actor.objBankIndex; + this->niwObjectSlot = niwObjectSlot; + this->nwcObjectIndex = this->actor.objectSlot; this->grog = EnNwc_FindGrog(play); this->footRotY = this->footRotZ = 0; @@ -242,20 +242,20 @@ void EnNwc_CheckFound(EnNwc* this, PlayState* play) { } EnNwc_ChangeState(this, NWC_STATE_FOLLOWING); - func_801A0868(&gSfxDefaultPos, NA_SE_SY_CHICK_JOIN_CHIME, currentChickCount); + Audio_PlaySfx_AtPosWithAllChannelsIO(&gSfxDefaultPos, NA_SE_SY_CHICK_JOIN_CHIME, currentChickCount); } } void EnNwc_LoadNiwSkeleton(EnNwc* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->niwObjectIndex)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->niwObjectIndex].segment); + if (Object_IsLoaded(&play->objectCtx, this->niwObjectSlot)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->niwObjectSlot].segment); - SkelAnime_InitFlex(play, &this->niwSkeleton, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->niwSkeleton, &gNiwSkel, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Animation_Change(&this->niwSkeleton, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->nwcObjectIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->nwcObjectIndex].segment); this->state = NWC_STATE_NIW_LOADED; EnNwc_ToggleState(this); } @@ -305,8 +305,8 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { } } - if (this->grog->actor.home.rot.z >= 20 && // all 10 chicks have been found - (this->hasGrownUp & 1) == false) { + if ((this->grog->actor.home.rot.z >= 20) && // all 10 chicks have been found + !(this->hasGrownUp & 1)) { this->transformTimer += 2; if (this->transformTimer >= (s32)(s16)((this->actor.home.rot.z * 0x1E) + 0x1E)) { // it is our turn to transform @@ -468,11 +468,11 @@ void EnNwc_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); if (this->hasGrownUp & 1) { - this->actor.objBankIndex = this->niwObjectIndex; + this->actor.objectSlot = this->niwObjectSlot; this->actor.draw = EnNwc_DrawAdultBody; this->actor.shape.shadowScale = 15.0f; } else { - this->actor.objBankIndex = this->nwcObjectIndex; + this->actor.objectSlot = this->nwcObjectIndex; this->actor.draw = EnNwc_Draw; this->actor.shape.shadowScale = 6.0f; } diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index 51c017dff..9ce3ab60e 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -15,7 +15,7 @@ typedef struct EnNwc { /* 0x144 */ SkelAnime niwSkeleton; // this skeleton is for when the chicks grow up into adults during the breman march /* 0x188 */ Vec3s jointTable[NIW_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[NIW_LIMB_MAX]; - /* 0x248 */ s8 niwObjectIndex; + /* 0x248 */ s8 niwObjectSlot; /* 0x249 */ s8 nwcObjectIndex; /* 0x24A */ s16 blinkState; /* 0x24C */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index df778f1a7..780e3b300 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -41,7 +41,7 @@ void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play) { void EnOkarinaEffect_Init(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = THIS; - if (play->envCtx.unk_F2[1]) { + if (play->envCtx.precipitation[PRECIP_RAIN_CUR] != 0) { Actor_Kill(&this->actor); } EnOkarinaEffect_SetupAction(this, func_8096B104); @@ -49,10 +49,10 @@ void EnOkarinaEffect_Init(Actor* thisx, PlayState* play) { void func_8096B104(EnOkarinaEffect* this, PlayState* play) { this->unk144 = 0x50; - play->envCtx.unk_F2[4] = 0x3C; - D_801F4E70 = 501.0f; - play->envCtx.unk_E3 = 2; - func_800FD78C(play); + play->envCtx.precipitation[PRECIP_SOS_MAX] = 60; + gLightningStrike.delayTimer = 501.0f; + play->envCtx.lightningState = LIGHTNING_LAST; + Environment_PlayStormNatureAmbience(play); EnOkarinaEffect_SetupAction(this, func_8096B174); } @@ -65,11 +65,11 @@ void func_8096B174(EnOkarinaEffect* this, PlayState* play) { } void func_8096B1FC(EnOkarinaEffect* this, PlayState* play) { - if (play->envCtx.unk_F2[4]) { + if (play->envCtx.precipitation[PRECIP_SOS_MAX] != 0) { if ((play->state.frames & 3) == 0) { - play->envCtx.unk_F2[4]--; - if (play->envCtx.unk_F2[4] == 8) { - func_800FD858(play); + play->envCtx.precipitation[PRECIP_SOS_MAX]--; + if (play->envCtx.precipitation[PRECIP_SOS_MAX] == 8) { + Environment_StopStormNatureAmbience(play); } } } else { diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 01cbb5dda..9119e0609 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -37,10 +37,10 @@ void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { f32 zRot = 0.0f; s32 i = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk148 = ENOKARINATAG_GET_F800(thisx); this->unk14A = ENOKARINATAG_GET_780(thisx); - this->switchFlags = ENOKARINATAG_GET_SWITCHFLAGS(thisx); + this->switchFlag = ENOKARINATAG_GET_SWITCH_FLAG(thisx); if (this->actor.world.rot.z > 0) { zRot = this->actor.world.rot.z; while (zRot > 10.0f) { @@ -50,13 +50,13 @@ void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { } this->unk154 = zRot * 50.0f; this->unk158 = i * 50.0f; - if (this->switchFlags == 0x7F) { - this->switchFlags = -1; + if (this->switchFlag == 0x7F) { + this->switchFlag = -1; } if (this->unk14A == 0xF) { this->unk14A = -1; } - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actionFunc = func_8093E518; } @@ -66,14 +66,14 @@ void func_8093E518(EnOkarinaTag* this, PlayState* play) { s16 yDiff; u16 var_v1; - if (this->switchFlags >= 0) { + if (this->switchFlag >= 0) { if (this->unk148 == 0) { - if (Flags_GetSwitch(play, this->switchFlags)) { + if (Flags_GetSwitch(play, this->switchFlag)) { return; } } if (this->unk148 == 1) { - if (!Flags_GetSwitch(play, this->switchFlags)) { + if (!Flags_GetSwitch(play, this->switchFlag)) { return; } } @@ -81,7 +81,7 @@ void func_8093E518(EnOkarinaTag* this, PlayState* play) { var_v1 = this->unk14A; if (var_v1 == 6) { var_v1 = 0xA; - if (gSaveContext.save.saveInfo.unk_F41 == 0) { + if (!gSaveContext.save.saveInfo.scarecrowSpawnSongSet) { return; } } @@ -89,7 +89,7 @@ void func_8093E518(EnOkarinaTag* this, PlayState* play) { var_v1 = 0; } if (func_800B8718(&this->actor, &play->state)) { - func_80152434(play, var_v1 + 0x29); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_CHECK_HEALING + var_v1); this->actionFunc = func_8093E68C; } else { yDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)); @@ -111,33 +111,36 @@ void func_8093E518(EnOkarinaTag* this, PlayState* play) { } void func_8093E68C(EnOkarinaTag* this, PlayState* play) { - if (play->msgCtx.ocarinaMode == 4) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { this->actionFunc = func_8093E518; } else { - if ((play->msgCtx.ocarinaMode == 3) || - ((this->unk14A == -1) && - ((play->msgCtx.ocarinaMode == 5) || (play->msgCtx.ocarinaMode == 6) || (play->msgCtx.ocarinaMode == 7) || - (play->msgCtx.ocarinaMode == 8) || (play->msgCtx.ocarinaMode == 0xA) || (play->msgCtx.ocarinaMode == 9) || - (play->msgCtx.ocarinaMode == 0xF)))) { - if (this->switchFlags >= 0) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) || + ((this->unk14A == -1) && ((play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_TIME) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_HEALING) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_EPONAS) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_SOARING) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_SUNS) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_STORMS) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_F)))) { + if (this->switchFlag >= 0) { switch (this->unk148) { case 0: - Flags_SetSwitch(play, this->switchFlags); + Flags_SetSwitch(play, this->switchFlag); break; case 1: - Flags_UnsetSwitch(play, this->switchFlags); + Flags_UnsetSwitch(play, this->switchFlag); break; case 2: - if (Flags_GetSwitch(play, this->switchFlags)) { - Flags_UnsetSwitch(play, this->switchFlags); + if (Flags_GetSwitch(play, this->switchFlag)) { + Flags_UnsetSwitch(play, this->switchFlag); } else { - Flags_SetSwitch(play, this->switchFlags); + Flags_SetSwitch(play, this->switchFlag); } break; } } - play->msgCtx.ocarinaMode = 4; - play_sound(NA_SE_SY_CORRECT_CHIME); + play->msgCtx.ocarinaMode = OCARINA_MODE_END; + Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_8093E518; } } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 0dd15c1c9..4c968b362 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -7,7 +7,7 @@ struct EnOkarinaTag; typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*); -#define ENOKARINATAG_GET_SWITCHFLAGS(thisx) (((thisx)->params & 0x7F)) +#define ENOKARINATAG_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x7F)) #define ENOKARINATAG_GET_780(thisx) (((thisx)->params >> 0x7) & 0xF) #define ENOKARINATAG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F) @@ -16,7 +16,7 @@ typedef struct EnOkarinaTag { /* 0x144 */ EnOkarinaTagActionFunc actionFunc; /* 0x148 */ s16 unk148; /* 0x14A */ s16 unk14A; - /* 0x14C */ s32 switchFlags; + /* 0x14C */ s32 switchFlag; /* 0x150 */ s8 unk150; /* 0x154 */ f32 unk154; /* 0x158 */ f32 unk158; diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 8241c7e5c..3263d9b71 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -6,7 +6,7 @@ #include "z_en_okuta.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnOkuta*)thisx) diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index cd20f489c..4e666ed5c 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -6,7 +6,7 @@ #include "z_en_onpuman.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnOnpuman*)thisx) @@ -56,7 +56,7 @@ void EnOnpuman_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->unk_2A4 = 0; this->unk_2A0 = NULL; this->actionFunc = func_80B121D8; @@ -84,14 +84,14 @@ Actor* func_80B11F44(PlayState* play) { } void func_80B11F78(EnOnpuman* this, PlayState* play) { - if (play->msgCtx.ocarinaMode == 4) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { this->actionFunc = func_80B121D8; if (this->actor.csId != CS_ID_NONE) { CutsceneManager_Stop(this->actor.csId); } - } else if (play->msgCtx.ocarinaMode == 3) { - play_sound(NA_SE_SY_CORRECT_CHIME); - play->msgCtx.ocarinaMode = 4; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { + Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); + play->msgCtx.ocarinaMode = OCARINA_MODE_END; if (this->actor.csId != CS_ID_NONE) { CutsceneManager_Stop(this->actor.csId); } @@ -118,7 +118,7 @@ void func_80B1202C(EnOnpuman* this, PlayState* play2) { case 0x8D6: this->actionFunc = func_80B11F78; - func_80152434(play, 0x3A); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_3A); if (this->unk_2A0 != NULL) { this->unk_2A0->home.rot.x = 0; } @@ -158,7 +158,7 @@ void func_80B121D8(EnOnpuman* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { if (ABS_ALT(yaw) <= 0x4300) { this->actor.textId = 0x8D3; - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); func_800B874C(&this->actor, play, 100.0f, 100.0f); } } diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.c b/src/overlays/actors/ovl_En_Osk/z_en_osk.c index c1ce34949..3a58ba62b 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.c +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.c @@ -8,7 +8,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_ikn_demo/object_ikn_demo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnOsk*)thisx) @@ -67,7 +67,7 @@ void EnOsk_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BF5F60; this->unk_254 = -1; this->cueId = -1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; switch (ENOSK_GET_F(&this->actor)) { case ENOSK_1: @@ -221,7 +221,7 @@ void func_80BF61EC(EnOsk* this, PlayState* play) { this->actor.scale.x -= 0.85f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); func_80BF5EBC(this, play); - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; } @@ -298,7 +298,7 @@ void func_80BF6478(EnOsk* this) { case 10: case 11: - func_800B9010(&this->actor, NA_SE_EN_YASE_LAUGH_K - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_YASE_LAUGH_K - SFX_FLAG); break; } } @@ -350,7 +350,7 @@ void func_80BF656C(EnOsk* this, PlayState* play) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); func_80BF5EBC(this, play); - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; } @@ -423,7 +423,7 @@ void func_80BF68E0(EnOsk* this) { break; case 5: - if ((Animation_OnFrame(&this->skelAnime, 6.0f)) || Animation_OnFrame(&this->skelAnime, 11.0f)) { + if (Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 11.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; @@ -482,7 +482,7 @@ void func_80BF6A20(EnOsk* this, PlayState* play) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); func_80BF5EBC(this, play); - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; } @@ -536,18 +536,16 @@ void EnOsk_Draw(Actor* thisx, PlayState* play) { Matrix_Translate(this->actor.focus.pos.x + sp80.x, this->actor.focus.pos.y + sp80.y, sp80.z = this->actor.focus.pos.z + sp80.z, MTXMODE_NEW); - sp80.z = Math_SinS(play->gameplayFrames << 0xE); + sp80.z = Math_SinS(play->gameplayFrames * 0x4000); sp80.z = ((sp80.z + 1.0f) * 0.1f) + 2.0f; Matrix_Scale(this->actor.scale.x * sp80.z, this->actor.scale.y * sp80.z, this->actor.scale.z * sp80.z, MTXMODE_APPLY); } - gfx = Gfx_SetupDL20_NoCD(POLY_XLU_DISP); + gfx = POLY_XLU_DISP; + gfx = Gfx_SetupDL20_NoCD(gfx); - gSPSetOtherMode(gfx++, G_SETOTHERMODE_H, 4, 4, 0x00000080); - if (1) {} - if (1) {} - if (1) {} + gDPSetDither(gfx++, G_CD_NOISE); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); gDPSetPrimColor(gfx++, 0, 0, 130, 0, 255, 100); 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 0631922be..29361e80f 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -7,7 +7,7 @@ #include "z_en_osn.h" #include "objects/object_osn/object_osn.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnOsn*)thisx) @@ -176,7 +176,7 @@ static DamageTable sDamageTable = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_STOP), }; void EnOsn_UpdateCollider(EnOsn* this, PlayState* play) { @@ -705,12 +705,12 @@ void EnOsn_InitCutscene(EnOsn* this) { } void EnOsn_ChooseAction(EnOsn* this, PlayState* play) { - u32 isFlagSet = Flags_GetSwitch(play, 0); + u32 isSwitchFlagSet = Flags_GetSwitch(play, 0); this->csId = this->actor.csId; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, OSN_ANIM_IDLE); - if (!isFlagSet) { + if (!isSwitchFlagSet) { this->actionFunc = EnOsn_HandleCsAction; } else { this->actionFunc = EnOsn_Idle; @@ -724,17 +724,17 @@ void EnOsn_Idle(EnOsn* this, PlayState* play) { !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnOsn_StartCutscene; - } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (yaw < 0x4000) && + } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) && (yaw < 0x4000) && (yaw > -0x4000)) { - func_800B863C(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); this->actor.textId = 0xFFFF; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->textId = EnOsn_GetInitialText(this, play); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnOsn_Talk; - } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (yaw < 0x4000) && (yaw > -0x4000)) { - func_800B863C(&this->actor, play); + } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) && (yaw < 0x4000) && (yaw > -0x4000)) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } @@ -869,9 +869,9 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { } if ((this->animIndex == OSN_ANIM_WALK_AWAY) && - (((Animation_OnFrame(&this->skelAnime, 17.0f))) || (Animation_OnFrame(&this->skelAnime, 27.0f)) || - (Animation_OnFrame(&this->skelAnime, 37.0f)) || (Animation_OnFrame(&this->skelAnime, 47.0f)) || - (Animation_OnFrame(&this->skelAnime, 57.0f)) || (Animation_OnFrame(&this->skelAnime, 67.0f)))) { + (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 27.0f) || + Animation_OnFrame(&this->skelAnime, 37.0f) || Animation_OnFrame(&this->skelAnime, 47.0f) || + Animation_OnFrame(&this->skelAnime, 57.0f) || Animation_OnFrame(&this->skelAnime, 67.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_OMENYA_WALK); } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); @@ -888,7 +888,7 @@ void EnOsn_Talk(EnOsn* this, PlayState* play) { if (((talkState == TEXT_STATE_DONE) || (talkState == TEXT_STATE_5)) && Message_ShouldAdvance(play)) { if (this->stateFlags & OSN_STATE_END_CONVERSATION) { this->stateFlags &= ~OSN_STATE_END_CONVERSATION; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnOsn_Idle; } else { @@ -948,7 +948,7 @@ void EnOsn_Init(Actor* thisx, PlayState* play) { break; case OSN_TYPE_CUTSCENE: - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnOsn_HandleCsAction; break; @@ -968,20 +968,20 @@ void EnOsn_Destroy(Actor* thisx, PlayState* play) { void EnOsn_Update(Actor* thisx, PlayState* play) { s32 pad; EnOsn* this = THIS; - u32 isFlagSet = Flags_GetSwitch(play, 0); + u32 isSwitchFlagSet = Flags_GetSwitch(play, 0); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); SkelAnime_Update(&this->skelAnime); if (ENOSN_GET_TYPE(&this->actor) == OSN_TYPE_CHOOSE) { - if (isFlagSet) { - this->actor.flags |= ACTOR_FLAG_1; + if (isSwitchFlagSet) { + this->actor.flags |= ACTOR_FLAG_TARGETABLE; EnOsn_UpdateCollider(this, play); this->actor.draw = EnOsn_Draw; } else { this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } 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 7ada3a223..bcdd2934e 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -7,7 +7,7 @@ #include "z_en_ossan.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnOssan*)thisx) @@ -31,7 +31,7 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play); void EnOssan_Idle(EnOssan* this, PlayState* play); void EnOssan_BeginInteraction(EnOssan* this, PlayState* play); void EnOssan_Hello(EnOssan* this, PlayState* play); -void EnOssan_SetHaveMet(EnOssan* this); +void EnOssan_SetTalked(EnOssan* this); void EnOssan_StartShopping(PlayState* play, EnOssan* this); void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play); void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play); @@ -198,7 +198,7 @@ void EnOssan_SetupAction(EnOssan* this, EnOssanActionFunc action) { s32 EnOssan_TestItemSelected(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || @@ -267,16 +267,16 @@ void EnOssan_SpawnShopItems(EnOssan* this, PlayState* play, ShopItem* shop) { void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = THIS; - s16 id; + s16 objectId; if ((this->actor.params > ENOSSAN_PART_TIME_WORKER) && (this->actor.params < ENOSSAN_CURIOSITY_SHOP_MAN)) { //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } - id = sObjectIds[this->actor.params]; - this->objIndex = Object_GetIndex(&play->objectCtx, id); - if (this->objIndex < 0) { + objectId = sObjectIds[this->actor.params]; + this->objectSlot = Object_GetSlot(&play->objectCtx, objectId); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -304,7 +304,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { Player* player = GET_PLAYER(play); Actor_ProcessTalkRequest(&this->actor, &play->state); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; @@ -360,7 +360,7 @@ void EnOssan_StartShopping(PlayState* play, EnOssan* this) { } void EnOssan_SetupLookToShopkeeperFromShelf(PlayState* play, EnOssan* this) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_LookToShopkeeperFromShelf); } @@ -368,7 +368,7 @@ void EnOssan_SetupLookToShopkeeperFromShelf(PlayState* play, EnOssan* this) { void EnOssan_Idle(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENOSSAN_LIMB_MAX); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->stateFlags2 |= PLAYER_STATE2_20000000; EnOssan_SetupAction(this, EnOssan_BeginInteraction); @@ -384,7 +384,7 @@ void EnOssan_Idle(EnOssan* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 100.0f) && (player->actor.world.pos.x >= -40.0f) && (player->actor.world.pos.x <= 40.0f) && (player->actor.world.pos.z >= -91.0f) && (player->actor.world.pos.z <= -60.0f)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } if (this->actor.params == ENOSSAN_PART_TIME_WORKER) { Math_SmoothStepToS(&this->partTimerHeadRot.y, 8000, 3, 2000, 0); @@ -417,7 +417,7 @@ void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { break; case FSN_ANIM_TURN_AROUND_FORWARD: - EnOssan_SetHaveMet(this); + EnOssan_SetTalked(this); this->textId = EnOssan_CuriosityShopMan_GetWelcome(this, play); SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, this->animIndex); break; @@ -454,7 +454,7 @@ void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { } } } else { - EnOssan_SetHaveMet(this); + EnOssan_SetTalked(this); this->textId = EnOssan_PartTimer_GetWelcome(this, play); Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, false); @@ -605,7 +605,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if ((this->actor.params == ENOSSAN_PART_TIME_WORKER) && (player->transformation == PLAYER_FORM_ZORA)) { this->animIndex = ANI_ANIM_APOLOGY_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, 9); @@ -618,7 +618,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { return true; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnOssan_EndInteraction(play, this); return true; @@ -652,7 +652,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { EnOssan_SetupAction(this, EnOssan_LookToLeftShelf); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } else if (this->stickAccumX > 0) { cursorIndex = EnOssan_SetCursorIndexFromNeutral(this, 0); @@ -661,7 +661,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { EnOssan_SetupAction(this, EnOssan_LookToRightShelf); func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } else { @@ -839,11 +839,11 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_SelectItem); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } return true; } @@ -901,7 +901,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) { EnOssan_CursorUpDown(this); if (this->cursorIndex != prevCursorIndex) { Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -959,7 +959,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { EnOssan_CursorUpDown(this); if (this->cursorIndex != prevCursorIndex) { Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -994,7 +994,7 @@ void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { Player* player = GET_PLAYER(play); Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); @@ -1021,7 +1021,7 @@ void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item->buyFanfareFunc(play, item); EnOssan_SetupBuyItemWithFanfare(play, this); this->drawCursor = 0; @@ -1030,7 +1030,7 @@ void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { break; case CANBUY_RESULT_SUCCESS_2: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item->buyFunc(play, item); EnOssan_SetupBuy(play, this, sBuySuccessTextIds[this->actor.params]); this->drawCursor = 0; @@ -1040,27 +1040,27 @@ void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { case CANBUY_RESULT_NO_ROOM: case CANBUY_RESULT_NO_ROOM_2: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnOssan_SetupCannotBuy(play, this, sNoRoomTextIds[this->actor.params]); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnOssan_SetupCannotBuy(play, this, sNeedEmptyBottleTextIds[this->actor.params]); break; case CANBUY_RESULT_NEED_RUPEES: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnOssan_SetupCannotBuy(play, this, sNeedRupeesTextIds[this->actor.params]); break; case CANBUY_RESULT_CANNOT_GET_NOW_2: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnOssan_SetupCannotBuy(play, this, sCannotGetNowTextIds[this->actor.params]); break; case CANBUY_RESULT_CANNOT_GET_NOW: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnOssan_SetupCannotBuy(play, this, sNoRoomTextIds[this->actor.params]); break; @@ -1081,7 +1081,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actionFunc = this->prevActionFunc; Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); break; @@ -1124,7 +1124,7 @@ void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) { void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; EnOssan_SetupAction(this, EnOssan_ItemPurchased); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { @@ -1134,7 +1134,7 @@ void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { this->csId = this->lookToShopkeeperCsId; CutsceneManager_Queue(this->csId); } - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1152,17 +1152,17 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y); player->stateFlags2 |= PLAYER_STATE2_20000000; Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 100.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, PLAYER_IA_MINUS1); break; case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnOssan_EndInteraction(play, this); break; } @@ -1176,7 +1176,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_20000000; Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 100.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, PLAYER_IA_MINUS1); } } @@ -1200,7 +1200,7 @@ void EnOssan_ItemPurchased(EnOssan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_ContinueTextbox(play, 0x642); } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1395,14 +1395,14 @@ void EnOssan_CuriosityShopMan_Init(EnOssan* this, PlayState* play) { } void EnOssan_PartTimer_Init(EnOssan* this, PlayState* play) { - SkelAnime_InitFlex(play, &this->skelAnime, &gAniSkeleton, &gAniStandingNormalAnim, this->jointTable, - this->morphTable, 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gAniSkel, &gAniStandingNormalAnim, this->jointTable, this->morphTable, + ANI_LIMB_MAX); this->actor.draw = EnOssan_PartTimer_Draw; } u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 textId = Text_GetFaceReaction(play, 0x2F); + u16 textId = Text_GetFaceReaction(play, FACE_REACTION_SET_CURIOSITY_SHOP_MAN); if (textId != 0) { this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START; @@ -1413,21 +1413,21 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { switch (player->transformation) { case PLAYER_FORM_DEKU: this->animIndex = FSN_ANIM_SLAM_COUNTER_START; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_DEKU)) { return sWelcomeDekuTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_ZORA: this->animIndex = FSN_ANIM_LEAN_FORWARD_START; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_ZORA)) { return sWelcomeZoraTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_GORON: this->animIndex = FSN_ANIM_HAND_ON_FACE_START; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_18_04)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_GORON)) { return sWelcomeGoronTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; @@ -1440,7 +1440,7 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 textId = Text_GetFaceReaction(play, 0x36); + u16 textId = Text_GetFaceReaction(play, FACE_REACTION_SET_PART_TIMER); if (textId != 0) { this->flags |= END_INTERACTION; @@ -1449,19 +1449,19 @@ u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) { switch (player->transformation) { case PLAYER_FORM_DEKU: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_DEKU)) { return sWelcomeDekuTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_ZORA: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_ZORA)) { return sWelcomeZoraTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; case PLAYER_FORM_GORON: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_04)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_GORON)) { return sWelcomeGoronTextIds[ENOSSAN_PART_TIME_WORKER]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_PART_TIME_WORKER]; @@ -1471,30 +1471,30 @@ u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) { } } -void EnOssan_SetHaveMet(EnOssan* this) { +void EnOssan_SetTalked(EnOssan* this) { switch (this->textId) { case 0x06A9: - SET_WEEKEVENTREG(WEEKEVENTREG_18_10); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_DEKU); break; case 0x06C6: - SET_WEEKEVENTREG(WEEKEVENTREG_55_10); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_DEKU); break; case 0x06A7: - SET_WEEKEVENTREG(WEEKEVENTREG_18_08); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_ZORA); break; case 0x06C4: - SET_WEEKEVENTREG(WEEKEVENTREG_55_08); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_ZORA); break; case 0x06A5: - SET_WEEKEVENTREG(WEEKEVENTREG_18_04); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_GORON); break; case 0x06C2: - SET_WEEKEVENTREG(WEEKEVENTREG_55_04); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_PART_TIMER_AS_GORON); break; default: @@ -1506,9 +1506,9 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) { static EnOssanActionFunc sInitFuncs[] = { EnOssan_CuriosityShopMan_Init, EnOssan_PartTimer_Init }; ShopItem* shopItems; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { this->actor.flags &= ~ACTOR_FLAG_10; - this->actor.objBankIndex = this->objIndex; + this->actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->actor); shopItems = sShops[this->actor.params]; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); @@ -1576,7 +1576,7 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) { this->blinkTimer = 20; this->eyeTexIndex = 0; this->blinkFunc = EnOssan_WaitForBlink; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; EnOssan_SetupAction(this, EnOssan_Idle); } } @@ -1744,8 +1744,8 @@ void EnOssan_CuriosityShopMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** if ((limbIndex == FSN_LIMB_PELVIS) || (limbIndex == FSN_LIMB_LEFT_UPPER_ARM) || (limbIndex == FSN_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (s16)Math_SinS(this->limbRotTableY[limbIndex]) * 200; - rot->z += (s16)Math_CosS(this->limbRotTableZ[limbIndex]) * 200; + rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200; + rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200; } } 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 c5de183d5..02c44818f 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -6,7 +6,7 @@ #include "objects/object_ani/object_ani.h" #include "objects/object_fsn/object_fsn.h" -// Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml +// Note: adding 1 to FSN_LIMB_MAX due to bug in the skeleton, see bug in object_fsn.xml #define ENOSSAN_LIMB_MAX MAX((s32)FSN_LIMB_MAX + 1, (s32)ANI_LIMB_MAX) struct EnOssan; @@ -21,7 +21,7 @@ typedef struct EnOssan { /* 0x18C */ EnOssanActionFunc prevActionFunc; // Used to restore back to correct browsing function /* 0x190 */ ColliderCylinder collider; /* 0x1DC */ s16 delayTimer; - /* 0x1DE */ s8 objIndex; + /* 0x1DE */ s8 objectSlot; /* 0x1E0 */ s16 eyeTexIndex; /* 0x1E2 */ s16 blinkTimer; /* 0x1E4 */ EnOssanBlinkFunc blinkFunc; @@ -52,8 +52,8 @@ typedef struct EnOssan { /* 0x2C4 */ u16 textId; /* 0x2C6 */ Vec3s headRot; /* 0x2CC */ Vec3s unk2CC; // Set but never used - /* 0x2D2 */ s16 limbRotTableY[19]; - /* 0x2F8 */ s16 limbRotTableZ[19]; + /* 0x2D2 */ s16 fidgetTableY[ENOSSAN_LIMB_MAX]; + /* 0x2F8 */ s16 fidgetTableZ[ENOSSAN_LIMB_MAX]; /* 0x31E */ Vec3s jointTable[ENOSSAN_LIMB_MAX]; /* 0x390 */ Vec3s morphTable[ENOSSAN_LIMB_MAX]; /* 0x402 */ s16 animIndex; 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 df6d3708f..fa7e72acc 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -9,7 +9,7 @@ #include "objects/object_ot/object_ot.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnOt*)thisx) @@ -107,9 +107,9 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 params, Vec3f* vec, s32* index) { +void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 pathIndex, Vec3f* vec, s32* index) { s32 i; - Path* path = &play->setupPathList[params]; + Path* path = &play->setupPathList[pathIndex]; f32 dist; Vec3f sp58; Vec3f sp4C; @@ -118,7 +118,7 @@ void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 params, Vec3f* vec, s32* ind for (i = 0; i < path->count; i++) { Math_Vec3s_ToVec3f(&sp58, &((Vec3s*)Lib_SegmentedToVirtual(path->points))[i]); dist = Math_Vec3f_DistXYZ(pos, &sp58); - if (dist < minDist) { + if (minDist > dist) { minDist = dist; Math_Vec3f_Copy(&sp4C, &sp58); *index = i; @@ -138,11 +138,11 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); this->unk_388 = 0; - this->unk_33C = ENOT_GET_C000(&this->actor); - if (this->unk_33C == 0) { + this->type = SEAHORSE_GET_TYPE(&this->actor); + if (this->type == SEAHORSE_TYPE_0) { D_80B5E880 = this; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.update = func_80B5DB6C; this->actor.draw = NULL; return; @@ -156,7 +156,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Animation_GetLastFrame(&sAnimations[0].animation->common) * Rand_ZeroOne(), Animation_GetLastFrame(&sAnimations[0].animation->common), sAnimations[0].mode, sAnimations[0].morphFrames); - this->unk_346 = ENOT_GET_7F(&this->actor); + this->pathIndex = SEAHORSE_GET_PATH_INDEX(&this->actor); this->unk_344 = this->actor.world.rot.z; this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; @@ -170,10 +170,10 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->unk_744.g = 200; this->unk_744.b = 80; - switch (ENOT_GET_C000(&this->actor)) { - case 1: + switch (SEAHORSE_GET_TYPE(&this->actor)) { + case SEAHORSE_TYPE_1: D_80B5E884 = this; - Actor_SetScale(&this->actor, 0.012999999f); + Actor_SetScale(&this->actor, 1.3f * 0.01f); switch (this->unk_344) { case 0: @@ -186,7 +186,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Sum(&this->actor.world.pos, &sp64, &sp64); this->unk_360 = (EnOt*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, sp64.x, sp64.y, sp64.z, 0, BINANG_ROT180(this->actor.shape.rot.y), 1, - ENOT_GET_3FFF(&this->actor) | 0x8000); + SEAHORSE_PARAMS_PARTNER(&this->actor, SEAHORSE_TYPE_2)); if (this->unk_360 != NULL) { this->unk_360->unk_360 = this; this->unk_3A0 = 0; @@ -224,7 +224,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { } break; - case 2: + case SEAHORSE_TYPE_2: D_80B5E888 = this; switch (this->unk_344) { @@ -249,7 +249,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { break; case 1: - Actor_SetScale(&this->actor, 0.012999999f); + Actor_SetScale(&this->actor, 1.3f * 0.01f); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_01)) { func_80B5C244(this, play); @@ -263,10 +263,10 @@ void EnOt_Init(Actor* thisx, PlayState* play) { } break; - case 3: + case SEAHORSE_TYPE_3: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); Actor_SetScale(&this->actor, 0.0064999997f); this->collider.dim.radius *= 0.5f; this->collider.dim.height *= 0.5f; @@ -277,6 +277,9 @@ void EnOt_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } break; + + default: + break; } } @@ -408,15 +411,15 @@ void func_80B5C25C(EnOt* this, PlayState* play) { this->unk_32C |= 0x80; } - if ((this->unk_33C == 2) && (this->unk_32C & 0x80) && (this->unk_360->unk_32C & 0x80)) { + if ((this->type == SEAHORSE_TYPE_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->animIndex); SubS_ChangeAnimationBySpeedInfo(&this->unk_360->skelAnime, sAnimations, 2, &this->unk_360->animIndex); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->unk_360->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->unk_360->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->unk_360->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); func_80B5C9A8(this->unk_360, play); func_80B5C3B8(this, play); } @@ -456,8 +459,8 @@ void func_80B5C3D8(EnOt* this, PlayState* play) { this->unk_360->actor.shape.rot.y = BINANG_ROT180(temp); if (this->unk_740 < 1.0f) { - Lib_LerpRGB(&D_80B5E408, &D_80B5E40C, this->unk_740, &this->unk_744); - Lib_LerpRGB(&D_80B5E408, &D_80B5E40C, this->unk_740, &this->unk_360->unk_744); + Color_RGB8_Lerp(&D_80B5E408, &D_80B5E40C, this->unk_740, &this->unk_744); + Color_RGB8_Lerp(&D_80B5E408, &D_80B5E40C, this->unk_740, &this->unk_360->unk_744); Math_StepToF(&this->unk_740, 1.0f, 0.05f); } @@ -502,7 +505,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { sp3E = Actor_WorldYawTowardPoint(&player->actor, &this->unk_394); Matrix_RotateYS(BINANG_ADD(sp3E, 0x4000), MTXMODE_NEW); - if (this->unk_33C == 2) { + if (this->type == SEAHORSE_TYPE_2) { Matrix_MultVecZ(26.259998f, &sp30); } else { if (this->unk_73C == 0) { @@ -528,7 +531,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_348.x, 1.0f, 2.0f, 0.01f); Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_348.z, 1.0f, 2.0f, 0.01f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (this->unk_33C == 1)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (this->type == SEAHORSE_TYPE_1)) { this->actor.textId = 0; this->unk_384 = 1; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -538,7 +541,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { func_80B5D114(this, play); } else if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { - func_800B8614(&this->actor, play, 130.0f); + Actor_OfferTalk(&this->actor, play, 130.0f); } } } @@ -582,9 +585,9 @@ void func_80B5C9D0(EnOt* this, PlayState* play) { } void func_80B5CA30(EnOt* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); + Math_SmoothStepToF(&this->actor.scale.x, 1.3f * 0.01f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); - if (this->actor.scale.x == 0.012999999f) { + if (this->actor.scale.x == 1.3f * 0.01f) { this->unk_360->unk_32C |= 0x1000; this->unk_360->unk_360 = this; func_80B5C9A8(this, play); @@ -597,9 +600,9 @@ void func_80B5CAD0(EnOt* this, PlayState* play) { } void func_80B5CB0C(EnOt* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); + Math_SmoothStepToF(&this->actor.scale.x, 1.3f * 0.01f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); - if (this->actor.scale.x == 0.012999999f) { + if (this->actor.scale.x == 1.3f * 0.01f) { this->unk_32C |= 0x800; func_80B5CE6C(this, play); } @@ -607,7 +610,8 @@ 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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); this->actionFunc = func_80B5CBEC; } @@ -618,7 +622,8 @@ 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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); } } @@ -697,16 +702,17 @@ 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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { - func_800B8614(&this->actor, play, 130.0f); + Actor_OfferTalk(&this->actor, play, 130.0f); } } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (ENOT_GET_C000(&this->actor) == 1)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_84_10) && (SEAHORSE_GET_TYPE(&this->actor) == 1)) { if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.playerHeightRel) <= 130.0f)) { player->unk_B2B = 29; } @@ -751,14 +757,14 @@ void func_80B5D160(EnOt* this, PlayState* play) { if (temp == 0) { switch (this->unk_384) { case 0: - if ((this->unk_33C != 1) && (this->unk_33C == 2)) { + if ((this->type != SEAHORSE_TYPE_1) && (this->type == SEAHORSE_TYPE_2)) { if (this->unk_32C & 1) { if (this->unk_32C & 4) { phi_a1 = 0x106A; } else { phi_a1 = 0x1069; } - } else if (Flags_GetSwitch(play, ENOT_GET_3F80(&this->actor))) { + } else if (Flags_GetSwitch(play, SEAHORSE_GET_SWITCH_FLAG(&this->actor))) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_10)) { phi_a1 = 0x106C; } else { @@ -881,10 +887,10 @@ s32 EnOt_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) } void func_80B5D648(EnOt* this, PlayState* play) { - func_80B5B2E0(play, &this->actor.world.pos, this->unk_346, &this->unk_348, &this->unk_340); + func_80B5B2E0(play, &this->actor.world.pos, this->pathIndex, &this->unk_348, &this->unk_340); Math_Vec3f_Copy(&this->unk_330, &this->actor.world.pos); - SubS_ActorPathing_Init(play, &this->unk_330, &this->actor, &this->actorPath, play->setupPathList, this->unk_346, 0, - 0, this->unk_340, 0); + SubS_ActorPathing_Init(play, &this->unk_330, &this->actor, &this->actorPath, play->setupPathList, this->pathIndex, + 0, 0, this->unk_340, 0); this->unk_32C = 0; this->actorPath.pointOffset.x = 0.0f; this->actorPath.pointOffset.y = 0.0f; @@ -893,8 +899,8 @@ void func_80B5D648(EnOt* this, PlayState* play) { this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - Flags_SetSwitch(play, ENOT_GET_3F80(&this->actor)); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); + Flags_SetSwitch(play, SEAHORSE_GET_SWITCH_FLAG(&this->actor)); this->actionFunc = func_80B5D750; } @@ -921,7 +927,7 @@ void func_80B5D750(EnOt* this, PlayState* play) { if ((this->unk_32C & 1) && (this->actor.xzDistToPlayer <= 180.0f)) { this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); if (D_80B5E884 != 0) { func_80B5C9A8(this, play); } else { @@ -994,10 +1000,11 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_04)) { Vec3f sp50; - func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); + func_80B5B2E0(play, &this->actor.world.pos, SEAHORSE_GET_PATH_INDEX(&this->actor), &sp50, &this->unk_340); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, - this->actor.shape.rot.y, 1, ENOT_GET_3FFF(&this->actor) | 0x8000, - this->actor.csId, this->actor.halfDaysBits, NULL) != NULL) { + this->actor.shape.rot.y, 1, + SEAHORSE_PARAMS_PARTNER(&this->actor, SEAHORSE_TYPE_2), this->actor.csId, + this->actor.halfDaysBits, NULL) != NULL) { this->unk_32C |= 8; } } else if (D_80B5E888 != NULL) { @@ -1013,7 +1020,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { EnOt* temp = D_80B5E888; temp->unk_32C |= 8; - temp->unk_346 = ENOT_GET_7F(&this->actor); + temp->pathIndex = SEAHORSE_GET_PATH_INDEX(&this->actor); temp->actor.params = this->actor.params; temp->actor.csId = this->actor.csId; this->unk_32C |= 8; @@ -1146,21 +1153,22 @@ void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2) { POLY_OPA_DISP = Gfx_SetupDL66(POLY_OPA_DISP); for (i = 0; i < arg2; i++, arg1++) { - if (arg1->unk_00) { - if (!flag) { - gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000040); - flag = true; - if (play) {} - } - - Matrix_Translate(arg1->unk_0C.x, arg1->unk_0C.y, arg1->unk_0C.z, MTXMODE_NEW); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); - Matrix_Scale(arg1->unk_04, arg1->unk_04, arg1->unk_04, MTXMODE_APPLY); - - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000078); + if (arg1->unk_00 == 0) { + continue; } + + if (!flag) { + gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000040); + flag = true; + } + + Matrix_Translate(arg1->unk_0C.x, arg1->unk_0C.y, arg1->unk_0C.z, MTXMODE_NEW); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); + Matrix_Scale(arg1->unk_04, arg1->unk_04, arg1->unk_04, MTXMODE_APPLY); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000078); } CLOSE_DISPS(play->state.gfxCtx); 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 8b01c6654..aa90ffa0b 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -7,10 +7,19 @@ struct EnOt; typedef void (*EnOtActionFunc)(struct EnOt*, PlayState*); -#define ENOT_GET_7F(thisx) ((thisx)->params & 0x7F) -#define ENOT_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) -#define ENOT_GET_3FFF(thisx) ((thisx)->params & 0x3FFF) -#define ENOT_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) +#define SEAHORSE_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) +#define SEAHORSE_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 7) & 0x7F) +#define SEAHORSE_GET_TYPE(thisx) (((thisx)->params >> 0xE) & 3) + +#define SEAHORSE_PARAMS(type, pathIndex, switchFlag) (((pathIndex) & 0x7F) | (((switchFlag) & 0x7F) << 7) | (((type) & 3) << 0xE)) +#define SEAHORSE_PARAMS_PARTNER(thisx, type) (((thisx)->params & 0x3FFF) | (((type) & 3) << 0xE)) + +typedef enum SeahorseType { + /* 0 */ SEAHORSE_TYPE_0, + /* 1 */ SEAHORSE_TYPE_1, + /* 2 */ SEAHORSE_TYPE_2, + /* 3 */ SEAHORSE_TYPE_3 +} SeahorseType; typedef struct { /* 0x00 */ u8 unk_00; @@ -39,10 +48,10 @@ typedef struct EnOt { /* 0x2C0 */ ActorPathing actorPath; /* 0x32C */ u16 unk_32C; /* 0x330 */ Vec3f unk_330; - /* 0x33C */ s32 unk_33C; + /* 0x33C */ s32 type; /* 0x340 */ s32 unk_340; /* 0x344 */ s16 unk_344; - /* 0x346 */ s16 unk_346; + /* 0x346 */ s16 pathIndex; /* 0x348 */ Vec3f unk_348; /* 0x354 */ s16 unk_354; /* 0x356 */ s16 csIdList[4]; 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 e5b4cabe3..db4d9386b 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -7,7 +7,7 @@ #include "z_en_owl.h" #include "objects/object_owl/object_owl.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnOwl*)thisx) @@ -120,7 +120,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.1f); this->actor.update = func_8095CCF4; this->actor.draw = func_8095D074; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_3D8 = 0; this->unk_3DA = 0x320; this->unk_3DC = 0x12C; @@ -146,7 +146,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { this->unk_40C = 4; this->csIdIndex = -1; owlType = ENOWL_GET_TYPE(&this->actor); - switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor); + switchFlag = ENOWL_GET_SWITCH_FLAG(&this->actor); switch (owlType) { case ENOWL_GET_TYPE_1: @@ -157,7 +157,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { break; case ENOWL_GET_TYPE_2: - if (gSaveContext.save.saveInfo.inventory.items[ITEM_LENS] == ITEM_LENS) { + if (gSaveContext.save.saveInfo.inventory.items[ITEM_LENS_OF_TRUTH] == ITEM_LENS_OF_TRUTH) { Actor_Kill(&this->actor); return; } @@ -169,6 +169,9 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { return; } break; + + default: + break; } this->unk_3DA = 0; @@ -229,7 +232,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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, targetDist, arg4, PLAYER_IA_NONE); } return false; @@ -242,7 +245,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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 350.0f, 1000.0f, PLAYER_IA_NONE); } return false; @@ -255,7 +258,7 @@ void func_8095AA70(EnOwl* this) { } void func_8095AAD0(EnOwl* this, PlayState* play) { - s32 switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor); + s32 switchFlag = ENOWL_GET_SWITCH_FLAG(&this->actor); if (switchFlag < 0x7F) { Flags_SetSwitch(play, switchFlag); @@ -335,6 +338,9 @@ void func_8095AD54(EnOwl* this, PlayState* play) { Message_ContinueTextbox(play, 0x7D3); this->actionFunc = func_8095ABF0; break; + + default: + break; } } } @@ -379,6 +385,9 @@ void func_8095AF2C(EnOwl* this, PlayState* play) { func_8095ACEC(this); this->actionFunc = func_8095ABF0; break; + + default: + break; } } @@ -505,7 +514,7 @@ void func_8095B574(EnOwl* this, PlayState* play) { this->csIdIndex = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 200.0f, 400.0f, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 200.0f, 400.0f, PLAYER_IA_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -612,7 +621,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0xBEC: switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_40)) { Message_ContinueTextbox(play, 0xBF4); } else { @@ -622,25 +631,34 @@ void func_8095BA84(EnOwl* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0xBEF); break; + + default: + break; } break; case 0xBF2: switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0xBF4); - return; + break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0xBF3); - return; + break; + + default: + break; } break; + + default: + break; } } break; @@ -703,9 +721,15 @@ void func_8095BA84(EnOwl* this, PlayState* play) { this->actionFlags |= 8; func_8095ACEC(this); break; + + default: + break; } } break; + + default: + break; } } @@ -717,12 +741,12 @@ void func_8095BE0C(EnOwl* this, PlayState* play) { this->csIdIndex = 1; this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { - if (this->actor.isTargeted) { - func_800B8500(&this->actor, play, 200.0f, 200.0f, PLAYER_IA_NONE); + if (this->actor.isLockedOn) { + Actor_OfferTalkExchange(&this->actor, play, 200.0f, 200.0f, PLAYER_IA_NONE); } } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 200.0f, 200.0f, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 200.0f, 200.0f, PLAYER_IA_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -897,168 +921,179 @@ void EnOwl_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (this->actor.update != NULL) { - if ((this->skelAnime1.animation == &object_owl_Anim_001ADC) && Animation_OnFrame(&this->skelAnime1, 4.0f)) { - Actor_PlaySfx(&this->actor, NA_SE_EN_OWL_FLUTTER); + if (this->actor.update == NULL) { + return; + } + + if ((this->skelAnime1.animation == &object_owl_Anim_001ADC) && Animation_OnFrame(&this->skelAnime1, 4.0f)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_OWL_FLUTTER); + } + + if (this->actionFlags & 2) { + this->eyeTexIndex = 2; + } else { + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); } - - if (this->actionFlags & 2) { - this->eyeTexIndex = 2; - } else { - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); - } - this->eyeTexIndex = this->blinkTimer; - if (this->eyeTexIndex >= 3) { - this->eyeTexIndex = 0; - } + this->eyeTexIndex = this->blinkTimer; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = 0; } + } - if (!(this->actionFlags & 8)) { - sp36 = 0; + if (!(this->actionFlags & 8)) { + sp36 = 0; - if (this->actionFlags & 0x10) { - switch (this->unk_408) { - case 0: - this->unk_408 = 1; - this->unk_409 = 6; - break; + if (this->actionFlags & 0x10) { + switch (this->unk_408) { + case 0: + this->unk_408 = 1; + this->unk_409 = 6; + break; - case 1: - this->unk_409--; - if (this->unk_409 != 0) { - sp36 = Math_CosS(this->unk_409 * 0x2000) * 0x1000; + case 1: + this->unk_409--; + if (this->unk_409 != 0) { + sp36 = Math_CosS(this->unk_409 * 0x2000) * 0x1000; + } else { + if (this->actionFlags & 2) { + this->unk_3DA = 0; } else { - if (this->actionFlags & 2) { - this->unk_3DA = 0; - } else { - this->unk_3DA = 0x20; - } - - if (this->actionFlags & 0x20) { - this->unk_3DA -= 4; - } else { - this->unk_3DA += 4; - } - this->unk_408++; + this->unk_3DA = 0x20; } if (this->actionFlags & 0x20) { - sp36 = -sp36; - } - break; - - case 2: - if (func_8095C510(this)) { - this->actionFlags &= ~0x10; - this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; - this->unk_408 = 0; - func_8095AB4C(this); - } - break; - } - } else { - if (this->unk_40A > 0) { - this->unk_40A--; - } else { - if (this->unk_408 == 0) { - if (Rand_ZeroOne() < 0.3f) { - this->unk_408 = 4; - this->unk_409 = 12; + this->unk_3DA -= 4; } else { - this->unk_408 = 1; - this->unk_409 = 4; + this->unk_3DA += 4; } - } - this->unk_409--; - - switch (this->unk_408) { - case 1: - sp36 = Math_SinS((-this->unk_409 * 0x1000) + 0x4000) * 5000.0f; - if (this->unk_409 <= 0) { - this->unk_409 = (s32)(Rand_ZeroFloat(15.0f) + 5.0f); - this->unk_408 = 2; - } - break; - - case 2: - sp36 = 0x1388; - if (this->unk_409 <= 0) { - this->unk_408 = 3; - this->unk_409 = 4; - } - break; - - case 3: - sp36 = Math_SinS(this->unk_409 * 0x1000) * 5000.0f; - if (this->unk_409 <= 0) { - this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; - this->unk_408 = 0; - func_8095AB4C(this); - } - break; - - case 4: - sp36 = Math_SinS(this->unk_409 * 0x2000) * 5000.0f; - if (this->unk_409 <= 0) { - this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; - this->unk_408 = 0; - func_8095AB4C(this); - } - break; + this->unk_408++; } if (this->actionFlags & 0x20) { sp36 = -sp36; } - } + break; - if (this->unk_40D > 0) { - this->unk_40D--; - } else { - this->unk_40C--; - switch (this->unk_40B) { - case 0: - this->unk_3DE = (-this->unk_40C * 0x5DC) + 0x1770; - if (this->unk_40C <= 0) { - this->unk_40B = 1; - this->unk_40C = (s8)(Rand_ZeroFloat(15.0f) + 5.0f); - } - break; + case 2: + if (func_8095C510(this)) { + this->actionFlags &= ~0x10; + this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; + this->unk_408 = 0; + func_8095AB4C(this); + } + break; - case 1: - this->unk_3DE = 0x1770; - if (this->unk_40C <= 0) { - this->unk_40B = 2; - this->unk_40C = 4; - } - break; - - case 2: - this->unk_3DE = this->unk_40C * 0x5DC; - if (this->unk_40C <= 0) { - this->unk_40B = 0; - this->unk_40C = 4; - this->unk_40D = (s32)Rand_ZeroFloat(40.0f) + 160; - } - break; + default: + break; + } + } else { + if (this->unk_40A > 0) { + this->unk_40A--; + } else { + if (this->unk_408 == 0) { + if (Rand_ZeroOne() < 0.3f) { + this->unk_408 = 4; + this->unk_409 = 12; + } else { + this->unk_408 = 1; + this->unk_409 = 4; } } + this->unk_409--; + + switch (this->unk_408) { + case 1: + sp36 = Math_SinS((-this->unk_409 * 0x1000) + 0x4000) * 5000.0f; + if (this->unk_409 <= 0) { + this->unk_409 = (s32)(Rand_ZeroFloat(15.0f) + 5.0f); + this->unk_408 = 2; + } + break; + + case 2: + sp36 = 0x1388; + if (this->unk_409 <= 0) { + this->unk_408 = 3; + this->unk_409 = 4; + } + break; + + case 3: + sp36 = Math_SinS(this->unk_409 * 0x1000) * 5000.0f; + if (this->unk_409 <= 0) { + this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; + this->unk_408 = 0; + func_8095AB4C(this); + } + break; + + case 4: + sp36 = Math_SinS(this->unk_409 * 0x2000) * 5000.0f; + if (this->unk_409 <= 0) { + this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60; + this->unk_408 = 0; + func_8095AB4C(this); + } + break; + + default: + break; + } + + if (this->actionFlags & 0x20) { + sp36 = -sp36; + } } - if (sp36) {} - this->unk_3DC = (u16)((this->unk_3DA << 2) << 8) + sp36; - this->unk_3D8 = ABS(this->unk_3DC) >> 3; - } else { - this->unk_3DE = 0; - if (this->actionFlags & 2) { - this->unk_3DC = -0x8000; + if (this->unk_40D > 0) { + this->unk_40D--; } else { - this->unk_3DC = 0; - } + this->unk_40C--; + switch (this->unk_40B) { + case 0: + this->unk_3DE = (-this->unk_40C * 0x5DC) + 0x1770; + if (this->unk_40C <= 0) { + this->unk_40B = 1; + this->unk_40C = (s8)(Rand_ZeroFloat(15.0f) + 5.0f); + } + break; - this->unk_3D8 = ABS(this->unk_3DC) >> 3; + case 1: + this->unk_3DE = 0x1770; + if (this->unk_40C <= 0) { + this->unk_40B = 2; + this->unk_40C = 4; + } + break; + + case 2: + this->unk_3DE = this->unk_40C * 0x5DC; + if (this->unk_40C <= 0) { + this->unk_40B = 0; + this->unk_40C = 4; + this->unk_40D = (s32)Rand_ZeroFloat(40.0f) + 160; + } + break; + + default: + break; + } + } } + + if (sp36) {} + this->unk_3DC = (u16)((this->unk_3DA << 2) << 8) + sp36; + this->unk_3D8 = ABS(this->unk_3DC) >> 3; + } else { + this->unk_3DE = 0; + if (this->actionFlags & 2) { + this->unk_3DC = -0x8000; + } else { + this->unk_3DC = 0; + } + + this->unk_3D8 = ABS(this->unk_3DC) >> 3; } } @@ -1117,6 +1152,9 @@ s32 EnOwl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p rot->y += (s16)(this->unk_3D8 * 1.5f); } break; + + default: + break; } return false; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 095434fa0..3dfadc7d7 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -10,7 +10,7 @@ typedef void (*EnOwlFunc)(struct EnOwl*); #define ENOWL_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC) #define ENOWL_GET_TYPE(thisx) (((thisx)->params & 0xF80) >> 7) -#define ENOWL_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define ENOWL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) typedef enum { /* 0x001 */ ENOWL_GET_TYPE_1 = 1, 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 e47515c5d..be1c95685 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnPamera*)thisx) @@ -140,7 +140,7 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit2); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->unk_312 = 0; this->unk_310 = 0; this->unk_314 = 0; @@ -233,7 +233,7 @@ void EnPamera_Destroy(Actor* thisx, PlayState* play) { void func_80BD8700(EnPamera* this) { this->hideInisdeTimer = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80BD8758; } @@ -275,7 +275,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { void func_80BD8908(EnPamera* this) { this->actor.draw = EnPamera_Draw; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80BD8964; } @@ -585,7 +585,7 @@ void func_80BD9840(EnPamera* this, PlayState* play) { } void func_80BD9904(EnPamera* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = &func_80BD9928; } @@ -603,7 +603,7 @@ void func_80BD994C(EnPamera* this, PlayState* play) { Message_StartTextbox(play, 0x15A8, &this->actor); this->unk_324 = 0x15A8; - } else if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || + } else if ((GET_PLAYER_FORM != PLAYER_FORM_HUMAN) || (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20))) { func_80BD93CC(this, 1, 0); @@ -621,7 +621,7 @@ void func_80BD994C(EnPamera* this, PlayState* play) { } func_80BD9A9C(this); } else { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -709,7 +709,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { case 2: if (this->actor.draw == NULL) { this->actor.draw = EnPamera_Draw; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } func_80BD9EE0(this); break; 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 4c75fac65..37c234538 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -8,9 +8,10 @@ #include "z64quake.h" #include "z64rumble.h" #include "overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnPametfrog*)thisx) @@ -168,10 +169,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(targetArrowOffset, -13221, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 10, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_10, ICHAIN_STOP), }; -static s32 isFrogReturnedFlags[] = { +static s32 sIsFrogReturnedFlags[] = { WEEKEVENTREG_32_40, WEEKEVENTREG_32_80, WEEKEVENTREG_33_01, @@ -191,7 +192,7 @@ void EnPametfrog_Init(Actor* thisx, PlayState* play) { this->params = CLAMP(this->actor.params, 1, 4); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); - if (!CHECK_WEEKEVENTREG(isFrogReturnedFlags[this->actor.params - 1])) { + if (!CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->actor.params - 1])) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); } @@ -244,7 +245,7 @@ void EnPametfrog_Thaw(EnPametfrog* this, PlayState* play) { this->collider.base.colType = COLTYPE_HIT6; this->collider.elements->info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, GEKKO_BODYPART_MAX, 2, 0.3f, 0.2f); } } @@ -394,7 +395,7 @@ void EnPametfrog_ApplyMagicArrowEffects(EnPametfrog* this, PlayState* play) { this->drawDmgEffAlpha = 3.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements[0].info.bumper.hitPos.x, this->collider.elements[0].info.bumper.hitPos.y, this->collider.elements[0].info.bumper.hitPos.z, 0, - 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ICE) { EnPametfrog_Freeze(this); } @@ -424,7 +425,7 @@ void EnPametfrog_SetupRearOnSnapper(EnPametfrog* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoStandingIdleAnim); } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.params = GEKKO_ON_SNAPPER; this->actionFunc = EnPametfrog_RearOnSnapper; } @@ -501,7 +502,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, PlayState* play) { this->actor.velocity.y = 15.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.child->world.rot.y); this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->timer = 30; this->collider.base.ocFlags1 |= OC1_ON; yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -1171,7 +1172,7 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_GREET); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.colChkInfo.health = 6; this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; @@ -1299,10 +1300,11 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn( - &play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements[0].info.bumper.hitPos.x, - this->collider.elements[0].info.bumper.hitPos.y, - this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, + this->collider.elements[0].info.bumper.hitPos.x, + this->collider.elements[0].info.bumper.hitPos.y, + this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } EnPametfrog_SetupDamage(this); } @@ -1310,7 +1312,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { this->collider.base.acFlags &= ~AC_ON; EnPametfrog_ApplyMagicArrowEffects(this, play); Enemy_StartFinishingBlow(play, &this->actor); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Audio_RestorePrevBgm(); EnPametfrog_SetupCutscene(this); } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ZORA_BARRIER) { @@ -1372,34 +1374,43 @@ void EnPametfrog_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = unk2C4; this->drawDmgEffScale = unk2C4 > 0.75f ? 0.75f : this->drawDmgEffScale; } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, (3.0f / 160.0f))) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } -/* value -1: Limb Not used - * value 0: GEKKO_LIMB_WAIST - * value 1: GEKKO_LIMB_LEFT_SHIN - * value 2: GEKKO_LIMB_LEFT_FOOT - * value 3: GEKKO_LIMB_RIGHT_SHIN - * value 4: GEKKO_LIMB_RIGHT_FOOT - * value 5: GEKKO_LIMB_LEFT_UPPER_ARM - * value 6: GEKKO_LIMB_LEFT_FOREARM - * value 7: GEKKO_LIMB_LEFT_HAND - * value 8: GEKKO_LIMB_RIGHT_UPPER_ARM - * value 9: GEKKO_LIMB_RIGHT_FOREARM - * value 10: GEKKO_LIMB_RIGHT_HAND - * value 11: GEKKO_LIMB_JAW - */ -static s8 limbPosIndex[] = { - -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, 6, -1, 7, 8, 9, -1, 10, -1, 11, -1, -1, +static s8 sLimbToBodyParts[GEKKO_LIMB_MAX] = { + BODYPART_NONE, // GEKKO_LIMB_NONE + BODYPART_NONE, // GEKKO_LIMB_ROOT + GEKKO_BODYPART_WAIST, // GEKKO_LIMB_WAIST + BODYPART_NONE, // GEKKO_LIMB_LEFT_THIGH + GEKKO_BODYPART_LEFT_SHIN, // GEKKO_LIMB_LEFT_SHIN + BODYPART_NONE, // GEKKO_LIMB_LEFT_ANKLE + GEKKO_BODYPART_LEFT_FOOT, // GEKKO_LIMB_LEFT_FOOT + BODYPART_NONE, // GEKKO_LIMB_RIGHT_THIGH + GEKKO_BODYPART_RIGHT_SHIN, // GEKKO_LIMB_RIGHT_SHIN + BODYPART_NONE, // GEKKO_LIMB_RIGHT_ANKLE + GEKKO_BODYPART_RIGHT_FOOT, // GEKKO_LIMB_RIGHT_FOOT + BODYPART_NONE, // GEKKO_LIMB_TORSO + GEKKO_BODYPART_LEFT_UPPER_ARM, // GEKKO_LIMB_LEFT_UPPER_ARM + GEKKO_BODYPART_LEFT_FOREARM, // GEKKO_LIMB_LEFT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_LEFT_WRIST + GEKKO_BODYPART_LEFT_HAND, // GEKKO_LIMB_LEFT_HAND + GEKKO_BODYPART_RIGHT_UPPER_ARM, // GEKKO_LIMB_RIGHT_UPPER_ARM + GEKKO_BODYPART_RIGHT_FOREARM, // GEKKO_LIMB_RIGHT_FOREARM + BODYPART_NONE, // GEKKO_LIMB_RIGHT_WRIST + GEKKO_BODYPART_RIGHT_HAND, // GEKKO_LIMB_RIGHT_HAND + BODYPART_NONE, // GEKKO_LIMB_HEAD + GEKKO_BODYPART_JAW, // GEKKO_LIMB_JAW + BODYPART_NONE, // GEKKO_LIMB_LEFT_EYE + BODYPART_NONE, // GEKKO_LIMB_RIGHT_EYE }; void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPametfrog* this = THIS; Vec3f vec; Vec3s* center; - s8 index; + s8 bodyPartIndex; if (limbIndex == GEKKO_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); @@ -1415,9 +1426,9 @@ void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s center->z = (Math_CosS(this->actor.shape.rot.y) * 35.0f) + this->actor.focus.pos.z; } - index = limbPosIndex[limbIndex]; - if (index != -1) { - Matrix_MultZero(&this->limbPos[index]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); } } @@ -1428,6 +1439,6 @@ void EnPametfrog_Draw(Actor* thisx, PlayState* play) { Matrix_RotateYS(this->spinYaw, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnPametfrog_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, GEKKO_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 31a3be14b..ac0a0b3f5 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -21,6 +21,23 @@ typedef enum { /* 9 */ GEKKO_DEFEAT } EnPametfrogState; +typedef enum GekkoBodyPart { + /* -1 */ GEKKO_BODYPART_NONE = -1, + /* 0 */ GEKKO_BODYPART_WAIST, + /* 1 */ GEKKO_BODYPART_LEFT_SHIN, + /* 2 */ GEKKO_BODYPART_LEFT_FOOT, + /* 3 */ GEKKO_BODYPART_RIGHT_SHIN, + /* 4 */ GEKKO_BODYPART_RIGHT_FOOT, + /* 5 */ GEKKO_BODYPART_LEFT_UPPER_ARM, + /* 6 */ GEKKO_BODYPART_LEFT_FOREARM, + /* 7 */ GEKKO_BODYPART_LEFT_HAND, + /* 8 */ GEKKO_BODYPART_RIGHT_UPPER_ARM, + /* 9 */ GEKKO_BODYPART_RIGHT_FOREARM, + /* 10 */ GEKKO_BODYPART_RIGHT_HAND, + /* 11 */ GEKKO_BODYPART_JAW, + /* 12 */ GEKKO_BODYPART_MAX +} GekkoBodyPart; + typedef struct EnPametfrog { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -44,7 +61,7 @@ typedef struct EnPametfrog { /* 0x2D0 */ Vec3f unk_2D0; // MtxF xz/yz/zz /* 0x2DC */ Vec3f unk_2DC; // MtxF xy/yy/zy: wallNorm/floorNorm/Base of Gekko walking??? /* 0x2E8 */ Vec3f unk_2E8; // MtxF xx/yx/zx - /* 0x2F4 */ Vec3f limbPos[12]; + /* 0x2F4 */ Vec3f bodyPartsPos[GEKKO_BODYPART_MAX]; /* 0x384 */ ColliderJntSph collider; /* 0x3A4 */ ColliderJntSphElement colElement[2]; } EnPametfrog; // size = 0x424 diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 645b7edf5..e2557b1c3 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -6,10 +6,11 @@ #include "z_en_peehat.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/object_ph/object_ph.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnPeehat*)thisx) @@ -230,7 +231,7 @@ void EnPeehat_Destroy(Actor* thisx, PlayState* play) { void func_80897170(EnPeehat* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 1.1f; - this->drawDmgEffFrozenSteamScale = 1.6500001f; + this->drawDmgEffFrozenSteamScale = 1650.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->colliderSphere.base.colType = COLTYPE_HIT3; this->unk_2B0 = 80; @@ -242,7 +243,7 @@ void func_808971DC(EnPeehat* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderSphere.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, PEEHAT_BODYPART_MAX, 2, 0.5f, 0.35f); } } @@ -297,7 +298,7 @@ void func_80897498(EnPeehat* this) { void func_80897520(EnPeehat* this, PlayState* play) { if (!gSaveContext.save.isNight) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->colliderSphere.base.acFlags |= AC_ON; if (this->actor.xzDistToPlayer < 740.0f) { func_80897648(this); @@ -305,7 +306,7 @@ void func_80897520(EnPeehat* this, PlayState* play) { Math_StepToF(&this->actor.shape.yOffset, -1000.0f, 10.0f); } } else { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->colliderSphere.base.acFlags &= ~AC_ON; Math_StepToF(&this->actor.shape.yOffset, -1000.0f, 50.0f); if (this->unk_2B0 != 0) { @@ -390,7 +391,7 @@ void func_80897910(EnPeehat* this, PlayState* play) { Math_ScaledStepToS(&this->unk_2B2, 4000, 500); this->unk_2B4 += this->unk_2B2; Math_StepToF(&this->unk_2C4, 0.075f, 0.005f); - func_800B9010(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } void func_80897A34(EnPeehat* this) { @@ -426,7 +427,7 @@ void func_80897A94(EnPeehat* this, PlayState* play) { Math_ScaledStepToS(&this->unk_2B2, 4000, 500); this->unk_2B4 += this->unk_2B2; Math_StepToF(&this->unk_2C4, 0.075f, 0.005f); - func_800B9010(&this->actor, NA_SE_EN_PIHAT_SM_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PIHAT_SM_FLY - SFX_FLAG); if (this->colliderTris.base.atFlags & AT_BOUNCED) { this->colliderTris.base.atFlags &= ~(AT_BOUNCED | AT_ON); @@ -531,7 +532,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) { Math_ScaledStepToS(&this->unk_2B2, 4000, 500); this->unk_2B4 += this->unk_2B2; Math_StepToF(&this->unk_2C4, 0.075f, 0.005f); - func_800B9010(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } void func_80898124(EnPeehat* this) { @@ -569,7 +570,7 @@ void func_80898144(EnPeehat* this, PlayState* play) { if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { func_80897864(this); } - func_800B9010(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } void func_808982E0(EnPeehat* this) { @@ -593,7 +594,7 @@ void func_80898338(EnPeehat* this, PlayState* play) { func_80897864(this); } } - func_800B9010(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG); } void func_80898414(EnPeehat* this) { @@ -727,7 +728,7 @@ void func_8089874C(EnPeehat* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderSphere.info.bumper.hitPos.x, this->colliderSphere.info.bumper.hitPos.y, this->colliderSphere.info.bumper.hitPos.z, 0, - 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } func_800BE568(&this->actor, &this->colliderSphere); func_808984E0(this); @@ -827,7 +828,7 @@ void EnPeehat_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 1.1f); } } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 1.1f, 0.0275f)) { - func_800B9010(thisx, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -865,25 +866,50 @@ s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f return false; } +static Vec3f D_80899570[] = { + { 1300.0f, 1200.0f, 0.0f }, // PEEHAT_BODYPART_12 + { 1300.0f, -1200.0f, 0.0f }, // PEEHAT_BODYPART_13 + { 1300.0f, 0.0f, 1200.0f }, // PEEHAT_BODYPART_14 + { 1300.0f, 0.0f, -1200.0f }, // PEEHAT_BODYPART_15 +}; + +static s8 sLimbToBodyParts[OBJECT_PH_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_PH_LIMB_NONE + BODYPART_NONE, // OBJECT_PH_LIMB_01 + BODYPART_NONE, // OBJECT_PH_LIMB_02 + BODYPART_NONE, // OBJECT_PH_LIMB_03 + BODYPART_NONE, // OBJECT_PH_LIMB_04 + BODYPART_NONE, // OBJECT_PH_LIMB_05 + BODYPART_NONE, // OBJECT_PH_LIMB_06 + PEEHAT_BODYPART_0, // OBJECT_PH_LIMB_07 + BODYPART_NONE, // OBJECT_PH_LIMB_08 + BODYPART_NONE, // OBJECT_PH_LIMB_09 + PEEHAT_BODYPART_2, // OBJECT_PH_LIMB_0A + BODYPART_NONE, // OBJECT_PH_LIMB_0B + BODYPART_NONE, // OBJECT_PH_LIMB_0C + PEEHAT_BODYPART_4, // OBJECT_PH_LIMB_0D + BODYPART_NONE, // OBJECT_PH_LIMB_0E + BODYPART_NONE, // OBJECT_PH_LIMB_0F + PEEHAT_BODYPART_6, // OBJECT_PH_LIMB_10 + BODYPART_NONE, // OBJECT_PH_LIMB_11 + BODYPART_NONE, // OBJECT_PH_LIMB_12 + PEEHAT_BODYPART_8, // OBJECT_PH_LIMB_13 + BODYPART_NONE, // OBJECT_PH_LIMB_14 + BODYPART_NONE, // OBJECT_PH_LIMB_15 + PEEHAT_BODYPART_10, // OBJECT_PH_LIMB_16 + BODYPART_NONE, // OBJECT_PH_LIMB_17 +}; + void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static Vec3f D_80899570[] = { - { 1300.0f, 1200.0f, 0.0f }, - { 1300.0f, -1200.0f, 0.0f }, - { 1300.0f, 0.0f, 1200.0f }, - { 1300.0f, 0.0f, -1200.0f }, - }; - static s8 D_808995A0[] = { - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 2, -1, -1, 4, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, - }; PlayState* play = play2; EnPeehat* this = THIS; s32 i; - s32 index = D_808995A0[limbIndex]; + s32 bodyPartIndex = sLimbToBodyParts[limbIndex]; Gfx* gfx; - if (index != -1) { - Matrix_MultVecX(2000.0f, &this->limbPos[index]); - Matrix_MultVecX(4000.0f, &this->limbPos[index + 1]); + if (bodyPartIndex != BODYPART_NONE) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex]); + Matrix_MultVecX(4000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); } if (limbIndex == 4) { @@ -891,14 +917,14 @@ void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVecZ(-5500.0f, &this->unk_2D4[1]); } else if ((limbIndex == 3) && (thisx->params == 0)) { Vec3f* vec = &D_80899570[0]; - Vec3f* vec2 = &this->limbPos[12]; + Vec3f* bodyPartPosPtr = &this->bodyPartsPos[PEEHAT_BODYPART_12]; - for (i = 0; i < ARRAY_COUNT(D_80899570); i++, vec++, vec2++) { - Matrix_MultVec3f(vec, vec2); + for (i = 0; i < ARRAY_COUNT(D_80899570); i++, vec++, bodyPartPosPtr++) { + Matrix_MultVec3f(vec, bodyPartPosPtr); } - Matrix_MultVecX(3000.0f, vec2++); - Matrix_MultVecX(-400.0f, vec2); + Matrix_MultVecX(3000.0f, bodyPartPosPtr++); // PEEHAT_BODYPART_16 + Matrix_MultVecX(-400.0f, bodyPartPosPtr); // PEEHAT_BODYPART_17 OPEN_DISPS(play->state.gfxCtx); @@ -942,11 +968,11 @@ void EnPeehat_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - this->limbPos[i].y -= 50.0f; + for (i = 0; i < PEEHAT_BODYPART_MAX; i++) { + this->bodyPartsPos[i].y -= 50.0f; } } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, PEEHAT_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index 248599c63..c5ff88b65 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -7,6 +7,28 @@ struct EnPeehat; typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); +typedef enum PeehatBodyPart { + /* 0 */ PEEHAT_BODYPART_0, + /* 1 */ PEEHAT_BODYPART_1, + /* 2 */ PEEHAT_BODYPART_2, + /* 3 */ PEEHAT_BODYPART_3, + /* 4 */ PEEHAT_BODYPART_4, + /* 5 */ PEEHAT_BODYPART_5, + /* 6 */ PEEHAT_BODYPART_6, + /* 7 */ PEEHAT_BODYPART_7, + /* 8 */ PEEHAT_BODYPART_8, + /* 9 */ PEEHAT_BODYPART_9, + /* 10 */ PEEHAT_BODYPART_10, + /* 11 */ PEEHAT_BODYPART_11, + /* 12 */ PEEHAT_BODYPART_12, + /* 13 */ PEEHAT_BODYPART_13, + /* 14 */ PEEHAT_BODYPART_14, + /* 15 */ PEEHAT_BODYPART_15, + /* 16 */ PEEHAT_BODYPART_16, + /* 17 */ PEEHAT_BODYPART_17, + /* 18 */ PEEHAT_BODYPART_MAX +} PeehatBodyPart; + typedef struct EnPeehat { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,7 +50,7 @@ typedef struct EnPeehat { /* 0x2CC */ f32 drawDmgEffScale; /* 0x2D0 */ f32 drawDmgEffFrozenSteamScale; /* 0x2D4 */ Vec3f unk_2D4[2]; - /* 0x2EC */ Vec3f limbPos[18]; + /* 0x2EC */ Vec3f bodyPartsPos[PEEHAT_BODYPART_MAX]; /* 0x3C4 */ ColliderCylinder colliderCylinder; /* 0x410 */ ColliderSphere colliderSphere; /* 0x468 */ ColliderTris colliderTris; 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 072f6d6ac..ab80d3d57 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "objects/object_mm/object_mm.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnPm*)thisx) @@ -999,8 +999,9 @@ UNK_TYPE* func_80AF8540(EnPm* this, PlayState* play) { s32 func_80AF86F0(EnPm* this, PlayState* play) { s32 ret = false; - if ((this->unk_356 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_356, 0, 7); + if (((this->unk_356 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_398 = 0; this->unk_378 = 0; this->unk_37C = NULL; @@ -1075,7 +1076,7 @@ void func_80AF898C(EnPm* this) { this->unk_372 = CLAMP(this->unk_372, -0x1FFE, 0x1FFE); Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_268->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_268)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_268)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_268->focus.pos); } @@ -1264,7 +1265,7 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_36C = scheduleOutput->time1 - scheduleOutput->time0; this->unk_36E = sp56 - scheduleOutput->time0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_08)) { this->unk_356 |= 0x800; } @@ -1343,7 +1344,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { break; default: - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); func_80AF7E98(this, 0); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_08)) { this->unk_356 |= 0x800; @@ -1440,7 +1441,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Actor_PlaySfx(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_SetSwitch(play, 0); this->unk_36C = 20; - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); func_80AF7E98(this, 3); break; @@ -1470,7 +1471,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { if (scheduleOutput->result == 29) { this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y); } - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x9000; func_80AF7E98(this, 3); break; @@ -1499,8 +1500,8 @@ s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80AFB8EC); Math_Vec3s_Copy(&this->actor.world.rot, &D_80AFB8F8); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - SubS_UpdateFlags(&this->unk_356, 3, 7); - this->actor.targetMode = 6; + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -1.0f; this->unk_368 = 80.0f; if (scheduleOutput->result == 14) { @@ -1517,7 +1518,7 @@ s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) { - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; if (this->unk_258 != 0) { @@ -1535,7 +1536,7 @@ s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TEST3)) { - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; if (this->unk_258 != 0) { @@ -1553,7 +1554,7 @@ s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AL)) { - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x9000; this->unk_356 |= 0x20; if (this->unk_258 != 0) { @@ -1570,8 +1571,8 @@ s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; - this->actor.flags |= ACTOR_FLAG_1; - this->actor.targetMode = 0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + this->actor.targetMode = TARGET_MODE_0; this->unk_394 = PLAYER_IA_NONE; this->unk_356 = 0; this->unk_368 = 40.0f; @@ -1854,9 +1855,9 @@ s32 func_80AFA334(EnPm* this, PlayState* play) { case 24: temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS_ALT(temp_v0) < 0x4000) { - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->unk_356, 0, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } break; @@ -2003,11 +2004,11 @@ void func_80AFA4D0(EnPm* this, PlayState* play) { if (!Schedule_RunScript(play, D_80AFB900[this->unk_38C], &sp2C) || ((this->unk_258 != sp2C.result) && !func_80AF9BF8(this, play, &sp2C))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sp2C.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_258 = sp2C.result; @@ -2024,7 +2025,7 @@ void func_80AFA5FC(EnPm* this, PlayState* play) { Vec3f sp2C; if (func_8010BF58(&this->actor, play, this->unk_25C, this->unk_37C, &this->unk_264)) { - SubS_UpdateFlags(&this->unk_356, 3, 7); + SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 &= ~0x20; this->unk_356 |= 0x200; this->actor.child = NULL; @@ -2093,7 +2094,7 @@ void EnPm_Update(Actor* thisx, PlayState* play) { func_80AF8DD4(this, play); func_80AF7E6C(this); func_80AF8AC8(this); - func_8013C964(&this->actor, play, this->unk_368, 30.0f, this->unk_394, this->unk_356 & 7); + SubS_Offer(&this->actor, play, this->unk_368, 30.0f, this->unk_394, this->unk_356 & SUBS_OFFER_MODE_MASK); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80AF7F68(this, play); diff --git a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c index 6d14ca25a..0772249ba 100644 --- a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c +++ b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c @@ -6,7 +6,7 @@ #include "z_en_po_composer.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) #define THIS ((EnPoComposer*)thisx) 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 24517f8aa..d5174f66a 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 @@ -5,6 +5,7 @@ */ #include "z_en_po_fusen.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Ma4/z_en_ma4.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_100000 | ACTOR_FLAG_80000000) @@ -101,7 +102,7 @@ void EnPoFusen_Init(Actor* thisx, PlayState* play) { f32 flyingHeightMin; this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.007f; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.colChkInfo.damageTable = &sDamageTable; Collider_InitSphere(play, &this->collider); @@ -239,7 +240,7 @@ void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { void EnPoFusen_Pop(EnPoFusen* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, - this->actor.world.pos.z, 255, 255, 200, CLEAR_TAG_POP); + this->actor.world.pos.z, 255, 255, 200, CLEAR_TAG_PARAMS(CLEAR_TAG_POP)); Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } 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 357b08bdd..bc0a3610c 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 @@ -5,9 +5,11 @@ */ #include "z_en_po_sisters.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnPoSisters*)thisx) @@ -184,7 +186,7 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { this->fireCount = 1; this->poSisterFlags = POE_SISTERS_FLAG_UPDATE_FIRES; this->megDistToPlayer = 110.0f; - thisx->flags &= ~ACTOR_FLAG_1; + thisx->flags &= ~ACTOR_FLAG_TARGETABLE; if (POE_SISTERS_GET_OBSERVER_FLAG(&this->actor)) { // "Flagged observer": non-enemy floating prop spawned by EnGb2 (Poe Hut Proprieter) for display @@ -280,16 +282,16 @@ void EnPoSisters_MatchPlayerY(EnPoSisters* this, PlayState* play) { if ((this->color.a == 255) && (this->actionFunc != EnPoSisters_SpinAttack) && (this->actionFunc != EnPoSisters_SpinUp)) { if (this->actionFunc == EnPoSisters_Flee) { - func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } } } // check for z target void EnPoSisters_CheckZTarget(EnPoSisters* this, PlayState* play) { - if (this->actor.isTargeted && (this->color.a == 255)) { + if (this->actor.isLockedOn && (this->color.a == 255)) { DECR(this->zTargetTimer); } else { this->zTargetTimer = 20; @@ -660,7 +662,7 @@ void EnPoSisters_SetupDeathStage1(EnPoSisters* this) { this->actor.speed = 0.0f; this->actor.world.pos.y += 42.0f; this->actor.shape.yOffset = -6000.0f; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->poSisterFlags = POE_SISTERS_FLAG_CLEAR; this->actionFunc = EnPoSisters_DeathStage1; } @@ -763,7 +765,7 @@ void EnPoSisters_MegCloneVanish(EnPoSisters* this, PlayState* play) { Vec3f pos; this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->invisibleTimer = 100; // 5 seconds this->poSisterFlags = POE_SISTERS_FLAG_UPDATE_FIRES; this->collider.base.colType = COLTYPE_HIT3; @@ -810,7 +812,7 @@ void EnPoSisters_SetupMegSurroundPlayer(EnPoSisters* this) { this->megSurroundTimer = 300; // 15 seconds this->megClonesRemaining = 3; this->poSisterFlags |= (POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_CHECK_AC); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnPoSisters_MegSurroundPlayer; } @@ -888,7 +890,7 @@ void EnPoSisters_SetupSpawnPo(EnPoSisters* this) { void EnPoSisters_PoeSpawn(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->color.a = 255; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->poSisterFlags |= (POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO | POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT); if (this->type == POE_SISTERS_TYPE_MEG) { EnPoSisters_MegCloneVanish(this, play); @@ -946,7 +948,7 @@ void EnPoSisters_CheckCollision(EnPoSisters* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } EnPoSisters_SetupDamageFlinch(this); } @@ -1121,37 +1123,37 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve return false; } -#define POE_SISTERS_LIMBPOS_INVALID -1 +static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; + +static s8 sLimbToBodyParts[POE_SISTERS_LIMB_MAX] = { + BODYPART_NONE, // POE_SISTERS_LIMB_NONE + BODYPART_NONE, // POE_SISTERS_LIMB_ROOT + POE_SISTERS_BODYPART_LEFT_ARM, // POE_SISTERS_LIMB_LEFT_ARM + POE_SISTERS_BODYPART_LEFT_HAND, // POE_SISTERS_LIMB_LEFT_HAND + POE_SISTERS_BODYPART_RIGHT_UPPER_ARM, // POE_SISTERS_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // POE_SISTERS_LIMB_RIGHT_FOREARM + POE_SISTERS_BODYPART_TORCH_ROOT, // POE_SISTERS_LIMB_TORCH_ROOT + BODYPART_NONE, // POE_SISTERS_LIMB_RIGHT_HAND + BODYPART_NONE, // POE_SISTERS_LIMB_TORCH + BODYPART_NONE, // POE_SISTERS_LIMB_MAIN_BODY + BODYPART_NONE, // POE_SISTERS_LIMB_FACE + BODYPART_NONE, // POE_SISTERS_LIMB_LOWER_BODY +}; void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; - static s8 D_80B1DB08[] = { - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - 0, - 1, - 2, - POE_SISTERS_LIMBPOS_INVALID, - 3, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - POE_SISTERS_LIMBPOS_INVALID, - }; EnPoSisters* this = THIS; s32 end; f32 brightness; - if (D_80B1DB08[limbIndex] != POE_SISTERS_LIMBPOS_INVALID) { - Matrix_MultZero(&this->limbPos[D_80B1DB08[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } else if (limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { - Matrix_MultVecY(-2500.0f, &this->limbPos[4]); - Matrix_MultVecY(3000.0f, &this->limbPos[5]); + Matrix_MultVecY(-2500.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_MAIN_BODY_0]); + Matrix_MultVecY(3000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_MAIN_BODY_1]); } else if (limbIndex == POE_SISTERS_LIMB_FACE) { - Matrix_MultVecY(-4000.0f, &this->limbPos[6]); + Matrix_MultVecY(-4000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_FACE]); } else if (limbIndex == POE_SISTERS_LIMB_LOWER_BODY) { - Matrix_MultVecX(3000.0f, &this->limbPos[7]); + Matrix_MultVecX(3000.0f, &this->bodyPartsPos[POE_SISTERS_BODYPART_LOWER_BODY]); } if ((this->actionFunc == EnPoSisters_DeathStage1) && (this->deathTimer >= 8) && @@ -1227,7 +1229,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { Matrix_Put(&this->mtxf); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gPoeSistersDrawTorchDL); + gSPDisplayList(POLY_OPA_DISP++, gPoeSistersTorchDL); } gSPSegment( @@ -1264,7 +1266,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, POE_SISTERS_BODYPART_MAX, this->actor.scale.x * (1.0f / 0.007f) * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index f800788c7..510a67f36 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -19,14 +19,26 @@ typedef enum { /* 1 */ POE_SISTERS_TYPE_JO, // red /* 2 */ POE_SISTERS_TYPE_BETH, // blue /* 3 */ POE_SISTERS_TYPE_AMY // green -} EnPoSisterType; +} PoeSisterType; typedef enum { /* 0 */ POE_SISTERS_MEG_REAL, /* 1 */ POE_SISTERS_MEG_CLONE1, /* 2 */ POE_SISTERS_MEG_CLONE2, /* 3 */ POE_SISTERS_MEG_CLONE3 -} EnPoSisterMegCloneID; +} PoeSisterMegCloneId; + +typedef enum PoeSisterBodyPart { + /* 0 */ POE_SISTERS_BODYPART_LEFT_ARM, + /* 1 */ POE_SISTERS_BODYPART_LEFT_HAND, + /* 2 */ POE_SISTERS_BODYPART_RIGHT_UPPER_ARM, + /* 3 */ POE_SISTERS_BODYPART_TORCH_ROOT, + /* 4 */ POE_SISTERS_BODYPART_MAIN_BODY_0, + /* 5 */ POE_SISTERS_BODYPART_MAIN_BODY_1, + /* 6 */ POE_SISTERS_BODYPART_FACE, + /* 7 */ POE_SISTERS_BODYPART_LOWER_BODY, + /* 8 */ POE_SISTERS_BODYPART_MAX +} PoeSisterBodyPart; typedef struct EnPoSisters { /* 0x000 */ Actor actor; @@ -58,7 +70,7 @@ typedef struct EnPoSisters { /* 0x1DE */ Vec3s morphTable[POE_SISTERS_LIMB_MAX]; /* 0x226 */ Color_RGBA8 color; /* 0x22C */ Vec3f firePos[8]; - /* 0x28C */ Vec3f limbPos[8]; // passed to Actor_DrawDamageEffects + /* 0x28C */ Vec3f bodyPartsPos[POE_SISTERS_BODYPART_MAX]; /* 0x2EC */ f32 megDistToPlayer; /* 0x2F0 */ f32 drawDmgEffAlpha; /* 0x2F4 */ f32 drawDmgEffScale; 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 4669b1916..1c301a8bf 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -6,9 +6,10 @@ #include "prevent_bss_reordering.h" #include "z_en_poh.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_po/object_po.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE) #define THIS ((EnPoh*)thisx) @@ -235,7 +236,7 @@ void func_80B2CAA4(EnPoh* this, PlayState* play) { } if (this->unk_197 == 255) { - func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } } @@ -270,7 +271,7 @@ void func_80B2CBBC(EnPoh* this, PlayState* play) { } if (this->unk_197 == 255) { - func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } } @@ -309,7 +310,7 @@ void func_80B2CD64(EnPoh* this, PlayState* play) { } if (this->unk_197 == 255) { - func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); } } @@ -364,7 +365,7 @@ void func_80B2D07C(EnPoh* this, PlayState* play) { void func_80B2D0E8(EnPoh* this) { this->unk_197 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Animation_PlayOnceSetSpeed(&this->skelAnime, &object_po_Anim_0011C4, 0.0f); this->actionFunc = func_80B2D140; } @@ -373,7 +374,7 @@ void func_80B2D140(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_197 = 255; this->unk_190 = Rand_S16Offset(700, 300); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; func_80B2CB60(this); } else if (this->skelAnime.curFrame > 10.0f) { this->unk_197 = (this->skelAnime.curFrame - 10.0f) * 0.05f * 255.0f; @@ -390,7 +391,7 @@ void func_80B2D2C0(EnPoh* this) { this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_18E = 0; this->actor.hintId = TATL_HINT_ID_NONE; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80B2D300; } @@ -435,7 +436,7 @@ void func_80B2D300(EnPoh* this, PlayState* play) { } if (this->unk_18E < 18) { - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } if (this->unk_18E == 18) { @@ -561,7 +562,7 @@ void func_80B2DB44(EnPoh* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80B2CB60(this); } - func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } void func_80B2DC50(EnPoh* this, PlayState* play) { @@ -578,7 +579,7 @@ void func_80B2DC50(EnPoh* this, PlayState* play) { this->actor.world.pos.y -= 15.0f; this->actor.shape.rot.x = -0x8000; func_800BC154(play, &play->actorCtx, &this->actor, 8); - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); this->actionFunc = func_80B2DD2C; } @@ -647,7 +648,7 @@ void func_80B2E1D8(EnPoh* this) { Actor_SetFocus(&this->actor, -10.0f); this->unk_18E = 200; this->unk_18D = 32; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80B2E230; } @@ -711,7 +712,8 @@ void func_80B2E438(EnPoh* this, PlayState* play) { this->drawDmgEffScale = 0.45f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderCylinder.info.bumper.hitPos.x, this->colliderCylinder.info.bumper.hitPos.y, - this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } func_80B2CFF8(this); } @@ -727,7 +729,7 @@ void func_80B2E55C(EnPoh* this) { } if (this->unk_197 == 255) { - if (this->actor.isTargeted) { + if (this->actor.isLockedOn) { this->unk_18C++; this->unk_18C = CLAMP_MAX(this->unk_18C, 20); } else { @@ -862,16 +864,38 @@ s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p return false; } +static s8 sLimbToBodyParts[OBJECT_PO_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_PO_LIMB_NONE + BODYPART_NONE, // OBJECT_PO_LIMB_01 + BODYPART_NONE, // OBJECT_PO_LIMB_02 + BODYPART_NONE, // OBJECT_PO_LIMB_03 + ENPOH_BODYPART_4, // OBJECT_PO_LIMB_04 + ENPOH_BODYPART_5, // OBJECT_PO_LIMB_05 + BODYPART_NONE, // OBJECT_PO_LIMB_06 + BODYPART_NONE, // OBJECT_PO_LIMB_07 + BODYPART_NONE, // OBJECT_PO_LIMB_08 + ENPOH_BODYPART_0, // OBJECT_PO_LIMB_09 + ENPOH_BODYPART_1, // OBJECT_PO_LIMB_0A + BODYPART_NONE, // OBJECT_PO_LIMB_0B + BODYPART_NONE, // OBJECT_PO_LIMB_0C + BODYPART_NONE, // OBJECT_PO_LIMB_0D + BODYPART_NONE, // OBJECT_PO_LIMB_0E + BODYPART_NONE, // OBJECT_PO_LIMB_0F + ENPOH_BODYPART_2, // OBJECT_PO_LIMB_10 + BODYPART_NONE, // OBJECT_PO_LIMB_11 + BODYPART_NONE, // OBJECT_PO_LIMB_12 + ENPOH_BODYPART_3, // OBJECT_PO_LIMB_13 + BODYPART_NONE, // OBJECT_PO_LIMB_14 +}; + +static Vec3f D_80B2F734[] = { + { -600.0f, 500.0f, 1700.0f }, // ENPOH_BODYPART_7 + { -600.0f, 500.0f, -1700.0f }, // ENPOH_BODYPART_8 + { 1000.0f, 1700.0f, 0.0f }, // ENPOH_BODYPART_9 +}; + void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static s8 D_80B2F71C[] = { - -1, -1, -1, -1, 4, 5, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, 3, -1, - }; - static Vec3f D_80B2F734[] = { - { -600.0f, 500.0f, 1700.0f }, - { -600.0f, 500.0f, -1700.0f }, - { 1000.0f, 1700.0f, 0.0f }, - }; - s32 temp_s3; + s32 bodyPartIndex; Vec3f sp60; EnPoh* this = THIS; s32 pad; @@ -895,21 +919,21 @@ void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->unk_199, this->unk_19A, this->unk_19B * (200.0f / 255.0f)); } - temp_s3 = D_80B2F71C[limbIndex]; - if (temp_s3 != -1) { - if (temp_s3 < 4) { - Matrix_MultZero(&this->limbPos[temp_s3]); - } else if (temp_s3 == 4) { - Matrix_MultVecX(2000.0f, &this->limbPos[temp_s3]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex <= ENPOH_BODYPART_3) { + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); + } else if (bodyPartIndex == ENPOH_BODYPART_4) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { s32 i; - Vec3f* vec = &this->limbPos[temp_s3 + 2]; + Vec3f* vec = &this->bodyPartsPos[bodyPartIndex + 2]; Vec3f* vec2 = &D_80B2F734[0]; - Matrix_MultVecX(-2000.0f, &this->limbPos[temp_s3]); - Matrix_MultVecY(-2000.0f, &this->limbPos[temp_s3 + 1]); + Matrix_MultVecX(-2000.0f, &this->bodyPartsPos[bodyPartIndex]); // ENPOH_BODYPART_5 + Matrix_MultVecY(-2000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); // ENPOH_BODYPART_6 - for (i = temp_s3 + 2; i < ARRAY_COUNT(this->limbPos); i++, vec++, vec2++) { + for (i = bodyPartIndex + 2; i < ENPOH_BODYPART_MAX; i++, vec++, vec2++) { Matrix_MultVec3f(vec2, vec); } } @@ -957,7 +981,7 @@ void EnPoh_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(&gfx[3], object_po_DL_002D28); POLY_OPA_DISP = &gfx[4]; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENPOH_BODYPART_MAX, this->actor.scale.x * 100.0f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index b07be6195..5f7439e4a 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -7,6 +7,20 @@ struct EnPoh; typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); +typedef enum EnPohBodyPart { + /* 0 */ ENPOH_BODYPART_0, + /* 1 */ ENPOH_BODYPART_1, + /* 2 */ ENPOH_BODYPART_2, + /* 3 */ ENPOH_BODYPART_3, + /* 4 */ ENPOH_BODYPART_4, + /* 5 */ ENPOH_BODYPART_5, + /* 6 */ ENPOH_BODYPART_6, + /* 7 */ ENPOH_BODYPART_7, + /* 8 */ ENPOH_BODYPART_8, + /* 9 */ ENPOH_BODYPART_9, + /* 10 */ ENPOH_BODYPART_MAX +} EnPohBodyPart; + typedef struct EnPoh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,7 +42,7 @@ typedef struct EnPoh { /* 0x21A */ Vec3s morphTable[21]; /* 0x298 */ f32 drawDmgEffAlpha; /* 0x29C */ f32 drawDmgEffScale; - /* 0x2A0 */ Vec3f limbPos[10]; + /* 0x2A0 */ Vec3f bodyPartsPos[ENPOH_BODYPART_MAX]; /* 0x318 */ LightNode* lightNode; /* 0x31C */ LightInfo lightInfo; /* 0x32C */ ColliderCylinder colliderCylinder; 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 48c8cd5ab..1c6774b1a 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -5,9 +5,10 @@ */ #include "z_en_pp.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnPp*)thisx) @@ -234,7 +235,7 @@ void EnPp_Init(Actor* thisx, PlayState* play) { EnPp* this = THIS; EffectBlureInit1 blureInit; - this->actor.targetMode = 4; + this->actor.targetMode = TARGET_MODE_4; this->actor.colChkInfo.mass = 60; this->actor.colChkInfo.health = 3; this->actor.colChkInfo.damageTable = &sDamageTable; @@ -296,10 +297,6 @@ void EnPp_Init(Actor* thisx, PlayState* play) { 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) {} } Collider_InitQuad(play, &this->hornCollider); @@ -559,14 +556,14 @@ void EnPp_Idle(EnPp* this, PlayState* play) { EnPp_ChangeAnim(this, EN_PP_ANIM_WALK); } - if ((this->maskBounceRotationalVelocity < 0x64) && + if ((this->maskBounceAngularVelocity < 0x64) && (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f)) { Math_ApproachF(&this->actor.speed, 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); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, this->maskBounceAngularVelocity + 0x258, + 0); + Math_SmoothStepToS(&this->maskBounceAngularVelocity, 0, 1, 0x1F4, 0); } } } @@ -605,11 +602,10 @@ void EnPp_Charge(EnPp* this, PlayState* play) { this->targetPos.z += distanceFromWorldPos.z; } - Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, (this->maskBounceRotationalVelocity + 0x7D0), - 0); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, this->maskBounceAngularVelocity + 0x7D0, 0); } - Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); + Math_SmoothStepToS(&this->maskBounceAngularVelocity, 0, 1, 0x1F4, 0); if (!this->actionVar.isCharging) { Math_ApproachZeroF(&this->actor.speed, 0.5f, 1.0f); if (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f) { @@ -872,8 +868,7 @@ void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play) { 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); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -909,7 +904,7 @@ void EnPp_SetupDamaged(EnPp* this, PlayState* play) { 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); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -989,7 +984,7 @@ void EnPp_SetupDead(EnPp* this, PlayState* play) { this->targetPos.z += deadVelocity.z; } - this->maskBounceRotationalVelocity = this->actionVar.isCharging = 0; + this->maskBounceAngularVelocity = this->actionVar.isCharging = 0; EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); this->timer = 15; if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1002,7 +997,7 @@ void EnPp_SetupDead(EnPp* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_HIPLOOP_DEAD); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->action = EN_PP_ACTION_DEAD; this->actionFunc = EnPp_Dead; } @@ -1029,7 +1024,7 @@ void EnPp_Dead(EnPp* this, PlayState* play) { return; } - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, 2, 0.7f, 0.4f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1097,7 +1092,7 @@ void EnPp_Mask_SetupDetach(EnPp* this, PlayState* play) { this->actor.gravity = 0.0f; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_START; EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); SkelAnime_Update(&this->skelAnime); @@ -1169,8 +1164,8 @@ void EnPp_BodyPart_SetupMove(EnPp* this) { 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; + this->deadBodyPartAngularVelocity.x = (this->deadBodyPartIndex * 0x2E) + 0xFF00; + this->deadBodyPartAngularVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00; if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) { this->actor.speed = Rand_ZeroFloat(4.0f) + 4.0f; this->actor.world.rot.y = ((s32)Rand_CenteredFloat(223.0f) + 0x1999) * this->deadBodyPartIndex; @@ -1192,18 +1187,18 @@ void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { 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; + this->deadBodyPartCount = EN_PP_DEAD_BODYPART_MAX; + for (i = 0; i < EN_PP_DEAD_BODYPART_MAX; i++) { + Math_Vec3f_Copy(&this->deadBodyPartsPos[i], &this->deadBodyPartPos); + this->deadBodyPartsPos[i].x += Math_SinS(0xCCC * i) * 15.0f; + this->deadBodyPartsPos[i].y += -5.0f; + this->deadBodyPartsPos[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; + Math_Vec3f_Copy(&this->deadBodyPartsPos[0], &this->deadBodyPartPos); + this->deadBodyPartCount = 1; + this->actor.shape.rot.x += this->deadBodyPartAngularVelocity.x; + this->actor.shape.rot.z += this->deadBodyPartAngularVelocity.z; } if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, @@ -1324,7 +1319,7 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { (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); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, 255, COLORFILTER_BUFFLAG_OPA, 25); this->drawDmgEffTimer = 20; @@ -1352,12 +1347,12 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { (this->action == EN_PP_ACTION_ROAR))) { this->secondaryTimer = 0; this->timer = 10; - this->maskBounceRotationalVelocity = 0x20D0; + this->maskBounceAngularVelocity = 0x20D0; this->actor.speed = 0.0f; if (this->action == EN_PP_ACTION_CHARGE) { this->actionVar.isCharging = false; EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); - this->maskBounceRotationalVelocity = 0x1B58; + this->maskBounceAngularVelocity = 0x1B58; } this->targetRotY = this->actor.yawTowardsPlayer; @@ -1544,10 +1539,10 @@ void EnPp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, (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->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_PP_BODYPART_MAX) { + this->bodyPartIndex = 0; } if ((this->action == EN_PP_ACTION_SPAWN_BODY_PARTS) && (this->deadBodyPartsSpawnedCount < 6) && @@ -1578,14 +1573,14 @@ void EnPp_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPp_OverrideLimbDraw, EnPp_PostLimbDraw, &this->actor); - if (this->deadBodyPartDrawDmgEffCount != 0) { + if (this->deadBodyPartCount != 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); + Actor_DrawDamageEffects(play, &this->actor, this->deadBodyPartsPos, this->deadBodyPartCount, scale, scale, 1.0f, + ACTOR_DRAW_DMGEFF_BLUE_FIRE); } if (this->drawDmgEffTimer != 0) { @@ -1603,8 +1598,8 @@ void EnPp_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_PP_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); } if (this->floorPolyForCircleShadow != NULL) { 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 2409487be..2f975a68c 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -25,6 +25,35 @@ typedef enum { /* 26 */ EN_PP_TYPE_BODY_PART_CENTER_WING_MIDDLE = 26 } EnPpType; +typedef enum EnPpBodyPart { + /* 0 */ EN_PP_BODYPART_0, + /* 1 */ EN_PP_BODYPART_1, + /* 2 */ EN_PP_BODYPART_2, + /* 3 */ EN_PP_BODYPART_3, + /* 4 */ EN_PP_BODYPART_4, + /* 5 */ EN_PP_BODYPART_5, + /* 6 */ EN_PP_BODYPART_6, + /* 7 */ EN_PP_BODYPART_7, + /* 8 */ EN_PP_BODYPART_8, + /* 9 */ EN_PP_BODYPART_9, + /* 10 */ EN_PP_BODYPART_10, + /* 11 */ EN_PP_BODYPART_MAX +} EnPpBodyPart; + +typedef enum EnPpDeadBodyPart { + /* 0 */ EN_PP_DEAD_BODYPART_0, + /* 1 */ EN_PP_DEAD_BODYPART_1, + /* 2 */ EN_PP_DEAD_BODYPART_2, + /* 3 */ EN_PP_DEAD_BODYPART_3, + /* 4 */ EN_PP_DEAD_BODYPART_4, + /* 5 */ EN_PP_DEAD_BODYPART_5, + /* 6 */ EN_PP_DEAD_BODYPART_6, + /* 7 */ EN_PP_DEAD_BODYPART_7, + /* 8 */ EN_PP_DEAD_BODYPART_8, + /* 9 */ EN_PP_DEAD_BODYPART_9, + /* 10 */ EN_PP_DEAD_BODYPART_MAX +} EnPpDeadBodyPart; + typedef struct EnPp { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -44,7 +73,7 @@ typedef struct EnPp { 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. + /* 0x2D4 */ s16 maskBounceAngularVelocity; // 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; @@ -57,17 +86,17 @@ typedef struct EnPp { /* 0x34C */ Vec3f maskVelocity; /* 0x358 */ Vec3f targetPos; /* 0x364 */ Vec3f deadBodyPartPos; - /* 0x370 */ s32 deadBodyPartDrawDmgEffCount; - /* 0x374 */ Vec3f deadBodyPartDrawDmgEffPos[10]; - /* 0x3EC */ Vec3s deadBodyPartRotationalVelocity; + /* 0x370 */ s32 deadBodyPartCount; + /* 0x374 */ Vec3f deadBodyPartsPos[EN_PP_DEAD_BODYPART_MAX]; + /* 0x3EC */ Vec3s deadBodyPartAngularVelocity; /* 0x3F2 */ s16 drawDmgEffTimer; /* 0x3F4 */ s16 drawDmgEffType; /* 0x3F8 */ f32 drawDmgEffScale; /* 0x3FC */ f32 drawDmgEffFrozenSteamScale; /* 0x400 */ f32 attackRange; /* 0x404 */ s32 hasBeenDamaged; - /* 0x408 */ Vec3f bodyPartsPos[11]; - /* 0x48C */ s16 bodyPartsPosIndex; + /* 0x408 */ Vec3f bodyPartsPos[EN_PP_BODYPART_MAX]; + /* 0x48C */ s16 bodyPartIndex; /* 0x490 */ f32 maskAccelY; /* 0x494 */ ColliderJntSph maskCollider; /* 0x4B4 */ ColliderJntSphElement maskColliderElements[1]; diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 98762c907..74efc10ca 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -5,10 +5,11 @@ */ #include "z_en_pr.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Prz/z_en_prz.h" #include "objects/object_pr/object_pr.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnPr*)thisx) @@ -66,7 +67,13 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -f32 D_80A338C0[PLAYER_FORM_MAX] = { 30.0f, 30.0f, 30.0f, 15.0f, 15.0f }; +f32 D_80A338C0[PLAYER_FORM_MAX] = { + 30.0f, // PLAYER_FORM_FIERCE_DEITY + 30.0f, // PLAYER_FORM_GORON + 30.0f, // PLAYER_FORM_ZORA + 15.0f, // PLAYER_FORM_DEKU + 15.0f, // PLAYER_FORM_HUMAN +}; ActorInit En_Pr_InitVars = { ACTOR_EN_PR, @@ -127,7 +134,7 @@ void EnPr_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->unk_2B8 = this->actor.world.pos.y; this->actor.shape.yOffset = 1500.0f; this->actor.colChkInfo.damageTable = &sDamageTable; @@ -460,7 +467,7 @@ void func_80A33098(EnPr* this, PlayState* play) { this->drawDmgEffAlpha = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, - this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } if ((player->stateFlags1 & PLAYER_STATE1_8000000) && (this->actor.colChkInfo.damageEffect == 5)) { @@ -582,10 +589,10 @@ void EnPr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if ((limbIndex == 0) || (limbIndex == 1) || (limbIndex == 2) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9)) { - Matrix_MultZero(&this->limbPos[this->unk_228]); - this->unk_228++; - if (this->unk_228 >= ARRAY_COUNT(this->limbPos)) { - this->unk_228 = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; + if (this->bodyPartsCount >= ENPR_BODYPART_MAX) { + this->bodyPartsCount = 0; } } } @@ -620,8 +627,8 @@ void EnPr_Draw(Actor* thisx, PlayState* play) { this->unk_238 = 0.8f; this->unk_234 = 0.8f; - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, - drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENPR_BODYPART_MAX, 0.8f, 0.8f, drawDmgEffAlpha, + this->drawDmgEffType); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.h b/src/overlays/actors/ovl_En_Pr/z_en_pr.h index dfa3081ca..58d1e8be2 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.h +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.h @@ -12,6 +12,20 @@ typedef void (*EnPrActionFunc)(struct EnPr*, PlayState*); #define ENPR_FF00_MAX 20 #define ENPR_FF00_MIN 0 +typedef enum EnPrBodyPart { + /* 0 */ ENPR_BODYPART_0, + /* 1 */ ENPR_BODYPART_1, + /* 2 */ ENPR_BODYPART_2, + /* 3 */ ENPR_BODYPART_3, + /* 4 */ ENPR_BODYPART_4, + /* 5 */ ENPR_BODYPART_5, + /* 6 */ ENPR_BODYPART_6, + /* 7 */ ENPR_BODYPART_7, + /* 8 */ ENPR_BODYPART_8, + /* 9 */ ENPR_BODYPART_9, + /* 10 */ ENPR_BODYPART_MAX +} EnPrBodyPart; + typedef struct EnPr { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -31,13 +45,13 @@ typedef struct EnPr { /* 0x218 */ UNK_TYPE1 unk218[4]; /* 0x21C */ s32 unk_21C; /* 0x220 */ UNK_TYPE1 unk220[0x8]; - /* 0x228 */ s32 unk_228; + /* 0x228 */ s32 bodyPartsCount; /* 0x22C */ s16 unk_22C; /* 0x22E */ s16 drawDmgEffAlpha; /* 0x230 */ s16 drawDmgEffType; /* 0x234 */ f32 unk_234; /* 0x238 */ f32 unk_238; - /* 0x23C */ Vec3f limbPos[10]; + /* 0x23C */ Vec3f bodyPartsPos[ENPR_BODYPART_MAX]; /* 0x2B4 */ f32 unk_2B4; /* 0x2B8 */ f32 unk_2B8; /* 0x2BC */ f32 unk_2BC; diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index a4dd96d4b..5ebdcd43f 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -8,7 +8,7 @@ #include "objects/object_pr/object_pr.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnPr2*)thisx) @@ -108,14 +108,14 @@ s16 D_80A75C3C[] = { void EnPr2_Init(Actor* thisx, PlayState* play) { EnPr2* this = THIS; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->actor.hintId = TATL_HINT_ID_SKULLFISH; this->unk_1EC = 255; this->actor.colChkInfo.health = 1; this->actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, - this->morphtable, 5); + this->morphTable, 5); this->unk_1E0 = ENPR2_GET_F(&this->actor); this->actor.colChkInfo.mass = 10; Math_Vec3f_Copy(&this->unk_228, &this->actor.home.pos); @@ -518,7 +518,7 @@ void func_80A74E90(EnPr2* this, PlayState* play) { void func_80A751B4(EnPr2* this) { this->unk_1EC = 0; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->unk_1E0 < 10) { func_80A74510(this, 2); } else { diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h index 94fb7e033..7d462b639 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h @@ -17,7 +17,7 @@ typedef struct EnPr2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[5]; - /* 0x1A6 */ Vec3s morphtable[5]; + /* 0x1A6 */ Vec3s morphTable[5]; /* 0x1C4 */ EnPr2ActionFunc actionFunc; /* 0x1C8 */ s16 pathIndex; /* 0x1CC */ Path* path; diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index ef37cf9f0..f314ebef0 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -8,7 +8,7 @@ #include "objects/object_pr/object_pr.h" #include "overlays/actors/ovl_En_Pr/z_en_pr.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnPrz*)thisx) @@ -60,7 +60,13 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -f32 D_80A771E0[] = { 40.0f, 40.0f, 40.0f, 30.0f, 30.0f }; +f32 D_80A771E0[PLAYER_FORM_MAX] = { + 40.0f, // PLAYER_FORM_FIERCE_DEITY + 40.0f, // PLAYER_FORM_GORON + 40.0f, // PLAYER_FORM_ZORA + 30.0f, // PLAYER_FORM_DEKU + 30.0f, // PLAYER_FORM_HUMAN +}; static ColliderCylinderInit sCylinderInit = { { @@ -108,7 +114,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->unk_1E8 = 255; this->actor.hintId = TATL_HINT_ID_SKULLFISH; this->actor.colChkInfo.damageTable = &sDamageTable; @@ -120,7 +126,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { this->unk_1E6 = ENPRZ_GET(&this->actor); this->actor.shape.yOffset = 500.0f; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Math_Vec3f_Copy(&this->unk_1D8, &this->actor.world.pos); @@ -361,7 +367,7 @@ void func_80A767A8(EnPrz* this, PlayState* play) { void func_80A76A1C(EnPrz* this) { this->unk_1E8 = 0; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); 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 7a507e0ef..c3a7d9a78 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -6,7 +6,7 @@ #include "z_en_pst.h" -#define FLAGS (ACTOR_FLAG_1) +#define FLAGS (ACTOR_FLAG_TARGETABLE) #define THIS ((EnPst*)thisx) @@ -208,7 +208,7 @@ s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) { itemAction = func_80123810(play); scriptBranch = 0; if ((itemAction == PLAYER_IA_LETTER_TO_KAFEI) || (itemAction == PLAYER_IA_LETTER_MAMA)) { - this->exchangeItemId = itemAction; + this->exchangeItemAction = itemAction; this->behaviour++; scriptBranch = 1; } else if (itemAction <= PLAYER_IA_MINUS1) { @@ -223,7 +223,7 @@ s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) { } break; case POSTBOX_BEHAVIOUR_TAKE_ITEM: - if (this->exchangeItemId == PLAYER_IA_LETTER_TO_KAFEI) { + if (this->exchangeItemAction == PLAYER_IA_LETTER_TO_KAFEI) { scriptBranch = 1; } break; @@ -252,7 +252,7 @@ s32* EnPst_GetMsgEventScript(EnPst* this, PlayState* play) { return NULL; } } else if (this->stateFlags & 0x20) { - if (this->exchangeItemId == PLAYER_IA_LETTER_MAMA) { + if (this->exchangeItemAction == PLAYER_IA_LETTER_MAMA) { return D_80B2C488; } else { return D_80B2C490; @@ -280,32 +280,31 @@ s32 EnPst_CheckTalk(EnPst* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 ret = false; - if (this->stateFlags & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->stateFlags &= ~0x30; - if (player->exchangeItemId == PLAYER_IA_LETTER_TO_KAFEI) { - this->stateFlags |= 0x10; - this->exchangeItemId = player->exchangeItemId; - } else if (player->exchangeItemId != PLAYER_IA_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; + if (((this->stateFlags & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->stateFlags &= ~0x30; + if (player->exchangeItemAction == PLAYER_IA_LETTER_TO_KAFEI) { + this->stateFlags |= 0x10; + this->exchangeItemAction = player->exchangeItemAction; + } else if (player->exchangeItemAction != PLAYER_IA_NONE) { + this->stateFlags |= 0x20; + this->exchangeItemAction = player->exchangeItemAction; } + // If Letter to Kafei is deposited, value is set to 2 + this->isLetterToKafeiDeposited = EnPst_HandleLetterDay1(this); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->behaviour = 0; + this->msgEventCallback = NULL; + this->stateFlags |= 0x40; + this->msgEventScript = EnPst_GetMsgEventScript(this, play); + this->actionFunc = EnPst_Talk; + ret = true; } return ret; } -s32 EnPst_UpdateFlagsSubs(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { - SubS_UpdateFlags(&this->stateFlags, 3, 7); +s32 EnPst_SetOfferItemModeOnScreen(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); return true; } @@ -316,8 +315,9 @@ s32 EnPst_ProcessScheduleOutput(EnPst* this, PlayState* play, ScheduleOutput* sc switch (scheduleOutput->result) { case POSTBOX_SCH_AVAILABLE: - ret = EnPst_UpdateFlagsSubs(this, play, scheduleOutput); + ret = EnPst_SetOfferItemModeOnScreen(this, play, scheduleOutput); break; + case POSTBOX_SCH_CHECKED_BY_POSTMAN: ret = true; break; @@ -342,11 +342,11 @@ void EnPst_FollowSchedule(EnPst* this, PlayState* play) { ((this->scheduleResult != scheduleOutput.result) && !EnPst_ProcessScheduleOutput(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = POSTBOX_SCH_NONE; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->scheduleResult = scheduleOutput.result; EnPst_HandleSchedule(this, play); @@ -373,7 +373,7 @@ void EnPst_Talk(EnPst* this, PlayState* play) { break; } } - SubS_UpdateFlags(&this->stateFlags, 3, 7); + SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->msgEventArg4 = 0; this->actionFunc = EnPst_FollowSchedule; } @@ -388,9 +388,9 @@ void EnPst_Init(Actor* thisx, PlayState* play) { 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_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = EnPst_FollowSchedule; Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); @@ -410,7 +410,7 @@ void EnPst_Update(Actor* thisx, PlayState* 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); + SubS_Offer(&this->actor, play, 60.0f, 20.0f, PLAYER_IA_NONE, this->stateFlags & SUBS_OFFER_MODE_MASK); } Actor_SetFocus(&this->actor, 20.0f); EnPst_UpdateCollision(this, play); 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 c3ebd58a8..9a47181e8 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.h +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.h @@ -32,7 +32,7 @@ typedef struct EnPst { /* 0x20E */ s16 behaviour; /* 0x210 */ MsgEventFunc msgEventCallback; /* 0x214 */ s32 unk214; // Set and not used - /* 0x218 */ s32 exchangeItemId; + /* 0x218 */ s32 exchangeItemAction; /* 0x21C */ s32 isLetterToKafeiDeposited; } EnPst; // size = 0x220 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 d4e83a388..a1df0f8ad 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -374,7 +374,7 @@ void EnRacedog_RaceStart(EnRacedog* this, PlayState* play) { if (DECR(this->raceStartTimer) == 0) { this->raceStartTimer = Rand_S16Offset(50, 50); if (this->extraTimeBeforeRaceStart == 0) { - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); } EnRacedog_ChangeAnim(&this->skelAnime, sAnimationInfo, RACEDOG_ANIM_RUN); @@ -580,7 +580,7 @@ void EnRacedog_CheckForFinish(EnRacedog* this) { sNumberOfDogsFinished++; if (sNumberOfDogsFinished == 1) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); - play_sound(NA_SE_SY_START_SHOT); + Audio_PlaySfx(NA_SE_SY_START_SHOT); } this->raceStatus = RACEDOG_RACE_STATUS_FINISHED; @@ -628,13 +628,28 @@ s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* finishLineCoordinates) { // frontPointsCrossProduct is positive if the dog is to the left of the line formed by the front points // crossProductTemp is positive if the dog is above the line formed by the bottom points + // This is checking that the dog within the region defined by front and bottom lines like so: + // | + // X | Front + // | + // -------- + // Bottom frontPointsCrossProduct = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); crossProductTemp = (((xDistToBottomFront * zDistToBottomBack) - (xDistToBottomBack * zDistToBottomFront))); + //! @bug If any dog is precisely (with floating-point precision) on top of the line formed by the front points, + //! then frontPointsCrossProduct will be zero. This will cause this multiplication (and all future multiplications) + //! to be zero, which will make this function think the dog has crossed the finish line. The line formed by the + //! front points extends throughout the entire racetrack, so a dog can trigger this when they're not even close to + //! the actual finish line, causing them to finish the race incredibly early. if (frontPointsCrossProduct * crossProductTemp < 0.0f) { return false; } // crossProductTemp is positive if the dog is to the right of the line formed by the back points + // This is checking that the dog within the region defined by front and back lines like so: + // | | + // Back | X | Front + // | | frontPointsCrossProduct = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); crossProductTemp = ((xDistToBottomBack * zDistToTopBack) - (xDistToTopBack * zDistToBottomBack)); if (frontPointsCrossProduct * crossProductTemp < 0.0f) { @@ -642,6 +657,12 @@ s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* finishLineCoordinates) { } // crossProductTemp is positive if the dog is below the line formed by the top points + // This is checking that the dog within the region defined by front and top lines like so: + // Top + // -------- + // | + // X | Front + // | frontPointsCrossProduct = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); crossProductTemp = ((xDistToTopBack * zDistToTopFront) - (xDistToTopFront * zDistToTopBack)); if (frontPointsCrossProduct * crossProductTemp < 0.0f) { diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index 1a4024f51..1c6a669a2 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -5,6 +5,7 @@ */ #include "z_en_raf.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #define FLAGS (ACTOR_FLAG_CANT_LOCK_ON) @@ -209,7 +210,7 @@ void EnRaf_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gCarnivorousLilyPadCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); - this->dyna.actor.targetMode = 3; + this->dyna.actor.targetMode = TARGET_MODE_3; this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; SkelAnime_InitFlex(play, &this->skelAnime, &gCarnivorousLilyPadSkel, &gCarnivorousLilyPadSpitAnim, this->jointTable, this->morphTable, CARNIVOROUS_LILY_PAD_LIMB_MAX); @@ -318,7 +319,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { if (player->transformation == PLAYER_FORM_GORON) { this->grabTarget = EN_RAF_GRAB_TARGET_GORON_PLAYER; } else { - player->unk_AE8 = 50; + player->actionVar2 = 50; } this->playerRotYWhenGrabbed = player->actor.world.rot.y; @@ -454,7 +455,7 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { case EN_RAF_GRAB_TARGET_GORON_PLAYER: if (this->chewCount > (BREG(54) + 4)) { player->actor.parent = NULL; - player->unk_AE8 = 1000; + player->actionVar2 = 1000; EnRaf_Explode(this, play); } break; @@ -511,7 +512,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { Math_Vec3f_Copy(&explosionPos, &this->dyna.actor.world.pos); explosionPos.y += 10.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, 0, 0, - CLEAR_TAG_SMALL_EXPLOSION); + CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_EXPLOSION)); Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_DEAD); if (this->switchFlag >= 0) { @@ -537,7 +538,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { this->timer = 5; if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { func_800BC154(play, &play->actorCtx, &this->dyna.actor, 5); - this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); } this->actionFunc = EnRaf_PostDetonation; @@ -551,7 +552,7 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) { this->collider.dim.radius = 50; this->collider.dim.height = 10; func_800BC154(play, &play->actorCtx, &this->dyna.actor, 6); - this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->dyna.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); EnRaf_SetupDormant(this); } else if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { this->collider.dim.radius = 80; @@ -895,9 +896,9 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc effect->accel = *accel; effect->scale = scale; effect->timer = timer; - effect->rotation.x = Rand_CenteredFloat(30000.0f); - effect->rotation.y = Rand_CenteredFloat(30000.0f); - effect->rotation.z = Rand_CenteredFloat(30000.0f); + effect->rot.x = Rand_CenteredFloat(30000.0f); + effect->rot.y = Rand_CenteredFloat(30000.0f); + effect->rot.z = Rand_CenteredFloat(30000.0f); return; } } @@ -912,9 +913,9 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { effect->pos.x += effect->velocity.x; effect->pos.y += effect->velocity.y; effect->pos.z += effect->velocity.z; - effect->rotation.x += 0xBB8; - effect->rotation.y += 0xBB8; - effect->rotation.z += 0xBB8; + effect->rot.x += 0xBB8; + effect->rot.y += 0xBB8; + effect->rot.z += 0xBB8; effect->velocity.x += effect->accel.x; effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; @@ -953,9 +954,9 @@ void EnRaf_DrawEffects(EnRaf* this, PlayState* play) { if (effect->isEnabled) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_RotateXS(effect->rotation.x, MTXMODE_APPLY); - Matrix_RotateYS(effect->rotation.y, MTXMODE_APPLY); - Matrix_RotateZS(effect->rotation.z, MTXMODE_APPLY); + Matrix_RotateXS(effect->rot.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->rot.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCarnivorousLilyPadParticleDL); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.h b/src/overlays/actors/ovl_En_Raf/z_en_raf.h index f4659f48b..a025046ab 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.h +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.h @@ -23,7 +23,7 @@ typedef struct { /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; /* 0x1C */ Vec3f accel; - /* 0x28 */ Vec3s rotation; + /* 0x28 */ Vec3s rot; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; } EnRafEffect; // size = 0x38 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 a280e9bfa..226aec92b 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 @@ -8,7 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/object_skb/object_skb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) #define THIS ((EnRailSkb*)thisx) @@ -63,19 +63,19 @@ ActorInit En_Rail_Skb_InitVars = { }; 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 }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, + { &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, }; static ColliderJntSphElementInit sJntSphElementsInit[2] = { @@ -247,7 +247,7 @@ void func_80B70D24(EnRailSkb* this, PlayState* play) { while (actor != NULL) { if ((actor->id == ACTOR_OBJ_HAKAISI) && func_80B70B04(this, actor->world.pos)) { - if (Flags_GetSwitch(play, (actor->params & 0xFF00) >> 8)) { + if (Flags_GetSwitch(play, OBJHAKAISI_GET_SWITCH_FLAG(actor))) { Actor_Kill(&this->actor); return; } @@ -270,13 +270,13 @@ void EnRailSkb_Init(Actor* thisx, PlayState* play) { func_80B708C0(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_0064E0, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildWalkAnim, this->jointTable, this->morphTable, + STALCHILD_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (Flags_GetSwitch(play, ENRAILSKB_GET_FF(&this->actor))) { + if (Flags_GetSwitch(play, ENRAILSKB_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); } @@ -428,7 +428,7 @@ void func_80B713A4(EnRailSkb* this, PlayState* play) { void func_80B71488(EnRailSkb* this) { this->unk_402 |= 0x40; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->unk_2E0 != 0) { this->unk_2E4 = this->unk_2E0 - 1; } else { @@ -451,7 +451,7 @@ void func_80B7151C(EnRailSkb* this) { this->actor.shape.yOffset = -5000.0f; this->actor.colChkInfo.health = 2; this->unk_402 = 0; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); this->actor.draw = EnRailSkb_Draw; this->actor.shape.shadowAlpha = 0; @@ -499,7 +499,7 @@ void func_80B716A8(EnRailSkb* this, PlayState* play) { 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); + Actor_OfferTalk(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x71C, 0xB6); } @@ -666,7 +666,7 @@ void func_80B71DF0(EnRailSkb* this) { this->actor.shape.yOffset = -5000.0f; this->actor.colChkInfo.health = 2; this->unk_402 = 0; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnRailSkb_Draw; this->actor.shape.shadowAlpha = 0; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -754,11 +754,11 @@ void func_80B71F3C(EnRailSkb* this, PlayState* play) { void func_80B72100(EnRailSkb* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x13F1, &this->actor); this->unk_400 = 0x13F1; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_StartTextbox(play, 0x13F3, &this->actor); this->unk_400 = 0x13F3; } @@ -822,8 +822,8 @@ void func_80B72190(EnRailSkb* this, PlayState* play) { } void func_80B723F8(EnRailSkb* this) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.flags |= ACTOR_FLAG_100000; this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; @@ -878,25 +878,25 @@ void func_80B726B4(EnRailSkb* this, PlayState* play) { static Vec3f D_80B734B8 = { 0.0f, -1.0f, 0.0f }; Vec3f sp84; s32 i; - s32 end; + s32 bodyPartsCount; s16 yaw; if (this->unk_402 & 2) { - end = ARRAY_COUNT(this->limbPos) - 1; + bodyPartsCount = ENRAILSKB_BODYPART_MAX - 1; } else { - end = ARRAY_COUNT(this->limbPos); + bodyPartsCount = ENRAILSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < end; i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(yaw) * 3.0f; sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); } } @@ -923,17 +923,17 @@ void func_80B72880(EnRailSkb* this, PlayState* play) { if ((this->actionFunc == func_80B70FF8) || (this->actionFunc == func_80B716A8)) { if (this->actionFunc != func_80B716A8) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.flags |= ACTOR_FLAG_100000; this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; func_80B71650(this); } } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.flags &= ~ACTOR_FLAG_100000; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); this->actor.hintId = TATL_HINT_ID_STALCHILD; this->actor.textId = 0; func_80B70FA0(this); @@ -1129,11 +1129,11 @@ void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } else if ((limbIndex == 11) && !(this->unk_402 & 2)) { - Matrix_MultVec3f(&D_80B734D0, &this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultVec3f(&D_80B734D0, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -1142,13 +1142,13 @@ void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnRailSkb_Draw(Actor* thisx, PlayState* play) { EnRailSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnRailSkb_OverrideLimbDraw, EnRailSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if ((this->unk_402 & 0x40) && !(this->unk_402 & 0x80)) { diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h index 10c2653c4..8feff7d5d 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h @@ -10,7 +10,25 @@ typedef void (*EnRailSkbActionFunc)(struct EnRailSkb*, PlayState*); typedef void (*EnRailSkbUnkFunc)(struct EnRailSkb*); #define ENRAILSKB_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) -#define ENRAILSKB_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENRAILSKB_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0xFF) + +typedef enum EnRailSkbBodyPart { + /* 0 */ ENRAILSKB_BODYPART_0, + /* 1 */ ENRAILSKB_BODYPART_1, + /* 2 */ ENRAILSKB_BODYPART_2, + /* 3 */ ENRAILSKB_BODYPART_3, + /* 4 */ ENRAILSKB_BODYPART_4, + /* 5 */ ENRAILSKB_BODYPART_5, + /* 6 */ ENRAILSKB_BODYPART_6, + /* 7 */ ENRAILSKB_BODYPART_7, + /* 8 */ ENRAILSKB_BODYPART_8, + /* 9 */ ENRAILSKB_BODYPART_9, + /* 10 */ ENRAILSKB_BODYPART_10, + /* 11 */ ENRAILSKB_BODYPART_11, + /* 12 */ ENRAILSKB_BODYPART_12, + /* 13 */ ENRAILSKB_BODYPART_13, + /* 14 */ ENRAILSKB_BODYPART_MAX +} EnRailSkbBodyPart; typedef struct EnRailSkb { /* 0x000 */ Actor actor; @@ -20,8 +38,8 @@ typedef struct EnRailSkb { /* 0x228 */ EnRailSkbActionFunc actionFunc; /* 0x22C */ ObjHakaisi* unk_22C; /* 0x230 */ Vec3s* unk_230; - /* 0x234 */ Vec3f limbPos[14]; - /* 0x2DC */ s32 limbCount; + /* 0x234 */ Vec3f bodyPartsPos[ENRAILSKB_BODYPART_MAX]; + /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ s32 unk_2E0; /* 0x2E4 */ s32 unk_2E4; /* 0x2E8 */ s32 unk_2E8; 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 9a0e1864e..9aa218e2f 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -8,7 +8,7 @@ #include "z64rumble.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((EnRailgibud*)thisx) @@ -246,7 +246,7 @@ void EnRailgibud_Init(Actor* thisx, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.hintId = TATL_HINT_ID_GIBDO; this->actor.textId = 0; if (ENRAILGIBUD_IS_CUTSCENE_TYPE(&this->actor)) { @@ -382,8 +382,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { if (EnRailgibud_PlayerInRangeWithCorrectState(this, play) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; - if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) || - (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_GORON) || (GET_PLAYER_FORM == PLAYER_FORM_DEKU)) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnRailgibud_SetupGrabFail(this); @@ -421,16 +420,15 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupGrab(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_START); this->grabDamageTimer = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->grabState = EN_RAILGIBUD_GRAB_START; this->actionFunc = EnRailgibud_Grab; } void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { - Player* player2 = GET_PLAYER(play); - Player* player = player2; + Actor* playerActor = &GET_PLAYER(play)->actor; + Player* player = (Player*)playerActor; s32 inPositionToAttack; - u16 damageSfxId; switch (this->grabState) { case EN_RAILGIBUD_GRAB_START: @@ -440,7 +438,7 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_ATTACK); } else if (!(player->stateFlags2 & PLAYER_STATE2_80)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_END); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->grabState = EN_RAILGIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; } @@ -448,9 +446,8 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { case EN_RAILGIBUD_GRAB_ATTACK: if (this->grabDamageTimer == 20) { - s16 requiredScopeTemp; + u16 damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; - damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; play->damagePlayer(play, -8); Player_PlaySfx(player, damageSfxId); Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); @@ -466,11 +463,11 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { if (!(player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B62 != 0)) { if ((player->unk_B62 != 0) && (player->stateFlags2 & PLAYER_STATE2_80)) { player->stateFlags2 &= ~PLAYER_STATE2_80; - player->unk_AE8 = 100; + player->actionVar2 = 100; } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_END); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->grabState = EN_RAILGIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; } @@ -555,7 +552,7 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { this->actor.world.rot = this->actor.shape.rot; } if (EnRailgibud_PlayerInRangeWithCorrectState(this, play)) { - if ((gSaveContext.save.playerForm != PLAYER_FORM_GORON) && (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) && + if ((GET_PLAYER_FORM != PLAYER_FORM_GORON) && (GET_PLAYER_FORM != PLAYER_FORM_DEKU) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnRailgibud_SetupWalkToPlayer(this); } @@ -621,7 +618,7 @@ void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupDead(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DEATH); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; this->actionFunc = EnRailgibud_Dead; @@ -638,7 +635,7 @@ void EnRailgibud_Dead(EnRailgibud* this, PlayState* play) { // stop drawing it, and make its Update function only check to see if // the Gibdos should move forward. this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.update = EnRailgibud_MainGibdo_DeadUpdate; } } else { @@ -869,7 +866,7 @@ s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, PlayState* distanceFromTargetPos = Math_Vec3f_StepTo(&this->actor.world.pos, &targetPos, 10.0f); distanceFromTargetAngle = Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { distanceFromTargetYOffset = Math_SmoothStepToF(&this->actor.shape.yOffset, -1500.0f, 1.0f, 150.0f, 0.0f); } @@ -934,10 +931,10 @@ void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, PlayState* play) { if ((this->actionFunc != EnRailgibud_Grab) && (this->actionFunc != EnRailgibud_Damage) && (this->actionFunc != EnRailgibud_GrabFail) && (this->actionFunc != EnRailgibud_TurnAwayAndShakeHead) && (this->actionFunc != EnRailgibud_Dead)) { - if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_1 | ACTOR_FLAG_4))) { + if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY))) { if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { - this->actor.flags &= ~(ACTOR_FLAG_4 | ACTOR_FLAG_1); - this->actor.flags |= (ACTOR_FLAG_8 | ACTOR_FLAG_1); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_TARGETABLE); this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; if ((this->actionFunc != EnRailgibud_WalkInCircles) && (this->actionFunc != EnRailgibud_WalkToHome)) { @@ -945,8 +942,8 @@ void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, PlayState* play) { } } } else if (Player_GetMask(play) != PLAYER_MASK_GIBDO) { - this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); - this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); + this->actor.flags &= ~(ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_TARGETABLE); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); if (this->type == EN_RAILGIBUD_TYPE_REDEAD) { this->actor.hintId = TATL_HINT_ID_REDEAD; } else { @@ -967,9 +964,9 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { this->textId = 0x13B2; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); this->actor.speed = 0.0f; - } else if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_1 | ACTOR_FLAG_8)) && + } else if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } else { switch (Message_GetState(&play->msgCtx)) { @@ -1064,8 +1061,8 @@ void EnRailgibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s (limbIndex == GIBDO_LIMB_LEFT_FOREARM) || (limbIndex == GIBDO_LIMB_LEFT_HAND) || (limbIndex == GIBDO_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == GIBDO_LIMB_RIGHT_FOREARM) || (limbIndex == GIBDO_LIMB_RIGHT_HAND) || (limbIndex == GIBDO_LIMB_HEAD) || (limbIndex == GIBDO_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1074,7 +1071,7 @@ void EnRailgibud_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->actor.shape.shadowAlpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1096,7 +1093,7 @@ void EnRailgibud_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENRAILGIBUD_BODYPART_MAX, this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } @@ -1185,37 +1182,40 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { this->cueId = play->csCtx.actorCues[cueChannel]->id; switch (play->csCtx.actorCues[cueChannel]->id) { case 1: - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_IDLE; + this->csAnimIndex = EN_RAILGIBUD_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE); break; case 2: - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START; + this->csAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED2); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_START); break; case 3: - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION; + this->csAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_CONVULSION); break; case 4: - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START; + this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_START); break; case 5: - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_WALK; + this->csAnimIndex = EN_RAILGIBUD_ANIM_WALK; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); break; + + default: + break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) { - this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP; + if (this->csAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) { + this->csAnimIndex = 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; + } else if (this->csAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) { + this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_LOOP); EnRailgibud_SetupSinkIntoGround(this); } @@ -1225,9 +1225,9 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { case 3: case 4: if (this->actionFunc == EnRailgibud_SinkIntoGround) { - func_800B9010(&this->actor, NA_SE_EN_REDEAD_WEAKENED_L2 - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_REDEAD_WEAKENED_L2 - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_REDEAD_WEAKENED_L1 - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_REDEAD_WEAKENED_L1 - SFX_FLAG); } break; 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 f9d3922c8..c9536d235 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -12,13 +12,32 @@ typedef void (*EnRailgibudActionFunc)(struct EnRailgibud*, PlayState*); #define ENRAILGIBUD_IS_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x80) #define ENRAILGIBUD_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +typedef enum EnRailgibudBodyPart { + /* 0 */ ENRAILGIBUD_BODYPART_0, + /* 1 */ ENRAILGIBUD_BODYPART_1, + /* 2 */ ENRAILGIBUD_BODYPART_2, + /* 3 */ ENRAILGIBUD_BODYPART_3, + /* 4 */ ENRAILGIBUD_BODYPART_4, + /* 5 */ ENRAILGIBUD_BODYPART_5, + /* 6 */ ENRAILGIBUD_BODYPART_6, + /* 7 */ ENRAILGIBUD_BODYPART_7, + /* 8 */ ENRAILGIBUD_BODYPART_8, + /* 9 */ ENRAILGIBUD_BODYPART_9, + /* 10 */ ENRAILGIBUD_BODYPART_10, + /* 11 */ ENRAILGIBUD_BODYPART_11, + /* 12 */ ENRAILGIBUD_BODYPART_12, + /* 13 */ ENRAILGIBUD_BODYPART_13, + /* 14 */ ENRAILGIBUD_BODYPART_14, + /* 15 */ ENRAILGIBUD_BODYPART_MAX +} EnRailgibudBodyPart; + typedef struct EnRailgibud { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnRailgibudActionFunc actionFunc; - /* 0x1D8 */ Vec3f limbPos[15]; - /* 0x28C */ s32 limbIndex; + /* 0x1D8 */ Vec3f bodyPartsPos[ENRAILGIBUD_BODYPART_MAX]; + /* 0x28C */ s32 bodyPartIndex; /* 0x290 */ UNK_TYPE1 unk290[0x4]; /* 0x294 */ Vec3s* points; /* 0x298 */ s32 currentPoint; @@ -33,7 +52,7 @@ typedef struct EnRailgibud { /* 0x3EE */ s16 shouldWalkForwardNextFrame; // Only used by the "main" Gibdo /* 0x3F0 */ union { s16 grabState; - s16 cutsceneAnimIndex; + s16 csAnimIndex; }; /* 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 e08cb5574..1dea0c2ee 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -8,7 +8,7 @@ #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) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200) #define THIS ((EnRat*)thisx) @@ -535,7 +535,7 @@ void EnRat_SetupRevive(EnRat* this) { this->actor.shape.rot.z = this->actor.home.rot.z; EnRat_InitializeAxes(this); EnRat_UpdateRotation(this); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; Animation_PlayLoopSetSpeed(&this->skelAnime, &gRealBombchuSpotAnim, 0.0f); this->revivePosY = 2666.6667f; @@ -552,7 +552,7 @@ 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.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnRat_Draw; this->skelAnime.playSpeed = 1.0f; } @@ -700,7 +700,7 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { func_800B1210(play, &this->actor.world.pos, &sDustVelocity, &gZeroVec3f, 550, 50); } - if ((this->actor.floorPoly == NULL) && (Animation_OnFrame(&this->skelAnime, 0.0f))) { + if ((this->actor.floorPoly == NULL) && Animation_OnFrame(&this->skelAnime, 0.0f)) { EnRat_SpawnWaterEffects(this, play); } @@ -709,7 +709,7 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { this->animLoopCounter = 5; } - func_800B9010(&this->actor, NA_SE_EN_BOMCHU_RUN - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BOMCHU_RUN - SFX_FLAG); EnRat_UpdateSparkOffsets(this); } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 34fc41192..276ff8db7 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -26,7 +26,7 @@ #include "z64rumble.h" #include "objects/object_rd/object_rd.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((EnRd*)thisx) @@ -188,7 +188,7 @@ void EnRd_Init(Actor* thisx, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); this->upperBodyYRotation = this->headYRotation = 0; @@ -523,7 +523,7 @@ void EnRd_SetupPirouette(EnRd* this) { Animation_MorphToLoop(&this->skelAnime, &gGibdoRedeadPirouetteAnim, -6.0f); this->action = EN_RD_ACTION_PIROUETTE; this->animationJudderTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->pirouetteRotationalVelocity = 0x1112; + this->pirouetteAngularVelocity = 0x1112; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnRd_Pirouette; @@ -562,12 +562,12 @@ void EnRd_Pirouette(EnRd* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - this->pirouetteRotationalVelocity = 0x1112; + this->pirouetteAngularVelocity = 0x1112; } else if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - this->pirouetteRotationalVelocity = 0x199A; + this->pirouetteAngularVelocity = 0x199A; } - this->actor.world.rot.y -= this->pirouetteRotationalVelocity; + this->actor.world.rot.y -= this->pirouetteAngularVelocity; this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -577,13 +577,13 @@ void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } - this->actor.world.rot.y -= this->pirouetteRotationalVelocity; + this->actor.world.rot.y -= this->pirouetteAngularVelocity; this->actor.shape.rot.y = this->actor.world.rot.y; - this->pirouetteRotationalVelocity -= 0x64; - if ((this->pirouetteRotationalVelocity < 0x834) && (this->pirouetteRotationalVelocity >= 0x7D0)) { + this->pirouetteAngularVelocity -= 0x64; + if ((this->pirouetteAngularVelocity < 0x834) && (this->pirouetteAngularVelocity >= 0x7D0)) { Animation_Change(&this->skelAnime, &gGibdoRedeadLookBackAnim, 0.0f, 0.0f, 19.0f, ANIMMODE_ONCE, -10.0f); - } else if (this->pirouetteRotationalVelocity < 0x3E8) { + } else if (this->pirouetteAngularVelocity < 0x3E8) { if ((EN_RD_GET_TYPE(&this->actor) != EN_RD_TYPE_CRYING) && (!this->isMourning)) { EnRd_SetupAttemptPlayerFreeze(this); } else { @@ -688,7 +688,7 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { EnRd_SetupWalkToHome(this, play); } } else if (play->grabPlayer(play, player)) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; EnRd_SetupGrab(this); } } else if (EN_RD_GET_TYPE(&this->actor) > EN_RD_TYPE_DOES_NOT_MOURN_IF_WALKING) { @@ -740,7 +740,7 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) { !(player->stateFlags2 & (0x4000 | 0x80)) && (player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; EnRd_SetupWalkToPlayer(this, play); } else if (EN_RD_GET_TYPE(&this->actor) > EN_RD_TYPE_DOES_NOT_MOURN_IF_WALKING) { if (this->actor.parent != NULL) { @@ -842,7 +842,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { if (!(player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B62 != 0)) { if ((player->unk_B62 != 0) && (player->stateFlags2 & PLAYER_STATE2_80)) { player->stateFlags2 &= ~PLAYER_STATE2_80; - player->unk_AE8 = 100; + player->actionVar2 = 100; } Animation_Change(&this->skelAnime, &gGibdoRedeadGrabEndAnim, 0.5f, 0.0f, Animation_GetLastFrame(&gGibdoRedeadGrabEndAnim), ANIMMODE_ONCE_INTERP, 0.0f); @@ -895,8 +895,8 @@ void EnRd_Grab(EnRd* this, PlayState* play) { if (player->transformation != PLAYER_FORM_FIERCE_DEITY) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 400.0f, 0.0f); } - this->actor.targetMode = 0; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.targetMode = TARGET_MODE_0; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->playerStunWaitTimer = 10; this->grabWaitTimer = 15; EnRd_SetupWalkToPlayer(this, play); @@ -1008,7 +1008,7 @@ void EnRd_SetupDamage(EnRd* this) { this->actor.speed = -2.0f; } - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->action = EN_RD_ACTION_DAMAGE; this->actionFunc = EnRd_Damage; @@ -1042,7 +1042,7 @@ void EnRd_SetupDead(EnRd* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gGibdoRedeadDeathAnim, -1.0f); this->action = EN_RD_ACTION_DEAD; this->deathTimer = 300; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->actionFunc = EnRd_Dead; @@ -1322,8 +1322,8 @@ void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, (limbIndex == REDEAD_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == REDEAD_LIMB_RIGHT_FOREARM) || (limbIndex == REDEAD_LIMB_RIGHT_HAND) || (limbIndex == REDEAD_LIMB_HEAD) || (limbIndex == REDEAD_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1335,7 +1335,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->alpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1363,7 +1363,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, - 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_RD_BODYPART_MAX, this->drawDmgEffScale, 0.5f, + this->drawDmgEffAlpha, this->drawDmgEffType); } } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.h b/src/overlays/actors/ovl_En_Rd/z_en_rd.h index fced38e75..578515a28 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.h +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.h @@ -30,14 +30,33 @@ typedef enum { /* 7 */ EN_RD_TYPE_PIROUETTE } EnRdType; +typedef enum EnRdBodyPart { + /* 0 */ EN_RD_BODYPART_0, + /* 1 */ EN_RD_BODYPART_1, + /* 2 */ EN_RD_BODYPART_2, + /* 3 */ EN_RD_BODYPART_3, + /* 4 */ EN_RD_BODYPART_4, + /* 5 */ EN_RD_BODYPART_5, + /* 6 */ EN_RD_BODYPART_6, + /* 7 */ EN_RD_BODYPART_7, + /* 8 */ EN_RD_BODYPART_8, + /* 9 */ EN_RD_BODYPART_9, + /* 10 */ EN_RD_BODYPART_10, + /* 11 */ EN_RD_BODYPART_11, + /* 12 */ EN_RD_BODYPART_12, + /* 13 */ EN_RD_BODYPART_13, + /* 14 */ EN_RD_BODYPART_14, + /* 15 */ EN_RD_BODYPART_MAX +} EnRdBodyPart; + typedef struct EnRd { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnRdActionFunc actionFunc; /* 0x18C */ EnRdSetupDanceFunc setupDanceFunc; /* 0x190 */ ColliderCylinder collider; - /* 0x1DC */ Vec3f limbPos[15]; - /* 0x290 */ s32 limbIndex; + /* 0x1DC */ Vec3f bodyPartsPos[EN_RD_BODYPART_MAX]; + /* 0x290 */ s32 bodyPartIndex; /* 0x294 */ f32 drawDmgEffAlpha; /* 0x298 */ f32 drawDmgEffScale; /* 0x29C */ Vec3s jointTable[REDEAD_LIMB_MAX]; @@ -57,7 +76,7 @@ typedef struct EnRd { /* 0x3E2 */ UNK_TYPE1 unk3E2[0x2]; /* 0x3E4 */ union { s16 danceEndTimer; - s16 pirouetteRotationalVelocity; + s16 pirouetteAngularVelocity; }; /* 0x3E6 */ s16 drawDmgEffTimer; /* 0x3E8 */ u8 drawDmgEffType; diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index 3632efa2a..b9ea1f142 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -7,7 +7,7 @@ #include "z_en_recepgirl.h" #include "objects/object_bg/object_bg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnRecepgirl*)thisx) @@ -37,7 +37,7 @@ static TexturePtr sEyeTextures[] = { object_bg_Tex_00F8F0, object_bg_Tex_00FCF0, object_bg_Tex_00FCF0 }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), }; @@ -61,7 +61,7 @@ void EnRecepgirl_Init(Actor* thisx, PlayState* play) { this->eyeTexIndex = 2; - if (Flags_GetSwitch(play, this->actor.params)) { + if (Flags_GetSwitch(play, ENRECEPGIRL_GET_SWITCH_FLAG(&this->actor))) { this->actor.textId = 0x2ADC; // hear directions again? } else { this->actor.textId = 0x2AD9; // "Welcome..." @@ -103,13 +103,13 @@ void EnRecepgirl_Wait(EnRecepgirl* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnRecepgirl_SetupTalk(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_800B8614(&this->actor, play, 60.0f); + Actor_OfferTalk(&this->actor, play, 60.0f); if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { - this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?" - } else if (Flags_GetSwitch(play, this->actor.params)) { + this->actor.textId = 0x2367; + } else if (Flags_GetSwitch(play, ENRECEPGIRL_GET_SWITCH_FLAG(&this->actor))) { this->actor.textId = 0x2ADC; // hear directions again? } else { - this->actor.textId = 0x2AD9; // "Welcome..." + this->actor.textId = 0x2AD9; } } } @@ -145,8 +145,8 @@ void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2ADC; // hear directions again? EnRecepgirl_SetupWait(this); } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - if (this->actor.textId == 0x2AD9) { // "Welcome..." - Flags_SetSwitch(play, this->actor.params); + if (this->actor.textId == 0x2AD9) { + Flags_SetSwitch(play, ENRECEPGIRL_GET_SWITCH_FLAG(&this->actor)); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80)) { @@ -156,11 +156,11 @@ void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { } } else if (this->actor.textId == 0x2ADC) { // hear directions again? Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - this->actor.textId = 0x2ADD; // "So..." + this->actor.textId = 0x2ADD; } else { Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_000968, 10.0f); - if (this->actor.textId == 0x2ADD) { // "So..." + if (this->actor.textId == 0x2ADD) { this->actor.textId = 0x2ADE; // Mayor's office is on the left, drawing room on the right } else if (this->actor.textId == 0x2ADA) { // Mayor's office is on the left (meeting ongoing) this->actor.textId = 0x2ADB; // drawing room on the right diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h index a0fba9fdc..96ad7522a 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h @@ -7,6 +7,8 @@ struct EnRecepgirl; typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, PlayState*); +#define ENRECEPGIRL_GET_SWITCH_FLAG(thisx) ((thisx)->params) + typedef struct EnRecepgirl { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; 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 b6407d24b..856070fba 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -669,7 +669,7 @@ void func_80BF4EBC(EnRg* this, PlayState* play) { this->unk_318 = Rand_S16Offset(0, 20); } } - SubS_FillLimbRotTables(play, this->unk_32E, this->unk_328, ARRAY_COUNT(this->unk_328)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENRG_FIDGET_TABLE_LEN); } void func_80BF4FC4(EnRg* this, PlayState* play) { @@ -747,10 +747,13 @@ void EnRg_Init(Actor* thisx, PlayState* play) { this->unk_33C = 1; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_310 = 8; this->actor.gravity = -1.0f; - SubS_UpdateFlags(&this->unk_310, 3, 7); + + // This is the only usage of this function whose actor does not use `SubS_Offer`. + // Since these bits go unused, it seems like a copy paste that still used `SubSOfferMode` + SubS_SetOfferMode(&this->unk_310, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_02)) { this->unk_318 = Rand_S16Offset(30, 30); @@ -823,29 +826,29 @@ void func_80BF547C(EnRg* this, PlayState* play) { s32 func_80BF5588(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRg* this = THIS; - s32 phi_v0; + s32 fidgetIndex; switch (limbIndex) { case 10: - phi_v0 = 0; + fidgetIndex = 0; break; case 11: - phi_v0 = 1; + fidgetIndex = 1; break; case 14: - phi_v0 = 2; + fidgetIndex = 2; break; default: - phi_v0 = 9; + fidgetIndex = 9; break; } - if (((this->unk_310 & 8) != 0) && (phi_v0 < 9)) { - rot->y += (s16)(Math_SinS(this->unk_32E[phi_v0]) * 200.0f); - rot->z += (s16)(Math_CosS(this->unk_328[phi_v0]) * 200.0f); + if ((this->unk_310 & 8) && (fidgetIndex < 9)) { + rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f); } return false; diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.h b/src/overlays/actors/ovl_En_Rg/z_en_rg.h index 14f8e3882..a29e0a5f7 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.h +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.h @@ -11,6 +11,8 @@ typedef void (*EnRgActionFunc)(struct EnRg*, PlayState*); #define ENRG_PATH_INDEX_NONE 0xFF +#define ENRG_FIDGET_TABLE_LEN 3 + typedef struct { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 unk_01; @@ -43,8 +45,8 @@ typedef struct EnRg { /* 0x322 */ s16 unk_322; /* 0x324 */ s16 unk_324; /* 0x326 */ s16 unk_326; - /* 0x328 */ s16 unk_328[3]; - /* 0x32E */ s16 unk_32E[3]; + /* 0x328 */ s16 fidgetTableZ[ENRG_FIDGET_TABLE_LEN]; + /* 0x32E */ s16 fidgetTableY[ENRG_FIDGET_TABLE_LEN]; /* 0x334 */ s32 unk_334; /* 0x338 */ UNK_TYPE1 unk338[4]; /* 0x33C */ s32 unk_33C; diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 6ea51586a..cfb8f82ea 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -88,6 +88,6 @@ void EnRiverSound_Draw(Actor* thisx, PlayState* play) { if (params < RS_RIVER_DEFAULT_LOW_FREQ) { Actor_PlaySfx(&this->actor, gAudioEnvironmentalSfx[params]); } else { - Audio_PlaySfxForRiver(&this->actor.projectedPos, freqScale[this->soundFreqIndex]); + Audio_PlaySfx_River(&this->actor.projectedPos, freqScale[this->soundFreqIndex]); } } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index cb16e5f39..24fc306cf 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -6,9 +6,10 @@ #include "z_en_rr.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_rr/object_rr.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnRr*)thisx) @@ -119,7 +120,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 3, 45, 60, 250 }; static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, TATL_HINT_ID_LIKE_LIKE, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -400, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), @@ -132,7 +133,7 @@ void EnRr_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); - if (this->actor.params != ENRR_3) { + if (this->actor.params != LIKE_LIKE_PARAM_3) { this->actor.scale.y = 0.015f; this->actor.scale.x = 0.019f; this->actor.scale.z = 0.019f; @@ -151,9 +152,9 @@ void EnRr_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->actor.scale.y * 2000.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if ((this->actor.params == ENRR_2) || (this->actor.params == ENRR_3)) { + if ((this->actor.params == LIKE_LIKE_PARAM_2) || (this->actor.params == LIKE_LIKE_PARAM_3)) { this->actor.colChkInfo.health = 6; - if (this->actor.params == ENRR_2) { + if (this->actor.params == LIKE_LIKE_PARAM_2) { this->actor.colChkInfo.mass = MASS_HEAVY; } } @@ -180,7 +181,7 @@ void func_808FA01C(EnRr* this, PlayState* play, ColliderCylinder* collider) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, collider->info.bumper.hitPos.y, collider->info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == 5) { this->drawDmgEffScale = 0.85f; this->drawDmgEffAlpha = 4.0f; @@ -194,7 +195,7 @@ void func_808FA11C(EnRr* this) { this->collider1.info.elemType = ELEMTYPE_UNK0; this->unk_1EE = 80; this->drawDmgEffScale = 0.85f; - this->drawDmgEffFrozenSteamScale = 1.2750001f; + this->drawDmgEffFrozenSteamScale = 1275.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->actor.flags &= ~ACTOR_FLAG_400; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); @@ -207,8 +208,8 @@ void func_808FA19C(EnRr* this, PlayState* play) { this->collider1.base.colType = COLTYPE_HIT0; this->collider1.info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 20, 2, this->actor.scale.y * 23.333334f, - this->actor.scale.y * 20.000002f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, LIKE_LIKE_BODYPART_MAX, 2, + this->actor.scale.y * 23.333334f, this->actor.scale.y * 20.000002f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -268,7 +269,7 @@ void func_808FA3F8(EnRr* this, Player* player) { this->unk_1EA = 100; this->unk_1FC = 20; this->collider1.base.ocFlags1 &= ~OC1_TYPE_PLAYER; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_1F0 = 8; this->unk_1E1 = 0; this->actor.speed = 0.0f; @@ -298,14 +299,14 @@ void func_808FA4F4(EnRr* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_80) { player->actor.parent = NULL; - player->unk_AE8 = 100; - this->actor.flags |= ACTOR_FLAG_1; + player->actionVar2 = 100; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->unk_1F0 = 110; this->unk_1F6 = 2500; this->unk_210 = 0.0f; this->unk_20C = 0x800; - if (((this->unk_1E2 == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) && + if (((this->unk_1E2 == 0) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) && (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) == EQUIP_VALUE_SHIELD_HERO)) { sp34 = true; this->unk_1E2 = Inventory_DeleteEquipment(play, EQUIP_VALUE_SHIELD_HERO); @@ -317,7 +318,7 @@ void func_808FA4F4(EnRr* this, PlayState* play) { Message_StartTextbox(play, 0xF6, NULL); } - if (this->actor.params == ENRR_0) { + if (this->actor.params == LIKE_LIKE_PARAM_0) { sp38 = 8; } else { sp38 = 16; @@ -416,7 +417,7 @@ void func_808FA910(EnRr* this) { this->actionFunc = func_808FB42C; Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_DEAD); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void func_808FA9CC(EnRr* this) { @@ -635,7 +636,7 @@ void func_808FB1C0(EnRr* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEMO_EYE); } - player->unk_AE8 = 0; + player->actionVar2 = 0; this->unk_1F0 = 8; this->unk_1EA--; @@ -653,7 +654,7 @@ void func_808FB2C0(EnRr* this, PlayState* play) { Player* player = GET_PLAYER(play); this->unk_1E6--; - player->unk_AE8 = 0; + player->actionVar2 = 0; Math_StepToF(&player->actor.world.pos.x, this->unk_228.x, 30.0f); Math_StepToF(&player->actor.world.pos.y, this->unk_228.y + this->unk_218, 30.0f); Math_StepToF(&player->actor.world.pos.z, this->unk_228.z, 30.0f); @@ -800,7 +801,7 @@ void EnRr_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actor.params == ENRR_2) { + if (this->actor.params == LIKE_LIKE_PARAM_2) { this->actor.speed = 0.0f; } else { Math_StepToF(&this->actor.speed, 0.0f, 0.1f); @@ -868,7 +869,7 @@ void EnRr_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.425f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.85f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.85f, 0.02125f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -877,7 +878,7 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnRr* this = THIS; Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Mtx)); - Vec3f* vecPtr; + Vec3f* bodyPartPos; s32 i; EnRrStruct* ptr; Vec3f spA4; @@ -896,14 +897,15 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { Matrix_Scale((1.0f + this->unk_324[0].unk_10) * this->unk_324[0].unk_08, 1.0f, (1.0f + this->unk_324[0].unk_10) * this->unk_324[0].unk_08, MTXMODE_APPLY); - vecPtr = &this->limbPos[0]; + bodyPartPos = &this->bodyPartsPos[0]; gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - Matrix_MultVecZ(1842.1053f, vecPtr++); - Matrix_MultVecZ(-1842.1053f, vecPtr++); - Matrix_MultVecX(1842.1053f, vecPtr++); - Matrix_MultVecX(-1842.1053f, vecPtr++); + // LIKE_LIKE_BODYPART_0 - LIKE_LIKE_BODYPART_3 + Matrix_MultVecZ(1842.1053f, bodyPartPos++); + Matrix_MultVecZ(-1842.1053f, bodyPartPos++); + Matrix_MultVecX(1842.1053f, bodyPartPos++); + Matrix_MultVecX(-1842.1053f, bodyPartPos++); Matrix_Pop(); for (i = 1; i < ARRAY_COUNT(this->unk_324); i++) { @@ -920,10 +922,14 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { Matrix_RotateYS(0x2000, MTXMODE_APPLY); } - Matrix_MultVecZ(1842.1053f, vecPtr++); - Matrix_MultVecZ(-1842.1053f, vecPtr++); - Matrix_MultVecX(1842.1053f, vecPtr++); - Matrix_MultVecX(-1842.1053f, vecPtr++); + // LIKE_LIKE_BODYPART_4 - LIKE_LIKE_BODYPART_7 + // LIKE_LIKE_BODYPART_8 - LIKE_LIKE_BODYPART_11 + // LIKE_LIKE_BODYPART_12 - LIKE_LIKE_BODYPART_15 + // LIKE_LIKE_BODYPART_16 - LIKE_LIKE_BODYPART_19 + Matrix_MultVecZ(1842.1053f, bodyPartPos++); + Matrix_MultVecZ(-1842.1053f, bodyPartPos++); + Matrix_MultVecX(1842.1053f, bodyPartPos++); + Matrix_MultVecX(-1842.1053f, bodyPartPos++); Matrix_Pop(); mtx++; if (i == 3) { @@ -936,9 +942,9 @@ void EnRr_Draw(Actor* thisx, PlayState* play2) { this->collider2.dim.pos.y = ((this->unk_228.y - spA4.y) * 0.85f) + spA4.y; this->collider2.dim.pos.z = ((this->unk_228.z - spA4.z) * 0.85f) + spA4.z; - gSPDisplayList(POLY_OPA_DISP++, object_rr_DL_000470); + gSPDisplayList(POLY_OPA_DISP++, gLikeLikeDL); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, LIKE_LIKE_BODYPART_MAX, this->actor.scale.y * 66.66667f * this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/src/overlays/actors/ovl_En_Rr/z_en_rr.h index 6f4178dd9..3c2bc3964 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -8,11 +8,35 @@ struct EnRr; typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); typedef enum { - /* 0 */ ENRR_0, - /* 1 */ ENRR_1, - /* 2 */ ENRR_2, - /* 3 */ ENRR_3 -} EnRrParam; + /* 0 */ LIKE_LIKE_PARAM_0, + /* 1 */ LIKE_LIKE_PARAM_1, + /* 2 */ LIKE_LIKE_PARAM_2, + /* 3 */ LIKE_LIKE_PARAM_3 +} LikeLikeParam; + +typedef enum LikeLikeBodyPart { + /* 0 */ LIKE_LIKE_BODYPART_0, + /* 1 */ LIKE_LIKE_BODYPART_1, + /* 2 */ LIKE_LIKE_BODYPART_2, + /* 3 */ LIKE_LIKE_BODYPART_3, + /* 4 */ LIKE_LIKE_BODYPART_4, + /* 5 */ LIKE_LIKE_BODYPART_5, + /* 6 */ LIKE_LIKE_BODYPART_6, + /* 7 */ LIKE_LIKE_BODYPART_7, + /* 8 */ LIKE_LIKE_BODYPART_8, + /* 9 */ LIKE_LIKE_BODYPART_9, + /* 10 */ LIKE_LIKE_BODYPART_10, + /* 11 */ LIKE_LIKE_BODYPART_11, + /* 12 */ LIKE_LIKE_BODYPART_12, + /* 13 */ LIKE_LIKE_BODYPART_13, + /* 14 */ LIKE_LIKE_BODYPART_14, + /* 15 */ LIKE_LIKE_BODYPART_15, + /* 16 */ LIKE_LIKE_BODYPART_16, + /* 17 */ LIKE_LIKE_BODYPART_17, + /* 18 */ LIKE_LIKE_BODYPART_18, + /* 19 */ LIKE_LIKE_BODYPART_19, + /* 20 */ LIKE_LIKE_BODYPART_MAX +} LikeLikeBodyPart; typedef struct { /* 0x00 */ f32 unk_00; @@ -58,7 +82,7 @@ typedef struct EnRr { /* 0x220 */ f32 drawDmgEffScale; /* 0x224 */ f32 drawDmgEffFrozenSteamScale; /* 0x228 */ Vec3f unk_228; - /* 0x234 */ Vec3f limbPos[20]; + /* 0x234 */ Vec3f bodyPartsPos[LIKE_LIKE_BODYPART_MAX]; /* 0x324 */ EnRrStruct unk_324[5]; } EnRr; // size = 0x3C4 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 0d9ada5e0..b1632ecc8 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c @@ -7,7 +7,7 @@ #include "z_en_rsn.h" #include "objects/object_rs/object_rs.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnRsn*)thisx) @@ -45,7 +45,7 @@ void EnRsn_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gBombShopkeeperSkel, &gBombShopkeeperWalkAnim, NULL, NULL, 0); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; func_80C25D40(this); } diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 3a4d30516..66ee8f546 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -6,7 +6,7 @@ #include "z_en_ru.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnRu*)thisx) @@ -97,17 +97,66 @@ static AnimationInfoS sAnimationInfo[] = { { &gAdultRutoSwimmingUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -// in PostLimbdraw, converts limbIndex to bodyPartsPos index -static s8 sBodyPartPosIndices[] = { - -1, -1, 12, 13, 14, -1, 9, 10, 11, -1, 0, 6, -1, -1, 7, 8, 2, -1, -1, 3, 4, 2, 1, +static s8 sLimbToBodyParts[RU2_LIMB_MAX] = { + BODYPART_NONE, // RU2_LIMB_NONE + BODYPART_NONE, // RU2_LIMB_ROOT + RU_BODYPART_12, // RU2_LIMB_LEFT_THIGH + RU_BODYPART_13, // RU2_LIMB_LEFT_LEG + RU_BODYPART_14, // RU2_LIMB_LEFT_FOOT + BODYPART_NONE, // RU2_LIMB_LEFT_TAIL + RU_BODYPART_9, // RU2_LIMB_RIGHT_THIGH + RU_BODYPART_10, // RU2_LIMB_RIGHT_LEG + RU_BODYPART_11, // RU2_LIMB_RIGHT_FOOT + BODYPART_NONE, // RU2_LIMB_RIGHT_TAIL + RU_BODYPART_0, // RU2_LIMB_TORSO + RU_BODYPART_6, // RU2_LIMB_LEFT_UPPER_ARM + BODYPART_NONE, // RU2_LIMB_LEFT_UPPER_WING + BODYPART_NONE, // RU2_LIMB_LEFT_LOWER_WING + RU_BODYPART_7, // RU2_LIMB_LEFT_FOREARM + RU_BODYPART_8, // RU2_LIMB_LEFT_HAND + RU_BODYPART_2, // RU2_LIMB_RIGHT_UPPER_ARM + BODYPART_NONE, // RU2_LIMB_RIGHT_UPPER_WING + BODYPART_NONE, // RU2_LIMB_RIGHT_LOWER_WING + RU_BODYPART_3, // RU2_LIMB_RIGHT_FOREARM + RU_BODYPART_4, // RU2_LIMB_RIGHT_HAND + RU_BODYPART_2, // RU2_LIMB_HEAD + RU_BODYPART_1, // RU2_LIMB_WAIST }; -static s8 sRuBodyParts[RU_BODYPARTSPOS_COUNT] = { - 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, +static s8 sParentShadowBodyParts[RU_BODYPART_MAX] = { + RU_BODYPART_0, // RU_BODYPART_0 + RU_BODYPART_0, // RU_BODYPART_1 + RU_BODYPART_0, // RU_BODYPART_2 + RU_BODYPART_0, // RU_BODYPART_3 + RU_BODYPART_3, // RU_BODYPART_4 + RU_BODYPART_4, // RU_BODYPART_5 + RU_BODYPART_0, // RU_BODYPART_6 + RU_BODYPART_6, // RU_BODYPART_7 + RU_BODYPART_7, // RU_BODYPART_8 + RU_BODYPART_0, // RU_BODYPART_9 + RU_BODYPART_9, // RU_BODYPART_10 + RU_BODYPART_10, // RU_BODYPART_11 + RU_BODYPART_0, // RU_BODYPART_12 + RU_BODYPART_12, // RU_BODYPART_13 + RU_BODYPART_13, // RU_BODYPART_14 }; -static u8 sRuShadowSizes[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +static u8 sShadowSizes[RU_BODYPART_MAX] = { + 0, // RU_BODYPART_0 + 0, // RU_BODYPART_1 + 0, // RU_BODYPART_2 + 0, // RU_BODYPART_3 + 0, // RU_BODYPART_4 + 0, // RU_BODYPART_5 + 0, // RU_BODYPART_6 + 0, // RU_BODYPART_7 + 0, // RU_BODYPART_8 + 0, // RU_BODYPART_9 + 0, // RU_BODYPART_10 + 0, // RU_BODYPART_11 + 0, // RU_BODYPART_12 + 0, // RU_BODYPART_13 + 0, // RU_BODYPART_14 }; static TrackOptionsSet sTrackOptions = { @@ -202,7 +251,7 @@ void EnRu_UpdateModel(EnRu* this, PlayState* play) { Vec3f playerPos; playerPos.x = player->actor.world.pos.x; - playerPos.y = player->bodyPartsPos[7].y + 3.0f; + playerPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; playerPos.z = player->actor.world.pos.z; SubS_TrackPoint(&playerPos, &this->actor.focus.pos, &this->actor.shape.rot, &this->trackTarget, &this->headRot, &this->torsoRot, &sTrackOptions); @@ -218,7 +267,7 @@ void EnRu_UpdateModel(EnRu* this, PlayState* play) { EnRu_UpdateEyes(this, 3); EnRu_PlayWalkingSound(this, play); - SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, RU2_LIMB_MAX); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, RU2_LIMB_MAX); } void EnRu_DoNothing(EnRu* this, PlayState* play) { @@ -274,8 +323,8 @@ s32 EnRu_OverrideLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if ((limbIndex == RU2_LIMB_TORSO) || (limbIndex == RU2_LIMB_LEFT_UPPER_ARM) || (limbIndex == RU2_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f); + rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f); } return false; @@ -286,8 +335,8 @@ void EnRu_PostLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f headFocus = { 800.0f, 0, 0 }; Vec3f bodyPartPos = { 0, 0, 0 }; - if (sBodyPartPosIndices[limbIndex] >= 0) { - Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sBodyPartPosIndices[limbIndex]]); + if (sLimbToBodyParts[limbIndex] > BODYPART_NONE) { + Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == RU2_LIMB_HEAD) { Matrix_MultVec3f(&headFocus, &thisx->focus.pos); @@ -344,8 +393,8 @@ void EnRu_Draw(Actor* thisx, PlayState* play) { } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(&this->bodyPartsPos[0], &this->actor.world.pos, shadowTex, (i / 5.0f), - (ARRAY_COUNT(sRuBodyParts)), sRuShadowSizes, sRuBodyParts); + SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, RU_BODYPART_MAX, + sShadowSizes, sParentShadowBodyParts); } SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index 7aeaea044..83f7d8426 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -12,7 +12,24 @@ struct EnRu; typedef void (*EnRuActionFunc)(struct EnRu*, PlayState*); -#define RU_BODYPARTSPOS_COUNT 15 +typedef enum EnRuBodyPart { + /* 0 */ RU_BODYPART_0, + /* 1 */ RU_BODYPART_1, + /* 2 */ RU_BODYPART_2, + /* 3 */ RU_BODYPART_3, + /* 4 */ RU_BODYPART_4, + /* 5 */ RU_BODYPART_5, + /* 6 */ RU_BODYPART_6, + /* 7 */ RU_BODYPART_7, + /* 8 */ RU_BODYPART_8, + /* 9 */ RU_BODYPART_9, + /* 10 */ RU_BODYPART_10, + /* 11 */ RU_BODYPART_11, + /* 12 */ RU_BODYPART_12, + /* 13 */ RU_BODYPART_13, + /* 14 */ RU_BODYPART_14, + /* 15 */ RU_BODYPART_MAX +} EnruBodyPart; typedef struct EnRu { /* 0x000 */ Actor actor; @@ -32,9 +49,9 @@ typedef struct EnRu { /* 0x318 */ Vec3s headRot; /* 0x31E */ Vec3s torsoRot; /* 0x324 */ UNK_TYPE1 pad324[0x12]; - /* 0x336 */ s16 limbRotTableY[RU2_LIMB_MAX]; - /* 0x364 */ s16 limbRotTableZ[RU2_LIMB_MAX]; - /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPARTSPOS_COUNT]; + /* 0x336 */ s16 fidgetTableY[RU2_LIMB_MAX]; + /* 0x364 */ s16 fidgetTableZ[RU2_LIMB_MAX]; + /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPART_MAX]; /* 0x348 */ UNK_TYPE1 padUNK[6]; /* 0x44E */ s16 eyeState; /* 0x450 */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index dfff2735c..27f95af01 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -222,7 +222,7 @@ void EnRuppecrow_ShatterIce(EnRuppecrow* this, PlayState* play) { if (this->currentEffect == ENRUPPECROW_EFFECT_ICE) { this->currentEffect = ENRUPPECROW_EFFECT_NONE; this->unk_2C8 = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0x2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENRUPPECROW_BODYPART_MAX, 0x2, 0.2f, 0.2f); } } @@ -368,7 +368,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) { s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState* play) { Player* player = GET_PLAYER(play); - if (play->msgCtx.ocarinaMode == 0x3) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { switch (player->transformation) { case PLAYER_FORM_DEKU: if (play->msgCtx.lastPlayedSong == OCARINA_SONG_SONATA) { @@ -494,7 +494,7 @@ void EnRuppecrow_UpdateDamage(EnRuppecrow* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect != 0x1) { this->actor.colChkInfo.health = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Enemy_StartFinishingBlow(play, &this->actor); EnRuppecrow_HandleDeath(this); } @@ -611,7 +611,7 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, PlayState* play) { this->unk_2CC = (this->unk_2C8 + 1.0f) * 0.25f; this->unk_2CC = CLAMP_MAX(this->unk_2CC, 0.5f); } else if (!Math_StepToF(&this->iceSfxTimer, 0.5f, 0.0125f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } this->actor.colorFilterTimer = 40; @@ -640,12 +640,12 @@ void EnRuppecrow_Init(Actor* thisx, PlayState* play2) { EnRuppecrow* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->joinTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitJntSph(play, &this->collider); - Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h index 5d591258b..40eee8102 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h @@ -9,24 +9,31 @@ #define ENRUPPECROW_PATH_INDEX_NONE 0x3F #define ENRUPPECROW_RUPEE_COUNT 20 -#define ENRUPPECROW_LIMB_POS_COUNT 4 struct EnRuppecrow; typedef void (*EnRuppecrowActionFunc)(struct EnRuppecrow*, PlayState*); +typedef enum EnRuppecrowBodyPart { + /* 0 */ ENRUPPECROW_BODYPART_0, + /* 1 */ ENRUPPECROW_BODYPART_1, + /* 2 */ ENRUPPECROW_BODYPART_2, + /* 3 */ ENRUPPECROW_BODYPART_3, + /* 4 */ ENRUPPECROW_BODYPART_MAX +} EnRuppecrowBodyPart; + typedef struct EnRuppecrow { /* 0x000 */ Actor actor; /* 0x144 */ EnItem00* rupees[ENRUPPECROW_RUPEE_COUNT]; /* 0x194 */ SkelAnime skelAnime; /* 0x1D8 */ EnRuppecrowActionFunc actionFunc; /* 0x1DC */ UNK_TYPE4 unk_1DC; // unused - /* 0x1E0 */ Vec3s joinTable[OBJECT_CROW_LIMB_MAX]; + /* 0x1E0 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; /* 0x216 */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x24C */ Path* path; /* 0x250 */ s32 currentPoint; /* 0x254 */ ColliderJntSph collider; - /* 0x274 */ ColliderJntSphElement colliderElement; + /* 0x274 */ ColliderJntSphElement colliderElements[1]; /* 0x2B4 */ u16 isGoingCounterClockwise; /* 0x2B8 */ f32 speedModifier; /* 0x2BC */ s16 rupeeIndex; @@ -36,7 +43,7 @@ typedef struct EnRuppecrow { /* 0x2C8 */ f32 unk_2C8; // set but not used /* 0x2CC */ f32 unk_2CC; // set but not used /* 0x2D0 */ f32 iceSfxTimer; - /* 0x2D4 */ Vec3f limbPos[ENRUPPECROW_LIMB_POS_COUNT]; + /* 0x2D4 */ Vec3f bodyPartsPos[ENRUPPECROW_BODYPART_MAX]; } EnRuppecrow; // size = 0x304 #endif // Z_EN_RUPPECROW_H diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index e980d1cb5..a1ed46868 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -7,7 +7,7 @@ #include "z_en_rz.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnRz*)thisx) @@ -112,7 +112,7 @@ void EnRz_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BFC058; EnRz_SetupPath(this, play); this->animIndex = EN_RZ_ANIM_MAX; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; @@ -362,7 +362,7 @@ s32 func_80BFBE70(EnRz* this, PlayState* play) { u16 cueId; if ((EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) && (this->animIndex == EN_RZ_ANIM_APPLAUDING)) { - func_800B9010(&this->actor, NA_SE_EV_CLAPPING_2P - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_CLAPPING_2P - SFX_FLAG); } if (Cutscene_IsCueInChannel(play, this->cueType)) { @@ -417,7 +417,7 @@ void func_80BFC058(EnRz* this, PlayState* play) { void func_80BFC078(EnRz* this, PlayState* play) { s32 pad; - Vec3f sp28; + Vec3f seqPos; EnRz_UpdateSkelAnime(this, play); @@ -443,10 +443,10 @@ void func_80BFC078(EnRz* this, PlayState* play) { } if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) { - sp28.x = this->actor.projectedPos.x; - sp28.y = this->actor.projectedPos.y; - sp28.z = this->actor.projectedPos.z; - func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_ROSA_SISTERS, 900.0f); + seqPos.x = this->actor.projectedPos.x; + seqPos.y = this->actor.projectedPos.y; + seqPos.z = this->actor.projectedPos.z; + Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_ROSA_SISTERS, 900.0f); } } @@ -504,7 +504,7 @@ void func_80BFC36C(EnRz* this, PlayState* play) { void func_80BFC3F8(EnRz* this, PlayState* play) { s32 pad; - Vec3f bgmPos; + Vec3f seqPos; EnRz_UpdateSkelAnime(this, play); @@ -536,18 +536,18 @@ void func_80BFC3F8(EnRz* this, PlayState* play) { } else if (EnRz_CanTalk(this, play)) { if (func_80BFBCEC(this, play) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04) && this->sister != NULL) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { this->actor.flags &= ~ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) { - bgmPos.x = this->actor.projectedPos.x; - bgmPos.y = this->actor.projectedPos.y; - bgmPos.z = this->actor.projectedPos.z; - func_801A1FB4(SEQ_PLAYER_BGM_SUB, &bgmPos, NA_BGM_ROSA_SISTERS, 900.0f); + seqPos.x = this->actor.projectedPos.x; + seqPos.y = this->actor.projectedPos.y; + seqPos.z = this->actor.projectedPos.z; + Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_ROSA_SISTERS, 900.0f); } } } @@ -572,7 +572,7 @@ void func_80BFC674(EnRz* this, PlayState* play) { Message_StartTextbox(play, 0x2924, &this->actor); } } else if (EnRz_CanTalk(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -609,7 +609,7 @@ void func_80BFC7E0(EnRz* this, PlayState* play) { this->actor.speed = 0.0f; func_80BFBDFC(play); } else if (EnRz_CanTalk(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -644,7 +644,7 @@ void EnRz_Walk(EnRz* this, PlayState* play) { this->actor.speed = 0.0f; func_80BFBDFC(play); } else if (EnRz_CanTalk(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index 54fe2698d..f7ec8f509 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 @@ -36,7 +36,7 @@ Week Event Flags: #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 FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnSGoro*)thisx) #define EN_S_GORO_ROLLEDUP_YOFFSET 14.0f @@ -264,7 +264,7 @@ u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { } } else { // Scene flag - Checks whether the chandelier has been lit - if (!Flags_GetSwitch(play, EN_S_GORO_SCENEFLAG_INDEX(&this->actor))) { + if (!Flags_GetSwitch(play, EN_S_GORO_GET_SWITCH_FLAG(&this->actor))) { if (player->transformation == PLAYER_FORM_GORON) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_36_08)) { if (this->textId == 0xD02) { @@ -697,23 +697,23 @@ u16 EnSGoro_BombshopGoron_NextTextId(EnSGoro* this, PlayState* play) { 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); + Audio_PlaySfx(NA_SE_SY_ERROR); return 0x673; } this->powderKegPrice = play->msgCtx.unk1206C; if (gSaveContext.save.saveInfo.playerData.rupees < this->powderKegPrice) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return 0x674; } if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; - func_8019F208(); + Audio_PlaySfx_MessageDecide(); return 0x676; } this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; - func_8019F208(); + Audio_PlaySfx_MessageDecide(); return 0x675; } if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { @@ -786,18 +786,18 @@ void EnSGoro_UpdateSleeping(EnSGoro* this, PlayState* play) { 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] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_TAISOU); + if (this->objectSlot > OBJECT_SLOT_NONE) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].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] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); + if (this->objectSlot > OBJECT_SLOT_NONE) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); this->skelAnime.curFrame = this->skelAnime.endFrame; @@ -811,7 +811,7 @@ 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 ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT)) { if (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) { this->animInfoIndex = EN_S_GORO_ANIM_ROLLUP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); @@ -1023,7 +1023,7 @@ s32 EnSGoro_UpdateAttentionTarget(EnSGoro* this, PlayState* play) { } void EnSGoro_SetupAction(EnSGoro* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->loadedObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { this->actionFlags = 0; if (EN_S_GORO_OFTYPE_WSHRINE) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON)) { @@ -1048,7 +1048,7 @@ void EnSGoro_SetupAction(EnSGoro* this, PlayState* play) { this->actor.gravity = -1.0f; this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; switch (EN_S_GORO_GET_MAIN_TYPE(&this->actor)) { case EN_S_GORO_TYPE_SHRINE_WINTER_A: @@ -1113,8 +1113,8 @@ void EnSGoro_WinterShrineGoron_Idle(EnSGoro* this, PlayState* play) { 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); + } else if ((this->actor.xzDistToPlayer < 250.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&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; @@ -1144,8 +1144,8 @@ void EnSGoro_SpringShrineGoron_Idle(EnSGoro* this, PlayState* play) { 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); + } else if ((this->actor.xzDistToPlayer < 250.0f) || (this->actor.isLockedOn)) { + Actor_OfferTalkNearColChkInfoCylinder(&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; @@ -1157,7 +1157,7 @@ void EnSGoro_SpringShrineGoron_Talk(EnSGoro* this, PlayState* 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.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnSGoro_SpringShrineGoron_Idle; return; @@ -1185,8 +1185,8 @@ void EnSGoro_ShopGoron_Idle(EnSGoro* this, PlayState* play) { 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); + } else if ((this->actor.xzDistToPlayer < 250.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&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; @@ -1236,14 +1236,14 @@ void EnSGoro_ShopGoron_Talk(EnSGoro* this, PlayState* play) { this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_YESBUY; break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); 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.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Actor_OfferGetItem(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); this->actionFunc = EnSGoro_ShopGoron_TakePayment; @@ -1271,7 +1271,7 @@ void EnSGoro_ShopGoron_FinishTransaction(EnSGoro* this, PlayState* play) { Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnSGoro_ShopGoron_Talk; } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1279,8 +1279,8 @@ 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); + } else if (this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } EnSGoro_UpdateSleeping(this, play); } @@ -1288,7 +1288,7 @@ void EnSGoro_Sleep(EnSGoro* this, PlayState* 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.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnSGoro_Sleep; } @@ -1307,10 +1307,10 @@ void EnSGoro_Init(Actor* thisx, PlayState* play) { 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); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OF1D_MAP); - this->loadedObjIndex = objIndex; - if (objIndex < 0) { + this->objectSlot = objectSlot; + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); } } @@ -1329,7 +1329,7 @@ void EnSGoro_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); SkelAnime_Update(&this->skelAnime); if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { EnSGoro_UpdateAttentionTarget(this, play); @@ -1350,7 +1350,7 @@ s32 EnSGoro_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 ste Matrix_MultVec3f(&zeroVec, &newPos); Matrix_Get(&curState); - Matrix_MtxFToYXZRot(&curState, &newRot, MTXMODE_NEW); + Matrix_MtxFToYXZRot(&curState, &newRot, false); *pos = newPos; @@ -1381,53 +1381,62 @@ void EnSGoro_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { 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; + switch (limbIndex) { + case GORON_LIMB_HEAD: + 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->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(); } - if (this->loseAttentionTimer != 0) { - stepRot = true; - } else { - stepRot = false; + break; + + case GORON_LIMB_BODY: + 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(); } + break; - 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(); + default: + break; } } 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 5777af17b..35b71bfdd 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 @@ -5,7 +5,7 @@ #include "objects/object_oF1d_map/object_oF1d_map.h" #define EN_S_GORO_GET_MAIN_TYPE(thisx) ((thisx)->params & 0xF) -#define EN_S_GORO_SCENEFLAG_INDEX(thisx) (((thisx)->params & 0x7F0) >> 4) +#define EN_S_GORO_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x7F0) >> 4) struct EnSGoro; @@ -23,7 +23,7 @@ typedef struct EnSGoro { /* 0x1EC */ s16 eyeTexIndex; /* 0x1EE */ s16 eyeTimer; /* 0x1F0 */ s16 loseAttentionTimer; - /* 0x1F4 */ s32 loadedObjIndex; + /* 0x1F4 */ s32 objectSlot; /* 0x1F8 */ Vec3s jointTable[GORON_LIMB_MAX]; /* 0x264 */ Vec3s morphTable[GORON_LIMB_MAX]; /* 0x2D0 */ f32 scaleFactor; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 17ad656a4..08b1ad240 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -7,7 +7,7 @@ #include "z_en_sb.h" #include "objects/object_sb/object_sb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnSb*)thisx) @@ -93,7 +93,7 @@ static DamageTable sDamageTable = { static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, TATL_HINT_ID_SHELLBLADE, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -337,7 +337,7 @@ void EnSb_UpdateDamage(EnSb* this, PlayState* play) { } if (hitPlayer) { this->unk_252 = 0; - if ((this->actor.draw != NULL) && (this->isDrawn == false)) { + if ((this->actor.draw != NULL) && !this->isDrawn) { this->isDrawn = true; } this->isDead = true; 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 cf634321e..80fbff4b1 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -8,7 +8,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_dnt/object_dnt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnScopenuts*)thisx) @@ -65,37 +65,37 @@ static ColliderCylinderInitType1 sCylinderInit = { }; 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 }, - { &object_dnt_Anim_004E38, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0029E8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_005CA8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0038CC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_003CC0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_0012F4, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_004700, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001BC8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_003438, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001E2C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_000994, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_002268, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_002F08, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_00577C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnt_Anim_0029E8, 1.0f, 8, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0029E8, 1.0f, 4, -1, ANIMMODE_ONCE, -4 }, - { &object_dnt_Anim_0029E8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001BC8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_0012F4, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_002670, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubRiseUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubExcitedStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubExcitedLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubExcitedEndAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubTakeOffHatAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubShockedShakeHeadAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedPoundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubThinkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubBobAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gBusinessScrubBurrowAnim, 1.0f, 8, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubBurrowAnim, 1.0f, 4, -1, ANIMMODE_ONCE, -4 }, + { &gBusinessScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubTakeOffHatAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, }; -Gfx* D_80BCCCDC[] = { gKakeraLeafMiddle, gKakeraLeafTip }; +Gfx* D_80BCCCDC[] = { gKakeraLeafMiddleDL, gKakeraLeafTipDL }; Vec3f D_80BCCCE4 = { 0.0f, -0.5f, 0.0f }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -301,8 +301,8 @@ void func_80BCB52C(EnScopenuts* this, PlayState* play) { this->actionFunc = func_80BCB6D0; } else if (((this->actor.xzDistToPlayer < 100.0f) && (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || - this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); + this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 100.0f); } 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; @@ -318,9 +318,9 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (this->unk_328 & 1) { this->unk_328 &= ~1; - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_328 &= ~4; this->unk_348 = 8; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 8); @@ -335,20 +335,20 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_358) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); this->unk_33C = 0x1636; this->unk_328 |= 1; Message_StartTextbox(play, this->unk_33C, &this->actor); } else { - func_8019F208(); - play->msgCtx.msgMode = 0x43; + Audio_PlaySfx_MessageDecide(); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Rupees_ChangeBy(-this->unk_358); this->actionFunc = func_80BCB90C; } break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); if (this->unk_358 == 150) { this->unk_33C = 0x1633; } else { @@ -360,7 +360,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { } } } else if (talkState == TEXT_STATE_DONE) { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_80BCB980; } } @@ -382,7 +382,7 @@ void func_80BCB980(EnScopenuts* this, PlayState* play) { Message_StartTextbox(play, this->unk_33C, &this->actor); this->actionFunc = func_80BCB6D0; } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -685,13 +685,13 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { EnScopenuts* this = THIS; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40) && - (gSaveContext.save.saveInfo.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { + (gSaveContext.save.saveInfo.inventory.items[ITEM_OCARINA_OF_TIME] == ITEM_NONE)) { Actor_Kill(&this->actor); return; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubStandingAnim, this->jointTable, this->morphTable, 28); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); @@ -757,7 +757,7 @@ void EnScopenuts_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->unk_328 & 8) { - func_800B9010(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); } func_80BCAE78(this, play); } @@ -794,9 +794,9 @@ s32 EnScopenuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve if (limbIndex == 26) { if ((this->unk_33C == 0x162F) || (this->unk_33C == 0x1630)) { - *dList = object_dnt_DL_001420; + *dList = gBusinessScrubEyesSquintDL; } else { - *dList = object_dnt_DL_008290; + *dList = gBusinessScrubEyesDL; } } diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index 909510329..9334d2d29 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -68,7 +68,7 @@ Vec3f D_80947B10[] = { { -1.0f, -2.0f, -0.2f }, { 0.0f, -2.0f, -0.2f }, { 1.0f, -2.0f, -0.2f }, { 0.0f, -3.0f, -0.5f }, }; -static s32 sPad[2] = { 0, 0 }; +static s32 sPad = 0; #include "overlays/ovl_En_Sda/ovl_En_Sda.c" diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index 1e1f19d70..0b22f3d9c 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -11,7 +11,7 @@ #include "objects/object_sekihiz/object_sekihiz.h" #include "objects/object_zog/object_zog.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnSekihi*)thisx) @@ -39,40 +39,44 @@ ActorInit En_Sekihi_InitVars = { static s16 sObjectIds[] = { OBJECT_SEKIHIL, OBJECT_SEKIHIG, OBJECT_SEKIHIN, OBJECT_SEKIHIZ, OBJECT_ZOG }; static Gfx* sOpaDLists[] = { - gGraveTriforceSymbolDL, gGraveGoronSymbolDL, gGraveKokiriSymbolDL, gTombSongOfSoaringDL, gMikauGraveDL, + gSunsSongGraveTriforceDL, gSunsSongGraveGoronDL, gSunsSongGraveKokiriDL, gSongOfSoaringPedestalDL, gMikauGraveDL, }; static Gfx* sXluDLists[] = { - gSunSongTriforceSymbolDL, gSunSongGoronSymbolDL, gSunSongKokiriSymbolDL, gSekihizEmptyDL, gMikauGraveDirtDL, + gSunsSongGraveTriforceSymbolsDL, + gSunsSongGraveGoronSymbolsDL, + gSunsSongGraveKokiriSymbolsDL, + gSongOfSoaringPedestalEmptyDL, + gMikauGraveDirtDL, }; static u16 sTextIds[] = { 0, 0, 0, 0, 0x1018 }; void EnSekihi_Init(Actor* thisx, PlayState* play) { EnSekihi* this = THIS; - s32 params = ENSIKIHI_GET_TYPE(thisx); - s32 objectIndex; + s32 type = ENSIKIHI_GET_TYPE(thisx); + s32 objectSlot; s32 pad; - if ((params < SEKIHI_TYPE_0 || params >= SEKIHI_TYPE_MAX) || sOpaDLists[params] == NULL) { + if (((type < SEKIHI_TYPE_0) || (type >= SEKIHI_TYPE_MAX)) || (sOpaDLists[type] == NULL)) { Actor_Kill(&this->dyna.actor); return; } - if ((params == SEKIHI_TYPE_4) && + if ((type == SEKIHI_TYPE_4) && ((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF) >= SPIDER_HOUSE_TOKENS_REQUIRED)) { // For some reason the mikau grave sets the flag instead of something in the spider house on exit. SET_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN); } - objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); - if (objectIndex >= 0) { - this->objectIndex = objectIndex; + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[type]); + if (objectSlot > OBJECT_SLOT_NONE) { + this->objectSlot = objectSlot; } this->actionFunc = func_80A44DE8; - this->opaDList = sOpaDLists[params]; - this->xluDList = sXluDLists[params]; - this->dyna.actor.textId = sTextIds[params]; + this->opaDList = sOpaDLists[type]; + this->xluDList = sXluDLists[type]; + this->dyna.actor.textId = sTextIds[type]; this->dyna.actor.focus.pos.y = this->dyna.actor.world.pos.y + 60.0f; Actor_SetScale(&this->dyna.actor, 0.1f); } @@ -85,16 +89,17 @@ void EnSekihi_Destroy(Actor* thisx, PlayState* play) { void func_80A44DE8(EnSekihi* this, PlayState* play) { CollisionHeader* colHeader = NULL; - s32 params; + s32 type; CollisionHeader* colHeaders[] = { - &gSekihilCol, &gSekihigCol, &gSekihinCol, &gSekihizCol, &gObjectZogCol, + &gSunsSongGraveTriforceCol, &gSunsSongGraveGoronCol, &gSunsSongGraveKokiriCol, + &gSongOfSoaringPedestalCol, &gMikauGraveCol, }; - params = ENSIKIHI_GET_TYPE(&this->dyna.actor); - if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) { - this->dyna.actor.objBankIndex = this->objectIndex; + type = ENSIKIHI_GET_TYPE(&this->dyna.actor); + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->dyna.actor.objectSlot = this->objectSlot; this->dyna.actor.draw = EnSekihi_Draw; - if (params == SEKIHI_TYPE_4) { + if (type == SEKIHI_TYPE_4) { this->actionFunc = func_80A450B0; } else { this->actionFunc = EnSekihi_DoNothing; @@ -102,12 +107,12 @@ void func_80A44DE8(EnSekihi* this, PlayState* play) { Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, 0); - if (colHeaders[params] != NULL) { - CollisionHeader_GetVirtual(colHeaders[params], &colHeader); + if (colHeaders[type] != NULL) { + CollisionHeader_GetVirtual(colHeaders[type], &colHeader); } this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if ((params == SEKIHI_TYPE_4) && (INV_CONTENT(ITEM_MASK_ZORA) != ITEM_MASK_ZORA)) { + if ((type == SEKIHI_TYPE_4) && (INV_CONTENT(ITEM_MASK_ZORA) != ITEM_MASK_ZORA)) { Actor_Kill(&this->dyna.actor); } } @@ -119,15 +124,15 @@ void func_80A44F40(EnSekihi* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1019)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x101A); break; case 1: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x101B); break; case 2: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_CloseTextbox(play); this->actionFunc = func_80A450B0; break; @@ -157,7 +162,7 @@ void func_80A450B0(EnSekihi* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { this->actionFunc = func_80A44F40; } else if ((this->dyna.actor.xzDistToPlayer < 100.0f) && (Player_IsFacingActor(&this->dyna.actor, 0x2600, play))) { - func_800B8614(&this->dyna.actor, play, 120.0f); + Actor_OfferTalk(&this->dyna.actor, play, 120.0f); } } diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h index 0c26dab71..60e7c47ba 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h @@ -15,7 +15,7 @@ typedef struct EnSekihi { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ Gfx* opaDList; /* 0x160 */ Gfx* xluDList; - /* 0x164 */ s8 objectIndex; + /* 0x164 */ s8 objectSlot; /* 0x168 */ EnSekihiActionFunc actionFunc; } EnSekihi; // size = 0x16C 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 73edc4267..597c2c392 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -7,7 +7,7 @@ #include "z_en_sellnuts.h" #include "objects/object_dnt/object_dnt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnSellnuts*)thisx) @@ -81,33 +81,33 @@ static ColliderCylinderInitType1 sCylinderInit = { }; 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 }, - { &object_dnt_Anim_004E38, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0029E8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_005CA8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0038CC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_003CC0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_0012F4, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_004700, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001BC8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_003438, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001E2C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_000994, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_002268, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_002F08, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_00577C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnt_Anim_0029E8, 1.0f, 8, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_0029E8, 1.0f, 4, -1, ANIMMODE_ONCE, -4 }, - { &object_dnt_Anim_0029E8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_001BC8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnt_Anim_0012F4, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnt_Anim_002670, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubRiseUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubExcitedStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubExcitedLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubExcitedEndAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubTakeOffHatAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubShockedShakeHeadAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedPoundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubShockedEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubThinkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubBobAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gBusinessScrubBurrowAnim, 1.0f, 8, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubBurrowAnim, 1.0f, 4, -1, ANIMMODE_ONCE, -4 }, + { &gBusinessScrubBurrowAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBusinessScrubTakeOffHatAnim, -1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gBusinessScrubFlyEndAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -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) == PLAYER_IA_MOON_TEAR) { + if (Player_GetExchangeItemAction(play) == PLAYER_IA_MOONS_TEAR) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; this->actionFunc = func_80ADBAB8; @@ -381,8 +381,8 @@ 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, PLAYER_IA_MOON_TEAR); + this->actor.isLockedOn) { + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 80.0f, PLAYER_IA_MOONS_TEAR); if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -423,10 +423,10 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { itemAction = func_80123810(play); if (itemAction > PLAYER_IA_NONE) { - if (itemAction == PLAYER_IA_MOON_TEAR) { + if (itemAction == PLAYER_IA_MOONS_TEAR) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; - player->exchangeItemId = itemAction; + player->exchangeItemAction = itemAction; this->actionFunc = func_80ADBAB8; } else { player->actor.textId = D_80ADD920[this->unk_33A]; @@ -470,7 +470,7 @@ void func_80ADBAB8(EnSellnuts* this, PlayState* play) { } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = func_80ADBBEC; func_800B7298(play, NULL, PLAYER_CSMODE_19); @@ -492,14 +492,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; this->actionFunc = func_80ADBC60; } @@ -516,10 +516,10 @@ void func_80ADBD64(EnSellnuts* this, PlayState* play) { } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_338 &= ~2; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_34C = 8; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 8); this->actionFunc = func_80ADBE80; @@ -558,7 +558,7 @@ void func_80ADBE80(EnSellnuts* this, PlayState* play) { void func_80ADBFA0(EnSellnuts* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if (this->unk_34C == 0) { this->actionFunc = func_80ADB544; @@ -713,7 +713,7 @@ void func_80ADC5A4(EnSellnuts* this, PlayState* play) { } } else if (func_80ADB08C(play) < 80.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, this->actor.xzDistToPlayer); + Actor_OfferTalk(&this->actor, play, this->actor.xzDistToPlayer); } } @@ -721,7 +721,7 @@ void func_80ADC6D0(EnSellnuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { @@ -751,7 +751,7 @@ void func_80ADC7B4(EnSellnuts* this, PlayState* play) { CutsceneManager_Queue(this->csId); } } else if ((this->unk_366 == 1) && (talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_366 = 0; CutsceneManager_Stop(this->csId); @@ -860,7 +860,7 @@ void func_80ADCC04(EnSellnuts* this, PlayState* play) { if (currentFrame == 0) { if (func_80ADB08C(play) < 9999.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 9999.0f); + Actor_OfferTalk(&this->actor, play, 9999.0f); } this->unk_340 = 0x626; this->unk_34C = 0; @@ -876,7 +876,7 @@ void func_80ADCD3C(EnSellnuts* this, PlayState* play) { this->unk_338 |= 2; this->unk_338 |= 1; this->unk_340 = 0x626; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.gravity = -1.0f; this->actor.draw = EnSellnuts_Draw; this->unk_34A = 50; @@ -953,7 +953,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubStandingAnim, this->jointTable, this->morphTable, 28); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); @@ -1003,7 +1003,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->actor.draw = NULL; this->unk_34C = 20; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_35C = 1.0f; this->unk_358 = 1.0f; this->unk_354 = 1.0f; @@ -1013,7 +1013,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { } else { this->unk_338 |= 2; this->unk_338 &= ~1; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.gravity = 0.0f; this->actor.draw = NULL; this->unk_34C = 4; @@ -1051,7 +1051,7 @@ void EnSellnuts_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); this->actionFunc(this, play); if (this->unk_338 & 8) { - func_800B9010(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); } func_80ADADD0(this, play); } @@ -1106,9 +1106,9 @@ s32 EnSellnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec if (limbIndex == 26) { if ((this->unk_34C == 6) || (this->unk_34C == 5) || (this->unk_34C == 7)) { - *dList = object_dnt_DL_001350; + *dList = gBusinessScrubEyesWideDL; } else { - *dList = object_dnt_DL_008290; + *dList = gBusinessScrubEyesDL; } } 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 643509515..158c80087 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -8,7 +8,7 @@ #include "z_en_shn.h" #include "z64snap.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnShn*)thisx) @@ -70,10 +70,10 @@ void func_80AE6130(EnShn* this) { 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 }, + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gBurlyGuyChinScratchAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBurlyGuyChinScratchAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; s32 phi_v0 = 0; s32 phi_v1 = 0; @@ -127,7 +127,7 @@ void func_80AE626C(EnShn* this) { this->unk_2BC = CLAMP(this->unk_2BC, -0x1FFE, 0x1FFE); Math_Vec3f_Copy(&shnPos, &this->actor.focus.pos); if (this->shnPlayerRef->actor.id == ACTOR_PLAYER) { - playerPos.y = this->shnPlayerRef->bodyPartsPos[7].y + 3.0f; + playerPos.y = this->shnPlayerRef->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&playerPos, &this->shnPlayerRef->actor.focus.pos); } @@ -290,25 +290,24 @@ s32 func_80AE68F0(EnShn* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 ret = false; - if (this->unk_1D8 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->unk_1D8 &= ~0x180; - if (player->exchangeItemId == PLAYER_IA_PICTO_BOX) { - this->unk_1D8 |= 0x80; - this->unk_2E4 = player->exchangeItemId; - } else if (player->exchangeItemId != PLAYER_IA_NONE) { - this->unk_1D8 |= 0x100; - this->unk_2E4 = player->exchangeItemId; - } - SubS_UpdateFlags(&this->unk_1D8, 0, 7); - this->unk_1DC = func_80AE6880(this, play); - this->unk_2C6 = 0; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08)) { - this->unk_1D8 |= 8; - } - this->actionFunc = func_80AE6A64; - ret = true; + if (((this->unk_1D8 & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->unk_1D8 &= ~0x180; + if (player->exchangeItemAction == PLAYER_IA_PICTOGRAPH_BOX) { + this->unk_1D8 |= 0x80; + this->unk_2E4 = player->exchangeItemAction; + } else if (player->exchangeItemAction != PLAYER_IA_NONE) { + this->unk_1D8 |= 0x100; + this->unk_2E4 = player->exchangeItemAction; } + SubS_SetOfferMode(&this->unk_1D8, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->unk_1DC = func_80AE6880(this, play); + this->unk_2C6 = 0; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_08)) { + this->unk_1D8 |= 8; + } + this->actionFunc = func_80AE6A64; + ret = true; } return ret; } @@ -328,7 +327,7 @@ void func_80AE6A64(EnShn* this, PlayState* play) { Vec3f shnPos; if (func_8010BF58(&this->actor, play, this->unk_1DC, this->unk_2D8, &this->unk_1E0)) { - SubS_UpdateFlags(&this->unk_1D8, 3, 7); + SubS_SetOfferMode(&this->unk_1D8, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_1D8 &= ~8; this->unk_1D8 |= 0x20; this->unk_2CA = 20; @@ -355,16 +354,16 @@ void EnShn_Init(Actor* thisx, PlayState* play) { } else { func_80AE615C(this, 2); } - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); this->unk_2E0 = 0; this->unk_2D8 = 0; this->unk_1D8 = 0; if (gSaveContext.save.entrance != ENTRANCE(TOURIST_INFORMATION, 2)) { - SubS_UpdateFlags(&this->unk_1D8, 3, 7); + SubS_SetOfferMode(&this->unk_1D8, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2BE = 0; } else { - SubS_UpdateFlags(&this->unk_1D8, 4, 7); + SubS_SetOfferMode(&this->unk_1D8, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); this->unk_2BE = 1; } this->actionFunc = func_80AE69E8; @@ -382,7 +381,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, PLAYER_IA_NONE, this->unk_1D8 & 7); + SubS_Offer(&this->actor, play, 120.0f, 40.0f, PLAYER_IA_NONE, this->unk_1D8 & SUBS_OFFER_MODE_MASK); } s32 EnShn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index cf44d641b..b75de6359 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -6,7 +6,7 @@ #include "z_en_si.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_200) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_200) #define THIS ((EnSi*)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 a8167009c..98223faea 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Encount4/z_en_encount4.h" #include "objects/object_skb/object_skb.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnSkb*)thisx) @@ -50,19 +50,19 @@ s32 func_80996594(EnSkb* this, PlayState* play); void func_80996BEC(EnSkb* this, PlayState* play); 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 }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, - { &object_skb_Anim_00270C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, - { &object_skb_Anim_00697C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, - { &object_skb_Anim_006D90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, - { &object_skb_Anim_001D1C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, - { &object_skb_Anim_002AC8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &object_skb_Anim_0015EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, - { &object_skb_Anim_0009E4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, + { &gStalchildWalkAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, + { &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, + { &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, + { &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, + { &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0 }, + { &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, }; static Vec3f D_80997468[] = { @@ -176,29 +176,29 @@ void func_809947B0(PlayState* play, EnSkb* this, Vec3f* inPos) { } void func_8099495C(EnSkb* this, PlayState* play) { - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_003584, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildStandUpAnim, this->jointTable, this->morphTable, + STALCHILD_LIMB_MAX); this->unk_3DC = 0; func_80994E2C(this); } void func_809949C4(EnSkb* this, PlayState* play) { - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildSitLaughAnim, this->jointTable, this->morphTable, + STALCHILD_LIMB_MAX); this->unk_3DC = 1; func_809952D8(this); } void func_80994A30(EnSkb* this, PlayState* play) { - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_006D90, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildSitTapToesAnim, this->jointTable, + this->morphTable, STALCHILD_LIMB_MAX); this->unk_3DC = 1; func_809953E8(this); } void func_80994A9C(EnSkb* this, PlayState* play) { - SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_001D1C, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildSwingOnBranchAnim, this->jointTable, + this->morphTable, STALCHILD_LIMB_MAX); this->unk_3DC = 1; func_809954F8(this); } @@ -288,7 +288,7 @@ void func_80994DA8(EnSkb* this, PlayState* play) { void func_80994E2C(EnSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); this->unk_3D0 = 0; this->unk_3DE = 0; @@ -300,7 +300,7 @@ void func_80994E94(EnSkb* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } Math_ApproachZeroF(&this->actor.shape.yOffset, 1.0f, 800.0f); @@ -327,7 +327,7 @@ void func_80994F7C(EnSkb* this, PlayState* play) { this->actionFunc = func_80995190; this->actor.speed = 0.0f; } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -351,13 +351,13 @@ void func_80995068(EnSkb* this, PlayState* play) { this->actionFunc = func_80995190; this->actor.speed = 0.0f; } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.hintId = TATL_HINT_ID_STALCHILD; this->actor.colChkInfo.mass = MASS_HEAVY; func_80995A30(this); } else if (!(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -388,8 +388,8 @@ void func_80995190(EnSkb* this, PlayState* play) { } void func_80995244(EnSkb* this, PlayState* play) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); this->unk_3E2 = 0; switch (this->unk_3DE) { @@ -423,8 +423,8 @@ void func_809952D8(EnSkb* this) { void func_8099533C(EnSkb* this, PlayState* play) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f)) { this->actor.hintId = TATL_HINT_ID_STALCHILD; @@ -445,8 +445,8 @@ void func_809953E8(EnSkb* this) { void func_8099544C(EnSkb* this, PlayState* play) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f)) { this->actor.hintId = TATL_HINT_ID_STALCHILD; @@ -482,8 +482,8 @@ void func_8099556C(EnSkb* this, PlayState* play) { this->actor.shape.rot.x = Math_SinS(this->unk_3D4 * sp26) * 20000.0f; if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f) && (this->skelAnime.curFrame > 24.0f) && (this->skelAnime.curFrame < 28.0f)) { @@ -535,10 +535,10 @@ void func_80995818(EnSkb* this, PlayState* play) { } void func_809958F4(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_Anim_003584, -1.0f, Animation_GetLastFrame(&object_skb_Anim_003584), + Animation_Change(&this->skelAnime, &gStalchildStandUpAnim, -1.0f, Animation_GetLastFrame(&gStalchildStandUpAnim), 0.0f, ANIMMODE_ONCE, -4.0f); this->unk_3E4 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->unk_3DE = 1; @@ -569,8 +569,8 @@ void func_80995A30(EnSkb* this) { void func_80995A8C(EnSkb* this, PlayState* play) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.hintId = TATL_HINT_ID_NONE; this->actor.colChkInfo.mass = MASS_HEAVY; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); @@ -620,7 +620,7 @@ void func_80995C84(EnSkb* this, PlayState* play) { } void func_80995D3C(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_Anim_002190, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &gStalchildAttackAnim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->unk_3DE = 4; @@ -735,7 +735,7 @@ void func_809961E4(EnSkb* this, PlayState* play) { this->actor.speed = -6.0f; } this->unk_3E4 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); this->unk_3DE = 7; this->actionFunc = func_80996284; @@ -795,7 +795,7 @@ void func_809963D8(EnSkb* this, PlayState* play) { void func_80996474(EnSkb* this) { this->unk_3D0 = 0; this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_809964A0; } @@ -1008,22 +1008,22 @@ void func_80996BEC(EnSkb* this, PlayState* play) { Vec3f sp84; s32 i; s16 yaw; - s32 end; + s32 bodyPartsCount; if (this->unk_3D8 & 2) { - end = 13; + bodyPartsCount = ENSKB_BODYPART_MAX - 1; } else { - end = 14; + bodyPartsCount = ENSKB_BODYPART_MAX; } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < end; i++) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); + for (i = 0; i < bodyPartsCount; i++) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyPartsPos[i]); sp84.x = Math_SinS(yaw) * 3.0f; sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); + EffectSsEnIce_Spawn(play, &this->bodyPartsPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); } } @@ -1118,11 +1118,11 @@ void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { - Matrix_MultZero(&this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } else if ((limbIndex == 11) && !(this->unk_3D8 & 2)) { - Matrix_MultVec3f(&D_80997564, &this->limbPos[this->limbCount]); - this->limbCount++; + Matrix_MultVec3f(&D_80997564, &this->bodyPartsPos[this->bodyPartsCount]); + this->bodyPartsCount++; } } } @@ -1130,13 +1130,13 @@ void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = THIS; - this->limbCount = 0; + this->bodyPartsCount = 0; Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, EnSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, - this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, this->bodyPartsCount, this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } if (this->unk_3D8 & 0x40) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 1970ebf8c..983e8cc5d 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -13,6 +13,24 @@ typedef enum { /* 0 */ ENSKB_PARAM_0 } EnSkbParam; +typedef enum EnSkbBodyPart { + /* 0 */ ENSKB_BODYPART_0, + /* 1 */ ENSKB_BODYPART_1, + /* 2 */ ENSKB_BODYPART_2, + /* 3 */ ENSKB_BODYPART_3, + /* 4 */ ENSKB_BODYPART_4, + /* 5 */ ENSKB_BODYPART_5, + /* 6 */ ENSKB_BODYPART_6, + /* 7 */ ENSKB_BODYPART_7, + /* 8 */ ENSKB_BODYPART_8, + /* 9 */ ENSKB_BODYPART_9, + /* 10 */ ENSKB_BODYPART_10, + /* 11 */ ENSKB_BODYPART_11, + /* 12 */ ENSKB_BODYPART_12, + /* 13 */ ENSKB_BODYPART_13, + /* 14 */ ENSKB_BODYPART_MAX +} EnSkbBodyPart; + typedef struct EnSkb { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -21,8 +39,8 @@ typedef struct EnSkb { /* 0x228 */ EnSkbActionFunc actionFunc; /* 0x22C */ f32 drawDmgEffAlpha; /* 0x230 */ f32 drawDmgEffScale; - /* 0x234 */ Vec3f limbPos[14]; - /* 0x2DC */ s32 limbCount; + /* 0x234 */ Vec3f bodyPartsPos[ENSKB_BODYPART_MAX]; + /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ Vec3s jointTable[20]; /* 0x358 */ Vec3s morphTable[20]; /* 0x3D0 */ s16 unk_3D0; diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 5e71d1a54..79dfe2ced 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -5,8 +5,9 @@ */ #include "z_en_slime.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_200) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_200) #define THIS ((EnSlime*)thisx) @@ -153,22 +154,25 @@ static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; static Vec3f sBubbleAccel = { 0.0f, -0.8f, 0.0f }; static Color_RGBA8 sPrimColors[] = { - { 255, 255, 255, 255 }, - { 255, 255, 0, 255 }, - { 255, 255, 200, 255 }, - { 225, 200, 255, 255 }, + { 255, 255, 255, 255 }, // EN_SLIME_TYPE_BLUE + { 255, 255, 0, 255 }, // EN_SLIME_TYPE_GREEN + { 255, 255, 200, 255 }, // EN_SLIME_TYPE_YELLOW + { 225, 200, 255, 255 }, // EN_SLIME_TYPE_RED }; static Color_RGBA8 sEnvColors[] = { - { 140, 255, 195, 255 }, - { 50, 255, 0, 255 }, - { 255, 180, 0, 255 }, - { 255, 50, 155, 255 }, + { 140, 255, 195, 255 }, // EN_SLIME_TYPE_BLUE + { 50, 255, 0, 255 }, // EN_SLIME_TYPE_GREEN + { 255, 180, 0, 255 }, // EN_SLIME_TYPE_YELLOW + { 255, 50, 155, 255 }, // EN_SLIME_TYPE_RED }; -static Vec3f sLimbPosOffsets[EN_SLIME_LIMBPOS_COUNT] = { - { 2000.0f, 2000.0f, 0.0f }, { -1500.0f, 2500.0f, -500.0f }, { -500.0f, 1000.0f, 2500.0f }, - { 0.0f, 4000.0f, 0.0f }, { 0.0f, 2000.0f, -2000.0f }, +static Vec3f sBodyPartPosOffsets[EN_SLIME_BODYPART_MAX] = { + { 2000.0f, 2000.0f, 0.0f }, // EN_SLIME_BODYPART_0 + { -1500.0f, 2500.0f, -500.0f }, // EN_SLIME_BODYPART_1 + { -500.0f, 1000.0f, 2500.0f }, // EN_SLIME_BODYPART_2 + { 0.0f, 4000.0f, 0.0f }, // EN_SLIME_BODYPART_3 + { 0.0f, 2000.0f, -2000.0f }, // EN_SLIME_BODYPART_4 }; AnimatedMaterial* sSlimeTexAnim; @@ -262,7 +266,7 @@ void EnSlime_Thaw(EnSlime* this, PlayState* play) { this->drawDmgEffType = 0; // So it's not triggered again until Freeze has been called again. this->collider.base.colType = COLTYPE_NONE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_SLIME_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -776,7 +780,7 @@ void EnSlime_Dead(EnSlime* this, PlayState* play) { if (this->actor.params == EN_SLIME_TYPE_YELLOW) { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); } else if (this->actor.params == EN_SLIME_TYPE_GREEN) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_SMALL); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_JAR_SMALL); } else if (this->actor.params == EN_SLIME_TYPE_RED) { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RECOVERY_HEART); } @@ -812,7 +816,7 @@ f32 EnSlime_SnapIceBlockPosition(f32 currentPosition, f32 homePosition) { */ void EnSlime_SetupSpawnIceBlock(EnSlime* this) { this->collider.base.acFlags &= ~AC_ON; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->drawDmgEffAlpha = 0.0f; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; @@ -849,7 +853,7 @@ void EnSlime_SpawnIceBlock(EnSlime* this, PlayState* play) { this->actor.colorFilterTimer = 0; this->collider.base.acFlags |= AC_ON; this->iceBlockTimer = ICE_BLOCK_UNUSED; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.gravity = -2.0f; EnSlime_SetupIdle(this); } @@ -937,7 +941,7 @@ void EnSlime_IceBlockThaw(EnSlime* this, PlayState* play) { if (this->iceBlockTimer == ICE_BLOCK_UNUSED) { this->collider.base.acFlags |= AC_ON; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.flags &= ~ACTOR_FLAG_10; EnSlime_SetupIdle(this); } @@ -999,7 +1003,7 @@ void EnSlime_Revive(EnSlime* this, PlayState* play) { this->timer++; if (this->timer == 28) { this->actor.flags &= ~ACTOR_FLAG_10; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->collider.base.acFlags |= AC_ON; this->actor.shape.rot.y = this->actor.home.rot.y; EnSlime_SetupMoveInDirection(this); @@ -1061,7 +1065,7 @@ void EnSlime_UpdateDamage(EnSlime* this, PlayState* play) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_SetDropFlag(&this->actor, &this->collider.info); Enemy_StartFinishingBlow(play, &this->actor); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_BLUNT) { @@ -1090,7 +1094,7 @@ void EnSlime_UpdateDamage(EnSlime* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } else if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_ELECTRIC) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffAlpha = 4.0f; @@ -1120,7 +1124,9 @@ void EnSlime_Update(Actor* thisx, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_ON) { Actor_MoveWithGravity(thisx); - Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 35.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 35.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } Collider_UpdateCylinder(thisx, &this->collider); @@ -1152,7 +1158,7 @@ void EnSlime_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.2f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.4f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.4f, 0.01f)) { - func_800B9010(thisx, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1214,8 +1220,8 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gChuchuEyesDL); } - for (i = 0; i < EN_SLIME_LIMBPOS_COUNT; i++) { - Matrix_MultVec3f(&sLimbPosOffsets[i], &this->limbPos[i]); + for (i = 0; i < EN_SLIME_BODYPART_MAX; i++) { + Matrix_MultVec3f(&sBodyPartPosOffsets[i], &this->bodyPartsPos[i]); } if (this->actionFunc == EnSlime_Revive) { @@ -1240,7 +1246,7 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_SLIME_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.h b/src/overlays/actors/ovl_En_Slime/z_en_slime.h index 130c442de..fbae533ea 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.h +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.h @@ -5,14 +5,29 @@ #include "objects/object_slime/object_slime.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define EN_SLIME_LIMBPOS_COUNT 5 +struct EnSlime; + +typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); + #define EN_SLIME_GET_TYPE(thisx) ((thisx)->params) #define EN_SLIME_GET_REVIVE_TIME(thisx) ((((thisx)->params) >> 8) & 0xFF) -struct EnSlime; +typedef enum EnSlimeType { + /* 0 */ EN_SLIME_TYPE_BLUE, + /* 1 */ EN_SLIME_TYPE_GREEN, + /* 2 */ EN_SLIME_TYPE_YELLOW, + /* 3 */ EN_SLIME_TYPE_RED +} EnSlimeType; -typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); +typedef enum EnSlimeBodyPart { + /* 0 */ EN_SLIME_BODYPART_0, + /* 1 */ EN_SLIME_BODYPART_1, + /* 2 */ EN_SLIME_BODYPART_2, + /* 3 */ EN_SLIME_BODYPART_3, + /* 4 */ EN_SLIME_BODYPART_4, + /* 5 */ EN_SLIME_BODYPART_MAX +} EnSlimeBodyPart; typedef struct EnSlime { /* 0x000 */ Actor actor; @@ -34,15 +49,8 @@ typedef struct EnSlime { /* 0x16C */ f32 drawDmgEffFrozenSteamScale; /* 0x170 */ f32 distLimit; /* 0x174 */ Vec3f reviveScale; - /* 0x180 */ Vec3f limbPos[EN_SLIME_LIMBPOS_COUNT]; + /* 0x180 */ Vec3f bodyPartsPos[EN_SLIME_BODYPART_MAX]; /* 0x1BC */ ColliderCylinder collider; } EnSlime; // size = 0x208 -typedef enum EnSlimeType { - /* 0 */ EN_SLIME_TYPE_BLUE, - /* 1 */ EN_SLIME_TYPE_GREEN, - /* 2 */ EN_SLIME_TYPE_YELLOW, - /* 3 */ EN_SLIME_TYPE_RED -} EnSlimeType; - #endif // Z_EN_SLIME_H diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index e22a5a73b..f1be3d5f4 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -5,8 +5,9 @@ */ #include "z_en_snowman.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnSnowman*)thisx) @@ -240,7 +241,7 @@ void EnSnowman_Init(Actor* thisx, PlayState* play) { } else { Player* player = GET_PLAYER(play); - thisx->flags &= ~ACTOR_FLAG_1; + thisx->flags &= ~ACTOR_FLAG_TARGETABLE; Collider_InitAndSetCylinder(play, &this->collider, thisx, &sSnowballCylinderInit); thisx->world.rot.y = Actor_WorldYawTowardActor(thisx, &player->actor); thisx->velocity.y = (Actor_WorldDistXZToActor(thisx, &player->actor) * 0.035f) + -5.0f; @@ -356,9 +357,9 @@ void EnSnowman_MoveSnowPile(EnSnowman* this, PlayState* play) { SkelAnime_Update(&this->snowPileSkelAnime); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { - func_800B9010(&this->actor, NA_SE_EN_YMAJIN_MOVE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_YMAJIN_MOVE - SFX_FLAG); } else { - func_800B9010(&this->actor, NA_SE_EN_YMAJIN_MINI_MOVE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_YMAJIN_MINI_MOVE - SFX_FLAG); } if (this->work.timer > 0) { @@ -602,7 +603,7 @@ void EnSnowman_SetupMelt(EnSnowman* this) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 50); this->collider.base.acFlags &= ~AC_ON; this->work.timer = 50; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; this->actor.scale.y = this->actor.scale.x; this->actor.speed = 0.0f; @@ -691,11 +692,11 @@ void EnSnowman_SetupDamaged(EnSnowman* this) { * Otherwise, it will either submerge underground (if it has health remaining) or die. */ void EnSnowman_Damaged(EnSnowman* this, PlayState* play) { - s32 rotationalVelocityScale; + s32 angularVelocityScale; SkelAnime_Update(&this->skelAnime); - rotationalVelocityScale = CLAMP_MAX(this->work.timer, 10); - this->actor.shape.rot.y += rotationalVelocityScale * 0x300; + angularVelocityScale = CLAMP_MAX(this->work.timer, 10); + this->actor.shape.rot.y += angularVelocityScale * 0x300; Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { @@ -786,7 +787,7 @@ void EnSnowman_SetupSplitDoNothing(EnSnowman* this) { this->combineState = EN_SNOWMAN_COMBINE_STATE_NO_ABSORPTION; } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_10); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10); if ((this->actor.parent != NULL) && (((EnSnowman*)this->actor.parent)->actionFunc == EnSnowman_SplitDoNothing)) { if ((this->actor.child != NULL) && (((EnSnowman*)this->actor.child)->actionFunc == EnSnowman_SplitDoNothing)) { EnSnowman_SetupKill((EnSnowman*)this->actor.parent); @@ -821,7 +822,7 @@ void EnSnowman_Kill(EnSnowman* this, PlayState* play) { * Creates a small split Eeno with a certain Y-rotation and at a certain offset from basePos. */ void EnSnowman_CreateSplitEeno(EnSnowman* this, Vec3f* basePos, s32 yRot) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.shape.rot.y = yRot; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1009,7 +1010,7 @@ void EnSnowman_UpdateDamage(EnSnowman* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } } } @@ -1124,11 +1125,21 @@ void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play) { /** * This maps a given limb based on its limbIndex to its appropriate index - * in the bodyPartsPos array. An index of -1 indicates that the limb is - * not part of the bodyPartsPos array. + * in the bodyPartsPos array. */ -static s8 sLimbIndexToBodyPartsPosIndex[] = { - -1, -1, -1, -1, -1, -1, 0, 1, -1, 2, 3, 4, +static s8 sLimbToBodyParts[EENO_LIMB_MAX] = { + BODYPART_NONE, // EENO_LIMB_NONE + BODYPART_NONE, // EENO_LIMB_ROOT + BODYPART_NONE, // EENO_LIMB_BODY_TOP + BODYPART_NONE, // EENO_LIMB_LEFT_EYE + BODYPART_NONE, // EENO_LIMB_RIGHT_EYE + BODYPART_NONE, // EENO_LIMB_LEFT_UPPER_ARM + EN_SNOWMAN_BODYPART_0, // EENO_LIMB_LEFT_FOREARM + EN_SNOWMAN_BODYPART_1, // EENO_LIMB_LEFT_HAND + BODYPART_NONE, // EENO_LIMB_RIGHT_UPPER_ARM + EN_SNOWMAN_BODYPART_2, // EENO_LIMB_RIGHT_FOREARM + EN_SNOWMAN_BODYPART_3, // EENO_LIMB_RIGHT_HAND + EN_SNOWMAN_BODYPART_4, // EENO_LIMB_BODY_BOTTOM }; /** @@ -1136,8 +1147,11 @@ static s8 sLimbIndexToBodyPartsPosIndex[] = { * bottom limb, each offset by a certain certain amount. */ static Vec3f sBodyBottomBodyPartOffsets[] = { - { 2000.0f, 3000.0f, 0.0f }, { 2000.0f, -2000.0f, 0.0f }, { 3000.0f, 0.0f, 0.0f }, - { 1000.0f, 0.0f, 3000.0f }, { 1000.0f, 0.0f, -3000.0f }, + { 2000.0f, 3000.0f, 0.0f }, // EN_SNOWMAN_BODYPART_4 + { 2000.0f, -2000.0f, 0.0f }, // EN_SNOWMAN_BODYPART_5 + { 3000.0f, 0.0f, 0.0f }, // EN_SNOWMAN_BODYPART_6 + { 1000.0f, 0.0f, 3000.0f }, // EN_SNOWMAN_BODYPART_7 + { 1000.0f, 0.0f, -3000.0f }, // EN_SNOWMAN_BODYPART_8 }; void EnSnowman_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { @@ -1146,13 +1160,13 @@ void EnSnowman_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Gfx* gfx; s32 i; - if (sLimbIndexToBodyPartsPosIndex[limbIndex] != -1) { - if (sLimbIndexToBodyPartsPosIndex[limbIndex] == 4) { - for (i = 0; i < 5; i++) { - Matrix_MultVec3f(&sBodyBottomBodyPartOffsets[i], &this->bodyPartsPos[i + 4]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + if (sLimbToBodyParts[limbIndex] == EN_SNOWMAN_BODYPART_4) { + for (i = 0; i < ARRAY_COUNT(sBodyBottomBodyPartOffsets); i++) { + Matrix_MultVec3f(&sBodyBottomBodyPartOffsets[i], &this->bodyPartsPos[EN_SNOWMAN_BODYPART_4 + i]); } } else { - Matrix_MultZero(&this->bodyPartsPos[sLimbIndexToBodyPartsPosIndex[limbIndex]]); + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } } @@ -1185,7 +1199,7 @@ void EnSnowman_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnSnowman_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_SNOWMAN_BODYPART_MAX, this->drawDmgEffScale * this->eenoScale, 0.0f, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h index 55285fec8..2533c2595 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h @@ -19,6 +19,19 @@ struct EnSnowman; typedef void (*EnSnowmanActionFunc)(struct EnSnowman*, PlayState*); +typedef enum EnSnowmanBodyPart { + /* 0 */ EN_SNOWMAN_BODYPART_0, + /* 1 */ EN_SNOWMAN_BODYPART_1, + /* 2 */ EN_SNOWMAN_BODYPART_2, + /* 3 */ EN_SNOWMAN_BODYPART_3, + /* 4 */ EN_SNOWMAN_BODYPART_4, + /* 5 */ EN_SNOWMAN_BODYPART_5, + /* 6 */ EN_SNOWMAN_BODYPART_6, + /* 7 */ EN_SNOWMAN_BODYPART_7, + /* 8 */ EN_SNOWMAN_BODYPART_8, + /* 9 */ EN_SNOWMAN_BODYPART_MAX +} EnSnowmanBodyPart; + typedef struct EnSnowman { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -50,7 +63,7 @@ typedef struct EnSnowman { /* 0x2A4 */ f32 drawDmgEffScale; /* 0x2A8 */ Vec3f combinePos; /* 0x2B4 */ Vec3f snowballPos; - /* 0x2C0 */ Vec3f bodyPartsPos[9]; + /* 0x2C0 */ Vec3f bodyPartsPos[EN_SNOWMAN_BODYPART_MAX]; /* 0x32C */ ColliderCylinder collider; } EnSnowman; // size = 0x378 diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c index 48a1cfea0..b99673197 100644 --- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c +++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c @@ -5,6 +5,7 @@ */ #include "z_en_snowwd.h" +#include "objects/object_snowwd/object_snowwd.h" #define FLAGS 0x00000000 @@ -15,9 +16,8 @@ void EnSnowwd_Destroy(Actor* thisx, PlayState* play); void EnSnowwd_Update(Actor* thisx, PlayState* play); void EnSnowwd_Draw(Actor* thisx, PlayState* play); -void func_80AF76F0(EnSnowwd* this, PlayState* play); +void EnSnowwd_Idle(EnSnowwd* this, PlayState* play); -#if 0 ActorInit En_Snowwd_InitVars = { ACTOR_EN_SNOWWD, ACTORCAT_PROP, @@ -30,25 +30,105 @@ ActorInit En_Snowwd_InitVars = { (ActorFunc)EnSnowwd_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80AF7A90 = { - { COLTYPE_TREE, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0x0100020A, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_TREE, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK5, + { 0x00000000, 0x00, 0x00 }, + { 0x0100020A, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 60, 0, { 0, 0, 0 } }, }; -#endif +void EnSnowwd_Init(Actor* thisx, PlayState* play) { + EnSnowwd* this = THIS; -extern ColliderCylinderInit D_80AF7A90; + SNOWWD_DROPPED_COLLECTIBLE(thisx) = false; + this->actor.home.rot.y = 0; + this->timer = 0; + this->actor.uncullZoneForward = 4000.0f; + this->actor.uncullZoneScale = 2000.0f; + this->actor.uncullZoneDownward = 2400.0f; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Actor_SetScale(&this->actor, 1.0f); + this->actionFunc = EnSnowwd_Idle; +} -extern UNK_TYPE D_06001AA0; +void EnSnowwd_Destroy(Actor* thisx, PlayState* play) { + EnSnowwd* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Init.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Destroy.s") +void EnSnowwd_Idle(EnSnowwd* this, PlayState* play) { + static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; + static Vec3f sVelocity = { 0.0f, -4.0f, 0.0f }; + static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEnvColor = { 200, 200, 220, 0 }; + s32 pad; + Actor* thisx = &this->actor; + f32 wobbleAmplitude; + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/func_80AF76F0.s") + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_PlaySfx(thisx, NA_SE_IT_REFLECTION_WOOD); + } + if (thisx->home.rot.y != 0) { + this->timer = 21; + thisx->home.rot.y = 0; + if (!SNOWWD_DROPPED_COLLECTIBLE(&this->actor)) { + if (SNOWWD_GET_DROP_TABLE(&this->actor) < 16) { + pos = thisx->world.pos; + pos.y += 200.0f; + Item_DropCollectibleRandom(play, NULL, &pos, SNOWWD_GET_DROP_TABLE(&this->actor) * DROP_TABLE_SIZE); + } + SNOWWD_DROPPED_COLLECTIBLE(&this->actor) = true; + } + } + if (thisx->xzDistToPlayer < 600.0f) { + Collider_UpdateCylinder(thisx, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Update.s") + // Wobble from impact and dust particles + if (this->timer > 0) { + this->timer--; + wobbleAmplitude = Math_SinS((this->timer ^ 0xFFFF) * 0x3332) * 250.0f; + thisx->shape.rot.x = Math_CosS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * wobbleAmplitude; + thisx->shape.rot.z = Math_SinS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * wobbleAmplitude; + pos = thisx->world.pos; + pos.x += Rand_CenteredFloat(80.0f); + pos.y += 100.0f + Rand_ZeroFloat(30.0f); + pos.z += Rand_CenteredFloat(80.0f); + func_800B0EB0(play, &pos, &sVelocity, &sAccel, &sPrimColor, &sEnvColor, 200, 10, 20); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Draw.s") +void EnSnowwd_Update(Actor* thisx, PlayState* play) { + EnSnowwd* this = THIS; + + this->actionFunc(this, play); +} + +void EnSnowwd_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); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gSnowTreeSnowLeavesTex)); + gSPDisplayList(POLY_OPA_DISP++, gSnowTreeDL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h index a83e5d05a..8adb7fcda 100644 --- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h +++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h @@ -3,13 +3,17 @@ #include "global.h" +#define SNOWWD_GET_DROP_TABLE(thisx) (((thisx)->params & 0xF80) >> 7) +#define SNOWWD_DROPPED_COLLECTIBLE(thisx) ((thisx)->home.rot.z) + struct EnSnowwd; typedef void (*EnSnowwdActionFunc)(struct EnSnowwd*, PlayState*); typedef struct EnSnowwd { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x50]; + /* 0x144 */ ColliderCylinder collider; + /* 0x190 */ s16 timer; /* 0x194 */ EnSnowwdActionFunc actionFunc; } EnSnowwd; // size = 0x198 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 3cd33653b..901e49126 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -9,7 +9,7 @@ #include "objects/object_masterzoora/object_masterzoora.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnSob1*)thisx) @@ -176,7 +176,7 @@ void EnSob1_SetupAction(EnSob1* this, EnSob1ActionFunc action) { s32 EnSob1_TestItemSelected(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || @@ -190,7 +190,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { if (this->shopType == BOMB_SHOP) { if ((gSaveContext.save.day == 1) && (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { return 0x648; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { return 0x649; } else { return 0x64A; @@ -270,34 +270,34 @@ u16 EnSob1_GetWelcome(EnSob1* this, PlayState* play) { } else if (this->shopType == ZORA_SHOP) { switch (player->transformation) { case PLAYER_FORM_HUMAN: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_HUMAN)) { return 0x12CF; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_57_10); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_HUMAN); return 0x12CE; } case PLAYER_FORM_DEKU: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_DEKU)) { return 0x12D1; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_57_20); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_DEKU); return 0x12D0; } case PLAYER_FORM_GORON: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_GORON)) { return 0x12D3; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_57_40); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_GORON); return 0x12D2; } case PLAYER_FORM_ZORA: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_57_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_ZORA)) { return 0x12D5; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_57_80); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_ZORA); return 0x12D4; } @@ -306,33 +306,33 @@ u16 EnSob1_GetWelcome(EnSob1* this, PlayState* play) { } } else if (this->shopType == GORON_SHOP) { if (player->transformation != PLAYER_FORM_GORON) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_04)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_NON_GORON)) { return 0xBB9; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_58_04); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_NON_GORON); return 0xBB8; } } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_GORON)) { return 0xBBB; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_58_08); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_GORON); return 0xBBA; } } } else if (this->shopType == GORON_SHOP_SPRING) { if (player->transformation != PLAYER_FORM_GORON) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_NON_GORON)) { return 0xBBD; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_58_10); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_NON_GORON); return 0xBBC; } } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_GORON)) { return 0xBBF; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_58_20); + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_GORON); return 0xBBE; } } @@ -379,22 +379,22 @@ void EnSob1_SpawnShopItems(EnSob1* this, PlayState* play, ShopItem* shopItem) { } } -s32 EnSob1_GetObjIndices(EnSob1* this, PlayState* play, s16* objIds) { - if (objIds[1] != OBJECT_ID_MAX) { - this->unusedObjIndex = Object_GetIndex(&play->objectCtx, objIds[1]); - if (this->unusedObjIndex < 0) { +s32 EnSob1_GetObjectIndices(EnSob1* this, PlayState* play, s16* objectIds) { + if (objectIds[1] != OBJECT_ID_MAX) { + this->unusedObjectSlot = Object_GetSlot(&play->objectCtx, objectIds[1]); + if (this->unusedObjectSlot <= OBJECT_SLOT_NONE) { return false; } } else { - this->unusedObjIndex = -1; + this->unusedObjectSlot = OBJECT_SLOT_NONE; } - if (objIds[2] != OBJECT_ID_MAX) { - this->shopkeeperAnimObjIndex = Object_GetIndex(&play->objectCtx, objIds[2]); - if (this->shopkeeperAnimObjIndex < 0) { + if (objectIds[2] != OBJECT_ID_MAX) { + this->shopkeeperAnimObjectSlot = Object_GetSlot(&play->objectCtx, objectIds[2]); + if (this->shopkeeperAnimObjectSlot <= OBJECT_SLOT_NONE) { return false; } } else { - this->shopkeeperAnimObjIndex = -1; + this->shopkeeperAnimObjectSlot = OBJECT_SLOT_NONE; } return true; } @@ -402,7 +402,7 @@ s32 EnSob1_GetObjIndices(EnSob1* this, PlayState* play, s16* objIds) { void EnSob1_Init(Actor* thisx, PlayState* play) { EnSob1* this = THIS; s32 pad; - s16* objIds; + s16* objectIds; switch (ENSOB1_GET_SHOPTYPE(thisx)) { case ZORA_SHOP: @@ -426,13 +426,13 @@ void EnSob1_Init(Actor* thisx, PlayState* play) { return; } - objIds = sObjectIds[this->shopType]; - this->mainObjIndex = Object_GetIndex(&play->objectCtx, objIds[0]); - if (this->mainObjIndex < 0) { + objectIds = sObjectIds[this->shopType]; + this->mainObjectSlot = Object_GetSlot(&play->objectCtx, objectIds[0]); + if (this->mainObjectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } - if (!EnSob1_GetObjIndices(this, play, objIds)) { + if (!EnSob1_GetObjectIndices(this, play, objectIds)) { Actor_Kill(&this->actor); return; } @@ -466,7 +466,7 @@ void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; @@ -526,7 +526,7 @@ void EnSob1_TalkToShopkeeper(PlayState* play, EnSob1* this) { } void EnSob1_SetupLookToShopkeeperFromShelf(PlayState* play, EnSob1* this) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_LookToShopkeeperFromShelf); } @@ -571,7 +571,7 @@ void EnSob1_Idle(EnSob1* this, PlayState* play) { player->actor.world.pos.x <= this->posXZRange.xMax) && (player->actor.world.pos.z >= this->posXZRange.zMin && player->actor.world.pos.z <= this->posXZRange.zMax)) { - func_800B8614(&this->actor, play, 400.0f); + Actor_OfferTalk(&this->actor, play, 400.0f); } if (this->wasTalkedToWhileWalking == true) { this->wasTalkedToWhileWalking = false; @@ -649,12 +649,12 @@ void EnSob1_Hello(EnSob1* this, PlayState* play) { s32 EnSob1_FacingShopkeeperDialogResult(EnSob1* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); EnSob1_TalkToShopkeeper(play, this); return true; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); if (this->shopType == BOMB_SHOP) { EnSob1_BombShopkeeper_EndInteraction(this, play); } else { @@ -697,7 +697,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { EnSob1_SetupAction(this, EnSob1_LookToShelf); func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -826,7 +826,7 @@ void EnSob1_Walking(EnSob1* this, PlayState* play) { player->actor.world.pos.x <= this->posXZRange.xMax) && (player->actor.world.pos.z >= this->posXZRange.zMin && player->actor.world.pos.z <= this->posXZRange.zMax)) { - func_800B8614(&this->actor, play, 400.0f); + Actor_OfferTalk(&this->actor, play, 400.0f); } } } @@ -851,7 +851,7 @@ void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_ContinueTextbox(play, 0x647); } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -912,13 +912,13 @@ s32 EnSob1_HasPlayerSelectedItem(PlayState* play, EnSob1* this, Input* input) { if (!item->isOutOfStock) { this->prevActionFunc = this->actionFunc; Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_SelectItem); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } return true; } @@ -946,7 +946,7 @@ void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { cursorIndex = this->cursorIndex; if (cursorIndex != prevCursorIndex) { Message_ContinueTextbox(play, this->items[cursorIndex]->actor.textId); - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -957,7 +957,7 @@ void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { Player* player = GET_PLAYER(play); Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); @@ -985,7 +985,7 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item2 = this->items[this->cursorIndex]; item2->buyFanfareFunc(play, item2); EnSob1_SetupBuyItemWithFanfare(play, this); @@ -995,7 +995,7 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { break; case CANBUY_RESULT_SUCCESS_2: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item->buyFunc(play, item); if ((this->shopType == GORON_SHOP) && (item->actor.params == SI_POTION_RED_5)) { EnSob1_SetupCanBuy(play, this, 0xBD7); @@ -1012,42 +1012,42 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { break; case CANBUY_RESULT_NO_ROOM: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNoRoomTextIds[this->shopType]); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNeedEmptyBottleTextIds[this->shopType]); break; case CANBUY_RESULT_NEED_RUPEES: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNeedRupeesTextIds[this->shopType]); break; case CANBUY_RESULT_CANNOT_GET_NOW: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sCannotGetNowTextIds[this->shopType]); break; case CANBUY_RESULT_CANNOT_GET_NOW_2: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sCannotGetNow2TextIds[this->shopType]); break; case CANBUY_RESULT_NO_ROOM_2: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNoRoom2TextIds[this->shopType]); break; case CANBUY_RESULT_ALREADY_HAVE: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, 0x658); break; case CANBUY_RESULT_HAVE_BETTER: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, 0x659); break; @@ -1068,7 +1068,7 @@ void EnSob1_SelectItem(EnSob1* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actionFunc = this->prevActionFunc; Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); break; @@ -1110,7 +1110,7 @@ void EnSob1_BuyItemWithFanfare(EnSob1* this, PlayState* play) { void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; EnSob1_SetupAction(this, EnSob1_ItemPurchased); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { @@ -1120,7 +1120,7 @@ void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { this->csId = this->lookToShopkeeperCsId; CutsceneManager_Queue(this->csId); } - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1136,7 +1136,7 @@ void EnSob1_ContinueShopping(EnSob1* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_20000000; Message_StartTextbox(play, this->welcomeTextId, &this->actor); EnSob1_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -1345,15 +1345,16 @@ void EnSob1_Blink(EnSob1* this) { } void EnSob1_ChangeObject(EnSob1* this, PlayState* play) { - gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); } s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->mainObjIndex)) { - if ((this->unusedObjIndex >= 0) && !Object_IsLoaded(&play->objectCtx, this->unusedObjIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->mainObjectSlot)) { + if ((this->unusedObjectSlot > OBJECT_SLOT_NONE) && !Object_IsLoaded(&play->objectCtx, this->unusedObjectSlot)) { return false; } - if ((this->shopkeeperAnimObjIndex >= 0) && !Object_IsLoaded(&play->objectCtx, this->shopkeeperAnimObjIndex)) { + if ((this->shopkeeperAnimObjectSlot > OBJECT_SLOT_NONE) && + !Object_IsLoaded(&play->objectCtx, this->shopkeeperAnimObjectSlot)) { return false; } return true; @@ -1363,7 +1364,7 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_ZoraShopkeeper_Draw; @@ -1372,7 +1373,7 @@ void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { void EnSob1_GoronShopkeeper_Init(EnSob1* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->shopkeeperAnimObjectSlot].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_GoronShopkeeper_Draw; @@ -1394,14 +1395,14 @@ void EnSob1_InitShop(EnSob1* this, PlayState* play) { if (EnSob1_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_10; - this->actor.objBankIndex = this->mainObjIndex; + this->actor.objectSlot = this->mainObjectSlot; Actor_SetObjectDependency(play, &this->actor); posOffset = &sPosOffset[this->shopType]; this->actor.world.pos.x += posOffset->x; this->actor.world.pos.y += posOffset->y; this->actor.world.pos.z += posOffset->z; shopItems = sShops[this->shopType]; - if ((this->shopType == BOMB_SHOP) && CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + if ((this->shopType == BOMB_SHOP) && CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { sShops[this->shopType][0].shopItemId = SI_BOMB_BAG_30_2; } @@ -1482,7 +1483,7 @@ void EnSob1_InitShop(EnSob1* this, PlayState* play) { this->blinkTimer = 20; this->eyeTexIndex = 0; this->blinkFunc = EnSob1_WaitForBlink; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h index 12c14301b..2ae018ce4 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h @@ -36,9 +36,9 @@ typedef struct EnSob1 { /* 0x1E0 */ Path* path; /* 0x1E4 */ s32 waypoint; /* 0x1E8 */ s16 delayTimer; - /* 0x1EA */ s8 mainObjIndex; - /* 0x1EB */ s8 unusedObjIndex; - /* 0x1EC */ s8 shopkeeperAnimObjIndex; + /* 0x1EA */ s8 mainObjectSlot; + /* 0x1EB */ s8 unusedObjectSlot; + /* 0x1EC */ s8 shopkeeperAnimObjectSlot; /* 0x1EE */ s16 headRot; /* 0x1F0 */ s16 headRotTarget; /* 0x1F2 */ Vec3s jointTable[ENSOB1_LIMB_MAX]; 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 358a8eeec..c7006f087 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -6,8 +6,9 @@ #include "z_en_ssh.h" #include "objects/object_ssh/object_ssh.h" +#include "objects/object_st/object_st.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnSsh*)thisx) @@ -325,9 +326,9 @@ void EnSsh_Stunned(EnSsh* this, PlayState* play) { if (this->stunTimer < 30) { if (this->stunTimer & 1) { - this->actor.shape.rot.y += 2000; + this->actor.shape.rot.y += 0x7D0; } else { - this->actor.shape.rot.y -= 2000; + this->actor.shape.rot.y -= 0x7D0; } } } @@ -627,13 +628,15 @@ void EnSsh_SetColliders(EnSsh* this, PlayState* play) { } void EnSsh_Init(Actor* thisx, PlayState* play) { - // @bug - this symbol no longer exists, reads from a random place in object_ssh_Tex_000190 instead - f32 frameCount = Animation_GetLastFrame(&D_06000304); + //! @bug: object_st_Anim_000304 is similar if not idential to object_ssh_Anim_001494. + //! They also shared the same offset into their respective object files in OoT. + //! However since object_ssh is the one loaded, this ends up reading garbage data from within object_ssh_Tex_000190. + f32 frameCount = Animation_GetLastFrame(&object_st_Anim_000304); s32 pad; EnSsh* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphtable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphTable, 30); Animation_Change(&this->skelAnime, &object_ssh_Anim_001494, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP_INTERP, 0.0f); this->blureIdx = EnSsh_CreateBlureEffect(play); EnSsh_InitColliders(this, play); @@ -747,7 +750,7 @@ void EnSsh_Idle(EnSsh* this, PlayState* play) { if ((this->unkTimer == 0) && (this->animTimer == 0) && (this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 6f19a5e51..8c95ea628 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -31,7 +31,7 @@ typedef struct EnSsh { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[30]; - /* 0x23C */ Vec3s morphtable[30]; + /* 0x23C */ Vec3s morphTable[30]; /* 0x2F0 */ EnSshActionFunc actionFunc; /* 0x2F4 */ ColliderCylinder collider1[6]; /* 0x4BC */ ColliderJntSph collider2; 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 f4cc458cb..ba1828067 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -5,10 +5,13 @@ */ #include "z_en_st.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_st/object_st.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000 | ACTOR_FLAG_1000000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000 | \ + ACTOR_FLAG_1000000) #define THIS ((EnSt*)thisx) @@ -242,9 +245,9 @@ void func_808A54B0(EnSt* this, PlayState* play) { if ((this->unk_18C & 1) && (this->actor.colChkInfo.health != 0)) { OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_2C0].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->unk_2C0].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[this->objectSlot].segment); Gfx_SetupDL25_Xlu(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); @@ -271,7 +274,7 @@ s32 func_808A576C(EnSt* this) { s32 i; s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % 12) * 0x1555; - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++, phi_s2 += 0x1555) { + for (i = 0; i < ENST_BODYPART_MAX; i++, phi_s2 += 0x1555) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->unk_31C[i] = (Rand_ZeroOne() * 16.0f) + 8.0f; } else { @@ -281,46 +284,46 @@ s32 func_808A576C(EnSt* this) { this->drawDmgEffFrozenSteamScales[i] = 0.90000004f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_BLUE_FIRE)) { - this->unk_358[i].y = ((Rand_ZeroOne() - 0.5f) * 40.0f) - 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 40.0f) - 10.0f; } else { - this->unk_358[i].y = ((Rand_ZeroOne() - 0.5f) * 30.0f) + 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 30.0f) + 10.0f; } - this->unk_358[i].x = Math_SinS(phi_s2) * 18.0f; - this->unk_358[i].z = Math_CosS(phi_s2) * 18.0f; + this->bodyPartsPos[i].x = Math_SinS(phi_s2) * 18.0f; + this->bodyPartsPos[i].z = Math_CosS(phi_s2) * 18.0f; } this->unk_31A = 1; return false; } -s32 func_808A5988(EnSt* this, PlayState* play, s32 arg2) { - s32 ret = false; +s32 func_808A5988(EnSt* this, PlayState* play, s32 bodyPartIndex) { + s32 ret = 0; u8 drawDmgEffType; - Vec3f limbPos[1]; + Vec3f bodyPartPos[1]; f32 drawDmgEffAlpha; - if (arg2 < this->unk_31A) { - if (this->unk_31C[arg2] != 0) { - drawDmgEffAlpha = (f32)this->unk_31C[arg2] / this->unk_334[arg2]; + if (bodyPartIndex < this->unk_31A) { + if (this->unk_31C[bodyPartIndex] != 0) { + drawDmgEffAlpha = (f32)this->unk_31C[bodyPartIndex] / this->unk_334[bodyPartIndex]; drawDmgEffType = this->drawDmgEffType; - Math_ApproachF(&this->drawDmgEffFrozenSteamScales[arg2], 0.6f, 0.3f, 0.5f); - Math_Vec3f_Copy(&limbPos[0], &this->actor.world.pos); + Math_ApproachF(&this->drawDmgEffFrozenSteamScales[bodyPartIndex], 0.6f, 0.3f, 0.5f); + Math_Vec3f_Copy(&bodyPartPos[0], &this->actor.world.pos); - limbPos[0].x += this->unk_358[arg2].x; - limbPos[0].y += this->unk_358[arg2].y; - limbPos[0].z += this->unk_358[arg2].z; + bodyPartPos[0].x += this->bodyPartsPos[bodyPartIndex].x; + bodyPartPos[0].y += this->bodyPartsPos[bodyPartIndex].y; + bodyPartPos[0].z += this->bodyPartsPos[bodyPartIndex].z; if (drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if ((this->unk_334[arg2] - this->unk_31C[arg2]) < 20) { + if ((this->unk_334[bodyPartIndex] - this->unk_31C[bodyPartIndex]) < 20) { drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.6f, - this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); - ret = true; + Actor_DrawDamageEffects(play, &this->actor, bodyPartPos, ARRAY_COUNT(bodyPartPos), 0.6f, + this->drawDmgEffFrozenSteamScales[bodyPartIndex], drawDmgEffAlpha, drawDmgEffType); + ret = 1; } } return ret; @@ -330,14 +333,14 @@ void func_808A5AF8(EnSt* this, PlayState* play) { Vec3f sp54; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_358); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); - sp54.x += this->unk_358[i].x; - sp54.y += this->unk_358[i].y; - sp54.z += this->unk_358[i].z; - Math_Vec3f_Copy(&this->unk_358[i], &sp54); + sp54.x += this->bodyPartsPos[i].x; + sp54.y += this->bodyPartsPos[i].y; + sp54.z += this->bodyPartsPos[i].z; + Math_Vec3f_Copy(&this->bodyPartsPos[i], &sp54); } - Actor_SpawnIceEffects(play, &this->actor, this->unk_358, 12, 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENST_BODYPART_MAX, 3, 0.1f, 0.3f); } s16 func_808A5BEC(EnSt* this) { @@ -557,7 +560,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if (this->collider3.base.acFlags & AC_HIT) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on this->unk_318 = 0; @@ -565,7 +568,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 4) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } this->collider3.base.acFlags &= ~AC_HIT; } @@ -575,12 +578,12 @@ s32 func_808A6580(EnSt* this, PlayState* play) { this->collider4.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect == 4) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on this->unk_318 = 0; @@ -614,13 +617,13 @@ s32 func_808A6580(EnSt* this, PlayState* play) { break; } } else { - if (ENST_GET_3F(&this->actor) != ENST_3F_63) { - Flags_SetSwitch(play, ENST_GET_3F(&this->actor)); + if (ENST_GET_SWITCH_FLAG(&this->actor) != 0x3F) { + Flags_SetSwitch(play, ENST_GET_SWITCH_FLAG(&this->actor)); } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); Enemy_StartFinishingBlow(play, &this->actor); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; switch (this->actor.colChkInfo.damageEffect) { case 4: @@ -690,7 +693,7 @@ s32 func_808A6A3C(EnSt* this) { void func_808A6A78(EnSt* this, PlayState* play) { s32 pad[2]; - if (Object_IsLoaded(&play->objectCtx, this->unk_2C0)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { 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, sAnimationInfo, 0); @@ -756,16 +759,16 @@ void func_808A6D84(EnSt* this, PlayState* play) { void func_808A6E24(EnSt* this, PlayState* play) { s32 i; - s32 count = 0; + s32 bodyPartsCount = 0; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { if (DECR(this->unk_31C[i]) == 0) { - count++; + bodyPartsCount++; } } - if (count == ARRAY_COUNT(this->unk_31C)) { + if (bodyPartsCount == ENST_BODYPART_MAX) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 7); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_BLUE_FIRE; this->unk_2CC = 0.0f; @@ -810,20 +813,20 @@ void func_808A6E24(EnSt* this, PlayState* play) { void func_808A701C(EnSt* this, PlayState* play) { s32 i; - s32 count = 0; + s32 bodyPartsCount = 0; if (this->unk_18C & 0x40) { if (DECR(this->unk_318) == 0) { this->unk_18C |= 0x20; } - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { + for (i = 0; i < ENST_BODYPART_MAX; i++) { if (DECR(this->unk_31C[i]) == 0) { - count++; + bodyPartsCount++; } } - if (count == ARRAY_COUNT(this->unk_31C)) { + if (bodyPartsCount == ENST_BODYPART_MAX) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0); Actor_Kill(&this->actor); } @@ -839,9 +842,9 @@ void func_808A701C(EnSt* this, PlayState* play) { void EnSt_Init(Actor* thisx, PlayState* play) { EnSt* this = THIS; - this->unk_2C0 = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP); - if (((ENST_GET_3F(&this->actor) != ENST_3F_63) && Flags_GetSwitch(play, ENST_GET_3F(&this->actor))) || - (this->unk_2C0 < 0)) { + this->objectSlot = Object_GetSlot(&play->objectCtx, GAMEPLAY_KEEP); + if (((ENST_GET_SWITCH_FLAG(&this->actor) != 0x3F) && Flags_GetSwitch(play, ENST_GET_SWITCH_FLAG(&this->actor))) || + (this->objectSlot <= OBJECT_SLOT_NONE)) { Actor_Kill(&this->actor); return; } @@ -891,7 +894,7 @@ void EnSt_Update(Actor* thisx, PlayState* play) { s32 i; // clang-format off - for (i = 0; i < ARRAY_COUNT(this->unk_31C); i++) { this->unk_31C[i] = 0; } + for (i = 0; i < ENST_BODYPART_MAX; i++) { this->unk_31C[i] = 0; } // clang-format on } } @@ -917,7 +920,7 @@ s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void func_808A7478(Actor* thisx, PlayState* play) { EnSt* this = THIS; - s32 i; + s32 bodyPartIndex; s32 count; if (!(this->unk_18C & 0x20)) { @@ -936,8 +939,8 @@ void func_808A7478(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } - for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_31C); i++) { - count += func_808A5988(this, play, i); + for (bodyPartIndex = 0, count = 0; bodyPartIndex < ENST_BODYPART_MAX; bodyPartIndex++) { + count += func_808A5988(this, play, bodyPartIndex); } if (count != 0) { diff --git a/src/overlays/actors/ovl_En_St/z_en_st.h b/src/overlays/actors/ovl_En_St/z_en_st.h index 5c63a9664..dd40a3450 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/src/overlays/actors/ovl_En_St/z_en_st.h @@ -7,12 +7,27 @@ struct EnSt; typedef void (*EnStActionFunc)(struct EnSt*, PlayState*); -#define ENST_GET_3F(thisx) (((thisx)->params & 0x3F) & 0xFF) +#define ENST_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x3F) & 0xFF) #define ENST_GET_1C0(thisx) ((((thisx)->params & 0x1C0) >> 6) & 0xFF) -#define ENST_3F_63 63 #define ENST_1C0_1 1 +typedef enum EnStBodyPart { + /* 0 */ ENST_BODYPART_0, + /* 1 */ ENST_BODYPART_1, + /* 2 */ ENST_BODYPART_2, + /* 3 */ ENST_BODYPART_3, + /* 4 */ ENST_BODYPART_4, + /* 5 */ ENST_BODYPART_5, + /* 6 */ ENST_BODYPART_6, + /* 7 */ ENST_BODYPART_7, + /* 8 */ ENST_BODYPART_8, + /* 9 */ ENST_BODYPART_9, + /* 10 */ ENST_BODYPART_10, + /* 11 */ ENST_BODYPART_11, + /* 12 */ ENST_BODYPART_MAX +} EnStBodyPart; + typedef struct EnSt { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -23,7 +38,7 @@ typedef struct EnSt { /* 0x1DC */ ColliderCylinder collider2; /* 0x228 */ ColliderCylinder collider3; /* 0x274 */ ColliderCylinder collider4; - /* 0x2C0 */ s8 unk_2C0; + /* 0x2C0 */ s8 objectSlot; /* 0x2C4 */ f32 unk_2C4; /* 0x2C8 */ f32 unk_2C8; /* 0x2CC */ f32 unk_2CC; @@ -39,11 +54,11 @@ typedef struct EnSt { /* 0x316 */ s16 unk_316; /* 0x318 */ s16 unk_318; /* 0x31A */ s16 unk_31A; - /* 0x31C */ s16 unk_31C[12]; - /* 0x334 */ s16 unk_334[12]; + /* 0x31C */ s16 unk_31C[ENST_BODYPART_MAX]; + /* 0x334 */ s16 unk_334[ENST_BODYPART_MAX]; /* 0x34C */ f32 unk_34C; /* 0x350 */ UNK_TYPE1 unk_350[0x8]; - /* 0x358 */ Vec3f unk_358[12]; + /* 0x358 */ Vec3f bodyPartsPos[ENST_BODYPART_MAX]; /* 0x3E8 */ Vec3s jointTable[30]; /* 0x49C */ Vec3s morphTable[30]; } EnSt; // size = 0x550 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 7e3b9ead6..c80aaed0b 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -9,7 +9,7 @@ #include "z_en_sth.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnSth*)thisx) @@ -108,16 +108,16 @@ static Color_RGB8 sShirtColors[] = { void EnSth_Init(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - s32 objectId; + s32 objectSlot; // this actor can draw two separate bodies that use different objects if (STH_GET_SWAMP_BODY(&this->actor)) { - objectId = Object_GetIndex(&play->objectCtx, OBJECT_AHG); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_AHG); } else { - objectId = Object_GetIndex(&play->objectCtx, OBJECT_STH); + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_STH); } - this->mainObjectId = objectId; - this->maskOfTruthObjectId = Object_GetIndex(&play->objectCtx, OBJECT_MASK_TRUTH); + this->mainObjectSlot = objectSlot; + this->maskOfTruthObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MASK_TRUTH); Actor_SetScale(&this->actor, 0.01f); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -161,7 +161,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnSth_MoonLookingIdle; this->sthFlags |= STH_FLAG_DISABLE_HEAD_TRACK; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->actor.uncullZoneForward = 800.0f; break; @@ -247,7 +247,7 @@ void EnSth_PanicIdle(EnSth* this, PlayState* play) { EnSth_GetInitialPanicText(this, play); this->actionFunc = EnSth_HandlePanicConversation; } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } @@ -310,7 +310,7 @@ void EnSth_PostOceanspiderhouseReward(EnSth* this, PlayState* play) { } Message_StartTextbox(play, nextTextId, &this->actor); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -321,7 +321,7 @@ void EnSth_GiveOceansideSpiderHouseReward(EnSth* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnSth_PostOceanspiderhouseReward; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); if (CURRENT_DAY == 3) { EnSth_ChangeAnim(this, STH_ANIM_PLEAD); } else { @@ -434,7 +434,7 @@ void EnSth_OceansideSpiderHouseIdle(EnSth* this, PlayState* play) { EnSth_GetInitialOceansideSpiderHouseText(this, play); this->actionFunc = EnSth_HandleOceansideSpiderHouseConversation; } else if (EnSth_CanSpeakToPlayer(this, play)) { - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } @@ -453,13 +453,13 @@ void EnSth_MoonLookingIdle(EnSth* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnSth_HandleMoonLookingConversation; - } else if (EnSth_CanSpeakToPlayer(this, play) || this->actor.isTargeted) { + } else if (EnSth_CanSpeakToPlayer(this, play) || this->actor.isLockedOn) { if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { this->actor.textId = 0x1130; // Huh? The Moon... } else { this->actor.textId = 0x1131; // (The Moon) gotten bigger again } - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } this->headRot.x = -0x1388; } @@ -510,7 +510,7 @@ void EnSth_TalkAfterSwampSpiderHouseGiveMask(EnSth* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH); Message_StartTextbox(play, 0x918, &this->actor); // I've had enough of this, going home } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -521,7 +521,7 @@ void EnSth_SwampSpiderHouseGiveMask(EnSth* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnSth_TalkAfterSwampSpiderHouseGiveMask; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { this->sthFlags &= ~STH_FLAG_DRAW_MASK_OF_TRUTH; // This flag is used to keep track if the player has already spoken to the actor, triggering secondary dialogue. @@ -593,7 +593,7 @@ void EnSth_SwampSpiderHouseIdle(EnSth* this, PlayState* play) { this->actionFunc = EnSth_HandleSwampSpiderHouseConversation; } else if (EnSth_CanSpeakToPlayer(this, play)) { this->actor.textId = 0; - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } @@ -607,7 +607,7 @@ void EnSth_UpdateOceansideSpiderHouseWaitForTokens(Actor* thisx, PlayState* play if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { this->actor.update = EnSth_Update; this->actor.draw = EnSth_Draw; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } } @@ -619,8 +619,8 @@ void EnSth_UpdateWaitForObject(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - if (Object_IsLoaded(&play->objectCtx, this->mainObjectId)) { - this->actor.objBankIndex = this->mainObjectId; + if (Object_IsLoaded(&play->objectCtx, this->mainObjectSlot)) { + this->actor.objectSlot = this->mainObjectSlot; Actor_SetObjectDependency(play, &this->actor); if (STH_GET_SWAMP_BODY(&this->actor)) { @@ -665,7 +665,7 @@ void EnSth_UpdateWaitForObject(Actor* thisx, PlayState* play) { (Inventory_GetSkullTokenCount(play->sceneId) < SPIDER_HOUSE_TOKENS_REQUIRED)) { this->actor.update = EnSth_UpdateOceansideSpiderHouseWaitForTokens; this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } } @@ -733,14 +733,14 @@ void EnSth_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, OPEN_DISPS(play->state.gfxCtx); if (this->sthFlags & STH_FLAG_DRAW_MASK_OF_TRUTH) { - if (Object_IsLoaded(&play->objectCtx, this->maskOfTruthObjectId)) { + if (Object_IsLoaded(&play->objectCtx, this->maskOfTruthObjectSlot)) { Matrix_Push(); Matrix_RotateZS(0x3A98, MTXMODE_APPLY); Matrix_Translate(0.0f, 190.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x0A, play->objectCtx.status[this->maskOfTruthObjectId].segment); + gSPSegment(POLY_OPA_DISP++, 0x0A, play->objectCtx.slots[this->maskOfTruthObjectSlot].segment); gSPDisplayList(POLY_OPA_DISP++, object_mask_truth_DL_0001A0); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/src/overlays/actors/ovl_En_Sth/z_en_sth.h index dbc459ce1..059ae8c76 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -42,8 +42,8 @@ typedef struct EnSth { /* 0x294 */ Vec3s headRot; /* 0x29A */ s16 animIndex; /* 0x29C */ u16 sthFlags; - /* 0x29E */ u8 mainObjectId; - /* 0x29F */ u8 maskOfTruthObjectId; + /* 0x29E */ u8 mainObjectSlot; + /* 0x29F */ u8 maskOfTruthObjectSlot; /* 0x2A0 */ EnSthActionFunc actionFunc; } EnSth; // size = 0x2A4 diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c index 723f7634f..e45dd1394 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c @@ -6,7 +6,7 @@ #include "z_en_sth2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnSth2*)thisx) @@ -35,7 +35,7 @@ ActorInit En_Sth2_InitVars = { void EnSth2_Init(Actor* thisx, PlayState* play) { EnSth2* this = THIS; - this->objIndex = Object_GetIndex(&play->objectCtx, OBJECT_STH); + this->objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_STH); Actor_SetScale(&this->actor, 0.01f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); this->unused = 0; @@ -60,8 +60,8 @@ void EnSth2_Update(Actor* thisx, PlayState* play) { s32 pad; EnSth2* this = THIS; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - this->actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->actor); SkelAnime_InitFlex(play, &this->skelAnime, &gSthSkel, &gEnSth2WavingHandAnim, this->jointTable, this->morphTable, STH_LIMB_MAX); diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h index d8ecc9cdb..9375532b4 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h @@ -14,7 +14,7 @@ typedef struct EnSth2 { /* 0x188 */ Vec3s jointTable[STH_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[STH_LIMB_MAX]; /* 0x248 */ s16 unused; - /* 0x24A */ u8 objIndex; + /* 0x24A */ u8 objectSlot; /* 0x24C */ EnSth2ActionFunc actionFunc; } EnSth2; // size = 0x250 diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 3a32031d3..581962d60 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -6,7 +6,7 @@ #include "z_en_stone_heishi.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnStoneheishi*)thisx) @@ -62,8 +62,8 @@ static ColliderCylinderInit sCylinderInit = { static u16 sEnStoneHeishiTextIds[] = { 0x1473, 0x1474, 0x1475, 0x1476, 0x1477, 0x1478, 0x1479, 0x147A, 0x1472 }; static AnimationHeader* sAnimations[] = { - &gSoldierStandHandOnHip, &gSoldierDrink, &gSoldierCheerWithSpear, &gSoldierWave, - &gSoldierSitAndReach, &gSoldierDrink, &gSoldierStandUp, + &gSoldierStandHandOnHipAnim, &gSoldierDrinkAnim, &gSoldierCheerWithSpearAnim, &gSoldierWaveAnim, + &gSoldierSitAndReachAnim, &gSoldierDrinkAnim, &gSoldierStandUpAnim, }; static u8 sAnimationModes[] = { @@ -107,11 +107,11 @@ void EnStoneheishi_Init(Actor* thisx, PlayState* play) { EnStoneheishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWaveAnim, this->jointTable, this->morphTable, SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -197,7 +197,7 @@ void func_80BC9560(EnStoneheishi* this, PlayState* play) { yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)); if ((yawDiff <= 0x18F0) && !(player->stateFlags1 & PLAYER_STATE1_800000)) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } @@ -328,7 +328,7 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { play->msgCtx.msgLength = 0; player->actor.textId = 0; - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; this->bottleDisplay = EN_STONE_BOTTLE_RED_POTION; if (this->playerGivesBluePotion) { @@ -398,7 +398,7 @@ void func_80BC9D28(EnStoneheishi* this, PlayState* play) { this->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex]; SET_WEEKEVENTREG(WEEKEVENTREG_41_40); Actor_ProcessTalkRequest(&this->actor, &play->state); - func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_80BC9E50; } else if (INV_CONTENT(ITEM_MASK_STONE) == ITEM_MASK_STONE) { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f); @@ -416,7 +416,7 @@ void func_80BC9E50(EnStoneheishi* this, PlayState* play) { this->action = EN_STONE_ACTION_1; this->actionFunc = func_80BC9680; } else { - func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index 43ddae02a..6a1b68bbc 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -7,7 +7,7 @@ #include "z_en_stop_heishi.h" #include "z64quake.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnStopheishi*)thisx) @@ -85,21 +85,21 @@ static u16 sThirdDayLeaveMessages[] = { }; static AnimationHeader* sAnimations[SOLDIER_ANIM_MAX] = { - &gSoldierLookDown, // SOLDIER_ANIM_LOOK_DOWN - &gSoldierComeUpHere, // SOLDIER_ANIM_COME_UP_HERE - &gSoldierStandHandOnHip, // SOLDIER_ANIM_STAND_HAND_ON_HIP - &gSoldierStandAndLookDown, // SOLDIER_ANIM_STAND_LOOK_DOWN - &object_sdn_Anim_0057BC, // SOLDIER_ANIM_4 - &object_sdn_Anim_005D28, // SOLDIER_ANIM_5 - &object_sdn_Anim_0064C0, // SOLDIER_ANIM_6 - &gSoldierStandWithHandOnChest, // SOLDIER_ANIM_STAND_HAND_ON_CHEST + &gSoldierLookDownAnim, // SOLDIER_ANIM_LOOK_DOWN + &gSoldierComeUpHereAnim, // SOLDIER_ANIM_COME_UP_HERE + &gSoldierStandHandOnHipAnim, // SOLDIER_ANIM_STAND_HAND_ON_HIP + &gSoldierStandAndLookDownAnim, // SOLDIER_ANIM_STAND_LOOK_DOWN + &object_sdn_Anim_0057BC, // SOLDIER_ANIM_4 + &object_sdn_Anim_005D28, // SOLDIER_ANIM_5 + &object_sdn_Anim_0064C0, // SOLDIER_ANIM_6 + &gSoldierStandWithHandOnChestAnim, // SOLDIER_ANIM_STAND_HAND_ON_CHEST }; void EnStopheishi_Init(Actor* thisx, PlayState* play) { EnStopheishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierStandHandOnHip, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierStandHandOnHipAnim, this->jointTable, this->morphTable, SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -114,7 +114,7 @@ void EnStopheishi_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->rotYTarget = this->actor.world.rot.y; @@ -500,12 +500,12 @@ void func_80AE7F34(EnStopheishi* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; func_80AE854C(this, play); } else if (yawDiffAbs < 0x4BB9) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } void func_80AE854C(EnStopheishi* this, PlayState* play) { - if (((this->unk_265 != 0) || (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_20))) && + if (((this->unk_265 != 0) || CHECK_WEEKEVENTREG(WEEKEVENTREG_12_20)) && (this->currentAnim != SOLDIER_ANIM_STAND_HAND_ON_HIP)) { EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); } diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index 3bc1f55fd..a5cb80095 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -127,7 +127,7 @@ void EnStream_Update(Actor* thisx, PlayState* play) { EnStream* this = THIS; this->actionFunc(this, play); - func_800B8FE8(&this->actor, NA_SE_EV_WHIRLPOOL - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered3(&this->actor, NA_SE_EV_WHIRLPOOL - SFX_FLAG); } void EnStream_Draw(Actor* thisx, PlayState* play) { 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 12d8d22a8..bc0099298 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -5,12 +5,12 @@ */ #include "z_en_suttari.h" -#include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h" -#include "objects/object_boj/object_boj.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnSuttari*)thisx) @@ -130,7 +130,7 @@ static TrackOptionsSet sTrackOptions = { static u8 D_80BAE820[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(2, 0x80 - 0x04), - /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_33_08, 0x7F - 0x08), + /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG, 0x7F - 0x08), /* 0x08 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_ICHIBA, 0x3D - 0x0C), /* 0x0C */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 0, 0, 25, 0x37 - 0x12), /* 0x12 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 25, 0, 30, 0x31 - 0x18), @@ -483,7 +483,7 @@ void func_80BAAFDC(EnSuttari* this, PlayState* play) { SOLDERSRCHBALL_INVISIBLE); } if (this->playerDetected == true) { - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); this->playerDetected = false; this->actor.speed = 0.0f; if (this->unk1F4[0] != 0) { @@ -516,7 +516,7 @@ void func_80BAB1A0(EnSuttari* this, PlayState* play) { SOLDERSRCHBALL_INVISIBLE); } if (this->playerDetected == true) { - play_sound(NA_SE_SY_FOUND); + Audio_PlaySfx(NA_SE_SY_FOUND); this->playerDetected = false; this->actor.speed = 0.0f; if (this->unk1F4[0] != 0) { @@ -578,7 +578,7 @@ void func_80BAB4F0(EnSuttari* this, PlayState* play) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } } - SubS_FillLimbRotTables(play, this->unk2FA, this->unk31A, ARRAY_COUNT(this->unk2FA)); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, OBJECT_BOJ_LIMB_MAX); } s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq) { @@ -963,7 +963,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { break; case 4: - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { if ((this->animIndex == 2) || (this->animIndex == 1)) { this->animIndex = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); @@ -993,7 +993,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_00071C, this->jointTable, this->morphTable, 16); this->actor.draw = EnSuttari_Draw; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (play->sceneId == SCENE_IKANA) { this->flags1 |= 1; if ((gSaveContext.save.day == 1) || (gSaveContext.save.day == 2)) { @@ -1003,7 +1003,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BACA14; return; } else if ((gSaveContext.save.day == 3) && (gSaveContext.save.time <= CLOCK_TIME(19, 0)) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_61_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_61_08) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) && CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { this->animIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); @@ -1027,7 +1028,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD004; return; } else if (play->sceneId == SCENE_ICHIBA) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { Actor_Kill(&this->actor); return; } @@ -1037,7 +1038,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD5F8; return; } else if (play->sceneId == SCENE_AYASHIISHOP) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { Actor_Kill(&this->actor); return; } @@ -1078,7 +1079,7 @@ void func_80BACA14(EnSuttari* this, PlayState* play) { func_80BAAB78(this, play); this->actionFunc = func_80BADA9C; } else if (this->actor.xzDistToPlayer < 200.0f) { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } } Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 0.1f); @@ -1156,10 +1157,10 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); @@ -1180,18 +1181,18 @@ void func_80BAD004(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A3A, &this->actor); this->actionFunc = func_80BAD130; - } else if ((this->actor.xzDistToPlayer < 200.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 200.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } Actor_MoveWithGravity(&this->actor); } @@ -1200,7 +1201,7 @@ void func_80BAD130(EnSuttari* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if (this->flags1 & 8) { this->actionFunc = func_80BAD004; @@ -1237,7 +1238,7 @@ void func_80BAD2B4(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD230; } else { CutsceneManager_Stop(this->csIdList[1]); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; this->actionFunc = func_80BAD380; @@ -1261,7 +1262,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_10000000; this->flags1 &= ~0x4000; CutsceneManager_Stop(this->csIdList[1]); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; } @@ -1269,18 +1270,18 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { this->flags2 |= 8; func_80BAAF1C(this); } else if (this->flags1 & 0x200) { - SET_WEEKEVENTREG(WEEKEVENTREG_79_40); + SET_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD); this->flags2 |= 4; this->actor.speed = 0.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_EXPLOSION)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); return; } if (this->unk1F4[1] == -0x63) { if (this->flags2 & 8) { - SET_WEEKEVENTREG(WEEKEVENTREG_33_08); + SET_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG); } this->actor.speed = 0.0f; SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); @@ -1307,10 +1308,10 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); @@ -1323,8 +1324,8 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; - } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); @@ -1345,10 +1346,10 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); @@ -1360,8 +1361,8 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; - } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); @@ -1375,7 +1376,7 @@ void func_80BADA08(EnSuttari* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_81_04); } else if (this->actor.xzDistToPlayer < 500.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 500.0f); + Actor_OfferTalk(&this->actor, play, 500.0f); } } @@ -1402,7 +1403,7 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 0x10; this->flags2 &= ~1; } - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->textId = 0; if (this->flags1 & 1) { @@ -1417,13 +1418,13 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { } else if ((talkstate == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->flags1 |= 0x800; func_80BAAB78(this, play); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); func_80BAAB78(this, play); break; @@ -1480,7 +1481,7 @@ void func_80BADE8C(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD130; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 500.0f); + Actor_OfferTalk(&this->actor, play, 500.0f); } } @@ -1500,14 +1501,14 @@ void EnSuttari_Init(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SAKON_DEAD)) { Actor_Kill(&this->actor); return; } Collider_InitCylinder(play, &this->collider); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; EnSuttari_GetPaths(this, play); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80BAC6E8; @@ -1568,8 +1569,8 @@ s32 EnSuttari_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY); } if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 0xC)) { - rot->y += (s16)(Math_SinS(this->unk2FA[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->unk31A[limbIndex]) * 200.0f); + rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f); } return false; } 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 8da01b67e..3ba38563f 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -2,6 +2,7 @@ #define Z_EN_SUTTARI_H #include "global.h" +#include "objects/object_boj/object_boj.h" #include "overlays/actors/ovl_En_Fsn/z_en_fsn.h" struct EnSuttari; @@ -27,14 +28,14 @@ typedef struct EnSuttari { /* 0x1EC */ Path* paths[2]; /* 0x1F4 */ s32 unk1F4[2]; /* 0x1FC */ UNK_TYPE1 unk_1FC[0x1A]; - /* 0x216 */ Vec3s jointTable[16]; - /* 0x276 */ Vec3s morphTable[16]; + /* 0x216 */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX]; + /* 0x276 */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX]; /* 0x2D6 */ Vec3s trackTarget; /* 0x2DC */ Vec3s headRot; /* 0x2E2 */ Vec3s torsoRot; /* 0x2E8 */ UNK_TYPE1 unk_2E8[0x12]; - /* 0x2FA */ s16 unk2FA[16]; - /* 0x31A */ s16 unk31A[16]; + /* 0x2FA */ s16 fidgetTableY[OBJECT_BOJ_LIMB_MAX]; + /* 0x31A */ s16 fidgetTableZ[OBJECT_BOJ_LIMB_MAX]; /* 0x33A */ UNK_TYPE1 unk_33A[0xB6]; /* 0x3F0 */ s16 playerDetected; /* 0x3F2 */ s16 unk3F2; 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 4937125dc..8cab11988 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -5,9 +5,10 @@ */ #include "z_en_sw.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_st/object_st.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnSw*)thisx) @@ -172,10 +173,10 @@ void func_808D8940(EnSw* this, PlayState* play) { } s32 func_808D8B58(EnSw* this) { - s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % ARRAY_COUNT(this->unk_464)) * 0x1555; + s16 phi_s2 = (s16)(TRUNCF_BINANG(Rand_ZeroOne() * 1000.0f) % ENSW_BODYPART_MAX) * 0x1555; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_464); i++, phi_s2 += 0x1555) { + for (i = 0; i < ENSW_BODYPART_MAX; i++, phi_s2 += 0x1555) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->unk_464[i] = (Rand_ZeroOne() * 16.0f) + 8.0f; } else { @@ -185,41 +186,41 @@ s32 func_808D8B58(EnSw* this) { this->drawDmgEffFrozenSteamScales[i] = 0.45000002f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_BLUE_FIRE) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - this->unk_380[i].y = (Rand_ZeroOne() - 0.5f) * 20.0f; + this->bodyPartsPos[i].y = (Rand_ZeroOne() - 0.5f) * 20.0f; } else { - this->unk_380[i].y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + 10.0f; + this->bodyPartsPos[i].y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + 10.0f; } - this->unk_380[i].x = Math_SinS(phi_s2) * 10.0f; - this->unk_380[i].z = Math_CosS(phi_s2) * 10.0f; + this->bodyPartsPos[i].x = Math_SinS(phi_s2) * 10.0f; + this->bodyPartsPos[i].z = Math_CosS(phi_s2) * 10.0f; } this->unk_462 = 1; return 0; } -s32 func_808D8D60(EnSw* this, PlayState* play, s32 arg2) { - s32 ret = false; +s32 func_808D8D60(EnSw* this, PlayState* play, s32 bodyPartIndex) { + s32 ret = 0; u8 drawDmgEffType; - Vec3f limbPos[1]; + Vec3f bodyPartsPos[1]; f32 drawDmgEffAlpha; - if (arg2 < this->unk_462) { - if (this->unk_464[arg2] != 0) { - drawDmgEffAlpha = (f32)this->unk_464[arg2] / this->unk_47C[arg2]; + if (bodyPartIndex < this->unk_462) { + if (this->unk_464[bodyPartIndex] != 0) { + drawDmgEffAlpha = (f32)this->unk_464[bodyPartIndex] / this->unk_47C[bodyPartIndex]; drawDmgEffType = this->drawDmgEffType; - Math_ApproachF(&this->drawDmgEffFrozenSteamScales[arg2], 0.3f, 0.3f, 0.5f); - Math_Vec3f_Copy(&limbPos[0], &this->actor.world.pos); - limbPos[0].x += this->unk_380[arg2].x; - limbPos[0].y += this->unk_380[arg2].y; - limbPos[0].z += this->unk_380[arg2].z; + Math_ApproachF(&this->drawDmgEffFrozenSteamScales[bodyPartIndex], 0.3f, 0.3f, 0.5f); + Math_Vec3f_Copy(&bodyPartsPos[0], &this->actor.world.pos); + bodyPartsPos[0].x += this->bodyPartsPos[bodyPartIndex].x; + bodyPartsPos[0].y += this->bodyPartsPos[bodyPartIndex].y; + bodyPartsPos[0].z += this->bodyPartsPos[bodyPartIndex].z; if (drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if ((this->unk_47C[arg2] - this->unk_464[arg2]) < 20) { + if ((this->unk_47C[bodyPartIndex] - this->unk_464[bodyPartIndex]) < 20) { drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.3f, - this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); - ret = true; + Actor_DrawDamageEffects(play, &this->actor, bodyPartsPos, ARRAY_COUNT(bodyPartsPos), 0.3f, + this->drawDmgEffFrozenSteamScales[bodyPartIndex], drawDmgEffAlpha, drawDmgEffType); + ret = 1; } } return ret; @@ -229,14 +230,14 @@ void func_808D8ED0(EnSw* this, PlayState* play) { Vec3f sp54; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_380); i++) { + for (i = 0; i < ENSW_BODYPART_MAX; i++) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); - sp54.x += this->unk_380[i].x; - sp54.y += this->unk_380[i].y; - sp54.z += this->unk_380[i].z; - Math_Vec3f_Copy(&this->unk_380[i], &sp54); + sp54.x += this->bodyPartsPos[i].x; + sp54.y += this->bodyPartsPos[i].y; + sp54.z += this->bodyPartsPos[i].z; + Math_Vec3f_Copy(&this->bodyPartsPos[i], &sp54); } - Actor_SpawnIceEffects(play, &this->actor, this->unk_380, ARRAY_COUNT(this->unk_380), 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENSW_BODYPART_MAX, 3, 0.1f, 0.3f); } void func_808D8FC4(EnSw* this, PlayState* play) { @@ -358,7 +359,6 @@ s32 func_808D9440(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, C return ret; } -#ifdef NON_MATCHING void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { CollisionPoly* spA4; CollisionPoly* spA0; @@ -412,7 +412,6 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { for (i = 0; i < 3; i++) { if (i == 0) { - if (this && this && this) {} sp84.x = sp90.x - (this->unk_350.x * temp_f20); sp84.y = sp90.y - (this->unk_350.y * temp_f20); sp84.z = sp90.z - (this->unk_350.z * temp_f20); @@ -433,6 +432,9 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { break; } } + + //! FAKE + if (i == 3) {} } func_808D93BC(this); @@ -448,10 +450,6 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { Actor_MoveWithoutGravity(&this->actor); } } -#else -void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D94D0.s") -#endif void func_808D9894(EnSw* this, Vec3f* vec) { Vec3f sp5C; @@ -664,7 +662,7 @@ s32 func_808DA08C(EnSw* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 4) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -676,7 +674,7 @@ s32 func_808DA08C(EnSw* this, PlayState* play) { } else if (!func_808D90C4(this)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); Enemy_StartFinishingBlow(play, &this->actor); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (!ENSW_GET_3(&this->actor)) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); } @@ -1037,7 +1035,7 @@ void func_808DAEB4(EnSw* this, PlayState* play) { sp5C.z += this->unk_368.z * 10.0f; if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SI, sp5C.x, sp5C.y, sp5C.z, 0, 0, 0, this->actor.params) != NULL) { - play_sound(NA_SE_SY_KINSTA_MARK_APPEAR); + Audio_PlaySfx(NA_SE_SY_KINSTA_MARK_APPEAR); } Actor_Kill(&this->actor); } @@ -1167,7 +1165,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { break; case 1: - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; if (this->actor.world.rot.z < 0) { @@ -1188,7 +1186,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { case 2: case 3: - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; if (this->actor.world.rot.z < 0) { @@ -1283,6 +1281,9 @@ s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po case 4: *dList = object_st_DL_0043D8; break; + + default: + break; } } return false; @@ -1290,12 +1291,12 @@ s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = THIS; - s32 i; + s32 bodyPartIndex; s32 count; if (this->unk_410 & 4) { if (ENSW_GET_3(&this->actor)) { - func_800B8050(&this->actor, play, MTXMODE_NEW); + func_800B8050(&this->actor, play, 0); } Gfx_SetupDL25_Opa(play->state.gfxCtx); Matrix_RotateXS(-0x3C72, MTXMODE_APPLY); @@ -1303,8 +1304,8 @@ void EnSw_Draw(Actor* thisx, PlayState* play) { &this->actor); } - for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) { - count += func_808D8D60(this, play, i); + for (bodyPartIndex = 0, count = 0; bodyPartIndex < ENSW_BODYPART_MAX; bodyPartIndex++) { + count += func_808D8D60(this, play, bodyPartIndex); } if (count != 0) { diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h index f77d12267..9cb68a3fa 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -15,6 +15,22 @@ typedef void (*EnSwActionFunc)(struct EnSw*, PlayState*); #define ENSW_PATH_INDEX_NONE 0xFF +typedef enum EnSwBodyPart { + /* 0 */ ENSW_BODYPART_0, + /* 1 */ ENSW_BODYPART_1, + /* 2 */ ENSW_BODYPART_2, + /* 3 */ ENSW_BODYPART_3, + /* 4 */ ENSW_BODYPART_4, + /* 5 */ ENSW_BODYPART_5, + /* 6 */ ENSW_BODYPART_6, + /* 7 */ ENSW_BODYPART_7, + /* 8 */ ENSW_BODYPART_8, + /* 9 */ ENSW_BODYPART_9, + /* 10 */ ENSW_BODYPART_10, + /* 11 */ ENSW_BODYPART_11, + /* 12 */ ENSW_BODYPART_MAX +} EnSwBodyPart; + typedef struct EnSw { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -27,11 +43,11 @@ typedef struct EnSw { /* 0x35C */ Vec3f unk_35C; /* 0x368 */ Vec3f unk_368; /* 0x374 */ Vec3f unk_374; - /* 0x380 */ Vec3f unk_380[12]; + /* 0x380 */ Vec3f bodyPartsPos[ENSW_BODYPART_MAX]; /* 0x410 */ u16 unk_410; /* 0x412 */ u8 drawDmgEffType; /* 0x414 */ f32 unk_414; - /* 0x418 */ f32 drawDmgEffFrozenSteamScales[12]; + /* 0x418 */ f32 drawDmgEffFrozenSteamScales[ENSW_BODYPART_MAX]; /* 0x448 */ f32 unk_448; /* 0x44C */ f32 unk_44C; /* 0x450 */ f32 unk_450; @@ -43,8 +59,8 @@ typedef struct EnSw { /* 0x45E */ s16 unk_45E; /* 0x460 */ s16 unk_460; /* 0x462 */ s16 unk_462; - /* 0x464 */ s16 unk_464[12]; - /* 0x47C */ s16 unk_47C[12]; + /* 0x464 */ s16 unk_464[ENSW_BODYPART_MAX]; + /* 0x47C */ s16 unk_47C[ENSW_BODYPART_MAX]; /* 0x494 */ s16 unk_494; /* 0x496 */ s16 unk_496; /* 0x498 */ s16 unk_498; diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index af419ba23..7e5cebb1c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -79,11 +79,11 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { s32 i; path = syatekiMan->path; - while (path->customValue != SG_PATH_TYPE_CROW) { + while (path->customValue != SG_PATH_TYPE_GUAY) { path = &play->setupPathList[path->additionalPathIndex]; } - for (i = 0; i < EN_SYATEKI_CROW_GET_INDEX(&this->actor); i++) { + for (i = 0; i < SG_GUAY_GET_INDEX(&this->actor); i++) { path = &play->setupPathList[path->additionalPathIndex]; } @@ -95,7 +95,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - if ((path == NULL) || (EN_SYATEKI_CROW_GET_INDEX(&this->actor) >= 0x80)) { + if ((path == NULL) || (SG_GUAY_GET_INDEX(&this->actor) >= 0x80)) { Actor_Kill(&this->actor); return; } @@ -133,7 +133,7 @@ void EnSyatekiCrow_WaitForSignal(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true) && - (syatekiMan->guayFlags & (1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)))) { + (syatekiMan->guayFlags & (1 << SG_GUAY_GET_INDEX(&this->actor)))) { EnSyatekiCrow_SetupWaitToMove(this); } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { this->isActive = true; @@ -168,10 +168,10 @@ void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this) { * How long the Guay should wait is controlled by its params. */ void EnSyatekiCrow_WaitToMove(EnSyatekiCrow* this, PlayState* play) { - if (((EN_SYATEKI_CROW_GET_WAIT_MOD(&this->actor) * 20) + 20) < this->waitTimer) { + if (((SG_GUAY_GET_WAIT_MOD(&this->actor) * 20) + 20) < this->waitTimer) { Actor_PlaySfx(this->actor.parent, NA_SE_EN_KAICHO_CRY); this->waitTimer = 0; - this->actor.speed = EN_SYATEKI_CROW_GET_SPEED_MOD(&this->actor) + 6.0f; + this->actor.speed = SG_GUAY_GET_SPEED_MOD(&this->actor) + 6.0f; this->actor.gravity = -0.5f; this->actionFunc = EnSyatekiCrow_Fly; } else { @@ -206,13 +206,13 @@ void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { this->currentPointIndex++; } else { this->isActive = false; - syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); + syatekiMan->guayFlags &= ~(1 << SG_GUAY_GET_INDEX(&this->actor)); EnSyatekiCrow_SetupWaitForSignal(this); } SkelAnime_Update(&this->skelAnime); this->actor.shape.yOffset = (fabsf(this->skelAnime.curFrame - 3.0f) * 150.0f) + 1700.0f; - if ((syatekiMan->perGameVar1.guaySpawnTimer % 90) == 0) { + if ((syatekiMan->guayAppearTimer % 90) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } } @@ -220,7 +220,7 @@ void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { void EnSyatekiCrow_SetupDead(EnSyatekiCrow* this) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - syatekiMan->score += 60; + syatekiMan->score += SG_POINTS_GUAY; this->isActive = false; this->actor.speed *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; @@ -245,7 +245,7 @@ void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play) { if (this->deathTimer > 20) { func_800B3030(play, &this->actor.world.pos, &sZeroVec, &sZeroVec, this->actor.scale.x * 10000.0f, 0, 0); syatekiMan->guayHitCounter++; - syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); + syatekiMan->guayFlags &= ~(1 << SG_GUAY_GET_INDEX(&this->actor)); EnSyatekiCrow_SetupWaitForSignal(this); } @@ -259,10 +259,10 @@ static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; void EnSyatekiCrow_UpdateDamage(EnSyatekiCrow* this, PlayState* play) { if (this->actionFunc == EnSyatekiCrow_Fly) { if (this->collider.base.acFlags & AC_HIT) { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); this->deathTimer = 0; this->collider.base.acFlags &= ~AC_HIT; - EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 1); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, EXTRA_SCORE_INDEX_60); EnSyatekiCrow_SetupDead(this); } else { this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; @@ -307,8 +307,8 @@ void EnSyatekiCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec Vec3f* bodyPartPos; if (limbIndex == OBJECT_CROW_LIMB_BODY) { - Matrix_MultVec3f(&sBodyOffset, &this->bodyPartsPos[0]); - this->bodyPartsPos[0].y -= 20.0f; + Matrix_MultVec3f(&sBodyOffset, &this->bodyPartsPos[SG_GUAY_BODYPART_BODY]); + this->bodyPartsPos[SG_GUAY_BODYPART_BODY].y -= 20.0f; } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_TAIL)) { bodyPartPos = &this->bodyPartsPos[(limbIndex >> 1) - 1]; diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index f244b0b60..fd9a679d8 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -4,18 +4,26 @@ #include "global.h" #include "objects/object_crow/object_crow.h" -#define EN_SYATEKI_CROW_GET_WAIT_MOD(thisx) ((thisx)->params & 0xF) -#define EN_SYATEKI_CROW_GET_SPEED_MOD(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_CROW_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_CROW_PARAMS(index, speedMod, waitMod) (((index << 8) & 0xFF00) | ((speedMod << 4) & 0xF0) | (waitMod & 0xF)) +#define SG_GUAY_GET_WAIT_MOD(thisx) ((thisx)->params & 0xF) +#define SG_GUAY_GET_SPEED_MOD(thisx) (((thisx)->params & 0xF0) >> 4) +#define SG_GUAY_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +#define SG_GUAY_PARAMS(index, speedMod, waitMod) (((index << 8) & 0xFF00) | ((speedMod << 4) & 0xF0) | (waitMod & 0xF)) struct EnSyatekiCrow; typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, PlayState*); +typedef enum EnSyatekiCrowBodyPart { + /* 0 */ SG_GUAY_BODYPART_BODY, + /* 1 */ SG_GUAY_BODYPART_RIGHT_WING_TIP, + /* 2 */ SG_GUAY_BODYPART_LEFT_WING_TIP, + /* 3 */ SG_GUAY_BODYPART_TAIL, + /* 4 */ SG_GUAY_BODYPART_MAX +} EnSyatekiCrowBodyPart; + typedef struct EnSyatekiCrow { /* 0x000 */ Actor actor; - /* 0x144 */ Vec3f bodyPartsPos[4]; + /* 0x144 */ Vec3f bodyPartsPos[SG_GUAY_BODYPART_MAX]; /* 0x174 */ SkelAnime skelAnime; /* 0x1B8 */ EnSyatekiCrowActionFunc actionFunc; /* 0x1BC */ s16 waitTimer; 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 ee9c63536..c4d366718 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 @@ -35,9 +35,9 @@ void EnSyatekiDekunuts_GameEnd(EnSyatekiDekunuts* this, PlayState* play); void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play); typedef enum { - /* 0 */ EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_NORMAL, - /* 1 */ EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP -} EnSyatekiDekunutsHeaddressType; + /* 0 */ SG_DEKU_HEADDRESS_TYPE_NORMAL, + /* 1 */ SG_DEKU_HEADDRESS_TYPE_FLIPPED_UP +} ShootingGalleryDekuScrubHeaddressType; ActorInit En_Syateki_Dekunuts_InitVars = { ACTOR_EN_SYATEKI_DEKUNUTS, @@ -74,23 +74,23 @@ static ColliderCylinderInit sCylinderInit = { static Cylinder16 sBonusDekuScrubColliderDimensions[] = { { 24, 40, 0, { 0, 0, 0 } } }; typedef enum { - /* 0 */ EN_SYATEKI_DEKUNUTS_ANIM_UP, - /* 1 */ EN_SYATEKI_DEKUNUTS_ANIM_BURROW, - /* 2 */ EN_SYATEKI_DEKUNUTS_ANIM_IDLE, // unused - /* 3 */ EN_SYATEKI_DEKUNUTS_ANIM_LOOK_AROUND, - /* 4 */ EN_SYATEKI_DEKUNUTS_ANIM_DAMAGE, - /* 5 */ EN_SYATEKI_DEKUNUTS_ANIM_DIE, - /* 6 */ EN_SYATEKI_DEKUNUTS_ANIM_UNBURROW // unused -} EnSyatekiDekunutsAnimation; + /* 0 */ SG_DEKU_ANIM_UP, + /* 1 */ SG_DEKU_ANIM_BURROW, + /* 2 */ SG_DEKU_ANIM_IDLE, // unused + /* 3 */ SG_DEKU_ANIM_LOOK_AROUND, + /* 4 */ SG_DEKU_ANIM_DAMAGE, + /* 5 */ SG_DEKU_ANIM_DIE, + /* 6 */ SG_DEKU_ANIM_UNBURROW // unused +} ShootingGalleryDekuScrubAnimation; 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 }, - { &gDekuScrubLookAroundAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, - { &gDekuScrubDamageAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &gDekuScrubDieAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &gDekuScrubUnburrowAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gDekuScrubUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_DEKU_ANIM_UP + { &gDekuScrubBurrowAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_DEKU_ANIM_BURROW + { &gDekuScrubIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, // SG_DEKU_ANIM_IDLE + { &gDekuScrubLookAroundAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, // SG_DEKU_ANIM_LOOK_AROUND + { &gDekuScrubDamageAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_DEKU_ANIM_DAMAGE + { &gDekuScrubDieAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_DEKU_ANIM_DIE + { &gDekuScrubUnburrowAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_DEKU_ANIM_UNBURROW }; static InitChainEntry sInitChain[] = { @@ -112,20 +112,20 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + if (SG_DEKU_GET_TYPE(&this->actor) == SG_DEKU_TYPE_BONUS) { Actor_SetScale(&this->actor, 0.01f); this->collider.dim = sBonusDekuScrubColliderDimensions[0]; - pathType = SG_PATH_TYPE_SCRUB_BONUS; + pathType = SG_PATH_TYPE_DEKU_BONUS; } else { Actor_SetScale(&this->actor, 0.02f); - pathType = SG_PATH_TYPE_SCRUB_NORMAL; + pathType = SG_PATH_TYPE_DEKU_NORMAL; } while (path->customValue != pathType) { path = &play->setupPathList[path->additionalPathIndex]; } - for (i = 0; i < EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(&this->actor); i++) { + for (i = 0; i < SG_DEKU_GET_ADDITIONAL_PATH_INDEX_LIMIT(&this->actor); i++) { path = &play->setupPathList[path->additionalPathIndex]; } @@ -147,7 +147,7 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { } this->flowerPos = Lib_SegmentedToVirtual(path->points); - this->index = EN_SYATEKI_DEKUNUTS_GET_INDEX(&this->actor); + this->index = SG_DEKU_GET_INDEX(&this->actor); this->flowerCount = path->count; this->timer = 0; this->unk_1DC = 0; @@ -172,7 +172,7 @@ void EnSyatekiDekunuts_SetupWaitForSignal(EnSyatekiDekunuts* this) { this->timer = 0; this->unk_1DC = 0; - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + if (SG_DEKU_GET_TYPE(&this->actor) != SG_DEKU_TYPE_BONUS) { this->isAlive = true; } @@ -193,7 +193,7 @@ void EnSyatekiDekunuts_WaitForSignal(EnSyatekiDekunuts* this, PlayState* play) { } if (!syatekiMan->dekuScrubFlags && !syatekiMan->guayFlags && - (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS)) { + (SG_DEKU_GET_TYPE(&this->actor) != SG_DEKU_TYPE_BONUS)) { this->isAlive = true; } } @@ -215,10 +215,10 @@ void EnSyatekiDekunuts_SetupWaitToStart(EnSyatekiDekunuts* this) { this->timeToBurrow = 140 - (syatekiMan->currentWave * 20); if ((syatekiMan->currentWave % 2) != 0) { - this->headdressType = EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP; + this->headdressType = SG_DEKU_HEADDRESS_TYPE_FLIPPED_UP; this->headdressRotZ = 0; } else { - this->headdressType = EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_NORMAL; + this->headdressType = SG_DEKU_HEADDRESS_TYPE_NORMAL; } this->actionFunc = EnSyatekiDekunuts_WaitToStart; @@ -259,7 +259,7 @@ void EnSyatekiDekunuts_WaitToEmerge(EnSyatekiDekunuts* this, PlayState* play) { void EnSyatekiDekunuts_SetupEmerge(EnSyatekiDekunuts* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_UP); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_DEKU_ANIM_UP); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actionFunc = EnSyatekiDekunuts_Emerge; @@ -275,7 +275,7 @@ void EnSyatekiDekunuts_Emerge(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiDekunuts_SetupLookAround(this); } - if (this->headdressType == EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP) { + if (this->headdressType == SG_DEKU_HEADDRESS_TYPE_FLIPPED_UP) { Math_SmoothStepToS(&this->headdressRotZ, -0x8000, 5, 0x1000, 0x100); } @@ -283,8 +283,8 @@ void EnSyatekiDekunuts_Emerge(EnSyatekiDekunuts* this, PlayState* play) { } void EnSyatekiDekunuts_SetupLookAround(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_LOOK_AROUND); - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_DEKU_ANIM_LOOK_AROUND); + if (SG_DEKU_GET_TYPE(&this->actor) != SG_DEKU_TYPE_BONUS) { this->actionFunc = EnSyatekiDekunuts_LookAround; } else { this->actionFunc = EnSyatekiDekunuts_BonusLookAround; @@ -325,7 +325,7 @@ void EnSyatekiDekunuts_BonusLookAround(EnSyatekiDekunuts* this, PlayState* play) } void EnSyatekiDekunuts_SetupBurrow(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_BURROW); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_DEKU_ANIM_BURROW); this->actionFunc = EnSyatekiDekunuts_Burrow; } @@ -369,19 +369,19 @@ void EnSyatekiDekunuts_SetupDead(EnSyatekiDekunuts* this, PlayState* play) { static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { - EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 2); - syatekiMan->score += 100; - syatekiMan->perGameVar2.bonusDekuScrubHitCounter++; + if (SG_DEKU_GET_TYPE(&this->actor) == SG_DEKU_TYPE_BONUS) { + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, EXTRA_SCORE_INDEX_100); + syatekiMan->score += SG_POINTS_DEKU_BONUS; + syatekiMan->bonusDekuScrubHitCounter++; } else { - EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 0); - syatekiMan->score += 30; + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, EXTRA_SCORE_INDEX_30); + syatekiMan->score += SG_POINTS_DEKU_NORMAL; syatekiMan->dekuScrubHitCounter++; } Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DAMAGE); this->isAlive = false; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DAMAGE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_DEKU_ANIM_DAMAGE); this->timer = 160; this->actionFunc = EnSyatekiDekunuts_Dead; } @@ -393,7 +393,7 @@ void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->timer == 160) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DIE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_DEKU_ANIM_DIE); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DEAD); this->timer--; } else if (this->timer < 160) { @@ -407,7 +407,7 @@ void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play) { pos.y = this->actor.world.pos.y + 10.0f; EffectSsHahen_SpawnBurst(play, &pos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + if (SG_DEKU_GET_TYPE(&this->actor) != SG_DEKU_TYPE_BONUS) { syatekiMan->dekuScrubFlags &= ~(1 << this->index); } @@ -427,10 +427,10 @@ void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play) { if ((this->actionFunc != EnSyatekiDekunuts_WaitForSignal) && (this->timer < this->timeToBurrow) && (this->timer > 10)) { if ((this->collider.base.acFlags & AC_HIT) && (this->isAlive == true)) { - if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + if (SG_DEKU_GET_TYPE(&this->actor) == SG_DEKU_TYPE_BONUS) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } this->collider.base.acFlags &= ~AC_HIT; @@ -450,8 +450,7 @@ s32 EnSyatekiDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dLi Actor* thisx) { EnSyatekiDekunuts* this = THIS; - if ((limbIndex == DEKU_SCRUB_LIMB_HEADDRESS) && - (this->headdressType == EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP)) { + if ((limbIndex == DEKU_SCRUB_LIMB_HEADDRESS) && (this->headdressType == SG_DEKU_HEADDRESS_TYPE_FLIPPED_UP)) { rot->z += this->headdressRotZ; } diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h index ce3e9ba90..2a103aa98 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h @@ -4,15 +4,15 @@ #include "global.h" #include "objects/object_dekunuts/object_dekunuts.h" -#define EN_SYATEKI_DEKUNUTS_GET_TYPE(thisx) ((thisx)->params & 0xF) -#define EN_SYATEKI_DEKUNUTS_GET_INDEX(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_DEKUNUTS_PARAMS(unkFF00, index, type) (((unkFF00 << 8) & 0xFF00) | ((index << 4) & 0xF0) | (type & 0xF)) +#define SG_DEKU_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define SG_DEKU_GET_INDEX(thisx) (((thisx)->params & 0xF0) >> 4) +#define SG_DEKU_GET_ADDITIONAL_PATH_INDEX_LIMIT(thisx) (((thisx)->params & 0xFF00) >> 8) +#define SG_DEKU_PARAMS(additionalPathIndexLimit, index, type) (((additionalPathIndexLimit << 8) & 0xFF00) | ((index << 4) & 0xF0) | (type & 0xF)) typedef enum { - /* 0 */ EN_SYATEKI_DEKUNUTS_TYPE_NORMAL, // Worth 30 points - /* 1 */ EN_SYATEKI_DEKUNUTS_TYPE_BONUS // Worth 100 points -} EnSyatekiDekunutsType; + /* 0 */ SG_DEKU_TYPE_NORMAL, // Worth 30 points + /* 1 */ SG_DEKU_TYPE_BONUS // Worth 100 points +} ShootingGalleryDekuScrubType; struct EnSyatekiDekunuts; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index f5910a06d..28eeafc09 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 @@ -10,9 +10,10 @@ #include "z_en_syateki_man.h" #include "overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h" #include "overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h" +#include "overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h" #include "overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiMan*)thisx) @@ -49,15 +50,41 @@ void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play); #define TALK_FLAG_SWAMP_HAS_SPOKEN_WITH_HUMAN (1 << 0) #define TALK_FLAG_SWAMP_HAS_EXPLAINED_THE_RULES (1 << 1) -#define OCTOROK_FLAG(color, row, column) (1 << ((row * 6) + (column * 2) + color)) -#define COLOR_RED 0 -#define COLOR_BLUE 1 -#define ROW_BACK 0 -#define ROW_CENTER 1 -#define ROW_FRONT 2 -#define COLUMN_LEFT 0 -#define COLUMN_CENTER 1 -#define COLUMN_RIGHT 2 +// This defines the configuration of a single wave of Octoroks in the Town Shooting Gallery. These are +// arranged in the same columns and rows that appear in-game; the player stands in the center column, and +// the Octorok with an index of 7 appears directly in front of them like so: +// 0 1 2 +// 3 4 5 +// 6 7 8 +// Player +#define OCTO_FLAGS(type0, type1, type2, type3, type4, type5, type6, type7, type8) \ + (SG_OCTO_SET_FLAG(type0, 0) | SG_OCTO_SET_FLAG(type1, 1) | SG_OCTO_SET_FLAG(type2, 2) | \ + SG_OCTO_SET_FLAG(type3, 3) | SG_OCTO_SET_FLAG(type4, 4) | SG_OCTO_SET_FLAG(type5, 5) | \ + SG_OCTO_SET_FLAG(type6, 6) | SG_OCTO_SET_FLAG(type7, 7) | SG_OCTO_SET_FLAG(type8, 8)) + +// These defines assume that sNormalSwampTargetActorList is used to spawn actors and that the logic of +// EnSyatekiMan_Swamp_RunGame is not modified; in other words, it assumes that each wave consists of five +// Deku Scrubs that the player must shoot and three Guays that the player can either shoot or let escape. +// Once all Deku Scrubs and Guays have been shot or escape, the next wave starts. +#define SG_SWAMP_WAVE_COUNT 4 +#define SG_SWAMP_DEKUS_PER_WAVE 5 +#define SG_SWAMP_GUAYS_PER_WAVE 3 +#define SG_SWAMP_BONUS_DEKU_COUNT 2 + +// This is the score the player will receive if they hit every single Deku Scrub (both normal and bonus), Guay, and +// Wolfos. There are two conditions for a Wolfos to appear, hence why their point value appears twice; one Wolfos +// will appear after shooting two waves of Deku Scrubs, and one Wolfos will appear after shooting one wave of Guays. +// Assuming the point values, actor list, and shooting game logic are unmodified, this should total to 2120 points. +#define SG_SWAMP_PERFECT_SCORE_WITHOUT_BONUS \ + (SG_POINTS_DEKU_NORMAL * (SG_SWAMP_DEKUS_PER_WAVE * SG_SWAMP_WAVE_COUNT) + \ + SG_POINTS_GUAY * (SG_SWAMP_GUAYS_PER_WAVE * SG_SWAMP_WAVE_COUNT) + \ + SG_POINTS_DEKU_BONUS * SG_SWAMP_BONUS_DEKU_COUNT + SG_POINTS_WOLFOS * SG_SWAMP_WAVE_COUNT + \ + SG_POINTS_WOLFOS * (SG_SWAMP_WAVE_COUNT / 2)) + +// To obtain the Heart Piece from the Swamp Shooting Gallery, the player not only needs to achieve a perfect score, +// but they must also have at least six seconds remaining on the minigame timer. If the player has already obtained +// the Heart Piece, then this score will be used instead to determine if the player should get a Purple Rupee. +#define SG_SWAMP_HEART_PIECE_SCORE (SG_SWAMP_PERFECT_SCORE_WITHOUT_BONUS + (6 * SG_BONUS_POINTS_PER_SECOND)) ActorInit En_Syateki_Man_InitVars = { ACTOR_EN_SYATEKI_MAN, @@ -72,22 +99,23 @@ ActorInit En_Syateki_Man_InitVars = { }; typedef enum { - /* 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; + /* 0 */ SG_MAN_ANIM_HANDS_ON_TABLE, + /* 1 */ SG_MAN_ANIM_HEAD_SCRATCH_LOOP, + /* 2 */ SG_MAN_ANIM_HEAD_SCRATCH_END +} ShootingGalleryManAnimation; 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 }, + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // SG_MAN_ANIM_HANDS_ON_TABLE + { &gBurlyGuyHeadScratchLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // SG_MAN_ANIM_HEAD_SCRATCH_LOOP + { &gBurlyGuyHeadScratchEndAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // SG_MAN_ANIM_HEAD_SCRATCH_END }; /** * In the Swamp Shooting Gallery, there are four waves of Guays. * For each wave, these flags are used to control which Guays appear. + * The number of flags per wave should be exactly SG_SWAMP_GUAYS_PER_WAVE for all waves. */ -static s16 sGuayFlagsPerWave[] = { +static s16 sGuayFlagsPerWave[SG_SWAMP_WAVE_COUNT] = { (1 << 7) | (1 << 6) | (1 << 0), (1 << 9) | (1 << 8) | (1 << 1), (1 << 4) | (1 << 3) | (1 << 0), @@ -101,32 +129,25 @@ typedef struct { } SwampTargetActorEntry; // size = 0x14 static SwampTargetActorEntry sNormalSwampTargetActorList[] = { - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(1, 3, 0) }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(0, 2, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 2, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 3, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 4, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(5, 2, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(6, 0, 1) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(7, 0, 2) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(8, 0, 1) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(9, 0, 2) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, SG_WOLFOS_PARAMS(1, 3, 0) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, SG_WOLFOS_PARAMS(0, 2, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 0, SG_DEKU_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 1, SG_DEKU_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 2, SG_DEKU_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 3, SG_DEKU_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 4, SG_DEKU_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 0, SG_DEKU_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 1, SG_DEKU_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(0, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(1, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(2, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(3, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(4, 2, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(5, 2, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(6, 0, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(7, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(8, 0, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(9, 0, 2) }, }; /** @@ -134,22 +155,20 @@ static SwampTargetActorEntry sNormalSwampTargetActorList[] = { * Without any "normal" Deku Scrubs, the game will not progress beyond the first wave. */ static SwampTargetActorEntry sUnusedSwampTargetActorList[] = { - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, - EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 2) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 2) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 3) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 3) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 3) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 4) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 4) }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 4) }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(0, 2, 5) }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(1, 3, 6) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(0, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(1, 0, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 0, SG_DEKU_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, SG_DEKU_PARAMS(0, 1, SG_DEKU_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(2, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(3, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(0, 0, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(1, 0, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(4, 2, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(2, 0, 4) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(3, 0, 4) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, SG_GUAY_PARAMS(4, 2, 4) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, SG_WOLFOS_PARAMS(0, 2, 5) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, SG_WOLFOS_PARAMS(1, 3, 6) }, }; static SwampTargetActorEntry* sSwampTargetActorLists[] = { @@ -183,14 +202,14 @@ void EnSyatekiMan_Swamp_SpawnTargetActors(EnSyatekiMan* this, PlayState* play2, void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - Path* path = &play->setupPathList[EN_SYATEKI_MAN_GET_PATH_INDEX(&this->actor)]; + Path* path = &play->setupPathList[SG_MAN_GET_PATH_INDEX(&this->actor)]; s32 actorListLength = sSwampTargetActorListLengths[this->swampTargetActorListIndex]; - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; Actor_SetScale(&this->actor, 0.01f); if (play->sceneId == SCENE_SYATEKI_MORI) { - SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim, - this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gBurlyGuyHeadScratchLoopAnim, this->jointTable, + this->morphTable, BURLY_GUY_LIMB_MAX); } else { SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gBurlyGuyHandsOnTableAnim, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); @@ -201,7 +220,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { this->shootingGameState = SG_GAME_STATE_NONE; this->talkWaitTimer = 15; this->flagsIndex = 0; - this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; + this->lastHitOctorokType = SG_OCTO_TYPE_NONE; this->octorokFlags = 0; this->dekuScrubFlags = 0; this->guayFlags = 0; @@ -269,8 +288,8 @@ void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { u16 faceReactionTextId; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_MAN_ANIM_SWAMP_HEAD_SCRATCH_END); - faceReactionTextId = Text_GetFaceReaction(play, 0x31); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_MAN_ANIM_HEAD_SCRATCH_END); + faceReactionTextId = Text_GetFaceReaction(play, FACE_REACTION_SET_SWAMP_SHOOTING_GALLERY_MAN); if (faceReactionTextId != 0) { Message_StartTextbox(play, faceReactionTextId, &this->actor); this->prevTextId = faceReactionTextId; @@ -308,7 +327,7 @@ void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play) { } this->actionFunc = EnSyatekiMan_Swamp_Talk; } else { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } if (player->actor.world.pos.z < 135.0f) { @@ -322,13 +341,13 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); // You don't have a bow! Message_StartTextbox(play, 0xA30, &this->actor); this->prevTextId = 0xA30; } else if (gSaveContext.save.saveInfo.playerData.rupees < 20) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); // You don't have enough rupees! Message_StartTextbox(play, 0xA31, &this->actor); @@ -339,18 +358,18 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-20); SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; player->stateFlags1 |= PLAYER_STATE1_20; this->actionFunc = EnSyatekiMan_Swamp_MovePlayerAndExplainRules; } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); switch (CURRENT_DAY) { case 1: @@ -396,7 +415,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) case 0xA2B: // The rules of the game are a piece of cake! case 0xA2C: // I keep saying - you have to aim with [Control Stick]! case 0xA35: // You almost had it! Well...just this once...here you go! - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; Interface_InitMinigame(play); @@ -431,7 +450,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) break; case 0xA34: // Perfect! Take this! - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; gSaveContext.minigameStatus = MINIGAME_STATUS_END; @@ -466,7 +485,7 @@ void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->stateFlags1 &= ~PLAYER_STATE1_20; CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); @@ -486,15 +505,15 @@ void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { break; } - if (this->skelAnime.animation == &gSwampShootingGalleryManHeadScratchEndAnim) { + if (this->skelAnime.animation == &gBurlyGuyHeadScratchEndAnim) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_MAN_ANIM_HANDS_ON_TABLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_MAN_ANIM_HANDS_ON_TABLE); } } } void EnSyatekiMan_Town_StartIntroTextbox(EnSyatekiMan* this, PlayState* play) { - switch (gSaveContext.save.playerForm) { + switch (GET_PLAYER_FORM) { case PLAYER_FORM_HUMAN: Flags_SetAllTreasure(play, Flags_GetAllTreasure(play) + 1); if (CURRENT_DAY != 3) { @@ -591,12 +610,15 @@ void EnSyatekiMan_Town_StartIntroTextbox(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0x3F5; } break; + + default: + break; } } void EnSyatekiMan_Town_Idle(EnSyatekiMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - u16 faceReactionTextId = Text_GetFaceReaction(play, 0x30); + u16 faceReactionTextId = Text_GetFaceReaction(play, FACE_REACTION_SET_TOWN_SHOOTING_GALLERY_MAN); if (faceReactionTextId != 0) { Message_StartTextbox(play, faceReactionTextId, &this->actor); @@ -607,7 +629,7 @@ void EnSyatekiMan_Town_Idle(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Town_Talk; } else { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -617,7 +639,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { // You don't have a bow? Then you can't play. Message_StartTextbox(play, 0x3F9, &this->actor); @@ -628,7 +650,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0x3FA; } } else if (gSaveContext.save.saveInfo.playerData.rupees < 20) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { // You don't have a enough rupees! Message_StartTextbox(play, 0x3FB, &this->actor); @@ -646,7 +668,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Rupees_ChangeBy(-20); this->shootingGameState = SG_GAME_STATE_EXPLAINING_RULES; if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_EXPLAINED_THE_RULES)) { @@ -664,7 +686,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); } } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); if (CURRENT_DAY != 3) { // Well, be that way! Message_StartTextbox(play, 0x3F7, &this->actor); @@ -742,7 +764,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) this->prevTextId = 0x400; } } else { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; @@ -755,7 +777,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) case 0x3FE: // Our highest score is [score]. If you break the record, you'll win a prize! case 0x400: // Our highest score is [score]. Good luck! - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; this->flagsIndex = 0; @@ -805,7 +827,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) case 0x405: // No way! That was perfect! case 0x406: // That was perfect! case 0x407: // You got a new record! - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; gSaveContext.minigameStatus = MINIGAME_STATUS_END; @@ -862,20 +884,22 @@ void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_HasParent(&this->actor, play)) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_10)) { - SET_WEEKEVENTREG(WEEKEVENTREG_59_10); - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_02) && (this->score >= 2180)) { - SET_WEEKEVENTREG(WEEKEVENTREG_32_02); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_QUIVER_UPGRADE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_QUIVER_UPGRADE); + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_HEART_PIECE) && + (this->score >= SG_SWAMP_HEART_PIECE_SCORE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_HEART_PIECE); } this->actor.parent = NULL; this->actionFunc = EnSyatekiMan_Swamp_GiveReward; } else { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_10)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_QUIVER_UPGRADE)) { Actor_OfferGetItem(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); - } else if (this->score < 2180) { + } else if (this->score < SG_SWAMP_HEART_PIECE_SCORE) { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_02)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_HEART_PIECE)) { Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); @@ -908,7 +932,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); } } @@ -917,14 +941,14 @@ void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { if (this->prevTextId == 0x407) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { - SET_WEEKEVENTREG(WEEKEVENTREG_59_20); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_QUIVER_UPGRADE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_QUIVER_UPGRADE); } } if ((this->prevTextId == 0x405) || (this->prevTextId == 0x406)) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_04)) { - SET_WEEKEVENTREG(WEEKEVENTREG_32_04); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_HEART_PIECE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_HEART_PIECE); } } @@ -932,12 +956,13 @@ void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Town_GiveReward; } else { if (this->prevTextId == 0x407) { - if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { + if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_QUIVER_UPGRADE)) { Actor_OfferGetItem(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_04)) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_HEART_PIECE)) { Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); @@ -972,7 +997,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 500.0f, PLAYER_IA_MINUS1); } } @@ -1016,11 +1041,11 @@ void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play) { this->dekuScrubFlags = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0); this->guayFlags = 0; this->wolfosFlags = 0; - this->perGameVar1.guaySpawnTimer = 0; + this->guayAppearTimer = 0; this->dekuScrubHitCounter = 0; this->guayHitCounter = 0; this->currentWave = 0; - this->perGameVar2.bonusDekuScrubHitCounter = 0; + this->bonusDekuScrubHitCounter = 0; Interface_StartTimer(TIMER_ID_MINIGAME_1, 100); this->actor.draw = NULL; this->actionFunc = EnSyatekiMan_Swamp_RunGame; @@ -1028,72 +1053,80 @@ void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play) { } void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { - static s16 sHasSpawnedGuaysForThisWave = false; + static s16 sHasSignaledGuaysForThisWave = false; Player* player = GET_PLAYER(play); - if (((this->dekuScrubFlags == 0) || (this->perGameVar1.guaySpawnTimer > 140)) && !sHasSpawnedGuaysForThisWave && - (this->currentWave < 4)) { - // Spawn three guays after the player has killed all Deku Scrubs, or after 140 frames. - sHasSpawnedGuaysForThisWave = true; - this->perGameVar1.guaySpawnTimer = 0; + if (((this->dekuScrubFlags == 0) || (this->guayAppearTimer > 140)) && !sHasSignaledGuaysForThisWave && + (this->currentWave < SG_SWAMP_WAVE_COUNT)) { + // Make three Guays appear after the player has killed all Deku Scrubs, or after 140 frames. + sHasSignaledGuaysForThisWave = true; + this->guayAppearTimer = 0; Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); this->guayFlags = sGuayFlagsPerWave[this->flagsIndex]; - if (this->flagsIndex == 3) { + if (this->flagsIndex == ARRAY_COUNT(sGuayFlagsPerWave) - 1) { this->flagsIndex = 0; } else { this->flagsIndex++; } - } else if ((this->guayFlags == 0) && (this->dekuScrubFlags == 0) && (sHasSpawnedGuaysForThisWave == true) && - (this->currentWave < 4)) { + } else if ((this->guayFlags == 0) && (this->dekuScrubFlags == 0) && (sHasSignaledGuaysForThisWave == true) && + (this->currentWave < SG_SWAMP_WAVE_COUNT)) { // Once all Deku Scrubs and Guays in this wave have either disappeared or died, move on to the next wave. - if (this->guayHitCounter < 3) { + if (this->guayHitCounter < SG_SWAMP_GUAYS_PER_WAVE) { this->guayHitCounter = 0; } - this->perGameVar1.guaySpawnTimer = 0; - sHasSpawnedGuaysForThisWave = false; + this->guayAppearTimer = 0; + sHasSignaledGuaysForThisWave = false; this->currentWave++; - if (this->currentWave < 4) { + if (this->currentWave < SG_SWAMP_WAVE_COUNT) { this->dekuScrubFlags = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0); } } - if (this->guayHitCounter == 3) { + // Makes a Wolfos appear after the player has shot all the Guays in the current wave. + if (this->guayHitCounter == SG_SWAMP_GUAYS_PER_WAVE) { this->guayHitCounter = 0; this->wolfosFlags |= 1; } - if (this->dekuScrubHitCounter == 10) { + // Makes a Wolfos appear after the player has shot two waves of Deku Scrubs. + if (this->dekuScrubHitCounter == SG_SWAMP_DEKUS_PER_WAVE * 2) { this->dekuScrubHitCounter = 0; this->wolfosFlags |= 2; } - this->perGameVar1.guaySpawnTimer++; + this->guayAppearTimer++; if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { + // End the game because the timer ran out. gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->actor.draw = EnSyatekiMan_Draw; this->flagsIndex = 0; this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; - sHasSpawnedGuaysForThisWave = false; + sHasSignaledGuaysForThisWave = false; Audio_StopSubBgm(); this->actionFunc = EnSyatekiMan_Swamp_EndGame; - } else if ((this->currentWave == 4) && (this->wolfosFlags == 0) && - (this->perGameVar2.bonusDekuScrubHitCounter == 2)) { + } else if ((this->currentWave == SG_SWAMP_WAVE_COUNT) && (this->wolfosFlags == 0) && + (this->bonusDekuScrubHitCounter == SG_SWAMP_BONUS_DEKU_COUNT)) { + // End the game because the player has nothing left to shoot. This doesn't mean the + // player actually hit everything, since Guays and Wolfos can escape. this->actor.draw = EnSyatekiMan_Draw; this->flagsIndex = 0; this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; - sHasSpawnedGuaysForThisWave = false; + sHasSignaledGuaysForThisWave = false; Audio_StopSubBgm(); this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; - if (this->score == 2120) { + + if (this->score == SG_SWAMP_PERFECT_SCORE_WITHOUT_BONUS) { Interface_SetPerfectLetters(play, PERFECT_LETTERS_TYPE_2); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_6; this->actionFunc = EnSyatekiMan_Swamp_AddBonusPoints; } else { + // If the player ran out of things to shoot but did *not* get a perfect score, then + // they must have missed a Guay or Wolfos at some point; don't award any bonus points. gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->actionFunc = EnSyatekiMan_Swamp_EndGame; } @@ -1107,12 +1140,12 @@ void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play) { this->guayFlags = 0; this->wolfosFlags = 0; if (this->talkWaitTimer <= 0) { - if (GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { - SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(this->score); + if (HS_GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { + HS_SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(this->score); } this->talkWaitTimer = 15; - if (this->score >= 2120) { + if (this->score >= SG_SWAMP_PERFECT_SCORE_WITHOUT_BONUS) { // Perfect! Take this! Message_StartTextbox(play, 0xA34, &this->actor); this->prevTextId = 0xA34; @@ -1166,8 +1199,8 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { sBonusTimer = 0; } else if (sBonusTimer > 10) { gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += SECONDS_TO_TIMER(1); - play->interfaceCtx.minigamePoints += 10; - this->score += 10; + play->interfaceCtx.minigamePoints += SG_BONUS_POINTS_PER_SECOND; + this->score += SG_BONUS_POINTS_PER_SECOND; Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); sBonusTimer = 0; } else { @@ -1179,7 +1212,7 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { void EnSyatekiMan_Town_MovePlayerAndSayHighScore(EnSyatekiMan* this, PlayState* play) { Vec3f targetPlayerPos; - if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) { + if (GET_PLAYER_FORM == PLAYER_FORM_FIERCE_DEITY) { targetPlayerPos = sTownFierceDeityPlayerPos; } else { targetPlayerPos = sTownPlayerPos; @@ -1226,8 +1259,8 @@ void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20; this->score = 0; this->flagsIndex = 0; - this->perGameVar1.octorokState = SG_OCTO_STATE_INITIAL; - this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; + this->octorokState = SG_OCTO_STATE_INITIAL; + this->lastHitOctorokType = SG_OCTO_TYPE_NONE; sGameStartTimer = 30; Interface_StartTimer(TIMER_ID_MINIGAME_1, 75); this->actor.draw = NULL; @@ -1240,62 +1273,67 @@ void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play) { * For each wave, these flags are used to control which Octoroks appear. */ static const s32 sOctorokFlagsPerWave[] = { - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + // clang-format off + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE), - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT), + OCTO_FLAGS(SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED), - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER), + OCTO_FLAGS(SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT), + OCTO_FLAGS(SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED), - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_BLUE), - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER), + OCTO_FLAGS(SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED), - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_BLUE), - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_BLUE, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_NONE), - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_BLUE, SG_OCTO_TYPE_BLUE), - OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | - OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + OCTO_FLAGS(SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_RED, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE, + SG_OCTO_TYPE_NONE, SG_OCTO_TYPE_RED, SG_OCTO_TYPE_NONE), + // clang-format on }; void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { @@ -1320,36 +1358,36 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { // Octoroks begin hiding four seconds after a wave begins. if (waveTimer < 100) { - this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING; + this->octorokState = SG_OCTO_STATE_HIDING; } - if (this->perGameVar2.octorokHitType != SG_OCTO_HIT_TYPE_NONE) { - if (this->perGameVar2.octorokHitType == SG_OCTO_HIT_TYPE_BLUE) { + if (this->lastHitOctorokType != SG_OCTO_TYPE_NONE) { + if (this->lastHitOctorokType == SG_OCTO_TYPE_BLUE) { gSaveContext.timerTimeLimits[TIMER_ID_MINIGAME_1] -= SECONDS_TO_TIMER_PRECISE(2, 50); sModFromLosingTime = (sModFromLosingTime + 25) % 50; } - this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; + this->lastHitOctorokType = SG_OCTO_TYPE_NONE; } - if (this->perGameVar1.octorokState == SG_OCTO_STATE_SPAWNING) { - this->perGameVar1.octorokState++; + if (this->octorokState == SG_OCTO_STATE_APPEARING) { + this->octorokState++; } // A new wave of Octoroks should appear every five seconds. However, we need to take into account // that the player might have lost time from hitting Blue Octoroks, so we do something similar to // what was done with waveTimer above. - if ((sModFromLosingTime == (timer % 50)) && (this->perGameVar1.octorokState >= SG_OCTO_STATE_INITIAL)) { - if (this->flagsIndex < 15) { + if ((sModFromLosingTime == (timer % 50)) && (this->octorokState >= SG_OCTO_STATE_INITIAL)) { + if (this->flagsIndex < ARRAY_COUNT(sOctorokFlagsPerWave)) { this->octorokFlags = sOctorokFlagsPerWave[this->flagsIndex++]; Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); - this->perGameVar1.octorokState = SG_OCTO_STATE_SPAWNING; + this->octorokState = SG_OCTO_STATE_APPEARING; } } if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { this->flagsIndex = 0; - this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING; + this->octorokState = SG_OCTO_STATE_HIDING; gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; player->stateFlags1 |= PLAYER_STATE1_20; @@ -1371,9 +1409,9 @@ void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play) { if ((this->talkWaitTimer <= 0) && !play->interfaceCtx.perfectLettersOn) { Flags_SetAllTreasure(play, this->score); this->talkWaitTimer = 15; - if ((GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) || (this->score == 50)) { - if (GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { + if ((HS_GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) || (this->score == 50)) { + if (HS_GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_QUIVER_UPGRADE)) { // You got a new record! Message_StartTextbox(play, 0x407, &this->actor); this->prevTextId = 0x407; @@ -1392,7 +1430,7 @@ void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0x406; } - SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(this->score); + HS_SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(this->score); this->shootingGameState = SG_GAME_STATE_ENDED; } else { if (CURRENT_DAY != 3) { diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index 468cb981c..2f6fe13f5 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -3,12 +3,29 @@ #include "global.h" #include "objects/object_shn/object_shn.h" +#include "overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h" struct EnSyatekiMan; typedef void (*EnSyatekiManActionFunc)(struct EnSyatekiMan*, PlayState*); -#define EN_SYATEKI_MAN_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +#define SG_MAN_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) + +// These values are used to modify the shooting gallery man's internal score. They are +// defined in terms of the scores used by EffectSsExtra because EffectSsExtra_Update +// updates the score displayed to the player, and defining them like this will prevent +// these two different scores from becoming desynchronized. If you intend to modify these +// values, then you'll also need to make sure that EffectSsExtra_Spawn in the appropriate +// actor is called with the correct parameter for the index; failing to do this will +// cause the two different score variables to fall out of sync. +#define SG_POINTS_DEKU_NORMAL EXTRA_SCORE_30 +#define SG_POINTS_DEKU_BONUS EXTRA_SCORE_100 +#define SG_POINTS_GUAY EXTRA_SCORE_60 +#define SG_POINTS_WOLFOS EXTRA_SCORE_100 + +// After getting a perfect score in the Swamp Shooting Gallery, the player is rewarded +// additional points for every second remaining on the minigame timer. +#define SG_BONUS_POINTS_PER_SECOND 10 typedef enum { /* 0 */ SG_GAME_STATE_NONE, // None of the states below apply. @@ -22,23 +39,17 @@ typedef enum { } ShootingGalleryGameState; typedef enum { - /* 0 */ SG_OCTO_STATE_SPAWNING, - /* 1 */ SG_OCTO_STATE_SPAWNED, - /* 70 */ SG_OCTO_STATE_INITIAL = 70, - /* 80 */ SG_OCTO_STATE_HIDING = 80 + /* 0 */ SG_OCTO_STATE_APPEARING, // The Octoroks will begin to appear on the next frame. + /* 1 */ SG_OCTO_STATE_APPEARED, // The Octoroks are appearing from underwater or have already appeared and are floating. + /* 70 */ SG_OCTO_STATE_INITIAL = 70, // The initial state of the game. The Octoroks have not appeared yet. + /* 80 */ SG_OCTO_STATE_HIDING = 80 // The Octoroks are in the process of hiding underwater. } ShootingGalleryOctorokState; typedef enum { - /* 0 */ SG_OCTO_HIT_TYPE_NONE, - /* 1 */ SG_OCTO_HIT_TYPE_RED, - /* 2 */ SG_OCTO_HIT_TYPE_BLUE -} ShootingGalleryoctorokHitType; - -typedef enum { - /* 0 */ SG_PATH_TYPE_CROW, - /* 1 */ SG_PATH_TYPE_SCRUB_NORMAL, + /* 0 */ SG_PATH_TYPE_GUAY, + /* 1 */ SG_PATH_TYPE_DEKU_NORMAL, /* 2 */ SG_PATH_TYPE_WOLFOS, - /* 3 */ SG_PATH_TYPE_SCRUB_BONUS + /* 3 */ SG_PATH_TYPE_DEKU_BONUS } ShootingGalleryPathType; typedef struct EnSyatekiMan { @@ -47,7 +58,7 @@ typedef struct EnSyatekiMan { /* 0x188 */ EnSyatekiManActionFunc actionFunc; /* 0x18C */ Path* path; /* 0x190 */ s32 octorokFlags; - /* 0x194 */ s32 swampTargetActorListIndex; // used but never initialized, so the value is implicitly always 0 + /* 0x194 */ s32 swampTargetActorListIndex; /* 0x198 */ Vec3s jointTable[BURLY_GUY_LIMB_MAX]; /* 0x1F8 */ Vec3s morphTable[BURLY_GUY_LIMB_MAX]; /* 0x258 */ Vec3s headRot; @@ -57,13 +68,13 @@ typedef struct EnSyatekiMan { /* 0x268 */ UNK_TYPE1 unk268[0x2]; /* 0x26A */ s16 shootingGameState; /* 0x26C */ union { - s16 guaySpawnTimer; + s16 guayAppearTimer; s16 octorokState; - } perGameVar1; + }; /* 0x26E */ union { s16 bonusDekuScrubHitCounter; - s16 octorokHitType; - } perGameVar2; + s16 lastHitOctorokType; + }; /* 0x270 */ s16 talkWaitTimer; /* 0x272 */ s16 dekuScrubFlags; /* 0x274 */ s16 guayFlags; 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 91ed08140..114a5fe22 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 @@ -16,17 +16,17 @@ void EnSyatekiOkuta_Destroy(Actor* thisx, PlayState* play); void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play); void EnSyatekiOkuta_Draw(Actor* thisx, PlayState* play); -void func_80A36260(EnSyatekiOkuta* this); -void func_80A362A8(EnSyatekiOkuta* this, PlayState* play); -void func_80A362F8(EnSyatekiOkuta* this); -void func_80A36350(EnSyatekiOkuta* this, PlayState* play); -void func_80A363B4(EnSyatekiOkuta* this, PlayState* play); -void func_80A36444(EnSyatekiOkuta* this); -void func_80A36488(EnSyatekiOkuta* this, PlayState* play); -void func_80A364C0(EnSyatekiOkuta* this); -void func_80A36504(EnSyatekiOkuta* this, PlayState* play); -void func_80A365EC(EnSyatekiOkuta* this, PlayState* play); -void func_80A36CB0(EnSyatekiOkuta* this); +void EnSyatekiOkuta_SetupAttachToShootingGalleryMan(EnSyatekiOkuta* this); +void EnSyatekiOkuta_AttachToShootingGalleryMan(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_SetupDoNothing(EnSyatekiOkuta* this); +void EnSyatekiOkuta_DoNothing(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_Appear(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_SetupFloat(EnSyatekiOkuta* this); +void EnSyatekiOkuta_Float(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_SetupHide(EnSyatekiOkuta* this); +void EnSyatekiOkuta_Hide(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_Die(EnSyatekiOkuta* this, PlayState* play); +void EnSyatekiOkuta_UpdateHeadScale(EnSyatekiOkuta* this); ActorInit En_Syateki_Okuta_InitVars = { ACTOR_EN_SYATEKI_OKUTA, @@ -60,13 +60,23 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, -30, { 0, 0, 0 } }, }; +typedef enum { + /* 0 */ SG_OCTO_ANIM_SHOOT, // unused + /* 1 */ SG_OCTO_ANIM_DIE, + /* 2 */ SG_OCTO_ANIM_HIDE, + /* 3 */ SG_OCTO_ANIM_FLOAT, + /* 4 */ SG_OCTO_ANIM_APPEAR, + /* 5 */ SG_OCTO_ANIM_HIT, // unused + /* 6 */ SG_OCTO_ANIM_MAX +} ShootingGalleryOctorokAnimation; + 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 }, - { &gOctorokFloatAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, - { &gOctorokAppearAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &gOctorokHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gOctorokShootAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_OCTO_ANIM_SHOOT + { &gOctorokDieAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_OCTO_ANIM_DIE + { &gOctorokHideAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_OCTO_ANIM_HIDE + { &gOctorokFloatAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, // SG_OCTO_ANIM_FLOAT + { &gOctorokAppearAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_OCTO_ANIM_APPEAR + { &gOctorokHitAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_OCTO_ANIM_HIT }; #include "assets/overlays/ovl_En_Syateki_Okuta/ovl_En_Syateki_Okuta.c" @@ -76,16 +86,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 6500, ICHAIN_STOP), }; -Color_RGBA8 D_80A37B90 = { 255, 255, 255, 255 }; - -Color_RGBA8 D_80A37B94 = { 150, 150, 150, 255 }; - -Vec3f D_80A37B98 = { 0.0f, -0.5, 0.0f }; - -Color_RGBA8 D_80A37BA4 = { 255, 255, 255, 255 }; - -Color_RGBA8 D_80A37BA8 = { 150, 150, 150, 0 }; - void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiOkuta* this = THIS; @@ -110,9 +110,9 @@ void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.y = this->actor.home.pos.y = ySurface; } - this->unk_2A4 = 0; - this->unk_2AA = 0; - func_80A36260(this); + this->deathTimer = 0; + this->hitResultAlpha = 0; + EnSyatekiOkuta_SetupAttachToShootingGalleryMan(this); } void EnSyatekiOkuta_Destroy(Actor* thisx, PlayState* play) { @@ -121,30 +121,45 @@ void EnSyatekiOkuta_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80A36148(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) { - func_800B0DE0(play, pos, velocity, &gZeroVec3f, &D_80A37B90, &D_80A37B94, 400, scaleStep); +/** + * Spawns the puff of smoke that appears when the Octorok disappears when it dies. + */ +void EnSyatekiOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) { + static Color_RGBA8 sDustPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sDustEnvColor = { 150, 150, 150, 255 }; + + func_800B0DE0(play, pos, velocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 400, scaleStep); } -void func_80A361B0(EnSyatekiOkuta* this, PlayState* play) { +/** + * Spawns the splash that appears when the Octorok appears from underwater, hides underwater, or dies. + */ +void EnSyatekiOkuta_SpawnSplash(EnSyatekiOkuta* this, PlayState* play) { EffectSsGSplash_Spawn(play, &this->actor.home.pos, NULL, NULL, 0, 800); } -s32 func_80A361F4(EnSyatekiOkuta* this) { - s32 temp_a0; - s32 temp_a1; - s32 temp_v1; +/* + * Returns true if this Octorok is hidden (in other words, if it's in the center + * column and has another Octorok in front of it), false otherwise. + */ +s32 EnSyatekiOkuta_IsHiddenByAnotherOctorok(EnSyatekiOkuta* this) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + s32 index = SG_OCTO_GET_INDEX(&this->actor); - temp_v1 = EN_SYATEKI_OKUTA_GET_F(&this->actor); - if ((temp_v1 == 1) || (temp_v1 == 4)) { - temp_a0 = syatekiMan->octorokFlags; - temp_a1 = (temp_v1 * 2) + 6; - - if ((temp_a0 >> temp_a1) & 3) { + // Only the Octoroks in the center column can be obscured by another Octorok. The Octoroks in the + // left and right columns are always visible, since the player looks at them from an angle. + // Additionally, the Octorok in the front row is always visible, even if it's in the center column. + if ((index == SG_OCTO_INDEX_FOR_POS(SG_OCTO_ROW_BACK, SG_OCTO_COL_CENTER)) || + (index == SG_OCTO_INDEX_FOR_POS(SG_OCTO_ROW_CENTER, SG_OCTO_COL_CENTER))) { + // Checks to see if this Octorok is hidden by an Octorok immediately in front of it. + if (SG_OCTO_GET_TYPE(syatekiMan->octorokFlags, SG_OCTO_INDEX_DIRECTLY_IN_FRONT(index)) != SG_OCTO_TYPE_NONE) { return true; } - if ((temp_a1 == 8) && ((temp_a0 >> 0xE) & 3)) { + // If this Octorok is in the back row, it can also be hidden by an Octorok in the front row. + if ((index == SG_OCTO_INDEX_FOR_POS(SG_OCTO_ROW_BACK, SG_OCTO_COL_CENTER)) && + (SG_OCTO_GET_TYPE(syatekiMan->octorokFlags, SG_OCTO_INDEX_FOR_POS(SG_OCTO_ROW_FRONT, SG_OCTO_COL_CENTER)) != + SG_OCTO_TYPE_NONE)) { return true; } } @@ -152,143 +167,177 @@ s32 func_80A361F4(EnSyatekiOkuta* this) { return false; } -void func_80A36260(EnSyatekiOkuta* this) { +void EnSyatekiOkuta_SetupAttachToShootingGalleryMan(EnSyatekiOkuta* this) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gOctorokAppearAnim, 0.0f); this->actor.draw = NULL; - this->actionFunc = func_80A362A8; + this->actionFunc = EnSyatekiOkuta_AttachToShootingGalleryMan; } -void func_80A362A8(EnSyatekiOkuta* this, PlayState* play) { +/** + * Checks every NPC actor in the scene to find the Shooting Gallery Man. Once it finds him, this will + * make him the parent to the Octorok. This is required because the Octoroks are normally spawned as + * part of the Town Shooting Gallery scene, so they don't have anything that links them to the Shooting + * Gallery Man, and the Octoroks need a pointer to him in order to access his Octorok flags. If this + * actor is spawned in a scene *without* the Shooting Gallery Man, its action function will never change + * from this function, and the Octorok will effectively do nothing. + */ +void EnSyatekiOkuta_AttachToShootingGalleryMan(EnSyatekiOkuta* this, PlayState* play) { Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actorIt != NULL) { if (actorIt->id == ACTOR_EN_SYATEKI_MAN) { this->actor.parent = actorIt; - func_80A362F8(this); + EnSyatekiOkuta_SetupDoNothing(this); break; - } else { - actorIt = actorIt->next; } + + actorIt = actorIt->next; } } -void func_80A362F8(EnSyatekiOkuta* this) { +/** + * Stops the Octorok's animation, prevents it from drawing, and sets its action function to do nothing. + * The intention here is to stay in this action function doing nothing until the Shooting Gallery Man + * tells it to appear in EnSyatekiOkuta_CheckForSignal, at which point the action function will be changed. + */ +void EnSyatekiOkuta_SetupDoNothing(EnSyatekiOkuta* this) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gOctorokAppearAnim, 0.0f); this->actor.draw = NULL; Actor_SetScale(&this->actor, 0.01f); - this->actionFunc = func_80A36350; + this->actionFunc = EnSyatekiOkuta_DoNothing; } -void func_80A36350(EnSyatekiOkuta* this, PlayState* play) { +void EnSyatekiOkuta_DoNothing(EnSyatekiOkuta* this, PlayState* play) { } -void func_80A36360(EnSyatekiOkuta* this) { +void EnSyatekiOkuta_SetupAppear(EnSyatekiOkuta* this) { this->actor.draw = EnSyatekiOkuta_Draw; - this->unk_2AA = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); - this->actionFunc = func_80A363B4; + this->hitResultAlpha = 0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_OCTO_ANIM_APPEAR); + this->actionFunc = EnSyatekiOkuta_Appear; } -void func_80A363B4(EnSyatekiOkuta* this, PlayState* play) { - if ((Animation_OnFrame(&this->skelAnime, 2.0f)) || (Animation_OnFrame(&this->skelAnime, 15.0f))) { - if (func_80A361F4(this)) { +/** + * Jumps out of the water and starts floating. + */ +void EnSyatekiOkuta_Appear(EnSyatekiOkuta* this, PlayState* play) { + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { + if (EnSyatekiOkuta_IsHiddenByAnotherOctorok(this)) { return; - } else { - func_80A361B0(this, play); - Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } + + EnSyatekiOkuta_SpawnSplash(this, play); + Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A36444(this); + EnSyatekiOkuta_SetupFloat(this); } } -void func_80A36444(EnSyatekiOkuta* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - this->actionFunc = func_80A36488; +void EnSyatekiOkuta_SetupFloat(EnSyatekiOkuta* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_OCTO_ANIM_FLOAT); + this->actionFunc = EnSyatekiOkuta_Float; } -void func_80A36488(EnSyatekiOkuta* this, PlayState* play) { +/** + * Floats in place until the Shooting Gallery Man tells it to hide. + */ +void EnSyatekiOkuta_Float(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (syatekiMan->perGameVar1.octorokState >= SG_OCTO_STATE_INITIAL) { - func_80A364C0(this); + // In practice, if the Octorok is floating, then the octorokState is either SG_OCTO_STATE_APPEARED or + // SG_OCTO_STATE_HIDING. Only the latter state is greater than SG_OCTO_STATE_INITIAL, so that's what + // this check is looking for. + if (syatekiMan->octorokState >= SG_OCTO_STATE_INITIAL) { + EnSyatekiOkuta_SetupHide(this); } } -void func_80A364C0(EnSyatekiOkuta* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); - this->actionFunc = func_80A36504; +void EnSyatekiOkuta_SetupHide(EnSyatekiOkuta* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_OCTO_ANIM_HIDE); + this->actionFunc = EnSyatekiOkuta_Hide; } -void func_80A36504(EnSyatekiOkuta* this, PlayState* play) { +/** + * Retreats underwater, then makes the Octorok do nothing until the Shooting Gallery Man tells it to appear again. + */ +void EnSyatekiOkuta_Hide(EnSyatekiOkuta* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - func_80A361B0(this, play); + EnSyatekiOkuta_SpawnSplash(this, play); Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_LAND); } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A362F8(this); + EnSyatekiOkuta_SetupDoNothing(this); } } -void func_80A3657C(EnSyatekiOkuta* this) { - this->unk_2A4 = 0; - this->unk_2AA = 300; - if (this->unk_2A6 == 1) { +void EnSyatekiOkuta_SetupDie(EnSyatekiOkuta* this) { + this->deathTimer = 0; + this->hitResultAlpha = 300; + if (this->type == SG_OCTO_TYPE_RED) { Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_DEAD1); } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); - this->actionFunc = func_80A365EC; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_OCTO_ANIM_DIE); + this->actionFunc = EnSyatekiOkuta_Die; } -void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) { - Vec3f sp84; - Vec3f sp78; +/** + * Plays the death animation and slowly shrinks the Octorok. Also spawns various bubble and dust + * effects as it dies. Once the Octorok is finished with its death animation, this function will + * make it do nothing until the Shooting Gallery Man tells it to appear again. + */ +void EnSyatekiOkuta_Die(EnSyatekiOkuta* this, PlayState* play) { + static Vec3f sBubbleAccel = { 0.0f, -0.5, 0.0f }; + static Color_RGBA8 sBubblePrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; + Vec3f velocity; + Vec3f pos; s32 pad; s32 i; - if (this->unk_2AA > 0) { - this->unk_2AA -= 15; + if (this->hitResultAlpha > 0) { + this->hitResultAlpha -= 15; } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->unk_2A4 == 0) { - sp78.x = this->actor.world.pos.x; - sp78.y = this->actor.world.pos.y + 40.0f; - sp78.z = this->actor.world.pos.z; - sp84.x = 0.0f; - sp84.y = -0.5f; - sp84.z = 0.0f; - func_80A36148(&sp78, &sp84, -20, play); + if (this->deathTimer == 0) { + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 40.0f; + pos.z = this->actor.world.pos.z; + velocity.x = 0.0f; + velocity.y = -0.5f; + velocity.z = 0.0f; + EnSyatekiOkuta_SpawnDust(&pos, &velocity, -20, play); Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } - this->unk_2A4++; + this->deathTimer++; } if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - func_80A361B0(this, play); + EnSyatekiOkuta_SpawnSplash(this, play); } - if (this->unk_2A4 < 3) { - Actor_SetScale(&this->actor, ((this->unk_2A4 * 0.25f) + 1.0f) * 0.01f); - } else if (this->unk_2A4 < 6) { - Actor_SetScale(&this->actor, (1.5f - ((this->unk_2A4 - 2) * 0.2333f)) * 0.01f); - } else if (this->unk_2A4 < 11) { - Actor_SetScale(&this->actor, (((this->unk_2A4 - 5) * 0.04f) + 0.8f) * 0.01f); + if (this->deathTimer < 3) { + Actor_SetScale(&this->actor, ((this->deathTimer * 0.25f) + 1.0f) * 0.01f); + } else if (this->deathTimer < 6) { + Actor_SetScale(&this->actor, (1.5f - ((this->deathTimer - 2) * 0.2333f)) * 0.01f); + } else if (this->deathTimer < 11) { + Actor_SetScale(&this->actor, (((this->deathTimer - 5) * 0.04f) + 0.8f) * 0.01f); } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.002f)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_COMMON_WATER_MID); for (i = 0; i < 10; i++) { - sp84.x = (Rand_ZeroOne() - 0.5f) * 7.0f; - sp84.y = Rand_ZeroOne() * 7.0f; - sp84.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &sp84, &D_80A37B98, &D_80A37BA4, - &D_80A37BA8, Rand_S16Offset(100, 50), 25, false); + velocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f; + velocity.y = Rand_ZeroOne() * 7.0f; + velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f; + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &sBubbleAccel, + &sBubblePrimColor, &sBubbleEnvColor, Rand_S16Offset(100, 50), 25, + false); } - func_80A362F8(this); + EnSyatekiOkuta_SetupDoNothing(this); } this->actor.scale.y = this->actor.scale.x; @@ -296,13 +345,17 @@ void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) { } } -void func_80A368E0(EnSyatekiOkuta* this, PlayState* play) { +/** + * Adjusts the collider's dimensions and position based on a few different factors, like the Octorok's + * type, current scale and head scale, and current action. + */ +void EnSyatekiOkuta_UpdateCollision(EnSyatekiOkuta* this, PlayState* play) { this->collider.dim.height = - (sCylinderInit.dim.height - this->collider.dim.yShift) * this->unk_1D8.y * this->actor.scale.y * 100.0f; + (sCylinderInit.dim.height - this->collider.dim.yShift) * this->headScale.y * this->actor.scale.y * 100.0f; this->collider.dim.radius = sCylinderInit.dim.radius * this->actor.scale.x * 100.0f; - if (this->actionFunc == func_80A363B4) { - if ((this->unk_2A6 == 2) && func_80A361F4(this)) { + if (this->actionFunc == EnSyatekiOkuta_Appear) { + if ((this->type == SG_OCTO_TYPE_BLUE) && EnSyatekiOkuta_IsHiddenByAnotherOctorok(this)) { return; } @@ -311,7 +364,7 @@ void func_80A368E0(EnSyatekiOkuta* this, PlayState* play) { } } - if (this->unk_2A6 == 1) { + if (this->type == SG_OCTO_TYPE_RED) { this->collider.dim.radius += 10; this->collider.dim.height += 15; } @@ -323,8 +376,11 @@ void func_80A368E0(EnSyatekiOkuta* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80A36A90(EnSyatekiOkuta* this, PlayState* play) { - if ((this->actionFunc == func_80A365EC) || (this->actionFunc == func_80A36350)) { +/** + * Returns true if the Octorok has been hit, false otherwise. + */ +s32 EnSyatekiOkuta_CheckCollision(EnSyatekiOkuta* this, PlayState* play) { + if ((this->actionFunc == EnSyatekiOkuta_Die) || (this->actionFunc == EnSyatekiOkuta_DoNothing)) { return false; } @@ -333,22 +389,28 @@ s32 func_80A36A90(EnSyatekiOkuta* this, PlayState* play) { return true; } - func_80A368E0(this, play); + EnSyatekiOkuta_UpdateCollision(this, play); return false; } -void func_80A36AF8(EnSyatekiOkuta* this, PlayState* play) { +/** + * Checks to see if both the archery game and this Octorok are in the appropriate state to consider + * appearing. If the conditions are right, then the Shooting Gallery Man's Octorok flags determine + * what type this Octorok should be for the current wave; if the type is *not* SG_OCTO_TYPE_NONE, + * then this Octorok will set itself to the appropriate type and get ready to jump out of the water. + */ +void EnSyatekiOkuta_CheckForSignal(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - s16 temp_v1_2; + s16 type; - if ((this->actionFunc != func_80A36488) && (this->actionFunc != func_80A363B4) && + if ((this->actionFunc != EnSyatekiOkuta_Float) && (this->actionFunc != EnSyatekiOkuta_Appear) && (syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && - (syatekiMan->perGameVar1.octorokState == SG_OCTO_STATE_SPAWNING)) { - temp_v1_2 = (syatekiMan->octorokFlags >> (EN_SYATEKI_OKUTA_GET_F(&this->actor) * 2)) & 3; - if (temp_v1_2 > 0) { + (syatekiMan->octorokState == SG_OCTO_STATE_APPEARING)) { + type = SG_OCTO_GET_TYPE(syatekiMan->octorokFlags, SG_OCTO_GET_INDEX(&this->actor)); + if (type > SG_OCTO_TYPE_NONE) { Actor_SetScale(&this->actor, 0.01f); - this->unk_2A6 = temp_v1_2; - func_80A36360(this); + this->type = type; + EnSyatekiOkuta_SetupAppear(this); } } } @@ -360,101 +422,108 @@ void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actionFunc != func_80A36350) { + if (this->actionFunc != EnSyatekiOkuta_DoNothing) { SkelAnime_Update(&this->skelAnime); } - func_80A36AF8(this, play); + EnSyatekiOkuta_CheckForSignal(this, play); - if (func_80A36A90(this, play)) { + if (EnSyatekiOkuta_CheckCollision(this, play)) { syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (this->unk_2A6 == 1) { + if (this->type == SG_OCTO_TYPE_RED) { Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); play->interfaceCtx.minigamePoints++; syatekiMan->score++; - syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_RED; + syatekiMan->lastHitOctorokType = SG_OCTO_TYPE_RED; } else { Actor_PlaySfx(&this->actor, NA_SE_SY_ERROR); - syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_BLUE; + syatekiMan->lastHitOctorokType = SG_OCTO_TYPE_BLUE; } - func_80A3657C(this); + EnSyatekiOkuta_SetupDie(this); } else { this->collider.base.acFlags &= ~AC_HIT; } - func_80A36CB0(this); + EnSyatekiOkuta_UpdateHeadScale(this); } -void func_80A36CB0(EnSyatekiOkuta* this) { +/** + * Adjusts the scale of the Octorok's head based on their current action and their current animation frame. + */ +void EnSyatekiOkuta_UpdateHeadScale(EnSyatekiOkuta* this) { f32 curFrame = this->skelAnime.curFrame; - if (this->actionFunc == func_80A363B4) { + if (this->actionFunc == EnSyatekiOkuta_Appear) { if (curFrame < 8.0f) { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = 1.0f; + this->headScale.x = this->headScale.y = this->headScale.z = 1.0f; } else if (curFrame < 10.0f) { - this->unk_1D8.x = this->unk_1D8.z = 1.0f; - this->unk_1D8.y = ((curFrame - 7.0f) * 0.4f) + 1.0f; + this->headScale.x = this->headScale.z = 1.0f; + this->headScale.y = ((curFrame - 7.0f) * 0.4f) + 1.0f; } else if (curFrame < 14.0f) { - this->unk_1D8.x = this->unk_1D8.z = ((curFrame - 9.0f) * 0.075f) + 1.0f; - this->unk_1D8.y = 1.8f - ((curFrame - 9.0f) * 0.25f); + this->headScale.x = this->headScale.z = ((curFrame - 9.0f) * 0.075f) + 1.0f; + this->headScale.y = 1.8f - ((curFrame - 9.0f) * 0.25f); } else { - this->unk_1D8.x = this->unk_1D8.z = 1.3f - ((curFrame - 13.0f) * 0.05f); - this->unk_1D8.y = ((curFrame - 13.0f) * 0.0333f) + 0.8f; + this->headScale.x = this->headScale.z = 1.3f - ((curFrame - 13.0f) * 0.05f); + this->headScale.y = ((curFrame - 13.0f) * 0.0333f) + 0.8f; } - } else if (this->actionFunc == func_80A36488) { - this->unk_1D8.x = this->unk_1D8.z = 1.0f; - this->unk_1D8.y = (Math_SinF((M_PI / 16) * curFrame) * 0.2f) + 1.0f; - } else if (this->actionFunc == func_80A36504) { + } else if (this->actionFunc == EnSyatekiOkuta_Float) { + this->headScale.x = this->headScale.z = 1.0f; + this->headScale.y = (Math_SinF((M_PI / 16) * curFrame) * 0.2f) + 1.0f; + } else if (this->actionFunc == EnSyatekiOkuta_Hide) { if (curFrame < 3.0f) { - this->unk_1D8.y = 1.0f; + this->headScale.y = 1.0f; } else if (curFrame < 4.0f) { - this->unk_1D8.y = (curFrame - 2.0f) + 1.0f; + this->headScale.y = (curFrame - 2.0f) + 1.0f; } else { - this->unk_1D8.y = 2.0f - ((curFrame - 3.0f) * 0.333f); + this->headScale.y = 2.0f - ((curFrame - 3.0f) * 0.333f); } - this->unk_1D8.x = this->unk_1D8.z = 1.0f; - } else if (this->actionFunc == func_80A365EC) { - curFrame += this->unk_2A4; + this->headScale.x = this->headScale.z = 1.0f; + } else if (this->actionFunc == EnSyatekiOkuta_Die) { + curFrame += this->deathTimer; if (curFrame >= 35.0f) { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = 1.0f; + this->headScale.x = this->headScale.y = this->headScale.z = 1.0f; } else if (curFrame < 4.0f) { - this->unk_1D8.x = this->unk_1D8.z = 1.0f - (curFrame * 0.0666f); - this->unk_1D8.y = (curFrame * 0.1666f) + 1.0f; + this->headScale.x = this->headScale.z = 1.0f - (curFrame * 0.0666f); + this->headScale.y = (curFrame * 0.1666f) + 1.0f; } else if (curFrame < 25.0f) { - this->unk_1D8.x = this->unk_1D8.z = ((curFrame - 4.0f) * 0.01f) + 0.8f; - this->unk_1D8.y = 1.5f - ((curFrame - 4.0f) * 0.025f); + this->headScale.x = this->headScale.z = ((curFrame - 4.0f) * 0.01f) + 0.8f; + this->headScale.y = 1.5f - ((curFrame - 4.0f) * 0.025f); } else if (curFrame < 27.0f) { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = ((curFrame - 24.0f) * 0.25f) + 1.0f; + this->headScale.x = this->headScale.y = this->headScale.z = ((curFrame - 24.0f) * 0.25f) + 1.0f; } else if (curFrame < 30.0f) { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = 1.5f - ((curFrame - 26.0f) * 0.233f); + this->headScale.x = this->headScale.y = this->headScale.z = 1.5f - ((curFrame - 26.0f) * 0.233f); } else { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = ((curFrame - 29.0f) * 0.04f) + 0.8f; + this->headScale.x = this->headScale.y = this->headScale.z = ((curFrame - 29.0f) * 0.04f) + 0.8f; } } else { - this->unk_1D8.x = this->unk_1D8.y = this->unk_1D8.z = 1.0f; + this->headScale.x = this->headScale.y = this->headScale.z = 1.0f; } } -s32 func_80A370EC(EnSyatekiOkuta* this, f32 arg1, Vec3f* arg2) { - if (this->actionFunc == func_80A363B4) { - arg2->y = 1.0f; - arg2->z = 1.0f; - arg2->x = (Math_SinF((M_PI / 16) * arg1) * 0.4f) + 1.0f; - } else if (this->actionFunc == func_80A365EC) { - if ((arg1 >= 35.0f) || (arg1 < 25.0f)) { +/** + * Returns true if the snout scale should be updated, false otherwise. The snout scale is returned via the scale + * parameter. + */ +s32 EnSyatekiOkuta_GetSnoutScale(EnSyatekiOkuta* this, f32 curFrame, Vec3f* scale) { + if (this->actionFunc == EnSyatekiOkuta_Appear) { + scale->y = 1.0f; + scale->z = 1.0f; + scale->x = (Math_SinF((M_PI / 16) * curFrame) * 0.4f) + 1.0f; + } else if (this->actionFunc == EnSyatekiOkuta_Die) { + if ((curFrame >= 35.0f) || (curFrame < 25.0f)) { return false; } - if (arg1 < 27.0f) { - arg2->z = 1.0f; - arg2->x = arg2->y = ((arg1 - 24.0f) * 0.5f) + 1.0f; - } else if (arg1 < 30.0f) { - arg2->z = (arg1 - 26.0f) * 0.333f + 1.0f; - arg2->x = arg2->y = 2.0f - (arg1 - 26.0f) * 0.333f; + if (curFrame < 27.0f) { + scale->z = 1.0f; + scale->x = scale->y = ((curFrame - 24.0f) * 0.5f) + 1.0f; + } else if (curFrame < 30.0f) { + scale->z = (curFrame - 26.0f) * 0.333f + 1.0f; + scale->x = scale->y = 2.0f - (curFrame - 26.0f) * 0.333f; } else { - arg2->z = 2.0f - ((arg1 - 29.0f) * 0.2f); - arg2->x = arg2->y = 1.0f; + scale->z = 2.0f - ((curFrame - 29.0f) * 0.2f); + scale->x = scale->y = 1.0f; } } else { return false; @@ -465,20 +534,20 @@ s32 func_80A370EC(EnSyatekiOkuta* this, f32 arg1, Vec3f* arg2) { s32 EnSyatekiOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; - Vec3f sp20; + Vec3f scale; f32 curFrame; EnSyatekiOkuta* this = THIS; curFrame = this->skelAnime.curFrame; - if (this->actionFunc == func_80A365EC) { - curFrame += this->unk_2A4; + if (this->actionFunc == EnSyatekiOkuta_Die) { + curFrame += this->deathTimer; } if (limbIndex == OCTOROK_LIMB_HEAD) { - sp20 = this->unk_1D8; - Matrix_Scale(sp20.x, sp20.y, sp20.z, MTXMODE_APPLY); - } else if ((limbIndex == OCTOROK_LIMB_SNOUT) && (func_80A370EC(this, curFrame, &sp20))) { - Matrix_Scale(sp20.x, sp20.y, sp20.z, MTXMODE_APPLY); + scale = this->headScale; + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); + } else if ((limbIndex == OCTOROK_LIMB_SNOUT) && (EnSyatekiOkuta_GetSnoutScale(this, curFrame, &scale))) { + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); } return false; @@ -490,7 +559,7 @@ void EnSyatekiOkuta_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - if (this->unk_2A6 == 1) { + if (this->type == SG_OCTO_TYPE_RED) { gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); } else { gSPSegment(POLY_OPA_DISP++, 0x08, gShootingGalleryOctorokBlueMaterialDL); @@ -498,20 +567,22 @@ void EnSyatekiOkuta_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiOkuta_OverrideLimbDraw, NULL, &this->actor); + + // Draw the circle or cross that appears when the player hits an Octorok Gfx_SetupDL25_Xlu(play->state.gfxCtx); - if (this->actionFunc == func_80A365EC) { + if (this->actionFunc == EnSyatekiOkuta_Die) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z + 20.0f, MTXMODE_NEW); - if (this->unk_2AA >= 256) { + if (this->hitResultAlpha > 255) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 210, 64, 32, 255); } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 210, 64, 32, this->unk_2AA); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 210, 64, 32, this->hitResultAlpha); } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (this->unk_2A6 == 2) { + if (this->type == SG_OCTO_TYPE_BLUE) { gSPDisplayList(POLY_XLU_DISP++, gShootingGalleryOctorokCrossDL); } else { gSPDisplayList(POLY_XLU_DISP++, gShootingGalleryOctorokCircleDL); diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h index 0527354d0..72be15406 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h @@ -4,7 +4,39 @@ #include "global.h" #include "objects/object_okuta/object_okuta.h" -#define EN_SYATEKI_OKUTA_GET_F(thisx) ((thisx)->params & 0xF) +typedef enum { + /* 0 */ SG_OCTO_TYPE_NONE, + /* 1 */ SG_OCTO_TYPE_RED, + /* 2 */ SG_OCTO_TYPE_BLUE, + /* 3 */ SG_OCTO_TYPE_MAX +} ShootingGalleryOctorokType; + +typedef enum { + /* 0 */ SG_OCTO_ROW_BACK, + /* 1 */ SG_OCTO_ROW_CENTER, + /* 2 */ SG_OCTO_ROW_FRONT, + /* 3 */ SG_OCTO_ROW_MAX +} ShootingGalleryOctorokRow; + +typedef enum { + /* 0 */ SG_OCTO_COL_LEFT, + /* 1 */ SG_OCTO_COL_CENTER, + /* 2 */ SG_OCTO_COL_RIGHT, + /* 3 */ SG_OCTO_COL_MAX +} ShootingGalleryOctorokColumn; + +#define SG_OCTO_GET_INDEX(thisx) ((thisx)->params & 0xF) +#define SG_OCTO_INDEX_FOR_POS(row, column) (((row) * SG_OCTO_COL_MAX) + (column)) + +// This returns the index of the Octorok directly in front of the Octorok at the given index. In other words, it +// returns the index of the Octorok in the same column as the one with the given index, but one row ahead. It's +// assumed that this will only be used for Octoroks in the back or center row; it returns an invalid index for +// Octoroks in the front row. +#define SG_OCTO_INDEX_DIRECTLY_IN_FRONT(index) ((index) + SG_OCTO_COL_MAX) + +// Both of these macros assume that the Octorok types can fit in two bits, hence why the index is multiplied by 2. +#define SG_OCTO_GET_TYPE(octorokFlags, index) (((octorokFlags) >> ((index) * 2)) & SG_OCTO_TYPE_MAX) +#define SG_OCTO_SET_FLAG(type, index) ((type & SG_OCTO_TYPE_MAX) << ((index) * 2)) struct EnSyatekiOkuta; @@ -15,13 +47,13 @@ typedef struct EnSyatekiOkuta { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnSyatekiOkutaActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1DC */ Vec3f unk_1D8; + /* 0x1DC */ Vec3f headScale; /* 0x1E4 */ Vec3s jointTable[OCTOROK_LIMB_MAX]; /* 0x244 */ Vec3s morphTable[OCTOROK_LIMB_MAX]; - /* 0x2A4 */ s16 unk_2A4; - /* 0x2A6 */ s16 unk_2A6; + /* 0x2A4 */ s16 deathTimer; + /* 0x2A6 */ s16 type; /* 0x2A8 */ UNK_TYPE1 unk_2A8[0x2]; - /* 0x2AA */ s16 unk_2AA; + /* 0x2AA */ s16 hitResultAlpha; } EnSyatekiOkuta; // size = 0x2AC #endif // Z_EN_SYATEKI_OKUTA_H 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 347d78088..7f1f3cd4a 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 @@ -114,23 +114,23 @@ ActorInit En_Syateki_Wf_InitVars = { }; typedef enum { - /* 0 */ EN_SYATEKI_WF_ANIM_WAIT, // unused - /* 1 */ EN_SYATEKI_WF_ANIM_RUN, - /* 2 */ EN_SYATEKI_WF_ANIM_JUMP, - /* 3 */ EN_SYATEKI_WF_ANIM_LAND, - /* 4 */ EN_SYATEKI_WF_ANIM_BACKFLIP, // unused - /* 5 */ EN_SYATEKI_WF_ANIM_DAMAGED, - /* 6 */ EN_SYATEKI_WF_ANIM_REAR_UP_FALL_OVER -} EnSyatekiWfAnimation; + /* 0 */ SG_WOLFOS_ANIM_WAIT, // unused + /* 1 */ SG_WOLFOS_ANIM_RUN, + /* 2 */ SG_WOLFOS_ANIM_JUMP, + /* 3 */ SG_WOLFOS_ANIM_LAND, + /* 4 */ SG_WOLFOS_ANIM_BACKFLIP, // unused + /* 5 */ SG_WOLFOS_ANIM_DAMAGED, + /* 6 */ SG_WOLFOS_ANIM_REAR_UP_FALL_OVER +} ShootingGalleryWolfosAnimation; static AnimationInfo sAnimationInfo[] = { - { &gWolfosWaitAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, - { &gWolfosRunAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gWolfosRunAnim, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, - { &gWolfosRunAnim, 1.0f, 4.0f, 8.0f, ANIMMODE_ONCE, 1.0f }, - { &gWolfosBackflipAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &gWolfosDamagedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f }, - { &gWolfosRearUpFallOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gWolfosWaitAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, // SG_WOLFOS_ANIM_WAIT + { &gWolfosRunAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // SG_WOLFOS_ANIM_RUN + { &gWolfosRunAnim, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, // SG_WOLFOS_ANIM_JUMP + { &gWolfosRunAnim, 1.0f, 4.0f, 8.0f, ANIMMODE_ONCE, 1.0f }, // SG_WOLFOS_ANIM_LAND + { &gWolfosBackflipAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_WOLFOS_ANIM_BACKFLIP + { &gWolfosDamagedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f }, // SG_WOLFOS_ANIM_DAMAGED + { &gWolfosRearUpFallOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // SG_WOLFOS_ANIM_REAR_UP_FALL_OVER }; static InitChainEntry sInitChain[] = { @@ -150,7 +150,7 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { path = &play->setupPathList[path->additionalPathIndex]; } - for (i = 0; i < EN_SYATEKI_WF_GET_INDEX(&this->actor); i++) { + for (i = 0; i < SG_WOLFOS_GET_INDEX(&this->actor); i++) { path = &play->setupPathList[path->additionalPathIndex]; } @@ -224,7 +224,7 @@ void EnSyatekiWf_SetupWaitForSignal(EnSyatekiWf* this) { this->actor.draw = NULL; this->currentPointIndex = 1; this->isActive = false; - syatekiMan->wolfosFlags &= ~(1 << EN_SYATEKI_WF_GET_INDEX(&this->actor)); + syatekiMan->wolfosFlags &= ~(1 << SG_WOLFOS_GET_INDEX(&this->actor)); this->actionFunc = EnSyatekiWf_WaitForSignal; } @@ -239,7 +239,7 @@ void EnSyatekiWf_WaitForSignal(EnSyatekiWf* this, PlayState* play) { if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true)) { EnSyatekiWf_InitPathStart(this); EnSyatekiWf_SetupWaitToMove(this); - } else if (syatekiMan->wolfosFlags & (1 << EN_SYATEKI_WF_GET_INDEX(&this->actor))) { + } else if (syatekiMan->wolfosFlags & (1 << SG_WOLFOS_GET_INDEX(&this->actor))) { this->isActive = true; } } @@ -263,7 +263,7 @@ void EnSyatekiWf_WaitToMove(EnSyatekiWf* this, PlayState* play) { } void EnSyatekiWf_SetupRun(EnSyatekiWf* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_RUN); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_WOLFOS_ANIM_RUN); this->actor.speed = 10.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.draw = EnSyatekiWf_Draw; @@ -318,7 +318,7 @@ void EnSyatekiWf_Run(EnSyatekiWf* this, PlayState* play) { } } else { if (this->currentPointIndex < (this->maxPointIndex - 1)) { - if (this->currentPointIndex == EN_SYATEKI_WF_GET_POINT_TO_HOWL(&this->actor)) { + if (this->currentPointIndex == SG_WOLFOS_GET_POINT_TO_HOWL(&this->actor)) { EnSyatekiWf_SetupHowl(this); } @@ -340,7 +340,7 @@ void EnSyatekiWf_SetupJump(EnSyatekiWf* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); this->actor.velocity.y = 20.0f; this->actor.speed = 5.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_JUMP); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_WOLFOS_ANIM_JUMP); this->actionFunc = EnSyatekiWf_Jump; } @@ -352,7 +352,7 @@ void EnSyatekiWf_Jump(EnSyatekiWf* this, PlayState* play) { void EnSyatekiWf_SetupLand(EnSyatekiWf* this) { this->actor.speed = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_LAND); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_WOLFOS_ANIM_LAND); this->actionFunc = EnSyatekiWf_Land; } @@ -369,7 +369,7 @@ void EnSyatekiWf_SetupHowl(EnSyatekiWf* this) { this->timer = 40; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_DAMAGED); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_WOLFOS_ANIM_DAMAGED); this->actionFunc = EnSyatekiWf_Howl; } @@ -390,10 +390,10 @@ void EnSyatekiWf_SetupDead(EnSyatekiWf* this, PlayState* play) { this->isActive = false; this->actor.speed = 0.0f; - EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 2); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, EXTRA_SCORE_INDEX_100); Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_REAR_UP_FALL_OVER); - syatekiMan->score += 100; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, SG_WOLFOS_ANIM_REAR_UP_FALL_OVER); + syatekiMan->score += SG_POINTS_WOLFOS; this->actionFunc = EnSyatekiWf_Dead; } @@ -441,19 +441,19 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { this->tailCollider.base.acFlags &= ~AC_HIT; this->headCollider.base.acFlags &= ~AC_HIT; - // The Wolfos always starts with 2 health, so the subtraction below is guaranteed to kill it; - // the else-block is never reached in practice. If you *could* damage the Wolfos without killing - // it, then the number "30" would appear every time you hit it, and the player's displayed score - // would increase by 30. However, the else-block doesn't increase the shooting gallery man's - // "score" variable, so it would become desynchronized from the displayed score. This could cause - // weird behavior, like not getting a free replay after finishing a game with 2000 or more points. + //! @bug: The Wolfos always starts with 2 health, so the subtraction below is guaranteed to kill it; + //! the else-block is never reached in practice. If you *could* damage the Wolfos without killing + //! it, then the number "30" would appear every time you hit it, and the player's displayed score + //! would increase by 30. However, the else-block doesn't increase the shooting gallery man's + //! "score" variable, so it would become desynchronized from the displayed score. This could cause + //! weird behavior, like not getting a free replay after finishing a game with 2000 or more points. this->actor.colChkInfo.health -= 2; if (this->actor.colChkInfo.health == 0) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); EnSyatekiWf_SetupDead(this, play); } else { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); - EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 3, 0); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 3, EXTRA_SCORE_INDEX_30); } } diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index 4a1fb2f72..06057d6b4 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -4,9 +4,9 @@ #include "global.h" #include "objects/object_wf/object_wf.h" -#define EN_SYATEKI_WF_GET_POINT_TO_HOWL(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_WF_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_WF_PARAMS(index, pointToHowl, unused) (((index << 8) & 0xFF00) | ((pointToHowl << 4) & 0xF0) | (unused & 0xF)) +#define SG_WOLFOS_GET_POINT_TO_HOWL(thisx) (((thisx)->params & 0xF0) >> 4) +#define SG_WOLFOS_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +#define SG_WOLFOS_PARAMS(index, pointToHowl, unused) (((index << 8) & 0xFF00) | ((pointToHowl << 4) & 0xF0) | (unused & 0xF)) struct EnSyatekiWf; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 1f97e5c57..364d8874b 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -8,7 +8,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tab/object_tab.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTab*)thisx) @@ -184,16 +184,14 @@ void func_80BE0664(EnTab* this) { s32 func_80BE06DC(EnTab* this, PlayState* play) { s32 ret = false; - if (this->unk_2FC & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - SubS_UpdateFlags(&this->unk_2FC, 0, 7); - ret = true; - this->unk_320 = 0; - this->unk_328 = NULL; - this->actor.child = &GET_PLAYER(play)->actor; - this->unk_2FC |= 8; - this->actionFunc = func_80BE1348; - } + if (((this->unk_2FC & 7) != SUBS_OFFER_MODE_NONE) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { + SubS_SetOfferMode(&this->unk_2FC, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + ret = true; + this->unk_320 = 0; + this->unk_328 = NULL; + this->actor.child = &GET_PLAYER(play)->actor; + this->unk_2FC |= 8; + this->actionFunc = func_80BE1348; } return ret; } @@ -227,7 +225,7 @@ void func_80BE07A0(EnTab* this) { Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); if (this->unk_1E0->id == ACTOR_PLAYER) { - sp40.y = ((Player*)this->unk_1E0)->bodyPartsPos[7].y + 3.0f; + sp40.y = ((Player*)this->unk_1E0)->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; } else { Math_Vec3f_Copy(&sp40, &this->unk_1E0->focus.pos); } @@ -374,8 +372,8 @@ s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1AF0); Math_Vec3s_Copy(&this->actor.world.rot, &D_80BE1AFC); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - this->actor.targetMode = 0; - SubS_UpdateFlags(&this->unk_2FC, 3, 7); + this->actor.targetMode = TARGET_MODE_0; + SubS_SetOfferMode(&this->unk_2FC, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2FC |= (0x40 | 0x20); this->unk_30C = 30; this->unk_1E4 = sp28; @@ -391,8 +389,8 @@ s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1B04); Math_Vec3s_Copy(&this->actor.world.rot, &D_80BE1B10); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - this->actor.targetMode = 6; - SubS_UpdateFlags(&this->unk_2FC, 3, 7); + this->actor.targetMode = TARGET_MODE_6; + SubS_SetOfferMode(&this->unk_2FC, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2FC |= (0x40 | 0x20); this->unk_30C = 0x50; func_80BE05BC(this, 1); @@ -478,11 +476,11 @@ void func_80BE127C(EnTab* this, PlayState* play) { if (!Schedule_RunScript(play, D_80BE18D0, &sp18) || ((this->unk_1D8 != sp18.result) && !func_80BE1060(this, play, &sp18))) { this->actor.shape.shadowDraw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sp18.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_1D8 = sp18.result; func_80BE1224(this, play); @@ -494,7 +492,7 @@ void func_80BE1348(EnTab* this, PlayState* play) { Vec3f sp34; if (func_8010BF58(&this->actor, play, func_80BE0E04(this, play), this->unk_328, &this->unk_1DC)) { - SubS_UpdateFlags(&this->unk_2FC, 3, 7); + SubS_SetOfferMode(&this->unk_2FC, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_2FC &= ~8; this->unk_2FC |= 0x40; this->unk_324 = 20; @@ -551,7 +549,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, PLAYER_IA_NONE, this->unk_2FC & 7); + SubS_Offer(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_2FC & SUBS_OFFER_MODE_MASK); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80BE0620(this, play); diff --git a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c index 2cc547e9a..9a4b0f2d7 100644 --- a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c +++ b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c @@ -5,6 +5,7 @@ */ #include "z_en_tag_obj.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #define FLAGS 0x00000000 @@ -60,7 +61,7 @@ void EnTagObj_Update(Actor* thisx, PlayState* play) { if (!this->hasSpawnedSeahorse) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, 0); + this->actor.world.pos.z, 0, 0, 0, SEAHORSE_PARAMS(SEAHORSE_TYPE_0, 0, 0)); this->hasSpawnedSeahorse = true; } } diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c index 9bc0cd1b9..692651860 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c @@ -6,7 +6,7 @@ #include "z_en_takaraya.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTakaraya*)thisx) @@ -15,7 +15,25 @@ void EnTakaraya_Destroy(Actor* thisx, PlayState* play); void EnTakaraya_Update(Actor* thisx, PlayState* play); void EnTakaraya_Draw(Actor* thisx, PlayState* play); -#if 0 +void EnTakaraya_Blink(EnTakaraya* this); +void EnTakaraya_SetupWait(EnTakaraya* this); +void EnTakaraya_Wait(EnTakaraya* this, PlayState* play); +void EnTakaraya_SpawnWalls(EnTakaraya* this, PlayState* play); +void EnTakaraya_SetupTalk(EnTakaraya* this); +void EnTakaraya_Talk(EnTakaraya* this, PlayState* play); +void func_80ADF2D4(EnTakaraya* this); +void func_80ADF338(EnTakaraya* this, PlayState* play); +void func_80ADF4E0(EnTakaraya* this); +void func_80ADF520(EnTakaraya* this, PlayState* play); +void func_80ADF608(EnTakaraya* this, PlayState* play); +void func_80ADF654(EnTakaraya* this, PlayState* play); +void func_80ADF6DC(EnTakaraya* this); +void func_80ADF730(EnTakaraya* this, PlayState* play); +void func_80ADF7B8(EnTakaraya* this); +void func_80ADF7CC(EnTakaraya* this, PlayState* play); +s32 EnTakaraya_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnTakaraya_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx); + ActorInit En_Takaraya_InitVars = { ACTOR_EN_TAKARAYA, ACTORCAT_NPC, @@ -28,61 +46,391 @@ ActorInit En_Takaraya_InitVars = { (ActorFunc)EnTakaraya_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80ADFB20[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), +TexturePtr sEyesUpTextures[] = { + gTreasureChestShopGalEyeOpenUpTex, + gTreasureChestShopGalEyeHalfUpTex, + gTreasureChestShopGalEyeClosedTex, + gTreasureChestShopGalEyeHalfUpTex, +}; + +TexturePtr sEyesDownTextures[] = { + gTreasureChestShopGalEyeOpenDownTex, + gTreasureChestShopGalEyeHalfDownTex, + gTreasureChestShopGalEyeClosedTex, + gTreasureChestShopGalEyeHalfDownTex, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), }; -#endif +u32 sTexturesDesegmented = false; -extern InitChainEntry D_80ADFB20[]; +u16 D_80ADFB2C[PLAYER_FORM_MAX] = { + 0x76D, // PLAYER_FORM_FIERCE_DEITY + 0x76E, // PLAYER_FORM_GORON + 0x76F, // PLAYER_FORM_ZORA + 0x76C, // PLAYER_FORM_DEKU + 0x76D, // PLAYER_FORM_HUMAN +}; -extern UNK_TYPE D_06001384; -extern UNK_TYPE D_06009890; -extern UNK_TYPE D_0600A280; -extern UNK_TYPE D_0600AD98; +u8 D_80ADFB38[PLAYER_FORM_MAX][2] = { + { 5, 5 }, // PLAYER_FORM_FIERCE_DEITY + { 12, 5 }, // PLAYER_FORM_GORON + { 4, 4 }, // PLAYER_FORM_ZORA + { 42, 41 }, // PLAYER_FORM_DEKU + { 5, 5 }, // PLAYER_FORM_HUMAN +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Init.s") +u16 D_80ADFB44[PLAYER_FORM_MAX] = { + 0x775, // PLAYER_FORM_FIERCE_DEITY + 0x776, // PLAYER_FORM_GORON + 0x777, // PLAYER_FORM_ZORA + 0x774, // PLAYER_FORM_DEKU + 0x775, // PLAYER_FORM_HUMAN +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Destroy.s") +u16 D_80ADFB50[PLAYER_FORM_MAX] = { + 0x771, // PLAYER_FORM_FIERCE_DEITY + 0x772, // PLAYER_FORM_GORON + 0x773, // PLAYER_FORM_ZORA + 0x770, // PLAYER_FORM_DEKU + 0x771, // PLAYER_FORM_HUMAN +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADED8C.s") +void EnTakaraya_Init(Actor* thisx, PlayState* play) { + EnTakaraya* this = THIS; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEDF8.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gTreasureChestShopGalSkel, &object_bg_Anim_009890, this->jointTable, + this->morphTable, TREASURE_CHEST_SHOP_GAL_LIMB_MAX); + this->switchFlag = EN_TAKARAYA_GET_SWITCH_FLAG(thisx); + thisx->params &= 0xFF; + if (!sTexturesDesegmented) { + for (i = 0; i < ARRAY_COUNT(sEyesDownTextures); i++) { + sEyesUpTextures[i] = Lib_SegmentedToVirtual(sEyesUpTextures[i]); + sEyesDownTextures[i] = Lib_SegmentedToVirtual(sEyesDownTextures[i]); + } + sTexturesDesegmented = true; + } + this->eyeTexIndex = 2; + if (gSaveContext.save.entrance == ENTRANCE(TREASURE_CHEST_SHOP, 1)) { + Audio_StopSubBgm(); + if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_6) { + this->actor.textId = 0x77A; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; + func_80ADF6DC(this); + } else { + this->actor.textId = 0x77C; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); + EnTakaraya_SetupWait(this); + } else { + func_80ADF6DC(this); + } + } + } else { + EnTakaraya_SetupWait(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEE4C.s") +void EnTakaraya_Destroy(Actor* thisx, PlayState* play) { + EnTakaraya* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEF74.s") + Flags_UnsetSwitch(play, 5); + if (!this->unk2AD) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF03C.s") +void EnTakaraya_Blink(EnTakaraya* this) { + if (this->eyeTexIndex != 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex == 4) { + this->eyeTexIndex = 0; + } + } else if (Rand_ZeroOne() < 0.02f) { + this->eyeTexIndex++; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF050.s") +void EnTakaraya_SetupWait(EnTakaraya* this) { + if (this->skelAnime.animation == &object_bg_Anim_001384) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); + } + this->actionFunc = EnTakaraya_Wait; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF2D4.s") +void EnTakaraya_Wait(EnTakaraya* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime)) { + if (this->skelAnime.animation == &object_bg_Anim_00A280) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); + } else { + Animation_MorphToLoop(&this->skelAnime, &object_bg_Anim_009890, -4.0f); + } + } + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Text_GetFaceReaction(play, FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL) == 0) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00A280, -4.0f); + } + EnTakaraya_SetupTalk(this); + } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { + this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL); + if (this->actor.textId == 0) { + this->actor.textId = D_80ADFB2C[GET_PLAYER_FORM]; + } + this->formSwitchFlag = GET_PLAYER_FORM + this->switchFlag; + Actor_OfferTalk(&this->actor, play, 120.0f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF338.s") +void EnTakaraya_SpawnWalls(EnTakaraya* this, PlayState* play) { + u8 var_v1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF4E0.s") + if (Flags_GetSwitch(play, this->formSwitchFlag)) { + var_v1 = D_80ADFB38[GET_PLAYER_FORM][1]; + } else { + var_v1 = D_80ADFB38[GET_PLAYER_FORM][0]; + } + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_TAKARAYA_WALL, 0.0f, 0.0f, 0.0f, 0, 0, 5, + ((var_v1 << 5) + this->actor.params) + 0xB000, this->actor.csId, HALFDAYBIT_ALL, + NULL); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF520.s") +void EnTakaraya_SetupTalk(EnTakaraya* this) { + this->actionFunc = EnTakaraya_Talk; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF608.s") +void EnTakaraya_Talk(EnTakaraya* this, PlayState* play) { + u8 talkState; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF654.s") + if (SkelAnime_Update(&this->skelAnime)) { + if (this->skelAnime.animation == &object_bg_Anim_00AD98) { + Animation_PlayOnce(&this->skelAnime, &object_bg_Anim_000968); + } else if (this->skelAnime.animation == &object_bg_Anim_00A280) { + Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_001384); + } else { + Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_009890); + } + } + talkState = Message_GetState(&play->msgCtx); + if ((talkState == TEXT_STATE_CLOSING) || (talkState == TEXT_STATE_DONE)) { + if (this->actor.textId == 0x778) { + func_80ADF2D4(this); + } else { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); + EnTakaraya_SetupWait(this); + } + } else if ((talkState == TEXT_STATE_1) && (this->actor.textId != 0x778)) { + if (Message_ShouldAdvance(play)) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); + } + } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { + this->actor.textId = 0x77B; + if (this->skelAnime.animation == &object_bg_Anim_009890) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_000968, 5.0f); + } + Audio_PlaySfx(NA_SE_SY_ERROR); + } else { + Audio_PlaySfx_MessageDecide(); + Rupees_ChangeBy(-play->msgCtx.unk1206C); + EnTakaraya_SpawnWalls(this, play); + this->actor.textId = 0x778; + if (this->skelAnime.animation != &object_bg_Anim_009890) { + Animation_MorphToLoop(&this->skelAnime, &object_bg_Anim_009890, 5.0f); + } + } + } else { + Audio_PlaySfx_MessageCancel(); + this->actor.textId = D_80ADFB44[GET_PLAYER_FORM]; + if (this->skelAnime.animation == &object_bg_Anim_009890) { + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_000968, 5.0f); + } + } + Message_ContinueTextbox(play, this->actor.textId); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF6DC.s") +void func_80ADF2D4(EnTakaraya* this) { + Actor_PlaySfx_FlaggedCentered2(&this->actor, NA_SE_SY_FOUND); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); + this->timer = 145; + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); + this->actionFunc = func_80ADF338; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF730.s") +void func_80ADF338(EnTakaraya* this, PlayState* play) { + Actor* chest = play->actorCtx.actorLists[ACTORCAT_CHEST].first; + Player* player = GET_PLAYER(play); + Vec3f subCamEye; + Vec3f subCamAt; + f32 sp2C; + s16 subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF7B8.s") + SkelAnime_Update(&this->skelAnime); + if ((CutsceneManager_GetCurrentCsId() == this->actor.csId) && (chest != NULL)) { + this->timer--; + subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); + if (this->timer >= 26) { + sp2C = 250.0f; + } else { + sp2C = ((chest->xzDistToPlayer - 250.0f) * (25 - this->timer) * 0.04f) + 250.0f; + } + subCamEye.x = (Math_SinS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.x; + subCamEye.y = player->actor.world.pos.y + 120.0f; + subCamEye.z = (Math_CosS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.z; + subCamAt.x = subCamEye.x - (Math_SinS(chest->yawTowardsPlayer) * 250.0f); + subCamAt.y = subCamEye.y - 90.0f; + subCamAt.z = subCamEye.z - (Math_CosS(chest->yawTowardsPlayer) * 250.0f); + Play_SetCameraAtEye(play, subCamId, &subCamAt, &subCamEye); + } else if (this->timer < 145) { + func_80ADF4E0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF7CC.s") +void func_80ADF4E0(EnTakaraya* this) { + Interface_StartTimer(TIMER_ID_MINIGAME_2, 45); + this->timer = 1; + this->actionFunc = func_80ADF520; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Update.s") +void func_80ADF520(EnTakaraya* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (!Play_InCsMode(play)) { + if (Flags_GetTreasure(play, this->actor.params)) { + Flags_SetSwitch(play, this->formSwitchFlag); + play->actorCtx.sceneFlags.chest &= ~TAKARAYA_GET_TREASURE_FLAG(&this->actor); + this->timer = 0; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; + func_80ADF608(this, play); + } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF) { + this->timer = 50; + Message_StartTextbox(play, 0x77D, &this->actor); + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; + func_80ADF608(this, play); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF94C.s") +void func_80ADF608(EnTakaraya* this, PlayState* play) { + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); + this->unk2AD = true; + this->actionFunc = func_80ADF654; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF984.s") +void func_80ADF654(EnTakaraya* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + } else { + if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_6) { + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; + } else { + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; + } + gSaveContext.nextCutsceneIndex = 0; + play->nextEntrance = ENTRANCE(TREASURE_CHEST_SHOP, 1); + play->transitionTrigger = TRANS_TRIGGER_START; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Draw.s") +void func_80ADF6DC(EnTakaraya* this) { + Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_001384); + this->eyeTexIndex = 0; + this->actor.flags |= ACTOR_FLAG_10000; + this->actionFunc = func_80ADF730; +} + +void func_80ADF730(EnTakaraya* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->actor.flags &= ~ACTOR_FLAG_10000; + func_80ADF7B8(this); + } else { + this->formSwitchFlag = GET_PLAYER_FORM + this->switchFlag; + Actor_OfferTalk(&this->actor, play, 120.0f); + } +} + +void func_80ADF7B8(EnTakaraya* this) { + this->actionFunc = func_80ADF7CC; +} + +void func_80ADF7CC(EnTakaraya* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + if (this->actor.textId == 0x77A) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + Message_CloseTextbox(play); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); + EnTakaraya_SetupWait(this); + } else { + this->actor.textId = 0x77C; + Message_ContinueTextbox(play, this->actor.textId); + } + } else { + this->actor.textId = D_80ADFB50[GET_PLAYER_FORM]; + Message_ContinueTextbox(play, this->actor.textId); + Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); + EnTakaraya_SetupTalk(this); + } + } +} + +void EnTakaraya_Update(Actor* thisx, PlayState* play) { + EnTakaraya* this = THIS; + s32 pad; + Vec3s torsoRot; + + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &torsoRot, this->actor.focus.pos); + EnTakaraya_Blink(this); +} + +s32 EnTakaraya_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnTakaraya* this = THIS; + + if (limbIndex == TREASURE_CHEST_SHOP_GAL_LIMB_HEAD) { + rot->x += this->headRot.y; + } + return false; +} + +void EnTakaraya_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { + EnTakaraya* this = THIS; + + if (limbIndex == TREASURE_CHEST_SHOP_GAL_LIMB_HEAD) { + Matrix_RotateYS(0x400 - this->headRot.x, MTXMODE_APPLY); + Matrix_MultVecX(500.0f, &thisx->focus.pos); + } +} + +void EnTakaraya_Draw(Actor* thisx, PlayState* play) { + EnTakaraya* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + + if ((GET_PLAYER_FORM == PLAYER_FORM_DEKU) || (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { + gSPSegment(POLY_OPA_DISP++, 0x08, sEyesDownTextures[this->eyeTexIndex]); + } else { + gSPSegment(POLY_OPA_DISP++, 0x08, sEyesUpTextures[this->eyeTexIndex]); + } + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnTakaraya_OverrideLimbDraw, NULL, + EnTakaraya_TransformLimbDraw, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h index cfa37125e..3124097de 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h @@ -2,16 +2,27 @@ #define Z_EN_TAKARAYA_H #include "global.h" +#include "objects/object_bg/object_bg.h" struct EnTakaraya; typedef void (*EnTakarayaActionFunc)(struct EnTakaraya*, PlayState*); +#define EN_TAKARAYA_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 0x8) & 0xFF) +#define TAKARAYA_GET_TREASURE_FLAG(thisx) (1 << (thisx)->params) + typedef struct EnTakaraya { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x164]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[TREASURE_CHEST_SHOP_GAL_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[TREASURE_CHEST_SHOP_GAL_LIMB_MAX]; /* 0x2A8 */ EnTakarayaActionFunc actionFunc; - /* 0x2AC */ char unk_2AC[0x10]; + /* 0x2AC */ u8 eyeTexIndex; + /* 0x2AD */ u8 unk2AD; + /* 0x2AE */ s16 timer; + /* 0x2B0 */ s16 formSwitchFlag; + /* 0x2B2 */ s16 switchFlag; + /* 0x2B4 */ Vec3s headRot; } EnTakaraya; // size = 0x2BC #endif // Z_EN_TAKARAYA_H diff --git a/src/overlays/actors/ovl_En_Talk/z_en_talk.c b/src/overlays/actors/ovl_En_Talk/z_en_talk.c index 7c639c44a..832a1313e 100644 --- a/src/overlays/actors/ovl_En_Talk/z_en_talk.c +++ b/src/overlays/actors/ovl_En_Talk/z_en_talk.c @@ -6,7 +6,7 @@ #include "z_en_talk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnTalk*)thisx) @@ -32,7 +32,7 @@ void EnTalk_Init(Actor* thisx, PlayState* play) { EnTalk* this = THIS; s8 targetMode = this->actor.home.rot.x - 0x1; - if ((targetMode >= 0) && (targetMode < 7)) { + if ((targetMode >= TARGET_MODE_0) && (targetMode < TARGET_MODE_7)) { this->actor.targetMode = targetMode; } @@ -57,8 +57,8 @@ void func_80BDE090(EnTalk* this, PlayState* play) { } if (((this->actor.xzDistToPlayer < 40.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) || - this->actor.isTargeted) { - func_800B8614(&this->actor, play, 120.0f); + this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 120.0f); } } 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 84d0b7dd1..34ebe1d80 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 @@ -7,7 +7,7 @@ #include "z_en_talk_gibud.h" #include "z64rumble.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((EnTalkGibud*)thisx) @@ -205,7 +205,7 @@ static EnTalkGibudRequestedItem sRequestedItemTable[] = { { PLAYER_IA_BOTTLE_SPRING_WATER, ITEM_SPRING_WATER, 1, true }, { PLAYER_IA_BOTTLE_FISH, ITEM_FISH, 1, true }, { PLAYER_IA_BOTTLE_BUG, ITEM_BUG, 1, true }, - { PLAYER_IA_NUT, ITEM_NUT, 10, false }, + { PLAYER_IA_DEKU_NUT, ITEM_DEKU_NUT, 10, false }, { PLAYER_IA_BOMB, ITEM_BOMB, 10, false }, { PLAYER_IA_BOTTLE_HOT_SPRING_WATER, ITEM_HOT_SPRING_WATER, 1, true }, { PLAYER_IA_BOTTLE_BIG_POE, ITEM_BIG_POE, 1, true }, @@ -228,7 +228,7 @@ void EnTalkGibud_Init(Actor* thisx, PlayState* play) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.hintId = TATL_HINT_ID_GIBDO; this->actor.textId = 0; @@ -248,12 +248,12 @@ void EnTalkGibud_Init(Actor* thisx, PlayState* play) { this->isTalking = false; this->type = EN_TALK_GIBUD_TYPE_GIBDO; this->requestedItemIndex = EN_TALK_GIBUD_REQUESTED_ITEM_INDEX(thisx); - this->switchFlag = EN_TALK_GIBUD_SWITCH_FLAG(thisx); + this->switchFlag = EN_TALK_GIBUD_GET_SWITCH_FLAG(thisx); this->drawDmgEffAlpha = 0.0f; this->drawDmgEffScale = 0.0f; - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - this->limbPos[i] = gZeroVec3f; + for (i = 0; i < EN_TALK_GIBUD_BODYPART_MAX; i++) { + this->bodyPartsPos[i] = gZeroVec3f; } if (this->requestedItemIndex < EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BLUE_POTION) { @@ -345,8 +345,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; - if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) || - (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_GORON) || (GET_PLAYER_FORM == PLAYER_FORM_DEKU)) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnTalkGibud_SetupGrabFail(this); @@ -384,16 +383,15 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupGrab(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_GRAB_START); this->grabDamageTimer = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->grabState = EN_TALK_GIBUD_GRAB_START; this->actionFunc = EnTalkGibud_Grab; } void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { - Player* player2 = GET_PLAYER(play); - Player* player = player2; + Actor* playerActor = &GET_PLAYER(play)->actor; + Player* player = (Player*)playerActor; s32 inPositionToAttack; - u16 damageSfxId; switch (this->grabState) { case EN_TALK_GIBUD_GRAB_START: @@ -406,9 +404,8 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { case EN_TALK_GIBUD_GRAB_ATTACK: if (this->grabDamageTimer == 20) { - s16 requiredScopeTemp; + u16 damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; - damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; play->damagePlayer(play, -8); Player_PlaySfx(player, damageSfxId); Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); @@ -424,11 +421,11 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { if (!(player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B62 != 0)) { if ((player->unk_B62 != 0) && (player->stateFlags2 & PLAYER_STATE2_80)) { player->stateFlags2 &= ~PLAYER_STATE2_80; - player->unk_AE8 = 100; + player->actionVar2 = 100; } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_GRAB_END); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->grabState = EN_TALK_GIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; } @@ -516,7 +513,7 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { this->actor.world.rot = this->actor.shape.rot; } if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play)) { - if ((gSaveContext.save.playerForm != PLAYER_FORM_GORON) && (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) && + if ((GET_PLAYER_FORM != PLAYER_FORM_GORON) && (GET_PLAYER_FORM != PLAYER_FORM_DEKU) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnTalkGibud_SetupWalkToPlayer(this); } @@ -572,8 +569,8 @@ void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { if ((this->drawDmgEffTimer > 0) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) && (this->type == EN_TALK_GIBUD_TYPE_GIBDO)) { this->actor.hintId = TATL_HINT_ID_REDEAD; - this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); - this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); + this->actor.flags &= ~(ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_TARGETABLE); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, GIBDO_LIMB_MAX); this->type = EN_TALK_GIBUD_TYPE_REDEAD; @@ -589,7 +586,7 @@ void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupDead(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DEATH); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; this->actionFunc = EnTalkGibud_Dead; @@ -615,7 +612,7 @@ void EnTalkGibud_Dead(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupRevive(EnTalkGibud* this) { Animation_Change(&this->skelAnime, &gGibdoRedeadDeathAnim, -1.0f, Animation_GetLastFrame(&gGibdoRedeadDeathAnim), 0.0f, ANIMMODE_ONCE, -8.0f); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_REVERSE); this->deathTimer = 0; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -791,7 +788,7 @@ void EnTalkGibud_PassiveIdle(EnTalkGibud* this, PlayState* play) { EnTalkGibud_SetupTalk(this); } else if (this->actor.xzDistToPlayer < 100.0f && !(this->collider.base.acFlags & AC_HIT)) { Actor_TrackPlayer(play, &this->actor, &this->headRotation, &this->upperBodyRotation, this->actor.focus.pos); - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } else { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); @@ -855,7 +852,7 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupDisappear(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_IDLE); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->disappearanceTimer = 40; this->actionFunc = EnTalkGibud_Disappear; } @@ -879,7 +876,7 @@ void EnTalkGibud_Disappear(EnTalkGibud* this, PlayState* play) { velocity.z += Rand_Centered() * 1.5f; func_800B3030(play, &pos, &velocity, &accel, 100, 0, 1); } - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); player->stateFlags1 |= PLAYER_STATE1_20000000; this->disappearanceTimer--; } else { @@ -937,15 +934,15 @@ void EnTalkGibud_CheckForGibdoMask(EnTalkGibud* this, PlayState* play) { (this->actionFunc != EnTalkGibud_Damage) && (this->actionFunc != EnTalkGibud_Talk)) { if (this->actionFunc != EnTalkGibud_PassiveIdle) { if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { - this->actor.flags &= ~(ACTOR_FLAG_4 | ACTOR_FLAG_1); - this->actor.flags |= (ACTOR_FLAG_8 | ACTOR_FLAG_1); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); + this->actor.flags |= (ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_TARGETABLE); this->actor.hintId = TATL_HINT_ID_NONE; this->actor.textId = 0; EnTalkGibud_SetupPassiveIdle(this); } } else if (Player_GetMask(play) != PLAYER_MASK_GIBDO) { - this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); - this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); + this->actor.flags &= ~(ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_TARGETABLE); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); if (this->type == EN_TALK_GIBUD_TYPE_REDEAD) { this->actor.hintId = TATL_HINT_ID_REDEAD; } else { @@ -994,7 +991,7 @@ s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, PlayState* distanceFromTargetPos = Math_Vec3f_StepTo(&this->actor.world.pos, &targetPos, 10.0f); distanceFromTargetAngle = Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { distanceFromTargetYOffset = Math_SmoothStepToF(&this->actor.shape.yOffset, -1500.0f, 1.0f, 150.0f, 0.0f); } @@ -1191,8 +1188,8 @@ void EnTalkGibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s (limbIndex == GIBDO_LIMB_LEFT_FOREARM) || (limbIndex == GIBDO_LIMB_LEFT_HAND) || (limbIndex == GIBDO_LIMB_RIGHT_SHOULDER_AND_UPPER_ARM) || (limbIndex == GIBDO_LIMB_RIGHT_FOREARM) || (limbIndex == GIBDO_LIMB_RIGHT_HAND) || (limbIndex == GIBDO_LIMB_HEAD) || (limbIndex == GIBDO_LIMB_PELVIS))) { - Matrix_MultZero(&this->limbPos[this->limbIndex]); - this->limbIndex++; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; } } @@ -1201,7 +1198,7 @@ void EnTalkGibud_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->limbIndex = 0; + this->bodyPartIndex = 0; if (this->actor.shape.shadowAlpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -1223,8 +1220,8 @@ void EnTalkGibud_Draw(Actor* thisx, PlayState* play) { } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, - 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_TALK_GIBUD_BODYPART_MAX, + this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h index d887b1c0d..06ccd3914 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h @@ -5,19 +5,38 @@ #include "objects/object_rd/object_rd.h" #define EN_TALK_GIBUD_REQUESTED_ITEM_INDEX(thisx) ((thisx)->params & 0xF) -#define EN_TALK_GIBUD_SWITCH_FLAG(thisx) (((thisx)->params & 0xFF0) >> 4) +#define EN_TALK_GIBUD_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFF0) >> 4) struct EnTalkGibud; typedef void (*EnTalkGibudActionFunc)(struct EnTalkGibud*, PlayState*); +typedef enum EnTalkGibudBodyPart { + /* 0 */ EN_TALK_GIBUD_BODYPART_0, + /* 1 */ EN_TALK_GIBUD_BODYPART_1, + /* 2 */ EN_TALK_GIBUD_BODYPART_2, + /* 3 */ EN_TALK_GIBUD_BODYPART_3, + /* 4 */ EN_TALK_GIBUD_BODYPART_4, + /* 5 */ EN_TALK_GIBUD_BODYPART_5, + /* 6 */ EN_TALK_GIBUD_BODYPART_6, + /* 7 */ EN_TALK_GIBUD_BODYPART_7, + /* 8 */ EN_TALK_GIBUD_BODYPART_8, + /* 9 */ EN_TALK_GIBUD_BODYPART_9, + /* 10 */ EN_TALK_GIBUD_BODYPART_10, + /* 11 */ EN_TALK_GIBUD_BODYPART_11, + /* 12 */ EN_TALK_GIBUD_BODYPART_12, + /* 13 */ EN_TALK_GIBUD_BODYPART_13, + /* 14 */ EN_TALK_GIBUD_BODYPART_14, + /* 15 */ EN_TALK_GIBUD_BODYPART_MAX +} EnTalkGibudBodyPart; + typedef struct EnTalkGibud { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnTalkGibudActionFunc actionFunc; - /* 0x1D8 */ Vec3f limbPos[15]; - /* 0x28C */ s32 limbIndex; + /* 0x1D8 */ Vec3f bodyPartsPos[EN_TALK_GIBUD_BODYPART_MAX]; + /* 0x28C */ s32 bodyPartIndex; /* 0x290 */ s32 requestedItemIndex; /* 0x294 */ PlayerItemAction itemAction; /* 0x298 */ s32 switchFlag; diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index c71676061..876b433d4 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -6,7 +6,7 @@ #include "z_en_tanron1.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTanron1*)thisx) @@ -30,14 +30,14 @@ ActorInit En_Tanron1_InitVars = { (ActorFunc)EnTanron1_Draw, }; -static u64 sPad = { 0 }; +static s32 sPad = 0; #include "overlays/ovl_En_Tanron1/ovl_En_Tanron1.c" void EnTanron1_Init(Actor* thisx, PlayState* play) { EnTanron1* this = THIS; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (!ENTANRON1_GET_100(&this->actor)) { this->unk_144 = 0; } else { @@ -149,7 +149,7 @@ void EnTanron1_Update(Actor* thisx, PlayState* play) { break; } - if ((player->heldItemAction == PLAYER_IA_STICK) && (player->unk_B28 != 0)) { + if ((player->heldItemAction == PLAYER_IA_DEKU_STICK) && (player->unk_B28 != 0)) { this->unk_14C.x = player->meleeWeaponInfo[0].tip.x; this->unk_14C.y = player->meleeWeaponInfo[0].tip.y; this->unk_14C.z = player->meleeWeaponInfo[0].tip.z; @@ -354,9 +354,9 @@ void func_80BB5318(EnTanron1* this, PlayState* play) { if (spB4 != NULL) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, spB4, &this->unk_3360, &spB0); if (spB8 >= (s16)(KREG(39) + 20)) { - Audio_PlaySfxAtPos(&this->unk_3360, NA_SE_EN_MB_MOTH_DEAD); + Audio_PlaySfx_AtPos(&this->unk_3360, NA_SE_EN_MB_MOTH_DEAD); } else if (spBA >= 20) { - Audio_PlaySfxAtPos(&this->unk_3360, NA_SE_EN_MB_MOTH_FLY - SFX_FLAG); + Audio_PlaySfx_AtPos(&this->unk_3360, NA_SE_EN_MB_MOTH_FLY - SFX_FLAG); } } } diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 785308dad..a539e82f5 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -9,7 +9,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_boss04/object_boss04.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTanron2*)thisx) @@ -124,7 +124,7 @@ void EnTanron2_Init(Actor* thisx, PlayState* play) { EnTanron2* this = THIS; D_80BB8450 = (Boss04*)this->actor.parent; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->actor.params == 100) { this->actor.update = func_80BB7B90; @@ -138,7 +138,7 @@ void EnTanron2_Init(Actor* thisx, PlayState* play) { this->actor.draw = NULL; this->actor.colChkInfo.health = 1; this->actor.colChkInfo.damageTable = &sDamageTable; - this->actor.targetMode = 5; + this->actor.targetMode = TARGET_MODE_5; Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); @@ -207,7 +207,7 @@ void func_80BB6B80(EnTanron2* this) { this->actor.velocity.x = 0.0f; this->unk_158 = 0; this->unk_159 = 1; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->collider1.dim.radius = 30; this->collider1.dim.height = 50; this->collider1.dim.yShift = -25; @@ -428,10 +428,10 @@ void func_80BB7578(EnTanron2* this, PlayState* play) { func_80BB6B80(this); this->unk_158 = 1; Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_DAMAGE); - if ((player->targetedActor != NULL) && (&this->actor != player->targetedActor)) { - player->targetedActor = &this->actor; - play->actorCtx.targetContext.arrowPointedActor = &this->actor; - play->actorCtx.targetContext.targetedActor = &this->actor; + if ((player->lockOnActor != NULL) && (&this->actor != player->lockOnActor)) { + player->lockOnActor = &this->actor; + play->actorCtx.targetCtx.fairyActor = &this->actor; + play->actorCtx.targetCtx.lockOnActor = &this->actor; } } else { this->unk_154 = 15; @@ -550,10 +550,10 @@ void EnTanron2_Update(Actor* thisx, PlayState* play) { if (ABS_ALT(BINANG_SUB(D_80BB8450->actor.yawTowardsPlayer, atan)) > 0x3000) { this->unk_159 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { this->unk_159 = 1; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; } } } diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 81a4ac2af..2c7a9fd55 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_Boss_03/z_boss_03.h" #include "objects/object_boss03/object_boss03.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTanron3*)thisx) @@ -117,7 +117,7 @@ void EnTanron3_Init(Actor* thisx, PlayState* play) { this->morphTable, GYORG_SMALL_FISH_LIMB_MAX); Actor_SetScale(&this->actor, 0.02f); EnTanron3_SetupLive(this, play); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->currentRotationAngle = Rand_ZeroFloat(500000.0f); this->waterSurfaceYPos = 430.0f; sGyorg = (Boss03*)this->actor.parent; diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index 074eaec79..ab190b38c 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -48,9 +48,9 @@ void EnTanron4_Init(Actor* thisx, PlayState* play2) { EnTanron4* this = THIS; SkelAnime_InitFlex(play, &this->skelAnime, &gSeagullSkel, &gSeagullFlapAnim, this->jointTable, this->morphTable, - OBJECT_TANRON4_LIMB_MAX); + SEAGULL_LIMB_RIGHT_WING_MAX); - thisx->flags &= ~ACTOR_FLAG_1; + thisx->flags &= ~ACTOR_FLAG_TARGETABLE; thisx->speed = 3.0f + KREG(48); thisx->uncullZoneForward = 10000.0f + KREG(70); this->randRollTimer = Rand_ZeroFloat(10.0f); @@ -138,8 +138,7 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { switch (this->flyState) { case SEAGULL_FLY_FLAP: - if ((this->timers[SEAGULL_TIMER_FLY_STATE] == 0) && - (Animation_OnFrame(&this->skelAnime, 2.0f + KREG(42)))) { + if ((this->timers[SEAGULL_TIMER_FLY_STATE] == 0) && Animation_OnFrame(&this->skelAnime, 2.0f + KREG(42))) { this->flyState = SEAGULL_FLY_GLIDE; this->timers[SEAGULL_TIMER_FLY_STATE] = Rand_ZeroFloat(50.0f) + 50.0f; Animation_MorphToLoop(&this->skelAnime, &gSeagullFlapAnim, -15.0f + KREG(43)); @@ -217,8 +216,7 @@ void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play) { switch (this->flyState) { case SEAGULL_FLY_FLAP: - if ((this->timers[SEAGULL_TIMER_FLY_STATE] == 0) && - (Animation_OnFrame(&this->skelAnime, 2.0f + KREG(42)))) { + if ((this->timers[SEAGULL_TIMER_FLY_STATE] == 0) && Animation_OnFrame(&this->skelAnime, 2.0f + KREG(42))) { this->flyState = SEAGULL_FLY_GLIDE; this->timers[SEAGULL_TIMER_FLY_STATE] = Rand_ZeroFloat(50.0f) + 50.0f; Animation_MorphToLoop(&this->skelAnime, &gSeagullFlapAnim, -15.0f + KREG(43)); diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h index 36a48c91a..93183dda9 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h @@ -19,8 +19,8 @@ typedef struct EnTanron4 { /* 0x15C */ s16 rollTarget; /* 0x160 */ f32 timeInfluence; /* 0x164 */ SkelAnime skelAnime; - /* 0x1A8 */ Vec3s jointTable[OBJECT_TANRON4_LIMB_MAX]; - /* 0x1EA */ Vec3s morphTable[OBJECT_TANRON4_LIMB_MAX]; + /* 0x1A8 */ Vec3s jointTable[SEAGULL_LIMB_RIGHT_WING_MAX]; + /* 0x1EA */ Vec3s morphTable[SEAGULL_LIMB_RIGHT_WING_MAX]; /* 0x022C */ EnTanron4ActionFunc actionFunc; } EnTanron4; // size = 0x230 diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index a56b01c3b..3f8442dad 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -1,7 +1,23 @@ /* * File: z_en_tanron5.c * Overlay: ovl_En_Tanron5 - * Description: Destructible props in Twinmold's arena + * Description: Destructible ruins, fragments, and item drops in Twinmold's arena. + * + * This actor is responsible for three different interactive props in Twinmold's arena, all of which can be further + * divided into more categories. The main thing this actor handles are the destructible ruins placed around the arena, + * of which there are two kinds. There are pillars with Majora's Mask on them, and there are ruins in a roughly + * pyramidal shape. While both types of ruin behave in roughly the same way, how they implement this behavior can + * sometimes be quite different. + * + * When Twinmold or the player wearing the Giant's Mask hits one of these destructible ruins, various fragments + * of the ruin fly off from the point of impact. These fragments are handled by this actor as well. The fragments + * can be large or small, and the two sizes behave almost identically outside of two small differences. Large + * fragments can damage the player and sink into the sand once they hit the ground, whereas small fragments + * deal no damage and despawn upon touching the ground. + * + * Sometimes, item drops can also appear when a destructible ruin is hit; this actor is responsible for handling + * these drops too. There are drops that give the player 10 arrows, and drops that give the player a big magic + * jar, and these drops behave identically outside of what item they give when collected by the player. */ #include "z_en_tanron5.h" @@ -18,10 +34,15 @@ void EnTanron5_Destroy(Actor* thisx, PlayState* play); void EnTanron5_Update(Actor* thisx, PlayState* play2); void EnTanron5_Draw(Actor* thisx, PlayState* play); -void func_80BE5818(Actor* thisx, PlayState* play2); -void func_80BE5C10(Actor* thisx, PlayState* play); +void EnTanron5_RuinFragmentItemDrop_Update(Actor* thisx, PlayState* play2); +void EnTanron5_ItemDrop_Draw(Actor* thisx, PlayState* play); -s32 D_80BE5D80 = 0; +typedef enum { + /* 0 */ TWINMOLD_PROP_ITEM_DROP_TYPE_10_ARROWS, + /* 1 */ TWINMOLD_PROP_ITEM_DROP_TYPE_MAGIC_JAR_BIG +} TwinmoldPropItemDropType; + +s32 sFragmentAndItemDropCount = 0; ActorInit En_Tanron5_InitVars = { ACTOR_EN_TANRON5, @@ -55,90 +76,136 @@ static ColliderCylinderInit sCylinderInit = { { 70, 450, 0, { 0, 0, 0 } }, }; -f32 D_80BE5DD0 = 1.0f; +/** + * Multiplies the scale differently depending on whether the player is wearing the Giant's Mask or not. + * When the player is wearing the Giant's Mask, this value is smaller to make the player seem larger. + */ +static f32 sGiantModeScaleFactor = 1.0f; -Vec2s D_80BE5DD4[] = { - { 0x4B0, 0x9C4 }, { -0x4B0, 0x9C4 }, { 0x4B0, -0x9C4 }, { -0x4B0, -0x9C4 }, { 0x9C4, 0x4B0 }, - { -0x9C4, 0x4B0 }, { 0x9C4, -0x4B0 }, { -0x9C4, -0x4B0 }, { 0x3E8, 0x3E8 }, { -0x3E8, 0x3E8 }, - { 0x3E8, -0x3E8 }, { -0x3E8, -0x3E8 }, { 0x000, -0x3E8 }, { 0x000, 0x3E8 }, { 0x3E8, 0x000 }, - { -0x3E8, 0x000 }, { 0x000, -0x7D0 }, { 0x000, 0x7D0 }, { 0x7D0, 0x000 }, { -0x7D0, 0x000 }, +/** + * Stores the X and Z spawn positions for all of the ruins. Their Y spawn position is determined by the + * height of the floor, so there's no need to store it. + */ +static Vec2s sSpawnPosList[] = { + { 1200, 2500 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_1 + { -1200, 2500 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_2 + { 1200, -2500 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_3 + { -1200, -2500 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_4 + { 2500, 1200 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_5 + { -2500, 1200 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_6 + { 2500, -1200 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_7 + { -2500, -1200 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_8 + { 1000, 1000 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_9 + { -1000, 1000 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_10 + { 1000, -1000 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_11 + { -1000, -1000 }, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_12 + { 0, -1000 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_1 + { 0, 1000 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_2 + { 1000, 0 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_3 + { -1000, 0 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_4 + { 0, -2000 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_5 + { 0, 2000 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_6 + { 2000, 0 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_7 + { -2000, 0 }, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_8 }; -Gfx* D_80BE5E24[] = { - gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, - gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, - gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, gTwinmoldMajoraPillarDL, - gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, - gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, gTwinmoldPyramidRuinDL, +/** + * Display lists for all ruins. + */ +static Gfx* sDLists[] = { + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_1 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_2 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_3 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_4 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_5 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_6 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_7 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_8 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_9 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_10 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_11 + gTwinmoldRuinPillarDL, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_12 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_1 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_2 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_3 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_4 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_5 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_6 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_7 + gTwinmoldRuinPyramidDL, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_8 }; -f32 D_80BE5E74[] = { - 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, - 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, 0.09f, +/** + * The initial base scale for all ruins. In the final game, this array isn't very useful, + * since they're all the same value, but this could be used to make some ruins larger or + * smaller than the others. + */ +static f32 sBaseScales[] = { + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_1 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_2 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_3 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_4 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_5 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_6 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_7 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_8 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_9 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_10 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_11 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PILLAR_12 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_1 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_2 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_3 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_4 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_5 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_6 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_7 + 0.09f, // TWINMOLD_PROP_TYPE_RUIN_PYRAMID_8 }; -typedef struct { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ f32 unk_0C; - /* 0x10 */ f32 unk_10; - /* 0x14 */ f32 unk_14; - /* 0x18 */ Vec3f unk_18; - /* 0x24 */ u8 unk_24; - /* 0x26 */ s16 unk_26; - /* 0x28 */ UNK_TYPE1 unk28[0x4]; - /* 0x2C */ s16 unk_2C; - /* 0x2E */ UNK_TYPE1 unk2E[0x6]; - /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 unk_38; -} EnTanron5Effect; // size = 0x3C - -void func_80BE4930(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { +/** + * Spawns the sand effect that appears when a ruin fragment hits the ground. + */ +void EnTanron5_SpawnEffectSand(TwinmoldEffect* effect, Vec3f* pos, f32 scale) { s16 i; - for (i = 0; i < 150; i++, effect++) { - if (effect->unk_24 == 0) { - effect->unk_24 = 1; - - effect->unk_00 = *arg1; - - effect->unk_0C = Rand_CenteredFloat(10.0f); - effect->unk_10 = Rand_ZeroFloat(2.0f) + 3.0f; - effect->unk_14 = Rand_CenteredFloat(10.0f); - - effect->unk_18.y = -0.15f; - effect->unk_18.x = 0.0f; - effect->unk_18.z = 0.0f; - - effect->unk_2C = Rand_ZeroFloat(100.0f) + 200.0f; - effect->unk_26 = 0; - effect->unk_34 = arg2; - effect->unk_38 = 2.0f * arg2; + for (i = 0; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { + if (effect->type == TWINMOLD_EFFECT_NONE) { + effect->type = TWINMOLD_EFFECT_SAND; + effect->pos = *pos; + effect->velocity.x = Rand_CenteredFloat(10.0f); + effect->velocity.y = Rand_ZeroFloat(2.0f) + 3.0f; + effect->velocity.z = Rand_CenteredFloat(10.0f); + effect->accel.y = -0.15f; + effect->accel.x = effect->accel.z = 0.0f; + effect->alpha = Rand_ZeroFloat(100.0f) + 200.0f; + effect->timer = 0; + effect->scale = scale; + effect->targetScale = 2.0f * scale; break; } } } -void func_80BE4A2C(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { +/** + * Spawns the black dust that appears whenever part of a ruin is destroyed. + */ +void EnTanron5_SpawnEffectBlackDust(TwinmoldEffect* effect, Vec3f* pos, f32 scale) { s16 i; - for (i = 0; i < 150; i++, effect++) { - if (effect->unk_24 == 0) { - effect->unk_24 = 2; - - effect->unk_00 = *arg1; - - effect->unk_0C = Rand_CenteredFloat(30.0f); - effect->unk_10 = Rand_ZeroFloat(7.0f); - effect->unk_14 = Rand_CenteredFloat(30.0f); - - effect->unk_18.y = -0.3f; - effect->unk_18.x = 0.0f; - effect->unk_18.z = 0.0f; - - effect->unk_2C = Rand_ZeroFloat(70.0f) + 150.0f; - effect->unk_26 = 0; - effect->unk_34 = arg2; - effect->unk_38 = 2.0f * arg2; + for (i = 0; i < TWINMOLD_EFFECT_COUNT; i++, effect++) { + if (effect->type == TWINMOLD_EFFECT_NONE) { + effect->type = TWINMOLD_EFFECT_BLACK_DUST; + effect->pos = *pos; + effect->velocity.x = Rand_CenteredFloat(30.0f); + effect->velocity.y = Rand_ZeroFloat(7.0f); + effect->velocity.z = Rand_CenteredFloat(30.0f); + effect->accel.y = -0.3f; + effect->accel.x = effect->accel.z = 0.0f; + effect->alpha = Rand_ZeroFloat(70.0f) + 150.0f; + effect->timer = 0; + effect->scale = scale; + effect->targetScale = 2.0f * scale; break; } } @@ -147,54 +214,60 @@ void func_80BE4A2C(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { void EnTanron5_Init(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; - if (ENTANRON5_GET(&this->actor) >= ENTANRON5_100) { - D_80BE5D80++; - if (D_80BE5D80 > 60) { + if (TWINMOLD_PROP_GET_TYPE(&this->actor) >= TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_1) { + // This is a ruin fragment or item drop; if there are more than 60 fragments or drops + // already spawned, immediately kill this one. Otherwise, set up the fragment or drop + // to fly off while spinning randomly. + sFragmentAndItemDropCount++; + if (sFragmentAndItemDropCount > 60) { Actor_Kill(&this->actor); return; } - this->unk_198 = Rand_CenteredFloat(0x2000); - this->unk_19A = Rand_CenteredFloat(0x2000); + // fragmentAngularVelocityX is in a union with itemDropRotZ, so for item drops, this code + // will initialize its z-rotation to a random value. + this->fragmentAngularVelocityX = Rand_CenteredFloat(0x2000); + this->fragmentAngularVelocityY = Rand_CenteredFloat(0x2000); - if (ENTANRON5_GET(&this->actor) < ENTANRON5_107) { - Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.025f) + 0.085f) * D_80BE5DD0); + if (TWINMOLD_PROP_GET_TYPE(&this->actor) <= TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_7) { + Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.025f) + 0.085f) * sGiantModeScaleFactor); } else { - Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.015f) + 0.01f) * D_80BE5DD0); + Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.015f) + 0.01f) * sGiantModeScaleFactor); } - this->actor.speed = (Rand_ZeroFloat(10.0f) + 10.0f) * D_80BE5DD0; - this->actor.velocity.y = (Rand_ZeroFloat(10.0f) + 15.0f) * D_80BE5DD0; - this->actor.gravity = -2.5f * D_80BE5DD0; - this->actor.terminalVelocity = -1000.0f * D_80BE5DD0; - this->actor.update = func_80BE5818; + this->actor.speed = (Rand_ZeroFloat(10.0f) + 10.0f) * sGiantModeScaleFactor; + this->actor.velocity.y = (Rand_ZeroFloat(10.0f) + 15.0f) * sGiantModeScaleFactor; + this->actor.gravity = -2.5f * sGiantModeScaleFactor; + this->actor.terminalVelocity = -1000.0f * sGiantModeScaleFactor; + this->actor.update = EnTanron5_RuinFragmentItemDrop_Update; - if (ENTANRON5_GET(&this->actor) >= ENTANRON5_110) { - this->actor.draw = func_80BE5C10; - this->unk_1A0 = Rand_ZeroFloat(1.999f); - Actor_SetScale(&this->actor, D_80BE5DD0 * 0.03f); - this->unk_144 = 250; + if (TWINMOLD_PROP_GET_TYPE(&this->actor) >= TWINMOLD_PROP_TYPE_ITEM_DROP_1) { + this->actor.draw = EnTanron5_ItemDrop_Draw; + this->itemDropType = Rand_ZeroFloat(1.999f); + Actor_SetScale(&this->actor, sGiantModeScaleFactor * 0.03f); + this->timer = 250; this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0; } else { - this->unk_148 = gRuinFragmentDL; - this->unk_144 = 150; + this->dList = gRuinFragmentDL; + this->timer = 150; } - } else if (ENTANRON5_GET(&this->actor) == ENTANRON5_0) { + } else if (TWINMOLD_PROP_GET_TYPE(&this->actor) == TWINMOLD_PROP_TYPE_STATIC) { EnTanron5* child; s32 i; - for (i = 0; i < ARRAY_COUNT(D_80BE5E74); i++) { - child = - (EnTanron5*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, D_80BE5DD4[i].x, - this->actor.world.pos.y, D_80BE5DD4[i].z, 0, Rand_ZeroFloat(0x10000), 0, i + 1); + // Spawns all of the ruins in the right places. Gets killed after everything is spawned. + for (i = 0; i < ARRAY_COUNT(sSpawnPosList); i++) { + child = (EnTanron5*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, sSpawnPosList[i].x, + this->actor.world.pos.y, sSpawnPosList[i].z, 0, Rand_ZeroFloat(0x10000), 0, + TWINMOLD_PROP_PARAMS(TWINMOLD_PROP_TYPE_RUIN_PILLAR_1 + i)); child->actor.parent = this->actor.parent; - child->unk_19C = D_80BE5E74[i]; + child->baseScale = sBaseScales[i]; - Actor_SetScale(&child->actor, child->unk_19C); + Actor_SetScale(&child->actor, child->baseScale); - child->unk_148 = D_80BE5E24[i]; - if (child->unk_148 == gTwinmoldPyramidRuinDL) { + child->dList = sDLists[i]; + if (child->dList == gTwinmoldRuinPyramidDL) { child->actor.shape.rot.y = 0; } @@ -203,6 +276,8 @@ void EnTanron5_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } else { + // This is a ruin; update its y-position to be just below the floor, so it looks like it's + // buried in the sand. Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y = this->actor.floorHeight + -20.0f; } @@ -211,25 +286,31 @@ void EnTanron5_Init(Actor* thisx, PlayState* play) { void EnTanron5_Destroy(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; - if (ENTANRON5_GET(&this->actor) >= ENTANRON5_100) { - D_80BE5D80--; + if (TWINMOLD_PROP_GET_TYPE(&this->actor) >= TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_1) { + sFragmentAndItemDropCount--; } } +/** + * This is the update function for the destructible ruins (both the pillar and pyarmid ruins). + */ void EnTanron5_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnTanron5* this = THIS; Boss02* boss02 = (Boss02*)this->actor.parent; Player* player = GET_PLAYER(play2); s32 i; - s32 phi_v0; - s32 spC4; - Vec3f spB8; + s32 yawDiff; + s32 fragmentAndItemCount; + Vec3f pos; - if (this->unk_1A0 >= 3) { - this->unk_1A0++; + // When a ruin is destroyed (i.e., it is hit three times), it will reduce its scale to 0.0f (making + // it effectively invisible and intangible), then wait an additional 37 frames before actually + // calling Actor_Kill to despawn. The reason for this extra waiting period is unknown. + if (this->hitCount >= 3) { + this->hitCount++; Actor_SetScale(&this->actor, 0.0f); - if (this->unk_1A0 >= 40) { + if (this->hitCount >= 40) { Actor_Kill(&this->actor); } return; @@ -237,154 +318,184 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { // required } - if (this->unk_144 != 0) { - this->unk_144--; - } + DECR(this->timer); + //! @bug This code will keep sGiantModeScaleFactor up-to-date so long as at least one ruin is still active. + //! However, once the last ruin is destroyed, this code will no longer run, so sGiantModeScaleFactor will + //! get "stuck" at whatever its current value is. This is a problem, because other instances of EnTanron5, + //! like the item drops, rely on this variable being updated to function properly. Getting in this "stuck" + //! state can result in odd behavior for these other instances, like item drops not being obtainable when + //! the player is normal-sized. + //! + //! The strange waiting period before despawning seen above may be an attempt to mitigate this, but it + //! doesn't work. It doesn't update sGiantModeScaleFactor, and even if it did, waiting 37 frames before + //! despawning is far too short of a time to wait, since item drops take 250 frames to despawn. if (boss02->actor.update != NULL) { - D_80BE5DD0 = boss02->unk_01AC; + sGiantModeScaleFactor = boss02->giantModeScaleFactor; } else { - D_80BE5DD0 = 1.0f; + sGiantModeScaleFactor = 1.0f; } - Actor_SetScale(&this->actor, this->unk_19C * D_80BE5DD0); + Actor_SetScale(&this->actor, this->baseScale * sGiantModeScaleFactor); - if (this->unk_148 == gTwinmoldMajoraPillarDL) { - this->collider.dim.radius = 65.0f * D_80BE5DD0; - this->collider.dim.height = 380.0f * D_80BE5DD0; - } else if (this->unk_1A0 == 0) { - this->collider.dim.radius = 85.0f * D_80BE5DD0; - this->collider.dim.height = 200.0f * D_80BE5DD0; - } else if (this->unk_1A0 == 1) { - this->collider.dim.radius = 95.0f * D_80BE5DD0; - this->collider.dim.height = 100.0f * D_80BE5DD0; - } else if (this->unk_1A0 == 2) { - this->collider.dim.radius = 95.0f * D_80BE5DD0; - this->collider.dim.height = 30.0f * D_80BE5DD0; + if (this->dList == gTwinmoldRuinPillarDL) { + this->collider.dim.radius = 65.0f * sGiantModeScaleFactor; + this->collider.dim.height = 380.0f * sGiantModeScaleFactor; + } else if (this->hitCount == 0) { + this->collider.dim.radius = 85.0f * sGiantModeScaleFactor; + this->collider.dim.height = 200.0f * sGiantModeScaleFactor; + } else if (this->hitCount == 1) { + this->collider.dim.radius = 95.0f * sGiantModeScaleFactor; + this->collider.dim.height = 100.0f * sGiantModeScaleFactor; + } else if (this->hitCount == 2) { + this->collider.dim.radius = 95.0f * sGiantModeScaleFactor; + this->collider.dim.height = 30.0f * sGiantModeScaleFactor; } - if (this->unk_144 == 0) { + if (this->timer == 0) { if (this->collider.base.acFlags & AC_HIT) { ColliderInfo* acHitInfo = this->collider.info.acHitInfo; Actor* ac = this->collider.base.ac; this->collider.base.acFlags &= ~AC_HIT; - spC4 = 10; + fragmentAndItemCount = 10; if (Play_InCsMode(play)) { - this->unk_144 = 1; + // In Twinmold's opening cutscene, it emerges from the sand beneath a ruin and destroys it. + // Setting the timer to 1 here allows Twinmold to hit the ruin every single frame during the + // cutscene, allowing it to destory the ruin in only 3 frames. + this->timer = 1; } else { - this->unk_144 = 5; - spC4 = (s32)Rand_ZeroFloat(2.99f) + 10; + this->timer = 5; + fragmentAndItemCount = (s32)Rand_ZeroFloat(2.99f) + 10; } - if ((KREG(19) != 0) || ((acHitInfo->toucher.dmgFlags & 0x05000202) && (D_80BE5DD0 < 0.5f)) || + if ((KREG(19) != 0) || ((acHitInfo->toucher.dmgFlags & 0x05000202) && (sGiantModeScaleFactor < 0.5f)) || (ac->id == ACTOR_BOSS_02)) { - if (this->unk_148 == gTwinmoldMajoraPillarDL) { - Math_Vec3f_Copy(&spB8, &this->actor.world.pos); - spB8.y += D_80BE5DD0 * 300.0f; + if (this->dList == gTwinmoldRuinPillarDL) { + // To create the appearance of the pillar shrinking after being hit, push it further into the floor, + // spawn some ruin fragments, and also spawn some black dust effects. + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.y += sGiantModeScaleFactor * 300.0f; - for (i = 3; i < spC4; i++) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, spB8.x, spB8.y, spB8.z, - Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, i + 100); + // This will spawn four normal-sized ruin fragments, three small ruin fragments, and + // zero, one, or two item drops, depending on the result of Rand_ZeroFloat above. + for (i = 3; i < fragmentAndItemCount; i++) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, pos.x, pos.y, pos.z, + Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, + TWINMOLD_PROP_PARAMS(TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_1 + i)); } for (i = 0; i < 6; i++) { - func_80BE4A2C(play->specialEffects, &spB8, Rand_ZeroFloat(3.0f) + 6.0f); + EnTanron5_SpawnEffectBlackDust(play->specialEffects, &pos, Rand_ZeroFloat(3.0f) + 6.0f); } - this->actor.world.pos.y -= D_80BE5DD0 * 130.0f; + this->actor.world.pos.y -= sGiantModeScaleFactor * 130.0f; } else { - f32 spAC; - f32 spA8; - Vec3f sp9C; + f32 yFactor; + f32 xzFactor; + Vec3f fragmentAndDustPos; - if (this->unk_1A0 == 0) { - spAC = 180.0f; - this->unk_19C *= 1.4f; - } else if (this->unk_1A0 == 1) { - spAC = 230.0f; - this->unk_19C *= 1.37f; - } else if (this->unk_1A0 == 2) { - spAC = 780.0f; - this->unk_19C *= 1.5f; + // Check the number of times this pyramid ruin has been hit to scale it accordingly. + if (this->hitCount == 0) { + yFactor = 180.0f; + this->baseScale *= 1.4f; + } else if (this->hitCount == 1) { + yFactor = 230.0f; + this->baseScale *= 1.37f; + } else if (this->hitCount == 2) { + yFactor = 780.0f; + this->baseScale *= 1.5f; } - // TODO: determine if unk_1A0 ever has a different value from these 3, which will cause UB from spAC - // being uninitialised - this->actor.world.pos.y -= D_80BE5DD0 * spAC; - Actor_SetScale(&this->actor, this->unk_19C * D_80BE5DD0); - Math_Vec3f_Copy(&spB8, &this->actor.world.pos); - for (i = 0; i < spC4; i++) { - if (this->unk_1A0 == 0) { - spA8 = 100.0f; - spAC = 180.0f; - } else if (this->unk_1A0 == 1) { - spA8 = 200.0f; - spAC = 100.0f; - } else if (this->unk_1A0 == 2) { - spA8 = 250.0f; - spAC = 50.0f; + this->actor.world.pos.y -= sGiantModeScaleFactor * yFactor; + Actor_SetScale(&this->actor, this->baseScale * sGiantModeScaleFactor); + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + + for (i = 0; i < fragmentAndItemCount; i++) { + if (this->hitCount == 0) { + xzFactor = 100.0f; + yFactor = 180.0f; + } else if (this->hitCount == 1) { + xzFactor = 200.0f; + yFactor = 100.0f; + } else if (this->hitCount == 2) { + xzFactor = 250.0f; + yFactor = 50.0f; } - sp9C.x = (Rand_CenteredFloat(spA8) * D_80BE5DD0) + spB8.x; - sp9C.z = (Rand_CenteredFloat(spA8) * D_80BE5DD0) + spB8.z; - sp9C.y = this->actor.floorHeight + (spAC * D_80BE5DD0); + fragmentAndDustPos.x = pos.x + (Rand_CenteredFloat(xzFactor) * sGiantModeScaleFactor); + fragmentAndDustPos.z = pos.z + (Rand_CenteredFloat(xzFactor) * sGiantModeScaleFactor); + fragmentAndDustPos.y = this->actor.floorHeight + (yFactor * sGiantModeScaleFactor); - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, sp9C.x, sp9C.y, sp9C.z, - Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, i + 100); + // This will spawn seven normal-sized ruin fragments, three small ruin fragments, and + // zero, one, or two item drops, depending on the result of Rand_ZeroFloat above. + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, fragmentAndDustPos.x, fragmentAndDustPos.y, + fragmentAndDustPos.z, Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, + TWINMOLD_PROP_PARAMS(TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_1 + i)); if (i < 8) { - func_80BE4A2C(play->specialEffects, &sp9C, Rand_ZeroFloat(3.0f) + 6.0f); + EnTanron5_SpawnEffectBlackDust(play->specialEffects, &fragmentAndDustPos, + Rand_ZeroFloat(3.0f) + 6.0f); } } } + // To better sell the illusion of the ruin being partially destroyed when it's hit + // rather than just being pushed into the ground (which is what actually happens), + // this code will rotate the ruin in a somewhat-random way. if (Rand_ZeroOne() < 0.333f) { - phi_v0 = 0x4000; + yawDiff = 0x4000; } else if (Rand_ZeroOne() < 0.5f) { - phi_v0 = -0x8000; + yawDiff = -0x8000; } else { - phi_v0 = -0x4000; + yawDiff = -0x4000; } - this->actor.shape.rot.y += phi_v0; + this->actor.shape.rot.y += yawDiff; Actor_PlaySfx(&this->actor, NA_SE_IT_BIG_BOMB_EXPLOSION); Actor_RequestQuakeAndRumble(&this->actor, play, 4, 4); - this->unk_1A0++; + this->hitCount++; } else { - Vec3f sp90; + // Something hit the ruin, but it wasn't Twinmold, and it wasn't the player while in giant + // mode. Play the reflect sound effect and spawn some sparks instead of breaking. + Vec3f hitPos; ColliderInfo* info = this->collider.info.acHitInfo; - sp90.x = info->bumper.hitPos.x; - sp90.y = info->bumper.hitPos.y; - sp90.z = info->bumper.hitPos.z; + hitPos.x = info->bumper.hitPos.x; + hitPos.y = info->bumper.hitPos.y; + hitPos.z = info->bumper.hitPos.z; Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); - CollisionCheck_SpawnShieldParticlesMetal(play, &sp90); + CollisionCheck_SpawnShieldParticlesMetal(play, &hitPos); } } } Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->unk_148 == gTwinmoldPyramidRuinDL) { + if (this->dList == gTwinmoldRuinPyramidDL) { this->collider.dim.pos.y = this->actor.floorHeight; } - if ((this->unk_148 == gTwinmoldMajoraPillarDL) || (D_80BE5DD0 < 0.5f)) { + if ((this->dList == gTwinmoldRuinPillarDL) || (sGiantModeScaleFactor < 0.5f)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { + // The collider cylinder used for the pyramid ruin is smaller than the ruin's visual appearance. When + // the player is wearing the Giant's Mask, it works fine, but when the player is normal-sized, they can + // walk through the sides of the ruin and wander around inside it without the collider pushing them out. + // The below code prevents this from happening by manually updating the player's position if they get + // close enough to the ruin, effectively creating a collision "box" around it that pushes players out. f32 xDiff = player->actor.world.pos.x - this->actor.world.pos.x; - f32 yDiff = player->actor.world.pos.z - this->actor.world.pos.z; + f32 zDiff = player->actor.world.pos.z - this->actor.world.pos.z; - if ((fabsf(xDiff) < 120.0f) && (fabsf(yDiff) < 120.0f)) { - if (fabsf(yDiff) < fabsf(xDiff)) { + if ((fabsf(xDiff) < 120.0f) && (fabsf(zDiff) < 120.0f)) { + if (fabsf(zDiff) < fabsf(xDiff)) { if (xDiff > 0.0f) { player->actor.prevPos.x = player->actor.world.pos.x = this->actor.world.pos.x + 120.0f; } else { player->actor.prevPos.x = player->actor.world.pos.x = this->actor.world.pos.x - 120.0f; } - } else if (yDiff > 0.0f) { + } else if (zDiff > 0.0f) { player->actor.prevPos.z = player->actor.world.pos.z = this->actor.world.pos.z + 120.0f; } else { player->actor.prevPos.z = player->actor.world.pos.z = this->actor.world.pos.z - 120.0f; @@ -395,23 +506,29 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void func_80BE5818(Actor* thisx, PlayState* play2) { - f32 sp6C; +/** + * This is the update function for the fragments and the item drops that fly off from a destructible ruin. + */ +void EnTanron5_RuinFragmentItemDrop_Update(Actor* thisx, PlayState* play2) { + f32 interactionDistSq; s32 i; - Vec3f sp5C; + Vec3f pos; EnTanron5* this = THIS; PlayState* play = play2; - if ((ENTANRON5_GET(&this->actor) < ENTANRON5_110) && (this->unk_1A0 != 0)) { - this->unk_1A0++; - this->actor.world.pos.y -= 2.0f * D_80BE5DD0; - if (this->unk_1A0 == 40) { + // When a ruin fragment hits the floor, it will slowly sink into the sand. After sinking for 38 frames, + // the ruin fragment will despawn. + if ((TWINMOLD_PROP_GET_TYPE(&this->actor) < TWINMOLD_PROP_TYPE_ITEM_DROP_1) && (this->sinkTimer != 0)) { + this->sinkTimer++; + this->actor.world.pos.y -= 2.0f * sGiantModeScaleFactor; + if (this->sinkTimer == 40) { Actor_Kill(&this->actor); } + return; } - if (DECR(this->unk_144) == 0) { + if (DECR(this->timer) == 0) { Actor_Kill(&this->actor); } @@ -420,94 +537,102 @@ void func_80BE5818(Actor* thisx, PlayState* play2) { Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); } - if (ENTANRON5_GET(&this->actor) < ENTANRON5_110) { - this->actor.shape.rot.x += this->unk_198; - this->actor.shape.rot.y += this->unk_19A; - sp6C = 1225.0f; + if (TWINMOLD_PROP_GET_TYPE(&this->actor) < TWINMOLD_PROP_TYPE_ITEM_DROP_1) { + this->actor.shape.rot.x += this->fragmentAngularVelocityX; + this->actor.shape.rot.y += this->fragmentAngularVelocityY; + interactionDistSq = SQ(35.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (ENTANRON5_GET(&this->actor) < ENTANRON5_108) { - Math_Vec3f_Copy(&sp5C, &this->actor.world.pos); - sp5C.y = this->actor.floorHeight; + if (TWINMOLD_PROP_GET_TYPE(&this->actor) <= TWINMOLD_PROP_TYPE_FRAGMENT_SMALL_1) { + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.y = this->actor.floorHeight; for (i = 0; i < 4; i++) { - func_80BE4930(play->specialEffects, &sp5C, Rand_ZeroFloat(1.0f) + 2.0f); + EnTanron5_SpawnEffectSand(play->specialEffects, &pos, Rand_ZeroFloat(1.0f) + 2.0f); } - this->unk_1A0++; + + // Set the sinkTimer to a non-zero value so that this fragment will start sinking on the next update. + this->sinkTimer++; } else { + // Small ruin fragments don't sink into the sand; they just immediately despawn. Actor_Kill(&this->actor); } } } else { - sp6C = 400.0f; - this->unk_198 += 0x2000; + interactionDistSq = SQ(20.0f); + this->itemDropRotZ += 0x2000; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_198 = 0; + this->itemDropRotZ = 0; this->actor.speed = 0.0f; } } - if (this->unk_1A1 == 0) { - if ((D_80BE5DD0 > 0.5f) && - ((ENTANRON5_GET(&this->actor) < ENTANRON5_108) || (ENTANRON5_GET(&this->actor) >= ENTANRON5_110))) { + if (this->hitTimer == 0) { + if ((sGiantModeScaleFactor > 0.5f) && + ((TWINMOLD_PROP_GET_TYPE(&this->actor) <= TWINMOLD_PROP_TYPE_FRAGMENT_SMALL_1) || + (TWINMOLD_PROP_GET_TYPE(&this->actor) >= TWINMOLD_PROP_TYPE_ITEM_DROP_1))) { Player* player = GET_PLAYER(play); - Vec3f temp; + Vec3f pos; - temp.x = player->actor.world.pos.x - this->actor.world.pos.x; - temp.y = (player->actor.world.pos.y + 10.0f) - this->actor.world.pos.y; - temp.z = player->actor.world.pos.z - this->actor.world.pos.z; + pos.x = player->actor.world.pos.x - this->actor.world.pos.x; + pos.y = (player->actor.world.pos.y + 10.0f) - this->actor.world.pos.y; + pos.z = player->actor.world.pos.z - this->actor.world.pos.z; - if (SQXYZ(temp) < sp6C) { - if (ENTANRON5_GET(&this->actor) >= ENTANRON5_110) { - if (this->unk_1A0 == 0) { + if (SQXYZ(pos) < interactionDistSq) { + if (TWINMOLD_PROP_GET_TYPE(&this->actor) >= TWINMOLD_PROP_TYPE_ITEM_DROP_1) { + if (this->itemDropType == TWINMOLD_PROP_ITEM_DROP_TYPE_10_ARROWS) { Item_Give(play, ITEM_ARROWS_10); } else { - Item_Give(play, ITEM_MAGIC_LARGE); + Item_Give(play, ITEM_MAGIC_JAR_BIG); } + Actor_Kill(&this->actor); - play_sound(NA_SE_SY_GET_ITEM); + Audio_PlaySfx(NA_SE_SY_GET_ITEM); } else { - this->unk_1A1 = 20; + // Damages the player and knocks them back. Starts a 20-frame timer to prevent + // this same ruin fragment from damaging the player again too quickly. + this->hitTimer = 20; func_800B8D50(play, NULL, 5.0f, this->actor.world.rot.y, 0.0f, 8); } } } } else { - this->unk_1A1--; + this->hitTimer--; } } void EnTanron5_Draw(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; - if ((-500.0f * D_80BE5DD0) < this->actor.projectedPos.z) { + if ((-500.0f * sGiantModeScaleFactor) < this->actor.projectedPos.z) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, this->unk_148); + gSPDisplayList(POLY_OPA_DISP++, this->dList); CLOSE_DISPS(play->state.gfxCtx); } } -void func_80BE5C10(Actor* thisx, PlayState* play) { +void EnTanron5_ItemDrop_Draw(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; TexturePtr texture; - s32 phi_v0; + s32 shouldDraw; - if ((this->unk_144 > 50) || (this->unk_144 & 1)) { - phi_v0 = true; + // This makes the item drop flicker when it's close to despawning. + if ((this->timer > 50) || (this->timer & 1)) { + shouldDraw = true; } else { - phi_v0 = false; + shouldDraw = false; } - if (((-500.0f * D_80BE5DD0) < this->actor.projectedPos.z) && phi_v0) { + if (((-500.0f * sGiantModeScaleFactor) < this->actor.projectedPos.z) && shouldDraw) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - if (this->unk_1A0 == 0) { + if (this->itemDropType == TWINMOLD_PROP_ITEM_DROP_TYPE_10_ARROWS) { texture = gDropArrows1Tex; } else { texture = gDropMagicLargeTex; @@ -518,7 +643,7 @@ void func_80BE5C10(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(texture)); Matrix_Translate(0.0f, 200.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateZS(this->unk_198, MTXMODE_APPLY); + Matrix_RotateZS(this->itemDropRotZ, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.h b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.h index d40938bf8..dddc205e7 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.h +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.h @@ -5,24 +5,62 @@ struct EnTanron5; -#define ENTANRON5_GET(thisx) ((thisx)->params) +#define TWINMOLD_PROP_GET_TYPE(thisx) ((thisx)->params) +#define TWINMOLD_PROP_PARAMS(type) (type) -#define ENTANRON5_0 0 -#define ENTANRON5_100 100 -#define ENTANRON5_107 107 -#define ENTANRON5_108 108 -#define ENTANRON5_110 110 +typedef enum { + /* 0 */ TWINMOLD_PROP_TYPE_STATIC, + /* 1 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_1, + /* 2 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_2, + /* 3 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_3, + /* 4 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_4, + /* 5 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_5, + /* 6 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_6, + /* 7 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_7, + /* 8 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_8, + /* 9 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_9, + /* 10 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_10, + /* 11 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_11, + /* 12 */ TWINMOLD_PROP_TYPE_RUIN_PILLAR_12, + /* 13 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_1, + /* 14 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_2, + /* 15 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_3, + /* 16 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_4, + /* 17 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_5, + /* 18 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_6, + /* 19 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_7, + /* 20 */ TWINMOLD_PROP_TYPE_RUIN_PYRAMID_8, + /* 100 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_1 = 100, + /* 101 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_2, + /* 102 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_3, + /* 103 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_4, + /* 104 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_5, + /* 105 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_6, + /* 106 */ TWINMOLD_PROP_TYPE_FRAGMENT_LARGE_7, + /* 107 */ TWINMOLD_PROP_TYPE_FRAGMENT_SMALL_1, + /* 108 */ TWINMOLD_PROP_TYPE_FRAGMENT_SMALL_2, + /* 109 */ TWINMOLD_PROP_TYPE_FRAGMENT_SMALL_3, + /* 110 */ TWINMOLD_PROP_TYPE_ITEM_DROP_1, + /* 111 */ TWINMOLD_PROP_TYPE_ITEM_DROP_2 +} TwinmoldPropType; typedef struct EnTanron5 { /* 0x000 */ Actor actor; - /* 0x144 */ s16 unk_144; - /* 0x148 */ Gfx* unk_148; + /* 0x144 */ s16 timer; + /* 0x148 */ Gfx* dList; /* 0x14C */ ColliderCylinder collider; - /* 0x198 */ s16 unk_198; - /* 0x19A */ s16 unk_19A; - /* 0x19C */ f32 unk_19C; - /* 0x1A0 */ u8 unk_1A0; - /* 0x1A1 */ u8 unk_1A1; + /* 0x198 */ union { + s16 fragmentAngularVelocityX; + s16 itemDropRotZ; + }; + /* 0x19A */ s16 fragmentAngularVelocityY; + /* 0x19C */ f32 baseScale; + /* 0x1A0 */ union { + u8 hitCount; // used by destructible ruins + u8 sinkTimer; // used by ruin fragments + u8 itemDropType; // used by item drops + }; + /* 0x1A1 */ u8 hitTimer; } EnTanron5; // size = 0x1A4 #endif // Z_EN_TANRON5_H diff --git a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c index 875f36a61..8ed4c36f3 100644 --- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c +++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c @@ -6,7 +6,7 @@ #include "z_en_tanron6.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnTanron6*)thisx) @@ -72,7 +72,7 @@ void EnTanron6_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 19.0f); this->actor.colChkInfo.health = 1; this->actor.colChkInfo.damageTable = &sDamageTable; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; EnTanron6_DoNothing(this); } 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 e853570f4..7a9e45bc2 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -79,18 +79,18 @@ void EnTest2_Init(Actor* thisx, PlayState* play) { void EnTest2_Update(Actor* thisx, PlayState* play) { s32 pad; - s32 objectIndex; + s32 objectSlot; EnTest2ModelInfo* modelInfo; EnTest2* this = THIS; - objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[this->actor.params]); - if (objectIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]); + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } - if (Object_IsLoaded(&play->objectCtx, objectIndex)) { + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { modelInfo = &sModelInfo[this->actor.params]; - this->actor.objBankIndex = objectIndex; + this->actor.objectSlot = objectSlot; this->actor.draw = EnTest2_Draw; if (modelInfo->animMat != NULL) { Actor_SetObjectDependency(play, &this->actor); diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 2000e0e53..90ea18d05 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -4,7 +4,6 @@ * Description: Kafei */ -#include "prevent_bss_reordering.h" #include "z_en_test3.h" #include "objects/object_test3/object_test3.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" @@ -122,8 +121,8 @@ static u8 sScheduleScript[] = { /* 0x094 */ SCHEDULE_CMD_RET_TIME(15, 55, 16, 10, 12), /* 0x09A */ SCHEDULE_CMD_RET_NONE(), /* 0x09B */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(3, 0x138 - 0x0A0), - /* 0x0A0 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_33_08, 0x12C - 0x0A5), - /* 0x0A5 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_79_40, 0x12C - 0x0AA), + /* 0x0A0 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG, 0x12C - 0x0A5), + /* 0x0A5 */ SCHEDULE_CMD_CHECK_FLAG_L(WEEKEVENTREG_SAKON_DEAD, 0x12C - 0x0AA), /* 0x0AA */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_SECOM, 0x0B0 - 0x0AE), /* 0x0AE */ SCHEDULE_CMD_RET_VAL_S(7), /* 0x0B0 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_ESCAPED_SAKONS_HIDEOUT, 0x0DD - 0x0B4), @@ -354,13 +353,13 @@ s32 func_80A3EA30(EnTest3* this, PlayState* play) { Actor* hideoutDoor = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_IKNV_OBJ); if (hideoutDoor != NULL) { - this->player.targetedActor = hideoutDoor; + this->player.lockOnActor = hideoutDoor; } } if (this->unk_D78->unk_1 != 0) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); CutsceneManager_Queue(this->csId); - play->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = MSGMODE_PAUSED; } return false; } @@ -378,7 +377,7 @@ s32 func_80A3EAF8(EnTest3* this, PlayState* play) { CutsceneManager_Stop(this->csId); this->csId = CS_ID_GLOBAL_TALK; CutsceneManager_Queue(this->csId); - this->player.targetedActor = &GET_PLAYER(play)->actor; + this->player.lockOnActor = &GET_PLAYER(play)->actor; } return 1; } @@ -390,9 +389,9 @@ s32 func_80A3EB8C(EnTest3* this, PlayState* play) { Actor* hideoutObject = SubS_FindActor(play, NULL, ACTORCAT_ITEMACTION, ACTOR_OBJ_NOZOKI); if (hideoutObject != NULL) { - this->player.targetedActor = hideoutObject; + this->player.lockOnActor = hideoutObject; } - play->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = MSGMODE_PAUSED; return 1; } return 0; @@ -412,9 +411,9 @@ s32 func_80A3EC30(EnTest3* this, PlayState* play) { s32 func_80A3EC44(EnTest3* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); } if (play->msgCtx.choiceIndex != 0) { return 1; @@ -457,7 +456,7 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { this->player.transformation = PLAYER_FORM_HUMAN; this->player.ageProperties = &sAgeProperties; this->player.heldItemAction = PLAYER_IA_NONE; - this->player.heldItemId = ITEM_OCARINA; + this->player.heldItemId = ITEM_OCARINA_OF_TIME; Player_SetModelGroup(&this->player, 3); play->playerInit(&this->player, play, &object_test3_Skel_00F7EC); @@ -471,7 +470,8 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { this->unk_D90 = GET_PLAYER(play); this->player.giObjectSegment = this->unk_D90->giObjectSegment; this->player.tatlActor = this->unk_D90->tatlActor; - if ((CURRENT_DAY != 3) || CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08) || !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { + if ((CURRENT_DAY != 3) || CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) || + !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { this->player.currentMask = PLAYER_MASK_KEATON; } this->player.prevMask = this->player.currentMask; @@ -527,7 +527,7 @@ void func_80A3F0B0(EnTest3* this, PlayState* play) { } void func_80A3F114(EnTest3* this, PlayState* play) { - if (this->player.csMode != PLAYER_CSMODE_0) { + if (this->player.csMode != PLAYER_CSMODE_NONE) { play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_END); } } @@ -654,7 +654,7 @@ s32 func_80A3F62C(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul s32 func_80A3F73C(EnTest3* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->player.actor, &play->state)) { func_80A3E7E0(this, func_80A4084C); - this->player.targetedActor = &GET_PLAYER(play)->actor; + this->player.lockOnActor = &GET_PLAYER(play)->actor; this->player.stateFlags2 &= ~PLAYER_STATE2_40000; D_80A41D5C = true; if ((this->unk_D78->unk_0 == 4) && CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { @@ -670,14 +670,14 @@ s32 func_80A3F73C(EnTest3* this, PlayState* play) { CutsceneManager_SetReturnCamera(this->subCamId); play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_WAIT); } - func_800B863C(&this->player.actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->player.actor, play); if (this->unk_D88 == 3) { func_80A3F534(this, play); } else if (this->unk_D88 == 5) { func_80A3F5A4(this, play); } this->player.actor.textId = this->unk_D78->textId; - this->player.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->player.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); } return false; } @@ -782,7 +782,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { CutsceneManager_SetReturnCamera(CAM_ID_MAIN); Environment_StartTime(); if (((void)0, gSaveContext.save.time) > CLOCK_TIME(6, 0)) { - func_800FE658(TIME_TO_MINUTES_ALT_F(fabsf((s16) - ((void)0, gSaveContext.save.time)))); + Environment_SetTimeJump(TIME_TO_MINUTES_ALT_F(fabsf((s16) - ((void)0, gSaveContext.save.time)))); } if (play->actorCtx.flags & ACTORCTX_FLAG_6) { SET_WEEKEVENTREG(WEEKEVENTREG_ESCAPED_SAKONS_HIDEOUT); @@ -950,7 +950,7 @@ s32 func_80A40230(EnTest3* this, PlayState* play) { dx = this->player.actor.world.pos.x - this->player.actor.prevPos.x; dy = this->player.actor.world.pos.z - this->player.actor.prevPos.z; this->player.linearVelocity = sqrtf(SQ(dx) + SQ(dy)); - this->player.linearVelocity *= 1.0f + (1.05f * fabsf(Math_SinS(this->player.unk_B6C))); + this->player.linearVelocity *= 1.0f + (1.05f * fabsf(Math_SinS(this->player.floorPitch))); D_80A41D40 = (this->player.linearVelocity * 10.0f) + 20.0f; D_80A41D40 = CLAMP_MAX(D_80A41D40, 60.0f); D_80A41D44 = this->player.actor.world.rot.y; @@ -1007,7 +1007,7 @@ void func_80A4084C(EnTest3* this, PlayState* play) { } else { func_80A3E7E0(this, func_80A40678); } - this->player.targetedActor = NULL; + this->player.lockOnActor = NULL; } } else if (func_80A3ED24(this, play)) { func_80A3E7E0(this, func_80A40908); @@ -1017,15 +1017,15 @@ void func_80A4084C(EnTest3* this, PlayState* play) { void func_80A40908(EnTest3* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->player.actor, &play->state)) { func_80A3E7E0(this, func_80A4084C); - this->player.targetedActor = &GET_PLAYER(play)->actor; + this->player.lockOnActor = &GET_PLAYER(play)->actor; SET_WEEKEVENTREG(WEEKEVENTREG_51_08); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_PENDANT_OF_MEMORIES); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_KAFEI); } else { - func_800B8500(&this->player.actor, play, 9999.9f, 9999.9f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->player.actor, play, 9999.9f, 9999.9f, PLAYER_IA_MINUS1); this->unk_D78 = &D_80A41854[6]; this->player.actor.textId = this->unk_D78->textId; - this->player.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->player.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); } } @@ -1055,7 +1055,7 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) { play->actorCtx.flags &= ~ACTORCTX_FLAG_7; this->player.actor.draw = EnTest3_Draw; D_80A41D48 = false; - this->player.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->player.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_506) && !((this->player.actor.category == ACTORCAT_PLAYER) && ((play->actorCtx.flags & ACTORCTX_FLAG_5) || (play->actorCtx.flags & ACTORCTX_FLAG_4)))) { @@ -1065,7 +1065,7 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) { play->actorCtx.flags &= ~ACTORCTX_FLAG_4; } else if (this->player.actor.category == ACTORCAT_PLAYER) { func_80A409D4(this, play); - } else if (play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_0)) { + } else if (play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_NONE)) { if (this->unk_D88 >= 7) { Vec3f worldPos; @@ -1188,12 +1188,15 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL Actor* leftHandActor = this->player.heldActor; if (leftHandActor != NULL) { - leftHandActor->world.pos.x = (this->player.bodyPartsPos[15].x + this->player.leftHandWorld.pos.x) / 2.0f; - leftHandActor->world.pos.y = (this->player.bodyPartsPos[15].y + this->player.leftHandWorld.pos.y) / 2.0f; - leftHandActor->world.pos.z = (this->player.bodyPartsPos[15].z + this->player.leftHandWorld.pos.z) / 2.0f; + leftHandActor->world.pos.x = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].x + this->player.leftHandWorld.pos.x) / 2.0f; + leftHandActor->world.pos.y = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].y + this->player.leftHandWorld.pos.y) / 2.0f; + leftHandActor->world.pos.z = + (this->player.bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].z + this->player.leftHandWorld.pos.z) / 2.0f; } } else if (limbIndex == OBJECT_TEST3_LIMB_0B) { - Actor* actor730 = this->player.targetedActor; + Actor* actor730 = this->player.lockOnActor; if ((*dList1 != NULL) && this->player.currentMask && !(this->player.stateFlags2 & PLAYER_STATE2_1000000)) { // this->player.currentMask != PLAYER_MASK_NONE 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 fb18d4a39..8816ceb64 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -48,20 +48,20 @@ static s16 sCurCsId; void func_80A41D70(EnTest4* this, PlayState* play) { if (this->csIdIndex != 0) { - func_80151A68(play, sNightMessages1[CURRENT_DAY - 1]); + Message_DisplaySceneTitleCard(play, sNightMessages1[CURRENT_DAY - 1]); } else if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { if (play->actorCtx.flags & ACTORCTX_FLAG_1) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); - func_80151A68(play, sDayMessages1[CURRENT_DAY - 1]); + Message_DisplaySceneTitleCard(play, sDayMessages1[CURRENT_DAY - 1]); } else { this->csIdIndex = 0; this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } Interface_NewDay(play, CURRENT_DAY); - D_801BDBC8 = 0xFE; - func_800FB758(play); + gSceneSeqState = SCENESEQ_MORNING; + Environment_PlaySceneSequence(play); func_800FEAF4(&play->envCtx); this->actionFunc = func_80A42AB8; } @@ -73,9 +73,9 @@ void func_80A41D70(EnTest4* this, PlayState* play) { this->transitionCsTimer = 0; SET_EVENTINF(EVENTINF_17); } else if (this->csIdIndex == 0) { - play_sound(NA_SE_EV_CHICKEN_CRY_M); + Audio_PlaySfx(NA_SE_EV_CHICKEN_CRY_M); } else { - func_8019F128(NA_SE_EV_DOG_CRY_EVENING); + Audio_PlaySfx_2(NA_SE_EV_DOG_CRY_EVENING); } } else { this->actionFunc = func_80A42AB8; @@ -91,14 +91,14 @@ void func_80A41D70(EnTest4* this, PlayState* play) { void func_80A41FA4(EnTest4* this, PlayState* play) { if (this->csIdIndex != 0) { - func_80151A68(play, sNightMessages2[CURRENT_DAY - 1]); + Message_DisplaySceneTitleCard(play, sNightMessages2[CURRENT_DAY - 1]); } else if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); Interface_NewDay(play, CURRENT_DAY); - func_80151A68(play, sDayMessages2[CURRENT_DAY - 1]); - D_801BDBC8 = 0xFE; - func_800FB758(play); + Message_DisplaySceneTitleCard(play, sDayMessages2[CURRENT_DAY - 1]); + gSceneSeqState = SCENESEQ_MORNING; + Environment_PlaySceneSequence(play); func_800FEAF4(&play->envCtx); this->actionFunc = func_80A42AB8; } @@ -110,9 +110,9 @@ void func_80A41FA4(EnTest4* this, PlayState* play) { this->transitionCsTimer = 0; SET_EVENTINF(EVENTINF_17); } else if (this->csIdIndex == 0) { - play_sound(NA_SE_EV_CHICKEN_CRY_M); + Audio_PlaySfx(NA_SE_EV_CHICKEN_CRY_M); } else { - func_8019F128(NA_SE_EV_DOG_CRY_EVENING); + Audio_PlaySfx_2(NA_SE_EV_DOG_CRY_EVENING); } } else { this->actionFunc = func_80A42AB8; @@ -296,16 +296,16 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { sCsIdList[0] = csId; if (csId >= 0) { - ActorCutscene* actorCutscene = CutsceneManager_GetCutsceneEntry(sCsIdList[0]); + ActorCutscene* csEntry = CutsceneManager_GetCutsceneEntry(sCsIdList[0]); SET_EVENTINF(EVENTINF_52); - sCsIdList[1] = actorCutscene->additionalCsId; + sCsIdList[1] = csEntry->additionalCsId; } else { CLEAR_EVENTINF(EVENTINF_52); sCsIdList[1] = sCsIdList[0]; } - if (sIsLoaded || (CHECK_EVENTINF(EVENTINF_27))) { + if (sIsLoaded || CHECK_EVENTINF(EVENTINF_TRIGGER_DAYTELOP)) { Actor_Kill(&this->actor); } else { sIsLoaded = true; @@ -324,7 +324,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { } else { gSaveContext.save.day = 1; dayTemp = gSaveContext.save.day; - gSaveContext.save.daysElapsed = dayTemp; + gSaveContext.save.eventDayCount = dayTemp; this->csIdIndex = 1; this->unk_146 = gSaveContext.save.time; this->actionFunc = func_80A42AB8; @@ -413,7 +413,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { } gSaveContext.respawnFlag = -4; - SET_EVENTINF(EVENTINF_27); + SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP); Actor_Kill(&this->actor); } } @@ -431,7 +431,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } } else if ((new_var * bellDiff) <= 0) { - func_801A0124(&this->actor.projectedPos, (this->actor.params >> 5) & 0xF); + Audio_PlaySfx_BigBells(&this->actor.projectedPos, (this->actor.params >> 5) & 0xF); this->lastBellTime = gSaveContext.save.time; if (CURRENT_DAY == 3) { @@ -484,9 +484,9 @@ void func_80A42F20(EnTest4* this, PlayState* play) { this->transitionCsTimer++; if (this->transitionCsTimer == 10) { if (this->csIdIndex == 0) { - play_sound(NA_SE_EV_CHICKEN_CRY_M); + Audio_PlaySfx(NA_SE_EV_CHICKEN_CRY_M); } else { - func_8019F128(NA_SE_EV_DOG_CRY_EVENING); + Audio_PlaySfx_2(NA_SE_EV_DOG_CRY_EVENING); } } if (this->transitionCsTimer == 60) { @@ -517,38 +517,38 @@ void func_80A42F20(EnTest4* this, PlayState* play) { void func_80A430C8(EnTest4* this, PlayState* play) { if ((CURRENT_DAY == 2) && (gSaveContext.save.time >= CLOCK_TIME(7, 0)) && - (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { + (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { // rain? - gWeatherMode = 1; - func_800FD78C(play); - play->envCtx.unk_E3 = 1; - play->envCtx.unk_F2[0] = 0x3C; + gWeatherMode = WEATHER_MODE_1; + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_ON; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 60; } else { - if (play->envCtx.unk_F2[0] != 0) { + if (play->envCtx.precipitation[PRECIP_RAIN_MAX] != 0) { if ((play->state.frames % 4) == 0) { - play->envCtx.unk_F2[0]--; - if ((play->envCtx.unk_F2[0]) == 8) { - func_800FD858(play); + play->envCtx.precipitation[PRECIP_RAIN_MAX]--; + if ((play->envCtx.precipitation[PRECIP_RAIN_MAX]) == 8) { + Environment_StopStormNatureAmbience(play); } } } } - if (gWeatherMode == 1) { + if (gWeatherMode == WEATHER_MODE_1) { this->state = TEST4_STATE_1; } } void func_80A431C8(EnTest4* this, PlayState* play) { if (((gSaveContext.save.time >= CLOCK_TIME(17, 30)) && (gSaveContext.save.time < CLOCK_TIME(23, 0)) && - (play->envCtx.unk_F2[0] != 0)) || - (play->envCtx.unk_F2[2] != 0)) { - gWeatherMode = 0; - play->envCtx.unk_E3 = 2; + (play->envCtx.precipitation[PRECIP_RAIN_MAX] != 0)) || + (play->envCtx.precipitation[PRECIP_SNOW_CUR] != 0)) { + gWeatherMode = WEATHER_MODE_CLEAR; + play->envCtx.lightningState = LIGHTNING_LAST; } - if (gWeatherMode == 0) { + if (gWeatherMode == WEATHER_MODE_CLEAR) { this->state = TEST4_STATE_0; } } @@ -557,7 +557,7 @@ void func_80A4323C(EnTest4* this, PlayState* play) { s32 temp_v0 = (this->actor.params >> 0xA) * 0x64; if (temp_v0 > 0) { - D_801F4E7A = temp_v0; + gSkyboxNumStars = temp_v0; } } @@ -568,7 +568,7 @@ void EnTest4_Update(Actor* thisx, PlayState* play) { if (!(player->stateFlags1 & PLAYER_STATE1_2)) { this->actionFunc(this, play); - if (func_800FE4B8(play) != 0) { + if (Environment_GetStormState(play) != STORM_STATE_OFF) { switch (this->state) { case TEST4_STATE_0: func_80A430C8(this, play); diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.h b/src/overlays/actors/ovl_En_Test5/z_en_test5.h index 8d0c47784..7a4b656b5 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.h +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.h @@ -5,6 +5,8 @@ #define ENTEST5_IS_HOT_SPRING(thisx) ((thisx)->params != 0) +#define ENTEST5_PARAMS(isHotSpringWater) (isHotSpringWater) + struct EnTest5; // SpringWaterModifier typedef void (*EnTest5ActionFunc)(struct EnTest5*, PlayState*); 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 846d728dc..9657f1b1e 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -18,30 +18,38 @@ void EnTest6_Destroy(Actor* thisx, PlayState* play2); void EnTest6_Update(Actor* thisx, PlayState* play); void EnTest6_Draw(Actor* thisx, PlayState* play); -struct EnTest6Struct; +struct SoTCsAmmoDrops; -typedef void (*EnTest6StructFunc)(EnTest6*, PlayState*, struct EnTest6Struct*); +typedef void (*SoTCsAmmoDropDrawFunc)(EnTest6*, PlayState*, struct SoTCsAmmoDrops*); -typedef struct EnTest6Struct { - /* 0x00 */ s32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_0C; - /* 0x10 */ f32 unk_10; - /* 0x14 */ EnTest6StructFunc unk_14; -} EnTest6Struct; // size = 0x18 +typedef enum SoTCsAmmoDropType { + /* 0 */ SOTCS_AMMO_DROP_NONE, + /* 1 */ SOTCS_AMMO_DROP_ARROWS, + /* 2 */ SOTCS_AMMO_DROP_BOMB, + /* 3 */ SOTCS_AMMO_DROP_DEKU_NUT, + /* 4 */ SOTCS_AMMO_DROP_DEKU_STICK, + /* 5 */ SOTCS_AMMO_DROP_RUPEE_GREEN, + /* 6 */ SOTCS_AMMO_DROP_RUPEE_BLUE +} SoTCsAmmoDropType; -void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr); -void func_80A90FC0(EnTest6* this, PlayState* play, EnTest6Struct* ptr); +typedef struct SoTCsAmmoDrops { + /* 0x00 */ SoTCsAmmoDropType type; + /* 0x04 */ f32 scale; + /* 0x08 */ Vec3f pos; + /* 0x14 */ SoTCsAmmoDropDrawFunc draw; +} SoTCsAmmoDrops; // size = 0x18 + +void EnTest6_DrawAmmoDropDefault(EnTest6* this, PlayState* play, SoTCsAmmoDrops* ammoDrop); +void EnTest6_DrawAmmoDropRupee(EnTest6* this, PlayState* play, SoTCsAmmoDrops* ammoDrop); void EnTest6_SetupAction(EnTest6* this, EnTest6ActionFunc actionFunc); -void func_80A9156C(EnTest6* this, PlayState* play); -void func_80A91690(EnTest6* this, PlayState* play); -void func_80A91760(EnTest6* this, PlayState* play); -void func_80A920C8(EnTest6* this, PlayState* play); -void func_80A92188(EnTest6* this, PlayState* play); -void func_80A92950(EnTest6* this, PlayState* play); +void EnTest6_StartCutscene(EnTest6* this, PlayState* play); +void EnTest6_SetupInvertedSoTCutscene(EnTest6* this, PlayState* play); +void EnTest6_InvertedSoTCutscene(EnTest6* this, PlayState* play); +void EnTest6_SetupDoubleSoTCutscene(EnTest6* this, PlayState* play); +void EnTest6_DoubleSoTCutscene(EnTest6* this, PlayState* play); +void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play); -EnTest6Struct D_80A94910[12]; +SoTCsAmmoDrops sSoTCsAmmoDrops[12]; ActorInit En_Test6_InitVars = { ACTOR_EN_TEST6, @@ -55,7 +63,7 @@ ActorInit En_Test6_InitVars = { (ActorFunc)EnTest6_Draw, }; -CutsceneData D_80A93E80[] = { +CutsceneData sDoubleSoTCsCamData[] = { // Header CS_CAM_SPLINE(13, 424, 0, 100), @@ -108,106 +116,114 @@ CutsceneData D_80A93E80[] = { CS_CAM_END() }; -TexturePtr D_80A9402C[] = { - NULL, gDropArrows2Tex, gDropBombTex, gDropDekuNutTex, gDropDekuStickTex, gRupeeGreenTex, gRupeeBlueTex, +TexturePtr sSoTCsAmmoDropTextures[] = { + NULL, // SOTCS_AMMO_DROP_NONE + gDropArrows2Tex, // SOTCS_AMMO_DROP_ARROWS + gDropBombTex, // SOTCS_AMMO_DROP_BOMB + gDropDekuNutTex, // SOTCS_AMMO_DROP_DEKU_NUT + gDropDekuStickTex, // SOTCS_AMMO_DROP_DEKU_STICK + gRupeeGreenTex, // SOTCS_AMMO_DROP_RUPEE_GREEN + gRupeeBlueTex, // SOTCS_AMMO_DROP_RUPEE_BLUE }; -Color_RGB8 D_80A94048 = { 230, 230, 220 }; -Color_RGB8 D_80A9404C = { 120, 120, 100 }; -Color_RGB8 D_80A94050 = { 0, 0, 0 }; +typedef enum SoTCsDrawType { + /* 0 */ SOTCS_DRAW_DOUBLE_SOT, + /* 1 */ SOTCS_DRAW_RESET_CYCLE_SOT, + /* 2 */ SOTCS_DRAW_INVERTED_SOT, + /* 99 */ SOTCS_DRAW_TYPE_NONE = 99 +} SoTCsDrawType; -s16 D_80A94054 = 500; -s16 D_80A94058 = 1500; +#define SOTCS_AMMO_FLAG_RUPEE (1 << 0) +#define SOTCS_AMMO_FLAG_BOMB (1 << 1) +#define SOTCS_AMMO_FLAG_NUT (1 << 2) +#define SOTCS_AMMO_FLAG_ARROW (1 << 4) -static Vec3f sSubCamUp = { 0.0f, 1.0f, 0.0f }; - -Color_RGB8 D_80A94068 = { 225, 230, 225 }; -Color_RGB8 D_80A9406C = { 120, 120, 100 }; -Color_RGB8 D_80A94070 = { 0, 0, 0 }; - -s16 D_80A94074 = 940; -s16 D_80A94078 = 2000; - -void func_80A90730(EnTest6* this, PlayState* play) { +void EnTest6_SetupCutscene(EnTest6* this, PlayState* play) { s32 i; Player* player = GET_PLAYER(play); - s32 phi_s0; - f32 phi_f24; + s32 ammoFlags; + f32 yOffset; this->actor.home.pos = player->actor.world.pos; this->actor.home.rot = player->actor.shape.rot; - switch (ENTEST6_GET(&this->actor)) { - case ENTEST6_24: - case ENTEST6_25: - func_80A91690(this, play); + switch (SOTCS_GET_OCARINA_MODE(&this->actor)) { + case OCARINA_MODE_APPLY_INV_SOT_FAST: + case OCARINA_MODE_APPLY_INV_SOT_SLOW: + EnTest6_SetupInvertedSoTCutscene(this, play); CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - return; + break; - case ENTEST6_26: - func_80A920C8(this, play); + case OCARINA_MODE_APPLY_DOUBLE_SOT: + EnTest6_SetupDoubleSoTCutscene(this, play); CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - return; - } + break; - phi_s0 = 0; - phi_f24 = -900.0f; + default: // Setup "return to first day cutscene" + ammoFlags = 0; + yOffset = -900.0f; - if (CHECK_EVENTINF(EVENTINF_70)) { - for (i = 0; i < 6; i++) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 5; - } - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 5; - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 6; - phi_s0 |= 1; - } + if (CHECK_EVENTINF(EVENTINF_THREEDAYRESET_LOST_RUPEES)) { + for (i = 0; i < 6; i++) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = + SOTCS_AMMO_DROP_RUPEE_GREEN; + } + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = + SOTCS_AMMO_DROP_RUPEE_GREEN; + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_RUPEE_BLUE; + ammoFlags |= SOTCS_AMMO_FLAG_RUPEE; + } - if (CHECK_EVENTINF(EVENTINF_74)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; - if (!(phi_s0 & 1)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 1; - } - phi_s0 |= 0x10; - } + if (CHECK_EVENTINF(EVENTINF_THREEDAYRESET_LOST_ARROW_AMMO)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_ARROWS; + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_ARROWS; + if (!(ammoFlags & SOTCS_AMMO_FLAG_RUPEE)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_ARROWS; + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_ARROWS; + } + ammoFlags |= SOTCS_AMMO_FLAG_ARROW; + } - if (CHECK_EVENTINF(EVENTINF_71)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; - if (!(phi_s0 & 1)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 2; - } - phi_s0 |= 2; - } + if (CHECK_EVENTINF(EVENTINF_THREEDAYRESET_LOST_BOMB_AMMO)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_BOMB; + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_BOMB; + if (!(ammoFlags & SOTCS_AMMO_FLAG_RUPEE)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_BOMB; + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_BOMB; + } + ammoFlags |= SOTCS_AMMO_FLAG_BOMB; + } - if (CHECK_EVENTINF(EVENTINF_72)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 3; - if (!(phi_s0 & (0x10 | 0x2 | 0x1))) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 3; - } - phi_s0 |= 4; - } + if (CHECK_EVENTINF(EVENTINF_THREEDAYRESET_LOST_NUT_AMMO)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_DEKU_NUT; + if (!(ammoFlags & (SOTCS_AMMO_FLAG_ARROW | SOTCS_AMMO_FLAG_BOMB | SOTCS_AMMO_FLAG_RUPEE))) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = + SOTCS_AMMO_DROP_DEKU_NUT; + } + ammoFlags |= SOTCS_AMMO_FLAG_NUT; + } - if (CHECK_EVENTINF(EVENTINF_73)) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 4; - if (!(phi_s0 & (0x10 | 0x2 | 0x1))) { - D_80A94910[(s32)(Rand_ZeroOne() * ARRAY_COUNT(D_80A94910))].unk_00 = 4; - } - } + if (CHECK_EVENTINF(EVENTINF_THREEDAYRESET_LOST_STICK_AMMO)) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = SOTCS_AMMO_DROP_DEKU_STICK; + if (!(ammoFlags & (SOTCS_AMMO_FLAG_ARROW | SOTCS_AMMO_FLAG_BOMB | SOTCS_AMMO_FLAG_RUPEE))) { + sSoTCsAmmoDrops[(s32)(Rand_ZeroOne() * ARRAY_COUNT(sSoTCsAmmoDrops))].type = + SOTCS_AMMO_DROP_DEKU_STICK; + } + } - for (i = 0; i < ARRAY_COUNT(D_80A94910); i++) { - D_80A94910[i].unk_08 = ((2.0f * Rand_ZeroOne()) - 1.0f) * 80.0f; - D_80A94910[i].unk_10 = ((2.0f * Rand_ZeroOne()) - 1.0f) * 80.0f; - D_80A94910[i].unk_0C = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + phi_f24; - D_80A94910[i].unk_04 = -10.0f; - if (D_80A94910[i].unk_00 < 5) { - D_80A94910[i].unk_14 = func_80A90D34; - } else { - D_80A94910[i].unk_14 = func_80A90FC0; - } - phi_f24 += 50.0f; + for (i = 0; i < ARRAY_COUNT(sSoTCsAmmoDrops); i++) { + sSoTCsAmmoDrops[i].pos.x = ((2.0f * Rand_ZeroOne()) - 1.0f) * 80.0f; + sSoTCsAmmoDrops[i].pos.z = ((2.0f * Rand_ZeroOne()) - 1.0f) * 80.0f; + sSoTCsAmmoDrops[i].pos.y = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + yOffset; + sSoTCsAmmoDrops[i].scale = -10.0f; + if (sSoTCsAmmoDrops[i].type <= SOTCS_AMMO_DROP_DEKU_STICK) { + sSoTCsAmmoDrops[i].draw = EnTest6_DrawAmmoDropDefault; + } else { + sSoTCsAmmoDrops[i].draw = EnTest6_DrawAmmoDropRupee; + } + yOffset += 50.0f; + } + break; } } @@ -219,36 +235,38 @@ void EnTest6_DisableMotionBlur(void) { Play_DisableMotionBlur(); } -void func_80A90C54(PlayState* play, f32 arg1) { +void EnTest6_EnableWhiteFillScreen(PlayState* play, f32 alphaRatio) { play->envCtx.fillScreen = true; play->envCtx.screenFillColor[0] = 250; play->envCtx.screenFillColor[1] = 250; play->envCtx.screenFillColor[2] = 250; - play->envCtx.screenFillColor[3] = 255.0f * arg1; + play->envCtx.screenFillColor[3] = 255.0f * alphaRatio; } -void func_80A90D20(PlayState* play) { +void EnTest6_DisableWhiteFillScreen(PlayState* play) { play->envCtx.fillScreen = false; } -void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) { +void EnTest6_DrawAmmoDropDefault(EnTest6* this, PlayState* play, SoTCsAmmoDrops* ammoDrop) { s32 pad; OPEN_DISPS(play->state.gfxCtx); - if (ptr->unk_00 != 0) { - Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); - Matrix_Scale(ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, MTXMODE_APPLY); + if (ammoDrop->type != SOTCS_AMMO_DROP_NONE) { + Matrix_Translate(ammoDrop->pos.x * ammoDrop->scale, ammoDrop->pos.y, ammoDrop->pos.z * ammoDrop->scale, + MTXMODE_NEW); + Matrix_Scale(ammoDrop->scale * 0.02f, ammoDrop->scale * 0.02f, ammoDrop->scale * 0.02f, MTXMODE_APPLY); POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); POLY_OPA_DISP = Gfx_SetupDL66(POLY_OPA_DISP); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sSoTCsAmmoDropTextures[ammoDrop->type])); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); } - Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); - Matrix_Scale(2.0f * ptr->unk_04, 2.0f * ptr->unk_04, 2.0f * ptr->unk_04, MTXMODE_APPLY); + Matrix_Translate(ammoDrop->pos.x * ammoDrop->scale, ammoDrop->pos.y, ammoDrop->pos.z * ammoDrop->scale, + MTXMODE_NEW); + Matrix_Scale(2.0f * ammoDrop->scale, 2.0f * ammoDrop->scale, 2.0f * ammoDrop->scale, MTXMODE_APPLY); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(play->state.frames * 512, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 2.0f, MTXMODE_APPLY); @@ -266,41 +284,43 @@ void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) { CLOSE_DISPS(play->state.gfxCtx); } -void func_80A90FC0(EnTest6* this, PlayState* play, EnTest6Struct* ptr) { +void EnTest6_DrawAmmoDropRupee(EnTest6* this, PlayState* play, SoTCsAmmoDrops* ammoDrop) { s32 pad; Gfx* gfxHead = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx)); Gfx* gfx = gfxHead; - Hilite* sp70; - Vec3f sp64; + Hilite* hilite; + Vec3f ammoDropPos; - sp64.x = ptr->unk_08 * ptr->unk_04; - sp64.y = ptr->unk_0C; - sp64.z = ptr->unk_10 * ptr->unk_04; + ammoDropPos.x = ammoDrop->pos.x * ammoDrop->scale; + ammoDropPos.y = ammoDrop->pos.y; + ammoDropPos.z = ammoDrop->pos.z * ammoDrop->scale; - sp70 = func_800BCBF4(&sp64, play); + hilite = func_800BCBF4(&ammoDropPos, play); OPEN_DISPS(play->state.gfxCtx); if (gfxHead != NULL) { Gfx_SetupDL25_Opa(play->state.gfxCtx); - gDPSetTileSize(gfx++, 1, sp70->h.x1 & 0xFFFF, sp70->h.y1 & 0xFFFF, (sp70->h.x1 + 60) & 0xFFFF, - (sp70->h.y1 + 60) & 0xFFFF); + //! FAKE: & 0xFFFF + gDPSetTileSize(gfx++, 1, hilite->h.x1 & 0xFFFF, hilite->h.y1 & 0xFFFF, (hilite->h.x1 + 60) & 0xFFFF, + (hilite->h.y1 + 60) & 0xFFFF); gSPEndDisplayList(gfx++); gSPSegment(POLY_OPA_DISP++, 0x07, gfxHead); - Matrix_Translate(sp64.x, sp64.y, sp64.z, MTXMODE_NEW); - Matrix_Scale(ptr->unk_04 * 0.018f, ptr->unk_04 * 0.018f, ptr->unk_04 * 0.018f, MTXMODE_APPLY); + Matrix_Translate(ammoDropPos.x, ammoDropPos.y, ammoDropPos.z, MTXMODE_NEW); + Matrix_Scale(ammoDrop->scale * 0.018f, ammoDrop->scale * 0.018f, ammoDrop->scale * 0.018f, MTXMODE_APPLY); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sSoTCsAmmoDropTextures[ammoDrop->type])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); } - Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); - Matrix_Scale(ptr->unk_04 * 2.5f, ptr->unk_04 * 2.5f, ptr->unk_04 * 2.5f, MTXMODE_APPLY); + Matrix_Translate(ammoDrop->pos.x * ammoDrop->scale, ammoDrop->pos.y, ammoDrop->pos.z * ammoDrop->scale, + MTXMODE_NEW); + Matrix_Scale(ammoDrop->scale * 2.5f, ammoDrop->scale * 2.5f, ammoDrop->scale * 2.5f, MTXMODE_APPLY); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(play->state.frames * 256, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 4.0f, MTXMODE_APPLY); @@ -327,8 +347,9 @@ void EnTest6_Init(Actor* thisx, PlayState* play2) { EnTest6* this = THIS; s32 i; - if (((ENTEST6_GET(&this->actor) == ENTEST6_24) || (ENTEST6_GET(&this->actor) == ENTEST6_25) || - (ENTEST6_GET(&this->actor) == ENTEST6_26)) && + if (((SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) || + (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_SLOW) || + (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_DOUBLE_SOT)) && (play->playerCsIds[PLAYER_CS_ID_SONG_WARP] == CS_ID_NONE)) { Actor_Kill(&this->actor); return; @@ -340,12 +361,13 @@ void EnTest6_Init(Actor* thisx, PlayState* play2) { this->lights[i].node = LightContext_InsertLight(play, &play->lightCtx, &this->lights[i].info); } - this->unk_286 = 0; - this->cueId = 0; - this->unk_278 = 0; - this->unk_276 = 99; - func_80A90730(this, play); - EnTest6_SetupAction(this, func_80A9156C); + this->screenFillAlpha = 0; + this->cueId = SOTCS_CUEID_NONE; + this->invSoTClockYaw = 0; + this->drawType = SOTCS_DRAW_TYPE_NONE; + + EnTest6_SetupCutscene(this, play); + EnTest6_SetupAction(this, EnTest6_StartCutscene); } void EnTest6_Destroy(Actor* thisx, PlayState* play2) { @@ -353,20 +375,25 @@ void EnTest6_Destroy(Actor* thisx, PlayState* play2) { EnTest6* this = THIS; s32 i; - play->envCtx.lightSettings.ambientColor[0] = 0; - play->envCtx.lightSettings.ambientColor[1] = 0; - play->envCtx.lightSettings.ambientColor[2] = 0; - play->envCtx.lightSettings.diffuseColor1[0] = 0; - play->envCtx.lightSettings.diffuseColor1[1] = 0; - play->envCtx.lightSettings.diffuseColor1[2] = 0; - play->envCtx.lightSettings.diffuseColor2[0] = 0; - play->envCtx.lightSettings.diffuseColor2[1] = 0; - play->envCtx.lightSettings.diffuseColor2[2] = 0; - play->envCtx.lightSettings.fogColor[0] = 0; - play->envCtx.lightSettings.fogColor[1] = 0; - play->envCtx.lightSettings.fogColor[2] = 0; - play->envCtx.lightSettings.fogNear = 0; - play->envCtx.lightSettings.zFar = 0; + play->envCtx.adjLightSettings.ambientColor[0] = 0; + play->envCtx.adjLightSettings.ambientColor[1] = 0; + play->envCtx.adjLightSettings.ambientColor[2] = 0; + + play->envCtx.adjLightSettings.light1Color[0] = 0; + play->envCtx.adjLightSettings.light1Color[1] = 0; + play->envCtx.adjLightSettings.light1Color[2] = 0; + + play->envCtx.adjLightSettings.light2Color[0] = 0; + play->envCtx.adjLightSettings.light2Color[1] = 0; + play->envCtx.adjLightSettings.light2Color[2] = 0; + + play->envCtx.adjLightSettings.fogColor[0] = 0; + play->envCtx.adjLightSettings.fogColor[1] = 0; + play->envCtx.adjLightSettings.fogColor[2] = 0; + + play->envCtx.adjLightSettings.fogNear = 0; + play->envCtx.adjLightSettings.zFar = 0; + play->envCtx.fillScreen = false; for (i = 0; i < ARRAY_COUNT(this->lights); i++) { @@ -374,50 +401,51 @@ void EnTest6_Destroy(Actor* thisx, PlayState* play2) { } } -void func_80A9156C(EnTest6* this, PlayState* play) { - switch (ENTEST6_GET(&this->actor)) { - case ENTEST6_24: - case ENTEST6_25: +void EnTest6_StartCutscene(EnTest6* this, PlayState* play) { + switch (SOTCS_GET_OCARINA_MODE(&this->actor)) { + case OCARINA_MODE_APPLY_INV_SOT_FAST: + case OCARINA_MODE_APPLY_INV_SOT_SLOW: if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); this->subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - EnTest6_SetupAction(this, func_80A91760); + EnTest6_SetupAction(this, EnTest6_InvertedSoTCutscene); } break; - case ENTEST6_26: + case OCARINA_MODE_APPLY_DOUBLE_SOT: if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); this->subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); - EnTest6_SetupAction(this, func_80A92188); + EnTest6_SetupAction(this, EnTest6_DoubleSoTCutscene); } break; default: - gSaveContext.save.daysElapsed = 0; - gSaveContext.save.day = false; + gSaveContext.save.eventDayCount = 0; + gSaveContext.save.day = 0; gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; - EnTest6_SetupAction(this, func_80A92950); + EnTest6_SetupAction(this, EnTest6_SharedSoTCutscene); break; } } -void func_80A91690(EnTest6* this, PlayState* play) { - this->cueId = 90; - this->unk_27A = 100; - this->unk_286 = 0; - if (ENTEST6_GET(&this->actor) == ENTEST6_25) { - play_sound(NA_SE_SY_TIME_CONTROL_SLOW); - } else if (ENTEST6_GET(&this->actor) == ENTEST6_24) { - play_sound(NA_SE_SY_TIME_CONTROL_NORMAL); +void EnTest6_SetupInvertedSoTCutscene(EnTest6* this, PlayState* play) { + this->cueId = SOTCS_CUEID_INV_INIT; + this->timer = 100; + this->screenFillAlpha = 0; + + if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_SLOW) { + Audio_PlaySfx(NA_SE_SY_TIME_CONTROL_SLOW); + } else if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) { + Audio_PlaySfx(NA_SE_SY_TIME_CONTROL_NORMAL); } } -void func_80A916F0(EnTest6* this, PlayState* play) { +void EnTest6_StopInvertedSoTCutscene(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; @@ -429,216 +457,249 @@ void func_80A916F0(EnTest6* this, PlayState* play) { Actor_Kill(&this->actor); } -void func_80A91760(EnTest6* this, PlayState* play) { +Color_RGB8 sInvSoTCsFogColor = { 230, 230, 220 }; +Color_RGB8 sInvSoTCsAmbientColor = { 120, 120, 100 }; +Color_RGB8 sInvSoTCsDiffuseColor = { 0, 0, 0 }; +s16 sInvSoTCsFogNear = 500; +s16 sInvSoTCsZFar = 1500; + +void EnTest6_InvertedSoTCutscene(EnTest6* this, PlayState* play) { Input* input = CONTROLLER1(&play->state); - s16 temp_s0; + s16 clockYaw; Player* player = GET_PLAYER(play); Camera* mainCam; Vec3f subCamAt; Vec3f subCamEye; - Vec3f sp54; + Vec3f eyeNext; s32 i; - f32 sp4C; - Camera* subCam = Play_GetCamera(play, this->subCamId); + f32 temp; + Camera* subCam; + subCam = Play_GetCamera(play, this->subCamId); mainCam = Play_GetCamera(play, CAM_ID_MAIN); + // Update cutscene effects switch (this->cueId) { - case 90: - this->unk_276 = 2; - this->unk_15C = 0.0f; - this->unk_14C = 0.1f; - this->unk_282 = 0; - this->unk_278 = 0; - this->cueId = 91; + case SOTCS_CUEID_INV_INIT: + this->drawType = SOTCS_DRAW_INVERTED_SOT; + this->invSoTEnvLerp = 0.0f; + this->speed = 0.1f; + this->alpha = 0; + this->invSoTClockYaw = 0; + this->cueId = SOTCS_CUEID_INV_SETUP_CLOCKS; break; - case 91: - this->unk_15C += this->unk_14C; - func_800FD59C(play, &D_80A9404C, this->unk_15C); - func_800FD5E0(play, &D_80A94050, this->unk_15C); - func_800FD654(play, &D_80A94048, this->unk_15C); - func_800FD698(play, D_80A94054, D_80A94058, this->unk_15C); + case SOTCS_CUEID_INV_SETUP_CLOCKS: + this->invSoTEnvLerp += this->speed; + Environment_LerpAmbientColor(play, &sInvSoTCsAmbientColor, this->invSoTEnvLerp); + Environment_LerpDiffuseColor(play, &sInvSoTCsDiffuseColor, this->invSoTEnvLerp); + Environment_LerpFogColor(play, &sInvSoTCsFogColor, this->invSoTEnvLerp); + Environment_LerpFog(play, sInvSoTCsFogNear, sInvSoTCsZFar, this->invSoTEnvLerp); - if (this->unk_27A == 90) { - this->unk_282 = 0; - if (ENTEST6_GET(&this->actor) == ENTEST6_24) { - this->unk_27C = 0x200; - this->unk_150 = 0.0f; - sp4C = -100.0f; + if (this->timer == 90) { + this->alpha = 0; + if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) { + this->clockAngle = 0x200; + this->clockDist = 0.0f; + temp = -100.0f; } else { - this->unk_27C = 0x570; - this->unk_150 = 110.0f; - sp4C = 100.0f; + this->clockAngle = 0x570; + this->clockDist = 110.0f; + temp = 100.0f; } - this->unk_14C = 1.0f; + this->speed = 1.0f; - for (i = 0; i < ARRAY_COUNT(this->unk_20C); i++) { - this->unk_20C[i].x = player->actor.world.pos.x; - this->unk_20C[i].y = player->actor.world.pos.y; - this->unk_20C[i].z = player->actor.world.pos.z; + for (i = 0; i < SOTCS_INV_NUM_CLOCKS; i++) { + this->invSoTClockPos[i].x = player->actor.world.pos.x; + this->invSoTClockPos[i].y = player->actor.world.pos.y; + this->invSoTClockPos[i].z = player->actor.world.pos.z; } - this->unk_254 = ZeldaArena_Malloc(sizeof(Vec3f) * 64); - if (this->unk_254 != NULL) { - for (i = 0; i < ARRAY_COUNT(this->unk_254[0]); i++) { - (*this->unk_254)[i].x = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.x + - ((subCam->at.x - subCam->eye.x) * 0.2f); - (*this->unk_254)[i].y = (((2.0f * Rand_ZeroOne()) - 1.0f) * 120.0f) + subCam->eye.y + - ((subCam->at.y - subCam->eye.y) * 0.2f) + sp4C; - (*this->unk_254)[i].z = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.z + - ((subCam->at.z - subCam->eye.z) * 0.2f); + this->invSoTParticles = ZeldaArena_Malloc(sizeof(Vec3f) * SOTCS_NUM_PARTICLES); + if (this->invSoTParticles != NULL) { + for (i = 0; i < ARRAY_COUNT(this->invSoTParticles[0]); i++) { + (*this->invSoTParticles)[i].x = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.x + + ((subCam->at.x - subCam->eye.x) * 0.2f); + (*this->invSoTParticles)[i].y = (((2.0f * Rand_ZeroOne()) - 1.0f) * 120.0f) + subCam->eye.y + + ((subCam->at.y - subCam->eye.y) * 0.2f) + temp; + (*this->invSoTParticles)[i].z = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.z + + ((subCam->at.z - subCam->eye.z) * 0.2f); } } + EnTest6_EnableMotionBlur(120); Distortion_Request(DISTORTION_TYPE_SONG_OF_TIME); Distortion_SetDuration(80); + play->unk_18844 = true; - this->cueId = 95; + this->cueId = SOTCS_CUEID_INV_CLOCKS; } break; - case 95: - if (this->unk_27A > 80) { - this->unk_282 += 25; + case SOTCS_CUEID_INV_CLOCKS: + if (this->timer > 80) { + this->alpha += 25; } - if (this->unk_27A < 20) { - this->unk_282 -= 25; + if (this->timer < 20) { + this->alpha -= 25; } - func_800FD59C(play, &D_80A9404C, this->unk_15C); - func_800FD5E0(play, &D_80A94050, this->unk_15C); - func_800FD654(play, &D_80A94048, this->unk_15C); - func_800FD698(play, D_80A94054 + this->unk_282, D_80A94058 + this->unk_282, this->unk_15C); + Environment_LerpAmbientColor(play, &sInvSoTCsAmbientColor, this->invSoTEnvLerp); + Environment_LerpDiffuseColor(play, &sInvSoTCsDiffuseColor, this->invSoTEnvLerp); + Environment_LerpFogColor(play, &sInvSoTCsFogColor, this->invSoTEnvLerp); + Environment_LerpFog(play, sInvSoTCsFogNear + this->alpha, sInvSoTCsZFar + this->alpha, this->invSoTEnvLerp); - this->unk_278 -= this->unk_27C; - temp_s0 = this->unk_278; - if (ENTEST6_GET(&this->actor) == ENTEST6_24) { - this->unk_27C += 8; - this->unk_150 += this->unk_14C; + this->invSoTClockYaw -= this->clockAngle; + clockYaw = this->invSoTClockYaw; + + if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) { + this->clockAngle += 8; + this->clockDist += this->speed; } else { - this->unk_27C -= 8; - this->unk_150 -= this->unk_14C; + this->clockAngle -= 8; + this->clockDist -= this->speed; } - for (i = 0; i < ARRAY_COUNT(this->unk_20C); i++) { - temp_s0 += 0x10000 / ARRAY_COUNT(this->unk_20C); - if (player) {} - this->unk_20C[i].x = (Math_SinS(temp_s0) * this->unk_150) + player->actor.world.pos.x; - this->unk_20C[i].y = player->actor.world.pos.y; - this->unk_20C[i].z = (Math_CosS(temp_s0) * this->unk_150) + player->actor.world.pos.z; + for (i = 0; i < SOTCS_INV_NUM_CLOCKS; i++) { + //! FAKE: + if (player != NULL) {} + + clockYaw += 0x10000 / SOTCS_INV_NUM_CLOCKS; + this->invSoTClockPos[i].x = player->actor.world.pos.x + (Math_SinS(clockYaw) * this->clockDist); + this->invSoTClockPos[i].y = player->actor.world.pos.y; + this->invSoTClockPos[i].z = player->actor.world.pos.z + (Math_CosS(clockYaw) * this->clockDist); } - if (this->unk_254 != NULL) { - for (i = 0; i < ARRAY_COUNT(this->unk_254[0]); i++) { - (*this->unk_254)[i].x += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); - if (ENTEST6_GET(&this->actor) == ENTEST6_24) { - (*this->unk_254)[i].y += 1.0f; + if (this->invSoTParticles != NULL) { + for (i = 0; i < ARRAY_COUNT(this->invSoTParticles[0]); i++) { + // Wiggle in the x-direction + (*this->invSoTParticles)[i].x += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); + + // Fall or rise depending on slow-down or speed-up + if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) { + // Rise up + (*this->invSoTParticles)[i].y += 1.0f; } else { - if (1) {} - (*this->unk_254)[i].y -= 1.0f; + // Fall down + (*this->invSoTParticles)[i].y -= 1.0f; } - (*this->unk_254)[i].z += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); + // Wiggle in the z-direction + (*this->invSoTParticles)[i].z += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); } } - if (this->unk_27A == 10) { - this->unk_14C = 0.1f; + if (this->timer == 10) { + this->speed = 0.1f; EnTest6_DisableMotionBlur(); Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); play->unk_18844 = false; - if (this->unk_254 != NULL) { - ZeldaArena_Free(this->unk_254); + if (this->invSoTParticles != NULL) { + ZeldaArena_Free(this->invSoTParticles); } - this->cueId = 99; + this->cueId = SOTCS_CUEID_INV_END; } break; - case 99: - this->unk_15C -= this->unk_14C; - func_800FD59C(play, &D_80A9404C, this->unk_15C); - func_800FD5E0(play, &D_80A94050, this->unk_15C); - func_800FD654(play, &D_80A94048, this->unk_15C); - func_800FD698(play, D_80A94054, D_80A94058, this->unk_15C); + case SOTCS_CUEID_INV_END: + this->invSoTEnvLerp -= this->speed; + Environment_LerpAmbientColor(play, &sInvSoTCsAmbientColor, this->invSoTEnvLerp); + Environment_LerpDiffuseColor(play, &sInvSoTCsDiffuseColor, this->invSoTEnvLerp); + Environment_LerpFogColor(play, &sInvSoTCsFogColor, this->invSoTEnvLerp); + Environment_LerpFog(play, sInvSoTCsFogNear, sInvSoTCsZFar, this->invSoTEnvLerp); + break; + + default: break; } - if (this->unk_286 != 0) { + // Update Player Cutscene Animation + if (this->screenFillAlpha != 0) { func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); } else { - if (this->unk_27A == 90) { + if (this->timer == 90) { + // Look side-to-side but downwards, with chin down + // gPlayerAnim_al_elf_tobidasi func_800B7298(play, NULL, PLAYER_CSMODE_66); } - if (this->unk_27A == 70) { + if (this->timer == 70) { + // close eyes and sway body in circles + // gPlayerAnim_alink_yurayura func_800B7298(play, NULL, PLAYER_CSMODE_82); } - if (this->unk_27A == 30) { + if (this->timer == 30) { + // Look side-to-side but upwards, with chin up + // gPlayerAnim_alink_kyoro func_800B7298(play, NULL, PLAYER_CSMODE_81); } - if (this->unk_27A == 5) { + if (this->timer == 5) { + // Give a big nod of approval + // gPlayerAnim_al_yes func_800B7298(play, NULL, PLAYER_CSMODE_74); } } - if (this->unk_27A > 80) { - subCam->fov += (90.0f - subCam->fov) / (this->unk_27A - 80); - } else if (this->unk_27A > 60) { - sp4C = 1.0f / (this->unk_27A - 60); + // Update camera + if (this->timer > 80) { + subCam->fov += (90.0f - subCam->fov) / (this->timer - 80); + } else if (this->timer > 60) { + temp = 1.0f / (this->timer - 60); - subCamAt.x = subCam->at.x + ((player->actor.world.pos.x - subCam->at.x) * sp4C); - subCamAt.y = subCam->at.y + (((player->actor.focus.pos.y - subCam->at.y) - 20.0f) * sp4C); - subCamAt.z = subCam->at.z + ((player->actor.world.pos.z - subCam->at.z) * sp4C); + subCamAt.x = subCam->at.x + ((player->actor.world.pos.x - subCam->at.x) * temp); + subCamAt.y = subCam->at.y + (((player->actor.focus.pos.y - subCam->at.y) - 20.0f) * temp); + subCamAt.z = subCam->at.z + ((player->actor.world.pos.z - subCam->at.z) * temp); - sp54.x = (Math_SinS(player->actor.world.rot.y) * 80.0f) + subCamAt.x; - sp54.y = subCamAt.y + 20.0f; - sp54.z = (Math_CosS(player->actor.world.rot.y) * 80.0f) + subCamAt.z; - sp4C *= 0.75f; + eyeNext.x = subCamAt.x + (Math_SinS(player->actor.world.rot.y) * 80.0f); + eyeNext.y = subCamAt.y + 20.0f; + eyeNext.z = subCamAt.z + (Math_CosS(player->actor.world.rot.y) * 80.0f); + temp *= 0.75f; - VEC3F_LERPIMPDST(&subCamEye, &subCam->eye, &sp54, sp4C); + VEC3F_LERPIMPDST(&subCamEye, &subCam->eye, &eyeNext, temp); 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; + } else if ((this->timer < 11) && (this->timer > 0)) { + subCam->fov += (mainCam->fov - subCam->fov) / this->timer; } - if (this->unk_286 != 0) { - func_80A90C54(play, this->unk_286 * 0.05f); + // Update white screen + if (this->screenFillAlpha != 0) { + EnTest6_EnableWhiteFillScreen(play, this->screenFillAlpha * 0.05f); subCam->fov += (mainCam->fov - subCam->fov) * 0.05f; - this->unk_286++; - if (this->unk_286 >= 20) { - this->unk_27A = 1; + this->screenFillAlpha++; + if (this->screenFillAlpha >= 20) { + this->timer = 1; } - } else if ((this->unk_27A <= 60) && (this->unk_27A > 40) && + } else if ((this->timer <= 60) && (this->timer > 40) && (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) { + this->screenFillAlpha = 1; + + if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_SLOW) { AudioSfx_StopById(NA_SE_SY_TIME_CONTROL_SLOW); - } else if (ENTEST6_GET(&this->actor) == ENTEST6_24) { + } else if (SOTCS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_APPLY_INV_SOT_FAST) { AudioSfx_StopById(NA_SE_SY_TIME_CONTROL_NORMAL); } } - if (DECR(this->unk_27A) == 0) { - func_80A916F0(this, play); - play->msgCtx.ocarinaMode = 4; + if (DECR(this->timer) == 0) { + EnTest6_StopInvertedSoTCutscene(this, play); + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } } -void func_80A920C8(EnTest6* this, PlayState* play) { +void EnTest6_SetupDoubleSoTCutscene(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->unk_27A = 120; - this->unk_286 = 0; - this->unk_160 = 0.0f; + this->timer = 120; + this->screenFillAlpha = 0; + this->doubleSoTEnvLerp = 0.0f; this->actor.home.pos = player->actor.world.pos; this->actor.home.rot = player->actor.shape.rot; } -void func_80A92118(EnTest6* this, PlayState* play) { +void EnTest6_StopDoubleSoTCutscene(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; @@ -650,7 +711,15 @@ void func_80A92118(EnTest6* this, PlayState* play) { Actor_Kill(&this->actor); } -void func_80A92188(EnTest6* this, PlayState* play) { +static Vec3f sSubCamUp = { 0.0f, 1.0f, 0.0f }; + +Color_RGB8 sDoubleSoTCsFogColor = { 225, 230, 225 }; +Color_RGB8 sDoubleSoTCsAmbientColor = { 120, 120, 100 }; +Color_RGB8 sDoubleSoTCsDiffuseColor = { 0, 0, 0 }; +s16 sDoubleSoTCsFogNear = 940; +s16 sDoubleSoTCsZFar = 2000; + +void EnTest6_DoubleSoTCutscene(EnTest6* this, PlayState* play) { Input* input = CONTROLLER1(&play->state); Player* player = GET_PLAYER(play); Camera* subCam; @@ -658,55 +727,55 @@ void func_80A92188(EnTest6* this, PlayState* play) { s16 subCamId; s16 pad2; - if (this->unk_27A > 115) { - this->unk_160 += 0.2f; - func_80A90C54(play, this->unk_160); - } else if (this->unk_27A > 90) { - this->unk_160 -= 0.05f; - func_80A90C54(play, this->unk_160); - } else if (this->unk_27A == 90) { - this->unk_160 = 0.0f; - func_80A90D20(play); + if (this->timer > 115) { + this->doubleSoTEnvLerp += 0.2f; + EnTest6_EnableWhiteFillScreen(play, this->doubleSoTEnvLerp); + } else if (this->timer > 90) { + this->doubleSoTEnvLerp -= 0.05f; + EnTest6_EnableWhiteFillScreen(play, this->doubleSoTEnvLerp); + } else if (this->timer == 90) { + this->doubleSoTEnvLerp = 0.0f; + EnTest6_DisableWhiteFillScreen(play); } - if (this->unk_27A == 1) { - this->unk_160 = 0.0f; - func_80A90D20(play); - } else if (this->unk_27A < 17) { - this->unk_160 -= 0.06666666f; - func_80A90C54(play, this->unk_160); - } else if (this->unk_27A < 22) { - this->unk_160 += 0.2f; - func_80A90C54(play, this->unk_160); + if (this->timer == 1) { + this->doubleSoTEnvLerp = 0.0f; + EnTest6_DisableWhiteFillScreen(play); + } else if (this->timer < 17) { + this->doubleSoTEnvLerp -= 0.06666666f; + EnTest6_EnableWhiteFillScreen(play, this->doubleSoTEnvLerp); + } else if (this->timer < 22) { + this->doubleSoTEnvLerp += 0.2f; + EnTest6_EnableWhiteFillScreen(play, this->doubleSoTEnvLerp); } - if (this->unk_27A == 115) { - func_800FD59C(play, &D_80A9406C, 1.0f); - func_800FD5E0(play, &D_80A94070, 1.0f); - func_800FD654(play, &D_80A94068, 1.0f); - func_800FD698(play, D_80A94074, D_80A94078, 1.0f); + if (this->timer == 115) { + Environment_LerpAmbientColor(play, &sDoubleSoTCsAmbientColor, 1.0f); + Environment_LerpDiffuseColor(play, &sDoubleSoTCsDiffuseColor, 1.0f); + Environment_LerpFogColor(play, &sDoubleSoTCsFogColor, 1.0f); + Environment_LerpFog(play, sDoubleSoTCsFogNear, sDoubleSoTCsZFar, 1.0f); play->unk_18844 = true; } - if (this->unk_27A == 15) { - func_800FD59C(play, &D_80A9406C, 0.0f); - func_800FD5E0(play, &D_80A94070, 0.0f); - func_800FD654(play, &D_80A94068, 0.0f); - func_800FD698(play, D_80A94074, D_80A94078, 0.0f); + if (this->timer == 15) { + Environment_LerpAmbientColor(play, &sDoubleSoTCsAmbientColor, 0.0f); + Environment_LerpDiffuseColor(play, &sDoubleSoTCsDiffuseColor, 0.0f); + Environment_LerpFogColor(play, &sDoubleSoTCsFogColor, 0.0f); + Environment_LerpFog(play, sDoubleSoTCsFogNear, sDoubleSoTCsZFar, 0.0f); play->unk_18844 = false; } - if (this->unk_286 >= 20) { - func_800FD59C(play, &D_80A9406C, this->unk_160); - func_800FD5E0(play, &D_80A94070, this->unk_160); - func_800FD654(play, &D_80A94068, this->unk_160); - func_800FD698(play, D_80A94074, D_80A94078, this->unk_160); + if (this->screenFillAlpha >= 20) { + Environment_LerpAmbientColor(play, &sDoubleSoTCsAmbientColor, this->doubleSoTEnvLerp); + Environment_LerpDiffuseColor(play, &sDoubleSoTCsDiffuseColor, this->doubleSoTEnvLerp); + Environment_LerpFogColor(play, &sDoubleSoTCsFogColor, this->doubleSoTEnvLerp); + Environment_LerpFog(play, sDoubleSoTCsFogNear, sDoubleSoTCsZFar, this->doubleSoTEnvLerp); play->unk_18844 = false; } - func_800B8F98(&player->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&player->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); - switch (this->unk_27A) { + switch (this->timer) { case 119: EnTest6_EnableMotionBlur(50); break; @@ -715,7 +784,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { EnTest6_EnableMotionBlur(20); Distortion_Request(DISTORTION_TYPE_SONG_OF_TIME); Distortion_SetDuration(90); - this->cueId = 2; + this->cueId = SOTCS_CUEID_DOUBLE_INIT; break; case 110: @@ -724,53 +793,56 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 38: case 114: - this->cueId = 1; + this->cueId = SOTCS_CUEID_DOUBLE_WAIT; break; case 76: - this->cueId = 3; + this->cueId = SOTCS_CUEID_DOUBLE_CLOCKS_INWARD; break; case 61: EnTest6_EnableMotionBlur(150); - this->cueId = 4; + this->cueId = SOTCS_CUEID_DOUBLE_CLOCKS_SPIN; break; case 51: EnTest6_EnableMotionBlur(180); - this->cueId = 5; + this->cueId = SOTCS_CUEID_DOUBLE_CLOCKS_OUTWARD; break; case 14: case 15: EnTest6_EnableMotionBlur(50); Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); - this->cueId = 0; + this->cueId = SOTCS_CUEID_NONE; break; case 1: EnTest6_DisableMotionBlur(); if (CHECK_EVENTINF(EVENTINF_52)) { - this->cueId = 9; + this->cueId = SOTCS_CUEID_DOUBLE_END; } break; + + default: + break; } - func_80A92950(this, play); + EnTest6_SharedSoTCutscene(this, play); - if (this->unk_27A == 115) { + if (this->timer == 115) { subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); subCam = Play_GetCamera(play, subCamId); this->subCamAt = subCam->at; this->subCamEye = subCam->eye; this->subCamFov = subCam->fov; - CutsceneCamera_Init(subCam, &this->unk_18C); + CutsceneCamera_Init(subCam, &this->csCamInfo); } - if ((this->unk_27A <= 115) && (this->unk_27A >= 16)) { - CutsceneCamera_UpdateSplines((u8*)D_80A93E80, &this->unk_18C); - } else if (this->unk_27A < 16) { + if ((this->timer <= 115) && (this->timer >= 16)) { + CutsceneCamera_UpdateSplines((u8*)sDoubleSoTCsCamData, &this->csCamInfo); + } else if (this->timer < 16) { subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); Play_SetCameraAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); @@ -778,7 +850,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { Play_SetCameraRoll(play, subCamId, 0); } - switch (this->unk_27A) { + switch (this->timer) { case 116: player->actor.freezeTimer = 2; player->actor.shape.rot.x = 0; @@ -821,24 +893,27 @@ void func_80A92188(EnTest6* this, PlayState* play) { player->unk_AC0 = 0.0f; player->actor.shape.yOffset = 0.0f; break; + + default: + break; } - if ((this->unk_286 > 0) && (this->unk_286 < 20)) { - func_80A90C54(play, this->unk_286 * 0.05f); - this->unk_286++; - if (this->unk_286 >= 20) { - this->unk_27A = 15; - this->unk_160 = 0.9333333f; + if ((this->screenFillAlpha > 0) && (this->screenFillAlpha < 20)) { + EnTest6_EnableWhiteFillScreen(play, this->screenFillAlpha * 0.05f); + this->screenFillAlpha++; + if (this->screenFillAlpha >= 20) { + this->timer = 15; + this->doubleSoTEnvLerp = 0.9333333f; } - } else if ((this->unk_27A < 96) && (this->unk_27A > 50) && + } else if ((this->timer < 96) && (this->timer > 50) && (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B))) { - this->unk_286 = 1; - this->unk_27A = 39; + this->screenFillAlpha = 1; + this->timer = 39; SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } - if (DECR(this->unk_27A) == 0) { - func_80A92118(this, play); + if (DECR(this->timer) == 0) { + EnTest6_StopDoubleSoTCutscene(this, play); } } @@ -848,475 +923,497 @@ void EnTest6_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } -void func_80A92950(EnTest6* this, PlayState* play) { +/** + * Processes two different cutscenes: + * return to "Dawn of the First Day" Cs, and Song of Double Time Cs + */ +void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) { s32 pad[2]; Player* player = GET_PLAYER(play); - f32 temp_f0; + f32 yDiff; s32 i; s32 cueChannel; - if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_505)) { - cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_505); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_SOTCS)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_SOTCS); this->cueId = play->csCtx.actorCues[cueChannel]->id; switch (this->cueId) { - case 1: + case SOTCS_CUEID_DOUBLE_WAIT: break; - case 2: - this->unk_276 = 0; - this->unk_278 = 0; - this->unk_27C = 0; + case SOTCS_CUEID_DOUBLE_INIT: + this->drawType = SOTCS_DRAW_DOUBLE_SOT; + this->counter = 0; + this->clockAngle = 0; player->actor.shape.shadowDraw = NULL; if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_154 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockSpeed = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { - this->unk_154 = 150.0f; + this->clockSpeed = 150.0f; } if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { - this->unk_280 = play->csCtx.actorCues[cueChannel]->startPos.y; + this->clockColorGray = play->csCtx.actorCues[cueChannel]->startPos.y; } else { - this->unk_280 = 38; + this->clockColorGray = 38; } if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { - this->unk_150 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; + this->clockDist = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { - this->unk_150 = 480.0f; + this->clockDist = 480.0f; } break; - case 3: + case SOTCS_CUEID_DOUBLE_CLOCKS_INWARD: if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockSpeed += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; + this->clockColorGray += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { - this->unk_280 += 6; + this->clockColorGray += 6; } if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { - this->unk_158 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; + this->clockRadialSpeed = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { - this->unk_158 = -32.0f; + this->clockRadialSpeed = -32.0f; } - this->unk_150 += this->unk_158; + this->clockDist += this->clockRadialSpeed; break; - case 4: + case SOTCS_CUEID_DOUBLE_CLOCKS_SPIN: if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockSpeed += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; + this->clockColorGray += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { - this->unk_280 -= 4; + this->clockColorGray -= 4; } break; - case 5: + case SOTCS_CUEID_DOUBLE_CLOCKS_OUTWARD: if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockSpeed += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; + this->clockColorGray += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { - this->unk_280 -= 8; + this->clockColorGray -= 8; } if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { - this->unk_158 += (u32)play->csCtx.actorCues[cueChannel]->startPos.z; + this->clockRadialSpeed += (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { - this->unk_158 += 20.0f; + this->clockRadialSpeed += 20.0f; } - this->unk_150 += this->unk_158; - if (this->unk_150 > 3500.0f) { - this->unk_150 = 3500.0f; - this->cueId = 0; + this->clockDist += this->clockRadialSpeed; + if (this->clockDist > 3500.0f) { + this->clockDist = 3500.0f; + this->cueId = SOTCS_CUEID_NONE; } break; - case 6: - this->unk_276 = 1; - this->unk_278 = 0; - this->unk_27C = 0; + case SOTCS_CUEID_RESET_INIT: + this->drawType = SOTCS_DRAW_RESET_CYCLE_SOT; + this->counter = 0; + this->clockAngle = 0; player->actor.shape.shadowDraw = NULL; if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_154 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockSpeed = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { - this->unk_154 = 100.0f; + this->clockSpeed = 100.0f; } if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { - this->unk_14C = (u32)play->csCtx.actorCues[cueChannel]->startPos.y; + this->speed = (u32)play->csCtx.actorCues[cueChannel]->startPos.y; } else { - this->unk_14C = 20.0f; + this->speed = 20.0f; } if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { - this->unk_150 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; + this->clockDist = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { - this->unk_150 = 300.0f; + this->clockDist = 300.0f; } - this->unk_158 = 0.0f; + this->clockAccel = 0.0f; break; - case 7: + case SOTCS_CUEID_RESET_CLOCKS_SLOW_DOWN: if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_158 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockAccel = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { - this->unk_158 = -5.0f; + this->clockAccel = -5.0f; } - this->unk_154 += this->unk_158; + this->clockSpeed += this->clockAccel; break; - case 8: + case SOTCS_CUEID_RESET_CLOCKS_SPEED_UP: if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { - this->unk_158 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; + this->clockAccel += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { - this->unk_158 += 2.0f; + this->clockAccel += 2.0f; } - this->unk_154 += this->unk_158; - if (this->unk_154 > 10000.0f) { - this->unk_154 = 10000.0f; - this->cueId = 0; + this->clockSpeed += this->clockAccel; + if (this->clockSpeed > 10000.0f) { + this->clockSpeed = 10000.0f; + this->cueId = SOTCS_CUEID_NONE; } break; - case 0: + case SOTCS_CUEID_NONE: default: - this->unk_276 = 99; + this->drawType = SOTCS_DRAW_TYPE_NONE; return; - case 9: - Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entrance & 0xFFFF), player->unk_3CE, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); - this->unk_276 = 99; + case SOTCS_CUEID_DOUBLE_END: + Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance), + player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, + player->unk_3CC); + this->drawType = SOTCS_DRAW_TYPE_NONE; play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_FADE_BLACK; if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; - SET_EVENTINF(EVENTINF_27); + SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP); } else { gSaveContext.respawnFlag = 2; } - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; return; } } else { switch (this->cueId) { - case 2: - this->unk_276 = 0; - this->unk_278 = 0; - this->unk_27C = 0; + case SOTCS_CUEID_DOUBLE_INIT: + this->drawType = SOTCS_DRAW_DOUBLE_SOT; + this->counter = 0; + this->clockAngle = 0; player->actor.shape.shadowDraw = NULL; - this->unk_280 = 38; - this->unk_154 = 150.0f; - this->unk_150 = 480.0f; + this->clockColorGray = 38; + this->clockSpeed = 150.0f; + this->clockDist = 480.0f; - case 1: + case SOTCS_CUEID_DOUBLE_WAIT: break; - case 3: - this->unk_158 = -32.0f; - this->unk_280 += 6; - this->unk_150 += -32.0f; + case SOTCS_CUEID_DOUBLE_CLOCKS_INWARD: + this->clockRadialSpeed = -32.0f; + this->clockColorGray += 6; + this->clockDist += -32.0f; break; - case 4: - this->unk_280 -= 4; + case SOTCS_CUEID_DOUBLE_CLOCKS_SPIN: + this->clockColorGray -= 4; break; - case 5: - this->unk_280 -= 8; - this->unk_158 += 20.0f; - this->unk_150 += this->unk_158; - if (this->unk_150 > 3500.0f) { - this->unk_150 = 3500.0f; - this->cueId = 0; + case SOTCS_CUEID_DOUBLE_CLOCKS_OUTWARD: + this->clockColorGray -= 8; + this->clockRadialSpeed += 20.0f; + this->clockDist += this->clockRadialSpeed; + if (this->clockDist > 3500.0f) { + this->clockDist = 3500.0f; + this->cueId = SOTCS_CUEID_NONE; } break; - case 6: - this->unk_276 = 1; - this->unk_278 = 0; - this->unk_27C = 0; + case SOTCS_CUEID_RESET_INIT: + this->drawType = SOTCS_DRAW_RESET_CYCLE_SOT; + this->counter = 0; + this->clockAngle = 0; player->actor.shape.shadowDraw = NULL; - this->unk_154 = 100.0f; - this->unk_14C = 20.0f; - this->unk_150 = 300.0f; - this->unk_158 = 0.0f; + this->clockSpeed = 100.0f; + this->speed = 20.0f; + this->clockDist = 300.0f; + this->clockAccel = 0.0f; break; - case 7: - this->unk_158 = -5.0f; - this->unk_154 += -5.0f; + case SOTCS_CUEID_RESET_CLOCKS_SLOW_DOWN: + this->clockAccel = -5.0f; + this->clockSpeed += -5.0f; break; - case 8: - this->unk_158 += 2.0f; - this->unk_154 += this->unk_158; - if (this->unk_154 > 10000.0f) { - this->unk_154 = 10000.0f; - this->cueId = 0; + case SOTCS_CUEID_RESET_CLOCKS_SPEED_UP: + this->clockAccel += 2.0f; + this->clockSpeed += this->clockAccel; + if (this->clockSpeed > 10000.0f) { + this->clockSpeed = 10000.0f; + this->cueId = SOTCS_CUEID_NONE; } break; - case 0: + case SOTCS_CUEID_NONE: default: - this->unk_276 = 99; + this->drawType = SOTCS_DRAW_TYPE_NONE; return; - case 9: + case SOTCS_CUEID_DOUBLE_END: if (gSaveContext.save.time > CLOCK_TIME(12, 0)) { - Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entrance & 0xFFFF), + Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance), player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); - this->unk_276 = 99; + this->drawType = SOTCS_DRAW_TYPE_NONE; play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.respawnFlag = 2; - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } return; } } - if (this->unk_276 == 1) { - for (i = 0; i < ARRAY_COUNT(D_80A94910); i++) { - D_80A94910[i].unk_08 += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); - D_80A94910[i].unk_10 += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); - D_80A94910[i].unk_0C += 3.0f; + if (this->drawType == SOTCS_DRAW_RESET_CYCLE_SOT) { + for (i = 0; i < ARRAY_COUNT(sSoTCsAmmoDrops); i++) { + sSoTCsAmmoDrops[i].pos.x += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); + sSoTCsAmmoDrops[i].pos.z += 2.0f * ((2.0f * Rand_ZeroOne()) - 1.0f); + sSoTCsAmmoDrops[i].pos.y += 3.0f; - if (player->actor.world.pos.y < D_80A94910[i].unk_0C) { - temp_f0 = D_80A94910[i].unk_0C - player->actor.world.pos.y; - if (temp_f0 > 550.0f) { - temp_f0 = 1.0f; + if (player->actor.world.pos.y < sSoTCsAmmoDrops[i].pos.y) { + yDiff = sSoTCsAmmoDrops[i].pos.y - player->actor.world.pos.y; + if (yDiff > 550.0f) { + yDiff = 1.0f; } else { - temp_f0 = temp_f0 / 550.0f; + yDiff /= 550.0f; } - D_80A94910[i].unk_04 = SQ(temp_f0); + sSoTCsAmmoDrops[i].scale = SQ(yDiff); } else { - D_80A94910[i].unk_04 = -10.0f; + sSoTCsAmmoDrops[i].scale = -10.0f; } } } - this->unk_278++; + this->counter++; } -void func_80A93298(EnTest6* this, PlayState* play) { - s16 temp_s3; - s16 temp_s4; - f32 phi_f24; - s16 phi_s2; +/** + * Draws clocks in a double spiral above and below player + */ +void EnTest6_DrawThreeDayResetSoTCutscene(EnTest6* this, PlayState* play) { + s16 clock1Yaw; + s16 clock2Yaw; + s16 angle; s32 i; - f32 cos; - f32 sin; + Vec3f clockPos; OPEN_DISPS(play->state.gfxCtx); - this->unk_148 = POLY_OPA_DISP; - phi_f24 = 0.0f; + this->gfx = POLY_OPA_DISP; + clockPos.y = 0.0f; - temp_s3 = this->unk_27C; - temp_s4 = (s32)(Math_SinS(play->state.frames) * 12000.0f) + temp_s3 + 0x4E20; - phi_s2 = (play->state.frames & 0x3C) * 1024; - phi_s2 *= (this->unk_154 / 200.0f); - this->unk_27C += (s16)this->unk_154; - this->unk_27E = (s16)((this->unk_154 / 200.0f) * 256.0f); + clock1Yaw = this->clockAngle; + clock2Yaw = clock1Yaw + 0x4E20 + (s32)(0x2EE0 * Math_SinS(play->state.frames)); + // The `& 0x3C` ensures the angle only updates once every 4 frames + angle = (play->state.frames & 0x3C) * 1024; + angle *= this->clockSpeed / 200.0f; + this->clockAngle += (s16)this->clockSpeed; + this->clockRingRotZ = (s16)((this->clockSpeed / 200.0f) * 256.0f); - for (i = 0; i < ARRAY_COUNT(this->unk_254[0]); i++) { - temp_s3 += 0x1000; - cos = Math_CosS(temp_s3) * this->unk_150; - sin = Math_SinS(temp_s3) * this->unk_150; - Matrix_Translate(cos, phi_f24, sin, MTXMODE_NEW); + // Draw 2 clocks per loop + for (i = 0; i < (SOTCS_RESET_NUM_CLOCKS / 2); i++) { + // Clock 1 + clock1Yaw += 0x1000; + clockPos.x = Math_CosS(clock1Yaw) * this->clockDist; + clockPos.z = Math_SinS(clock1Yaw) * this->clockDist; + Matrix_Translate(clockPos.x, clockPos.y, clockPos.z, MTXMODE_NEW); Matrix_RotateXS(0x4000, MTXMODE_APPLY); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - Matrix_RotateZS(phi_s2, MTXMODE_APPLY); + Matrix_RotateZS(angle, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); - gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255); - gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); - gSPDisplayList(this->unk_148++, gSongOfTimeClockDL); + gSPMatrix(this->gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(this->gfx++, 0, 0xFF, 28, 28, 28, 255); + gDPSetEnvColor(this->gfx++, 255, 255, 255, 255); + gDPSetRenderMode(this->gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); + gSPDisplayList(this->gfx++, gSongOfTimeClockDL); - temp_s4 += 0x1000; - cos = Math_CosS(temp_s4) * this->unk_150; - sin = Math_SinS(temp_s4) * this->unk_150; - Matrix_Translate(cos, phi_f24, sin, MTXMODE_NEW); + // Clock 2 + clock2Yaw += 0x1000; + clockPos.x = Math_CosS(clock2Yaw) * this->clockDist; + clockPos.z = Math_SinS(clock2Yaw) * this->clockDist; + Matrix_Translate(clockPos.x, clockPos.y, clockPos.z, MTXMODE_NEW); Matrix_RotateXS(0x4000, MTXMODE_APPLY); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - Matrix_RotateZS(-phi_s2, MTXMODE_APPLY); + Matrix_RotateZS(-angle, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); - gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255); - gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); - gSPDisplayList(this->unk_148++, gSongOfTimeClockDL); + gSPMatrix(this->gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(this->gfx++, 0, 0xFF, 28, 28, 28, 255); + gDPSetEnvColor(this->gfx++, 255, 255, 255, 255); + gDPSetRenderMode(this->gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); + gSPDisplayList(this->gfx++, gSongOfTimeClockDL); - phi_f24 -= this->unk_14C; - phi_s2 += this->unk_27E; + clockPos.y -= this->speed; + angle += this->clockRingRotZ; } - POLY_OPA_DISP = this->unk_148; + POLY_OPA_DISP = this->gfx; - for (i = 0; i < ARRAY_COUNT(D_80A94910); i++) { - if (D_80A94910[i].unk_04 > 0.0f) { - D_80A94910[i].unk_14(this, play, &D_80A94910[i]); + for (i = 0; i < ARRAY_COUNT(sSoTCsAmmoDrops); i++) { + if (sSoTCsAmmoDrops[i].scale > 0.0f) { + sSoTCsAmmoDrops[i].draw(this, play, &sSoTCsAmmoDrops[i]); } } CLOSE_DISPS(play->state.gfxCtx); } -void func_80A9369C(Actor* thisx, PlayState* play2) { - EnTest6* this = THIS; - PlayState* play = play2; - f32 temp_f20; - f32 temp_f22; - f32 phi_f26; - s16 phi_s2; - s16 sp78; +/** + * Draws clocks in a ring that spins around player + */ +void EnTest6_DrawDoubleSoTCutscene(EnTest6* this, PlayState* play) { + s32 pad1[2]; + Vec3f clockPos; + s16 clockRotX; + s16 clockNormalAngle; s32 i; Player* player = GET_PLAYER(play); - s32 pad; - - if (this) {} + s32 pad2; OPEN_DISPS(play->state.gfxCtx); - this->unk_148 = POLY_OPA_DISP; - this->unk_27C += (s16)this->unk_154; - this->unk_27E = this->unk_27C * 2; - sp78 = (play->state.frames & 0x3C) * 1024; - phi_s2 = this->unk_27C + 0x4000; + this->gfx = POLY_OPA_DISP; + this->clockAngle += (s16)this->clockSpeed; + this->clockRingRotZ = this->clockAngle * 2; + // The `& 0x3C` ensures the clock only turns once every 4 frames. + // Each turn rotates the clock 22.5 degrees (0x10000 / 64 * 4) + // clockNormalAngle = (play->state.frames & 0x3C) * ((0x10000 / 64 * 4) / 4); + clockNormalAngle = (play->state.frames & 0x3C) * (DEG_TO_BINANG(22.5f) / 4); + clockRotX = this->clockAngle + 0x4000; + + // All cases have the exact same code switch (player->transformation) { - default: - phi_f26 = player->actor.world.pos.y + 40.0f; - break; - case PLAYER_FORM_DEKU: - phi_f26 = player->actor.world.pos.y + 40.0f; + clockPos.x = player->actor.world.pos.y + 40.0f; break; case PLAYER_FORM_GORON: - phi_f26 = player->actor.world.pos.y + 40.0f; + clockPos.x = player->actor.world.pos.y + 40.0f; break; case PLAYER_FORM_ZORA: - phi_f26 = player->actor.world.pos.y + 40.0f; + clockPos.x = player->actor.world.pos.y + 40.0f; break; case PLAYER_FORM_FIERCE_DEITY: - phi_f26 = player->actor.world.pos.y + 40.0f; + clockPos.x = player->actor.world.pos.y + 40.0f; + break; + + default: + clockPos.x = player->actor.world.pos.y + 40.0f; break; } - for (i = 0; i < 51; i++) { - temp_f20 = Math_CosS(phi_s2) * this->unk_150; - temp_f22 = Math_SinS(phi_s2) * this->unk_150; - Matrix_RotateZS(this->unk_27E, MTXMODE_NEW); - Matrix_Translate(phi_f26, temp_f20, temp_f22, MTXMODE_APPLY); + // Draw clocks + for (i = 0; i < SOTCS_DOUBLE_NUM_CLOCKS; i++) { + clockPos.y = Math_CosS(clockRotX) * this->clockDist; + clockPos.z = Math_SinS(clockRotX) * this->clockDist; + // Rotate the entire clock ring + Matrix_RotateZS(this->clockRingRotZ, MTXMODE_NEW); + + Matrix_Translate(clockPos.x, clockPos.y, clockPos.z, MTXMODE_APPLY); Matrix_Scale(0.85f, 0.85f, 0.85f, MTXMODE_APPLY); - Matrix_RotateXS(phi_s2, MTXMODE_APPLY); - Matrix_RotateZS(sp78, MTXMODE_APPLY); + // Orient the clock so the plane it's drawn on also passes through player + Matrix_RotateXS(clockRotX, MTXMODE_APPLY); + // Rotate around the normal of the plane, so the clock plane does not change, + // the drawn shape is spun internally + Matrix_RotateZS(clockNormalAngle, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(this->unk_148++, 0, 0xFF, this->unk_280, this->unk_280, this->unk_280, 255); - gDPSetEnvColor(this->unk_148++, 235, 238, 235, 255); - gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); - gSPDisplayList(this->unk_148++, gSongOfTimeClockDL); + gSPMatrix(this->gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(this->gfx++, 0, 0xFF, this->clockColorGray, this->clockColorGray, this->clockColorGray, 255); + gDPSetEnvColor(this->gfx++, 235, 238, 235, 255); + gDPSetRenderMode(this->gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); + gSPDisplayList(this->gfx++, gSongOfTimeClockDL); - phi_s2 += 0x505; + clockRotX += 0x10000 / SOTCS_DOUBLE_NUM_CLOCKS; } Lights_PointSetPosition(&this->lights[0].info, player->actor.world.pos.x, player->actor.world.pos.y - 10.0f, player->actor.world.pos.z); Lights_PointSetColorAndRadius(&this->lights[0].info, 100, 250, 100, 200); - POLY_OPA_DISP = this->unk_148; + POLY_OPA_DISP = this->gfx; CLOSE_DISPS(play->state.gfxCtx); } -void func_80A939E8(EnTest6* this, PlayState* play2) { +/** + * Draws clocks flat on the ground. + * Also draws black particles that raise or fall to indicate if time is speeding up or slowing down + */ +void EnTest6_DrawInvertedSoTCutscene(EnTest6* this, PlayState* play2) { PlayState* play = play2; Player* player = GET_PLAYER(play); - f32 temp_f20; + f32 flashScale; s32 i; OPEN_DISPS(play->state.gfxCtx); switch (this->cueId) { - case 91: - case 93: + case SOTCS_CUEID_INV_SETUP_CLOCKS: + case SOTCS_CUEID_INV_UNUSED: Lights_PointSetPosition(&this->lights[0].info, player->actor.world.pos.x, player->actor.world.pos.y - 10.0f, player->actor.world.pos.z); - Lights_PointSetColorAndRadius(&this->lights[0].info, 245, 245, 200, this->unk_282); + Lights_PointSetColorAndRadius(&this->lights[0].info, 245, 245, 200, this->alpha); break; - case 95: - this->unk_148 = POLY_XLU_DISP; + case SOTCS_CUEID_INV_CLOCKS: + this->gfx = POLY_XLU_DISP; - for (i = 0; i < ARRAY_COUNT(this->unk_20C); i++) { - Matrix_Translate(this->unk_20C[i].x, this->unk_20C[i].y, this->unk_20C[i].z, MTXMODE_NEW); + // Draw clocks + for (i = 0; i < ARRAY_COUNT(this->invSoTClockPos); i++) { + Matrix_Translate(this->invSoTClockPos[i].x, this->invSoTClockPos[i].y, this->invSoTClockPos[i].z, + MTXMODE_NEW); Matrix_Scale(0.3f, 0.3f, 0.3f, MTXMODE_APPLY); Matrix_RotateXS(-0x4000, MTXMODE_APPLY); - Matrix_RotateZS(this->unk_278, MTXMODE_APPLY); + Matrix_RotateZS(this->invSoTClockYaw, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); - gDPSetEnvColor(this->unk_148++, 245, 245, 200, this->unk_282); - gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); - gSPDisplayList(this->unk_148++, gSongOfTimeClockDL); + gSPMatrix(this->gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(this->gfx++, 0, 0xFF, 28, 28, 28, 255); + gDPSetEnvColor(this->gfx++, 245, 245, 200, this->alpha); + gDPSetRenderMode(this->gfx++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); + gSPDisplayList(this->gfx++, gSongOfTimeClockDL); - POLY_XLU_DISP = this->unk_148; + POLY_XLU_DISP = this->gfx; } - if (this->unk_254 != NULL) { - for (i = 0; i < ARRAY_COUNT(this->unk_254[0]); i++) { - temp_f20 = Rand_ZeroOne() * 0.0025f; - Matrix_Translate((*this->unk_254)[i].x, (*this->unk_254)[i].y, (*this->unk_254)[i].z, MTXMODE_NEW); - Matrix_Scale(temp_f20, temp_f20, temp_f20, MTXMODE_APPLY); + // Draw black particles + if (this->invSoTParticles != NULL) { + for (i = 0; i < SOTCS_NUM_PARTICLES; i++) { + flashScale = Rand_ZeroOne() * 0.0025f; + Matrix_Translate((*this->invSoTParticles)[i].x, (*this->invSoTParticles)[i].y, + (*this->invSoTParticles)[i].z, MTXMODE_NEW); + Matrix_Scale(flashScale, flashScale, flashScale, MTXMODE_APPLY); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 128, 128, 128, this->unk_282 >> 1); - gDPSetEnvColor(POLY_XLU_DISP++, 230, 230, 180, this->unk_282); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 128, 128, 128, this->alpha >> 1); + gDPSetEnvColor(POLY_XLU_DISP++, 230, 230, 180, this->alpha); Gfx_SetupDL25_Xlu(play->state.gfxCtx); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZS(this->unk_278 + (i << 2), MTXMODE_APPLY); + Matrix_RotateZS(this->invSoTClockYaw + (i << 2), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); } } + Lights_PointSetPosition(&this->lights[0].info, player->actor.world.pos.x, player->actor.world.pos.y - 10.0f, player->actor.world.pos.z); - Lights_PointSetColorAndRadius(&this->lights[0].info, 250, 250, 100, this->unk_282); + Lights_PointSetColorAndRadius(&this->lights[0].info, 250, 250, 100, this->alpha); break; - case 90: - case 92: - case 94: - case 96: - case 97: - case 98: - case 99: + case SOTCS_CUEID_INV_INIT: + case SOTCS_CUEID_INV_END: break; } @@ -1326,18 +1423,21 @@ void func_80A939E8(EnTest6* this, PlayState* play2) { void EnTest6_Draw(Actor* thisx, PlayState* play) { EnTest6* this = THIS; - if (this->cueId != 0) { - switch (this->unk_276) { - case 1: - func_80A93298(this, play); + if (this->cueId != SOTCS_CUEID_NONE) { + switch (this->drawType) { + case SOTCS_DRAW_RESET_CYCLE_SOT: + EnTest6_DrawThreeDayResetSoTCutscene(this, play); break; - case 0: - func_80A9369C(thisx, play); + case SOTCS_DRAW_DOUBLE_SOT: + EnTest6_DrawDoubleSoTCutscene(this, play); break; - case 2: - func_80A939E8(this, play); + case SOTCS_DRAW_INVERTED_SOT: + EnTest6_DrawInvertedSoTCutscene(this, play); + break; + + default: break; } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.h b/src/overlays/actors/ovl_En_Test6/z_en_test6.h index 2fe138ddb..726e23dc5 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.h +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.h @@ -7,46 +7,71 @@ struct EnTest6; typedef void (*EnTest6ActionFunc)(struct EnTest6*, PlayState*); -#define ENTEST6_GET(thisx) ((thisx)->params) +#define SOTCS_GET_OCARINA_MODE(thisx) ((thisx)->params) -typedef enum { - /* 24 */ ENTEST6_24 = 24, - /* 25 */ ENTEST6_25, - /* 26 */ ENTEST6_26 -} EnTest6Param; +// CueIds are a mix of cues from external cutscenes and internal states + +typedef enum SoTCsCueId { + /* 0x00 */ SOTCS_CUEID_NONE, + /* 0x01 */ SOTCS_CUEID_DOUBLE_WAIT, + /* 0x02 */ SOTCS_CUEID_DOUBLE_INIT, + /* 0x03 */ SOTCS_CUEID_DOUBLE_CLOCKS_INWARD, + /* 0x04 */ SOTCS_CUEID_DOUBLE_CLOCKS_SPIN, + /* 0x05 */ SOTCS_CUEID_DOUBLE_CLOCKS_OUTWARD, + /* 0x06 */ SOTCS_CUEID_RESET_INIT, + /* 0x07 */ SOTCS_CUEID_RESET_CLOCKS_SLOW_DOWN, + /* 0x08 */ SOTCS_CUEID_RESET_CLOCKS_SPEED_UP, + /* 0x09 */ SOTCS_CUEID_DOUBLE_END, + /* 0x5A */ SOTCS_CUEID_INV_INIT = 90, + /* 0x5B */ SOTCS_CUEID_INV_SETUP_CLOCKS, + /* 0x5D */ SOTCS_CUEID_INV_UNUSED = 93, + /* 0x5F */ SOTCS_CUEID_INV_CLOCKS = 95, + /* 0x63 */ SOTCS_CUEID_INV_END = 99 +} SoTCsCueId; typedef struct { - /* 0x00 */ LightNode* node; - /* 0x04 */ LightInfo info; -} EnTest6Light; // size = 0x14 + /* 0x0 */ LightNode* node; + /* 0x4 */ LightInfo info; +} SoTCsLight; // size = 0x14 + +#define SOTCS_INV_NUM_CLOCKS 6 +#define SOTCS_DOUBLE_NUM_CLOCKS 51 +#define SOTCS_RESET_NUM_CLOCKS 128 +#define SOTCS_NUM_PARTICLES 64 typedef struct EnTest6 { /* 0x000 */ Actor actor; /* 0x144 */ EnTest6ActionFunc actionFunc; - /* 0x148 */ Gfx* unk_148; - /* 0x14C */ f32 unk_14C; - /* 0x150 */ f32 unk_150; - /* 0x154 */ f32 unk_154; - /* 0x158 */ f32 unk_158; - /* 0x15C */ f32 unk_15C; - /* 0x160 */ f32 unk_160; - /* 0x164 */ EnTest6Light lights[2]; - /* 0x18C */ CutsceneCamera unk_18C; - /* 0x20C */ Vec3f unk_20C[6]; - /* 0x254 */ Vec3f (*unk_254)[64]; + /* 0x148 */ Gfx* gfx; + /* 0x14C */ f32 speed; // Used for clock distance and lights + /* 0x150 */ f32 clockDist; // Radius from player + /* 0x154 */ f32 clockSpeed; + /* 0x158 */ union { + f32 clockRadialSpeed; // For double SoT cutscene + f32 clockAccel; // For reset SoT cutscene + }; + /* 0x15C */ f32 invSoTEnvLerp; + /* 0x160 */ f32 doubleSoTEnvLerp; + /* 0x164 */ SoTCsLight lights[2]; + /* 0x18C */ CutsceneCamera csCamInfo; + /* 0x20C */ Vec3f invSoTClockPos[SOTCS_INV_NUM_CLOCKS]; + /* 0x254 */ Vec3f (*invSoTParticles)[SOTCS_NUM_PARTICLES]; /* 0x258 */ Vec3f subCamAt; /* 0x264 */ Vec3f subCamEye; /* 0x270 */ f32 subCamFov; /* 0x274 */ s16 cueId; - /* 0x276 */ s16 unk_276; - /* 0x278 */ s16 unk_278; - /* 0x27A */ s16 unk_27A; - /* 0x27C */ s16 unk_27C; - /* 0x27E */ s16 unk_27E; - /* 0x280 */ s16 unk_280; - /* 0x282 */ s16 unk_282; + /* 0x276 */ s16 drawType; + /* 0x278 */ union { + s16 invSoTClockYaw; // For inverted SoT cutscene. + s16 counter; // For double/reset SoT cutscenes. Increments every frame, unused. + }; + /* 0x27A */ s16 timer; + /* 0x27C */ s16 clockAngle; + /* 0x27E */ s16 clockRingRotZ; // For double/reset SoT cutscenes + /* 0x280 */ s16 clockColorGray; // For double SoT cutscene + /* 0x282 */ s16 alpha; /* 0x284 */ s16 subCamId; - /* 0x286 */ s16 unk_286; + /* 0x286 */ s16 screenFillAlpha; // As a ratio, 20 is an alpha of 255 } EnTest6; // size = 0x288 #endif // Z_EN_TEST6_H 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 2606331e2..417176d96 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -364,14 +364,13 @@ void func_80AF14FC(PlayState* play2, EnTest7Struct2* arg1) { } temp_v0 = Matrix_NewMtx(play->state.gfxCtx); - if (temp_v0 != NULL) { - gSPMatrix(POLY_OPA_DISP++, temp_v0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_081628); + if (temp_v0 == NULL) { + continue; } + gSPMatrix(POLY_OPA_DISP++, temp_v0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_081628); } - if (ptr) {} - Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx); @@ -444,13 +443,13 @@ void func_80AF19A8(EnTest7* this, PlayState* play) { } void func_80AF1A2C(EnTest7* this, PlayState* play) { - Color_RGB8 sp34 = { 64, 0, 0 }; - Color_RGB8 sp30 = { 220, 220, 255 }; - f32 sp2C = this->unk_1E54 / 10.0f; + Color_RGB8 fogColor = { 64, 0, 0 }; + Color_RGB8 ambientColor = { 220, 220, 255 }; + f32 envLerp = this->unk_1E54 / 10.0f; - func_800FD59C(play, &sp30, sp2C); - func_800FD654(play, &sp34, sp2C); - func_800FD698(play, 2000, 4000, sp2C); + Environment_LerpAmbientColor(play, &ambientColor, envLerp); + Environment_LerpFogColor(play, &fogColor, envLerp); + Environment_LerpFog(play, 2000, 4000, envLerp); if (this->unk_1E54 >= 10) { Camera* subCam = @@ -462,7 +461,7 @@ void func_80AF1A2C(EnTest7* this, PlayState* play) { func_80AF082C(this, func_80AF1CA0); this->unk_144 |= 0x20; - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_OPEN); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_OPEN); Play_EnableMotionBlur(120); } } @@ -506,13 +505,13 @@ void func_80AF1CA0(EnTest7* this, PlayState* play) { if ((this->unk_18CC.frameCtrl.unk_10 > 20.0f) && !(this->unk_144 & 0x40)) { this->unk_144 |= 0x40; - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_CLOSE); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_CLOSE); } if (this->unk_18CC.frameCtrl.unk_10 > 42.0f) { if (!(this->unk_144 & 0x80)) { this->unk_144 |= 0x80; - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_ROLL); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_ROLL); } if (Rand_ZeroOne() < 0.3f) { @@ -611,12 +610,12 @@ void func_80AF2030(EnTest7* this, PlayState* play) { void func_80AF21E8(EnTest7* this, PlayState* play) { s32 sp2C = this->unk_1E54 - 100; - f32 sp1C; - Color_RGB8 sp24 = { 64, 0, 0 }; - Color_RGB8 sp20 = { 220, 220, 255 }; + f32 envLerp; + Color_RGB8 fogColor = { 64, 0, 0 }; + Color_RGB8 ambientColor = { 220, 220, 255 }; if (R_PLAY_FILL_SCREEN_ON) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_VANISH); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_VANISH); R_PLAY_FILL_SCREEN_ON = false; R_PLAY_FILL_SCREEN_R = 0; R_PLAY_FILL_SCREEN_G = 0; @@ -624,10 +623,10 @@ void func_80AF21E8(EnTest7* this, PlayState* play) { R_PLAY_FILL_SCREEN_ALPHA = 0; } - sp1C = 1.0f - (sp2C / 10.0f); - func_800FD59C(play, &sp20, sp1C); - func_800FD654(play, &sp24, sp1C); - func_800FD698(play, 2000, 4000, sp1C); + envLerp = 1.0f - (sp2C / 10.0f); + Environment_LerpAmbientColor(play, &ambientColor, envLerp); + Environment_LerpFogColor(play, &fogColor, envLerp); + Environment_LerpFog(play, 2000, 4000, envLerp); if (this->unk_1E54 >= 110) { func_80AF082C(this, func_80AF2318); @@ -850,7 +849,7 @@ void func_80AF2C48(EnTest7* this, PlayState* play) { subCam->at.y = this->actor.world.pos.y + 40.0f; subCam->at.z = this->actor.world.pos.z; - func_800B9010(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); if (this->unk_1E54 >= 40) { this->unk_144 &= ~4; func_80AF082C(this, func_80AF2F98); @@ -896,7 +895,7 @@ void func_80AF2F98(EnTest7* this, PlayState* play) { Player* player2 = GET_PLAYER(play); Vec3f sp2C; - func_800B9010(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); sp2C = this->actor.world.pos; @@ -988,6 +987,7 @@ void EnTest7_Draw(Actor* thisx, PlayState* play) { func_80AF14FC(play, this->unk_15C); if (this->unk_144 & 4) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, this->actor.world.pos, 70.0f, 5.0f, 0, 0); + Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, this->actor.world.pos, 70.0f, + 5.0f, 0, 0); } } diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 0672bd4bf..efdc48713 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -7,7 +7,7 @@ #include "z_en_tg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnTg*)thisx) 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 87589ae8c..3671693c7 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -6,8 +6,10 @@ #include "prevent_bss_reordering.h" #include "z_en_thiefbird.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000) #define THIS ((EnThiefbird*)thisx) @@ -231,7 +233,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { } } - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { phi_a3 = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD); if (INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) == ITEM_SWORD_GREAT_FAIRY) { phi_a3 += 4; @@ -265,7 +267,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 = gTakkuriStolenGreatFairySwordDL; + this->unk_3E8 = gTakkuriStolenGreatFairysSwordDL; itemId1 = ITEM_SWORD_GREAT_FAIRY; } else { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; @@ -464,7 +466,7 @@ void func_80C114C0(EnThiefbird* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_THIEFBIRD_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -478,10 +480,10 @@ void func_80C11538(EnThiefbird* this) { void func_80C11590(EnThiefbird* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp38; + s32 onAnimFirstFrame; SkelAnime_Update(&this->skelAnime); - sp38 = Animation_OnFrame(&this->skelAnime, 0.0f); + onAnimFirstFrame = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 3.0f; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -492,7 +494,7 @@ void func_80C11590(EnThiefbird* this, PlayState* play) { } } - if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 5, 0x300, 0x10) && (sp38 != 0) && + if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 5, 0x300, 0x10) && onAnimFirstFrame && (Rand_ZeroOne() < 0.1f)) { s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y; @@ -512,7 +514,7 @@ void func_80C11590(EnThiefbird* this, PlayState* play) { this->unk_190 = Rand_S16Offset(2048, 2048); } - if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk_190, 10, 0x100, 8) && (sp38 != 0) && + if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk_190, 10, 0x100, 8) && onAnimFirstFrame && (Rand_ZeroOne() < 0.1f)) { if (this->actor.home.pos.y < this->actor.world.pos.y) { this->unk_190 -= Rand_S16Offset(0x400, 0x400); @@ -640,7 +642,7 @@ void func_80C11D14(EnThiefbird* this, PlayState* play) { } void func_80C11DC0(EnThiefbird* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80C11DF0; this->actor.gravity = -0.5f; } @@ -655,8 +657,8 @@ void func_80C11DF0(EnThiefbird* this, PlayState* play) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); + for (i = 0; i < EN_THIEFBIRD_BODYPART_MAX; i++) { + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); @@ -833,7 +835,7 @@ void func_80C124B0(EnThiefbird* this, PlayState* play) { } void func_80C126A8(EnThiefbird* this) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->collider.base.acFlags &= ~AC_ON; this->actionFunc = func_80C126D8; } @@ -887,10 +889,10 @@ void func_80C127F4(EnThiefbird* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &this->unk_3EC->actor), 3, 0x2000, 0x100); } - temp_v0 = Math_Vec3f_Pitch(&this->limbPos[9], &this->unk_3EC->actor.world.pos); + temp_v0 = Math_Vec3f_Pitch(&this->bodyPartsPos[EN_THIEFBIRD_BODYPART_9], &this->unk_3EC->actor.world.pos); temp_v0 = CLAMP(temp_v0, -0x3000, 0x3000); Math_SmoothStepToS(&this->actor.shape.rot.x, temp_v0, 4, 0x800, 0x80); - temp_f0 = Actor_WorldDistXYZToPoint(&this->unk_3EC->actor, &this->limbPos[9]); + temp_f0 = Actor_WorldDistXYZToPoint(&this->unk_3EC->actor, &this->bodyPartsPos[EN_THIEFBIRD_BODYPART_9]); this->actor.speed = (0.02f * temp_f0) + 2.0f; this->actor.speed = CLAMP_MAX(this->actor.speed, 4.0f); if ((this->unk_3EC->actor.speed <= 0.0f) && (temp_f0 < 40.0f)) { @@ -949,7 +951,8 @@ void func_80C12B1C(EnThiefbird* this, PlayState* play) { if (i != ARRAY_COUNT(this->colliderElements)) { sph = &this->collider.elements[i]; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sph->info.bumper.hitPos.x, - sph->info.bumper.hitPos.y, sph->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + sph->info.bumper.hitPos.y, sph->info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } } else if (this->actor.colChkInfo.damageEffect == 2) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; @@ -1037,7 +1040,7 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.25f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.5f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.5f, 0.0125f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } @@ -1063,14 +1066,31 @@ s32 EnThiefbird_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve return false; } +static s8 sLimbToBodyParts[TAKKURI_LIMB_MAX] = { + BODYPART_NONE, // TAKKURI_LIMB_NONE + EN_THIEFBIRD_BODYPART_0, // TAKKURI_LIMB_BODY + BODYPART_NONE, // TAKKURI_LIMB_LEFT_WING_BASE + EN_THIEFBIRD_BODYPART_1, // TAKKURI_LIMB_LEFT_WING_MIDDLE + EN_THIEFBIRD_BODYPART_3, // TAKKURI_LIMB_LEFT_WING_TIP + BODYPART_NONE, // TAKKURI_LIMB_RIGHT_WING_BASE + EN_THIEFBIRD_BODYPART_2, // TAKKURI_LIMB_RIGHT_WING_MIDDLE + EN_THIEFBIRD_BODYPART_5, // TAKKURI_LIMB_RIGHT_WING_TIP + BODYPART_NONE, // TAKKURI_LIMB_NECK + BODYPART_NONE, // TAKKURI_LIMB_HEAD + EN_THIEFBIRD_BODYPART_7, // TAKKURI_LIMB_RIGHT_EAR + EN_THIEFBIRD_BODYPART_8, // TAKKURI_LIMB_LEFT_EAR + EN_THIEFBIRD_BODYPART_9, // TAKKURI_LIMB_LOWER_BEAK + BODYPART_NONE, // TAKKURI_LIMB_EYES + BODYPART_NONE, // TAKKURI_LIMB_LEGS + EN_THIEFBIRD_BODYPART_10, // TAKKURI_LIMB_FEET + BODYPART_NONE, // TAKKURI_LIMB_STOLEN_ITEM +}; + void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_80C13698[] = { - -1, 0, -1, 1, 3, -1, 2, 5, -1, -1, 7, 8, 9, -1, -1, 10, -1, - }; EnThiefbird* this = THIS; s32 pad; Gfx* gfx; - s8 idx; + s8 bodyPartIndex; Collider_UpdateSpheres(limbIndex, &this->collider); if ((limbIndex == TAKKURI_LIMB_RIGHT_EAR) || (limbIndex == TAKKURI_LIMB_LEFT_EAR)) { @@ -1106,14 +1126,14 @@ void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s } } - idx = D_80C13698[limbIndex]; - if (idx != -1) { - if (idx == 9) { - Matrix_MultVecX(1000.0f, &this->limbPos[idx]); + bodyPartIndex = sLimbToBodyParts[limbIndex]; + if (bodyPartIndex != BODYPART_NONE) { + if (bodyPartIndex == EN_THIEFBIRD_BODYPART_9) { + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[bodyPartIndex]); } else { - Matrix_MultZero(&this->limbPos[idx]); - if ((idx == 3) || (idx == 5)) { - Matrix_MultVecX(2000.0f, &this->limbPos[idx + 1]); + Matrix_MultZero(&this->bodyPartsPos[bodyPartIndex]); + if ((bodyPartIndex == EN_THIEFBIRD_BODYPART_3) || (bodyPartIndex == EN_THIEFBIRD_BODYPART_5)) { + Matrix_MultVecX(2000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); } } } @@ -1161,7 +1181,7 @@ void EnThiefbird_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } func_80C13354(this, play); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_THIEFBIRD_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); Math_Vec3s_ToVec3f(&this->actor.focus.pos, &this->collider.elements[1].dim.worldSphere.center); } 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 c40555299..bbe354848 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h @@ -18,6 +18,21 @@ typedef struct { /* 0x22 */ s16 unk_22; } EnThiefbirdUnkStruct; // size = 0x24 +typedef enum EnThiefbirdBodyPart { + /* 0 */ EN_THIEFBIRD_BODYPART_0, + /* 1 */ EN_THIEFBIRD_BODYPART_1, + /* 2 */ EN_THIEFBIRD_BODYPART_2, + /* 3 */ EN_THIEFBIRD_BODYPART_3, + /* 4 */ EN_THIEFBIRD_BODYPART_4, + /* 5 */ EN_THIEFBIRD_BODYPART_5, + /* 6 */ EN_THIEFBIRD_BODYPART_6, + /* 7 */ EN_THIEFBIRD_BODYPART_7, + /* 8 */ EN_THIEFBIRD_BODYPART_8, + /* 9 */ EN_THIEFBIRD_BODYPART_9, + /* 10 */ EN_THIEFBIRD_BODYPART_10, + /* 11 */ EN_THIEFBIRD_BODYPART_MAX +} EnThiefbirdBodyPart; + typedef struct EnThiefbird { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -32,7 +47,7 @@ typedef struct EnThiefbird { /* 0x208 */ Vec3s morphTable[TAKKURI_LIMB_MAX]; /* 0x270 */ ColliderJntSph collider; /* 0x290 */ ColliderJntSphElement colliderElements[3]; - /* 0x350 */ Vec3f limbPos[11]; + /* 0x350 */ Vec3f bodyPartsPos[EN_THIEFBIRD_BODYPART_MAX]; /* 0x3D4 */ f32 drawDmgEffAlpha; /* 0x3D8 */ f32 drawDmgEffScale; /* 0x3DC */ f32 drawDmgEffFrozenSteamScale; 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 dfcd1bad0..d99ee0bce 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 @@ -56,7 +56,7 @@ void EnTimeTag_Init(Actor* thisx, PlayState* play) { switch (TIMETAG_GET_TYPE(&this->actor)) { case TIMETAG_KICKOUT_FINAL_HOURS: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40) || (CURRENT_DAY != 3)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED) || (CURRENT_DAY != 3)) { Actor_Kill(&this->actor); return; } @@ -116,13 +116,13 @@ void EnTimeTag_RooftopOath_Cutscene(EnTimeTag* this, PlayState* play) { void EnTimeTag_RooftopOath_Wait(EnTimeTag* this, PlayState* play) { Actor* thisx = &this->actor; - if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_OATH)) { - if (thisx->csId != CS_ID_NONE) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_OATH)) { + if (this->actor.csId != CS_ID_NONE) { this->actionFunc = EnTimeTag_RooftopOath_Cutscene; CutsceneManager_Queue(thisx->csId); gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; } - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } } @@ -161,10 +161,10 @@ void EnTimeTag_SoaringEngraving_Wait(EnTimeTag* this, PlayState* play) { this->actionFunc = EnTimeTag_SoaringEngraving_SubsequentInteraction; } } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && - (Flags_GetSwitch(play, TIMETAG_SOARING_GET_SWITCHFLAG(&this->actor)) || + (Flags_GetSwitch(play, TIMETAG_SOARING_GET_SWITCH_FLAG(&this->actor)) || CHECK_QUEST_ITEM(QUEST_SONG_SOARING))) { - this->actor.flags |= ACTOR_FLAG_1; - func_800B8614(&this->actor, play, 110.0f); + this->actor.flags |= ACTOR_FLAG_TARGETABLE; + Actor_OfferTalk(&this->actor, play, 110.0f); } } @@ -186,11 +186,11 @@ void EnTimeTag_Diary_AfterOcarina(EnTimeTag* this, PlayState* play) { } void EnTimeTag_Diary_TeachEvanSongSnippets(EnTimeTag* this, PlayState* play) { - if ((play->msgCtx.ocarinaStaff->state == 0) && (play->msgCtx.msgMode == 0x1B)) { + if ((play->msgCtx.ocarinaStaff->state == 0) && (play->msgCtx.msgMode == MSGMODE_SONG_DEMONSTRATION_DONE)) { TIMETAG_DIARY_TIMER(&this->actor) = 5; this->actionFunc = EnTimeTag_Diary_AfterOcarina; play->msgCtx.msgLength = 0; - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; } } @@ -217,13 +217,13 @@ void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play) { break; case 0x122B: // Mikau diary part 1 - func_80152434(play, 0x3F); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_DEMONSTRATE_EVAN_PART1_SECOND_HALF); this->actionFunc = EnTimeTag_Diary_TeachEvanSongSnippets; TIMETAG_DIARY_SONG(&this->actor) = TIMETAG_DIARY_SONG_EVAN_PART1; break; case 0x122E: // Mikau diary part 3 - func_80152434(play, 0x40); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_DEMONSTRATE_EVAN_PART2_SECOND_HALF); this->actionFunc = EnTimeTag_Diary_TeachEvanSongSnippets; TIMETAG_DIARY_SONG(&this->actor) = TIMETAG_DIARY_SONG_EVAN_PART2; break; @@ -256,7 +256,7 @@ void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play) { void EnTimeTag_Diary_Wait(EnTimeTag* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (TIMETAG_DIARY_GET_TYPE(&this->actor) == TIMETAG_DIARY_LULU) { Message_StartTextbox(play, 0x101C, &this->actor); } else { @@ -277,7 +277,7 @@ void EnTimeTag_Diary_Wait(EnTimeTag* this, PlayState* play) { } this->actionFunc = EnTimeTag_Diary_Cutscene; } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 110.0f); + Actor_OfferTalk(&this->actor, play, 110.0f); } } diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h index c022ca122..33f6d414e 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h @@ -14,7 +14,7 @@ typedef void (*EnTimeTagActionFunc)(struct EnTimeTag*, PlayState*); #define TIMETAG_KICKOUT_HOUR(thisx) ((thisx)->home.rot.x) #define TIMETAG_KICKOUT_MINUTE(thisx) ((thisx)->home.rot.y) -#define TIMETAG_SOARING_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define TIMETAG_SOARING_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define TIMETAG_DIARY_GET_TYPE(thisx) ((thisx)->params & 0x7F) #define TIMETAG_DIARY_TIMER(thisx) ((thisx)->home.rot.x) diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 1ae0e073b..bf861c2da 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -5,9 +5,10 @@ */ #include "z_en_tite.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "objects/object_tite/object_tite.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200) #define THIS ((EnTite*)thisx) @@ -162,7 +163,7 @@ void EnTite_Init(Actor* thisx, PlayState* play) { if (this->actor.params == ENTITE_MINUS_3) { this->actor.params = ENTITE_MINUS_2; this->unk_2BE = 240; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.shape.yOffset = -3000.0f; this->actor.shape.shadowDraw = NULL; func_80895A10(this); @@ -244,18 +245,18 @@ void func_80893BCC(EnTite* this, PlayState* play) { SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) { - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { - func_800BBFB0(play, &this->limbPos[i], 1.0f, 2, 80, 15, 1); + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { + func_800BBFB0(play, &this->bodyPartsPos[i], 1.0f, 2, 80, 15, 1); } } else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) { - Vec3f* ptr; + Vec3f* bodyPartPos; - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { for (j = 0; j < 2; j++) { - ptr = &this->limbPos[i]; - sp7C.x = ptr->x + Rand_CenteredFloat(1.0f); - sp7C.y = ptr->y + Rand_CenteredFloat(1.0f); - sp7C.z = ptr->z + Rand_CenteredFloat(1.0f); + bodyPartPos = &this->bodyPartsPos[i]; + sp7C.x = bodyPartPos->x + Rand_CenteredFloat(1.0f); + sp7C.y = bodyPartPos->y + Rand_CenteredFloat(1.0f); + sp7C.z = bodyPartPos->z + Rand_CenteredFloat(1.0f); func_800B0DE0(play, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, (s32)Rand_ZeroFloat(16.0f) + 80, 15); } @@ -281,7 +282,7 @@ void func_80893E54(EnTite* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 9, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENTITE_BODYPART_MAX, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -352,7 +353,7 @@ void func_8089408C(EnTite* this, PlayState* play) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.velocity.y = 10.0f; } else { this->actor.velocity.y = 8.0f; @@ -639,7 +640,7 @@ void func_80895020(EnTite* this, PlayState* play) { this->collider.base.acFlags &= ~AC_ON; this->actor.colorFilterTimer = 0; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; this->unk_2BA = 1; Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, this->unk_2BE); @@ -649,8 +650,8 @@ void func_80895020(EnTite* this, PlayState* play) { this->actor.speed = 0.0f; ptr = &this->unk_33C[0]; - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++, ptr++) { - Math_Vec3f_Diff(&this->limbPos[i], &this->actor.world.pos, &sp74); + for (i = 0; i < ENTITE_BODYPART_MAX; i++, ptr++) { + Math_Vec3f_Diff(&this->bodyPartsPos[i], &this->actor.world.pos, &sp74); temp_f0 = Math3D_Vec3fMagnitude(&sp74); if (temp_f0 > 1.0f) { temp_f0 = 1.2f / temp_f0; @@ -670,16 +671,16 @@ void func_808951B8(EnTite* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 4, 0x1000, 0x400); if (this->unk_2BC == 0) { - for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); - SoundSource_PlaySfxAtFixedWorldPos(play, &this->limbPos[i], 11, NA_SE_EN_EXTINCT); + for (i = 0; i < ENTITE_BODYPART_MAX; i++) { + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } Actor_Kill(&this->actor); return; } - for (i = 0; i < ARRAY_COUNT(this->unk_33C); i++) { - Math_Vec3f_Sum(&this->limbPos[i], &this->unk_33C[i], &this->limbPos[i]); + for (i = 0; i < ENTITE_BODYPART_MAX; i++) { + Math_Vec3f_Sum(&this->bodyPartsPos[i], &this->unk_33C[i], &this->bodyPartsPos[i]); this->unk_33C[i].y += this->actor.gravity; } } @@ -928,7 +929,7 @@ void func_80895E28(EnTite* this, PlayState* play) { func_800B0DE0(play, &sp44, &sp38, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); if (Math_StepToF(&this->actor.shape.yOffset, 0.0f, 200.0f)) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.acFlags |= AC_ON; func_808945EC(this); @@ -999,7 +1000,7 @@ void func_80895FF8(EnTite* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); @@ -1021,7 +1022,7 @@ void func_80895FF8(EnTite* this, PlayState* play) { } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->collider.base.acFlags & AC_ON) && (this->actor.colChkInfo.health != 0) && (play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f))) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (this->actor.shape.yOffset < 0.0f) { this->actor.shape.yOffset = 0.0f; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; @@ -1039,8 +1040,8 @@ void func_808963B4(EnTite* this, PlayState* play) { Vec3f sp48; if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { - Math_Vec3f_Copy(&sp48, &this->limbPos[i]); + for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { + Math_Vec3f_Copy(&sp48, &this->bodyPartsPos[i]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } @@ -1048,7 +1049,7 @@ void func_808963B4(EnTite* this, PlayState* play) { s32 temp = play->gameplayFrames & 7; if (!(temp & 1) && (this->actor.depthInWater < 10.0f)) { - Math_Vec3f_Copy(&sp48, &this->limbPos[5 + (temp >> 1)]); + Math_Vec3f_Copy(&sp48, &this->bodyPartsPos[ENTITE_BODYPART_5 + (temp >> 1)]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } @@ -1097,7 +1098,7 @@ void EnTite_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.25f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.5f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.5f, 0.0125f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1113,40 +1114,90 @@ s32 EnTite_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* return false; } +static s8 sLimbToBodyParts1[OBJECT_TITE_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_TITE_LIMB_NONE + BODYPART_NONE, // OBJECT_TITE_LIMB_01 + BODYPART_NONE, // OBJECT_TITE_LIMB_02 + BODYPART_NONE, // OBJECT_TITE_LIMB_03 + ENTITE_BODYPART_0, // OBJECT_TITE_LIMB_04 + BODYPART_NONE, // OBJECT_TITE_LIMB_05 + BODYPART_NONE, // OBJECT_TITE_LIMB_06 + BODYPART_NONE, // OBJECT_TITE_LIMB_07 + ENTITE_BODYPART_1, // OBJECT_TITE_LIMB_08 + BODYPART_NONE, // OBJECT_TITE_LIMB_09 + BODYPART_NONE, // OBJECT_TITE_LIMB_0A + BODYPART_NONE, // OBJECT_TITE_LIMB_0B + BODYPART_NONE, // OBJECT_TITE_LIMB_0C + ENTITE_BODYPART_2, // OBJECT_TITE_LIMB_0D + BODYPART_NONE, // OBJECT_TITE_LIMB_0E + BODYPART_NONE, // OBJECT_TITE_LIMB_0F + BODYPART_NONE, // OBJECT_TITE_LIMB_10 + BODYPART_NONE, // OBJECT_TITE_LIMB_11 + ENTITE_BODYPART_3, // OBJECT_TITE_LIMB_12 + BODYPART_NONE, // OBJECT_TITE_LIMB_13 + BODYPART_NONE, // OBJECT_TITE_LIMB_14 + BODYPART_NONE, // OBJECT_TITE_LIMB_15 + BODYPART_NONE, // OBJECT_TITE_LIMB_16 + ENTITE_BODYPART_4, // OBJECT_TITE_LIMB_17 + BODYPART_NONE, // OBJECT_TITE_LIMB_18 +}; + +static s8 sLimbToBodyParts2[OBJECT_TITE_LIMB_MAX] = { + BODYPART_NONE, // OBJECT_TITE_LIMB_NONE + BODYPART_NONE, // OBJECT_TITE_LIMB_01 + BODYPART_NONE, // OBJECT_TITE_LIMB_02 + BODYPART_NONE, // OBJECT_TITE_LIMB_03 + ENTITE_BODYPART_0, // OBJECT_TITE_LIMB_04 + BODYPART_NONE, // OBJECT_TITE_LIMB_05 + BODYPART_NONE, // OBJECT_TITE_LIMB_06 + BODYPART_NONE, // OBJECT_TITE_LIMB_07 + ENTITE_BODYPART_1, // OBJECT_TITE_LIMB_08 + ENTITE_BODYPART_5, // OBJECT_TITE_LIMB_09 + BODYPART_NONE, // OBJECT_TITE_LIMB_0A + BODYPART_NONE, // OBJECT_TITE_LIMB_0B + BODYPART_NONE, // OBJECT_TITE_LIMB_0C + ENTITE_BODYPART_2, // OBJECT_TITE_LIMB_0D + ENTITE_BODYPART_6, // OBJECT_TITE_LIMB_0E + BODYPART_NONE, // OBJECT_TITE_LIMB_0F + BODYPART_NONE, // OBJECT_TITE_LIMB_10 + BODYPART_NONE, // OBJECT_TITE_LIMB_11 + ENTITE_BODYPART_3, // OBJECT_TITE_LIMB_12 + ENTITE_BODYPART_7, // OBJECT_TITE_LIMB_13 + BODYPART_NONE, // OBJECT_TITE_LIMB_14 + BODYPART_NONE, // OBJECT_TITE_LIMB_15 + BODYPART_NONE, // OBJECT_TITE_LIMB_16 + ENTITE_BODYPART_4, // OBJECT_TITE_LIMB_17 + ENTITE_BODYPART_8, // OBJECT_TITE_LIMB_18 +}; + void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_80896B70[] = { - -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, -1, -1, 2, -1, -1, -1, -1, 3, -1, -1, -1, -1, 4, -1, - }; - static s8 D_80896B8C[] = { - -1, -1, -1, -1, 0, -1, -1, -1, 1, 5, -1, -1, -1, 2, 6, -1, -1, -1, 3, 7, -1, -1, -1, 4, 8, - }; EnTite* this = THIS; MtxF* matrix; - s8 idx; + s8 bodyPart1Index; if (this->unk_2BA == 0) { - idx = D_80896B70[limbIndex]; - if (idx != -1) { - Matrix_MultZero(&this->limbPos[idx]); - if (idx >= 1) { - Matrix_MultVecX(2500.0f, &this->limbPos[idx + 4]); + bodyPart1Index = sLimbToBodyParts1[limbIndex]; + if (bodyPart1Index != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[bodyPart1Index]); + if (bodyPart1Index >= ENTITE_BODYPART_1) { + Matrix_MultVecX(2500.0f, &this->bodyPartsPos[ENTITE_BODYPART_4 + bodyPart1Index]); } } } else if (this->unk_2BA > 0) { - if (D_80896B8C[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_80896B8C[limbIndex]]); + if (sLimbToBodyParts2[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts2[limbIndex]]); } if (limbIndex == 24) { this->unk_2BA = -1; } - } else if (D_80896B8C[limbIndex] != -1) { + } else if (sLimbToBodyParts2[limbIndex] != BODYPART_NONE) { OPEN_DISPS(play->state.gfxCtx); matrix = Matrix_GetCurrent(); - matrix->xw = this->limbPos[D_80896B8C[limbIndex]].x; - matrix->yw = this->limbPos[D_80896B8C[limbIndex]].y; - matrix->zw = this->limbPos[D_80896B8C[limbIndex]].z; + matrix->xw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].x; + matrix->yw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].y; + matrix->zw = this->bodyPartsPos[sLimbToBodyParts2[limbIndex]].z; Matrix_RotateZS(this->actor.world.rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1180,7 +1231,7 @@ void EnTite_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTite_OverrideLimbDraw, EnTite_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ENTITE_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index af77f4a8d..66fec66b3 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -15,6 +15,19 @@ typedef enum { /* 0 */ ENTITE_MINUS_0 } EnTiteParam; +typedef enum EnTiteBodyPart { + /* 0 */ ENTITE_BODYPART_0, + /* 1 */ ENTITE_BODYPART_1, + /* 2 */ ENTITE_BODYPART_2, + /* 3 */ ENTITE_BODYPART_3, + /* 4 */ ENTITE_BODYPART_4, + /* 5 */ ENTITE_BODYPART_5, + /* 6 */ ENTITE_BODYPART_6, + /* 7 */ ENTITE_BODYPART_7, + /* 8 */ ENTITE_BODYPART_8, + /* 9 */ ENTITE_BODYPART_MAX +} EnTiteBodyPart; + typedef struct EnTite { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -31,8 +44,8 @@ typedef struct EnTite { /* 0x2C4 */ f32 drawDmgEffAlpha; /* 0x2C8 */ f32 drawDmgEffScale; /* 0x2CC */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D0 */ Vec3f limbPos[9]; - /* 0x33C */ Vec3f unk_33C[9]; + /* 0x2D0 */ Vec3f bodyPartsPos[ENTITE_BODYPART_MAX]; + /* 0x33C */ Vec3f unk_33C[ENTITE_BODYPART_MAX]; /* 0x3A8 */ Gfx* unk_3A8; /* 0x3AC */ ColliderSphere collider; } EnTite; // size = 0x404 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 469e07e6d..7b88159f1 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "objects/object_tk/object_tk.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnTk*)thisx) @@ -204,10 +204,10 @@ void EnTk_Init(Actor* thisx, PlayState* play) { EnTk* this = THIS; this->unk_2B0 = ENTK_GET_F(&this->actor); - this->unk_2B1 = ENTK_GET_7F0(&this->actor); + this->switchFlag = ENTK_GET_SWITCH_FLAG(&this->actor); Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(play, this->unk_2B1)) { + if (Flags_GetSwitch(play, this->switchFlag)) { if (this->unk_2B0 == 0) { Actor_Kill(&this->actor); return; @@ -218,7 +218,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { } if ((this->unk_2B0 == 1) || (this->unk_2B0 == 3)) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); this->actor.update = func_80AEF2C8; this->actor.draw = NULL; return; @@ -231,7 +231,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { this->unk_318 = 0; this->unk_2D4 = -1; Actor_SetScale(&this->actor, 0.01f); - this->actor.targetMode = 1; + this->actor.targetMode = TARGET_MODE_1; this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_2B0 == 2) { @@ -290,11 +290,11 @@ void func_80AECA3C(EnTk* this, PlayState* play) { void func_80AECA90(EnTk* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; func_80AEDE10(this, play); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } } @@ -317,14 +317,14 @@ void func_80AECB6C(EnTk* this, PlayState* play) { this->actor.textId = 0; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; func_80AED4F8(this, play); return; } if (R_TIME_SPEED != 0.0f) { - this->skelAnime.playSpeed = (f32)func_800FE620(play) / R_TIME_SPEED; + this->skelAnime.playSpeed = (f32)Environment_GetTimeSpeed(play) / R_TIME_SPEED; } else { this->skelAnime.playSpeed = 0.0f; } @@ -358,9 +358,9 @@ void func_80AECB6C(EnTk* this, PlayState* play) { if (!temp4 && (this->unk_3CC != 0)) { this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else if (temp4 && (this->unk_3CC == 0)) { - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnTk_Draw; } @@ -368,7 +368,7 @@ void func_80AECB6C(EnTk* this, PlayState* play) { func_80AECE0C(this, play); if (this->unk_3CE & 8) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.draw = NULL; } } @@ -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, PLAYER_IA_NONE, 0x4000, 0x4000); + SubS_OfferTalkExchangeFacing(&this->actor, play, 100.0f, 100.0f, PLAYER_IA_NONE, 0x4000, 0x4000); } return false; @@ -562,7 +562,7 @@ void func_80AED610(EnTk* this, PlayState* play) { Message_StartTextbox(play, 0x13FD, &this->actor); } else if (CURRENT_DAY != 2) { func_80AED544(this, play); - } else if (!Flags_GetSwitch(play, ENTK_GET_7F0(&this->actor))) { + } else if (!Flags_GetSwitch(play, ENTK_GET_SWITCH_FLAG(&this->actor))) { Message_StartTextbox(play, 0x1403, &this->actor); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_02)) { func_80AED544(this, play); @@ -691,15 +691,16 @@ void func_80AED940(EnTk* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2CA &= ~0x80; this->actor.flags &= ~ACTOR_FLAG_10000; - play->msgCtx.msgMode = 0; + play->msgCtx.msgMode = MSGMODE_NONE; play->msgCtx.msgLength = 0; 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, PLAYER_IA_NONE, 0x4000, 0x4000); + SubS_OfferTalkExchangeFacing(&this->actor, play, 100.0f, 100.0f, PLAYER_IA_NONE, 0x4000, 0x4000); } } else { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + PLAYER_IA_NONE); } } @@ -846,10 +847,10 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { case 0x1407: if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x1409); } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1408); } break; @@ -872,11 +873,11 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { case 0x140D: this->unk_2CA |= 2; if (play->msgCtx.choiceIndex == 0) { - func_8019F208(); - play->msgCtx.msgMode = 0x44; + Audio_PlaySfx_MessageDecide(); + play->msgCtx.msgMode = MSGMODE_PAUSED; func_80AEE2A8(this, play); } else { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x140E); } break; @@ -1073,7 +1074,7 @@ s32 func_80AEEA4C(EnTk* this, PlayState* play) { ret = 3; } else if (this->actor.xyzDistToPlayerSq < SQ(60.0f)) { ret = 0; - } else if (this->actor.isTargeted || (play->actorCtx.targetContext.unk_94 == &this->actor) || + } else if (this->actor.isLockedOn || (play->actorCtx.targetCtx.arrowPointedActor == &this->actor) || (this->actor.xyzDistToPlayerSq < SQ(80.0f))) { ret = 1; } else { @@ -1323,7 +1324,7 @@ void EnTk_Update(Actor* thisx, PlayState* play) { if (!(this->unk_2CA & 0x200)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_800B9010(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index aa15c6fc6..46e9b0b96 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -9,7 +9,7 @@ typedef void (*EnTkActionFunc)(struct EnTk*, PlayState*); typedef void (*EnTkUnkFunc)(struct EnTk*, PlayState*); #define ENTK_GET_F(thisx) ((thisx)->params & 0xF) -#define ENTK_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) +#define ENTK_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 4) & 0x7F) #define ENTK_GET_PATH_INDEX(thisx) (((thisx)->params >> 0xB) & 0x1F) typedef struct EnTk { @@ -20,7 +20,7 @@ typedef struct EnTk { /* 0x1D8 */ Vec3s jointTable[18]; /* 0x244 */ Vec3s morphTable[18]; /* 0x2B0 */ s8 unk_2B0; - /* 0x2B1 */ s8 unk_2B1; + /* 0x2B1 */ s8 switchFlag; /* 0x2B4 */ Vec3f unk_2B4; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; 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 2177742dc..12aaa808f 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -7,7 +7,7 @@ #include "z_en_toto.h" #include "objects/object_zm/object_zm.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnToto*)thisx) @@ -89,7 +89,7 @@ static EnTotoActionFunc D_80BA501C[] = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 1, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_STOP), }; static EnTotoText D_80BA502C[] = { @@ -151,7 +151,12 @@ static Vec3s D_80BA510C[] = { { 0xFF64, 0x0016, 0xFE7E }, }; -static u16 D_80BA5120[] = { 67, 68, 69, 70 }; +static u16 sOcarinaActionWindFishPrompts[] = { + OCARINA_ACTION_PROMPT_WIND_FISH_HUMAN, + OCARINA_ACTION_PROMPT_WIND_FISH_GORON, + OCARINA_ACTION_PROMPT_WIND_FISH_ZORA, + OCARINA_ACTION_PROMPT_WIND_FISH_DEKU, +}; static u8 D_80BA5128[] = { 8, 4, 2, 1 }; @@ -243,9 +248,9 @@ void func_80BA39C8(EnToto* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80BA36C0(this, play, 1); if (play->sceneId != SCENE_SONCHONOIE) { - Flags_SetSwitch(play, this->actor.params & 0x7F); + Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor)); } else if (player->transformation == PLAYER_FORM_DEKU) { - Flags_SetSwitch(play, this->actor.home.rot.x); + Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_3(&this->actor)); } this->unk2B6 = 0; return; @@ -257,13 +262,13 @@ 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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 9999.9f, 9999.9f, PLAYER_IA_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 50.0f); + Actor_OfferTalk(&this->actor, play, 50.0f); if (play->sceneId == SCENE_SONCHONOIE) { if (player->transformation == PLAYER_FORM_DEKU) { - if (!Flags_GetSwitch(play, this->actor.home.rot.x)) { + if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_3(&this->actor))) { this->text = D_80BA5068; } else { this->text = D_80BA5074; @@ -273,7 +278,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } } else if (ENTOTO_WEEK_EVENT_FLAGS) { this->text = D_80BA502C; - } else if (!Flags_GetSwitch(play, this->actor.params & 0x7F)) { + } else if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor))) { this->text = D_80BA5034; } else { this->text = D_80BA5038; @@ -332,7 +337,7 @@ void func_80BA3DBC(EnToto* this, PlayState* play) { } } else { player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_400) && player->unk_AE7 != 0) { + if ((player->stateFlags1 & PLAYER_STATE1_400) && (player->actionVar1 != 0)) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_CIRCUS_LEADERS_MASK); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_TOTO); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_GORMAN); @@ -423,9 +428,9 @@ s32 func_80BA4128(EnToto* this, PlayState* play) { s32 func_80BA415C(EnToto* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { - func_8019F230(); + Audio_PlaySfx_MessageCancel(); } else { - func_8019F208(); + Audio_PlaySfx_MessageDecide(); } return ((play->msgCtx.choiceIndex != 0) ? 0 : this->text->unk1) + 1; } @@ -542,22 +547,22 @@ s32 func_80BA4530(EnToto* this, PlayState* play) { s32 func_80BA46D8(EnToto* this, PlayState* play) { func_800B7298(play, NULL, PLAYER_CSMODE_68); - func_80152434(play, D_80BA5120[CUR_FORM]); + Message_DisplayOcarinaStaff(play, sOcarinaActionWindFishPrompts[CUR_FORM]); return 0; } s32 func_80BA4740(EnToto* this, PlayState* play) { - if (play->msgCtx.ocarinaMode == 4) { - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { SET_WEEKEVENTREG(WEEKEVENTREG_56_10); } - if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if (GET_PLAYER_FORM == PLAYER_FORM_DEKU) { SET_WEEKEVENTREG(WEEKEVENTREG_56_20); } - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { SET_WEEKEVENTREG(WEEKEVENTREG_56_40); } - if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { + if (GET_PLAYER_FORM == PLAYER_FORM_GORON) { SET_WEEKEVENTREG(WEEKEVENTREG_56_80); } return 1; @@ -583,7 +588,7 @@ s32 func_80BA47E0(EnToto* this, PlayState* play) { this->unk2B3 += 8; } for (i = 0; i < ARRAY_COUNT(D_80BA50DC); i++) { - if ((gSaveContext.save.playerForm != (i + 1)) && (D_80BA5128[i] & this->unk2B3)) { + if ((GET_PLAYER_FORM != (i + 1)) && (D_80BA5128[i] & this->unk2B3)) { Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); Actor_Spawn(&play->actorCtx, play, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, @@ -641,15 +646,15 @@ s32 func_80BA4B24(EnToto* this, PlayState* play) { player = GET_PLAYER(play); Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_0028B8, -4.0f); if (player->transformation == PLAYER_FORM_ZORA) { - if (!Flags_GetSwitch(play, this->actor.params & 0x7F)) { - Flags_SetSwitch(play, this->actor.params & 0x7F); + if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor))) { + Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_1(&this->actor)); return 1; } else { return 3; } } else { - if (!Flags_GetSwitch(play, (this->actor.params >> 7) & 0x7F)) { - Flags_SetSwitch(play, (this->actor.params >> 7) & 0x7F); + if (!Flags_GetSwitch(play, ENTOTO_GET_SWITCH_FLAG_2(&this->actor))) { + Flags_SetSwitch(play, ENTOTO_GET_SWITCH_FLAG_2(&this->actor)); return 4; } else { return 7; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h index dc2b0947e..7a742d84a 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h @@ -8,6 +8,10 @@ struct EnToto; typedef void (*EnTotoActionFunc)(struct EnToto*, PlayState*); typedef s32 (*EnTotoUnkFunc)(struct EnToto*, PlayState*); +#define ENTOTO_GET_SWITCH_FLAG_1(thisx) ((thisx)->params & 0x7F) +#define ENTOTO_GET_SWITCH_FLAG_2(thisx) (((thisx)->params >> 7) & 0x7F) +#define ENTOTO_GET_SWITCH_FLAG_3(thisx) ((thisx)->home.rot.x) + typedef struct EnTotoText { /* 0x0 */ u8 unk0; /* 0x1 */ u8 unk1; 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 ee9c5aaae..499a3a748 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -8,13 +8,13 @@ #include "objects/object_trt/object_trt.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnTrt*)thisx) #define ENTRT_FULLY_AWAKE (1 << 0) #define ENTRT_GIVEN_MUSHROOM (1 << 1) -#define ENTRT_MET (1 << 2) +#define ENTRT_TALKED (1 << 2) void EnTrt_Init(Actor* thisx, PlayState* play); void EnTrt_Destroy(Actor* thisx, PlayState* play); @@ -126,7 +126,7 @@ void EnTrt_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 a s32 EnTrt_TestItemSelected(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { + if ((msgCtx->textboxEndType == TEXTBOX_ENDTYPE_10) || (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_11)) { return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || @@ -202,7 +202,7 @@ u16 EnTrt_GetItemTextId(EnTrt* this) { u16 EnTrt_GetItemChoiceTextId(EnTrt* this) { EnGirlA* item = this->items[this->cursorIndex]; - if ((item->actor.params == SI_POTION_BLUE) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_53_10)) { + if ((item->actor.params == SI_POTION_BLUE) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_FREE_BLUE_POTION)) { this->textId = 0x881; return 0x881; } @@ -217,7 +217,7 @@ void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; @@ -326,7 +326,7 @@ void EnTrt_Hello(EnTrt* this, PlayState* play) { } } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play_sound(NA_SE_SY_MESSAGE_PASS); + Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS); if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { EnTrt_StartShopping(play, this); } @@ -348,7 +348,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { case 0x883: this->textId = 0x884; Message_StartTextbox(play, this->textId, &this->actor); - SET_WEEKEVENTREG(WEEKEVENTREG_53_08); + SET_WEEKEVENTREG(WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM); Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); break; @@ -362,7 +362,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_PayForMushroom; break; @@ -407,39 +407,39 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) { void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x88F) { - if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->prevTextId = this->textId; this->textId = 0x88E; - SET_WEEKEVENTREG(WEEKEVENTREG_85_08); + SET_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_SHOP); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { this->textId = 0x83D; EnTrt_SetupStartShopping(play, this, 0); - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME)) { this->textId = 0x83B; if (Inventory_HasItemInBottle(ITEM_POTION_RED)) { EnTrt_SetupStartShopping(play, this, false); } else { this->actionFunc = EnTrt_TryToGiveRedPotion; } - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { this->timer = 30; this->textId = 0x838; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; this->actionFunc = EnTrt_Surprised; return; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_KIOSK_EMPTY)) { this->textId = 0x835; EnTrt_SetupStartShopping(play, this, false); } @@ -453,13 +453,13 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { - SET_WEEKEVENTREG(WEEKEVENTREG_12_10); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE); } - SET_WEEKEVENTREG(WEEKEVENTREG_84_40); + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME); player->stateFlags2 &= ~PLAYER_STATE2_20000000; this->actionFunc = EnTrt_GivenRedPotionForKoume; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { Actor_OfferGetItem(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); @@ -486,7 +486,7 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { CutsceneManager_Queue(this->csId); } } - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = EnTrt_ItemGiven; } } @@ -508,12 +508,12 @@ void EnTrt_EndConversation(EnTrt* this, PlayState* play) { s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); EnTrt_SetupTalkToShopkeeper(play, this); return true; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnTrt_EndInteraction(play, this); return true; @@ -552,7 +552,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { this->actionFunc = EnTrt_LookToShelf; func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = false; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -616,13 +616,13 @@ s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) { if ((item->actor.params != SI_POTION_BLUE) || (this->flags & ENTRT_GIVEN_MUSHROOM)) { this->prevActionFunc = this->actionFunc; Message_ContinueTextbox(play, EnTrt_GetItemChoiceTextId(this)); - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; this->drawCursor = 0; this->actionFunc = EnTrt_SelectItem; } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } return true; } @@ -649,7 +649,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { EnTrt_CursorLeftRight(play, this); if (this->cursorIndex != prevCursorIdx) { Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -660,7 +660,7 @@ void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { Player* player = GET_PLAYER(play); Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); @@ -688,7 +688,7 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item2 = this->items[this->cursorIndex]; item2->buyFanfareFunc(play, item2); EnTrt_SetupBuyItemWithFanfare(play, this); @@ -698,7 +698,7 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) { break; case CANBUY_RESULT_SUCCESS_2: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); item->buyFunc(play, item); EnTrt_SetupCanBuy(play, this, 0x848); this->drawCursor = 0; @@ -707,22 +707,22 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) { break; case CANBUY_RESULT_NO_ROOM: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x641); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x846); break; case CANBUY_RESULT_NEED_RUPEES: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x847); break; case CANBUY_RESULT_CANNOT_GET_NOW: - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x643); break; @@ -745,7 +745,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); this->actionFunc = this->prevActionFunc; Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); break; @@ -756,7 +756,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { } } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (!Inventory_HasEmptyBottle()) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x846); } else { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { @@ -767,7 +767,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item->boughtFunc(play, item); - SET_WEEKEVENTREG(WEEKEVENTREG_53_10); + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_FREE_BLUE_POTION); } } } @@ -776,14 +776,15 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_SHOP) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME)) { this->textId = 0x88F; - } else if (!(this->flags & ENTRT_MET)) { + } else if (!(this->flags & ENTRT_TALKED)) { this->textId = 0x834; } else { this->textId = 0x83E; } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM)) { this->talkOptionTextId = 0x845; } else if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->talkOptionTextId = 0x882; @@ -801,7 +802,7 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (player->transformation == PLAYER_FORM_HUMAN) { - this->flags |= ENTRT_MET; + this->flags |= ENTRT_TALKED; } if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { @@ -816,7 +817,7 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { this->actionFunc = EnTrt_BeginInteraction; } else if (((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= -25.0f)) && ((player->actor.world.pos.z >= -19.0f) && (player->actor.world.pos.z <= 30.0f))) { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } if (DECR(this->timer) == 0) { this->timer = 40; @@ -826,7 +827,7 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_OpenThenCloseEyes; } if (DECR(this->sleepSoundTimer) == 0) { - func_800B9010(&this->actor, NA_SE_EN_KOTAKE_SLEEP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KOTAKE_SLEEP - SFX_FLAG); } } @@ -854,7 +855,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { } player->stateFlags2 |= PLAYER_STATE2_20000000; if (player->transformation == PLAYER_FORM_HUMAN) { - this->flags |= ENTRT_MET; + this->flags |= ENTRT_TALKED; } EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SLEEPING); this->blinkFunc = EnTrt_EyesClosed; @@ -862,7 +863,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { this->actionFunc = EnTrt_BeginInteraction; } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) && (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(150, 100); @@ -908,8 +909,10 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { this->animIndex = TRT_ANIM_HANDS_ON_COUNTER; switch (this->textId) { case 0x834: - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_KIOSK_EMPTY)) { func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -972,7 +975,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_Blink; if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -981,7 +984,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { } else { this->prevTextId = this->textId; this->textId = 0x88E; - SET_WEEKEVENTREG(WEEKEVENTREG_85_08); + SET_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_SHOP); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -996,13 +999,13 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->prevTextId = this->textId; this->textId = 0x88E; - SET_WEEKEVENTREG(WEEKEVENTREG_85_08); + SET_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_SHOP); Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } @@ -1055,7 +1058,7 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { } Message_ContinueTextbox(play, this->textId); } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1074,7 +1077,7 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { } else { if ((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= 50.0f) && (player->actor.world.pos.z >= -19.0f) && (player->actor.world.pos.z <= 30.0f)) { - func_800B8614(&this->actor, play, 200.0f); + Actor_OfferTalk(&this->actor, play, 200.0f); } } if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { @@ -1128,7 +1131,7 @@ void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play) { this->csId = this->lookToShopkeeperCsId; CutsceneManager_Queue(this->csId); } - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1146,17 +1149,17 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y); player->stateFlags2 |= PLAYER_STATE2_20000000; Message_StartTextbox(play, this->textId, &this->actor); EnTrt_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); break; case 1: default: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); EnTrt_EndInteraction(play, this); break; } @@ -1419,13 +1422,13 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { itemAction = func_80123810(play); if (itemAction > PLAYER_IA_NONE) { if (itemAction == PLAYER_IA_BOTTLE_MUSHROOM) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM)) { player->actor.textId = 0x888; } else { player->actor.textId = 0x883; } this->textId = player->actor.textId; - player->exchangeItemId = itemAction; + player->exchangeItemAction = itemAction; this->actionFunc = EnTrt_GetMushroom; } else { if (this->flags & ENTRT_GIVEN_MUSHROOM) { @@ -1458,7 +1461,7 @@ void EnTrt_SetupTalkToShopkeeper(PlayState* play, EnTrt* this) { } void EnTrt_SetupLookToShopkeeperFromShelf(PlayState* play, EnTrt* this) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); this->drawCursor = 0; this->actionFunc = EnTrt_LookToShopkeeperFromShelf; } @@ -1488,8 +1491,8 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) { void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeSleepingAnim, NULL, NULL, 0); - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && - (gSaveContext.save.day >= 2)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME) && (gSaveContext.save.day >= 2)) { this->actor.draw = NULL; } else { this->actor.draw = EnTrt_Draw; @@ -1504,8 +1507,8 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->timer = Rand_S16Offset(40, 20); - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40) && - gSaveContext.save.day >= 2) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME) && gSaveContext.save.day >= 2) { this->textId = 0x84A; this->actionFunc = EnTrt_ShopkeeperGone; } else { @@ -1570,11 +1573,11 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) { this->blinkTimer = 20; this->eyeTexIndex = 0; this->blinkFunc = EnTrt_EyesClosed; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM)) { this->flags |= ENTRT_GIVEN_MUSHROOM; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void EnTrt_GetCutscenes(EnTrt* this, PlayState* play) { 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 29560fdce..8bc8e2541 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -7,7 +7,7 @@ #include "z_en_trt2.h" #include "objects/object_trt/object_trt.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnTrt2*)thisx) @@ -144,13 +144,14 @@ void func_80AD341C(EnTrt2* this, PlayState* play) { } void func_80AD349C(EnTrt2* this) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_WOODS) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME)) { this->unk_3A8 = 0x88F; } else if (this->unk_3A8 == 0) { this->unk_3A8 = 0x84B; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { this->unk_3A8 = 0x838; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_17_01)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_KIOSK_EMPTY)) { this->unk_3A8 = 0x84D; } else { this->unk_3A8 = 0x849; @@ -200,7 +201,7 @@ void func_80AD3664(EnTrt2* this, PlayState* play) { CutsceneManager_Queue(this->csId); return; } - func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); } void func_80AD36EC(EnTrt2* this, PlayState* play) { @@ -227,7 +228,7 @@ void func_80AD36EC(EnTrt2* this, PlayState* play) { } } Actor_MoveWithGravity(&this->actor); - func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); if ((this->actor.shape.rot.y >= 0x2800) && (this->actor.shape.rot.y < 0x3800)) { Actor_PlaySfx(&this->actor, NA_SE_EN_KOTAKE_ROLL); } @@ -239,7 +240,7 @@ void func_80AD381C(EnTrt2* this, PlayState* play) { this->actor.world.pos.y -= 50.0f; this->unk_3D9 = 0; this->unk_3B2 = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; } } else { @@ -281,7 +282,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { } Actor_MoveWithoutGravity(&this->actor); - func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); } void func_80AD3A24(EnTrt2* this, PlayState* play) { @@ -346,7 +347,7 @@ void func_80AD3CEC(EnTrt2* this, PlayState* play) { Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3D8 = false; } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER); this->unk_3B2 = 4; @@ -374,11 +375,11 @@ void func_80AD3DA4(EnTrt2* this, PlayState* play) { void func_80AD3E34(EnTrt2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_3B2 = 12; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_85_10); + SET_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_WOODS); this->unk_3A8 = 0x88E; Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; @@ -391,18 +392,18 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play)) { - if ((Inventory_HasEmptyBottle() && !CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) || - !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + if ((Inventory_HasEmptyBottle() && !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME)) || + !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { this->unk_3B2 = 12; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_85_10); + SET_WEEKEVENTREG(WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_WOODS); this->unk_3A8 = 0x88E; Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; } } } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; this->unk_3B2 = 12; } @@ -410,13 +411,13 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { void func_80AD3FF4(EnTrt2* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { - SET_WEEKEVENTREG(WEEKEVENTREG_12_10); + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE); } - SET_WEEKEVENTREG(WEEKEVENTREG_84_40); + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME); this->actor.parent = NULL; this->unk_3B2 = 14; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE)) { Actor_OfferGetItem(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { Actor_OfferGetItem(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); @@ -425,7 +426,7 @@ void func_80AD3FF4(EnTrt2* this, PlayState* play) { void func_80AD40AC(EnTrt2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->unk_3B2 = 13; } } @@ -436,7 +437,7 @@ void func_80AD4110(EnTrt2* this, PlayState* play) { Message_ContinueTextbox(play, this->unk_3A8); this->unk_3B2 = 10; } else { - func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -446,7 +447,7 @@ void func_80AD417C(EnTrt2* this, PlayState* play) { func_80AD349C(this); func_80AD3DA4(this, play); } else { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; if (this->unk_3A8 == 0x84C) { EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER); @@ -505,7 +506,7 @@ void func_80AD434C(EnTrt2* this, PlayState* play) { func_800B3030(play, &sp68, &sp5C, &sp5C, 100, 0, 3); } - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } } else if (this->actor.world.pos.y < 5.0f) { func_80AD4A78(this, play); @@ -528,7 +529,7 @@ void func_80AD4550(EnTrt2* this, PlayState* play) { } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; } } @@ -700,7 +701,7 @@ s32 func_80AD4CCC(EnTrt2* this, PlayState* play) { s16 sp1E = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Player* player = GET_PLAYER(play); - if (((this->unk_3B2 == 4) || (this->unk_3B2 == 5)) && this->actor.isTargeted && + if (((this->unk_3B2 == 4) || (this->unk_3B2 == 5)) && this->actor.isLockedOn && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY))) { this->actor.speed = 0.0f; @@ -709,8 +710,8 @@ s32 func_80AD4CCC(EnTrt2* this, PlayState* play) { return true; } - if (func_80AD4C4C(this) && this->actor.isTargeted && (sp1E < 0x4000) && (sp1E > -0x4000)) { - func_800B863C(&this->actor, play); + if (func_80AD4C4C(this) && this->actor.isLockedOn && (sp1E < 0x4000) && (sp1E > -0x4000)) { + Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } return true; @@ -743,12 +744,12 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { this->unk_3B8 = 0; this->unk_3BC = func_80AD4608; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { Actor_Kill(&this->actor); return; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME)) { Actor_Kill(&this->actor); return; } @@ -800,7 +801,7 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play) { } static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_3, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; 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 895d1d406..a5938d4cf 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -7,7 +7,7 @@ #include "z_en_tru.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTru*)thisx) @@ -670,11 +670,11 @@ UNK_TYPE* func_80A871E0(EnTru* this, PlayState* play) { return D_80A88924; } - if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { return D_80A88918; } - if ((this->unk_34E & 0x1000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if ((this->unk_34E & 0x1000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { return D_80A88910; } @@ -685,29 +685,28 @@ s32 func_80A872AC(EnTru* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 ret = false; - if (this->unk_34E & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (player->transformation == PLAYER_FORM_HUMAN) { - this->unk_34E &= ~0x80; - } - this->unk_34E &= ~(0x4000 | 0x2000); - - if ((player->exchangeItemId == PLAYER_IA_BOTTLE_POTION_RED) || - (player->exchangeItemId == PLAYER_IA_BOTTLE_POTION_BLUE)) { - this->unk_34E |= 0x2000; - this->unk_38C = player->exchangeItemId; - } else if (player->exchangeItemId != PLAYER_IA_NONE) { - this->unk_34E |= 0x4000; - } - - this->unk_378 = func_80A875AC; - this->unk_390 = 0; - this->unk_364 = 0; - this->unk_354 = func_80A871E0(this, play); - SubS_UpdateFlags(&this->unk_34E, 0, 7); - this->actionFunc = func_80A881E0; - ret = true; + if (((this->unk_34E & SUBS_OFFER_MODE_MASK) != SUBS_OFFER_MODE_NONE) && + Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_34E &= ~0x80; } + this->unk_34E &= ~(0x4000 | 0x2000); + + if ((player->exchangeItemAction == PLAYER_IA_BOTTLE_POTION_RED) || + (player->exchangeItemAction == PLAYER_IA_BOTTLE_POTION_BLUE)) { + this->unk_34E |= 0x2000; + this->unk_38C = player->exchangeItemAction; + } else if (player->exchangeItemAction != PLAYER_IA_NONE) { + this->unk_34E |= 0x4000; + } + + this->unk_378 = func_80A875AC; + this->unk_390 = 0; + this->unk_364 = 0; + this->unk_354 = func_80A871E0(this, play); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); + this->actionFunc = func_80A881E0; + ret = true; } return ret; @@ -770,7 +769,7 @@ s32 func_80A875AC(Actor* thisx, PlayState* play) { switch (this->unk_364) { case 0: - if ((this->unk_34E & 0x40) || CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if ((this->unk_34E & 0x40) || CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { this->csId = this->actor.csId; this->unk_364++; } else { @@ -973,8 +972,8 @@ s32 func_80A87B48(Actor* thisx, PlayState* play) { this->actor.shape.shadowDraw = NULL; this->unk_34E |= (0x200 | 0x8); this->unk_34E &= ~0x800; - if (player->exchangeItemId != PLAYER_IA_NONE) { - player->exchangeItemId = PLAYER_IA_NONE; + if (player->exchangeItemAction != PLAYER_IA_NONE) { + player->exchangeItemAction = PLAYER_IA_NONE; } EnTru_ChangeAnim(this, KOUME_ANIM_HOVER1); } @@ -1041,13 +1040,13 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { case 4: if (func_80A87400(this, play) || (DECR(this->unk_362) == 0)) { ret = true; - SET_WEEKEVENTREG(WEEKEVENTREG_12_08); + SET_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME); } break; } if (ret == true) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.draw = NULL; this->unk_378 = NULL; this->unk_34E = 0; @@ -1058,17 +1057,17 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { void func_80A87FD0(EnTru* this, PlayState* play) { if (this->actor.draw != NULL) { - if ((this->unk_34E & 0x80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if ((this->unk_34E & 0x80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { if (func_80A873B8(this)) { - SubS_UpdateFlags(&this->unk_34E, 3, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->unk_34E, 0, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } } else if (this->unk_34E & 0x40) { if (func_80A873B8(this)) { - SubS_UpdateFlags(&this->unk_34E, 3, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->unk_34E, 0, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } if ((this->animIndex == KOUME_ANIM_TRY_GET_UP) && @@ -1081,15 +1080,15 @@ void func_80A87FD0(EnTru* this, PlayState* play) { EnTru_ChangeAnim(this, KOUME_ANIM_TRY_GET_UP); } } - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && - (this->actor.xzDistToPlayer < 140.0f)) { - SubS_UpdateFlags(&this->unk_34E, 4, 7); + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED) && + (fabsf(this->actor.playerHeightRel) < 10.0f) && (this->actor.xzDistToPlayer < 140.0f)) { + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_AUTO, SUBS_OFFER_MODE_MASK); this->unk_34E |= 0x1040; this->unk_362 = Rand_S16Offset(40, 20); } else if (func_80A873B8(this)) { - SubS_UpdateFlags(&this->unk_34E, 3, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); } else { - SubS_UpdateFlags(&this->unk_34E, 0, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); } } } @@ -1106,16 +1105,16 @@ void func_80A881E0(EnTru* this, PlayState* play) { CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); } - if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_LYING_DOWN); } else if (this->unk_34E & 0x80) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_LYING_DOWN); func_80A86460(this); - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_HEAD_UP_MORPH); } - SubS_UpdateFlags(&this->unk_34E, 0, 7); + SubS_SetOfferMode(&this->unk_34E, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_34E &= ~(0x1000 | 0x8); this->unk_34E |= 0x10; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -1128,7 +1127,7 @@ void func_80A881E0(EnTru* this, PlayState* play) { void EnTru_Init(Actor* thisx, PlayState* play) { EnTru* this = THIS; - if ((gSaveContext.save.entrance != ENTRANCE(WOODS_OF_MYSTERY, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) { + if ((gSaveContext.save.entrance != ENTRANCE(WOODS_OF_MYSTERY, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_SAVED_KOUME)) { Actor_Kill(&this->actor); return; } @@ -1145,11 +1144,11 @@ void EnTru_Init(Actor* thisx, PlayState* play) { this->unk_384 = 1; } - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.008f); this->unk_34E = 0; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_KOUME_INJURED)) { EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_HEAD_UP); } else { this->unk_388 = PLAYER_IA_NONE; @@ -1180,7 +1179,7 @@ void EnTru_Update(Actor* thisx, PlayState* play) { radius = this->collider.dim.worldSphere.radius + 30; this->unk_388 = !(this->unk_34E & 0x80) ? PLAYER_IA_NONE : PLAYER_IA_NONE; - func_8013C964(&this->actor, play, radius, 20.0f, this->unk_388, this->unk_34E & 7); + SubS_Offer(&this->actor, play, radius, 20.0f, this->unk_388, this->unk_34E & SUBS_OFFER_MODE_MASK); func_80A8697C(this, play); func_80A86384(this->unk_394, &this->unk_1F8); } 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 f877a26a8..8ca8857db 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 @@ -7,7 +7,7 @@ #include "z_en_tru_mt.h" #include "overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnTruMt*)thisx) @@ -350,11 +350,8 @@ void func_80B76980(EnTruMt* this, PlayState* play) { this->actor.speed = 0.0f; this->actionFunc = func_80B76BB8; } else if (CHECK_EVENTINF(EVENTINF_40)) { - u32 score = gSaveContext.minigameScore; - - if (((gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF0000) >> 0x10) < score) { - gSaveContext.save.saveInfo.unk_EC4 = - ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF); + if (((void)0, gSaveContext.minigameScore) > HS_GET_BOAT_ARCHERY_HIGH_SCORE()) { + HS_SET_BOAT_ARCHERY_HIGH_SCORE((u32)((void)0, gSaveContext.minigameScore)); SET_EVENTINF(EVENTINF_37); } } @@ -432,7 +429,7 @@ void EnTruMt_Init(Actor* thisx, PlayState* play) { this->collider.dim.worldSphere.radius = 22; this->actor.colChkInfo.damageTable = &sDamageTable; this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FF(&this->actor), ENTRUMT_PATH_INDEX_NONE); - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.008f); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); 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 a404ac817..f95b1a8e8 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -8,7 +8,7 @@ #include "z64snap.h" #include "objects/object_tsn/object_tsn.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnTsn*)thisx) @@ -83,7 +83,7 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { this->actor.update = func_80AE0F84; this->actor.destroy = NULL; this->actor.draw = NULL; - this->actor.targetMode = 7; + this->actor.targetMode = TARGET_MODE_7; switch (ENTSN_GET_F(&this->actor)) { case ENTSN_F_0: @@ -160,7 +160,7 @@ void func_80ADFF84(EnTsn* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { textId = 0x107E; - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_80)) { textId = 0x1083; } else { @@ -275,7 +275,7 @@ void func_80AE0304(EnTsn* this, PlayState* play) { func_80ADFF84(this, play); } } else if ((this->actor.xzDistToPlayer < 150.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 160.0f); + Actor_OfferTalk(&this->actor, play, 160.0f); this->unk_220 |= 1; } else { this->unk_220 &= ~1; @@ -324,7 +324,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { if (itemAction > PLAYER_IA_NONE) { Message_CloseTextbox(play); this->actionFunc = func_80AE0704; - if (itemAction == PLAYER_IA_PICTO_BOX) { + if (itemAction == PLAYER_IA_PICTOGRAPH_BOX) { if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { if (Snap_CheckFlag(PICTO_VALID_PIRATE_GOOD)) { player->actor.textId = 0x107B; @@ -420,7 +420,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x1075: case 0x1078: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; @@ -448,7 +448,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { break; case 0x107B: - player->exchangeItemId = PLAYER_IA_NONE; + player->exchangeItemAction = PLAYER_IA_NONE; Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; @@ -536,8 +536,8 @@ void func_80AE0C88(EnTsn* this, PlayState* play) { this->unk_220 |= 4; ENTSN_SET_Z(&this->unk_1D8->actor, true); } - } else if (this->actor.isTargeted) { - func_800B8614(&this->actor, play, 1000.0f); + } else if (this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 1000.0f); } } @@ -553,8 +553,8 @@ void func_80AE0D78(EnTsn* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80AE0D10; this->unk_220 |= 4; - } else if (this->actor.isTargeted) { - func_800B8614(&this->actor, play, 1000.0f); + } else if (this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 1000.0f); } } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 340618db7..cc1df3cdb 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -236,7 +236,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, PlayState* play) { if ((startingRotation == 0) || (this->actor.playerHeightRel <= (startingRotation * 10.0f))) { func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); currentHeight = this->actor.world.pos.y; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_10); // always update and can target + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10); // always update and can target transformationHeight = sTransformationHeight[player->transformation]; @@ -253,7 +253,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, PlayState* play) { } void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play) { - this->actor.shape.rot.y += 5000; + this->actor.shape.rot.y += 0x1388; Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.8f, 3.0f); if (fabsf(this->actor.world.pos.y - this->targetHeight) < 10.0f) { @@ -279,7 +279,7 @@ void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, -3.0f, 0.2f, 0.5f); } - this->actor.shape.rot.y += 5000; + this->actor.shape.rot.y += 0x1388; EnTuboTrap_HandleImpact(this, play); } diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index b756d0f92..93c494489 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -3,8 +3,6 @@ * Overlay: ovl_En_Twig * Description: Beaver Race Ring */ - -#include "prevent_bss_reordering.h" #include "z_en_twig.h" #include "objects/object_twig/object_twig.h" @@ -125,7 +123,7 @@ void func_80AC0A6C(EnTwig* this, PlayState* play) { void func_80AC0A7C(EnTwig* this, PlayState* play) { Player* player = GET_PLAYER(play); - Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]); + Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); this->unk_178 = 0; this->unk_17A = 0; this->actionFunc = func_80AC0AC8; @@ -148,7 +146,7 @@ void func_80AC0AC8(EnTwig* this, PlayState* play) { SubS_ConstructPlane(&this->dyna.actor.world.pos, &D_80AC10D0, &this->dyna.actor.shape.rot, &sp4C); if ((sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) && Math3D_LineSegVsPlane(sp4C.normal.x, sp4C.normal.y, sp4C.normal.z, sp4C.originDist, &this->unk_180, - &player->bodyPartsPos[0], &sp40, 0)) { + &player->bodyPartsPos[PLAYER_BODYPART_WAIST], &sp40, 0)) { if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &sp40) <= SQ(this->dyna.actor.scale.x * 0.345f * 40.0f)) { func_80AC0CC4(this, play); return; @@ -164,7 +162,7 @@ void func_80AC0AC8(EnTwig* this, PlayState* play) { this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer; } } - Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]); + Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); } void func_80AC0CC4(EnTwig* this, PlayState* play) { @@ -182,9 +180,12 @@ void func_80AC0D2C(EnTwig* this, PlayState* play) { static Color_RGBA8 sColorYellow = { 255, 255, 0, 0 }; Player* player = GET_PLAYER(play); - Math_SmoothStepToF(&this->dyna.actor.world.pos.x, player->bodyPartsPos[0].x, 0.5f, 100.0f, 0.01f); - Math_SmoothStepToF(&this->dyna.actor.world.pos.y, player->bodyPartsPos[0].y, 0.5f, 100.0f, 0.01f); - Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[0].z, 0.5f, 100.0f, 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.x, player->bodyPartsPos[PLAYER_BODYPART_WAIST].x, 0.5f, 100.0f, + 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.y, player->bodyPartsPos[PLAYER_BODYPART_WAIST].y, 0.5f, 100.0f, + 0.01f); + Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[PLAYER_BODYPART_WAIST].z, 0.5f, 100.0f, + 0.01f); this->dyna.actor.shape.rot.z += (s16)this->unk_170; this->dyna.actor.scale.x -= this->unk_174; if (this->dyna.actor.scale.x < 0.0f) { @@ -203,7 +204,7 @@ void func_80AC0D2C(EnTwig* this, PlayState* play) { EffectSsKirakira_SpawnDispersed(play, &sp6C, &sKiraVel, &sKiraAccel, &sColorWhite, &sColorYellow, 1000, (s32)(Rand_ZeroOne() * 10.0f) + 20); } - play_sound(NA_SE_SY_GET_ITEM); + Audio_PlaySfx(NA_SE_SY_GET_ITEM); play->interfaceCtx.minigamePoints--; sRingNotCollected[RACERING_GET_PARAM_FE0(&this->dyna.actor)] = true; if (sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) { 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 551d7d774..3221878e3 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -77,7 +77,7 @@ void func_8089F014(EnViewer* this, PlayState* play, f32 arg2) { arg2 = 0.0f; } play->envCtx.lightSettingOverride = 0; - play->envCtx.unk_E0 = 2; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_FULL_CONTROL; play->envCtx.lightSetting = this->actor.world.rot.x; play->envCtx.prevLightSetting = this->actor.world.rot.z; play->envCtx.lightBlend = arg2; @@ -87,11 +87,11 @@ void func_8089F0A0(EnViewer* this, PlayState* play) { Player* player = GET_PLAYER(play); D_8089F3E4++; - if ((D_8089F3E4 == D_8089F3E0) && (play->envCtx.lightSettingOverride != 255)) { - play->envCtx.lightSettingOverride = 255; - play->envCtx.unk_E0 = 0; + if ((D_8089F3E4 == D_8089F3E0) && (play->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE)) { + play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; + play->envCtx.lightBlendOverride = LIGHT_BLEND_OVERRIDE_NONE; play->envCtx.lightBlend = 1.0f; - func_800FAAB4( + Environment_ChangeLightSetting( play, SurfaceType_GetLightSettingIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)); play->envCtx.lightBlend = 1.0f; play->envCtx.prevLightSetting = play->envCtx.lightSetting; diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 2f68391b1..1866a2381 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -9,7 +9,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_vm/object_vm.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_400) #define THIS ((EnVm*)thisx) @@ -167,8 +167,7 @@ void EnVm_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(play, &this->skelAnime, &object_vm_Skel_003F60, &object_vm_Anim_000068, this->jointTable, - this->morphTable, 11); + SkelAnime_Init(play, &this->skelAnime, &gBeamosSkel, &gBeamosAnim, this->jointTable, this->morphTable, 11); Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); Collider_InitAndSetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -199,9 +198,9 @@ void EnVm_Destroy(Actor* thisx, PlayState* play) { } void func_808CC420(EnVm* this) { - f32 lastFrame = Animation_GetLastFrame(&object_vm_Anim_000068); + f32 lastFrame = Animation_GetLastFrame(&gBeamosAnim); - Animation_Change(&this->skelAnime, &object_vm_Anim_000068, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBeamosAnim, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f); this->actionFunc = func_808CC490; } @@ -212,7 +211,7 @@ void func_808CC490(EnVm* this, PlayState* play) { Math_ApproachS(&this->unk_216, 0, 0xA, 0x5DC); this->unk_218 -= 0x1F4; - func_800B9010(&this->actor, NA_SE_EN_BIMOS_ROLL_HEAD - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIMOS_ROLL_HEAD - SFX_FLAG); if (this->actor.xzDistToPlayer <= this->unk_21C) { if ((this->actor.playerHeightRel <= 80.0f) && (this->actor.playerHeightRel >= -160.0f)) { @@ -231,7 +230,7 @@ void func_808CC490(EnVm* this, PlayState* play) { } void func_808CC5C4(EnVm* this) { - Animation_PlayLoopSetSpeed(&this->skelAnime, &object_vm_Anim_000068, 2.0f); + Animation_PlayLoopSetSpeed(&this->skelAnime, &gBeamosAnim, 2.0f); this->unk_214 = 10; this->actionFunc = func_808CC610; } @@ -266,7 +265,7 @@ void func_808CC610(EnVm* this, PlayState* play) { void func_808CC788(EnVm* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_BIMOS_AIM); - Animation_Change(&this->skelAnime, &object_vm_Anim_000068, 3.0f, 3.0f, 7.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBeamosAnim, 3.0f, 3.0f, 7.0f, ANIMMODE_ONCE, 0.0f); this->unk_214 = 305; this->unk_220 = 0.06f; this->colliderTris.base.atFlags &= ~AT_HIT; @@ -322,8 +321,8 @@ void func_808CC820(EnVm* this, PlayState* play) { } void func_808CCA10(EnVm* this) { - Animation_Change(&this->skelAnime, &object_vm_Anim_000068, -1.0f, Animation_GetLastFrame(&object_vm_Anim_000068), - 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBeamosAnim, -1.0f, Animation_GetLastFrame(&gBeamosAnim), 0.0f, ANIMMODE_ONCE, + 0.0f); this->unk_214 = 100; this->unk_210 = 0; this->unk_224 = 0.0f; @@ -343,7 +342,7 @@ void func_808CCAA4(EnVm* this, PlayState* play) { } void func_808CCB08(EnVm* this) { - Animation_PlayOnce(&this->skelAnime, &object_vm_Anim_000068); + Animation_PlayOnce(&this->skelAnime, &gBeamosAnim); this->unk_214 = -1; this->actionFunc = func_808CCB50; } @@ -365,8 +364,8 @@ void func_808CCB50(EnVm* this, PlayState* play) { } void func_808CCBE4(EnVm* this, PlayState* play) { - Animation_Change(&this->skelAnime, &object_vm_Anim_000068, -1.0f, Animation_GetLastFrame(&object_vm_Anim_000068), - 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBeamosAnim, -1.0f, Animation_GetLastFrame(&gBeamosAnim), 0.0f, ANIMMODE_ONCE, + 0.0f); Enemy_StartFinishingBlow(play, &this->actor); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 33); this->unk_214 = 33; @@ -446,7 +445,7 @@ void EnVm_Update(Actor* thisx, PlayState* play) { } if (this->unk_224 > 0.0f) { - func_800B9010(&this->actor, NA_SE_EN_BIMOS_LAZER - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIMOS_LAZER - SFX_FLAG); } this->actionFunc(this, play); @@ -462,10 +461,10 @@ void EnVm_Update(Actor* thisx, PlayState* play) { s32 EnVm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnVm* this = THIS; - if (limbIndex == OBJECT_VM_LIMB_02) { + if (limbIndex == BEAMOS_LIMB_HEAD_ROOT) { rot->x += this->unk_216; rot->y += this->unk_218; - } else if ((limbIndex == OBJECT_VM_LIMB_0A) && (this->actionFunc == func_808CCCF0)) { + } else if ((limbIndex == BEAMOS_LIMB_BODY) && (this->actionFunc == func_808CCCF0)) { *dList = NULL; } return false; @@ -481,7 +480,7 @@ void EnVm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); - if (limbIndex == OBJECT_VM_LIMB_02) { + if (limbIndex == BEAMOS_LIMB_HEAD_ROOT) { sp4C = NULL; Matrix_MultZero(&this->actor.focus.pos); @@ -549,7 +548,7 @@ void EnVm_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(this->unk_220, this->unk_220, this->unk_224 * 0.0015f, MTXMODE_APPLY); gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&gfx[2], object_vm_DL_002728); + gSPDisplayList(&gfx[2], gBeamosLaserDL); POLY_OPA_DISP = &gfx[3]; } 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 f4f89d79e..ca614643f 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -5,10 +5,11 @@ */ #include "z_en_wallmas.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((EnWallmas*)thisx) @@ -128,15 +129,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1500, ICHAIN_STOP), }; -static f32 sYOffsetPerForm[] = { 50.0f, 55.0f, 50.0f, 20.0f, 30.0f }; - -/** - * This maps a given limb based on its limbIndex to its appropriate index - * in the limbPos array. An index of -1 indicates that the limb is not part - * of the limbPos array. - */ -static s8 sLimbIndexToLimbPosIndex[] = { - -1, -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, -1, 3, -1, 4, -1, -1, 5, -1, -1, -1, 6, 7, -1, 8, +static f32 sYOffsetPerForm[PLAYER_FORM_MAX] = { + 50.0f, // PLAYER_FORM_FIERCE_DEITY + 55.0f, // PLAYER_FORM_GORON + 50.0f, // PLAYER_FORM_ZORA + 20.0f, // PLAYER_FORM_DEKU + 30.0f, // PLAYER_FORM_HUMAN }; void EnWallmas_Init(Actor* thisx, PlayState* play) { @@ -200,7 +198,7 @@ void EnWallmas_Destroy(Actor* thisx, PlayState* play) { void EnWallmas_Freeze(EnWallmas* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.55f; - this->drawDmgEffFrozenSteamScale = 0.82500005f; + this->drawDmgEffFrozenSteamScale = 825.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; this->collider.base.colType = 3; this->timer = 80; @@ -213,7 +211,7 @@ void EnWallmas_ThawIfFrozen(EnWallmas* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = 0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, WALLMASTER_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -221,7 +219,7 @@ void EnWallmas_ThawIfFrozen(EnWallmas* this, PlayState* play) { void EnWallmas_TimerInit(EnWallmas* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_20; this->timer = 130; this->actor.velocity.y = 0.0f; @@ -272,7 +270,7 @@ void EnWallmas_SetupDrop(EnWallmas* this, PlayState* play) { this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.floorHeight = player->actor.floorHeight; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.flags &= ~ACTOR_FLAG_20; this->actionFunc = EnWallmas_Drop; } @@ -498,7 +496,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { Math_StepToF(&this->actor.world.pos.z, player->actor.world.pos.z, 3.0f); if (this->timer == 30) { - play_sound(NA_SE_OC_ABYSS); + Audio_PlaySfx(NA_SE_OC_ABYSS); func_80169FDC(&play->state); } } @@ -506,7 +504,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { this->timer = 0; this->actor.draw = NULL; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_PROXIMITY) { this->actionFunc = EnWallmas_WaitForProximity; } else { @@ -565,7 +563,7 @@ void EnWallmas_UpdateDamage(EnWallmas* this, PlayState* play) { if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else if (this->actor.colChkInfo.damage != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_DAMAGE); } @@ -605,7 +603,7 @@ void EnWallmas_UpdateDamage(EnWallmas* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } EnWallmas_SetupDamage(this, true); @@ -650,8 +648,8 @@ void EnWallmas_Update(Actor* thisx, PlayState* play) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.275f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); - } else if (Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f) == 0) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f)) { + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -705,17 +703,49 @@ s32 EnWallmas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } +/** + * This maps a given limb based on its limbIndex to its appropriate index + * in the bodyPartsPos array. + */ +static s8 sLimbToBodyParts[WALLMASTER_LIMB_MAX] = { + BODYPART_NONE, // WALLMASTER_LIMB_NONE + BODYPART_NONE, // WALLMASTER_LIMB_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_HAND + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_ROOT + WALLMASTER_BODYPART_0, // WALLMASTER_LIMB_INDEX_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_INDEX_FINGER_MIDDLE + WALLMASTER_BODYPART_1, // WALLMASTER_LIMB_INDEX_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_ROOT + WALLMASTER_BODYPART_2, // WALLMASTER_LIMB_RING_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_RING_FINGER_MIDDLE + WALLMASTER_BODYPART_3, // WALLMASTER_LIMB_RING_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_ROOT + WALLMASTER_BODYPART_4, // WALLMASTER_LIMB_MIDDLE_FINGER_PROXIMAL + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_MIDDLE_FINGER_MIDDLE + WALLMASTER_BODYPART_5, // WALLMASTER_LIMB_MIDDLE_FINGER_DISTAL + BODYPART_NONE, // WALLMASTER_LIMB_WRIST_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_WRIST + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_ROOT + WALLMASTER_BODYPART_6, // WALLMASTER_LIMB_THUMB_PROXIMAL + WALLMASTER_BODYPART_7, // WALLMASTER_LIMB_THUMB_DISTAL_ROOT + BODYPART_NONE, // WALLMASTER_LIMB_THUMB_MIDDLE + WALLMASTER_BODYPART_8, // WALLMASTER_LIMB_THUMB_DISTAL +}; + void EnWallmas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnWallmas* this = THIS; Gfx* gfx; - if (sLimbIndexToLimbPosIndex[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[sLimbIndexToLimbPosIndex[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WALLMASTER_LIMB_WRIST) { - Matrix_MultVecX(1000.0f, &this->limbPos[9]); - Matrix_MultVecX(-1000.0f, &this->limbPos[10]); + Matrix_MultVecX(1000.0f, &this->bodyPartsPos[WALLMASTER_BODYPART_9]); + Matrix_MultVecX(-1000.0f, &this->bodyPartsPos[WALLMASTER_BODYPART_10]); } else if (limbIndex == WALLMASTER_LIMB_HAND) { OPEN_DISPS(play->state.gfxCtx); @@ -745,7 +775,7 @@ void EnWallmas_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWallmas_OverrideLimbDraw, EnWallmas_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, WALLMASTER_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index 4d1466b95..383d6d4ca 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -36,6 +36,21 @@ struct EnWallmas; typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); +typedef enum WallmasterBodyPart { + /* 0 */ WALLMASTER_BODYPART_0, + /* 1 */ WALLMASTER_BODYPART_1, + /* 2 */ WALLMASTER_BODYPART_2, + /* 3 */ WALLMASTER_BODYPART_3, + /* 4 */ WALLMASTER_BODYPART_4, + /* 5 */ WALLMASTER_BODYPART_5, + /* 6 */ WALLMASTER_BODYPART_6, + /* 7 */ WALLMASTER_BODYPART_7, + /* 8 */ WALLMASTER_BODYPART_8, + /* 9 */ WALLMASTER_BODYPART_9, + /* 10 */ WALLMASTER_BODYPART_10, + /* 11 */ WALLMASTER_BODYPART_MAX +} WallmasterBodyPart; + typedef struct EnWallmas { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -50,7 +65,7 @@ typedef struct EnWallmas { /* 0x2C8 */ f32 drawDmgEffAlpha; /* 0x2CC */ f32 drawDmgEffScale; /* 0x2D0 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2D4 */ Vec3f limbPos[11]; + /* 0x2D4 */ Vec3f bodyPartsPos[WALLMASTER_BODYPART_MAX]; /* 0x358 */ ColliderCylinder collider; } EnWallmas; // size = 0x3A4 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 3cfc1eba7..b5603e613 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 @@ -7,7 +7,7 @@ #include "z_en_warp_uzu.h" #include "objects/object_warp_uzu/object_warp_uzu.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnWarpUzu*)thisx) @@ -65,7 +65,7 @@ void EnWarpUzu_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider, thisx, &sCylinderInit); - thisx->targetMode = 0; + thisx->targetMode = TARGET_MODE_0; func_80A66208(this, play); } @@ -103,7 +103,7 @@ void func_80A66278(EnWarpUzu* this, PlayState* play) { phi_v1 = ABS(temp_v0); if (phi_a0 >= 0x2AAB) { if (phi_v1 < 0x238E) { - func_800B8614(&this->actor, play, 70.0f); + Actor_OfferTalk(&this->actor, play, 70.0f); } } } 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 06893449e..fcac1e837 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -8,7 +8,7 @@ #include "z_en_warp_tag.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnWarptag*)thisx) @@ -37,8 +37,10 @@ ActorInit En_Warp_tag_InitVars = { }; // this appears to be unused, as the code never accesses it in known vanilla cases -// these unknown values get passed to a unknown z_message function -u8 D_809C1000[] = { 0x28, 0x29, 0x2A, 0x2B, 0x2D, 0x2C, 0, 0 }; +u8 D_809C1000[] = { + OCARINA_ACTION_CHECK_TIME, OCARINA_ACTION_CHECK_HEALING, OCARINA_ACTION_CHECK_EPONAS, + OCARINA_ACTION_CHECK_SOARING, OCARINA_ACTION_CHECK_SUNS, OCARINA_ACTION_CHECK_STORMS, +}; static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), @@ -52,13 +54,14 @@ void EnWarptag_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->dyna.actor, 0.0f); if (WARPTAG_GET_3C0_MAX(thisx) == WARPTAG_3C0_MAX) { - this->dyna.actor.flags &= ~ACTOR_FLAG_1; + this->dyna.actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (WARPTAG_GET_INVISIBLE(&this->dyna.actor)) { this->actionFunc = EnWarpTag_WaitForPlayer; } else { - if ((this->dangeonKeepObject = Object_GetIndex(&play->objectCtx, GAMEPLAY_DANGEON_KEEP)) < 0) { + if ((this->dangeonKeepObjectSlot = Object_GetSlot(&play->objectCtx, GAMEPLAY_DANGEON_KEEP)) <= + OBJECT_SLOT_NONE) { Actor_Kill(&this->dyna.actor); } @@ -81,11 +84,11 @@ void EnWarptag_Destroy(Actor* thisx, PlayState* play) { * Loads DynaPoly from GAMEPLAY_DANGEON_KEEP. */ void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->dangeonKeepObject)) { + if (Object_IsLoaded(&play->objectCtx, this->dangeonKeepObjectSlot)) { this->actionFunc = EnWarpTag_WaitForPlayer; DynaPolyActor_Init(&this->dyna, 0x1); DynaPolyActor_LoadMesh(play, &this->dyna, &gWarpTagGoronTrialBaseCol); - this->dyna.actor.objBankIndex = this->dangeonKeepObject; + this->dyna.actor.objectSlot = this->dangeonKeepObjectSlot; this->dyna.actor.draw = EnWarpTag_Draw; } } @@ -113,7 +116,7 @@ void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { // 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 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 + Message_DisplayOcarinaStaff(play, D_809C1000[WARPTAG_GET_3C0(&this->dyna.actor)]); this->actionFunc = EnWarpTag_Unused809C0A20; } else { @@ -125,13 +128,13 @@ void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { * Unused ActionFunc: assigned by EnWarpTag_Unused809C09A0, no known variants use. */ void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play) { - if (play->msgCtx.ocarinaMode == 9) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_STORMS) { func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = EnWarpTag_RespawnPlayer; CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); - } else if (play->msgCtx.ocarinaMode >= 2) { - play->msgCtx.ocarinaMode = 4; + } else if (play->msgCtx.ocarinaMode >= OCARINA_MODE_WARP) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; this->actionFunc = EnWarpTag_Unused809C09A0; } } @@ -208,8 +211,8 @@ 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, entrance, play->setupEntranceList[playerSpawnIndex].room, - playerParams, &newRespawnPos, + Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, entrance, + play->setupEntranceList[playerSpawnIndex].room, playerParams, &newRespawnPos, DEG_TO_BINANG_ALT((playerActorEntry->rot.y >> 7) & 0x1FF)); func_80169EFC(&play->state); @@ -243,7 +246,7 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { 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); + Audio_PlaySfx_2(NA_SE_OC_SECRET_HOLE_OUT); func_801A4058(5); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; 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 ac76ccb67..840cf8a0f 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 @@ -9,7 +9,7 @@ typedef void (*EnWarptagActionFunc)(struct EnWarptag*, PlayState*); typedef struct EnWarptag { /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ s8 dangeonKeepObject; + /* 0x15C */ s8 dangeonKeepObjectSlot; /* 0x15E */ union { s16 reusedValue; // default name s16 unkValue15E; // passed to unk play func, mods player rotation, stepped to 0x2710 diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index c8ec8f8c4..bc960b96b 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -13,10 +13,11 @@ */ #include "z_en_water_effect.h" +#include "overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.h" #include "objects/object_water_effect/object_water_effect.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EnWaterEffect*)thisx) @@ -90,7 +91,7 @@ void EnWaterEffect_Init(Actor* thisx, PlayState* play) { s32 pad; EnWaterEffect* this = THIS; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_DC4 = Rand_ZeroFloat(100.0f); if (this->actor.params == ENWATEREFFECT_TYPE_FALLING_ROCK_SPAWNER) { @@ -414,7 +415,7 @@ void func_80A59C04(Actor* thisx, PlayState* play2) { this->unk_DC6--; } - if ((rotaryRoom != NULL) && Flags_GetSwitch(play, (rotaryRoom->params >> 1) & 0x7F)) { + if ((rotaryRoom != NULL) && Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_SWITCH_FLAG_1(rotaryRoom))) { this->unk_DC6 = Rand_ZeroFloat(150.0f) + 100.0f; } else if (!Play_InCsMode(play)) { this->unk_DC4++; diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c index 83cf47291..221ff557c 100644 --- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c +++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c @@ -6,7 +6,7 @@ #include "z_en_wdhand.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY) #define THIS ((EnWdhand*)thisx) 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 84f621915..3aa4360f9 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 @@ -47,12 +47,6 @@ ActorInit En_Weather_Tag_InitVars = { (ActorFunc)EnWeatherTag_Draw, }; -extern f32 D_801F4E74; -extern u8 D_801BDBB8; -extern u8 D_801BDBB4; -extern u8 D_801F4E30; -extern s16 D_801F4E7A; - void EnWeatherTag_SetupAction(EnWeatherTag* this, EnWeatherTagActionFunc func) { this->actionFunc = func; } @@ -67,7 +61,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { s32 pathID; // flag: is targetable. Should do nothing as not set by default above - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; switch (WEATHER_TAG_TYPE(&this->actor)) { case WEATHERTAG_TYPE_UNK0: @@ -131,17 +125,17 @@ u8 func_80966608(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, if (WEATHER_TAG_RANGE100(&this->actor) > Actor_WorldDistXZToActor(&player->actor, &this->actor)) { if (play->envCtx.lightConfig == play->envCtx.changeLightNextConfig) { - D_801BDBB8 = 1; - if (!(play->envCtx.lightMode == 0) || + gInterruptSongOfStorms = true; + if (!(play->envCtx.lightMode == LIGHT_MODE_TIME) || ((play->envCtx.lightConfig != 1) && !play->envCtx.changeLightEnabled)) { - D_801BDBB8 = 0; + gInterruptSongOfStorms = false; if (gWeatherMode != weatherMode) { gWeatherMode = weatherMode; play->envCtx.changeLightEnabled = true; play->envCtx.lightConfig = lightConfig; play->envCtx.changeLightNextConfig = changeLightNextConfig; - D_801BDBB4 = changeLightNextConfig; + gLightConfigAfterUnderwater = changeLightNextConfig; play->envCtx.changeDuration = changeDuration; play->envCtx.changeLightTimer = play->envCtx.changeDuration; } @@ -161,16 +155,16 @@ u8 func_80966758(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, if (WEATHER_TAG_RANGE100(&this->actor) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { if (play->envCtx.lightConfig == play->envCtx.changeLightNextConfig) { - D_801BDBB8 = 1; - if (!(play->envCtx.lightMode == 0) || + gInterruptSongOfStorms = true; + if (!(play->envCtx.lightMode == LIGHT_MODE_TIME) || ((play->envCtx.lightConfig != 1) && !play->envCtx.changeLightEnabled)) { - D_801BDBB8 = 0; - gWeatherMode = 0; + gInterruptSongOfStorms = false; + gWeatherMode = WEATHER_MODE_CLEAR; play->envCtx.changeLightEnabled = true; play->envCtx.lightConfig = lightConfig; play->envCtx.changeLightNextConfig = changeLightNextConfig; - D_801BDBB4 = changeLightNextConfig; + gLightConfigAfterUnderwater = changeLightNextConfig; play->envCtx.changeDuration = changeDuration; play->envCtx.changeLightTimer = play->envCtx.changeDuration; returnVal = 1; @@ -201,11 +195,11 @@ void func_8096689C(EnWeatherTag* this, PlayState* play) { play->envCtx.windSpeed = (this->actor.world.rot.z * partialResult) + 30.0f; if (partialResult > 0.01f) { - play->envCtx.sandstormState = 8; + play->envCtx.sandstormState = SANDSTORM_8; D_801F4E30 = 0x9B; - } else if (play->envCtx.sandstormState == 8) { + } else if (play->envCtx.sandstormState == SANDSTORM_8) { D_801F4E30 = 0; - play->envCtx.sandstormState = 9; + play->envCtx.sandstormState = SANDSTORM_9; } } @@ -243,7 +237,7 @@ void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play) { // poisoned swamp: placed behind the water fall from ikana // this tag stops spawning after STT cleared? void func_80966B08(EnWeatherTag* this, PlayState* play) { - if (func_80966608(this, play, 0, 0, play->envCtx.lightConfig, 5, 100, 2) || (gWeatherMode == 2)) { + if (func_80966608(this, play, 0, 0, play->envCtx.lightConfig, 5, 100, 2) || (gWeatherMode == WEATHER_MODE_2)) { play->skyboxId = SKYBOX_3; EnWeatherTag_SetupAction(this, func_80966D20); } else if (D_801F4E74 <= 0.01f) { @@ -315,7 +309,7 @@ void func_80966D20(EnWeatherTag* this, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966B08); } - if (gWeatherMode != 2) { + if (gWeatherMode != WEATHER_MODE_2) { EnWeatherTag_SetupAction(this, func_80966B08); } } @@ -325,7 +319,7 @@ void func_80966D20(EnWeatherTag* this, PlayState* play) { // path to goron village winter, winter mountain village void func_80966E0C(EnWeatherTag* this, PlayState* play) { if (func_80966608(this, play, 0, 1, 0, 2, 60, 3)) { - play->envCtx.unk_F2[3] = 0x80; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 128; EnWeatherTag_SetupAction(this, func_80966E84); } } @@ -333,7 +327,7 @@ void func_80966E0C(EnWeatherTag* this, PlayState* play) { // WEATHERTAG_TYPE_WINTERFOG 2 void func_80966E84(EnWeatherTag* this, PlayState* play) { if (func_80966758(this, play, 1, 0, 2, 0, 60)) { - play->envCtx.unk_F2[3] = 0; + play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; EnWeatherTag_SetupAction(this, func_80966E0C); } } @@ -343,8 +337,8 @@ void func_80966E84(EnWeatherTag* this, PlayState* play) { // wait if you enter the scene through a room instead of fog you get a flash rain shower void func_80966EF0(EnWeatherTag* this, PlayState* play) { if (func_80966608(this, play, 0, 1, 0, 2, 100, 4)) { - func_800FD78C(play); - play->envCtx.unk_F2[0] = 60; + Environment_PlayStormNatureAmbience(play); + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 60; EnWeatherTag_SetupAction(this, func_80966F74); } } @@ -352,8 +346,8 @@ void func_80966EF0(EnWeatherTag* this, PlayState* play) { // WEATHERTAG_TYPE_UNK3 2 void func_80966F74(EnWeatherTag* this, PlayState* play) { if (func_80966758(this, play, 1, 0, 2, 0, 100)) { - func_800FD858(play); - play->envCtx.unk_F2[0] = 0; + Environment_StopStormNatureAmbience(play); + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; EnWeatherTag_SetupAction(this, func_80966EF0); } } @@ -365,7 +359,7 @@ 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->actor); if (distance > 0) { - D_801F4E7A = distance; + gSkyboxNumStars = distance; } if ((play->sceneId == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) { @@ -410,9 +404,9 @@ void EnWeatherTag_DoNothing(EnWeatherTag* this, PlayState* play) { // these two are isolated, they call themselves but nothing calls them? void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, PlayState* play) { if (func_80966608(this, play, 0, 1, 0, 4, 100, 5)) { - func_800FD78C(play); - play->envCtx.unk_E3 = 1; - play->envCtx.unk_F2[0] = 60; + Environment_PlayStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_ON; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 60; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_80967250); } } @@ -420,9 +414,9 @@ void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, PlayState* play) { // these two are isolated, they call themselves but nothing calls them void EnWeatherTag_Unused_80967250(EnWeatherTag* this, PlayState* play) { if (func_80966758(this, play, 1, 0, 4, 0, 100)) { - func_800FD858(play); - play->envCtx.unk_E3 = 2; - play->envCtx.unk_F2[0] = 0; + Environment_StopStormNatureAmbience(play); + play->envCtx.lightningState = LIGHTNING_LAST; + play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_809671B8); } } @@ -442,20 +436,20 @@ void func_809672DC(EnWeatherTag* this, PlayState* play) { range = WEATHER_TAG_RANGE100(&this->actor); if (distance < range) { - play->envCtx.sandstormState = 6; + play->envCtx.sandstormState = SANDSTORM_6; strength = 1.0f - (distance / range); if (0.8f < strength) { strength = 1.0f; } D_801F4E30 = (200.0f * strength); } else { - if (play->envCtx.sandstormState == 6) { + if (play->envCtx.sandstormState == SANDSTORM_6) { D_801F4E30 = 0; - play->envCtx.sandstormState = 7; + play->envCtx.sandstormState = SANDSTORM_7; } } - Math_SmoothStepToS(&play->envCtx.lightSettings.fogNear, (s16)(-40.0f * strength), 1, 1, 1); + Math_SmoothStepToS(&play->envCtx.adjLightSettings.fogNear, -40.0f * strength, 1, 1, 1); } // WEATHERTAG_TYPE_LOCALDAY2RAIN: rain proximity as approaching rainy scene @@ -466,19 +460,19 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(&this->actor)) { if (CURRENT_DAY == 2) { if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && - (play->envCtx.unk_F2[2] == 0)) { + (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { - gWeatherMode = 1; - func_800FD78C(play); - play->envCtx.unk_F2[4] = 0x20; + gWeatherMode = WEATHER_MODE_1; + Environment_PlayStormNatureAmbience(play); + play->envCtx.precipitation[PRECIP_SOS_MAX] = 32; EnWeatherTag_SetupAction(this, func_80967608); } } } else { - if ((play->envCtx.unk_F2[4] != 0) && !(play->state.frames & 3)) { - play->envCtx.unk_F2[4]--; - if ((play->envCtx.unk_F2[4]) == 8) { - func_800FD858(play); + if ((play->envCtx.precipitation[PRECIP_SOS_MAX] != 0) && !(play->state.frames & 3)) { + play->envCtx.precipitation[PRECIP_SOS_MAX]--; + if ((play->envCtx.precipitation[PRECIP_SOS_MAX]) == 8) { + Environment_StopStormNatureAmbience(play); } } } @@ -488,7 +482,7 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { void func_80967608(EnWeatherTag* this, PlayState* play) { if ((WEATHER_TAG_RANGE100(&this->actor) + 10.0f) < Actor_WorldDistXZToActor(&GET_PLAYER(play)->actor, &this->actor)) { - gWeatherMode = 0; + gWeatherMode = WEATHER_MODE_CLEAR; EnWeatherTag_SetupAction(this, func_809674C8); } } @@ -497,7 +491,7 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = THIS; this->actionFunc(this, play); - if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) && + if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != MSGMODE_NONE) && (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (play->csCtx.state == CS_STATE_IDLE)) { diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 26301730f..b1332885e 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -6,9 +6,10 @@ #include "z_en_wf.h" #include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_400) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_400) #define THIS ((EnWf*)thisx) @@ -376,7 +377,7 @@ void func_80990854(EnWf* this, PlayState* play) { this->collider2.base.colType = COLTYPE_HIT5; this->collider3.base.colType = COLTYPE_HIT5; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, WOLFOS_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -526,7 +527,7 @@ void func_80990F0C(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; this->actor.shape.shadowScale = 0.0f; this->actor.scale.y = 0.0f; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_2A0 = 60; this->actionFunc = func_80990F50; } @@ -552,7 +553,7 @@ void func_80990F50(EnWf* this, PlayState* play) { void func_80990FC8(EnWf* this) { Animation_Change(&this->skelAnime, &gWolfosRearUpFallOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->unk_2A0 = 5; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = func_80991040; } @@ -1163,7 +1164,7 @@ void func_80992D6C(EnWf* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_2A0 = 25; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); this->actionFunc = func_80992E0C; @@ -1205,7 +1206,7 @@ void func_80992E0C(EnWf* this, PlayState* play) { func_800B3030(play, &sp60, &D_809942F0, &D_809942F0, 100, 0, 2); } - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } } @@ -1456,7 +1457,7 @@ void func_8099386C(EnWf* this, PlayState* play) { this->drawDmgEffAlpha = 4.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, collider->info.bumper.hitPos.y, collider->info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); @@ -1534,7 +1535,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = this->drawDmgEffScale; } } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -1548,17 +1549,39 @@ s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } +static s8 sLimbToBodyParts[WOLFOS_NORMAL_LIMB_MAX] = { + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_NONE + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_ROOT + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_THIGH + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_SHIN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_LEFT_PASTERN + WOLFOS_BODYPART_BACK_LEFT_PAW, // WOLFOS_NORMAL_LIMB_BACK_LEFT_PAW + WOLFOS_BODYPART_TAIL, // WOLFOS_NORMAL_LIMB_TAIL + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_ABDOMEN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_THIGH + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_SHIN + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_PASTERN + WOLFOS_BODYPART_BACK_RIGHT_PAW, // WOLFOS_NORMAL_LIMB_BACK_RIGHT_PAW + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_THORAX + WOLFOS_BODYPART_FRONT_RIGHT_UPPER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_UPPER_LEG + WOLFOS_BODYPART_FRONT_RIGHT_LOWER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_LOWER_LEG + WOLFOS_BODYPART_FRONT_RIGHT_CLAW, // WOLFOS_NORMAL_LIMB_FRONT_RIGHT_CLAW + WOLFOS_BODYPART_HEAD_ROOT, // WOLFOS_NORMAL_LIMB_HEAD_ROOT + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_HEAD + BODYPART_NONE, // WOLFOS_NORMAL_LIMB_EYES + WOLFOS_BODYPART_FRONT_LEFT_UPPER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_UPPER_LEG + WOLFOS_BODYPART_FRONT_LEFT_LOWER_LEG, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_LOWER_LEG + WOLFOS_BODYPART_FRONT_LEFT_CLAW, // WOLFOS_NORMAL_LIMB_FRONT_LEFT_CLAW +}; + void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - static s8 D_809942FC[] = { - -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, 2, -1, 3, 4, 5, 6, -1, -1, 7, 8, 9, - }; EnWf* this = THIS; Vec3f sp20; Collider_UpdateSpheres(limbIndex, &this->collider1); - if (D_809942FC[limbIndex] != -1) { - Matrix_MultZero(&this->limbPos[D_809942FC[limbIndex]]); + if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { + Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } if (limbIndex == WOLFOS_NORMAL_LIMB_TAIL) { @@ -1587,7 +1610,7 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, WOLFOS_BODYPART_MAX, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.h b/src/overlays/actors/ovl_En_Wf/z_en_wf.h index c8a0c7af8..6e9db0be1 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -10,6 +10,20 @@ typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); #define ENWF_GET_80(thisx) ((thisx)->params & 0x80) +typedef enum WolfosBodyPart { + /* 0 */ WOLFOS_BODYPART_BACK_LEFT_PAW, + /* 1 */ WOLFOS_BODYPART_TAIL, + /* 2 */ WOLFOS_BODYPART_BACK_RIGHT_PAW, + /* 3 */ WOLFOS_BODYPART_FRONT_RIGHT_UPPER_LEG, + /* 4 */ WOLFOS_BODYPART_FRONT_RIGHT_LOWER_LEG, + /* 5 */ WOLFOS_BODYPART_FRONT_RIGHT_CLAW, + /* 6 */ WOLFOS_BODYPART_HEAD_ROOT, + /* 7 */ WOLFOS_BODYPART_FRONT_LEFT_UPPER_LEG, + /* 8 */ WOLFOS_BODYPART_FRONT_LEFT_LOWER_LEG, + /* 9 */ WOLFOS_BODYPART_FRONT_LEFT_CLAW, + /* 10 */ WOLFOS_BODYPART_MAX +} WolfosBodyPart; + typedef struct EnWf { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -30,7 +44,7 @@ typedef struct EnWf { /* 0x2AC */ f32 drawDmgEffAlpha; /* 0x2B0 */ f32 drawDmgEffScale; /* 0x2B4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2B8 */ Vec3f limbPos[10]; + /* 0x2B8 */ Vec3f bodyPartsPos[WOLFOS_BODYPART_MAX]; /* 0x330 */ ColliderJntSph collider1; /* 0x350 */ ColliderJntSphElement collider1Elements[4]; /* 0x450 */ ColliderCylinder collider2; diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index 6ce68a0e3..8ae7b0de4 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -6,11 +6,12 @@ #include "z_en_wiz.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h" -#define FLAGS \ - (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_100000 | \ - ACTOR_FLAG_CANT_LOCK_ON | ACTOR_FLAG_80000000) +#define FLAGS \ + (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE | \ + ACTOR_FLAG_100000 | ACTOR_FLAG_CANT_LOCK_ON | ACTOR_FLAG_80000000) #define THIS ((EnWiz*)thisx) @@ -329,13 +330,13 @@ void EnWiz_Init(Actor* thisx, PlayState* play) { this->platformLightAlpha = 0; this->alpha = 255; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->unk_450 = 1.0f; this->actor.shape.yOffset = 700.0f; Collider_InitAndSetJntSph(play, &this->ghostColliders, &this->actor, &sJntSphInit, this->ghostColliderElements); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->staffFlameScroll = Rand_S16Offset(0, 7); - this->switchFlag = EN_WIZ_GET_SWITCHFLAG(&this->actor); + this->switchFlag = EN_WIZ_GET_SWITCH_FLAG(&this->actor); this->type = EN_WIZ_GET_TYPE(&this->actor); if (this->switchFlag == 0x7F) { @@ -497,7 +498,7 @@ void EnWiz_HandleIntroCutscene(EnWiz* this, PlayState* play) { case EN_WIZ_INTRO_CS_WAIT_BEFORE_RUN: if (this->introCutsceneTimer == 0) { EnWiz_ChangeAnim(this, EN_WIZ_ANIM_RUN, false); - this->rotationalVelocity = 0; + this->angularVelocity = 0; this->introCutsceneTimer = 34; this->introCutsceneState++; } @@ -509,8 +510,8 @@ void EnWiz_HandleIntroCutscene(EnWiz* this, PlayState* play) { this->animLoopCounter = this->introCutsceneCameraAngle = 0; this->introCutsceneState = EN_WIZ_INTRO_CS_DISAPPEAR; } else { - Math_SmoothStepToS(&this->rotationalVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); - this->actor.world.rot.y += this->rotationalVelocity; + Math_SmoothStepToS(&this->angularVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); + this->actor.world.rot.y += this->angularVelocity; } Math_Vec3f_Copy(&eyeNext, &this->actor.world.pos); @@ -783,7 +784,7 @@ void EnWiz_Appear(EnWiz* this, PlayState* play) { void EnWiz_SetupDance(EnWiz* this) { EnWiz_ChangeAnim(this, EN_WIZ_ANIM_DANCE, false); Math_ApproachF(&this->scale, 0.015f, 0.05f, 0.001f); - this->rotationalVelocity = 0; + this->angularVelocity = 0; this->animLoopCounter = 0; this->action = EN_WIZ_ACTION_DANCE; if (this->fightState >= EN_WIZ_FIGHT_STATE_SECOND_PHASE_GHOSTS_COPY_WIZROBE) { @@ -807,16 +808,16 @@ void EnWiz_Dance(EnWiz* this, PlayState* play) { Math_SmoothStepToS(&this->alpha, 255, 1, 5, 0); Math_ApproachF(&this->scale, 0.015f, 0.05f, 0.001f); Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); - this->actor.world.rot.y += this->rotationalVelocity; + this->actor.world.rot.y += this->angularVelocity; if (this->fightState >= EN_WIZ_FIGHT_STATE_SECOND_PHASE_GHOSTS_RUN_AROUND) { EnWiz_MoveGhosts(this); } else { for (i = 0; i < this->platformCount; i++) { - this->ghostRot[i].y += this->rotationalVelocity; + this->ghostRot[i].y += this->angularVelocity; } } - Math_SmoothStepToS(&this->rotationalVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); + Math_SmoothStepToS(&this->angularVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); Math_SmoothStepToS(&this->platformLightAlpha, this->targetPlatformLightAlpha, 20, 50, 10); if (this->endFrame <= curFrame) { if (this->animLoopCounter < 10) { @@ -824,7 +825,7 @@ void EnWiz_Dance(EnWiz* this, PlayState* play) { } } - if ((this->animLoopCounter >= 3) && (!this->hasActiveProjectile)) { + if ((this->animLoopCounter >= 3) && !this->hasActiveProjectile) { this->targetPlatformLightAlpha = 0; EnWiz_SetupWindUp(this); } @@ -962,7 +963,7 @@ void EnWiz_Attack(EnWiz* this, PlayState* play) { } if (this->timer == 0) { - if ((Animation_OnFrame(&this->skelAnime, 6.0f)) && (!this->hasActiveProjectile)) { + if (Animation_OnFrame(&this->skelAnime, 6.0f) && !this->hasActiveProjectile) { Player* player = GET_PLAYER(play); Vec3f pos; s32 type = this->type; @@ -996,21 +997,21 @@ void EnWiz_Attack(EnWiz* this, PlayState* play) { void EnWiz_SetupDisappear(EnWiz* this) { if (this->action != EN_WIZ_ACTION_DAMAGED) { - this->rotationalVelocity = 0x2710; + this->angularVelocity = 0x2710; this->timer = 0; EnWiz_ChangeAnim(this, EN_WIZ_ANIM_IDLE, false); this->action = EN_WIZ_ACTION_DISAPPEAR; } else { - this->rotationalVelocity = 0x2710; - this->actor.world.rot.y += this->rotationalVelocity; + this->angularVelocity = 0x2710; + this->actor.world.rot.y += this->angularVelocity; } this->targetPlatformLightAlpha = 0; this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); - Math_SmoothStepToS(&this->rotationalVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); - this->actor.world.rot.y += this->rotationalVelocity; - this->actor.flags &= ~ACTOR_FLAG_1; + Math_SmoothStepToS(&this->angularVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); + this->actor.world.rot.y += this->angularVelocity; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actionFunc = EnWiz_Disappear; } @@ -1021,8 +1022,8 @@ void EnWiz_SetupDisappear(EnWiz* this) { void EnWiz_Disappear(EnWiz* this, PlayState* play) { s32 i; - Math_SmoothStepToS(&this->rotationalVelocity, 0, 0xA, 0xBB8, 0x14); - this->actor.world.rot.y += this->rotationalVelocity; + Math_SmoothStepToS(&this->angularVelocity, 0, 0xA, 0xBB8, 0x14); + this->actor.world.rot.y += this->angularVelocity; if ((this->fightState == EN_WIZ_FIGHT_STATE_FIRST_PHASE) || (this->action == EN_WIZ_ACTION_DAMAGED)) { Math_ApproachZeroF(&this->scale, 0.3f, 0.01f); Math_SmoothStepToS(&this->platformLightAlpha, this->targetPlatformLightAlpha, 5, 50, 0); @@ -1030,7 +1031,7 @@ void EnWiz_Disappear(EnWiz* this, PlayState* play) { Math_ApproachZeroF(&this->scale, 0.3f, 0.001f); Math_SmoothStepToS(&this->platformLightAlpha, this->targetPlatformLightAlpha, 10, 50, 0); for (i = 0; i < this->platformCount; i++) { - this->ghostRot[i].y += this->rotationalVelocity; + this->ghostRot[i].y += this->angularVelocity; } } @@ -1050,7 +1051,7 @@ void EnWiz_Disappear(EnWiz* this, PlayState* play) { this->ghostColliders.elements[0].info.bumper.dmgFlags = 0x1000202; } - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnWiz_SetupAppear; } } @@ -1065,7 +1066,7 @@ void EnWiz_SetupDamaged(EnWiz* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DEAD); this->timer = 0; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DAMAGE); } @@ -1078,9 +1079,9 @@ void EnWiz_SetupDamaged(EnWiz* this, PlayState* play) { this->timer = 0; } - this->rotationalVelocity = 0x4E20; + this->angularVelocity = 0x4E20; if ((this->drawDmgEffTimer != 0) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX)) { - this->rotationalVelocity = 0; + this->angularVelocity = 0; this->timer = 0; } @@ -1096,10 +1097,10 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { s32 i; if ((this->drawDmgEffTimer < 50) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX)) { - Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 1.0f, 0.7f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, EN_WIZ_BODYPART_MAX, 2, 1.0f, 0.7f); this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - this->rotationalVelocity = 0x4E20; + this->angularVelocity = 0x4E20; this->actor.velocity.y = 30.0f; this->actor.gravity = -3.0f; } @@ -1117,10 +1118,10 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { this->isDead = true; } - this->actor.world.rot.y += this->rotationalVelocity; - Math_SmoothStepToS(&this->rotationalVelocity, 0, 0xA, 0xBB8, 0x14); + this->actor.world.rot.y += this->angularVelocity; + Math_SmoothStepToS(&this->angularVelocity, 0, 0xA, 0xBB8, 0x14); for (i = 0; i < this->platformCount; i++) { - this->ghostRot[i].y += this->rotationalVelocity; + this->ghostRot[i].y += this->angularVelocity; } //! @bug: When the Wizrobe is defeated, it is launched into the air by the code above, and the @@ -1172,7 +1173,7 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { void EnWiz_SetupDead(EnWiz* this) { EnWiz_ChangeAnim(this, EN_WIZ_ANIM_DAMAGE, false); - this->rotationalVelocity = 0x2710; + this->angularVelocity = 0x2710; this->action = EN_WIZ_ACTION_DEAD; this->timer = 0; this->actionFunc = EnWiz_Dead; @@ -1185,9 +1186,9 @@ void EnWiz_SetupDead(EnWiz* this) { void EnWiz_Dead(EnWiz* this, PlayState* play) { s32 i; - this->actor.world.rot.y += this->rotationalVelocity; - Math_SmoothStepToS(&this->rotationalVelocity, 0, 0xA, 0xBB8, 0x14); - if (this->rotationalVelocity < 0x1E) { + this->actor.world.rot.y += this->angularVelocity; + Math_SmoothStepToS(&this->angularVelocity, 0, 0xA, 0xBB8, 0x14); + if (this->angularVelocity < 0x1E) { Math_SmoothStepToS(&this->alpha, 0, 10, 30, 20); for (i = 0; i < this->platformCount; i++) { Math_SmoothStepToS(&this->ghostAlpha[i], 0, 10, 30, 20); @@ -1250,7 +1251,8 @@ void EnWiz_UpdateDamage(EnWiz* this, PlayState* play) { (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); + this->actor.focus.pos.y, this->actor.focus.pos.z, 0, 0, 0, + CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; attackDealsDamage = true; @@ -1285,8 +1287,8 @@ void EnWiz_UpdateDamage(EnWiz* this, PlayState* play) { //! colliders are effectively disabled, this doesn't cause any problems in the final //! game, but it becomes an issue if the ghost colliders are enabled. this->fightState = EN_WIZ_FIGHT_STATE_SECOND_PHASE_GHOSTS_COPY_WIZROBE; - this->ghostColliders.base.acFlags &= ~BUMP_HIT; - if (this->ghostPos[i].x != .0f || this->ghostPos[i].z != .0f) { + this->ghostColliders.base.acFlags &= ~AC_HIT; + if ((this->ghostPos[i].x != .0f) || (this->ghostPos[i].z != .0f)) { for (j = 0; j < 9; j++) { accel.x = 0.0f; accel.y = 1.0f; @@ -1388,10 +1390,10 @@ void EnWiz_PostLimbDrawOpa(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r (limbIndex == WIZROBE_LIMB_NECK) || (limbIndex == WIZROBE_LIMB_HEAD) || (limbIndex == WIZROBE_LIMB_JAW) || (limbIndex == WIZROBE_LIMB_LEFT_SHIN) || (limbIndex == WIZROBE_LIMB_RIGHT_SHIN) || (limbIndex == WIZROBE_LIMB_LOINCLOTH)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_WIZ_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -1437,10 +1439,10 @@ void EnWiz_PostLimbDrawXlu(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r (limbIndex == WIZROBE_LIMB_NECK) || (limbIndex == WIZROBE_LIMB_HEAD) || (limbIndex == WIZROBE_LIMB_JAW) || (limbIndex == WIZROBE_LIMB_LEFT_SHIN) || (limbIndex == WIZROBE_LIMB_RIGHT_SHIN) || (limbIndex == WIZROBE_LIMB_LOINCLOTH)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); - this->bodyPartsPosIndex++; - if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosIndex = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + this->bodyPartIndex++; + if (this->bodyPartIndex >= EN_WIZ_BODYPART_MAX) { + this->bodyPartIndex = 0; } } } @@ -1485,9 +1487,8 @@ void EnWiz_Draw(Actor* thisx, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.8f; } - Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, - this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, EN_WIZ_BODYPART_MAX, this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, this->drawDmgEffType); } if (this->platformCount > 0) { diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h index 70f7a6c64..fa7156fc5 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h @@ -4,7 +4,7 @@ #include "global.h" #include "objects/object_wiz/object_wiz.h" -#define EN_WIZ_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define EN_WIZ_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define EN_WIZ_GET_TYPE(thisx) (((thisx)->params >> 8) & 0xFF) typedef enum { @@ -17,6 +17,22 @@ struct EnWiz; typedef void (*EnWizActionFunc)(struct EnWiz*, PlayState*); +typedef enum EnWizBodyPart { + /* 0 */ EN_WIZ_BODYPART_0, + /* 1 */ EN_WIZ_BODYPART_1, + /* 2 */ EN_WIZ_BODYPART_2, + /* 3 */ EN_WIZ_BODYPART_3, + /* 4 */ EN_WIZ_BODYPART_4, + /* 5 */ EN_WIZ_BODYPART_5, + /* 6 */ EN_WIZ_BODYPART_6, + /* 7 */ EN_WIZ_BODYPART_7, + /* 8 */ EN_WIZ_BODYPART_8, + /* 9 */ EN_WIZ_BODYPART_9, + /* 10 */ EN_WIZ_BODYPART_10, + /* 11 */ EN_WIZ_BODYPART_11, + /* 12 */ EN_WIZ_BODYPART_MAX +} EnWizBodyPart; + typedef struct EnWiz { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -34,7 +50,7 @@ typedef struct EnWiz { /* 0x3BA */ s16 hasActiveProjectile; /* 0x3BC */ s16 hasRunToEveryPlatform; // used for the second phase cutscene to make sure the Wizrobe visits every platform /* 0x3BE */ s16 unk_3BE; // unused, inferred from surrounding members - /* 0x3C0 */ s16 rotationalVelocity; + /* 0x3C0 */ s16 angularVelocity; /* 0x3C2 */ s16 alpha; /* 0x3C4 */ s16 platformLightAlpha; /* 0x3C6 */ s16 targetPlatformLightAlpha; @@ -68,8 +84,8 @@ typedef struct EnWiz { /* 0x754 */ s16 drawDmgEffType; /* 0x758 */ f32 drawDmgEffScale; /* 0x75C */ f32 drawDmgEffFrozenSteamScale; - /* 0x760 */ Vec3f bodyPartsPos[12]; - /* 0x7F0 */ s16 bodyPartsPosIndex; + /* 0x760 */ Vec3f bodyPartsPos[EN_WIZ_BODYPART_MAX]; + /* 0x7F0 */ s16 bodyPartIndex; /* 0x7F2 */ s16 ghostAlpha[10]; /* 0x806 */ s16 ghostNextPlatformIndex[10]; /* 0x81C */ Vec3f ghostPos[10]; diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c index e6fc7e776..a3df9a7a2 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Wiz/z_en_wiz.h" #include "objects/object_wiz/object_wiz.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnWizFire*)thisx) @@ -74,10 +74,10 @@ void EnWizFire_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->type = EN_WIZ_FIRE_GET_TYPE(&this->actor); - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; this->wallCheckTimer = 10; this->alpha = 255.0f; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (!Player_HasMirrorShieldEquipped(play)) { this->collider.info.toucher.dmgFlags = 0x20000000; @@ -119,19 +119,19 @@ void EnWizFire_Destroy(Actor* thisx, PlayState* play) { EnWizFire* this = THIS; if (this->type == EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE) { - play->envCtx.lightSettings.fogColor[2] = 0; - play->envCtx.lightSettings.fogColor[1] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.fogColor[0] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor2[2] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor2[1] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor2[0] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor1[2] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor1[1] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.ambientColor[2] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.ambientColor[1] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.fogColor[2]; - play->envCtx.lightSettings.fogNear = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.adjLightSettings.fogColor[2] = 0; + play->envCtx.adjLightSettings.fogColor[1] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.fogColor[0] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light2Color[2] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light2Color[1] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light2Color[0] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light1Color[2] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light1Color[1] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.light1Color[0] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.ambientColor[2] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.ambientColor[1] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.ambientColor[0] = play->envCtx.adjLightSettings.fogColor[2]; + play->envCtx.adjLightSettings.fogNear = play->envCtx.adjLightSettings.fogColor[2]; } Collider_DestroyCylinder(play, &this->collider); @@ -518,38 +518,39 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) { fogNear = 968.0f; } - play->envCtx.lightSettings.fogNear = (fogNear - (s16)play->envCtx.unk_C4.fogNear) * this->blendScaleFrac; + play->envCtx.adjLightSettings.fogNear = + (fogNear - (s16)play->envCtx.lightSettings.fogNear) * this->blendScaleFrac; - play->envCtx.lightSettings.ambientColor[0] = - ((f32)lightSettingsColors[index].r - play->envCtx.unk_C4.ambientColor[0]) * this->blendScaleFrac; - play->envCtx.lightSettings.ambientColor[1] = - ((f32)lightSettingsColors[index].g - play->envCtx.unk_C4.ambientColor[1]) * this->blendScaleFrac; - play->envCtx.lightSettings.ambientColor[2] = - ((f32)lightSettingsColors[index].b - play->envCtx.unk_C4.ambientColor[2]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.ambientColor[0] = + ((f32)lightSettingsColors[index].r - play->envCtx.lightSettings.ambientColor[0]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.ambientColor[1] = + ((f32)lightSettingsColors[index].g - play->envCtx.lightSettings.ambientColor[1]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.ambientColor[2] = + ((f32)lightSettingsColors[index].b - play->envCtx.lightSettings.ambientColor[2]) * this->blendScaleFrac; index++; - play->envCtx.lightSettings.diffuseColor1[0] = - ((f32)lightSettingsColors[index].r - play->envCtx.unk_C4.diffuseColor1[0]) * this->blendScaleFrac; - play->envCtx.lightSettings.diffuseColor1[1] = - ((f32)lightSettingsColors[index].g - play->envCtx.unk_C4.diffuseColor1[1]) * this->blendScaleFrac; - play->envCtx.lightSettings.diffuseColor1[2] = - ((f32)lightSettingsColors[index].b - play->envCtx.unk_C4.diffuseColor1[2]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light1Color[0] = + ((f32)lightSettingsColors[index].r - play->envCtx.lightSettings.light1Color[0]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light1Color[1] = + ((f32)lightSettingsColors[index].g - play->envCtx.lightSettings.light1Color[1]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light1Color[2] = + ((f32)lightSettingsColors[index].b - play->envCtx.lightSettings.light1Color[2]) * this->blendScaleFrac; index++; - play->envCtx.lightSettings.diffuseColor2[0] = - ((f32)lightSettingsColors[index].r - play->envCtx.unk_C4.diffuseColor[0]) * this->blendScaleFrac; - play->envCtx.lightSettings.diffuseColor2[1] = - ((f32)lightSettingsColors[index].g - play->envCtx.unk_C4.diffuseColor[1]) * this->blendScaleFrac; - play->envCtx.lightSettings.diffuseColor2[2] = - ((f32)lightSettingsColors[index].b - play->envCtx.unk_C4.diffuseColor[2]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light2Color[0] = + ((f32)lightSettingsColors[index].r - play->envCtx.lightSettings.light2Color[0]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light2Color[1] = + ((f32)lightSettingsColors[index].g - play->envCtx.lightSettings.light2Color[1]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.light2Color[2] = + ((f32)lightSettingsColors[index].b - play->envCtx.lightSettings.light2Color[2]) * this->blendScaleFrac; index++; - play->envCtx.lightSettings.fogColor[0] = - ((f32)lightSettingsColors[index].r - play->envCtx.unk_C4.fogColor[0]) * this->blendScaleFrac; - play->envCtx.lightSettings.fogColor[1] = - ((f32)lightSettingsColors[index].g - play->envCtx.unk_C4.fogColor[1]) * this->blendScaleFrac; - play->envCtx.lightSettings.fogColor[2] = - ((f32)lightSettingsColors[index].b - play->envCtx.unk_C4.fogColor[2]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.fogColor[0] = + ((f32)lightSettingsColors[index].r - play->envCtx.lightSettings.fogColor[0]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.fogColor[1] = + ((f32)lightSettingsColors[index].g - play->envCtx.lightSettings.fogColor[1]) * this->blendScaleFrac; + play->envCtx.adjLightSettings.fogColor[2] = + ((f32)lightSettingsColors[index].b - play->envCtx.lightSettings.fogColor[2]) * this->blendScaleFrac; } } @@ -573,7 +574,7 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) { DECR(this->steamSpawnTimer); DECR(this->poolTimer); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 5.0f, 10, + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 5.0f, 10.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); @@ -638,8 +639,8 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) { } } - if ((player->stateFlags2 & PLAYER_STATE2_4000) && (player->unk_AE8 < 90)) { - player->unk_AE8 = 90; + if ((player->stateFlags2 & PLAYER_STATE2_4000) && (player->actionVar2 < 90)) { + player->actionVar2 = 90; } if (!this->hitByIceArrow && !sPoolHitByIceArrow && diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index cf4331ffa..8611c1c30 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -4,7 +4,6 @@ * Description: Trees, shrubs */ -#include "prevent_bss_reordering.h" #include "z_en_wood02.h" #include "objects/object_wood02/object_wood02.h" 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 9238a166b..b39a77408 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -7,7 +7,7 @@ #include "z_en_yb.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) #define THIS ((EnYb*)thisx) @@ -88,7 +88,7 @@ void EnYb_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, EnYb_ActorShadowFunc, 20.0f); // @bug this alignment is because of player animations, but should be using ALIGN16 - SkelAnime_InitFlex(play, &this->skelAnime, &gYbSkeleton, &object_yb_Anim_000200, (uintptr_t)this->jointTable & ~0xF, + SkelAnime_InitFlex(play, &this->skelAnime, &gYbSkel, &object_yb_Anim_000200, (uintptr_t)this->jointTable & ~0xF, (uintptr_t)this->morphTable & ~0xF, YB_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &object_yb_Anim_000200); @@ -120,7 +120,7 @@ void EnYb_Init(Actor* thisx, PlayState* play) { } else { // else (night 6pm to midnight): wait to appear this->alpha = 0; this->actionFunc = EnYb_WaitForMidnight; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_04)) { @@ -170,31 +170,33 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { } void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 morphFrames) { - if ((animIndex >= 0) && (animIndex < 3)) { - if ((animIndex != this->animIndex) || (animMode != ANIMMODE_LOOP)) { - if (animIndex > 0) { - if (animMode == ANIMMODE_LOOP) { - PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, - Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, - morphFrames); - } else { - // unused case, (only called once with animMode = ANIMMODE_LOOP) - PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, - Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, - morphFrames); - } - } else { - // unused case, (only called once with animIndex = 2) - AnimationHeader* animationPtr = gYbUnusedAnimations[animIndex]; + s32 pad; - if (1) {} - - Animation_Change(&this->skelAnime, gYbUnusedAnimations[animIndex], 1.0f, 0.0f, - Animation_GetLastFrame(animationPtr), animMode, morphFrames); - } - this->animIndex = animIndex; - } + if ((animIndex < 0) || (animIndex > 2)) { + return; } + + if ((animIndex == this->animIndex) && (animMode == ANIMMODE_LOOP)) { + return; + } + + if (animIndex > 0) { + if (animMode == ANIMMODE_LOOP) { + PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, + Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, + morphFrames); + } else { + // unused case, (only called once with animMode = ANIMMODE_LOOP) + PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, + Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, + morphFrames); + } + } else { + // unused case, (only called once with animIndex = 2) + Animation_Change(&this->skelAnime, gYbUnusedAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(gYbUnusedAnimations[animIndex]), animMode, morphFrames); + } + this->animIndex = animIndex; } s32 EnYb_CanTalk(EnYb* this, PlayState* play) { @@ -232,7 +234,7 @@ void EnYb_ChangeCutscene(EnYb* this, s16 csIdIndex) { * Sets a flag that enables the Kamaro dancing proximity music at night. */ void EnYb_EnableProximityMusic(EnYb* this) { - func_800B9084(&this->actor); + Actor_PlaySeq_FlaggedKamaroDance(&this->actor); } void EnYb_Disappear(EnYb* this, PlayState* play) { @@ -265,7 +267,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } EnYb_EnableProximityMusic(this); } @@ -277,7 +279,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { Actor_OfferGetItem(&this->actor, play, GI_MASK_KAMARO, 10000.0f, 100.0f); } @@ -330,7 +332,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } EnYb_EnableProximityMusic(this); } @@ -345,7 +347,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } EnYb_EnableProximityMusic(this); } @@ -356,8 +358,8 @@ void EnYb_Idle(EnYb* this, PlayState* play) { EnYb_UpdateAnimation(this, play); if ((this->actor.xzDistToPlayer < 180.0f) && (fabsf(this->actor.playerHeightRel) < 50.0f) && - (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && + (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { this->actionFunc = EnYb_TeachingDance; this->teachingCutsceneTimer = 200; EnYb_ChangeCutscene(this, 0); @@ -372,7 +374,7 @@ void EnYb_Idle(EnYb* this, PlayState* play) { Message_StartTextbox(play, 0x147B, &this->actor); } } else if (EnYb_CanTalk(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } if (this->playerOcarinaOut & 1) { @@ -394,7 +396,7 @@ void EnYb_WaitForMidnight(EnYb* this, PlayState* play) { this->alpha += 5; if (this->alpha > 250) { this->alpha = 255; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actionFunc = EnYb_Idle; } EnYb_EnableProximityMusic(this); @@ -405,11 +407,11 @@ void EnYb_Update(Actor* thisx, PlayState* play) { s32 pad; EnYb* this = THIS; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_1)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TARGETABLE)) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_1)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TARGETABLE)) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index e77aace23..1e813813e 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -6,7 +6,7 @@ #include "z_en_zl1.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnZl1*)thisx) 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 ba71bbd7f..95e8f2ceb 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -6,7 +6,7 @@ #include "z_en_zo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnZo*)thisx) @@ -98,9 +98,64 @@ static AnimationInfoS sAnimationInfo[] = { { &gZoraWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -s8 sBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -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 }; +static s8 sLimbToBodyParts[ZORA_LIMB_MAX] = { + BODYPART_NONE, // ZORA_LIMB_NONE + ZORA_BODYPART_1, // ZORA_LIMB_PELVIS + ZORA_BODYPART_12, // ZORA_LIMB_LEFT_THIGH + ZORA_BODYPART_13, // ZORA_LIMB_LEFT_SHIN + ZORA_BODYPART_14, // ZORA_LIMB_LEFT_FOOT + ZORA_BODYPART_9, // ZORA_LIMB_RIGHT_THIGH + ZORA_BODYPART_10, // ZORA_LIMB_RIGHT_SHIN + ZORA_BODYPART_11, // ZORA_LIMB_RIGHT_FOOT + ZORA_BODYPART_0, // ZORA_LIMB_TORSO + ZORA_BODYPART_6, // ZORA_LIMB_LEFT_UPPER_ARM + ZORA_BODYPART_7, // ZORA_LIMB_LEFT_FOREARM + ZORA_BODYPART_8, // ZORA_LIMB_LEFT_HAND + ZORA_BODYPART_3, // ZORA_LIMB_RIGHT_UPPER_ARM + ZORA_BODYPART_4, // ZORA_LIMB_RIGHT_FOREARM + ZORA_BODYPART_5, // ZORA_LIMB_RIGHT_HAND + ZORA_BODYPART_2, // ZORA_LIMB_HEAD + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_1 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_2 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_3 + BODYPART_NONE, // ZORA_LIMB_HEAD_TAIL_FIN +}; + +static s8 sParentShadowBodyParts[ZORA_BODYPART_MAX] = { + ZORA_BODYPART_0, // ZORA_BODYPART_0 + ZORA_BODYPART_0, // ZORA_BODYPART_1 + ZORA_BODYPART_0, // ZORA_BODYPART_2 + ZORA_BODYPART_0, // ZORA_BODYPART_3 + ZORA_BODYPART_3, // ZORA_BODYPART_4 + ZORA_BODYPART_4, // ZORA_BODYPART_5 + ZORA_BODYPART_0, // ZORA_BODYPART_6 + ZORA_BODYPART_6, // ZORA_BODYPART_7 + ZORA_BODYPART_7, // ZORA_BODYPART_8 + ZORA_BODYPART_0, // ZORA_BODYPART_9 + ZORA_BODYPART_9, // ZORA_BODYPART_10 + ZORA_BODYPART_10, // ZORA_BODYPART_11 + ZORA_BODYPART_0, // ZORA_BODYPART_12 + ZORA_BODYPART_12, // ZORA_BODYPART_13 + ZORA_BODYPART_13, // ZORA_BODYPART_14 +}; + +static u8 sShadowSizes[ZORA_BODYPART_MAX] = { + 0, // ZORA_BODYPART_0 + 0, // ZORA_BODYPART_1 + 0, // ZORA_BODYPART_2 + 0, // ZORA_BODYPART_3 + 0, // ZORA_BODYPART_4 + 0, // ZORA_BODYPART_5 + 0, // ZORA_BODYPART_6 + 0, // ZORA_BODYPART_7 + 0, // ZORA_BODYPART_8 + 0, // ZORA_BODYPART_9 + 0, // ZORA_BODYPART_10 + 0, // ZORA_BODYPART_11 + 0, // ZORA_BODYPART_12 + 0, // ZORA_BODYPART_13 + 0, // ZORA_BODYPART_14 +}; s32 EnZo_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; @@ -142,12 +197,12 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { } this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); - if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) { + if (this->isLeftFootGrounded && !leftWasGrounded && isFootGrounded) { Actor_PlaySfx(&this->actor, sfxId); } this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); - if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) { + if (this->isRightFootGrounded && !rightWasGrounded && isFootGrounded) { Actor_PlaySfx(&this->actor, sfxId); } @@ -173,13 +228,14 @@ void EnZo_UpdateCollider(EnZo* this, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } +static TrackOptionsSet sTrackOptions = { + { 0xFA0, 4, 1, 3 }, + { 0x1770, 4, 1, 6 }, + { 0xFA0, 4, 1, 3 }, + { 0x1770, 4, 1, 6 }, +}; + void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { - static TrackOptionsSet sTrackOptions = { - { 0xFA0, 4, 1, 3 }, - { 0x1770, 4, 1, 6 }, - { 0xFA0, 4, 1, 3 }, - { 0x1770, 4, 1, 6 }, - }; Player* player = GET_PLAYER(play); Vec3f point; @@ -202,7 +258,7 @@ void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { } EnZo_Blink(this, 3); - SubS_FillLimbRotTables(play, this->limbRotY, this->limbRotZ, 20); + SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ZORA_LIMB_MAX); } void EnZo_Walk(EnZo* this, PlayState* play) { @@ -305,8 +361,8 @@ s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if ((limbIndex == ZORA_LIMB_TORSO) || (limbIndex == ZORA_LIMB_LEFT_UPPER_ARM) || (limbIndex == ZORA_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (s16)(Math_SinS(this->limbRotY[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->limbRotZ[limbIndex]) * 200.0f); + rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f); } return false; } @@ -316,15 +372,18 @@ void EnZo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp30 = { 400.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - if (sBodyParts[limbIndex] >= 0) { - Matrix_MultVec3f(&zeroVec, &this->bodyPartsPos[sBodyParts[limbIndex]]); + if (sLimbToBodyParts[limbIndex] > BODYPART_NONE) { + Matrix_MultVec3f(&zeroVec, &this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } + if (limbIndex == ZORA_LIMB_HEAD) { Matrix_MultVec3f(&sp30, &this->actor.focus.pos); } + if (limbIndex == ZORA_LIMB_LEFT_FOOT) { Matrix_MultVec3f(&zeroVec, &this->leftFootPos); } + if (limbIndex == ZORA_LIMB_RIGHT_FOOT) { Matrix_MultVec3f(&zeroVec, &this->rightFootPos); } @@ -366,8 +425,8 @@ void EnZo_Draw(Actor* thisx, PlayState* play) { shadowTexIter++; } for (i = 0; i < 5; i++) { - SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, - ARRAY_COUNT(this->bodyPartsPos), sShadowSizes, sParentBodyParts); + SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, ZORA_BODYPART_MAX, + sShadowSizes, sParentShadowBodyParts); } SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 9d32f63e5..db620def0 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -12,6 +12,25 @@ typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); #define ENZO_PATH_INDEX_NONE 0x3F +typedef enum EnZoBodyPart { + /* 0 */ ZORA_BODYPART_0, + /* 1 */ ZORA_BODYPART_1, + /* 2 */ ZORA_BODYPART_2, + /* 3 */ ZORA_BODYPART_3, + /* 4 */ ZORA_BODYPART_4, + /* 5 */ ZORA_BODYPART_5, + /* 6 */ ZORA_BODYPART_6, + /* 7 */ ZORA_BODYPART_7, + /* 8 */ ZORA_BODYPART_8, + /* 9 */ ZORA_BODYPART_9, + /* 10 */ ZORA_BODYPART_10, + /* 11 */ ZORA_BODYPART_11, + /* 12 */ ZORA_BODYPART_12, + /* 13 */ ZORA_BODYPART_13, + /* 14 */ ZORA_BODYPART_14, + /* 15 */ ZORA_BODYPART_MAX +} EnZoBodyPart; + typedef struct EnZo { /* 0x000 */ Actor actor; /* 0x144 */ EnZoActionFunc actionFunc; @@ -30,9 +49,9 @@ typedef struct EnZo { /* 0x2F4 */ Vec3s headRot; /* 0x2FA */ Vec3s upperBodyRot; /* 0x300 */ UNK_TYPE1 unk_300[0x12]; - /* 0x312 */ s16 limbRotY[20]; - /* 0x33A */ s16 limbRotZ[20]; - /* 0x364 */ Vec3f bodyPartsPos[15]; + /* 0x312 */ s16 fidgetTableY[ZORA_LIMB_MAX]; + /* 0x33A */ s16 fidgetTableZ[ZORA_LIMB_MAX]; + /* 0x364 */ Vec3f bodyPartsPos[ZORA_BODYPART_MAX]; /* 0x41A */ UNK_TYPE1 unk_41A[0x6]; /* 0x41E */ s16 eyeIndex; /* 0x420 */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index cdf6b1766..68dbd0e48 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -7,7 +7,7 @@ #include "z_en_zob.h" #include "objects/object_zob/object_zob.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnZob*)thisx) @@ -210,7 +210,7 @@ void func_80B9FA3C(EnZob* this, PlayState* play) { this->unk_2F4 |= 1; - if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM != PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_30_02)) { textId = 0x11F9; } else { @@ -268,7 +268,7 @@ void func_80B9FC70(EnZob* this, s16 csIdIndex) { void func_80B9FCA0(EnZob* this, PlayState* play) { Message_CloseTextbox(play); - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; func_80B9FC0C(this); this->unk_2F4 &= ~1; this->actionFunc = func_80BA0728; @@ -315,7 +315,7 @@ void func_80B9FE1C(EnZob* this, PlayState* play) { void func_80B9FE5C(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (play->msgCtx.ocarinaMode == 3) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { play->msgCtx.msgLength = 0; this->actionFunc = func_80B9FDDC; func_80B9FC70(this, 0); @@ -331,7 +331,7 @@ void func_80B9FE5C(EnZob* this, PlayState* play) { void func_80B9FF20(EnZob* this, PlayState* play) { func_80B9F86C(this); if (Message_GetState(&play->msgCtx) == TEXT_STATE_7) { - func_80152434(play, 0x42); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_PROMPT_EVAN_PART2_SECOND_HALF); this->actionFunc = func_80B9FE5C; func_80B9FC70(this, 2); } @@ -339,11 +339,11 @@ void func_80B9FF20(EnZob* this, PlayState* play) { void func_80B9FF80(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (play->msgCtx.ocarinaMode == 3) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { this->actionFunc = func_80B9FF20; this->unk_304 = 6; func_80B9F7E4(this, 1, ANIMMODE_LOOP); - func_80152434(play, 0x3E); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_DEMONSTRATE_EVAN_PART2_FIRST_HALF); func_80B9FC70(this, 1); } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_11) { play->msgCtx.msgLength = 0; @@ -357,7 +357,7 @@ void func_80B9FF80(EnZob* this, PlayState* play) { void func_80BA005C(EnZob* this, PlayState* play) { func_80B9F86C(this); if (Message_GetState(&play->msgCtx) == TEXT_STATE_7) { - func_80152434(play, 0x41); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_PROMPT_EVAN_PART1_SECOND_HALF); this->actionFunc = func_80B9FF80; func_80B9FC70(this, 2); } @@ -371,14 +371,14 @@ void func_80BA00BC(EnZob* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1212)) { switch (play->msgCtx.choiceIndex) { case 1: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x1209); this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); break; case 0: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1213); break; } @@ -426,7 +426,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { break; case 0x1209: - func_80152434(play, 0x3D); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_DEMONSTRATE_EVAN_PART1_FIRST_HALF); this->unk_304 = 4; func_80B9F7E4(this, 0, ANIMMODE_LOOP); this->actionFunc = func_80BA005C; @@ -439,7 +439,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { } void func_80BA0318(EnZob* this, PlayState* play) { - func_80152434(play, 0x3D); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_DEMONSTRATE_EVAN_PART1_FIRST_HALF); this->unk_304 = 4; func_80B9F7E4(this, 0, ANIMMODE_LOOP); this->actionFunc = func_80BA005C; @@ -456,13 +456,13 @@ void func_80BA0374(EnZob* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1205)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x1207); func_80B9F7E4(this, 2, ANIMMODE_ONCE); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1206); break; } @@ -543,7 +543,7 @@ void func_80BA0610(EnZob* this, PlayState* play) { func_80B9FC70(this, 0); this->actionFunc = func_80BA00BC; } else { - func_800B8614(&this->actor, play, 500.0f); + Actor_OfferTalk(&this->actor, play, 500.0f); } } @@ -558,12 +558,12 @@ void func_80BA06BC(EnZob* this, PlayState* play) { void func_80BA0728(EnZob* this, PlayState* play) { s32 pad; - Vec3f sp28; + Vec3f seqPos; func_80B9F86C(this); if (func_800B8718(&this->actor, &play->state)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { Message_StartTextbox(play, 0x1208, NULL); SET_WEEKEVENTREG(WEEKEVENTREG_30_08); } else { @@ -581,20 +581,20 @@ void func_80BA0728(EnZob* this, PlayState* play) { this->actionFunc = func_80BA06BC; } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 60.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); func_800B874C(&this->actor, play, 200.0f, 150.0f); } - sp28.x = this->actor.projectedPos.x; - sp28.y = this->actor.projectedPos.y; - sp28.z = this->actor.projectedPos.z; - func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_BASS_PLAY, 1000.0f); + seqPos.x = this->actor.projectedPos.x; + seqPos.y = this->actor.projectedPos.y; + seqPos.z = this->actor.projectedPos.z; + Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_BASS_PLAY, 1000.0f); } void func_80BA08E8(EnZob* this, PlayState* play) { s32 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1257; this->unk_304 = 3; @@ -658,7 +658,7 @@ void func_80BA0AD8(EnZob* this, PlayState* play) { func_80BA08E8(this, play); } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index d032b6579..f30aa51b8 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -6,7 +6,7 @@ #include "z_en_zod.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnZod*)thisx) @@ -124,7 +124,7 @@ void EnZod_Init(Actor* thisx, PlayState* play) { } this->actionFunc = func_80BAFB84; - if (!(CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE))) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); break; } @@ -154,7 +154,7 @@ void EnZod_Destroy(Actor* thisx, PlayState* play) { void EnZod_HandleRoomConversation(EnZod* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM != PLAYER_FORM_ZORA) { textId = 0x1227; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_08)) { textId = 0x1229; @@ -315,12 +315,12 @@ void func_80BAF7CC(EnZod* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x121F)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x1220); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1223); break; } @@ -380,20 +380,20 @@ void EnZod_PlayDrumsSequence(EnZod* this, PlayState* play) { EnZod_HandleRoomConversation(this, play); this->actionFunc = func_80BAF7CC; } else if (EnZod_PlayerIsFacingTijo(this, play)) { - func_800B8614(&this->actor, play, 210.0f); + Actor_OfferTalk(&this->actor, play, 210.0f); } seqPos.x = this->actor.projectedPos.x; seqPos.y = this->actor.projectedPos.y; seqPos.z = this->actor.projectedPos.z; - func_801A1FB4(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_DRUMS_PLAY, 700.0f); + Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_DRUMS_PLAY, 700.0f); } void func_80BAFA44(EnZod* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1253; } else { @@ -436,7 +436,7 @@ void func_80BAFB84(EnZod* this, PlayState* play) { func_80BAFA44(this, play); this->actionFunc = func_80BAFADC; } else if (EnZod_PlayerIsFacingTijo(this, play)) { - func_800B8614(&this->actor, play, 210.0f); + Actor_OfferTalk(&this->actor, play, 210.0f); } } @@ -480,7 +480,7 @@ void func_80BAFDB4(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_Start(this->actor.csId, &this->actor); - func_800B7298(play, NULL, 0x44); + func_800B7298(play, NULL, PLAYER_CSMODE_68); Message_StartTextbox(play, 0x103A, &this->actor); this->actionFunc = EnZod_SetupRehearse; } else { @@ -622,7 +622,7 @@ void EnZod_DrawDrums(EnZod* this, PlayState* play) { } void EnZod_Draw(Actor* thisx, PlayState* play) { - static TexturePtr sTijoEyesTextures[] = { &gTijoEyesOpen, &gTijoEyesHalfOpen, &gTijoEyesClosed }; + static TexturePtr sTijoEyesTextures[] = { &gTijoEyesOpenTex, &gTijoEyesHalfOpenTex, &gTijoEyesClosedTex }; EnZod* this = THIS; Gfx* gfx; diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 96de52b88..92fa313a6 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -7,7 +7,7 @@ #include "z_en_zog.h" #include "objects/object_zog/object_zog.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnZog*)thisx) @@ -627,15 +627,14 @@ void func_80B9451C(EnZog* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_300 = 2; this->actionFunc = func_80B94470; - } else if ((play->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + } else if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; } } else if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); } func_80B943EC(this, play); } @@ -667,14 +666,14 @@ void func_80B946FC(EnZog* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); play->msgCtx.msgLength = 0; this->actionFunc = func_80B946B4; func_80B93BA8(this, 1); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1014); break; } @@ -716,9 +715,8 @@ void func_80B948A8(EnZog* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_300 = 2; this->actionFunc = func_80B946FC; - } else if ((play->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + } else if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; @@ -734,7 +732,7 @@ void func_80B948A8(EnZog* this, PlayState* play) { } if ((this->unk_302 == 0) && (this->actor.xzDistToPlayer < 120.0f)) { - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); } } func_80B93A48(this, play); @@ -908,7 +906,7 @@ void func_80B94E34(EnZog* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_88_10); } else if ((this->actor.yawTowardsPlayer > 16000) && (this->actor.yawTowardsPlayer < 32000) && (this->unk_302 == 0)) { - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -941,7 +939,7 @@ void func_80B95128(EnZog* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; SET_WEEKEVENTREG(WEEKEVENTREG_91_01); } else { - func_800B8614(&this->actor, play, 150.0f); + Actor_OfferTalk(&this->actor, play, 150.0f); } this->actor.shape.rot.y = this->actor.world.rot.y; func_80B93A48(this, play); diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 0bfc986dc..6440493cf 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -98,15 +98,15 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -10.0f; this->actor.gravity = -5.0f; - switch (ENZORAEGG_GET_1F(&this->actor)) { - case ENZORAEGG_1F_00: - if (Flags_GetSwitch(play, ENZORAEGG_GET_FE00(&this->actor))) { + switch (ZORA_EGG_GET_TYPE(&this->actor)) { + case ZORA_EGG_TYPE_00: + if (Flags_GetSwitch(play, ZORA_EGG_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } break; - case ENZORAEGG_1F_11: + case ZORA_EGG_TYPE_11: if (func_80B319A8(play) >= 7) { Actor_Kill(&this->actor); this->actor.home.rot.z = 1; @@ -114,26 +114,26 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { } break; - case ENZORAEGG_1F_03: - case ENZORAEGG_1F_04: - case ENZORAEGG_1F_05: - case ENZORAEGG_1F_06: - case ENZORAEGG_1F_07: - case ENZORAEGG_1F_08: - case ENZORAEGG_1F_09: + case ZORA_EGG_TYPE_03: + case ZORA_EGG_TYPE_04: + case ZORA_EGG_TYPE_05: + case ZORA_EGG_TYPE_06: + case ZORA_EGG_TYPE_07: + case ZORA_EGG_TYPE_08: + case ZORA_EGG_TYPE_09: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; } break; - case ENZORAEGG_1F_0A: - case ENZORAEGG_1F_0B: - case ENZORAEGG_1F_0C: - case ENZORAEGG_1F_0D: - case ENZORAEGG_1F_0E: - case ENZORAEGG_1F_0F: - case ENZORAEGG_1F_10: + case ZORA_EGG_TYPE_0A: + case ZORA_EGG_TYPE_0B: + case ZORA_EGG_TYPE_0C: + case ZORA_EGG_TYPE_0D: + case ZORA_EGG_TYPE_0E: + case ZORA_EGG_TYPE_0F: + case ZORA_EGG_TYPE_10: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_19_40)) { Actor_Kill(&this->actor); return; @@ -141,50 +141,50 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { break; } - switch (ENZORAEGG_GET_1F(&this->actor)) { - case ENZORAEGG_1F_00: + switch (ZORA_EGG_GET_TYPE(&this->actor)) { + case ZORA_EGG_TYPE_00: this->actionFunc = func_80B320E0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.targetMode = 3; + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); + this->actor.targetMode = TARGET_MODE_3; break; - case ENZORAEGG_1F_01: + case ZORA_EGG_TYPE_01: this->actionFunc = func_80B322BC; func_80B31590(this); break; - case ENZORAEGG_1F_02: + case ZORA_EGG_TYPE_02: this->actionFunc = func_80B32390; func_80B31590(this); break; - case ENZORAEGG_1F_03: - case ENZORAEGG_1F_04: - case ENZORAEGG_1F_05: - case ENZORAEGG_1F_06: - case ENZORAEGG_1F_07: - case ENZORAEGG_1F_08: - case ENZORAEGG_1F_09: - this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03]; + case ZORA_EGG_TYPE_03: + case ZORA_EGG_TYPE_04: + case ZORA_EGG_TYPE_05: + case ZORA_EGG_TYPE_06: + case ZORA_EGG_TYPE_07: + case ZORA_EGG_TYPE_08: + case ZORA_EGG_TYPE_09: + this->cueType = cueTypes[ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_03]; Animation_PlayOnce(&this->skelAnime, &object_zoraegg_Anim_001E08); this->unk_1EC = 1; this->unk_1EE = 0; this->unk_1EF = 0; this->actionFunc = func_80B32B10; - if (((ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03) >= func_80B319A8(play)) { + if ((ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_03) >= func_80B319A8(play)) { this->actionFunc = func_80B32B3C; this->actor.draw = NULL; } break; - case ENZORAEGG_1F_0A: - case ENZORAEGG_1F_0B: - case ENZORAEGG_1F_0C: - case ENZORAEGG_1F_0D: - case ENZORAEGG_1F_0E: - case ENZORAEGG_1F_0F: - case ENZORAEGG_1F_10: - this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_0A]; + case ZORA_EGG_TYPE_0A: + case ZORA_EGG_TYPE_0B: + case ZORA_EGG_TYPE_0C: + case ZORA_EGG_TYPE_0D: + case ZORA_EGG_TYPE_0E: + case ZORA_EGG_TYPE_0F: + case ZORA_EGG_TYPE_10: + this->cueType = cueTypes[ZORA_EGG_GET_TYPE(&this->actor) - ZORA_EGG_TYPE_0A]; this->unk_1EC = 2; this->actionFunc = func_80B324B0; Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); @@ -193,7 +193,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { this->unk_1EA |= 3; break; - case ENZORAEGG_1F_11: + case ZORA_EGG_TYPE_11: Actor_SetScale(&this->actor, 0.0006f); this->actionFunc = func_80B32D08; this->actor.world.pos.y -= this->actor.shape.yOffset * this->actor.scale.y; @@ -254,7 +254,7 @@ Actor* func_80B31CB4(PlayState* play) { Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { - if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_11) && + if ((actor->id == ACTOR_EN_ZORAEGG) && (ZORA_EGG_GET_TYPE(actor) == ZORA_EGG_TYPE_11) && (actor->home.rot.z == 0)) { actor->home.rot.z = 1; return actor; @@ -268,7 +268,7 @@ Actor* func_80B31D14(PlayState* play) { Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { - if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_03)) { + if ((actor->id == ACTOR_EN_ZORAEGG) && (ZORA_EGG_GET_TYPE(actor) == ZORA_EGG_TYPE_03)) { return actor; } actor = actor->next; @@ -337,20 +337,20 @@ void func_80B32094(EnZoraegg* this, PlayState* play) { void func_80B320E0(EnZoraegg* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - Flags_SetSwitch(play, ENZORAEGG_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ZORA_EGG_GET_SWITCH_FLAG(&this->actor)); Actor_Kill(&this->actor); } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B32094; Message_StartTextbox(play, 0x24B, &this->actor); } else { Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 60.0f); - if (this->actor.isTargeted) { - func_800B8614(&this->actor, play, 110.0f); + if (this->actor.isLockedOn) { + Actor_OfferTalk(&this->actor, play, 110.0f); } } - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.targetMode = 3; + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); + this->actor.targetMode = TARGET_MODE_3; func_80B31C40(this, play); } @@ -701,7 +701,7 @@ void func_80B32F04(Actor* thisx, PlayState* play) { gfx = POLY_XLU_DISP; gfx = Gfx_SetupDL20_NoCD(gfx); - gSPSetOtherMode(gfx++, G_SETOTHERMODE_H, 4, 4, 0x00000080); + gDPSetDither(gfx++, G_CD_NOISE); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h index f8895af3f..84fce59df 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h @@ -7,37 +7,39 @@ struct EnZoraegg; typedef void (*EnZoraeggActionFunc)(struct EnZoraegg*, PlayState*); -#define ENZORAEGG_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENZORAEGG_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) +#define ZORA_EGG_GET_TYPE(thisx) ((thisx)->params & 0x1F) +#define ZORA_EGG_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) + +#define ZORA_EGG_PARAMS(type, switchFlag) (((type) & 0x1F) | (((switchFlag) & 0x7F) << 9)) typedef enum { - /* 0x00 */ ENZORAEGG_1F_00, - /* 0x01 */ ENZORAEGG_1F_01, - /* 0x02 */ ENZORAEGG_1F_02, - /* 0x03 */ ENZORAEGG_1F_03, - /* 0x04 */ ENZORAEGG_1F_04, - /* 0x05 */ ENZORAEGG_1F_05, - /* 0x06 */ ENZORAEGG_1F_06, - /* 0x07 */ ENZORAEGG_1F_07, - /* 0x08 */ ENZORAEGG_1F_08, - /* 0x09 */ ENZORAEGG_1F_09, - /* 0x0A */ ENZORAEGG_1F_0A, - /* 0x0B */ ENZORAEGG_1F_0B, - /* 0x0C */ ENZORAEGG_1F_0C, - /* 0x0D */ ENZORAEGG_1F_0D, - /* 0x0E */ ENZORAEGG_1F_0E, - /* 0x0F */ ENZORAEGG_1F_0F, - /* 0x10 */ ENZORAEGG_1F_10, - /* 0x11 */ ENZORAEGG_1F_11, - /* 0x12 */ ENZORAEGG_1F_12, - /* 0x13 */ ENZORAEGG_1F_13, - /* 0x14 */ ENZORAEGG_1F_14, - /* 0x15 */ ENZORAEGG_1F_15, - /* 0x16 */ ENZORAEGG_1F_16, - /* 0x17 */ ENZORAEGG_1F_17, - /* 0x18 */ ENZORAEGG_1F_18, - /* 0x19 */ ENZORAEGG_1F_19 -} EnZoraeggParam; + /* 0x00 */ ZORA_EGG_TYPE_00, + /* 0x01 */ ZORA_EGG_TYPE_01, + /* 0x02 */ ZORA_EGG_TYPE_02, + /* 0x03 */ ZORA_EGG_TYPE_03, + /* 0x04 */ ZORA_EGG_TYPE_04, + /* 0x05 */ ZORA_EGG_TYPE_05, + /* 0x06 */ ZORA_EGG_TYPE_06, + /* 0x07 */ ZORA_EGG_TYPE_07, + /* 0x08 */ ZORA_EGG_TYPE_08, + /* 0x09 */ ZORA_EGG_TYPE_09, + /* 0x0A */ ZORA_EGG_TYPE_0A, + /* 0x0B */ ZORA_EGG_TYPE_0B, + /* 0x0C */ ZORA_EGG_TYPE_0C, + /* 0x0D */ ZORA_EGG_TYPE_0D, + /* 0x0E */ ZORA_EGG_TYPE_0E, + /* 0x0F */ ZORA_EGG_TYPE_0F, + /* 0x10 */ ZORA_EGG_TYPE_10, + /* 0x11 */ ZORA_EGG_TYPE_11, + /* 0x12 */ ZORA_EGG_TYPE_12, + /* 0x13 */ ZORA_EGG_TYPE_13, + /* 0x14 */ ZORA_EGG_TYPE_14, + /* 0x15 */ ZORA_EGG_TYPE_15, + /* 0x16 */ ZORA_EGG_TYPE_16, + /* 0x17 */ ZORA_EGG_TYPE_17, + /* 0x18 */ ZORA_EGG_TYPE_18, + /* 0x19 */ ZORA_EGG_TYPE_19 +} ZoraEggType; typedef struct EnZoraegg { /* 0x000 */ Actor actor; 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 c3192cec1..249b8f6bb 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -6,7 +6,7 @@ #include "z_en_zos.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_2000000) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_2000000) #define THIS ((EnZos*)thisx) @@ -138,7 +138,7 @@ static AnimationHeader* sAnimations[] = { &gEvanLeanOnKeyboardAnim, // EN_ZOS_ANIM_LEAN_ON_KEYBOARD &gEvanLeanOnKeyboardAndSighAnim, // EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH &gEvanHandsOnHipsAnim, // EN_ZOS_ANIM_HANDS_ON_HIPS - &gEeanTalkFootTapAnim, // EN_ZOS_ANIM_TALK_FOOT_TAP + &gEvanTalkFootTapAnim, // EN_ZOS_ANIM_TALK_FOOT_TAP &gEvanTalkLookDownAnim, // EN_ZOS_ANIM_TALK_LOOK_DOWN &gEvanTalkArmsOutAnim, // EN_ZOS_ANIM_TALK_ARMS_OUT &gEvanTalkHandsOnHipsAnim, // EN_ZOS_ANIM_TALK_HANDS_ON_HIPS @@ -214,7 +214,7 @@ void func_80BBB0D4(EnZos* this, PlayState* play) { void func_80BBB15C(EnZos* this, PlayState* play) { s32 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (this->unk_2B6 & 8) { textId = 0x1235; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); @@ -254,7 +254,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -266,7 +266,7 @@ void func_80BBB354(EnZos* this, PlayState* play) { this->actionFunc = func_80BBB2C4; SET_WEEKEVENTREG(WEEKEVENTREG_39_20); this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_20)) { getItemId = GI_RUPEE_PURPLE; @@ -414,93 +414,92 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { } } - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - switch (play->msgCtx.currentTextId) { - case 0x1237: - player->exchangeItemId = PLAYER_IA_NONE; + if ((Message_GetState(&play->msgCtx) != TEXT_STATE_5) || !Message_ShouldAdvance(play)) { + return; + } - case 0x1238: - case 0x123A: - case 0x123B: - case 0x123C: - case 0x123E: - case 0x123F: - Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); - break; + switch (play->msgCtx.currentTextId) { + case 0x1237: + player->exchangeItemAction = PLAYER_IA_NONE; + // fallthrough + case 0x1238: + case 0x123A: + case 0x123B: + case 0x123C: + case 0x123E: + case 0x123F: + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); + break; - case 0x1244: - this->unk_2B6 &= ~0x10; - EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); - Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); - break; + case 0x1244: + this->unk_2B6 &= ~0x10; + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); + break; - case 0x1232: - case 0x1241: - player->exchangeItemId = PLAYER_IA_NONE; + case 0x1232: + case 0x1241: + player->exchangeItemAction = PLAYER_IA_NONE; + // fallthrough + case 0x1239: + case 0x1246: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); + break; - case 0x1239: - case 0x1246: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); - Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); - break; + case 0x1233: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); + break; - case 0x1233: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); - Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); - break; + case 0x1245: + case 0x1248: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_FOOT_TAP, ANIMMODE_LOOP); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); + break; - case 0x1245: - case 0x1248: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_FOOT_TAP, ANIMMODE_LOOP); - Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); - break; + case 0x1231: + Message_ContinueTextbox(play, 0xFF); + this->actionFunc = func_80BBB718; + break; - case 0x1231: - Message_ContinueTextbox(play, 0xFF); - this->actionFunc = func_80BBB718; - break; + case 0x1243: + case 0x1249: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); + Message_CloseTextbox(play); + this->actionFunc = func_80BBBDE0; + this->unk_2B6 |= 1; + break; - case 0x1243: - case 0x1249: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - Message_CloseTextbox(play); - this->actionFunc = func_80BBBDE0; - this->unk_2B6 |= 1; - break; + case 0x1234: + case 0x123D: + case 0x1242: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); + Actor_ProcessTalkRequest(&this->actor, &play->state); + Message_CloseTextbox(play); + this->actionFunc = func_80BBBDE0; + this->unk_2B6 |= 1; + break; - case 0x1234: - case 0x123D: - case 0x1242: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - Actor_ProcessTalkRequest(&this->actor, &play->state); - Message_CloseTextbox(play); - this->actionFunc = func_80BBBDE0; - this->unk_2B6 |= 1; - break; + case 0x1236: + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); + Message_CloseTextbox(play); + this->actionFunc = func_80BBBDE0; + this->unk_2B6 |= 1; + break; - case 0x1236: - EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - Message_CloseTextbox(play); - this->actionFunc = func_80BBBDE0; - this->unk_2B6 |= 1; - break; - - default: - //! FAKE: - if (1) {} - - Message_CloseTextbox(play); - this->actionFunc = func_80BBBDE0; - this->unk_2B6 |= 1; - break; - } + default: + Message_CloseTextbox(play); + this->actionFunc = func_80BBBDE0; + this->unk_2B6 |= 1; + break; } } void func_80BBBB84(EnZos* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { Message_StartTextbox(play, 0x1248, &this->actor); this->actionFunc = func_80BBB8AC; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); @@ -517,7 +516,7 @@ void func_80BBBB84(EnZos* this, PlayState* play) { this->unk_2B6 |= 0x10; } } else { - func_800B8614(&this->actor, play, 300.0f); + Actor_OfferTalk(&this->actor, play, 300.0f); } } @@ -528,7 +527,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -537,13 +536,13 @@ void func_80BBBD5C(EnZos* this, PlayState* play) { if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) { this->actionFunc = func_80BBBCBC; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } void func_80BBBDE0(EnZos* this, PlayState* play) { Actor* thisx = &this->actor; - Vec3f sp28; + Vec3f seqPos; if (this->unk_2B6 & 1) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200); @@ -556,11 +555,11 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { func_80BBB0D4(this, play); - if (play->msgCtx.ocarinaMode == 0x2A) { - play->msgCtx.ocarinaMode = 4; + if (play->msgCtx.ocarinaMode == OCARINA_MODE_PLAYED_FULL_EVAN_SONG) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; this->actionFunc = func_80BBBB84; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); return; } @@ -570,7 +569,7 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) { this->actionFunc = func_80BBBD5C; } else if (func_80BBAF5C(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } if (!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 100.0f)) { @@ -579,16 +578,16 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_10); } - sp28.x = this->actor.projectedPos.x; - sp28.y = this->actor.projectedPos.y; - sp28.z = this->actor.projectedPos.z; - func_801A1FB4(SEQ_PLAYER_BGM_SUB, &sp28, NA_BGM_PIANO_PLAY, 1000.0f); + seqPos.x = this->actor.projectedPos.x; + seqPos.y = this->actor.projectedPos.y; + seqPos.z = this->actor.projectedPos.z; + Audio_PlaySequenceAtPos(SEQ_PLAYER_BGM_SUB, &seqPos, NA_BGM_PIANO_PLAY, 1000.0f); } void func_80BBBFBC(EnZos* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x125B; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_80)) { @@ -646,7 +645,7 @@ void func_80BBC14C(EnZos* this, PlayState* play) { this->actionFunc = func_80BBC070; func_80BBBFBC(this, play); } else if (func_80BBAF5C(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } 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 1493759a5..57689ebd8 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -8,7 +8,7 @@ #include "z64snap.h" #include "objects/object_zo/object_zo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnZot*)thisx) @@ -96,7 +96,7 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { this->unk_2F4 = 0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.world.rot.z = this->actor.shape.rot.z = 0; - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.terminalVelocity = -4.0f; this->actor.gravity = -4.0f; @@ -361,7 +361,7 @@ void func_80B97100(EnZot* this, PlayState* play) { void func_80B97110(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { textId = 0x125F; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_28_80)) { textId = 0x1261; @@ -404,7 +404,7 @@ void func_80B97240(EnZot* this, PlayState* play) { func_80B97110(this, play); } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -412,7 +412,7 @@ void func_80B972E8(EnZot* this, PlayState* play) { u16 textId; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_10)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { textId = 0x126A; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_01)) { textId = 0x126D; @@ -427,7 +427,7 @@ void func_80B972E8(EnZot* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_29_02); } } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { textId = 0x1265; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_29_04)) { textId = 0x1266; @@ -517,7 +517,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, PLAYER_IA_NONE); + Actor_OfferTalkExchange(&this->actor, play, 10000.0f, 1000.0f, PLAYER_IA_NONE); } } @@ -533,6 +533,7 @@ void func_80B9765C(EnZot* this, PlayState* play) { case 0x126B: Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; + default: Message_CloseTextbox(play); this->actionFunc = func_80B97708; @@ -564,12 +565,12 @@ void func_80B97708(EnZot* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_29_10); this->actor.flags |= ACTOR_FLAG_10000; if (phi_v1 == 5) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { this->actor.textId = 0x126E; } else { this->actor.textId = 0x1272; } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { this->actor.textId = 0x1273; } else { this->actor.textId = 0x1276; @@ -578,7 +579,7 @@ void func_80B97708(EnZot* this, PlayState* play) { func_80B975F8(this, play); this->actionFunc = func_80B975F8; } else if (func_80B96DF0(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -586,7 +587,7 @@ void func_80B9787C(EnZot* this, PlayState* play) { u16 textId; if (this->actor.textId == 0) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { switch (ENZOT_GET_1F(&this->actor)) { case 2: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_37_40)) { @@ -702,14 +703,14 @@ void func_80B97B5C(EnZot* this, PlayState* play) { this->actionFunc = func_80B97A44; func_80B9787C(this, play); } else if (func_80B96DF0(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } void func_80B97BF8(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { textId = 0x128C; } else { textId = 0x128B; @@ -731,7 +732,7 @@ void func_80B97CC8(EnZot* this, PlayState* play) { this->actionFunc = func_80B97C40; Message_StartTextbox(play, 0x128B, &this->actor); } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -808,13 +809,13 @@ void func_80B97FD0(EnZot* this, PlayState* play) { this->actionFunc = func_80B97E4C; func_80B97BF8(this, play); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_38_08)) { - if ((this->actor.xzDistToPlayer < 120.0f) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { + if ((this->actor.xzDistToPlayer < 120.0f) && (GET_PLAYER_FORM == PLAYER_FORM_ZORA)) { this->unk_2F2 |= 4; this->actionFunc = func_80B97E0C; func_80B96BEC(this, 6, ANIMMODE_ONCE); } } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -838,7 +839,7 @@ void func_80B98178(EnZot* this, PlayState* play) { switch (ENZOT_GET_1F(&this->actor)) { case 6: - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CURRENT_DAY == 3) { textId = 0x129D; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_01)) { @@ -856,14 +857,14 @@ void func_80B98178(EnZot* this, PlayState* play) { break; case 7: - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_04)) { textId = 0x12AA; } else { textId = 0x12A6; SET_WEEKEVENTREG(WEEKEVENTREG_39_04); } - } else if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { + } else if (Flags_GetSwitch(play, ENZOT_GET_SWITCH_FLAG(&this->actor))) { textId = 0x12A0; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_02)) { textId = 0x12A5; @@ -885,14 +886,14 @@ void func_80B98178(EnZot* this, PlayState* play) { phi_v0 += 2; } - if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM != PLAYER_FORM_ZORA) { phi_v0++; } textId = phi_v0 + 0x1302; break; default: - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { textId = 0x129F; } else { textId = 0x1295; @@ -935,7 +936,7 @@ void func_80B9849C(EnZot* this, PlayState* play) { } this->actionFunc = func_80B98728; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } @@ -945,7 +946,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, PLAYER_IA_MINUS1); + Actor_OfferTalkExchange(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { Actor_OfferGetItem(&this->actor, play, this->unk_2D4, 10000.0f, 50.0f); } @@ -961,7 +962,7 @@ void func_80B985EC(EnZot* this, PlayState* play) { if (itemAction > PLAYER_IA_NONE) { Message_CloseTextbox(play); - if ((itemAction == PLAYER_IA_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && + if ((itemAction == PLAYER_IA_PICTOGRAPH_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && Snap_CheckFlag(PICTO_VALID_LULU_HEAD)) { if (Snap_CheckFlag(PICTO_VALID_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTO_VALID_LULU_LEFT_ARM)) { player->actor.textId = 0x12AE; @@ -988,12 +989,12 @@ void func_80B98728(EnZot* this, PlayState* play) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1293)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); Message_ContinueTextbox(play, 0x1294); break; case 1: - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_ContinueTextbox(play, 0x1298); break; } @@ -1073,14 +1074,14 @@ void func_80B98998(EnZot* this, PlayState* play) { func_80B98178(this, play); } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x7000)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } void func_80B98A4C(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_80)) { textId = 0x12B6; } else { @@ -1139,26 +1140,26 @@ void func_80B98BF4(EnZot* this, PlayState* play) { this->actionFunc = func_80B98AD0; } } else { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } void func_80B98CA8(EnZot* this, PlayState* play) { if (func_800B8718(&this->actor, &play->state)) { - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; AudioOcarina_StartDefault(0xFFFF); this->actionFunc = func_80B98BF4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B98AD0; func_80B98A4C(this, play); } else { if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } - if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { + if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { func_800B874C(&this->actor, play, 120.0, 100.0f); } } @@ -1171,8 +1172,8 @@ void func_80B98CA8(EnZot* this, PlayState* play) { void func_80B98E10(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { + if (Flags_GetSwitch(play, ENZOT_GET_SWITCH_FLAG(&this->actor))) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_04)) { textId = 0x12C5; } else { @@ -1186,7 +1187,7 @@ void func_80B98E10(EnZot* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_40_02); } } else { - if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { + if (Flags_GetSwitch(play, ENZOT_GET_SWITCH_FLAG(&this->actor))) { if (this->unk_2F2 & 0x10) { textId = 0x12BF; } else { @@ -1251,14 +1252,14 @@ void func_80B990A4(EnZot* this, PlayState* play) { this->actionFunc = func_80B98F94; func_80B98E10(this, play); } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } } void func_80B99160(EnZot* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_40_10)) { textId = 0x12CD; } else { @@ -1275,8 +1276,7 @@ void func_80B99160(EnZot* this, PlayState* play) { } void func_80B991E4(EnZot* this, PlayState* play) { - if (1) { - do { } while (0); } + if (1) {} Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1303,7 +1303,7 @@ void func_80B992C0(EnZot* this, PlayState* play) { func_80B96BEC(this, 0, ANIMMODE_LOOP); } else { if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, play, 120.0f); + Actor_OfferTalk(&this->actor, play, 120.0f); } this->actor.speed = 1.5f; func_80B96FB0(this); diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.h b/src/overlays/actors/ovl_En_Zot/z_en_zot.h index e2c43baa3..b6b67abb4 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.h +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.h @@ -9,6 +9,7 @@ typedef void (*EnZotActionFunc)(struct EnZot*, PlayState*); #define ENZOT_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENZOT_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENZOT_GET_SWITCH_FLAG(thisx) (((thisx)->home.rot.z) & 0x7F) #define ENZOT_PATH_INDEX_NONE 0x3F 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 fdf50a820..8e85f4675 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -5,10 +5,9 @@ */ #include "z_en_zov.h" -#include "objects/object_zov/object_zov.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((EnZov*)thisx) @@ -60,20 +59,20 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -static AnimationHeader* D_80BD270C[] = { - &object_zov_Anim_00D3EC, &object_zov_Anim_008120, &object_zov_Anim_00B4CC, &object_zov_Anim_00A888, - &object_zov_Anim_00C510, &object_zov_Anim_00CAA8, &object_zov_Anim_008120, &object_zov_Anim_00A888, - &object_zov_Anim_002B5C, &object_zov_Anim_00418C, &object_zov_Anim_005A6C, &object_zov_Anim_0066A4, - &object_zov_Anim_0017D4, &object_zov_Anim_0023F4, +static AnimationHeader* sAnimations[] = { + &gLuluLookDownAnim, &gLuluPutHandsDownAnim, &gLuluLookForwardAndDownAnim, &gLuluLookAroundAnim, + &gLuluAngleHeadAnim, &gLuluNodAnim, &gLuluPutHandsDownAnim, &gLuluLookAroundAnim, + &gLuluSingStartAnim, &gLuluSingLoopAnim, &gLuluLookForwardAndLeftAnim, &gLuluLookLeftLoopAnim, + &gLuluTurnAndWalkAnim, &gLuluWalkLoopAnim, }; static Vec3f D_80BD2744 = { 400.0f, 600.0f, 0.0f }; static Vec3f D_80BD2750 = { 400.0f, 600.0f, 0.0f }; -static TexturePtr D_80BD275C[] = { object_zov_Tex_013C38, object_zov_Tex_015138, object_zov_Tex_014138 }; +static TexturePtr sEyeTextures[] = { gLuluEyeOpenTex, gLuluEyeHalfTex, gLuluEyeClosedTex }; -static TexturePtr D_80BD2768[] = { object_zov_Tex_0135F8, object_zov_Tex_014538 }; +static TexturePtr sMouthTextures[] = { gLuluMouthClosedTex, gLuluMouthOpenTex }; static s8 D_80BD2770[] = { 1, 2, 1, 0, 0, 1, 2, 1, @@ -86,9 +85,9 @@ void EnZov_Init(Actor* thisx, PlayState* play) { 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); + SkelAnime_InitFlex(play, &this->skelAnime, &gLuluSkel, &gLuluLookDownAnim, this->jointTable, this->morphTable, + LULU_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gLuluLookDownAnim); this->unk_320 = 0; this->csIdIndex = -1; @@ -147,10 +146,10 @@ void func_80BD1440(EnZov* this, s16 arg1) { this->csIdIndex = arg1; } -void func_80BD1470(EnZov* this, s16 index, u8 mode, f32 transitionRate) { +void func_80BD1470(EnZov* this, s16 index, u8 mode, f32 morphFrames) { f32 frame; - if (((index != this->unk_322) || (mode != ANIMMODE_LOOP)) && (index >= 0) && (index < ARRAY_COUNT(D_80BD270C))) { + if (((index != this->unk_322) || (mode != ANIMMODE_LOOP)) && (index >= 0) && (index < ARRAY_COUNT(sAnimations))) { switch (index) { case 6: frame = 30.0f; @@ -164,8 +163,8 @@ void func_80BD1470(EnZov* this, s16 index, u8 mode, f32 transitionRate) { frame = 0.0f; break; } - Animation_Change(&this->skelAnime, D_80BD270C[index], 1.0f, frame, Animation_GetLastFrame(D_80BD270C[index]), - mode, transitionRate); + Animation_Change(&this->skelAnime, sAnimations[index], 1.0f, frame, Animation_GetLastFrame(sAnimations[index]), + mode, morphFrames); this->unk_322 = index; } } @@ -187,7 +186,7 @@ void func_80BD160C(EnZov* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { this->unk_320 &= ~2; - if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM != PLAYER_FORM_ZORA) { textId = 0x1024; if ((this->unk_322 == 0) || (this->unk_322 == 4)) { func_80BD1570(this, 4, ANIMMODE_ONCE); @@ -201,7 +200,7 @@ void func_80BD160C(EnZov* this, PlayState* play) { this->unk_320 |= 4; func_80BD1570(this, 3, ANIMMODE_ONCE); } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { func_80BD1570(this, 2, ANIMMODE_ONCE); this->actionFunc = func_80BD19FC; this->unk_324 = 10; @@ -378,7 +377,7 @@ void func_80BD1C84(EnZov* this, PlayState* play) { this->actionFunc = func_80BD187C; func_80BD160C(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->picto.actor, play, 120.0f); + Actor_OfferTalk(&this->picto.actor, play, 120.0f); } if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_504)) { @@ -390,7 +389,7 @@ void func_80BD1C84(EnZov* this, PlayState* play) { void func_80BD1D30(EnZov* this, PlayState* play) { u16 textId; - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1032; } else { @@ -452,7 +451,7 @@ void func_80BD1F1C(EnZov* this, PlayState* play) { this->actionFunc = func_80BD1DB8; func_80BD1D30(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->picto.actor, play, 120.0f); + Actor_OfferTalk(&this->picto.actor, play, 120.0f); } } @@ -521,14 +520,14 @@ void EnZov_Update(Actor* thisx, PlayState* play) { s32 EnZov_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnZov* this = THIS; - if (limbIndex == 12) { + if (limbIndex == LULU_LIMB_HEAD) { rot->x += this->unk_2F0.y; if ((this->unk_320 & 0x10) && (this->unk_322 == 0)) { rot->z += this->unk_2F0.x; } } - if (limbIndex == 11) { + if (limbIndex == LULU_LIMB_TORSO) { rot->x += this->unk_2F6.y; } return false; @@ -537,17 +536,17 @@ s32 EnZov_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnZov_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnZov* this = THIS; - if (limbIndex == 12) { + if (limbIndex == LULU_LIMB_HEAD) { 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; } - if (limbIndex == 18) { + if (limbIndex == LULU_LIMB_RIGHT_UPPER_ARM) { Matrix_MultVec3f(&D_80BD2750, &this->unk_308); } - if (limbIndex == 13) { + if (limbIndex == LULU_LIMB_LEFT_UPPER_ARM) { Matrix_MultVec3f(&D_80BD2750, &this->unk_314); } } @@ -625,8 +624,8 @@ void EnZov_Draw(Actor* thisx, PlayState* play) { } gfx = POLY_OPA_DISP; - gSPSegment(&gfx[0], 0x09, Lib_SegmentedToVirtual(D_80BD275C[phi_v1])); - gSPSegment(&gfx[1], 0x08, Lib_SegmentedToVirtual(D_80BD2768[phi_a1])); + gSPSegment(&gfx[0], 0x09, Lib_SegmentedToVirtual(sEyeTextures[phi_v1])); + gSPSegment(&gfx[1], 0x08, Lib_SegmentedToVirtual(sMouthTextures[phi_a1])); POLY_OPA_DISP = &gfx[2]; CLOSE_DISPS(play->state.gfxCtx); 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 7e1204100..7637bb53e 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.h +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.h @@ -3,6 +3,7 @@ #include "global.h" #include "z64snap.h" +#include "objects/object_zov/object_zov.h" struct EnZov; @@ -16,8 +17,8 @@ typedef void (*EnZovActionFunc)(struct EnZov*, PlayState*); typedef struct EnZov { /* 0x000 */ PictoActor picto; - /* 0x148 */ Vec3s jontTable[23]; - /* 0x1D2 */ Vec3s morphTable[23]; + /* 0x148 */ Vec3s jointTable[LULU_LIMB_MAX]; + /* 0x1D2 */ Vec3s morphTable[LULU_LIMB_MAX]; /* 0x25C */ SkelAnime skelAnime; /* 0x2A0 */ ColliderCylinder collider; /* 0x2EC */ s16 unk_2EC; diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index 334b8fc05..dfcf7225e 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -7,7 +7,7 @@ #include "z_en_zow.h" #include "objects/object_zo/object_zo.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnZow*)thisx) @@ -324,7 +324,7 @@ void EnZow_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.textId = 0; this->actor.world.rot.z = this->actor.shape.rot.z; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } void EnZow_Destroy(Actor* thisx, PlayState* play) { @@ -361,7 +361,7 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { if (ENZOW_GET_F(&this->actor) == ENZOW_F_1) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_04)) { phi_a1 = 0x12FD; } else { @@ -374,7 +374,7 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_78_10); phi_a1 = 0x12FF; } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_08)) { phi_a1 = 0x12F8; } else { @@ -388,12 +388,12 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { phi_a1 = 0x12FF; } } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { phi_a1 = 0x12EC; } else { phi_a1 = 0x12F1; } - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { + } else if (GET_PLAYER_FORM == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_02)) { phi_a1 = 0x12EB; } else { @@ -410,7 +410,7 @@ void func_80BDD350(EnZow* this, PlayState* play) { if (this->unk_2CA & 2) { Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_WATER); func_80BDCDA8(this, this->unk_2D0); - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->skelAnime.playSpeed = 0.0f; this->actor.velocity.y = -4.0f; } @@ -502,7 +502,7 @@ void func_80BDD634(EnZow* this, PlayState* play) { this->actionFunc = func_80BDD570; func_80BDD1E0(this, play); } else if (func_80BDD154(this, play)) { - func_800B8614(&this->actor, play, 180.0f); + Actor_OfferTalk(&this->actor, play, 180.0f); } } @@ -517,7 +517,7 @@ void func_80BDD6BC(EnZow* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); func_80BDCDA8(this, this->unk_2D0); func_80BDD04C(this, 1, ANIMMODE_ONCE); - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.velocity.y = 0.0f; this->actionFunc = func_80BDD634; } else if (this->actor.depthInWater < 80.0f) { diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index c5b218815..e7308c10d 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -55,12 +55,12 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { s32 pad; ItemEtcetera* this = THIS; s32 type = ITEMETCETERA_GET_FF(&this->actor); - s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); + s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[type]); - if (objBankIndex < 0) { + if (objectSlot <= OBJECT_SLOT_NONE) { // assert on debug } else { - this->objIndex = objBankIndex; + this->objectSlot = objectSlot; } this->getItemDrawId = sGetItemDrawIds[type]; this->getItemId = sGetItemIds[type]; @@ -93,8 +93,8 @@ void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) { } void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - this->actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; this->actor.draw = this->drawFunc; this->actionFunc = this->futureActionFunc; } diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index 4ac893ba5..92cda8710 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -32,7 +32,7 @@ typedef struct ItemEtcetera { /* 0x144 */ ItemEtceteraActionFunc futureActionFunc; /* 0x148 */ s16 getItemDrawId; /* 0x14A */ s16 getItemId; - /* 0x14C */ u8 objIndex; + /* 0x14C */ u8 objectSlot; /* 0x150 */ ActorFunc drawFunc; /* 0x154 */ ItemEtceteraActionFunc actionFunc; } ItemEtcetera; // size = 0x158 diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index 0599e117d..0b554f665 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -6,7 +6,7 @@ #include "z_item_inbox.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((ItemInbox*)thisx) diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 61b172ea7..412687b7f 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -383,7 +383,7 @@ void MirRay_Update(Actor* thisx, PlayState* play) { MirRay_MakeShieldLight(this, play); if (this->reflectIntensity > 0.0f) { - func_800B8F98(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); } } } 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 c4e861ff6..d475a263e 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c @@ -92,7 +92,7 @@ void MirRay2_Init(Actor* thisx, PlayState* play) { 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))) { + if ((MIRRAY2_GET_SWITCH_FLAG(thisx) != 0x7F) && !Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAG(thisx))) { this->unk1A4 |= 1; } } @@ -109,7 +109,7 @@ void MirRay2_Update(Actor* thisx, PlayState* play) { MirRay2* this = THIS; if (this->unk1A4 & 1) { - if (Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) { + if (Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAG(thisx))) { this->unk1A4 &= ~1; } } else { 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 4bb40d40d..7325ba2cf 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h @@ -6,7 +6,7 @@ struct MirRay2; #define MIRRAY2_GET_F(thisx) ((thisx)->params & 0xF) -#define MIRRAY2_GET_SWITCH_FLAGS(thisx) (((thisx)->params & 0xFE00) >> 9) +#define MIRRAY2_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) typedef struct MirRay2 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c index ae8c81f26..520684fb7 100644 --- a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c +++ b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c @@ -139,7 +139,7 @@ void MirRay3_Update(Actor* thisx, PlayState* play) { } if (this->unk_214 > 0.1f) { - func_800B8F98(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); } Math_ApproachZeroF(&this->unk_214, 1.0f, 0.1f); 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 ca4efd4bb..7324448a4 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -199,7 +199,7 @@ void func_80ACBD34(ObjAqua* this) { } void func_80ACBD48(ObjAqua* this, PlayState* play) { - if ((AQUA_HOT(&this->actor) == 1) && (this->alpha > 90)) { + if ((AQUA_GET_TYPE(&this->actor) == AQUA_TYPE_HOT) && (this->alpha > 90)) { func_80ACB940(this, play); } if (this->alpha > 5) { @@ -228,7 +228,7 @@ void func_80ACBDFC(ObjAqua* this, PlayState* play) { this->alpha = (s32)(temp * 3.25f) + 10; this->actor.shape.shadowAlpha = this->alpha; this->unk_198 += 1000; - if (AQUA_HOT(&this->actor) == 1) { + if (AQUA_GET_TYPE(&this->actor) == AQUA_TYPE_HOT) { f32 temp_f2 = this->actor.scale.x * 10000.0f; EffectSsBubble_Spawn(play, &this->actor.world.pos, temp_f2 * -0.5f, temp_f2, temp_f2, diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h index a47ea661a..12dcedc1c 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h @@ -3,8 +3,14 @@ #include "global.h" -#define AQUA_HOT(thisx) ((thisx)->params & 1) -#define OBJAQUA_1 1 +#define AQUA_GET_TYPE(thisx) ((thisx)->params & 1) + +#define AQUA_PARAMS(type) ((type) & 1) + +typedef enum { + /* 0 */ AQUA_TYPE_COLD, + /* 1 */ AQUA_TYPE_HOT +} AquaType; struct ObjAqua; diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index f41b8057c..d713c9d04 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -198,7 +198,7 @@ void ObjArmos_Init(Actor* thisx, PlayState* play) { if (sp40 == 0) { func_809A57D8(this); - } else if (Flags_GetSwitch(play, OBJARMOS_GET_7F(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJARMOS_GET_SWITCH_FLAG(&this->dyna.actor))) { if (sp44 == OBJARMOS_ROT_7_0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (sp40 * 60); func_809A57D8(this); @@ -285,7 +285,7 @@ void func_809A562C(ObjArmos* this, PlayState* play) { } } else { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Flags_SetSwitch(play, OBJARMOS_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJARMOS_GET_SWITCH_FLAG(&this->dyna.actor)); sp20 = true; } @@ -298,7 +298,7 @@ void func_809A562C(ObjArmos* this, PlayState* play) { func_809A57D8(this); } } else { - func_800B9010(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h index 4ac83cc9d..af3b31338 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h @@ -8,7 +8,7 @@ struct ObjArmos; typedef void (*ObjArmosActionFunc)(struct ObjArmos*, PlayState*); -#define OBJARMOS_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJARMOS_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJARMOS_GET_ROTZ_7(thisx) ((thisx)->home.rot.z & 7) #define OBJARMOS_GET_ROTX_F(thisx) ((thisx)->home.rot.x & 0xF) 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 003b94932..d5ec2917a 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -275,14 +275,14 @@ s32 func_80937468(ObjBean* this, PlayState* play) { ObjBean* func_809374F8(ObjBean* this, PlayState* play) { Actor* bgActor = play->actorCtx.actorLists[ACTORCAT_BG].first; - s32 params = OBJBEAN_GET_3F80(&this->dyna.actor, 0); + s32 switchFlag = OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 0); while (bgActor != NULL) { if (bgActor->id == ACTOR_OBJ_BEAN) { s32 params2 = OBJBEAN_GET_C000(bgActor); if (!params2 && (bgActor->room == this->dyna.actor.room) && !OBJBEAN_GET_80(bgActor) && - (params == OBJBEAN_GET_7F(bgActor, 0)) && + (switchFlag == OBJBEAN_GET_SWITCH_FLAG_1(bgActor, 0)) && (Math3D_Vec3fDistSq(&bgActor->world.pos, &this->dyna.actor.world.pos) < SQ(10.0f))) { break; } @@ -303,8 +303,8 @@ void func_809375C8(ObjBean* this, PlayState* play) { void func_809375F4(ObjBean* this, PlayState* play) { static Gfx* D_80939024[] = { - gKakeraLeafMiddle, - gKakeraLeafTip, + gKakeraLeafMiddleDL, + gKakeraLeafTipDL, }; Vec3f spC4; Vec3f spB8; @@ -406,12 +406,14 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 8.8f); func_80936CF0(this, play); - if (!OBJBEAN_GET_80(&this->dyna.actor) && Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0)) && - !Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1)) && func_800FE9B4(play)) { - Flags_SetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1)); + if (!OBJBEAN_GET_80(&this->dyna.actor) && + Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 0)) && + !Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 1)) && func_800FE9B4(play)) { + Flags_SetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 1)); } - if (OBJBEAN_GET_80(&this->dyna.actor) || Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1))) { + if (OBJBEAN_GET_80(&this->dyna.actor) || + Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 1))) { func_80938804(this); } else { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); @@ -504,12 +506,12 @@ void func_80937DEC(ObjBean* this, PlayState* play) { this->unk_1FF = false; } - if (this->unk_1FF && !Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)) && - Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0)) && func_800FE9B4(play)) { - Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); + if (this->unk_1FF && !Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 1)) && + Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 0)) && func_800FE9B4(play)) { + Flags_SetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 1)); } - if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1))) { + if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 1))) { Actor_Kill(&this->dyna.actor); return; } @@ -520,7 +522,7 @@ void func_80937DEC(ObjBean* this, PlayState* play) { this->dyna.actor.draw = func_80938E00; } - if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0))) { + if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 0))) { this->unk_1FE |= 5; func_80937C30(this); } else { @@ -528,7 +530,7 @@ void func_80937DEC(ObjBean* this, PlayState* play) { func_80937C10(this); } - if (Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { + if (Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 0))) { this->unk_1E4 = 5; } else { this->unk_1E4 = 0; @@ -546,12 +548,12 @@ void func_80937FC8(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { - if (Player_GetExchangeItemId(play) == PLAYER_IA_MAGIC_BEANS) { + if (Player_GetExchangeItemAction(play) == PLAYER_IA_MAGIC_BEANS) { func_809383B4(this); - Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0)); + Flags_SetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 0)); } - if (Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { + if (Flags_GetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 0))) { this->unk_1E4 = 5; } else { s32 pad; @@ -566,7 +568,7 @@ void func_80937FC8(ObjBean* this, PlayState* play) { ((this->unk_1FF != 0) && (this->unk_1FE & 4) && (this->dyna.actor.xzDistToPlayer < 300.0f) && func_800FE9B4(play))) { func_809375C8(this, play); - Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); + Flags_SetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_2(&this->dyna.actor, 1)); this->unk_1E4 = 6; func_80938670(this); } else if (this->unk_1FF != 0) { @@ -576,7 +578,7 @@ void func_80937FC8(ObjBean* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } else { - func_800B85E0(&this->dyna.actor, play, 28.0f, PLAYER_IA_MAGIC_BEANS); + Actor_OfferTalkExchangeEquiCylinder(&this->dyna.actor, play, 28.0f, PLAYER_IA_MAGIC_BEANS); } } } @@ -597,7 +599,7 @@ void func_809381C4(ObjBean* this, PlayState* play) { func_80938284(this); } else if (this->unk_1E4 == 4) { CutsceneManager_Stop(this->dyna.actor.csId); - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); this->unk_1E4 = 0; func_80937FB0(this); } else { @@ -614,12 +616,12 @@ void func_80938298(ObjBean* this, PlayState* play) { if (this->unk_1E0 >= 3) { this->unk_1E4 = 3; - Flags_SetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0)); + Flags_SetSwitch(play, OBJBEAN_GET_SWITCH_FLAG_1(&this->dyna.actor, 0)); this->unk_1E4 = 5; func_8093833C(this); } else if (this->unk_1E4 == 4) { CutsceneManager_Stop(this->dyna.actor.csId); - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); this->unk_1E4 = 0; func_80937FB0(this); } @@ -670,7 +672,7 @@ void func_80938444(ObjBean* this, PlayState* play) { } else { this->unk_1B2 = 1; } - func_800B9010(&this->dyna.actor, NA_SE_PL_PLANT_GROW_UP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_PL_PLANT_GROW_UP - SFX_FLAG); } void func_809384E8(ObjBean* this) { @@ -785,7 +787,7 @@ void func_809388A8(ObjBean* this, PlayState* play) { func_809372A8(this); func_8093892C(this); } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { - func_800B9010(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); } func_80936F24(this); } @@ -889,7 +891,7 @@ void func_80938C1C(Actor* thisx, PlayState* play) { if (this->unk_1DF > 0) { this->unk_1DF--; if (this->unk_1DF == 0) { - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h index 1a22de390..f21610891 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -8,10 +8,10 @@ struct ObjBean; typedef void (*ObjBeanActionFunc)(struct ObjBean*, PlayState*); typedef void (*ObjBeanUnkFunc)(struct ObjBean*); -#define OBJBEAN_GET_7F(thisx, x) (((thisx)->params + (x)) & 0x7F) +#define OBJBEAN_GET_SWITCH_FLAG_1(thisx, offset) (((thisx)->params + (offset)) & 0x7F) #define OBJBEAN_GET_80(thisx) (((thisx)->params >> 7) & 1) #define OBJBEAN_GET_3F00(thisx) (((thisx)->params >> 8) & 0x3F) -#define OBJBEAN_GET_3F80(thisx, x) ((((thisx)->params >> 7) + (x)) & 0x7F) +#define OBJBEAN_GET_SWITCH_FLAG_2(thisx, offset) ((((thisx)->params >> 7) + (offset)) & 0x7F) #define OBJBEAN_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) #define OBJBEAN_GET_3(thisx) ((thisx)->home.rot.z & 3) diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index 61805fd49..afcf7aaa0 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -111,7 +111,7 @@ void ObjBigicicle_Init(Actor* thisx, PlayState* play) { } Actor_SetScale(&this->actor, sp28 * 0.001f); - this->actor.params &= 0xFF; + this->actor.params = OBJBIGICLE_GET_SWITCH_FLAG_MASK(&this->actor); this->actor.colChkInfo.mass = MASS_IMMOVABLE; sp30 = sp28 * (1.0f / 60.0f); @@ -125,7 +125,7 @@ void ObjBigicicle_Init(Actor* thisx, PlayState* play) { this->collider2.dim.height = this->collider2.dim.height * sp30; this->collider2.dim.yShift = this->collider2.dim.yShift * sp30; - if (Flags_GetSwitch(play, this->actor.params)) { + if (Flags_GetSwitch(play, OBJBIGICLE_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -248,7 +248,7 @@ void func_80AE9258(ObjBigicicle* this, PlayState* play) { temp_f0 = this->actor.world.pos.y - icePoly->actor.world.pos.y; if ((temp_f0 < icePoly->colliders1[0].dim.height) && (temp_f0 > 0.0f) && (Actor_WorldDistXZToActor(&this->actor, &icePoly->actor) < icePoly->colliders1[0].dim.radius)) { - Flags_SetSwitch(play, this->actor.params); + Flags_SetSwitch(play, OBJBIGICLE_GET_SWITCH_FLAG(&this->actor)); this->actionFunc = func_80AE939C; return; } diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h index 2eb5a00bd..fc506e62b 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h @@ -7,6 +7,8 @@ struct ObjBigicicle; typedef void (*ObjBigicicleActionFunc)(struct ObjBigicicle*, PlayState*); +#define OBJBIGICLE_GET_SWITCH_FLAG_MASK(thisx) ((thisx)->params & 0xFF) +#define OBJBIGICLE_GET_SWITCH_FLAG(thisx) ((thisx)->params) #define OBJBIGICLE_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) typedef struct ObjBigicicle { diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index a4f44973f..f21ebff2b 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -32,7 +32,7 @@ ActorInit Obj_Blockstop_InitVars = { void ObjBlockstop_Init(Actor* thisx, PlayState* play) { ObjBlockstop* this = THIS; - if (Flags_GetSwitch(play, this->actor.params)) { + if (Flags_GetSwitch(play, OBJBLOCKSTOP_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); } this->actionFunc = ObjBlockstop_CheckForBlock; @@ -58,7 +58,7 @@ void ObjBlockstop_CheckForBlock(ObjBlockstop* this, PlayState* play) { void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { - Flags_SetSwitch(play, this->actor.params); + Flags_SetSwitch(play, OBJBLOCKSTOP_GET_SWITCH_FLAG(&this->actor)); if (CutsceneManager_GetLength(this->actor.csId) != -1) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h index 15d45a90b..e6ad9f696 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h @@ -7,6 +7,8 @@ struct ObjBlockstop; typedef void (*ObjBlockstopActionFunc)(struct ObjBlockstop*, PlayState*); +#define OBJBLOCKSTOP_GET_SWITCH_FLAG(thisx) ((thisx)->params) + typedef struct ObjBlockstop { /* 0x000 */ Actor actor; /* 0x144 */ ObjBlockstopActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index 6c81e8de6..cf2ef3ded 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -140,7 +140,7 @@ void ObjBoat_Update(Actor* thisx, PlayState* play) { Math_StepToF(&this->dyna.actor.speed, speedTarget, 0.05f); Actor_MoveWithGravity(&this->dyna.actor); if (this->dyna.actor.speed != 0.0f) { - func_800B9010(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); } } ObjBoat_SetRotations(this); @@ -188,7 +188,7 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { if (cue->id != 3) { ObjBoat_SetRotations(this); if (cue->id == 2) { - func_800B9010(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); } } else { // Tumble in the air diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index c8eed614b..95ff47db2 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -182,7 +182,7 @@ void ObjBombiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(play, OBJBOMBIWA_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, OBJBOMBIWA_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -342,10 +342,10 @@ void func_80939EF4(ObjBombiwa* this, PlayState* play) { } if (sp28->unk_0C(&this->actor)) { - Flags_SetSwitch(play, OBJBOMBIWA_GET_7F(&this->actor)); + Flags_SetSwitch(play, OBJBOMBIWA_GET_SWITCH_FLAG(&this->actor)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); if (OBJBOMBIWA_GET_8000(&this->actor)) { - play_sound(NA_SE_SY_CORRECT_CHIME); + Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); } if (params == OBJBOMBIWA_100_0) { diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h index b49a89323..911d804fc 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h @@ -7,7 +7,7 @@ struct ObjBombiwa; typedef void (*ObjBombiwaActionFunc)(struct ObjBombiwa*, PlayState*); -#define OBJBOMBIWA_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJBOMBIWA_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJBOMBIWA_GET_100(thisx) (((thisx)->params >> 8) & 1) #define OBJBOMBIWA_GET_8000(thisx) (((thisx)->params >> 0xF) & 1) diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index e5e53000a..9e791f7ae 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -1,4 +1,7 @@ #include "z_obj_boyo.h" +#include "overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h" +#include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "objects/object_boyo/object_boyo.h" #define FLAGS (ACTOR_FLAG_10) @@ -9,7 +12,11 @@ void ObjBoyo_Destroy(Actor* thisx, PlayState* play2); void ObjBoyo_Update(Actor* thisx, PlayState* play2); void ObjBoyo_Draw(Actor* thisx, PlayState* play); -/* +void ObjBoyo_PushPlayer(ObjBoyo* this, Actor* actor); +void ObjBoyo_PushPirate(ObjBoyo* this, Actor* actor); +void ObjBoyo_ExplodeBomb(ObjBoyo* this, Actor* actor); +Actor* ObjBoyo_FindCollidedActor(ObjBoyo* this, PlayState* play, s32* index); + const ActorInit Obj_Boyo_InitVars = { ACTOR_OBJ_BOYO, ACTORCAT_PROP, @@ -19,22 +26,184 @@ const ActorInit Obj_Boyo_InitVars = { (ActorFunc)ObjBoyo_Init, (ActorFunc)ObjBoyo_Destroy, (ActorFunc)ObjBoyo_Update, - (ActorFunc)ObjBoyo_Draw + (ActorFunc)ObjBoyo_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Init.s") +typedef void (*ObjBoyoCollisionHandler)(ObjBoyo* this, Actor* actor); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Destroy.s") +typedef struct ObjBoyoUnkStruct { + /* 0x0 */ s16 id; + /* 0x4 */ ObjBoyoCollisionHandler colHandler; +} ObjBoyoUnkStruct; // size = 0x8 -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DC0.s") +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_TYPE_PLAYER | AC_HARD | AC_ON, + OC1_TYPE_2 | OC1_TYPE_1 | OC1_TYPE_PLAYER | OC1_ON, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x01CBFFBE, 0x00, 0x00 }, + TOUCH_NONE, + BUMP_ON, + OCELEM_ON, + }, + { + 60, + 140, + 0, + { 0, 0, 0 }, + }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DE0.s") +static InitChainEntry sInitChain[] = { + ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E14.s") +static ObjBoyoUnkStruct sCollisionHandlers[] = { + { ACTOR_PLAYER, ObjBoyo_PushPlayer }, + { ACTOR_EN_KAIZOKU, ObjBoyo_PushPirate }, + { ACTOR_EN_BOM, ObjBoyo_ExplodeBomb }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E24.s") +void ObjBoyo_Init(Actor* thisx, PlayState* play) { + ObjBoyo* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Update.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->collider); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->animatedMaterial = Lib_SegmentedToVirtual(&object_boyo_Matanimheader_000E88); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Draw.s") +void ObjBoyo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + ObjBoyo* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void ObjBoyo_PushPlayer(ObjBoyo* this, Actor* actor) { + Player* player = (Player*)actor; + + player->pushedSpeed = 30.0f; + player->pushedYaw = this->actor.yawTowardsPlayer; +} + +void ObjBoyo_PushPirate(ObjBoyo* this, Actor* actor) { + EnKaizoku* kaizoku = (EnKaizoku*)actor; + + kaizoku->unk_2F0 = 30.0f; + kaizoku->unk_2F4 = Actor_WorldYawTowardActor(&this->actor, &kaizoku->picto.actor); +} + +void ObjBoyo_ExplodeBomb(ObjBoyo* this, Actor* actor) { + EnBom* bom = (EnBom*)actor; + + bom->timer = 0; +} + +/* + * Find the Actor we collided with. + */ +Actor* ObjBoyo_FindCollidedActor(ObjBoyo* this, PlayState* play, s32* index) { + Actor* collidedActor; + ObjBoyoUnkStruct* iter; + s32 i; + + if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { + *index = 0; + return &GET_PLAYER(play)->actor; + } + iter = sCollisionHandlers + 1; + if (this->collider.base.ocFlags1 & OC1_HIT) { + collidedActor = this->collider.base.oc; + for (i = 1; i < 3; i++) { + if (iter->id == collidedActor->id) { + *index = i; + return collidedActor; + } + iter++; + } + } + return NULL; +} + +void ObjBoyo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + ObjBoyo* this = THIS; + Actor* collidedActor; + s32 index; + + collidedActor = ObjBoyo_FindCollidedActor(this, play, &index); + + if (collidedActor != NULL) { + sCollisionHandlers[index].colHandler(this, collidedActor); + // TODO: find out what all of these are. + + this->unk194 = 0x64; + this->unk196 = 3; + this->unk198 = 0.01f; + this->unk19C = 0.03f; + this->unk1A4 = 0x3F40; + this->unk1A6 = 0x7D0; + this->unk1A8 = 0; + this->unk1A0 = 0.03f; + this->unk1AA = 0x2DF7; + this->unk1AC = 0x258; + } + + if (this->unk194 > 0) { + // compute new scaling + // this computation might help finding what those values are. + + this->unk194 -= this->unk196; + this->unk1AA += this->unk1AC; + this->unk1A8 += this->unk1AA; + + this->actor.scale.x = this->actor.scale.z = + (Math_CosS(this->unk1A8 + this->unk1A4) * (f32)this->unk194 * this->unk19C * this->unk198) + 0.1f; + + this->actor.scale.y = + (Math_CosS(this->unk1A8 + this->unk1A6) * (f32)this->unk194 * this->unk1A0 * this->unk198) + 0.1f; + } else { + Actor_SetScale(&this->actor, 0.1f); + if (this->collider.base.acFlags & AC_HIT) { + // TODO: find out what all of these are. + + this->unk194 = 0x1E; + this->unk196 = 2; + this->unk198 = 0.033333335f; + this->unk19C = 0.012f; + this->unk1A0 = 0.006f; + this->unk1A4 = 0x3F40; + this->unk1A6 = 0x7D0; + this->unk1A8 = 0; + this->unk1AA = 0x3A98; + this->unk1AC = 0x640; + } + } + this->collider.base.acFlags &= ~AC_HIT; + this->collider.base.ocFlags1 &= ~OC1_HIT; + this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->actor.xzDistToPlayer < 2000.0f) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } +} + +void ObjBoyo_Draw(Actor* thisx, PlayState* play) { + ObjBoyo* this = THIS; + + AnimatedMat_Draw(play, this->animatedMaterial); + Gfx_DrawDListOpa(play, object_boyo_DL_000300); +} diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h index feb95dcd1..eb1184a40 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h @@ -3,11 +3,21 @@ #include "global.h" -struct ObjBoyo; - typedef struct ObjBoyo { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x6C]; + /* 0x144 */ ColliderCylinder collider; + /* 0x190 */ AnimatedMaterial* animatedMaterial; + /* 0x194 */ s16 unk194; + /* 0x196 */ s16 unk196; + /* 0x198 */ f32 unk198; + /* 0x19C */ f32 unk19C; + /* 0x1A0 */ f32 unk1A0; + /* 0x1A4 */ s16 unk1A4; + /* 0x1A6 */ s16 unk1A6; + /* 0x1A8 */ s16 unk1A8; + /* 0x1AA */ s16 unk1AA; + /* 0x1AC */ s16 unk1AC; + /* 0x1AE */ s16 unk1AE; } ObjBoyo; // size = 0x1B0 #endif // Z_OBJ_BOYO_H diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index d1f19032f..8f326af48 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -191,7 +191,7 @@ void ObjChan_InitChandelier(ObjChan* this, PlayState* play) { } } - if (Flags_GetSwitch(play, thisx->params & 0x7F)) { + if (Flags_GetSwitch(play, OBJCHAN_GET_SWITCH_FLAG(thisx))) { this->stateFlags |= OBJCHAN_STATE_FIRE_DELAY; this->stateFlags |= OBJCHAN_STATE_ON_FIRE; @@ -261,9 +261,9 @@ void ObjChan_ChandelierAction(ObjChan* this, PlayState* play) { } } if ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x800)) { - Flags_SetSwitch(play, thisx->params & 0x7F); + Flags_SetSwitch(play, OBJCHAN_GET_SWITCH_FLAG(thisx)); } - if (Flags_GetSwitch(play, thisx->params & 0x7F)) { + if (Flags_GetSwitch(play, OBJCHAN_GET_SWITCH_FLAG(thisx))) { if (!(this->stateFlags & OBJCHAN_STATE_FIRE_DELAY)) { this->rotationSpeed = 0; this->flameSize = 0.0f; @@ -282,7 +282,7 @@ void ObjChan_ChandelierAction(ObjChan* this, PlayState* play) { Math_StepToF(&this->flameSize, 1.0f, 0.05f); this->rotation += this->rotationSpeed; Math_StepToS(&this->rotationSpeed, OBJCHAN_ROTATION_SPEED, 5); - func_800B9010(&this->actor, NA_SE_EV_CHANDELIER_ROLL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_CHANDELIER_ROLL - SFX_FLAG); } } } @@ -357,7 +357,7 @@ void ObjChan_CreateSmashEffects(ObjChan* this, PlayState* play) { } new_var2 = spA4 * Rand_ZeroOne(); EffectSsKakera_Spawn(play, &spDC, &spD0, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, spA8 + new_var2, 0, 0, - 50, -1, OBJECT_TSUBO, object_tsubo_DL_001960); + 50, -1, OBJECT_TSUBO, gPotShardDL); } func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 20, 50, true); func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 10, 80, true); @@ -382,12 +382,12 @@ void ObjChan_Draw(Actor* thisx, PlayState* play) { opa = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_25); gSPMatrix(&opa[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); - gSPDisplayList(&opa[1], object_obj_chan_DL_000AF0); + gSPDisplayList(&opa[1], gChandelierCenterDL); POLY_OPA_DISP = &opa[2]; xlu = Gfx_SetupDL71(POLY_XLU_DISP); gSPMatrix(&xlu[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); - gSPDisplayList(&xlu[1], object_obj_chan_DL_000A10); + gSPDisplayList(&xlu[1], gChandelierPotHolderDL); POLY_XLU_DISP = &xlu[2]; CLOSE_DISPS(play->state.gfxCtx); @@ -408,7 +408,7 @@ void ObjChan_DrawPot(Actor* thisx, PlayState* play) { dl = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_25); gSPMatrix(&dl[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); - gSPDisplayList(&dl[1], object_obj_chan_DL_002358); + gSPDisplayList(&dl[1], gChandelierPotDL); POLY_OPA_DISP = &dl[2]; CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h index 0e6fbca86..f97ecccda 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h @@ -5,6 +5,8 @@ struct ObjChan; +#define OBJCHAN_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) + #define OBJCHAN_SUBTYPE(thisx) (((thisx)->params >> 12) & 0xF) #define OBJCHAN_SUBTYPE_CHANDELIER 0 #define OBJCHAN_SUBTYPE_POT 1 diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 1f3f7f902..4227178e2 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -127,7 +127,7 @@ void func_8098CEAC(ObjComb* this, PlayState* play) { phi_v0 = 0x20; } EffectSsKakera_Spawn(play, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f10, 0, 0, 60, -1, - OBJECT_COMB, object_comb_DL_001040); + OBJECT_COMB, gBeehiveFragmentDL); } spD0.x = this->actor.world.pos.x; @@ -185,7 +185,7 @@ void func_8098D19C(ObjComb* this, PlayState* play) { } EffectSsKakera_Spawn(play, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f8, 0, 0, 60, -1, - OBJECT_COMB, object_comb_DL_001040); + OBJECT_COMB, gBeehiveFragmentDL); } spD0.x = this->actor.world.pos.x; @@ -236,7 +236,7 @@ void func_8098D47C(ObjComb* this, PlayState* play) { } EffectSsKakera_Spawn(play, &spC8, &spBC, &spC8, phi_s0, phi_v0, 40, 0, 0, temp_f10, 0, 0, 80, -1, OBJECT_COMB, - object_comb_DL_001040); + gBeehiveFragmentDL); } } @@ -309,7 +309,7 @@ void func_8098D99C(ObjComb* this, PlayState* play) { temp_v0->speed = 2.0f; } this->unk_1B6 = 1; - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); } } } @@ -339,7 +339,7 @@ void ObjComb_Init(Actor* thisx, PlayState* play) { return; } - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if ((sp2C == 0) && Item_CanDropBigFairy(play, OBJCOMB_GET_3F(&this->actor), OBJCOMB_GET_7F00(&this->actor))) { this->unk_1B7 = 1; @@ -469,7 +469,7 @@ void func_8098DEA0(ObjComb* this, PlayState* play) { if (this->unk_1B0 > 0x258) { this->unk_1B0 = 0x258; } - func_800B9010(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); } Actor_MoveWithGravity(&this->actor); @@ -566,7 +566,7 @@ void ObjComb_Draw(Actor* thisx, PlayState* play) { 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++, object_comb_DL_000CB0); + gSPDisplayList(POLY_OPA_DISP++, gBeehiveDL); Collider_UpdateSpheres(0, &this->collider); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index 0ee61baaf..0b1873bb3 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -19,7 +19,7 @@ typedef struct ObjComb { /* 0x000 */ Actor actor; /* 0x144 */ ObjCombActionFunc actionFunc; /* 0x148 */ ColliderJntSph collider; - /* 0x168 */ ColliderJntSphElement colliderElement; + /* 0x168 */ ColliderJntSphElement colliderElements[1]; /* 0x1A8 */ s16 unk_1A8; /* 0x1AA */ s16 unk_1AA; /* 0x1AC */ s16 unk_1AC; diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index ee76dd9d4..a809da57a 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -32,8 +32,8 @@ ActorInit Obj_Demo_InitVars = { void ObjDemo_Init(Actor* thisx, PlayState* play) { ObjDemo* this = THIS; - thisx->params = OBJDEMO_GET_FF(thisx); - if ((thisx->params != OBJDEMO_FF_FF) && (Flags_GetSwitch(play, thisx->params))) { + thisx->params = OBJDEMO_GET_SWITCH_FLAG_MASK(thisx); + if ((OBJDEMO_GET_SWITCH_FLAG(thisx) != 0xFF) && (Flags_GetSwitch(play, OBJDEMO_GET_SWITCH_FLAG(thisx)))) { Actor_Kill(&this->actor); return; } @@ -93,8 +93,8 @@ void func_80983704(ObjDemo* this, PlayState* play) { } this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); if (this->actor.csId == CS_ID_NONE) { - if (this->actor.params != 0xFF) { - Flags_SetSwitch(play, this->actor.params); + if (OBJDEMO_GET_SWITCH_FLAG(&this->actor) != 0xFF) { + Flags_SetSwitch(play, OBJDEMO_GET_SWITCH_FLAG(&this->actor)); } Actor_Kill(&this->actor); } @@ -108,7 +108,8 @@ void func_80983704(ObjDemo* this, PlayState* play) { void ObjDemo_Update(Actor* thisx, PlayState* play) { ObjDemo* this = THIS; - if ((this->actor.params != 0xFF) && Flags_GetSwitch(play, this->actor.params)) { + if ((OBJDEMO_GET_SWITCH_FLAG(&this->actor) != 0xFF) && + Flags_GetSwitch(play, OBJDEMO_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h index 065a21fe9..6b9d39db3 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h @@ -3,12 +3,13 @@ #include "global.h" -#define OBJDEMO_GET_FF(thisx) ((thisx)->params & 0xFF) -#define OBJDEMO_FF_FF 0xFF struct ObjDemo; typedef void (*ObjDemoActionFunc)(struct ObjDemo*, PlayState*); +#define OBJDEMO_GET_SWITCH_FLAG_MASK(thisx) ((thisx)->params & 0xFF) +#define OBJDEMO_GET_SWITCH_FLAG(thisx) ((thisx)->params) + typedef struct ObjDemo { /* 0x000 */ Actor actor; /* 0x144 */ ObjDemoActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index c1b46fce7..ac31cbc64 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -131,7 +131,7 @@ void ObjDhouse_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); - if (Flags_GetSwitch(play, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJDHOUSE_GET_SWITCH_FLAG(&this->dyna.actor))) { this->dyna.actor.draw = func_80B13E40; func_80B13908(this); } else { @@ -434,7 +434,7 @@ void func_80B13940(ObjDhouse* this, PlayState* play2) { PlayState* play = play2; s32 sp20 = false; - if (Flags_GetSwitch(play, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJDHOUSE_GET_SWITCH_FLAG(&this->dyna.actor))) { sp20 = true; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EXPLSION_LONG); } diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h index c03dbed7d..46f1af83b 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h @@ -7,7 +7,7 @@ struct ObjDhouse; typedef void (*ObjDhouseActionFunc)(struct ObjDhouse*, PlayState*); -#define OBJDHOUSE_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJDHOUSE_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) typedef struct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c index 7d729495a..13a88568b 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c @@ -163,19 +163,19 @@ void func_80A66930(ObjDrifticeStruct2* arg0, ObjDriftice* this, s16* arg2, s16* temp_f20 = 0.01f; } - Math_StepToS(&arg0->unk_00[1], 1200.0f * temp_f20, 0x64); + Math_StepToS(&arg0->unk_02, 1200.0f * temp_f20, 0x64); phi_s0 = 2500.0f * temp_f20; - Math_StepToS(&arg0->unk_00[3], Math_CosS(arg0->unk_00[2] * 6.5536f) * (120.0f * temp_f20), 0x28); + Math_StepToS(&arg0->unk_06, Math_CosS(arg0->unk_04 * 6.5536f) * (120.0f * temp_f20), 0x28); Math_StepToF(&arg0->unk_08, 1.0f, 0.02f); } else { - Math_StepToS(&arg0->unk_00[1], 0, 0x96); + Math_StepToS(&arg0->unk_02, 0, 0x96); phi_s0 = 0; - Math_StepToS(&arg0->unk_00[3], 20, 7); + Math_StepToS(&arg0->unk_06, 20, 7); Math_StepToF(&arg0->unk_08, 0.0f, 0.02f); } - Math_ScaledStepToS(arg0->unk_00, this->dyna.actor.yawTowardsPlayer, arg0->unk_00[1]); - *arg3 = arg0->unk_00[0]; - Math_ScaledStepToS(&arg0->unk_00[2], phi_s0, arg0->unk_00[3]); + Math_ScaledStepToS(&arg0->unk_00, this->dyna.actor.yawTowardsPlayer, arg0->unk_02); + *arg3 = arg0->unk_00; + Math_ScaledStepToS(&arg0->unk_04, phi_s0, arg0->unk_06); for (i = 0; i < 2; i++) { temp_s0 = &arg0->unk_0C[i]; @@ -195,8 +195,7 @@ void func_80A66930(ObjDrifticeStruct2* arg0, ObjDriftice* this, s16* arg2, s16* temp_f22 *= arg0->unk_08; - //! FAKE: - *arg2 = arg0->unk_00[2] + (s32)((void)0, temp_f22); + *arg2 = (s32)temp_f22 + arg0->unk_04; } void func_80A66C4C(ObjDrifticeStruct4* arg0, ObjDriftice* this, s16* arg2, s16* arg3) { diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h index 19627c3df..f77e95eff 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h @@ -23,8 +23,10 @@ typedef struct { } ObjDrifticeStruct3; // size = 0x14 typedef struct { - /* 0x00 */ s16 unk_00[2]; - /* 0x04 */ f32 unk_04; + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; /* 0x08 */ f32 unk_08; /* 0x0C */ ObjDrifticeStruct3 unk_0C[2]; } ObjDrifticeStruct2; // size = 0x34 diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index c7fbab2d6..57bfa823c 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -52,7 +52,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 14, 0, { 0, 0, 0 } }, }; -static s16 objectIds[] = { +static s16 sObjectIds[] = { GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP, @@ -71,7 +71,7 @@ static f32 oscillationTable[] = { void ObjEtcetera_Init(Actor* thisx, PlayState* play) { s32 pad; ObjEtcetera* this = THIS; - s32 objectIndex; + s32 objectSlot; s32 type = DEKU_FLOWER_TYPE(&this->dyna.actor); s32 floorBgId; Vec3f pos; @@ -80,9 +80,9 @@ void ObjEtcetera_Init(Actor* thisx, PlayState* play) { type = DEKU_FLOWER_TYPE_PINK; } - objectIndex = Object_GetIndex(&play->objectCtx, objectIds[type]); - if (objectIndex >= 0) { - this->objIndex = objectIndex; + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[type]); + if (objectSlot > OBJECT_SLOT_NONE) { + this->objectSlot = objectSlot; } pos.x = this->dyna.actor.world.pos.x; @@ -257,8 +257,8 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { type = DEKU_FLOWER_TYPE_PINK; } - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - this->dyna.actor.objBankIndex = this->objIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->dyna.actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); thisCollisionHeader = collisionHeaders[type]; @@ -298,7 +298,7 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, 0.01f); this->dyna.actor.scale.y = 0.02f; this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y + 10.0f; - this->dyna.actor.targetMode = 3; + this->dyna.actor.targetMode = TARGET_MODE_3; break; case DEKU_FLOWER_TYPE_PINK_WITH_INITIAL_BOUNCE: @@ -311,7 +311,7 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { this->oscillationTimer = 30; this->bounceOscillationScale = 0.0f; this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y + 10.0f; - this->dyna.actor.targetMode = 3; + this->dyna.actor.targetMode = TARGET_MODE_3; break; default: @@ -328,7 +328,7 @@ void ObjEtcetera_Update(Actor* thisx, PlayState* play) { if (floorBgId == BGCHECK_SCENE) { floorPoly = this->dyna.actor.floorPoly; if ((floorPoly != NULL) && (this->burrowFlag & 1)) { - func_800FAAB4(play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, floorBgId)); + Environment_ChangeLightSetting(play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, floorBgId)); } } diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h index 454e3f674..6c8734c85 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h @@ -28,7 +28,7 @@ typedef struct ObjEtcetera { /* 0x270 */ f32 bounceOscillationScale; /* 0x274 */ s16 oscillationTimer; /* 0x276 */ u16 burrowFlag; - /* 0x278 */ s8 objIndex; + /* 0x278 */ s8 objectSlot; /* 0x27C */ Gfx* dList; /* 0x280 */ ObjEtceteraActionFunc actionFunc; } ObjEtcetera; // size = 0x284 diff --git a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c index e672780de..9933b36f2 100644 --- a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c +++ b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c @@ -88,7 +88,7 @@ void func_80A4CABC(ObjFireshield* this) { s32 pad; if (CutsceneManager_IsNext(this->actor.csId)) { - s32 sp18 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 sp18 = OBJFIRESHIELD_GET_FLAGS(&this->actor); s32 temp_a0 = (sp18 & ~0x1F) >> 5; CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); @@ -103,7 +103,7 @@ void func_80A4CABC(ObjFireshield* this) { void func_80A4CB7C(ObjFireshield* this) { s32 pad; - s32 sp18 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 sp18 = OBJFIRESHIELD_GET_FLAGS(&this->actor); if (this->unk_194 > 0) { if (this->unk_194 == 20) { @@ -119,7 +119,7 @@ void func_80A4CB7C(ObjFireshield* this) { } void func_80A4CC54(ObjFireshield* this) { - s32 temp_v0 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 temp_v0 = OBJFIRESHIELD_GET_FLAGS(&this->actor); s32 temp_v1 = 1 << (temp_v0 & 0x1F); this->actionFunc = func_80A4CCBC; @@ -128,7 +128,7 @@ void func_80A4CC54(ObjFireshield* this) { } void func_80A4CCBC(ObjFireshield* this) { - s32 temp_v0 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 temp_v0 = OBJFIRESHIELD_GET_FLAGS(&this->actor); this->actionFunc = func_80A4CD28; D_80A4D884[(temp_v0 & ~0x1F) >> 5] &= ~(1 << (temp_v0 & 0x1F)); @@ -141,7 +141,7 @@ void func_80A4CD28(ObjFireshield* this) { void func_80A4CD34(Actor* thisx, PlayState* play) { s32 pad; ObjFireshield* this = THIS; - s32 sp24 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_7F(&this->actor)); + s32 isSwitchFlagSet = Flags_GetSwitch(play, OBJFIRESHIELD_GET_FLAGS(&this->actor)); s32 phi_v1; s32 phi_a0; @@ -154,13 +154,13 @@ void func_80A4CD34(Actor* thisx, PlayState* play) { phi_a0 = false; } } else { - phi_a0 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_3F80(&this->actor)); + phi_a0 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_SWITCH_FLAG(&this->actor)); phi_v1 = false; } if (phi_v1 || phi_a0) { this->unk_19C = 0; - } else if (sp24) { + } else if (isSwitchFlagSet) { this->unk_19C = 0; } else { this->unk_19C = 1; @@ -175,7 +175,7 @@ void func_80A4CD34(Actor* thisx, PlayState* play) { void func_80A4CE28(ObjFireshield* this, PlayState* play) { s32 pad; - s32 sp30 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 sp30 = OBJFIRESHIELD_GET_FLAGS(&this->actor); s32 pad2[2]; s32 sp24; s32 sp20; @@ -189,7 +189,7 @@ void func_80A4CE28(ObjFireshield* this, PlayState* play) { sp20 = false; } } else { - sp20 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_3F80(&this->actor)); + sp20 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_SWITCH_FLAG(&this->actor)); sp24 = false; } @@ -251,7 +251,7 @@ void func_80A4CE28(ObjFireshield* this, PlayState* play) { } void func_80A4D174(ObjFireshield* this) { - s32 temp_v0 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 temp_v0 = OBJFIRESHIELD_GET_FLAGS(&this->actor); s32 temp_v1 = 1 << (temp_v0 & 0x1F); if (!(D_80A4D864[(temp_v0 & ~0x1F) >> 5] & temp_v1)) { @@ -318,7 +318,7 @@ void ObjFireshield_Update(Actor* thisx, PlayState* play) { s32 pad; ObjFireshield* this = THIS; s32 sp44 = OBJFIRESHIELD_GET_ROTX(&this->actor); - s32 sp40 = OBJFIRESHIELD_GET_7F(&this->actor); + s32 sp40 = OBJFIRESHIELD_GET_FLAGS(&this->actor); s32 temp_a0; s32 temp_v1; @@ -362,7 +362,7 @@ void ObjFireshield_Update(Actor* thisx, PlayState* play) { this->collider.dim.yShift = thisx->home.pos.y - thisx->world.pos.y; } - func_800B9010(thisx, NA_SE_EV_BURNING - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_BURNING - SFX_FLAG); if (player->transformation == PLAYER_FORM_GORON) { this->collider.info.toucher.damage = 0; diff --git a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.h b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.h index ffe1d7a35..772f839bb 100644 --- a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.h +++ b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.h @@ -7,10 +7,10 @@ struct ObjFireshield; typedef void (*ObjFireshieldActionFunc)(struct ObjFireshield*); -#define OBJFIRESHIELD_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJFIRESHIELD_GET_FLAGS(thisx) ((thisx)->params & 0x7F) #define OBJFIRESHIELD_GET_1F00(thisx) (((thisx)->params >> 8) & 0x1F) #define OBJFIRESHIELD_GET_2000(thisx) (((thisx)->params >> 0xD) & 1) -#define OBJFIRESHIELD_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) +#define OBJFIRESHIELD_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 7) & 0x7F) #define OBJFIRESHIELD_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) #define OBJFIRESHIELD_GET_ROTX(thisx) ((thisx)->home.rot.x & 1) diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index aca30fe92..cd8632659 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -255,7 +255,7 @@ void func_80A1BA44(ObjFlowerpot* this, PlayState* play) { } EffectSsKakera_Spawn(play, &spC4, &spB8, &spC4, -600, phi_s0, 30, 0, 0, (Rand_ZeroOne() * 12.0f) + 16.6f, - phi_s1, 0, 35, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0015B0); + phi_s1, 0, 35, -1, OBJECT_FLOWERPOT, object_flowerpot_DL_0015B0); } spD0.y += 20.0f; @@ -298,7 +298,7 @@ void func_80A1BD80(ObjFlowerpot* this, PlayState* play) { } EffectSsKakera_Spawn(play, &spBC, &spB0, &spBC, -240, phi_s0, 40, 0, 0, (Rand_ZeroOne() * 20.0f) + 10.6f, 0, 0, - 42, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0015B0); + 42, -1, OBJECT_FLOWERPOT, object_flowerpot_DL_0015B0); } spBC.y = this->actor.world.pos.y + this->actor.depthInWater; @@ -338,7 +338,7 @@ void func_80A1C0FC(ObjFlowerpot* this, PlayState* play) { Math_Vec3f_Sum(&spB8, &spC4, &spB8); EffectSsKakera_Spawn(play, &spB8, &spAC, &spB8, -100, 64, 40, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, 80, - -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); + -1, OBJECT_FLOWERPOT, object_flowerpot_DL_0014F0); } } @@ -365,7 +365,7 @@ void func_80A1C328(ObjFlowerpot* this, PlayState* play) { Math_Vec3f_Sum(&spB8, &spC4, &spB8); EffectSsKakera_Spawn(play, &spB8, &spAC, &spB8, -80, 64, 44, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, 80, - -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); + -1, OBJECT_FLOWERPOT, object_flowerpot_DL_0014F0); } } diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c index 409cbd837..a75a43cda 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -43,6 +43,6 @@ void ObjFunen_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, temp, 0x20, 0x20, 1, 0, temp, 0x20, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, object_funen_DL_0000D0); + gSPDisplayList(POLY_XLU_DISP++, gStoneTowerSmokeDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 85e628359..92479cc4a 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -7,7 +7,7 @@ #include "z_obj_ghaka.h" #include "objects/object_ghaka/object_ghaka.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_20) #define THIS ((ObjGhaka*)thisx) @@ -39,7 +39,7 @@ ActorInit Obj_Ghaka_InitVars = { static Vec3f D_80B3C960 = { 0.0f, 0.0f, 0.0f }; static InitChainEntry D_80B3C96C[] = { - ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; @@ -70,13 +70,13 @@ void func_80B3C2C4(ObjGhaka* this, PlayState* play) { void func_80B3C39C(ObjGhaka* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; + s16 yaw = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { func_80B3C29C(this); - } else if (this->dyna.actor.xzDistToPlayer < 100.0f || this->dyna.actor.isTargeted) { - if (distDiff <= -0x5556 || distDiff >= 0x5556) { - func_800B863C(&this->dyna.actor, play); + } else if ((this->dyna.actor.xzDistToPlayer < 100.0f) || this->dyna.actor.isLockedOn) { + if ((yaw <= -0x5556) || (yaw >= 0x5556)) { + Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play); if (player->transformation == PLAYER_FORM_GORON) { this->dyna.actor.textId = 0xCF3; } else { @@ -85,8 +85,8 @@ void func_80B3C39C(ObjGhaka* this, PlayState* play) { } } - if (this->dyna.pushForce < 0.0f && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20) && - player->transformation == PLAYER_FORM_GORON) { + if ((this->dyna.pushForce < 0.0f) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20) && + (player->transformation == PLAYER_FORM_GORON)) { func_80B3C2B0(this); } else { player->stateFlags2 &= ~PLAYER_STATE2_10; @@ -99,7 +99,7 @@ void func_80B3C4E0(ObjGhaka* this, PlayState* play) { if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { - play->msgCtx.msgMode = 0x43; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; func_80B3C260(this); } @@ -107,20 +107,20 @@ void func_80B3C4E0(ObjGhaka* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->dyna.actor.textId = 0xCF5; Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; case 1: - func_8019F208(); + Audio_PlaySfx_MessageDecide(); this->dyna.actor.textId = 0xCF7; Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; case 2: - func_8019F230(); - play->msgCtx.msgMode = 0x43; + Audio_PlaySfx_MessageCancel(); + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; func_80B3C260(this); break; @@ -141,9 +141,9 @@ void func_80B3C624(ObjGhaka* this, PlayState* play) { func_80B3C2C4(this, play); SET_WEEKEVENTREG(WEEKEVENTREG_20_20); func_80B3C260(this); - Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); + Audio_PlaySfx_AtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); } else { - Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); + Audio_PlaySfx_AtPos(&D_80B3C960, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } } @@ -158,7 +158,7 @@ void ObjGhaka_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&object_ghaka_Colheader_003CD0, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); - if (this->dyna.actor.floorPoly == 0) { + if (this->dyna.actor.floorPoly == NULL) { Actor_Kill(&this->dyna.actor); } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { 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 a17f853df..a1ce45b82 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -1,7 +1,9 @@ /* * File: z_obj_grass.c * Overlay: ovl_Obj_Grass - * Description: "Master" instance of grass for unit spawned by Obj_Grass_Unit + * Description: Optimized manager for processing grass "spawned" by ObjGrassUnit + * + * Instances of ObjGrass must be spawned by ObjGrassUnit to function correctly. */ #include "prevent_bss_reordering.h" @@ -18,10 +20,10 @@ void ObjGrass_Destroy(Actor* thisx, PlayState* play); void ObjGrass_Update(Actor* thisx, PlayState* play); void ObjGrass_Draw(Actor* thisx, PlayState* play); -ObjGrassStruct1* D_809AADA0[4]; -f32 D_809AADB0[4]; -ObjGrassStruct1_1* D_809AADC0[20]; -f32 D_809AAE10[20]; +ObjGrassGroup* sNearestGrassGroups[OBJ_GRASS_NEAREST_GROUP_MAX]; +f32 sNearestGrassGroupsDist[OBJ_GRASS_NEAREST_GROUP_MAX]; +ObjGrassElement* sNearestGrassElements[OBJ_GRASS_NEAREST_ELEM_MAX]; +f32 sNearestGrassElementsDistSq[OBJ_GRASS_NEAREST_ELEM_MAX]; #include "overlays/ovl_Obj_Grass/ovl_Obj_Grass.c" @@ -57,35 +59,35 @@ static ColliderCylinderInit sCylinderInit = { { 6, 44, 0, { 0, 0, 0 } }, }; -Vec3f D_809AAB4C[] = { - { 0.0f, 0.707099974155f, 0.707099974155f }, - { 0.707099974155f, 0.707099974155f, 0.0f }, - { 0.0f, 0.707099974155f, -0.707099974155f }, - { -0.707099974155f, 0.707099974155f, 0.0f }, +static Vec3f sUnitDirections[] = { + { 0.0f, 0.7071f, 0.7071f }, + { 0.7071f, 0.7071f, 0.0f }, + { 0.0f, 0.7071f, -0.7071f }, + { -0.7071f, 0.7071f, 0.0f }, }; -s16 D_809AAB7C[] = { 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26 }; +static s16 sFragmentScales[] = { 108, 102, 96, 84, 66, 55, 42, 38 }; -s32 func_809A9110(PlayState* play, Vec3f* arg1) { - f32 sp2C; - Vec3f sp20; +s32 func_809A9110(PlayState* play, Vec3f* pos) { + f32 w; + Vec3f projectedPos; - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, &sp20, &sp2C); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, pos, &projectedPos, &w); - if ((play->projectionMtxFDiagonal.z * -130.13191f) < sp20.z) { - if (sp2C < 1.0f) { - sp2C = 1.0f; + if ((play->projectionMtxFDiagonal.z * -130.13191f) < projectedPos.z) { + if (w < 1.0f) { + w = 1.0f; } - if (((fabsf(sp20.x) - (130.13191f * play->projectionMtxFDiagonal.x)) < sp2C) && - ((fabsf(sp20.y) - (130.13191f * play->projectionMtxFDiagonal.y)) < sp2C)) { + if (((fabsf(projectedPos.x) - (130.13191f * play->projectionMtxFDiagonal.x)) < w) && + ((fabsf(projectedPos.y) - (130.13191f * play->projectionMtxFDiagonal.y)) < w)) { return true; } } return false; } -void func_809A91FC(MtxF* matrix) { +void ObjGrass_OverrideMatrixCurrent(MtxF* matrix) { s32 i; MtxF* temp = Matrix_GetCurrent(); f32* tmp = &temp->xx; @@ -96,42 +98,44 @@ void func_809A91FC(MtxF* matrix) { } } -void func_809A92D0(ObjGrassStruct1_1* ptr, PlayState* play) { - if (!(ptr->unk_0E & 0x10)) { - Item_DropCollectibleRandom(play, NULL, &ptr->unk_00, ptr->unk_0E * 0x10); +void ObjGrass_DropCollectible(ObjGrassElement* grassElem, PlayState* play) { + if (!(grassElem->dropTable & 0x10)) { + Item_DropCollectibleRandom(play, NULL, &grassElem->pos, grassElem->dropTable * 0x10); } } -void func_809A9314(ObjGrassStruct1_1* ptr, PlayState* play) { - Vec3f spBC; - Vec3f spB0; +void ObjGrass_SpawnFragments(Vec3f* basePos, PlayState* play) { + Vec3f velocity; + Vec3f pos; s32 i; - Vec3f* ptr2; + Vec3f* dir; - for (i = 0; i < ARRAY_COUNT(D_809AAB4C); i++) { - ptr2 = &D_809AAB4C[i]; + for (i = 0; i < ARRAY_COUNT(sUnitDirections); i++) { + dir = &sUnitDirections[i]; - spB0.x = ptr->unk_00.x + (ptr2->x * 8.0f); - spB0.y = (ptr->unk_00.y + (ptr2->y * 8.0f)) + 10.0f; - spB0.z = ptr->unk_00.z + (ptr2->z * 8.0f); + pos.x = basePos->x + (dir->x * 8.0f); + pos.y = basePos->y + (dir->y * 8.0f) + 10.0f; + pos.z = basePos->z + (dir->z * 8.0f); - spBC.x = (Rand_ZeroOne() - 0.5f) * 8.0f; - spBC.y = Rand_ZeroOne() * 10.0f; - spBC.z = (Rand_ZeroOne() - 0.5f) * 8.0f; + velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f; + velocity.y = Rand_ZeroOne() * 10.0f; + velocity.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, - D_809AAB7C[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, 1, gKakeraLeafMiddle); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, + sFragmentScales[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, GAMEPLAY_KEEP, + gKakeraLeafMiddleDL); - spB0.x = ptr->unk_00.x + (ptr2->x * 16.0f); - spB0.y = (ptr->unk_00.y + (ptr2->y * 16.0f)) + 10.0f; - spB0.z = ptr->unk_00.z + (ptr2->z * 16.0f); + pos.x = basePos->x + (dir->x * 16.0f); + pos.y = basePos->y + (dir->y * 16.0f) + 10.0f; + pos.z = basePos->z + (dir->z * 16.0f); - spBC.x = (Rand_ZeroOne() - 0.5f) * 6.0f; - spBC.y = Rand_ZeroOne() * 10.0f; - spBC.z = (Rand_ZeroOne() - 0.5f) * 6.0f; + velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f; + velocity.y = Rand_ZeroOne() * 10.0f; + velocity.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, - D_809AAB7C[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, 1, gKakeraLeafTip); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, + sFragmentScales[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, GAMEPLAY_KEEP, + gKakeraLeafTipDL); } } @@ -141,9 +145,9 @@ void ObjGrass_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.4f); - for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - Collider_InitCylinder(play, &this->unk_2948[i].collider); - Collider_SetCylinder(play, &this->unk_2948[i].collider, &this->actor, &sCylinderInit); + for (i = 0; i < ARRAY_COUNT(this->grassElemColliders); i++) { + Collider_InitCylinder(play, &this->grassElemColliders[i].collider); + Collider_SetCylinder(play, &this->grassElemColliders[i].collider, &this->actor, &sCylinderInit); } this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -158,117 +162,121 @@ void ObjGrass_Destroy(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - Collider_DestroyCylinder(play, &this->unk_2948[i].collider); + for (i = 0; i < ARRAY_COUNT(this->grassElemColliders); i++) { + Collider_DestroyCylinder(play, &this->grassElemColliders[i].collider); } - for (i = 0; i < ARRAY_COUNT(this->unk_3298); i++) { - ObjGrassCarry** ptr = &this->unk_3298[i]; + for (i = 0; i < ARRAY_COUNT(this->grassCarry); i++) { + ObjGrassCarry** grassCarry = &this->grassCarry[i]; - if (*ptr != NULL) { - (*ptr)->unk_190 = 0; - *ptr = NULL; + if (*grassCarry != NULL) { + (*grassCarry)->grassManager = NULL; + *grassCarry = NULL; } } } -void func_809A9790(ObjGrass* this, PlayState* play) { +void ObjGrass_ProcessColliders(ObjGrass* this, PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - ObjGrassStruct1_1* ptr = this->unk_2948[i].unk_4C; + for (i = 0; i < ARRAY_COUNT(this->grassElemColliders); i++) { + ObjGrassElement* grassElem = this->grassElemColliders[i].entity; - if ((ptr != NULL) && (this->unk_2948[i].collider.base.acFlags & AC_HIT)) { - func_809A9314(ptr, play); - func_809A92D0(ptr, play); - ptr->unk_0F |= 4; - SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_00, 20, NA_SE_EV_PLANT_BROKEN); + if ((grassElem != NULL) && (this->grassElemColliders[i].collider.base.acFlags & AC_HIT)) { + ObjGrass_SpawnFragments(&grassElem->pos, play); + ObjGrass_DropCollectible(grassElem, play); + grassElem->flags |= OBJ_GRASS_ELEM_REMOVED; + SoundSource_PlaySfxAtFixedWorldPos(play, &grassElem->pos, 20, NA_SE_EV_PLANT_BROKEN); } } } -void func_809A983C(ObjGrass* this, PlayState* play) { +void ObjGrass_UpdateGrass(ObjGrass* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 i; s32 j; s32 x; s32 y; - f32 temp_f0; - ObjGrassStruct1* ptr; - ObjGrassStruct1_1* ptr2; - ObjGrassStruct2* ptr3; + f32 distSq; + ObjGrassGroup* grassGroup; s16 yaw; - for (i = 0; i < ARRAY_COUNT(D_809AADC0); i++) { - D_809AADC0[i] = NULL; - D_809AAE10[i] = 422500.0f; + for (i = 0; i < OBJ_GRASS_NEAREST_ELEM_MAX; i++) { + sNearestGrassElements[i] = NULL; + sNearestGrassElementsDistSq[i] = SQ(650.0f); } - for (i = 0; i < ARRAY_COUNT(D_809AADA0); i++) { - D_809AADA0[i] = NULL; - D_809AADB0[i] = 422500.0f; + for (i = 0; i < OBJ_GRASS_NEAREST_GROUP_MAX; i++) { + sNearestGrassGroups[i] = NULL; + sNearestGrassGroupsDist[i] = SQ(650.0f); } - for (i = 0; i < this->unk_2944; i++) { - ptr = &this->unk_144[i]; + for (i = 0; i < this->activeGrassGroups; i++) { + grassGroup = &this->grassGroups[i]; - for (j = 0; j < ptr->unk_FC; j++) { - ptr->unk_0C[j].unk_0F &= (u16)~2; + for (j = 0; j < grassGroup->count; j++) { + grassGroup->elements[j].flags &= (u16)~OBJ_GRASS_ELEM_ANIM; } } - for (i = 0; i < this->unk_2944; i++) { - ptr = &this->unk_144[i]; - temp_f0 = Math3D_Vec3fDistSq(&ptr->unk_00, &player->actor.world.pos); + for (i = 0; i < this->activeGrassGroups; i++) { + grassGroup = &this->grassGroups[i]; + distSq = Math3D_Vec3fDistSq(&grassGroup->homePos, &player->actor.world.pos); - for (j = 0; j < ARRAY_COUNT(D_809AADB0); j++) { - if (temp_f0 < D_809AADB0[j]) { + for (j = 0; j < OBJ_GRASS_NEAREST_GROUP_MAX; j++) { + if (distSq < sNearestGrassGroupsDist[j]) { break; } } - if (j < ARRAY_COUNT(D_809AADB0)) { - for (x = 2; x >= j; x--) { - D_809AADB0[x + 1] = D_809AADB0[x]; - D_809AADA0[x + 1] = D_809AADA0[x]; + if (j < OBJ_GRASS_NEAREST_GROUP_MAX) { + // Insert the grassGroup into the list + + // Shift each element under j that remains in the list down 1 + for (x = OBJ_GRASS_NEAREST_GROUP_MAX - 2; x >= j; x--) { + sNearestGrassGroupsDist[x + 1] = sNearestGrassGroupsDist[x]; + sNearestGrassGroups[x + 1] = sNearestGrassGroups[x]; } - D_809AADB0[j] = temp_f0; - D_809AADA0[j] = ptr; + sNearestGrassGroupsDist[j] = distSq; + sNearestGrassGroups[j] = grassGroup; } } - this->unk_3294 = NULL; + this->carryGrassElem = NULL; - for (i = 0; i < ARRAY_COUNT(D_809AADA0); i++) { - ptr = D_809AADA0[i]; + for (i = 0; i < OBJ_GRASS_NEAREST_GROUP_MAX; i++) { + grassGroup = sNearestGrassGroups[i]; - if (ptr != NULL) { - for (j = 0; j < ptr->unk_FC; j++) { - if (!(ptr->unk_0C[j].unk_0F & 4)) { - temp_f0 = Math3D_Vec3fDistSq(&ptr->unk_0C[j].unk_00, &player->actor.world.pos); + if (grassGroup != NULL) { + for (j = 0; j < grassGroup->count; j++) { + if (!(grassGroup->elements[j].flags & OBJ_GRASS_ELEM_REMOVED)) { + distSq = Math3D_Vec3fDistSq(&grassGroup->elements[j].pos, &player->actor.world.pos); - for (x = 0; x < ARRAY_COUNT(D_809AAE10); x++) { - if (temp_f0 < D_809AAE10[x]) { + for (x = 0; x < OBJ_GRASS_NEAREST_ELEM_MAX; x++) { + if (distSq < sNearestGrassElementsDistSq[x]) { break; } } - if (x < ARRAY_COUNT(D_809AAE10)) { - for (y = 18; y >= x; y--) { - D_809AAE10[y + 1] = D_809AAE10[y]; - D_809AADC0[y + 1] = D_809AADC0[y]; + if (x < OBJ_GRASS_NEAREST_ELEM_MAX) { + // Insert the GrassElement into the list + + // Shift each element under j that remains in the list down 1 + for (y = OBJ_GRASS_NEAREST_ELEM_MAX - 2; y >= x; y--) { + sNearestGrassElementsDistSq[y + 1] = sNearestGrassElementsDistSq[y]; + sNearestGrassElements[y + 1] = sNearestGrassElements[y]; } - D_809AAE10[x] = temp_f0; - D_809AADC0[x] = &ptr->unk_0C[j]; + sNearestGrassElementsDistSq[x] = distSq; + sNearestGrassElements[x] = &grassGroup->elements[j]; - if (temp_f0 < 2500.0f) { + if (distSq < SQ(50.0f)) { yaw = player->actor.shape.rot.y - - Math_Vec3f_Yaw(&player->actor.world.pos, &ptr->unk_0C[j].unk_00); + Math_Vec3f_Yaw(&player->actor.world.pos, &grassGroup->elements[j].pos); if (ABS_ALT(yaw) < 0x2000) { - this->unk_3294 = &ptr->unk_0C[j]; + this->carryGrassElem = &grassGroup->elements[j]; } } } @@ -277,28 +285,29 @@ void func_809A983C(ObjGrass* this, PlayState* play) { } } - for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - ptr3 = &this->unk_2948[i]; + for (i = 0; i < ARRAY_COUNT(this->grassElemColliders); i++) { + ObjGrassCollider* grassCol = &this->grassElemColliders[i]; + ObjGrassElement* grassElem; - ptr3->collider.base.acFlags &= (u16)~AC_HIT; - ptr3->collider.base.ocFlags1 &= (u16)~OC1_HIT; + grassCol->collider.base.acFlags &= (u16)~AC_HIT; + grassCol->collider.base.ocFlags1 &= (u16)~OC1_HIT; - ptr2 = D_809AADC0[i]; - if (ptr2 != NULL) { - ptr3->collider.dim.pos.x = ptr2->unk_00.x; - ptr3->collider.dim.pos.y = ptr2->unk_00.y; - ptr3->collider.dim.pos.z = ptr2->unk_00.z; - CollisionCheck_SetAC(play, &play->colChkCtx, &ptr3->collider.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &ptr3->collider.base); - ptr2->unk_0F |= 2; - ptr3->unk_4C = ptr2; + grassElem = sNearestGrassElements[i]; + if (grassElem != NULL) { + grassCol->collider.dim.pos.x = grassElem->pos.x; + grassCol->collider.dim.pos.y = grassElem->pos.y; + grassCol->collider.dim.pos.z = grassElem->pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &grassCol->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &grassCol->collider.base); + grassElem->flags |= OBJ_GRASS_ELEM_ANIM; + grassCol->entity = grassElem; } else { - ptr3->unk_4C = NULL; + grassCol->entity = NULL; } } } -void func_809A9DB8(ObjGrass* this) { +void ObjGrass_CalcAnimationMatrices(ObjGrass* this) { s32 i; s32 pad; f32* ptr; @@ -345,8 +354,8 @@ void func_809A9DB8(ObjGrass* this) { sp6C[6] = (temp_f26 - temp_f22) * temp_f22 * temp_f20 * temp_f16 * 0.0015f; sp6C[7] = (spA4 - temp_f20) * sp94 * sp90 * temp_f16 * 0.0015f; - for (i = 0; i < ARRAY_COUNT(this->unk_2F88); i++) { - ptr = &this->unk_2F88[i].mf[0][0]; + for (i = 0; i < ARRAY_COUNT(this->distortionMtx); i++) { + ptr = &this->distortionMtx[i].mf[0][0]; tempf1 = sp6C[(i + 0) & 7]; tempf2 = sp6C[(i + 1) & 7]; @@ -379,64 +388,65 @@ void func_809A9DB8(ObjGrass* this) { void ObjGrass_Update(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; - func_809A9790(this, play); - func_809A983C(this, play); - func_809A9DB8(this); + ObjGrass_ProcessColliders(this, play); + ObjGrass_UpdateGrass(this, play); + ObjGrass_CalcAnimationMatrices(this); } -void func_809AA278(ObjGrass* this, PlayState* play) { - ObjGrassStruct1* ptr; - ObjGrassStruct1_1* ptr2; +void ObjGrass_InitDraw(ObjGrass* this, PlayState* play) { + ObjGrassGroup* grassGroup; + ObjGrassElement* grassElem; s32 i; s32 j; f32 distSq; - f32 temp_f22; + f32 eyeDist; - for (i = 0; i < this->unk_2944; i++) { - ptr = &this->unk_144[i]; + for (i = 0; i < this->activeGrassGroups; i++) { + grassGroup = &this->grassGroups[i]; - temp_f22 = Math3D_Vec3fDistSq(&ptr->unk_00, &GET_ACTIVE_CAM(play)->eye); + eyeDist = Math3D_Vec3fDistSq(&grassGroup->homePos, &GET_ACTIVE_CAM(play)->eye); - if ((temp_f22 < SQ(1280.0f)) && func_809A9110(play, &ptr->unk_00)) { - ptr->unk_FE |= 1; + if ((eyeDist < SQ(1280.0f)) && func_809A9110(play, &grassGroup->homePos)) { + grassGroup->flags |= OBJ_GRASS_GROUP_DRAW; - for (j = 0; j < ptr->unk_FC; j++) { - ptr2 = &ptr->unk_0C[j]; + for (j = 0; j < grassGroup->count; j++) { + grassElem = &grassGroup->elements[j]; - if (ptr2->unk_0F & 4) { - ptr2->unk_10 = 255; - ptr2->unk_0F &= ~1; + if (grassElem->flags & OBJ_GRASS_ELEM_REMOVED) { + grassElem->alpha = 255; + grassElem->flags &= ~OBJ_GRASS_ELEM_DRAW; } else { - ptr2->unk_0F |= 1; - if (temp_f22 < SQ(980.0f)) { - ptr2->unk_10 = 255; + grassElem->flags |= OBJ_GRASS_ELEM_DRAW; + if (eyeDist < SQ(980.0f)) { + grassElem->alpha = 255; } else { - distSq = Math3D_Vec3fDistSq(&ptr2->unk_00, &GET_ACTIVE_CAM(play)->eye); - if ((distSq <= SQ(1080.0f)) || ((ptr2->unk_0F & 8) && (distSq < SQ(1180.0f)))) { - ptr2->unk_10 = 255; + distSq = Math3D_Vec3fDistSq(&grassElem->pos, &GET_ACTIVE_CAM(play)->eye); + if ((distSq <= SQ(1080.0f)) || + ((grassElem->flags & OBJ_GRASS_ELEM_UNDERWATER) && (distSq < SQ(1180.0f)))) { + grassElem->alpha = 255; } else if (distSq >= SQ(1180.0f)) { - ptr2->unk_10 = 0; + grassElem->alpha = 0; } else { - ptr2->unk_10 = (1180.0f - sqrtf(distSq)) * 2.55f; + grassElem->alpha = (1180.0f - sqrtf(distSq)) * 2.55f; } } } } } else { - ptr->unk_FE &= ~1; + grassGroup->flags &= ~OBJ_GRASS_GROUP_DRAW; } } } -void func_809AA54C(Actor* thisx, PlayState* play2) { +void ObjGrass_DrawOpa(Actor* thisx, PlayState* play2) { ObjGrass* this = THIS; PlayState* play = play2; - Lights* temp_s0; - ObjGrassStruct1* ptr; + Lights* lights; + ObjGrassGroup* grassGroup; s32 i; s32 j; - Vec3s sp70 = { 0, 0, 0 }; - ObjGrassStruct1_1* ptr2; + Vec3s rot = { 0, 0, 0 }; + ObjGrassElement* grassElem; OPEN_DISPS(play->state.gfxCtx); @@ -445,23 +455,23 @@ void func_809AA54C(Actor* thisx, PlayState* play2) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gObjGrass_D_809AA9F0); - for (i = 0; i < this->unk_2944; i++) { - ptr = &this->unk_144[i]; + for (i = 0; i < this->activeGrassGroups; i++) { + grassGroup = &this->grassGroups[i]; - if (ptr->unk_FE & 1) { - temp_s0 = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); - Lights_BindAll(temp_s0, play->lightCtx.listHead, &ptr->unk_00, play); - Lights_Draw(temp_s0, play->state.gfxCtx); + if (grassGroup->flags & OBJ_GRASS_GROUP_DRAW) { + lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, &grassGroup->homePos, play); + Lights_Draw(lights, play->state.gfxCtx); - for (j = 0; j < ptr->unk_FC; j++) { - ptr2 = &ptr->unk_0C[j]; + for (j = 0; j < grassGroup->count; j++) { + grassElem = &grassGroup->elements[j]; - if ((ptr2->unk_0F & 1) && (ptr2->unk_10 == 255)) { - sp70.y = ptr2->unk_0C; - Matrix_SetTranslateRotateYXZ(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, &sp70); + if ((grassElem->flags & OBJ_GRASS_ELEM_DRAW) && (grassElem->alpha == 255)) { + rot.y = grassElem->rotY; + Matrix_SetTranslateRotateYXZ(grassElem->pos.x, grassElem->pos.y, grassElem->pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - if (ptr2->unk_0F & 2) { - func_809A91FC(&this->unk_2F88[j]); + if (grassElem->flags & OBJ_GRASS_ELEM_ANIM) { + ObjGrass_OverrideMatrixCurrent(&this->distortionMtx[j]); } gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), @@ -475,13 +485,13 @@ void func_809AA54C(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); } -void func_809AA798(Actor* thisx, PlayState* play) { +void ObjGrass_DrawXlu(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; - ObjGrassStruct1* ptr; - ObjGrassStruct1_1* ptr2; + ObjGrassGroup* grassGroup; + ObjGrassElement* grassElem; s32 i; s32 j; - Vec3s sp6C = { 0, 0, 0 }; + Vec3s rot = { 0, 0, 0 }; OPEN_DISPS(play->state.gfxCtx); @@ -489,21 +499,21 @@ void func_809AA798(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gObjGrass_D_809AAA68); - for (i = 0; i < this->unk_2944; i++) { - ptr = &this->unk_144[i]; + for (i = 0; i < this->activeGrassGroups; i++) { + grassGroup = &this->grassGroups[i]; - if (ptr->unk_FE & 1) { - for (j = 0; j < ptr->unk_FC; j++) { - ptr2 = &ptr->unk_0C[j]; + if (grassGroup->flags & OBJ_GRASS_GROUP_DRAW) { + for (j = 0; j < grassGroup->count; j++) { + grassElem = &grassGroup->elements[j]; - if ((ptr2->unk_0F & 1) && (ptr2->unk_10 > 0) && (ptr2->unk_10 < 255)) { - sp6C.y = ptr2->unk_0C; - Matrix_SetTranslateRotateYXZ(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, &sp6C); + if ((grassElem->flags & OBJ_GRASS_ELEM_DRAW) && (grassElem->alpha > 0) && (grassElem->alpha < 255)) { + rot.y = grassElem->rotY; + Matrix_SetTranslateRotateYXZ(grassElem->pos.x, grassElem->pos.y, grassElem->pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, ptr2->unk_10); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, grassElem->alpha); gSPDisplayList(POLY_XLU_DISP++, gObjGrass_D_809AAAE0); } } @@ -516,7 +526,7 @@ void func_809AA798(Actor* thisx, PlayState* play) { void ObjGrass_Draw(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; - func_809AA278(this, play); - func_809AA54C(thisx, play); - func_809AA798(thisx, play); + ObjGrass_InitDraw(this, play); + ObjGrass_DrawOpa(thisx, play); + ObjGrass_DrawXlu(thisx, play); } diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.h b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.h index fffcdad4e..f3fb8705d 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.h +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.h @@ -7,40 +7,52 @@ struct ObjGrass; struct ObjGrassCarry; -typedef struct ObjGrassStruct1_1 { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ s16 unk_0C; - /* 0x0E */ s8 unk_0E; - /* 0x0F */ u8 unk_0F; - /* 0x10 */ u8 unk_10; -} ObjGrassStruct1_1; // size = 0x14 +#define OBJ_GRASS_NEAREST_GROUP_MAX 4 +#define OBJ_GRASS_NEAREST_ELEM_MAX 20 + +#define OBJ_GRASS_GROUP_ELEM_COUNT_MAX 12 + +#define OBJ_GRASS_GROUP_DRAW 1 + +#define OBJ_GRASS_ELEM_DRAW 1 +#define OBJ_GRASS_ELEM_ANIM 2 +#define OBJ_GRASS_ELEM_REMOVED 4 +#define OBJ_GRASS_ELEM_UNDERWATER 8 + +typedef struct ObjGrassElement { + /* 0x00 */ Vec3f pos; + /* 0x0C */ s16 rotY; + /* 0x0E */ s8 dropTable; + /* 0x0F */ u8 flags; + /* 0x10 */ u8 alpha; +} ObjGrassElement; // size = 0x14 typedef struct { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ ObjGrassStruct1_1 unk_0C[12]; - /* 0xFC */ s16 unk_FC; - /* 0xFE */ u8 unk_FE; -} ObjGrassStruct1; // size = 0x100 + /* 0x00 */ Vec3f homePos; + /* 0x0C */ ObjGrassElement elements[OBJ_GRASS_GROUP_ELEM_COUNT_MAX]; + /* 0xFC */ s16 count; + /* 0xFE */ u8 flags; +} ObjGrassGroup; // size = 0x100 typedef struct { /* 0x00 */ ColliderCylinder collider; - /* 0x4C */ ObjGrassStruct1_1* unk_4C; -} ObjGrassStruct2; // size = 0x50 + /* 0x4C */ ObjGrassElement* entity; +} ObjGrassCollider; // size = 0x50 typedef struct ObjGrass { /* 0x0000 */ Actor actor; - /* 0x0144 */ ObjGrassStruct1 unk_144[40]; - /* 0x2944 */ s16 unk_2944; - /* 0x2948 */ ObjGrassStruct2 unk_2948[20]; - /* 0x2F88 */ MtxF unk_2F88[12]; + /* 0x0144 */ ObjGrassGroup grassGroups[40]; + /* 0x2944 */ s16 activeGrassGroups; + /* 0x2948 */ ObjGrassCollider grassElemColliders[OBJ_GRASS_NEAREST_ELEM_MAX]; + /* 0x2F88 */ MtxF distortionMtx[OBJ_GRASS_GROUP_ELEM_COUNT_MAX]; /* 0x3288 */ s16 unk_3288; /* 0x328A */ s16 unk_328A; /* 0x328C */ s16 unk_328C; /* 0x328E */ s16 unk_328E; /* 0x3290 */ s16 unk_3290; - /* 0x3292 */ s16 unk_3292; - /* 0x3294 */ ObjGrassStruct1_1* unk_3294; - /* 0x3298 */ struct ObjGrassCarry* unk_3298[2]; + /* 0x3292 */ s16 activeGrassCarry; + /* 0x3294 */ ObjGrassElement* carryGrassElem; + /* 0x3298 */ struct ObjGrassCarry* grassCarry[2]; } ObjGrass; // size = 0x32A0 #endif // Z_OBJ_GRASS_H diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c index 795d740f1..4b9c424f4 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c @@ -17,17 +17,17 @@ void ObjGrassCarry_Init(Actor* thisx, PlayState* play); void ObjGrassCarry_Destroy(Actor* thisx, PlayState* play); void ObjGrassCarry_Update(Actor* thisx, PlayState* play); -void func_809AB3C4(ObjGrassCarry* this); -void func_809AB3D8(ObjGrassCarry* this, PlayState* play); -void func_809AB428(ObjGrassCarry* this); -void func_809AB43C(ObjGrassCarry* this, PlayState* play); -void func_809AB474(ObjGrassCarry* this); -void func_809AB4A8(ObjGrassCarry* this, PlayState* play); -void func_809AB5FC(ObjGrassCarry* this); -void func_809AB610(ObjGrassCarry* this, PlayState* play); -void func_809AB6FC(ObjGrassCarry* this); -void func_809AB77C(ObjGrassCarry* this, PlayState* play); -void func_809ABB7C(Actor* this, PlayState* play); +void ObjGrassCarry_SetupAwaitSpawnManager(ObjGrassCarry* this); +void ObjGrassCarry_AwaitSpawnManager(ObjGrassCarry* this, PlayState* play); +void ObjGrassCarry_SetupIdle(ObjGrassCarry* this); +void ObjGrassCarry_Idle(ObjGrassCarry* this, PlayState* play); +void ObjGrassCarry_Reset(ObjGrassCarry* this); +void ObjGrassCarry_Main(ObjGrassCarry* this, PlayState* play); +void ObjGrassCarry_SetupLiftedUp(ObjGrassCarry* this); +void ObjGrassCarry_LiftedUp(ObjGrassCarry* this, PlayState* play); +void ObjGrassCarry_SetupFall(ObjGrassCarry* this); +void ObjGrassCarry_Fall(ObjGrassCarry* this, PlayState* play); +void ObjGrassCarry_Draw(Actor* this, PlayState* play); ActorInit Obj_Grass_Carry_InitVars = { ACTOR_OBJ_GRASS_CARRY, @@ -61,19 +61,19 @@ static ColliderCylinderInit sCylinderInit = { { 10, 44, 0, { 0, 0, 0 } }, }; -s16 D_809ABBFC = 0; -s16 D_809ABC00 = 0; -s16 D_809ABC04 = 0; -s16 D_809ABC08 = 0; +static s16 sRotSpeedXTarget = 0; +static s16 sRotSpeedX = 0; +static s16 sRotSpeedYTarget = 0; +static s16 sRotSpeedY = 0; -Vec3f D_809ABC0C[] = { +static Vec3f sUnitDirections[] = { { 0.0f, 0.7071f, 0.7071f }, { 0.7071f, 0.7071f, 0.0f }, { 0.0f, 0.7071f, -0.7071f }, { -0.7071f, 0.7071f, 0.0f }, }; -s16 D_809ABC3C[] = { 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26 }; +static s16 sFragmentScales[] = { 108, 102, 96, 84, 66, 55, 42, 38 }; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -3200, ICHAIN_CONTINUE), @@ -81,69 +81,71 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 400, ICHAIN_STOP), }; -void func_809AAE60(ObjGrassCarry* this) { +void ObjGrassCarry_UpdateVelY(ObjGrassCarry* this) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.terminalVelocity) { this->actor.velocity.y = this->actor.terminalVelocity; } } -void func_809AAE94(Vec3f* arg0, f32 arg1) { - arg1 += ((Rand_ZeroOne() * 0.2f) - 0.1f) * arg1; +void ObjGrassCarry_RandScaleVecToZero(Vec3f* velocity, f32 scale) { + scale += ((Rand_ZeroOne() * 0.2f) - 0.1f) * scale; - arg0->x -= (arg0->x * arg1); - arg0->y -= (arg0->y * arg1); - arg0->z -= (arg0->z * arg1); + velocity->x -= velocity->x * scale; + velocity->y -= velocity->y * scale; + velocity->z -= velocity->z * scale; } -void func_809AAF18(ObjGrassCarry* this) { - func_809AAE60(this); - func_809AAE94(&this->actor.velocity, 0.05f); +void ObjGrassCarry_UpdatePos(ObjGrassCarry* this) { + ObjGrassCarry_UpdateVelY(this); + ObjGrassCarry_RandScaleVecToZero(&this->actor.velocity, 0.05f); Actor_UpdatePos(&this->actor); } -void func_809AAF58(ObjGrassCarry* this, PlayState* play) { +void ObjGrassCarry_UpdateBgCheckInfo(ObjGrassCarry* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | UPDBGCHECKINFO_FLAG_80); } -void func_809AAF9C(Vec3f* arg0, s16 arg1, PlayState* play) { - if (!(arg1 & 0x10)) { - Item_DropCollectibleRandom(play, NULL, arg0, arg1 * 0x10); +void ObjGrassCarry_DropCollectible(Vec3f* pos, s16 dropTable, PlayState* play) { + if ((dropTable & 0x10) == 0) { + Item_DropCollectibleRandom(play, NULL, pos, dropTable * 0x10); } } -void func_809AAFE8(Vec3f* arg0, PlayState* play) { - Vec3f spBC; - Vec3f spB0; +void ObjGrassCarry_SpawnFragments(Vec3f* basePos, PlayState* play) { + Vec3f velocity; + Vec3f pos; s32 i; - Vec3f* ptr; + Vec3f* dir; - for (i = 0; i < ARRAY_COUNT(D_809ABC0C); i++) { - ptr = &D_809ABC0C[i]; + for (i = 0; i < ARRAY_COUNT(sUnitDirections); i++) { + dir = &sUnitDirections[i]; - spB0.x = arg0->x + (ptr->x * 8.0f); - spB0.y = arg0->y + (ptr->y * 8.0f) + 10.0f; - spB0.z = arg0->z + (ptr->z * 8.0f); + pos.x = basePos->x + (dir->x * 8.0f); + pos.y = basePos->y + (dir->y * 8.0f) + 10.0f; + pos.z = basePos->z + (dir->z * 8.0f); - spBC.x = (Rand_ZeroOne() - 0.5f) * 8.0f; - spBC.y = Rand_ZeroOne() * 10.0f; - spBC.z = (Rand_ZeroOne() - 0.5f) * 8.0f; + velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f; + velocity.y = Rand_ZeroOne() * 10.0f; + velocity.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, - D_809ABC3C[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, 1, gKakeraLeafMiddle); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, + sFragmentScales[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, GAMEPLAY_KEEP, + gKakeraLeafMiddleDL); - spB0.x = arg0->x + (ptr->x * 16.0f); - spB0.y = arg0->y + (ptr->y * 16.0f) + 10.0f; - spB0.z = arg0->z + (ptr->z * 16.0f); + pos.x = basePos->x + (dir->x * 16.0f); + pos.y = basePos->y + (dir->y * 16.0f) + 10.0f; + pos.z = basePos->z + (dir->z * 16.0f); - spBC.x = (Rand_ZeroOne() - 0.5f) * 6.0f; - spBC.y = Rand_ZeroOne() * 10.0f; - spBC.z = (Rand_ZeroOne() - 0.5f) * 6.0f; + velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f; + velocity.y = Rand_ZeroOne() * 10.0f; + velocity.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, - D_809ABC3C[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, 1, gKakeraLeafTip); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, + sFragmentScales[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, GAMEPLAY_KEEP, + gKakeraLeafTipDL); } } @@ -154,7 +156,7 @@ void ObjGrassCarry_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = 80; - func_809AB3C4(this); + ObjGrassCarry_SetupAwaitSpawnManager(this); } void ObjGrassCarry_Destroy(Actor* thisx, PlayState* play) { @@ -162,73 +164,69 @@ void ObjGrassCarry_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); - if (this->unk_190 != NULL) { - ObjGrassCarry** carry = &this->unk_190->unk_3298[this->actor.params]; + if (this->grassManager != NULL) { + ObjGrassCarry** carry = &this->grassManager->grassCarry[this->actor.params]; if (this == *carry) { *carry = NULL; - this->unk_190 = NULL; + this->grassManager = NULL; } } } -void func_809AB3C4(ObjGrassCarry* this) { - this->actionFunc = func_809AB3D8; +void ObjGrassCarry_SetupAwaitSpawnManager(ObjGrassCarry* this) { + this->actionFunc = ObjGrassCarry_AwaitSpawnManager; } -void func_809AB3D8(ObjGrassCarry* this, PlayState* play) { - if (this->unk_190 != NULL) { - if (this->actor.params != this->unk_190->unk_3292) { - func_809AB474(this); +void ObjGrassCarry_AwaitSpawnManager(ObjGrassCarry* this, PlayState* play) { + if (this->grassManager != NULL) { + if (this->actor.params != this->grassManager->activeGrassCarry) { + ObjGrassCarry_Reset(this); } else { - func_809AB428(this); + ObjGrassCarry_SetupIdle(this); } } } -void func_809AB428(ObjGrassCarry* this) { - this->actionFunc = func_809AB43C; +void ObjGrassCarry_SetupIdle(ObjGrassCarry* this) { + this->actionFunc = ObjGrassCarry_Idle; } -void func_809AB43C(ObjGrassCarry* this, PlayState* play) { - if (this->actor.params != this->unk_190->unk_3292) { - func_809AB474(this); +void ObjGrassCarry_Idle(ObjGrassCarry* this, PlayState* play) { + if (this->actor.params != this->grassManager->activeGrassCarry) { + ObjGrassCarry_Reset(this); } } -void func_809AB474(ObjGrassCarry* this) { - this->actor.shape.rot.z = 0; - this->actionFunc = func_809AB4A8; - this->unk_194 = NULL; - this->actor.shape.rot.y = this->actor.shape.rot.z; - this->actor.shape.rot.x = this->actor.shape.rot.z; - this->actor.world.rot.z = this->actor.shape.rot.z; - this->actor.world.rot.y = this->actor.shape.rot.z; - this->actor.world.rot.x = this->actor.shape.rot.z; +void ObjGrassCarry_Reset(ObjGrassCarry* this) { + this->actionFunc = ObjGrassCarry_Main; + this->grassElem = NULL; + this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = this->actor.shape.rot.x = + this->actor.shape.rot.y = this->actor.shape.rot.z = 0; } -void func_809AB4A8(ObjGrassCarry* this, PlayState* play) { +void ObjGrassCarry_Main(ObjGrassCarry* this, PlayState* play) { Actor* thisx = &this->actor; if (Actor_HasParent(thisx, play)) { - func_809AB5FC(this); - if (this->unk_194 != NULL) { - this->unk_194->unk_0F |= 4; + ObjGrassCarry_SetupLiftedUp(this); + if (this->grassElem != NULL) { + this->grassElem->flags |= OBJ_GRASS_ELEM_REMOVED; } - thisx->draw = func_809ABB7C; + thisx->draw = ObjGrassCarry_Draw; thisx->shape.shadowDraw = ActorShadow_DrawCircle; thisx->shape.shadowAlpha = 60; thisx->shape.shadowScale = 1.0f; - this->unk_190->unk_3292 ^= 1; + this->grassManager->activeGrassCarry ^= 1; thisx->room = -1; SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 20, NA_SE_PL_PULL_UP_PLANT); - } else if (this->unk_190->unk_3294 != NULL) { + } else if (this->grassManager->carryGrassElem != NULL) { Player* player = GET_PLAYER(play); - this->unk_194 = this->unk_190->unk_3294; - Math_Vec3f_Copy(&thisx->world.pos, &this->unk_194->unk_00); - thisx->shape.rot.y = thisx->world.rot.y = this->unk_194->unk_0C; - this->unk_198 = this->unk_194->unk_0E; + this->grassElem = this->grassManager->carryGrassElem; + Math_Vec3f_Copy(&thisx->world.pos, &this->grassElem->pos); + thisx->shape.rot.y = thisx->world.rot.y = this->grassElem->rotY; + this->dropTable = this->grassElem->dropTable; thisx->xzDistToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor); thisx->playerHeightRel = Actor_HeightDiff(&this->actor, &player->actor); thisx->xyzDistToPlayerSq = SQ(thisx->xzDistToPlayer) + SQ(thisx->playerHeightRel); @@ -237,87 +235,88 @@ void func_809AB4A8(ObjGrassCarry* this, PlayState* play) { } } -void func_809AB5FC(ObjGrassCarry* this) { - this->actionFunc = func_809AB610; +void ObjGrassCarry_SetupLiftedUp(ObjGrassCarry* this) { + this->actionFunc = ObjGrassCarry_LiftedUp; } -void func_809AB610(ObjGrassCarry* this, PlayState* play) { +void ObjGrassCarry_LiftedUp(ObjGrassCarry* this, PlayState* play) { s32 pad; - Vec3f sp30; - s32 sp2C; if (Actor_HasNoParent(&this->actor, play)) { - func_809AB6FC(this); + ObjGrassCarry_SetupFall(this); this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; this->actor.gravity = -0.1f; this->actor.terminalVelocity = -17.0f; - func_809AAF18(this); - func_809AAF58(this, play); + ObjGrassCarry_UpdatePos(this); + ObjGrassCarry_UpdateBgCheckInfo(this, play); this->actor.gravity = -3.2f; } else { - sp30.x = this->actor.world.pos.x; - sp30.y = this->actor.world.pos.y + 20.0f; - sp30.z = this->actor.world.pos.z; + Vec3f pos; + s32 bgId; + + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 20.0f; + pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); } } -void func_809AB6FC(ObjGrassCarry* this) { - this->actionFunc = func_809AB77C; - D_809ABBFC = -0xBB8; - D_809ABC04 = (Rand_ZeroOne() - 0.5f) * 1600.0f; - D_809ABC00 = 0; - D_809ABC08 = 0; - this->unk_19A = 60; +void ObjGrassCarry_SetupFall(ObjGrassCarry* this) { + this->actionFunc = ObjGrassCarry_Fall; + sRotSpeedXTarget = -0xBB8; + sRotSpeedYTarget = (Rand_ZeroOne() - 0.5f) * 1600.0f; + sRotSpeedX = 0; + sRotSpeedY = 0; + this->fallTimer = 60; } -void func_809AB77C(ObjGrassCarry* this, PlayState* play) { - s16 phi_s0; - s32 temp_v0 = (this->collider.base.atFlags & AT_HIT) != 0; - Vec3f sp5C; +void ObjGrassCarry_Fall(ObjGrassCarry* this, PlayState* play) { + s16 angle; + s32 atHit = (this->collider.base.atFlags & AT_HIT) != 0; + Vec3f pos; s32 i; - if (temp_v0) { + if (atHit) { this->collider.base.atFlags &= ~AT_HIT; } - this->unk_19A--; + this->fallTimer--; - if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || temp_v0 || - (this->unk_19A <= 0)) { - func_809AAFE8(&this->actor.world.pos, play); - func_809AAF9C(&this->actor.world.pos, this->unk_198, play); + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || atHit || + (this->fallTimer <= 0)) { + ObjGrassCarry_SpawnFragments(&this->actor.world.pos, play); + ObjGrassCarry_DropCollectible(&this->actor.world.pos, this->dropTable, play); this->actor.draw = NULL; this->actor.shape.shadowDraw = NULL; - if (this->unk_190 != NULL) { - this->actor.room = this->unk_190->actor.room; + if (this->grassManager != NULL) { + this->actor.room = this->grassManager->actor.room; } if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } - func_809AB428(this); + ObjGrassCarry_SetupIdle(this); return; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - sp5C.y = this->actor.world.pos.y + this->actor.depthInWater; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; - for (phi_s0 = 0, i = 0; i < 4; i++, phi_s0 += 0x4000) { - sp5C.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.x; - sp5C.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(play, &sp5C, NULL, NULL, 0, 190); + for (angle = 0, i = 0; i < 4; i++, angle += 0x4000) { + pos.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + angle) * 15.0f) + this->actor.world.pos.x; + pos.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + angle) * 15.0f) + this->actor.world.pos.z; + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 190); } - sp5C.x = this->actor.world.pos.x; - sp5C.z = this->actor.world.pos.z; + pos.x = this->actor.world.pos.x; + pos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(play, &sp5C, NULL, NULL, 0, 280); - EffectSsGRipple_Spawn(play, &sp5C, 300, 700, 0); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 280); + EffectSsGRipple_Spawn(play, &pos, 300, 700, 0); this->actor.terminalVelocity = -3.0f; this->actor.velocity.x *= 0.1f; @@ -325,20 +324,20 @@ void func_809AB77C(ObjGrassCarry* this, PlayState* play) { this->actor.velocity.z *= 0.1f; this->actor.gravity *= 0.5f; - D_809ABC00 = D_809ABC00 >> 1; - D_809ABBFC = D_809ABBFC >> 1; - D_809ABC08 = D_809ABC08 >> 1; - D_809ABC04 = D_809ABC04 >> 1; + sRotSpeedX >>= 1; + sRotSpeedXTarget >>= 1; + sRotSpeedY >>= 1; + sRotSpeedYTarget >>= 1; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } - Math_StepToS(&D_809ABC00, D_809ABBFC, 0x1F4); - Math_StepToS(&D_809ABC08, D_809ABC04, 0xAA); - this->actor.shape.rot.x += D_809ABC00; - this->actor.shape.rot.y += D_809ABC08; - func_809AAF18(this); - func_809AAF58(this, play); + Math_StepToS(&sRotSpeedX, sRotSpeedXTarget, 0x1F4); + Math_StepToS(&sRotSpeedY, sRotSpeedYTarget, 0xAA); + this->actor.shape.rot.x += sRotSpeedX; + this->actor.shape.rot.y += sRotSpeedY; + ObjGrassCarry_UpdatePos(this); + ObjGrassCarry_UpdateBgCheckInfo(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); @@ -348,8 +347,8 @@ void func_809AB77C(ObjGrassCarry* this, PlayState* play) { void ObjGrassCarry_Update(Actor* thisx, PlayState* play) { ObjGrassCarry* this = THIS; - if (this->unk_190 == NULL) { - if ((this->actionFunc != func_809AB610) && (this->actionFunc != func_809AB77C)) { + if (this->grassManager == NULL) { + if ((this->actionFunc != ObjGrassCarry_LiftedUp) && (this->actionFunc != ObjGrassCarry_Fall)) { Actor_Kill(&this->actor); return; } @@ -358,6 +357,6 @@ void ObjGrassCarry_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } -void func_809ABB7C(Actor* this, PlayState* play) { +void ObjGrassCarry_Draw(Actor* this, PlayState* play) { Gfx_DrawDListOpa(play, gKusaBushType1DL); } diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h index fa870305e..3f20ea1c1 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h @@ -5,17 +5,17 @@ struct ObjGrassCarry; struct ObjGrass; -struct ObjGrassStruct1_1; +struct ObjGrassElement; typedef void (*ObjGrassCarryActionFunc)(struct ObjGrassCarry*, PlayState*); typedef struct ObjGrassCarry { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; - /* 0x190 */ struct ObjGrass* unk_190; - /* 0x194 */ struct ObjGrassStruct1_1* unk_194; - /* 0x198 */ s16 unk_198; - /* 0x19A */ s16 unk_19A; + /* 0x190 */ struct ObjGrass* grassManager; + /* 0x194 */ struct ObjGrassElement* grassElem; + /* 0x198 */ s16 dropTable; + /* 0x19A */ s16 fallTimer; /* 0x19C */ ObjGrassCarryActionFunc actionFunc; } ObjGrassCarry; // size = 0x1A0 diff --git a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c index c57ed608f..dfb5d0527 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c +++ b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c @@ -1,38 +1,168 @@ /* * File: z_obj_grass_unit.c * Overlay: ovl_Obj_Grass_Unit - * Description: Spawner for circular patch of grass + * Description: Initializes a pattern of grass to be passed to an ObjGrass instance. + * + * ObjGrassUnit instances are intended to be spawned from room data so that just one ObjGrass instance manages the grass + * for that room. When a room with ObjGrassUnit spawns loads, it allocates ovl_Obj_Grass_Unit and creates N instances of + * ObjGrassUnit. The first instance processed initializes sGrassManager, then all instances live on that cycle pass type + * and position data to that ObjGrass instance before calling Actor_Kill. Since ovl_Obj_Grass_Unit uses + * ALLOCTYPE_NORMAL, it is deleted and loses the reference to the newly created ObjGrass. This allows for ObjGrassUnit + * spawned in a different room to be associated to a new ObjGrass instance. */ #include "z_obj_grass_unit.h" +#include "overlays/actors/ovl_Obj_Grass/z_obj_grass.h" +#include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h" #define FLAGS 0x00000000 #define THIS ((ObjGrassUnit*)thisx) -void ObjGrassUnit_Init(Actor* thisx, PlayState* play); +void ObjGrassUnit_Init(Actor* this, PlayState* play2); -#if 0 ActorInit Obj_Grass_Unit_InitVars = { - ACTOR_OBJ_GRASS_UNIT, - ACTORCAT_BG, - FLAGS, - GAMEPLAY_FIELD_KEEP, - sizeof(ObjGrassUnit), - (ActorFunc)ObjGrassUnit_Init, - (ActorFunc)Actor_Noop, - (ActorFunc)Actor_Noop, - (ActorFunc)NULL, + ACTOR_OBJ_GRASS_UNIT, ACTORCAT_BG, FLAGS, + GAMEPLAY_FIELD_KEEP, sizeof(ObjGrassUnit), (ActorFunc)ObjGrassUnit_Init, + (ActorFunc)Actor_Noop, (ActorFunc)Actor_Noop, (ActorFunc)NULL, }; -#endif +// Neat circular pattern with a single bush in the center +static VecPolar sGrassPatternCircle[] = { + { 0.0f, 0x0000 }, { 80.0f, 0x0000 }, { 80.0f, 0x2000 }, { 80.0f, 0x4000 }, { 80.0f, 0x6000 }, + { 80.0f, 0x8000 }, { 80.0f, 0xA000 }, { 80.0f, 0xC000 }, { 80.0f, 0xE000 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Grass_Unit/func_809ABDE0.s") +// "Random" looking pattern +static VecPolar sGrassPatternMixed[] = { + { 40.0f, 0x0666 }, { 40.0f, 0x2CCC }, { 40.0f, 0x5999 }, { 40.0f, 0x8667 }, { 20.0f, 0xC000 }, { 80.0f, 0x1333 }, + { 80.0f, 0x4000 }, { 80.0f, 0x6CCC }, { 80.0f, 0x9334 }, { 80.0f, 0xACCD }, { 80.0f, 0xC667 }, { 60.0f, 0xE000 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Grass_Unit/func_809ABE54.s") +typedef struct { + /* 0x0 */ s32 count; + /* 0x4 */ VecPolar* positions; +} ObjGrassUnitPattern; // size = 0x8 -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Grass_Unit/func_809ABEC4.s") +static ObjGrassUnitPattern sGrassPatterns[2] = { + { ARRAY_COUNT(sGrassPatternCircle), sGrassPatternCircle }, + { ARRAY_COUNT(sGrassPatternMixed), sGrassPatternMixed }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Grass_Unit/func_809ABF38.s") +ObjGrass* sGrassManager = NULL; +ObjGrassCarry* sGrassCarry0 = NULL; +ObjGrassCarry* sGrassCarry1 = NULL; +s32 sInitialized = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Grass_Unit/ObjGrassUnit_Init.s") +s32 ObjGrassUnit_SpawnObjGrass(Actor* this, PlayState* play) { + sGrassManager = (ObjGrass*)Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_GRASS, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1); + if (sGrassManager != NULL) { + sGrassManager->actor.room = this->room; + return true; + } + return false; +} + +s32 ObjGrassUnit_SpawnObjGrassCarry0(Actor* this, PlayState* play) { + sGrassCarry0 = + (ObjGrassCarry*)Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_GRASS_CARRY, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0); + if (sGrassCarry0 != NULL) { + sGrassCarry0->actor.room = this->room; + return true; + } + return false; +} + +s32 ObjGrassUnit_SpawnObjGrassCarry1(Actor* this, PlayState* play) { + sGrassCarry1 = + (ObjGrassCarry*)Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_GRASS_CARRY, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1); + if (sGrassCarry1 != NULL) { + sGrassCarry1->actor.room = this->room; + return true; + } + return false; +} + +s32 ObjGrassUnit_IsUnderwater(PlayState* play, Vec3f* pos) { + WaterBox* waterBox; + f32 ySurface; + s32 bgId; + + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, pos->x, pos->z, &ySurface, &waterBox, &bgId) && + (pos->y < ySurface)) { + return true; + } + return false; +} + +void ObjGrassUnit_Init(Actor* this, PlayState* play2) { + PlayState* play = play2; + ObjGrassGroup* grassGroup; + ObjGrass* grassManager; + f32 homePosYSum; + f32 tmp; + s32 i; + VecPolar* grassPos; + CollisionPoly* poly; + s32 bgId; + ObjGrassElement* grassElem; + ObjGrassUnitPattern* grassPattern; + s8 dropTable = OBJGRASSUNIT_GET_DROPTABLE(this); + + if ((sGrassManager == NULL) && !ObjGrassUnit_SpawnObjGrass(this, play)) { + Actor_Kill(this); + return; + } + if ((sGrassCarry0 == NULL) && ObjGrassUnit_SpawnObjGrassCarry0(this, play)) { + sGrassCarry0->grassManager = sGrassManager; + } + if ((sGrassCarry1 == NULL) && ObjGrassUnit_SpawnObjGrassCarry1(this, play)) { + sGrassCarry1->grassManager = sGrassManager; + } + if (!sInitialized && (sGrassManager != NULL) && (sGrassCarry0 != NULL) && (sGrassCarry1 != NULL)) { + sInitialized = true; + sGrassManager->grassCarry[0] = sGrassCarry0; + sGrassManager->grassCarry[1] = sGrassCarry1; + sGrassCarry0->grassManager = sGrassManager; + sGrassCarry1->grassManager = sGrassManager; + } + + grassManager = sGrassManager; + if (sGrassManager->activeGrassGroups >= ARRAY_COUNT(sGrassManager->grassGroups)) { + Actor_Kill(this); + return; + } + + homePosYSum = 0.0f; + grassGroup = &grassManager->grassGroups[sGrassManager->activeGrassGroups]; + grassGroup->count = 0; + grassPattern = &sGrassPatterns[OBJGRASSUNIT_GET_PATTERN(this)]; + + for (i = 0; i < grassPattern->count; i++) { + grassElem = &grassGroup->elements[grassGroup->count]; + grassPos = &grassPattern->positions[i]; + + grassElem->pos.x = (Math_CosS((this->home.rot.y + grassPos->angle)) * grassPos->distance) + this->home.pos.x; + grassElem->pos.y = this->home.pos.y + 100.0f; + grassElem->pos.z = (Math_SinS((this->home.rot.y + grassPos->angle)) * grassPos->distance) + this->home.pos.z; + + grassElem->pos.y = BgCheck_EntityRaycastFloor5(&play->colCtx, &poly, &bgId, this, &grassElem->pos); + tmp = grassElem->pos.y - this->home.pos.y; + if ((fabsf(tmp) < 80.0f) && (grassElem->pos.y > BGCHECK_Y_MIN)) { + grassGroup->count++; + grassElem->rotY = (s16)(Rand_Next() >> 0x10); + grassElem->dropTable = dropTable; + if (ObjGrassUnit_IsUnderwater(play, &grassElem->pos)) { + grassElem->flags |= OBJ_GRASS_ELEM_UNDERWATER; + } + homePosYSum += grassElem->pos.y; + } + } + if (grassGroup->count > 0) { + grassManager->activeGrassGroups++; + grassGroup->homePos.x = this->home.pos.x; + grassGroup->homePos.y = (homePosYSum / grassGroup->count); + grassGroup->homePos.z = this->home.pos.z; + } + Actor_Kill(this); +} diff --git a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.h b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.h index 58a8a427a..7c24d1e58 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.h +++ b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.h @@ -3,6 +3,9 @@ #include "global.h" +#define OBJGRASSUNIT_GET_DROPTABLE(thisx) (((thisx)->params >> 8) & 0x1F) +#define OBJGRASSUNIT_GET_PATTERN(thisx) ((thisx)->params & 1) + struct ObjGrassUnit; typedef struct ObjGrassUnit { diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index 40db98b1f..8802a257d 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -7,7 +7,7 @@ #include "z_obj_hakaisi.h" #include "objects/object_hakaisi/object_hakaisi.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_20) #define THIS ((ObjHakaisi*)thisx) @@ -98,7 +98,7 @@ void ObjHakaisi_Init(Actor* thisx, PlayState* play) { } Actor_SetScale(&this->dyna.actor, 1.0f); - this->dyna.actor.targetMode = 0; + this->dyna.actor.targetMode = TARGET_MODE_0; this->dyna.actor.colChkInfo.health = 30; if (OBJHAKAISI_GET_FF(&this->dyna.actor) == 3) { this->dyna.actor.draw = NULL; @@ -112,7 +112,7 @@ void ObjHakaisi_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp7C); this->unk_19A = 0; this->unk_198 = 0; - this->switchFlag = OBJHAKAISI_GET_SWITCHFLAG(thisx); + this->switchFlag = OBJHAKAISI_GET_SWITCH_FLAG(thisx); this->csId = this->dyna.actor.csId; if (this->switchFlag == 0xFF) { @@ -168,7 +168,7 @@ void func_80B14460(ObjHakaisi* this, PlayState* play) { func_80B14510(this); } else if (this->dyna.actor.textId != 0) { if (ABS_ALT(sp26) < 0x2000) { - func_800B8614(&this->dyna.actor, play, 100.0f); + Actor_OfferTalk(&this->dyna.actor, play, 100.0f); } } @@ -208,7 +208,7 @@ void func_80B1456C(ObjHakaisi* this, PlayState* play) { void func_80B145F4(ObjHakaisi* this) { this->unk_19A = 0; this->dyna.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->dyna.actor.flags &= ~ACTOR_FLAG_1; + this->dyna.actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80B14648; } @@ -375,7 +375,7 @@ void func_80B151E0(ObjHakaisi* this, PlayState* play) { this->dyna.actor.destroy = func_80B15254; Actor_SetScale(&this->dyna.actor, 0.1f); this->dyna.actor.shape.yOffset = 100.0f; - this->dyna.actor.flags &= ~ACTOR_FLAG_1; + this->dyna.actor.flags &= ~ACTOR_FLAG_TARGETABLE; func_80B15264(this); } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h index 1454181dd..7ee84768a 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h @@ -8,7 +8,7 @@ struct ObjHakaisi; typedef void (*ObjHakaisiActionFunc)(struct ObjHakaisi*, PlayState*); #define OBJHAKAISI_GET_FF(thisx) ((thisx)->params & 0xFF) -#define OBJHAKAISI_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFF00) >> 8) +#define OBJHAKAISI_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0xFF00) >> 8) typedef struct ObjHakaisi { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index f9d1f0252..5ccbf3d50 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -180,7 +180,7 @@ void ObjHamishi_Init(Actor* thisx, PlayState* play) { func_809A13A0(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 2.3f); - if (Flags_GetSwitch(play, OBJHAMISHI_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, OBJHAMISHI_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -232,7 +232,7 @@ void ObjHamishi_Update(Actor* thisx, PlayState* play) { } else { func_809A10F4(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(play, OBJHAMISHI_GET_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, OBJHAMISHI_GET_SWITCH_FLAG(&this->actor)); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h index 962a59612..48ea889d5 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h @@ -5,7 +5,7 @@ struct ObjHamishi; -#define OBJHAMISHI_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define OBJHAMISHI_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) typedef struct ObjHamishi { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 97fbbec3d..fbc581aec 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -48,5 +48,5 @@ void ObjHana_Update(Actor* thisx, PlayState* play) { } void ObjHana_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, object_hana_DL_000500); + Gfx_DrawDListOpa(play, gGraveyardFlowersDL); } diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c index ffc3558e6..3dde506b9 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c @@ -44,7 +44,7 @@ void ObjHsStump_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->isHidden = OBJHSSTUMP_GET_ISHIDDEN(thisx); - this->switchFlag = OBJHSSTUMP_GET_SWITCHFLAG(thisx); + this->switchFlag = OBJHSSTUMP_GET_SWITCH_FLAG(thisx); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_hsstump_Colheader_0011B0); switch (this->isHidden) { @@ -71,7 +71,7 @@ void ObjHsStump_SetupIdle(ObjHsStump* this, PlayState* play) { } void ObjHsStump_Idle(ObjHsStump* this, PlayState* play) { - if (this->isHidden == true && Flags_GetSwitch(play, this->switchFlag)) { + if ((this->isHidden == true) && Flags_GetSwitch(play, this->switchFlag)) { ObjHsStump_SetupAppear(this, play); } } @@ -81,7 +81,7 @@ void ObjHsStump_SetupAppear(ObjHsStump* this, PlayState* play) { this->framesAppeared = 0; this->rotAngle = 0; this->rotFactor = 3640.0f; - func_8019F128(NA_SE_EN_NPC_APPEAR); + Audio_PlaySfx_2(NA_SE_EN_NPC_APPEAR); this->actionFunc = ObjHsStump_Appear; } diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h index 0f06fdfaf..479e17207 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h @@ -3,7 +3,7 @@ #include "global.h" -#define OBJHSSTUMP_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define OBJHSSTUMP_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJHSSTUMP_GET_ISHIDDEN(thisx) (((thisx)->params >> 12) & 0xF) struct ObjHsStump; diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index 40e8b9323..5cced7f48 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -78,7 +78,7 @@ void ObjHsblock_Init(Actor* thisx, PlayState* play) { func_8093E03C(this); break; case 1: - if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH(thisx))) { + if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH_FLAG(thisx))) { func_8093E03C(this); } else { func_8093E05C(this); @@ -106,7 +106,7 @@ void func_8093E05C(ObjHsblock* this) { } void func_8093E0A0(ObjHsblock* this, PlayState* play) { - if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH_FLAG(&this->dyna.actor))) { func_8093E0E8(this); } } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h index f91926409..ca2d81c63 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -3,7 +3,7 @@ #include "global.h" -#define OBJHSBLOCK_GET_SWITCH(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJHSBLOCK_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) #define OBJHSBLOCK_GET_3(thisx) ((thisx)->params & 3) #define OBJHSBLOCK_GET_5(thisx) (((thisx)->params >> 5) & 1) #define OBJHSBLOCK_GET_6(thisx) (((thisx)->params >> 6) & 3) diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index b04dff8a0..a2b376a28 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -340,7 +340,7 @@ void ObjHugebombiwa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, ENHUGEBOMBIWA_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } @@ -409,19 +409,19 @@ void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { if (CutsceneManager_IsNext(this->actor.csId)) { CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); - Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); - if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && + Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_SWITCH_FLAG(&this->actor)); + if (!ENHUGEBOMBIWA_GET_100(&this->actor) && ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_17SETUGEN2))) { SET_WEEKEVENTREG(WEEKEVENTREG_19_02); } - if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { + if (!ENHUGEBOMBIWA_GET_100(&this->actor)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); } else { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_SNOWBALL_BROKEN); } - if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { + if (!ENHUGEBOMBIWA_GET_100(&this->actor)) { func_80A53BE0(play, &this->actor.world.pos); func_80A54E10(this); } else { diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h index 932a61c3d..bb34c5013 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h @@ -7,7 +7,7 @@ struct ObjHugebombiwa; typedef void (*ObjHugebombiwaActionFunc)(struct ObjHugebombiwa*, PlayState*); -#define ENHUGEBOMBIWA_GET_7F(thisx) ((thisx)->params & 0x7F) +#define ENHUGEBOMBIWA_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define ENHUGEBOMBIWA_GET_100(thisx) (((thisx)->params >> 8) & 1) typedef struct { 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 7559c4db7..8ee8520ed 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -3,7 +3,7 @@ * Overlay: ovl_Obj_Hunsui * Description: Switch-Activated Geyser */ -#include "prevent_bss_reordering.h" + #include "z_obj_hunsui.h" #include "objects/object_hunsui/object_hunsui.h" @@ -65,20 +65,20 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), }; -s32 func_80B9C450(PlayState* play, s32 arg1, s32 arg2) { +s32 func_80B9C450(PlayState* play, s32 switchFlagBase, s32 arg2) { s32 sp2C = 1; if (arg2 < ARRAY_COUNT(D_80B9DC70)) { - s32 val = D_80B9DC70[arg2].unk_00; + s32 switchFlagOffset = D_80B9DC70[arg2].unk_00; s32 val3 = D_80B9DC70[arg2].unk_01; - while (val--) { - if ((1 << val) & val3) { - if (!Flags_GetSwitch(play, arg1 + val)) { + while (switchFlagOffset--) { + if ((1 << switchFlagOffset) & val3) { + if (!Flags_GetSwitch(play, switchFlagBase + switchFlagOffset)) { sp2C = 0; break; } - } else if (Flags_GetSwitch(play, arg1 + val)) { + } else if (Flags_GetSwitch(play, switchFlagBase + switchFlagOffset)) { sp2C = 0; break; } @@ -87,23 +87,26 @@ s32 func_80B9C450(PlayState* play, s32 arg1, s32 arg2) { sp2C = 0; switch (arg2) { case 14: - if (!Flags_GetSwitch(play, arg1)) { + if (!Flags_GetSwitch(play, switchFlagBase)) { sp2C = 1; } - if (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && - Flags_GetSwitch(play, arg1 + 3)) { + if (Flags_GetSwitch(play, switchFlagBase + 1) && Flags_GetSwitch(play, switchFlagBase + 2) && + Flags_GetSwitch(play, switchFlagBase + 3)) { sp2C += 2; } break; case 15: - if (!Flags_GetSwitch(play, arg1) || - (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && - Flags_GetSwitch(play, arg1 + 3))) { + if (!Flags_GetSwitch(play, switchFlagBase) || + (Flags_GetSwitch(play, switchFlagBase + 1) && Flags_GetSwitch(play, switchFlagBase + 2) && + Flags_GetSwitch(play, switchFlagBase + 3))) { sp2C = 1; } break; + + default: + break; } } return sp2C; @@ -204,7 +207,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->unk_160 = OBJHUNSUI_GET_F000(thisx); this->unk_164 = OBJHUNSUI_GET_F80(thisx); - this->unk_168 = OBJHUNSUI_GET_7F(thisx); + this->switchFlag = OBJHUNSUI_GET_SWITCH_FLAG(thisx); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if ((this->unk_160 != OBJHUNSUI_F000_5) && (this->unk_160 != OBJHUNSUI_F000_6)) { @@ -279,7 +282,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { case OBJHUNSUI_F000_1: this->dyna.actor.draw = func_80B9DA60; - if ((this->unk_172 & 1) && func_80B9C450(play, this->unk_168, this->unk_164)) { + if ((this->unk_172 & 1) && func_80B9C450(play, this->switchFlag, this->unk_164)) { this->unk_174 = 240.0f; this->unk_172 |= 4; this->unk_184 = 0xFF0; @@ -289,7 +292,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { this->unk_184 = 0; } this->unk_178 = this->unk_174; - this->unk_180 = func_80B9C450(play, this->unk_168, this->unk_164); + this->unk_180 = func_80B9C450(play, this->switchFlag, this->unk_164); this->actionFunc = func_80B9CE64; break; @@ -304,7 +307,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { func_80B9D2BC(this, play); this->unk_178 = this->unk_174; } else { - if ((this->unk_172 & 1) || func_80B9C450(play, this->unk_168, this->unk_164)) { + if ((this->unk_172 & 1) || func_80B9C450(play, this->switchFlag, this->unk_164)) { func_80B9D4D0(this, play); } else { func_80B9D0FC(this, play); @@ -351,7 +354,7 @@ void func_80B9CE64(ObjHunsui* this, PlayState* play) { this->unk_18A += 0x71C; Math_SmoothStepToF(&this->unk_190, this->unk_194, 1.0f, 0.2f, 0.01f); - sp2C = func_80B9C450(play, this->unk_168, this->unk_164); + sp2C = func_80B9C450(play, this->switchFlag, this->unk_164); if (!(this->unk_172 & 1)) { if (sp2C != this->unk_180) { @@ -446,7 +449,7 @@ void func_80B9D120(ObjHunsui* this, PlayState* play) { this->unk_172 |= 2; } - if (func_80B9C450(play, this->unk_168, this->unk_164)) { + if (func_80B9C450(play, this->switchFlag, this->unk_164)) { this->csId = this->csIdList[0]; this->unk_172 |= 0x40; func_80B9D4D0(this, play); @@ -463,7 +466,7 @@ s32 func_80B9D288(PlayState* play, Actor* thisx, Actor* iter, void* verifyData) } void func_80B9D2BC(ObjHunsui* this, PlayState* play) { - if ((this->unk_172 & 1) || func_80B9C450(play, this->unk_168, this->unk_164)) { + if ((this->unk_172 & 1) || func_80B9C450(play, this->switchFlag, this->unk_164)) { func_80B9D4D0(this, play); } else { this->unk_172 |= 2; @@ -559,7 +562,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { this->unk_1B0 += -8.0f + (0.9f * (this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y)); } - if (!(this->unk_172 & 1) && !func_80B9C450(play, this->unk_168, this->unk_164)) { + if (!(this->unk_172 & 1) && !func_80B9C450(play, this->switchFlag, this->unk_164)) { this->csId = this->csIdList[0]; this->unk_172 |= 0x40; func_80B9D0FC(this, play); @@ -576,7 +579,7 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { (this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { Actor_Kill(&this->dyna.actor); } else { - if (Flags_GetSwitch(play, this->unk_168)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->unk_172 &= ~2; this->unk_172 |= 0x10; csId = this->dyna.actor.csId; @@ -600,7 +603,7 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 800.0f, 0.1f, 8.0f, 1.0f) < 0.5f) { if (DECR(this->unk_16E) == 0) { - Flags_UnsetSwitch(play, this->unk_168); + Flags_UnsetSwitch(play, this->switchFlag); } } this->dyna.actor.velocity.y = this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y; @@ -634,7 +637,7 @@ void ObjHunsui_Draw(Actor* thisx, PlayState* play) { if (this->unk_172 & 0x10) { f32 temp_f8 = (this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) / 800.0f; - func_8019FAD8(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp_f8); + Audio_PlaySfx_AtPosWithFreq(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp_f8); } if (!(this->unk_172 & 2)) { @@ -650,7 +653,7 @@ void func_80B9DA60(Actor* thisx, PlayState* play) { if (this->unk_172 & 0x10) { temp = 1.0f + ((this->unk_178 - 240.0f) / 270.0f); - func_8019FAD8(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp); + Audio_PlaySfx_AtPosWithFreq(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp); } if ((this->dyna.actor.flags & ACTOR_FLAG_40) && !(this->unk_172 & 2)) { 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 1f0450b28..a0b42a648 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h @@ -8,7 +8,7 @@ struct ObjHunsui; typedef void (*ObjHunsuiActionFunc)(struct ObjHunsui*, PlayState*); -#define OBJHUNSUI_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJHUNSUI_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJHUNSUI_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJHUNSUI_GET_F000(thisx) (((thisx)->params >> 0xC) & 0xF) @@ -27,7 +27,7 @@ typedef struct ObjHunsui { /* 0x15C */ ObjHunsuiActionFunc actionFunc; /* 0x160 */ s16 unk_160; /* 0x164 */ s32 unk_164; - /* 0x168 */ s32 unk_168; + /* 0x168 */ s32 switchFlag; /* 0x16C */ s8 unk_16C; /* 0x16D */ s8 unk_16D; /* 0x16E */ s8 unk_16E; 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 d1601e69d..8df527f37 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 @@ -81,7 +81,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { ObjIcePoly* this = THIS; s32 i; - this->unk_149 = OBJICEPOLY_GET_FF00(thisx); + this->switchFlag = OBJICEPOLY_GET_SWITCH_FLAG(thisx); thisx->params &= 0xFF; thisx->uncullZoneForward = 5600.0f; @@ -115,7 +115,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.x = 0x500; thisx->shape.rot.z = -0x500; - if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || + if (((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) || ((play->sceneId == SCENE_KAJIYA) && CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE))) { Actor_Kill(thisx); return; @@ -193,13 +193,13 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { ((this->colliders2[0].base.ac->id != ACTOR_OBJ_AQUA) && (this->colliders2[0].info.acHitInfo->toucher.dmgFlags == 0x800)) || ((this->colliders2[0].base.ac->id == ACTOR_OBJ_AQUA) && - (this->colliders2[0].base.ac->params == OBJAQUA_1)))) || + (this->colliders2[0].base.ac->params == AQUA_TYPE_HOT)))) || ((this->colliders2[1].base.acFlags & AC_HIT) && ((this->colliders2[1].base.ac == NULL) || ((this->colliders2[1].base.ac->id != ACTOR_OBJ_AQUA) && (this->colliders2[1].info.acHitInfo->toucher.dmgFlags == 0x800)) || ((this->colliders2[1].base.ac->id == ACTOR_OBJ_AQUA) && - (this->colliders2[1].base.ac->params == OBJAQUA_1))))) { + (this->colliders2[1].base.ac->params == AQUA_TYPE_HOT))))) { CutsceneManager_Queue(this->actor.csId); this->unk_14A = 0; this->actionFunc = func_80931E58; @@ -219,7 +219,7 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { } } while (actor != NULL); } - } else if ((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) { + } else if ((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) { CutsceneManager_Queue(this->actor.csId); this->unk_14A = 1; this->actionFunc = func_80931E58; @@ -328,8 +328,8 @@ void func_80931EEC(ObjIcePoly* this, PlayState* play) { if (this->unk_14A == 0) { CutsceneManager_Stop(this->actor.csId); - if (this->unk_149 != OBJICEPOLY_FF_FF) { - Flags_SetSwitch(play, this->unk_149); + if (this->switchFlag != 0xFF) { + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h index b081a7250..3e59cd92e 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h @@ -7,15 +7,13 @@ struct ObjIcePoly; typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*); -#define OBJICEPOLY_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) - -#define OBJICEPOLY_FF_FF 0xFF +#define OBJICEPOLY_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0xFF) typedef struct ObjIcePoly { /* 0x000 */ Actor actor; /* 0x144 */ ObjIcePolyActionFunc actionFunc; /* 0x148 */ u8 unk_148; - /* 0x149 */ u8 unk_149; + /* 0x149 */ u8 switchFlag; /* 0x14A */ s16 unk_14A; /* 0x14C */ ColliderCylinder colliders1[2]; /* 0x1E4 */ ColliderCylinder colliders2[2]; 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 0ae8abe18..edeb9e269 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -1181,7 +1181,7 @@ void func_80A25E50(ObjIceblock* this, PlayState* play) { func_80A2541C(this, play); func_80A25CF4(this); } else { - func_800B9010(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } } @@ -1267,7 +1267,7 @@ void func_80A26144(ObjIceblock* this, PlayState* play) { func_80A23B88(this); func_80A25FA0(this); } else { - func_800B9010(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } func_80A24DD0(this, play); 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 529d7ec95..e69995ed2 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 @@ -93,7 +93,7 @@ void ObjJgameLight_Destroy(Actor* thisx, PlayState* play) { void func_80C15474(ObjJgameLight* this, PlayState* play) { u8 temp_a1; - if ((this->actor.colChkInfo.health & OBJLUPYGAMELIFT_IGNITE_FIRE) && (this->isOn == false)) { + if ((this->actor.colChkInfo.health & OBJLUPYGAMELIFT_IGNITE_FIRE) && !this->isOn) { if (this->lightRadius < 160) { this->lightRadius += 40; } else { @@ -123,7 +123,7 @@ void func_80C15474(ObjJgameLight* this, PlayState* play) { } } if (this->flameScaleProportion > 0.1f) { - func_800B9010(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } temp_a1 = (s32)(Rand_ZeroOne() * 127.0f) + 128; Lights_PointSetColorAndRadius(&this->lightInfo, temp_a1, temp_a1 * 0.7f, 0, this->lightRadius); @@ -138,7 +138,7 @@ void ObjJgameLight_UpdateCollision(ObjJgameLight* this, PlayState* play) { void func_80C15718(ObjJgameLight* this, PlayState* play) { if ((this->actor.colChkInfo.health & OBJLUPYGAMELIFT_IGNITE_FIRE) && !(this->prevHealth & OBJLUPYGAMELIFT_IGNITE_FIRE)) { - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_FLAME_IGNITION); + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_FLAME_IGNITION); this->prevHealth = this->actor.colChkInfo.health; } if (this->actor.colChkInfo.health & OBJLUPYGAMELIFT_DISPLAY_CORRECT) { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index e33f62f8b..3885041fd 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -68,7 +68,7 @@ static ColliderCylinderInit sCylinderInit = { { 15, 30, 0, { 0, 0, 0 } }, }; -static s16 sObjectIdList[] = { GAMEPLAY_DANGEON_KEEP, OBJECT_KIBAKO }; +static s16 sObjectIds[] = { GAMEPLAY_DANGEON_KEEP, OBJECT_KIBAKO }; static Gfx* sKakeraDisplayLists[] = { gameplay_dangeon_keep_DL_007980, gSmallCrateFragmentDL }; @@ -135,12 +135,12 @@ void func_80926394(ObjKibako* this, PlayState* play) { void ObjKibako_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjKibako* this = THIS; - s32 whichBankIndex; + s32 objectIndex; - whichBankIndex = KIBAKO_BANK_INDEX(thisx); + objectIndex = KIBAKO_BANK_INDEX(thisx); Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, 0.15f); - if (whichBankIndex == 0) { + if (objectIndex == 0) { this->actor.uncullZoneForward = 4000.0f; } else { this->actor.uncullZoneForward = 800.0f; @@ -149,8 +149,8 @@ void ObjKibako_Init(Actor* thisx, PlayState* play2) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->bankIndex = Object_GetIndex(&play->objectCtx, sObjectIdList[whichBankIndex]); - if (this->bankIndex < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[objectIndex]); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -197,7 +197,7 @@ void ObjKibako_AirBreak(ObjKibako* this, PlayState* play) { } EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -200, phi_s0, 20, 0, 0, (Rand_ZeroOne() * 38.0f) + 10.0f, - 0, 0, 60, -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], + 0, 0, 60, -1, sObjectIds[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); } @@ -241,7 +241,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, PlayState* play) { phi_s0 = (temp_rand < 0.2f) ? 0x40 : 0x20; EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -180, phi_s0, 50, 5, 0, (Rand_ZeroOne() * 35.0f) + 10.0f, - 0, 0, 70, -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], + 0, 0, 70, -1, sObjectIds[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); } } @@ -254,9 +254,9 @@ void func_80926B54(ObjKibako* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { this->actor.draw = ObjKibako_Draw; - this->actor.objBankIndex = this->bankIndex; + this->actor.objectSlot = this->objectSlot; ObjKibako_SetupIdle(this); } } diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h index 102dd1e1b..274a335d4 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h @@ -17,7 +17,7 @@ typedef struct ObjKibako { /* 0x144 */ ObjKibakoActionFunc actionFunc; /* 0x148 */ ColliderCylinder collider; /* 0x194 */ s16 timer; - /* 0x196 */ s16 bankIndex; + /* 0x196 */ s16 objectSlot; /* 0x198 */ s8 isDropCollected; /* 0x199 */ s8 unk199; /* room? */ } ObjKibako; // size = 0x19C diff --git a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c index 5bf35d48d..c6529625c 100644 --- a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c +++ b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c @@ -42,11 +42,11 @@ void ObjKinoko_Update(Actor* thisx, PlayState* play) { if (player->currentMask != PLAYER_MASK_SCENTS) { thisx->draw = NULL; thisx->hintId = TATL_HINT_ID_NONE; - thisx->flags &= ~ACTOR_FLAG_1; + thisx->flags &= ~ACTOR_FLAG_TARGETABLE; } else { thisx->draw = ObjKinoko_Draw; thisx->hintId = TATL_HINT_ID_MUSHROOM; - thisx->flags |= ACTOR_FLAG_1; + thisx->flags |= ACTOR_FLAG_TARGETABLE; if (Actor_HasParent(thisx, play)) { Flags_SetCollectible(play, OBJ_KINOKO_GET_FLAG(thisx)); Actor_Kill(thisx); diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c index ee8536caa..94937b164 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c @@ -42,11 +42,11 @@ void ObjKzsaku_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->dyna.actor, 1.0f); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(&object_kzsaku_Colheader_001118, &col); + CollisionHeader_GetVirtual(&gUnderwaterGrateCol, &col); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, col); - this->switchFlag = KZSAKU_GET_SWITCHFLAG(thisx); + this->switchFlag = KZSAKU_GET_SWITCH_FLAG(thisx); this->raisedAmount = 0.0f; if (Flags_GetSwitch(play, this->switchFlag)) { @@ -86,7 +86,7 @@ void ObjKzsaku_Rise(ObjKzsaku* this, PlayState* play) { } } if (this->raisedAmount < 450.0f) { - func_800B9010(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); this->raisedAmount += 15.0f; } else { func_80C08C84(this); @@ -124,7 +124,7 @@ void ObjKzsaku_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_kzsaku_DL_000040); + gSPDisplayList(POLY_OPA_DISP++, gUnderwaterGrateDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h index 0a6f00187..2af2db8ab 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h @@ -3,7 +3,7 @@ #include "global.h" -#define KZSAKU_GET_SWITCHFLAG(thisx) (((thisx)->params & 0x7F00) >> 8) +#define KZSAKU_GET_SWITCH_FLAG(thisx) (((thisx)->params & 0x7F00) >> 8) struct ObjKzsaku; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 88d04b780..9e92dcb11 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -101,7 +101,7 @@ void ObjLift_Init(Actor* thisx, PlayState* play) { this->unk_178 = this->dyna.actor.home.rot.z; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - if ((this->unk_178 <= 0) && (Flags_GetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)))) { + if ((this->unk_178 <= 0) && (Flags_GetSwitch(play, OBJLIFT_GET_SWITCH_FLAG(&this->dyna.actor)))) { Actor_Kill(&this->dyna.actor); return; } @@ -196,7 +196,7 @@ void func_8093DA48(ObjLift* this, PlayState* play) { func_8093DB70(this); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - Flags_SetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJLIFT_GET_SWITCH_FLAG(&this->dyna.actor)); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index b7f2af050..ae973ecbf 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -5,7 +5,7 @@ #define OBJLIFT_GET_1(thisx) ((thisx)->params & 1) #define OBJLIFT_GET_7(thisx) (((thisx)->params >> 8) & 7) -#define OBJLIFT_GET_7F(thisx) (((thisx)->params >> 1) & 0x7F) +#define OBJLIFT_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 1) & 0x7F) struct ObjLift; diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c index 6a6937e7e..28ead0679 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c @@ -5,6 +5,7 @@ */ #include "z_obj_lightblock.h" +#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #include "objects/object_lightblock/object_lightblock.h" #define FLAGS 0x00000000 @@ -15,12 +16,12 @@ void ObjLightblock_Init(Actor* thisx, PlayState* play); void ObjLightblock_Destroy(Actor* thisx, PlayState* play); void ObjLightblock_Update(Actor* thisx, PlayState* play); void ObjLightblock_Draw(Actor* thisx, PlayState* play); -void func_80AF3AC8(ObjLightblock* this); -void func_80AF3ADC(ObjLightblock* this, PlayState* play); -void func_80AF3B8C(ObjLightblock* this); -void func_80AF3BA0(ObjLightblock* this, PlayState* play); -void func_80AF3C18(ObjLightblock* this); -void func_80AF3C34(ObjLightblock* this, PlayState* play); +void ObjLightblock_SetupWait(ObjLightblock* this); +void ObjLightblock_Wait(ObjLightblock* this, PlayState* play); +void ObjLightblock_SetupPlayCutscene(ObjLightblock* this); +void ObjLightblock_PlayCutscene(ObjLightblock* this, PlayState* play); +void ObjLightblock_SetupFadeAway(ObjLightblock* this); +void ObjLightblock_FadeAway(ObjLightblock* this, PlayState* play); ActorInit Obj_Lightblock_InitVars = { ACTOR_OBJ_LIGHTBLOCK, @@ -54,17 +55,17 @@ static ColliderCylinderInit sCylinderInit = { { 84, 120, 0, { 0, 0, 0 } }, }; -typedef struct { +typedef struct LightblockTypeVars { /* 0x0 */ f32 scale; /* 0x4 */ s16 radius; /* 0x6 */ s16 height; /* 0x8 */ s16 yShift; - /* 0xC */ s32 params; + /* 0xC */ s32 effectParams; } LightblockTypeVars; // size = 0x10 static LightblockTypeVars sLightblockTypeVars[] = { - { 0.1f, 76, 80, 19, 2 }, - { (1.0f / 6), 126, 144, 19, 3 }, + { 0.1f, 76, 80, 19, DEMO_EFFECT_TIMEWARP_LIGHTBLOCK_LARGE }, + { (1.0f / 6.0f), 126, 144, 19, DEMO_EFFECT_TIMEWARP_LIGHTBLOCK_VERY_LARGE }, }; static InitChainEntry sInitChain[] = { @@ -76,11 +77,11 @@ static InitChainEntry sInitChain[] = { extern Gfx D_801AEF88[]; extern Gfx D_801AEFA0[]; -void func_80AF3910(ObjLightblock* this, PlayState* play) { +void ObjLightblock_SpawnEffect(ObjLightblock* this, PlayState* play) { LightblockTypeVars* typeVars = &sLightblockTypeVars[LIGHTBLOCK_TYPE(&this->dyna.actor)]; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, - this->dyna.actor.world.pos.z, 0, 0, 0, typeVars->params); + this->dyna.actor.world.pos.z, 0, 0, 0, typeVars->effectParams); } void ObjLightblock_Init(Actor* thisx, PlayState* play) { @@ -92,19 +93,19 @@ void ObjLightblock_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->dyna.actor, typeVars->scale); DynaPolyActor_Init(&this->dyna, 0); Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(play, LIGHTBLOCK_DESTROYED(&this->dyna.actor))) { + if (Flags_GetSwitch(play, LIGHTBLOCK_GET_DESTROYED_SWITCH_FLAG(&this->dyna.actor))) { Actor_Kill(&this->dyna.actor); return; } - DynaPolyActor_LoadMesh(play, &this->dyna, &object_lightblock_Colheader_000B80); + DynaPolyActor_LoadMesh(play, &this->dyna, &gSunBlockCol); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->collider.dim.radius = typeVars->radius; this->collider.dim.height = typeVars->height; this->collider.dim.yShift = typeVars->yShift; this->alpha = 255; - func_80AF3AC8(this); + ObjLightblock_SetupWait(this); } void ObjLightblock_Destroy(Actor* thisx, PlayState* play) { @@ -114,11 +115,14 @@ void ObjLightblock_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80AF3AC8(ObjLightblock* this) { - this->actionFunc = func_80AF3ADC; +void ObjLightblock_SetupWait(ObjLightblock* this) { + this->actionFunc = ObjLightblock_Wait; } -void func_80AF3ADC(ObjLightblock* this, PlayState* play) { +/** + * Wait for a single collision from a Light Arrow or 8 frames of Mirror Shield ray collision. + */ +void ObjLightblock_Wait(ObjLightblock* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; // light arrows @@ -135,39 +139,36 @@ void func_80AF3ADC(ObjLightblock* this, PlayState* play) { if (this->collisionCounter >= 8) { CutsceneManager_Queue(this->dyna.actor.csId); - func_80AF3B8C(this); + ObjLightblock_SetupPlayCutscene(this); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80AF3B8C(ObjLightblock* this) { - this->actionFunc = func_80AF3BA0; +void ObjLightblock_SetupPlayCutscene(ObjLightblock* this) { + this->actionFunc = ObjLightblock_PlayCutscene; } -void func_80AF3BA0(ObjLightblock* this, PlayState* play) { +void ObjLightblock_PlayCutscene(ObjLightblock* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - Flags_SetSwitch(play, LIGHTBLOCK_DESTROYED(&this->dyna.actor)); - func_80AF3910(this, play); - func_80AF3C18(this); + Flags_SetSwitch(play, LIGHTBLOCK_GET_DESTROYED_SWITCH_FLAG(&this->dyna.actor)); + ObjLightblock_SpawnEffect(this, play); + ObjLightblock_SetupFadeAway(this); } else { CutsceneManager_Queue(this->dyna.actor.csId); } } -void func_80AF3C18(ObjLightblock* this) { +void ObjLightblock_SetupFadeAway(ObjLightblock* this) { this->timer = 80; - this->actionFunc = func_80AF3C34; + this->actionFunc = ObjLightblock_FadeAway; } -void func_80AF3C34(ObjLightblock* this, PlayState* play) { - s8 csId; - +void ObjLightblock_FadeAway(ObjLightblock* this, PlayState* play) { this->timer--; if (this->timer <= 0) { - csId = this->dyna.actor.csId; - CutsceneManager_Stop(csId); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); return; } @@ -199,13 +200,13 @@ void ObjLightblock_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, this->alpha); - gSPDisplayList(POLY_XLU_DISP++, object_lightblock_DL_000178); + gSPDisplayList(POLY_XLU_DISP++, gSunBlockDL); } else { Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); - gSPDisplayList(POLY_OPA_DISP++, object_lightblock_DL_000178); + gSPDisplayList(POLY_OPA_DISP++, gSunBlockDL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h index 63a106dac..c1c1bcbb7 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h @@ -4,7 +4,7 @@ #include "global.h" #define LIGHTBLOCK_TYPE(thisx) ((thisx)->params & 1) -#define LIGHTBLOCK_DESTROYED(thisx) (((thisx)->params >> 8) & 0x7F) +#define LIGHTBLOCK_GET_DESTROYED_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) struct ObjLightblock; 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 408668ecb..1acb015ea 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, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor)); } else { - Flags_UnsetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); + Flags_UnsetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor)); } } @@ -150,7 +150,7 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { u32 isSwitchActivated; s32 isTriggered; - isSwitchActivated = Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); + isSwitchActivated = Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor)); isTriggered = false; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetFocus(&this->actor, 0.0f); @@ -264,7 +264,7 @@ void ObjLightSwitch_Enabled(ObjLightswitch* this, PlayState* play) { if (actorType == LIGHTSWITCH_TYPE_REGULAR) { // switch can be disabled outside of this actor by flag - if (!Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor))) { + if (!Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor))) { ObjLightSwitch_SetupDisabled(this); } } else if (actorType == LIGHTSWITCH_TYPE_FLIP) { @@ -319,7 +319,7 @@ void ObjLightSwitch_Fade(ObjLightswitch* this, PlayState* play) { return; } - func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); // "burn into ashes" + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); // "burn into ashes" } void ObjLightswitch_Update(Actor* thisx, PlayState* 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 c26dab262..c81a87057 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -40,6 +40,6 @@ typedef struct ObjLightswitch { #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) +#define LIGHTSWITCH_GET_SWITCH_FLAG(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 da16d938f..c7605c825 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -53,7 +53,7 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { if (!func_8099FA40(this, play)) { this->unk144 = -1; } - if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAG(thisx))) { Actor_Kill(&this->actor); } } @@ -62,7 +62,7 @@ void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = THIS; if (func_8099FA40(this, play)) { - Flags_UnsetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx)); + Flags_UnsetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAG(thisx)); } } @@ -107,7 +107,7 @@ void func_8099FB64(Actor* thisx, PlayState* play) { void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { ObjMakekinsuta* this = THIS; - if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAG(thisx))) { this->actor.update = func_8099FD7C; CutsceneManager_Queue(this->actor.csId); } else { 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 17c9220e2..6afe50e1a 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h @@ -8,7 +8,7 @@ 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) +#define OBJMAKEKINSUTA_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) typedef struct ObjMakekinsuta { /* 0x000 */ Actor actor; 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 bcef92843..76ccba1b1 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 @@ ActorInit Obj_Makeoshihiki_InitVars = { s32 ObjMakeoshihiki_GetChildSpawnPointIndex(ObjMakeoshihiki* this, PlayState* play) { s32 pad; - 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; + s32 pathIndexOffset1 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_1(&this->actor)) ? 1 : 0; + s32 pathIndexOffset2 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_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->actor); - switchFlag1 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(&this->actor); + switchFlag2 = OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_2(&this->actor); + switchFlag1 = OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_1(&this->actor); if (pathIndex & 2) { Flags_SetSwitch(play, switchFlag2); 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 fbe8c1283..c9ae90921 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h @@ -6,8 +6,8 @@ struct ObjMakeoshihiki; #define OBJMAKEOSHIHIKI_GET_PATH_INDEX(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) +#define OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_1(thisx) ((thisx)->home.rot.z & 0x7F) +#define OBJMAKEOSHIHIKI_GET_SWITCH_FLAG_2(thisx) ((thisx)->params & 0x7F) typedef struct ObjMakeoshihiki { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index dab7489ee..dddbaa256 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -42,19 +42,19 @@ void ObjMoonStone_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.3f); this->unk194 = (this->actor.params & 0xF000) >> 0xC; - this->actor.targetMode = 0; + this->actor.targetMode = TARGET_MODE_0; this->actor.shape.yOffset = 25.0f; this->actor.focus.pos.y += 10.0f; if (this->unk194 == 0) { this->actor.colChkInfo.health = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); func_80C0662C(this); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_74_80)) { Actor_Spawn(&play->actorCtx, play, 1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -1); } - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; func_80C0673C(this); } else { Actor_Kill(&this->actor); @@ -80,7 +80,7 @@ void func_80C06640(ObjMoonStone* this, PlayState* play) { } else { s32 phi_v0 = ABS_ALT(sp1A); if (phi_v0 < 0x1555) { - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } } } @@ -117,7 +117,7 @@ void func_80C06768(ObjMoonStone* this, PlayState* play) { this->actor.draw = NULL; func_80C0685C(this); } else if (this->actor.xzDistToPlayer < 25.0f) { - Actor_OfferGetItem(&this->actor, play, GI_MOON_TEAR, 100.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_MOONS_TEAR, 100.0f, 30.0f); } } } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index d08f2d638..f0315a16e 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -6,7 +6,7 @@ #include "z_obj_mu_pict.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((ObjMuPict*)thisx) @@ -46,7 +46,7 @@ void ObjMuPict_Init(Actor* thisx, PlayState* play) { func_80C06D90(this, play); this->unk14A = OBJMUPICT_GET_F000(&this->actor); - this->actor.targetMode = 6; + this->actor.targetMode = TARGET_MODE_6; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; this->unk148 = 0; @@ -76,7 +76,7 @@ void func_80C06B70(ObjMuPict* this, PlayState* play) { func_80C06C54(this); } } else if (ABS_ALT(yawDiff) < 0x2AAA) { - func_800B8614(&this->actor, play, 80.0f); + Actor_OfferTalk(&this->actor, play, 80.0f); } } diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index f63201966..49a0bb656 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -5,6 +5,10 @@ */ #include "z_obj_mure.h" +#include "overlays/actors/ovl_En_Butte/z_en_butte.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" +#include "overlays/actors/ovl_En_Insect/z_en_insect.h" +#include "overlays/actors/ovl_En_Kusa/z_en_kusa.h" #define FLAGS 0x00000000 @@ -32,8 +36,12 @@ ActorInit Obj_Mure_InitVars = { (ActorFunc)NULL, }; -static f32 sZClip[] = { - 1600.0f, 1600.0f, 1000.0f, 1000.0f, 1000.0f, +static f32 sZClip[OBJMURE_TYPE_MAX] = { + 1600.0f, // OBJMURE_TYPE_GRASS + 1600.0f, // OBJMURE_TYPE_UNDEFINED + 1000.0f, // OBJMURE_TYPE_FISH + 1000.0f, // OBJMURE_TYPE_BUGS + 1000.0f, // OBJMURE_TYPE_BUTTERFLY }; static s32 sMaxChildSpawns[] = { @@ -43,12 +51,20 @@ static s32 sMaxChildSpawns[] = { 0, }; -static s16 sSpawnActorIds[] = { - ACTOR_EN_KUSA, 0, ACTOR_EN_FISH, ACTOR_EN_INSECT, ACTOR_EN_BUTTE, +static s16 sSpawnActorIds[OBJMURE_TYPE_MAX] = { + ACTOR_EN_KUSA, // OBJMURE_TYPE_GRASS + ACTOR_PLAYER, // OBJMURE_TYPE_UNDEFINED + ACTOR_EN_FISH, // OBJMURE_TYPE_FISH + ACTOR_EN_INSECT, // OBJMURE_TYPE_BUGS + ACTOR_EN_BUTTE, // OBJMURE_TYPE_BUTTERFLY }; -static s16 sSpawnParams[] = { - 0, 2, -1, 0, -1, +static s16 sSpawnParams[OBJMURE_TYPE_MAX] = { + KUSA_BUSH_PARAMS(false, 0, false), // OBJMURE_TYPE_GRASS + PLAYER_PARAMS(2, PLAYER_INITMODE_0), // OBJMURE_TYPE_UNDEFINED + FISH_PARAMS(ENFISH_MINUS1), // OBJMURE_TYPE_FISH + ENINSECT_PARAMS(false), // OBJMURE_TYPE_BUGS + BUTTERFLY_PARAMS(BUTTERFLY_MINUS1), // OBJMURE_TYPE_BUTTERFLY }; static InitChainEntry sInitChain[] = { @@ -57,15 +73,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1200, ICHAIN_STOP), }; -typedef enum { - /* 0 */ OBJMURE_TYPE_GRASS, - /* 1 */ OBJMURE_TYPE_UNDEFINED, - /* 2 */ OBJMURE_TYPE_FISH, - /* 3 */ OBJMURE_TYPE_BUGS, - /* 4 */ OBJMURE_TYPE_BUTTERFLY, - /* 5 */ OBJMURE_TYPE_MAX -} ObjMureType; - typedef enum { /* 0 */ OBJMURE_CHILD_STATE_0, /* 1 */ OBJMURE_CHILD_STATE_DEAD, 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 7bf2d40b7..57a099dc1 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -7,6 +7,20 @@ struct ObjMure; typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); +#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) + +typedef enum { + /* 0 */ OBJMURE_TYPE_GRASS, + /* 1 */ OBJMURE_TYPE_UNDEFINED, + /* 2 */ OBJMURE_TYPE_FISH, + /* 3 */ OBJMURE_TYPE_BUGS, + /* 4 */ OBJMURE_TYPE_BUTTERFLY, + /* 5 */ OBJMURE_TYPE_MAX +} ObjMureType; + #define OBJMURE_MAX_SPAWNS 15 typedef struct { @@ -29,9 +43,4 @@ typedef struct ObjMure { /* 0x1A0 */ s16 unk_1A0; } ObjMure; // size = 0x1A4 -#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 10f12c64a..d894c64a6 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -134,7 +134,7 @@ void func_8098F438(ObjMure3* this, PlayState* play) { if ((*collectible != NULL) && !((this->unk164 >> i) & 1)) { if ((*collectible)->unk1A4 != 0) { - Flags_SetSwitch(play, OBJMURE3_PARAM_7F(&this->actor)); + Flags_SetSwitch(play, OBJMURE3_GET_SWITCH_FLAG(&this->actor)); } if ((*collectible)->actor.update == NULL) { this->unk164 |= (1 << i); @@ -147,7 +147,7 @@ void func_8098F438(ObjMure3* this, PlayState* play) { void ObjMure3_Init(Actor* thisx, PlayState* play) { ObjMure3* this = THIS; - if (Flags_GetSwitch(play, OBJMURE3_PARAM_7F(&this->actor))) { + if (Flags_GetSwitch(play, OBJMURE3_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); return; } 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 336a092b4..fb79e3440 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -3,7 +3,7 @@ #include "global.h" -#define OBJMURE3_PARAM_7F(thisx) ((thisx)->params & 0x7F) +#define OBJMURE3_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJMURE3_PARAM_RUPEEINDEX(thisx) (((thisx)->params >> 13) & 7) struct ObjMure3; 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 4710b8908..a4259857a 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -4,7 +4,6 @@ * Description: Sakon's Hideout Objects (Sun's Mask, doors, etc) */ -#include "prevent_bss_reordering.h" #include "z_obj_nozoki.h" #include "objects/object_secom_obj/object_secom_obj.h" @@ -47,10 +46,10 @@ ActorInit Obj_Nozoki_InitVars = { static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 0, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_0, ICHAIN_STOP), }; -s16 D_80BA34B8[] = { OBJECT_SECOM_OBJ, OBJECT_GI_MSSA, OBJECT_SECOM_OBJ, OBJECT_SECOM_OBJ }; +static s16 sObjectIds[] = { OBJECT_SECOM_OBJ, OBJECT_GI_MSSA, OBJECT_SECOM_OBJ, OBJECT_SECOM_OBJ }; Vec3f D_80BA34C0 = { 0.0f, 0.0f, -1110.0f }; @@ -94,15 +93,15 @@ void ObjNozoki_Destroy(Actor* thisx, PlayState* play) { } void func_80BA2514(ObjNozoki* this, PlayState* play) { - s32 sp24 = Object_GetIndex(&play->objectCtx, D_80BA34B8[this->unk_15C]); + s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->unk_15C]); - if (sp24 < 0) { + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->dyna.actor); return; } - if (Object_IsLoaded(&play->objectCtx, sp24)) { - this->dyna.actor.objBankIndex = sp24; + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { + this->dyna.actor.objectSlot = objectSlot; this->dyna.actor.draw = ObjNozoki_Draw; if (this->unk_15C == 0) { @@ -175,7 +174,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) { play->actorCtx.flags |= ACTORCTX_FLAG_7; } - if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { return; } } @@ -184,7 +183,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) { func_80BA2790(this); if (D_80BA36B0 == 0) { this->unk_15E = 25; - play_sound(NA_SE_SY_SECOM_WARNING); + Audio_PlaySfx(NA_SE_SY_SECOM_WARNING); } else { this->unk_15E = CutsceneManager_GetLength(this->csId); if (this->unk_15E < 0) { @@ -210,10 +209,10 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y); if (OBJNOZOKI_GET_200(&this->dyna.actor)) { - if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { return; } - } else if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { s32 csId = this->dyna.actor.csId; if (csId == this->csId) { @@ -253,20 +252,20 @@ void func_80BA2AB4(ObjNozoki* this, PlayState* play) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) { if (!(OBJNOZOKI_GET_200(&this->dyna.actor)) && - Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { func_80BA2790(this); } } } -void func_80BA2B64(ObjNozoki* this, PlayState* play, s32 arg2, s32 arg3) { +void func_80BA2B64(ObjNozoki* this, PlayState* play, s32 arg2, s32 switchFlag) { this->unk_15D = arg2; this->unk_15E = 80; - Flags_UnsetSwitch(play, arg3); + Flags_UnsetSwitch(play, switchFlag); } void func_80BA2BA4(ObjNozoki* this, PlayState* play) { - if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { this->dyna.actor.shape.rot.x = -0x1F40; this->unk_15E = 80; } else if (DECR(this->unk_15E) == 0) { @@ -332,7 +331,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) { Actor_Kill(&this->dyna.actor); } } else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) && - Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) { + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) { static Vec3f D_80BA34F0 = { 0.0f, 0.0f, 50.0f }; play->actorCtx.flags |= ACTORCTX_FLAG_6; @@ -363,7 +362,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) { play->roomCtx.unk7A[0] = this->dyna.actor.velocity.x; - func_8019FAD8(&gSfxDefaultPos, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speed); + Audio_PlaySfx_AtPosWithFreq(&gSfxDefaultPos, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speed); } void func_80BA3044(ObjNozoki* this, PlayState* play) { @@ -375,7 +374,7 @@ void func_80BA3044(ObjNozoki* this, PlayState* play) { this->unk_15E = 20; Math_Vec3f_Copy(&this->dyna.actor.world.pos, sp1C); } else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) && - Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { sp1C = &this->dyna.actor.home.pos; } } else if (DECR(this->unk_15E) == 0) { @@ -387,7 +386,7 @@ void func_80BA3044(ObjNozoki* this, PlayState* play) { void func_80BA311C(ObjNozoki* this, PlayState* play) { if (this->unk_15D == 0) { - if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCH_FLAG1(&this->dyna.actor))) { this->unk_15D = 1; this->unk_15E = 70; } @@ -414,10 +413,10 @@ void func_80BA3230(ObjNozoki* this, PlayState* play) { if ((test3 != NULL) && (test3->draw != NULL)) { if ((play->curSpawn == 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_64_40)) { - this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10000); + this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10000); this->dyna.actor.textId = 0x297A; } else { - this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_64_40)) { this->dyna.actor.textId = 0; } else { @@ -428,7 +427,7 @@ void func_80BA3230(ObjNozoki* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { ObjNozoki_SetupAction(this, func_80BA3344); } else { - func_800B8614(&this->dyna.actor, play, 50.0f); + Actor_OfferTalk(&this->dyna.actor, play, 50.0f); } } } diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h index 8bfc9818e..33c97db69 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h @@ -7,11 +7,11 @@ struct ObjNozoki; typedef void (*ObjNozokiActionFunc)(struct ObjNozoki*, PlayState*); -#define OBJNOZOKI_GET_SWITCHFLAG1(thisx) ((thisx)->params & 0x7F) +#define OBJNOZOKI_GET_SWITCH_FLAG1(thisx) ((thisx)->params & 0x7F) #define OBJNOZOKI_GET_180(thisx) (((thisx)->params >> 7) & 3) #define OBJNOZOKI_GET_200(thisx) ((thisx)->params & 0x200) #define OBJNOZOKI_GET_400(thisx) ((thisx)->params & 0x400) -#define OBJNOZOKI_GET_SWITCHFLAG2(thisx) (((thisx)->params >> 9) & 0x7F) +#define OBJNOZOKI_GET_SWITCH_FLAG2(thisx) (((thisx)->params >> 9) & 0x7F) #define OBJNOZOKI_400 0x400 diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 168168f41..b5ba51418 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -44,8 +44,8 @@ ActorInit Obj_Ocarinalift_InitVars = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), + ICHAIN_U8(targetMode, TARGET_MODE_2, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; @@ -112,7 +112,7 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { s32 sp34; Vec3s* temp_v1_2; - func_800B9010(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); Math_Vec3s_ToVec3f(&sp48, this->unk170 + this->unk168 + this->unk16C); Math_Vec3f_Diff(&sp48, &thisx->world.pos, &thisx->velocity); magnitude = Math3D_Vec3fMagnitude(&thisx->velocity); @@ -197,13 +197,13 @@ void func_80AC9A7C(ObjOcarinalift* this, PlayState* play) { } void func_80AC9AB8(ObjOcarinalift* this) { - this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); + this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); this->actionFunc = func_80AC9AE0; } void func_80AC9AE0(ObjOcarinalift* this, PlayState* play) { if (func_800B8718(&this->dyna.actor, &play->state)) { - func_80152434(play, 1); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY); func_80AC9B48(this); } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_800B8804(&this->dyna.actor, play, 40.0f); @@ -216,7 +216,7 @@ void func_80AC9B48(ObjOcarinalift* this) { void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { if (func_800B886C(&this->dyna.actor, play)) { - if (play->msgCtx.ocarinaMode == 4) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { if (play->msgCtx.lastPlayedSong == 0) { if (OBJOCARINALIFT_GET_C(&this->dyna.actor) != OBJOCARINALIFT_PARAM_1) { Flags_SetSwitch(play, OBJOCARINALIFT_GET_SWITCH_FLAG(&this->dyna.actor)); @@ -225,8 +225,8 @@ void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { func_80AC9C20(this); } } else { - if (play->msgCtx.ocarinaMode >= 2) { - play->msgCtx.ocarinaMode = 4; + if (play->msgCtx.ocarinaMode >= OCARINA_MODE_WARP) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } func_80AC9AB8(this); } @@ -234,7 +234,7 @@ void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { } void func_80AC9C20(ObjOcarinalift* this) { - this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); + this->dyna.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); this->actionFunc = func_80AC9C48; } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 736d80d10..9d49067fe 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -134,26 +134,26 @@ void ObjOshihiki_UpdateInitPos(ObjOshihiki* this) { } s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, PlayState* play) { - s16 dynaSwitchFlag; + s16 switchFlag; if (dyna == NULL) { return true; } if (dyna->actor.id == ACTOR_OBJ_SWITCH) { - dynaSwitchFlag = OBJSWITCH_GET_7F00(&dyna->actor); + switchFlag = OBJSWITCH_GET_7F00(&dyna->actor); switch (OBJSWITCH_GET_33(&dyna->actor)) { case OBJSWITCH_NORMAL_BLUE: - if ((dynaSwitchFlag == OBJOSHIHIKI_GET_7F00(&this->dyna.actor)) && - Flags_GetSwitch(play, dynaSwitchFlag)) { + if ((switchFlag == OBJOSHIHIKI_GET_SWITCH_FLAG(&this->dyna.actor)) && + Flags_GetSwitch(play, switchFlag)) { return false; } break; case OBJSWITCH_INVERSE_BLUE: - if ((dynaSwitchFlag == OBJOSHIHIKI_GET_7F00(&this->dyna.actor)) && - !Flags_GetSwitch(play, dynaSwitchFlag)) { + if ((switchFlag == OBJOSHIHIKI_GET_SWITCH_FLAG(&this->dyna.actor)) && + !Flags_GetSwitch(play, switchFlag)) { return false; } break; @@ -200,13 +200,16 @@ void ObjOshihiki_Init(Actor* thisx, PlayState* play) { if ((OBJOSHIHIKI_GET_FF00(&this->dyna.actor) >= OBJOSHIHIKI_FF00_0) && (OBJOSHIHIKI_GET_FF00(&this->dyna.actor) < OBJOSHIHIKI_FF00_80)) { - if (Flags_GetSwitch(play, OBJOSHIHIKI_GET_7F00(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJOSHIHIKI_GET_SWITCH_FLAG(&this->dyna.actor))) { switch (OBJOSHIHIKI_GET_F(&this->dyna.actor)) { case OBJOSHIHIKI_F_0: case OBJOSHIHIKI_F_1: case OBJOSHIHIKI_F_2: Actor_Kill(&this->dyna.actor); return; + + default: + break; } } else { switch (OBJOSHIHIKI_GET_F(&this->dyna.actor)) { @@ -215,6 +218,9 @@ void ObjOshihiki_Init(Actor* thisx, PlayState* play) { case OBJOSHIHIKI_F_5: Actor_Kill(&this->dyna.actor); return; + + default: + break; } } } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index 4740b907a..6a400f2dc 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -9,7 +9,7 @@ typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, PlayState*); #define OBJOSHIHIKI_GET_F(thisx) ((thisx)->params & 0xF) #define OBJOSHIHIKI_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) -#define OBJOSHIHIKI_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJOSHIHIKI_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) #define OBJOSHIHIKI_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) typedef enum { diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c index 649343554..9be9106d6 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c @@ -130,8 +130,8 @@ void ObjPurify_Init(Actor* thisx, PlayState* play) { if (sp20 == 1) { DynaPolyActor_Init(&this->dyna, 0); } - this->objIndex = Object_GetIndex(&play->objectCtx, info->objectId); - if (this->objIndex < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, info->objectId); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->dyna.actor); } else if (sp20 == 0) { func_80A84EAC(this); @@ -158,10 +158,10 @@ void func_80A84EC0(ObjPurify* this, PlayState* play) { s32 sp28; s32 index; - if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { sp28 = OBJPURIFY_GET_UNK_FLAG(&this->dyna.actor); index = OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor); - this->dyna.actor.objBankIndex = this->objIndex; + this->dyna.actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); if (sp28 == 1) { DynaPolyActor_LoadMesh(play, &this->dyna, sObjPurifyInfo[index].colHeader); diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h index 2651bf049..cea8c6e9a 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h @@ -12,7 +12,7 @@ typedef struct ObjPurify { /* 0x15C */ ObjPurifyActionFunc actionFunc; /* 0x160 */ s32 gfxIndex; /* 0x164 */ s16 timer; - /* 0x166 */ s16 objIndex; + /* 0x166 */ s16 objectSlot; /* 0x168 */ f32 unk168[2]; } ObjPurify; // size = 0x170 diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index 8a124b0ab..478991a86 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -41,7 +41,7 @@ s16 D_809A4050[] = { 1, -1, 0, 0 }; s16 D_809A4058[] = { 0, 0, 1, -1 }; typedef struct { - /* 0x0 */ s16 unk_00; + /* 0x0 */ s16 objectId; /* 0x4 */ CollisionHeader* unk_04; /* 0x8 */ Gfx* unk_08; } ObjPzlblockStruct; // size = 0xC @@ -207,11 +207,11 @@ void ObjPzlblock_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); - this->unk_17A = Object_GetIndex(&play->objectCtx, sp24->unk_00); + this->objectSlot = Object_GetSlot(&play->objectCtx, sp24->objectId); if (sp28 == 0) { func_809A3D1C(this); - } else if (Flags_GetSwitch(play, OBJPZLBLOCK_GET_7F(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJPZLBLOCK_GET_SWITCH_FLAG(&this->dyna.actor))) { if (sp2C == 0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (sp28 * 60); func_809A3D1C(this); @@ -295,7 +295,7 @@ void func_809A3BC0(ObjPzlblock* this, PlayState* play) { } } else { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Flags_SetSwitch(play, OBJPZLBLOCK_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJPZLBLOCK_GET_SWITCH_FLAG(&this->dyna.actor)); sp20 = 1; } @@ -307,7 +307,7 @@ void func_809A3BC0(ObjPzlblock* this, PlayState* play) { func_809A3D1C(this); } } else { - func_800B9010(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } } @@ -330,10 +330,10 @@ void ObjPzlblock_Update(Actor* thisx, PlayState* play) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); - if (Object_IsLoaded(&play->objectCtx, this->unk_17A)) { + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { ObjPzlblockStruct* sp2C = &D_809A4060[OBJPZLBLOCK_GET_1000(&this->dyna.actor)]; - this->dyna.actor.objBankIndex = this->unk_17A; + this->dyna.actor.objectSlot = this->objectSlot; Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_LoadMesh(play, &this->dyna, sp2C->unk_04); this->dyna.actor.update = func_809A3E58; diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h index 5cf67efcc..9f235ced1 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h @@ -7,7 +7,7 @@ struct ObjPzlblock; typedef void (*ObjPzlblockActionFunc)(struct ObjPzlblock*, PlayState*); -#define OBJPZLBLOCK_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJPZLBLOCK_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJPZLBLOCK_GET_700(thisx) (((thisx)->params >> 8) & 7) #define OBJPZLBLOCK_GET_1000(thisx) (((thisx)->params >> 0xC) & 1) #define OBJPZLBLOCK_GET_ROTZ(thisx) ((thisx)->home.rot.z & 7) @@ -22,7 +22,7 @@ typedef struct ObjPzlblock { /* 0x16E */ s16 unk_16E[4]; /* 0x176 */ s16 unk_176; /* 0x178 */ s16 unk_178; - /* 0x17A */ s8 unk_17A; + /* 0x17A */ s8 objectSlot; } ObjPzlblock; // size = 0x17C #endif // Z_OBJ_PZLBLOCK_H diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 1a63e89cb..dc5e9e315 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -92,7 +92,7 @@ void ObjRaillift_Init(Actor* thisx, PlayState* play) { this->direction = 1; this->points = Lib_SegmentedToVirtual(path->points); ObjRaillift_UpdatePosition(this, this->curPoint); - if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(thisx))) { + if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(play, OBJRAILLIFT_GET_SWITCH_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; } else { this->actionFunc = ObjRaillift_Move; @@ -120,13 +120,13 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { Vec3s* endPoint; if (OBJRAILLIFT_HAS_FLAG(thisx)) { - if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(thisx))) { + if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_SWITCH_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; return; } if (OBJRAILLIFT_GET_TYPE(thisx) == DEKU_FLOWER_PLATFORM) { - func_800B9010(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); } } @@ -196,7 +196,7 @@ void ObjRaillift_Wait(ObjRaillift* this, PlayState* play) { } void ObjRaillift_Idle(ObjRaillift* this, PlayState* play) { - if (Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJRAILLIFT_GET_SWITCH_FLAG(&this->dyna.actor))) { this->dyna.actor.speed = 0.0f; CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = ObjRaillift_StartCutscene; @@ -215,8 +215,6 @@ void ObjRaillift_StartCutscene(ObjRaillift* this, PlayState* play) { void ObjRaillift_Update(Actor* thisx, PlayState* play) { ObjRaillift* this = THIS; - f32 target; - f32 step; this->actionFunc(this, play); Actor_SetFocus(thisx, 10.0f); @@ -227,7 +225,8 @@ void ObjRaillift_Update(Actor* thisx, PlayState* play) { } } if (OBJRAILLIFT_REACT_TO_PLAYER_ON_TOP(thisx)) { - s32 requiredScopeTemp; + f32 target; + f32 step; this->isPlayerOnTopPrev = this->isPlayerOnTop; this->isPlayerOnTop = DynaPolyActor_IsPlayerOnTop(&this->dyna) ? true : false; diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h index dc197432f..64aa01130 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h @@ -9,7 +9,7 @@ typedef void (*ObjRailliftActionFunc)(struct ObjRaillift*, PlayState*); #define OBJRAILLIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) #define OBJRAILLIFT_HAS_FLAG(thisx) (((thisx)->params >> 0xD) & 1) -#define OBJRAILLIFT_GET_FLAG(thisx) ((thisx)->home.rot.x & 0x7F) +#define OBJRAILLIFT_GET_SWITCH_FLAG(thisx) ((thisx)->home.rot.x & 0x7F) #define OBJRAILLIFT_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJRAILLIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJRAILLIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 3871508ba..1fe208ba8 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -33,7 +33,7 @@ ActorInit Obj_Roomtimer_InitVars = { void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { ObjRoomtimer* this = THIS; - this->switchFlag = ROOMTIMER_GET_SWITCHFLAG(thisx); + this->switchFlag = ROOMTIMER_GET_SWITCH_FLAG(thisx); this->actor.params &= 0x1FF; if (this->actor.params != 0x1FF) { @@ -67,7 +67,7 @@ void func_80973D3C(ObjRoomtimer* this, PlayState* play) { CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_80973DE0; } else if ((this->actor.params != 0x1FF) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF)) { - play_sound(NA_SE_OC_ABYSS); + Audio_PlaySfx(NA_SE_OC_ABYSS); func_80169EFC(&play->state); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h index 5ce7d13d4..d976de5e3 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h @@ -3,7 +3,7 @@ #include "global.h" -#define ROOMTIMER_GET_SWITCHFLAG(thisx) (((thisx)->params >> 9) & 0x7F) +#define ROOMTIMER_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 9) & 0x7F) struct ObjRoomtimer; diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 28ce8cda8..09dd82441 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -567,7 +567,7 @@ void func_80A224A4(ObjSkateblock* this, PlayState* play) { func_80A21D1C(this); sp28 = true; } else { - func_800B9010(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } func_80A21CD8(this); diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c index 92ac9ad85..06de02581 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c @@ -110,7 +110,7 @@ void func_80B02CD0(ObjSnowball* this, PlayState* play) { } void func_80B02D58(ObjSnowball* this, PlayState* play) { - s32 temp_v0 = func_800A8150(OBJSNOWBALL_GET_3F(&this->actor)); + s32 temp_v0 = func_800A8150(OBJSNOWBALL_GET_SWITCH_FLAG(&this->actor)); if (temp_v0 >= 0) { Item_DropCollectible(play, &this->actor.home.pos, (OBJSNOWBALL_GET_7F00(&this->actor) << 8) | temp_v0); @@ -443,7 +443,7 @@ void func_80B03FF8(ObjSnowball* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); if (rotY == 5) { - Flags_SetSwitch(play, OBJSNOWBALL_GET_3F(&this->actor)); + Flags_SetSwitch(play, OBJSNOWBALL_GET_SWITCH_FLAG(&this->actor)); } } @@ -478,10 +478,10 @@ void ObjSnowball_Init(Actor* thisx, PlayState* play) { if (sp34) { this->actor.textId = 0x238; - this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.targetArrowOffset = 1400.0f / 3.0f; Actor_SetFocus(&this->actor, 24.0f); - this->actor.targetMode = 3; + this->actor.targetMode = TARGET_MODE_3; } Collider_InitJntSph(play, &this->collider); @@ -509,7 +509,7 @@ void ObjSnowball_Init(Actor* thisx, PlayState* play) { func_80B04338(this, play); - if ((sp40 == 5) && Flags_GetSwitch(play, OBJSNOWBALL_GET_3F(&this->actor))) { + if ((sp40 == 5) && Flags_GetSwitch(play, OBJSNOWBALL_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); } } @@ -537,7 +537,7 @@ void func_80B04350(ObjSnowball* this, PlayState* play) { (0x80000000 | 0x4000 | 0x800 | 0x400 | 0x100 | 0x8))) { this->actor.flags |= ACTOR_FLAG_10; if (this->actor.home.rot.y == 1) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); + this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY); } if (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x4000) { @@ -763,7 +763,7 @@ void ObjSnowball_Update(Actor* thisx, PlayState* play) { } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags |= ACTOR_FLAG_10; this->unk_211 = 1; - } else if (this->actor.isTargeted) { + } else if (this->actor.isLockedOn) { sp24 = true; } } @@ -771,7 +771,7 @@ void ObjSnowball_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (sp24 && (this->actionFunc == func_80B04350)) { - func_800B8614(&this->actor, play, 100.0f); + Actor_OfferTalk(&this->actor, play, 100.0f); } if ((this->actor.floorPoly != NULL) && (this->actor.projectedPos.z < 920.0f)) { diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h index 804c2596c..16ce58f91 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h @@ -7,7 +7,7 @@ struct ObjSnowball; typedef void (*ObjSnowballActionFunc)(struct ObjSnowball*, PlayState*); -#define OBJSNOWBALL_GET_3F(thisx) ((thisx)->params & 0x3F) +#define OBJSNOWBALL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x3F) #define OBJSNOWBALL_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) typedef struct { diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index ec05294d1..c19c537ce 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -594,7 +594,7 @@ void func_80B3A500(ObjSnowball2* this, PlayState* play) { func_80B38E88(this, play); } - func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); } else { func_80B38E20(this); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c index 42c2bcc95..1bcfd0ab5 100644 --- a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c +++ b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c @@ -1,7 +1,7 @@ /* * File: z_obj_sound.c * Overlay: ovl_Obj_Sound - * Description: Plays certain sounds (e.g., swamp waterfall noise) + * Description: An invisible point-source to play sounds, including sfx and sequences. */ #include "z_obj_sound.h" @@ -13,8 +13,8 @@ void ObjSound_Init(Actor* thisx, PlayState* play); void ObjSound_Destroy(Actor* thisx, PlayState* play); void ObjSound_Update(Actor* thisx, PlayState* play); +void ObjSound_Draw(Actor* thisx, PlayState* play); -#if 0 ActorInit Obj_Sound_InitVars = { ACTOR_OBJ_SOUND, ACTORCAT_ITEMACTION, @@ -27,12 +27,50 @@ ActorInit Obj_Sound_InitVars = { (ActorFunc)NULL, }; -#endif +void ObjSound_Init(Actor* thisx, PlayState* play) { + ObjSound* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Init.s") + this->unk_144 = false; + this->soundType = OBJ_SOUND_GET_TYPE(&this->actor); + this->sfxType = OBJ_SOUND_GET_SFX_TYPE(&this->actor); + this->actor.params &= OBJ_SOUND_ID_MASK; + if (this->soundType == OBJ_SOUND_TYPE_FANFARE) { + this->actor.draw = ObjSound_Draw; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Destroy.s") +void ObjSound_Destroy(Actor* thisx, PlayState* play) { + ObjSound* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/ObjSound_Update.s") + if (this->soundType == OBJ_SOUND_TYPE_BGM) { + Audio_PlayObjSoundBgm(NULL, NA_BGM_GENERAL_SFX); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Sound/func_8099AA84.s") +void ObjSound_Update(Actor* thisx, PlayState* play) { + ObjSound* this = THIS; + + if (this->soundType == OBJ_SOUND_TYPE_SFX) { + if (this->sfxType != 0) { + Actor_PlaySfx_Flagged(&this->actor, gAudioEnvironmentalSfx[this->actor.params]); + } else { + Actor_PlaySfx_FlaggedCentered3(&this->actor, gAudioEnvironmentalSfx[this->actor.params]); + } + } else if (this->unk_144) { + if (this->soundType == OBJ_SOUND_TYPE_BGM) { + Audio_PlayObjSoundBgm(&this->actor.projectedPos, this->actor.params); + } else if (this->soundType == OBJ_SOUND_TYPE_FIXED_SFX) { + Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, gAudioEnvironmentalSfx[this->actor.params]); + } + } else { + this->unk_144 = true; + } +} + +void ObjSound_Draw(Actor* thisx, PlayState* play) { + ObjSound* this = THIS; + + if (CHECK_EVENTINF(EVENTINF_41) || CHECK_EVENTINF(EVENTINF_35)) { + Audio_PlayObjSoundFanfare(&this->actor.projectedPos, this->actor.params); + } +} diff --git a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.h b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.h index a83aa840b..f9ec7fa8f 100644 --- a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.h +++ b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.h @@ -5,9 +5,22 @@ struct ObjSound; +#define OBJ_SOUND_GET_TYPE(thisx) (((thisx)->params >> 8) & 0xFF) +#define OBJ_SOUND_GET_SFX_TYPE(thisx) (((thisx)->params >> 7) & 1) +#define OBJ_SOUND_ID_MASK 0x7F + +typedef enum { + /* 0 */ OBJ_SOUND_TYPE_SFX, + /* 1 */ OBJ_SOUND_TYPE_BGM, + /* 2 */ OBJ_SOUND_TYPE_FIXED_SFX, + /* 3 */ OBJ_SOUND_TYPE_FANFARE +} ObjSoundType; + typedef struct ObjSound { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ u8 unk_144; + /* 0x145 */ u8 sfxType; + /* 0x146 */ s16 soundType; } ObjSound; // size = 0x148 #endif // Z_OBJ_SOUND_H 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 c366a6982..785a3ea5a 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -529,7 +529,7 @@ s32 func_80B30480(ObjSpidertent* this, PlayState* play, Vec3f* arg2) { Vec3f sp58; f32 sp54; - if (player->heldItemAction == PLAYER_IA_STICK) { + if (player->heldItemAction == PLAYER_IA_DEKU_STICK) { if (player->unk_B28 > 0) { for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { triNorm = &this->collider.elements[i].dim; @@ -564,7 +564,7 @@ void ObjSpidertent_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); Collider_InitTris(play, &this->collider); - if (Flags_GetSwitch(play, OBJSPIDERTENT_GET_7F00(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJSPIDERTENT_GET_SWITCH_FLAG(&this->dyna.actor))) { Actor_Kill(&this->dyna.actor); return; } @@ -681,7 +681,7 @@ void func_80B30A4C(ObjSpidertent* this, PlayState* play) { if (this->dyna.actor.csId >= 0) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); } - Flags_SetSwitch(play, OBJSPIDERTENT_GET_7F00(&this->dyna.actor)); + Flags_SetSwitch(play, OBJSPIDERTENT_GET_SWITCH_FLAG(&this->dyna.actor)); func_80B30AD4(this); } else { CutsceneManager_Queue(this->dyna.actor.csId); diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h index 881a816a7..880921535 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h @@ -8,7 +8,7 @@ struct ObjSpidertent; typedef void (*ObjSpidertentActionFunc)(struct ObjSpidertent*, PlayState*); #define OBJSPIDERTENT_GET_1(thisx) ((thisx)->params & 1) -#define OBJSPIDERTENT_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJSPIDERTENT_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) typedef struct ObjSpidertent { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 70d6c2619..52652c8bb 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -250,13 +250,13 @@ Actor* ObjSwitch_SpawnIce(ObjSwitch* this, PlayState* play) { void ObjSwitch_SetSwitchFlagState(ObjSwitch* this, PlayState* play, s32 setFlag) { if (setFlag) { - s32 flag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); + s32 switchFlag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); - Flags_SetSwitch(play, flag); + Flags_SetSwitch(play, switchFlag); } else { - s32 flag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); + s32 switchFlag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); - Flags_UnsetSwitch(play, flag); + Flags_UnsetSwitch(play, switchFlag); } } @@ -381,7 +381,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { ObjSwitch_InitJntSphCollider(this, play, &sJntSphInit); } if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { - this->dyna.actor.targetMode = 4; + this->dyna.actor.targetMode = TARGET_MODE_4; this->dyna.actor.flags |= 1; } this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -397,7 +397,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { this->dyna.actor.flags |= 0x80; } if (type == OBJSWITCH_TYPE_EYE) { - if (sIsSegmentTableInit == false) { + if (!sIsSegmentTableInit) { s32 i; s32 j; @@ -509,7 +509,7 @@ void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play) { if (OBJ_SWITCH_GET_TYPE(&this->dyna.actor) == OBJSWITCH_TYPE_FLOOR_RUSTY) { if (this->colliderTris.base.acFlags & AC_HIT) { - this->colliderTris.base.acFlags &= ~AT_HIT; + this->colliderTris.base.acFlags &= ~AC_HIT; ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); 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 1b1ca74a0..cbd94d808 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -197,7 +197,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { if (this->flameCollider.info.acHitInfo->toucher.dmgFlags & 0x820) { interaction = OBJ_SYOKUDAI_INTERACTION_ARROW_FA; } - } else if (player->heldItemAction == PLAYER_IA_STICK) { + } else if (player->heldItemAction == PLAYER_IA_DEKU_STICK) { Vec3f stickTipSeparationVec; Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &thisx->world.pos, &stickTipSeparationVec); @@ -211,7 +211,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { if (interaction <= OBJ_SYOKUDAI_INTERACTION_STICK) { if (player->unk_B28 == 0) { player->unk_B28 = 0xD2; - Audio_PlaySfxAtPos(&thisx->projectedPos, NA_SE_EV_FLAME_IGNITION); + Audio_PlaySfx_AtPos(&thisx->projectedPos, NA_SE_EV_FLAME_IGNITION); } else if (player->unk_B28 < 0xC8) { player->unk_B28 = 0xC8; } @@ -248,7 +248,8 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; } } else { - if (++sNumLitTorchesInGroup >= groupSize) { + sNumLitTorchesInGroup++; + if (sNumLitTorchesInGroup >= groupSize) { this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH; } else { this->snuffTimer = @@ -280,7 +281,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { } lightIntensity = Rand_ZeroOne() * 127; lightIntensity += 128; - func_800B9010(thisx, NA_SE_EV_TORCH - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_TORCH - SFX_FLAG); } Lights_PointSetColorAndRadius(&this->lightInfo, lightIntensity, lightIntensity * 0.7f, 0, lightRadius); this->flameTexScroll++; 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 6eac0ddbc..e8389e91f 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -203,7 +203,7 @@ void ObjTaru_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (OBJ_TARU_GET_80(thisx)) { - if (Flags_GetSwitch(play, OBJ_TARU_GET_7F(thisx))) { + if (Flags_GetSwitch(play, OBJ_TARU_GET_SWITCH_FLAG(thisx))) { Actor_Kill(&this->dyna.actor); } else { DynaPolyActor_LoadMesh(play, &this->dyna, &object_taru_Colheader_001CB0); @@ -298,7 +298,7 @@ void func_80B9C174(ObjTaru* this, PlayState* play) { void func_80B9C1A0(ObjTaru* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - Flags_SetSwitch(play, OBJ_TARU_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJ_TARU_GET_SWITCH_FLAG(&this->dyna.actor)); Actor_Kill(&this->dyna.actor); return; } 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 629bc57a5..e7620f458 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h @@ -6,7 +6,7 @@ #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_SWITCH_FLAG(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) diff --git a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c index 0c81ec028..85b7e9414 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c @@ -5,6 +5,7 @@ */ #include "z_obj_tokei_tobira.h" +#include "objects/object_tokei_tobira/object_tokei_tobira.h" #define FLAGS 0x00000000 @@ -14,8 +15,8 @@ void ObjTokeiTobira_Init(Actor* thisx, PlayState* play); void ObjTokeiTobira_Destroy(Actor* thisx, PlayState* play); void ObjTokeiTobira_Update(Actor* thisx, PlayState* play); void ObjTokeiTobira_Draw(Actor* thisx, PlayState* play); +void ObjTokeiTobira_StartCutscene(ObjTokeiTobira* this); -#if 0 ActorInit Obj_Tokei_Tobira_InitVars = { ACTOR_OBJ_TOKEI_TOBIRA, ACTORCAT_BG, @@ -28,24 +29,153 @@ ActorInit Obj_Tokei_Tobira_InitVars = { (ActorFunc)ObjTokeiTobira_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80ABD750[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +Vec3f D_80ABD760 = { 0.0f, 0.0f, 80.0f }; +s16 D_80ABD76C[] = { + -0x4000, // OBJTOKEITOBIRA_TYPE_0 + 0x4000, // OBJTOKEITOBIRA_TYPE_1 +}; +CollisionHeader* D_80ABD770[] = { + &object_tokei_tobira_Colheader_0012B0, // OBJTOKEITOBIRA_TYPE_0 + &object_tokei_tobira_Colheader_001590, // OBJTOKEITOBIRA_TYPE_1 +}; +f32 D_80ABD778[] = { + 1.0f, // OBJTOKEITOBIRA_TYPE_0 + -1.0f, // OBJTOKEITOBIRA_TYPE_1 +}; +Gfx* D_80ABD780[] = { + object_tokei_tobira_DL_001108, // OBJTOKEITOBIRA_TYPE_0 + object_tokei_tobira_DL_0013E8, // OBJTOKEITOBIRA_TYPE_1 +}; -extern InitChainEntry D_80ABD750[]; +void ObjTokeiTobira_Init(Actor* thisx, PlayState* play) { + ObjTokeiTobira* this = THIS; + s32 pad; + s32 type = OBJTOKEITOBIRA_GET_TYPE(&this->dyna.actor); + Vec3f posOffset; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tokei_Tobira/ObjTokeiTobira_Init.s") + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80ABD770[type]); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tokei_Tobira/ObjTokeiTobira_Destroy.s") + if (type == OBJTOKEITOBIRA_TYPE_0) { + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_TOKEI_TOBIRA, + this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, + this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, + OBJTOKEITOBIRA_PARAMS(OBJTOKEITOBIRA_TYPE_1)); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tokei_Tobira/func_80ABD3B0.s") + Matrix_RotateYS(D_80ABD76C[type] + this->dyna.actor.shape.rot.y, MTXMODE_NEW); + Matrix_MultVec3f(&D_80ABD760, &posOffset); + this->dyna.actor.world.pos.x += posOffset.x; + this->dyna.actor.world.pos.y += posOffset.y; + this->dyna.actor.world.pos.z += posOffset.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tokei_Tobira/ObjTokeiTobira_Update.s") + if ((type == OBJTOKEITOBIRA_TYPE_0) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_04) && + (play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 0) && (this->dyna.actor.csId > CS_ID_NONE)) { + this->dyna.actor.flags |= ACTOR_FLAG_10; + this->actionFunc = ObjTokeiTobira_StartCutscene; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tokei_Tobira/ObjTokeiTobira_Draw.s") +void ObjTokeiTobira_Destroy(Actor* thisx, PlayState* play) { + ObjTokeiTobira* this = THIS; + + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} + +void ObjTokeiTobira_StartCutscene(ObjTokeiTobira* this) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); + SET_WEEKEVENTREG(WEEKEVENTREG_59_04); + this->actionFunc = NULL; + this->dyna.actor.flags &= ~ACTOR_FLAG_10; + } else { + CutsceneManager_Queue(this->dyna.actor.csId); + } +} + +void ObjTokeiTobira_Update(Actor* thisx, PlayState* play) { + s32 pad1; + ObjTokeiTobira* this = THIS; + Player* player = GET_PLAYER(play); + s32 pad2; + s32 type = OBJTOKEITOBIRA_GET_TYPE(&this->dyna.actor); + f32 sp48 = D_80ABD778[type]; + s32 pad3; + + if (player->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) { + if (DynaPoly_GetActor(&play->colCtx, player->actor.wallBgId) == &this->dyna) { + f32 sp40; + Vec3f sp34; + + Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &sp34, &player->actor.world.pos); + sp40 = sp34.x * sp48; + + if (sp40 > 20.0f) { + if (sp34.z > 0.0f) { + this->unk160 += (sp40 - 20.0f) * sp48 * (16.0f / 3.0f); + this->unk168 = 1; + if (this->unk16C <= 0) { + Actor_PlaySfx(&this->dyna.actor, NA_SE_OC_WOOD_GATE_OPEN); + this->unk16C = 80; + } + } + + if (sp40 > 48.0f) { + ObjTokeiTobira* tobira; + + if (type == OBJTOKEITOBIRA_TYPE_0) { + tobira = (ObjTokeiTobira*)this->dyna.actor.child; + } else { + tobira = (ObjTokeiTobira*)this->dyna.actor.parent; + } + + if (tobira != NULL) { + tobira->unk168 = 1; + } + } + } + } + } else if (this->unk168 == 1) { + Vec3f sp24; + + Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &sp24, &player->actor.world.pos); + + if ((sp24.z > 0.0f) && (sp24.z < 30.0f)) { + this->unk168 = 1; + this->unk160 += sp48 * 290.0f; + } + } + + if (this->unk16C > 0) { + this->unk16C--; + } + + this->unk168 = 0; + this->unk160 *= 0.87f; + this->unk164 += this->unk160; + if ((this->unk164 * sp48) > 14336.0f) { + this->unk160 *= 0.1f; + this->unk164 = 14336.0f * sp48; + } else if ((this->unk164 * sp48) < -1000.0f) { + this->unk160 *= 0.1f; + this->unk164 = -1000.0f * sp48; + } + + this->dyna.actor.shape.rot.y = (s32)this->unk164 + this->dyna.actor.home.rot.y; + + if (this->actionFunc != NULL) { + this->actionFunc(this); + } +} + +void ObjTokeiTobira_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80ABD780[OBJTOKEITOBIRA_GET_TYPE(thisx)]); +} diff --git a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h index 8f9983995..45264df75 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h +++ b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h @@ -3,15 +3,27 @@ #include "global.h" +#define OBJTOKEITOBIRA_GET_TYPE(thisx) ((thisx)->params & 1) +#define OBJTOKEITOBIRA_PARAMS(type) (type) + + struct ObjTokeiTobira; -typedef void (*ObjTokeiTobiraActionFunc)(struct ObjTokeiTobira*, PlayState*); +typedef void (*ObjTokeiTobiraActionFunc)(struct ObjTokeiTobira*); + + +typedef enum ObjTokeiTobiraType { + /* 0 */ OBJTOKEITOBIRA_TYPE_0, + /* 1 */ OBJTOKEITOBIRA_TYPE_1 +} ObjTokeiTobiraType; typedef struct ObjTokeiTobira { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjTokeiTobiraActionFunc actionFunc; - /* 0x160 */ char unk_160[0x10]; -} ObjTokeiTobira; // size = 0x170 + /* 0x160 */ f32 unk160; + /* 0x164 */ f32 unk164; + /* 0x168 */ s32 unk168; + /* 0x16C */ s32 unk16C; +} ObjTokeiTobira; // size = 0x170 #endif // Z_OBJ_TOKEI_TOBIRA_H 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 61fa2376f..7f8d87ca4 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -99,7 +99,7 @@ void ObjTokeidai_SetupClockOrExteriorGear(ObjTokeidai* this) { this->clockMinute = currentClockMinute; this->minuteRingOrExteriorGearRotation = GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute); - this->minuteRingOrExteriorGearRotationalVelocity = 0x3C; + this->minuteRingOrExteriorGearAngularVelocity = 0x3C; this->minuteRingOrExteriorGearRotationTimer = 0; } @@ -110,9 +110,9 @@ void ObjTokeidai_Clock_Init(ObjTokeidai* this) { currentClockHour = GET_CURRENT_CLOCK_HOUR(this); this->clockHour = currentClockHour; this->clockFaceRotation = GET_CLOCK_FACE_ROTATION(currentClockHour); - this->clockFaceRotationalVelocity = 0; + this->clockFaceAngularVelocity = 0; this->clockFaceRotationTimer = 0; - this->sunMoonPanelRotationalVelocity = 0; + this->sunMoonPanelAngularVelocity = 0; this->sunMoonPanelRotation = ObjTokeidai_GetTargetSunMoonPanelRotation(); } @@ -128,7 +128,7 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; this->actor.world.pos.y += this->actor.scale.y * 1900.0f; this->actor.shape.yOffset = 1500.0f; - SET_WEEKEVENTREG(WEEKEVENTREG_08_40); + SET_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED); } else { this->actionFunc = ObjTokeidai_ExteriorGear_Idle; } @@ -294,8 +294,8 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { if (this->minuteRingOrExteriorGearRotationTimer > 8) { // This actually performs the rotation to the next minute // for the minute ring or exterior gear. - this->minuteRingOrExteriorGearRotationalVelocity += 0x3C; - this->minuteRingOrExteriorGearRotation += this->minuteRingOrExteriorGearRotationalVelocity; + this->minuteRingOrExteriorGearAngularVelocity += 0x3C; + this->minuteRingOrExteriorGearRotation += this->minuteRingOrExteriorGearAngularVelocity; } else { // This makes the minute ring or exterior gear wiggle in place for a bit // before rotating to the next position. @@ -314,7 +314,7 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { this->minuteRingOrExteriorGearRotation > GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute))) { this->minuteRingOrExteriorGearRotation = GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute); this->clockMinute = currentClockMinute; - this->minuteRingOrExteriorGearRotationalVelocity = 0x5A; + this->minuteRingOrExteriorGearAngularVelocity = 0x5A; this->minuteRingOrExteriorGearRotationTimer = 0; } } @@ -347,9 +347,9 @@ void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, PlayState* play) { * tower's clock slide off the tower and spin through the air when the moon crashes. */ void ObjTokeidai_TowerClock_Fall(ObjTokeidai* this, PlayState* play) { - this->actor.shape.rot.x += this->fallingClockFaceRotationalVelocity; - if (this->fallingClockFaceRotationalVelocity > 0xA0) { - this->fallingClockFaceRotationalVelocity -= 5; + this->actor.shape.rot.x += this->fallingClockFaceAngularVelocity; + if (this->fallingClockFaceAngularVelocity > 0xA0) { + this->fallingClockFaceAngularVelocity -= 5; } this->actor.world.pos.z += 4.0f; @@ -377,15 +377,15 @@ void ObjTokeidai_TowerClock_SlideOff(ObjTokeidai* this, PlayState* play) { if (this->aerialClockFaceSpeed < 0x80) { thisx->shape.rot.x = this->slidingClockFaceAngle - 0x4000; - this->fallingClockFaceRotationalVelocity = 0x28; + this->fallingClockFaceAngularVelocity = 0x28; } else { if (thisx->shape.rot.x < -0x1000) { - thisx->shape.rot.x += this->fallingClockFaceRotationalVelocity; - if (this->fallingClockFaceRotationalVelocity < 0x1E0) { - this->fallingClockFaceRotationalVelocity += 0xA; + thisx->shape.rot.x += this->fallingClockFaceAngularVelocity; + if (this->fallingClockFaceAngularVelocity < 0x1E0) { + this->fallingClockFaceAngularVelocity += 0xA; } } else { - thisx->shape.rot.x += this->fallingClockFaceRotationalVelocity; + thisx->shape.rot.x += this->fallingClockFaceAngularVelocity; this->actionFunc = ObjTokeidai_TowerClock_Fall; thisx->terminalVelocity = -7.5f; thisx->gravity = -0.75f; @@ -444,7 +444,7 @@ void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, PlayState* play) { void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 5)) { - SET_WEEKEVENTREG(WEEKEVENTREG_08_40); + SET_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED); if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { Audio_SetCutsceneFlag(false); @@ -496,9 +496,9 @@ void ObjTokeidai_TowerOpening_Wait(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, PlayState* play) { - this->xRotation += this->counterweightRotationalVelocity; + this->xRotation += this->counterweightAngularVelocity; if (this->xRotation < 0x4000) { - this->counterweightRotationalVelocity += this->counterweightRotationalAcceleration; + this->counterweightAngularVelocity += this->counterweightRotationalAcceleration; return; } @@ -522,14 +522,14 @@ void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, PlayState* pl } this->boundCount++; - if (this->counterweightRotationalVelocity > 0x190) { + if (this->counterweightAngularVelocity > 0x190) { // This condition is met for the first bound, causing the counterweight // to rebound upwards quickly. - this->counterweightRotationalVelocity = -0xC8; - } else if (this->counterweightRotationalVelocity > 0x32) { + this->counterweightAngularVelocity = -0xC8; + } else if (this->counterweightAngularVelocity > 0x32) { // This condition is met for the second bound, causing the counterweight // to rebound upwards slowly. - this->counterweightRotationalVelocity = -(this->counterweightRotationalVelocity >> 1); + this->counterweightAngularVelocity = -(this->counterweightAngularVelocity >> 1); } else { // This condition is met for the third bound, causing the counterweight // to stop moving. @@ -561,7 +561,7 @@ void ObjTokeidai_TowerOpening_FinishRaise(ObjTokeidai* this, PlayState* play) { } this->yTranslation = 3400; this->actionFunc = ObjTokeidai_TowerOpening_DropCounterweight; - this->counterweightRotationalVelocity = 0; + this->counterweightAngularVelocity = 0; this->counterweightRotationalAcceleration = 0xA; this->boundCount = 0; } @@ -575,7 +575,7 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { this->yTranslation += 25; if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) { - func_800B9010(&this->actor, NA_SE_EV_CLOCK_TOWER_UP - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_CLOCK_TOWER_UP - SFX_FLAG); } } else { type = OBJ_TOKEIDAI_TYPE(&this->actor); @@ -593,7 +593,7 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, PlayState* play) { if ((Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 4)) || - CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED)) { this->actionFunc = ObjTokeidai_TowerOpening_RaiseTower; } } @@ -604,7 +604,7 @@ void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, PlayState* play) { */ void ObjTokeidai_SetupTowerOpening(ObjTokeidai* this) { this->actionFunc = ObjTokeidai_TowerOpening_Start; - this->clockFaceRotationalVelocity = 0; + this->clockFaceAngularVelocity = 0; this->clockFaceRotationTimer = 0; this->yTranslation = 0; this->xRotation = 0; @@ -616,7 +616,7 @@ void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play) { void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { if ((((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) || - CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED)) { this->actor.draw = ObjTokeidai_Draw; } else { this->actor.draw = NULL; @@ -641,8 +641,8 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { if (this->clockFaceRotationTimer > 12) { // This actually performs the rotation to the next hour // for the clock face. - this->clockFaceRotationalVelocity += 0xA; - this->clockFaceRotation += this->clockFaceRotationalVelocity; + this->clockFaceAngularVelocity += 0xA; + this->clockFaceRotation += this->clockFaceAngularVelocity; } else { // This makes the clock face wiggle in place for a bit // before rotating to the next position. @@ -660,7 +660,7 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { ((currentClockHour != 12) && (this->clockFaceRotation > GET_CLOCK_FACE_ROTATION(currentClockHour)))) { this->clockFaceRotation = GET_CLOCK_FACE_ROTATION(currentClockHour); this->clockHour = currentClockHour; - this->clockFaceRotationalVelocity = 0; + this->clockFaceAngularVelocity = 0; this->clockFaceRotationTimer = 0; } } @@ -669,19 +669,19 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { // just changed), rotate it until it matches the target. if (this->sunMoonPanelRotation != ObjTokeidai_GetTargetSunMoonPanelRotation()) { if (this->clockHour == 6) { - this->sunMoonPanelRotationalVelocity += 0x222; - this->sunMoonPanelRotation += this->sunMoonPanelRotationalVelocity; + this->sunMoonPanelAngularVelocity += 0x222; + this->sunMoonPanelRotation += this->sunMoonPanelAngularVelocity; if (this->sunMoonPanelRotation > 0x10000) { this->sunMoonPanelRotation = ObjTokeidai_GetTargetSunMoonPanelRotation(); - this->sunMoonPanelRotationalVelocity = 0; + this->sunMoonPanelAngularVelocity = 0; } } if (this->clockHour == 18) { - this->sunMoonPanelRotationalVelocity += 0x222; - this->sunMoonPanelRotation += this->sunMoonPanelRotationalVelocity; + this->sunMoonPanelAngularVelocity += 0x222; + this->sunMoonPanelRotation += this->sunMoonPanelAngularVelocity; if (this->sunMoonPanelRotation > 0x8000) { this->sunMoonPanelRotation = ObjTokeidai_GetTargetSunMoonPanelRotation(); - this->sunMoonPanelRotationalVelocity = 0; + this->sunMoonPanelAngularVelocity = 0; } } } @@ -691,7 +691,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { if ((CURRENT_DAY == 3) && (this->clockHour < 6) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); - SET_WEEKEVENTREG(WEEKEVENTREG_08_40); + SET_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED); return; } @@ -835,9 +835,9 @@ void ObjTokeidai_Clock_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_WALL_CLOCK || OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_SMALL_WALL_CLOCK) { - gSPDisplayList(POLY_OPA_DISP++, gWallClockClockFace); + gSPDisplayList(POLY_OPA_DISP++, gWallClockClockFaceDL); } else { - gSPDisplayList(POLY_OPA_DISP++, gClockTowerClockFace); + gSPDisplayList(POLY_OPA_DISP++, gClockTowerClockFaceDL); } Matrix_Translate(0.0f, -1112.0f, -19.6f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h index 43f424ceb..0ccf84425 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h @@ -28,13 +28,13 @@ typedef struct ObjTokeidai { /* 0x144 */ Gfx* opaDList; /* 0x148 */ Gfx* xluDList; /* 0x14C */ s16 minuteRingOrExteriorGearRotation; - /* 0x14E */ s16 minuteRingOrExteriorGearRotationalVelocity; + /* 0x14E */ s16 minuteRingOrExteriorGearAngularVelocity; /* 0x150 */ s16 minuteRingOrExteriorGearRotationTimer; /* 0x152 */ s16 clockFaceRotation; /* 0x154 */ union { - s16 clockFaceRotationalVelocity; + s16 clockFaceAngularVelocity; s16 settleTimer; - s16 counterweightRotationalVelocity; + s16 counterweightAngularVelocity; s16 openingWaitTimer; s16 slidingClockFaceAngle; }; @@ -46,8 +46,8 @@ typedef struct ObjTokeidai { }; /* 0x158 */ s32 sunMoonPanelRotation; /* 0x15C */ union { - s16 sunMoonPanelRotationalVelocity; - s16 fallingClockFaceRotationalVelocity; + s16 sunMoonPanelAngularVelocity; + s16 fallingClockFaceAngularVelocity; }; /* 0x15E */ s16 yTranslation; /* 0x160 */ s16 xRotation; diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c index 4c30a763e..3fff091b6 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c @@ -100,7 +100,7 @@ void ObjTree_Init(Actor* thisx, PlayState* play) { } else { Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(&object_tree_Colheader_001B2C, &colHeader); + CollisionHeader_GetVirtual(&gTreeTopCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } @@ -187,11 +187,11 @@ void ObjTree_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_tree_DL_000680); + gSPDisplayList(POLY_OPA_DISP++, gTreeBodyDL); Matrix_RotateZYX(xRot, 0, zRot, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_tree_DL_0007C8); + gSPDisplayList(POLY_OPA_DISP++, gTreeLeavesDL); CLOSE_DISPS(play->state.gfxCtx); } 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 9b8baa861..bdfc48aa8 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -20,11 +20,11 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play); void ObjTsubo_Draw(Actor* thisx, PlayState* play2); void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play); -void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play); +void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play); void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2); -void ObjTsubo_RacePotBreak2(ObjTsubo* this, PlayState* play2); +void ObjTsubo_MagicPotBreak2(ObjTsubo* this, PlayState* play2); void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2); -void ObjTsubo_RacePotBreak3(ObjTsubo* this, PlayState* play2); +void ObjTsubo_MagicPotBreak3(ObjTsubo* this, PlayState* play2); void func_80928914(ObjTsubo* this); void func_80928928(ObjTsubo* this, PlayState* play); void func_809289B4(ObjTsubo* this); @@ -54,7 +54,7 @@ ActorInit Obj_Tsubo_InitVars = { }; typedef struct { - /* 0x00 */ s16 objId; + /* 0x00 */ s16 objectId; /* 0x04 */ f32 scale; /* 0x08 */ Gfx* modelDL; /* 0x0C */ Gfx* shardDL; @@ -68,10 +68,9 @@ typedef struct { ObjTsuboData sPotTypeData[4] = { { GAMEPLAY_DANGEON_KEEP, 0.197f, gameplay_dangeon_keep_DL_017EA0, gameplay_dangeon_keep_DL_018090, 12, 32, ObjTsubo_PotBreak1, ObjTsubo_PotBreak2, ObjTsubo_PotBreak3 }, - { OBJECT_RACETSUBO, 0.29549998f, object_racetsubo_DL_000278, object_racetsubo_DL_001610, 18, 45, - ObjTsubo_RacePotBreak1, ObjTsubo_RacePotBreak2, ObjTsubo_RacePotBreak3 }, - { OBJECT_TSUBO, 0.197f, object_tsubo_DL_0017C0, object_tsubo_DL_001960, 12, 32, ObjTsubo_PotBreak1, - ObjTsubo_PotBreak2, ObjTsubo_PotBreak3 }, + { OBJECT_RACETSUBO, 0.29549998f, gMagicPotDL, gMagicPotShardDL, 18, 45, ObjTsubo_MagicPotBreak1, + ObjTsubo_MagicPotBreak2, ObjTsubo_MagicPotBreak3 }, + { OBJECT_TSUBO, 0.197f, gPotDL, gPotShardDL, 12, 32, ObjTsubo_PotBreak1, ObjTsubo_PotBreak2, ObjTsubo_PotBreak3 }, { GAMEPLAY_DANGEON_KEEP, 0.197f, gameplay_dangeon_keep_DL_017EA0, gameplay_dangeon_keep_DL_018090, 12, 32, ObjTsubo_PotBreak1, ObjTsubo_PotBreak2, ObjTsubo_PotBreak3 }, }; @@ -187,8 +186,8 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { this->cylinderCollider.dim.radius = sPotTypeData[type].radius; this->cylinderCollider.dim.height = sPotTypeData[type].height; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->objBankIndex = Object_GetIndex(&play->objectCtx, sPotTypeData[type].objId); - if (this->objBankIndex < 0) { + this->objectSlot = Object_GetSlot(&play->objectCtx, sPotTypeData[type].objectId); + if (this->objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } @@ -247,13 +246,13 @@ void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play) { } scale = Rand_ZeroOne() * 110.0f + 15.0f; EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, - typeData->objId, typeData->shardDL); + typeData->objectId, typeData->shardDL); } func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 20, 50, true); func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 10, 80, true); } -void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play) { +void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play) { s16 rot; s32 phi_s0; s32 i; @@ -286,7 +285,7 @@ void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play) { } scale = Rand_ZeroOne() * 160.0f + 15.0f; EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -340, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, - typeData->objId, typeData->shardDL); + typeData->objectId, typeData->shardDL); } func_800BBFB0(play, &this->actor.world.pos, 50.0f, 2, 40, 50, true); func_800BBFB0(play, &this->actor.world.pos, 50.0f, 2, 20, 80, true); @@ -331,12 +330,12 @@ void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2) { phi_s0 = 0x20; } scale = Rand_ZeroOne() * 105.0f + 10.0f; - EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objId, - typeData->shardDL); + EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, + typeData->objectId, typeData->shardDL); } } -void ObjTsubo_RacePotBreak2(ObjTsubo* this, PlayState* play2) { +void ObjTsubo_MagicPotBreak2(ObjTsubo* this, PlayState* play2) { PlayState* play = (PlayState*)play2; s32 pad; s16 rot; @@ -376,8 +375,8 @@ void ObjTsubo_RacePotBreak2(ObjTsubo* this, PlayState* play2) { phi_s0 = 0xA0; } scale = (Rand_ZeroOne() * 150.0f) + 10.0f; - EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objId, - typeData->shardDL); + EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, + typeData->objectId, typeData->shardDL); } } @@ -413,7 +412,7 @@ void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2) { phi_s0 = 0x20; } EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -170, phi_s0, 50, 3, 0, - (Rand_ZeroOne() * 105.0f) + 10.0f, 0, 0, 70, -1, typeData->objId, typeData->shardDL); + (Rand_ZeroOne() * 105.0f) + 10.0f, 0, 0, 70, -1, typeData->objectId, typeData->shardDL); } for (i = 0; i < 7; i++) { EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 30.0f, 40.0f, (Rand_ZeroOne() * 0.06f) + 0.09f); @@ -421,7 +420,7 @@ void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2) { } } -void ObjTsubo_RacePotBreak3(ObjTsubo* this, PlayState* play2) { +void ObjTsubo_MagicPotBreak3(ObjTsubo* this, PlayState* play2) { } void func_80928914(ObjTsubo* this) { @@ -431,8 +430,8 @@ void func_80928914(ObjTsubo* this) { void func_80928928(ObjTsubo* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); - if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { - this->actor.objBankIndex = this->objBankIndex; + if (Object_IsLoaded(&play->objectCtx, this->objectSlot)) { + this->actor.objectSlot = this->objectSlot; func_809289B4(this); } } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index 2b3d1537f..b78f5ec0f 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -26,7 +26,7 @@ typedef struct ObjTsubo { /* 0x196 */ s8 homeRoom; /* 0x197 */ s8 unk_197; /* 0x198 */ s8 unk_198; - /* 0x199 */ s8 objBankIndex; + /* 0x199 */ s8 objectSlot; /* 0x19A */ s8 unk_19A; /* 0x19B */ u8 unk_19B; } ObjTsubo; // size = 0x19C 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 a6085ef51..3f556d640 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_In/z_en_in.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((ObjUm*)thisx) @@ -469,9 +469,9 @@ s32 func_80B78764(ObjUm* this, PlayState* play, EnHorse* bandit1, EnHorse* bandi if (this->potsLife[potIndex] != 1) { this->wasPotHit[potIndex] = true; if (this->potsLife[potIndex] == 2) { - Audio_PlaySfxAtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_BROKEN); + Audio_PlaySfx_AtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_BROKEN); } else { - Audio_PlaySfxAtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_DAMAGE); + Audio_PlaySfx_AtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_DAMAGE); } this->potsLife[potIndex]--; @@ -517,7 +517,7 @@ s32 func_80B78A54(ObjUm* this, PlayState* play, s32 arg2, EnHorse* arg3, EnHorse Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &arg3->actor.world.pos) - this->dyna.actor.shape.rot.y; this->banditsCollisions[arg2].base.acFlags &= ~AC_HIT; - Audio_PlaySfxAtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); + Audio_PlaySfx_AtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); arg3->unk_54C = 0xF; if (Math_SinS(sp36) > 0.0f) { @@ -541,7 +541,7 @@ s32 func_80B78A54(ObjUm* this, PlayState* play, s32 arg2, EnHorse* arg3, EnHorse arg3->rider->actor.colorFilterTimer = 20; Actor_SetColorFilter(&arg3->rider->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); } - Audio_PlaySfxAtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); + Audio_PlaySfx_AtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); } } @@ -708,7 +708,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { return; } - this->dyna.actor.targetMode = 6; + this->dyna.actor.targetMode = TARGET_MODE_6; this->unk_2B4 = 0; ObjUm_SetupAction(this, ObjUm_RanchWait); } @@ -830,7 +830,7 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { SET_WEEKEVENTREG(WEEKEVENTREG_31_40); if (play->msgCtx.choiceIndex == 0) { player = GET_PLAYER(play); - func_8019F208(); + Audio_PlaySfx_MessageDecide(); SET_WEEKEVENTREG(WEEKEVENTREG_31_80); play->nextEntrance = ENTRANCE(ROMANI_RANCH, 11); if (player->stateFlags1 & PLAYER_STATE1_800000) { @@ -842,7 +842,7 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { phi_v1 = true; } else { Actor_ContinueText(play, &this->dyna.actor, 0x33B5); - func_8019F230(); + Audio_PlaySfx_MessageCancel(); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_CREMIA); phi_v1 = false; } @@ -864,10 +864,10 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { case 0x33BD: if (play->msgCtx.choiceIndex == 0) { Actor_ContinueText(play, &this->dyna.actor, 0x33BE); - func_8019F230(); + Audio_PlaySfx_MessageCancel(); } else { Actor_ContinueText(play, &this->dyna.actor, 0x33BF); - func_8019F208(); + Audio_PlaySfx_MessageDecide(); } phi_v1 = false; break; @@ -897,7 +897,7 @@ s32 func_80B79734(PlayState* play, ObjUm* this, s32 arg2) { case TEXT_STATE_CHOICE: case TEXT_STATE_5: if (Message_ShouldAdvance(play) && func_80B795A0(play, this, arg2)) { - msgCtx->msgMode = 0x43; + msgCtx->msgMode = MSGMODE_TEXT_CLOSING; ret = true; } break; @@ -911,7 +911,7 @@ s32 func_80B79734(PlayState* play, ObjUm* this, s32 arg2) { u16 ObjUm_RanchGetDialogue(PlayState* play, ObjUm* this, s32 arg2) { u16 textId = 0; - if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM == PLAYER_FORM_HUMAN) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_40)) { // "Want a ride?" textId = 0x33CF; @@ -965,15 +965,15 @@ s32 func_80B7984C(PlayState* play, ObjUm* this, s32 arg2, s32* arg3) { return 0; } - if ((this->dyna.actor.xyzDistToPlayerSq > SQ(100.0f)) && !this->dyna.actor.isTargeted) { + if ((this->dyna.actor.xyzDistToPlayerSq > SQ(100.0f)) && !this->dyna.actor.isLockedOn) { return 0; } if (this->dyna.actor.xyzDistToPlayerSq <= SQ(50.0f)) { - if (func_800B8614(&this->dyna.actor, play, 50.0f)) { + if (Actor_OfferTalk(&this->dyna.actor, play, 50.0f)) { this->dyna.actor.textId = ObjUm_RanchGetDialogue(play, this, arg2); } - } else if (func_800B863C(&this->dyna.actor, play)) { + } else if (Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play)) { this->dyna.actor.textId = ObjUm_RanchGetDialogue(play, this, arg2); } @@ -995,7 +995,7 @@ s32 func_80B79A24(s32 arg0) { void ObjUm_RanchWait(ObjUm* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->dyna.actor.flags |= ACTOR_FLAG_1; + this->dyna.actor.flags |= ACTOR_FLAG_TARGETABLE; SkelAnime_Update(&this->skelAnime); ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); this->flags |= OBJ_UM_FLAG_WAITING; diff --git a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c index 9859d9c0f..c685f2836 100644 --- a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c +++ b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c @@ -39,7 +39,7 @@ void ObjVisiblock_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_visiblock_Colheader_000AD0); + DynaPolyActor_LoadMesh(play, &this->dyna, &gLensOfTruthPlatformCol); } void ObjVisiblock_Destroy(Actor* thisx, PlayState* play) { @@ -49,5 +49,5 @@ void ObjVisiblock_Destroy(Actor* thisx, PlayState* play) { } void ObjVisiblock_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListXlu(play, object_visiblock_DL_000140); + Gfx_DrawDListXlu(play, gLensOfTruthPlatformDL); } diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index cc47113a5..62ec8f0f7 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -8,7 +8,7 @@ #include "objects/object_sek/object_sek.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((ObjWarpstone*)thisx) @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 1, ICHAIN_STOP), + ICHAIN_U8(targetMode, TARGET_MODE_1, ICHAIN_STOP), }; static Gfx* sOwlStatueDLs[] = { gOwlStatueClosedDL, gOwlStatueOpenedDL }; @@ -140,8 +140,8 @@ void ObjWarpstone_Update(Actor* thisx, PlayState* play) { this->isTalking = false; } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { - func_8019F208(); - play->msgCtx.msgMode = 0x4D; + Audio_PlaySfx_MessageDecide(); + play->msgCtx.msgMode = MSGMODE_OWL_SAVE_0; play->msgCtx.unk120D6 = 0; play->msgCtx.unk120D4 = 0; gSaveContext.save.owlSaveLocation = OBJ_WARPSTONE_GET_ID(&this->dyna.actor); @@ -152,7 +152,7 @@ void ObjWarpstone_Update(Actor* thisx, PlayState* play) { } else if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { this->isTalking = true; } else if (!this->actionFunc(this, play)) { - func_800B863C(&this->dyna.actor, play); + Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play); } Collider_ResetCylinderAC(play, &this->collider.base); diff --git a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c index 5f53030f3..3b6b90731 100644 --- a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c +++ b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c @@ -5,6 +5,7 @@ */ #include "z_obj_wind.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,6 @@ void ObjWind_Destroy(Actor* thisx, PlayState* play); void ObjWind_Update(Actor* thisx, PlayState* play); void ObjWind_Draw(Actor* thisx, PlayState* play); -#if 0 ActorInit Obj_Wind_InitVars = { ACTOR_OBJ_WIND, ACTORCAT_ITEMACTION, @@ -28,21 +28,140 @@ ActorInit Obj_Wind_InitVars = { (ActorFunc)ObjWind_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B24480[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 4000, ICHAIN_STOP), }; -#endif +void ObjWind_Init(Actor* thisx, PlayState* play) { + ObjWind* this = (ObjWind*)thisx; + s32 pad; + WaterBox* waterbox; + f32 ySurface; -extern InitChainEntry D_80B24480[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterbox) && + (this->actor.world.pos.y < ySurface)) { + this->isUnderWater = true; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wind/ObjWind_Init.s") +void ObjWind_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wind/ObjWind_Destroy.s") +typedef struct ObjWindStruct { + /* 0x0 */ s16 unk_0; + /* 0x2 */ s16 unk_2; + /* 0x4 */ s16 unk_4; + /* 0x6 */ s16 unk_6; + /* 0x8 */ s16 unk_8; +} ObjWindStruct; // size = 0xA -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wind/ObjWind_Update.s") +static ObjWindStruct D_80B2448C[] = { + { 530, 90, 3000, 2000, 0 }, { 1120, 100, 2000, 1000, 0 }, { 620, 100, 2000, 1000, 0 }, + { 1620, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, { 400, 100, 2000, 1000, 0 }, + { 400, 100, 2000, 1000, 0 }, { 600, 120, 3000, 2000, 0 }, { 500, 80, 3000, 2000, 0 }, + { 400, 60, 2000, 2000, 0 }, { 470, 70, 2000, 1000, 0 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wind/ObjWind_Draw.s") +static s32 D_80B245CC = -1; + +void ObjWind_Update(Actor* thisx, PlayState* play) { + ObjWind* this = (ObjWind*)thisx; + ObjWindStruct* entry = &D_80B2448C[OBJ_WIND_GET_TYPE(thisx)]; + Player* player; + f32 upZ; + f32 upY; + f32 upX; + Vec3f posCopy; + Vec3f nearestPoint; + Vec3f sp54; + f32 upXZ; // reused temp + f32 distToNearestPoint; + + if (D_80B245CC != DREG(85)) { + if ((DREG(85) >= 0) && (DREG(85) < ARRAY_COUNT(D_80B2448C))) { + DREG(80) = D_80B2448C[DREG(85)].unk_0; + DREG(81) = D_80B2448C[DREG(85)].unk_2; + DREG(82) = D_80B2448C[DREG(85)].unk_4; + DREG(83) = D_80B2448C[DREG(85)].unk_6; + DREG(84) = D_80B2448C[DREG(85)].unk_8; + D_80B245CC = DREG(85); + } + } else { + D_80B2448C[DREG(85)].unk_0 = DREG(80); + D_80B2448C[DREG(85)].unk_2 = DREG(81); + D_80B2448C[DREG(85)].unk_4 = DREG(82); + D_80B2448C[DREG(85)].unk_6 = DREG(83); + D_80B2448C[DREG(85)].unk_8 = DREG(84); + } + + if ((OBJ_WIND_GET_SWITCH_FLAG(thisx) == 0x7F) || !Flags_GetSwitch(play, OBJ_WIND_GET_SWITCH_FLAG(thisx))) { + player = GET_PLAYER(play); + Math_Vec3f_Copy(&posCopy, &this->actor.world.pos); + upY = Math_CosS(this->actor.shape.rot.x); + upXZ = Math_SinS(this->actor.shape.rot.x); + upX = Math_SinS(this->actor.shape.rot.y) * upXZ; + upZ = Math_CosS(this->actor.shape.rot.y) * upXZ; + distToNearestPoint = func_80179A44(&posCopy, &player->actor.world, &nearestPoint); + if ((distToNearestPoint >= 0.0f) && (distToNearestPoint < entry->unk_0)) { + upXZ = Math_Vec3f_DistXYZAndStoreDiff(&player->actor.world.pos, &nearestPoint, &sp54); + if (upXZ < entry->unk_2) { + f32 var_fa0; + f32 windSpeedXZ = 1.0f; // reused temp + f32 windMagnitude; + f32 temp_ft0; + f32 windSpeedX; + f32 windSpeedY; + f32 windSpeedZ; + + var_fa0 = 1.0f - distToNearestPoint / entry->unk_0; + windMagnitude = ((f32)entry->unk_4 / 100.0f) * + ((var_fa0 * (1.0f - upXZ / entry->unk_2)) + ((f32)entry->unk_8 / 100.0f)); + if ((distToNearestPoint / entry->unk_0) > 0.8f) { + var_fa0 = windSpeedXZ - 1.0f; + } + temp_ft0 = ((f32)entry->unk_6 / 100.0f) * (upXZ / entry->unk_2 * var_fa0); + if (upXZ != 0.0f) { + // FAKE: + if (1) {} + upXZ = 1.0f / upXZ; + } + temp_ft0 *= upXZ; + windSpeedX = (upX * windMagnitude) + (sp54.x * temp_ft0); + windSpeedY = (upY * windMagnitude) + (sp54.y * temp_ft0); + windSpeedZ = (upZ * windMagnitude) + (sp54.z * temp_ft0); + player->windSpeed = sqrtf(SQ(windSpeedX) + SQ(windSpeedY) + SQ(windSpeedZ)); + player->windAngleY = Math_Atan2S_XY(windSpeedZ, windSpeedX); + + windSpeedXZ = sqrtf(SQ(windSpeedX) + SQ(windSpeedZ)); + player->windAngleX = Math_Atan2S_XY(windSpeedXZ, windSpeedY); + } + } + } + this->actor.scale.x = (f32)entry->unk_2 / 50.0f; + this->actor.scale.z = (f32)entry->unk_2 / 50.0f; + this->actor.scale.y = (f32)entry->unk_0 / 400.0f; +} + +void ObjWind_Draw(Actor* thisx, PlayState* play) { + ObjWind* this = (ObjWind*)thisx; + + OPEN_DISPS(play->state.gfxCtx); + + Gfx_SetupDL25_Xlu(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gameplay_keep_Matanimheader_07F218)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07E8C0); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.h b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.h index 08db8914a..7c1ecc66e 100644 --- a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.h +++ b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.h @@ -3,11 +3,14 @@ #include "global.h" +#define OBJ_WIND_GET_TYPE(thisx) (((thisx)->params >> 7) & 0x1F) +#define OBJ_WIND_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) + struct ObjWind; typedef struct ObjWind { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ u8 isUnderWater; } ObjWind; // size = 0x148 #endif // Z_OBJ_WIND_H 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 54ebe8cc7..a44f2cbb1 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -39,14 +39,15 @@ void func_808A7954(ObjWturn* this) { } void func_808A7968(ObjWturn* this, PlayState* play) { - if (play->msgCtx.ocarinaMode >= 28 && play->msgCtx.ocarinaMode < 39) { - Flags_UnsetSwitch(play, this->actor.params); + if ((play->msgCtx.ocarinaMode >= OCARINA_MODE_WARP_TO_GREAT_BAY_COAST) && + (play->msgCtx.ocarinaMode <= OCARINA_MODE_WARP_TO_ENTRANCE)) { + Flags_UnsetSwitch(play, OBJWTURN_GET_SWITCH_FLAG(&this->actor)); Actor_Kill(&this->actor); return; } - if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F40)) || - (!Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F41))) { + if ((Flags_GetSwitch(play, OBJWTURN_GET_SWITCH_FLAG(&this->actor)) && (play->sceneId == SCENE_F40)) || + (!Flags_GetSwitch(play, OBJWTURN_GET_SWITCH_FLAG(&this->actor)) && (play->sceneId == SCENE_F41))) { func_808A7A24(this); } } @@ -87,7 +88,7 @@ void func_808A7BA0(ObjWturn* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.shape.rot.z, -0x8000, 0x0200)) { func_808A7C04(this, play); } - func_800B8FE8(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered3(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG); Play_SetCameraRoll(play, this->subCamId, this->actor.shape.rot.z); } diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h index 2e2963d0e..9aee7e2ad 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h @@ -7,6 +7,8 @@ struct ObjWturn; typedef void (*ObjWturnActionFunc)(struct ObjWturn*, PlayState*); +#define OBJWTURN_GET_SWITCH_FLAG(thisx) ((thisx)->params) + typedef struct ObjWturn { /* 0x000 */ Actor actor; /* 0x144 */ ObjWturnActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c index 96de17fb0..791afcd6a 100644 --- a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c +++ b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c @@ -83,7 +83,7 @@ void ObjY2lift_Update(Actor* thisx, PlayState* play) { } } else { this->unk15E = false; - func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); } if (DECR(this->unk15F) != 0) { this->dyna.actor.shape.yOffset = (2.0f * (this->unk15F & 1)) * this->unk15F; diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c index cea1a4e71..d1b39bb24 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c @@ -96,15 +96,15 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { DREG(87) = 0; } - if (Flags_GetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor))) { - Flags_UnsetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor)); + if (Flags_GetSwitch(play, OBJY2SHUTTER_GET_SWITCH_FLAG(&this->dyna.actor))) { + Flags_UnsetSwitch(play, OBJY2SHUTTER_GET_SWITCH_FLAG(&this->dyna.actor)); } else { - Flags_SetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, OBJY2SHUTTER_GET_SWITCH_FLAG(&this->dyna.actor)); } } if (this->settleTimer == 0) { - if (Flags_GetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJY2SHUTTER_GET_SWITCH_FLAG(&this->dyna.actor))) { s16 csId = this->dyna.actor.csId; if (this->openTimer == 0) { @@ -125,7 +125,7 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { targetVelocityY = info->openVelocity; accelY = info->openAccel; if (this->openTimer < 2) { - Flags_UnsetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_UnsetSwitch(play, OBJY2SHUTTER_GET_SWITCH_FLAG(&this->dyna.actor)); } else { this->openTimer--; } @@ -159,7 +159,7 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { } else { this->isStationary = false; if (shutterType != SHUTTER_BARRED) { - func_800B9010(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.h b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.h index a1b32bbe9..8ff346f74 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.h +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.h @@ -18,6 +18,6 @@ typedef enum { } ShutterType; #define OBJY2SHUTTER_GET_TYPE(thisx) (((thisx)->params >> 7) & 1) -#define OBJY2SHUTTER_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) +#define OBJY2SHUTTER_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #endif // Z_OBJ_Y2SHUTTER_H diff --git a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c index 5af34152a..b11454095 100644 --- a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c +++ b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c @@ -69,7 +69,7 @@ void ObjYasi_Update(Actor* thisx, PlayState* play) { dropPos.x = this->dyna.actor.world.pos.x; dropPos.y = this->dyna.actor.world.pos.y + 280.0f; dropPos.z = this->dyna.actor.world.pos.z; - Item_DropCollectible(play, &dropPos, ITEM00_NUTS_1); + Item_DropCollectible(play, &dropPos, ITEM00_DEKU_NUTS_1); } } this->dyna.actor.home.rot.y = GET_PLAYER(play)->actor.shape.rot.y; 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 2661b9cc5..dbefd93b9 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -55,11 +55,11 @@ void func_808DBEB0(ObjectKankyo* this, PlayState* play) { D_808DE5B0 = 0.0f; this->unk_144 = Rand_ZeroOne() * 360.0f; this->unk_148 = Rand_ZeroOne() * 360.0f; - if (play->envCtx.unk_F2[2] == 128) { + if (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 128) { D_808DE5B0 = 1.0f; this->unk_114E = 1; - for (i = 0; i < play->envCtx.unk_F2[2]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_SNOW_CUR]; i++) { this->unk_14C[i].unk_10 = Rand_ZeroOne() * -200.0f; } } else { @@ -107,7 +107,7 @@ void ObjectKankyo_Init(Actor* thisx, PlayState* play) { break; case 2: - play->envCtx.unk_F2[2] = 0x80; + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 128; func_808DBFB0(this, play); break; @@ -180,16 +180,16 @@ void func_808DC18C(ObjectKankyo* this, PlayState* play) { magnitude = play->envCtx.windSpeed / 60.0f; magnitude = CLAMP(magnitude, 0.0f, 1.0f); - sp30.x = play->envCtx.windDir.x * magnitude; - sp30.y = play->envCtx.windDir.y + 100.0f; - sp30.z = play->envCtx.windDir.z * magnitude; + sp30.x = play->envCtx.windDirection.x * magnitude; + sp30.y = play->envCtx.windDirection.y + 100.0f; + sp30.z = play->envCtx.windDirection.z * magnitude; this->unk_14C[2].unk_00 = 0x4000 - Math_Vec3f_Pitch(&gZeroVec3f, &sp30); this->unk_14C[2].unk_04 = Math_Vec3f_Yaw(&gZeroVec3f, &sp30) + 0x8000; } void func_808DC454(ObjectKankyo* this, PlayState* play) { s16 i; - u32 tempI; + s32 pad1; f32 phi_f20; f32 spD0; f32 spCC; @@ -214,7 +214,7 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) { spCC = y / magnitude; spC8 = z / magnitude; - for (i = 0; i < play->envCtx.unk_F2[2]; i++) { + for (i = 0; i < play->envCtx.precipitation[PRECIP_SNOW_CUR]; i++) { switch (this->unk_14C[i].unk_1C) { case 0: this->unk_14C[i].unk_00 = play->view.eye.x + (spD0 * 120.0f); @@ -231,14 +231,13 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) { this->unk_14C[i].unk_10 = temp_f22; } else { this->unk_14C[i].unk_10 += temp_f22; - tempI = i; - if (play->envCtx.unk_F2[2] == (tempI + 1)) { + if (play->envCtx.precipitation[PRECIP_SNOW_CUR] == ((u32)i + 1)) { this->unk_114E = 0; } } this->unk_14C[i].unk_14 = (Rand_ZeroOne() - 0.5f) * (2.0f * temp_120); - if (play->envCtx.unk_F2[4] == 0) { + if (play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) { this->unk_14C[i].unk_18 = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { this->unk_14C[i].unk_18 = (Rand_ZeroOne() * 3.0f) + 8.0f; @@ -251,14 +250,14 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) { temp_f28 = play->view.eye.y + (spCC * 120.0f); temp_f30 = play->view.eye.z + (spC8 * 120.0f); - magnitude = - sqrtf((f32)SQ(play->envCtx.windDir.x) + SQ(play->envCtx.windDir.y) + SQ(play->envCtx.windDir.z)); + magnitude = sqrtf((f32)SQ(play->envCtx.windDirection.x) + SQ(play->envCtx.windDirection.y) + + SQ(play->envCtx.windDirection.z)); if (magnitude == 0.0f) { magnitude = 0.001f; } - spC4 = -play->envCtx.windDir.x / magnitude; - spC0 = -play->envCtx.windDir.y / magnitude; - spBC = -play->envCtx.windDir.z / magnitude; + spC4 = -play->envCtx.windDirection.x / magnitude; + spC0 = -play->envCtx.windDirection.y / magnitude; + spBC = -play->envCtx.windDirection.z / magnitude; if (i == 0) { this->unk_144 += 0.049999997f * Rand_ZeroOne(); @@ -318,13 +317,13 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) { } void func_808DCB7C(ObjectKankyo* this, PlayState* play) { - if (play->envCtx.unk_F2[2] < play->envCtx.unk_F2[3]) { + if (play->envCtx.precipitation[PRECIP_SNOW_CUR] < play->envCtx.precipitation[PRECIP_SNOW_MAX]) { if ((play->state.frames % 16) == 0) { - play->envCtx.unk_F2[2] += 2; + play->envCtx.precipitation[PRECIP_SNOW_CUR] += 2; } - } else if (play->envCtx.unk_F2[3] < play->envCtx.unk_F2[2]) { + } else if (play->envCtx.precipitation[PRECIP_SNOW_MAX] < play->envCtx.precipitation[PRECIP_SNOW_CUR]) { if ((play->state.frames % 16) == 0) { - play->envCtx.unk_F2[2] -= 2; + play->envCtx.precipitation[PRECIP_SNOW_CUR] -= 2; } } func_808DC454(this, play); @@ -333,24 +332,24 @@ void func_808DCB7C(ObjectKankyo* this, PlayState* play) { void func_808DCBF8(ObjectKankyo* this, PlayState* play) { f32 temp_f0; - if ((play->envCtx.unk_F2[2] > 0) && (this->unk_114C == 0)) { + if ((play->envCtx.precipitation[PRECIP_SNOW_CUR] > 0) && (this->unk_114C == 0)) { if ((play->state.frames % 16) == 0) { - play->envCtx.unk_F2[2] -= 9; - if ((s8)play->envCtx.unk_F2[2] < 0) { - play->envCtx.unk_F2[2] = 0; + play->envCtx.precipitation[PRECIP_SNOW_CUR] -= 9; + if ((s8)play->envCtx.precipitation[PRECIP_SNOW_CUR] < 0) { + play->envCtx.precipitation[PRECIP_SNOW_CUR] = 0; } } } - temp_f0 = (f32)play->envCtx.unk_F2[2] / 128; + temp_f0 = (f32)play->envCtx.precipitation[PRECIP_SNOW_CUR] / 128; temp_f0 = CLAMP(temp_f0, 0.0f, 1.0f); if (temp_f0 > 0.01f) { D_801F4E30 = 155.0f * temp_f0; - play->envCtx.sandstormState = 10; + play->envCtx.sandstormState = SANDSTORM_A; } else { D_801F4E30 = 0; - play->envCtx.sandstormState = 10; + play->envCtx.sandstormState = SANDSTORM_A; } func_808DC454(this, play); } @@ -413,14 +412,14 @@ void func_808DCDB4(ObjectKankyo* this, PlayState* play) { temp_f28 = play->view.eye.y + (spA8 * 120.0f); temp_f18 = play->view.eye.z + (spA4 * 120.0f); - magnitude = - sqrtf((f32)SQ(play->envCtx.windDir.x) + SQ(play->envCtx.windDir.y) + SQ(play->envCtx.windDir.z)); + magnitude = sqrtf((f32)SQ(play->envCtx.windDirection.x) + SQ(play->envCtx.windDirection.y) + + SQ(play->envCtx.windDirection.z)); if (magnitude == 0.0f) { magnitude = 0.001f; } - spA0 = -play->envCtx.windDir.x / magnitude; - sp9C = -play->envCtx.windDir.z / magnitude; + spA0 = -play->envCtx.windDirection.x / magnitude; + sp9C = -play->envCtx.windDirection.z / magnitude; if (i == 0) { this->unk_144 += 0.049999997f * Rand_ZeroOne(); @@ -512,7 +511,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { f32 temp_f2; f32 tempf; - if ((play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_UNDERWATER) || ((u8)play->envCtx.unk_E2 == 0)) { + if ((play->cameraPtrs[CAM_ID_MAIN]->stateFlags & CAM_STATE_UNDERWATER) || ((u8)play->envCtx.stormState == 0)) { return; } @@ -525,14 +524,14 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { temp_f0 = CLAMP(temp_f0, 0.0f, 1.0f); Math_SmoothStepToF(&D_808DE5B0, temp_f0, 0.2f, 0.1f, 0.001f); - sp68 = play->envCtx.unk_F2[2]; + sp68 = play->envCtx.precipitation[PRECIP_SNOW_CUR]; sp68 *= D_808DE5B0; - if ((play->envCtx.unk_F2[2] >= 32) && (sp68 < 32)) { + if ((play->envCtx.precipitation[PRECIP_SNOW_CUR] >= 32) && (sp68 < 32)) { sp68 = 32; } } else { - sp68 = play->envCtx.unk_F2[2]; + sp68 = play->envCtx.precipitation[PRECIP_SNOW_CUR]; } for (i = 0; i < sp68; i++) { @@ -654,7 +653,7 @@ void func_808DDE9C(Actor* thisx, PlayState* play2) { Player* player = GET_PLAYER(play); s32 i; u8 phi_s5; - u16 end = play->envCtx.unk_F2[1]; + u16 end = play->envCtx.precipitation[PRECIP_RAIN_CUR]; f32 temp_f12; f32 temp_f20; f32 temp_f22; diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 99bcf4191..2dbfecfdf 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -62,8 +62,8 @@ void OceffSpot_Init(Actor* thisx, PlayState* play2) { this->actor.scale.y = 0.3f; this->unk16C = 0.0f; this->actor.world.pos.y = player->actor.world.pos.y; - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; } void OceffSpot_Destroy(Actor* thisx, PlayState* play2) { @@ -80,12 +80,13 @@ void OceffSpot_End(OceffSpot* this, PlayState* play) { this->unk16C -= 0.05f; } else { Actor_Kill(&this->actor); - if ((R_TIME_SPEED != 400) && (play->msgCtx.unk12046 == 0)) { - if ((play->msgCtx.ocarinaAction != 0x39) || (play->msgCtx.ocarinaMode != 0xA)) { + if ((R_TIME_SPEED != 400) && !play->msgCtx.blockSunsSong) { + if ((play->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOTIME_DONE) || + (play->msgCtx.ocarinaMode != OCARINA_MODE_PLAYED_SUNS)) { gSaveContext.sunsSongState = SUNSSONG_START; } } else { - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } } } @@ -117,11 +118,7 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) { temp = (1.0f - cosf(this->unk16C * M_PI)) * 0.5f; this->actionFunc(this, play); - switch (gSaveContext.save.playerForm) { - default: - scale = 1.0f; - break; - + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: scale = 1.3f; break; @@ -133,6 +130,10 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) { case PLAYER_FORM_GORON: scale = 2.0f; break; + + default: + scale = 1.0f; + break; } this->actor.scale.z = (scale * 0.42f) * temp; @@ -143,7 +144,7 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) { temp = (2.0f - this->unk16C) * this->unk16C; - func_800FD2B4(play, temp * 0.5f, 880.0f, 0.2f, 0.9f); + Environment_AdjustLights(play, temp * 0.5f, 880.0f, 0.2f, 0.9f); Lights_PointNoGlowSetInfo(&this->lightInfo1, this->actor.world.pos.x, this->actor.world.pos.y + 55.0f, this->actor.world.pos.z, (s32)(255.0f * temp), (s32)(255.0f * temp), (s32)(200.0f * temp), diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index d3486bb0c..5fa5d58c3 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -81,8 +81,8 @@ void OceffStorm_Init(Actor* thisx, PlayState* play) { this->actor.draw = OceffStorm_Draw2; } else { this->actor.world.pos.y = player->actor.world.pos.y; - this->actor.world.pos.x = player->bodyPartsPos[0].x; - this->actor.world.pos.z = player->bodyPartsPos[0].z; + this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; + this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; gSaveContext.jinxTimer = 0; if ((play->interfaceCtx.restrictions.songOfStorms == 0) && !func_8098176C(play)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x, @@ -100,11 +100,7 @@ void OceffStorm_Destroy(Actor* thisx, PlayState* play) { void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) { f32 cylinderScale; - switch (gSaveContext.save.playerForm) { - default: - cylinderScale = 1.0f; - break; - + switch (GET_PLAYER_FORM) { case PLAYER_FORM_DEKU: cylinderScale = 1.3f; break; @@ -116,6 +112,10 @@ void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) { case PLAYER_FORM_GORON: cylinderScale = 2.0f; break; + + default: + cylinderScale = 1.0f; + break; } if (this->counter < 10) { diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index c73e67a1d..59cd120cf 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -41,7 +41,7 @@ void OceffWipe_Destroy(Actor* thisx, PlayState* play) { OceffWipe* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 7de628750..6dbea9128 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -43,7 +43,7 @@ void OceffWipe2_Destroy(Actor* thisx, PlayState* play) { OceffWipe2* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe2_Update(Actor* thisx, PlayState* play) { @@ -72,7 +72,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) { vtxPtr = sEponaSongFrustumVtx; if (this->timer < 32) { - z = Math_SinS(this->timer << 9) * 1220.0f; + z = Math_SinS(this->timer * 0x200) * 1220.0f; } else { z = 1220.0f; } diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index f7156878c..f0ab978c8 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -44,7 +44,7 @@ void OceffWipe3_Destroy(Actor* thisx, PlayState* play) { OceffWipe3* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe3_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index d82c117e9..0bda6d1b9 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -43,7 +43,7 @@ void OceffWipe4_Destroy(Actor* thisx, PlayState* play) { OceffWipe4* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe4_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 3dcb06d5d..272d0fb88 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -41,7 +41,7 @@ void OceffWipe5_Destroy(Actor* thisx, PlayState* play) { OceffWipe5* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe5_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c b/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c index 244870f9d..28a5dfb04 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c +++ b/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c @@ -39,7 +39,7 @@ void OceffWipe6_Init(Actor* thisx, PlayState* play) { void OceffWipe6_Destroy(Actor* thisx, PlayState* play) { Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe6_Update(Actor* thisx, PlayState* play) { 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 fb8011c60..49f9fc0dd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c +++ b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c @@ -43,7 +43,7 @@ void OceffWipe7_Destroy(Actor* thisx, PlayState* play) { OceffWipe7* this = THIS; Magic_Reset(play); - play->msgCtx.unk120B0 = 0; + play->msgCtx.ocarinaSongEffectActive = false; } void OceffWipe7_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 69f56ef2d..7a5cc209d 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) +#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define THIS ((ShotSun*)thisx) @@ -55,9 +55,9 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { s32 pad; ShotSun* this = THIS; - if ((SHOTSUN_GET_FF(thisx) == SHOTSUN_FAIRY_SPAWNER_SUNS) || - (SHOTSUN_GET_FF(thisx) == SHOTSUN_FAIRY_SPAWNER_STORMS)) { - this->unk_19C = 0; + if ((SHOTSUN_GET_TYPE(thisx) == SHOTSUN_FAIRY_SPAWNER_SUNS) || + (SHOTSUN_GET_TYPE(thisx) == SHOTSUN_FAIRY_SPAWNER_STORMS)) { + this->fairySpawnerState = SPAWNER_OUT_OF_RANGE; // never read after here this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; this->actionFunc = ShotSun_UpdateForOcarina; @@ -66,21 +66,21 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = ShotSun_UpdateHyliaSun; - this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } } void ShotSun_Destroy(Actor* thisx, PlayState* play) { ShotSun* this = THIS; - if ((SHOTSUN_GET_FF(thisx) != SHOTSUN_FAIRY_SPAWNER_SUNS) && - (SHOTSUN_GET_FF(thisx) != SHOTSUN_FAIRY_SPAWNER_STORMS)) { + if ((SHOTSUN_GET_TYPE(thisx) != SHOTSUN_FAIRY_SPAWNER_SUNS) && + (SHOTSUN_GET_TYPE(thisx) != SHOTSUN_FAIRY_SPAWNER_STORMS)) { Collider_DestroyCylinder(play, &this->collider); } } void ShotSun_SpawnFairy(ShotSun* this, PlayState* play2) { - s32 params = SHOTSUN_GET_FF(&this->actor); + s32 type = SHOTSUN_GET_TYPE(&this->actor); s32 fairyType = 0; PlayState* play = play2; @@ -88,16 +88,21 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play2) { this->timer--; } else { CutsceneManager_Stop(this->actor.csId); - switch (params) { + switch (type) { case SHOTSUN_FAIRY_SPAWNER_SUNS: - fairyType = ENELF_TYPE_7; + fairyType = FAIRY_TYPE_7; break; + case SHOTSUN_FAIRY_SPAWNER_STORMS: - fairyType = ENELF_TYPE_7; + fairyType = FAIRY_TYPE_7; + break; + + default: break; } + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, 0, 0, 0, fairyType); + this->actor.home.pos.z, 0, 0, 0, FAIRY_PARAMS(fairyType, false, 0)); Actor_Kill(&this->actor); } } @@ -107,31 +112,35 @@ void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { if (this->actor.csId != CS_ID_NONE) { CutsceneManager_Start(this->actor.csId, &this->actor); } + this->actionFunc = ShotSun_SpawnFairy; this->timer = 50; + + //! @bug: This Demo_Kankyo spawn will crash because parameter 0x11 is an invalid value (type goes up to 4) Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x11); - Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); + + Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } else { CutsceneManager_Queue(this->actor.csId); } } void ShotSun_UpdateForOcarina(ShotSun* this, PlayState* play) { - s32 params = SHOTSUN_GET_FF(&this->actor); + s32 type = SHOTSUN_GET_TYPE(&this->actor); - if (play->msgCtx.ocarinaMode == 3) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) { switch (play->msgCtx.lastPlayedSong) { case OCARINA_SONG_STORMS: - if (params == SHOTSUN_FAIRY_SPAWNER_STORMS) { + if (type == SHOTSUN_FAIRY_SPAWNER_STORMS) { this->actionFunc = ShotSun_TriggerFairy; - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } break; case OCARINA_SONG_SUNS: - if (params == SHOTSUN_FAIRY_SPAWNER_SUNS) { + if (type == SHOTSUN_FAIRY_SPAWNER_SUNS) { this->actionFunc = ShotSun_TriggerFairy; - play->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = OCARINA_MODE_END; } break; } @@ -149,7 +158,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { if (1) {} if (this->collider.base.acFlags & AC_HIT) { - play_sound(NA_SE_SY_CORRECT_CHIME); + Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); if (INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE) { Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, ITEM_ETC_ARROW_FIRE); @@ -158,7 +167,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { spawnPos.x = 700.0f; spawnPos.y = -800.0f; spawnPos.z = 7261.0f; - collectible = (EnItem00*)Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE); + collectible = (EnItem00*)Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_JAR_BIG); if (collectible != NULL) { collectible->unk152 = 0x1770; collectible->actor.speed = 0.0f; diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h index 3ba7f35d9..ad94fda73 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h @@ -3,7 +3,7 @@ #include "global.h" -#define SHOTSUN_GET_FF(thisx) ((thisx)->params & 0xFF) +#define SHOTSUN_GET_TYPE(thisx) ((thisx)->params & 0xFF) #define SHOTSUN_FAIRY_SPAWNER_SUNS 0x40 #define SHOTSUN_FAIRY_SPAWNER_STORMS 0x41 @@ -17,7 +17,14 @@ typedef struct ShotSun { /* 0x190 */ ShotSunActionFunc actionFunc; /* 0x194 */ Vec3s hitboxPos; /* 0x19A */ s16 timer; - /* 0x19C */ s8 unk_19C; // leftover from OOT secret ocarina occurrence function. + /* 0x19C */ s8 fairySpawnerState; // leftover from OOT secret ocarina occurrence function. } ShotSun; // size = 0x1A0 +// Left over from OOT, unused in MM +typedef enum { + /* 0 */ SPAWNER_OUT_OF_RANGE, + /* 1 */ SPAWNER_OCARINA_START, + /* 2 */ SPAWNER_OCARINA_PLAYING +} FairySpawnerState; + #endif // Z_SHOT_SUN_H diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 01c732aa2..6e19ae832 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3,7 +3,7 @@ * Overlay: ovl_player_actor * Description: Player */ -#include "prevent_bss_reordering.h" + #include "global.h" #include "z64horse.h" #include "z64quake.h" @@ -17,13 +17,22 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Boom/z_en_boom.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" +#include "overlays/actors/ovl_En_Dnp/z_en_dnp.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Ishi/z_en_ishi.h" +#include "overlays/actors/ovl_En_Mushi2/z_en_mushi2.h" +#include "overlays/actors/ovl_En_Ot/z_en_ot.h" #include "overlays/actors/ovl_En_Test3/z_en_test3.h" +#include "overlays/actors/ovl_En_Test5/z_en_test5.h" #include "overlays/actors/ovl_En_Test7/z_en_test7.h" #include "overlays/actors/ovl_En_Torch2/z_en_torch2.h" +#include "overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h" +#include "overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h" +#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" #include "overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -41,25 +50,23 @@ void Player_Destroy(Actor* thisx, PlayState* play); void Player_Update(Actor* thisx, PlayState* play); void Player_Draw(Actor* thisx, PlayState* play); -s32 Player_GrabPlayer(PlayState* play, Player* player); +s32 Player_GrabPlayer(PlayState* play, Player* this); s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode); void func_8085B384(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); void Player_TalkWithPlayer(PlayState* play, Actor* actor); void func_8085B74C(PlayState* play); void func_8085B820(PlayState* play, s16 arg1); -PlayerItemAction func_8085B854(PlayState* play, Player* player, ItemId itemId); +PlayerItemAction func_8085B854(PlayState* play, Player* this, ItemId itemId); s32 func_8085B930(PlayState* play, PlayerAnimationHeader* talkAnim, AnimationMode animMode); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); s32 Player_StartFishing(PlayState* play); void func_8085B170(PlayState* play, Player* this); s32 func_8083A658(PlayState* play, Player* this); -void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction); +void Player_InitItemAction(PlayState* play, Player* this, PlayerItemAction itemAction); -void func_80831990(PlayState* play, Player* this, ItemId item); - -s32 func_80848BF4(Player* this, PlayState* play); +void Player_UseItem(PlayState* play, Player* this, ItemId item); void func_80836988(Player* this, PlayState* play); @@ -102,137 +109,145 @@ typedef struct AnimSfxEntry { } AnimSfxEntry; // size = 0x4 /* action funcs */ -void func_808496AC(Player* this, PlayState* play); -void func_808497A0(Player* this, PlayState* play); -void func_80849A9C(Player* this, PlayState* play); -void func_80849DD0(Player* this, PlayState* play); -void func_80849FE0(Player* this, PlayState* play); -void func_8084A26C(Player* this, PlayState* play); -void func_8084A5C0(Player* this, PlayState* play); -void func_8084A794(Player* this, PlayState* play); -void func_8084A884(Player* this, PlayState* play); -void func_8084A8E8(Player* this, PlayState* play); -void func_8084AB4C(Player* this, PlayState* play); -void func_8084AC84(Player* this, PlayState* play); -void func_8084AEEC(Player* this, PlayState* play); -void func_8084AF9C(Player* this, PlayState* play); -void func_8084B0EC(Player* this, PlayState* play); -void func_8084B288(Player* this, PlayState* play); -void func_8084B3B8(Player* this, PlayState* play); -void func_8084B4A8(Player* this, PlayState* play); -void func_8084B5C0(Player* this, PlayState* play); -void func_8084BAA4(Player* this, PlayState* play); -void func_8084BBF0(Player* this, PlayState* play); -void func_8084BC64(Player* this, PlayState* play); -void func_8084BE40(Player* this, PlayState* play); -void func_8084BF28(Player* this, PlayState* play); -void func_8084BFDC(Player* this, PlayState* play); -void func_8084C16C(Player* this, PlayState* play); -void func_8084C6EC(Player* this, PlayState* play); -void func_8084C94C(Player* this, PlayState* play); -void func_8084CA24(Player* this, PlayState* play); -void func_8084CB58(Player* this, PlayState* play); -void func_8084CCEC(Player* this, PlayState* play); -void func_8084CE84(Player* this, PlayState* play); -void func_8084D18C(Player* this, PlayState* play); -void func_8084D4EC(Player* this, PlayState* play); -void func_8084D770(Player* this, PlayState* play); -void func_8084D820(Player* this, PlayState* play); -void func_8084E034(Player* this, PlayState* play); -void func_8084E25C(Player* this, PlayState* play); -void func_8084E334(Player* this, PlayState* play); -void func_8084E434(Player* this, PlayState* play); -void func_8084E4E4(Player* this, PlayState* play); -void func_8084E58C(Player* this, PlayState* play); -void func_8084E65C(Player* this, PlayState* play); -void func_8084E724(Player* this, PlayState* play); -void func_8084E980(Player* this, PlayState* play); -void func_8084ED9C(Player* this, PlayState* play); -void func_8084EE50(Player* this, PlayState* play); -void func_8084EF9C(Player* this, PlayState* play); -void func_8084F1B8(Player* this, PlayState* play); -void func_8084F3DC(Player* this, PlayState* play); -void func_8084F4E8(Player* this, PlayState* play); -void func_8084FC0C(Player* this, PlayState* play); -void func_8084FE7C(Player* this, PlayState* play); -void func_808505D0(Player* this, PlayState* play); -void func_808508C8(Player* this, PlayState* play); -void func_80850B18(Player* this, PlayState* play); -void func_80850D68(Player* this, PlayState* play); -void func_808513EC(Player* this, PlayState* play); -void func_80851588(Player* this, PlayState* play); -void func_808516B4(Player* this, PlayState* play); -void func_808519FC(Player* this, PlayState* play); -void func_80851B58(Player* this, PlayState* play); -void func_80851BD4(Player* this, PlayState* play); -void func_8085269C(Player* this, PlayState* play); -void func_80852B28(Player* this, PlayState* play); -void func_80852C04(Player* this, PlayState* play); -void func_80852FD4(Player* this, PlayState* play); -void func_80853194(Player* this, PlayState* play); -void func_808534C0(Player* this, PlayState* play); -void func_80853754(Player* this, PlayState* play); -void func_80853850(Player* this, PlayState* play); -void func_80853A5C(Player* this, PlayState* play); -void func_80853CC0(Player* this, PlayState* play); -void func_80853D68(Player* this, PlayState* play); -void func_80854010(Player* this, PlayState* play); -void func_808540A0(Player* this, PlayState* play); -void func_80854118(Player* this, PlayState* play); -void func_8085421C(Player* this, PlayState* play); -void func_8085437C(Player* this, PlayState* play); -void func_8085439C(Player* this, PlayState* play); -void func_80854430(Player* this, PlayState* play); -void func_80854614(Player* this, PlayState* play); -void func_808546D0(Player* this, PlayState* play); -void func_80854800(Player* this, PlayState* play); -void func_808548B8(Player* this, PlayState* play); -void func_80854C70(Player* this, PlayState* play); -void func_808553F4(Player* this, PlayState* play); -void func_80855818(Player* this, PlayState* play); -void func_80855A7C(Player* this, PlayState* play); -void func_80855AF4(Player* this, PlayState* play); -void func_80855B9C(Player* this, PlayState* play); -void func_80855C28(Player* this, PlayState* play); -void func_80855E08(Player* this, PlayState* play); -void func_808561B0(Player* this, PlayState* play); -void func_80856918(Player* this, PlayState* play); -void func_808573A4(Player* this, PlayState* play); -void func_80857BE8(Player* this, PlayState* play); -void func_8085B08C(Player* this, PlayState* play); +void Player_Action_0(Player* this, PlayState* play); +void Player_Action_1(Player* this, PlayState* play); +void Player_Action_2(Player* this, PlayState* play); +void Player_Action_3(Player* this, PlayState* play); +void Player_Action_4(Player* this, PlayState* play); +void Player_Action_5(Player* this, PlayState* play); +void Player_Action_6(Player* this, PlayState* play); +void Player_Action_7(Player* this, PlayState* play); +void Player_Action_8(Player* this, PlayState* play); +void Player_Action_9(Player* this, PlayState* play); +void Player_Action_10(Player* this, PlayState* play); +void Player_Action_11(Player* this, PlayState* play); +void Player_Action_12(Player* this, PlayState* play); +void Player_Action_13(Player* this, PlayState* play); +void Player_Action_14(Player* this, PlayState* play); +void Player_Action_15(Player* this, PlayState* play); +void Player_Action_16(Player* this, PlayState* play); +void Player_Action_17(Player* this, PlayState* play); +void Player_Action_18(Player* this, PlayState* play); +void Player_Action_19(Player* this, PlayState* play); +void Player_Action_20(Player* this, PlayState* play); +void Player_Action_21(Player* this, PlayState* play); +void Player_Action_22(Player* this, PlayState* play); +void Player_Action_23(Player* this, PlayState* play); +void Player_Action_24(Player* this, PlayState* play); +void Player_Action_25(Player* this, PlayState* play); +void Player_Action_26(Player* this, PlayState* play); +void Player_Action_27(Player* this, PlayState* play); +void Player_Action_28(Player* this, PlayState* play); +void Player_Action_29(Player* this, PlayState* play); +void Player_Action_30(Player* this, PlayState* play); +void Player_Action_31(Player* this, PlayState* play); +void Player_Action_32(Player* this, PlayState* play); +void Player_Action_33(Player* this, PlayState* play); +void Player_Action_34(Player* this, PlayState* play); +void Player_Action_35(Player* this, PlayState* play); +void Player_Action_36(Player* this, PlayState* play); +void Player_Action_37(Player* this, PlayState* play); +void Player_Action_38(Player* this, PlayState* play); +void Player_Action_39(Player* this, PlayState* play); +void Player_Action_40(Player* this, PlayState* play); +void Player_Action_41(Player* this, PlayState* play); +void Player_Action_42(Player* this, PlayState* play); +void Player_Action_43(Player* this, PlayState* play); +void Player_Action_44(Player* this, PlayState* play); +void Player_Action_45(Player* this, PlayState* play); +void Player_Action_46(Player* this, PlayState* play); +void Player_Action_47(Player* this, PlayState* play); +void Player_Action_48(Player* this, PlayState* play); +void Player_Action_49(Player* this, PlayState* play); +void Player_Action_50(Player* this, PlayState* play); +void Player_Action_51(Player* this, PlayState* play); +void Player_Action_52(Player* this, PlayState* play); +void Player_Action_53(Player* this, PlayState* play); +void Player_Action_54(Player* this, PlayState* play); +void Player_Action_55(Player* this, PlayState* play); +void Player_Action_56(Player* this, PlayState* play); +void Player_Action_57(Player* this, PlayState* play); +void Player_Action_58(Player* this, PlayState* play); +void Player_Action_59(Player* this, PlayState* play); +void Player_Action_60(Player* this, PlayState* play); +void Player_Action_61(Player* this, PlayState* play); +void Player_Action_62(Player* this, PlayState* play); +void Player_Action_63(Player* this, PlayState* play); +void Player_Action_64(Player* this, PlayState* play); +void Player_Action_65(Player* this, PlayState* play); +void Player_Action_66(Player* this, PlayState* play); +void Player_Action_67(Player* this, PlayState* play); +void Player_Action_68(Player* this, PlayState* play); +void Player_Action_69(Player* this, PlayState* play); +void Player_Action_70(Player* this, PlayState* play); +void Player_Action_71(Player* this, PlayState* play); +void Player_Action_72(Player* this, PlayState* play); +void Player_Action_73(Player* this, PlayState* play); +void Player_Action_74(Player* this, PlayState* play); +void Player_Action_75(Player* this, PlayState* play); +void Player_Action_76(Player* this, PlayState* play); +void Player_Action_77(Player* this, PlayState* play); +void Player_Action_78(Player* this, PlayState* play); +void Player_Action_79(Player* this, PlayState* play); +void Player_Action_80(Player* this, PlayState* play); +void Player_Action_81(Player* this, PlayState* play); +void Player_Action_82(Player* this, PlayState* play); +void Player_Action_83(Player* this, PlayState* play); +void Player_Action_84(Player* this, PlayState* play); +void Player_Action_85(Player* this, PlayState* play); +void Player_Action_86(Player* this, PlayState* play); +void Player_Action_87(Player* this, PlayState* play); +void Player_Action_88(Player* this, PlayState* play); +void Player_Action_89(Player* this, PlayState* play); +void Player_Action_90(Player* this, PlayState* play); +void Player_Action_91(Player* this, PlayState* play); +void Player_Action_92(Player* this, PlayState* play); +void Player_Action_93(Player* this, PlayState* play); +void Player_Action_94(Player* this, PlayState* play); +void Player_Action_95(Player* this, PlayState* play); +void Player_Action_96(Player* this, PlayState* play); +void Player_Action_97(Player* this, PlayState* play); -s32 func_80839518(Player* this, PlayState* play); -s32 func_808365DC(Player* this, PlayState* play); -s32 func_8083D23C(Player* this, PlayState* play); -s32 func_8083CCB4(Player* this, PlayState* play); -s32 func_808391D8(Player* this, PlayState* play); -s32 func_8083DFC4(Player* this, PlayState* play); -s32 func_8083A114(Player* this, PlayState* play); -s32 func_80848570(Player* this, PlayState* play); -s32 func_8083A580(Player* this, PlayState* play); -s32 func_8083D78C(Player* this, PlayState* play); -s32 func_80839B18(Player* this, PlayState* play); -s32 func_8083A274(Player* this, PlayState* play); -s32 func_80834DFC(Player* this, PlayState* play); -s32 func_80838A90(Player* this, PlayState* play); -s32 func_8083A0CC(Player* this, PlayState* play); +s32 Player_UpperAction_0(Player* this, PlayState* play); +s32 Player_UpperAction_1(Player* this, PlayState* play); +s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play); +s32 Player_UpperAction_3(Player* this, PlayState* play); +s32 Player_UpperAction_4(Player* this, PlayState* play); +s32 Player_UpperAction_5(Player* this, PlayState* play); +s32 Player_UpperAction_6(Player* this, PlayState* play); +s32 Player_UpperAction_7(Player* this, PlayState* play); +s32 Player_UpperAction_8(Player* this, PlayState* play); +s32 Player_UpperAction_9(Player* this, PlayState* play); +s32 Player_UpperAction_10(Player* this, PlayState* play); +s32 Player_UpperAction_11(Player* this, PlayState* play); +s32 Player_UpperAction_12(Player* this, PlayState* play); +s32 Player_UpperAction_13(Player* this, PlayState* play); +s32 Player_UpperAction_14(Player* this, PlayState* play); +s32 Player_UpperAction_15(Player* this, PlayState* play); +s32 Player_UpperAction_16(Player* this, PlayState* play); -s32 func_80848780(Player* this, PlayState* play); -s32 func_808487B8(Player* this, PlayState* play); -s32 func_80848B6C(Player* this, PlayState* play); -s32 func_808490B4(Player* this, PlayState* play); -s32 func_808491B4(Player* this, PlayState* play); -s32 func_80848808(Player* this, PlayState* play); -s32 func_8084894C(Player* this, PlayState* play); -s32 func_80848A0C(Player* this, PlayState* play); -s32 func_80848AB0(Player* this, PlayState* play); -s32 func_80848E4C(Player* this, PlayState* play); -s32 func_80849054(Player* this, PlayState* play); -s32 func_8084923C(Player* this, PlayState* play); -s32 func_808492C4(Player* this, PlayState* play); -s32 func_8084933C(Player* this, PlayState* play); -s32 func_80849570(Player* this, PlayState* play); -s32 func_80849620(Player* this, PlayState* play); +void Player_InitItemAction_DoNothing(PlayState* play, Player* this); +void Player_InitItemAction_DekuStick(PlayState* play, Player* this); +void Player_InitItemAction_2(PlayState* play, Player* this); +void Player_InitItemAction_SpawnExplosive(PlayState* play, Player* this); +void Player_InitItemAction_SpawnHookshot(PlayState* play, Player* this); +void Player_InitItemAction_5(PlayState* play, Player* this); + +s32 Player_ActionChange_0(Player* this, PlayState* play); +s32 Player_ActionChange_1(Player* this, PlayState* play); +s32 Player_ActionChange_2(Player* this, PlayState* play); +s32 Player_ActionChange_3(Player* this, PlayState* play); +s32 Player_ActionChange_4(Player* this, PlayState* play); +s32 Player_ActionChange_5(Player* this, PlayState* play); +s32 Player_ActionChange_6(Player* this, PlayState* play); +s32 Player_ActionChange_7(Player* this, PlayState* play); +s32 Player_ActionChange_8(Player* this, PlayState* play); +s32 Player_ActionChange_9(Player* this, PlayState* play); +s32 Player_ActionChange_10(Player* this, PlayState* play); +s32 Player_ActionChange_11(Player* this, PlayState* play); +s32 Player_ActionChange_12(Player* this, PlayState* play); +s32 Player_ActionChange_13(Player* this, PlayState* play); +s32 Player_ActionChange_14(Player* this, PlayState* play); /* Init Mode functions */ void Player_InitMode_0(PlayState* play, Player* this); @@ -252,105 +267,76 @@ void Player_InitMode_D(PlayState* play, Player* this); void func_8083ADF0(PlayState* play, Player* this); void Player_InitMode_F(PlayState* play, Player* this); -void func_80859F4C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859FCC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859FF4(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A120(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A144(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A19C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A1D4(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A24C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A2AC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A330(PlayState* play, Player* this, UNK_TYPE arg2); +/* Cutscene functions */ +void Player_CsAction_0(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_1(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_2(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_3(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_4(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_5(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_6(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_7(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_8(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_9(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_10(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_11(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_12(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_13(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_14(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_15(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_16(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_17(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_18(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_19(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_20(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_21(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_22(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_23(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_25(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_26(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_27(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_28(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_29(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_30(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_31(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_32(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_33(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_34(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_35(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_36(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_37(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_38(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_39(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_40(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_41(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_42(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_43(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_44(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_45(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_46(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_End(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue); -void func_80859EBC(PlayState* play, Player* this, s32 arg2); - -void func_80859414(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859AD0(PlayState* play, Player* this, void* arg2); -void func_80859B28(PlayState* play, Player* this, void* arg2); -void func_8085ADA0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085AACC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_808595B8(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859890(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859C60(PlayState* play, Player* this, void* arg2); -void func_8085A710(PlayState* play, Player* this, void* anim); -void func_808595B8(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859D70(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A6C0(PlayState* play, Player* this, void* anim); -void func_80859FF4(PlayState* play, Player* this, UNK_TYPE arg2); -void Player_Cutscene_TranslateReverse(PlayState* play, Player* this, void* arg); -void func_8085A144(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A1D4(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A364(PlayState* play, Player* this, void* arg2); -void func_808599DC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A40C(PlayState* play, Player* this, void* arg2); -void func_80859708(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A2AC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A940(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A4A4(PlayState* play, Player* this, void* arg2); -void func_8085A5DC(PlayState* play, Player* this, void* arg2); -void func_8085AA84(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A7C0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085AA10(PlayState* play, Player* this, UNK_TYPE arg2); -void func_808599DC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859AF8(PlayState* play, Player* this, void* arg2); -void func_80859A44(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859D44(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859EBC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859F4C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859F4C(PlayState* play, Player* this, UNK_TYPE arg2); - -void func_8085A768(PlayState* play, Player* this, void* arg2); -void func_8085AA60(PlayState* play, Player* this, UNK_TYPE arg2); - -void func_808594D0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_808594D0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085978C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859B54(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859CA0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_808594D0(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859CFC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A66C(PlayState* play, Player* this, void* arg2); -void func_80859FCC(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A120(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A19C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085968C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A24C(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A330(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A8C4(PlayState* play, Player* this, UNK_TYPE arg2); -void func_8085A530(PlayState* play, Player* this, void* arg2); -void func_8085A768(PlayState* play, Player* this, void* arg2); -void func_8085AA60(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859990(PlayState* play, Player* this, UNK_TYPE arg2); -void func_80859A10(PlayState* play, Player* this, UNK_TYPE arg2); - -// ItemActions -void func_8082F594(PlayState* play, Player* this); -void func_8082F5A4(PlayState* play, Player* this); -void func_8082F8A0(PlayState* play, Player* this); -void func_8082F5C0(PlayState* play, Player* this); -void func_8082F7F4(PlayState* play, Player* this); -void Player_SpawnExplosive(PlayState* play, Player* this); - -void func_80858DB4(PlayState* play, Player* this, void* anim); -void func_80858DDC(PlayState* play, Player* this, void* anim); -void func_80858E40(PlayState* play, Player* this, void* anim); -void func_80858E60(PlayState* play, Player* this, void* anim); -void func_80858E80(PlayState* play, Player* this, void* anim); -void func_80858EA0(PlayState* play, Player* this, void* anim); -void func_80858EFC(PlayState* play, Player* this, void* anim); -void func_80858F1C(PlayState* play, Player* this, void* anim); -void func_80858F3C(PlayState* play, Player* this, void* anim); -void func_80858F5C(PlayState* play, Player* this, void* anim); -void func_80858FBC(PlayState* play, Player* this, void* anim); -void func_80859028(PlayState* play, Player* this, void* anim); -void func_808591BC(PlayState* play, Player* this, void* anim); -void func_80858DFC(PlayState* play, Player* this, void* anim); -void func_80858EC0(PlayState* play, Player* this, void* anim); -void func_80858F7C(PlayState* play, Player* this, void* anim); -void func_80858F9C(PlayState* play, Player* this, void* anim); -void func_80859168(PlayState* play, Player* this, void* anim); -void func_80859210(PlayState* play, Player* this, void* arg2); +void Player_CsAnim_1(PlayState* play, Player* this, void* arg2); // void* arg2 +void Player_CsAnim_2(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_3(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_4(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_5(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_6(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_7(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_8(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_9(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_10(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_11(PlayState* play, Player* this, void* cue); // CsCmdActorCue* cue +void Player_CsAnim_12(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_13(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_14(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_15(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_16(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_17(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim +void Player_CsAnim_18(PlayState* play, Player* this, void* entry); // AnimSfxEntry* entry +void Player_CsAnim_19(PlayState* play, Player* this, void* anim); // PlayerAnimationHeader* anim typedef struct struct_8085C2A4 { /* 0x0 */ PlayerAnimationHeader* unk_0; @@ -365,17 +351,44 @@ typedef struct BlureColors { /* 0xC */ u8 p2EndColor[4]; } BlureColors; // size = 0x10 -typedef void (*PlayerCueInterpreter)(PlayState*, Player*, CsCmdActorCue*); +typedef void (*PlayerCsAnim)(PlayState*, Player*, void*); +typedef void (*PlayerCsAction)(PlayState*, Player*, CsCmdActorCue*); -typedef struct struct_8085DA94 { - /* 0x0 */ s8 type; +typedef enum { + /* -1 */ PLAYER_CSTYPE_ACTION = -1, + /* 0x00 */ PLAYER_CSTYPE_NONE, + /* 0x01 */ PLAYER_CSTYPE_ANIM_1, + /* 0x02 */ PLAYER_CSTYPE_ANIM_2, + /* 0x03 */ PLAYER_CSTYPE_ANIM_3, + /* 0x04 */ PLAYER_CSTYPE_ANIM_4, + /* 0x05 */ PLAYER_CSTYPE_ANIM_5, + /* 0x06 */ PLAYER_CSTYPE_ANIM_6, + /* 0x07 */ PLAYER_CSTYPE_ANIM_7, + /* 0x08 */ PLAYER_CSTYPE_ANIM_8, + /* 0x09 */ PLAYER_CSTYPE_ANIM_9, + /* 0x0A */ PLAYER_CSTYPE_ANIM_10, + /* 0x0B */ PLAYER_CSTYPE_ANIM_11, + /* 0x0C */ PLAYER_CSTYPE_ANIM_12, + /* 0x0D */ PLAYER_CSTYPE_ANIM_13, + /* 0x0E */ PLAYER_CSTYPE_ANIM_14, + /* 0x0F */ PLAYER_CSTYPE_ANIM_15, + /* 0x10 */ PLAYER_CSTYPE_ANIM_16, + /* 0x11 */ PLAYER_CSTYPE_ANIM_17, + /* 0x12 */ PLAYER_CSTYPE_ANIM_18, + /* 0x13 */ PLAYER_CSTYPE_ANIM_19 +} PlayerCsType; + +typedef struct PlayerCsModeEntry { + /* 0x0 */ s8 type; // PlayerCsType enum /* 0x4 */ union { void* ptr; // Do not use, required in the absence of designated initialisors + PlayerCsAction csActionFunc; + void* csAnimArg2; // Can point to any of the below in the union PlayerAnimationHeader* anim; - PlayerCueInterpreter func; AnimSfxEntry* entry; + CsCmdActorCue* cue; }; -} struct_8085DA94; // size = 0x8 +} PlayerCsModeEntry; // size = 0x8 typedef struct struct_8085E368 { /* 0x0 */ Vec3s base; @@ -455,10 +468,10 @@ typedef struct MeleeWeaponDamageInfo { /* 0x7 */ u8 dmgHumanStrong; } MeleeWeaponDamageInfo; // size = 0x8 -typedef struct struct_8085CC88 { +typedef struct ItemChangeInfo { /* 0x0 */ PlayerAnimationHeader* anim; - /* 0x4 */ u8 frame; -} struct_8085CC88; // size = 0x8 + /* 0x4 */ u8 changeFrame; +} ItemChangeInfo; // size = 0x8 typedef struct { /* 0x0 */ u8 itemId; @@ -466,12 +479,12 @@ typedef struct { } ExplosiveInfo; // size = 0x4 typedef struct { - /* 0x0 */ Color_RGB8 unk_0; - /* 0x3 */ Color_RGB8 unk_3; - /* 0x6 */ Color_RGB8 unk_6; - /* 0xA */ s16 unk_A; - /* 0xC */ s16 unk_C; -} struct_8082F02C_arg1; // size = 0xE + /* 0x0 */ Color_RGB8 ambientColor; + /* 0x3 */ Color_RGB8 diffuseColor; + /* 0x6 */ Color_RGB8 fogColor; + /* 0xA */ s16 fogNear; + /* 0xC */ s16 zFar; +} PlayerEnvLighting; // size = 0xE typedef struct GetItemEntry { /* 0x0 */ u8 itemId; @@ -488,29 +501,29 @@ typedef struct struct_8085D200 { /* 0x9 */ u8 unk_9; } struct_8085D200; // size = 0xC -f32 D_80862AFC; // distance of the analog stick to its center -s16 D_80862B00; // analog stick angle/yaw +f32 sPlayerControlStickMagnitude; +s16 sPlayerControlStickAngle; s16 D_80862B02; // analog stick yaw + camera yaw -s32 D_80862B04; // boolean, set to the return value of func_8083216C -FloorType sPlayerCurrentFloorType; -u32 sPlayerCurrentWallFlags; +s32 D_80862B04; // boolean, set to the return value of Player_UpdateUpperBody +FloorType sPlayerFloorType; +u32 sPlayerTouchedWallFlags; ConveyorSpeed sPlayerConveyorSpeedIndex; s16 sPlayerIsOnFloorConveyor; -s16 D_80862B16; // SurfaceType_GetConveyorDirection << 0xA -f32 D_80862B18; // D_80862B18 = this->actor.world.pos.y - this->actor.floorHeight; +s16 sPlayerConveyorYaw; +f32 sPlayerYDistToFloor; FloorProperty sPlayerPrevFloorProperty; -s32 D_80862B20; // ABS_ALT(this->actor.shape.rot.y - BINANG_ADD(this->actor.wallYaw, 0x8000)) -s32 D_80862B24; // ABS_ALT(BINANG_SUB(this->currentYaw, BINANG_ADD(this->actor.wallYaw, 0x8000))) -s16 D_80862B28; +s32 sPlayerShapeYawToTouchedWall; +s32 sPlayerWorldYawToTouchedWall; +s16 sPlayerFloorPitchShape; s32 D_80862B2C; // D_80862B2C = player->currentMask; -Vec3f D_80862B30; +Vec3f sPlayerInteractWallCheckResult; f32 D_80862B3C; -FloorEffect D_80862B40; // SurfaceType_GetFloorEffect +FloorEffect sPlayerFloorEffect; Input* sPlayerControlInput; -s32 D_80862B48; -s32 D_80862B4C; -EnvLightSettings D_80862B50; // backup of play->envCtx.lightSettings -s32 D_80862B6C; // this->skelAnime.moveFlags // sPlayerSkelMoveFlags? +s32 sPlayerUseHeldItem; // When true, the current held item is used. Is reset to false every frame. +s32 sPlayerHeldItemButtonIsHeldDown; // Indicates if the button for the current held item is held down. +AdjLightSettings D_80862B50; // backup of lay->envCtx.adjLightSettings +s32 D_80862B6C; // this->skelAnime.moveFlags // sPlayerSkelMoveFlags? s32 func_8082DA90(PlayState* play) { return (play->transitionTrigger != TRANS_TRIGGER_OFF) || (play->transitionMode != TRANS_MODE_OFF); @@ -573,7 +586,7 @@ void func_8082DC64(PlayState* play, Player* this) { this->stateFlags2 &= ~(PLAYER_STATE2_400 | PLAYER_STATE2_800); } -void func_8082DCA0(PlayState* play, Player* this) { +void Player_DetachHeldActor(PlayState* play, Player* this) { Actor* heldActor = this->heldActor; if ((heldActor != NULL) && !Player_IsHoldingHookshot(this)) { @@ -585,7 +598,7 @@ void func_8082DCA0(PlayState* play, Player* this) { } if (Player_GetExplosiveHeld(this) > PLAYER_EXPLOSIVE_NONE) { - func_8082F8BC(play, this, PLAYER_IA_NONE); + Player_InitItemAction(play, this, PLAYER_IA_NONE); this->heldItemId = ITEM_FE; } } @@ -619,7 +632,7 @@ void func_8082DD2C(PlayState* play, Player* this) { s32 func_8082DE14(PlayState* play, Player* this) { if (this->heldItemAction > PLAYER_IA_LAST_USED) { - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); return true; } else { return false; @@ -628,18 +641,20 @@ s32 func_8082DE14(PlayState* play, Player* this) { void func_8082DE50(PlayState* play, Player* this) { func_8082DD2C(play, this); - func_8082DCA0(play, this); + Player_DetachHeldActor(play, this); } s32 func_8082DE88(Player* this, s32 arg1, s32 arg2) { - s16 temp_v0 = this->unk_D64 - D_80862B00; + s16 controlStickAngleDiff = this->prevControlStickAngle - sPlayerControlStickAngle; + + this->actionVar2 += + arg1 + TRUNCF_BINANG(ABS_ALT(controlStickAngleDiff) * fabsf(sPlayerControlStickMagnitude) * (1.0f / 0x600F0)); - this->unk_AE8 += arg1 + (s16)(ABS_ALT(temp_v0) * fabsf(D_80862AFC) * (1.0f / 0x600F0)); if (CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_B | BTN_A)) { - this->unk_AE8 += 5; + this->actionVar2 += 5; } - return this->unk_AE8 >= arg2; + return this->actionVar2 >= arg2; } void func_8082DF2C(PlayState* play) { @@ -648,7 +663,7 @@ void func_8082DF2C(PlayState* play) { } } -u8 D_8085B9F0[PLAYER_LIMB_MAX] = { +u8 sPlayerUpperBodyLimbCopyMap[PLAYER_LIMB_MAX] = { false, // PLAYER_LIMB_NONE false, // PLAYER_LIMB_ROOT false, // PLAYER_LIMB_WAIST @@ -733,39 +748,39 @@ void Player_RequestRumble(PlayState* play, Player* this, s32 sourceIntensity, s3 PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { - // unk_00; + // ceilingCheckHeight 84.0f, - // shadowScale; + // shadowScale 90.0f, - // unk_08; + // unk_08 1.5f, - // unk_0C; + // unk_0C 166.5f, - // unk_10; + // unk_10 105.0f, - // unk_14; + // unk_14 119.100006f, - // unk_18; + // unk_18 88.5f, - // unk_1C; + // unk_1C 61.5f, - // unk_20; + // unk_20 28.5f, - // unk_24; + // unk_24 54.0f, - // unk_28; + // unk_28 75.0f, - // unk_2C; + // unk_2C 84.0f, - // unk_30; + // unk_30 102.0f, - // unk_34; // height? + // unk_34 70.0f, - // unk_38; + // wallCheckRadius 27.0f, - // unk_3C; + // unk_3C 24.75f, - // unk_40; + // unk_40 105.0f, // unk_44 { 9, 0x123F, 0x167 }, @@ -787,13 +802,13 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { -0x638, 0x1256, 0x17C }, { -0x637, 0x17EA, 0x167 }, }, - // voiceSfxIdOffset; + // voiceSfxIdOffset SFX_VOICE_BANK_SIZE * 0, - // surfaceSfxIdOffset; + // surfaceSfxIdOffset 0x80, - // unk_98; + // unk_98 33.0f, - // unk_9C; + // unk_9C 44.15145f, // openChestAnim &gPlayerAnim_link_demo_Tbox_open, @@ -829,39 +844,39 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { }, }, { - // unk_00; + // ceilingCheckHeight 70.0f, - // shadowScale; + // shadowScale 90.0f, - // unk_08; + // unk_08 0.74f, - // unk_0C; + // unk_0C 111.0f, - // unk_10; + // unk_10 70.0f, - // unk_14; + // unk_14 79.4f, - // unk_18; + // unk_18 59.0f, - // unk_1C; + // unk_1C 41.0f, - // unk_20; + // unk_20 19.0f, - // unk_24; + // unk_24 36.0f, - // unk_28; + // unk_28 50.0f, - // unk_2C; + // unk_2C 56.0f, - // unk_30; + // unk_30 68.0f, - // unk_34; // height? + // unk_34 70.0f, - // unk_38; + // wallCheckRadius 19.5f, - // unk_3C; + // unk_3C 18.2f, - // unk_40; + // unk_40 80.0f, // unk_44 { 0x17, 0xF3B, 0xDF }, @@ -883,13 +898,13 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { -0x638, 0x1256, 0x17C }, { -0x637, 0x17EA, 0x167 }, }, - // voiceSfxIdOffset; + // voiceSfxIdOffset SFX_VOICE_BANK_SIZE * 6, - // surfaceSfxIdOffset; + // surfaceSfxIdOffset 0x150, - // unk_98; + // unk_98 -25.0f, - // unk_9C; + // unk_9C 42.0f, // openChestAnim &gPlayerAnim_pg_Tbox_open, @@ -925,39 +940,39 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { }, }, { - // unk_00; + // ceilingCheckHeight 56.0f, - // shadowScale; + // shadowScale 90.0f, - // unk_08; + // unk_08 1.0f, - // unk_0C; + // unk_0C 111.0f, - // unk_10; + // unk_10 70.0f, - // unk_14; + // unk_14 79.4f, - // unk_18; + // unk_18 59.0f, - // unk_1C; + // unk_1C 41.0f, - // unk_20; + // unk_20 19.0f, - // unk_24; + // unk_24 36.0f, - // unk_28; + // unk_28 50.0f, - // unk_2C; + // unk_2C 56.0f, - // unk_30; + // unk_30 68.0f, - // unk_34; // height? + // unk_34 70.0f, - // unk_38; + // wallCheckRadius 18.0f, - // unk_3C; + // unk_3C 23.0f, - // unk_40; + // unk_40 70.0f, // unk_44 { 0x17, 0x1323, -0x6D }, @@ -979,13 +994,13 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { -0x638, 0x1256, 0x17C }, { -0x637, 0x17EA, 0x167 }, }, - // voiceSfxIdOffset; + // voiceSfxIdOffset SFX_VOICE_BANK_SIZE * 5, - // surfaceSfxIdOffset; + // surfaceSfxIdOffset 0x120, - // unk_98; + // unk_98 22.0f, - // unk_9C; + // unk_9C 36.0f, // openChestAnim &gPlayerAnim_pz_Tbox_open, @@ -1021,39 +1036,39 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { }, }, { - // unk_00; + // ceilingCheckHeight 35.0f, - // shadowScale; + // shadowScale 50.0f, - // unk_08; + // unk_08 0.3f, - // unk_0C; + // unk_0C 71.0f, - // unk_10; + // unk_10 50.0f, - // unk_14; + // unk_14 49.0f, - // unk_18; + // unk_18 39.0f, - // unk_1C; + // unk_1C 27.0f, - // unk_20; + // unk_20 19.0f, - // unk_24; + // unk_24 8.0f, - // unk_28; + // unk_28 13.6f, - // unk_2C; + // unk_2C 24.0f, - // unk_30; + // unk_30 24.0f, - // unk_34; // height? + // unk_34 70.0f, - // unk_38; + // wallCheckRadius 14.0f, - // unk_3C; + // unk_3C 12.0f, - // unk_40; + // unk_40 55.0f, // unk_44 { -0x18, 0xDED, 0x36C }, @@ -1075,13 +1090,13 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { -0x638, 0x1256, 0x17C }, { -0x637, 0x17EA, 0x167 }, }, - // voiceSfxIdOffset; + // voiceSfxIdOffset SFX_VOICE_BANK_SIZE * 4, - // surfaceSfxIdOffset; + // surfaceSfxIdOffset 0xF0, - // unk_98; + // unk_98 -21.0f, - // unk_9C; + // unk_9C 33.0f, // openChestAnim &gPlayerAnim_pn_Tbox_open, @@ -1117,39 +1132,39 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { }, }, { - // unk_00; + // ceilingCheckHeight 40.0f, - // shadowScale; + // shadowScale 60.0f, - // unk_08; + // unk_08 11.0f / 17.0f, - // unk_0C; + // unk_0C 71.0f, - // unk_10; + // unk_10 50.0f, - // unk_14; + // unk_14 49.0f, - // unk_18; + // unk_18 39.0f, - // unk_1C; + // unk_1C 27.0f, - // unk_20; + // unk_20 19.0f, - // unk_24; + // unk_24 22.0f, - // unk_28; + // unk_28 32.4f, - // unk_2C; + // unk_2C 32.0f, - // unk_30; + // unk_30 48.0f, - // unk_34; // height? + // unk_34 11.0f / 17.0f * 70.0f, - // unk_38; + // wallCheckRadius 14.0f, - // unk_3C; + // unk_3C 12.0f, - // unk_40; + // unk_40 55.0f, // unk_44 { -0x18, 0xDED, 0x36C }, @@ -1171,13 +1186,13 @@ PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { -0x638, 0x1256, 0x17C }, { -0x637, 0x17EA, 0x167 }, }, - // voiceSfxIdOffset; + // voiceSfxIdOffset SFX_VOICE_BANK_SIZE * 1, - // surfaceSfxIdOffset; + // surfaceSfxIdOffset 0, - // unk_98; + // unk_98 22.0f, - // unk_9C; + // unk_9C 29.4343f, // openChestAnim &gPlayerAnim_clink_demo_Tbox_open, @@ -1744,7 +1759,7 @@ void Player_AnimSfx_PlayVoice(Player* this, u16 sfxId) { u16 sfxOffset; if (this->currentMask == PLAYER_MASK_GIANT) { - func_8019F830(&this->actor.projectedPos, sfxId); + Audio_PlaySfx_GiantsMask(&this->actor.projectedPos, sfxId); } else if (this->actor.id == ACTOR_PLAYER) { if (this->currentMask == PLAYER_MASK_SCENTS) { sfxOffset = SFX_VOICE_BANK_SIZE * 7; @@ -1802,7 +1817,7 @@ void Player_AnimSfx_PlayFloorWalk(Player* this, f32 freqVolumeLerp) { } // Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume - func_8019F638(&this->actor.projectedPos, sfxId, freqVolumeLerp); + Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume(&this->actor.projectedPos, sfxId, freqVolumeLerp); } // ANIMSFX_TYPE_FLOOR_JUMP @@ -1846,8 +1861,8 @@ void Player_PlayAnimSfx(Player* this, AnimSfxEntry* entry) { Player_AnimSfx_PlayFloorWalk(this, 0.0f); } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_9)) { // Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume - func_8019F638(&this->actor.projectedPos, this->ageProperties->surfaceSfxIdOffset + NA_SE_PL_WALK_LADDER, - 0.0f); + Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume( + &this->actor.projectedPos, this->ageProperties->surfaceSfxIdOffset + NA_SE_PL_WALK_LADDER, 0.0f); } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_SURFACE)) { Player_PlaySfx(this, entry->sfxId + this->ageProperties->surfaceSfxIdOffset); } @@ -2005,27 +2020,31 @@ void func_8082EB18(PlayState* play, Player* this, PlayerAnimationHeader* anim) { func_8082EAF0(play, this, anim, ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE); } -void func_8082EB38(PlayState* play, Player* this) { +void Player_ProcessControlStick(PlayState* play, Player* this) { s8 var_v0; s8 var_v1; - this->unk_D60 = D_80862AFC; - this->unk_D64 = D_80862B00; - func_800FF3A0(&D_80862AFC, &D_80862B00, sPlayerControlInput); + this->prevControlStickMagnitude = sPlayerControlStickMagnitude; + this->prevControlStickAngle = sPlayerControlStickAngle; - if (D_80862AFC < 8.0f) { - D_80862AFC = 0.0f; + Lib_GetControlStickData(&sPlayerControlStickMagnitude, &sPlayerControlStickAngle, sPlayerControlInput); + + if (sPlayerControlStickMagnitude < 8.0f) { + sPlayerControlStickMagnitude = 0.0f; } - D_80862B02 = Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]) + D_80862B00; + D_80862B02 = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sPlayerControlStickAngle; + this->unk_ADE = (this->unk_ADE + 1) % ARRAY_COUNT(this->unk_ADF); - if (D_80862AFC < 55.0f) { + + if (sPlayerControlStickMagnitude < 55.0f) { var_v0 = -1; var_v1 = -1; } else { - var_v1 = ((u16)(D_80862B00 + 0x2000)) >> 9; + var_v1 = ((u16)(sPlayerControlStickAngle + 0x2000)) >> 9; var_v0 = ((u16)(BINANG_SUB(D_80862B02, this->actor.shape.rot.y) + 0x2000)) >> 14; } + this->unk_ADF[this->unk_ADE] = var_v1; this->unk_AE3[this->unk_ADE] = var_v0; } @@ -2090,12 +2109,12 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { // GI_HEART_CONTAINER GET_ITEM(ITEM_HEART_CONTAINER, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xD, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), - // GI_MAGIC_SMALL - GET_ITEM(ITEM_MAGIC_SMALL, OBJECT_GI_MAGICPOT, GID_MAGIC_SMALL, 0xE, - GIFIELD(GIFIELD_20 | GIFIELD_40, ITEM00_MAGIC_SMALL), CHEST_ANIM_SHORT), - // GI_MAGIC_LARGE - GET_ITEM(ITEM_MAGIC_LARGE, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xF, - GIFIELD(GIFIELD_20 | GIFIELD_40, ITEM00_MAGIC_LARGE), CHEST_ANIM_SHORT), + // GI_MAGIC_JAR_SMALL + GET_ITEM(ITEM_MAGIC_JAR_SMALL, OBJECT_GI_MAGICPOT, GID_MAGIC_JAR_SMALL, 0xE, + GIFIELD(GIFIELD_20 | GIFIELD_40, ITEM00_MAGIC_JAR_SMALL), CHEST_ANIM_SHORT), + // GI_MAGIC_JAR_BIG + GET_ITEM(ITEM_MAGIC_JAR_BIG, OBJECT_GI_MAGICPOT, GID_MAGIC_JAR_BIG, 0xF, + GIFIELD(GIFIELD_20 | GIFIELD_40, ITEM00_MAGIC_JAR_BIG), CHEST_ANIM_SHORT), // GI_10 GET_ITEM(ITEM_RECOVERY_HEART, OBJECT_GI_HEART, GID_RECOVERY_HEART, 0x10, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), @@ -2117,8 +2136,8 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { GET_ITEM(ITEM_BOMBS_20, OBJECT_GI_BOMB_1, GID_BOMB, 0x17, GIFIELD(GIFIELD_40, ITEM00_BOMBS_0), CHEST_ANIM_SHORT), // GI_BOMBS_30 GET_ITEM(ITEM_BOMBS_30, OBJECT_GI_BOMB_1, GID_BOMB, 0x18, GIFIELD(GIFIELD_40, ITEM00_BOMBS_0), CHEST_ANIM_SHORT), - // GI_STICKS_1 - GET_ITEM(ITEM_STICK, OBJECT_GI_STICK, GID_STICK, 0x19, GIFIELD(0, ITEM00_STICK), CHEST_ANIM_SHORT), + // GI_DEKU_STICKS_1 + GET_ITEM(ITEM_DEKU_STICK, OBJECT_GI_STICK, GID_DEKU_STICK, 0x19, GIFIELD(0, ITEM00_DEKU_STICK), CHEST_ANIM_SHORT), // GI_BOMBCHUS_10 GET_ITEM(ITEM_BOMBCHUS_10, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x1A, GIFIELD(GIFIELD_40 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), @@ -2160,33 +2179,33 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { // GI_ARROW_LIGHT GET_ITEM(ITEM_ARROW_LIGHT, OBJECT_GI_M_ARROW, GID_ARROW_LIGHT, 0x27, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), - // GI_NUTS_1 - GET_ITEM(ITEM_NUT, OBJECT_GI_NUTS, GID_NUTS, 0x28, GIFIELD(0, ITEM00_NUTS_1), CHEST_ANIM_SHORT), - // GI_NUTS_5 - GET_ITEM(ITEM_NUTS_5, OBJECT_GI_NUTS, GID_NUTS, 0x29, GIFIELD(0, ITEM00_NUTS_1), CHEST_ANIM_SHORT), - // GI_NUTS_10 - GET_ITEM(ITEM_NUTS_10, OBJECT_GI_NUTS, GID_NUTS, 0x2A, GIFIELD(0, ITEM00_NUTS_1), CHEST_ANIM_SHORT), + // GI_DEKU_NUTS_1 + GET_ITEM(ITEM_DEKU_NUT, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x28, GIFIELD(0, ITEM00_DEKU_NUTS_1), CHEST_ANIM_SHORT), + // GI_DEKU_NUTS_5 + GET_ITEM(ITEM_DEKU_NUTS_5, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x29, GIFIELD(0, ITEM00_DEKU_NUTS_1), CHEST_ANIM_SHORT), + // GI_DEKU_NUTS_10 + GET_ITEM(ITEM_DEKU_NUTS_10, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x2A, GIFIELD(0, ITEM00_DEKU_NUTS_1), CHEST_ANIM_SHORT), // GI_2B - GET_ITEM(ITEM_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_NUTS, 0x2B, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x2B, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_2C - GET_ITEM(ITEM_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_NUTS, 0x2C, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x2C, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_2D - GET_ITEM(ITEM_NUT_UPGRADE_40, OBJECT_GI_NUTS, GID_NUTS, 0x2D, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_NUT_UPGRADE_40, OBJECT_GI_NUTS, GID_DEKU_NUTS, 0x2D, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_BOMBCHUS_20 GET_ITEM(ITEM_BOMBCHUS_20, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x2E, GIFIELD(GIFIELD_40 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_2F - GET_ITEM(ITEM_STICK_UPGRADE_20, OBJECT_GI_STICK, GID_STICK, 0x2F, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_STICK_UPGRADE_20, OBJECT_GI_STICK, GID_DEKU_STICK, 0x2F, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_30 - GET_ITEM(ITEM_STICK_UPGRADE_20, OBJECT_GI_STICK, GID_STICK, 0x30, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_STICK_UPGRADE_20, OBJECT_GI_STICK, GID_DEKU_STICK, 0x30, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_31 - GET_ITEM(ITEM_STICK_UPGRADE_30, OBJECT_GI_STICK, GID_STICK, 0x31, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_SHORT), + GET_ITEM(ITEM_DEKU_STICK_UPGRADE_30, OBJECT_GI_STICK, GID_DEKU_STICK, 0x31, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), // GI_SHIELD_HERO GET_ITEM(ITEM_SHIELD_HERO, OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, 0x32, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_SHORT), @@ -2234,14 +2253,14 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { // GI_HOOKSHOT GET_ITEM(ITEM_HOOKSHOT, OBJECT_GI_HOOKSHOT, GID_HOOKSHOT, 0x41, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), - // GI_LENS - GET_ITEM(ITEM_LENS, OBJECT_GI_GLASSES, GID_LENS, 0x42, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_LONG), - // GI_PICTO_BOX - GET_ITEM(ITEM_PICTO_BOX, OBJECT_GI_CAMERA, GID_PICTO_BOX, 0x43, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), + // GI_LENS_OF_TRUTH + GET_ITEM(ITEM_LENS_OF_TRUTH, OBJECT_GI_GLASSES, GID_LENS, 0x42, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), + // GI_PICTOGRAPH_BOX + GET_ITEM(ITEM_PICTOGRAPH_BOX, OBJECT_GI_CAMERA, GID_PICTOGRAPH_BOX, 0x43, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), // GI_44 - GET_ITEM(ITEM_PICTO_BOX, OBJECT_UNSET_0, GID_NONE, 0x44, GIFIELD(0, ITEM00_RUPEE_GREEN), 0), + GET_ITEM(ITEM_PICTOGRAPH_BOX, OBJECT_UNSET_0, GID_NONE, 0x44, GIFIELD(0, ITEM00_RUPEE_GREEN), 0), // GI_45 GET_ITEM(ITEM_RECOVERY_HEART, OBJECT_GI_HEART, GID_RECOVERY_HEART, 0x45, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), @@ -2257,9 +2276,9 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { GET_ITEM(ITEM_NONE, OBJECT_UNSET_0, GID_NONE, 0x4A, 0, 0), // GI_4B GET_ITEM(ITEM_NONE, OBJECT_UNSET_0, GID_NONE, 0x4B, 0, 0), - // GI_OCARINA - GET_ITEM(ITEM_OCARINA, OBJECT_GI_OCARINA, GID_OCARINA, 0x4C, GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), - CHEST_ANIM_LONG), + // GI_OCARINA_OF_TIME + GET_ITEM(ITEM_OCARINA_OF_TIME, OBJECT_GI_OCARINA, GID_OCARINA, 0x4C, + GIFIELD(GIFIELD_20 | GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), // GI_4D GET_ITEM(ITEM_NONE, OBJECT_UNSET_0, GID_NONE, 0x4D, 0, 0), // GI_4E @@ -2449,8 +2468,8 @@ GetItemEntry sGetItemTable[GI_MAX - 1] = { // GI_SEAHORSE_CAUGHT GET_ITEM(ITEM_SEAHORSE_CAUGHT, OBJECT_GI_SEAHORSE, GID_SEAHORSE_CAUGHT, 0x95, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), - // GI_MOON_TEAR - GET_ITEM(ITEM_MOON_TEAR, OBJECT_GI_RESERVE00, GID_MOON_TEAR, 0x96, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), + // GI_MOONS_TEAR + GET_ITEM(ITEM_MOONS_TEAR, OBJECT_GI_RESERVE00, GID_MOONS_TEAR, 0x96, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), CHEST_ANIM_LONG), // GI_DEED_LAND GET_ITEM(ITEM_DEED_LAND, OBJECT_GI_RESERVE01, GID_DEED_LAND, 0x97, GIFIELD(GIFIELD_NO_COLLECTIBLE, 0), @@ -2714,11 +2733,11 @@ PlayerAnimationHeader* func_8082EFE4(Player* this) { } } -void func_8082F02C(PlayState* play, struct_8082F02C_arg1* arg1, f32 arg2) { - func_800FD59C(play, &arg1->unk_0, arg2); - func_800FD5E0(play, &arg1->unk_3, arg2); - func_800FD654(play, &arg1->unk_6, arg2); - func_800FD698(play, arg1->unk_A, arg1->unk_C, arg2); +void Player_LerpEnvLighting(PlayState* play, PlayerEnvLighting* lighting, f32 lerp) { + Environment_LerpAmbientColor(play, &lighting->ambientColor, lerp); + Environment_LerpDiffuseColor(play, &lighting->diffuseColor, lerp); + Environment_LerpFogColor(play, &lighting->fogColor, lerp); + Environment_LerpFog(play, lighting->fogNear, lighting->zFar, lerp); } /** @@ -2786,8 +2805,12 @@ void func_8082F164(Player* this, u16 button) { } } -struct_8082F02C_arg1 D_8085C98C = { - { 0, 0, 0 }, { 255, 255, 155 }, { 20, 20, 50 }, 940, 5000, +PlayerEnvLighting sZoraBarrierEnvLighting = { + { 0, 0, 0 }, // ambientColor + { 255, 255, 155 }, // diffuseColor + { 20, 20, 50 }, // fogColor + 940, // fogNear + 5000, // zFar }; // Run Zora Barrier @@ -2822,7 +2845,7 @@ void func_8082F1AC(PlayState* play, Player* this) { sp46 = play->gameplayFrames * 7000; sp44 = play->gameplayFrames * 14000; - func_8082F02C(play, &D_8085C98C, this->unk_B62 / 255.0f); + Player_LerpEnvLighting(play, &sZoraBarrierEnvLighting, this->unk_B62 / 255.0f); sp34 = Math_SinS(sp44) * 40.0f; sp40 = Math_CosS(sp44) * 40.0f; @@ -2837,55 +2860,55 @@ void func_8082F1AC(PlayState* play, Player* this) { } } -void func_8082F43C(PlayState* play, Player* this, PlayerFuncAC4 arg2) { - this->unk_AC4 = arg2; +void Player_SetUpperAction(PlayState* play, Player* this, PlayerUpperActionFunc upperActionFunc) { + this->upperActionFunc = upperActionFunc; this->unk_ACE = 0; - this->unk_AC8 = 0.0f; + this->skelAnimeUpperBlendWeight = 0.0f; func_8082E00C(this); } #define GET_PLAYER_ANIM(group, type) ((PlayerAnimationHeader**)D_8085BE84)[group * PLAYER_ANIMTYPE_MAX + type] -void func_8082F470(PlayState* play, Player* this, PlayerItemAction itemAction) { +void Player_InitItemActionWithAnim(PlayState* play, Player* this, PlayerItemAction itemAction) { PlayerAnimationHeader* curAnim = this->skelAnime.animation; PlayerAnimationHeader*(*iter)[PLAYER_ANIMTYPE_MAX] = (void*)&D_8085BE84[0][this->modelAnimType]; - s32 i; + s32 animGroup; this->stateFlags1 &= ~(PLAYER_STATE1_8 | PLAYER_STATE1_1000000); - for (i = 0; i < PLAYER_ANIMGROUP_MAX; i++) { + for (animGroup = 0; animGroup < PLAYER_ANIMGROUP_MAX; animGroup++) { if (curAnim == **iter) { break; } iter++; } - func_8082F8BC(play, this, itemAction); + Player_InitItemAction(play, this, itemAction); - if (i < PLAYER_ANIMGROUP_MAX) { - this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType); + if (animGroup < PLAYER_ANIMGROUP_MAX) { + this->skelAnime.animation = GET_PLAYER_ANIM(animGroup, this->modelAnimType); } } s8 sItemItemActions[] = { - PLAYER_IA_OCARINA, // ITEM_OCARINA, + PLAYER_IA_OCARINA, // ITEM_OCARINA_OF_TIME, PLAYER_IA_BOW, // ITEM_BOW, PLAYER_IA_BOW_FIRE, // ITEM_ARROW_FIRE, PLAYER_IA_BOW_ICE, // ITEM_ARROW_ICE, PLAYER_IA_BOW_LIGHT, // ITEM_ARROW_LIGHT, - PLAYER_IA_PICTO_BOX, // ITEM_OCARINA_FAIRY, + PLAYER_IA_PICTOGRAPH_BOX, // ITEM_OCARINA_FAIRY, PLAYER_IA_BOMB, // ITEM_BOMB, PLAYER_IA_BOMBCHU, // ITEM_BOMBCHU, - PLAYER_IA_STICK, // ITEM_STICK, - PLAYER_IA_NUT, // ITEM_NUT, + PLAYER_IA_DEKU_STICK, // ITEM_DEKU_STICK, + PLAYER_IA_DEKU_NUT, // ITEM_DEKU_NUT, PLAYER_IA_MAGIC_BEANS, // ITEM_MAGIC_BEANS, - PLAYER_IA_PICTO_BOX, // ITEM_SLINGSHOT, + PLAYER_IA_PICTOGRAPH_BOX, // ITEM_SLINGSHOT, PLAYER_IA_POWDER_KEG, // ITEM_POWDER_KEG, - PLAYER_IA_PICTO_BOX, // ITEM_PICTO_BOX, - PLAYER_IA_LENS, // ITEM_LENS, + PLAYER_IA_PICTOGRAPH_BOX, // ITEM_PICTOGRAPH_BOX, + PLAYER_IA_LENS_OF_TRUTH, // ITEM_LENS_OF_TRUTH, PLAYER_IA_HOOKSHOT, // ITEM_HOOKSHOT, PLAYER_IA_SWORD_TWO_HANDED, // ITEM_SWORD_GREAT_FAIRY, - PLAYER_IA_PICTO_BOX, // ITEM_LONGSHOT, // OoT Leftover + PLAYER_IA_PICTOGRAPH_BOX, // ITEM_LONGSHOT, // OoT Leftover PLAYER_IA_BOTTLE_EMPTY, // ITEM_BOTTLE, PLAYER_IA_BOTTLE_POTION_RED, // ITEM_POTION_RED, PLAYER_IA_BOTTLE_POTION_GREEN, // ITEM_POTION_GREEN, @@ -2908,7 +2931,7 @@ s8 sItemItemActions[] = { PLAYER_IA_BOTTLE_CHATEAU, // ITEM_CHATEAU, PLAYER_IA_BOTTLE_HYLIAN_LOACH, // ITEM_HYLIAN_LOACH, PLAYER_IA_BOTTLE_POE, // ITEM_OBABA_DRINK, // ! - PLAYER_IA_MOON_TEAR, // ITEM_MOON_TEAR, + PLAYER_IA_MOONS_TEAR, // ITEM_MOONS_TEAR, PLAYER_IA_DEED_LAND, // ITEM_DEED_LAND, PLAYER_IA_DEED_SWAMP, // ITEM_DEED_SWAMP, PLAYER_IA_DEED_MOUNTAIN, // ITEM_DEED_MOUNTAIN, @@ -2942,9 +2965,9 @@ s8 sItemItemActions[] = { PLAYER_IA_MASK_BLAST, // ITEM_MASK_BLAST, PLAYER_IA_MASK_SCENTS, // ITEM_MASK_SCENTS, PLAYER_IA_MASK_GIANT, // ITEM_MASK_GIANT, - PLAYER_IA_BOW_FIRE, // ITEM_BOW_ARROW_FIRE, - PLAYER_IA_BOW_ICE, // ITEM_BOW_ARROW_ICE, - PLAYER_IA_BOW_LIGHT, // ITEM_BOW_ARROW_LIGHT, + PLAYER_IA_BOW_FIRE, // ITEM_BOW_FIRE, + PLAYER_IA_BOW_ICE, // ITEM_BOW_ICE, + PLAYER_IA_BOW_LIGHT, // ITEM_BOW_LIGHT, PLAYER_IA_SWORD_KOKIRI, // ITEM_SWORD_KOKIRI, PLAYER_IA_SWORD_RAZOR, // ITEM_SWORD_RAZOR, PLAYER_IA_SWORD_GILDED, // ITEM_SWORD_GILDED, @@ -2965,18 +2988,192 @@ PlayerItemAction Player_ItemToItemAction(Player* this, ItemId item) { } } -void func_8082F594(PlayState* play, Player* this) { +PlayerUpperActionFunc sPlayerUpperActionUpdateFuncs[PLAYER_IA_MAX] = { + Player_UpperAction_0, // PLAYER_IA_NONE + Player_UpperAction_0, // PLAYER_IA_LAST_USED + Player_UpperAction_0, // PLAYER_IA_FISHING_ROD + Player_UpperAction_1, // PLAYER_IA_SWORD_KOKIRI + Player_UpperAction_1, // PLAYER_IA_SWORD_RAZOR + Player_UpperAction_1, // PLAYER_IA_SWORD_GILDED + Player_UpperAction_1, // PLAYER_IA_SWORD_TWO_HANDED + Player_UpperAction_0, // PLAYER_IA_DEKU_STICK + Player_UpperAction_0, // PLAYER_IA_ZORA_FINS + Player_UpperAction_6, // PLAYER_IA_BOW + Player_UpperAction_6, // PLAYER_IA_BOW_FIRE + Player_UpperAction_6, // PLAYER_IA_BOW_ICE + Player_UpperAction_6, // PLAYER_IA_BOW_LIGHT + Player_UpperAction_6, // PLAYER_IA_HOOKSHOT + Player_UpperAction_10, // PLAYER_IA_BOMB + Player_UpperAction_10, // PLAYER_IA_POWDER_KEG + Player_UpperAction_10, // PLAYER_IA_BOMBCHU + Player_UpperAction_11, // PLAYER_IA_11 + Player_UpperAction_6, // PLAYER_IA_DEKU_NUT + Player_UpperAction_0, // PLAYER_IA_PICTOGRAPH_BOX + Player_UpperAction_0, // PLAYER_IA_OCARINA + Player_UpperAction_0, // PLAYER_IA_BOTTLE_EMPTY + Player_UpperAction_0, // PLAYER_IA_BOTTLE_FISH + Player_UpperAction_0, // PLAYER_IA_BOTTLE_SPRING_WATER + Player_UpperAction_0, // PLAYER_IA_BOTTLE_HOT_SPRING_WATER + Player_UpperAction_0, // PLAYER_IA_BOTTLE_ZORA_EGG + Player_UpperAction_0, // PLAYER_IA_BOTTLE_DEKU_PRINCESS + Player_UpperAction_0, // PLAYER_IA_BOTTLE_GOLD_DUST + Player_UpperAction_0, // PLAYER_IA_BOTTLE_1C + Player_UpperAction_0, // PLAYER_IA_BOTTLE_SEA_HORSE + Player_UpperAction_0, // PLAYER_IA_BOTTLE_MUSHROOM + Player_UpperAction_0, // PLAYER_IA_BOTTLE_HYLIAN_LOACH + Player_UpperAction_0, // PLAYER_IA_BOTTLE_BUG + Player_UpperAction_0, // PLAYER_IA_BOTTLE_POE + Player_UpperAction_0, // PLAYER_IA_BOTTLE_BIG_POE + Player_UpperAction_0, // PLAYER_IA_BOTTLE_POTION_RED + Player_UpperAction_0, // PLAYER_IA_BOTTLE_POTION_BLUE + Player_UpperAction_0, // PLAYER_IA_BOTTLE_POTION_GREEN + Player_UpperAction_0, // PLAYER_IA_BOTTLE_MILK + Player_UpperAction_0, // PLAYER_IA_BOTTLE_MILK_HALF + Player_UpperAction_0, // PLAYER_IA_BOTTLE_CHATEAU + Player_UpperAction_0, // PLAYER_IA_BOTTLE_FAIRY + Player_UpperAction_0, // PLAYER_IA_MOONS_TEAR + Player_UpperAction_0, // PLAYER_IA_DEED_LAND + Player_UpperAction_0, // PLAYER_IA_ROOM_KEY + Player_UpperAction_0, // PLAYER_IA_LETTER_TO_KAFEI + Player_UpperAction_0, // PLAYER_IA_MAGIC_BEANS + Player_UpperAction_0, // PLAYER_IA_DEED_SWAMP + Player_UpperAction_0, // PLAYER_IA_DEED_MOUNTAIN + Player_UpperAction_0, // PLAYER_IA_DEED_OCEAN + Player_UpperAction_0, // PLAYER_IA_32 + Player_UpperAction_0, // PLAYER_IA_LETTER_MAMA + Player_UpperAction_0, // PLAYER_IA_34 + Player_UpperAction_0, // PLAYER_IA_35 + Player_UpperAction_0, // PLAYER_IA_PENDANT_MEMORIES + Player_UpperAction_0, // PLAYER_IA_37 + Player_UpperAction_0, // PLAYER_IA_38 + Player_UpperAction_0, // PLAYER_IA_39 + Player_UpperAction_0, // PLAYER_IA_MASK_TRUTH + Player_UpperAction_0, // PLAYER_IA_MASK_KAFEIS_MASK + Player_UpperAction_0, // PLAYER_IA_MASK_ALL_NIGHT + Player_UpperAction_0, // PLAYER_IA_MASK_BUNNY + Player_UpperAction_0, // PLAYER_IA_MASK_KEATON + Player_UpperAction_0, // PLAYER_IA_MASK_GARO + Player_UpperAction_0, // PLAYER_IA_MASK_ROMANI + Player_UpperAction_0, // PLAYER_IA_MASK_CIRCUS_LEADER + Player_UpperAction_0, // PLAYER_IA_MASK_POSTMAN + Player_UpperAction_0, // PLAYER_IA_MASK_COUPLE + Player_UpperAction_0, // PLAYER_IA_MASK_GREAT_FAIRY + Player_UpperAction_0, // PLAYER_IA_MASK_GIBDO + Player_UpperAction_0, // PLAYER_IA_MASK_DON_GERO + Player_UpperAction_0, // PLAYER_IA_MASK_KAMARO + Player_UpperAction_0, // PLAYER_IA_MASK_CAPTAIN + Player_UpperAction_0, // PLAYER_IA_MASK_STONE + Player_UpperAction_0, // PLAYER_IA_MASK_BREMEN + Player_UpperAction_0, // PLAYER_IA_MASK_BLAST + Player_UpperAction_0, // PLAYER_IA_MASK_SCENTS + Player_UpperAction_0, // PLAYER_IA_MASK_GIANT + Player_UpperAction_0, // PLAYER_IA_MASK_FIERCE_DEITY + Player_UpperAction_0, // PLAYER_IA_MASK_GORON + Player_UpperAction_0, // PLAYER_IA_MASK_ZORA + Player_UpperAction_0, // PLAYER_IA_MASK_DEKU + Player_UpperAction_0, // PLAYER_IA_LENS_OF_TRUTH +}; + +typedef void (*PlayerInitItemActionFunc)(PlayState*, Player*); + +PlayerInitItemActionFunc sPlayerItemActionInitFuncs[PLAYER_IA_MAX] = { + Player_InitItemAction_DoNothing, // PLAYER_IA_NONE + Player_InitItemAction_DoNothing, // PLAYER_IA_LAST_USED + Player_InitItemAction_DoNothing, // PLAYER_IA_FISHING_ROD + Player_InitItemAction_DoNothing, // PLAYER_IA_SWORD_KOKIRI + Player_InitItemAction_DoNothing, // PLAYER_IA_SWORD_RAZOR + Player_InitItemAction_DoNothing, // PLAYER_IA_SWORD_GILDED + Player_InitItemAction_DoNothing, // PLAYER_IA_SWORD_TWO_HANDED + Player_InitItemAction_DekuStick, // PLAYER_IA_DEKU_STICK + Player_InitItemAction_5, // PLAYER_IA_ZORA_FINS + Player_InitItemAction_2, // PLAYER_IA_BOW + Player_InitItemAction_2, // PLAYER_IA_BOW_FIRE + Player_InitItemAction_2, // PLAYER_IA_BOW_ICE + Player_InitItemAction_2, // PLAYER_IA_BOW_LIGHT + Player_InitItemAction_SpawnHookshot, // PLAYER_IA_HOOKSHOT + Player_InitItemAction_SpawnExplosive, // PLAYER_IA_BOMB + Player_InitItemAction_SpawnExplosive, // PLAYER_IA_POWDER_KEG + Player_InitItemAction_SpawnExplosive, // PLAYER_IA_BOMBCHU + Player_InitItemAction_5, // PLAYER_IA_11 + Player_InitItemAction_2, // PLAYER_IA_DEKU_NUT + Player_InitItemAction_DoNothing, // PLAYER_IA_PICTOGRAPH_BOX + Player_InitItemAction_DoNothing, // PLAYER_IA_OCARINA + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_EMPTY + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_FISH + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_SPRING_WATER + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_HOT_SPRING_WATER + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_ZORA_EGG + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_DEKU_PRINCESS + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_GOLD_DUST + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_1C + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_SEA_HORSE + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_MUSHROOM + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_HYLIAN_LOACH + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_BUG + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_POE + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_BIG_POE + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_POTION_RED + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_POTION_BLUE + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_POTION_GREEN + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_MILK + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_MILK_HALF + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_CHATEAU + Player_InitItemAction_DoNothing, // PLAYER_IA_BOTTLE_FAIRY + Player_InitItemAction_DoNothing, // PLAYER_IA_MOONS_TEAR + Player_InitItemAction_DoNothing, // PLAYER_IA_DEED_LAND + Player_InitItemAction_DoNothing, // PLAYER_IA_ROOM_KEY + Player_InitItemAction_DoNothing, // PLAYER_IA_LETTER_TO_KAFEI + Player_InitItemAction_DoNothing, // PLAYER_IA_MAGIC_BEANS + Player_InitItemAction_DoNothing, // PLAYER_IA_DEED_SWAMP + Player_InitItemAction_DoNothing, // PLAYER_IA_DEED_MOUNTAIN + Player_InitItemAction_DoNothing, // PLAYER_IA_DEED_OCEAN + Player_InitItemAction_DoNothing, // PLAYER_IA_32 + Player_InitItemAction_DoNothing, // PLAYER_IA_LETTER_MAMA + Player_InitItemAction_DoNothing, // PLAYER_IA_34 + Player_InitItemAction_DoNothing, // PLAYER_IA_35 + Player_InitItemAction_DoNothing, // PLAYER_IA_PENDANT_MEMORIES + Player_InitItemAction_DoNothing, // PLAYER_IA_37 + Player_InitItemAction_DoNothing, // PLAYER_IA_38 + Player_InitItemAction_DoNothing, // PLAYER_IA_39 + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_TRUTH + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_KAFEIS_MASK + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_ALL_NIGHT + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_BUNNY + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_KEATON + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_GARO + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_ROMANI + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_CIRCUS_LEADER + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_POSTMAN + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_COUPLE + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_GREAT_FAIRY + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_GIBDO + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_DON_GERO + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_KAMARO + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_CAPTAIN + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_STONE + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_BREMEN + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_BLAST + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_SCENTS + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_GIANT + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_FIERCE_DEITY + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_GORON + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_ZORA + Player_InitItemAction_DoNothing, // PLAYER_IA_MASK_DEKU + Player_InitItemAction_DoNothing, // PLAYER_IA_LENS_OF_TRUTH +}; + +void Player_InitItemAction_DoNothing(PlayState* play, Player* this) { } -void func_8082F5A4(PlayState* play, Player* this) { +void Player_InitItemAction_DekuStick(PlayState* play, Player* this) { this->unk_B28 = 0; this->unk_B0C = 1.0f; } -void func_8082F5C0(PlayState* play, Player* this) { +void Player_InitItemAction_2(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_8; - if (this->heldItemAction == PLAYER_IA_NUT) { + if (this->heldItemAction == PLAYER_IA_DEKU_NUT) { this->unk_B28 = -2; } else { this->unk_B28 = -1; @@ -2984,179 +3181,6 @@ void func_8082F5C0(PlayState* play, Player* this) { this->unk_ACC = 0; } -PlayerFuncAC4 D_8085C9F0[PLAYER_IA_MAX] = { - func_80848780, // PLAYER_IA_NONE - func_80848780, // PLAYER_IA_LAST_USED - func_80848780, // PLAYER_IA_FISHING_ROD - func_808487B8, // PLAYER_IA_SWORD_KOKIRI - func_808487B8, // PLAYER_IA_SWORD_RAZOR - func_808487B8, // PLAYER_IA_SWORD_GILDED - func_808487B8, // PLAYER_IA_SWORD_TWO_HANDED - func_80848780, // PLAYER_IA_STICK - func_80848780, // PLAYER_IA_ZORA_FINS - func_80848B6C, // PLAYER_IA_BOW - func_80848B6C, // PLAYER_IA_BOW_FIRE - func_80848B6C, // PLAYER_IA_BOW_ICE - func_80848B6C, // PLAYER_IA_BOW_LIGHT - func_80848B6C, // PLAYER_IA_HOOKSHOT - func_808490B4, // PLAYER_IA_BOMB - func_808490B4, // PLAYER_IA_POWDER_KEG - func_808490B4, // PLAYER_IA_BOMBCHU - func_808491B4, // PLAYER_IA_11 - func_80848B6C, // PLAYER_IA_NUT - func_80848780, // PLAYER_IA_PICTO_BOX - func_80848780, // PLAYER_IA_OCARINA - func_80848780, // PLAYER_IA_BOTTLE_EMPTY - func_80848780, // PLAYER_IA_BOTTLE_FISH - func_80848780, // PLAYER_IA_BOTTLE_SPRING_WATER - func_80848780, // PLAYER_IA_BOTTLE_HOT_SPRING_WATER - func_80848780, // PLAYER_IA_BOTTLE_ZORA_EGG - func_80848780, // PLAYER_IA_BOTTLE_DEKU_PRINCESS - func_80848780, // PLAYER_IA_BOTTLE_GOLD_DUST - func_80848780, // PLAYER_IA_BOTTLE_1C - func_80848780, // PLAYER_IA_BOTTLE_SEA_HORSE - func_80848780, // PLAYER_IA_BOTTLE_MUSHROOM - func_80848780, // PLAYER_IA_BOTTLE_HYLIAN_LOACH - func_80848780, // PLAYER_IA_BOTTLE_BUG - func_80848780, // PLAYER_IA_BOTTLE_POE - func_80848780, // PLAYER_IA_BOTTLE_BIG_POE - func_80848780, // PLAYER_IA_BOTTLE_POTION_RED - func_80848780, // PLAYER_IA_BOTTLE_POTION_BLUE - func_80848780, // PLAYER_IA_BOTTLE_POTION_GREEN - func_80848780, // PLAYER_IA_BOTTLE_MILK - func_80848780, // PLAYER_IA_BOTTLE_MILK_HALF - func_80848780, // PLAYER_IA_BOTTLE_CHATEAU - func_80848780, // PLAYER_IA_BOTTLE_FAIRY - func_80848780, // PLAYER_IA_MOON_TEAR - func_80848780, // PLAYER_IA_DEED_LAND - func_80848780, // PLAYER_IA_ROOM_KEY - func_80848780, // PLAYER_IA_LETTER_TO_KAFEI - func_80848780, // PLAYER_IA_MAGIC_BEANS - func_80848780, // PLAYER_IA_DEED_SWAMP - func_80848780, // PLAYER_IA_DEED_MOUNTAIN - func_80848780, // PLAYER_IA_DEED_OCEAN - func_80848780, // PLAYER_IA_32 - func_80848780, // PLAYER_IA_LETTER_MAMA - func_80848780, // PLAYER_IA_34 - func_80848780, // PLAYER_IA_35 - func_80848780, // PLAYER_IA_PENDANT_MEMORIES - func_80848780, // PLAYER_IA_37 - func_80848780, // PLAYER_IA_38 - func_80848780, // PLAYER_IA_39 - func_80848780, // PLAYER_IA_MASK_TRUTH - func_80848780, // PLAYER_IA_MASK_KAFEIS_MASK - func_80848780, // PLAYER_IA_MASK_ALL_NIGHT - func_80848780, // PLAYER_IA_MASK_BUNNY - func_80848780, // PLAYER_IA_MASK_KEATON - func_80848780, // PLAYER_IA_MASK_GARO - func_80848780, // PLAYER_IA_MASK_ROMANI - func_80848780, // PLAYER_IA_MASK_CIRCUS_LEADER - func_80848780, // PLAYER_IA_MASK_POSTMAN - func_80848780, // PLAYER_IA_MASK_COUPLE - func_80848780, // PLAYER_IA_MASK_GREAT_FAIRY - func_80848780, // PLAYER_IA_MASK_GIBDO - func_80848780, // PLAYER_IA_MASK_DON_GERO - func_80848780, // PLAYER_IA_MASK_KAMARO - func_80848780, // PLAYER_IA_MASK_CAPTAIN - func_80848780, // PLAYER_IA_MASK_STONE - func_80848780, // PLAYER_IA_MASK_BREMEN - func_80848780, // PLAYER_IA_MASK_BLAST - func_80848780, // PLAYER_IA_MASK_SCENTS - func_80848780, // PLAYER_IA_MASK_GIANT - func_80848780, // PLAYER_IA_MASK_FIERCE_DEITY - func_80848780, // PLAYER_IA_MASK_GORON - func_80848780, // PLAYER_IA_MASK_ZORA - func_80848780, // PLAYER_IA_MASK_DEKU - func_80848780, // PLAYER_IA_LENS -}; - -// sPlayerItemActionInits? -void (*D_8085CB3C[PLAYER_IA_MAX])(PlayState*, Player*) = { - func_8082F594, // PLAYER_IA_NONE - func_8082F594, // PLAYER_IA_LAST_USED - func_8082F594, // PLAYER_IA_FISHING_ROD - func_8082F594, // PLAYER_IA_SWORD_KOKIRI - func_8082F594, // PLAYER_IA_SWORD_RAZOR - func_8082F594, // PLAYER_IA_SWORD_GILDED - func_8082F594, // PLAYER_IA_SWORD_TWO_HANDED - func_8082F5A4, // PLAYER_IA_STICK - func_8082F8A0, // PLAYER_IA_ZORA_FINS - func_8082F5C0, // PLAYER_IA_BOW - func_8082F5C0, // PLAYER_IA_BOW_FIRE - func_8082F5C0, // PLAYER_IA_BOW_ICE - func_8082F5C0, // PLAYER_IA_BOW_LIGHT - func_8082F7F4, // PLAYER_IA_HOOKSHOT - Player_SpawnExplosive, // PLAYER_IA_BOMB - Player_SpawnExplosive, // PLAYER_IA_POWDER_KEG - Player_SpawnExplosive, // PLAYER_IA_BOMBCHU - func_8082F8A0, // PLAYER_IA_11 - func_8082F5C0, // PLAYER_IA_NUT - func_8082F594, // PLAYER_IA_PICTO_BOX - func_8082F594, // PLAYER_IA_OCARINA - func_8082F594, // PLAYER_IA_BOTTLE_EMPTY - func_8082F594, // PLAYER_IA_BOTTLE_FISH - func_8082F594, // PLAYER_IA_BOTTLE_SPRING_WATER - func_8082F594, // PLAYER_IA_BOTTLE_HOT_SPRING_WATER - func_8082F594, // PLAYER_IA_BOTTLE_ZORA_EGG - func_8082F594, // PLAYER_IA_BOTTLE_DEKU_PRINCESS - func_8082F594, // PLAYER_IA_BOTTLE_GOLD_DUST - func_8082F594, // PLAYER_IA_BOTTLE_1C - func_8082F594, // PLAYER_IA_BOTTLE_SEA_HORSE - func_8082F594, // PLAYER_IA_BOTTLE_MUSHROOM - func_8082F594, // PLAYER_IA_BOTTLE_HYLIAN_LOACH - func_8082F594, // PLAYER_IA_BOTTLE_BUG - func_8082F594, // PLAYER_IA_BOTTLE_POE - func_8082F594, // PLAYER_IA_BOTTLE_BIG_POE - func_8082F594, // PLAYER_IA_BOTTLE_POTION_RED - func_8082F594, // PLAYER_IA_BOTTLE_POTION_BLUE - func_8082F594, // PLAYER_IA_BOTTLE_POTION_GREEN - func_8082F594, // PLAYER_IA_BOTTLE_MILK - func_8082F594, // PLAYER_IA_BOTTLE_MILK_HALF - func_8082F594, // PLAYER_IA_BOTTLE_CHATEAU - func_8082F594, // PLAYER_IA_BOTTLE_FAIRY - func_8082F594, // PLAYER_IA_MOON_TEAR - func_8082F594, // PLAYER_IA_DEED_LAND - func_8082F594, // PLAYER_IA_ROOM_KEY - func_8082F594, // PLAYER_IA_LETTER_TO_KAFEI - func_8082F594, // PLAYER_IA_MAGIC_BEANS - func_8082F594, // PLAYER_IA_DEED_SWAMP - func_8082F594, // PLAYER_IA_DEED_MOUNTAIN - func_8082F594, // PLAYER_IA_DEED_OCEAN - func_8082F594, // PLAYER_IA_32 - func_8082F594, // PLAYER_IA_LETTER_MAMA - func_8082F594, // PLAYER_IA_34 - func_8082F594, // PLAYER_IA_35 - func_8082F594, // PLAYER_IA_PENDANT_MEMORIES - func_8082F594, // PLAYER_IA_37 - func_8082F594, // PLAYER_IA_38 - func_8082F594, // PLAYER_IA_39 - func_8082F594, // PLAYER_IA_MASK_TRUTH - func_8082F594, // PLAYER_IA_MASK_KAFEIS_MASK - func_8082F594, // PLAYER_IA_MASK_ALL_NIGHT - func_8082F594, // PLAYER_IA_MASK_BUNNY - func_8082F594, // PLAYER_IA_MASK_KEATON - func_8082F594, // PLAYER_IA_MASK_GARO - func_8082F594, // PLAYER_IA_MASK_ROMANI - func_8082F594, // PLAYER_IA_MASK_CIRCUS_LEADER - func_8082F594, // PLAYER_IA_MASK_POSTMAN - func_8082F594, // PLAYER_IA_MASK_COUPLE - func_8082F594, // PLAYER_IA_MASK_GREAT_FAIRY - func_8082F594, // PLAYER_IA_MASK_GIBDO - func_8082F594, // PLAYER_IA_MASK_DON_GERO - func_8082F594, // PLAYER_IA_MASK_KAMARO - func_8082F594, // PLAYER_IA_MASK_CAPTAIN - func_8082F594, // PLAYER_IA_MASK_STONE - func_8082F594, // PLAYER_IA_MASK_BREMEN - func_8082F594, // PLAYER_IA_MASK_BLAST - func_8082F594, // PLAYER_IA_MASK_SCENTS - func_8082F594, // PLAYER_IA_MASK_GIANT - func_8082F594, // PLAYER_IA_MASK_FIERCE_DEITY - func_8082F594, // PLAYER_IA_MASK_GORON - func_8082F594, // PLAYER_IA_MASK_ZORA - func_8082F594, // PLAYER_IA_MASK_DEKU - func_8082F594, // PLAYER_IA_LENS -}; - void func_8082F5FC(Player* this, Actor* actor) { this->heldActor = actor; this->interactRangeActor = actor; @@ -3165,27 +3189,94 @@ void func_8082F5FC(Player* this, Actor* actor) { this->stateFlags1 |= PLAYER_STATE1_800; } -struct_8085CC88 D_8085CC88[] = { - { &gPlayerAnim_link_normal_free2free, 12 }, - { &gPlayerAnim_link_normal_normal2fighter, 6 }, - { &gPlayerAnim_link_hammer_normal2long, 8 }, - { &gPlayerAnim_link_normal_normal2free, 8 }, - { &gPlayerAnim_link_fighter_fighter2long, 8 }, - { &gPlayerAnim_link_normal_fighter2free, 10 }, - { &gPlayerAnim_link_hammer_long2free, 7 }, - { &gPlayerAnim_link_hammer_long2long, 11 }, - { &gPlayerAnim_link_normal_free2free, 12 }, - { &gPlayerAnim_link_normal_normal2bom, 4 }, - { &gPlayerAnim_link_normal_long2bom, 4 }, - { &gPlayerAnim_link_normal_free2bom, 4 }, - { &gPlayerAnim_link_anchor_anchor2fighter, 5 }, - { &gPlayerAnim_link_normal_free2freeB, 13 }, - { &gPlayerAnim_pz_bladeon, 4 }, +typedef enum ItemChangeType { + /* 0 */ PLAYER_ITEM_CHG_0, + /* 1 */ PLAYER_ITEM_CHG_1, + /* 2 */ PLAYER_ITEM_CHG_2, + /* 3 */ PLAYER_ITEM_CHG_3, + /* 4 */ PLAYER_ITEM_CHG_4, + /* 5 */ PLAYER_ITEM_CHG_5, + /* 6 */ PLAYER_ITEM_CHG_6, + /* 7 */ PLAYER_ITEM_CHG_7, + /* 8 */ PLAYER_ITEM_CHG_8, + /* 9 */ PLAYER_ITEM_CHG_9, + /* 10 */ PLAYER_ITEM_CHG_10, + /* 11 */ PLAYER_ITEM_CHG_11, + /* 12 */ PLAYER_ITEM_CHG_12, + /* 13 */ PLAYER_ITEM_CHG_13, + /* 14 */ PLAYER_ITEM_CHG_14, + /* 15 */ PLAYER_ITEM_CHG_MAX +} ItemChangeType; + +ItemChangeInfo sPlayerItemChangeInfo[PLAYER_ITEM_CHG_MAX] = { + { &gPlayerAnim_link_normal_free2free, 12 }, // PLAYER_ITEM_CHG_0 + { &gPlayerAnim_link_normal_normal2fighter, 6 }, // PLAYER_ITEM_CHG_1 + { &gPlayerAnim_link_hammer_normal2long, 8 }, // PLAYER_ITEM_CHG_2 + { &gPlayerAnim_link_normal_normal2free, 8 }, // PLAYER_ITEM_CHG_3 + { &gPlayerAnim_link_fighter_fighter2long, 8 }, // PLAYER_ITEM_CHG_4 + { &gPlayerAnim_link_normal_fighter2free, 10 }, // PLAYER_ITEM_CHG_5 + { &gPlayerAnim_link_hammer_long2free, 7 }, // PLAYER_ITEM_CHG_6 + { &gPlayerAnim_link_hammer_long2long, 11 }, // PLAYER_ITEM_CHG_7 + { &gPlayerAnim_link_normal_free2free, 12 }, // PLAYER_ITEM_CHG_8 + { &gPlayerAnim_link_normal_normal2bom, 4 }, // PLAYER_ITEM_CHG_9 + { &gPlayerAnim_link_normal_long2bom, 4 }, // PLAYER_ITEM_CHG_10 + { &gPlayerAnim_link_normal_free2bom, 4 }, // PLAYER_ITEM_CHG_11 + { &gPlayerAnim_link_anchor_anchor2fighter, 5 }, // PLAYER_ITEM_CHG_12 + { &gPlayerAnim_link_normal_free2freeB, 13 }, // PLAYER_ITEM_CHG_13 + { &gPlayerAnim_pz_bladeon, 4 }, // PLAYER_ITEM_CHG_14 }; -s8 D_8085CD00[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = { - { 8, -5, -3, -6, 8, 0xB }, { 5, 0, -1, 4, 5, 9 }, { 3, 1, 0, 2, 3, 9 }, - { 6, -4, -2, 7, 6, 0xA }, { 8, -5, -3, -6, 8, 0xB }, { 8, -5, -3, -6, 8, 0xB }, +// Maps the appropriate ItemChangeType based on current and next animtype. +// A negative type value means the corresponding animation should be played in reverse. +s8 sPlayerItemChangeTypes[PLAYER_ANIMTYPE_MAX][PLAYER_ANIMTYPE_MAX] = { + { + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_DEFAULT + -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_1 + -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_2 + -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_DEFAULT -> PLAYER_ANIMTYPE_5 + }, + { + PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_DEFAULT + PLAYER_ITEM_CHG_0, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_1 + -PLAYER_ITEM_CHG_1, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_2 + PLAYER_ITEM_CHG_4, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_9, // PLAYER_ANIMTYPE_1 -> PLAYER_ANIMTYPE_5 + }, + { + PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_DEFAULT + PLAYER_ITEM_CHG_1, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_1 + PLAYER_ITEM_CHG_0, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_2 + PLAYER_ITEM_CHG_2, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_9, // PLAYER_ANIMTYPE_2 -> PLAYER_ANIMTYPE_5 + }, + { + PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_DEFAULT + -PLAYER_ITEM_CHG_4, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_1 + -PLAYER_ITEM_CHG_2, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_2 + PLAYER_ITEM_CHG_7, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_10, // PLAYER_ANIMTYPE_3 -> PLAYER_ANIMTYPE_5 + }, + { + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_DEFAULT + -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_1 + -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_2 + -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_4 -> PLAYER_ANIMTYPE_5 + }, + { + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_DEFAULT + -PLAYER_ITEM_CHG_5, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_1 + -PLAYER_ITEM_CHG_3, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_2 + -PLAYER_ITEM_CHG_6, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_3 + PLAYER_ITEM_CHG_8, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_4 + PLAYER_ITEM_CHG_11, // PLAYER_ANIMTYPE_5 -> PLAYER_ANIMTYPE_5 + }, }; ExplosiveInfo sPlayerExplosiveInfo[PLAYER_EXPLOSIVE_MAX] = { @@ -3194,7 +3285,7 @@ ExplosiveInfo sPlayerExplosiveInfo[PLAYER_EXPLOSIVE_MAX] = { { ITEM_BOMBCHU, ACTOR_EN_BOM_CHU }, // PLAYER_EXPLOSIVE_BOMBCHU }; -void Player_SpawnExplosive(PlayState* play, Player* this) { +void Player_InitItemAction_SpawnExplosive(PlayState* play, Player* this) { PlayerExplosive explosiveType; ExplosiveInfo* explosiveInfo; Actor* explosiveActor; @@ -3235,8 +3326,7 @@ void Player_SpawnExplosive(PlayState* play, Player* this) { } } -// SpawnHookshot? -void func_8082F7F4(PlayState* play, Player* this) { +void Player_InitItemAction_SpawnHookshot(PlayState* play, Player* this) { ArmsHook* armsHook; this->stateFlags1 |= PLAYER_STATE1_8; @@ -3248,19 +3338,19 @@ void func_8082F7F4(PlayState* play, Player* this) { this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); if (this->heldActor == NULL) { - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); return; } armsHook = (ArmsHook*)this->heldActor; - armsHook->actor.objBankIndex = this->actor.objBankIndex; + armsHook->actor.objectSlot = this->actor.objectSlot; armsHook->unk_208 = this->transformation; } -void func_8082F8A0(PlayState* play, Player* this) { +void Player_InitItemAction_5(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_1000000; } -void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction) { +void Player_InitItemAction(PlayState* play, Player* this, PlayerItemAction itemAction) { this->itemAction = this->heldItemAction = itemAction; this->modelGroup = this->nextModelGroup; @@ -3270,7 +3360,7 @@ void func_8082F8BC(PlayState* play, Player* this, PlayerItemAction itemAction) { this->unk_B0C = 0.0f; this->unk_B28 = 0; - D_8085CB3C[itemAction](play, this); + sPlayerItemActionInitFuncs[itemAction](play, this); Player_SetModelGroup(this, this->modelGroup); } @@ -3476,7 +3566,8 @@ void func_8082FA5C(PlayState* play, Player* this, PlayerMeleeWeaponState meleeWe } s32 func_8082FB68(Player* this) { - if ((this->targetedActor != NULL) && CHECK_FLAG_ALL(this->targetedActor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_4)) { + if ((this->lockOnActor != NULL) && + CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY)) { this->stateFlags3 |= PLAYER_STATE3_80000000; return true; } @@ -3504,7 +3595,7 @@ void func_8082FC60(Player* this) { this->unk_B40 = 0.0f; } -s32 func_8082FC78(Player* this, ItemId item) { +s32 Player_ItemIsInUse(Player* this, ItemId item) { if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == this->itemAction)) { return true; } else { @@ -3512,7 +3603,7 @@ s32 func_8082FC78(Player* this, ItemId item) { } } -s32 func_8082FCC4(Player* this, ItemId item, PlayerItemAction itemAction) { +s32 Player_ItemIsItemAction(Player* this, ItemId item, PlayerItemAction itemAction) { if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == itemAction)) { return true; } else { @@ -3524,7 +3615,7 @@ EquipSlot func_8082FD0C(Player* this, PlayerItemAction itemAction) { s32 btn; for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { - if (func_8082FCC4(this, GET_CUR_FORM_BTN_ITEM(btn), itemAction)) { + if (Player_ItemIsItemAction(this, GET_CUR_FORM_BTN_ITEM(btn), itemAction)) { return btn; } } @@ -3532,7 +3623,7 @@ EquipSlot func_8082FD0C(Player* this, PlayerItemAction itemAction) { return EQUIP_SLOT_NONE; } -u16 D_8085CFA8[] = { +u16 sPlayerItemButtons[] = { BTN_B, BTN_CLEFT, BTN_CDOWN, @@ -3543,8 +3634,8 @@ u16 D_8085CFA8[] = { EquipSlot func_8082FDC4(void) { EquipSlot i; - for (i = 0; i < ARRAY_COUNT(D_8085CFA8); i++) { - if (CHECK_BTN_ALL(sPlayerControlInput->press.button, D_8085CFA8[i])) { + for (i = 0; i < ARRAY_COUNT(sPlayerItemButtons); i++) { + if (CHECK_BTN_ALL(sPlayerControlInput->press.button, sPlayerItemButtons[i])) { break; } } @@ -3552,7 +3643,10 @@ EquipSlot func_8082FDC4(void) { return i; } -void func_8082FE0C(Player* this, PlayState* play) { +/** + * Handles the high level item usage and changing process based on the B and C buttons. + */ +void Player_ProcessItemButtons(Player* this, PlayState* play) { if (this->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000)) { return; } @@ -3578,7 +3672,7 @@ void func_8082FE0C(Player* this, PlayState* play) { if ((maskIdMinusOne < PLAYER_MASK_TRUTH - 1) || (maskIdMinusOne >= PLAYER_MASK_MAX - 1)) { maskIdMinusOne = this->currentMask - 1; } - func_80831990(play, this, Player_MaskIdToItemId(maskIdMinusOne)); + Player_UseItem(play, this, Player_MaskIdToItemId(maskIdMinusOne)); return; } @@ -3592,10 +3686,11 @@ void func_8082FE0C(Player* this, PlayState* play) { if (((this->actor.id == ACTOR_PLAYER) && (this->itemAction >= PLAYER_IA_FISHING_ROD)) && !(((Player_GetHeldBButtonSword(this) == PLAYER_B_SWORD_NONE) || (gSaveContext.jinxTimer == 0)) && - (func_8082FC78(this, (IREG(1) != 0) ? ITEM_FISHING_ROD : Inventory_GetBtnBItem(play)) || - func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_LEFT)) || func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_DOWN)) || - func_8082FC78(this, C_BTN_ITEM(EQUIP_SLOT_C_RIGHT))))) { - func_80831990(play, this, ITEM_NONE); + (Player_ItemIsInUse(this, (IREG(1) != 0) ? ITEM_FISHING_ROD : Inventory_GetBtnBItem(play)) || + Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_LEFT)) || + Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_DOWN)) || + Player_ItemIsInUse(this, C_BTN_ITEM(EQUIP_SLOT_C_RIGHT))))) { + Player_UseItem(play, this, ITEM_NONE); } else { s32 pad; ItemId item; @@ -3606,17 +3701,18 @@ void func_8082FE0C(Player* this, PlayState* play) { ? EQUIP_SLOT_B : i; - item = func_8012364C(play, this, i); + item = Player_GetItemOnButton(play, this, i); + if (item >= ITEM_FD) { - for (i = 0; i < ARRAY_COUNT(D_8085CFA8); i++) { - if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, D_8085CFA8[i])) { + for (i = 0; i < ARRAY_COUNT(sPlayerItemButtons); i++) { + if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, sPlayerItemButtons[i])) { break; } } - item = func_8012364C(play, this, i); + item = Player_GetItemOnButton(play, this, i); if ((item < ITEM_FD) && (Player_ItemToItemAction(this, item) == this->heldItemAction)) { - D_80862B4C = 1; + sPlayerHeldItemButtonIsHeldDown = true; } } else if (item == ITEM_F0) { if (this->blastMaskTimer == 0) { @@ -3640,44 +3736,45 @@ void func_8082FE0C(Player* this, PlayState* play) { } } else { this->heldItemButton = i; - func_80831990(play, this, item); + Player_UseItem(play, this, item); } } } -void func_808302CC(Player* this, PlayState* play) { +void Player_StartChangingHeldItem(Player* this, PlayState* play) { PlayerAnimationHeader* anim; s32 pad[3]; u8 nextModelAnimType; - s32 var_v1; - s8 itemAction = Player_ItemToItemAction(this, this->heldItemId); + s32 itemChangeType; + s8 heldItemAction = Player_ItemToItemAction(this, this->heldItemId); s32 pad3; f32 startFrame; f32 endFrame; f32 frameSpeed; - func_8082F43C(play, this, func_80848808); + Player_SetUpperAction(play, this, Player_UpperAction_ChangeHeldItem); nextModelAnimType = gPlayerModelTypes[this->nextModelGroup].modelAnimType; - var_v1 = D_8085CD00[gPlayerModelTypes[this->modelGroup].modelAnimType][nextModelAnimType]; + itemChangeType = sPlayerItemChangeTypes[gPlayerModelTypes[this->modelGroup].modelAnimType][nextModelAnimType]; - if ((itemAction == PLAYER_IA_ZORA_FINS) || (this->heldItemAction == PLAYER_IA_ZORA_FINS)) { - var_v1 = (itemAction == PLAYER_IA_NONE) ? -14 : 14; - } else if ((itemAction == PLAYER_IA_BOTTLE_EMPTY) || (itemAction == PLAYER_IA_11) || - ((itemAction == PLAYER_IA_NONE) && + if ((heldItemAction == PLAYER_IA_ZORA_FINS) || (this->heldItemAction == PLAYER_IA_ZORA_FINS)) { + itemChangeType = (heldItemAction == PLAYER_IA_NONE) ? -PLAYER_ITEM_CHG_14 : PLAYER_ITEM_CHG_14; + } else if ((heldItemAction == PLAYER_IA_BOTTLE_EMPTY) || (heldItemAction == PLAYER_IA_11) || + ((heldItemAction == PLAYER_IA_NONE) && ((this->heldItemAction == PLAYER_IA_BOTTLE_EMPTY) || (this->heldItemAction == PLAYER_IA_11)))) { - var_v1 = (itemAction == PLAYER_IA_NONE) ? -13 : 13; + itemChangeType = (heldItemAction == PLAYER_IA_NONE) ? -PLAYER_ITEM_CHG_13 : PLAYER_ITEM_CHG_13; } - this->unk_14E = ABS_ALT(var_v1); - anim = D_8085CC88[this->unk_14E].anim; + this->itemChangeType = ABS_ALT(itemChangeType); + anim = sPlayerItemChangeInfo[this->itemChangeType].anim; + if ((anim == &gPlayerAnim_link_normal_fighter2free) && (this->currentShield == PLAYER_SHIELD_NONE)) { anim = &gPlayerAnim_link_normal_free2fighter_free; } endFrame = Animation_GetLastFrame(anim); - if (var_v1 >= 0) { + if (itemChangeType >= 0) { frameSpeed = 1.2f; startFrame = 0.0f; } else { @@ -3686,36 +3783,38 @@ void func_808302CC(Player* this, PlayState* play) { endFrame = 0.0f; } - if (itemAction != PLAYER_IA_NONE) { + if (heldItemAction != PLAYER_IA_NONE) { frameSpeed *= 2.0f; } - PlayerAnimation_Change(play, &this->unk_284, anim, frameSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); - this->stateFlags3 &= ~PLAYER_STATE3_40000000; + PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, frameSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); + + this->stateFlags3 &= ~PLAYER_STATE3_START_CHANGING_HELD_ITEM; } -void func_808304BC(Player* this, PlayState* play) { - if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags3 & PLAYER_STATE3_40000000)) { +void Player_UpdateItems(Player* this, PlayState* play) { + if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM)) { if ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_400000)) { if ((gSaveContext.save.saveInfo.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE)) { - if ((this->csMode == PLAYER_CSMODE_0) && (play->unk_1887C == 0) && (play->activeCamId == CAM_ID_MAIN)) { + if ((this->csMode == PLAYER_CSMODE_NONE) && (play->unk_1887C == 0) && + (play->activeCamId == CAM_ID_MAIN)) { if (!func_8082DA90(play) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] != TIMER_STATE_STOP)) { - func_8082FE0C(this, play); + Player_ProcessItemButtons(this, play); } } } } } - if (this->stateFlags3 & PLAYER_STATE3_40000000) { - func_808302CC(this, play); + if (this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) { + Player_StartChangingHeldItem(this, play); } } // EN_ARROW ammo related? s32 func_808305BC(PlayState* play, Player* this, ItemId* item, ArrowType* typeParam) { - if (this->heldItemAction == PLAYER_IA_NUT) { - *item = ITEM_NUT; + if (this->heldItemAction == PLAYER_IA_DEKU_NUT) { + *item = ITEM_DEKU_NUT; *typeParam = (this->transformation == PLAYER_FORM_DEKU) ? ARROW_TYPE_DEKU_BUBBLE : ARROW_TYPE_SLINGSHOT; } else { *item = ITEM_BOW; @@ -3760,9 +3859,9 @@ u8 sMagicArrowCosts[] = { s32 func_808306F8(Player* this, PlayState* play) { if ((this->heldItemAction >= PLAYER_IA_BOW_FIRE) && (this->heldItemAction <= PLAYER_IA_BOW_LIGHT) && (gSaveContext.magicState != MAGIC_STATE_IDLE)) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } else { - func_8082F43C(play, this, func_80848BF4); + Player_SetUpperAction(play, this, Player_UpperAction_7); this->stateFlags3 |= PLAYER_STATE3_40; this->unk_ACC = 14; @@ -3811,8 +3910,7 @@ s32 func_808306F8(Player* this, PlayState* play) { return false; } -// Take out / put away sounds? -void func_808308DC(PlayState* play, Player* this) { +void Player_FinishItemChange(PlayState* play, Player* this) { s32 isGoronOrDeku = (this->transformation == PLAYER_FORM_GORON) || (this->transformation == PLAYER_FORM_DEKU); if ((this->heldItemAction != PLAYER_IA_NONE) && !isGoronOrDeku) { @@ -3823,7 +3921,7 @@ void func_808308DC(PlayState* play, Player* this) { } } - func_80831990(play, this, this->heldItemId); + Player_UseItem(play, this, this->heldItemId); if (!isGoronOrDeku) { if (Player_SwordFromIA(this, this->heldItemAction) > PLAYER_SWORD_NONE) { @@ -3835,15 +3933,15 @@ void func_808308DC(PlayState* play, Player* this) { } void func_808309CC(PlayState* play, Player* this) { - if (func_80848808 == this->unk_AC4) { - func_808308DC(play, this); + if (Player_UpperAction_ChangeHeldItem == this->upperActionFunc) { + Player_FinishItemChange(play, this); } - func_8082F43C(play, this, D_8085C9F0[this->heldItemAction]); + Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]); this->unk_ACC = 0; this->unk_AA4 = 0; - func_8082DCA0(play, this); - this->stateFlags3 &= ~PLAYER_STATE3_40000000; + Player_DetachHeldActor(play, this); + this->stateFlags3 &= ~PLAYER_STATE3_START_CHANGING_HELD_ITEM; } PlayerAnimationHeader* D_8085CFBC[2] = { @@ -3868,8 +3966,8 @@ PlayerAnimationHeader* D_8085CFDC[2] = { }; PlayerAnimationHeader* func_80830A58(PlayState* play, Player* this) { - func_8082F43C(play, this, func_8084894C); - func_8082DCA0(play, this); + Player_SetUpperAction(play, this, Player_UpperAction_3); + Player_DetachHeldActor(play, this); if (this->unk_B40 < 0.5f) { return D_8085CFBC[Player_IsHoldingTwoHandedWeapon(this)]; @@ -3908,9 +4006,9 @@ s32 func_80830B88(PlayState* play, Player* this) { (this->currentShield != PLAYER_SHIELD_NONE))) && func_8082FBE8(this))) { PlayerAnimationHeader* anim = func_80830A58(play, this); - f32 lastFrame = Animation_GetLastFrame(anim); + f32 endFrame = Animation_GetLastFrame(anim); - PlayerAnimation_Change(play, &this->unk_284, anim, 3.0f / 3.0f, lastFrame, lastFrame, + PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, 3.0f / 3.0f, endFrame, endFrame, ANIMMODE_ONCE, 0.0f); func_80830AE8(this); return true; @@ -3924,32 +4022,34 @@ s32 func_80830B88(PlayState* play, Player* this) { } void func_80830CE8(PlayState* play, Player* this) { - func_8082F43C(play, this, func_80848AB0); + Player_SetUpperAction(play, this, Player_UpperAction_5); if (this->itemAction <= PLAYER_IA_MINUS1) { func_80123C58(this); } - Animation_Reverse(&this->unk_284); + Animation_Reverse(&this->skelAnimeUpper); func_80830B38(this); } -void func_80830D40(PlayState* play, Player* this) { - struct_8085CC88* entry = &D_8085CC88[this->unk_14E]; - f32 frame = entry->frame; +void Player_WaitToFinishItemChange(PlayState* play, Player* this) { + ItemChangeInfo* itemChangeEntry = &sPlayerItemChangeInfo[this->itemChangeType]; + f32 changeFrame = itemChangeEntry->changeFrame; - if (this->unk_284.playSpeed < 0.0f) { - frame -= 1.0f; + if (this->skelAnimeUpper.playSpeed < 0.0f) { + changeFrame -= 1.0f; } - if (PlayerAnimation_OnFrame(&this->unk_284, frame)) { - func_808308DC(play, this); + + if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, changeFrame)) { + Player_FinishItemChange(play, this); } + func_8082FB68(this); } s32 func_80830DF0(Player* this, PlayState* play) { - if (this->stateFlags3 & PLAYER_STATE3_40000000) { - func_808302CC(this, play); + if (this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) { + Player_StartChangingHeldItem(this, play); } else { return false; } @@ -3958,9 +4058,9 @@ s32 func_80830DF0(Player* this, PlayState* play) { s32 func_80830E30(Player* this, PlayState* play) { if ((this->heldItemAction == PLAYER_IA_11) || (this->transformation == PLAYER_FORM_ZORA)) { - func_8082F43C(play, this, func_8084923C); + Player_SetUpperAction(play, this, Player_UpperAction_12); - PlayerAnimation_PlayOnce(play, &this->unk_284, + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, (this->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_LEFT) ? &gPlayerAnim_pz_cutterwaitA : ((this->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_COMBO) @@ -3972,7 +4072,7 @@ s32 func_80830E30(Player* this, PlayState* play) { return false; } - PlayerAnimation_PlayOnce(play, &this->unk_284, + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, (Player_IsHoldingHookshot(this)) ? &gPlayerAnim_link_hook_shot_ready : ((this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_tamahakidf @@ -4000,7 +4100,7 @@ s32 func_80830FD4(PlayState* play) { s32 func_80831010(Player* this, PlayState* play) { if ((this->unk_AA5 == PLAYER_UNKAA5_0) || (this->unk_AA5 == PLAYER_UNKAA5_3)) { - if (func_8082FBE8(this) || (this->targetedActor != NULL) || + if (func_8082FBE8(this) || (this->lockOnActor != NULL) || (Camera_CheckValidMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_BOWARROW) == 0)) { return true; } @@ -4011,7 +4111,7 @@ s32 func_80831010(Player* this, PlayState* play) { s32 func_80831094(Player* this, PlayState* play) { if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_2000000)) { - if ((D_80862B48 != 0) || func_80830F9C(play)) { + if (sPlayerUseHeldItem || func_80830F9C(play)) { if (func_80830E30(this, play)) { return func_80831010(this, play); } @@ -4077,7 +4177,7 @@ void func_8083133C(Player* this) { this->stateFlags1 |= PLAYER_STATE1_20000; if (!(this->skelAnime.moveFlags & ANIM_FLAG_80) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && - (D_80862B20 < 0x2000)) { + (sPlayerShapeYawToTouchedWall < 0x2000)) { this->currentYaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } @@ -4096,8 +4196,8 @@ s32 func_808313A8(PlayState* play, Player* this, Actor* actor) { void func_808313F0(Player* this, PlayState* play) { if (!func_808313A8(play, this, this->heldActor)) { - func_8082F43C(play, this, func_808490B4); - PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_link_normal_carryB_wait); + Player_SetUpperAction(play, this, Player_UpperAction_10); + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait); } } @@ -4121,11 +4221,11 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, if (this->actor.flags & ACTOR_FLAG_20000000) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); this->actor.flags &= ~ACTOR_FLAG_20000000; - } else if ((func_80857BE8 == this->actionFunc) || (func_808561B0 == this->actionFunc)) { + } else if ((Player_Action_96 == this->actionFunc) || (Player_Action_93 == this->actionFunc)) { this->actor.shape.shadowDraw = ActorShadow_DrawFeet; this->actor.shape.shadowScale = this->ageProperties->shadowScale; this->unk_ABC = 0.0f; - if (func_80857BE8 == this->actionFunc) { + if (Player_Action_96 == this->actionFunc) { if (this->stateFlags3 & PLAYER_STATE3_80000) { Magic_Reset(play); } @@ -4138,7 +4238,7 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, } } else if ((this->transformation == PLAYER_FORM_GORON) && (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE)) { - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); } func_800AEF44(Effect_GetByIndex(this->meleeWeaponEffectIndex[2])); @@ -4150,7 +4250,7 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, if (!(arg3 & 1) && !(this->stateFlags1 & PLAYER_STATE1_800)) { func_808309CC(play, this); - PlayerAnimation_PlayLoop(play, &this->unk_284, func_8082ED20(this)); + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, func_8082ED20(this)); this->stateFlags1 &= ~PLAYER_STATE1_400000; } @@ -4166,8 +4266,8 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, PLAYER_STATE3_8000 | PLAYER_STATE3_10000 | PLAYER_STATE3_20000 | PLAYER_STATE3_40000 | PLAYER_STATE3_80000 | PLAYER_STATE3_200000 | PLAYER_STATE3_1000000 | PLAYER_STATE3_20000000); - this->unk_AE7 = 0; - this->unk_AE8 = 0; + this->actionVar1 = 0; + this->actionVar2 = 0; this->unk_AA4 = 0; this->unk_B86[0] = 0; this->unk_B86[1] = 0; @@ -4192,7 +4292,7 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, return true; } -void func_8083172C(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3) { +void Player_SetAction_PreserveMoveFlags(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3) { s32 moveFlags = this->skelAnime.moveFlags; this->skelAnime.moveFlags = 0; @@ -4200,7 +4300,7 @@ void func_8083172C(PlayState* play, Player* this, PlayerActionFunc actionFunc, s this->skelAnime.moveFlags = moveFlags; } -void func_80831760(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3) { +void Player_SetAction_PreserveItemAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3) { if (this->itemAction > PLAYER_IA_MINUS1) { PlayerItemAction heldItemAction = this->itemAction; @@ -4212,7 +4312,7 @@ void func_80831760(PlayState* play, Player* this, PlayerActionFunc actionFunc, s } } -void func_808317C4(Player* this) { +void Player_DestroyHookshot(Player* this) { if (Player_IsHoldingHookshot(this)) { if (this->heldActor != NULL) { Actor_Kill(this->heldActor); @@ -4244,21 +4344,20 @@ void func_808318C0(PlayState* play) { play->actorCtx.lensActive = true; } - play_sound(play->actorCtx.lensActive ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); + Audio_PlaySfx(play->actorCtx.lensActive ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } } // Toggle Lens from a button press void func_80831944(PlayState* play, Player* this) { - if (func_8012364C(play, this, func_8082FDC4()) == ITEM_LENS) { + if (Player_GetItemOnButton(play, this, func_8082FDC4()) == ITEM_LENS_OF_TRUTH) { func_808318C0(play); } } -// Proposed name: Player_UseItem -void func_80831990(PlayState* play, Player* this, ItemId item) { +void Player_UseItem(PlayState* play, Player* this, ItemId item) { PlayerItemAction itemAction = Player_ItemToItemAction(this, item); if ((((this->heldItemAction == this->itemAction) && @@ -4280,8 +4379,8 @@ void func_80831990(PlayState* play, Player* this, ItemId item) { (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK_REQUESTED) && (itemAction != PLAYER_IA_NONE)) || (itemAction == PLAYER_IA_OCARINA) || ((itemAction > PLAYER_IA_BOTTLE_MIN) && itemAction < PLAYER_IA_MASK_MIN) || - ((itemAction == PLAYER_IA_PICTO_BOX) && (this->talkActor != NULL) && - (this->exchangeItemId > PLAYER_IA_NONE))) { + ((itemAction == PLAYER_IA_PICTOGRAPH_BOX) && (this->talkActor != NULL) && + (this->exchangeItemAction > PLAYER_IA_NONE))) { if (var_v1) { PlayerTransformation playerForm = (itemAction < PLAYER_IA_MASK_FIERCE_DEITY) ? PLAYER_FORM_HUMAN @@ -4292,42 +4391,49 @@ void func_80831990(PlayState* play, Player* this, ItemId item) { (gSaveContext.save.saveInfo.playerData.magic == 0))) || (!(this->stateFlags1 & PLAYER_STATE1_8000000) && BgCheck_EntityCheckCeiling(&play->colCtx, &sp54, &this->actor.world.pos, - sPlayerAgeProperties[playerForm].unk_00, &sp5C, &sp58, &this->actor))) { - play_sound(NA_SE_SY_ERROR); + sPlayerAgeProperties[playerForm].ceilingCheckHeight, &sp5C, &sp58, + &this->actor))) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } if ((itemAction == PLAYER_IA_MAGIC_BEANS) && (AMMO(ITEM_MAGIC_BEANS) == 0)) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } else { this->itemAction = itemAction; this->unk_AA5 = PLAYER_UNKAA5_5; } - } else if (((itemAction == PLAYER_IA_STICK) && (AMMO(ITEM_STICK) == 0)) || + } else if (((itemAction == PLAYER_IA_DEKU_STICK) && (AMMO(ITEM_DEKU_STICK) == 0)) || (((play->unk_1887D != 0) || (play->unk_1887E != 0)) && (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].length >= 5)) || ((play->unk_1887D == 0) && (play->unk_1887E == 0) && ((explosiveType = Player_ExplosiveFromIA(this, itemAction)) > PLAYER_EXPLOSIVE_NONE) && ((AMMO(sPlayerExplosiveInfo[explosiveType].itemId) == 0) || (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].length >= 3)))) { - play_sound(NA_SE_SY_ERROR); - } else if (itemAction == PLAYER_IA_LENS) { + // Prevent some items from being used if player is out of ammo. + // Also prevent explosives from being used if too many are active + Audio_PlaySfx(NA_SE_SY_ERROR); + } else if (itemAction == PLAYER_IA_LENS_OF_TRUTH) { + // Handle Lens of Truth func_808318C0(play); - } else if (itemAction == PLAYER_IA_PICTO_BOX) { + } else if (itemAction == PLAYER_IA_PICTOGRAPH_BOX) { + // Handle Pictograph Box if (!func_80831814(this, play, PLAYER_UNKAA5_2)) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } - } else if ((itemAction == PLAYER_IA_NUT) && + } else if ((itemAction == PLAYER_IA_DEKU_NUT) && ((this->transformation != PLAYER_FORM_DEKU) || (this->heldItemButton != 0))) { - if (AMMO(ITEM_NUT) != 0) { + // Handle Deku Nuts + if (AMMO(ITEM_DEKU_NUT) != 0) { func_8083A658(play, this); } else { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } } else if ((this->transformation == PLAYER_FORM_HUMAN) && (itemAction >= PLAYER_IA_MASK_MIN) && (itemAction < PLAYER_IA_MASK_GIANT)) { PlayerMask maskId = GET_MASK_FROM_IA(itemAction); + // Handle wearable masks this->prevMask = this->currentMask; if (maskId == this->currentMask) { this->currentMask = PLAYER_MASK_NONE; @@ -4341,26 +4447,30 @@ void func_80831990(PlayState* play, Player* this, ItemId item) { ((this->heldActor == NULL) && (Player_ExplosiveFromIA(this, itemAction) > PLAYER_EXPLOSIVE_NONE))) { u8 nextAnimType; + // Handle using a new held item this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); nextAnimType = gPlayerModelTypes[this->nextModelGroup].modelAnimType; var_v1 = ((this->transformation != PLAYER_FORM_GORON) || (itemAction == PLAYER_IA_POWDER_KEG)); if (var_v1 && (this->heldItemAction >= 0) && (item != this->heldItemId) && - (D_8085CD00[gPlayerModelTypes[this->modelGroup].modelAnimType][nextAnimType] != 0)) { + (sPlayerItemChangeTypes[gPlayerModelTypes[this->modelGroup].modelAnimType][nextAnimType] != + PLAYER_ITEM_CHG_0)) { + // Start the held item change process this->heldItemId = item; - this->stateFlags3 |= PLAYER_STATE3_40000000; + this->stateFlags3 |= PLAYER_STATE3_START_CHANGING_HELD_ITEM; } else { - func_808317C4(this); - func_8082DCA0(play, this); - func_8082F470(play, this, itemAction); + // Init new held item for use + Player_DestroyHookshot(this); + Player_DetachHeldActor(play, this); + Player_InitItemActionWithAnim(play, this, itemAction); if (!var_v1) { - D_80862B48 = 1; - D_80862B4C = 1; + sPlayerUseHeldItem = true; + sPlayerHeldItemButtonIsHeldDown = true; } } } else { - D_80862B48 = 1; - D_80862B4C = 1; + sPlayerUseHeldItem = true; + sPlayerHeldItemButtonIsHeldDown = true; } } } @@ -4369,7 +4479,7 @@ void func_80831F34(PlayState* play, Player* this, PlayerAnimationHeader* anim) { s32 sp24 = func_801242B4(this); func_8082DE50(play, this); - Player_SetAction(play, this, sp24 ? func_80851BD4 : func_8084BFDC, 0); + Player_SetAction(play, this, sp24 ? Player_Action_62 : Player_Action_24, 0); Player_AnimationPlayOnce(play, this, anim); if (anim == &gPlayerAnim_link_derth_rebirth) { @@ -4390,7 +4500,7 @@ void func_80831F34(PlayState* play, Player* this, PlayerAnimationHeader* anim) { if (Inventory_ConsumeFairy(play)) { play->gameOverCtx.state = GAMEOVER_REVIVE_START; - this->unk_AE7 = 1; + this->actionVar1 = 1; } else { play->gameOverCtx.state = GAMEOVER_DEATH_START; func_801A41F8(0); @@ -4403,22 +4513,22 @@ void func_80831F34(PlayState* play, Player* this, PlayerAnimationHeader* anim) { } } -s32 func_80832090(Player* this) { - return (!(func_8084D770 == this->actionFunc) || - (((this->stateFlags3 & PLAYER_STATE3_40000000)) && +s32 Player_CanUpdateItems(Player* this) { + return (!(Player_Action_34 == this->actionFunc) || + ((this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) && ((this->heldItemId == ITEM_FC) || (this->heldItemId == ITEM_NONE)))) && - (!(func_80848808 == this->unk_AC4) || + (!(Player_UpperAction_ChangeHeldItem == this->upperActionFunc) || Player_ItemToItemAction(this, this->heldItemId) == this->heldItemAction); } // Whether action is Bremen marching or Kamaro dancing s32 func_8083213C(Player* this) { - return (func_8084AC84 == this->actionFunc) || (func_8084AEEC == this->actionFunc); + return (Player_Action_11 == this->actionFunc) || (Player_Action_12 == this->actionFunc); } -s32 func_8083216C(Player* this, PlayState* play) { +s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_800000) && (this->actor.parent != NULL) && Player_IsHoldingHookshot(this)) { - Player_SetAction(play, this, func_80855E08, 1); + Player_SetAction(play, this, Player_Action_92, 1); this->stateFlags3 |= PLAYER_STATE3_80; Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); func_8082E920(play, this, (ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80)); @@ -4430,34 +4540,34 @@ s32 func_8083216C(Player* this, PlayState* play) { return true; } - if (func_80832090(this)) { - func_808304BC(this, play); - if (func_80852B28 == this->actionFunc) { + if (Player_CanUpdateItems(this)) { + Player_UpdateItems(this, play); + if (Player_Action_64 == this->actionFunc) { return true; } } - if (!this->unk_AC4(this, play)) { + if (!this->upperActionFunc(this, play)) { return false; } - if (this->unk_AC8 != 0.0f) { + if (this->skelAnimeUpperBlendWeight != 0.0f) { if ((func_8082ED94(this) == 0) || (this->linearVelocity != 0.0f)) { - AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->unk_284.jointTable, - this->skelAnime.jointTable, D_8085B9F0); + AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnimeUpper.jointTable, + this->skelAnime.jointTable, sPlayerUpperBodyLimbCopyMap); } if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->skelAnime.moveFlags & ANIM_FLAG_8)) { - Math_StepToF(&this->unk_AC8, 0.0f, 0.25f); + Math_StepToF(&this->skelAnimeUpperBlendWeight, 0.0f, 0.25f); AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable, 1.0f - this->unk_AC8); + this->skelAnimeUpper.jointTable, 1.0f - this->skelAnimeUpperBlendWeight); } } else if ((func_8082ED94(this) == 0) || (this->linearVelocity != 0.0f) || (this->skelAnime.moveFlags & ANIM_FLAG_8)) { AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable, D_8085B9F0); + this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap); } else { AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable); + this->skelAnimeUpper.jointTable); } return true; @@ -4499,7 +4609,7 @@ s32 func_8083249C(Player* this) { s32 func_808324EC(PlayState* play, Player* this, PlayerFuncD58 arg2, s32 csId) { this->unk_D58 = arg2; this->csId = csId; - Player_SetAction(play, this, func_8084D770, 0); + Player_SetAction(play, this, Player_Action_34, 0); func_8083249C(this); this->stateFlags2 |= PLAYER_STATE2_40; return func_8082DE14(play, this); @@ -4514,12 +4624,12 @@ void func_80832578(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_20 | PLAYER_STATE2_40))) { - Actor* targetedActor = this->targetedActor; + Actor* lockOnActor = this->lockOnActor; - if ((targetedActor != NULL) && ((play->actorCtx.targetContext.unk4B != 0) || (this != GET_PLAYER(play))) && - (targetedActor->id != ACTOR_OBJ_NOZOKI)) { + if ((lockOnActor != NULL) && ((play->actorCtx.targetCtx.rotZTick != 0) || (this != GET_PLAYER(play))) && + (lockOnActor->id != ACTOR_OBJ_NOZOKI)) { Math_ScaledStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &targetedActor->focus.pos), 0xFA0); + Math_Vec3f_Yaw(&this->actor.world.pos, &lockOnActor->focus.pos), 0xFA0); } else if ((this->stateFlags1 & PLAYER_STATE1_20000) && !(this->stateFlags2 & (PLAYER_STATE2_20 | PLAYER_STATE2_40))) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0xFA0); @@ -4577,7 +4687,7 @@ s16 func_80832754(Player* this, s32 arg1) { } void func_80832888(Player* this, PlayState* play) { - s32 var_v1 = 0; + s32 ignoreLeash = false; Actor* var_v1_2; s32 heldZ = CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_Z); s32 temp_v0_3; @@ -4587,7 +4697,7 @@ void func_80832888(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_40000000; } - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_0) || + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE) || (this->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) || (this->stateFlags3 & PLAYER_STATE3_80)) { this->unk_738 = 0; } else if (heldZ || (this->stateFlags2 & PLAYER_STATE2_2000) || (this->unk_A78 != NULL)) { @@ -4603,7 +4713,7 @@ void func_80832888(Player* this, PlayState* play) { } if (this->unk_738 > 5) { - var_v1 = 1; + ignoreLeash = true; } temp_v0_3 = func_8082DAFC(play); @@ -4612,53 +4722,52 @@ void func_80832888(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_2000000) && ((this->heldItemAction != PLAYER_IA_FISHING_ROD) || (this->unk_B28 == 0)) && CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_Z)) { - var_v1_2 = (this == GET_PLAYER(play)) ? play->actorCtx.targetContext.arrowPointedActor - : &GET_PLAYER(play)->actor; + var_v1_2 = (this == GET_PLAYER(play)) ? play->actorCtx.targetCtx.fairyActor : &GET_PLAYER(play)->actor; var_a1 = (gSaveContext.options.zTargetSetting != 0) || (this != GET_PLAYER(play)); this->stateFlags1 |= PLAYER_STATE1_8000; if ((this->currentMask != PLAYER_MASK_GIANT) && (var_v1_2 != NULL) && !(var_v1_2->flags & ACTOR_FLAG_CANT_LOCK_ON) && !(this->stateFlags3 & (PLAYER_STATE3_200 | PLAYER_STATE3_2000))) { - if ((var_v1_2 == this->targetedActor) && (this == GET_PLAYER(play))) { - var_v1_2 = play->actorCtx.targetContext.unk_94; + if ((var_v1_2 == this->lockOnActor) && (this == GET_PLAYER(play))) { + var_v1_2 = play->actorCtx.targetCtx.arrowPointedActor; } if ((var_v1_2 != NULL) && - (((var_v1_2 != this->targetedActor)) || (var_v1_2->flags & ACTOR_FLAG_80000))) { + (((var_v1_2 != this->lockOnActor)) || (var_v1_2->flags & ACTOR_FLAG_80000))) { var_v1_2->flags &= ~ACTOR_FLAG_80000; if (!var_a1) { this->stateFlags2 |= PLAYER_STATE2_2000; } - this->targetedActor = var_v1_2; + this->lockOnActor = var_v1_2; this->unk_738 = 0xF; this->stateFlags2 &= ~(PLAYER_STATE2_2 | PLAYER_STATE2_200000); } else if (!var_a1) { - func_80123DA4(this); + Player_Untarget(this); } this->stateFlags1 &= ~PLAYER_STATE1_40000000; } else if (!(this->stateFlags1 & (PLAYER_STATE1_20000 | PLAYER_STATE1_40000000)) && - (func_808573A4 != this->actionFunc)) { + (Player_Action_95 != this->actionFunc)) { func_8083133C(this); } } - if (this->targetedActor != NULL) { - if ((this == GET_PLAYER(play)) && (this->targetedActor != this->unk_A78) && - func_800B83F8(this->targetedActor, this, var_v1)) { - func_80123DA4(this); + if (this->lockOnActor != NULL) { + if ((this == GET_PLAYER(play)) && (this->lockOnActor != this->unk_A78) && + Target_OutsideLeashRange(this->lockOnActor, this, ignoreLeash)) { + Player_Untarget(this); this->stateFlags1 |= PLAYER_STATE1_40000000; - } else if (this->targetedActor != NULL) { - this->targetedActor->targetPriority = 0x28; + } else if (this->lockOnActor != NULL) { + this->lockOnActor->targetPriority = 0x28; } } else if (this->unk_A78 != NULL) { - this->targetedActor = this->unk_A78; + this->lockOnActor = this->unk_A78; } } - if ((this->targetedActor != NULL) && !(this->stateFlags3 & (PLAYER_STATE3_200 | PLAYER_STATE3_2000))) { + if ((this->lockOnActor != NULL) && !(this->stateFlags3 & (PLAYER_STATE3_200 | PLAYER_STATE3_2000))) { this->stateFlags1 &= ~(PLAYER_STATE1_10000 | PLAYER_STATE1_20000); if ((this->stateFlags1 & PLAYER_STATE1_800) || - !CHECK_FLAG_ALL(this->targetedActor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_4)) { + !CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY)) { this->stateFlags1 |= PLAYER_STATE1_10000; } } else if (this->stateFlags1 & PLAYER_STATE1_20000) { @@ -4671,45 +4780,87 @@ void func_80832888(Player* this, PlayState* play) { } } -s32 func_80832CAC(PlayState* play, Player* this, f32* arg2, s16* outYaw, f32 arg4) { - f32 temp_fv1_2; +/** + * These defines exist to simplify the variable used to toggle the different speed modes. + * While the `speedMode` variable is a float and can contain a non-boolean value, + * `Player_CalcSpeedAndYawFromControlStick` never actually uses the value for anything. + * It simply checks if the value is non-zero to toggle the "curved" mode. + * In practice, 0.0f or 0.018f are the only values passed to this function. + * + * It's clear that this value was intended to mean something in the curved mode calculation at + * some point in development, but was either never implemented or removed. + * + * To see the difference between linear and curved mode, with interactive toggles for + * speed cap and floor pitch, see the following desmos graph: https://www.desmos.com/calculator/hri7dcws4c + */ + +// Linear mode is a straight line, increasing target speed at a steady rate relative to the control stick magnitude +#define SPEED_MODE_LINEAR 0.0f + +// Curved mode drops any input below 20 units of magnitude, resulting in zero for target speed. +// Beyond 20 units, a gradual curve slowly moves up until around the 40 unit mark +// when target speed ramps up very quickly. +#define SPEED_MODE_CURVED 0.018f + +/** + * Calculates target speed and yaw based on input from the control stick. + * See `Player_GetMovementSpeedAndYaw` for detailed argument descriptions. + * + * @return true if the control stick has any magnitude, false otherwise. + */ +s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* outSpeedTarget, s16* outYawTarget, + f32 speedMode) { + f32 temp; if ((this->unk_AA5 != PLAYER_UNKAA5_0) || func_8082DA90(play) || (this->stateFlags1 & PLAYER_STATE1_1)) { - *arg2 = 0.0f; - *outYaw = this->actor.shape.rot.y; + *outSpeedTarget = 0.0f; + *outYawTarget = this->actor.shape.rot.y; } else { - *arg2 = D_80862AFC; - *outYaw = D_80862B00; - if (arg4 != 0.0f) { - *arg2 -= 20.0f; - if (*arg2 < 0.0f) { - *arg2 = 0.0f; + *outSpeedTarget = sPlayerControlStickMagnitude; + *outYawTarget = sPlayerControlStickAngle; + + // The value of `speedMode` is never actually used. It only toggles this condition. + // See the definition of `SPEED_MODE_LINEAR` and `SPEED_MODE_CURVED` for more information. + if (speedMode != SPEED_MODE_LINEAR) { + *outSpeedTarget -= 20.0f; + + if (*outSpeedTarget < 0.0f) { + // If control stick magnitude is below 20, return zero speed. + *outSpeedTarget = 0.0f; } else { - temp_fv1_2 = 1.0f - Math_CosS(*arg2 * 450.0f); - *arg2 = (SQ(temp_fv1_2) * 30.0f) + 7.0f; + // Cosine of the control stick magnitude isn't exactly meaningful, but + // it happens to give a desirable curve for grounded movement speed relative + // to control stick magnitude. + temp = 1.0f - Math_CosS(*outSpeedTarget * 450.0f); + *outSpeedTarget = (SQ(temp) * 30.0f) + 7.0f; } } else { - *arg2 *= 0.8f; + // Speed increases linearly relative to control stick magnitude + *outSpeedTarget *= 0.8f; } if (this->transformation == PLAYER_FORM_FIERCE_DEITY) { - *arg2 *= 1.5f; + *outSpeedTarget *= 1.5f; } - if (D_80862AFC != 0.0f) { - f32 temp_fv0 = Math_SinS(this->unk_B6C); - f32 var_fa0 = this->unk_B50; + if (sPlayerControlStickMagnitude != 0.0f) { + f32 floorPitchInfluence = Math_SinS(this->floorPitch); + f32 speedCap = this->unk_B50; f32 var_fa1; if (this->unk_AB8 != 0.0f) { - var_fa1 = (this->targetedActor != NULL) ? 0.002f : 0.008f; + var_fa1 = (this->lockOnActor != NULL) ? 0.002f : 0.008f; - var_fa0 -= this->unk_AB8 * var_fa1; - var_fa0 = CLAMP_MIN(var_fa0, 2.0f); + speedCap -= this->unk_AB8 * var_fa1; + speedCap = CLAMP_MIN(speedCap, 2.0f); } - *arg2 = (*arg2 * 0.14f) - (8.0f * temp_fv0 * temp_fv0); - *arg2 = CLAMP(*arg2, 0.0f, var_fa0); - if (temp_fv0) {} //! FAKE + + *outSpeedTarget = (*outSpeedTarget * 0.14f) - (8.0f * floorPitchInfluence * floorPitchInfluence); + *outSpeedTarget = CLAMP(*outSpeedTarget, 0.0f, speedCap); + + //! FAKE + if (floorPitchInfluence) {} + return true; } } @@ -4721,54 +4872,234 @@ s32 func_80832F24(Player* this) { return Math_StepToF(&this->linearVelocity, 0.0f, REG(43) / 100.0f); } -s32 func_80832F78(Player* this, f32* arg1, s16* outYaw, f32 arg3, PlayState* play) { - if (!func_80832CAC(play, this, arg1, outYaw, arg3)) { - *outYaw = this->actor.shape.rot.y; +/** + * Gets target speed and yaw values for movement based on control stick input. + * Control stick magnitude and angle are processed in `Player_CalcSpeedAndYawFromControlStick` to get target values. + * Additionally, this function does extra processing on the target yaw value if the control stick is neutral. + * + * @param outSpeedTarget a pointer to the variable that will hold the resulting target speed value + * @param outYawTarget a pointer to the variable that will hold the resulting target yaw value + * @param speedMode toggles between a linear and curved mode for the speed value + * + * @see Player_CalcSpeedAndYawFromControlStick for more information on the linear vs curved speed mode. + * + * @return true if the control stick has any magnitude, false otherwise. + */ +s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode, + PlayState* play) { + if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { + *outYawTarget = this->actor.shape.rot.y; - if (this->targetedActor != NULL) { - if ((play->actorCtx.targetContext.unk4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_40)) { - *outYaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->targetedActor->focus.pos); + if (this->lockOnActor != NULL) { + if ((play->actorCtx.targetCtx.rotZTick != 0) && !(this->stateFlags2 & PLAYER_STATE2_40)) { + *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->lockOnActor->focus.pos); } } else if (func_80123434(this)) { - *outYaw = this->targetYaw; + *outYawTarget = this->targetYaw; } return false; } - *outYaw += Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]); + *outYawTarget += Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); return true; } +typedef enum ActionChangeIndex { + /* 0x0 */ PLAYER_ACTION_CHG_0, + /* 0x1 */ PLAYER_ACTION_CHG_1, + /* 0x2 */ PLAYER_ACTION_CHG_2, + /* 0x3 */ PLAYER_ACTION_CHG_3, + /* 0x4 */ PLAYER_ACTION_CHG_4, + /* 0x5 */ PLAYER_ACTION_CHG_5, + /* 0x6 */ PLAYER_ACTION_CHG_6, + /* 0x7 */ PLAYER_ACTION_CHG_7, + /* 0x8 */ PLAYER_ACTION_CHG_8, + /* 0x9 */ PLAYER_ACTION_CHG_9, + /* 0xA */ PLAYER_ACTION_CHG_10, + /* 0xB */ PLAYER_ACTION_CHG_11, + /* 0xC */ PLAYER_ACTION_CHG_12, + /* 0xD */ PLAYER_ACTION_CHG_13, + /* 0xE */ PLAYER_ACTION_CHG_14, + /* 0xF */ PLAYER_ACTION_CHG_MAX +} ActionChangeIndex; + /** - * The values of following arrays are used as indices for the `D_8085D054` array. + * The values of following arrays are used as indices for the `sPlayerActionChangeFuncs` array. * Each index correspond to a function which will be called sequentially until any of them return `true`. * Negative marks the end of the array. */ -s8 D_8085CFE4[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -s8 D_8085CFEC[] = { 13, 1, 2, 5, 3, 4, 9, 10, 11, 7, 8, -6 }; -s8 D_8085CFF8[] = { 13, 1, 2, 3, 4, 9, 10, 11, 8, 7, -6 }; -s8 D_8085D004[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -s8 D_8085D00C[] = { 13, 2, 4, 9, 10, 11, 12, 8, -7 }; -s8 D_8085D018[] = { -7 }; -s8 D_8085D01C[] = { 0, 11, 1, 2, 3, 5, 4, 9, 8, 7, -6 }; -s8 D_8085D028[] = { 0, 11, 1, 2, 3, 12, 5, 4, 9, 8, 7, -6 }; -s8 D_8085D034[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 }; -s8 D_8085D044[] = { 10, 8, -7 }; -s8 D_8085D048[] = { 0, 12, 5, 4, -14 }; -s8 D_8085D050[] = { 13, 2, -4 }; - -s32 (*D_8085D054[])(Player*, PlayState*) = { - func_80839518, func_808365DC, func_8083D23C, func_8083CCB4, func_808391D8, - func_8083DFC4, func_8083A114, func_80848570, func_8083A580, func_8083D78C, - func_80839B18, func_8083A274, func_80834DFC, func_80838A90, func_8083A0CC, +s8 sPlayerActionChangeList1[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_2, + /* 2 */ PLAYER_ACTION_CHG_4, + /* 3 */ PLAYER_ACTION_CHG_9, + /* 4 */ PLAYER_ACTION_CHG_10, + /* 5 */ PLAYER_ACTION_CHG_11, + /* 6 */ PLAYER_ACTION_CHG_8, + /* 7 */ -PLAYER_ACTION_CHG_7, }; -s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) { +s8 sPlayerActionChangeList2[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_1, + /* 2 */ PLAYER_ACTION_CHG_2, + /* 3 */ PLAYER_ACTION_CHG_5, + /* 4 */ PLAYER_ACTION_CHG_3, + /* 5 */ PLAYER_ACTION_CHG_4, + /* 6 */ PLAYER_ACTION_CHG_9, + /* 7 */ PLAYER_ACTION_CHG_10, + /* 8 */ PLAYER_ACTION_CHG_11, + /* 9 */ PLAYER_ACTION_CHG_7, + /* 10 */ PLAYER_ACTION_CHG_8, + /* 11 */ -PLAYER_ACTION_CHG_6, +}; + +s8 sPlayerActionChangeList3[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_1, + /* 2 */ PLAYER_ACTION_CHG_2, + /* 3 */ PLAYER_ACTION_CHG_3, + /* 4 */ PLAYER_ACTION_CHG_4, + /* 5 */ PLAYER_ACTION_CHG_9, + /* 6 */ PLAYER_ACTION_CHG_10, + /* 7 */ PLAYER_ACTION_CHG_11, + /* 8 */ PLAYER_ACTION_CHG_8, + /* 9 */ PLAYER_ACTION_CHG_7, + /* 10 */ -PLAYER_ACTION_CHG_6, +}; + +s8 sPlayerActionChangeList4[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_2, + /* 2 */ PLAYER_ACTION_CHG_4, + /* 3 */ PLAYER_ACTION_CHG_9, + /* 4 */ PLAYER_ACTION_CHG_10, + /* 5 */ PLAYER_ACTION_CHG_11, + /* 6 */ PLAYER_ACTION_CHG_8, + /* 7 */ -PLAYER_ACTION_CHG_7, +}; + +s8 sPlayerActionChangeList5[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_2, + /* 2 */ PLAYER_ACTION_CHG_4, + /* 3 */ PLAYER_ACTION_CHG_9, + /* 4 */ PLAYER_ACTION_CHG_10, + /* 5 */ PLAYER_ACTION_CHG_11, + /* 6 */ PLAYER_ACTION_CHG_12, + /* 7 */ PLAYER_ACTION_CHG_8, + /* 8 */ -PLAYER_ACTION_CHG_7, +}; + +s8 sPlayerActionChangeList6[] = { + /* 0 */ -PLAYER_ACTION_CHG_7, +}; + +s8 sPlayerActionChangeList7[] = { + /* 0 */ PLAYER_ACTION_CHG_0, + /* 1 */ PLAYER_ACTION_CHG_11, + /* 2 */ PLAYER_ACTION_CHG_1, + /* 3 */ PLAYER_ACTION_CHG_2, + /* 4 */ PLAYER_ACTION_CHG_3, + /* 5 */ PLAYER_ACTION_CHG_5, + /* 6 */ PLAYER_ACTION_CHG_4, + /* 7 */ PLAYER_ACTION_CHG_9, + /* 8 */ PLAYER_ACTION_CHG_8, + /* 9 */ PLAYER_ACTION_CHG_7, + /* 10 */ -PLAYER_ACTION_CHG_6, +}; + +s8 sPlayerActionChangeList8[] = { + /* 0 */ PLAYER_ACTION_CHG_0, + /* 1 */ PLAYER_ACTION_CHG_11, + /* 2 */ PLAYER_ACTION_CHG_1, + /* 3 */ PLAYER_ACTION_CHG_2, + /* 4 */ PLAYER_ACTION_CHG_3, + /* 5 */ PLAYER_ACTION_CHG_12, + /* 6 */ PLAYER_ACTION_CHG_5, + /* 7 */ PLAYER_ACTION_CHG_4, + /* 8 */ PLAYER_ACTION_CHG_9, + /* 9 */ PLAYER_ACTION_CHG_8, + /* 10 */ PLAYER_ACTION_CHG_7, + /* 11 */ -PLAYER_ACTION_CHG_6, +}; + +s8 sPlayerActionChangeList9[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_1, + /* 2 */ PLAYER_ACTION_CHG_2, + /* 3 */ PLAYER_ACTION_CHG_3, + /* 4 */ PLAYER_ACTION_CHG_12, + /* 5 */ PLAYER_ACTION_CHG_5, + /* 6 */ PLAYER_ACTION_CHG_4, + /* 7 */ PLAYER_ACTION_CHG_9, + /* 8 */ PLAYER_ACTION_CHG_10, + /* 9 */ PLAYER_ACTION_CHG_11, + /* 10 */ PLAYER_ACTION_CHG_8, + /* 11 */ PLAYER_ACTION_CHG_7, + /* 12 */ -PLAYER_ACTION_CHG_6, +}; + +s8 sPlayerActionChangeList10[] = { + /* 0 */ PLAYER_ACTION_CHG_10, + /* 1 */ PLAYER_ACTION_CHG_8, + /* 2 */ -PLAYER_ACTION_CHG_7, +}; + +s8 sPlayerActionChangeList11[] = { + /* 0 */ PLAYER_ACTION_CHG_0, + /* 1 */ PLAYER_ACTION_CHG_12, + /* 2 */ PLAYER_ACTION_CHG_5, + /* 3 */ PLAYER_ACTION_CHG_4, + /* 4 */ -PLAYER_ACTION_CHG_14, +}; + +s8 sPlayerActionChangeList12[] = { + /* 0 */ PLAYER_ACTION_CHG_13, + /* 1 */ PLAYER_ACTION_CHG_2, + /* 2 */ -PLAYER_ACTION_CHG_4, +}; + +s32 (*sPlayerActionChangeFuncs[PLAYER_ACTION_CHG_MAX])(Player*, PlayState*) = { + Player_ActionChange_0, // PLAYER_ACTION_CHG_0 + Player_ActionChange_1, // PLAYER_ACTION_CHG_1 + Player_ActionChange_2, // PLAYER_ACTION_CHG_2 + Player_ActionChange_3, // PLAYER_ACTION_CHG_3 + Player_ActionChange_4, // PLAYER_ACTION_CHG_4 + Player_ActionChange_5, // PLAYER_ACTION_CHG_5 + Player_ActionChange_6, // PLAYER_ACTION_CHG_6 + Player_ActionChange_7, // PLAYER_ACTION_CHG_7 + Player_ActionChange_8, // PLAYER_ACTION_CHG_8 + Player_ActionChange_9, // PLAYER_ACTION_CHG_9 + Player_ActionChange_10, // PLAYER_ACTION_CHG_10 + Player_ActionChange_11, // PLAYER_ACTION_CHG_11 + Player_ActionChange_12, // PLAYER_ACTION_CHG_12 + Player_ActionChange_13, // PLAYER_ACTION_CHG_13 + Player_ActionChange_14, // PLAYER_ACTION_CHG_14 +}; + +/** + * This function processes "Action Change Lists", which run various functions that + * check if it is appropriate to change to a new action. + * + * Action Change Lists are a list of indices for the `sPlayerActionChangeFuncs` array. + * The functions are ran in order until one of them returns true, or the end of the list is reached. + * An Action Change index having a negative value indicates that it is the last member in the list. + * + * Because these lists are processed sequentially, the order of the indices in the list determines its priority. + * + * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Change List + * is processed. This allows for Upper Action functions to run. + * + * @return true if a new action has been chosen + * + */ +s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeList, s32 updateUpperBody) { if (!(this->stateFlags1 & (PLAYER_STATE1_1 | PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) && !func_8082DA90(play)) { - if (arg3) { - D_80862B04 = func_8083216C(this, play); - if (func_80852B28 == this->actionFunc) { + if (updateUpperBody) { + D_80862B04 = Player_UpdateUpperBody(this, play); + if (Player_Action_64 == this->actionFunc) { return true; } } @@ -4778,15 +5109,18 @@ s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) { return true; } - if (!(this->stateFlags3 & PLAYER_STATE3_40000000) && (func_80848808 != this->unk_AC4)) { - while (*arg2 >= 0) { - if (D_8085D054[*arg2](this, play)) { + if (!(this->stateFlags3 & PLAYER_STATE3_START_CHANGING_HELD_ITEM) && + (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) { + // Process all entries in the Action Change List with a positive index + while (*actionChangeList >= 0) { + if (sPlayerActionChangeFuncs[*actionChangeList](this, play)) { return true; } - arg2++; + actionChangeList++; } - if (D_8085D054[-*arg2](this, play)) { + // Try the last entry in the list. Negate the index to make it positive again. + if (sPlayerActionChangeFuncs[-*actionChangeList](this, play)) { return true; } } @@ -4795,7 +5129,7 @@ s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) { return true; } } else if (this->stateFlags1 & PLAYER_STATE1_800) { - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } return false; @@ -4803,14 +5137,14 @@ s32 func_80833058(PlayState* play, Player* this, s8* arg2, s32 arg3) { s32 func_808331FC(PlayState* play, Player* this, SkelAnime* skelAnime, f32 frame) { if ((skelAnime->endFrame - frame) <= skelAnime->curFrame) { - f32 sp24; - s16 sp22; + f32 speedTarget; + s16 yawTarget; - if (func_80833058(play, this, D_8085D01C, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true)) { return 0; } - if (D_80862B04 || func_80832F78(this, &sp24, &sp22, 0.018f, play)) { + if (D_80862B04 || Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play)) { return 1; } } @@ -4830,8 +5164,8 @@ void func_808332A0(PlayState* play, Player* this, s32 magicCost, s32 isSwordBeam Actor* thunder; if (isSwordBeam) { - if (this->targetedActor != NULL) { - pitch = Math_Vec3f_Pitch(&this->bodyPartsPos[PLAYER_BODYPART_WAIST], &this->targetedActor->focus.pos); + if (this->lockOnActor != NULL) { + pitch = Math_Vec3f_Pitch(&this->bodyPartsPos[PLAYER_BODYPART_WAIST], &this->lockOnActor->focus.pos); } if (gSaveContext.save.saveInfo.playerData.magic == 0) { return; @@ -4858,7 +5192,7 @@ s32 func_808333CC(Player* this) { s8 temp2; s32 i; - if (this->heldItemAction == PLAYER_IA_STICK) { + if (this->heldItemAction == PLAYER_IA_DEKU_STICK) { return false; } @@ -4904,7 +5238,7 @@ void func_808334D4(PlayState* play, Player* this) { } void func_808335B0(PlayState* play, Player* this) { - Player_SetAction(play, this, func_8084CCEC, 1); + Player_SetAction(play, this, Player_Action_30, 1); func_808334D4(play, this); } @@ -4926,14 +5260,14 @@ PlayerMeleeWeaponAnimation func_808335F4(Player* this) { temp_a1 = this->unk_AE3[this->unk_ADE]; if ((this->transformation == PLAYER_FORM_ZORA) || (this->transformation == PLAYER_FORM_GORON)) { - s32 requiredScopeTemp; + s8* meleeWeaponAnims = (this->transformation == PLAYER_FORM_ZORA) ? D_8085D094[0] : D_8085D094[1]; + s32 unk_ADD = this->unk_ADD; - // yikes - meleeWeaponAnim = ((this->transformation == PLAYER_FORM_ZORA) ? D_8085D094[0] : D_8085D094[1])[this->unk_ADD]; + meleeWeaponAnim = meleeWeaponAnims[unk_ADD]; - if (this->unk_ADD != 0) { + if (unk_ADD != 0) { this->meleeWeaponAnimation = meleeWeaponAnim; - if (this->unk_ADD >= 2) { + if (unk_ADD >= 2) { this->unk_ADD = -1; } } @@ -4953,7 +5287,7 @@ PlayerMeleeWeaponAnimation func_808335F4(Player* this) { } } - if (this->heldItemAction == PLAYER_IA_STICK) { + if (this->heldItemAction == PLAYER_IA_DEKU_STICK) { meleeWeaponAnim = PLAYER_MWA_FORWARD_SLASH_1H; } } @@ -4982,7 +5316,7 @@ MeleeWeaponDamageInfo D_8085D09C[PLAYER_MELEEWEAPON_MAX] = { { DMG_SWORD, 4, 8, 2, 4 }, // PLAYER_MELEEWEAPON_SWORD_RAZOR { DMG_SWORD, 4, 8, 3, 6 }, // PLAYER_MELEEWEAPON_SWORD_GILDED { DMG_SWORD, 4, 8, 4, 8 }, // PLAYER_MELEEWEAPON_SWORD_TWO_HANDED - { DMG_DEKU_STICK, 0, 0, 2, 4 }, // PLAYER_MELEEWEAPON_STICK + { DMG_DEKU_STICK, 0, 0, 2, 4 }, // PLAYER_MELEEWEAPON_DEKU_STICK { DMG_ZORA_PUNCH, 1, 2, 0, 0 }, // PLAYER_MELEEWEAPON_ZORA_FINS }; @@ -5016,8 +5350,8 @@ void func_8083375C(Player* this, PlayerMeleeWeaponAnimation meleeWeaponAnim) { void func_80833864(PlayState* play, Player* this, PlayerMeleeWeaponAnimation meleeWeaponAnim) { func_8083375C(this, meleeWeaponAnim); - Player_SetAction(play, this, func_808548B8, 0); - this->unk_AE8 = 0; + Player_SetAction(play, this, Player_Action_84, 0); + this->actionVar2 = 0; if ((meleeWeaponAnim < PLAYER_MWA_FLIPSLASH_FINISH) || (meleeWeaponAnim > PLAYER_MWA_ZORA_JUMPKICK_FINISH)) { func_8082DC38(this); @@ -5082,9 +5416,9 @@ void func_80833A64(Player* this) { } void func_80833AA0(Player* this, PlayState* play) { - if (Player_SetAction(play, this, func_8084C16C, 0)) { + if (Player_SetAction(play, this, Player_Action_25, 0)) { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); - this->unk_AE8 = 1; + this->actionVar2 = 1; } if (this->unk_AA5 != PLAYER_UNKAA5_4) { this->unk_AA5 = PLAYER_UNKAA5_0; @@ -5133,7 +5467,7 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc } if (arg2 == 3) { - Player_SetAction(play, this, func_808546D0, 0); + Player_SetAction(play, this, Player_Action_82, 0); anim = &gPlayerAnim_link_normal_ice_down; func_8082DAD4(this); this->actor.velocity.y = 0.0f; @@ -5143,11 +5477,11 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc Player_PlaySfx(this, NA_SE_PL_FREEZE_S); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { - Player_SetAction(play, this, func_80854800, 0); + Player_SetAction(play, this, Player_Action_83, 0); func_8082DB60(play, this, &gPlayerAnim_link_normal_electric_shock); func_8082DAD4(this); - this->unk_AE8 = 20; + this->actionVar2 = 20; this->actor.velocity.y = 0.0f; Player_RequestRumble(play, this, 255, 80, 150, SQ(0)); @@ -5155,7 +5489,7 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_8000000) { - Player_SetAction(play, this, func_80851B58, 0); + Player_SetAction(play, this, Player_Action_61, 0); Player_RequestRumble(play, this, 180, 20, 50, SQ(0)); if (arg2 == 1) { @@ -5171,7 +5505,7 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_200000))) { - Player_SetAction(play, this, func_8084BC64, 0); + Player_SetAction(play, this, Player_Action_21, 0); this->stateFlags3 |= PLAYER_STATE3_2; @@ -5179,7 +5513,7 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc func_8082DAD4(this); if (arg2 == 2) { - this->unk_AE8 = 4; + this->actionVar2 = 4; this->actor.speed = 3.0f; this->linearVelocity = 3.0f; @@ -5210,7 +5544,7 @@ void func_80833B18(PlayState* play, Player* this, s32 arg2, f32 speed, f32 veloc } else { PlayerAnimationHeader** animPtr = D_8085D0D4; - Player_SetAction(play, this, func_8084BBF0, 0); + Player_SetAction(play, this, Player_Action_20, 0); func_8082FC60(this); if (this->actor.colChkInfo.damage < 5) { @@ -5266,7 +5600,7 @@ s32 func_808340D4(FloorType floorType) { } void func_80834104(PlayState* play, Player* this) { - Player_SetAction(play, this, func_8085421C, 0); + Player_SetAction(play, this, Player_Action_77, 0); this->stateFlags1 |= PLAYER_STATE1_20000000 | PLAYER_STATE1_80000000; } @@ -5274,11 +5608,11 @@ void func_80834140(PlayState* play, Player* this, PlayerAnimationHeader* anim) { if (!(this->stateFlags1 & PLAYER_STATE1_80)) { func_80834104(play, this); if (func_8082DA90(play)) { - this->unk_AE8 = -30; + this->actionVar2 = -30; } this->stateFlags1 |= PLAYER_STATE1_80; PlayerAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, 84.0f, ANIMMODE_ONCE, -6.0f); - this->unk_AE7 = 1; + this->actionVar1 = 1; this->linearVelocity = 0.0f; } } @@ -5397,7 +5731,7 @@ s32 func_80834600(Player* this, PlayState* play) { this->unk_D6A = 0; } } else if ((var_v0 = ((Player_GetHeight(this) - 8.0f) < (this->unk_AB8 * this->actor.scale.y))) || - (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (sPlayerCurrentFloorType == FLOOR_TYPE_9) || + (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (sPlayerFloorType == FLOOR_TYPE_9) || (this->stateFlags2 & PLAYER_STATE2_80000000)) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_DAMAGE_S); @@ -5412,7 +5746,7 @@ s32 func_80834600(Player* this, PlayState* play) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_TAKEN_AWAY); play->haltAllActors = true; - play_sound(NA_SE_OC_ABYSS); + Audio_PlaySfx(NA_SE_OC_ABYSS); } else if ((this->unk_B75 != 0) && ((this->unk_B75 >= 3) || (this->invincibilityTimer == 0))) { u8 sp6C[] = { 0, 2, 1, 1 }; @@ -5433,17 +5767,17 @@ s32 func_80834600(Player* this, PlayState* play) { Player_RequestRumble(play, this, 180, 20, 100, SQ(0)); if ((this->invincibilityTimer >= 0) && !Player_IsGoronOrDeku(this)) { - sp64 = (func_8084B5C0 == this->actionFunc); + sp64 = (Player_Action_18 == this->actionFunc); if (!func_801242B4(this)) { - Player_SetAction(play, this, func_8084BAA4, 0); + Player_SetAction(play, this, Player_Action_19, 0); } - this->unk_AE7 = sp64; + this->actionVar1 = sp64; if ((s8)sp64 == 0) { - func_8082F43C(play, this, func_80848A0C); + Player_SetUpperAction(play, this, Player_UpperAction_4); var_a2 = (this->unk_B40 < 0.5f) ? D_8085CFD4[Player_IsHoldingTwoHandedWeapon(this)] : D_8085CFCC[Player_IsHoldingTwoHandedWeapon(this)]; - PlayerAnimation_PlayOnce(play, &this->unk_284, var_a2); + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, var_a2); } else { Player_AnimationPlayOnce(play, this, D_8085CFDC[Player_IsHoldingTwoHandedWeapon(this)]); } @@ -5456,7 +5790,7 @@ s32 func_80834600(Player* this, PlayState* play) { return false; } else if ((this->unk_D6B != 0) || (this->invincibilityTimer > 0) || (this->stateFlags1 & PLAYER_STATE1_4000000) || - (this->csMode != PLAYER_CSMODE_0) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || + (this->csMode != PLAYER_CSMODE_NONE) || (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || (this->meleeWeaponQuads[1].base.atFlags & AT_HIT) || (this->cylinder.base.atFlags & AT_HIT) || (this->shieldCylinder.base.atFlags & AT_HIT)) { return false; @@ -5494,30 +5828,30 @@ s32 func_80834600(Player* this, PlayState* play) { } else if (this->invincibilityTimer != 0) { return false; } else { - s32 sp58 = func_808340AC(sPlayerCurrentFloorType); - u32 sp54 = SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - s32 var_a1 = 0; + s32 sp58 = func_808340AC(sPlayerFloorType); + u32 isSurfaceWallDamage = SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + s32 var_a1 = false; s32 var_v1_2; s32 pad48; - if ((sp58 < 0) || - ((sp54 == 0) && (this->transformation == PLAYER_FORM_GORON) && !(this->actor.depthInWater > 0.0f))) { + if ((sp58 < 0) || (!isSurfaceWallDamage && (this->transformation == PLAYER_FORM_GORON) && + !(this->actor.depthInWater > 0.0f))) { var_a1 = (this->actor.wallPoly != NULL) && SurfaceType_IsWallDamage(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); - if (var_a1 == 0) { + if (!var_a1) { //! FAKE? goto label; } } - var_v1_2 = (var_a1 != 0) ? this->actor.wallBgId : this->actor.floorBgId; + var_v1_2 = var_a1 ? this->actor.wallBgId : this->actor.floorBgId; if (((this->transformation == PLAYER_FORM_DEKU) || (this->transformation == PLAYER_FORM_ZORA)) && - ((sp58 >= 0) && (sp54 == 0) && !(this->stateFlags1 & PLAYER_STATE1_8000000) && + ((sp58 >= 0) && !isSurfaceWallDamage && !(this->stateFlags1 & PLAYER_STATE1_8000000) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.depthInWater < -30.0f))) { func_80834534(play, this); } else { this->actor.colChkInfo.damage = 4; func_80833B18(play, this, (var_v1_2 == BGCHECK_SCENE) ? 0 : 1, 4.0f, 5.0f, - (var_a1 != 0) ? this->actor.wallYaw : this->actor.shape.rot.y, 20); + var_a1 ? this->actor.wallYaw : this->actor.shape.rot.y, 20); return true; } } @@ -5545,7 +5879,7 @@ void func_80834CD0(Player* this, f32 arg1, u16 sfxId) { } void func_80834D50(PlayState* play, Player* this, PlayerAnimationHeader* anim, f32 speed, u16 sfxId) { - Player_SetAction(play, this, func_8084C16C, 1); + Player_SetAction(play, this, Player_Action_25, 1); if (anim != NULL) { func_8082DB90(play, this, anim); } @@ -5556,46 +5890,50 @@ void func_80834DB8(Player* this, PlayerAnimationHeader* anim, f32 speed, PlaySta func_80834D50(play, this, anim, speed, NA_SE_VO_LI_SWORD_N); } -s32 func_80834DFC(Player* this, PlayState* play) { +s32 Player_ActionChange_12(Player* this, PlayState* play) { if ((this->transformation != PLAYER_FORM_GORON) && - ((this->transformation != PLAYER_FORM_DEKU) || func_801242B4(this) || (this->unk_B5C < 4)) && - !(this->stateFlags1 & PLAYER_STATE1_800) && (this->unk_B5C >= 2) && - (!(this->stateFlags1 & PLAYER_STATE1_8000000) || (this->wallHeight < this->ageProperties->unk_14))) { + ((this->transformation != PLAYER_FORM_DEKU) || func_801242B4(this) || + (this->ledgeClimbType <= PLAYER_LEDGE_CLIMB_3)) && + !(this->stateFlags1 & PLAYER_STATE1_800) && (this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && + (!(this->stateFlags1 & PLAYER_STATE1_8000000) || (this->yDistToLedge < this->ageProperties->unk_14))) { s32 var_v1 = false; PlayerAnimationHeader* anim; - f32 wallHeight; + f32 yDistToLedge; if (func_801242B4(this)) { f32 depth = (this->transformation == PLAYER_FORM_FIERCE_DEITY) ? 80.0f : 50.0f; if (this->actor.depthInWater < depth) { - if ((this->unk_B5C < 2) || (this->ageProperties->unk_10 < this->wallHeight)) { + if ((this->ledgeClimbType <= PLAYER_LEDGE_CLIMB_1) || + (this->ageProperties->unk_10 < this->yDistToLedge)) { return false; } - } else if ((this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) || (this->unk_B5C >= 3)) { + } else if ((this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) || + (this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_3)) { return false; } } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - ((this->ageProperties->unk_14 <= this->wallHeight) && (this->stateFlags1 & PLAYER_STATE1_8000000))) { + ((this->ageProperties->unk_14 <= this->yDistToLedge) && + (this->stateFlags1 & PLAYER_STATE1_8000000))) { return false; } - if ((this->actor.wallBgId != BGCHECK_SCENE) && (sPlayerCurrentWallFlags & WALL_FLAG_6)) { - if (this->unk_B5D >= 6) { + if ((this->actor.wallBgId != BGCHECK_SCENE) && (sPlayerTouchedWallFlags & WALL_FLAG_6)) { + if (this->ledgeClimbDelayTimer >= 6) { this->stateFlags2 |= PLAYER_STATE2_4; if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { var_v1 = true; } } - } else if ((this->unk_B5D >= 6) || CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { + } else if ((this->ledgeClimbDelayTimer >= 6) || CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { var_v1 = true; } if (var_v1) { - Player_SetAction(play, this, func_8084D4EC, 0); - wallHeight = this->wallHeight; + Player_SetAction(play, this, Player_Action_33, 0); + yDistToLedge = this->yDistToLedge; - if (this->ageProperties->unk_14 <= wallHeight) { + if (this->ageProperties->unk_14 <= yDistToLedge) { anim = &gPlayerAnim_link_normal_250jump_start; this->linearVelocity = 1.0f; } else { @@ -5603,28 +5941,28 @@ s32 func_80834DFC(Player* this, PlayState* play) { s32 bgId; f32 wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); - f32 var_fv1 = this->wallDistance + 0.5f; // wallDistance + f32 var_fv1 = this->distToInteractWall + 0.5f; f32 yIntersect; s32 pad; this->stateFlags1 |= PLAYER_STATE1_4; if (func_801242B4(this)) { - wallHeight -= 60.0f * this->ageProperties->unk_08; + yDistToLedge -= 60.0f * this->ageProperties->unk_08; anim = &gPlayerAnim_link_swimer_swim_15step_up; this->stateFlags1 &= ~PLAYER_STATE1_8000000; - } else if (this->ageProperties->unk_18 <= wallHeight) { - wallHeight -= 59.0f * this->ageProperties->unk_08; + } else if (this->ageProperties->unk_18 <= yDistToLedge) { + yDistToLedge -= 59.0f * this->ageProperties->unk_08; anim = &gPlayerAnim_link_normal_150step_up; } else { - wallHeight -= 41.0f * this->ageProperties->unk_08; + yDistToLedge -= 41.0f * this->ageProperties->unk_08; anim = &gPlayerAnim_link_normal_100step_up; } - this->unk_ABC -= wallHeight * 100.0f; + this->unk_ABC -= yDistToLedge * 100.0f; this->actor.world.pos.x -= var_fv1 * wallPolyNormalX; - this->actor.world.pos.y += this->wallHeight + 10.0f; + this->actor.world.pos.y += this->yDistToLedge + 10.0f; this->actor.world.pos.z -= var_fv1 * wallPolyNormalZ; yIntersect = @@ -5646,8 +5984,9 @@ s32 func_80834DFC(Player* this, PlayState* play) { this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; return true; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_B5C == 1) && (this->unk_B5D >= 3)) { - f32 temp = (this->wallHeight * 0.08f) + 5.5f; + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->ledgeClimbType == PLAYER_LEDGE_CLIMB_1) && + (this->ledgeClimbDelayTimer >= 3)) { + f32 temp = (this->yDistToLedge * 0.08f) + 5.5f; func_80834DB8(this, &gPlayerAnim_link_normal_jump, temp, play); this->linearVelocity = 2.5f; @@ -5658,12 +5997,12 @@ s32 func_80834DFC(Player* this, PlayState* play) { } void func_80835324(PlayState* play, Player* this, f32 arg2, s16 arg3) { - Player_SetAction(play, this, func_8084D820, 0); + Player_SetAction(play, this, Player_Action_35, 0); func_8082DD2C(play, this); this->csId = CS_ID_NONE; - this->unk_AE7 = 1; - this->unk_AE8 = 1; + this->actionVar1 = 1; + this->actionVar2 = 1; this->unk_3A0.x = Math_SinS(arg3) * arg2 + this->actor.world.pos.x; this->unk_3A0.z = Math_CosS(arg3) * arg2 + this->actor.world.pos.z; @@ -5672,7 +6011,7 @@ void func_80835324(PlayState* play, Player* this, f32 arg2, s16 arg3) { } void func_808353DC(PlayState* play, Player* this) { - Player_SetAction(play, this, func_808508C8, 0); + Player_SetAction(play, this, Player_Action_54, 0); func_8082E634(play, this, &gPlayerAnim_link_swimer_swim_wait); } @@ -5681,7 +6020,7 @@ s32 func_80835428(PlayState* play, Player* this) { func_80834104(play, this); Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_FALL_S); - func_8019F128(NA_SE_OC_SECRET_WARP_IN); + Audio_PlaySfx_2(NA_SE_OC_SECRET_WARP_IN); return true; } return false; @@ -5713,8 +6052,8 @@ u8 sReturnEntranceGroupIndices[] = { }; // subfunction of OoT's func_80839034 -void func_808354A4(PlayState* play, s32 arg1, s32 arg2) { - play->nextEntrance = play->setupExitList[arg1]; +void func_808354A4(PlayState* play, s32 exitIndex, s32 arg2) { + play->nextEntrance = play->setupExitList[exitIndex]; if (play->nextEntrance == 0xFFFF) { gSaveContext.respawnFlag = 4; @@ -5733,7 +6072,7 @@ void func_808354A4(PlayState* play, s32 arg1, s32 arg2) { gSaveContext.respawnFlag = -2; } - gSaveContext.retainWeatherMode = 1; + gSaveContext.retainWeatherMode = true; Scene_SetExitFade(play); } @@ -5742,141 +6081,149 @@ void func_808354A4(PlayState* play, s32 arg1, s32 arg2) { void func_808355D8(PlayState* play, Player* this, PlayerAnimationHeader* anim) { func_80833AA0(this, play); - this->unk_AE8 = -2; + this->actionVar2 = -2; func_8082E5EC(play, this, anim); func_8082E1F0(this, NA_SE_IT_DEKUNUTS_FLOWER_CLOSE); } -// related to grottos (?) -s32 func_8083562C(PlayState* play, Player* this, CollisionPoly* poly, s32 bgId) { - s32 var_a3; +s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* poly, s32 bgId) { + s32 exitIndexPlusOne; FloorType floorType; s32 sp34; s32 sp30; if ((this == GET_PLAYER(play)) && !(this->stateFlags1 & PLAYER_STATE1_80) && !func_8082DA90(play) && - (this->csMode == PLAYER_CSMODE_0) && !(this->stateFlags1 & PLAYER_STATE1_1)) { - var_a3 = 0; - if (((poly != NULL) && (var_a3 = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), (var_a3 != 0)) && - (((play->sceneId != SCENE_GORONRACE) && (play->sceneId != SCENE_DEKU_KING)) || (var_a3 < 3)) && - (((play->sceneId != SCENE_20SICHITAI) && (play->sceneId != SCENE_20SICHITAI2)) || (var_a3 < 0x15)) && - ((play->sceneId != SCENE_11GORONNOSATO) || (var_a3 < 6))) || - (func_808340D4(sPlayerCurrentFloorType) && (this->floorProperty == FLOOR_PROPERTY_12))) { + (this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_1)) { + exitIndexPlusOne = 0; + + if (((poly != NULL) && + (exitIndexPlusOne = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), (exitIndexPlusOne != 0)) && + (((play->sceneId != SCENE_GORONRACE) && (play->sceneId != SCENE_DEKU_KING)) || (exitIndexPlusOne < 3)) && + (((play->sceneId != SCENE_20SICHITAI) && (play->sceneId != SCENE_20SICHITAI2)) || + (exitIndexPlusOne < 0x15)) && + ((play->sceneId != SCENE_11GORONNOSATO) || (exitIndexPlusOne < 6))) || + (func_808340D4(sPlayerFloorType) && (this->floorProperty == FLOOR_PROPERTY_12))) { + sp34 = this->unk_D68 - (s32)this->actor.world.pos.y; + if (!(this->stateFlags1 & (PLAYER_STATE1_800000 | PLAYER_STATE1_8000000 | PLAYER_STATE1_20000000)) && - !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 400) && (D_80862B18 > 100.0f)) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 400) && (sPlayerYDistToFloor > 100.0f)) { if ((this->floorProperty != FLOOR_PROPERTY_5) && (this->floorProperty != FLOOR_PROPERTY_12)) { this->linearVelocity = 0.0f; } - return false; + } + + if (this->stateFlags3 & PLAYER_STATE3_1000000) { + func_808355D8(play, this, &gPlayerAnim_pn_kakkufinish); + } + + if (exitIndexPlusOne == 0) { + func_80169EFC(&play->state); + Scene_SetExitFade(play); } else { - if (this->stateFlags3 & PLAYER_STATE3_1000000) { - func_808355D8(play, this, &gPlayerAnim_pn_kakkufinish); + func_808354A4(play, exitIndexPlusOne - 1, + SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == FLOOR_EFFECT_2); + + if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->floorProperty == FLOOR_PROPERTY_5)) { + Audio_PlaySfx_2(NA_SE_OC_TUNAMI); + func_801A4058(5); + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->floorProperty == FLOOR_PROPERTY_12)) { + Audio_PlaySfx_2(NA_SE_OC_SECRET_WARP_IN); } - if (var_a3 == 0) { - func_80169EFC(&play->state); - Scene_SetExitFade(play); + if (this->stateFlags1 & PLAYER_STATE1_800000) { + if (D_801BDAA0) { + D_801BDAA0 = false; + } else { + gHorseIsMounted = true; + } + } + } + + if (!(this->stateFlags1 & (PLAYER_STATE1_800000 | PLAYER_STATE1_8000000 | PLAYER_STATE1_20000000)) && + ((floorType = SurfaceType_GetFloorType(&play->colCtx, poly, bgId)) != FLOOR_TYPE_10) && + ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { + if (floorType == FLOOR_TYPE_11) { + Audio_PlaySfx_2(NA_SE_OC_SECRET_HOLE_OUT); + func_801A4058(5); + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } else { - func_808354A4(play, var_a3 - 1, - SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == FLOOR_EFFECT_2); - if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->floorProperty == FLOOR_PROPERTY_5)) { - func_8019F128(NA_SE_OC_TUNAMI); - func_801A4058(5); - gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; - } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (this->floorProperty == FLOOR_PROPERTY_12)) { - func_8019F128(NA_SE_OC_SECRET_WARP_IN); - } - - if (this->stateFlags1 & PLAYER_STATE1_800000) { - if (D_801BDAA0) { - D_801BDAA0 = false; - } else { - gHorseIsMounted = true; - } - } + func_8085B74C(play); } - - if (!(this->stateFlags1 & (PLAYER_STATE1_800000 | PLAYER_STATE1_8000000 | PLAYER_STATE1_20000000)) && - ((floorType = SurfaceType_GetFloorType(&play->colCtx, poly, bgId)) != FLOOR_TYPE_10) && - ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { - if (floorType == FLOOR_TYPE_11) { - func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); - func_801A4058(5); - gSaveContext.seqId = (u8)NA_BGM_DISABLED; - gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; - } else { - func_8085B74C(play); - } - } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - Player_StopHorizontalMovement(this); - } - - Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SCENE0); - this->stateFlags1 |= PLAYER_STATE1_1 | PLAYER_STATE1_20000000; - return true; - } - } else { - if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->actor.floorPoly == NULL)) { - BgCheck_EntityRaycastFloor7(&play->colCtx, &this->actor.floorPoly, &sp30, &this->actor, - &this->actor.world.pos); - if (this->actor.floorPoly == NULL) { - func_80169EFC(&play->state); - return false; - } - //! FAKE - if (1) {} + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Player_StopHorizontalMovement(this); } - if (!(this->stateFlags1 & PLAYER_STATE1_80000000)) { - if (((this->actor.world.pos.y < -4000.0f) || - (((this->floorProperty == FLOOR_PROPERTY_5) || (this->floorProperty == FLOOR_PROPERTY_12) || - (this->floorProperty == FLOOR_PROPERTY_13)) && - ((D_80862B18 < 100.0f) || (this->fallDistance > 400))))) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->floorProperty == FLOOR_PROPERTY_5) { - func_80169FDC(&play->state); - func_808345C8(); - } else { - func_80169EFC(&play->state); - } - if (!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { - gSaveContext.respawnFlag = -5; - } - - play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - play_sound(NA_SE_OC_ABYSS); - } else { - if (this->stateFlags3 & PLAYER_STATE3_1000000) { - func_808355D8(play, this, &gPlayerAnim_pn_kakkufinish); - } - - if (this->floorProperty == FLOOR_PROPERTY_13) { - Player_SetAction(play, this, func_808497A0, 0); - this->stateFlags1 |= PLAYER_STATE1_20000000; - } else { - func_80834104(play, this); - this->unk_AE8 = 9999; - if (this->floorProperty == FLOOR_PROPERTY_5) { - this->unk_AE7 = -1; - } else { - this->unk_AE7 = 1; - } - } - } - } - } - - this->unk_D68 = this->actor.world.pos.y; + Camera_ChangeSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SCENE0); + this->stateFlags1 |= PLAYER_STATE1_1 | PLAYER_STATE1_20000000; + return true; } + if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->actor.floorPoly == NULL)) { + BgCheck_EntityRaycastFloor7(&play->colCtx, &this->actor.floorPoly, &sp30, &this->actor, + &this->actor.world.pos); + if (this->actor.floorPoly == NULL) { + func_80169EFC(&play->state); + return false; + } + //! FAKE + if (1) {} + } + + if (!(this->stateFlags1 & PLAYER_STATE1_80000000)) { + if (((this->actor.world.pos.y < -4000.0f) || + (((this->floorProperty == FLOOR_PROPERTY_5) || (this->floorProperty == FLOOR_PROPERTY_12) || + (this->floorProperty == FLOOR_PROPERTY_13)) && + ((sPlayerYDistToFloor < 100.0f) || (this->fallDistance > 400))))) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->floorProperty == FLOOR_PROPERTY_5) { + func_80169FDC(&play->state); + func_808345C8(); + } else { + func_80169EFC(&play->state); + } + if (!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + gSaveContext.respawnFlag = -5; + } + + play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; + Audio_PlaySfx(NA_SE_OC_ABYSS); + } else { + if (this->stateFlags3 & PLAYER_STATE3_1000000) { + func_808355D8(play, this, &gPlayerAnim_pn_kakkufinish); + } + + if (this->floorProperty == FLOOR_PROPERTY_13) { + Player_SetAction(play, this, Player_Action_1, 0); + this->stateFlags1 |= PLAYER_STATE1_20000000; + } else { + func_80834104(play, this); + this->actionVar2 = 9999; + if (this->floorProperty == FLOOR_PROPERTY_5) { + this->actionVar1 = -1; + } else { + this->actionVar1 = 1; + } + } + } + } + } + + this->unk_D68 = this->actor.world.pos.y; } return false; } +/** + * Gets a position relative to player's yaw. + * An offset is applied to the provided base position in the direction of shape y rotation. + * The resulting position is stored in `dst` + */ void Player_TranslateAndRotateY(Player* this, Vec3f* translation, Vec3f* src, Vec3f* dst) { Lib_Vec3f_TranslateAndRotateY(translation, this->actor.shape.rot.y, src, dst); } @@ -5887,16 +6234,17 @@ void func_80835BF8(Vec3f* srcPos, s16 rotY, f32 radius, Vec3f* dstPos) { dstPos->z = Math_CosS(rotY) * radius + srcPos->z; } -Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* translation, Vec3f* arg3, s32 elfParams) { - Vec3f pos; +Actor* Player_SpawnFairy(PlayState* play, Player* this, Vec3f* translation, Vec3f* pos, s32 fairyParams) { + Vec3f spawnPos; - Player_TranslateAndRotateY(this, translation, arg3, &pos); + Player_TranslateAndRotateY(this, translation, pos, &spawnPos); - return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, pos.x, pos.y, pos.z, 0, 0, 0, elfParams); + return Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, fairyParams); } f32 func_80835CD8(PlayState* play, Player* this, Vec3f* arg2, Vec3f* pos, CollisionPoly** outPoly, s32* outBgId) { Player_TranslateAndRotateY(this, &this->actor.world.pos, arg2, pos); + return BgCheck_EntityRaycastFloor5(&play->colCtx, outPoly, outBgId, &this->actor, pos); } @@ -5907,16 +6255,25 @@ f32 func_80835D2C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* pos) { return func_80835CD8(play, this, arg2, pos, &poly, &bgId); } -s32 func_80835D58(PlayState* play, Player* this, Vec3f* arg2, CollisionPoly** outPoly, s32* bgId, Vec3f* posResult) { +/** + * Checks if a line between the player's position and the provided `offset` intersect a wall. + * + * Point A of the line is at player's world position offset by the height provided in `offset`. + * Point B of the line is at player's world position offset by the entire `offset` vector. + * Point A and B are always at the same height, meaning this is a horizontal line test. + */ +s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, + Vec3f* posResult) { Vec3f posA; Vec3f posB; posA.x = this->actor.world.pos.x; - posA.y = this->actor.world.pos.y + arg2->y; + posA.y = this->actor.world.pos.y + offset->y; posA.z = this->actor.world.pos.z; - Player_TranslateAndRotateY(this, &this->actor.world.pos, arg2, &posB); - return BgCheck_EntityLineTest2(&play->colCtx, &posA, &posB, posResult, outPoly, true, false, false, true, bgId, + Player_TranslateAndRotateY(this, &this->actor.world.pos, offset, &posB); + + return BgCheck_EntityLineTest2(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId, &this->actor); } @@ -5927,7 +6284,7 @@ s32 func_80835DF8(PlayState* play, Player* this, CollisionPoly** outPoly, s32* o f32 yIntersect = func_80835CD8(play, this, &D_8085D100, &pos, outPoly, outBgId); if ((*outBgId == BGCHECK_SCENE) && (fabsf(this->actor.world.pos.y - yIntersect) < 10.0f)) { - func_800FAAB4(play, SurfaceType_GetLightSettingIndex(&play->colCtx, *outPoly, *outBgId)); + Environment_ChangeLightSetting(play, SurfaceType_GetLightSettingIndex(&play->colCtx, *outPoly, *outBgId)); return true; } return false; @@ -5948,7 +6305,7 @@ void Player_Door_Staircase(PlayState* play, Player* this, Actor* door) { func_80835324(play, this, 50.0f, this->actor.shape.rot.y); this->unk_397 = this->doorType; - this->unk_AE7 = 0; + this->actionVar1 = 0; this->stateFlags1 |= PLAYER_STATE1_20000000; func_80835BF8(&doorStaircase->actor.world.pos, doorStaircase->actor.shape.rot.y, -140.0f, &this->unk_3A0); @@ -5961,7 +6318,7 @@ void Player_Door_Staircase(PlayState* play, Player* this, Actor* door) { func_8082DAD4(this); if (this->doorTimer != 0) { - this->unk_AE8 = 0; + this->actionVar2 = 0; func_8082E438(play, this, func_8082ED20(this)); this->skelAnime.endFrame = 0.0f; } else { @@ -5992,7 +6349,7 @@ void Player_Door_Sliding(PlayState* play, Player* this, Actor* door) { } func_80835324(play, this, 50.0f, this->actor.shape.rot.y); - this->unk_AE7 = 0; + this->actionVar1 = 0; this->unk_397 = this->doorType; this->stateFlags1 |= PLAYER_STATE1_20000000; Actor_OffsetOfPointInActorCoords(&doorSliding->dyna.actor, &sp38, &this->actor.world.pos); @@ -6008,7 +6365,7 @@ void Player_Door_Sliding(PlayState* play, Player* this, Actor* door) { func_8082DAD4(this); if (this->doorTimer != 0) { - this->unk_AE8 = 0; + this->actionVar2 = 0; func_8082E438(play, this, func_8082ED20(this)); this->skelAnime.endFrame = 0.0f; } else { @@ -6046,9 +6403,9 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) { s32 temp = this->transformation - 1; PlayerAnimationHeader* anim; f32 temp_fv0; // sp5C - KnobDoorActor* doorHandle = (KnobDoorActor*)door; + KnobDoorActor* knobDoor = (KnobDoorActor*)door; - doorHandle->animIndex = this->transformation; + knobDoor->animIndex = this->transformation; if (this->doorDirection < 0) { if (this->transformation == PLAYER_FORM_FIERCE_DEITY) { @@ -6059,7 +6416,7 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) { anim = D_8085D118[temp]; } } else { - doorHandle->animIndex += 5; + knobDoor->animIndex += PLAYER_FORM_MAX; if (this->transformation == PLAYER_FORM_FIERCE_DEITY) { anim = D_8085BE84[PLAYER_ANIMGROUP_10][this->modelAnimType]; @@ -6070,19 +6427,18 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) { } } - Player_SetAction(play, this, func_8084E034, 0); + Player_SetAction(play, this, Player_Action_36, 0); this->stateFlags2 |= PLAYER_STATE2_800000; func_8082DE14(play, this); if (this->doorDirection < 0) { - this->actor.shape.rot.y = doorHandle->dyna.actor.shape.rot.y; + this->actor.shape.rot.y = knobDoor->dyna.actor.shape.rot.y; } else { - this->actor.shape.rot.y = doorHandle->dyna.actor.shape.rot.y - 0x8000; + this->actor.shape.rot.y = knobDoor->dyna.actor.shape.rot.y - 0x8000; } this->currentYaw = this->actor.shape.rot.y; temp_fv0 = this->doorDirection * 22.0f; - func_80835BF8(&doorHandle->dyna.actor.world.pos, doorHandle->dyna.actor.shape.rot.y, temp_fv0, - &this->actor.world.pos); + func_80835BF8(&knobDoor->dyna.actor.world.pos, knobDoor->dyna.actor.shape.rot.y, temp_fv0, &this->actor.world.pos); func_8082EC9C(play, this, anim); if (this->doorTimer != 0) { @@ -6092,47 +6448,47 @@ void Player_Door_Knob(PlayState* play, Player* this, Actor* door) { func_8082DAD4(this); func_8082E920(play, this, ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_80 | ANIM_FLAG_200); - doorHandle->playOpenAnim = true; + knobDoor->playOpenAnim = true; if (this->doorType != PLAYER_DOORTYPE_FAKE) { CollisionPoly* poly; s32 bgId; Vec3f pos; - s32 enDoorType = ENDOOR_GET_TYPE(&doorHandle->dyna.actor); + s32 enDoorType = ENDOOR_GET_TYPE(&knobDoor->dyna.actor); this->stateFlags1 |= PLAYER_STATE1_20000000; if (this->actor.category == ACTORCAT_PLAYER) { Actor_DeactivateLens(play); - func_80835BF8(&doorHandle->dyna.actor.world.pos, doorHandle->dyna.actor.shape.rot.y, -temp_fv0, &pos); - pos.y = doorHandle->dyna.actor.world.pos.y + 10.0f; + func_80835BF8(&knobDoor->dyna.actor.world.pos, knobDoor->dyna.actor.shape.rot.y, -temp_fv0, &pos); + pos.y = knobDoor->dyna.actor.world.pos.y + 10.0f; BgCheck_EntityRaycastFloor5(&play->colCtx, &poly, &bgId, &this->actor, &pos); - if (func_8083562C(play, this, poly, BGCHECK_SCENE)) { + if (Player_HandleExitsAndVoids(play, this, poly, BGCHECK_SCENE)) { gSaveContext.entranceSpeed = 2.0f; } else if (enDoorType != ENDOOR_TYPE_7) { Camera* mainCam; - this->unk_AE7 = 38.0f * D_8085C3E8; + this->actionVar1 = 38.0f * D_8085C3E8; mainCam = Play_GetCamera(play, CAM_ID_MAIN); - Camera_ChangeDoorCam(mainCam, &doorHandle->dyna.actor, - play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&doorHandle->dyna.actor)] + Camera_ChangeDoorCam(mainCam, &knobDoor->dyna.actor, + play->doorCtx.transitionActorList[DOOR_GET_TRANSITION_ID(&knobDoor->dyna.actor)] .sides[(this->doorDirection > 0) ? 0 : 1] .bgCamIndex, - 0.0f, this->unk_AE7, 26.0f * D_8085C3E8, 10.0f * D_8085C3E8); + 0.0f, this->actionVar1, 26.0f * D_8085C3E8, 10.0f * D_8085C3E8); } } } } // door stuff -s32 func_808365DC(Player* this, PlayState* play) { +s32 Player_ActionChange_1(Player* this, PlayState* play) { if ((gSaveContext.save.saveInfo.playerData.health != 0) && (this->doorType != PLAYER_DOORTYPE_NONE)) { if ((this->actor.category != ACTORCAT_PLAYER) || ((((this->doorType <= PLAYER_DOORTYPE_TALKING) && CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) || ((this->doorType >= PLAYER_DOORTYPE_HANDLE) && CutsceneManager_IsNext(CS_ID_GLOBAL_DOOR))) && (!(this->stateFlags1 & PLAYER_STATE1_800) && - (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) || (func_8085437C == this->actionFunc) || + (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) || (Player_Action_78 == this->actionFunc) || (this->doorType == PLAYER_DOORTYPE_STAIRCASE) || (this->doorType == PLAYER_DOORTYPE_PROXIMITY))))) { Actor* doorActor = this->doorActor; Actor* var_v0_3; @@ -6187,7 +6543,7 @@ s32 func_808365DC(Player* this, PlayState* play) { void func_80836888(Player* this, PlayState* play) { PlayerAnimationHeader* anim; - Player_SetAction(play, this, func_80849A9C, 1); + Player_SetAction(play, this, Player_Action_2, 1); if (this->unk_B40 < 0.5f) { anim = func_8082EF54(this); @@ -6203,7 +6559,7 @@ void func_80836888(Player* this, PlayState* play) { } void func_8083692C(Player* this, PlayState* play) { - Player_SetAction(play, this, func_80849DD0, 1); + Player_SetAction(play, this, Player_Action_3, 1); func_8082E438(play, this, func_8082ED20(this)); this->currentYaw = this->actor.shape.rot.y; } @@ -6222,11 +6578,11 @@ void func_808369F4(Player* this, PlayState* play) { PlayerActionFunc actionFunc; if (func_80123420(this)) { - actionFunc = func_80849A9C; + actionFunc = Player_Action_2; } else if (func_80123434(this)) { - actionFunc = func_80849DD0; + actionFunc = Player_Action_3; } else { - actionFunc = func_80849FE0; + actionFunc = Player_Action_4; } Player_SetAction(play, this, actionFunc, 1); } @@ -6234,7 +6590,7 @@ void func_808369F4(Player* this, PlayState* play) { void func_80836A5C(Player* this, PlayState* play) { func_808369F4(this, play); if (func_80123420(this)) { - this->unk_AE8 = 1; + this->actionVar2 = 1; } } @@ -6244,7 +6600,7 @@ void func_80836A98(Player* this, PlayerAnimationHeader* anim, PlayState* play) { } void func_80836AD8(PlayState* play, Player* this) { - Player_SetAction(play, this, func_80857BE8, 0); + Player_SetAction(play, this, Player_Action_96, 0); this->unk_B28 = 0; this->unk_B86[1] = 0; this->unk_AF0[0].x = 0.0f; @@ -6266,7 +6622,7 @@ void func_80836B3C(PlayState* play, Player* this, f32 arg2) { } else { PlayerAnimationHeader* anim = D_8085BE84[PLAYER_ANIMGROUP_15][this->modelAnimType]; - Player_SetAction(play, this, func_8084C6EC, 0); + Player_SetAction(play, this, Player_Action_26, 0); PlayerAnimation_Change(play, &this->skelAnime, anim, 1.25f * D_8085C3E4, arg2, Animation_GetLastFrame(anim), ANIMMODE_ONCE, 0.0f); } @@ -6303,7 +6659,7 @@ void func_80836D8C(Player* this) { s32 func_80836DC0(PlayState* play, Player* this) { if ((MREG(48) != 0) || func_800C9DDC(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { - Player_SetAction(play, this, func_808561B0, 0); + Player_SetAction(play, this, Player_Action_93, 0); this->stateFlags1 &= ~(PLAYER_STATE1_20000 | PLAYER_STATE1_40000000); func_8082E438(play, this, &gPlayerAnim_pn_attack); Player_StopHorizontalMovement(this); @@ -6336,8 +6692,8 @@ FallImpactInfo sFallImpactInfos[] = { s32 func_80836F10(PlayState* play, Player* this) { s32 fallDistance; - if ((sPlayerCurrentFloorType == FLOOR_TYPE_6) || (sPlayerCurrentFloorType == FLOOR_TYPE_9) || - (this->csMode != PLAYER_CSMODE_0)) { + if ((sPlayerFloorType == FLOOR_TYPE_6) || (sPlayerFloorType == FLOOR_TYPE_9) || + (this->csMode != PLAYER_CSMODE_NONE)) { fallDistance = 0; } else { fallDistance = this->fallDistance; @@ -6382,8 +6738,8 @@ s32 func_80836F10(PlayState* play, Player* this) { fallDistance = CLAMP_MAX(fallDistance, 255); Player_RequestRumble(play, this, fallDistance, fallDistance * 0.1f, fallDistance, SQ(0)); - if (sPlayerCurrentFloorType == FLOOR_TYPE_6) { - //! @bug unreachable code: When sPlayerCurrentFloorType is equal to FLOOR_TYPE_6 then fallDistance is + if (sPlayerFloorType == FLOOR_TYPE_6) { + //! @bug unreachable code: When sPlayerFloorType is equal to FLOOR_TYPE_6 then fallDistance is //! ignored (set to zero), so the previous check based on said variable will always fail, producing this //! current check to always be false. Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_CLIMB_END); @@ -6430,9 +6786,9 @@ void func_80837134(PlayState* play, Player* this) { } } else if (this->stateFlags2 & PLAYER_STATE2_80000) { if (func_80123420(this)) { - anim = D_8085C2A4[this->unk_AE7].unk_8; + anim = D_8085C2A4[this->actionVar1].unk_8; } else { - anim = D_8085C2A4[this->unk_AE7].unk_4; + anim = D_8085C2A4[this->actionVar1].unk_4; } } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_run_jump) { anim = &gPlayerAnim_link_normal_run_jump_end; @@ -6451,9 +6807,9 @@ void func_80837134(PlayState* play, Player* this) { this->skelAnime.endFrame = 8.0f; if (temp_v0_2 == 1) { - this->unk_AE8 = 0xA; + this->actionVar2 = 0xA; } else { - this->unk_AE8 = 0x14; + this->actionVar2 = 0x14; } } else if (temp_v0_2 == 0) { func_80836A98(this, anim, play); @@ -6490,7 +6846,7 @@ s32 func_808373F8(PlayState* play, Player* this, u16 sfxId) { s32 var_v1; if ((this->transformation != PLAYER_FORM_DEKU) && - (((sPlayerPrevFloorProperty == FLOOR_PROPERTY_1)) || (sPlayerPrevFloorProperty == FLOOR_PROPERTY_2))) { + ((sPlayerPrevFloorProperty == FLOOR_PROPERTY_1) || (sPlayerPrevFloorProperty == FLOOR_PROPERTY_2))) { if (sPlayerPrevFloorProperty == FLOOR_PROPERTY_1) { var_v1 = 4; } else { @@ -6498,9 +6854,9 @@ s32 func_808373F8(PlayState* play, Player* this, u16 sfxId) { } func_80834D50(play, this, D_8085C2A4[var_v1].unk_0, speed, ((var_v1 == 4) ? NA_SE_VO_LI_SWORD_N : sfxId)); - this->unk_AE8 = -1; + this->actionVar2 = -1; this->stateFlags2 |= PLAYER_STATE2_80000; - this->unk_AE7 = var_v1; + this->actionVar1 = var_v1; return true; } anim = &gPlayerAnim_link_normal_run_jump; @@ -6516,7 +6872,7 @@ s32 func_808373F8(PlayState* play, Player* this, u16 sfxId) { if ((this->actor.depthInWater > 0.0f) && (this->remainingHopsCounter != 0)) { this->actor.world.pos.y += this->actor.depthInWater; func_80834D50(play, this, anim, speed, NA_SE_NONE); - this->unk_AE8 = 1; + this->actionVar2 = 1; this->stateFlags3 |= PLAYER_STATE3_200000; Player_PlaySfx(this, (NA_SE_PL_DEKUNUTS_JUMP5 + 1 - this->remainingHopsCounter)); Player_AnimSfx_PlayVoice(this, sfxId); @@ -6535,7 +6891,7 @@ s32 func_808373F8(PlayState* play, Player* this, u16 sfxId) { } func_80834D50(play, this, anim, speed, sfxId); - this->unk_AE8 = 1; + this->actionVar2 = 1; return true; } @@ -6566,7 +6922,7 @@ s32 func_80837730(PlayState* play, Player* this, f32 arg2, s32 scale) { s32 func_8083784C(Player* this) { if (this->actor.velocity.y < 0.0f) { if ((this->actor.depthInWater > 0.0f) && - ((this->ageProperties->unk_2C - this->actor.depthInWater) < D_80862B18)) { + ((this->ageProperties->unk_2C - this->actor.depthInWater) < sPlayerYDistToFloor)) { if ((this->remainingHopsCounter != 0) && (gSaveContext.save.saveInfo.playerData.health != 0) && !(this->stateFlags1 & PLAYER_STATE1_4000000)) { if (((this->talkActor == NULL) || !(this->talkActor->flags & ACTOR_FLAG_10000))) { @@ -6600,12 +6956,12 @@ void func_808379C0(PlayState* play, Player* this) { PlayerAnimationHeader* anim; if ((interactRangeActor->id == ACTOR_EN_ISHI) && (ENISHI_GET_1(interactRangeActor) != 0)) { - Player_SetAction(play, this, func_8084E334, 0); + Player_SetAction(play, this, Player_Action_38, 0); anim = &gPlayerAnim_link_silver_carry; } else if (((interactRangeActor->id == ACTOR_EN_BOMBF) || (interactRangeActor->id == ACTOR_EN_KUSA) || (interactRangeActor->id == ACTOR_EN_KUSA2) || (interactRangeActor->id == ACTOR_OBJ_GRASS_CARRY)) && (Player_GetStrength() <= PLAYER_STRENGTH_DEKU)) { - Player_SetAction(play, this, func_8084E4E4, 0); + Player_SetAction(play, this, Player_Action_40, 0); anim = &gPlayerAnim_link_normal_nocarry_free; this->actor.world.pos.x = @@ -6615,7 +6971,7 @@ void func_808379C0(PlayState* play, Player* this) { this->currentYaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; } else { - Player_SetAction(play, this, func_8084E25C, 0); + Player_SetAction(play, this, Player_Action_37, 0); anim = D_8085BE84[PLAYER_ANIMGROUP_12][this->modelAnimType]; } @@ -6627,43 +6983,43 @@ void func_808379C0(PlayState* play, Player* this) { } void func_80837B60(PlayState* play, Player* this) { - func_8083172C(play, this, func_8084E980, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_44, 0); - this->exchangeItemId = PLAYER_IA_NONE; + this->exchangeItemAction = PLAYER_IA_NONE; this->stateFlags1 |= (PLAYER_STATE1_40 | PLAYER_STATE1_20000000); if (this->actor.textId != 0) { Message_StartTextbox(play, this->actor.textId, this->talkActor); } - this->targetedActor = this->talkActor; + this->lockOnActor = this->talkActor; } void func_80837BD0(PlayState* play, Player* this) { - func_8083172C(play, this, func_8084FE7C, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_52, 0); } void func_80837BF8(PlayState* play, Player* this) { - Player_SetAction(play, this, func_8084ED9C, 0); + Player_SetAction(play, this, Player_Action_45, 0); } void func_80837C20(PlayState* play, Player* this) { - s32 sp1C = this->unk_AE8; - s32 sp18 = this->unk_AE7; + s32 sp1C = this->actionVar2; + s32 sp18 = this->actionVar1; - func_8083172C(play, this, func_8084F4E8, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_50, 0); this->actor.velocity.y = 0.0f; - this->unk_AE8 = sp1C; - this->unk_AE7 = sp18; + this->actionVar2 = sp1C; + this->actionVar1 = sp18; } void func_80837C78(PlayState* play, Player* this) { - func_8083172C(play, this, func_80852C04, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_65, 0); this->stateFlags1 |= (PLAYER_STATE1_400 | PLAYER_STATE1_20000000); if (this->getItemId == GI_HEART_CONTAINER) { - this->unk_AE8 = 20; + this->actionVar2 = 20; } else if (this->getItemId >= GI_NONE) { - this->unk_AE8 = 1; + this->actionVar2 = 1; } else { this->getItemId = -this->getItemId; } @@ -6673,7 +7029,7 @@ void func_80837CEC(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, f32 nx = COLPOLY_GET_NORMAL(arg2->normal.x); f32 nz = COLPOLY_GET_NORMAL(arg2->normal.z); - Player_SetAction(play, this, func_8084F1B8, 0); + Player_SetAction(play, this, Player_Action_48, 0); func_8082DE50(play, this); Player_AnimationPlayOnce(play, this, anim); @@ -6690,7 +7046,11 @@ void func_80837CEC(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, s32 func_80837DEC(Player* this, PlayState* play) { if ((this->transformation != PLAYER_FORM_GORON) && (this->transformation != PLAYER_FORM_DEKU) && (this->actor.depthInWater < -80.0f)) { - if ((ABS_ALT(this->unk_B6C)) < 0xAAA && (ABS_ALT(this->unk_B6E) < 0xAAA)) { + //! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, + //! because the player left the ground. The angles will always be zero and therefore will always + //! pass these checks. The intention seems to be to prevent ledge hanging or vine grabbing when + //! walking off of a steep enough slope. + if ((ABS_ALT(this->floorPitch) < 0xAAA) && (ABS_ALT(this->floorPitchAlt) < 0xAAA)) { CollisionPoly* entityPoly; CollisionPoly* sp90; s32 entityBgId; @@ -6737,7 +7097,7 @@ s32 func_80837DEC(Player* this, PlayState* play) { temp_fv1_2 = this->actor.world.pos.y - BgCheck_EntityRaycastFloor5(&play->colCtx, &sp90, &sp88, &this->actor, &sp70); if ((temp_fv1_2 >= -11.0f) && (temp_fv1_2 <= 0.0f)) { - var_v1_2 = sPlayerPrevFloorProperty == FLOOR_PROPERTY_6; + var_v1_2 = (sPlayerPrevFloorProperty == FLOOR_PROPERTY_6); if (!var_v1_2) { if (SurfaceType_GetWallFlags(&play->colCtx, entityPoly, entityBgId) & WALL_FLAG_3) { var_v1_2 = true; @@ -6755,8 +7115,8 @@ s32 func_80837DEC(Player* this, PlayState* play) { func_8082E920(play, this, ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); - this->unk_AE8 = -1; - this->unk_AE7 = var_v1_2; + this->actionVar2 = -1; + this->actionVar1 = var_v1_2; } else { this->stateFlags1 |= PLAYER_STATE1_2000; this->stateFlags1 &= ~PLAYER_STATE1_20000; @@ -6775,7 +7135,7 @@ s32 func_80837DEC(Player* this, PlayState* play) { } void func_808381A0(Player* this, PlayerAnimationHeader* anim, PlayState* play) { - Player_SetAction(play, this, func_8084F3DC, 0); + Player_SetAction(play, this, Player_Action_49, 0); PlayerAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); } @@ -6824,9 +7184,9 @@ void func_8083827C(Player* this, PlayState* play) { return; } - if ((func_8084C16C == this->actionFunc) || (func_8084C94C == this->actionFunc) || - (func_8084CA24 == this->actionFunc) || (func_80857BE8 == this->actionFunc) || - (func_808546D0 == this->actionFunc) || (func_80854800 == this->actionFunc)) { + if ((Player_Action_25 == this->actionFunc) || (Player_Action_27 == this->actionFunc) || + (Player_Action_28 == this->actionFunc) || (Player_Action_96 == this->actionFunc) || + (Player_Action_82 == this->actionFunc) || (Player_Action_83 == this->actionFunc)) { return; } @@ -6841,16 +7201,16 @@ void func_8083827C(Player* this, PlayState* play) { } temp_t0 = BINANG_SUB(this->currentYaw, this->actor.shape.rot.y); - Player_SetAction(play, this, func_8084C16C, 1); + Player_SetAction(play, this, Player_Action_25, 1); func_8082DD2C(play, this); - this->floorSfxOffset = this->unk_D66; + this->floorSfxOffset = this->prevFloorSfxOffset; if ((this->transformation != PLAYER_FORM_GORON) && ((this->transformation != PLAYER_FORM_DEKU) || (this->remainingHopsCounter != 0)) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE)) { if (!(this->stateFlags1 & PLAYER_STATE1_8000000)) { if ((sPlayerPrevFloorProperty != FLOOR_PROPERTY_6) && (sPlayerPrevFloorProperty != FLOOR_PROPERTY_9) && - (D_80862B18 > 20.0f) && (this->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0)) { + (sPlayerYDistToFloor > 20.0f) && (this->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0)) { if ((ABS_ALT(temp_t0) < 0x2000) && (this->linearVelocity > 3.0f)) { if (!(this->stateFlags1 & PLAYER_STATE1_800)) { if (((this->transformation == PLAYER_FORM_ZORA) && @@ -6865,7 +7225,7 @@ void func_8083827C(Player* this, PlayState* play) { if (WaterBox_GetSurface1(play, &play->colCtx, sp4C.x, sp4C.z, &sp44, &sp58) && ((sp44 - sp48) > 50.0f)) { func_80834DB8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); - Player_SetAction(play, this, func_8084C94C, 0); + Player_SetAction(play, this, Player_Action_27, 0); return; } } @@ -6878,7 +7238,7 @@ void func_8083827C(Player* this, PlayState* play) { } // Checking if the ledge is tall enough for Player to hang from - if ((sPlayerPrevFloorProperty == FLOOR_PROPERTY_9) || (D_80862B18 <= this->ageProperties->unk_34) || + if ((sPlayerPrevFloorProperty == FLOOR_PROPERTY_9) || (sPlayerYDistToFloor <= this->ageProperties->unk_34) || !func_80837DEC(this, play)) { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); } @@ -6925,8 +7285,8 @@ s32 func_808387A0(PlayState* play, Player* this) { if (this->unk_AA5 == PLAYER_UNKAA5_4) { Player_StopCutscene(this); this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; - Player_SetAction(play, this, func_8085B08C, 0); - if (this->doorBgCamIndex != 0) { + Player_SetAction(play, this, Player_Action_97, 0); + if (this->unk_3BA) { this->stateFlags1 |= PLAYER_STATE1_20000000; } func_8082DC38(this); @@ -6958,25 +7318,25 @@ PlayerAnimationHeader* D_8085D160[PLAYER_FORM_MAX] = { void func_808388B8(PlayState* play, Player* this, PlayerTransformation playerForm) { func_8082DE50(play, this); - func_80831760(play, this, func_808553F4, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_86, 0); func_8082E4A4(play, this, D_8085D160[this->transformation]); gSaveContext.save.playerForm = playerForm; this->stateFlags1 |= PLAYER_STATE1_2; - D_80862B50 = play->envCtx.lightSettings; + D_80862B50 = play->envCtx.adjLightSettings; this->actor.velocity.y = 0.0f; Actor_DeactivateLens(play); } void func_808389BC(PlayState* play, Player* this) { - func_80831760(play, this, func_80855AF4, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_89, 0); func_8082E4A4(play, this, &gPlayerAnim_cl_setmask); this->stateFlags1 |= (PLAYER_STATE1_100 | PLAYER_STATE1_20000000); func_8082DAD4(this); } void func_80838A20(PlayState* play, Player* this) { - func_80831760(play, this, func_80855B9C, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_90, 0); func_8082DB90(play, this, &gPlayerAnim_cl_maskoff); this->currentMask = PLAYER_MASK_NONE; this->stateFlags1 |= (PLAYER_STATE1_100 | PLAYER_STATE1_20000000); @@ -7015,7 +7375,7 @@ u8 D_8085D1A4[PLAYER_IA_MAX] = { GI_SWORD_RAZOR, // PLAYER_IA_SWORD_RAZOR GI_SWORD_GILDED, // PLAYER_IA_SWORD_GILDED GI_SWORD_GREAT_FAIRY, // PLAYER_IA_SWORD_TWO_HANDED - GI_STICKS_1, // PLAYER_IA_STICK + GI_DEKU_STICKS_1, // PLAYER_IA_DEKU_STICK GI_SWORD_KOKIRI, // PLAYER_IA_ZORA_FINS GI_QUIVER_30, // PLAYER_IA_BOW GI_ARROW_FIRE, // PLAYER_IA_BOW_FIRE @@ -7026,9 +7386,9 @@ u8 D_8085D1A4[PLAYER_IA_MAX] = { GI_POWDER_KEG, // PLAYER_IA_POWDER_KEG GI_BOMBCHUS_10, // PLAYER_IA_BOMBCHU GI_40, // PLAYER_IA_11 - GI_NUTS_1, // PLAYER_IA_NUT - GI_PICTO_BOX, // PLAYER_IA_PICTO_BOX - GI_OCARINA, // PLAYER_IA_OCARINA + GI_DEKU_NUTS_1, // PLAYER_IA_DEKU_NUT + GI_PICTOGRAPH_BOX, // PLAYER_IA_PICTOGRAPH_BOX + GI_OCARINA_OF_TIME, // PLAYER_IA_OCARINA GI_BOTTLE, // PLAYER_IA_BOTTLE_EMPTY GI_FISH, // PLAYER_IA_BOTTLE_FISH GI_75, // PLAYER_IA_BOTTLE_SPRING_WATER @@ -7050,7 +7410,7 @@ u8 D_8085D1A4[PLAYER_IA_MAX] = { GI_MILK_HALF, // PLAYER_IA_BOTTLE_MILK_HALF GI_CHATEAU, // PLAYER_IA_BOTTLE_CHATEAU GI_FAIRY, // PLAYER_IA_BOTTLE_FAIRY - GI_MOON_TEAR, // PLAYER_IA_MOON_TEAR + GI_MOONS_TEAR, // PLAYER_IA_MOONS_TEAR GI_DEED_LAND, // PLAYER_IA_DEED_LAND GI_ROOM_KEY, // PLAYER_IA_ROOM_KEY GI_LETTER_TO_KAFEI, // PLAYER_IA_LETTER_TO_KAFEI @@ -7058,7 +7418,7 @@ u8 D_8085D1A4[PLAYER_IA_MAX] = { GI_DEED_SWAMP, // PLAYER_IA_DEED_SWAMP GI_DEED_MOUNTAIN, // PLAYER_IA_DEED_MOUNTAIN GI_DEED_OCEAN, // PLAYER_IA_DEED_OCEAN - GI_MOON_TEAR, // PLAYER_IA_32 + GI_MOONS_TEAR, // PLAYER_IA_32 GI_LETTER_TO_MAMA, // PLAYER_IA_LETTER_MAMA GI_A7, // PLAYER_IA_34 GI_A8, // PLAYER_IA_35 @@ -7090,7 +7450,7 @@ u8 D_8085D1A4[PLAYER_IA_MAX] = { GI_MASK_GORON, // PLAYER_IA_MASK_GORON GI_MASK_ZORA, // PLAYER_IA_MASK_ZORA GI_MASK_DEKU, // PLAYER_IA_MASK_DEKU - GI_LENS, // PLAYER_IA_LENS + GI_LENS_OF_TRUTH, // PLAYER_IA_LENS_OF_TRUTH }; PlayerAnimationHeader* D_8085D1F8[] = { @@ -7098,7 +7458,7 @@ PlayerAnimationHeader* D_8085D1F8[] = { &gPlayerAnim_link_normal_take_out, // Hold up cutscene item; "this item doesn't work here" }; -s32 func_80838A90(Player* this, PlayState* play) { +s32 Player_ActionChange_13(Player* this, PlayState* play) { PlayerBottle bottleAction; if (this->unk_AA5 != PLAYER_UNKAA5_0) { @@ -7115,7 +7475,7 @@ s32 func_80838A90(Player* this, PlayState* play) { PlayerMask maskId = GET_MASK_FROM_IA(this->itemAction); this->prevMask = this->currentMask; - if (((maskId == this->currentMask) != 0) || (this->itemAction < PLAYER_IA_MASK_GIANT) || + if ((u32)(maskId == this->currentMask) || (this->itemAction < PLAYER_IA_MASK_GIANT) || ((this->itemAction == PLAYER_IA_MASK_GIANT) && (this->transformation != PLAYER_FORM_HUMAN))) { if (maskId == this->currentMask) { this->currentMask = PLAYER_MASK_NONE; @@ -7139,35 +7499,35 @@ s32 func_80838A90(Player* this, PlayState* play) { } gSaveContext.save.equippedMask = this->currentMask; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK_REQUESTED) || - (this->itemAction == PLAYER_IA_PICTO_BOX) || + (this->itemAction == PLAYER_IA_PICTOGRAPH_BOX) || ((this->itemAction != this->unk_B2B) && ((this->itemAction == PLAYER_IA_BOTTLE_BIG_POE) || ((this->itemAction >= PLAYER_IA_BOTTLE_ZORA_EGG) && (this->itemAction <= PLAYER_IA_BOTTLE_HYLIAN_LOACH)) || (this->itemAction > PLAYER_IA_BOTTLE_FAIRY) || - ((this->talkActor != NULL) && (this->exchangeItemId > PLAYER_IA_NONE) && - (((this->exchangeItemId == PLAYER_IA_MAGIC_BEANS) && + ((this->talkActor != NULL) && (this->exchangeItemAction > PLAYER_IA_NONE) && + (((this->exchangeItemAction == PLAYER_IA_MAGIC_BEANS) && (this->itemAction == PLAYER_IA_MAGIC_BEANS)) || - ((this->exchangeItemId != PLAYER_IA_MAGIC_BEANS) && + ((this->exchangeItemAction != PLAYER_IA_MAGIC_BEANS) && (Player_BottleFromIA(this, this->itemAction) > PLAYER_BOTTLE_NONE))))))) { Actor* talkActor; s32 heldItemTemp = this->itemAction; Player_StopCutscene(this); this->itemAction = PLAYER_IA_NONE; - func_80831760(play, this, func_80853A5C, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_71, 0); talkActor = this->talkActor; this->itemAction = heldItemTemp; this->csId = CS_ID_NONE; - if ((talkActor != NULL) && (((this->exchangeItemId == PLAYER_IA_MAGIC_BEANS) && + if ((talkActor != NULL) && (((this->exchangeItemAction == PLAYER_IA_MAGIC_BEANS) && (this->itemAction == PLAYER_IA_MAGIC_BEANS)) || - ((this->exchangeItemId != PLAYER_IA_MAGIC_BEANS) && - (this->exchangeItemId > PLAYER_IA_NONE)))) { + ((this->exchangeItemAction != PLAYER_IA_MAGIC_BEANS) && + (this->exchangeItemAction > PLAYER_IA_NONE)))) { this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_40); - if (this->exchangeItemId == PLAYER_IA_MAGIC_BEANS) { + if (this->exchangeItemAction == PLAYER_IA_MAGIC_BEANS) { Inventory_ChangeAmmo(ITEM_MAGIC_BEANS, -1); - func_80831760(play, this, func_8084B4A8, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_17, 0); this->currentYaw = talkActor->yawTowardsPlayer + 0x8000; this->actor.shape.rot.y = this->currentYaw; if (talkActor->xzDistToPlayer < 40.0f) { @@ -7177,26 +7537,26 @@ s32 func_80838A90(Player* this, PlayState* play) { func_8082E438(play, this, D_8085BE84[31][this->modelAnimType]); } this->stateFlags1 |= PLAYER_STATE1_20000000; - this->unk_AE8 = 80; - this->unk_AE7 = -1; - this->targetedActor = this->talkActor; + this->actionVar2 = 80; + this->actionVar1 = -1; + this->lockOnActor = this->talkActor; } else { this->csId = CS_ID_GLOBAL_TALK; } talkActor->flags |= ACTOR_FLAG_TALK_REQUESTED; this->actor.textId = 0; - this->targetedActor = this->talkActor; + this->lockOnActor = this->talkActor; } else { this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_10000000 | PLAYER_STATE1_40); this->csId = play->playerCsIds[PLAYER_CS_ID_ITEM_SHOW]; - this->unk_AE7 = 1; + this->actionVar1 = 1; this->actor.textId = 0xFE; } this->actor.flags |= ACTOR_FLAG_TALK_REQUESTED; - this->exchangeItemId = this->itemAction; - if (this->unk_AE7 >= 0) { - Player_AnimationPlayOnce(play, this, D_8085D1F8[this->unk_AE7]); + this->exchangeItemAction = this->itemAction; + if (this->actionVar1 >= 0) { + Player_AnimationPlayOnce(play, this, D_8085D1F8[this->actionVar1]); } func_8082DAD4(this); return true; @@ -7206,14 +7566,14 @@ s32 func_80838A90(Player* this, PlayState* play) { if (bottleAction > PLAYER_BOTTLE_NONE) { Player_StopCutscene(this); if (bottleAction >= PLAYER_BOTTLE_FAIRY) { - func_80831760(play, this, func_80853754, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_69, 0); func_8082DB90(play, this, &gPlayerAnim_link_bottle_bug_out); } else if ((bottleAction > PLAYER_BOTTLE_EMPTY) && (bottleAction < PLAYER_BOTTLE_POE)) { - func_80831760(play, this, func_80853850, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_70, 0); func_8082DB90(play, this, &gPlayerAnim_link_bottle_fish_out); this->csId = play->playerCsIds[PLAYER_CS_ID_ITEM_BOTTLE]; } else { - func_80831760(play, this, func_80853194, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_67, 0); func_8082E4A4(play, this, (this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_drinkstart @@ -7230,7 +7590,7 @@ s32 func_80838A90(Player* this, PlayState* play) { } else { this->csId = CS_ID_NONE; } - func_80831760(play, this, func_8085269C, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_63, 0); if ((this->skelAnime.playSpeed < 0.0f) || ((this->skelAnime.animation != D_8085D17C[this->transformation]) && (this->skelAnime.animation != D_8085D190[this->transformation]))) { @@ -7251,20 +7611,20 @@ s32 func_80838A90(Player* this, PlayState* play) { if (func_8083868C(play, this) != CAM_MODE_NORMAL) { Player_StopCutscene(this); if (!(this->stateFlags1 & PLAYER_STATE1_800000)) { - Player_SetAction(play, this, func_8084E724, 1); - this->unk_AE8 = 13; + Player_SetAction(play, this, Player_Action_43, 1); + this->actionVar2 = 13; func_80836D8C(this); if (this->unk_AA5 == PLAYER_UNKAA5_2) { play->actorCtx.flags |= ACTORCTX_FLAG_PICTO_BOX_ON; } } this->stateFlags1 |= PLAYER_STATE1_100000; - play_sound(NA_SE_SY_CAMERA_ZOOM_UP); + Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP); Player_StopHorizontalMovement(this); return true; } this->unk_AA5 = PLAYER_UNKAA5_0; - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return false; } this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_10000000); @@ -7275,18 +7635,18 @@ s32 func_80838A90(Player* this, PlayState* play) { return false; } -s32 func_808391D8(Player* this, PlayState* play) { +s32 Player_ActionChange_4(Player* this, PlayState* play) { if (gSaveContext.save.saveInfo.playerData.health != 0) { Actor* talkActor = this->talkActor; - Actor* targetedActor = this->targetedActor; + Actor* lockOnActor = this->lockOnActor; Actor* var_a1 = NULL; s32 var_t1 = false; s32 var_t2 = false; if (this->tatlActor != NULL) { - var_t2 = - (targetedActor != NULL) && (CHECK_FLAG_ALL(targetedActor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_40000) || - (targetedActor->hintId != TATL_HINT_ID_NONE)); + var_t2 = (lockOnActor != NULL) && + (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_40000) || + (lockOnActor->hintId != TATL_HINT_ID_NONE)); if (var_t2 || (this->tatlTextId != 0)) { //! @bug The comparison `((ABS_ALT(this->tatlTextId) & 0xFF00) != 0x10000)` always evaluates to `true` @@ -7295,17 +7655,17 @@ s32 func_808391D8(Player* this, PlayState* play) { if (var_t1 || !var_t2) { var_a1 = this->tatlActor; if (var_t1) { - targetedActor = NULL; + lockOnActor = NULL; talkActor = NULL; } } else { - var_a1 = targetedActor; + var_a1 = lockOnActor; } } } if ((talkActor != NULL) || (var_a1 != NULL)) { - if ((targetedActor == NULL) || (targetedActor == talkActor) || (targetedActor == var_a1)) { + if ((lockOnActor == NULL) || (lockOnActor == talkActor) || (lockOnActor == var_a1)) { if (!(this->stateFlags1 & PLAYER_STATE1_800) || ((this->heldActor != NULL) && (var_t1 || (talkActor == this->heldActor) || (var_a1 == this->heldActor) || @@ -7313,7 +7673,7 @@ s32 func_808391D8(Player* this, PlayState* play) { if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_800000) || func_801242B4(this))) { if (talkActor != NULL) { - if ((targetedActor == NULL) || (targetedActor == talkActor)) { + if ((lockOnActor == NULL) || (lockOnActor == talkActor)) { this->stateFlags2 |= PLAYER_STATE2_2; } @@ -7361,18 +7721,18 @@ s32 func_808391D8(Player* this, PlayState* play) { return false; } -s32 func_80839518(Player* this, PlayState* play) { +s32 Player_ActionChange_0(Player* this, PlayState* play) { if (this->unk_AA5 != PLAYER_UNKAA5_0) { - func_80838A90(this, play); + Player_ActionChange_13(this, play); return true; - } else if ((this->targetedActor != NULL) && - (CHECK_FLAG_ALL(this->targetedActor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_40000) || - (this->targetedActor->hintId != TATL_HINT_ID_NONE))) { + } else if ((this->lockOnActor != NULL) && + (CHECK_FLAG_ALL(this->lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_40000) || + (this->lockOnActor->hintId != TATL_HINT_ID_NONE))) { this->stateFlags2 |= PLAYER_STATE2_200000; } else if ((this->tatlTextId == 0) && !func_80123420(this) && CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_CUP) && !func_80831814(this, play, PLAYER_UNKAA5_1)) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); } return false; } @@ -7387,7 +7747,7 @@ void func_808395F0(PlayState* play, Player* this, PlayerMeleeWeaponAnimation mel } func_80833864(play, this, meleeWeaponAnim); - Player_SetAction(play, this, func_8084CB58, 0); + Player_SetAction(play, this, Player_Action_29, 0); this->stateFlags3 |= PLAYER_STATE3_2; this->linearVelocity = linearVelocity; this->currentYaw = this->actor.shape.rot.y; @@ -7403,7 +7763,7 @@ s32 func_808396B8(PlayState* play, Player* this) { ((Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && ((this->transformation != PLAYER_FORM_GORON) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) && ((this->transformation != PLAYER_FORM_ZORA) || !(this->stateFlags1 & PLAYER_STATE1_2000000)) && - (D_80862B48 != 0)))) { + sPlayerUseHeldItem))) { return true; } @@ -7412,7 +7772,7 @@ s32 func_808396B8(PlayState* play, Player* this) { s32 func_80839770(Player* this, PlayState* play) { if (func_808396B8(play, this)) { - if ((this->transformation != PLAYER_FORM_GORON) && (sPlayerCurrentFloorType != FLOOR_TYPE_7)) { + if ((this->transformation != PLAYER_FORM_GORON) && (sPlayerFloorType != FLOOR_TYPE_7)) { func_808395F0(play, this, (this->transformation == PLAYER_FORM_ZORA) ? PLAYER_MWA_ZORA_JUMPKICK_START : PLAYER_MWA_JUMPSLASH_START, @@ -7424,7 +7784,7 @@ s32 func_80839770(Player* this, PlayState* play) { } s32 func_80839800(Player* this, PlayState* play) { - if ((this->unk_AE3[this->unk_ADE] == 0) && (sPlayerCurrentFloorType != FLOOR_TYPE_7)) { + if ((this->unk_AE3[this->unk_ADE] == 0) && (sPlayerFloorType != FLOOR_TYPE_7)) { func_80836B3C(play, this, 0.0f); return true; } @@ -7444,8 +7804,8 @@ void func_80839860(Player* this, PlayState* play, s32 arg2) { func_80834D50(play, this, D_8085C2A4[arg2].unk_0, speed, NA_SE_VO_LI_SWORD_N); - this->unk_AE8 = 1; - this->unk_AE7 = arg2; + this->actionVar2 = 1; + this->actionVar1 = arg2; this->currentYaw = this->actor.shape.rot.y + (arg2 << 0xE); this->linearVelocity = !(arg2 & 1) ? 6.0f : 8.5f; @@ -7457,7 +7817,7 @@ void func_80839860(Player* this, PlayState* play, s32 arg2) { void func_80839978(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->itemAction = PLAYER_IA_OCARINA; - func_80831760(play, this, func_8084AC84, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_11, 0); func_8082DB60(play, this, &gPlayerAnim_clink_normal_okarina_walk); func_8082E920(play, this, ANIM_FLAG_4 | ANIM_FLAG_200); this->stateFlags3 |= PLAYER_STATE3_20000000; @@ -7469,7 +7829,7 @@ void func_80839978(PlayState* play, Player* this) { void func_80839A10(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->itemAction = PLAYER_IA_NONE; - func_80831760(play, this, func_8084AEEC, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_12, 0); func_8082DB60(play, this, &gPlayerAnim_alink_dance_loop); this->stateFlags2 |= PLAYER_STATE2_2000000; Audio_PlayFanfare(NA_BGM_KAMARO_DANCE); @@ -7485,17 +7845,17 @@ s32 func_80839A84(PlayState* play, Player* this) { return false; } - Player_SetAction(play, this, func_808573A4, 0); + Player_SetAction(play, this, Player_Action_95, 0); this->stateFlags1 &= ~(PLAYER_STATE1_20000 | PLAYER_STATE1_40000000); this->unk_ADC = 4; func_808373A4(play, this); return true; } -s32 func_80839B18(Player* this, PlayState* play) { +s32 Player_ActionChange_10(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) && - (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sPlayerCurrentFloorType != FLOOR_TYPE_7) && - (D_80862B40 != FLOOR_EFFECT_1)) { + (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sPlayerFloorType != FLOOR_TYPE_7) && + (sPlayerFloorEffect != FLOOR_EFFECT_1)) { s32 temp_a2 = this->unk_AE3[this->unk_ADE]; if (temp_a2 <= 0) { @@ -7507,8 +7867,8 @@ s32 func_80839B18(Player* this, PlayState* play) { func_80836B3C(play, this, 0.0f); } } else if (!(this->stateFlags1 & PLAYER_STATE1_8000000) && - (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && func_80832090(this) && - (this->transformation != PLAYER_FORM_GORON)) { + (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && + Player_CanUpdateItems(this) && (this->transformation != PLAYER_FORM_GORON)) { func_808395F0(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); } else if (!func_80839A84(play, this)) { func_80836B3C(play, this, 0.0f); @@ -7560,13 +7920,13 @@ void func_80839E3C(Player* this, PlayState* play) { } void func_80839E74(Player* this, PlayState* play) { - Player_SetAction(play, this, func_80849FE0, 1); + Player_SetAction(play, this, Player_Action_4, 1); Player_AnimationPlayOnce(play, this, func_8082ED20(this)); this->currentYaw = this->actor.shape.rot.y; } void func_80839ED0(Player* this, PlayState* play) { - if (!(this->stateFlags3 & PLAYER_STATE3_80) && (func_80852B28 != this->actionFunc) && !func_8083213C(this)) { + if (!(this->stateFlags3 & PLAYER_STATE3_80) && (Player_Action_64 != this->actionFunc) && !func_8083213C(this)) { func_80836D8C(this); if (!(this->stateFlags1 & PLAYER_STATE1_40)) { if (func_801242B4(this)) { @@ -7602,8 +7962,8 @@ void func_8083A04C(Player* this) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { this->currentBoots = PLAYER_BOOTS_ZORA_LAND; } - if (func_808508C8 == this->actionFunc) { - this->unk_AE8 = 20; + if (Player_Action_54 == this->actionFunc) { + this->actionVar2 = 20; } } else { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_B)) { @@ -7612,14 +7972,14 @@ void func_8083A04C(Player* this) { } } -s32 func_8083A0CC(Player* this, PlayState* play) { +s32 Player_ActionChange_14(Player* this, PlayState* play) { if (!D_80862B04 && (this->transformation == PLAYER_FORM_ZORA)) { func_8083A04C(this); } return false; } -s32 func_8083A114(Player* this, PlayState* play) { +s32 Player_ActionChange_6(Player* this, PlayState* play) { if (!D_80862B04 && !(this->stateFlags1 & PLAYER_STATE1_800000) && !func_8082FB68(this)) { if ((this->transformation == PLAYER_FORM_ZORA) && (this->stateFlags1 & PLAYER_STATE1_8000000)) { func_8083A04C(this); @@ -7634,7 +7994,7 @@ s32 func_8083A114(Player* this, PlayState* play) { if ((this->putAwayCountdown == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_KOKIRI) && (this->transformation != PLAYER_FORM_FIERCE_DEITY)) { - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); } else { this->stateFlags2 ^= PLAYER_STATE2_100000; } @@ -7644,16 +8004,16 @@ s32 func_8083A114(Player* this, PlayState* play) { return false; } -s32 func_8083A274(Player* this, PlayState* play) { +s32 Player_ActionChange_11(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_R) && (this->unk_AA5 == PLAYER_UNKAA5_0) && (play->unk_1887C == 0)) { if (Player_IsGoronOrDeku(this) || ((((this->transformation == PLAYER_FORM_ZORA) && !(this->stateFlags1 & PLAYER_STATE1_2000000)) || ((this->transformation == PLAYER_FORM_HUMAN) && (this->currentShield != PLAYER_SHIELD_NONE))) && - !func_80123434(this) && (this->targetedActor == NULL))) { + !func_80123434(this) && (this->lockOnActor == NULL))) { func_8082DC38(this); - func_8082DCA0(play, this); - if (Player_SetAction(play, this, func_8084B5C0, 0)) { + Player_DetachHeldActor(play, this); + if (Player_SetAction(play, this, Player_Action_18, 0)) { this->stateFlags1 |= PLAYER_STATE1_400000; if (this->transformation != PLAYER_FORM_GORON) { PlayerAnimationHeader* anim; @@ -7714,12 +8074,12 @@ void func_8083A548(Player* this) { } } -s32 func_8083A580(Player* this, PlayState* play) { +s32 Player_ActionChange_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_400000) && (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE)) { if ((this->unk_ADC > 0) && (((this->transformation == PLAYER_FORM_ZORA)) || - ((this->unk_ADC == 1) && (this->heldItemAction != PLAYER_IA_STICK)))) { + ((this->unk_ADC == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)))) { if (this->transformation == PLAYER_FORM_ZORA) { func_80830E30(this, play); } else { @@ -7736,7 +8096,7 @@ s32 func_8083A580(Player* this, PlayState* play) { s32 func_8083A658(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - Player_SetAction(play, this, func_80852B28, 0); + Player_SetAction(play, this, Player_Action_64, 0); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_light_bom); this->unk_AA5 = PLAYER_UNKAA5_0; return true; @@ -7750,13 +8110,13 @@ struct_8085D200 D_8085D200[] = { }; s32 func_8083A6C0(PlayState* play, Player* this) { - if (D_80862B48 != 0) { + if (sPlayerUseHeldItem) { if (Player_GetBottleHeld(this) > PLAYER_BOTTLE_NONE) { - Player_SetAction(play, this, func_808534C0, 0); + Player_SetAction(play, this, Player_Action_68, 0); if (this->actor.depthInWater > 12.0f) { - this->unk_AE8 = 1; + this->actionVar2 = 1; } - func_8082DB90(play, this, D_8085D200[this->unk_AE8].unk_0); + func_8082DB90(play, this, D_8085D200[this->actionVar2].unk_0); Player_PlaySfx(this, NA_SE_IT_SWORD_SWING); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_AUTO_JUMP); return true; @@ -7767,14 +8127,14 @@ s32 func_8083A6C0(PlayState* play, Player* this) { } void func_8083A794(Player* this, PlayState* play) { - if ((func_8084AF9C != this->actionFunc) && (func_8084B0EC != this->actionFunc)) { + if ((Player_Action_13 != this->actionFunc) && (Player_Action_14 != this->actionFunc)) { this->unk_B70 = 0; this->unk_B34 = 0.0f; this->unk_B38 = 0.0f; func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_2][this->modelAnimType]); } - Player_SetAction(play, this, func_8082FBE8(this) ? func_8084B0EC : func_8084AF9C, 1); + Player_SetAction(play, this, func_8082FBE8(this) ? Player_Action_14 : Player_Action_13, 1); } void func_8083A844(Player* this, PlayState* play, s16 currentYaw) { @@ -7791,10 +8151,10 @@ s32 func_8083A878(PlayState* play, Player* this, f32 arg2) { &waterBox)) { ySurface -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= ySurface) { - Player_SetAction(play, this, func_80850B18, 0); + Player_SetAction(play, this, Player_Action_55, 0); func_8082E634(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= (PLAYER_STATE1_8000000 | PLAYER_STATE1_20000000); - this->unk_AE8 = 20; + this->actionVar2 = 20; this->linearVelocity = 2.0f; func_80123140(play, this); return false; @@ -7823,11 +8183,11 @@ void func_8083A98C(Actor* thisx, PlayState* play2) { return; } - if (DECR(this->unk_AE8) != 0) { + if (DECR(this->actionVar2) != 0) { camMode = (play->sceneId != SCENE_AYASHIISHOP) ? CAM_MODE_FIRSTPERSON : CAM_MODE_DEKUHIDE; // Show controls overlay. SCENE_AYASHIISHOP does not have Zoom, so has a different one. - if (this->unk_AE8 == 1) { + if (this->actionVar2 == 1) { Message_StartTextbox(play, (play->sceneId == SCENE_AYASHIISHOP) ? 0x2A00 : 0x5E6, NULL); } } else { @@ -7860,8 +8220,8 @@ void func_8083A98C(Actor* thisx, PlayState* play2) { f32 focusDeltaX = (s16)(thisx->focus.rot.x - prevFocusX); f32 focusDeltaY = (s16)(thisx->focus.rot.y - prevFocusY); - func_8019FAD8(&gSfxDefaultPos, NA_SE_PL_TELESCOPE_MOVEMENT - SFX_FLAG, - sqrtf(SQ(focusDeltaX) + SQ(focusDeltaY)) / 300.0f); + Audio_PlaySfx_AtPosWithFreq(&gSfxDefaultPos, NA_SE_PL_TELESCOPE_MOVEMENT - SFX_FLAG, + sqrtf(SQ(focusDeltaX) + SQ(focusDeltaY)) / 300.0f); } } @@ -7907,15 +8267,15 @@ void Player_InitMode_Telescope(PlayState* play, Player* this) { if (play->sceneId == SCENE_00KEIKOKU) { this->actor.focus.rot.x = 0xBD8; this->actor.focus.rot.y = -0x4D74; - this->unk_AE8 = 20; + this->actionVar2 = 20; } else if (play->sceneId == SCENE_AYASHIISHOP) { this->actor.focus.rot.x = 0x9A6; this->actor.focus.rot.y = 0x2102; - this->unk_AE8 = 2; + this->actionVar2 = 2; } else { this->actor.focus.rot.x = 0x9A6; this->actor.focus.rot.y = 0x2102; - this->unk_AE8 = 20; + this->actionVar2 = 20; } play->actorCtx.flags |= ACTORCTX_FLAG_1; } @@ -7926,7 +8286,7 @@ void Player_InitMode_B(PlayState* play, Player* this) { void Player_InitMode_D(PlayState* play, Player* this) { if (func_8083A878(play, this, 180.0f)) { - this->unk_AE8 = -20; + this->actionVar2 = -20; } } @@ -7936,7 +8296,7 @@ void func_8083ADF0(PlayState* play, Player* this) { gSaveContext.entranceSpeed = 2.0f; if (func_8083A878(play, this, 120.0f)) { - this->unk_AE8 = -15; + this->actionVar2 = -15; } } @@ -7947,15 +8307,15 @@ void Player_InitMode_F(PlayState* play, Player* this) { this->linearVelocity = gSaveContext.entranceSpeed; if (func_8083A878(play, this, 800.0f)) { - this->unk_AE8 = -80.0f / this->linearVelocity; - if (this->unk_AE8 < -20) { - this->unk_AE8 = -20; + this->actionVar2 = -80.0f / this->linearVelocity; + if (this->actionVar2 < -20) { + this->actionVar2 = -20; } } } void func_8083AECC(Player* this, s16 currentYaw, PlayState* play) { - Player_SetAction(play, this, func_8084A5C0, 1); + Player_SetAction(play, this, Player_Action_6, 1); PlayerAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_B38 = 0.0f; this->unk_B34 = 0.0f; @@ -7963,12 +8323,12 @@ void func_8083AECC(Player* this, s16 currentYaw, PlayState* play) { } void func_8083AF30(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084A26C, 1); + Player_SetAction(play, this, Player_Action_5, 1); func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_1][this->modelAnimType]); } void func_8083AF8C(Player* this, s16 currentYaw, PlayState* play) { - Player_SetAction(play, this, func_8084B288, 1); + Player_SetAction(play, this, Player_Action_15, 1); PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_anchor_back_walk), ANIMMODE_ONCE, -6.0f); this->linearVelocity = 8.0f; @@ -7976,19 +8336,19 @@ void func_8083AF8C(Player* this, s16 currentYaw, PlayState* play) { } void func_8083B030(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084A8E8, 1); + Player_SetAction(play, this, Player_Action_9, 1); func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_24][this->modelAnimType]); this->unk_B38 = 0.0f; } void func_8083B090(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084B3B8, 1); + Player_SetAction(play, this, Player_Action_16, 1); PlayerAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 6.0f / 3.0f); } void func_8083B0E4(PlayState* play, Player* this, s16 currentYaw) { this->currentYaw = currentYaw; - Player_SetAction(play, this, func_8084AB4C, 1); + Player_SetAction(play, this, Player_Action_10, 1); this->unk_B4E = 1200; this->unk_B4E *= D_8085C3E4; PlayerAnimation_Change(play, &this->skelAnime, D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType], 1.0f, 0.0f, @@ -7998,7 +8358,7 @@ void func_8083B0E4(PlayState* play, Player* this, s16 currentYaw) { void func_8083B1A0(Player* this, PlayState* play) { PlayerAnimationHeader* anim; - Player_SetAction(play, this, func_80849FE0, 1); + Player_SetAction(play, this, Player_Action_4, 1); if (this->unk_B40 < 0.5f) { anim = D_8085BE84[PLAYER_ANIMGROUP_27][this->modelAnimType]; } else { @@ -8009,9 +8369,9 @@ void func_8083B1A0(Player* this, PlayState* play) { } void func_8083B23C(Player* this, PlayState* play) { - Player_SetAction(play, this, func_80849A9C, 1); + Player_SetAction(play, this, Player_Action_2, 1); func_8082E438(play, this, D_8085BE84[PLAYER_ANIMGROUP_6][this->modelAnimType]); - this->unk_AE8 = 1; + this->actionVar2 = 1; } void func_8083B29C(Player* this, PlayState* play) { @@ -8050,8 +8410,8 @@ s32 func_8083B3B4(PlayState* play, Player* this, Input* input) { ((ABS_ALT(this->unk_AAA) < 0x2EE0) && (this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) && ((s32)SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) <= CONVEYOR_SPEED_SLOW))))) { - if (func_8085B08C != this->actionFunc) { - Player_SetAction(play, this, func_808516B4, 0); + if (Player_Action_97 != this->actionFunc) { + Player_SetAction(play, this, Player_Action_59, 0); } Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_swimer_swim_deep_start); @@ -8069,7 +8429,7 @@ s32 func_8083B3B4(PlayState* play, Player* this, Input* input) { if ((this->transformation != PLAYER_FORM_DEKU) && ((this->stateFlags1 & PLAYER_STATE1_400) || ((this->stateFlags2 & PLAYER_STATE2_400) && - (((func_80850D68 != this->actionFunc) && !(this->stateFlags3 & PLAYER_STATE3_8000)) || + (((Player_Action_56 != this->actionFunc) && !(this->stateFlags3 & PLAYER_STATE3_8000)) || (this->unk_AAA < -0x1555)))) && ((this->actor.depthInWater - this->actor.velocity.y) < this->ageProperties->unk_30)) { s32 temp_v0_3; @@ -8082,7 +8442,7 @@ s32 func_8083B3B4(PlayState* play, Player* this, Input* input) { if (this->stateFlags3 & PLAYER_STATE3_8000) { sp2A = this->unk_B86[1]; sp24 = this->unk_B48 * 1.5f; - Player_SetAction(play, this, func_8084CA24, 1); + Player_SetAction(play, this, Player_Action_28, 1); this->stateFlags3 |= PLAYER_STATE3_8000; this->stateFlags1 &= ~PLAYER_STATE1_8000000; sp24 = CLAMP_MAX(sp24, 13.5f); @@ -8100,11 +8460,11 @@ s32 func_8083B3B4(PlayState* play, Player* this, Input* input) { } if (input != NULL) { - Player_SetAction(play, this, func_808519FC, 1); + Player_SetAction(play, this, Player_Action_60, 1); if (this->stateFlags1 & PLAYER_STATE1_400) { this->stateFlags1 |= (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_20000000); } - this->unk_AE8 = 2; + this->actionVar2 = 2; } func_8082E438(play, this, @@ -8117,7 +8477,7 @@ s32 func_8083B3B4(PlayState* play, Player* this, Input* input) { } void func_8083B73C(PlayState* play, Player* this, s16 currentYaw) { - Player_SetAction(play, this, func_808513EC, 0); + Player_SetAction(play, this, Player_Action_57, 0); func_8082E634(play, this, &gPlayerAnim_link_swimer_swim); this->actor.shape.rot.y = currentYaw; this->currentYaw = currentYaw; @@ -8125,13 +8485,13 @@ void func_8083B73C(PlayState* play, Player* this, s16 currentYaw) { void func_8083B798(PlayState* play, Player* this) { if (this->transformation == PLAYER_FORM_ZORA) { - Player_SetAction(play, this, func_808513EC, 0); + Player_SetAction(play, this, Player_Action_57, 0); PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim, 1.0f, Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim), 0.0f, ANIMMODE_LOOP, 0.0f); this->unk_B48 = 2.0f; } else { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); - this->unk_AE8 = 1; + this->actionVar2 = 1; } this->unk_AAA = 0x3E80; @@ -8140,7 +8500,7 @@ void func_8083B798(PlayState* play, Player* this) { void func_8083B850(PlayState* play, Player* this) { this->currentBoots = PLAYER_BOOTS_ZORA_LAND; this->prevBoots = PLAYER_BOOTS_ZORA_LAND; - Player_SetAction(play, this, func_80850D68, 0); + Player_SetAction(play, this, Player_Action_56, 0); this->unk_B48 = sqrtf(SQ(this->linearVelocity) + SQ(this->actor.velocity.y)); Player_OverrideBlureColors(play, this, 1, 8); this->currentBoots = PLAYER_BOOTS_ZORA_LAND; @@ -8160,25 +8520,25 @@ void func_8083B930(PlayState* play, Player* this) { PlayerAnimationHeader* var_a2; if ((this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - (func_80857BE8 == this->actionFunc)) { + (Player_Action_96 == this->actionFunc)) { func_8082DE50(play, this); - if (func_8084CA24 == this->actionFunc) { + if (Player_Action_28 == this->actionFunc) { func_8083B850(play, this); this->stateFlags3 |= PLAYER_STATE3_8000; - } else if ((this->transformation == PLAYER_FORM_ZORA) && (func_8084C94C == this->actionFunc)) { + } else if ((this->transformation == PLAYER_FORM_ZORA) && (Player_Action_27 == this->actionFunc)) { func_8083B850(play, this); this->stateFlags3 |= PLAYER_STATE3_8000; func_8082DB60(play, this, &gPlayerAnim_pz_fishswim); } else if ((this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) && (this->stateFlags2 & PLAYER_STATE2_400)) { this->stateFlags2 &= ~PLAYER_STATE2_400; func_8083B3B4(play, this, NULL); - this->unk_AE7 = 1; - } else if (func_8084C94C == this->actionFunc) { - Player_SetAction(play, this, func_808516B4, 0); + this->actionVar1 = 1; + } else if (Player_Action_27 == this->actionFunc) { + Player_SetAction(play, this, Player_Action_59, 0); func_8083B798(play, this); } else { - Player_SetAction(play, this, func_808508C8, 1); + Player_SetAction(play, this, Player_Action_54, 1); func_8082E438(play, this, (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ? &gPlayerAnim_link_swimer_wait2swim_wait : &gPlayerAnim_link_swimer_land2swim_wait); @@ -8214,8 +8574,9 @@ void func_8083BB4C(PlayState* play, Player* this) { } } - if ((this->actor.parent == NULL) && (func_8084D4EC != this->actionFunc) && (func_8084F3DC != this->actionFunc) && - ((func_8084CA24 != this->actionFunc) || (this->actor.velocity.y < -2.0f))) { + if ((this->actor.parent == NULL) && (Player_Action_33 != this->actionFunc) && + (Player_Action_49 != this->actionFunc) && + ((Player_Action_28 != this->actionFunc) || (this->actor.velocity.y < -2.0f))) { if (this->ageProperties->unk_2C < this->actor.depthInWater) { if (this->transformation == PLAYER_FORM_GORON) { func_80834140(play, this, &gPlayerAnim_link_swimer_swim_down); @@ -8234,14 +8595,14 @@ void func_8083BB4C(PlayState* play, Player* this) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; this->stateFlags1 |= PLAYER_STATE1_200; - play_sound(NA_SE_SY_DEKUNUTS_JUMP_FAILED); + Audio_PlaySfx(NA_SE_SY_DEKUNUTS_JUMP_FAILED); } else if ((this->unk_3CF == 0) && ((play->sceneId == SCENE_30GYOSON) || (play->sceneId == SCENE_31MISAKI) || (play->sceneId == SCENE_TORIDE))) { func_80169EFC(&play->state); func_808345C8(); } else { - Player_SetAction(play, this, func_808497A0, 0); + Player_SetAction(play, this, Player_Action_1, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; } func_8083B8D0(play, this); @@ -8249,16 +8610,16 @@ void func_8083BB4C(PlayState* play, Player* this) { } else if (!(this->stateFlags1 & PLAYER_STATE1_8000000) || (((this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) && - (func_8084E724 != this->actionFunc) && (func_80851B58 != this->actionFunc) && - (func_80851BD4 != this->actionFunc) && (func_808508C8 != this->actionFunc) && - (func_808513EC != this->actionFunc) && (func_80851588 != this->actionFunc) && - (func_808516B4 != this->actionFunc) && (func_808519FC != this->actionFunc) && - (func_80850B18 != this->actionFunc) && (func_80850D68 != this->actionFunc))) { + (Player_Action_43 != this->actionFunc) && (Player_Action_61 != this->actionFunc) && + (Player_Action_62 != this->actionFunc) && (Player_Action_54 != this->actionFunc) && + (Player_Action_57 != this->actionFunc) && (Player_Action_58 != this->actionFunc) && + (Player_Action_59 != this->actionFunc) && (Player_Action_60 != this->actionFunc) && + (Player_Action_55 != this->actionFunc) && (Player_Action_56 != this->actionFunc))) { func_8083B930(play, this); } } else if ((this->stateFlags1 & PLAYER_STATE1_8000000) && (this->actor.depthInWater < this->ageProperties->unk_24) && - (((func_80850D68 != this->actionFunc) && !(this->stateFlags3 & PLAYER_STATE3_8000)) || + (((Player_Action_56 != this->actionFunc) && !(this->stateFlags3 & PLAYER_STATE3_8000)) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { if (this->skelAnime.moveFlags == 0) { func_8083B0E4(play, this, this->actor.shape.rot.y); @@ -8277,11 +8638,10 @@ void func_8083BF54(PlayState* play, Player* this) { this->actor.gravity = REG(68) / 100.0f; var_a2 = false; - temp_v0 = func_808340D4(sPlayerCurrentFloorType); + temp_v0 = func_808340D4(sPlayerFloorType); - if (temp_v0 || - (((var_a2 = (sPlayerCurrentFloorType == FLOOR_TYPE_14) || (sPlayerCurrentFloorType == FLOOR_TYPE_15))) || - (sPlayerCurrentFloorType == FLOOR_TYPE_13))) { + if (temp_v0 || ((var_a2 = (sPlayerFloorType == FLOOR_TYPE_14) || (sPlayerFloorType == FLOOR_TYPE_15)) || + (sPlayerFloorType == FLOOR_TYPE_13))) { f32 temp_fv1_2; f32 var_fa1; f32 var_ft4; @@ -8290,9 +8650,9 @@ void func_8083BF54(PlayState* play, Player* this) { var_ft4 = fabsf(this->linearVelocity + D_80862B3C) * 20.0f; if (temp_v0) { - if (sPlayerCurrentFloorType == FLOOR_TYPE_4) { + if (sPlayerFloorType == FLOOR_TYPE_4) { var_fa1 = 1300.0f; - } else if (sPlayerCurrentFloorType == FLOOR_TYPE_7) { + } else if (sPlayerFloorType == FLOOR_TYPE_7) { var_fa1 = 20000.0f; var_ft4 = 0.0f; } else { @@ -8301,7 +8661,7 @@ void func_8083BF54(PlayState* play, Player* this) { } sfxId = NA_SE_PL_SINK_ON_SAND - SFX_FLAG; } else if (var_a2) { - if (sPlayerCurrentFloorType == FLOOR_TYPE_14) { + if (sPlayerFloorType == FLOOR_TYPE_14) { var_fa1 = 400.0f; var_ft4 *= 10.0f; } else { @@ -8317,7 +8677,7 @@ void func_8083BF54(PlayState* play, Player* this) { var_fa1 = CLAMP_MIN(var_fa1, this->unk_AB8); - var_fv0 = (sPlayerCurrentFloorType == FLOOR_TYPE_14) ? 200.0f : (var_fa1 - this->unk_AB8) * 0.02f; + var_fv0 = (sPlayerFloorType == FLOOR_TYPE_14) ? 200.0f : (var_fa1 - this->unk_AB8) * 0.02f; var_fv0 = CLAMP(var_fv0, 0.0f, 300.0f); temp_fv1_2 = this->unk_AB8; @@ -8325,7 +8685,7 @@ void func_8083BF54(PlayState* play, Player* this) { this->unk_AB8 = CLAMP(this->unk_AB8, 0.0f, var_fa1); if ((this->linearVelocity == 0.0f) && (fabsf(this->unk_AB8 - temp_fv1_2) > 2.0f)) { - func_800B8F98(&this->actor, sfxId); + Actor_PlaySfx_FlaggedCentered1(&this->actor, sfxId); } this->actor.gravity -= this->unk_AB8 * 0.004f; @@ -8384,7 +8744,7 @@ void func_8083BF54(PlayState* play, Player* this) { var_fv1 = (this->stateFlags1 & PLAYER_STATE1_4000000) ? -fabsf(this->linearVelocity) - : ((func_80850D68 == this->actionFunc) + : ((Player_Action_56 == this->actionFunc) ? (ABS_ALT(this->unk_B8A) * -0.004f) + (this->unk_B48 * -0.38f) : this->actor.velocity.y); @@ -8408,7 +8768,7 @@ void func_8083BF54(PlayState* play, Player* this) { } s32 func_8083C62C(Player* this, s32 arg1) { - Actor* targetedActor = this->targetedActor; + Actor* lockOnActor = this->lockOnActor; Vec3f headPos; s16 pitchTarget; s16 yawTarget; @@ -8417,8 +8777,8 @@ s32 func_8083C62C(Player* this, s32 arg1) { headPos.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; headPos.z = this->actor.world.pos.z; - pitchTarget = Math_Vec3f_Pitch(&headPos, &targetedActor->focus.pos); - yawTarget = Math_Vec3f_Yaw(&headPos, &targetedActor->focus.pos); + pitchTarget = Math_Vec3f_Pitch(&headPos, &lockOnActor->focus.pos); + yawTarget = Math_Vec3f_Yaw(&headPos, &lockOnActor->focus.pos); Math_SmoothStepToS(&this->actor.focus.rot.y, yawTarget, 4, 0x2710, 0); Math_SmoothStepToS(&this->actor.focus.rot.x, pitchTarget, 4, 0x2710, 0); @@ -8431,7 +8791,7 @@ s32 func_8083C62C(Player* this, s32 arg1) { Vec3f D_8085D218 = { 0.0f, 100.0f, 40.0f }; void func_8083C6E8(Player* this, PlayState* play) { - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { if (func_800B7128(this) || func_8082EF20(this)) { func_8083C62C(this, true); } else { @@ -8440,7 +8800,7 @@ void func_8083C6E8(Player* this, PlayState* play) { return; } - if (sPlayerCurrentFloorType == FLOOR_TYPE_11) { + if (sPlayerFloorType == FLOOR_TYPE_11) { Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800); } else { s16 sp46 = 0; @@ -8467,8 +8827,7 @@ void func_8083C85C(Player* this) { } void func_8083C8E8(Player* this, PlayState* play) { - if ((func_800B7128(this) == 0) && (func_8082EF20(this) == 0) && - ((this->linearVelocity > 5.0f) || (D_80862B3C != 0.0f))) { + if (!func_800B7128(this) && !func_8082EF20(this) && ((this->linearVelocity > 5.0f) || (D_80862B3C != 0.0f))) { s16 temp1; s16 temp2; @@ -8511,7 +8870,7 @@ s32 func_8083CBC4(Player* this, f32 arg1, s16 arg2, f32 arg3, f32 arg4, f32 arg5 } if (ABS_ALT(temp_v0) > 0x6000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, arg3) == 0) { + if (!Math_StepToF(&this->linearVelocity, 0.0f, arg3)) { return false; } @@ -8550,7 +8909,7 @@ u16 D_8085D25C[] = { }; // Player_MountHorse -s32 func_8083CCB4(Player* this, PlayState* play) { +s32 Player_ActionChange_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; if (rideActor != NULL) { @@ -8624,15 +8983,15 @@ s32 func_8083CCB4(Player* this, PlayState* play) { return false; } -PlayerAnimationHeader* D_8085D264[] = { +PlayerAnimationHeader* sPlayerSlopeSlipAnims[] = { &gPlayerAnim_link_normal_down_slope_slip, &gPlayerAnim_link_normal_up_slope_slip, }; -s32 func_8083CF68(PlayState* play, Player* this) { +s32 Player_HandleSlopes(PlayState* play, Player* this) { if (!Player_InBlockingCsMode(play, this) && !(this->cylinder.base.ocFlags1 & OC1_HIT)) { - if ((func_80853D68 != this->actionFunc) && (func_80857BE8 != this->actionFunc) && - (D_80862B40 == FLOOR_EFFECT_1)) { + if ((Player_Action_73 != this->actionFunc) && (Player_Action_96 != this->actionFunc) && + (sPlayerFloorEffect == FLOOR_EFFECT_1)) { s16 playerVelYaw = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); Vec3f slopeNormal; s16 downwardSlopeYaw; @@ -8646,7 +9005,7 @@ s32 func_8083CF68(PlayState* play, Player* this) { velYawToDownwardSlope = downwardSlopeYaw - playerVelYaw; if (ABS_ALT(velYawToDownwardSlope) > 0x3E80) { // 87.9 degrees - var_fa1 = (func_80857BE8 == this->actionFunc) ? Math_CosS(this->unk_B6C) : slopeNormal.y; + var_fa1 = (Player_Action_96 == this->actionFunc) ? Math_CosS(this->floorPitch) : slopeNormal.y; slopeSlowdownSpeed = (1.0f - var_fa1) * 40.0f; temp_fv1 = fabsf(this->actor.speed) + slopeSlowdownSpeed; slopeSlowdownSpeedStep = SQ(temp_fv1) * 0.011f; @@ -8656,13 +9015,13 @@ s32 func_8083CF68(PlayState* play, Player* this) { this->pushedYaw = downwardSlopeYaw; Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep); } else { - Player_SetAction(play, this, func_80853D68, 0); + Player_SetAction(play, this, Player_Action_73, 0); func_8082DE50(play, this); - func_8082E514(play, this, D_8085D264[this->unk_AE7]); + func_8082E514(play, this, sPlayerSlopeSlipAnims[this->actionVar1]); this->linearVelocity = sqrtf(SQXZ(this->actor.velocity)); this->currentYaw = downwardSlopeYaw; - if (D_80862B28 >= 0) { - this->unk_AE7 = 1; + if (sPlayerFloorPitchShape >= 0) { + this->actionVar1 = 1; Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_HANG); } @@ -8688,10 +9047,10 @@ void func_8083D168(PlayState* play, Player* this, GetItemEntry* giEntry) { } Item_Give(play, giEntry->itemId); - play_sound((this->getItemId < GI_NONE) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); + Audio_PlaySfx((this->getItemId < GI_NONE) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } -s32 func_8083D23C(Player* this, PlayState* play) { +s32 Player_ActionChange_2(Player* this, PlayState* play) { if (gSaveContext.save.saveInfo.playerData.health != 0) { Actor* interactRangeActor = this->interactRangeActor; @@ -8703,7 +9062,7 @@ s32 func_8083D23C(Player* this, PlayState* play) { interactRangeActor->parent = &this->actor; if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || ((s16)giEntry->objectId == OBJECT_GI_BOMB_2)) { - func_8082DCA0(play, this); + Player_DetachHeldActor(play, this); func_80838830(this, giEntry->objectId); if (!(this->stateFlags2 & PLAYER_STATE2_400) || @@ -8725,7 +9084,7 @@ s32 func_8083D23C(Player* this, PlayState* play) { func_8083D168(play, this, giEntry); this->getItemId = GI_NONE; } - } else if (this->csMode == PLAYER_CSMODE_0) { + } else if (this->csMode == PLAYER_CSMODE_NONE) { if (!(this->stateFlags1 & PLAYER_STATE1_800)) { if (this->getItemId != GI_NONE) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { @@ -8804,7 +9163,7 @@ s32 func_8083D23C(Player* this, PlayState* play) { // Player_SetAction_Throwing void func_8083D6DC(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084E65C, 1); + Player_SetAction(play, this, Player_Action_42, 1); Player_AnimationPlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_28][this->modelAnimType]); } @@ -8817,13 +9176,13 @@ s32 func_8083D738(Player* this, Actor* heldActor) { return true; } -s32 func_8083D78C(Player* this, PlayState* play) { +s32 Player_ActionChange_9(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_800) { if ((this->heldActor != NULL) && CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_B | BTN_A)) { if (!func_808313A8(play, this, this->heldActor)) { if (!func_8083D738(this, this->heldActor)) { - Player_SetAction(play, this, func_8084E58C, 1); + Player_SetAction(play, this, Player_Action_41, 1); Player_AnimationPlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_29][this->modelAnimType]); return true; } @@ -8837,11 +9196,11 @@ s32 func_8083D78C(Player* this, PlayState* play) { } s32 func_8083D860(Player* this, PlayState* play) { - if ((this->wallHeight >= 79.0f) && + if ((this->yDistToLedge >= 79.0f) && (!(this->stateFlags1 & PLAYER_STATE1_8000000) || (this->currentBoots == PLAYER_BOOTS_ZORA_UNDERWATER) || (this->actor.depthInWater < this->ageProperties->unk_2C))) { - s32 var_t0 = (sPlayerCurrentWallFlags & WALL_FLAG_3) ? 2 : 0; - s32 temp_t2 = sPlayerCurrentWallFlags & WALL_FLAG_1; + s32 var_t0 = (sPlayerTouchedWallFlags & WALL_FLAG_3) ? 2 : 0; + s32 temp_t2 = sPlayerTouchedWallFlags & WALL_FLAG_1; if ((var_t0 != 0) || temp_t2 || SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { @@ -8901,7 +9260,7 @@ s32 func_8083D860(Player* this, PlayState* play) { if (xOut < 8.0f) { f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); - f32 wallDistance = this->wallDistance; + f32 distToInteractWall = this->distToInteractWall; PlayerAnimationHeader* anim; func_80832558(play, this, func_80837C20); @@ -8910,33 +9269,33 @@ s32 func_8083D860(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_8000000; if ((var_t0 != 0) || temp_t2) { - if ((this->unk_AE7 = var_t0) != 0) { + if ((this->actionVar1 = var_t0) != 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { anim = &gPlayerAnim_link_normal_Fclimb_startA; } else { anim = &gPlayerAnim_link_normal_Fclimb_hold2upL; } - wallDistance = (this->ageProperties->unk_3C + 4.0f) - wallDistance; + distToInteractWall = (this->ageProperties->unk_3C + 4.0f) - distToInteractWall; } else { anim = this->ageProperties->unk_AC; - wallDistance = 20.5f; + distToInteractWall = 20.5f; } - this->unk_AE8 = -2; + this->actionVar2 = -2; this->actor.world.pos.y += yOut; this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; } else { anim = this->ageProperties->unk_B0; - wallDistance = (this->ageProperties->unk_38 - this->ageProperties->unk_3C) + 17.0f; - this->unk_AE8 = -4; + distToInteractWall = (this->ageProperties->wallCheckRadius - this->ageProperties->unk_3C) + 17.0f; + this->actionVar2 = -4; this->actor.shape.rot.y = this->currentYaw = i = this->actor.wallYaw; //! FAKE } - this->actor.world.pos.x = (wallDistance * wallPolyNormalX) + sp78; - this->actor.world.pos.z = (wallDistance * wallPolyNormalZ) + sp74; + this->actor.world.pos.x = (distToInteractWall * wallPolyNormalX) + sp78; + this->actor.world.pos.z = (distToInteractWall * wallPolyNormalZ) + sp74; func_8082DAD4(this); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); Player_AnimationPlayOnce(play, this, anim); @@ -8952,7 +9311,7 @@ s32 func_8083D860(Player* this, PlayState* play) { } void func_8083DCC4(Player* this, PlayerAnimationHeader* anim, PlayState* play) { - func_8083172C(play, this, func_8084FC0C, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_51, 0); PlayerAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 4.0f / 3.0f); } @@ -8979,7 +9338,7 @@ s32 func_8083DD1C(PlayState* play, Player* this, f32 arg2, f32 arg3, f32 arg4, f wallPoly = this->actor.wallPoly; this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; this->actor.wallBgId = bgId; - sPlayerCurrentWallFlags = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, bgId); + sPlayerTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, bgId); wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); @@ -8998,14 +9357,14 @@ s32 func_8083DD1C(PlayState* play, Player* this, f32 arg2, f32 arg3, f32 arg4, f } void func_8083DEE4(PlayState* play, Player* this) { - f32 temp_fv0 = this->ageProperties->unk_38; + f32 temp_fv0 = this->ageProperties->wallCheckRadius; func_8083DD1C(play, this, 268 * 0.1f, temp_fv0 + 5.0f, temp_fv0 + 15.0f, 0.0f); } void func_8083DF38(Player* this, PlayerAnimationHeader* anim, PlayState* play) { if (!func_80832558(play, this, func_80837BF8)) { - Player_SetAction(play, this, func_8084ED9C, 0); + Player_SetAction(play, this, Player_Action_45, 0); } Player_AnimationPlayOnce(play, this, anim); @@ -9014,16 +9373,16 @@ void func_8083DF38(Player* this, PlayerAnimationHeader* anim, PlayState* play) { this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; } -s32 func_8083DFC4(Player* this, PlayState* play) { +s32 Player_ActionChange_5(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_800) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && - (D_80862B20 < 0x3000)) { + (sPlayerShapeYawToTouchedWall < 0x3000)) { if ((this->linearVelocity > 0.0f) && func_8083D860(this, play)) { return true; } if (!func_801242B4(this) && ((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_4)) && - (sPlayerCurrentWallFlags & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (this->wallHeight >= 39.0f)) { + (sPlayerTouchedWallFlags & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->yDistToLedge >= 39.0f)) { this->stateFlags2 |= PLAYER_STATE2_1; if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A)) { @@ -9069,13 +9428,13 @@ s32 func_8083E14C(PlayState* play, Player* this) { } void func_8083E234(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084EE50, 0); + Player_SetAction(play, this, Player_Action_46, 0); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_push_start); this->stateFlags2 |= PLAYER_STATE2_10; } void func_8083E28C(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084EF9C, 0); + Player_SetAction(play, this, Player_Action_47, 0); Player_AnimationPlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_34][this->modelAnimType]); this->stateFlags2 |= PLAYER_STATE2_10; } @@ -9094,7 +9453,7 @@ void func_8083E2F4(Player* this, PlayState* play) { s32 func_8083E354(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT)) { - if ((sPlayerCurrentWallFlags & WALL_FLAG_3) || (sPlayerCurrentWallFlags & WALL_FLAG_1) || + if ((sPlayerTouchedWallFlags & WALL_FLAG_3) || (sPlayerTouchedWallFlags & WALL_FLAG_1) || SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { return false; } @@ -9109,7 +9468,7 @@ s32 func_8083E404(Player* this, f32 arg1, s16 arg2) { f32 sp1C = BINANG_SUB(arg2, this->actor.shape.rot.y); f32 temp_fv1; - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { func_8083C62C(this, func_800B7128(this) || func_8082EF20(this)); } @@ -9128,7 +9487,7 @@ s32 func_8083E514(Player* this, f32* arg2, s16* arg3, PlayState* play) { s16 temp_v1 = *arg3 - this->targetYaw; u16 var_a2 = ABS_ALT(temp_v1); - if ((func_800B7128(this) || func_8082EF20(this)) && (this->targetedActor == NULL)) { + if ((func_800B7128(this) || func_8082EF20(this)) && (this->lockOnActor == NULL)) { *arg2 *= Math_SinS(var_a2); if (*arg2 != 0.0f) { @@ -9137,14 +9496,14 @@ s32 func_8083E514(Player* this, f32* arg2, s16* arg3, PlayState* play) { *arg3 = this->actor.shape.rot.y; } - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { func_8083C62C(this, true); } else { Math_SmoothStepToS(&this->actor.focus.rot.x, (sPlayerControlInput->rel.stick_y * 240.0f), 0xE, 0xFA0, 0x1E); func_80832754(this, true); } } else { - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { return func_8083E404(this, *arg2, *arg3); } @@ -9184,7 +9543,7 @@ s32 func_8083E7F8(Player* this, f32* arg1, s16* arg2, PlayState* play) { func_8083C6E8(this, play); if ((*arg1 != 0.0f) || (ABS_ALT(this->unk_B4C) > 0x190)) { - s16 temp_a0 = *arg2 - (u16)Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]); + s16 temp_a0 = *arg2 - (u16)Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); u16 temp; temp = (ABS_ALT(temp_a0) - 0x2000); @@ -9265,11 +9624,11 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) { s32 animIndex; s32 rand; f32 morphFrames; - s16 lastFrame; + s16 endFrame; if (((this->actor.id != ACTOR_PLAYER) && !(healthIsCritical = (this->actor.colChkInfo.health < 0x64))) || ((this->actor.id == ACTOR_PLAYER) && - (((this->targetedActor != NULL) || + (((this->lockOnActor != NULL) || ((this->transformation != PLAYER_FORM_FIERCE_DEITY) && (this->transformation != PLAYER_FORM_HUMAN)) || (this->currentMask == PLAYER_MASK_SCENTS)) || (!(healthIsCritical = LifeMeter_IsCritical()) && (this->unk_AA4 = ((this->unk_AA4 + 1) & 1)))))) { @@ -9312,7 +9671,7 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) { } } - lastFrame = Animation_GetLastFrame(anim); + endFrame = Animation_GetLastFrame(anim); if ((this->skelAnime.animation == anim) || (this->skelAnime.animation == &gPlayerAnim_pz_attackAend) || (this->skelAnime.animation == &gPlayerAnim_pz_attackBend) || (this->skelAnime.animation == &gPlayerAnim_pz_attackCend)) { @@ -9321,7 +9680,7 @@ void Player_ChooseIdleAnim(PlayState* play, Player* this) { morphFrames = -6.0f; } - PlayerAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_8085C3E4, 0.0f, lastFrame, ANIMMODE_ONCE, + PlayerAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_8085C3E4, 0.0f, endFrame, ANIMMODE_ONCE, morphFrames); } @@ -9370,7 +9729,7 @@ void func_8083EE60(Player* this, PlayState* play) { } void func_8083F144(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084A794, 1); + Player_SetAction(play, this, Player_Action_7, 1); func_8082E438(play, this, &gPlayerAnim_link_normal_back_brake); } @@ -9392,7 +9751,7 @@ s32 func_8083F190(Player* this, f32* arg1, s16* arg2, PlayState* play) { } void func_8083F230(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084A884, 1); + Player_SetAction(play, this, Player_Action_8, 1); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_back_brake_end); } @@ -9414,14 +9773,14 @@ void func_8083F27C(PlayState* play, Player* this) { } void func_8083F358(Player* this, s32 arg1, PlayState* play) { - PlayerAnimationHeader* var_v0; + PlayerAnimationHeader* climbAnim; f32 var_fv1; s16 var_a1; - if (ABS_ALT(D_80862B28) < 0xE38) { + if (ABS_ALT(sPlayerFloorPitchShape) < 0xE38) { var_a1 = 0; } else { - var_a1 = CLAMP(D_80862B28, -0x2AAA, 0x2AAA); + var_a1 = CLAMP(sPlayerFloorPitchShape, -0x2AAA, 0x2AAA); } Math_ScaledStepToS(&this->unk_B70, var_a1, 0x190); @@ -9448,18 +9807,18 @@ void func_8083F358(Player* this, s32 arg1, PlayState* play) { } if (var_fv1 < 0.0f) { - var_v0 = &gPlayerAnim_link_normal_climb_down; + climbAnim = &gPlayerAnim_link_normal_climb_down; var_fv1 = -var_fv1; } else { - var_v0 = &gPlayerAnim_link_normal_climb_up; + climbAnim = &gPlayerAnim_link_normal_climb_up; } if (arg1 == 0) { PlayerAnimation_BlendToJoint(play, &this->skelAnime, D_8085BE84[PLAYER_ANIMGROUP_1][this->modelAnimType], - this->unk_B38, var_v0, this->unk_B38, var_fv1, this->blendTableBuffer); + this->unk_B38, climbAnim, this->unk_B38, var_fv1, this->blendTableBuffer); } else { PlayerAnimation_BlendToMorph(play, &this->skelAnime, D_8085BE84[PLAYER_ANIMGROUP_1][this->modelAnimType], - this->unk_B38, var_v0, this->unk_B38, var_fv1, this->blendTableBuffer); + this->unk_B38, climbAnim, this->unk_B38, var_fv1, this->blendTableBuffer); } } @@ -9558,7 +9917,7 @@ s32 func_8083F8A8(PlayState* play, Player* this, f32 radius, s32 countMax, f32 r velocity.y = Rand_ZeroFloat(2.0f); velocity.z = Rand_CenteredFloat(3.0f); D_8085D288.y = -0.1f; - EffectSsHahen_Spawn(play, &pos, &velocity, &D_8085D288, 0, 0x96, 1, 0x10, gKakeraLeafTip); + EffectSsHahen_Spawn(play, &pos, &velocity, &D_8085D288, 0, 0x96, 1, 0x10, gKakeraLeafTipDL); } } @@ -9610,11 +9969,11 @@ s32 func_8083FCF0(PlayState* play, Player* this, f32 arg2, f32 arg3, f32 arg4) { // Crouch-stabbing s32 func_8083FD80(Player* this, PlayState* play) { if (!Player_IsGoronOrDeku(this) && (Player_GetMeleeWeaponHeld(this) != PLAYER_MELEEWEAPON_NONE) && - (this->transformation != PLAYER_FORM_ZORA) && (D_80862B48 != 0)) { + (this->transformation != PLAYER_FORM_ZORA) && sPlayerUseHeldItem) { //! Calling this function sets the meleeWeaponQuads' damage properties correctly, patching "Power Crouch Stab". func_8083375C(this, PLAYER_MWA_STAB_1H); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); - this->unk_AE7 = 1; + this->actionVar1 = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->currentYaw = this->actor.shape.rot.y + this->upperLimbRot.y; this->unk_ADD = 0; @@ -9624,7 +9983,7 @@ s32 func_8083FD80(Player* this, PlayState* play) { } s32 func_8083FE38(Player* this, PlayState* play) { - return func_80838A90(this, play) || func_808391D8(this, play) || func_8083D23C(this, play); + return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play); } void Player_RequestQuakeAndRumble(PlayState* play, Player* this, u16 sfxId) { @@ -9634,13 +9993,13 @@ void Player_RequestQuakeAndRumble(PlayState* play, Player* this, u16 sfxId) { } void func_8083FEF4(PlayState* play, Player* this) { - Inventory_ChangeAmmo(ITEM_STICK, -1); - func_80831990(play, this, ITEM_NONE); + Inventory_ChangeAmmo(ITEM_DEKU_STICK, -1); + Player_UseItem(play, this, ITEM_NONE); } s32 func_8083FF30(PlayState* play, Player* this) { - if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_B0C > 0.5f)) { - if (AMMO(ITEM_STICK) != 0) { + if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_B0C > 0.5f)) { + if (AMMO(ITEM_DEKU_STICK) != 0) { EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND], BINANG_ADD(this->actor.shape.rot.y, 0x8000)); this->unk_B0C = 0.5f; @@ -9660,7 +10019,7 @@ s32 func_8083FFEC(PlayState* play, Player* this) { gSaveContext.save.saveInfo.playerData.swordHealth--; if (gSaveContext.save.saveInfo.playerData.swordHealth <= 0) { Item_Give(play, ITEM_SWORD_KOKIRI); - func_80831990(play, this, ITEM_SWORD_KOKIRI); + Player_UseItem(play, this, ITEM_SWORD_KOKIRI); Player_PlaySfx(this, NA_SE_IT_MAJIN_SWORD_BROKEN); if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Message_StartTextbox(play, 0xF9, NULL); @@ -9686,20 +10045,20 @@ PlayerAnimationHeader* D_8085D294[] = { }; void func_808400CC(PlayState* play, Player* this) { - if (func_8084B5C0 != this->actionFunc) { + if (Player_Action_18 != this->actionFunc) { func_8082DD2C(play, this); if ((this->transformation != PLAYER_FORM_HUMAN) && (this->transformation != PLAYER_FORM_FIERCE_DEITY)) { u8 moveFlags = this->skelAnime.moveFlags; s32 pad; this->skelAnime.moveFlags = 0; - Player_SetAction(play, this, func_80854C70, 0); + Player_SetAction(play, this, Player_Action_85, 0); this->skelAnime.moveFlags = moveFlags; } else { s32 var_v1; s32 pad; - Player_SetAction(play, this, func_80854C70, 0); + Player_SetAction(play, this, Player_Action_85, 0); if (func_80123420(this)) { var_v1 = 2; } else { @@ -9846,10 +10205,10 @@ s32 func_808401F4(PlayState* play, Player* this) { Vec3f D_8085D2A4 = { 0.0f, 0.0f, 5.0f }; void func_80840770(PlayState* play, Player* this) { - if (this->unk_AE8 != 0) { - if (this->unk_AE8 > 0) { - this->unk_AE8--; - if (this->unk_AE8 == 0) { + if (this->actionVar2 != 0) { + if (this->actionVar2 > 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { if (this->stateFlags1 & PLAYER_STATE1_8000000) { PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_wait, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_wait), ANIMMODE_ONCE, @@ -9860,7 +10219,7 @@ void func_80840770(PlayState* play, Player* this) { 0.0f); } gSaveContext.healthAccumulator = 0xA0; - this->unk_AE8 = -1; + this->actionVar2 = -1; } } else if (gSaveContext.healthAccumulator == 0) { Player_StopCutscene(this); @@ -9876,11 +10235,11 @@ void func_80840770(PlayState* play, Player* this) { func_808339B4(this, -20); Audio_SetBgmVolumeOn(); } - } else if (this->unk_AE7 != 0) { + } else if (this->actionVar1 != 0) { Player_StopCutscene(this); this->csId = play->playerCsIds[PLAYER_CS_ID_REVIVE]; - this->unk_AE8 = 60; - Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D2A4, 5); + this->actionVar2 = 60; + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D2A4, FAIRY_PARAMS(FAIRY_TYPE_5, false, 0)); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { play->gameOverCtx.state = GAMEOVER_DEATH_FADE_OUT; @@ -9910,7 +10269,8 @@ s32 func_80840A30(PlayState* play, Player* this, f32* arg2, f32 arg3) { if (arg3 <= *arg2) { // If interacting with a wall and close to facing it - if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80862B24 < 0x1C00)) || + if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && + (sPlayerWorldYawToTouchedWall < 0x1C00)) || // or, impacting something's cylinder (((this->cylinder.base.ocFlags1 & OC1_HIT) && (cylinderOc = this->cylinder.base.oc) != NULL) && // and that something is a Beaver Race ring, @@ -9941,15 +10301,15 @@ s32 func_80840A30(PlayState* play, Player* this, f32* arg2, f32 arg3) { } if (!(this->stateFlags3 & PLAYER_STATE3_1000)) { - if ((this->stateFlags3 & PLAYER_STATE3_8000) && (func_8084CA24 != this->actionFunc)) { - Player_SetAction(play, this, func_80851B58, 0); + if ((this->stateFlags3 & PLAYER_STATE3_8000) && (Player_Action_28 != this->actionFunc)) { + Player_SetAction(play, this, Player_Action_61, 0); func_8082DB90(play, this, &gPlayerAnim_link_swimer_swim_hit); func_8082DD2C(play, this); this->linearVelocity *= 0.2f; } else { - Player_SetAction(play, this, func_8084C6EC, 0); + Player_SetAction(play, this, Player_Action_26, 0); Player_AnimationPlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_16][this->modelAnimType]); - this->unk_AE8 = 1; + this->actionVar2 = 1; } } @@ -9991,11 +10351,11 @@ s32 func_80840CD4(Player* this, PlayState* play) { } void func_80840DEC(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084CE84, 1); + Player_SetAction(play, this, Player_Action_31, 1); } void func_80840E24(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084D18C, 1); + Player_SetAction(play, this, Player_Action_32, 1); } void func_80840E5C(Player* this, PlayState* play) { @@ -10006,38 +10366,36 @@ void func_80840E5C(Player* this, PlayState* play) { } void func_80840EC0(Player* this, PlayState* play) { - Player_SetAction(play, this, func_8084CCEC, 1); + Player_SetAction(play, this, Player_Action_30, 1); Player_AnimationPlayLoop(play, this, D_8085CF60[Player_IsHoldingTwoHandedWeapon(this)]); - this->unk_AE8 = 1; + this->actionVar2 = 1; this->unk_B38 = 0.0f; } // Spin attack size void func_80840F34(Player* this) { - Math_StepToF(&this->unk_B08, (CHECK_WEEKEVENTREG(WEEKEVENTREG_23_02)) ? 1.0f : 0.5f, 0.02f); + Math_StepToF(&this->unk_B08, CHECK_WEEKEVENTREG(WEEKEVENTREG_OBTAINED_GREAT_SPIN_ATTACK) ? 1.0f : 0.5f, 0.02f); } -s32 func_80840F90(PlayState* play, Player* this, CsCmdActorCue* playerAction, f32 arg3, s16 arg4, s32 arg5) { +s32 func_80840F90(PlayState* play, Player* this, CsCmdActorCue* cue, f32 arg3, s16 arg4, s32 arg5) { if ((arg5 != 0) && (this->linearVelocity == 0.0f)) { return PlayerAnimation_Update(play, &this->skelAnime); } if (arg5 != 2) { f32 halfUpdateRate = R_UPDATE_RATE / 2.0f; - f32 curDiffX = playerAction->endPos.x - this->actor.world.pos.x; - f32 curDiffZ = playerAction->endPos.z - this->actor.world.pos.z; + f32 curDiffX = cue->endPos.x - this->actor.world.pos.x; + f32 curDiffZ = cue->endPos.z - this->actor.world.pos.z; f32 scaledCurDist = sqrtf(SQ(curDiffX) + SQ(curDiffZ)) / halfUpdateRate; - s32 framesLeft = (playerAction->endFrame - play->csCtx.curFrame) + 1; + s32 framesLeft = (cue->endFrame - play->csCtx.curFrame) + 1; arg4 = Math_Atan2S_XY(curDiffZ, curDiffX); if (arg5 == 1) { - f32 distX = playerAction->endPos.x - playerAction->startPos.x; - f32 distZ = playerAction->endPos.z - playerAction->startPos.z; - s32 temp = (((sqrtf(SQ(distX) + SQ(distZ)) / halfUpdateRate) / - (playerAction->endFrame - playerAction->startFrame)) / - 1.5f) * - 4.0f; + f32 distX = cue->endPos.x - cue->startPos.x; + f32 distZ = cue->endPos.z - cue->startPos.z; + s32 temp = + (((sqrtf(SQ(distX) + SQ(distZ)) / halfUpdateRate) / (cue->endFrame - cue->startFrame)) / 1.5f) * 4.0f; if (temp >= framesLeft) { arg3 = 0.0f; arg4 = this->actor.shape.rot.y; @@ -10084,7 +10442,7 @@ void Player_InitMode_0(PlayState* play, Player* this) { } void Player_InitMode_2(PlayState* play, Player* this) { - Player_SetAction(play, this, func_80854118, 0); + Player_SetAction(play, this, Player_Action_76, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, 0.0f); @@ -10104,11 +10462,11 @@ void func_80841358(PlayState* play, Player* this, s32 arg2) { //! @bug OoB read if player is goron, deku or human item = D_8085D2B0[this->transformation]; itemAction = sItemItemActions[item]; - func_808317C4(this); - func_8082DCA0(play, this); + Player_DestroyHookshot(this); + Player_DetachHeldActor(play, this); this->heldItemId = item; this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); - func_8082F8BC(play, this, itemAction); + Player_InitItemAction(play, this, itemAction); func_808309CC(play, this); if (arg2) { Player_PlaySfx(this, NA_SE_IT_SWORD_PICKOUT); @@ -10118,7 +10476,7 @@ void func_80841358(PlayState* play, Player* this, s32 arg2) { Vec3f D_8085D2B4 = { -1.0f, 69.0f, 20.0f }; void Player_InitMode_1(PlayState* play, Player* this) { - Player_SetAction(play, this, func_80852FD4, 0); + Player_SetAction(play, this, Player_Action_66, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; Math_Vec3f_Copy(&this->actor.world.pos, &D_8085D2B4); this->currentYaw = this->actor.shape.rot.y = -0x8000; @@ -10129,17 +10487,17 @@ void Player_InitMode_1(PlayState* play, Player* this) { if (this->transformation == PLAYER_FORM_FIERCE_DEITY) { func_80841358(play, this, false); } - this->unk_AE8 = 20; + this->actionVar2 = 20; } void Player_InitMode_3(PlayState* play, Player* this) { - Player_SetAction(play, this, func_8085437C, 0); + Player_SetAction(play, this, Player_Action_78, 0); func_8082E920(play, this, ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } void Player_InitMode_4(PlayState* play, Player* this) { func_80834DB8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); - Player_SetAction(play, this, func_8085439C, 0); + Player_SetAction(play, this, Player_Action_79, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; this->fallStartHeight = this->actor.world.pos.y; } @@ -10149,20 +10507,20 @@ void Player_InitMode_7(PlayState* play, Player* this) { } void Player_InitMode_5(PlayState* play, Player* this) { - Player_SetAction(play, this, func_808540A0, 0); + Player_SetAction(play, this, Player_Action_75, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_20000000; } void Player_InitMode_6(PlayState* play, Player* this) { if (gSaveContext.save.isOwlSave) { - Player_SetAction(play, this, func_808496AC, 0); + Player_SetAction(play, this, Player_Action_0, 0); func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_43][this->modelAnimType]); this->stateFlags1 |= PLAYER_STATE1_20000000; - this->unk_AE8 = 0x28; + this->actionVar2 = 0x28; gSaveContext.save.isOwlSave = false; } else { - Player_SetAction(play, this, func_80849FE0, 0); + Player_SetAction(play, this, Player_Action_4, 0); func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_43][this->modelAnimType]); this->stateFlags1 |= PLAYER_STATE1_20000000; this->stateFlags2 |= PLAYER_STATE2_20000000; @@ -10173,7 +10531,7 @@ void Player_InitMode_6(PlayState* play, Player* this) { // InitModes 0x8 and 0x9 void func_80841744(PlayState* play, Player* this) { - Player_SetAction(play, this, func_80855C28, 0); + Player_SetAction(play, this, Player_Action_91, 0); if (PLAYER_GET_INITMODE(&this->actor) == PLAYER_INITMODE_8) { Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]); this->itemAction = PLAYER_IA_OCARINA; @@ -10183,7 +10541,7 @@ void func_80841744(PlayState* play, Player* this) { } this->stateFlags1 |= PLAYER_STATE1_20000000; this->unk_ABC = -10000.0f; - this->unk_AE8 = 0x2710; + this->actionVar2 = 0x2710; this->unk_B10[5] = 8.0f; } @@ -10191,7 +10549,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -Vec3s D_8085D2C4 = { -57, 3377, 0 }; +Vec3s sPlayerSkeletonBaseTransl = { -57, 3377, 0 }; void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) { Actor_ProcessInitChain(&this->actor, sInitChain); @@ -10203,11 +10561,11 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe func_808309CC(play, this); SkelAnime_InitPlayer(play, &this->skelAnime, skelHeader, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType], 1 | 8, this->jointTableBuffer, this->morphTableBuffer, PLAYER_LIMB_MAX); - this->skelAnime.baseTransl = D_8085D2C4; + this->skelAnime.baseTransl = sPlayerSkeletonBaseTransl; - SkelAnime_InitPlayer(play, &this->unk_284, skelHeader, func_8082ED20(this), 1 | 8, this->unk_929, this->unk_9C8, - PLAYER_LIMB_MAX); - this->unk_284.baseTransl = D_8085D2C4; + SkelAnime_InitPlayer(play, &this->skelAnimeUpper, skelHeader, func_8082ED20(this), 1 | 8, + this->jointTableUpperBuffer, this->morphTableUpperBuffer, PLAYER_LIMB_MAX); + this->skelAnimeUpper.baseTransl = sPlayerSkeletonBaseTransl; if (this->transformation == PLAYER_FORM_GORON) { SkelAnime_InitFlex(play, &this->unk_2C8, &gLinkGoronShieldingSkel, &gLinkGoronShieldingAnim, @@ -10276,7 +10634,7 @@ Vec3f D_8085D340 = { 0.0f, 50.0f, 0.0f }; void Player_Init(Actor* thisx, PlayState* play) { s32 pad; Player* this = THIS; - s8 objBankIndex; + s8 objectSlot; s32 respawnFlag; s32 var_a1; PlayerInitMode initMode; @@ -10303,16 +10661,16 @@ void Player_Init(Actor* thisx, PlayState* play) { if (this->actor.shape.rot.x != 0) { this->transformation = this->actor.shape.rot.x - 1; - objBankIndex = Object_GetIndex(&play->objectCtx, gPlayerFormObjectIndices[this->transformation]); - this->actor.objBankIndex = objBankIndex; - if (objBankIndex < 0) { + objectSlot = Object_GetSlot(&play->objectCtx, gPlayerFormObjectIds[this->transformation]); + this->actor.objectSlot = objectSlot; + if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } Actor_SetObjectDependency(play, &this->actor); } else { - this->transformation = gSaveContext.save.playerForm; + this->transformation = GET_PLAYER_FORM; if (this->transformation == PLAYER_FORM_HUMAN) { if (gSaveContext.save.equippedMask == PLAYER_MASK_GIANT) { gSaveContext.save.equippedMask = PLAYER_MASK_NONE; @@ -10363,7 +10721,7 @@ void Player_Init(Actor* thisx, PlayState* play) { this->heldItemAction = PLAYER_IA_NONE; this->heldItemId = ITEM_NONE; - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; Player_InitCommon(this, play, gPlayerSkeletons[this->transformation]); @@ -10382,10 +10740,10 @@ void Player_Init(Actor* thisx, PlayState* play) { } if ((this->csMode == PLAYER_CSMODE_9) || (this->csMode == PLAYER_CSMODE_93)) { - Player_SetAction(play, this, func_8085B08C, 0); + Player_SetAction(play, this, Player_Action_97, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; } else { - Player_SetAction(play, this, func_80855818, 0); + Player_SetAction(play, this, Player_Action_87, 0); this->actor.shape.rot.y = this->currentYaw; if (this->prevMask != PLAYER_MASK_NONE) { @@ -10420,7 +10778,7 @@ void Player_Init(Actor* thisx, PlayState* play) { if (this->actor.shape.rot.x != 0) { this->actor.shape.rot.x = 0; this->csMode = PLAYER_CSMODE_68; - Player_SetAction(play, this, func_8085B08C, 0); + Player_SetAction(play, this, Player_Action_97, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; return; } @@ -10498,7 +10856,8 @@ void Player_Init(Actor* thisx, PlayState* play) { if ((this->actor.draw != NULL) && gSaveContext.save.hasTatl && ((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) && (play->sceneId != SCENE_SPOT00)) { - this->tatlActor = Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D340, 0); + this->tatlActor = + Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D340, FAIRY_PARAMS(FAIRY_TYPE_0, false, 0)); if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; @@ -10507,7 +10866,7 @@ void Player_Init(Actor* thisx, PlayState* play) { if (gSaveContext.powderKegTimer != 0) { this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_POWDER_KEG); this->heldItemId = ITEM_POWDER_KEG; - func_8082F8BC(play, this, PLAYER_IA_POWDER_KEG); + Player_InitItemAction(play, this, PLAYER_IA_POWDER_KEG); func_808313F0(this, play); } else if (gSaveContext.unk_1014 != 0) { func_8082F5FC(this, Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MM, @@ -10583,7 +10942,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { } doActionB = -1; - sp38 = func_801242B4(this) || (func_8084CA24 == this->actionFunc); + sp38 = func_801242B4(this) || (Player_Action_28 == this->actionFunc); // Set B do action if (this->transformation == PLAYER_FORM_GORON) { @@ -10638,7 +10997,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { doActionA = DO_ACTION_SNAP; } else if (Player_InBlockingCsMode(play, this) || (this->actor.flags & ACTOR_FLAG_20000000) || (this->stateFlags1 & PLAYER_STATE1_1000) || (this->stateFlags3 & PLAYER_STATE3_80000) || - (func_80854430 == this->actionFunc)) { + (Player_Action_80 == this->actionFunc)) { doActionA = DO_ACTION_NONE; } else if (this->stateFlags1 & PLAYER_STATE1_100000) { doActionA = DO_ACTION_RETURN; @@ -10665,7 +11024,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { (!(this->stateFlags1 & PLAYER_STATE1_800000) && (this->rideActor != NULL))) { doActionA = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_800000) && - (!EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && (func_808505D0 != this->actionFunc))) { + (!EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && (Player_Action_53 != this->actionFunc))) { if ((this->stateFlags2 & PLAYER_STATE2_2) && (this->talkActor != NULL)) { if ((this->talkActor->category == ACTORCAT_NPC) || (this->talkActor->id == ACTOR_DM_CHAR08)) { doActionA = DO_ACTION_SPEAK; @@ -10729,10 +11088,10 @@ void Player_SetDoAction(PlayState* play, Player* this) { !Player_IsGoronOrDeku(this)) { if ((this->transformation != PLAYER_FORM_GORON) && !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_4000)) && (sp28 <= 0) && - ((func_80123420(this)) || - ((sPlayerCurrentFloorType != FLOOR_TYPE_7) && - ((func_80123434(this)) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && - !(this->stateFlags1 & PLAYER_STATE1_400000) && (sp28 == 0)))))) { + (func_80123420(this) || + ((sPlayerFloorType != FLOOR_TYPE_7) && + (func_80123434(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && + !(this->stateFlags1 & PLAYER_STATE1_400000) && (sp28 == 0)))))) { doActionA = DO_ACTION_ATTACK; } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && sp24 && (sp28 > 0)) { doActionA = DO_ACTION_JUMP; @@ -10743,7 +11102,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { (this->transformation == PLAYER_FORM_ZORA)) && ((this->heldItemAction >= PLAYER_IA_SWORD_KOKIRI) || ((this->stateFlags2 & PLAYER_STATE2_100000) && - (play->actorCtx.targetContext.arrowPointedActor == NULL)))) { + (play->actorCtx.targetCtx.fairyActor == NULL)))) { doActionA = DO_ACTION_PUTAWAY; if (play->msgCtx.currentTextId == 0) {} //! FAKE @@ -10763,7 +11122,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { // Set Tatl state if (!Play_InCsMode(play) && (this->stateFlags2 & PLAYER_STATE2_200000) && !(this->stateFlags3 & PLAYER_STATE3_100)) { - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { func_80115764(play, 0x2B); } else { func_80115764(play, 0x2A); @@ -10785,27 +11144,39 @@ s32 func_808430E0(Player* this) { } if (!(this->stateFlags1 & PLAYER_STATE1_8000000)) { - sPlayerCurrentFloorType = FLOOR_TYPE_0; + sPlayerFloorType = FLOOR_TYPE_0; } - this->unk_B6C = 0; - this->unk_B6E = 0; - D_80862B28 = 0; + this->floorPitch = 0; + this->floorPitchAlt = 0; + sPlayerFloorPitchShape = 0; return true; } -void func_80843178(PlayState* play, Player* this) { - u8 spC7 = 0; +/** + * Performs the following tasks related to scene collision: + * + * This includes: + * - Update BgCheckInfo, parameters adjusted due to various state flags + * - Update floor type, floor property and floor sfx offset + * - Update conveyor, reverb and light settings according to the current floor poly + * - Handle exits and voids + * - Update information relating to the "interact wall" + * - Update information for ledge climbing + * - Calculate floor poly angles + */ +void Player_ProcessSceneCollision(PlayState* play, Player* this) { + u8 nextLedgeClimbType = PLAYER_LEDGE_CLIMB_NONE; CollisionPoly* floorPoly; - f32 temp_fv0; - f32 temp_fv0_3; - f32 temp_fv1; + f32 wallCheckRadius; + f32 speedScale; + f32 ceilingCheckHeight; u32 updBgCheckInfoFlags; - s32 spAC = (func_8084D820 == this->actionFunc) && (this->unk_397 == 4); + s32 spAC = (Player_Action_35 == this->actionFunc) && (this->unk_397 == 4); sPlayerPrevFloorProperty = this->floorProperty; - temp_fv0 = this->ageProperties->unk_38; - temp_fv1 = this->ageProperties->unk_00; + wallCheckRadius = this->ageProperties->wallCheckRadius; + ceilingCheckHeight = this->ageProperties->ceilingCheckHeight; if (this->stateFlags1 & (PLAYER_STATE1_20000000 | PLAYER_STATE1_80000000)) { if ((!(this->stateFlags1 & PLAYER_STATE1_80) && !(this->stateFlags2 & PLAYER_STATE2_4000) && @@ -10813,23 +11184,22 @@ void func_80843178(PlayState* play, Player* this) { spAC) { updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + } else if ((this->stateFlags1 & PLAYER_STATE1_1) && + (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && + ((this->unk_D68 - (s32)this->actor.world.pos.y) >= 100)) { + updBgCheckInfoFlags = + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; + } else if (!(this->stateFlags1 & PLAYER_STATE1_1) && + ((Player_Action_36 == this->actionFunc) || (Player_Action_35 == this->actionFunc))) { + updBgCheckInfoFlags = + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_WALL | BGCHECKFLAG_PLAYER_WALL_INTERACT); } else { - if ((this->stateFlags1 & 1) && (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) && - ((this->unk_D68 - (s32)this->actor.world.pos.y) >= 100)) { - updBgCheckInfoFlags = - UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; - } else if (!(this->stateFlags1 & PLAYER_STATE1_1) && - ((func_8084E034 == this->actionFunc) || (func_8084D820 == this->actionFunc))) { - updBgCheckInfoFlags = - UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; - this->actor.bgCheckFlags &= ~(BGCHECKFLAG_WALL | BGCHECKFLAG_PLAYER_WALL_INTERACT); - } else { - updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | - UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; - } + updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_20; } } else { - if (func_808561B0 == this->actionFunc) { + if (Player_Action_93 == this->actionFunc) { updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_800; } else if ((this->stateFlags3 & (PLAYER_STATE3_1000 | PLAYER_STATE3_80000)) && (this->linearVelocity >= 8.0f)) { updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | @@ -10844,6 +11214,7 @@ void func_80843178(PlayState* play, Player* this) { if (this->stateFlags3 & PLAYER_STATE3_1) { updBgCheckInfoFlags &= ~(UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } + if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_4) { this->stateFlags3 |= PLAYER_STATE3_10; } @@ -10852,7 +11223,7 @@ void func_80843178(PlayState* play, Player* this) { updBgCheckInfoFlags &= ~(UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } - Actor_UpdateBgCheckInfo(play, &this->actor, 268 * 0.1f, temp_fv0, temp_fv1, updBgCheckInfoFlags); + Actor_UpdateBgCheckInfo(play, &this->actor, 268 * 0.1f, wallCheckRadius, ceilingCheckHeight, updBgCheckInfoFlags); this->unk_AC0 -= (this->actor.world.pos.y - this->actor.prevPos.y) / this->actor.scale.y; this->unk_AC0 = CLAMP(this->unk_AC0, -1000.0f, 1000.0f); @@ -10861,27 +11232,33 @@ void func_80843178(PlayState* play, Player* this) { this->actor.velocity.y = 0.0f; } - D_80862B18 = this->actor.world.pos.y - this->actor.floorHeight; + sPlayerYDistToFloor = this->actor.world.pos.y - this->actor.floorHeight; sPlayerConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; floorPoly = this->actor.floorPoly; if ((floorPoly != NULL) && (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_4)) { this->floorProperty = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId); + if (this == GET_PLAYER(play)) { func_801A3CF4(SurfaceType_GetEcho(&play->colCtx, floorPoly, this->actor.floorBgId)); + if (this->actor.floorBgId == BGCHECK_SCENE) { - func_800FAAB4(play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, this->actor.floorBgId)); + Environment_ChangeLightSetting( + play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, this->actor.floorBgId)); } else { DynaPoly_SetPlayerAbove(&play->colCtx, this->actor.floorBgId); } } sPlayerConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId); + if (sPlayerConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { sPlayerIsOnFloorConveyor = SurfaceType_IsFloorConveyor(&play->colCtx, floorPoly, this->actor.floorBgId); + if ((!sPlayerIsOnFloorConveyor && (this->actor.depthInWater > 20.0f)) || (sPlayerIsOnFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { - D_80862B16 = SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId) << 0xA; + sPlayerConveyorYaw = CONVEYOR_DIRECTION_TO_BINANG( + SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId)); } else { sPlayerConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED; } @@ -10889,94 +11266,102 @@ void func_80843178(PlayState* play, Player* this) { } this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - static Vec3f D_8085D358 = { 0.0f, 0.0f, 0.0f }; - CollisionPoly* spA8; - s32 spA4; - s16 temp_v1_3; - f32 sp9C; + static Vec3f sInteractWallCheckOffset = { 0.0f, 0.0f, 0.0f }; + CollisionPoly* wallPoly; + s32 wallBgId; + s16 yawDiff; + s32 pad; - D_8085D358.y = 178.0f * 0.1f; - D_8085D358.z = this->ageProperties->unk_38 + 10.0f; + sInteractWallCheckOffset.y = 178.0f * 0.1f; + sInteractWallCheckOffset.z = this->ageProperties->wallCheckRadius + 10.0f; - if (func_80835D58(play, this, &D_8085D358, &spA8, &spA4, &D_80862B30)) { + if (Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &wallPoly, &wallBgId, + &sPlayerInteractWallCheckResult)) { this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; - if (spA8 != this->actor.wallPoly) { - this->actor.wallPoly = spA8; - this->actor.wallBgId = spA4; - this->actor.wallYaw = Math_Atan2S_XY(spA8->normal.z, spA8->normal.x); + + if (this->actor.wallPoly != wallPoly) { + this->actor.wallPoly = wallPoly; + this->actor.wallBgId = wallBgId; + this->actor.wallYaw = Math_Atan2S_XY(wallPoly->normal.z, wallPoly->normal.x); } } - temp_v1_3 = this->actor.shape.rot.y - BINANG_ADD(this->actor.wallYaw, 0x8000); - sPlayerCurrentWallFlags = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); - D_80862B20 = ABS_ALT(temp_v1_3); - temp_v1_3 = BINANG_SUB(this->currentYaw, BINANG_ADD(this->actor.wallYaw, 0x8000)); - D_80862B24 = ABS_ALT(temp_v1_3); + yawDiff = this->actor.shape.rot.y - BINANG_ADD(this->actor.wallYaw, 0x8000); + sPlayerTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); + sPlayerShapeYawToTouchedWall = ABS_ALT(yawDiff); - temp_fv0_3 = D_80862B24 * 0.00008f; - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (temp_fv0_3 >= 1.0f)) { + yawDiff = BINANG_SUB(this->currentYaw, BINANG_ADD(this->actor.wallYaw, 0x8000)); + sPlayerWorldYawToTouchedWall = ABS_ALT(yawDiff); + + speedScale = sPlayerWorldYawToTouchedWall * 0.00008f; + + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (speedScale >= 1.0f)) { this->unk_B50 = R_RUN_SPEED_LIMIT / 100.0f; } else { - temp_fv1 = (R_RUN_SPEED_LIMIT / 100.0f) * temp_fv0_3; - - this->unk_B50 = temp_fv1; - if (temp_fv1 < 0.1f) { + this->unk_B50 = ceilingCheckHeight = (R_RUN_SPEED_LIMIT / 100.0f) * speedScale; + if (this->unk_B50 < 0.1f) { this->unk_B50 = 0.1f; } } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80862B20 < 0x3000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (sPlayerShapeYawToTouchedWall < 0x3000)) { CollisionPoly* wallPoly = this->actor.wallPoly; - if (ABS_ALT(wallPoly->normal.y) < 0x258) { + if (ABS_ALT(wallPoly->normal.y) < 600) { f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 wallPolyNormalY = COLPOLY_GET_NORMAL(wallPoly->normal.y); f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); - f32 temp_fv1_3; - CollisionPoly* sp84; - CollisionPoly* sp80; - s32 sp7C; - Vec3f sp70; - f32 temp_fv0_5; - f32 sp68; - s32 temp_v1_6; + f32 ledgeCheckOffsetXZ; + CollisionPoly* ledgeFloorPoly; + CollisionPoly* poly; + s32 bgId; + Vec3f ledgeCheckPos; + f32 ledgePosY; + f32 ceillingPosY; + s32 wallYawDiff; - this->wallDistance = Math3D_UDistPlaneToPos(wallPolyNormalX, wallPolyNormalY, wallPolyNormalZ, - wallPoly->dist, &this->actor.world.pos); - temp_fv1_3 = this->wallDistance + 10.0f; - sp70.x = this->actor.world.pos.x - (temp_fv1_3 * wallPolyNormalX); - sp70.z = this->actor.world.pos.z - (temp_fv1_3 * wallPolyNormalZ); - sp70.y = this->actor.world.pos.y + this->ageProperties->unk_0C; - temp_fv0_5 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp84, &sp7C, &this->actor, &sp70); + this->distToInteractWall = Math3D_UDistPlaneToPos(wallPolyNormalX, wallPolyNormalY, wallPolyNormalZ, + wallPoly->dist, &this->actor.world.pos); - this->wallHeight = temp_fv0_5 - this->actor.world.pos.y; - if ((this->wallHeight < 178.0f * 0.1f) || - ((BgCheck_EntityCheckCeiling(&play->colCtx, &sp68, &this->actor.world.pos, - (temp_fv0_5 - this->actor.world.pos.y) + 20.0f, &sp80, &sp7C, - &this->actor) != 0))) { - this->wallHeight = 399.96002f; + ledgeCheckOffsetXZ = this->distToInteractWall + 10.0f; + + ledgeCheckPos.x = this->actor.world.pos.x - (ledgeCheckOffsetXZ * wallPolyNormalX); + ledgeCheckPos.z = this->actor.world.pos.z - (ledgeCheckOffsetXZ * wallPolyNormalZ); + ledgeCheckPos.y = this->actor.world.pos.y + this->ageProperties->unk_0C; + + ledgePosY = + BgCheck_EntityRaycastFloor5(&play->colCtx, &ledgeFloorPoly, &bgId, &this->actor, &ledgeCheckPos); + this->yDistToLedge = ledgePosY - this->actor.world.pos.y; + + if ((this->yDistToLedge < 178.0f * 0.1f) || + BgCheck_EntityCheckCeiling(&play->colCtx, &ceillingPosY, &this->actor.world.pos, + (ledgePosY - this->actor.world.pos.y) + 20.0f, &poly, &bgId, + &this->actor)) { + this->yDistToLedge = LEDGE_DIST_MAX; } else { - D_8085D358.y = (temp_fv0_5 + 5.0f) - this->actor.world.pos.y; + sInteractWallCheckOffset.y = (ledgePosY + 5.0f) - this->actor.world.pos.y; - if ((func_80835D58(play, this, &D_8085D358, &sp80, &sp7C, &D_80862B30)) && - (temp_v1_6 = this->actor.wallYaw - Math_Atan2S_XY(sp80->normal.z, sp80->normal.x), - ABS_ALT(temp_v1_6) < 0x4000) && - !(SurfaceType_CheckWallFlag1(&play->colCtx, sp80, sp7C))) { - this->wallHeight = 399.96002f; - } else if (SurfaceType_CheckWallFlag0(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { - if (this->ageProperties->unk_1C <= this->wallHeight) { - if (ABS_ALT(sp84->normal.y) > 0x5DC0) { - if ((this->ageProperties->unk_14 <= this->wallHeight) || func_801242B4(this)) { - spC7 = 4; - } else if (this->ageProperties->unk_18 <= this->wallHeight) { - spC7 = 3; + if (Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &poly, &bgId, + &sPlayerInteractWallCheckResult) && + (wallYawDiff = (s32)(this->actor.wallYaw - Math_Atan2S_XY(poly->normal.z, poly->normal.x)), + ABS_ALT(wallYawDiff) < 0x4000) && + !SurfaceType_CheckWallFlag1(&play->colCtx, poly, bgId)) { + this->yDistToLedge = LEDGE_DIST_MAX; + } else if (!SurfaceType_CheckWallFlag0(&play->colCtx, wallPoly, this->actor.wallBgId)) { + if (this->ageProperties->unk_1C <= this->yDistToLedge) { + if (ABS_ALT(ledgeFloorPoly->normal.y) > 0x5DC0) { + if ((this->ageProperties->unk_14 <= this->yDistToLedge) || func_801242B4(this)) { + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_4; + } else if (this->ageProperties->unk_18 <= this->yDistToLedge) { + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_3; } else { - spC7 = 2; + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_2; } } } else { - spC7 = 1; + nextLedgeClimbType = PLAYER_LEDGE_CLIMB_1; } } } @@ -10984,39 +11369,41 @@ void func_80843178(PlayState* play, Player* this) { } } else { this->unk_B50 = R_RUN_SPEED_LIMIT / 100.0f; - this->wallHeight = 0.0f; - this->unk_B5D = 0; + this->yDistToLedge = 0.0f; + this->ledgeClimbDelayTimer = 0; } - if (spC7 == this->unk_B5C) { + if (nextLedgeClimbType == this->ledgeClimbType) { if (this->linearVelocity != 0.0f) { - if (this->unk_B5D < 0x64) { - this->unk_B5D++; + if (this->ledgeClimbDelayTimer < 100) { + this->ledgeClimbDelayTimer++; } } } else { - this->unk_B5C = spC7; - this->unk_B5D = 0; + this->ledgeClimbType = nextLedgeClimbType; + this->ledgeClimbDelayTimer = 0; } - sPlayerCurrentFloorType = SurfaceType_GetFloorType(&play->colCtx, floorPoly, this->actor.floorBgId); + sPlayerFloorType = SurfaceType_GetFloorType(&play->colCtx, floorPoly, this->actor.floorBgId); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { f32 floorPolyNormalX; f32 floorPolyNormalY; f32 floorPolyNormalZ; - f32 sp54; + f32 sin; s32 pad; - f32 sp4C; + f32 cos; - D_80862B40 = SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if (func_808430E0(this) == 0) { + sPlayerFloorEffect = SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + + if (!func_808430E0(this)) { floorPolyNormalY = COLPOLY_GET_NORMAL(floorPoly->normal.y); if (this->actor.floorBgId != BGCHECK_SCENE) { DynaPoly_SetPlayerOnTop(&play->colCtx, this->actor.floorBgId); } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (this->actor.depthInWater <= 24.0f) && - (D_80862B40 != FLOOR_EFFECT_1) && (sPlayerConveyorSpeedIndex == CONVEYOR_SPEED_DISABLED) && - (floorPolyNormalY > 0.5f)) { + (sPlayerFloorEffect != FLOOR_EFFECT_1) && + (sPlayerConveyorSpeedIndex == CONVEYOR_SPEED_DISABLED) && (floorPolyNormalY > 0.5f)) { if (CutsceneManager_GetCurrentCsId() != play->playerCsIds[PLAYER_CS_ID_SONG_WARP]) { func_80841A50(play, this); } @@ -11026,26 +11413,31 @@ void func_80843178(PlayState* play, Player* this) { floorPolyNormalY = 1.0f / floorPolyNormalY; floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z); - sp54 = Math_SinS(this->currentYaw); - sp4C = Math_CosS(this->currentYaw); - this->unk_B6C = - Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * sp54) - (floorPolyNormalZ * sp4C)) * floorPolyNormalY); - this->unk_B6E = - Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * sp4C) - (floorPolyNormalZ * sp54)) * floorPolyNormalY); - sp54 = Math_SinS(this->actor.shape.rot.y); - sp4C = Math_CosS(this->actor.shape.rot.y); - D_80862B28 = - Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * sp54) - (floorPolyNormalZ * sp4C)) * floorPolyNormalY); - func_8083CF68(play, this); + sin = Math_SinS(this->currentYaw); + cos = Math_CosS(this->currentYaw); + + this->floorPitch = + Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * floorPolyNormalY); + this->floorPitchAlt = + Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * cos) - (floorPolyNormalZ * sin)) * floorPolyNormalY); + + sin = Math_SinS(this->actor.shape.rot.y); + cos = Math_CosS(this->actor.shape.rot.y); + + sPlayerFloorPitchShape = + Math_Atan2S_XY(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * floorPolyNormalY); + + Player_HandleSlopes(play, this); } } else { func_808430E0(this); - D_80862B40 = FLOOR_EFFECT_0; + sPlayerFloorEffect = FLOOR_EFFECT_0; } if (floorPoly != NULL) { - this->unk_D66 = this->floorSfxOffset; - if (spAC != 0) { + this->prevFloorSfxOffset = this->floorSfxOffset; + + if (spAC) { this->floorSfxOffset = NA_SE_PL_WALK_CONCRETE - SFX_FLAG; return; } @@ -11053,18 +11445,18 @@ void func_80843178(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.depthInWater < 50.0f) { if (this->actor.depthInWater < 20.0f) { - this->floorSfxOffset = (sPlayerCurrentFloorType == FLOOR_TYPE_13) ? NA_SE_PL_WALK_DIRT - SFX_FLAG - : NA_SE_PL_WALK_WATER0 - SFX_FLAG; + this->floorSfxOffset = (sPlayerFloorType == FLOOR_TYPE_13) ? NA_SE_PL_WALK_DIRT - SFX_FLAG + : NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { - this->floorSfxOffset = (sPlayerCurrentFloorType == FLOOR_TYPE_13) ? NA_CODE_DIRT_DEEP - SFX_FLAG - : NA_SE_PL_WALK_WATER1 - SFX_FLAG; + this->floorSfxOffset = (sPlayerFloorType == FLOOR_TYPE_13) ? NA_CODE_DIRT_DEEP - SFX_FLAG + : NA_SE_PL_WALK_WATER1 - SFX_FLAG; } return; } } - if (this->stateFlags2 & PLAYER_STATE2_200) { + if (this->stateFlags2 & PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND) { this->floorSfxOffset = NA_SE_PL_WALK_SAND - SFX_FLAG; } else if (COLPOLY_GET_NORMAL(floorPoly->normal.y) > 0.5f) { this->floorSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, floorPoly, this->actor.floorBgId); @@ -11082,7 +11474,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { seqMode = SEQ_MODE_DEFAULT; if (this->stateFlags1 & PLAYER_STATE1_100000) { seqMode = SEQ_MODE_STILL; - } else if (this->csMode != PLAYER_CSMODE_0) { + } else if (this->csMode != PLAYER_CSMODE_NONE) { Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); } else { camera = (this->actor.id == ACTOR_PLAYER) ? Play_GetCamera(play, CAM_ID_MAIN) @@ -11090,7 +11482,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_80)) { camMode = CAM_MODE_HOOKSHOT; Camera_SetViewParam(camera, CAM_VIEW_TARGET, this->actor.parent); - } else if (func_8084BC64 == this->actionFunc) { + } else if (Player_Action_21 == this->actionFunc) { camMode = CAM_MODE_STILL; } else if (this->stateFlags3 & PLAYER_STATE3_8000) { if (this->stateFlags1 & PLAYER_STATE1_8000000) { @@ -11106,7 +11498,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } } else if (this->stateFlags2 & PLAYER_STATE2_100) { camMode = CAM_MODE_PUSHPULL; - } else if (this->targetedActor != NULL) { + } else if (this->lockOnActor != NULL) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK_REQUESTED)) { camMode = CAM_MODE_TALK; } else if (this->stateFlags1 & PLAYER_STATE1_10000) { @@ -11118,7 +11510,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else { camMode = CAM_MODE_BATTLE; } - Camera_SetViewParam(camera, CAM_VIEW_TARGET, this->targetedActor); + Camera_SetViewParam(camera, CAM_VIEW_TARGET, this->lockOnActor); } else if (this->stateFlags1 & PLAYER_STATE1_1000) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags3 & PLAYER_STATE3_100) { @@ -11154,12 +11546,12 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_CLIMB; } else if (this->stateFlags1 & PLAYER_STATE1_80000) { camMode = CAM_MODE_FREEFALL; - } else if (((func_808548B8 == this->actionFunc) && + } else if (((Player_Action_84 == this->actionFunc) && (this->meleeWeaponAnimation >= PLAYER_MWA_FORWARD_SLASH_1H) && (this->meleeWeaponAnimation <= PLAYER_MWA_ZORA_PUNCH_KICK)) || (this->stateFlags3 & PLAYER_STATE3_8) || - ((func_8084FE7C == this->actionFunc) && (this->unk_AE8 == 0)) || - (func_808505D0 == this->actionFunc)) { + ((Player_Action_52 == this->actionFunc) && (this->actionVar2 == 0)) || + (Player_Action_53 == this->actionFunc)) { camMode = CAM_MODE_STILL; } else { camMode = CAM_MODE_NORMAL; @@ -11172,9 +11564,9 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { Camera_ChangeMode(camera, camMode); } - if (play->actorCtx.targetContext.bgmEnemy != NULL) { + if (play->actorCtx.targetCtx.bgmEnemy != NULL) { seqMode = SEQ_MODE_ENEMY; - Audio_UpdateEnemyBgmVolume(sqrtf(play->actorCtx.targetContext.bgmEnemy->xyzDistToPlayerSq)); + Audio_UpdateEnemyBgmVolume(sqrtf(play->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); } Audio_SetSequenceMode(seqMode); @@ -11191,13 +11583,13 @@ void func_808442D8(PlayState* play, Player* this) { f32 temp_fv1; if (this->unk_B0C == 0.0f) { - func_80831990(play, this, ITEM_NONE); + Player_UseItem(play, this, ITEM_NONE); return; } var_fa0 = 1.0f; if (DECR(this->unk_B28) == 0) { - Inventory_ChangeAmmo(ITEM_STICK, -1); + Inventory_ChangeAmmo(ITEM_DEKU_STICK, -1); this->unk_B28 = 1; this->unk_B0C = 0.0f; var_fa0 = 0.0f; @@ -11239,8 +11631,8 @@ void func_808445C4(PlayState* play, Player* this) { pos.x = (Rand_CenteredFloat(5.0f) + bodyPartsPos->x) - this->actor.world.pos.x; pos.y = (Rand_CenteredFloat(5.0f) + bodyPartsPos->y) - this->actor.world.pos.y; pos.z = (Rand_CenteredFloat(5.0f) + bodyPartsPos->z) - this->actor.world.pos.z; - EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, scale, 1); - func_800B8F98(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, scale, FHGFLASH_SHOCK_PLAYER); + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); } } @@ -11261,99 +11653,103 @@ void Player_DetectSecrets(PlayState* play, Player* this) { } } -s8 D_8085D384[92] = { - /* 0 */ PLAYER_CSMODE_0, - /* 1 */ PLAYER_CSMODE_2, - /* 2 */ PLAYER_CSMODE_2, - /* 3 */ PLAYER_CSMODE_4, - /* 4 */ PLAYER_CSMODE_3, - /* 5 */ PLAYER_CSMODE_56, - /* 6 */ PLAYER_CSMODE_8, - /* 7 */ PLAYER_CSMODE_0, - /* 8 */ PLAYER_CSMODE_0, - /* 9 */ PLAYER_CSMODE_135, - /* 10 */ PLAYER_CSMODE_21, - /* 11 */ PLAYER_CSMODE_61, - /* 12 */ PLAYER_CSMODE_62, - /* 13 */ PLAYER_CSMODE_60, - /* 14 */ PLAYER_CSMODE_63, - /* 15 */ PLAYER_CSMODE_64, - /* 16 */ PLAYER_CSMODE_65, - /* 17 */ PLAYER_CSMODE_66, - /* 18 */ PLAYER_CSMODE_70, - /* 19 */ PLAYER_CSMODE_19, - /* 20 */ PLAYER_CSMODE_71, - /* 21 */ PLAYER_CSMODE_72, - /* 22 */ PLAYER_CSMODE_67, - /* 23 */ PLAYER_CSMODE_73, - /* 24 */ PLAYER_CSMODE_74, - /* 25 */ PLAYER_CSMODE_75, - /* 26 */ PLAYER_CSMODE_68, - /* 27 */ PLAYER_CSMODE_69, - /* 28 */ PLAYER_CSMODE_76, - /* 29 */ PLAYER_CSMODE_116, - /* 30 */ PLAYER_CSMODE_0, - /* 31 */ PLAYER_CSMODE_40, - /* 32 */ PLAYER_CSMODE_0, - /* 33 */ -PLAYER_CSMODE_52, // the only negative one - /* 34 */ PLAYER_CSMODE_42, - /* 35 */ PLAYER_CSMODE_43, - /* 36 */ PLAYER_CSMODE_57, - /* 37 */ PLAYER_CSMODE_81, - /* 38 */ PLAYER_CSMODE_41, - /* 39 */ PLAYER_CSMODE_53, - /* 40 */ PLAYER_CSMODE_54, - /* 41 */ PLAYER_CSMODE_44, - /* 42 */ PLAYER_CSMODE_55, - /* 43 */ PLAYER_CSMODE_45, - /* 44 */ PLAYER_CSMODE_46, - /* 45 */ PLAYER_CSMODE_47, - /* 46 */ PLAYER_CSMODE_48, - /* 47 */ PLAYER_CSMODE_49, - /* 48 */ PLAYER_CSMODE_50, - /* 49 */ PLAYER_CSMODE_51, - /* 50 */ PLAYER_CSMODE_77, - /* 51 */ PLAYER_CSMODE_78, - /* 52 */ PLAYER_CSMODE_79, - /* 53 */ PLAYER_CSMODE_80, - /* 54 */ PLAYER_CSMODE_81, - /* 55 */ PLAYER_CSMODE_82, - /* 56 */ PLAYER_CSMODE_83, - /* 57 */ PLAYER_CSMODE_84, - /* 58 */ PLAYER_CSMODE_85, - /* 59 */ PLAYER_CSMODE_86, - /* 60 */ PLAYER_CSMODE_87, - /* 61 */ PLAYER_CSMODE_88, - /* 62 */ PLAYER_CSMODE_89, - /* 63 */ PLAYER_CSMODE_90, - /* 64 */ PLAYER_CSMODE_91, - /* 65 */ PLAYER_CSMODE_92, - /* 66 */ PLAYER_CSMODE_94, - /* 67 */ PLAYER_CSMODE_95, - /* 68 */ PLAYER_CSMODE_100, - /* 69 */ PLAYER_CSMODE_101, - /* 70 */ PLAYER_CSMODE_98, - /* 71 */ PLAYER_CSMODE_99, - /* 72 */ PLAYER_CSMODE_102, - /* 73 */ PLAYER_CSMODE_103, - /* 74 */ PLAYER_CSMODE_104, - /* 75 */ PLAYER_CSMODE_112, - /* 76 */ PLAYER_CSMODE_113, - /* 77 */ PLAYER_CSMODE_117, - /* 78 */ PLAYER_CSMODE_104, - /* 79 */ PLAYER_CSMODE_104, - /* 80 */ PLAYER_CSMODE_105, - /* 81 */ PLAYER_CSMODE_106, - /* 82 */ PLAYER_CSMODE_107, - /* 83 */ PLAYER_CSMODE_108, - /* 84 */ PLAYER_CSMODE_109, - /* 85 */ PLAYER_CSMODE_110, - /* 86 */ PLAYER_CSMODE_118, - /* 87 */ PLAYER_CSMODE_119, - /* 88 */ PLAYER_CSMODE_120, - /* 89 */ PLAYER_CSMODE_114, - /* 90 */ PLAYER_CSMODE_111, - /* 91 */ PLAYER_CSMODE_122, +// Making a player csMode negative will behave as its positive counterpart +// except will disable setting the start position +#define DISABLE_PLAYER_CSMODE_START_POS(csMode) -(csMode) + +s8 sPlayerCsModes[PLAYER_CUEID_MAX] = { + /* PLAYER_CUEID_NONE */ PLAYER_CSMODE_NONE, + /* PLAYER_CUEID_1 */ PLAYER_CSMODE_2, + /* PLAYER_CUEID_2 */ PLAYER_CSMODE_2, + /* PLAYER_CUEID_3 */ PLAYER_CSMODE_4, + /* PLAYER_CUEID_4 */ PLAYER_CSMODE_3, + /* PLAYER_CUEID_5 */ PLAYER_CSMODE_56, + /* PLAYER_CUEID_6 */ PLAYER_CSMODE_8, + /* PLAYER_CUEID_7 */ PLAYER_CSMODE_NONE, + /* PLAYER_CUEID_8 */ PLAYER_CSMODE_NONE, + /* PLAYER_CUEID_9 */ PLAYER_CSMODE_135, + /* PLAYER_CUEID_10 */ PLAYER_CSMODE_21, + /* PLAYER_CUEID_11 */ PLAYER_CSMODE_61, + /* PLAYER_CUEID_12 */ PLAYER_CSMODE_62, + /* PLAYER_CUEID_13 */ PLAYER_CSMODE_60, + /* PLAYER_CUEID_14 */ PLAYER_CSMODE_63, + /* PLAYER_CUEID_15 */ PLAYER_CSMODE_64, + /* PLAYER_CUEID_16 */ PLAYER_CSMODE_65, + /* PLAYER_CUEID_17 */ PLAYER_CSMODE_66, + /* PLAYER_CUEID_18 */ PLAYER_CSMODE_70, + /* PLAYER_CUEID_19 */ PLAYER_CSMODE_19, + /* PLAYER_CUEID_20 */ PLAYER_CSMODE_71, + /* PLAYER_CUEID_21 */ PLAYER_CSMODE_72, + /* PLAYER_CUEID_22 */ PLAYER_CSMODE_67, + /* PLAYER_CUEID_23 */ PLAYER_CSMODE_73, + /* PLAYER_CUEID_24 */ PLAYER_CSMODE_74, + /* PLAYER_CUEID_25 */ PLAYER_CSMODE_75, + /* PLAYER_CUEID_26 */ PLAYER_CSMODE_68, + /* PLAYER_CUEID_27 */ PLAYER_CSMODE_69, + /* PLAYER_CUEID_28 */ PLAYER_CSMODE_76, + /* PLAYER_CUEID_29 */ PLAYER_CSMODE_116, + /* PLAYER_CUEID_30 */ PLAYER_CSMODE_NONE, + /* PLAYER_CUEID_31 */ PLAYER_CSMODE_40, + /* PLAYER_CUEID_32 */ PLAYER_CSMODE_NONE, + /* PLAYER_CUEID_33 */ DISABLE_PLAYER_CSMODE_START_POS(PLAYER_CSMODE_52), + /* PLAYER_CUEID_34 */ PLAYER_CSMODE_42, + /* PLAYER_CUEID_35 */ PLAYER_CSMODE_43, + /* PLAYER_CUEID_36 */ PLAYER_CSMODE_57, + /* PLAYER_CUEID_37 */ PLAYER_CSMODE_81, + /* PLAYER_CUEID_38 */ PLAYER_CSMODE_41, + /* PLAYER_CUEID_39 */ PLAYER_CSMODE_53, + /* PLAYER_CUEID_40 */ PLAYER_CSMODE_54, + /* PLAYER_CUEID_41 */ PLAYER_CSMODE_44, + /* PLAYER_CUEID_42 */ PLAYER_CSMODE_55, + /* PLAYER_CUEID_43 */ PLAYER_CSMODE_45, + /* PLAYER_CUEID_44 */ PLAYER_CSMODE_46, + /* PLAYER_CUEID_45 */ PLAYER_CSMODE_47, + /* PLAYER_CUEID_46 */ PLAYER_CSMODE_48, + /* PLAYER_CUEID_47 */ PLAYER_CSMODE_49, + /* PLAYER_CUEID_48 */ PLAYER_CSMODE_50, + /* PLAYER_CUEID_49 */ PLAYER_CSMODE_51, + /* PLAYER_CUEID_50 */ PLAYER_CSMODE_77, + /* PLAYER_CUEID_51 */ PLAYER_CSMODE_78, + /* PLAYER_CUEID_52 */ PLAYER_CSMODE_79, + /* PLAYER_CUEID_53 */ PLAYER_CSMODE_80, + /* PLAYER_CUEID_54 */ PLAYER_CSMODE_81, + /* PLAYER_CUEID_55 */ PLAYER_CSMODE_82, + /* PLAYER_CUEID_56 */ PLAYER_CSMODE_83, + /* PLAYER_CUEID_57 */ PLAYER_CSMODE_84, + /* PLAYER_CUEID_58 */ PLAYER_CSMODE_85, + /* PLAYER_CUEID_59 */ PLAYER_CSMODE_86, + /* PLAYER_CUEID_60 */ PLAYER_CSMODE_87, + /* PLAYER_CUEID_61 */ PLAYER_CSMODE_88, + /* PLAYER_CUEID_62 */ PLAYER_CSMODE_89, + /* PLAYER_CUEID_63 */ PLAYER_CSMODE_90, + /* PLAYER_CUEID_64 */ PLAYER_CSMODE_91, + /* PLAYER_CUEID_65 */ PLAYER_CSMODE_92, + /* PLAYER_CUEID_66 */ PLAYER_CSMODE_94, + /* PLAYER_CUEID_67 */ PLAYER_CSMODE_95, + /* PLAYER_CUEID_68 */ PLAYER_CSMODE_100, + /* PLAYER_CUEID_69 */ PLAYER_CSMODE_101, + /* PLAYER_CUEID_70 */ PLAYER_CSMODE_98, + /* PLAYER_CUEID_71 */ PLAYER_CSMODE_99, + /* PLAYER_CUEID_72 */ PLAYER_CSMODE_102, + /* PLAYER_CUEID_73 */ PLAYER_CSMODE_103, + /* PLAYER_CUEID_74 */ PLAYER_CSMODE_104, + /* PLAYER_CUEID_75 */ PLAYER_CSMODE_112, + /* PLAYER_CUEID_76 */ PLAYER_CSMODE_113, + /* PLAYER_CUEID_77 */ PLAYER_CSMODE_117, + /* PLAYER_CUEID_78 */ PLAYER_CSMODE_104, + /* PLAYER_CUEID_79 */ PLAYER_CSMODE_104, + /* PLAYER_CUEID_80 */ PLAYER_CSMODE_105, + /* PLAYER_CUEID_81 */ PLAYER_CSMODE_106, + /* PLAYER_CUEID_82 */ PLAYER_CSMODE_107, + /* PLAYER_CUEID_83 */ PLAYER_CSMODE_108, + /* PLAYER_CUEID_84 */ PLAYER_CSMODE_109, + /* PLAYER_CUEID_85 */ PLAYER_CSMODE_110, + /* PLAYER_CUEID_86 */ PLAYER_CSMODE_118, + /* PLAYER_CUEID_87 */ PLAYER_CSMODE_119, + /* PLAYER_CUEID_88 */ PLAYER_CSMODE_120, + /* PLAYER_CUEID_89 */ PLAYER_CSMODE_114, + /* PLAYER_CUEID_90 */ PLAYER_CSMODE_111, + /* PLAYER_CUEID_91 */ PLAYER_CSMODE_122, }; f32 D_8085D3E0[PLAYER_FORM_MAX] = { @@ -11381,7 +11777,7 @@ void func_80844784(PlayState* play, Player* this) { s16 temp_v0; f32 temp_fv0_2; - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sPlayerCurrentFloorType == FLOOR_TYPE_5) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sPlayerFloorType == FLOOR_TYPE_5) && (this->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER)) { var_a3 = this->currentYaw; var_fv0 = this->linearVelocity; @@ -11392,7 +11788,7 @@ void func_80844784(PlayState* play, Player* this) { var_a3 += 0x8000; } - if ((Math_StepToF(&this->actor.speed, var_fv0, 0.35f) != 0) && (var_fv0 == 0.0f)) { + if (Math_StepToF(&this->actor.speed, var_fv0, 0.35f) && (var_fv0 == 0.0f)) { this->actor.world.rot.y = this->currentYaw; } @@ -11403,8 +11799,8 @@ void func_80844784(PlayState* play, Player* this) { Math_ScaledStepToS(&this->actor.world.rot.y, var_a3, temp_ft2); } if ((this->linearVelocity == 0.0f) && (this->actor.speed != 0.0f)) { - func_8019F780(&this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), - this->actor.speed); + Audio_PlaySfx_AtPosWithSyncedFreqAndVolume( + &this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), this->actor.speed); } } else { this->actor.speed = this->linearVelocity; @@ -11417,7 +11813,7 @@ void func_80844784(PlayState* play, Player* this) { ((this->pushedSpeed != 0.0f) || (this->windSpeed != 0.0f) || (play->envCtx.windSpeed >= 50.0f)) && (!Player_InCsMode(play)) && !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_200000)) && - !(this->stateFlags3 & PLAYER_STATE3_100) && (func_8084D4EC != this->actionFunc) && + !(this->stateFlags3 & PLAYER_STATE3_100) && (Player_Action_33 != this->actionFunc) && (this->actor.id == ACTOR_PLAYER)) { this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw); this->actor.velocity.z += this->pushedSpeed * Math_CosS(this->pushedYaw); @@ -11432,20 +11828,20 @@ void func_80844784(PlayState* play, Player* this) { if ((sp50 > 0.0f) && (this->transformation == PLAYER_FORM_DEKU) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (Player_SetAction(play, this, func_80856918, 1)) { + if (Player_SetAction(play, this, Player_Action_94, 1)) { this->stateFlags3 |= PLAYER_STATE3_2000 | PLAYER_STATE3_1000000; func_8082E1F0(this, NA_SE_IT_DEKUNUTS_FLOWER_OPEN); - func_8019FD90(4, 2); + Audio_SetSfxTimerLerpInterval(4, 2); } - this->unk_AE8 = 0x270F; + this->actionVar2 = 0x270F; Math_Vec3f_Copy(this->unk_AF0, &this->actor.world.pos); } if (play->envCtx.windSpeed >= 50.0f) { - temp_fa0 = play->envCtx.windDir.x; - temp_fa1 = play->envCtx.windDir.y; - temp_ft4 = play->envCtx.windDir.z; + temp_fa0 = play->envCtx.windDirection.x; + temp_fa1 = play->envCtx.windDirection.y; + temp_ft4 = play->envCtx.windDirection.z; temp_fv0_2 = sqrtf(SQ(temp_fa0) + SQ(temp_fa1) + SQ(temp_ft4)); if (temp_fv0_2 != 0.0f) { @@ -11471,8 +11867,9 @@ void func_80844784(PlayState* play, Player* this) { func_8083FBC4(play, this); } - func_8019F780(&this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), - fabsf(D_80862B3C)); + Audio_PlaySfx_AtPosWithSyncedFreqAndVolume(&this->actor.projectedPos, + Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), + fabsf(D_80862B3C)); } this->actor.velocity.x += sp48; @@ -11530,13 +11927,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_D6A++; if (this->unk_D6A == 0) { this->unk_D6A = 1; - play_sound(NA_SE_OC_REVENGE); + Audio_PlaySfx(NA_SE_OC_REVENGE); } } Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.home.pos); - temp_fv1 = fabsf(this->linearVelocity) * (fabsf(Math_SinS(this->unk_B6C) * 800.0f) + 100.0f); + temp_fv1 = fabsf(this->linearVelocity) * (fabsf(Math_SinS(this->floorPitch) * 800.0f) + 100.0f); Math_StepToF(&this->unk_AC0, 0.0f, CLAMP_MIN(temp_fv1, 300.0f)); @@ -11586,7 +11983,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->lightInfo.params.point.radius = -1; } - if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_B28 != 0)) { + if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_B28 != 0)) { func_808442D8(play, this); } else if (this->heldItemAction == PLAYER_IA_FISHING_ROD) { if (this->unk_B28 < 0) { @@ -11606,7 +12003,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_StopHorizontalMovement(this); Actor_MoveWithGravity(&this->actor); } - func_80843178(play, this); + Player_ProcessSceneCollision(play, this); } else { f32 temp_fa0; f32 var_fv1_2; @@ -11626,8 +12023,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { func_8083B930(play, this); this->stateFlags2 &= ~PLAYER_STATE2_400; - if (func_808508C8 == this->actionFunc) { - this->unk_AE8 = 20; + if (Player_Action_54 == this->actionFunc) { + this->actionVar2 = 20; } } this->prevBoots = this->currentBoots; @@ -11635,7 +12032,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((this->actor.parent == NULL) && (this->stateFlags1 & PLAYER_STATE1_800000)) { this->actor.parent = this->rideActor; func_80837BD0(play, this); - this->unk_AE8 = -1; + this->actionVar2 = -1; Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_uma_wait_1); func_8082E920(play, this, ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } @@ -11672,9 +12069,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if (!(this->stateFlags1 & PLAYER_STATE1_2) && (this->actor.parent == NULL)) { func_80844784(play, this); } - func_80843178(play, this); + Player_ProcessSceneCollision(play, this); } else { - sPlayerCurrentFloorType = FLOOR_TYPE_0; + sPlayerFloorType = FLOOR_TYPE_0; this->floorProperty = FLOOR_PROPERTY_0; if (this->stateFlags1 & PLAYER_STATE1_800000) { this->actor.floorPoly = this->rideActor->floorPoly; @@ -11684,7 +12081,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->pushedSpeed = 0.0f; } - func_8083562C(play, this, this->actor.floorPoly, this->actor.floorBgId); + Player_HandleExitsAndVoids(play, this, this->actor.floorPoly, this->actor.floorBgId); if (sPlayerConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { f32 conveyorSpeed; s32 pad2; @@ -11700,13 +12097,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } Math_StepToF(&this->pushedSpeed, conveyorSpeed, conveyorSpeed * 0.1f); - Math_ScaledStepToS(&this->pushedYaw, D_80862B16, + Math_ScaledStepToS(&this->pushedYaw, sPlayerConveyorYaw, ((this->stateFlags1 & PLAYER_STATE1_8000000) ? 400.0f : 800.0f) * conveyorSpeed); } else if (this->pushedSpeed != 0.0f) { Math_StepToF(&this->pushedSpeed, 0.0f, (this->stateFlags1 & PLAYER_STATE1_8000000) ? 0.5f : 2.0f); } if (!(this->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) && - !(this->stateFlags3 & PLAYER_STATE3_80) && (func_80854430 != this->actionFunc)) { + !(this->stateFlags3 & PLAYER_STATE3_80) && (Player_Action_80 != this->actionFunc)) { func_8083BB4C(play, this); if (!Play_InCsMode(play)) { if ((this->actor.id == ACTOR_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_80000000) && @@ -11737,7 +12134,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_DetectSecrets(play, this); } } - } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (func_8084D820 == this->actionFunc) && + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (Player_Action_35 == this->actionFunc) && (this->unk_397 == 4)) { this->actor.world.pos.y = this->actor.prevPos.y; } @@ -11745,10 +12142,11 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if (play->csCtx.state != CS_STATE_IDLE) { if ((this->csMode != PLAYER_CSMODE_5) && !(this->stateFlags1 & PLAYER_STATE1_800000)) { if (!(this->stateFlags2 & PLAYER_STATE2_80) && (this->actor.id == ACTOR_PLAYER)) { - if ((play->csCtx.playerCue != NULL) && (D_8085D384[play->csCtx.playerCue->id] != 0)) { + if ((play->csCtx.playerCue != NULL) && + (sPlayerCsModes[play->csCtx.playerCue->id] != PLAYER_CSMODE_NONE)) { func_800B7298(play, NULL, PLAYER_CSMODE_5); Player_StopHorizontalMovement(this); - } else if (((u32)this->csMode == PLAYER_CSMODE_0) && + } else if (((u32)this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags2 & (PLAYER_STATE2_400 | PLAYER_STATE2_8000000)) && (play->csCtx.state != CS_STATE_STOP)) { func_800B7298(play, NULL, PLAYER_CSMODE_20); @@ -11758,48 +12156,49 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } } - if ((u32)this->csMode != PLAYER_CSMODE_0) { + if ((u32)this->csMode != PLAYER_CSMODE_NONE) { if ((this->csMode != PLAYER_CSMODE_END) || !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_200000 | PLAYER_STATE1_4000000))) { - if (func_8085B08C != this->actionFunc) { + if (Player_Action_97 != this->actionFunc) { this->unk_AA5 = PLAYER_UNKAA5_4; if (this->csMode == PLAYER_CSMODE_5) { func_808387A0(play, this); func_8082DAD4(this); } } - } else if (func_8085B08C != this->actionFunc) { - func_8085AACC(play, this, 0); + } else if (Player_Action_97 != this->actionFunc) { + Player_CsAction_End(play, this, NULL); } } else { - this->prevCsMode = PLAYER_CSMODE_0; + this->prevCsMode = PLAYER_CSMODE_NONE; } func_8083BF54(play, this); Lights_PointSetPosition(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z); - if (((this->targetedActor == NULL) || (this->targetedActor == this->talkActor) || - (this->targetedActor->hintId == TATL_HINT_ID_NONE)) && + if (((this->lockOnActor == NULL) || (this->lockOnActor == this->talkActor) || + (this->lockOnActor->hintId == TATL_HINT_ID_NONE)) && (this->tatlTextId == 0)) { this->stateFlags2 &= ~(PLAYER_STATE2_2 | PLAYER_STATE2_200000); } this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_1000 | PLAYER_STATE1_400000); - this->stateFlags2 &= ~(PLAYER_STATE2_1 | PLAYER_STATE2_4 | PLAYER_STATE2_8 | PLAYER_STATE2_20 | - PLAYER_STATE2_40 | PLAYER_STATE2_100 | PLAYER_STATE2_200 | PLAYER_STATE2_1000 | - PLAYER_STATE2_4000 | PLAYER_STATE2_10000 | PLAYER_STATE2_400000 | PLAYER_STATE2_4000000); + this->stateFlags2 &= + ~(PLAYER_STATE2_1 | PLAYER_STATE2_4 | PLAYER_STATE2_8 | PLAYER_STATE2_20 | PLAYER_STATE2_40 | + PLAYER_STATE2_100 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_1000 | PLAYER_STATE2_4000 | + PLAYER_STATE2_10000 | PLAYER_STATE2_400000 | PLAYER_STATE2_4000000); this->stateFlags3 &= ~(PLAYER_STATE3_10 | PLAYER_STATE3_40 | PLAYER_STATE3_100 | PLAYER_STATE3_800 | PLAYER_STATE3_1000 | PLAYER_STATE3_100000 | PLAYER_STATE3_2000000 | PLAYER_STATE3_4000000 | PLAYER_STATE3_8000000 | PLAYER_STATE3_10000000); func_808425B4(this); - func_8082EB38(play, this); + Player_ProcessControlStick(play, this); D_8085C3E4 = (this->stateFlags1 & PLAYER_STATE1_8000000) ? 0.5f : 1.0f; D_8085C3E8 = 1.0f / D_8085C3E4; - D_80862B48 = D_80862B4C = 0; + sPlayerUseHeldItem = sPlayerHeldItemButtonIsHeldDown = false; var_v1 = Play_InCsMode(play); D_80862B2C = this->currentMask; @@ -11824,7 +12223,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->talkActorDistance = 0.0f; } else { this->talkActor = NULL; - this->exchangeItemId = PLAYER_IA_NONE; + this->exchangeItemAction = PLAYER_IA_NONE; this->talkActorDistance = FLT_MAX; } if (!(this->actor.flags & ACTOR_FLAG_20000000) && (this->unk_AA5 != PLAYER_UNKAA5_5)) { @@ -11921,7 +12320,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if (!(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_800000)) && !(this->stateFlags3 & PLAYER_STATE3_10000000)) { - if ((func_808561B0 != this->actionFunc) && (func_80853D68 != this->actionFunc) && + if ((Player_Action_93 != this->actionFunc) && (Player_Action_73 != this->actionFunc) && (this->actor.draw != NULL)) { if ((this->actor.id != ACTOR_PLAYER) && (this->csMode == PLAYER_CSMODE_110)) { this->cylinder.dim.radius = 8; @@ -11930,8 +12329,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } } if (!(this->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_4000000)) && (this->invincibilityTimer <= 0)) { - if ((func_808561B0 != this->actionFunc) && - ((func_80857BE8 != this->actionFunc) || (this->unk_AE7 != 1))) { + if ((Player_Action_93 != this->actionFunc) && + ((Player_Action_96 != this->actionFunc) || (this->actionVar1 != 1))) { if (this->cylinder.base.atFlags != AT_NONE) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); } @@ -11982,7 +12381,7 @@ void Player_Update(Actor* thisx, PlayState* play) { // This block is a leftover dog-following mechanic from OoT if (gSaveContext.dogParams < 0) { - if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0) { + if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) { gSaveContext.dogParams = 0; } else { Actor* dog; @@ -12005,7 +12404,7 @@ void Player_Update(Actor* thisx, PlayState* play) { } if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { - func_8082DCA0(play, this); + Player_DetachHeldActor(play, this); } if ((play->actorCtx.unk268 != 0) && (this == GET_PLAYER(play))) { @@ -12049,7 +12448,7 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, void func_80846460(Player* this) { Vec3f* pos; - Vec3f* bodyPartsPos; + Vec3f* bodyPartPosPtr; s32 i; this->actor.focus.pos.x = this->actor.world.pos.x; @@ -12057,15 +12456,15 @@ void func_80846460(Player* this) { this->actor.focus.pos.y = this->actor.world.pos.y + 24.0f; pos = &this->actor.world.pos; - bodyPartsPos = this->bodyPartsPos; - for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { - Math_Vec3f_Copy(bodyPartsPos, pos); - bodyPartsPos++; + bodyPartPosPtr = this->bodyPartsPos; + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { + Math_Vec3f_Copy(bodyPartPosPtr, pos); + bodyPartPosPtr++; } this->bodyPartsPos[PLAYER_BODYPART_HEAD].y = this->actor.world.pos.y + 24.0f; this->bodyPartsPos[PLAYER_BODYPART_WAIST].y = this->actor.world.pos.y + 60.0f; - Math_Vec3f_Copy(this->actor.shape.feetPos, pos); + Math_Vec3f_Copy(&this->actor.shape.feetPos[0], pos); Math_Vec3f_Copy(&this->actor.shape.feetPos[1], pos); } @@ -12160,7 +12559,7 @@ void Player_Draw(Actor* thisx, PlayState* play) { spE0 = 0.0f; } else { Matrix_Translate(0.0f, -this->unk_ABC, 0.0f, MTXMODE_APPLY); - spE0 = this->unk_AE8 - 6; + spE0 = this->actionVar2 - 6; if (spE0 < 0.0f) { spE8 = D_8085D55C; spE0 = this->unk_B86[0]; @@ -12219,7 +12618,7 @@ void Player_Draw(Actor* thisx, PlayState* play) { CLAMP_MIN(spB8, spB4) * this->actor.scale.z * 1.15f, MTXMODE_APPLY); Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); Scene_SetRenderModeXlu(play, 0, 1); - Lib_LerpRGB(&D_8085D580, &D_8085D584, this->unk_B10[0], &spBC); + Color_RGB8_Lerp(&D_8085D580, &D_8085D584, this->unk_B10[0], &spBC); gDPSetEnvColor(POLY_OPA_DISP++, spBC.r, spBC.g, spBC.b, 255); @@ -12241,11 +12640,11 @@ void Player_Draw(Actor* thisx, PlayState* play) { func_80122BA4(play, &this->unk_3D0, 2, 255); if (this->unk_B86[1] < 3) { - if (this->unk_AE7 >= 5) { + if (this->actionVar1 >= 5) { f32 var_fa1; u8 sp9B; - var_fa1 = (this->unk_AE7 - 4) * 0.02f; + var_fa1 = (this->actionVar1 - 4) * 0.02f; if (this->unk_B86[1] != 0) { sp9B = (-this->unk_B86[1] * 0x55) + 0xFF; @@ -12276,7 +12675,7 @@ void Player_Draw(Actor* thisx, PlayState* play) { NULL, NULL, NULL); } else { OverrideLimbDrawFlex sp84 = Player_OverrideLimbDrawGameplayDefault; - s32 lod = ((this->csMode != PLAYER_CSMODE_0) || (this->actor.projectedPos.z < 320.0f)) ? 0 : 1; + s32 lod = ((this->csMode != PLAYER_CSMODE_NONE) || (this->actor.projectedPos.z < 320.0f)) ? 0 : 1; Vec3f sp74; //! FAKE @@ -12490,19 +12889,19 @@ void func_808477D0(PlayState* play, Player* this, Input* input, f32 arg3) { s32 func_80847880(PlayState* play, Player* this) { if (play->unk_1887C != 0) { if (play->sceneId == SCENE_20SICHITAI) { - Player_SetAction(play, this, func_80854430, 0); + Player_SetAction(play, this, Player_Action_80, 0); play->unk_1887C = 0; - this->csMode = PLAYER_CSMODE_0; + this->csMode = PLAYER_CSMODE_NONE; return true; } func_8082DE50(play, this); - Player_SetAction(play, this, func_80854614, 0); + Player_SetAction(play, this, Player_Action_81, 0); if (!func_800B7118(this) || Player_IsHoldingHookshot(this)) { - func_80831990(play, this, ITEM_BOW); + Player_UseItem(play, this, ITEM_BOW); } Player_AnimationPlayOnce(play, this, func_8082ED20(this)); - this->csMode = PLAYER_CSMODE_0; + this->csMode = PLAYER_CSMODE_NONE; this->stateFlags1 |= PLAYER_STATE1_100000; Player_StopHorizontalMovement(this); func_80836D8C(this); @@ -12517,7 +12916,7 @@ s32 func_80847994(PlayState* play, Player* this) { this->stateFlags3 &= ~PLAYER_STATE3_20; this->itemAction = PLAYER_IA_OCARINA; this->unk_AA5 = PLAYER_UNKAA5_5; - func_80838A90(this, play); + Player_ActionChange_13(this, play); return true; } return false; @@ -12534,7 +12933,7 @@ void func_808479F4(PlayState* play, Player* this, f32 arg2) { } void func_80847A50(Player* this) { - Player_PlaySfx(this, ((this->unk_AE7 != 0) ? NA_SE_PL_WALK_METAL1 : NA_SE_PL_WALK_LADDER) + + Player_PlaySfx(this, ((this->actionVar1 != 0) ? NA_SE_PL_WALK_METAL1 : NA_SE_PL_WALK_LADDER) + this->ageProperties->surfaceSfxIdOffset); } @@ -12559,19 +12958,21 @@ s32 func_80847A94(PlayState* play, Player* this, s32 arg2, f32* arg3) { f32 sp5C = rideActor->world.pos.y - 20.0f; Vec3f sp50; Vec3f sp44; - CollisionPoly* sp40; - CollisionPoly* sp3C; - s32 sp38; - s32 sp34; + CollisionPoly* wallPoly; + CollisionPoly* floorPoly; + s32 wallBgId; + s32 floorBgId; - *arg3 = func_80835CD8(play, this, &D_8085D588[arg2], &sp50, &sp3C, &sp34); + *arg3 = func_80835CD8(play, this, &D_8085D588[arg2], &sp50, &floorPoly, &floorBgId); if ((sp5C < *arg3) && (*arg3 < sp60)) { - if (!func_80835D58(play, this, &D_8085D5A0[arg2], &sp40, &sp38, &sp44)) { - if (!func_80835D58(play, this, &D_8085D5B8[arg2], &sp40, &sp38, &sp44)) { - this->actor.floorPoly = sp3C; - this->actor.floorBgId = sp38; - this->floorSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, sp3C, sp34); + if (!Player_PosVsWallLineTest(play, this, &D_8085D5A0[arg2], &wallPoly, &wallBgId, &sp44)) { + if (!Player_PosVsWallLineTest(play, this, &D_8085D5B8[arg2], &wallPoly, &wallBgId, &sp44)) { + this->actor.floorPoly = floorPoly; + //! @note: no poly is assigned to `wallBgId` when `Player_PosVsWallLineTest` fails. + //! Therefore, the default value `BGCHECK_SCENE` is assigned. + this->actor.floorBgId = wallBgId; + this->floorSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, floorPoly, floorBgId); return true; } } @@ -12584,8 +12985,8 @@ s32 func_80847BF0(Player* this, PlayState* play) { s32 var_a2; f32 sp34; - if (this->unk_AE8 < 0) { - this->unk_AE8 = 0x63; + if (this->actionVar2 < 0) { + this->actionVar2 = 0x63; } else { var_a2 = (this->mountSide < 0) ? 0 : 1; @@ -12607,7 +13008,7 @@ s32 func_80847BF0(Player* this, PlayState* play) { (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_8083172C(play, this, func_808505D0, 0); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_53, 0); this->unk_B48 = sp34 - rideActor->actor.world.pos.y; Player_AnimationPlayOnce(play, this, @@ -12679,7 +13080,7 @@ void func_80847FF8(Player* this, f32* arg1, f32 arg2, s16 arg3) { } void func_80848048(PlayState* play, Player* this) { - Player_SetAction(play, this, func_80851588, 0); + Player_SetAction(play, this, Player_Action_58, 0); func_8082E634(play, this, &gPlayerAnim_link_swimer_swim); } @@ -12721,11 +13122,11 @@ s32 func_80848094(PlayState* play, Player* this, f32* arg2, s16* arg3) { } void func_808481CC(PlayState* play, Player* this, f32 arg2) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; - func_80832F78(this, &sp2C, &sp2A, 0.0f, play); - func_8084748C(this, &this->linearVelocity, sp2C / 2.0f, sp2A); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + func_8084748C(this, &this->linearVelocity, speedTarget / 2.0f, yawTarget); func_8084748C(this, &this->actor.velocity.y, arg2, this->currentYaw); } @@ -12749,10 +13150,10 @@ s32 func_808482E0(PlayState* play, Player* this) { return true; } - if (this->unk_AE7 == 0) { + if (this->actionVar1 == 0) { GetItemEntry* giEntry = &sGetItemTable[this->getItemId - 1]; - this->unk_AE7 = 1; + this->actionVar1 = 1; Message_StartTextbox(play, giEntry->textId, &this->actor); Item_Give(play, giEntry->itemId); @@ -12760,7 +13161,7 @@ s32 func_808482E0(PlayState* play, Player* this) { Audio_PlayFanfare(NA_BGM_GET_NEW_MASK); } else if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_10)) || (this->getItemId == GI_RECOVERY_HEART)) { - play_sound(NA_SE_SY_GET_BOXITEM); + Audio_PlaySfx(NA_SE_SY_GET_BOXITEM); } else { s32 seqId; @@ -12782,7 +13183,7 @@ s32 func_808482E0(PlayState* play, Player* this) { Audio_PlayFanfare(seqId); } } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - if (this->getItemId == GI_OCARINA) { + if (this->getItemId == GI_OCARINA_OF_TIME) { // zelda teaching song of time cs? play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.nextCutsceneIndex = 0xFFF2; @@ -12819,7 +13220,7 @@ void func_808484F0(Player* this) { } } -s32 func_80848570(Player* this, PlayState* play) { +s32 Player_ActionChange_7(Player* this, PlayState* play) { if (!func_8083A6C0(play, this)) { if (func_808396B8(play, this)) { PlayerMeleeWeaponAnimation meleeWeaponAnim = func_808335F4(this); @@ -12869,44 +13270,46 @@ void func_80848640(PlayState* play, Player* this) { } } -s32 func_80848780(Player* this, PlayState* play) { +s32 Player_UpperAction_0(Player* this, PlayState* play) { if (func_80830B88(play, this)) { return true; } return false; } -s32 func_808487B8(Player* this, PlayState* play) { +s32 Player_UpperAction_1(Player* this, PlayState* play) { if (func_80830B88(play, this) || func_80830DF0(this, play)) { return true; } return false; } -s32 func_80848808(Player* this, PlayState* play) { - if (PlayerAnimation_Update(play, &this->unk_284) || +s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) { + if (PlayerAnimation_Update(play, &this->skelAnimeUpper) || ((Player_ItemToItemAction(this, this->heldItemId) == this->heldItemAction) && - (D_80862B48 = D_80862B48 || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && - (this->heldItemAction != PLAYER_IA_STICK) && (play->unk_1887C == 0))))) { - func_8082F43C(play, this, D_8085C9F0[this->heldItemAction]); + (sPlayerUseHeldItem = + (sPlayerUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && + (this->heldItemAction != PLAYER_IA_DEKU_STICK) && (play->unk_1887C == 0)))))) { + Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]); this->unk_ACC = 0; this->unk_AA4 = 0; - D_80862B4C = D_80862B48; - return this->unk_AC4(this, play); + sPlayerHeldItemButtonIsHeldDown = sPlayerUseHeldItem; + return this->upperActionFunc(this, play); } if (func_8082ED94(this) != 0) { - func_80830D40(play, this); + Player_WaitToFinishItemChange(play, this); Player_AnimationPlayOnce(play, this, func_8082ED20(this)); this->unk_AA4 = 0; } else { - func_80830D40(play, this); + Player_WaitToFinishItemChange(play, this); } + return true; } -s32 func_8084894C(Player* this, PlayState* play) { - PlayerAnimation_Update(play, &this->unk_284); +s32 Player_UpperAction_3(Player* this, PlayState* play) { + PlayerAnimation_Update(play, &this->skelAnimeUpper); if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_R)) { func_80830CE8(play, this); } else { @@ -12919,14 +13322,14 @@ s32 func_8084894C(Player* this, PlayState* play) { return true; } -s32 func_80848A0C(Player* this, PlayState* play) { - if (PlayerAnimation_Update(play, &this->unk_284)) { +s32 Player_UpperAction_4(Player* this, PlayState* play) { + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { PlayerAnimationHeader* anim; - f32 lastFrame; + f32 endFrame; anim = func_80830A58(play, this); - lastFrame = Animation_GetLastFrame(anim); - PlayerAnimation_Change(play, &this->unk_284, anim, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f); + endFrame = Animation_GetLastFrame(anim); + PlayerAnimation_Change(play, &this->skelAnimeUpper, anim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE, 0.0f); } this->stateFlags1 |= PLAYER_STATE1_400000; @@ -12934,20 +13337,19 @@ s32 func_80848A0C(Player* this, PlayState* play) { return true; } -s32 func_80848AB0(Player* this, PlayState* play) { - // possibly a case of if ((D_80862B48 = D_80862B4C) || PlayerAnimation_Update(play, &this->unk_284)) - D_80862B48 = D_80862B4C; - if ((D_80862B48 != 0) || PlayerAnimation_Update(play, &this->unk_284)) { - func_8082F43C(play, this, D_8085C9F0[this->heldItemAction]); - PlayerAnimation_PlayLoop(play, &this->unk_284, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType]); +s32 Player_UpperAction_5(Player* this, PlayState* play) { + sPlayerUseHeldItem = sPlayerHeldItemButtonIsHeldDown; + if (sPlayerUseHeldItem || PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetUpperAction(play, this, sPlayerUpperActionUpdateFuncs[this->heldItemAction]); + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, D_8085BE84[PLAYER_ANIMGROUP_0][this->modelAnimType]); this->unk_AA4 = 0; - this->unk_AC4(this, play); + this->upperActionFunc(this, play); return false; } return true; } -s32 func_80848B6C(Player* this, PlayState* play) { +s32 Player_UpperAction_6(Player* this, PlayState* play) { if (this->unk_B28 >= 0) { this->unk_B28 = -this->unk_B28; } @@ -12979,7 +13381,7 @@ u16 D_8085D5FC[] = { NA_SE_NONE, }; -s32 func_80848BF4(Player* this, PlayState* play) { +s32 Player_UpperAction_7(Player* this, PlayState* play) { s32 index; s32 temp; @@ -12997,10 +13399,10 @@ s32 func_80848BF4(Player* this, PlayState* play) { if ((this->unk_ACE == 0) && (func_8082ED94(this) == 0) && (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { - PlayerAnimation_PlayOnce(play, &this->unk_284, D_8085D5E4[index]); + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, D_8085D5E4[index]); this->unk_ACE = -1; - } else if (PlayerAnimation_Update(play, &this->unk_284)) { - PlayerAnimation_PlayLoop(play, &this->unk_284, D_8085D5F0[index]); + } else if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, D_8085D5F0[index]); this->unk_ACE = 1; } else if (this->unk_ACE == 1) { this->unk_ACE = 2; @@ -13011,8 +13413,8 @@ s32 func_80848BF4(Player* this, PlayState* play) { } func_80831010(this, play); - if ((this->unk_ACE > 0) && ((this->unk_B28 < 0) || ((D_80862B4C == 0) && !func_80830FD4(play)))) { - func_8082F43C(play, this, func_80848E4C); + if ((this->unk_ACE > 0) && ((this->unk_B28 < 0) || (!sPlayerHeldItemButtonIsHeldDown && !func_80830FD4(play)))) { + Player_SetUpperAction(play, this, Player_UpperAction_8); if (this->unk_B28 >= 0) { if (index != 0) { if (!func_80831194(play, this)) { @@ -13020,7 +13422,8 @@ s32 func_80848BF4(Player* this, PlayState* play) { } if (this->transformation == PLAYER_FORM_DEKU) { - PlayerAnimation_PlayOnceSetSpeed(play, &this->unk_284, &gPlayerAnim_pn_tamahaki, 2.0f / 3.0f); + PlayerAnimation_PlayOnceSetSpeed(play, &this->skelAnimeUpper, &gPlayerAnim_pn_tamahaki, + 2.0f / 3.0f); } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80831194(play, this); @@ -13035,16 +13438,16 @@ s32 func_80848BF4(Player* this, PlayState* play) { return 1; } -s32 func_80848E4C(Player* this, PlayState* play) { - s32 animFinished = PlayerAnimation_Update(play, &this->unk_284); +s32 Player_UpperAction_8(Player* this, PlayState* play) { + s32 animFinished = PlayerAnimation_Update(play, &this->skelAnimeUpper); if (Player_IsHoldingHookshot(this) && !func_80831124(play, this)) { return true; } if (!func_80830B88(play, this) && - ((((this->unk_B28 < 0) && (D_80862B4C != 0)) || - ((animFinished || (this->transformation != PLAYER_FORM_DEKU)) && (D_80862B48 != 0))) || + ((((this->unk_B28 < 0) && sPlayerHeldItemButtonIsHeldDown) || + ((animFinished || (this->transformation != PLAYER_FORM_DEKU)) && sPlayerUseHeldItem)) || func_80830F9C(play))) { this->unk_B28 = ABS_ALT(this->unk_B28); @@ -13052,7 +13455,7 @@ s32 func_80848E4C(Player* this, PlayState* play) { if (Player_IsHoldingHookshot(this)) { this->unk_ACE = 1; } else { - PlayerAnimation_PlayOnce(play, &this->unk_284, + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, (this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_tamahakidf : &gPlayerAnim_link_bow_bow_shoot_next); @@ -13071,10 +13474,10 @@ s32 func_80848E4C(Player* this, PlayState* play) { } if (Player_IsHoldingHookshot(this)) { - func_8082F43C(play, this, func_80848B6C); + Player_SetUpperAction(play, this, Player_UpperAction_6); } else { - func_8082F43C(play, this, func_80849054); - PlayerAnimation_PlayOnce(play, &this->unk_284, + Player_SetUpperAction(play, this, Player_UpperAction_9); + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, (this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_tamahakidf : &gPlayerAnim_link_bow_bow_shoot_end); } @@ -13084,14 +13487,14 @@ s32 func_80848E4C(Player* this, PlayState* play) { return true; } -s32 func_80849054(Player* this, PlayState* play) { - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || PlayerAnimation_Update(play, &this->unk_284)) { - func_8082F43C(play, this, func_80848B6C); +s32 Player_UpperAction_9(Player* this, PlayState* play) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetUpperAction(play, this, Player_UpperAction_6); } return true; } -s32 func_808490B4(Player* this, PlayState* play) { +s32 Player_UpperAction_10(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; if (heldActor == NULL) { @@ -13103,8 +13506,8 @@ s32 func_808490B4(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_800) { - if (PlayerAnimation_Update(play, &this->unk_284)) { - PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_link_normal_carryB_wait); + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait); } if ((heldActor->id == ACTOR_EN_NIW) && (this->actor.velocity.y <= 0.0f)) { @@ -13114,16 +13517,16 @@ s32 func_808490B4(Player* this, PlayState* play) { } return true; } - return func_80848780(this, play); + return Player_UpperAction_0(this, play); } -s32 func_808491B4(Player* this, PlayState* play) { +s32 Player_UpperAction_11(Player* this, PlayState* play) { if (func_80830B88(play, this)) { return true; } if (this->stateFlags1 & PLAYER_STATE1_2000000) { - func_8082F43C(play, this, func_80849570); + Player_SetUpperAction(play, this, Player_UpperAction_15); } else if (func_80831094(this, play)) { return true; } @@ -13131,32 +13534,32 @@ s32 func_808491B4(Player* this, PlayState* play) { return false; } -s32 func_8084923C(Player* this, PlayState* play) { - if (PlayerAnimation_Update(play, &this->unk_284)) { - func_8082F43C(play, this, func_808492C4); - PlayerAnimation_PlayLoop(play, &this->unk_284, &gPlayerAnim_pz_cutterwaitanim); +s32 Player_UpperAction_12(Player* this, PlayState* play) { + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetUpperAction(play, this, Player_UpperAction_13); + PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cutterwaitanim); } - if (this->unk_284.animation == &gPlayerAnim_pz_cutterwaitanim) { + if (this->skelAnimeUpper.animation == &gPlayerAnim_pz_cutterwaitanim) { func_80831010(this, play); } return true; } -s32 func_808492C4(Player* this, PlayState* play) { - PlayerAnimation_Update(play, &this->unk_284); +s32 Player_UpperAction_13(Player* this, PlayState* play) { + PlayerAnimation_Update(play, &this->skelAnimeUpper); func_80831010(this, play); - if (D_80862B4C == 0) { - func_8082F43C(play, this, func_8084933C); - PlayerAnimation_PlayOnce(play, &this->unk_284, &gPlayerAnim_pz_cutterattack); + if (!sPlayerHeldItemButtonIsHeldDown) { + Player_SetUpperAction(play, this, Player_UpperAction_14); + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cutterattack); } return true; } -s32 func_8084933C(Player* this, PlayState* play) { - if (PlayerAnimation_Update(play, &this->unk_284)) { - func_8082F43C(play, this, func_80849570); +s32 Player_UpperAction_14(Player* this, PlayState* play) { + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + Player_SetUpperAction(play, this, Player_UpperAction_15); this->unk_ACC = 0; - } else if (PlayerAnimation_OnFrame(&this->unk_284, 6.0f)) { + } else if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 6.0f)) { Vec3f pos; s16 untargetedRotY; @@ -13166,13 +13569,13 @@ s32 func_8084933C(Player* this, PlayState* play) { untargetedRotY = this->actor.shape.rot.y - 0x190; this->boomerangActor = Actor_Spawn( &play->actorCtx, play, ACTOR_EN_BOOM, pos.x, pos.y, pos.z, this->actor.focus.rot.x, - (this->targetedActor != NULL) ? this->actor.shape.rot.y + 0x36B0 : untargetedRotY, 0, ZORA_BOOMERANG_LEFT); + (this->lockOnActor != NULL) ? this->actor.shape.rot.y + 0x36B0 : untargetedRotY, 0, ZORA_BOOMERANG_LEFT); if (this->boomerangActor != NULL) { EnBoom* leftBoomerang = (EnBoom*)this->boomerangActor; EnBoom* rightBoomerang; - leftBoomerang->moveTo = this->targetedActor; + leftBoomerang->moveTo = this->lockOnActor; if (leftBoomerang->moveTo != NULL) { leftBoomerang->unk_1CF = 0x10; } @@ -13183,11 +13586,11 @@ s32 func_8084933C(Player* this, PlayState* play) { untargetedRotY = (this->actor.shape.rot.y + 0x190); rightBoomerang = (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, pos.x, pos.y, pos.z, this->actor.focus.rot.x, - (this->targetedActor != NULL) ? this->actor.shape.rot.y - 0x36B0 : untargetedRotY, - 0, ZORA_BOOMERANG_RIGHT); + (this->lockOnActor != NULL) ? this->actor.shape.rot.y - 0x36B0 : untargetedRotY, 0, + ZORA_BOOMERANG_RIGHT); if (rightBoomerang != NULL) { - rightBoomerang->moveTo = this->targetedActor; + rightBoomerang->moveTo = this->lockOnActor; if (rightBoomerang->moveTo != NULL) { rightBoomerang->unk_1CF = 0x10; } @@ -13213,14 +13616,14 @@ s32 func_8084933C(Player* this, PlayState* play) { return true; } -s32 func_80849570(Player* this, PlayState* play) { +s32 Player_UpperAction_15(Player* this, PlayState* play) { if (func_80830B88(play, this)) { return true; } if (this->stateFlags3 & PLAYER_STATE3_800000) { - func_8082F43C(play, this, func_80849620); - PlayerAnimation_PlayOnce(play, &this->unk_284, &gPlayerAnim_pz_cuttercatch); + Player_SetUpperAction(play, this, Player_UpperAction_16); + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, &gPlayerAnim_pz_cuttercatch); this->stateFlags3 &= ~PLAYER_STATE3_800000; Player_PlaySfx(this, NA_SE_PL_CATCH_BOOMERANG); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_SWORD_N); @@ -13230,47 +13633,47 @@ s32 func_80849570(Player* this, PlayState* play) { return false; } -s32 func_80849620(Player* this, PlayState* play) { - if (!func_808491B4(this, play) && PlayerAnimation_Update(play, &this->unk_284)) { +s32 Player_UpperAction_16(Player* this, PlayState* play) { + if (!Player_UpperAction_11(this, play) && PlayerAnimation_Update(play, &this->skelAnimeUpper)) { if (this->stateFlags1 & PLAYER_STATE1_2000000) { - func_8082F43C(play, this, func_80849570); + Player_SetUpperAction(play, this, Player_UpperAction_15); this->unk_ACC = 0; } else { - func_8082F43C(play, this, func_80848780); + Player_SetUpperAction(play, this, Player_UpperAction_0); } } return true; } -void func_808496AC(Player* this, PlayState* play) { +void Player_Action_0(Player* this, PlayState* play) { PlayerAnimation_Update(play, &this->skelAnime); func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_ITEM_BOTTLE]); - if (DECR(this->unk_AE8) == 0) { + if (DECR(this->actionVar2) == 0) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Player_StopCutscene(this); - Player_SetAction(play, this, func_80849FE0, 0); + Player_SetAction(play, this, Player_Action_4, 0); this->stateFlags1 &= ~PLAYER_STATE1_20000000; } - } else if (this->unk_AE8 == 30) { + } else if (this->actionVar2 == 30) { if (Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { - this->unk_AE8++; + this->actionVar2++; } else { Message_StartTextbox(play, 0xC03, NULL); } } } -void func_808497A0(Player* this, PlayState* play) { +void Player_Action_1(Player* this, PlayState* play) { this->stateFlags3 |= PLAYER_STATE3_10000000; PlayerAnimation_Update(play, &this->skelAnime); - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); if (R_PLAY_FILL_SCREEN_ON == 0) { R_PLAY_FILL_SCREEN_ON = 20; R_PLAY_FILL_SCREEN_ALPHA = 0; R_PLAY_FILL_SCREEN_R = R_PLAY_FILL_SCREEN_G = R_PLAY_FILL_SCREEN_B = R_PLAY_FILL_SCREEN_ALPHA; - play_sound(NA_SE_SY_DEKUNUTS_JUMP_FAILED); + Audio_PlaySfx(NA_SE_SY_DEKUNUTS_JUMP_FAILED); } else if (R_PLAY_FILL_SCREEN_ON > 0) { R_PLAY_FILL_SCREEN_ALPHA += R_PLAY_FILL_SCREEN_ON; if (R_PLAY_FILL_SCREEN_ALPHA > 255) { @@ -13300,7 +13703,7 @@ void func_808497A0(Player* this, PlayState* play) { Player_AnimationPlayOnce(play, this, func_8082ED20(this)); if ((play->roomCtx.curRoom.num == this->unk_3CE) && (play->roomCtx.prevRoom.num < 0)) { - this->unk_AE8 = 5; + this->actionVar2 = 5; } else { play->roomCtx.curRoom.num = -1; play->roomCtx.prevRoom.num = -1; @@ -13308,19 +13711,19 @@ void func_808497A0(Player* this, PlayState* play) { play->roomCtx.prevRoom.segment = NULL; func_8012EBF8(play, &play->roomCtx); - this->unk_AE8 = -1; - this->unk_AE7 = this->unk_3CE; + this->actionVar2 = -1; + this->actionVar1 = this->unk_3CE; } } } - } else if (this->unk_AE8 < 0) { - if (Room_StartRoomTransition(play, &play->roomCtx, this->unk_AE7)) { + } else if (this->actionVar2 < 0) { + if (Room_StartRoomTransition(play, &play->roomCtx, this->actionVar1)) { Map_InitRoomData(play, play->roomCtx.curRoom.num); Minimap_SavePlayerRoomInitInfo(play); - this->unk_AE8 = 5; + this->actionVar2 = 5; } - } else if (this->unk_AE8 > 0) { - this->unk_AE8--; + } else if (this->actionVar2 > 0) { + this->actionVar2--; } else { R_PLAY_FILL_SCREEN_ALPHA += R_PLAY_FILL_SCREEN_ON; if (R_PLAY_FILL_SCREEN_ALPHA < 0) { @@ -13333,16 +13736,16 @@ void func_808497A0(Player* this, PlayState* play) { } } -void func_80849A9C(Player* this, PlayState* play) { - f32 sp44; - s16 sp42; +void Player_Action_2(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp_v0; - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8082E794(this); Player_AnimationPlayLoop(play, this, func_8082EF54(this)); - this->unk_AE8 = 0; + this->actionVar2 = 0; this->stateFlags3 &= ~PLAYER_STATE3_8; } func_8082FC60(this); @@ -13351,52 +13754,52 @@ void func_80849A9C(Player* this, PlayState* play) { } func_80832F24(this); - if (func_80833058(play, this, D_8085CFE4, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList1, true)) { return; } - if (!func_8082FB68(this) && (!func_80123434(this) || (func_8084894C != this->unk_AC4))) { + if (!func_8082FB68(this) && (!func_80123434(this) || (Player_UpperAction_3 != this->upperActionFunc))) { func_8083B29C(this, play); return; } - func_80832F78(this, &sp44, &sp42, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp_v0 = func_8083E404(this, sp44, sp42); + temp_v0 = func_8083E404(this, speedTarget, yawTarget); if (temp_v0 > 0) { - func_8083A844(this, play, sp42); + func_8083A844(this, play, yawTarget); } else if (temp_v0 < 0) { - func_8083AF8C(this, sp42, play); - } else if (sp44 > 4.0f) { + func_8083AF8C(this, yawTarget, play); + } else if (speedTarget > 4.0f) { func_8083B030(this, play); } else { u32 temp_v0_2; func_8083EA44(this, this->linearVelocity * 0.3f + 1.0f); - func_8083E8E0(this, sp44, sp42); + func_8083E8E0(this, speedTarget, yawTarget); temp_v0_2 = this->unk_B38; if ((temp_v0_2 < 6) || ((temp_v0_2 - 0xE) < 6)) { Math_StepToF(&this->linearVelocity, 0.0f, 1.5f); } else { - s16 temp_v0_3 = sp42 - this->currentYaw; + s16 temp_v0_3 = yawTarget - this->currentYaw; s32 var_v1 = ABS_ALT(temp_v0_3); if (var_v1 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + this->currentYaw = yawTarget; } } else { - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, sp42, var_v1 * 0.1f); + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.3f, 2.0f, 1.5f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, var_v1 * 0.1f); } } } } -void func_80849DD0(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; +void Player_Action_3(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp_v0; if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -13406,7 +13809,7 @@ void func_80849DD0(Player* this, PlayState* play) { } func_80832F24(this); - if (func_80833058(play, this, D_8085CFEC, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList2, true)) { return; } @@ -13415,41 +13818,41 @@ void func_80849DD0(Player* this, PlayState* play) { return; } if (!func_80123434(this)) { - func_8083172C(play, this, func_80849FE0, 1); + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_4, 1); this->currentYaw = this->actor.shape.rot.y; return; } - if (func_8084894C == this->unk_AC4) { + if (Player_UpperAction_3 == this->upperActionFunc) { func_8083B23C(this, play); return; } - func_80832F78(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp_v0 = func_8083E514(this, &sp3C, &sp3A, play); + temp_v0 = func_8083E514(this, &speedTarget, &yawTarget, play); if (temp_v0 > 0) { - func_8083A844(this, play, sp3A); + func_8083A844(this, play, yawTarget); } else if (temp_v0 < 0) { - func_8083AECC(this, sp3A, play); - } else if (sp3C > 4.9f) { + func_8083AECC(this, yawTarget, play); + } else if (speedTarget > 4.9f) { func_8083B030(this, play); func_8082FC60(this); - } else if (sp3C != 0.0f) { + } else if (speedTarget != 0.0f) { func_8083AF30(this, play); } else { - s16 temp_v0_2 = sp3A - this->actor.shape.rot.y; + s16 temp_v0_2 = yawTarget - this->actor.shape.rot.y; if (ABS_ALT(temp_v0_2) > 0x320) { - func_8083B0E4(play, this, sp3A); + func_8083B0E4(play, this, yawTarget); } } } -void func_80849FE0(Player* this, PlayState* play) { +void Player_Action_4(Player* this, PlayState* play) { s32 temp_v0 = func_8082ED94(this); s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime); - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; s16 temp_v1_2; func_8083C85C(this); @@ -13460,13 +13863,13 @@ void func_80849FE0(Player* this, PlayState* play) { if (animFinished || ((this->currentMask == PLAYER_MASK_SCENTS) && (this->skelAnime.animation != &gPlayerAnim_cl_msbowait)) || ((this->currentMask != PLAYER_MASK_SCENTS) && (this->skelAnime.animation == &gPlayerAnim_cl_msbowait))) { - if (this->unk_AE8 != 0) { - if (DECR(this->unk_AE8) == 0) { + if (this->actionVar2 != 0) { + if (DECR(this->actionVar2) == 0) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].y = - (this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].y + ((this->unk_AE8 & 1) * 0x50)) - 0x28; + (this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].y + ((this->actionVar2 & 1) * 0x50)) - 0x28; } else { func_8082E794(this); Player_ChooseIdleAnim(play, this); @@ -13475,7 +13878,8 @@ void func_80849FE0(Player* this, PlayState* play) { } func_80832F24(this); - if ((this->unk_AE8 == 0) && !func_80847880(play, this) && !func_80833058(play, this, D_8085D01C, 1)) { + if ((this->actionVar2 == 0) && !func_80847880(play, this) && + !Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true)) { if (func_8082FB68(this)) { func_8083B23C(this, play); return; @@ -13484,17 +13888,19 @@ void func_80849FE0(Player* this, PlayState* play) { func_8083692C(this, play); return; } - func_80832F78(this, &sp3C, &sp3A, 0.018f, play); - if (sp3C != 0.0f) { - func_8083A844(this, play, sp3A); + + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + + if (speedTarget != 0.0f) { + func_8083A844(this, play, yawTarget); return; } - temp_v1_2 = sp3A - this->actor.shape.rot.y; + temp_v1_2 = yawTarget - this->actor.shape.rot.y; if (ABS_ALT(temp_v1_2) > 0x320) { - func_8083B0E4(play, this, sp3A); + func_8083B0E4(play, this, yawTarget); } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 0x4B0); + Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 0x4B0); this->currentYaw = this->actor.shape.rot.y; if (func_8082ED20(this) == this->skelAnime.animation) { func_8083C6E8(this, play); @@ -13503,11 +13909,11 @@ void func_80849FE0(Player* this, PlayState* play) { } } -void func_8084A26C(Player* this, PlayState* play) { +void Player_Action_5(Player* this, PlayState* play) { f32 var_fv0; s16 temp_v0_3; - f32 sp44; - s16 sp42; + f32 speedTarget; + s16 yawTarget; s32 var_v0; s32 temp_v0_2; s32 var_v1; @@ -13540,7 +13946,7 @@ void func_8084A26C(Player* this, PlayState* play) { Player_AnimSfx_PlayFloorWalk(this, this->linearVelocity); } - if (func_80833058(play, this, D_8085CFF8, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList3, true)) { return; } @@ -13552,46 +13958,47 @@ void func_8084A26C(Player* this, PlayState* play) { func_8085B384(this, play); return; } - func_80832F78(this, &sp44, &sp42, 0.0f, play); - temp_v0_2 = func_8083E514(this, &sp44, &sp42, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + + temp_v0_2 = func_8083E514(this, &speedTarget, &yawTarget, play); if (temp_v0_2 > 0) { - func_8083A844(this, play, sp42); + func_8083A844(this, play, yawTarget); return; } if (temp_v0_2 < 0) { - func_8083AECC(this, sp42, play); + func_8083AECC(this, yawTarget, play); return; } - if (sp44 > 4.9f) { + if (speedTarget > 4.9f) { func_8083B030(this, play); func_8082FC60(this); return; } - if ((sp44 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f)) { func_8083692C(this, play); return; } - temp_v0_3 = sp42 - this->currentYaw; + temp_v0_3 = yawTarget - this->currentYaw; var_v1 = ABS_ALT(temp_v0_3); if (var_v1 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + this->currentYaw = yawTarget; } } else { - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, sp42, var_v1 * 0.1f); + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.4f, 1.5f, 1.5f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, var_v1 * 0.1f); } } -void func_8084A5C0(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_6(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 sp2C; func_8083EE60(this, play); - if (func_80833058(play, this, D_8085D004, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) { return; } @@ -13600,58 +14007,59 @@ void func_8084A5C0(Player* this, PlayState* play) { return; } - func_80832F78(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - sp2C = func_8083E514(this, &sp34, &sp32, play); + sp2C = func_8083E514(this, &speedTarget, &yawTarget, play); if (sp2C >= 0) { - if (!func_8083F190(this, &sp34, &sp32, play)) { + if (!func_8083F190(this, &speedTarget, &yawTarget, play)) { if (sp2C != 0) { func_8083A794(this, play); - } else if (sp34 > 4.9f) { + } else if (speedTarget > 4.9f) { func_8083B030(this, play); } else { func_8083AF30(this, play); } } } else { - s16 sp2A = sp32 - this->currentYaw; + s16 sp2A = yawTarget - this->currentYaw; - Math_AsymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f); - Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f); - if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) { + Math_AsymStepToF(&this->linearVelocity, speedTarget * 1.5f, 1.5f, 2.0f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, sp2A * 0.1f); + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f)) { func_8083692C(this, play); } } } -void func_8084A794(Player* this, PlayState* play) { +void Player_Action_7(Player* this, PlayState* play) { s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime); - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; func_80832F24(this); - if (func_80833058(play, this, D_8085D004, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) { return; } - func_80832F78(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + if (this->linearVelocity != 0.0f) { return; } this->currentYaw = this->actor.shape.rot.y; - if (func_8083E514(this, &sp30, &sp2E, play) > 0) { + if (func_8083E514(this, &speedTarget, &yawTarget, play) > 0) { func_8083A794(this, play); - } else if ((sp30 != 0.0f) || animFinished) { + } else if ((speedTarget != 0.0f) || animFinished) { func_8083F230(this, play); } } -void func_8084A884(Player* this, PlayState* play) { +void Player_Action_8(Player* this, PlayState* play) { s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime); - if (func_80833058(play, this, D_8085D004, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList4, true)) { return; } @@ -13660,13 +14068,13 @@ void func_8084A884(Player* this, PlayState* play) { } } -void func_8084A8E8(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; +void Player_Action_9(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 var_v0; func_8083F27C(play, this); - if (func_80833058(play, this, D_8085D00C, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList5, true)) { return; } @@ -13675,23 +14083,24 @@ void func_8084A8E8(Player* this, PlayState* play) { return; } - func_80832F78(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + if (func_80123434(this)) { - var_v0 = func_8083E514(this, &sp3C, &sp3A, play); + var_v0 = func_8083E514(this, &speedTarget, &yawTarget, play); } else { - var_v0 = func_8083E404(this, sp3C, sp3A); + var_v0 = func_8083E404(this, speedTarget, yawTarget); } if (var_v0 > 0) { func_8083A794(this, play); } else if (var_v0 < 0) { if (func_80123434(this)) { - func_8083AECC(this, sp3A, play); + func_8083AECC(this, yawTarget, play); } else { - func_8083AF8C(this, sp3A, play); + func_8083AF8C(this, yawTarget, play); } - } else if ((this->linearVelocity < 3.6f) && (sp3C < 4.0f)) { - if ((func_80123420(this) == 0) && (func_80123434(this))) { + } else if ((this->linearVelocity < 3.6f) && (speedTarget < 4.0f)) { + if (!func_80123420(this) && func_80123434(this)) { func_8083AF30(this, play); } else { func_80836988(this, play); @@ -13701,53 +14110,54 @@ void func_8084A8E8(Player* this, PlayState* play) { s32 var_v1; s32 pad; - func_8083E8E0(this, sp3C, sp3A); + func_8083E8E0(this, speedTarget, yawTarget); - temp_v0 = sp3A - this->currentYaw; + temp_v0 = yawTarget - this->currentYaw; var_v1 = ABS_ALT(temp_v0); if (var_v1 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 3.0f)) { - this->currentYaw = sp3A; + this->currentYaw = yawTarget; } } else { - sp3C = sp3C * 0.9f; - Math_AsymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f); - Math_ScaledStepToS(&this->currentYaw, sp3A, var_v1 * 0.1f); + speedTarget *= 0.9f; + Math_AsymStepToF(&this->linearVelocity, speedTarget, 2.0f, 3.0f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, var_v1 * 0.1f); } } } -void func_8084AB4C(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_10(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; PlayerAnimation_Update(play, &this->skelAnime); if (Player_IsHoldingTwoHandedWeapon(this)) { AnimationContext_SetLoadFrame(play, func_8082ED20(this), 0, this->skelAnime.limbCount, this->skelAnime.morphTable); AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->skelAnime.morphTable, D_8085B9F0); + this->skelAnime.morphTable, sPlayerUpperBodyLimbCopyMap); } - func_80832F78(this, &sp34, &sp32, 0.018f, play); - if ((this != GET_PLAYER(play)) && (this->targetedActor == NULL)) { - sp32 = this->actor.home.rot.y; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + + if ((this != GET_PLAYER(play)) && (this->lockOnActor == NULL)) { + yawTarget = this->actor.home.rot.y; } - if (func_80833058(play, this, D_8085D018, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList6, true)) { return; } - if (sp34 != 0.0f) { - this->actor.shape.rot.y = sp32; + if (speedTarget != 0.0f) { + this->actor.shape.rot.y = yawTarget; func_8083A794(this, play); - } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, sp32, this->unk_B4E)) { + } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, this->unk_B4E)) { func_80839E74(this, play); } this->currentYaw = this->actor.shape.rot.y; } -void func_8084AC84(Player* this, PlayState* play) { +void Player_Action_11(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; if (this->linearVelocity < 1.0f) { @@ -13757,12 +14167,12 @@ void func_8084AC84(Player* this, PlayState* play) { } PlayerAnimation_Update(play, &this->skelAnime); - if (!func_80847880(play, this) && - (!func_80833058(play, this, D_8085D01C, 1) || (func_8084AC84 == this->actionFunc))) { - f32 sp3C; + if (!func_80847880(play, this) && (!Player_TryActionChangeList(play, this, sPlayerActionChangeList7, true) || + (Player_Action_11 == this->actionFunc))) { + f32 speedTarget; f32 temp_fv0; f32 temp_fv1; - s16 sp32; + s16 yawTarget; s16 sp30; if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) { @@ -13771,13 +14181,13 @@ void func_8084AC84(Player* this, PlayState* play) { } this->linearVelocity = this->unk_B48; - func_80832F78(this, &sp3C, &sp32, 0.018f, play); - sp30 = sp32; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + sp30 = yawTarget; - if (!func_8083A4A4(this, &sp3C, &sp32, REG(43) / 100.0f)) { - func_8083CB04(this, sp3C, sp32, REG(19) / 100.0f, 1.5f, 0x3E8); + if (!func_8083A4A4(this, &speedTarget, &yawTarget, REG(43) / 100.0f)) { + func_8083CB04(this, speedTarget, yawTarget, REG(19) / 100.0f, 1.5f, 0x3E8); func_8083C8E8(this, play); - if ((this->linearVelocity == 0.0f) && (sp3C == 0.0f)) { + if ((this->linearVelocity == 0.0f) && (speedTarget == 0.0f)) { this->currentYaw = sp30; this->actor.shape.rot.y = this->currentYaw; } @@ -13793,12 +14203,13 @@ void func_8084AC84(Player* this, PlayState* play) { } } -void func_8084AEEC(Player* this, PlayState* play) { +void Player_Action_12(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; PlayerAnimation_Update(play, &this->skelAnime); func_80832F24(this); if (!func_80847880(play, this)) { - if (!func_80833058(play, this, D_8085D01C, 0) || (func_8084AEEC == this->actionFunc)) { + if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList7, false) || + (Player_Action_12 == this->actionFunc)) { if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) { func_80839E74(this, play); } @@ -13806,13 +14217,13 @@ void func_8084AEEC(Player* this, PlayState* play) { } } -void func_8084AF9C(Player* this, PlayState* play) { - f32 sp2C; // player speed? - s16 sp2A; +void Player_Action_13(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_20; func_8083F57C(this, play); - if (func_80833058(play, this, D_8085D028, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList8, true)) { return; } @@ -13821,28 +14232,29 @@ void func_8084AF9C(Player* this, PlayState* play) { return; } - func_80832F78(this, &sp2C, &sp2A, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + if (this->currentMask == PLAYER_MASK_BUNNY) { - sp2C *= 1.5f; + speedTarget *= 1.5f; } - if (!func_8083A4A4(this, &sp2C, &sp2A, REG(43) / 100.0f)) { - func_8083CB58(this, sp2C, sp2A); + if (!func_8083A4A4(this, &speedTarget, &yawTarget, REG(43) / 100.0f)) { + func_8083CB58(this, speedTarget, yawTarget); func_8083C8E8(this, play); - if ((this->linearVelocity == 0.0f) && (sp2C == 0.0f)) { + if ((this->linearVelocity == 0.0f) && (speedTarget == 0.0f)) { func_80839E3C(this, play); } } } -void func_8084B0EC(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; +void Player_Action_14(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_20; func_8083F57C(this, play); - if (func_80833058(play, this, D_8085D034, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList9, true)) { return; } @@ -13851,27 +14263,28 @@ void func_8084B0EC(Player* this, PlayState* play) { return; } - func_80832F78(this, &sp2C, &sp2A, 0.0f, play); - if (!func_8083A4A4(this, &sp2C, &sp2A, REG(43) / 100.0f)) { - if (((func_80123434(this) != 0) && (sp2C != 0) && (func_8083E514(this, &sp2C, &sp2A, play) <= 0)) || - (!func_80123434(this) && (func_8083E404(this, sp2C, sp2A) <= 0))) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + + if (!func_8083A4A4(this, &speedTarget, &yawTarget, REG(43) / 100.0f)) { + if ((func_80123434(this) && (speedTarget != 0) && (func_8083E514(this, &speedTarget, &yawTarget, play) <= 0)) || + (!func_80123434(this) && (func_8083E404(this, speedTarget, yawTarget) <= 0))) { func_80836988(this, play); } else { - func_8083CB58(this, sp2C, sp2A); + func_8083CB58(this, speedTarget, yawTarget); func_8083C8E8(this, play); - if ((this->linearVelocity == 0.0f) && (sp2C == 0.0f)) { + if ((this->linearVelocity == 0.0f) && (speedTarget == 0.0f)) { func_80836988(this, play); } } } } -void func_8084B288(Player* this, PlayState* play) { +void Player_Action_15(Player* this, PlayState* play) { s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime); - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; - if (func_80833058(play, this, D_8085D00C, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList5, true)) { return; } @@ -13880,39 +14293,41 @@ void func_8084B288(Player* this, PlayState* play) { return; } - func_80832F78(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { func_80832F24(this); - if ((this->skelAnime.curFrame > 10.0f) && (func_8083E404(this, sp30, sp2E) < 0)) { - func_8083AF8C(this, sp2E, play); + if ((this->skelAnime.curFrame > 10.0f) && (func_8083E404(this, speedTarget, yawTarget) < 0)) { + func_8083AF8C(this, yawTarget, play); } else if (animFinished) { func_8083B090(this, play); } } } -void func_8084B3B8(Player* this, PlayState* play) { +void Player_Action_16(Player* this, PlayState* play) { s32 animFinished = PlayerAnimation_Update(play, &this->skelAnime); - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; func_80832F24(this); - if (func_80833058(play, this, D_8085D044, 1)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList10, true)) { return; } - func_80832F78(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + if (this->linearVelocity == 0.0f) { this->currentYaw = this->actor.shape.rot.y; - if (func_8083E404(this, sp30, sp2E) > 0) { + if (func_8083E404(this, speedTarget, yawTarget) > 0) { func_8083A794(this, play); - } else if ((sp30 != 0.0f) || animFinished) { + } else if ((speedTarget != 0.0f) || animFinished) { func_80836988(this, play); } } } -void func_8084B4A8(Player* this, PlayState* play) { +void Player_Action_17(Player* this, PlayState* play) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8082E794(this); @@ -13922,8 +14337,8 @@ void func_8084B4A8(Player* this, PlayState* play) { func_8082E67C(play, this, D_8085BE84[PLAYER_ANIMGROUP_32][this->modelAnimType]); } - if (DECR(this->unk_AE8) == 0) { - if (!func_80838A90(this, play)) { + if (DECR(this->actionVar2) == 0) { + if (!Player_ActionChange_13(this, play)) { func_80836A98(this, D_8085BE84[PLAYER_ANIMGROUP_33][this->modelAnimType], play); } this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; @@ -13932,14 +14347,14 @@ void func_8084B4A8(Player* this, PlayState* play) { } // Player_Action_Shielding -void func_8084B5C0(Player* this, PlayState* play) { +void Player_Action_18(Player* this, PlayState* play) { func_80832F24(this); if (this->transformation == PLAYER_FORM_GORON) { SkelAnime_Update(&this->unk_2C8); if (!func_8083FE38(this, play)) { - if (!func_8083A274(this, play)) { + if (!Player_ActionChange_11(this, play)) { this->stateFlags1 &= ~PLAYER_STATE1_400000; if (this->itemAction <= PLAYER_IA_MINUS1) { @@ -13961,23 +14376,23 @@ void func_8084B5C0(Player* this, PlayState* play) { Player_AnimationPlayLoop(play, this, D_8085BE84[PLAYER_ANIMGROUP_20][this->modelAnimType]); } - this->unk_AE8 = 1; - this->unk_AE7 = 0; + this->actionVar2 = 1; + this->actionVar1 = 0; } if (!Player_IsGoronOrDeku(this)) { this->stateFlags1 |= PLAYER_STATE1_400000; - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); this->stateFlags1 &= ~PLAYER_STATE1_400000; if (this->transformation == PLAYER_FORM_ZORA) { func_8082F164(this, BTN_R | BTN_B); } } - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { f32 yStick = sPlayerControlInput->rel.stick_y * 180; f32 xStick = sPlayerControlInput->rel.stick_x * -120; - s16 temp_a0 = this->actor.shape.rot.y - Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]); + s16 temp_a0 = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); s16 var_a1; s16 temp_ft5; s16 var_a2; @@ -13997,17 +14412,17 @@ void func_8084B5C0(Player* this, PlayState* play) { this->upperLimbRot.x = this->actor.focus.rot.x; Math_ScaledStepToS(&this->upperLimbRot.y, temp_ft5, var_a3); - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { if (!func_808401F4(play, this)) { if (this->skelAnime.curFrame < 2.0f) { func_8082FA5C(play, this, PLAYER_MELEE_WEAPON_STATE_1); } } else { - this->unk_AE8 = 1; - this->unk_AE7 = 0; + this->actionVar2 = 1; + this->actionVar1 = 0; } } else if (!func_8083FE38(this, play)) { - if (func_8083A274(this, play) != 0) { + if (Player_ActionChange_11(this, play)) { func_8083FD80(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_400000; @@ -14038,12 +14453,13 @@ void func_8084B5C0(Player* this, PlayState* play) { this->unk_AA6 |= 0xC1; } -void func_8084BAA4(Player* this, PlayState* play) { +void Player_Action_19(Player* this, PlayState* play) { func_80832F24(this); - if (this->unk_AE7 == 0) { - D_80862B04 = func_8083216C(this, play); - if ((func_8084894C == this->unk_AC4) || (func_808331FC(play, this, &this->unk_284, 4.0f) > 0)) { - Player_SetAction(play, this, func_80849A9C, 1); + if (this->actionVar1 == 0) { + D_80862B04 = Player_UpdateUpperBody(this, play); + if ((Player_UpperAction_3 == this->upperActionFunc) || + (func_808331FC(play, this, &this->skelAnimeUpper, 4.0f) > 0)) { + Player_SetAction(play, this, Player_Action_2, 1); } } else { s32 temp_v0; @@ -14052,18 +14468,18 @@ void func_8084BAA4(Player* this, PlayState* play) { temp_v0 = func_808331FC(play, this, &this->skelAnime, 4.0f); if ((temp_v0 != 0) && ((temp_v0 > 0) || PlayerAnimation_Update(play, &this->skelAnime))) { PlayerAnimationHeader* anim; - f32 lastFrame; + f32 endFrame; - Player_SetAction(play, this, func_8084B5C0, 1); + Player_SetAction(play, this, Player_Action_18, 1); Player_SetModelsForHoldingShield(this); anim = D_8085BE84[PLAYER_ANIMGROUP_19][this->modelAnimType]; - lastFrame = Animation_GetLastFrame(anim); - PlayerAnimation_Change(play, &this->skelAnime, anim, 1.0f, lastFrame, lastFrame, ANIMMODE_ONCE, 0.0f); + endFrame = Animation_GetLastFrame(anim); + PlayerAnimation_Change(play, &this->skelAnime, anim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE, 0.0f); } } } -void func_8084BBF0(Player* this, PlayState* play) { +void Player_Action_20(Player* this, PlayState* play) { s32 temp_v0; func_80832F24(this); @@ -14075,11 +14491,11 @@ void func_8084BBF0(Player* this, PlayState* play) { } } -void func_8084BC64(Player* this, PlayState* play) { +void Player_Action_21(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20 | PLAYER_STATE2_40; func_808345A8(this); - if (!(this->stateFlags1 & PLAYER_STATE1_20000000) && (this->unk_AE8 == 0) && (this->unk_B75 != 0)) { + if (!(this->stateFlags1 & PLAYER_STATE1_20000000) && (this->actionVar2 == 0) && (this->unk_B75 != 0)) { s16 temp_v0 = this->unk_B76; s16 temp_v1 = this->actor.shape.rot.y - temp_v0; @@ -14098,17 +14514,17 @@ void func_8084BC64(Player* this, PlayState* play) { } if (PlayerAnimation_Update(play, &this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (this->unk_AE8 != 0) { - this->unk_AE8--; - if (this->unk_AE8 == 0) { + if (this->actionVar2 != 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { func_8085B384(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_20000000) || (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_B75 == 0))) { if (this->stateFlags1 & PLAYER_STATE1_20000000) { - this->unk_AE8++; + this->actionVar2++; } else { - Player_SetAction(play, this, func_8084BE40, 0); + Player_SetAction(play, this, Player_Action_22, 0); this->stateFlags1 |= PLAYER_STATE1_4000000; } @@ -14125,15 +14541,15 @@ void func_8084BC64(Player* this, PlayState* play) { } } -void func_8084BE40(Player* this, PlayState* play) { +void Player_Action_22(Player* this, PlayState* play) { this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40); func_808345A8(this); func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_20000000) { - this->unk_AE8++; + this->actionVar2++; } else { - Player_SetAction(play, this, func_8084BF28, 0); + Player_SetAction(play, this, Player_Action_23, 0); this->stateFlags1 |= PLAYER_STATE1_4000000; } @@ -14149,7 +14565,7 @@ AnimSfxEntry D_8085D604[] = { ANIMSFX(ANIMSFX_TYPE_8, 30, NA_SE_NONE, STOP), }; -void func_8084BF28(Player* this, PlayState* play) { +void Player_Action_23(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; func_808345A8(this); @@ -14175,11 +14591,10 @@ AnimSfxEntry D_8085D60C[] = { ANIMSFX(ANIMSFX_TYPE_8, 170, NA_SE_NONE, STOP), }; -void func_8084BFDC(Player* this, PlayState* play) { +void Player_Action_24(Player* this, PlayState* play) { if ((this->transformation != PLAYER_FORM_GORON) && (this->actor.depthInWater <= 0.0f)) { - if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_HOT) || - (sPlayerCurrentFloorType == FLOOR_TYPE_9) || - ((func_808340AC(sPlayerCurrentFloorType) >= 0) && + if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_HOT) || (sPlayerFloorType == FLOOR_TYPE_9) || + ((func_808340AC(sPlayerFloorType) >= 0) && !SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_808344C0(play, this); } @@ -14206,17 +14621,18 @@ s32 func_8084C124(PlayState* play, Player* this) { return false; } -void func_8084C16C(Player* this, PlayState* play) { - f32 sp44; - s16 sp42; +void Player_Action_25(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; Actor* heldActor; - if (func_80123420(this) != 0) { + if (func_80123420(this)) { this->actor.gravity = -1.2f; } if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832F78(this, &sp44, &sp42, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + if (this->stateFlags1 & PLAYER_STATE1_800) { heldActor = this->heldActor; if (!func_808313A8(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && @@ -14235,7 +14651,7 @@ void func_8084C16C(Player* this, PlayState* play) { s16 prevYaw = this->currentYaw; func_808378FC(play, this); - func_8083CBC4(this, sp44 * 0.5f, sp42, 2.0f, 0.2f, 0.1f, 0x190); + func_8083CBC4(this, speedTarget * 0.5f, yawTarget, 2.0f, 0.2f, 0.1f, 0x190); if (this->skelAnime.animation == &gPlayerAnim_pn_attack) { this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40); @@ -14245,26 +14661,27 @@ void func_8084C16C(Player* this, PlayState* play) { Math_StepToF(&this->unk_B10[1], 0.0f, this->unk_B10[0]); } } else { - func_8083CBC4(this, sp44, sp42, 1.0f, 0.05f, 0.1f, 0xC8); + func_8083CBC4(this, speedTarget, yawTarget, 1.0f, 0.05f, 0.1f, 0xC8); } - func_8083216C(this, play); - if ((((this->stateFlags2 & PLAYER_STATE2_80000) && ((this->unk_AE7 == 2) || (this->unk_AE7 >= 4))) || + Player_UpdateUpperBody(this, play); + if ((((this->stateFlags2 & PLAYER_STATE2_80000) && ((this->actionVar1 == 2) || (this->actionVar1 >= 4))) || !func_80839770(this, play)) && (this->actor.velocity.y < 0.0f)) { - if (this->unk_AE8 >= 0) { - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_AE8 == 0) || (this->fallDistance > 0)) { - if ((D_80862B18 > 800.0f) || (this->stateFlags3 & PLAYER_STATE3_10000)) { + if (this->actionVar2 >= 0) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actionVar2 == 0) || + (this->fallDistance > 0)) { + if ((sPlayerYDistToFloor > 800.0f) || (this->stateFlags3 & PLAYER_STATE3_10000)) { func_80840980(this, NA_SE_VO_LI_FALL_S); this->stateFlags3 &= ~PLAYER_STATE3_10000; } PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_normal_landing, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f); - this->unk_AE8 = -1; + this->actionVar2 = -1; } } else { - if ((this->unk_AE8 == -1) && (this->fallDistance > 120) && (D_80862B18 > 280.0f)) { - this->unk_AE8 = -2; + if ((this->actionVar2 == -1) && (this->fallDistance > 120) && (sPlayerYDistToFloor > 280.0f)) { + this->actionVar2 = -2; func_80840980(this, NA_SE_VO_LI_FALL_L); } @@ -14273,13 +14690,13 @@ void func_8084C16C(Player* this, PlayState* play) { (this->linearVelocity > 0.0f)) { if ((this->transformation != PLAYER_FORM_GORON) && ((this->transformation != PLAYER_FORM_DEKU) || (this->remainingHopsCounter != 0))) { - if ((this->wallHeight >= 150.0f) && (this->unk_AE3[this->unk_ADE] == 0)) { + if ((this->yDistToLedge >= 150.0f) && (this->unk_AE3[this->unk_ADE] == 0)) { if (func_8083D860(this, play)) { func_8084C124(play, this); } - } else if ((this->unk_B5C >= 2) && - ((this->wallHeight < (150.0f * this->ageProperties->unk_08)) && - (((this->actor.world.pos.y - this->actor.floorHeight) + this->wallHeight)) > + } else if ((this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && + ((this->yDistToLedge < (150.0f * this->ageProperties->unk_08)) && + (((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge)) > (70.0f * this->ageProperties->unk_08))) { AnimationContext_DisableQueue(play); if (this->stateFlags3 & PLAYER_STATE3_10000) { @@ -14288,8 +14705,8 @@ void func_8084C16C(Player* this, PlayState* play) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_HANG); } - this->actor.world.pos.y += this->wallHeight; - func_80837CEC(play, this, this->actor.wallPoly, this->wallDistance, + this->actor.world.pos.y += this->yDistToLedge; + func_80837CEC(play, this, this->actor.wallPoly, this->distToInteractWall, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_38, this->modelAnimType)); this->currentYaw += 0x8000; this->actor.shape.rot.y = this->currentYaw; @@ -14303,10 +14720,10 @@ void func_8084C16C(Player* this, PlayState* play) { } } else { func_80837134(play, this); - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } - func_80838A90(this, play); + Player_ActionChange_13(this, play); } // sPlayerRollingAnimSfx @@ -14318,7 +14735,7 @@ AnimSfxEntry D_8085D61C[] = { }; // Player_Action_Rolling // Handles bonking too? -void func_8084C6EC(Player* this, PlayState* play) { +void Player_Action_26(Player* this, PlayState* play) { s32 animFinished; this->stateFlags2 |= PLAYER_STATE2_20; @@ -14341,7 +14758,7 @@ void func_8084C6EC(Player* this, PlayState* play) { return; } - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { s32 temp_v0; Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); @@ -14352,26 +14769,27 @@ void func_8084C6EC(Player* this, PlayState* play) { } } } else if (!func_80840A30(play, this, &this->linearVelocity, 6.0f)) { - if ((this->skelAnime.curFrame < 15.0f) || !func_80848570(this, play)) { - f32 sp3C; - s16 yaw; + if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) { + f32 speedTarget; + s16 yawTarget; if (this->skelAnime.curFrame >= 20.0f) { func_80836A5C(this, play); return; } - func_80832F78(this, &sp3C, &yaw, 0.018f, play); - sp3C *= 1.5f; - if ((sp3C < 3.0f) || (this->unk_AE3[this->unk_ADE] != 0)) { - sp3C = 3.0f; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + speedTarget *= 1.5f; + + if ((speedTarget < 3.0f) || (this->unk_AE3[this->unk_ADE] != 0)) { + speedTarget = 3.0f; } - func_8083CB58(this, sp3C, this->actor.shape.rot.y); + func_8083CB58(this, speedTarget, this->actor.shape.rot.y); if (func_8083FBC4(play, this)) { - func_800B8F98(&this->actor, (this->floorSfxOffset == NA_SE_PL_WALK_SNOW - SFX_FLAG) - ? NA_SE_PL_ROLL_SNOW_DUST - SFX_FLAG - : NA_SE_PL_ROLL_DUST - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&this->actor, (this->floorSfxOffset == NA_SE_PL_WALK_SNOW - SFX_FLAG) + ? NA_SE_PL_ROLL_SNOW_DUST - SFX_FLAG + : NA_SE_PL_ROLL_DUST - SFX_FLAG); } Player_PlayAnimSfx(this, D_8085D61C); @@ -14379,7 +14797,7 @@ void func_8084C6EC(Player* this, PlayState* play) { } } -void func_8084C94C(Player* this, PlayState* play) { +void Player_Action_27(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -14397,7 +14815,7 @@ void func_8084C94C(Player* this, PlayState* play) { } } -void func_8084CA24(Player* this, PlayState* play) { +void Player_Action_28(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -14421,10 +14839,10 @@ void func_8084CA24(Player* this, PlayState* play) { } } -void func_8084CB58(Player* this, PlayState* play) { +void Player_Action_29(Player* this, PlayState* play) { AttackAnimInfo* attackInfoEntry = &sMeleeAttackAnimInfo[this->meleeWeaponAnimation]; - f32 sp38; - s16 sp36; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_20; @@ -14439,8 +14857,8 @@ void func_8084CB58(Player* this, PlayState* play) { if (!func_808401F4(play, this)) { func_8083FCF0(play, this, 6.0f, attackInfoEntry->unk_C, attackInfoEntry->unk_D); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832F78(this, &sp38, &sp36, 0.0f, play); - func_8083CBC4(this, sp38, this->currentYaw, 1.0f, 0.05f, 0.1f, 200); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + func_8083CBC4(this, speedTarget, this->currentYaw, 1.0f, 0.05f, 0.1f, 200); } else if (func_80836F10(play, this) >= 0) { // Player didn't die because of this fall this->meleeWeaponAnimation += 3; func_80833864(play, this, this->meleeWeaponAnimation); @@ -14451,9 +14869,9 @@ void func_8084CB58(Player* this, PlayState* play) { } } -void func_8084CCEC(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_30(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp_v0; this->stateFlags1 |= PLAYER_STATE1_1000; @@ -14462,22 +14880,22 @@ void func_8084CCEC(Player* this, PlayState* play) { func_8083133C(this); this->stateFlags1 &= ~PLAYER_STATE1_20000; Player_AnimationPlayLoop(play, this, D_8085CF60[Player_IsHoldingTwoHandedWeapon(this)]); - this->unk_AE8 = -1; + this->actionVar2 = -1; } func_80832F24(this); - if (!func_8083FE38(this, play) && (this->unk_AE8 != 0)) { + if (!func_8083FE38(this, play) && (this->actionVar2 != 0)) { func_80840F34(this); - if (this->unk_AE8 < 0) { + if (this->actionVar2 < 0) { if (this->unk_B08 >= 0.1f) { this->unk_ADD = 0; - this->unk_AE8 = 1; + this->actionVar2 = 1; } else if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) { func_80840E5C(this, play); } } else if (!func_80840CD4(this, play)) { - func_80832F78(this, &sp34, &sp32, 0.0f, play); - temp_v0 = func_8083E7F8(this, &sp34, &sp32, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp_v0 = func_8083E7F8(this, &speedTarget, &yawTarget, play); if (temp_v0 > 0) { func_80840DEC(this, play); } else if (temp_v0 < 0) { @@ -14487,13 +14905,13 @@ void func_8084CCEC(Player* this, PlayState* play) { } } -void func_8084CE84(Player* this, PlayState* play) { +void Player_Action_31(Player* this, PlayState* play) { s32 var_v1; s32 temp_v0_2; f32 temp_ft4; f32 var_fa0; - f32 sp54; - s16 sp52; + f32 speedTarget; + s16 yawTarget; s16 temp_v0; f32 temp_fv1; s32 pad; @@ -14519,35 +14937,35 @@ void func_8084CE84(Player* this, PlayState* play) { this->blendTableBuffer); if (!func_8083FE38(this, play) && !func_80840CD4(this, play)) { func_80840F34(this); - func_80832F78(this, &sp54, &sp52, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp_v0_2 = func_8083E7F8(this, &sp54, &sp52, play); + temp_v0_2 = func_8083E7F8(this, &speedTarget, &yawTarget, play); if (temp_v0_2 < 0) { func_80840E24(this, play); return; } if (temp_v0_2 == 0) { - sp54 = 0.0f; - sp52 = this->currentYaw; + speedTarget = 0.0f; + yawTarget = this->currentYaw; } - sp44 = ABS_ALT(BINANG_SUB(sp52, this->currentYaw)); + sp44 = ABS_ALT(BINANG_SUB(yawTarget, this->currentYaw)); if (sp44 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + this->currentYaw = yawTarget; } } else { - Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); - if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) { + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, sp44 * 0.1f); + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f)) { func_80840EC0(this, play); } } } } -void func_8084D18C(Player* this, PlayState* play) { +void Player_Action_32(Player* this, PlayState* play) { f32 sp5C = fabsf(this->linearVelocity); f32 var_fa0; @@ -14572,41 +14990,41 @@ void func_8084D18C(Player* this, PlayState* play) { D_8085CF78[Player_IsHoldingTwoHandedWeapon(this)], this->unk_B38 * 0.7241379f, var_fa0, this->blendTableBuffer); if (!func_8083FE38(this, play) && !func_80840CD4(this, play)) { - f32 sp54; - s16 sp52; + f32 speedTarget; + s16 yawTarget; s32 temp_v0; s16 temp_v0_2; s32 var_v1; func_80840F34(this); - func_80832F78(this, &sp54, &sp52, 0.0f, play); - temp_v0 = func_8083E7F8(this, &sp54, &sp52, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp_v0 = func_8083E7F8(this, &speedTarget, &yawTarget, play); if (temp_v0 > 0) { func_80840DEC(this, play); return; } if (temp_v0 == 0) { - sp54 = 0.0f; - sp52 = this->currentYaw; + speedTarget = 0.0f; + yawTarget = this->currentYaw; } - var_v1 = ABS_ALT(BINANG_SUB(sp52, this->currentYaw)); + var_v1 = ABS_ALT(BINANG_SUB(yawTarget, this->currentYaw)); if (var_v1 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + this->currentYaw = yawTarget; } } else { - Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, var_v1 * 0.1f); - if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->currentYaw, yawTarget, var_v1 * 0.1f); + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { func_80840EC0(this, play); } } } } -void func_8084D4EC(Player* this, PlayState* play) { +void Player_Action_33(Player* this, PlayState* play) { s32 animFinished; f32 frame; s32 temp_v0; @@ -14617,7 +15035,7 @@ void func_8084D4EC(Player* this, PlayState* play) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_250jump_start) { this->linearVelocity = 1.0f; if (PlayerAnimation_OnFrame(&this->skelAnime, 8.0f)) { - f32 speed = this->wallHeight; + f32 speed = this->yDistToLedge; speed = CLAMP_MAX(speed, this->ageProperties->unk_0C); if (this->stateFlags1 & PLAYER_STATE1_8000000) { @@ -14631,7 +15049,7 @@ void func_8084D4EC(Player* this, PlayState* play) { } func_80834D50(play, this, NULL, speed, NA_SE_VO_LI_AUTO_JUMP); - this->unk_AE8 = -1; + this->actionVar2 = -1; } } else { temp_v0 = func_808331FC(play, this, &this->skelAnime, 4.0f); @@ -14664,16 +15082,16 @@ void func_8084D4EC(Player* this, PlayState* play) { } if ((this->skelAnime.animation == &gPlayerAnim_link_normal_100step_up) || (this->skelAnime.curFrame > 5.0f)) { - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { Player_AnimSfx_PlayFloorJump(this); - this->unk_AE8 = 1; + this->actionVar2 = 1; } Math_SmoothStepToF(&this->unk_ABC, 0.0f, 0.1f, 400.0f, 150.0f); } } } -void func_8084D770(Player* this, PlayState* play) { +void Player_Action_34(Player* this, PlayState* play) { s32 temp_v0; this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40); @@ -14684,25 +15102,25 @@ void func_8084D770(Player* this, PlayState* play) { PlayerAnimation_Update(play, &this->skelAnime); func_8083249C(this); - temp_v0 = func_8083216C(this, play); + temp_v0 = Player_UpdateUpperBody(this, play); if (((this->stateFlags1 & PLAYER_STATE1_800) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || - (temp_v0 == 0)) { + !temp_v0) { this->unk_D58(play, this); } } -void func_8084D820(Player* this, PlayState* play) { - if (func_80838A90(this, play) == 0) { +void Player_Action_35(Player* this, PlayState* play) { + if (!Player_ActionChange_13(this, play)) { if ((this->stateFlags3 & PLAYER_STATE3_10) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80833AA0(this, play); this->stateFlags1 |= PLAYER_STATE1_20000000; - } else if (this->unk_AE8 == 0) { + } else if (this->actionVar2 == 0) { PlayerAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { this->linearVelocity = 0.1f; - this->unk_AE8 = 1; + this->actionVar2 = 1; } - } else if (this->unk_AE7 == 0) { + } else if (this->actionVar1 == 0) { f32 sp6C = 5.0f * D_8085C3E4; s32 var_t0 = func_808411D4(play, this, &sp6C, -1); @@ -14729,7 +15147,7 @@ void func_8084D820(Player* this, PlayState* play) { } if (var_t0 < 0x1E) { - this->unk_AE7 = 1; + this->actionVar1 = 1; this->stateFlags1 |= PLAYER_STATE1_20000000; this->unk_3A0.x = this->unk_3AC.x; this->unk_3A0.z = this->unk_3AC.z; @@ -14742,12 +15160,12 @@ void func_8084D820(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_1) { sp5C = gSaveContext.entranceSpeed; if (sPlayerConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { - this->unk_3A0.x = (Math_SinS(D_80862B16) * 400.0f) + this->actor.world.pos.x; - this->unk_3A0.z = (Math_CosS(D_80862B16) * 400.0f) + this->actor.world.pos.z; + this->unk_3A0.x = (Math_SinS(sPlayerConveyorYaw) * 400.0f) + this->actor.world.pos.x; + this->unk_3A0.z = (Math_CosS(sPlayerConveyorYaw) * 400.0f) + this->actor.world.pos.z; } } else { - if (this->unk_AE8 < 0) { - this->unk_AE8++; + if (this->actionVar2 < 0) { + this->actionVar2++; sp5C = gSaveContext.entranceSpeed; sp58 = -1; } else if (this->unk_397 == 4) { @@ -14813,7 +15231,7 @@ void func_8084D820(Player* this, PlayState* play) { Player_TranslateAndRotateY(this, &this->unk_3A0, &D_8085D644, &this->unk_3AC); this->actor.shape.rot.y += (this->doorDirection != 0) ? 0x4000 : -0x4000; - this->unk_AE7 = 0; + this->actionVar1 = 0; this->actor.world.rot.y = this->currentYaw = this->actor.shape.rot.y; } @@ -14826,8 +15244,8 @@ void func_8084D820(Player* this, PlayState* play) { } temp_v0_8 = func_808411D4(play, this, &sp5C, sp58); - if ((this->unk_AE8 == 0) || ((temp_v0_8 == 0) && (this->linearVelocity == 0.0f) && - (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { + if ((this->actionVar2 == 0) || ((temp_v0_8 == 0) && (this->linearVelocity == 0.0f) && + (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { if (this->unk_397 == 4) { Map_InitRoomData(play, play->roomCtx.curRoom.num); Minimap_SavePlayerRoomInitInfo(play); @@ -14842,11 +15260,11 @@ void func_8084D820(Player* this, PlayState* play) { if (play->unk_1887C != 0) { play->func_18780(this, play); - Player_SetAction(play, this, func_80854430, 0); - if (play->sceneId == 0x45) { + Player_SetAction(play, this, Player_Action_80, 0); + if (play->sceneId == SCENE_20SICHITAI) { play->unk_1887C = 0; } - } else if (!func_808391D8(this, play)) { + } else if (!Player_ActionChange_4(this, play)) { func_8083B2E4(this, play); } } @@ -14854,12 +15272,12 @@ void func_8084D820(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_800) { - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } } // door stuff -void func_8084E034(Player* this, PlayState* play) { +void Player_Action_36(Player* this, PlayState* play) { EnDoor* doorActor = (EnDoor*)this->doorActor; s32 sp38 = (doorActor != NULL) && (doorActor->doorType == ENDOOR_TYPE_7); s32 animFinished; @@ -14868,17 +15286,17 @@ void func_8084E034(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; - if (DECR(this->unk_AE7) == 0) { + if (DECR(this->actionVar1) == 0) { func_80835DF8(play, this, &poly, &bgId); } animFinished = PlayerAnimation_Update(play, &this->skelAnime); - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); if (animFinished) { - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if (DECR(this->doorTimer) == 0) { - this->unk_AE8 = 1; + this->actionVar2 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -14898,17 +15316,17 @@ void func_8084E034(Player* this, PlayState* play) { Player_StopCutscene(this); play->func_18780(this, play); } else if (sp38 && PlayerAnimation_OnFrame(&this->skelAnime, 15.0f)) { - s16 doorRot = (this->doorDirection < 0) ? doorActor->knobDoor.dyna.actor.world.rot.x - : doorActor->knobDoor.dyna.actor.world.rot.z; + s16 exitIndexPlusOne = (this->doorDirection < 0) ? doorActor->knobDoor.dyna.actor.world.rot.x + : doorActor->knobDoor.dyna.actor.world.rot.z; - if (doorRot != 0) { - func_808354A4(play, doorRot - 1, false); + if (exitIndexPlusOne != 0) { + func_808354A4(play, exitIndexPlusOne - 1, false); } } } // grab/hold an actor (?) -void func_8084E25C(Player* this, PlayState* play) { +void Player_Action_37(Player* this, PlayState* play) { func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -14932,13 +15350,13 @@ void func_8084E25C(Player* this, PlayState* play) { } // grab/hold an actor (?) -void func_8084E334(Player* this, PlayState* play) { +void Player_Action_38(Player* this, PlayState* play) { func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_silver_wait); - this->unk_AE8 = 1; - } else if (this->unk_AE8 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { if (PlayerAnimation_OnFrame(&this->skelAnime, 27.0f)) { Actor* interactRangeActor = this->interactRangeActor; @@ -14949,13 +15367,13 @@ void func_8084E334(Player* this, PlayState* play) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_SWORD_L); } } else if (CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_B | BTN_A)) { - Player_SetAction(play, this, func_8084E434, 1); + Player_SetAction(play, this, Player_Action_39, 1); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_silver_throw); } } // throw held actor (?) -void func_8084E434(Player* this, PlayState* play) { +void Player_Action_39(Player* this, PlayState* play) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_80836988(this, play); } else if (PlayerAnimation_OnFrame(&this->skelAnime, 6.0f)) { @@ -14970,13 +15388,13 @@ void func_8084E434(Player* this, PlayState* play) { } } -void func_8084E4E4(Player* this, PlayState* play) { +void Player_Action_40(Player* this, PlayState* play) { if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); - this->unk_AE8 = 15; - } else if (this->unk_AE8 != 0) { - this->unk_AE8--; - if (this->unk_AE8 == 0) { + this->actionVar2 = 15; + } else if (this->actionVar2 != 0) { + this->actionVar2--; + if (this->actionVar2 == 0) { func_80836A98(this, &gPlayerAnim_link_normal_nocarry_free_end, play); this->stateFlags1 &= ~PLAYER_STATE1_800; Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_DAMAGE_S); @@ -14985,7 +15403,7 @@ void func_8084E4E4(Player* this, PlayState* play) { } // Player_Action_PutDownObject? -void func_8084E58C(Player* this, PlayState* play) { +void Player_Action_41(Player* this, PlayState* play) { func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -15005,24 +15423,22 @@ void func_8084E58C(Player* this, PlayState* play) { } // Player_Action_Throwing -void func_8084E65C(Player* this, PlayState* play) { - f32 sp34; - s16 yaw; +void Player_Action_42(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime) || - ((this->skelAnime.curFrame >= 8.0f) && func_80832F78(this, &sp34, &yaw, 0.018f, play))) { + ((this->skelAnime.curFrame >= 8.0f) && + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play))) { func_80836988(this, play); } else if (PlayerAnimation_OnFrame(&this->skelAnime, 3.0f)) { func_808409A8(play, this, this->linearVelocity + 8.0f, 12.0f); } } -void func_8084E724(Player* this, PlayState* play) { - u8 temp_v1; - u32 new_var; - +void Player_Action_43(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_8000000) { func_808475B4(this); func_8084748C(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); @@ -15032,32 +15448,27 @@ void func_8084E724(Player* this, PlayState* play) { if (this->unk_AA5 == PLAYER_UNKAA5_3) { if (func_800B7118(this) || func_8082ECCC(this)) { - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } } - temp_v1 = this->unk_AA5; - new_var = temp_v1; - - if (((temp_v1 == PLAYER_UNKAA5_2) && !(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) || - ((temp_v1 != PLAYER_UNKAA5_2) && - (((((((((this->csMode != PLAYER_CSMODE_0) || (new_var == 0)) || (temp_v1 >= PLAYER_UNKAA5_5)) || - (func_8082FB68(this) != 0)) || - (this->targetedActor != NULL)) || - (func_8083868C(play, this) == 0)) || + if (((this->unk_AA5 == PLAYER_UNKAA5_2) && !(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) || + ((this->unk_AA5 != PLAYER_UNKAA5_2) && + ((((this->csMode != PLAYER_CSMODE_NONE) || ((u32)this->unk_AA5 == PLAYER_UNKAA5_0) || + (this->unk_AA5 >= PLAYER_UNKAA5_5) || func_8082FB68(this) || (this->lockOnActor != NULL) || + (func_8083868C(play, this) == CAM_MODE_NORMAL) || ((this->unk_AA5 == PLAYER_UNKAA5_3) && - (((((Player_ItemToItemAction(this, Inventory_GetBtnBItem(play)) != this->heldItemAction) && - CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_B)) || - CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_R | BTN_A)) || - (func_80123434(this) != 0)) || - (!func_800B7128(this) && (func_8082EF20(this) == 0))))) || + (((Player_ItemToItemAction(this, Inventory_GetBtnBItem(play)) != this->heldItemAction) && + CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_B)) || + CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_R | BTN_A) || func_80123434(this) || + (!func_800B7128(this) && !func_8082EF20(this))))) || ((this->unk_AA5 == PLAYER_UNKAA5_1) && CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_R | BTN_B | BTN_A))) || - func_808391D8(this, play)))) { + Player_ActionChange_4(this, play)))) { func_80839ED0(this, play); - play_sound(NA_SE_SY_CAMERA_ZOOM_UP); - } else if ((DECR(this->unk_AE8) == 0) || (this->unk_AA5 != PLAYER_UNKAA5_3)) { + Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP); + } else if ((DECR(this->actionVar2) == 0) || (this->unk_AA5 != PLAYER_UNKAA5_3)) { if (func_801240DC(this)) { this->unk_AA6 |= 0x43; } else { @@ -15068,26 +15479,26 @@ void func_8084E724(Player* this, PlayState* play) { this->currentYaw = this->actor.shape.rot.y; } -void func_8084E980(Player* this, PlayState* play) { +void Player_Action_44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; func_8083249C(this); - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; - if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_4)) { + if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY)) { this->stateFlags2 &= ~PLAYER_STATE2_2000; } func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); CutsceneManager_Stop(CS_ID_GLOBAL_TALK); if (this->stateFlags1 & PLAYER_STATE1_800000) { - s32 sp44 = this->unk_AE8; + s32 sp44 = this->actionVar2; func_80837BD0(play, this); - this->unk_AE8 = sp44; + this->actionVar2 = sp44; } else if (!func_80847994(play, this) && !func_80847880(play, this) && !func_808387A0(play, this) && - ((this->talkActor != this->interactRangeActor) || !func_8083D23C(this, play))) { + ((this->talkActor != this->interactRangeActor) || !Player_ActionChange_2(this, play))) { if (func_801242B4(this)) { func_808353DC(play, this); } else { @@ -15100,9 +15511,9 @@ void func_8084E980(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_800000) { - func_8084FE7C(this, play); + Player_Action_52(this, play); } else if (func_801242B4(this)) { - func_808508C8(this, play); + Player_Action_54(this, play); if (this->actor.depthInWater > 100.0f) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; @@ -15120,47 +15531,47 @@ void func_8084E980(Player* this, PlayState* play) { } } - if (this->targetedActor != NULL) { + if (this->lockOnActor != NULL) { this->currentYaw = func_8083C62C(this, false); this->actor.shape.rot.y = this->currentYaw; - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { if (!(this->stateFlags1 & PLAYER_STATE1_800)) { - if (PlayerAnimation_Update(play, &this->unk_284)) { - this->unk_AE7--; - if (this->unk_AE7 != 0) { - PlayerAnimation_Change(play, &this->unk_284, &gPlayerAnim_link_normal_talk_free, 1.0f, 0.0f, - Animation_GetLastFrame(&gPlayerAnim_link_normal_talk_free), + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { + this->actionVar1--; + if (this->actionVar1 != 0) { + PlayerAnimation_Change(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_talk_free, 1.0f, + 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_normal_talk_free), ANIMMODE_ONCE, -6.0f); } } } AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable, D_8085B9F0); + this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap); } else if (!(this->stateFlags1 & PLAYER_STATE1_800) && (this->skelAnime.animation == &gPlayerAnim_link_normal_talk_free_wait)) { s32 temp_v0 = this->actor.focus.rot.y - this->actor.shape.rot.y; if (ABS_ALT(temp_v0) > 0xFA0) { PlayerAnimation_Change( - play, &this->unk_284, D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType], 0.4f, 0.0f, + play, &this->skelAnimeUpper, D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType], 0.4f, 0.0f, Animation_GetLastFrame(D_8085BE84[PLAYER_ANIMGROUP_25][this->modelAnimType]), ANIMMODE_ONCE, -6.0f); - this->unk_AE7 = 2; + this->actionVar1 = 2; } } } } -void func_8084ED9C(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_45(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp_v0; this->stateFlags2 |= (PLAYER_STATE2_1 | PLAYER_STATE2_40 | PLAYER_STATE2_100); func_8083DEE4(play, this); if (PlayerAnimation_Update(play, &this->skelAnime) && !func_8083E14C(play, this)) { - func_80832F78(this, &sp34, &sp32, 0.0f, play); - temp_v0 = func_8083E758(this, &sp34, &sp32); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp_v0 = func_8083E758(this, &speedTarget, &yawTarget); if (temp_v0 > 0) { func_8083E234(this, play); } else if (temp_v0 < 0) { @@ -15174,12 +15585,12 @@ AnimSfxEntry D_8085D650[] = { ANIMSFX(ANIMSFX_TYPE_FLOOR, 21, NA_SE_PL_SLIP, STOP), }; -void func_8084EE50(Player* this, PlayState* play) { +void Player_Action_46(Player* this, PlayState* play) { this->stateFlags2 |= (PLAYER_STATE2_1 | PLAYER_STATE2_40 | PLAYER_STATE2_100); if (func_8082E67C(play, this, &gPlayerAnim_link_normal_pushing)) { - this->unk_AE8 = 1; - } else if ((this->unk_AE8 == 0) && PlayerAnimation_OnFrame(&this->skelAnime, 11.0f)) { + this->actionVar2 = 1; + } else if ((this->actionVar2 == 0) && PlayerAnimation_OnFrame(&this->skelAnime, 11.0f)) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_PUSH); } @@ -15187,12 +15598,12 @@ void func_8084EE50(Player* this, PlayState* play) { func_8083DEE4(play, this); if (!func_8083E14C(play, this)) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 temp_v0; - func_80832F78(this, &sp34, &sp32, 0.0f, play); - temp_v0 = func_8083E758(this, &sp34, &sp32); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp_v0 = func_8083E758(this, &speedTarget, &yawTarget); if (temp_v0 < 0) { func_8083E28C(this, play); } else if (temp_v0 == 0) { @@ -15215,14 +15626,14 @@ AnimSfxEntry D_8085D658[] = { Vec3f D_8085D660 = { 0.0f, 268 * 0.1f, -60.0f }; -void func_8084EF9C(Player* this, PlayState* play) { +void Player_Action_47(Player* this, PlayState* play) { PlayerAnimationHeader* anim = D_8085BE84[PLAYER_ANIMGROUP_35][this->modelAnimType]; this->stateFlags2 |= (PLAYER_STATE2_1 | PLAYER_STATE2_40 | PLAYER_STATE2_100); if (func_8082E67C(play, this, anim)) { - this->unk_AE8 = 1; - } else if (this->unk_AE8 == 0) { + this->actionVar2 = 1; + } else if (this->actionVar2 == 0) { if (PlayerAnimation_OnFrame(&this->skelAnime, 11.0f)) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_PUSH); } @@ -15235,13 +15646,13 @@ void func_8084EF9C(Player* this, PlayState* play) { func_8083DEE4(play, this); if (!func_8083E14C(play, this)) { - f32 sp78; - s16 sp76; + f32 speedTarget; + s16 yawTarget; s32 temp_v0; - func_80832F78(this, &sp78, &sp76, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp_v0 = func_8083E758(this, &sp78, &sp76); + temp_v0 = func_8083E758(this, &speedTarget, &yawTarget); if (temp_v0 > 0) { func_8083E234(this, play); } else if (temp_v0 == 0) { @@ -15273,17 +15684,17 @@ void func_8084EF9C(Player* this, PlayState* play) { } } -void func_8084F1B8(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; +void Player_Action_48(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_40; if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_AnimationPlayLoop(play, this, - (this->unk_AE7 > 0) ? &gPlayerAnim_link_normal_fall_wait - : D_8085BE84[PLAYER_ANIMGROUP_39][this->modelAnimType]); - } else if (this->unk_AE7 == 0) { + (this->actionVar1 > 0) ? &gPlayerAnim_link_normal_fall_wait + : D_8085BE84[PLAYER_ANIMGROUP_39][this->modelAnimType]); + } else if (this->actionVar1 == 0) { f32 frame; if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { @@ -15295,25 +15706,25 @@ void func_8084F1B8(Player* this, PlayState* play) { if (PlayerAnimation_OnFrame(&this->skelAnime, frame)) { Player_AnimSfx_PlayFloor(this, NA_SE_PL_WALK_GROUND); if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { - this->unk_AE7 = 1; + this->actionVar1 = 1; } else { - this->unk_AE7 = -1; + this->actionVar1 = -1; } } } Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 0x800); - if (this->unk_AE7 != 0) { - func_80832F78(this, &sp3C, &sp3A, 0.0f, play); + if (this->actionVar1 != 0) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->unk_ADF[this->unk_ADE] >= 0) { func_808381A0(this, - (this->unk_AE7 > 0) ? D_8085BE84[PLAYER_ANIMGROUP_37][this->modelAnimType] - : D_8085BE84[PLAYER_ANIMGROUP_40][this->modelAnimType], + (this->actionVar1 > 0) ? D_8085BE84[PLAYER_ANIMGROUP_37][this->modelAnimType] + : D_8085BE84[PLAYER_ANIMGROUP_40][this->modelAnimType], play); } else if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlags != 0)) { func_80833A64(this); - if (this->unk_AE7 < 0) { + if (this->actionVar1 < 0) { this->linearVelocity = -0.8f; } else { this->linearVelocity = 0.8f; @@ -15326,7 +15737,7 @@ void func_8084F1B8(Player* this, PlayState* play) { } } -void func_8084F3DC(Player* this, PlayState* play) { +void Player_Action_49(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_40; if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -15344,7 +15755,7 @@ void func_8084F3DC(Player* this, PlayState* play) { } } -void func_8084F4E8(Player* this, PlayState* play) { +void Player_Action_50(Player* this, PlayState* play) { s32 yStick = sPlayerControlInput->rel.stick_y; s32 xStick = sPlayerControlInput->rel.stick_x; f32 var_fv0; @@ -15361,7 +15772,7 @@ void func_8084F4E8(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_40; - if ((this->unk_AE7 != 0) && (ABS_ALT(yStick) < ABS_ALT(xStick))) { + if ((this->actionVar1 != 0) && (ABS_ALT(yStick) < ABS_ALT(xStick))) { var_fv0 = ABS_ALT(xStick) * 0.0325f; yStick = 0; } else { @@ -15383,7 +15794,7 @@ void func_8084F4E8(Player* this, PlayState* play) { this->skelAnime.playSpeed = var_fv1 * var_fv0; - if (this->unk_AE8 >= 0) { + if (this->actionVar2 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { dyna = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); @@ -15393,21 +15804,21 @@ void func_8084F4E8(Player* this, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 268 * 0.1f, 6.0f, this->ageProperties->unk_00 + 15.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 268 * 0.1f, 6.0f, this->ageProperties->ceilingCheckHeight + 15.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); func_8083DD1C(play, this, 268 * 0.1f, this->ageProperties->unk_3C, 50.0f, -20.0f); } func_80831944(play, this); - if ((this->unk_AE8 < 0) || !func_8083E354(this, play)) { + if ((this->actionVar2 < 0) || !func_8083E354(this, play)) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8 < 0) { - this->unk_AE8 = ABS_ALT(this->unk_AE8) & 1; + if (this->actionVar2 < 0) { + this->actionVar2 = ABS_ALT(this->actionVar2) & 1; } else if (yStick != 0) { f32 yIntersect; - sp78 = this->unk_AE7 + this->unk_AE8; + sp78 = this->actionVar1 + this->actionVar2; if (yStick > 0) { sp6C.x = 0.0f; @@ -15417,7 +15828,7 @@ void func_8084F4E8(Player* this, PlayState* play) { yIntersect = func_80835D2C(play, this, &sp6C, &sp60); if (this->actor.world.pos.y < yIntersect) { - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { this->actor.world.pos.y = yIntersect; this->stateFlags1 &= ~PLAYER_STATE1_200000; func_80837CEC(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, @@ -15427,22 +15838,22 @@ void func_8084F4E8(Player* this, PlayState* play) { func_808381A0(this, &gPlayerAnim_link_normal_jump_climb_up_free, play); this->stateFlags1 |= PLAYER_STATE1_4000; } else { - func_8083DCC4(this, this->ageProperties->unk_D4[this->unk_AE8], play); + func_8083DCC4(this, this->ageProperties->unk_D4[this->actionVar2], play); } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp78]; Player_AnimationPlayOnce(play, this, this->ageProperties->unk_B4[sp78]); } } else if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { func_8083E2F4(this, play); } else { - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { this->skelAnime.prevTransl = this->ageProperties->unk_44; } - func_8083DCC4(this, this->ageProperties->unk_CC[this->unk_AE8], play); - this->unk_AE8 = 1; + func_8083DCC4(this, this->ageProperties->unk_CC[this->actionVar2], play); + this->actionVar2 = 1; } } else { sp78 ^= 1; @@ -15452,15 +15863,15 @@ void func_8084F4E8(Player* this, PlayState* play) { 0.0f); } - this->unk_AE8 ^= 1; - } else if ((this->unk_AE7 != 0) && (xStick != 0)) { - anim2 = this->ageProperties->unk_C4[this->unk_AE8]; + this->actionVar2 ^= 1; + } else if ((this->actionVar1 != 0) && (xStick != 0)) { + anim2 = this->ageProperties->unk_C4[this->actionVar2]; if (xStick > 0) { - this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_AE8]; + this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->actionVar2]; Player_AnimationPlayOnce(play, this, anim2); } else { - this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_AE8 + 2]; + this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->actionVar2 + 2]; PlayerAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, 2, 0.0f); } @@ -15472,10 +15883,10 @@ void func_8084F4E8(Player* this, PlayState* play) { } } - if (this->unk_AE8 < 0) { - if (((this->unk_AE8 == -2) && + if (this->actionVar2 < 0) { + if (((this->actionVar2 == -2) && (PlayerAnimation_OnFrame(&this->skelAnime, 14.0f) || PlayerAnimation_OnFrame(&this->skelAnime, 29.0f))) || - ((this->unk_AE8 == -4) && + ((this->actionVar2 == -4) && (PlayerAnimation_OnFrame(&this->skelAnime, 22.0f) || PlayerAnimation_OnFrame(&this->skelAnime, 35.0f) || PlayerAnimation_OnFrame(&this->skelAnime, 49.0f) || PlayerAnimation_OnFrame(&this->skelAnime, 55.0f)))) { func_80847A50(this); @@ -15494,7 +15905,7 @@ AnimSfxEntry D_8085D67C[] = { ANIMSFX(ANIMSFX_TYPE_SURFACE, 30, NA_SE_PL_WALK_LADDER, STOP), }; -void func_8084FC0C(Player* this, PlayState* play) { +void Player_Action_51(Player* this, PlayState* play) { s32 temp_v0; this->stateFlags2 |= PLAYER_STATE2_40; @@ -15508,7 +15919,7 @@ void func_8084FC0C(Player* this, PlayState* play) { } else { f32* var_v1 = D_8085D66C; - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { Player_PlayAnimSfx(this, D_8085D67C); var_v1 = D_8085D674; } @@ -15552,7 +15963,7 @@ void func_8084FD7C(PlayState* play, Player* this, Actor* actor) { } s32 func_8084FE48(Player* this) { - return (this->targetedActor == NULL) && !func_8082FC24(this); + return (this->lockOnActor == NULL) && !func_8082FC24(this); } PlayerAnimationHeader* D_8085D688[] = { @@ -15599,16 +16010,16 @@ AnimSfxEntry D_8085D6E8[] = { ANIMSFX(ANIMSFX_TYPE_GENERAL, 136, NA_SE_PL_CALM_PAT, STOP), }; -void func_8084FE7C(Player* this, PlayState* play) { +void Player_Action_52(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; this->stateFlags2 |= PLAYER_STATE2_40; func_80847E2C(this, 1.0f, 10.0f); - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if (PlayerAnimation_Update(play, &this->skelAnime)) { this->skelAnime.animation = &gPlayerAnim_link_uma_wait_1; - this->unk_AE8 = 0x63; + this->actionVar2 = 0x63; } else { s32 var_v0 = (this->mountSide < 0) ? 0 : 1; @@ -15628,8 +16039,8 @@ void func_8084FE7C(Player* this, PlayState* play) { this->skelAnime.prevTransl = D_8085D6E0; - if ((this->unk_AE8 < 0) || ((rideActor->animIndex != (this->unk_AE8 & 0xFFFF)) && - ((rideActor->animIndex >= ENHORSE_ANIM_STOPPING) || (this->unk_AE8 >= 2)))) { + if ((this->actionVar2 < 0) || ((rideActor->animIndex != (this->actionVar2 & 0xFFFF)) && + ((rideActor->animIndex >= ENHORSE_ANIM_STOPPING) || (this->actionVar2 >= 2)))) { s32 animIndex = rideActor->animIndex; if (animIndex < ENHORSE_ANIM_STOPPING) { @@ -15646,24 +16057,24 @@ void func_8084FE7C(Player* this, PlayState* play) { Player_AnimationPlayOnce(play, this, D_8085D6D0[index]); } else { this->skelAnime.animation = D_8085D688[animIndex - 2]; - if (this->unk_AE8 >= 0) { + if (this->actionVar2 >= 0) { Animation_SetMorph(play, &this->skelAnime, 8.0f); } if (animIndex < ENHORSE_ANIM_WALK) { func_808309CC(play, this); - this->unk_AE7 = 0; + this->actionVar1 = 0; } } - this->unk_AE8 = animIndex; + this->actionVar2 = animIndex; } - if (this->unk_AE8 == 1) { + if (this->actionVar2 == 1) { if (D_80862B04 || func_8082DAFC(play)) { Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (PlayerAnimation_Update(play, &this->skelAnime)) { - this->unk_AE8 = 0x63; + this->actionVar2 = 0x63; } else if (this->skelAnime.animation == &gPlayerAnim_link_uma_wait_1) { Player_PlayAnimSfx(this, D_8085D6E8); } @@ -15675,13 +16086,13 @@ void func_8084FE7C(Player* this, PlayState* play) { AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.morphTable, this->skelAnime.jointTable); - if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_0)) { + if ((play->csCtx.state != CS_STATE_IDLE) || (this->csMode != PLAYER_CSMODE_NONE)) { this->unk_AA5 = PLAYER_UNKAA5_0; - this->unk_AE7 = 0; - } else if ((this->unk_AE8 < 2) || (this->unk_AE8 >= 4)) { - D_80862B04 = func_8083216C(this, play); + this->actionVar1 = 0; + } else if ((this->actionVar2 < 2) || (this->actionVar2 >= 4)) { + D_80862B04 = Player_UpdateUpperBody(this, play); if (D_80862B04) { - this->unk_AE7 = 0; + this->actionVar1 = 0; } } @@ -15692,28 +16103,28 @@ void func_8084FE7C(Player* this, PlayState* play) { this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if (!D_80862B04) { - if (this->unk_AE7 != 0) { - if (PlayerAnimation_Update(play, &this->unk_284)) { + if (this->actionVar1 != 0) { + if (PlayerAnimation_Update(play, &this->skelAnimeUpper)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; - this->unk_AE7 = 0; + this->actionVar1 = 0; } - if (this->unk_284.animation == &gPlayerAnim_link_uma_stop_muti) { - if (PlayerAnimation_OnFrame(&this->unk_284, 23.0f)) { + if (this->skelAnimeUpper.animation == &gPlayerAnim_link_uma_stop_muti) { + if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 23.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable); + this->skelAnimeUpper.jointTable); } else { - if (PlayerAnimation_OnFrame(&this->unk_284, 10.0f)) { + if (PlayerAnimation_OnFrame(&this->skelAnimeUpper, 10.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->unk_284.jointTable, D_8085B9F0); + this->skelAnimeUpper.jointTable, sPlayerUpperBodyLimbCopyMap); } } else if (!CHECK_FLAG_ALL(this->actor.flags, 0x100)) { PlayerAnimationHeader* anim = NULL; @@ -15721,14 +16132,14 @@ void func_8084FE7C(Player* this, PlayState* play) { if (EN_HORSE_CHECK_3(rideActor)) { anim = &gPlayerAnim_link_uma_stop_muti; } else if (EN_HORSE_CHECK_2(rideActor)) { - if ((this->unk_AE8 >= 2) && (this->unk_AE8 != 0x63)) { - anim = D_8085D6A4[this->unk_AE8]; + if ((this->actionVar2 >= 2) && (this->actionVar2 != 0x63)) { + anim = D_8085D6A4[this->actionVar2]; } } if (anim != NULL) { - PlayerAnimation_PlayOnce(play, &this->unk_284, anim); - this->unk_AE7 = 1; + PlayerAnimation_PlayOnce(play, &this->skelAnimeUpper, anim); + this->actionVar1 = 1; } } } @@ -15740,10 +16151,10 @@ void func_8084FE7C(Player* this, PlayState* play) { } else { func_8084FD7C(play, this, &rideActor->actor); } - } else if ((this->csMode != PLAYER_CSMODE_0) || - (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !func_808391D8(this, play)) && - !func_80847BF0(this, play) && !func_80838A90(this, play))) { - if (this->targetedActor != NULL) { + } else if ((this->csMode != PLAYER_CSMODE_NONE) || + (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionChange_4(this, play)) && + !func_80847BF0(this, play) && !Player_ActionChange_13(this, play))) { + if (this->lockOnActor != NULL) { if (func_800B7128(this)) { this->upperLimbRot.y = func_8083C62C(this, true) - this->actor.shape.rot.y; this->upperLimbRot.y = CLAMP(this->upperLimbRot.y, -0x4AAA, 0x4AAA); @@ -15768,7 +16179,7 @@ void func_8084FE7C(Player* this, PlayState* play) { } if (this->csMode == PLAYER_CSMODE_END) { - this->csMode = PLAYER_CSMODE_0; + this->csMode = PLAYER_CSMODE_NONE; } } @@ -15778,7 +16189,7 @@ AnimSfxEntry D_8085D708[] = { ANIMSFX(ANIMSFX_TYPE_GENERAL, 25, NA_SE_PL_SLIPDOWN, STOP), }; -void func_808505D0(Player* this, PlayState* play) { +void Player_Action_53(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_40; func_80847E2C(this, 1.0f, 10.0f); @@ -15817,7 +16228,7 @@ s32 func_80850734(PlayState* play, Player* this) { this->stateFlags2 |= PLAYER_STATE2_400; PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_pz_waterroll, 2.0f / 3.0f, 4.0f, Animation_GetLastFrame(&gPlayerAnim_pz_waterroll), ANIMMODE_ONCE, -6.0f); - this->unk_AE8 = 5; + this->actionVar2 = 5; this->unk_B86[0] = 0; this->unk_B48 = this->linearVelocity; this->actor.velocity.y = 0.0f; @@ -15829,36 +16240,36 @@ s32 func_80850734(PlayState* play, Player* this) { s32 func_80850854(PlayState* play, Player* this) { if ((this->transformation == PLAYER_FORM_DEKU) && (this->remainingHopsCounter != 0) && - (gSaveContext.save.saveInfo.playerData.health != 0) && (D_80862AFC != 0.0f)) { + (gSaveContext.save.saveInfo.playerData.health != 0) && (sPlayerControlStickMagnitude != 0.0f)) { func_808373F8(play, this, 0); return true; } return false; } -void func_808508C8(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_54(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_20; func_8082E67C(play, this, &gPlayerAnim_link_swimer_swim_wait); func_808475B4(this); - if (this->unk_AE8 != 0) { - this->unk_AE8--; + if (this->actionVar2 != 0) { + this->actionVar2--; } func_8082F164(this, BTN_R); if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { - this->unk_AE8 = 0; + this->actionVar2 = 0; } - if (!func_8082DAFC(play) && !func_80833058(play, this, D_8085D048, 1) && - !func_8083B3B4(play, this, sPlayerControlInput) && ((this->unk_AE8 != 0) || !func_80850734(play, this))) { - sp34 = 0.0f; - sp32 = this->actor.shape.rot.y; + if (!func_8082DAFC(play) && !Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) && + !func_8083B3B4(play, this, sPlayerControlInput) && ((this->actionVar2 != 0) || !func_80850734(play, this))) { + speedTarget = 0.0f; + yawTarget = this->actor.shape.rot.y; if (this->unk_AA5 > PLAYER_UNKAA5_2) { this->unk_AA5 = PLAYER_UNKAA5_0; @@ -15869,32 +16280,35 @@ void func_808508C8(Player* this, PlayState* play) { func_80836A98(this, D_8085BE84[PLAYER_ANIMGROUP_14][this->modelAnimType], play); Player_AnimSfx_PlayFloorLand(this); } - } else if ((func_80850854(play, this) == 0) && - (func_80832F78(this, &sp34, &sp32, 0.0f, play), (sp34 != 0.0f))) { - if ((ABS_ALT(BINANG_SUB(this->actor.shape.rot.y, sp32)) > 0x6000) && - !Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - return; - } + } else if (!func_80850854(play, this)) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (func_8082FC24(this) || func_80847ED4(this)) { - func_80848048(play, this); - } else { - func_8083B73C(play, this, sp32); + if (speedTarget != 0.0f) { + if ((ABS_ALT(BINANG_SUB(this->actor.shape.rot.y, yawTarget)) > 0x6000) && + !Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { + return; + } + + if (func_8082FC24(this) || func_80847ED4(this)) { + func_80848048(play, this); + } else { + func_8083B73C(play, this, yawTarget); + } } } - func_8084748C(this, &this->linearVelocity, sp34, sp32); + func_8084748C(this, &this->linearVelocity, speedTarget, yawTarget); func_80847F1C(this); } } -void func_80850B18(Player* this, PlayState* play) { - if (!func_80838A90(this, play)) { +void Player_Action_55(Player* this, PlayState* play) { + if (!Player_ActionChange_13(this, play)) { this->stateFlags2 |= PLAYER_STATE2_20; func_808477D0(play, this, NULL, this->linearVelocity); func_808475B4(this); - if (DECR(this->unk_AE8) == 0) { + if (DECR(this->actionVar2) == 0) { func_808353DC(play, this); } } @@ -15922,10 +16336,10 @@ void func_80850D20(PlayState* play, Player* this) { func_8083F8A8(play, this, 12.0f, -1, 1.0f, 160, 20, true); } -void func_80850D68(Player* this, PlayState* play) { - f32 sp44; +void Player_Action_56(Player* this, PlayState* play) { + f32 speedTarget; s16 sp42; - s16 sp40; + s16 yawTarget; s16 sp3E; s16 sp3C; s16 sp3A; @@ -15935,7 +16349,7 @@ void func_80850D68(Player* this, PlayState* play) { func_808475B4(this); func_8082F164(this, BTN_R); - if (func_80833058(play, this, D_8085D048, false)) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList11, false)) { return; } @@ -15947,15 +16361,15 @@ void func_80850D68(Player* this, PlayState* play) { return; } - sp44 = 0.0f; + speedTarget = 0.0f; - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { if ((!func_8082DA90(play) && !CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A)) || (this->currentBoots != PLAYER_BOOTS_ZORA_LAND)) { this->unk_B86[0] = 1; } - if (PlayerAnimation_Update(play, &this->skelAnime) && (DECR(this->unk_AE8) == 0)) { + if (PlayerAnimation_Update(play, &this->skelAnime) && (DECR(this->actionVar2) == 0)) { if (this->unk_B86[0] != 0) { this->stateFlags3 &= ~PLAYER_STATE3_8000; func_8082DB90(play, this, &gPlayerAnim_pz_swimtowait); @@ -15963,18 +16377,18 @@ void func_80850D68(Player* this, PlayState* play) { func_8082DB60(play, this, &gPlayerAnim_pz_fishswim); } } else { - func_80832F78(this, &sp44, &sp40, 0.0f, play); - Math_ScaledStepToS(&this->currentYaw, sp40, 0x640); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + Math_ScaledStepToS(&this->currentYaw, yawTarget, 0x640); if (this->skelAnime.curFrame >= 13.0f) { - sp44 = 12.0f; + speedTarget = 12.0f; if (PlayerAnimation_OnFrame(&this->skelAnime, 13.0f)) { this->unk_B48 = 16.0f; } this->stateFlags3 |= PLAYER_STATE3_8000; } else { - sp44 = 0.0f; + speedTarget = 0.0f; } } @@ -15989,15 +16403,15 @@ void func_80850D68(Player* this, PlayState* play) { func_8082DB90(play, this, &gPlayerAnim_pz_swimtowait); this->unk_B86[0] = 1; } else { - sp44 = 9.0f; - func_800B8F98(&this->actor, NA_SE_PL_ZORA_SWIM_LV - SFX_FLAG); + speedTarget = 9.0f; + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_ZORA_SWIM_LV - SFX_FLAG); } // Y sp3E = sPlayerControlInput->rel.stick_y * 0xC8; if (this->unk_B8C != 0) { this->unk_B8C--; - sp3E = CLAMP_MAX(sp3E, (s16)(this->unk_B6C - 0xFA0)); + sp3E = CLAMP_MAX(sp3E, (s16)(this->floorPitch - 0xFA0)); } if ((this->unk_AAA >= -0x1555) && (this->actor.depthInWater < (this->ageProperties->unk_24 + 10.0f))) { @@ -16021,7 +16435,7 @@ void func_80850D68(Player* this, PlayState* play) { } } - if (D_80862B18 < 20.0f) { + if (sPlayerYDistToFloor < 20.0f) { func_80850D20(play, this); } } else { @@ -16041,7 +16455,7 @@ void func_80850D68(Player* this, PlayState* play) { if ((this->actor.floorBgId == BGCHECK_SCENE) || ((dynaActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId)) == NULL) || (dynaActor->actor.id != ACTOR_EN_TWIG)) { - this->unk_AAA += (s16)((-this->unk_B6C - this->unk_AAA) * 2); + this->unk_AAA += (s16)((-this->floorPitch - this->unk_AAA) * 2); this->unk_B8C = 0xF; } @@ -16049,83 +16463,84 @@ void func_80850D68(Player* this, PlayState* play) { Player_PlaySfx(this, NA_SE_PL_BODY_BOUND); } - func_80850BF8(this, sp44); + func_80850BF8(this, speedTarget); func_80850BA8(this); } -void func_808513EC(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_57(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s16 sp30; s16 var_v0; this->stateFlags2 |= PLAYER_STATE2_20; func_808475B4(this); func_8082F164(this, BTN_R); - if (!func_80833058(play, this, D_8085D048, 1) && !func_8083B3B4(play, this, sPlayerControlInput) && - !func_80850854(play, this)) { + if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) && + !func_8083B3B4(play, this, sPlayerControlInput) && !func_80850854(play, this)) { func_808477D0(play, this, sPlayerControlInput, this->linearVelocity); if (func_8082DA90(play)) { - sp34 = this->linearVelocity; - sp32 = this->actor.shape.rot.y; + speedTarget = this->linearVelocity; + yawTarget = this->actor.shape.rot.y; } else { - func_80832F78(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); } - sp30 = this->actor.shape.rot.y - sp32; + sp30 = this->actor.shape.rot.y - yawTarget; if (!func_80850734(play, this)) { if (func_8082FC24(this) || func_80847ED4(this)) { func_80848048(play, this); } else { - if ((sp34 == 0.0f) || (ABS_ALT(sp30) > 0x6000) || + if ((speedTarget == 0.0f) || (ABS_ALT(sp30) > 0x6000) || (this->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER)) { func_808353DC(play, this); } } - func_80847FF8(this, &this->linearVelocity, sp34, sp32); + func_80847FF8(this, &this->linearVelocity, speedTarget, yawTarget); } } } -void func_80851588(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; +void Player_Action_58(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; func_808477D0(play, this, sPlayerControlInput, this->linearVelocity); func_808475B4(this); func_8082F164(this, BTN_R); - if (!func_80833058(play, this, D_8085D048, 1) && !func_8083B3B4(play, this, sPlayerControlInput)) { - func_80832F78(this, &sp2C, &sp2A, 0.0f, play); + if (!Player_TryActionChangeList(play, this, sPlayerActionChangeList11, true) && + !func_8083B3B4(play, this, sPlayerControlInput)) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (sp2C == 0.0f) { + if (speedTarget == 0.0f) { func_808353DC(play, this); } else if (!func_8082FC24(this) && !func_80847ED4(this)) { - func_8083B73C(play, this, sp2A); + func_8083B73C(play, this, yawTarget); } else { - func_80848094(play, this, &sp2C, &sp2A); + func_80848094(play, this, &speedTarget, &yawTarget); } - func_80847FF8(this, &this->linearVelocity, sp2C, sp2A); + func_80847FF8(this, &this->linearVelocity, speedTarget, yawTarget); } } -void func_808516B4(Player* this, PlayState* play) { +void Player_Action_59(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; this->actor.gravity = 0.0f; - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); func_8082F164(this, BTN_R); - if (func_80838A90(this, play)) { + if (Player_ActionChange_13(this, play)) { return; } if (this->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) { func_808353DC(play, this); - } else if (this->unk_AE7 == 0) { + } else if (this->actionVar1 == 0) { f32 temp_fv0; - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if (PlayerAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 22.0f) && !CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A))) { func_8083B798(play, this); @@ -16137,11 +16552,11 @@ void func_808516B4(Player* this, PlayState* play) { func_808477D0(play, this, sPlayerControlInput, this->actor.velocity.y); this->unk_AAA = 0x3E80; - if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) && !func_8083D23C(this, play) && + if (CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.depthInWater < 120.0f)) { func_808481CC(play, this, -2.0f); } else { - this->unk_AE7++; + this->actionVar1++; func_8082E634(play, this, &gPlayerAnim_link_swimer_swim_wait); } } @@ -16150,16 +16565,16 @@ void func_808516B4(Player* this, PlayState* play) { if (temp_fv0 < this->actor.velocity.y) { this->actor.velocity.y = temp_fv0; } - } else if (this->unk_AE7 == 1) { + } else if (this->actionVar1 == 1) { PlayerAnimation_Update(play, &this->skelAnime); func_808475B4(this); if (this->unk_AAA < 0x2710) { - this->unk_AE7++; - this->unk_AE8 = this->actor.depthInWater; + this->actionVar1++; + this->actionVar2 = this->actor.depthInWater; func_8082E634(play, this, &gPlayerAnim_link_swimer_swim); } } else if (!func_8083B3B4(play, this, sPlayerControlInput)) { - f32 var_fv1 = (this->unk_AE8 * 0.018f) + 4.0f; + f32 var_fv1 = (this->actionVar2 * 0.018f) + 4.0f; if (this->stateFlags1 & PLAYER_STATE1_800) { sPlayerControlInput = NULL; @@ -16173,7 +16588,7 @@ void func_808516B4(Player* this, PlayState* play) { } } -void func_808519FC(Player* this, PlayState* play) { +void Player_Action_60(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; func_8082F164(this, BTN_R); @@ -16197,7 +16612,7 @@ void func_808519FC(Player* this, PlayState* play) { func_8084748C(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_80851B58(Player* this, PlayState* play) { +void Player_Action_61(Player* this, PlayState* play) { func_808475B4(this); Math_StepToF(&this->linearVelocity, 0.0f, 0.4f); if (PlayerAnimation_Update(play, &this->skelAnime) && (this->linearVelocity < 10.0f)) { @@ -16205,7 +16620,7 @@ void func_80851B58(Player* this, PlayState* play) { } } -void func_80851BD4(Player* this, PlayState* play) { +void Player_Action_62(Player* this, PlayState* play) { func_808475B4(this); if (PlayerAnimation_Update(play, &this->skelAnime) && (this == GET_PLAYER(play))) { func_80840770(play, this); @@ -16216,10 +16631,12 @@ void func_80851BD4(Player* this, PlayState* play) { s32 func_80851C40(PlayState* play, Player* this) { return ((play->sceneId == SCENE_MILK_BAR) && Audio_IsSequencePlaying(NA_BGM_BALLAD_OF_THE_WIND_FISH)) || (((play->sceneId != SCENE_MILK_BAR) && (this->csMode == PLAYER_CSMODE_68)) || - ((play->msgCtx.msgMode == 0x12) || (play->msgCtx.msgMode == 0x13) || (play->msgCtx.msgMode == 0x14) || - ((play->msgCtx.ocarinaMode != 1) && - ((this->csMode == PLAYER_CSMODE_5) || (play->msgCtx.ocarinaMode == 3) || - play->msgCtx.ocarinaAction == 0x32)))); + ((play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) || + (play->msgCtx.msgMode == MSGMODE_SETUP_DISPLAY_SONG_PLAYED) || + (play->msgCtx.msgMode == MSGMODE_DISPLAY_SONG_PLAYED) || + ((play->msgCtx.ocarinaMode != OCARINA_MODE_ACTIVE) && + ((this->csMode == PLAYER_CSMODE_5) || (play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) || + play->msgCtx.ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE)))); } // Deku playing the pipes? The loops both overwrite unk_AF0[0].y,z and unk_AF0[1].x,y,z @@ -16239,9 +16656,9 @@ void func_80851D30(PlayState* play, Player* this) { *var_s0 = sp50.x; var_s0++; } - } else if (play->msgCtx.ocarinaMode == 1) { - if (play->msgCtx.unk12048 != 0xFF) { - var_s0[play->msgCtx.unk12048] = 1.2f; + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE) { + if (play->msgCtx.ocarinaButtonIndex != OCARINA_BTN_INVALID) { + var_s0[play->msgCtx.ocarinaButtonIndex] = 1.2f; func_8082DB90(play, this, D_8085D190[this->transformation]); } else { s32 i; @@ -16265,11 +16682,11 @@ struct_8085D714 D_8085D714[] = { }; void func_80851EC8(PlayState* play, Player* this) { - struct_8085D714* temp3 = &D_8085D714[play->msgCtx.unk12048]; - f32* temp2 = &this->unk_B10[play->msgCtx.unk12048]; + struct_8085D714* temp3 = &D_8085D714[play->msgCtx.ocarinaButtonIndex]; + f32* temp2 = &this->unk_B10[play->msgCtx.ocarinaButtonIndex]; s16* temp_a3 = &this->unk_B86[temp3->unk_0]; - temp_a3[0] = play->msgCtx.unk12048; + temp_a3[0] = play->msgCtx.ocarinaButtonIndex; temp2[0] = 3.0f; } @@ -16324,8 +16741,8 @@ void func_808521E0(PlayState* play, Player* this) { } func_80124618(D_801C0490, this->skelAnime.curFrame, &this->unk_AF0[1]); - } else if (play->msgCtx.ocarinaMode == 1) { - if (play->msgCtx.unk12048 != 0xFF) { + } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE) { + if (play->msgCtx.ocarinaButtonIndex != OCARINA_BTN_INVALID) { func_80851EC8(play, this); } @@ -16346,7 +16763,8 @@ void func_80852290(PlayState* play, Player* this) { s16 var_a1_3; s16 sp38; - if ((play->msgCtx.ocarinaMode == 1) && (play->msgCtx.unk12048 != 0xFF)) { + if ((play->msgCtx.ocarinaMode == OCARINA_MODE_ACTIVE) && + (play->msgCtx.ocarinaButtonIndex != OCARINA_BTN_INVALID)) { if ((this->unk_A90 != NULL) && (this->unk_A94 < 0.0f)) { this->unk_A90->flags |= ACTOR_FLAG_20000000; this->unk_A94 = 0.0f; @@ -16357,7 +16775,7 @@ void func_80852290(PlayState* play, Player* this) { } sPlayerControlInput = play->state.input; - func_800FF3A0(&sp3C, &sp38, sPlayerControlInput); + Lib_GetControlStickData(&sp3C, &sp38, sPlayerControlInput); if (BINANG_ADD(sp38, 0x4000) < 0) { sp38 -= 0x8000; @@ -16407,7 +16825,7 @@ void func_8085255C(PlayState* play, Player* this) { } void func_808525C4(PlayState* play, Player* this) { - if (this->unk_AE8++ >= 3) { + if (this->actionVar2++ >= 3) { if ((this->transformation == PLAYER_FORM_ZORA) || (this->transformation == PLAYER_FORM_DEKU)) { func_8082E5A8(play, this, D_8085D190[this->transformation]); } else if (this->transformation == PLAYER_FORM_GORON) { @@ -16421,16 +16839,16 @@ void func_808525C4(PlayState* play, Player* this) { } } -void func_8085269C(Player* this, PlayState* play) { +void Player_Action_63(Player* this, PlayState* play) { if ((this->unk_AA5 != PLAYER_UNKAA5_4) && ((PlayerAnimation_Update(play, &this->skelAnime) && (this->skelAnime.animation == D_8085D17C[this->transformation])) || - ((this->skelAnime.mode == 0) && (this->unk_AE8 == 0)))) { + ((this->skelAnime.mode == 0) && (this->actionVar2 == 0)))) { func_808525C4(play, this); if (!(this->actor.flags & ACTOR_FLAG_20000000) || (this->unk_A90->id == ACTOR_EN_ZOT)) { - func_80152434(play, 1); + Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY); } - } else if (this->unk_AE8 != 0) { - if (play->msgCtx.ocarinaMode == 4) { + } else if (this->actionVar2 != 0) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) { play->interfaceCtx.unk_222 = 0; CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]); this->actor.flags &= ~ACTOR_FLAG_20000000; @@ -16441,17 +16859,20 @@ void func_8085269C(Player* this, PlayState* play) { this->talkActor = this->tatlActor; this->tatlActor->textId = -this->tatlTextId; Player_TalkWithPlayer(play, this->talkActor); - } else if (!func_80838A90(this, play)) { + } else if (!Player_ActionChange_13(this, play)) { func_80836A5C(this, play); Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]); } } else { - s32 var_v1 = (play->msgCtx.ocarinaMode >= 0x1C) && (play->msgCtx.ocarinaMode < 0x27); + s32 var_v1 = (play->msgCtx.ocarinaMode >= OCARINA_MODE_WARP_TO_GREAT_BAY_COAST) && + (play->msgCtx.ocarinaMode <= OCARINA_MODE_WARP_TO_ENTRANCE); s32 pad[2]; - if (var_v1 || (play->msgCtx.ocarinaMode == 0x16) || (play->msgCtx.ocarinaMode == 0x1A) || - (play->msgCtx.ocarinaMode == 0x18) || (play->msgCtx.ocarinaMode == 0x19)) { - if (play->msgCtx.ocarinaMode == 0x16) { + if (var_v1 || (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_SOT) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_DOUBLE_SOT) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_INV_SOT_FAST) || + (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_INV_SOT_SLOW)) { + if (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_SOT) { if (!func_8082DA90(play)) { if (gSaveContext.save.saveInfo.playerData.threeDayResetCount == 1) { play->nextEntrance = ENTRANCE(CUTSCENE, 1); @@ -16474,7 +16895,7 @@ void func_8085269C(Player* this, PlayState* play) { 0, play->msgCtx.ocarinaMode); if (actor != NULL) { this->stateFlags1 &= ~PLAYER_STATE1_20000000; - this->csMode = PLAYER_CSMODE_0; + this->csMode = PLAYER_CSMODE_NONE; func_8085B28C(play, NULL, PLAYER_CSMODE_19); this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000; } else { @@ -16482,12 +16903,13 @@ void func_8085269C(Player* this, PlayState* play) { Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]); } } - } else if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_ELEGY)) { + } else if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) && + (play->msgCtx.lastPlayedSong == OCARINA_SONG_ELEGY)) { play->interfaceCtx.unk_222 = 0; CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]); this->actor.flags &= ~ACTOR_FLAG_20000000; - func_80831760(play, this, func_80855A7C, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_88, 0); this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000; } else if (this->unk_AA5 == PLAYER_UNKAA5_4) { f32 temp_fa0 = this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].x; @@ -16509,7 +16931,7 @@ void func_8085269C(Player* this, PlayState* play) { } } -void func_80852B28(Player* this, PlayState* play) { +void Player_Action_64(Player* this, PlayState* play) { func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -16519,7 +16941,7 @@ void func_80852B28(Player* this, PlayState* play) { this->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].y, this->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].z, 0xFA0, this->actor.shape.rot.y, 0, ARROW_TYPE_DEKU_NUT) != NULL) { - Inventory_ChangeAmmo(ITEM_NUT, -1); + Inventory_ChangeAmmo(ITEM_DEKU_NUT, -1); this->unk_D57 = 4; } @@ -16541,16 +16963,16 @@ AnimSfxEntry D_8085D74C[] = { ANIMSFX(ANIMSFX_TYPE_FLOOR_LAND, 120, NA_SE_NONE, STOP), }; -void func_80852C04(Player* this, PlayState* play) { +void Player_Action_65(Player* this, PlayState* play) { func_8083249C(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8 != 0) { - if (this->unk_AE8 > 1) { - this->unk_AE8--; + if (this->actionVar2 != 0) { + if (this->actionVar2 > 1) { + this->actionVar2--; } - if (func_808482E0(play, this) && (this->unk_AE8 == 1)) { + if (func_808482E0(play, this) && (this->actionVar2 == 1)) { Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); if ((this->getItemDrawIdPlusOne == GID_REMAINS_ODOLWA + 1) || @@ -16562,14 +16984,14 @@ void func_80852C04(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_20000000; func_8085B28C(play, NULL, PLAYER_CSMODE_93); } else { - s32 var_a2 = ((this->talkActor != NULL) && (this->exchangeItemId <= PLAYER_IA_MINUS1)) || + s32 var_a2 = ((this->talkActor != NULL) && (this->exchangeItemAction <= PLAYER_IA_MINUS1)) || (this->stateFlags3 & PLAYER_STATE3_20); if (var_a2 || (gSaveContext.healthAccumulator == 0)) { Player_StopCutscene(this); if (var_a2) { func_80848250(play, this); - this->exchangeItemId = PLAYER_IA_NONE; + this->exchangeItemAction = PLAYER_IA_NONE; if (!func_80847994(play, this)) { Player_TalkWithPlayer(play, this->talkActor); } @@ -16608,10 +17030,10 @@ void func_80852C04(Player* this, PlayState* play) { ANIM_FLAG_80); Player_StopCutscene(this); this->csId = play->playerCsIds[PLAYER_CS_ID_ITEM_GET]; - this->unk_AE8 = 2; + this->actionVar2 = 2; } } - } else if (this->unk_AE8 == 0) { + } else if (this->actionVar2 == 0) { if (this->transformation == PLAYER_FORM_HUMAN) { Player_PlayAnimSfx(this, D_8085D73C); } else if (this->transformation == PLAYER_FORM_DEKU) { @@ -16620,8 +17042,8 @@ void func_80852C04(Player* this, PlayState* play) { } else { if ((this->skelAnime.animation == &gPlayerAnim_link_demo_get_itemB) || (this->skelAnime.animation == &gPlayerAnim_pn_getB)) { - Math_ScaledStepToS(&this->actor.shape.rot.y, - BINANG_ADD(Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]), 0x8000), 0xFA0); + Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)), 0x8000), + 0xFA0); } else if ((this->skelAnime.animation == &gPlayerAnim_pn_getA) && PlayerAnimation_OnFrame(&this->skelAnime, 10.0f)) { Player_AnimSfx_PlayFloorLand(this); @@ -16638,11 +17060,11 @@ AnimSfxEntry D_8085D75C[] = { ANIMSFX(ANIMSFX_TYPE_FLOOR_LAND, 15, NA_SE_NONE, STOP), }; -void func_80852FD4(Player* this, PlayState* play) { +void Player_Action_66(Player* this, PlayState* play) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE7 == 0) { - if (DECR(this->unk_AE8) == 0) { - this->unk_AE7 = 1; + if (this->actionVar1 == 0) { + if (DECR(this->actionVar2) == 0) { + this->actionVar1 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -16685,11 +17107,11 @@ u8 D_8085D790[] = { 1 | 2, // PLAYER_IA_BOTTLE_CHATEAU }; -void func_80853194(Player* this, PlayState* play) { +void Player_Action_67(Player* this, PlayState* play) { func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_ITEM_BOTTLE]); if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if (this->itemAction == PLAYER_IA_BOTTLE_POE) { s32 health = Rand_S16Offset(-1, 3); @@ -16728,31 +17150,31 @@ void func_80853194(Player* this, PlayState* play) { func_8082DB60(play, this, (this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_drink : &gPlayerAnim_link_bottle_drink_demo_wait); - this->unk_AE8 = 1; + this->actionVar2 = 1; //! FAKE dummy_label_235515:; - } else if (this->unk_AE8 < 0) { - this->unk_AE8++; - if (this->unk_AE8 == 0) { - this->unk_AE8 = 3; + } else if (this->actionVar2 < 0) { + this->actionVar2++; + if (this->actionVar2 == 0) { + this->actionVar2 = 3; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; - } else if (this->unk_AE8 == -6) { + } else if (this->actionVar2 == -6) { func_808530E0(play, this); } } else { Player_StopCutscene(this); func_80839E74(this, play); } - } else if (this->unk_AE8 == 1) { + } else if (this->actionVar2 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { if (this->transformation == PLAYER_FORM_DEKU) { PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_pn_drinkend, 2.0f / 3.0f, 0.0f, 5.0f, 2, -6.0f); - this->unk_AE8 = -7; + this->actionVar2 = -7; } else { func_8082E4A4(play, this, &gPlayerAnim_link_bottle_drink_demo_end); - this->unk_AE8 = 2; + this->actionVar2 = 2; } Player_UpdateBottleHeld(play, this, @@ -16761,51 +17183,53 @@ void func_80853194(Player* this, PlayState* play) { } Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_DRINK - SFX_FLAG); - } else if ((this->unk_AE8 == 2) && PlayerAnimation_OnFrame(&this->skelAnime, 29.0f)) { + } else if ((this->actionVar2 == 2) && PlayerAnimation_OnFrame(&this->skelAnime, 29.0f)) { Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_BREATH_DRINK); } } +#define BOTTLE_CATCH_PARAMS_ANY -1 + struct_8085D798 D_8085D798[] = { - { ACTOR_EN_ELF, 2, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, - { ACTOR_EN_FISH, -1, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x62 }, - { ACTOR_EN_INSECT, -1, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, - { ACTOR_EN_MUSHI2, -1, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, - { ACTOR_EN_TEST5, 0, ITEM_SPRING_WATER, PLAYER_IA_BOTTLE_SPRING_WATER, 0x67 }, - { ACTOR_EN_TEST5, 1, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, - { ACTOR_BG_GORON_OYU, -1, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, - { ACTOR_EN_ZORAEGG, -1, ITEM_ZORA_EGG, PLAYER_IA_BOTTLE_ZORA_EGG, 0x69 }, - { ACTOR_EN_DNP, -1, ITEM_DEKU_PRINCESS, PLAYER_IA_BOTTLE_DEKU_PRINCESS, 0x5F }, - { ACTOR_EN_OT, -1, ITEM_SEAHORSE, PLAYER_IA_BOTTLE_SEAHORSE, 0x6E }, - { ACTOR_OBJ_KINOKO, -1, ITEM_MUSHROOM, PLAYER_IA_BOTTLE_SEAHORSE, 0x6B }, - { ACTOR_EN_POH, -1, ITEM_POE, PLAYER_IA_BOTTLE_POE, 0x65 }, - { ACTOR_EN_BIGPO, -1, ITEM_BIG_POE, PLAYER_IA_BOTTLE_BIG_POE, 0x66 }, - { ACTOR_EN_ELF, 6, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, + { ACTOR_EN_ELF, FAIRY_PARAMS(FAIRY_TYPE_2, false, 0), ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, + { ACTOR_EN_FISH, BOTTLE_CATCH_PARAMS_ANY, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x62 }, + { ACTOR_EN_INSECT, BOTTLE_CATCH_PARAMS_ANY, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, + { ACTOR_EN_MUSHI2, BOTTLE_CATCH_PARAMS_ANY, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x63 }, + { ACTOR_EN_TEST5, ENTEST5_PARAMS(false), ITEM_SPRING_WATER, PLAYER_IA_BOTTLE_SPRING_WATER, 0x67 }, + { ACTOR_EN_TEST5, ENTEST5_PARAMS(true), ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, + { ACTOR_BG_GORON_OYU, BOTTLE_CATCH_PARAMS_ANY, ITEM_HOT_SPRING_WATER, PLAYER_IA_BOTTLE_HOT_SPRING_WATER, 0x68 }, + { ACTOR_EN_ZORAEGG, BOTTLE_CATCH_PARAMS_ANY, ITEM_ZORA_EGG, PLAYER_IA_BOTTLE_ZORA_EGG, 0x69 }, + { ACTOR_EN_DNP, BOTTLE_CATCH_PARAMS_ANY, ITEM_DEKU_PRINCESS, PLAYER_IA_BOTTLE_DEKU_PRINCESS, 0x5F }, + { ACTOR_EN_OT, BOTTLE_CATCH_PARAMS_ANY, ITEM_SEAHORSE, PLAYER_IA_BOTTLE_SEAHORSE, 0x6E }, + { ACTOR_OBJ_KINOKO, BOTTLE_CATCH_PARAMS_ANY, ITEM_MUSHROOM, PLAYER_IA_BOTTLE_SEAHORSE, 0x6B }, + { ACTOR_EN_POH, BOTTLE_CATCH_PARAMS_ANY, ITEM_POE, PLAYER_IA_BOTTLE_POE, 0x65 }, + { ACTOR_EN_BIGPO, BOTTLE_CATCH_PARAMS_ANY, ITEM_BIG_POE, PLAYER_IA_BOTTLE_BIG_POE, 0x66 }, + { ACTOR_EN_ELF, FAIRY_PARAMS(FAIRY_TYPE_6, false, 0), ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x5E }, }; -void func_808534C0(Player* this, PlayState* play) { - struct_8085D200* sp24 = &D_8085D200[this->unk_AE8]; +void Player_Action_68(Player* this, PlayState* play) { + struct_8085D200* sp24 = &D_8085D200[this->actionVar2]; func_80832F24(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_ITEM_SHOW]); - if (this->unk_AE8 == 0) { - Message_StartTextbox(play, D_8085D798[this->unk_AE7 - 1].textId, &this->actor); + if (this->actionVar2 == 0) { + Message_StartTextbox(play, D_8085D798[this->actionVar1 - 1].textId, &this->actor); Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); - this->unk_AE8 = 1; + this->actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { Actor* talkActor; - this->unk_AE7 = 0; + this->actionVar1 = 0; Player_StopCutscene(this); func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); talkActor = this->talkActor; - if ((talkActor != NULL) && (this->exchangeItemId <= PLAYER_IA_MINUS1)) { + if ((talkActor != NULL) && (this->exchangeItemAction <= PLAYER_IA_MINUS1)) { Player_TalkWithPlayer(play, talkActor); } } @@ -16813,15 +17237,15 @@ void func_808534C0(Player* this, PlayState* play) { func_80839E74(this, play); } } else { - if (this->unk_AE7 == 0) { + if (this->actionVar1 == 0) { s32 temp_ft5 = this->skelAnime.curFrame - sp24->unk_8; if ((temp_ft5 >= 0) && (sp24->unk_9 >= temp_ft5)) { - if ((this->unk_AE8 != 0) && (temp_ft5 == 0)) { + if ((this->actionVar2 != 0) && (temp_ft5 == 0)) { Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER); } - if (func_8012364C(play, this, this->heldItemButton) == ITEM_BOTTLE) { + if (Player_GetItemOnButton(play, this, this->heldItemButton) == ITEM_BOTTLE) { Actor* interactRangeActor = this->interactRangeActor; if (interactRangeActor != NULL) { @@ -16830,15 +17254,16 @@ void func_808534C0(Player* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(D_8085D798); i++) { if (((interactRangeActor->id == entry->actorId) && - ((entry->actorParams < 0) || (interactRangeActor->params == entry->actorParams)))) { + ((entry->actorParams <= BOTTLE_CATCH_PARAMS_ANY) || + (interactRangeActor->params == entry->actorParams)))) { break; } entry++; } if (i < ARRAY_COUNT(D_8085D798)) { - this->unk_AE7 = i + 1; - this->unk_AE8 = 0; + this->actionVar1 = i + 1; + this->actionVar2 = 0; this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000; interactRangeActor->parent = &this->actor; Player_UpdateBottleHeld(play, this, entry->itemId, entry->itemAction); @@ -16857,28 +17282,28 @@ void func_808534C0(Player* this, PlayState* play) { Vec3f D_8085D7EC = { 0.0f, 0.0f, 5.0f }; -void func_80853754(Player* this, PlayState* play) { +void Player_Action_69(Player* this, PlayState* play) { func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_ITEM_BOTTLE]); if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_StopCutscene(this); func_80839E74(this, play); } else if (PlayerAnimation_OnFrame(&this->skelAnime, 37.0f)) { - s32 sp2C = 8; + s32 fairyParams = FAIRY_PARAMS(FAIRY_TYPE_8, false, 0); Player_PlaySfx(this, NA_SE_EV_BOTTLE_CAP_OPEN); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_AUTO_JUMP); if (this->itemAction == PLAYER_IA_BOTTLE_FAIRY) { Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); - sp2C = 1; + fairyParams = FAIRY_PARAMS(FAIRY_TYPE_1, false, 0); } - Player_SpawnFairy(play, this, &this->leftHandWorld.pos, &D_8085D7EC, sp2C); + Player_SpawnFairy(play, this, &this->leftHandWorld.pos, &D_8085D7EC, fairyParams); } } -void func_80853850(Player* this, PlayState* play) { +void Player_Action_70(Player* this, PlayState* play) { static Vec3f D_8085D7F8 = { 10.0f, 268 * 0.1f, 30.0f }; static s8 D_8085D804[PLAYER_FORM_MAX] = { 0x2D, // PLAYER_FORM_FIERCE_DEITY @@ -16888,17 +17313,17 @@ void func_80853850(Player* this, PlayState* play) { 0x28, // PLAYER_FORM_HUMAN }; static struct_8085D80C D_8085D80C[] = { - { ACTOR_EN_FISH, 0 }, // PLAYER_BOTTLE_FISH - { ACTOR_OBJ_AQUA, 0 }, // PLAYER_BOTTLE_SPRING_WATER - { ACTOR_OBJ_AQUA, 1 }, // PLAYER_BOTTLE_HOT_SPRING_WATER - { ACTOR_EN_ZORAEGG, 0x11 }, // PLAYER_BOTTLE_ZORA_EGG - { ACTOR_EN_DNP, 1 }, // PLAYER_BOTTLE_DEKU_PRINCESS - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_GOLD_DUST - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_1C - { ACTOR_EN_OT, 0x8000 }, // PLAYER_BOTTLE_SEAHORSE - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_MUSHROOM - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_HYLIAN_LOACH - { ACTOR_EN_MUSHI2, 0 }, // PLAYER_BOTTLE_BUG + { ACTOR_EN_FISH, FISH_PARAMS(ENFISH_0) }, // PLAYER_BOTTLE_FISH + { ACTOR_OBJ_AQUA, AQUA_PARAMS(AQUA_TYPE_COLD) }, // PLAYER_BOTTLE_SPRING_WATER + { ACTOR_OBJ_AQUA, AQUA_PARAMS(AQUA_TYPE_HOT) }, // PLAYER_BOTTLE_HOT_SPRING_WATER + { ACTOR_EN_ZORAEGG, ZORA_EGG_PARAMS(ZORA_EGG_TYPE_11, 0) }, // PLAYER_BOTTLE_ZORA_EGG + { ACTOR_EN_DNP, DEKU_PRINCESS_PARAMS(DEKU_PRINCESS_TYPE_RELEASED_FROM_BOTTLE) }, // PLAYER_BOTTLE_DEKU_PRINCESS + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_GOLD_DUST + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_1C + { ACTOR_EN_OT, SEAHORSE_PARAMS(SEAHORSE_TYPE_2, 0, 0) }, // PLAYER_BOTTLE_SEAHORSE + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_MUSHROOM + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_HYLIAN_LOACH + { ACTOR_EN_MUSHI2, ENMUSHI2_PARAMS(ENMUSHI2_0) }, // PLAYER_BOTTLE_BUG }; static AnimSfxEntry D_8085D838[] = { ANIMSFX(ANIMSFX_TYPE_VOICE, 38, NA_SE_VO_LI_AUTO_JUMP, CONTINUE), @@ -16914,7 +17339,7 @@ void func_80853850(Player* this, PlayState* play) { struct_8085D80C* sp4C; D_8085D7F8.z = D_8085D804[this->transformation]; - if (func_80835D58(play, this, &D_8085D7F8, &sp6C, &sp68, &sp5C)) { + if (Player_PosVsWallLineTest(play, this, &D_8085D7F8, &sp6C, &sp68, &sp5C)) { temp_fv1 = this->actor.world.pos.x - sp5C.x; temp_fa0 = this->actor.world.pos.z - sp5C.z; temp_fv0 = sqrtf(SQ(temp_fv1) + SQ(temp_fa0)); @@ -16922,8 +17347,8 @@ void func_80853850(Player* this, PlayState* play) { if (temp_fv0 != 0.0f) { temp_fv0 = 3.0f / temp_fv0; - this->actor.world.pos.x = this->actor.world.pos.x + (temp_fv1 * temp_fv0); - this->actor.world.pos.z = this->actor.world.pos.z + (temp_fa0 * temp_fv0); + this->actor.world.pos.x += temp_fv1 * temp_fv0; + this->actor.world.pos.z += temp_fa0 * temp_fv0; } } @@ -16932,7 +17357,7 @@ void func_80853850(Player* this, PlayState* play) { if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_StopCutscene(this); - if (!func_80838A90(this, play)) { + if (!Player_ActionChange_13(this, play)) { func_80839E74(this, play); } } else if (PlayerAnimation_OnFrame(&this->skelAnime, 76.0f)) { @@ -16952,14 +17377,14 @@ AnimSfxEntry D_8085D840[] = { ANIMSFX(ANIMSFX_TYPE_GENERAL, 30, NA_SE_PL_PUT_OUT_ITEM, STOP), }; -void func_80853A5C(Player* this, PlayState* play) { +void Player_Action_71(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; this->stateFlags3 |= PLAYER_STATE3_4000000; func_8083249C(this); if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->exchangeItemId == PLAYER_IA_NONE) { + if (this->exchangeItemAction == PLAYER_IA_NONE) { Actor* talkActor = this->talkActor; Player_StopCutscene(this); @@ -16970,18 +17395,18 @@ void func_80853A5C(Player* this, PlayState* play) { } Player_TalkWithPlayer(play, talkActor); } else { - GetItemEntry* giEntry = &sGetItemTable[D_8085D1A4[this->exchangeItemId] - 1]; + GetItemEntry* giEntry = &sGetItemTable[D_8085D1A4[this->exchangeItemAction] - 1]; if (Player_BottleFromIA(this, this->itemAction) <= PLAYER_BOTTLE_NONE) { this->getItemDrawIdPlusOne = ABS_ALT(giEntry->gid); } - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if ((this->actor.textId != 0) && (this->actor.textId != 0xFFFF)) { Message_StartTextbox(play, this->actor.textId, &this->actor); } - this->unk_AE8 = 1; + this->actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { Player_StopCutscene(this); this->getItemDrawIdPlusOne = GID_NONE + 1; @@ -16990,7 +17415,7 @@ void func_80853A5C(Player* this, PlayState* play) { this->unk_B5E = 0xA; } } - } else if (this->unk_AE8 >= 0) { + } else if (this->actionVar2 >= 0) { if ((Player_BottleFromIA(this, this->itemAction) > PLAYER_BOTTLE_NONE) && PlayerAnimation_OnFrame(&this->skelAnime, 36.0f)) { Player_SetModels(this, PLAYER_MODELGROUP_BOTTLE); @@ -17002,13 +17427,13 @@ void func_80853A5C(Player* this, PlayState* play) { Player_PlayAnimSfx(this, D_8085D840); } - if ((this->unk_AE7 == 0) && (this->targetedActor != NULL)) { + if ((this->actionVar1 == 0) && (this->lockOnActor != NULL)) { this->currentYaw = func_8083C62C(this, 0); this->actor.shape.rot.y = this->currentYaw; } } -void func_80853CC0(Player* this, PlayState* play) { +void Player_Action_72(Player* this, PlayState* play) { this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40); if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -17025,7 +17450,7 @@ void func_80853CC0(Player* this, PlayState* play) { } } -void func_80853D68(Player* this, PlayState* play) { +void Player_Action_73(Player* this, PlayState* play) { CollisionPoly* floorPoly; f32 var_fv0; f32 temp_fv1; @@ -17037,14 +17462,14 @@ void func_80853D68(Player* this, PlayState* play) { this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40); PlayerAnimation_Update(play, &this->skelAnime); func_8083FBC4(play, this); - func_8019F780(&this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), - this->actor.speed); + Audio_PlaySfx_AtPosWithSyncedFreqAndVolume( + &this->actor.projectedPos, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG), this->actor.speed); - if (func_80838A90(this, play)) { + if (Player_ActionChange_13(this, play)) { return; } - if ((this->transformation == PLAYER_FORM_GORON) && func_8083A114(this, play)) { + if ((this->transformation == PLAYER_FORM_GORON) && Player_ActionChange_6(this, play)) { return; } @@ -17056,7 +17481,7 @@ void func_80853D68(Player* this, PlayState* play) { Actor_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); var_v0 = downwardSlopeYaw; - if (this->unk_AE7 != 0) { + if (this->actionVar1 != 0) { var_v0 = downwardSlopeYaw + 0x8000; } if (this->linearVelocity < 0.0f) { @@ -17076,8 +17501,8 @@ void func_80853D68(Player* this, PlayState* play) { if (Math_AsymStepToF(&this->linearVelocity, var_fv0, temp_fv1, var_fa0) && (var_fv0 == 0.0f)) { func_80836A98(this, - (this->unk_AE7 == 0) ? D_8085BE84[PLAYER_ANIMGROUP_41][this->modelAnimType] - : D_8085BE84[PLAYER_ANIMGROUP_42][this->modelAnimType], + (this->actionVar1 == 0) ? D_8085BE84[PLAYER_ANIMGROUP_41][this->modelAnimType] + : D_8085BE84[PLAYER_ANIMGROUP_42][this->modelAnimType], play); } @@ -17087,30 +17512,30 @@ void func_80853D68(Player* this, PlayState* play) { void func_80859CE0(PlayState* play, Player* this, s32 arg2); -void func_80854010(Player* this, PlayState* play) { - if ((DECR(this->unk_AE8) == 0) && func_808387A0(play, this)) { +void Player_Action_74(Player* this, PlayState* play) { + if ((DECR(this->actionVar2) == 0) && func_808387A0(play, this)) { func_80859CE0(play, this, 0); - Player_SetAction(play, this, func_8085B08C, 0); - func_8085B08C(this, play); + Player_SetAction(play, this, Player_Action_97, 0); + Player_Action_97(this, play); } } -void func_808540A0(Player* this, PlayState* play) { - Player_SetAction(play, this, func_80854010, 0); - this->unk_AE8 = 0x28; +void Player_Action_75(Player* this, PlayState* play) { + Player_SetAction(play, this, Player_Action_74, 0); + this->actionVar2 = 0x28; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10); } -void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* playerAction); +void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* cue); -void func_80854118(Player* this, PlayState* play) { - if (D_80862B18 < 150.0f) { +void Player_Action_76(Player* this, PlayState* play) { + if (sPlayerYDistToFloor < 150.0f) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; Player_AnimSfx_PlayFloorLand(this); - this->unk_AE8 = 1; + this->actionVar2 = 1; } } else { func_8085B384(this, play); @@ -17131,7 +17556,7 @@ void func_80854118(Player* this, PlayState* play) { } } -void func_8085421C(Player* this, PlayState* play) { +void Player_Action_77(Player* this, PlayState* play) { if (this->skelAnime.animation == NULL) { this->stateFlags2 |= PLAYER_STATE2_4000; } else { @@ -17143,9 +17568,9 @@ void func_8085421C(Player* this, PlayState* play) { } } - if ((this->unk_AE8++ >= 9) && !func_8082DA90(play)) { - if (this->unk_AE7 != 0) { - if (this->unk_AE7 < 0) { + if ((this->actionVar2++ >= 9) && !func_8082DA90(play)) { + if (this->actionVar1 != 0) { + if (this->actionVar1 < 0) { func_80169FDC(&play->state); } else { func_80169EFC(&play->state); @@ -17155,7 +17580,7 @@ void func_8085421C(Player* this, PlayState* play) { } play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - play_sound(NA_SE_OC_ABYSS); + Audio_PlaySfx(NA_SE_OC_ABYSS); } else { play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; @@ -17167,11 +17592,11 @@ void func_8085421C(Player* this, PlayState* play) { } } -void func_8085437C(Player* this, PlayState* play) { - func_808365DC(this, play); +void Player_Action_78(Player* this, PlayState* play) { + Player_ActionChange_1(this, play); } -void func_8085439C(Player* this, PlayState* play) { +void Player_Action_79(Player* this, PlayState* play) { this->actor.gravity = -1.0f; PlayerAnimation_Update(play, &this->skelAnime); @@ -17182,16 +17607,16 @@ void func_8085439C(Player* this, PlayState* play) { } } -void func_80854430(Player* this, PlayState* play) { +void Player_Action_80(Player* this, PlayState* play) { if (play->unk_1887C < 0) { play->unk_1887C = 0; func_80839ED0(this, play); - } else if (this->unk_AE7 == 0) { + } else if (this->actionVar1 == 0) { if ((play->sceneId != SCENE_20SICHITAI) && CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_B)) { play->unk_1887C = 10; func_80847880(play, this); - Player_SetAction(play, this, func_80854430, 1); - this->unk_AE7 = 1; + Player_SetAction(play, this, Player_Action_80, 1); + this->actionVar1 = 1; } else { play->unk_1887C = 0; func_80847190(play, this, 0); @@ -17202,7 +17627,7 @@ void func_80854430(Player* this, PlayState* play) { } else { this->stateFlags1 &= ~PLAYER_STATE1_100000; if ((play->sceneId == SCENE_20SICHITAI) && - (func_8012364C(play, this, func_8082FDC4()) == ITEM_PICTO_BOX)) { + (Player_GetItemOnButton(play, this, func_8082FDC4()) == ITEM_PICTOGRAPH_BOX)) { s32 requiredScopeTemp; play->actorCtx.flags |= ACTORCTX_FLAG_PICTO_BOX_ON; @@ -17212,20 +17637,20 @@ void func_80854430(Player* this, PlayState* play) { } else if (CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_R | BTN_A)) { play->unk_1887C = -1; - func_80854614(this, play); - Player_SetAction(play, this, func_80854430, 0); - this->unk_AE7 = 0; + Player_Action_81(this, play); + Player_SetAction(play, this, Player_Action_80, 0); + this->actionVar1 = 0; } else { play->unk_1887C = 10; - func_80854614(this, play); + Player_Action_81(this, play); } } -void func_80854614(Player* this, PlayState* play) { +void Player_Action_81(Player* this, PlayState* play) { this->unk_AA5 = PLAYER_UNKAA5_3; func_8083868C(play, this); PlayerAnimation_Update(play, &this->skelAnime); - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); this->upperLimbRot.y = func_80847190(play, this, 1) - this->actor.shape.rot.y; this->unk_AA6 |= 0x80; @@ -17237,14 +17662,14 @@ void func_80854614(Player* this, PlayState* play) { } } -void func_808546D0(Player* this, PlayState* play) { - if (this->unk_AE7 >= 0) { - if (this->unk_AE7 < 6) { - this->unk_AE7++; +void Player_Action_82(Player* this, PlayState* play) { + if (this->actionVar1 >= 0) { + if (this->actionVar1 < 6) { + this->actionVar1++; } else { - this->unk_B48 = (this->unk_AE7 >> 1) * 22.0f; + this->unk_B48 = (this->actionVar1 >> 1) * 22.0f; if (func_8082DE88(this, 1, 0x64)) { - this->unk_AE7 = -1; + this->actionVar1 = -1; EffectSsIcePiece_SpawnBurst(play, &this->actor.world.pos, this->actor.scale.x); Player_PlaySfx(this, NA_SE_PL_ICE_BROKEN); } @@ -17252,8 +17677,8 @@ void func_808546D0(Player* this, PlayState* play) { if (this->transformation == PLAYER_FORM_ZORA) { func_80834104(play, this); this->skelAnime.animation = NULL; - this->unk_AE8 = -0x28; - this->unk_AE7 = 1; + this->actionVar2 = -0x28; + this->actionVar1 = 1; this->linearVelocity = 0.0f; } else if (play->gameplayFrames % 4 == 0) { Player_InflictDamage(play, -1); @@ -17267,21 +17692,22 @@ void func_808546D0(Player* this, PlayState* play) { } } -void func_80854800(Player* this, PlayState* play) { +void Player_Action_83(Player* this, PlayState* play) { PlayerAnimation_Update(play, &this->skelAnime); func_808345A8(this); - if (((this->unk_AE8 % 25) != 0) || (func_808339D4(play, this, -1) != 0)) { - if (DECR(this->unk_AE8) == 0) { + if (((this->actionVar2 % 25) != 0) || (func_808339D4(play, this, -1) != 0)) { + if (DECR(this->actionVar2) == 0) { func_80836988(this, play); } } this->shockTimer = 40; - func_800B8F98(&this->actor, this->ageProperties->voiceSfxIdOffset + (NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG)); + Actor_PlaySfx_FlaggedCentered1(&this->actor, + this->ageProperties->voiceSfxIdOffset + (NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG)); } -void func_808548B8(Player* this, PlayState* play) { +void Player_Action_84(Player* this, PlayState* play) { AttackAnimInfo* attackInfoEntry = &sMeleeAttackAnimInfo[this->meleeWeaponAnimation]; if (this->skelAnime.curFrame < (this->skelAnime.endFrame - 6.0f)) { @@ -17321,9 +17747,9 @@ void func_808548B8(Player* this, PlayState* play) { ((this->meleeWeaponAnimation >= PLAYER_MWA_FLIPSLASH_FINISH) && (this->meleeWeaponAnimation <= PLAYER_MWA_ZORA_JUMPKICK_FINISH) && (this->skelAnime.curFrame > 2.0f) && func_808333CC(this))) { - D_80862B48 = this->unk_AE8; + sPlayerUseHeldItem = this->actionVar2; - if (!func_80848570(this, play)) { + if (!Player_ActionChange_7(this, play)) { PlayerAnimationHeader* anim = func_80123420(this) ? attackInfoEntry->unk_8 : attackInfoEntry->unk_4; func_8082DC38(this); @@ -17335,8 +17761,8 @@ void func_808548B8(Player* this, PlayState* play) { u8 moveFlags = this->skelAnime.moveFlags; if (this->transformation == PLAYER_FORM_ZORA) { - if (func_8083A580(this, play)) { - anim = this->unk_284.animation; + if (Player_ActionChange_8(this, play)) { + anim = this->skelAnimeUpper.animation; } this->unk_ADC = 0; } else if ((anim == &gPlayerAnim_link_fighter_Lpower_jump_kiru_end) && @@ -17345,7 +17771,7 @@ void func_808548B8(Player* this, PlayState* play) { } this->skelAnime.moveFlags = 0; - Player_SetAction(play, this, func_80849FE0, 1); + Player_SetAction(play, this, Player_Action_4, 1); func_8082EC9C(play, this, anim); this->currentYaw = this->actor.shape.rot.y; this->skelAnime.moveFlags = moveFlags; @@ -17357,11 +17783,11 @@ void func_808548B8(Player* this, PlayState* play) { (this->meleeWeaponAnimation != PLAYER_MWA_ZORA_JUMPKICK_FINISH)) || ((this->transformation == PLAYER_FORM_GORON) && (this->meleeWeaponAnimation != PLAYER_MWA_GORON_PUNCH_BUTT))) { - this->unk_AE8 |= CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_B) ? 1 : 0; + this->actionVar2 |= CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_B) ? 1 : 0; } } -void func_80854C70(Player* this, PlayState* play) { +void Player_Action_85(Player* this, PlayState* play) { PlayerAnimation_Update(play, &this->skelAnime); func_80832F24(this); @@ -17413,14 +17839,14 @@ void func_80854EFC(PlayState* play, f32 arg1, struct_8085D848_unk_00* arg2) { u8* new_var; s32 pad[4]; - new_var = play->envCtx.unk_C4.diffuseColor1; - sp70.fogNear = play->envCtx.unk_C4.fogNear; - sp70.fogColor[0] = play->envCtx.unk_C4.fogColor[0]; - sp70.fogColor[1] = play->envCtx.unk_C4.fogColor[1]; - sp70.fogColor[2] = play->envCtx.unk_C4.fogColor[2]; - sp70.ambientColor[0] = play->envCtx.unk_C4.ambientColor[0]; - sp70.ambientColor[1] = play->envCtx.unk_C4.ambientColor[1]; - sp70.ambientColor[2] = play->envCtx.unk_C4.ambientColor[2]; + new_var = play->envCtx.lightSettings.light1Color; + sp70.fogNear = play->envCtx.lightSettings.fogNear; + sp70.fogColor[0] = play->envCtx.lightSettings.fogColor[0]; + sp70.fogColor[1] = play->envCtx.lightSettings.fogColor[1]; + sp70.fogColor[2] = play->envCtx.lightSettings.fogColor[2]; + sp70.ambientColor[0] = play->envCtx.lightSettings.ambientColor[0]; + sp70.ambientColor[1] = play->envCtx.lightSettings.ambientColor[1]; + sp70.ambientColor[2] = play->envCtx.lightSettings.ambientColor[2]; if (arg1 <= 1.0f) { arg1 -= 0.0f; @@ -17451,13 +17877,13 @@ void func_80854EFC(PlayState* play, f32 arg1, struct_8085D848_unk_00* arg2) { var_t4 = D_8085D844; } - play->envCtx.lightSettings.fogNear = - ((s16)((var_v1->fogNear - var_t0->fogNear) * arg1) + var_t0->fogNear) - play->envCtx.unk_C4.fogNear; + play->envCtx.adjLightSettings.fogNear = + ((s16)((var_v1->fogNear - var_t0->fogNear) * arg1) + var_t0->fogNear) - play->envCtx.lightSettings.fogNear; - func_80854CD0(arg1, play->envCtx.lightSettings.fogColor, var_v1->fogColor, var_t0->fogColor, - play->envCtx.unk_C4.fogColor, play->envCtx.lightSettings.ambientColor, var_v1->ambientColor, - var_t0->ambientColor, play->envCtx.unk_C4.ambientColor, play->envCtx.lightSettings.diffuseColor1, - var_t3, var_t4, new_var); + func_80854CD0(arg1, play->envCtx.adjLightSettings.fogColor, var_v1->fogColor, var_t0->fogColor, + play->envCtx.lightSettings.fogColor, play->envCtx.adjLightSettings.ambientColor, var_v1->ambientColor, + var_t0->ambientColor, play->envCtx.lightSettings.ambientColor, + play->envCtx.adjLightSettings.light1Color, var_t3, var_t4, new_var); } struct_8085D848 D_8085D848[] = { @@ -17527,19 +17953,19 @@ void func_80855218(PlayState* play, Player* this, struct_8085D910** arg2) { func_8082DB60(play, this, &gPlayerAnim_cl_setmaskend); } else if ((this->skelAnime.animation == &gPlayerAnim_cl_setmask) || (this->skelAnime.animation == &gPlayerAnim_cl_setmaskend)) { - if (this->unk_AE7 >= 58) { - Math_StepToS(&this->unk_AE8, 255, 50); + if (this->actionVar1 >= 58) { + Math_StepToS(&this->actionVar2, 255, 50); } - if (this->unk_AE7 >= 64) { + if (this->actionVar1 >= 64) { Math_StepToF(&this->unk_B10[2], 0.0f, 0.015f); - } else if (this->unk_AE7 >= 0xE) { + } else if (this->actionVar1 >= 0xE) { Math_StepToF(&this->unk_B10[2], 0.3f, 0.3f); } - if (this->unk_AE7 > 65) { + if (this->actionVar1 > 65) { Math_StepToF(&this->unk_B10[3], 0.0f, 0.02f); - } else if (this->unk_AE7 >= 0x10) { + } else if (this->actionVar1 >= 0x10) { Math_StepToF(&this->unk_B10[3], -0.1f, 0.1f); } @@ -17547,13 +17973,13 @@ void func_80855218(PlayState* play, Player* this, struct_8085D910** arg2) { Player_PlayAnimSfx(this, D_8085D8F0); } } else { - if (this->unk_AE7 >= 20) { - Math_StepToS(&this->unk_AE8, 255, 20); + if (this->actionVar1 >= 20) { + Math_StepToS(&this->actionVar2, 255, 20); } if (R_PLAY_FILL_SCREEN_ON == 0) { Player_PlayAnimSfx(this, D_8085D904); - if (this->unk_AE7 == 15) { + if (this->actionVar1 == 15) { Player_PlaySfx(this, NA_SE_PL_FACE_CHANGE); } } @@ -17571,21 +17997,21 @@ struct_8085D910 D_8085D910[] = { { 9, 0x32, 0xA, 0xD }, }; -void func_808553F4(Player* this, PlayState* play) { +void Player_Action_86(Player* this, PlayState* play) { struct_8085D910* sp4C = D_8085D910; s32 sp48 = false; func_808323C0(this, play->playerCsIds[PLAYER_CS_ID_MASK_TRANSFORMATION]); sPlayerControlInput = play->state.input; - Camera_ChangeMode(play->cameraPtrs[play->activeCamId], + Camera_ChangeMode(GET_ACTIVE_CAM(play), (this->transformation == PLAYER_FORM_HUMAN) ? CAM_MODE_NORMAL : CAM_MODE_JUMP); this->stateFlags2 |= PLAYER_STATE2_40; - this->actor.shape.rot.y = Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; func_80855218(play, this, &sp4C); - if (this->unk_AE7 == 0x14) { + if (this->actionVar1 == 0x14) { Play_EnableMotionBlurPriority(100); } @@ -17595,16 +18021,16 @@ void func_808553F4(Player* this, PlayState* play) { R_PLAY_FILL_SCREEN_ALPHA = 255; this->actor.update = func_8012301C; this->actor.draw = NULL; - this->unk_AE7 = 0; + this->actionVar1 = 0; Play_DisableMotionBlurPriority(); - SET_WEEKEVENTREG(D_8085D908[gSaveContext.save.playerForm]); + SET_WEEKEVENTREG(D_8085D908[GET_PLAYER_FORM]); } - } else if ((this->unk_AE7++ > ((this->transformation == PLAYER_FORM_HUMAN) ? 0x53 : 0x37)) || - ((this->unk_AE7 >= 5) && - (sp48 = ((this->transformation != PLAYER_FORM_HUMAN) || - CHECK_WEEKEVENTREG(D_8085D908[gSaveContext.save.playerForm])) && - CHECK_BTN_ANY(sPlayerControlInput->press.button, - BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_B | BTN_A)))) { + } else if ((this->actionVar1++ > ((this->transformation == PLAYER_FORM_HUMAN) ? 0x53 : 0x37)) || + ((this->actionVar1 >= 5) && + (sp48 = + ((this->transformation != PLAYER_FORM_HUMAN) || CHECK_WEEKEVENTREG(D_8085D908[GET_PLAYER_FORM])) && + CHECK_BTN_ANY(sPlayerControlInput->press.button, + BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_B | BTN_A)))) { R_PLAY_FILL_SCREEN_ON = 45; R_PLAY_FILL_SCREEN_R = 220; R_PLAY_FILL_SCREEN_G = 220; @@ -17627,12 +18053,12 @@ void func_808553F4(Player* this, PlayState* play) { Player_PlaySfx(this, NA_SE_SY_TRANSFORM_MASK_FLASH); } - if (this->unk_AE7 >= sp4C->unk_0) { - if (this->unk_AE7 < sp4C->unk_2) { + if (this->actionVar1 >= sp4C->unk_0) { + if (this->actionVar1 < sp4C->unk_2) { Math_StepToF(&this->unk_B10[4], 1.0f, sp4C->unk_1 / 100.0f); - } else if (this->unk_AE7 < sp4C->unk_3) { - if (this->unk_AE7 == sp4C->unk_2) { - func_801000CC(NA_SE_EV_LIGHTNING_HARD); + } else if (this->actionVar1 < sp4C->unk_3) { + if (this->actionVar1 == sp4C->unk_2) { + Lib_PlaySfx_2(NA_SE_EV_LIGHTNING_HARD); } Math_StepToF(&this->unk_B10[4], 2.0f, 0.5f); @@ -17641,10 +18067,10 @@ void func_808553F4(Player* this, PlayState* play) { } } - if (this->unk_AE7 >= 0x10) { - if (this->unk_AE7 < 0x40) { + if (this->actionVar1 >= 0x10) { + if (this->actionVar1 < 0x40) { Math_StepToF(&this->unk_B10[5], 1.0f, 0.2f); - } else if (this->unk_AE7 < 0x37) { + } else if (this->actionVar1 < 0x37) { Math_StepToF(&this->unk_B10[5], 2.0f, 1.0f); } else { Math_StepToF(&this->unk_B10[5], 3.0f, 0.55f); @@ -17654,9 +18080,8 @@ void func_808553F4(Player* this, PlayState* play) { func_808550D0(play, this, this->unk_B10[4], this->unk_B10[5], (this->transformation == PLAYER_FORM_HUMAN) ? 0 : 1); } -void func_80855818(Player* this, PlayState* play) { - Camera_ChangeMode(play->cameraPtrs[play->activeCamId], - (this->prevMask == PLAYER_MASK_NONE) ? CAM_MODE_NORMAL : CAM_MODE_JUMP); +void Player_Action_87(Player* this, PlayState* play) { + Camera_ChangeMode(GET_ACTIVE_CAM(play), (this->prevMask == PLAYER_MASK_NONE) ? CAM_MODE_NORMAL : CAM_MODE_JUMP); if (R_PLAY_FILL_SCREEN_ON != 0) { R_PLAY_FILL_SCREEN_ALPHA -= R_PLAY_FILL_SCREEN_ON; @@ -17666,8 +18091,8 @@ void func_80855818(Player* this, PlayState* play) { } } - if (this->unk_AE7++ < 4) { - if ((this->prevMask == PLAYER_MASK_NONE) && (this->unk_AE7 == 4)) { + if (this->actionVar1++ < 4) { + if ((this->prevMask == PLAYER_MASK_NONE) && (this->actionVar1 == 4)) { PlayerAnimation_Change(play, &this->skelAnime, func_8082ED20(this), 1.0f, 0.0f, 20.0f, ANIMMODE_ONCE, 20.0f); } @@ -17676,14 +18101,14 @@ void func_80855818(Player* this, PlayState* play) { f32 dist; s16 angle; - func_800FF3A0(&dist, &angle, play->state.input); - if (PlayerAnimation_Update(play, &this->skelAnime) || ((this->unk_AE7 > 10) && (dist != 0.0f))) { + Lib_GetControlStickData(&dist, &angle, play->state.input); + if (PlayerAnimation_Update(play, &this->skelAnime) || ((this->actionVar1 > 10) && (dist != 0.0f))) { if (R_PLAY_FILL_SCREEN_ON == 0) { this->stateFlags1 &= ~PLAYER_STATE1_2; this->prevMask = this->currentMask; this->csId = play->playerCsIds[PLAYER_CS_ID_MASK_TRANSFORMATION]; Player_StopCutscene(this); - play->envCtx.lightSettings = D_80862B50; + play->envCtx.adjLightSettings = D_80862B50; func_8085B384(this, play); return; } @@ -17695,21 +18120,21 @@ void func_80855818(Player* this, PlayState* play) { func_808550D0(play, this, 0, this->unk_B10[5], (this->prevMask == PLAYER_MASK_NONE) ? 0 : 1); } -void func_80855A7C(Player* this, PlayState* play) { - if (this->unk_AE8++ > 90) { - play->msgCtx.ocarinaMode = 4; +void Player_Action_88(Player* this, PlayState* play) { + if (this->actionVar2++ > 90) { + play->msgCtx.ocarinaMode = OCARINA_MODE_END; func_8085B384(this, play); - } else if (this->unk_AE8 == 10) { + } else if (this->actionVar2 == 10) { func_80848640(play, this); } } // Giant's Mask -void func_80855AF4(Player* this, PlayState* play) { +void Player_Action_89(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_40; func_80855218(play, this, NULL); - this->unk_AE7++; + this->actionVar1++; if (!(this->stateFlags1 & PLAYER_STATE1_100)) { this->prevMask = this->currentMask; @@ -17722,7 +18147,7 @@ void func_80855AF4(Player* this, PlayState* play) { } } -void func_80855B9C(Player* this, PlayState* play) { +void Player_Action_90(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_40; PlayerAnimation_Update(play, &this->skelAnime); @@ -17739,7 +18164,7 @@ void func_80855B9C(Player* this, PlayState* play) { } } -void func_80855C28(Player* this, PlayState* play) { +void Player_Action_91(Player* this, PlayState* play) { s16 sp3E; s32 pad; PlayerAnimationHeader* sp34; @@ -17751,10 +18176,10 @@ void func_80855C28(Player* this, PlayState* play) { var_a0 = 0; if ((this->actor.floorHeight - this->actor.world.pos.y) < 60.0f) { Math_StepToF(&this->unk_B10[5], 200.0f, 150.0f); - var_a0 = Math_StepToS(&this->unk_AE8, 0xFA0, 0x15E); + var_a0 = Math_StepToS(&this->actionVar2, 0xFA0, 0x15E); } - this->actor.shape.rot.y += this->unk_AE8; + this->actor.shape.rot.y += this->actionVar2; this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].x = 0; this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].z = 0; this->unk_ABC += this->unk_B10[5]; @@ -17775,13 +18200,13 @@ void func_80855C28(Player* this, PlayState* play) { } } } - } else if (this->unk_AE7 == 0) { + } else if (this->actionVar1 == 0) { Player_PlaySfx(this, NA_SE_PL_WARP_PLATE_OUT); - this->unk_AE7 = 1; + this->actionVar1 = 1; } } -void func_80855E08(Player* this, PlayState* play) { +void Player_Action_92(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; if (PlayerAnimation_Update(play, &this->skelAnime)) { @@ -17793,7 +18218,7 @@ void func_80855E08(Player* this, PlayState* play) { f32 var_fv0; Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); - func_80843178(play, this); + Player_ProcessSceneCollision(play, this); var_fv0 = this->actor.world.pos.y - this->actor.floorHeight; var_fv0 = CLAMP_MAX(var_fv0, 20.0f); @@ -17815,12 +18240,12 @@ void func_80855E08(Player* this, PlayState* play) { } void func_80855F9C(PlayState* play, Player* this) { - f32 sp24; - s16 sp22; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_20; - func_80832F78(this, &sp24, &sp22, 0.018f, play); - Math_ScaledStepToS(&this->currentYaw, sp22, 0x258); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + Math_ScaledStepToS(&this->currentYaw, yawTarget, 0x258); } s32 func_80856000(PlayState* play, Player* this) { @@ -17859,7 +18284,7 @@ void func_80856110(PlayState* play, Player* this, f32 arg2, f32 arg3, f32 arg4, } // Deku Flower related -void func_808561B0(Player* this, PlayState* play) { +void Player_Action_93(Player* this, PlayState* play) { DynaPolyActor* dyna; s32 aux = 0xAE; f32 temp_fv0_2; @@ -17868,19 +18293,19 @@ void func_808561B0(Player* this, PlayState* play) { PlayerAnimation_Update(play, &this->skelAnime); - if (func_80838A90(this, play)) { + if (Player_ActionChange_13(this, play)) { return; } - if (this->unk_AE7 == 0) { + if (this->actionVar1 == 0) { this->unk_ABC += this->unk_B48; if (this->unk_ABC < -1000.0f) { this->unk_ABC = -1000.0f; - this->unk_AE7 = 1; + this->actionVar1 = 1; this->unk_B48 = 0.0f; } func_80856074(play, this); - } else if (this->unk_AE7 == 1) { + } else if (this->actionVar1 == 1) { this->unk_B48 += -22.0f; if (this->unk_B48 < -170.0f) { this->unk_B48 = -170.0f; @@ -17888,8 +18313,8 @@ void func_808561B0(Player* this, PlayState* play) { this->unk_ABC += this->unk_B48; if (this->unk_ABC < -3900.0f) { this->unk_ABC = -3900.0f; - this->unk_AE7 = 2; - this->actor.shape.rot.y = Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamId]); + this->actionVar1 = 2; + this->actor.shape.rot.y = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); this->actor.scale.y = 0.01f; this->currentYaw = this->actor.world.rot.y = this->actor.shape.rot.y; } else { @@ -17908,22 +18333,22 @@ void func_808561B0(Player* this, PlayState* play) { } func_80856074(play, this); - } else if (this->unk_AE7 == 2) { + } else if (this->actionVar1 == 2) { if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A)) { if (func_80856000(play, this)) { - this->unk_AE8 = 0; + this->actionVar2 = 0; } else { - this->unk_AE7 = 3; - if (this->unk_AE8 >= 10) { + this->actionVar1 = 3; + if (this->actionVar2 >= 10) { this->unk_B48 = 2700.0f; } else { this->unk_B48 = 1450.0f; } func_8082E1F0(this, NA_SE_PL_DEKUNUTS_OUT_GRD); } - } else if (this->unk_AE8 < 15) { - this->unk_AE8++; - if (this->unk_AE8 == 10) { + } else if (this->actionVar2 < 15) { + this->actionVar2++; + if (this->actionVar2 == 10) { func_80856110(play, this, 20.0f, 3.8f, -0.1f, 140, 23, 15); } } @@ -17935,7 +18360,7 @@ void func_808561B0(Player* this, PlayState* play) { if (temp_fv0_2 >= 0.0f) { f32 speed; - sp38 = (this->unk_AE8 >= 10); + sp38 = (this->actionVar2 >= 10); var_v1 = -1; speed = this->unk_B48 * this->actor.scale.y; if (this->actor.floorBgId != BGCHECK_SCENE) { @@ -17951,7 +18376,7 @@ void func_808561B0(Player* this, PlayState* play) { this->unk_ABC = 0.0f; this->actor.world.pos.y += temp_fv0_2 * this->actor.scale.y; func_80834DB8(this, &gPlayerAnim_pn_kakku, speed, play); - Player_SetAction(play, this, func_80856918, 1); + Player_SetAction(play, this, Player_Action_94, 1); this->boomerangActor = NULL; this->stateFlags3 |= PLAYER_STATE3_200; @@ -17962,8 +18387,8 @@ void func_808561B0(Player* this, PlayState* play) { this->stateFlags3 |= PLAYER_STATE3_40000; } - this->unk_AE7 = var_v1; - this->unk_AE8 = 9999; + this->actionVar1 = var_v1; + this->actionVar2 = 9999; Player_SetCylinderForAttack(this, DMG_DEKU_LAUNCH, 2, 20); } else if (this->unk_ABC < 0.0f) { func_80856074(play, this); @@ -18047,12 +18472,12 @@ Vec3f D_8085D960 = { -30.0f, 50.0f, 0.0f }; Vec3f D_8085D96C = { 30.0f, 50.0f, 0.0f }; // Flying as Deku? -void func_80856918(Player* this, PlayState* play) { +void Player_Action_94(Player* this, PlayState* play) { if ((this->boomerangActor != NULL) && (this->boomerangActor->update == NULL)) { this->boomerangActor = NULL; } - if (func_80838A90(this, play)) { + if (Player_ActionChange_13(this, play)) { return; } @@ -18074,7 +18499,7 @@ void func_80856918(Player* this, PlayState* play) { func_80833AA0(this, play); } else if (this->stateFlags3 & PLAYER_STATE3_200) { if (this->actor.velocity.y < 0.0f) { - if (this->unk_AE7 < 0) { + if (this->actionVar1 < 0) { func_80833AA0(this, play); } else { PlayerAnimation_Update(play, &this->skelAnime); @@ -18083,7 +18508,7 @@ void func_80856918(Player* this, PlayState* play) { this->stateFlags3 &= ~PLAYER_STATE3_200; this->stateFlags3 |= PLAYER_STATE3_1000000; func_8082E1F0(this, NA_SE_IT_DEKUNUTS_FLOWER_OPEN); - func_8019FD90(4, 2); + Audio_SetSfxTimerLerpInterval(4, 2); } } } @@ -18099,9 +18524,9 @@ void func_80856918(Player* this, PlayState* play) { s16 sp76; s16 var_v1; s16 var_a1; - f32 sp6C; + f32 speedTarget; f32 sp68; - s16 sp66; + s16 yawTarget; s16 temp_ft0; s32 temp; s16 var_v1_4; @@ -18124,14 +18549,14 @@ void func_80856918(Player* this, PlayState* play) { func_8085687C(this); - if (this->unk_AE8 != 0) { - this->unk_AE8--; + if (this->actionVar2 != 0) { + this->actionVar2--; } - temp_fv1 = D_8085D958[this->unk_AE7] - Math_Vec3f_DistXZ(&this->actor.world.pos, this->unk_AF0); + temp_fv1 = D_8085D958[this->actionVar1] - Math_Vec3f_DistXZ(&this->actor.world.pos, this->unk_AF0); PlayerAnimation_Update(play, &this->skelAnime); - if ((this->unk_AE8 != 0) && (temp_fv1 > 300.0f)) { + if ((this->actionVar2 != 0) && (temp_fv1 > 300.0f)) { sp76 = 0x1770; if (this->skelAnime.animation != &gPlayerAnim_pn_kakku) { func_8082E5EC(play, this, &gPlayerAnim_pn_kakkufinish); @@ -18148,7 +18573,7 @@ void func_80856918(Player* this, PlayState* play) { func_808566C0(play, this, PLAYER_BODYPART_RIGHT_HAND, 0.6f, 1.0f, 0.8f, 17); } } - } else if ((this->unk_AE8 == 0) || (temp_fv1 < 0.0f)) { + } else if ((this->actionVar2 == 0) || (temp_fv1 < 0.0f)) { sp76 = 0; func_808355D8(play, this, &gPlayerAnim_pn_rakkafinish); } else { @@ -18175,10 +18600,10 @@ void func_80856918(Player* this, PlayState* play) { func_808566C0(play, this, PLAYER_BODYPART_RIGHT_HAND, 0.0f, 1.0f, 0.0f, 32); } - func_8019FCB8(&this->actor.projectedPos, 0x1851, 2.0f * (this->unk_B86[1] * (1.0f / 6000.0f))); + Audio_PlaySfx_AtPosWithTimer(&this->actor.projectedPos, 0x1851, 2.0f * (this->unk_B86[1] * (1.0f / 6000.0f))); if ((this->boomerangActor == NULL) && CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_B)) { - if (AMMO(ITEM_NUT) == 0) { - play_sound(NA_SE_SY_ERROR); + if (AMMO(ITEM_DEKU_NUT) == 0) { + Audio_PlaySfx(NA_SE_SY_ERROR); } else { this->boomerangActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_WAIST].x, @@ -18187,7 +18612,7 @@ void func_80856918(Player* this, PlayState* play) { if (this->boomerangActor != NULL) { this->boomerangActor->velocity.x = this->actor.velocity.x * 1.5f; this->boomerangActor->velocity.z = this->actor.velocity.z * 1.5f; - Inventory_ChangeAmmo(ITEM_NUT, -1); + Inventory_ChangeAmmo(ITEM_DEKU_NUT, -1); Actor_PlaySfx(this->boomerangActor, NA_SE_PL_DEKUNUTS_DROP_BOMB); } } @@ -18204,33 +18629,34 @@ void func_80856918(Player* this, PlayState* play) { } this->fallStartHeight = this->actor.world.pos.y; - func_80832F78(this, &sp6C, &sp66, 0.0f, play); - if (sp6C == 0.0f) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + + if (speedTarget == 0.0f) { sp68 = 0.1f; } else { - s16 temp_v0_6 = this->currentYaw - sp66; + s16 temp_v0_6 = this->currentYaw - yawTarget; if (ABS_ALT(temp_v0_6) > 0x4000) { - sp6C = -sp6C; - sp66 += 0x8000; + speedTarget = -speedTarget; + yawTarget += 0x8000; } sp68 = 0.25f; } - Math_SmoothStepToS(&this->unk_B8C, sp6C * 600.0f, 8, 0xFA0, 0x64); - Math_ScaledStepToS(&this->currentYaw, sp66, 0xFA); + Math_SmoothStepToS(&this->unk_B8C, speedTarget * 600.0f, 8, 0xFA0, 0x64); + Math_ScaledStepToS(&this->currentYaw, yawTarget, 0xFA); - temp_ft0 = BINANG_SUB(sp66, this->currentYaw) * -2.0f; + temp_ft0 = BINANG_SUB(yawTarget, this->currentYaw) * -2.0f; temp_ft0 = CLAMP(temp_ft0, -0x1F40, 0x1F40); Math_SmoothStepToS(&this->unk_B8E, temp_ft0, 0x14, 0x320, 0x14); - sp6C = (sp6C * (this->unk_B86[1] * 0.0004f)) * fabsf(Math_SinS(this->unk_B8C)); - func_80856888(&this->linearVelocity, sp6C, sp68); + speedTarget = (speedTarget * (this->unk_B86[1] * 0.0004f)) * fabsf(Math_SinS(this->unk_B8C)); + func_80856888(&this->linearVelocity, speedTarget, sp68); - sp6C = sqrtf(SQ(this->linearVelocity) + SQ(this->actor.velocity.y)); - if (sp6C > 8.0f) { - sp6C = 8.0f / sp6C; - this->linearVelocity *= sp6C; - this->actor.velocity.y *= sp6C; + speedTarget = sqrtf(SQ(this->linearVelocity) + SQ(this->actor.velocity.y)); + if (speedTarget > 8.0f) { + speedTarget = 8.0f / speedTarget; + this->linearVelocity *= speedTarget; + this->actor.velocity.y *= speedTarget; } } @@ -18238,21 +18664,22 @@ void func_80856918(Player* this, PlayState* play) { } // Deku spinning related -void func_808573A4(Player* this, PlayState* play) { +void Player_Action_95(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20 | PLAYER_STATE2_40; PlayerAnimation_Update(play, &this->skelAnime); Player_SetCylinderForAttack(this, DMG_DEKU_SPIN, 1, 30); - if (!func_80838A90(this, play)) { + if (!Player_ActionChange_13(this, play)) { s16 prevYaw = this->currentYaw; - f32 sp40; - s16 sp3E; + f32 speedTarget; + s16 yawTarget; - func_80832F78(this, &sp40, &sp3E, 0.018f, play); - sp40 *= 1.0f - (0.9f * ((11100.0f - this->unk_B10[0]) / 11100.0f)); - if (!func_8083A4A4(this, &sp40, &sp3E, REG(43) / 100.0f)) { - func_8083CB58(this, sp40, sp3E); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + speedTarget *= 1.0f - (0.9f * ((11100.0f - this->unk_B10[0]) / 11100.0f)); + + if (!func_8083A4A4(this, &speedTarget, &yawTarget, REG(43) / 100.0f)) { + func_8083CB58(this, speedTarget, yawTarget); } this->unk_B10[0] += -800.0f; @@ -18277,7 +18704,7 @@ void func_808573A4(Player* this, PlayState* play) { func_800AE930(&play->colCtx, Effect_GetByIndex(this->meleeWeaponEffectIndex[2]), &this->actor.world.pos, 2.0f, this->currentYaw, this->actor.floorPoly, this->actor.floorBgId); - func_800B8F98(&this->actor, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG)); + Actor_PlaySfx_FlaggedCentered1(&this->actor, Player_GetFloorSfx(this, NA_SE_PL_SLIP_LEVEL - SFX_FLAG)); } } @@ -18285,10 +18712,10 @@ void func_80857640(Player* this, f32 arg1, s32 arg2) { func_80834CD0(this, arg1, NA_SE_VO_LI_SWORD_N); Player_PlaySfx(this, NA_SE_PL_GORON_BALLJUMP); Player_StopHorizontalMovement(this); - if (this->unk_AE8 < arg2) { - this->unk_AE8 = arg2; + if (this->actionVar2 < arg2) { + this->actionVar2 = arg2; } - this->unk_AE7 = 1; + this->actionVar1 = 1; this->unk_B48 = 1.0f; } @@ -18297,7 +18724,7 @@ void func_808576BC(PlayState* play, Player* this) { (this->actor.velocity.x * Math_SinS(this->currentYaw))) * 800.0f; - var_v0 -= this->unk_AE8; + var_v0 -= this->actionVar2; var_v0 = ABS_ALT(var_v0); if (var_v0 <= 0x7D0) { @@ -18305,7 +18732,7 @@ void func_808576BC(PlayState* play, Player* this) { } if (var_v0 > 0x1770) { - func_800B8F98(&this->actor, NA_SE_PL_GORON_SLIP - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_GORON_SLIP - SFX_FLAG); } if (func_8083F8A8(play, this, 12.0f, -1 - (var_v0 >> 0xC), (var_v0 >> 0xA) + 1.0f, (var_v0 >> 7) + 160, 20, true)) { @@ -18316,7 +18743,7 @@ void func_808576BC(PlayState* play, Player* this) { } void func_808577E0(Player* this) { - f32 temp_fa1 = ABS_ALT(this->unk_AE8) * 0.00004f; + f32 temp_fa1 = ABS_ALT(this->actionVar2) * 0.00004f; if (this->unk_ABC < temp_fa1) { this->unk_B48 += 0.08f; @@ -18337,8 +18764,8 @@ void func_808577E0(Player* this) { s32 func_80857950(PlayState* play, Player* this) { if (((this->unk_B86[1] == 0) && !CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A)) || - ((this->unk_AE7 == 3) && (this->actor.velocity.y < 0.0f))) { - Player_SetAction(play, this, func_80849FE0, 1); + ((this->actionVar1 == 3) && (this->actor.velocity.y < 0.0f))) { + Player_SetAction(play, this, Player_Action_4, 1); Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_pg_maru_change, -2.0f / 3.0f, 7.0f, 0.0f, ANIMMODE_ONCE, 0.0f); @@ -18355,9 +18782,9 @@ s32 func_80857A44(PlayState* play, Player* this) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_800; - this->unk_AE7 = 4; + this->actionVar1 = 4; this->actor.shape.shadowScale = 30.0f; - this->unk_AE8 = this->linearVelocity * 500.0f; + this->actionVar2 = this->linearVelocity * 500.0f; this->unk_B08 = this->linearVelocity; this->unk_B0C = 0.0f; this->actor.home.rot.y = this->currentYaw; @@ -18373,17 +18800,17 @@ void func_80857AEC(PlayState* play, Player* this) { this->unk_B0C += this->unk_B08 * 0.05f; if (this->unk_B86[1] == 0) { - if (this->unk_AE7 == 1) { - this->unk_AE7 = 2; + if (this->actionVar1 == 1) { + this->actionVar1 = 2; Player_RequestQuakeAndRumble(play, this, NA_SE_PL_GORON_PUNCH); play->actorCtx.unk2 = 4; EffectSsBlast_SpawnWhiteShockwave(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f); - this->unk_AE8 = 0; + this->actionVar2 = 0; this->unk_B08 = 0.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } else { - this->unk_AE7 = 4; + this->actionVar1 = 4; } } @@ -18392,12 +18819,12 @@ void func_80857AEC(PlayState* play, Player* this) { } // Goron rolling related -void func_80857BE8(Player* this, PlayState* play) { - if (func_80833058(play, this, D_8085D050, 0)) { +void Player_Action_96(Player* this, PlayState* play) { + if (Player_TryActionChangeList(play, this, sPlayerActionChangeList12, false)) { return; } - if ((this->unk_AE7 == 0) && !func_80857A44(play, this)) { + if ((this->actionVar1 == 0) && !func_80857A44(play, this)) { return; } @@ -18405,14 +18832,14 @@ void func_80857BE8(Player* this, PlayState* play) { func_808577E0(this); if (!func_80857950(play, this)) { - f32 spE4 = 0.0f; - s16 spE2 = this->currentYaw; + f32 speedTarget = 0.0f; + s16 yawTarget = this->currentYaw; u16 spE0; s32 spDC; s32 spD8; if (func_80840A30(play, this, &this->unk_B08, (this->doorType == PLAYER_DOORTYPE_STAIRCASE) ? 0.0f : 12.0f)) { - if (func_80857BE8 != this->actionFunc) { + if (Player_Action_96 != this->actionFunc) { return; } @@ -18420,7 +18847,7 @@ void func_80857BE8(Player* this, PlayState* play) { func_80834CD0(this, 10.0f, 0); if (this->unk_B86[1] != 0) { this->unk_B86[1] = 0; - this->unk_AE7 = 3; + this->actionVar1 = 3; } } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->unk_B08 >= 12.0f)) { s16 temp_v0 = this->currentYaw - BINANG_ADD(this->actor.wallYaw, 0x8000); @@ -18442,28 +18869,28 @@ void func_80857BE8(Player* this, PlayState* play) { if (this->unk_B8E != 0) { this->unk_B8E--; } else { - func_80832F78(this, &spE4, &spE2, 0.0f, play); - spE4 *= 2.6f; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + speedTarget *= 2.6f; } if (this->unk_B8C != 0) { this->unk_B8C--; - spE2 = this->currentYaw; + yawTarget = this->currentYaw; } if (this->unk_B86[1] != 0) { - spE4 = 18.0f; - Math_StepToC(&this->unk_AE7, 4, 1); + speedTarget = 18.0f; + Math_StepToC(&this->actionVar1, 4, 1); if ((this->stateFlags3 & PLAYER_STATE3_80000) && (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_A) || (gSaveContext.save.saveInfo.playerData.magic == 0) || - ((this->unk_AE7 == 4) && (this->unk_B08 < 12.0f)))) { - if (Math_StepToS(&this->unk_B86[1], 0, 1) != 0) { + ((this->actionVar1 == 4) && (this->unk_B08 < 12.0f)))) { + if (Math_StepToS(&this->unk_B86[1], 0, 1)) { this->stateFlags3 &= ~PLAYER_STATE3_80000; Magic_Reset(play); Player_PlaySfx(this, NA_SE_PL_GORON_BALL_CHARGE_FAILED); } - this->unk_AE7 = 4; + this->actionVar1 = 4; } else if (this->unk_B86[1] < 7) { if (!(this->stateFlags3 & PLAYER_STATE3_80000)) { this->unk_3D0.unk_00 = 2; @@ -18472,14 +18899,14 @@ void func_80857BE8(Player* this, PlayState* play) { } } - spDC = spE4 * 900.0f; + spDC = speedTarget * 900.0f; Math_AsymStepToF(&this->unk_B10[0], (this->unk_B8A != 0) ? 1.0f : 0.0f, 0.8f, 0.05f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80857AEC(play, this); - if (this->unk_AE7 == 2) { + if (this->actionVar1 == 2) { if (this->unk_B8A == 0) { - this->unk_AE7 = 4; + this->actionVar1 = 4; } else { this->unk_B8A--; this->unk_ABC = 0.0f; @@ -18510,7 +18937,7 @@ void func_80857BE8(Player* this, PlayState* play) { if (this->unk_B86[1] == 0) { this->unk_B0C = 0.0f; - if (this->unk_AE7 >= 0x36) { + if (this->actionVar1 >= 0x36) { Magic_Consume(play, 2, MAGIC_CONSUME_GORON_ZORA); this->unk_B08 = 18.0f; this->unk_B86[1] = 1; @@ -18522,7 +18949,7 @@ void func_80857BE8(Player* this, PlayState* play) { } spBC = (1.0f - this->unk_B0C) * this->unk_B08 * sp88; - if ((spBC < 0.0f) || ((spE4 == 0.0f) && (ABS_ALT(sp8E) > 0xFA0))) { + if ((spBC < 0.0f) || ((speedTarget == 0.0f) && (ABS_ALT(sp8E) > 0xFA0))) { spBC = 0.0f; } @@ -18530,7 +18957,7 @@ void func_80857BE8(Player* this, PlayState* play) { var_a0 = spBC * 500.0f; var_a0 = CLAMP_MIN(var_a0, 0); - spC0 = (s32)(spE4 * 400.0f) - var_a0; + spC0 = (s32)(speedTarget * 400.0f) - var_a0; spC0 = CLAMP_MIN(spC0, 0); spDC = CLAMP_MIN(spDC, var_a0); @@ -18544,15 +18971,15 @@ void func_80857BE8(Player* this, PlayState* play) { spA0 = spB0 - spA8; this->linearVelocity = spBC; this->currentYaw = this->actor.home.rot.y; - spCC = spE4; - spCA = spE2; + spCC = speedTarget; + spCA = yawTarget; - if (func_8083A4A4(this, &spCC, &spCA, (this->unk_AE7 >= 5) ? 0.0f : 1.0f)) { + if (func_8083A4A4(this, &spCC, &spCA, (this->actionVar1 >= 5) ? 0.0f : 1.0f)) { if (this->unk_B86[1] == 0) { - this->unk_AE7 = 4; + this->actionVar1 = 4; } - if (this->unk_AE7 == 4) { + if (this->actionVar1 == 4) { spDC = -0xFA0; } } else { @@ -18561,11 +18988,11 @@ void func_80857BE8(Player* this, PlayState* play) { f32 sp84 = (((this->floorSfxOffset == NA_SE_PL_WALK_SNOW - SFX_FLAG) || (this->floorSfxOffset == NA_SE_PL_WALK_ICE - SFX_FLAG) || (this->floorSfxOffset == NA_SE_PL_WALK_SAND - SFX_FLAG) || - (sPlayerCurrentFloorType == FLOOR_TYPE_5)) && + (sPlayerFloorType == FLOOR_TYPE_5)) && (spC0 >= 0x7D0)) ? 0.08f - : this->unk_AE8 * 0.0003f; - f32 sp80 = (Math_SinS(this->unk_B6C) * 8.0f) + 0.6f; + : this->actionVar2 * 0.0003f; + f32 sp80 = (Math_SinS(this->floorPitch) * 8.0f) + 0.6f; s16 var_a3; s16 sp7C; Vec3f sp70; @@ -18574,28 +19001,28 @@ void func_80857BE8(Player* this, PlayState* play) { if (this->unk_B86[1] == 0) { if ((gSaveContext.magicState == MAGIC_STATE_IDLE) && - (gSaveContext.save.saveInfo.playerData.magic >= 2) && (this->unk_AE8 >= 0x36B0)) { - this->unk_AE7++; - func_800B8F98(&this->actor, NA_SE_PL_GORON_BALL_CHARGE - SFX_FLAG); + (gSaveContext.save.saveInfo.playerData.magic >= 2) && (this->actionVar2 >= 0x36B0)) { + this->actionVar1++; + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_GORON_BALL_CHARGE - SFX_FLAG); } else { - this->unk_AE7 = 4; + this->actionVar1 = 4; } } - if (spE4 != spCC) { - this->currentYaw = spE2; + if (speedTarget != spCC) { + this->currentYaw = yawTarget; } sp84 = CLAMP_MIN(sp84, 0.0f); sp80 = CLAMP_MIN(sp80, 0.0f); - Math_AsymStepToF(&this->linearVelocity, spE4, sp84, sp80); + Math_AsymStepToF(&this->linearVelocity, speedTarget, sp84, sp80); spC8 = (s16)(fabsf(this->actor.speed) * 20.0f) + 300; spC8 = CLAMP_MIN(spC8, 100); - sp7C = (s32)(BINANG_SUB(spE2, this->currentYaw) * -0.5f); + sp7C = (s32)(BINANG_SUB(yawTarget, this->currentYaw) * -0.5f); this->unk_B0C += (f32)(SQ(sp7C)) * 8e-9f; - Math_ScaledStepToS(&this->currentYaw, spE2, spC8); + Math_ScaledStepToS(&this->currentYaw, yawTarget, spC8); sp6C = func_80835D2C(play, this, &D_8085D978, &sp70); var_fa1 = func_80835D2C(play, this, &D_8085D984, &sp70) - sp6C; @@ -18618,11 +19045,11 @@ void func_80857BE8(Player* this, PlayState* play) { spB8 = sqrtf(SQ(spA4) + SQ(spA0)); if (this->unk_B86[1] != 0) { - if ((ABS_ALT(sp8E) + ABS_ALT(this->unk_B6C)) > 15000) { + if ((ABS_ALT(sp8E) + ABS_ALT(this->floorPitch)) > 0x3A98) { this->unk_B86[1] = 0; - this->unk_AE7 = 4; + this->actionVar1 = 4; this->unk_B8E = 0x14; - this->unk_AE8 = 0; + this->actionVar2 = 0; this->stateFlags3 &= ~PLAYER_STATE3_80000; Magic_Reset(play); } @@ -18653,7 +19080,7 @@ void func_80857BE8(Player* this, PlayState* play) { this->unk_B28 = Math_Atan2S_XY(spA0, spA4); } - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { s32 temp_v0_10 = this->unk_B86[0]; s32 temp_ft3_2 = sp54 * 800.0f; @@ -18661,7 +19088,7 @@ void func_80857BE8(Player* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (temp_ft3_2 != 0) && (((temp_v0_10 + temp_ft3_2) * temp_v0_10) <= 0)) { spE0 = Player_GetFloorSfx(this, NA_SE_PL_GORON_ROLL); - func_8019F780(&this->actor.projectedPos, spE0, sp54); + Audio_PlaySfx_AtPosWithSyncedFreqAndVolume(&this->actor.projectedPos, spE0, sp54); } } } @@ -18680,13 +19107,13 @@ void func_80857BE8(Player* this, PlayState* play) { func_808576BC(play, this); - if (ABS_ALT(this->unk_AE8) > 0xFA0) { + if (ABS_ALT(this->actionVar2) > 0xFA0) { this->stateFlags2 |= PLAYER_STATE2_8; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->linearVelocity = this->unk_B08 * Math_CosS(this->unk_B6C); - this->actor.velocity.y = this->unk_B08 * Math_SinS(this->unk_B6C); + this->linearVelocity = this->unk_B08 * Math_CosS(this->floorPitch); + this->actor.velocity.y = this->unk_B08 * Math_SinS(this->floorPitch); } if ((this->unk_B86[1] != 0) || @@ -18703,14 +19130,14 @@ void func_80857BE8(Player* this, PlayState* play) { this->unk_B86[0] = 0; if (this->unk_B86[1] != 0) { this->actor.gravity = -1.0f; - Math_ScaledStepToS(&this->actor.home.rot.y, spE2, 0x190); + Math_ScaledStepToS(&this->actor.home.rot.y, yawTarget, 0x190); this->unk_B08 = sqrtf(SQ(this->linearVelocity) + SQ(this->actor.velocity.y)) * ((this->linearVelocity >= 0.0f) ? 1.0f : -1.0f); this->unk_B08 = CLAMP_MAX(this->unk_B08, 18.0f); } else { this->unk_B48 += this->actor.velocity.y * 0.005f; - if (this->unk_AE7 == 1) { + if (this->actionVar1 == 1) { if (this->actor.velocity.y > 0.0f) { if ((this->actor.velocity.y + this->actor.gravity) < 0.0f) { this->actor.velocity.y = -this->actor.gravity; @@ -18733,21 +19160,21 @@ void func_80857BE8(Player* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x7D0); - Math_AsymStepToS(&this->unk_AE8, spDC, (spDC >= 0) ? 0x7D0 : 0x3E8, 0x4B0); + Math_AsymStepToS(&this->actionVar2, spDC, (spDC >= 0) ? 0x7D0 : 0x3E8, 0x4B0); - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { spD8 = this->actor.shape.rot.x; - this->actor.shape.rot.x += this->unk_AE8; + this->actor.shape.rot.x += this->actionVar2; - Math_ScaledStepToS(&this->unk_B86[0], 0, ABS_ALT(this->unk_AE8)); - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->unk_AE8 + spD8) * spD8) <= 0)) { + Math_ScaledStepToS(&this->unk_B86[0], 0, ABS_ALT(this->actionVar2)); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actionVar2 + spD8) * spD8) <= 0)) { spE0 = Player_GetFloorSfx(this, (this->unk_B86[1] != 0) ? NA_SE_PL_GORON_CHG_ROLL : NA_SE_PL_GORON_ROLL); - func_8019F780(&this->actor.projectedPos, spE0, this->unk_B08); + Audio_PlaySfx_AtPosWithSyncedFreqAndVolume(&this->actor.projectedPos, spE0, this->unk_B08); } } - if (this->unk_AE7 == 2) { + if (this->actionVar1 == 2) { Player_SetCylinderForAttack(this, DMG_GORON_POUND, 4, 60); Actor_SetPlayerImpact(play, PLAYER_IMPACT_GORON_GROUND_POUND, 2, 100.0f, &this->actor.world.pos); } else if (this->unk_B86[1] != 0) { @@ -18777,66 +19204,89 @@ void func_80858D48(PlayState* play, Player* this, PlayerAnimationHeader* anim) { Player_StopHorizontalMovement(this); } -void func_80858DB4(PlayState* play, Player* this, void* anim) { +PlayerCsAnim sPlayerCsModeAnimFuncs[] = { + NULL, // PLAYER_CSTYPE_NONE + Player_CsAnim_1, // PLAYER_CSTYPE_ANIM_1 + Player_CsAnim_2, // PLAYER_CSTYPE_ANIM_2 + Player_CsAnim_3, // PLAYER_CSTYPE_ANIM_3 + Player_CsAnim_4, // PLAYER_CSTYPE_ANIM_4 + Player_CsAnim_5, // PLAYER_CSTYPE_ANIM_5 + Player_CsAnim_6, // PLAYER_CSTYPE_ANIM_6 + Player_CsAnim_7, // PLAYER_CSTYPE_ANIM_7 + Player_CsAnim_8, // PLAYER_CSTYPE_ANIM_8 + Player_CsAnim_9, // PLAYER_CSTYPE_ANIM_9 + Player_CsAnim_10, // PLAYER_CSTYPE_ANIM_10 + Player_CsAnim_11, // PLAYER_CSTYPE_ANIM_11 + Player_CsAnim_12, // PLAYER_CSTYPE_ANIM_12 + Player_CsAnim_13, // PLAYER_CSTYPE_ANIM_13 + Player_CsAnim_14, // PLAYER_CSTYPE_ANIM_14 + Player_CsAnim_15, // PLAYER_CSTYPE_ANIM_15 + Player_CsAnim_16, // PLAYER_CSTYPE_ANIM_16 + Player_CsAnim_17, // PLAYER_CSTYPE_ANIM_17 + Player_CsAnim_18, // PLAYER_CSTYPE_ANIM_18 + Player_CsAnim_19, // PLAYER_CSTYPE_ANIM_19 +}; + +void Player_CsAnim_1(PlayState* play, Player* this, void* arg2) { Player_StopHorizontalMovement(this); } -void func_80858DDC(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_2(PlayState* play, Player* this, void* anim) { func_80858C84(play, this, anim); } -void func_80858DFC(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_14(PlayState* play, Player* this, void* anim) { func_8082E784(this); func_8082E5A8(play, this, anim); Player_StopHorizontalMovement(this); } -void func_80858E40(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_3(PlayState* play, Player* this, void* anim) { func_80858CC8(play, this, anim); } -void func_80858E60(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_4(PlayState* play, Player* this, void* anim) { func_80858D48(play, this, anim); } -void func_80858E80(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_5(PlayState* play, Player* this, void* anim) { func_8082EA60(play, this, anim); } -void func_80858EA0(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_6(PlayState* play, Player* this, void* anim) { func_8082EA10(play, this, anim, ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } -void func_80858EC0(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_19(PlayState* play, Player* this, void* anim) { Player_AnimationPlayOnceReverse(play, this, anim); func_8082E920(play, this, ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } -void func_80858EFC(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_7(PlayState* play, Player* this, void* anim) { func_8082EB18(play, this, anim); } -void func_80858F1C(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_8(PlayState* play, Player* this, void* anim) { func_8082EAC8(play, this, anim, ANIM_FLAG_4 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } -void func_80858F3C(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_9(PlayState* play, Player* this, void* anim) { Player_AnimationPlayOnce(play, this, anim); } -void func_80858F5C(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_10(PlayState* play, Player* this, void* anim) { Player_AnimationPlayLoop(play, this, anim); } -void func_80858F7C(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_15(PlayState* play, Player* this, void* anim) { func_8082DB90(play, this, anim); } -void func_80858F9C(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_16(PlayState* play, Player* this, void* anim) { func_8082DB60(play, this, anim); } -void func_80858FBC(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_11(PlayState* play, Player* this, void* cue) { PlayerAnimation_Update(play, &this->skelAnime); } @@ -18847,29 +19297,6 @@ void func_80858FE8(Player* this) { } } -void (*D_8085D990[])(PlayState*, Player*, void*) = { - /* 0 */ NULL, - /* 1 */ func_80858DB4, - /* 2 */ func_80858DDC, - /* 3 */ func_80858E40, - /* 4 */ func_80858E60, - /* 5 */ func_80858E80, - /* 6 */ func_80858EA0, - /* 7 */ func_80858EFC, - /* 8 */ func_80858F1C, - /* 9 */ func_80858F3C, - /* 10 */ func_80858F5C, - /* 11 */ func_80858FBC, - /* 12 */ func_80859028, - /* 13 */ func_808591BC, - /* 14 */ func_80858DFC, - /* 15 */ func_80858F7C, - /* 16 */ func_80858F9C, - /* 17 */ func_80859168, - /* 18 */ func_80859210, - /* 19 */ func_80858EC0, -}; - AnimSfxEntry D_8085D9E0[] = { ANIMSFX(ANIMSFX_TYPE_FLOOR_LAND, 34, NA_SE_NONE, CONTINUE), ANIMSFX(ANIMSFX_TYPE_GENERAL, 45, NA_SE_PL_CALM_HIT, CONTINUE), @@ -18961,10 +19388,10 @@ AnimSfxEntry D_8085DA90[] = { ANIMSFX(ANIMSFX_TYPE_GENERAL, 18, NA_SE_PL_SIT_ON_HORSE, STOP), }; -void func_80859028(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_12(PlayState* play, Player* this, void* anim) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_80858D48(play, this, anim); - this->unk_AE8 = 1; + this->actionVar2 = 1; } if (this->skelAnime.animation == &gPlayerAnim_okiagaru_tatu) { @@ -18984,31 +19411,31 @@ void func_80859028(PlayState* play, Player* this, void* anim) { } } -void func_80859168(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_17(PlayState* play, Player* this, void* anim) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8082E794(this); func_8082DB60(play, this, anim); } } -void func_808591BC(PlayState* play, Player* this, void* anim) { +void Player_CsAnim_13(PlayState* play, Player* this, void* anim) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8082EB18(play, this, anim); - this->unk_AE8 = 1; + this->actionVar2 = 1; } } -void func_80859210(PlayState* play, Player* this, void* arg2) { +void Player_CsAnim_18(PlayState* play, Player* this, void* entry) { PlayerAnimation_Update(play, &this->skelAnime); - Player_PlayAnimSfx(this, arg2); + Player_PlayAnimSfx(this, entry); } void func_80859248(Player* this) { - if ((this->unk_398 == NULL) || (this->unk_398->update == NULL)) { - this->unk_398 = NULL; + if ((this->csActor == NULL) || (this->csActor->update == NULL)) { + this->csActor = NULL; } - this->targetedActor = this->unk_398; - if (this->unk_398 != NULL) { + this->lockOnActor = this->csActor; + if (this->csActor != NULL) { this->actor.shape.rot.y = func_8083C62C(this, 0); } } @@ -19024,9 +19451,9 @@ void func_8085929C(PlayState* play, Player* this, UNK_TYPE arg2) { void func_80859300(PlayState* play, Player* this, UNK_TYPE arg2) { this->actor.gravity = 0.0f; - if (this->unk_AE7 == 0) { + if (this->actionVar1 == 0) { if ((this->transformation == PLAYER_FORM_DEKU) || func_8083B3B4(play, this, NULL)) { - this->unk_AE7 = 1; + this->actionVar1 = 1; } else { func_808477D0(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_AAA, -0x2710, 0x320); @@ -19034,7 +19461,7 @@ void func_80859300(PlayState* play, Player* this, UNK_TYPE arg2) { } } else { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE7 == 1) { + if (this->actionVar1 == 1) { func_8082E634(play, this, &gPlayerAnim_link_swimer_swim_wait); } else { Player_AnimationPlayLoop(play, this, &gPlayerAnim_link_swimer_swim_wait); @@ -19045,7 +19472,293 @@ void func_80859300(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_80859414(PlayState* play, Player* this, UNK_TYPE arg2) { +PlayerCsModeEntry sPlayerCsModeInitFuncs[PLAYER_CSMODE_MAX] = { + /* PLAYER_CSMODE_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSMODE_2 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_3 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_4 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_bikkuri } }, + /* PLAYER_CSMODE_5 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_END */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSMODE_8 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_furimuki } }, + /* PLAYER_CSMODE_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, + /* PLAYER_CSMODE_10 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_warp } }, + /* PLAYER_CSMODE_11 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_standup } }, + /* PLAYER_CSMODE_12 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_standup_wait } }, + /* PLAYER_CSMODE_13 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_baru_op3 } }, + /* PLAYER_CSMODE_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_15 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_jibunmiru } }, + /* PLAYER_CSMODE_16 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_14 } }, + /* PLAYER_CSMODE_17 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_normal_okarina_end } }, + /* PLAYER_CSMODE_18 */ { PLAYER_CSTYPE_ANIM_16, { &gPlayerAnim_link_normal_hang_up_down } }, + /* PLAYER_CSMODE_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_16 } }, + /* PLAYER_CSMODE_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_1 } }, + /* PLAYER_CSMODE_21 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_clink_demo_mimawasi } }, + /* PLAYER_CSMODE_22 */ { PLAYER_CSTYPE_ANIM_6, { &gPlayerAnim_om_get_mae } }, + /* PLAYER_CSMODE_23 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_look_hand } }, + /* PLAYER_CSMODE_24 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_normal_wait_typeB_20f } }, + /* PLAYER_CSMODE_25 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_17 } }, + /* PLAYER_CSMODE_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_37 } }, + /* PLAYER_CSMODE_27 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_zeldamiru } }, + /* PLAYER_CSMODE_28 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru1 } }, + /* PLAYER_CSMODE_29 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2 } }, + /* PLAYER_CSMODE_30 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_kenmiru2_modori } }, + /* PLAYER_CSMODE_31 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D310 } }, + /* PLAYER_CSMODE_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_22 } }, + /* PLAYER_CSMODE_33 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_demo_rakka } }, + /* PLAYER_CSMODE_34 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_demo_pikupiku } }, + /* PLAYER_CSMODE_35 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00D2B8 } }, + /* PLAYER_CSMODE_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_25 } }, + /* PLAYER_CSMODE_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_27 } }, + /* PLAYER_CSMODE_38 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D278 } }, + /* PLAYER_CSMODE_39 */ { PLAYER_CSTYPE_ANIM_6, { &gameplay_keep_Linkanim_00D288 } }, + /* PLAYER_CSMODE_40 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakuba } }, + /* PLAYER_CSMODE_41 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_bajyo_furikaeru } }, + /* PLAYER_CSMODE_42 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru } }, + /* PLAYER_CSMODE_43 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okiagaru_tatu } }, + /* PLAYER_CSMODE_44 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_bajyo_walk } }, + /* PLAYER_CSMODE_45 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_rakka } }, + /* PLAYER_CSMODE_46 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_sirimochi } }, + /* PLAYER_CSMODE_47 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_spotlight } }, + /* PLAYER_CSMODE_48 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_hensin } }, + /* PLAYER_CSMODE_49 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_jibunmiru } }, + /* PLAYER_CSMODE_50 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_vs_yousei } }, + /* PLAYER_CSMODE_51 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_urusai } }, + /* PLAYER_CSMODE_52 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_okarinatori } }, + /* PLAYER_CSMODE_53 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse } }, + /* PLAYER_CSMODE_54 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_lost_horse_wait } }, + /* PLAYER_CSMODE_55 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_lost_horse2 } }, + /* PLAYER_CSMODE_56 */ { PLAYER_CSTYPE_ANIM_14, { &gPlayerAnim_okarinatori } }, + /* PLAYER_CSMODE_57 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_tobikakaru } }, + /* PLAYER_CSMODE_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_5 } }, + /* PLAYER_CSMODE_59 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D0A0 } }, + /* PLAYER_CSMODE_60 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_cl_furafura } }, + /* PLAYER_CSMODE_61 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_nigeru } }, + /* PLAYER_CSMODE_62 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_ononoki } }, + /* PLAYER_CSMODE_63 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_gaku } }, + /* PLAYER_CSMODE_64 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa } }, + /* PLAYER_CSMODE_65 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_fuwafuwa_modori } }, + /* PLAYER_CSMODE_66 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_elf_tobidasi } }, + /* PLAYER_CSMODE_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_3 } }, + /* PLAYER_CSMODE_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_29 } }, + /* PLAYER_CSMODE_69 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_31 } }, + /* PLAYER_CSMODE_70 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_tewofuru } }, + /* PLAYER_CSMODE_71 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_jibun_miru } }, + /* PLAYER_CSMODE_72 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_hoo } }, + /* PLAYER_CSMODE_73 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yareyare } }, + /* PLAYER_CSMODE_74 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_yes } }, + /* PLAYER_CSMODE_75 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_no } }, + /* PLAYER_CSMODE_76 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_al_unun } }, + /* PLAYER_CSMODE_77 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_dl_yusaburu } }, + /* PLAYER_CSMODE_78 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_dl_kokeru } }, + /* PLAYER_CSMODE_79 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_powerup } }, + /* PLAYER_CSMODE_80 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_rakkatyu } }, + /* PLAYER_CSMODE_81 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kyoro } }, + /* PLAYER_CSMODE_82 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_yurayura } }, + /* PLAYER_CSMODE_83 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_somukeru } }, + /* PLAYER_CSMODE_84 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_alink_fukitobu } }, + /* PLAYER_CSMODE_85 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFC8 } }, + /* PLAYER_CSMODE_86 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_tereru } }, + /* PLAYER_CSMODE_87 */ { PLAYER_CSTYPE_ANIM_5, { &gameplay_keep_Linkanim_00D1D0 } }, + /* PLAYER_CSMODE_88 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_kaitenmiss } }, + /* PLAYER_CSMODE_89 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFC0 } }, + /* PLAYER_CSMODE_90 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00CFB8 } }, + /* PLAYER_CSMODE_91 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D050 } }, + /* PLAYER_CSMODE_92 */ { PLAYER_CSTYPE_ANIM_4, { &gameplay_keep_Linkanim_00D048 } }, + /* PLAYER_CSMODE_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_42 } }, + /* PLAYER_CSMODE_94 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi } }, + /* PLAYER_CSMODE_95 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ozigi_modori } }, + /* PLAYER_CSMODE_96 */ { PLAYER_CSTYPE_ANIM_9, { &gPlayerAnim_link_normal_back_downA } }, + /* PLAYER_CSMODE_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_35 } }, + /* PLAYER_CSMODE_98 */ { PLAYER_CSTYPE_ANIM_15, { &gPlayerAnim_cl_maskoff } }, + /* PLAYER_CSMODE_99 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_cl_kubisime } }, + /* PLAYER_CSMODE_100 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_alink_ee } }, + /* PLAYER_CSMODE_101 */ { PLAYER_CSTYPE_ANIM_3, { &gameplay_keep_Linkanim_00CFF0 } }, + /* PLAYER_CSMODE_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_40 } }, + /* PLAYER_CSMODE_103 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_45 } }, + /* PLAYER_CSMODE_104 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_dakisime } }, + /* PLAYER_CSMODE_105 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_omen } }, + /* PLAYER_CSMODE_106 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_dakiau } }, + /* PLAYER_CSMODE_107 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_hanare } }, + /* PLAYER_CSMODE_108 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_miseau } }, + /* PLAYER_CSMODE_109 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_kf_awase } }, + /* PLAYER_CSMODE_110 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_kf_tetunagu_loop } }, + /* PLAYER_CSMODE_111 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_keirei } }, + /* PLAYER_CSMODE_112 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umanoru } }, + /* PLAYER_CSMODE_113 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_wakare } }, + /* PLAYER_CSMODE_114 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_alink_dance_loop } }, + /* PLAYER_CSMODE_115 */ { PLAYER_CSTYPE_ANIM_2, { &gPlayerAnim_link_demo_goma_furimuki } }, + /* PLAYER_CSMODE_116 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_link_uma_anim_fastrun } }, + /* PLAYER_CSMODE_117 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_cl_umamiage } }, + /* PLAYER_CSMODE_118 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari1 } }, + /* PLAYER_CSMODE_119 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari2 } }, + /* PLAYER_CSMODE_120 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_demo_suwari3 } }, + /* PLAYER_CSMODE_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_7 } }, + /* PLAYER_CSMODE_122 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_9 } }, + /* PLAYER_CSMODE_124 */ { PLAYER_CSTYPE_ANIM_7, { &gPlayerAnim_clink_demo_get1 } }, + /* PLAYER_CSMODE_125 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get2 } }, + /* PLAYER_CSMODE_126 */ { PLAYER_CSTYPE_ANIM_5, { &gPlayerAnim_clink_demo_get3 } }, + /* PLAYER_CSMODE_127 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_gurad } }, + /* PLAYER_CSMODE_128 */ { PLAYER_CSTYPE_ANIM_4, { &gPlayerAnim_link_demo_sita_wait } }, + /* PLAYER_CSMODE_129 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_1kyoro } }, + /* PLAYER_CSMODE_130 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_2kyoro } }, + /* PLAYER_CSMODE_131 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_sagaru } }, + /* PLAYER_CSMODE_132 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_bouzen } }, + /* PLAYER_CSMODE_133 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_kamaeru } }, + /* PLAYER_CSMODE_134 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_hajikareru } }, + /* PLAYER_CSMODE_135 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_ken_miru } }, + /* PLAYER_CSMODE_136 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_L_mukinaoru } }, + /* PLAYER_CSMODE_137 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_demo_return_to_past } }, + /* PLAYER_CSMODE_138 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion1 } }, + /* PLAYER_CSMODE_139 */ { PLAYER_CSTYPE_ANIM_3, { &gPlayerAnim_link_last_hit_motion2 } }, +}; + +PlayerCsModeEntry sPlayerCsModeUpdateFuncs[PLAYER_CSMODE_MAX] = { + /* PLAYER_CSMODE_NONE */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_1 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_0 } }, + /* PLAYER_CSMODE_2 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_11 } }, + /* PLAYER_CSMODE_3 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_13 } }, + /* PLAYER_CSMODE_4 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_5 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_48 } }, + /* PLAYER_CSMODE_END */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_End } }, + /* PLAYER_CSMODE_WAIT */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, + /* PLAYER_CSMODE_8 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA70 } }, + /* PLAYER_CSMODE_9 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_6 } }, + /* PLAYER_CSMODE_10 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_15 } }, + /* PLAYER_CSMODE_11 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9E0 } }, + /* PLAYER_CSMODE_12 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_13 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_14 */ { PLAYER_CSTYPE_NONE, { NULL } }, + /* PLAYER_CSMODE_15 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_16 */ { PLAYER_CSTYPE_ANIM_17, { &gPlayerAnim_link_normal_okarina_swing } }, + /* PLAYER_CSMODE_17 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_18 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_19 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_39 } }, + /* PLAYER_CSMODE_20 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_2 } }, + /* PLAYER_CSMODE_21 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_clink_demo_mimawasi_wait } }, + /* PLAYER_CSMODE_22 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_19 } }, + /* PLAYER_CSMODE_23 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_look_hand_wait } }, + /* PLAYER_CSMODE_24 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_25 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_26 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_38 } }, + /* PLAYER_CSMODE_27 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_zeldamiru_wait } }, + /* PLAYER_CSMODE_28 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru1_wait } }, + /* PLAYER_CSMODE_29 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_kenmiru2_wait } }, + /* PLAYER_CSMODE_30 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_demo_link_nwait } }, + /* PLAYER_CSMODE_31 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D318 } }, + /* PLAYER_CSMODE_32 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_23 } }, + /* PLAYER_CSMODE_33 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_TranslateReverse } }, + /* PLAYER_CSMODE_34 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_35 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D2C0 } }, + /* PLAYER_CSMODE_36 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_26 } }, + /* PLAYER_CSMODE_37 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_28 } }, + /* PLAYER_CSMODE_38 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D280 } }, + /* PLAYER_CSMODE_39 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00D290 } }, + /* PLAYER_CSMODE_40 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9F0 } }, + /* PLAYER_CSMODE_41 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_42 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA00 } }, + /* PLAYER_CSMODE_43 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_okiagaru_wait } }, + /* PLAYER_CSMODE_44 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSMODE_45 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA2C } }, + /* PLAYER_CSMODE_46 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_sirimochi_wait } }, + /* PLAYER_CSMODE_47 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_spotlight_wait } }, + /* PLAYER_CSMODE_48 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_hensin_loop } }, + /* PLAYER_CSMODE_49 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_dl_jibunmiru_wait } }, + /* PLAYER_CSMODE_50 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA50 } }, + /* PLAYER_CSMODE_51 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_52 */ { PLAYER_CSTYPE_ANIM_18, { D_8085D9FC } }, + /* PLAYER_CSMODE_53 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_lost_horse_wait } }, + /* PLAYER_CSMODE_54 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSMODE_55 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA1C } }, + /* PLAYER_CSMODE_56 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_57 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA0C } }, + /* PLAYER_CSMODE_58 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, + /* PLAYER_CSMODE_59 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_60 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA28 } }, + /* PLAYER_CSMODE_61 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSMODE_62 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_63 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_64 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_al_fuwafuwa_loop } }, + /* PLAYER_CSMODE_65 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, + /* PLAYER_CSMODE_66 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_67 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_4 } }, + /* PLAYER_CSMODE_68 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_30 } }, + /* PLAYER_CSMODE_69 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_70 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_71 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_33 } }, + /* PLAYER_CSMODE_72 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_73 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_74 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_75 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_76 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_77 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_78 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA78 } }, + /* PLAYER_CSMODE_79 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_powerup_loop } }, + /* PLAYER_CSMODE_80 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSMODE_81 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_kyoro_loop } }, + /* PLAYER_CSMODE_82 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_83 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_somukeru_loop } }, + /* PLAYER_CSMODE_84 */ { PLAYER_CSTYPE_ANIM_18, { D_8085DA80 } }, + /* PLAYER_CSMODE_85 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFD0 } }, + /* PLAYER_CSMODE_86 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_87 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_88 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_89 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_90 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_91 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_92 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_93 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_43 } }, + /* PLAYER_CSMODE_94 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ozigi_loop } }, + /* PLAYER_CSMODE_95 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_96 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_34 } }, + /* PLAYER_CSMODE_97 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_36 } }, + /* PLAYER_CSMODE_98 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_46 } }, + /* PLAYER_CSMODE_99 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_100 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_alink_ee_loop } }, + /* PLAYER_CSMODE_101 */ { PLAYER_CSTYPE_ANIM_12, { &gameplay_keep_Linkanim_00CFF8 } }, + /* PLAYER_CSMODE_102 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_41 } }, + /* PLAYER_CSMODE_103 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_104 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_dakisime_loop } }, + /* PLAYER_CSMODE_105 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_omen_loop } }, + /* PLAYER_CSMODE_106 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_dakiau_loop } }, + /* PLAYER_CSMODE_107 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_kf_hanare_loop } }, + /* PLAYER_CSMODE_108 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_109 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_110 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_111 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_kei_wait } }, + /* PLAYER_CSMODE_112 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_umanoru_loop } }, + /* PLAYER_CSMODE_113 */ { PLAYER_CSTYPE_ANIM_13, { &gPlayerAnim_cl_wakare_loop } }, + /* PLAYER_CSMODE_114 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_115 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_44 } }, + /* PLAYER_CSMODE_116 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_117 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_32 } }, + /* PLAYER_CSMODE_118 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_119 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_120 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_121 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_8 } }, + /* PLAYER_CSMODE_122 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_12 } }, + /* PLAYER_CSMODE_123 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_10 } }, + /* PLAYER_CSMODE_125 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_124 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_126 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_127 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_link_demo_gurad_wait } }, + /* PLAYER_CSMODE_128 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_129 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kw } }, + /* PLAYER_CSMODE_130 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_131 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_132 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_133 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_134 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_18 } }, + /* PLAYER_CSMODE_135 */ { PLAYER_CSTYPE_ANIM_11, { NULL } }, + /* PLAYER_CSMODE_136 */ { PLAYER_CSTYPE_ANIM_12, { &gPlayerAnim_L_kennasi_w } }, + /* PLAYER_CSMODE_137 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_20 } }, + /* PLAYER_CSMODE_138 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, + /* PLAYER_CSMODE_139 */ { PLAYER_CSTYPE_ACTION, { Player_CsAction_21 } }, +}; + +void Player_CsAction_0(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80859248(this); if (func_801242B4(this)) { @@ -19053,20 +19766,20 @@ void func_80859414(PlayState* play, Player* this, UNK_TYPE arg2) { } else { PlayerAnimation_Update(play, &this->skelAnime); if (func_801240DC(this) || (this->stateFlags1 & PLAYER_STATE1_800)) { - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } else if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - func_8083D23C(this, play); + Player_ActionChange_2(this, play); } } } -void func_808594D0(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_1(PlayState* play, Player* this, CsCmdActorCue* cue) { if (this->stateFlags1 & PLAYER_STATE1_8000000) { func_8085929C(play, this, 0); } else { PlayerAnimationHeader* anim = D_8085BE84[PLAYER_ANIMGROUP_43][this->modelAnimType]; - if ((this->unk_396 == 6) || (this->unk_396 == 0x2E)) { + if ((this->cueId == PLAYER_CUEID_6) || (this->cueId == PLAYER_CUEID_46)) { Player_AnimationPlayOnce(play, this, anim); } else { func_8082E784(this); @@ -19077,7 +19790,7 @@ void func_808594D0(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_808595B8(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_2(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_80847880(play, this)) { return; } @@ -19090,12 +19803,12 @@ void func_808595B8(PlayState* play, Player* this, UNK_TYPE arg2) { } else { PlayerAnimation_Update(play, &this->skelAnime); if (func_801240DC(this) || (this->stateFlags1 & PLAYER_STATE1_800)) { - func_8083216C(this, play); + Player_UpdateUpperBody(this, play); } } } -void func_8085968C(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_3(PlayState* play, Player* this, CsCmdActorCue* cue) { if (this->actor.id == ACTOR_EN_TEST3) { func_80838830(this, OBJECT_GI_MSSA); this->stateFlags1 |= PLAYER_STATE1_400; @@ -19105,16 +19818,16 @@ void func_8085968C(PlayState* play, Player* this, UNK_TYPE arg2) { (this->transformation == PLAYER_FORM_DEKU) ? &gPlayerAnim_pn_getA : &gPlayerAnim_link_demo_get_itemA); } -void func_80859708(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_4(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Update(play, &this->skelAnime); if ((this->actor.id == ACTOR_EN_TEST3) && Animation_OnFrame(&this->skelAnime, 20.0f)) { this->getItemDrawIdPlusOne = GID_MASK_SUN + 1; - Message_BombersNotebookQueueEvent(play, 0x1B); + Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_ESCAPED_SAKONS_HIDEOUT); Audio_PlayFanfare(NA_BGM_GET_NEW_MASK); } } -void func_8085978C(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_5(PlayState* play, Player* this, CsCmdActorCue* cue) { f32 linearVelocity; s16 yaw; @@ -19137,11 +19850,11 @@ void func_8085978C(PlayState* play, Player* this, UNK_TYPE arg2) { R_PLAY_FILL_SCREEN_G = 255; R_PLAY_FILL_SCREEN_B = 255; R_PLAY_FILL_SCREEN_ALPHA = 0; - play_sound(NA_SE_SY_WHITE_OUT_T); + Audio_PlaySfx(NA_SE_SY_WHITE_OUT_T); } } -void func_80859890(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_6(PlayState* play, Player* this, CsCmdActorCue* cue) { f32 sp24; if (R_PLAY_FILL_SCREEN_ON > 0) { @@ -19152,7 +19865,7 @@ void func_80859890(PlayState* play, Player* this, UNK_TYPE arg2) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; this->actor.update = func_8012301C; this->actor.draw = NULL; - this->unk_AE7 = 0; + this->actionVar1 = 0; } } else if (R_PLAY_FILL_SCREEN_ON < 0) { R_PLAY_FILL_SCREEN_ALPHA += R_PLAY_FILL_SCREEN_ON; @@ -19163,34 +19876,34 @@ void func_80859890(PlayState* play, Player* this, UNK_TYPE arg2) { } else { sp24 = 2.5f; func_808411D4(play, this, &sp24, 0xA); - this->unk_AE8++; - if (this->unk_AE8 >= 0x15) { + this->actionVar2++; + if (this->actionVar2 >= 0x15) { this->csMode = PLAYER_CSMODE_10; } } } -void func_80859990(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_7(PlayState* play, Player* this, CsCmdActorCue* cue) { this->linearVelocity = 2.5f; func_80835BF8(&this->actor.world.pos, this->actor.shape.rot.y, 180.0f, &this->unk_3A0); } -void func_808599DC(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_8(PlayState* play, Player* this, CsCmdActorCue* cue) { f32 sp1C = 2.5f; func_808411D4(play, this, &sp1C, 0xA); } -void func_80859A10(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_9(PlayState* play, Player* this, CsCmdActorCue* cue) { func_8083B23C(this, play); } -void func_80859A44(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_10(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80859248(this); - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { if (PlayerAnimation_Update(play, &this->skelAnime)) { Player_AnimationPlayLoop(play, this, func_8082EF54(this)); - this->unk_AE8 = 0; + this->actionVar2 = 0; } func_8082FC60(this); } else { @@ -19198,49 +19911,48 @@ void func_80859A44(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_80859AD0(PlayState* play, Player* this, UNK_PTR arg2) { - func_80840F90(play, this, arg2, 0.0f, 0, 0); +void Player_CsAction_11(PlayState* play, Player* this, CsCmdActorCue* cue) { + func_80840F90(play, this, cue, 0.0f, 0, 0); } -void func_80859AF8(PlayState* play, Player* this, UNK_PTR arg2) { +void Player_CsAction_12(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actor.shape.face = 0xF; - func_80840F90(play, this, arg2, 0.0f, 0, 0); + func_80840F90(play, this, cue, 0.0f, 0, 0); } -void func_80859B28(PlayState* play, Player* this, UNK_PTR arg2) { - func_80840F90(play, this, arg2, 0.0f, 0, 1); +void Player_CsAction_13(PlayState* play, Player* this, CsCmdActorCue* cue) { + func_80840F90(play, this, cue, 0.0f, 0, 1); } -void func_80859B54(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_14(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80858CC8(play, this, &gPlayerAnim_link_normal_okarina_start); this->itemAction = PLAYER_IA_OCARINA; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } -void Player_Cutscene_Translate(PlayState* play, Player* this, CsCmdActorCue* playerAction) { - f32 startX = playerAction->startPos.x; - f32 startY = playerAction->startPos.y; - f32 startZ = playerAction->startPos.z; - f32 diffX = playerAction->endPos.x - startX; - f32 diffY = playerAction->endPos.y - startY; - f32 diffZ = playerAction->endPos.z - startZ; - f32 progress = (((f32)(play->csCtx.curFrame - playerAction->startFrame)) / - ((f32)(playerAction->endFrame - playerAction->startFrame))); +void Player_Cutscene_Translate(PlayState* play, Player* this, CsCmdActorCue* cue) { + f32 startX = cue->startPos.x; + f32 startY = cue->startPos.y; + f32 startZ = cue->startPos.z; + f32 diffX = cue->endPos.x - startX; + f32 diffY = cue->endPos.y - startY; + f32 diffZ = cue->endPos.z - startZ; + f32 progress = (((f32)(play->csCtx.curFrame - cue->startFrame)) / ((f32)(cue->endFrame - cue->startFrame))); this->actor.world.pos.x = (diffX * progress) + startX; this->actor.world.pos.y = (diffY * progress) + startY; this->actor.world.pos.z = (diffZ * progress) + startZ; } -void func_80859C60(PlayState* play, Player* this, void* arg2) { - if (arg2 != NULL) { - Player_Cutscene_Translate(play, this, arg2); +void Player_CsAction_15(PlayState* play, Player* this, CsCmdActorCue* cue) { + if (cue != NULL) { + Player_Cutscene_Translate(play, this, cue); } PlayerAnimation_Update(play, &this->skelAnime); } -void func_80859CA0(PlayState* play, Player* this, s32 arg2) { +void Player_CsAction_16(PlayState* play, Player* this, CsCmdActorCue* cue) { func_8082E514(play, this, D_8085BE84[PLAYER_ANIMGROUP_43][this->modelAnimType]); Player_StopHorizontalMovement(this); } @@ -19249,301 +19961,15 @@ void func_80859CE0(PlayState* play, Player* this, s32 arg2) { this->actor.draw = Player_Draw; } -void func_80859CFC(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_17(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80841358(play, this, false); func_8082DB90(play, this, &gPlayerAnim_link_demo_return_to_past); } -void func_80859D44(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_18(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Update(play, &this->skelAnime); } -struct_8085DA94 D_8085DA94[PLAYER_CSMODE_MAX] = { - /* PLAYER_CSMODE_0 */ { 0, { NULL } }, - /* PLAYER_CSMODE_1 */ { -1, { func_808594D0 } }, - /* PLAYER_CSMODE_2 */ { 0, { NULL } }, - /* PLAYER_CSMODE_3 */ { 0, { NULL } }, - /* PLAYER_CSMODE_4 */ { 3, { &gPlayerAnim_link_demo_bikkuri } }, - /* PLAYER_CSMODE_5 */ { 0, { NULL } }, - /* PLAYER_CSMODE_END */ { 0, { NULL } }, - /* PLAYER_CSMODE_WAIT */ { -1, { func_808594D0 } }, - /* PLAYER_CSMODE_8 */ { 2, { &gPlayerAnim_link_demo_furimuki } }, - /* PLAYER_CSMODE_9 */ { -1, { func_8085978C } }, - /* PLAYER_CSMODE_10 */ { 3, { &gPlayerAnim_link_demo_warp } }, - /* PLAYER_CSMODE_11 */ { 5, { &gPlayerAnim_clink_demo_standup } }, - /* PLAYER_CSMODE_12 */ { 7, { &gPlayerAnim_clink_demo_standup_wait } }, - /* PLAYER_CSMODE_13 */ { 2, { &gPlayerAnim_link_demo_baru_op3 } }, - /* PLAYER_CSMODE_14 */ { 0, { NULL } }, - /* PLAYER_CSMODE_15 */ { 3, { &gPlayerAnim_link_demo_jibunmiru } }, - /* PLAYER_CSMODE_16 */ { -1, { func_80859B54 } }, - /* PLAYER_CSMODE_17 */ { 2, { &gPlayerAnim_link_normal_okarina_end } }, - /* PLAYER_CSMODE_18 */ { 16, { &gPlayerAnim_link_normal_hang_up_down } }, - /* PLAYER_CSMODE_19 */ { -1, { func_80859CA0 } }, - /* PLAYER_CSMODE_20 */ { -1, { func_808594D0 } }, - /* PLAYER_CSMODE_21 */ { 3, { &gPlayerAnim_clink_demo_mimawasi } }, - /* PLAYER_CSMODE_22 */ { 6, { &gPlayerAnim_om_get_mae } }, - /* PLAYER_CSMODE_23 */ { 3, { &gPlayerAnim_link_demo_look_hand } }, - /* PLAYER_CSMODE_24 */ { 3, { &gPlayerAnim_link_normal_wait_typeB_20f } }, - /* PLAYER_CSMODE_25 */ { -1, { func_80859CFC } }, - /* PLAYER_CSMODE_26 */ { -1, { func_8085A66C } }, - /* PLAYER_CSMODE_27 */ { 3, { &gPlayerAnim_link_demo_zeldamiru } }, - /* PLAYER_CSMODE_28 */ { 3, { &gPlayerAnim_link_demo_kenmiru1 } }, - /* PLAYER_CSMODE_29 */ { 3, { &gPlayerAnim_link_demo_kenmiru2 } }, - /* PLAYER_CSMODE_30 */ { 3, { &gPlayerAnim_link_demo_kenmiru2_modori } }, - /* PLAYER_CSMODE_31 */ { 6, { &gameplay_keep_Linkanim_00D310 } }, - /* PLAYER_CSMODE_32 */ { -1, { func_80859FCC } }, - /* PLAYER_CSMODE_33 */ { 3, { &gPlayerAnim_demo_rakka } }, - /* PLAYER_CSMODE_34 */ { 4, { &gPlayerAnim_demo_pikupiku } }, - /* PLAYER_CSMODE_35 */ { 3, { &gameplay_keep_Linkanim_00D2B8 } }, - /* PLAYER_CSMODE_36 */ { -1, { func_8085A120 } }, - /* PLAYER_CSMODE_37 */ { -1, { func_8085A19C } }, - /* PLAYER_CSMODE_38 */ { 6, { &gameplay_keep_Linkanim_00D278 } }, - /* PLAYER_CSMODE_39 */ { 6, { &gameplay_keep_Linkanim_00D288 } }, - /* PLAYER_CSMODE_40 */ { 5, { &gPlayerAnim_rakuba } }, - /* PLAYER_CSMODE_41 */ { 5, { &gPlayerAnim_bajyo_furikaeru } }, - /* PLAYER_CSMODE_42 */ { 5, { &gPlayerAnim_okiagaru } }, - /* PLAYER_CSMODE_43 */ { 5, { &gPlayerAnim_okiagaru_tatu } }, - /* PLAYER_CSMODE_44 */ { 7, { &gPlayerAnim_bajyo_walk } }, - /* PLAYER_CSMODE_45 */ { 5, { &gPlayerAnim_rakka } }, - /* PLAYER_CSMODE_46 */ { 5, { &gPlayerAnim_sirimochi } }, - /* PLAYER_CSMODE_47 */ { 5, { &gPlayerAnim_spotlight } }, - /* PLAYER_CSMODE_48 */ { 3, { &gPlayerAnim_al_hensin } }, - /* PLAYER_CSMODE_49 */ { 5, { &gPlayerAnim_dl_jibunmiru } }, - /* PLAYER_CSMODE_50 */ { 5, { &gPlayerAnim_vs_yousei } }, - /* PLAYER_CSMODE_51 */ { 5, { &gPlayerAnim_urusai } }, - /* PLAYER_CSMODE_52 */ { 5, { &gPlayerAnim_okarinatori } }, - /* PLAYER_CSMODE_53 */ { 5, { &gPlayerAnim_lost_horse } }, - /* PLAYER_CSMODE_54 */ { 4, { &gPlayerAnim_lost_horse_wait } }, - /* PLAYER_CSMODE_55 */ { 5, { &gPlayerAnim_lost_horse2 } }, - /* PLAYER_CSMODE_56 */ { 14, { &gPlayerAnim_okarinatori } }, - /* PLAYER_CSMODE_57 */ { 5, { &gPlayerAnim_cl_tobikakaru } }, - /* PLAYER_CSMODE_58 */ { -1, { func_8085978C } }, - /* PLAYER_CSMODE_59 */ { 5, { &gameplay_keep_Linkanim_00D0A0 } }, - /* PLAYER_CSMODE_60 */ { 2, { &gPlayerAnim_cl_furafura } }, - /* PLAYER_CSMODE_61 */ { 7, { &gPlayerAnim_cl_nigeru } }, - /* PLAYER_CSMODE_62 */ { 5, { &gPlayerAnim_cl_ononoki } }, - /* PLAYER_CSMODE_63 */ { 3, { &gPlayerAnim_al_gaku } }, - /* PLAYER_CSMODE_64 */ { 3, { &gPlayerAnim_al_fuwafuwa } }, - /* PLAYER_CSMODE_65 */ { 3, { &gPlayerAnim_al_fuwafuwa_modori } }, - /* PLAYER_CSMODE_66 */ { 3, { &gPlayerAnim_al_elf_tobidasi } }, - /* PLAYER_CSMODE_67 */ { -1, { func_8085968C } }, - /* PLAYER_CSMODE_68 */ { -1, { func_8085A24C } }, - /* PLAYER_CSMODE_69 */ { -1, { func_8085A330 } }, - /* PLAYER_CSMODE_70 */ { 7, { &gPlayerAnim_cl_tewofuru } }, - /* PLAYER_CSMODE_71 */ { 5, { &gPlayerAnim_cl_jibun_miru } }, - /* PLAYER_CSMODE_72 */ { 5, { &gPlayerAnim_cl_hoo } }, - /* PLAYER_CSMODE_73 */ { 3, { &gPlayerAnim_al_yareyare } }, - /* PLAYER_CSMODE_74 */ { 3, { &gPlayerAnim_al_yes } }, - /* PLAYER_CSMODE_75 */ { 3, { &gPlayerAnim_al_no } }, - /* PLAYER_CSMODE_76 */ { 3, { &gPlayerAnim_al_unun } }, - /* PLAYER_CSMODE_77 */ { 7, { &gPlayerAnim_dl_yusaburu } }, - /* PLAYER_CSMODE_78 */ { 5, { &gPlayerAnim_dl_kokeru } }, - /* PLAYER_CSMODE_79 */ { 3, { &gPlayerAnim_alink_powerup } }, - /* PLAYER_CSMODE_80 */ { 4, { &gPlayerAnim_alink_rakkatyu } }, - /* PLAYER_CSMODE_81 */ { 3, { &gPlayerAnim_alink_kyoro } }, - /* PLAYER_CSMODE_82 */ { 4, { &gPlayerAnim_alink_yurayura } }, - /* PLAYER_CSMODE_83 */ { 3, { &gPlayerAnim_alink_somukeru } }, - /* PLAYER_CSMODE_84 */ { 5, { &gPlayerAnim_alink_fukitobu } }, - /* PLAYER_CSMODE_85 */ { 3, { &gameplay_keep_Linkanim_00CFC8 } }, - /* PLAYER_CSMODE_86 */ { 4, { &gPlayerAnim_alink_tereru } }, - /* PLAYER_CSMODE_87 */ { 5, { &gameplay_keep_Linkanim_00D1D0 } }, - /* PLAYER_CSMODE_88 */ { 3, { &gPlayerAnim_alink_kaitenmiss } }, - /* PLAYER_CSMODE_89 */ { 4, { &gameplay_keep_Linkanim_00CFC0 } }, - /* PLAYER_CSMODE_90 */ { 4, { &gameplay_keep_Linkanim_00CFB8 } }, - /* PLAYER_CSMODE_91 */ { 4, { &gameplay_keep_Linkanim_00D050 } }, - /* PLAYER_CSMODE_92 */ { 4, { &gameplay_keep_Linkanim_00D048 } }, - /* PLAYER_CSMODE_93 */ { -1, { func_8085A8C4 } }, - /* PLAYER_CSMODE_94 */ { 3, { &gPlayerAnim_alink_ozigi } }, - /* PLAYER_CSMODE_95 */ { 3, { &gPlayerAnim_alink_ozigi_modori } }, - /* PLAYER_CSMODE_96 */ { 9, { &gPlayerAnim_link_normal_back_downA } }, - /* PLAYER_CSMODE_97 */ { -1, { func_8085A530 } }, - /* PLAYER_CSMODE_98 */ { 15, { &gPlayerAnim_cl_maskoff } }, - /* PLAYER_CSMODE_99 */ { 7, { &gPlayerAnim_cl_kubisime } }, - /* PLAYER_CSMODE_100 */ { 3, { &gPlayerAnim_alink_ee } }, - /* PLAYER_CSMODE_101 */ { 3, { &gameplay_keep_Linkanim_00CFF0 } }, - /* PLAYER_CSMODE_102 */ { -1, { func_8085A768 } }, - /* PLAYER_CSMODE_103 */ { -1, { func_8085AA60 } }, - /* PLAYER_CSMODE_104 */ { 5, { &gPlayerAnim_cl_dakisime } }, - /* PLAYER_CSMODE_105 */ { 5, { &gPlayerAnim_kf_omen } }, - /* PLAYER_CSMODE_106 */ { 5, { &gPlayerAnim_kf_dakiau } }, - /* PLAYER_CSMODE_107 */ { 5, { &gPlayerAnim_kf_hanare } }, - /* PLAYER_CSMODE_108 */ { 5, { &gPlayerAnim_kf_miseau } }, - /* PLAYER_CSMODE_109 */ { 5, { &gPlayerAnim_kf_awase } }, - /* PLAYER_CSMODE_110 */ { 7, { &gPlayerAnim_kf_tetunagu_loop } }, - /* PLAYER_CSMODE_111 */ { 3, { &gPlayerAnim_link_keirei } }, - /* PLAYER_CSMODE_112 */ { 5, { &gPlayerAnim_cl_umanoru } }, - /* PLAYER_CSMODE_113 */ { 5, { &gPlayerAnim_cl_wakare } }, - /* PLAYER_CSMODE_114 */ { 4, { &gPlayerAnim_alink_dance_loop } }, - /* PLAYER_CSMODE_115 */ { 2, { &gPlayerAnim_link_demo_goma_furimuki } }, - /* PLAYER_CSMODE_116 */ { 7, { &gPlayerAnim_link_uma_anim_fastrun } }, - /* PLAYER_CSMODE_117 */ { 5, { &gPlayerAnim_cl_umamiage } }, - /* PLAYER_CSMODE_118 */ { 7, { &gPlayerAnim_demo_suwari1 } }, - /* PLAYER_CSMODE_119 */ { 7, { &gPlayerAnim_demo_suwari2 } }, - /* PLAYER_CSMODE_120 */ { 7, { &gPlayerAnim_demo_suwari3 } }, - /* PLAYER_CSMODE_121 */ { -1, { func_80859990 } }, - /* PLAYER_CSMODE_122 */ { 0, { NULL } }, - /* PLAYER_CSMODE_123 */ { -1, { func_80859A10 } }, - /* PLAYER_CSMODE_124 */ { 7, { &gPlayerAnim_clink_demo_get1 } }, - /* PLAYER_CSMODE_125 */ { 5, { &gPlayerAnim_clink_demo_get2 } }, - /* PLAYER_CSMODE_126 */ { 5, { &gPlayerAnim_clink_demo_get3 } }, - /* PLAYER_CSMODE_127 */ { 3, { &gPlayerAnim_link_demo_gurad } }, - /* PLAYER_CSMODE_128 */ { 4, { &gPlayerAnim_link_demo_sita_wait } }, - /* PLAYER_CSMODE_129 */ { 3, { &gPlayerAnim_L_1kyoro } }, - /* PLAYER_CSMODE_130 */ { 3, { &gPlayerAnim_L_2kyoro } }, - /* PLAYER_CSMODE_131 */ { 3, { &gPlayerAnim_L_sagaru } }, - /* PLAYER_CSMODE_132 */ { 3, { &gPlayerAnim_L_bouzen } }, - /* PLAYER_CSMODE_133 */ { 3, { &gPlayerAnim_L_kamaeru } }, - /* PLAYER_CSMODE_134 */ { 3, { &gPlayerAnim_L_hajikareru } }, - /* PLAYER_CSMODE_135 */ { 3, { &gPlayerAnim_L_ken_miru } }, - /* PLAYER_CSMODE_136 */ { 3, { &gPlayerAnim_L_mukinaoru } }, - /* PLAYER_CSMODE_137 */ { 3, { &gPlayerAnim_link_demo_return_to_past } }, - /* PLAYER_CSMODE_138 */ { 3, { &gPlayerAnim_link_last_hit_motion1 } }, - /* PLAYER_CSMODE_139 */ { 3, { &gPlayerAnim_link_last_hit_motion2 } }, -}; - -struct_8085DA94 D_8085DEF4[PLAYER_CSMODE_MAX] = { - /* PLAYER_CSMODE_0 */ { 0, { NULL } }, - /* PLAYER_CSMODE_1 */ { -1, { func_80859414 } }, - /* PLAYER_CSMODE_2 */ { -1, { func_80859AD0 } }, - /* PLAYER_CSMODE_3 */ { -1, { func_80859B28 } }, - /* PLAYER_CSMODE_4 */ { 11, { NULL } }, - /* PLAYER_CSMODE_5 */ { -1, { func_8085ADA0 } }, - /* PLAYER_CSMODE_END */ { -1, { func_8085AACC } }, - /* PLAYER_CSMODE_WAIT */ { -1, { func_808595B8 } }, - /* PLAYER_CSMODE_8 */ { 18, { D_8085DA70 } }, - /* PLAYER_CSMODE_9 */ { -1, { func_80859890 } }, - /* PLAYER_CSMODE_10 */ { -1, { func_80859C60 } }, - /* PLAYER_CSMODE_11 */ { 18, { D_8085D9E0 } }, - /* PLAYER_CSMODE_12 */ { 11, { NULL } }, - /* PLAYER_CSMODE_13 */ { 11, { NULL } }, - /* PLAYER_CSMODE_14 */ { 0, { NULL } }, - /* PLAYER_CSMODE_15 */ { 11, { NULL } }, - /* PLAYER_CSMODE_16 */ { 17, { &gPlayerAnim_link_normal_okarina_swing } }, - /* PLAYER_CSMODE_17 */ { 11, { NULL } }, - /* PLAYER_CSMODE_18 */ { 11, { NULL } }, - /* PLAYER_CSMODE_19 */ { -1, { func_8085A710 } }, - /* PLAYER_CSMODE_20 */ { -1, { func_808595B8 } }, - /* PLAYER_CSMODE_21 */ { 12, { &gPlayerAnim_clink_demo_mimawasi_wait } }, - /* PLAYER_CSMODE_22 */ { -1, { func_80859D70 } }, - /* PLAYER_CSMODE_23 */ { 12, { &gPlayerAnim_link_demo_look_hand_wait } }, - /* PLAYER_CSMODE_24 */ { 11, { NULL } }, - /* PLAYER_CSMODE_25 */ { 11, { NULL } }, - /* PLAYER_CSMODE_26 */ { -1, { func_8085A6C0 } }, - /* PLAYER_CSMODE_27 */ { 12, { &gPlayerAnim_link_demo_zeldamiru_wait } }, - /* PLAYER_CSMODE_28 */ { 12, { &gPlayerAnim_link_demo_kenmiru1_wait } }, - /* PLAYER_CSMODE_29 */ { 12, { &gPlayerAnim_link_demo_kenmiru2_wait } }, - /* PLAYER_CSMODE_30 */ { 12, { &gPlayerAnim_demo_link_nwait } }, - /* PLAYER_CSMODE_31 */ { 12, { &gameplay_keep_Linkanim_00D318 } }, - /* PLAYER_CSMODE_32 */ { -1, { func_80859FF4 } }, - /* PLAYER_CSMODE_33 */ { -1, { Player_Cutscene_TranslateReverse } }, - /* PLAYER_CSMODE_34 */ { 11, { NULL } }, - /* PLAYER_CSMODE_35 */ { 12, { &gameplay_keep_Linkanim_00D2C0 } }, - /* PLAYER_CSMODE_36 */ { -1, { func_8085A144 } }, - /* PLAYER_CSMODE_37 */ { -1, { func_8085A1D4 } }, - /* PLAYER_CSMODE_38 */ { 12, { &gameplay_keep_Linkanim_00D280 } }, - /* PLAYER_CSMODE_39 */ { 12, { &gameplay_keep_Linkanim_00D290 } }, - /* PLAYER_CSMODE_40 */ { 18, { D_8085D9F0 } }, - /* PLAYER_CSMODE_41 */ { 11, { NULL } }, - /* PLAYER_CSMODE_42 */ { 18, { D_8085DA00 } }, - /* PLAYER_CSMODE_43 */ { 13, { &gPlayerAnim_okiagaru_wait } }, - /* PLAYER_CSMODE_44 */ { -1, { func_8085A364 } }, - /* PLAYER_CSMODE_45 */ { 18, { D_8085DA2C } }, - /* PLAYER_CSMODE_46 */ { 12, { &gPlayerAnim_sirimochi_wait } }, - /* PLAYER_CSMODE_47 */ { 12, { &gPlayerAnim_spotlight_wait } }, - /* PLAYER_CSMODE_48 */ { 12, { &gPlayerAnim_al_hensin_loop } }, - /* PLAYER_CSMODE_49 */ { 12, { &gPlayerAnim_dl_jibunmiru_wait } }, - /* PLAYER_CSMODE_50 */ { 18, { D_8085DA50 } }, - /* PLAYER_CSMODE_51 */ { 11, { NULL } }, - /* PLAYER_CSMODE_52 */ { 18, { D_8085D9FC } }, - /* PLAYER_CSMODE_53 */ { 12, { &gPlayerAnim_lost_horse_wait } }, - /* PLAYER_CSMODE_54 */ { -1, { func_8085A364 } }, - /* PLAYER_CSMODE_55 */ { 18, { D_8085DA1C } }, - /* PLAYER_CSMODE_56 */ { 11, { NULL } }, - /* PLAYER_CSMODE_57 */ { 18, { D_8085DA0C } }, - /* PLAYER_CSMODE_58 */ { -1, { func_808599DC } }, - /* PLAYER_CSMODE_59 */ { 11, { NULL } }, - /* PLAYER_CSMODE_60 */ { 18, { D_8085DA28 } }, - /* PLAYER_CSMODE_61 */ { -1, { func_8085A364 } }, - /* PLAYER_CSMODE_62 */ { 11, { NULL } }, - /* PLAYER_CSMODE_63 */ { 11, { NULL } }, - /* PLAYER_CSMODE_64 */ { 12, { &gPlayerAnim_al_fuwafuwa_loop } }, - /* PLAYER_CSMODE_65 */ { -1, { func_8085A40C } }, - /* PLAYER_CSMODE_66 */ { 11, { NULL } }, - /* PLAYER_CSMODE_67 */ { -1, { func_80859708 } }, - /* PLAYER_CSMODE_68 */ { -1, { func_8085A2AC } }, - /* PLAYER_CSMODE_69 */ { 11, { NULL } }, - /* PLAYER_CSMODE_70 */ { 11, { NULL } }, - /* PLAYER_CSMODE_71 */ { -1, { func_8085A40C } }, - /* PLAYER_CSMODE_72 */ { 11, { NULL } }, - /* PLAYER_CSMODE_73 */ { 11, { NULL } }, - /* PLAYER_CSMODE_74 */ { 11, { NULL } }, - /* PLAYER_CSMODE_75 */ { 11, { NULL } }, - /* PLAYER_CSMODE_76 */ { 11, { NULL } }, - /* PLAYER_CSMODE_77 */ { 11, { NULL } }, - /* PLAYER_CSMODE_78 */ { 18, { D_8085DA78 } }, - /* PLAYER_CSMODE_79 */ { 12, { &gPlayerAnim_alink_powerup_loop } }, - /* PLAYER_CSMODE_80 */ { -1, { func_8085A364 } }, - /* PLAYER_CSMODE_81 */ { 12, { &gPlayerAnim_alink_kyoro_loop } }, - /* PLAYER_CSMODE_82 */ { 11, { NULL } }, - /* PLAYER_CSMODE_83 */ { 12, { &gPlayerAnim_alink_somukeru_loop } }, - /* PLAYER_CSMODE_84 */ { 18, { D_8085DA80 } }, - /* PLAYER_CSMODE_85 */ { 12, { &gameplay_keep_Linkanim_00CFD0 } }, - /* PLAYER_CSMODE_86 */ { 11, { NULL } }, - /* PLAYER_CSMODE_87 */ { 11, { NULL } }, - /* PLAYER_CSMODE_88 */ { 11, { NULL } }, - /* PLAYER_CSMODE_89 */ { 11, { NULL } }, - /* PLAYER_CSMODE_90 */ { 11, { NULL } }, - /* PLAYER_CSMODE_91 */ { 11, { NULL } }, - /* PLAYER_CSMODE_92 */ { 11, { NULL } }, - /* PLAYER_CSMODE_93 */ { -1, { func_8085A940 } }, - /* PLAYER_CSMODE_94 */ { 12, { &gPlayerAnim_alink_ozigi_loop } }, - /* PLAYER_CSMODE_95 */ { 11, { NULL } }, - /* PLAYER_CSMODE_96 */ { -1, { func_8085A4A4 } }, - /* PLAYER_CSMODE_97 */ { -1, { func_8085A5DC } }, - /* PLAYER_CSMODE_98 */ { -1, { func_8085AA84 } }, - /* PLAYER_CSMODE_99 */ { 11, { NULL } }, - /* PLAYER_CSMODE_100 */ { 12, { &gPlayerAnim_alink_ee_loop } }, - /* PLAYER_CSMODE_101 */ { 12, { &gameplay_keep_Linkanim_00CFF8 } }, - /* PLAYER_CSMODE_102 */ { -1, { func_8085A7C0 } }, - /* PLAYER_CSMODE_103 */ { 11, { NULL } }, - /* PLAYER_CSMODE_104 */ { 13, { &gPlayerAnim_cl_dakisime_loop } }, - /* PLAYER_CSMODE_105 */ { 13, { &gPlayerAnim_kf_omen_loop } }, - /* PLAYER_CSMODE_106 */ { 13, { &gPlayerAnim_kf_dakiau_loop } }, - /* PLAYER_CSMODE_107 */ { 13, { &gPlayerAnim_kf_hanare_loop } }, - /* PLAYER_CSMODE_108 */ { 11, { NULL } }, - /* PLAYER_CSMODE_109 */ { 11, { NULL } }, - /* PLAYER_CSMODE_110 */ { 11, { NULL } }, - /* PLAYER_CSMODE_111 */ { 12, { &gPlayerAnim_link_kei_wait } }, - /* PLAYER_CSMODE_112 */ { 13, { &gPlayerAnim_cl_umanoru_loop } }, - /* PLAYER_CSMODE_113 */ { 13, { &gPlayerAnim_cl_wakare_loop } }, - /* PLAYER_CSMODE_114 */ { 11, { NULL } }, - /* PLAYER_CSMODE_115 */ { -1, { func_8085AA10 } }, - /* PLAYER_CSMODE_116 */ { 11, { NULL } }, - /* PLAYER_CSMODE_117 */ { -1, { func_8085A364 } }, - /* PLAYER_CSMODE_118 */ { 11, { NULL } }, - /* PLAYER_CSMODE_119 */ { 11, { NULL } }, - /* PLAYER_CSMODE_120 */ { 11, { NULL } }, - /* PLAYER_CSMODE_121 */ { -1, { func_808599DC } }, - /* PLAYER_CSMODE_122 */ { -1, { func_80859AF8 } }, - /* PLAYER_CSMODE_123 */ { -1, { func_80859A44 } }, - /* PLAYER_CSMODE_124 */ { 11, { NULL } }, - /* PLAYER_CSMODE_125 */ { 11, { NULL } }, - /* PLAYER_CSMODE_126 */ { 11, { NULL } }, - /* PLAYER_CSMODE_127 */ { 12, { &gPlayerAnim_link_demo_gurad_wait } }, - /* PLAYER_CSMODE_128 */ { 11, { NULL } }, - /* PLAYER_CSMODE_129 */ { 12, { &gPlayerAnim_L_kw } }, - /* PLAYER_CSMODE_130 */ { 11, { NULL } }, - /* PLAYER_CSMODE_131 */ { 11, { NULL } }, - /* PLAYER_CSMODE_132 */ { 11, { NULL } }, - /* PLAYER_CSMODE_133 */ { 11, { NULL } }, - /* PLAYER_CSMODE_134 */ { -1, { func_80859D44 } }, - /* PLAYER_CSMODE_135 */ { 11, { NULL } }, - /* PLAYER_CSMODE_136 */ { 12, { &gPlayerAnim_L_kennasi_w } }, - /* PLAYER_CSMODE_137 */ { -1, { func_80859EBC } }, - /* PLAYER_CSMODE_138 */ { -1, { func_80859F4C } }, - /* PLAYER_CSMODE_139 */ { -1, { func_80859F4C } }, -}; - PlayerAnimationHeader* D_8085E354[PLAYER_FORM_MAX] = { &gPlayerAnim_L_okarina_get, // PLAYER_FORM_FIERCE_DEITY &gPlayerAnim_L_okarina_get, // PLAYER_FORM_GORON @@ -19563,12 +19989,12 @@ struct_8085E368 D_8085E368[PLAYER_FORM_MAX] = { Color_RGBA8 D_8085E3A4 = { 255, 255, 255, 0 }; Color_RGBA8 D_8085E3A8 = { 0, 128, 128, 0 }; -void func_80859D70(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_19(PlayState* play, Player* this, CsCmdActorCue* cue) { struct_8085E368* posInfo; Vec3f effectPos; Vec3f randPos; - func_808591BC(play, this, D_8085E354[this->transformation]); + Player_CsAnim_13(play, this, D_8085E354[this->transformation]); if (this->rightHandType != 0xFF) { this->rightHandType = 0xFF; @@ -19582,10 +20008,10 @@ void func_80859D70(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_80859EBC(PlayState* play, Player* this, s32 arg2) { +void Player_CsAction_20(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - func_8085AACC(play, this, arg2); - } else if (this->unk_AE8 == 0) { + Player_CsAction_End(play, this, cue); + } else if (this->actionVar2 == 0) { Item_Give(play, ITEM_SWORD_RAZOR); func_80841358(play, this, false); } else { @@ -19593,7 +20019,7 @@ void func_80859EBC(PlayState* play, Player* this, s32 arg2) { } } -void func_80859F4C(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_21(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8083FCF0(play, this, 0.0f, 99.0f, this->skelAnime.endFrame - 8.0f); } @@ -19602,36 +20028,42 @@ void func_80859F4C(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_80859FCC(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_22(PlayState* play, Player* this, CsCmdActorCue* cue) { if (this->transformation != PLAYER_FORM_DEKU) { gSaveContext.save.playerForm = PLAYER_FORM_DEKU; } } -void func_80859FF4(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_23(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Update(play, &this->skelAnime); - if (gSaveContext.save.playerForm != this->transformation) { + if (GET_PLAYER_FORM != this->transformation) { this->actor.update = func_8012301C; this->actor.draw = NULL; } } -void Player_Cutscene_TranslateReverse(PlayState* play, Player* this, void* arg) { - CsCmdActorCue* playerAction = arg; - f32 xEnd = playerAction->endPos.x; - f32 yEnd = playerAction->endPos.y; - f32 zEnd = playerAction->endPos.z; +void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue) { + s32 pad; + f32 xEnd; + f32 yEnd; + f32 zEnd; f32 xDiff; f32 yDiff; f32 zDiff; f32 progress; - xDiff = playerAction->startPos.x - xEnd; - yDiff = playerAction->startPos.y - yEnd; - zDiff = playerAction->startPos.z - zEnd; + xEnd = cue->endPos.x; + yEnd = cue->endPos.y; + zEnd = cue->endPos.z; - progress = ((f32)(playerAction->endFrame - play->csCtx.curFrame)) / - ((f32)(playerAction->endFrame - playerAction->startFrame)); + xDiff = cue->startPos.x - xEnd; + yDiff = cue->startPos.y - yEnd; + zDiff = cue->startPos.z - zEnd; + + //! FAKE: + if (1) {} + + progress = ((f32)(cue->endFrame - play->csCtx.curFrame)) / ((f32)(cue->endFrame - cue->startFrame)); this->actor.world.pos.x = (xDiff * progress) + xEnd; this->actor.world.pos.y = (yDiff * progress) + yEnd; @@ -19639,54 +20071,54 @@ void Player_Cutscene_TranslateReverse(PlayState* play, Player* this, void* arg) PlayerAnimation_Update(play, &this->skelAnime); } -void func_8085A120(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_25(PlayState* play, Player* this, CsCmdActorCue* cue) { if (this->transformation != PLAYER_FORM_FIERCE_DEITY) { gSaveContext.save.playerForm = PLAYER_FORM_FIERCE_DEITY; } } -void func_8085A144(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_26(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Update(play, &this->skelAnime); - if (gSaveContext.save.playerForm != this->transformation) { + if (GET_PLAYER_FORM != this->transformation) { this->actor.update = func_8012301C; this->actor.draw = NULL; } } -void func_8085A19C(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_27(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimationPlayOnce(play, this, &gPlayerAnim_demo_rakka); this->unk_AAA = -0x8000; } -void func_8085A1D4(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_28(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Update(play, &this->skelAnime); this->actor.gravity = 0.0f; Math_StepToF(&this->actor.velocity.y, -this->actor.terminalVelocity, -((f32)REG(68) / 100.0f)); } -void func_8085A24C(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_29(PlayState* play, Player* this, CsCmdActorCue* cue) { func_8082DB90(play, this, D_8085D17C[this->transformation]); this->itemAction = PLAYER_IA_OCARINA; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } -void func_8085A2AC(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_30(PlayState* play, Player* this, CsCmdActorCue* cue) { if ((PlayerAnimation_Update(play, &this->skelAnime)) && (this->skelAnime.animation == D_8085D17C[this->transformation])) { func_808525C4(play, this); return; } - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { func_8085255C(play, this); } } -void func_8085A330(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_31(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]); } -void func_8085A364(PlayState* play, Player* this, void* arg2) { - Player_Cutscene_Translate(play, this, arg2); +void Player_CsAction_32(PlayState* play, Player* this, CsCmdActorCue* cue) { + Player_Cutscene_Translate(play, this, cue); if (PlayerAnimation_Update(play, &this->skelAnime)) { func_8082EB18(play, this, &gPlayerAnim_cl_umamiage_loop); } @@ -19694,15 +20126,15 @@ void func_8085A364(PlayState* play, Player* this, void* arg2) { if (this->skelAnime.animation == &gPlayerAnim_cl_nigeru) { Player_PlayAnimSfx(this, D_8085DA48); } else if (this->skelAnime.animation == &gPlayerAnim_alink_rakkatyu) { - func_800B8F98(&this->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); + Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); } else { func_80858FE8(this); } } -void func_8085A40C(PlayState* play, Player* this, void* arg2) { +void Player_CsAction_33(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - func_80859CA0(play, this, arg2); + Player_CsAction_16(play, this, cue); } else if (this->skelAnime.animation == &gPlayerAnim_al_fuwafuwa_modori) { Player_PlayAnimSfx(this, D_8085DA88); } else if (this->skelAnime.animation == &gPlayerAnim_cl_jibun_miru) { @@ -19710,76 +20142,76 @@ void func_8085A40C(PlayState* play, Player* this, void* arg2) { } } -void func_8085A4A4(PlayState* play, Player* this, void* arg2) { - if (PlayerAnimation_Update(play, &this->skelAnime) && (this->unk_AE8 == 0) && +void Player_CsAction_34(PlayState* play, Player* this, CsCmdActorCue* cue) { + if (PlayerAnimation_Update(play, &this->skelAnime) && (this->actionVar2 == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_back_downB); - this->unk_AE8 = 1; + this->actionVar2 = 1; } - if (this->unk_AE8 != 0) { + if (this->actionVar2 != 0) { func_80832F24(this); } } -void func_8085A530(PlayState* play, Player* this, void* arg2) { +void Player_CsAction_35(PlayState* play, Player* this, CsCmdActorCue* cue) { PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_normal_give_other, 1.0f, (play->sceneId == SCENE_ALLEY) ? IREG(56) : 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_normal_give_other), ANIMMODE_ONCE, -8.0f); } -void func_8085A5DC(PlayState* play, Player* this, void* arg2) { +void Player_CsAction_36(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8++ >= 0x15) { + if (this->actionVar2++ >= 0x15) { PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_pz_wait, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -16.0f); } } } -void func_8085A66C(PlayState* play, Player* this, void* arg2) { +void Player_CsAction_37(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_801242B4(this)) { func_8085929C(play, this, 0); } else { - func_80858E40(play, this, &gPlayerAnim_link_demo_kousan); + Player_CsAnim_3(play, this, &gPlayerAnim_link_demo_kousan); } } -void func_8085A6C0(PlayState* play, Player* this, void* anim) { +void Player_CsAction_38(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_801242B4(this)) { func_80859300(play, this, 0); } else { - func_80858FBC(play, this, anim); + Player_CsAnim_11(play, this, cue); } } -void func_8085A710(PlayState* play, Player* this, void* anim) { - func_80858FBC(play, this, anim); - if (func_8083D23C(this, play)) { +void Player_CsAction_39(PlayState* play, Player* this, CsCmdActorCue* cue) { + Player_CsAnim_11(play, this, cue); + if (Player_ActionChange_2(this, play)) { play->csCtx.state = CS_STATE_STOP; CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); } } -void func_8085A768(PlayState* play, Player* this, void* arg2) { +void Player_CsAction_40(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80838830(this, OBJECT_GI_RESERVE_C_01); - func_80858E40(play, this, &gPlayerAnim_link_normal_give_other); + Player_CsAnim_3(play, this, &gPlayerAnim_link_normal_give_other); this->stateFlags2 &= ~PLAYER_STATE2_1000000; } -void func_8085A7C0(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_41(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { - if (this->unk_AE8 == 0) { + if (this->actionVar2 == 0) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->getItemDrawIdPlusOne = GID_NONE + 1; - this->unk_AE8 = -1; + this->actionVar2 = -1; } else { this->getItemDrawIdPlusOne = GID_PENDANT_OF_MEMORIES + 1; } - } else if (this->unk_AE8 < 0) { + } else if (this->actionVar2 < 0) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->unk_AE8 = 1; + this->actionVar2 = 1; } else { Actor_OfferGetItem(&this->actor, play, GI_PENDANT_OF_MEMORIES, 9999.9f, 9999.9f); } @@ -19789,18 +20221,18 @@ void func_8085A7C0(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_8085A8C4(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_42(PlayState* play, Player* this, CsCmdActorCue* cue) { if ((this->transformation != PLAYER_FORM_HUMAN) && (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_5)) { R_PLAY_FILL_SCREEN_ON = 45; R_PLAY_FILL_SCREEN_R = 255; R_PLAY_FILL_SCREEN_G = 255; R_PLAY_FILL_SCREEN_B = 255; R_PLAY_FILL_SCREEN_ALPHA = 0; - play_sound(NA_SE_SY_WHITE_OUT_T); + Audio_PlaySfx(NA_SE_SY_WHITE_OUT_T); } } -void func_8085A940(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_43(PlayState* play, Player* this, CsCmdActorCue* cue) { if (R_PLAY_FILL_SCREEN_ON > 0) { R_PLAY_FILL_SCREEN_ALPHA += R_PLAY_FILL_SCREEN_ON; if (R_PLAY_FILL_SCREEN_ALPHA > 255) { @@ -19809,7 +20241,7 @@ void func_8085A940(PlayState* play, Player* this, UNK_TYPE arg2) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; this->actor.update = func_8012301C; this->actor.draw = NULL; - this->unk_AE7 = 0; + this->actionVar1 = 0; } } else if (R_PLAY_FILL_SCREEN_ON < 0) { R_PLAY_FILL_SCREEN_ALPHA += R_PLAY_FILL_SCREEN_ON; @@ -19822,57 +20254,57 @@ void func_8085A940(PlayState* play, Player* this, UNK_TYPE arg2) { } } -void func_8085AA10(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_44(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime) && (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR)) { CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); } } -void func_8085AA60(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_45(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80848640(play, this); } -void func_8085AA84(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_46(PlayState* play, Player* this, CsCmdActorCue* cue) { if (PlayerAnimation_Update(play, &this->skelAnime)) { this->stateFlags2 |= PLAYER_STATE2_1000000; } } -void func_8085AACC(PlayState* play, Player* this, UNK_TYPE arg2) { +void Player_CsAction_End(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_801242B4(this)) { func_808353DC(play, this); func_8082DC64(play, this); } else { func_80839ED0(this, play); - if (!func_808391D8(this, play)) { - func_8083D23C(this, play); + if (!Player_ActionChange_4(this, play)) { + Player_ActionChange_2(this, play); } } - this->csMode = PLAYER_CSMODE_0; + this->csMode = PLAYER_CSMODE_NONE; this->unk_AA5 = PLAYER_UNKAA5_0; } -void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* playerAction) { - this->actor.world.pos.x = playerAction->startPos.x; - this->actor.world.pos.y = playerAction->startPos.y; - this->actor.world.pos.z = playerAction->startPos.z; +void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* cue) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; + this->actor.world.pos.z = cue->startPos.z; - this->currentYaw = this->actor.shape.rot.y = playerAction->rot.y; + this->currentYaw = this->actor.shape.rot.y = cue->rot.y; } -void Player_Cutscene_8085ABA8(Player* this, CsCmdActorCue* playerAction) { - f32 xDiff = playerAction->startPos.x - (s32)this->actor.world.pos.x; - f32 yDiff = playerAction->startPos.y - (s32)this->actor.world.pos.y; - f32 zDiff = playerAction->startPos.z - (s32)this->actor.world.pos.z; +void Player_Cutscene_8085ABA8(Player* this, CsCmdActorCue* cue) { + f32 xDiff = cue->startPos.x - (s32)this->actor.world.pos.x; + f32 yDiff = cue->startPos.y - (s32)this->actor.world.pos.y; + f32 zDiff = cue->startPos.z - (s32)this->actor.world.pos.z; f32 dist; s16 temp_v0; - temp_v0 = (s16)playerAction->rot.y - this->actor.shape.rot.y; + temp_v0 = (s16)cue->rot.y - this->actor.shape.rot.y; dist = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)); if (this->linearVelocity == 0.0f) { if ((dist > 50.0f) || (ABS_ALT(temp_v0) > 0x4000)) { - Player_Cutscene_SetPosAndYawToStart(this, playerAction); + Player_Cutscene_SetPosAndYawToStart(this, cue); } } @@ -19880,11 +20312,11 @@ void Player_Cutscene_8085ABA8(Player* this, CsCmdActorCue* playerAction) { func_8082E784(this); } -void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_8085DA94* arg3) { - if (arg3->type > 0) { - D_8085D990[arg3->type](play, this, arg3->anim); - } else if (arg3->type < 0) { - arg3->func(play, this, cue); +void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, PlayerCsModeEntry* csEntry) { + if (csEntry->type > PLAYER_CSTYPE_NONE) { + sPlayerCsModeAnimFuncs[csEntry->type](play, this, csEntry->csAnimArg2); + } else if (csEntry->type <= PLAYER_CSTYPE_ACTION) { + csEntry->csActionFunc(play, this, cue); } if ((D_80862B6C & 4) && !(this->skelAnime.moveFlags & ANIM_FLAG_4)) { @@ -19896,53 +20328,54 @@ void func_8085AC9C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808 void func_8085AD5C(PlayState* play, Player* this, PlayerCsMode csMode) { if ((csMode != PLAYER_CSMODE_1) && (csMode != PLAYER_CSMODE_WAIT) && (csMode != PLAYER_CSMODE_20) && (csMode != PLAYER_CSMODE_END)) { - func_8082DCA0(play, this); + Player_DetachHeldActor(play, this); } } -void func_8085ADA0(PlayState* play, Player* this, s32 arg2) { - CsCmdActorCue* cue = (this->actor.id == ACTOR_EN_TEST3) - ? play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_506)] - : play->csCtx.playerCue; +void Player_CsAction_48(PlayState* play, Player* this, CsCmdActorCue* cue) { + CsCmdActorCue* playerCue = (this->actor.id == ACTOR_EN_TEST3) + ? play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_506)] + : play->csCtx.playerCue; s32 var_a0 = false; s32 pad; s32 csMode; if ((play->csCtx.state == CS_STATE_IDLE) || (play->csCtx.state == CS_STATE_STOP) || (play->csCtx.state == CS_STATE_RUN_UNSTOPPABLE)) { - if ((D_8085D384[this->unk_396] == PLAYER_CSMODE_68) && (play->sceneId == SCENE_OKUJOU)) { + if ((sPlayerCsModes[this->cueId] == PLAYER_CSMODE_68) && (play->sceneId == SCENE_OKUJOU)) { this->unk_AA5 = PLAYER_UNKAA5_5; - if (func_80838A90(this, play)) { - this->csMode = PLAYER_CSMODE_0; + if (Player_ActionChange_13(this, play)) { + this->csMode = PLAYER_CSMODE_NONE; } return; - } else { - var_a0 = true; + } - if (D_8085D384[this->unk_396] != PLAYER_CSMODE_16) { - this->csMode = PLAYER_CSMODE_END; - func_800B7298(play, NULL, PLAYER_CSMODE_END); - this->unk_396 = 0; - Player_StopHorizontalMovement(this); - return; - } + var_a0 = true; + + if (sPlayerCsModes[this->cueId] != PLAYER_CSMODE_16) { + this->csMode = PLAYER_CSMODE_END; + func_800B7298(play, NULL, PLAYER_CSMODE_END); + this->cueId = PLAYER_CUEID_NONE; + Player_StopHorizontalMovement(this); + return; } } - if (!var_a0 && (cue == NULL)) { + if (!var_a0 && (playerCue == NULL)) { this->actor.flags &= ~ACTOR_FLAG_40; return; } - if (!var_a0 && (this->unk_396 != cue->id)) { - csMode = D_8085D384[cue->id]; + if (!var_a0 && (this->cueId != playerCue->id)) { + csMode = sPlayerCsModes[playerCue->id]; - if ((csMode >= PLAYER_CSMODE_0) && (gDisablePlayerCsModeStartPos == 0)) { + // Negative csModes will skip this block + if ((csMode >= PLAYER_CSMODE_NONE) && !gDisablePlayerCsModeStartPos) { if ((csMode == PLAYER_CSMODE_2) || (csMode == PLAYER_CSMODE_3)) { - Player_Cutscene_8085ABA8(this, cue); + Player_Cutscene_8085ABA8(this, playerCue); } else { - Player_Cutscene_SetPosAndYawToStart(this, cue); + Player_Cutscene_SetPosAndYawToStart(this, playerCue); } } @@ -19956,59 +20389,59 @@ void func_8085ADA0(PlayState* play, Player* this, s32 arg2) { func_8082E794(this); func_8085AD5C(play, this, ABS_ALT(csMode)); - func_8085AC9C(play, this, cue, &D_8085DA94[ABS_ALT(csMode)]); + func_8085AC9C(play, this, playerCue, &sPlayerCsModeInitFuncs[ABS_ALT(csMode)]); - this->unk_AE8 = 0; - this->unk_AE7 = 0; - this->unk_396 = cue->id; + this->actionVar2 = 0; + this->actionVar1 = 0; + this->cueId = playerCue->id; } - csMode = D_8085D384[this->unk_396]; - func_8085AC9C(play, this, cue, &D_8085DEF4[ABS_ALT(csMode)]); + csMode = sPlayerCsModes[this->cueId]; + func_8085AC9C(play, this, playerCue, &sPlayerCsModeUpdateFuncs[ABS_ALT(csMode)]); - if ((u16)cue->rot.x != 0) { - Math_SmoothStepToS(&this->actor.focus.rot.x, (u16)cue->rot.x, 4, 0x2710, 0); + if ((u16)playerCue->rot.x != 0) { + Math_SmoothStepToS(&this->actor.focus.rot.x, (u16)playerCue->rot.x, 4, 0x2710, 0); func_80832754(this, false); } } -void func_8085B08C(Player* this, PlayState* play) { +void Player_Action_97(Player* this, PlayState* play) { if (this->csMode != this->prevCsMode) { D_80862B6C = this->skelAnime.moveFlags; func_8082E794(this); this->prevCsMode = this->csMode; func_8085AD5C(play, this, this->csMode); - func_8085AC9C(play, this, NULL, &D_8085DA94[this->csMode]); + func_8085AC9C(play, this, NULL, &sPlayerCsModeInitFuncs[this->csMode]); } - func_8085AC9C(play, this, NULL, &D_8085DEF4[this->csMode]); + func_8085AC9C(play, this, NULL, &sPlayerCsModeUpdateFuncs[this->csMode]); } s32 Player_StartFishing(PlayState* play) { Player* player = GET_PLAYER(play); func_8082DE50(play, player); - func_80831990(play, player, ITEM_FISHING_ROD); + Player_UseItem(play, player, ITEM_FISHING_ROD); return 1; } // Player_GrabPlayerImpl? Player_GrabPlayerNoChecks? void func_8085B170(PlayState* play, Player* this) { func_8082DE50(play, this); - Player_SetAction(play, this, func_80853CC0, 0); + Player_SetAction(play, this, Player_Action_72, 0); Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_re_dead_attack); this->stateFlags2 |= PLAYER_STATE2_80; func_8082DAD4(this); Player_AnimSfx_PlayVoice(this, NA_SE_VO_LI_HELD); } -s32 Player_GrabPlayer(PlayState* play, Player* player) { - if (!Player_InBlockingCsMode(play, player) && (player->invincibilityTimer >= 0) && !func_801240DC(player)) { - if (!(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_100000 | - PLAYER_STATE1_200000 | PLAYER_STATE1_800000))) { - if (!(player->stateFlags2 & PLAYER_STATE2_80) && !(player->stateFlags3 & PLAYER_STATE3_80)) { - func_8085B170(play, player); +s32 Player_GrabPlayer(PlayState* play, Player* this) { + if (!Player_InBlockingCsMode(play, this) && (this->invincibilityTimer >= 0) && !func_801240DC(this)) { + if (!(this->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_100000 | + PLAYER_STATE1_200000 | PLAYER_STATE1_800000))) { + if (!(this->stateFlags2 & PLAYER_STATE2_80) && !(this->stateFlags3 & PLAYER_STATE3_80)) { + func_8085B170(play, this); return true; } } @@ -20021,8 +20454,8 @@ s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode) { Player* player = GET_PLAYER(play); if (this != NULL) { - if (csMode == PLAYER_CSMODE_0) { - return func_8084E034 == this->actionFunc; + if (csMode == PLAYER_CSMODE_NONE) { + return Player_Action_36 == this->actionFunc; } if ((this->actor.id == ACTOR_EN_TEST3) && (csMode < 0)) { @@ -20037,9 +20470,9 @@ s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode) { if ((player->actor.id == ACTOR_EN_TEST3) || !Player_InBlockingCsMode(play, player)) { func_8082DE50(play, player); - Player_SetAction(play, player, func_8085B08C, 0); + Player_SetAction(play, player, Player_Action_97, 0); player->csMode = csMode; - player->unk_398 = &this->actor; + player->csActor = &this->actor; func_8082DAD4(player); return true; @@ -20049,7 +20482,7 @@ s32 func_8085B28C(PlayState* play, Player* this, PlayerCsMode csMode) { } void func_8085B384(Player* this, PlayState* play) { - Player_SetAction(play, this, func_80849FE0, 1); + Player_SetAction(play, this, Player_Action_4, 1); func_8082E438(play, this, func_8082ED20(this)); this->currentYaw = this->actor.shape.rot.y; } @@ -20077,13 +20510,13 @@ void Player_TalkWithPlayer(PlayState* play, Actor* actor) { func_808323C0(player, CS_ID_GLOBAL_TALK); if ((player->talkActor != NULL) || (actor == player->tatlActor) || - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_1 | ACTOR_FLAG_40000)) { + CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_40000)) { actor->flags |= ACTOR_FLAG_TALK_REQUESTED; } player->talkActor = actor; - player->exchangeItemId = PLAYER_IA_NONE; - player->targetedActor = actor; + player->exchangeItemAction = PLAYER_IA_NONE; + player->lockOnActor = actor; if (actor->textId == 0xFFFF) { func_800B7298(play, actor, PLAYER_CSMODE_1); @@ -20098,11 +20531,11 @@ void Player_TalkWithPlayer(PlayState* play, Actor* actor) { } if (player->stateFlags1 & PLAYER_STATE1_800000) { - s32 sp24 = player->unk_AE8; + s32 sp24 = player->actionVar2; func_8082DE14(play, player); func_80837B60(play, player); - player->unk_AE8 = sp24; + player->actionVar2 = sp24; } else { if (func_801242B4(player)) { func_80832558(play, player, func_80837B60); @@ -20158,7 +20591,8 @@ void func_8085B74C(PlayState* play) { } func_80835324(play, player, 400.0f, - (sPlayerConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) ? D_80862B16 : player->actor.world.rot.y); + (sPlayerConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) ? sPlayerConveyorYaw + : player->actor.world.rot.y); player->stateFlags1 |= (PLAYER_STATE1_1 | PLAYER_STATE1_20000000); } @@ -20169,11 +20603,11 @@ void func_8085B820(PlayState* play, s16 arg1) { func_80836D8C(player); } -PlayerItemAction func_8085B854(PlayState* play, Player* player, ItemId itemId) { - PlayerItemAction itemAction = Player_ItemToItemAction(player, itemId); +PlayerItemAction func_8085B854(PlayState* play, Player* this, ItemId itemId) { + PlayerItemAction itemAction = Player_ItemToItemAction(this, itemId); if ((itemAction >= PLAYER_IA_MASK_MIN) && (itemAction <= PLAYER_IA_MASK_MAX) && - (itemAction == GET_IA_FROM_MASK(player->currentMask))) { + (itemAction == GET_IA_FROM_MASK(this->currentMask))) { itemAction = PLAYER_IA_NONE; } @@ -20181,15 +20615,15 @@ PlayerItemAction func_8085B854(PlayState* play, Player* player, ItemId itemId) { return PLAYER_IA_MINUS1; } - player->itemAction = PLAYER_IA_NONE; - player->actionFunc = NULL; - func_80831760(play, player, func_80853A5C, 0); - player->csId = CS_ID_GLOBAL_TALK; - player->itemAction = itemAction; - Player_AnimationPlayOnce(play, player, &gPlayerAnim_link_normal_give_other); - player->stateFlags1 |= (PLAYER_STATE1_40 | PLAYER_STATE1_20000000); - player->getItemDrawIdPlusOne = GID_NONE + 1; - player->exchangeItemId = itemAction; + this->itemAction = PLAYER_IA_NONE; + this->actionFunc = NULL; + Player_SetAction_PreserveItemAction(play, this, Player_Action_71, 0); + this->csId = CS_ID_GLOBAL_TALK; + this->itemAction = itemAction; + Player_AnimationPlayOnce(play, this, &gPlayerAnim_link_normal_give_other); + this->stateFlags1 |= (PLAYER_STATE1_40 | PLAYER_STATE1_20000000); + this->getItemDrawIdPlusOne = GID_NONE + 1; + this->exchangeItemAction = itemAction; return itemAction; } diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c index e63d414d9..fffd5b1d9 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c @@ -19,14 +19,14 @@ EffectSsInit Effect_En_Ice_Block_InitVars = { EffectEnIceBlock_Init, }; -#define rObjId regs[0] +#define rObjectSlot regs[0] #define rScale regs[1] #define rRot regs[2] #define rRotVel regs[3] u32 EffectEnIceBlock_CheckIceBlockObject(EffectSs* this, PlayState* play) { - if (((this->rObjId = Object_GetIndex(&play->objectCtx, OBJECT_ICE_BLOCK)) < 0) || - (!Object_IsLoaded(&play->objectCtx, this->rObjId))) { + if (((this->rObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ICE_BLOCK)) <= OBJECT_SLOT_NONE) || + (!Object_IsLoaded(&play->objectCtx, this->rObjectSlot))) { this->life = -1; this->draw = NULL; return false; @@ -63,7 +63,7 @@ void EffectEnIceBlock_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x06, - play->objectCtx.status[this->rObjId].segment); // object: OBJECT_ICE_BLOCK + play->objectCtx.slots[this->rObjectSlot].segment); // object: OBJECT_ICE_BLOCK Gfx_SetupDL25_Xlu(play->state.gfxCtx); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 87e50fb5f..0cc62b42d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -13,7 +13,7 @@ #define rAlphaStep regs[6] #define rFadeDelay regs[7] #define rScaleStep regs[8] -#define rObjectIndex regs[9] +#define rObjectSlot regs[9] #define PARAMS ((EffectSsDFireInitParams*)initParamsx) @@ -29,8 +29,8 @@ EffectSsInit Effect_Ss_D_Fire_InitVars = { static TexturePtr sFireTextures[] = { gDodongoFire0Tex, gDodongoFire1Tex, gDodongoFire2Tex, gDodongoFire3Tex }; s32 EffectSsDFire_CheckForObject(EffectSs* this, PlayState* play) { - if (((this->rObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO)) < 0) || - !Object_IsLoaded(&play->objectCtx, this->rObjectIndex)) { + if (((this->rObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_DODONGO)) <= OBJECT_SLOT_NONE) || + !Object_IsLoaded(&play->objectCtx, this->rObjectSlot)) { this->life = -1; this->draw = NULL; return false; @@ -65,16 +65,16 @@ u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; - void* object; + void* objectPtr; f32 scale; if (EffectSsDFire_CheckForObject(this, play)) { - object = play->objectCtx.status[this->rObjectIndex].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(object); - gSPSegment(POLY_XLU_DISP++, 0x06, object); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); scale = this->rScale / 100.0f; 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 a786327fa..d4dbbd4db 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 @@ -43,7 +43,7 @@ u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPa this->update = EffectSsEnFire_Update; this->rUnused = -15; - if (initParams->bodyPart < 0) { + if (initParams->bodyPart <= BODYPART_NONE) { 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; @@ -124,7 +124,7 @@ void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { if (this->actor->update != NULL) { Math_SmoothStepToS(&this->rScale, this->rScaleMax, 1, this->rScaleMax >> 3, 0); - if (this->rBodyPart < 0) { + if (this->rBodyPart <= BODYPART_NONE) { 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); diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index 91b699f5f..f8b20175b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -14,7 +14,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); -static s16 sScores[] = { 30, 60, 100 }; +static s16 sScores[] = { EXTRA_SCORE_30, EXTRA_SCORE_60, EXTRA_SCORE_100 }; EffectSsInit Effect_Ss_Extra_InitVars = { EFFECT_SS_EXTRA, @@ -23,7 +23,7 @@ EffectSsInit Effect_Ss_Extra_InitVars = { static TexturePtr sPointTextures[] = { gYabusamePoint30Tex, gYabusamePoint60Tex, gYabusamePoint100Tex }; -#define rObjId regs[0] +#define rObjectSlot regs[0] #define rTimer regs[1] #define rScoreIndex regs[2] #define rScale regs[3] @@ -31,13 +31,13 @@ static TexturePtr sPointTextures[] = { gYabusamePoint30Tex, gYabusamePoint60Tex, u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 pad; EffectSsExtraInitParams* params = PARAMS; - s32 objIndex; + s32 objectSlot; - objIndex = Object_GetIndex(&play->objectCtx, OBJECT_YABUSAME_POINT); - if ((objIndex >= 0) && (Object_IsLoaded(&play->objectCtx, objIndex))) { + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT); + if ((objectSlot > OBJECT_SLOT_NONE) && (Object_IsLoaded(&play->objectCtx, objectSlot))) { void* segBackup = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = params->pos; this->velocity = params->velocity; @@ -45,10 +45,10 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar this->draw = EffectSsExtra_Draw; this->update = EffectSsExtra_Update; this->life = 50; - this->rScoreIndex = params->scoreIdx; + this->rScoreIndex = params->scoreIndex; this->rScale = params->scale; this->rTimer = 5; - this->rObjId = objIndex; + this->rObjectSlot = objectSlot; gSegments[6] = segBackup; return 1; @@ -59,16 +59,16 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale; - void* storedSegment; + void* objectPtr; scale = this->rScale / 100.0f; - storedSegment = play->objectCtx.status[this->rObjId].segment; + objectPtr = play->objectCtx.slots[this->rObjectSlot].segment; OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(storedSegment); + gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); - gSPSegment(POLY_XLU_DISP++, 0x06, storedSegment); + gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h index 081570f62..b0e162c12 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h @@ -3,18 +3,22 @@ #include "global.h" +#define EXTRA_SCORE_30 30 +#define EXTRA_SCORE_60 60 +#define EXTRA_SCORE_100 100 + typedef enum { - /* 0 */ EXTRA_SCORE_30, - /* 1 */ EXTRA_SCORE_60, - /* 2 */ EXTRA_SCORE_100 -} ExtraScoreIdx; + /* 0 */ EXTRA_SCORE_INDEX_30, + /* 1 */ EXTRA_SCORE_INDEX_60, + /* 2 */ EXTRA_SCORE_INDEX_100 +} ExtraScoreIndex; typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; /* 0x24 */ s16 scale; - /* 0x26 */ s16 scoreIdx; + /* 0x26 */ s16 scoreIndex; } EffectSsExtraInitParams; // size = 0x28 #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 4edc1e3b1..c8f5a74c7 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 @@ -97,12 +97,12 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; Vec3f* bodyPartPos; BossHakugin* goht = (BossHakugin*)this->actor; - s32 index = goht->unk_191 - 3; + s32 gohtIndex = goht->unk_191 - 3; - if (index < 0) { + if (gohtIndex < 0) { bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00; } else { - bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00; + bodyPartPos = &goht->unk_2F00[this->rParams][gohtIndex].unk_00; } this->pos.x = Rand_CenteredFloat(70.0f) + bodyPartPos->x; 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 57ac1af69..442b779ac 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 @@ -83,7 +83,7 @@ void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { if (this->actor != NULL) { this->vec = this->actor->velocity; - if (this->rBodyPart < 0) { + if (this->rBodyPart <= BODYPART_NONE) { 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 { diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index 15444ad47..521b6db54 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -11,8 +11,8 @@ #define rYaw regs[1] #define rFlags regs[2] #define rScale regs[3] -#define rObjId regs[4] -#define rObjBankIndex regs[5] +#define rObjectId regs[4] +#define rObjectSlot regs[5] #define rMinLife regs[6] #define PARAMS ((EffectSsHahenInitParams*)initParamsx) @@ -27,8 +27,8 @@ EffectSsInit Effect_Ss_Hahen_InitVars = { }; void EffectSsHahen_CheckForObject(EffectSs* this, PlayState* play) { - if (((this->rObjBankIndex = Object_GetIndex(&play->objectCtx, this->rObjId)) < 0) || - !Object_IsLoaded(&play->objectCtx, this->rObjBankIndex)) { + if (((this->rObjectSlot = Object_GetSlot(&play->objectCtx, this->rObjectId)) <= OBJECT_SLOT_NONE) || + !Object_IsLoaded(&play->objectCtx, this->rObjectSlot)) { this->life = -1; this->draw = NULL; } @@ -44,11 +44,11 @@ u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initPar if (initParams->dList != NULL) { this->gfx = initParams->dList; - this->rObjId = initParams->objId; + this->rObjectId = initParams->objectId; EffectSsHahen_CheckForObject(this, play); } else { this->gfx = gEffFragments1DL; - this->rObjId = HAHEN_OBJECT_DEFAULT; + this->rObjectId = HAHEN_OBJECT_DEFAULT; } this->draw = EffectSsHahen_Draw; @@ -68,8 +68,8 @@ void EffectSsHahen_DrawOpa(PlayState* play, EffectSs* this) { OPEN_DISPS(gfxCtx); - if (this->rObjId != HAHEN_OBJECT_DEFAULT) { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); + if (this->rObjectId != HAHEN_OBJECT_DEFAULT) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -84,8 +84,8 @@ void EffectSsHahen_DrawXlu(PlayState* play, EffectSs* this) { OPEN_DISPS(gfxCtx); - if (this->rObjId != -1) { - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); + if (this->rObjectId != -1) { + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL25_Xlu(play->state.gfxCtx); @@ -125,7 +125,7 @@ void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this) { this->life = 0; } - if (this->rObjId != HAHEN_OBJECT_DEFAULT) { + if (this->rObjectId != HAHEN_OBJECT_DEFAULT) { EffectSsHahen_CheckForObject(this, play); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h index d962bf55f..5fc6303d4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h @@ -15,7 +15,7 @@ typedef struct { /* 0x24 */ Gfx* dList; /* 0x28 */ s16 flags; /* 0x2A */ s16 scale; - /* 0x2C */ s16 objId; + /* 0x2C */ s16 objectId; /* 0x2C */ s16 life; } EffectSsHahenInitParams; // size = 0x30 diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index 1104a28a3..7c3bcd0ad 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -5,6 +5,7 @@ */ #include "z_eff_ss_kakera.h" +#include "debug.h" #define rReg0 regs[0] #define rGravity regs[1] @@ -16,8 +17,8 @@ #define rScale regs[7] #define rReg8 regs[8] #define rReg9 regs[9] -#define rObjId regs[10] -#define rObjBankIndex regs[11] +#define rObjectId regs[10] +#define rObjectSlot regs[11] #define rColorIndex regs[12] #define PARAMS ((EffectSsKakeraInitParams*)initParamsx) @@ -50,19 +51,19 @@ u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initPa this->priority = 101; if (initParams->dList != NULL) { this->gfx = initParams->dList; - switch (initParams->objId) { + switch (initParams->objectId) { case GAMEPLAY_KEEP: case GAMEPLAY_FIELD_KEEP: case GAMEPLAY_DANGEON_KEEP: - this->rObjId = KAKERA_OBJECT_DEFAULT; + this->rObjectId = KAKERA_OBJECT_DEFAULT; break; default: - this->rObjId = initParams->objId; + this->rObjectId = initParams->objectId; EffectSsKakera_CheckForObject(this, play); break; } } else { - __assert("../z_eff_kakera.c", 193); + _dbg_hungup("../z_eff_kakera.c", 193); } this->draw = EffectSsKakera_Draw; this->update = EffectSsKakera_Update; @@ -92,11 +93,11 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { s32 colorIndex = this->rColorIndex; OPEN_DISPS(gfxCtx); - if (this->rObjId != KAKERA_OBJECT_DEFAULT) { + if (this->rObjectId != KAKERA_OBJECT_DEFAULT) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { - gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } else { - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); } } @@ -126,8 +127,8 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { } void EffectSsKakera_CheckForObject(EffectSs* this, PlayState* play) { - this->rObjBankIndex = Object_GetIndex(&play->objectCtx, this->rObjId); - if ((this->rObjBankIndex < 0) || (!Object_IsLoaded(&play->objectCtx, this->rObjBankIndex))) { + this->rObjectSlot = Object_GetSlot(&play->objectCtx, this->rObjectId); + if ((this->rObjectSlot <= OBJECT_SLOT_NONE) || (!Object_IsLoaded(&play->objectCtx, this->rObjectSlot))) { this->life = 0; this->draw = NULL; } @@ -368,7 +369,7 @@ void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this) { this->life = 0; } func_8097E7E0(this, play); - if (this->rObjId != KAKERA_OBJECT_DEFAULT) { + if (this->rObjectId != KAKERA_OBJECT_DEFAULT) { EffectSsKakera_CheckForObject(this, play); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h index d55a683cd..f2e5a609c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h @@ -30,7 +30,7 @@ typedef struct { /* 0x32 */ s16 unk_32; /* 0x34 */ s32 life; /* 0x38 */ s16 colorIdx; - /* 0x3A */ s16 objId; + /* 0x3A */ s16 objectId; /* 0x3C */ Gfx* dList; } EffectSsKakeraInitParams; // size = 0x40 diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 61eb3aebd..139568f3b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -26,7 +26,7 @@ u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* ini void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this); -TexturePtr sLightningTextures[] = { +static TexturePtr sLightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index c1615e2bf..f3de09474 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -7,7 +7,7 @@ #include "z_eff_ss_stick.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define rObjBankIndex regs[0] +#define rObjectSlot regs[0] #define rYaw regs[1] #define PARAMS ((EffectSsStickInitParams*)initParamsx) @@ -25,7 +25,7 @@ u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initPar EffectSsStickInitParams* initParams = PARAMS; Vec3f pos; - this->rObjBankIndex = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP); + this->rObjectSlot = Object_GetSlot(&play->objectCtx, GAMEPLAY_KEEP); pos = initParams->pos; this->pos = pos; this->vec = pos; @@ -51,7 +51,7 @@ void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_RotateZYX(0, this->rYaw, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL25_Opa(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->rObjectSlot].segment); gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); gSPDisplayList(POLY_OPA_DISP++, gDekuStickDL); diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c index 03bc1e81d..b12a9cb76 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c @@ -74,7 +74,7 @@ void TransitionWipe3_Start(void* thisx) { } else { this->scrollY = 500; if (this->texIndex == 2) { - func_8019F128(NA_SE_OC_SECRET_WARP_OUT); + Audio_PlaySfx_2(NA_SE_OC_SECRET_WARP_OUT); } } guPerspective(&this->projection, &this->normal, 60.0f, 4.0f / 3.0f, 10.0f, 12800.0f, 1.0f); @@ -102,7 +102,7 @@ void TransitionWipe3_Update(void* thisx, s32 updateRate) { if (this->dir != TRANS_WIPE3_DIR_IN) { if ((this->scrollY == 0) && (this->texIndex == 2)) { - func_8019F128(NA_SE_OC_SECRET_WARP_IN); + Audio_PlaySfx_2(NA_SE_OC_SECRET_WARP_IN); } this->scrollY += (this->wipeSpeed * 3) / updateRate; if (this->scrollY >= 500) { diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index 9e11df190..ee8aa689f 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -5,6 +5,8 @@ */ #include "global.h" +#include "PR/gs2dex.h" +#include "sys_cfb.h" #include "z_fbdemo_wipe5.h" #define THIS ((TransitionWipe5*)thisx) diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index 134c6457b..2c2e9a6b1 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -84,7 +84,7 @@ void DayTelop_Update(DayTelopState* this, GameState* thisx) { SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState)); gSaveContext.save.time = CLOCK_TIME(6, 0); - D_801BDBC8 = 0xFE; + gSceneSeqState = SCENESEQ_MORNING; } else if (this->transitionCountdown == 90) { this->fadeInState = DAYTELOP_HOURSTEXT_FADEIN; this->alpha = 0; @@ -215,18 +215,18 @@ void DayTelop_Noop(DayTelopState* this) { void DayTelop_LoadGraphics(DayTelopState* this) { size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static); - this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); + this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize); DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize); segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static); - this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); + this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize); DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize); } void DayTelop_Init(GameState* thisx) { DayTelopState* this = (DayTelopState*)thisx; - Game_SetFramerateDivisor(&this->state, 1); + GameState_SetFramerateDivisor(&this->state, 1); Matrix_Init(&this->state); ShrinkWindow_Destroy(); View_Init(&this->view, this->state.gfxCtx); @@ -244,5 +244,5 @@ void DayTelop_Init(GameState* thisx) { DayTelop_Noop(this); DayTelop_LoadGraphics(this); - play_sound(NA_SE_OC_TELOP_IMPACT); + Audio_PlaySfx(NA_SE_OC_TELOP_IMPACT); } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 0cc43ad50..65d26a97e 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -242,7 +242,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) { if (!gSaveContext.flashSaveAvailable) { if (!NO_FLASH_SLOT_OCCUPIED(sramCtx, this->buttonIndex)) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->configMode = CM_ROTATE_TO_NAME_ENTRY; this->kbdButton = FS_KBD_BTN_NONE; this->charPage = FS_CHAR_PAGE_HIRA; @@ -258,7 +258,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; Lib_MemCpy(&this->fileNames[this->buttonIndex], &sEmptyName, ARRAY_COUNT(sEmptyName)); } else { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->actionTimer = 4; this->selectMode = SM_FADE_MAIN_TO_SELECT; this->selectedFileIndex = this->buttonIndex; @@ -266,7 +266,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { this->nextTitleLabel = FS_TITLE_OPEN_FILE; } } else if (!SLOT_OCCUPIED(this, this->buttonIndex)) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->configMode = CM_ROTATE_TO_NAME_ENTRY; this->kbdButton = FS_KBD_BTN_NONE; this->charPage = FS_CHAR_PAGE_HIRA; @@ -282,7 +282,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; Lib_MemCpy(&this->fileNames[this->buttonIndex], &sEmptyName, ARRAY_COUNT(sEmptyName)); } else { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->actionTimer = 4; this->selectMode = SM_FADE_MAIN_TO_SELECT; this->selectedFileIndex = this->buttonIndex; @@ -290,7 +290,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { this->nextTitleLabel = FS_TITLE_OPEN_FILE; } } else if (this->warningLabel == FS_WARNING_NONE) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->prevConfigMode = this->configMode; if (this->buttonIndex == FS_BTN_MAIN_COPY) { @@ -310,7 +310,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { } this->actionTimer = 4; } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; @@ -318,7 +318,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState)); } else { if (ABS_ALT(this->stickAdjY) > 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (this->stickAdjY > 30) { this->buttonIndex--; if (this->buttonIndex == FS_BTN_MAIN_FILE_3) { @@ -2048,18 +2048,18 @@ void FileSelect_ConfirmFile(GameState* thisx) { if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) { if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) { Rumble_Request(300.0f, 180, 20, 100); - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->selectMode = SM_FADE_OUT; func_801A4058(0xF); } else { // FS_BTN_CONFIRM_QUIT - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); this->selectMode++; // SM_FADE_OUT_FILE_INFO } } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); this->selectMode++; // SM_FADE_OUT_FILE_INFO } else if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->confirmButtonIndex ^= 1; } } @@ -2197,7 +2197,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = 0; - gSaveContext.nextDayTime = 0xFFFF; + gSaveContext.nextDayTime = NEXT_TIME_NONE; gSaveContext.retainWeatherMode = false; gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; @@ -2489,7 +2489,7 @@ void FileSelect_InitContext(GameState* thisx) { Skybox_Init(&this->state, &this->skyboxCtx, 1); R_TIME_SPEED = 10; - envCtx->changeSkyboxState = 0; + envCtx->changeSkyboxState = CHANGE_SKYBOX_INACTIVE; envCtx->changeSkyboxTimer = 0; envCtx->changeLightEnabled = false; envCtx->changeLightTimer = 0; @@ -2521,7 +2521,7 @@ void FileSelect_Init(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; size_t size; - Game_SetFramerateDivisor(&this->state, 1); + GameState_SetFramerateDivisor(&this->state, 1); Matrix_Init(&this->state); ShrinkWindow_Init(); View_Init(&this->view, this->state.gfxCtx); @@ -2531,15 +2531,15 @@ void FileSelect_Init(GameState* thisx) { Font_LoadOrderedFont(&this->font); size = SEGMENT_ROM_SIZE(title_static); - this->staticSegment = THA_AllocTailAlign16(&this->state.heap, size); + this->staticSegment = THA_AllocTailAlign16(&this->state.tha, size); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(title_static), size); size = SEGMENT_ROM_SIZE(parameter_static); - this->parameterSegment = THA_AllocTailAlign16(&this->state.heap, size); + this->parameterSegment = THA_AllocTailAlign16(&this->state.tha, size); DmaMgr_SendRequest0(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size); size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart; - this->titleSegment = THA_AllocTailAlign16(&this->state.heap, size); + this->titleSegment = THA_AllocTailAlign16(&this->state.tha, size); DmaMgr_SendRequest0(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size); Audio_SetSpec(0xA); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 7f8e5789c..97181cefb 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -77,7 +77,7 @@ void FileSelect_SelectCopySource(GameState* thisx) { this->nextTitleLabel = FS_TITLE_SELECT_FILE; this->configMode = CM_COPY_RETURN_MAIN; this->warningLabel = FS_WARNING_NONE; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { if (!gSaveContext.flashSaveAvailable) { if (NO_FLASH_SLOT_OCCUPIED(sramCtx, this->buttonIndex)) { @@ -85,22 +85,22 @@ void FileSelect_SelectCopySource(GameState* thisx) { this->selectedFileIndex = this->buttonIndex; this->configMode = CM_SETUP_COPY_DEST_1; this->nextTitleLabel = FS_TITLE_COPY_TO; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else if (SLOT_OCCUPIED(this, this->buttonIndex)) { this->actionTimer = 4; this->selectedFileIndex = this->buttonIndex; this->configMode = CM_SETUP_COPY_DEST_1; this->nextTitleLabel = FS_TITLE_COPY_TO; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else { if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (this->stickAdjY >= 30) { this->buttonIndex--; // Instead of removing File 3 entirely, the index is manually adjusted to skip it @@ -211,7 +211,7 @@ void FileSelect_SelectCopyDest(GameState* thisx) { this->nextTitleLabel = FS_TITLE_COPY_FROM; this->actionTimer = 4; this->configMode = CM_EXIT_TO_COPY_SOURCE_1; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { if (!gSaveContext.flashSaveAvailable) { if (!NO_FLASH_SLOT_OCCUPIED(sramCtx, this->buttonIndex)) { @@ -219,22 +219,22 @@ void FileSelect_SelectCopyDest(GameState* thisx) { this->nextTitleLabel = FS_TITLE_COPY_CONFIRM; this->actionTimer = 4; this->configMode = CM_SETUP_COPY_CONFIRM_1; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else if (!SLOT_OCCUPIED(this, this->buttonIndex)) { this->copyDestFileIndex = this->buttonIndex; this->nextTitleLabel = FS_TITLE_COPY_CONFIRM; this->actionTimer = 4; this->configMode = CM_SETUP_COPY_CONFIRM_1; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else { if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (this->stickAdjY >= 30) { this->buttonIndex--; // Instead of removing File 3 entirely, the index is manually adjusted to skip it @@ -421,7 +421,7 @@ void FileSelect_CopyConfirm(GameState* thisx) { this->actionTimer = 4; this->nextTitleLabel = FS_TITLE_COPY_TO; this->configMode = CM_RETURN_TO_COPY_DEST; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { dayTime = gSaveContext.save.time; gSaveContext.save.time = dayTime; @@ -439,9 +439,9 @@ void FileSelect_CopyConfirm(GameState* thisx) { this->configMode = CM_COPY_WAIT_FOR_FLASH_SAVE; } Rumble_Request(300.0f, 180, 20, 100); - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->buttonIndex ^= 1; } } @@ -585,7 +585,7 @@ void FileSelect_CopyAnim3(GameState* thisx) { if (this->actionTimer == 38) { this->connectorAlpha[this->copyDestFileIndex] = 255; - play_sound(NA_SE_EV_DIAMOND_SWITCH); + Audio_PlaySfx(NA_SE_EV_DIAMOND_SWITCH); } this->actionTimer--; @@ -594,7 +594,7 @@ void FileSelect_CopyAnim3(GameState* thisx) { if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_B | BTN_START) || (this->actionTimer == 0)) { this->actionTimer = 4; this->nextTitleLabel = FS_TITLE_SELECT_FILE; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); this->configMode = CM_COPY_ANIM_4; } } @@ -794,7 +794,7 @@ void FileSelect_EraseSelect(GameState* thisx) { this->nextTitleLabel = FS_TITLE_SELECT_FILE; this->configMode = CM_EXIT_ERASE_TO_MAIN; this->warningLabel = FS_WARNING_NONE; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { if (!gSaveContext.flashSaveAvailable) { @@ -803,22 +803,22 @@ void FileSelect_EraseSelect(GameState* thisx) { this->selectedFileIndex = this->buttonIndex; this->configMode = CM_SETUP_ERASE_CONFIRM_1; this->nextTitleLabel = FS_TITLE_ERASE_CONFIRM; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else if (SLOT_OCCUPIED(this, this->buttonIndex)) { this->actionTimer = 4; this->selectedFileIndex = this->buttonIndex; this->configMode = CM_SETUP_ERASE_CONFIRM_1; this->nextTitleLabel = FS_TITLE_ERASE_CONFIRM; - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } else { if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (this->stickAdjY >= 30) { this->buttonIndex--; @@ -966,7 +966,7 @@ void FileSelect_EraseConfirm(GameState* thisx) { this->nextTitleLabel = FS_TITLE_ERASE_FILE; this->configMode = CM_EXIT_TO_ERASE_SELECT_1; this->actionTimer = 4; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { Sram_EraseSave(this, sramCtx, this->selectedFileIndex); if (!gSaveContext.flashSaveAvailable) { @@ -978,13 +978,13 @@ void FileSelect_EraseConfirm(GameState* thisx) { this->configMode = CM_ERASE_WAIT_FOR_FLASH_SAVE; } this->connectorAlpha[this->selectedFileIndex] = 0; - play_sound(NA_SE_EV_DIAMOND_SWITCH); + Audio_PlaySfx(NA_SE_EV_DIAMOND_SWITCH); this->actionTimer = 4; this->nextTitleLabel = FS_TITLE_ERASE_COMPLETE; Rumble_Request(200.0f, 255, 20, 150); sEraseDelayTimer = 15; } else if (ABS_ALT(this->stickAdjY) >= 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->buttonIndex ^= 1; } } @@ -1104,7 +1104,7 @@ void FileSelect_EraseAnim1(GameState* thisx) { sEraseDelayTimer--; if (sEraseDelayTimer == 0) { - play_sound(NA_SE_OC_ABYSS); + Audio_PlaySfx(NA_SE_OC_ABYSS); } } } @@ -1141,7 +1141,7 @@ void FileSelect_EraseAnim2(GameState* thisx) { this->actionTimer = 4; this->nextTitleLabel = FS_TITLE_SELECT_FILE; this->configMode++; // CM_ERASE_ANIM_3 - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index 02236002a..f8f228eaa 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -4,7 +4,6 @@ * Description: Entering name on a new file, selecting options from the options menu */ -#include "prevent_bss_reordering.h" #include "z_file_select.h" #include "z64rumble.h" #include "misc/title_static/title_static.h" @@ -403,7 +402,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { if (this->configMode == CM_NAME_ENTRY) { if (CHECK_BTN_ALL(input->press.button, BTN_START)) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); // place cursor on END button this->kbdY = 5; this->kbdX = 4; @@ -415,21 +414,21 @@ void FileSelect_DrawNameEntry(GameState* thisx) { } this->fileNames[this->buttonIndex][i] = 0x3E; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else { this->newFileNameCharCount--; if (this->newFileNameCharCount < 0) { this->newFileNameCharCount = 0; this->configMode = CM_NAME_ENTRY_TO_MAIN; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else { for (i = this->newFileNameCharCount; i < 7; i++) { this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1]; } this->fileNames[this->buttonIndex][i] = 0x3E; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } } } else { @@ -462,7 +461,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { font->fontBuf + D_808141F0[this->charIndex] * FONT_CHAR_TEX_SIZE, 0); if (CHECK_BTN_ALL(input->press.button, BTN_A)) { - play_sound(NA_SE_SY_FSEL_DECIDE_S); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_S); this->fileNames[this->buttonIndex][this->newFileNameCharCount] = D_808141F0[this->charIndex]; this->newFileNameCharCount++; @@ -481,7 +480,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { } this->fileNames[this->buttonIndex][i] = 0x3E; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else { this->newFileNameCharCount--; @@ -494,7 +493,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { } this->fileNames[this->buttonIndex][i] = 0x3E; - play_sound(NA_SE_SY_FSEL_CLOSE); + Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } } else if (this->kbdButton == FS_KBD_BTN_END) { validName = false; @@ -507,7 +506,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { } if (validName) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); gSaveContext.fileNum = this->buttonIndex; time = ((void)0, gSaveContext.save.time); Sram_InitSave(this, sramCtx); @@ -526,21 +525,21 @@ void FileSelect_DrawNameEntry(GameState* thisx) { this->connectorAlpha[this->buttonIndex] = 255; Rumble_Request(300.0f, 180, 20, 100); } else { - play_sound(NA_SE_SY_FSEL_ERROR); + Audio_PlaySfx(NA_SE_SY_FSEL_ERROR); } } } } if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->newFileNameCharCount++; if (this->newFileNameCharCount > 7) { this->newFileNameCharCount = 7; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->newFileNameCharCount--; if (this->newFileNameCharCount < 0) { @@ -597,7 +596,7 @@ void FileSelect_UpdateKeyboardCursor(GameState* thisx) { if (this->kbdY != 5) { if (this->stickAdjX < -30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->charIndex--; this->kbdX--; if (this->kbdX < 0) { @@ -605,7 +604,7 @@ void FileSelect_UpdateKeyboardCursor(GameState* thisx) { this->charIndex = (this->kbdY * 13) + this->kbdX; } } else if (this->stickAdjX > 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->charIndex++; this->kbdX++; if (this->kbdX > 12) { @@ -615,13 +614,13 @@ void FileSelect_UpdateKeyboardCursor(GameState* thisx) { } } else { if (this->stickAdjX < -30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->kbdX--; if (this->kbdX < 3) { this->kbdX = 4; } } else if (this->stickAdjX > 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->kbdX++; if (this->kbdX > 4) { this->kbdX = 3; @@ -630,7 +629,7 @@ void FileSelect_UpdateKeyboardCursor(GameState* thisx) { } if (this->stickAdjY > 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->kbdY--; @@ -661,7 +660,7 @@ void FileSelect_UpdateKeyboardCursor(GameState* thisx) { } } } else if (this->stickAdjY < -30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); this->kbdY++; if (this->kbdY > 5) { @@ -757,7 +756,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { Input* input = CONTROLLER1(&this->state); if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); Sram_WriteSaveOptionsToBuffer(sramCtx); if (!gSaveContext.flashSaveAvailable) { @@ -772,7 +771,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { } if (this->stickAdjX < -30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (sSelectedSetting == FS_SETTING_AUDIO) { gSaveContext.options.audioSetting--; @@ -785,7 +784,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { gSaveContext.options.zTargetSetting ^= 1; } } else if (this->stickAdjX > 30) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); if (sSelectedSetting == FS_SETTING_AUDIO) { gSaveContext.options.audioSetting++; @@ -798,12 +797,12 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { } if ((this->stickAdjY < -30) || (this->stickAdjY > 30)) { - play_sound(NA_SE_SY_FSEL_CURSOR); + Audio_PlaySfx(NA_SE_SY_FSEL_CURSOR); sSelectedSetting ^= 1; return; } if (CHECK_BTN_ALL(input->press.button, BTN_A)) { - play_sound(NA_SE_SY_FSEL_DECIDE_L); + Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); sSelectedSetting ^= 1; } } diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 84425cc73..f2b74cdc7 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -52,7 +52,7 @@ void TitleSetup_Destroy(GameState* thisx) { void TitleSetup_Init(GameState* thisx) { TitleSetupState* this = (TitleSetupState*)thisx; - Game_SetFramerateDivisor(&this->state, 1); + GameState_SetFramerateDivisor(&this->state, 1); Matrix_Init(&this->state); ShrinkWindow_Init(); View_Init(&this->view, this->state.gfxCtx); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 88d9ccdc4..7a79da010 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -51,7 +51,7 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { gSaveContext.respawn[RESPAWN_MODE_ZORA].entrance = 0xFF; gSaveContext.respawn[RESPAWN_MODE_DEKU].entrance = 0xFF; gSaveContext.respawn[RESPAWN_MODE_HUMAN].entrance = 0xFF; - gWeatherMode = 0; + gWeatherMode = WEATHER_MODE_CLEAR; STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState)); @@ -525,7 +525,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) { - playerForm = gSaveContext.save.playerForm - 1; + playerForm = GET_PLAYER_FORM - 1; if (playerForm < PLAYER_FORM_FIERCE_DEITY) { playerForm = PLAYER_FORM_HUMAN; } @@ -631,13 +631,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) { this->timerUp = 20; this->lockUp = true; - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = updateRate; } } if (CHECK_BTN_ALL(controller1->cur.button, BTN_DUP) && (this->timerUp == 0)) { - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = updateRate * 3; } @@ -648,24 +648,24 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (this->timerDown == 0) { this->timerDown = 20; this->lockDown = true; - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = -updateRate; } } if (CHECK_BTN_ALL(controller1->cur.button, BTN_DDOWN) && (this->timerDown == 0)) { - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = -updateRate * 3; } if (CHECK_BTN_ALL(controller1->press.button, BTN_DLEFT) || CHECK_BTN_ALL(controller1->cur.button, BTN_DLEFT)) { - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = updateRate; } if (CHECK_BTN_ALL(controller1->press.button, BTN_DRIGHT) || CHECK_BTN_ALL(controller1->cur.button, BTN_DRIGHT)) { - play_sound(NA_SE_IT_SWORD_IMPACT); + Audio_PlaySfx(NA_SE_IT_SWORD_IMPACT); this->verticalInput = -updateRate; } } @@ -1084,7 +1084,7 @@ void MapSelect_Init(GameState* thisx) { this->pageDownIndex = dREG(82); } - Game_SetFramerateDivisor(&this->state, 1); + GameState_SetFramerateDivisor(&this->state, 1); gSaveContext.save.cutsceneIndex = 0; gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; gSaveContext.save.linkAge = 0; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index abde294e5..5cebc2fca 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -7,6 +7,7 @@ #include "z_title.h" #include "z64shrink_window.h" #include "z64view.h" +#include "CIC6105.h" #include "overlays/gamestates/ovl_opening/z_opening.h" #include "misc/nintendo_rogo_static/nintendo_rogo_static.h" @@ -146,17 +147,17 @@ void ConsoleLogo_Destroy(GameState* thisx) { Sram_InitSram(&this->state, &this->sramCtx); ShrinkWindow_Destroy(); - CIC6105_Nop80081828(); + CIC6105_Noop2(); } void ConsoleLogo_Init(GameState* thisx) { ConsoleLogoState* this = (ConsoleLogoState*)thisx; uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static); - this->staticSegment = THA_AllocTailAlign16(&this->state.heap, segmentSize); + this->staticSegment = THA_AllocTailAlign16(&this->state.tha, segmentSize); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize); - Game_SetFramerateDivisor(&this->state, 1); + GameState_SetFramerateDivisor(&this->state, 1); Matrix_Init(&this->state); ShrinkWindow_Init(); View_Init(&this->view, this->state.gfxCtx); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index 1b18adcd1..6c3af4569 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -6,12 +6,10 @@ #include "z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" +#include "archives/icon_item_static/icon_item_static_yar.h" s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s16 point); -extern TexturePtr D_08061000; // gBombersNotebookIconTex -extern TexturePtr D_08062000; // gSongNoteIconTex - s16 sQuestRemainsColorTimerInit[] = { 120, 60, 2, 80 }; s16 sQuestHpColorTimerInits[] = { 20, 4, 20, 10 }; s16 sQuestSongPlayedOcarinaButtonsNum = 0; @@ -117,8 +115,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { 255, // QUEST_SONG_SUN }; static TexturePtr sQuestUpgradeTextures[][3] = { - { 0x08053000, 0x08054000, 0x08055000 }, // UPG_QUIVER - { 0x08056000, 0x08057000, 0x08058000 }, // UPG_BOMB_BAG + { gItemIconQuiver30Tex, gItemIconQuiver40Tex, gItemIconQuiver50Tex }, // UPG_QUIVER + { gItemIconBombBag20Tex, gItemIconBombBag30Tex, gItemIconBombBag40Tex }, // UPG_BOMB_BAG }; static u8 sQuestUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG }; PauseContext* pauseCtx = &play->pauseCtx; @@ -221,8 +219,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gDPLoadTextureBlock(POLY_OPA_DISP++, &D_08062000, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(POLY_OPA_DISP++, gItemIconSongNoteTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); for (i = 0; i < 12; i++, j += 4) { if (CHECK_QUEST_ITEM(i + QUEST_SONG_SONATA) || @@ -256,7 +255,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[j], 4, 0); - KaleidoScope_DrawTexQuadRGBA32(play->state.gfxCtx, &D_08061000, 32, 32, 0); + KaleidoScope_DrawTexQuadRGBA32(play->state.gfxCtx, gItemIconBombersNotebookTex, 32, 32, 0); } j += 4; @@ -690,7 +689,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { // if the cursor point changed if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_QUEST]) { pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } // Update cursor item and slot @@ -851,7 +850,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (pauseCtx->cursorPoint[PAUSE_QUEST] == QUEST_BOMBERS_NOTEBOOK) { play->pauseCtx.bombersNotebookOpen = true; pauseCtx->mainState = PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); } else { pauseCtx->itemDescriptionOn = true; if (pauseCtx->cursorYIndex[PAUSE_QUEST] < 2) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index f643d8d40..e658251e4 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -97,7 +97,7 @@ SectionPosition sSectionPositions[] = { s16 sSlotItems[] = { // Items Row 1 - ITEM_OCARINA, + ITEM_OCARINA_OF_TIME, ITEM_BOW, ITEM_ARROW_FIRE, ITEM_ARROW_ICE, @@ -106,14 +106,14 @@ s16 sSlotItems[] = { // Items Row 2 ITEM_BOMB, ITEM_BOMBCHU, - ITEM_STICK, - ITEM_NUT, + ITEM_DEKU_STICK, + ITEM_DEKU_NUT, ITEM_MAGIC_BEANS, ITEM_SLINGSHOT, // Items Row 3 ITEM_POWDER_KEG, - ITEM_PICTO_BOX, - ITEM_LENS, + ITEM_PICTOGRAPH_BOX, + ITEM_LENS_OF_TRUTH, ITEM_HOOKSHOT, ITEM_SWORD_GREAT_FAIRY, ITEM_LONGSHOT, @@ -427,7 +427,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { for (j = 0, rectLeft = 44; j < 6; j++, slot++, rectLeft += 23) { counterDigits[3] = 0; counterDigits[2] = 0; - if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_NUT)) || (slot == SLOT_POWDER_KEG) || + if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_DEKU_NUT)) || (slot == SLOT_POWDER_KEG) || (slot == SLOT_MAGIC_BEANS)) { counterDigits[3] = AMMO(gAmmoItems[slot]); } else if ((slot == SLOT_TRADE_DEED) || (slot == SLOT_TRADE_KEY_MAMA) || (slot == SLOT_TRADE_COUPLE)) { @@ -778,8 +778,8 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { if (sCurSection < INV_EDITOR_SECTION_BOSS) { // Items slot = sCurSection - INV_EDITOR_SECTION_ITEMS; - if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_NUT)) || (slot == SLOT_POWDER_KEG) || - (slot == SLOT_MAGIC_BEANS)) { + if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_DEKU_NUT)) || + (slot == SLOT_POWDER_KEG) || (slot == SLOT_MAGIC_BEANS)) { if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { Inventory_DeleteItem(gAmmoItems[slot], SLOT(gAmmoItems[slot])); AMMO(gAmmoItems[slot]) = 0; @@ -805,18 +805,18 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { Inventory_DeleteItem(value, slot); } else if (slot == SLOT_TRADE_DEED) { if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { - gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_MOON_TEAR; - } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_MOON_TEAR) && - (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_MOUNTAIN)) { - gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) + 1; + if (INV_CONTENT(ITEM_MOONS_TEAR) == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_MOONS_TEAR; + } else if ((INV_CONTENT(ITEM_MOONS_TEAR) >= ITEM_MOONS_TEAR) && + (INV_CONTENT(ITEM_MOONS_TEAR) <= ITEM_DEED_MOUNTAIN)) { + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOONS_TEAR) + 1; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { + if (INV_CONTENT(ITEM_MOONS_TEAR) == ITEM_NONE) { gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_DEED_OCEAN; - } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_DEED_LAND) && - (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_OCEAN)) { - gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) - 1; + } else if ((INV_CONTENT(ITEM_MOONS_TEAR) >= ITEM_DEED_LAND) && + (INV_CONTENT(ITEM_MOONS_TEAR) <= ITEM_DEED_OCEAN)) { + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOONS_TEAR) - 1; } } } else if (slot == SLOT_TRADE_KEY_MAMA) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index f46db573c..02f011807 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -16,7 +16,7 @@ s16 sEquipMagicArrowSlotHoldTimer = 0; s16 sEquipAnimTimer = 10; u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { - // Fierce Deity + // PLAYER_FORM_FIERCE_DEITY { false, // SLOT_OCARINA false, // SLOT_BOW @@ -26,13 +26,13 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { false, // SLOT_TRADE_DEED false, // SLOT_BOMB false, // SLOT_BOMBCHU - false, // SLOT_STICK - false, // SLOT_NUT + false, // SLOT_DEKU_STICK + false, // SLOT_DEKU_NUT false, // SLOT_MAGIC_BEANS false, // SLOT_TRADE_KEY_MAMA false, // SLOT_POWDER_KEG - false, // SLOT_PICTO_BOX - false, // SLOT_LENS + false, // SLOT_PICTOGRAPH_BOX + false, // SLOT_LENS_OF_TRUTH false, // SLOT_HOOKSHOT false, // SLOT_SWORD_GREAT_FAIRY false, // SLOT_TRADE_COUPLE @@ -43,7 +43,7 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_BOTTLE_5 true, // SLOT_BOTTLE_6 }, - // Goron + // PLAYER_FORM_GORON { true, // SLOT_OCARINA false, // SLOT_BOW @@ -53,13 +53,13 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_TRADE_DEED false, // SLOT_BOMB false, // SLOT_BOMBCHU - false, // SLOT_STICK - false, // SLOT_NUT + false, // SLOT_DEKU_STICK + false, // SLOT_DEKU_NUT false, // SLOT_MAGIC_BEANS true, // SLOT_TRADE_KEY_MAMA true, // SLOT_POWDER_KEG - true, // SLOT_PICTO_BOX - true, // SLOT_LENS + true, // SLOT_PICTOGRAPH_BOX + true, // SLOT_LENS_OF_TRUTH false, // SLOT_HOOKSHOT false, // SLOT_SWORD_GREAT_FAIRY true, // SLOT_TRADE_COUPLE @@ -70,7 +70,7 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_BOTTLE_5 true, // SLOT_BOTTLE_6 }, - // Zora + // PLAYER_FORM_ZORA { true, // SLOT_OCARINA false, // SLOT_BOW @@ -80,13 +80,13 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_TRADE_DEED false, // SLOT_BOMB false, // SLOT_BOMBCHU - false, // SLOT_STICK - false, // SLOT_NUT + false, // SLOT_DEKU_STICK + false, // SLOT_DEKU_NUT false, // SLOT_MAGIC_BEANS true, // SLOT_TRADE_KEY_MAMA false, // SLOT_POWDER_KEG - true, // SLOT_PICTO_BOX - true, // SLOT_LENS + true, // SLOT_PICTOGRAPH_BOX + true, // SLOT_LENS_OF_TRUTH false, // SLOT_HOOKSHOT false, // SLOT_SWORD_GREAT_FAIRY true, // SLOT_TRADE_COUPLE @@ -97,7 +97,7 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_BOTTLE_5 true, // SLOT_BOTTLE_6 }, - // Deku + // PLAYER_FORM_DEKU { true, // SLOT_OCARINA false, // SLOT_BOW @@ -107,13 +107,13 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_TRADE_DEED false, // SLOT_BOMB false, // SLOT_BOMBCHU - false, // SLOT_STICK - true, // SLOT_NUT + false, // SLOT_DEKU_STICK + true, // SLOT_DEKU_NUT false, // SLOT_MAGIC_BEANS true, // SLOT_TRADE_KEY_MAMA false, // SLOT_POWDER_KEG - true, // SLOT_PICTO_BOX - true, // SLOT_LENS + true, // SLOT_PICTOGRAPH_BOX + true, // SLOT_LENS_OF_TRUTH false, // SLOT_HOOKSHOT false, // SLOT_SWORD_GREAT_FAIRY true, // SLOT_TRADE_COUPLE @@ -124,7 +124,7 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_BOTTLE_5 true, // SLOT_BOTTLE_6 }, - // Human + // PLAYER_FORM_HUMAN { true, // SLOT_OCARINA true, // SLOT_BOW @@ -134,13 +134,13 @@ u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][ITEM_NUM_SLOTS] = { true, // SLOT_TRADE_DEED true, // SLOT_BOMB true, // SLOT_BOMBCHU - true, // SLOT_STICK - true, // SLOT_NUT + true, // SLOT_DEKU_STICK + true, // SLOT_DEKU_NUT true, // SLOT_MAGIC_BEANS true, // SLOT_TRADE_KEY_MAMA false, // SLOT_POWDER_KEG - true, // SLOT_PICTO_BOX - true, // SLOT_LENS + true, // SLOT_PICTOGRAPH_BOX + true, // SLOT_LENS_OF_TRUTH true, // SLOT_HOOKSHOT true, // SLOT_SWORD_GREAT_FAIRY true, // SLOT_TRADE_COUPLE @@ -157,22 +157,22 @@ s16 sAmmoRectLeft[] = { 95, // SLOT_BOW 62, // SLOT_BOMB 95, // SLOT_BOMBCHU - 128, // SLOT_STICK - 161, // SLOT_NUT + 128, // SLOT_DEKU_STICK + 161, // SLOT_DEKU_NUT 194, // SLOT_MAGIC_BEANS 62, // SLOT_POWDER_KEG - 95, // SLOT_PICTO_BOX + 95, // SLOT_PICTOGRAPH_BOX }; s16 sAmmoRectHeight[] = { 85, // SLOT_BOW 117, // SLOT_BOMB 117, // SLOT_BOMBCHU - 117, // SLOT_STICK - 117, // SLOT_NUT + 117, // SLOT_DEKU_STICK + 117, // SLOT_DEKU_NUT 117, // SLOT_MAGIC_BEANS 150, // SLOT_POWDER_KEG - 150, // SLOT_PICTO_BOX + 150, // SLOT_PICTOGRAPH_BOX }; void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, s16 item, u16 ammoIndex) { @@ -181,7 +181,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, OPEN_DISPS(gfxCtx); - if (item == ITEM_PICTO_BOX) { + if (item == ITEM_PICTOGRAPH_BOX) { if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { ammo = 0; } else { @@ -193,7 +193,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPPipeSync(POLY_OPA_DISP++); - if (!gPlayerFormSlotRestrictions[((void)0, gSaveContext.save.playerForm)][SLOT(item)]) { + if (!gPlayerFormSlotRestrictions[GET_PLAYER_FORM][SLOT(item)]) { // Ammo item is restricted gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 100, pauseCtx->alpha); } else { @@ -204,10 +204,10 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 130, 130, 130, pauseCtx->alpha); } else if (((item == ITEM_BOMB) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || ((item == ITEM_BOW) && (AMMO(item) == CUR_CAPACITY(UPG_QUIVER))) || - ((item == ITEM_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_STICKS))) || - ((item == ITEM_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_NUTS))) || + ((item == ITEM_DEKU_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_DEKU_STICKS))) || + ((item == ITEM_DEKU_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_DEKU_NUTS))) || ((item == ITEM_BOMBCHU) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || - ((item == ITEM_POWDER_KEG) && (ammo == 1)) || ((item == ITEM_PICTO_BOX) && (ammo == 1)) || + ((item == ITEM_POWDER_KEG) && (ammo == 1)) || ((item == ITEM_PICTOGRAPH_BOX) && (ammo == 1)) || ((item == ITEM_MAGIC_BEANS) && (ammo == 20))) { // Ammo at capacity gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 120, 255, 0, pauseCtx->alpha); @@ -277,8 +277,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if (((void)0, gSaveContext.save.saveInfo.inventory.items[i]) != ITEM_NONE) { if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_ITEM) && - (pauseCtx->cursorSpecialPos == 0) && - gPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { + (pauseCtx->cursorSpecialPos == 0) && gPlayerFormSlotRestrictions[GET_PLAYER_FORM][i]) { if ((sEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { // Possible bug: // Supposed to be `SLOT_BOW`, unchanged from OoT, instead increase size of ice arrow icon @@ -339,8 +338,12 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -u8 sPlayerFormItems[] = { - ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_NONE, +u8 sPlayerFormItems[PLAYER_FORM_MAX] = { + ITEM_MASK_FIERCE_DEITY, // PLAYER_FORM_FIERCE_DEITY + ITEM_MASK_GORON, // PLAYER_FORM_GORON + ITEM_MASK_ZORA, // PLAYER_FORM_ZORA + ITEM_MASK_DEKU, // PLAYER_FORM_DEKU + ITEM_NONE, // PLAYER_FORM_HUMAN }; void KaleidoScope_UpdateItemCursor(PlayState* play) { @@ -599,24 +602,21 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { // Ensure that a transformation mask can not be unequipped while being used - if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { if (1) {} if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CLEFT)) { - if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)) { - play_sound(NA_SE_SY_ERROR); + if (sPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CDOWN)) { - if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)) { - play_sound(NA_SE_SY_ERROR); + if (sPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CRIGHT)) { - if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { - play_sound(NA_SE_SY_ERROR); + if (sPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } @@ -626,21 +626,21 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CLEFT)) { if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT))) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return; } pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_LEFT; } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CDOWN)) { if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN))) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return; } pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_DOWN; } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CRIGHT)) { if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT))) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return; } pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_RIGHT; @@ -668,12 +668,12 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT) { magicArrowIndex = 2; } - play_sound(NA_SE_SY_SET_FIRE_ARROW + magicArrowIndex); + Audio_PlaySfx(NA_SE_SY_SET_FIRE_ARROW + magicArrowIndex); pauseCtx->equipTargetItem = 0xB5 + magicArrowIndex; pauseCtx->equipAnimAlpha = sEquipState = 0; // EQUIP_STATE_MAGIC_ARROW_GROW_ORB sEquipAnimTimer = 6; } else { - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); } } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && @@ -692,7 +692,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_ITEM]) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM) && (pauseCtx->pageIndex == PAUSE_ITEM)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; @@ -725,13 +725,13 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { sEquipMagicArrowBowSlotHoldTimer--; if (sEquipMagicArrowBowSlotHoldTimer == 0) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; sEquipAnimTimer = 6; pauseCtx->equipAnimScale = 320; pauseCtx->equipAnimShrinkRate = 40; sEquipState++; - play_sound(NA_SE_SY_SYNTH_MAGIC_ARROW); + Audio_PlaySfx(NA_SE_SY_SYNTH_MAGIC_ARROW); } return; } @@ -802,9 +802,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); @@ -819,9 +819,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); @@ -837,19 +837,19 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { // Special case for magic arrows if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) == ITEM_BOW) || - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } } else if (pauseCtx->equipTargetItem == ITEM_BOW) { - if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); - } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT)) { + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); @@ -866,9 +866,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); @@ -883,9 +883,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); @@ -901,18 +901,18 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { // Special case for magic arrows if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) == ITEM_BOW) || - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } } else if (pauseCtx->equipTargetItem == ITEM_BOW) { - if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); - } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT)) { + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); } @@ -928,9 +928,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); @@ -945,9 +945,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) == ITEM_BOW) || - (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); @@ -963,18 +963,18 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { // Special case for magic arrows if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) == ITEM_BOW) || - ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT))) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; } } else if (pauseCtx->equipTargetItem == ITEM_BOW) { - if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); - } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && - (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT)) { + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_LIGHT)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index a4df2c889..ec1ca83ec 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -9,8 +9,7 @@ #include "interface/icon_item_field_static/icon_item_field_static.h" #include "interface/icon_item_dungeon_static/icon_item_dungeon_static.h" #include "interface/icon_item_jpn_static/icon_item_jpn_static.h" - -extern TexturePtr D_09007500; // gPlayerFaceIcon +#include "archives/icon_item_24_static/icon_item_24_static_yar.h" void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { s16 counterDigits[2]; @@ -20,7 +19,7 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); // Get digits for max number of stray fairies - counterDigits[1] = 15; + counterDigits[1] = STRAY_FAIRY_SCATTERED_TOTAL; counterDigits[0] = counterDigits[1] / 10; counterDigits[1] -= (s16)(counterDigits[0] * 10); @@ -76,9 +75,9 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { } TexturePtr sDungeonItemTextures[] = { - 0x09003600, // `gBossKeyIconTex`: DUNGEON_BOSS_KEY - 0x09003F00, // `gCompassIconTex`: DUNGEON_COMPASS - 0x09004800, // `gDungeonMapIconTex`: DUNGEON_MAP + gQuestIconBossKeyTex, // DUNGEON_BOSS_KEY + gQuestIconCompassTex, // DUNGEON_COMPASS + gQuestIconDungeonMapTex, // DUNGEON_MAP }; TexturePtr sDungeonTitleTextures[] = { @@ -283,7 +282,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // Draw Player's face next to the dungeon floor icon currently in. POLY_OPA_DISP = - Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, &D_09007500, 16, 16, 62, + Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, gQuestIconLinkHumanFaceTex, 16, 16, 62, sDungeonMapFloorIconPosY[R_REVERSE_FLOOR_INDEX], 16, 16, 1 << 10, 1 << 10); if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, gSaveContext.dungeonIndex)) { @@ -465,7 +464,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MAP]) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } @@ -765,8 +764,8 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { } } - // Find the regionId that player is currently in - // Loop over regionId (n) and regionIdIndex (j) + // Find the region that player is currently in + // Loop over region (n) and regionIndex (j) while (true) { if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) { n++; @@ -813,8 +812,9 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - POLY_OPA_DISP = Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, &D_09007500, 16, 16, sWorldMapCursorsRectLeft[n], - sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); + POLY_OPA_DISP = + Gfx_DrawTexRectRGBA16(POLY_OPA_DISP, gQuestIconLinkHumanFaceTex, 16, 16, sWorldMapCursorsRectLeft[n], + sWorldMapCursorsRectTop[n], 16, 16, 1 << 10, 1 << 10); } } @@ -824,16 +824,16 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { } u16 sOwlWarpPauseItems[] = { - 0xAF, // OWL_WARP_GREAT_BAY_COAST - 0xB3, // OWL_WARP_ZORA_CAPE - 0xAA, // OWL_WARP_SNOWHEAD - 0xB1, // OWL_WARP_MOUNTAIN_VILLAGE - 0xA9, // OWL_WARP_CLOCK_TOWN - 0xB2, // OWL_WARP_MILK_ROAD - 0xA8, // OWL_WARP_WOODFALL - 0xB0, // OWL_WARP_SOUTHERN_SWAMP - 0xAC, // OWL_WARP_IKANA_CANYON - 0xAE, // OWL_WARP_STONE_TOWER + ITEM_MAP_POINT_GREAT_BAY_COAST, // OWL_WARP_GREAT_BAY_COAST + ITEM_MAP_POINT_ZORA_CAPE, // OWL_WARP_ZORA_CAPE + ITEM_MAP_POINT_SNOWHEAD, // OWL_WARP_SNOWHEAD + ITEM_MAP_POINT_MOUNTAIN_VILLAGE, // OWL_WARP_MOUNTAIN_VILLAGE + ITEM_MAP_POINT_CLOCK_TOWN, // OWL_WARP_CLOCK_TOWN + ITEM_MAP_POINT_MILK_ROAD, // OWL_WARP_MILK_ROAD + ITEM_MAP_POINT_WOODFALL, // OWL_WARP_WOODFALL + ITEM_MAP_POINT_SOUTHERN_SWAMP, // OWL_WARP_SOUTHERN_SWAMP + ITEM_MAP_POINT_IKANA_CANYON, // OWL_WARP_IKANA_CANYON + ITEM_MAP_POINT_STONE_TOWER, // OWL_WARP_STONE_TOWER }; void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { @@ -874,7 +874,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { while (true) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; - if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < REGION_GREAT_BAY) { + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] <= REGION_NONE) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; break; @@ -896,13 +896,13 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->stickAdjX > 30) { - pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = -1; + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = REGION_NONE; pauseCtx->cursorSpecialPos = 0; pauseCtx->cursorShrinkRate = 4.0f; while (true) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; - if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] > REGION_STONE_TOWER) { + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] >= REGION_MAX) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; break; @@ -917,17 +917,17 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { // Used as cursor vtxIndex pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; } - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); sStickAdjTimer = 0; } } else if (pauseCtx->stickAdjX < -30) { - pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = REGION_MAX; pauseCtx->cursorSpecialPos = 0; pauseCtx->cursorShrinkRate = 4.0f; while (true) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; - if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] < 0) { + if (pauseCtx->cursorPoint[PAUSE_WORLD_MAP] <= REGION_NONE) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; break; @@ -942,7 +942,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { // Used as cursor vtxIndex pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; } - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); sStickAdjTimer = 0; } } @@ -951,7 +951,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { pauseCtx->cursorItem[PAUSE_MAP] = PAUSE_ITEM_NONE; } if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } else if (pauseCtx->state == PAUSE_STATE_OWLWARP_SELECT) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_BLUE; @@ -979,13 +979,14 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { sStickAdjTimer++; } - //! TODO: Is the `0xA4` here related to `0xA3` being the last recored item in the `ItemId` enum? - pauseCtx->cursorItem[PAUSE_MAP] = sOwlWarpPauseItems[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] - 0xA4; + // Offset from `ITEM_MAP_POINT_GREAT_BAY` is to get the correct ordering in `map_name_static` + pauseCtx->cursorItem[PAUSE_MAP] = + sOwlWarpPauseItems[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]] - ITEM_MAP_POINT_GREAT_BAY; // Used as cursor vtxIndex pauseCtx->cursorSlot[PAUSE_MAP] = 31 + pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 228f0d16a..7c984a09c 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -16,7 +16,7 @@ s16 sMaskEquipMagicArrowSlotHoldTimer = 0; s16 sMaskEquipAnimTimer = 10; u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][MASK_NUM_SLOTS] = { - // Fierce Deity + // PLAYER_FORM_FIERCE_DEITY { false, // SLOT_MASK_POSTMAN false, // SLOT_MASK_ALL_NIGHT @@ -43,7 +43,7 @@ u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][MASK_NUM_SLOTS] = { false, // SLOT_MASK_GIANT true, // SLOT_MASK_FIERCE_DEITY }, - // Goron + // PLAYER_FORM_GORON { false, // SLOT_MASK_POSTMAN false, // SLOT_MASK_ALL_NIGHT @@ -70,7 +70,7 @@ u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][MASK_NUM_SLOTS] = { false, // SLOT_MASK_GIANT true, // SLOT_MASK_FIERCE_DEITY }, - // Zora + // PLAYER_FORM_ZORA { false, // SLOT_MASK_POSTMAN false, // SLOT_MASK_ALL_NIGHT @@ -97,7 +97,7 @@ u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][MASK_NUM_SLOTS] = { false, // SLOT_MASK_GIANT true, // SLOT_MASK_FIERCE_DEITY }, - // Deku + // PLAYER_FORM_DEKU { false, // SLOT_MASK_POSTMAN false, // SLOT_MASK_ALL_NIGHT @@ -124,7 +124,7 @@ u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][MASK_NUM_SLOTS] = { false, // SLOT_MASK_GIANT true, // SLOT_MASK_FIERCE_DEITY }, - // Human + // PLAYER_FORM_HUMAN { true, // SLOT_MASK_POSTMAN true, // SLOT_MASK_ALL_NIGHT @@ -224,8 +224,7 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { if (((void)0, gSaveContext.save.saveInfo.inventory.items[i + ITEM_NUM_SLOTS]) != ITEM_NONE) { if (!CHECK_GIVEN_MASK_ON_MOON(i)) { if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_MASK) && - (pauseCtx->cursorSpecialPos == 0) && - gMaskPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { + (pauseCtx->cursorSpecialPos == 0) && gMaskPlayerFormSlotRestrictions[GET_PLAYER_FORM][i]) { if ((sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { // Possible bug: // Supposed to be `SLOT_BOW`, unchanged from OoT, instead increase size of ice arrow icon @@ -267,8 +266,12 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -u8 sMaskPlayerFormItems[] = { - ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_NONE, +u8 sMaskPlayerFormItems[PLAYER_FORM_MAX] = { + ITEM_MASK_FIERCE_DEITY, // PLAYER_FORM_FIERCE_DEITY + ITEM_MASK_GORON, // PLAYER_FORM_GORON + ITEM_MASK_ZORA, // PLAYER_FORM_ZORA + ITEM_MASK_DEKU, // PLAYER_FORM_DEKU + ITEM_NONE, // PLAYER_FORM_HUMAN }; void KaleidoScope_UpdateMaskCursor(PlayState* play) { @@ -543,28 +546,25 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT))) || - ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && - (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)))) { - play_sound(NA_SE_SY_ERROR); + ((sMaskPlayerFormItems[GET_PLAYER_FORM] != ITEM_NONE) && + (sMaskPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)))) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN))) || - ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && - (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)))) { - play_sound(NA_SE_SY_ERROR); + ((sMaskPlayerFormItems[GET_PLAYER_FORM] != ITEM_NONE) && + (sMaskPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)))) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT))) || - ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && - (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)))) { - play_sound(NA_SE_SY_ERROR); + ((sMaskPlayerFormItems[GET_PLAYER_FORM] != ITEM_NONE) && + (sMaskPlayerFormItems[GET_PLAYER_FORM] == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)))) { + Audio_PlaySfx(NA_SE_SY_ERROR); return; } } @@ -573,7 +573,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE) && ((cursorSlot == (SLOT_MASK_DEKU - ITEM_NUM_SLOTS)) || (cursorSlot == (SLOT_MASK_GORON - ITEM_NUM_SLOTS)))) { - play_sound(NA_SE_SY_ERROR); + Audio_PlaySfx(NA_SE_SY_ERROR); return; } @@ -596,7 +596,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { sMaskEquipMagicArrowSlotHoldTimer = 0; sMaskEquipState = EQUIP_STATE_MOVE_TO_C_BTN; sMaskEquipAnimTimer = 10; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && CHECK_BTN_ALL(input->press.button, BTN_A) && (msgCtx->msgLength == 0)) { @@ -614,7 +614,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { } if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MASK]) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); } } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_MASK) && (pauseCtx->pageIndex == PAUSE_MASK)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; @@ -647,13 +647,13 @@ void KaleidoScope_UpdateMaskEquip(PlayState* play) { sMaskEquipMagicArrowBowSlotHoldTimer--; if (sMaskEquipMagicArrowBowSlotHoldTimer == 0) { - pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_FIRE; pauseCtx->equipTargetSlot = SLOT_BOW; sMaskEquipAnimTimer = 6; pauseCtx->equipAnimScale = 320; pauseCtx->equipAnimShrinkRate = 40; sMaskEquipState++; - play_sound(NA_SE_SY_SYNTH_MAGIC_ARROW); + Audio_PlaySfx(NA_SE_SY_SYNTH_MAGIC_ARROW); } return; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c index 9bf89cdd2..d2a11b7d2 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c @@ -24,11 +24,11 @@ void KaleidoScope_UpdatePrompt(PlayState* play) { // Move the prompt if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (stickAdjX >= 30)) { // Move right to the no prompt - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); pauseCtx->promptChoice = PAUSE_PROMPT_NO; } else if ((pauseCtx->promptChoice != PAUSE_PROMPT_YES) && (stickAdjX <= -30)) { // Move left to the yes prompt - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); pauseCtx->promptChoice = PAUSE_PROMPT_YES; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index b60a00f9e..c99e6d718 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -3,102 +3,98 @@ * Overlay: ovl_kaleido_scope * Description: Pause Menu */ + #include "prevent_bss_reordering.h" #include "z_kaleido_scope.h" -#include "overlays/gamestates/ovl_opening/z_opening.h" -#include "interface/icon_item_gameover_static/icon_item_gameover_static.h" -#include "interface/icon_item_jpn_static/icon_item_jpn_static.h" #include "z64view.h" #include "overlays/gamestates/ovl_opening/z_opening.h" +#include "archives/icon_item_static/icon_item_static_yar.h" #include "interface/icon_item_gameover_static/icon_item_gameover_static.h" #include "interface/icon_item_jpn_static/icon_item_jpn_static.h" #include "interface/icon_item_vtx_static/icon_item_vtx_static.h" -// iconItemSegment -extern TexturePtr D_08064340; // gPauseMenuCursorTex - // Page Textures (Background of Page): // Broken up into multiple textures. // Numbered by column/row. TexturePtr sMaskPageBgTextures[] = { // Column 0 - 0x08064440, // gPauseMasks00Tex - 0x0806E440, // gPauseMasks01Tex - 0x08077A40, // gPauseMasks02Tex - 0x08081040, // gPauseMasks03Tex - 0x0808A640, // gPauseMasks04Tex + gPauseMasks00Tex, + gPauseMasks01Tex, + gPauseMasks02Tex, + gPauseMasks03Tex, + gPauseMasks04Tex, // Column 1 gPauseMasks10ENGTex, - 0x0806EE40, // gPauseMasks11Tex - 0x08078440, // gPauseMasks12Tex - 0x08081A40, // gPauseMasks13Tex - 0x0808B040, // gPauseMasks14Tex + gPauseMasks11Tex, + gPauseMasks12Tex, + gPauseMasks13Tex, + gPauseMasks14Tex, // Column 2 - 0x08065840, // gPauseMasks20Tex - 0x0806F840, // gPauseMasks21Tex - 0x08078E40, // gPauseMasks22Tex - 0x08082440, // gPauseMasks23Tex - 0x0808BA40, // gPauseMasks24Tex + gPauseMasks20Tex, + gPauseMasks21Tex, + gPauseMasks22Tex, + gPauseMasks23Tex, + gPauseMasks24Tex, }; TexturePtr sItemPageBgTextures[] = { // Column 0 gPauseSelectItem00ENGTex, - 0x08070240, // gPauseSelectItem01Tex - 0x08079840, // gPauseSelectItem02Tex - 0x08082E40, // gPauseSelectItem03Tex - 0x0808C440, // gPauseSelectItem04Tex + gPauseSelectItem01Tex, + gPauseSelectItem02Tex, + gPauseSelectItem03Tex, + gPauseSelectItem04Tex, // Column 1 gPauseSelectItem10ENGTex, - 0x08070C40, // gPauseSelectItem11Tex - 0x0807A240, // gPauseSelectItem12Tex - 0x08083840, // gPauseSelectItem13Tex - 0x0808CE40, // gPauseSelectItem14Tex + gPauseSelectItem11Tex, + gPauseSelectItem12Tex, + gPauseSelectItem13Tex, + gPauseSelectItem14Tex, // Column 2 gPauseSelectItem20ENGTex, - 0x08071640, // gPauseSelectItem21Tex - 0x0807AC40, // gPauseSelectItem22Tex - 0x08084240, // gPauseSelectItem23Tex - 0x0808D840, // gPauseSelectItem24Tex + gPauseSelectItem21Tex, + gPauseSelectItem22Tex, + gPauseSelectItem23Tex, + gPauseSelectItem24Tex, }; TexturePtr sMapPageBgTextures[] = { // Column 0 - 0x08068040, // gPauseMap00Tex - 0x08072040, // gPauseMap01Tex - 0x0807B640, // gPauseMap02Tex - 0x08084C40, // gPauseMap03Tex - 0x0808E240, // gPauseMap04Tex + gPauseMap00Tex, + gPauseMap01Tex, + gPauseMap02Tex, + gPauseMap03Tex, + gPauseMap04Tex, // Column 1 gPauseMap10ENGTex, - 0x08072A40, // gPauseMap11Tex - 0x0807C040, // gPauseMap12Tex - 0x08085640, // gPauseMap13Tex - 0x0808EC40, // gPauseMap14Tex + gPauseMap11Tex, + gPauseMap12Tex, + gPauseMap13Tex, + gPauseMap14Tex, // Column 2 - 0x08069440, // gPauseMap20Tex - 0x08073440, // gPauseMap21Tex - 0x0807CA40, // gPauseMap22Tex - 0x08086040, // gPauseMap23Tex - 0x0808F640, // gPauseMap24Tex + gPauseMap20Tex, + gPauseMap21Tex, + gPauseMap22Tex, + gPauseMap23Tex, + gPauseMap24Tex, }; TexturePtr sQuestPageBgTextures[] = { // Column 0 gPauseQuestStatus00ENGTex, - 0x08073E40, // gPauseQuestStatus01Tex - 0x0807D440, // gPauseQuestStatus02Tex - 0x08086A40, // gPauseQuestStatus03Tex - 0x08090040, // gPauseQuestStatus04Tex + gPauseQuestStatus01Tex, + gPauseQuestStatus02Tex, + gPauseQuestStatus03Tex, + gPauseQuestStatus04Tex, // Column 1 gPauseQuestStatus10ENGTex, - 0x08074840, // gPauseQuestStatus11Tex - 0x0807DE40, // gPauseQuestStatus12Tex - 0x08087440, // gPauseQuestStatus13Tex - 0x08090A40, // gPauseQuestStatus14Tex + gPauseQuestStatus11Tex, + gPauseQuestStatus12Tex, + gPauseQuestStatus13Tex, + gPauseQuestStatus14Tex, // Column 2 gPauseQuestStatus20ENGTex, - 0x08075240, // gPauseQuestStatus21Tex - 0x0807E840, // gPauseQuestStatus22Tex - 0x08087E40, // gPauseQuestStatus23Tex - 0x08091440, // gPauseQuestStatus24Tex + gPauseQuestStatus21Tex, + gPauseQuestStatus22Tex, + gPauseQuestStatus23Tex, + gPauseQuestStatus24Tex, }; s16 gVtxPageMapWorldQuadsWidth[VTX_PAGE_MAP_WORLD_QUADS] = { @@ -252,6 +248,7 @@ void Kaleido_LoadMapNameStatic(void* segment, u32 texIndex) { CmpDma_LoadFile(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0x400); } +//! note: nothing from `map_name_static` is of size `0xA00` in US 1.0 void Kaleido_LoadMapNameStaticLarge(void* segment, u32 texIndex) { CmpDma_LoadFile(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0xA00); } @@ -267,7 +264,7 @@ void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos) pauseCtx->cursorSpecialPos = cursorSpecialPos; pauseCtx->pageSwitchInputTimer = 0; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; @@ -285,7 +282,7 @@ void KaleidoScope_MoveCursorFromSpecialPos(PlayState* play) { pauseCtx->nameDisplayTimer = 0; pauseCtx->cursorSpecialPos = 0; - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); pauseCtx->cursorShrinkRate = 4.0f; @@ -321,11 +318,11 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 direction) { if (direction == SWITCH_PAGE_LEFT) { pauseCtx->nextPageMode = (pauseCtx->pageIndex * 2) + 1; - play_sound(NA_SE_SY_WIN_SCROLL_LEFT); + Audio_PlaySfx(NA_SE_SY_WIN_SCROLL_LEFT); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; } else { // SWITCH_PAGE_RIGHT pauseCtx->nextPageMode = pauseCtx->pageIndex * 2; - play_sound(NA_SE_SY_WIN_SCROLL_RIGHT); + Audio_PlaySfx(NA_SE_SY_WIN_SCROLL_RIGHT); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; } @@ -2607,7 +2604,7 @@ void KaleidoScope_DrawCursor(PlayState* play) { Matrix_Translate(sCursorCirclesX[i], sCursorCirclesY[i], -50.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_OPA_DISP++); - gDPLoadTextureBlock(POLY_OPA_DISP++, &D_08064340, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, + gDPLoadTextureBlock(POLY_OPA_DISP++, gPauseMenuCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPVertex(POLY_OPA_DISP++, &pauseCtx->cursorVtx[0], 4, 0); @@ -2802,10 +2799,14 @@ void KaleidoScope_UpdateOpening(PlayState* play) { } } +u16 sCursorPointsToOcarinaModes[] = { + OCARINA_MODE_WARP_TO_GREAT_BAY_COAST, OCARINA_MODE_WARP_TO_ZORA_CAPE, OCARINA_MODE_WARP_TO_SNOWHEAD, + OCARINA_MODE_WARP_TO_MOUNTAIN_VILLAGE, OCARINA_MODE_WARP_TO_SOUTH_CLOCK_TOWN, OCARINA_MODE_WARP_TO_MILK_ROAD, + OCARINA_MODE_WARP_TO_WOODFALL, OCARINA_MODE_WARP_TO_SOUTHERN_SWAMP, OCARINA_MODE_WARP_TO_IKANA_CANYON, + OCARINA_MODE_WARP_TO_STONE_TOWER, +}; + void KaleidoScope_Update(PlayState* play) { - static u16 sCursorPointsToOcarinaModes[] = { - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - }; static s16 sUnpausedHudVisibility = HUD_VISIBILITY_IDLE; static s16 sNextMainState = PAUSE_MAIN_STATE_IDLE; static s16 sDelayTimer = 10; @@ -2857,20 +2858,20 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->roll = -314.0f; pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart); - size0 = SEGMENT_ROM_SIZE(icon_item_static_old); - CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + size0 = SEGMENT_ROM_SIZE(icon_item_static_syms); + CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0); gSegments[0x08] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); - for (itemId = 0; itemId <= ITEM_BOW_ARROW_FIRE; itemId++) { - if (!gPlayerFormItemRestrictions[(void)0, gSaveContext.save.playerForm][(s32)itemId]) { + for (itemId = 0; itemId <= ITEM_BOW_FIRE; itemId++) { + if (!gPlayerFormItemRestrictions[GET_PLAYER_FORM][(s32)itemId]) { KaleidoScope_GrayOutTextureRGBA32(Lib_SegmentedToVirtual(gItemIcons[(s32)itemId]), 0x400); } } pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); - size1 = SEGMENT_ROM_SIZE(icon_item_24_static_old); - CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_24_static_test), pauseCtx->iconItem24Segment, + size1 = SEGMENT_ROM_SIZE(icon_item_24_static_syms); + CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_24_static_yar), pauseCtx->iconItem24Segment, size1); pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1); @@ -2896,7 +2897,9 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); func_8011552C(play, DO_ACTION_INFO); - if (((void)0, gSaveContext.worldMapArea) < 0x16) { + + //! note: `worldMapArea` never set to a value other than 0 + if (((void)0, gSaveContext.worldMapArea) < 22) { Kaleido_LoadMapNameStaticLarge(pauseCtx->nameSegment + 0x400, ((void)0, gSaveContext.worldMapArea)); } @@ -2944,7 +2947,7 @@ void KaleidoScope_Update(PlayState* play) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); } break; @@ -2978,17 +2981,17 @@ void KaleidoScope_Update(PlayState* play) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIndex) { // The player successfully played the song - play_sound(NA_SE_SY_TRE_BOX_APPEAR); + Audio_PlaySfx(NA_SE_SY_TRE_BOX_APPEAR); sNextMainState = PAUSE_MAIN_STATE_IDLE; sDelayTimer = 30; pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT_DONE; } else if (pauseCtx->ocarinaStaff->state == 0xFF) { // The player failed to play the song - play_sound(NA_SE_SY_OCARINA_ERROR); + Audio_PlaySfx(NA_SE_SY_OCARINA_ERROR); sNextMainState = PAUSE_MAIN_STATE_SONG_PROMPT_INIT; sDelayTimer = 20; pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT_DONE; @@ -3014,7 +3017,7 @@ void KaleidoScope_Update(PlayState* play) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; } break; @@ -3056,7 +3059,7 @@ void KaleidoScope_Update(PlayState* play) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU; } else { - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); Play_SaveCycleSceneFlags(&play->state); gSaveContext.save.saveInfo.playerData.savedSceneId = play->sceneId; func_8014546C(sramCtx); @@ -3075,7 +3078,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; sPauseMenuVerticalOffset = -6240.0f; D_8082B90C = pauseCtx->roll; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU; @@ -3096,7 +3099,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; sPauseMenuVerticalOffset = -6240.0f; D_8082B90C = pauseCtx->roll; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); } break; @@ -3159,7 +3162,7 @@ void KaleidoScope_Update(PlayState* play) { if (interfaceCtx->screenFillAlpha >= 255) { interfaceCtx->screenFillAlpha = 255; pauseCtx->state = PAUSE_STATE_OFF; - Game_SetFramerateDivisor(&play->state, 3); + GameState_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; Object_LoadAll(&play->objectCtx); BgCheck_InitCollisionHeaders(&play->colCtx, play); @@ -3184,12 +3187,12 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->iconItemSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); // Messed up ALIGN64 - size0 = SEGMENT_ROM_SIZE(icon_item_static_old); - CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + size0 = SEGMENT_ROM_SIZE(icon_item_static_syms); + CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0); pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); - size1 = SEGMENT_ROM_SIZE(icon_item_24_static_old); - CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_24_static_test), pauseCtx->iconItem24Segment, size1); + size1 = SEGMENT_ROM_SIZE(icon_item_24_static_syms); + CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_24_static_yar), pauseCtx->iconItem24Segment, size1); pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1); size2 = SEGMENT_ROM_SIZE(icon_item_gameover_static); @@ -3314,14 +3317,14 @@ void KaleidoScope_Update(PlayState* play) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (pauseCtx->promptChoice != PAUSE_PROMPT_YES) { pauseCtx->promptChoice = PAUSE_PROMPT_YES; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); pauseCtx->state = PAUSE_STATE_OFF; - Game_SetFramerateDivisor(&play->state, 3); + GameState_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; Object_LoadAll(&play->objectCtx); BgCheck_InitCollisionHeaders(&play->colCtx, play); } else { - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); pauseCtx->promptChoice = PAUSE_PROMPT_YES; Play_SaveCycleSceneFlags(&play->state); gSaveContext.save.saveInfo.playerData.savedSceneId = play->sceneId; @@ -3338,10 +3341,10 @@ void KaleidoScope_Update(PlayState* play) { sDelayTimer = 90; } } else if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (stickAdjX >= 30)) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); pauseCtx->promptChoice = PAUSE_PROMPT_NO; } else if ((pauseCtx->promptChoice != PAUSE_PROMPT_YES) && (stickAdjX <= -30)) { - play_sound(NA_SE_SY_CURSOR); + Audio_PlaySfx(NA_SE_SY_CURSOR); pauseCtx->promptChoice = PAUSE_PROMPT_YES; } break; @@ -3349,7 +3352,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_GAMEOVER_7: if (sramCtx->status == 0) { pauseCtx->state = PAUSE_STATE_OFF; - Game_SetFramerateDivisor(&play->state, 3); + GameState_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; Object_LoadAll(&play->objectCtx); BgCheck_InitCollisionHeaders(&play->colCtx, play); @@ -3365,18 +3368,18 @@ void KaleidoScope_Update(PlayState* play) { (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START))) { pauseCtx->state = PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT; gameOverCtx->state++; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); } break; case PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT: if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { if (pauseCtx->promptChoice == PAUSE_PROMPT_YES) { - play_sound(NA_SE_SY_PIECE_OF_HEART); + Audio_PlaySfx(NA_SE_SY_PIECE_OF_HEART); Play_SaveCycleSceneFlags(&play->state); if (gSaveContext.save.entrance == ENTRANCE(UNSET_0D, 0)) {} } else { // PAUSE_PROMPT_NO - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); } pauseCtx->state = PAUSE_STATE_GAMEOVER_10; } @@ -3389,7 +3392,7 @@ void KaleidoScope_Update(PlayState* play) { interfaceCtx->screenFillAlpha = 255; pauseCtx->state = PAUSE_STATE_OFF; - Game_SetFramerateDivisor(&play->state, 3); + GameState_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; Object_LoadAll(&play->objectCtx); BgCheck_InitCollisionHeaders(&play->colCtx, play); @@ -3432,8 +3435,8 @@ void KaleidoScope_Update(PlayState* play) { sPauseCursorRightX = 155; pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart); - size0 = SEGMENT_ROM_SIZE(icon_item_static_old); - CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + size0 = SEGMENT_ROM_SIZE(icon_item_static_syms); + CmpDma_LoadAllFiles(SEGMENT_ROM_START(icon_item_static_yar), pauseCtx->iconItemSegment, size0); pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); sInDungeonScene = false; @@ -3484,11 +3487,11 @@ void KaleidoScope_Update(PlayState* play) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); - play->msgCtx.ocarinaMode = 4; + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); + play->msgCtx.ocarinaMode = OCARINA_MODE_END; gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; } else if (CHECK_BTN_ALL(input->press.button, BTN_A)) { - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); Message_StartTextbox(play, 0x1B93, NULL); pauseCtx->state = PAUSE_STATE_OWLWARP_CONFIRM; } else { @@ -3499,32 +3502,32 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_OWLWARP_CONFIRM: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { msgCtx->msgLength = 0; - msgCtx->msgMode = 0; + msgCtx->msgMode = MSGMODE_NONE; if (msgCtx->choiceIndex == 0) { func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); play->msgCtx.ocarinaMode = sCursorPointsToOcarinaModes[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; - play_sound(NA_SE_SY_DECIDE); + Audio_PlaySfx(NA_SE_SY_DECIDE); } else { pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; func_8011552C(play, DO_ACTION_WARP); - play_sound(NA_SE_SY_MESSAGE_PASS); + Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS); } } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { msgCtx->msgLength = 0; - msgCtx->msgMode = 0; + msgCtx->msgMode = MSGMODE_NONE; pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; - play_sound(NA_SE_SY_MESSAGE_PASS); + Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS); } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { msgCtx->msgLength = 0; - msgCtx->msgMode = 0; + msgCtx->msgMode = MSGMODE_NONE; func_8011552C(play, DO_ACTION_NONE); pauseCtx->state = PAUSE_STATE_OWLWARP_6; sPauseMenuVerticalOffset = -6240.0f; - func_801A3AEC(0); - play->msgCtx.ocarinaMode = 4; + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_CLOSE); + play->msgCtx.ocarinaMode = OCARINA_MODE_END; gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; } break; @@ -3582,7 +3585,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_UNPAUSE_CLOSE: pauseCtx->state = PAUSE_STATE_OFF; - Game_SetFramerateDivisor(&play->state, 3); + GameState_SetFramerateDivisor(&play->state, 3); R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; Object_LoadAll(&play->objectCtx); BgCheck_InitCollisionHeaders(&play->colCtx, play); @@ -3599,7 +3602,7 @@ void KaleidoScope_Update(PlayState* play) { MsgEvent_SendNullTask(); func_80143324(play, &play->skyboxCtx, play->skyboxId); - if ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF)) { + if ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId == 0xFF)) { func_80115844(play, DO_ACTION_STOP); func_8011552C(play, DO_ACTION_STOP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_C); diff --git a/sym_info.py b/sym_info.py index 17849a953..8578b2812 100755 --- a/sym_info.py +++ b/sym_info.py @@ -1,139 +1,29 @@ #!/usr/bin/env python3 import argparse -import os.path +from pathlib import Path -parser = argparse.ArgumentParser( - description="Display various information about a symbol or address." -) -parser.add_argument( - "name", - type=str, - default="", - help="symbol name or VROM/VRAM address to lookup" -) -parser.add_argument( - "-e", - "--expected", - dest="use_expected", - action="store_true", - help="use the map file in expected/build/ instead of build/" -) -args = parser.parse_args() - -mymap = "build/mm.map" -if args.use_expected: - mymap = f"expected/{mymap}" - -if not os.path.isfile(mymap): - print(f"{mymap} must exist.") +try: + import mapfile_parser +except ImportError: + print("Missing dependency mapfile_parser, install it with `python3 -m pip install 'mapfile-parser>=1.2.1,<2.0.0'`") exit(1) -def search_address(target_addr): - is_ram = target_addr & 0x80000000 - ram_offset = None - prev_ram = 0 - prev_rom = 0 - prev_sym = "" - cur_file = "" - prev_file = cur_file - prev_line = "" - with open(mymap) as f: - for line in f: - if "load address" in line: - # Ignore .bss sections if we're looking for a ROM address - if not is_ram and (".bss" in line or ".bss" in prev_line): - ram_offset = None - continue - ram = int(line[16 : 16 + 18], 0) - rom = int(line[59 : 59 + 18], 0) - ram_offset = ram - rom - continue +def symInfoMain(): + parser = argparse.ArgumentParser(description="Display various information about a symbol or address.") + parser.add_argument("symname", help="symbol name or VROM/VRAM address to lookup") + parser.add_argument("-e", "--expected", dest="use_expected", action="store_true", help="use the map file in expected/build/ instead of build/") - prev_line = line + args = parser.parse_args() - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): - continue + BUILTMAP = Path(f"build") / f"mm.map" - ram = int(line[16 : 16 + 18], 0) - rom = ram - ram_offset - sym = line.split()[-1] + mapPath = BUILTMAP + if args.use_expected: + mapPath = "expected" / BUILTMAP - if "0x" in sym and "/" not in sym: - ram_offset = None - continue - if "/" in sym: - cur_file = sym - continue + mapfile_parser.frontends.sym_info.doSymInfo(mapPath, args.symname) - if rom == target_addr or (is_ram and ram == target_addr): - return f"{sym} (VRAM 0x{ram:X}, VROM 0x{rom:X}, {cur_file})" - if rom > target_addr or (is_ram and ram > target_addr): - offset = target_addr - prev_ram if is_ram else target_addr - prev_rom - return f"at 0x{offset:X} bytes inside {prev_sym} (VRAM 0x{prev_ram:X}, VROM 0x{prev_rom:X}, {prev_file})" - - prev_ram = ram - prev_rom = rom - prev_sym = sym - prev_file = cur_file - - return "at end of rom?" - - -def search_symbol(target_sym): - ram_offset = None - cur_file = "" - prev_line = "" - with open(mymap) as f: - for line in f: - if "load address" in line: - ram = int(line[16 : 16 + 18], 0) - rom = int(line[59 : 59 + 18], 0) - ram_offset = ram - rom - continue - - prev_line = line - - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): - continue - - ram = int(line[16 : 16 + 18], 0) - rom = ram - ram_offset - sym = line.split()[-1] - - if "0x" in sym and "/" not in sym: - ram_offset = None - continue - elif "/" in sym: - cur_file = sym - continue - - if sym == target_sym: - return (rom, cur_file, ram) - - return None - - -try: - target_addr = int(args.name, 0) - print(args.name, "is", search_address(target_addr)) -except ValueError: - sym_info = search_symbol(args.name) - if sym_info is not None: - sym_rom = sym_info[0] - sym_file = sym_info[1] - sym_ram = sym_info[2] - print(f"Symbol {args.name} (VRAM: 0x{sym_ram:08X}, VROM: 0x{sym_rom:06X}, {sym_file})") - else: - print(f"Symbol {args.name} not found in map file {mymap}") +if __name__ == "__main__": + symInfoMain() diff --git a/tools/ZAPD/.clang-format b/tools/ZAPD/.clang-format index 784e734e9..5ba1c4a95 100644 --- a/tools/ZAPD/.clang-format +++ b/tools/ZAPD/.clang-format @@ -66,7 +66,7 @@ PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Left ReflowComments: true -SortIncludes: true +SortIncludes: false SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index 131ccdc88..c8d51d0cf 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = 23929ec9373d28cb298daad4ad7cb468e09c0a46 - parent = 2e487b5008c129031ab311a3a7bfd42adeb4916b + commit = 7f398831fbcf67210b37882b5017093a1d187d5c + parent = 71e36ae371f89b5f86a6d59c7ebc24b8a55ee43e method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/tools/ZAPD/ExporterTest/CollisionExporter.cpp b/tools/ZAPD/ExporterTest/CollisionExporter.cpp index db5ad1a79..6431a4593 100644 --- a/tools/ZAPD/ExporterTest/CollisionExporter.cpp +++ b/tools/ZAPD/ExporterTest/CollisionExporter.cpp @@ -67,9 +67,9 @@ void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]] fs::path o for (auto entry : col->camData->entries) { - writer->Write(entry->cameraSType); - writer->Write(entry->numData); - writer->Write(entry->cameraPosDataSeg); + writer->Write(entry.cameraSType); + writer->Write(entry.numData); + writer->Write(entry.cameraPosDataSeg); } writer->Seek(oldOffset, SeekOffsetType::Start); diff --git a/tools/ZAPD/ExporterTest/Makefile b/tools/ZAPD/ExporterTest/Makefile index 42033b7c0..98e047525 100644 --- a/tools/ZAPD/ExporterTest/Makefile +++ b/tools/ZAPD/ExporterTest/Makefile @@ -17,7 +17,7 @@ clean: rm -rf build $(LIB) format: - clang-format-11 -i $(CPP_FILES) $(H_FILES) + clang-format-14 -i $(CPP_FILES) $(H_FILES) .PHONY: all clean format diff --git a/tools/ZAPD/Makefile b/tools/ZAPD/Makefile index e725f94f8..36331937a 100644 --- a/tools/ZAPD/Makefile +++ b/tools/ZAPD/Makefile @@ -8,6 +8,18 @@ COPYCHECK_ARGS ?= LLD ?= 0 WERROR ?= 0 +# On MacOS 10.14, use boost::filesystem, because +# the system doesn't supply std::filesystem. +ifneq ($(OS),Windows_NT) + ifeq ($(shell uname -s),Darwin) + MACOS_VERSION := $(shell sw_vers -productVersion | cut -d . -f 1,2) + ifeq ($(MACOS_VERSION),10.14) + USE_BOOST_FS ?= 1 + endif + endif +endif +USE_BOOST_FS ?= 0 + # Use clang++ if available, else use g++ ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0) CXX := clang++ @@ -46,6 +58,11 @@ endif LDFLAGS := -lm -ldl -lpng +ifneq ($(USE_BOOST_FS),0) + CXXFLAGS += -DUSE_BOOST_FS + LDFLAGS += -lboost_filesystem +endif + # Use LLD if available. Set LLD=0 to not use it ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) LLD := 1 @@ -106,7 +123,7 @@ clean: rebuild: clean all format: - clang-format-11 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES) + clang-format-14 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES) $(MAKE) -C ZAPDUtils format $(MAKE) -C ExporterTest format diff --git a/tools/ZAPD/README.md b/tools/ZAPD/README.md index bb96bab1b..e2d1f64e0 100644 --- a/tools/ZAPD/README.md +++ b/tools/ZAPD/README.md @@ -139,22 +139,23 @@ Each warning type uses one of these by default, but can be modified with flags, All warning types currently implemented, with their default levels: -| Warning type | Default level | Description | -| --------------------------- | ------------- | ------------------------------------------------------------------------ | -| `-Wdeprecated` | Warn | Deprecated features | -| `-Whardcoded-pointer` | Warn | ZAPD lacks the info to make a symbol, so must output a hardcoded pointer | -| `-Wintersection` | Warn | Two assets intersect | -| `-Winvalid-attribute-value` | Err | Attribute declared in XML is wrong | -| `-Winvalid-extracted-data` | Err | Extracted data does not have correct form | -| `-Winvalid-jpeg` | Err | JPEG file does not conform to the game's format requirements | -| `-Winvalid-png` | Err | Issues arising when processing PNG data | -| `-Winvalid-xml` | Err | XML has syntax errors | -| `-Wmissing-attribute` | Warn | Required attribute missing in XML tag | -| `-Wmissing-offsets` | Warn | Offset attribute missing in XML tag | -| `-Wmissing-segment` | Warn | Segment not given in File tag in XML | -| `-Wnot-implemented` | Warn | ZAPD does not currently support this feature | -| `-Wunaccounted` | Off | Large blocks of unaccounted | -| `-Wunknown-attribute` | Warn | Unknown attribute in XML entry tag | +| Warning type | Default level | Description | +| ----------------------------- | ------------- | ------------------------------------------------------------------------ | +| `-Wdeprecated` | Warn | Deprecated features | +| `-Whardcoded-generic-pointer` | Off | A generic segmented pointer must be produced | +| `-Whardcoded-pointer` | Warn | ZAPD lacks the info to make a symbol, so must output a hardcoded pointer | +| `-Wintersection` | Warn | Two assets intersect | +| `-Winvalid-attribute-value` | Err | Attribute declared in XML is wrong | +| `-Winvalid-extracted-data` | Err | Extracted data does not have correct form | +| `-Winvalid-jpeg` | Err | JPEG file does not conform to the game's format requirements | +| `-Winvalid-png` | Err | Issues arising when processing PNG data | +| `-Winvalid-xml` | Err | XML has syntax errors | +| `-Wmissing-attribute` | Warn | Required attribute missing in XML tag | +| `-Wmissing-offsets` | Warn | Offset attribute missing in XML tag | +| `-Wmissing-segment` | Warn | Segment not given in File tag in XML | +| `-Wnot-implemented` | Warn | ZAPD does not currently support this feature | +| `-Wunaccounted` | Off | Large blocks of unaccounted | +| `-Wunknown-attribute` | Warn | Unknown attribute in XML entry tag | There are also errors that do not have a type, and cannot be disabled. diff --git a/tools/ZAPD/ZAPD/CRC32.h b/tools/ZAPD/ZAPD/CRC32.h index 4158a5528..1f82c75c5 100644 --- a/tools/ZAPD/ZAPD/CRC32.h +++ b/tools/ZAPD/ZAPD/CRC32.h @@ -1,6 +1,6 @@ #pragma once -static uint32_t CRC32B(unsigned char* message, int32_t size) +static uint32_t CRC32B(const unsigned char* message, int32_t size) { int32_t byte, crc; int32_t mask; diff --git a/tools/ZAPD/ZAPD/CrashHandler.cpp b/tools/ZAPD/ZAPD/CrashHandler.cpp index 356866536..7ddec5a7e 100644 --- a/tools/ZAPD/ZAPD/CrashHandler.cpp +++ b/tools/ZAPD/ZAPD/CrashHandler.cpp @@ -8,6 +8,7 @@ #endif #include +#include #include #include #include diff --git a/tools/ZAPD/ZAPD/Declaration.cpp b/tools/ZAPD/ZAPD/Declaration.cpp index 34ab95351..30863803a 100644 --- a/tools/ZAPD/ZAPD/Declaration.cpp +++ b/tools/ZAPD/ZAPD/Declaration.cpp @@ -4,61 +4,79 @@ #include "Utils/StringHelper.h" Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nText) + const std::string& nBody) { address = nAddress; alignment = nAlignment; size = nSize; - text = nText; + declBody = nBody; } -Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - const std::string& nText) - : Declaration(nAddress, nAlignment, nSize, nText) +Declaration* Declaration::Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize, + const std::string& declType, const std::string& declName, + const std::string& declBody) { - varType = nVarType; - varName = nVarName; - isArray = nIsArray; + Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); + + decl->declType = declType; + decl->declName = declName; + decl->declBody = declBody; + + return decl; } -Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - size_t nArrayItemCnt, const std::string& nText) - : Declaration(nAddress, nAlignment, nSize, nText) +Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& declBody, + size_t declArrayItemCnt, bool isDeclExternal) { - varType = nVarType; - varName = nVarName; - isArray = nIsArray; - arrayItemCnt = nArrayItemCnt; + Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); + + decl->declName = declName; + decl->declType = declType; + decl->arrayItemCnt = declArrayItemCnt; + decl->isExternal = isDeclExternal; + decl->isArray = true; + + return decl; } -Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - const std::string& nArrayItemCntStr, const std::string& nText) - : Declaration(nAddress, nAlignment, nSize, nText) +Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& declBody, + const std::string& declArrayItemCntStr, bool isDeclExternal) { - varType = nVarType; - varName = nVarName; - isArray = nIsArray; - arrayItemCntStr = nArrayItemCntStr; + Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); + + decl->declName = declName; + decl->declType = declType; + decl->arrayItemCntStr = declArrayItemCntStr; + decl->isExternal = isDeclExternal; + decl->isArray = true; + + return decl; } -Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - size_t nArrayItemCnt, const std::string& nText, bool nIsExternal) - : Declaration(nAddress, nAlignment, nSize, nVarType, nVarName, nIsArray, nArrayItemCnt, nText) +Declaration* Declaration::CreateInclude(offset_t declAddr, const std::string& includePath, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& defines) { - isExternal = nIsExternal; + Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, declSize, ""); + decl->includePath = includePath; + decl->declType = declType; + decl->declName = declName; + decl->defines = defines; + + return decl; } -Declaration::Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize, - const std::string& nVarType, const std::string& nVarName) - : Declaration(nAddress, DeclarationAlignment::Align4, nSize, "") +Declaration* Declaration::CreatePlaceholder(offset_t declAddr, const std::string& declName) { - includePath = nIncludePath; - varType = nVarType; - varName = nVarName; + Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, 0, ""); + decl->declName = declName; + decl->isPlaceholder = true; + + return decl; } bool Declaration::IsStatic() const @@ -82,9 +100,6 @@ std::string Declaration::GetNormalDeclarationStr() const { std::string output; - if (preText != "") - output += preText + "\n"; - if (IsStatic()) { output += "static "; @@ -92,27 +107,28 @@ std::string Declaration::GetNormalDeclarationStr() const if (isArray) { - if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) + bool includeArraySize = (IsStatic() || forceArrayCnt); + + if (includeArraySize) { - output += StringHelper::Sprintf("%s %s[%s];\n", varType.c_str(), varName.c_str(), - arrayItemCntStr.c_str()); - } - else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) - { - output += StringHelper::Sprintf("%s %s[%i] = {\n", varType.c_str(), varName.c_str(), - arrayItemCnt); + if (arrayItemCntStr != "") + output += StringHelper::Sprintf("%s %s[%s];\n", declType.c_str(), declName.c_str(), + arrayItemCntStr.c_str()); + else + output += StringHelper::Sprintf("%s %s[%i] = {\n", declType.c_str(), + declName.c_str(), arrayItemCnt); } else { - output += StringHelper::Sprintf("%s %s[] = {\n", varType.c_str(), varName.c_str()); + output += StringHelper::Sprintf("%s %s[] = {\n", declType.c_str(), declName.c_str()); } - output += text + "\n"; + output += declBody + "\n"; } else { - output += StringHelper::Sprintf("%s %s = { ", varType.c_str(), varName.c_str()); - output += text; + output += StringHelper::Sprintf("%s %s = { ", declType.c_str(), declName.c_str()); + output += declBody; } if (output.back() == '\n') @@ -120,14 +136,8 @@ std::string Declaration::GetNormalDeclarationStr() const else output += " };"; - if (rightText != "") - output += " " + rightText + ""; - output += "\n"; - if (postText != "") - output += postText + "\n"; - output += "\n"; return output; @@ -137,41 +147,34 @@ std::string Declaration::GetExternalDeclarationStr() const { std::string output; - if (preText != "") - output += preText + "\n"; - if (IsStatic()) - { output += "static "; + + bool includeArraySize = (IsStatic() || forceArrayCnt); + + if (includeArraySize) + { + if (arrayItemCntStr != "") + output += StringHelper::Sprintf("%s %s[%s] = ", declType.c_str(), declName.c_str(), + arrayItemCntStr.c_str()); + else + output += StringHelper::Sprintf("%s %s[%i] = ", declType.c_str(), declName.c_str(), + arrayItemCnt); + } + else + { + output += StringHelper::Sprintf("%s %s[] = ", declType.c_str(), declName.c_str()); } - if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) - output += StringHelper::Sprintf("%s %s[%s] = ", varType.c_str(), varName.c_str(), - arrayItemCntStr.c_str()); - else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) - output += - StringHelper::Sprintf("%s %s[%i] = ", varType.c_str(), varName.c_str(), arrayItemCnt); - else - output += StringHelper::Sprintf("%s %s[] = ", varType.c_str(), varName.c_str()); - output += StringHelper::Sprintf("{\n#include \"%s\"\n};", includePath.c_str()); - - if (rightText != "") - output += " " + rightText + ""; - - output += "\n"; - - if (postText != "") - output += postText + "\n"; - - output += "\n"; + output += "\n\n"; return output; } std::string Declaration::GetExternStr() const { - if (IsStatic() || varType == "" || isUnaccounted) + if (IsStatic() || declType == "" || isUnaccounted) { return ""; } @@ -180,19 +183,28 @@ std::string Declaration::GetExternStr() const { if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) { - return StringHelper::Sprintf("extern %s %s[%s];\n", varType.c_str(), varName.c_str(), + return StringHelper::Sprintf("extern %s %s[%s];\n", declType.c_str(), declName.c_str(), arrayItemCntStr.c_str()); } else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) { - return StringHelper::Sprintf("extern %s %s[%i];\n", varType.c_str(), varName.c_str(), + return StringHelper::Sprintf("extern %s %s[%i];\n", declType.c_str(), declName.c_str(), arrayItemCnt); } else - return StringHelper::Sprintf("extern %s %s[];\n", varType.c_str(), varName.c_str()); + return StringHelper::Sprintf("extern %s %s[];\n", declType.c_str(), declName.c_str()); } - return StringHelper::Sprintf("extern %s %s;\n", varType.c_str(), varName.c_str()); + return StringHelper::Sprintf("extern %s %s;\n", declType.c_str(), declName.c_str()); +} + +std::string Declaration::GetDefinesStr() const +{ + if (IsStatic() || (declType == "")) + { + return ""; + } + return StringHelper::Sprintf("%s", defines.c_str()); } std::string Declaration::GetStaticForwardDeclarationStr() const @@ -210,15 +222,15 @@ std::string Declaration::GetStaticForwardDeclarationStr() const if (arrayItemCntStr != "") { - return StringHelper::Sprintf("static %s %s[%s];\n", varType.c_str(), varName.c_str(), + return StringHelper::Sprintf("static %s %s[%s];\n", declType.c_str(), declName.c_str(), arrayItemCntStr.c_str()); } else { - return StringHelper::Sprintf("static %s %s[%i];\n", varType.c_str(), varName.c_str(), + return StringHelper::Sprintf("static %s %s[%i];\n", declType.c_str(), declName.c_str(), arrayItemCnt); } } - return StringHelper::Sprintf("static %s %s;\n", varType.c_str(), varName.c_str()); + return StringHelper::Sprintf("static %s %s;\n", declType.c_str(), declName.c_str()); } diff --git a/tools/ZAPD/ZAPD/Declaration.h b/tools/ZAPD/ZAPD/Declaration.h index 4a743b50f..d079cb8dc 100644 --- a/tools/ZAPD/ZAPD/Declaration.h +++ b/tools/ZAPD/ZAPD/Declaration.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -22,59 +23,160 @@ enum class StaticConfig On }; +/// +/// A declaration is contains the C contents of a symbol for a file. +/// It contains at a minimum the address where the symbol would be in the binary file, alignment +/// settings, the size of the binary data, and the C code that makes it up. Optionally it can also +/// contain comments. +/// class Declaration { public: - offset_t address; - DeclarationAlignment alignment; - size_t size; - std::string preText; - std::string text; - std::string rightText; - std::string postText; - std::string preComment; - std::string postComment; - std::string varType; - std::string varName; - std::string includePath; + // Where in the binary file (segment) will this C code end up being? + offset_t address = 0; + // How is this C code aligned? + DeclarationAlignment alignment = DeclarationAlignment::Align4; + + // How many bytes will this C code take up in the resulting binary when compiled? + size_t size = 0; + + // The C type of this declaration + std::string declType = ""; + + // The C variable name of this declaration + std::string declName = ""; + + // The body of the declaration containing the data. + // In "int j = 7;", "7" would be text. + std::string declBody = ""; + + // #define's to be included in the header + std::string defines = ""; + + std::string includePath = ""; + + // Is this declaration in an external file? (ie. a gameplay_keep reference being found in + // another file that wishes to use its data) bool isExternal = false; + bool isArray = false; + + // If true, will ensure that the arrays size is included in the declaration bool forceArrayCnt = false; + + // If this declaration is an array, how many items make it up? size_t arrayItemCnt = 0; + + // Overrides the brackets for the arrays size with a custom string std::string arrayItemCntStr = ""; + std::vector references; + + // If true, this declaration represents data inside the file which we do not understand it's + // purpose for. It will be outputted as just a byte array. bool isUnaccounted = false; + + // Is this declaration a placeholder that will be replaced later? bool isPlaceholder = false; + + // Does this declaration come straight from the XML? + // If false, this means that the declaration was created by ZAPD when it was parsing the + // resources. bool declaredInXml = false; + StaticConfig staticConf = StaticConfig::Global; - Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - const std::string& nText); - Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - size_t nArrayItemCnt, const std::string& nText); - Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - const std::string& nArrayItemCntStr, const std::string& nText); - Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nVarType, const std::string& nVarName, bool nIsArray, - size_t nArrayItemCnt, const std::string& nText, bool nIsExternal); + /// + /// Creates a regular declaration. + /// + /// The address inside a binary file this declaration will be in when + /// compiled. The alignment of this declaration in the compiled + /// binary file. The size of this declaration when it is compiled + /// to binary data. The C variable type this declaration will be + /// declared as. The C variable name this declaration will be + /// declared as. The contents of the C variable + /// declaration. + static Declaration* Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize, + const std::string& declType, const std::string& declName, + const std::string& declBody); - Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize, - const std::string& nVarType, const std::string& nVarName); + /// + /// Creates an array declaration. + /// + /// The address inside a binary file this declaration will be in when + /// compiled. The alignment of this declaration in the compiled + /// binary file. The size of this declaration when it is compiled + /// to binary data. The C variable type this declaration will be + /// declared as. The C variable name this declaration will be + /// declared as. The contents of the C variable + /// declaration. The number of items in the + /// array. (Optional) Is this declaration from another + /// segment? + static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& declBody, + size_t declArrayItemCnt = 0, bool isDeclExternal = false); + + /// + /// Creates an array declaration who's size in the C code uses a custom string. + /// + /// The address inside a binary file this declaration will be in when + /// compiled. The alignment of this declaration in the compiled + /// binary file. The size of this declaration when it is compiled + /// to binary data. The C variable type this declaration will be + /// declared as. The C variable name this declaration will be + /// declared as. The contents of the C variable + /// declaration. The string to be put in the C array's + /// size inbetween the brackets. (Optional) Is this + /// declaration from another segment? + static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& declBody, + const std::string& declArrayItemCntStr, + bool isDeclExternal = false); + + /// + /// Creates a declaration who's body uses a #include to include another file + /// + /// The address inside a binary file this declaration will be in when + /// compiled. The path to the file this declaration will be + /// #including. The size of this declaration when it is compiled + /// to binary data. The C variable type this declaration will be + /// declared as. The C variable name this declaration will be + /// declared as. (Optional) Any #define's we want to have + /// outputted by this declaration. + static Declaration* CreateInclude(offset_t declAddr, const std::string& includePath, + size_t declSize, const std::string& declType, + const std::string& declName, const std::string& defines = ""); + + /// + /// Creates a placeholder declaration to be replaced later. + /// + /// The address inside a binary file this declaration will be in when + /// compiled. The C variable name this declaration will be + /// declared as. + static Declaration* CreatePlaceholder(offset_t declAddr, const std::string& declName); bool IsStatic() const; + // Returns the declaration as C code as it would be in the code file when the body contains the + // needed data std::string GetNormalDeclarationStr() const; + + // Returns the declaration as C code as it would be in the code file when the body #include's + // another file std::string GetExternalDeclarationStr() const; + // Generates the extern for this item to be placed in header files. std::string GetExternStr() const; + // Generates any #define's needed + std::string GetDefinesStr() const; + std::string GetStaticForwardDeclarationStr() const; protected: Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nText); + const std::string& nBody); }; diff --git a/tools/ZAPD/ZAPD/ExporterSet.h b/tools/ZAPD/ZAPD/ExporterSet.h new file mode 100644 index 000000000..c4dd93445 --- /dev/null +++ b/tools/ZAPD/ZAPD/ExporterSet.h @@ -0,0 +1,24 @@ +#pragma once + +typedef void (*ExporterSetFunc)(ZFile*); +typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode); +typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i); +typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode); +typedef void (*ExporterSetFuncVoid3)(); +typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer); + +class ExporterSet +{ +public: + ~ExporterSet(); + + std::map exporters; + ExporterSetFuncVoid parseArgsFunc = nullptr; + ExporterSetFuncVoid2 parseFileModeFunc = nullptr; + ExporterSetFuncBool processFileModeFunc = nullptr; + ExporterSetFunc beginFileFunc = nullptr; + ExporterSetFunc endFileFunc = nullptr; + ExporterSetFuncVoid3 beginXMLFunc = nullptr; + ExporterSetFuncVoid3 endXMLFunc = nullptr; + ExporterSetResSave resSaveFunc = nullptr; +}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp index 777cf9d49..638480875 100644 --- a/tools/ZAPD/ZAPD/GameConfig.cpp +++ b/tools/ZAPD/ZAPD/GameConfig.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "Utils/Directory.h" #include "Utils/File.h" @@ -124,6 +125,7 @@ void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element) { bgScreenWidth = element.IntAttribute("ScreenWidth", 320); bgScreenHeight = element.IntAttribute("ScreenHeight", 240); + useScreenWidthHeightConstants = element.BoolAttribute("UseScreenWidthHeightConstants", true); } void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element) diff --git a/tools/ZAPD/ZAPD/GameConfig.h b/tools/ZAPD/ZAPD/GameConfig.h index 2a783d10a..d650c6d70 100644 --- a/tools/ZAPD/ZAPD/GameConfig.h +++ b/tools/ZAPD/ZAPD/GameConfig.h @@ -37,6 +37,8 @@ public: // ZBackground uint32_t bgScreenWidth = 320, bgScreenHeight = 240; + bool useScreenWidthHeightConstants = true; // If true, ZBackground's will be declared with + // SCREEN_WIDTH * SCREEN_HEIGHT in the C file // ExternalFile fs::path externalXmlFolder; diff --git a/tools/ZAPD/ZAPD/Globals.cpp b/tools/ZAPD/ZAPD/Globals.cpp index a10705e9a..02380f690 100644 --- a/tools/ZAPD/ZAPD/Globals.cpp +++ b/tools/ZAPD/ZAPD/Globals.cpp @@ -83,9 +83,10 @@ ExporterSet* Globals::GetExporterSet() } bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, - const std::string& expectedType, std::string& declName) + const std::string& expectedType, std::string& declName, + bool warnIfNotFound) { - if (segAddress == 0) + if (segAddress == SEGMENTED_NULL) { declName = "NULL"; return true; @@ -160,14 +161,18 @@ bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, } declName = StringHelper::Sprintf("0x%08X", segAddress); + if (warnIfNotFound) + { + WarnHardcodedPointer(segAddress, currentFile, nullptr, -1); + } return false; } bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile, const std::string& expectedType, - std::string& declName) + std::string& declName, bool warnIfNotFound) { - if (segAddress == 0) + if (segAddress == SEGMENTED_NULL) { declName = "NULL"; return true; @@ -197,9 +202,36 @@ bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSi } declName = StringHelper::Sprintf("0x%08X", segAddress); + if (warnIfNotFound) + { + WarnHardcodedPointer(segAddress, currentFile, nullptr, -1); + } return false; } +void Globals::WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res, + offset_t currentOffset) +{ + uint8_t segment = GETSEGNUM(segAddress); + + if ((segment >= 2 && segment <= 6) || segment == 0x80) + { + std::string errorHeader = "A hardcoded pointer was found"; + std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress); + + HANDLE_WARNING_RESOURCE(WarningType::HardcodedPointer, currentFile, res, currentOffset, + errorHeader, errorBody); + } + else + { + std::string errorHeader = "A general purpose hardcoded pointer was found"; + std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress); + + HANDLE_WARNING_RESOURCE(WarningType::HardcodedGenericPointer, currentFile, res, + currentOffset, errorHeader, errorBody); + } +} + ExternalFile::ExternalFile(fs::path nXmlPath, fs::path nOutPath) : xmlPath{nXmlPath}, outPath{nOutPath} { diff --git a/tools/ZAPD/ZAPD/Globals.h b/tools/ZAPD/ZAPD/Globals.h index 1ae753e20..0bfcaeec7 100644 --- a/tools/ZAPD/ZAPD/Globals.h +++ b/tools/ZAPD/ZAPD/Globals.h @@ -5,6 +5,7 @@ #include #include "GameConfig.h" #include "ZFile.h" +#include "ExporterSet.h" class ZRoom; @@ -15,29 +16,6 @@ enum class VerbosityLevel VERBOSITY_DEBUG }; -typedef void (*ExporterSetFunc)(ZFile*); -typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode); -typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i); -typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode); -typedef void (*ExporterSetFuncVoid3)(); -typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer); - -class ExporterSet -{ -public: - ~ExporterSet(); - - std::map exporters; - ExporterSetFuncVoid parseArgsFunc = nullptr; - ExporterSetFuncVoid2 parseFileModeFunc = nullptr; - ExporterSetFuncBool processFileModeFunc = nullptr; - ExporterSetFunc beginFileFunc = nullptr; - ExporterSetFunc endFileFunc = nullptr; - ExporterSetFuncVoid3 beginXMLFunc = nullptr; - ExporterSetFuncVoid3 endXMLFunc = nullptr; - ExporterSetResSave resSaveFunc = nullptr; -}; - class Globals { public: @@ -86,8 +64,14 @@ public: * in which case `declName` will be set to the address formatted as a pointer. */ bool GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, - const std::string& expectedType, std::string& declName); + const std::string& expectedType, std::string& declName, + bool warnIfNotFound = true); bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile, - const std::string& expectedType, std::string& declName); + const std::string& expectedType, std::string& declName, + bool warnIfNotFound = true); + + // TODO: consider moving to another place + void WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res, + offset_t currentOffset); }; diff --git a/tools/ZAPD/ZAPD/Main.cpp b/tools/ZAPD/ZAPD/Main.cpp index 2563154e5..40a38bc60 100644 --- a/tools/ZAPD/ZAPD/Main.cpp +++ b/tools/ZAPD/ZAPD/Main.cpp @@ -9,24 +9,52 @@ #include "ZFile.h" #include "ZTexture.h" +#include #include "CrashHandler.h" #include #include #include "tinyxml2.h" +using ArgFunc = void (*)(int&, char**); + +void Arg_SetOutputPath(int& i, char* argv[]); +void Arg_SetInputPath(int& i, char* argv[]); +void Arg_SetBaseromPath(int& i, char* argv[]); +void Arg_SetSourceOutputPath(int& i, char* argv[]); +void Arg_GenerateSourceFile(int& i, char* argv[]); +void Arg_TestMode(int& i, char* argv[]); +void Arg_LegacyDList(int& i, char* argv[]); +void Arg_EnableProfiling(int& i, char* argv[]); +void Arg_UseExternalResources(int& i, char* argv[]); +void Arg_SetTextureType(int& i, char* argv[]); +void Arg_ReadConfigFile(int& i, char* argv[]); +void Arg_EnableErrorHandler(int& i, char* argv[]); +void Arg_SetVerbosity(int& i, char* argv[]); +void Arg_VerboseUnaccounted(int& i, char* argv[]); +void Arg_SetExporter(int& i, char* argv[]); +void Arg_EnableGCCCompat(int& i, char* argv[]); +void Arg_ForceStatic(int& i, char* argv[]); +void Arg_ForceUnaccountedStatic(int& i, char* argv[]); + +int main(int argc, char* argv[]); + bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath, ZFileMode fileMode); +void ParseArgs(int& argc, char* argv[]); + void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath); void BuildAssetBackground(const fs::path& imageFilePath, const fs::path& outPath); void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath); +ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet); +int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet); extern const char gBuildHash[]; int main(int argc, char* argv[]) { - // Syntax: ZAPD.out [mode (btex/bovl/e)] (Arbritrary Number of Arguments) + int returnCode = 0; if (argc < 2) { @@ -55,112 +83,12 @@ int main(int argc, char* argv[]) } } - // Parse other "commands" - for (int32_t i = 2; i < argc; i++) - { - std::string arg = argv[i]; - - if (arg == "-o" || arg == "--outputpath") // Set output path - { - Globals::Instance->outputPath = argv[++i]; - - if (Globals::Instance->sourceOutputPath == "") - Globals::Instance->sourceOutputPath = Globals::Instance->outputPath; - } - else if (arg == "-i" || arg == "--inputpath") // Set input path - { - Globals::Instance->inputPath = argv[++i]; - } - else if (arg == "-b" || arg == "--baserompath") // Set baserom path - { - Globals::Instance->baseRomPath = argv[++i]; - } - else if (arg == "-osf") // Set source output path - { - Globals::Instance->sourceOutputPath = argv[++i]; - } - else if (arg == "-gsf") // Generate source file during extraction - { - Globals::Instance->genSourceFile = std::string_view(argv[++i]) == "1"; - } - else if (arg == "-tm") // Test Mode (enables certain experimental features) - { - Globals::Instance->testMode = std::string_view(argv[++i]) == "1"; - } - else if (arg == "-crc" || - arg == "--output-crc") // Outputs a CRC file for each extracted texture. - { - Globals::Instance->testMode = std::string_view(argv[++i]) == "1"; - } - else if (arg == "-ulzdl") // Use Legacy ZDisplay List - { - Globals::Instance->useLegacyZDList = std::string_view(argv[++i]) == "1"; - } - else if (arg == "-profile") // Enable profiling - { - Globals::Instance->profile = std::string_view(argv[++i]) == "1"; - } - else if (arg == - "-uer") // Split resources into their individual components (enabled by default) - // TODO: We may wish to make this a part of the config file... - { - Globals::Instance->useExternalResources = std::string_view(argv[++i]) == "1"; - } - else if (arg == "-tt") // Set texture type - { - Globals::Instance->texType = ZTexture::GetTextureTypeFromString(argv[++i]); - } - else if (arg == "-rconf") // Read Config File - { - Globals::Instance->cfg.ReadConfigFile(argv[++i]); - } - else if (arg == "-eh") // Enable Error Handler - { - CrashHandler_Init(); - } - else if (arg == "-v") // Verbose - { - Globals::Instance->verbosity = static_cast(strtol(argv[++i], NULL, 16)); - } - else if (arg == "-vu" || arg == "--verbose-unaccounted") // Verbose unaccounted - { - Globals::Instance->verboseUnaccounted = true; - } - else if (arg == "-se" || arg == "--set-exporter") // Set Current Exporter - { - Globals::Instance->currentExporter = argv[++i]; - } - else if (arg == "--gcc-compat") // GCC compatibility - { - Globals::Instance->gccCompat = true; - } - else if (arg == "-s" || arg == "--static") - { - Globals::Instance->forceStatic = true; - } - else if (arg == "-us" || arg == "--unaccounted-static") - { - Globals::Instance->forceUnaccountedStatic = true; - } - } + ParseArgs(argc, argv); // Parse File Mode ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); std::string buildMode = argv[1]; - ZFileMode fileMode = ZFileMode::Invalid; - - if (buildMode == "btex") - fileMode = ZFileMode::BuildTexture; - else if (buildMode == "bren") - fileMode = ZFileMode::BuildBackground; - else if (buildMode == "bsf") - fileMode = ZFileMode::BuildSourceFile; - else if (buildMode == "bblb") - fileMode = ZFileMode::BuildBlob; - else if (buildMode == "e") - fileMode = ZFileMode::Extract; - else if (exporterSet != nullptr && exporterSet->parseFileModeFunc != nullptr) - exporterSet->parseFileModeFunc(buildMode, fileMode); + ZFileMode fileMode = ParseFileMode(buildMode, exporterSet); if (fileMode == ZFileMode::Invalid) { @@ -170,7 +98,6 @@ int main(int argc, char* argv[]) // We've parsed through our commands once. If an exporter exists, it's been set by now. // Now we'll parse through them again but pass them on to our exporter if one is available. - if (exporterSet != nullptr && exporterSet->parseArgsFunc != nullptr) { for (int32_t i = 2; i < argc; i++) @@ -181,62 +108,20 @@ int main(int argc, char* argv[]) printf("ZAPD: Zelda Asset Processor For Decomp: %s\n", gBuildHash); if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - { WarningHandler::PrintWarningsDebugInfo(); - } - // TODO: switch if (fileMode == ZFileMode::Extract || fileMode == ZFileMode::BuildSourceFile) - { - bool procFileModeSuccess = false; - - if (exporterSet != nullptr && exporterSet->processFileModeFunc != nullptr) - procFileModeSuccess = exporterSet->processFileModeFunc(fileMode); - - if (!procFileModeSuccess) - { - bool parseSuccessful; - - for (auto& extFile : Globals::Instance->cfg.externalFiles) - { - fs::path externalXmlFilePath = - Globals::Instance->cfg.externalXmlFolder / extFile.xmlPath; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - { - printf("Parsing external file from config: '%s'\n", - externalXmlFilePath.c_str()); - } - - parseSuccessful = Parse(externalXmlFilePath, Globals::Instance->baseRomPath, - extFile.outPath, ZFileMode::ExternalFile); - - if (!parseSuccessful) - return 1; - } - - parseSuccessful = Parse(Globals::Instance->inputPath, Globals::Instance->baseRomPath, - Globals::Instance->outputPath, fileMode); - if (!parseSuccessful) - return 1; - } - } + returnCode = HandleExtract(fileMode, exporterSet); else if (fileMode == ZFileMode::BuildTexture) - { - TextureType texType = Globals::Instance->texType; - BuildAssetTexture(Globals::Instance->inputPath, texType, Globals::Instance->outputPath); - } + BuildAssetTexture(Globals::Instance->inputPath, Globals::Instance->texType, + Globals::Instance->outputPath); else if (fileMode == ZFileMode::BuildBackground) - { BuildAssetBackground(Globals::Instance->inputPath, Globals::Instance->outputPath); - } else if (fileMode == ZFileMode::BuildBlob) - { BuildAssetBlob(Globals::Instance->inputPath, Globals::Instance->outputPath); - } delete g; - return 0; + return returnCode; } bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath, @@ -339,6 +224,209 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path return true; } +void ParseArgs(int& argc, char* argv[]) +{ + static const std::unordered_map ArgFuncDictionary = { + {"-o", &Arg_SetOutputPath}, + {"--outputpath", &Arg_SetOutputPath}, + {"-i", &Arg_SetInputPath}, + {"--inputpath", &Arg_SetInputPath}, + {"-b", &Arg_SetBaseromPath}, + {"--baserompath", &Arg_SetBaseromPath}, + {"-osf", &Arg_SetSourceOutputPath}, + {"-gsf", &Arg_GenerateSourceFile}, + {"-tm", &Arg_TestMode}, + {"-ulzdl", &Arg_LegacyDList}, + {"-profile", &Arg_EnableProfiling}, + {"-uer", &Arg_UseExternalResources}, + {"-tt", &Arg_SetTextureType}, + {"-rconf", &Arg_ReadConfigFile}, + {"-eh", &Arg_EnableErrorHandler}, + {"-v", &Arg_SetVerbosity}, + {"-vu", &Arg_VerboseUnaccounted}, + {"--verbose-unaccounted", &Arg_VerboseUnaccounted}, + {"-se", &Arg_SetExporter}, + {"--set-exporter", &Arg_SetExporter}, + {"--gcc-compat", &Arg_EnableGCCCompat}, + {"-s", &Arg_ForceStatic}, + {"--static", &Arg_ForceStatic}, + {"-us", &Arg_ForceUnaccountedStatic}, + {"--unaccounted-static", &Arg_ForceUnaccountedStatic}, + }; + + for (int32_t i = 2; i < argc; i++) + { + std::string arg = argv[i]; + + // Ignore warning args as they have already been parsed + if (arg.length() > 2 && arg[0] == '-' && arg[1] == 'W' && arg[2] != '\0') + { + continue; + } + + auto it = ArgFuncDictionary.find(arg); + if (it == ArgFuncDictionary.end()) + { + fprintf(stderr, "Unsupported argument: %s\n", arg.c_str()); + continue; + } + + std::invoke(it->second, i, argv); + } +} + +ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet) +{ + ZFileMode fileMode = ZFileMode::Invalid; + + if (buildMode == "btex") + fileMode = ZFileMode::BuildTexture; + else if (buildMode == "bren") + fileMode = ZFileMode::BuildBackground; + else if (buildMode == "bsf") + fileMode = ZFileMode::BuildSourceFile; + else if (buildMode == "bblb") + fileMode = ZFileMode::BuildBlob; + else if (buildMode == "e") + fileMode = ZFileMode::Extract; + else if (exporterSet != nullptr && exporterSet->parseFileModeFunc != nullptr) + exporterSet->parseFileModeFunc(buildMode, fileMode); + + return fileMode; +} + +void Arg_SetOutputPath(int& i, [[maybe_unused]] char* argv[]) +{ + Globals::Instance->outputPath = argv[++i]; + + if (Globals::Instance->sourceOutputPath == "") + Globals::Instance->sourceOutputPath = Globals::Instance->outputPath; +} + +void Arg_SetInputPath(int& i, char* argv[]) +{ + Globals::Instance->inputPath = argv[++i]; +} + +void Arg_SetBaseromPath(int& i, char* argv[]) +{ + Globals::Instance->baseRomPath = argv[++i]; +} + +void Arg_SetSourceOutputPath(int& i, char* argv[]) +{ + Globals::Instance->sourceOutputPath = argv[++i]; +} + +void Arg_GenerateSourceFile(int& i, char* argv[]) +{ + // Generate source file during extraction + Globals::Instance->genSourceFile = std::string_view(argv[++i]) == "1"; +} + +void Arg_TestMode(int& i, char* argv[]) +{ + // Test Mode (enables certain experimental features) + Globals::Instance->testMode = std::string_view(argv[++i]) == "1"; +} + +void Arg_LegacyDList(int& i, char* argv[]) +{ + Globals::Instance->useLegacyZDList = std::string_view(argv[++i]) == "1"; +} + +void Arg_EnableProfiling(int& i, char* argv[]) +{ + Globals::Instance->profile = std::string_view(argv[++i]) == "1"; +} + +void Arg_UseExternalResources(int& i, char* argv[]) +{ + // Split resources into their individual components(enabled by default) + // TODO: We may wish to make this a part of the config file... + Globals::Instance->useExternalResources = std::string_view(argv[++i]) == "1"; +} + +void Arg_SetTextureType(int& i, char* argv[]) +{ + Globals::Instance->texType = ZTexture::GetTextureTypeFromString(argv[++i]); +} + +void Arg_ReadConfigFile(int& i, char* argv[]) +{ + Globals::Instance->cfg.ReadConfigFile(argv[++i]); +} + +void Arg_EnableErrorHandler([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + CrashHandler_Init(); +} + +void Arg_SetVerbosity(int& i, char* argv[]) +{ + Globals::Instance->verbosity = static_cast(strtol(argv[++i], NULL, 16)); +} + +void Arg_VerboseUnaccounted([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + Globals::Instance->verboseUnaccounted = true; +} + +void Arg_SetExporter(int& i, char* argv[]) +{ + Globals::Instance->currentExporter = argv[++i]; +} + +void Arg_EnableGCCCompat([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + Globals::Instance->gccCompat = true; +} + +void Arg_ForceStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + Globals::Instance->forceStatic = true; +} + +void Arg_ForceUnaccountedStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + Globals::Instance->forceUnaccountedStatic = true; +} + +int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet) +{ + bool procFileModeSuccess = false; + + if (exporterSet != nullptr && exporterSet->processFileModeFunc != nullptr) + procFileModeSuccess = exporterSet->processFileModeFunc(fileMode); + + if (!procFileModeSuccess) + { + bool parseSuccessful; + + for (auto& extFile : Globals::Instance->cfg.externalFiles) + { + fs::path externalXmlFilePath = + Globals::Instance->cfg.externalXmlFolder / extFile.xmlPath; + + if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) + printf("Parsing external file from config: '%s'\n", externalXmlFilePath.c_str()); + + parseSuccessful = Parse(externalXmlFilePath, Globals::Instance->baseRomPath, + extFile.outPath, ZFileMode::ExternalFile); + + if (!parseSuccessful) + return 1; + } + + parseSuccessful = Parse(Globals::Instance->inputPath, Globals::Instance->baseRomPath, + Globals::Instance->outputPath, fileMode); + if (!parseSuccessful) + return 1; + } + + return 0; +} + void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath) { std::string name = outPath.stem().string(); diff --git a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp index df8bd6d98..4c12062b2 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp +++ b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp @@ -165,7 +165,7 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix) res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr); } else - decl->text = entryStr; + decl->declBody = entryStr; } if (unk_C != 0 && GETSEGNUM(unk_C) == parent->segment) @@ -195,7 +195,7 @@ void Struct_800A598C::DeclareReferences(const std::string& prefix) res.GetSourceTypeName(), unk_C_Str, arrayItemCnt, entryStr); } else - decl->text = entryStr; + decl->declBody = entryStr; } } @@ -296,7 +296,7 @@ void Struct_800A5E28::DeclareReferences(const std::string& prefix) res.GetSourceTypeName(), unk_4_Str, arrayItemCnt, entryStr); } else - decl->text = entryStr; + decl->declBody = entryStr; } if (unk_8 != SEGMENTED_NULL && GETSEGNUM(unk_8) == parent->segment) diff --git a/tools/ZAPD/ZAPD/OutputFormatter.h b/tools/ZAPD/ZAPD/OutputFormatter.h index 28955b1cd..ec56b654d 100644 --- a/tools/ZAPD/ZAPD/OutputFormatter.h +++ b/tools/ZAPD/ZAPD/OutputFormatter.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include diff --git a/tools/ZAPD/ZAPD/WarningHandler.cpp b/tools/ZAPD/ZAPD/WarningHandler.cpp index 163b028b5..f416a5b80 100644 --- a/tools/ZAPD/ZAPD/WarningHandler.cpp +++ b/tools/ZAPD/ZAPD/WarningHandler.cpp @@ -84,26 +84,27 @@ typedef struct */ // clang-format off static const std::unordered_map warningStringToInitMap = { - {"deprecated", {WarningType::Deprecated, + {"deprecated", {WarningType::Deprecated, #ifdef DEPRECATION_ON WarningLevel::Warn, #else WarningLevel::Off, #endif "Deprecated features"}}, - {"unaccounted", {WarningType::Unaccounted, WarningLevel::Off, "Large blocks of unaccounted"}}, - {"missing-offsets", {WarningType::MissingOffsets, WarningLevel::Warn, "Offset attribute missing in XML tag"}}, - {"intersection", {WarningType::Intersection, WarningLevel::Warn, "Two assets intersect"}}, - {"missing-attribute", {WarningType::MissingAttribute, WarningLevel::Warn, "Required attribute missing in XML tag"}}, - {"invalid-attribute-value", {WarningType::InvalidAttributeValue, WarningLevel::Err, "Attribute declared in XML is wrong"}}, - {"unknown-attribute", {WarningType::UnknownAttribute, WarningLevel::Warn, "Unknown attribute in XML entry tag"}}, - {"invalid-xml", {WarningType::InvalidXML, WarningLevel::Err, "XML has syntax errors"}}, - {"invalid-jpeg", {WarningType::InvalidJPEG, WarningLevel::Err, "JPEG file does not conform to the game's format requirements"}}, - {"invalid-png", {WarningType::InvalidPNG, WarningLevel::Err, "Issues arising when processing PNG data"}}, - {"invalid-extracted-data", {WarningType::InvalidExtractedData, WarningLevel::Err, "Extracted data does not have correct form"}}, - {"missing-segment", {WarningType::MissingSegment, WarningLevel::Warn, "Segment not given in File tag in XML"}}, - {"hardcoded-pointer", {WarningType::HardcodedPointer, WarningLevel::Warn, "ZAPD lacks the info to make a symbol, so must output a hardcoded pointer"}}, - {"not-implemented", {WarningType::NotImplemented, WarningLevel::Warn, "ZAPD does not currently support this feature"}}, + {"unaccounted", {WarningType::Unaccounted, WarningLevel::Off, "Large blocks of unaccounted"}}, + {"missing-offsets", {WarningType::MissingOffsets, WarningLevel::Warn, "Offset attribute missing in XML tag"}}, + {"intersection", {WarningType::Intersection, WarningLevel::Warn, "Two assets intersect"}}, + {"missing-attribute", {WarningType::MissingAttribute, WarningLevel::Warn, "Required attribute missing in XML tag"}}, + {"invalid-attribute-value", {WarningType::InvalidAttributeValue, WarningLevel::Err, "Attribute declared in XML is wrong"}}, + {"unknown-attribute", {WarningType::UnknownAttribute, WarningLevel::Warn, "Unknown attribute in XML entry tag"}}, + {"invalid-xml", {WarningType::InvalidXML, WarningLevel::Err, "XML has syntax errors"}}, + {"invalid-jpeg", {WarningType::InvalidJPEG, WarningLevel::Err, "JPEG file does not conform to the game's format requirements"}}, + {"invalid-png", {WarningType::InvalidPNG, WarningLevel::Err, "Issues arising when processing PNG data"}}, + {"invalid-extracted-data", {WarningType::InvalidExtractedData, WarningLevel::Err, "Extracted data does not have correct form"}}, + {"missing-segment", {WarningType::MissingSegment, WarningLevel::Warn, "Segment not given in File tag in XML"}}, + {"hardcoded-generic-pointer", {WarningType::HardcodedGenericPointer, WarningLevel::Off, "A generic segmented pointer must be produced"}}, + {"hardcoded-pointer", {WarningType::HardcodedPointer, WarningLevel::Warn, "ZAPD lacks the info to make a symbol, so must output a hardcoded pointer"}}, + {"not-implemented", {WarningType::NotImplemented, WarningLevel::Warn, "ZAPD does not currently support this feature"}}, }; /** @@ -229,7 +230,10 @@ void WarningHandler::ExtractedFilePreamble(const ZFile *parent, const ZResource* if (res != nullptr) { fprintf(stderr, "resource '%s' at ", res->GetName().c_str()); } - fprintf(stderr, "offset 0x%06X: \n\t", offset); + if (offset != static_cast(-1)) { + fprintf(stderr, "offset 0x%06X:", offset); + } + fprintf(stderr, "\n\t"); } /** diff --git a/tools/ZAPD/ZAPD/WarningHandler.h b/tools/ZAPD/ZAPD/WarningHandler.h index bb0360a81..f99330042 100644 --- a/tools/ZAPD/ZAPD/WarningHandler.h +++ b/tools/ZAPD/ZAPD/WarningHandler.h @@ -81,6 +81,7 @@ enum class WarningType InvalidExtractedData, MissingSegment, HardcodedPointer, + HardcodedGenericPointer, NotImplemented, Max, }; diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj b/tools/ZAPD/ZAPD/ZAPD.vcxproj index 505e41100..77d0bd16e 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj @@ -249,6 +249,7 @@ mkdir build\ZAPD + @@ -272,6 +273,7 @@ mkdir build\ZAPD + @@ -339,6 +341,7 @@ mkdir build\ZAPD + diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters index ce89882fe..eac471961 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -291,6 +291,12 @@ Source Files\Z64 + + Source Files\Z64 + + + Source Files\Z64 + @@ -554,6 +560,15 @@ Header Files\Z64 + + Header Files + + + Header Files + + + Header Files + diff --git a/tools/ZAPD/ZAPD/ZAnimation.cpp b/tools/ZAPD/ZAPD/ZAnimation.cpp index 74b520b50..0d7234407 100644 --- a/tools/ZAPD/ZAPD/ZAnimation.cpp +++ b/tools/ZAPD/ZAPD/ZAnimation.cpp @@ -300,7 +300,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix) } else { - decl->text = entryStr; + decl->declBody = entryStr; } } @@ -331,7 +331,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix) } else { - decl->text = entryStr; + decl->declBody = entryStr; } } @@ -359,7 +359,7 @@ void ZCurveAnimation::DeclareReferences(const std::string& prefix) } else { - decl->text = entryStr; + decl->declBody = entryStr; } } } diff --git a/tools/ZAPD/ZAPD/ZArray.cpp b/tools/ZAPD/ZAPD/ZArray.cpp index 0a9797ba0..62720bc61 100644 --- a/tools/ZAPD/ZAPD/ZArray.cpp +++ b/tools/ZAPD/ZAPD/ZArray.cpp @@ -56,7 +56,7 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader) } res->parent = parent; res->SetInnerNode(true); - res->ExtractFromXML(child, childIndex); + res->ExtractWithXML(child, childIndex); childIndex += res->GetRawDataSize(); resList.push_back(res); @@ -75,11 +75,11 @@ Declaration* ZArray::DeclareVar(const std::string& prefix, const std::string& bo if (res->IsExternalResource()) { auto filepath = Globals::Instance->outputPath / name; - std::string includePath = StringHelper::Sprintf("%s.%s.inc", filepath.c_str(), + std::string includePath = StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), res->GetExternalExtension().c_str()); decl = parent->AddDeclarationIncludeArray(rawDataIndex, includePath, GetRawDataSize(), GetSourceTypeName(), name, arrayCnt); - decl->text = bodyStr; + decl->declBody = bodyStr; decl->isExternal = true; } else @@ -109,6 +109,7 @@ std::string ZArray::GetBodySourceCode() const case ZResourceType::Vertex: case ZResourceType::CollisionPoly: case ZResourceType::SurfaceType: + case ZResourceType::Waterbox: output += resList.at(i)->GetBodySourceCode(); break; diff --git a/tools/ZAPD/ZAPD/ZBackground.cpp b/tools/ZAPD/ZAPD/ZBackground.cpp index 0ed1eb747..fc725637e 100644 --- a/tools/ZAPD/ZAPD/ZBackground.cpp +++ b/tools/ZAPD/ZAPD/ZBackground.cpp @@ -132,8 +132,13 @@ Declaration* ZBackground::DeclareVar(const std::string& prefix, Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), GetSourceTypeName(), auxName, 0); - decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4"; - decl->forceArrayCnt = true; + + if (Globals::Instance->cfg.useScreenWidthHeightConstants) + { + decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4"; + decl->forceArrayCnt = true; + } + decl->staticConf = staticConf; return decl; } diff --git a/tools/ZAPD/ZAPD/ZCollision.cpp b/tools/ZAPD/ZAPD/ZCollision.cpp index 5bd3d93a6..8c193167b 100644 --- a/tools/ZAPD/ZAPD/ZCollision.cpp +++ b/tools/ZAPD/ZAPD/ZCollision.cpp @@ -1,4 +1,5 @@ #include "ZCollision.h" +#include "ZWaterbox.h" #include #include @@ -50,6 +51,7 @@ void ZCollisionHeader::ParseRawData() vertices.reserve(numVerts); polygons.reserve(numPolygons); + waterBoxes.reserve(numWaterBoxes); offset_t currentPtr = vtxSegmentOffset; @@ -104,31 +106,48 @@ void ZCollisionHeader::ParseRawData() // - WaterBoxes // - CollisionHeader offset_t upperCameraBoundary = polyTypeDefSegmentOffset; - if (upperCameraBoundary == 0) + if (upperCameraBoundary == SEGMENTED_NULL) { upperCameraBoundary = polySegmentOffset; } - if (upperCameraBoundary == 0) + if (upperCameraBoundary == SEGMENTED_NULL) { upperCameraBoundary = vtxSegmentOffset; } - if (upperCameraBoundary == 0) + if (upperCameraBoundary == SEGMENTED_NULL) { upperCameraBoundary = waterBoxSegmentOffset; } - if (upperCameraBoundary == 0) + if (upperCameraBoundary == SEGMENTED_NULL) { upperCameraBoundary = rawDataIndex; } + // Sharp Ocarina places the CamDataEntries above the list so we need to calculate the number + // of cameras differently. + if (upperCameraBoundary < camDataSegmentOffset) + { + offset_t offset = camDataSegmentOffset; + while (rawData[offset] == 0x00 && rawData[offset + 0x4] == 0x02) + { + offset += 0x08; + } + upperCameraBoundary = offset; + } + camData = new CameraDataList(parent, name, rawData, camDataSegmentOffset, upperCameraBoundary); } - for (uint16_t i = 0; i < numWaterBoxes; i++) - waterBoxes.push_back(WaterBoxHeader( - rawData, - waterBoxSegmentOffset + (i * (Globals::Instance->game == ZGame::OOT_SW97 ? 12 : 16)))); + for (int32_t i = 0; i < numWaterBoxes; i++) + { + ZWaterbox waterbox(parent); + + waterbox.SetRawDataIndex(waterBoxSegmentOffset + + (i * (Globals::Instance->game == ZGame::OOT_SW97 ? 12 : 16))); + waterbox.ParseRawData(); + waterBoxes.emplace_back(waterbox); + } } void ZCollisionHeader::DeclareReferences(const std::string& prefix) @@ -149,9 +168,11 @@ void ZCollisionHeader::DeclareReferences(const std::string& prefix) declaration += "\n"; } - parent->AddDeclarationArray( - waterBoxSegmentOffset, DeclarationAlignment::Align4, 16 * waterBoxes.size(), "WaterBox", - StringHelper::Sprintf("%sWaterBoxes", auxName.c_str()), waterBoxes.size(), declaration); + parent->AddDeclarationArray(waterBoxSegmentOffset, DeclarationAlignment::Align4, + waterBoxes[0].GetRawDataSize() * waterBoxes.size(), + waterBoxes[0].GetSourceTypeName().c_str(), + StringHelper::Sprintf("%sWaterBoxes", auxName.c_str()), + waterBoxes.size(), declaration); } if (polygons.size() > 0) @@ -219,11 +240,21 @@ std::string ZCollisionHeader::GetBodySourceCode() const std::string vtxName; Globals::Instance->GetSegmentedPtrName(vtxAddress, parent, "Vec3s", vtxName); - declaration += StringHelper::Sprintf("\t%i, %s,\n", numVerts, vtxName.c_str()); + + if (numVerts > 0) + declaration += + StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", vtxName.c_str(), vtxName.c_str()); + else + declaration += StringHelper::Sprintf("\t%i, %s,\n", numVerts, vtxName.c_str()); std::string polyName; Globals::Instance->GetSegmentedPtrName(polyAddress, parent, "CollisionPoly", polyName); - declaration += StringHelper::Sprintf("\t%i, %s,\n", numPolygons, polyName.c_str()); + + if (numPolygons > 0) + declaration += + StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", polyName.c_str(), polyName.c_str()); + else + declaration += StringHelper::Sprintf("\t%i, %s,\n", numPolygons, polyName.c_str()); std::string surfaceName; Globals::Instance->GetSegmentedPtrName(polyTypeDefAddress, parent, "SurfaceType", surfaceName); @@ -235,7 +266,12 @@ std::string ZCollisionHeader::GetBodySourceCode() const std::string waterBoxName; Globals::Instance->GetSegmentedPtrName(waterBoxAddress, parent, "WaterBox", waterBoxName); - declaration += StringHelper::Sprintf("\t%i, %s\n", numWaterBoxes, waterBoxName.c_str()); + + if (numWaterBoxes > 0) + declaration += StringHelper::Sprintf("\tARRAY_COUNT(%s), %s\n", waterBoxName.c_str(), + waterBoxName.c_str()); + else + declaration += StringHelper::Sprintf("\t%i, %s\n", numWaterBoxes, waterBoxName.c_str()); return declaration; } @@ -260,26 +296,6 @@ size_t ZCollisionHeader::GetRawDataSize() const return 44; } -WaterBoxHeader::WaterBoxHeader(const std::vector& rawData, uint32_t rawDataIndex) -{ - xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - - if (Globals::Instance->game == ZGame::OOT_SW97) - properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - else - properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12); -} - -std::string WaterBoxHeader::GetBodySourceCode() const -{ - return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength, - zLength, properties); -} - CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, const std::vector& rawData, offset_t rawDataIndex, offset_t upperCameraBoundary) @@ -291,46 +307,63 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, assert(numElements < 10000); offset_t cameraPosDataSeg = rawDataIndex; + uint32_t numDataTotal; + uint32_t cameraPosDataSegEnd = rawDataIndex; + bool isSharpOcarina = false; + for (size_t i = 0; i < numElements; i++) { - CameraDataEntry* entry = new CameraDataEntry(); + CameraDataEntry entry; - entry->cameraSType = + entry.cameraSType = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 0); - entry->numData = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 2); - entry->cameraPosDataSeg = + entry.numData = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 2); + entry.cameraPosDataSeg = BitConverter::ToInt32BE(rawData, rawDataIndex + (entries.size() * 8) + 4); - if (entry->cameraPosDataSeg != 0 && GETSEGNUM(entry->cameraPosDataSeg) != SEGMENT_SCENE) + if (entry.cameraPosDataSeg != 0 && GETSEGNUM(entry.cameraPosDataSeg) != SEGMENT_SCENE) { cameraPosDataSeg = rawDataIndex + (entries.size() * 8); break; } - if (entry->cameraPosDataSeg != 0 && cameraPosDataSeg > (entry->cameraPosDataSeg & 0xFFFFFF)) - cameraPosDataSeg = (entry->cameraPosDataSeg & 0xFFFFFF); + if (rawDataIndex > GETSEGOFFSET(entry.cameraPosDataSeg)) + { + if (entry.cameraPosDataSeg != 0 && + cameraPosDataSeg > GETSEGOFFSET(entry.cameraPosDataSeg)) + cameraPosDataSeg = GETSEGOFFSET(entry.cameraPosDataSeg); + } + else + { + // Sharp Ocarina will place the cam data after the list as opposed to the original maps + // which have it before. + isSharpOcarina = true; + cameraPosDataSeg = rawDataIndex + (numElements * 0x8); + if (cameraPosDataSegEnd < GETSEGOFFSET(entry.cameraPosDataSeg)) + cameraPosDataSegEnd = GETSEGOFFSET(entry.cameraPosDataSeg); + } - entries.push_back(entry); + entries.emplace_back(entry); } // Setting cameraPosDataAddr to rawDataIndex give a pos list length of 0 - uint32_t cameraPosDataOffset = cameraPosDataSeg & 0xFFFFFF; + uint32_t cameraPosDataOffset = GETSEGOFFSET(cameraPosDataSeg); for (size_t i = 0; i < entries.size(); i++) { char camSegLine[2048]; - if (entries[i]->cameraPosDataSeg != 0) + if (entries[i].cameraPosDataSeg != 0) { - int32_t index = - ((entries[i]->cameraPosDataSeg & 0x00FFFFFF) - cameraPosDataOffset) / 0x6; - sprintf(camSegLine, "&%sCamPosData[%i]", prefix.c_str(), index); + uint32_t index = + (GETSEGOFFSET(entries[i].cameraPosDataSeg) - cameraPosDataOffset) / 0x6; + snprintf(camSegLine, 2048, "&%sCamPosData[%i]", prefix.c_str(), index); } else - sprintf(camSegLine, "NULL"); + snprintf(camSegLine, 2048, "NULL"); declaration += - StringHelper::Sprintf(" { 0x%04X, %i, %s },", entries[i]->cameraSType, - entries[i]->numData, camSegLine, rawDataIndex + (i * 8)); + StringHelper::Sprintf(" { 0x%04X, %i, %s },", entries[i].cameraSType, + entries[i].numData, camSegLine, rawDataIndex + (i * 8)); if (i < entries.size() - 1) declaration += "\n"; @@ -341,23 +374,26 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, StringHelper::Sprintf("%sCamDataList", prefix.c_str(), rawDataIndex), entries.size(), declaration); - uint32_t numDataTotal = (rawDataIndex - cameraPosDataOffset) / 0x6; + if (!isSharpOcarina) + numDataTotal = (rawDataIndex - cameraPosDataOffset) / 0x6; + else + numDataTotal = ((cameraPosDataSegEnd - cameraPosDataSeg) + 18) / 0x6; if (numDataTotal > 0) { declaration.clear(); + cameraPositionData.reserve(numDataTotal); for (uint32_t i = 0; i < numDataTotal; i++) { - CameraPositionData* data = - new CameraPositionData(rawData, cameraPosDataOffset + (i * 6)); - cameraPositionData.push_back(data); + CameraPositionData data = CameraPositionData(rawData, cameraPosDataOffset + (i * 6)); - declaration += StringHelper::Sprintf("\t{ %6i, %6i, %6i },", data->x, data->y, data->z); + declaration += StringHelper::Sprintf("\t{ %6i, %6i, %6i },", data.x, data.y, data.z); + cameraPositionData.emplace_back(data); if (i + 1 < numDataTotal) declaration += "\n"; } - int32_t cameraPosDataIndex = GETSEGOFFSET(cameraPosDataSeg); + uint32_t cameraPosDataIndex = GETSEGOFFSET(cameraPosDataSeg); uint32_t entrySize = numDataTotal * 0x6; parent->AddDeclarationArray(cameraPosDataIndex, DeclarationAlignment::Align4, entrySize, "Vec3s", StringHelper::Sprintf("%sCamPosData", prefix.c_str()), @@ -367,11 +403,6 @@ CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, CameraDataList::~CameraDataList() { - for (auto entry : entries) - delete entry; - - for (auto camPosData : cameraPositionData) - delete camPosData; } CameraPositionData::CameraPositionData(const std::vector& rawData, uint32_t rawDataIndex) diff --git a/tools/ZAPD/ZAPD/ZCollision.h b/tools/ZAPD/ZAPD/ZCollision.h index 35c632144..8c73d2eaa 100644 --- a/tools/ZAPD/ZAPD/ZCollision.h +++ b/tools/ZAPD/ZAPD/ZCollision.h @@ -6,23 +6,7 @@ #include "ZRoom/ZRoom.h" #include "ZSurfaceType.h" #include "ZVector.h" - -class WaterBoxHeader -{ -public: - WaterBoxHeader(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - -protected: - int16_t xMin; - int16_t ySurface; - int16_t zMin; - int16_t xLength; - int16_t zLength; - int16_t pad; - int32_t properties; -}; +#include "ZWaterbox.h" class CameraPositionData { @@ -37,14 +21,14 @@ class CameraDataEntry public: int16_t cameraSType; int16_t numData; - int32_t cameraPosDataSeg; + offset_t cameraPosDataSeg; }; class CameraDataList { public: - std::vector entries; - std::vector cameraPositionData; + std::vector entries; + std::vector cameraPositionData; CameraDataList(ZFile* parent, const std::string& prefix, const std::vector& rawData, offset_t rawDataIndex, offset_t upperCameraBoundary); @@ -72,7 +56,7 @@ public: std::vector vertices; std::vector polygons; std::vector polygonTypes; - std::vector waterBoxes; + std::vector waterBoxes; CameraDataList* camData = nullptr; ZCollisionHeader(ZFile* nParent); diff --git a/tools/ZAPD/ZAPD/ZCutscene.cpp b/tools/ZAPD/ZAPD/ZCutscene.cpp index a3bfe0e07..c2e6c2b8f 100644 --- a/tools/ZAPD/ZAPD/ZCutscene.cpp +++ b/tools/ZAPD/ZAPD/ZCutscene.cpp @@ -231,6 +231,7 @@ CutsceneCommand* ZCutscene::GetCommandOoT(uint32_t id, offset_t currentPtr) cons case 142: case 62: // CutsceneCommands::SetActorAction9 case 143: // CutsceneCommands::SetActorAction10 + case 74: return new CutsceneCommand_ActorAction(rawData, currentPtr); case 0x0B: @@ -249,7 +250,6 @@ CutsceneCommand* ZCutscene::GetCommandOoT(uint32_t id, offset_t currentPtr) cons case 0x16: case 0x70: case 0x71: - case 0x4A: return new CutsceneCommand_GenericCmd(rawData, currentPtr, cmdID); } diff --git a/tools/ZAPD/ZAPD/ZDisplayList.cpp b/tools/ZAPD/ZAPD/ZDisplayList.cpp index 3b50c1fd3..98c4d0e4a 100644 --- a/tools/ZAPD/ZAPD/ZDisplayList.cpp +++ b/tools/ZAPD/ZAPD/ZDisplayList.cpp @@ -40,7 +40,7 @@ ZDisplayList::~ZDisplayList() } // EXTRACT MODE -void ZDisplayList::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) +void ZDisplayList::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) { rawDataIndex = nRawDataIndex; ParseXML(reader); @@ -708,7 +708,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l if (!Globals::Instance->HasSegment(segNum)) sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); else if (dListDecl != nullptr) - sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str()); + sprintf(line, "gsSPBranchList(%s),", dListDecl->declName.c_str()); else sprintf(line, "gsSPBranchList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), GETSEGOFFSET(data)); @@ -718,7 +718,7 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l if (!Globals::Instance->HasSegment(segNum)) sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); else if (dListDecl != nullptr) - sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str()); + sprintf(line, "gsSPDisplayList(%s),", dListDecl->declName.c_str()); else sprintf(line, "gsSPDisplayList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), GETSEGOFFSET(data)); @@ -958,7 +958,7 @@ void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, ch } if (texDecl != nullptr) - sprintf(texStr, "%s", texDecl->varName.c_str()); + sprintf(texStr, "%s", texDecl->declName.c_str()); else if (data != 0 && Globals::Instance->HasSegment(segmentNumber)) sprintf(texStr, "%sTex_%06X", prefix.c_str(), texAddress); else @@ -1642,7 +1642,14 @@ static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count) vtxList.push_back(vtx); currentPtr += 16; } - self->vertices[vtxOffset] = vtxList; + + bool keyAlreadyOccupied = self->vertices.find(vtxOffset) != self->vertices.end(); + + // In some cases a vtxList already exists at vtxOffset. Only override the existing list + // if the new one is bigger. + if (!keyAlreadyOccupied || + (keyAlreadyOccupied && vtxList.size() > self->vertices[vtxOffset].size())) + self->vertices[vtxOffset] = vtxList; } } @@ -1708,17 +1715,26 @@ static int32_t GfxdCallback_DisplayList(uint32_t seg) uint32_t dListSegNum = GETSEGNUM(seg); std::string dListName = ""; - bool addressFound = Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Gfx", dListName); + bool addressFound = + Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Gfx", dListName, false); - if (!addressFound && self->parent->segment == dListSegNum) + if (!addressFound) { - ZDisplayList* newDList = new ZDisplayList(self->parent); - newDList->ExtractFromBinary( - dListOffset, - self->GetDListLength(self->parent->GetRawData(), dListOffset, self->dListType)); - newDList->SetName(newDList->GetDefaultName(self->parent->GetName())); - self->otherDLists.push_back(newDList); - dListName = newDList->GetName(); + if (self->parent->segment == dListSegNum) + { + ZDisplayList* newDList = new ZDisplayList(self->parent); + newDList->ExtractFromBinary( + dListOffset, + self->GetDListLength(self->parent->GetRawData(), dListOffset, self->dListType)); + newDList->SetName(newDList->GetDefaultName(self->parent->GetName())); + self->otherDLists.push_back(newDList); + dListName = newDList->GetName(); + } + else + { + Globals::Instance->WarnHardcodedPointer(seg, self->parent, self, + self->GetRawDataIndex()); + } } gfxd_puts(dListName.c_str()); @@ -1731,21 +1747,31 @@ static int32_t GfxdCallback_Matrix(uint32_t seg) std::string mtxName; ZDisplayList* self = static_cast(gfxd_udata_get()); - bool addressFound = Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Mtx", mtxName); - if (!addressFound && GETSEGNUM(seg) == self->parent->segment) - { - Declaration* decl = - self->parent->GetDeclaration(Seg2Filespace(seg, self->parent->baseAddress)); - if (decl == nullptr) - { - ZMtx mtx(self->parent); - mtx.SetName(mtx.GetDefaultName(self->GetName())); - mtx.ExtractFromFile(Seg2Filespace(seg, self->parent->baseAddress)); - mtx.DeclareVar(self->GetName(), ""); + bool addressFound = + Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Mtx", mtxName, false); - mtx.GetSourceOutputCode(self->GetName()); - self->mtxList.push_back(mtx); - mtxName = "&" + mtx.GetName(); + if (!addressFound) + { + if (GETSEGNUM(seg) == self->parent->segment) + { + Declaration* decl = + self->parent->GetDeclaration(Seg2Filespace(seg, self->parent->baseAddress)); + if (decl == nullptr) + { + ZMtx mtx(self->parent); + mtx.SetName(mtx.GetDefaultName(self->GetName())); + mtx.ExtractFromFile(Seg2Filespace(seg, self->parent->baseAddress)); + mtx.DeclareVar(self->GetName(), ""); + + mtx.GetSourceOutputCode(self->GetName()); + self->mtxList.push_back(mtx); + mtxName = "&" + mtx.GetName(); + } + } + else + { + Globals::Instance->WarnHardcodedPointer(seg, self->parent, self, + self->GetRawDataIndex()); } } @@ -1870,7 +1896,8 @@ void ZDisplayList::DeclareReferences(const std::string& prefix) vtxName = StringHelper::Sprintf("%sVtx_%06X", prefix.c_str(), vtxKeys[i]); auto filepath = Globals::Instance->outputPath / vtxName; - std::string incStr = StringHelper::Sprintf("%s.%s.inc", filepath.c_str(), "vtx"); + std::string incStr = + StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), "vtx"); Declaration* vtxDecl = parent->AddDeclarationIncludeArray( vtxKeys[i], incStr, item.size() * 16, "Vtx", vtxName, item.size()); @@ -1954,9 +1981,46 @@ std::string ZDisplayList::ProcessGfxDis([[maybe_unused]] const std::string& pref gfxd_execute(); // generate display list sourceOutput += outputformatter.GetOutput(); // write formatted display list + MergeConnectingVertexLists(); + return sourceOutput; } +void ZDisplayList::MergeConnectingVertexLists() +{ + if (vertices.size() > 0) + { + std::vector>> vertexKeys(vertices.begin(), + vertices.end()); + std::pair> lastItem = vertexKeys.at(0); + + for (size_t i = 1; i < vertexKeys.size(); i++) + { + std::pair> curItem = vertexKeys[i]; + + size_t lastItemEnd = lastItem.first + (lastItem.second.size() * 16); + bool lastItemIntersects = lastItemEnd >= curItem.first; + + if (lastItemIntersects) + { + int intersectedVtxStart = (lastItemEnd - curItem.first) / 16; + + for (size_t j = intersectedVtxStart; j < curItem.second.size(); j++) + vertices[lastItem.first].push_back(curItem.second[j]); + + vertices.erase(curItem.first); + vertexKeys.erase(vertexKeys.begin() + i); + + lastItem.second = vertices[lastItem.first]; + + i--; + } + else + lastItem = curItem; + } + } +} + void ZDisplayList::TextureGenCheck() { if (TextureGenCheck(lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg, lastTexFmt, diff --git a/tools/ZAPD/ZAPD/ZDisplayList.h b/tools/ZAPD/ZAPD/ZDisplayList.h index 96808315d..356e89a2b 100644 --- a/tools/ZAPD/ZAPD/ZDisplayList.h +++ b/tools/ZAPD/ZAPD/ZDisplayList.h @@ -346,7 +346,7 @@ public: ZDisplayList(ZFile* nParent); ~ZDisplayList(); - void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; + void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; void ExtractFromBinary(uint32_t nRawDataIndex, int32_t rawDataSize); void ParseRawData() override; @@ -367,6 +367,9 @@ public: std::string ProcessLegacy(const std::string& prefix); std::string ProcessGfxDis(const std::string& prefix); + // Combines vertex lists from the vertices map which touch or intersect + void MergeConnectingVertexLists(); + bool IsExternalResource() const override; std::string GetExternalExtension() const override; std::string GetSourceTypeName() const override; diff --git a/tools/ZAPD/ZAPD/ZFile.cpp b/tools/ZAPD/ZAPD/ZFile.cpp index 09776505d..0b2a4d631 100644 --- a/tools/ZAPD/ZAPD/ZFile.cpp +++ b/tools/ZAPD/ZAPD/ZFile.cpp @@ -181,6 +181,12 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) } } + const char* segmentDefines = reader->Attribute("Defines"); + if (segmentDefines != NULL) + { + makeDefines = true; + } + if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile) { if (!File::Exists((basePath / name).string())) @@ -213,14 +219,12 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) // Check for repeated attributes. if (offsetXml != nullptr) { - std::string offsetStr = StringHelper::Split(offsetXml, "0x")[1]; - if (!StringHelper::HasOnlyHexDigits(offsetStr)) + if (!StringHelper::IsValidOffset(std::string_view(offsetXml))) { HANDLE_ERROR(WarningType::InvalidXML, - StringHelper::Sprintf("Invalid offset %s entered", offsetStr.c_str()), - ""); + StringHelper::Sprintf("Invalid offset %s entered", offsetXml), ""); } - rawDataIndex = strtol(offsetStr.c_str(), NULL, 16); + rawDataIndex = strtol(offsetXml, NULL, 16); if (offsetSet.find(offsetXml) != offsetSet.end()) { @@ -268,7 +272,7 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) ZResource* nRes = nodeMap[nodeName](this); if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile) - nRes->ExtractFromXML(child, rawDataIndex); + nRes->ExtractWithXML(child, rawDataIndex); switch (nRes->GetResourceType()) { @@ -442,24 +446,25 @@ Declaration* ZFile::AddDeclaration(offset_t address, DeclarationAlignment alignm const std::string& varType, const std::string& varName, const std::string& body) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; Declaration* decl = GetDeclaration(address); if (decl == nullptr) { - decl = new Declaration(address, alignment, size, varType, varName, false, body); + decl = Declaration::Create(address, alignment, size, varType, varName, body); declarations[address] = decl; } else { decl->alignment = alignment; decl->size = size; - decl->varType = varType; - decl->varName = varName; - decl->text = body; + decl->declType = varType; + decl->declName = varName; + decl->declBody = body; } + return decl; } @@ -468,27 +473,29 @@ Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment a const std::string& varName, size_t arrayItemCnt, const std::string& body) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; Declaration* decl = GetDeclaration(address); if (decl == nullptr) { - decl = - new Declaration(address, alignment, size, varType, varName, true, arrayItemCnt, body); + decl = Declaration::CreateArray(address, alignment, size, varType, varName, body, + arrayItemCnt); + declarations[address] = decl; } else { if (decl->isPlaceholder) - decl->varName = varName; + decl->declName = varName; + decl->alignment = alignment; decl->size = size; - decl->varType = varType; + decl->declType = varType; decl->isArray = true; decl->arrayItemCnt = arrayItemCnt; - decl->text = body; + decl->declBody = body; } return decl; @@ -499,41 +506,41 @@ Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment a const std::string& varName, const std::string& arrayItemCntStr, const std::string& body) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; Declaration* decl = GetDeclaration(address); if (decl == nullptr) { - decl = new Declaration(address, alignment, size, varType, varName, true, arrayItemCntStr, - body); + decl = Declaration::CreateArray(address, alignment, size, varType, varName, body, + arrayItemCntStr); + declarations[address] = decl; } else { decl->alignment = alignment; decl->size = size; - decl->varType = varType; - decl->varName = varName; + decl->declType = varType; + decl->declName = varName; decl->isArray = true; decl->arrayItemCntStr = arrayItemCntStr; - decl->text = body; + decl->declBody = body; } return decl; } Declaration* ZFile::AddDeclarationPlaceholder(offset_t address, const std::string& varName) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; Declaration* decl; if (declarations.find(address) == declarations.end()) { - decl = new Declaration(address, DeclarationAlignment::Align4, 0, "", varName, false, ""); - decl->isPlaceholder = true; + decl = Declaration::CreatePlaceholder(address, varName); declarations[address] = decl; } else @@ -546,22 +553,22 @@ Declaration* ZFile::AddDeclarationInclude(offset_t address, const std::string& i size_t size, const std::string& varType, const std::string& varName) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; Declaration* decl = GetDeclaration(address); if (decl == nullptr) { - decl = new Declaration(address, includePath, size, varType, varName); + decl = Declaration::CreateInclude(address, includePath, size, varType, varName); declarations[address] = decl; } else { decl->includePath = includePath; decl->size = size; - decl->varType = varType; - decl->varName = varName; + decl->declType = varType; + decl->declName = varName; } return decl; } @@ -570,7 +577,7 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in size_t size, const std::string& varType, const std::string& varName, size_t arrayItemCnt) { - bool validOffset = AddDeclarationChecks(address, varName); + bool validOffset = DeclarationSanityChecks(address, varName); if (!validOffset) return nullptr; @@ -582,7 +589,7 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in Declaration* decl = GetDeclaration(address); if (decl == nullptr) { - decl = new Declaration(address, includePath, size, varType, varName); + decl = Declaration::CreateInclude(address, includePath, size, varType, varName); decl->isArray = true; decl->arrayItemCnt = arrayItemCnt; @@ -592,8 +599,8 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in else { decl->includePath = includePath; - decl->varType = varType; - decl->varName = varName; + decl->declType = varType; + decl->declName = varName; decl->size = size; decl->isArray = true; decl->arrayItemCnt = arrayItemCnt; @@ -601,7 +608,44 @@ Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& in return decl; } -bool ZFile::AddDeclarationChecks(uint32_t address, const std::string& varName) +Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& includePath, + size_t size, const std::string& varType, + const std::string& varName, + const std::string& defines, size_t arrayItemCnt) +{ + bool validOffset = DeclarationSanityChecks(address, varName); + if (!validOffset) + return nullptr; + + if (StringHelper::StartsWith(includePath, "assets/extracted/")) + includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1]; + if (StringHelper::StartsWith(includePath, "assets/custom/")) + includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1]; + + Declaration* decl = GetDeclaration(address); + if (decl == nullptr) + { + decl = Declaration::CreateInclude(address, includePath, size, varType, varName, defines); + + decl->isArray = true; + decl->arrayItemCnt = arrayItemCnt; + + declarations[address] = decl; + } + else + { + decl->includePath = includePath; + decl->declType = varType; + decl->declName = varName; + decl->defines = defines; + decl->size = size; + decl->isArray = true; + decl->arrayItemCnt = arrayItemCnt; + } + return decl; +} + +bool ZFile::DeclarationSanityChecks(uint32_t address, const std::string& varName) { assert(GETSEGNUM(address) == 0); assert(varName != ""); @@ -645,7 +689,7 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect if (expectedType != "" && expectedType != "void*") { - if (expectedType != decl->varType && "static " + expectedType != decl->varType) + if (expectedType != decl->declType && "static " + expectedType != decl->declType) { declName = StringHelper::Sprintf("0x%08X", segAddress); return false; @@ -653,9 +697,9 @@ bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expect } if (!decl->isArray) - declName = "&" + decl->varName; + declName = "&" + decl->declName; else - declName = decl->varName; + declName = decl->declName; return true; } @@ -679,7 +723,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi if (expectedType != "" && expectedType != "void*") { - if (expectedType != decl->varType && "static " + expectedType != decl->varType) + if (expectedType != decl->declType && "static " + expectedType != decl->declType) { declName = StringHelper::Sprintf("0x%08X", segAddress); return false; @@ -688,7 +732,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi if (decl->address == address) { - declName = decl->varName; + declName = decl->declName; return true; } @@ -699,7 +743,7 @@ bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSi } uint32_t index = (address - decl->address) / elementSize; - declName = StringHelper::Sprintf("&%s[%u]", decl->varName.c_str(), index); + declName = StringHelper::Sprintf("&%s[%u]", decl->declName.c_str(), index); return true; } @@ -728,6 +772,20 @@ bool ZFile::HasDeclaration(offset_t address) return declarations.find(address) != declarations.end(); } +size_t ZFile::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress) +{ + auto currentDecl = declarations.find(declarationAddress); + if (currentDecl == declarations.end()) + return 0; + + auto nextDecl = currentDecl; + std::advance(nextDecl, 1); + if (nextDecl == declarations.end()) + return GetRawData().size() - currentDecl->first; + + return nextDecl->first - currentDecl->first; +} + void ZFile::GenerateSourceFiles() { std::string sourceOutput; @@ -817,8 +875,8 @@ void ZFile::GenerateSourceHeaderFiles() std::string ZFile::GetHeaderInclude() const { - std::string headers = StringHelper::Sprintf("#include \"%s.h\"\n", - (outName.parent_path() / outName.stem()).c_str()); + std::string headers = StringHelper::Sprintf( + "#include \"%s.h\"\n", (outName.parent_path() / outName.stem()).string().c_str()); return headers; } @@ -843,16 +901,12 @@ std::string ZFile::GetExternalFileHeaderInclude() const { fs::path outputFolderPath = externalFile->GetSourceOutputFolderPath(); if (outputFolderPath == this->GetSourceOutputFolderPath()) - { outputFolderPath = externalFile->outName.stem(); - } else - { outputFolderPath /= externalFile->outName.stem(); - } externalFilesIncludes += - StringHelper::Sprintf("#include \"%s.h\"\n", outputFolderPath.c_str()); + StringHelper::Sprintf("#include \"%s.h\"\n", outputFolderPath.string().c_str()); } } @@ -967,46 +1021,7 @@ std::string ZFile::ProcessDeclarations() // printf("RANGE START: 0x%06X - RANGE END: 0x%06X\n", rangeStart, rangeEnd); - // Optimization: See if there are any arrays side by side that can be merged... - std::vector> declarationKeys(declarations.begin(), - declarations.end()); - - std::pair lastItem = declarationKeys.at(0); - - for (size_t i = 1; i < declarationKeys.size(); i++) - { - std::pair curItem = declarationKeys[i]; - - if (curItem.second->isArray && lastItem.second->isArray) - { - if (curItem.second->varType == lastItem.second->varType) - { - if (!curItem.second->declaredInXml && !lastItem.second->declaredInXml) - { - // TEST: For now just do Vtx declarations... - if (lastItem.second->varType == "Vtx") - { - int32_t sizeDiff = curItem.first - (lastItem.first + lastItem.second->size); - - // Make sure there isn't an unaccounted inbetween these two - if (sizeDiff == 0) - { - lastItem.second->size += curItem.second->size; - lastItem.second->arrayItemCnt += curItem.second->arrayItemCnt; - lastItem.second->text += "\n" + curItem.second->text; - declarations.erase(curItem.first); - declarationKeys.erase(declarationKeys.begin() + i); - delete curItem.second; - i--; - continue; - } - } - } - } - } - - lastItem = curItem; - } + MergeNeighboringDeclarations(); for (std::pair item : declarations) ProcessDeclarationText(item.second); @@ -1041,20 +1056,20 @@ std::string ZFile::ProcessDeclarations() // HACK std::string extType; - if (item.second->varType == "Gfx") + if (item.second->declType == "Gfx") extType = "dlist"; - else if (item.second->varType == "Vtx") + else if (item.second->declType == "Vtx") extType = "vtx"; - auto filepath = outputPath / item.second->varName; + auto filepath = outputPath / item.second->declName; File::WriteAllText( - StringHelper::Sprintf("%s.%s.inc", filepath.c_str(), extType.c_str()), - item.second->text); + StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), extType.c_str()), + item.second->declBody); } output += item.second->GetExternalDeclarationStr(); } - else if (item.second->varType != "") + else if (item.second->declType != "") { output += item.second->GetNormalDeclarationStr(); } @@ -1063,6 +1078,50 @@ std::string ZFile::ProcessDeclarations() return output; } +void ZFile::MergeNeighboringDeclarations() +{ + // Optimization: See if there are any arrays side by side that can be merged... + std::vector> declarationKeys(declarations.begin(), + declarations.end()); + + std::pair lastItem = declarationKeys.at(0); + + for (size_t i = 1; i < declarationKeys.size(); i++) + { + std::pair curItem = declarationKeys[i]; + + if (curItem.second->isArray && lastItem.second->isArray) + { + if (curItem.second->declType == lastItem.second->declType) + { + if (!curItem.second->declaredInXml && !lastItem.second->declaredInXml) + { + // TEST: For now just do Vtx declarations... + if (lastItem.second->declType == "Vtx") + { + int32_t sizeDiff = curItem.first - (lastItem.first + lastItem.second->size); + + // Make sure there isn't an unaccounted inbetween these two + if (sizeDiff == 0) + { + lastItem.second->size += curItem.second->size; + lastItem.second->arrayItemCnt += curItem.second->arrayItemCnt; + lastItem.second->declBody += "\n" + curItem.second->declBody; + declarations.erase(curItem.first); + declarationKeys.erase(declarationKeys.begin() + i); + delete curItem.second; + i--; + continue; + } + } + } + } + } + + lastItem = curItem; + } +} + void ZFile::ProcessDeclarationText(Declaration* decl) { size_t refIndex = 0; @@ -1070,17 +1129,17 @@ void ZFile::ProcessDeclarationText(Declaration* decl) if (!(decl->references.size() > 0)) return; - for (size_t i = 0; i < decl->text.size() - 1; i++) + for (size_t i = 0; i < decl->declBody.size() - 1; i++) { - char c = decl->text[i]; - char c2 = decl->text[i + 1]; + char c = decl->declBody[i]; + char c2 = decl->declBody[i + 1]; if (c == '@' && c2 == 'r') { std::string vtxName; Globals::Instance->GetSegmentedArrayIndexedName(decl->references[refIndex], 0x10, this, "Vtx", vtxName); - decl->text.replace(i, 2, vtxName); + decl->declBody.replace(i, 2, vtxName); refIndex++; @@ -1092,7 +1151,8 @@ void ZFile::ProcessDeclarationText(Declaration* decl) std::string ZFile::ProcessExterns() { - std::string output; + std::string output = ""; + bool hadDefines = true; // Previous declaration included defines. for (const auto& item : declarations) { @@ -1101,10 +1161,21 @@ std::string ZFile::ProcessExterns() continue; } + std::string itemDefines = item.second->GetDefinesStr(); + // Add a newline above if previous has no defines and this one does. + if (!hadDefines && (itemDefines.length() > 0)) + { + output.push_back('\n'); + } output += item.second->GetExternStr(); - } + output += itemDefines; - output += "\n"; + // Newline below if this one has defines. + if ((hadDefines = (itemDefines.length() > 0))) + { + output.push_back('\n'); + } + } output += defines; @@ -1153,7 +1224,7 @@ std::string ZFile::ProcessTextureIntersections([[maybe_unused]] const std::strin if (nextDecl == nullptr) texNextName = texturesResources.at(nextOffset)->GetName(); else - texNextName = nextDecl->varName; + texNextName = nextDecl->declName; defines += StringHelper::Sprintf("#define %s ((u32)%s + 0x%06X)\n", texNextName.c_str(), texName.c_str(), offsetDiff); @@ -1226,8 +1297,8 @@ bool ZFile::HandleUnaccountedAddress(offset_t currentAddress, offset_t lastAddr, std::string intersectionInfo = StringHelper::Sprintf( "Resource from 0x%06X:0x%06X (%s) conflicts with 0x%06X (%s).", lastAddr, - lastAddr + lastSize, lastDecl->varName.c_str(), currentAddress, - currentDecl->varName.c_str()); + lastAddr + lastSize, lastDecl->declName.c_str(), currentAddress, + currentDecl->declName.c_str()); HANDLE_WARNING_RESOURCE(WarningType::Intersection, this, nullptr, currentAddress, "intersection detected", intersectionInfo); } diff --git a/tools/ZAPD/ZAPD/ZFile.h b/tools/ZAPD/ZAPD/ZFile.h index e4980eb68..65b1cc4aa 100644 --- a/tools/ZAPD/ZAPD/ZFile.h +++ b/tools/ZAPD/ZAPD/ZFile.h @@ -38,6 +38,8 @@ public: uint32_t segment = 0x80; uint32_t baseAddress, rangeStart, rangeEnd; bool isExternalFile = false; + // Whether to make defines for texture dimensions, and possibly more in future + bool makeDefines = false; ZFile(const fs::path& nOutPath, const std::string& nName); ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBasePath, @@ -74,6 +76,9 @@ public: Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size, const std::string& varType, const std::string& varName, size_t arrayItemCnt); + Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size, + const std::string& varType, const std::string& varName, + const std::string& defines, size_t arrayItemCnt); bool GetDeclarationPtrName(segptr_t segAddress, const std::string& expectedType, std::string& declName) const; @@ -84,6 +89,7 @@ public: Declaration* GetDeclaration(offset_t address) const; Declaration* GetDeclarationRanged(offset_t address) const; bool HasDeclaration(offset_t address); + size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress); std::string GetHeaderInclude() const; std::string GetZRoomHeaderInclude() const; @@ -126,8 +132,9 @@ protected: void DeclareResourceSubReferences(); void GenerateSourceFiles(); void GenerateSourceHeaderFiles(); - bool AddDeclarationChecks(uint32_t address, const std::string& varName); + bool DeclarationSanityChecks(uint32_t address, const std::string& varName); std::string ProcessDeclarations(); + void MergeNeighboringDeclarations(); void ProcessDeclarationText(Declaration* decl); std::string ProcessExterns(); diff --git a/tools/ZAPD/ZAPD/ZLimb.cpp b/tools/ZAPD/ZAPD/ZLimb.cpp index 034d0850b..fd824d010 100644 --- a/tools/ZAPD/ZAPD/ZLimb.cpp +++ b/tools/ZAPD/ZAPD/ZLimb.cpp @@ -394,7 +394,7 @@ void ZLimb::DeclareDList(segptr_t dListSegmentedPtr, const std::string& prefix, std::string dlistName; bool declFound = Globals::Instance->GetSegmentedArrayIndexedName(dListSegmentedPtr, 8, parent, - "Gfx", dlistName); + "Gfx", dlistName, false); if (declFound) return; diff --git a/tools/ZAPD/ZAPD/ZPath.cpp b/tools/ZAPD/ZAPD/ZPath.cpp index 0dac87a1b..cb8295679 100644 --- a/tools/ZAPD/ZAPD/ZPath.cpp +++ b/tools/ZAPD/ZAPD/ZPath.cpp @@ -6,7 +6,8 @@ #include "WarningHandler.h" #include "ZFile.h" -REGISTER_ZFILENODE(Path, ZPath); +REGISTER_ZFILENODE(Path, ZPath); // Old name that is being kept for backwards compatability +REGISTER_ZFILENODE(PathList, ZPath); // New name that may be used in future XMLs ZPath::ZPath(ZFile* nParent) : ZResource(nParent) { @@ -144,8 +145,8 @@ void PathwayEntry::DeclareReferences(const std::string& prefix) return; std::string pointsName; - bool addressFound = - Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s", pointsName); + bool addressFound = Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s", + pointsName, false); if (addressFound) return; @@ -172,7 +173,7 @@ void PathwayEntry::DeclareReferences(const std::string& prefix) points.size(), declaration); } else - decl->text = declaration; + decl->declBody = declaration; } std::string PathwayEntry::GetBodySourceCode() const @@ -185,7 +186,13 @@ std::string PathwayEntry::GetBodySourceCode() const declaration += StringHelper::Sprintf("%i, %i, %i, %s", numPoints, unk1, unk2, listName.c_str()); else - declaration += StringHelper::Sprintf("%i, %s", numPoints, listName.c_str()); + { + if (numPoints > 0) + declaration += + StringHelper::Sprintf("ARRAY_COUNT(%s), %s", listName.c_str(), listName.c_str()); + else + declaration += StringHelper::Sprintf("%i, %s", numPoints, listName.c_str()); + } return declaration; } diff --git a/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp b/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp index a96604fda..ce5425d7e 100644 --- a/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp +++ b/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp @@ -32,7 +32,7 @@ void ZPlayerAnimationData::ParseRawData() for (size_t i = 0; i < totalSize; i += 2) { - limbRotData.push_back(BitConverter::ToUInt16BE(rawData, rawDataIndex + i)); + limbRotData.push_back(BitConverter::ToInt16BE(rawData, rawDataIndex + i)); } } @@ -55,14 +55,21 @@ std::string ZPlayerAnimationData::GetBodySourceCode() const std::string declaration = ""; size_t index = 0; - for (const auto& entry : limbRotData) + for (const auto entry : limbRotData) { if (index % 8 == 0) { declaration += "\t"; } - declaration += StringHelper::Sprintf("0x%04X, ", entry); + if (entry < 0) + { + declaration += StringHelper::Sprintf("-0x%04X, ", -entry); + } + else + { + declaration += StringHelper::Sprintf("0x%04X, ", entry); + } if ((index + 1) % 8 == 0) { diff --git a/tools/ZAPD/ZAPD/ZPlayerAnimationData.h b/tools/ZAPD/ZAPD/ZPlayerAnimationData.h index 20835f236..2923117ef 100644 --- a/tools/ZAPD/ZAPD/ZPlayerAnimationData.h +++ b/tools/ZAPD/ZAPD/ZPlayerAnimationData.h @@ -9,7 +9,7 @@ class ZPlayerAnimationData : public ZResource { public: int16_t frameCount = 0; - std::vector limbRotData; + std::vector limbRotData; ZPlayerAnimationData(ZFile* nParent); diff --git a/tools/ZAPD/ZAPD/ZResource.cpp b/tools/ZAPD/ZAPD/ZResource.cpp index 8825cc97b..d991c4653 100644 --- a/tools/ZAPD/ZAPD/ZResource.cpp +++ b/tools/ZAPD/ZAPD/ZResource.cpp @@ -24,7 +24,7 @@ ZResource::ZResource(ZFile* nParent) RegisterOptionalAttribute("Static", "Global"); } -void ZResource::ExtractFromXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex) +void ZResource::ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex) { rawDataIndex = nRawDataIndex; declaredInXml = true; @@ -274,7 +274,7 @@ void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) if (decl == nullptr || decl->isPlaceholder) decl = DeclareVar(prefix, bodyStr); else - decl->text = bodyStr; + decl->declBody = bodyStr; decl->staticConf = staticConf; } diff --git a/tools/ZAPD/ZAPD/ZResource.h b/tools/ZAPD/ZAPD/ZResource.h index f97b259c6..975401398 100644 --- a/tools/ZAPD/ZAPD/ZResource.h +++ b/tools/ZAPD/ZAPD/ZResource.h @@ -54,6 +54,7 @@ enum class ZResourceType TextureAnimationParams, Vector, Vertex, + Waterbox, }; class ResourceAttribute @@ -79,8 +80,18 @@ public: ZResource(ZFile* nParent); virtual ~ZResource() = default; - // Parsing from File - virtual void ExtractFromXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex); + /// + /// Extracts/Parsees data from binary file using an XML to provide the needed metadata. + /// + /// XML Node we wish to parse from. + /// The offset within the binary file we are going to parse from as + /// indicated by the "Offset" parameter in the XML. + virtual void ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex); + + /// + /// Extracts/Parses the needed data straight from a binary without the use of an XML. + /// + /// The offset within the binary file we wish to parse from. virtual void ExtractFromFile(offset_t nRawDataIndex); // Misc diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp index 1687b5462..e64b85537 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp @@ -21,7 +21,7 @@ void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string& void SetAlternateHeaders::ParseRawDataLate() { - size_t numHeaders = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 4; + size_t numHeaders = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 4; headers.reserve(numHeaders); for (uint32_t i = 0; i < numHeaders; i++) diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp index c92f56c4e..79c87babf 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp @@ -24,7 +24,7 @@ void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& pref void SetEntranceList::ParseRawDataLate() { // Parse Entrances and Generate Declaration - uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; + uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; uint32_t currentPtr = segmentOffset; entrances.reserve(numEntrances); diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp index 80ccc6b05..78bbaa87e 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp @@ -24,7 +24,7 @@ void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix) void SetExitList::ParseRawDataLate() { // Parse Entrances and Generate Declaration - uint32_t numEntrances = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; + uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; uint32_t currentPtr = segmentOffset; exits.reserve(numEntrances); diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp index 89c8c8c88..40e0bddf2 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp @@ -151,7 +151,7 @@ void PolygonDlist::GetSourceOutputCode(const std::string& prefix) if (decl == nullptr) DeclareVar(prefix, bodyStr); else - decl->text = bodyStr; + decl->declBody = bodyStr; } std::string PolygonDlist::GetSourceTypeName() const @@ -371,7 +371,7 @@ void PolygonTypeBase::DeclareAndGenerateOutputCode(const std::string& prefix) } else { - decl->text = bodyStr; + decl->declBody = bodyStr; } } diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp index 52d400a84..967d10b8d 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp @@ -24,7 +24,7 @@ void SetPathways::ParseRawDataLate() { if (Globals::Instance->game == ZGame::MM_RETAIL) { - auto numPaths = zRoom->GetDeclarationSizeFromNeighbor(segmentOffset) / 8; + auto numPaths = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 8; pathwayList.SetNumPaths(numPaths); } diff --git a/tools/ZAPD/ZAPD/ZRoom/ZNames.h b/tools/ZAPD/ZAPD/ZRoom/ZNames.h index 667407c36..83c217e99 100644 --- a/tools/ZAPD/ZAPD/ZRoom/ZNames.h +++ b/tools/ZAPD/ZAPD/ZRoom/ZNames.h @@ -48,11 +48,12 @@ public: static std::string GetEntranceName(uint16_t id) { if (ZNames::GetNumEntrances() == 0 || ZNames::GetNumSpecialEntrances() == 0) - return StringHelper::Sprintf("0x%04X", id); - + return StringHelper::Sprintf("0x%04X", id); + if (id < ZNames::GetNumEntrances()) return Globals::Instance->cfg.entranceList[id]; - else if ((id >= 0x7FF9 && id <= 0x7FFF) && !((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances + else if ((id >= 0x7FF9 && id <= 0x7FFF) && + !((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances return Globals::Instance->cfg.specialEntranceList[id - 0x7FF9]; else return StringHelper::Sprintf("0x%04X", id); @@ -60,5 +61,8 @@ public: static size_t GetNumActors() { return Globals::Instance->cfg.actorList.size(); } static size_t GetNumEntrances() { return Globals::Instance->cfg.entranceList.size(); } - static size_t GetNumSpecialEntrances() { return Globals::Instance->cfg.specialEntranceList.size(); } + static size_t GetNumSpecialEntrances() + { + return Globals::Instance->cfg.specialEntranceList.size(); + } }; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp b/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp index 5831eaa56..a28ea7b90 100644 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp @@ -64,18 +64,14 @@ ZRoom::~ZRoom() delete cmd; } -void ZRoom::ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) +void ZRoom::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) { - ZResource::ExtractFromXML(reader, nRawDataIndex); + ZResource::ExtractWithXML(reader, nRawDataIndex); if (hackMode == "syotes_room") - { - SyotesRoomHack(); - } + SyotesRoomFix(); else - { DeclareVar(name, ""); - } } void ZRoom::ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType) @@ -338,7 +334,7 @@ std::string ZRoom::GetDefaultName(const std::string& prefix) const * back to very early in the game's development. Since this room is a special case, * declare automatically the data its contains whitout the need of a header. */ -void ZRoom::SyotesRoomHack() +void ZRoom::SyotesRoomFix() { PolygonType2 poly(parent, 0, this); @@ -360,20 +356,6 @@ ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType) return nullptr; } -size_t ZRoom::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress) -{ - auto currentDecl = parent->declarations.find(declarationAddress); - if (currentDecl == parent->declarations.end()) - return 0; - - auto nextDecl = currentDecl; - std::advance(nextDecl, 1); - if (nextDecl == parent->declarations.end()) - return parent->GetRawData().size() - currentDecl->first; - - return nextDecl->first - currentDecl->first; -} - size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd) { int32_t cmdIndex = -1; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h b/tools/ZAPD/ZAPD/ZRoom/ZRoom.h index e837ec70a..950dbbb18 100644 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h +++ b/tools/ZAPD/ZAPD/ZRoom/ZRoom.h @@ -22,7 +22,7 @@ public: ZRoom(ZFile* nParent); virtual ~ZRoom(); - void ExtractFromXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; + void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; void ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType); void ParseXML(tinyxml2::XMLElement* reader) override; @@ -37,7 +37,6 @@ public: void GetSourceOutputCode(const std::string& prefix) override; std::string GetDefaultName(const std::string& prefix) const override; - size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress); size_t GetCommandSizeFromNeighbor(ZRoomCommand* cmd); ZRoomCommand* FindCommandOfType(RoomCommand cmdType); @@ -46,5 +45,5 @@ public: ZResourceType GetResourceType() const override; protected: - void SyotesRoomHack(); + void SyotesRoomFix(); }; diff --git a/tools/ZAPD/ZAPD/ZTexture.cpp b/tools/ZAPD/ZAPD/ZTexture.cpp index 74b7c7d10..0ecda1a8c 100644 --- a/tools/ZAPD/ZAPD/ZTexture.cpp +++ b/tools/ZAPD/ZAPD/ZTexture.cpp @@ -137,31 +137,31 @@ void ZTexture::ParseRawData() switch (format) { case TextureType::RGBA16bpp: - PrepareBitmapRGBA16(); + ConvertN64ToBitmap_RGBA16(); break; case TextureType::RGBA32bpp: - PrepareBitmapRGBA32(); + ConvertN64ToBitmap_RGBA32(); break; case TextureType::Grayscale4bpp: - PrepareBitmapGrayscale4(); + ConvertN64ToBitmap_Grayscale4(); break; case TextureType::Grayscale8bpp: - PrepareBitmapGrayscale8(); + ConvertN64ToBitmap_Grayscale8(); break; case TextureType::GrayscaleAlpha4bpp: - PrepareBitmapGrayscaleAlpha4(); + ConvertN64ToBitmap_GrayscaleAlpha4(); break; case TextureType::GrayscaleAlpha8bpp: - PrepareBitmapGrayscaleAlpha8(); + ConvertN64ToBitmap_GrayscaleAlpha8(); break; case TextureType::GrayscaleAlpha16bpp: - PrepareBitmapGrayscaleAlpha16(); + ConvertN64ToBitmap_GrayscaleAlpha16(); break; case TextureType::Palette4bpp: - PrepareBitmapPalette4(); + ConvertN64ToBitmap_Palette4(); break; case TextureType::Palette8bpp: - PrepareBitmapPalette8(); + ConvertN64ToBitmap_Palette8(); break; case TextureType::Error: HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, @@ -212,10 +212,10 @@ void ZTexture::ParseRawDataLate() } } -void ZTexture::PrepareBitmapRGBA16() +void ZTexture::ConvertN64ToBitmap_RGBA16() { textureData.InitEmptyRGBImage(width, height, true); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) @@ -227,15 +227,16 @@ void ZTexture::PrepareBitmapRGBA16() uint8_t b = (data & 0x003E) >> 1; uint8_t alpha = data & 0x01; - textureData.SetRGBPixel(y, x, r * 8, g * 8, b * 8, alpha * 255); + textureData.SetRGBPixel(y, x, (r << 3) | (r >> 2), (g << 3) | (g >> 2), + (b << 3) | (b >> 2), alpha * 255); } } } -void ZTexture::PrepareBitmapRGBA32() +void ZTexture::ConvertN64ToBitmap_RGBA32() { textureData.InitEmptyRGBImage(width, height, true); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) @@ -251,10 +252,10 @@ void ZTexture::PrepareBitmapRGBA32() } } -void ZTexture::PrepareBitmapGrayscale4() +void ZTexture::ConvertN64ToBitmap_Grayscale4() { textureData.InitEmptyRGBImage(width, height, false); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x += 2) @@ -269,16 +270,16 @@ void ZTexture::PrepareBitmapGrayscale4() else grayscale = (parentRawData.at(pos) & 0x0F) << 4; - textureData.SetGrayscalePixel(y, x + i, grayscale); + textureData.SetGrayscalePixel(y, x + i, (grayscale << 4) | grayscale); } } } } -void ZTexture::PrepareBitmapGrayscale8() +void ZTexture::ConvertN64ToBitmap_Grayscale8() { textureData.InitEmptyRGBImage(width, height, false); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) @@ -290,10 +291,10 @@ void ZTexture::PrepareBitmapGrayscale8() } } -void ZTexture::PrepareBitmapGrayscaleAlpha4() +void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha4() { textureData.InitEmptyRGBImage(width, height, true); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x += 2) @@ -308,8 +309,9 @@ void ZTexture::PrepareBitmapGrayscaleAlpha4() else data = parentRawData.at(pos) & 0x0F; - uint8_t grayscale = ((data & 0x0E) >> 1) * 32; - uint8_t alpha = (data & 0x01) * 255; + uint8_t grayscale = data & 0b1110; + grayscale = (grayscale << 4) | (grayscale << 1) | (grayscale >> 2); + uint8_t alpha = (data & 0x01) ? 255 : 0; textureData.SetGrayscalePixel(y, x + i, grayscale, alpha); } @@ -317,27 +319,32 @@ void ZTexture::PrepareBitmapGrayscaleAlpha4() } } -void ZTexture::PrepareBitmapGrayscaleAlpha8() +void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha8() { textureData.InitEmptyRGBImage(width, height, true); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) { size_t pos = rawDataIndex + ((y * width) + x) * 1; - uint8_t grayscale = parentRawData.at(pos) & 0xF0; - uint8_t alpha = (parentRawData.at(pos) & 0x0F) << 4; + uint8_t pixel = parentRawData.at(pos); + uint8_t data = (pixel >> 4) & 0xF; + + data = (data << 4) | data; + uint8_t grayscale = data; + uint8_t alpha = (pixel & 0xF); + alpha = (alpha << 4) | alpha; textureData.SetGrayscalePixel(y, x, grayscale, alpha); } } } -void ZTexture::PrepareBitmapGrayscaleAlpha16() +void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha16() { textureData.InitEmptyRGBImage(width, height, true); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) @@ -351,10 +358,10 @@ void ZTexture::PrepareBitmapGrayscaleAlpha16() } } -void ZTexture::PrepareBitmapPalette4() +void ZTexture::ConvertN64ToBitmap_Palette4() { textureData.InitEmptyPaletteImage(width, height); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x += 2) @@ -375,10 +382,10 @@ void ZTexture::PrepareBitmapPalette4() } } -void ZTexture::PrepareBitmapPalette8() +void ZTexture::ConvertN64ToBitmap_Palette8() { textureData.InitEmptyPaletteImage(width, height); - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); for (size_t y = 0; y < height; y++) { for (size_t x = 0; x < width; x++) @@ -428,31 +435,31 @@ void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath) switch (format) { case TextureType::RGBA16bpp: - PrepareRawDataRGBA16(); + ConvertBitmapToN64_RGBA16(); break; case TextureType::RGBA32bpp: - PrepareRawDataRGBA32(); + ConvertBitmapToN64_RGBA32(); break; case TextureType::Grayscale4bpp: - PrepareRawDataGrayscale4(); + ConvertBitmapToN64_Grayscale4(); break; case TextureType::Grayscale8bpp: - PrepareRawDataGrayscale8(); + ConvertBitmapToN64_Grayscale8(); break; case TextureType::GrayscaleAlpha4bpp: - PrepareRawDataGrayscaleAlpha4(); + ConvertBitmapToN64_GrayscaleAlpha4(); break; case TextureType::GrayscaleAlpha8bpp: - PrepareRawDataGrayscaleAlpha8(); + ConvertBitmapToN64_GrayscaleAlpha8(); break; case TextureType::GrayscaleAlpha16bpp: - PrepareRawDataGrayscaleAlpha16(); + ConvertBitmapToN64_GrayscaleAlpha16(); break; case TextureType::Palette4bpp: - PrepareRawDataPalette4(); + ConvertBitmapToN64_Palette4(); break; case TextureType::Palette8bpp: - PrepareRawDataPalette8(); + ConvertBitmapToN64_Palette8(); break; case TextureType::Error: HANDLE_ERROR_PROCESS(WarningType::InvalidPNG, "Input PNG file has invalid format type", ""); @@ -460,7 +467,7 @@ void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath) } } -void ZTexture::PrepareRawDataRGBA16() +void ZTexture::ConvertBitmapToN64_RGBA16() { for (uint16_t y = 0; y < height; y++) { @@ -469,13 +476,13 @@ void ZTexture::PrepareRawDataRGBA16() size_t pos = ((y * width) + x) * 2; RGBAPixel pixel = textureData.GetPixel(y, x); - uint8_t r = pixel.r / 8; - uint8_t g = pixel.g / 8; - uint8_t b = pixel.b / 8; + uint8_t r = pixel.r >> 3; + uint8_t g = pixel.g >> 3; + uint8_t b = pixel.b >> 3; uint8_t alphaBit = pixel.a != 0; - uint16_t data = (r << 11) + (g << 6) + (b << 1) + alphaBit; + uint16_t data = (r << 11) | (g << 6) | (b << 1) | alphaBit; textureDataRaw[pos + 0] = (data & 0xFF00) >> 8; textureDataRaw[pos + 1] = (data & 0x00FF); @@ -483,7 +490,7 @@ void ZTexture::PrepareRawDataRGBA16() } } -void ZTexture::PrepareRawDataRGBA32() +void ZTexture::ConvertBitmapToN64_RGBA32() { for (uint16_t y = 0; y < height; y++) { @@ -500,7 +507,7 @@ void ZTexture::PrepareRawDataRGBA32() } } -void ZTexture::PrepareRawDataGrayscale4() +void ZTexture::ConvertBitmapToN64_Grayscale4() { for (uint16_t y = 0; y < height; y++) { @@ -515,7 +522,7 @@ void ZTexture::PrepareRawDataGrayscale4() } } -void ZTexture::PrepareRawDataGrayscale8() +void ZTexture::ConvertBitmapToN64_Grayscale8() { for (uint16_t y = 0; y < height; y++) { @@ -528,7 +535,7 @@ void ZTexture::PrepareRawDataGrayscale8() } } -void ZTexture::PrepareRawDataGrayscaleAlpha4() +void ZTexture::ConvertBitmapToN64_GrayscaleAlpha4() { for (uint16_t y = 0; y < height; y++) { @@ -544,9 +551,9 @@ void ZTexture::PrepareRawDataGrayscaleAlpha4() uint8_t alphaBit = pixel.a != 0; if (i == 0) - data |= (((cR / 32) << 1) + alphaBit) << 4; + data = (((cR >> 5) << 1) | alphaBit) << 4; else - data |= ((cR / 32) << 1) + alphaBit; + data |= ((cR >> 5) << 1) | alphaBit; } textureDataRaw[pos] = data; @@ -554,7 +561,7 @@ void ZTexture::PrepareRawDataGrayscaleAlpha4() } } -void ZTexture::PrepareRawDataGrayscaleAlpha8() +void ZTexture::ConvertBitmapToN64_GrayscaleAlpha8() { for (uint16_t y = 0; y < height; y++) { @@ -563,15 +570,15 @@ void ZTexture::PrepareRawDataGrayscaleAlpha8() size_t pos = ((y * width) + x) * 1; RGBAPixel pixel = textureData.GetPixel(y, x); - uint8_t r = pixel.r; - uint8_t a = pixel.a; + uint8_t r = (pixel.r >> 4) & 0xF; + uint8_t a = (pixel.a >> 4) & 0xF; - textureDataRaw[pos] = ((r / 16) << 4) + (a / 16); + textureDataRaw[pos] = (r << 4) | a; } } } -void ZTexture::PrepareRawDataGrayscaleAlpha16() +void ZTexture::ConvertBitmapToN64_GrayscaleAlpha16() { for (uint16_t y = 0; y < height; y++) { @@ -589,7 +596,7 @@ void ZTexture::PrepareRawDataGrayscaleAlpha16() } } -void ZTexture::PrepareRawDataPalette4() +void ZTexture::ConvertBitmapToN64_Palette4() { for (uint16_t y = 0; y < height; y++) { @@ -605,7 +612,7 @@ void ZTexture::PrepareRawDataPalette4() } } -void ZTexture::PrepareRawDataPalette8() +void ZTexture::ConvertBitmapToN64_Palette8() { for (uint16_t y = 0; y < height; y++) { @@ -770,10 +777,10 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix, auto filepath = Globals::Instance->outputPath / fs::path(auxOutName).stem(); if (dWordAligned) - incStr = - StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), GetExternalExtension().c_str()); + incStr = StringHelper::Sprintf("%s.%s.inc.c", filepath.string().c_str(), + GetExternalExtension().c_str()); else - incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.c_str(), + incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.string().c_str(), GetExternalExtension().c_str()); if (!Globals::Instance->cfg.texturePool.empty()) @@ -785,18 +792,31 @@ Declaration* ZTexture::DeclareVar(const std::string& prefix, if (poolEntry != Globals::Instance->cfg.texturePool.end()) { if (dWordAligned) - incStr = StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.c_str(), - GetExternalExtension().c_str()); + incStr = + StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.string().c_str(), + GetExternalExtension().c_str()); else - incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", poolEntry->second.path.c_str(), + incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", + poolEntry->second.path.string().c_str(), GetExternalExtension().c_str()); } } size_t texSizeDivisor = (dWordAligned) ? 8 : 4; - Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), - GetSourceTypeName(), auxName, - GetRawDataSize() / texSizeDivisor); + Declaration* decl; + + if (parent->makeDefines) + { + decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), + GetSourceTypeName(), auxName, GetHeaderDefines(), + GetRawDataSize() / texSizeDivisor); + } + else + { + decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), + GetSourceTypeName(), auxName, + GetRawDataSize() / texSizeDivisor); + } decl->staticConf = staticConf; return decl; } @@ -827,6 +847,17 @@ std::string ZTexture::GetBodySourceCode() const return sourceOutput; } +std::string ZTexture::GetHeaderDefines() const +{ + std::string definePrefix = StringHelper::camelCaseTo_SCREAMING_SNAKE_CASE(name.c_str(), true); + std::string ret = StringHelper::Sprintf("#define %s_WIDTH %d\n", definePrefix.c_str(), width); + + ret += StringHelper::Sprintf("#define %s_HEIGHT %d\n", definePrefix.c_str(), height); + ret += StringHelper::Sprintf("#define %s_SIZE 0x%zX\n", definePrefix.c_str(), GetRawDataSize()); + + return ret; +} + bool ZTexture::IsExternalResource() const { return true; @@ -844,7 +875,7 @@ std::string ZTexture::GetSourceTypeName() const void ZTexture::CalcHash() { - auto parentRawData = parent->GetRawData(); + const auto& parentRawData = parent->GetRawData(); hash = CRC32B(parentRawData.data() + rawDataIndex, GetRawDataSize()); } diff --git a/tools/ZAPD/ZAPD/ZTexture.h b/tools/ZAPD/ZAPD/ZTexture.h index 8cece3ff2..1461ff95a 100644 --- a/tools/ZAPD/ZAPD/ZTexture.h +++ b/tools/ZAPD/ZAPD/ZTexture.h @@ -30,26 +30,28 @@ protected: ZTexture* tlut = nullptr; bool splitTlut; - void PrepareBitmapRGBA16(); - void PrepareBitmapRGBA32(); - void PrepareBitmapGrayscale8(); - void PrepareBitmapGrayscaleAlpha8(); - void PrepareBitmapGrayscale4(); - void PrepareBitmapGrayscaleAlpha4(); - void PrepareBitmapGrayscaleAlpha16(); - void PrepareBitmapPalette4(); - void PrepareBitmapPalette8(); + // The following functions convert from N64 binary data to a bitmap to be saved to a PNG. + void ConvertN64ToBitmap_RGBA16(); + void ConvertN64ToBitmap_RGBA32(); + void ConvertN64ToBitmap_Grayscale8(); + void ConvertN64ToBitmap_GrayscaleAlpha8(); + void ConvertN64ToBitmap_Grayscale4(); + void ConvertN64ToBitmap_GrayscaleAlpha4(); + void ConvertN64ToBitmap_GrayscaleAlpha16(); + void ConvertN64ToBitmap_Palette4(); + void ConvertN64ToBitmap_Palette8(); + // The following functions convert from a bitmap to N64 binary data. void PrepareRawDataFromFile(const fs::path& inFolder); - void PrepareRawDataRGBA16(); - void PrepareRawDataRGBA32(); - void PrepareRawDataGrayscale4(); - void PrepareRawDataGrayscale8(); - void PrepareRawDataGrayscaleAlpha4(); - void PrepareRawDataGrayscaleAlpha8(); - void PrepareRawDataGrayscaleAlpha16(); - void PrepareRawDataPalette4(); - void PrepareRawDataPalette8(); + void ConvertBitmapToN64_RGBA16(); + void ConvertBitmapToN64_RGBA32(); + void ConvertBitmapToN64_Grayscale4(); + void ConvertBitmapToN64_Grayscale8(); + void ConvertBitmapToN64_GrayscaleAlpha4(); + void ConvertBitmapToN64_GrayscaleAlpha8(); + void ConvertBitmapToN64_GrayscaleAlpha16(); + void ConvertBitmapToN64_Palette4(); + void ConvertBitmapToN64_Palette8(); public: ZTexture(ZFile* nParent); @@ -68,9 +70,15 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; std::string GetBodySourceCode() const override; + + /// + /// Calculates the hash of this texture, for use with the texture pool. + /// void CalcHash() override; + void Save(const fs::path& outFolder) override; + std::string GetHeaderDefines() const; bool IsExternalResource() const override; std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; @@ -83,10 +91,28 @@ public: uint32_t GetWidth() const; uint32_t GetHeight() const; void SetDimensions(uint32_t nWidth, uint32_t nHeight); + + /// + /// Returns how many bytes each pixel takes up. + /// + /// float GetPixelMultiplyer() const; + TextureType GetTextureType() const; + + /// + /// Returns the path to the texture pool, taken from the config file. + /// + /// + /// fs::path GetPoolOutPath(const fs::path& defaultValue); + + /// + /// Returns if this texture uses a palette. + /// + /// bool IsColorIndexed() const; + void SetTlut(ZTexture* nTlut); bool HasTlut() const; void ParseRawDataLate() override; diff --git a/tools/ZAPD/ZAPD/ZWaterbox.cpp b/tools/ZAPD/ZAPD/ZWaterbox.cpp new file mode 100644 index 000000000..9a289db52 --- /dev/null +++ b/tools/ZAPD/ZAPD/ZWaterbox.cpp @@ -0,0 +1,74 @@ +#include "ZWaterbox.h" + +#include "Globals.h" +#include "Utils/BitConverter.h" +#include "Utils/StringHelper.h" + +REGISTER_ZFILENODE(Waterbox, ZWaterbox); + +ZWaterbox::ZWaterbox(ZFile* nParent) : ZResource(nParent) +{ +} + +ZWaterbox::~ZWaterbox() +{ +} + +void ZWaterbox::ParseRawData() +{ + const auto& rawData = parent->GetRawData(); + + xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); + ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); + zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); + xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); + zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); + + if (Globals::Instance->game == ZGame::OOT_SW97) + properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); + else + properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12); +} + +void ZWaterbox::DeclareReferences(const std::string& prefix) +{ + std::string declaration; + std::string auxName = name; + + if (name == "") + auxName = GetDefaultName(prefix); + + parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(), + GetSourceTypeName(), name.c_str(), GetBodySourceCode()); +} + +std::string ZWaterbox::GetBodySourceCode() const +{ + return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength, + zLength, properties); +} + +std::string ZWaterbox::GetDefaultName(const std::string& prefix) const +{ + return StringHelper::Sprintf("%sWaterBoxes_%06X", prefix.c_str(), rawDataIndex); +} + +ZResourceType ZWaterbox::GetResourceType() const +{ + return ZResourceType::Waterbox; +} + +size_t ZWaterbox::GetRawDataSize() const +{ + return 16; +} + +std::string ZWaterbox::GetSourceTypeName() const +{ + return "WaterBox"; +} + +bool ZWaterbox::DoesSupportArray() const +{ + return true; +} diff --git a/tools/ZAPD/ZAPD/ZWaterbox.h b/tools/ZAPD/ZAPD/ZWaterbox.h new file mode 100644 index 000000000..e190b26a0 --- /dev/null +++ b/tools/ZAPD/ZAPD/ZWaterbox.h @@ -0,0 +1,30 @@ +#pragma once + +#include "ZFile.h" +#include "ZResource.h" + +class ZWaterbox : public ZResource +{ +public: + int16_t xMin; + int16_t ySurface; + int16_t zMin; + int16_t xLength; + int16_t zLength; + int32_t properties; + + ZWaterbox(ZFile* nParent); + ~ZWaterbox(); + + void ParseRawData() override; + void DeclareReferences(const std::string& prefix) override; + std::string GetBodySourceCode() const override; + std::string GetDefaultName(const std::string& prefix) const override; + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + bool DoesSupportArray() const override; + + size_t GetRawDataSize() const override; +}; diff --git a/tools/ZAPD/ZAPD/genbuildinfo.py b/tools/ZAPD/ZAPD/genbuildinfo.py index 91a567d31..3317c4276 100644 --- a/tools/ZAPD/ZAPD/genbuildinfo.py +++ b/tools/ZAPD/ZAPD/genbuildinfo.py @@ -10,7 +10,13 @@ parser.add_argument("--devel", action="store_true") args = parser.parse_args() with open("build/ZAPD/BuildInfo.cpp", "w+") as buildFile: - label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8") + # Get commit hash from git + # If git fails due to a missing .git directory, a default label will be used instead. + try: + label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8") + except: + label = "GIT_NOT_FOUND" + now = datetime.now() if args.devel: label += " ~ Development version" diff --git a/tools/ZAPD/ZAPDUtils/Makefile b/tools/ZAPD/ZAPDUtils/Makefile index e8941ed77..c0f818bdf 100644 --- a/tools/ZAPD/ZAPDUtils/Makefile +++ b/tools/ZAPD/ZAPDUtils/Makefile @@ -17,7 +17,7 @@ clean: rm -rf build $(LIB) format: - clang-format-11 -i $(CPP_FILES) $(H_FILES) + clang-format-14 -i $(CPP_FILES) $(H_FILES) .PHONY: all clean format diff --git a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h b/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h index 646fa1274..aa41b5b21 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h +++ b/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h @@ -76,7 +76,7 @@ public: fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); } return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); + ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); } static inline uint32_t ToUInt32BE(const std::vector& data, size_t offset) @@ -89,7 +89,7 @@ public: fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); } return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); + ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); } static inline int64_t ToInt64BE(const std::vector& data, size_t offset) @@ -102,9 +102,9 @@ public: fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); } return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) + - ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + - ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + - ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); + ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + + ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + + ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); } static inline uint64_t ToUInt64BE(const std::vector& data, size_t offset) @@ -117,9 +117,9 @@ public: fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); } return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) + - ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + - ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + - ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); + ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + + ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + + ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); } static inline float ToFloatBE(const std::vector& data, size_t offset) @@ -133,8 +133,8 @@ public: } float value; uint32_t floatData = ((uint32_t)data.at(offset + 0) << 24) + - ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); + ((uint32_t)data.at(offset + 1) << 16) + + ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); static_assert(sizeof(uint32_t) == sizeof(float), "expected 32-bit float"); std::memcpy(&value, &floatData, sizeof(value)); return value; diff --git a/tools/ZAPD/ZAPDUtils/Utils/Directory.h b/tools/ZAPD/ZAPDUtils/Utils/Directory.h index eaa6a26ab..2e782624e 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/Directory.h +++ b/tools/ZAPD/ZAPDUtils/Utils/Directory.h @@ -4,7 +4,10 @@ #include #include -#if __has_include() +#ifdef USE_BOOST_FS +#include +namespace fs = boost::filesystem; +#elif __has_include() #include namespace fs = std::filesystem; #else @@ -17,7 +20,11 @@ namespace fs = std::experimental::filesystem; class Directory { public: +#ifdef USE_BOOST_FS + static std::string GetCurrentDirectory() { return fs::current_path().string(); } +#else static std::string GetCurrentDirectory() { return fs::current_path().u8string(); } +#endif static bool Exists(const fs::path& path) { return fs::exists(path); } diff --git a/tools/ZAPD/ZAPDUtils/Utils/File.h b/tools/ZAPD/ZAPDUtils/Utils/File.h index 7bc5d2950..707b1600f 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/File.h +++ b/tools/ZAPD/ZAPDUtils/Utils/File.h @@ -1,8 +1,11 @@ #pragma once -#include +#ifdef USE_BOOST_FS +#include +#else #include -#include +#endif + #include #include #include "Directory.h" @@ -10,29 +13,38 @@ class File { +#ifdef USE_BOOST_FS + typedef fs::ifstream ifstream; + typedef fs::ofstream ofstream; +#else + typedef std::ifstream ifstream; + typedef std::ofstream ofstream; +#endif + public: static bool Exists(const fs::path& filePath) { - std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); + ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); return file.good(); } static std::vector ReadAllBytes(const fs::path& filePath) { - std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); + ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); int32_t fileSize = (int32_t)file.tellg(); file.seekg(0); char* data = new char[fileSize]; file.read(data, fileSize); std::vector result = std::vector(data, data + fileSize); delete[] data; + file.close(); return result; }; static std::string ReadAllText(const fs::path& filePath) { - std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); + ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); if (!file.is_open()) return ""; int32_t fileSize = (int32_t)file.tellg(); @@ -42,6 +54,7 @@ public: file.read(data, fileSize); std::string str = std::string((const char*)data); delete[] data; + file.close(); return str; }; @@ -56,25 +69,29 @@ public: static void WriteAllBytes(const fs::path& filePath, const std::vector& data) { - std::ofstream file(filePath, std::ios::binary); + ofstream file(filePath, std::ios::binary); file.write((char*)data.data(), data.size()); + file.close(); }; static void WriteAllBytes(const std::string& filePath, const std::vector& data) { - std::ofstream file(filePath, std::ios::binary); + ofstream file(filePath, std::ios::binary); file.write((char*)data.data(), data.size()); + file.close(); }; static void WriteAllBytes(const std::string& filePath, const char* data, int dataSize) { - std::ofstream file(filePath, std::ios::binary); + ofstream file(filePath, std::ios::binary); file.write((char*)data, dataSize); + file.close(); }; static void WriteAllText(const fs::path& filePath, const std::string& text) { - std::ofstream file(filePath, std::ios::out); + ofstream file(filePath, std::ios::out); file.write(text.c_str(), text.size()); + file.close(); } }; diff --git a/tools/ZAPD/ZAPDUtils/Utils/Path.h b/tools/ZAPD/ZAPDUtils/Utils/Path.h index 0f7ef2743..90f55380b 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/Path.h +++ b/tools/ZAPD/ZAPDUtils/Utils/Path.h @@ -4,7 +4,10 @@ #include #include "Utils/StringHelper.h" -#if __has_include() +#ifdef USE_BOOST_FS +#include +namespace fs = boost::filesystem; +#elif __has_include() #include namespace fs = std::filesystem; #else diff --git a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h b/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h index 8560d6b09..c4e012eb0 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h +++ b/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h @@ -106,9 +106,35 @@ public: return std::all_of(str.begin(), str.end(), ::isdigit); } - static bool HasOnlyHexDigits(const std::string& str) + static bool IsValidHex(std::string_view str) { - return std::all_of(str.begin(), str.end(), ::isxdigit); + if (str.length() < 3) + { + return false; + } + + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + { + return std::all_of(str.begin() + 2, str.end(), ::isxdigit); + } + + return false; + } + + static bool IsValidOffset(std::string_view str) + { + if (str.length() == 1) + { + // 0 is a valid offset + return isdigit(str[0]); + } + + return IsValidHex(str); + } + + static bool IsValidHex(const std::string& str) + { + return IsValidHex(std::string_view(str.c_str())); } static std::string ToUpper(const std::string& str) @@ -123,4 +149,66 @@ public: return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) { return tolower(a) == tolower(b); }); } + + /** + * Converts a std::string formatted in camelCase into one in SCREAMING_SNAKE_CASE. Since this + * will mostly be used on symbols that start with either 'g' or 's', an option is included to + * skip these. + */ + static std::string camelCaseTo_SCREAMING_SNAKE_CASE(const std::string& in, bool skipSP) + { + std::string out = ""; + const char* ptr = in.c_str(); + char ch = *ptr; + + // Switch checks for 'g'/'s'/'\0', looks at next character if skipSP enabled and string is + // nonempty. + switch (ch) + { + case 'g': + case 's': + if (skipSP) + { + // Print it anyway if the next character is lowercase, e.g. "gameplay_keep_...". + if (!isupper(ptr[1])) + { + out.push_back(toupper(ch)); + } + if ((ch = *++ptr) == '\0') + { + case '\0': + // This is reached either by the if or the case label, avoiding duplication. + return out; + } + } + [[fallthrough]]; + default: + if (islower(ch)) + { + out.push_back(toupper(ch)); + } + else + { + out.push_back(ch); + } + break; + } + + while ((ch = *++ptr) != '\0') + { + if (islower(ch)) + { + out.push_back(toupper(ch)); + } + else + { + if (isupper(ch) && !(isupper(ptr[1]) && isupper(ptr[-1]))) + { + out.push_back('_'); + } + out.push_back(ch); + } + } + return out; + } }; diff --git a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj index 4b91c2aeb..2abbdc966 100644 --- a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj +++ b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj @@ -118,6 +118,7 @@ true MultiThreadedDebug Default + stdcpp17 Console diff --git a/tools/asm-differ/.github/workflows/check-poetry-lock.yml b/tools/asm-differ/.github/workflows/check-poetry-lock.yml new file mode 100644 index 000000000..6104770e9 --- /dev/null +++ b/tools/asm-differ/.github/workflows/check-poetry-lock.yml @@ -0,0 +1,20 @@ +name: flake check + +on: + pull_request: + push: + +permissions: read-all + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Install `nix` which is just a dead-simple way to get a stable `poetry` + # in scope. + - uses: cachix/install-nix-action@v20 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + # Check that poetry.lock is in sync with pyproject.toml + - run: nix run github:NixOS/nixpkgs/22.11#poetry -- lock --check diff --git a/tools/asm-differ/.github/workflows/unit-tests.yml b/tools/asm-differ/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..a77498adf --- /dev/null +++ b/tools/asm-differ/.github/workflows/unit-tests.yml @@ -0,0 +1,15 @@ +name: unit tests + +on: + pull_request: + push: + +permissions: read-all + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: python3 -m pip install --user colorama watchdog levenshtein cxxfilt + - run: python3 test.py diff --git a/tools/asm-differ/.gitignore b/tools/asm-differ/.gitignore index a2b216fea..90df93b18 100644 --- a/tools/asm-differ/.gitignore +++ b/tools/asm-differ/.gitignore @@ -1,4 +1,3 @@ .mypy_cache/ __pycache__/ .vscode/ -poetry.lock diff --git a/tools/asm-differ/.gitrepo b/tools/asm-differ/.gitrepo index a23a9c1e4..21e3d185a 100644 --- a/tools/asm-differ/.gitrepo +++ b/tools/asm-differ/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/simonlindholm/asm-differ branch = main - commit = ae408664a89ea4dc70d005d0afc69ac26c938cbb - parent = c833969ea79ba31c3103e25e94ef88098c0287de + commit = 4ed8473173c5a4d6d62337ee4759fdbd93fcf20b + parent = 862e62040f70cb24d66e893ff4299b79fda9407d method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/tools/asm-differ/README.md b/tools/asm-differ/README.md index 1d0932c9b..4e62b15b4 100644 --- a/tools/asm-differ/README.md +++ b/tools/asm-differ/README.md @@ -1,6 +1,6 @@ # asm-differ -Nice differ for assembly code. Currently supports MIPS, PPC, AArch64, and ARM32; should be easy to hack to support other instruction sets. +Nice differ for assembly code. Currently supports MIPS, PPC, AArch64, ARM32, SH2, SH4, and m68k; should be easy to hack to support other instruction sets. ![](screenshot.png) diff --git a/tools/asm-differ/diff.py b/tools/asm-differ/diff.py index 230dbaed7..d20fe4ed7 100755 --- a/tools/asm-differ/diff.py +++ b/tools/asm-differ/diff.py @@ -54,7 +54,7 @@ if __name__ == "__main__": argcomplete = None parser = argparse.ArgumentParser( - description="Diff MIPS, PPC, AArch64, or ARM32 assembly." + description="Diff MIPS, PPC, AArch64, ARM32, SH2, SH4, or m68k assembly." ) start_argument = parser.add_argument( @@ -120,11 +120,11 @@ if __name__ == "__main__": ) parser.add_argument( "-f", - "--objfile", - dest="objfile", + "--file", + dest="file", type=str, - help="""File path for an object file being diffed. When used - the map file isn't searched for the function given. Useful for dynamically + help="""File path for a file being diffed. When used the map + file isn't searched for the function given. Useful for dynamically linked libraries.""", ) parser.add_argument( @@ -212,9 +212,9 @@ if __name__ == "__main__": "-s", "--stop-at-ret", dest="stop_at_ret", - action="store_true", + action="count", help="""Stop disassembling at the first return instruction. - Some functions have multiple return points, so use with care!""", + You can also pass -ss to stop at the second return instruction, and so on.""", ) parser.add_argument( "-i", @@ -264,6 +264,14 @@ if __name__ == "__main__": help="""Automatically update when source/object files change. Recommended in combination with -m.""", ) + parser.add_argument( + "-y", + "--yes", + dest="agree", + action="store_true", + help="""Automatically agree to any yes/no questions asked. + Useful if you really want to use the -w option without -m.""" + ) parser.add_argument( "-0", "--diff_mode=single_base", @@ -407,7 +415,7 @@ class ProjectSettings: build_command: List[str] map_format: str build_dir: str - ms_map_address_offset: int + map_address_offset: int baseimg: Optional[str] myimg: Optional[str] mapfile: Optional[str] @@ -431,7 +439,7 @@ class Config: # Build/objdump options diff_obj: bool - objfile: Optional[str] + file: Optional[str] make: bool source_old_binutils: bool diff_section: str @@ -449,7 +457,7 @@ class Config: show_branches: bool show_line_numbers: bool show_source: bool - stop_at_ret: bool + stop_at_ret: Optional[int] ignore_large_imms: bool ignore_addr_diffs: bool algorithm: str @@ -481,7 +489,9 @@ def create_project_settings(settings: Dict[str, Any]) -> ProjectSettings: objdump_flags=settings.get("objdump_flags", []), expected_dir=settings.get("expected_dir", "expected/"), map_format=settings.get("map_format", "gnu"), - ms_map_address_offset=settings.get("ms_map_address_offset", 0), + map_address_offset=settings.get( + "map_address_offset", settings.get("ms_map_address_offset", 0) + ), build_dir=settings.get("build_dir", settings.get("mw_build_dir", "build/")), show_line_numbers_default=settings.get("show_line_numbers_default", True), disassemble_all=settings.get("disassemble_all", False), @@ -522,7 +532,7 @@ def create_config(args: argparse.Namespace, project: ProjectSettings) -> Config: arch=arch, # Build/objdump options diff_obj=args.diff_obj, - objfile=args.objfile, + file=args.file, make=args.make, source_old_binutils=args.source_old_binutils, diff_section=args.diff_section, @@ -557,6 +567,9 @@ def get_objdump_executable(objdump_executable: Optional[str]) -> str: "mips-linux-gnu-objdump", "mips64-elf-objdump", "mips-elf-objdump", + "sh-elf-objdump", + "sh4-linux-gnu-objdump", + "m68k-elf-objdump", ] for objdump_cand in objdump_candidates: try: @@ -590,7 +603,7 @@ BUFFER_CMD: List[str] = ["tail", "-c", str(10**9)] # -i ignores case when searching # -c something about how the screen gets redrawn; I don't remember the purpose # -#6 makes left/right arrow keys scroll by 6 characters -LESS_CMD: List[str] = ["less", "-SRic", "-#6"] +LESS_CMD: List[str] = ["less", "-SRic", "-+F", "-+X", "-#6"] DEBOUNCE_DELAY: float = 0.1 @@ -766,7 +779,6 @@ class AnsiFormatter(Formatter): BasicFormat.STACK: Fore.YELLOW, BasicFormat.REGISTER: Fore.YELLOW, BasicFormat.REGISTER_CATEGORY: Fore.LIGHTYELLOW_EX, - BasicFormat.DELAY_SLOT: Fore.LIGHTBLACK_EX, BasicFormat.DIFF_CHANGE: Fore.LIGHTBLUE_EX, BasicFormat.DIFF_ADD: Fore.GREEN, BasicFormat.DIFF_REMOVE: Fore.RED, @@ -1271,11 +1283,7 @@ def search_map_file( if len(find) == 1: names_find = re.search(r"(\S+) ... (\S+)", find[0]) assert names_find is not None - fileofs = ( - int(names_find.group(1), 16) - - load_address - + project.ms_map_address_offset - ) + fileofs = int(names_find.group(1), 16) - load_address if for_binary: return None, fileofs @@ -1462,7 +1470,7 @@ def dump_objfile( if start.startswith("0"): fail("numerical start address not supported with -o; pass a function name") - objfile = config.objfile + objfile = config.file if not objfile: objfile, _ = search_map_file(start, project, config, for_binary=False) @@ -1495,15 +1503,21 @@ def dump_objfile( def dump_binary( start: str, end: Optional[str], config: Config, project: ProjectSettings ) -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: - if not project.baseimg or not project.myimg: + binfile = config.file or project.myimg + if not project.baseimg or not binfile: fail("Missing myimg/baseimg in config.") if config.make: - run_make(project.myimg, project) + run_make(binfile, project) + if not os.path.isfile(binfile): + fail(f"Not able to find binary file: {binfile}") start_addr = maybe_eval_int(start) - if start_addr is None: + if start_addr is None and config.file is None: _, start_addr = search_map_file(start, project, config, for_binary=True) if start_addr is None: fail("Not able to find function in map file.") + start_addr += project.map_address_offset + elif start_addr is None: + fail("Start address must be an integer expression when using binary -f") if end is not None: end_addr = eval_int(end, "End address must be an integer expression.") else: @@ -1515,9 +1529,9 @@ def dump_binary( ] flags2 = [f"--start-address={start_addr}", f"--stop-address={end_addr}"] return ( - project.myimg, + binfile, (objdump_flags + flags1, project.baseimg, None), - (objdump_flags + flags2, project.myimg, None), + (objdump_flags + flags2, binfile, None), ) @@ -1569,7 +1583,8 @@ class AsmProcessorMIPS(AsmProcessor): # integer. return prev, None before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] + reloc_addend_from_imm(imm, before, self.config.arch) + addend = reloc_addend_from_imm(imm, before, self.config.arch) + repl = row.split()[-1] + addend if "R_MIPS_LO16" in row: repl = f"%lo({repl})" elif "R_MIPS_HI16" in row: @@ -1590,6 +1605,8 @@ class AsmProcessorMIPS(AsmProcessor): repl = f"%got({repl})" elif "R_MIPS_CALL16" in row: repl = f"%call16({repl})" + elif "R_MIPS_LITERAL" in row: + repl = repl[:-len(addend)] else: assert False, f"unknown relocation type '{row}' for line '{prev}'" return before + repl + after, repl @@ -1812,6 +1829,66 @@ class AsmProcessorI686(AsmProcessor): return mnemonic == "ret" +class AsmProcessorSH2(AsmProcessor): + def __init__(self, config: Config) -> None: + super().__init__(config) + + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: + return prev, None + + def is_end_of_function(self, mnemonic: str, args: str) -> bool: + return mnemonic == "rts" + + +class AsmProcessorM68k(AsmProcessor): + def pre_process( + self, mnemonic: str, args: str, next_row: Optional[str] + ) -> Tuple[str, str]: + # replace objdump's syntax of pointer accesses with the equivilant in AT&T syntax for readability + return mnemonic, re.sub( + r"%(sp|a[0-7]|fp|pc)@(?:(?:\((-?(?:0x[0-9a-f]+|[0-9]+)) *(,%d[0-7]:[wl])?\))|(\+)|(-))?", + r"\5\2(%\1\3)\4", + args, + ) + + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: + repl = row.split()[-1] + mnemonic, args = prev.split(maxsplit=1) + + addr_imm = re.search(r"(? bool: + return mnemonic == "rts" or mnemonic == "rte" or mnemonic == "rtr" + + @dataclass class ArchSettings: name: str @@ -2006,6 +2083,48 @@ I686_BRANCH_INSTRUCTIONS = { "jz", } +SH2_BRANCH_INSTRUCTIONS = { + "bf", + "bf.s", + "bt", + "bt.s", + "bra", + "bsr", +} + +M68K_CONDS = { + "ra", + "cc", + "cs", + "eq", + "ge", + "gt", + "hi", + "le", + "ls", + "lt", + "mi", + "ne", + "pl", + "vc", + "vs", +} + +M68K_BRANCH_INSTRUCTIONS = { + f"{prefix}{cond}{suffix}" + for prefix in {"b", "db"} + for cond in M68K_CONDS + for suffix in {"s", "w"} +}.union( + { + "dbt", + "dbf", + "bsrw", + "bsrs", + } +) + + MIPS_SETTINGS = ArchSettings( name="mips", re_int=re.compile(r"[0-9]+"), @@ -2127,6 +2246,72 @@ I686_SETTINGS = ArchSettings( proc=AsmProcessorI686, ) +SH2_SETTINGS = ArchSettings( + name="sh2", + # match -128-127 preceded by a '#' with a ',' after (8 bit immediates) + re_int=re.compile(r"(?<=#)(-?(?:1[01][0-9]|12[0-8]|[1-9][0-9]?|0))(?=,)"), + # match , match ! and after + re_comment=re.compile(r"<.*?>|!.*"), + # - r0-r15 general purpose registers, r15 is stack pointer during exceptions + # - sr, gbr, vbr - control registers + # - mach, macl, pr, pc - system registers + re_reg=re.compile(r"r1[0-5]|r[0-9]"), + # sh2 has pc-relative and gbr-relative but not stack-pointer-relative + re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"), + # max immediate size is 8-bit + re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), + re_imm=re.compile(r"\b0[xX][0-9a-fA-F]+\b"), + # https://github.com/bminor/binutils-gdb/blob/master/bfd/elf32-sh-relocs.h#L21 + re_reloc=re.compile(r"R_SH_"), + arch_flags=["-m", "sh2"], + branch_instructions=SH2_BRANCH_INSTRUCTIONS, + instructions_with_address_immediates=SH2_BRANCH_INSTRUCTIONS.union( + {"bf", "bf.s", "bt", "bt.s", "bra", "bsr"} + ), + delay_slot_instructions=SH2_BRANCH_INSTRUCTIONS.union( + {"bf.s", "bt.s", "bra", "braf", "bsr", "bsrf", "jmp", "jsr", "rts"} + ), + proc=AsmProcessorSH2, +) + +SH4_SETTINGS = replace( + SH2_SETTINGS, + name="sh4", + # - fr0-fr15, dr0-dr14, xd0-xd14, fv0-fv12 FP registers + # dr/xd registers can only be even-numbered, and fv registers can only be a multiple of 4 + re_reg=re.compile( + r"r1[0-5]|r[0-9]|fr1[0-5]|fr[0-9]|dr[02468]|dr1[024]|xd[02468]|xd1[024]|fv[048]|fv12" + ), + arch_flags=["-m", "sh4"], +) + +SH4EL_SETTINGS = replace(SH4_SETTINGS, name="sh4el", big_endian=False) + +M68K_SETTINGS = ArchSettings( + name="m68k", + re_int=re.compile(r"[0-9]+"), + # '|' is used by assemblers, but is not used by objdump + re_comment=re.compile(r"<.*>"), + # Includes: + # - d0-d7 data registers + # - a0-a6 address registers + # - fp0-fp7 floating-point registers + # - usp (user sp) + # - fp, sr, ccr + # - fpcr, fpsr, fpiar + re_reg=re.compile(r"%\b(d[0-7]|a[0-6]|usp|fp([0-7]|cr|sr|iar)?|sr|ccr)(:[wl])?\b"), + # This matches all stack accesses that do not use an index register + re_sprel=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)(?=\((%sp|%a7)\))"), + re_imm=re.compile(r"#?-?\b(0x[0-9a-f]+|[0-9]+)(?!\()"), + re_large_imm=re.compile(r"#?-?([1-9][0-9]{2,}|0x[0-9a-f]{3,})"), + re_reloc=re.compile(r"R_68K_"), + arch_flags=["-m", "m68k"], + branch_instructions=M68K_BRANCH_INSTRUCTIONS, + # Pretty much every instruction can take an address immediate + instructions_with_address_immediates=M68K_BRANCH_INSTRUCTIONS.union("jmp", "jsr"), + proc=AsmProcessorM68k, +) + ARCH_SETTINGS = [ MIPS_SETTINGS, MIPSEL_SETTINGS, @@ -2136,11 +2321,21 @@ ARCH_SETTINGS = [ AARCH64_SETTINGS, PPC_SETTINGS, I686_SETTINGS, + SH2_SETTINGS, + SH4_SETTINGS, + SH4EL_SETTINGS, + M68K_SETTINGS, ] def hexify_int(row: str, pat: Match[str], arch: ArchSettings) -> str: full = pat.group(0) + + # sh2/sh4 only has 8-bit immediates, just convert them uniformly without + # any -hex stuff + if arch.name == "sh2" or arch.name == "sh4" or arch.name == "sh4el": + return hex(int(full) & 0xFF) + if len(full) <= 1: # leave one-digit ints alone return full @@ -2220,16 +2415,15 @@ class Line: def process(dump: str, config: Config) -> List[Line]: arch = config.arch processor = arch.proc(config) - skip_next = False source_lines = [] source_filename = None source_line_num = None + rets_remaining = config.stop_at_ret i = 0 num_instr = 0 data_refs: Dict[int, Dict[str, List[int]]] = defaultdict(lambda: defaultdict(list)) output: List[Line] = [] - stop_after_delay_slot = False lines = dump.split("\n") while i < len(lines): row = lines[i] @@ -2364,17 +2558,8 @@ def process(dump: str, config: Config) -> List[Line]: if not config.score_stack_differences: scorable_line = re.sub(arch.re_sprel, "addr(sp)", scorable_line) - if skip_next: - skip_next = False - row = "" - mnemonic = "" - scorable_line = "" - if mnemonic in arch.branch_likely_instructions: - skip_next = True - row = re.sub(arch.re_reg, "", row) row = re.sub(arch.re_sprel, "addr(sp)", row) - row_with_imm = row if mnemonic in arch.instructions_with_address_immediates: row = row.strip() row, _ = split_off_address(row) @@ -2414,8 +2599,10 @@ def process(dump: str, config: Config) -> List[Line]: num_instr += 1 source_lines = [] - if config.stop_at_ret and processor.is_end_of_function(mnemonic, args): - break + if rets_remaining and processor.is_end_of_function(mnemonic, args): + rets_remaining -= 1 + if rets_remaining == 0: + break processor.post_process(output) return output @@ -2509,7 +2696,7 @@ def diff_sequences( try: rem1 = remap(seq1) rem2 = remap(seq2) - except ValueError as e: + except ValueError: if len(seq1) + len(seq2) < 0x110000: raise # If there are too many unique elements, chr() doesn't work. @@ -2776,13 +2963,6 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: # the diff, and don't just happen to have the are the same address # by accident. pass - elif line1.diff_row == "": - # Don't draw attention to differing branch-likely delay slots: they - # typically mirror the branch destination - 1 so the real difference - # is elsewhere. Still, do mark them as different to avoid confusion. - # No need to consider branches because delay slots can't branch. - out1 = out1.reformat(BasicFormat.DELAY_SLOT) - out2 = out2.reformat(BasicFormat.DELAY_SLOT) else: mnemonic = line1.original.split()[0] branchless1, address1 = out1.plain(), "" @@ -3131,7 +3311,7 @@ def align_diffs(old_diff: Diff, new_diff: Diff, config: Config) -> TableData: def diff_line_to_table_line(line: Tuple[OutputLine, ...]) -> TableLine: cells = [ - (line[0].base or Text(), line[0].line1) + (line[0].base or Text(), line[0].line1), ] for ol in line[1:]: cells.append((ol.fmt2, ol.line2)) @@ -3433,9 +3613,9 @@ def main() -> None: elif not args.watch: display.run_sync() else: - if not args.make: + if not args.make and not args.agree: yn = input( - "Warning: watch-mode (-w) enabled without auto-make (-m). " + "Warning: watch-mode (-w) enabled without auto-make (-m) or agree-all (-y). " "You will have to run make manually. Ok? (Y/n) " ) if yn.lower() == "n": diff --git a/tools/asm-differ/mypy.ini b/tools/asm-differ/mypy.ini index 138b93935..0559d9b8b 100644 --- a/tools/asm-differ/mypy.ini +++ b/tools/asm-differ/mypy.ini @@ -11,7 +11,7 @@ warn_return_any = True warn_unused_ignores = True ignore_missing_imports = True python_version = 3.6 -files = diff.py +files = diff.py, test.py [mypy-diff_settings] ignore_errors = True diff --git a/tools/asm-differ/poetry.lock b/tools/asm-differ/poetry.lock new file mode 100644 index 000000000..2826d784b --- /dev/null +++ b/tools/asm-differ/poetry.lock @@ -0,0 +1,321 @@ +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. + +[[package]] +name = "ansiwrap" +version = "0.8.4" +description = "textwrap, but savvy to ANSI colors and styles" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "ansiwrap-0.8.4-py2.py3-none-any.whl", hash = "sha256:7b053567c88e1ad9eed030d3ac41b722125e4c1271c8a99ade797faff1f49fb1"}, + {file = "ansiwrap-0.8.4.zip", hash = "sha256:ca0c740734cde59bf919f8ff2c386f74f9a369818cdc60efe94893d01ea8d9b7"}, +] + +[package.dependencies] +textwrap3 = ">=0.9.2" + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "cxxfilt" +version = "0.3.0" +description = "Python interface to c++filt / abi::__cxa_demangle" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "cxxfilt-0.3.0-py2.py3-none-any.whl", hash = "sha256:774e85a8d0157775ed43276d89397d924b104135762d86b3a95f81f203094e07"}, + {file = "cxxfilt-0.3.0.tar.gz", hash = "sha256:7df6464ba5e8efbf0d8974c0b2c78b32546676f06059a83515dbdfa559b34214"}, +] + +[package.extras] +test = ["pytest (>=3.0.0)"] + +[[package]] +name = "levenshtein" +version = "0.20.9" +description = "Python extension for computing string edit distances and similarities." +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "Levenshtein-0.20.9-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:105c239ec786750cd5136991c58196b440cc39b6acf3ec8227f6562c9a94e4b9"}, + {file = "Levenshtein-0.20.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f7728bea7fe6dc55ceecde0dcda4287e74fe3b6733ad42530f46aaa8d2f81d0"}, + {file = "Levenshtein-0.20.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cc7eca755c13c92814c8cce8175524cf764ce38f39228b602f59eac58cfdc51a"}, + {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8a552e79d053dc1324fb90d342447fd4e15736f4cbc5363b6fbd5577f53dce9"}, + {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5474b2681ee0b7944fb1e7fe281cd44e2dfe75b03ba4558dca49c96fa0861b62"}, + {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:56e132c203b0dd8fc72a33e791c39ad0d5a25bcf24b130a1e202abbf489a3e75"}, + {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3badc94708ac05b405e795fde58a53272b90a9ee6099ecd54a345658b7b812e1"}, + {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48b9b3ae095b14dad7bc4bd219c7cd9113a7aa123a033337c85b00fe2ed565d3"}, + {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0d3a1f7328c91caeb1f857ddd2787e3f19d60cc2c688339d249ca8841da61454"}, + {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ef67c50428c99caf67d31bd209da21d9378da5f0cc3ad4f7bafb6caa78aee6f2"}, + {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:47f6d1592c0891f7355e38a302becd233336ca2f55f9a8be3a8635f946a6784f"}, + {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:2891019740e874f05e0349e9f27b6af8ad837b1612f42e9c90c296d54d1404fd"}, + {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c554704eec4f4ba742febdcc79a85491f8f9a1d493cb103bb2af18536d6cf122"}, + {file = "Levenshtein-0.20.9-cp310-cp310-win32.whl", hash = "sha256:7628e356b3f9c78ad7272c3b9137f0641a1368849e749ff6f2c8fe372795806b"}, + {file = "Levenshtein-0.20.9-cp310-cp310-win_amd64.whl", hash = "sha256:ba2bafe3511194a37044cae4e7d328cca70657933052691c37eba2ca428a379d"}, + {file = "Levenshtein-0.20.9-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7605a94145198d19fdaaa7e29c0f8a56ad719b12386f3ae8cd8ed4cb9fa6c2e4"}, + {file = "Levenshtein-0.20.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:29db4dabfad2ddf33c7986eb6fd525c7587cca4c4d9e187365cff0a5281f5a35"}, + {file = "Levenshtein-0.20.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:965336c1772a4fc5fb2686a2a0bfaf3455dced96f19f50f278da8bc139076d31"}, + {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67235753035ac898d6475c0b29540521018db2e0027a3c1deb9aa0af0a84fd74"}, + {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:120dca58136aee3d8c7b190e30db7b6a6eb9579ea5712df84ad076a389801743"}, + {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6496ea66a6f755e48c0d82f1eee396d16edcd5592d4b3677d26fa789a636a728"}, + {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0af20327acc2c904d11611cb3a0d8d17f80c279a12e0b84189eafc35297186d"}, + {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:34d2f891ef53afbab6cf2eeb92ff13151884d17dc80a2d6d3c7ae74d7738b772"}, + {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2ab9c72380582bf4745d1c5b055b1df0c85f7a980a04bd7603a855dd91478c0f"}, + {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6de13be3eb5ac48053fb1635a7b4daa936b9114ad4b264942e9eb709fcaa41dd"}, + {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:a9fc296860588251d8d72b4f4637cca4eef7351e042a7a23d44e6385aef1e160"}, + {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:35777b20fe35858248c22da37984469e6dd1278f55d17c53378312853d5d683d"}, + {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6b9e0642ddb4c431f77c38cec9edbd0317e26c3f37d072ccf281ab58926dce69"}, + {file = "Levenshtein-0.20.9-cp311-cp311-win32.whl", hash = "sha256:f88ec322d86d3cc9d3936dbf6b421ad813950c2658599d48ac4ede59f2a6047e"}, + {file = "Levenshtein-0.20.9-cp311-cp311-win_amd64.whl", hash = "sha256:2907a6888455f9915d5b656f5d058f63eaf6063b2c7f0f1ff6bc05706ae5bc39"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6bcebc79760be08488cb921732af34ade6abc7476a94866881c68b45ec4b6c82"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47d8d4f3825d1d8f3b19382537a8536e689cf57aaa224d2cb4f44cf844811885"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d40e18a5817ee7f0675401613a26c492fd4ea68d2103c1480fb5a6ab1b8763d"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4d258f3d44f6bac17f33002fea34570049507d3476c3716b5267170c666b20b4"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c621e0c389546147ed43c33ca4168de0f91c920508ab8a94a400835fa084f486"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57a31527dc7994353091626e62b7d82d53290cb00df48d3e5d29cb291fb4c03c"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:129c8f192e656b7c2c543bf0d704d677720771b8bc2f30c50db02fbc2001bac2"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:5a01fca58255be6bf724a40af2575d7cf644c099c28a00d1f5f6a81675e60e7d"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:4c13749ea39a228f05d5bd9d473e76f726fc2dcd493cafc322f740921a6eeffb"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:69daa0f8eefa5b947255a81346741ed86fe7030e0909741dbd978e38b30da3fd"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:fcc78a73ed423bbb09ac902dd2e1ff1094d159d1c6766e5e52da5f376a4cba18"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-win32.whl", hash = "sha256:d82ae57982a9f33c55778f1f0f63d5e51e291aee236abed3b90497578b944202"}, + {file = "Levenshtein-0.20.9-cp36-cp36m-win_amd64.whl", hash = "sha256:4082379b406752fc1173ed1f8c3a122c5d5491e10e564ed721602e4e049e3d4c"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cb499783b7126e6fc45c39ab34c8114148425c5d975b1ce35e6c47c0eda58a94"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ce747b296aad3bd8a563cccf2119cf37bf72f668076bfdad6ec55f0a0596dd9"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1347c3ebbe8f42f7a487e8d23a95bde6529379b4939ad51d32246d001565c499"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2a2f1c1e8360603a6da29416da61d1907a27656843e269413091c8c3a3e6286e"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73c1caaedbee3617fd29139aac8dab7743776b59c3c1fed2790308ecb43c7b25"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a1f24133df69f8b618fc508d6023695130ad3c3c8968ef43aaeca21835eb337a"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:cf7260722f8170c09af5cfa714bb45626a4dfc85d71d1c1c9c52c2a6901cc501"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:01668178fd9244df290db0340293982fe7641162a12a35ad9ffb3fe145ce6377"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:1e46f9d3483dc4991ac60ff3711b0d40f93e352cc8edc16b68df57ccc472bd6c"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:680cd250dc1875eb80cf2a0cca742bd13f6f9ab11c48317244fcc483eba1dd67"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2346e2f7dfbbc2936bd81e19f7734984e72486ffc086760c897b39b9f674b2fa"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-win32.whl", hash = "sha256:7f31bcf257fec9719d0d97185c419d315f6f20a194f0b442919e352d19418b2e"}, + {file = "Levenshtein-0.20.9-cp37-cp37m-win_amd64.whl", hash = "sha256:48262bc9830ad60de96411fcb2e96a522c7206e7069169e04d89dd79364a7722"}, + {file = "Levenshtein-0.20.9-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:eba5696e1f8e8da225498fd1d743886d639400cafd0e5be3c553978cbb54c345"}, + {file = "Levenshtein-0.20.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:679333188f9791c85109d2981e97e8721a99b2b975b5c52d16aca50ac9c70757"}, + {file = "Levenshtein-0.20.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:06c9cfc61cf66833692d1ed258ec5a0871221b0779f1281c32a10348c492e2c5"}, + {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b5d80d949168df406f2ac9ade1a5d0419cef0a8df611c8c2efe88f0248c9d0c0"}, + {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9275c6e601ff7f659116e2235e8585950c9c39d72504006077be85bf27950b35"}, + {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6414eea342d9632045e12b66bef043dbc6557189a283dc4dcc5966f63fa48998"}, + {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56571c58700600a382ecdf3f9efcb132ed16a0476cbb4e23a9478ab0ae788fd9"}, + {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7ccb76ffd9b851384f9cf1595b90b17cae46f0ab895e234de11ea48f9d9f73a"}, + {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109172943cff7fb10f28a9eb819eb3eaf9c88fe38661fb1d0f230a8ae68a615c"}, + {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:534c8bbdfd033fa20575d57332d9ac0447b5afbeca7db975ba169762ece2051f"}, + {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:381a725963c392585135654caa3c7fc32cb1755ed977fb9db72e8838fee261be"}, + {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:7e4a44b1223980a9880e6f2bbf19121a125928580df9e4e81207199190343e11"}, + {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fc0ced58ee6d07351cde140a7ec88e5f2ceb053c805af1f90514d21914d21cad"}, + {file = "Levenshtein-0.20.9-cp38-cp38-win32.whl", hash = "sha256:5eec0868ffcd825564dd5e3399305eaa159220554d1aedbff13af0de1fe01f6c"}, + {file = "Levenshtein-0.20.9-cp38-cp38-win_amd64.whl", hash = "sha256:e9db476e40a3aa184631d102b716a019f70837eb0fcdd5b5d1504f099f91359c"}, + {file = "Levenshtein-0.20.9-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:d5a20ecc20a09a32c72128c43d7df23877a2469b3c17780ae83f9a9d55873c08"}, + {file = "Levenshtein-0.20.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8b7b772f2f62a19a15ccb1b09c6c7754ca7430bb7e19d4ca4ff232958786873b"}, + {file = "Levenshtein-0.20.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af92326b90ea6fe4521cf6a5dfe450e21150393c573ef3ad9ee446f1009fbfbd"}, + {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b48554dad328e198a636f937e2f4c057aac8e4bfcb8467b10e0f5daa94307b17"}, + {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:82304821e128d5453d1755d1c2f3d9cdf75e9def3517cf913b09df174e20283b"}, + {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2052357c5da195ede7dbc81a4e3408ebd6374a1ff1b86a0a9d8b8ce9562b32c3"}, + {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:44d60c6b47ccd6841c990418f7f4f58c28f7da9b07b81eaafc99b836cf351df1"}, + {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8dc2194c917e4466cb604580b16e42286f04e3fe0424489459e68f0834f5c527"}, + {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bb1e20965d759d89318cac7ff7eb045eb1fafcb5c3fa3047a23f6ae20c810ad7"}, + {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:74e959035da10a54e7a2eee28408eff672297ce96cdadd6f4a2f269a06e395c4"}, + {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:4a441b23d9704f57eb34af6a300ae5c335b9e77e6a065ada36ca69d6fc582af9"}, + {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:f59470c49114a5da064712a427317f2b1fa5bb89aa2dfd0e300f8289e26aec28"}, + {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:06191f5d0527e3224107aea260b5cffc8a78722e0efb4e793f0e45c449b813a2"}, + {file = "Levenshtein-0.20.9-cp39-cp39-win32.whl", hash = "sha256:3235c461904fe94b4f62fee78a1658c1316344411c81b02400c27d692a893f8f"}, + {file = "Levenshtein-0.20.9-cp39-cp39-win_amd64.whl", hash = "sha256:8b852def43d165c2f2b468239d66b847d9e6f52a775fc657773ced04d26062bd"}, + {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:f674cc75f127692525563155e500a3fa16aaf24dafd33a9bcda46e2979f793a1"}, + {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a34e3fd21acb31fcd29a0c8353dca74dfbb59957210a6f142505907a9dff3d59"}, + {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0ddddf2beafd1a2e17a87f80be562a7f7478e6098ccfc15de4c879972dfa2f9"}, + {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9649af1a896a4a7fc7f6f1fd093e8a92f463297f56c7bd0f8d7d16dfabeb236d"}, + {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:d7bd7f25336849027fbe5ed32b6ffd404436727d78a014e348dcd17347c73fd8"}, + {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0371d996ae81089296f42b6e886c7bf138d1cb0f002b0c724a9e5d689b29b5a0"}, + {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7e00e2fda9f225b5f4537647f6195cf220d468532739d3390eaf082b1d76c87"}, + {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1600f5ebe2f2aebf13e88cf488ec2e5ce25f7a42b5846335018693baf4ea63bd"}, + {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bcd59fcf06aaedda98da185ec289dc2c2c9922ce789f6a9c101709d4a22cac9"}, + {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:1549e307028fa5c3a8cf28ae8bcb1f6072df2abf7f36b9d7adf7fd60690fe372"}, + {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:795f2e95d09a33c66c73cd49be3ee632fb4b8c41be72c0cb8df29a329ce7d111"}, + {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:726bfb361d3b6786bea31392752f0ffcca568db7dc3f1e274f1b529489b8ad05"}, + {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e0fd315132786375de532355fa06b2f11c4b4af5784b7e064dc54b6ee0c3281"}, + {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0674bc0549d5ea9edb934b3b03a160a116cc410feb5739a51f9c4f618ee674e3"}, + {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1ef8f3ecdfca5d6f0538226338d58617270439a1cc9b6cacb30a388984bb1608"}, + {file = "Levenshtein-0.20.9.tar.gz", hash = "sha256:70a8ad5e28bb76d87da1eb3f31de940836596547d6d01317c2289f5b7cd0b0ea"}, +] + +[package.dependencies] +rapidfuzz = ">=2.3.0,<3.0.0" + +[[package]] +name = "rapidfuzz" +version = "2.15.1" +description = "rapid fuzzy string matching" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:fc0bc259ebe3b93e7ce9df50b3d00e7345335d35acbd735163b7c4b1957074d3"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d59fb3a410d253f50099d7063855c2b95df1ef20ad93ea3a6b84115590899f25"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c525a3da17b6d79d61613096c8683da86e3573e807dfaecf422eea09e82b5ba6"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4deae6a918ecc260d0c4612257be8ba321d8e913ccb43155403842758c46fbe"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2577463d10811386e704a3ab58b903eb4e2a31b24dfd9886d789b0084d614b01"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f67d5f56aa48c0da9de4ab81bffb310683cf7815f05ea38e5aa64f3ba4368339"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d7927722ff43690e52b3145b5bd3089151d841d350c6f8378c3cfac91f67573a"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6534afc787e32c4104f65cdeb55f6abe4d803a2d0553221d00ef9ce12788dcde"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d0ae6ec79a1931929bb9dd57bc173eb5ba4c7197461bf69e3a34b6dd314feed2"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:be7ccc45c4d1a7dfb595f260e8022a90c6cb380c2a346ee5aae93f85c96d362b"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:8ba013500a2b68c64b2aecc5fb56a2dad6c2872cf545a0308fd044827b6e5f6a"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:4d9f7d10065f657f960b48699e7dddfce14ab91af4bab37a215f0722daf0d716"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7e24a1b802cea04160b3fccd75d2d0905065783ebc9de157d83c14fb9e1c6ce2"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-win32.whl", hash = "sha256:dffdf03499e0a5b3442951bb82b556333b069e0661e80568752786c79c5b32de"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-win_amd64.whl", hash = "sha256:7d150d90a7c6caae7962f29f857a4e61d42038cfd82c9df38508daf30c648ae7"}, + {file = "rapidfuzz-2.15.1-cp310-cp310-win_arm64.whl", hash = "sha256:87c30e9184998ff6eb0fa9221f94282ce7c908fd0da96a1ef66ecadfaaa4cdb7"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6986413cb37035eb796e32f049cbc8c13d8630a4ac1e0484e3e268bb3662bd1b"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a72f26e010d4774b676f36e43c0fc8a2c26659efef4b3be3fd7714d3491e9957"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b5cd54c98a387cca111b3b784fc97a4f141244bbc28a92d4bde53f164464112e"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da7fac7c3da39f93e6b2ebe386ed0ffe1cefec91509b91857f6e1204509e931f"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f976e76ac72f650790b3a5402431612175b2ac0363179446285cb3c901136ca9"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:abde47e1595902a490ed14d4338d21c3509156abb2042a99e6da51f928e0c117"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ca8f1747007a3ce919739a60fa95c5325f7667cccf6f1c1ef18ae799af119f5e"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c35da09ab9797b020d0d4f07a66871dfc70ea6566363811090353ea971748b5a"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a3a769ca7580686a66046b77df33851b3c2d796dc1eb60c269b68f690f3e1b65"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:d50622efefdb03a640a51a6123748cd151d305c1f0431af762e833d6ffef71f0"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:b7461b0a7651d68bc23f0896bffceea40f62887e5ab8397bf7caa883592ef5cb"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:074ee9e17912e025c72a5780ee4c7c413ea35cd26449719cc399b852d4e42533"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7025fb105a11f503943f17718cdb8241ea3bb4d812c710c609e69bead40e2ff0"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-win32.whl", hash = "sha256:2084d36b95139413cef25e9487257a1cc892b93bd1481acd2a9656f7a1d9930c"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-win_amd64.whl", hash = "sha256:5a738fcd24e34bce4b19126b92fdae15482d6d3a90bd687fd3d24ce9d28ce82d"}, + {file = "rapidfuzz-2.15.1-cp311-cp311-win_arm64.whl", hash = "sha256:dc3cafa68cfa54638632bdcadf9aab89a3d182b4a3f04d2cad7585ed58ea8731"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3c53d57ba7a88f7bf304d4ea5a14a0ca112db0e0178fff745d9005acf2879f7d"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6ee758eec4cf2215dc8d8eafafcea0d1f48ad4b0135767db1b0f7c5c40a17dd"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2d93ba3ae59275e7a3a116dac4ffdb05e9598bf3ee0861fecc5b60fb042d539e"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7c3ff75e647908ddbe9aa917fbe39a112d5631171f3fcea5809e2363e525a59d"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6d89c421702474c6361245b6b199e6e9783febacdbfb6b002669e6cb3ef17a09"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f69e6199fec0f58f9a89afbbaea78d637c7ce77f656a03a1d6ea6abdc1d44f8"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:41dfea282844d0628279b4db2929da0dacb8ac317ddc5dcccc30093cf16357c1"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2dd03477feefeccda07b7659dd614f6738cfc4f9b6779dd61b262a73b0a9a178"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:5efe035aa76ff37d1b5fa661de3c4b4944de9ff227a6c0b2e390a95c101814c0"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:ed2cf7c69102c7a0a06926d747ed855bc836f52e8d59a5d1e3adfd980d1bd165"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a0e441d4c2025110ec3eba5d54f11f78183269a10152b3a757a739ffd1bb12bf"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-win32.whl", hash = "sha256:a4a54efe17cc9f53589c748b53f28776dfdfb9bc83619685740cb7c37985ac2f"}, + {file = "rapidfuzz-2.15.1-cp37-cp37m-win_amd64.whl", hash = "sha256:bb8318116ecac4dfb84841d8b9b461f9bb0c3be5b616418387d104f72d2a16d1"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e9296c530e544f68858c3416ad1d982a1854f71e9d2d3dcedb5b216e6d54f067"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:49c4bcdb9238f11f8c4eba1b898937f09b92280d6f900023a8216008f299b41a"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ebb40a279e134bb3fef099a8b58ed5beefb201033d29bdac005bddcdb004ef71"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a7381c11cb590bbd4e6f2d8779a0b34fdd2234dfa13d0211f6aee8ca166d9d05"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfdcdedfd12a0077193f2cf3626ff6722c5a184adf0d2d51f1ec984bf21c23c3"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f85bece1ec59bda8b982bd719507d468d4df746dfb1988df11d916b5e9fe19e8"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b1b393f4a1eaa6867ffac6aef58cfb04bab2b3d7d8e40b9fe2cf40dd1d384601"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53de456ef020a77bf9d7c6c54860a48e2e902584d55d3001766140ac45c54bc7"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2492330bc38b76ed967eab7bdaea63a89b6ceb254489e2c65c3824efcbf72993"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:099e4c6befaa8957a816bdb67ce664871f10aaec9bebf2f61368cf7e0869a7a1"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:46599b2ad4045dd3f794a24a6db1e753d23304699d4984462cf1ead02a51ddf3"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:591f19d16758a3c55c9d7a0b786b40d95599a5b244d6eaef79c7a74fcf5104d8"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ed17359061840eb249f8d833cb213942e8299ffc4f67251a6ed61833a9f2ea20"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-win32.whl", hash = "sha256:aa1e5aad325168e29bf8e17006479b97024aa9d2fdbe12062bd2f8f09080acf8"}, + {file = "rapidfuzz-2.15.1-cp38-cp38-win_amd64.whl", hash = "sha256:c2bb68832b140c551dbed691290bef4ee6719d4e8ce1b7226a3736f61a9d1a83"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3fac40972cf7b6c14dded88ae2331eb50dfbc278aa9195473ef6fc6bfe49f686"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f0e456cbdc0abf39352800309dab82fd3251179fa0ff6573fa117f51f4e84be8"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:22b9d22022b9d09fd4ece15102270ab9b6a5cfea8b6f6d1965c1df7e3783f5ff"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46754fe404a9a6f5cbf7abe02d74af390038d94c9b8c923b3f362467606bfa28"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:91abb8bf7610efe326394adc1d45e1baca8f360e74187f3fa0ef3df80cdd3ba6"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e40a2f60024f9d3c15401e668f732800114a023f3f8d8c40f1521a62081ff054"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a48ee83916401ac73938526d7bd804e01d2a8fe61809df7f1577b0b3b31049a3"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c71580052f9dbac443c02f60484e5a2e5f72ad4351b84b2009fbe345b1f38422"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:82b86d5b8c1b9bcbc65236d75f81023c78d06a721c3e0229889ff4ed5c858169"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:fc4528b7736e5c30bc954022c2cf410889abc19504a023abadbc59cdf9f37cae"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:e1e0e569108a5760d8f01d0f2148dd08cc9a39ead79fbefefca9e7c7723c7e88"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:94e1c97f0ad45b05003806f8a13efc1fc78983e52fa2ddb00629003acf4676ef"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:47e81767a962e41477a85ad7ac937e34d19a7d2a80be65614f008a5ead671c56"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-win32.whl", hash = "sha256:79fc574aaf2d7c27ec1022e29c9c18f83cdaf790c71c05779528901e0caad89b"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-win_amd64.whl", hash = "sha256:f3dd4bcef2d600e0aa121e19e6e62f6f06f22a89f82ef62755e205ce14727874"}, + {file = "rapidfuzz-2.15.1-cp39-cp39-win_arm64.whl", hash = "sha256:cac095cbdf44bc286339a77214bbca6d4d228c9ebae3da5ff6a80aaeb7c35634"}, + {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:b89d1126be65c85763d56e3b47d75f1a9b7c5529857b4d572079b9a636eaa8a7"}, + {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19b7460e91168229768be882ea365ba0ac7da43e57f9416e2cfadc396a7df3c2"}, + {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93c33c03e7092642c38f8a15ca2d8fc38da366f2526ec3b46adf19d5c7aa48ba"}, + {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:040faca2e26d9dab5541b45ce72b3f6c0e36786234703fc2ac8c6f53bb576743"}, + {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:6e2a3b23e1e9aa13474b3c710bba770d0dcc34d517d3dd6f97435a32873e3f28"}, + {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:2e597b9dfd6dd180982684840975c458c50d447e46928efe3e0120e4ec6f6686"}, + {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d14752c9dd2036c5f36ebe8db5f027275fa7d6b3ec6484158f83efb674bab84e"}, + {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:558224b6fc6124d13fa32d57876f626a7d6188ba2a97cbaea33a6ee38a867e31"}, + {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c89cfa88dc16fd8c9bcc0c7f0b0073f7ef1e27cceb246c9f5a3f7004fa97c4d"}, + {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:509c5b631cd64df69f0f011893983eb15b8be087a55bad72f3d616b6ae6a0f96"}, + {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0f73a04135a03a6e40393ecd5d46a7a1049d353fc5c24b82849830d09817991f"}, + {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c99d53138a2dfe8ada67cb2855719f934af2733d726fbf73247844ce4dd6dd5"}, + {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f01fa757f0fb332a1f045168d29b0d005de6c39ee5ce5d6c51f2563bb53c601b"}, + {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60368e1add6e550faae65614844c43f8a96e37bf99404643b648bf2dba92c0fb"}, + {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:785744f1270828cc632c5a3660409dee9bcaac6931a081bae57542c93e4d46c4"}, + {file = "rapidfuzz-2.15.1.tar.gz", hash = "sha256:d62137c2ca37aea90a11003ad7dc109c8f1739bfbe5a9a217f3cdb07d7ac00f6"}, +] + +[package.extras] +full = ["numpy"] + +[[package]] +name = "textwrap3" +version = "0.9.2" +description = "textwrap from Python 3.6 backport (plus a few tweaks)" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "textwrap3-0.9.2-py2.py3-none-any.whl", hash = "sha256:bf5f4c40faf2a9ff00a9e0791fed5da7415481054cef45bb4a3cfb1f69044ae0"}, + {file = "textwrap3-0.9.2.zip", hash = "sha256:5008eeebdb236f6303dcd68f18b856d355f6197511d952ba74bc75e40e0c3414"}, +] + +[[package]] +name = "watchdog" +version = "2.3.1" +description = "Filesystem events monitoring" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "watchdog-2.3.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1f1200d4ec53b88bf04ab636f9133cb703eb19768a39351cee649de21a33697"}, + {file = "watchdog-2.3.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:564e7739abd4bd348aeafbf71cc006b6c0ccda3160c7053c4a53b67d14091d42"}, + {file = "watchdog-2.3.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:95ad708a9454050a46f741ba5e2f3468655ea22da1114e4c40b8cbdaca572565"}, + {file = "watchdog-2.3.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a073c91a6ef0dda488087669586768195c3080c66866144880f03445ca23ef16"}, + {file = "watchdog-2.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:aa8b028750b43e80eea9946d01925168eeadb488dfdef1d82be4b1e28067f375"}, + {file = "watchdog-2.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:964fd236cd443933268ae49b59706569c8b741073dbfd7ca705492bae9d39aab"}, + {file = "watchdog-2.3.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:91fd146d723392b3e6eb1ac21f122fcce149a194a2ba0a82c5e4d0ee29cd954c"}, + {file = "watchdog-2.3.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:efe3252137392a471a2174d721e1037a0e6a5da7beb72a021e662b7000a9903f"}, + {file = "watchdog-2.3.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:85bf2263290591b7c5fa01140601b64c831be88084de41efbcba6ea289874f44"}, + {file = "watchdog-2.3.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8f2df370cd8e4e18499dd0bfdef476431bcc396108b97195d9448d90924e3131"}, + {file = "watchdog-2.3.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ea5d86d1bcf4a9d24610aa2f6f25492f441960cf04aed2bd9a97db439b643a7b"}, + {file = "watchdog-2.3.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6f5d0f7eac86807275eba40b577c671b306f6f335ba63a5c5a348da151aba0fc"}, + {file = "watchdog-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b848c71ef2b15d0ef02f69da8cc120d335cec0ed82a3fa7779e27a5a8527225"}, + {file = "watchdog-2.3.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0d9878be36d2b9271e3abaa6f4f051b363ff54dbbe7e7df1af3c920e4311ee43"}, + {file = "watchdog-2.3.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:4cd61f98cb37143206818cb1786d2438626aa78d682a8f2ecee239055a9771d5"}, + {file = "watchdog-2.3.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:3d2dbcf1acd96e7a9c9aefed201c47c8e311075105d94ce5e899f118155709fd"}, + {file = "watchdog-2.3.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:03f342a9432fe08107defbe8e405a2cb922c5d00c4c6c168c68b633c64ce6190"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:7a596f9415a378d0339681efc08d2249e48975daae391d58f2e22a3673b977cf"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_armv7l.whl", hash = "sha256:0e1dd6d449267cc7d6935d7fe27ee0426af6ee16578eed93bacb1be9ff824d2d"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_i686.whl", hash = "sha256:7a1876f660e32027a1a46f8a0fa5747ad4fcf86cb451860eae61a26e102c8c79"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_ppc64.whl", hash = "sha256:2caf77ae137935c1466f8cefd4a3aec7017b6969f425d086e6a528241cba7256"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:53f3e95081280898d9e4fc51c5c69017715929e4eea1ab45801d5e903dd518ad"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_s390x.whl", hash = "sha256:9da7acb9af7e4a272089bd2af0171d23e0d6271385c51d4d9bde91fe918c53ed"}, + {file = "watchdog-2.3.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:8a4d484e846dcd75e96b96d80d80445302621be40e293bfdf34a631cab3b33dc"}, + {file = "watchdog-2.3.1-py3-none-win32.whl", hash = "sha256:a74155398434937ac2780fd257c045954de5b11b5c52fc844e2199ce3eecf4cf"}, + {file = "watchdog-2.3.1-py3-none-win_amd64.whl", hash = "sha256:5defe4f0918a2a1a4afbe4dbb967f743ac3a93d546ea4674567806375b024adb"}, + {file = "watchdog-2.3.1-py3-none-win_ia64.whl", hash = "sha256:4109cccf214b7e3462e8403ab1e5b17b302ecce6c103eb2fc3afa534a7f27b96"}, + {file = "watchdog-2.3.1.tar.gz", hash = "sha256:d9f9ed26ed22a9d331820a8432c3680707ea8b54121ddcc9dc7d9f2ceeb36906"}, +] + +[package.extras] +watchmedo = ["PyYAML (>=3.10)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.7" +content-hash = "f48df5c526c5e9e9b6c8dd83bb06b628c347f616a66670800e3032a83ba50c08" diff --git a/tools/asm-differ/test.py b/tools/asm-differ/test.py new file mode 100644 index 000000000..b5f037f90 --- /dev/null +++ b/tools/asm-differ/test.py @@ -0,0 +1,189 @@ +import unittest +import diff +import json + + +class TestSh2(unittest.TestCase): + def get_config(self) -> diff.Config: + arch = diff.get_arch("sh2") + formatter = diff.JsonFormatter(arch_str="sh2") + config = diff.Config( + arch=arch, + diff_obj=True, + file='', + make=False, + source_old_binutils=True, + diff_section='.text', + inlines=False, + max_function_size_lines=25000, + max_function_size_bytes=100000, + formatter=formatter, + diff_mode=diff.DiffMode.NORMAL, + base_shift=0, + skip_lines=0, + compress=None, + show_rodata_refs=True, + show_branches=True, + show_line_numbers=False, + show_source=False, + stop_at_ret=None, + ignore_large_imms=False, + ignore_addr_diffs=True, + algorithm="levenshtein", + reg_categories={}, + ) + return config + + # check that comment <> regex has ? to avoid ",r1 ! 60e87d0" + # all being a comment for: + # mov.l 44 ,r1 ! 60e87d0 + def test_sh2_comment(self) -> None: + # parser specifically looks for tabs so make sure they are represented + + # 16: d1 0b mov.l 44 ,r1 ! 60e87d0 + sh2_theirs = ( + " 16:\td1 0b \tmov.l\t44 ,r1\t! 60e87d0\n" + ) + + # 16: d1 0b mov.l 44 <_func_060E8780+0x44>,r1 ! 0 <_func_060E8780> + sh2_ours = " 16:\td1 0b \tmov.l\t44 <_func_060E8780+0x44>,r1\t! 0 <_func_060E8780>\n" + + config = self.get_config() + display = diff.Display(sh2_theirs, sh2_ours, config) + loaded = json.loads(display.run_diff()[0]) + + curr = loaded["rows"][0]["current"]["src_comment"] + + assert curr != "<_func_060E8780+0x44>,r1 ! 0 <_func_060E8780>" + assert curr == "<_func_060E8780+0x44>" + + def test_sh2_immediates(self) -> None: + # test parsing these immediates + # func_0606B760(): + # 0: ec 01 mov #1,r12 + # 2: 71 01 add #1,r1 + # 4: ec ff mov #-1,r12 + # 6: 71 ff add #-1,r1 + # 8: ec 7f mov #127,r12 + # a: 71 7f add #127,r1 + # c: ec 80 mov #-128,r12 + # e: 71 80 add #-128,r1 + sh2_theirs = "func_0606B760():\n 0:\tec 01 \tmov\t#1,r12\n 2:\t71 01 \tadd\t#1,r1\n 4:\tec ff \tmov\t#-1,r12\n 6:\t71 ff \tadd\t#-1,r1\n 8:\tec 7f \tmov\t#127,r12\n a:\t71 7f \tadd\t#127,r1\n c:\tec 80 \tmov\t#-128,r12\n e:\t71 80 \tadd\t#-128,r1" + + # just diff with self + sh2_ours = sh2_theirs + + config = self.get_config() + display = diff.Display(sh2_theirs, sh2_ours, config) + loaded = json.loads(display.run_diff()[0]) + + expected = [ + "0: mov #0x1,r12", + "2: add #0x1,r1", + "4: mov #0xff,r12", + "6: add #0xff,r1", + "8: mov #0x7f,r12", + "a: add #0x7f,r1", + "c: mov #0x80,r12", + "e: add #0x80,r1", + ] + + i = 0 + for text in loaded["rows"]: + assert text["base"]["text"][0]["text"] == expected[i] + i += 1 + + def test_more_sh2_immediates(self) -> None: + # test that the re_int regex is able to catch all these "boundary" numbers + # since we have to match 0-9 one digit at a time + # 0: 71 00 add #0,r1 + # 2: 71 01 add #1,r1 + # 4: 71 09 add #9,r1 + # 6: 71 0a add #10,r1 + # 8: 71 0b add #11,r1 + # a: 71 13 add #19,r1 + # c: 71 64 add #100,r1 + # e: 71 65 add #101,r1 + # 10: 71 6d add #109,r1 + # 12: 71 6f add #111,r1 + # 14: 71 77 add #119,r1 + # 16: 71 f7 add #-9,r1 + # 18: 71 f6 add #-10,r1 + # 1a: 71 f5 add #-11,r1 + # 1c: 71 ed add #-19,r1 + # 1e: 71 9c add #-100,r1 + # 20: 71 9b add #-101,r1 + # 22: 71 93 add #-109,r1 + # 24: 71 91 add #-111,r1 + # 26: 71 89 add #-119,r1 + sh2_theirs = "func_0606B760():\n 0:\t71 00 \tadd\t#0,r1\n 2:\t71 01 \tadd\t#1,r1\n 4:\t71 09 \tadd\t#9,r1\n 6:\t71 0a \tadd\t#10,r1\n 8:\t71 0b \tadd\t#11,r1\n a:\t71 13 \tadd\t#19,r1\n c:\t71 64 \tadd\t#100,r1\n e:\t71 65 \tadd\t#101,r1\n 10:\t71 6d \tadd\t#109,r1\n 12:\t71 6f \tadd\t#111,r1\n 14:\t71 77 \tadd\t#119,r1\n 16:\t71 f7 \tadd\t#-9,r1\n 18:\t71 f6 \tadd\t#-10,r1\n 1a:\t71 f5 \tadd\t#-11,r1\n 1c:\t71 ed \tadd\t#-19,r1\n 1e:\t71 9c \tadd\t#-100,r1\n 20:\t71 9b \tadd\t#-101,r1\n 22:\t71 93 \tadd\t#-109,r1\n 24:\t71 91 \tadd\t#-111,r1\n 26:\t71 89 \tadd\t#-119,r1" + + # just diff with self + sh2_ours = sh2_theirs + + config = self.get_config() + display = diff.Display(sh2_theirs, sh2_ours, config) + loaded = json.loads(display.run_diff()[0]) + + expected = [ + "0: add #0x0,r1", + "2: add #0x1,r1", + "4: add #0x9,r1", + "6: add #0xa,r1", + "8: add #0xb,r1", + "a: add #0x13,r1", + "c: add #0x64,r1", + "e: add #0x65,r1", + "10: add #0x6d,r1", + "12: add #0x6f,r1", + "14: add #0x77,r1", + "16: add #0xf7,r1", + "18: add #0xf6,r1", + "1a: add #0xf5,r1", + "1c: add #0xed,r1", + "1e: add #0x9c,r1", + "20: add #0x9b,r1", + "22: add #0x93,r1", + "24: add #0x91,r1", + "26: add #0x89,r1", + ] + + i = 0 + for text in loaded["rows"]: + assert text["base"]["text"][0]["text"] == expected[i] + i += 1 + + def test_branch(self) -> None: + # test that bt.s and bra get ~> + # func(): + # 0: 8d 02 bt.s 8 + # 2: 6e f3 mov r15,r14 + # 4: a0 01 bra a + # 6: 00 09 nop + + # 00000008 : + # lab_0606B780(): + # 8: db 32 mov.l d4 ,r11 + + # 0000000a : + # lab_0606B8E0(): + # a: 00 0b rts + # c: 00 09 nop + sh2_theirs = "func():\n 0:\t8d 02 \tbt.s\t8 \n 2:\t6e f3 \tmov\tr15,r14\n 4:\ta0 01 \tbra\ta \n 6:\t00 09 \tnop\t\n\n00000008 :\nlab_0606B780():\n 8:\tdb 32 \tmov.l\td4 ,r11\n\n0000000a :\nlab_0606B8E0():\n a:\t00 0b \trts\t\n c:\t00 09 \tnop\t" + sh2_ours = sh2_theirs + + config = self.get_config() + display = diff.Display(sh2_theirs, sh2_ours, config) + loaded = json.loads(display.run_diff()[0]) + + # bt.s 8 + print(loaded["rows"][0]["base"]["text"][1]["text"] == "~>") + print(loaded["rows"][0]["base"]["text"][1]["key"] == "8") + + # bra a + print(loaded["rows"][2]["base"]["text"][1]["text"] == "~>") + print(loaded["rows"][2]["base"]["text"][1]["key"] == "10") + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/asm-processor/.gitrepo b/tools/asm-processor/.gitrepo index e9ee1dd74..6265b2fc5 100644 --- a/tools/asm-processor/.gitrepo +++ b/tools/asm-processor/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:simonlindholm/asm-processor.git branch = main - commit = bbd86ea1faf84e6a7a0e101ab8068a00a3dfb2fc - parent = 8985197b6da23db874ac6e8a29ddec5636944bba + commit = fed1e3ddb9967bd427f4599b1b8ededa296bd9f9 + parent = 4fa13e4132cf8adb2f07bb34927e62e525c8cc79 method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/tools/asm-processor/asm_processor.py b/tools/asm-processor/asm_processor.py index 0d62bc32a..317585291 100644 --- a/tools/asm-processor/asm_processor.py +++ b/tools/asm-processor/asm_processor.py @@ -2,7 +2,6 @@ import argparse import tempfile import struct -import copy import sys import re import os @@ -82,7 +81,14 @@ R_MIPS_HI16 = 5 R_MIPS_LO16 = 6 MIPS_DEBUG_ST_STATIC = 2 +MIPS_DEBUG_ST_PROC = 6 +MIPS_DEBUG_ST_BLOCK = 7 +MIPS_DEBUG_ST_END = 8 +MIPS_DEBUG_ST_FILE = 11 MIPS_DEBUG_ST_STATIC_PROC = 14 +MIPS_DEBUG_ST_STRUCT = 26 +MIPS_DEBUG_ST_UNION = 27 +MIPS_DEBUG_ST_ENUM = 28 class ElfFormat: @@ -605,11 +611,11 @@ class GlobalAsmBlock: line = re.sub(r'^[a-zA-Z0-9_]+:\s*', '', line) changed_section = False emitting_double = False - if line.startswith('glabel ') and self.cur_section == '.text': + if (line.startswith('glabel ') or line.startswith('jlabel ')) and self.cur_section == '.text': self.text_glabels.append(line.split()[1]) if not line: pass # empty line - elif line.startswith('glabel ') or line.startswith('dlabel ') or line.startswith('endlabel ') or (' ' not in line and line.endswith(':')): + elif line.startswith('glabel ') or line.startswith('dlabel ') or line.startswith('jlabel ') or line.startswith('endlabel ') or (' ' not in line and line.endswith(':')): pass # label elif line.startswith('.section') or line in ['.text', '.data', '.rdata', '.rodata', '.bss', '.late_rodata']: # section change @@ -651,19 +657,26 @@ class GlobalAsmBlock: emitting_double = True elif line.startswith('.space'): self.add_sized(int(line.split()[1], 0), real_line) - elif line.startswith('.balign') or line.startswith('.align'): + elif line.startswith('.balign'): align = int(line.split()[1]) if align != 4: self.fail("only .balign 4 is supported", real_line) self.align4() + elif line.startswith('.align'): + align = int(line.split()[1]) + if align != 2: + self.fail("only .align 2 is supported", real_line) + self.align4() elif line.startswith('.asci'): z = (line.startswith('.asciz') or line.startswith('.asciiz')) self.add_sized(self.count_quoted_size(line, z, real_line, output_enc), real_line) elif line.startswith('.byte'): self.add_sized(len(line.split(',')), real_line) - elif line.startswith('.half'): + elif line.startswith('.half') or line.startswith('.hword') or line.startswith(".short"): self.align2() self.add_sized(2*len(line.split(',')), real_line) + elif line.startswith('.size'): + pass elif line.startswith('.'): # .macro, ... self.fail("asm directive not supported", real_line) @@ -1268,6 +1281,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d # Add static symbols from .mdebug, so they can be referred to from GLOBAL_ASM if mdebug_section and convert_statics != "no": + static_name_count = {} strtab_index = len(objfile.symtab.strtab.data) new_strtab_data = [] ifd_max, cb_fd_offset = fmt.unpack('II', mdebug_section.data[18*4 : 20*4]) @@ -1276,20 +1290,28 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d for i in range(ifd_max): offset = cb_fd_offset + 18*4*i iss_base, _, isym_base, csym = fmt.unpack('IIII', objfile.data[offset + 2*4 : offset + 6*4]) + scope_level = 0 for j in range(csym): offset2 = cb_sym_offset + 12 * (isym_base + j) iss, value, st_sc_index = fmt.unpack('III', objfile.data[offset2 : offset2 + 12]) st = (st_sc_index >> 26) sc = (st_sc_index >> 21) & 0x1f - if st in [MIPS_DEBUG_ST_STATIC, MIPS_DEBUG_ST_STATIC_PROC]: + if st in (MIPS_DEBUG_ST_STATIC, MIPS_DEBUG_ST_STATIC_PROC): symbol_name_offset = cb_ss_offset + iss_base + iss symbol_name_offset_end = objfile.data.find(b'\0', symbol_name_offset) assert symbol_name_offset_end != -1 - symbol_name = objfile.data[symbol_name_offset : symbol_name_offset_end + 1] + symbol_name = objfile.data[symbol_name_offset : symbol_name_offset_end] + if scope_level > 1: + # For in-function statics, append an increasing counter to + # the name, to avoid duplicate conflicting symbols. + count = static_name_count.get(symbol_name, 0) + 1 + static_name_count[symbol_name] = count + symbol_name += b":" + str(count).encode("utf-8") emitted_symbol_name = symbol_name if convert_statics == "global-with-filename": # Change the emitted symbol name to include the filename, - # but don't let that affect deduplication logic. + # but don't let that affect deduplication logic (we still + # want to be able to reference statics from GLOBAL_ASM). emitted_symbol_name = objfile_name.encode("utf-8") + b":" + symbol_name section_name = {1: '.text', 2: '.data', 3: '.bss', 15: '.rodata'}[sc] section = objfile.find_section(section_name) @@ -1304,10 +1326,23 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d st_other=STV_DEFAULT, st_shndx=section.index, strtab=objfile.symtab.strtab, - name=symbol_name[:-1].decode('latin1')) - strtab_index += len(emitted_symbol_name) - new_strtab_data.append(emitted_symbol_name) + name=symbol_name.decode('latin1')) + strtab_index += len(emitted_symbol_name) + 1 + new_strtab_data.append(emitted_symbol_name + b'\0') new_syms.append(sym) + if st in ( + MIPS_DEBUG_ST_FILE, + MIPS_DEBUG_ST_STRUCT, + MIPS_DEBUG_ST_UNION, + MIPS_DEBUG_ST_ENUM, + MIPS_DEBUG_ST_BLOCK, + MIPS_DEBUG_ST_PROC, + MIPS_DEBUG_ST_STATIC_PROC, + ): + scope_level += 1 + if st == MIPS_DEBUG_ST_END: + scope_level -= 1 + assert scope_level == 0 objfile.symtab.strtab.data += b''.join(new_strtab_data) # Get rid of duplicate symbols, favoring ones that are not UNDEF. diff --git a/tools/asm-processor/mypy.ini b/tools/asm-processor/mypy.ini new file mode 100644 index 000000000..9a57d3c52 --- /dev/null +++ b/tools/asm-processor/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +files = asm_processor.py, build.py + diff --git a/tools/asm-processor/prelude.inc b/tools/asm-processor/prelude.inc index 3e58ff149..9bc893962 100644 --- a/tools/asm-processor/prelude.inc +++ b/tools/asm-processor/prelude.inc @@ -1,11 +1,21 @@ .set noat .set noreorder .set gp=64 + .macro glabel label .global \label \label: .endm +.macro dlabel label + .global \label + \label: +.endm + +.macro jlabel label + \label: +.endm + # Float register aliases (o32 ABI, odd ones are rarely used) diff --git a/tools/asm-processor/tests/static-global.c b/tools/asm-processor/tests/static-global.c index a7f616907..12b143462 100644 --- a/tools/asm-processor/tests/static-global.c +++ b/tools/asm-processor/tests/static-global.c @@ -25,9 +25,11 @@ nop ) static int xtext(int a, int b, int c) { + static int bss2; return 1; } void baz(void) { + { static int bss2; } xtext(bss2, rodata2[0], data2[0]); } diff --git a/tools/asm-processor/tests/static-global.objdump b/tools/asm-processor/tests/static-global.objdump index a519e4f48..c792e6a93 100644 --- a/tools/asm-processor/tests/static-global.objdump +++ b/tools/asm-processor/tests/static-global.objdump @@ -15,6 +15,8 @@ SYMBOL TABLE: 00000004 g O .data 00000000 data2 00000004 g O .bss 00000000 bss2 00000030 g F .text 00000000 xtext +00000008 g O .bss 00000000 bss2:1 +0000000c g O .bss 00000000 bss2:2 RELOCATION RECORDS FOR [.text]: diff --git a/tools/assist.py b/tools/assist.py index 7a05fde67..7381c85a7 100755 --- a/tools/assist.py +++ b/tools/assist.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 -import argparse, os, sys +import argparse +import os +import sys from collections import OrderedDict +gAddressWidth = 18 # if your ld >= 2.40 change this to 10 + script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = script_dir + "/../" asm_dir = root_dir + "asm/non_matchings/overlays" @@ -50,8 +54,8 @@ def parse_map(fname): if "noload" in line or "noload" in prev_line: ram_offset = None continue - ram = int(line[16 : 16 + 18], 0) - rom = int(line[59 : 59 + 18], 0) + ram = int(line[16 : 16 + gAddressWidth], 0) + rom = int(line[16 + gAddressWidth + 25 : 16 + gAddressWidth + 25 + gAddressWidth], 0) ram_offset = ram - rom continue prev_line = line @@ -63,7 +67,7 @@ def parse_map(fname): or " 0x" not in line ): continue - ram = int(line[16 : 16 + 18], 0) + ram = int(line[16 : 16 + gAddressWidth], 0) rom = ram - ram_offset fn = line.split()[-1] if "0x" in fn: diff --git a/tools/buildtools/.gitignore b/tools/buildtools/.gitignore index ecf2dd851..1119d9786 100644 --- a/tools/buildtools/.gitignore +++ b/tools/buildtools/.gitignore @@ -5,3 +5,4 @@ makeromfs mkldscript reloc_prereq yaz0 +makeyar diff --git a/tools/buildtools/Makefile b/tools/buildtools/Makefile index 6f34b5cfa..57c5d0542 100644 --- a/tools/buildtools/Makefile +++ b/tools/buildtools/Makefile @@ -1,6 +1,5 @@ -CC := gcc -CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 -PROGRAMS := elf2rom makeromfs mkldscript reloc_prereq yaz0 +CFLAGS := -Wall -Wextra -Wpedantic -std=c99 -g -Os +PROGRAMS := elf2rom makeromfs mkldscript reloc_prereq yaz0 makeyar ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0) CC := clang @@ -8,15 +7,6 @@ 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: @@ -27,6 +17,7 @@ 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 +makeyar_SOURCES := makeyar.c elf32.c yaz0.c util.c define COMPILE = $(1): $($1_SOURCES) diff --git a/tools/buildtools/elf32.c b/tools/buildtools/elf32.c index 7540406fb..64e6a9a1b 100644 --- a/tools/buildtools/elf32.c +++ b/tools/buildtools/elf32.c @@ -138,6 +138,7 @@ bool elf32_get_section(struct Elf32* e, struct Elf32_Section* sec, int secnum) { sec->flags = e->read32(sechdr + 0x08); sec->addr = e->read32(sechdr + 0x0C); sec->offset = e->read32(sechdr + 0x10); + sec->size = e->read32(sechdr + 0x14); sec->addralign = e->read32(sechdr + 0x20); sec->entsize = e->read32(sechdr + 0x24); return true; @@ -162,5 +163,8 @@ bool elf32_get_symbol(struct Elf32* e, struct Elf32_Symbol* sym, int symnum) { sym->name = strings + e->read32(symtab + symnum * 0x10); sym->value = e->read32(symtab + symnum * 0x10 + 4); + sym->size = e->read32(symtab + symnum * 0x10 + 8); + sym->st_type = symtab[symnum * 0x10 + 0xC] & 0xF; + sym->shndx = e->read16(symtab + symnum * 0x10 + 0xE); return true; } diff --git a/tools/buildtools/elf32.h b/tools/buildtools/elf32.h index 0dae635f2..f3de31358 100644 --- a/tools/buildtools/elf32.h +++ b/tools/buildtools/elf32.h @@ -3,6 +3,7 @@ #include #include +#include enum { ELF_MACHINE_NONE = 0, @@ -52,14 +53,31 @@ struct Elf32_Section { uint32_t type; uint32_t flags; uint32_t addr; + uint32_t size; uint32_t offset; uint32_t addralign; uint32_t entsize; }; +#define SHN_UNDEF 0 +#define SHN_ABS 0xFFF1 +#define SHN_COMMON 0xFFF2 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 +#define STT_NUM 7 + struct Elf32_Symbol { const char* name; uint32_t value; + uint32_t size; + uint8_t st_type; + uint16_t shndx; }; bool elf32_init(struct Elf32* e, const void* data, size_t size); diff --git a/tools/buildtools/makeyar.c b/tools/buildtools/makeyar.c new file mode 100644 index 000000000..6a241f6f5 --- /dev/null +++ b/tools/buildtools/makeyar.c @@ -0,0 +1,267 @@ +/* SPDX-FileCopyrightText: © 2023 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ + +/** + * Program to generate compressed yar (Yaz0 ARchive) files. + * + * The program expects an .o elf file and outputs a raw yar binary file and a + * "symbols" elf. + * + * A yar file consists of multiple Yaz0 files compressed individually. The + * archive begins with a header of non-fixed size, which describes the + * location of each individual Yaz0 block within the archive itself. This + * header is followed by each Yaz0 file. + * + * The first word (a 4 byte group) of the header indicates the size in bytes of + * the header itself (also describes the offset of the first Yaz0 block). The + * rest of the header consists of words describing the offsets of each Yaz0 + * block relative to the end of the header, because the first Yaz0 + * block is omitted from the offsets in the header. + * + * Each Yaz0 block is 0xFF-padded to a multiple of 0x10 in size. + * + * The entire archive is 0-padded to a multiple of 0x10 in size. + * + * The program works by compressing each .data symbol in the input elf file as + * its own Yaz0 compressed file, appending them in order for the generated + * archive. Other elf sections are ignored for the resulting yar file. + * + * The program also outputs an elf file that's identical to the elf input, + * but with its .data section zero'ed out completely. This "symbols" elf can be + * used for referencing each symbol as the whole file were completely + * uncompressed. + */ + + +#include +#include +#include +#include +#include +#include + +#include "elf32.h" +#include "yaz0.h" +#include "util.h" + + +typedef struct Bytearray { + uint8_t *bytes; + size_t size; +} Bytearray; + +typedef struct SymbolList { + struct Elf32_Symbol *symbols; + size_t size; // allocated size + size_t len; // elements in the list +} SymbolList; + +typedef struct DataSection { + Bytearray data; + uint32_t dataOffset; + SymbolList symbols; +} DataSection; + + +void Bytearray_Init(Bytearray *bytearr, const uint8_t *bytes, size_t size) { + bytearr->bytes = malloc(size); + if (bytearr->bytes == NULL) { + util_fatal_error("memory error"); + } + + memcpy(bytearr->bytes, bytes, size); + bytearr->size = size; +} + +void Bytearray_InitValue(Bytearray *bytearr, uint8_t val, size_t count) { + bytearr->bytes = malloc(count * sizeof(uint8_t)); + if (bytearr->bytes == NULL) { + util_fatal_error("memory error"); + } + + memset(bytearr->bytes, val, count); + bytearr->size = count; +} + +void Bytearray_ExtendValue(Bytearray *bytearr, uint8_t val, size_t count) { + size_t newSize = bytearr->size + count; + + bytearr->bytes = realloc(bytearr->bytes, newSize); + if (bytearr->bytes == NULL) { + util_fatal_error("memory error"); + } + + memset(&bytearr->bytes[bytearr->size], val, count); + bytearr->size = newSize; +} + +void Bytearray_Extend(Bytearray *bytearr, const uint8_t *bytes, size_t size) { + size_t newSize = bytearr->size + size; + + bytearr->bytes = realloc(bytearr->bytes, newSize); + if (bytearr->bytes == NULL) { + util_fatal_error("memory error"); + } + + memcpy(&bytearr->bytes[bytearr->size], bytes, size); + bytearr->size = newSize; +} + +void Bytearray_Destroy(Bytearray *bytearr) { + free(bytearr->bytes); +} + +void SymbolList_Init(SymbolList *list, size_t initialAmount) { + list->symbols = malloc(initialAmount * sizeof(struct Elf32_Symbol)); + if (list->symbols == NULL) { + util_fatal_error("memory error"); + } + list->size = initialAmount; + list->len = 0; +} + +void SymbolList_Destroy(SymbolList *list) { + free(list->symbols); +} + +void DataSection_FromElf(DataSection *dst, const Bytearray *elfBytes){ + struct Elf32 elf; + size_t i; + int symIndex; + size_t dataShndx = 0; + + if (!elf32_init(&elf, elfBytes->bytes, elfBytes->size) || (elf.machine != ELF_MACHINE_MIPS)) { + util_fatal_error("not a valid 32-bit MIPS ELF file"); + } + + for (i = 0; i < elf.shnum; i++) { + struct Elf32_Section sec; + + if (!elf32_get_section(&elf, &sec, i)) { + util_fatal_error("invalid or corrupt ELF file"); + } + + if (strcmp(sec.name, ".data") == 0) { + dst->dataOffset = sec.offset; + Bytearray_Init(&dst->data, &elfBytes->bytes[sec.offset], sec.size); + dataShndx = i; + break; + } + } + + SymbolList_Init(&dst->symbols, elf.numsymbols); + for (symIndex = 0; symIndex < elf.numsymbols; symIndex++) { + struct Elf32_Symbol sym; + + if (!elf32_get_symbol(&elf, &sym, symIndex)) { + util_fatal_error("invalid or corrupt ELF file"); + } + + if (sym.shndx != dataShndx) { + continue; + } + if (sym.st_type != STT_OBJECT) { + continue; + } + + dst->symbols.symbols[dst->symbols.len++] = sym; + } +} + +void DataSection_Destroy(DataSection *dataSect) { + Bytearray_Destroy(&dataSect->data); + SymbolList_Destroy(&dataSect->symbols); +} + +#define ALIGN16(val) (((val) + 0xF) & ~0xF) + +void createArchive(Bytearray *archive, const DataSection *dataSect) { + uint32_t firstEntryOffset = (dataSect->symbols.len + 1) * sizeof(uint32_t); + size_t i; + size_t offset; + + // Fill with zeroes until the compressed data start + Bytearray_InitValue(archive, 0, firstEntryOffset); + + util_write_uint32_be(&archive->bytes[0], firstEntryOffset); + + offset = firstEntryOffset; + for (i = 0; i < dataSect->symbols.len; i++) { + const struct Elf32_Symbol *sym = &dataSect->symbols.symbols[i]; + size_t uncompressedSize = sym->size; + uint8_t *output = malloc(uncompressedSize * sizeof(uint8_t)); // assume compressed shouldn't be bigger than uncompressed + size_t compressedSize; + + output[0] = 'Y'; + output[1] = 'a'; + output[2] = 'z'; + output[3] = '0'; + util_write_uint32_be(&output[4], uncompressedSize); + memset(&output[8], 0, 8); + compressedSize = 0x10; + + assert(sym->value + uncompressedSize <= dataSect->data.size); + compressedSize += yaz0_encode(&dataSect->data.bytes[sym->value], &output[0x10], uncompressedSize); + + // Pad to 0x10 + while (compressedSize % 0x10 != 0) { + output[compressedSize++] = 0xFF; + } + + Bytearray_Extend(archive, output, compressedSize); + + if (i > 0) { + util_write_uint32_be(&archive->bytes[i * sizeof(uint32_t)], offset - firstEntryOffset); + } + + offset += compressedSize; + free(output); + } + + util_write_uint32_be(&archive->bytes[i * sizeof(uint32_t)], offset - firstEntryOffset); + + if (archive->size % 16 != 0) { + size_t extraPad = ALIGN16(archive->size) - archive->size; + + Bytearray_ExtendValue(archive, 0, extraPad); + } +} + + +int main(int argc, char *argv[]) { + const char *inPath; + const char *binPath; + const char *symPath; + Bytearray elfBytes; + DataSection dataSect; + Bytearray archive; + + if (argc != 4) { + fprintf(stderr, "%s in_file out_bin out_sym\n", argv[0]); + exit(1); + } + + inPath = argv[1]; + binPath = argv[2]; + symPath = argv[3]; + + elfBytes.bytes = util_read_whole_file(inPath, &elfBytes.size); + + DataSection_FromElf(&dataSect, &elfBytes); + + createArchive(&archive, &dataSect); + + // Write the compressed archive file as a raw binary + util_write_whole_file(binPath, archive.bytes, archive.size); + + // Zero out data + memset(&elfBytes.bytes[dataSect.dataOffset], 0, dataSect.data.size); + + util_write_whole_file(symPath, elfBytes.bytes, elfBytes.size); + + Bytearray_Destroy(&archive); + DataSection_Destroy(&dataSect); + Bytearray_Destroy(&elfBytes); + + return 0; +} diff --git a/tools/buildtools/yaz0.h b/tools/buildtools/yaz0.h index 97656aac5..50ac586bb 100644 --- a/tools/buildtools/yaz0.h +++ b/tools/buildtools/yaz0.h @@ -1,8 +1,6 @@ #ifndef YAZ0_H #define YAZ0_H -int yaz0_encode2(uint8_t* src, uint8_t* dest, int uncompressedSize); - void yaz0_decode(uint8_t* src, uint8_t* dst, int uncompressedSize); int yaz0_encode(uint8_t* src, uint8_t* dest, int srcSize); diff --git a/tools/decompress_yars.py b/tools/decompress_yars.py new file mode 100755 index 000000000..404a50c56 --- /dev/null +++ b/tools/decompress_yars.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: © 2023 ZeldaRET +# SPDX-License-Identifier: MIT + +# yar (Yaz0 ARchive) decompressor +# +# This program decompresses every raw yar binary file listed in +# `tools/filelists/{version}/archives.csv` to a corresponding +# `baserom/{file}.unarchive` raw file. +# +# It works by decompressing every Yaz0 block and appending them one by one into +# a new raw binary file so it can be processed normally by other tools. + + +from __future__ import annotations + +import argparse +import dataclasses +import libyaz0 +from pathlib import Path +import struct + + +PRINT_XML = False + +@dataclasses.dataclass +class ArchiveMeta: + start: int + end: int + + +def readFileAsBytearray(filepath: Path) -> bytearray: + with filepath.open(mode="rb") as f: + return bytearray(f.read()) + + +def readBytesAsWord(array_of_bytes: bytearray, offset: int) -> int: + return struct.unpack_from(f">I", array_of_bytes, offset)[0] + + +def getOffsetsList(archiveBytes: bytearray) -> list[ArchiveMeta]: + archivesOffsets: list[ArchiveMeta] = [] + + firstEntryOffset = readBytesAsWord(archiveBytes, 0) + firstEntrySize = readBytesAsWord(archiveBytes, 4) + + archivesOffsets.append(ArchiveMeta(firstEntryOffset, firstEntryOffset + firstEntrySize)) + + offset = 4 + while offset < firstEntryOffset - 4: + entry = readBytesAsWord(archiveBytes, offset) + nextEntry = readBytesAsWord(archiveBytes, offset + 4) + entryStart = entry + firstEntryOffset + entryEnd = nextEntry + firstEntryOffset + archivesOffsets.append(ArchiveMeta(entryStart, entryEnd)) + + offset += 4 + + return archivesOffsets + + +def extractArchive(archivePath: Path, outPath: Path): + archiveBytes = readFileAsBytearray(archivePath) + + if readBytesAsWord(archiveBytes, 0) == 0: + # Empty file, ignore it + return + + print(f"Extracting '{archivePath}' -> '{outPath}'") + archivesOffsets = getOffsetsList(archiveBytes) + + if PRINT_XML: + print('') + print(f' ') + + with outPath.open("wb") as out: + currentOffset = 0 + for meta in archivesOffsets: + decompressedBytes = libyaz0.decompress(archiveBytes[meta.start:meta.end]) + decompressedSize = len(decompressedBytes) + out.write(decompressedBytes) + + if PRINT_XML: + print(f' ') + + currentOffset += decompressedSize + + if PRINT_XML: + print(f' ') + print('') + + +def main(): + parser = argparse.ArgumentParser(description="MM archives extractor") + parser.add_argument("-v", "--version", help="version to process", default="mm.us.rev1") + parser.add_argument("--xml", help="Generate xml to stdout", action="store_true") + + args = parser.parse_args() + + global PRINT_XML + PRINT_XML = args.xml + + archivesCsvPath = Path(f"tools/filelists/{args.version}/archives.csv") + + with archivesCsvPath.open() as f: + for line in f: + archiveName = line.strip().split(",")[1] + archivePath = Path(f"baserom/{archiveName}") + + extractedPath = Path(str(archivePath) + ".unarchive") + extractArchive(archivePath, extractedPath) + +if __name__ == "__main__": + main() diff --git a/tools/disasm/dma_filenames.txt b/tools/disasm/dma_filenames.txt index aaa17ab6d..798a8b366 100644 --- a/tools/disasm/dma_filenames.txt +++ b/tools/disasm/dma_filenames.txt @@ -7,8 +7,8 @@ 'Audiotable', 'kanji', 'link_animetion', - 'icon_item_static_old', - 'icon_item_24_static_old', + 'icon_item_static_syms', + 'icon_item_24_static_syms', 'icon_item_field_static', 'icon_item_dungeon_static', 'icon_item_gameover_static', @@ -18,10 +18,10 @@ 'map_grand_static', 'item_name_static', 'map_name_static', - 'icon_item_static_test', - 'icon_item_24_static_test', - 'schedule_dma_static_old', - 'schedule_dma_static_test', + 'icon_item_static_yar', + 'icon_item_24_static_yar', + 'schedule_dma_static_syms', + 'schedule_dma_static_yar', 'schedule_static', 'story_static', 'do_action_static', diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index df205189f..56d6477ca 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -49,17 +49,17 @@ 0x80081920 : "syncprintf", 0x80081980 : "fault", 0x80083EB0 : "fault_drawer", - 0x80084940 : "boot_80084940", + 0x80084940 : "rcp_utils", 0x800849A0 : "loadfragment", 0x80084DB0 : "loadfragment2", 0x80085130 : "padutils", 0x80085320 : "stackcheck", 0x80085570 : "gfxprint", 0x80086110 : "mtxuty-cvt", - 0x80086280 : "assert", + 0x80086280 : "debug", 0x800862E0 : "system_heap", 0x80086620 : "padsetup", - 0x80086760 : "boot_80086760", + 0x80086760 : "math64", 0x80086C70 : "fp", 0x80086DD0 : "system_malloc", 0x80086FA0 : "rand", @@ -296,8 +296,8 @@ 0x800982B0 : "fault", 0x80098C50 : "fault_drawer", 0x80099090 : "gfxprint", - 0x800990B0 : "assert", - 0x800990C0 : "boot_80086760", + 0x800990B0 : "debug", + 0x800990C0 : "math64", 0x80099110 : "__osMalloc", 0x800991A0 : "setintmask", 0x80099220 : "sinf", @@ -320,7 +320,7 @@ 0x8009BE30 : "CIC6105", 0x8009BE50 : "fault", 0x8009CCD0 : "fault_drawer", - 0x8009CD10 : "boot_80086760", + 0x8009CD10 : "math64", 0x8009CD20 : "system_malloc", 0x8009CD50 : "rand", 0x8009CD60 : "__osMalloc", @@ -428,7 +428,7 @@ 0x8013EC10 : "z_rumble", 0x8013EE60 : "z_view", 0x80140260 : "z_vimode", - 0x80140CE0 : "code_80140CE0", + 0x80140CE0 : "z_viscvg", 0x80140E80 : "code_80140E80", 0x801418B0 : "z_vismono", 0x801420C0 : "z_viszbuf", @@ -561,11 +561,12 @@ 0x801C5CB0 : "z_skelanime", 0x801C5CD0 : "z_skin_matrix", 0x801C5D10 : "z_sub_s", - 0x801C5DD0 : "code_80140CE0", + 0x801C5DD0 : "z_viscvg", 0x801C5E30 : "z_vr_box", 0x801C5FC0 : "z_sram_NES", 0x801C6A70 : "z_message", 0x801D0470 : "z_message_nes", + 0x801D0910 : "z_message_staff", 0x801D0B50 : "z_player_call", 0x801D0B70 : "z_kaleido_manager", 0x801D0BB0 : "", @@ -691,7 +692,7 @@ 0x801E3F40 : "njpgdspMain", # .bss section - 0x801E3FA0 : "code_801E3FA0", + 0x801E3FA0 : "z_en_item00", 0x801E3FB0 : "z_effect", 0x801ED890 : "flg_set", 0x801ED8A0 : "z_actor", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 89e1c153b..f5b07f8fe 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2,11 +2,11 @@ { 0x80080000:("entrypoint",), 0x80080060:("bootproc",), - 0x80080150:("Idle_ClearMemory",), - 0x80080180:("Idle_InitFramebuffer",), - 0x8008019C:("Idle_InitScreen",), - 0x800801EC:("Idle_InitMemory",), - 0x80080250:("Idle_InitCodeAndMemory",), + 0x80080150:("Main_ClearMemory",), + 0x80080180:("Main_InitFramebuffer",), + 0x8008019C:("Main_InitScreen",), + 0x800801EC:("Main_InitMemory",), + 0x80080250:("Main_Init",), 0x80080300:("Main_ThreadEntry",), 0x8008038C:("Idle_InitVideo",), 0x80080514:("Idle_ThreadEntry",), @@ -40,13 +40,13 @@ 0x800815CC:("IrqMgr_HandleRetrace",), 0x80081684:("IrqMgr_ThreadEntry",), 0x80081754:("IrqMgr_Init",), - 0x80081820:("CIC6105_Nop80081820",), - 0x80081828:("CIC6105_Nop80081828",), + 0x80081820:("CIC6105_Noop1",), + 0x80081828:("CIC6105_Noop2",), 0x80081830:("CIC6105_PrintRomInfo",), 0x8008189C:("CIC6105_AddRomInfoFaultPage",), - 0x800818D0:("CIC6105_RemoveRomInfoFaultPage",), - 0x800818F4:("func_800818F4",), - 0x80081920:("__osSyncVPrintf",), + 0x800818D0:("CIC6105_Destroy",), + 0x800818F4:("CIC6105_Init",), + 0x80081920:("osSyncPrintfUnused",), 0x8008193C:("osSyncPrintf",), 0x80081958:("rmonPrintf",), 0x80081980:("Fault_SleepImpl",), @@ -65,27 +65,27 @@ 0x8008212C:("Fault_FillScreenRed",), 0x80082180:("Fault_DrawCornerRec",), 0x800821D4:("Fault_PrintFReg",), - 0x80082280:("osSyncPrintfFReg",), + 0x80082280:("Fault_LogFReg",), 0x80082330:("Fault_PrintFPCR",), - 0x800823D4:("osSyncPrintfFPCR",), + 0x800823D4:("Fault_LogFPCSR",), 0x8008246C:("Fault_PrintThreadContext",), 0x800827BC:("osSyncPrintfThreadContext",), 0x80082AB8:("Fault_FindFaultedThread",), 0x80082B40:("Fault_Wait5Seconds",), 0x80082BD0:("Fault_WaitForButtonCombo",), - 0x80082C6C:("Fault_DrawMemDumpPage",), + 0x80082C6C:("Fault_DrawMemDumpContents",), 0x80082DD8:("Fault_DrawMemDump",), - 0x80082FD0:("Fault_FindNextStackCall",), + 0x80082FD0:("Fault_WalkStack",), 0x80083144:("Fault_DrawStackTrace",), - 0x800832D4:("osSyncPrintfStackTrace",), + 0x800832D4:("Fault_LogStackTrace",), 0x80083450:("Fault_ResumeThread",), - 0x800834CC:("Fault_CommitFB",), + 0x800834CC:("Fault_DisplayFrameBuffer",), 0x8008358C:("Fault_ProcessClients",), 0x80083670:("Fault_SetOptionsFromController3",), - 0x800837E4:("Fault_SetOptions",), + 0x800837E4:("Fault_UpdatePad",), 0x80083828:("Fault_ThreadEntry",), - 0x80083B70:("Fault_SetFB",), - 0x80083BC4:("Fault_Start",), + 0x80083B70:("Fault_SetFrameBuffer",), + 0x80083BC4:("Fault_Init",), 0x80083CF8:("Fault_HangupFaultClient",), 0x80083DF4:("Fault_AddHungupAndCrashImpl",), 0x80083E4C:("Fault_AddHungupAndCrash",), @@ -104,17 +104,17 @@ 0x8008477C:("FaultDrawer_VPrintf",), 0x800847CC:("FaultDrawer_Printf",), 0x8008481C:("FaultDrawer_DrawText",), - 0x8008486C:("FaultDrawer_SetDrawerFB",), + 0x8008486C:("FaultDrawer_SetDrawerFrameBuffer",), 0x800848A4:("FaultDrawer_SetInputCallback",), 0x800848B8:("FaultDrawer_Init",), - 0x80084940:("func_80084940",), - 0x80084968:("func_80084968",), - 0x800849A0:("Load_Relocate",), - 0x80084C0C:("Load_LoadOverlay",), - 0x80084CD0:("Load_AllocateAndLoad",), - 0x80084DB0:("Load2_Relocate",), - 0x8008501C:("Load2_LoadOverlay",), - 0x800850C8:("Load2_AllocateAndLoad",), + 0x80084940:("RcpUtils_PrintRegisterStatus",), + 0x80084968:("RcpUtils_Reset",), + 0x800849A0:("Fragment_Relocate",), + 0x80084C0C:("Fragment_Load",), + 0x80084CD0:("Fragment_AllocateAndLoad",), + 0x80084DB0:("Overlay_Relocate",), + 0x8008501C:("Overlay_Load",), + 0x800850C8:("Overlay_AllocateAndLoad",), 0x80085130:("PadUtils_Init",), 0x80085150:("func_80085150",), 0x80085158:("PadUtils_ResetPressRel",), @@ -155,8 +155,8 @@ 0x800860D8:("GfxPrint_Printf",), 0x80086110:("MtxConv_F2L",), 0x80086258:("MtxConv_L2F",), - 0x80086280:("__assert",), - 0x800862B4:("func_800862B4",), + 0x80086280:("_dbg_hungup",), + 0x800862B4:("Reset",), 0x800862E0:("SystemHeap_Malloc",), 0x80086310:("SystemHeap_Free",), 0x8008633C:("SystemHeap_RunBlockFunc",), @@ -299,7 +299,7 @@ 0x8008A5D0:("__osSetSR",), 0x8008A5E0:("osWritebackDCache",), 0x8008A660:("__createSpeedParam",), - 0x8008A6FC:("osInitialize",), + 0x8008A6FC:("__osInitialize_common",), 0x8008A9A8:("__osInitialize_autodetect",), 0x8008AA10:("osViGetNextFramebuffer",), 0x8008AA50:("guPerspectiveF",), @@ -669,12 +669,12 @@ 0x800B4AEC:("func_800B4AEC",), 0x800B4B50:("func_800B4B50",), 0x800B4EDC:("Actor_GetProjectedPos",), - 0x800B4F40:("Target_SetPos",), - 0x800B4F78:("func_800B4F78",), - 0x800B5040:("Target_SetColors",), - 0x800B51A4:("Actor_TargetContextInit",), - 0x800B5208:("Actor_DrawZTarget",), - 0x800B5814:("func_800B5814",), + 0x800B4F40:("Target_SetLockOnPos",), + 0x800B4F78:("Target_InitLockOn",), + 0x800B5040:("Target_SetFairyState",), + 0x800B51A4:("Target_Init",), + 0x800B5208:("Target_Draw",), + 0x800B5814:("Target_Update",), 0x800B5BB0:("Flags_GetSwitch",), 0x800B5BF4:("Flags_SetSwitch",), 0x800B5C34:("Flags_UnsetSwitch",), @@ -700,9 +700,9 @@ 0x800B6474:("Actor_UpdatePlayerImpact",), 0x800B648C:("Actor_SetPlayerImpact",), 0x800B64FC:("Actor_GetPlayerImpact",), - 0x800B6584:("func_800B6584",), - 0x800B6608:("func_800B6608",), - 0x800B6680:("func_800B6680",), + 0x800B6584:("Actor_AddSharedMemoryEntry",), + 0x800B6608:("Actor_FreeSharedMemoryEntry",), + 0x800B6680:("Actor_FindSharedMemoryEntry",), 0x800B670C:("Actor_Kill",), 0x800B672C:("Actor_SetWorldToHome",), 0x800B675C:("Actor_SetFocus",), @@ -766,14 +766,14 @@ 0x800B81E0:("Actor_GetFocus",), 0x800B8214:("Actor_GetWorld",), 0x800B8248:("Actor_GetWorldPosShapeRot",), - 0x800B82EC:("func_800B82EC",), - 0x800B83BC:("func_800B83BC",), - 0x800B83F8:("func_800B83F8",), + 0x800B82EC:("Target_GetAdjustedDistSq",), + 0x800B83BC:("Target_IsActorInRange",), + 0x800B83F8:("Target_OutsideLeashRange",), 0x800B84D0:("Actor_ProcessTalkRequest",), - 0x800B8500:("func_800B8500",), - 0x800B85E0:("func_800B85E0",), - 0x800B8614:("func_800B8614",), - 0x800B863C:("func_800B863C",), + 0x800B8500:("Actor_OfferTalkExchange",), + 0x800B85E0:("Actor_OfferTalkExchangeEquiCylinder",), + 0x800B8614:("Actor_OfferTalk",), + 0x800B863C:("Actor_OfferTalkNearColChkInfoCylinder",), 0x800B867C:("Actor_TextboxIsClosing",), 0x800B86C8:("Actor_ChangeFocus",), 0x800B8708:("Player_GetExchangeItemId",), @@ -802,14 +802,14 @@ 0x800B8E1C:("func_800B8E1C",), 0x800B8E58:("Player_PlaySfx",), 0x800B8EC8:("Actor_PlaySfx",), - 0x800B8EF4:("func_800B8EF4",), - 0x800B8F98:("func_800B8F98",), - 0x800B8FC0:("func_800B8FC0",), - 0x800B8FE8:("func_800B8FE8",), - 0x800B9010:("func_800B9010",), - 0x800B9038:("func_800B9038",), - 0x800B9084:("func_800B9084",), - 0x800B9098:("func_800B9098",), + 0x800B8EF4:("Actor_PlaySfx_SurfaceBomb",), + 0x800B8F98:("Actor_PlaySfx_FlaggedCentered1",), + 0x800B8FC0:("Actor_PlaySfx_FlaggedCentered2",), + 0x800B8FE8:("Actor_PlaySfx_FlaggedCentered3",), + 0x800B9010:("Actor_PlaySfx_Flagged",), + 0x800B9038:("Actor_PlaySfx_FlaggedTimer",), + 0x800B9084:("Actor_PlaySeq_FlaggedKamaroDance",), + 0x800B9098:("Actor_PlaySeq_FlaggedMusicBoxHouse",), 0x800B90AC:("func_800B90AC",), 0x800B90F4:("Actor_DeactivateLens",), 0x800B9120:("Actor_InitHalfDaysBit",), @@ -818,7 +818,7 @@ 0x800B948C:("Actor_UpdateActor",), 0x800B9780:("Actor_UpdateAll",), 0x800B9A04:("Actor_Draw",), - 0x800B9D1C:("func_800B9D1C",), + 0x800B9D1C:("Actor_UpdateFlaggedAudio",), 0x800B9E3C:("Actor_ResetLensActors",), 0x800B9E4C:("Actor_AddToLensActors",), 0x800B9E84:("Actor_DrawLensOverlay",), @@ -840,9 +840,9 @@ 0x800BB140:("Actor_SpawnTransitionActors",), 0x800BB2D0:("Actor_SpawnEntry",), 0x800BB498:("Actor_Delete",), - 0x800BB59C:("func_800BB59C",), - 0x800BB604:("func_800BB604",), - 0x800BB8EC:("func_800BB8EC",), + 0x800BB59C:("Target_InTargetableScreenRegion",), + 0x800BB604:("Target_FindTargetableActorForCategory",), + 0x800BB8EC:("Target_GetTargetActor",), 0x800BBA88:("Enemy_StartFinishingBlow",), 0x800BBAC0:("func_800BBAC0",), 0x800BBB74:("func_800BBB74",), @@ -878,7 +878,7 @@ 0x800BDAA0:("func_800BDAA0",), 0x800BDB6C:("func_800BDB6C",), 0x800BDC5C:("Actor_ChangeAnimationByInfo",), - 0x800BDCF4:("func_800BDCF4",), + 0x800BDCF4:("Actor_UpdateFidgetTables",), 0x800BDFB0:("Actor_Noop",), 0x800BDFC0:("Gfx_DrawDListOpa",), 0x800BE03C:("Gfx_DrawDListXlu",), @@ -1706,86 +1706,86 @@ 0x800F4F54:("Font_LoadCharNES",), 0x800F4FC0:("Font_LoadMessageBoxEndIcon",), 0x800F5004:("Font_LoadOrderedFont",), - 0x800F5090:("func_800F5090",), + 0x800F5090:("Environment_GraphCallback",), 0x800F50D4:("Environment_ZBufValToFixedPoint",), 0x800F510C:("Environment_Init",), - 0x800F5954:("func_800F5954",), + 0x800F5954:("Environment_SmoothStepToU8",), 0x800F5A8C:("Environment_LerpWeight",), - 0x800F5B10:("func_800F5B10",), + 0x800F5B10:("Environment_LerpWeightAccelDecel",), 0x800F5CD0:("Environment_UpdateSkybox",), - 0x800F6834:("func_800F6834",), - 0x800F694C:("func_800F694C",), - 0x800F6A04:("func_800F6A04",), - 0x800F6A40:("func_800F6A40",), - 0x800F6AB8:("func_800F6AB8",), - 0x800F6B44:("func_800F6B44",), + 0x800F6834:("Environment_EnableUnderwaterLights",), + 0x800F694C:("Environment_DisableUnderwaterLights",), + 0x800F6A04:("Environment_WipeRumbleRequests",), + 0x800F6A40:("Environment_UpdateSkyboxRotY",), + 0x800F6AB8:("Environment_UpdateNextDayTime",), + 0x800F6B44:("Environment_UpdateTime",), 0x800F6CEC:("func_800F6CEC",), 0x800F6EA4:("func_800F6EA4",), - 0x800F6FCC:("Kankyo_IsSceneUpsideDown",), - 0x800F6FF8:("func_800F6FF8",), - 0x800F8554:("func_800F8554",), + 0x800F6FCC:("Environment_IsSceneUpsideDown",), + 0x800F6FF8:("Environment_UpdateLights",), + 0x800F8554:("Environment_UpdateSun",), 0x800F88C4:("func_800F88C4",), 0x800F8970:("func_800F8970",), - 0x800F8A9C:("func_800F8A9C",), + 0x800F8A9C:("Environment_UpdatePostmanEvents",), 0x800F8CD4:("Environment_Update",), - 0x800F8D84:("func_800F8D84",), + 0x800F8D84:("Environment_DrawSun",), 0x800F9728:("Environment_DrawSunLensFlare",), - 0x800F9824:("func_800F9824",), - 0x800FA39C:("func_800FA39C",), - 0x800FA3C4:("func_800FA3C4",), + 0x800F9824:("Environment_DrawLensFlare",), + 0x800FA39C:("Environment_RandCentered",), + 0x800FA3C4:("Environment_DrawRainImpl",), 0x800FA9FC:("Environment_DrawRain",), - 0x800FAAB4:("func_800FAAB4",), - 0x800FAC20:("func_800FAC20",), - 0x800FAF74:("func_800FAF74",), - 0x800FB010:("func_800FB010",), + 0x800FAAB4:("Environment_ChangeLightSetting",), + 0x800FAC20:("Environment_DrawSkyboxFilters",), + 0x800FAF74:("Environment_DrawLightningFlash",), + 0x800FB010:("Environment_UpdateLightningStrike",), 0x800FB320:("Environment_AddLightningBolts",), - 0x800FB388:("func_800FB388",), - 0x800FB758:("func_800FB758",), - 0x800FB9B4:("func_800FB9B4",), + 0x800FB388:("Environment_DrawLightning",), + 0x800FB758:("Environment_PlaySceneSequence",), + 0x800FB9B4:("Environment_UpdateTimeBasedSequence",), 0x800FBCBC:("Environment_DrawCustomLensFlare",), - 0x800FBDEC:("Kankyo_InitGameOverLights",), - 0x800FBF3C:("Kankyo_FadeInGameOverLights",), - 0x800FC158:("Kankyo_FadeOutGameOverLights",), - 0x800FC3DC:("func_800FC3DC",), + 0x800FBDEC:("Environment_InitGameOverLights",), + 0x800FBF3C:("Environment_FadeInGameOverLights",), + 0x800FC158:("Environment_FadeOutGameOverLights",), + 0x800FC3DC:("Environment_UpdateRain",), 0x800FC444:("Environment_FillScreen",), 0x800FC64C:("Environment_DrawSandstorm",), - 0x800FD2B4:("func_800FD2B4",), - 0x800FD538:("func_800FD538",), - 0x800FD59C:("func_800FD59C",), - 0x800FD5E0:("func_800FD5E0",), - 0x800FD654:("func_800FD654",), - 0x800FD698:("func_800FD698",), - 0x800FD720:("get_days_elapsed",), - 0x800FD730:("reset_days_elapsed",), - 0x800FD740:("get_current_day",), - 0x800FD750:("func_800FD750",), - 0x800FD768:("func_800FD768",), - 0x800FD78C:("func_800FD78C",), - 0x800FD858:("func_800FD858",), - 0x800FD928:("func_800FD928",), - 0x800FD980:("func_800FD980",), - 0x800FDAF8:("func_800FDAF8",), - 0x800FDC94:("func_800FDC94",), - 0x800FE390:("func_800FE390",), - 0x800FE3E0:("func_800FE3E0",), + 0x800FD2B4:("Environment_AdjustLights",), + 0x800FD538:("Environment_LerpRGB8",), + 0x800FD59C:("Environment_LerpAmbientColor",), + 0x800FD5E0:("Environment_LerpDiffuseColor",), + 0x800FD654:("Environment_LerpFogColor",), + 0x800FD698:("Environment_LerpFog",), + 0x800FD720:("Environment_GetEventDayCount",), + 0x800FD730:("Environment_ClearEventDayCount",), + 0x800FD740:("Environment_GetTotalDays",), + 0x800FD750:("Environment_ForcePlaySequence",), + 0x800FD768:("Environment_IsForcedSequenceDisabled",), + 0x800FD78C:("Environment_PlayStormNatureAmbience",), + 0x800FD858:("Environment_StopStormNatureAmbience",), + 0x800FD928:("Environment_WarpSongLeave",), + 0x800FD980:("Environment_SetupSkyboxStars",), + 0x800FDAF8:("Environment_DrawSkyboxStar",), + 0x800FDC94:("Environment_DrawSkyboxStarsImpl",), + 0x800FE390:("Environment_Draw",), + 0x800FE3E0:("Environment_DrawSkyboxStars",), 0x800FE484:("Environment_StopTime",), 0x800FE498:("Environment_StartTime",), 0x800FE4A8:("Environment_IsTimeStopped",), - 0x800FE4B8:("func_800FE4B8",), - 0x800FE590:("func_800FE590",), + 0x800FE4B8:("Environment_GetStormState",), + 0x800FE590:("Environment_IsFinalHours",), 0x800FE5D0:("func_800FE5D0",), 0x800FE610:("func_800FE610",), - 0x800FE620:("func_800FE620",), - 0x800FE658:("func_800FE658",), + 0x800FE620:("Environment_GetTimeSpeed",), + 0x800FE658:("Environment_SetTimeJump",), 0x800FE6F8:("func_800FE6F8",), - 0x800FE778:("func_800FE778",), - 0x800FE788:("func_800FE788",), - 0x800FE798:("func_800FE798",), - 0x800FE7A8:("func_800FE7A8",), + 0x800FE778:("Environment_GetSandstormColorIndex",), + 0x800FE788:("Environment_GetNextSandstormColorIndex",), + 0x800FE798:("Environment_GetSandstormLerpScale",), + 0x800FE7A8:("Environment_LerpSandstormColors",), 0x800FE9B4:("func_800FE9B4",), 0x800FEA50:("func_800FEA50",), 0x800FEAB0:("func_800FEAB0",), - 0x800FEAC0:("func_800FEAC0",), + 0x800FEAC0:("Environment_JumpForwardInTime",), 0x800FEAF4:("func_800FEAF4",), 0x800FEC90:("Lib_MemCpy",), 0x800FECC0:("Lib_MemSet",), @@ -1803,7 +1803,7 @@ 0x800FF1FC:("Math_AsymStepToS",), 0x800FF2A8:("Math_StepUntilF",), 0x800FF2F8:("Math_AsymStepToF",), - 0x800FF3A0:("func_800FF3A0",), + 0x800FF3A0:("Lib_GetControlStickData",), 0x800FF450:("Rand_S16Offset",), 0x800FF4A4:("Rand_S16OffsetStride",), 0x800FF50C:("Math_Vec3f_Copy",), @@ -1845,11 +1845,11 @@ 0x800FFEBC:("Math_SmoothStepToS",), 0x800FFFD8:("Math_ApproachS",), 0x8010007C:("Color_RGBA8_Copy",), - 0x801000A4:("func_801000A4",), - 0x801000CC:("func_801000CC",), - 0x801000F4:("Lib_PlaySfxAtPos",), + 0x801000A4:("Lib_PlaySfx",), + 0x801000CC:("Lib_PlaySfx_2",), + 0x801000F4:("Lib_PlaySfx_AtPos",), 0x8010011C:("Lib_Vec3f_TranslateAndRotateY",), - 0x801001B8:("Lib_LerpRGB",), + 0x801001B8:("Color_RGB8_Lerp",), 0x80100448:("Math_Vec3f_StepTo",), 0x801004FC:("Lib_Nop801004FC",), 0x80100504:("Lib_SegmentedToVirtual",), @@ -2199,7 +2199,7 @@ 0x801234D4:("func_801234D4",), 0x80123590:("func_80123590",), 0x801235DC:("func_801235DC",), - 0x8012364C:("func_8012364C",), + 0x8012364C:("Player_GetItemOnButton",), 0x80123810:("func_80123810",), 0x80123960:("Player_ActionToModelGroup",), 0x801239AC:("Player_SetModelsForHoldingShield",), @@ -2208,7 +2208,7 @@ 0x80123C58:("func_80123C58",), 0x80123C90:("Player_SetEquipmentData",), 0x80123D50:("Player_UpdateBottleHeld",), - 0x80123DA4:("func_80123DA4",), + 0x80123DA4:("Player_Untarget",), 0x80123DC0:("func_80123DC0",), 0x80123E90:("func_80123E90",), 0x80123F14:("func_80123F14",), @@ -2415,10 +2415,10 @@ 0x8012F1BC:("Inventory_IncrementSkullTokenCount",), 0x8012F22C:("Inventory_GetSkullTokenCount",), 0x8012F278:("Inventory_SaveLotteryCodeGuess",), - 0x8012F2E0:("Object_Spawn",), - 0x8012F3D0:("Object_InitBank",), - 0x8012F4FC:("Object_UpdateBank",), - 0x8012F608:("Object_GetIndex",), + 0x8012F2E0:("Object_SpawnPersistent",), + 0x8012F3D0:("Object_InitContext",), + 0x8012F4FC:("Object_UpdateEntries",), + 0x8012F608:("Object_GetSlot",), 0x8012F668:("Object_IsLoaded",), 0x8012F698:("Object_LoadAll",), 0x8012F73C:("func_8012F73C",), @@ -2660,7 +2660,7 @@ 0x8013AB00:("SubS_DrawTransformFlex",), 0x8013AD6C:("SubS_InCsMode",), 0x8013AD9C:("SubS_UpdateLimb",), - 0x8013AED4:("SubS_UpdateFlags",), + 0x8013AED4:("SubS_SetOfferMode",), 0x8013AF00:("SubS_TimePathing_FillKnots",), 0x8013B010:("SubS_TimePathing_ComputeProgress",), 0x8013B0C8:("SubS_TimePathing_ComputeWeights",), @@ -2675,7 +2675,7 @@ 0x8013C068:("SubS_WeightPathing_ComputePoint",), 0x8013C624:("SubS_WeightPathing_Move",), 0x8013C8B8:("SubS_CopyPointFromPathCheckBounds",), - 0x8013C964:("func_8013C964",), + 0x8013C964:("SubS_Offer",), 0x8013CC2C:("SubS_FillShadowTex",), 0x8013CD64:("SubS_GenShadowTex",), 0x8013CF04:("SubS_DrawShadowTex",), @@ -2688,9 +2688,9 @@ 0x8013D768:("SubS_MoveActorToPoint",), 0x8013D83C:("SubS_GetDistSqAndOrientPath",), 0x8013D8DC:("SubS_IsObjectLoaded",), - 0x8013D924:("SubS_GetObjectIndex",), + 0x8013D924:("SubS_GetObjectSlot",), 0x8013D960:("SubS_FindActor",), - 0x8013D9C8:("SubS_FillLimbRotTables",), + 0x8013D9C8:("SubS_UpdateFidgetTables",), 0x8013DB90:("SubS_IsFloorAbove",), 0x8013DC40:("SubS_CopyPointFromPathList",), 0x8013DCCC:("SubS_GetPathCountFromPathList",), @@ -2706,9 +2706,9 @@ 0x8013E4B0:("SubS_ConstructPlane",), 0x8013E5CC:("SubS_LineSegVsPlane",), 0x8013E640:("SubS_FindActorCustom",), - 0x8013E748:("func_8013E748",), + 0x8013E748:("SubS_OfferTalkExchangeCustom",), 0x8013E7C0:("SubS_ActorAndPlayerFaceEachOther",), - 0x8013E8F8:("func_8013E8F8",), + 0x8013E8F8:("SubS_OfferTalkExchangeFacing",), 0x8013E950:("SubS_TrackPointStep",), 0x8013EC10:("Rumble_Update",), 0x8013EC44:("Rumble_Override",), @@ -2820,59 +2820,59 @@ 0x80147314:("func_80147314",), 0x80147414:("func_80147414",), 0x8014750C:("Sram_nop8014750C",), - 0x80147520:("func_80147520",), - 0x80147564:("func_80147564",), + 0x80147520:("Message_ResetOcarinaButtonAlphas",), + 0x80147564:("Message_ResetOcarinaButtonState",), 0x80147624:("Message_ShouldAdvance",), 0x80147734:("Message_ShouldAdvanceSilent",), 0x801477B4:("Message_CloseTextbox",), - 0x80147818:("func_80147818",), + 0x80147818:("Message_DrawTextboxIcon",), 0x80147F18:("func_80147F18",), 0x80148558:("func_80148558",), - 0x80148B98:("func_80148B98",), + 0x80148B98:("Message_HandleChoiceSelection",), 0x80148CBC:("func_80148CBC",), 0x80148D64:("func_80148D64",), 0x80149048:("func_80149048",), 0x801491DC:("func_801491DC",), 0x80149454:("func_80149454",), 0x801496C8:("func_801496C8",), - 0x8014995C:("func_8014995C",), - 0x80149C18:("func_80149C18",), + 0x8014995C:("Message_DrawTextChar",), + 0x80149C18:("Message_GrowTextbox",), 0x80149EBC:("Message_FindMessage",), - 0x80149F74:("func_80149F74",), - 0x8014AAD0:("func_8014AAD0",), - 0x8014ADBC:("func_8014ADBC",), - 0x8014C70C:("func_8014C70C",), + 0x80149F74:("Message_DrawItemIcon",), + 0x8014AAD0:("Message_HandleOcarina",), + 0x8014ADBC:("Message_DrawTextDefault",), + 0x8014C70C:("Message_LoadItemIcon",), 0x8014CC14:("Message_LoadChar",), 0x8014CCB4:("func_8014CCB4",), - 0x8014CDF0:("func_8014CDF0",), - 0x8014CFDC:("func_8014CFDC",), - 0x8014D304:("func_8014D304",), - 0x8014D62C:("func_8014D62C",), - 0x8014D7B4:("func_8014D7B4",), + 0x8014CDF0:("Message_GetTimerDigits",), + 0x8014CFDC:("Message_SetupLoadItemIcon",), + 0x8014D304:("Message_LoadTime",), + 0x8014D62C:("Message_LoadOwlWarpText",), + 0x8014D7B4:("Message_Decode",), 0x80150A84:("func_80150A84",), - 0x80150D08:("func_80150D08",), + 0x80150D08:("Message_OpenText",), 0x801514B0:("func_801514B0",), 0x801518B0:("Message_StartTextbox",), 0x80151938:("Message_ContinueTextbox",), - 0x80151A68:("func_80151A68",), + 0x80151A68:("Message_DisplaySceneTitleCard",), 0x80151BB4:("Message_BombersNotebookQueueEvent",), - 0x80151C9C:("func_80151C9C",), - 0x80151DA4:("func_80151DA4",), - 0x80152434:("func_80152434",), - 0x80152464:("func_80152464",), + 0x80151C9C:("Message_BombersNotebookProcessEventQueue",), + 0x80151DA4:("Message_DisplayOcarinaStaffImpl",), + 0x80152434:("Message_DisplayOcarinaStaff",), + 0x80152464:("Message_DisplayOcarinaStaffBlockSunsSong",), 0x80152498:("Message_GetState",), - 0x8015268C:("func_8015268C",), - 0x80152C64:("func_80152C64",), + 0x8015268C:("Message_DrawTextBox",), + 0x80152C64:("Message_SetView",), 0x80152CAC:("func_80152CAC",), - 0x80152EC0:("func_80152EC0",), - 0x80152FB8:("func_80152FB8",), - 0x80153750:("func_80153750",), - 0x80153E7C:("func_80153E7C",), - 0x80153EF0:("func_80153EF0",), - 0x801541D4:("func_801541D4",), + 0x80152EC0:("Message_SpawnSongEffect",), + 0x80152FB8:("Message_FlashOcarinaButtons",), + 0x80153750:("Message_DrawOcarinaButtons",), + 0x80153E7C:("Message_DrawText",), + 0x80153EF0:("Message_DrawSceneTitleCard",), + 0x801541D4:("Message_DrawMain",), 0x80156758:("Message_Draw",), 0x8015680C:("Message_Update",), - 0x801586A4:("func_801586A4",), + 0x801586A4:("Message_SetTables",), 0x801586D4:("Message_Init",), 0x801588D0:("Message_FindMessageNES",), 0x80158988:("Message_LoadCharNES",), @@ -2881,12 +2881,12 @@ 0x80158D98:("Message_LoadRupeesNES",), 0x80158FB0:("Message_LoadTimeNES",), 0x8015926C:("Message_LoadOwlWarpTextNES",), - 0x80159438:("func_80159438",), - 0x8015966C:("func_8015966C",), - 0x8015B198:("func_8015B198",), + 0x80159438:("Message_GetTimerDigitsNES",), + 0x8015966C:("Message_DrawTextNES",), + 0x8015B198:("Message_DecodeNES",), 0x8015E750:("Message_FindCreditsMessage",), - 0x8015E7EC:("func_8015E7EC",), - 0x8015F8A8:("func_8015F8A8",), + 0x8015E7EC:("Message_DrawTextCredits",), + 0x8015F8A8:("Message_DecodeCredits",), 0x80160A90:("PlayerCall_InitFuncPtrs",), 0x80160AF8:("PlayerCall_Init",), 0x80160B40:("PlayerCall_Destroy",), @@ -3057,28 +3057,28 @@ 0x8016FD2C:("PreRender_Init",), 0x8016FD60:("PreRender_SetValues",), 0x8016FD94:("PreRender_Destroy",), - 0x8016FDB8:("func_8016FDB8",), - 0x8016FF70:("func_8016FF70",), + 0x8016FDB8:("PreRender_CopyImage",), + 0x8016FF70:("PreRender_RestoreBuffer",), 0x8016FF90:("func_8016FF90",), 0x80170200:("func_80170200",), - 0x8017023C:("func_8017023C",), - 0x8017057C:("func_8017057C",), - 0x801705B4:("func_801705B4",), - 0x801705EC:("func_801705EC",), - 0x80170730:("func_80170730",), - 0x80170774:("func_80170774",), + 0x8017023C:("PreRender_CoverageRgba16ToI8",), + 0x8017057C:("PreRender_SaveZBuffer",), + 0x801705B4:("PreRender_SaveFramebuffer",), + 0x801705EC:("PreRender_FetchFbufCoverage",), + 0x80170730:("PreRender_DrawCoverage",), + 0x80170774:("PreRender_RestoreZBuffer",), 0x80170798:("func_80170798",), 0x80170AE0:("func_80170AE0",), - 0x80170B28:("func_80170B28",), - 0x80170B4C:("PreRender_AntiAliasAlgorithm",), - 0x8017160C:("PreRender_ApplyAntiAliasingFilter",), - 0x801716C4:("func_801716C4",), - 0x801717F8:("func_801717F8",), + 0x80170B28:("PreRender_RestoreFramebuffer",), + 0x80170B4C:("PreRender_AntiAliasFilterPixel",), + 0x8017160C:("PreRender_AntiAliasFilter",), + 0x801716C4:("PreRender_Get5bMedian9",), + 0x801717F8:("PreRender_DivotFilter",), 0x80171F4C:("PreRender_ApplyFilters",), 0x80171FA8:("PreRender_ApplyFiltersSlowlyInit",), 0x80172078:("PreRender_ApplyFiltersSlowlyDestroy",), 0x801720C4:("func_801720C4",), - 0x801720FC:("func_801720FC",), + 0x801720FC:("Prerender_DrawBackground2DImpl",), 0x80172758:("Prerender_DrawBackground2D",), 0x801727F0:("THGA_Init",), 0x80172810:("THGA_Destroy",), @@ -3110,9 +3110,9 @@ 0x80172B58:("THA_Init",), 0x80172B9C:("THA_Destroy",), 0x80172BC0:("AudioMgr_StopAllSfxExceptSystem",), - 0x80172C30:("func_80172C30",), + 0x80172C30:("AudioMgr_NotifyTaskDone",), 0x80172C68:("AudioMgr_HandleRetrace",), - 0x80172EAC:("AudioMgr_HandlePRENMI",), + 0x80172EAC:("AudioMgr_HandlePreNMI",), 0x80172ED0:("AudioMgr_ThreadEntry",), 0x80173048:("AudioMgr_Unlock",), 0x80173074:("AudioMgr_Init",), @@ -3120,16 +3120,16 @@ 0x801732DC:("Setup_InitImpl",), 0x8017332C:("Setup_Destroy",), 0x80173338:("Setup_Init",), - 0x80173360:("Game_UpdateFramerateVariables",), - 0x801733A8:("Game_SetFramerateDivisor",), + 0x80173360:("GameState_UpdateFramerateDivisors",), + 0x801733A8:("GameState_SetFramerateDivisor",), 0x801733DC:("GameState_SetFBFilter",), - 0x80173534:("Game_Nop80173534",), + 0x80173534:("GameState_Noop",), 0x80173540:("GameState_Draw",), 0x80173644:("GameState_SetFrameBuffer",), - 0x801736DC:("func_801736DC",), - 0x80173754:("Game_UpdateInput",), - 0x8017377C:("Game_Update",), - 0x801737E4:("Game_IncrementFrameCount",), + 0x801736DC:("GameState_DrawEnd",), + 0x80173754:("GameState_GetInput",), + 0x8017377C:("GameState_Update",), + 0x801737E4:("GameState_IncrementFrameCount",), 0x80173810:("GameState_InitArena",), 0x80173880:("GameState_Realloc",), 0x80173950:("GameState_Init",), @@ -3215,12 +3215,12 @@ 0x80177084:("Sched_FaultClient",), 0x8017715C:("Sched_ThreadEntry",), 0x801772A0:("Sched_Init",), - 0x80177390:("func_80177390",), - 0x801773A0:("func_801773A0",), - 0x801773C4:("func_801773C4",), + 0x80177390:("SpeedMeter_InitImpl",), + 0x801773A0:("SpeedMeter_Init",), + 0x801773C4:("SpeedMeter_Destroy",), 0x801773D0:("SpeedMeter_DrawTimeEntries",), - 0x80177A84:("func_80177A84",), - 0x80177AC8:("func_80177AC8",), + 0x80177A84:("SpeedMeter_InitAllocEntry",), + 0x80177AC8:("SpeedMeter_DrawAllocEntry",), 0x80177E58:("SpeedMeter_DrawAllocEntries",), 0x801780F0:("Mtx_SetTranslateScaleMtx",), 0x801781EC:("Mtx_SetRotationMtx",), @@ -3757,16 +3757,16 @@ 0x801964F8:("AudioPlayback_AllocNoteFromActive",), 0x801965F0:("AudioPlayback_AllocNote",), 0x801968C4:("AudioPlayback_NoteInitAll",), - 0x80196A00:("AudioEffects_SequenceChannelProcessSound",), - 0x80196BC8:("AudioEffects_SequencePlayerProcessSound",), - 0x80196D20:("AudioEffects_GetPortamentoFreqScale",), + 0x80196A00:("AudioScript_SequenceChannelProcessSound",), + 0x80196BC8:("AudioScript_SequencePlayerProcessSound",), + 0x80196D20:("AudioEffects_UpdatePortamento",), 0x80196D7C:("AudioEffects_GetVibratoPitchChange",), - 0x80196DB4:("AudioEffects_GetVibratoFreqScale",), - 0x80196FEC:("AudioEffects_NoteVibratoUpdate",), - 0x80197048:("AudioEffects_NoteVibratoInit",), - 0x80197138:("AudioEffects_NotePortamentoInit",), - 0x80197164:("AudioEffects_AdsrInit",), - 0x80197188:("AudioEffects_AdsrUpdate",), + 0x80196DB4:("AudioEffects_UpdateVibrato",), + 0x80196FEC:("AudioEffects_UpdatePortamentoAndVibrato",), + 0x80197048:("AudioEffects_InitVibrato",), + 0x80197138:("AudioEffects_InitPortamento",), + 0x80197164:("AudioEffects_InitAdsr",), + 0x80197188:("AudioEffects_UpdateAdsr",), 0x801974D0:("AudioScript_GetScriptControlFlowArgument",), 0x80197538:("AudioScript_HandleScriptFlowControl",), 0x80197714:("AudioScript_InitSequenceChannel",), @@ -3867,40 +3867,40 @@ 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",), + 0x8019F0C8:("Audio_PlaySfx",), + 0x8019F128:("Audio_PlaySfx_2",), + 0x8019F170:("Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb",), + 0x8019F1C0:("Audio_PlaySfx_AtPos",), + 0x8019F208:("Audio_PlaySfx_MessageDecide",), + 0x8019F230:("Audio_PlaySfx_MessageCancel",), 0x8019F258:("AudioSfx_AddSfxSetting",), 0x8019F300:("AudioSfx_ProcessSfxSettings",), - 0x8019F420:("func_8019F420",), - 0x8019F4AC:("func_8019F4AC",), - 0x8019F540:("func_8019F540",), + 0x8019F420:("Audio_PlaySfx_Underwater",), + 0x8019F4AC:("Audio_PlaySfx_WithSfxSettingsReverb",), + 0x8019F540:("Audio_SetSfxUnderwaterReverb",), 0x8019F570:("AudioSfx_LowerSfxSettingsReverb",), - 0x8019F5AC:("func_8019F5AC",), - 0x8019F638:("func_8019F638",), - 0x8019F780:("func_8019F780",), - 0x8019F7D8:("func_8019F7D8",), - 0x8019F830:("func_8019F830",), - 0x8019F88C:("func_8019F88C",), - 0x8019F900:("func_8019F900",), - 0x8019FA18:("func_8019FA18",), - 0x8019FAD8:("func_8019FAD8",), - 0x8019FB0C:("func_8019FB0C",), - 0x8019FC20:("func_8019FC20",), - 0x8019FCB8:("func_8019FCB8",), - 0x8019FD90:("func_8019FD90",), - 0x8019FDC8:("func_8019FDC8",), - 0x8019FE1C:("func_8019FE1C",), - 0x8019FE74:("func_8019FE74",), - 0x8019FEDC:("func_8019FEDC",), - 0x8019FF38:("func_8019FF38",), - 0x8019FF9C:("Audio_PlaySfxForRiver",), - 0x801A0048:("Audio_PlaySfxForWaterfall",), + 0x8019F5AC:("Audio_SetSyncedSfxFreqAndVolume",), + 0x8019F638:("Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume",), + 0x8019F780:("Audio_PlaySfx_AtPosWithSyncedFreqAndVolume",), + 0x8019F7D8:("Audio_PlaySfx_GiantsMaskUnused",), + 0x8019F830:("Audio_PlaySfx_GiantsMask",), + 0x8019F88C:("Audio_PlaySfx_Randomized",), + 0x8019F900:("Audio_PlaySfx_SwordCharge",), + 0x8019FA18:("Audio_PlaySfx_AtPosWithFreqAndVolume",), + 0x8019FAD8:("Audio_PlaySfx_AtPosWithFreq",), + 0x8019FB0C:("Audio_PlaySfx_AtPosWithFreqAndChannelIO",), + 0x8019FC20:("Audio_PlaySfx_WaterWheel",), + 0x8019FCB8:("Audio_PlaySfx_AtPosWithTimer",), + 0x8019FD90:("Audio_SetSfxTimerLerpInterval",), + 0x8019FDC8:("Audio_PlaySfx_AtPosWithReverb",), + 0x8019FE1C:("Audio_PlaySfx_AtPosWithVolume",), + 0x8019FE74:("Audio_SetSfxVolumeTransition",), + 0x8019FEDC:("Audio_UpdateSfxVolumeTransition",), + 0x8019FF38:("Audio_PlaySfx_FishingReel",), + 0x8019FF9C:("Audio_PlaySfx_River",), + 0x801A0048:("Audio_PlaySfx_Waterfall",), 0x801A00EC:("Audio_StepFreqLerp",), - 0x801A0124:("func_801A0124",), + 0x801A0124:("Audio_PlaySfx_BigBells",), 0x801A0184:("Audio_SetBgmVolumeOff",), 0x801A01C4:("Audio_SetBgmVolumeOn",), 0x801A0204:("func_801A0204",), @@ -3909,32 +3909,32 @@ 0x801A0318:("Audio_SetGanonsTowerBgmVolume",), 0x801A0450:("Audio_LowerMainBgmVolume",), 0x801A046C:("Audio_UpdateRiverSoundVolumes",), - 0x801A0554:("func_801A0554",), - 0x801A05E4:("func_801A05E4",), - 0x801A05F0:("func_801A05F0",), + 0x801A0554:("Audio_PlaySfx_IncreasinglyTransposed",), + 0x801A05E4:("Audio_ResetIncreasingTranspose",), + 0x801A05F0:("Audio_PlaySfx_Transposed",), 0x801A0654:("AudioSfx_SetChannelIO",), - 0x801A0810:("func_801A0810",), - 0x801A0868:("func_801A0868",), + 0x801A0810:("Audio_PlaySfx_AtPosWithChannelIO",), + 0x801A0868:("Audio_PlaySfx_AtPosWithAllChannelsIO",), 0x801A09D4:("func_801A09D4",), 0x801A0C70:("Audio_ClearSariaBgm",), 0x801A0C90:("Audio_ClearSariaBgmAtPos",), 0x801A0CB0:("Audio_SplitBgmChannels",), - 0x801A0E44:("func_801A0E44",), - 0x801A1290:("func_801A1290",), - 0x801A1348:("func_801A1348",), - 0x801A13BC:("func_801A13BC",), - 0x801A153C:("func_801A153C",), - 0x801A17F4:("func_801A17F4",), - 0x801A1904:("func_801A1904",), - 0x801A1A10:("func_801A1A10",), - 0x801A1A8C:("func_801A1A8C",), - 0x801A1D44:("func_801A1D44",), - 0x801A1DB8:("func_801A1DB8",), - 0x801A1E0C:("func_801A1E0C",), - 0x801A1F00:("func_801A1F00",), - 0x801A1F88:("func_801A1F88",), - 0x801A1FB4:("func_801A1FB4",), - 0x801A2090:("func_801A2090",), + 0x801A0E44:("Audio_SetSequenceProperties",), + 0x801A1290:("Audio_UpdateObjSoundProperties",), + 0x801A1348:("Audio_SetObjSoundProperties",), + 0x801A13BC:("Audio_StartObjSoundFanfare",), + 0x801A153C:("Audio_PlayObjSoundBgm",), + 0x801A17F4:("Audio_PlayObjSoundFanfare",), + 0x801A1904:("Audio_UpdateObjSoundFanfare",), + 0x801A1A10:("Audio_StopSequenceAtPos",), + 0x801A1A8C:("Audio_StartSubBgmAtPos",), + 0x801A1D44:("Audio_PlaySubBgmAtPos",), + 0x801A1DB8:("Audio_PlaySubBgmAtPosWithFilter",), + 0x801A1E0C:("Audio_UpdateSubBgmAtPos",), + 0x801A1F00:("Audio_PlaySequenceAtDefaultPos",), + 0x801A1F88:("Audio_StopSequenceAtDefaultPos",), + 0x801A1FB4:("Audio_PlaySequenceAtPos",), + 0x801A2090:("Audio_UpdateSequenceAtPos",), 0x801A21FC:("Audio_PlaySariaBgm",), 0x801A2460:("Audio_ClearSariaBgm2",), 0x801A246C:("func_801A246C",), @@ -3969,35 +3969,35 @@ 0x801A39F8:("func_801A39F8",), 0x801A3A7C:("func_801A3A7C",), 0x801A3AC0:("func_801A3AC0",), - 0x801A3AEC:("func_801A3AEC",), + 0x801A3AEC:("Audio_PlaySfx_PauseMenuOpenOrClose",), 0x801A3B48:("func_801A3B48",), 0x801A3B90:("func_801A3B90",), 0x801A3CD8:("func_801A3CD8",), 0x801A3CF4:("func_801A3CF4",), - 0x801A3D54:("func_801A3D54",), + 0x801A3D54:("Audio_PlaySfx_SurroundSoundTest",), 0x801A3D98:("func_801A3D98",), 0x801A3E38:("func_801A3E38",), 0x801A3EC0:("func_801A3EC0",), 0x801A3F54:("Audio_SetCutsceneFlag",), - 0x801A3F6C:("func_801A3F6C",), - 0x801A3FB4:("func_801A3FB4",), - 0x801A3FFC:("func_801A3FFC",), + 0x801A3F6C:("Audio_PlaySfx_IfNotInCutsceneImpl",), + 0x801A3FB4:("Audio_PlaySfx_IfNotInCutscene",), + 0x801A3FFC:("Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem",), 0x801A400C:("Audio_SetSpec",), 0x801A4058:("func_801A4058",), 0x801A41C8:("func_801A41C8",), 0x801A41F8:("func_801A41F8",), - 0x801A429C:("func_801A429C",), + 0x801A429C:("Audio_StartSfxPlayer",), 0x801A42C8:("func_801A42C8",), 0x801A4324:("func_801A4324",), 0x801A4348:("func_801A4348",), 0x801A4380:("Audio_SetSfxVolumeExceptSystemAndOcarinaBanks",), - 0x801A4428:("func_801A4428",), + 0x801A4428:("Audio_SetSfxReverbIndexExceptOcarinaBank",), 0x801A44A4:("Audio_PreNMI",), 0x801A44C4:("Audio_ResetRequestedSceneSeqId",), 0x801A44D4:("Audio_ResetData",), 0x801A46F8:("func_801A46F8",), - 0x801A4748:("func_801A4748",), - 0x801A479C:("func_801A479C",), + 0x801A4748:("Audio_PlaySfx_AtFixedPos",), + 0x801A479C:("Audio_PlaySfx_AtPosWithVolumeTransition",), 0x801A47DC:("Audio_SetAmbienceChannelIO",), 0x801A48E0:("Audio_StartAmbience",), 0x801A4A28:("Audio_PlayAmbience",), @@ -4256,7 +4256,7 @@ 0x8082DC28:("func_8082DC28",), 0x8082DC38:("func_8082DC38",), 0x8082DC64:("func_8082DC64",), - 0x8082DCA0:("func_8082DCA0",), + 0x8082DCA0:("Player_DetachHeldActor",), 0x8082DD2C:("func_8082DD2C",), 0x8082DE14:("func_8082DE14",), 0x8082DE50:("func_8082DE50",), @@ -4296,7 +4296,7 @@ 0x8082EAC8:("func_8082EAC8",), 0x8082EAF0:("func_8082EAF0",), 0x8082EB18:("func_8082EB18",), - 0x8082EB38:("func_8082EB38",), + 0x8082EB38:("Player_ProcessControlStick",), 0x8082EC9C:("func_8082EC9C",), 0x8082ECCC:("func_8082ECCC",), 0x8082ECE0:("func_8082ECE0",), @@ -4308,45 +4308,45 @@ 0x8082EF54:("func_8082EF54",), 0x8082EF9C:("func_8082EF9C",), 0x8082EFE4:("func_8082EFE4",), - 0x8082F02C:("func_8082F02C",), + 0x8082F02C:("Player_LerpEnvLighting",), 0x8082F09C:("Player_ResetCylinder",), 0x8082F0E4:("Player_SetCylinderForAttack",), 0x8082F164:("func_8082F164",), 0x8082F1AC:("func_8082F1AC",), - 0x8082F43C:("func_8082F43C",), - 0x8082F470:("func_8082F470",), + 0x8082F43C:("Player_SetUpperAction",), + 0x8082F470:("Player_InitItemActionWithAnim",), 0x8082F524:("Player_ItemToItemAction",), - 0x8082F594:("func_8082F594",), - 0x8082F5A4:("func_8082F5A4",), - 0x8082F5C0:("func_8082F5C0",), + 0x8082F594:("Player_InitItemAction_DoNothing",), + 0x8082F5A4:("Player_InitItemAction_DekuStick",), + 0x8082F5C0:("Player_InitItemAction_2",), 0x8082F5FC:("func_8082F5FC",), - 0x8082F62C:("Player_SpawnExplosive",), - 0x8082F7F4:("func_8082F7F4",), - 0x8082F8A0:("func_8082F8A0",), - 0x8082F8BC:("func_8082F8BC",), + 0x8082F62C:("Player_InitItemAction_SpawnExplosive",), + 0x8082F7F4:("Player_InitItemAction_SpawnHookshot",), + 0x8082F8A0:("Player_InitItemAction_5",), + 0x8082F8BC:("Player_InitItemAction",), 0x8082F938:("Player_OverrideBlureColors",), 0x8082FA5C:("func_8082FA5C",), 0x8082FB68:("func_8082FB68",), 0x8082FBE8:("func_8082FBE8",), 0x8082FC24:("func_8082FC24",), 0x8082FC60:("func_8082FC60",), - 0x8082FC78:("func_8082FC78",), - 0x8082FCC4:("func_8082FCC4",), + 0x8082FC78:("Player_ItemIsInUse",), + 0x8082FCC4:("Player_ItemIsItemAction",), 0x8082FD0C:("func_8082FD0C",), 0x8082FDC4:("func_8082FDC4",), - 0x8082FE0C:("func_8082FE0C",), - 0x808302CC:("func_808302CC",), - 0x808304BC:("func_808304BC",), + 0x8082FE0C:("Player_ProcessItemButtons",), + 0x808302CC:("Player_StartChangingHeldItem",), + 0x808304BC:("Player_UpdateItems",), 0x808305BC:("func_808305BC",), 0x808306F8:("func_808306F8",), - 0x808308DC:("func_808308DC",), + 0x808308DC:("Player_FinishItemChange",), 0x808309CC:("func_808309CC",), 0x80830A58:("func_80830A58",), 0x80830AE8:("func_80830AE8",), 0x80830B38:("func_80830B38",), 0x80830B88:("func_80830B88",), 0x80830CE8:("func_80830CE8",), - 0x80830D40:("func_80830D40",), + 0x80830D40:("Player_WaitToFinishItemChange",), 0x80830DF0:("func_80830DF0",), 0x80830E30:("func_80830E30",), 0x80830F9C:("func_80830F9C",), @@ -4360,17 +4360,17 @@ 0x808313F0:("func_808313F0",), 0x80831454:("func_80831454",), 0x80831494:("Player_SetAction",), - 0x8083172C:("func_8083172C",), - 0x80831760:("func_80831760",), - 0x808317C4:("func_808317C4",), + 0x8083172C:("Player_SetAction_PreserveMoveFlags",), + 0x80831760:("Player_SetAction_PreserveItemAction",), + 0x808317C4:("Player_DestroyHookshot",), 0x80831814:("func_80831814",), 0x808318C0:("func_808318C0",), 0x80831944:("func_80831944",), - 0x80831990:("func_80831990",), + 0x80831990:("Player_UseItem",), 0x80831F34:("func_80831F34",), - 0x80832090:("func_80832090",), + 0x80832090:("Player_CanUpdateItems",), 0x8083213C:("func_8083213C",), - 0x8083216C:("func_8083216C",), + 0x8083216C:("Player_UpdateUpperBody",), 0x808323C0:("func_808323C0",), 0x80832444:("func_80832444",), 0x8083249C:("func_8083249C",), @@ -4380,10 +4380,10 @@ 0x80832660:("func_80832660",), 0x80832754:("func_80832754",), 0x80832888:("func_80832888",), - 0x80832CAC:("func_80832CAC",), + 0x80832CAC:("Player_CalcSpeedAndYawFromControlStick",), 0x80832F24:("func_80832F24",), - 0x80832F78:("func_80832F78",), - 0x80833058:("func_80833058",), + 0x80832F78:("Player_GetMovementSpeedAndYaw",), + 0x80833058:("Player_TryActionChangeList",), 0x808331FC:("func_808331FC",), 0x808332A0:("func_808332A0",), 0x808333CC:("func_808333CC",), @@ -4413,24 +4413,24 @@ 0x80834CD0:("func_80834CD0",), 0x80834D50:("func_80834D50",), 0x80834DB8:("func_80834DB8",), - 0x80834DFC:("func_80834DFC",), + 0x80834DFC:("Player_ActionChange_12",), 0x80835324:("func_80835324",), 0x808353DC:("func_808353DC",), 0x80835428:("func_80835428",), 0x808354A4:("func_808354A4",), 0x808355D8:("func_808355D8",), - 0x8083562C:("func_8083562C",), + 0x8083562C:("Player_HandleExitsAndVoids",), 0x80835BC8:("Player_TranslateAndRotateY",), 0x80835BF8:("func_80835BF8",), 0x80835C64:("Player_SpawnFairy",), 0x80835CD8:("func_80835CD8",), 0x80835D2C:("func_80835D2C",), - 0x80835D58:("func_80835D58",), + 0x80835D58:("Player_PosVsWallLineTest",), 0x80835DF8:("func_80835DF8",), 0x80835EAC:("Player_Door_Staircase",), 0x8083604C:("Player_Door_Sliding",), 0x80836258:("Player_Door_Knob",), - 0x808365DC:("func_808365DC",), + 0x808365DC:("Player_ActionChange_1",), 0x80836888:("func_80836888",), 0x8083692C:("func_8083692C",), 0x80836988:("func_80836988",), @@ -4470,9 +4470,9 @@ 0x808388B8:("func_808388B8",), 0x808389BC:("func_808389BC",), 0x80838A20:("func_80838A20",), - 0x80838A90:("func_80838A90",), - 0x808391D8:("func_808391D8",), - 0x80839518:("func_80839518",), + 0x80838A90:("Player_ActionChange_13",), + 0x808391D8:("Player_ActionChange_4",), + 0x80839518:("Player_ActionChange_0",), 0x808395F0:("func_808395F0",), 0x808396B8:("func_808396B8",), 0x80839770:("func_80839770",), @@ -4481,19 +4481,19 @@ 0x80839978:("func_80839978",), 0x80839A10:("func_80839A10",), 0x80839A84:("func_80839A84",), - 0x80839B18:("func_80839B18",), + 0x80839B18:("Player_ActionChange_10",), 0x80839CD8:("func_80839CD8",), 0x80839E3C:("func_80839E3C",), 0x80839E74:("func_80839E74",), 0x80839ED0:("func_80839ED0",), 0x80839F98:("func_80839F98",), 0x8083A04C:("func_8083A04C",), - 0x8083A0CC:("func_8083A0CC",), - 0x8083A114:("func_8083A114",), - 0x8083A274:("func_8083A274",), + 0x8083A0CC:("Player_ActionChange_14",), + 0x8083A114:("Player_ActionChange_6",), + 0x8083A274:("Player_ActionChange_11",), 0x8083A4A4:("func_8083A4A4",), 0x8083A548:("func_8083A548",), - 0x8083A580:("func_8083A580",), + 0x8083A580:("Player_ActionChange_8",), 0x8083A658:("func_8083A658",), 0x8083A6C0:("func_8083A6C0",), 0x8083A794:("func_8083A794",), @@ -4531,19 +4531,19 @@ 0x8083CB04:("func_8083CB04",), 0x8083CB58:("func_8083CB58",), 0x8083CBC4:("func_8083CBC4",), - 0x8083CCB4:("func_8083CCB4",), - 0x8083CF68:("func_8083CF68",), + 0x8083CCB4:("Player_ActionChange_3",), + 0x8083CF68:("Player_HandleSlopes",), 0x8083D168:("func_8083D168",), - 0x8083D23C:("func_8083D23C",), + 0x8083D23C:("Player_ActionChange_2",), 0x8083D6DC:("func_8083D6DC",), 0x8083D738:("func_8083D738",), - 0x8083D78C:("func_8083D78C",), + 0x8083D78C:("Player_ActionChange_9",), 0x8083D860:("func_8083D860",), 0x8083DCC4:("func_8083DCC4",), 0x8083DD1C:("func_8083DD1C",), 0x8083DEE4:("func_8083DEE4",), 0x8083DF38:("func_8083DF38",), - 0x8083DFC4:("func_8083DFC4",), + 0x8083DFC4:("Player_ActionChange_5",), 0x8083E14C:("func_8083E14C",), 0x8083E234:("func_8083E234",), 0x8083E28C:("func_8083E28C",), @@ -4607,7 +4607,7 @@ 0x808425B4:("func_808425B4",), 0x808426F0:("Player_SetDoAction",), 0x808430E0:("func_808430E0",), - 0x80843178:("func_80843178",), + 0x80843178:("Player_ProcessSceneCollision",), 0x80843EC0:("Player_UpdateCamAndSeqModes",), 0x808442D8:("func_808442D8",), 0x808445C4:("func_808445C4",), @@ -4642,96 +4642,96 @@ 0x808482E0:("func_808482E0",), 0x808484CC:("func_808484CC",), 0x808484F0:("func_808484F0",), - 0x80848570:("func_80848570",), + 0x80848570:("Player_ActionChange_7",), 0x80848640:("func_80848640",), - 0x80848780:("func_80848780",), - 0x808487B8:("func_808487B8",), - 0x80848808:("func_80848808",), - 0x8084894C:("func_8084894C",), - 0x80848A0C:("func_80848A0C",), - 0x80848AB0:("func_80848AB0",), - 0x80848B6C:("func_80848B6C",), - 0x80848BF4:("func_80848BF4",), - 0x80848E4C:("func_80848E4C",), - 0x80849054:("func_80849054",), - 0x808490B4:("func_808490B4",), - 0x808491B4:("func_808491B4",), - 0x8084923C:("func_8084923C",), - 0x808492C4:("func_808492C4",), - 0x8084933C:("func_8084933C",), - 0x80849570:("func_80849570",), - 0x80849620:("func_80849620",), - 0x808496AC:("func_808496AC",), - 0x808497A0:("func_808497A0",), - 0x80849A9C:("func_80849A9C",), - 0x80849DD0:("func_80849DD0",), - 0x80849FE0:("func_80849FE0",), - 0x8084A26C:("func_8084A26C",), - 0x8084A5C0:("func_8084A5C0",), - 0x8084A794:("func_8084A794",), - 0x8084A884:("func_8084A884",), - 0x8084A8E8:("func_8084A8E8",), - 0x8084AB4C:("func_8084AB4C",), - 0x8084AC84:("func_8084AC84",), - 0x8084AEEC:("func_8084AEEC",), - 0x8084AF9C:("func_8084AF9C",), - 0x8084B0EC:("func_8084B0EC",), - 0x8084B288:("func_8084B288",), - 0x8084B3B8:("func_8084B3B8",), - 0x8084B4A8:("func_8084B4A8",), - 0x8084B5C0:("func_8084B5C0",), - 0x8084BAA4:("func_8084BAA4",), - 0x8084BBF0:("func_8084BBF0",), - 0x8084BC64:("func_8084BC64",), - 0x8084BE40:("func_8084BE40",), - 0x8084BF28:("func_8084BF28",), - 0x8084BFDC:("func_8084BFDC",), + 0x80848780:("Player_UpperAction_0",), + 0x808487B8:("Player_UpperAction_1",), + 0x80848808:("Player_UpperAction_ChangeHeldItem",), + 0x8084894C:("Player_UpperAction_3",), + 0x80848A0C:("Player_UpperAction_4",), + 0x80848AB0:("Player_UpperAction_5",), + 0x80848B6C:("Player_UpperAction_6",), + 0x80848BF4:("Player_UpperAction_7",), + 0x80848E4C:("Player_UpperAction_8",), + 0x80849054:("Player_UpperAction_9",), + 0x808490B4:("Player_UpperAction_10",), + 0x808491B4:("Player_UpperAction_11",), + 0x8084923C:("Player_UpperAction_12",), + 0x808492C4:("Player_UpperAction_13",), + 0x8084933C:("Player_UpperAction_14",), + 0x80849570:("Player_UpperAction_15",), + 0x80849620:("Player_UpperAction_16",), + 0x808496AC:("Player_Action_0",), + 0x808497A0:("Player_Action_1",), + 0x80849A9C:("Player_Action_2",), + 0x80849DD0:("Player_Action_3",), + 0x80849FE0:("Player_Action_4",), + 0x8084A26C:("Player_Action_5",), + 0x8084A5C0:("Player_Action_6",), + 0x8084A794:("Player_Action_7",), + 0x8084A884:("Player_Action_8",), + 0x8084A8E8:("Player_Action_9",), + 0x8084AB4C:("Player_Action_10",), + 0x8084AC84:("Player_Action_11",), + 0x8084AEEC:("Player_Action_12",), + 0x8084AF9C:("Player_Action_13",), + 0x8084B0EC:("Player_Action_14",), + 0x8084B288:("Player_Action_15",), + 0x8084B3B8:("Player_Action_16",), + 0x8084B4A8:("Player_Action_17",), + 0x8084B5C0:("Player_Action_18",), + 0x8084BAA4:("Player_Action_19",), + 0x8084BBF0:("Player_Action_20",), + 0x8084BC64:("Player_Action_21",), + 0x8084BE40:("Player_Action_22",), + 0x8084BF28:("Player_Action_23",), + 0x8084BFDC:("Player_Action_24",), 0x8084C124:("func_8084C124",), - 0x8084C16C:("func_8084C16C",), - 0x8084C6EC:("func_8084C6EC",), - 0x8084C94C:("func_8084C94C",), - 0x8084CA24:("func_8084CA24",), - 0x8084CB58:("func_8084CB58",), - 0x8084CCEC:("func_8084CCEC",), - 0x8084CE84:("func_8084CE84",), - 0x8084D18C:("func_8084D18C",), - 0x8084D4EC:("func_8084D4EC",), - 0x8084D770:("func_8084D770",), - 0x8084D820:("func_8084D820",), - 0x8084E034:("func_8084E034",), - 0x8084E25C:("func_8084E25C",), - 0x8084E334:("func_8084E334",), - 0x8084E434:("func_8084E434",), - 0x8084E4E4:("func_8084E4E4",), - 0x8084E58C:("func_8084E58C",), - 0x8084E65C:("func_8084E65C",), - 0x8084E724:("func_8084E724",), - 0x8084E980:("func_8084E980",), - 0x8084ED9C:("func_8084ED9C",), - 0x8084EE50:("func_8084EE50",), - 0x8084EF9C:("func_8084EF9C",), - 0x8084F1B8:("func_8084F1B8",), - 0x8084F3DC:("func_8084F3DC",), - 0x8084F4E8:("func_8084F4E8",), - 0x8084FC0C:("func_8084FC0C",), + 0x8084C16C:("Player_Action_25",), + 0x8084C6EC:("Player_Action_26",), + 0x8084C94C:("Player_Action_27",), + 0x8084CA24:("Player_Action_28",), + 0x8084CB58:("Player_Action_29",), + 0x8084CCEC:("Player_Action_30",), + 0x8084CE84:("Player_Action_31",), + 0x8084D18C:("Player_Action_32",), + 0x8084D4EC:("Player_Action_33",), + 0x8084D770:("Player_Action_34",), + 0x8084D820:("Player_Action_35",), + 0x8084E034:("Player_Action_36",), + 0x8084E25C:("Player_Action_37",), + 0x8084E334:("Player_Action_38",), + 0x8084E434:("Player_Action_39",), + 0x8084E4E4:("Player_Action_40",), + 0x8084E58C:("Player_Action_41",), + 0x8084E65C:("Player_Action_42",), + 0x8084E724:("Player_Action_43",), + 0x8084E980:("Player_Action_44",), + 0x8084ED9C:("Player_Action_45",), + 0x8084EE50:("Player_Action_46",), + 0x8084EF9C:("Player_Action_47",), + 0x8084F1B8:("Player_Action_48",), + 0x8084F3DC:("Player_Action_49",), + 0x8084F4E8:("Player_Action_50",), + 0x8084FC0C:("Player_Action_51",), 0x8084FD7C:("func_8084FD7C",), 0x8084FE48:("func_8084FE48",), - 0x8084FE7C:("func_8084FE7C",), - 0x808505D0:("func_808505D0",), + 0x8084FE7C:("Player_Action_52",), + 0x808505D0:("Player_Action_53",), 0x80850734:("func_80850734",), 0x80850854:("func_80850854",), - 0x808508C8:("func_808508C8",), - 0x80850B18:("func_80850B18",), + 0x808508C8:("Player_Action_54",), + 0x80850B18:("Player_Action_55",), 0x80850BA8:("func_80850BA8",), 0x80850BF8:("func_80850BF8",), 0x80850D20:("func_80850D20",), - 0x80850D68:("func_80850D68",), - 0x808513EC:("func_808513EC",), - 0x80851588:("func_80851588",), - 0x808516B4:("func_808516B4",), - 0x808519FC:("func_808519FC",), - 0x80851B58:("func_80851B58",), - 0x80851BD4:("func_80851BD4",), + 0x80850D68:("Player_Action_56",), + 0x808513EC:("Player_Action_57",), + 0x80851588:("Player_Action_58",), + 0x808516B4:("Player_Action_59",), + 0x808519FC:("Player_Action_60",), + 0x80851B58:("Player_Action_61",), + 0x80851BD4:("Player_Action_62",), 0x80851C40:("func_80851C40",), 0x80851D30:("func_80851D30",), 0x80851EAC:("func_80851EAC",), @@ -4741,140 +4741,140 @@ 0x80852290:("func_80852290",), 0x8085255C:("func_8085255C",), 0x808525C4:("func_808525C4",), - 0x8085269C:("func_8085269C",), - 0x80852B28:("func_80852B28",), - 0x80852C04:("func_80852C04",), - 0x80852FD4:("func_80852FD4",), + 0x8085269C:("Player_Action_63",), + 0x80852B28:("Player_Action_64",), + 0x80852C04:("Player_Action_65",), + 0x80852FD4:("Player_Action_66",), 0x808530E0:("func_808530E0",), - 0x80853194:("func_80853194",), - 0x808534C0:("func_808534C0",), - 0x80853754:("func_80853754",), - 0x80853850:("func_80853850",), - 0x80853A5C:("func_80853A5C",), - 0x80853CC0:("func_80853CC0",), - 0x80853D68:("func_80853D68",), - 0x80854010:("func_80854010",), - 0x808540A0:("func_808540A0",), - 0x80854118:("func_80854118",), - 0x8085421C:("func_8085421C",), - 0x8085437C:("func_8085437C",), - 0x8085439C:("func_8085439C",), - 0x80854430:("func_80854430",), - 0x80854614:("func_80854614",), - 0x808546D0:("func_808546D0",), - 0x80854800:("func_80854800",), - 0x808548B8:("func_808548B8",), - 0x80854C70:("func_80854C70",), + 0x80853194:("Player_Action_67",), + 0x808534C0:("Player_Action_68",), + 0x80853754:("Player_Action_69",), + 0x80853850:("Player_Action_70",), + 0x80853A5C:("Player_Action_71",), + 0x80853CC0:("Player_Action_72",), + 0x80853D68:("Player_Action_73",), + 0x80854010:("Player_Action_74",), + 0x808540A0:("Player_Action_75",), + 0x80854118:("Player_Action_76",), + 0x8085421C:("Player_Action_77",), + 0x8085437C:("Player_Action_78",), + 0x8085439C:("Player_Action_79",), + 0x80854430:("Player_Action_80",), + 0x80854614:("Player_Action_81",), + 0x808546D0:("Player_Action_82",), + 0x80854800:("Player_Action_83",), + 0x808548B8:("Player_Action_84",), + 0x80854C70:("Player_Action_85",), 0x80854CD0:("func_80854CD0",), 0x80854EFC:("func_80854EFC",), 0x808550D0:("func_808550D0",), 0x80855218:("func_80855218",), - 0x808553F4:("func_808553F4",), - 0x80855818:("func_80855818",), - 0x80855A7C:("func_80855A7C",), - 0x80855AF4:("func_80855AF4",), - 0x80855B9C:("func_80855B9C",), - 0x80855C28:("func_80855C28",), - 0x80855E08:("func_80855E08",), + 0x808553F4:("Player_Action_86",), + 0x80855818:("Player_Action_87",), + 0x80855A7C:("Player_Action_88",), + 0x80855AF4:("Player_Action_89",), + 0x80855B9C:("Player_Action_90",), + 0x80855C28:("Player_Action_91",), + 0x80855E08:("Player_Action_92",), 0x80855F9C:("func_80855F9C",), 0x80856000:("func_80856000",), 0x80856074:("func_80856074",), 0x80856110:("func_80856110",), - 0x808561B0:("func_808561B0",), + 0x808561B0:("Player_Action_93",), 0x808566C0:("func_808566C0",), 0x8085687C:("func_8085687C",), 0x80856888:("func_80856888",), - 0x80856918:("func_80856918",), - 0x808573A4:("func_808573A4",), + 0x80856918:("Player_Action_94",), + 0x808573A4:("Player_Action_95",), 0x80857640:("func_80857640",), 0x808576BC:("func_808576BC",), 0x808577E0:("func_808577E0",), 0x80857950:("func_80857950",), 0x80857A44:("func_80857A44",), 0x80857AEC:("func_80857AEC",), - 0x80857BE8:("func_80857BE8",), + 0x80857BE8:("Player_Action_96",), 0x80858C84:("func_80858C84",), 0x80858CC8:("func_80858CC8",), 0x80858D48:("func_80858D48",), - 0x80858DB4:("func_80858DB4",), - 0x80858DDC:("func_80858DDC",), - 0x80858DFC:("func_80858DFC",), - 0x80858E40:("func_80858E40",), - 0x80858E60:("func_80858E60",), - 0x80858E80:("func_80858E80",), - 0x80858EA0:("func_80858EA0",), - 0x80858EC0:("func_80858EC0",), - 0x80858EFC:("func_80858EFC",), - 0x80858F1C:("func_80858F1C",), - 0x80858F3C:("func_80858F3C",), - 0x80858F5C:("func_80858F5C",), - 0x80858F7C:("func_80858F7C",), - 0x80858F9C:("func_80858F9C",), - 0x80858FBC:("func_80858FBC",), + 0x80858DB4:("Player_CsAnim_1",), + 0x80858DDC:("Player_CsAnim_2",), + 0x80858DFC:("Player_CsAnim_14",), + 0x80858E40:("Player_CsAnim_3",), + 0x80858E60:("Player_CsAnim_4",), + 0x80858E80:("Player_CsAnim_5",), + 0x80858EA0:("Player_CsAnim_6",), + 0x80858EC0:("Player_CsAnim_19",), + 0x80858EFC:("Player_CsAnim_7",), + 0x80858F1C:("Player_CsAnim_8",), + 0x80858F3C:("Player_CsAnim_9",), + 0x80858F5C:("Player_CsAnim_10",), + 0x80858F7C:("Player_CsAnim_15",), + 0x80858F9C:("Player_CsAnim_16",), + 0x80858FBC:("Player_CsAnim_11",), 0x80858FE8:("func_80858FE8",), - 0x80859028:("func_80859028",), - 0x80859168:("func_80859168",), - 0x808591BC:("func_808591BC",), - 0x80859210:("func_80859210",), + 0x80859028:("Player_CsAnim_12",), + 0x80859168:("Player_CsAnim_17",), + 0x808591BC:("Player_CsAnim_13",), + 0x80859210:("Player_CsAnim_18",), 0x80859248:("func_80859248",), 0x8085929C:("func_8085929C",), 0x80859300:("func_80859300",), - 0x80859414:("func_80859414",), - 0x808594D0:("func_808594D0",), - 0x808595B8:("func_808595B8",), - 0x8085968C:("func_8085968C",), - 0x80859708:("func_80859708",), - 0x8085978C:("func_8085978C",), - 0x80859890:("func_80859890",), - 0x80859990:("func_80859990",), - 0x808599DC:("func_808599DC",), - 0x80859A10:("func_80859A10",), - 0x80859A44:("func_80859A44",), - 0x80859AD0:("func_80859AD0",), - 0x80859AF8:("func_80859AF8",), - 0x80859B28:("func_80859B28",), - 0x80859B54:("func_80859B54",), + 0x80859414:("Player_CsAction_0",), + 0x808594D0:("Player_CsAction_1",), + 0x808595B8:("Player_CsAction_2",), + 0x8085968C:("Player_CsAction_3",), + 0x80859708:("Player_CsAction_4",), + 0x8085978C:("Player_CsAction_5",), + 0x80859890:("Player_CsAction_6",), + 0x80859990:("Player_CsAction_7",), + 0x808599DC:("Player_CsAction_8",), + 0x80859A10:("Player_CsAction_9",), + 0x80859A44:("Player_CsAction_10",), + 0x80859AD0:("Player_CsAction_11",), + 0x80859AF8:("Player_CsAction_12",), + 0x80859B28:("Player_CsAction_13",), + 0x80859B54:("Player_CsAction_14",), 0x80859BA8:("Player_Cutscene_Translate",), - 0x80859C60:("func_80859C60",), - 0x80859CA0:("func_80859CA0",), + 0x80859C60:("Player_CsAction_15",), + 0x80859CA0:("Player_CsAction_16",), 0x80859CE0:("func_80859CE0",), - 0x80859CFC:("func_80859CFC",), - 0x80859D44:("func_80859D44",), - 0x80859D70:("func_80859D70",), - 0x80859EBC:("func_80859EBC",), - 0x80859F4C:("func_80859F4C",), - 0x80859FCC:("func_80859FCC",), - 0x80859FF4:("func_80859FF4",), - 0x8085A04C:("Player_Cutscene_TranslateReverse",), - 0x8085A120:("func_8085A120",), - 0x8085A144:("func_8085A144",), - 0x8085A19C:("func_8085A19C",), - 0x8085A1D4:("func_8085A1D4",), - 0x8085A24C:("func_8085A24C",), - 0x8085A2AC:("func_8085A2AC",), - 0x8085A330:("func_8085A330",), - 0x8085A364:("func_8085A364",), - 0x8085A40C:("func_8085A40C",), - 0x8085A4A4:("func_8085A4A4",), - 0x8085A530:("func_8085A530",), - 0x8085A5DC:("func_8085A5DC",), - 0x8085A66C:("func_8085A66C",), - 0x8085A6C0:("func_8085A6C0",), - 0x8085A710:("func_8085A710",), - 0x8085A768:("func_8085A768",), - 0x8085A7C0:("func_8085A7C0",), - 0x8085A8C4:("func_8085A8C4",), - 0x8085A940:("func_8085A940",), - 0x8085AA10:("func_8085AA10",), - 0x8085AA60:("func_8085AA60",), - 0x8085AA84:("func_8085AA84",), - 0x8085AACC:("func_8085AACC",), + 0x80859CFC:("Player_CsAction_17",), + 0x80859D44:("Player_CsAction_18",), + 0x80859D70:("Player_CsAction_19",), + 0x80859EBC:("Player_CsAction_20",), + 0x80859F4C:("Player_CsAction_21",), + 0x80859FCC:("Player_CsAction_22",), + 0x80859FF4:("Player_CsAction_23",), + 0x8085A04C:("Player_CsAction_TranslateReverse",), + 0x8085A120:("Player_CsAction_25",), + 0x8085A144:("Player_CsAction_26",), + 0x8085A19C:("Player_CsAction_27",), + 0x8085A1D4:("Player_CsAction_28",), + 0x8085A24C:("Player_CsAction_29",), + 0x8085A2AC:("Player_CsAction_30",), + 0x8085A330:("Player_CsAction_31",), + 0x8085A364:("Player_CsAction_32",), + 0x8085A40C:("Player_CsAction_33",), + 0x8085A4A4:("Player_CsAction_34",), + 0x8085A530:("Player_CsAction_35",), + 0x8085A5DC:("Player_CsAction_36",), + 0x8085A66C:("Player_CsAction_37",), + 0x8085A6C0:("Player_CsAction_38",), + 0x8085A710:("Player_CsAction_39",), + 0x8085A768:("Player_CsAction_40",), + 0x8085A7C0:("Player_CsAction_41",), + 0x8085A8C4:("Player_CsAction_42",), + 0x8085A940:("Player_CsAction_43",), + 0x8085AA10:("Player_CsAction_44",), + 0x8085AA60:("Player_CsAction_45",), + 0x8085AA84:("Player_CsAction_46",), + 0x8085AACC:("Player_CsAction_End",), 0x8085AB58:("Player_Cutscene_SetPosAndYawToStart",), 0x8085ABA8:("Player_Cutscene_8085ABA8",), 0x8085AC9C:("func_8085AC9C",), 0x8085AD5C:("func_8085AD5C",), - 0x8085ADA0:("func_8085ADA0",), - 0x8085B08C:("func_8085B08C",), + 0x8085ADA0:("Player_CsAction_48",), + 0x8085B08C:("Player_Action_97",), 0x8085B134:("Player_StartFishing",), 0x8085B170:("func_8085B170",), 0x8085B1F0:("Player_GrabPlayer",), @@ -5806,7 +5806,7 @@ 0x808AAE1C:("EnOssan_PartTimer_Init",), 0x808AAE84:("EnOssan_CuriosityShopMan_GetWelcome",), 0x808AAFB0:("EnOssan_PartTimer_GetWelcome",), - 0x808AB0B0:("EnOssan_SetHaveMet",), + 0x808AB0B0:("EnOssan_SetTalked",), 0x808AB16C:("EnOssan_InitShop",), 0x808AB404:("EnOssan_GetCutscenes",), 0x808AB458:("EnOssan_Update",), @@ -6263,17 +6263,17 @@ 0x808CD238:("EnVm_Draw",), 0x808CD740:("DemoEffect_Init",), 0x808CD8E8:("DemoEffect_Destroy",), - 0x808CD940:("func_808CD940",), - 0x808CD998:("func_808CD998",), - 0x808CDAD0:("func_808CDAD0",), - 0x808CDBDC:("func_808CDBDC",), - 0x808CDCEC:("func_808CDCEC",), - 0x808CDD70:("func_808CDD70",), - 0x808CDDE0:("func_808CDDE0",), + 0x808CD940:("DemoEffect_WaitForObject",), + 0x808CD998:("DemoEffect_SetupTimewarp",), + 0x808CDAD0:("DemoEffect_SetPerVertexAlpha",), + 0x808CDBDC:("DemoEffect_FinishTimewarp",), + 0x808CDCEC:("DemoEffect_StartTimewarp",), + 0x808CDD70:("DemoEffect_ShrinkLight",), + 0x808CDDE0:("DemoEffect_ExpandLight",), 0x808CDE54:("DemoEffect_Update",), - 0x808CDE78:("func_808CDE78",), - 0x808CDFF8:("func_808CDFF8",), - 0x808CE078:("func_808CE078",), + 0x808CDE78:("DemoEffect_OverrideLimbDrawTimewarp",), + 0x808CDFF8:("DemoEffect_DrawTimewarp",), + 0x808CE078:("DemoEffect_DrawLight",), 0x808CE450:("DemoKankyo_SetupAction",), 0x808CE45C:("func_808CE45C",), 0x808CF06C:("func_808CF06C",), @@ -6473,24 +6473,24 @@ 0x808DD970:("func_808DD970",), 0x808DDE74:("func_808DDE74",), 0x808DDE9C:("func_808DDE9C",), - 0x808DE5C0:("func_808DE5C0",), - 0x808DE660:("func_808DE660",), - 0x808DE728:("func_808DE728",), + 0x808DE5C0:("EnHorseLinkChild_PlayWalkingSound",), + 0x808DE660:("EnHorseLinkChild_PlaySound",), + 0x808DE728:("EnHorseLinkChild_GetAnimSpeed",), 0x808DE7F0:("EnHorseLinkChild_Init",), 0x808DE958:("EnHorseLinkChild_Destroy",), - 0x808DE9A8:("func_808DE9A8",), - 0x808DEA0C:("func_808DEA0C",), - 0x808DEA54:("func_808DEA54",), - 0x808DEB14:("func_808DEB14",), - 0x808DECA0:("func_808DECA0",), - 0x808DED40:("func_808DED40",), - 0x808DEFE8:("func_808DEFE8",), + 0x808DE9A8:("EnHorseLinkChild_SetupActionFunc0",), + 0x808DEA0C:("EnHorseLinkChild_ActionFunc0",), + 0x808DEA54:("EnHorseLinkChild_SetupWaitForPlayer",), + 0x808DEB14:("EnHorseLinkChild_WaitForPlayer",), + 0x808DECA0:("EnHorseLinkChild_SetupGreetPlayer",), + 0x808DED40:("EnHorseLinkChild_GreetPlayer",), + 0x808DEFE8:("EnHorseLinkChild_SetupLonLonIdle",), 0x808DF088:("func_808DF088",), - 0x808DF194:("func_808DF194",), - 0x808DF560:("func_808DF560",), - 0x808DF620:("func_808DF620",), - 0x808DF788:("func_808DF788",), - 0x808DF838:("func_808DF838",), + 0x808DF194:("EnHorseLinkChild_LonLonIdle",), + 0x808DF560:("EnHorseLinkChild_SetupActionFunc5",), + 0x808DF620:("EnHorseLinkChild_ActionFunc5",), + 0x808DF788:("EnHorseLinkChild_SetupActionFunc4",), + 0x808DF838:("EnHorseLinkChild_ActionFunc4",), 0x808DFB14:("EnHorseLinkChild_Update",), 0x808DFC3C:("EnHorseLinkChild_PostSkinDraw",), 0x808DFDC8:("EnHorseLinkChild_OverrideSkinDraw",), @@ -6517,7 +6517,7 @@ 0x808E13FC:("DemoTreLgt_Draw",), 0x808E1560:("EnEncount2_Init",), 0x808E16B4:("EnEncount2_Destroy",), - 0x808E16FC:("EnEncount2_SetIdle",), + 0x808E16FC:("EnEncount2_SetupIdle",), 0x808E1714:("EnEncount2_Idle",), 0x808E17C4:("EnEncount2_Popped",), 0x808E18A8:("EnEncount2_Die",), @@ -7118,7 +7118,7 @@ 0x8092C550:("DemoShd_Update",), 0x8092C560:("DemoShd_Draw",), 0x8092C5C0:("func_8092C5C0",), - 0x8092C63C:("func_8092C63C",), + 0x8092C63C:("EnDns_ChangeAnim",), 0x8092C6FC:("func_8092C6FC",), 0x8092C740:("func_8092C740",), 0x8092C86C:("func_8092C86C",), @@ -7136,7 +7136,7 @@ 0x8092D320:("func_8092D320",), 0x8092D330:("func_8092D330",), 0x8092D4D8:("func_8092D4D8",), - 0x8092D5E8:("func_8092D5E8",), + 0x8092D5E8:("EnDns_HandleCutscene",), 0x8092D6C0:("EnDns_Init",), 0x8092D820:("EnDns_Destroy",), 0x8092D84C:("EnDns_Update",), @@ -7502,7 +7502,7 @@ 0x80942D34:("EnGoroiwa_Draw",), 0x809434B0:("EnDaiku_Init",), 0x80943710:("EnDaiku_Destroy",), - 0x8094373C:("func_8094373C",), + 0x8094373C:("EnDaiku_ChangeAnim",), 0x809437C8:("func_809437C8",), 0x80943820:("func_80943820",), 0x809438F8:("func_809438F8",), @@ -7580,8 +7580,8 @@ 0x80949BD4:("EnClearTag_DrawEffects",), 0x8094DEE0:("func_8094DEE0",), 0x8094DF90:("func_8094DF90",), - 0x8094DFF8:("func_8094DFF8",), - 0x8094E054:("func_8094E054",), + 0x8094DFF8:("EnGm_UpdateSkelAnime",), + 0x8094E054:("EnGm_ChangeAnim",), 0x8094E0F8:("func_8094E0F8",), 0x8094E1DC:("func_8094E1DC",), 0x8094E278:("func_8094E278",), @@ -8641,20 +8641,20 @@ 0x8099FD7C:("func_8099FD7C",), 0x8099FEB0:("EnGe3_Init",), 0x809A0044:("EnGe3_Destroy",), - 0x809A0070:("func_809A0070",), - 0x809A00F8:("func_809A00F8",), - 0x809A020C:("func_809A020C",), - 0x809A024C:("func_809A024C",), - 0x809A0350:("func_809A0350",), - 0x809A03AC:("func_809A03AC",), - 0x809A03FC:("func_809A03FC",), - 0x809A04D0:("func_809A04D0",), - 0x809A0820:("func_809A0820",), - 0x809A08A4:("func_809A08A4",), + 0x809A0070:("EnGe3_ChangeAnim",), + 0x809A00F8:("EnGe3_LookAtPlayer",), + 0x809A020C:("EnGe3_SetupPath",), + 0x809A024C:("EnGe3_FollowPath",), + 0x809A0350:("EnGe3_Scream",), + 0x809A03AC:("EnGe3_Idle",), + 0x809A03FC:("EnGe3_ThrowPlayerOut",), + 0x809A04D0:("EnGe3_AveilsChamberIdle",), + 0x809A0820:("EnGe3_UpdateColliderAndMove",), + 0x809A08A4:("EnGe3_Blink",), 0x809A0920:("EnGe3_Update",), - 0x809A096C:("func_809A096C",), - 0x809A0A14:("func_809A0A14",), - 0x809A0C60:("func_809A0C60",), + 0x809A096C:("EnGe3_ValidatePictograph",), + 0x809A0A14:("EnGe3_OverrideLimbDraw",), + 0x809A0C60:("EnGe3_PostLimbDraw",), 0x809A0CBC:("EnGe3_Draw",), 0x809A0F20:("func_809A0F20",), 0x809A0F78:("func_809A0F78",), @@ -8743,10 +8743,10 @@ 0x809A5B50:("ObjArmos_Draw",), 0x809A5D10:("ObjBoyo_Init",), 0x809A5D94:("ObjBoyo_Destroy",), - 0x809A5DC0:("func_809A5DC0",), - 0x809A5DE0:("func_809A5DE0",), - 0x809A5E14:("func_809A5E14",), - 0x809A5E24:("func_809A5E24",), + 0x809A5DC0:("ObjBoyo_PushPlayer",), + 0x809A5DE0:("ObjBoyo_PushPirate",), + 0x809A5E14:("ObjBoyo_ExplodeBomb",), + 0x809A5E24:("ObjBoyo_FindCollidedActor",), 0x809A5E98:("ObjBoyo_Update",), 0x809A610C:("ObjBoyo_Draw",), 0x809A6280:("EnGrasshopper_Init",), @@ -9057,7 +9057,7 @@ 0x809C467C:("EnEncount4_Update",), 0x809C4790:("EnBomBowlMan_Init",), 0x809C492C:("EnBomBowlMan_Destroy",), - 0x809C493C:("func_809C493C",), + 0x809C493C:("EnBomBowlMan_ChangeAnim",), 0x809C49CC:("func_809C49CC",), 0x809C4B50:("func_809C4B50",), 0x809C4B6C:("func_809C4B6C",), @@ -9292,9 +9292,9 @@ 0x809D6C98:("func_809D6C98",), 0x809D6E7C:("func_809D6E7C",), 0x809D73D4:("func_809D73D4",), - 0x809DA1D0:("func_809DA1D0",), - 0x809DA22C:("func_809DA22C",), - 0x809DA24C:("func_809DA24C",), + 0x809DA1D0:("Boss02_FillScreen",), + 0x809DA22C:("Boss02_SetFillScreenAlpha",), + 0x809DA24C:("Boss02_StopFillScreen",), 0x809DA264:("Boss02_SpawnEffectSand",), 0x809DA344:("Boss02_SpawnEffectFragment",), 0x809DA460:("Boss02_SpawnEffectFlash",), @@ -9313,7 +9313,7 @@ 0x809DD0A8:("Boss02_Static_Draw",), 0x809DD0CC:("Boss02_UpdateEffects",), 0x809DD2F8:("Boss02_DrawEffects",), - 0x809DD934:("func_809DD934",), + 0x809DD934:("Boss02_HandleGiantsMaskCutscene",), 0x809DEAC4:("func_809DEAC4",), 0x809E2760:("Boss03_PlayUnderwaterSfx",), 0x809E2788:("Boss03_SpawnEffectWetSpot",), @@ -9573,9 +9573,9 @@ 0x80A07740:("func_80A07740",), 0x80A0A8A0:("BgDyYoseizo_Init",), 0x80A0A95C:("BgDyYoseizo_Destroy",), - 0x80A0A96C:("func_80A0A96C",), - 0x80A0A9E4:("func_80A0A9E4",), - 0x80A0AA40:("func_80A0AA40",), + 0x80A0A96C:("BgDyYoseizo_UpdateEyes",), + 0x80A0A9E4:("BgDyYoseizo_Bob",), + 0x80A0AA40:("BgDyYoseizo_SpawnEffects",), 0x80A0AD50:("func_80A0AD50",), 0x80A0AE1C:("func_80A0AE1C",), 0x80A0AFDC:("func_80A0AFDC",), @@ -9587,14 +9587,14 @@ 0x80A0B5F0:("func_80A0B5F0",), 0x80A0B75C:("func_80A0B75C",), 0x80A0B834:("func_80A0B834",), - 0x80A0B8CC:("func_80A0B8CC",), + 0x80A0B8CC:("BgDyYoseizo_TrainPlayer",), 0x80A0BB08:("func_80A0BB08",), 0x80A0BC84:("BgDyYoseizo_Update",), - 0x80A0BCD8:("func_80A0BCD8",), - 0x80A0BD40:("func_80A0BD40",), - 0x80A0BE60:("func_80A0BE60",), - 0x80A0BF70:("func_80A0BF70",), - 0x80A0C270:("func_80A0C270",), + 0x80A0BCD8:("BgDyYoseizo_OverrideLimbDraw",), + 0x80A0BD40:("BgDyYoseizo_Draw",), + 0x80A0BE60:("BgDyYoseizo_SpawnEffect",), + 0x80A0BF70:("BgDyYoseizo_UpdateEffects",), + 0x80A0C270:("BgDyYoseizo_DrawEffects",), 0x80A0C780:("EnBoj05_Init",), 0x80A0C790:("EnBoj05_Destroy",), 0x80A0C7A0:("EnBoj05_Update",), @@ -9607,7 +9607,7 @@ 0x80A0CC88:("EnSob1_GetGoodbye",), 0x80A0CCEC:("EnSob1_BombShopkeeper_EndInteraction",), 0x80A0CD48:("EnSob1_SpawnShopItems",), - 0x80A0CE10:("EnSob1_GetObjIndices",), + 0x80A0CE10:("EnSob1_GetObjectIndices",), 0x80A0CED4:("EnSob1_Init",), 0x80A0D008:("EnSob1_Destroy",), 0x80A0D034:("EnSob1_UpdateCursorPos",), @@ -9696,7 +9696,7 @@ 0x80A12774:("EnGo_UpdateTalking",), 0x80A12868:("EnGo_DetectCollisions",), 0x80A12954:("EnGo_UpdateSpringArrivalCutscene",), - 0x80A12A64:("EnGo_UpdateAnimationToCurrent",), + 0x80A12A64:("EnGo_UpdateSkelAnime",), 0x80A12B78:("EnGo_UpdateSfx",), 0x80A12C48:("EnGo_ChangeAnim",), 0x80A12D6C:("EnGo_UpdateEyes",), @@ -10092,7 +10092,7 @@ 0x80A2D0FC:("ElfMsg3_Update",), 0x80A2D280:("EnFg_ChangeAnim",), 0x80A2D348:("func_80A2D348",), - 0x80A2D3D4:("func_80A2D3D4",), + 0x80A2D3D4:("EnFg_UpdateSkelAnime",), 0x80A2D400:("func_80A2D400",), 0x80A2D42C:("func_80A2D42C",), 0x80A2D4B8:("func_80A2D4B8",), @@ -10113,7 +10113,7 @@ 0x80A2E838:("DmRavine_DoNothing",), 0x80A2E848:("DmRavine_Update",), 0x80A2E8F4:("DmRavine_Draw",), - 0x80A2E960:("func_80A2E960",), + 0x80A2E960:("DmSa_ChangeAnim",), 0x80A2E9FC:("DmSa_Init",), 0x80A2EAAC:("DmSa_Destroy",), 0x80A2EABC:("DmSa_DoNothing",), @@ -10217,38 +10217,38 @@ 0x80A35DDC:("ObjBell_Draw",), 0x80A35FF0:("EnSyatekiOkuta_Init",), 0x80A3611C:("EnSyatekiOkuta_Destroy",), - 0x80A36148:("func_80A36148",), - 0x80A361B0:("func_80A361B0",), - 0x80A361F4:("func_80A361F4",), - 0x80A36260:("func_80A36260",), - 0x80A362A8:("func_80A362A8",), - 0x80A362F8:("func_80A362F8",), - 0x80A36350:("func_80A36350",), - 0x80A36360:("func_80A36360",), - 0x80A363B4:("func_80A363B4",), - 0x80A36444:("func_80A36444",), - 0x80A36488:("func_80A36488",), - 0x80A364C0:("func_80A364C0",), - 0x80A36504:("func_80A36504",), - 0x80A3657C:("func_80A3657C",), - 0x80A365EC:("func_80A365EC",), - 0x80A368E0:("func_80A368E0",), - 0x80A36A90:("func_80A36A90",), - 0x80A36AF8:("func_80A36AF8",), + 0x80A36148:("EnSyatekiOkuta_SpawnDust",), + 0x80A361B0:("EnSyatekiOkuta_SpawnSplash",), + 0x80A361F4:("EnSyatekiOkuta_IsHiddenByAnotherOctorok",), + 0x80A36260:("EnSyatekiOkuta_SetupAttachToShootingGalleryMan",), + 0x80A362A8:("EnSyatekiOkuta_AttachToShootingGalleryMan",), + 0x80A362F8:("EnSyatekiOkuta_SetupDoNothing",), + 0x80A36350:("EnSyatekiOkuta_DoNothing",), + 0x80A36360:("EnSyatekiOkuta_SetupAppear",), + 0x80A363B4:("EnSyatekiOkuta_Appear",), + 0x80A36444:("EnSyatekiOkuta_SetupFloat",), + 0x80A36488:("EnSyatekiOkuta_Float",), + 0x80A364C0:("EnSyatekiOkuta_SetupHide",), + 0x80A36504:("EnSyatekiOkuta_Hide",), + 0x80A3657C:("EnSyatekiOkuta_SetupDie",), + 0x80A365EC:("EnSyatekiOkuta_Die",), + 0x80A368E0:("EnSyatekiOkuta_UpdateCollision",), + 0x80A36A90:("EnSyatekiOkuta_CheckCollision",), + 0x80A36AF8:("EnSyatekiOkuta_CheckForSignal",), 0x80A36B9C:("EnSyatekiOkuta_Update",), - 0x80A36CB0:("func_80A36CB0",), - 0x80A370EC:("func_80A370EC",), + 0x80A36CB0:("EnSyatekiOkuta_UpdateHeadScale",), + 0x80A370EC:("EnSyatekiOkuta_GetSnoutScale",), 0x80A37294:("EnSyatekiOkuta_OverrideLimbDraw",), 0x80A3735C:("EnSyatekiOkuta_Draw",), 0x80A37ED0:("ObjShutter_Init",), 0x80A37EE0:("ObjShutter_Destroy",), 0x80A37EF0:("ObjShutter_Update",), 0x80A3803C:("ObjShutter_Draw",), - 0x80A38190:("DmZl_ChangeAnimation",), + 0x80A38190:("DmZl_ChangeAnim",), 0x80A3822C:("DmZl_Init",), 0x80A382EC:("DmZl_Destroy",), 0x80A382FC:("DmZl_DoNothing",), - 0x80A3830C:("DmZl_UpdateCutscene",), + 0x80A3830C:("DmZl_HandleCutscene",), 0x80A38468:("DmZl_UpdateFace",), 0x80A385D4:("DmZl_Update",), 0x80A3862C:("DmZl_OverrideLimbDraw",), @@ -10266,16 +10266,16 @@ 0x80A38FB4:("EnRu_OverrideLimbdraw",), 0x80A390F8:("EnRu_PostLimbdraw",), 0x80A39204:("EnRu_Draw",), - 0x80A396B0:("func_80A396B0",), + 0x80A396B0:("EnElfgrp_SetCutscene",), 0x80A3970C:("EnElfgrp_Init",), 0x80A39BC0:("EnElfgrp_Destroy",), - 0x80A39BD0:("func_80A39BD0",), - 0x80A39C1C:("func_80A39C1C",), - 0x80A39CD4:("func_80A39CD4",), - 0x80A39DC8:("func_80A39DC8",), - 0x80A39F50:("func_80A39F50",), - 0x80A39FBC:("func_80A39FBC",), - 0x80A3A044:("func_80A3A044",), + 0x80A39BD0:("EnElfgrp_GetHeldFairiesCount",), + 0x80A39C1C:("EnElfgrp_GetFountainFairiesCount",), + 0x80A39CD4:("EnElfgrp_SetFountainFairiesCount",), + 0x80A39DC8:("EnElfgrp_SpawnStrayFairies",), + 0x80A39F50:("EnElfgrp_SummonStrayFairies",), + 0x80A39FBC:("EnElfgrp_SpinStrayFairies",), + 0x80A3A044:("EnElfgrp_VanishStrayFairies",), 0x80A3A0AC:("func_80A3A0AC",), 0x80A3A0F4:("func_80A3A0F4",), 0x80A3A210:("func_80A3A210",), @@ -10284,8 +10284,8 @@ 0x80A3A484:("func_80A3A484",), 0x80A3A4AC:("func_80A3A4AC",), 0x80A3A520:("func_80A3A520",), - 0x80A3A600:("func_80A3A600",), - 0x80A3A610:("func_80A3A610",), + 0x80A3A600:("EnElfgrp_DoNothing",), + 0x80A3A610:("EnElfgrp_HealPlayer",), 0x80A3A6F4:("func_80A3A6F4",), 0x80A3A77C:("func_80A3A77C",), 0x80A3A7FC:("func_80A3A7FC",), @@ -10546,8 +10546,8 @@ 0x80A4F4C8:("func_80A4F4C8",), 0x80A4FA40:("DemoGetitem_Init",), 0x80A4FB00:("DemoGetitem_Destroy",), - 0x80A4FB10:("func_80A4FB10",), - 0x80A4FB68:("func_80A4FB68",), + 0x80A4FB10:("DemoGetitem_Wait",), + 0x80A4FB68:("DemoGetitem_PerformCutsceneActions",), 0x80A4FCCC:("DemoGetitem_Update",), 0x80A4FCF0:("DemoGetitem_Draw",), 0x80A4FDD0:("func_80A4FDD0",), @@ -10574,10 +10574,10 @@ 0x80A510E0:("EnDnh_Update",), 0x80A51168:("func_80A51168",), 0x80A511B4:("EnDnh_Draw",), - 0x80A514F0:("func_80A514F0",), + 0x80A514F0:("EnDnk_ChangeAnim",), 0x80A515C4:("func_80A515C4",), 0x80A51648:("func_80A51648",), - 0x80A51890:("func_80A51890",), + 0x80A51890:("EnDnk_HandleCutscene",), 0x80A518DC:("func_80A518DC",), 0x80A518EC:("EnDnk_Init",), 0x80A519A8:("EnDnk_Destroy",), @@ -10592,7 +10592,7 @@ 0x80A52074:("func_80A52074",), 0x80A52134:("func_80A52134",), 0x80A52530:("EnDnq_ValidatePictograph",), - 0x80A5257C:("func_80A5257C",), + 0x80A5257C:("EnDnq_ChangeAnim",), 0x80A52604:("func_80A52604",), 0x80A52648:("func_80A52648",), 0x80A526F8:("func_80A526F8",), @@ -10604,7 +10604,7 @@ 0x80A52D44:("func_80A52D44",), 0x80A52DC8:("func_80A52DC8",), 0x80A52FB8:("func_80A52FB8",), - 0x80A53038:("func_80A53038",), + 0x80A53038:("EnDnq_HandleCutscene",), 0x80A5313C:("EnDnq_Init",), 0x80A53258:("EnDnq_Destroy",), 0x80A53284:("EnDnq_Update",), @@ -10752,48 +10752,48 @@ 0x80A61040:("BgSpoutFire_Draw",), 0x80A612B0:("EnDyExtra_Destroy",), 0x80A612C0:("EnDyExtra_Init",), - 0x80A61334:("func_80A61334",), - 0x80A613C8:("func_80A613C8",), + 0x80A61334:("EnDyExtra_WaitForTrigger",), + 0x80A613C8:("EnDyExtra_Fall",), 0x80A61470:("EnDyExtra_Update",), 0x80A614C4:("EnDyExtra_Draw",), 0x80A61810:("EnBal_Init",), 0x80A619EC:("EnBal_Destroy",), - 0x80A61A18:("func_80A61A18",), - 0x80A61A44:("func_80A61A44",), + 0x80A61A18:("EnBal_SetMainColliderToBalloon",), + 0x80A61A44:("EnBal_SetMainColliderToHead",), 0x80A61A6C:("EnBal_ValidatePictograph",), - 0x80A61ADC:("func_80A61ADC",), - 0x80A61B5C:("func_80A61B5C",), - 0x80A61C9C:("func_80A61C9C",), - 0x80A61CE4:("func_80A61CE4",), - 0x80A61DF8:("func_80A61DF8",), - 0x80A61E5C:("func_80A61E5C",), - 0x80A62128:("func_80A62128",), - 0x80A621C4:("func_80A621C4",), - 0x80A62260:("func_80A62260",), - 0x80A622A0:("func_80A622A0",), - 0x80A623CC:("func_80A623CC",), - 0x80A624DC:("func_80A624DC",), - 0x80A62818:("func_80A62818",), - 0x80A62830:("func_80A62830",), - 0x80A629C4:("func_80A629C4",), - 0x80A62AC4:("func_80A62AC4",), - 0x80A62B30:("func_80A62B30",), - 0x80A62B78:("func_80A62B78",), - 0x80A62CF0:("func_80A62CF0",), - 0x80A62DCC:("func_80A62DCC",), - 0x80A62ED0:("func_80A62ED0",), - 0x80A62FAC:("func_80A62FAC",), - 0x80A63158:("func_80A63158",), - 0x80A634B4:("func_80A634B4",), - 0x80A634C8:("func_80A634C8",), - 0x80A635DC:("func_80A635DC",), - 0x80A635F0:("func_80A635F0",), - 0x80A636AC:("func_80A636AC",), - 0x80A637FC:("func_80A637FC",), - 0x80A63884:("func_80A63884",), + 0x80A61ADC:("EnBal_SetupFloatIdle",), + 0x80A61B5C:("EnBal_FloatIdle",), + 0x80A61C9C:("EnBal_SetupPopBalloon",), + 0x80A61CE4:("EnBal_PopBalloon",), + 0x80A61DF8:("EnBal_SetupFall",), + 0x80A61E5C:("EnBal_Fall",), + 0x80A62128:("EnBal_SetupInflateBalloon",), + 0x80A621C4:("EnBal_InflateBalloon",), + 0x80A62260:("EnBal_SetupFloatUp",), + 0x80A622A0:("EnBal_FloatUp",), + 0x80A623CC:("EnBal_SetupGroundIdle",), + 0x80A624DC:("EnBal_GroundIdle",), + 0x80A62818:("EnBal_SetupTalk",), + 0x80A62830:("EnBal_Talk",), + 0x80A629C4:("EnBal_UpdateShadow",), + 0x80A62AC4:("EnBal_SetRecognizedPlayerForm",), + 0x80A62B30:("EnBal_GetRecognizedPlayerForm",), + 0x80A62B78:("EnBal_ThrowMagicSparkles",), + 0x80A62CF0:("EnBal_EmitDustPuff",), + 0x80A62DCC:("EnBal_CheckIfMapUnlocked",), + 0x80A62ED0:("EnBal_UnlockSelectedAreaMap",), + 0x80A62FAC:("EnBal_TryPurchaseMap",), + 0x80A63158:("EnBal_HandleConversation",), + 0x80A634B4:("EnBal_SetupOfferGetItem",), + 0x80A634C8:("EnBal_OfferGetItem",), + 0x80A635DC:("EnBal_SetupThankYou",), + 0x80A635F0:("EnBal_ThankYou",), + 0x80A636AC:("EnBal_UpdateHead",), + 0x80A637FC:("EnBal_UpdateCollision",), + 0x80A63884:("EnBal_TryBalloonPopped",), 0x80A63914:("EnBal_Update",), - 0x80A63A10:("func_80A63A10",), - 0x80A63B94:("func_80A63B94",), + 0x80A63A10:("EnBal_OverrideLimbDraw",), + 0x80A63B94:("EnBal_PostLimbDraw",), 0x80A63BEC:("EnBal_Draw",), 0x80A644A0:("EnGinkoMan_Init",), 0x80A64544:("EnGinkoMan_Destroy",), @@ -11338,28 +11338,28 @@ 0x80A90468:("EnTest5_Destroy",), 0x80A90478:("EnTest5_HandleBottleAction",), 0x80A905A4:("EnTest5_Update",), - 0x80A90730:("func_80A90730",), + 0x80A90730:("EnTest6_SetupCutscene",), 0x80A90C08:("EnTest6_EnableMotionBlur",), 0x80A90C34:("EnTest6_DisableMotionBlur",), - 0x80A90C54:("func_80A90C54",), - 0x80A90D20:("func_80A90D20",), - 0x80A90D34:("func_80A90D34",), - 0x80A90FC0:("func_80A90FC0",), + 0x80A90C54:("EnTest6_EnableWhiteFillScreen",), + 0x80A90D20:("EnTest6_DisableWhiteFillScreen",), + 0x80A90D34:("EnTest6_DrawAmmoDropDefault",), + 0x80A90FC0:("EnTest6_DrawAmmoDropRupee",), 0x80A91324:("EnTest6_SetupAction",), 0x80A91330:("EnTest6_Init",), 0x80A9149C:("EnTest6_Destroy",), - 0x80A9156C:("func_80A9156C",), - 0x80A91690:("func_80A91690",), - 0x80A916F0:("func_80A916F0",), - 0x80A91760:("func_80A91760",), - 0x80A920C8:("func_80A920C8",), - 0x80A92118:("func_80A92118",), - 0x80A92188:("func_80A92188",), + 0x80A9156C:("EnTest6_StartCutscene",), + 0x80A91690:("EnTest6_SetupInvertedSoTCutscene",), + 0x80A916F0:("EnTest6_StopInvertedSoTCutscene",), + 0x80A91760:("EnTest6_InvertedSoTCutscene",), + 0x80A920C8:("EnTest6_SetupDoubleSoTCutscene",), + 0x80A92118:("EnTest6_StopDoubleSoTCutscene",), + 0x80A92188:("EnTest6_DoubleSoTCutscene",), 0x80A9292C:("EnTest6_Update",), - 0x80A92950:("func_80A92950",), - 0x80A93298:("func_80A93298",), - 0x80A9369C:("func_80A9369C",), - 0x80A939E8:("func_80A939E8",), + 0x80A92950:("EnTest6_SharedSoTCutscene",), + 0x80A93298:("EnTest6_DrawThreeDayResetSoTCutscene",), + 0x80A9369C:("EnTest6_DrawDoubleSoTCutscene",), + 0x80A939E8:("EnTest6_DrawInvertedSoTCutscene",), 0x80A93DE8:("EnTest6_Draw",), 0x80A94A30:("func_80A94A30",), 0x80A94A64:("func_80A94A64",), @@ -11497,7 +11497,7 @@ 0x80AA1AF8:("DmStk_ClockTower_AdjustHeightAndRotation",), 0x80AA1B9C:("DmStk_ClockTower_DeflectHit",), 0x80AA1C64:("DmStk_ClockTower_WaitForDeflectionToEnd",), - 0x80AA1D1C:("DmStk_UpdateCutscenes",), + 0x80AA1D1C:("DmStk_HandleCutscene",), 0x80AA26CC:("DmStk_UpdateCollision",), 0x80AA2720:("DmStk_ClockTower_IdleWithOcarina",), 0x80AA27EC:("DmStk_ClockTower_Idle",), @@ -11506,7 +11506,7 @@ 0x80AA2BC0:("DmStk_PostLimbDraw2",), 0x80AA33A4:("DmStk_PostLimbDraw",), 0x80AA33CC:("DmStk_Draw",), - 0x80AA5580:("func_80AA5580",), + 0x80AA5580:("DmChar00_ChangeAnim",), 0x80AA561C:("func_80AA561C",), 0x80AA5720:("func_80AA5720",), 0x80AA575C:("func_80AA575C",), @@ -11526,7 +11526,7 @@ 0x80AA5EBC:("func_80AA5EBC",), 0x80AA6178:("DmChar00_Init",), 0x80AA62EC:("DmChar00_Destroy",), - 0x80AA62FC:("func_80AA62FC",), + 0x80AA62FC:("DmChar00_HandleCutscene",), 0x80AA67F8:("func_80AA67F8",), 0x80AA695C:("func_80AA695C",), 0x80AA6A04:("DmChar00_Update",), @@ -11552,7 +11552,7 @@ 0x80AAAF2C:("DmChar02_PlaySfxForCutscenes",), 0x80AAAF78:("DmChar02_Init",), 0x80AAB03C:("DmChar02_Destroy",), - 0x80AAB04C:("DmChar02_PerformCutsceneActions",), + 0x80AAB04C:("DmChar02_HandleCutscene",), 0x80AAB19C:("DmChar02_Update",), 0x80AAB23C:("DmChar02_OverrideLimbDraw",), 0x80AAB258:("DmChar02_PostLimbDraw",), @@ -11575,11 +11575,11 @@ 0x80AABC40:("DmChar04_ChangeAnim",), 0x80AABCDC:("DmChar04_Init",), 0x80AABE24:("DmChar04_Destroy",), - 0x80AABE34:("func_80AABE34",), + 0x80AABE34:("DmChar04_HandleCutscene",), 0x80AABF28:("DmChar04_Update",), 0x80AABF74:("DmChar04_OverrideLimbDraw",), 0x80AAC03C:("DmChar04_Draw",), - 0x80AAC5A0:("func_80AAC5A0",), + 0x80AAC5A0:("DmChar05_ChangeAnim",), 0x80AAC63C:("func_80AAC63C",), 0x80AAC6E4:("func_80AAC6E4",), 0x80AAC770:("func_80AAC770",), @@ -11620,7 +11620,7 @@ 0x80AAE680:("DmChar06_SetupAction",), 0x80AAE68C:("DmChar06_Init",), 0x80AAE6E0:("DmChar06_Destroy",), - 0x80AAE6F0:("func_80AAE6F0",), + 0x80AAE6F0:("DmChar06_HandleCutscene",), 0x80AAE854:("DmChar06_Update",), 0x80AAE878:("DmChar06_Draw",), 0x80AAE9C0:("DmChar07_SetupAction",), @@ -11645,8 +11645,8 @@ 0x80AAFBA4:("DmChar08_SpawnBubbles",), 0x80AAFCCC:("func_80AAFCCC",), 0x80AAFE78:("DmChar08_DoNothing",), - 0x80AAFE88:("func_80AAFE88",), - 0x80AB01E8:("func_80AB01E8",), + 0x80AAFE88:("DmChar08_HandleCutscene",), + 0x80AB01E8:("DmChar08_UpdateAnim",), 0x80AB023C:("func_80AB023C",), 0x80AB032C:("func_80AB032C",), 0x80AB096C:("func_80AB096C",), @@ -11662,7 +11662,7 @@ 0x80AB1FA0:("func_80AB1FA0",), 0x80AB1FDC:("func_80AB1FDC",), 0x80AB2258:("DmChar09_DoNothing",), - 0x80AB2268:("func_80AB2268",), + 0x80AB2268:("DmChar09_HandleCutscene",), 0x80AB24BC:("func_80AB24BC",), 0x80AB2544:("DmChar09_Update",), 0x80AB25D8:("DmChar09_OverrideLimbDraw",), @@ -11830,7 +11830,7 @@ 0x80ABCF0C:("BgHakuginBombwall_Draw",), 0x80ABD1D0:("ObjTokeiTobira_Init",), 0x80ABD37C:("ObjTokeiTobira_Destroy",), - 0x80ABD3B0:("func_80ABD3B0",), + 0x80ABD3B0:("ObjTokeiTobira_StartCutscene",), 0x80ABD424:("ObjTokeiTobira_Update",), 0x80ABD6F0:("ObjTokeiTobira_Draw",), 0x80ABD830:("BgHakuginElvpole_Init",), @@ -12240,44 +12240,44 @@ 0x80AD6CBC:("BgLotus_Draw",), 0x80AD6DD0:("EnKame_Init",), 0x80AD6F08:("EnKame_Destroy",), - 0x80AD6F34:("func_80AD6F34",), - 0x80AD6F9C:("func_80AD6F9C",), - 0x80AD7018:("func_80AD7018",), - 0x80AD70A0:("func_80AD70A0",), - 0x80AD70EC:("func_80AD70EC",), - 0x80AD71B4:("func_80AD71B4",), - 0x80AD7254:("func_80AD7254",), - 0x80AD73A8:("func_80AD73A8",), - 0x80AD7424:("func_80AD7424",), - 0x80AD7568:("func_80AD7568",), - 0x80AD75A8:("func_80AD75A8",), - 0x80AD76CC:("func_80AD76CC",), - 0x80AD7798:("func_80AD7798",), - 0x80AD792C:("func_80AD792C",), - 0x80AD7948:("func_80AD7948",), - 0x80AD7B18:("func_80AD7B18",), - 0x80AD7B90:("func_80AD7B90",), - 0x80AD7C54:("func_80AD7C54",), - 0x80AD7D40:("func_80AD7D40",), - 0x80AD7DA4:("func_80AD7DA4",), - 0x80AD7E0C:("func_80AD7E0C",), - 0x80AD7EC0:("func_80AD7EC0",), - 0x80AD7F10:("func_80AD7F10",), - 0x80AD7FA4:("func_80AD7FA4",), - 0x80AD7FF8:("func_80AD7FF8",), - 0x80AD8060:("func_80AD8060",), - 0x80AD810C:("func_80AD810C",), - 0x80AD8148:("func_80AD8148",), - 0x80AD825C:("func_80AD825C",), - 0x80AD8364:("func_80AD8364",), - 0x80AD8388:("func_80AD8388",), - 0x80AD84C0:("func_80AD84C0",), + 0x80AD6F34:("EnKame_Blink",), + 0x80AD6F9C:("EnKame_Freeze",), + 0x80AD7018:("EnKame_Thaw",), + 0x80AD70A0:("EnKame_SetupIdle",), + 0x80AD70EC:("EnKame_Idle",), + 0x80AD71B4:("EnKame_SetupWalk",), + 0x80AD7254:("EnKame_Walk",), + 0x80AD73A8:("EnKame_SetupRetreatIntoShell",), + 0x80AD7424:("EnKame_RetreatIntoShell",), + 0x80AD7568:("EnKame_SetAttackSpeed",), + 0x80AD75A8:("EnKame_ProcessAttackEffects",), + 0x80AD76CC:("EnKame_SetupPrepareToAttack",), + 0x80AD7798:("EnKame_PrepareToAttack",), + 0x80AD792C:("EnKame_SetupAttack",), + 0x80AD7948:("EnKame_Attack",), + 0x80AD7B18:("EnKame_SetupEmergeFromShell",), + 0x80AD7B90:("EnKame_EmergeFromShell",), + 0x80AD7C54:("EnKame_SetupFlip",), + 0x80AD7D40:("EnKame_Flip",), + 0x80AD7DA4:("EnKame_SetupStruggle",), + 0x80AD7E0C:("EnKame_Struggle",), + 0x80AD7EC0:("EnKame_SetupFlipUpright",), + 0x80AD7F10:("EnKame_FlipUpright",), + 0x80AD7FA4:("EnKame_SetupStunned",), + 0x80AD7FF8:("EnKame_Stunned",), + 0x80AD8060:("EnKame_SetupDamaged",), + 0x80AD810C:("EnKame_Damaged",), + 0x80AD8148:("EnKame_SetupDead",), + 0x80AD825C:("EnKame_Dead",), + 0x80AD8364:("EnKame_SetupBurstIntoFlames",), + 0x80AD8388:("EnKame_BurstIntoFlames",), + 0x80AD84C0:("EnKame_UpdateDamage",), 0x80AD881C:("EnKame_Update",), - 0x80AD8A48:("func_80AD8A48",), - 0x80AD8AF8:("func_80AD8AF8",), + 0x80AD8A48:("EnKame_OverrideLimbDraw",), + 0x80AD8AF8:("EnKame_PostLimbDraw",), 0x80AD8BC0:("EnKame_Draw",), - 0x80AD8CEC:("Enkame_OverrideLimbDraw",), - 0x80AD8D64:("func_80AD8D64",), + 0x80AD8CEC:("EnKame_SpikedSnapperOverrideLimbDraw",), + 0x80AD8D64:("EnKame_DrawSpikedSnapper",), 0x80AD9240:("func_80AD9240",), 0x80AD92FC:("func_80AD92FC",), 0x80AD9358:("func_80AD9358",), @@ -12404,7 +12404,7 @@ 0x80AE1F5C:("EnFsn_HandleLookToShopkeeperBuyingCutscene",), 0x80AE2028:("EnFsn_SetCursorIndexFromNeutral",), 0x80AE2074:("EnFsn_CursorLeftRight",), - 0x80AE21C8:("EnFsn_GetThirdDayItemId",), + 0x80AE21C8:("EnFsn_GetSpecialItemId",), 0x80AE2234:("EnFsn_GetStolenItemId",), 0x80AE2298:("EnFsn_HasItemsToSell",), 0x80AE2340:("EnFsn_GetShopItemIds",), @@ -12504,48 +12504,48 @@ 0x80AE939C:("func_80AE939C",), 0x80AE9574:("ObjBigicicle_Update",), 0x80AE9780:("ObjBigicicle_Draw",), - 0x80AE9A20:("func_80AE9A20",), - 0x80AE9A80:("func_80AE9A80",), - 0x80AE9AC4:("func_80AE9AC4",), - 0x80AE9B4C:("func_80AE9B4C",), - 0x80AE9B8C:("func_80AE9B8C",), - 0x80AE9BCC:("func_80AE9BCC",), + 0x80AE9A20:("EnLiftNuts_AddSharedMemoryEntry",), + 0x80AE9A80:("EnLiftNuts_FreeSharedMemoryEntry",), + 0x80AE9AC4:("EnLiftNuts_Autotalk",), + 0x80AE9B4C:("EnLiftNuts_GameState",), + 0x80AE9B8C:("EnLiftNuts_GetNumDaysWon",), + 0x80AE9BCC:("EnLiftNuts_TryHide",), 0x80AE9CA8:("EnLiftNuts_Init",), 0x80AE9EEC:("EnLiftNuts_Destroy",), - 0x80AE9F28:("func_80AE9F28",), - 0x80AE9F70:("func_80AE9F70",), - 0x80AE9FC8:("func_80AE9FC8",), - 0x80AEA044:("func_80AEA044",), - 0x80AEA0B4:("func_80AEA0B4",), - 0x80AEA128:("func_80AEA128",), - 0x80AEA1A0:("func_80AEA1A0",), - 0x80AEA7A4:("func_80AEA7A4",), - 0x80AEA910:("func_80AEA910",), - 0x80AEABF0:("func_80AEABF0",), - 0x80AEAC64:("func_80AEAC64",), - 0x80AEACF8:("func_80AEACF8",), - 0x80AEAEAC:("func_80AEAEAC",), - 0x80AEAF14:("func_80AEAF14",), - 0x80AEAF8C:("func_80AEAF8C",), - 0x80AEAFA0:("func_80AEAFA0",), - 0x80AEB114:("func_80AEB114",), - 0x80AEB148:("func_80AEB148",), - 0x80AEB1C8:("func_80AEB1C8",), - 0x80AEB230:("func_80AEB230",), - 0x80AEB280:("func_80AEB280",), - 0x80AEB294:("func_80AEB294",), - 0x80AEB3E0:("func_80AEB3E0",), - 0x80AEB428:("func_80AEB428",), - 0x80AEB584:("func_80AEB584",), - 0x80AEB598:("func_80AEB598",), - 0x80AEB684:("func_80AEB684",), - 0x80AEB698:("func_80AEB698",), - 0x80AEB828:("func_80AEB828",), - 0x80AEB8A4:("func_80AEB8A4",), - 0x80AEB934:("func_80AEB934",), - 0x80AEB974:("func_80AEB974",), - 0x80AEB9E0:("func_80AEB9E0",), - 0x80AEBB30:("func_80AEBB30",), + 0x80AE9F28:("EnLiftNuts_SetupIdleHidden",), + 0x80AE9F70:("EnLiftNuts_IdleHidden",), + 0x80AE9FC8:("EnLiftNuts_SetupBurrow",), + 0x80AEA044:("EnLiftNuts_Burrow",), + 0x80AEA0B4:("EnLiftNuts_SetupIdle",), + 0x80AEA128:("EnLiftNuts_RiseUp",), + 0x80AEA1A0:("EnLiftNuts_Idle",), + 0x80AEA7A4:("EnLiftNuts_HandleConversationChoice",), + 0x80AEA910:("EnLiftNuts_HandleConversation5",), + 0x80AEABF0:("EnLiftNuts_SetupStartConversation",), + 0x80AEAC64:("EnLiftNuts_StartConversation",), + 0x80AEACF8:("EnLiftNuts_HandleConversation",), + 0x80AEAEAC:("EnLiftNuts_SetupMove",), + 0x80AEAF14:("EnLiftNuts_Move",), + 0x80AEAF8C:("EnLiftNuts_SetupMovePlayer",), + 0x80AEAFA0:("EnLiftNuts_MovePlayer",), + 0x80AEB114:("EnLiftNuts_SetupStartGame",), + 0x80AEB148:("EnLiftNuts_StartGame",), + 0x80AEB1C8:("EnLiftNuts_SetupStartGameImmediately",), + 0x80AEB230:("EnLiftNuts_StartGameImmediately",), + 0x80AEB280:("EnLiftNuts_SetupRunGame",), + 0x80AEB294:("EnLiftNuts_RunGame",), + 0x80AEB3E0:("EnLiftNuts_SetupEndGame",), + 0x80AEB428:("EnLiftNuts_EndGame",), + 0x80AEB584:("EnLiftNuts_SetupGiveReward",), + 0x80AEB598:("EnLiftNuts_GiveReward",), + 0x80AEB684:("EnLiftNuts_SetupResumeConversation",), + 0x80AEB698:("EnLiftNuts_ResumeConversation",), + 0x80AEB828:("EnLiftNuts_SetupStartHiding",), + 0x80AEB8A4:("EnLiftNuts_StartHiding",), + 0x80AEB934:("EnLiftNuts_Hide",), + 0x80AEB974:("EnLiftNuts_UpdateEyes",), + 0x80AEB9E0:("EnLiftNuts_SpawnDust",), + 0x80AEBB30:("EnLiftNuts_UpdateCollision",), 0x80AEBB74:("EnLiftNuts_Update",), 0x80AEBC18:("func_80AEBC18",), 0x80AEBC90:("func_80AEBC90",), @@ -12656,15 +12656,15 @@ 0x80AF3144:("EnTest7_Update",), 0x80AF31D0:("func_80AF31D0",), 0x80AF3248:("EnTest7_Draw",), - 0x80AF3910:("func_80AF3910",), + 0x80AF3910:("ObjLightblock_SpawnEffect",), 0x80AF397C:("ObjLightblock_Init",), 0x80AF3A80:("ObjLightblock_Destroy",), - 0x80AF3AC8:("func_80AF3AC8",), - 0x80AF3ADC:("func_80AF3ADC",), - 0x80AF3B8C:("func_80AF3B8C",), - 0x80AF3BA0:("func_80AF3BA0",), - 0x80AF3C18:("func_80AF3C18",), - 0x80AF3C34:("func_80AF3C34",), + 0x80AF3AC8:("ObjLightblock_SetupWait",), + 0x80AF3ADC:("ObjLightblock_Wait",), + 0x80AF3B8C:("ObjLightblock_SetupPlayCutscene",), + 0x80AF3BA0:("ObjLightblock_PlayCutscene",), + 0x80AF3C18:("ObjLightblock_SetupFadeAway",), + 0x80AF3C34:("ObjLightblock_FadeAway",), 0x80AF3CC0:("ObjLightblock_Update",), 0x80AF3CE4:("ObjLightblock_Draw",), 0x80AF3F70:("func_80AF3F70",), @@ -12699,14 +12699,14 @@ 0x80AF6094:("EnWdhand_Draw",), 0x80AF6760:("EnGamelupy_Init",), 0x80AF6828:("EnGamelupy_Destroy",), - 0x80AF6854:("func_80AF6854",), - 0x80AF6944:("func_80AF6944",), - 0x80AF6958:("func_80AF6958",), - 0x80AF6994:("func_80AF6994",), - 0x80AF69A8:("func_80AF69A8",), - 0x80AF6A38:("func_80AF6A38",), - 0x80AF6A78:("func_80AF6A78",), - 0x80AF6B40:("func_80AF6B40",), + 0x80AF6854:("EnGamelupy_SpawnSparkles",), + 0x80AF6944:("EnGamelupy_SetupFindSharedMemory",), + 0x80AF6958:("EnGamelupy_FindSharedMemory",), + 0x80AF6994:("EnGamelupy_SetupIdle",), + 0x80AF69A8:("EnGamelupy_Idle",), + 0x80AF6A38:("EnGamelupy_SetupCollected",), + 0x80AF6A78:("EnGamelupy_Collected",), + 0x80AF6B40:("EnGamelupy_UpdateCollision",), 0x80AF6B84:("EnGamelupy_Update",), 0x80AF6BF8:("EnGamelupy_Draw",), 0x80AF6DE0:("func_80AF6DE0",), @@ -13338,7 +13338,7 @@ 0x80B2815C:("func_80B2815C",), 0x80B2816C:("BgBotihasira_Update",), 0x80B28240:("BgBotihasira_Draw",), - 0x80B28370:("func_80B28370",), + 0x80B28370:("EnFish2_ChangeAnim",), 0x80B28478:("func_80B28478",), 0x80B28538:("EnFish2_Init",), 0x80B287B8:("EnFish2_Destroy",), @@ -13378,7 +13378,7 @@ 0x80B2B974:("EnPst_ChooseBehaviour",), 0x80B2BAA4:("EnPst_GetMsgEventScript",), 0x80B2BBFC:("EnPst_CheckTalk",), - 0x80B2BCF8:("EnPst_UpdateFlagsSubs",), + 0x80B2BCF8:("EnPst_SetOfferItemModeOnScreen",), 0x80B2BD30:("EnPst_ProcessScheduleOutput",), 0x80B2BD88:("EnPst_Idle",), 0x80B2BD98:("EnPst_FollowSchedule",), @@ -13493,7 +13493,7 @@ 0x80B33E54:("EnKbt_Destroy",), 0x80B33E64:("func_80B33E64",), 0x80B33E8C:("func_80B33E8C",), - 0x80B33EF0:("func_80B33EF0",), + 0x80B33EF0:("EnKbt_ChangeAnim",), 0x80B3403C:("func_80B3403C",), 0x80B34078:("func_80B34078",), 0x80B3415C:("func_80B3415C",), @@ -13640,7 +13640,7 @@ 0x80B3E168:("func_80B3E168",), 0x80B3E460:("func_80B3E460",), 0x80B3E5B4:("func_80B3E5B4",), - 0x80B3E5DC:("func_80B3E5DC",), + 0x80B3E5DC:("EnDai_ChangeAnim",), 0x80B3E69C:("func_80B3E69C",), 0x80B3E7C8:("func_80B3E7C8",), 0x80B3E834:("func_80B3E834",), @@ -13653,7 +13653,7 @@ 0x80B3EEDC:("func_80B3EEDC",), 0x80B3EF90:("func_80B3EF90",), 0x80B3F00C:("func_80B3F00C",), - 0x80B3F044:("func_80B3F044",), + 0x80B3F044:("EnDai_HandleCutscene",), 0x80B3F318:("EnDai_Init",), 0x80B3F494:("EnDai_Destroy",), 0x80B3F4A4:("EnDai_Update",), @@ -13678,7 +13678,7 @@ 0x80B40800:("EnKgy_Init",), 0x80B40B04:("EnKgy_Destroy",), 0x80B40B38:("func_80B40B38",), - 0x80B40BC0:("func_80B40BC0",), + 0x80B40BC0:("EnKgy_ChangeAnimLoopMorph",), 0x80B40BFC:("func_80B40BFC",), 0x80B40C38:("func_80B40C38",), 0x80B40C74:("func_80B40C74",), @@ -15302,8 +15302,8 @@ 0x80BB1C8C:("func_80BB1C8C",), 0x80BB1D04:("func_80BB1D04",), 0x80BB1D64:("func_80BB1D64",), - 0x80BB1FCC:("func_80BB1FCC",), - 0x80BB2020:("func_80BB2020",), + 0x80BB1FCC:("EnGeg_UpdateSkelAnime",), + 0x80BB2020:("EnGeg_ChangeAnim",), 0x80BB2088:("func_80BB2088",), 0x80BB217C:("func_80BB217C",), 0x80BB221C:("func_80BB221C",), @@ -15482,8 +15482,8 @@ 0x80BC11B4:("EnNb_PostLimbDraw",), 0x80BC1278:("EnNb_TransformLimbDraw",), 0x80BC1374:("EnNb_Draw",), - 0x80BC1900:("func_80BC1900",), - 0x80BC192C:("func_80BC192C",), + 0x80BC1900:("EnJa_UpdateSkelAnime",), + 0x80BC192C:("EnJa_ChangeAnim",), 0x80BC1984:("func_80BC1984",), 0x80BC19FC:("func_80BC19FC",), 0x80BC1A68:("func_80BC1A68",), @@ -15734,8 +15734,8 @@ 0x80BD2404:("EnZov_PostLimbDraw",), 0x80BD24B4:("EnZov_Draw",), 0x80BD2A30:("func_80BD2A30",), - 0x80BD2AE0:("func_80BD2AE0",), - 0x80BD2B0C:("func_80BD2B0C",), + 0x80BD2AE0:("EnAh_UpdateSkelAnime",), + 0x80BD2B0C:("EnAh_ChangeAnim",), 0x80BD2BA4:("func_80BD2BA4",), 0x80BD2BE8:("func_80BD2BE8",), 0x80BD2C6C:("func_80BD2C6C",), @@ -15951,7 +15951,7 @@ 0x80BDAF24:("ObjHsStump_Draw",), 0x80BDB040:("EnHiddenNuts_Init",), 0x80BDB188:("EnHiddenNuts_Destroy",), - 0x80BDB1B4:("func_80BDB1B4",), + 0x80BDB1B4:("EnHiddenNuts_ChangeAnim",), 0x80BDB268:("func_80BDB268",), 0x80BDB2B8:("func_80BDB2B8",), 0x80BDB580:("func_80BDB580",), @@ -16000,8 +16000,8 @@ 0x80BDE090:("func_80BDE090",), 0x80BDE11C:("EnTalk_Update",), 0x80BDE1A0:("func_80BDE1A0",), - 0x80BDE250:("func_80BDE250",), - 0x80BDE27C:("func_80BDE27C",), + 0x80BDE250:("EnAl_UpdateSkelAnime",), + 0x80BDE27C:("EnAl_ChangeAnim",), 0x80BDE318:("func_80BDE318",), 0x80BDE384:("func_80BDE384",), 0x80BDE408:("func_80BDE408",), @@ -16100,14 +16100,14 @@ 0x80BE42A4:("EnTanron4_FlyNearActor",), 0x80BE4734:("EnTanron4_Update",), 0x80BE4804:("EnTanron4_Draw",), - 0x80BE4930:("func_80BE4930",), - 0x80BE4A2C:("func_80BE4A2C",), + 0x80BE4930:("EnTanron5_SpawnEffectSand",), + 0x80BE4A2C:("EnTanron5_SpawnEffectBlackDust",), 0x80BE4B1C:("EnTanron5_Init",), 0x80BE4F24:("EnTanron5_Destroy",), 0x80BE4F54:("EnTanron5_Update",), - 0x80BE5818:("func_80BE5818",), + 0x80BE5818:("EnTanron5_RuinFragmentItemDrop_Update",), 0x80BE5B58:("EnTanron5_Draw",), - 0x80BE5C10:("func_80BE5C10",), + 0x80BE5C10:("EnTanron5_ItemDrop_Draw",), 0x80BE6040:("EnTanron6_Init",), 0x80BE60AC:("EnTanron6_Destroy",), 0x80BE60BC:("EnTanron6_DoNothing",), @@ -16117,7 +16117,7 @@ 0x80BE61D0:("func_80BE61D0",), 0x80BE6228:("EnDaiku2_Init",), 0x80BE63DC:("EnDaiku2_Destroy",), - 0x80BE6408:("func_80BE6408",), + 0x80BE6408:("EnDaiku2_ChangeAnim",), 0x80BE64C0:("func_80BE64C0",), 0x80BE65B4:("func_80BE65B4",), 0x80BE66E4:("func_80BE66E4",), @@ -16283,8 +16283,8 @@ 0x80BF0F10:("EffStk_Draw",), 0x80BF1150:("func_80BF1150",), 0x80BF1200:("func_80BF1200",), - 0x80BF1258:("func_80BF1258",), - 0x80BF1284:("func_80BF1284",), + 0x80BF1258:("EnIg_UpdateSkelAnime",), + 0x80BF1284:("EnIg_ChangeAnim",), 0x80BF1354:("func_80BF1354",), 0x80BF13E4:("func_80BF13E4",), 0x80BF146C:("func_80BF146C",), @@ -16454,7 +16454,7 @@ 0x80BFE170:("EnBomjima_Init",), 0x80BFE300:("EnBomjima_Destroy",), 0x80BFE32C:("func_80BFE32C",), - 0x80BFE494:("func_80BFE494",), + 0x80BFE494:("EnBomjima_ChangeAnim",), 0x80BFE524:("func_80BFE524",), 0x80BFE65C:("func_80BFE65C",), 0x80BFE67C:("func_80BFE67C",), @@ -16487,7 +16487,7 @@ 0x80C008B4:("EnBomjima_Draw",), 0x80C00EA0:("EnBomjimb_Init",), 0x80C01110:("EnBomjimb_Destroy",), - 0x80C0113C:("func_80C0113C",), + 0x80C0113C:("EnBomjimb_ChangeAnim",), 0x80C011CC:("func_80C011CC",), 0x80C012E0:("func_80C012E0",), 0x80C012FC:("func_80C012FC",), @@ -16519,7 +16519,7 @@ 0x80C03034:("EnBomjimb_Draw",), 0x80C03530:("EnBombers_Init",), 0x80C037F8:("EnBombers_Destroy",), - 0x80C03824:("func_80C03824",), + 0x80C03824:("EnBombers_ChangeAnim",), 0x80C038B4:("func_80C038B4",), 0x80C039A8:("func_80C039A8",), 0x80C03ACC:("func_80C03ACC",), @@ -16876,38 +16876,38 @@ 0x80C18E94:("EnAnd_Update",), 0x80C18ED0:("EnAnd_TransformLimbDraw",), 0x80C19084:("EnAnd_Draw",), - 0x80C192A0:("func_80C192A0",), - 0x80C192B0:("func_80C192B0",), - 0x80C19334:("func_80C19334",), - 0x80C193A8:("func_80C193A8",), - 0x80C19454:("func_80C19454",), - 0x80C19498:("func_80C19498",), - 0x80C1950C:("func_80C1950C",), - 0x80C19548:("func_80C19548",), - 0x80C19564:("func_80C19564",), - 0x80C19590:("func_80C19590",), - 0x80C1965C:("func_80C1965C",), - 0x80C19688:("func_80C19688",), - 0x80C19754:("func_80C19754",), - 0x80C1985C:("func_80C1985C",), - 0x80C1987C:("func_80C1987C",), - 0x80C199BC:("func_80C199BC",), - 0x80C199EC:("func_80C199EC",), - 0x80C19AB4:("func_80C19AB4",), - 0x80C19D00:("func_80C19D00",), - 0x80C19D48:("func_80C19D48",), - 0x80C19E04:("func_80C19E04",), - 0x80C19EC0:("func_80C19EC0",), - 0x80C19F7C:("func_80C19F7C",), - 0x80C1A038:("func_80C1A038",), - 0x80C1A070:("func_80C1A070",), - 0x80C1A168:("func_80C1A168",), - 0x80C1A244:("func_80C1A244",), - 0x80C1A590:("func_80C1A590",), - 0x80C1A650:("func_80C1A650",), - 0x80C1A670:("func_80C1A670",), - 0x80C1A6C8:("func_80C1A6C8",), - 0x80C1A854:("func_80C1A854",), + 0x80C192A0:("EnInvadepohDemo_DoNothing",), + 0x80C192B0:("EnInvadepohDemo_Alien_Init",), + 0x80C19334:("EnInvadepohDemo_Romani_Init",), + 0x80C193A8:("EnInvadepohDemo_Cow_Init",), + 0x80C19454:("EnInvadepohDemo_Ufo_Init",), + 0x80C19498:("EnInvadepohDemo_CowTail_Init",), + 0x80C1950C:("EnInvadepohDemo_Cow_Destroy",), + 0x80C19548:("EnInvadepohDemo_CowTail_Destroy",), + 0x80C19564:("EnInvadepohDemo_Alien_Idle",), + 0x80C19590:("EnInvadepohDemo_Alien_FollowPath",), + 0x80C1965C:("EnInvadepohDemo_Romani_Idle",), + 0x80C19688:("EnInvadepohDemo_Romani_FollowPath",), + 0x80C19754:("EnInvadepohDemo_Cow_UpdateCommon",), + 0x80C1985C:("EnInvadepohDemo_Cow_Idle",), + 0x80C1987C:("EnInvadepohDemo_Cow_FollowPath",), + 0x80C199BC:("EnInvadepohDemo_Ufo_Idle",), + 0x80C199EC:("EnInvadepohDemo_Ufo_FollowPath",), + 0x80C19AB4:("EnInvadepohDemo_SelectCueAction",), + 0x80C19D00:("EnInvadepohDemo_CowTail_Idle",), + 0x80C19D48:("EnInvadepohDemo_Alien_WaitForObject",), + 0x80C19E04:("EnInvadepohDemo_Romani_WaitForObject",), + 0x80C19EC0:("EnInvadepohDemo_Cow_WaitForObject",), + 0x80C19F7C:("EnInvadepohDemo_CowTail_WaitForObject",), + 0x80C1A038:("EnInvadepohDemo_Ufo_UpdateMatrixTranslation",), + 0x80C1A070:("EnInvadepohDemo_Ufo_ShouldDrawLensFlare",), + 0x80C1A168:("EnInvadepohDemo_Alien_PostLimbDraw",), + 0x80C1A244:("EnInvadepohDemo_Alien_Draw",), + 0x80C1A590:("EnInvadepohDemo_Romani_Draw",), + 0x80C1A650:("EnInvadepohDemo_Cow_OverrideLimbDraw",), + 0x80C1A670:("EnInvadepohDemo_Cow_Draw",), + 0x80C1A6C8:("EnInvadepohDemo_Ufo_Draw",), + 0x80C1A854:("EnInvadepohDemo_CowTail_Draw",), 0x80C1A8A4:("EnInvadepohDemo_Init",), 0x80C1A98C:("EnInvadepohDemo_Destroy",), 0x80C1A9C0:("EnInvadepohDemo_Update",), @@ -16927,11 +16927,11 @@ 0x80C1B8A4:("func_80C1B8A4",), 0x80C1B8B4:("func_80C1B8B4",), 0x80C1B8F0:("func_80C1B8F0",), - 0x80C1B9D4:("func_80C1B9D4",), + 0x80C1B9D4:("EnFall2_HandleCutscene",), 0x80C1BAC8:("EnFall2_Update",), 0x80C1BAEC:("EnFall2_Draw",), 0x80C1BD90:("DmAl_ChangeAnim",), - 0x80C1BDD8:("func_80C1BDD8",), + 0x80C1BDD8:("DmAl_HandleCutscene",), 0x80C1BF08:("DmAl_Init",), 0x80C1BFB8:("DmAl_Destroy",), 0x80C1BFC8:("DmAl_Update",), @@ -16939,36 +16939,36 @@ 0x80C1C064:("DmAl_PostLimbDraw",), 0x80C1C11C:("DmAl_TransformLimbDraw",), 0x80C1C130:("DmAl_Draw",), - 0x80C1C410:("func_80C1C410",), - 0x80C1C4D8:("func_80C1C4D8",), + 0x80C1C410:("DmAn_UpdateSkelAnime",), + 0x80C1C4D8:("DmAn_ChangeAnim",), 0x80C1C5B4:("func_80C1C5B4",), 0x80C1C62C:("func_80C1C62C",), 0x80C1C83C:("func_80C1C83C",), 0x80C1C8E8:("func_80C1C8E8",), 0x80C1C958:("func_80C1C958",), - 0x80C1CAB0:("func_80C1CAB0",), - 0x80C1CC80:("func_80C1CC80",), + 0x80C1CAB0:("DmAn_HandleCutscene",), + 0x80C1CC80:("DmAn_DoNothing",), 0x80C1CC90:("DmAn_Init",), 0x80C1CCE4:("DmAn_Destroy",), 0x80C1CCF4:("DmAn_Update",), 0x80C1CD80:("func_80C1CD80",), 0x80C1CEFC:("func_80C1CEFC",), 0x80C1D0B0:("func_80C1D0B0",), - 0x80C1D410:("func_80C1D410",), + 0x80C1D410:("DmAh_ChangeAnim",), 0x80C1D458:("func_80C1D458",), 0x80C1D4D0:("func_80C1D4D0",), 0x80C1D6E0:("func_80C1D6E0",), 0x80C1D78C:("func_80C1D78C",), - 0x80C1D7FC:("func_80C1D7FC",), - 0x80C1D92C:("func_80C1D92C",), + 0x80C1D7FC:("DmAh_HandleCutscene",), + 0x80C1D92C:("DmAh_DoNothing",), 0x80C1D93C:("DmAh_Init",), 0x80C1DA48:("DmAh_Destroy",), 0x80C1DA58:("DmAh_Update",), 0x80C1DAD4:("DmAh_PostLimbDraw",), 0x80C1DB24:("DmAh_TransformLimbDraw",), 0x80C1DCD8:("DmAh_Draw",), - 0x80C1DED0:("func_80C1DED0",), - 0x80C1DF18:("func_80C1DF18",), + 0x80C1DED0:("DmNb_ChangeAnim",), + 0x80C1DF18:("DmNb_HandleCutscene",), 0x80C1E048:("DmNb_Init",), 0x80C1E0F8:("DmNb_Destroy",), 0x80C1E108:("DmNb_Update",), @@ -16984,15 +16984,15 @@ 0x80C1E568:("EnDrs_Draw",), 0x80C1E690:("EnEndingHero_Init",), 0x80C1E738:("EnEndingHero_Destroy",), - 0x80C1E748:("func_80C1E748",), - 0x80C1E764:("func_80C1E764",), + 0x80C1E748:("EnEndingHero1_SetupIdle",), + 0x80C1E764:("EnEndingHero1_Idle",), 0x80C1E790:("EnEndingHero_Update",), 0x80C1E84C:("EnEndingHero_Draw",), 0x80C1E9E0:("DmBal_Init",), 0x80C1EAB4:("DmBal_Destroy",), 0x80C1EAC4:("DmBal_SetupDoNothing",), 0x80C1EAD8:("DmBal_DoNothing",), - 0x80C1EAE8:("func_80C1EAE8",), + 0x80C1EAE8:("DmBal_HandleCutscene",), 0x80C1EC60:("func_80C1EC60",), 0x80C1ED0C:("DmBal_UpdateEyes",), 0x80C1ED64:("DmBal_SpawnPaper",), @@ -17057,7 +17057,7 @@ 0x80C22880:("func_80C22880",), 0x80C2291C:("func_80C2291C",), 0x80C229AC:("func_80C229AC",), - 0x80C229EC:("func_80C229EC",), + 0x80C229EC:("DmTag_DoNothing",), 0x80C229FC:("func_80C229FC",), 0x80C22A40:("DmTag_Init",), 0x80C22B30:("DmTag_Destroy",), @@ -17069,26 +17069,26 @@ 0x80C23154:("EnBh_Draw",), 0x80C23230:("EnEndingHero2_Init",), 0x80C232D8:("EnEndingHero2_Destroy",), - 0x80C232E8:("func_80C232E8",), - 0x80C23304:("func_80C23304",), + 0x80C232E8:("EnEndingHero2_SetupIdle",), + 0x80C23304:("EnEndingHero2_Idle",), 0x80C23330:("EnEndingHero2_Update",), 0x80C23398:("EnEndingHero2_Draw",), 0x80C23460:("EnEndingHero3_Init",), 0x80C23508:("EnEndingHero3_Destroy",), - 0x80C23518:("func_80C23518",), - 0x80C23534:("func_80C23534",), + 0x80C23518:("EnEndingHero3_SetupIdle",), + 0x80C23534:("EnEndingHero3_Idle",), 0x80C23560:("EnEndingHero3_Update",), 0x80C235C8:("EnEndingHero3_Draw",), 0x80C23690:("EnEndingHero4_Init",), 0x80C23738:("EnEndingHero4_Destroy",), - 0x80C23748:("func_80C23748",), - 0x80C23764:("func_80C23764",), + 0x80C23748:("EnEndingHero4_SetupIdle",), + 0x80C23764:("EnEndingHero4_Idle",), 0x80C23790:("EnEndingHero4_Update",), 0x80C237F8:("EnEndingHero4_Draw",), 0x80C238C0:("EnEndingHero5_Init",), 0x80C23970:("EnEndingHero5_Destroy",), - 0x80C23980:("func_80C23980",), - 0x80C2399C:("func_80C2399C",), + 0x80C23980:("EnEndingHero5_SetupIdle",), + 0x80C2399C:("EnEndingHero5_Idle",), 0x80C239C8:("EnEndingHero5_Update",), 0x80C23A30:("EnEndingHero5_PostLimbDraw",), 0x80C23A7C:("EnEndingHero5_Draw",), @@ -17100,15 +17100,15 @@ 0x80C23E44:("EnEndingHero6_Update",), 0x80C23F14:("func_80C23F14",), 0x80C23F6C:("EnEndingHero6_Draw",), - 0x80C24360:("func_80C24360",), - 0x80C24428:("func_80C24428",), + 0x80C24360:("DmGm_UpdateSkelAnime",), + 0x80C24428:("DmGm_ChangeAnim",), 0x80C24504:("func_80C24504",), 0x80C2457C:("func_80C2457C",), 0x80C2478C:("func_80C2478C",), 0x80C24838:("func_80C24838",), 0x80C248A8:("func_80C248A8",), - 0x80C24A00:("func_80C24A00",), - 0x80C24BD0:("func_80C24BD0",), + 0x80C24A00:("DmGm_HandleCutscene",), + 0x80C24BD0:("DmGm_DoNothing",), 0x80C24BE0:("DmGm_Init",), 0x80C24C34:("DmGm_Destroy",), 0x80C24C44:("DmGm_Update",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 592bb4650..c3622c1fa 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -7,7 +7,7 @@ 0x80000310:("osCicId","UNK_TYPE","",0x4), 0x80000314:("osVersion","UNK_TYPE","",0x4), 0x80000318:("osMemSize","UNK_TYPE","",0x4), - 0x8000031C:("osAppNmiBuffer","s32","[0x10]",0x40), + 0x8000031C:("osAppNMIBuffer","s32","[0x10]",0x40), 0x80000500:("gFramebuffer1","u16","[SCREEN_HEIGHT][SCREEN_WIDTH]",0x25800), 0x80025D00:("D_80025D00","u8","[]",0x1), # TODO size 0x800969C0:("rspbootTextStart","u64","[]",0x160), @@ -18,17 +18,17 @@ 0x80096B30:("gViConfigXScale","f32","",0x4), 0x80096B34:("gViConfigYScale","f32","",0x4), 0x80096B40:("gCartHandle","OSPiHandle*","",0x4), - 0x80096B50:("sDmaMgrDmaBuffSize","u32","",0x4), + 0x80096B50:("gDmaMgrDmaBuffSize","u32","",0x4), 0x80096B60:("gIrqMgrResetStatus","vs32","",0x4), 0x80096B68:("sIrqMgrResetTime","volatile OSTime","",0x8), - 0x80096B70:("sIrqMgrRetraceTime","volatile OSTime","",0x8), + 0x80096B70:("gIrqMgrRetraceTime","volatile OSTime","",0x8), 0x80096B78:("sIrqMgrRetraceCount","s32","",0x4), 0x80096B80:("sCpuExceptions","char*","[18]",0x48), 0x80096BC8:("sFpuExceptions","char*","[6]",0x18), - 0x80096BE0:("sFaultDrawContext","FaultDrawer*","",0x4), + 0x80096BE0:("sFaultDrawerInstance","FaultDrawer*","",0x4), 0x80096BE4:("sFaultDrawerDefault","FaultDrawer","",0x3c), 0x80096C20:("gLoadLogSeverity","UNK_TYPE4","",0x4), - 0x80096C30:("gLoad2LogSeverity","UNK_TYPE4","",0x4), + 0x80096C30:("gOverlayLogSeverity","UNK_TYPE4","",0x4), 0x80096C40:("sStackInfoListStart","StackEntry*","",0x4), 0x80096C44:("sStackInfoListEnd","StackEntry*","",0x4), 0x80096C50:("sGfxPrintFontTLUT","u16","[64]",0x80), @@ -47,13 +47,13 @@ 0x800975E0:("sintable","s16","[1024]",0x800), 0x80097DE0:("__osHwIntTable","__osHwInt","[]",0x28), 0x80097E08:("__osPiIntTable","__osHwInt","[]",0x28), - 0x80097E10:("__osThreadTail","OSThread*","",0x4), + 0x80097E10:("__osThreadTail","__OSThreadTail","",0x8), 0x80097E18:("__osRunQueue","OSThread*","",0x4), 0x80097E1C:("__osActiveQueue","OSThread*","",0x4), 0x80097E20:("__osRunningThread","OSThread*","",0x4), 0x80097E24:("__osFaultedThread","OSThread*","",0x4), 0x80097E30:("__osSiAccessQueueEnabled","u32","",0x4), - 0x80097E40:("D_80097E40","UNK_TYPE4","",0x4), + 0x80097E40:("__osContinitialized","UNK_TYPE4","",0x4), 0x80097E50:("osClockRate","u64","",0x8), 0x80097E58:("osViClock","s32","",0x4), 0x80097E5C:("__osShutdown","UNK_TYPE4","",0x4), @@ -65,19 +65,17 @@ 0x80097EB0:("osViModeNtscHpn1","OSViMode","",0x50), 0x80097F00:("__osPfsInodeCacheChannel","s32","",0x4), 0x80097F04:("__osPfsInodeCacheBank","u8","",0x1), - 0x80097F10:("D_80097F10","UNK_TYPE4","",0x4), + 0x80097F10:("__osPreNMI","UNK_TYPE4","",0x4), 0x80097F20:("spaces","char","[]",0x21), 0x80097F44:("zeroes","char","[]",0x24), 0x80097F70:("__osTimerList","OSTimer*","",0x4), 0x80097F80:("D_80097F80","f32","",0x4), 0x80097F90:("D_80097F90","f32","",0x4), - 0x80097FA0:("D_80097FA0","UNK_TYPE1","",0x1), - 0x80097FA4:("D_80097FA4","UNK_TYPE1","",0x1), - 0x80097FA5:("D_80097FA5","UNK_TYPE1","",0x1), + 0x80097FA0:("sCmds","UNK_TYPE1","",0x1), 0x80097FB0:("__osPfsLastChannel","s32","",0x4), 0x80097FC0:("osViModeNtscLan1","OSViMode","",0x50), 0x80098010:("osViModeMpalLan1","OSViMode","",0x50), - 0x80098060:("D_80098060","__OSViContext","[2]",0x60), + 0x80098060:("vi","__OSViContext","[2]",0x60), 0x800980C0:("__osViCurr","__OSViContext*","",0x4), 0x800980C4:("__osViNext","__OSViContext*","",0x4), 0x800980D0:("sCartRomNeedsInit","UNK_TYPE4","",0x4), @@ -86,7 +84,7 @@ 0x80098144:("udigs","u8","[]",0x14), 0x80098160:("__osViDevMgr","OSDevMgr","",0x1c), 0x8009817C:("__additional_scanline","UNK_TYPE4","",0x4), - 0x80098180:("D_80098180","UNK_TYPE1","",0x1), + 0x80098180:("sDigitalTable","UNK_TYPE1","",0x1), 0x80098190:("D_80098190","char","[]",0x5), 0x80098198:("D_80098198","char","[]",0x5), 0x800981A0:("D_800981A0","char","[]",0x7), @@ -253,14 +251,14 @@ 0x80099128:("D_80099128","char","[]",0x1), 0x8009915C:("D_8009915C","char","[]",0x1), 0x80099178:("D_80099178","char","[]",0x1), - 0x800991A0:("D_800991A0","u16","[64]",0x80), + 0x800991A0:("__osRcpImTable","u16","[64]",0x80), 0x80099220:("P","du","[5]",0x28), 0x80099248:("rpi","du","",0x8), 0x80099250:("pihi","du","",0x8), 0x80099258:("pilo","du","",0x8), 0x80099260:("zero","fu","",0x4), - 0x80099270:("D_80099270","UNK_TYPE1","",0x1), - 0x80099290:("__osIntTable","UNK_PTR","",0x4), + 0x80099270:("__osIntOffTable","u8","",0x20), + 0x80099290:("__osIntTable","UNK_PTR","",0x30), 0x800992C0:("D_800992C0","f64","",0x8), 0x800992D0:("jtbl_800992D0","UNK_PTR","",0x4), 0x800992F0:("D_800992F0","f64","",0x8), @@ -297,11 +295,11 @@ 0x8009A840:("sMainStack","u8","[2304]",0x900), 0x8009B140:("sMainStackInfo","StackEntry","",0x1c), 0x8009B160:("sPiMgrCmdBuff","OSMesg","[50]",0xc8), - 0x8009B228:("gPiMgrCmdQ","OSMesgQueue","",0x18), + 0x8009B228:("gPiMgrCmdQueue","OSMesgQueue","",0x18), 0x8009B240:("gViConfigMode","OSViMode","",0x50), - 0x8009B290:("D_8009B290","u8","",0x1), + 0x8009B290:("gViConfigModeType","u8","",0x1), 0x8009B2A0:("sDmaMgrStackInfo","StackEntry","",0x1c), - 0x8009B2BC:("numDmaEntries","u16","",0x2), + 0x8009B2BC:("sNumDmaEntries","u16","",0x2), 0x8009B2C0:("sDmaMgrMsgQueue","OSMesgQueue","",0x18), 0x8009B2D8:("sDmaMgrMsgs","OSMesg","[32]",0x80), 0x8009B358:("sDmaMgrThread","OSThread","",0x1b0), @@ -312,17 +310,17 @@ 0x8009BE18:("sYaz0CurSize","u32","",0x4), 0x8009BE1C:("sYaz0MaxPtr","u8*","",0x4), 0x8009BE20:("gYaz0DecompressDstEnd","void*","",0x4), - 0x8009BE30:("D_8009BE30","UNK_TYPE4","",0x4), - 0x8009BE34:("D_8009BE34","UNK_TYPE4","",0x4), - 0x8009BE38:("romInfoFaultClient","FaultClient","",0x10), - 0x8009BE50:("sFaultContext","FaultThreadStruct*","",0x4), - 0x8009BE54:("D_8009BE54","f32","",0x4), + 0x8009BE30:("gCICAddr1Val","UNK_TYPE4","",0x4), + 0x8009BE34:("gCICAddr2Val","UNK_TYPE4","",0x4), + 0x8009BE38:("sRomInfoFaultClient","FaultClient","",0x10), + 0x8009BE50:("sFaultInstance","FaultMgr*","",0x4), + 0x8009BE54:("sFaultTimeTotal","f32","",0x4), 0x8009BE58:("faultCustomOptions","u32","",0x4), 0x8009BE5C:("faultCopyToLog","u32","",0x4), 0x8009BE60:("sFaultStack","u8","[1536]",0x600), - 0x8009C460:("sFaultStackInfo","StackEntry","",0x1c), - 0x8009C480:("gFaultStruct","FaultThreadStruct","",0x848), - 0x8009CCD0:("sFaultDrawerStruct","FaultDrawer","",0x3c), + 0x8009C460:("sFaultStackInfo","StackEntry","",0x1C), + 0x8009C480:("gFaultMgr","FaultMgr","",0x848), + 0x8009CCD0:("sFaultDrawer","FaultDrawer","",0x3c), 0x8009CD10:("D_8009CD10","UNK_TYPE4","",0x4), 0x8009CD20:("gSystemArena","Arena","",0x24), 0x8009CD50:("sRandFloat","f32","",0x4), @@ -332,32 +330,31 @@ 0x8009CEB0:("siAccessBuf","OSMesg","[1]",0x4), 0x8009CEB8:("__osSiAccessQueue","OSMesgQueue","",0x18), 0x8009CED0:("__osContPifRam","OSPifRam","",0x40), - 0x8009CF0C:("D_8009CF0C","UNK_TYPE1","",0x1), 0x8009CF10:("__osContLastPoll","u8","",0x1), 0x8009CF11:("__osMaxControllers","u8","",0x1), 0x8009CF18:("__osEepromTimer","OSTimer","",0x20), - 0x8009CF38:("D_8009CF38","OSMesgQueue","",0x18), - 0x8009CF50:("D_8009CF50","OSMesg","",0x4), - 0x8009CF60:("D_8009CF60","UNK_TYPE1","",0x1), - 0x8009CF70:("D_8009CF70","UNK_TYPE4","",0x4), + 0x8009CF38:("__osEepromTimerQ","OSMesgQueue","",0x18), + 0x8009CF50:("__osEepromTimerMsg","OSMesg","",0x4), + 0x8009CF60:("sHandleStatus","UNK_TYPE1","",0x1), + 0x8009CF70:("__osFinalrom","UNK_TYPE4","",0x4), 0x8009CF80:("__osThreadSave","OSThread","",0x1b0), - 0x8009D130:("D_8009D130","OSPiHandle","",0x74), - 0x8009D1A8:("D_8009D1A8","OSPiHandle","",0x74), + 0x8009D130:("__Dom1SpeedParam","OSPiHandle","",0x74), + 0x8009D1A8:("__Dom2SpeedParam","OSPiHandle","",0x74), 0x8009D220:("sPiMgrThread","OSThread","",0x1b0), 0x8009D3D0:("sPiMgrStack","u8","[4096]",0x1000), - 0x8009E3D0:("D_8009E3D0","OSMesgQueue","",0x18), - 0x8009E3E8:("D_8009E3E8","OSMesg","[1]",0x4), - 0x8009E3F0:("D_8009E3F0","OSMesg","[1]",0x4), + 0x8009E3D0:("piEventQueue","OSMesgQueue","",0x18), + 0x8009E3E8:("piEventBuf","OSMesg","[1]",0x4), + 0x8009E3F0:("piAccessBuf","OSMesg","[1]",0x4), 0x8009E3F8:("__osPiAccessQueue","OSMesgQueue","",0x18), 0x8009E410:("__osPfsInodeCache","__OSInode","",0x100), 0x8009E510:("__osEventStateTab","__OSEventState","[16]",0x80), - 0x8009E590:("D_8009E590","OSTimer","",0x20), + 0x8009E590:("__osBaseTimer","OSTimer","",0x20), 0x8009E5B0:("__osCurrentTime","OSTime","",0x8), 0x8009E5B8:("__osBaseCounter","u32","",0x4), 0x8009E5BC:("__osViIntrCount","u32","",0x4), 0x8009E5C0:("__osTimerCounter","u32","",0x4), 0x8009E5D0:("__osPfsPifRam","OSPifRam","",0x40), - 0x8009E610:("CartRomHandle","OSPiHandle","",0x74), + 0x8009E610:("__CartRomHandle","OSPiHandle","",0x74), 0x8009E690:("viThread","OSThread","",0x1b0), 0x8009E840:("sViStack","u8","[4096]",0x1000), 0x8009F840:("viEventQueue","OSMesgQueue","",0x18), @@ -435,7 +432,7 @@ 0x801AED48:("D_801AED48","s16","[8]",0x10), 0x801AED58:("sCategoryFreezeMasks","UNK_TYPE4","",0x4), 0x801AED88:("actorDefaultHitColor","Color_RGBA8","",0x4), - 0x801AED8C:("D_801AED8C","UNK_TYPE1","",0x1), + 0x801AED8C:("sTargetableActorCategories","UNK_TYPE1","",0x1), 0x801AED98:("D_801AED98","Vec3f","",0xC), 0x801AEDA4:("D_801AEDA4","UNK_TYPE4","",0x4), 0x801AEDB0:("sArrowDmgFlags","UNK_TYPE1","",0x1), @@ -905,11 +902,11 @@ 0x801BB050:("sDebugDisplayLight1","Lights1","",0x24), 0x801BB068:("D_801BB068","UNK_TYPE2","",0x2), 0x801BB08C:("D_801BB08C","UNK_TYPE1","",0x1), - 0x801BB090:("D_801BB090","UNK_TYPE4","",0x4), - 0x801BB094:("D_801BB094","UNK_TYPE1","",0x1), - 0x801BB0DC:("D_801BB0DC","UNK_TYPE1","",0x1), - 0x801BB0FC:("D_801BB0FC","UNK_TYPE2","",0x2), - 0x801BB100:("D_801BB100","UNK_TYPE1","",0x1), + 0x801BB090:("sDebugTextDrawFlags","UNK_TYPE4","",0x4), + 0x801BB094:("sDebugTextBuffer","UNK_TYPE1","",0x1), + 0x801BB0DC:("sDebugTextColors","UNK_TYPE1","",0x1), + 0x801BB0FC:("sDebugCamTextEntryCount","UNK_TYPE2","",0x2), + 0x801BB100:("sDebugCamTextColors","UNK_TYPE1","",0x1), 0x801BB124:("sCurTextId","UNK_TYPE2","",0x2), 0x801BB128:("sCurOcarinaAction","UNK_TYPE2","",0x2), 0x801BB12C:("gOpeningEntranceIndex","UNK_TYPE1","",0x1), @@ -923,8 +920,8 @@ 0x801BC240:("gEffFootprintMaterialDL","Gfx","[9]",0x48), 0x801BC288:("gEffFootprintModelDL","Gfx","[3]",0x18), 0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1), - 0x801BC3F0:("gEnHyBodyParts","UNK_TYPE1","",0x1), - 0x801BC400:("gEnHyParentBodyParts","UNK_TYPE1","",0x1), + 0x801BC3F0:("gEnHyLimbToBodyParts","UNK_TYPE1","",0x1), + 0x801BC400:("gEnHyParentShadowBodyParts","UNK_TYPE1","",0x1), 0x801BC410:("gEnHyShadowSizes","s32",[],0x10), 0x801BC420:("sReactionTextIds","u16","[]",0x140A), 0x801BD830:("sGlobalCutsceneList","ActorCutscene","[8]",0x80), @@ -949,36 +946,33 @@ 0x801BDB08:("sKaleidoSetupRightPageEyeX","UNK_TYPE1","",0x1), 0x801BDB18:("sKaleidoSetupRightPageEyeZ","UNK_TYPE1","",0x1), 0x801BDB30:("kanfontOrdering","u8","[92]",0x5c), - 0x801BDB90:("D_801BDB90","f32","",0x4), - 0x801BDB94:("D_801BDB94","UNK_TYPE4","",0x4), - 0x801BDB98:("D_801BDB98","UNK_TYPE4","",0x4), - 0x801BDB9C:("D_801BDB9C","UNK_TYPE2","",0x2), - 0x801BDBA0:("D_801BDBA0","UNK_TYPE1","",0x1), - 0x801BDBA4:("D_801BDBA4","UNK_TYPE1","",0x1), + 0x801BDB90:("sSandstormLerpScale","f32","",0x4), + 0x801BDB94:("sSunScreenDepth","UNK_TYPE4","",0x4), + 0x801BDB98:("sEnvSkyboxNumStars","UNK_TYPE4","",0x4), + 0x801BDB9C:("sTimeJump","UNK_TYPE2","",0x2), + 0x801BDBA0:("sSandstormColorIndex","UNK_TYPE1","",0x1), + 0x801BDBA4:("sNextSandstormColorIndex","UNK_TYPE1","",0x1), 0x801BDBA8:("D_801BDBA8","UNK_TYPE1","",0x1), 0x801BDBB0:("gWeatherMode","u8","",0x1), - 0x801BDBB4:("D_801BDBB4","UNK_TYPE1","",0x1), - 0x801BDBB8:("D_801BDBB8","UNK_TYPE1","",0x1), - 0x801BDBBC:("D_801BDBBC","UNK_TYPE1","",0x1), + 0x801BDBB4:("gLightConfigAfterUnderwater","UNK_TYPE1","",0x1), + 0x801BDBB8:("gInterruptSongOfStorms","UNK_TYPE1","",0x1), + 0x801BDBBC:("sSkyboxIsChanging","UNK_TYPE1","",0x1), 0x801BDBC0:("D_801BDBC0","UNK_TYPE1","",0x1), 0x801BDBC4:("D_801BDBC4","UNK_TYPE1","",0x1), - 0x801BDBC8:("D_801BDBC8","u8","",0x1), - 0x801BDBCC:("D_801BDBCC","UNK_TYPE1","",0x1), - 0x801BDCF4:("D_801BDCF4","UNK_TYPE1","",0x1), - 0x801BE38E:("D_801BE38E","UNK_TYPE1","",0x1), - 0x801BE38F:("D_801BE38F","UNK_TYPE1","",0x1), - 0x801BE390:("D_801BE390","UNK_TYPE1","",0x1), - 0x801BE4D4:("D_801BE4D4","UNK_TYPE1","",0x1), - 0x801BE4F4:("D_801BE4F4","UNK_TYPE1","",0x1), - 0x801BE534:("D_801BE534","UNK_TYPE1","",0x1), - 0x801BE6D4:("D_801BE6D4","UNK_TYPE1","",0x1), - 0x801BE874:("D_801BE874","UNK_TYPE1","",0x1), - 0x801BE894:("D_801BE894","UNK_TYPE4","",0x4), - 0x801BE8BC:("D_801BE8BC","UNK_TYPE4","",0x4), - 0x801BE8E4:("D_801BE8E4","UNK_TYPE4","",0x4), - 0x801BE90C:("D_801BE90C","UNK_TYPE1","",0x1), - 0x801BE92C:("D_801BE92C","UNK_TYPE1","",0x1), - 0x801BE944:("D_801BE944","UNK_TYPE1","",0x1), + 0x801BDBC8:("gSceneSeqState","u8","",0x1), + 0x801BDBCC:("sTimeBasedLightConfigs","UNK_TYPE1","",0x1), + 0x801BDCF4:("sTimeBasedSkyboxConfigs","TimeBasedSkyboxEntry","[28][9]",0x7E0), + 0x801BE4D4:("sNormalSkyFiles","UNK_TYPE1","",0x1), + 0x801BE4F4:("sZBufValConversionTable","UNK_TYPE1","",0x1), + 0x801BE534:("sSkyboxPrimColors","UNK_TYPE1","",0x1), + 0x801BE6D4:("sSkyboxEnvColors","UNK_TYPE1","",0x1), + 0x801BE874:("sLensFlareColors","UNK_TYPE1","",0x1), + 0x801BE894:("sLensFlareScales","UNK_TYPE4","",0x4), + 0x801BE8BC:("sLensFlareAlphas","UNK_TYPE4","",0x4), + 0x801BE8E4:("sLensFlareTypes","UNK_TYPE4","",0x4), + 0x801BE90C:("sLightningTextures","UNK_TYPE1","",0x1), + 0x801BE92C:("sSandstormPrimColors","UNK_TYPE1","",0x1), + 0x801BE944:("sSandstormEnvColors","UNK_TYPE1","",0x1), 0x801BE960:("sInitChainHandlers","actor_init_var_func","[11]",0x2c), 0x801BE990:("sHeartsPrimColors","s16","[3][3]",0x12), 0x801BE9A4:("sHeartsEnvColors","s16","[3][3]",0x12), @@ -1081,12 +1075,9 @@ 0x801BF9C4:("D_801BF9C4","UNK_TYPE1","",0x1), 0x801BF9C8:("D_801BF9C8","UNK_TYPE1","",0x1), 0x801BF9CC:("D_801BF9CC","UNK_TYPE1","",0x1), - 0x801BF9D4:("D_801BF9D4","UNK_TYPE4","",0x4), - 0x801BF9D8:("D_801BF9D8","UNK_TYPE4","",0x4), - 0x801BF9DC:("D_801BF9DC","UNK_TYPE4","",0x4), - 0x801BF9E0:("D_801BF9E0","UNK_TYPE4","",0x4), - 0x801BF9E4:("D_801BF9E4","UNK_TYPE4","",0x4), - 0x801BF9E8:("D_801BF9E8","UNK_TYPE4","",0x4), + 0x801BF9D4:("D_801BF9D4","UNK_TYPE4","",0x8), + 0x801BF9DC:("D_801BF9DC","UNK_TYPE4","",0x8), + 0x801BF9E4:("D_801BF9E4","UNK_TYPE4","",0x8), 0x801BF9EC:("sFinalHoursClockDigitsRed","UNK_TYPE4","",0x4), 0x801BF9F0:("sFinalHoursClockFrameEnvRed","UNK_TYPE2","",0x2), 0x801BF9F4:("sFinalHoursClockFrameEnvGreen","UNK_TYPE2","",0x2), @@ -1105,8 +1096,7 @@ 0x801BFAC4:("magicBorderIndices","UNK_TYPE1","",0x1), 0x801BFACC:("magicBorderColorTimerIndex","UNK_TYPE1","",0x1), 0x801BFAD4:("cUpLabelTextures","UNK_TYPE1","",0x1), - 0x801BFAF4:("D_801BFAF4","UNK_TYPE4","",0x4), - 0x801BFAF8:("D_801BFAF8","UNK_TYPE4","",0x4), + 0x801BFAF4:("D_801BFAF4","UNK_TYPE4","",0x8), 0x801BFAFC:("D_801BFAFC","UNK_TYPE4","",0x4), 0x801BFB04:("D_801BFB04","UNK_TYPE1","",0x1), 0x801BFB0C:("D_801BFB0C","UNK_TYPE1","",0x1), @@ -1330,13 +1320,13 @@ 0x801C212C:("gSceneIdsPerRegion","SceneIdList","[]",0x252), 0x801C2380:("sSceneIdsPerTingleMap","u16","[]",0x90), 0x801C2410:("gPlayerFormItemRestrictions","UNK_TYPE1","",0x1), - 0x801C2650:("tatlMessageFiles","RomFile","[2]",0x10), + 0x801C2650:("naviQuestHintFiles","RomFile","[2]",0x10), 0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48), - 0x801C26A8:("sceneHeaderFuncTable","scene_header_func","[31]",0x7c), - 0x801C2730:("gPlayerFormObjectIndices","s16","[5]",0xA), + 0x801C26A8:("sSceneCmdHandlers","scene_header_func","[31]",0x7c), + 0x801C2730:("gPlayerFormObjectIds","s16","[5]",0xA), 0x801C273C:("gObjectTableSize","ObjectId","",0x4), 0x801C2740:("gObjectTable","RomFile","[643]",0x1418), - 0x801C3B60:("sSceneDrawDefaultDl","Gfx","[11]",0x58), + 0x801C3B60:("sSceneDrawDefaultDL","Gfx","[11]",0x58), 0x801C3BB8:("gSceneProcSceneDrawFuncs","SceneDrawConfigFunc","[8]",0x20), 0x801C3BD8:("gSceneProcDrawFuncs","scene_proc_draw_func","[6]",0x18), 0x801C3BF0:("D_801C3BF0","Gfx","[4]",0x20), @@ -1925,8 +1915,8 @@ 0x801C5EB0:("D_801C5EB0","UNK_TYPE4","",0x4), 0x801C5EC4:("D_801C5EC4","UNK_TYPE2","",0x2), 0x801C5F44:("D_801C5F44","UNK_TYPE4","",0x4), - 0x801C5FC0:("sPersistentCycleFlags","u32","[452]",0x710), - 0x801C66D0:("D_801C66D0","UNK_TYPE2","",0x2), + 0x801C5FC0:("sPersistentCycleSceneFlags","u32","[452]",0x710), + 0x801C66D0:("sPersistentCycleWeekEventRegs","UNK_TYPE2","",0x2), 0x801C6798:("gSramSlotOffsets","UNK_TYPE4","",0x4), 0x801C67B0:("gAmmoItems","UNK_TYPE1","",0x1), 0x801C67C8:("gFlashSaveStartPages","s32","[10]",0x28), @@ -1948,44 +1938,34 @@ 0x801C6A50:("D_801C6A50","UNK_TYPE1","",0x1), 0x801C6A58:("D_801C6A58","UNK_TYPE1","",0x1), 0x801C6A70:("D_801C6A70","UNK_TYPE1","",0x1), - 0x801C6A74:("D_801C6A74","UNK_TYPE2","",0x2), - 0x801C6A78:("D_801C6A78","UNK_TYPE2","",0x2), - 0x801C6A7C:("D_801C6A7C","UNK_TYPE2","",0x2), - 0x801C6A80:("D_801C6A80","UNK_TYPE2","",0x2), - 0x801C6A84:("D_801C6A84","UNK_TYPE2","",0x2), - 0x801C6A88:("D_801C6A88","UNK_TYPE2","",0x2), - 0x801C6A8C:("D_801C6A8C","UNK_TYPE2","",0x2), - 0x801C6A90:("D_801C6A90","UNK_TYPE2","",0x2), + 0x801C6A74:("sOcarinaButtonIndexBufPos","UNK_TYPE2","",0x2), + 0x801C6A78:("sOcarinaButtonIndexBufLen","UNK_TYPE2","",0x2), + 0x801C6A7C:("sLastPlayedSong","UNK_TYPE2","",0x2), + 0x801C6A80:("sOcarinaButtonStepR","UNK_TYPE2","",0x2), + 0x801C6A84:("sOcarinaButtonStepG","UNK_TYPE2","",0x2), + 0x801C6A88:("sOcarinaButtonStepB","UNK_TYPE2","",0x2), + 0x801C6A8C:("sOcarinaButtonFlashTimer","UNK_TYPE2","",0x2), + 0x801C6A90:("sOcarinaButtonFlashColorIndex","UNK_TYPE2","",0x2), 0x801C6A94:("D_801C6A94","UNK_TYPE2","",0x2), 0x801C6A98:("gPageSwitchNextButtonStatus","UNK_TYPE1","",0x1), 0x801C6AB8:("sBombersNotebookEventMessages","UNK_TYPE1","",0x1), 0x801C6B28:("gBombersNotebookWeekEventFlags","UNK_TYPE1","",0x1), 0x801C6B98:("D_801C6B98","UNK_TYPE1","",0x1), - 0x801CED40:("D_801CED40","UNK_TYPE1","",0x1), 0x801CFB08:("D_801CFB08","UNK_TYPE1","",0x1), - 0x801CFC78:("D_801CFC78","UNK_TYPE2","",0x2), - 0x801CFC7A:("D_801CFC7A","UNK_TYPE1","",0x1), - 0x801CFC7C:("D_801CFC7C","UNK_TYPE1","",0x1), - 0x801CFC7E:("D_801CFC7E","UNK_TYPE1","",0x1), - 0x801CFC84:("D_801CFC84","UNK_TYPE1","",0x1), - 0x801CFC88:("D_801CFC88","UNK_TYPE1","",0x1), - 0x801CFC8C:("D_801CFC8C","UNK_TYPE1","",0x1), - 0x801CFC8E:("D_801CFC8E","UNK_TYPE1","",0x1), - 0x801CFC92:("D_801CFC92","UNK_TYPE1","",0x1), - 0x801CFC98:("D_801CFC98","UNK_TYPE1","",0x1), - 0x801CFCA4:("D_801CFCA4","UNK_TYPE2","",0x2), - 0x801CFCAC:("D_801CFCAC","UNK_TYPE2","",0x2), + 0x801CFC78:("D_801CFC78","s16","[15]",0x1E), + 0x801CFC98:("sOcarinaButtonIndexBuf","UNK_TYPE1","",0x1), + 0x801CFCA4:("sOcarinaButtonAlphaValues","UNK_TYPE2","",0x2), 0x801CFCB8:("gOcarinaSongItemMap","UNK_TYPE1","",0x1), - 0x801CFCD8:("D_801CFCD8","UNK_TYPE2","",0x2), - 0x801CFCE4:("D_801CFCE4","UNK_TYPE2","",0x2), - 0x801CFCF0:("D_801CFCF0","UNK_TYPE2","",0x2), - 0x801CFCF4:("D_801CFCF4","UNK_TYPE2","",0x2), - 0x801CFCF8:("D_801CFCF8","UNK_TYPE2","",0x2), - 0x801CFCFC:("D_801CFCFC","UNK_TYPE2","",0x2), - 0x801CFD00:("D_801CFD00","UNK_TYPE2","",0x2), - 0x801CFD04:("D_801CFD04","UNK_TYPE2","",0x2), - 0x801CFD08:("D_801CFD08","UNK_TYPE2","",0x2), - 0x801CFD0C:("D_801CFD0C","UNK_TYPE2","",0x2), + 0x801CFCD8:("sIconPrimColors","UNK_TYPE2","",0x2), + 0x801CFCE4:("sIconEnvColors","UNK_TYPE2","",0x2), + 0x801CFCF0:("sIconPrimR","UNK_TYPE2","",0x2), + 0x801CFCF4:("sIconPrimG","UNK_TYPE2","",0x2), + 0x801CFCF8:("sIconPrimB","UNK_TYPE2","",0x2), + 0x801CFCFC:("sIconFlashTimer","UNK_TYPE2","",0x2), + 0x801CFD00:("sIconFlashColorIndex","UNK_TYPE2","",0x2), + 0x801CFD04:("sIconEnvR","UNK_TYPE2","",0x2), + 0x801CFD08:("sIconEnvG","UNK_TYPE2","",0x2), + 0x801CFD0C:("sIconEnvB","UNK_TYPE2","",0x2), 0x801CFD10:("D_801CFD10","UNK_TYPE2","",0x2), 0x801CFD1C:("D_801CFD1C","UNK_TYPE2","",0x2), 0x801CFD28:("D_801CFD28","UNK_TYPE2","",0x2), @@ -2006,24 +1986,24 @@ 0x801CFD74:("D_801CFD74","UNK_TYPE2","",0x2), 0x801CFD78:("D_801CFD78","UNK_TYPE2","",0x2), 0x801CFD7C:("D_801CFD7C","UNK_TYPE2","",0x2), - 0x801CFD80:("D_801CFD80","UNK_TYPE2","",0x2), - 0x801CFD84:("D_801CFD84","UNK_TYPE2","",0x2), - 0x801CFD88:("D_801CFD88","UNK_TYPE2","",0x2), - 0x801CFD8C:("D_801CFD8C","UNK_TYPE2","",0x2), - 0x801CFD90:("D_801CFD90","UNK_TYPE2","",0x2), - 0x801CFD94:("D_801CFD94","UNK_PTR","",0x4), - 0x801CFD98:("D_801CFD98","UNK_TYPE2","",0x2), - 0x801CFD9C:("D_801CFD9C","UNK_TYPE2","",0x2), - 0x801CFDA0:("D_801CFDA0","UNK_TYPE2","",0x2), + 0x801CFD80:("sAnalogStickHeld","UNK_TYPE2","",0x2), + 0x801CFD84:("sAnalogStickHeld","UNK_TYPE2","",0x2), + 0x801CFD88:("sAnalogStickHeld","UNK_TYPE2","",0x2), + 0x801CFD8C:("sAnalogStickHeld","UNK_TYPE2","",0x2), + 0x801CFD90:("sAnalogStickHeld","UNK_TYPE2","",0x2), + 0x801CFD94:("sTextboxWidth","UNK_PTR","",0x4), + 0x801CFD98:("sTextboxHeight","UNK_TYPE2","",0x2), + 0x801CFD9C:("sTextboxTexWidth","UNK_TYPE2","",0x2), + 0x801CFDA0:("sTextboxTexHeight","UNK_TYPE2","",0x2), 0x801CFDA4:("D_801CFDA4","UNK_TYPE1","",0x1), 0x801CFDC8:("D_801CFDC8","UNK_TYPE1","",0x1), 0x801CFDEC:("D_801CFDEC","UNK_TYPE1","",0x1), 0x801CFE04:("D_801CFE04","UNK_TYPE1","",0x1), 0x801CFE1C:("D_801CFE1C","UNK_TYPE1","",0x1), 0x801CFE34:("D_801CFE34","UNK_TYPE1","",0x1), - 0x801CFE4C:("D_801CFE4C","UNK_TYPE1","",0x1), - 0x801CFE5C:("D_801CFE5C","UNK_TYPE1","",0x1), - 0x801CFE68:("D_801CFE68","UNK_TYPE1","",0x1), + 0x801CFE4C:("sStrayFairyIconTextures","UNK_TYPE1","",0x1), + 0x801CFE5C:("sStrayFairyIconPrimColors","UNK_TYPE1","",0x1), + 0x801CFE68:("sStrayFairyIconEnvColors","UNK_TYPE1","",0x1), 0x801CFE74:("D_801CFE74","UNK_TYPE1","",0x1), 0x801CFEA4:("D_801CFEA4","UNK_TYPE1","",0x1), 0x801CFED4:("D_801CFED4","UNK_TYPE1","",0x1), @@ -2034,71 +2014,49 @@ 0x801CFF7C:("D_801CFF7C","UNK_TYPE1","",0x1), 0x801CFF88:("D_801CFF88","UNK_TYPE1","",0x1), 0x801CFF94:("D_801CFF94","UNK_TYPE1","",0x1), - 0x801D0000:("D_801D0000","UNK_TYPE1","",0x1), - 0x801D0001:("D_801D0001","UNK_TYPE1","",0x1), - 0x801D001F:("D_801D001F","UNK_TYPE1","",0x1), - 0x801D0188:("D_801D0188","UNK_TYPE1","",0x1), - 0x801D023A:("D_801D023A","UNK_TYPE1","",0x1), - 0x801D0250:("D_801D0250","UNK_TYPE1","",0x1), + 0x801D0188:("sOwlWarpTextJPN","UNK_TYPE1","",0x1), + 0x801D0250:("sOwlWarpTextLengthJPN","UNK_TYPE1","",0x1), 0x801D0268:("D_801D0268","UNK_TYPE2","",0x2), 0x801D027C:("D_801D027C","UNK_TYPE1","",0x1), 0x801D0284:("D_801D0284","UNK_TYPE1","",0x1), 0x801D028C:("D_801D028C","UNK_TYPE1","",0x1), - 0x801D02C0:("D_801D02C0","UNK_TYPE1","",0x1), - 0x801D02D8:("D_801D02D8","UNK_TYPE1","",0x1), - 0x801D02F8:("D_801D02F8","UNK_TYPE1","",0x1), + 0x801D02C0:("sOcarinaSongFlagsMap","UNK_TYPE1","",0x1), + 0x801D02D8:("sOcarinaEffectActorIds","UNK_TYPE1","",0x1), + 0x801D02F8:("sOcarinaEffectActorParams","UNK_TYPE1","",0x1), 0x801D0330:("D_801D0330","UNK_TYPE1","",0x1), - 0x801D0334:("D_801D0334","UNK_TYPE1","",0x1), - 0x801D0340:("D_801D0340","UNK_TYPE1","",0x1), - 0x801D034C:("D_801D034C","UNK_TYPE1","",0x1), - 0x801D0358:("D_801D0358","UNK_TYPE1","",0x1), - 0x801D0364:("D_801D0364","UNK_TYPE1","",0x1), - 0x801D0378:("D_801D0378","UNK_TYPE1","",0x1), - 0x801D039C:("D_801D039C","UNK_TYPE1","",0x8), - 0x801D03A4:("D_801D03A4","UNK_TYPE1","",0x1), + 0x801D0334:("sOcarinaButtonAPrimColors","UNK_TYPE1","",0x1), + 0x801D0340:("sOcarinaButtonAEnvColors","UNK_TYPE1","",0x1), + 0x801D034C:("sOcarinaButtonCPrimColors","UNK_TYPE1","",0x1), + 0x801D0358:("sOcarinaButtonCEnvColors","UNK_TYPE1","",0x1), + 0x801D0364:("sOcarinaButtonTextures","UNK_TYPE1","",0x1), + 0x801D0378:("sOcarinaSongFanfares","UNK_TYPE1","",0x1), + 0x801D039C:("sOcarinaSongFanfareIoData","UNK_TYPE1","",0x8), + 0x801D03A4:("sPlayerFormOcarinaInstruments","UNK_TYPE1","",0x1), 0x801D03A8:("D_801D03A8","UNK_TYPE1","",0x1), - 0x801D03C8:("D_801D03C8","UNK_TYPE1","",0x1), - 0x801D03E8:("D_801D03E8","UNK_TYPE1","",0x1), - 0x801D03F0:("D_801D03F0","UNK_TYPE1","",0x1), - 0x801D0401:("D_801D0401","UNK_TYPE1","",0x1), - 0x801D0408:("D_801D0408","UNK_TYPE1","",0x1), - 0x801D0428:("D_801D0428","UNK_TYPE1","",0x1), - 0x801D045A:("D_801D045A","UNK_TYPE1","",0x1), - 0x801D0462:("D_801D0462","UNK_TYPE1","",0x1), + 0x801D03C8:("sTextboxXPositions","UNK_TYPE1","",0x20), + 0x801D03E8:("sTextboxLowerYPositions","UNK_TYPE1","",0x20), + 0x801D0408:("sTextboxUpperYPositions","UNK_TYPE1","",0x1), + 0x801D0428:("sTextboxMidYPositions","UNK_TYPE1","",0x1), + 0x801D0448:("D_801D0448","s16","[10]",0x14), + 0x801D045C:("D_801D045C","s16","[3]",0x8), + 0x801D0464:("D_801D0464","s16","[2]",0x4), 0x801D0468:("D_801D0468","UNK_TYPE1","",0x1), - 0x801D0470:("D_801D0470","UNK_TYPE1","",0x1), - 0x801D06F0:("D_801D06F0","char","[]",0x18), - 0x801D0708:("D_801D0708","char","[]",1), - 0x801D0710:("D_801D0710","UNK_TYPE1","",0x1), - 0x801D0714:("D_801D0714","char","[]",0x1), - 0x801D0724:("D_801D0724","char","[]",0x1), - 0x801D0730:("D_801D0730","char","[]",0x1), - 0x801D0734:("D_801D0734","char","[]",0x1), - 0x801D0740:("D_801D0740","char","[]",0x1), - 0x801D0744:("D_801D0744","char","[]",0x1), - 0x801D0760:("D_801D0760","char","[]",0x1), - 0x801D0764:("D_801D0764","char","[]",0x1), - 0x801D0770:("D_801D0770","char","[]",0x1), - 0x801D0774:("D_801D0774","char","[]",0x1), - 0x801D0780:("D_801D0780","char","[]",0x1), - 0x801D0784:("D_801D0784","char","[]",0x1), - 0x801D0794:("D_801D0794","char","[]",0x1), - 0x801D07A4:("D_801D07A4","char","[]",0x1), - 0x801D07B0:("D_801D07B0","char","[]",0x1), - 0x801D07B4:("D_801D07B4","char","[]",0x1), - 0x801D07C0:("D_801D07C0","char","[]",0x1), - 0x801D07C4:("D_801D07C4","UNK_TYPE1","",0x1), + 0x801D0470:("sNESFontWidths","UNK_TYPE1","",0x1), + 0x801D06F0:("sRupeesTextLocalization","char","[]",0x18), + 0x801D0710:("sRupeesTextLength","UNK_TYPE1","",0x1), + 0x801D0714:("sOwlWarpTextENG","char","[]",0xB0), + 0x801D07C4:("sOwlWarpTextLengthENG","UNK_TYPE1","",0x16), 0x801D07DC:("D_801D07DC","UNK_TYPE1","",0x1), 0x801D080C:("D_801D080C","UNK_TYPE1","",0x1), 0x801D083C:("D_801D083C","UNK_TYPE1","",0x1), - 0x801D086C:("D_801D086C","UNK_TYPE1","",0x1), - 0x801D0890:("D_801D0890","UNK_TYPE1","",0x1), + 0x801D086C:("D_801D086C","UNK_TYPE1","",0x30), 0x801D089C:("D_801D089C","UNK_TYPE1","",0x1), 0x801D08CC:("D_801D08CC","UNK_TYPE1","",0x1), 0x801D08D8:("D_801D08D8","UNK_TYPE1","",0x1), 0x801D08E4:("D_801D08E4","UNK_TYPE1","",0x1), - 0x801D08E8:("D_801D08E8","UNK_TYPE1","",0x1), - 0x801D0900:("D_801D0900","UNK_TYPE1","",0x1), + 0x801D08E8:("sMaskCodeTextENG","UNK_TYPE1","",0x1), + 0x801D0900:("sMaskCodeTextLengthENG","UNK_TYPE1","",0x1), + 0x801D0910:("sCreditsFontWidths","f32","[]",0x1), 0x801D0B50:("Player_InitVars","ActorInit","",0x20), 0x801D0B70:("gKaleidoMgrOverlayTable","KaleidoMgrOverlay","",0x38), 0x801D0BA8:("sKaleidoAreaPtr","void*","",0x4), @@ -2164,11 +2122,11 @@ 0x801D150C:("gFramerateDivisorThird","f32","",0x4), 0x801D1520:("gScreenWidth","s32","",0x4), 0x801D1524:("gScreenHeight","s32","",0x4), - 0x801D1528:("startHeapSize","UNK_TYPE4","",0x4), + 0x801D1528:("gSystemHeapSize","UNK_TYPE4","",0x4), 0x801D1530:("sPadMgrInstance","PadMgr*","",0x4), 0x801D1534:("sPadMgrRetraceCount","UNK_TYPE4","",0x4), 0x801D1538:("sVoiceInitStatus","UNK_TYPE4","",0x4), - 0x801D1540:("D_801D1540","UNK_PTR","",0x4), + 0x801D1540:("sSpeedMeterTimeEntryArray","UNK_PTR","",0x4), 0x801D1570:("D_801D1570","f32","[13]",0x34), 0x801D15B0:("gZeroVec3f","Vec3f","",0xC), 0x801D15BC:("gZeroVec3s","Vec3s","",0x6), @@ -2252,7 +2210,7 @@ 0x801D66A0:("sEnterGanonsTowerTimer","UNK_TYPE1","",0x1), 0x801D66A4:("sSfxVolumeDuration","UNK_TYPE2","",0x2), 0x801D66A8:("sSoundMode","UNK_TYPE1","",0x1), - 0x801D66AC:("sAudioIsWindowOpen","UNK_TYPE1","",0x1), + 0x801D66AC:("sAudioPauseMenuOpenOrClose","UNK_TYPE1","",0x1), 0x801D66B0:("sAudioCutsceneFlag","UNK_TYPE1","",0x1), 0x801D66B4:("sSpecReverb","UNK_TYPE1","",0x1), 0x801D66B8:("sAudioEnvReverb","UNK_TYPE1","",0x1), @@ -3806,22 +3764,22 @@ 0x801E3F40:("njpgdspMainDataStart","UNK_TYPE1","",0x1), 0x801E3FA0:("D_801E3FA0","UNK_TYPE1","",0x1), 0x801E3FB0:("sEffectContext","EffectContext","",0x98E0), - 0x801ED890:("D_801ED890","UNK_TYPE1","",0x1), + 0x801ED890:("sFlagBitIndex","UNK_TYPE1","",0x1), 0x801ED894:("D_801ED894","UNK_TYPE1","",0x1), 0x801ED8A0:("sActorFaultClient","UNK_TYPE1","",0x1), 0x801ED8B0:("D_801ED8B0","UNK_TYPE1","",0x1), 0x801ED8B4:("D_801ED8B4","UNK_TYPE1","",0x1), - 0x801ED8B8:("D_801ED8B8","UNK_TYPE1","",0x1), - 0x801ED8BC:("D_801ED8BC","UNK_TYPE1","",0x1), + 0x801ED8B8:("sTargetableNearestActor","UNK_TYPE1","",0x1), + 0x801ED8BC:("sTargetablePrioritizedActor","UNK_TYPE1","",0x1), 0x801ED8C0:("D_801ED8C0","UNK_TYPE1","",0x1), 0x801ED8C4:("D_801ED8C4","UNK_TYPE1","",0x1), - 0x801ED8C8:("D_801ED8C8","f32","",0x4), + 0x801ED8C8:("sTargetableNearestActorDistSq","f32","",0x4), 0x801ED8CC:("sBgmEnemyDistSq","f32","",0x4), 0x801ED8D0:("D_801ED8D0","f32","",0x4), - 0x801ED8D4:("D_801ED8D4","UNK_TYPE1","",0x1), + 0x801ED8D4:("sTargetablePrioritizedPriority","UNK_TYPE1","",0x1), 0x801ED8D8:("D_801ED8D8","UNK_TYPE1","",0x1), - 0x801ED8DC:("D_801ED8DC","UNK_TYPE1","",0x1), - 0x801ED8E0:("D_801ED8E0","Mtx","",0x40), + 0x801ED8DC:("sTargetPlayerRotY","UNK_TYPE1","",0x1), + 0x801ED8E0:("sActorHiliteMtx","Mtx","",0x40), 0x801ED920:("D_801ED920","Actor*","",0x1), 0x801ED930:("D_801ED930","FaultClient","",0x10), 0x801ED940:("sActorOverlayTableFaultAddrConvClient","FaultAddrConvClient","",0xC), @@ -3909,45 +3867,45 @@ 0x801F4E20:("D_801F4E20","UNK_TYPE1","",0x1), 0x801F4E30:("D_801F4E30","UNK_TYPE1","",0x1), 0x801F4E31:("D_801F4E31","UNK_TYPE1","",0x1), - 0x801F4E32:("D_801F4E32","UNK_TYPE1","",0x1), - 0x801F4E38:("D_801F4E38","UNK_TYPE1","",0x1), + 0x801F4E32:("gCustomLensFlare1On","UNK_TYPE1","",0x1), + 0x801F4E38:("gCustomLensFlare1Pos","UNK_TYPE1","",0x1), 0x801F4E3C:("D_801F4E3C","UNK_TYPE1","",0x1), 0x801F4E40:("D_801F4E40","UNK_TYPE1","",0x1), 0x801F4E44:("D_801F4E44","UNK_TYPE1","",0x1), 0x801F4E48:("D_801F4E48","UNK_TYPE1","",0x1), 0x801F4E4C:("D_801F4E4C","UNK_TYPE1","",0x1), - 0x801F4E4E:("D_801F4E4E","UNK_TYPE1","",0x1), - 0x801F4E50:("D_801F4E50","UNK_TYPE1","",0x1), + 0x801F4E4E:("gCustomLensFlare2On","UNK_TYPE1","",0x1), + 0x801F4E50:("gCustomLensFlare2Pos","UNK_TYPE1","",0x1), 0x801F4E54:("D_801F4E54","UNK_TYPE1","",0x1), 0x801F4E58:("D_801F4E58","UNK_TYPE1","",0x1), 0x801F4E5C:("D_801F4E5C","UNK_TYPE1","",0x1), 0x801F4E60:("D_801F4E60","UNK_TYPE1","",0x1), 0x801F4E64:("D_801F4E64","UNK_TYPE1","",0x1), - 0x801F4E68:("D_801F4E68","UNK_TYPE1","",0x1), + 0x801F4E68:("gLightningStrike","UNK_TYPE1","",0x1), 0x801F4E70:("D_801F4E70","UNK_TYPE1","",0x1), 0x801F4E74:("D_801F4E74","UNK_TYPE1","",0x1), 0x801F4E78:("D_801F4E78","UNK_TYPE1","",0x1), - 0x801F4E7A:("D_801F4E7A","s16","",0x2), - 0x801F4E80:("D_801F4E80","UNK_TYPE1","",0x1), - 0x801F4EE0:("D_801F4EE0","UNK_TYPE1","",0x1), - 0x801F4EE8:("D_801F4EE8","UNK_TYPE1","",0x1), - 0x801F4EF8:("D_801F4EF8","UNK_TYPE1","",0x1), - 0x801F4F00:("D_801F4F00","UNK_TYPE1","",0x1), - 0x801F4F10:("D_801F4F10","UNK_TYPE1","",0x1), - 0x801F4F14:("D_801F4F14","UNK_TYPE1","",0x1), - 0x801F4F18:("D_801F4F18","UNK_TYPE1","",0x1), - 0x801F4F1C:("D_801F4F1C","UNK_TYPE1","",0x1), - 0x801F4F20:("D_801F4F20","UNK_TYPE1","",0x1), - 0x801F4F24:("D_801F4F24","UNK_TYPE1","",0x1), + 0x801F4E7A:("gSkyboxNumStars","s16","",0x2), + 0x801F4E80:("sLightningBolts","UNK_TYPE1","",0x1), + 0x801F4EE0:("sNGameOverLightNode","UNK_TYPE1","",0x1), + 0x801F4EE8:("sNGameOverLightInfo","UNK_TYPE1","",0x1), + 0x801F4EF8:("sSGameOverLightNode","UNK_TYPE1","",0x1), + 0x801F4F00:("sSGameOverLightInfo","UNK_TYPE1","",0x1), + 0x801F4F10:("sSunEnvAlpha","UNK_TYPE1","",0x1), + 0x801F4F14:("sSunColor","UNK_TYPE1","",0x1), + 0x801F4F18:("sSunScale","UNK_TYPE1","",0x1), + 0x801F4F1C:("sSunPrimAlpha","UNK_TYPE1","",0x1), + 0x801F4F20:("sSunDepthTestX","UNK_TYPE1","",0x1), + 0x801F4F24:("sSunDepthTestY","UNK_TYPE1","",0x1), 0x801F4F28:("D_801F4F28","UNK_TYPE1","",0x1), - 0x801F4F2C:("D_801F4F2C","UNK_TYPE1","",0x1), - 0x801F4F2E:("D_801F4F2E","UNK_TYPE1","",0x1), + 0x801F4F2C:("sLightningFlashAlpha","UNK_TYPE1","",0x1), + 0x801F4F2E:("sSandstormScroll","UNK_TYPE1","",0x1), 0x801F4F30:("D_801F4F30","UNK_TYPE1","",0x1), 0x801F4F31:("D_801F4F31","UNK_TYPE1","",0x1), - 0x801F4F32:("D_801F4F32","UNK_TYPE1","",0x1), + 0x801F4F32:("sEnvIsTimeStopped","UNK_TYPE1","",0x1), 0x801F4F33:("D_801F4F33","UNK_TYPE1","",0x1), - 0x801F4F34:("D_801F4F34","UNK_TYPE1","",0x1), - 0x801F4F38:("D_801F4F38","UNK_TYPE1","",0x1), + 0x801F4F34:("sGameOverLightsIntensity","UNK_TYPE1","",0x1), + 0x801F4F38:("sSkyboxStarsDList","UNK_TYPE1","",0x1), 0x801F4F40:("sBeatingHeartsDDPrim","s32","[3]",0x6), 0x801F4F48:("sBeatingHeartsDDEnv","s32","[3]",0x6), 0x801F4F50:("sHeartsDDPrim","s32","[2][3]",0xC), @@ -3991,21 +3949,21 @@ 0x801F6AE0:("sSkyboxDrawMatrix","Mtx*","",0x4), 0x801F6AF0:("D_801F6AF0","UNK_TYPE1","",0x1), 0x801F6AF2:("D_801F6AF2","UNK_TYPE1","",0x1), - 0x801F6B00:("D_801F6B00","UNK_TYPE4","",0x4), - 0x801F6B04:("D_801F6B04","UNK_TYPE4","",0x4), + 0x801F6B00:("sCharTexSize","UNK_TYPE4","",0x4), + 0x801F6B04:("sCharTexScale","UNK_TYPE4","",0x4), 0x801F6B08:("D_801F6B08","UNK_TYPE4","",0x4), - 0x801F6B0C:("D_801F6B0C","UNK_TYPE1","",0x1), - 0x801F6B0E:("D_801F6B0E","UNK_TYPE1","",0x1), - 0x801F6B10:("D_801F6B10","UNK_TYPE1","",0x1), - 0x801F6B12:("D_801F6B12","UNK_TYPE1","",0x1), - 0x801F6B14:("D_801F6B14","UNK_TYPE1","",0x1), - 0x801F6B16:("D_801F6B16","UNK_TYPE1","",0x1), - 0x801F6B18:("D_801F6B18","UNK_TYPE1","",0x1), - 0x801F6B1A:("D_801F6B1A","UNK_TYPE1","",0x1), - 0x801F6B1C:("D_801F6B1C","UNK_TYPE1","",0x1), - 0x801F6B1E:("D_801F6B1E","UNK_TYPE1","",0x1), - 0x801F6B20:("D_801F6B20","UNK_TYPE1","",0x1), - 0x801F6B22:("D_801F6B22","UNK_TYPE1","",0x1), + 0x801F6B0C:("sOcarinaButtonAPrimR","UNK_TYPE1","",0x1), + 0x801F6B0E:("sOcarinaButtonAPrimB","UNK_TYPE1","",0x1), + 0x801F6B10:("sOcarinaButtonAPrimG","UNK_TYPE1","",0x1), + 0x801F6B12:("sOcarinaButtonAEnvR","UNK_TYPE1","",0x1), + 0x801F6B14:("sOcarinaButtonAEnvB","UNK_TYPE1","",0x1), + 0x801F6B16:("sOcarinaButtonAEnvG","UNK_TYPE1","",0x1), + 0x801F6B18:("sOcarinaButtonCPrimR","UNK_TYPE1","",0x1), + 0x801F6B1A:("sOcarinaButtonCPrimB","UNK_TYPE1","",0x1), + 0x801F6B1C:("sOcarinaButtonCPrimG","UNK_TYPE1","",0x1), + 0x801F6B1E:("sOcarinaButtonCEnvR","UNK_TYPE1","",0x1), + 0x801F6B20:("sOcarinaButtonCEnvB","UNK_TYPE1","",0x1), + 0x801F6B22:("sOcarinaButtonCEnvG","UNK_TYPE1","",0x1), 0x801F6B30:("sPlayerCallInitFunc","UNK_TYPE1","",0x1), 0x801F6B34:("sPlayerCallDestroyFunc","UNK_TYPE1","",0x1), 0x801F6B38:("sPlayerCallUpdateFunc","UNK_TYPE1","",0x1), @@ -4021,7 +3979,7 @@ 0x801F6C18:("D_801F6C18","Input","",0x18), 0x801F6C30:("sTransitionTile","TransitionTile","",0xE0), 0x801F6D10:("gTransitionTileState","UNK_TYPE4","",0x4), - 0x801F6D18:("sVisMono","UNK_TYPE1","",0x1), + 0x801F6D18:("sPlayVisMono","VisMono","",0x18), 0x801F6D30:("gVisMonoColor","Color_RGBA8","",0x4), 0x801F6D38:("D_801F6D38","UNK_TYPE1","",0x1), 0x801F6D4C:("D_801F6D4C","UNK_TYPE4","",0x4), @@ -4029,26 +3987,26 @@ 0x801F6DFC:("sBombersNotebookOpen","u8","",0x1), 0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1), 0x801F6E00:("sSlowlyMgr","SlowlyMgr","",0x1c0), - 0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1), + 0x801F6FC0:("sSlowlyRunning","UNK_TYPE1","",0x1), 0x801F6FC8:("sSlowlyStackInfo","StackEntry","",0x1c), 0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000), - 0x801F7FF0:("D_801F7FF0","UNK_TYPE1","",0x1), - 0x801F8010:("D_801F8010","struct_801F8010","",0x10), - 0x801F8020:("sVisZbuf","VisZbuf","",0x10), - 0x801F8030:("sMonoColors","VisMono","",0x18), - 0x801F8048:("D_801F8048","ViMode","",0x88), + 0x801F7FF0:("sGameSpeedMeter","SpeedMeter","", 0x20), + 0x801F8010:("sGameVisCvg","VisCvg","",0x10), + 0x801F8020:("sGameVisZbuf","VisZbuf","",0x10), + 0x801F8030:("sGameVisMono","VisMono","",0x18), + 0x801F8048:("sGameViMode","ViMode","",0x88), 0x801F80D0:("sGraphFaultAddrConvClient","FaultAddrConvClient","",0xc), 0x801F80E0:("sGraphFaultClient","FaultClient","",0x10), 0x801F80F0:("gGfxMasterDL","Gfx*","",0x4), 0x801F80F8:("sGraphCfbInfos","UNK_TYPE1","",0x1), - 0x801F8150:("sGraphTaskStartTime","u64","",0x8), - 0x801F8160:("sSiIntMsgQ","OSMesgQueue","",0x18), - 0x801F8178:("sSiIntMsgBuf","OSMesg","[1]",0x4), + 0x801F8150:("sGraphPrevUpdateEndTime","u64","",0x8), + 0x801F8160:("sSerialEventQueue","OSMesgQueue","",0x18), + 0x801F8178:("sSerialMsgBuf","OSMesg","[1]",0x4), 0x801F8180:("gSegments","u32","[16]",0x40), 0x801F81C0:("gSchedContext","SchedContext","",0x338), - 0x801F84F8:("irqClient","IrqMgrClient","",0x8), - 0x801F8500:("irqMgrMsgQ","OSMesgQueue","",0x18), - 0x801F8518:("irqMgrMsgBuf","OSMesg","[60]",0xf0), + 0x801F84F8:("sIrqClient","IrqMgrClient","",0x8), + 0x801F8500:("sIrqMgrMsgQueue","OSMesgQueue","",0x18), + 0x801F8518:("sIrqMgrMsgBuf","OSMesg","[60]",0xf0), 0x801F8608:("gGraphThread","OSThread","",0x1b0), 0x801F87B8:("sGraphStack","u8","[6144]",0x1800), 0x801F9FB8:("sSchedStack","u8","[1536]",0x600), @@ -4061,24 +4019,22 @@ 0x801FB338:("sAudioMgr","AudioMgr","",0x2e0), 0x801FB620:("gPadMgr","PadMgr","",0x480), 0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1), - 0x801FBAB0:("sRSPGFXStartTime","OSTime","",0x8), - 0x801FBAB8:("sRSPAudioStartTime","OSTime","",0x8), - 0x801FBAC0:("sRSPOtherStartTime","OSTime","",0x8), + 0x801FBAB0:("sRSPGfxTimeStart","OSTime","",0x8), + 0x801FBAB8:("sRSPAudioTimeStart","OSTime","",0x8), + 0x801FBAC0:("sRSPOtherTimeStart","OSTime","",0x8), 0x801FBAC8:("sRDPStartTime","OSTime","",0x8), 0x801FBAD0:("gAudioSPDataPtr","u64*","",0x4), 0x801FBAD4:("gAudioSPDataSize","u32","",0x4), - 0x801FBAE0:("D_801FBAE0","UNK_TYPE1","",0x1), - 0x801FBAE8:("D_801FBAE8","UNK_TYPE1","",0x1), - 0x801FBAF0:("D_801FBAF0","volatile OSTime","",0x8), - 0x801FBAF8:("lastRenderFrameDuration","volatile OSTime","",0x8), - 0x801FBB00:("gRSPAudioTotalTime","UNK_TYPE1","",0x1), - 0x801FBB04:("D_801FBB04","UNK_TYPE1","",0x1), - 0x801FBB08:("sRSPGFXTotalTime","UNK_TYPE1","",0x1), - 0x801FBB0C:("D_801FBB0C","UNK_TYPE1","",0x1), - 0x801FBB10:("sRSPOtherTotalTime","UNK_TYPE1","",0x1), - 0x801FBB14:("D_801FBB14","UNK_TYPE1","",0x1), - 0x801FBB20:("gRDPTotalTime","UNK_TYPE1","",0x1), - 0x801FBB28:("D_801FBB28","UNK_TYPE1","",0x1), + 0x801FBAE0:("gRSPAudioTimeTotal","volatile OSTime","",0x8), + 0x801FBAE8:("gRSPGfxTimeTotal","volatile OSTime","",0x8), + 0x801FBAF0:("gRDPTimeTotal","volatile OSTime","",0x8), + 0x801FBAF8:("gGraphUpdatePeriod","volatile OSTime","",0x8), + 0x801FBB00:("gRSPAudioTimeAcc","volatile OSTime","",0x8), + 0x801FBB08:("gRSPGfxTimeAcc","volatile OSTime","",0x8), + 0x801FBB10:("gRSPOtherTimeAcc","volatile OSTime","",0x8), + 0x801FBB18:("gUnkTimeAcc","volatile OSTime","",0x8), + 0x801FBB20:("gRDPTimeAcc","volatile OSTime","",0x8), + 0x801FBB28:("sSpeedMeterTimeEntryPtr","UNK_TYPE1","",0x1), 0x801FBB30:("sNotebookViMode","OSViMode","",0x50), 0x801FBB80:("gFramebuffers","u32*","[2]",0x8), 0x801FBB88:("gActiveViMode","OSViMode*","",0x4), @@ -4225,7 +4181,7 @@ 0x801FD3AB:("sFanfareState","UNK_TYPE1","",0x1), 0x801FD3AC:("sFanfareSeqId","UNK_TYPE1","",0x1), 0x801FD3AE:("sMuteOnlySfxAndAmbienceSeq","UNK_TYPE1","",0x1), - 0x801FD3AF:("sAllPlayersMutedExceptOcaAndSys","UNK_TYPE1","",0x1), + 0x801FD3AF:("sAllPlayersMutedExceptSystemAndOcarina","UNK_TYPE1","",0x1), 0x801FD3B0:("sAudioPauseState","UNK_TYPE1","",0x1), 0x801FD3B4:("sSpatialSeqIsActive","u8","[4]",0x4), 0x801FD3B8:("sSequenceFilter","UNK_TYPE1","",0x1), @@ -4923,7 +4879,7 @@ 0x8082DA82:("sPauseZRCursorGreen","UNK_TYPE1","",0x1), 0x8082DA84:("sPauseZRCursorBlue","UNK_TYPE1","",0x1), 0x8082DA86:("sPauseZRCursorAlpha","UNK_TYPE1","",0x1), - 0x8085B9F0:("D_8085B9F0","UNK_TYPE1","",0x1), + 0x8085B9F0:("sPlayerUpperBodyLimbCopyMap","UNK_TYPE1","",0x1), 0x8085BA08:("D_8085BA08","UNK_TYPE1","",0x1), 0x8085BA20:("D_8085BA20","UNK_TYPE1","",0x1), 0x8085BA38:("sPlayerAgeProperties","UNK_TYPE1","",0x1), @@ -4951,12 +4907,12 @@ 0x8085C928:("D_8085C928","UNK_TYPE1","",0x14), 0x8085C93C:("D_8085C93C","UNK_TYPE1","",0x1), 0x8085C96C:("D_8085C96C","UNK_TYPE1","",0x1), - 0x8085C98C:("D_8085C98C","UNK_TYPE1","",0x1), + 0x8085C98C:("sZoraBarrierEnvLighting","UNK_TYPE1","",0x1), 0x8085C99C:("sItemActionParams","UNK_TYPE1","",0x1), - 0x8085C9F0:("D_8085C9F0","UNK_PTR","",0x4), - 0x8085CB3C:("D_8085CB3C","UNK_PTR","",0x4), - 0x8085CC88:("D_8085CC88","UNK_TYPE1","",0x1), - 0x8085CD00:("D_8085CD00","s8","[36]",0x24), + 0x8085C9F0:("sPlayerUpperActionUpdateFuncs","UNK_PTR","",0x4), + 0x8085CB3C:("sPlayerItemActionInitFuncs","UNK_PTR","",0x4), + 0x8085CC88:("sPlayerItemChangeInfo","UNK_TYPE1","",0x1), + 0x8085CD00:("sPlayerItemChangeTypes","s8","[36]",0x24), 0x8085CD24:("sPlayerExplosiveInfo","UNK_TYPE1","",0x1), 0x8085CD30:("sMeleeAttackAnimInfo","UNK_TYPE1","",0x220), 0x8085CF50:("D_8085CF50","UNK_TYPE1","",0x1), @@ -4968,7 +4924,7 @@ 0x8085CF80:("D_8085CF80","UNK_TYPE1","",0x1), 0x8085CF84:("D_8085CF84","UNK_TYPE1","",0x1), 0x8085CF88:("D_8085CF88","BlureColors","[2]",0x20), - 0x8085CFA8:("D_8085CFA8","u16","[4]",0x8), + 0x8085CFA8:("sPlayerItemButtons","u16","[4]",0x8), 0x8085CFB0:("D_8085CFB0","UNK_TYPE1","",0x1), 0x8085CFB8:("sMagicArrowCosts","u8","[4]",0x4), 0x8085CFBC:("D_8085CFBC","UNK_TYPE1","",0x1), @@ -4976,19 +4932,19 @@ 0x8085CFCC:("D_8085CFCC","UNK_TYPE1","",0x1), 0x8085CFD4:("D_8085CFD4","UNK_TYPE1","",0x1), 0x8085CFDC:("D_8085CFDC","UNK_TYPE1","",0x1), - 0x8085CFE4:("D_8085CFE4","UNK_TYPE1","",0x1), - 0x8085CFEC:("D_8085CFEC","UNK_TYPE1","",0x1), - 0x8085CFF8:("D_8085CFF8","UNK_TYPE1","",0x1), - 0x8085D004:("D_8085D004","UNK_TYPE1","",0x1), - 0x8085D00C:("D_8085D00C","UNK_TYPE1","",0x1), - 0x8085D018:("D_8085D018","UNK_TYPE1","",0x1), - 0x8085D01C:("D_8085D01C","UNK_TYPE1","",0x1), - 0x8085D028:("D_8085D028","UNK_TYPE1","",0x1), - 0x8085D034:("D_8085D034","UNK_TYPE1","",0x1), - 0x8085D044:("D_8085D044","UNK_TYPE1","",0x1), - 0x8085D048:("D_8085D048","UNK_TYPE1","",0x1), - 0x8085D050:("D_8085D050","UNK_TYPE1","",0x1), - 0x8085D054:("D_8085D054","UNK_PTR","",0x4), + 0x8085CFE4:("sPlayerActionChangeList1","UNK_TYPE1","",0x1), + 0x8085CFEC:("sPlayerActionChangeList2","UNK_TYPE1","",0x1), + 0x8085CFF8:("sPlayerActionChangeList3","UNK_TYPE1","",0x1), + 0x8085D004:("sPlayerActionChangeList4","UNK_TYPE1","",0x1), + 0x8085D00C:("sPlayerActionChangeList5","UNK_TYPE1","",0x1), + 0x8085D018:("sPlayerActionChangeList6","UNK_TYPE1","",0x1), + 0x8085D01C:("sPlayerActionChangeList7","UNK_TYPE1","",0x1), + 0x8085D028:("sPlayerActionChangeList8","UNK_TYPE1","",0x1), + 0x8085D034:("sPlayerActionChangeList9","UNK_TYPE1","",0x1), + 0x8085D044:("sPlayerActionChangeList10","UNK_TYPE1","",0x1), + 0x8085D048:("sPlayerActionChangeList11","UNK_TYPE1","",0x1), + 0x8085D050:("sPlayerActionChangeList12","UNK_TYPE1","",0x1), + 0x8085D054:("sPlayerActionChangeFuncs","UNK_PTR","",0x4), 0x8085D090:("D_8085D090","UNK_TYPE1","",0x1), 0x8085D094:("D_8085D094","UNK_TYPE1","",0x6), 0x8085D09C:("D_8085D09C","UNK_TYPE4","",0x4), @@ -5016,7 +4972,7 @@ 0x8085D224:("D_8085D224","UNK_TYPE1","",0x30), 0x8085D254:("D_8085D254","u16","[4]",0x8), 0x8085D25C:("D_8085D25C","UNK_TYPE1","",0x1), - 0x8085D264:("D_8085D264","UNK_TYPE1","",0x1), + 0x8085D264:("sPlayerSlopeSlipAnims","UNK_TYPE1","",0x1), 0x8085D26C:("D_8085D26C","UNK_TYPE1","",0x1), 0x8085D270:("D_8085D270","UNK_TYPE1","",0x1), 0x8085D27C:("D_8085D27C","Vec3f","",0xC), @@ -5026,7 +4982,7 @@ 0x8085D2B0:("D_8085D2B0","UNK_TYPE1","",0x1), 0x8085D2B4:("D_8085D2B4","UNK_TYPE1","",0x1), 0x8085D2C0:("sInitChain","ActorInitVar","",0x4), - 0x8085D2C4:("D_8085D2C4","UNK_TYPE4","",0x4), + 0x8085D2C4:("sPlayerSkeletonBaseTransl","UNK_TYPE4","",0x4), 0x8085D2CC:("D_8085D2CC","UNK_PTR","",0x4), 0x8085D30C:("D_8085D30C","EffectBlureInit2","",0x24), 0x8085D330:("D_8085D330","EffectTireMarkInit","",0x8), @@ -5035,12 +4991,12 @@ 0x8085D340:("D_8085D340","UNK_TYPE1","",0x1), 0x8085D34C:("D_8085D34C","UNK_TYPE1","",0x1), 0x8085D354:("D_8085D354","UNK_TYPE1","",0x1), - 0x8085D358:("D_8085D358","Vec3f","",0xC), + 0x8085D358:("sInteractWallCheckOffset","Vec3f","",0xC), 0x8085D364:("D_8085D364","UNK_TYPE1","",0x1), 0x8085D370:("D_8085D370","UNK_TYPE1","",0x1), 0x8085D37C:("D_8085D37C","UNK_TYPE1","",0x1), 0x8085D380:("D_8085D380","UNK_TYPE1","",0x1), - 0x8085D384:("D_8085D384","UNK_TYPE1","",0x1), + 0x8085D384:("sPlayerCsModes","UNK_TYPE1","",0x1), 0x8085D3E0:("D_8085D3E0","UNK_TYPE1","",0x1), 0x8085D3F4:("D_8085D3F4","UNK_TYPE1","",0x1), 0x8085D3F8:("D_8085D3F8","UNK_TYPE1","",0x1), @@ -5128,7 +5084,7 @@ 0x8085D96C:("D_8085D96C","UNK_TYPE1","",0x1), 0x8085D978:("D_8085D978","UNK_TYPE1","",0x1), 0x8085D984:("D_8085D984","UNK_TYPE1","",0x1), - 0x8085D990:("D_8085D990","UNK_TYPE1","",0x1), + 0x8085D990:("sPlayerCsModeAnimFuncs","UNK_TYPE1","",0x1), 0x8085D9E0:("D_8085D9E0","UNK_TYPE1","",0x1), 0x8085D9F0:("D_8085D9F0","UNK_TYPE1","",0x1), 0x8085D9FC:("D_8085D9FC","UNK_TYPE1","",0x1), @@ -5150,8 +5106,8 @@ 0x8085DA88:("D_8085DA88","UNK_TYPE1","",0x1), 0x8085DA8C:("D_8085DA8C","UNK_TYPE1","",0x1), 0x8085DA90:("D_8085DA90","UNK_TYPE1","",0x1), - 0x8085DA94:("D_8085DA94","UNK_TYPE1","",0x1), - 0x8085DEF4:("D_8085DEF4","UNK_TYPE1","",0x1), + 0x8085DA94:("sPlayerCsModeInitFuncs","UNK_TYPE1","",0x1), + 0x8085DEF4:("sPlayerCsModeUpdateFuncs","UNK_TYPE1","",0x1), 0x8085E354:("D_8085E354","UNK_TYPE1","",0x1), 0x8085E368:("D_8085E368","UNK_TYPE2","",0x2), 0x8085E3A4:("D_8085E3A4","UNK_TYPE1","",0x1), @@ -5367,27 +5323,27 @@ 0x8085E6F0:("D_8085E6F0","f32","",0x4), 0x8085E6F4:("D_8085E6F4","f32","",0x4), 0x80862AF0:("sDogSpawnPos","Vec3f","",0xC), - 0x80862AFC:("D_80862AFC","f32","",0x4), - 0x80862B00:("D_80862B00","UNK_TYPE1","",0x1), + 0x80862AFC:("sPlayerControlStickMagnitude","f32","",0x4), + 0x80862B00:("sPlayerControlStickAngle","UNK_TYPE1","",0x1), 0x80862B02:("D_80862B02","UNK_TYPE1","",0x1), 0x80862B04:("D_80862B04","UNK_TYPE1","",0x1), - 0x80862B08:("sPlayerCurrentFloorType","UNK_TYPE1","",0x1), - 0x80862B0C:("sPlayerCurrentWallFlags","UNK_TYPE1","",0x1), + 0x80862B08:("sPlayerFloorType","UNK_TYPE1","",0x1), + 0x80862B0C:("sPlayerTouchedWallFlags","UNK_TYPE1","",0x1), 0x80862B10:("sPlayerConveyorSpeedIndex","UNK_TYPE1","",0x1), 0x80862B14:("sPlayerIsOnFloorConveyor","UNK_TYPE1","",0x1), - 0x80862B16:("D_80862B16","UNK_TYPE1","",0x1), - 0x80862B18:("D_80862B18","f32","",0x4), + 0x80862B16:("sPlayerConveyorYaw","UNK_TYPE1","",0x1), + 0x80862B18:("sPlayerYDistToFloor","f32","",0x4), 0x80862B1C:("sPlayerPrevFloorProperty","UNK_TYPE1","",0x1), - 0x80862B20:("D_80862B20","UNK_TYPE1","",0x1), - 0x80862B24:("D_80862B24","UNK_TYPE1","",0x1), - 0x80862B28:("D_80862B28","UNK_TYPE1","",0x1), + 0x80862B20:("sPlayerShapeYawToTouchedWall","UNK_TYPE1","",0x1), + 0x80862B24:("sPlayerWorldYawToTouchedWall","UNK_TYPE1","",0x1), + 0x80862B28:("sPlayerFloorPitchShape","UNK_TYPE1","",0x1), 0x80862B2C:("D_80862B2C","UNK_TYPE1","",0x1), - 0x80862B30:("D_80862B30","UNK_TYPE1","",0x1), + 0x80862B30:("sPlayerInteractWallCheckResult","UNK_TYPE1","",0x1), 0x80862B3C:("D_80862B3C","f32","",0x4), - 0x80862B40:("D_80862B40","UNK_TYPE1","",0x1), + 0x80862B40:("sPlayerFloorEffect","UNK_TYPE1","",0x1), 0x80862B44:("sPlayerControlInput","UNK_TYPE1","",0x1), - 0x80862B48:("D_80862B48","UNK_TYPE1","",0x1), - 0x80862B4C:("D_80862B4C","UNK_TYPE1","",0x1), + 0x80862B48:("sPlayerUseHeldItem","UNK_TYPE1","",0x1), + 0x80862B4C:("sPlayerHeldItemButtonIsHeldDown","UNK_TYPE1","",0x1), 0x80862B50:("D_80862B50","UNK_TYPE1","",0x1), 0x80862B6C:("D_80862B6C","UNK_TYPE1","",0x1), 0x808637B0:("En_Test_InitVars","ActorInit","",0x20), @@ -5451,7 +5407,7 @@ 0x80867784:("D_80867784","UNK_TYPE1","",0x1), 0x8086778C:("D_8086778C","UNK_PTR","",0x4), 0x8086780C:("En_Door_InitVars","UNK_TYPE1","",0x1), - 0x8086782C:("sObjInfo","UNK_TYPE2","",0x126), + 0x8086782C:("sObjectInfo","UNK_TYPE2","",0x126), 0x80867954:("sInitChain","UNK_TYPE1","",0x1), 0x80867964:("sAnimations","AnimationHeader","[10]",0x28), 0x8086798C:("sAnimOpenFrames","u8","[10]",0x10), @@ -5676,7 +5632,7 @@ 0x8087936C:("D_8087936C","UNK_TYPE1","",0x1), 0x80879370:("D_80879370","UNK_TYPE1","",0x1), 0x8087937C:("D_8087937C","UNK_TYPE1","",0x1), - 0x80879388:("D_80879388","UNK_TYPE1","",0x1), + 0x80879388:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x8087938E:("D_8087938E","UNK_TYPE1","",0x1), 0x8087938F:("D_8087938F","UNK_TYPE1","",0x1), 0x80879394:("D_80879394","UNK_TYPE1","",0x1), @@ -6032,7 +5988,7 @@ 0x80899564:("D_80899564","f32","",0x4), 0x8089956C:("D_8089956C","f32","",0x4), 0x80899570:("D_80899570","UNK_TYPE1","",0x1), - 0x808995A0:("D_808995A0","UNK_TYPE1","",0x1), + 0x808995A0:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808995A3:("D_808995A3","UNK_TYPE1","",0x1), 0x808995A4:("D_808995A4","UNK_TYPE1","",0x1), 0x808995C0:("D_808995C0","f32","",0x4), @@ -6100,7 +6056,7 @@ 0x8089E38C:("D_8089E38C","UNK_TYPE1","",0x1), 0x8089E398:("D_8089E398","UNK_TYPE1","",0x1), 0x8089E3A4:("D_8089E3A4","UNK_TYPE1","",0x1), - 0x8089E3B0:("D_8089E3B0","UNK_TYPE1","",0x1), + 0x8089E3B0:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x8089E3B4:("D_8089E3B4","UNK_TYPE1","",0x1), 0x8089E3B6:("D_8089E3B6","UNK_TYPE1","",0x1), 0x8089E3B7:("D_8089E3B7","UNK_TYPE1","",0x1), @@ -6464,7 +6420,7 @@ 0x808BEF84:("D_808BEF84","UNK_TYPE1","",0x1), 0x808BEF90:("D_808BEF90","UNK_TYPE1","",0x1), 0x808BEF94:("D_808BEF94","UNK_TYPE1","",0x1), - 0x808BEF98:("D_808BEF98","UNK_TYPE1","",0x1), + 0x808BEF98:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808BEF9A:("D_808BEF9A","UNK_TYPE1","",0x1), 0x808BEFA4:("D_808BEFA4","UNK_TYPE1","",0x1), 0x808BEFE0:("D_808BEFE0","f32","",0x4), @@ -6663,7 +6619,7 @@ 0x808CD5E8:("D_808CD5E8","f32","",0x4), 0x808CE290:("Demo_Effect_InitVars","UNK_TYPE1","",0x1), 0x808CE2B0:("D_808CE2B0","UNK_TYPE4","",0x4), - 0x808CE2C0:("sEffectTypeObjects","s16","",0x12), + 0x808CE2C0:("sEffectTypeObjectIds","s16","",0x12), 0x808CE2D4:("sAlphaTypes","u8","",0x15), 0x808CE2F0:("jtbl_808CE2F0","UNK_PTR","",0x4), 0x808CE314:("D_808CE314","f32","",0x4), @@ -6729,7 +6685,7 @@ 0x808D38D4:("D_808D38D4","UNK_TYPE1","",0x1), 0x808D38F4:("D_808D38F4","UNK_TYPE1","",0x1), 0x808D3900:("D_808D3900","UNK_TYPE4","",0x4), - 0x808D393C:("D_808D393C","UNK_TYPE1","",0x1), + 0x808D393C:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x808D393E:("D_808D393E","UNK_TYPE1","",0x1), 0x808D394E:("D_808D394E","UNK_TYPE1","",0x1), 0x808D394F:("D_808D394F","UNK_TYPE1","",0x1), @@ -6859,8 +6815,7 @@ 0x808DE3E4:("D_808DE3E4","f32","",0x4), 0x808DE5B0:("D_808DE5B0","UNK_TYPE1","",0x1), 0x808DFEA0:("En_Horse_Link_Child_InitVars","UNK_TYPE1","",0x1), - 0x808DFEC0:("D_808DFEC0","UNK_TYPE4","",0x4), - 0x808DFEC8:("D_808DFEC8","UNK_TYPE4","",0x4), + 0x808DFEC0:("D_808DFEC0","UNK_TYPE4","",0x14), 0x808DFED4:("D_808DFED4","UNK_TYPE1","",0x1), 0x808DFEF8:("D_808DFEF8","UNK_TYPE1","",0x1), 0x808DFF08:("D_808DFF08","UNK_TYPE1","",0x1), @@ -7973,7 +7928,7 @@ 0x8092DD54:("D_8092DD54","UNK_PTR","",0x4), 0x8092DD60:("sAnimations","UNK_TYPE1","",0x1), 0x8092DE00:("D_8092DE00","UNK_TYPE1","",0x1), - 0x8092DE0C:("D_8092DE0C","UNK_TYPE1","",0x1), + 0x8092DE0C:("sCsAnimIndex","UNK_TYPE1","",0x1), 0x8092DE1C:("D_8092DE1C","UNK_TYPE1","",0x1), 0x8092DE30:("D_8092DE30","f32","",0x4), 0x8092DE34:("D_8092DE34","f32","",0x4), @@ -9149,7 +9104,7 @@ 0x809942E8:("D_809942E8","UNK_TYPE1","",0x1), 0x809942EC:("D_809942EC","UNK_TYPE1","",0x1), 0x809942F0:("D_809942F0","UNK_TYPE1","",0x1), - 0x809942FC:("D_809942FC","UNK_TYPE1","",0x1), + 0x809942FC:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80994302:("D_80994302","UNK_TYPE1","",0x1), 0x80994320:("D_80994320","f32","",0x4), 0x80994324:("D_80994324","f32","",0x4), @@ -9351,10 +9306,10 @@ 0x8099FE3C:("D_8099FE3C","UNK_TYPE1","",0x1), 0x8099FE50:("D_8099FE50","UNK_TYPE1","",0x1), 0x809A0D80:("En_Ge3_InitVars","UNK_TYPE1","",0x1), - 0x809A0DA0:("D_809A0DA0","UNK_TYPE1","",0x1), - 0x809A0DCC:("D_809A0DCC","UNK_TYPE1","",0x1), - 0x809A0DF0:("D_809A0DF0","UNK_TYPE4","",0x4), - 0x809A0DFC:("D_809A0DFC","UNK_TYPE1","",0x1), + 0x809A0DA0:("sCylinderInit","ColliderCylinderInit","",0x2C), + 0x809A0DCC:("sAnimations","AnimationHeader*","[9]",0x24), + 0x809A0DF0:("sFocusOffset","Vec3f","",0xC), + 0x809A0DFC:("sEyeTextures","TexturePtr","[3]",0xC), 0x809A0E10:("jtbl_809A0E10","UNK_PTR","",0x4), 0x809A1A80:("Obj_Hamishi_InitVars","UNK_TYPE1","",0x1), 0x809A1AA0:("D_809A1AA0","UNK_TYPE1","",0x1), @@ -9411,10 +9366,9 @@ 0x809A5BF0:("D_809A5BF0","f32","",0x4), 0x809A5BF4:("D_809A5BF4","f32","",0x4), 0x809A6150:("Obj_Boyo_InitVars","UNK_TYPE1","",0x1), - 0x809A6170:("D_809A6170","UNK_TYPE1","",0x1), - 0x809A619C:("D_809A619C","UNK_TYPE1","",0x1), - 0x809A61B0:("D_809A61B0","UNK_TYPE1","",0x1), - 0x809A61B4:("D_809A61B4","UNK_TYPE2","",0x2), + 0x809A6170:("sCylinderInit","ColliderCylinderInit","",0x1), + 0x809A619C:("sInitChain","InitChainEntry","[]",0x4), + 0x809A61AC:("gCollisionHandling","ObjBoyoUnkStruct","[]",0x20), 0x809A61D0:("D_809A61D0","f32","",0x4), 0x809A61D4:("D_809A61D4","f32","",0x4), 0x809A61D8:("D_809A61D8","f32","",0x4), @@ -9423,8 +9377,8 @@ 0x809A61E4:("D_809A61E4","f32","",0x4), 0x809A61E8:("D_809A61E8","f32","",0x4), 0x809A8C80:("sOccupiedIndices","UNK_TYPE4","",0x4), - 0x809A8C94:("sLimbIndexToShadowBodyPartsIndex","UNK_TYPE1","",0x1), - 0x809A8CAC:("sParentBodyParts","UNK_TYPE1","",0x1), + 0x809A8C94:("sLimbToBodyParts","UNK_TYPE1","",0x1), + 0x809A8CAC:("sParentShadowBodyParts","UNK_TYPE1","",0x1), 0x809A8CC4:("sShadowSizes","UNK_TYPE1","",0x1), 0x809A8CDC:("sDamageTable","UNK_TYPE1","",0x1), 0x809A8CFC:("En_Grasshopper_InitVars","UNK_TYPE1","",0x1), @@ -9792,7 +9746,7 @@ 0x809C6104:("D_809C6104","UNK_TYPE4","",0x4), 0x809C6108:("En_Bom_Bowl_Man_InitVars","UNK_TYPE1","",0x1), 0x809C6128:("D_809C6128","UNK_TYPE1","",0x1), - 0x809C6178:("D_809C6178","UNK_TYPE1","",0x1), + 0x809C6178:("sAnimationModes","UNK_TYPE1","",0x1), 0x809C618C:("D_809C618C","UNK_TYPE2","",0x2), 0x809C6198:("D_809C6198","UNK_TYPE2","",0x2), 0x809C61A0:("D_809C61A0","UNK_TYPE1","",0x1), @@ -9820,7 +9774,7 @@ 0x809C9480:("sTownFierceDeityPlayerPos","UNK_TYPE4","",0x4), 0x809C948C:("sTownPlayerPos","UNK_TYPE4","",0x4), 0x809C9498:("sGameStartTimer","s16","",0x2), - 0x809C949C:("sHasSpawnedGuaysForThisWave","UNK_TYPE2","",0x2), + 0x809C949C:("sHasSignaledGuaysForThisWave","UNK_TYPE2","",0x2), 0x809C94A0:("sBonusTimer","s32","",0x4), 0x809C94A4:("sGameStartTimer","s16","",0x2), 0x809C94A8:("sModFromLosingTime","s32","",0x4), @@ -10032,7 +9986,7 @@ 0x809DF550:("D_809DF550","UNK_TYPE1","",0x1), 0x809DF570:("D_809DF570","UNK_TYPE1","",0x1), 0x809DF590:("Boss_02_InitVars","UNK_TYPE1","",0x1), - 0x809DF5B0:("D_809DF5B0","f32","",0x4), + 0x809DF5B0:("sGiantModeScaleFactor","f32","",0x4), 0x809DF5B4:("D_809DF5B4","UNK_TYPE2","[24]",0x30), 0x809DF5E4:("D_809DF5E4","UNK_TYPE2","[24]",0x30), 0x809DF614:("D_809DF614","UNK_TYPE1","",0x1), @@ -10117,9 +10071,9 @@ 0x809DFD34:("D_809DFD34","f32","",0x4), 0x809DFD38:("D_809DFD38","f32","",0x4), 0x809DFD3C:("D_809DFD3C","f32","",0x4), - 0x809E0420:("D_809E0420","UNK_TYPE1","",0x1), - 0x809E0421:("D_809E0421","UNK_TYPE1","",0x1), - 0x809E0422:("D_809E0422","UNK_TYPE1","",0x1), + 0x809E0420:("sCanSkipMaskOnCs","UNK_TYPE1","",0x1), + 0x809E0421:("sCanSkipMaskOffCs","UNK_TYPE1","",0x1), + 0x809E0422:("sIsInGiantMode","UNK_TYPE1","",0x1), 0x809E0424:("sRedTwinmold","UNK_TYPE4","",0x4), 0x809E0428:("sBlueTwinmold","UNK_TYPE4","",0x4), 0x809E042C:("sTwinmoldStatic","UNK_TYPE4","",0x4), @@ -10137,7 +10091,7 @@ 0x809E90FC:("sGyorgDustPrimColor","UNK_TYPE1","",0x1), 0x809E9100:("sGyorgDustEnvColor","UNK_TYPE1","",0x1), 0x809E9104:("D_809E9104","UNK_TYPE1","",0x1), - 0x809E9128:("sGyorgSphElementIndices","s8","[30]",0x1E), + 0x809E9128:("sLimbToBodyParts","s8","[30]",0x1E), 0x809E9148:("D_809E9148","UNK_TYPE1","",0x1), 0x809E9154:("D_809E9154","Vec3f","[7]",0x54), 0x809E91A8:("D_809E91A8","UNK_TYPE1","",0x1), @@ -10581,27 +10535,11 @@ 0x80A0A88C:("sSeed1","UNK_TYPE4","",0x4), 0x80A0A890:("sSeed2","UNK_TYPE4","",0x4), 0x80A0C4A0:("Bg_Dy_Yoseizo_InitVars","UNK_TYPE1","",0x1), - 0x80A0C4C0:("D_80A0C4C0","UNK_TYPE4","",0x4), - 0x80A0C4C4:("D_80A0C4C4","UNK_TYPE4","",0x4), - 0x80A0C4C8:("D_80A0C4C8","UNK_TYPE4","",0x4), - 0x80A0C4CC:("D_80A0C4CC","UNK_TYPE4","",0x4), - 0x80A0C4D0:("D_80A0C4D0","UNK_TYPE4","",0x4), - 0x80A0C4D8:("D_80A0C4D8","UNK_TYPE4","",0x4), - 0x80A0C4DC:("D_80A0C4DC","UNK_TYPE4","",0x4), - 0x80A0C4E0:("D_80A0C4E0","UNK_TYPE4","",0x4), - 0x80A0C4E4:("D_80A0C4E4","UNK_TYPE1","",0x1), - 0x80A0C4F8:("D_80A0C4F8","UNK_TYPE1","",0x1), - 0x80A0C50C:("D_80A0C50C","UNK_TYPE1","",0x1), - 0x80A0C514:("D_80A0C514","UNK_TYPE1","",0x1), - 0x80A0C540:("D_80A0C540","f32","",0x4), - 0x80A0C544:("D_80A0C544","f32","",0x4), - 0x80A0C548:("D_80A0C548","f32","",0x4), - 0x80A0C54C:("D_80A0C54C","f32","",0x4), - 0x80A0C550:("D_80A0C550","f32","",0x4), - 0x80A0C554:("D_80A0C554","f32","",0x4), - 0x80A0C558:("D_80A0C558","f32","",0x4), - 0x80A0C55C:("D_80A0C55C","f32","",0x4), - 0x80A0C560:("D_80A0C560","f32","",0x4), + 0x80A0C4C0:("sAnimations","AnimationHeader*","9",0x24), + 0x80A0C4E4:("sEffectPrimColors","Color_RGB8","6",0x12), + 0x80A0C4F8:("sEffectEnvColors","Color_RGB8","6",0x12), + 0x80A0C50C:("sMouthTextures","UNK_TYPE1","2",0x8), + 0x80A0C514:("sStretchFactors","f32","8",0x20), 0x80A0C7C0:("En_Boj_05_InitVars","UNK_TYPE1","",0x1), 0x80A10860:("sAnimationsBombShopkeeper","UNK_PTR","",0x4), 0x80A10890:("En_Sob1_InitVars","UNK_TYPE1","",0x1), @@ -11204,11 +11142,11 @@ 0x80A37A88:("D_80A37A88","UNK_TYPE1","",0x1), 0x80A37B08:("D_80A37B08","UNK_TYPE1","",0x1), 0x80A37B88:("D_80A37B88","UNK_TYPE1","",0x1), - 0x80A37B90:("D_80A37B90","UNK_TYPE1","",0x1), - 0x80A37B94:("D_80A37B94","UNK_TYPE1","",0x1), - 0x80A37B98:("D_80A37B98","UNK_TYPE1","",0x1), - 0x80A37BA4:("D_80A37BA4","UNK_TYPE1","",0x1), - 0x80A37BA8:("D_80A37BA8","UNK_TYPE1","",0x1), + 0x80A37B90:("sDustPrimColor","UNK_TYPE1","",0x1), + 0x80A37B94:("sDustEnvColor","UNK_TYPE1","",0x1), + 0x80A37B98:("sBubbleAccel","UNK_TYPE1","",0x1), + 0x80A37BA4:("sBubblePrimColor","UNK_TYPE1","",0x1), + 0x80A37BA8:("sBubbleEnvColor","UNK_TYPE1","",0x1), 0x80A37BB0:("D_80A37BB0","f32","",0x4), 0x80A37BB4:("D_80A37BB4","f32","",0x4), 0x80A37BB8:("D_80A37BB8","f32","",0x4), @@ -11566,7 +11504,7 @@ 0x80A5349C:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80A535DC:("D_80A535DC","UNK_TYPE1","",0x1), 0x80A535F0:("D_80A535F0","UNK_TYPE4","",0x4), - 0x80A535FC:("D_80A535FC","UNK_TYPE1","",0x1), + 0x80A535FC:("sCsAnimIndex","UNK_TYPE1","",0x1), 0x80A53620:("jtbl_80A53620","UNK_PTR","",0x4), 0x80A53648:("jtbl_80A53648","UNK_PTR","",0x4), 0x80A53B50:("Bg_Keikoku_Saku_InitVars","UNK_TYPE1","",0x1), @@ -11782,30 +11720,25 @@ 0x80A61794:("D_80A61794","f32","",0x4), 0x80A61798:("D_80A61798","f32","",0x4), 0x80A6179C:("D_80A6179C","f32","",0x4), - 0x80A63CC0:("En_Bal_InitVars","UNK_TYPE1","",0x1), - 0x80A63CE0:("D_80A63CE0","UNK_TYPE1","",0x1), - 0x80A63D00:("D_80A63D00","UNK_PTR","",0x4), - 0x80A63D0C:("D_80A63D0C","UNK_TYPE1","",0x1), - 0x80A63D30:("D_80A63D30","UNK_TYPE1","",0x1), - 0x80A63D40:("D_80A63D40","UNK_TYPE1","",0x1), - 0x80A63D58:("D_80A63D58","UNK_PTR","",0x4), - 0x80A63EA8:("D_80A63EA8","UNK_TYPE4","",0x4), - 0x80A63EB4:("D_80A63EB4","f32","",0x4), - 0x80A63EB8:("D_80A63EB8","f32","",0x4), - 0x80A63EBC:("D_80A63EBC","f32","",0x4), - 0x80A63EC0:("D_80A63EC0","UNK_TYPE1","",0x1), - 0x80A63EC4:("D_80A63EC4","f32","",0x4), - 0x80A63ECC:("D_80A63ECC","UNK_TYPE1","",0x1), - 0x80A63ED0:("D_80A63ED0","UNK_TYPE1","",0x1), - 0x80A63ED4:("D_80A63ED4","f32","",0x4), - 0x80A63ED8:("D_80A63ED8","f32","",0x4), - 0x80A63EDC:("D_80A63EDC","f32","",0x4), - 0x80A63EE0:("D_80A63EE0","UNK_TYPE1","",0x1), - 0x80A63EEC:("D_80A63EEC","UNK_TYPE1","",0x1), - 0x80A63EF0:("D_80A63EF0","UNK_TYPE1","",0x1), - 0x80A63EF4:("D_80A63EF4","UNK_TYPE4","",0x4), - 0x80A63EF8:("D_80A63EF8","UNK_TYPE1","",0x1), - 0x80A63F04:("D_80A63F04","UNK_TYPE1","",0x1), + 0x80A63CC0:("En_Bal_InitVars","ActorInit","",0x1), + 0x80A63CE0:("sDamageTable","DamageTable","",0x1), + 0x80A63D00:("sColChkInfoInit","CollisionCheckInfoInit2","",0x1), + 0x80A63D0C:("sJntSphElementsInit","ColliderJntSphElementInit","",0x1), + 0x80A63D30:("sJntSphInit","ColliderJntSphInit","",0x1), + 0x80A63D40:("sBuyMapOptions","s16","",0xC), + 0x80A63D58:("sAnimationInfo","AnimationInfo","",0xE), + 0x80A63EA8:("sInitBalloonScale","Vec3f","",0x1), + 0x80A63EB4:("sSparkleVelocity","Vec3f","",0x1), + 0x80A63EC0:("sSparkleAccel","Vec3f","",0x1), + 0x80A63ECC:("sSparklePrimColor","Color_RGBA8","",0x1), + 0x80A63ED0:("sSparkleEnvColor","Color_RGBA8","",0x1), + 0x80A63ED4:("sDustVelocity","Vec3f","",0x1), + 0x80A63EE0:("sDustAccel","Vec3f","",0x1), + 0x80A63EEC:("sDustPrimColor","Color_RGBA8","",0x1), + 0x80A63EF0:("sDustEnvColor","Color_RGBA8","",0x1), + 0x80A63EF4:("sGetItemPending","s32","",0x1), + 0x80A63EF8:("sFocusPosMultiplier","Vec3f","",0x1), + 0x80A63F04:("sEyeTextures","TexturePtr","",0x2), 0x80A63F10:("D_80A63F10","f32","",0x4), 0x80A63F14:("D_80A63F14","f32","",0x4), 0x80A63F18:("D_80A63F18","f32","",0x4), @@ -12275,19 +12208,19 @@ 0x80A8FF6C:("D_80A8FF6C","f32","",0x4), 0x80A906E0:("En_Test5_InitVars","UNK_TYPE1","",0x1), 0x80A93E60:("En_Test6_InitVars","UNK_TYPE1","",0x1), - 0x80A93E80:("D_80A93E80","UNK_TYPE1","",0x1), - 0x80A9402C:("D_80A9402C","UNK_TYPE1","",0x1), - 0x80A94048:("D_80A94048","UNK_TYPE1","",0x1), - 0x80A9404C:("D_80A9404C","UNK_TYPE1","",0x1), - 0x80A94050:("D_80A94050","UNK_TYPE1","",0x1), - 0x80A94054:("D_80A94054","UNK_TYPE2","",0x2), - 0x80A94058:("D_80A94058","UNK_TYPE2","",0x2), + 0x80A93E80:("sDoubleSoTCsCamData","UNK_TYPE1","",0x1), + 0x80A9402C:("sSoTCsAmmoDropTextures","UNK_TYPE1","",0x1), + 0x80A94048:("sInvSoTCsFogColor","UNK_TYPE1","",0x1), + 0x80A9404C:("sInvSoTCsAmbientColor","UNK_TYPE1","",0x1), + 0x80A94050:("sInvSoTCsDiffuseColor","UNK_TYPE1","",0x1), + 0x80A94054:("sInvSoTCsFogNear","UNK_TYPE2","",0x2), + 0x80A94058:("sInvSoTCsZFar","UNK_TYPE2","",0x2), 0x80A9405C:("D_80A9405C","UNK_TYPE1","",0x1), - 0x80A94068:("D_80A94068","UNK_TYPE1","",0x1), - 0x80A9406C:("D_80A9406C","UNK_TYPE1","",0x1), - 0x80A94070:("D_80A94070","UNK_TYPE1","",0x1), - 0x80A94074:("D_80A94074","UNK_TYPE2","",0x2), - 0x80A94078:("D_80A94078","UNK_TYPE2","",0x2), + 0x80A94068:("sDoubleSoTCsFogColor","UNK_TYPE1","",0x1), + 0x80A9406C:("sDoubleSoTCsAmbientColor","UNK_TYPE1","",0x1), + 0x80A94070:("sDoubleSoTCsDiffuseColor","UNK_TYPE1","",0x1), + 0x80A94074:("sDoubleSoTCsFogNear","UNK_TYPE2","",0x2), + 0x80A94078:("sDoubleSoTCsZFar","UNK_TYPE2","",0x2), 0x80A94080:("D_80A94080","f32","",0x4), 0x80A94084:("D_80A94084","f32","",0x4), 0x80A94088:("D_80A94088","f32","",0x4), @@ -12318,7 +12251,7 @@ 0x80A94338:("jtbl_80A94338","UNK_PTR","",0x4), 0x80A94360:("D_80A94360","f32","",0x4), 0x80A94364:("D_80A94364","f32","",0x4), - 0x80A94910:("D_80A94910","UNK_TYPE4","",0x4), + 0x80A94910:("sSoTCsAmmoDrops","UNK_TYPE4","",0x4), 0x80A99010:("D_80A99010","UNK_TYPE4","",0x4), 0x80A990F0:("En_Az_InitVars","UNK_TYPE1","",0x1), 0x80A99110:("D_80A99110","UNK_TYPE1","",0x1), @@ -12762,7 +12695,7 @@ 0x80AC1E04:("D_80AC1E04","f32","",0x4), 0x80AC2580:("En_Door_Etc_InitVars","UNK_TYPE1","",0x1), 0x80AC25A0:("sCylinderInit","UNK_TYPE1","",0x1), - 0x80AC25CC:("sObjInfo","UNK_TYPE2","",0x2), + 0x80AC25CC:("sObjectInfo","UNK_TYPE2","",0x2), 0x80AC2634:("sInitChain","UNK_TYPE1","",0x1), 0x80AC2650:("D_80AC2650","f32","",0x4), 0x80AC4510:("En_Bigokuta_InitVars","UNK_TYPE1","",0x1), @@ -12774,7 +12707,7 @@ 0x80AC45B0:("D_80AC45B0","UNK_TYPE1","",0x1), 0x80AC45B4:("D_80AC45B4","UNK_TYPE1","",0x1), 0x80AC45B8:("D_80AC45B8","UNK_TYPE1","",0x1), - 0x80AC45BC:("D_80AC45BC","UNK_TYPE1","",0x1), + 0x80AC45BC:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80AC45D0:("D_80AC45D0","UNK_TYPE1","",0x1), 0x80AC460C:("D_80AC460C","UNK_TYPE1","",0x1), 0x80AC4610:("D_80AC4610","f32","",0x4), @@ -13001,14 +12934,14 @@ 0x80AD8DE0:("D_80AD8DE0","UNK_TYPE1","",0x1), 0x80AD8E0C:("D_80AD8E0C","UNK_TYPE1","",0x1), 0x80AD8E14:("D_80AD8E14","UNK_TYPE1","",0x1), - 0x80AD8E34:("D_80AD8E34","UNK_TYPE4","",0x4), + 0x80AD8E34:("sEyeTextures","UNK_TYPE4","",0x4), 0x80AD8E44:("D_80AD8E44","UNK_TYPE1","",0x1), - 0x80AD8E50:("D_80AD8E50","UNK_TYPE4","",0x4), - 0x80AD8E54:("D_80AD8E54","UNK_TYPE1","",0x1), - 0x80AD8E58:("D_80AD8E58","UNK_TYPE1","",0x1), - 0x80AD8E5C:("D_80AD8E5C","UNK_TYPE1","",0x1), - 0x80AD8E68:("D_80AD8E68","UNK_TYPE1","",0x1), - 0x80AD8EA4:("D_80AD8EA4","UNK_TYPE1","",0x1), + 0x80AD8E50:("sTexturesDesegmented","UNK_TYPE4","",0x4), + 0x80AD8E54:("sSnowPrimColor","UNK_TYPE1","",0x1), + 0x80AD8E58:("sSnowEnvColor","UNK_TYPE1","",0x1), + 0x80AD8E5C:("sVelocity","UNK_TYPE1","",0x1), + 0x80AD8E68:("sBodyLimbBodyPartOffsets","Vec3f","[5]",0x3C), + 0x80AD8EA4:("sLimbToBodyParts","s8","[13]",0xD), 0x80AD8EA5:("D_80AD8EA5","UNK_TYPE1","",0x1), 0x80AD8EC0:("D_80AD8EC0","f32","",0x4), 0x80AD8EC4:("D_80AD8EC4","f32","",0x4), @@ -13773,7 +13706,7 @@ 0x80B1DADC:("D_80B1DADC","UNK_TYPE1","",0x1), 0x80B1DAEC:("D_80B1DAEC","UNK_TYPE1","",0x1), 0x80B1DAFC:("D_80B1DAFC","UNK_TYPE1","",0x1), - 0x80B1DB08:("D_80B1DB08","UNK_TYPE1","",0x1), + 0x80B1DB08:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80B1DB10:("D_80B1DB10","UNK_TYPE1","",0x1), 0x80B1DB11:("D_80B1DB11","UNK_TYPE1","",0x1), 0x80B1DB12:("D_80B1DB12","UNK_TYPE1","",0x1), @@ -13848,7 +13781,7 @@ 0x80B23C70:("D_80B23C70","f32","",0x4), 0x80B23E80:("Obj_Dowsing_InitVars","UNK_TYPE1","",0x1), 0x80B24460:("Obj_Wind_InitVars","UNK_TYPE1","",0x1), - 0x80B24480:("D_80B24480","UNK_TYPE1","",0x1), + 0x80B24480:("sInitChain","UNK_TYPE1","",0x1), 0x80B2448C:("D_80B2448C","UNK_TYPE1","",0x1), 0x80B245CC:("D_80B245CC","UNK_TYPE4","",0x4), 0x80B245D0:("D_80B245D0","f32","",0x4), @@ -13902,8 +13835,8 @@ 0x80B2B360:("D_80B2B360","UNK_TYPE1","",0x1), 0x80B2B370:("D_80B2B370","f32","",0x4), 0x80B2B380:("D_80B2B380","f32","",0x4), - 0x80B2B388:("D_80B2B388","UNK_TYPE1","",0x1), - 0x80B2B3A0:("D_80B2B3A0","UNK_TYPE1","",0x1), + 0x80B2B388:("sAnimations","UNK_TYPE1","",0x1), + 0x80B2B3A0:("sAnimationModes","UNK_TYPE1","",0x1), 0x80B2B3A8:("D_80B2B3A8","UNK_TYPE1","",0x1), 0x80B2B3C0:("D_80B2B3C0","f32","",0x4), 0x80B2B3C4:("D_80B2B3C4","f32","",0x4), @@ -13967,7 +13900,7 @@ 0x80B2F700:("D_80B2F700","UNK_TYPE1","",0x1), 0x80B2F708:("D_80B2F708","UNK_TYPE1","",0x1), 0x80B2F710:("D_80B2F710","UNK_TYPE1","",0x1), - 0x80B2F71C:("D_80B2F71C","UNK_TYPE1","",0x1), + 0x80B2F71C:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80B2F734:("D_80B2F734","UNK_TYPE1","",0x1), 0x80B2F760:("D_80B2F760","f32","",0x4), 0x80B2F764:("D_80B2F764","f32","",0x4), @@ -14148,7 +14081,7 @@ 0x80B3A9E4:("D_80B3A9E4","f32","",0x4), 0x80B3A9E8:("D_80B3A9E8","f32","",0x4), 0x80B3BEE0:("En_Gg2_InitVars","UNK_TYPE1","",0x1), - 0x80B3BF00:("D_80B3BF00","UNK_TYPE4","",0x4), + 0x80B3BF00:("sAnimationInfo","UNK_TYPE4","",0x4), 0x80B3C080:("D_80B3C080","UNK_TYPE4","",0x4), 0x80B3C084:("D_80B3C084","UNK_TYPE4","",0x4), 0x80B3C088:("D_80B3C088","UNK_TYPE1","",0x1), @@ -14169,7 +14102,7 @@ 0x80B3DCAC:("D_80B3DCAC","UNK_TYPE1","",0x1), 0x80B3DCB8:("sAnimations","UNK_TYPE1","",0x1), 0x80B3DE58:("D_80B3DE58","UNK_TYPE1","",0x1), - 0x80B3DE74:("sCsAnimations","UNK_TYPE1","",0x1), + 0x80B3DE74:("sCsAnimIndex","UNK_TYPE1","",0x1), 0x80B3DEAC:("sEyeTextures","UNK_TYPE1","",0x1), 0x80B3DEC0:("D_80B3DEC0","f32","",0x4), 0x80B3DEC4:("D_80B3DEC4","f32","",0x4), @@ -14191,7 +14124,7 @@ 0x80B3FDF4:("D_80B3FDF4","UNK_TYPE4","",0x4), 0x80B3FE00:("D_80B3FE00","UNK_TYPE2","",0x2), 0x80B3FE08:("D_80B3FE08","UNK_TYPE4","",0x4), - 0x80B3FE38:("D_80B3FE38","UNK_TYPE1","",0x1), + 0x80B3FE38:("sCsAnimIndex","UNK_TYPE1","",0x1), 0x80B3FE4C:("D_80B3FE4C","f32","",0x4), 0x80B3FE50:("D_80B3FE50","f32","",0x4), 0x80B3FE54:("D_80B3FE54","f32","",0x4), @@ -14665,7 +14598,7 @@ 0x80B65044:("D_80B65044","UNK_TYPE1","",0x1), 0x80B65064:("D_80B65064","UNK_TYPE1","",0x1), 0x80B6506C:("D_80B6506C","UNK_TYPE1","",0x1), - 0x80B65078:("D_80B65078","UNK_TYPE1","",0x1), + 0x80B65078:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80B65084:("D_80B65084","UNK_TYPE1","",0x1), 0x80B650B0:("D_80B650B0","f32","",0x4), 0x80B650B4:("D_80B650B4","f32","",0x4), @@ -15319,7 +15252,7 @@ 0x80BA50BC:("D_80BA50BC","UNK_TYPE1","",0x1), 0x80BA50DC:("D_80BA50DC","UNK_TYPE1","",0x1), 0x80BA510C:("D_80BA510C","UNK_TYPE1","",0x1), - 0x80BA5120:("D_80BA5120","UNK_TYPE2","",0x2), + 0x80BA5120:("sOcarinaActionWindFishPrompts","UNK_TYPE2","",0x2), 0x80BA5128:("D_80BA5128","UNK_TYPE1","",0x1), 0x80BA512C:("D_80BA512C","UNK_PTR","",0x4), 0x80BA5174:("D_80BA5174","UNK_PTR","",0x4), @@ -15820,8 +15753,8 @@ 0x80BDAFA0:("D_80BDAFA0","f32","",0x4), 0x80BDC0B0:("En_Hidden_Nuts_InitVars","UNK_TYPE1","",0x1), 0x80BDC0D0:("D_80BDC0D0","UNK_TYPE1","",0x1), - 0x80BDC0FC:("D_80BDC0FC","UNK_TYPE1","",0x1), - 0x80BDC120:("D_80BDC120","UNK_TYPE1","",0x1), + 0x80BDC0FC:("sAnimations","UNK_TYPE1","",0x1), + 0x80BDC120:("sAnimationModes","UNK_TYPE1","",0x1), 0x80BDC12C:("D_80BDC12C","UNK_TYPE1","",0x1), 0x80BDC138:("D_80BDC138","UNK_TYPE1","",0x1), 0x80BDC144:("D_80BDC144","UNK_TYPE1","",0x1), @@ -15920,13 +15853,13 @@ 0x80BE48AC:("D_80BE48AC","f32","",0x4), 0x80BE48B0:("D_80BE48B0","f32","",0x4), 0x80BE48B4:("D_80BE48B4","f32","",0x4), - 0x80BE5D80:("D_80BE5D80","UNK_TYPE4","",0x4), + 0x80BE5D80:("sFragmentAndItemDropCount","UNK_TYPE4","",0x4), 0x80BE5D84:("En_Tanron5_InitVars","UNK_TYPE1","",0x1), 0x80BE5DA4:("D_80BE5DA4","UNK_TYPE1","",0x1), - 0x80BE5DD0:("D_80BE5DD0","f32","",0x4), - 0x80BE5DD4:("D_80BE5DD4","UNK_TYPE2","",0x2), - 0x80BE5E24:("D_80BE5E24","UNK_TYPE1","",0x1), - 0x80BE5E74:("D_80BE5E74","UNK_TYPE1","",0x1), + 0x80BE5DD0:("sGiantModeScaleFactor","f32","",0x4), + 0x80BE5DD4:("sSpawnPosList","UNK_TYPE2","",0x2), + 0x80BE5E24:("sDLists","UNK_TYPE1","",0x1), + 0x80BE5E74:("sBaseScales","UNK_TYPE1","",0x1), 0x80BE5ED0:("D_80BE5ED0","f32","",0x4), 0x80BE5ED4:("D_80BE5ED4","f32","",0x4), 0x80BE5ED8:("D_80BE5ED8","f32","",0x4), @@ -15947,7 +15880,7 @@ 0x80BE78F0:("sTextIds","s16","",0x1), 0x80BE7900:("D_80BE7900","UNK_TYPE1","",0x1), 0x80BE792C:("sAnimations","AnimationHeader*","",0x1), - 0x80BE7958:("D_80BE7958","UNK_TYPE1","",0x1), + 0x80BE7958:("sAnimationModes","UNK_TYPE1","",0x1), 0x80BE7970:("D_80BE7970","f32","",0x4), 0x80BE7974:("D_80BE7974","f32","",0x4), 0x80BE7978:("D_80BE7978","f32","",0x4), @@ -16177,7 +16110,7 @@ 0x80C00A70:("D_80C00A70","UNK_TYPE1","",0x1), 0x80C00A8C:("D_80C00A8C","UNK_TYPE1","",0x1), 0x80C00A94:("D_80C00A94","UNK_TYPE1","",0x1), - 0x80C00AE4:("D_80C00AE4","UNK_TYPE1","",0x1), + 0x80C00AE4:("sAnimationModes","UNK_TYPE1","",0x1), 0x80C00AF8:("D_80C00AF8","UNK_TYPE2","",0x2), 0x80C00B08:("D_80C00B08","UNK_TYPE1","",0x1), 0x80C00B18:("D_80C00B18","UNK_TYPE1","",0x1), @@ -16205,8 +16138,8 @@ 0x80C032C8:("jtbl_80C032C8","UNK_PTR","",0x4), 0x80C04750:("En_Bombers_InitVars","UNK_TYPE1","",0x1), 0x80C04770:("D_80C04770","UNK_TYPE1","",0x1), - 0x80C0479C:("D_80C0479C","UNK_TYPE1","",0x1), - 0x80C047E0:("D_80C047E0","UNK_TYPE1","",0x1), + 0x80C0479C:("sAnimations","UNK_TYPE1","",0x1), + 0x80C047E0:("sAnimationModes","UNK_TYPE1","",0x1), 0x80C047F8:("D_80C047F8","UNK_TYPE1","",0x1), 0x80C04808:("D_80C04808","UNK_TYPE1","",0x1), 0x80C04818:("D_80C04818","UNK_PTR","",0x4), @@ -16346,7 +16279,7 @@ 0x80C13670:("D_80C13670","UNK_TYPE1","",0x1), 0x80C1367C:("D_80C1367C","UNK_TYPE1","",0x1), 0x80C1368C:("D_80C1368C","UNK_TYPE1","",0x1), - 0x80C13698:("D_80C13698","UNK_TYPE1","",0x1), + 0x80C13698:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x80C136B0:("D_80C136B0","f32","",0x4), 0x80C136B4:("D_80C136B4","f32","",0x4), 0x80C136B8:("D_80C136B8","f32","",0x4), @@ -16423,26 +16356,25 @@ 0x80C19218:("D_80C19218","UNK_TYPE4","",0x4), 0x80C19220:("D_80C19220","UNK_TYPE1","",0x1), 0x80C1AA40:("En_Invadepoh_Demo_InitVars","UNK_TYPE1","",0x1), - 0x80C1AA60:("D_80C1AA60","UNK_TYPE1","",0x1), - 0x80C1AA62:("D_80C1AA62","UNK_TYPE1","",0x1), - 0x80C1AA74:("D_80C1AA74","UNK_TYPE1","",0x1), - 0x80C1AA88:("D_80C1AA88","UNK_TYPE1","",0x1), - 0x80C1AAA0:("D_80C1AAA0","UNK_TYPE1","",0x1), - 0x80C1AAB0:("D_80C1AAB0","UNK_TYPE1","",0x1), - 0x80C1AAC8:("D_80C1AAC8","UNK_TYPE1","",0x1), - 0x80C1AAD8:("D_80C1AAD8","UNK_PTR","",0x4), - 0x80C1AAEC:("D_80C1AAEC","UNK_PTR","",0x4), - 0x80C1AB00:("D_80C1AB00","UNK_PTR","",0x4), - 0x80C1AB1C:("D_80C1AB1C","UNK_TYPE1","",0x1), - 0x80C1AB28:("D_80C1AB28","UNK_PTR","",0x4), - 0x80C1AB3C:("D_80C1AB3C","UNK_PTR","",0x4), - 0x80C1AB4C:("D_80C1AB4C","UNK_PTR","",0x4), + 0x80C1AA60:("sCueTypes","s32","[5]",0x14), + 0x80C1AA74:("sAlienInitChain","InitChainEntry","[5]",0x14), + 0x80C1AA88:("sRomaniInitChain","InitChainEntry","[6]",0x18), + 0x80C1AAA0:("sCowInitChain","InitChainEntry","[4]",0x10), + 0x80C1AAB0:("sUfoInitChain","InitChainEntry","[6]",0x18), + 0x80C1AAC8:("sCowTailInitChain","InitChainEntry","[4]",0x10), + 0x80C1AAD8:("sInitFuncs","UNK_PTR","[5]",0x14), + 0x80C1AAEC:("sDestroyFuncs","UNK_PTR","[5]",0x14), + 0x80C1AB00:("sAlienCueActionCsFuncs","UNK_PTR","[7]",0x1C), + 0x80C1AB1C:("sRomaniCueActionCsFuncs","UNK_TYPE1","[3]",0xC), + 0x80C1AB28:("sCowCueActionCsFuncs","UNK_PTR","[5]",0x14), + 0x80C1AB3C:("sUfoCueActionCsFuncs","UNK_PTR","[4]",0x10), + 0x80C1AB4C:("sDrawFuncs","UNK_PTR","[5]",0x14), 0x80C1AB60:("D_80C1AB60","f32","",0x4), 0x80C1AB64:("D_80C1AB64","f32","",0x4), 0x80C1AB68:("D_80C1AB68","f32","",0x4), 0x80C1AB6C:("D_80C1AB6C","f32","",0x4), - 0x80C1AD40:("D_80C1AD40","UNK_TYPE1","",0x1), - 0x80C1AD80:("D_80C1AD80","UNK_TYPE1","",0x1), + 0x80C1AD40:("sAlienLeftEyeBeamMtxF","MtxF","",0x40), + 0x80C1AD80:("sAlienRightEyeBeamMtxF","MtxF","",0x40), 0x80C1B520:("Obj_Danpeilift_InitVars","UNK_TYPE1","",0x1), 0x80C1B540:("D_80C1B540","UNK_TYPE1","",0x1), 0x80C1B550:("D_80C1B550","f32","",0x4), diff --git a/tools/extract_baserom.py b/tools/extract_baserom.py index 03d230e80..c631a6392 100755 --- a/tools/extract_baserom.py +++ b/tools/extract_baserom.py @@ -14,8 +14,8 @@ FILE_NAMES = [ 'Audiotable', 'kanji', 'link_animetion', - 'icon_item_static_old', - 'icon_item_24_static_old', + 'icon_item_static_syms', + 'icon_item_24_static_syms', 'icon_item_field_static', 'icon_item_dungeon_static', 'icon_item_gameover_static', @@ -25,10 +25,10 @@ FILE_NAMES = [ 'map_grand_static', 'item_name_static', 'map_name_static', - 'icon_item_static_test', - 'icon_item_24_static_test', - 'schedule_dma_static_old', - 'schedule_dma_static_test', + 'icon_item_static_yar', + 'icon_item_24_static_yar', + 'schedule_dma_static_syms', + 'schedule_dma_static_yar', 'schedule_static', 'story_static', 'do_action_static', diff --git a/tools/fado/.gitrepo b/tools/fado/.gitrepo index 042b904f1..f88c42275 100644 --- a/tools/fado/.gitrepo +++ b/tools/fado/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:EllipticEllipsis/fado.git branch = master - commit = 8d896ee97d565508755584803c409fc33bb0c953 - parent = b51c9f4d22d6e7db63700c163418654431a2a61a + commit = 8ce0483766e2857c6f2997880ab7a5381b2cc5c3 + parent = aa8be27d62d8485c61f88889faf6132e4f66590b method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/tools/fado/Makefile b/tools/fado/Makefile index 135f51251..8f61a209e 100644 --- a/tools/fado/Makefile +++ b/tools/fado/Makefile @@ -57,7 +57,7 @@ clean: $(RM) -r build $(ELF) format: - clang-format-11 -i $(C_FILES) $(H_FILES) lib/fairy/* + clang-format-14 -i $(C_FILES) $(H_FILES) lib/fairy/* .PHONY: all clean format diff --git a/tools/fado/include/mips_elf.h b/tools/fado/include/mips_elf.h index 122e98d25..f76a69b79 100644 --- a/tools/fado/include/mips_elf.h +++ b/tools/fado/include/mips_elf.h @@ -476,9 +476,9 @@ typedef struct { /* 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_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. */ diff --git a/tools/filelists/mm.us.rev1/all.csv b/tools/filelists/mm.us.rev1/all.csv index c23622330..7c98a7cf3 100644 --- a/tools/filelists/mm.us.rev1/all.csv +++ b/tools/filelists/mm.us.rev1/all.csv @@ -6,8 +6,8 @@ 5,Audiotable 6,kanji 7,link_animetion -8,icon_item_static_old -9,icon_item_24_static_old +8,icon_item_static_syms +9,icon_item_24_static_syms 10,icon_item_field_static 11,icon_item_dungeon_static 12,icon_item_gameover_static @@ -17,10 +17,10 @@ 16,map_grand_static 17,item_name_static 18,map_name_static -19,icon_item_static_test -20,icon_item_24_static_test -21,schedule_dma_static_old -22,schedule_dma_static_test +19,icon_item_static_yar +20,icon_item_24_static_yar +21,schedule_dma_static_syms +22,schedule_dma_static_yar 23,schedule_static 24,story_static 25,do_action_static diff --git a/tools/filelists/mm.us.rev1/archives.csv b/tools/filelists/mm.us.rev1/archives.csv index a0b758dfd..3053456d0 100644 --- a/tools/filelists/mm.us.rev1/archives.csv +++ b/tools/filelists/mm.us.rev1/archives.csv @@ -2,6 +2,6 @@ 16,map_grand_static 17,item_name_static 18,map_name_static -19,icon_item_static_test -20,icon_item_24_static_test -22,schedule_dma_static_test +19,icon_item_static_yar +20,icon_item_24_static_yar +22,schedule_dma_static_yar diff --git a/tools/filelists/mm.us.rev1/deleted.csv b/tools/filelists/mm.us.rev1/deleted.csv index 12e60f6ee..2fca3fbe8 100644 --- a/tools/filelists/mm.us.rev1/deleted.csv +++ b/tools/filelists/mm.us.rev1/deleted.csv @@ -1,3 +1,3 @@ -8,icon_item_static_old -9,icon_item_24_static_old -21,schedule_dma_static_old +8,icon_item_static_syms +9,icon_item_24_static_syms +21,schedule_dma_static_syms diff --git a/tools/gitable.py b/tools/gitable.py index dad39638f..c5b8bc9ec 100755 --- a/tools/gitable.py +++ b/tools/gitable.py @@ -13,7 +13,7 @@ GETITEMENTRY_LENGTH = struct.calcsize(GETITEMENTRY_FORMAT) # MM US: 0x2E964 itemId_names = { - 0x00: "ITEM_OCARINA", + 0x00: "ITEM_OCARINA_OF_TIME", 0x01: "ITEM_BOW", 0x02: "ITEM_ARROW_FIRE", 0x03: "ITEM_ARROW_ICE", @@ -21,13 +21,13 @@ itemId_names = { 0x05: "ITEM_OCARINA_FAIRY", 0x06: "ITEM_BOMB", 0x07: "ITEM_BOMBCHU", - 0x08: "ITEM_STICK", - 0x09: "ITEM_NUT", + 0x08: "ITEM_DEKU_STICK", + 0x09: "ITEM_DEKU_NUT", 0x0A: "ITEM_MAGIC_BEANS", 0x0B: "ITEM_SLINGSHOT", 0x0C: "ITEM_POWDER_KEG", - 0x0D: "ITEM_PICTO_BOX", - 0x0E: "ITEM_LENS", + 0x0D: "ITEM_PICTOGRAPH_BOX", + 0x0E: "ITEM_LENS_OF_TRUTH", 0x0F: "ITEM_HOOKSHOT", 0x10: "ITEM_SWORD_GREAT_FAIRY", 0x11: "ITEM_LONGSHOT", @@ -53,7 +53,7 @@ itemId_names = { 0x25: "ITEM_CHATEAU", 0x26: "ITEM_HYLIAN_LOACH", 0x27: "ITEM_OBABA_DRINK", - 0x28: "ITEM_MOON_TEAR", + 0x28: "ITEM_MOONS_TEAR", 0x29: "ITEM_DEED_LAND", 0x2A: "ITEM_DEED_SWAMP", 0x2B: "ITEM_DEED_MOUNTAIN", @@ -87,9 +87,9 @@ itemId_names = { 0x47: "ITEM_MASK_BLAST", 0x48: "ITEM_MASK_SCENTS", 0x49: "ITEM_MASK_GIANT", - 0x4A: "ITEM_BOW_ARROW_FIRE", - 0x4B: "ITEM_BOW_ARROW_ICE", - 0x4C: "ITEM_BOW_ARROW_LIGHT", + 0x4A: "ITEM_BOW_FIRE", + 0x4B: "ITEM_BOW_ICE", + 0x4C: "ITEM_BOW_LIGHT", 0x4D: "ITEM_SWORD_KOKIRI", 0x4E: "ITEM_SWORD_RAZOR", 0x4F: "ITEM_SWORD_GILDED", @@ -132,8 +132,8 @@ itemId_names = { 0x76: "ITEM_DUNGEON_MAP", 0x77: "ITEM_STRAY_FAIRIES", 0x78: "ITEM_KEY_SMALL", - 0x79: "ITEM_MAGIC_SMALL", - 0x7A: "ITEM_MAGIC_LARGE", + 0x79: "ITEM_MAGIC_JAR_SMALL", + 0x7A: "ITEM_MAGIC_JAR_BIG", 0x7B: "ITEM_HEART_PIECE_2", 0x7C: "ITEM_INVALID_1", 0x7D: "ITEM_INVALID_2", @@ -150,10 +150,10 @@ itemId_names = { 0x88: "ITEM_RUPEE_PURPLE", 0x89: "ITEM_RUPEE_SILVER", 0x8A: "ITEM_RUPEE_HUGE", - 0x8B: "ITEM_STICKS_5", - 0x8C: "ITEM_STICKS_10", - 0x8D: "ITEM_NUTS_5", - 0x8E: "ITEM_NUTS_10", + 0x8B: "ITEM_DEKU_STICKS_5", + 0x8C: "ITEM_DEKU_STICKS_10", + 0x8D: "ITEM_DEKU_NUTS_5", + 0x8E: "ITEM_DEKU_NUTS_10", 0x8F: "ITEM_BOMBS_5", 0x90: "ITEM_BOMBS_10", 0x91: "ITEM_BOMBS_20", @@ -166,10 +166,10 @@ itemId_names = { 0x98: "ITEM_BOMBCHUS_10", 0x99: "ITEM_BOMBCHUS_1", 0x9A: "ITEM_BOMBCHUS_5", - 0x9B: "ITEM_STICK_UPGRADE_20", - 0x9C: "ITEM_STICK_UPGRADE_30", - 0x9D: "ITEM_NUT_UPGRADE_30", - 0x9E: "ITEM_NUT_UPGRADE_40", + 0x9B: "ITEM_DEKU_STICK_UPGRADE_20", + 0x9C: "ITEM_DEKU_STICK_UPGRADE_30", + 0x9D: "ITEM_DEKU_NUT_UPGRADE_30", + 0x9E: "ITEM_DEKU_NUT_UPGRADE_40", 0x9F: "ITEM_CHATEAU_2", 0xA0: "ITEM_MILK", 0xA1: "ITEM_GOLD_DUST_2", @@ -198,15 +198,15 @@ getItemId_names = { 0x0A: "GI_RECOVERY_HEART", 0x0C: "GI_HEART_PIECE", 0x0D: "GI_HEART_CONTAINER", - 0x0E: "GI_MAGIC_SMALL", - 0x0F: "GI_MAGIC_LARGE", + 0x0E: "GI_MAGIC_JAR_SMALL", + 0x0F: "GI_MAGIC_JAR_BIG", 0x11: "GI_STRAY_FAIRY", 0x14: "GI_BOMBS_1", 0x15: "GI_BOMBS_5", 0x16: "GI_BOMBS_10", 0x17: "GI_BOMBS_20", 0x18: "GI_BOMBS_30", - 0x19: "GI_STICKS_1", + 0x19: "GI_DEKU_STICKS_1", 0x1A: "GI_BOMBCHUS_10", 0x1B: "GI_BOMB_BAG_20", 0x1C: "GI_BOMB_BAG_30", @@ -221,9 +221,9 @@ getItemId_names = { 0x25: "GI_ARROW_FIRE", 0x26: "GI_ARROW_ICE", 0x27: "GI_ARROW_LIGHT", - 0x28: "GI_NUTS_1", - 0x29: "GI_NUTS_5", - 0x2A: "GI_NUTS_10", + 0x28: "GI_DEKU_NUTS_1", + 0x29: "GI_DEKU_NUTS_5", + 0x2A: "GI_DEKU_NUTS_10", 0x2E: "GI_BOMBCHUS_20", 0x32: "GI_SHIELD_HERO", 0x33: "GI_SHIELD_MIRROR", @@ -241,9 +241,9 @@ getItemId_names = { 0x3F: "GI_COMPASS", 0x40: "GI_40", 0x41: "GI_HOOKSHOT", - 0x42: "GI_LENS", - 0x43: "GI_PICTO_BOX", - 0x4C: "GI_OCARINA", + 0x42: "GI_LENS_OF_TRUTH", + 0x43: "GI_PICTOGRAPH_BOX", + 0x4C: "GI_OCARINA_OF_TIME", 0x50: "GI_BOMBERS_NOTEBOOK", 0x52: "GI_SKULL_TOKEN", 0x55: "GI_REMAINS_ODOLWA", @@ -305,7 +305,7 @@ getItemId_names = { 0x93: "GI_GOLD_DUST_2", 0x94: "GI_HYLIAN_LOACH", 0x95: "GI_SEAHORSE_CAUGHT", - 0x96: "GI_MOON_TEAR", + 0x96: "GI_MOONS_TEAR", 0x97: "GI_DEED_LAND", 0x98: "GI_DEED_SWAMP", 0x99: "GI_DEED_MOUNTAIN", @@ -354,7 +354,7 @@ getItemDrawId_names = { 0x0E: "GID_MASK_CIRCUS_LEADER", 0x0F: "GID_MASK_BREMEN", 0x10: "GID_MASK_ALL_NIGHT", - 0x11: "GID_NUTS", + 0x11: "GID_DEKU_NUTS", 0x12: "GID_HEART_CONTAINER", 0x13: "GID_HEART_PIECE", 0x14: "GID_QUIVER_30", @@ -363,10 +363,10 @@ getItemDrawId_names = { 0x17: "GID_BOMB_BAG_20", 0x18: "GID_BOMB_BAG_30", 0x19: "GID_BOMB_BAG_40", - 0x1A: "GID_STICK", + 0x1A: "GID_DEKU_STICK", 0x1B: "GID_DUNGEON_MAP", - 0x1C: "GID_MAGIC_SMALL", - 0x1D: "GID_MAGIC_LARGE", + 0x1C: "GID_MAGIC_JAR_SMALL", + 0x1D: "GID_MAGIC_JAR_BIG", 0x1E: "GID_BOMB", 0x1F: "GID_STONE_OF_AGONY", 0x20: "GID_WALLET_ADULT", @@ -426,7 +426,7 @@ getItemDrawId_names = { 0x56: "GID_SKULL_TOKEN_2", 0x57: "GID_57", 0x58: "GID_ZORA_EGG", - 0x59: "GID_MOON_TEAR", + 0x59: "GID_MOONS_TEAR", 0x5A: "GID_DEED_LAND", 0x5B: "GID_MASK_DEKU", 0x5C: "GID_REMAINS_ODOLWA", @@ -453,7 +453,7 @@ getItemDrawId_names = { 0x71: "GID_MASK_POSTMAN", 0x72: "GID_MASK_GIANT", 0x73: "GID_CHATEAU", - 0x74: "GID_PICTO_BOX", + 0x74: "GID_PICTOGRAPH_BOX", 0x75: "GID_MASK_FIERCE_DEITY", 0x76: "GID_MAX", -1: "GID_NONE", diff --git a/tools/namefixer.py b/tools/namefixer.py index 417210d8f..ea6d5e19e 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -104,6 +104,7 @@ wordReplace = { "func_800B78B8": "Actor_UpdateBgCheckInfo", "func_80123D50": "Player_UpdateBottleHeld", + "func_80123DA4": "Player_Untarget", "func_8012403C": "Player_GetMask", "func_8012404c": "Player_RemoveMask", "func_80123AA4": "Player_SetModels", @@ -174,6 +175,10 @@ wordReplace = { "func_800B6474": "Actor_UpdatePlayerImpact", "func_800B648C": "Actor_SetPlayerImpact", "func_800B64FC": "Actor_GetPlayerImpact", + "func_800B8500": "Actor_OfferTalkExchange", + "func_800B85E0": "Actor_OfferTalkExchangeEquiCylinder", + "func_800B8614": "Actor_OfferTalk", + "func_800B863C": "Actor_OfferTalkNearColChkInfoCylinder", "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos", "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos", "func_8016970C": "Play_SetCameraAtEye", @@ -186,7 +191,7 @@ wordReplace = { "func_801A0238": "Audio_SetMainBgmVolume", "func_801A2C20": "Audio_StopSubBgm", "func_801A2BB8": "Audio_PlaySubBgm", - "func_8019F1C0": "Audio_PlaySfxAtPos", + "func_8019F1C0": "Audio_PlaySfx_AtPos", "func_801A5BD0": "AudioSfx_MuteBanks", "func_801A72CC": "AudioSfx_StopByPos", "Audio_StopSfxByPos": "AudioSfx_StopByPos", @@ -218,6 +223,48 @@ wordReplace = { "func_801358D4": "AnimationContext_SetNextQueue", "func_801358F4": "AnimationContext_DisableQueue", "SkelAnime_LoadLinkAnimetion": "AnimationContext_SetLoadFrame", + "play_sound": "Audio_PlaySfx", + "func_8019F128": "Audio_PlaySfx_2", + "func_8019F170": "Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb", + "Audio_PlaySfxAtPos": "Audio_PlaySfx_AtPos", + "func_8019F208": "Audio_PlaySfx_MessageDecide", + "func_8019F230": "Audio_PlaySfx_MessageCancel", + "func_8019F420": "Audio_PlaySfx_Underwater", + "func_8019F4AC": "Audio_PlaySfx_WithSfxSettingsReverb", + "func_8019F638": "Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume", + "func_8019F780": "Audio_PlaySfx_AtPosWithSyncedFreqAndVolume", + "func_8019F830": "Audio_PlaySfx_GiantsMask", + "func_8019F88C": "Audio_PlaySfx_Randomized", + "func_8019F900": "Audio_PlaySfx_SwordCharge", + "func_8019FAD8": "Audio_PlaySfx_AtPosWithFreq", + "func_8019FB0C": "Audio_PlaySfx_AtPosWithFreqAndChannelIO", + "func_8019FC20": "Audio_PlaySfx_WaterWheel", + "func_8019FCB8": "Audio_PlaySfx_AtPosWithTimer", + "func_8019FDC8": "Audio_PlaySfx_AtPosWithReverb", + "func_8019FE1C": "Audio_PlaySfx_AtPosWithVolume", + "func_8019FF9C": "Audio_PlaySfx_River", + "func_801A0124": "Audio_PlaySfx_BigBells", + "func_801A0810": "Audio_PlaySfx_AtPosWithAllChannelsIO", + "func_801A0868": "Audio_PlaySfx_AtPosWithChannelIO", + "func_801A3AEC": "Audio_PlaySfx_PauseMenuOpenOrClose", + "func_801A3FB4": "Audio_PlaySfx_IfNotInCutscene", + "func_801A4748": "Audio_PlaySfx_AtFixedPos", + "func_801A479C": "Audio_PlaySfx_AtPosWithVolumeTransition", + "func_8019F540": "Audio_SetSfxUnderwaterReverb", + "func_8019FD90": "Audio_SetSfxTimerLerpInterval", + "func_8019FE74": "Audio_SetSfxVolumeTransition", + "func_801A4428": "Audio_SetSfxReverbIndexExceptOcarinaBank", + "func_800B8EF4": "Actor_PlaySfx_SurfaceBomb", + "func_800B8F98": "Actor_PlaySfx_FlaggedCentered1", + "func_800B8FC0": "Actor_PlaySfx_FlaggedCentered2", + "func_800B8FE8": "Actor_PlaySfx_FlaggedCentered3", + "func_800B9010": "Actor_PlaySfx_Flagged", + "func_800B9038": "Actor_PlaySfx_FlaggedTimer", + "func_800B9084": "Actor_PlaySeq_FlaggedKamaroDance", + "func_800B9098": "Actor_PlaySeq_FlaggedMusicBoxHouse", + "func_801000A4": "Lib_PlaySfx", + "func_801000CC": "Lib_PlaySfx_2", + "Lib_PlaySfxAtPos": "Lib_PlaySfx_AtPos", "SkelAnime_AnimationType1Loaded": "AnimationContext_CopyAll", "SkelAnime_AnimationType2Loaded": "AnimationContext_CopyInterp", @@ -302,7 +349,8 @@ wordReplace = { "Audio_PlaySfxGeneral": "AudioSfx_PlaySfx", "func_800B8C50": "Actor_SetClosestSecretDistance", "func_800BBDAC": "Actor_SpawnFloorDustRing", - "func_800B8708": "Player_GetExchangeItemId", + "func_800B8708": "Player_GetExchangeItemAction", + "Player_GetExchangeItemId": "Player_GetExchangeItemAction", "func_801233E4": "Player_InCsMode", "func_800BC4EC": "Actor_TestFloorInDirection", "func_800BC5B8": "Actor_IsTargeted", @@ -601,10 +649,64 @@ wordReplace = { "func_800A81F0": "EffectBlure_AddVertex", "func_800A8514": "EffectBlure_AddSpace", "Effect_GetParams": "Effect_GetByIndex", + "func_800FE484": "Environment_StopTime", "func_800FE498": "Environment_StartTime", "func_800FE4A8": "Environment_IsTimeStopped", "func_800F5A8C": "Environment_LerpWeight", + "func_800FD2B4": "Environment_AdjustLights", + "func_800FAAB4": "Environment_ChangeLightSetting", + "func_800FD78C": "Environment_PlayStormNatureAmbience", + "func_800FD858": "Environment_StopStormNatureAmbience", + "func_800F6834": "Environment_EnableUnderwaterLights", + "func_800F9824": "Environment_DrawLensFlare", + "func_800FE658": "Environment_SetTimeJump", + "func_800FE620": "Environment_GetTimeSpeed", + "func_800FD750": "Environment_ForcePlaySequence", + "func_800FE7A8": "Environment_LerpSandstormColors", + "func_800FB758": "Environment_PlaySceneSequence", + "func_800FE4B8": "Environment_GetStormState", + "Kankyo_FadeInGameOverLights": "Environment_FadeInGameOverLights", + "Kankyo_InitGameOverLights": "Environment_InitGameOverLights", + "Kankyo_FadeOutGameOverLights": "Environment_FadeOutGameOverLights", + "func_800F5090": "Environment_GraphCallback", + "func_800F5954": "Environment_SmoothStepToU8", + "func_800F5B10": "Environment_LerpWeightAccelDecel", + "func_800F694C": "Environment_DisableUnderwaterLights", + "func_800F6A40": "Environment_UpdateSkyboxRotY", + "func_800F6AB8": "Environment_UpdateNextDayTime", + "func_800F6B44": "Environment_UpdateTime", + "Kankyo_IsSceneUpsideDown": "Environment_IsSceneUpsideDown", + "func_800F6FF8": "Environment_UpdateLights", + "func_800F8554": "Environment_UpdateSun", + "func_800F8A9C": "Environment_UpdatePostmanEvents", + "func_800F8D84": "Environment_DrawSun", + "func_800FA39C": "Environment_RandCentered", + "func_800FA3C4": "Environment_DrawRainImpl", + "func_800FAC20": "Environment_DrawSkyboxFilters", + "func_800FAF74": "Environment_DrawLightningFlash", + "func_800FB010": "Environment_UpdateLightningStrike", + "func_800FB388": "Environment_DrawLightning", + "func_800FB9B4": "Environment_UpdateTimeBasedSequence", + "func_800FC3DC": "Environment_UpdateRain", + "func_800FD538": "Environment_LerpRGB8", + "get_days_elapsed": "Environment_GetEventDayCount", + "reset_days_elapsed": "Environment_ClearEventDayCount", + "get_current_day": "Environment_GetTotalDays", + "func_800FD768": "Environment_IsForcedSequenceDisabled", + "func_800FD928": "Environment_WarpSongLeave", + "func_800FD980": "Environment_SetupSkyboxStars", + "func_800FDAF8": "Environment_DrawSkyboxStar", + "func_800FDC94": "Environment_DrawSkyboxStarsImpl", + "func_800FE390": "Environment_Draw", + "func_800FE3E0": "Environment_DrawSkyboxStars", + "func_800FE590": "Environment_IsFinalHours", + "func_800FE778": "Environment_GetSandstormColorIndex", + "func_800FE788": "Environment_GetNextSandstormColorIndex", + "func_800FE798": "Environment_GetSandstormLerpScale", + "func_800FE7A8": "Environment_LerpSandstormColors", + "func_800FEAC0": "Environment_JumpForwardInTime", + "func_801A3F54": "Audio_SetCutsceneFlag", "func_800EA0D4": "Cutscene_StartManual", @@ -667,7 +769,8 @@ wordReplace = { "func_8013A860": "SubS_DrawTransformFlexLimb", "func_8013BC6C": "SubS_ChangeAnimationByInfoS", "func_8013E1C8": "SubS_ChangeAnimationBySpeedInfo", - "func_8013D9C8": "SubS_FillLimbRotTables", + "func_8013D9C8": "SubS_UpdateFidgetTables", + "SubS_FillLimbRotTables": "SubS_UpdateFidgetTables", "func_8013A7C0": "SubS_FindDoor", "func_8013E640": "SubS_FindActorCustom", "func_ActorCategoryIterateById": "SubS_FindActor", @@ -675,9 +778,11 @@ wordReplace = { "func_8013E2D4": "SubS_StartCutscene", "SubS_StartActorCutscene": "SubS_StartCutscene", "func_8013E3B8": "SubS_FillCutscenesList", - "func_8013AED4": "SubS_UpdateFlags", + "func_8013AED4": "SubS_SetOfferMode", + "SubS_UpdateFlags": "SubS_SetOfferMode", "func_8013D8DC": "SubS_IsObjectLoaded", - "func_8013D924": "SubS_GetObjectIndex", + "func_8013D924": "SubS_GetObjectSlot", + "SubS_GetObjectIndex": "SubS_GetObjectSlot", "func_8013D5E8": "SubS_AngleDiffLessEqual", "func_8013DCE0": "SubS_ActorPathing_Init", "func_8013DE04": "SubS_ActorPathing_Update", @@ -699,6 +804,9 @@ wordReplace = { "func_8013DCCC": "SubS_GetPathCount", "func_8013AD9C": "SubS_UpdateLimb", "func_8013D2E0": "SubS_TurnToPoint", + "func_8013C964": "SubS_Offer", + "func_8013E748": "SubS_OfferTalkExchangeCustom", + "func_8013E8F8": "SubS_OfferTalkExchangeFacing", "func_80147624": "Message_ShouldAdvance", "func_80147734": "Message_ShouldAdvanceSilent", @@ -714,8 +822,16 @@ wordReplace = { "func_8015926C": "Message_LoadOwlWarpTextNES", "func_8015E750": "Message_FindCreditsMessage", "func_80151BB4": "Message_BombersNotebookQueueEvent", + "func_8014995C": "Message_DrawTextChar", + "func_8014AAD0": "Message_HandleOcarina", + "func_8014C70C": "Message_LoadItemIcon", + "func_8015E7EC": "Message_DrawTextCredits", + "func_80133038": "Schedule_RunScript", + "Object_GetIndex": "Object_GetSlot", + "Object_Spawn": "Object_SpawnPersistent", + "EffectSsKiraKira_SpawnSmallYellow": "EffectSsKirakira_SpawnSmallYellow", "EffectSsKiraKira_SpawnSmall": "EffectSsKirakira_SpawnSmall", "EffectSsKiraKira_SpawnDispersed": "EffectSsKirakira_SpawnDispersed", @@ -842,6 +958,8 @@ wordReplace = { "func_8012CA0C": "Gfx_SetupDL56_Ptr", "func_8012CA38": "Gfx_SetupDL59_Opa", + "Game_SetFramerateDivisor": "GameState_SetFramerateDivisor", + # Structs "ActorAnimationEntry": "AnimationInfo", "ActorAnimationEntryS": "AnimationInfoS", @@ -875,6 +993,8 @@ wordReplace = { "actor.yDistToPlayer": "actor.playerHeightRel", "actor.cutscene": "actor.csId", "actor.speedXZ": "actor.speed", + "actor.isTargeted": "actor.isLockedOn", + "actor->isTargeted": "actor->isLockedOn", "thisx->speedXZ": "thisx->speed", "gSaveContext.unk_3F1E": "gSaveContext.hudVisibilityForceButtonAlphasByStatus", @@ -966,7 +1086,10 @@ wordReplace = { "gSaveContext.save.horseData": "gSaveContext.save.saveInfo.horseData", "gSaveContext.save.checksum": "gSaveContext.save.saveInfo.checksum", - "player->unk_A87": "player->exchangeItemId", + "gSaveContext.save.daysElapsed": "gSaveContext.save.eventDayCount", + + "player->unk_A87": "player->exchangeItemAction", + "player->exchangeItemId": "player->exchangeItemAction", "player->leftHandActor": "player->heldActor", "player->unk_384": "player->getItemId", "player->unk_386": "player->getItemDirection", @@ -986,6 +1109,8 @@ wordReplace = { "player->unk_AA0": "player->closestSecretDistSq", "player->unk_AAC": "player->headLimbRot", "player->unk_AB2": "player->upperLimbRot", + "player->unk_AE7": "player->actionVar1", + "player->unk_AE8": "player->actionVar2", "player->unk_B2A": "player->getItemDrawIdPlusOne", "player->getItemDrawId": "player->getItemDrawIdPlusOne", "player->unk_B68": "player->fallStartHeight", @@ -994,7 +1119,8 @@ wordReplace = { "player->unk_B84": "player->pushedYaw", "player->targetActor": "player->talkActor", "player->targetActorDistance": "player->talkActorDistance", - "player->unk_730": "player->targetedActor", + "player->unk_730": "player->lockOnActor", + "player->targetedActor": "player->lockOnActor", "ageProperties->unk_04": "ageProperties->shadowScale", "ageProperties->unk_92": "ageProperties->voiceSfxOffset", @@ -1016,7 +1142,7 @@ wordReplace = { "globalCtx->mf_187FC": "play->billboardMtxF", "globalCtx->projectionMatrix": "play->viewProjectionMtxF", "globalCtx->actorCtx.actorList[": "play->actorCtx.actorLists[", - "globalCtx->envCtx.unk_8C": "play->envCtx.lightSettings", + "globalCtx->envCtx.unk_8C": "play->envCtx.adjLightSettings", "globalCtx->envCtx.unk_E5": "play->envCtx.fillScreen", "globalCtx->envCtx.unk_E6": "play->envCtx.screenFillColor", "globalCtx->envCtx.unk_C3": "play->envCtx.lightSettingOverride", @@ -1038,9 +1164,47 @@ wordReplace = { "play->msgCtx.unk12023": "play->msgCtx.stateTimer", "play->msgCtx.unk1202A": "play->msgCtx.ocarinaMode", "play->msgCtx.unk1202C": "play->msgCtx.ocarinaAction", - "play->msgCtx.unk11F04": "play->msgCtx.currentTextId", + "play->msgCtx.unk12048": "play->msgCtx.ocarinaButtonIndex", + "play->msgCtx.unk120B0": "play->msgCtx.ocarinaSongEffectActive", + "play->msgCtx.unk12046": "play->msgCtx.blockSunsSong", + "play->msgCtx.unk12090": "play->msgCtx.textIsCredits", + "play->msgCtx.unk_120BC": "play->msgCtx.hudVisibility", + + "msgCtx->unk11EF8": "msgCtx->textboxSegment", + "msgCtx->unk11F14": "msgCtx->nextTextId", + "msgCtx->unk11FF2": "msgCtx->textUnskippable", + "msgCtx->unk11FF4": "msgCtx->textPosX", + "msgCtx->unk11FF6": "msgCtx->textPosY", + "msgCtx->unk12004": "msgCtx->textboxXTarget", + "msgCtx->unk12006": "msgCtx->textboxYTarget", + "msgCtx->unk1201E": "msgCtx->textColorAlpha", + "msgCtx->unk12020": "msgCtx->textboxEndType", + "msgCtx->unk12024": "msgCtx->textDelayTimer", + "msgCtx->unk1203A": "msgCtx->textboxColorAlphaTarget", + "msgCtx->unk1203C": "msgCtx->textboxColorAlphaCurrent", + "msgCtx->unk1204A": "msgCtx->ocarinaButtonsPosY", + "msgCtx->unk12068": "msgCtx->textboxX", + "msgCtx->unk1206A": "msgCtx->textboxY", + "msgCtx->unk12090": "msgCtx->textIsCredits", + "msgCtx->unk12092": "msgCtx->messageHasSetSfx", + "msgCtx->unk12094": "msgCtx->textboxSkipped", + "msgCtx->unk12098": "msgCtx->textCharScale", + "msgCtx->unk1209C": "msgCtx->textFade", + "msgCtx->unk120A0": "msgCtx->ocarinaAvailableSongs", + "msgCtx->unk120B0": "msgCtx->ocarinaSongEffectActive", + "msgCtx->unkActor": "msgCtx->talkActor", + "play->actorCtx.unk3": "play->actorCtx.lensActive", "play->actorCtx.unk4": "play->actorCtx.lensMaskSize", + "play->actorCtx.targetContext": "play->actorCtx.targetCtx", + "play->actorCtx.targetCtx.unk0": "play->actorCtx.targetCtx.fairyPos", + "play->actorCtx.targetCtx.unk40": "play->actorCtx.targetCtx.fairyMoveProgressFactor", + "play->actorCtx.targetCtx.unk44": "play->actorCtx.targetCtx.lockOnRadius", + "play->actorCtx.targetCtx.unk48": "play->actorCtx.targetCtx.lockOnAlpha", + "play->actorCtx.targetCtx.unk4B": "play->actorCtx.targetCtx.rotation", + "play->actorCtx.targetCtx.unk4C": "play->actorCtx.targetCtx.lockOnIndex", + "play->actorCtx.targetCtx.unk50": "play->actorCtx.targetCtx.lockOnTriangleSets", + "play->actorCtx.targetCtx.unk8C": "play->actorCtx.targetCtx.nextTarget", "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", @@ -1052,6 +1216,16 @@ wordReplace = { "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1", "play->roomCtx.curRoom.unk2": "play->roomCtx.curRoom.behaviorType2", "play->roomCtx.unk31": "play->roomCtx.status", + "play->objectCtx.status": "play->objectCtx.slots", + + "play->envCtx.unk_E0": "play->envCtx.lightBlendOverride", + "play->envCtx.unk_E1": "play->envCtx.stormRequest", + "play->envCtx.unk_E2": "play->envCtx.stormState", + "play->envCtx.unk_E3": "play->envCtx.lightningState", + "play->envCtx.unk_E4": "play->envCtx.timeSeqState", + "play->envCtx.unk_F2": "play->envCtx.precipitation", + "play->envCtx.windDir": "play->envCtx.windDirection", + "play->envCtx.sunMoonDisabled": "play->envCtx.sunDisabled", "actorCtx.unkC": "actorCtx.halfDaysBit", "actorCtx.unk1F4": "actorCtx.playerImpact.type", @@ -1085,9 +1259,21 @@ wordReplace = { "D_801D1E20": "gIdentityMtxF", "sSetupDL": "gSetupDLs", + "gFaultStruct": "gFaultMgr", + "D_801BDA9C": "gHorseIsMounted", "D_801BDAA4": "gHorsePlayedEponasSong", + "D_801BDBC8": "gSceneSeqState", + "D_801F4E32": "gCustomLensFlare1On", + "D_801F4E38": "gCustomLensFlare1Pos", + "D_801F4E4E": "gCustomLensFlare2On", + "D_801F4E50": "gCustomLensFlare2Pos", + "D_801F4E7A": "gSkyboxNumStars", + "D_801BDBB8": "gInterruptSongOfStorms", + "D_801BDBB4": "gLightConfigAfterUnderwater", + "D_801F4E68": "gLightningStrike", + # Macros "CUR_EQUIP_VALUE_VOID": "GET_CUR_EQUIP_VALUE", "CUR_UPG_VALUE_VOID": "GET_CUR_UPG_VALUE", @@ -1100,14 +1286,17 @@ wordReplace = { "ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON", + "ACTOR_FLAG_1": "ACTOR_FLAG_TARGETABLE", + "ACTOR_FLAG_4": "ACTOR_FLAG_UNFRIENDLY", + "ACTOR_FLAG_8": "ACTOR_FLAG_FRIENDLY", "ACTOR_FLAG_100": "ACTOR_FLAG_TALK_REQUESTED", "ACTOR_FLAG_8000000": "ACTOR_FLAG_CANT_LOCK_ON", "EXCH_ITEM_MINUS1": "PLAYER_IA_MINUS1", "EXCH_ITEM_NONE": "PLAYER_IA_NONE", - "EXCH_ITEM_PICTO_BOX": "PLAYER_IA_PICTO_BOX", + "EXCH_ITEM_PICTO_BOX": "PLAYER_IA_PICTOGRAPH_BOX", "EXCH_ITEM_1E": "PLAYER_IA_BOTTLE_MUSHROOM", - "EXCH_ITEM_MOON_TEAR": "PLAYER_IA_MOON_TEAR", + "EXCH_ITEM_MOON_TEAR": "PLAYER_IA_MOONS_TEAR", "EXCH_ITEM_DEED_LAND": "PLAYER_IA_DEED_LAND", "EXCH_ITEM_ROOM_KEY": "PLAYER_IA_ROOM_KEY", "EXCH_ITEM_LETTER_TO_KAFEI": "PLAYER_IA_LETTER_TO_KAFEI", @@ -1117,6 +1306,14 @@ wordReplace = { "EXCH_ITEM_DEED_OCEAN": "PLAYER_IA_DEED_OCEAN", "EXCH_ITEM_LETTER_MAMA": "PLAYER_IA_LETTER_MAMA", "ITEM_FISHING_POLE": "ITEM_FISHING_ROD", + "ITEM_OCARINA": "ITEM_OCARINA_OF_TIME", + "ITEM_STICK": "ITEM_DEKU_STICK", + "ITEM_NUT": "ITEM_DEKU_NUT", + "ITEM_PICTO_BOX": "ITEM_PICTOGRAPH_BOX", + "ITEM_LENS": "ITEM_LENS_OF_TRUTH", + "ITEM_MAGIC_SMALL": "ITEM_MAGIC_JAR_SMALL", + "ITEM_MAGIC_LARGE": "ITEM_MAGIC_JAR_BIG", + "ITEM_MOON_TEAR": "ITEM_MOONS_TEAR", "PLAYER_AP_FISHING_POLE": "PLAYER_IA_FISHING_ROD", "PLAYER_IA_BOTTLE": "PLAYER_IA_BOTTLE_EMPTY", diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index efa3bc2fe..0aa806f2a 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -34,6 +34,8 @@ CLEAR_EVENTINF = "int" CLEAR_EVENTINF_ALT = "int" "EVENTINF_.*" = "int" ".+REG" = "int" +SET_FULLSCREEN_VIEWPORT_DYNAMIC = "void" +gDrawRect = "void" [decompme.compilers] "tools/ido_recomp/linux/7.1/cc" = "ido7.1" diff --git a/tools/progress.py b/tools/progress.py index 5a2958cd8..9096715aa 100755 --- a/tools/progress.py +++ b/tools/progress.py @@ -136,7 +136,6 @@ if not args.matching: # The order of this list should not change to prevent breaking the graph of the website # New stuff shall be appended at the end of the list assetsCategories = [ - "archives", "audio", "interface", "misc", @@ -148,6 +147,11 @@ assetsCategories = [ ] assetsTracker = dict() +# Assets that we don't have a proper way of tracking right now +ignoredAssets = { + "archives", +} + # Manual fixer for files that would be counted in wrong categories # "filename": "correctSection" fileSectionFixer = { @@ -203,12 +207,12 @@ for line in map_file: file_size = int(line_split[2], 16) obj_file = line_split[3].strip() objFileSplit = obj_file.split("/") + objFileName = objFileSplit[-1].split(".o")[0] fileData = {"name": obj_file, "vram": obj_vram, "size": file_size, "section": section, "symbols": []} mapFileList.append(fileData) if (section == ".text"): - objFileName = objFileSplit[-1].split(".o")[0] srcCat = obj_file.split("/")[2] if srcCat in srcCategoriesFixer: srcCat = srcCategoriesFixer[srcCat] @@ -229,6 +233,8 @@ for line in map_file: assetCat = obj_file.split("/")[2] if assetCat in assetsTracker: assetsTracker[assetCat]["currentSize"] += file_size + elif assetCat in ignoredAssets: + pass else: eprint(f"Found file '{obj_file}' in unknown asset category '{assetCat}'") eprint("I'll ignore this for now, but please fix it!") diff --git a/tools/rename_sym.sh b/tools/rename_sym.sh index 227db4df7..ea9976997 100755 --- a/tools/rename_sym.sh +++ b/tools/rename_sym.sh @@ -10,4 +10,4 @@ fi #echo "Replace $1 with $2?" #read -grep -rl "$1" asm/**/*.s src/**/*.{c,h} include/**/*.h tools/disasm/functions.txt tools/disasm/variables.txt tools/sizes/*.csv | xargs sed -i "s/\b$1\b/$2/g" +grep -rl "$1" asm/**/*.s src/**/*.{c,h} include/**/*.h assets/xml/* tools/disasm/functions.txt tools/disasm/variables.txt tools/sizes/*.csv | xargs sed -i "s/\b$1\b/$2/g" diff --git a/tools/sizes/boot_functions.csv b/tools/sizes/boot_functions.csv index ecc9eed27..47bc17b62 100644 --- a/tools/sizes/boot_functions.csv +++ b/tools/sizes/boot_functions.csv @@ -1,9 +1,9 @@ asm/non_matchings/boot/boot_main/bootproc.s,bootproc,0x80080060,0x3C -asm/non_matchings/boot/idle/Idle_ClearMemory.s,Idle_ClearMemory,0x80080150,0xC -asm/non_matchings/boot/idle/Idle_InitFramebuffer.s,Idle_InitFramebuffer,0x80080180,0x7 -asm/non_matchings/boot/idle/Idle_InitScreen.s,Idle_InitScreen,0x8008019C,0x14 -asm/non_matchings/boot/idle/Idle_InitMemory.s,Idle_InitMemory,0x800801EC,0x19 -asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.s,Idle_InitCodeAndMemory,0x80080250,0x2C +asm/non_matchings/boot/idle/Main_ClearMemory.s,Main_ClearMemory,0x80080150,0xC +asm/non_matchings/boot/idle/Main_InitFramebuffer.s,Main_InitFramebuffer,0x80080180,0x7 +asm/non_matchings/boot/idle/Main_InitScreen.s,Main_InitScreen,0x8008019C,0x14 +asm/non_matchings/boot/idle/Main_InitMemory.s,Main_InitMemory,0x800801EC,0x19 +asm/non_matchings/boot/idle/Main_Init.s,Main_Init,0x80080250,0x2C asm/non_matchings/boot/idle/Main_ThreadEntry.s,Main_ThreadEntry,0x80080300,0x23 asm/non_matchings/boot/idle/Idle_InitVideo.s,Idle_InitVideo,0x8008038C,0x62 asm/non_matchings/boot/idle/Idle_ThreadEntry.s,Idle_ThreadEntry,0x80080514,0x33 @@ -37,13 +37,13 @@ asm/non_matchings/boot/irqmgr/IrqMgr_HandlePRENMI500.s,IrqMgr_HandlePRENMI500,0x asm/non_matchings/boot/irqmgr/IrqMgr_HandleRetrace.s,IrqMgr_HandleRetrace,0x800815CC,0x2E asm/non_matchings/boot/irqmgr/IrqMgr_ThreadEntry.s,IrqMgr_ThreadEntry,0x80081684,0x34 asm/non_matchings/boot/irqmgr/IrqMgr_Init.s,IrqMgr_Init,0x80081754,0x33 -asm/non_matchings/boot/CIC6105/CIC6105_Nop80081820.s,CIC6105_Nop80081820,0x80081820,0x2 -asm/non_matchings/boot/CIC6105/CIC6105_Nop80081828.s,CIC6105_Nop80081828,0x80081828,0x2 +asm/non_matchings/boot/CIC6105/CIC6105_Noop1.s,CIC6105_Noop1,0x80081820,0x2 +asm/non_matchings/boot/CIC6105/CIC6105_Noop2.s,CIC6105_Noop2,0x80081828,0x2 asm/non_matchings/boot/CIC6105/CIC6105_PrintRomInfo.s,CIC6105_PrintRomInfo,0x80081830,0x1B asm/non_matchings/boot/CIC6105/CIC6105_AddRomInfoFaultPage.s,CIC6105_AddRomInfoFaultPage,0x8008189C,0xD -asm/non_matchings/boot/CIC6105/CIC6105_RemoveRomInfoFaultPage.s,CIC6105_RemoveRomInfoFaultPage,0x800818D0,0x9 -asm/non_matchings/boot/CIC6105/func_800818F4.s,func_800818F4,0x800818F4,0xB -asm/non_matchings/boot/syncprintf/__osSyncVPrintf.s,__osSyncVPrintf,0x80081920,0x7 +asm/non_matchings/boot/CIC6105/CIC6105_Destroy.s,CIC6105_Destroy,0x800818D0,0x9 +asm/non_matchings/boot/CIC6105/CIC6105_Init.s,CIC6105_Init,0x800818F4,0xB +asm/non_matchings/boot/syncprintf/osSyncPrintfUnused.s,osSyncPrintfUnused,0x80081920,0x7 asm/non_matchings/boot/syncprintf/osSyncPrintf.s,osSyncPrintf,0x8008193C,0x7 asm/non_matchings/boot/syncprintf/rmonPrintf.s,rmonPrintf,0x80081958,0xA asm/non_matchings/boot/fault/Fault_SleepImpl.s,Fault_SleepImpl,0x80081980,0x1C @@ -62,27 +62,27 @@ asm/non_matchings/boot/fault/Fault_FillScreenBlack.s,Fault_FillScreenBlack,0x800 asm/non_matchings/boot/fault/Fault_FillScreenRed.s,Fault_FillScreenRed,0x8008212C,0x15 asm/non_matchings/boot/fault/Fault_DrawCornerRec.s,Fault_DrawCornerRec,0x80082180,0x15 asm/non_matchings/boot/fault/Fault_PrintFReg.s,Fault_PrintFReg,0x800821D4,0x2B -asm/non_matchings/boot/fault/osSyncPrintfFReg.s,osSyncPrintfFReg,0x80082280,0x2C +asm/non_matchings/boot/fault/Fault_LogFReg.s,Fault_LogFReg,0x80082280,0x2C asm/non_matchings/boot/fault/Fault_PrintFPCR.s,Fault_PrintFPCR,0x80082330,0x29 -asm/non_matchings/boot/fault/osSyncPrintfFPCR.s,osSyncPrintfFPCR,0x800823D4,0x26 +asm/non_matchings/boot/fault/Fault_LogFPCSR.s,Fault_LogFPCSR,0x800823D4,0x26 asm/non_matchings/boot/fault/Fault_PrintThreadContext.s,Fault_PrintThreadContext,0x8008246C,0xD4 asm/non_matchings/boot/fault/osSyncPrintfThreadContext.s,osSyncPrintfThreadContext,0x800827BC,0xBF asm/non_matchings/boot/fault/Fault_FindFaultedThread.s,Fault_FindFaultedThread,0x80082AB8,0x22 asm/non_matchings/boot/fault/Fault_Wait5Seconds.s,Fault_Wait5Seconds,0x80082B40,0x24 asm/non_matchings/boot/fault/Fault_WaitForButtonCombo.s,Fault_WaitForButtonCombo,0x80082BD0,0x27 -asm/non_matchings/boot/fault/Fault_DrawMemDumpPage.s,Fault_DrawMemDumpPage,0x80082C6C,0x5B +asm/non_matchings/boot/fault/Fault_DrawMemDumpContents.s,Fault_DrawMemDumpContents,0x80082C6C,0x5B asm/non_matchings/boot/fault/Fault_DrawMemDump.s,Fault_DrawMemDump,0x80082DD8,0x7E -asm/non_matchings/boot/fault/Fault_FindNextStackCall.s,Fault_FindNextStackCall,0x80082FD0,0x5D +asm/non_matchings/boot/fault/Fault_WalkStack.s,Fault_WalkStack,0x80082FD0,0x5D asm/non_matchings/boot/fault/Fault_DrawStackTrace.s,Fault_DrawStackTrace,0x80083144,0x64 -asm/non_matchings/boot/fault/osSyncPrintfStackTrace.s,osSyncPrintfStackTrace,0x800832D4,0x5F +asm/non_matchings/boot/fault/Fault_LogStackTrace.s,Fault_LogStackTrace,0x800832D4,0x5F asm/non_matchings/boot/fault/Fault_ResumeThread.s,Fault_ResumeThread,0x80083450,0x1F -asm/non_matchings/boot/fault/Fault_CommitFB.s,Fault_CommitFB,0x800834CC,0x30 +asm/non_matchings/boot/fault/Fault_DisplayFrameBuffer.s,Fault_DisplayFrameBuffer,0x800834CC,0x30 asm/non_matchings/boot/fault/Fault_ProcessClients.s,Fault_ProcessClients,0x8008358C,0x39 asm/non_matchings/boot/fault/Fault_SetOptionsFromController3.s,Fault_SetOptionsFromController3,0x80083670,0x5D -asm/non_matchings/boot/fault/Fault_SetOptions.s,Fault_SetOptions,0x800837E4,0x11 +asm/non_matchings/boot/fault/Fault_UpdatePad.s,Fault_UpdatePad,0x800837E4,0x11 asm/non_matchings/boot/fault/Fault_ThreadEntry.s,Fault_ThreadEntry,0x80083828,0xD2 -asm/non_matchings/boot/fault/Fault_SetFB.s,Fault_SetFB,0x80083B70,0x15 -asm/non_matchings/boot/fault/Fault_Start.s,Fault_Start,0x80083BC4,0x4D +asm/non_matchings/boot/fault/Fault_SetFrameBuffer.s,Fault_SetFrameBuffer,0x80083B70,0x15 +asm/non_matchings/boot/fault/Fault_Init.s,Fault_Init,0x80083BC4,0x4D asm/non_matchings/boot/fault/Fault_HangupFaultClient.s,Fault_HangupFaultClient,0x80083CF8,0x3F asm/non_matchings/boot/fault/Fault_AddHungupAndCrashImpl.s,Fault_AddHungupAndCrashImpl,0x80083DF4,0x16 asm/non_matchings/boot/fault/Fault_AddHungupAndCrash.s,Fault_AddHungupAndCrash,0x80083E4C,0x19 @@ -101,17 +101,17 @@ asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.s,FaultDrawer_F asm/non_matchings/boot/fault_drawer/FaultDrawer_VPrintf.s,FaultDrawer_VPrintf,0x8008477C,0x14 asm/non_matchings/boot/fault_drawer/FaultDrawer_Printf.s,FaultDrawer_Printf,0x800847CC,0x14 asm/non_matchings/boot/fault_drawer/FaultDrawer_DrawText.s,FaultDrawer_DrawText,0x8008481C,0x14 -asm/non_matchings/boot/fault_drawer/FaultDrawer_SetDrawerFB.s,FaultDrawer_SetDrawerFB,0x8008486C,0xE +asm/non_matchings/boot/fault_drawer/FaultDrawer_SetDrawerFrameBuffer.s,FaultDrawer_SetDrawerFrameBuffer,0x8008486C,0xE asm/non_matchings/boot/fault_drawer/FaultDrawer_SetInputCallback.s,FaultDrawer_SetInputCallback,0x800848A4,0x5 asm/non_matchings/boot/fault_drawer/FaultDrawer_Init.s,FaultDrawer_Init,0x800848B8,0x22 -asm/non_matchings/boot/boot_80084940/func_80084940.s,func_80084940,0x80084940,0xA -asm/non_matchings/boot/boot_80084940/func_80084968.s,func_80084968,0x80084968,0xE -asm/non_matchings/boot/loadfragment/Load_Relocate.s,Load_Relocate,0x800849A0,0x9B -asm/non_matchings/boot/loadfragment/Load_LoadOverlay.s,Load_LoadOverlay,0x80084C0C,0x31 -asm/non_matchings/boot/loadfragment/Load_AllocateAndLoad.s,Load_AllocateAndLoad,0x80084CD0,0x38 -asm/non_matchings/boot/loadfragment2/Load2_Relocate.s,Load2_Relocate,0x80084DB0,0x9B -asm/non_matchings/boot/loadfragment2/Load2_LoadOverlay.s,Load2_LoadOverlay,0x8008501C,0x2B -asm/non_matchings/boot/loadfragment2/Load2_AllocateAndLoad.s,Load2_AllocateAndLoad,0x800850C8,0x1A +asm/non_matchings/boot/rcp_utils/RcpUtils_PrintRegisterStatus.s,RcpUtils_PrintRegisterStatus,0x80084940,0xA +asm/non_matchings/boot/rcp_utils/RcpUtils_Reset.s,RcpUtils_Reset,0x80084968,0xE +asm/non_matchings/boot/loadfragment/Fragment_Relocate.s,Fragment_Relocate,0x800849A0,0x9B +asm/non_matchings/boot/loadfragment/Fragment_Load.s,Fragment_Load,0x80084C0C,0x31 +asm/non_matchings/boot/loadfragment/Fragment_AllocateAndLoad.s,Fragment_AllocateAndLoad,0x80084CD0,0x38 +asm/non_matchings/boot/loadfragment2/Overlay_Relocate.s,Overlay_Relocate,0x80084DB0,0x9B +asm/non_matchings/boot/loadfragment2/Overlay_Load.s,Overlay_Load,0x8008501C,0x2B +asm/non_matchings/boot/loadfragment2/Overlay_AllocateAndLoad.s,Overlay_AllocateAndLoad,0x800850C8,0x1A asm/non_matchings/boot/padutils/PadUtils_Init.s,PadUtils_Init,0x80085130,0x8 asm/non_matchings/boot/padutils/func_80085150.s,func_80085150,0x80085150,0x2 asm/non_matchings/boot/padutils/PadUtils_ResetPressRel.s,PadUtils_ResetPressRel,0x80085158,0x3 @@ -152,8 +152,8 @@ asm/non_matchings/boot/gfxprint/GfxPrint_VPrintf.s,GfxPrint_VPrintf,0x800860B8,0 asm/non_matchings/boot/gfxprint/GfxPrint_Printf.s,GfxPrint_Printf,0x800860D8,0xE asm/non_matchings/boot/mtxuty-cvt/MtxConv_F2L.s,MtxConv_F2L,0x80086110,0x52 asm/non_matchings/boot/mtxuty-cvt/MtxConv_L2F.s,MtxConv_L2F,0x80086258,0xA -asm/non_matchings/boot/assert/__assert.s,__assert,0x80086280,0xD -asm/non_matchings/boot/assert/func_800862B4.s,func_800862B4,0x800862B4,0xB +asm/non_matchings/boot/assert/_dbg_hungup.s,_dbg_hungup,0x80086280,0xD +asm/non_matchings/boot/assert/Reset.s,Reset,0x800862B4,0xB asm/non_matchings/boot/boot_800862E0/SystemHeap_Malloc.s,SystemHeap_Malloc,0x800862E0,0xC asm/non_matchings/boot/boot_800862E0/SystemArena_Free.s,SystemArena_Free,0x80086310,0xB asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc.s,SystemHeap_RunBlockFunc,0x8008633C,0x1C @@ -163,19 +163,19 @@ asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1Reverse.s,SystemHea asm/non_matchings/boot/boot_800862E0/SystemHeap_RunInits.s,SystemHeap_RunInits,0x80086588,0x1C asm/non_matchings/boot/boot_800862E0/SystemHeap_Init.s,SystemHeap_Init,0x800865F8,0xA asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50 -asm/non_matchings/boot/boot_80086760/Math_FTanF.s,Math_FTanF,0x80086760,0xD -asm/non_matchings/boot/boot_80086760/Math_FFloorF.s,Math_FFloorF,0x80086794,0x8 -asm/non_matchings/boot/boot_80086760/Math_FCeilF.s,Math_FCeilF,0x800867B4,0x8 -asm/non_matchings/boot/boot_80086760/Math_FRoundF.s,Math_FRoundF,0x800867D4,0x8 -asm/non_matchings/boot/boot_80086760/Math_FTruncF.s,Math_FTruncF,0x800867F4,0x8 -asm/non_matchings/boot/boot_80086760/Math_FNearbyIntF.s,Math_FNearbyIntF,0x80086814,0x8 -asm/non_matchings/boot/boot_80086760/Math_FAtanTaylorQF.s,Math_FAtanTaylorQF,0x80086834,0x13 -asm/non_matchings/boot/boot_80086760/Math_FAtanTaylorF.s,Math_FAtanTaylorF,0x80086880,0x49 -asm/non_matchings/boot/boot_80086760/Math_FAtanContFracF.s,Math_FAtanContFracF,0x800869A4,0x53 -asm/non_matchings/boot/boot_80086760/Math_FAtanF.s,Math_FAtanF,0x80086AF0,0x10 -asm/non_matchings/boot/boot_80086760/Math_FAtan2F.s,Math_FAtan2F,0x80086B30,0x3A -asm/non_matchings/boot/boot_80086760/Math_FAsinF.s,Math_FAsinF,0x80086C18,0xC -asm/non_matchings/boot/boot_80086760/Math_FAcosF.s,Math_FAcosF,0x80086C48,0xA +asm/non_matchings/boot/math64/Math_FTanF.s,Math_FTanF,0x80086760,0xD +asm/non_matchings/boot/math64/Math_FFloorF.s,Math_FFloorF,0x80086794,0x8 +asm/non_matchings/boot/math64/Math_FCeilF.s,Math_FCeilF,0x800867B4,0x8 +asm/non_matchings/boot/math64/Math_FRoundF.s,Math_FRoundF,0x800867D4,0x8 +asm/non_matchings/boot/math64/Math_FTruncF.s,Math_FTruncF,0x800867F4,0x8 +asm/non_matchings/boot/math64/Math_FNearbyIntF.s,Math_FNearbyIntF,0x80086814,0x8 +asm/non_matchings/boot/math64/Math_FAtanTaylorQF.s,Math_FAtanTaylorQF,0x80086834,0x13 +asm/non_matchings/boot/math64/Math_FAtanTaylorF.s,Math_FAtanTaylorF,0x80086880,0x49 +asm/non_matchings/boot/math64/Math_FAtanContFracF.s,Math_FAtanContFracF,0x800869A4,0x53 +asm/non_matchings/boot/math64/Math_FAtanF.s,Math_FAtanF,0x80086AF0,0x10 +asm/non_matchings/boot/math64/Math_FAtan2F.s,Math_FAtan2F,0x80086B30,0x3A +asm/non_matchings/boot/math64/Math_FAsinF.s,Math_FAsinF,0x80086C18,0xC +asm/non_matchings/boot/math64/Math_FAcosF.s,Math_FAcosF,0x80086C48,0xA asm/non_matchings/boot/fp/floorf.s,floorf,0x80086C70,0x3 asm/non_matchings/boot/fp/floor.s,floor,0x80086C7C,0x3 asm/non_matchings/boot/fp/lfloorf.s,lfloorf,0x80086C88,0x4 @@ -296,7 +296,7 @@ asm/non_matchings/boot/getsr/__osGetSR.s,__osGetSR,0x8008A5C0,0x4 asm/non_matchings/boot/setsr/__osSetSR.s,__osSetSR,0x8008A5D0,0x4 asm/non_matchings/boot/writebackdcache/osWritebackDCache.s,osWritebackDCache,0x8008A5E0,0x20 asm/non_matchings/boot/initialize/__createSpeedParam.s,__createSpeedParam,0x8008A660,0x27 -asm/non_matchings/boot/initialize/osInitialize.s,osInitialize,0x8008A6FC,0xAB +asm/non_matchings/boot/initialize/__osInitialize_common.s,__osInitialize_common,0x8008A6FC,0xAB asm/non_matchings/boot/initialize/__osInitialize_autodetect.s,__osInitialize_autodetect,0x8008A9A8,0x2 asm/non_matchings/boot/vigetnextframebuf/osViGetNextFramebuffer.s,osViGetNextFramebuffer,0x8008AA10,0x10 asm/non_matchings/boot/perspective/guPerspectiveF.s,guPerspectiveF,0x8008AA50,0x8C diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 80d36de95..54ec93503 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -183,12 +183,12 @@ asm/non_matchings/code/z_actor/Actor_SetFeetPos.s,Actor_SetFeetPos,0x800B4A98,0x asm/non_matchings/code/z_actor/func_800B4AEC.s,func_800B4AEC,0x800B4AEC,0x19 asm/non_matchings/code/z_actor/func_800B4B50.s,func_800B4B50,0x800B4B50,0xE3 asm/non_matchings/code/z_actor/Actor_GetProjectedPos.s,Actor_GetProjectedPos,0x800B4EDC,0x19 -asm/non_matchings/code/z_actor/Target_SetPos.s,Target_SetPos,0x800B4F40,0xE -asm/non_matchings/code/z_actor/func_800B4F78.s,func_800B4F78,0x800B4F78,0x32 -asm/non_matchings/code/z_actor/Target_SetColors.s,Target_SetColors,0x800B5040,0x59 -asm/non_matchings/code/z_actor/Actor_TargetContextInit.s,Actor_TargetContextInit,0x800B51A4,0x19 -asm/non_matchings/code/z_actor/Actor_DrawZTarget.s,Actor_DrawZTarget,0x800B5208,0x183 -asm/non_matchings/code/z_actor/func_800B5814.s,func_800B5814,0x800B5814,0xE7 +asm/non_matchings/code/z_actor/Target_SetLockOnPos.s,Target_SetLockOnPos,0x800B4F40,0xE +asm/non_matchings/code/z_actor/Target_InitLockOn.s,Target_InitLockOn,0x800B4F78,0x32 +asm/non_matchings/code/z_actor/Target_SetFairyState.s,Target_SetFairyState,0x800B5040,0x59 +asm/non_matchings/code/z_actor/Target_Init.s,Target_Init,0x800B51A4,0x19 +asm/non_matchings/code/z_actor/Target_Draw.s,Target_Draw,0x800B5208,0x183 +asm/non_matchings/code/z_actor/Target_Update.s,Target_Update,0x800B5814,0xE7 asm/non_matchings/code/z_actor/Flags_GetSwitch.s,Flags_GetSwitch,0x800B5BB0,0x11 asm/non_matchings/code/z_actor/Flags_SetSwitch.s,Flags_SetSwitch,0x800B5BF4,0x10 asm/non_matchings/code/z_actor/Flags_UnsetSwitch.s,Flags_UnsetSwitch,0x800B5C34,0x11 @@ -214,9 +214,9 @@ asm/non_matchings/code/z_actor/Actor_InitPlayerImpact.s,Actor_InitPlayerImpact,0 asm/non_matchings/code/z_actor/Actor_UpdatePlayerImpact.s,Actor_UpdatePlayerImpact,0x800B6474,0x6 asm/non_matchings/code/z_actor/Actor_SetPlayerImpact.s,Actor_SetPlayerImpact,0x800B648C,0x1C asm/non_matchings/code/z_actor/Actor_GetPlayerImpact.s,Actor_GetPlayerImpact,0x800B64FC,0x22 -asm/non_matchings/code/z_actor/func_800B6584.s,func_800B6584,0x800B6584,0x21 -asm/non_matchings/code/z_actor/func_800B6608.s,func_800B6608,0x800B6608,0x1E -asm/non_matchings/code/z_actor/func_800B6680.s,func_800B6680,0x800B6680,0x23 +asm/non_matchings/code/z_actor/Actor_AddSharedMemoryEntry.s,func_800B6584,0x800B6584,0x21 +asm/non_matchings/code/z_actor/Actor_FreeSharedMemoryEntry.s,func_800B6608,0x800B6608,0x1E +asm/non_matchings/code/z_actor/Actor_FindSharedMemoryEntry.s,func_800B6680,0x800B6680,0x23 asm/non_matchings/code/z_actor/Actor_Kill.s,Actor_Kill,0x800B670C,0x8 asm/non_matchings/code/z_actor/Actor_SetWorldToHome.s,Actor_SetWorldToHome,0x800B672C,0xC asm/non_matchings/code/z_actor/Actor_SetFocus.s,Actor_SetFocus,0x800B675C,0x11 @@ -280,14 +280,14 @@ asm/non_matchings/code/z_actor/func_800B8118.s,func_800B8118,0x800B8118,0x32 asm/non_matchings/code/z_actor/Actor_GetFocus.s,Actor_GetFocus,0x800B81E0,0xD asm/non_matchings/code/z_actor/Actor_GetWorld.s,Actor_GetWorld,0x800B8214,0xD asm/non_matchings/code/z_actor/Actor_GetWorldPosShapeRot.s,Actor_GetWorldPosShapeRot,0x800B8248,0x29 -asm/non_matchings/code/z_actor/func_800B82EC.s,func_800B82EC,0x800B82EC,0x34 -asm/non_matchings/code/z_actor/func_800B83BC.s,func_800B83BC,0x800B83BC,0xF -asm/non_matchings/code/z_actor/func_800B83F8.s,func_800B83F8,0x800B83F8,0x36 +asm/non_matchings/code/z_actor/Target_GetAdjustedDistSq.s,Target_GetAdjustedDistSq,0x800B82EC,0x34 +asm/non_matchings/code/z_actor/Target_IsActorInRange.s,Target_IsActorInRange,0x800B83BC,0xF +asm/non_matchings/code/z_actor/Target_OutsideLeashRange.s,Target_OutsideLeashRange,0x800B83F8,0x36 asm/non_matchings/code/z_actor/Actor_ProcessTalkRequest.s,Actor_ProcessTalkRequest,0x800B84D0,0xC -asm/non_matchings/code/z_actor/func_800B8500.s,func_800B8500,0x800B8500,0x38 -asm/non_matchings/code/z_actor/func_800B85E0.s,func_800B85E0,0x800B85E0,0xD -asm/non_matchings/code/z_actor/func_800B8614.s,func_800B8614,0x800B8614,0xA -asm/non_matchings/code/z_actor/func_800B863C.s,func_800B863C,0x800B863C,0x10 +asm/non_matchings/code/z_actor/Actor_OfferTalkExchange.s,Actor_OfferTalkExchange,0x800B8500,0x38 +asm/non_matchings/code/z_actor/Actor_OfferTalkExchangeEquiCylinder.s,Actor_OfferTalkExchangeEquiCylinder,0x800B85E0,0xD +asm/non_matchings/code/z_actor/Actor_OfferTalk.s,Actor_OfferTalk,0x800B8614,0xA +asm/non_matchings/code/z_actor/Actor_OfferTalkNearColChkInfoCylinder.s,Actor_OfferTalkNearColChkInfoCylinder,0x800B863C,0x10 asm/non_matchings/code/z_actor/Actor_TextboxIsClosing.s,Actor_TextboxIsClosing,0x800B867C,0x13 asm/non_matchings/code/z_actor/Actor_ChangeFocus.s,Actor_ChangeFocus,0x800B86C8,0x10 asm/non_matchings/code/z_actor/Player_GetExchangeItemId.s,Player_GetExchangeItemId,0x800B8708,0x4 @@ -316,14 +316,14 @@ asm/non_matchings/code/z_actor/func_800B8DD4.s,func_800B8DD4,0x800B8DD4,0x12 asm/non_matchings/code/z_actor/func_800B8E1C.s,func_800B8E1C,0x800B8E1C,0xF asm/non_matchings/code/z_actor/Player_PlaySfx.s,Player_PlaySfx,0x800B8E58,0x1C asm/non_matchings/code/z_actor/Actor_PlaySfx.s,Actor_PlaySfx,0x800B8EC8,0xB -asm/non_matchings/code/z_actor/func_800B8EF4.s,func_800B8EF4,0x800B8EF4,0x29 -asm/non_matchings/code/z_actor/func_800B8F98.s,func_800B8F98,0x800B8F98,0xA -asm/non_matchings/code/z_actor/func_800B8FC0.s,func_800B8FC0,0x800B8FC0,0xA -asm/non_matchings/code/z_actor/func_800B8FE8.s,func_800B8FE8,0x800B8FE8,0xA -asm/non_matchings/code/z_actor/func_800B9010.s,func_800B9010,0x800B9010,0xA -asm/non_matchings/code/z_actor/func_800B9038.s,func_800B9038,0x800B9038,0x13 -asm/non_matchings/code/z_actor/func_800B9084.s,func_800B9084,0x800B9084,0x5 -asm/non_matchings/code/z_actor/func_800B9098.s,func_800B9098,0x800B9098,0x5 +asm/non_matchings/code/z_actor/Actor_PlaySfx_SurfaceBomb.s,Actor_PlaySfx_SurfaceBomb,0x800B8EF4,0x29 +asm/non_matchings/code/z_actor/Actor_PlaySfx_FlaggedCentered1.s,Actor_PlaySfx_FlaggedCentered1,0x800B8F98,0xA +asm/non_matchings/code/z_actor/Actor_PlaySfx_FlaggedCentered2.s,Actor_PlaySfx_FlaggedCentered2,0x800B8FC0,0xA +asm/non_matchings/code/z_actor/Actor_PlaySfx_FlaggedCentered3.s,Actor_PlaySfx_FlaggedCentered3,0x800B8FE8,0xA +asm/non_matchings/code/z_actor/Actor_PlaySfx_Flagged.s,Actor_PlaySfx_Flagged,0x800B9010,0xA +asm/non_matchings/code/z_actor/Actor_PlaySfx_FlaggedTimer.s,Actor_PlaySfx_FlaggedTimer,0x800B9038,0x13 +asm/non_matchings/code/z_actor/Actor_PlaySeq_FlaggedKamaroDance.s,Actor_PlaySeq_FlaggedKamaroDance,0x800B9084,0x5 +asm/non_matchings/code/z_actor/Actor_PlaySeq_FlaggedMusicBoxHouse.s,Actor_PlaySeq_FlaggedMusicBoxHouse,0x800B9098,0x5 asm/non_matchings/code/z_actor/func_800B90AC.s,func_800B90AC,0x800B90AC,0x12 asm/non_matchings/code/z_actor/Actor_DeactivateLens.s,Actor_DeactivateLens,0x800B90F4,0xB asm/non_matchings/code/z_actor/Actor_InitHalfDaysBit.s,Actor_InitHalfDaysBit,0x800B9120,0x14 @@ -332,7 +332,7 @@ asm/non_matchings/code/z_actor/Actor_SpawnSetupActors.s,Actor_SpawnSetupActors,0 asm/non_matchings/code/z_actor/Actor_UpdateActor.s,Actor_UpdateActor,0x800B948C,0xBD asm/non_matchings/code/z_actor/Actor_UpdateAll.s,Actor_UpdateAll,0x800B9780,0xA1 asm/non_matchings/code/z_actor/Actor_Draw.s,Actor_Draw,0x800B9A04,0xC6 -asm/non_matchings/code/z_actor/func_800B9D1C.s,func_800B9D1C,0x800B9D1C,0x48 +asm/non_matchings/code/z_actor/Actor_UpdateFlaggedAudio.s,Actor_UpdateFlaggedAudio,0x800B9D1C,0x48 asm/non_matchings/code/z_actor/Actor_ResetLensActors.s,Actor_ResetLensActors,0x800B9E3C,0x4 asm/non_matchings/code/z_actor/Actor_AddToLensActors.s,Actor_AddToLensActors,0x800B9E4C,0xE asm/non_matchings/code/z_actor/Actor_DrawLensOverlay.s,Actor_DrawLensOverlay,0x800B9E84,0x1C @@ -354,9 +354,9 @@ asm/non_matchings/code/z_actor/Actor_SpawnAsChild.s,Actor_SpawnAsChild,0x800BB0C asm/non_matchings/code/z_actor/Actor_SpawnTransitionActors.s,Actor_SpawnTransitionActors,0x800BB140,0x64 asm/non_matchings/code/z_actor/Actor_SpawnEntry.s,Actor_SpawnEntry,0x800BB2D0,0x72 asm/non_matchings/code/z_actor/Actor_Delete.s,Actor_Delete,0x800BB498,0x41 -asm/non_matchings/code/z_actor/func_800BB59C.s,func_800BB59C,0x800BB59C,0x1A -asm/non_matchings/code/z_actor/func_800BB604.s,func_800BB604,0x800BB604,0xBA -asm/non_matchings/code/z_actor/func_800BB8EC.s,func_800BB8EC,0x800BB8EC,0x67 +asm/non_matchings/code/z_actor/Target_InTargetableScreenRegion.s,Target_InTargetableScreenRegion,0x800BB59C,0x1A +asm/non_matchings/code/z_actor/Target_FindTargetableActorForCategory.s,Target_FindTargetableActorForCategory,0x800BB604,0xBA +asm/non_matchings/code/z_actor/Target_GetTargetActor.s,Target_GetTargetActor,0x800BB8EC,0x67 asm/non_matchings/code/z_actor/Enemy_StartFinishingBlow.s,Enemy_StartFinishingBlow,0x800BBA88,0xE asm/non_matchings/code/z_actor/func_800BBAC0.s,func_800BBAC0,0x800BBAC0,0x2D asm/non_matchings/code/z_actor/func_800BBB74.s,func_800BBB74,0x800BBB74,0x2B @@ -392,7 +392,7 @@ asm/non_matchings/code/z_actor/func_800BD9E0.s,func_800BD9E0,0x800BD9E0,0x30 asm/non_matchings/code/z_actor/func_800BDAA0.s,func_800BDAA0,0x800BDAA0,0x33 asm/non_matchings/code/z_actor/func_800BDB6C.s,func_800BDB6C,0x800BDB6C,0x3C asm/non_matchings/code/z_actor/Actor_ChangeAnimationByInfo.s,Actor_ChangeAnimationByInfo,0x800BDC5C,0x26 -asm/non_matchings/code/z_actor/func_800BDCF4.s,func_800BDCF4,0x800BDCF4,0xAF +asm/non_matchings/code/z_actor/Actor_UpdateFidgetTables.s,Actor_UpdateFidgetTables,0x800BDCF4,0xAF asm/non_matchings/code/z_actor/Actor_Noop.s,Actor_Noop,0x800BDFB0,0x4 asm/non_matchings/code/z_actor/Gfx_DrawDListOpa.s,Gfx_DrawDListOpa,0x800BDFC0,0x1F asm/non_matchings/code/z_actor/Gfx_DrawDListXlu.s,Gfx_DrawDListXlu,0x800BE03C,0x1F @@ -1220,86 +1220,86 @@ asm/non_matchings/code/z_kanfont/Font_LoadChar.s,Font_LoadChar,0x800F4F40,0x5 asm/non_matchings/code/z_kanfont/Font_LoadCharNES.s,Font_LoadCharNES,0x800F4F54,0x1B asm/non_matchings/code/z_kanfont/Font_LoadMessageBoxEndIcon.s,Font_LoadMessageBoxEndIcon,0x800F4FC0,0x11 asm/non_matchings/code/z_kanfont/Font_LoadOrderedFont.s,Font_LoadOrderedFont,0x800F5004,0x23 -asm/non_matchings/code/z_kankyo/func_800F5090.s,func_800F5090,0x800F5090,0x11 +asm/non_matchings/code/z_kankyo/Environment_GraphCallback.s,Environment_GraphCallback,0x800F5090,0x11 asm/non_matchings/code/z_kankyo/Environment_ZBufValToFixedPoint.s,Environment_ZBufValToFixedPoint,0x800F50D4,0xE asm/non_matchings/code/z_kankyo/Environment_Init.s,Environment_Init,0x800F510C,0x212 -asm/non_matchings/code/z_kankyo/func_800F5954.s,func_800F5954,0x800F5954,0x4E +asm/non_matchings/code/z_kankyo/Environment_SmoothStepToU8.s,Environment_SmoothStepToU8,0x800F5954,0x4E asm/non_matchings/code/z_kankyo/Environment_LerpWeight.s,Environment_LerpWeight,0x800F5A8C,0x21 -asm/non_matchings/code/z_kankyo/func_800F5B10.s,func_800F5B10,0x800F5B10,0x70 +asm/non_matchings/code/z_kankyo/Environment_LerpWeightAccelDecel.s,Environment_LerpWeightAccelDecel,0x800F5B10,0x70 asm/non_matchings/code/z_kankyo/Environment_UpdateSkybox.s,Environment_UpdateSkybox,0x800F5CD0,0x2D9 -asm/non_matchings/code/z_kankyo/func_800F6834.s,func_800F6834,0x800F6834,0x46 -asm/non_matchings/code/z_kankyo/func_800F694C.s,func_800F694C,0x800F694C,0x2E +asm/non_matchings/code/z_kankyo/Environment_EnableUnderwaterLights.s,Environment_EnableUnderwaterLights,0x800F6834,0x46 +asm/non_matchings/code/z_kankyo/Environment_DisableUnderwaterLights.s,Environment_DisableUnderwaterLights,0x800F694C,0x2E asm/non_matchings/code/z_kankyo/func_800F6A04.s,func_800F6A04,0x800F6A04,0xF -asm/non_matchings/code/z_kankyo/func_800F6A40.s,func_800F6A40,0x800F6A40,0x1E -asm/non_matchings/code/z_kankyo/func_800F6AB8.s,func_800F6AB8,0x800F6AB8,0x23 -asm/non_matchings/code/z_kankyo/func_800F6B44.s,func_800F6B44,0x800F6B44,0x6A +asm/non_matchings/code/z_kankyo/Environment_UpdateSkyboxRotY.s,Environment_UpdateSkyboxRotY,0x800F6A40,0x1E +asm/non_matchings/code/z_kankyo/Environment_UpdateNextDayTime.s,Environment_UpdateNextDayTime,0x800F6AB8,0x23 +asm/non_matchings/code/z_kankyo/Environment_UpdateTime.s,Environment_UpdateTime,0x800F6B44,0x6A asm/non_matchings/code/z_kankyo/func_800F6CEC.s,func_800F6CEC,0x800F6CEC,0x6E asm/non_matchings/code/z_kankyo/func_800F6EA4.s,func_800F6EA4,0x800F6EA4,0x4A -asm/non_matchings/code/z_kankyo/Kankyo_IsSceneUpsideDown.s,Kankyo_IsSceneUpsideDown,0x800F6FCC,0xB -asm/non_matchings/code/z_kankyo/func_800F6FF8.s,func_800F6FF8,0x800F6FF8,0x557 -asm/non_matchings/code/z_kankyo/func_800F8554.s,func_800F8554,0x800F8554,0xDC +asm/non_matchings/code/z_kankyo/Environment_IsSceneUpsideDown.s,Environment_IsSceneUpsideDown,0x800F6FCC,0xB +asm/non_matchings/code/z_kankyo/Environment_UpdateLights.s,Environment_UpdateLights,0x800F6FF8,0x557 +asm/non_matchings/code/z_kankyo/Environment_UpdateSun.s,Environment_UpdateSun,0x800F8554,0xDC asm/non_matchings/code/z_kankyo/func_800F88C4.s,func_800F88C4,0x800F88C4,0x2B asm/non_matchings/code/z_kankyo/func_800F8970.s,func_800F8970,0x800F8970,0x4B -asm/non_matchings/code/z_kankyo/func_800F8A9C.s,func_800F8A9C,0x800F8A9C,0x8E +asm/non_matchings/code/z_kankyo/Environment_UpdatePostmanEvents.s,Environment_UpdatePostmanEvents,0x800F8A9C,0x8E asm/non_matchings/code/z_kankyo/Environment_Update.s,Environment_Update,0x800F8CD4,0x2C -asm/non_matchings/code/z_kankyo/func_800F8D84.s,func_800F8D84,0x800F8D84,0x269 +asm/non_matchings/code/z_kankyo/Environment_DrawSun.s,Environment_DrawSun,0x800F8D84,0x269 asm/non_matchings/code/z_kankyo/Environment_DrawSunLensFlare.s,Environment_DrawSunLensFlare,0x800F9728,0x3F -asm/non_matchings/code/z_kankyo/func_800F9824.s,func_800F9824,0x800F9824,0x2DE -asm/non_matchings/code/z_kankyo/func_800FA39C.s,func_800FA39C,0x800FA39C,0xA -asm/non_matchings/code/z_kankyo/func_800FA3C4.s,func_800FA3C4,0x800FA3C4,0x18E +asm/non_matchings/code/z_kankyo/Environment_DrawLensFlare.s,Environment_DrawLensFlare,0x800F9824,0x2DE +asm/non_matchings/code/z_kankyo/Environment_RandCentered.s,Environment_RandCentered,0x800FA39C,0xA +asm/non_matchings/code/z_kankyo/Environment_DrawRainImpl.s,Environment_DrawRainImpl,0x800FA3C4,0x18E asm/non_matchings/code/z_kankyo/Environment_DrawRain.s,Environment_DrawRain,0x800FA9FC,0x2E -asm/non_matchings/code/z_kankyo/func_800FAAB4.s,func_800FAAB4,0x800FAAB4,0x5B -asm/non_matchings/code/z_kankyo/func_800FAC20.s,func_800FAC20,0x800FAC20,0xD5 -asm/non_matchings/code/z_kankyo/func_800FAF74.s,func_800FAF74,0x800FAF74,0x27 -asm/non_matchings/code/z_kankyo/func_800FB010.s,func_800FB010,0x800FB010,0xC4 +asm/non_matchings/code/z_kankyo/Environment_ChangeLightSetting.s,Environment_ChangeLightSetting,0x800FAAB4,0x5B +asm/non_matchings/code/z_kankyo/Environment_DrawSkyboxFilters.s,Environment_DrawSkyboxFilters,0x800FAC20,0xD5 +asm/non_matchings/code/z_kankyo/Environment_DrawLightningFlash.s,Environment_DrawLightningFlash,0x800FAF74,0x27 +asm/non_matchings/code/z_kankyo/Environment_UpdateLightningStrike.s,Environment_UpdateLightningStrike,0x800FB010,0xC4 asm/non_matchings/code/z_kankyo/Environment_AddLightningBolts.s,Environment_AddLightningBolts,0x800FB320,0x1A -asm/non_matchings/code/z_kankyo/func_800FB388.s,func_800FB388,0x800FB388,0xF4 -asm/non_matchings/code/z_kankyo/func_800FB758.s,func_800FB758,0x800FB758,0x97 -asm/non_matchings/code/z_kankyo/func_800FB9B4.s,func_800FB9B4,0x800FB9B4,0xC2 +asm/non_matchings/code/z_kankyo/Environment_DrawLightning.s,Environment_DrawLightning,0x800FB388,0xF4 +asm/non_matchings/code/z_kankyo/Environment_PlaySceneSequence.s,Environment_PlaySceneSequence,0x800FB758,0x97 +asm/non_matchings/code/z_kankyo/Environment_UpdateTimeBasedSequence.s,Environment_UpdateTimeBasedSequence,0x800FB9B4,0xC2 asm/non_matchings/code/z_kankyo/Environment_DrawCustomLensFlare.s,Environment_DrawCustomLensFlare,0x800FBCBC,0x4C -asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s,Kankyo_InitGameOverLights,0x800FBDEC,0x54 -asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s,Kankyo_FadeInGameOverLights,0x800FBF3C,0x87 -asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s,Kankyo_FadeOutGameOverLights,0x800FC158,0xA1 -asm/non_matchings/code/z_kankyo/func_800FC3DC.s,func_800FC3DC,0x800FC3DC,0x1A +asm/non_matchings/code/z_kankyo/Environment_InitGameOverLights.s,Environment_InitGameOverLights,0x800FBDEC,0x54 +asm/non_matchings/code/z_kankyo/Environment_FadeInGameOverLights.s,Environment_FadeInGameOverLights,0x800FBF3C,0x87 +asm/non_matchings/code/z_kankyo/Environment_FadeOutGameOverLights.s,Environment_FadeOutGameOverLights,0x800FC158,0xA1 +asm/non_matchings/code/z_kankyo/Environment_UpdateRain.s,Environment_UpdateRain,0x800FC3DC,0x1A asm/non_matchings/code/z_kankyo/Environment_FillScreen.s,Environment_FillScreen,0x800FC444,0x82 asm/non_matchings/code/z_kankyo/Environment_DrawSandstorm.s,Environment_DrawSandstorm,0x800FC64C,0x31A -asm/non_matchings/code/z_kankyo/func_800FD2B4.s,func_800FD2B4,0x800FD2B4,0xA1 -asm/non_matchings/code/z_kankyo/func_800FD538.s,func_800FD538,0x800FD538,0x19 -asm/non_matchings/code/z_kankyo/func_800FD59C.s,func_800FD59C,0x800FD59C,0x11 -asm/non_matchings/code/z_kankyo/func_800FD5E0.s,func_800FD5E0,0x800FD5E0,0x1D -asm/non_matchings/code/z_kankyo/func_800FD654.s,func_800FD654,0x800FD654,0x11 -asm/non_matchings/code/z_kankyo/func_800FD698.s,func_800FD698,0x800FD698,0x22 -asm/non_matchings/code/z_kankyo/get_days_elapsed.s,get_days_elapsed,0x800FD720,0x4 -asm/non_matchings/code/z_kankyo/reset_days_elapsed.s,reset_days_elapsed,0x800FD730,0x4 -asm/non_matchings/code/z_kankyo/get_current_day.s,get_current_day,0x800FD740,0x4 -asm/non_matchings/code/z_kankyo/func_800FD750.s,func_800FD750,0x800FD750,0x6 -asm/non_matchings/code/z_kankyo/func_800FD768.s,func_800FD768,0x800FD768,0x9 -asm/non_matchings/code/z_kankyo/func_800FD78C.s,func_800FD78C,0x800FD78C,0x33 -asm/non_matchings/code/z_kankyo/func_800FD858.s,func_800FD858,0x800FD858,0x34 -asm/non_matchings/code/z_kankyo/func_800FD928.s,func_800FD928,0x800FD928,0x16 -asm/non_matchings/code/z_kankyo/func_800FD980.s,func_800FD980,0x800FD980,0x5E -asm/non_matchings/code/z_kankyo/func_800FDAF8.s,func_800FDAF8,0x800FDAF8,0x67 -asm/non_matchings/code/z_kankyo/func_800FDC94.s,func_800FDC94,0x800FDC94,0x1BF -asm/non_matchings/code/z_kankyo/func_800FE390.s,func_800FE390,0x800FE390,0x14 -asm/non_matchings/code/z_kankyo/func_800FE3E0.s,func_800FE3E0,0x800FE3E0,0x29 +asm/non_matchings/code/z_kankyo/Environment_AdjustLights.s,Environment_AdjustLights,0x800FD2B4,0xA1 +asm/non_matchings/code/z_kankyo/Environment_LerpRGB8.s,Environment_LerpRGB8,0x800FD538,0x19 +asm/non_matchings/code/z_kankyo/Environment_LerpAmbientColor.s,Environment_LerpAmbientColor,0x800FD59C,0x11 +asm/non_matchings/code/z_kankyo/Environment_LerpDiffuseColor.s,Environment_LerpDiffuseColor,0x800FD5E0,0x1D +asm/non_matchings/code/z_kankyo/Environment_LerpFogColor.s,Environment_LerpFogColor,0x800FD654,0x11 +asm/non_matchings/code/z_kankyo/Environment_LerpFog.s,Environment_LerpFog,0x800FD698,0x22 +asm/non_matchings/code/z_kankyo/Environment_GetEventDayCount.s,Environment_GetEventDayCount,0x800FD720,0x4 +asm/non_matchings/code/z_kankyo/Environment_ClearEventDayCount.s,Environment_ClearEventDayCount,0x800FD730,0x4 +asm/non_matchings/code/z_kankyo/Environment_GetTotalDays.s,Environment_GetTotalDays,0x800FD740,0x4 +asm/non_matchings/code/z_kankyo/Environment_ForcePlaySequence.s,Environment_ForcePlaySequence,0x800FD750,0x6 +asm/non_matchings/code/z_kankyo/Environment_IsForcedSequenceDisabled.s,Environment_IsForcedSequenceDisabled,0x800FD768,0x9 +asm/non_matchings/code/z_kankyo/Environment_PlayStormNatureAmbience.s,Environment_PlayStormNatureAmbience,0x800FD78C,0x33 +asm/non_matchings/code/z_kankyo/Environment_StopStormNatureAmbience.s,Environment_StopStormNatureAmbience,0x800FD858,0x34 +asm/non_matchings/code/z_kankyo/Environment_WarpSongLeave.s,Environment_WarpSongLeave,0x800FD928,0x16 +asm/non_matchings/code/z_kankyo/Environment_SetupSkyboxStars.s,Environment_SetupSkyboxStars,0x800FD980,0x5E +asm/non_matchings/code/z_kankyo/Environment_DrawSkyboxStar.s,Environment_DrawSkyboxStar,0x800FDAF8,0x67 +asm/non_matchings/code/z_kankyo/Environment_DrawSkyboxStarsImpl.s,Environment_DrawSkyboxStarsImpl,0x800FDC94,0x1BF +asm/non_matchings/code/z_kankyo/Environment_Draw.s,Environment_Draw,0x800FE390,0x14 +asm/non_matchings/code/z_kankyo/Environment_DrawSkyboxStars.s,Environment_DrawSkyboxStars,0x800FE3E0,0x29 asm/non_matchings/code/z_kankyo/Environment_StopTime.s,Environment_StopTime,0x800FE484,0x5 asm/non_matchings/code/z_kankyo/Environment_StartTime.s,Environment_StartTime,0x800FE498,0x4 asm/non_matchings/code/z_kankyo/Environment_IsTimeStopped.s,Environment_IsTimeStopped,0x800FE4A8,0x4 -asm/non_matchings/code/z_kankyo/func_800FE4B8.s,func_800FE4B8,0x800FE4B8,0x36 -asm/non_matchings/code/z_kankyo/func_800FE590.s,func_800FE590,0x800FE590,0x10 +asm/non_matchings/code/z_kankyo/Environment_GetStormState.s,Environment_GetStormState,0x800FE4B8,0x36 +asm/non_matchings/code/z_kankyo/Environment_IsFinalHours.s,Environment_IsFinalHours,0x800FE590,0x10 asm/non_matchings/code/z_kankyo/func_800FE5D0.s,func_800FE5D0,0x800FE5D0,0x10 asm/non_matchings/code/z_kankyo/func_800FE610.s,func_800FE610,0x800FE610,0x4 -asm/non_matchings/code/z_kankyo/func_800FE620.s,func_800FE620,0x800FE620,0xE -asm/non_matchings/code/z_kankyo/func_800FE658.s,func_800FE658,0x800FE658,0x28 +asm/non_matchings/code/z_kankyo/Environment_GetTimeSpeed.s,Environment_GetTimeSpeed,0x800FE620,0xE +asm/non_matchings/code/z_kankyo/Environment_SetTimeJump.s,Environment_SetTimeJump,0x800FE658,0x28 asm/non_matchings/code/z_kankyo/func_800FE6F8.s,func_800FE6F8,0x800FE6F8,0x20 -asm/non_matchings/code/z_kankyo/func_800FE778.s,func_800FE778,0x800FE778,0x4 -asm/non_matchings/code/z_kankyo/func_800FE788.s,func_800FE788,0x800FE788,0x4 -asm/non_matchings/code/z_kankyo/func_800FE798.s,func_800FE798,0x800FE798,0x4 -asm/non_matchings/code/z_kankyo/func_800FE7A8.s,func_800FE7A8,0x800FE7A8,0x83 +asm/non_matchings/code/z_kankyo/Environment_GetSandstormColorIndex.s,Environment_GetSandstormColorIndex,0x800FE778,0x4 +asm/non_matchings/code/z_kankyo/Environment_GetNextSandstormColorIndex.s,Environment_GetNextSandstormColorIndex,0x800FE788,0x4 +asm/non_matchings/code/z_kankyo/Environment_GetSandstormLerpScale.s,Environment_GetSandstormLerpScale,0x800FE798,0x4 +asm/non_matchings/code/z_kankyo/Environment_LerpSandstormColors.s,Environment_LerpSandstormColors,0x800FE7A8,0x83 asm/non_matchings/code/z_kankyo/func_800FE9B4.s,func_800FE9B4,0x800FE9B4,0x27 asm/non_matchings/code/z_kankyo/func_800FEA50.s,func_800FEA50,0x800FEA50,0x18 asm/non_matchings/code/z_kankyo/func_800FEAB0.s,func_800FEAB0,0x800FEAB0,0x4 -asm/non_matchings/code/z_kankyo/func_800FEAC0.s,func_800FEAC0,0x800FEAC0,0xD +asm/non_matchings/code/z_kankyo/Environment_JumpForwardInTime.s,Environment_JumpForwardInTime,0x800FEAC0,0xD asm/non_matchings/code/z_kankyo/func_800FEAF4.s,func_800FEAF4,0x800FEAF4,0x67 asm/non_matchings/code/z_lib/Lib_MemCpy.s,Lib_MemCpy,0x800FEC90,0xC asm/non_matchings/code/z_lib/Lib_MemSet.s,Lib_MemSet,0x800FECC0,0x21 @@ -1317,7 +1317,7 @@ asm/non_matchings/code/z_lib/Math_StepToAngleS.s,Math_StepToAngleS,0x800FF138,0x asm/non_matchings/code/z_lib/Math_AsymStepToS.s,Math_AsymStepToS,0x800FF1FC,0x2B asm/non_matchings/code/z_lib/Math_StepUntilF.s,Math_StepUntilF,0x800FF2A8,0x14 asm/non_matchings/code/z_lib/Math_AsymStepToF.s,Math_AsymStepToF,0x800FF2F8,0x2A -asm/non_matchings/code/z_lib/func_800FF3A0.s,func_800FF3A0,0x800FF3A0,0x2C +asm/non_matchings/code/z_lib/Lib_GetControlStickData.s,Lib_GetControlStickData,0x800FF3A0,0x2C asm/non_matchings/code/z_lib/Rand_S16Offset.s,Rand_S16Offset,0x800FF450,0x15 asm/non_matchings/code/z_lib/Rand_S16OffsetStride.s,Rand_S16OffsetStride,0x800FF4A4,0x1A asm/non_matchings/code/z_lib/Math_Vec3f_Copy.s,Math_Vec3f_Copy,0x800FF50C,0x8 @@ -1359,11 +1359,11 @@ asm/non_matchings/code/z_lib/Math_ApproachZeroF.s,Math_ApproachZeroF,0x800FFE68, asm/non_matchings/code/z_lib/Math_SmoothStepToS.s,Math_SmoothStepToS,0x800FFEBC,0x47 asm/non_matchings/code/z_lib/Math_ApproachS.s,Math_ApproachS,0x800FFFD8,0x29 asm/non_matchings/code/z_lib/Color_RGBA8_Copy.s,Color_RGBA8_Copy,0x8010007C,0xA -asm/non_matchings/code/z_lib/func_801000A4.s,func_801000A4,0x801000A4,0xA -asm/non_matchings/code/z_lib/func_801000CC.s,func_801000CC,0x801000CC,0xA -asm/non_matchings/code/z_lib/Lib_PlaySfxAtPos.s,Lib_PlaySfxAtPos,0x801000F4,0xA +asm/non_matchings/code/z_lib/Lib_PlaySfx.s,Lib_PlaySfx,0x801000A4,0xA +asm/non_matchings/code/z_lib/Lib_PlaySfx_2.s,Lib_PlaySfx_2,0x801000CC,0xA +asm/non_matchings/code/z_lib/Lib_PlaySfx_AtPos.s,Lib_PlaySfx_AtPos,0x801000F4,0xA asm/non_matchings/code/z_lib/Lib_Vec3f_TranslateAndRotateY.s,Lib_Vec3f_TranslateAndRotateY,0x8010011C,0x27 -asm/non_matchings/code/z_lib/Lib_LerpRGB.s,Lib_LerpRGB,0x801001B8,0xA4 +asm/non_matchings/code/z_lib/Color_RGB8_Lerp.s,Color_RGB8_Lerp,0x801001B8,0xA4 asm/non_matchings/code/z_lib/Math_Vec3f_StepTo.s,Math_Vec3f_StepTo,0x80100448,0x2D asm/non_matchings/code/z_lib/Lib_Nop801004FC.s,Lib_Nop801004FC,0x801004FC,0x2 asm/non_matchings/code/z_lib/Lib_SegmentedToVirtual.s,Lib_SegmentedToVirtual,0x80100504,0xE @@ -1713,7 +1713,7 @@ asm/non_matchings/code/z_player_lib/Player_IsGoronOrDeku.s,Player_IsGoronOrDeku, asm/non_matchings/code/z_player_lib/func_801234D4.s,func_801234D4,0x801234D4,0x2F asm/non_matchings/code/z_player_lib/func_80123590.s,func_80123590,0x80123590,0x13 asm/non_matchings/code/z_player_lib/func_801235DC.s,func_801235DC,0x801235DC,0x1C -asm/non_matchings/code/z_player_lib/func_8012364C.s,func_8012364C,0x8012364C,0x71 +asm/non_matchings/code/z_player_lib/Player_GetItemOnButton.s,Player_GetItemOnButton,0x8012364C,0x71 asm/non_matchings/code/z_player_lib/func_80123810.s,func_80123810,0x80123810,0x54 asm/non_matchings/code/z_player_lib/Player_ActionToModelGroup.s,Player_ActionToModelGroup,0x80123960,0x13 asm/non_matchings/code/z_player_lib/Player_SetModelsForHoldingShield.s,Player_SetModelsForHoldingShield,0x801239AC,0x3E @@ -1722,7 +1722,7 @@ asm/non_matchings/code/z_player_lib/Player_SetModelGroup.s,Player_SetModelGroup, asm/non_matchings/code/z_player_lib/func_80123C58.s,func_80123C58,0x80123C58,0xE asm/non_matchings/code/z_player_lib/Player_SetEquipmentData.s,Player_SetEquipmentData,0x80123C90,0x30 asm/non_matchings/code/z_player_lib/Player_UpdateBottleHeld.s,Player_UpdateBottleHeld,0x80123D50,0x15 -asm/non_matchings/code/z_player_lib/func_80123DA4.s,func_80123DA4,0x80123DA4,0x7 +asm/non_matchings/code/z_player_lib/Player_Untarget.s,Player_Untarget,0x80123DA4,0x7 asm/non_matchings/code/z_player_lib/func_80123DC0.s,func_80123DC0,0x80123DC0,0x34 asm/non_matchings/code/z_player_lib/func_80123E90.s,func_80123E90,0x80123E90,0x21 asm/non_matchings/code/z_player_lib/func_80123F14.s,func_80123F14,0x80123F14,0x6 @@ -1929,10 +1929,10 @@ asm/non_matchings/code/code_8012EC80/Inventory_SaveDekuPlaygroundHighScore.s,Inv asm/non_matchings/code/code_8012EC80/Inventory_IncrementSkullTokenCount.s,Inventory_IncrementSkullTokenCount,0x8012F1BC,0x1C asm/non_matchings/code/code_8012EC80/Inventory_GetSkullTokenCount.s,Inventory_GetSkullTokenCount,0x8012F22C,0x13 asm/non_matchings/code/code_8012EC80/Inventory_SaveLotteryCodeGuess.s,Inventory_SaveLotteryCodeGuess,0x8012F278,0x16 -asm/non_matchings/code/z_scene/Object_Spawn.s,Object_Spawn,0x8012F2E0,0x3C -asm/non_matchings/code/z_scene/Object_InitBank.s,Object_InitBank,0x8012F3D0,0x4B -asm/non_matchings/code/z_scene/Object_UpdateBank.s,Object_UpdateBank,0x8012F4FC,0x43 -asm/non_matchings/code/z_scene/Object_GetIndex.s,Object_GetIndex,0x8012F608,0x18 +asm/non_matchings/code/z_scene/Object_SpawnPersistent.s,Object_SpawnPersistent,0x8012F2E0,0x3C +asm/non_matchings/code/z_scene/Object_InitContext.s,Object_InitContext,0x8012F3D0,0x4B +asm/non_matchings/code/z_scene/Object_UpdateEntries.s,Object_UpdateEntries,0x8012F4FC,0x43 +asm/non_matchings/code/z_scene/Object_GetSlot.s,Object_GetSlot,0x8012F608,0x18 asm/non_matchings/code/z_scene/Object_IsLoaded.s,Object_IsLoaded,0x8012F668,0xC asm/non_matchings/code/z_scene/Object_LoadAll.s,Object_LoadAll,0x8012F698,0x29 asm/non_matchings/code/z_scene/func_8012F73C.s,func_8012F73C,0x8012F73C,0x18 @@ -2174,7 +2174,7 @@ asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s,SubS_DrawTransformFl asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s,SubS_DrawTransformFlex,0x8013AB00,0x9B asm/non_matchings/code/z_sub_s/SubS_InCsMode.s,SubS_InCsMode,0x8013AD6C,0xC asm/non_matchings/code/z_sub_s/SubS_UpdateLimb.s,SubS_UpdateLimb,0x8013AD9C,0x4E -asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s,SubS_UpdateFlags,0x8013AED4,0xB +asm/non_matchings/code/z_sub_s/SubS_SetOfferMode.s,SubS_SetOfferMode,0x8013AED4,0xB asm/non_matchings/code/z_sub_s/SubS_TimePathing_FillKnots.s,SubS_TimePathing_FillKnots,0x8013AF00,0x44 asm/non_matchings/code/z_sub_s/SubS_TimePathing_ComputeProgress.s,SubS_TimePathing_ComputeProgress,0x8013B010,0x2E asm/non_matchings/code/z_sub_s/SubS_TimePathing_ComputeWeights.s,SubS_TimePathing_ComputeWeights,0x8013B0C8,0xA2 @@ -2189,7 +2189,7 @@ asm/non_matchings/code/z_sub_s/SubS_GetDayDependentPath.s,SubS_GetDayDependentPa asm/non_matchings/code/z_sub_s/SubS_WeightPathing_ComputePoint.s,SubS_WeightPathing_ComputePoint,0x8013C068,0x16F asm/non_matchings/code/z_sub_s/SubS_WeightPathing_Move.s,SubS_WeightPathing_Move,0x8013C624,0xA5 asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPathCheckBounds.s,SubS_CopyPointFromPathCheckBounds,0x8013C8B8,0x2B -asm/non_matchings/code/z_sub_s/func_8013C964.s,func_8013C964,0x8013C964,0xB2 +asm/non_matchings/code/z_sub_s/SubS_Offer.s,SubS_Offer,0x8013C964,0xB2 asm/non_matchings/code/z_sub_s/SubS_FillShadowTex.s,SubS_FillShadowTex,0x8013CC2C,0x4E asm/non_matchings/code/z_sub_s/SubS_GenShadowTex.s,SubS_GenShadowTex,0x8013CD64,0x68 asm/non_matchings/code/z_sub_s/SubS_DrawShadowTex.s,SubS_DrawShadowTex,0x8013CF04,0x77 @@ -2202,9 +2202,9 @@ asm/non_matchings/code/z_sub_s/SubS_GetDistSqAndOrientPoints.s,SubS_GetDistSqAnd asm/non_matchings/code/z_sub_s/SubS_MoveActorToPoint.s,SubS_MoveActorToPoint,0x8013D768,0x35 asm/non_matchings/code/z_sub_s/SubS_GetDistSqAndOrientPath.s,SubS_GetDistSqAndOrientPath,0x8013D83C,0x28 asm/non_matchings/code/z_sub_s/SubS_IsObjectLoaded.s,SubS_IsObjectLoaded,0x8013D8DC,0x12 -asm/non_matchings/code/z_sub_s/SubS_GetObjectIndex.s,SubS_GetObjectIndex,0x8013D924,0xF +asm/non_matchings/code/z_sub_s/SubS_GetObjectSlot.s,SubS_GetObjectSlot,0x8013D924,0xF asm/non_matchings/code/z_sub_s/SubS_FindActor.s,SubS_FindActor,0x8013D960,0x1A -asm/non_matchings/code/z_sub_s/SubS_FillLimbRotTables.s,SubS_FillLimbRotTables,0x8013D9C8,0x72 +asm/non_matchings/code/z_sub_s/SubS_UpdateFidgetTables.s,SubS_UpdateFidgetTables,0x8013D9C8,0x72 asm/non_matchings/code/z_sub_s/SubS_IsFloorAbove.s,SubS_IsFloorAbove,0x8013DB90,0x2C asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPathList.s,SubS_CopyPointFromPathList,0x8013DC40,0x23 asm/non_matchings/code/z_sub_s/SubS_GetPathCountFromPathList.s,SubS_GetPathCountFromPathList,0x8013DCCC,0x5 @@ -2220,9 +2220,9 @@ asm/non_matchings/code/z_sub_s/SubS_FillCutscenesList.s,SubS_FillCutscenesList,0 asm/non_matchings/code/z_sub_s/SubS_ConstructPlane.s,SubS_ConstructPlane,0x8013E4B0,0x47 asm/non_matchings/code/z_sub_s/SubS_LineSegVsPlane.s,SubS_LineSegVsPlane,0x8013E5CC,0x1D asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s,SubS_FindActorCustom,0x8013E640,0x42 -asm/non_matchings/code/z_sub_s/func_8013E748.s,func_8013E748,0x8013E748,0x1E +asm/non_matchings/code/z_sub_s/SubS_OfferTalkExchangeCustom.s,SubS_OfferTalkExchangeCustom,0x8013E748,0x1E asm/non_matchings/code/z_sub_s/SubS_ActorAndPlayerFaceEachOther.s,SubS_ActorAndPlayerFaceEachOther,0x8013E7C0,0x4E -asm/non_matchings/code/z_sub_s/func_8013E8F8.s,func_8013E8F8,0x8013E8F8,0x16 +asm/non_matchings/code/z_sub_s/SubS_OfferTalkExchangeFacing.s,SubS_OfferTalkExchangeFacing,0x8013E8F8,0x16 asm/non_matchings/code/z_sub_s/SubS_TrackPointStep.s,SubS_TrackPointStep,0x8013E950,0xB0 asm/non_matchings/code/code_8013EC10/Rumble_Update.s,Rumble_Update,0x8013EC10,0xD asm/non_matchings/code/code_8013EC10/Rumble_Override.s,Rumble_Override,0x8013EC44,0x27 @@ -2334,59 +2334,59 @@ asm/non_matchings/code/z_sram_NES/Sram_UpdateWriteToFlashOwlSave.s,Sram_UpdateWr asm/non_matchings/code/z_sram_NES/func_80147314.s,func_80147314,0x80147314,0x40 asm/non_matchings/code/z_sram_NES/func_80147414.s,func_80147414,0x80147414,0x3E asm/non_matchings/code/z_sram_NES/Sram_nop8014750C.s,Sram_nop8014750C,0x8014750C,0x5 -asm/non_matchings/code/z_message/func_80147520.s,func_80147520,0x80147520,0x11 -asm/non_matchings/code/z_message/func_80147564.s,func_80147564,0x80147564,0x30 +asm/non_matchings/code/z_message/Message_ResetOcarinaButtonAlphas.s,Message_ResetOcarinaButtonAlphas,0x80147520,0x11 +asm/non_matchings/code/z_message/Message_ResetOcarinaButtonState.s,Message_ResetOcarinaButtonState,0x80147564,0x30 asm/non_matchings/code/z_message/Message_ShouldAdvance.s,Message_ShouldAdvance,0x80147624,0x44 asm/non_matchings/code/z_message/Message_ShouldAdvanceSilent.s,Message_ShouldAdvanceSilent,0x80147734,0x20 asm/non_matchings/code/z_message/Message_CloseTextbox.s,Message_CloseTextbox,0x801477B4,0x19 -asm/non_matchings/code/z_message/func_80147818.s,func_80147818,0x80147818,0x1C0 +asm/non_matchings/code/z_message/Message_DrawTextboxIcon.s,Message_DrawTextboxIcon,0x80147818,0x1C0 asm/non_matchings/code/z_message/func_80147F18.s,func_80147F18,0x80147F18,0x190 asm/non_matchings/code/z_message/func_80148558.s,func_80148558,0x80148558,0x190 -asm/non_matchings/code/z_message/func_80148B98.s,func_80148B98,0x80148B98,0x49 +asm/non_matchings/code/z_message/Message_HandleChoiceSelection.s,Message_HandleChoiceSelection,0x80148B98,0x49 asm/non_matchings/code/z_message/func_80148CBC.s,func_80148CBC,0x80148CBC,0x2A asm/non_matchings/code/z_message/func_80148D64.s,func_80148D64,0x80148D64,0xB9 asm/non_matchings/code/z_message/func_80149048.s,func_80149048,0x80149048,0x65 asm/non_matchings/code/z_message/func_801491DC.s,func_801491DC,0x801491DC,0x9E asm/non_matchings/code/z_message/func_80149454.s,func_80149454,0x80149454,0x9D asm/non_matchings/code/z_message/func_801496C8.s,func_801496C8,0x801496C8,0xA5 -asm/non_matchings/code/z_message/func_8014995C.s,func_8014995C,0x8014995C,0xAF -asm/non_matchings/code/z_message/func_80149C18.s,func_80149C18,0x80149C18,0xA9 +asm/non_matchings/code/z_message/Message_DrawTextChar.s,Message_DrawTextChar,0x8014995C,0xAF +asm/non_matchings/code/z_message/Message_GrowTextbox.s,Message_GrowTextbox,0x80149C18,0xA9 asm/non_matchings/code/z_message/Message_FindMessage.s,Message_FindMessage,0x80149EBC,0x2E -asm/non_matchings/code/z_message/func_80149F74.s,func_80149F74,0x80149F74,0x2D7 -asm/non_matchings/code/z_message/func_8014AAD0.s,func_8014AAD0,0x8014AAD0,0xBB -asm/non_matchings/code/z_message/func_8014ADBC.s,func_8014ADBC,0x8014ADBC,0x654 -asm/non_matchings/code/z_message/func_8014C70C.s,func_8014C70C,0x8014C70C,0x142 +asm/non_matchings/code/z_message/Message_DrawItemIcon.s,Message_DrawItemIcon,0x80149F74,0x2D7 +asm/non_matchings/code/z_message/Message_HandleOcarina.s,Message_HandleOcarina,0x8014AAD0,0xBB +asm/non_matchings/code/z_message/Message_DrawTextDefault.s,Message_DrawTextDefault,0x8014ADBC,0x654 +asm/non_matchings/code/z_message/Message_LoadItemIcon.s,Message_LoadItemIcon,0x8014C70C,0x142 asm/non_matchings/code/z_message/Message_LoadChar.s,Message_LoadChar,0x8014CC14,0x28 asm/non_matchings/code/z_message/func_8014CCB4.s,func_8014CCB4,0x8014CCB4,0x4F -asm/non_matchings/code/z_message/func_8014CDF0.s,func_8014CDF0,0x8014CDF0,0x7B -asm/non_matchings/code/z_message/func_8014CFDC.s,func_8014CFDC,0x8014CFDC,0xCA -asm/non_matchings/code/z_message/func_8014D304.s,func_8014D304,0x8014D304,0xCA -asm/non_matchings/code/z_message/func_8014D62C.s,func_8014D62C,0x8014D62C,0x62 -asm/non_matchings/code/z_message/func_8014D7B4.s,func_8014D7B4,0x8014D7B4,0xCB4 +asm/non_matchings/code/z_message/Message_GetTimerDigits.s,Message_GetTimerDigits,0x8014CDF0,0x7B +asm/non_matchings/code/z_message/Message_SetupLoadItemIcon.s,Message_SetupLoadItemIcon,0x8014CFDC,0xCA +asm/non_matchings/code/z_message/Message_LoadTime.s,Message_LoadTime,0x8014D304,0xCA +asm/non_matchings/code/z_message/Message_LoadOwlWarpText.s,Message_LoadOwlWarpText,0x8014D62C,0x62 +asm/non_matchings/code/z_message/Message_Decode.s,Message_Decode,0x8014D7B4,0xCB4 asm/non_matchings/code/z_message/func_80150A84.s,func_80150A84,0x80150A84,0xA1 -asm/non_matchings/code/z_message/func_80150D08.s,func_80150D08,0x80150D08,0x1EA +asm/non_matchings/code/z_message/Message_OpenText.s,Message_OpenText,0x80150D08,0x1EA asm/non_matchings/code/z_message/func_801514B0.s,func_801514B0,0x801514B0,0x100 asm/non_matchings/code/z_message/Message_StartTextbox.s,Message_StartTextbox,0x801518B0,0x22 asm/non_matchings/code/z_message/Message_ContinueTextbox.s,Message_ContinueTextbox,0x80151938,0x4C -asm/non_matchings/code/z_message/func_80151A68.s,func_80151A68,0x80151A68,0x53 +asm/non_matchings/code/z_message/Message_DisplaySceneTitleCard.s,Message_DisplaySceneTitleCard,0x80151A68,0x53 asm/non_matchings/code/z_message/Message_BombersNotebookQueueEvent.s,Message_BombersNotebookQueueEvent,0x80151BB4,0x3A -asm/non_matchings/code/z_message/func_80151C9C.s,func_80151C9C,0x80151C9C,0x42 -asm/non_matchings/code/z_message/func_80151DA4.s,func_80151DA4,0x80151DA4,0x1A4 -asm/non_matchings/code/z_message/func_80152434.s,func_80152434,0x80152434,0xC -asm/non_matchings/code/z_message/func_80152464.s,func_80152464,0x80152464,0xD +asm/non_matchings/code/z_message/Message_BombersNotebookProcessEventQueue.s,func_80151C9C,0x80151C9C,0x42 +asm/non_matchings/code/z_message/Message_DisplayOcarinaStaffImpl.s,Message_DisplayOcarinaStaffImpl,0x80151DA4,0x1A4 +asm/non_matchings/code/z_message/Message_DisplayOcarinaStaff.s,Message_DisplayOcarinaStaff,0x80152434,0xC +asm/non_matchings/code/z_message/Message_DisplayOcarinaStaffBlockSunsSong.s,Message_DisplayOcarinaStaffBlockSunsSong,0x80152464,0xD asm/non_matchings/code/z_message/Message_GetState.s,Message_GetState,0x80152498,0x7D -asm/non_matchings/code/z_message/func_8015268C.s,func_8015268C,0x8015268C,0x176 -asm/non_matchings/code/z_message/func_80152C64.s,func_80152C64,0x80152C64,0x12 +asm/non_matchings/code/z_message/Message_DrawTextBox.s,Message_DrawTextBox,0x8015268C,0x176 +asm/non_matchings/code/z_message/Message_SetView.s,Message_SetView,0x80152C64,0x12 asm/non_matchings/code/z_message/func_80152CAC.s,func_80152CAC,0x80152CAC,0x85 -asm/non_matchings/code/z_message/func_80152EC0.s,func_80152EC0,0x80152EC0,0x3E -asm/non_matchings/code/z_message/func_80152FB8.s,func_80152FB8,0x80152FB8,0x1E6 -asm/non_matchings/code/z_message/func_80153750.s,func_80153750,0x80153750,0x1CB -asm/non_matchings/code/z_message/func_80153E7C.s,func_80153E7C,0x80153E7C,0x1D -asm/non_matchings/code/z_message/func_80153EF0.s,func_80153EF0,0x80153EF0,0xB9 -asm/non_matchings/code/z_message/func_801541D4.s,func_801541D4,0x801541D4,0x961 +asm/non_matchings/code/z_message/Message_SpawnSongEffect.s,Message_SpawnSongEffect,0x80152EC0,0x3E +asm/non_matchings/code/z_message/Message_FlashOcarinaButtons.s,Message_FlashOcarinaButtons,0x80152FB8,0x1E6 +asm/non_matchings/code/z_message/Message_DrawOcarinaButtons.s,Message_DrawOcarinaButtons,0x80153750,0x1CB +asm/non_matchings/code/z_message/Message_DrawText.s,Message_DrawText,0x80153E7C,0x1D +asm/non_matchings/code/z_message/Message_DrawSceneTitleCard.s,Message_DrawSceneTitleCard,0x80153EF0,0xB9 +asm/non_matchings/code/z_message/Message_DrawMain.s,Message_DrawMain,0x801541D4,0x961 asm/non_matchings/code/z_message/Message_Draw.s,Message_Draw,0x80156758,0x2D asm/non_matchings/code/z_message/Message_Update.s,Message_Update,0x8015680C,0x7A6 -asm/non_matchings/code/z_message/func_801586A4.s,func_801586A4,0x801586A4,0xC +asm/non_matchings/code/z_message/Message_SetTables.s,Message_SetTables,0x801586A4,0xC asm/non_matchings/code/z_message/Message_Init.s,Message_Init,0x801586D4,0x7F asm/non_matchings/code/z_message_nes/Message_FindMessageNES.s,Message_FindMessageNES,0x801588D0,0x2E asm/non_matchings/code/z_message_nes/Message_LoadCharNES.s,Message_LoadCharNES,0x80158988,0x27 @@ -2395,12 +2395,12 @@ asm/non_matchings/code/z_message_nes/Message_LoadLocalizedRupeesNES.s,Message_Lo asm/non_matchings/code/z_message_nes/Message_LoadRupeesNES.s,Message_LoadRupeesNES,0x80158D98,0x86 asm/non_matchings/code/z_message_nes/Message_LoadTimeNES.s,Message_LoadTimeNES,0x80158FB0,0xAF asm/non_matchings/code/z_message_nes/Message_LoadOwlWarpTextNES.s,Message_LoadOwlWarpTextNES,0x8015926C,0x73 -asm/non_matchings/code/z_message_nes/func_80159438.s,func_80159438,0x80159438,0x8D -asm/non_matchings/code/z_message_nes/func_8015966C.s,func_8015966C,0x8015966C,0x6CB -asm/non_matchings/code/z_message_nes/func_8015B198.s,func_8015B198,0x8015B198,0xD6E +asm/non_matchings/code/z_message_nes/Message_GetTimerDigitsNES.s,Message_GetTimerDigitsNES,0x80159438,0x8D +asm/non_matchings/code/z_message_nes/Message_DrawTextNES.s,Message_DrawTextNES,0x8015966C,0x6CB +asm/non_matchings/code/z_message_nes/Message_DecodeNES.s,Message_DecodeNES,0x8015B198,0xD6E asm/non_matchings/code/z_message_staff/Message_FindCreditsMessage.s,Message_FindCreditsMessage,0x8015E750,0x27 -asm/non_matchings/code/z_message_staff/func_8015E7EC.s,func_8015E7EC,0x8015E7EC,0x42F -asm/non_matchings/code/z_message_staff/func_8015F8A8.s,func_8015F8A8,0x8015F8A8,0x47A +asm/non_matchings/code/z_message_staff/Message_DrawTextCredits.s,Message_DrawTextCredits,0x8015E7EC,0x42F +asm/non_matchings/code/z_message_staff/Message_DecodeCredits.s,Message_DecodeCredits,0x8015F8A8,0x47A asm/non_matchings/code/z_player_call/PlayerCall_InitFuncPtrs.s,PlayerCall_InitFuncPtrs,0x80160A90,0x1A asm/non_matchings/code/z_player_call/PlayerCall_Init.s,PlayerCall_Init,0x80160AF8,0x12 asm/non_matchings/code/z_player_call/PlayerCall_Destroy.s,PlayerCall_Destroy,0x80160B40,0x10 @@ -2571,28 +2571,28 @@ asm/non_matchings/code/PreRender/PreRender_SetValuesSave.s,PreRender_SetValuesSa asm/non_matchings/code/PreRender/PreRender_Init.s,PreRender_Init,0x8016FD2C,0xD asm/non_matchings/code/PreRender/PreRender_SetValues.s,PreRender_SetValues,0x8016FD60,0xD asm/non_matchings/code/PreRender/PreRender_Destroy.s,PreRender_Destroy,0x8016FD94,0x9 -asm/non_matchings/code/PreRender/func_8016FDB8.s,func_8016FDB8,0x8016FDB8,0x6E -asm/non_matchings/code/PreRender/func_8016FF70.s,func_8016FF70,0x8016FF70,0x8 +asm/non_matchings/code/PreRender/PreRender_CopyImage.s,PreRender_CopyImage,0x8016FDB8,0x6E +asm/non_matchings/code/PreRender/PreRender_RestoreBuffer.s,PreRender_RestoreBuffer,0x8016FF70,0x8 asm/non_matchings/code/PreRender/func_8016FF90.s,func_8016FF90,0x8016FF90,0x9C asm/non_matchings/code/PreRender/func_80170200.s,func_80170200,0x80170200,0xF -asm/non_matchings/code/PreRender/func_8017023C.s,func_8017023C,0x8017023C,0xD0 -asm/non_matchings/code/PreRender/func_8017057C.s,func_8017057C,0x8017057C,0xE -asm/non_matchings/code/PreRender/func_801705B4.s,func_801705B4,0x801705B4,0xE -asm/non_matchings/code/PreRender/func_801705EC.s,func_801705EC,0x801705EC,0x51 -asm/non_matchings/code/PreRender/func_80170730.s,func_80170730,0x80170730,0x11 -asm/non_matchings/code/PreRender/func_80170774.s,func_80170774,0x80170774,0x9 +asm/non_matchings/code/PreRender/PreRender_CoverageRgba16ToI8.s,PreRender_CoverageRgba16ToI8,0x8017023C,0xD0 +asm/non_matchings/code/PreRender/PreRender_SaveZBuffer.s,PreRender_SaveZBuffer,0x8017057C,0xE +asm/non_matchings/code/PreRender/PreRender_SaveFramebuffer.s,PreRender_SaveFramebuffer,0x801705B4,0xE +asm/non_matchings/code/PreRender/PreRender_FetchFbufCoverage.s,PreRender_FetchFbufCoverage,0x801705EC,0x51 +asm/non_matchings/code/PreRender/PreRender_DrawCoverage.s,PreRender_DrawCoverage,0x80170730,0x11 +asm/non_matchings/code/PreRender/PreRender_RestoreZBuffer.s,PreRender_RestoreZBuffer,0x80170774,0x9 asm/non_matchings/code/PreRender/func_80170798.s,func_80170798,0x80170798,0xD2 asm/non_matchings/code/PreRender/func_80170AE0.s,func_80170AE0,0x80170AE0,0x12 -asm/non_matchings/code/PreRender/func_80170B28.s,func_80170B28,0x80170B28,0x9 -asm/non_matchings/code/PreRender/PreRender_AntiAliasAlgorithm.s,PreRender_AntiAliasAlgorithm,0x80170B4C,0x2B0 -asm/non_matchings/code/PreRender/PreRender_ApplyAntiAliasingFilter.s,PreRender_ApplyAntiAliasingFilter,0x8017160C,0x2E -asm/non_matchings/code/PreRender/func_801716C4.s,func_801716C4,0x801716C4,0x4D -asm/non_matchings/code/PreRender/func_801717F8.s,func_801717F8,0x801717F8,0x1D5 +asm/non_matchings/code/PreRender/PreRender_RestoreFramebuffer.s,PreRender_RestoreFramebuffer,0x80170B28,0x9 +asm/non_matchings/code/PreRender/PreRender_AntiAliasFilterPixel.s,PreRender_AntiAliasFilterPixel,0x80170B4C,0x2B0 +asm/non_matchings/code/PreRender/PreRender_AntiAliasFilter.s,PreRender_AntiAliasFilter,0x8017160C,0x2E +asm/non_matchings/code/PreRender/PreRender_Get5bMedian9.s,PreRender_Get5bMedian9,0x801716C4,0x4D +asm/non_matchings/code/PreRender/PreRender_DivotFilter.s,PreRender_DivotFilter,0x801717F8,0x1D5 asm/non_matchings/code/PreRender/PreRender_ApplyFilters.s,PreRender_ApplyFilters,0x80171F4C,0x17 asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyInit.s,PreRender_ApplyFiltersSlowlyInit,0x80171FA8,0x34 asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyDestroy.s,PreRender_ApplyFiltersSlowlyDestroy,0x80172078,0x13 asm/non_matchings/code/PreRender/func_801720C4.s,func_801720C4,0x801720C4,0xE -asm/non_matchings/code/PreRender/func_801720FC.s,func_801720FC,0x801720FC,0x197 +asm/non_matchings/code/PreRender/Prerender_DrawBackground2DImpl.s,Prerender_DrawBackground2DImpl,0x801720FC,0x197 asm/non_matchings/code/PreRender/Prerender_DrawBackground2D.s,Prerender_DrawBackground2D,0x80172758,0x26 asm/non_matchings/code/TwoHeadGfxArena/THGA_Init.s,THGA_Init,0x801727F0,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_Destroy.s,THGA_Destroy,0x80172810,0x8 @@ -2624,9 +2624,9 @@ asm/non_matchings/code/TwoHeadArena/THA_Reset.s,THA_Reset,0x80172B3C,0x7 asm/non_matchings/code/TwoHeadArena/THA_Init.s,THA_Init,0x80172B58,0x11 asm/non_matchings/code/TwoHeadArena/THA_Destroy.s,THA_Destroy,0x80172B9C,0x9 asm/non_matchings/code/audio_stop_all_sfx/AudioMgr_StopAllSfxExceptSystem.s,AudioMgr_StopAllSfxExceptSystem,0x80172BC0,0x1C -asm/non_matchings/code/audio_thread_manager/func_80172C30.s,func_80172C30,0x80172C30,0xE +asm/non_matchings/code/audio_thread_manager/AudioMgr_NotifyTaskDone.s,AudioMgr_NotifyTaskDone,0x80172C30,0xE asm/non_matchings/code/audio_thread_manager/AudioMgr_HandleRetrace.s,AudioMgr_HandleRetrace,0x80172C68,0x91 -asm/non_matchings/code/audio_thread_manager/AudioMgr_HandlePRENMI.s,AudioMgr_HandlePRENMI,0x80172EAC,0x9 +asm/non_matchings/code/audio_thread_manager/AudioMgr_HandlePreNMI.s,AudioMgr_HandlePreNMI,0x80172EAC,0x9 asm/non_matchings/code/audio_thread_manager/AudioMgr_ThreadEntry.s,AudioMgr_ThreadEntry,0x80172ED0,0x5E asm/non_matchings/code/audio_thread_manager/AudioMgr_Unlock.s,AudioMgr_Unlock,0x80173048,0xB asm/non_matchings/code/audio_thread_manager/AudioMgr_Init.s,AudioMgr_Init,0x80173074,0x2F @@ -2634,16 +2634,16 @@ asm/non_matchings/code/title_setup/Setup_SetRegs.s,Setup_SetRegs,0x80173130,0x6B asm/non_matchings/code/title_setup/Setup_InitImpl.s,Setup_InitImpl,0x801732DC,0x14 asm/non_matchings/code/title_setup/Setup_Destroy.s,Setup_Destroy,0x8017332C,0x3 asm/non_matchings/code/title_setup/Setup_Init.s,Setup_Init,0x80173338,0xA -asm/non_matchings/code/game/Game_UpdateFramerateVariables.s,Game_UpdateFramerateVariables,0x80173360,0x12 -asm/non_matchings/code/game/Game_SetFramerateDivisor.s,Game_SetFramerateDivisor,0x801733A8,0xD +asm/non_matchings/code/game/GameState_UpdateFramerateDivisors.s,GameState_UpdateFramerateDivisors,0x80173360,0x12 +asm/non_matchings/code/game/GameState_SetFramerateDivisor.s,GameState_SetFramerateDivisor,0x801733A8,0xD asm/non_matchings/code/game/GameState_SetFBFilter.s,GameState_SetFBFilter,0x801733DC,0x56 -asm/non_matchings/code/game/Game_Nop80173534.s,Game_Nop80173534,0x80173534,0x3 +asm/non_matchings/code/game/GameState_Noop.s,GameState_Noop,0x80173534,0x3 asm/non_matchings/code/game/GameState_Draw.s,GameState_Draw,0x80173540,0x41 asm/non_matchings/code/game/Game_ResetSegments.s,Game_ResetSegments,0x80173644,0x26 -asm/non_matchings/code/game/func_801736DC.s,func_801736DC,0x801736DC,0x1E -asm/non_matchings/code/game/Game_UpdateInput.s,Game_UpdateInput,0x80173754,0xA -asm/non_matchings/code/game/Game_Update.s,Game_Update,0x8017377C,0x1A -asm/non_matchings/code/game/Game_IncrementFrameCount.s,Game_IncrementFrameCount,0x801737E4,0xB +asm/non_matchings/code/game/GameState_DrawEnd.s,GameState_DrawEnd,0x801736DC,0x1E +asm/non_matchings/code/game/GameState_GetInput.s,GameState_GetInput,0x80173754,0xA +asm/non_matchings/code/game/GameState_Update.s,GameState_Update,0x8017377C,0x1A +asm/non_matchings/code/game/GameState_IncrementFrameCount.s,GameState_IncrementFrameCount,0x801737E4,0xB asm/non_matchings/code/game/Game_InitHeap.s,Game_InitHeap,0x80173810,0x1C asm/non_matchings/code/game/Game_ResizeHeap.s,Game_ResizeHeap,0x80173880,0x34 asm/non_matchings/code/game/GameState_Init.s,GameState_Init,0x80173950,0x40 @@ -2729,12 +2729,12 @@ asm/non_matchings/code/sched/Sched_SendGfxCancelMsg.s,Sched_SendGfxCancelMsg,0x8 asm/non_matchings/code/sched/Sched_FaultClient.s,Sched_FaultClient,0x80177084,0x36 asm/non_matchings/code/sched/Sched_ThreadEntry.s,Sched_ThreadEntry,0x8017715C,0x51 asm/non_matchings/code/sched/Sched_Init.s,Sched_Init,0x801772A0,0x3C -asm/non_matchings/code/speed_meter/func_80177390.s,func_80177390,0x80177390,0x4 -asm/non_matchings/code/speed_meter/func_801773A0.s,func_801773A0,0x801773A0,0x9 -asm/non_matchings/code/speed_meter/func_801773C4.s,func_801773C4,0x801773C4,0x3 +asm/non_matchings/code/speed_meter/SpeedMeter_InitImpl.s,SpeedMeter_InitImpl,0x80177390,0x4 +asm/non_matchings/code/speed_meter/SpeedMeter_Init.s,SpeedMeter_Init,0x801773A0,0x9 +asm/non_matchings/code/speed_meter/SpeedMeter_Destroy.s,SpeedMeter_Destroy,0x801773C4,0x3 asm/non_matchings/code/speed_meter/SpeedMeter_DrawTimeEntries.s,SpeedMeter_DrawTimeEntries,0x801773D0,0x1AD -asm/non_matchings/code/speed_meter/func_80177A84.s,func_80177A84,0x80177A84,0x11 -asm/non_matchings/code/speed_meter/func_80177AC8.s,func_80177AC8,0x80177AC8,0xE4 +asm/non_matchings/code/speed_meter/SpeedMeter_InitAllocEntry.s,SpeedMeter_InitAllocEntry,0x80177A84,0x11 +asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntry.s,SpeedMeter_DrawAllocEntry,0x80177AC8,0xE4 asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntries.s,SpeedMeter_DrawAllocEntries,0x80177E58,0xA6 asm/non_matchings/code/speed_meter/func_801780F0.s,func_801780F0,0x801780F0,0x3F asm/non_matchings/code/speed_meter/func_801781EC.s,func_801781EC,0x801781EC,0x90 @@ -3274,16 +3274,16 @@ asm/non_matchings/code/audio_playback/AudioPlayback_AllocNoteFromDecaying.s,Audi asm/non_matchings/code/audio_playback/AudioPlayback_AllocNoteFromActive.s,AudioPlayback_AllocNoteFromActive,0x801964F8,0x3E asm/non_matchings/code/audio_playback/AudioPlayback_AllocNote.s,AudioPlayback_AllocNote,0x801965F0,0xB5 asm/non_matchings/code/audio_playback/AudioPlayback_NoteInitAll.s,AudioPlayback_NoteInitAll,0x801968C4,0x4F -asm/non_matchings/code/audio_effects/AudioEffects_SequenceChannelProcessSound.s,AudioEffects_SequenceChannelProcessSound,0x80196A00,0x72 -asm/non_matchings/code/audio_effects/AudioEffects_SequencePlayerProcessSound.s,AudioEffects_SequencePlayerProcessSound,0x80196BC8,0x56 -asm/non_matchings/code/audio_effects/AudioEffects_GetPortamentoFreqScale.s,AudioEffects_GetPortamentoFreqScale,0x80196D20,0x17 +asm/non_matchings/code/audio_effects/AudioScript_SequenceChannelProcessSound.s,AudioScript_SequenceChannelProcessSound,0x80196A00,0x72 +asm/non_matchings/code/audio_effects/AudioScript_SequencePlayerProcessSound.s,AudioScript_SequencePlayerProcessSound,0x80196BC8,0x56 +asm/non_matchings/code/audio_effects/AudioEffects_UpdatePortamento.s,AudioEffects_UpdatePortamento,0x80196D20,0x17 asm/non_matchings/code/audio_effects/AudioEffects_GetVibratoPitchChange.s,AudioEffects_GetVibratoPitchChange,0x80196D7C,0xE -asm/non_matchings/code/audio_effects/AudioEffects_GetVibratoFreqScale.s,AudioEffects_GetVibratoFreqScale,0x80196DB4,0x8E -asm/non_matchings/code/audio_effects/AudioEffects_NoteVibratoUpdate.s,AudioEffects_NoteVibratoUpdate,0x80196FEC,0x17 -asm/non_matchings/code/audio_effects/AudioEffects_NoteVibratoInit.s,AudioEffects_NoteVibratoInit,0x80197048,0x3C -asm/non_matchings/code/audio_effects/AudioEffects_NotePortamentoInit.s,AudioEffects_NotePortamentoInit,0x80197138,0xB -asm/non_matchings/code/audio_effects/AudioEffects_AdsrInit.s,AudioEffects_AdsrInit,0x80197164,0x9 -asm/non_matchings/code/audio_effects/AudioEffects_AdsrUpdate.s,AudioEffects_AdsrUpdate,0x80197188,0xD2 +asm/non_matchings/code/audio_effects/AudioEffects_UpdateVibrato.s,AudioEffects_UpdateVibrato,0x80196DB4,0x8E +asm/non_matchings/code/audio_effects/AudioEffects_UpdatePortamentoAndVibrato.s,AudioEffects_UpdatePortamentoAndVibrato,0x80196FEC,0x17 +asm/non_matchings/code/audio_effects/AudioEffects_InitVibrato.s,AudioEffects_InitVibrato,0x80197048,0x3C +asm/non_matchings/code/audio_effects/AudioEffects_InitPortamento.s,AudioEffects_InitPortamento,0x80197138,0xB +asm/non_matchings/code/audio_effects/AudioEffects_InitAdsr.s,AudioEffects_InitAdsr,0x80197164,0x9 +asm/non_matchings/code/audio_effects/AudioEffects_UpdateAdsr.s,AudioEffects_UpdateAdsr,0x80197188,0xD2 asm/non_matchings/code/audio_seqplayer/AudioScript_GetScriptControlFlowArgument.s,AudioScript_GetScriptControlFlowArgument,0x801974D0,0x1A asm/non_matchings/code/audio_seqplayer/AudioScript_HandleScriptFlowControl.s,AudioScript_HandleScriptFlowControl,0x80197538,0x77 asm/non_matchings/code/audio_seqplayer/AudioScript_InitSequenceChannel.s,AudioScript_InitSequenceChannel,0x80197714,0x5B @@ -3384,40 +3384,40 @@ asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeCombFilter.s,AudioSfx_Compu 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/Audio_PlaySfx.s,Audio_PlaySfx,0x8019F0C8,0x18 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_2.s,Audio_PlaySfx_2,0x8019F128,0x12 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb.s,Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb,0x8019F170,0x14 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPos.s,Audio_PlaySfx_AtPos,0x8019F1C0,0x12 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_MessageDecide.s,Audio_PlaySfx_MessageDecide,0x8019F208,0xA +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_MessageCancel.s,Audio_PlaySfx_MessageCancel,0x8019F230,0xA 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/Audio_PlaySfx_Underwater.s,Audio_PlaySfx_Underwater,0x8019F420,0x23 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_WithSfxSettingsReverb.s,Audio_PlaySfx_WithSfxSettingsReverb,0x8019F4AC,0x25 +asm/non_matchings/code/code_8019AF00/Audio_SetSfxUnderwaterReverb.s,Audio_SetSfxUnderwaterReverb,0x8019F540,0xC 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 -asm/non_matchings/code/code_8019AF00/func_8019F7D8.s,func_8019F7D8,0x8019F7D8,0x16 -asm/non_matchings/code/code_8019AF00/func_8019F830.s,func_8019F830,0x8019F830,0x17 -asm/non_matchings/code/code_8019AF00/func_8019F88C.s,func_8019F88C,0x8019F88C,0x1D -asm/non_matchings/code/code_8019AF00/func_8019F900.s,func_8019F900,0x8019F900,0x46 -asm/non_matchings/code/code_8019AF00/func_8019FA18.s,func_8019FA18,0x8019FA18,0x30 -asm/non_matchings/code/code_8019AF00/func_8019FAD8.s,func_8019FAD8,0x8019FAD8,0xD -asm/non_matchings/code/code_8019AF00/func_8019FB0C.s,func_8019FB0C,0x8019FB0C,0x45 -asm/non_matchings/code/code_8019AF00/func_8019FC20.s,func_8019FC20,0x8019FC20,0x26 -asm/non_matchings/code/code_8019AF00/func_8019FCB8.s,func_8019FCB8,0x8019FCB8,0x36 -asm/non_matchings/code/code_8019AF00/func_8019FD90.s,func_8019FD90,0x8019FD90,0xE -asm/non_matchings/code/code_8019AF00/func_8019FDC8.s,func_8019FDC8,0x8019FDC8,0x15 -asm/non_matchings/code/code_8019AF00/func_8019FE1C.s,func_8019FE1C,0x8019FE1C,0x16 -asm/non_matchings/code/code_8019AF00/func_8019FE74.s,func_8019FE74,0x8019FE74,0x1A -asm/non_matchings/code/code_8019AF00/func_8019FEDC.s,func_8019FEDC,0x8019FEDC,0x17 -asm/non_matchings/code/code_8019AF00/func_8019FF38.s,func_8019FF38,0x8019FF38,0x19 -asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForRiver.s,Audio_PlaySfxForRiver,0x8019FF9C,0x2B -asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForWaterfall.s,Audio_PlaySfxForWaterfall,0x801A0048,0x29 +asm/non_matchings/code/code_8019AF00/Audio_SetSyncedSfxFreqAndVolume.s,Audio_SetSyncedSfxFreqAndVolume,0x8019F5AC,0x23 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume.s,Audio_PlaySfx_AtPosForMetalEffectsWithSyncedFreqAndVolume,0x8019F638,0x52 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithSyncedFreqAndVolume.s,Audio_PlaySfx_AtPosWithSyncedFreqAndVolume,0x8019F780,0x16 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_GiantsMaskUnused.s,Audio_PlaySfx_GiantsMaskUnused,0x8019F7D8,0x16 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_GiantsMask.s,Audio_PlaySfx_GiantsMask,0x8019F830,0x17 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_Randomized.s,Audio_PlaySfx_Randomized,0x8019F88C,0x1D +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_SwordCharge.s,Audio_PlaySfx_SwordCharge,0x8019F900,0x46 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithFreqAndVolume.s,Audio_PlaySfx_AtPosWithFreqAndVolume,0x8019FA18,0x30 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithFreq.s,Audio_PlaySfx_AtPosWithFreq,0x8019FAD8,0xD +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithFreqAndChannelIO.s,Audio_PlaySfx_AtPosWithFreqAndChannelIO,0x8019FB0C,0x45 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_WaterWheel.s,Audio_PlaySfx_WaterWheel,0x8019FC20,0x26 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithTimer.s,Audio_PlaySfx_AtPosWithTimer,0x8019FCB8,0x36 +asm/non_matchings/code/code_8019AF00/Audio_SetSfxTimerLerpInterval.s,Audio_SetSfxTimerLerpInterval,0x8019FD90,0xE +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithReverb.s,Audio_PlaySfx_AtPosWithReverb,0x8019FDC8,0x15 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithVolume.s,Audio_PlaySfx_AtPosWithVolume,0x8019FE1C,0x16 +asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeTransition.s,Audio_SetSfxVolumeTransition,0x8019FE74,0x1A +asm/non_matchings/code/code_8019AF00/Audio_UpdateSfxVolumeTransition.s,Audio_UpdateSfxVolumeTransition,0x8019FEDC,0x17 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_FishingReel.s,Audio_PlaySfx_FishingReel,0x8019FF38,0x19 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_River.s,Audio_PlaySfx_River,0x8019FF9C,0x2B +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_Waterfall.s,Audio_PlaySfx_Waterfall,0x801A0048,0x29 asm/non_matchings/code/code_8019AF00/Audio_StepFreqLerp.s,Audio_StepFreqLerp,0x801A00EC,0xE -asm/non_matchings/code/code_8019AF00/func_801A0124.s,func_801A0124,0x801A0124,0x18 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_BigBells.s,Audio_PlaySfx_BigBells,0x801A0124,0x18 asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOff.s,Audio_SetBgmVolumeOff,0x801A0184,0x10 asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOn.s,Audio_SetBgmVolumeOn,0x801A01C4,0x10 asm/non_matchings/code/code_8019AF00/func_801A0204.s,func_801A0204,0x801A0204,0xD @@ -3426,32 +3426,32 @@ asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolumeLevel.s,Audio_ asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolume.s,Audio_SetGanonsTowerBgmVolume,0x801A0318,0x4E asm/non_matchings/code/code_8019AF00/Audio_LowerMainBgmVolume.s,Audio_LowerMainBgmVolume,0x801A0450,0x7 asm/non_matchings/code/code_8019AF00/Audio_UpdateRiverSoundVolumes.s,Audio_UpdateRiverSoundVolumes,0x801A046C,0x3A -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/Audio_PlaySfx_IncreasinglyTransposed.s,Audio_PlaySfx_IncreasinglyTransposed,0x801A0554,0x24 +asm/non_matchings/code/code_8019AF00/Audio_ResetIncreasingTranspose.s,Audio_ResetIncreasingTranspose,0x801A05E4,0x3 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_Transposed.s,Audio_PlaySfx_Transposed,0x801A05F0,0x19 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/Audio_PlaySfx_AtPosWithChannelIO.s,Audio_PlaySfx_AtPosWithChannelIO,0x801A0810,0x16 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithAllChannelsIO.s,Audio_PlaySfx_AtPosWithAllChannelsIO,0x801A0868,0x5B asm/non_matchings/code/code_8019AF00/func_801A09D4.s,func_801A09D4,0x801A09D4,0xA7 asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm.s,Audio_ClearSariaBgm,0x801A0C70,0x8 asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgmAtPos.s,Audio_ClearSariaBgmAtPos,0x801A0C90,0x8 asm/non_matchings/code/code_8019AF00/Audio_SplitBgmChannels.s,Audio_SplitBgmChannels,0x801A0CB0,0x65 -asm/non_matchings/code/code_8019AF00/func_801A0E44.s,func_801A0E44,0x801A0E44,0x113 -asm/non_matchings/code/code_8019AF00/func_801A1290.s,func_801A1290,0x801A1290,0x2E -asm/non_matchings/code/code_8019AF00/func_801A1348.s,func_801A1348,0x801A1348,0x1D -asm/non_matchings/code/code_8019AF00/func_801A13BC.s,func_801A13BC,0x801A13BC,0x60 -asm/non_matchings/code/code_8019AF00/func_801A153C.s,func_801A153C,0x801A153C,0xAE -asm/non_matchings/code/code_8019AF00/func_801A17F4.s,func_801A17F4,0x801A17F4,0x44 -asm/non_matchings/code/code_8019AF00/func_801A1904.s,func_801A1904,0x801A1904,0x43 -asm/non_matchings/code/code_8019AF00/func_801A1A10.s,func_801A1A10,0x801A1A10,0x1F -asm/non_matchings/code/code_8019AF00/func_801A1A8C.s,func_801A1A8C,0x801A1A8C,0xAE -asm/non_matchings/code/code_8019AF00/func_801A1D44.s,func_801A1D44,0x801A1D44,0x1D -asm/non_matchings/code/code_8019AF00/func_801A1DB8.s,func_801A1DB8,0x801A1DB8,0x15 -asm/non_matchings/code/code_8019AF00/func_801A1E0C.s,func_801A1E0C,0x801A1E0C,0x3D -asm/non_matchings/code/code_8019AF00/func_801A1F00.s,func_801A1F00,0x801A1F00,0x22 -asm/non_matchings/code/code_8019AF00/func_801A1F88.s,func_801A1F88,0x801A1F88,0xB -asm/non_matchings/code/code_8019AF00/func_801A1FB4.s,func_801A1FB4,0x801A1FB4,0x37 -asm/non_matchings/code/code_8019AF00/func_801A2090.s,func_801A2090,0x801A2090,0x5B +asm/non_matchings/code/code_8019AF00/Audio_SetSequenceProperties.s,Audio_SetSequenceProperties,0x801A0E44,0x113 +asm/non_matchings/code/code_8019AF00/Audio_UpdateObjSoundProperties.s,Audio_UpdateObjSoundProperties,0x801A1290,0x2E +asm/non_matchings/code/code_8019AF00/Audio_SetObjSoundProperties.s,Audio_SetObjSoundProperties,0x801A1348,0x1D +asm/non_matchings/code/code_8019AF00/Audio_StartObjSoundFanfare.s,Audio_StartObjSoundFanfare,0x801A13BC,0x60 +asm/non_matchings/code/code_8019AF00/Audio_PlayObjSoundBgm.s,Audio_PlayObjSoundBgm,0x801A153C,0xAE +asm/non_matchings/code/code_8019AF00/Audio_PlayObjSoundFanfare.s,Audio_PlayObjSoundFanfare,0x801A17F4,0x44 +asm/non_matchings/code/code_8019AF00/Audio_UpdateObjSoundFanfare.s,Audio_UpdateObjSoundFanfare,0x801A1904,0x43 +asm/non_matchings/code/code_8019AF00/Audio_StopSequenceAtPos.s,Audio_StopSequenceAtPos,0x801A1A10,0x1F +asm/non_matchings/code/code_8019AF00/Audio_StartSubBgmAtPos.s,Audio_StartSubBgmAtPos,0x801A1A8C,0xAE +asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgmAtPos.s,Audio_PlaySubBgmAtPos,0x801A1D44,0x1D +asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgmAtPosWithFilter.s,Audio_PlaySubBgmAtPosWithFilter,0x801A1DB8,0x15 +asm/non_matchings/code/code_8019AF00/Audio_UpdateSubBgmAtPos.s,Audio_UpdateSubBgmAtPos,0x801A1E0C,0x3D +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceAtDefaultPos.s,Audio_PlaySequenceAtDefaultPos,0x801A1F00,0x22 +asm/non_matchings/code/code_8019AF00/Audio_StopSequenceAtDefaultPos.s,Audio_StopSequenceAtDefaultPos,0x801A1F88,0xB +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceAtPos.s,Audio_PlaySequenceAtPos,0x801A1FB4,0x37 +asm/non_matchings/code/code_8019AF00/Audio_UpdateSequenceAtPos.s,Audio_UpdateSequenceAtPos,0x801A2090,0x5B asm/non_matchings/code/code_8019AF00/Audio_PlaySariaBgm.s,Audio_PlaySariaBgm,0x801A21FC,0x99 asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm2.s,Audio_ClearSariaBgm2,0x801A2460,0x3 asm/non_matchings/code/code_8019AF00/func_801A246C.s,func_801A246C,0x801A246C,0x36 @@ -3486,35 +3486,35 @@ asm/non_matchings/code/code_8019AF00/func_801A3950.s,func_801A3950,0x801A3950,0x asm/non_matchings/code/code_8019AF00/func_801A39F8.s,func_801A39F8,0x801A39F8,0x21 asm/non_matchings/code/code_8019AF00/func_801A3A7C.s,func_801A3A7C,0x801A3A7C,0x11 asm/non_matchings/code/code_8019AF00/func_801A3AC0.s,func_801A3AC0,0x801A3AC0,0xB -asm/non_matchings/code/code_8019AF00/func_801A3AEC.s,func_801A3AEC,0x801A3AEC,0x17 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_PauseMenuOpenOrClose.s,Audio_PlaySfx_PauseMenuOpenOrClose,0x801A3AEC,0x17 asm/non_matchings/code/code_8019AF00/func_801A3B48.s,func_801A3B48,0x801A3B48,0x12 asm/non_matchings/code/code_8019AF00/func_801A3B90.s,func_801A3B90,0x801A3B90,0x52 asm/non_matchings/code/code_8019AF00/func_801A3CD8.s,func_801A3CD8,0x801A3CD8,0x7 asm/non_matchings/code/code_8019AF00/func_801A3CF4.s,func_801A3CF4,0x801A3CF4,0x18 -asm/non_matchings/code/code_8019AF00/func_801A3D54.s,func_801A3D54,0x801A3D54,0x11 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_SurroundSoundTest.s,Audio_PlaySfx_SurroundSoundTest,0x801A3D54,0x11 asm/non_matchings/code/code_8019AF00/func_801A3D98.s,func_801A3D98,0x801A3D98,0x28 asm/non_matchings/code/code_8019AF00/func_801A3E38.s,func_801A3E38,0x801A3E38,0x22 asm/non_matchings/code/code_8019AF00/func_801A3EC0.s,func_801A3EC0,0x801A3EC0,0x25 asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s,Audio_SetCutsceneFlag,0x801A3F54,0x6 -asm/non_matchings/code/code_8019AF00/func_801A3F6C.s,func_801A3F6C,0x801A3F6C,0x12 -asm/non_matchings/code/code_8019AF00/func_801A3FB4.s,func_801A3FB4,0x801A3FB4,0x12 -asm/non_matchings/code/code_8019AF00/func_801A3FFC.s,func_801A3FFC,0x801A3FFC,0x4 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_IfNotInCutsceneImpl.s,Audio_PlaySfx_IfNotInCutsceneImpl,0x801A3F6C,0x12 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_IfNotInCutscene.s,Audio_PlaySfx_IfNotInCutscene,0x801A3FB4,0x12 +asm/non_matchings/code/code_8019AF00/Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem.s,Audio_MuteSfxAndAmbienceSeqExceptOcarinaAndSystem,0x801A3FFC,0x4 asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s,Audio_SetSpec,0x801A400C,0x13 asm/non_matchings/code/code_8019AF00/func_801A4058.s,func_801A4058,0x801A4058,0x5C asm/non_matchings/code/code_8019AF00/func_801A41C8.s,func_801A41C8,0x801A41C8,0xC asm/non_matchings/code/code_8019AF00/func_801A41F8.s,func_801A41F8,0x801A41F8,0x29 -asm/non_matchings/code/code_8019AF00/func_801A429C.s,func_801A429C,0x801A429C,0xB +asm/non_matchings/code/code_8019AF00/Audio_StartSfxPlayer.s,Audio_StartSfxPlayer,0x801A429C,0xB 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/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_SetSfxReverbIndexExceptOcarinaBank.s,Audio_SetSfxReverbIndexExceptOcarinaBank,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 asm/non_matchings/code/code_8019AF00/Audio_ResetRequestedSceneSeqId.s,Audio_ResetRequestedSceneSeqId,0x801A44C4,0x4 asm/non_matchings/code/code_8019AF00/Audio_ResetData.s,Audio_ResetData,0x801A44D4,0x89 asm/non_matchings/code/code_8019AF00/func_801A46F8.s,func_801A46F8,0x801A46F8,0x14 -asm/non_matchings/code/code_8019AF00/func_801A4748.s,func_801A4748,0x801A4748,0x15 -asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x10 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtFixedPos.s,Audio_PlaySfx_AtFixedPos,0x801A4748,0x15 +asm/non_matchings/code/code_8019AF00/Audio_PlaySfx_AtPosWithVolumeTransition.s,Audio_PlaySfx_AtPosWithVolumeTransition,0x801A479C,0x10 asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceChannelIO.s,Audio_SetAmbienceChannelIO,0x801A47DC,0x41 asm/non_matchings/code/code_8019AF00/Audio_StartAmbience.s,Audio_StartAmbience,0x801A48E0,0x52 asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience.s,Audio_PlayAmbience,0x801A4A28,0x56 diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index 591671ab8..35757a022 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -74,7 +74,7 @@ weekEventReg = { ( 8 << 8) | 0x08: "WEEKEVENTREG_08_08", ( 8 << 8) | 0x10: "WEEKEVENTREG_08_10", ( 8 << 8) | 0x20: "WEEKEVENTREG_RECEIVED_DOGGY_RACETRACK_HEART_PIECE", - ( 8 << 8) | 0x40: "WEEKEVENTREG_08_40", + ( 8 << 8) | 0x40: "WEEKEVENTREG_CLOCK_TOWER_OPENED", ( 8 << 8) | 0x80: "WEEKEVENTREG_08_80", ( 9 << 8) | 0x01: "WEEKEVENTREG_09_01", ( 9 << 8) | 0x02: "WEEKEVENTREG_09_02", @@ -84,7 +84,7 @@ weekEventReg = { ( 9 << 8) | 0x20: "WEEKEVENTREG_09_20", ( 9 << 8) | 0x40: "WEEKEVENTREG_09_40", ( 9 << 8) | 0x80: "WEEKEVENTREG_09_80", - (10 << 8) | 0x01: "WEEKEVENTREG_10_01", + (10 << 8) | 0x01: "WEEKEVENTREG_TALKED_TINGLE", (10 << 8) | 0x02: "WEEKEVENTREG_10_02", (10 << 8) | 0x04: "WEEKEVENTREG_10_04", (10 << 8) | 0x08: "WEEKEVENTREG_10_08", @@ -103,8 +103,8 @@ weekEventReg = { (12 << 8) | 0x01: "WEEKEVENTREG_12_01", (12 << 8) | 0x02: "WEEKEVENTREG_12_02", (12 << 8) | 0x04: "WEEKEVENTREG_12_04", - (12 << 8) | 0x08: "WEEKEVENTREG_12_08", - (12 << 8) | 0x10: "WEEKEVENTREG_12_10", + (12 << 8) | 0x08: "WEEKEVENTREG_SAVED_KOUME", + (12 << 8) | 0x10: "WEEKEVENTREG_RECEIVED_KOTAKE_BOTTLE", (12 << 8) | 0x20: "WEEKEVENTREG_12_20", (12 << 8) | 0x40: "WEEKEVENTREG_12_40", (12 << 8) | 0x80: "WEEKEVENTREG_12_80", @@ -120,10 +120,10 @@ weekEventReg = { (14 << 8) | 0x02: "WEEKEVENTREG_14_02", (14 << 8) | 0x04: "WEEKEVENTREG_14_04", (14 << 8) | 0x08: "WEEKEVENTREG_DRANK_CHATEAU_ROMANI", - (14 << 8) | 0x10: "WEEKEVENTREG_14_10", - (14 << 8) | 0x20: "WEEKEVENTREG_14_20", - (14 << 8) | 0x40: "WEEKEVENTREG_14_40", - (14 << 8) | 0x80: "WEEKEVENTREG_14_80", + (14 << 8) | 0x10: "WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1", + (14 << 8) | 0x20: "WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_2", + (14 << 8) | 0x40: "WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_3", + (14 << 8) | 0x80: "WEEKEVENTREG_RECEIVED_DEKU_PLAYGROUND_HEART_PIECE", (15 << 8) | 0x01: "WEEKEVENTREG_15_01", (15 << 8) | 0x02: "WEEKEVENTREG_15_02", (15 << 8) | 0x04: "WEEKEVENTREG_15_04", @@ -136,11 +136,11 @@ weekEventReg = { (16 << 8) | 0x02: "WEEKEVENTREG_16_02", (16 << 8) | 0x04: "WEEKEVENTREG_16_04", (16 << 8) | 0x08: "WEEKEVENTREG_16_08", - (16 << 8) | 0x10: "WEEKEVENTREG_16_10", + (16 << 8) | 0x10: "WEEKEVENTREG_TALKED_KOUME_INJURED", (16 << 8) | 0x20: "WEEKEVENTREG_16_20", (16 << 8) | 0x40: "WEEKEVENTREG_16_40", (16 << 8) | 0x80: "WEEKEVENTREG_16_80", - (17 << 8) | 0x01: "WEEKEVENTREG_17_01", + (17 << 8) | 0x01: "WEEKEVENTREG_TALKED_EMPTY_BOAT_CRUISE", (17 << 8) | 0x02: "WEEKEVENTREG_17_02", (17 << 8) | 0x04: "WEEKEVENTREG_17_04", (17 << 8) | 0x08: "WEEKEVENTREG_17_08", @@ -150,9 +150,9 @@ weekEventReg = { (17 << 8) | 0x80: "WEEKEVENTREG_17_80", (18 << 8) | 0x01: "WEEKEVENTREG_18_01", (18 << 8) | 0x02: "WEEKEVENTREG_18_02", - (18 << 8) | 0x04: "WEEKEVENTREG_18_04", - (18 << 8) | 0x08: "WEEKEVENTREG_18_08", - (18 << 8) | 0x10: "WEEKEVENTREG_18_10", + (18 << 8) | 0x04: "WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_GORON", + (18 << 8) | 0x08: "WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_ZORA", + (18 << 8) | 0x10: "WEEKEVENTREG_TALKED_CURIOSITY_SHOP_MAN_AS_DEKU", (18 << 8) | 0x20: "WEEKEVENTREG_18_20", (18 << 8) | 0x40: "WEEKEVENTREG_18_40", (18 << 8) | 0x80: "WEEKEVENTREG_HAS_POWDERKEG_PRIVILEGES", @@ -189,7 +189,7 @@ weekEventReg = { (22 << 8) | 0x40: "WEEKEVENTREG_22_40", (22 << 8) | 0x80: "WEEKEVENTREG_22_80", (23 << 8) | 0x01: "WEEKEVENTREG_23_01", - (23 << 8) | 0x02: "WEEKEVENTREG_23_02", + (23 << 8) | 0x02: "WEEKEVENTREG_OBTAINED_GREAT_SPIN_ATTACK", (23 << 8) | 0x04: "WEEKEVENTREG_23_04", (23 << 8) | 0x08: "WEEKEVENTREG_23_08", (23 << 8) | 0x10: "WEEKEVENTREG_23_10", @@ -261,8 +261,8 @@ weekEventReg = { (31 << 8) | 0x40: "WEEKEVENTREG_31_40", (31 << 8) | 0x80: "WEEKEVENTREG_31_80", (32 << 8) | 0x01: "WEEKEVENTREG_32_01", - (32 << 8) | 0x02: "WEEKEVENTREG_32_02", - (32 << 8) | 0x04: "WEEKEVENTREG_32_04", + (32 << 8) | 0x02: "WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_HEART_PIECE", + (32 << 8) | 0x04: "WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_HEART_PIECE", (32 << 8) | 0x08: "WEEKEVENTREG_32_08", (32 << 8) | 0x10: "WEEKEVENTREG_32_10", (32 << 8) | 0x20: "WEEKEVENTREG_32_20", @@ -270,8 +270,8 @@ weekEventReg = { (32 << 8) | 0x80: "WEEKEVENTREG_32_80", (33 << 8) | 0x01: "WEEKEVENTREG_33_01", (33 << 8) | 0x02: "WEEKEVENTREG_33_02", - (33 << 8) | 0x04: "WEEKEVENTREG_33_04", - (33 << 8) | 0x08: "WEEKEVENTREG_33_08", + (33 << 8) | 0x04: "WEEKEVENTREG_BOUGHT_CURIOSITY_SHOP_SPECIAL_ITEM", + (33 << 8) | 0x08: "WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG", (33 << 8) | 0x10: "WEEKEVENTREG_33_10", (33 << 8) | 0x20: "WEEKEVENTREG_33_20", (33 << 8) | 0x40: "WEEKEVENTREG_33_40", @@ -284,12 +284,12 @@ weekEventReg = { (34 << 8) | 0x20: "WEEKEVENTREG_34_20", (34 << 8) | 0x40: "WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH", (34 << 8) | 0x80: "WEEKEVENTREG_34_80", - (35 << 8) | 0x01: "WEEKEVENTREG_35_01", - (35 << 8) | 0x02: "WEEKEVENTREG_35_02", - (35 << 8) | 0x04: "WEEKEVENTREG_35_04", - (35 << 8) | 0x08: "WEEKEVENTREG_35_08", - (35 << 8) | 0x10: "WEEKEVENTREG_35_10", - (35 << 8) | 0x20: "WEEKEVENTREG_35_20", + (35 << 8) | 0x01: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_CLOCK_TOWN", + (35 << 8) | 0x02: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_WOODFALL", + (35 << 8) | 0x04: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_SNOWHEAD", + (35 << 8) | 0x08: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_ROMANI_RANCH", + (35 << 8) | 0x10: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_GREAT_BAY", + (35 << 8) | 0x20: "WEEKEVENTREG_TINGLE_MAP_BOUGHT_STONE_TOWER", (35 << 8) | 0x40: "WEEKEVENTREG_35_40", (35 << 8) | 0x80: "WEEKEVENTREG_35_80", (36 << 8) | 0x01: "WEEKEVENTREG_36_01", @@ -431,8 +431,8 @@ weekEventReg = { (53 << 8) | 0x01: "WEEKEVENTREG_53_01", (53 << 8) | 0x02: "WEEKEVENTREG_53_02", (53 << 8) | 0x04: "WEEKEVENTREG_53_04", - (53 << 8) | 0x08: "WEEKEVENTREG_53_08", - (53 << 8) | 0x10: "WEEKEVENTREG_53_10", + (53 << 8) | 0x08: "WEEKEVENTREG_GAVE_KOTAKE_MUSHROOM", + (53 << 8) | 0x10: "WEEKEVENTREG_RECEIVED_FREE_BLUE_POTION", (53 << 8) | 0x20: "WEEKEVENTREG_53_20", (53 << 8) | 0x40: "WEEKEVENTREG_53_40", (53 << 8) | 0x80: "WEEKEVENTREG_53_80", @@ -446,9 +446,9 @@ weekEventReg = { (54 << 8) | 0x80: "WEEKEVENTREG_54_80", (55 << 8) | 0x01: "WEEKEVENTREG_55_01", (55 << 8) | 0x02: "WEEKEVENTREG_55_02", - (55 << 8) | 0x04: "WEEKEVENTREG_55_04", - (55 << 8) | 0x08: "WEEKEVENTREG_55_08", - (55 << 8) | 0x10: "WEEKEVENTREG_55_10", + (55 << 8) | 0x04: "WEEKEVENTREG_TALKED_PART_TIMER_AS_GORON", + (55 << 8) | 0x08: "WEEKEVENTREG_TALKED_PART_TIMER_AS_ZORA", + (55 << 8) | 0x10: "WEEKEVENTREG_TALKED_PART_TIMER_AS_DEKU", (55 << 8) | 0x20: "WEEKEVENTREG_55_20", (55 << 8) | 0x40: "WEEKEVENTREG_55_40", (55 << 8) | 0x80: "WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE", @@ -464,24 +464,24 @@ weekEventReg = { (57 << 8) | 0x02: "WEEKEVENTREG_57_02", (57 << 8) | 0x04: "WEEKEVENTREG_57_04", (57 << 8) | 0x08: "WEEKEVENTREG_57_08", - (57 << 8) | 0x10: "WEEKEVENTREG_57_10", - (57 << 8) | 0x20: "WEEKEVENTREG_57_20", - (57 << 8) | 0x40: "WEEKEVENTREG_57_40", - (57 << 8) | 0x80: "WEEKEVENTREG_57_80", + (57 << 8) | 0x10: "WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_HUMAN", + (57 << 8) | 0x20: "WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_DEKU", + (57 << 8) | 0x40: "WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_GORON", + (57 << 8) | 0x80: "WEEKEVENTREG_TALKED_ZORA_SHOPKEEPER_AS_ZORA", (58 << 8) | 0x01: "WEEKEVENTREG_58_01", (58 << 8) | 0x02: "WEEKEVENTREG_58_02", - (58 << 8) | 0x04: "WEEKEVENTREG_58_04", - (58 << 8) | 0x08: "WEEKEVENTREG_58_08", - (58 << 8) | 0x10: "WEEKEVENTREG_58_10", - (58 << 8) | 0x20: "WEEKEVENTREG_58_20", + (58 << 8) | 0x04: "WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_NON_GORON", + (58 << 8) | 0x08: "WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_AS_GORON", + (58 << 8) | 0x10: "WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_NON_GORON", + (58 << 8) | 0x20: "WEEKEVENTREG_TALKED_GORON_SHOPKEEPER_SPRING_AS_GORON", (58 << 8) | 0x40: "WEEKEVENTREG_58_40", (58 << 8) | 0x80: "WEEKEVENTREG_58_80", (59 << 8) | 0x01: "WEEKEVENTREG_59_01", (59 << 8) | 0x02: "WEEKEVENTREG_59_02", (59 << 8) | 0x08: "WEEKEVENTREG_59_08", (59 << 8) | 0x04: "WEEKEVENTREG_59_04", - (59 << 8) | 0x10: "WEEKEVENTREG_59_10", - (59 << 8) | 0x20: "WEEKEVENTREG_59_20", + (59 << 8) | 0x10: "WEEKEVENTREG_RECEIVED_SWAMP_SHOOTING_GALLERY_QUIVER_UPGRADE", + (59 << 8) | 0x20: "WEEKEVENTREG_RECEIVED_TOWN_SHOOTING_GALLERY_QUIVER_UPGRADE", (59 << 8) | 0x40: "WEEKEVENTREG_59_40", (59 << 8) | 0x80: "WEEKEVENTREG_59_80", (60 << 8) | 0x01: "WEEKEVENTREG_60_01", @@ -519,8 +519,8 @@ weekEventReg = { (64 << 8) | 0x01: "WEEKEVENTREG_64_01", (64 << 8) | 0x02: "WEEKEVENTREG_64_02", (64 << 8) | 0x04: "WEEKEVENTREG_64_04", - (64 << 8) | 0x08: "WEEKEVENTREG_64_08", - (64 << 8) | 0x10: "WEEKEVENTREG_64_10", + (64 << 8) | 0x08: "WEEKEVENTREG_TINGLE_RECOGNIZED_PLAYER_FORM_LOW_BIT", + (64 << 8) | 0x10: "WEEKEVENTREG_TINGLE_RECOGNIZED_PLAYER_FORM_HIGH_BIT", (64 << 8) | 0x20: "WEEKEVENTREG_64_20", (64 << 8) | 0x40: "WEEKEVENTREG_64_40", (64 << 8) | 0x80: "WEEKEVENTREG_TALKED_DOGGY_RACETRACK_OWNER_DAY_1", @@ -642,7 +642,7 @@ weekEventReg = { (79 << 8) | 0x08: "WEEKEVENTREG_79_08", (79 << 8) | 0x10: "WEEKEVENTREG_79_10", (79 << 8) | 0x20: "WEEKEVENTREG_79_20", - (79 << 8) | 0x40: "WEEKEVENTREG_79_40", + (79 << 8) | 0x40: "WEEKEVENTREG_SAKON_DEAD", (79 << 8) | 0x80: "WEEKEVENTREG_79_80", (80 << 8) | 0x01: "WEEKEVENTREG_80_01", (80 << 8) | 0x02: "WEEKEVENTREG_80_02", @@ -682,13 +682,13 @@ weekEventReg = { (84 << 8) | 0x08: "WEEKEVENTREG_84_08", (84 << 8) | 0x10: "WEEKEVENTREG_84_10", (84 << 8) | 0x20: "WEEKEVENTREG_84_20", - (84 << 8) | 0x40: "WEEKEVENTREG_84_40", + (84 << 8) | 0x40: "WEEKEVENTREG_RECEIVED_RED_POTION_FOR_KOUME", (84 << 8) | 0x80: "WEEKEVENTREG_84_80", (85 << 8) | 0x01: "WEEKEVENTREG_85_01", (85 << 8) | 0x02: "WEEKEVENTREG_85_02", (85 << 8) | 0x04: "WEEKEVENTREG_85_04", - (85 << 8) | 0x08: "WEEKEVENTREG_85_08", - (85 << 8) | 0x10: "WEEKEVENTREG_85_10", + (85 << 8) | 0x08: "WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_SHOP", + (85 << 8) | 0x10: "WEEKEVENTREG_FAILED_RECEIVED_RED_POTION_FOR_KOUME_WOODS", (85 << 8) | 0x20: "WEEKEVENTREG_85_20", (85 << 8) | 0x40: "WEEKEVENTREG_85_40", (85 << 8) | 0x80: "WEEKEVENTREG_85_80", diff --git a/undefined_syms.txt b/undefined_syms.txt index f0c2ad0d9..8c286e996 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -14,7 +14,7 @@ osResetType = 0x8000030C; osCicId = 0x80000310; osVersion = 0x80000314; osMemSize = 0x80000318; -osAppNmiBuffer = 0x8000031C; +osAppNMIBuffer = 0x8000031C; /// OS hardware registers @@ -141,450 +141,58 @@ aspMainDataEnd = aspMainDataStart + 0x2E0; // segment 0x01 D_01000000 = 0x01000000; -D_01000680 = 0x01000680; -D_01001280 = 0x01001280; -D_01001800 = 0x01001800; -D_01002720 = 0x01002720; -D_01002800 = 0x01002800; -D_01007980 = 0x01007980; -D_010220B0 = 0x010220B0; -D_010277B0 = 0x010277B0; -D_0102A030 = 0x0102A030; -D_0102A6B0 = 0x0102A6B0; -D_0102A7B0 = 0x0102A7B0; -D_0102AAB0 = 0x0102AAB0; -D_0102B170 = 0x0102B170; -D_0102B3B0 = 0x0102B3B0; -D_0102B8F0 = 0x0102B8F0; -D_0102FCB0 = 0x0102FCB0; -D_010308F0 = 0x010308F0; -D_010310F0 = 0x010310F0; -D_010311F0 = 0x010311F0; -D_01031408 = 0x01031408; -D_01031618 = 0x01031618; // segment 0x02 -D_02000000 = 0x02000000; -D_02000100 = 0x02000100; -D_02000200 = 0x02000200; -D_02000300 = 0x02000300; D_02000400 = 0x02000400; -D_02000500 = 0x02000500; -D_02000600 = 0x02000600; -D_02000700 = 0x02000700; -D_02000800 = 0x02000800; -D_02000900 = 0x02000900; -D_02000A00 = 0x02000A00; -D_02000BE0 = 0x02000BE0; -D_02000D60 = 0x02000D60; D_02000E60 = 0x02000E60; -D_02000F60 = 0x02000F60; -D_02001360 = 0x02001360; -D_02002360 = 0x02002360; D_02002460 = 0x02002460; D_020029A0 = 0x020029A0; D_02002AA0 = 0x02002AA0; -D_02002DE0 = 0x02002DE0; -D_020031E0 = 0x020031E0; -D_020038A0 = 0x020038A0; D_02003F20 = 0x02003F20; -D_02003FA0 = 0x02003FA0; -D_020042A0 = 0x020042A0; -D_020043A0 = 0x020043A0; -D_02004420 = 0x02004420; -D_020044A0 = 0x020044A0; -D_02004A20 = 0x02004A20; -D_02004AA0 = 0x02004AA0; -D_02004DA0 = 0x02004DA0; -D_02004E20 = 0x02004E20; -D_02004FA0 = 0x02004FA0; -D_02004FE0 = 0x02004FE0; -D_020054E0 = 0x020054E0; -D_02005720 = 0x02005720; -D_02005960 = 0x02005960; -D_02005F60 = 0x02005F60; -D_020063C0 = 0x020063C0; -D_02006B20 = 0x02006B20; D_0200B998 = 0x0200B998; // segment 0x03 - // segment 0x04 -D_04000320 = 0x04000320; -D_040003E0 = 0x040003E0; -D_040032B0 = 0x040032B0; -D_0400CF48 = 0x0400CF48; -D_0400CF58 = 0x0400CF58; -D_0400CF88 = 0x0400CF88; -D_0400CF98 = 0x0400CF98; -D_0400D028 = 0x0400D028; -D_0400D030 = 0x0400D030; -D_0400D090 = 0x0400D090; -D_0400D0A8 = 0x0400D0A8; -D_0400D0B0 = 0x0400D0B0; -D_0400D0B8 = 0x0400D0B8; -D_0400D0C8 = 0x0400D0C8; -D_0400D0D0 = 0x0400D0D0; -D_0400D100 = 0x0400D100; -D_0400D108 = 0x0400D108; -D_0400D218 = 0x0400D218; -D_0400D220 = 0x0400D220; -D_0400D228 = 0x0400D228; -D_0400D2D0 = 0x0400D2D0; -D_0400D300 = 0x0400D300; -D_0400D3E8 = 0x0400D3E8; -D_0400D3F8 = 0x0400D3F8; -D_0400D420 = 0x0400D420; -D_0400D488 = 0x0400D488; -D_0400D490 = 0x0400D490; -D_0400D4A8 = 0x0400D4A8; -D_0400D4B0 = 0x0400D4B0; -D_0400D4B8 = 0x0400D4B8; -D_0400D4C0 = 0x0400D4C0; -D_0400D4D8 = 0x0400D4D8; -D_0400D4F0 = 0x0400D4F0; -D_0400D4F8 = 0x0400D4F8; -D_0400D500 = 0x0400D500; -D_0400D520 = 0x0400D520; -D_0400D568 = 0x0400D568; -D_0400D5A8 = 0x0400D5A8; -D_0400D5B0 = 0x0400D5B0; -D_0400D638 = 0x0400D638; -D_0400D660 = 0x0400D660; -D_0400D698 = 0x0400D698; -D_0400D728 = 0x0400D728; -D_0400D8B0 = 0x0400D8B0; -D_0400D9C8 = 0x0400D9C8; -D_0400D9D0 = 0x0400D9D0; -D_0400D9D8 = 0x0400D9D8; -D_0400DA60 = 0x0400DA60; -D_0400DA68 = 0x0400DA68; -D_0400DA70 = 0x0400DA70; -D_0400DA88 = 0x0400DA88; -D_0400DAA0 = 0x0400DAA0; -D_0400DAA8 = 0x0400DAA8; -D_0400DAC0 = 0x0400DAC0; -D_0400DAC8 = 0x0400DAC8; -D_0400DAD0 = 0x0400DAD0; -D_0400DAD8 = 0x0400DAD8; -D_0400DAE0 = 0x0400DAE0; -D_0400DAF0 = 0x0400DAF0; -D_0400DB10 = 0x0400DB10; -D_0400DB18 = 0x0400DB18; -D_0400DB30 = 0x0400DB30; -D_0400DB68 = 0x0400DB68; -D_0400DBB0 = 0x0400DBB0; -D_0400DBE8 = 0x0400DBE8; -D_0400DC20 = 0x0400DC20; -D_0400DC28 = 0x0400DC28; -D_0400DC30 = 0x0400DC30; -D_0400DC48 = 0x0400DC48; -D_0400DC50 = 0x0400DC50; -D_0400DC60 = 0x0400DC60; -D_0400DC78 = 0x0400DC78; -D_0400DC80 = 0x0400DC80; -D_0400DC88 = 0x0400DC88; -D_0400DCA8 = 0x0400DCA8; -D_0400DCD0 = 0x0400DCD0; -D_0400DCD8 = 0x0400DCD8; -D_0400DCF8 = 0x0400DCF8; -D_0400DD10 = 0x0400DD10; -D_0400DD30 = 0x0400DD30; -D_0400DD38 = 0x0400DD38; -D_0400DD40 = 0x0400DD40; -D_0400DD50 = 0x0400DD50; -D_0400DD58 = 0x0400DD58; -D_0400DD68 = 0x0400DD68; -D_0400DD70 = 0x0400DD70; -D_0400DD78 = 0x0400DD78; -D_0400DD80 = 0x0400DD80; -D_0400DDB0 = 0x0400DDB0; -D_0400DDF0 = 0x0400DDF0; -D_0400DDF8 = 0x0400DDF8; -D_0400DE00 = 0x0400DE00; -D_0400DE08 = 0x0400DE08; -D_0400DE10 = 0x0400DE10; -D_0400DE28 = 0x0400DE28; -D_0400DE30 = 0x0400DE30; -D_0400DE48 = 0x0400DE48; -D_0400DE50 = 0x0400DE50; -D_0400DE58 = 0x0400DE58; -D_0400DE60 = 0x0400DE60; -D_0400DEA0 = 0x0400DEA0; -D_0400DEA8 = 0x0400DEA8; -D_0400DF78 = 0x0400DF78; -D_0400DF90 = 0x0400DF90; -D_0400DF98 = 0x0400DF98; -D_0400DFA0 = 0x0400DFA0; -D_0400DFA8 = 0x0400DFA8; -D_0400DFB0 = 0x0400DFB0; -D_0400DFB8 = 0x0400DFB8; -D_0400DFC0 = 0x0400DFC0; -D_0400DFC8 = 0x0400DFC8; -D_0400DFD0 = 0x0400DFD0; -D_0400DFD8 = 0x0400DFD8; -D_0400DFE0 = 0x0400DFE0; -D_0400DFE8 = 0x0400DFE8; -D_0400DFF0 = 0x0400DFF0; -D_0400DFF8 = 0x0400DFF8; -D_0400E000 = 0x0400E000; -D_0400E008 = 0x0400E008; -D_0400E050 = 0x0400E050; -D_0400E060 = 0x0400E060; -D_0400E070 = 0x0400E070; -D_0400E080 = 0x0400E080; -D_0400E088 = 0x0400E088; -D_0400E098 = 0x0400E098; -D_0400E118 = 0x0400E118; -D_0400E120 = 0x0400E120; -D_0400E150 = 0x0400E150; -D_0400E1F0 = 0x0400E1F0; -D_0400E1F8 = 0x0400E1F8; -D_0400E200 = 0x0400E200; -D_0400E208 = 0x0400E208; -D_0400E218 = 0x0400E218; -D_0400E230 = 0x0400E230; -D_0400E248 = 0x0400E248; -D_0400E260 = 0x0400E260; -D_0400E270 = 0x0400E270; -D_0400E278 = 0x0400E278; -D_0400E290 = 0x0400E290; -D_0400E298 = 0x0400E298; -D_0400E2A0 = 0x0400E2A0; -D_0400E2A8 = 0x0400E2A8; -D_0400E2B0 = 0x0400E2B0; -D_0400E2B8 = 0x0400E2B8; -D_0400E2C0 = 0x0400E2C0; -D_0400E2C8 = 0x0400E2C8; -D_0400E2D0 = 0x0400E2D0; -D_0400E2D8 = 0x0400E2D8; -D_0400E2E8 = 0x0400E2E8; -D_0400E2F0 = 0x0400E2F0; -D_0400E2F8 = 0x0400E2F8; -D_0400E318 = 0x0400E318; -D_0400E330 = 0x0400E330; -D_0400E348 = 0x0400E348; -D_0400E350 = 0x0400E350; -D_0400E398 = 0x0400E398; -D_0400E3A0 = 0x0400E3A0; -D_0400E3A8 = 0x0400E3A8; -D_0400E3B0 = 0x0400E3B0; -D_0400E3B8 = 0x0400E3B8; -D_0400E3C0 = 0x0400E3C0; -D_0400E3D8 = 0x0400E3D8; -D_0400E3E0 = 0x0400E3E0; -D_0400E3E8 = 0x0400E3E8; -D_0400E3F0 = 0x0400E3F0; -D_0400E3F8 = 0x0400E3F8; -D_0400E408 = 0x0400E408; -D_0400E410 = 0x0400E410; -D_0400E418 = 0x0400E418; -D_0400E430 = 0x0400E430; -D_04012860 = 0x04012860; -D_040128BC = 0x040128BC; -D_04014560 = 0x04014560; -D_04015DB0 = 0x04015DB0; -D_04015FA0 = 0x04015FA0; -D_04016360 = 0x04016360; -D_0401ACF0 = 0x0401ACF0; D_0401ED00 = 0x0401ED00; -D_0401F0F0 = 0x0401F0F0; -D_04020658 = 0x04020658; -D_04020BB8 = 0x04020BB8; -D_04020D00 = 0x04020D00; -D_040221B8 = 0x040221B8; -D_04023130 = 0x04023130; D_04023210 = 0x04023210; -D_04023288 = 0x04023288; D_04023348 = 0x04023348; D_040233B8 = 0x040233B8; D_04023428 = 0x04023428; -D_04023480 = 0x04023480; -D_040234F0 = 0x040234F0; -D_04025850 = 0x04025850; -D_04025970 = 0x04025970; -D_04025DD0 = 0x04025DD0; -D_04025EF0 = 0x04025EF0; -D_040268F0 = 0x040268F0; -D_04027CA0 = 0x04027CA0; -D_040281DC = 0x040281DC; -D_04028FEC = 0x04028FEC; -D_0402900C = 0x0402900C; -D_04029140 = 0x04029140; D_04029CB0 = 0x04029CB0; D_04029CF0 = 0x04029CF0; -D_04029D20 = 0x04029D20; -D_0402AF58 = 0x0402AF58; D_0402E510 = 0x0402E510; -D_0402E65C = 0x0402E65C; -D_0402F028 = 0x0402F028; -D_0402F0EC = 0x0402F0EC; D_04030100 = 0x04030100; -D_040301B0 = 0x040301B0; -D_040367B0 = 0x040367B0; -D_040377B0 = 0x040377B0; -D_04037850 = 0x04037850; -D_0403A0F0 = 0x0403A0F0; D_0403F230 = 0x0403F230; -D_0404F250 = 0x0404F250; -D_04050550 = 0x04050550; D_04050D10 = 0x04050D10; -D_040510B0 = 0x040510B0; D_04051180 = 0x04051180; D_04051238 = 0x04051238; -D_0405140C = 0x0405140C; -D_040527A0 = 0x040527A0; -D_040527F0 = 0x040527F0; -D_040528B0 = 0x040528B0; D_04054940 = 0x04054940; D_040549A8 = 0x040549A8; -D_04054A90 = 0x04054A90; -D_04054C90 = 0x04054C90; -D_04054F18 = 0x04054F18; -D_04058BA0 = 0x04058BA0; -D_0405AAB0 = 0x0405AAB0; -D_0405AED0 = 0x0405AED0; -D_0405BEF0 = 0x0405BEF0; -D_0405CEF0 = 0x0405CEF0; -D_0405E6F0 = 0x0405E6F0; -D_0405F6F0 = 0x0405F6F0; -D_0405FFC0 = 0x0405FFC0; -D_040617C0 = 0x040617C0; -D_040622C0 = 0x040622C0; -D_0406A800 = 0x0406A800; D_0406AB30 = 0x0406AB30; -D_0406B6A0 = 0x0406B6A0; -D_0406B730 = 0x0406B730; -D_0406BB0C = 0x0406BB0C; -D_0406EB70 = 0x0406EB70; -D_0406F380 = 0x0406F380; -D_0406F9F0 = 0x0406F9F0; -D_0406FAE0 = 0x0406FAE0; D_040706E0 = 0x040706E0; -D_04075A40 = 0x04075A40; D_04076BC0 = 0x04076BC0; -D_04079B10 = 0x04079B10; -D_0407AB10 = 0x0407AB10; -D_0407AB58 = 0x0407AB58; D_0407AB70 = 0x0407AB70; -D_0407AFB0 = 0x0407AFB0; D_0407D590 = 0x0407D590; -D_0407D650 = 0x0407D650; D_0407E8C0 = 0x0407E8C0; D_0407F218 = 0x0407F218; -D_04080FC8 = 0x04080FC8; -D_040815D0 = 0x040815D0; -D_04081628 = 0x04081628; -D_04083534 = 0x04083534; -D_04085640 = 0x04085640; -D_0408DBE0 = 0x0408DBE0; -D_0408EBE0 = 0x0408EBE0; -D_04091BE0 = 0x04091BE0; -D_04091CE0 = 0x04091CE0; -D_04091DE0 = 0x04091DE0; -D_04091FE0 = 0x04091FE0; -D_040921E0 = 0x040921E0; -D_040923E0 = 0x040923E0; // segment 0x05 -D_05001D20 = 0x05001D20; -D_05002FA0 = 0x05002FA0; -D_050061E8 = 0x050061E8; -D_05006420 = 0x05006420; -D_050066B0 = 0x050066B0; -D_05006760 = 0x05006760; -D_05007498 = 0x05007498; -D_050078A0 = 0x050078A0; -D_05007938 = 0x05007938; D_050085F0 = 0x050085F0; D_050089D0 = 0x050089D0; -D_050182A8 = 0x050182A8; -D_0501B370 = 0x0501B370; -D_0501BEE0 = 0x0501BEE0; -D_0501BFB8 = 0x0501BFB8; -D_0501C058 = 0x0501C058; -D_0501C118 = 0x0501C118; -D_05021EF0 = 0x05021EF0; -D_05023008 = 0x05023008; -D_0502324C = 0x0502324C; // segment 0x06 -// code - -D_06001254 = 0x06001254; -D_06001C60 = 0x06001C60; -D_06007390 = 0x06007390; -D_06008AA0 = 0x06008AA0; -D_06008C50 = 0x06008C50; -D_0600A348 = 0x0600A348; -D_0600E088 = 0x0600E088; -D_0600E2A0 = 0x0600E2A0; -D_0600FBB8 = 0x0600FBB8; -D_0600FC18 = 0x0600FC18; -D_0600FDF0 = 0x0600FDF0; -D_060110A8 = 0x060110A8; -D_06011210 = 0x06011210; -D_06011710 = 0x06011710; -D_06011760 = 0x06011760; -D_06011AB8 = 0x06011AB8; -D_06012A80 = 0x06012A80; -D_06013138 = 0x06013138; - -// ovl_Bg_Crace_Movebg - -D_060003A0 = 0x060003A0; -D_06000E00 = 0x06000E00; - // ovl_Bg_Dblue_Elevator D_060002C8 = 0x060002C8; D_060005C4 = 0x060005C4; -// ovl_Bg_Dkjail_Ivy +// ovl_Bg_Lotus -D_06000080 = 0x06000080; -D_060011A8 = 0x060011A8; - -// ovl_Bg_Dy_Yoseizo - -D_06008090 = 0x06008090; -D_0600D1B0 = 0x0600D1B0; -D_0600D228 = 0x0600D228; -D_0601C6F4 = 0x0601C6F4; -D_0601C8B4 = 0x0601C8B4; - -// ovl_Bg_F40_Flift - -D_06004038 = 0x06004038; -D_06004240 = 0x06004240; - -// ovl_Bg_F40_Swlift - -D_06003B08 = 0x06003B08; -D_06003E80 = 0x06003E80; - -// ovl_Bg_Haka_Bombwall - -D_06001680 = 0x06001680; - -// ovl_Bg_Ikana_Bombwall - -D_06000288 = 0x06000288; - -// ovl_Bg_Keikoku_Spr - -D_06000100 = 0x06000100; -D_060001F8 = 0x060001F8; -D_060003F8 = 0x060003F8; -D_06000500 = 0x06000500; -D_060005F8 = 0x060005F8; - -/* ovl_Bg_Lotus */ D_06000A20 = 0x06000A20; D_06000040 = 0x06000040; @@ -748,12 +356,6 @@ D_06009278 = 0x06009278; D_06012B70 = 0x06012B70; D_06013EA8 = 0x06013EA8; -// ovl_Eff_Stk - -D_06008920 = 0x06008920; -D_06008A38 = 0x06008A38; -D_06009F60 = 0x06009F60; - // ovl_En_An D_06000308 = 0x06000308; @@ -800,51 +402,15 @@ D_0600CB2C = 0x0600CB2C; D_0600CB84 = 0x0600CB84; D_0600CBC0 = 0x0600CBC0; -// ovl_En_Dnh - -D_06002950 = 0x06002950; - // ovl_En_Dt D_0600112C = 0x0600112C; D_0600B0CC = 0x0600B0CC; -// ovl_En_Egblock - -D_06001698 = 0x06001698; -D_06001820 = 0x06001820; -D_06001918 = 0x06001918; -D_06001BF8 = 0x06001BF8; - -// ovl_En_Egol - -D_06000040 = 0x06000040; -D_06001170 = 0x06001170; -D_060013B0 = 0x060013B0; -D_06001918 = 0x06001918; -D_060041F0 = 0x060041F0; -D_060094E4 = 0x060094E4; -D_06009664 = 0x06009664; -D_0600EE4C = 0x0600EE4C; - // ovl_En_Encount3 D_060009A0 = 0x060009A0; -// ovl_En_Estone - -D_06010240 = 0x06010240; - -// ovl_En_Ge2 - -D_0600030C = 0x0600030C; -D_06000460 = 0x06000460; -D_06001664 = 0x06001664; -D_06008DD8 = 0x06008DD8; -D_060091D0 = 0x060091D0; -D_06009D1C = 0x06009D1C; -D_0600A344 = 0x0600A344; - // ovl_En_Ge3 D_06001EFC = 0x06001EFC; @@ -899,22 +465,6 @@ D_06015C28 = 0x06015C28; D_060156D8 = 0x060156D8; D_06016720 = 0x06016720; -// ovl_En_Invadepoh_Demo - -D_06000080 = 0x06000080; -D_06000550 = 0x06000550; -D_06000560 = 0x06000560; -D_06001D80 = 0x06001D80; -D_06004010 = 0x06004010; -D_06004264 = 0x06004264; -D_06004C30 = 0x06004C30; -D_06004E50 = 0x06004E50; -D_06004E98 = 0x06004E98; -D_06011FC8 = 0x06011FC8; -D_06012FC8 = 0x06012FC8; -D_06013928 = 0x06013928; -D_06016588 = 0x06016588; - // ovl_En_Jso D_060081F4 = 0x060081F4; @@ -992,17 +542,6 @@ D_06021E34 = 0x06021E34; D_06022728 = 0x06022728; D_06022CAC = 0x06022CAC; -// ovl_En_Mnk - -D_06003584 = 0x06003584; -D_06005150 = 0x06005150; -D_060082C8 = 0x060082C8; -D_06008814 = 0x06008814; -D_06009CC0 = 0x06009CC0; -D_060105DC = 0x060105DC; -D_06019B88 = 0x06019B88; -D_0601D518 = 0x0601D518; - // ovl_En_Okuta D_0600044C = 0x0600044C; @@ -1023,22 +562,6 @@ D_06006F38 = 0x06006F38; D_06006FD8 = 0x06006FD8; D_06009930 = 0x06009930; -// ovl_En_Slime - -D_060004C0 = 0x060004C0; -D_06000650 = 0x06000650; -D_06000828 = 0x06000828; -D_06000A10 = 0x06000A10; - -// ovl_En_Snowwd - -D_06000198 = 0x06000198; -D_06001AA0 = 0x06001AA0; - -// ovl_En_Ssh - -D_06000304 = 0x06000304; - // ovl_En_Takaraya D_06000968 = 0x06000968; @@ -1048,17 +571,6 @@ D_06009890 = 0x06009890; D_0600A280 = 0x0600A280; D_0600AD98 = 0x0600AD98; -// ovl_En_Test3 - -D_0600CB60 = 0x0600CB60; -D_0600EDD0 = 0x0600EDD0; -D_0600F7EC = 0x0600F7EC; - -// ovl_En_Tru - -D_0601A820 = 0x0601A820; -D_0601A830 = 0x0601A830; - // ovl_En_Wdhand D_060000F4 = 0x060000F4; @@ -1073,17 +585,6 @@ D_06001E20 = 0x06001E20; D_06013328 = 0x06013328; -// ovl_En_Zod - -D_06000D94 = 0x06000D94; -D_06007650 = 0x06007650; -D_0600D658 = 0x0600D658; - -// ovl_Item_B_Heart - -D_06001290 = 0x06001290; -D_06001470 = 0x06001470; - // ovl_Obj_Boyo D_06000300 = 0x06000300; @@ -1100,101 +601,34 @@ D_06002188 = 0x06002188; D_06000B70 = 0x06000B70; D_06000D60 = 0x06000D60; - // segment 0x07 -D_07000000 = 0x07000000; -D_07000800 = 0x07000800; -D_07001000 = 0x07001000; -D_07001800 = 0x07001800; -D_07002000 = 0x07002000; -D_07002800 = 0x07002800; -D_07003000 = 0x07003000; -D_07003800 = 0x07003800; -D_07004000 = 0x07004000; -D_07004800 = 0x07004800; -D_07005000 = 0x07005000; -D_07005800 = 0x07005800; -D_07006000 = 0x07006000; -D_07006800 = 0x07006800; -D_07007000 = 0x07007000; -D_07007800 = 0x07007800; -D_07008000 = 0x07008000; -D_07008800 = 0x07008800; -D_07009000 = 0x07009000; -D_07009800 = 0x07009800; -D_0700AC00 = 0x0700AC00; -D_0700AEA0 = 0x0700AEA0; - - // segment 0x08 D_08000000 = 0x08000000; -D_08000100 = 0x08000100; -D_08000700 = 0x08000700; -D_08000880 = 0x08000880; -D_08000A40 = 0x08000A40; -D_08001240 = 0x08001240; -D_080012C0 = 0x080012C0; -D_08001340 = 0x08001340; -D_08001358 = 0x08001358; -D_080013D8 = 0x080013D8; -D_080017D8 = 0x080017D8; -D_08001898 = 0x08001898; -D_080018B0 = 0x080018B0; -D_080018D0 = 0x080018D0; -D_08001950 = 0x08001950; -D_08001CD0 = 0x08001CD0; -D_08001DB0 = 0x08001DB0; -D_08001E90 = 0x08001E90; -D_08001F70 = 0x08001F70; -D_080025C8 = 0x080025C8; -D_080032B0 = 0x080032B0; -D_08061000 = 0x08061000; -D_08062000 = 0x08062000; -D_08064340 = 0x08064340; -D_08095AC0 = 0x08095AC0; // segment 0x09 -D_09007500 = 0x09007500; - // segment 0x0A -D_0A0001A0 = 0x0A0001A0; -D_0A000440 = 0x0A000440; -D_0A0004A0 = 0x0A0004A0; D_0A000D40 = 0x0A000D40; -D_0A0011F8 = 0x0A0011F8; -D_0A001CD8 = 0x0A001CD8; // segment 0x0B -D_0B000000 = 0x0B000000; -D_0B000090 = 0x0B000090; -D_0B0000E0 = 0x0B0000E0; -D_0B000130 = 0x0B000130; -D_0B000188 = 0x0B000188; - // segment 0x0C D_0C000000 = 0x0C000000; +// segment 0x0D + // segment 0x0E D_0E000000 = 0x0E000000; // TODO the following are fake and are offsets into the structure at D_0E000000 -D_0E000048 = 0x0E000048; -D_0E000088 = 0x0E000088; D_0E000140 = 0x0E000140; D_0E0001C8 = 0x0E0001C8; -D_0E0002A0 = 0x0E0002A0; -D_0E0002A8 = 0x0E0002A8; -D_0E0002B0 = 0x0E0002B0; -D_0E0002B8 = 0x0E0002B8; D_0E0002C8 = 0x0E0002C8; -D_0E0002E0 = 0x0E0002E0; // segment 0x0F