diff --git a/.gitignore b/.gitignore index ce16eaafbf..a6d3f3b8f5 100644 --- a/.gitignore +++ b/.gitignore @@ -42,5 +42,9 @@ tools/mips_to_c/ !*_custom* .extracted-assets.json +# Docs +!docs/**/*.png +!.vscode/extensions.json + # Per-user configuration .python-version diff --git a/Jenkinsfile b/Jenkinsfile index df06c6a096..cf5d8f3b63 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,9 +52,9 @@ pipeline { } steps { sh 'mkdir reports' - sh 'python3 ./tools/progress.py csv >> reports/progress_mm.us.rev1.csv' - sh 'python3 ./tools/progress.py csv -m >> reports/progress_matching_mm.us.rev1.csv' - sh 'python3 ./tools/progress.py shield-json > reports/progress_shield_mm.us.rev1.json' + sh 'python3 ./tools/progress.py csv >> reports/progress-mm-nonmatching.csv' + sh 'python3 ./tools/progress.py csv -m >> reports/progress-mm-matching.csv' + sh 'python3 ./tools/progress.py shield-json > reports/progress-mm-shield.json' stash includes: 'reports/*', name: 'reports' } } @@ -67,9 +67,9 @@ pipeline { } steps { unstash 'reports' - sh 'cat reports/progress_mm.us.rev1.csv >> /var/www/html/reports/progress_mm.us.rev1.csv' - sh 'cat reports/progress_matching_mm.us.rev1.csv >> /var/www/html/reports/progress_matching_mm.us.rev1.csv' - sh 'cat reports/progress_shield_mm.us.rev1.json > /var/www/html/reports/progress_shield_mm.us.rev1.json' + sh 'cat reports/progress-mm-nonmatching.csv >> /var/www/zelda64.dev/assets/csv/progress-mm-nonmatching.csv' + sh 'cat reports/progress-mm-matching.csv >> /var/www/zelda64.dev/assets/csv/progress-mm-matching.csv' + sh 'cat reports/progress-mm-shield.json > /var/www/zelda64.dev/assets/csv/progress-mm-shield.json' } } } diff --git a/Makefile b/Makefile index a65a8713d2..082203bae0 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump IINC := -Iinclude -Isrc -Iassets -Ibuild -I. + ifeq ($(KEEP_MDEBUG),0) RM_MDEBUG = $(OBJCOPY) --remove-section .mdebug $@ else @@ -102,6 +103,12 @@ else CC_CHECK += -m32 endif +# rom compression flags +COMPFLAGS := --threads $(N_THREADS) +ifneq ($(NON_MATCHING),1) + COMPFLAGS += --matching +endif + #### Files #### # ROM image @@ -116,25 +123,27 @@ $(shell mkdir -p asm data) SRC_DIRS := $(shell find src -type d) ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*") $(shell find data -type d) -ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") -BASEROM_DIRS := $(shell find baserom -type d 2>/dev/null) -ASSET_C_FILES := $(shell find assets/ -type f -name "*.c") -ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) -ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) ## Assets binaries (PNGs, JPGs, etc) +ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") + +ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml)) +ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) +ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \ + $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) + TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png)) TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg)) TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \ $(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \ -C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) +C_FILES := $(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)) 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\".*//') O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \ - $(foreach f,$(wildcard baserom/*),build/$f.o) \ $(foreach f,$(C_FILES:.c=.o),build/$f) \ - $(foreach f,$(ASSET_C_FILES:.c=.o),build/$f) + $(foreach f,$(BASEROM_FILES),build/$f.o) # Automatic dependency files # (Only asm_processor dependencies are handled for now) @@ -158,6 +167,8 @@ build/src/libultra/flash/%.o: MIPS_VERSION := -mips1 build/src/code/audio/%.o: OPTFLAGS := -O2 +build/assets/%.o: OPTFLAGS := + # file flags build/src/boot_O2_g3/fault.o: CFLAGS += -trapuv build/src/boot_O2_g3/fault_drawer.o: CFLAGS += -trapuv @@ -209,9 +220,9 @@ $(ROM): $(ELF) $(ELF2ROM) -cic 6105 $< $@ $(ROMC): uncompressed - python3 tools/z64compress_wrapper.py --mb 32 --matching --threads $(N_THREADS) $(ROM) $@ $(ELF) build/$(SPEC) + python3 tools/z64compress_wrapper.py $(COMPFLAGS) $(ROM) $@ $(ELF) build/$(SPEC) -$(ELF): $(TEXTURE_FILES_OUT) $(OVERLAY_RELOC_FILES) $(O_FILES) build/ldscript.txt build/undefined_syms.txt +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) build/ldscript.txt build/undefined_syms.txt $(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/mm.map -o $@ @@ -254,10 +265,6 @@ init: $(MAKE) all $(MAKE) diff-init -build/assets/%.o: assets/%.c - $(CC) -I build/ -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< - $(RM_MDEBUG) - #### Various Recipes #### build/undefined_syms.txt: undefined_syms.txt @@ -267,14 +274,19 @@ build/ldscript.txt: $(SPEC) $(CPP) $(CPPFLAGS) $< > build/spec $(MKLDSCRIPT) build/spec $@ -build/baserom/%.o: baserom/% - $(OBJCOPY) -I binary -O elf32-big $< $@ - build/asm/%.o: asm/%.s $(AS) $(ASFLAGS) $< -o $@ +build/assets/%.o: assets/%.c + $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< + $(OBJCOPY) -O binary $@ $@.bin + $(RM_MDEBUG) + +build/baserom/%.o: baserom/% + $(OBJCOPY) -I binary -O elf32-big $< $@ + build/data/%.o: data/%.s - iconv --from UTF-8 --to EUC-JP $< | $(AS) $(ASFLAGS) -o $@ + $(AS) $(ASFLAGS) $< -o $@ build/src/overlays/%.o: src/overlays/%.c $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< @@ -307,8 +319,9 @@ build/src/libultra/libc/llcvt.o: src/libultra/libc/llcvt.c $(RM_MDEBUG) # Build C files from assets + build/%.inc.c: %.png - $(ZAPD) btex -eh -tt $(lastword ,$(subst ., ,$(basename $<))) -i $< -o $@ + $(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@ build/assets/%.bin.inc.c: assets/%.bin $(ZAPD) bblb -eh -i $< -o $@ diff --git a/README.md b/README.md index 99ae2355ab..80d1e5d549 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ [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 -[progress]: https://zelda64.dev/progress.html -[progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/reports/progress_shield_mm.us.rev1.json +[progress]: https://zelda64.dev/games/mm +[progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/assets/csv/progress-mm-shield.json [contributors]: https://github.com/zeldaret/mm/graphs/contributors [contributors-badge]: https://img.shields.io/github/contributors/zeldaret/mm diff --git a/assets/xml/static/icon_item_gameover_static.xml b/assets/xml/interface/icon_item_gameover_static.xml similarity index 100% rename from assets/xml/static/icon_item_gameover_static.xml rename to assets/xml/interface/icon_item_gameover_static.xml diff --git a/assets/xml/static/daytelop_static.xml b/assets/xml/misc/daytelop_static.xml similarity index 100% rename from assets/xml/static/daytelop_static.xml rename to assets/xml/misc/daytelop_static.xml diff --git a/assets/xml/static/esp_daytelop_static.xml b/assets/xml/misc/esp_daytelop_static.xml similarity index 100% rename from assets/xml/static/esp_daytelop_static.xml rename to assets/xml/misc/esp_daytelop_static.xml diff --git a/assets/xml/static/fra_daytelop_static.xml b/assets/xml/misc/fra_daytelop_static.xml similarity index 100% rename from assets/xml/static/fra_daytelop_static.xml rename to assets/xml/misc/fra_daytelop_static.xml diff --git a/assets/xml/static/ger_daytelop_static.xml b/assets/xml/misc/ger_daytelop_static.xml similarity index 100% rename from assets/xml/static/ger_daytelop_static.xml rename to assets/xml/misc/ger_daytelop_static.xml diff --git a/assets/xml/static/nintendo_rogo_static.xml b/assets/xml/misc/nintendo_rogo_static.xml similarity index 100% rename from assets/xml/static/nintendo_rogo_static.xml rename to assets/xml/misc/nintendo_rogo_static.xml diff --git a/assets/xml/objects/gameplay_dangeon_keep.xml b/assets/xml/objects/gameplay_dangeon_keep.xml new file mode 100644 index 0000000000..19fabad2b3 --- /dev/null +++ b/assets/xml/objects/gameplay_dangeon_keep.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml new file mode 100644 index 0000000000..537d596a6b --- /dev/null +++ b/assets/xml/objects/gameplay_field_keep.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml new file mode 100644 index 0000000000..892749e732 --- /dev/null +++ b/assets/xml/objects/gameplay_keep.xml @@ -0,0 +1,1415 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ah.xml b/assets/xml/objects/object_ah.xml new file mode 100644 index 0000000000..296347dacb --- /dev/null +++ b/assets/xml/objects/object_ah.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ahg.xml b/assets/xml/objects/object_ahg.xml new file mode 100644 index 0000000000..c636f0baa3 --- /dev/null +++ b/assets/xml/objects/object_ahg.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_al.xml b/assets/xml/objects/object_al.xml new file mode 100644 index 0000000000..7a2ff1a52a --- /dev/null +++ b/assets/xml/objects/object_al.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_am.xml b/assets/xml/objects/object_am.xml new file mode 100644 index 0000000000..c135b7b0b6 --- /dev/null +++ b/assets/xml/objects/object_am.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_an1.xml b/assets/xml/objects/object_an1.xml new file mode 100644 index 0000000000..c2ae65d8b2 --- /dev/null +++ b/assets/xml/objects/object_an1.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_an2.xml b/assets/xml/objects/object_an2.xml new file mode 100644 index 0000000000..3adcc27f70 --- /dev/null +++ b/assets/xml/objects/object_an2.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_an3.xml b/assets/xml/objects/object_an3.xml new file mode 100644 index 0000000000..2d94b81b79 --- /dev/null +++ b/assets/xml/objects/object_an3.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_an4.xml b/assets/xml/objects/object_an4.xml new file mode 100644 index 0000000000..57088a072a --- /dev/null +++ b/assets/xml/objects/object_an4.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_and.xml b/assets/xml/objects/object_and.xml new file mode 100644 index 0000000000..269e2a73fe --- /dev/null +++ b/assets/xml/objects/object_and.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml new file mode 100644 index 0000000000..85fd13cecd --- /dev/null +++ b/assets/xml/objects/object_ani.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_aob.xml b/assets/xml/objects/object_aob.xml new file mode 100644 index 0000000000..f44ec32463 --- /dev/null +++ b/assets/xml/objects/object_aob.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_astr_obj.xml b/assets/xml/objects/object_astr_obj.xml new file mode 100644 index 0000000000..7a87bd61b7 --- /dev/null +++ b/assets/xml/objects/object_astr_obj.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_az.xml b/assets/xml/objects/object_az.xml new file mode 100644 index 0000000000..c192f6914f --- /dev/null +++ b/assets/xml/objects/object_az.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_b_heart.xml b/assets/xml/objects/object_b_heart.xml new file mode 100644 index 0000000000..789f05b379 --- /dev/null +++ b/assets/xml/objects/object_b_heart.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_bai.xml b/assets/xml/objects/object_bai.xml new file mode 100644 index 0000000000..ad8d8445bf --- /dev/null +++ b/assets/xml/objects/object_bai.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bal.xml b/assets/xml/objects/object_bal.xml new file mode 100644 index 0000000000..e564a4798d --- /dev/null +++ b/assets/xml/objects/object_bal.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bat.xml b/assets/xml/objects/object_bat.xml new file mode 100644 index 0000000000..35a5c158d9 --- /dev/null +++ b/assets/xml/objects/object_bat.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bb.xml b/assets/xml/objects/object_bb.xml new file mode 100644 index 0000000000..ba3e4cb94a --- /dev/null +++ b/assets/xml/objects/object_bb.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bba.xml b/assets/xml/objects/object_bba.xml new file mode 100644 index 0000000000..b172e9f770 --- /dev/null +++ b/assets/xml/objects/object_bba.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bdoor.xml b/assets/xml/objects/object_bdoor.xml new file mode 100644 index 0000000000..d74f4aa575 --- /dev/null +++ b/assets/xml/objects/object_bdoor.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bee.xml b/assets/xml/objects/object_bee.xml new file mode 100644 index 0000000000..b2c90324b0 --- /dev/null +++ b/assets/xml/objects/object_bee.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml new file mode 100644 index 0000000000..d623f9455a --- /dev/null +++ b/assets/xml/objects/object_bg.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bh.xml b/assets/xml/objects/object_bh.xml new file mode 100644 index 0000000000..d54e99e23c --- /dev/null +++ b/assets/xml/objects/object_bh.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_big_fwall.xml b/assets/xml/objects/object_big_fwall.xml new file mode 100644 index 0000000000..f3f51a4883 --- /dev/null +++ b/assets/xml/objects/object_big_fwall.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_bigicicle.xml b/assets/xml/objects/object_bigicicle.xml new file mode 100644 index 0000000000..3e1a7fd7eb --- /dev/null +++ b/assets/xml/objects/object_bigicicle.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bigokuta.xml b/assets/xml/objects/object_bigokuta.xml new file mode 100644 index 0000000000..b6783c15d4 --- /dev/null +++ b/assets/xml/objects/object_bigokuta.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bigpo.xml b/assets/xml/objects/object_bigpo.xml new file mode 100644 index 0000000000..5a930c9ac5 --- /dev/null +++ b/assets/xml/objects/object_bigpo.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bigslime.xml b/assets/xml/objects/object_bigslime.xml new file mode 100644 index 0000000000..d0238adef4 --- /dev/null +++ b/assets/xml/objects/object_bigslime.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bji.xml b/assets/xml/objects/object_bji.xml new file mode 100644 index 0000000000..e8c7fe9496 --- /dev/null +++ b/assets/xml/objects/object_bji.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bjt.xml b/assets/xml/objects/object_bjt.xml new file mode 100644 index 0000000000..9f0c0edc23 --- /dev/null +++ b/assets/xml/objects/object_bjt.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bob.xml b/assets/xml/objects/object_bob.xml new file mode 100644 index 0000000000..968a838d2f --- /dev/null +++ b/assets/xml/objects/object_bob.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boj.xml b/assets/xml/objects/object_boj.xml new file mode 100644 index 0000000000..d948ff5464 --- /dev/null +++ b/assets/xml/objects/object_boj.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bombf.xml b/assets/xml/objects/object_bombf.xml new file mode 100644 index 0000000000..a0e5cdef35 --- /dev/null +++ b/assets/xml/objects/object_bombf.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_bombiwa.xml b/assets/xml/objects/object_bombiwa.xml new file mode 100644 index 0000000000..6dbcaf2b59 --- /dev/null +++ b/assets/xml/objects/object_bombiwa.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss01.xml b/assets/xml/objects/object_boss01.xml new file mode 100644 index 0000000000..a9865a0962 --- /dev/null +++ b/assets/xml/objects/object_boss01.xml @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss02.xml b/assets/xml/objects/object_boss02.xml new file mode 100644 index 0000000000..f944de2421 --- /dev/null +++ b/assets/xml/objects/object_boss02.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml new file mode 100644 index 0000000000..14d7d3498e --- /dev/null +++ b/assets/xml/objects/object_boss03.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss04.xml b/assets/xml/objects/object_boss04.xml new file mode 100644 index 0000000000..d24ad986a9 --- /dev/null +++ b/assets/xml/objects/object_boss04.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss05.xml b/assets/xml/objects/object_boss05.xml new file mode 100644 index 0000000000..ec994d8242 --- /dev/null +++ b/assets/xml/objects/object_boss05.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss07.xml b/assets/xml/objects/object_boss07.xml new file mode 100644 index 0000000000..aa0ef8c886 --- /dev/null +++ b/assets/xml/objects/object_boss07.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss_hakugin.xml b/assets/xml/objects/object_boss_hakugin.xml new file mode 100644 index 0000000000..05302db78d --- /dev/null +++ b/assets/xml/objects/object_boss_hakugin.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_botihasira.xml b/assets/xml/objects/object_botihasira.xml new file mode 100644 index 0000000000..93c59f42fb --- /dev/null +++ b/assets/xml/objects/object_botihasira.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml new file mode 100644 index 0000000000..39d21765f7 --- /dev/null +++ b/assets/xml/objects/object_box.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boyo.xml b/assets/xml/objects/object_boyo.xml new file mode 100644 index 0000000000..0084c4825f --- /dev/null +++ b/assets/xml/objects/object_boyo.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_bsb.xml b/assets/xml/objects/object_bsb.xml new file mode 100644 index 0000000000..ddaadc33d9 --- /dev/null +++ b/assets/xml/objects/object_bsb.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bsmask.xml b/assets/xml/objects/object_bsmask.xml new file mode 100644 index 0000000000..e776cde1ac --- /dev/null +++ b/assets/xml/objects/object_bsmask.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bubble.xml b/assets/xml/objects/object_bubble.xml new file mode 100644 index 0000000000..4397a017f5 --- /dev/null +++ b/assets/xml/objects/object_bubble.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_cha.xml b/assets/xml/objects/object_cha.xml new file mode 100644 index 0000000000..12835da1f6 --- /dev/null +++ b/assets/xml/objects/object_cha.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_cne.xml b/assets/xml/objects/object_cne.xml new file mode 100644 index 0000000000..72447ceec5 --- /dev/null +++ b/assets/xml/objects/object_cne.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_comb.xml b/assets/xml/objects/object_comb.xml new file mode 100644 index 0000000000..df9359acc8 --- /dev/null +++ b/assets/xml/objects/object_comb.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_cow.xml b/assets/xml/objects/object_cow.xml new file mode 100644 index 0000000000..b440573447 --- /dev/null +++ b/assets/xml/objects/object_cow.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_crace_object.xml b/assets/xml/objects/object_crace_object.xml new file mode 100644 index 0000000000..06c007989d --- /dev/null +++ b/assets/xml/objects/object_crace_object.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_crow.xml b/assets/xml/objects/object_crow.xml new file mode 100644 index 0000000000..b3b004cd7b --- /dev/null +++ b/assets/xml/objects/object_crow.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_cs.xml b/assets/xml/objects/object_cs.xml new file mode 100644 index 0000000000..d55f866caf --- /dev/null +++ b/assets/xml/objects/object_cs.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ctower_rot.xml b/assets/xml/objects/object_ctower_rot.xml new file mode 100644 index 0000000000..515b4fa65e --- /dev/null +++ b/assets/xml/objects/object_ctower_rot.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_d_hsblock.xml b/assets/xml/objects/object_d_hsblock.xml new file mode 100644 index 0000000000..e9f90c011b --- /dev/null +++ b/assets/xml/objects/object_d_hsblock.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_d_lift.xml b/assets/xml/objects/object_d_lift.xml new file mode 100644 index 0000000000..bcd707d686 --- /dev/null +++ b/assets/xml/objects/object_d_lift.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_dai.xml b/assets/xml/objects/object_dai.xml new file mode 100644 index 0000000000..c39ef9a6df --- /dev/null +++ b/assets/xml/objects/object_dai.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_daiku.xml b/assets/xml/objects/object_daiku.xml new file mode 100644 index 0000000000..0c42532ecd --- /dev/null +++ b/assets/xml/objects/object_daiku.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_danpei_object.xml b/assets/xml/objects/object_danpei_object.xml new file mode 100644 index 0000000000..3f373a8ceb --- /dev/null +++ b/assets/xml/objects/object_danpei_object.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dblue_object.xml b/assets/xml/objects/object_dblue_object.xml new file mode 100644 index 0000000000..d49b368e14 --- /dev/null +++ b/assets/xml/objects/object_dblue_object.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_death.xml b/assets/xml/objects/object_death.xml new file mode 100644 index 0000000000..2aba9582d1 --- /dev/null +++ b/assets/xml/objects/object_death.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml new file mode 100644 index 0000000000..bd59555c48 --- /dev/null +++ b/assets/xml/objects/object_dekubaba.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dekucity_ana_obj.xml b/assets/xml/objects/object_dekucity_ana_obj.xml new file mode 100644 index 0000000000..620c34a046 --- /dev/null +++ b/assets/xml/objects/object_dekucity_ana_obj.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_dekucity_obj.xml b/assets/xml/objects/object_dekucity_obj.xml new file mode 100644 index 0000000000..1d680965e4 --- /dev/null +++ b/assets/xml/objects/object_dekucity_obj.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dekunuts.xml b/assets/xml/objects/object_dekunuts.xml new file mode 100644 index 0000000000..442dc756d8 --- /dev/null +++ b/assets/xml/objects/object_dekunuts.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_delf.xml b/assets/xml/objects/object_delf.xml new file mode 100644 index 0000000000..39996c0f09 --- /dev/null +++ b/assets/xml/objects/object_delf.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dhouse.xml b/assets/xml/objects/object_dhouse.xml new file mode 100644 index 0000000000..dd95b8b98f --- /dev/null +++ b/assets/xml/objects/object_dhouse.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dinofos.xml b/assets/xml/objects/object_dinofos.xml new file mode 100644 index 0000000000..83eade0dad --- /dev/null +++ b/assets/xml/objects/object_dinofos.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dkjail_obj.xml b/assets/xml/objects/object_dkjail_obj.xml new file mode 100644 index 0000000000..219181c6db --- /dev/null +++ b/assets/xml/objects/object_dkjail_obj.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_dmask.xml b/assets/xml/objects/object_dmask.xml new file mode 100644 index 0000000000..f2411c147c --- /dev/null +++ b/assets/xml/objects/object_dmask.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnk.xml b/assets/xml/objects/object_dnk.xml new file mode 100644 index 0000000000..209742fe18 --- /dev/null +++ b/assets/xml/objects/object_dnk.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dno.xml b/assets/xml/objects/object_dno.xml new file mode 100644 index 0000000000..16fa904c5b --- /dev/null +++ b/assets/xml/objects/object_dno.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnp.xml b/assets/xml/objects/object_dnp.xml new file mode 100644 index 0000000000..0f5655e9b6 --- /dev/null +++ b/assets/xml/objects/object_dnp.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnq.xml b/assets/xml/objects/object_dnq.xml new file mode 100644 index 0000000000..d286082bf8 --- /dev/null +++ b/assets/xml/objects/object_dnq.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dns.xml b/assets/xml/objects/object_dns.xml new file mode 100644 index 0000000000..64939670e3 --- /dev/null +++ b/assets/xml/objects/object_dns.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnt.xml b/assets/xml/objects/object_dnt.xml new file mode 100644 index 0000000000..d75f29cfc0 --- /dev/null +++ b/assets/xml/objects/object_dnt.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dodongo.xml b/assets/xml/objects/object_dodongo.xml new file mode 100644 index 0000000000..cf0fa37256 --- /dev/null +++ b/assets/xml/objects/object_dodongo.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dog.xml b/assets/xml/objects/object_dog.xml new file mode 100644 index 0000000000..7e9cd3e992 --- /dev/null +++ b/assets/xml/objects/object_dog.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dor01.xml b/assets/xml/objects/object_dor01.xml new file mode 100644 index 0000000000..39c950680f --- /dev/null +++ b/assets/xml/objects/object_dor01.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_dor02.xml b/assets/xml/objects/object_dor02.xml new file mode 100644 index 0000000000..0b64a9b1bd --- /dev/null +++ b/assets/xml/objects/object_dor02.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_dor03.xml b/assets/xml/objects/object_dor03.xml new file mode 100644 index 0000000000..c374837eaf --- /dev/null +++ b/assets/xml/objects/object_dor03.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_dor04.xml b/assets/xml/objects/object_dor04.xml new file mode 100644 index 0000000000..2d1ac5611d --- /dev/null +++ b/assets/xml/objects/object_dor04.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_dora.xml b/assets/xml/objects/object_dora.xml new file mode 100644 index 0000000000..6a09726665 --- /dev/null +++ b/assets/xml/objects/object_dora.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_driftice.xml b/assets/xml/objects/object_driftice.xml new file mode 100644 index 0000000000..0ddb6e2048 --- /dev/null +++ b/assets/xml/objects/object_driftice.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_drs.xml b/assets/xml/objects/object_drs.xml new file mode 100644 index 0000000000..35202d17bf --- /dev/null +++ b/assets/xml/objects/object_drs.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ds2.xml b/assets/xml/objects/object_ds2.xml new file mode 100644 index 0000000000..0745fad580 --- /dev/null +++ b/assets/xml/objects/object_ds2.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml new file mode 100644 index 0000000000..63ccca136b --- /dev/null +++ b/assets/xml/objects/object_ds2n.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dt.xml b/assets/xml/objects/object_dt.xml new file mode 100644 index 0000000000..a4df244adb --- /dev/null +++ b/assets/xml/objects/object_dt.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml new file mode 100644 index 0000000000..dc2ab5ed41 --- /dev/null +++ b/assets/xml/objects/object_dy_obj.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_efc_star_field.xml b/assets/xml/objects/object_efc_star_field.xml new file mode 100644 index 0000000000..72b7ef6367 --- /dev/null +++ b/assets/xml/objects/object_efc_star_field.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml new file mode 100644 index 0000000000..f251f9607b --- /dev/null +++ b/assets/xml/objects/object_efc_tw.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_eg.xml b/assets/xml/objects/object_eg.xml new file mode 100644 index 0000000000..1458afaec0 --- /dev/null +++ b/assets/xml/objects/object_eg.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ending_obj.xml b/assets/xml/objects/object_ending_obj.xml new file mode 100644 index 0000000000..ad13ce7b89 --- /dev/null +++ b/assets/xml/objects/object_ending_obj.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_f40_obj.xml b/assets/xml/objects/object_f40_obj.xml new file mode 100644 index 0000000000..59bff9d05e --- /dev/null +++ b/assets/xml/objects/object_f40_obj.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_f40_switch.xml b/assets/xml/objects/object_f40_switch.xml new file mode 100644 index 0000000000..a5c823baaa --- /dev/null +++ b/assets/xml/objects/object_f40_switch.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_f52_obj.xml b/assets/xml/objects/object_f52_obj.xml new file mode 100644 index 0000000000..7f35d8b1bb --- /dev/null +++ b/assets/xml/objects/object_f52_obj.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_f53_obj.xml b/assets/xml/objects/object_f53_obj.xml new file mode 100644 index 0000000000..8fef96ac8a --- /dev/null +++ b/assets/xml/objects/object_f53_obj.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fall.xml b/assets/xml/objects/object_fall.xml new file mode 100644 index 0000000000..f84ecffc5f --- /dev/null +++ b/assets/xml/objects/object_fall.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fall2.xml b/assets/xml/objects/object_fall2.xml new file mode 100644 index 0000000000..e616de260d --- /dev/null +++ b/assets/xml/objects/object_fall2.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_famos.xml b/assets/xml/objects/object_famos.xml new file mode 100644 index 0000000000..7cec70be54 --- /dev/null +++ b/assets/xml/objects/object_famos.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fb.xml b/assets/xml/objects/object_fb.xml new file mode 100644 index 0000000000..101ddbc5a7 --- /dev/null +++ b/assets/xml/objects/object_fb.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_firefly.xml b/assets/xml/objects/object_firefly.xml new file mode 100644 index 0000000000..f6d8f1bc71 --- /dev/null +++ b/assets/xml/objects/object_firefly.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml new file mode 100644 index 0000000000..3d02127c6d --- /dev/null +++ b/assets/xml/objects/object_fish.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_flowerpot.xml b/assets/xml/objects/object_flowerpot.xml new file mode 100644 index 0000000000..b6adc70d4c --- /dev/null +++ b/assets/xml/objects/object_flowerpot.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_fr.xml b/assets/xml/objects/object_fr.xml new file mode 100644 index 0000000000..b1d284de9f --- /dev/null +++ b/assets/xml/objects/object_fr.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fsn.xml b/assets/xml/objects/object_fsn.xml new file mode 100644 index 0000000000..f2d4b36485 --- /dev/null +++ b/assets/xml/objects/object_fsn.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml new file mode 100644 index 0000000000..83d2f9eff9 --- /dev/null +++ b/assets/xml/objects/object_fu.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fu_kaiten.xml b/assets/xml/objects/object_fu_kaiten.xml new file mode 100644 index 0000000000..bce80f68c1 --- /dev/null +++ b/assets/xml/objects/object_fu_kaiten.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fu_mato.xml b/assets/xml/objects/object_fu_mato.xml new file mode 100644 index 0000000000..b28899f3c9 --- /dev/null +++ b/assets/xml/objects/object_fu_mato.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_funen.xml b/assets/xml/objects/object_funen.xml new file mode 100644 index 0000000000..5f8c18c3d3 --- /dev/null +++ b/assets/xml/objects/object_funen.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_fusen.xml b/assets/xml/objects/object_fusen.xml new file mode 100644 index 0000000000..0ff9e9f6c1 --- /dev/null +++ b/assets/xml/objects/object_fusen.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_fwall.xml b/assets/xml/objects/object_fwall.xml new file mode 100644 index 0000000000..1f7fb575bb --- /dev/null +++ b/assets/xml/objects/object_fwall.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_fz.xml b/assets/xml/objects/object_fz.xml new file mode 100644 index 0000000000..0c0b2ce2b4 --- /dev/null +++ b/assets/xml/objects/object_fz.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml new file mode 100644 index 0000000000..e401fd0888 --- /dev/null +++ b/assets/xml/objects/object_ge1.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml new file mode 100644 index 0000000000..357b832843 --- /dev/null +++ b/assets/xml/objects/object_geldb.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gg.xml b/assets/xml/objects/object_gg.xml new file mode 100644 index 0000000000..e1ac1c779b --- /dev/null +++ b/assets/xml/objects/object_gg.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ghaka.xml b/assets/xml/objects/object_ghaka.xml new file mode 100644 index 0000000000..6ca9a32b0a --- /dev/null +++ b/assets/xml/objects/object_ghaka.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_arrow.xml b/assets/xml/objects/object_gi_arrow.xml new file mode 100644 index 0000000000..ab3bcbde9f --- /dev/null +++ b/assets/xml/objects/object_gi_arrow.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_arrowcase.xml b/assets/xml/objects/object_gi_arrowcase.xml new file mode 100644 index 0000000000..ae10b4faae --- /dev/null +++ b/assets/xml/objects/object_gi_arrowcase.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bean.xml b/assets/xml/objects/object_gi_bean.xml new file mode 100644 index 0000000000..e19b48d14b --- /dev/null +++ b/assets/xml/objects/object_gi_bean.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_bigbomb.xml b/assets/xml/objects/object_gi_bigbomb.xml new file mode 100644 index 0000000000..27d2a07416 --- /dev/null +++ b/assets/xml/objects/object_gi_bigbomb.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bomb_1.xml b/assets/xml/objects/object_gi_bomb_1.xml new file mode 100644 index 0000000000..98af218735 --- /dev/null +++ b/assets/xml/objects/object_gi_bomb_1.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_bomb_2.xml b/assets/xml/objects/object_gi_bomb_2.xml new file mode 100644 index 0000000000..ecd07c048f --- /dev/null +++ b/assets/xml/objects/object_gi_bomb_2.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_bombpouch.xml b/assets/xml/objects/object_gi_bombpouch.xml new file mode 100644 index 0000000000..06eff7cedb --- /dev/null +++ b/assets/xml/objects/object_gi_bombpouch.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bosskey.xml b/assets/xml/objects/object_gi_bosskey.xml new file mode 100644 index 0000000000..ae5ac2e750 --- /dev/null +++ b/assets/xml/objects/object_gi_bosskey.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_bottle.xml b/assets/xml/objects/object_gi_bottle.xml new file mode 100644 index 0000000000..95a7b8bce4 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_04.xml b/assets/xml/objects/object_gi_bottle_04.xml new file mode 100644 index 0000000000..f215d40599 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_04.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_15.xml b/assets/xml/objects/object_gi_bottle_15.xml new file mode 100644 index 0000000000..afea0f6ca2 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_15.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_16.xml b/assets/xml/objects/object_gi_bottle_16.xml new file mode 100644 index 0000000000..7ee7f36408 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_16.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_21.xml b/assets/xml/objects/object_gi_bottle_21.xml new file mode 100644 index 0000000000..779b474cd0 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_21.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_22.xml b/assets/xml/objects/object_gi_bottle_22.xml new file mode 100644 index 0000000000..d613970143 --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_22.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_red.xml b/assets/xml/objects/object_gi_bottle_red.xml new file mode 100644 index 0000000000..c2f189dcef --- /dev/null +++ b/assets/xml/objects/object_gi_bottle_red.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_bow.xml b/assets/xml/objects/object_gi_bow.xml new file mode 100644 index 0000000000..b7d62e12d3 --- /dev/null +++ b/assets/xml/objects/object_gi_bow.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_camera.xml b/assets/xml/objects/object_gi_camera.xml new file mode 100644 index 0000000000..81641ca309 --- /dev/null +++ b/assets/xml/objects/object_gi_camera.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_compass.xml b/assets/xml/objects/object_gi_compass.xml new file mode 100644 index 0000000000..49f7cf87e7 --- /dev/null +++ b/assets/xml/objects/object_gi_compass.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_fieldmap.xml b/assets/xml/objects/object_gi_fieldmap.xml new file mode 100644 index 0000000000..bdb77ad0b1 --- /dev/null +++ b/assets/xml/objects/object_gi_fieldmap.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_fish.xml b/assets/xml/objects/object_gi_fish.xml new file mode 100644 index 0000000000..339f2d1445 --- /dev/null +++ b/assets/xml/objects/object_gi_fish.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_ghost.xml b/assets/xml/objects/object_gi_ghost.xml new file mode 100644 index 0000000000..813ba7d4ea --- /dev/null +++ b/assets/xml/objects/object_gi_ghost.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_glasses.xml b/assets/xml/objects/object_gi_glasses.xml new file mode 100644 index 0000000000..571f0ea6df --- /dev/null +++ b/assets/xml/objects/object_gi_glasses.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_gold_dust.xml b/assets/xml/objects/object_gi_gold_dust.xml new file mode 100644 index 0000000000..ed787b2b2e --- /dev/null +++ b/assets/xml/objects/object_gi_gold_dust.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_golonmask.xml b/assets/xml/objects/object_gi_golonmask.xml new file mode 100644 index 0000000000..c845fd0bdf --- /dev/null +++ b/assets/xml/objects/object_gi_golonmask.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_heart.xml b/assets/xml/objects/object_gi_heart.xml new file mode 100644 index 0000000000..0917876aa7 --- /dev/null +++ b/assets/xml/objects/object_gi_heart.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_hearts.xml b/assets/xml/objects/object_gi_hearts.xml new file mode 100644 index 0000000000..442ba21c73 --- /dev/null +++ b/assets/xml/objects/object_gi_hearts.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_hookshot.xml b/assets/xml/objects/object_gi_hookshot.xml new file mode 100644 index 0000000000..37a0b46426 --- /dev/null +++ b/assets/xml/objects/object_gi_hookshot.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_insect.xml b/assets/xml/objects/object_gi_insect.xml new file mode 100644 index 0000000000..a7c3107ea5 --- /dev/null +++ b/assets/xml/objects/object_gi_insect.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_key.xml b/assets/xml/objects/object_gi_key.xml new file mode 100644 index 0000000000..bf4cdb7271 --- /dev/null +++ b/assets/xml/objects/object_gi_key.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_ki_tan_mask.xml b/assets/xml/objects/object_gi_ki_tan_mask.xml new file mode 100644 index 0000000000..3135766315 --- /dev/null +++ b/assets/xml/objects/object_gi_ki_tan_mask.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_liquid.xml b/assets/xml/objects/object_gi_liquid.xml new file mode 100644 index 0000000000..bec768cfe0 --- /dev/null +++ b/assets/xml/objects/object_gi_liquid.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_loach.xml b/assets/xml/objects/object_gi_loach.xml new file mode 100644 index 0000000000..c9c81f0b9a --- /dev/null +++ b/assets/xml/objects/object_gi_loach.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_longsword.xml b/assets/xml/objects/object_gi_longsword.xml new file mode 100644 index 0000000000..6be60d411d --- /dev/null +++ b/assets/xml/objects/object_gi_longsword.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_m_arrow.xml b/assets/xml/objects/object_gi_m_arrow.xml new file mode 100644 index 0000000000..6351783b54 --- /dev/null +++ b/assets/xml/objects/object_gi_m_arrow.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_magicmushroom.xml b/assets/xml/objects/object_gi_magicmushroom.xml new file mode 100644 index 0000000000..ae6cbeb49c --- /dev/null +++ b/assets/xml/objects/object_gi_magicmushroom.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_magicpot.xml b/assets/xml/objects/object_gi_magicpot.xml new file mode 100644 index 0000000000..2abd48eeff --- /dev/null +++ b/assets/xml/objects/object_gi_magicpot.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_map.xml b/assets/xml/objects/object_gi_map.xml new file mode 100644 index 0000000000..250bb4613a --- /dev/null +++ b/assets/xml/objects/object_gi_map.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_mask03.xml b/assets/xml/objects/object_gi_mask03.xml new file mode 100644 index 0000000000..561ddef83a --- /dev/null +++ b/assets/xml/objects/object_gi_mask03.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask05.xml b/assets/xml/objects/object_gi_mask05.xml new file mode 100644 index 0000000000..307a3b2f43 --- /dev/null +++ b/assets/xml/objects/object_gi_mask05.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask06.xml b/assets/xml/objects/object_gi_mask06.xml new file mode 100644 index 0000000000..256d9a91eb --- /dev/null +++ b/assets/xml/objects/object_gi_mask06.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask09.xml b/assets/xml/objects/object_gi_mask09.xml new file mode 100644 index 0000000000..d6db047d57 --- /dev/null +++ b/assets/xml/objects/object_gi_mask09.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask10.xml b/assets/xml/objects/object_gi_mask10.xml new file mode 100644 index 0000000000..adb3ee1d22 --- /dev/null +++ b/assets/xml/objects/object_gi_mask10.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask11.xml b/assets/xml/objects/object_gi_mask11.xml new file mode 100644 index 0000000000..46de5c2cdb --- /dev/null +++ b/assets/xml/objects/object_gi_mask11.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask12.xml b/assets/xml/objects/object_gi_mask12.xml new file mode 100644 index 0000000000..dced8d8eb6 --- /dev/null +++ b/assets/xml/objects/object_gi_mask12.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask13.xml b/assets/xml/objects/object_gi_mask13.xml new file mode 100644 index 0000000000..b6d2c77336 --- /dev/null +++ b/assets/xml/objects/object_gi_mask13.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask14.xml b/assets/xml/objects/object_gi_mask14.xml new file mode 100644 index 0000000000..a3c96bb9d6 --- /dev/null +++ b/assets/xml/objects/object_gi_mask14.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask15.xml b/assets/xml/objects/object_gi_mask15.xml new file mode 100644 index 0000000000..bc612c0755 --- /dev/null +++ b/assets/xml/objects/object_gi_mask15.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask16.xml b/assets/xml/objects/object_gi_mask16.xml new file mode 100644 index 0000000000..57124d4d43 --- /dev/null +++ b/assets/xml/objects/object_gi_mask16.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask17.xml b/assets/xml/objects/object_gi_mask17.xml new file mode 100644 index 0000000000..a509ca27ed --- /dev/null +++ b/assets/xml/objects/object_gi_mask17.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask18.xml b/assets/xml/objects/object_gi_mask18.xml new file mode 100644 index 0000000000..8e1c8ca547 --- /dev/null +++ b/assets/xml/objects/object_gi_mask18.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask20.xml b/assets/xml/objects/object_gi_mask20.xml new file mode 100644 index 0000000000..8b87c44fa0 --- /dev/null +++ b/assets/xml/objects/object_gi_mask20.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask21.xml b/assets/xml/objects/object_gi_mask21.xml new file mode 100644 index 0000000000..175d22b85f --- /dev/null +++ b/assets/xml/objects/object_gi_mask21.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask22.xml b/assets/xml/objects/object_gi_mask22.xml new file mode 100644 index 0000000000..7b3a49e537 --- /dev/null +++ b/assets/xml/objects/object_gi_mask22.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask23.xml b/assets/xml/objects/object_gi_mask23.xml new file mode 100644 index 0000000000..458b7c825a --- /dev/null +++ b/assets/xml/objects/object_gi_mask23.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_melody.xml b/assets/xml/objects/object_gi_melody.xml new file mode 100644 index 0000000000..d7617e7a69 --- /dev/null +++ b/assets/xml/objects/object_gi_melody.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_milk.xml b/assets/xml/objects/object_gi_milk.xml new file mode 100644 index 0000000000..137dae7779 --- /dev/null +++ b/assets/xml/objects/object_gi_milk.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_mssa.xml b/assets/xml/objects/object_gi_mssa.xml new file mode 100644 index 0000000000..6b61b00f5f --- /dev/null +++ b/assets/xml/objects/object_gi_mssa.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_nuts.xml b/assets/xml/objects/object_gi_nuts.xml new file mode 100644 index 0000000000..073e7db8f6 --- /dev/null +++ b/assets/xml/objects/object_gi_nuts.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_nutsmask.xml b/assets/xml/objects/object_gi_nutsmask.xml new file mode 100644 index 0000000000..e34a593f22 --- /dev/null +++ b/assets/xml/objects/object_gi_nutsmask.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_ocarina.xml b/assets/xml/objects/object_gi_ocarina.xml new file mode 100644 index 0000000000..7b968a4912 --- /dev/null +++ b/assets/xml/objects/object_gi_ocarina.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_purse.xml b/assets/xml/objects/object_gi_purse.xml new file mode 100644 index 0000000000..49cf9fd370 --- /dev/null +++ b/assets/xml/objects/object_gi_purse.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_rabit_mask.xml b/assets/xml/objects/object_gi_rabit_mask.xml new file mode 100644 index 0000000000..172c080f11 --- /dev/null +++ b/assets/xml/objects/object_gi_rabit_mask.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve00.xml b/assets/xml/objects/object_gi_reserve00.xml new file mode 100644 index 0000000000..1527a26303 --- /dev/null +++ b/assets/xml/objects/object_gi_reserve00.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve01.xml b/assets/xml/objects/object_gi_reserve01.xml new file mode 100644 index 0000000000..c31c76698f --- /dev/null +++ b/assets/xml/objects/object_gi_reserve01.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_b_00.xml b/assets/xml/objects/object_gi_reserve_b_00.xml new file mode 100644 index 0000000000..1c1e543905 --- /dev/null +++ b/assets/xml/objects/object_gi_reserve_b_00.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_b_01.xml b/assets/xml/objects/object_gi_reserve_b_01.xml new file mode 100644 index 0000000000..574763ee91 --- /dev/null +++ b/assets/xml/objects/object_gi_reserve_b_01.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_c_00.xml b/assets/xml/objects/object_gi_reserve_c_00.xml new file mode 100644 index 0000000000..86c6b15fbd --- /dev/null +++ b/assets/xml/objects/object_gi_reserve_c_00.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_c_01.xml b/assets/xml/objects/object_gi_reserve_c_01.xml new file mode 100644 index 0000000000..da15309709 --- /dev/null +++ b/assets/xml/objects/object_gi_reserve_c_01.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_rupy.xml b/assets/xml/objects/object_gi_rupy.xml new file mode 100644 index 0000000000..69cd8bf5c8 --- /dev/null +++ b/assets/xml/objects/object_gi_rupy.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_schedule.xml b/assets/xml/objects/object_gi_schedule.xml new file mode 100644 index 0000000000..e5025a9938 --- /dev/null +++ b/assets/xml/objects/object_gi_schedule.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_seahorse.xml b/assets/xml/objects/object_gi_seahorse.xml new file mode 100644 index 0000000000..f35e2edc97 --- /dev/null +++ b/assets/xml/objects/object_gi_seahorse.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_shield_2.xml b/assets/xml/objects/object_gi_shield_2.xml new file mode 100644 index 0000000000..eb9fec8d2f --- /dev/null +++ b/assets/xml/objects/object_gi_shield_2.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_shield_3.xml b/assets/xml/objects/object_gi_shield_3.xml new file mode 100644 index 0000000000..8e011bb92a --- /dev/null +++ b/assets/xml/objects/object_gi_shield_3.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_soldout.xml b/assets/xml/objects/object_gi_soldout.xml new file mode 100644 index 0000000000..8a733af02e --- /dev/null +++ b/assets/xml/objects/object_gi_soldout.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_soul.xml b/assets/xml/objects/object_gi_soul.xml new file mode 100644 index 0000000000..945670888b --- /dev/null +++ b/assets/xml/objects/object_gi_soul.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_stick.xml b/assets/xml/objects/object_gi_stick.xml new file mode 100644 index 0000000000..c038af3571 --- /dev/null +++ b/assets/xml/objects/object_gi_stick.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_gi_stonemask.xml b/assets/xml/objects/object_gi_stonemask.xml new file mode 100644 index 0000000000..9d3b62b8c2 --- /dev/null +++ b/assets/xml/objects/object_gi_stonemask.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_sutaru.xml b/assets/xml/objects/object_gi_sutaru.xml new file mode 100644 index 0000000000..3b991123e8 --- /dev/null +++ b/assets/xml/objects/object_gi_sutaru.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gi_sword_1.xml b/assets/xml/objects/object_gi_sword_1.xml new file mode 100644 index 0000000000..a03de82d51 --- /dev/null +++ b/assets/xml/objects/object_gi_sword_1.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_2.xml b/assets/xml/objects/object_gi_sword_2.xml new file mode 100644 index 0000000000..045936ef2a --- /dev/null +++ b/assets/xml/objects/object_gi_sword_2.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_3.xml b/assets/xml/objects/object_gi_sword_3.xml new file mode 100644 index 0000000000..79a2079916 --- /dev/null +++ b/assets/xml/objects/object_gi_sword_3.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_4.xml b/assets/xml/objects/object_gi_sword_4.xml new file mode 100644 index 0000000000..b5c826dc36 --- /dev/null +++ b/assets/xml/objects/object_gi_sword_4.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_gi_truth_mask.xml b/assets/xml/objects/object_gi_truth_mask.xml new file mode 100644 index 0000000000..52fdaaf65a --- /dev/null +++ b/assets/xml/objects/object_gi_truth_mask.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_gi_zoramask.xml b/assets/xml/objects/object_gi_zoramask.xml new file mode 100644 index 0000000000..c5ba218b41 --- /dev/null +++ b/assets/xml/objects/object_gi_zoramask.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_giant.xml b/assets/xml/objects/object_giant.xml new file mode 100644 index 0000000000..9e1815528e --- /dev/null +++ b/assets/xml/objects/object_giant.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gk.xml b/assets/xml/objects/object_gk.xml new file mode 100644 index 0000000000..420f544f19 --- /dev/null +++ b/assets/xml/objects/object_gk.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml new file mode 100644 index 0000000000..ee793c256a --- /dev/null +++ b/assets/xml/objects/object_gla.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gm.xml b/assets/xml/objects/object_gm.xml new file mode 100644 index 0000000000..50c852ade8 --- /dev/null +++ b/assets/xml/objects/object_gm.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_gmo.xml b/assets/xml/objects/object_gmo.xml new file mode 100644 index 0000000000..732634d761 --- /dev/null +++ b/assets/xml/objects/object_gmo.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_goroiwa.xml b/assets/xml/objects/object_goroiwa.xml new file mode 100644 index 0000000000..e6ddfe7c16 --- /dev/null +++ b/assets/xml/objects/object_goroiwa.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_goronswitch.xml b/assets/xml/objects/object_goronswitch.xml new file mode 100644 index 0000000000..a6a0f996f1 --- /dev/null +++ b/assets/xml/objects/object_goronswitch.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_grasshopper.xml b/assets/xml/objects/object_grasshopper.xml new file mode 100644 index 0000000000..5b8ee82af2 --- /dev/null +++ b/assets/xml/objects/object_grasshopper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gs.xml b/assets/xml/objects/object_gs.xml new file mode 100644 index 0000000000..1e9b159dfe --- /dev/null +++ b/assets/xml/objects/object_gs.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_ha.xml b/assets/xml/objects/object_ha.xml new file mode 100644 index 0000000000..f3d3f10290 --- /dev/null +++ b/assets/xml/objects/object_ha.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_haka_obj.xml b/assets/xml/objects/object_haka_obj.xml new file mode 100644 index 0000000000..57f34f0d11 --- /dev/null +++ b/assets/xml/objects/object_haka_obj.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hakaisi.xml b/assets/xml/objects/object_hakaisi.xml new file mode 100644 index 0000000000..82e80242e6 --- /dev/null +++ b/assets/xml/objects/object_hakaisi.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hakugin_demo.xml b/assets/xml/objects/object_hakugin_demo.xml new file mode 100644 index 0000000000..24c7a2ba2a --- /dev/null +++ b/assets/xml/objects/object_hakugin_demo.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_hakugin_obj.xml b/assets/xml/objects/object_hakugin_obj.xml new file mode 100644 index 0000000000..412d0bdd3e --- /dev/null +++ b/assets/xml/objects/object_hakugin_obj.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hana.xml b/assets/xml/objects/object_hana.xml new file mode 100644 index 0000000000..3812a4ff59 --- /dev/null +++ b/assets/xml/objects/object_hana.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hanareyama_obj.xml b/assets/xml/objects/object_hanareyama_obj.xml new file mode 100644 index 0000000000..ba213a5856 --- /dev/null +++ b/assets/xml/objects/object_hanareyama_obj.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_harfgibud.xml b/assets/xml/objects/object_harfgibud.xml new file mode 100644 index 0000000000..9a9bf4745c --- /dev/null +++ b/assets/xml/objects/object_harfgibud.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hariko.xml b/assets/xml/objects/object_hariko.xml new file mode 100644 index 0000000000..e0f139b883 --- /dev/null +++ b/assets/xml/objects/object_hariko.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml new file mode 100644 index 0000000000..3131a6628d --- /dev/null +++ b/assets/xml/objects/object_hata.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hgdoor.xml b/assets/xml/objects/object_hgdoor.xml new file mode 100644 index 0000000000..e897103bf6 --- /dev/null +++ b/assets/xml/objects/object_hgdoor.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hintnuts.xml b/assets/xml/objects/object_hintnuts.xml new file mode 100644 index 0000000000..655c8ae3c4 --- /dev/null +++ b/assets/xml/objects/object_hintnuts.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_horse_game_check.xml b/assets/xml/objects/object_horse_game_check.xml new file mode 100644 index 0000000000..1ea72ac57c --- /dev/null +++ b/assets/xml/objects/object_horse_game_check.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_horse_link_child.xml b/assets/xml/objects/object_horse_link_child.xml new file mode 100644 index 0000000000..f844224fa5 --- /dev/null +++ b/assets/xml/objects/object_horse_link_child.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hs.xml b/assets/xml/objects/object_hs.xml new file mode 100644 index 0000000000..3151288155 --- /dev/null +++ b/assets/xml/objects/object_hs.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hsstump.xml b/assets/xml/objects/object_hsstump.xml new file mode 100644 index 0000000000..f94f0ed4e2 --- /dev/null +++ b/assets/xml/objects/object_hsstump.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_hunsui.xml b/assets/xml/objects/object_hunsui.xml new file mode 100644 index 0000000000..878bf704d6 --- /dev/null +++ b/assets/xml/objects/object_hunsui.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ice_block.xml b/assets/xml/objects/object_ice_block.xml new file mode 100644 index 0000000000..1e14ea5b5f --- /dev/null +++ b/assets/xml/objects/object_ice_block.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_icefloe.xml b/assets/xml/objects/object_icefloe.xml new file mode 100644 index 0000000000..cb9b321a31 --- /dev/null +++ b/assets/xml/objects/object_icefloe.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_icicle.xml b/assets/xml/objects/object_icicle.xml new file mode 100644 index 0000000000..4f7bab8a24 --- /dev/null +++ b/assets/xml/objects/object_icicle.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml new file mode 100644 index 0000000000..34dcac8f2c --- /dev/null +++ b/assets/xml/objects/object_ik.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ikana_obj.xml b/assets/xml/objects/object_ikana_obj.xml new file mode 100644 index 0000000000..66398991b9 --- /dev/null +++ b/assets/xml/objects/object_ikana_obj.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ikn_demo.xml b/assets/xml/objects/object_ikn_demo.xml new file mode 100644 index 0000000000..69d225933c --- /dev/null +++ b/assets/xml/objects/object_ikn_demo.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ikninside_obj.xml b/assets/xml/objects/object_ikninside_obj.xml new file mode 100644 index 0000000000..98ae6d34f0 --- /dev/null +++ b/assets/xml/objects/object_ikninside_obj.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_iknv_obj.xml b/assets/xml/objects/object_iknv_obj.xml new file mode 100644 index 0000000000..1e10d813c0 --- /dev/null +++ b/assets/xml/objects/object_iknv_obj.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_in.xml b/assets/xml/objects/object_in.xml new file mode 100644 index 0000000000..07969fe80f --- /dev/null +++ b/assets/xml/objects/object_in.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_in2.xml b/assets/xml/objects/object_in2.xml new file mode 100644 index 0000000000..34a942882a --- /dev/null +++ b/assets/xml/objects/object_in2.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_inibs_object.xml b/assets/xml/objects/object_inibs_object.xml new file mode 100644 index 0000000000..e1d454ae71 --- /dev/null +++ b/assets/xml/objects/object_inibs_object.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ishi.xml b/assets/xml/objects/object_ishi.xml new file mode 100644 index 0000000000..6e48cf5f4e --- /dev/null +++ b/assets/xml/objects/object_ishi.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_jg.xml b/assets/xml/objects/object_jg.xml new file mode 100644 index 0000000000..10253e155d --- /dev/null +++ b/assets/xml/objects/object_jg.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_js.xml b/assets/xml/objects/object_js.xml new file mode 100644 index 0000000000..be9246ab66 --- /dev/null +++ b/assets/xml/objects/object_js.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_jso.xml b/assets/xml/objects/object_jso.xml new file mode 100644 index 0000000000..777c6e53c3 --- /dev/null +++ b/assets/xml/objects/object_jso.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ka.xml b/assets/xml/objects/object_ka.xml new file mode 100644 index 0000000000..2944a00b24 --- /dev/null +++ b/assets/xml/objects/object_ka.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kaizoku_obj.xml b/assets/xml/objects/object_kaizoku_obj.xml new file mode 100644 index 0000000000..a38d16827b --- /dev/null +++ b/assets/xml/objects/object_kaizoku_obj.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kamejima.xml b/assets/xml/objects/object_kamejima.xml new file mode 100644 index 0000000000..8bdb54d06c --- /dev/null +++ b/assets/xml/objects/object_kamejima.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kanban.xml b/assets/xml/objects/object_kanban.xml new file mode 100644 index 0000000000..b821aa2883 --- /dev/null +++ b/assets/xml/objects/object_kanban.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kbt.xml b/assets/xml/objects/object_kbt.xml new file mode 100644 index 0000000000..b3ab0baaf8 --- /dev/null +++ b/assets/xml/objects/object_kbt.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_keikoku_demo.xml b/assets/xml/objects/object_keikoku_demo.xml new file mode 100644 index 0000000000..994b682f3b --- /dev/null +++ b/assets/xml/objects/object_keikoku_demo.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_keikoku_obj.xml b/assets/xml/objects/object_keikoku_obj.xml new file mode 100644 index 0000000000..ff5a6899cb --- /dev/null +++ b/assets/xml/objects/object_keikoku_obj.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kepn_koya.xml b/assets/xml/objects/object_kepn_koya.xml new file mode 100644 index 0000000000..893892d25c --- /dev/null +++ b/assets/xml/objects/object_kepn_koya.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kgy.xml b/assets/xml/objects/object_kgy.xml new file mode 100644 index 0000000000..856c5883d9 --- /dev/null +++ b/assets/xml/objects/object_kgy.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kibako.xml b/assets/xml/objects/object_kibako.xml new file mode 100644 index 0000000000..138894b0fb --- /dev/null +++ b/assets/xml/objects/object_kibako.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_kibako2.xml b/assets/xml/objects/object_kibako2.xml new file mode 100644 index 0000000000..098a5318d0 --- /dev/null +++ b/assets/xml/objects/object_kibako2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kin2_obj.xml b/assets/xml/objects/object_kin2_obj.xml new file mode 100644 index 0000000000..93e55786cc --- /dev/null +++ b/assets/xml/objects/object_kin2_obj.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kinsta1_obj.xml b/assets/xml/objects/object_kinsta1_obj.xml new file mode 100644 index 0000000000..48d40c5271 --- /dev/null +++ b/assets/xml/objects/object_kinsta1_obj.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_kinsta2_obj.xml b/assets/xml/objects/object_kinsta2_obj.xml new file mode 100644 index 0000000000..f27778b1ac --- /dev/null +++ b/assets/xml/objects/object_kinsta2_obj.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_kitan.xml b/assets/xml/objects/object_kitan.xml new file mode 100644 index 0000000000..3884470f94 --- /dev/null +++ b/assets/xml/objects/object_kitan.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_knight.xml b/assets/xml/objects/object_knight.xml new file mode 100644 index 0000000000..bbd2d7b939 --- /dev/null +++ b/assets/xml/objects/object_knight.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kujiya.xml b/assets/xml/objects/object_kujiya.xml new file mode 100644 index 0000000000..3b17d43c08 --- /dev/null +++ b/assets/xml/objects/object_kujiya.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kumo30.xml b/assets/xml/objects/object_kumo30.xml new file mode 100644 index 0000000000..24e8d39742 --- /dev/null +++ b/assets/xml/objects/object_kumo30.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kusa.xml b/assets/xml/objects/object_kusa.xml new file mode 100644 index 0000000000..0d36569a55 --- /dev/null +++ b/assets/xml/objects/object_kusa.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml new file mode 100644 index 0000000000..24c16e1fcb --- /dev/null +++ b/assets/xml/objects/object_kz.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kzsaku.xml b/assets/xml/objects/object_kzsaku.xml new file mode 100644 index 0000000000..4cfce2de2b --- /dev/null +++ b/assets/xml/objects/object_kzsaku.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_ladder.xml b/assets/xml/objects/object_ladder.xml new file mode 100644 index 0000000000..6e42412eca --- /dev/null +++ b/assets/xml/objects/object_ladder.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_last_obj.xml b/assets/xml/objects/object_last_obj.xml new file mode 100644 index 0000000000..03dbddcf22 --- /dev/null +++ b/assets/xml/objects/object_last_obj.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_lastday.xml b/assets/xml/objects/object_lastday.xml new file mode 100644 index 0000000000..9988ec1f84 --- /dev/null +++ b/assets/xml/objects/object_lastday.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_lbfshot.xml b/assets/xml/objects/object_lbfshot.xml new file mode 100644 index 0000000000..325ddf49ee --- /dev/null +++ b/assets/xml/objects/object_lbfshot.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_lightblock.xml b/assets/xml/objects/object_lightblock.xml new file mode 100644 index 0000000000..207b03020f --- /dev/null +++ b/assets/xml/objects/object_lightblock.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_lightswitch.xml b/assets/xml/objects/object_lightswitch.xml new file mode 100644 index 0000000000..3d5c3aee2b --- /dev/null +++ b/assets/xml/objects/object_lightswitch.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_link_boy.xml b/assets/xml/objects/object_link_boy.xml new file mode 100644 index 0000000000..8bfd17e988 --- /dev/null +++ b/assets/xml/objects/object_link_boy.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml new file mode 100644 index 0000000000..86c5969095 --- /dev/null +++ b/assets/xml/objects/object_link_child.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_goron.xml b/assets/xml/objects/object_link_goron.xml new file mode 100644 index 0000000000..05336d6dbe --- /dev/null +++ b/assets/xml/objects/object_link_goron.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_nuts.xml b/assets/xml/objects/object_link_nuts.xml new file mode 100644 index 0000000000..169dc848aa --- /dev/null +++ b/assets/xml/objects/object_link_nuts.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_zora.xml b/assets/xml/objects/object_link_zora.xml new file mode 100644 index 0000000000..e3bbaba951 --- /dev/null +++ b/assets/xml/objects/object_link_zora.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_lodmoon.xml b/assets/xml/objects/object_lodmoon.xml new file mode 100644 index 0000000000..46d9f8e72b --- /dev/null +++ b/assets/xml/objects/object_lodmoon.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_lotus.xml b/assets/xml/objects/object_lotus.xml new file mode 100644 index 0000000000..a9835b81b4 --- /dev/null +++ b/assets/xml/objects/object_lotus.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_ma1.xml b/assets/xml/objects/object_ma1.xml new file mode 100644 index 0000000000..98444a884c --- /dev/null +++ b/assets/xml/objects/object_ma1.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ma2.xml b/assets/xml/objects/object_ma2.xml new file mode 100644 index 0000000000..523dfe212c --- /dev/null +++ b/assets/xml/objects/object_ma2.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mag.xml b/assets/xml/objects/object_mag.xml new file mode 100644 index 0000000000..061ff6bca9 --- /dev/null +++ b/assets/xml/objects/object_mag.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mamenoki.xml b/assets/xml/objects/object_mamenoki.xml new file mode 100644 index 0000000000..9ce4644c39 --- /dev/null +++ b/assets/xml/objects/object_mamenoki.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_market_obj.xml b/assets/xml/objects/object_market_obj.xml new file mode 100644 index 0000000000..81ab838f1f --- /dev/null +++ b/assets/xml/objects/object_market_obj.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_maruta.xml b/assets/xml/objects/object_maruta.xml new file mode 100644 index 0000000000..e61e1162b0 --- /dev/null +++ b/assets/xml/objects/object_maruta.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_bakuretu.xml b/assets/xml/objects/object_mask_bakuretu.xml new file mode 100644 index 0000000000..2eed781718 --- /dev/null +++ b/assets/xml/objects/object_mask_bakuretu.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_bigelf.xml b/assets/xml/objects/object_mask_bigelf.xml new file mode 100644 index 0000000000..762d118089 --- /dev/null +++ b/assets/xml/objects/object_mask_bigelf.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_boy.xml b/assets/xml/objects/object_mask_boy.xml new file mode 100644 index 0000000000..e0f93797e1 --- /dev/null +++ b/assets/xml/objects/object_mask_boy.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_bree.xml b/assets/xml/objects/object_mask_bree.xml new file mode 100644 index 0000000000..9fda443c83 --- /dev/null +++ b/assets/xml/objects/object_mask_bree.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_bu_san.xml b/assets/xml/objects/object_mask_bu_san.xml new file mode 100644 index 0000000000..621e748ed6 --- /dev/null +++ b/assets/xml/objects/object_mask_bu_san.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_dancer.xml b/assets/xml/objects/object_mask_dancer.xml new file mode 100644 index 0000000000..a2a37c958b --- /dev/null +++ b/assets/xml/objects/object_mask_dancer.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_gero.xml b/assets/xml/objects/object_mask_gero.xml new file mode 100644 index 0000000000..b6acf6c173 --- /dev/null +++ b/assets/xml/objects/object_mask_gero.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_gibudo.xml b/assets/xml/objects/object_mask_gibudo.xml new file mode 100644 index 0000000000..76bf2b3dea --- /dev/null +++ b/assets/xml/objects/object_mask_gibudo.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_mask_goron.xml b/assets/xml/objects/object_mask_goron.xml new file mode 100644 index 0000000000..56a67218e5 --- /dev/null +++ b/assets/xml/objects/object_mask_goron.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_json.xml b/assets/xml/objects/object_mask_json.xml new file mode 100644 index 0000000000..1a5c10eb1b --- /dev/null +++ b/assets/xml/objects/object_mask_json.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_kerfay.xml b/assets/xml/objects/object_mask_kerfay.xml new file mode 100644 index 0000000000..282aa8029f --- /dev/null +++ b/assets/xml/objects/object_mask_kerfay.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_ki_tan.xml b/assets/xml/objects/object_mask_ki_tan.xml new file mode 100644 index 0000000000..f0322cc83e --- /dev/null +++ b/assets/xml/objects/object_mask_ki_tan.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_mask_kyojin.xml b/assets/xml/objects/object_mask_kyojin.xml new file mode 100644 index 0000000000..cd07a57fd2 --- /dev/null +++ b/assets/xml/objects/object_mask_kyojin.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_mask_meoto.xml b/assets/xml/objects/object_mask_meoto.xml new file mode 100644 index 0000000000..069e521e05 --- /dev/null +++ b/assets/xml/objects/object_mask_meoto.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_mask_nuts.xml b/assets/xml/objects/object_mask_nuts.xml new file mode 100644 index 0000000000..6a0eaf26dc --- /dev/null +++ b/assets/xml/objects/object_mask_nuts.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_mask_posthat.xml b/assets/xml/objects/object_mask_posthat.xml new file mode 100644 index 0000000000..bccbfb3018 --- /dev/null +++ b/assets/xml/objects/object_mask_posthat.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_mask_rabit.xml b/assets/xml/objects/object_mask_rabit.xml new file mode 100644 index 0000000000..a4a1f5c0cf --- /dev/null +++ b/assets/xml/objects/object_mask_rabit.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_mask_romerny.xml b/assets/xml/objects/object_mask_romerny.xml new file mode 100644 index 0000000000..603feef0df --- /dev/null +++ b/assets/xml/objects/object_mask_romerny.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_skj.xml b/assets/xml/objects/object_mask_skj.xml new file mode 100644 index 0000000000..457cd94f25 --- /dev/null +++ b/assets/xml/objects/object_mask_skj.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_stone.xml b/assets/xml/objects/object_mask_stone.xml new file mode 100644 index 0000000000..24f67d1dfe --- /dev/null +++ b/assets/xml/objects/object_mask_stone.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_mask_truth.xml b/assets/xml/objects/object_mask_truth.xml new file mode 100644 index 0000000000..3fed737a21 --- /dev/null +++ b/assets/xml/objects/object_mask_truth.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_mask_yofukasi.xml b/assets/xml/objects/object_mask_yofukasi.xml new file mode 100644 index 0000000000..990543e1b8 --- /dev/null +++ b/assets/xml/objects/object_mask_yofukasi.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_mask_zacho.xml b/assets/xml/objects/object_mask_zacho.xml new file mode 100644 index 0000000000..ae63753de1 --- /dev/null +++ b/assets/xml/objects/object_mask_zacho.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mask_zora.xml b/assets/xml/objects/object_mask_zora.xml new file mode 100644 index 0000000000..c2e07cde24 --- /dev/null +++ b/assets/xml/objects/object_mask_zora.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_mastergolon.xml b/assets/xml/objects/object_mastergolon.xml new file mode 100644 index 0000000000..ae481332cc --- /dev/null +++ b/assets/xml/objects/object_mastergolon.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_masterzoora.xml b/assets/xml/objects/object_masterzoora.xml new file mode 100644 index 0000000000..c4f8735d75 --- /dev/null +++ b/assets/xml/objects/object_masterzoora.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_mbar_obj.xml b/assets/xml/objects/object_mbar_obj.xml new file mode 100644 index 0000000000..d69d7ce3b1 --- /dev/null +++ b/assets/xml/objects/object_mbar_obj.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_meganeana_obj.xml b/assets/xml/objects/object_meganeana_obj.xml new file mode 100644 index 0000000000..457c937bd7 --- /dev/null +++ b/assets/xml/objects/object_meganeana_obj.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_milkbar.xml b/assets/xml/objects/object_milkbar.xml new file mode 100644 index 0000000000..38bec140b1 --- /dev/null +++ b/assets/xml/objects/object_milkbar.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mir_ray.xml b/assets/xml/objects/object_mir_ray.xml new file mode 100644 index 0000000000..9629823223 --- /dev/null +++ b/assets/xml/objects/object_mir_ray.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mk.xml b/assets/xml/objects/object_mk.xml new file mode 100644 index 0000000000..c927f33de2 --- /dev/null +++ b/assets/xml/objects/object_mk.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mkk.xml b/assets/xml/objects/object_mkk.xml new file mode 100644 index 0000000000..17f36f3232 --- /dev/null +++ b/assets/xml/objects/object_mkk.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mm.xml b/assets/xml/objects/object_mm.xml new file mode 100644 index 0000000000..3ce9c1925c --- /dev/null +++ b/assets/xml/objects/object_mm.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mnk.xml b/assets/xml/objects/object_mnk.xml new file mode 100644 index 0000000000..8f813ba002 --- /dev/null +++ b/assets/xml/objects/object_mnk.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_moonend.xml b/assets/xml/objects/object_moonend.xml new file mode 100644 index 0000000000..e677f9c3f1 --- /dev/null +++ b/assets/xml/objects/object_moonend.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_moonston.xml b/assets/xml/objects/object_moonston.xml new file mode 100644 index 0000000000..cc06a96323 --- /dev/null +++ b/assets/xml/objects/object_moonston.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_ms.xml b/assets/xml/objects/object_ms.xml new file mode 100644 index 0000000000..9d7df53ad2 --- /dev/null +++ b/assets/xml/objects/object_ms.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_msmo.xml b/assets/xml/objects/object_msmo.xml new file mode 100644 index 0000000000..cb08f53ef6 --- /dev/null +++ b/assets/xml/objects/object_msmo.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_mtoride.xml b/assets/xml/objects/object_mtoride.xml new file mode 100644 index 0000000000..ab07928391 --- /dev/null +++ b/assets/xml/objects/object_mtoride.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml new file mode 100644 index 0000000000..a1c11fed2f --- /dev/null +++ b/assets/xml/objects/object_mu.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml new file mode 100644 index 0000000000..e0f557f981 --- /dev/null +++ b/assets/xml/objects/object_nb.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_niw.xml b/assets/xml/objects/object_niw.xml new file mode 100644 index 0000000000..f97b5d7261 --- /dev/null +++ b/assets/xml/objects/object_niw.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nnh.xml b/assets/xml/objects/object_nnh.xml new file mode 100644 index 0000000000..1bb833cf07 --- /dev/null +++ b/assets/xml/objects/object_nnh.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_numa_obj.xml b/assets/xml/objects/object_numa_obj.xml new file mode 100644 index 0000000000..cc36fa1b80 --- /dev/null +++ b/assets/xml/objects/object_numa_obj.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nwc.xml b/assets/xml/objects/object_nwc.xml new file mode 100644 index 0000000000..77b395b581 --- /dev/null +++ b/assets/xml/objects/object_nwc.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ny.xml b/assets/xml/objects/object_ny.xml new file mode 100644 index 0000000000..186dd91c3c --- /dev/null +++ b/assets/xml/objects/object_ny.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml new file mode 100644 index 0000000000..9eac29aaad --- /dev/null +++ b/assets/xml/objects/object_oF1d_map.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ob.xml b/assets/xml/objects/object_ob.xml new file mode 100644 index 0000000000..7a75a59f28 --- /dev/null +++ b/assets/xml/objects/object_ob.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_obj_chan.xml b/assets/xml/objects/object_obj_chan.xml new file mode 100644 index 0000000000..8469110e47 --- /dev/null +++ b/assets/xml/objects/object_obj_chan.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_obj_danpeilift.xml b/assets/xml/objects/object_obj_danpeilift.xml new file mode 100644 index 0000000000..2d3c265670 --- /dev/null +++ b/assets/xml/objects/object_obj_danpeilift.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_obj_dinner.xml b/assets/xml/objects/object_obj_dinner.xml new file mode 100644 index 0000000000..6ca440035e --- /dev/null +++ b/assets/xml/objects/object_obj_dinner.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_obj_milk_bin.xml b/assets/xml/objects/object_obj_milk_bin.xml new file mode 100644 index 0000000000..4a0ca700bb --- /dev/null +++ b/assets/xml/objects/object_obj_milk_bin.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_obj_tokeidai.xml b/assets/xml/objects/object_obj_tokeidai.xml new file mode 100644 index 0000000000..9141b67ff3 --- /dev/null +++ b/assets/xml/objects/object_obj_tokeidai.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_obj_usiyane.xml b/assets/xml/objects/object_obj_usiyane.xml new file mode 100644 index 0000000000..339b25df9c --- /dev/null +++ b/assets/xml/objects/object_obj_usiyane.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_obj_yasi.xml b/assets/xml/objects/object_obj_yasi.xml new file mode 100644 index 0000000000..b7d2c1fd13 --- /dev/null +++ b/assets/xml/objects/object_obj_yasi.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_okuta.xml b/assets/xml/objects/object_okuta.xml new file mode 100644 index 0000000000..0eebb587e1 --- /dev/null +++ b/assets/xml/objects/object_okuta.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_omoya_obj.xml b/assets/xml/objects/object_omoya_obj.xml new file mode 100644 index 0000000000..85389f314f --- /dev/null +++ b/assets/xml/objects/object_omoya_obj.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_open_obj.xml b/assets/xml/objects/object_open_obj.xml new file mode 100644 index 0000000000..ea1664a884 --- /dev/null +++ b/assets/xml/objects/object_open_obj.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_os_anime.xml b/assets/xml/objects/object_os_anime.xml new file mode 100644 index 0000000000..7957dd58d5 --- /dev/null +++ b/assets/xml/objects/object_os_anime.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_osn.xml b/assets/xml/objects/object_osn.xml new file mode 100644 index 0000000000..0994d057fd --- /dev/null +++ b/assets/xml/objects/object_osn.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ot.xml b/assets/xml/objects/object_ot.xml new file mode 100644 index 0000000000..1fb04a34a7 --- /dev/null +++ b/assets/xml/objects/object_ot.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_owl.xml b/assets/xml/objects/object_owl.xml new file mode 100644 index 0000000000..b35f38b0f9 --- /dev/null +++ b/assets/xml/objects/object_owl.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_oyu.xml b/assets/xml/objects/object_oyu.xml new file mode 100644 index 0000000000..aa762ce592 --- /dev/null +++ b/assets/xml/objects/object_oyu.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_pamera.xml b/assets/xml/objects/object_pamera.xml new file mode 100644 index 0000000000..901a7523bc --- /dev/null +++ b/assets/xml/objects/object_pamera.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ph.xml b/assets/xml/objects/object_ph.xml new file mode 100644 index 0000000000..df0cff73d3 --- /dev/null +++ b/assets/xml/objects/object_ph.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po.xml b/assets/xml/objects/object_po.xml new file mode 100644 index 0000000000..5d66d380cd --- /dev/null +++ b/assets/xml/objects/object_po.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_composer.xml b/assets/xml/objects/object_po_composer.xml new file mode 100644 index 0000000000..288dd41c31 --- /dev/null +++ b/assets/xml/objects/object_po_composer.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_fusen.xml b/assets/xml/objects/object_po_fusen.xml new file mode 100644 index 0000000000..6dd6d1f9bb --- /dev/null +++ b/assets/xml/objects/object_po_fusen.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml new file mode 100644 index 0000000000..6004d6cbfa --- /dev/null +++ b/assets/xml/objects/object_po_sisters.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_posthouse_obj.xml b/assets/xml/objects/object_posthouse_obj.xml new file mode 100644 index 0000000000..8a324672be --- /dev/null +++ b/assets/xml/objects/object_posthouse_obj.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_pp.xml b/assets/xml/objects/object_pp.xml new file mode 100644 index 0000000000..63bf541cd0 --- /dev/null +++ b/assets/xml/objects/object_pp.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pr.xml b/assets/xml/objects/object_pr.xml new file mode 100644 index 0000000000..27a03fdcf5 --- /dev/null +++ b/assets/xml/objects/object_pr.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ps.xml b/assets/xml/objects/object_ps.xml new file mode 100644 index 0000000000..9febc56609 --- /dev/null +++ b/assets/xml/objects/object_ps.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pst.xml b/assets/xml/objects/object_pst.xml new file mode 100644 index 0000000000..9d62acba78 --- /dev/null +++ b/assets/xml/objects/object_pst.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_racetsubo.xml b/assets/xml/objects/object_racetsubo.xml new file mode 100644 index 0000000000..6558fcbe53 --- /dev/null +++ b/assets/xml/objects/object_racetsubo.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_raf.xml b/assets/xml/objects/object_raf.xml new file mode 100644 index 0000000000..df3d619d1c --- /dev/null +++ b/assets/xml/objects/object_raf.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_raillift.xml b/assets/xml/objects/object_raillift.xml new file mode 100644 index 0000000000..241a7346be --- /dev/null +++ b/assets/xml/objects/object_raillift.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_random_obj.xml b/assets/xml/objects/object_random_obj.xml new file mode 100644 index 0000000000..9b9986ca15 --- /dev/null +++ b/assets/xml/objects/object_random_obj.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_rat.xml b/assets/xml/objects/object_rat.xml new file mode 100644 index 0000000000..5c979b098c --- /dev/null +++ b/assets/xml/objects/object_rat.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rb.xml b/assets/xml/objects/object_rb.xml new file mode 100644 index 0000000000..3898e84176 --- /dev/null +++ b/assets/xml/objects/object_rb.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rd.xml b/assets/xml/objects/object_rd.xml new file mode 100644 index 0000000000..d9087282aa --- /dev/null +++ b/assets/xml/objects/object_rd.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_redead_obj.xml b/assets/xml/objects/object_redead_obj.xml new file mode 100644 index 0000000000..fd286d6e7b --- /dev/null +++ b/assets/xml/objects/object_redead_obj.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_rotlift.xml b/assets/xml/objects/object_rotlift.xml new file mode 100644 index 0000000000..403f7d3dd9 --- /dev/null +++ b/assets/xml/objects/object_rotlift.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rr.xml b/assets/xml/objects/object_rr.xml new file mode 100644 index 0000000000..dbdba55c54 --- /dev/null +++ b/assets/xml/objects/object_rr.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_rs.xml b/assets/xml/objects/object_rs.xml new file mode 100644 index 0000000000..5019d9631f --- /dev/null +++ b/assets/xml/objects/object_rs.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml new file mode 100644 index 0000000000..016a610e82 --- /dev/null +++ b/assets/xml/objects/object_ru2.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rz.xml b/assets/xml/objects/object_rz.xml new file mode 100644 index 0000000000..323393f87e --- /dev/null +++ b/assets/xml/objects/object_rz.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sb.xml b/assets/xml/objects/object_sb.xml new file mode 100644 index 0000000000..9fcd76a8f4 --- /dev/null +++ b/assets/xml/objects/object_sb.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sdn.xml b/assets/xml/objects/object_sdn.xml new file mode 100644 index 0000000000..9cc607047c --- /dev/null +++ b/assets/xml/objects/object_sdn.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_secom_obj.xml b/assets/xml/objects/object_secom_obj.xml new file mode 100644 index 0000000000..7b21783a33 --- /dev/null +++ b/assets/xml/objects/object_secom_obj.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sek.xml b/assets/xml/objects/object_sek.xml new file mode 100644 index 0000000000..e37af43802 --- /dev/null +++ b/assets/xml/objects/object_sek.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihig.xml b/assets/xml/objects/object_sekihig.xml new file mode 100644 index 0000000000..dab91d71b2 --- /dev/null +++ b/assets/xml/objects/object_sekihig.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihil.xml b/assets/xml/objects/object_sekihil.xml new file mode 100644 index 0000000000..e3c7bcc42d --- /dev/null +++ b/assets/xml/objects/object_sekihil.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihin.xml b/assets/xml/objects/object_sekihin.xml new file mode 100644 index 0000000000..f2982169bb --- /dev/null +++ b/assets/xml/objects/object_sekihin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sekihiz.xml b/assets/xml/objects/object_sekihiz.xml new file mode 100644 index 0000000000..0f8ef7c43e --- /dev/null +++ b/assets/xml/objects/object_sekihiz.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_shn.xml b/assets/xml/objects/object_shn.xml new file mode 100644 index 0000000000..78cc77ca71 --- /dev/null +++ b/assets/xml/objects/object_shn.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sichitai_obj.xml b/assets/xml/objects/object_sichitai_obj.xml new file mode 100644 index 0000000000..f093778abd --- /dev/null +++ b/assets/xml/objects/object_sichitai_obj.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_sinkai_kabe.xml b/assets/xml/objects/object_sinkai_kabe.xml new file mode 100644 index 0000000000..96f8531ad0 --- /dev/null +++ b/assets/xml/objects/object_sinkai_kabe.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml new file mode 100644 index 0000000000..cafba559ed --- /dev/null +++ b/assets/xml/objects/object_skb.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_slime.xml b/assets/xml/objects/object_slime.xml new file mode 100644 index 0000000000..f17633eff1 --- /dev/null +++ b/assets/xml/objects/object_slime.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_smtower.xml b/assets/xml/objects/object_smtower.xml new file mode 100644 index 0000000000..90ee5a13df --- /dev/null +++ b/assets/xml/objects/object_smtower.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_snowman.xml b/assets/xml/objects/object_snowman.xml new file mode 100644 index 0000000000..f92110b3ed --- /dev/null +++ b/assets/xml/objects/object_snowman.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_snowwd.xml b/assets/xml/objects/object_snowwd.xml new file mode 100644 index 0000000000..c61d07bebe --- /dev/null +++ b/assets/xml/objects/object_snowwd.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_spdweb.xml b/assets/xml/objects/object_spdweb.xml new file mode 100644 index 0000000000..6f54a482d2 --- /dev/null +++ b/assets/xml/objects/object_spdweb.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_spidertent.xml b/assets/xml/objects/object_spidertent.xml new file mode 100644 index 0000000000..d90bede678 --- /dev/null +++ b/assets/xml/objects/object_spidertent.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_spinyroll.xml b/assets/xml/objects/object_spinyroll.xml new file mode 100644 index 0000000000..d27386945a --- /dev/null +++ b/assets/xml/objects/object_spinyroll.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_spot11_obj.xml b/assets/xml/objects/object_spot11_obj.xml new file mode 100644 index 0000000000..c049bb3379 --- /dev/null +++ b/assets/xml/objects/object_spot11_obj.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ssh.xml b/assets/xml/objects/object_ssh.xml new file mode 100644 index 0000000000..e4072d79e4 --- /dev/null +++ b/assets/xml/objects/object_ssh.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_st.xml b/assets/xml/objects/object_st.xml new file mode 100644 index 0000000000..a7ce1418df --- /dev/null +++ b/assets/xml/objects/object_st.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sth.xml b/assets/xml/objects/object_sth.xml new file mode 100644 index 0000000000..7b6947b07c --- /dev/null +++ b/assets/xml/objects/object_sth.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_stk.xml b/assets/xml/objects/object_stk.xml new file mode 100644 index 0000000000..44a311dfbd --- /dev/null +++ b/assets/xml/objects/object_stk.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_stk2.xml b/assets/xml/objects/object_stk2.xml new file mode 100644 index 0000000000..fe62266a84 --- /dev/null +++ b/assets/xml/objects/object_stk2.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_stk3.xml b/assets/xml/objects/object_stk3.xml new file mode 100644 index 0000000000..dbd5da6523 --- /dev/null +++ b/assets/xml/objects/object_stk3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_stream.xml b/assets/xml/objects/object_stream.xml new file mode 100644 index 0000000000..ac73120799 --- /dev/null +++ b/assets/xml/objects/object_stream.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_syokudai.xml b/assets/xml/objects/object_syokudai.xml new file mode 100644 index 0000000000..83e4c34f33 --- /dev/null +++ b/assets/xml/objects/object_syokudai.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_syoten.xml b/assets/xml/objects/object_syoten.xml new file mode 100644 index 0000000000..9802f7701b --- /dev/null +++ b/assets/xml/objects/object_syoten.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tab.xml b/assets/xml/objects/object_tab.xml new file mode 100644 index 0000000000..52c3156a3c --- /dev/null +++ b/assets/xml/objects/object_tab.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_taisou.xml b/assets/xml/objects/object_taisou.xml new file mode 100644 index 0000000000..696285927f --- /dev/null +++ b/assets/xml/objects/object_taisou.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_takaraya_objects.xml b/assets/xml/objects/object_takaraya_objects.xml new file mode 100644 index 0000000000..4ce448c86a --- /dev/null +++ b/assets/xml/objects/object_takaraya_objects.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_tanron1.xml b/assets/xml/objects/object_tanron1.xml new file mode 100644 index 0000000000..99a39e534c --- /dev/null +++ b/assets/xml/objects/object_tanron1.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_tanron2.xml b/assets/xml/objects/object_tanron2.xml new file mode 100644 index 0000000000..950621c192 --- /dev/null +++ b/assets/xml/objects/object_tanron2.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tanron3.xml b/assets/xml/objects/object_tanron3.xml new file mode 100644 index 0000000000..05ef078d7c --- /dev/null +++ b/assets/xml/objects/object_tanron3.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tanron4.xml b/assets/xml/objects/object_tanron4.xml new file mode 100644 index 0000000000..7e48cdf0ec --- /dev/null +++ b/assets/xml/objects/object_tanron4.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tanron5.xml b/assets/xml/objects/object_tanron5.xml new file mode 100644 index 0000000000..e64a11d5db --- /dev/null +++ b/assets/xml/objects/object_tanron5.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_taru.xml b/assets/xml/objects/object_taru.xml new file mode 100644 index 0000000000..763fe1b2ec --- /dev/null +++ b/assets/xml/objects/object_taru.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_test3.xml b/assets/xml/objects/object_test3.xml new file mode 100644 index 0000000000..fc6e026a94 --- /dev/null +++ b/assets/xml/objects/object_test3.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_thiefbird.xml b/assets/xml/objects/object_thiefbird.xml new file mode 100644 index 0000000000..31f0213c54 --- /dev/null +++ b/assets/xml/objects/object_thiefbird.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tite.xml b/assets/xml/objects/object_tite.xml new file mode 100644 index 0000000000..2d57d1b47d --- /dev/null +++ b/assets/xml/objects/object_tite.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tk.xml b/assets/xml/objects/object_tk.xml new file mode 100644 index 0000000000..506f9b00af --- /dev/null +++ b/assets/xml/objects/object_tk.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tl.xml b/assets/xml/objects/object_tl.xml new file mode 100644 index 0000000000..656d707433 --- /dev/null +++ b/assets/xml/objects/object_tl.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tokei_step.xml b/assets/xml/objects/object_tokei_step.xml new file mode 100644 index 0000000000..fad13984a3 --- /dev/null +++ b/assets/xml/objects/object_tokei_step.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_tokei_tobira.xml b/assets/xml/objects/object_tokei_tobira.xml new file mode 100644 index 0000000000..cfa6175511 --- /dev/null +++ b/assets/xml/objects/object_tokei_tobira.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tokei_turret.xml b/assets/xml/objects/object_tokei_turret.xml new file mode 100644 index 0000000000..edca7c5c24 --- /dev/null +++ b/assets/xml/objects/object_tokei_turret.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_toryo.xml b/assets/xml/objects/object_toryo.xml new file mode 100644 index 0000000000..101db58395 --- /dev/null +++ b/assets/xml/objects/object_toryo.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_trap.xml b/assets/xml/objects/object_trap.xml new file mode 100644 index 0000000000..3afdf61d46 --- /dev/null +++ b/assets/xml/objects/object_trap.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_tree.xml b/assets/xml/objects/object_tree.xml new file mode 100644 index 0000000000..9d5fb66dd8 --- /dev/null +++ b/assets/xml/objects/object_tree.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_tro.xml b/assets/xml/objects/object_tro.xml new file mode 100644 index 0000000000..773182c588 --- /dev/null +++ b/assets/xml/objects/object_tro.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_trt.xml b/assets/xml/objects/object_trt.xml new file mode 100644 index 0000000000..ecde36e182 --- /dev/null +++ b/assets/xml/objects/object_trt.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tru.xml b/assets/xml/objects/object_tru.xml new file mode 100644 index 0000000000..0ca1acff45 --- /dev/null +++ b/assets/xml/objects/object_tru.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tsn.xml b/assets/xml/objects/object_tsn.xml new file mode 100644 index 0000000000..63c03c84c3 --- /dev/null +++ b/assets/xml/objects/object_tsn.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tsubo.xml b/assets/xml/objects/object_tsubo.xml new file mode 100644 index 0000000000..46aacd873d --- /dev/null +++ b/assets/xml/objects/object_tsubo.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_twig.xml b/assets/xml/objects/object_twig.xml new file mode 100644 index 0000000000..7b9c6c1918 --- /dev/null +++ b/assets/xml/objects/object_twig.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_uch.xml b/assets/xml/objects/object_uch.xml new file mode 100644 index 0000000000..de16b0d7b8 --- /dev/null +++ b/assets/xml/objects/object_uch.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_um.xml b/assets/xml/objects/object_um.xml new file mode 100644 index 0000000000..693c704d33 --- /dev/null +++ b/assets/xml/objects/object_um.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_umajump.xml b/assets/xml/objects/object_umajump.xml new file mode 100644 index 0000000000..6d86b4298b --- /dev/null +++ b/assets/xml/objects/object_umajump.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_utubo.xml b/assets/xml/objects/object_utubo.xml new file mode 100644 index 0000000000..97a7095c9b --- /dev/null +++ b/assets/xml/objects/object_utubo.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_visiblock.xml b/assets/xml/objects/object_visiblock.xml new file mode 100644 index 0000000000..d714338fcd --- /dev/null +++ b/assets/xml/objects/object_visiblock.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_vm.xml b/assets/xml/objects/object_vm.xml new file mode 100644 index 0000000000..b07534c65c --- /dev/null +++ b/assets/xml/objects/object_vm.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wallmaster.xml b/assets/xml/objects/object_wallmaster.xml new file mode 100644 index 0000000000..249af61eec --- /dev/null +++ b/assets/xml/objects/object_wallmaster.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_warp1.xml b/assets/xml/objects/object_warp1.xml new file mode 100644 index 0000000000..9324f1301c --- /dev/null +++ b/assets/xml/objects/object_warp1.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_warp_uzu.xml b/assets/xml/objects/object_warp_uzu.xml new file mode 100644 index 0000000000..4924c86ca3 --- /dev/null +++ b/assets/xml/objects/object_warp_uzu.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_water_effect.xml b/assets/xml/objects/object_water_effect.xml new file mode 100644 index 0000000000..e3cd9ec27b --- /dev/null +++ b/assets/xml/objects/object_water_effect.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wdhand.xml b/assets/xml/objects/object_wdhand.xml new file mode 100644 index 0000000000..22e12cfa08 --- /dev/null +++ b/assets/xml/objects/object_wdhand.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wdor01.xml b/assets/xml/objects/object_wdor01.xml new file mode 100644 index 0000000000..ffc3327bba --- /dev/null +++ b/assets/xml/objects/object_wdor01.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_wdor02.xml b/assets/xml/objects/object_wdor02.xml new file mode 100644 index 0000000000..9cb35ddb82 --- /dev/null +++ b/assets/xml/objects/object_wdor02.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_wdor03.xml b/assets/xml/objects/object_wdor03.xml new file mode 100644 index 0000000000..c23f870377 --- /dev/null +++ b/assets/xml/objects/object_wdor03.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_wdor04.xml b/assets/xml/objects/object_wdor04.xml new file mode 100644 index 0000000000..040df15980 --- /dev/null +++ b/assets/xml/objects/object_wdor04.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_wdor05.xml b/assets/xml/objects/object_wdor05.xml new file mode 100644 index 0000000000..f8fda23221 --- /dev/null +++ b/assets/xml/objects/object_wdor05.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml new file mode 100644 index 0000000000..98dd21ed58 --- /dev/null +++ b/assets/xml/objects/object_wf.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wiz.xml b/assets/xml/objects/object_wiz.xml new file mode 100644 index 0000000000..6a27c2ba9e --- /dev/null +++ b/assets/xml/objects/object_wiz.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wood02.xml b/assets/xml/objects/object_wood02.xml new file mode 100644 index 0000000000..6ef693f349 --- /dev/null +++ b/assets/xml/objects/object_wood02.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_yabusame_point.xml b/assets/xml/objects/object_yabusame_point.xml new file mode 100644 index 0000000000..856d94cfed --- /dev/null +++ b/assets/xml/objects/object_yabusame_point.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/objects/object_yado_obj.xml b/assets/xml/objects/object_yado_obj.xml new file mode 100644 index 0000000000..d5d0467d49 --- /dev/null +++ b/assets/xml/objects/object_yado_obj.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/xml/objects/object_yb.xml b/assets/xml/objects/object_yb.xml new file mode 100644 index 0000000000..8cf61e347c --- /dev/null +++ b/assets/xml/objects/object_yb.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_yukimura_obj.xml b/assets/xml/objects/object_yukimura_obj.xml new file mode 100644 index 0000000000..2099f807ae --- /dev/null +++ b/assets/xml/objects/object_yukimura_obj.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_yukiyama.xml b/assets/xml/objects/object_yukiyama.xml new file mode 100644 index 0000000000..5e7215f82d --- /dev/null +++ b/assets/xml/objects/object_yukiyama.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zg.xml b/assets/xml/objects/object_zg.xml new file mode 100644 index 0000000000..e5cb1dd5d5 --- /dev/null +++ b/assets/xml/objects/object_zg.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/xml/objects/object_zl1.xml b/assets/xml/objects/object_zl1.xml new file mode 100644 index 0000000000..759b358678 --- /dev/null +++ b/assets/xml/objects/object_zl1.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zl4.xml b/assets/xml/objects/object_zl4.xml new file mode 100644 index 0000000000..f13487f981 --- /dev/null +++ b/assets/xml/objects/object_zl4.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zm.xml b/assets/xml/objects/object_zm.xml new file mode 100644 index 0000000000..c5511f6b2e --- /dev/null +++ b/assets/xml/objects/object_zm.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zo.xml b/assets/xml/objects/object_zo.xml new file mode 100644 index 0000000000..4462024438 --- /dev/null +++ b/assets/xml/objects/object_zo.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zob.xml b/assets/xml/objects/object_zob.xml new file mode 100644 index 0000000000..22400d46ef --- /dev/null +++ b/assets/xml/objects/object_zob.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zod.xml b/assets/xml/objects/object_zod.xml new file mode 100644 index 0000000000..f1152e2ac1 --- /dev/null +++ b/assets/xml/objects/object_zod.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zog.xml b/assets/xml/objects/object_zog.xml new file mode 100644 index 0000000000..aae7b0381f --- /dev/null +++ b/assets/xml/objects/object_zog.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zoraband.xml b/assets/xml/objects/object_zoraband.xml new file mode 100644 index 0000000000..53a3d5a7b8 --- /dev/null +++ b/assets/xml/objects/object_zoraband.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/objects/object_zoraegg.xml b/assets/xml/objects/object_zoraegg.xml new file mode 100644 index 0000000000..c527fe618a --- /dev/null +++ b/assets/xml/objects/object_zoraegg.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zos.xml b/assets/xml/objects/object_zos.xml new file mode 100644 index 0000000000..7a25eb338d --- /dev/null +++ b/assets/xml/objects/object_zos.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zov.xml b/assets/xml/objects/object_zov.xml new file mode 100644 index 0000000000..17d6382a95 --- /dev/null +++ b/assets/xml/objects/object_zov.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Tru.xml b/assets/xml/overlays/ovl_En_Tru.xml new file mode 100644 index 0000000000..e242db4c34 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Tru.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/En_Firefly.png b/docs/images/En_Firefly.png new file mode 100644 index 0000000000..ed32585926 Binary files /dev/null and b/docs/images/En_Firefly.png differ diff --git a/docs/images/diff.png b/docs/images/diff.png new file mode 100644 index 0000000000..c93a5ac9f3 Binary files /dev/null and b/docs/images/diff.png differ diff --git a/docs/tools.md b/docs/tools.md new file mode 100644 index 0000000000..6fec9caf86 --- /dev/null +++ b/docs/tools.md @@ -0,0 +1,291 @@ +# Table of Contnets + +- [Table of Contnets](#table-of-contnets) + - [Introduction](#introduction) + - [In the repository](#in-the-repository) + - [`diff.py`](#diffpy) + - [`tools/m2ctx.py`](#toolsm2ctxpy) + - [`tools/overlayhelpers/actor_symbols.py`](#toolsoverlayhelpersactor_symbolspy) + - [`first_diff.py`](#first_diffpy) + - [`sym_info.py`](#sym_infopy) + - [`extract_assets.py`](#extract_assetspy) + - [`tools/assist.py`](#toolsassistpy) + - [`tools/get_actor_sizes.py`](#toolsget_actor_sizespy) + - [`tools/progress.py`](#toolsprogresspy) + - [`tools/regconvert.py`](#toolsregconvertpy) + - [`tools/rename_global_asm.py`](#toolsrename_global_asmpy) + - [`tools/rename_sym.sh`](#toolsrename_symsh) + - [`tools/actorfixer.py`](#toolsactorfixerpy) + - [`tools/timeconv.py`](#toolstimeconvpy) + - [`tools/sfx_convert.py`](#toolssfx_convertpy) + - [`tools/vt_fmt.py`](#toolsvt_fmtpy) + - [`tools/graphovl.py`](#toolsgraphovlpy) + - [`tools/warnings_count/check_new_warnings.sh`](#toolswarnings_countcheck_new_warningssh) + - [`tools/warnings_count/update_current_warnings.sh`](#toolswarnings_countupdate_current_warningssh) + - [`fixle.sh`](#fixlesh) + - [`format.sh`](#formatsh) + - [External tools](#external-tools) + - [mips_to_c](#mips_to_c) + - [Permuter](#permuter) + - [vbindiff](#vbindiff) + - [Texture64](#texture64) + - [Z64Utils](#z64utils) + - [Retired tools](#retired-tools) + - [`tools/overlayhelpers/ichaindis.py`](#toolsoverlayhelpersichaindispy) + - [`tools/overlayhelpers/colliderinit.py`](#toolsoverlayhelperscolliderinitpy) + - [`tools/overlayhelpers/colchkinfoinit.py`](#toolsoverlayhelperscolchkinfoinitpy) + - [`tools/overlayhelpers/damage_table.py`](#toolsoverlayhelpersdamage_tablepy) + - [`tools/vtxdis`](#toolsvtxdis) + - [Reservation Tracking](#reservation-tracking) + +## Introduction + +There are a variety of tools that are used to assist in the decompilation process. This guide is an introduction to some of the tools that are used. Most of these tools are located in the `mm/tools` directory, others are either in the project root, or are separate programs entirely. Almost all of these programs have more information available via running them with `-h`. + +## In the repository + +### `diff.py` + +Your best friend for most of the decompilation work. Compares the original assembly extracted from the ROM instruction-for-instruction with what the code you have written compiles to. + +To use `diff.py`, you need a copy of a matching build folder to diff against. In MM, this can be made with `make diff-init`, which will rebuild both ROMs, check for OK, and copy the build folder and the roms. + +`diff.py` takes the function symbol name as the main argument: + +```bash +./diff.py ObjTree_Init +``` + +`diff.py` reads the respective `mm.map` files to find the function. If the function has been renamed, it will not be able to find it. You should not edit map files yourself, but instead rerun `make diff-init` (it is possible to copy the build folder manually, but it's better not to, since `make diff-init` guarantees an OK `expected` folder). + +The recommended flags used are `-mwo`, `-mwo3`, or `-mwob`: + +- `-m` ("make") builds the file used for diffing automatically when `diff.py` is run. +- `-w` ("watch") will watch the C file containing the function (and only the C file!) and automatically recompile when it changes. +- `-o` ("object file") uses only the `.o` file. This is faster than without, and means you can see symbol names, but obscures the data behind relative addresses: if you have differences in the .text section that are invisible with `-o`, or you suspect the data is shifted in some way, try without +- `-3` creates a three-way diff: TARGET/CURRENT/PREVIOUS, which is particularly useful for seeing changes. +- `-b` creates a three-way diff: TARGET/CURRENT/BASE, where BASE is the version from when the program was started. +- `-s` ("stop") stops diffing at the next `jr $ra`, commonly the end of the function. Beware that some functions with conditionals may have multiple `jr $ra`s, so this feature can chop the bottom off the diff. + +There are numerous other options that are not used as often (changing the diffing algorithm, viewing the source code in the diff, ...), and the various flags have dependencies among themselves, so check its documentation with `-h` to get fuller information. + +Colour explanations (sadly GitHub markdown does not allow for fancy colouring here): + +- white/grey is matching instructions +- red is missing instructions +- green is extra instructions +- blue means something in the instruction is wrong, be it numerical differences in the immediates, or the whole thing. Not all blue is meaningful: using `-o` to get symbols, the addresses of imported data will be blue since the relative address looks different from the absolute one. +- yellow means the instruction itself is correct, but the registers used are not (*regalloc*, register allocation) +- Each register gets its own colour when the regalloc is wrong, which makes it much easier to follow their usage. +- a branch is indicated by coloured `~>`s on the right of the instruction, and their targets by the same colour `~>` on the left of the instruction (remember delay slots!). The colours matching is a good indication that the branches are correct, although not infallible, since there are only so many colours it will use. +- occasionally instructions will be coloured a dark grey. You should consider this the same as blue. + +Example Diff: + +![Diff](images/diff.png) + +### `tools/m2ctx.py` + +Pass it the path to a C file to generate the context for that C file, to help [mips_to_c](#mips_to_c). Writes to a file called `ctx.c` in the root directory of the repo. + +### `tools/overlayhelpers/actor_symbols.py` + +Takes a VRAM or VROM address to get overlay file and offset for an Actor. + +### `first_diff.py` + +Gives you the addresses of first difference in the ROM, the difference, and a count of how many bytes differ, or if the whole ROM is shifted. + +### `sym_info.py` + +Can be given a symbol (function or variable name, for example), and will find its ROM, VRAM, and file using the map file. E.g. + +```bash +$ ./sym_info.py ObjTree_Init +Symbol ObjTree_Init (RAM: 0x80B9A0B0, ROM: 0xFFF210, build/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.o) +``` + +### `extract_assets.py` + +A tool that will use ZAPD to extract assets from the baserom. + +### `tools/assist.py` + +Searches for similar functions to the one you are passing, and it tells you which one are decompiled. You can pass the name of an overlay and it will search for similar functions for every function in said overlay. + +(Still a little broken) + +### `tools/get_actor_sizes.py` + +Generates a list of actors with various statistics about their function sizes. Run with `-h` for information on flags. + +(nonmatching does not work currently: we need to adapt it to MM's assembly files) + +### `tools/progress.py` + +Gives the progress output that the website uses. Run for that warm glow. + +### `tools/regconvert.py` + +Convert `mips2c`'s `gGameInfo->data[n]` output (or a raw offset) into the appropriate variable in the REG pages. Can also be run on a file to mass-convert them: run with `-h` for details. + +### `tools/rename_global_asm.py` + +Will rename the single-function assembly files in `asm/non_matchings` when the function they contain has been renamed. Should mean you have to run `make disasm` far less frequently. + +### `tools/rename_sym.sh` + +Will rename a symbol throughout the codebase. **Be very careful with this script**: it has no sanity checks, so you can do a lot of damage if you're not careful. Best to commit before using it. + +### `tools/actorfixer.py` + +Provided it is kept up-to-date with function renames, you can run this to automatically update your branch with the new names. `.` will cause it to replace in the whole repo, or you can pass it a specific file path to run it on only that file. + +### `tools/timeconv.py` + +Changes a raw `u16` value into a macro for clock time in-game: + +```bash +$ ./tools/timeconv.py 0x4800 +6,45 -> 0x4800 +CLOCK_TIME(6, 45) +``` + +Either dec or hex input will work. It will warn if the macro output will not match: + +```bash +$ ./tools/timeconv.py 44102 +16,09 -> 0xAC44 +CLOCK_TIME(16, 9) +Warning: Result does not match as-is +``` + +### `tools/sfx_convert.py` + +Replaces sfx ids by their corresponding defines from `sfx.h`. Run on a single file to replace all of them. + +### `tools/vt_fmt.py` + +Replaces VT symbols by their corresponding macros. Not many files in MM need this; ask if you need help with it. + +### `tools/graphovl.py` + +Creates a graph of action functions (black and green arrows) and function calls (blue arrows) for a given overlay file. For best results, run this from the root directory + +Example: `./tools/graphovl/graphovl.py En_Firefly` + +This will save a `.png` of the overlay in the `/graphs` directory. + +See Example below. + +![Graph](images/En_Firefly.png) + +### `tools/warnings_count/check_new_warnings.sh` + +Runs a make from clean and checks if new warnings have been produced: we use Jenkins to check this as well, but you should run this before opening a PR. + +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`). + +Run `check_new_warnings.sh -h` for more information. + +### `tools/warnings_count/update_current_warnings.sh` + +If you have to add new warnings, **and have permission from the leads**, run this to update the file used for warnings comparison. + +### `fixle.sh` + +Fixes line endings in the repo to Linux style (LF), which is required for the build process to work. (You may be better off creating a new clone directly in Linux/WSL, though) + +### `format.sh` + +Formats all C files in the repo using `clang-format-11` (instructions on how to install this version are pinned in Discord if you can't get it from your package manager in the usual way). This will touch all files in the repo, so the next `make` will take longer. + +## External tools + +### mips_to_c + +mips_to_c (or mips2c) is a tool that takes MIPS assembly and will attempt to convert it to C. + +There are different ways you can run mips2c: + +- Clone the repo and run it loclly on your own machine. Follow set up instructions at +- An online version is available at . + +mips_to_c's accuracy can be improved when some context to what the existing C source code is like. See more on how to generate this in [m2ctx](#m2ctx.py) + +### Permuter + +Use when you're low on ideas for matching a function. This goes through a series of heuristic random replacements known to help improve matching, although often at the expense of clarity. + +To set up the permuter, clone the repository in a directory of your choice. Follow the usage section of the README and ensure you have all the prerequisites installed. + +```bash +./import.py +``` + +on the files to import the code on which to run the permuter to `nonmatchings/func`, and then + +```bash +./permuter.py +``` + +will run the permuter + +Flags: + +- `-jN` for multithreading +- `-J` for using permuter@home (ask in Discord for someone to vouch for you to use this). (Can be combined with `-jN`.) +- `--better-only` only report improvements on base score (and not ties) +- `--best-only` only report improvements on current best score +- `--stack-diffs` take into account differences in placement on the stack (ignored by default) + +More information on these can be found in the permuter's own documentation. There are macros that can be added to the C to get the permuter to run particular types of transformation; these are also detailed in its manual. + +### vbindiff + +Your fallback for anything that you need to correct that is not visible in `diff.py`. Typically you use it to open the nonmatching uncompressed ROM and the uncompressed baserom and look at the differences highlighted in red. `first_diff.py` will usually tell you where to look. Controls are detailed in the program itself. + +### Texture64 + +Probably the best of the Nintendo 64 texture viewing programs. It is quite simple, but very good for the one thing that it does. + +### 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 . + +## Retired tools + +The following tools are hopefully rendered obsolete by the data extraction that has already been done. + +### `tools/overlayhelpers/ichaindis.py` + +Used for extracting the InitChain information automatically from the ROM. + +### `tools/overlayhelpers/colliderinit.py` + +Used for decompliling the Collider struct of an actor. To use colliderinit, you will need to know the address (VRAM or VROM) of the struct, and the type of collider. There are different types of colliderinits: `ColliderJntSph, ColliderTrisInit, ColliderQuadInit, ColliderSphereInit`. + +### `tools/overlayhelpers/colchkinfoinit.py` + +Similar to `colliderinit.py` but for `CollisionCheckInfoInit`s. + +### `tools/overlayhelpers/damage_table.py` + +Extracts a damagetable from its address. Can also reconvert existing damagetables should the format change. + +### `tools/vtxdis` + +Extracts vertex data from a file. Essentially irrelevant since MM requires extracting this data with ZAPD anyway. + +### Reservation Tracking + +We use a [Google Sheet](https://docs.google.com/spreadsheets/d/1X83YCPRa532v-Zo0WgUsJ2kB1X9RxBta5_p9aWA8uro/edit#gid=0) to keep track of all the files' decompilation statuses and their function statistics. On this board one can reserve a file to work on. The columns are + +- **Actor Id**: The enum that uniquely identifies the actor for spawning etc., useful for looking in KZ/VerboseOcarina/Spectrum. For `boot`/`code`, the VRAM of the file's .text start is given instead. +- **Overlay/File name**: Name of the Overlay or File in the codebase. +- **Function size statistics**: Intended as a crude estimate of how hard a file will be. Beginners should look for small largest function size and total size; the columns give a rough estimate of the distribution of function sizes without getting unnecessarily statistically descriptive. As you become more experienced, you should work on larger files to leave the smaller ones for other beginners. +- **Description**: What the file is. It's helpful if you can fill this in if you know! They should be synchronised with the short top-of-file descriptions. +- **Status**: (Free)/Reserved/PR/Merged. To be kept up-to-date by the reserver. +- **Reserved**: To reserve a file, put your Discord name in the "Reserved" column. It is common courtesy to not work on a file that is being worked on by another contributor, so ensure the "Reserved" column is blank before working on a file. If it is not, you can ask the reserver(s) if they want to release it or collaborate on it, but don't expect them to agree. More information on what is expected when you reserve a file is available in the [CONTRIBUTING.md](../CONTRIBUTING.md). +- **Interested**: If you would like to work on a file, but don't want to reserve it, or would be interested in collaboration, etc. You should talk to any Interested people if you want to work on the file. +- **Notes**: Any other useful information: partial progress by someone unable to finish the file, other files it works with, etc. diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md new file mode 100644 index 0000000000..953e3e44d7 --- /dev/null +++ b/docs/tutorial/advanced_control_flow.md @@ -0,0 +1,747 @@ +# Advanced control flow + +Nice as `EnRecepgirl` was, she was somewhat lacking in complexity. In this document, we'll look at something rather more complicated than any of the functions she had. + +Again our example will be taken from a small NPC: this time, `EnMs` (Bean Seller). Most of its functions are even simpler than `EnRecepgirl`'s, and fairly quickly we can get to + +
+ + Large code block, click to show. + + +```C +#include "z_en_ms.h" + +#define FLAGS 0x00000009 + +#define THIS ((EnMs*)thisx) + +void EnMs_Init(Actor* thisx, GlobalContext* globalCtx); +void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx); +void EnMs_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx); + +void func_80952734(EnMs* this, GlobalContext* globalCtx); +void func_809527F8(EnMs* this, GlobalContext* globalCtx); +void func_809529AC(EnMs* this, GlobalContext* globalCtx); +void func_80952A1C(EnMs *this, GlobalContext *globalCtx); + +const ActorInit En_Ms_InitVars = { + ACTOR_EN_MS, + ACTORCAT_NPC, + FLAGS, + OBJECT_MS, + sizeof(EnMs), + (ActorFunc)EnMs_Init, + (ActorFunc)EnMs_Destroy, + (ActorFunc)EnMs_Update, + (ActorFunc)EnMs_Draw, +}; + +static ColliderCylinderInitType1 D_80952BA0 = { + { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, + { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { 22, 37, 0, { 0, 0, 0 } }, +}; + +static InitChainEntry D_80952BCC[] = { + ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), +}; + + +extern ColliderCylinderInitType1 D_80952BA0; +extern InitChainEntry D_80952BCC[]; + +extern AnimationHeader D_060005EC; +extern FlexSkeletonHeader D_06003DC0; + +void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; + + Actor_ProcessInitChain(thisx, D_80952BCC); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80952BA0); + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 35.0f); + Actor_SetScale(&this->actor, 0.015f); + this->actor.colChkInfo.mass = 0xFF; + this->actionFunc = func_80952734; + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.gravity = -1.0f; +} + +void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80952734(EnMs* this, GlobalContext* globalCtx) { + s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + + if (gSaveContext.inventory.items[10] == ITEM_NONE) { + this->actor.textId = 0x92E; + } else { + this->actor.textId = 0x932; + } + + if (func_800B84D0(&this->actor, globalCtx) != 0) { + this->actionFunc = func_809527F8; + return; + } + + if (this->actor.xzDistToPlayer < 90.0f) { + if (ABS_ALT(temp_v1) < 0x2000) { + func_800B8614(&this->actor, globalCtx, 90.0f); + } + } +} + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s") + +void func_809529AC(EnMs *this, GlobalContext *globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.textId = 0; + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + this->actionFunc = func_80952A1C; + } else { + func_800B8A1C(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + } +} + +void func_80952A1C(EnMs *this, GlobalContext *globalCtx) { + if (func_800B84D0(&this->actor, globalCtx)) { + func_80151938(globalCtx, 0x936U); + this->actionFunc = func_809527F8; + } else { + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + } +} + +void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMs* this = THIS; + + Actor_SetHeight(&this->actor, 20.0f); + this->actor.targetArrowOffset = 500.0f; + Actor_SetScale(&this->actor, 0.015f); + SkelAnime_Update(&this->skelAnime); + this->actionFunc(this, globalCtx); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} + +void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; + + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); +} + +``` + +
+ +(Skipping any documentation we might have done.) Indeed, this actor is so simple so far that you can see why it wasn't worth using most of it for the rest of the tutorial. `func_809527F8` is a different story, however. We know it's an action function since it's set to the `actionFunc` in `func_80952A1C`. But mips2c gives us + +```bash +$ ../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s --context ctx.c --gotos-only +``` + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + u8 temp_v0; + u8 temp_v0_2; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 != 4) { + if (temp_v0 != 5) { + if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) { + this->actionFunc = func_80952734; + return; + } + // Duplicate return node #17. Try simplifying control flow for better match + return; + } + if (func_80147624(globalCtx) != 0) { + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + return; + } + // Duplicate return node #17. Try simplifying control flow for better match + return; + } + if (func_80147624(globalCtx) != 0) { + temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (temp_v0_2 != 0) { + if (temp_v0_2 != 1) { + + } + func_8019F230(); + func_80151938(globalCtx, 0x934U); + // Duplicate return node #17. Try simplifying control flow for better match + return; + } + func_801477B4(globalCtx); + if ((s32) gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; + } + if ((s32) gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + return; + } + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + } +} +``` + +which is long, messy, and contains some rather nasty-looking control flow, including horrors like + +```C + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 != 4) { + if (temp_v0 != 5) { + if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) { + this->actionFunc = func_80952734; + return; + } + // Duplicate return node #17. Try simplifying control flow for better match + return; + } +``` + +If you read the OoT tutorial, you'll know these nested negated ifs all using the same variable are a good indicator that there's a switch. The problem is working out how to write it. + + +## Goto-only mode + +For didactic purposes, we'll use a feature of mips2c called goto-only mode to examine this. *This is not the only way of doing it*, but it is good practice for a beginner to this sort of control flow. Running + +```bash +../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s --context ctx.c --gotos-only +``` + +instead will produce + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + u8 temp_v0; + u8 temp_v0_2; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 == 4) { + goto block_7; + } + if (temp_v0 == 5) { + goto block_5; + } + if (temp_v0 != 6) { + goto block_17; + } + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + this->actionFunc = func_80952734; + return; +block_5: + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + return; +block_7: + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (temp_v0_2 == 0) { + goto block_11; + } + if (temp_v0_2 == 1) { + goto block_16; + } + goto block_16; +block_11: + func_801477B4(globalCtx); + if ((s32) gSaveContext.rupees >= 0xA) { + goto block_13; + } + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; +block_13: + if ((s32) gSaveContext.inventory.ammo[gItemSlots[0xA]] < 0x14) { + goto block_15; + } + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + return; +block_15: + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + return; +block_16: + func_8019F230(); + func_80151938(globalCtx, 0x934U); +block_17: + return; +} +``` + +which in many ways looks worse: you can see why the use of gotos in code is strongly discouraged. However, if you throw this in `diff.py`, you'll find it's rather closer than you'd have thought. Goto-only mode has the advantages that +- code is always in the right order: mips2c has not had to reorder anything to get the ifs to work out +- it is often possible to get quite close with gotos, then start removing them, checking the matching status at each point. This is usually easier than trying to puzzle out the way it's trying to jump out of an `if ( || )` or similar. +- if you're trying to keep track of where you are in the code, the gotos mean that it is closer to the assembly in the first place. + +## Eliminating the gotos + +The simplest sort of block label to eliminate is one that is only used once, and where the corresponding goto jumps over a simple block of code with no extra internal control flow structure. There are two obvious examples of this here, the first being + +```C + if ((s32) gSaveContext.rupees >= 0xA) { + goto block_13; + } + play_sound(0x4806U); + func_80151938(globalCtx, 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: + +```C + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; + } +``` + +Likewise, one can do this with `block_15`. + +If you examine appropriate part of the diff, you will usually find that such eliminations make no, or very little, difference to the compiled code. + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + u8 temp_v0; + u8 temp_v0_2; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 == 4) { + goto block_7; + } + if (temp_v0 == 5) { + goto block_5; + } + if (temp_v0 != 6) { + goto block_17; + } + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + this->actionFunc = func_80952734; + return; +block_5: + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + return; +block_7: + if (func_80147624(globalCtx) == 0) { + goto block_17; + } + temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (temp_v0_2 == 0) { + goto block_11; + } + if (temp_v0_2 == 1) { + goto block_16; + } + goto block_16; +block_11: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; + } + if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + return; + } + + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + return; +block_16: + func_8019F230(); + func_80151938(globalCtx, 0x934U); +block_17: + return; +} +``` + +We can't apply this rule any more, so we need to move on to the next: `block_17` just contains a `return`. So we can replace it by `return` everywhere it appears. + + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + u8 temp_v0; + u8 temp_v0_2; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 == 4) { + goto block_7; + } + if (temp_v0 == 5) { + goto block_5; + } + if (temp_v0 != 6) { + return; + } + if (func_80147624(globalCtx) == 0) { + return; + } + this->actionFunc = func_80952734; + return; +block_5: + if (func_80147624(globalCtx) == 0) { + return; + } + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + return; +block_7: + if (func_80147624(globalCtx) == 0) { + return; + } + temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (temp_v0_2 == 0) { + goto block_11; + } + if (temp_v0_2 == 1) { + goto block_16; + } + goto block_16; +block_11: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; + } + if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + return; + } + + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + return; +block_16: + func_8019F230(); + func_80151938(globalCtx, 0x934U); +} +``` + +Our next rule is about non-crossing blocks. If two code blocks do not contain any jumps between them, we can treat them separately. This is *almost* true for the code after `block_7`, were it not for the returns; of course returns are a special case because they can be used to be escape from a function at any point. This doesn't get us very far in this case, unfortunately, but it *does* tell us we can look at the second half of the function separately. + +Now let's start thinking about switches. A good indicator of a switch in goto-only mode is something like + +```C + temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (temp_v0_2 == 0) { + goto block_11; + } + if (temp_v0_2 == 1) { + goto block_16; + } + goto block_16; +``` + +because +- there are multiple ifs that are simple numeric comparisons of the same argument +- the goto blocks are in the same order as the ifs +- there is one last goto at the end that triggers if none of the ifs does: this sounds an awful lot like a `default`! + +So let us rewrite the entire second half as a switch: + +```C + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + return; + } + if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + return; + } + + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + return; + break; + + case 1: + default: + func_8019F230(); + func_80151938(globalCtx, 0x934U); + break; + } +``` + +There's a couple of other obvious things here: +- the last `return` in `case 0` is unnecessary since there is no other code after the switch, so breaking is equivalent to the return` +- a common pattern everywhere, a sequence of ifs with returns as the last thing inside is the same as an if-else chain, so we can rewrite these as + +```C + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + } else { + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + } + break; + + case 1: + default: + func_8019F230(); + func_80151938(globalCtx, 0x934U); + break; + } +``` + +Well, at least the bottom half looks respectable now. Again, there is no code after the switch, so the next thing up, namely + +```C + if (func_80147624(globalCtx) == 0) { + return; + } +``` + +can be swapped round and made to wrap the switch. This leaves us with + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + u8 temp_v0; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 == 4) { + goto block_7; + } + if (temp_v0 == 5) { + goto block_5; + } + if (temp_v0 != 6) { + return; + } + if (func_80147624(globalCtx) == 0) { + return; + } + this->actionFunc = func_80952734; + return; +block_5: + if (func_80147624(globalCtx) == 0) { + return; + } + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + return; +block_7: + if (func_80147624(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + } else { + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + } + break; + + case 1: + default: + func_8019F230(); + func_80151938(globalCtx, 0x934U); + break; + } + } +} +``` + +Now, the top of the function also looks like a switch: +```C + temp_v0 = func_80152498(&globalCtx->msgCtx); + if (temp_v0 == 4) { + goto block_7; + } + if (temp_v0 == 5) { + goto block_5; + } + if (temp_v0 != 6) { + return; + } +``` + +Interestingly, this time the blocks are the other way round. Also, the last statement is a `!=` rather than an `==`: this should be the default this time. The code order takes priority over the check order, because the compiler likes to put those in numerical order. There will be cases 4,5,6, but in the order 6,5,4, because that's how the code ordering goes. Also, notice that every case returns at the end: this means there's nothing else in the function after this switch, so everything after `block_7` is actually part of `case 4`. + +Putting all this together, we write down a function with no gotos in it: + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + switch (func_80152498(&globalCtx->msgCtx)) { + case 6: + this->actionFunc = func_80952734; + break; + + case 5: + if (func_80147624(globalCtx) == 0) { + return; + } + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + break; + + case 4: + if (func_80147624(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + } else { + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + } + break; + + case 1: + default: + func_8019F230(); + func_80151938(globalCtx, 0x934U); + break; + } + } + break; + + default: + break; + } +} +``` + +Lastly, we can simplify `case 5` to replace the return in the if by the rest of the code, and we end up with + +```C +void func_809527F8(EnMs *this, GlobalContext *globalCtx) { + switch (func_80152498(&globalCtx->msgCtx)) { + case 6: + this->actionFunc = func_80952734; + break; + + case 5: + if (func_80147624(globalCtx) != 0) { + func_801477B4(globalCtx); + func_800B8A1C((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809529AC; + } + break; + + case 4: + if (func_80147624(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_801477B4(globalCtx); + + if (gSaveContext.rupees < 0xA) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x935U); + } else if (gSaveContext.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + play_sound(0x4806U); + func_80151938(globalCtx, 0x937U); + } else { + func_8019F208(); + func_800B8A1C((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + func_801159EC(-0xA); + this->actionFunc = func_809529AC; + } + break; + + case 1: + default: + func_8019F230(); + func_80151938(globalCtx, 0x934U); + break; + } + } + break; + + default: + break; + } +} +``` + +And this matches! + +We will not document this now, although even with so few function named it seems pretty clear that it's to do with buying beans (and indeed, Magic Beans cost 10 Rupees and have Get Item ID `0x35`) You might like to try to match this function without using goto-only mode, to compare. It is also an interesting exercise to see what each elimination does to the diff: sometimes it will stray surprisingly far for a small change. diff --git a/docs/tutorial/beginning_decomp.md b/docs/tutorial/beginning_decomp.md new file mode 100644 index 0000000000..01cc21cf3b --- /dev/null +++ b/docs/tutorial/beginning_decomp.md @@ -0,0 +1,675 @@ +# Beginning decompilation: the Init function and the Actor struct + +Up: [Contents](contents.md) + +Open the C file and the H file with your actor's name from the appropriate directory in `src/overlays/actors/`. These will be the main files we work with. We will be using EnRecepgirl (the rather forward Mayor's receptionist in the Mayor's residence in East Clock Town) as our example: it is a nice simple NPC with most of the common features of an NPC. + +Each actor has associated to it a data file and one assembly file per function. During the process, we will transfer the contents of all or most of these into the main C file. VSCode's search feature usually makes it quite easy to find the appropriate files without troubling the directory tree. + + +## Anatomy of the C file + +The actor file starts off looking like: + +```C +// --------------- 1 --------------- +// --------------- 2 --------------- +#include "z_en_recepgirl.h" + +#define FLAGS 0x00000009 + +#define THIS ((EnRecepgirl*)thisx) + +// --------------- 3 --------------- +void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); + +// --------------- 4 --------------- +#if 0 +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, + sizeof(EnRecepgirl), + (ActorFunc)EnRecepgirl_Init, + (ActorFunc)EnRecepgirl_Destroy, + (ActorFunc)EnRecepgirl_Update, + (ActorFunc)EnRecepgirl_Draw, +}; + +// static InitChainEntry sInitChain[] = { +static InitChainEntry D_80C106C0[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), +}; + +#endif + +// --------------- 5 --------------- +extern InitChainEntry D_80C106C0[]; + +extern UNK_TYPE D_06001384; +extern UNK_TYPE D_06009890; +extern UNK_TYPE D_0600A280; + +// --------------- 6 --------------- +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Destroy.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10148.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C1019C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10290.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C102D4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Update.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") + +``` + +It is currently divided into six sections as follows: + +1. Description of the actor. This is not present for all actors, (and indeed, is not present here) but gives a short description based on what we know about the actor already. It may be inaccurate, so feel free to correct it after you understand the actor better, or add it. It currently has the form + +```C +/* + * File: z_en_recepgirl.c + * Overlay: ovl_En_Recepgirl + * Description: Mayor's receptionist + */ +``` + +2. Specific `include`s and `define`s for the actor. You may need to add more header files, but otherwise this section is unlikely to change. + +3. These are prototypes for the "main four" functions that almost every actor has. You add more functions here if they need to be declared above their first use. + +5. `if`'d-out section containing the `InitVars` and a few other common pieces of data. This can be ignored until we import the data. + +4. A set of `extern`s. These refer to the data in the previous section, and, data that comes from other files, usually in the actor's corresponding object file. The latter point to addresses in the ROM where assets are stored (usually collision data, animations or display lists). Once the corresponding object files have been decompiled, these will simply be replaced by including the object file (see [Object Decompilation](object_decomp.md) for how this process works). These symbols have been automatically extracted from the MIPS code. There may turn out to be some that were not caught by the script, in which case they need to be placed in the file called `undefined_syms.txt` in the root directory of the project. Ask in Discord for how to do this: it is simple, but rare enough to not be worth covering here. + +6. List of functions. Each `#pragma GLOBAL_ASM` is letting the compiler use the corresponding assembly file while we do not have decompiled C code for that function. The majority of the decompilation work is converting these functions into C that it looks like a human wrote. + + +## Header file + +The header file looks like this at the moment: + +```C +#ifndef Z_EN_RECEPGIRL_H +#define Z_EN_RECEPGIRL_H + +#include "global.h" + +struct EnRecepgirl; + +typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); + +typedef struct EnRecepgirl { + /* 0x0000 */ Actor actor; + /* 0x0144 */ char unk_144[0x164]; + /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x02AC */ char unk_2AC[0x8]; +} EnRecepgirl; // size = 0x2B4 + +extern const ActorInit En_Recepgirl_InitVars; + +#endif // Z_EN_RECEPGIRL_H +``` + +The struct currently contains a variable that is the `Actor` struct, which all actors use one way or another, plus other items. Currently we don't know what most of those items are, so we have arrays of chars as padding instead, just so the struct is the right size. As we understand the actor better, we will be able to gradually replace this padding with the actual variables that the actor uses. + +The header file is also used to declare structs and other information about the actor that is needed by other files (e.g. by other actors): one can simply `#include` the header rather than `extern`ing it. + + +## Order of decompilation + +The general rule for order of decompilation is +- Start with `Init`, because it usually contains the most information about the structure of the actor. You can also do `Destroy`, which is generally simpler than `Init`. +- Next, decompile any other functions from the actor you have found in `Init`. You generally start with the action functions, because they return nothing and all take the same arguments, + +```C +void func_80whatever(EnRecepgirl* this, GlobalContext* globalCtx); +``` + +- Decompile each action function in turn until you run out. Along the way, do any other functions in the actor for which you have discovered the argument types. (You are probably better doing depth-first on action functions than breadth-first: it's normally easier to follow along one branch of the actions than be thinking about several at once.) + +- After you've run out, do `Update`. This usually provides the rest of the function tree, apart from possibly some draw functions. + +- Finally, do the draw functions. + +The above is a rough ordering for the beginner. As you become more experienced, you can deviate from this scheme, but the general principle remains that you should work on functions that you already know something about. (This is why it's good to start on actors: they are self-contained, we already know a lot about some of the functions, and the function flow tends to be both logical and provide information about every function.) + +## Data + +![Fresh actor data](images/fresh_actor_data.png) + +Associated to each actor is a `.data` file, containing data that the actor uses. This ranges from spawn positions, to animation information, to even assets that we have to extract from the ROM. Since the structure of the data is very inconsistent between actors, automatic importing has been very limited, so the vast majority must be done manually. + +There are two ways of transfering the data into an actor: we can either +- import it all naively as words (`s32`s), which will still allow it to compile, and sort out the actual types later, or +- we can extern each piece of data as we come across it, and come back to it later when we have a better idea of what it is. + +We will concentrate on the second here; the other is covered in [the document about data](data.md). Thankfully this means we essentially don't have to do anything to the data yet. Nevertheless, it is often quite helpful to copy over at least some of the data and leave it commented out for later replacement. *Data must go in the same order as in the data file, and data is "all or nothing": you cannot only import some of it*. + + +**WARNING** The way in which the data was extracted from the ROM means that there are sometimes "fake symbols" in the data, which have to be removed to avoid confusing the compiler. Thankfully it will turn out that this is not the case here. + +(Sometimes it is useful to import the data in the middle of doing functions: you just have to choose an appropriate moment.) + +Some actors also have a `.bss` file. This is just data that is initialised to 0, and can be imported immediately once you know what type it is, by declaring it without giving it a value. (bss is a significant problem for code files, but not *usually* for actors.) + + +## Init + +The Init function sets up the various components of the actor when it is first loaded. It is hence usually very useful for finding out what is in the actor struct, and so we usually start with it. (Some people like starting with Destroy, which is usually shorter and simpler, but gives some basic information about the actor, but Init is probably best for beginners.) + +### mips2c + +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. + +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 +``` +$ ./tools/m2ctx.py +``` +from the main directory of the repository. In this case, the C file is `src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c`. This generates a file called `ctx.c` in the main directory of the repository. + +To get mips_to_c to decompile a function, the bare minimum is to run +``` +$ ../mips_to_c/mips_to_c.py +``` +(from the root directory of `mm`). We can tell mips2c to use the context file we just generated by adding `--context ctx.c`. If we have data, mips2c may be able to assist with that as well. + +In this case, we want the assembly file for `EnRecepgirl_Init`. You can copy the path to the file in VSCode or similar, or just tab-complete it once you know the directory structure well enough: it turns out to be `asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s`. + +**N.B.** You want the file in `nonmatchings`! the files in the other directories in `asm/` are the *unsplit* asm, which can be used, but is less convenient (you would need to include the rodata, for example, and it will do the whole file at once. This is sometimes useful, but we'll go one function at a time today to keep things simple). + +We shall also include the data file, which is located at `data/overlays/ovl_En_Recepgirl/ovl_En_Recepgirl.data.s`. Hence the whole command will be +``` +$ ../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.s --context ctx.c +? func_80C10148(EnRecepgirl *); // extern +extern FlexSkeletonHeader D_06011B60; +static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60100F0, (void *)0x600FCF0}; +static s32 D_80C106C8 = 0; +InitChainEntry D_80C106C0[2]; // unable to generate initializer + +void EnRecepgirl_Init(EnRecepgirl *this, GlobalContext *globalCtx) { + EnRecepgirl* this = (EnRecepgirl *) thisx; + void **temp_s0; + void **phi_s0; + + Actor_ProcessInitChain((Actor *) this, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + phi_s0 = D_80C106B0; + if (D_80C106C8 == 0) { + do { + temp_s0 = phi_s0 + 4; + temp_s0->unk-4 = Lib_SegmentedToVirtual(*phi_s0); + phi_s0 = temp_s0; + } while (temp_s0 != D_80C106C0); + D_80C106C8 = 1; + } + this->unk_2AC = 2; + if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + func_80C10148(this); +} +``` +Comment out the `GLOBAL_ASM` line for `Init`, and paste all of this into the file just underneath it: + +```C +[...] +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s") +? func_80C10148(EnRecepgirl *); // extern +extern FlexSkeletonHeader D_06011B60; +static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60100F0, (void *)0x600FCF0}; +static s32 D_80C106C8 = 0; +InitChainEntry D_80C106C0[2]; // unable to generate initializer + +void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = (EnRecepgirl *) thisx; + void **temp_s0; + void **phi_s0; + + Actor_ProcessInitChain((Actor *) this, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + phi_s0 = D_80C106B0; + if (D_80C106C8 == 0) { + do { + temp_s0 = phi_s0 + 4; + temp_s0->unk-4 = Lib_SegmentedToVirtual(*phi_s0); + phi_s0 = temp_s0; + } while (temp_s0 != D_80C106C0); + D_80C106C8 = 1; + } + this->unk_2AC = 2; + if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + func_80C10148(this); +} +[...] +``` + + +Typically for all but the simplest functions, there is a lot that needs fixing before we are anywhere near seeing how close we are to the original code. You will notice that mips2c creates a lot of temporary variables. Usually most of these will turn out to not be real, and we need to remove the right ones to get the code to match. + +To allow the function to find the variables, we need another correction. Half of this has already been done at the top of the file, where we have + +```C +#define THIS ((EnRecepgirl*)thisx) +``` + +To do the other half, replace the recast at the beginning of the function, before any declarations: + +```C +EnRecepgirl* this = THIS; +``` + +Now everything points to the right place, even though the argument of the function seems inconsistent with the contents. + +(Again: this step is only necessary for the "main four" functions, and sometimes functions that are used by these: it relates to how such functions are used outside the actor.) + +While we are carrying out initial changes, you can also find-and-replace any instances of `(Actor *) this` by `&this->actor`. The function now looks like this: + +```C +? func_80C10148(EnRecepgirl *); // extern +extern FlexSkeletonHeader D_06011B60; +static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60100F0, (void *)0x600FCF0}; +static s32 D_80C106C8 = 0; +InitChainEntry D_80C106C0[2]; // unable to generate initializer + +void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + void **temp_s0; + void **phi_s0; + + Actor_ProcessInitChain(&this->actor, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + phi_s0 = D_80C106B0; + if (D_80C106C8 == 0) { + do { + temp_s0 = phi_s0 + 4; + temp_s0->unk-4 = Lib_SegmentedToVirtual(*phi_s0); + phi_s0 = temp_s0; + } while (temp_s0 != D_80C106C0); + D_80C106C8 = 1; + } + this->unk_2AC = 2; + if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + func_80C10148(this); +} +``` + +### (Not) dealing with Data + +For now, we do not want to consider the data that mips2c has kindly imported for us: it will only get in the way when we want to rebuild the file to check for OK (`diff.py` will not care, but `make` will complain if it notices a symbol defined twice, and if some data is included twice the ROM will not match anyway). Therefore, put it in the `#if`'d out section and add some externs with the types: + +```C +#if 0 +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, + sizeof(EnRecepgirl), + (ActorFunc)EnRecepgirl_Init, + (ActorFunc)EnRecepgirl_Destroy, + (ActorFunc)EnRecepgirl_Update, + (ActorFunc)EnRecepgirl_Draw, +}; + +static void* D_80C106B0[4] = { (void*)0x600F8F0, (void*)0x600FCF0, (void*)0x60100F0, (void*)0x600FCF0 }; + +// static InitChainEntry sInitChain[] = { +static InitChainEntry D_80C106C0[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), +}; + +static s32 D_80C106C8 = 0; + +#endif + +extern void* D_80C106B0[]; +extern InitChainEntry D_80C106C0[]; +extern s32 D_80C106C8; +``` + +**N.B.** As is covered in more detail in [the document about data](data.md), the data *must* be declared in the same order in C as it was in the data assembly file: notice that the order in this example is `En_Recepgirl_InitVars`, `D_80C106B0`, `D_80C106C0`, `D_80C106C8`, the same as in `data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.s`. + + +In the next sections, we shall sort out the various initialisation functions that occur in Init. This actor contains several of the most common ones, but it does not have, for example, a collider. The process is similar to what we discuss below, or you can check the OoT tutorial. + + + +### Init chains + +Almost always, one of the first items in `Init` is a function that looks like + +```C +Actor_ProcessInitChain(&this->actor, D_80C106C0); +``` + +which initialises common properties of actor using an InitChain, which is usually somewhere near the top of the data, in this case in the variable `D_80C106C0`. This is already included in the `#if`'d out data at the top if the file, so we don't have to do anything for now. We can correct the mips2c output for the extern, though: I actually did this when moving the rest of the data in the previous section. + + +### SkelAnime + +This is the combined system that handles actors' skeletons and their animations. It is the other significant part of most actor structs. We see its initialisation in this part of the code: +```C + Actor_ProcessInitChain(&this->actor, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + phi_s0 = D_80C106B0; +``` + +An actor with SkelAnime has three structs in the Actor struct that handle it: one called SkelAnime, and two arrays of `Vec3s`, called `jointTable` and `morphTable`. Usually, although not always, they are next to one another. + +There are two different sorts of SkelAnime, although for decompilation purposes there is not much difference between them. Looking at the prototype of `SkelAnime_InitFlex` from `functions.h` (or even the definition in `z_skelanime.c`), +```C +void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, + AnimationHeader* animationSeg, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); +``` +we can read off the types of the various arguments: +- The `SkelAnime` struct is at `this + 0x144` +- The `jointTable` is at `this + 0x188` +- The `morphTable` is at `this + 0x218` +- The number of limbs is `0x18 = 24` (we use dec for the number of limbs) +- Because of how SkelAnime works, this means that the `jointTable` and `morphTable` both have `24` elements + +Looking in `z64animation.h`, we find that `SkelAnime` has size `0x44`, and looking in `z64math.h`, that `Vec3s` has size `0x6`. Since ` 0x144 + 0x44 = 0x188 `, `jointTable` is immediately after the `SkelAnime`, and since `0x188 + 0x6 * 0x18 = 0x218`, `morphTable` is immediately after the `jointTable`. Finally, `0x218 + 0x6 * 0x18 = 0x2A8`, and we have filled all the space between the `actor` and `actionFunc`. Therefore the struct now looks like +```C +typedef struct EnRecepgirl { + /* 0x0000 */ Actor actor; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[24]; + /* 0x0218 */ Vec3s morphTable[24]; + /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x02AC */ char unk_2AC[0x8]; +} EnRecepgirl; // size = 0x2B4 +``` + +The last information we get from the SkelAnime function is the types of two of the externed symbols: `D_06011B60` is a `FlexSkeletonHeader`, and `D_06009890` is an `AnimationHeader`. So we can change/add these at the top of the C file: + +```C +extern InitChainEntry D_80C106C0[]; + +extern UNK_TYPE D_06001384; +extern AnimationHeader D_06009890; +extern UNK_TYPE D_0600A280; +extern FlexSkeletonHeader D_06011B60; +``` +As with the data, these externed symbols should be kept in increasing address order. + +They are both passed to the function as pointers, so need `&` to pass the address instead of the actual data. Hence we end up with +```C + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); +``` +note that `this->jointTable` and `this->morphTable` are arrays, so are already effectively pointers and don't need a `&`. + +### More struct variables: a brief detour into reading some assembly + +This function also gives us information about other things in the struct. The only other reference to `this` (rather than `this->actor` or similar) is in +```C +this->unk_2AC = 2; +``` +This doesn't tell us much except that at `this + 0x2AC` is a number of some kind. What sort of number? For that we will have to look in the assembly code. This will probably look quite intimidating the first time, but it's usually not too bad if you use functions as signposts: IDO will never change the order of function calls, and tends to keep code between functions in roughly the same place, so you can usually guess where you are. + +In this case, we are looking for `this + 0x2AC`. `0x2AC` is not a very common number, so hopefully the only mention of it is in referring to this struct variable. Indeed, if we search the file, we find that the only instruction mentioning `0x2AC` is here: +```mips +/* 0000B0 80C10080 24090002 */ addiu $t1, $zero, 2 +/* 0000B4 80C10084 A24902AC */ sb $t1, 0x2ac($s2) +``` +`addiu` ("add unsigned immediate") adds the last two things and puts the result in the register in the first position. So this says `$t1 = 0 + 2`. The next instruction, `sb` ("store byte") puts the value in the register in the first position in the memory location in the second, which in this case says `$s2 + 0x2ac = $t1`. We can go and find out what is in `$s2` is: it is set *all* the way at the top of the function, in this line: +```mips +/* 000008 80C0FFD8 00809025 */ move $s2, $a0 +``` +This simply copies the contents of the second register into the first one. In this case, it is copying the contents of the function's first argument into `$s2` (because it wants to use it later, and the `$a` registers are assumed to be cleared after a function call). In this case, the first argument is a pointer to `this` (well, `thisx`, but the struct starts with an `Actor`, so it's the same address). So line `B4` of the asm really is saving `2` into the memory location `this + 0x2AC`. + +Anyway, this tells us that the variable is a byte of some kind, so `s8` or `u8`: if it was an `s16/u16` it would have said `sh`, and if it was an `s32/u32` it would have said `sw`. Unfortunately this is all we can determine from this function: MIPS does not have separate instructions for saving signed and unsigned bytes. + +At this point you have two options: guess based on statistics/heuristics, or go and look in the other functions in the actor to find out more information. The useful statistic here is that `u8` is far more common than `s8`, but let's look in the other functions, since we're pretty confident after finding `0x2ac` so easily in `Init`. So, let us grep the actor's assembly folder: +``` +$ grep -r '0x2ac' asm/non_matchings/overlays/ovl_En_Recepgirl/ +asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s:/* 00065C 80C1062C 921902AC */ lbu $t9, 0x2ac($s0) +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s:/* 000114 80C100E4 908202AC */ lbu $v0, 0x2ac($a0) +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s:/* 00012C 80C100FC A08E02AC */ sb $t6, 0x2ac($a0) +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s:/* 000134 80C10104 A08002AC */ sb $zero, 0x2ac($a0) +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s:/* 00015C 80C1012C 909802AC */ lbu $t8, 0x2ac($a0) +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s:/* 000164 80C10134 A09902AC */ sb $t9, 0x2ac($a0) +asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s:/* 0000B4 80C10084 A24902AC */ sb $t1, 0x2ac($s2) +``` +in which we clearly see `lbu` ("load byte unsigned"), and hence this variable really is a `u8`. Hence we can add this to the actor struct too: +```C +typedef struct EnRecepgirl { + /* 0x0000 */ Actor actor; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[24]; + /* 0x0218 */ Vec3s morphTable[24]; + /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x02AC */ u8 unk_2AC; + /* 0x02AD */ char unk_2AD[0x7]; +} EnRecepgirl; // size = 0x2B4 +``` + +You might think that was a lot of work for one variable, but it's pretty quick when you know what to do. Obviously this would be more difficult with a more common number, but it's often still worth trying. + +Removing some of the declarations for data that we have accounted for, the function now looks like this: +```C +? func_80C10148(EnRecepgirl *); // extern + +void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + void **temp_s0; + void **phi_s0; + + Actor_ProcessInitChain(&this->actor, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + + phi_s0 = D_80C106B0; + if (D_80C106C8 == 0) { + do { + temp_s0 = phi_s0 + 4; + temp_s0->unk-4 = Lib_SegmentedToVirtual(*phi_s0); + phi_s0 = temp_s0; + } while (temp_s0 != D_80C106C0); + D_80C106C8 = 1; + } + + this->unk_2AC = 2; + if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + func_80C10148(this); +} +``` + +We have one significant problem and a few minor ones left. + +### Casts and boolean functions + +mips2c likes casting a lot: this is useful for getting types, less so when the type is changed automatically, such as in `Flags_GetSwitch(globalCtx, (s32) this->actor.params)`. Also, if we look at this function's definition, we discover it will only return `true` or `false`, so we can remove the `!= 0`. + +### Functions called + +One minor problem is what `func_80C10148` is: C needs a prototype to compile it properly. mips2c has offered us `? func_80C10148(EnRecepgirl *); // extern`, but this is obviously incomplete: there's no `?` type in C! We shall guess for now that this function returns `void`, for two reasons: +1. It's not used as a condition in a conditional or anything +2. It's not used to assign a value + +To this experience will add a third reason: +3. This is probably a setup function for an actionFunc, which are usually either `void (*)(ActorType*)` or `void (*)(ActorType*, GlobalContext*)`. + +The upshot of all this is to remove mips2c's `? func_80C10148(EnRecepgirl *); // extern`, and add a `void func_80C10148(EnRecepgirl* this);` underneath the declarations for the main four functions: +```C +void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); + +void func_80C10148(EnRecepgirl* this); +``` + +(we usually leave a blank line after the main four, and put all further declarations in address order). + + +### Loops + +Loops are often some of the hardest things to decompile, because there are many ways to write a loop, only some of which will generate the same assembly. mips2c has had a go at the one in this function, but it usually struggles with loops: don't expect it to get a loop correct, well, at all. + +The code in question is +```C + void **temp_s0; + void **phi_s0; + +[...] + + phi_s0 = D_80C106B0; + if (D_80C106C8 == 0) { + do { + temp_s0 = phi_s0 + 4; + temp_s0->unk-4 = Lib_SegmentedToVirtual(*phi_s0); + phi_s0 = temp_s0; + } while (temp_s0 != D_80C106C0); + D_80C106C8 = 1; + } +``` + +`D_80C106B0` is the array that mips2c has declared above the function, a set of 8-digit hex numbers starting `0x06`. These are likely to be *segmented pointers*, but this is not a very useful piece of information yet. `D_80C106C0` is the InitChain, though, and it seems pretty unlikely that it would be seriously involved in any sort of loop. Indeed, if you tried to compile this now, you would get an error: +``` +cfe: Error: src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c, line 61: Unacceptable operand of == or != + } while (temp_s0 != D_80C106C0); + -------------------------^ +``` +so this can't possibly be right. + +So what on earth is this loop doing? Probably the best thing to do is manually unroll it and see what it's doing each time. + +0. `phi_s0 = D_80C106B0`, aka `&D_80C106B0[0]`, to `temp_s0 = D_80C106B0 + 4`, i.e. `&D_80C106B0[1]`. But then `temp_s0->unk-4` is 4 backwards from `&D_80C106B0[1]`, which is back at `&D_80C106B0[0]`; the `->` means to look at what is at this address, so `temp_s0->unk-4` is `D_80C106B0[0]`. Equally, `*phi_s0` is the thing at `&D_80C106B0[0]`, i.e. `D_80C106B0[0]`. So the actual thing the first pass does is +```C + D_80C106B0[0] = Lib_SegmentedToVirtual(D_80C106B0[0]); +``` +it then proceeds to set `phi_s0 = &D_80C106B0[1]` for the next iteration. + +1. We go through the same reasoning and find the inside of the loop is +```C + temp_s0 = &D_80C106B0[2]; + D_80C106B0[1] = Lib_SegmentedToVirtual(D_80C106B0[1]); + phi_s0 = &D_80C106B0[2]; +``` + +2. +```C + temp_s0 = &D_80C106B0[3]; + D_80C106B0[2] = Lib_SegmentedToVirtual(D_80C106B0[2]); + phi_s0 = &D_80C106B0[3]; +``` + +3. +```C + temp_s0 = &D_80C106B0[4]; + D_80C106B0[3] = Lib_SegmentedToVirtual(D_80C106B0[3]); + phi_s0 = &D_80C106B0[4]; +``` +But now, `&D_80C106B0[4] = D_80C106B0 + 4 * 4 = D_80C106B0 + 0x10`, and `0x10` after this array's starting address is `D_80C106C0`, i.e. the InitChhain. Hence at this point the looping ends. + +So what this loop actually does is run `Lib_SegmentedToVirtual` on each element of the array `D_80C106B0`. + +At this point, I confess that I guessed what this loop does, and rewrote it how I would have written it, namely how one usually iterates over an array: +```C + s32 i; +[...] + for (i = 0; i < 4; i++) { + D_80C106B0[i] = Lib_SegmentedToVirtual(D_80C106B0[i]); + } +``` + +This is a dangerous game, since there is no guarantee that what you think is the right way to write something bears any relation to either what the original was like, or more importantly, what will give the same codegen as the original. This is a significant leap, since the original appears to be using a pointer iterator! + +However, this is certainly at least equivalent to the original (or at least, to what mips2c gave us: it's not infallible): we can be certain of this because we wrote the thing out in its entirety to understand it! This also allows us to eliminate one of the temps: you'll find with even simple loops mips2c will usually make two temps for the loop variable. + +Hence we end up with + +```C +void func_80C10148(EnRecepgirl* this); +[...] + +void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + + Actor_ProcessInitChain(&this->actor, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + + if (D_80C106C8 == 0) { + for (i = 0; i < 4; i++) { + D_80C106B0[i] = Lib_SegmentedToVirtual(D_80C106B0[i]); + } + D_80C106C8 = 1; + } + + this->unk_2AC = 2; + + if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + + func_80C10148(this); +} +``` +as our first guess. This doesn't look unreasonable... the question is, does it match? + +## Diff + +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!) + +Now, we run diff on the function name: in the main directory, +``` +$ ./diff.py -mwo3 EnRecepgirl_Init +``` +(To see what these arguments do, run it with `./diff.py -h` or look in the scripts documentation.) + +![FeelsOKMan completely white diff](images/EnRecepgirl_Init_diff_matching.png) + +And err, well, everything is white, so it matches. Whoops. Guess we'll cover `diff.py` properly next time! (Notice that even though the diff is completely white, there are some differences in the `%hi`s and `%lo`s that access data, because it is now accessed with a relative address rather than an absolute one. If you have the data in the file in the right order, this shouldn't matter.) + +And with that, we have successfully matched our first function. + +**N.B** Notice that we don't yet have much idea of what this code actually does: this should be clarified by going through the rest of the actor's functions, which is discussed in the next document. + +Next: [Other functions in the actor](other_functions.md) diff --git a/docs/tutorial/contents.md b/docs/tutorial/contents.md new file mode 100644 index 0000000000..227f4fc7d4 --- /dev/null +++ b/docs/tutorial/contents.md @@ -0,0 +1,56 @@ +# Getting started + +## [Introduction to decomp](introduction.md) +- What we are doing +- Structure of the code + +## Pre-decompilation +- Building the repo (follow the instructions in the [README.md](../../README.md)) +- Most of us use VSCode. Some useful information is [here](vscode.md). + +- Choosing a first actor (You want something small that has simple interactions with the environment. A simple NPC can also work, and is what we will use as an illustration for most of the tutorial. There is a collection of actors we think are suitable for beginners on the spreadsheet or Trello) + +## Decompilation + +- [Begining decompilation: order, Init and the actor struct](beginning_decomp.md) + - Order of decompilation + - Init and common actor features + - Initchains + - Actors and dynapoly actors + - Colliders + - Skelanime + +- [The rest of the functions in the actor](other_functions.md) + - Order of decompilation + - Action Functions and other functions + +- [Draw functions](draw_functions.md) + +- [Data, migration and non-migration](data.md) + - Importing the data: early and late + - Segmented pointers + - Fake symbols + - Inlining + +## [Object Decompilation](object_decomp.md) (TODO) +- Object files +- How we decompile objects + +## After Decompilation + +- See the [CONTRIBUTING.md](../../CONTRIBUTING.md) for most of the details for submitting PRs. Remember to format again after making adjustments from reviews! +- More information about specific preparations is in [this document](merging.md). + +## Appendices +- [Types, Structs and Padding](types_structs_padding.md) (a miscellany of useful stuff) +- [Advanced control flow](advanced_control_flow.md) (an example of a more complex function which mips2c is not so good at) +- [Using the diff script and the permuter](diff_and_permuter.md) (using the diff script and the permuter to match something) + - control flow (branches) -> instruction ordering -> register allocation -> stack +- [Helper scripts] TODO: link when merged + +To be written, maybe + +- How we use git and GitHub +- Some notes on the basic structure of N64 MIPS +- Glossary +- Conventions diff --git a/docs/tutorial/data.md b/docs/tutorial/data.md new file mode 100644 index 0000000000..ae856123e9 --- /dev/null +++ b/docs/tutorial/data.md @@ -0,0 +1,171 @@ +# Data + +Up: [Contents](contents.md) +Previous: [Draw functions](draw_functions.md) + +## Table of Contents + +- [Data first](#data-first) +- [Extern and data last](#extern-and-data-last) +- [Segmented pointers](#segmented-pointers) +- [Fake symbols](#fake-symbols) +- [Inlining](#inlining) + +Each actor's data is stored in a separate file. EnRecepgirl's data is in `data/overlays/ovl_En_Recepgirl/ovl_En_Recepgirl.data.s`, for example. At some point in the decompilation process we need to convert this raw data into recognisable information for the C to use. + +There are two main ways to do this: either +1. import the data first and type it later, or +2. wait until the data appears in functions, extern it, then import it at the end + +Sometimes something between these two is appropriate: wait until the largest or strangest bits of data appear in functions, get some typing information out of that, and then import it, but for now, let's stick to both of these. + +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. + + +## Extern and data last + +Externing is explained in detail in the document about the [Init function](beginning_decomp.md). To summarize, every time a `D_address` appears that is in the data file, we put a +```C +extern UNK_TYPE D_address; +``` +at the top of the file, in the same order that the data appears in the data file. We can also give it a type if we know what the type actually is (e.g. for colliders, initchains, etc.), and convert the actual data and place it commented-out under the corresponding line. This means we don't have to do everything at once at the end. + +Once we have decompiled enough things to know what the data is, we can import it. The advantage of doing it this way is we should know what type everything is already: in our work on EnRecepgirl, for example, we ended up with the following data at the top of the file +```C +#if 0 +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, + sizeof(EnRecepgirl), + (ActorFunc)EnRecepgirl_Init, + (ActorFunc)EnRecepgirl_Destroy, + (ActorFunc)EnRecepgirl_Update, + (ActorFunc)EnRecepgirl_Draw, +}; + +static void* D_80C106B0[4] = { (void*)0x600F8F0, (void*)0x600FCF0, (void*)0x60100F0, (void*)0x600FCF0 }; + +// static InitChainEntry sInitChain[] = { +static InitChainEntry D_80C106C0[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), +}; + +static s32 D_80C106C8 = 0; + +#endif +``` +and the main thing we need to understand is `D_80C106B0` + +*Before doing anything else, make sure `make` gives `OK`.* + +First, we tell the compiler to ignore the original data file. To do this, open the file called `spec` in the main directory of the repository, and search for the actor name. You will find a section that looks like +``` +beginseg + name "ovl_En_Recepgirl" + compress + include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" + include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.o" + include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.reloc.o" +endseg +``` +We will eventually remove both of the bottom two lines and replace them with our own reloc file, but for now, just comment out the data line: +``` +beginseg + name "ovl_En_Recepgirl" + compress + include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" + //include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.o" + include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.reloc.o" +endseg +``` + +Next remove all the externs, and uncomment their corresponding commented data: +```C +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, + sizeof(EnRecepgirl), + (ActorFunc)EnRecepgirl_Init, + (ActorFunc)EnRecepgirl_Destroy, + (ActorFunc)EnRecepgirl_Update, + (ActorFunc)EnRecepgirl_Draw, +}; + +static void* D_80C106B0[4] = { (void*)0x600F8F0, (void*)0x600FCF0, (void*)0x60100F0, (void*)0x600FCF0 }; + +// static InitChainEntry sInitChain[] = { +static InitChainEntry D_80C106C0[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), +}; + +static s32 D_80C106C8 = 0; +``` + +That should be everything, and we should now be able to `make` without the data file with no issues. + + +## Segmented pointers + +The game has a convenient system that allows it to sometimes effectively use offsets into a file instead of raw memory addresses to reference things. This is done by setting a file address to a *segment*. A segmented address is of the form `0x0XYYYYYY`, where `X` is the segment number. There are 16 available segments, and actors always set segment 6 to their object file, which is a file containing assets (skeleton, animations, textures, etc.) that they use. This is what all those `D_06...` are, and it is also what the entries in `D_80C106B0` are: they are currently raw numbers instead of symbols, though, and we would like to replace them. + +There is an obvious problem here, which is that is that these symbols have to be defined *somewhere*, or the linker will complain (indeed, if we change the ones in the array to `D_...`, even if we extern them, we get +``` +mips-linux-gnu-ld: build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o:(.data+0x20): undefined reference to `D_0600F8F0' +```` +As we'd expect, of course: we didn't fulfil our promise that they were defined elsewhere.) + +This is mitigated by use of the file `undefined_syms.txt`, which feeds the linker the raw addresses to use as the symbol definitions. If you find a segmented address that is not in already externed, `extern` it at the top of the file and add it to the actor's section in undefined_syms: +```C +extern void* D_0600F8F0; +extern void* D_0600FCF0; +extern void* D_060100F0; +extern void* D_0600FCF0; + +static void* D_80C106B0[4] = { &D_0600F8F0, &D_0600FCF0, &D_060100F0, &D_0600FCF0 }; +``` +and in undefined_syms.txt: +``` +// ovl_En_Recepgirl +D_06000968 = 0x06000968; +D_06001384 = 0x06001384; +D_06009890 = 0x06009890; +D_0600A280 = 0x0600A280; +D_0600AD98 = 0x0600AD98; +D_0600F8F0 = 0x0600F8F0; +D_0600FCF0 = 0x0600FCF0; +D_060100F0 = 0x060100F0; +D_06011B60 = 0x06011B60; +``` + +We will come back and name these later when we do the object. + + +## Fake symbols + +Some symbols in the data have been decompiled wrongly, being incorrectly separated from the previous symbol due to how it was accessed by the actor's functions. However, most of these have now been fixed. Some more detail is given in [Types, structs and padding](types_structs_padding.md) If you are unsure, ask! + + +## Inlining + +After the file is finished, it is possible to move some static data into functions. This requires that: +1. The data is used in only one function +2. The ordering of the data can be maintained + +Additionally, we prefer to keep larger data (more than a line or two) out of functions anyway. + + +# Finally: .bss + +A .bss contains data that is uninitialised (actually initialised to `0`). For most actors all you need to do is declare it at the top of the actor file without giving it a value, once you find out what type it is. In `code`, it's much more of a problem. + +Next: [Documenting](documenting.md) \ No newline at end of file diff --git a/docs/tutorial/diff_and_permuter.md b/docs/tutorial/diff_and_permuter.md new file mode 100644 index 0000000000..aa72999d15 --- /dev/null +++ b/docs/tutorial/diff_and_permuter.md @@ -0,0 +1,145 @@ +# `diff.py` and the permuter + +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). + + + + diff --git a/docs/tutorial/disassembly_quirks.md b/docs/tutorial/disassembly_quirks.md new file mode 100644 index 0000000000..dacfb78d81 --- /dev/null +++ b/docs/tutorial/disassembly_quirks.md @@ -0,0 +1,36 @@ +# Disassembly quirks + +As MM's disassembly is automatic, there are certain unique problems it has. + +## Renaming functions and variables + +A function must be renamed in `tools/disasm/functions.txt` in addition to the source code, for the disassembler to know what to call the symbol at that address when it sees it. + +Variables must be renamed in `tools/disasm/variables.txt`. It may also be necessary to change their type, count or size to stop the disassembler misusing them. + +You can avoid having to redisassemble every time by running `rename_global_asm.py`, which will rename the individual functions' assembly files in `asm/nonmatchings/` to the name of the function they contain. + + +## Fake and incorrect symbols + +TODO + + +## Resplitting a file + +The files `boot` and `code` are each divided up into dozens of separate files, that are all joined together into one text, data, rodata and bss section when building the ROM. As such, it has been necessary to guess where the file boundaries are, and not every file contains the correct functions or the correct data (rodata is mostly the exception since it is automatically split). + +To change a split for a file, find its entry in `tools/disasm/files.txt`, and change or create entries to accurately reflect where the file(s) should start. For example, it was found that the last function in `z_nmi_buff.c` had nothing to do with the rest, so it should be split into its own file. Looking up the address of the last function, it was found to be at `0x8010C1B0`, so adding the line: + +```diff + 0x8010C0C0 : "z_nmi_buff", ++++ 0x8010C1B0 : "code_8010C1B0", + 0x8010C230 : "z_olib", +``` + +to the file will extract it correctly as a separate file. It also is necessary to make a new C file and move the `GLOBAL_ASM` declaration into it. + +Unfortunately you essentially have to redisassemble after telling the disassembler to resplit a file. + + +## diff --git a/docs/tutorial/documenting.md b/docs/tutorial/documenting.md new file mode 100644 index 0000000000..9b2c8e177e --- /dev/null +++ b/docs/tutorial/documenting.md @@ -0,0 +1,601 @@ +# Documenting + +Up: [Contents](contents.md) +Previous: [Data](data.md) + +Decompilation is only the first step: since the point of this project is to understand the game better than ever before, the code needs documentation. In this document, we will go through the basic stuff that it's good to do for any actor: we will not try to understand every single thing the actor does in full detail, but try to name the functions and variables usefully for a full documentation pass later to take advantage of. + +It is helpful to document the functions and variables in the actor before you Pull Request it. The aim is to provide code that is sufficiently clear to be self-documenting, but it is worth leaving a comment on anything you find obscure or confusing. (Pull Request reviews will let you know if you are leaving too many comments.) Useful things to do documentation-wise: + +- Name all (or most) of the functions. +- Name all the variables in the actor struct. +- Create enums for params, and any other numbers that would benefit from that sort of clarity. + +You can test things using the practice rom for a retail version (watches and memory view is especially helpful), as well as the generated rom with Project 64 and something like Spectrum. + +If you want to use `diff.py` after renaming anything, particularly functions, remember to rerun `make diff-init` so it can use the correct symbols. + +Finally, *if you are not sure what something does, either ask or leave it unnamed: it will be less confusing later if things are unnamed than if they are wrongly named* + + +## Renaming things + +Because MM needs to regenerate the assembly code, it is necessary to tell the disassembler the names of functions and variables, so it knows what symbols to assign in the code. This is done via `functions.txt` and `variables.txt`. The best way to rename functions and symbols is via global rename in an editor like VSCode. The next best way is to run `tools/rename_sym.sh`. You should be careful with this script: it has no error-checking! + +Renaming symbols in theory requires re-disassembly. This can often be avoided in the case of functions by running `tools/rename_global_asm.py`, which will rename any individual functions' assembly files with the wrong names, so that the `GLOBAL_ASM`s can spot them. Renaming variables *may* require redisassembly (and if fake symbols are removed, it *will*). + + +## EnRecepgirl + +Currently, the file looks like this: +
+ +Large code block, click to show + + +```C +#include "z_en_recepgirl.h" + +#define FLAGS 0x00000009 + +#define THIS ((EnRecepgirl*)thisx) + +void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); + +void func_80C10148(EnRecepgirl* this); +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C10290(EnRecepgirl* this); +void func_80C102D4(EnRecepgirl * this, GlobalContext * globalCtx); + +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, + sizeof(EnRecepgirl), + (ActorFunc)EnRecepgirl_Init, + (ActorFunc)EnRecepgirl_Destroy, + (ActorFunc)EnRecepgirl_Update, + (ActorFunc)EnRecepgirl_Draw, +}; + +extern void* D_0600F8F0; +extern void* D_0600FCF0; +extern void* D_060100F0; + +static void* D_80C106B0[4] = { &D_0600F8F0, &D_0600FCF0, &D_060100F0, &D_0600FCF0 }; + +// static InitChainEntry sInitChain[] = { +static InitChainEntry D_80C106C0[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), +}; + +static s32 D_80C106C8 = 0; + +extern AnimationHeader D_06000968; +extern AnimationHeader D_06001384; +extern AnimationHeader D_06009890; +extern AnimationHeader D_0600A280; +extern AnimationHeader D_0600AD98; +extern FlexSkeletonHeader D_06011B60; + + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s") +void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { + EnRecepgirl* this = THIS; + s32 i; + + Actor_ProcessInitChain(&this->actor, D_80C106C0); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + + if (D_80C106C8 == 0) { + for (i = 0; i < 4; i++) { + D_80C106B0[i] = Lib_SegmentedToVirtual(D_80C106B0[i]); + } + D_80C106C8 = 1; + } + + this->unk_2AC = 2; + + if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + + func_80C10148(this); +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Destroy.s") +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s") +void func_80C100DC(EnRecepgirl *this) { + if (this->unk_2AC != 0) { + this->unk_2AC++; + if (this->unk_2AC == 4) { + this->unk_2AC = 0; + return; + } + return; + } + if (Rand_ZeroOne() < 0.02f) { + this->unk_2AC++; + } +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10148.s") +void func_80C10148(EnRecepgirl *this) { + if (this->skelAnime.animation == &D_06001384) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } + this->actionFunc = func_80C1019C; +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C1019C.s") +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f); + } + } + + if (func_800B84D0(&this->actor, globalCtx) != 0) { + func_80C10290(this); + } else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) { + func_800B8614(&this->actor, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == 2) { + this->actor.textId = 0x2367; + } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + } +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10290.s") +void func_80C10290(EnRecepgirl *this) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + this->actionFunc = func_80C102D4; +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C102D4.s") +void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { + u8 temp_v0_2; + + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_ChangeDefaultRepeat(&this->skelAnime, &D_06001384); + } else if (this->skelAnime.animation == &D_0600AD98) { + if (this->actor.textId == 0x2ADA) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } + } else if (this->actor.textId == 0x2ADA) { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + } + } + + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; + func_80C10148(this); + return; + } + + if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) { + if (this->actor.textId == 0x2AD9) { + Actor_SetSwitchFlag(globalCtx, this->actor.params); + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + if ((gSaveContext.weekEventReg[63] & 0x80)) { + this->actor.textId = 0x2ADF; + } else { + this->actor.textId = 0x2ADA; + } + } else if (this->actor.textId == 0x2ADC) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + this->actor.textId = 0x2ADD; + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + if (this->actor.textId == 0x2ADD) { + this->actor.textId = 0x2ADE; + } else if (this->actor.textId == 0x2ADA) { + this->actor.textId = 0x2ADB; + } else { + this->actor.textId = 0x2AE0; + } + } + func_80151938(globalCtx, this->actor.textId); + } +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Update.s") +void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { + s32 pad; + EnRecepgirl* this = THIS; + Vec3s sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + func_80C100DC(this); +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") +s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + rot->x += this->unk_2AE.y; + } + return false; +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") +void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + Matrix_RotateY(0x400 - this->unk_2AE.x, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledX(500.0f, &this->actor.focus.pos); + } +} + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") +void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); + + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +``` + +
+ +(We can delete the `GLOBAL_ASM` lines now.) + +The worst part of documentation is finding somewhere to start. We have a decent place to start here, though, in that we already know the function (or rather, the use) of a couple of the functions, namely the LimbDraws. So we can rename `func_80C10558` to `EnRecepgirl_OverrideLimbDraw` and `func_80C10590` to `EnRecepgirl_UnkLimbDraw`. Remember to do a global rename so that the functions in the assembly are renamed, use `rename_global_asm`, +``` +$ ./tools/rename_global_asm.py +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s --> asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_OverrideLimbDraw.s +asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s --> asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_UnkLimbDraw.s +``` +as well as the mentions in this chunk of `functions.txt`: +``` + 0x80C0FFD0:("EnRecepgirl_Init",), + 0x80C100CC:("EnRecepgirl_Destroy",), + 0x80C100DC:("func_80C100DC",), + 0x80C10148:("func_80C10148",), + 0x80C1019C:("func_80C1019C",), + 0x80C10290:("func_80C10290",), + 0x80C102D4:("func_80C102D4",), + 0x80C104E8:("EnRecepgirl_Update",), + 0x80C10558:("func_80C10558",), + 0x80C10590:("func_80C10590",), + 0x80C105EC:("EnRecepgirl_Draw",), +``` + +That's probably as much as we can do on functions for now. Next let's think about some of the variables. We have essentially 3 sorts of variable here +- struct variables +- data/bss +- intrafunction/stack variables + +and this is roughly the order of preference for naming them (although not necessarily the logical order to determine what they do). This actor is quite limited in the last category: only `sp30` is unnamed at the moment. Even though `func_800E9250` is decomped, the purpose of the argument in which `sp30` is placed is not clear (and, indeed, is not named), so it's probably best to leave it unnamed for now. (With greater experience, you might analyse `func_800E9250` to work out what this argument is for, but let's not worry about that for now.) + +As for the struct, there are two unnamed variables at the moment: +```C +typedef struct EnRecepgirl { + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[24]; + /* 0x218 */ Vec3s morphTable[24]; + /* 0x2A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x2AC */ u8 unk_2AC; + /* 0x2AE */ Vec3s unk_2AE; +} EnRecepgirl; // size = 0x2B4 +``` + +Let's start with `unk_2AC`. This is set to `2` in `Init`, something interesting happens to it in `func_80C100DC`, but it is used in the `Draw`, here: +```C + gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); +``` +So it is used as an index into the array `D_80C106B0`, and the element with that index is placed on segment `8`. So we need to work out what this array is to name `unk_2AC`. + +As we discussed last time, `D_80C106B0` is an array of [segmented pointers](data.md#segmented-pointers). Since they are in segment `6`, they are in the actor's object file. Which object? The InitVars tell us: namely, +```C +const ActorInit En_Recepgirl_InitVars = { + ACTOR_EN_RECEPGIRL, + ACTORCAT_NPC, + FLAGS, + OBJECT_BG, +``` +the fourth element is the object (it is actually an enum, but the file itself has the same name as the object enum). So, we need to look at the object file. We are very lucky that a custom tool has been written for such a thing: Z64Utils. + + +## Z64Utils + +The latest release of Z64Utils can be downloaded from [https://github.com/Random06457/Z64Utils/releases]. To use it with MM, you also need a json file to fill in the file names: the latest version can be obtained from [https://github.com/Random06457/Z64Utils-Config]. It should work on Wine. Some graphics cards don't love it, but the 3D graphical part is only required for skeleton and animations. + +Having downloaded and unzipped it, open the baserom file. This will populate the main window with a list: + +![Z64Utils' main window](images/z64utils_main.png) + +Search for the object file, right-click and select "Open in Object Analyzer". It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment `6`, so just click okay. This will open this window: + +![Z64Utils' object analyzer window](images/z64utils_object_analyzer.png) + +Go to "Analysis -> Find Dlists" and press OK (the defaults are usually fine). This will automatically search for displaylists in the object, which are a sufficiently distinctive format to be easy to find. We want to see the other stuff in the object too, so also do "Analysis -> Analyze Dlists". This will populate the window with even more stuff: + +![Z64Utils, with an analyzed object](images/z64utils_object_analyzed.png) + +We will talk about what all these types of data are next time, but for now, all we want to know is what +```C +extern void* D_0600F8F0; +extern void* D_0600FCF0; +extern void* D_060100F0; +``` +actually are. We know they are set on segment 8, so we need to find where the skeleton uses them. We know from `extern FlexSkeletonHeader D_06011B60;` that this is at `0x06011B60`, so scroll down to it, right-click on it, and choose "Open in Skeleton Viewer". Pick an animation that we know it uses (sometimes Z64Utils misidentifies other things for animations), such as `extern AnimationHeader D_06000968;`, and you will get this error: + +![Z64Utils, error when viewing skeleton](images/z64utils_skeleton_error.png) + +It needs something to be set to segment `8`. Well, that's good, we know that the code does that! Let's find out what. Z64Utils tells you the address, so we can look up the displaylist that wants it: the relevant block is +```C +[...] +// Multi Command Macro Found (6 instructions) +0600DE70: gsDPLoadTLUT(256, 0x100, D_0600F6F0), +// Multi Command Macro Found (7 instructions) +0600DEA0: gsDPLoadTextureBlock(D_08000000, G_IM_FMT_CI, G_IM_SIZ_8b, 32, 32, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 5, 5, 0, 0), +0600DED8: gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, (63<<2), (31<<2)), +0600DEE0: gsSPVertex(D_0600B3F0, 19, 0), +0600DEE8: gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), +0600DEF0: gsSP2Triangles(6, 7, 5, 0, 8, 4, 3, 0), +0600DEF8: gsSP2Triangles(7, 6, 9, 0, 5, 10, 3, 0), +0600DF00: gsSP2Triangles(5, 7, 10, 0, 11, 9, 6, 0), +0600DF08: gsSP2Triangles(11, 12, 9, 0, 4, 1, 13, 0), +0600DF10: gsSP2Triangles(6, 14, 11, 0, 13, 5, 4, 0), +0600DF18: gsSP2Triangles(5, 14, 6, 0, 15, 14, 5, 0), +0600DF20: gsSP2Triangles(8, 1, 4, 0, 2, 1, 8, 0), +0600DF28: gsSP2Triangles(13, 16, 5, 0, 13, 14, 17, 0), +0600DF30: gsSP2Triangles(18, 11, 14, 0, 12, 11, 18, 0), +0600DF38: gsSP1Triangle(13, 1, 0, 0), +0600DF40: gsDPPipeSync(), +[...] + +``` +so we see that segment `8` is expecting a texture (we'll go into more detail about precisely what when we talk about making the XML file to extract the object). Therefore, `D_80C106B0` is a set of textures. We have a special type for textures, namely `TexturePtr`. + +## Back to the data + +But what sort of textures? This is an NPC, so what textures on the model would it want to change? The answer is of course the eyes: most NPCs have eye textures, with some sort of routine for changing them to appear to blink. We can set the different textures onto segment `8` and see which is which, but this is enough to know that `D_80C106B0` can be `sEyeTextures` (`s` for `static`: they essentially have to be static so that we can name them like this without the names clashing), and that `unk_2AC` is `eyeTexIndex` (these names are not completely standard, but it's best to be as consistent as possible). + +**N.B.** static data should not be renamed in the assembly or `variables.txt`, since assembly has no notion of file locality and there can be symbol clashes. Therefore it should only be renamed in its respective file, not globally. +```C +extern void* D_0600F8F0; +extern void* D_0600FCF0; +extern void* D_060100F0; + +static TexturePtr sEyeTextures[] = { &D_0600F8F0, &D_0600FCF0, &D_060100F0, &D_0600FCF0 }; +``` + +And now it's rather more obvious what +```C +void func_80C100DC(EnRecepgirl* this) { + if (this->eyeTexIndex != 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex == 4) { + this->eyeTexIndex = 0; + } + } else if (Rand_ZeroOne() < 0.02f) { + this->eyeTexIndex++; + } +} +``` +is doing: it's running a kind of blink routine. This is slightly nonstandard: usually there is a separate timer, but this one simply perturbs the index away from `0` every frame with a 2% chance. This sort of function is usually called `Blink` or `UpdateEyes`. Since it is explicitly called in `Update`, we'll call it `UpdateEyes`, but either is fine; we'll standardise later. + +We have two other pieces of data. There is a suggested name for the InitChain in the code already; just replace it and replace the first line in the definition. + +This leaves one piece of data unnamed, `D_80C106C8`. This is initially set to `0`, checked in `Init` to decide whether to run the loop, and then set to `1` after the loop is finished: +```C + if (D_80C106C8 == 0) { + for (i = 0; i < 4; i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); + } + D_80C106C8 = 1; + } +``` +What is this doing? We need to understand that to name this variable. + +The N64's processors cannot use segmented addresses: they need actual RAM addresses. Therefore the segmented addresses have to be converted before being placed on a segment: this is what `Lib_SegmentedToVirtual` does. So (somewhat unusually) this loop is modifying the addresses in the actor's actual data in RAM. Having converted the addresses once, it wouldn't make any sense to convert them again, but `Init` would run every time an instantiation of the actor is created. Therefore `D_80C106C8` is present to ensure that the addresses only get converted once: it is really a boolean that indicates if the addresses have been converted. So let's call it `texturesDesegmented`, and replace its values by `true` and `false`. + +Finally, clearly `4` is linked to the data over which we're iterating: namely it's the size of the array. We have a macro for this, `ARRAY_COUNT(sEyeTextures)`. + +We've got one struct variable left. To find out what it does, we can look at a function that uses it, for example +```C +s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + rot->x += this->unk_2AE.y; + } + return false; +} + +void EnRecepgirl_UnkLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + Matrix_RotateY(0x400 - this->unk_2AE.x, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledX(500.0f, &this->actor.focus.pos); + } +} +``` +It is used to do a rotation of whatever limb `5` is. (The `+=` is because `rot->x` is the base rotation of the limb, and we have to add the same thing to it every frame to keep the angle changed and constant.) We can use Z64Utils to : setting segment `8` to one of what we know now are the eye textures, we can view the model in the skeleton viewer. The limb numbers in the object are one smaller than those in the actor (the root limb is only a concept for the code, not the object), so we find limb 4: + +![Z64Utils highlighting a limb](images/z64utils_skeleton_head.png) + +Hence this is changing the head rotation. An obvious name is `headRot`. + +## Functions + +Finally, we have to name the rest of the functions. Setup functions are usually named as `_Setup`, so we really only have to name two functions. They are both related to text. if we annotate all the textIds (do not quote the whole message, just give an unambiguous summary), the flow becomes a bit clearer: + +```C +void func_80C10148(EnRecepgirl* this) { + if (this->skelAnime.animation == &D_06001384) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } + this->actionFunc = func_80C1019C; +} + +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f); + } + } + + if (func_800B84D0(&this->actor, globalCtx) != 0) { + func_80C10290(this); + } else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) { + func_800B8614(&this->actor, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?" + } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; // hear directions again? + } else { + this->actor.textId = 0x2AD9; // "Welcome..." + } + } +} + +void func_80C10290(EnRecepgirl* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + this->actionFunc = func_80C102D4; +} + +void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) { + u8 temp_v0_2; + + if (SkelAnime_Update(&this->skelAnime)) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_ChangeDefaultRepeat(&this->skelAnime, &D_06001384); + } else if (this->skelAnime.animation == &D_0600AD98) { + if (this->actor.textId == 0x2ADA) { // Mayor's office is on the left (meeting ongoing) + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } + } else if (this->actor.textId == 0x2ADA) { // Mayor's office is on the left (meeting ongoing) + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + } + } + + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; // hear directions again? + func_80C10148(this); + } else if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) { + if (this->actor.textId == 0x2AD9) { // "Welcome..." + Actor_SetSwitchFlag(globalCtx, this->actor.params); + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + if (gSaveContext.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting + this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) + } else { + this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) + } + } else if (this->actor.textId == 0x2ADC) { // hear directions again? + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + this->actor.textId = 0x2ADD; // "So..." + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + + if (this->actor.textId == 0x2ADD) { // "So..." + 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 + } else { + this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment + } + } + func_80151938(globalCtx, this->actor.textId); + } +} +``` +All this branching is to make the conversation look more diverse and interesting. Notably, though, `func_80C1019C` is set to start with, and is only changed when `func_800B84D0(&this->actor, globalCtx) != 0`. This is something to do with talking. The other function handles the rest of the conversation, and hands back to the first if `func_80152498(&globalCtx->msgCtx) == 2`. This function is *something* to do with the text state, which will require `z_message` to be decomped. However, observation in-game will reveal this is something to do with ending dialogue. So we can conclude that the action functions are `EnRecepgirl_Wait` and `EnRecepgirl_Talk`. The setup functions are thus `EnRecepgirl_SetupWait` and `EnRecepgirl_SetupTalk`. + +For more complex actors, we have a tool called `graphovl.py` that can produce function flow graphs for actors: running +``` +$ ./tools/graphovl/graphovl.py En_Recepgirl +``` +produces + +![EnRecepgirl's function flow graph](images/En_Recepgirl.gv.png) + + +## Miscellaneous other documentation + +We like to make macros for reading an actor's `params` (indeed, this is required even if you don't know what the params are for). A simple example is `ObjTree`, which has the following code in its `Init` function: + +```c + if (this->dyna.actor.params & 0x8000) { + Actor_SetScale(&this->dyna.actor, 0.15f); + this->dyna.actor.uncullZoneForward = 4000.0f; + } else { + Actor_SetScale(&this->dyna.actor, 0.1f); + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&D_06001B2C, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + } +``` + +Looking through the rest of the actor, it becomes apparent that `params & 0x8000` is only used for changing the size of the tree: ones with this bit set are larger. So we make a macro in the header: + +```c +#define OBJTREE_ISLARGE(thisx) ((thisx)->params & 0x8000) +``` + +Notice that we use `thisx`: this makes the form of every one of these macros the same. However, we only use `thisx` if required for matching, so when we add it to the actor, we use `&this->dyna.actor` (in this case, since `ObjTree` is a dynapoly actor). + +```c + if (OBJTREE_ISLARGE(&this->dyna.actor)) { + Actor_SetScale(&this->dyna.actor, 0.15f); + this->dyna.actor.uncullZoneForward = 4000.0f; + } else { + Actor_SetScale(&this->dyna.actor, 0.1f); + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&D_06001B2C, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + } +``` + +Much clearer! + + +We have now essentially documented this as far as we can without the object, so we'd better do that next. + +Next: [Analysing object files](object_decomp.md) diff --git a/docs/tutorial/draw_functions.md b/docs/tutorial/draw_functions.md new file mode 100644 index 0000000000..319d5efbb0 --- /dev/null +++ b/docs/tutorial/draw_functions.md @@ -0,0 +1,303 @@ +# Draw functions + +Up: [Contents](contents.md) +Previous: [The rest of the functions in the actor](other_functions.md) + +Draw functions behave completely differently from the other functions in an actor. They often use a lot of macros. + +This document will be a bit different: we will look at the draw functions in EnRecepgirl, then consider some more complicated examples. + +## A first example + +Unless it is completely invisible, an actor usually has a draw function as one of the main four actor functions. Hence its prototype looks like + +```C +void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +``` + +From now on, the process is rather different from the decompilation process used for the other functions. Here is the output of mips2c after sorting out the actor struct from Init, and with the arguments set back to `Actor* thisx`: +```C +s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); // extern +void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor); // extern +void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60100F0, (void *)0x600FCF0}; + +void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = (EnRecepgirl *) thisx; + GraphicsContext *sp30; + Gfx *temp_v1; + GraphicsContext *temp_a0; + + temp_a0 = globalCtx->state.gfxCtx; + sp30 = temp_a0; + func_8012C28C(temp_a0); + temp_v1 = sp30->polyOpa.p; + sp30->polyOpa.p = temp_v1 + 8; + temp_v1->words.w0 = 0xDB060020; + temp_v1->words.w1 = (u32) D_80C106B0[this->unk_2AC]; + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, (Actor *) this); +} +``` + + +Notable features are the GraphicsContext temps, and blocks of the form + +```C + temp_v1 = sp30->polyOpa.p; + sp30->polyOpa.p = temp_v1 + 8; + temp_v1->words.w0 = 0xDB060020; + temp_v1->words.w1 = (u32) D_80C106B0[this->unk_2AC]; +``` + +(This is a particularly simple example, since there's only one of these blocks. We will give a more involved example later.) + +Each of these blocks converts into a graphics macro. They are usually (but not always) straightforward, but manually converting them is a pain, and there are sometimes special cases. To deal with them easily, we will use a tool from glank's N64 tools. To install these, follow the instructions [here](https://practicerom.com/public/packages/debian/howto.txt). + +For our purposes, we only need one of the programs this provides: `gfxdis.f3dex2`. + + +Graphics are actually 64-bit on the Nintendo 64. This code block is a result of instructions telling the processor what to do with the graphics pointer. There are two main types of graphics pointer (there are a couple of others used in `code`, but actors will only use these two), +- polyOpa ("opaque") for solid textures +- polyXlu ("Xlucent" i.e. "translucent") for translucent textures + +Our example is polyOpa, not surprisingly since our receptionist is solid. + +`words.w0` and `words.w1` contain the actual graphics instruction, in hex format. Usually, `w0` is constant and `w1` contains the arguments. To find out what sort of macro we are dealing with, we use `gfxdis.f3dex2`. `w1` is variable, but we need to give the program a constant placeholder. A common word to use is 12345678, so in this case we run +``` +gfxdis.f3dex2 -x -g "POLY_OPA_DISP++" -d DB06002012345678 +``` + +- `-x` uses hex instead of the default qu macros (never mind what those are, MM doesn't use them) +- `-g` is used to specify which graphics pointer macro to use +- `-d` is for the graphics dword + +Our standard now is to use decimal colors. If you have a constant second argument rather than a variable one, you can also use `-dc` to get decimal colors instead of the default hex. + +The output looks like +``` +gSPSegment(POLY_OPA_DISP++, 0x08, 0x12345678); +``` + +We can now replace the `0x12345678` by the actual second word, namely `D_80C106B0[this->unk_2AC]`. We can see mips2c has pulled in this data again: we saw it before in the `Init`. + +The words look like pointers to assets in the actor's object segment, which would make sense if we're looking for textures to draw. Because this data is used in a graphics macro, it will be either a displaylist or a texture; it may as well stay as `void*` until we come back to it later. + +```C +gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); +``` + +You repeat this for every block in the function. + +If you have worked on OoT, you will be aware of the functions `Graph_OpenDisps` and `Graph_CloseDisps`, and might be surprised to see them missing here. These functions are actually a debug feature: the `OPEN_DISPS` and `CLOSE_DISPS` macros still exist, but they don't expand to functions. Of course this means you have to guess where they go. A sensible guess for `OPEN_DISPS` is where the `gfxCtx` temp assignment first happens; `CLOSE_DISPS` is a bit harder, although it's basically just a `}`, so it *shouldn't* matter as much. + +It's sensible to eliminate all the `gfxCtx` temps and reintroduce as needed. Also remember to change the prototype and function definition back! +```C +s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") + +void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") + +// #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") +void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); + + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +``` + +And this matches. + +The last two functions in the actor are used as arguments in `func_801343C0`. This is a `SkelAnime` function, except unlike the OoT ones, it has three function callback arguments instead of two: in `functions.h` or `z_skelanime.c`, we find +```C +void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, + OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor) +``` +The typedefs of the callbacks it uses are in `z64animation.h`: +```C +typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + struct Actor* actor); + +typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, + struct Actor* actor); + +[...] + +typedef void (*UnkActorDraw)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* actor); +``` +which is where mips2c got them from. + +In this case, only two of them are used, and it is these that are the last functions standing between us and a decompiled actor. + +## OverrideLimbDraw, PostLimbDraw, UnkActorDraw + +Well, we don't have a PostLimbDraw here, but as we see from the prototype, it's much the same as the OverrideLimbDraw but without the `pos` argument and no return value. +```C +s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor) { + if (limbIndex == 5) { + rot->x += actor->unk2B0; + } + return 0; +} +``` +Only two things to do here: we need to use `EnRecepgirl` to get to `actor + 0x2B0`, and the return value is used as a boolean, so we replace `0` by `false` (`true` means "don't draw the limb", and is hardly ever used). +```C +s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + rot->x += this->unk_2AE.y; + } + return false; +} +``` + +As for the UnkActorDraw, it has a much simpler prototype. mips2c gives +```C +void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor) { + if (limbIndex == 5) { + Matrix_RotateY((s16) (0x400 - actor->unk2AE), 1); + Matrix_GetStateTranslationAndScaledX(500.0f, (Vec3f *) &actor->focus); + } +} +``` +There is only minor cleanup needed here: +- recasting the last argument, +- replacing the last argument of `Matrix_RotateY` by the enum `MTXMODE_APPLY` (which means "use the current matrix instead of starting from a new identity matrix"), and the first argument by `0x400 - this->unk_2AE.x`. +- `(Vec3f *) &actor->focus` to `&actor->focus.pos` (this is the same issue as `(Actor*)this`, where mips2c doesn't climb deep enough into the struct). +```C +void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + Matrix_RotateY(0x400 - this->unk_2AE.x, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledX(500.0f, &this->actor.focus.pos); + } +} +``` + +## Some more examples: ObjTree + +Since EnRecepgirl was a bit light on graphics macros, we will look at an example that has a few more. A nice simple one is `ObjTree_Draw`: the original mips2c output is +```C +void ObjTree_Draw(Actor *thisx, GlobalContext *globalCtx) { + s16 sp36; + s16 sp34; + Gfx *sp28; + Gfx *sp20; + Gfx *temp_v0; + Gfx *temp_v0_2; + Gfx *temp_v0_3; + Gfx *temp_v0_4; + GraphicsContext *temp_a0; + GraphicsContext *temp_s0; + + sp36 = (s16) (s32) (f32) thisx->shape.rot.x; + sp34 = (s16) (s32) (f32) thisx->shape.rot.z; + temp_a0 = globalCtx->state.gfxCtx; + temp_s0 = temp_a0; + func_8012C28C(temp_a0); + temp_v0 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0 + 8; + temp_v0->words.w0 = 0xDA380003; + sp28 = temp_v0; + sp28->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + temp_v0_2 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_2 + 8; + temp_v0_2->words.w1 = (u32) &D_06000680; + temp_v0_2->words.w0 = 0xDE000000; + Matrix_InsertRotation(sp36, 0, sp34, 1); + temp_v0_3 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_3 + 8; + temp_v0_3->words.w0 = 0xDA380003; + sp20 = temp_v0_3; + sp20->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + temp_v0_4 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_4 + 8; + temp_v0_4->words.w1 = (u32) &D_060007C8; + temp_v0_4->words.w0 = 0xDE000000; +} +``` +We can see there are four blocks here, although only two different macros: +```C + temp_v0 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0 + 8; + temp_v0->words.w0 = 0xDA380003; + sp28 = temp_v0; + sp28->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); +``` +gfxdis gives +``` +$ gfxdis.f3dex2 -x -g POLY_OPA_DISP++ -d DA38000312345678 +gSPMatrix(POLY_OPA_DISP++, 0x12345678, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +``` +so it becomes +```C +gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +``` + +```C + temp_v0_2 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_2 + 8; + temp_v0_2->words.w1 = (u32) &D_06000680; + temp_v0_2->words.w0 = 0xDE000000; +``` +``` +$ gfxdis.f3dex2 -x -g POLY_OPA_DISP++ -d DE00000012345678 +gSPDisplayList(POLY_OPA_DISP++, 0x12345678); +``` +so this one is +```C +gSPDisplayList(POLY_OPA_DISP++, D_06000680); +``` + +```C + temp_v0_3 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_3 + 8; + temp_v0_3->words.w0 = 0xDA380003; + sp20 = temp_v0_3; + sp20->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); +``` +This is the same as the first one. Indeed, it's identical. +```C + temp_v0_4 = temp_s0->polyOpa.p; + temp_s0->polyOpa.p = temp_v0_4 + 8; + temp_v0_4->words.w1 = (u32) &D_060007C8; + temp_v0_4->words.w0 = 0xDE000000; +``` +This is the same as the second one, but with a different second word. + +Tidying up and inserting `OPEN_DISPS` and `CLOSE_DISPS`, we end up with +```C +void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx) { + s16 sp36 = (f32) thisx->shape.rot.x; + s16 sp34 = (f32) thisx->shape.rot.z; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_06000680); + + Matrix_InsertRotation(sp36, 0, sp34, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_060007C8); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +``` + +## RGB macros and bitpacking + +TODO: find some examples for this one. + +For even more examples, you can consult [the OoT tutorial](https://github.com/zeldaret/oot/blob/master/docs/tutorial/draw_functions.md) + +Next: [Data](data.md) diff --git a/docs/tutorial/images/EnRecepgirl_Init_diff_matching.png b/docs/tutorial/images/EnRecepgirl_Init_diff_matching.png new file mode 100644 index 0000000000..9fc4730192 Binary files /dev/null and b/docs/tutorial/images/EnRecepgirl_Init_diff_matching.png differ diff --git a/docs/tutorial/images/EnRecepgirl_stack_diff.png b/docs/tutorial/images/EnRecepgirl_stack_diff.png new file mode 100644 index 0000000000..c5de5f3665 Binary files /dev/null and b/docs/tutorial/images/EnRecepgirl_stack_diff.png differ diff --git a/docs/tutorial/images/En_Recepgirl.gv.png b/docs/tutorial/images/En_Recepgirl.gv.png new file mode 100644 index 0000000000..fe30408698 Binary files /dev/null and b/docs/tutorial/images/En_Recepgirl.gv.png differ diff --git a/docs/tutorial/images/fresh_actor_data.png b/docs/tutorial/images/fresh_actor_data.png new file mode 100644 index 0000000000..c887ce4518 Binary files /dev/null and b/docs/tutorial/images/fresh_actor_data.png differ diff --git a/docs/tutorial/images/func_80C100DC_diff1.png b/docs/tutorial/images/func_80C100DC_diff1.png new file mode 100644 index 0000000000..1f899b1b51 Binary files /dev/null and b/docs/tutorial/images/func_80C100DC_diff1.png differ diff --git a/docs/tutorial/images/func_80C100DC_diff2.png b/docs/tutorial/images/func_80C100DC_diff2.png new file mode 100644 index 0000000000..db4404d8f5 Binary files /dev/null and b/docs/tutorial/images/func_80C100DC_diff2.png differ diff --git a/docs/tutorial/images/func_80C100DC_diff3.png b/docs/tutorial/images/func_80C100DC_diff3.png new file mode 100644 index 0000000000..b0d25c693e Binary files /dev/null and b/docs/tutorial/images/func_80C100DC_diff3.png differ diff --git a/docs/tutorial/images/func_80C102D4_diff1.png b/docs/tutorial/images/func_80C102D4_diff1.png new file mode 100644 index 0000000000..2b4147999d Binary files /dev/null and b/docs/tutorial/images/func_80C102D4_diff1.png differ diff --git a/docs/tutorial/images/func_80C102D4_diff2.png b/docs/tutorial/images/func_80C102D4_diff2.png new file mode 100644 index 0000000000..0fefcb43ce Binary files /dev/null and b/docs/tutorial/images/func_80C102D4_diff2.png differ diff --git a/docs/tutorial/images/z64utils_main.png b/docs/tutorial/images/z64utils_main.png new file mode 100644 index 0000000000..972c9c4a5d Binary files /dev/null and b/docs/tutorial/images/z64utils_main.png differ diff --git a/docs/tutorial/images/z64utils_object_analyzed.png b/docs/tutorial/images/z64utils_object_analyzed.png new file mode 100644 index 0000000000..9a2de8dac6 Binary files /dev/null and b/docs/tutorial/images/z64utils_object_analyzed.png differ diff --git a/docs/tutorial/images/z64utils_object_analyzer.png b/docs/tutorial/images/z64utils_object_analyzer.png new file mode 100644 index 0000000000..7a6adec3db Binary files /dev/null and b/docs/tutorial/images/z64utils_object_analyzer.png differ diff --git a/docs/tutorial/images/z64utils_skeleton_error.png b/docs/tutorial/images/z64utils_skeleton_error.png new file mode 100644 index 0000000000..821ff69f61 Binary files /dev/null and b/docs/tutorial/images/z64utils_skeleton_error.png differ diff --git a/docs/tutorial/images/z64utils_skeleton_head.png b/docs/tutorial/images/z64utils_skeleton_head.png new file mode 100644 index 0000000000..263f066425 Binary files /dev/null and b/docs/tutorial/images/z64utils_skeleton_head.png differ diff --git a/docs/tutorial/introduction.md b/docs/tutorial/introduction.md new file mode 100644 index 0000000000..4e2d8324d3 --- /dev/null +++ b/docs/tutorial/introduction.md @@ -0,0 +1,87 @@ +# Introduction + +In this project, we are decompiling The Legend of Zelda: Majora's Mask. This means that we take the assembly language that is on the cartridge, + +``` +glabel func_809529AC +/* 00038C 809529AC 27BDFFE0 */ addiu $sp, $sp, -0x20 +/* 000390 809529B0 AFBF001C */ sw $ra, 0x1c($sp) +/* 000394 809529B4 AFA40020 */ sw $a0, 0x20($sp) +/* 000398 809529B8 0C02E27E */ jal Actor_HasParent +/* 00039C 809529BC AFA50024 */ sw $a1, 0x24($sp) +/* 0003A0 809529C0 8FA40020 */ lw $a0, 0x20($sp) +/* 0003A4 809529C4 1040000C */ beqz $v0, .L809529F8 +/* 0003A8 809529C8 8FA50024 */ lw $a1, 0x24($sp) +/* 0003AC 809529CC A4800116 */ sh $zero, 0x116($a0) +/* 0003B0 809529D0 8C860098 */ lw $a2, 0x98($a0) +/* 0003B4 809529D4 8C87009C */ lw $a3, 0x9c($a0) +/* 0003B8 809529D8 AFA40020 */ sw $a0, 0x20($sp) +/* 0003BC 809529DC 0C02E140 */ jal func_800B8500 +/* 0003C0 809529E0 AFA00010 */ sw $zero, 0x10($sp) +/* 0003C4 809529E4 8FA40020 */ lw $a0, 0x20($sp) +/* 0003C8 809529E8 3C0E8095 */ lui $t6, %hi(func_80952A1C) +/* 0003CC 809529EC 25CE2A1C */ addiu $t6, $t6, %lo(func_80952A1C) +/* 0003D0 809529F0 10000006 */ b .L80952A0C +/* 0003D4 809529F4 AC8E01F4 */ sw $t6, 0x1f4($a0) +.L809529F8: +/* 0003D8 809529F8 C484009C */ lwc1 $f4, 0x9c($a0) +/* 0003DC 809529FC 8C870098 */ lw $a3, 0x98($a0) +/* 0003E0 80952A00 24060035 */ addiu $a2, $zero, 0x35 +/* 0003E4 80952A04 0C02E287 */ jal func_800B8A1C +/* 0003E8 80952A08 E7A40010 */ swc1 $f4, 0x10($sp) +.L80952A0C: +/* 0003EC 80952A0C 8FBF001C */ lw $ra, 0x1c($sp) +/* 0003F0 80952A10 27BD0020 */ addiu $sp, $sp, 0x20 +/* 0003F4 80952A14 03E00008 */ jr $ra +/* 0003F8 80952A18 00000000 */ nop +``` + +(the commented numbers on the left are the original machine code, the middle the translation into MIPS assembly, the right useful information about the numbers in the code) +and turn it into compilable C code: + +```C +void func_809529AC(EnMs *this, GlobalContext *globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.textId = 0; + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + this->actionFunc = func_80952A1C; + } else { + func_800B8A1C(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + } +} +``` + +which is intended to be as close to the original code as we can get just by looking at the assembly. We are doing *matching* decomp: in the right context, and with the right compiler settings, the above C compiles into *precisely* the assembly code above, not just equivalent code. + +N.B. We are using only publicly available code. In particular, we are not looking at any of the recent Nintendo source code leaks. + +Progress of the project can be found at [https://zelda64.dev]. The long-term goal of this project is to obtain a complete compilable version of the code for every publicly released version of Majora's Mask (in the same way as the Ocarina of Time project and many other Zelda games). *We are not working on a PC Port, and neither this project nor the ZeldaRET organisation will not be making one*, although the resulting code will be very useful if someone does intend to make such a port. + +Most of the discussion on the project takes place on the Zelda Decompilation Discord (linked in the [README.md](../../README.md)). We are very welcoming to newcomers and are happy to help you with any problems you might have with the decompilation process. + +## What do I need to know to take part? + +Basic knowledge of C, particularly arrays and pointers, is extremely useful. Knowledge of MIPS is not required initially, but if you are serious about decompilation you will soon pick up a lot of it. + +Knowledge of the fundamentals of git and GitHub is required. There are a number of tutorials available online, and a later document in this tutorial describes how you contribute to this project outside the actual decompilation process. + +The most useful knowledge to have is a general understanding of how the game works. An afternoon of constructive mucking about in the [Practice Rom](https://kz.zeldacodes.org/) (aka KZ) will be very beneficial if you have not looked at the game's subsurface workings before. + +## Structure of the code + +A lot of work has already been done on the code to bring it into a format that is easy to decompile. I will discuss actors, since this is where the majority of new people should begin. + +An *actor* is any thing in the game that moves or performs actions or interactions: Link is an actor, enemies are actors, NPCs are actors, props like grass are actors. The vast majority of actors are *overlays*, which means they are loaded only when the game needs them. + +In the code, each actor is associated to several files: there is +- the main .c file, e.g. `src/overlays/actors/ovl_En_Ms/z_en_ms.c` +- the actor's Header file, e.g. `src/overlays/actors/ovl_En_Ms/z_en_ms.h` +- various .o files that tell the `make` script how to incorporate it into building the ROM, + +and then for undecompiled actors, various assembly (.s) files, generally including: +- one for the actor's *data* (this usually includes things like its collision information about how to draw it, and various other stuff that is used in it), e.g. `data/overlays/actors/ovl_En_Ms.data.s` +- one for each function in the actor, e.g. `asm/non_matchings/overlays/actors/ovl_En_Ms/func_809529AC.s` + +(In this project, all assembly code and asset files are extracted from a user-provided ROM: if you look in the GitHub repository, you will see that only decompiled source code is present.) + +The basic process of decomp is to take one or more of the .s files, run it through a decompilation program (mips_to_c) that reads the ASM very literally, and then, through human ingenuity, reshape it into code that not only compiles in the first place, but completely matches the assembly generation of the original code (well-written or otherwise; it's also very likely that our constructed code differs significantly from the original, even if it still compiles to the same thing). diff --git a/docs/tutorial/merging.md b/docs/tutorial/merging.md new file mode 100644 index 0000000000..1d8c6ad1c2 --- /dev/null +++ b/docs/tutorial/merging.md @@ -0,0 +1,97 @@ +# The merging process + +Up: [Contents](contents.md) +Previous: [Documenting](documenting.md) + + +## Preparing to PR + +### Change the `spec` + +Specifically, to use the automatically generated reloc, rather than the original. In the case of an entirely matched actor, you find the section relating to the actor that you edited before: + +``` +beginseg + name "ovl_En_Recepgirl" + include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" + //include "build/data/overlays/actors/ovl_En_Recepgirl.data.o" + include "build/data/overlays/actors/ovl_En_Recepgirl.reloc.o" +endseg +``` + +and change to use our reloc: + +``` +beginseg + name "ovl_En_Recepgirl" + include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" + include "build/src/overlays/actors/ovl_En_Recepgirl/ovl_En_Recepgirl_reloc.o" +endseg +``` + +(copy the path, then copy the directory name and put `_reloc.o` after it). + +### Non-matchings + +If you can't match a function even with everyone's help in the `mm-decomp-help` discord channel, don't worry overlong about it. Hopefully you can get it to do the same thing as the original (non-matching), and then you set it up to use the original asm for the matching build, and your code for the non-matching. This looks like + +```c +#ifdef NON_MATCHING +// Helpful comment about the nature of the nonmatching +void function() { + // ... +} +#else +#pragma GLOBAL_ASM(asm/.../function.s) +#endif +``` + +in the C file. Also, due to the way `GLOBAL_ASM` works, we also cannot use generated reloc for overlays with nonmatchings, so we have to do the same thing for the reloc file in the spec: + +``` +beginseg + name "ovl_En_Recepgirl" + compress + include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" +#ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_En_Recepgirl/ovl_En_Recepgirl_reloc.o" +#else + include "build/data/overlays/actors/ovl_En_Recepgirl.reloc.o" +#endif +endseg +``` + +Ideally you should at least be able to get a function to have equivalent behaviour; if not, and you have exhausted all other avenues of getting help, it should be marked in the C file as `NON_EQUIVALENT`, in the same way as a nonmatching. We do not change the spec for non-equivalents: they are treated the same as undecompiled code from a building perspective, lest they break things. + +### Format + +Run the formatting script `format.sh`, to format the C files in the standard way we use. If you have some arrays or struct definitions in your file, check that they have not been obnoxiously padded out: you can usually get a better format without a final comma for short things. + +**N.B.** this is now essential: the CI will fail immediately if it detects files that change when formatted. + +### Merge master + +To make sure the PR builds correctly with the current master, you need to merge `upstream/master` before you make the PR. This tends to break things, that you have to fix to get it to compile correctly again. + + +## Pull Requests + +Push commits to your fork of the repository on GitHub, and then open a pull request. Name the PR something sensible, like + +- `EnRecepgirl OK and documented` (if all the functions match and your documentation is fairly complete) +- `EnRecepgirl OK` (if all the functions match) +- `EnRecepgirl (n nonmatching)` (if you couldn't get one or more functions to match, but to the best of your knowledge they are equivalent code) +- `EnRecepgirl (n nonequivalent)` (if you couldn't get one or more functions to match, and do not believe the code in them has the same effect) + +and so on, although these four tend to cover most cases. Feel free to add a comment describing anything interesting you had to do or issues in non-matchings. + +Please also update the status of the file on Trello/the spreadsheet. + + +### Reviews + +Pull requests may be reviewed by anyone (who knows enough about the conventions of the project), and all must be reviewed and approved by two leads and one extra contributor. + +To implement suggestions made in reviews, it is generally easier to be consistent if you push more commits from your local branch. It is also quite possible that in the meantime some other PR has gone in, and git will ask you to merge master before you add more commits. This is normally fairly painless, although often you have to resolve merge conflicts. If in doubt, backup your work before doing anything, and ask in Discord before doing anything drastic, or if you don't understand what git is telling you. + +There is no need to wait for your PR to be approved and committed before working on your next file. diff --git a/docs/tutorial/object_decomp.md b/docs/tutorial/object_decomp.md new file mode 100644 index 0000000000..88fe89eca0 --- /dev/null +++ b/docs/tutorial/object_decomp.md @@ -0,0 +1,14 @@ +# Analysing object files + +Up: [Contents](contents.md) +Previous: [Documenting](documenting.md) + +TODO: To be written once automated objects are present. + +## Useful tools + +We are very fortunate that several nice tools have been written recently that are excellent for documenting asset files: +- [Z64Utils](https://github.com/Random06457/Z64Utils/releases), for looking at displaylists, textures they reference, the skeleton, animations, etc. +- [Texture64](https://github.com/queueRAM/Texture64/releases), for looking at textures in all the common N64 formats (needed since Z64Utils cannot interpret textures not explicitly referenced in displaylists currently) + +Next: [The merging process](merging.md) \ No newline at end of file diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md new file mode 100644 index 0000000000..bdc49036da --- /dev/null +++ b/docs/tutorial/other_functions.md @@ -0,0 +1,605 @@ +# The rest of the functions in the actor + +Up: [Contents](contents.md) +Previous: [Beginning decompilation: the Init function and the Actor struct](beginning_decomp.md) + +## Now what? + +At this point we have a choice to make. Either we could follow the main function flow and decompile `func_80C10148`, or take a look at `Destroy`, which for smaller actors can often be done straight after Init, since it usually just removes colliders and deallocates dynapoly. + +## Destroy + +Destroy will be a dead end, but we might as well do it now. Usually we would regenerate the context first and apply it to mips2c as with `Init`, but if we look at the assembly... +```mips +glabel EnRecepgirl_Destroy +/* 0000FC 80C100CC AFA40000 */ sw $a0, ($sp) +/* 000100 80C100D0 AFA50004 */ sw $a1, 4($sp) +/* 000104 80C100D4 03E00008 */ jr $ra +/* 000108 80C100D8 00000000 */ nop +``` +It doesn't seem to do anything. Indeed, chucking it in mips2c, +``` +$ ../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Destroy.s +void EnRecepgirl_Destroy(s32 arg0, ? arg1) { + +} +``` +so it really does do nothing. It is worth staying on this briefly to understand what is is doing, though. Even with no context, mips2c knows it takes two arguments because it does two saves onto the stack: the calling convention the N64 uses requires the first four arguments be saved from the registers onto the stack, since the registers are expected to be cleared when a function call happens. It's done a bad job of guessing what they are, but that's to be expected: the assembly only tells us they're words. Thankfully we already know in this case, so we can just replace the `GLOBAL_ASM` by +```C +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { + +} +``` +and cross this function off. + +## `func_80C10148` + +We don't really have a choice now, we have to look at this function. Remake the context (no need to change the function type this time), and run mips2c on the function's assembly file: +``` +$ ../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10148.s data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.s --context ctx.c +extern AnimationHeader D_0600AD98; +extern ? func_80C1019C; + +void func_80C10148(EnRecepgirl *this) { + SkelAnime *temp_a0; + + temp_a0 = &this->skelAnime; + if (&D_06001384 == this->skelAnime.animation) { + this = this; + Animation_MorphToPlayOnce(temp_a0, &D_0600AD98, 5.0f); + } + this->actionFunc = &func_80C1019C; +} +``` + +This gives us some information immediately: `D_0600AD98` is an `AnimationHeader`, and `func_80C1019C` is set as the action function. This means that we know its type, even though mips2c does not: looking in the header, we see the typedef is +```C +typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); +``` +and so we prototype `func_80C1019C` as +```C +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +``` +at the top (were it above the function we're currently working on, the prototype could eventually be replaced by the function definition itself, but since it isn't, it goes at the top with the others). + +There are several rather odd things going on here: +- `temp_a0` is only used once. As such it's probably fake. +- There's a weird `this = this` that does nothing +- `if (&D_06001384 == this->skelAnime.animation)` is a bit of a funny way to write the condition: it seems more likely it would be the other way round. +- Also, if we look up `animation`, we find it is an `AnimationHeader*`, so `D_06001384` can be externed as `AnimationHeader`. +- `func_80C1019C` is already a pointer, so the `&` is ineffectual. Our style is to not use `&` on function pointers. + +If we tackle these, we end up with +```C + +void func_80C10148(EnRecepgirl* this); +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); + +[...] + +extern AnimationHeader D_06001384; +extern AnimationHeader D_06009890; +extern UNK_TYPE D_0600A280; +extern AnimationHeader D_0600AD98; +extern FlexSkeletonHeader D_06011B60; + +[...] + +void func_80C10148(EnRecepgirl *this) { + if (this->skelAnime.animation == &D_06001384) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } + this->actionFunc = func_80C1019C; +} +``` +This is a common type of function called a setup (action) function. It runs once and prepares the ground for its corresponding actionfunction to run, whereas the actionfunction is usually run every frame by `Update` (but more on that later). Running `make`, we get OK again. + +Again we have only one way to go + + +## `func_80C1019C` + +Remake the context and run mips2c on this function's assembly file. We get +```C +? func_80C10290(EnRecepgirl *); // extern + +void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { + SkelAnime *sp24; + SkelAnime *temp_a0; + + temp_a0 = &this->skelAnime; + sp24 = temp_a0; + if (SkelAnime_Update(temp_a0) != 0) { + if (&D_0600A280 == this->skelAnime.animation) { + Animation_MorphToPlayOnce(temp_a0, &D_0600AD98, 5.0f); + } else { + Animation_ChangeTransitionRepeat(temp_a0, &D_06009890, -4.0f); + } + } + if (func_800B84D0((Actor *) this, globalCtx) != 0) { + func_80C10290(this); + return; + } + if (Actor_IsActorFacingLink((Actor *) this, 0x2000) != 0) { + func_800B8614((Actor *) this, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == 2) { + this->actor.textId = 0x2367; + return; + } + if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + this->actor.textId = 0x2ADC; + return; + } + this->actor.textId = 0x2AD9; + // Duplicate return node #12. Try simplifying control flow for better match + } +} +``` +This is a bit juicier! We can do some preliminary cleanup, then worry about the control flow. +- `sp24` does nothing, so is almost certainly fake. +- `temp_a0` is used in 3 different places, but they're all right next to one another and are unlikely to be required since there's no nontrivial calculation or anything happening. Let's remove it too and see what happens. +- We've got another reversed comparison, `&D_0600A280 == this->skelAnime.animation`. +- `D_0600A280` is an `AnimationHeader`. +- `(Actor *) this` should be replaced by `&this->actor`. +- `Flags_GetSwitch is a boolean and we don't need to cast the argument, as we have discussed before. (We don't know about the other functions in the conditions, so leave them for now.) +- Prototype `func_80C10290`: it is reasonable to guess it's another setup function, so `void func_80C10290(EnRecepgirl* this);`. + +Changing all these, we end up with +```C +void func_80C10148(EnRecepgirl* this); +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C10290(EnRecepgirl* this); + +[...] + +extern AnimationHeader D_06001384; +extern AnimationHeader D_06009890; +extern AnimationHeader D_0600A280; +extern AnimationHeader D_0600AD98; +extern FlexSkeletonHeader D_06011B60; + +[...] + +void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (&D_0600A280 == this->skelAnime.animation) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f); + } + } + if (func_800B84D0(&this->actor, globalCtx) != 0) { + func_80C10290(this); + return; + } + if (Actor_IsActorFacingLink(&this->actor, 0x2000) != 0) { + func_800B8614(&this->actor, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == 2) { + this->actor.textId = 0x2367; + return; + } + if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; + return; + } + this->actor.textId = 0x2AD9; + // Duplicate return node #12. Try simplifying control flow for better match + } +} +``` +If we look with diff.py, we find this matches. But we can replace some of the `return`s by `else`s: generally, we use elses unless +- After an `Actor_Kill` +- Sometimes after setting an actionfunction +- There's no way to avoid an early return + +Here, it's debatable whether to keep the first, since `func_80C10290` is likely a setup function. The latter two should be changed to elses, though. For now, let's replace all of them. This leaves us with +```C +void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f); + } + } + + if (func_800B84D0(&this->actor, globalCtx) != 0) { + func_80C10290(this); + } else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) { + func_800B8614(&this->actor, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == 2) { + this->actor.textId = 0x2367; + } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; + } else { + this->actor.textId = 0x2AD9; + } + } +} +``` +which still matches. Lastly, we have an enum for the output of `Player_GetMask` and other mask-related things: in `z64player.h` we find +```C +typedef enum { + /* 0x00 */ PLAYER_MASK_NONE, + /* 0x01 */ PLAYER_MASK_MASK_OF_TRUTH, + /* 0x02 */ PLAYER_MASK_KAFEIS_MASK, +[...] + /* 0x19 */ PLAYER_MASK_MAX +} PlayerMask; +``` +and so we can write the last if as `Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK`. + +Again, we have no choice in what to do next. + + +## `func_80C10290` + +Remaking the context and running mips2c gives +```C +void func_80C102D4(EnRecepgirl *, GlobalContext *); // extern + +void func_80C10290(EnRecepgirl *this) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + this->actionFunc = func_80C102D4; +} +``` +so all we have to do is add the function prototype for the newest action function. Not surprisingly, this matches without changing anything. + + +## `func_80C102D4` + +
+ +Large code block, click to show + + +```C +extern AnimationHeader D_06000968; + +void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { + SkelAnime *sp20; + AnimationHeader *temp_v0; + SkelAnime *temp_a0; + u16 temp_v0_3; + u16 temp_v0_4; + u8 temp_v0_2; + + temp_a0 = &this->skelAnime; + sp20 = temp_a0; + if (SkelAnime_Update(temp_a0) != 0) { + temp_v0 = this->skelAnime.animation; + if (&D_0600A280 == temp_v0) { + Animation_ChangeDefaultRepeat(sp20, &D_06001384); + } else if (&D_0600AD98 == temp_v0) { + if (this->actor.textId == 0x2ADA) { + Animation_MorphToPlayOnce(sp20, &D_06000968, 10.0f); + } else { + Animation_ChangeTransitionRepeat(sp20, &D_06009890, 10.0f); + } + } else if (this->actor.textId == 0x2ADA) { + Animation_ChangeTransitionRepeat(sp20, &D_06009890, 10.0f); + } else { + Animation_MorphToPlayOnce(sp20, &D_0600A280, -4.0f); + } + } + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; + func_80C10148(this); + return; + } + if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) { + temp_v0_3 = this->actor.textId; + if (temp_v0_3 == 0x2AD9) { + Actor_SetSwitchFlag(globalCtx, (s32) this->actor.params); + Animation_MorphToPlayOnce(sp20, &D_0600AD98, 10.0f); + if ((*(&gSaveContext + 0xF37) & 0x80) != 0) { + this->actor.textId = 0x2ADF; + } else { + this->actor.textId = 0x2ADA; + } + } else if (temp_v0_3 == 0x2ADC) { + Animation_MorphToPlayOnce(sp20, &D_0600AD98, 10.0f); + this->actor.textId = 0x2ADD; + } else { + Animation_MorphToPlayOnce(sp20, &D_06000968, 10.0f); + temp_v0_4 = this->actor.textId; + if (temp_v0_4 == 0x2ADD) { + this->actor.textId = 0x2ADE; + } else if (temp_v0_4 == 0x2ADA) { + this->actor.textId = 0x2ADB; + } else { + this->actor.textId = 0x2AE0; + } + } + func_80151938(globalCtx, this->actor.textId); + } +} +``` + +
+ +Well, this is a big one! We get one more extern, for `D_06000968`. A lot of the temps used in the conditionals look fake, with the exception of `temp_v0_2`: because the function is only called once but the temp is used twice, the temp must be real. Removing the others and switching the `animation` conditionals, +```C +void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { + u8 temp_v0_2; + + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_ChangeDefaultRepeat(&this->skelAnime, &D_06001384); + } else if (this->skelAnime.animation == &D_0600AD98) { + if (this->actor.textId == 0x2ADA) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + } else { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } + } else if (this->actor.textId == 0x2ADA) { + Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, 10.0f); + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + } + } + + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; + func_80C10148(this); + return; + } + + if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) { + if (this->actor.textId == 0x2AD9) { + Actor_SetSwitchFlag(globalCtx, this->actor.params); + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + if ((*(&gSaveContext + 0xF37) & 0x80) != 0) { + this->actor.textId = 0x2ADF; + } else { + this->actor.textId = 0x2ADA; + } + } else if (this->actor.textId == 0x2ADC) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + this->actor.textId = 0x2ADD; + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + if (this->actor.textId == 0x2ADD) { + this->actor.textId = 0x2ADE; + } else if (this->actor.textId == 0x2ADA) { + this->actor.textId = 0x2ADB; + } else { + this->actor.textId = 0x2AE0; + } + } + func_80151938(globalCtx, this->actor.textId); + } +} +``` +There remains one thing we need to fix before trying to compile it, namely `*(&gSaveContext + 0xF37) & 0x80`. This is really a funny way of writing an array access, because mips2c will get confused about arrays in structs. Opening up `z64save.h`, we find in the `SaveContext` struct that +```C + /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" + /* 0x0F5C */ u32 mapsVisited; // "area_arrival" +``` +so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.weekEventReg[63] & 0x80)` will do. + +Running `./diff.py -mwo3 func_80C102D4` and scrolling down, we discover that this doesn't match! + +![First run of diff.py on func_80C102D4](images/func_80C102D4_diff1.png) + +The yellow shows registers that don't match, the different colours on the registers help you to estimate where the problems are. Usually it's best to start at the top and work down if possible: any regalloc problems at the top tend to propagate most of the way down. In our case, the first problem is +``` +3f0: andi t0,v0,0xff r 153 3f0: andi t1,v0,0xff +``` +somehow we skipped over `t0`. Where is this in the code? The `153` in the middle is the line number in the C file (the `3f0`s are the offsets into the assembly file), we have `--source` if you want to see the code explicitly, or you can do it the old-fashioned way, and work it out from nearby function calls. In this case, `func_80C10148` is run straight after, and the only place that is called is +```C + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; + func_80C10148(this); + return; + } + + if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) { +``` + +If you look at the conditionals and the declaration of `temp_v0_2`, you may notice something odd: `temp_v0_2` is a `u8`. Therefore the `& 0xFF` does nothing! It's surprisingly common for this to happen, be it leaving out a `& 0xFF` or adding an extraneous one. If we remove it, we get a match: + +![func_80C102D4 now matching](images/func_80C102D4_diff2.png) + +Notice that indeed the subsequent regalloc, which might have looked like a bigger problem than the initial part, was also fixed: skipping a register in one place will throw the registers off below too. + +And now we've run out of functions. Time for `Update`. + + +## Update + +Update runs every frame and usually is responsible for the actor's common logic updates: for example, updating timers, blinking, updating collision, running the `actionFunc`, and so on, either directly or through other functions it calls. A lot of subsidiary functions that are not common to every state (e.g. updating position, or the text when talking, etc.) are carried out by one of the action functions we have already decomped. + +Remake the context and run mips2c: +```C +? func_80C100DC(EnRecepgirl *); // extern + +void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = (EnRecepgirl *) thisx; + ? sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, (Actor *) this, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); + func_80C100DC(this); +} +``` +If we search for `func_80C100DC`, we find that this is the only time it is used. Hence we can be almost certain that its prototype is `void func_80C100DC(EnRecepgirl* this);`. This function occurs above `Update`, so you can put the prototype next to the `GLOBAL_ASM` and remove it when we decompile that function. + +Change the function and the prototype back to `Actor* thisx`, and add the casting temp: +```C +void func_80C100DC(EnRecepgirl *); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s") + +[...] + +void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + ? sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, &this->actor, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); + func_80C100DC(this); +} +``` +Now, our problem is `func_800E9250`. The arguments all look terrible! Indeed, if we look at the actual function in `src/code/code_800E8EA0.c` (found by searching), we find that it should be +```C +s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) +``` +So mips2c has made a bit of a mess here: +- the third argument should be a `Vec3s`. Hence `this + 0x2AE` is a `Vec3s*`, and so `this->unk_2AE` is a `Vec3s` +- `&sp30` is a `Vec3s*`, so `sp30` is a `Vec3s` (it's clearly not used for anything, just used to "dump" a side-effect of the function) +- The last argument is supposed to be an actual `Vec3f` + +Fixing all of this, we end up with +```C +void EnRecepgirl_Update(EnRecepgirl *this, GlobalContext *globalCtx) { + EnRecepgirl* this = THIS; + Vec3s sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + func_80C100DC(this); +} +``` +and can fill in the top end of the struct: +```C +typedef struct EnRecepgirl { + /* 0x0000 */ Actor actor; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[24]; + /* 0x0218 */ Vec3s morphTable[24]; + /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x02AC */ u8 unk_2AC; + /* 0x02AD */ char unk_2AD[0x1]; + /* 0x02AE */ Vec3s unk_2AE; +} EnRecepgirl; // size = 0x2B4 +``` + +It's entirely possible that `unk_2AD` is not real, and is just padding: see [Types, structs, and padding](types_structs_padding.md) for the details. We'll find out once we've finished all the functions. If we look at the diff, we find that one line is different: + +![EnRecepgirl_Update's stack difference](images/EnRecepgirl_stack_diff.png) + +So `sp30` is in the wrong place: it's `4` too high on the stack in ours. This is because the main four functions do not actually take `GlobalContext`: they really take `Gamestate` and recast it with a temp, just like `EnRecepgirl* this = THIS;`. We haven't implemented this in the repo yet, though, so for now, it suffices to put a pad on the stack where it would go instead: experience has shown when it matters, it goes above the actor recast, so we end up with +```C +void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { + s32 pad; + EnRecepgirl* this = THIS; + Vec3s sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + func_80C100DC(this); +} +``` +and this now matches. + +**N.B.** sometimes using an actual `GlobalContext* globalCtx` temp is required for matching: add it to your bag o' matching memes. + +### *Some remarks about the function stack + +(Feel free to skip this if you'd rather finish the actor first.) + +The (function) stack is used to store variables. It has rather more space and is somewhat less volatile than registers (it still can't be used outside a function, except by a called function accessing its arguments). The stack a function sets up for itself to use is called its *stack frame* or *function frame* (or just *function stack* or *the stack*, although strictly speaking the frame itself is not a stack, since not just the top variable is accessed), and the function frames themselves form an (genuine) stack called the *call stack*. In MIPS this stack grows downwards, and its size is always a multiple of 0x8 (in case you want to put a 64-bit value on it, although almost no N64 game functions do this). The compiler uses the stack in a single function frame in the following way: + +| user-defined variables | +| compiler-defined varibles | +| saved registers | +| argument registers/stack | + +where sp is at the very bottom of this table, and the function that called the current function would have its frame above this one. We have seen a couple of aspects of this stack behaviour already: saving the function arguments onto it in [`EnRecepgirl_Destroy`](#destroy), and here, requiring an extre user stack variable to be the correct size. + +Anyway, back to EnRecepgirl. 4 functions to go... + +## `func_80C100DC` + +This is the final non-draw function. You know what to do now: remake the context and run mips2c: +```C +void func_80C100DC(EnRecepgirl *this) { + u8 temp_t6; + u8 temp_v0; + + temp_v0 = this->unk_2AC; + temp_t6 = temp_v0 + 1; + if (temp_v0 != 0) { + this->unk_2AC = temp_t6; + if ((temp_t6 & 0xFF) == 4) { + this->unk_2AC = 0; + return; + } + // Duplicate return node #5. Try simplifying control flow for better match + return; + } + if (Rand_ZeroOne() < 0.02f) { + this->unk_2AC += 1; + } +} +``` + +Well, hmm. It's pretty hard to tell what's going on here. Finally it's time to really use `diff.py`. this function is a bit more typical of what to expect: this actor has been very easy so far! + +![func_80C100DC, first diff](images/func_80C100DC_diff1.png) + +Well, it's still *pretty* close. But the registers are all wrong. Firstly, `temp_t6` is already `u8`, so the `& 0xFF` is again ineffective, so let's try removing it... + +![func_80C100DC, second diff](images/func_80C100DC_diff2.png) + +It's not obvious that did much: it even looks a bit worse. +```C + temp_v0 = this->unk_2AC; + temp_t6 = temp_v0 + 1; + if (temp_v0 != 0) { + this->unk_2AC = temp_t6; +``` +may remind you of that loop we decompiled, where mips2c unnecessarily made two temps. Let's walk through what this does. +- First, it saves the value of `this->unk_2AC` into `v0` +- Then, it adds one to it and stores it in `t6`. +- It checks if the first saved value is zero +- If it is, it sets `this->unk_2AC` to the incremented value and carries on. + +Well, if we allow ourselves to bend the order of operations a little, there's a much simpler way to write this with no temps, namely +```C + if (this->unk_2AC != 0) { + this->unk_2AC++; +``` +So let's try removing both temps: +```C +void func_80C100DC(EnRecepgirl *this) { + if (this->unk_2AC != 0) { + this->unk_2AC++; + if (this->unk_2AC == 4) { + this->unk_2AC = 0; + return; + } + return; + } + if (Rand_ZeroOne() < 0.02f) { + this->unk_2AC++; + } +} +``` + +![func_80C100DC, matching](images/func_80C100DC_diff3.png) + +There we go. + +Even though this matches, it is not quite according to our style: remember what was said earlier about early returns. Here, both of them can be removed and replaced by a single else without affecting matching: +```C +void func_80C100DC(EnRecepgirl *this) { + if (this->unk_2AC != 0) { + this->unk_2AC++; + if (this->unk_2AC == 4) { + this->unk_2AC = 0; + } + } else if (Rand_ZeroOne() < 0.02f) { + this->unk_2AC++; + } +} +``` +and this is how we prefer it to be written. + +With that, the last remaining function is `EnJj_Draw`. Draw functions have an extra layer of macroing that is required, so we shall cover them separately. + +Next: [Draw functions](draw_functions.md) diff --git a/docs/tutorial/types_structs_padding.md b/docs/tutorial/types_structs_padding.md new file mode 100644 index 0000000000..dc72e0100b --- /dev/null +++ b/docs/tutorial/types_structs_padding.md @@ -0,0 +1,159 @@ +# Types, structs, and padding + +Reminders: +- In N64 MIPS, 1 word is 4 bytes (yes, the N64 is meant to be 64-bit, but it mostly isn't used like it in MM or OoT) +- A byte is 8 bits, or 2 hex digits + + +## Types + +The following are the common data types used everywhere: + +| Name | Size | Comment | +| ---- | ----- | -------- | +| char | 1 byte | character | +| u8 | 1 byte | unsigned byte | +| s8 | 1 byte | signed byte | +| u16 | 2 bytes | unsigned short | +| s16 | 2 bytes | signed short | +| u32 | 4 bytes/1 word | unsigned int | +| s32 | 4 bytes/1 word | signed int | +| void* | 4 bytes/1 word | pointer | +| uintptr_t | 4 bytes/1 word | pointer^ | +| intptr_t | 4 bytes/1 word | pointer^ | + +A pointer is sometimes mistaken for an `s32`. The last two, marked with `^`, are special types allowing for arithmetic on generic pointers, and are to be used over `u32`. + +`s32` is the default thing to use in the absence of any other information about the data. + +Useful data for guessing types: +- `u8` is about 7 times more common than `s8` +- `s16` is about 16 times more common than `u16` +- `s32` is about 8 times more common than `u32` + +Another useful thing to put here: the typedef for an action function is +```C +typedef void (*ActorNameActionFunc)(struct ActorName*, GlobalContext*); +``` +where you replace `ActorName` by the actual actor name as used elsewhere in the actor, e.g. `EnRecepgirl`. In MM these typedefs have been automatically generated, so you don't need to constantly copy from here or another actor any more. + + +## Some Common Structs + +Here are the usual names and the sizes of some of the most common structs used in actors and their structs: +| Type | Usual name | Size | +| ----------------------- | --------------------- | --------------- | +| `Actor` | `actor` | 0x144 | +| `DynaPolyActor` | `dyna` | 0x15C | +| `Vec3f` | | 0xC | +| `Vec3s` | | 0x6 | +| `SkelAnime` | `skelAnime` | 0x44 | +| `Vec3s[limbCount]` | `jointTable` | 0x6 * limbCount | +| `Vec3s[limbCount]` | `morphTable` | 0x6 * limbCount | +| `ColliderCylinder` | `collider` | 0x4C | +| `ColliderQuad` | `collider` | 0x80 | +| `ColliderJntSph` | `collider` | 0x20 | +| `ColliderJntSphElement` | `colliderElements[n]` | 0x40 * n | +| `ColliderTris` | `collider` | 0x20 | +| `ColliderTrisElement` | `colliderElements[n]` | 0x5C * n | + +Note that `Actor` and `DynaPolyActor` have changed size from OoT. + + +## Padding + +### Alignment + +A stored variable or piece of data does not always start immediately after the previous one: there may be padding in between: `0`s that are never written or referred to, and so ignored. This is to do with how the processor accesses memory: it reads 1 word at a time, so multibyte objects are aligned so they cross as few word boundaries as possible. + +The clearest example of this is that variables with types that are 1 word in size (`s32`s and pointers, for example) are automatically shifted so that they start at the beginning of the next word, i.e. at an offset ending with one of `0,4,8,C`: this is called 4-alignment. This will also happen to `s16`s, but with 2-alignment + +### Struct padding + +In actor structs, this manifests as some of the char arrays not being completely replaced by actual variables. + +```C +typedef struct EnRecepgirl { + /* 0x0000 */ Actor actor; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[24]; + /* 0x0218 */ Vec3s morphTable[24]; + /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x02AC */ u8 unk_2AC; + /* 0x02AE */ Vec3s unk_2AE; +} EnRecepgirl; // size = 0x2B4 +``` + +Notice that even though `unk_2AC` is a `u8`, `unk_2AE` is at `this + 0x2AE`, rather than `0x2AD`: we removed the extra char of padding while working on this actor. + +How do structs themselves align? A struct has the same alignment properties as its longest constituent (that is not itself a struct). For example, a `Vec3f` has 4-alignment, while a `Vec3s` has 2-alignment. + +A struct may also pad at the end: it will pad to the size of its largest non-struct element. Notably, every actor struct has size a whole number of words as well, so this phenomenon also occurs at the ends of structs. For example, ObjTree has the following actor struct: + +```C +typedef struct ObjTree { + /* 0x0000 */ DynaPolyActor dyna; + /* 0x015C */ ColliderCylinder collider; + /* 0x01A8 */ ObjTreeActionFunc actionFunc; + /* 0x01AC */ f32 unk_1AC; + /* 0x01B0 */ s16 unk_1B0; + /* 0x01B2 */ s16 unk_1B2; + /* 0x01B4 */ s16 unk_1B4; +} ObjTree; // size = 0x1B8 +``` + +The struct pads to be `0x1B8` in size even though the last actual variable ends at `0x1B6`. + +For more information on this topic, there are plenty of guides elsewhere on the Internet, for example [The Lost Art of Structure Packing](http://www.catb.org/esr/structure-packing/). *The main thing to bear in mind for decomp purposes is that after finishing the functions, there may be some small parts of the actor struct that are just not used, because they were originally just struct padding.* + +### Padding at the end of sections + +In the ROM, each actor is layed out in the following order: + +- .text (Function instructions, separated into .s files, aka .text) +- .data (contents of the .data.s file) +- .rodata (read-only data, includes strings, floats, jumptables etc., almost entirely moved to the appropriate function files in the MM repo) +- .bss (varibles initialised to 0, not assigned a value when declared) +- .reloc (relocation information: you can ignore this) + +Each section is 0x10/16-aligned (qword aligned), i.e. each new section begins at an address with last digit `0`. This means that there can occur up to three words of padding at the end of each section. + +(The same occurs with any object divided into multiple .c files: each new file becomes 0x10 aligned.) + +#### Padding at the end of .text (function instructions) + +In function instructions, this manifests as a set of `nop`s at the end of the last function: for example, in EnRecepGirl, +``` +/* 0006B0 80C10680 27BD0038 */ addiu $sp, $sp, 0x38 +/* 0006B4 80C10684 03E00008 */ jr $ra +/* 0006B8 80C10688 00000000 */ nop +/* 0006BC 80C1068C 00000000 */ nop +``` + +the second `nop` is just extra `0`s of padding, as you can see in the machine code (third column in the comment) + +Once the rest of the functions match, this is automatic. So you never need to worry about these. + +#### Padding at the end of .data + +In data, the last entry may contain up to 3 words of 0s as padding. These can safely be removed when migrating data, but make sure that you don't remove something that actually is accessed by the function and happens to be 0! + +For example, in `ObjTree` we found that the last symbol in the data, +``` +glabel D_80B9A5BC +/* 00006C 80B9A5BC */ .word 0x08000000 +/* 000070 80B9A5C0 */ .word 0x00000000 +/* 000074 80B9A5C4 */ .word 0xFE000000 +/* 000078 80B9A5C8 */ .word 0x00000000 +/* 00007C 80B9A5CC */ .word 0x00000000 +``` +had 2 words of padding: only the first 3 words are actually used in the `CollisionCheckInfoInit2`. + +### Padding within the .data section + +Every distinct symbol in data is 4-aligned (word-aligned). So in the data, even if you have two `u8`s, they will be stored in addresses starting successive words: + +```C +u8 byte1 = 1 // will go to address ending in 0 +u8 byte2 = 2 // Will go to address ending in 4 +``` diff --git a/docs/tutorial/vscode.md b/docs/tutorial/vscode.md new file mode 100644 index 0000000000..91f2f659c4 --- /dev/null +++ b/docs/tutorial/vscode.md @@ -0,0 +1,84 @@ +# VSCode + +A lot of people on this project use VSCode as their coding environment. + +## Extensions + +There are a number of useful extensions available to make work more efficient: + +- C/C++ IntelliSense +- Clang-Format +- HexInspector (hover on numbers for float and other info) +- NumberMonger (convert hex to decimal and vice versa) +- ~~bracket pair colorizer 2~~ (now obsolete due to VSCode's built-in bracket colouring) +- Better MIPS Support + + + + +## Useful stuff to know: + +- Ctrl + Alt + Up/Down (on Windows, on Linux it's Ctrl + Shift + Up/Down or Shift + Alt + Up/Down) gives multicursors across consecutive lines. If you want several cursors in a more diverse arrangement, middle clicking works, at least on Windows. +- Alt + Up/Down moves lines up/down. +- Shift + Alt + Up/Down (Linux: Ctrl + Shift + Alt + Up/Down) copies lines up/down. +- Ctrl + P offers a box to use to search for and open files. +- Ctrl + Shift + P offers a box for commands like editing settings or reloading the window. + +- Make use of VSCode's search/search-and-replace features. + - Ctrl + Click goes to a definition. + - Ctrl + F for search in current file + - Ctrl + H for replace in current file + - Ctrl + Shift + F for search in all files + - Ctrl + Shift + H for replace in all files + - F2 for Rename symbol + +Many of VS Code's other shortcuts can be found on [its getting started page](https://code.visualstudio.com/docs/getstarted/keybindings), which also has links to OS-specific PDFs. + +## C/C++ configuration + +You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configurations (JSON)` in the command box to customise how IntelliSense reads the repository (stuff like where to look for includes, flags, compiler defines, etc.) to make VSCode's IntelliSense plugin better able to understand the structure of the repository. This is a good default one to use for this project's repository: + +```jsonc +{ + "configurations": [ + { + "name": "Linux", + "compilerPath": "${default}", // Needs to not be "" for -m32 to work + "compilerArgs": [ + "-m32" // Removes integer truncation warnings with gbi macros + ], + "intelliSenseMode": "${default}", // Shouldn't matter + "includePath": [ // Matches makefile's includes + "${workspaceFolder}/**", + "src", + "assets", + "build", + "include" + ], + "defines": [ + "_LANGUAGE_C" // For gbi.h + ], + "cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments + "cppStandard": "${default}" // Only ZAPD uses C++, so doesn't really matter + } + ], + "version": 4 +} +``` + +## Settings + +Add the following to (or create) the `.vscode/settings.json` file for VSCode to search the gitignored asset and assembly files by default: + +```jsonc +{ + "search.useIgnoreFiles": false, + "search.exclude": { + "**/.git": true, + "baserom/**": true, + "build/**": true, + "expected/**": true, + "nonmatchings/**": true, + }, +} +``` diff --git a/docs/useful_conversions.md b/docs/useful_conversions.md new file mode 100644 index 0000000000..102c20daa0 --- /dev/null +++ b/docs/useful_conversions.md @@ -0,0 +1,275 @@ +# Useful conversions + +This article contains some useful conversion tables. Beware that we will omit the `0x` prefix on hex numbers: it will be evident from context which base is intended. + +- [Degrees and hex/binary angles](#degrees-and-hex-binary-angles) + * [Small angles](#small-angles) + * [Larger angles](#larger-angles) +- [Round decimal numbers in hex](#round-decimal-numbers-in-hex) + * [Small](#small) + * [Medium](#medium) + * [Large](#large) +- [Extra large](#extra-large) +- [Shifts/powers of 2 in dec and hex](#shifts-powers-of-2-in-dec-and-hex) + +## Degrees and hex/binary angles + +Conversion of degrees to binary angles in the two common ways, that give different answers. Table is produced using this script: + +```bash +$ printf "%s\t%s\t%s\n" "d" "d * 2^16/360" "2^16/360 * d" ; for i in {0..360..5} ; do printf "%d\t%X\t\t%X\n" "$i" $(( "$i" * 0x10000 / 360 )) $(( 0x10000 / 360 * "$i" )) ; done +``` + +### Small angles + +| `d` | `d * 2^16/360` | `2^16/360 * d` | +| ----: | -------------: | -------------: | +| 0 | 0 | 0 | +| 1 | B6 | B6 | +| 2 | 16C | 16C | +| 3 | 222 | 222 | +| 4 | 2D8 | 2D8 | +| 5 | 38E | 38E | +| 6 | 444 | 444 | +| 7 | 4FA | 4FA | +| 8 | 5B0 | 5B0 | +| 9 | 666 | 666 | +| 10 | 71C | 71C | +| 11 | 7D2 | 7D2 | +| 12 | 888 | 888 | +| 13 | 93E | 93E | +| 14 | 9F4 | 9F4 | +| 15 | AAA | AAA | +| 16 | B60 | B60 | +| 17 | C16 | C16 | +| 18 | CCC | CCC | +| 19 | D82 | D82 | +| 20 | E38 | E38 | +| 21 | EEE | EEE | +| 22 | FA4 | FA4 | +| 23 | 105B | 105A | +| 24 | 1111 | 1110 | +| 25 | 11C7 | 11C6 | +| 26 | 127D | 127C | +| 27 | 1333 | 1332 | +| 28 | 13E9 | 13E8 | +| 29 | 149F | 149E | +| 30 | 1555 | 1554 | + +### Larger angles + +| `d` | `d * 2^16/360` | `2^16/360 * d` | +| -----: | -------------: | -------------: | +| 0 | 0 | 0 | +| 5 | 38E | 38E | +| 10 | 71C | 71C | +| 15 | AAA | AAA | +| 20 | E38 | E38 | +| 25 | 11C7 | 11C6 | +| 30 | 1555 | 1554 | +| 35 | 18E3 | 18E2 | +| 40 | 1C71 | 1C70 | +| 45 | 2000 | 1FFE | +| 50 | 238E | 238C | +| 55 | 271C | 271A | +| 60 | 2AAA | 2AA8 | +| 65 | 2E38 | 2E36 | +| 70 | 31C7 | 31C4 | +| 75 | 3555 | 3552 | +| 80 | 38E3 | 38E0 | +| 85 | 3C71 | 3C6E | +| 90 | 4000 | 3FFC | +| 95 | 438E | 438A | +| 100 | 471C | 4718 | +| 105 | 4AAA | 4AA6 | +| 110 | 4E38 | 4E34 | +| 115 | 51C7 | 51C2 | +| 120 | 5555 | 5550 | +| 125 | 58E3 | 58DE | +| 130 | 5C71 | 5C6C | +| 135 | 6000 | 5FFA | +| 140 | 638E | 6388 | +| 145 | 671C | 6716 | +| 150 | 6AAA | 6AA4 | +| 155 | 6E38 | 6E32 | +| 160 | 71C7 | 71C0 | +| 165 | 7555 | 754E | +| 170 | 78E3 | 78DC | +| 175 | 7C71 | 7C6A | +| 180 | 8000 | 7FF8 | +| 185 | 838E | 8386 | +| 190 | 871C | 8714 | +| 195 | 8AAA | 8AA2 | +| 200 | 8E38 | 8E30 | +| 205 | 91C7 | 91BE | +| 210 | 9555 | 954C | +| 215 | 98E3 | 98DA | +| 220 | 9C71 | 9C68 | +| 225 | A000 | 9FF6 | +| 230 | A38E | A384 | +| 235 | A71C | A712 | +| 240 | AAAA | AAA0 | +| 245 | AE38 | AE2E | +| 250 | B1C7 | B1BC | +| 255 | B555 | B54A | +| 260 | B8E3 | B8D8 | +| 265 | BC71 | BC66 | +| 270 | C000 | BFF4 | +| 275 | C38E | C382 | +| 280 | C71C | C710 | +| 285 | CAAA | CA9E | +| 290 | CE38 | CE2C | +| 295 | D1C7 | D1BA | +| 300 | D555 | D548 | +| 305 | D8E3 | D8D6 | +| 310 | DC71 | DC64 | +| 315 | E000 | DFF2 | +| 320 | E38E | E380 | +| 325 | E71C | E70E | +| 330 | EAAA | EA9C | +| 335 | EE38 | EE2A | +| 340 | F1C7 | F1B8 | +| 345 | F555 | F546 | +| 350 | F8E3 | F8D4 | +| 355 | FC71 | FC62 | +| 360 | 10000 | FFF0 | + +Similarly for small angles with a smaller increment: + + + +## Round decimal numbers in hex + +```bash +printf "%s\t%s\n" "dec" "hex" ; for i in {0..100..5} ; do printf "%d\t%X\n" "$i" "$i" ; done +``` + +### Small + +| dec | hex | +| -----: | --: | +| 0 | 0 | +| 5 | 5 | +| 10 | A | +| 15 | F | +| 20 | 14 | +| 25 | 19 | +| 30 | 1E | +| 35 | 23 | +| 40 | 28 | +| 45 | 2D | +| 50 | 32 | +| 55 | 37 | +| 60 | 3C | +| 65 | 41 | +| 70 | 46 | +| 75 | 4B | +| 80 | 50 | +| 85 | 55 | +| 90 | 5A | +| 95 | 5F | +| 100 | 64 | + + +### Medium + +| dec | hex | +| -----: | ---: | +| 100 | 64 | +| 150 | 96 | +| 200 | C8 | +| 250 | FA | +| 300 | 12C | +| 350 | 15E | +| 400 | 190 | +| 450 | 1C2 | +| 500 | 1F4 | +| 550 | 226 | +| 600 | 258 | +| 650 | 28A | +| 700 | 2BC | +| 750 | 2EE | +| 800 | 320 | +| 850 | 352 | +| 900 | 384 | +| 950 | 3B6 | +| 1000 | 3E8 | + + +### Large + +| dec | hex | +| -----: | ----: | +| 1000 | 3E8 | +| 1500 | 5DC | +| 2000 | 7D0 | +| 2500 | 9C4 | +| 3000 | BB8 | +| 3500 | DAC | +| 4000 | FA0 | +| 4500 | 1194 | +| 5000 | 1388 | +| 5500 | 157C | +| 6000 | 1770 | +| 6500 | 1964 | +| 7000 | 1B58 | +| 7500 | 1D4C | +| 8000 | 1F40 | +| 8500 | 2134 | +| 9000 | 2328 | +| 9500 | 251C | +| 10000 | 2710 | + + +## Extra large +| dec | hex | +| -----: | ----: | +| 10000 | 2710 | +| 11000 | 2AF8 | +| 12000 | 2EE0 | +| 13000 | 32C8 | +| 14000 | 36B0 | +| 15000 | 3A98 | +| 16000 | 3E80 | +| 17000 | 4268 | +| 18000 | 4650 | +| 19000 | 4A38 | +| 20000 | 4E20 | +| 21000 | 5208 | +| 22000 | 55F0 | +| 23000 | 59D8 | +| 24000 | 5DC0 | +| 25000 | 61A8 | +| 26000 | 6590 | +| 27000 | 6978 | +| 28000 | 6D60 | +| 29000 | 7148 | +| 30000 | 7530 | + +## Shifts/powers of 2 in dec and hex + +```bash +$ printf "%s\t%s\t%s\n" "n" "1 << n (hex)" "1 << n (dec)" ; for i in {0..15..1} ; do printf "%d\t%X\t\t%d\n" "$i" $(( 1 << "$i" )) $(( 1 << "$i" )) ; done +``` +`1 << n` is the same as `2^n`. + +| `n` | `1 << n` (hex) | `1 << n` (dec) | +| -----: | -------------: | -------------: | +| 0 | 1 | 1 | +| 1 | 2 | 2 | +| 2 | 4 | 4 | +| 3 | 8 | 8 | +| 4 | 10 | 16 | +| 5 | 20 | 32 | +| 6 | 40 | 64 | +| 7 | 80 | 128 | +| 8 | 100 | 256 | +| 9 | 200 | 512 | +| 10 | 400 | 1024 | +| 11 | 800 | 2048 | +| 12 | 1000 | 4096 | +| 13 | 2000 | 8192 | +| 14 | 4000 | 16384 | +| 15 | 8000 | 32768 | + + diff --git a/extract_assets.py b/extract_assets.py index 066c1de3cd..a7825af1fe 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 -import argparse, json, os, signal, time +import argparse, json, os, signal, time, colorama from multiprocessing import Pool, Event, Manager +colorama.init(); + EXTRACTED_ASSETS_NAMEFILE = ".extracted-assets.json" def SignalHandler(sig, frame): @@ -15,10 +17,10 @@ def ExtractFile(xmlPath, outputPath, outputSourcePath): # Don't extract if another file wasn't extracted properly. return - execStr = "tools/ZAPD/ZAPD.out e -eh -i %s -b baserom/ -o %s -osf %s -gsf 1 -rconf tools/ZAPDConfigs/MM/Config.xml" % (xmlPath, outputPath, outputSourcePath) + execStr = f"tools/ZAPD/ZAPD.out e -eh -i {xmlPath} -b baserom/ -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf tools/ZAPDConfigs/MM/Config.xml {ZAPDArgs}" if globalUnaccounted: - execStr += " -wu" + execStr += " -Wunaccounted" print(execStr) exitValue = os.system(execStr) @@ -72,8 +74,27 @@ def main(): parser.add_argument("-t", "--threads", help="Number of cpu cores to extract with.") parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones.", action="store_true") parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true") + parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append") args = parser.parse_args() + global ZAPDArgs; + ZAPDArgs = ""; + if args.Z is not None: + badZAPDArg = False; + for i in range(len(args.Z)): + z = args.Z[i] + if z[0] == '-': + print(f"{colorama.Fore.LIGHTRED_EX}error{colorama.Fore.RESET}: argument \"{z}\" starts with \"-\", which is not supported.", file=os.sys.stderr); + badZAPDArg = True; + else: + args.Z[i] = "-" + z; + + if badZAPDArg: + exit(1); + + ZAPDArgs = " ".join(args.Z); + print("Using extra ZAPD arguments: " + ZAPDArgs); + global mainAbort mainAbort = Event() manager = Manager() @@ -88,7 +109,7 @@ def main(): if asset_path is not None: fullPath = os.path.join("assets", "xml", asset_path + ".xml") if not os.path.exists(fullPath): - print(f"Error. File {fullPath} doesn't exists.", file=os.sys.stderr) + print(f"Error. File {fullPath} does not exist.", file=os.sys.stderr) exit(1) initializeWorker(mainAbort, args.unaccounted, extractedAssetsTracker, manager) @@ -107,7 +128,7 @@ def main(): numCores = int(args.threads or 0) if numCores <= 0: numCores = 1 - print("Extracting assets with " + str(numCores) + " CPU cores.") + print("Extracting assets with " + str(numCores) + " CPU core" + ("s" if numCores > 1 else "") + ".") with Pool(numCores, initializer=initializeWorker, initargs=(mainAbort, args.unaccounted, extractedAssetsTracker, manager)) as p: p.map(ExtractFunc, xmlFiles) diff --git a/include/functions.h b/include/functions.h index 521a87f405..8cbccc85e9 100644 --- a/include/functions.h +++ b/include/functions.h @@ -603,7 +603,8 @@ void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); // void EffectSsKiraKira_SpawnFocused(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); // void EffectSsBomb2_SpawnFade(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4); -// void EffectSsBomb2_SpawnLayered(UNK_TYPE4 param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); +void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, + s16 scaleStep); // void EffectSsBlast_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, Color_RGBA8* param_5, Color_RGBA8* param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); // void EffectSsBlast_SpawnWhiteCustomScale(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); // void EffectSsBlast_SpawnShockwave(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7); @@ -875,7 +876,7 @@ s32 func_800BC5EC(GlobalContext* globalCtx, Actor* actor); void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 arg2, GlobalContext* globalCtx); // void func_800BC770(void); // void func_800BC7D8(void); -// void func_800BC848(void); +void func_800BC848(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3); // void func_800BC8B8(void); // void func_800BCB50(void); void func_800BCB70(Actor* actor, u16 arg1, u16 arg2, s16 arg3, s16 arg4); @@ -1584,21 +1585,21 @@ void func_800F048C(GlobalContext* globalCtx, Vec3f* param_2, u8 param_3, u16 par void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* position, s32 param_3, u16 sfxId); void func_800F0590(GlobalContext* globalCtx, Vec3f* arg1, s32 arg2, s32 arg3); u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx); -// void func_800F07C0(void); -// void func_800F0888(void); -// void func_800F0944(void); -// void func_800F09B4(void); -// void func_800F0A20(void); -// void func_800F0A94(void); -// void func_800F0BB4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); -// void func_800F0CE4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); -// void func_800F0DD4(void); -// void func_800F0E94(void); -// void func_800F0EEC(void); -// void func_800F0F28(void); -// void func_800F0FF0(void); -// void func_800F10AC(void); -// void func_800F112C(void); +s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex); +Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx); +void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex); +s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx); +void EnHy_Blink(EnHy* enHy, s32 arg1); +s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex); +void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, Actor* arg2, s16 arg3, s16 arg4); +s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5); +s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3); +s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex); +s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex); +s32 EnHy_MoveForwards(EnHy* enHy, f32 arg1); +s32 EnHy_MoveBackwards(EnHy* enHy, f32 arg1); +void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx); +s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 arg2); u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); void EnvFlags_UnsetAll(GlobalContext* globalCtx); void EnvFlags_Set(GlobalContext* globalCtx, s16 flag); @@ -2129,8 +2130,8 @@ void func_80121FC4(GlobalContext* globalCtx); Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); -// void func_80122660(void); -// UNK_TYPE4 func_80122670(s32* param_1, Input* input); +void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); +s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); // void func_801226E0(void); void func_80122744(GlobalContext* globalCtx, UNK_PTR arg1, u32 arg2, Vec3s* arg3); s32 func_80122760(GlobalContext* globalCtx, UNK_PTR arg1, f32 arg2); @@ -2161,7 +2162,7 @@ s32 func_80123590(GlobalContext* globalCtx, Actor* actor); s32 func_80123810(GlobalContext* globalCtx); // void func_80123960(void); // void func_801239AC(void); -// void func_80123AA4(void); +void func_80123AA4(Player* player, s32 arg1); // void func_80123BD4(void); // void func_80123C58(void); // void func_80123C90(void); @@ -2667,7 +2668,7 @@ s8 func_8013D8DC(s8 arg0, GlobalContext* globalCtx); s8 func_8013D924(s16 arg0, GlobalContext* globalCtx); Actor* func_ActorCategoryIterateById(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId); s32 func_8013D9C8(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3); -u8 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2); +s32 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2); s32 func_8013DC40(Path* arg0, s32 arg1, s32 arg2, Vec3f* arg3); void func_8013DCE0(GlobalContext* globalCtx, Vec3f* arg1, Actor* arg2, struct_8013DF3C_arg1* arg3, Path* arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, u8 arg9); s32 func_8013DE04(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1, struct_8013DF3C_arg1_unk_func1 arg2, struct_8013DF3C_arg1_unk_func2 arg3, struct_8013DF3C_arg1_unk_func2 arg4, struct_8013DF3C_arg1_unk_func2 arg5); @@ -2758,11 +2759,11 @@ s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* vtx, s32 arg2, s32 arg3, s32 ar void func_80143148(SkyboxContext* skyboxCtx, s32 arg1); void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType); void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType); -void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType); -// void func_801435A0(void); -// void func_80143624(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7); -// void func_80143668(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_80143A04(void); +void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType); +Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z); +void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB); +void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z); +void SkyboxDraw_Noop(SkyboxContext* skyboxCtx); void func_80143A10(u8 owlId); // void func_80143A54(void); void func_80143AC4(void); @@ -2950,8 +2951,8 @@ void func_80165438(UNK_PTR param_1); // void func_80165460(void); // void func_80165608(void); // void func_80165630(void); -// void func_80165658(void); -void func_8016566C(s32 arg0); +void func_80165658(u32 arg0); +void func_8016566C(u32 arg0); void func_80165690(void); // void func_801656A4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); // void func_80165DCC(void); @@ -2970,7 +2971,7 @@ void func_80166B30(GlobalContext* globalCtx); void func_80167814(GlobalContext* globalCtx); void func_80167DE4(GlobalContext* globalCtx); // void func_80167F0C(void); -void func_80168090(GlobalContext* globalCtx); +void Play_Draw(GlobalContext* globalCtx); void func_80168DAC(GlobalContext* globalCtx); void Play_Update(GlobalContext* globalCtx); s32 func_801690CC(GlobalContext* globalCtx); @@ -3011,7 +3012,7 @@ s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); // void func_8016A0AC(void); s32 func_8016A168(void); // void func_8016A178(void); -// void func_8016A268(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6); +void func_8016A268(GlobalContext* globalCtx, s32 param_2, s32 param_3, s32 param_4, s32 param_5, s32 param_6); void Play_Init(GameState* gameState); // void func_8016AC10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); // void func_8016AE1C(void); @@ -3371,7 +3372,7 @@ void Matrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 ap void Matrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState); u64* SysUcode_GetUCodeBoot(void); -u32 SysUcode_GetUCodeBootSize(void); +size_t SysUcode_GetUCodeBootSize(void); u64* SysUcode_GetUCode(void); u64* SysUcode_GetUCodeData(void); @@ -3962,7 +3963,7 @@ void func_801A5CFC(u16 sfxId, Vec3f* param_2, u8 param_3, f32* param_4, f32* par void func_801A72CC(Vec3f* uParm1); void func_801A7328(Vec3f* pos, u16 sfxId); // void func_801A7484(void); -// void func_801A75E8(void); +void func_801A75E8(u16 sfxId); // void func_801A7720(void); void func_801A7794(u32 param_1, u32 param_2, u32 param_3); // void func_801A7828(void); diff --git a/include/ultra64/sptask.h b/include/ultra64/sptask.h index e89557267a..ef4aa4d04a 100644 --- a/include/ultra64/sptask.h +++ b/include/ultra64/sptask.h @@ -2,6 +2,7 @@ #define _SPTASK_H_ #include "PR/ultratypes.h" +#include "libc/stddef.h" /* Task Types */ #define M_NULTASK 0 @@ -80,7 +81,7 @@ typedef struct { /* 0x04 */ u32 flags; /* 0x08 */ u64* ucodeBoot; - /* 0x0C */ u32 ucodeBootSize; + /* 0x0C */ u32 ucodeBootSize; // ucode will load these sizes with lw, so need to be 32-bit /* 0x10 */ u64* ucode; /* 0x14 */ u32 ucodeSize; @@ -101,8 +102,7 @@ typedef struct { /* 0x3C */ u32 yieldDataSize; } OSTask_t; // size = 0x40 -typedef union -{ +typedef union { OSTask_t t; long long int force_structure_alignment; } OSTask; diff --git a/include/variables.h b/include/variables.h index baf145e0f8..35277bb802 100644 --- a/include/variables.h +++ b/include/variables.h @@ -18,7 +18,7 @@ extern u16 gFramebuffer1[SCREEN_HEIGHT][SCREEN_WIDTH]; // at 0x80000500 extern u8 D_80025D00[]; // data -extern UNK_TYPE1 D_800969C0; +extern u64 rspbootTextStart[]; extern u8 D_80096B20; extern vu8 gViConfigUseDefault; extern u8 gViConfigAdditionalScanLines; @@ -889,7 +889,6 @@ extern s801BB170 D_801BB170[118]; // extern UNK_TYPE1 D_801BC210; extern Gfx D_801BC240[9]; extern Gfx D_801BC288[3]; -// extern UNK_TYPE1 D_801BC2A0; // extern UNK_TYPE1 D_801BC3F0; // extern UNK_TYPE1 D_801BC400; // extern UNK_TYPE1 D_801BC410; @@ -1636,8 +1635,8 @@ extern Vec3f D_801D15B0; extern Vec3s D_801D15BC; extern Mtx D_801D1DE0; extern MtxF D_801D1E20; -extern UNK_PTR D_801D1E60; -extern UNK_PTR D_801D1E64; +// extern u64* initialgspUcodeText; +// extern u64* initialgspUcodeData; // extern UNK_TYPE1 D_801D1E70; // extern UNK_TYPE1 D_801D2E80; // extern UNK_TYPE1 D_801D2F80; @@ -3090,8 +3089,8 @@ extern f32 D_801E0E24; extern f64 D_801E0EB0; // extern UNK_TYPE4 D_801E1068; extern UNK_PTR D_801E10B0; -// extern UNK_TYPE2 D_801E1102; -// extern UNK_TYPE4 D_801E1104; +extern const s16 gAudioTatumInit[]; +extern const AudioContextInitSizes gAudioContextInitSizes; // extern UNK_TYPE4 D_801E1108; // extern UNK_TYPE4 D_801E110C; // extern UNK_TYPE2 D_801E1180; @@ -3099,8 +3098,8 @@ extern UNK_PTR D_801E10B0; // extern UNK_TYPE2 D_801E1630; // extern UNK_TYPE1 D_801E1E40; // extern UNK_TYPE1 D_801E1E80; -// extern UNK_TYPE1 D_801E2160; -// extern UNK_TYPE1 D_801E3790; +extern u64 gspF3DEX2_NoN_fifoTextStart[]; +extern u64 gspF3DEX2_NoN_fifoDataStart[]; extern u64 gJpegUCodeData[]; // extern UNK_TYPE1 D_801E3FA0; @@ -3317,7 +3316,7 @@ extern Arena sZeldaArena; // extern UNK_TYPE1 D_801F6AD4; // extern UNK_TYPE1 D_801F6AD5; // extern UNK_TYPE1 D_801F6ADA; -// extern UNK_TYPE1 D_801F6AE0; +// extern UNK_TYPE1 sSkyboxDrawMatrix; // extern UNK_TYPE1 D_801F6AF0; // extern UNK_TYPE1 D_801F6AF2; // extern UNK_TYPE4 D_801F6B00; @@ -3413,7 +3412,7 @@ extern OSViMode* D_801FBB88; extern u16* gZBufferPtr; extern void* D_801FBB90; extern u64* gGfxSPTaskOutputBufferPtr; -extern u32 gGfxSPTaskOutputBufferSize; +extern size_t gGfxSPTaskOutputBufferSize; // extern UNK_TYPE1 D_801FBB9C; // extern UNK_TYPE1 D_801FBBA0; extern u16 (*gZBuffer)[SCREEN_WIDTH * SCREEN_HEIGHT]; diff --git a/include/z64.h b/include/z64.h index 23f8c7df84..f094c7cfc4 100644 --- a/include/z64.h +++ b/include/z64.h @@ -766,11 +766,10 @@ typedef struct { typedef struct { /* 0x00000 */ View view; - /* 0x00168 */ void* skyboxStaticSegment[2]; - /* 0x00170 */ char unk170[8]; // more static segments? + /* 0x00168 */ void* skyboxStaticSegment[4]; /* 0x00178 */ void* skyboxPaletteStaticSegment; - /* 0x0017C */ Gfx* unk17C; - /* 0x00180 */ Gfx* unk180; + /* 0x0017C */ Gfx* dListBuf; + /* 0x00180 */ Gfx* roomDL; /* 0x00184 */ Vtx* roomVtx; /* 0x00188 */ DmaRequest unk188; /* 0x001A8 */ DmaRequest unk1A8; @@ -791,6 +790,10 @@ typedef struct { /* 0x00227 */ u8 envB; } SkyboxContext; // size = 0x228 +typedef enum { + /* 0x05 */ SKYBOX_CUTSCENE_MAP = 5 +} SkyboxId; + typedef struct ListAlloc { /* 0x00 */ struct ListAlloc* prev; /* 0x04 */ struct ListAlloc* next; @@ -1398,9 +1401,9 @@ struct GlobalContext { /* 0x18794 */ void* unk_18794; //! @TODO: Determine function prototype /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct GlobalContext* globalCtx, void* talkAnim, s32 arg2); /* 0x1879C */ s16 unk_1879C[10]; - /* 0x187B0 */ MtxF projectionMatrix; + /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f unk_187F0; - /* 0x187FC */ MtxF mf_187FC; + /* 0x187FC */ MtxF billboardMtxF; /* 0x1883C */ Mtx* unk_1883C; /* 0x18840 */ u32 gameplayFrames; /* 0x18844 */ u8 unk_18844; @@ -1459,6 +1462,30 @@ typedef struct { /* 0x24 */ s16 unk_24; } struct_800BD888_arg1; // size = 0x28 +typedef struct EnHy { + /* 0x000 */ Actor actor; + /* 0x144 */ UNK_TYPE1 unk_144[0x8]; + /* 0x14C */ SkelAnime skelAnime; + /* 0x190 */ s8 unk190; + /* 0x191 */ s8 unk191; + /* 0x192 */ s8 unk192; + /* 0x193 */ s8 animObjIndex; + /* 0x194 */ ColliderCylinder collider; + /* 0x1E0 */ UNK_TYPE1 unk_1E0[0x4]; + /* 0x1E4 */ Path* path; + /* 0x1E8 */ s16 curPoint; + /* 0x1EA */ UNK_TYPE1 unk_1EA[0x2]; + /* 0x1EC */ Vec3f leftFootPos; + /* 0x1F8 */ Vec3f rightFootPos; + /* 0x204 */ u8 isLeftFootOnGround; + /* 0x205 */ u8 isRightFootOnGround; + /* 0x206 */ Vec3s jointTable[16]; + /* 0x266 */ Vec3s morphTable[16]; + /* 0x2C6 */ UNK_TYPE1 unk_2C6[0x120]; + /* 0x3E6 */ s16 eyeTexIndex; + /* 0x3E8 */ s16 blinkTimer; +} EnHy; + typedef struct { /* 0x0 */ u8 unk0; /* 0x4 */ s32 unk4; diff --git a/include/z64animation.h b/include/z64animation.h index abd95423bd..8d6df14c84 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -49,6 +49,14 @@ typedef struct { /* 0x08 */ Gfx* dLists[2]; // Near and far } LodLimb; // size = 0x10 +typedef struct { + /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x06 */ u8 child; + /* 0x07 */ u8 sibling; + /* 0x08 */ s32 unk_8; // Type of data contained in segment + /* 0x0C */ void* segment; // Segment address of data. Currently unclear what. +} SkinLimb; // size = 0x10 + // Model has limbs with only rigid meshes typedef struct { /* 0x00 */ void** segment; @@ -271,6 +279,43 @@ typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeC typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex, struct Actor* actor); +// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes +typedef struct { + /* 0x000 */ u16 unk_0; + /* 0x002 */ s16 unk_2; + /* 0x004 */ s16 unk_4; + /* 0x006 */ s8 unk_6; + /* 0x007 */ s8 unk_7; + /* 0x008 */ s8 unk_8; + /* 0x009 */ u8 unk_9; +} Struct_800A57C0; // size = 0xA + +// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes +typedef struct { + /* 0x000 */ u8 unk_0; + /* 0x002 */ s16 x; + /* 0x004 */ s16 y; + /* 0x006 */ s16 z; + /* 0x008 */ u8 unk_8; +} Struct_800A598C_2; // size = 0xA + +// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes +typedef struct { + /* 0x000 */ u16 unk_0; + /* 0x002 */ u16 unk_2; + /* 0x004 */ u16 unk_4; + /* 0x008 */ Struct_800A57C0* unk_8; + /* 0x00C */ Struct_800A598C_2* unk_C; +} Struct_800A598C; // size = 0x10 + +// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes +typedef struct { + /* 0x000 */ u16 unk_0; + /* 0x002 */ u16 unk_2; + /* 0x004 */ Struct_800A598C* unk_4; + /* 0x008 */ Gfx* unk_8; +} Struct_800A5E28; // size = 0xC + typedef struct struct_80B8E1A8 { /* 0x00 */ AnimationHeader* animationSeg; /* 0x04 */ f32 playbackSpeed; diff --git a/include/z64item.h b/include/z64item.h index 82dc6e352f..d912169f2a 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -57,7 +57,7 @@ typedef enum { /* 0x07 */ SLOT_BOMBCHU, /* 0x08 */ SLOT_STICK, /* 0x09 */ SLOT_NUT, - /* 0x0A */ SLOT_BEAN, + /* 0x0A */ SLOT_MAGIC_BEANS, /* 0x0B */ SLOT_TRADE_KEY_MAMA, /* 0x0C */ SLOT_POWDER_KEG, /* 0x0D */ SLOT_PICTO_BOX, @@ -85,7 +85,7 @@ typedef enum { /* 0x23 */ SLOT_MASK_GORON, /* 0x24 */ SLOT_MASK_ROMANI, /* 0x25 */ SLOT_MASK_CIRCUS_LEADER, - /* 0x26 */ SLOT_MASK_KAFEI, + /* 0x26 */ SLOT_MASK_KAFEIS_MASK, /* 0x27 */ SLOT_MASK_COUPLE, /* 0x28 */ SLOT_MASK_TRUTH, /* 0x29 */ SLOT_MASK_ZORA, @@ -109,7 +109,7 @@ typedef enum { /* 0x07 */ ITEM_BOMBCHU, /* 0x08 */ ITEM_STICK, /* 0x09 */ ITEM_NUT, - /* 0x0A */ ITEM_BEAN, + /* 0x0A */ ITEM_MAGIC_BEANS, /* 0x0B */ ITEM_SLINGSHOT, /* 0x0C */ ITEM_POWDER_KEG, /* 0x0D */ ITEM_PICTO_BOX, @@ -146,7 +146,7 @@ typedef enum { /* 0x2C */ ITEM_DEED_OCEAN, /* 0x2D */ ITEM_ROOM_KEY, /* 0x2E */ ITEM_LETTER_MAMA, - /* 0x2F */ ITEM_LETTER_KAFEI, + /* 0x2F */ ITEM_LETTER_TO_KAFEI, /* 0x30 */ ITEM_PENDANT_MEMORIES, /* 0x31 */ ITEM_TINGLE_MAP, /* 0x32 */ ITEM_MASK_DEKU, @@ -154,7 +154,7 @@ typedef enum { /* 0x34 */ ITEM_MASK_ZORA, /* 0x35 */ ITEM_MASK_FIERCE_DEITY, /* 0x36 */ ITEM_MASK_TRUTH, - /* 0x37 */ ITEM_MASK_KAFEI, + /* 0x37 */ ITEM_MASK_KAFEIS_MASK, /* 0x38 */ ITEM_MASK_ALL_NIGHT, /* 0x39 */ ITEM_MASK_BUNNY, /* 0x3A */ ITEM_MASK_KEATON, @@ -294,6 +294,7 @@ typedef enum { /* 0x2A */ GI_NUTS_10 = 0x2A, /* 0x32 */ GI_SHIELD_HERO = 0x32, /* 0x33 */ GI_SHIELD_MIRROR, + /* 0x35 */ GI_MAGIC_BEANS = 0x35, /* 0x3C */ GI_KEY_SMALL = 0x3C, /* 0x3E */ GI_MAP = 0x3E, /* 0x3F */ GI_COMPASS, @@ -308,7 +309,7 @@ typedef enum { /* 0x7A */ GI_MASK_ZORA, /* 0x7B */ GI_MASK_FIERCE_DEITY, /* 0x7C */ GI_MASK_TRUTH, - /* 0x7D */ GI_MASK_KAFEI, + /* 0x7D */ GI_MASK_KAFEIS_MASK, /* 0x7E */ GI_MASK_ALL_NIGHT, /* 0x7F */ GI_MASK_BUNNY, /* 0x80 */ GI_MASK_KEATON, diff --git a/include/z64object.h b/include/z64object.h index 920a9e5dde..08423ab6c7 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -207,7 +207,7 @@ typedef enum { /* 0x0C3 */ OBJECT_GI_SHIELD_3, /* 0x0C4 */ OBJECT_UNSET_C4, /* 0x0C5 */ OBJECT_UNSET_C5, - /* 0x0C6 */ OBJECT_GI_BEAN, + /* 0x0C6 */ OBJECT_GI_MAGIC_BEANS, /* 0x0C7 */ OBJECT_GI_FISH, /* 0x0C8 */ OBJECT_UNSET_C8, /* 0x0C9 */ OBJECT_UNSET_C9, diff --git a/include/z64player.h b/include/z64player.h index e20b26ca7c..6b156372eb 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -36,7 +36,7 @@ typedef enum { typedef enum { /* 0x00 */ PLAYER_MASK_NONE, /* 0x01 */ PLAYER_MASK_TRUTH, - /* 0x02 */ PLAYER_MASK_KAFEI, + /* 0x02 */ PLAYER_MASK_KAFEIS_MASK, /* 0x03 */ PLAYER_MASK_ALL_NIGHT, /* 0x04 */ PLAYER_MASK_BUNNY, /* 0x05 */ PLAYER_MASK_KEATON, @@ -106,15 +106,15 @@ typedef enum { /* 0x2A */ PLAYER_AP_MOON_TEAR, /* 0x2B */ PLAYER_AP_DEED_LAND, /* 0x2C */ PLAYER_AP_ROOM_KEY, - /* 0x2D */ PLAYER_AP_LETTER_KAFEI, - /* 0x2E */ PLAYER_AP_BEAN, + /* 0x2D */ PLAYER_AP_LETTER_TO_KAFEI, + /* 0x2E */ PLAYER_AP_MAGIC_BEANS, /* 0x2F */ PLAYER_AP_DEED_SWAMP, /* 0x30 */ PLAYER_AP_DEED_MOUNTAIN, /* 0x31 */ PLAYER_AP_DEED_OCEAN, /* 0x33 */ PLAYER_AP_LETTER_MAMA = 0x33, /* 0x36 */ PLAYER_AP_PENDANT_MEMORIES = 0x36, /* 0x3A */ PLAYER_AP_MASK_TRUTH = 0x3A, - /* 0x3B */ PLAYER_AP_MASK_KAFEI, + /* 0x3B */ PLAYER_AP_MASK_KAFEIS_MASK, /* 0x3C */ PLAYER_AP_MASK_ALL_NIGHT, /* 0x3D */ PLAYER_AP_MASK_BUNNY, /* 0x3E */ PLAYER_AP_MASK_KEATON, diff --git a/spec b/spec index b282930333..bdf94ffaf0 100644 --- a/spec +++ b/spec @@ -312,7 +312,7 @@ beginseg name "icon_item_gameover_static" compress romalign 0x1000 - include "build/assets/static/icon_item_gameover_static/icon_item_gameover_static.o" + include "build/assets/interface/icon_item_gameover_static/icon_item_gameover_static.o" number 12 endseg @@ -473,8 +473,7 @@ beginseg include "build/data/code/z_eff_footmark.data.o" include "build/src/code/code_800F0390.o" include "build/src/code/z_elf_message.o" - include "build/src/code/code_800F07C0.o" - include "build/data/code/code_801BC2A0.data.o" + include "build/src/code/z_en_hy.o" include "build/src/code/z_face_reaction.o" include "build/src/code/z_env_flags.o" include "build/src/code/z_eventmgr.o" @@ -553,8 +552,6 @@ beginseg include "build/src/code/code_801420C0.o" include "build/src/code/z_vr_box.o" include "build/src/code/z_vr_box_draw.o" - include "build/data/code/z_vr_box_draw.data.o" - include "build/data/code/z_vr_box_draw.bss.o" include "build/src/code/z_sram_NES.o" include "build/data/code/z_sram_NES.data.o" include "build/data/code/z_sram_NES.bss.o" @@ -672,7 +669,7 @@ beginseg include "build/src/code/audio/code_801A7B10.o" include "build/data/code/code_801A7B10.data.o" include "build/data/code/code_801A7B10.bss.o" - include "build/data/code/audio_init_params.rodata.o" + include "build/src/code/audio/audio_init_params.o" include "build/src/code/jpegutils.o" include "build/src/code/jpegdecoder.o" include_readonly "build/src/code/z_game_over.o" @@ -683,7 +680,9 @@ endseg beginseg name "buffers" flags NOLOAD - include "build/src/buffers/gfxbuffers.o" + include "build/src/buffers/gfxyield.o" + include "build/src/buffers/gfxstack.o" + include "build/src/buffers/gfxpools.o" include "build/data/code/buffers.bss.o" endseg @@ -1629,8 +1628,7 @@ beginseg name "ovl_En_Ms" compress include "build/src/overlays/actors/ovl_En_Ms/z_en_ms.o" - include "build/data/ovl_En_Ms/ovl_En_Ms.data.o" - include "build/data/ovl_En_Ms/ovl_En_Ms.reloc.o" + include "build/src/overlays/actors/ovl_En_Ms/ovl_En_Ms_reloc.o" endseg beginseg @@ -2012,8 +2010,7 @@ beginseg name "ovl_Effect_Ss_Kakera" compress include "build/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.o" - include "build/data/ovl_Effect_Ss_Kakera/ovl_Effect_Ss_Kakera.data.o" - include "build/data/ovl_Effect_Ss_Kakera/ovl_Effect_Ss_Kakera.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Kakera/ovl_Effect_Ss_Kakera_reloc.o" endseg beginseg @@ -2199,8 +2196,7 @@ beginseg name "ovl_En_Gs" compress include "build/src/overlays/actors/ovl_En_Gs/z_en_gs.o" - include "build/data/ovl_En_Gs/ovl_En_Gs.data.o" - include "build/data/ovl_En_Gs/ovl_En_Gs.reloc.o" + include "build/src/overlays/actors/ovl_En_Gs/ovl_En_Gs_reloc.o" endseg beginseg @@ -3219,8 +3215,11 @@ beginseg name "ovl_En_Tru" compress include "build/src/overlays/actors/ovl_En_Tru/z_en_tru.o" - include "build/data/ovl_En_Tru/ovl_En_Tru.data.o" - include "build/data/ovl_En_Tru/ovl_En_Tru.reloc.o" + #ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_En_Tru/ovl_En_Tru_reloc.o" + #else + include "build/data/ovl_En_Tru/ovl_En_Tru.reloc.o" + #endif endseg beginseg @@ -3234,8 +3233,7 @@ beginseg name "ovl_En_Test5" compress include "build/src/overlays/actors/ovl_En_Test5/z_en_test5.o" - include "build/data/ovl_En_Test5/ovl_En_Test5.data.o" - include "build/data/ovl_En_Test5/ovl_En_Test5.reloc.o" + include "build/src/overlays/actors/ovl_En_Test5/ovl_En_Test5_reloc.o" endseg beginseg @@ -4131,8 +4129,7 @@ beginseg name "ovl_Bg_Goron_Oyu" compress include "build/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.o" - include "build/data/ovl_Bg_Goron_Oyu/ovl_Bg_Goron_Oyu.data.o" - include "build/data/ovl_Bg_Goron_Oyu/ovl_Bg_Goron_Oyu.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Goron_Oyu/ovl_Bg_Goron_Oyu_reloc.o" endseg beginseg @@ -4458,8 +4455,7 @@ beginseg name "ovl_Obj_Tree" compress include "build/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.o" - include "build/data/ovl_Obj_Tree/ovl_Obj_Tree.data.o" - include "build/data/ovl_Obj_Tree/ovl_Obj_Tree.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Tree/ovl_Obj_Tree_reloc.o" endseg beginseg @@ -4633,8 +4629,7 @@ beginseg name "ovl_En_Tanron3" compress include "build/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.o" - include "build/data/ovl_En_Tanron3/ovl_En_Tanron3.data.o" - include "build/data/ovl_En_Tanron3/ovl_En_Tanron3.reloc.o" + include "build/src/overlays/actors/ovl_En_Tanron3/ovl_En_Tanron3_reloc.o" endseg beginseg @@ -5265,8 +5260,7 @@ beginseg name "ovl_En_Recepgirl" compress include "build/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.o" - include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.data.o" - include "build/data/ovl_En_Recepgirl/ovl_En_Recepgirl.reloc.o" + include "build/src/overlays/actors/ovl_En_Recepgirl/ovl_En_Recepgirl_reloc.o" endseg beginseg @@ -5296,9 +5290,7 @@ beginseg name "ovl_Obj_Yado" compress include "build/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.o" - include "build/data/ovl_Obj_Yado/ovl_Obj_Yado.data.o" - include "build/data/ovl_Obj_Yado/ovl_Obj_Yado.bss.o" - include "build/data/ovl_Obj_Yado/ovl_Obj_Yado.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Yado/ovl_Obj_Yado_reloc.o" endseg beginseg @@ -5506,8 +5498,7 @@ beginseg name "ovl_En_Invisible_Ruppe" compress include "build/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.o" - include "build/data/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe.data.o" - include "build/data/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe.reloc.o" + include "build/src/overlays/actors/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe_reloc.o" endseg beginseg @@ -5528,21 +5519,24 @@ beginseg name "gameplay_keep" compress romalign 0x1000 - include "build/baserom/gameplay_keep.o" + number 4 + include "build/assets/objects/gameplay_keep/gameplay_keep.o" endseg beginseg name "gameplay_field_keep" compress romalign 0x1000 - include "build/baserom/gameplay_field_keep.o" + number 5 + include "build/assets/objects/gameplay_field_keep/gameplay_field_keep.o" endseg beginseg name "gameplay_dangeon_keep" compress romalign 0x1000 - include "build/baserom/gameplay_dangeon_keep.o" + number 5 + include "build/assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.o" endseg beginseg @@ -5556,3227 +5550,3688 @@ beginseg name "object_link_boy" compress romalign 0x1000 - include "build/baserom/object_link_boy.o" + number 6 + include "build/assets/objects/object_link_boy/object_link_boy.o" endseg beginseg name "object_link_child" compress romalign 0x1000 - include "build/baserom/object_link_child.o" + number 6 + include "build/assets/objects/object_link_child/object_link_child.o" endseg beginseg name "object_link_goron" compress romalign 0x1000 - include "build/baserom/object_link_goron.o" + number 6 + include "build/assets/objects/object_link_goron/object_link_goron.o" endseg beginseg name "object_link_zora" compress romalign 0x1000 - include "build/baserom/object_link_zora.o" + number 6 + include "build/assets/objects/object_link_zora/object_link_zora.o" endseg beginseg name "object_link_nuts" compress romalign 0x1000 - include "build/baserom/object_link_nuts.o" + number 6 + include "build/assets/objects/object_link_nuts/object_link_nuts.o" endseg beginseg name "object_mask_ki_tan" compress romalign 0x1000 - include "build/baserom/object_mask_ki_tan.o" + number 10 + include "build/assets/objects/object_mask_ki_tan/object_mask_ki_tan.o" endseg beginseg name "object_mask_rabit" compress romalign 0x1000 - include "build/baserom/object_mask_rabit.o" + number 10 + include "build/assets/objects/object_mask_rabit/object_mask_rabit.o" endseg beginseg name "object_mask_skj" compress romalign 0x1000 - include "build/baserom/object_mask_skj.o" + number 10 + include "build/assets/objects/object_mask_skj/object_mask_skj.o" endseg beginseg name "object_mask_truth" compress romalign 0x1000 - include "build/baserom/object_mask_truth.o" + number 10 + include "build/assets/objects/object_mask_truth/object_mask_truth.o" endseg beginseg name "object_mask_gibudo" compress romalign 0x1000 - include "build/baserom/object_mask_gibudo.o" + number 10 + include "build/assets/objects/object_mask_gibudo/object_mask_gibudo.o" endseg beginseg name "object_mask_json" compress romalign 0x1000 - include "build/baserom/object_mask_json.o" + number 10 + include "build/assets/objects/object_mask_json/object_mask_json.o" endseg beginseg name "object_mask_kerfay" compress romalign 0x1000 - include "build/baserom/object_mask_kerfay.o" + number 10 + include "build/assets/objects/object_mask_kerfay/object_mask_kerfay.o" endseg beginseg name "object_mask_bigelf" compress romalign 0x1000 - include "build/baserom/object_mask_bigelf.o" + number 10 + include "build/assets/objects/object_mask_bigelf/object_mask_bigelf.o" endseg beginseg name "object_mask_kyojin" compress romalign 0x1000 - include "build/baserom/object_mask_kyojin.o" + number 10 + include "build/assets/objects/object_mask_kyojin/object_mask_kyojin.o" endseg beginseg name "object_mask_romerny" compress romalign 0x1000 - include "build/baserom/object_mask_romerny.o" + number 10 + include "build/assets/objects/object_mask_romerny/object_mask_romerny.o" endseg beginseg name "object_mask_posthat" compress romalign 0x1000 - include "build/baserom/object_mask_posthat.o" + number 10 + include "build/assets/objects/object_mask_posthat/object_mask_posthat.o" endseg beginseg name "object_mask_zacho" compress romalign 0x1000 - include "build/baserom/object_mask_zacho.o" + number 10 + include "build/assets/objects/object_mask_zacho/object_mask_zacho.o" endseg beginseg name "object_mask_stone" compress romalign 0x1000 - include "build/baserom/object_mask_stone.o" + number 10 + include "build/assets/objects/object_mask_stone/object_mask_stone.o" endseg beginseg name "object_mask_bree" compress romalign 0x1000 - include "build/baserom/object_mask_bree.o" + number 10 + include "build/assets/objects/object_mask_bree/object_mask_bree.o" endseg beginseg name "object_mask_gero" compress romalign 0x1000 - include "build/baserom/object_mask_gero.o" + number 10 + include "build/assets/objects/object_mask_gero/object_mask_gero.o" endseg beginseg name "object_mask_yofukasi" compress romalign 0x1000 - include "build/baserom/object_mask_yofukasi.o" + number 10 + include "build/assets/objects/object_mask_yofukasi/object_mask_yofukasi.o" endseg beginseg name "object_mask_meoto" compress romalign 0x1000 - include "build/baserom/object_mask_meoto.o" + number 10 + include "build/assets/objects/object_mask_meoto/object_mask_meoto.o" endseg beginseg name "object_mask_dancer" compress romalign 0x1000 - include "build/baserom/object_mask_dancer.o" + number 10 + include "build/assets/objects/object_mask_dancer/object_mask_dancer.o" endseg beginseg name "object_mask_bakuretu" compress romalign 0x1000 - include "build/baserom/object_mask_bakuretu.o" + number 10 + include "build/assets/objects/object_mask_bakuretu/object_mask_bakuretu.o" endseg beginseg name "object_mask_bu_san" compress romalign 0x1000 - include "build/baserom/object_mask_bu_san.o" + number 10 + include "build/assets/objects/object_mask_bu_san/object_mask_bu_san.o" endseg beginseg name "object_mask_goron" compress romalign 0x1000 - include "build/baserom/object_mask_goron.o" + number 10 + include "build/assets/objects/object_mask_goron/object_mask_goron.o" endseg beginseg name "object_mask_zora" compress romalign 0x1000 - include "build/baserom/object_mask_zora.o" + number 10 + include "build/assets/objects/object_mask_zora/object_mask_zora.o" endseg beginseg name "object_mask_nuts" compress romalign 0x1000 - include "build/baserom/object_mask_nuts.o" + number 10 + include "build/assets/objects/object_mask_nuts/object_mask_nuts.o" endseg beginseg name "object_mask_boy" compress romalign 0x1000 - include "build/baserom/object_mask_boy.o" + number 10 + include "build/assets/objects/object_mask_boy/object_mask_boy.o" endseg beginseg name "object_box" compress romalign 0x1000 - include "build/baserom/object_box.o" + number 6 + include "build/assets/objects/object_box/object_box.o" endseg beginseg name "object_okuta" compress romalign 0x1000 - include "build/baserom/object_okuta.o" + number 6 + include "build/assets/objects/object_okuta/object_okuta.o" endseg beginseg name "object_wallmaster" compress romalign 0x1000 - include "build/baserom/object_wallmaster.o" + number 6 + include "build/assets/objects/object_wallmaster/object_wallmaster.o" endseg beginseg name "object_dy_obj" compress romalign 0x1000 - include "build/baserom/object_dy_obj.o" + number 6 + include "build/assets/objects/object_dy_obj/object_dy_obj.o" endseg beginseg name "object_firefly" compress romalign 0x1000 - include "build/baserom/object_firefly.o" + number 6 + include "build/assets/objects/object_firefly/object_firefly.o" endseg beginseg name "object_dodongo" compress romalign 0x1000 - include "build/baserom/object_dodongo.o" + number 6 + include "build/assets/objects/object_dodongo/object_dodongo.o" endseg beginseg name "object_niw" compress romalign 0x1000 - include "build/baserom/object_niw.o" + number 6 + include "build/assets/objects/object_niw/object_niw.o" endseg beginseg name "object_tite" compress romalign 0x1000 - include "build/baserom/object_tite.o" + number 6 + include "build/assets/objects/object_tite/object_tite.o" endseg beginseg name "object_ph" compress romalign 0x1000 - include "build/baserom/object_ph.o" + number 6 + include "build/assets/objects/object_ph/object_ph.o" endseg beginseg name "object_dinofos" compress romalign 0x1000 - include "build/baserom/object_dinofos.o" + number 6 + include "build/assets/objects/object_dinofos/object_dinofos.o" endseg beginseg name "object_zl1" compress romalign 0x1000 - include "build/baserom/object_zl1.o" + number 6 + include "build/assets/objects/object_zl1/object_zl1.o" endseg beginseg name "object_bubble" compress romalign 0x1000 - include "build/baserom/object_bubble.o" + number 6 + include "build/assets/objects/object_bubble/object_bubble.o" endseg beginseg name "object_test3" compress romalign 0x1000 - include "build/baserom/object_test3.o" + number 6 + include "build/assets/objects/object_test3/object_test3.o" endseg beginseg name "object_famos" compress romalign 0x1000 - include "build/baserom/object_famos.o" + number 6 + include "build/assets/objects/object_famos/object_famos.o" endseg beginseg name "object_st" compress romalign 0x1000 - include "build/baserom/object_st.o" + number 6 + include "build/assets/objects/object_st/object_st.o" endseg beginseg name "object_thiefbird" compress romalign 0x1000 - include "build/baserom/object_thiefbird.o" + number 6 + include "build/assets/objects/object_thiefbird/object_thiefbird.o" endseg beginseg name "object_bombf" compress romalign 0x1000 - include "build/baserom/object_bombf.o" + number 6 + include "build/assets/objects/object_bombf/object_bombf.o" endseg beginseg name "object_am" compress romalign 0x1000 - include "build/baserom/object_am.o" + number 6 + include "build/assets/objects/object_am/object_am.o" endseg beginseg name "object_dekubaba" compress romalign 0x1000 - include "build/baserom/object_dekubaba.o" + number 6 + include "build/assets/objects/object_dekubaba/object_dekubaba.o" endseg beginseg name "object_warp1" compress romalign 0x1000 - include "build/baserom/object_warp1.o" + number 6 + include "build/assets/objects/object_warp1/object_warp1.o" endseg beginseg name "object_b_heart" compress romalign 0x1000 - include "build/baserom/object_b_heart.o" + number 6 + include "build/assets/objects/object_b_heart/object_b_heart.o" endseg beginseg name "object_dekunuts" compress romalign 0x1000 - include "build/baserom/object_dekunuts.o" + number 6 + include "build/assets/objects/object_dekunuts/object_dekunuts.o" endseg beginseg name "object_bb" compress romalign 0x1000 - include "build/baserom/object_bb.o" + number 6 + include "build/assets/objects/object_bb/object_bb.o" endseg beginseg name "object_death" compress romalign 0x1000 - include "build/baserom/object_death.o" + number 6 + include "build/assets/objects/object_death/object_death.o" endseg beginseg name "object_hata" compress romalign 0x1000 - include "build/baserom/object_hata.o" + number 6 + include "build/assets/objects/object_hata/object_hata.o" endseg beginseg name "object_wood02" compress romalign 0x1000 - include "build/baserom/object_wood02.o" + number 6 + include "build/assets/objects/object_wood02/object_wood02.o" endseg beginseg name "object_trap" compress romalign 0x1000 - include "build/baserom/object_trap.o" + number 6 + include "build/assets/objects/object_trap/object_trap.o" endseg beginseg name "object_vm" compress romalign 0x1000 - include "build/baserom/object_vm.o" + number 6 + include "build/assets/objects/object_vm/object_vm.o" endseg beginseg name "object_efc_star_field" compress romalign 0x1000 - include "build/baserom/object_efc_star_field.o" + number 6 + include "build/assets/objects/object_efc_star_field/object_efc_star_field.o" endseg beginseg name "object_rd" compress romalign 0x1000 - include "build/baserom/object_rd.o" + number 6 + include "build/assets/objects/object_rd/object_rd.o" endseg beginseg name "object_yukimura_obj" compress romalign 0x1000 - include "build/baserom/object_yukimura_obj.o" + number 6 + include "build/assets/objects/object_yukimura_obj/object_yukimura_obj.o" endseg beginseg name "object_horse_link_child" compress romalign 0x1000 - include "build/baserom/object_horse_link_child.o" + number 6 + include "build/assets/objects/object_horse_link_child/object_horse_link_child.o" endseg beginseg name "object_syokudai" compress romalign 0x1000 - include "build/baserom/object_syokudai.o" + number 6 + include "build/assets/objects/object_syokudai/object_syokudai.o" endseg beginseg name "object_efc_tw" compress romalign 0x1000 - include "build/baserom/object_efc_tw.o" + number 6 + include "build/assets/objects/object_efc_tw/object_efc_tw.o" endseg beginseg name "object_gi_key" compress romalign 0x1000 - include "build/baserom/object_gi_key.o" + number 6 + include "build/assets/objects/object_gi_key/object_gi_key.o" endseg beginseg name "object_mir_ray" compress romalign 0x1000 - include "build/baserom/object_mir_ray.o" + number 6 + include "build/assets/objects/object_mir_ray/object_mir_ray.o" endseg beginseg name "object_ctower_rot" compress romalign 0x1000 - include "build/baserom/object_ctower_rot.o" + number 6 + include "build/assets/objects/object_ctower_rot/object_ctower_rot.o" endseg beginseg name "object_bdoor" compress romalign 0x1000 - include "build/baserom/object_bdoor.o" + number 6 + include "build/assets/objects/object_bdoor/object_bdoor.o" endseg beginseg name "object_sb" compress romalign 0x1000 - include "build/baserom/object_sb.o" + number 6 + include "build/assets/objects/object_sb/object_sb.o" endseg beginseg name "object_gi_melody" compress romalign 0x1000 - include "build/baserom/object_gi_melody.o" + number 6 + include "build/assets/objects/object_gi_melody/object_gi_melody.o" endseg beginseg name "object_gi_heart" compress romalign 0x1000 - include "build/baserom/object_gi_heart.o" + number 6 + include "build/assets/objects/object_gi_heart/object_gi_heart.o" endseg beginseg name "object_gi_compass" compress romalign 0x1000 - include "build/baserom/object_gi_compass.o" + number 6 + include "build/assets/objects/object_gi_compass/object_gi_compass.o" endseg beginseg name "object_gi_bosskey" compress romalign 0x1000 - include "build/baserom/object_gi_bosskey.o" + number 6 + include "build/assets/objects/object_gi_bosskey/object_gi_bosskey.o" endseg beginseg name "object_gi_nuts" compress romalign 0x1000 - include "build/baserom/object_gi_nuts.o" + number 6 + include "build/assets/objects/object_gi_nuts/object_gi_nuts.o" endseg beginseg name "object_gi_hearts" compress romalign 0x1000 - include "build/baserom/object_gi_hearts.o" + number 6 + include "build/assets/objects/object_gi_hearts/object_gi_hearts.o" endseg beginseg name "object_gi_arrowcase" compress romalign 0x1000 - include "build/baserom/object_gi_arrowcase.o" + number 6 + include "build/assets/objects/object_gi_arrowcase/object_gi_arrowcase.o" endseg beginseg name "object_gi_bombpouch" compress romalign 0x1000 - include "build/baserom/object_gi_bombpouch.o" + number 6 + include "build/assets/objects/object_gi_bombpouch/object_gi_bombpouch.o" endseg beginseg name "object_in" compress romalign 0x1000 - include "build/baserom/object_in.o" + number 6 + include "build/assets/objects/object_in/object_in.o" endseg beginseg name "object_os_anime" compress romalign 0x1000 - include "build/baserom/object_os_anime.o" + number 6 + include "build/assets/objects/object_os_anime/object_os_anime.o" endseg beginseg name "object_gi_bottle" compress romalign 0x1000 - include "build/baserom/object_gi_bottle.o" + number 6 + include "build/assets/objects/object_gi_bottle/object_gi_bottle.o" endseg beginseg name "object_gi_stick" compress romalign 0x1000 - include "build/baserom/object_gi_stick.o" + number 6 + include "build/assets/objects/object_gi_stick/object_gi_stick.o" endseg beginseg name "object_gi_map" compress romalign 0x1000 - include "build/baserom/object_gi_map.o" + number 6 + include "build/assets/objects/object_gi_map/object_gi_map.o" endseg beginseg name "object_oF1d_map" compress romalign 0x1000 - include "build/baserom/object_oF1d_map.o" + number 6 + include "build/assets/objects/object_oF1d_map/object_oF1d_map.o" endseg beginseg name "object_ru2" compress romalign 0x1000 - include "build/baserom/object_ru2.o" + number 6 + include "build/assets/objects/object_ru2/object_ru2.o" endseg beginseg name "object_gi_magicpot" compress romalign 0x1000 - include "build/baserom/object_gi_magicpot.o" + number 6 + include "build/assets/objects/object_gi_magicpot/object_gi_magicpot.o" endseg beginseg name "object_gi_bomb_1" compress romalign 0x1000 - include "build/baserom/object_gi_bomb_1.o" + number 6 + include "build/assets/objects/object_gi_bomb_1/object_gi_bomb_1.o" endseg beginseg name "object_ma2" compress romalign 0x1000 - include "build/baserom/object_ma2.o" + number 6 + include "build/assets/objects/object_ma2/object_ma2.o" endseg beginseg name "object_gi_purse" compress romalign 0x1000 - include "build/baserom/object_gi_purse.o" + number 6 + include "build/assets/objects/object_gi_purse/object_gi_purse.o" endseg beginseg name "object_rr" compress romalign 0x1000 - include "build/baserom/object_rr.o" + number 6 + include "build/assets/objects/object_rr/object_rr.o" endseg beginseg name "object_gi_arrow" compress romalign 0x1000 - include "build/baserom/object_gi_arrow.o" + number 6 + include "build/assets/objects/object_gi_arrow/object_gi_arrow.o" endseg beginseg name "object_gi_bomb_2" compress romalign 0x1000 - include "build/baserom/object_gi_bomb_2.o" + number 6 + include "build/assets/objects/object_gi_bomb_2/object_gi_bomb_2.o" endseg beginseg name "object_gi_shield_2" compress romalign 0x1000 - include "build/baserom/object_gi_shield_2.o" + number 6 + include "build/assets/objects/object_gi_shield_2/object_gi_shield_2.o" endseg beginseg name "object_gi_hookshot" compress romalign 0x1000 - include "build/baserom/object_gi_hookshot.o" + number 6 + include "build/assets/objects/object_gi_hookshot/object_gi_hookshot.o" endseg beginseg name "object_gi_ocarina" compress romalign 0x1000 - include "build/baserom/object_gi_ocarina.o" + number 6 + include "build/assets/objects/object_gi_ocarina/object_gi_ocarina.o" endseg beginseg name "object_gi_milk" compress romalign 0x1000 - include "build/baserom/object_gi_milk.o" + number 6 + include "build/assets/objects/object_gi_milk/object_gi_milk.o" endseg beginseg name "object_ma1" compress romalign 0x1000 - include "build/baserom/object_ma1.o" + number 6 + include "build/assets/objects/object_ma1/object_ma1.o" endseg beginseg name "object_ny" compress romalign 0x1000 - include "build/baserom/object_ny.o" + number 6 + include "build/assets/objects/object_ny/object_ny.o" endseg beginseg name "object_fr" compress romalign 0x1000 - include "build/baserom/object_fr.o" + number 6 + include "build/assets/objects/object_fr/object_fr.o" endseg beginseg name "object_gi_bow" compress romalign 0x1000 - include "build/baserom/object_gi_bow.o" + number 6 + include "build/assets/objects/object_gi_bow/object_gi_bow.o" endseg beginseg name "object_gi_glasses" compress romalign 0x1000 - include "build/baserom/object_gi_glasses.o" + number 6 + include "build/assets/objects/object_gi_glasses/object_gi_glasses.o" endseg beginseg name "object_gi_liquid" compress romalign 0x1000 - include "build/baserom/object_gi_liquid.o" + number 6 + include "build/assets/objects/object_gi_liquid/object_gi_liquid.o" endseg beginseg name "object_ani" compress romalign 0x1000 - include "build/baserom/object_ani.o" + number 6 + include "build/assets/objects/object_ani/object_ani.o" endseg beginseg name "object_gi_shield_3" compress romalign 0x1000 - include "build/baserom/object_gi_shield_3.o" + number 6 + include "build/assets/objects/object_gi_shield_3/object_gi_shield_3.o" endseg beginseg name "object_gi_bean" compress romalign 0x1000 - include "build/baserom/object_gi_bean.o" + number 6 + include "build/assets/objects/object_gi_bean/object_gi_bean.o" endseg beginseg name "object_gi_fish" compress romalign 0x1000 - include "build/baserom/object_gi_fish.o" + number 6 + include "build/assets/objects/object_gi_fish/object_gi_fish.o" endseg beginseg name "object_gi_longsword" compress romalign 0x1000 - include "build/baserom/object_gi_longsword.o" + number 6 + include "build/assets/objects/object_gi_longsword/object_gi_longsword.o" endseg beginseg name "object_zo" compress romalign 0x1000 - include "build/baserom/object_zo.o" + number 6 + include "build/assets/objects/object_zo/object_zo.o" endseg beginseg name "object_umajump" compress romalign 0x1000 - include "build/baserom/object_umajump.o" + number 6 + include "build/assets/objects/object_umajump/object_umajump.o" endseg beginseg name "object_mastergolon" compress romalign 0x1000 - include "build/baserom/object_mastergolon.o" + number 6 + include "build/assets/objects/object_mastergolon/object_mastergolon.o" endseg beginseg name "object_masterzoora" compress romalign 0x1000 - include "build/baserom/object_masterzoora.o" + number 6 + include "build/assets/objects/object_masterzoora/object_masterzoora.o" endseg beginseg name "object_aob" compress romalign 0x1000 - include "build/baserom/object_aob.o" + number 6 + include "build/assets/objects/object_aob/object_aob.o" endseg beginseg name "object_ik" compress romalign 0x1000 - include "build/baserom/object_ik.o" + number 6 + include "build/assets/objects/object_ik/object_ik.o" endseg beginseg name "object_ahg" compress romalign 0x1000 - include "build/baserom/object_ahg.o" + number 6 + include "build/assets/objects/object_ahg/object_ahg.o" endseg beginseg name "object_cne" compress romalign 0x1000 - include "build/baserom/object_cne.o" + number 6 + include "build/assets/objects/object_cne/object_cne.o" endseg beginseg name "object_bji" compress romalign 0x1000 - include "build/baserom/object_bji.o" + number 6 + include "build/assets/objects/object_bji/object_bji.o" endseg beginseg name "object_bba" compress romalign 0x1000 - include "build/baserom/object_bba.o" + number 6 + include "build/assets/objects/object_bba/object_bba.o" endseg beginseg name "object_an1" compress romalign 0x1000 - include "build/baserom/object_an1.o" + number 6 + include "build/assets/objects/object_an1/object_an1.o" endseg beginseg name "object_boj" compress romalign 0x1000 - include "build/baserom/object_boj.o" + number 6 + include "build/assets/objects/object_boj/object_boj.o" endseg beginseg name "object_fz" compress romalign 0x1000 - include "build/baserom/object_fz.o" + number 6 + include "build/assets/objects/object_fz/object_fz.o" endseg beginseg name "object_bob" compress romalign 0x1000 - include "build/baserom/object_bob.o" + number 6 + include "build/assets/objects/object_bob/object_bob.o" endseg beginseg name "object_ge1" compress romalign 0x1000 - include "build/baserom/object_ge1.o" + number 6 + include "build/assets/objects/object_ge1/object_ge1.o" endseg beginseg name "object_yabusame_point" compress romalign 0x1000 - include "build/baserom/object_yabusame_point.o" + number 6 + include "build/assets/objects/object_yabusame_point/object_yabusame_point.o" endseg beginseg name "object_d_hsblock" compress romalign 0x1000 - include "build/baserom/object_d_hsblock.o" + number 6 + include "build/assets/objects/object_d_hsblock/object_d_hsblock.o" endseg beginseg name "object_d_lift" compress romalign 0x1000 - include "build/baserom/object_d_lift.o" + number 6 + include "build/assets/objects/object_d_lift/object_d_lift.o" endseg beginseg name "object_mamenoki" compress romalign 0x1000 - include "build/baserom/object_mamenoki.o" + number 6 + include "build/assets/objects/object_mamenoki/object_mamenoki.o" endseg beginseg name "object_goroiwa" compress romalign 0x1000 - include "build/baserom/object_goroiwa.o" + number 6 + include "build/assets/objects/object_goroiwa/object_goroiwa.o" endseg beginseg name "object_toryo" compress romalign 0x1000 - include "build/baserom/object_toryo.o" + number 6 + include "build/assets/objects/object_toryo/object_toryo.o" endseg beginseg name "object_daiku" compress romalign 0x1000 - include "build/baserom/object_daiku.o" + number 6 + include "build/assets/objects/object_daiku/object_daiku.o" endseg beginseg name "object_nwc" compress romalign 0x1000 - include "build/baserom/object_nwc.o" + number 6 + include "build/assets/objects/object_nwc/object_nwc.o" endseg beginseg name "object_gm" compress romalign 0x1000 - include "build/baserom/object_gm.o" + number 6 + include "build/assets/objects/object_gm/object_gm.o" endseg beginseg name "object_ms" compress romalign 0x1000 - include "build/baserom/object_ms.o" + number 6 + include "build/assets/objects/object_ms/object_ms.o" endseg beginseg name "object_hs" compress romalign 0x1000 - include "build/baserom/object_hs.o" + number 6 + include "build/assets/objects/object_hs/object_hs.o" endseg beginseg name "object_lightswitch" compress romalign 0x1000 - include "build/baserom/object_lightswitch.o" + number 6 + include "build/assets/objects/object_lightswitch/object_lightswitch.o" endseg beginseg name "object_kusa" compress romalign 0x1000 - include "build/baserom/object_kusa.o" + number 6 + include "build/assets/objects/object_kusa/object_kusa.o" endseg beginseg name "object_tsubo" compress romalign 0x1000 - include "build/baserom/object_tsubo.o" + number 6 + include "build/assets/objects/object_tsubo/object_tsubo.o" endseg beginseg name "object_kanban" compress romalign 0x1000 - include "build/baserom/object_kanban.o" + number 6 + include "build/assets/objects/object_kanban/object_kanban.o" endseg beginseg name "object_owl" compress romalign 0x1000 - include "build/baserom/object_owl.o" + number 6 + include "build/assets/objects/object_owl/object_owl.o" endseg beginseg name "object_mk" compress romalign 0x1000 - include "build/baserom/object_mk.o" + number 6 + include "build/assets/objects/object_mk/object_mk.o" endseg beginseg name "object_fu" compress romalign 0x1000 - include "build/baserom/object_fu.o" + number 6 + include "build/assets/objects/object_fu/object_fu.o" endseg beginseg name "object_gi_ki_tan_mask" compress romalign 0x1000 - include "build/baserom/object_gi_ki_tan_mask.o" + number 6 + include "build/assets/objects/object_gi_ki_tan_mask/object_gi_ki_tan_mask.o" endseg beginseg name "object_gi_mask18" compress romalign 0x1000 - include "build/baserom/object_gi_mask18.o" + number 6 + include "build/assets/objects/object_gi_mask18/object_gi_mask18.o" endseg beginseg name "object_gi_rabit_mask" compress romalign 0x1000 - include "build/baserom/object_gi_rabit_mask.o" + number 6 + include "build/assets/objects/object_gi_rabit_mask/object_gi_rabit_mask.o" endseg beginseg name "object_gi_truth_mask" compress romalign 0x1000 - include "build/baserom/object_gi_truth_mask.o" + number 6 + include "build/assets/objects/object_gi_truth_mask/object_gi_truth_mask.o" endseg beginseg name "object_stream" compress romalign 0x1000 - include "build/baserom/object_stream.o" + number 6 + include "build/assets/objects/object_stream/object_stream.o" endseg beginseg name "object_mm" compress romalign 0x1000 - include "build/baserom/object_mm.o" + number 6 + include "build/assets/objects/object_mm/object_mm.o" endseg beginseg name "object_js" compress romalign 0x1000 - include "build/baserom/object_js.o" + number 6 + include "build/assets/objects/object_js/object_js.o" endseg beginseg name "object_cs" compress romalign 0x1000 - include "build/baserom/object_cs.o" + number 6 + include "build/assets/objects/object_cs/object_cs.o" endseg beginseg name "object_gi_soldout" compress romalign 0x1000 - include "build/baserom/object_gi_soldout.o" + number 6 + include "build/assets/objects/object_gi_soldout/object_gi_soldout.o" endseg beginseg name "object_mag" compress romalign 0x1000 - include "build/baserom/object_mag.o" + number 6 + include "build/assets/objects/object_mag/object_mag.o" endseg beginseg name "object_gi_golonmask" compress romalign 0x1000 - include "build/baserom/object_gi_golonmask.o" + number 6 + include "build/assets/objects/object_gi_golonmask/object_gi_golonmask.o" endseg beginseg name "object_gi_zoramask" compress romalign 0x1000 - include "build/baserom/object_gi_zoramask.o" + number 6 + include "build/assets/objects/object_gi_zoramask/object_gi_zoramask.o" endseg beginseg name "object_ka" compress romalign 0x1000 - include "build/baserom/object_ka.o" + number 6 + include "build/assets/objects/object_ka/object_ka.o" endseg beginseg name "object_zg" compress romalign 0x1000 - include "build/baserom/object_zg.o" + number 6 + include "build/assets/objects/object_zg/object_zg.o" endseg beginseg name "object_gi_m_arrow" compress romalign 0x1000 - include "build/baserom/object_gi_m_arrow.o" + number 6 + include "build/assets/objects/object_gi_m_arrow/object_gi_m_arrow.o" endseg beginseg name "object_ds2" compress romalign 0x1000 - include "build/baserom/object_ds2.o" + number 6 + include "build/assets/objects/object_ds2/object_ds2.o" endseg beginseg name "object_fish" compress romalign 0x1000 - include "build/baserom/object_fish.o" + number 6 + include "build/assets/objects/object_fish/object_fish.o" endseg beginseg name "object_gi_sutaru" compress romalign 0x1000 - include "build/baserom/object_gi_sutaru.o" + number 6 + include "build/assets/objects/object_gi_sutaru/object_gi_sutaru.o" endseg beginseg name "object_ssh" compress romalign 0x1000 - include "build/baserom/object_ssh.o" + number 6 + include "build/assets/objects/object_ssh/object_ssh.o" endseg beginseg name "object_bigslime" compress romalign 0x1000 - include "build/baserom/object_bigslime.o" + number 6 + include "build/assets/objects/object_bigslime/object_bigslime.o" endseg beginseg name "object_bg" compress romalign 0x1000 - include "build/baserom/object_bg.o" + number 6 + include "build/assets/objects/object_bg/object_bg.o" endseg beginseg name "object_bombiwa" compress romalign 0x1000 - include "build/baserom/object_bombiwa.o" + number 6 + include "build/assets/objects/object_bombiwa/object_bombiwa.o" endseg beginseg name "object_hintnuts" compress romalign 0x1000 - include "build/baserom/object_hintnuts.o" + number 6 + include "build/assets/objects/object_hintnuts/object_hintnuts.o" endseg beginseg name "object_rs" compress romalign 0x1000 - include "build/baserom/object_rs.o" + number 6 + include "build/assets/objects/object_rs/object_rs.o" endseg beginseg name "object_gla" compress romalign 0x1000 - include "build/baserom/object_gla.o" + number 6 + include "build/assets/objects/object_gla/object_gla.o" endseg beginseg name "object_geldb" compress romalign 0x1000 - include "build/baserom/object_geldb.o" + number 6 + include "build/assets/objects/object_geldb/object_geldb.o" endseg beginseg name "object_dog" compress romalign 0x1000 - include "build/baserom/object_dog.o" + number 6 + include "build/assets/objects/object_dog/object_dog.o" endseg beginseg name "object_kibako2" compress romalign 0x1000 - include "build/baserom/object_kibako2.o" + number 6 + include "build/assets/objects/object_kibako2/object_kibako2.o" endseg beginseg name "object_dns" compress romalign 0x1000 - include "build/baserom/object_dns.o" + number 6 + include "build/assets/objects/object_dns/object_dns.o" endseg beginseg name "object_dnk" compress romalign 0x1000 - include "build/baserom/object_dnk.o" + number 6 + include "build/assets/objects/object_dnk/object_dnk.o" endseg beginseg name "object_gi_insect" compress romalign 0x1000 - include "build/baserom/object_gi_insect.o" + number 6 + include "build/assets/objects/object_gi_insect/object_gi_insect.o" endseg beginseg name "object_gi_ghost" compress romalign 0x1000 - include "build/baserom/object_gi_ghost.o" + number 6 + include "build/assets/objects/object_gi_ghost/object_gi_ghost.o" endseg beginseg name "object_gi_soul" compress romalign 0x1000 - include "build/baserom/object_gi_soul.o" + number 6 + include "build/assets/objects/object_gi_soul/object_gi_soul.o" endseg beginseg name "object_f40_obj" compress romalign 0x1000 - include "build/baserom/object_f40_obj.o" + number 6 + include "build/assets/objects/object_f40_obj/object_f40_obj.o" endseg beginseg name "object_gi_rupy" compress romalign 0x1000 - include "build/baserom/object_gi_rupy.o" + number 6 + include "build/assets/objects/object_gi_rupy/object_gi_rupy.o" endseg beginseg name "object_po_composer" compress romalign 0x1000 - include "build/baserom/object_po_composer.o" + number 6 + include "build/assets/objects/object_po_composer/object_po_composer.o" endseg beginseg name "object_mu" compress romalign 0x1000 - include "build/baserom/object_mu.o" + number 6 + include "build/assets/objects/object_mu/object_mu.o" endseg beginseg name "object_wf" compress romalign 0x1000 - include "build/baserom/object_wf.o" + number 6 + include "build/assets/objects/object_wf/object_wf.o" endseg beginseg name "object_skb" compress romalign 0x1000 - include "build/baserom/object_skb.o" + number 6 + include "build/assets/objects/object_skb/object_skb.o" endseg beginseg name "object_gs" compress romalign 0x1000 - include "build/baserom/object_gs.o" + number 6 + include "build/assets/objects/object_gs/object_gs.o" endseg beginseg name "object_ps" compress romalign 0x1000 - include "build/baserom/object_ps.o" + number 6 + include "build/assets/objects/object_ps/object_ps.o" endseg beginseg name "object_omoya_obj" compress romalign 0x1000 - include "build/baserom/object_omoya_obj.o" + number 6 + include "build/assets/objects/object_omoya_obj/object_omoya_obj.o" endseg beginseg name "object_crow" compress romalign 0x1000 - include "build/baserom/object_crow.o" + number 6 + include "build/assets/objects/object_crow/object_crow.o" endseg beginseg name "object_cow" compress romalign 0x1000 - include "build/baserom/object_cow.o" + number 6 + include "build/assets/objects/object_cow/object_cow.o" endseg beginseg name "object_gi_sword_1" compress romalign 0x1000 - include "build/baserom/object_gi_sword_1.o" + number 6 + include "build/assets/objects/object_gi_sword_1/object_gi_sword_1.o" endseg beginseg name "object_zl4" compress romalign 0x1000 - include "build/baserom/object_zl4.o" + number 6 + include "build/assets/objects/object_zl4/object_zl4.o" endseg beginseg name "object_grasshopper" compress romalign 0x1000 - include "build/baserom/object_grasshopper.o" + number 6 + include "build/assets/objects/object_grasshopper/object_grasshopper.o" endseg beginseg name "object_boyo" compress romalign 0x1000 - include "build/baserom/object_boyo.o" + number 6 + include "build/assets/objects/object_boyo/object_boyo.o" endseg beginseg name "object_fwall" compress romalign 0x1000 - include "build/baserom/object_fwall.o" + number 6 + include "build/assets/objects/object_fwall/object_fwall.o" endseg beginseg name "object_jso" compress romalign 0x1000 - include "build/baserom/object_jso.o" + number 6 + include "build/assets/objects/object_jso/object_jso.o" endseg beginseg name "object_knight" compress romalign 0x1000 - include "build/baserom/object_knight.o" + number 6 + include "build/assets/objects/object_knight/object_knight.o" endseg beginseg name "object_icicle" compress romalign 0x1000 - include "build/baserom/object_icicle.o" + number 6 + include "build/assets/objects/object_icicle/object_icicle.o" endseg beginseg name "object_spdweb" compress romalign 0x1000 - include "build/baserom/object_spdweb.o" + number 6 + include "build/assets/objects/object_spdweb/object_spdweb.o" endseg beginseg name "object_boss01" compress romalign 0x1000 - include "build/baserom/object_boss01.o" + number 6 + include "build/assets/objects/object_boss01/object_boss01.o" endseg beginseg name "object_boss02" compress romalign 0x1000 - include "build/baserom/object_boss02.o" + number 6 + include "build/assets/objects/object_boss02/object_boss02.o" endseg beginseg name "object_boss03" compress romalign 0x1000 - include "build/baserom/object_boss03.o" + number 6 + include "build/assets/objects/object_boss03/object_boss03.o" endseg beginseg name "object_boss04" compress romalign 0x1000 - include "build/baserom/object_boss04.o" + number 6 + include "build/assets/objects/object_boss04/object_boss04.o" endseg beginseg name "object_boss05" compress romalign 0x1000 - include "build/baserom/object_boss05.o" + number 6 + include "build/assets/objects/object_boss05/object_boss05.o" endseg beginseg name "object_boss07" compress romalign 0x1000 - include "build/baserom/object_boss07.o" + number 6 + include "build/assets/objects/object_boss07/object_boss07.o" endseg beginseg name "object_raf" compress romalign 0x1000 - include "build/baserom/object_raf.o" + number 6 + include "build/assets/objects/object_raf/object_raf.o" endseg beginseg name "object_funen" compress romalign 0x1000 - include "build/baserom/object_funen.o" + number 6 + include "build/assets/objects/object_funen/object_funen.o" endseg beginseg name "object_raillift" compress romalign 0x1000 - include "build/baserom/object_raillift.o" + number 6 + include "build/assets/objects/object_raillift/object_raillift.o" endseg beginseg name "object_numa_obj" compress romalign 0x1000 - include "build/baserom/object_numa_obj.o" + number 6 + include "build/assets/objects/object_numa_obj/object_numa_obj.o" endseg beginseg name "object_flowerpot" compress romalign 0x1000 - include "build/baserom/object_flowerpot.o" + number 6 + include "build/assets/objects/object_flowerpot/object_flowerpot.o" endseg beginseg name "object_spinyroll" compress romalign 0x1000 - include "build/baserom/object_spinyroll.o" + number 6 + include "build/assets/objects/object_spinyroll/object_spinyroll.o" endseg beginseg name "object_ice_block" compress romalign 0x1000 - include "build/baserom/object_ice_block.o" + number 6 + include "build/assets/objects/object_ice_block/object_ice_block.o" endseg beginseg name "object_keikoku_demo" compress romalign 0x1000 - include "build/baserom/object_keikoku_demo.o" + number 6 + include "build/assets/objects/object_keikoku_demo/object_keikoku_demo.o" endseg beginseg name "object_slime" compress romalign 0x1000 - include "build/baserom/object_slime.o" + number 6 + include "build/assets/objects/object_slime/object_slime.o" endseg beginseg name "object_pr" compress romalign 0x1000 - include "build/baserom/object_pr.o" + number 6 + include "build/assets/objects/object_pr/object_pr.o" endseg beginseg name "object_f52_obj" compress romalign 0x1000 - include "build/baserom/object_f52_obj.o" + number 6 + include "build/assets/objects/object_f52_obj/object_f52_obj.o" endseg beginseg name "object_f53_obj" compress romalign 0x1000 - include "build/baserom/object_f53_obj.o" + number 6 + include "build/assets/objects/object_f53_obj/object_f53_obj.o" endseg beginseg name "object_kibako" compress romalign 0x1000 - include "build/baserom/object_kibako.o" + number 6 + include "build/assets/objects/object_kibako/object_kibako.o" endseg beginseg name "object_sek" compress romalign 0x1000 - include "build/baserom/object_sek.o" + number 6 + include "build/assets/objects/object_sek/object_sek.o" endseg beginseg name "object_gmo" compress romalign 0x1000 - include "build/baserom/object_gmo.o" + number 6 + include "build/assets/objects/object_gmo/object_gmo.o" endseg beginseg name "object_bat" compress romalign 0x1000 - include "build/baserom/object_bat.o" + number 6 + include "build/assets/objects/object_bat/object_bat.o" endseg beginseg name "object_sekihil" compress romalign 0x1000 - include "build/baserom/object_sekihil.o" + number 6 + include "build/assets/objects/object_sekihil/object_sekihil.o" endseg beginseg name "object_sekihig" compress romalign 0x1000 - include "build/baserom/object_sekihig.o" + number 6 + include "build/assets/objects/object_sekihig/object_sekihig.o" endseg beginseg name "object_sekihin" compress romalign 0x1000 - include "build/baserom/object_sekihin.o" + number 6 + include "build/assets/objects/object_sekihin/object_sekihin.o" endseg beginseg name "object_sekihiz" compress romalign 0x1000 - include "build/baserom/object_sekihiz.o" + number 6 + include "build/assets/objects/object_sekihiz/object_sekihiz.o" endseg beginseg name "object_wiz" compress romalign 0x1000 - include "build/baserom/object_wiz.o" + number 6 + include "build/assets/objects/object_wiz/object_wiz.o" endseg beginseg name "object_ladder" compress romalign 0x1000 - include "build/baserom/object_ladder.o" + number 6 + include "build/assets/objects/object_ladder/object_ladder.o" endseg beginseg name "object_mkk" compress romalign 0x1000 - include "build/baserom/object_mkk.o" + number 6 + include "build/assets/objects/object_mkk/object_mkk.o" endseg beginseg name "object_keikoku_obj" compress romalign 0x1000 - include "build/baserom/object_keikoku_obj.o" + number 6 + include "build/assets/objects/object_keikoku_obj/object_keikoku_obj.o" endseg beginseg name "object_sichitai_obj" compress romalign 0x1000 - include "build/baserom/object_sichitai_obj.o" + number 6 + include "build/assets/objects/object_sichitai_obj/object_sichitai_obj.o" endseg beginseg name "object_dekucity_ana_obj" compress romalign 0x1000 - include "build/baserom/object_dekucity_ana_obj.o" + number 6 + include "build/assets/objects/object_dekucity_ana_obj/object_dekucity_ana_obj.o" endseg beginseg name "object_rat" compress romalign 0x1000 - include "build/baserom/object_rat.o" + number 6 + include "build/assets/objects/object_rat/object_rat.o" endseg beginseg name "object_water_effect" compress romalign 0x1000 - include "build/baserom/object_water_effect.o" + number 6 + include "build/assets/objects/object_water_effect/object_water_effect.o" endseg beginseg name "object_dblue_object" compress romalign 0x1000 - include "build/baserom/object_dblue_object.o" + number 6 + include "build/assets/objects/object_dblue_object/object_dblue_object.o" endseg beginseg name "object_bal" compress romalign 0x1000 - include "build/baserom/object_bal.o" + number 6 + include "build/assets/objects/object_bal/object_bal.o" endseg beginseg name "object_warp_uzu" compress romalign 0x1000 - include "build/baserom/object_warp_uzu.o" + number 6 + include "build/assets/objects/object_warp_uzu/object_warp_uzu.o" endseg beginseg name "object_driftice" compress romalign 0x1000 - include "build/baserom/object_driftice.o" + number 6 + include "build/assets/objects/object_driftice/object_driftice.o" endseg beginseg name "object_fall" compress romalign 0x1000 - include "build/baserom/object_fall.o" + number 6 + include "build/assets/objects/object_fall/object_fall.o" endseg beginseg name "object_hanareyama_obj" compress romalign 0x1000 - include "build/baserom/object_hanareyama_obj.o" + number 6 + include "build/assets/objects/object_hanareyama_obj/object_hanareyama_obj.o" endseg beginseg name "object_crace_object" compress romalign 0x1000 - include "build/baserom/object_crace_object.o" + number 6 + include "build/assets/objects/object_crace_object/object_crace_object.o" endseg beginseg name "object_dnq" compress romalign 0x1000 - include "build/baserom/object_dnq.o" + number 6 + include "build/assets/objects/object_dnq/object_dnq.o" endseg beginseg name "object_obj_tokeidai" compress romalign 0x1000 - include "build/baserom/object_obj_tokeidai.o" + number 6 + include "build/assets/objects/object_obj_tokeidai/object_obj_tokeidai.o" endseg beginseg name "object_eg" compress romalign 0x1000 - include "build/baserom/object_eg.o" + number 6 + include "build/assets/objects/object_eg/object_eg.o" endseg beginseg name "object_tru" compress romalign 0x1000 - include "build/baserom/object_tru.o" + number 6 + include "build/assets/objects/object_tru/object_tru.o" endseg beginseg name "object_trt" compress romalign 0x1000 - include "build/baserom/object_trt.o" + number 6 + include "build/assets/objects/object_trt/object_trt.o" endseg beginseg name "object_hakugin_obj" compress romalign 0x1000 - include "build/baserom/object_hakugin_obj.o" + number 6 + include "build/assets/objects/object_hakugin_obj/object_hakugin_obj.o" endseg beginseg name "object_horse_game_check" compress romalign 0x1000 - include "build/baserom/object_horse_game_check.o" + number 6 + include "build/assets/objects/object_horse_game_check/object_horse_game_check.o" endseg beginseg name "object_stk" compress romalign 0x1000 - include "build/baserom/object_stk.o" + number 6 + include "build/assets/objects/object_stk/object_stk.o" endseg beginseg name "object_mnk" compress romalign 0x1000 - include "build/baserom/object_mnk.o" + number 6 + include "build/assets/objects/object_mnk/object_mnk.o" endseg beginseg name "object_gi_bottle_red" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_red.o" + number 6 + include "build/assets/objects/object_gi_bottle_red/object_gi_bottle_red.o" endseg beginseg name "object_tokei_tobira" compress romalign 0x1000 - include "build/baserom/object_tokei_tobira.o" + number 6 + include "build/assets/objects/object_tokei_tobira/object_tokei_tobira.o" endseg beginseg name "object_az" compress romalign 0x1000 - include "build/baserom/object_az.o" + number 6 + include "build/assets/objects/object_az/object_az.o" endseg beginseg name "object_twig" compress romalign 0x1000 - include "build/baserom/object_twig.o" + number 6 + include "build/assets/objects/object_twig/object_twig.o" endseg beginseg name "object_dekucity_obj" compress romalign 0x1000 - include "build/baserom/object_dekucity_obj.o" + number 6 + include "build/assets/objects/object_dekucity_obj/object_dekucity_obj.o" endseg beginseg name "object_po_fusen" compress romalign 0x1000 - include "build/baserom/object_po_fusen.o" + number 6 + include "build/assets/objects/object_po_fusen/object_po_fusen.o" endseg beginseg name "object_racetsubo" compress romalign 0x1000 - include "build/baserom/object_racetsubo.o" + number 6 + include "build/assets/objects/object_racetsubo/object_racetsubo.o" endseg beginseg name "object_ha" compress romalign 0x1000 - include "build/baserom/object_ha.o" + number 6 + include "build/assets/objects/object_ha/object_ha.o" endseg beginseg name "object_bigokuta" compress romalign 0x1000 - include "build/baserom/object_bigokuta.o" + number 6 + include "build/assets/objects/object_bigokuta/object_bigokuta.o" endseg beginseg name "object_open_obj" compress romalign 0x1000 - include "build/baserom/object_open_obj.o" + number 6 + include "build/assets/objects/object_open_obj/object_open_obj.o" endseg beginseg name "object_fu_kaiten" compress romalign 0x1000 - include "build/baserom/object_fu_kaiten.o" + number 6 + include "build/assets/objects/object_fu_kaiten/object_fu_kaiten.o" endseg beginseg name "object_fu_mato" compress romalign 0x1000 - include "build/baserom/object_fu_mato.o" + number 6 + include "build/assets/objects/object_fu_mato/object_fu_mato.o" endseg beginseg name "object_mtoride" compress romalign 0x1000 - include "build/baserom/object_mtoride.o" + number 6 + include "build/assets/objects/object_mtoride/object_mtoride.o" endseg beginseg name "object_osn" compress romalign 0x1000 - include "build/baserom/object_osn.o" + number 6 + include "build/assets/objects/object_osn/object_osn.o" endseg beginseg name "object_tokei_step" compress romalign 0x1000 - include "build/baserom/object_tokei_step.o" + number 6 + include "build/assets/objects/object_tokei_step/object_tokei_step.o" endseg beginseg name "object_lotus" compress romalign 0x1000 - include "build/baserom/object_lotus.o" + number 6 + include "build/assets/objects/object_lotus/object_lotus.o" endseg beginseg name "object_tl" compress romalign 0x1000 - include "build/baserom/object_tl.o" + number 6 + include "build/assets/objects/object_tl/object_tl.o" endseg beginseg name "object_dkjail_obj" compress romalign 0x1000 - include "build/baserom/object_dkjail_obj.o" + number 6 + include "build/assets/objects/object_dkjail_obj/object_dkjail_obj.o" endseg beginseg name "object_visiblock" compress romalign 0x1000 - include "build/baserom/object_visiblock.o" + number 6 + include "build/assets/objects/object_visiblock/object_visiblock.o" endseg beginseg name "object_tsn" compress romalign 0x1000 - include "build/baserom/object_tsn.o" + number 6 + include "build/assets/objects/object_tsn/object_tsn.o" endseg beginseg name "object_ds2n" compress romalign 0x1000 - include "build/baserom/object_ds2n.o" + number 6 + include "build/assets/objects/object_ds2n/object_ds2n.o" endseg beginseg name "object_fsn" compress romalign 0x1000 - include "build/baserom/object_fsn.o" + number 6 + include "build/assets/objects/object_fsn/object_fsn.o" endseg beginseg name "object_shn" compress romalign 0x1000 - include "build/baserom/object_shn.o" + number 6 + include "build/assets/objects/object_shn/object_shn.o" endseg beginseg name "object_bigicicle" compress romalign 0x1000 - include "build/baserom/object_bigicicle.o" + number 6 + include "build/assets/objects/object_bigicicle/object_bigicicle.o" endseg beginseg name "object_gi_bottle_15" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_15.o" + number 6 + include "build/assets/objects/object_gi_bottle_15/object_gi_bottle_15.o" endseg beginseg name "object_tk" compress romalign 0x1000 - include "build/baserom/object_tk.o" + number 6 + include "build/assets/objects/object_tk/object_tk.o" endseg beginseg name "object_market_obj" compress romalign 0x1000 - include "build/baserom/object_market_obj.o" + number 6 + include "build/assets/objects/object_market_obj/object_market_obj.o" endseg beginseg name "object_gi_reserve00" compress romalign 0x1000 - include "build/baserom/object_gi_reserve00.o" + number 6 + include "build/assets/objects/object_gi_reserve00/object_gi_reserve00.o" endseg beginseg name "object_gi_reserve01" compress romalign 0x1000 - include "build/baserom/object_gi_reserve01.o" + number 6 + include "build/assets/objects/object_gi_reserve01/object_gi_reserve01.o" endseg beginseg name "object_lightblock" compress romalign 0x1000 - include "build/baserom/object_lightblock.o" + number 6 + include "build/assets/objects/object_lightblock/object_lightblock.o" endseg beginseg name "object_takaraya_objects" compress romalign 0x1000 - include "build/baserom/object_takaraya_objects.o" + number 6 + include "build/assets/objects/object_takaraya_objects/object_takaraya_objects.o" endseg beginseg name "object_wdhand" compress romalign 0x1000 - include "build/baserom/object_wdhand.o" + number 6 + include "build/assets/objects/object_wdhand/object_wdhand.o" endseg beginseg name "object_sdn" compress romalign 0x1000 - include "build/baserom/object_sdn.o" + number 6 + include "build/assets/objects/object_sdn/object_sdn.o" endseg beginseg name "object_snowwd" compress romalign 0x1000 - include "build/baserom/object_snowwd.o" + number 6 + include "build/assets/objects/object_snowwd/object_snowwd.o" endseg beginseg name "object_giant" compress romalign 0x1000 - include "build/baserom/object_giant.o" + number 6 + include "build/assets/objects/object_giant/object_giant.o" endseg beginseg name "object_comb" compress romalign 0x1000 - include "build/baserom/object_comb.o" + number 6 + include "build/assets/objects/object_comb/object_comb.o" endseg beginseg name "object_hana" compress romalign 0x1000 - include "build/baserom/object_hana.o" + number 6 + include "build/assets/objects/object_hana/object_hana.o" endseg beginseg name "object_boss_hakugin" compress romalign 0x1000 - include "build/baserom/object_boss_hakugin.o" + number 6 + include "build/assets/objects/object_boss_hakugin/object_boss_hakugin.o" endseg beginseg name "object_meganeana_obj" compress romalign 0x1000 - include "build/baserom/object_meganeana_obj.o" + number 6 + include "build/assets/objects/object_meganeana_obj/object_meganeana_obj.o" endseg beginseg name "object_gi_nutsmask" compress romalign 0x1000 - include "build/baserom/object_gi_nutsmask.o" + number 6 + include "build/assets/objects/object_gi_nutsmask/object_gi_nutsmask.o" endseg beginseg name "object_stk2" compress romalign 0x1000 - include "build/baserom/object_stk2.o" + number 6 + include "build/assets/objects/object_stk2/object_stk2.o" endseg beginseg name "object_spot11_obj" compress romalign 0x1000 - include "build/baserom/object_spot11_obj.o" + number 6 + include "build/assets/objects/object_spot11_obj/object_spot11_obj.o" endseg beginseg name "object_danpei_object" compress romalign 0x1000 - include "build/baserom/object_danpei_object.o" + number 6 + include "build/assets/objects/object_danpei_object/object_danpei_object.o" endseg beginseg name "object_dhouse" compress romalign 0x1000 - include "build/baserom/object_dhouse.o" + number 6 + include "build/assets/objects/object_dhouse/object_dhouse.o" endseg beginseg name "object_hakaisi" compress romalign 0x1000 - include "build/baserom/object_hakaisi.o" + number 6 + include "build/assets/objects/object_hakaisi/object_hakaisi.o" endseg beginseg name "object_po" compress romalign 0x1000 - include "build/baserom/object_po.o" + number 6 + include "build/assets/objects/object_po/object_po.o" endseg beginseg name "object_snowman" compress romalign 0x1000 - include "build/baserom/object_snowman.o" + number 6 + include "build/assets/objects/object_snowman/object_snowman.o" endseg beginseg name "object_po_sisters" compress romalign 0x1000 - include "build/baserom/object_po_sisters.o" + number 6 + include "build/assets/objects/object_po_sisters/object_po_sisters.o" endseg beginseg name "object_pp" compress romalign 0x1000 - include "build/baserom/object_pp.o" + number 6 + include "build/assets/objects/object_pp/object_pp.o" endseg beginseg name "object_goronswitch" compress romalign 0x1000 - include "build/baserom/object_goronswitch.o" + number 6 + include "build/assets/objects/object_goronswitch/object_goronswitch.o" endseg beginseg name "object_delf" compress romalign 0x1000 - include "build/baserom/object_delf.o" + number 6 + include "build/assets/objects/object_delf/object_delf.o" endseg beginseg name "object_botihasira" compress romalign 0x1000 - include "build/baserom/object_botihasira.o" + number 6 + include "build/assets/objects/object_botihasira/object_botihasira.o" endseg beginseg name "object_gi_bigbomb" compress romalign 0x1000 - include "build/baserom/object_gi_bigbomb.o" + number 6 + include "build/assets/objects/object_gi_bigbomb/object_gi_bigbomb.o" endseg beginseg name "object_pst" compress romalign 0x1000 - include "build/baserom/object_pst.o" + number 6 + include "build/assets/objects/object_pst/object_pst.o" endseg beginseg name "object_bsmask" compress romalign 0x1000 - include "build/baserom/object_bsmask.o" + number 6 + include "build/assets/objects/object_bsmask/object_bsmask.o" endseg beginseg name "object_spidertent" compress romalign 0x1000 - include "build/baserom/object_spidertent.o" + number 6 + include "build/assets/objects/object_spidertent/object_spidertent.o" endseg beginseg name "object_zoraegg" compress romalign 0x1000 - include "build/baserom/object_zoraegg.o" + number 6 + include "build/assets/objects/object_zoraegg/object_zoraegg.o" endseg beginseg name "object_kbt" compress romalign 0x1000 - include "build/baserom/object_kbt.o" + number 6 + include "build/assets/objects/object_kbt/object_kbt.o" endseg beginseg name "object_gg" compress romalign 0x1000 - include "build/baserom/object_gg.o" + number 6 + include "build/assets/objects/object_gg/object_gg.o" endseg beginseg name "object_maruta" compress romalign 0x1000 - include "build/baserom/object_maruta.o" + number 6 + include "build/assets/objects/object_maruta/object_maruta.o" endseg beginseg name "object_ghaka" compress romalign 0x1000 - include "build/baserom/object_ghaka.o" + number 6 + include "build/assets/objects/object_ghaka/object_ghaka.o" endseg beginseg name "object_oyu" compress romalign 0x1000 - include "build/baserom/object_oyu.o" + number 6 + include "build/assets/objects/object_oyu/object_oyu.o" endseg beginseg name "object_dnp" compress romalign 0x1000 - include "build/baserom/object_dnp.o" + number 6 + include "build/assets/objects/object_dnp/object_dnp.o" endseg beginseg name "object_dai" compress romalign 0x1000 - include "build/baserom/object_dai.o" + number 6 + include "build/assets/objects/object_dai/object_dai.o" endseg beginseg name "object_kgy" compress romalign 0x1000 - include "build/baserom/object_kgy.o" + number 6 + include "build/assets/objects/object_kgy/object_kgy.o" endseg beginseg name "object_fb" compress romalign 0x1000 - include "build/baserom/object_fb.o" + number 6 + include "build/assets/objects/object_fb/object_fb.o" endseg beginseg name "object_taisou" compress romalign 0x1000 - include "build/baserom/object_taisou.o" + number 6 + include "build/assets/objects/object_taisou/object_taisou.o" endseg beginseg name "object_gk" compress romalign 0x1000 - include "build/baserom/object_gk.o" + number 6 + include "build/assets/objects/object_gk/object_gk.o" endseg beginseg name "object_haka_obj" compress romalign 0x1000 - include "build/baserom/object_haka_obj.o" + number 6 + include "build/assets/objects/object_haka_obj/object_haka_obj.o" endseg beginseg name "object_dnt" compress romalign 0x1000 - include "build/baserom/object_dnt.o" + number 6 + include "build/assets/objects/object_dnt/object_dnt.o" endseg beginseg name "object_yukiyama" compress romalign 0x1000 - include "build/baserom/object_yukiyama.o" + number 6 + include "build/assets/objects/object_yukiyama/object_yukiyama.o" endseg beginseg name "object_icefloe" compress romalign 0x1000 - include "build/baserom/object_icefloe.o" + number 6 + include "build/assets/objects/object_icefloe/object_icefloe.o" endseg beginseg name "object_gi_gold_dust" compress romalign 0x1000 - include "build/baserom/object_gi_gold_dust.o" + number 6 + include "build/assets/objects/object_gi_gold_dust/object_gi_gold_dust.o" endseg beginseg name "object_gi_bottle_16" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_16.o" + number 6 + include "build/assets/objects/object_gi_bottle_16/object_gi_bottle_16.o" endseg beginseg name "object_gi_bottle_22" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_22.o" + number 6 + include "build/assets/objects/object_gi_bottle_22/object_gi_bottle_22.o" endseg beginseg name "object_bee" compress romalign 0x1000 - include "build/baserom/object_bee.o" + number 6 + include "build/assets/objects/object_bee/object_bee.o" endseg beginseg name "object_ot" compress romalign 0x1000 - include "build/baserom/object_ot.o" + number 6 + include "build/assets/objects/object_ot/object_ot.o" endseg beginseg name "object_utubo" compress romalign 0x1000 - include "build/baserom/object_utubo.o" + number 6 + include "build/assets/objects/object_utubo/object_utubo.o" endseg beginseg name "object_dora" compress romalign 0x1000 - include "build/baserom/object_dora.o" + number 6 + include "build/assets/objects/object_dora/object_dora.o" endseg beginseg name "object_gi_loach" compress romalign 0x1000 - include "build/baserom/object_gi_loach.o" + number 6 + include "build/assets/objects/object_gi_loach/object_gi_loach.o" endseg beginseg name "object_gi_seahorse" compress romalign 0x1000 - include "build/baserom/object_gi_seahorse.o" + number 6 + include "build/assets/objects/object_gi_seahorse/object_gi_seahorse.o" endseg beginseg name "object_bigpo" compress romalign 0x1000 - include "build/baserom/object_bigpo.o" + number 6 + include "build/assets/objects/object_bigpo/object_bigpo.o" endseg beginseg name "object_hariko" compress romalign 0x1000 - include "build/baserom/object_hariko.o" + number 6 + include "build/assets/objects/object_hariko/object_hariko.o" endseg beginseg name "object_dno" compress romalign 0x1000 - include "build/baserom/object_dno.o" + number 6 + include "build/assets/objects/object_dno/object_dno.o" endseg beginseg name "object_sinkai_kabe" compress romalign 0x1000 - include "build/baserom/object_sinkai_kabe.o" + number 6 + include "build/assets/objects/object_sinkai_kabe/object_sinkai_kabe.o" endseg beginseg name "object_kin2_obj" compress romalign 0x1000 - include "build/baserom/object_kin2_obj.o" + number 6 + include "build/assets/objects/object_kin2_obj/object_kin2_obj.o" endseg beginseg name "object_ishi" compress romalign 0x1000 - include "build/baserom/object_ishi.o" + number 6 + include "build/assets/objects/object_ishi/object_ishi.o" endseg beginseg name "object_hakugin_demo" compress romalign 0x1000 - include "build/baserom/object_hakugin_demo.o" + number 6 + include "build/assets/objects/object_hakugin_demo/object_hakugin_demo.o" endseg beginseg name "object_jg" compress romalign 0x1000 - include "build/baserom/object_jg.o" + number 6 + include "build/assets/objects/object_jg/object_jg.o" endseg beginseg name "object_gi_sword_2" compress romalign 0x1000 - include "build/baserom/object_gi_sword_2.o" + number 6 + include "build/assets/objects/object_gi_sword_2/object_gi_sword_2.o" endseg beginseg name "object_gi_sword_3" compress romalign 0x1000 - include "build/baserom/object_gi_sword_3.o" + number 6 + include "build/assets/objects/object_gi_sword_3/object_gi_sword_3.o" endseg beginseg name "object_gi_sword_4" compress romalign 0x1000 - include "build/baserom/object_gi_sword_4.o" + number 6 + include "build/assets/objects/object_gi_sword_4/object_gi_sword_4.o" endseg beginseg name "object_um" compress romalign 0x1000 - include "build/baserom/object_um.o" + number 6 + include "build/assets/objects/object_um/object_um.o" endseg beginseg name "object_rb" compress romalign 0x1000 - include "build/baserom/object_rb.o" + number 6 + include "build/assets/objects/object_rb/object_rb.o" endseg beginseg name "object_mbar_obj" compress romalign 0x1000 - include "build/baserom/object_mbar_obj.o" + number 6 + include "build/assets/objects/object_mbar_obj/object_mbar_obj.o" endseg beginseg name "object_ikana_obj" compress romalign 0x1000 - include "build/baserom/object_ikana_obj.o" + number 6 + include "build/assets/objects/object_ikana_obj/object_ikana_obj.o" endseg beginseg name "object_kz" compress romalign 0x1000 - include "build/baserom/object_kz.o" + number 6 + include "build/assets/objects/object_kz/object_kz.o" endseg beginseg name "object_tokei_turret" compress romalign 0x1000 - include "build/baserom/object_tokei_turret.o" + number 6 + include "build/assets/objects/object_tokei_turret/object_tokei_turret.o" endseg beginseg name "object_zog" compress romalign 0x1000 - include "build/baserom/object_zog.o" + number 6 + include "build/assets/objects/object_zog/object_zog.o" endseg beginseg name "object_rotlift" compress romalign 0x1000 - include "build/baserom/object_rotlift.o" + number 6 + include "build/assets/objects/object_rotlift/object_rotlift.o" endseg beginseg name "object_posthouse_obj" compress romalign 0x1000 - include "build/baserom/object_posthouse_obj.o" + number 6 + include "build/assets/objects/object_posthouse_obj/object_posthouse_obj.o" endseg beginseg name "object_gi_mask09" compress romalign 0x1000 - include "build/baserom/object_gi_mask09.o" + number 6 + include "build/assets/objects/object_gi_mask09/object_gi_mask09.o" endseg beginseg name "object_gi_mask14" compress romalign 0x1000 - include "build/baserom/object_gi_mask14.o" + number 6 + include "build/assets/objects/object_gi_mask14/object_gi_mask14.o" endseg beginseg name "object_gi_mask15" compress romalign 0x1000 - include "build/baserom/object_gi_mask15.o" + number 6 + include "build/assets/objects/object_gi_mask15/object_gi_mask15.o" endseg beginseg name "object_inibs_object" compress romalign 0x1000 - include "build/baserom/object_inibs_object.o" + number 6 + include "build/assets/objects/object_inibs_object/object_inibs_object.o" endseg beginseg name "object_tree" compress romalign 0x1000 - include "build/baserom/object_tree.o" + number 6 + include "build/assets/objects/object_tree/object_tree.o" endseg beginseg name "object_kaizoku_obj" compress romalign 0x1000 - include "build/baserom/object_kaizoku_obj.o" + number 6 + include "build/assets/objects/object_kaizoku_obj/object_kaizoku_obj.o" endseg beginseg name "object_gi_reserve_b_00" compress romalign 0x1000 - include "build/baserom/object_gi_reserve_b_00.o" + number 6 + include "build/assets/objects/object_gi_reserve_b_00/object_gi_reserve_b_00.o" endseg beginseg name "object_gi_reserve_c_00" compress romalign 0x1000 - include "build/baserom/object_gi_reserve_c_00.o" + number 6 + include "build/assets/objects/object_gi_reserve_c_00/object_gi_reserve_c_00.o" endseg beginseg name "object_zob" compress romalign 0x1000 - include "build/baserom/object_zob.o" + number 6 + include "build/assets/objects/object_zob/object_zob.o" endseg beginseg name "object_milkbar" compress romalign 0x1000 - include "build/baserom/object_milkbar.o" + number 6 + include "build/assets/objects/object_milkbar/object_milkbar.o" endseg beginseg name "object_dmask" compress romalign 0x1000 - include "build/baserom/object_dmask.o" + number 6 + include "build/assets/objects/object_dmask/object_dmask.o" endseg beginseg name "object_gi_reserve_c_01" compress romalign 0x1000 - include "build/baserom/object_gi_reserve_c_01.o" + number 6 + include "build/assets/objects/object_gi_reserve_c_01/object_gi_reserve_c_01.o" endseg beginseg name "object_zod" compress romalign 0x1000 - include "build/baserom/object_zod.o" + number 6 + include "build/assets/objects/object_zod/object_zod.o" endseg beginseg name "object_kumo30" compress romalign 0x1000 - include "build/baserom/object_kumo30.o" + number 6 + include "build/assets/objects/object_kumo30/object_kumo30.o" endseg beginseg name "object_obj_yasi" compress romalign 0x1000 - include "build/baserom/object_obj_yasi.o" + number 6 + include "build/assets/objects/object_obj_yasi/object_obj_yasi.o" endseg beginseg name "object_tanron1" compress romalign 0x1000 - include "build/baserom/object_tanron1.o" + number 6 + include "build/assets/objects/object_tanron1/object_tanron1.o" endseg beginseg name "object_tanron2" compress romalign 0x1000 - include "build/baserom/object_tanron2.o" + number 6 + include "build/assets/objects/object_tanron2/object_tanron2.o" endseg beginseg name "object_tanron3" compress romalign 0x1000 - include "build/baserom/object_tanron3.o" + number 6 + include "build/assets/objects/object_tanron3/object_tanron3.o" endseg beginseg name "object_gi_magicmushroom" compress romalign 0x1000 - include "build/baserom/object_gi_magicmushroom.o" + number 6 + include "build/assets/objects/object_gi_magicmushroom/object_gi_magicmushroom.o" endseg beginseg name "object_obj_chan" compress romalign 0x1000 - include "build/baserom/object_obj_chan.o" + number 6 + include "build/assets/objects/object_obj_chan/object_obj_chan.o" endseg beginseg name "object_gi_mask10" compress romalign 0x1000 - include "build/baserom/object_gi_mask10.o" + number 6 + include "build/assets/objects/object_gi_mask10/object_gi_mask10.o" endseg beginseg name "object_zos" compress romalign 0x1000 - include "build/baserom/object_zos.o" + number 6 + include "build/assets/objects/object_zos/object_zos.o" endseg beginseg name "object_an2" compress romalign 0x1000 - include "build/baserom/object_an2.o" + number 6 + include "build/assets/objects/object_an2/object_an2.o" endseg beginseg name "object_an3" compress romalign 0x1000 - include "build/baserom/object_an3.o" + number 6 + include "build/assets/objects/object_an3/object_an3.o" endseg beginseg name "object_f40_switch" compress romalign 0x1000 - include "build/baserom/object_f40_switch.o" + number 6 + include "build/assets/objects/object_f40_switch/object_f40_switch.o" endseg beginseg name "object_lodmoon" compress romalign 0x1000 - include "build/baserom/object_lodmoon.o" + number 6 + include "build/assets/objects/object_lodmoon/object_lodmoon.o" endseg beginseg name "object_tro" compress romalign 0x1000 - include "build/baserom/object_tro.o" + number 6 + include "build/assets/objects/object_tro/object_tro.o" endseg beginseg name "object_gi_mask12" compress romalign 0x1000 - include "build/baserom/object_gi_mask12.o" + number 6 + include "build/assets/objects/object_gi_mask12/object_gi_mask12.o" endseg beginseg name "object_gi_mask23" compress romalign 0x1000 - include "build/baserom/object_gi_mask23.o" + number 6 + include "build/assets/objects/object_gi_mask23/object_gi_mask23.o" endseg beginseg name "object_gi_bottle_21" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_21.o" + number 6 + include "build/assets/objects/object_gi_bottle_21/object_gi_bottle_21.o" endseg beginseg name "object_gi_camera" compress romalign 0x1000 - include "build/baserom/object_gi_camera.o" + number 6 + include "build/assets/objects/object_gi_camera/object_gi_camera.o" endseg beginseg name "object_kamejima" compress romalign 0x1000 - include "build/baserom/object_kamejima.o" + number 6 + include "build/assets/objects/object_kamejima/object_kamejima.o" endseg beginseg name "object_nb" compress romalign 0x1000 - include "build/baserom/object_nb.o" + number 6 + include "build/assets/objects/object_nb/object_nb.o" endseg beginseg name "object_harfgibud" compress romalign 0x1000 - include "build/baserom/object_harfgibud.o" + number 6 + include "build/assets/objects/object_harfgibud/object_harfgibud.o" endseg beginseg name "object_zov" compress romalign 0x1000 - include "build/baserom/object_zov.o" + number 6 + include "build/assets/objects/object_zov/object_zov.o" endseg beginseg name "object_ah" compress romalign 0x1000 - include "build/baserom/object_ah.o" + number 6 + include "build/assets/objects/object_ah/object_ah.o" endseg beginseg name "object_hgdoor" compress romalign 0x1000 - include "build/baserom/object_hgdoor.o" + number 6 + include "build/assets/objects/object_hgdoor/object_hgdoor.o" endseg beginseg name "object_dor01" compress romalign 0x1000 - include "build/baserom/object_dor01.o" + number 6 + include "build/assets/objects/object_dor01/object_dor01.o" endseg beginseg name "object_dor02" compress romalign 0x1000 - include "build/baserom/object_dor02.o" + number 6 + include "build/assets/objects/object_dor02/object_dor02.o" endseg beginseg name "object_dor03" compress romalign 0x1000 - include "build/baserom/object_dor03.o" + number 6 + include "build/assets/objects/object_dor03/object_dor03.o" endseg beginseg name "object_dor04" compress romalign 0x1000 - include "build/baserom/object_dor04.o" + number 6 + include "build/assets/objects/object_dor04/object_dor04.o" endseg beginseg name "object_last_obj" compress romalign 0x1000 - include "build/baserom/object_last_obj.o" + number 6 + include "build/assets/objects/object_last_obj/object_last_obj.o" endseg beginseg name "object_redead_obj" compress romalign 0x1000 - include "build/baserom/object_redead_obj.o" + number 6 + include "build/assets/objects/object_redead_obj/object_redead_obj.o" endseg beginseg name "object_ikninside_obj" compress romalign 0x1000 - include "build/baserom/object_ikninside_obj.o" + number 6 + include "build/assets/objects/object_ikninside_obj/object_ikninside_obj.o" endseg beginseg name "object_iknv_obj" compress romalign 0x1000 - include "build/baserom/object_iknv_obj.o" + number 6 + include "build/assets/objects/object_iknv_obj/object_iknv_obj.o" endseg beginseg name "object_pamera" compress romalign 0x1000 - include "build/baserom/object_pamera.o" + number 6 + include "build/assets/objects/object_pamera/object_pamera.o" endseg beginseg name "object_hsstump" compress romalign 0x1000 - include "build/baserom/object_hsstump.o" + number 6 + include "build/assets/objects/object_hsstump/object_hsstump.o" endseg beginseg name "object_zm" compress romalign 0x1000 - include "build/baserom/object_zm.o" + number 6 + include "build/assets/objects/object_zm/object_zm.o" endseg beginseg name "object_al" compress romalign 0x1000 - include "build/baserom/object_al.o" + number 6 + include "build/assets/objects/object_al/object_al.o" endseg beginseg name "object_tab" compress romalign 0x1000 - include "build/baserom/object_tab.o" + number 6 + include "build/assets/objects/object_tab/object_tab.o" endseg beginseg name "object_secom_obj" compress romalign 0x1000 - include "build/baserom/object_secom_obj.o" + number 6 + include "build/assets/objects/object_secom_obj/object_secom_obj.o" endseg beginseg name "object_dt" compress romalign 0x1000 - include "build/baserom/object_dt.o" + number 6 + include "build/assets/objects/object_dt/object_dt.o" endseg beginseg name "object_gi_mask03" compress romalign 0x1000 - include "build/baserom/object_gi_mask03.o" + number 6 + include "build/assets/objects/object_gi_mask03/object_gi_mask03.o" endseg beginseg name "object_cha" compress romalign 0x1000 - include "build/baserom/object_cha.o" + number 6 + include "build/assets/objects/object_cha/object_cha.o" endseg beginseg name "object_obj_dinner" compress romalign 0x1000 - include "build/baserom/object_obj_dinner.o" + number 6 + include "build/assets/objects/object_obj_dinner/object_obj_dinner.o" endseg beginseg name "object_gi_reserve_b_01" compress romalign 0x1000 - include "build/baserom/object_gi_reserve_b_01.o" + number 6 + include "build/assets/objects/object_gi_reserve_b_01/object_gi_reserve_b_01.o" endseg beginseg name "object_lastday" compress romalign 0x1000 - include "build/baserom/object_lastday.o" + number 6 + include "build/assets/objects/object_lastday/object_lastday.o" endseg beginseg name "object_bai" compress romalign 0x1000 - include "build/baserom/object_bai.o" + number 6 + include "build/assets/objects/object_bai/object_bai.o" endseg beginseg name "object_ikn_demo" compress romalign 0x1000 - include "build/baserom/object_ikn_demo.o" + number 6 + include "build/assets/objects/object_ikn_demo/object_ikn_demo.o" endseg beginseg name "object_gi_fieldmap" compress romalign 0x1000 - include "build/baserom/object_gi_fieldmap.o" + number 6 + include "build/assets/objects/object_gi_fieldmap/object_gi_fieldmap.o" endseg beginseg name "object_big_fwall" compress romalign 0x1000 - include "build/baserom/object_big_fwall.o" + number 6 + include "build/assets/objects/object_big_fwall/object_big_fwall.o" endseg beginseg name "object_hunsui" compress romalign 0x1000 - include "build/baserom/object_hunsui.o" + number 6 + include "build/assets/objects/object_hunsui/object_hunsui.o" endseg beginseg name "object_uch" compress romalign 0x1000 - include "build/baserom/object_uch.o" + number 6 + include "build/assets/objects/object_uch/object_uch.o" endseg beginseg name "object_tanron4" compress romalign 0x1000 - include "build/baserom/object_tanron4.o" + number 6 + include "build/assets/objects/object_tanron4/object_tanron4.o" endseg beginseg name "object_tanron5" compress romalign 0x1000 - include "build/baserom/object_tanron5.o" + number 6 + include "build/assets/objects/object_tanron5/object_tanron5.o" endseg beginseg name "object_in2" compress romalign 0x1000 - include "build/baserom/object_in2.o" + number 6 + include "build/assets/objects/object_in2/object_in2.o" endseg beginseg name "object_yb" compress romalign 0x1000 - include "build/baserom/object_yb.o" + number 6 + include "build/assets/objects/object_yb/object_yb.o" endseg beginseg name "object_rz" compress romalign 0x1000 - include "build/baserom/object_rz.o" + number 6 + include "build/assets/objects/object_rz/object_rz.o" endseg beginseg name "object_bjt" compress romalign 0x1000 - include "build/baserom/object_bjt.o" + number 6 + include "build/assets/objects/object_bjt/object_bjt.o" endseg beginseg name "object_taru" compress romalign 0x1000 - include "build/baserom/object_taru.o" + number 6 + include "build/assets/objects/object_taru/object_taru.o" endseg beginseg name "object_moonston" compress romalign 0x1000 - include "build/baserom/object_moonston.o" + number 6 + include "build/assets/objects/object_moonston/object_moonston.o" endseg beginseg name "object_gi_schedule" compress romalign 0x1000 - include "build/baserom/object_gi_schedule.o" + number 6 + include "build/assets/objects/object_gi_schedule/object_gi_schedule.o" endseg beginseg name "object_gi_stonemask" compress romalign 0x1000 - include "build/baserom/object_gi_stonemask.o" + number 6 + include "build/assets/objects/object_gi_stonemask/object_gi_stonemask.o" endseg beginseg name "object_zoraband" compress romalign 0x1000 - include "build/baserom/object_zoraband.o" + number 6 + include "build/assets/objects/object_zoraband/object_zoraband.o" endseg beginseg name "object_kepn_koya" compress romalign 0x1000 - include "build/baserom/object_kepn_koya.o" + number 6 + include "build/assets/objects/object_kepn_koya/object_kepn_koya.o" endseg beginseg name "object_obj_usiyane" compress romalign 0x1000 - include "build/baserom/object_obj_usiyane.o" + number 6 + include "build/assets/objects/object_obj_usiyane/object_obj_usiyane.o" endseg beginseg name "object_gi_mask05" compress romalign 0x1000 - include "build/baserom/object_gi_mask05.o" + number 6 + include "build/assets/objects/object_gi_mask05/object_gi_mask05.o" endseg beginseg name "object_gi_mask11" compress romalign 0x1000 - include "build/baserom/object_gi_mask11.o" + number 6 + include "build/assets/objects/object_gi_mask11/object_gi_mask11.o" endseg beginseg name "object_gi_mask20" compress romalign 0x1000 - include "build/baserom/object_gi_mask20.o" + number 6 + include "build/assets/objects/object_gi_mask20/object_gi_mask20.o" endseg beginseg name "object_nnh" compress romalign 0x1000 - include "build/baserom/object_nnh.o" + number 6 + include "build/assets/objects/object_nnh/object_nnh.o" endseg beginseg name "object_kzsaku" compress romalign 0x1000 - include "build/baserom/object_kzsaku.o" + number 6 + include "build/assets/objects/object_kzsaku/object_kzsaku.o" endseg beginseg name "object_obj_milk_bin" compress romalign 0x1000 - include "build/baserom/object_obj_milk_bin.o" + number 6 + include "build/assets/objects/object_obj_milk_bin/object_obj_milk_bin.o" endseg beginseg name "object_random_obj" compress romalign 0x1000 - include "build/baserom/object_random_obj.o" + number 6 + include "build/assets/objects/object_random_obj/object_random_obj.o" endseg beginseg name "object_kujiya" compress romalign 0x1000 - include "build/baserom/object_kujiya.o" + number 6 + include "build/assets/objects/object_kujiya/object_kujiya.o" endseg beginseg name "object_kitan" compress romalign 0x1000 - include "build/baserom/object_kitan.o" + number 6 + include "build/assets/objects/object_kitan/object_kitan.o" endseg beginseg name "object_gi_mask06" compress romalign 0x1000 - include "build/baserom/object_gi_mask06.o" + number 6 + include "build/assets/objects/object_gi_mask06/object_gi_mask06.o" endseg beginseg name "object_gi_mask16" compress romalign 0x1000 - include "build/baserom/object_gi_mask16.o" + number 6 + include "build/assets/objects/object_gi_mask16/object_gi_mask16.o" endseg beginseg name "object_astr_obj" compress romalign 0x1000 - include "build/baserom/object_astr_obj.o" + number 6 + include "build/assets/objects/object_astr_obj/object_astr_obj.o" endseg beginseg name "object_bsb" compress romalign 0x1000 - include "build/baserom/object_bsb.o" + number 6 + include "build/assets/objects/object_bsb/object_bsb.o" endseg beginseg name "object_fall2" compress romalign 0x1000 - include "build/baserom/object_fall2.o" + number 6 + include "build/assets/objects/object_fall2/object_fall2.o" endseg beginseg name "object_sth" compress romalign 0x1000 - include "build/baserom/object_sth.o" + number 6 + include "build/assets/objects/object_sth/object_sth.o" endseg beginseg name "object_gi_mssa" compress romalign 0x1000 - include "build/baserom/object_gi_mssa.o" + number 6 + include "build/assets/objects/object_gi_mssa/object_gi_mssa.o" endseg beginseg name "object_smtower" compress romalign 0x1000 - include "build/baserom/object_smtower.o" + number 6 + include "build/assets/objects/object_smtower/object_smtower.o" endseg beginseg name "object_gi_mask21" compress romalign 0x1000 - include "build/baserom/object_gi_mask21.o" + number 6 + include "build/assets/objects/object_gi_mask21/object_gi_mask21.o" endseg beginseg name "object_yado_obj" compress romalign 0x1000 - include "build/baserom/object_yado_obj.o" + number 6 + include "build/assets/objects/object_yado_obj/object_yado_obj.o" endseg beginseg name "object_syoten" compress romalign 0x1000 - include "build/baserom/object_syoten.o" + number 6 + include "build/assets/objects/object_syoten/object_syoten.o" endseg beginseg name "object_moonend" compress romalign 0x1000 - include "build/baserom/object_moonend.o" + number 6 + include "build/assets/objects/object_moonend/object_moonend.o" endseg beginseg name "object_ob" compress romalign 0x1000 - include "build/baserom/object_ob.o" + number 6 + include "build/assets/objects/object_ob/object_ob.o" endseg beginseg name "object_gi_bottle_04" compress romalign 0x1000 - include "build/baserom/object_gi_bottle_04.o" + number 6 + include "build/assets/objects/object_gi_bottle_04/object_gi_bottle_04.o" endseg beginseg name "object_and" compress romalign 0x1000 - include "build/baserom/object_and.o" + number 6 + include "build/assets/objects/object_and/object_and.o" endseg beginseg name "object_obj_danpeilift" compress romalign 0x1000 - include "build/baserom/object_obj_danpeilift.o" + number 6 + include "build/assets/objects/object_obj_danpeilift/object_obj_danpeilift.o" endseg beginseg name "object_drs" compress romalign 0x1000 - include "build/baserom/object_drs.o" + number 6 + include "build/assets/objects/object_drs/object_drs.o" endseg beginseg name "object_msmo" compress romalign 0x1000 - include "build/baserom/object_msmo.o" + number 6 + include "build/assets/objects/object_msmo/object_msmo.o" endseg beginseg name "object_an4" compress romalign 0x1000 - include "build/baserom/object_an4.o" + number 6 + include "build/assets/objects/object_an4/object_an4.o" endseg beginseg name "object_wdor01" compress romalign 0x1000 - include "build/baserom/object_wdor01.o" + number 6 + include "build/assets/objects/object_wdor01/object_wdor01.o" endseg beginseg name "object_wdor02" compress romalign 0x1000 - include "build/baserom/object_wdor02.o" + number 6 + include "build/assets/objects/object_wdor02/object_wdor02.o" endseg beginseg name "object_wdor03" compress romalign 0x1000 - include "build/baserom/object_wdor03.o" + number 6 + include "build/assets/objects/object_wdor03/object_wdor03.o" endseg beginseg name "object_wdor04" compress romalign 0x1000 - include "build/baserom/object_wdor04.o" + number 6 + include "build/assets/objects/object_wdor04/object_wdor04.o" endseg beginseg name "object_wdor05" compress romalign 0x1000 - include "build/baserom/object_wdor05.o" + number 6 + include "build/assets/objects/object_wdor05/object_wdor05.o" endseg beginseg name "object_stk3" compress romalign 0x1000 - include "build/baserom/object_stk3.o" + number 6 + include "build/assets/objects/object_stk3/object_stk3.o" endseg beginseg name "object_kinsta1_obj" compress romalign 0x1000 - include "build/baserom/object_kinsta1_obj.o" + number 6 + include "build/assets/objects/object_kinsta1_obj/object_kinsta1_obj.o" endseg beginseg name "object_kinsta2_obj" compress romalign 0x1000 - include "build/baserom/object_kinsta2_obj.o" + number 6 + include "build/assets/objects/object_kinsta2_obj/object_kinsta2_obj.o" endseg beginseg name "object_bh" compress romalign 0x1000 - include "build/baserom/object_bh.o" + number 6 + include "build/assets/objects/object_bh/object_bh.o" endseg beginseg name "object_gi_mask17" compress romalign 0x1000 - include "build/baserom/object_gi_mask17.o" + number 6 + include "build/assets/objects/object_gi_mask17/object_gi_mask17.o" endseg beginseg name "object_gi_mask22" compress romalign 0x1000 - include "build/baserom/object_gi_mask22.o" + number 6 + include "build/assets/objects/object_gi_mask22/object_gi_mask22.o" endseg beginseg name "object_lbfshot" compress romalign 0x1000 - include "build/baserom/object_lbfshot.o" + number 6 + include "build/assets/objects/object_lbfshot/object_lbfshot.o" endseg beginseg name "object_fusen" compress romalign 0x1000 - include "build/baserom/object_fusen.o" + number 6 + include "build/assets/objects/object_fusen/object_fusen.o" endseg beginseg name "object_ending_obj" compress romalign 0x1000 - include "build/baserom/object_ending_obj.o" + number 6 + include "build/assets/objects/object_ending_obj/object_ending_obj.o" endseg beginseg name "object_gi_mask13" compress romalign 0x1000 - include "build/baserom/object_gi_mask13.o" + number 6 + include "build/assets/objects/object_gi_mask13/object_gi_mask13.o" endseg beginseg @@ -8839,7 +9294,7 @@ beginseg name "nintendo_rogo_static" compress romalign 0x1000 - include "build/assets/static/nintendo_rogo_static/nintendo_rogo_static.o" + include "build/assets/misc/nintendo_rogo_static/nintendo_rogo_static.o" number 1 endseg @@ -8883,7 +9338,7 @@ beginseg name "daytelop_static" compress romalign 0x1000 - include "build/assets/static/daytelop_static/daytelop_static.o" + include "build/assets/misc/daytelop_static/daytelop_static.o" number 9 endseg @@ -8891,7 +9346,7 @@ beginseg name "ger_daytelop_static" compress romalign 0x1000 - include "build/assets/static/ger_daytelop_static/ger_daytelop_static.o" + include "build/assets/misc/ger_daytelop_static/ger_daytelop_static.o" number 9 endseg @@ -8899,7 +9354,7 @@ beginseg name "fra_daytelop_static" compress romalign 0x1000 - include "build/assets/static/fra_daytelop_static/fra_daytelop_static.o" + include "build/assets/misc/fra_daytelop_static/fra_daytelop_static.o" number 9 endseg @@ -8907,7 +9362,7 @@ beginseg name "esp_daytelop_static" compress romalign 0x1000 - include "build/assets/static/esp_daytelop_static/esp_daytelop_static.o" + include "build/assets/misc/esp_daytelop_static/esp_daytelop_static.o" number 9 endseg diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index c5af62f825..1f55034453 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -796,7 +796,7 @@ void Fault_ThreadEntry(void* arg) { osSetEventMesg(12, &sFaultContext->queue, (OSMesg)2); while (1) { do { - osRecvMesg(&sFaultContext->queue, &msg, 1); + osRecvMesg(&sFaultContext->queue, &msg, OS_MESG_BLOCK); if (msg == (OSMesg)1) { sFaultContext->msgId = 1; @@ -887,7 +887,7 @@ void Fault_Start(void) { sFaultContext->clients = NULL; sFaultContext->faultActive = 0; gFaultStruct.faultHandlerEnabled = 1; - osCreateMesgQueue(&sFaultContext->queue, sFaultContext->msg, 1); + osCreateMesgQueue(&sFaultContext->queue, sFaultContext->msg, ARRAY_COUNT(sFaultContext->msg)); StackCheck_Init(&sFaultThreadInfo, sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault"); osCreateThread(&sFaultContext->thread, 2, Fault_ThreadEntry, NULL, sFaultStack + sizeof(sFaultStack), 0x7F); osStartThread(&sFaultContext->thread); diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 7a1d636431..2a52e7dcec 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "prevent_bss_reordering.h" u8 D_80096B20 = 1; vu8 gViConfigUseDefault = 1; @@ -63,7 +64,7 @@ void Idle_InitCodeAndMemory(void) { SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &queue, 0); Idle_InitScreen(); Idle_InitMemory(); - osRecvMesg(&queue, NULL, 1); + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); sDmaMgrDmaBuffSize = oldSize; diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index 3f4ca04aed..f605dc3270 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -17,10 +17,10 @@ void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* param_2, OSMesgQueue* param_ osSetIntMask(saveMask); if (irqmgr->prenmiStage > 0) { - osSendMesg(param_2->queue, &irqmgr->prenmiMsg.type, 0); + osSendMesg(param_2->queue, &irqmgr->prenmiMsg.type, OS_MESG_NOBLOCK); } if (irqmgr->prenmiStage > 1) { - osSendMesg(param_2->queue, &irqmgr->nmiMsg.type, 0); + osSendMesg(param_2->queue, &irqmgr->nmiMsg.type, OS_MESG_NOBLOCK); } } @@ -54,7 +54,7 @@ void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg) { IrqMgrClient* iter = irqmgr->callbacks; while (iter != NULL) { - osSendMesg(iter->queue, msg, 0); + osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK); iter = iter->next; } } @@ -64,7 +64,7 @@ void IrqMgr_JamMesgForClient(IrqMgr* irqmgr, OSMesg msg) { while (iter != NULL) { if (iter->queue->validCount < iter->queue->msgCount) { - osSendMesg(iter->queue, msg, 0); + osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK); } iter = iter->next; } @@ -130,7 +130,7 @@ void IrqMgr_ThreadEntry(IrqMgr* irqmgr) { ; } - osRecvMesg(&irqmgr->irqQueue, (OSMesg*)&interrupt, 1); + osRecvMesg(&irqmgr->irqQueue, (OSMesg*)&interrupt, OS_MESG_BLOCK); switch (interrupt) { case 0x29A: IrqMgr_HandleRetrace(irqmgr); @@ -159,7 +159,7 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) { irqmgr->prenmiStage = 0; irqmgr->lastPrenmiTime = 0; - osCreateMesgQueue(&irqmgr->irqQueue, (OSMesg*)irqmgr->irqBuffer, 8); + osCreateMesgQueue(&irqmgr->irqQueue, (OSMesg*)irqmgr->irqBuffer, ARRAY_COUNT(irqmgr->irqBuffer)); osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D); osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount); diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 25fc8fbb08..ebf3909249 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -31,7 +31,7 @@ s32 DmaMgr_DMARomToRam(uintptr_t rom, void* ram, size_t size) { goto END; } - osRecvMesg(&queue, NULL, 1); + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); size -= buffSize; rom = rom + buffSize; ram = (u8*)ram + buffSize; @@ -47,7 +47,7 @@ s32 DmaMgr_DMARomToRam(uintptr_t rom, void* ram, size_t size) { goto END; } - osRecvMesg(&queue, NULL, 1); + osRecvMesg(&queue, NULL, OS_MESG_BLOCK); osInvalDCache(ram, size); diff --git a/src/buffers/gfxpools.c b/src/buffers/gfxpools.c new file mode 100644 index 0000000000..a91c87bed9 --- /dev/null +++ b/src/buffers/gfxpools.c @@ -0,0 +1,3 @@ +#include "global.h" + +GfxPool gGfxPools[2]; diff --git a/src/buffers/gfxstack.c b/src/buffers/gfxstack.c new file mode 100644 index 0000000000..2b158d1414 --- /dev/null +++ b/src/buffers/gfxstack.c @@ -0,0 +1,3 @@ +#include "global.h" + +u8 gGfxSPTaskStack[0x400]; diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxyield.c similarity index 56% rename from src/buffers/gfxbuffers.c rename to src/buffers/gfxyield.c index ed0d12b6c2..73810d4acd 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxyield.c @@ -1,7 +1,3 @@ #include "global.h" u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; - -u8 gGfxSPTaskStack[0x400]; - -GfxPool gGfxPools[2]; diff --git a/src/code/audio/audio_init_params.c b/src/code/audio/audio_init_params.c new file mode 100644 index 0000000000..4e6ef9dfbb --- /dev/null +++ b/src/code/audio/audio_init_params.c @@ -0,0 +1,12 @@ +#include "global.h" + +const s16 gAudioTatumInit[] = { + 0x1C00, // unused + 0x30, // gTatumsPerBeat +}; + +const AudioContextInitSizes gAudioContextInitSizes = { + 0x137F00, // heapSize + 0x1C480, // initPoolSize + 0x1A000, // permanentPoolSize +}; diff --git a/src/code/code_800F07C0.c b/src/code/code_800F07C0.c deleted file mode 100644 index 9255dcfcbf..0000000000 --- a/src/code/code_800F07C0.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F07C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0888.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0944.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F09B4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0A20.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0A94.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0BB4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0CE4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0DD4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0E94.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0EEC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0F28.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0FF0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F10AC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F112C.s") diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 3bd5aac928..34ad973f6d 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -45,7 +45,7 @@ void* gItemIcons[] = { 0x08007000, // ITEM_BOMBCHU 0x08008000, // ITEM_STICK 0x08009000, // ITEM_NUT - 0x0800A000, // ITEM_BEAN + 0x0800A000, // ITEM_MAGIC_BEANS 0x0800B000, // ITEM_SLINGSHOT 0x0800C000, // ITEM_POWDER_KEG 0x0800D000, // ITEM_PICTO_BOX @@ -82,7 +82,7 @@ void* gItemIcons[] = { 0x0802C000, // ITEM_DEED_OCEAN 0x0802D000, // ITEM_ROOM_KEY 0x0802E000, // ITEM_LETTER_MAMA - 0x0802F000, // ITEM_LETTER_KAFEI + 0x0802F000, // ITEM_LETTER_TO_KAFEI 0x08030000, // ITEM_PENDANT_MEMORIES 0x08031000, // ITEM_TINGLE_MAP 0x08032000, // ITEM_MASK_DEKU @@ -90,7 +90,7 @@ void* gItemIcons[] = { 0x08034000, // ITEM_MASK_ZORA 0x08035000, // ITEM_MASK_FIERCE_DEITY 0x08036000, // ITEM_MASK_TRUTH - 0x08037000, // ITEM_MASK_KAFEI + 0x08037000, // ITEM_MASK_KAFEIS_MASK 0x08038000, // ITEM_MASK_ALL_NIGHT 0x08039000, // ITEM_MASK_BUNNY 0x0803A000, // ITEM_MASK_KEATON @@ -180,7 +180,7 @@ u8 gItemSlots[] = { SLOT_BOMBCHU, // ITEM_BOMBCHU SLOT_STICK, // ITEM_STICK SLOT_NUT, // ITEM_NUT - SLOT_BEAN, // ITEM_BEAN + SLOT_MAGIC_BEANS, // ITEM_MAGIC_BEANS SLOT_TRADE_KEY_MAMA, // ITEM_SLINGSHOT SLOT_POWDER_KEG, // ITEM_POWDER_KEG SLOT_PICTO_BOX, // ITEM_PICTO_BOX @@ -217,7 +217,7 @@ u8 gItemSlots[] = { SLOT_TRADE_DEED, // ITEM_DEED_OCEAN SLOT_TRADE_KEY_MAMA, // ITEM_ROOM_KEY SLOT_TRADE_KEY_MAMA, // ITEM_LETTER_MAMA - SLOT_TRADE_COUPLE, // ITEM_LETTER_KAFEI + SLOT_TRADE_COUPLE, // ITEM_LETTER_TO_KAFEI SLOT_TRADE_COUPLE, // ITEM_PENDANT_MEMORIES SLOT_TRADE_COUPLE, // ITEM_TINGLE_MAP SLOT_MASK_DEKU, // ITEM_MASK_DEKU @@ -225,7 +225,7 @@ u8 gItemSlots[] = { SLOT_MASK_ZORA, // ITEM_MASK_ZORA SLOT_MASK_FIERCE_DEITY, // ITEM_MASK_FIERCE_DEITY SLOT_MASK_TRUTH, // ITEM_MASK_TRUTH - SLOT_MASK_KAFEI, // ITEM_MASK_KAFEI + SLOT_MASK_KAFEIS_MASK, // ITEM_MASK_KAFEIS_MASK SLOT_MASK_ALL_NIGHT, // ITEM_MASK_ALL_NIGHT SLOT_MASK_BUNNY, // ITEM_MASK_BUNNY SLOT_MASK_KEATON, // ITEM_MASK_KEATON @@ -260,7 +260,7 @@ s16 gItemPrices[] = { 0, // ITEM_BOMBCHU 0, // ITEM_STICK 0, // ITEM_NUT - 0, // ITEM_BEAN + 0, // ITEM_MAGIC_BEANS 0, // ITEM_SLINGSHOT 0, // ITEM_POWDER_KEG 0, // ITEM_PICTO_BOX diff --git a/src/code/sys_initial_check.c b/src/code/sys_initial_check.c index 84871255b8..ec61d07b56 100644 --- a/src/code/sys_initial_check.c +++ b/src/code/sys_initial_check.c @@ -10,8 +10,16 @@ #include "misc/locerrmsg/locerrmsg.h" #include "misc/memerrmsg/memerrmsg.h" -#define SIZEOF_LOCERRMSG (sizeof(gNotDesignedForSystemErrorTex)) -#define SIZEOF_MEMERRMSG (sizeof(gExpansionPakNotInstalledErrorTex) + sizeof(gSeeInstructionBookletErrorTex)) +#define LOCERRMSG_WIDTH 208 +#define LOCERRMSG_HEIGHT 16 +#define NUMBEROF_LOCERRMSGS 1 + +#define MEMERRMSG_WIDTH 128 +#define MEMERRMSG_HEIGHT 37 +#define NUMBEROF_MEMERRMSGS 2 + +#define SIZEOF_LOCERRMSG (LOCERRMSG_WIDTH * LOCERRMSG_HEIGHT / 2 * NUMBEROF_LOCERRMSGS) +#define SIZEOF_MEMERRMSG (MEMERRMSG_WIDTH * MEMERRMSG_HEIGHT / 2 * NUMBEROF_MEMERRMSGS) // Address with enough room after to load either of the error message image files before the fault screen buffer at the // end of RDRAM @@ -64,9 +72,9 @@ void Check_ClearRGBA16(u16* buffer) { void Check_DrawExpansionPakErrorMessage(void) { DmaMgr_SendRequest0(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(memerrmsg), SEGMENT_SIZE(memerrmsg)); Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS); - Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 71, 128, 37, CHECK_ERRMSG_STATIC_SEGMENT); - Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 127, 128, 37, - CHECK_ERRMSG_STATIC_SEGMENT + sizeof(gExpansionPakNotInstalledErrorTex)); + Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 71, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT, CHECK_ERRMSG_STATIC_SEGMENT); + Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 96, 127, MEMERRMSG_WIDTH, MEMERRMSG_HEIGHT, + CHECK_ERRMSG_STATIC_SEGMENT + MEMERRMSG_WIDTH * MEMERRMSG_HEIGHT / 2); osWritebackDCacheAll(); osViSwapBuffer((u16*)FAULT_FB_ADDRESS); osViBlack(false); @@ -78,7 +86,8 @@ void Check_DrawExpansionPakErrorMessage(void) { void Check_DrawRegionLockErrorMessage(void) { DmaMgr_SendRequest0(CHECK_ERRMSG_STATIC_SEGMENT, SEGMENT_ROM_START(locerrmsg), SEGMENT_SIZE(locerrmsg)); Check_ClearRGBA16((u16*)FAULT_FB_ADDRESS); - Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 56, 112, 208, 16, CHECK_ERRMSG_STATIC_SEGMENT); + Check_DrawI4Texture((u16*)FAULT_FB_ADDRESS, 56, 112, LOCERRMSG_WIDTH, LOCERRMSG_HEIGHT, + CHECK_ERRMSG_STATIC_SEGMENT); osWritebackDCacheAll(); osViSwapBuffer((u16*)FAULT_FB_ADDRESS); osViBlack(false); diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c index a832f9d386..9bde9e6df3 100644 --- a/src/code/sys_ucode.c +++ b/src/code/sys_ucode.c @@ -1,9 +1,27 @@ +/* + * File: sys_ucode.c + * Description: Functions for obtaining locations and sizes of microcode + */ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBoot.s") +extern u64 rspbootTextStart[]; +extern u64 rspbootTextEnd[]; -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeBootSize.s") +u64* initialgspUcodeText = gspF3DEX2_NoN_fifoTextStart; +u64* initialgspUcodeData = gspF3DEX2_NoN_fifoDataStart; -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCode.s") +u64* SysUcode_GetUCodeBoot(void) { + return rspbootTextStart; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_ucode/SysUcode_GetUCodeData.s") +size_t SysUcode_GetUCodeBootSize(void) { + return (uintptr_t)rspbootTextEnd - (uintptr_t)rspbootTextStart; +} + +u64* SysUcode_GetUCode(void) { + return initialgspUcodeText; +} + +u64* SysUcode_GetUCodeData(void) { + return initialgspUcodeData; +} diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index 2fe6b79778..a62d4ddb9e 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -68,10 +68,10 @@ void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalCo func_8012C6FC(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); - Matrix_InsertTranslation(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, 0); - Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, 1); - Matrix_InsertMatrix(&globalCtx->mf_187FC, 1); - Matrix_InsertRotation(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, 1); + Matrix_InsertTranslation(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW); + Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_InsertRotation(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, 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); @@ -95,7 +95,7 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContex gSPSetLights1(POLY_XLU_DISP++, sDebugDisplayLight1); Matrix_SetStateRotationAndTranslation(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); - Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, 1); + Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, arg1); diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index f293c81c2f..6deeb79434 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -48,7 +48,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur scale = this->rgScale * 0.0025f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, scale); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_187FC, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSegments[0x06] = PHYSICAL_TO_VIRTUAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); diff --git a/src/code/z_en_hy.c b/src/code/z_en_hy.c new file mode 100644 index 0000000000..73adc5fa58 --- /dev/null +++ b/src/code/z_en_hy.c @@ -0,0 +1,271 @@ +/* + * File: z_en_hy.c + * Description: Unused System for NPCs (includes animation, door interaction, blinking, pathing, and collider helpers) + */ + +#include "global.h" +#include "overlays/actors/ovl_En_Door/z_en_door.h" + +extern AnimationHeader D_0600007C; +extern AnimationHeader D_0600066C; +extern AnimationHeader D_0600071C; +extern AnimationHeader D_060008C0; +extern AnimationHeader D_06000AB0; +extern AnimationHeader D_06000FDC; +extern AnimationHeader D_06001494; +extern AnimationHeader D_06001908; +extern AnimationHeader D_06001EE0; +extern AnimationHeader D_06005DC4; +extern AnimationHeader D_06005D9C; +extern AnimationHeader D_0600DED8; +extern AnimationHeader D_0600F920; +extern AnimationHeader D_0600FC1C; +extern AnimationHeader D_0600FEE4; +extern AnimationHeader D_06010330; + +static ActorAnimationEntryS animations[] = { + { &D_0600007C, 1.0f, 0, -1, 0, 0 }, { &D_06001494, 1.0f, 0, -1, 0, 0 }, { &D_06001494, 1.0f, 0, -1, 0, -8 }, + { &D_06001908, 1.0f, 0, -1, 0, 0 }, { &D_06001908, 1.0f, 0, -1, 0, -8 }, { &D_060008C0, 1.0f, 0, -1, 0, 0 }, + { &D_06005DC4, 1.0f, 0, -1, 0, 0 }, { &D_06000FDC, 1.0f, 0, -1, 0, 0 }, { &D_06000AB0, 1.0f, 0, -1, 0, -8 }, + { &D_0600066C, 1.0f, 0, -1, 0, 0 }, { &D_0600071C, 1.0f, 0, -1, 0, 0 }, { &D_06001EE0, 1.0f, 0, -1, 0, 0 }, + { &D_0600DED8, 1.5f, 0, -1, 2, 0 }, { &D_0600F920, 1.5f, 0, -1, 2, 0 }, { &D_0600FC1C, 1.0f, 0, -1, 0, 0 }, + { &D_0600FEE4, 1.0f, 0, -1, 0, 0 }, { &D_06010330, 1.0f, 0, -1, 0, 0 }, { &D_0600FC1C, 1.0f, 0, -1, 0, -8 }, + { &D_0600FEE4, 1.0f, 0, -1, 0, -8 }, { &D_06010330, 1.0f, 0, -1, 0, -8 }, { &D_06005D9C, 1.0f, 0, -1, 0, -8 }, +}; + +s8 D_801BC3F0[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2 }; + +s8 D_801BC400[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, 0 }; + +u8 D_801BC410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { + s16 frameCount; + s32 isChanged = false; + + if (animIndex >= 0 && animIndex <= 20) { + isChanged = true; + frameCount = animations[animIndex].frameCount; + if (frameCount < 0) { + frameCount = Animation_GetLastFrame(&animations[animIndex].animationSeg->common); + } + Animation_Change(skelAnime, animations[animIndex].animationSeg, animations[animIndex].playbackSpeed, + animations[animIndex].frame, frameCount, animations[animIndex].mode, + animations[animIndex].transitionRate); + } + return isChanged; +} + +//! @TODO: Return Door instance when c and h files are split +Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) { + Actor* nearestDoor = NULL; + Actor* doorIter = NULL; + Actor* door; + f32 dist; + s32 isSetup = false; + f32 minDist = 0.0f; + + do { + doorIter = func_ActorCategoryIterateById(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); + door = doorIter; + dist = Actor_DistanceBetweenActors(actor, door); + if (!isSetup || (dist < minDist)) { + nearestDoor = door; + minDist = dist; + isSetup = true; + } + doorIter = door->next; + } while (doorIter != NULL); + + if (1) {} + + return nearestDoor; +} + +void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment); + EnHy_ChangeAnim(&enHy->skelAnime, animIndex); +} + +s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx) { + s32 isUpdated = false; + + if (enHy->actor.draw != NULL) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment); + SkelAnime_Update(&enHy->skelAnime); + isUpdated = true; + } + return isUpdated; +} + +void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) { + if (DECR(enHy->blinkTimer) == 0) { + enHy->eyeTexIndex++; + if (enHy->eyeTexIndex >= eyeTexMaxIndex) { + enHy->eyeTexIndex = 0; + enHy->blinkTimer = Rand_S16Offset(30, 30); + } + } +} + +s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) { + s32 isInitialized = false; + + if ((func_8013D8DC(enHy->animObjIndex, globalCtx) == 1) && (func_8013D8DC(enHy->unk190, globalCtx) == 1) && + (func_8013D8DC(enHy->unk191, globalCtx) == 1) && (func_8013D8DC(enHy->unk192, globalCtx) == 1)) { + enHy->actor.objBankIndex = enHy->unk192; + isInitialized = true; + ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f); + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->actor.objBankIndex].segment); + SkelAnime_InitFlex(globalCtx, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable, + 16); + EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); + } + return isInitialized; +} + +//! @TODO: Should just take EnDoor instead of actor when c and h are split +void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, Actor* door, s16 arg3, s16 arg4) { + s32 pad; + s8 sp3B; + Vec3f offset; + f32 phi_f0; + + Actor_CalcOffsetOrientedToDrawRotation(door, &offset, &enHy->actor.world.pos); + phi_f0 = (offset.z >= 0.0f) ? 1.0f : -1.0f; + sp3B = ((s8)phi_f0 < 0) ? 0 : 2; + EnHy_ChangeObjectAndAnim(enHy, globalCtx, (sp3B == 0) ? arg3 : arg4); + enHy->skelAnime.baseTransl = *enHy->skelAnime.jointTable; + enHy->skelAnime.prevTransl = *enHy->skelAnime.jointTable; + enHy->skelAnime.moveFlags |= 3; + AnimationContext_SetMoveActor(globalCtx, &enHy->actor, &enHy->skelAnime, 1.0f); + ((EnDoor*)door)->unk_1A1 = 1; + ((EnDoor*)door)->unk_1A0 = sp3B; +} + +s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) { + s32 ret = false; + s16 yaw; + Actor* door; + s32 pad; + + if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) { + door = EnHy_FindNearestDoor(&enHy->actor, globalCtx); + if (door != NULL) { + ret = true; + func_800F0BB4(enHy, globalCtx, door, arg3, arg4); + yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->world.pos); + enHy->actor.world.pos.x += arg5 * Math_SinS(yaw); + enHy->actor.world.pos.z += arg5 * Math_CosS(yaw); + enHy->actor.world.rot.y = -yaw; + enHy->actor.shape.rot.y = -yaw; + enHy->actor.draw = draw; + } + } + return ret; +} + +s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) { + s32 ret = false; + s32 pad; + Actor* door; + + enHy->curPoint = 0; + if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) { + door = EnHy_FindNearestDoor(&enHy->actor, globalCtx); + if (door != NULL) { + ret = true; + func_800F0BB4(enHy, globalCtx, door, arg2, arg3); + enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->world.pos); + enHy->actor.world.rot.y = enHy->actor.shape.rot.y; + enHy->actor.gravity = 0.0f; + enHy->actor.flags &= ~1; + } + } + return ret; +} + +s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex) { + enHy->actor.gravity = gravity; + enHy->actor.flags |= 1; + EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); + enHy->curPoint++; + return 0; +} + +s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) { + EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); + enHy->curPoint--; + return 0; +} + +s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) { + s16 rotStep; + s32 reachedEnd = false; + Vec3f curPointPos; + + Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = enHy->actor.speedXZ * 400.0f; + if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) { + enHy->curPoint++; + if (enHy->curPoint >= enHy->path->count) { + reachedEnd = true; + } + } + return reachedEnd; +} + +s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) { + s16 rotStep; + s32 reachedEnd = false; + Vec3f curPointPos; + + Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = enHy->actor.speedXZ * 400.0f; + if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) { + enHy->curPoint--; + if (enHy->curPoint < 0) { + reachedEnd = true; + } + } + return reachedEnd; +} + +void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx) { + enHy->collider.dim.pos.x = enHy->actor.world.pos.x; + enHy->collider.dim.pos.y = enHy->actor.world.pos.y; + enHy->collider.dim.pos.z = enHy->actor.world.pos.z; + + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base); +} + +s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThreshold) { + u8 wasLeftFootOnGround = enHy->isLeftFootOnGround; + u8 wasRightFootOnGround = enHy->isRightFootOnGround; + s32 waterSfxId; + u16 sfxId; + u8 isFootOnGround; + + if (enHy->actor.bgCheckFlags & 0x20) { + if (enHy->actor.depthInWater < 20.0f) { + waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + } else { + waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + } + sfxId = waterSfxId + SFX_FLAG; + } else { + sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG; + } + + enHy->isLeftFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->leftFootPos, distAboveThreshold); + if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) { + Audio_PlayActorSound2(&enHy->actor, sfxId); + } + + enHy->isRightFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->rightFootPos, distAboveThreshold); + if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) { + Audio_PlayActorSound2(&enHy->actor, sfxId); + } + return 0; +} diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c index a6a6da5b39..d54561fdd5 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -3,7 +3,7 @@ /** * Indices of the columns of this array: * - index 0x00: PLAYER_MASK_TRUTH - * - index 0x01: PLAYER_MASK_KAFEI + * - index 0x01: PLAYER_MASK_KAFEIS_MASK * - index 0x02: PLAYER_MASK_ALL_NIGHT * - index 0x03: PLAYER_MASK_BUNNY * - index 0x04: PLAYER_MASK_KEATON diff --git a/src/code/z_lights.c b/src/code/z_lights.c index fb88fbc773..4d649da2d7 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -131,7 +131,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global posF.x = params->point.x; posF.y = params->point.y; posF.z = params->point.z; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->projectionMatrix, &posF, &adjustedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &posF, &adjustedPos); if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) && (400 > fabsf(adjustedPos.y) - radiusF)) { light = Lights_FindSlot(lights); diff --git a/src/code/z_pause.c b/src/code/z_pause.c index 44be6238af..bb5b33cf2f 100644 --- a/src/code/z_pause.c +++ b/src/code/z_pause.c @@ -1,5 +1,39 @@ +/* + * File: z_pause.c + * Description: Frame Advance debug feature + * + * This allows you to advance through the game one frame at a time on command. + * To advance a frame, hold Z and press R on the specified controller (see z_play). + * Holding Z and R will advance a frame every half second. + * + * Note: While the system is fully hooked up, there is no way to enable it in game + * Instead one would have to add something like: + * + * if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + * frameAdvCtx->enabled = !frameAdvCtx->enabled; + * } + * + * to the start of FrameAdvance_Update, which would allow the system to be toggled on and off by holding R + * and pressing Dpad Down on the specified controller. + * + * Note2: Controllers 2-4's inputs are normally zeroed out, so this would also need to be fixed to use frame advance + */ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122660.s") +void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { + frameAdvCtx->timer = 0; + frameAdvCtx->enabled = false; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122670.s") +/* + * Returns true when frame advance is not active (game will run normally) + */ +s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { + if (!frameAdvCtx->enabled || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && + (CHECK_BTN_ALL(input->press.button, BTN_R) || + (CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) { + frameAdvCtx->timer = 0; + return true; + } + return false; +} diff --git a/src/code/z_play.c b/src/code/z_play.c index 8f15c577a2..7e0e018c74 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -52,7 +52,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167F0C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80168090.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Draw.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80168DAC.s") diff --git a/src/code/z_view.c b/src/code/z_view.c index c325fd5637..da2e3593b3 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -259,11 +259,11 @@ s32 View_StepQuake(View* view, Mtx* matrix) { Matrix_FromRSPMatrix(matrix, &mf); Matrix_SetCurrentState(&mf); Matrix_RotateStateAroundXAxis(view->currQuakeRot.x); - Matrix_InsertYRotation_f(view->currQuakeRot.y, 1); - Matrix_InsertZRotation_f(view->currQuakeRot.z, 1); + Matrix_InsertYRotation_f(view->currQuakeRot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_f(view->currQuakeRot.z, MTXMODE_APPLY); Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, MTXMODE_APPLY); - Matrix_InsertZRotation_f(-view->currQuakeRot.z, 1); - Matrix_InsertYRotation_f(-view->currQuakeRot.y, 1); + Matrix_InsertZRotation_f(-view->currQuakeRot.z, MTXMODE_APPLY); + Matrix_InsertYRotation_f(-view->currQuakeRot.y, MTXMODE_APPLY); Matrix_RotateStateAroundXAxis(-view->currQuakeRot.x); Matrix_ToMtx(matrix); diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 9e949beac9..29d1a1acad 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -103,7 +103,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); if (globalCtx->envCtx.unk_11 == 0) { @@ -120,7 +120,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); size = SEGMENT_ROM_SIZE(d2_fine_pal_static); @@ -129,7 +129,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL); - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); } } @@ -140,7 +140,7 @@ void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) func_801431E8(gameState, skyboxCtx, skyType); if (skyType != 0) { - skyboxCtx->unk17C = THA_AllocEndAlign16(&gameState->heap, 0x3840); + skyboxCtx->dListBuf = THA_AllocEndAlign16(&gameState->heap, 0x3840); if (skyType == 5) { // Allocate enough space for the vertices for a 6 sided skybox (cube) diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index 27142c944a..d7f99eed9d 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -1,9 +1,67 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_801435A0.s") +Mtx* sSkyboxDrawMatrix; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143624.s") +Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) { + Matrix_InsertTranslation(x, y, z, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateStateAroundXAxis(skyboxCtx->rotX); + Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY); + Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY); + return Matrix_ToMtx(sSkyboxDrawMatrix); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143668.s") +void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { + skyboxCtx->primR = primR; + skyboxCtx->primG = primG; + skyboxCtx->primB = primB; + skyboxCtx->envR = envR; + skyboxCtx->envG = envG; + skyboxCtx->envB = envB; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_80143A04.s") +void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) { + OPEN_DISPS(gfxCtx); + + func_8012C6AC(gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x0B, skyboxCtx->skyboxPaletteStaticSegment); + gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON); + + sSkyboxDrawMatrix = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); + + Matrix_InsertTranslation(x, y, z, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateStateAroundXAxis(skyboxCtx->rotX); + Matrix_InsertYRotation_f(skyboxCtx->rotY, MTXMODE_APPLY); + Matrix_InsertZRotation_f(skyboxCtx->rotZ, MTXMODE_APPLY); + Matrix_ToMtx(sSkyboxDrawMatrix); + + gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetColorDither(POLY_OPA_DISP++, G_CD_MAGICSQ); + gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP); + gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->skyboxPaletteStaticSegment); + gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_RGBA16); + gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT); + gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, TEXEL0, PRIMITIVE_ALPHA, TEXEL0, TEXEL1, TEXEL0, PRIMITIVE, TEXEL0, + PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, skyboxCtx->primR, skyboxCtx->primG, skyboxCtx->primB, blend); + gDPSetEnvColor(POLY_OPA_DISP++, skyboxCtx->envR, skyboxCtx->envG, skyboxCtx->envB, 0); + + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[0]); + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[300]); + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[600]); + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[900]); + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[1200]); + + if (skyboxId == SKYBOX_CUTSCENE_MAP) { + gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[1500]); + } + + gDPPipeSync(POLY_OPA_DISP++); + + CLOSE_DISPS(gfxCtx); +} + +void SkyboxDraw_Noop(SkyboxContext* skyboxCtx) { +} diff --git a/src/libultra/io/contquery.c b/src/libultra/io/contquery.c index 7cb681fdeb..a9a944f54b 100644 --- a/src/libultra/io/contquery.c +++ b/src/libultra/io/contquery.c @@ -7,11 +7,11 @@ s32 osContStartQuery(OSMesgQueue* mq) { if (__osContLastPoll != 0) { __osPackRequestData(0); - __osSiRawStartDma(1, &__osContPifRam); + __osSiRawStartDma(OS_WRITE, &__osContPifRam); osRecvMesg(mq, NULL, OS_MESG_BLOCK); } - ret = __osSiRawStartDma(0, &__osContPifRam); + ret = __osSiRawStartDma(OS_READ, &__osContPifRam); __osContLastPoll = 0; diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 0017a42226..47b7968d38 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -8,11 +8,11 @@ s32 osContStartReadData(OSMesgQueue* mq) { if (__osContLastPoll != 1) { __osPackReadData(); - __osSiRawStartDma(1, &__osContPifRam); - osRecvMesg(mq, NULL, 1); + __osSiRawStartDma(OS_WRITE, &__osContPifRam); + osRecvMesg(mq, NULL, OS_MESG_BLOCK); } - ret = __osSiRawStartDma(0, &__osContPifRam); + ret = __osSiRawStartDma(OS_READ, &__osContPifRam); __osContLastPoll = 1; __osSiRelAccess(); diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index a048575a72..d84ba2d711 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -34,16 +34,16 @@ s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) { __osPackRequestData(0); - ret = __osSiRawStartDma(1, &__osContPifRam); - osRecvMesg(mq, &dummy, 1); + ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam); + osRecvMesg(mq, &dummy, OS_MESG_BLOCK); - ret = __osSiRawStartDma(0, &__osContPifRam); - osRecvMesg(mq, &dummy, 1); + ret = __osSiRawStartDma(OS_READ, &__osContPifRam); + osRecvMesg(mq, &dummy, OS_MESG_BLOCK); __osContGetInitData(bitpattern, data); __osContLastPoll = 0; __osSiCreateAccessQueue(); - osCreateMesgQueue(&D_8009CF38, D_8009CF50, 1); + osCreateMesgQueue(&D_8009CF38, D_8009CF50, ARRAY_COUNT(D_8009CF50)); return ret; } diff --git a/src/libultra/io/epidma.c b/src/libultra/io/epidma.c index d3e0e36d2f..0b8c847d6a 100644 --- a/src/libultra/io/epidma.c +++ b/src/libultra/io/epidma.c @@ -16,9 +16,9 @@ s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { } if (mb->hdr.pri == 1) { - result = osJamMesg(osPiGetCmdQueue(), mb, 0); + result = osJamMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); } else { - result = osSendMesg(osPiGetCmdQueue(), mb, 0); + result = osSendMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); } return result; } diff --git a/src/libultra/io/piacs.c b/src/libultra/io/piacs.c index 8e6f830c0f..532b149e23 100644 --- a/src/libultra/io/piacs.c +++ b/src/libultra/io/piacs.c @@ -7,8 +7,8 @@ OSMesgQueue __osPiAccessQueue; void __osPiCreateAccessQueue(void) { __osPiAccessQueueEnabled = 1; - osCreateMesgQueue(&__osPiAccessQueue, D_8009E3F0, 1); - osSendMesg(&__osPiAccessQueue, NULL, 0); + osCreateMesgQueue(&__osPiAccessQueue, D_8009E3F0, ARRAY_COUNT(D_8009E3F0)); + osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); } void __osPiGetAccess(void) { diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c index 74b1075a16..3d618de746 100644 --- a/src/libultra/io/pimgr.c +++ b/src/libultra/io/pimgr.c @@ -14,7 +14,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC if (!__osPiDevMgr.active) { osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt); - osCreateMesgQueue(&D_8009E3D0, D_8009E3E8, 1); + osCreateMesgQueue(&D_8009E3D0, D_8009E3E8, ARRAY_COUNT(D_8009E3E8)); if (!__osPiAccessQueueEnabled) { __osPiCreateAccessQueue(); } diff --git a/src/libultra/io/siacs.c b/src/libultra/io/siacs.c index 590f048adf..7a221408e5 100644 --- a/src/libultra/io/siacs.c +++ b/src/libultra/io/siacs.c @@ -7,8 +7,8 @@ OSMesgQueue __osSiAccessQueue; void __osSiCreateAccessQueue() { __osSiAccessQueueEnabled = 1; - osCreateMesgQueue(&__osSiAccessQueue, siAccessBuf, 1); - osSendMesg(&__osSiAccessQueue, NULL, 0); + osCreateMesgQueue(&__osSiAccessQueue, siAccessBuf, ARRAY_COUNT(siAccessBuf)); + osSendMesg(&__osSiAccessQueue, NULL, OS_MESG_NOBLOCK); } void __osSiGetAccess(void) { @@ -16,9 +16,9 @@ void __osSiGetAccess(void) { if (!__osSiAccessQueueEnabled) { __osSiCreateAccessQueue(); } - osRecvMesg(&__osSiAccessQueue, &dummyMesg, 1); + osRecvMesg(&__osSiAccessQueue, &dummyMesg, OS_MESG_BLOCK); } void __osSiRelAccess(void) { - osSendMesg(&__osSiAccessQueue, NULL, 0); + osSendMesg(&__osSiAccessQueue, NULL, OS_MESG_NOBLOCK); } diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index 0ec16a4c3c..aeaaf0f82e 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -32,29 +32,23 @@ void osSpTaskLoad(OSTask* intp) { intp->t.flags &= ~OS_TASK_YIELDED; if (tp->t.flags & OS_TASK_LOADABLE) { - tp->t.ucode = HW_REG((u32)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4, u32); + tp->t.ucode = HW_REG((uintptr_t)intp->t.yieldDataPtr + OS_YIELD_DATA_SIZE - 4, u32); } } osWritebackDCache(tp, sizeof(OSTask)); __osSpSetStatus(SP_CLR_SIG0 | SP_CLR_SIG1 | SP_CLR_SIG2 | SP_SET_INTR_BREAK); - while (__osSpSetPc((void*)SP_IMEM_START) == -1) { - ; - } - while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) { - ; - } - while (__osSpDeviceBusy()) { - ; - } - while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucodeBoot, tp->t.ucodeBootSize) == -1) { - ; - } + while (__osSpSetPc((void*)SP_IMEM_START) == -1) {} + + while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {} + + while (__osSpDeviceBusy()) {} + + while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucodeBoot, tp->t.ucodeBootSize) == -1) {} } void osSpTaskStartGo(OSTask* tp) { - while (__osSpDeviceBusy()) { - ; - } + while (__osSpDeviceBusy()) {} + __osSpSetStatus(SP_SET_INTR_BREAK | SP_CLR_SSTEP | SP_CLR_BROKE | SP_CLR_HALT); } diff --git a/src/libultra/io/viswapcontext.c b/src/libultra/io/viswapcontext.c index 014fbbfeb7..514e3aa1df 100644 --- a/src/libultra/io/viswapcontext.c +++ b/src/libultra/io/viswapcontext.c @@ -1,3 +1,66 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/boot/viswapcontext/__osViSwapContext.s") +void __osViSwapContext(void) { + register OSViMode* viMode; + register __OSViContext* viNext; + u32 origin; + u32 hStart; + u32 vstart; + u32 sp34; + u32 field; + register u32 s2; + + field = 0; + viNext = __osViNext; + viMode = viNext->modep; + field = HW_REG(VI_V_CURRENT_LINE_REG, u32) & 1; + s2 = osVirtualToPhysical(viNext->buffer); + origin = (viMode->fldRegs[field].origin) + s2; + if (viNext->state & 2) { + viNext->x.scale |= viMode->comRegs.xScale & ~0xFFF; + } else { + viNext->x.scale = viMode->comRegs.xScale; + } + if (viNext->state & 4) { + sp34 = (u32)(viMode->fldRegs[field].yScale & 0xFFF); + viNext->y.scale = viNext->y.factor * sp34; + viNext->y.scale |= viMode->fldRegs[field].yScale & ~0xFFF; + } else { + viNext->y.scale = viMode->fldRegs[field].yScale; + } + + vstart = (viMode->fldRegs[field].vStart - (__additional_scanline << 0x10)) + __additional_scanline; + hStart = viMode->comRegs.hStart; + + if (viNext->state & 0x20) { + hStart = 0; + } + + if (viNext->state & 0x40) { + viNext->y.scale = 0; + origin = osVirtualToPhysical(viNext->buffer); + } + + if (viNext->state & 0x80) { + viNext->y.scale = (viNext->y.offset << 0x10) & 0x3FF0000; + origin = osVirtualToPhysical(viNext->buffer); + } + + HW_REG(VI_ORIGIN_REG, u32) = origin; + HW_REG(VI_WIDTH_REG, u32) = viMode->comRegs.width; + HW_REG(VI_BURST_REG, u32) = viMode->comRegs.burst; + HW_REG(VI_V_SYNC_REG, u32) = viMode->comRegs.vSync; + HW_REG(VI_H_SYNC_REG, u32) = viMode->comRegs.hSync; + HW_REG(VI_LEAP_REG, u32) = viMode->comRegs.leap; + HW_REG(VI_H_START_REG, u32) = hStart; + HW_REG(VI_V_START_REG, u32) = vstart; + HW_REG(VI_V_BURST_REG, u32) = viMode->fldRegs[field].vBurst; + HW_REG(VI_INTR_REG, u32) = viMode->fldRegs[field].vIntr; + HW_REG(VI_X_SCALE_REG, u32) = viNext->x.scale; + HW_REG(VI_Y_SCALE_REG, u32) = viNext->y.scale; + HW_REG(VI_CONTROL_REG, u32) = viNext->features; + + __osViNext = __osViCurr; + __osViCurr = viNext; + *__osViNext = *__osViCurr; +} diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index 723d1dafc6..8be2ff9e2b 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -17,7 +17,7 @@ void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) { if (e == 14) { if (__osShutdown != 0 && D_80097F10 == 0) { - osSendMesg(mq, m, 0); + osSendMesg(mq, m, OS_MESG_NOBLOCK); } D_80097F10 = 1; } diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 4c00831399..87f7129dfd 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -49,7 +49,7 @@ void __osTimerInterrupt(void) { t->next = NULL; t->prev = NULL; if (t->mq != NULL) { - osSendMesg(t->mq, t->msg, 0); + osSendMesg(t->mq, t->msg, OS_MESG_NOBLOCK); } if (t->interval != 0) { t->value = t->interval; diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index ff11631ef1..5b47f8e4ed 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -89,9 +89,9 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { flags = this->dyna.actor.flags & 0x40; rotZ = this->dyna.actor.shape.rot.z & 0x1FFF; if ((flags != 0) && (rotZ < 0x1B58) && (rotZ >= 0x1388)) { - Matrix_RotateY(this->dyna.actor.home.rot.y, 0); - Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1); - Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1); + Matrix_RotateY(this->dyna.actor.home.rot.y, MTXMODE_NEW); + Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, MTXMODE_APPLY); for (i = 0; i < 4; i++) { if ((u32)Rand_Next() >= 0x40000000) { splashOffset.x = D_80AD3270[i].x - (Rand_ZeroOne() * 30.0f); @@ -107,9 +107,9 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { } if ((rotZ < 0x1F4) && (rotZ >= 0)) { if (flags != 0) { - Matrix_RotateY(this->dyna.actor.home.rot.y, 0); - Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1); - Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1); + Matrix_RotateY(this->dyna.actor.home.rot.y, MTXMODE_NEW); + Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, MTXMODE_APPLY); for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { splashOffset.x = D_80AD32A0[i].x + (Rand_ZeroOne() * 10.0f); diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h index 5eac10d0b0..4a0e14d2fd 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h @@ -10,7 +10,7 @@ typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, GlobalContext*); typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; /* 0x0144 */ BgDyYoseizoActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x33BC]; + /* 0x0148 */ char unk_148[0x33BC]; } BgDyYoseizo; // size = 0x3504 extern const ActorInit Bg_Dy_Yoseizo_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h index 8bbcb45bfb..b4d176d9e9 100644 --- a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h +++ b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h @@ -10,7 +10,7 @@ typedef void (*BgFireWallActionFunc)(struct BgFireWall*, GlobalContext*); typedef struct BgFireWall { /* 0x0000 */ Actor actor; /* 0x0144 */ BgFireWallActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x68]; + /* 0x0148 */ char unk_148[0x68]; } BgFireWall; // size = 0x1B0 extern const ActorInit Bg_Fire_Wall_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index b0e79b3db0..e32492e9c0 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -15,7 +15,13 @@ void BgGoronOyu_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgGoronOyu_Update(Actor* thisx, GlobalContext* globalCtx); void BgGoronOyu_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx); +void func_80B400C8(BgGoronOyu* this, GlobalContext* globalCtx); +void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx); +void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx); +void BgGoronOyu_SpawnParticles(BgGoronOyu* this, GlobalContext* globalCtx); +void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx); + const ActorInit Bg_Goron_Oyu_InitVars = { ACTOR_BG_GORON_OYU, ACTORCAT_BG, @@ -28,31 +34,163 @@ const ActorInit Bg_Goron_Oyu_InitVars = { (ActorFunc)BgGoronOyu_Draw, }; -#endif +extern Gfx D_06000080; +extern Gfx D_06000158; +extern AnimatedMaterial D_06000968; +extern CollisionHeader D_06000988; -extern UNK_TYPE D_06000968; -extern UNK_TYPE D_06000988; +void func_80B40080(BgGoronOyu* this) { + this->unk_17E = 1; + this->actionFunc = func_80B400C8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B40080.s") +void func_80B4009C(BgGoronOyu* this) { + this->unk_17E = 0; + this->initialActorCutscene = this->dyna.actor.cutscene; + this->actionFunc = func_80B40100; + this->unk_164 = 20.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B4009C.s") +void func_80B400C8(BgGoronOyu* this, GlobalContext* globalCtx) { + BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); + func_80B401F8(this, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B400C8.s") +void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(this->initialActorCutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->initialActorCutscene, &this->dyna.actor); + this->actionFunc = func_80B40160; + } else { + ActorCutscene_SetIntentToPlay(this->initialActorCutscene); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B40100.s") +void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx) { + static Vec3f D_80B40780 = { 0, 0, 0 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B40160.s") + Math_StepToF(&this->unk_164, 0.0f, 0.2f); + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - this->unk_164; + BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B401F8.s") + if (this->unk_164 <= 0.0f) { + ActorCutscene_Stop(this->initialActorCutscene); + this->unk_164 = 0.0f; + func_80B40080(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B40308.s") + func_8019F1C0(&D_80B40780, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/func_80B40394.s") +void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx) { + Player* player; + Vec3f dist; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/BgGoronOyu_Init.s") + if (Actor_HasParent(&this->dyna.actor, globalCtx)) { + this->dyna.actor.parent = NULL; + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/BgGoronOyu_Destroy.s") + player = GET_PLAYER(globalCtx); + Math_Vec3f_DistXYZAndStoreDiff(&this->waterBoxPos, &player->actor.world.pos, &dist); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/BgGoronOyu_Update.s") + if (dist.x >= 0.0f && dist.x <= this->waterBoxXLength && dist.z >= 0.0f && dist.z <= this->waterBoxZLength && + fabsf(dist.y) < 100.0f && player->actor.depthInWater > 12.0f) { + func_800B8A1C(&this->dyna.actor, globalCtx, 0xBA, this->dyna.actor.xzDistToPlayer, + fabsf(this->dyna.actor.playerHeightRel)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Goron_Oyu/BgGoronOyu_Draw.s") +void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx) { + WaterBox* waterBox; + f32 ySurface; + + if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, + &ySurface, &waterBox)) { + Math_Vec3s_ToVec3f(&this->waterBoxPos, &waterBox->minPos); + this->waterBoxXLength = waterBox->xLength; + this->waterBoxZLength = waterBox->zLength; + } +} + +void BgGoronOyu_SpawnParticles(BgGoronOyu* this, GlobalContext* globalCtx) { + s16 scale; + Vec3f pos1; + Vec3f pos2; + CollisionPoly* poly; + s32 pad; + + if ((globalCtx->state.frames % 4) == 0) { + Vec3f vel1; + Vec3f vel2; + + pos1.x = this->dyna.actor.world.pos.x; + pos1.y = this->dyna.actor.world.pos.y + 100.0f; + pos1.z = this->dyna.actor.world.pos.z; + vel1.x = 0.0f; + vel1.y = 2.5f; + vel1.z = 0.0f; + scale = -200 - (s32)(Rand_ZeroOne() * 50.0f); + + if (BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos1) < this->waterBoxPos.y) { + pos1.y = this->waterBoxPos.y + 10.0f; + EffectSsIceSmoke_Spawn(globalCtx, &pos1, &vel1, &D_801D15B0, scale); + } + pos2.x = (Rand_ZeroOne() * this->waterBoxXLength) + this->waterBoxPos.x; + pos2.y = this->waterBoxPos.y + 100.0f; + pos2.z = (Rand_ZeroOne() * this->waterBoxZLength) + this->waterBoxPos.z; + vel2.x = 0.0f; + vel2.y = 0.5f; + vel2.z = 0.0f; + scale = -200 - (s32)(Rand_ZeroOne() * 50.0f); + + if (BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos2) < this->waterBoxPos.y) { + pos2.y = this->waterBoxPos.y + 10.0f; + EffectSsIceSmoke_Spawn(globalCtx, &pos2, &vel2, &D_801D15B0, scale); + } + } +} + +void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgGoronOyu* this = THIS; + CollisionHeader* colHeader = NULL; + + Actor_SetScale(&this->dyna.actor, 0.1f); + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&D_06000988, &colHeader); + + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + + BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); + + if (thisx->params != 0) { + thisx->world.pos.y = thisx->home.pos.y; + func_80B40080(this); + } else { + thisx->world.pos.y = thisx->home.pos.y - 20.0f; + func_80B4009C(this); + } +} + +void BgGoronOyu_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgGoronOyu* this = THIS; + + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} + +void BgGoronOyu_Update(Actor* thisx, GlobalContext* globalCtx) { + BgGoronOyu* this = THIS; + + this->actionFunc(this, globalCtx); + BgGoronOyu_SpawnParticles(this, globalCtx); +} + +void BgGoronOyu_Draw(Actor* thisx, GlobalContext* globalCtx) { + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_06000968)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, &D_06000158); + gSPDisplayList(POLY_XLU_DISP++, &D_06000080); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h index e60a42af28..dba8bb044a 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h @@ -8,12 +8,15 @@ struct BgGoronOyu; typedef void (*BgGoronOyuActionFunc)(struct BgGoronOyu*, GlobalContext*); typedef struct BgGoronOyu { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x18]; - /* 0x015C */ BgGoronOyuActionFunc actionFunc; - /* 0x0160 */ char unk_160[0x20]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ BgGoronOyuActionFunc actionFunc; + /* 0x160 */ UNK_TYPE unk_160; + /* 0x164 */ f32 unk_164; + /* 0x168 */ Vec3f waterBoxPos; + /* 0x174 */ f32 waterBoxXLength; + /* 0x178 */ f32 waterBoxZLength; + /* 0x17C */ s16 initialActorCutscene; + /* 0x17E */ u16 unk_17E; } BgGoronOyu; // size = 0x180 -extern const ActorInit Bg_Goron_Oyu_InitVars; - #endif // Z_BG_GORON_OYU_H diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h index e2ae361122..6fc19e4ca0 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h @@ -10,7 +10,7 @@ typedef void (*BgSpoutFireActionFunc)(struct BgSpoutFire*, GlobalContext*); typedef struct BgSpoutFire { /* 0x0000 */ Actor actor; /* 0x0144 */ BgSpoutFireActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x50]; + /* 0x0148 */ char unk_148[0x50]; } BgSpoutFire; // size = 0x198 extern const ActorInit Bg_Spout_Fire_InitVars; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 32d75abba3..03c1733153 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -680,8 +680,6 @@ void func_809DAAA8(Boss02* this, GlobalContext* globalCtx) { this->actor.world.pos.y = -500.0f; } -#ifdef NON_MATCHING -// Saving to spC8 rather than spC4 at line 18dc void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { static Color_RGBA8 D_809DFA98 = { 185, 140, 70, 255 }; s32 pad; @@ -992,15 +990,15 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { this->actor.minVelocityY = -1000.0f * D_809DF5B0; this->unk_0164 = randPlusMinusPoint5Scaled(0.05f); - spC4 = player->actor.world.pos.x - this->actor.world.pos.x; - spC8 = player->actor.world.pos.z - this->actor.world.pos.z; - if (sqrtf(SQ(spC4) + SQ(spC8)) < (400.0f * D_809DF5B0)) { + spCC = player->actor.world.pos.x - this->actor.world.pos.x; + spC4 = player->actor.world.pos.z - this->actor.world.pos.z; + if (sqrtf(SQ(spCC) + SQ(spC4)) < (400.0f * D_809DF5B0)) { this->actor.speedXZ = 15.0f * D_809DF5B0; } - spC4 = this->actor.world.pos.x; - spC8 = this->actor.world.pos.z; - if (sqrtf(SQ(spC4) + SQ(spC8)) < (400.0f * D_809DF5B0)) { + spCC = this->actor.world.pos.x; + spC4 = this->actor.world.pos.z; + if (sqrtf(SQ(spCC) + SQ(spC4)) < (400.0f * D_809DF5B0)) { this->actor.speedXZ = 15.0f * D_809DF5B0; } @@ -1051,7 +1049,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { sp9C = Rand_ZeroFloat(M_PI); for (i = 0; i < 15; i++) { - Matrix_InsertYRotation_f(((2.0f * (i * M_PI)) / 15.0f) + sp9C, 0); + Matrix_InsertYRotation_f(((2.0f * (i * M_PI)) / 15.0f) + sp9C, MTXMODE_NEW); Matrix_GetStateTranslationAndScaledZ((10 - this->unk_0146[0]) * (D_809DF5B0 * 300.0f) * 0.1f, &sp90); spD0.x = this->unk_0170.x + sp90.x; @@ -1081,10 +1079,6 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); } -#else -static Color_RGBA8 D_809DFA98 = { 185, 140, 70, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_02/func_809DAB78.s") -#endif void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { Boss02* temp_s6 = this->unk_1674; @@ -1477,7 +1471,7 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { } func_809DA50C(1, &this->colliderSphere2, &this->unk_147C[i + 1]); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->projectionMatrix, &this->unk_147C[i + 1], &this->unk_167C, + SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->unk_147C[i + 1], &this->unk_167C, &this->actor.projectedW); } else { func_809DA50C(i, &this->colliderSphere1, &this->unk_147C[i + 1]); @@ -1584,7 +1578,7 @@ void func_809DD2F8(GlobalContext* globalCtx) { (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), @@ -1625,7 +1619,7 @@ void func_809DD2F8(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)effect->unk_2C); Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), @@ -1649,7 +1643,7 @@ void func_809DD2F8(GlobalContext* globalCtx) { (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); Matrix_InsertTranslation(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, 0); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.h b/src/overlays/actors/ovl_Boss_02/z_boss_02.h index d630acb8f5..babf40b769 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.h +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.h @@ -40,7 +40,7 @@ typedef struct Boss02 { /* 0x016C */ s16 unk_016C; /* 0x0170 */ Vec3f unk_0170; /* 0x017C */ Vec3f unk_017C; - /* 0x018C */ Vec3f unk_0188; + /* 0x0188 */ Vec3f unk_0188; /* 0x0194 */ u8 unk_0194; /* 0x0195 */ u8 unk_0195; /* 0x0196 */ s16 unk_0196; @@ -53,7 +53,7 @@ typedef struct Boss02 { /* 0x01AC */ f32 unk_01AC; /* 0x01B0 */ Vec3f unk_01B0; /* 0x01BC */ Vec3f unk_01BC[200]; - /* 0x0B1c */ Vec3f unk_0B1C[200]; + /* 0x0B1C */ Vec3f unk_0B1C[200]; /* 0x147C */ Vec3f unk_147C[23]; /* 0x1590 */ SkelAnime skelAnime; /* 0x15D4 */ Vec3s jointTable[13]; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.h b/src/overlays/actors/ovl_Boss_03/z_boss_03.h index e93baca0bf..ca8a92328a 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.h +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.h @@ -9,9 +9,13 @@ typedef void (*Boss03ActionFunc)(struct Boss03*, GlobalContext*); typedef struct Boss03 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x1E4]; + /* 0x0144 */ UNK_TYPE1 unk_144[0x10E]; + /* 0x0252 */ s8 unk_252; // number of Tanron3 fish that are currently alive, maybe "numSmallFishAlive"? + /* 0x0253 */ UNK_TYPE1 unk_253[0xD1]; + /* 0x0324 */ s16 unk_324; + /* 0x0326 */ UNK_TYPE1 unk_326[0x2]; /* 0x0328 */ Boss03ActionFunc actionFunc; - /* 0x032C */ char unk_32C[0x250]; + /* 0x032C */ UNK_TYPE1 unk_32C[0x250]; } Boss03; // size = 0x57C extern const ActorInit Boss_03_InitVars; diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.h b/src/overlays/actors/ovl_Boss_07/z_boss_07.h index 21e30eb920..b8ace3f9ce 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.h +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.h @@ -10,7 +10,7 @@ typedef void (*Boss07ActionFunc)(struct Boss07*, GlobalContext*); typedef struct Boss07 { /* 0x0000 */ Actor actor; /* 0x0144 */ Boss07ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xAAD8]; + /* 0x0148 */ char unk_148[0xAAD8]; } Boss07; // size = 0xAC20 extern const ActorInit Boss_07_InitVars; diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h index 5e29a38156..3b5882692f 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h @@ -13,16 +13,16 @@ typedef struct BossHakuginParticle { /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ Vec3s unk_1C; - /* 0x22 */ f32 unk_24; + /* 0x24 */ f32 unk_24; } BossHakuginParticle; // size = 0x28 typedef struct BossHakugin { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ char unk_0144[0x44]; /* 0x0188 */ BossHakuginActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x86C]; + /* 0x018C */ char unk_018C[0x86C]; /* 0x09F8 */ BossHakuginParticle unk_9F8[180]; - /* 0x0A14 */ char unk_A04[0x2DFC]; + /* 0x2618 */ char unk_2618[0x11F8]; } BossHakugin; // size = 0x3810 extern const ActorInit Boss_Hakugin_InitVars; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 6ff4f90965..9cc359c9e6 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -588,7 +588,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { break; } - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); Matrix_InsertZRotation_f(DEGF_TO_RADF(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), @@ -659,7 +659,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, &D_04023348); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); Matrix_InsertZRotation_f(DEGF_TO_RADF(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h index 958608c653..4ce31a8a17 100644 --- a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h +++ b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h @@ -10,7 +10,7 @@ typedef void (*DmHinaActionFunc)(struct DmHina*, GlobalContext*); typedef struct DmHina { /* 0x0000 */ Actor actor; /* 0x0144 */ DmHinaActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x3C]; + /* 0x0148 */ char unk_148[0x3C]; } DmHina; // size = 0x184 extern const ActorInit Dm_Hina_InitVars; diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index bf72f3721e..296d6e429f 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -288,7 +288,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { initialPositions->z * ((this->dz * aux) + (1.0f - this->dz)), MTXMODE_APPLY); Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -345,7 +345,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h index e0418f3057..5f30ef196e 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h @@ -10,7 +10,7 @@ typedef void (*EnAob01ActionFunc)(struct EnAob01*, GlobalContext*); typedef struct EnAob01 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnAob01ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x2FC]; + /* 0x0148 */ char unk_148[0x2FC]; } EnAob01; // size = 0x444 extern const ActorInit En_Aob_01_InitVars; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.h b/src/overlays/actors/ovl_En_Az/z_en_az.h index 17b2b85fa3..89d7c1a09b 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.h +++ b/src/overlays/actors/ovl_En_Az/z_en_az.h @@ -10,7 +10,7 @@ typedef void (*EnAzActionFunc)(struct EnAz*, GlobalContext*); typedef struct EnAz { /* 0x0000 */ Actor actor; /* 0x0144 */ EnAzActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x290]; + /* 0x0148 */ char unk_148[0x290]; } EnAz; // size = 0x3D8 extern const ActorInit En_Az_InitVars; diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.h b/src/overlays/actors/ovl_En_Bat/z_en_bat.h index d1f949f441..2ccaaa8928 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.h +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.h @@ -10,7 +10,7 @@ typedef void (*EnBatActionFunc)(struct EnBat*, GlobalContext*); typedef struct EnBat { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBatActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x94]; + /* 0x0148 */ char unk_148[0x94]; } EnBat; // size = 0x1DC extern const ActorInit En_Bat_InitVars; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h index 157ac7eaf2..20416b4f9f 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h @@ -10,7 +10,7 @@ typedef void (*EnBba01ActionFunc)(struct EnBba01*, GlobalContext*); typedef struct EnBba01 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBba01ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4D4]; + /* 0x0148 */ char unk_148[0x4D4]; } EnBba01; // size = 0x61C extern const ActorInit En_Bba_01_InitVars; 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 fa8eb472fc..ee51c74444 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 @@ -144,7 +144,7 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { } break; case PLAYER_FORM_HUMAN: - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEI) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { this->textId = 0x236A; } else if (gSaveContext.weekEventReg[74] & 0x10) { this->textId = 0x5F6; diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h index 13172b1808..910ad51745 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h @@ -10,7 +10,7 @@ typedef void (*EnBomChuActionFunc)(struct EnBomChu*, GlobalContext*); typedef struct EnBomChu { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBomChuActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x98]; + /* 0x0148 */ char unk_148[0x98]; } EnBomChu; // size = 0x1E0 extern const ActorInit En_Bom_Chu_InitVars; diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h index ea538d5ce1..ce6fd67244 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -10,7 +10,7 @@ typedef void (*EnBombalActionFunc)(struct EnBombal*, GlobalContext*); typedef struct EnBombal { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBombalActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x28FC]; + /* 0x0148 */ char unk_148[0x28FC]; } EnBombal; // size = 0x2A44 extern const ActorInit En_Bombal_InitVars; 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 cb61799b9e..3c56535256 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.c +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.c @@ -54,9 +54,9 @@ void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_InsertZRotation_s(this->actor.shape.rot.z, 1); - Matrix_RotateY(this->actor.shape.rot.y, 1); - Matrix_InsertXRotation_s(this->actor.shape.rot.x, 1); + Matrix_InsertZRotation_s(this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->actor.shape.rot.x, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->displayListPtr); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h index c78b9df693..f2901b3249 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -10,7 +10,7 @@ typedef void (*EnBubbleActionFunc)(struct EnBubble*, GlobalContext*); typedef struct EnBubble { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBubbleActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x110]; + /* 0x0148 */ char unk_148[0x110]; } EnBubble; // size = 0x258 extern const ActorInit En_Bubble_InitVars; diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index 9a1280c293..d8f32613f4 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -119,6 +119,6 @@ void EnCha_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800BDFC0(globalCtx, D_06000710); Matrix_InsertTranslation(-1094.0f, 4950.0f, 9.0f, MTXMODE_APPLY); - Matrix_InsertXRotation_s(this->actor.home.rot.x, 1); + Matrix_InsertXRotation_s(this->actor.home.rot.x, MTXMODE_APPLY); func_800BDFC0(globalCtx, D_06000958); } 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 ee13a00974..f76b22296c 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 @@ -416,7 +416,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 54; i++) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); - Matrix_InsertYRotation_f(Rand_ZeroFloat(M_PI * 2), 0); + Matrix_InsertYRotation_f(Rand_ZeroFloat(M_PI * 2), MTXMODE_NEW); Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(M_PI * 2)); Matrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel); accel.x = vel.x * -0.03f; @@ -489,7 +489,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { pos = this->actor.world.pos; for (i = 0; i < 44; i++) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); - Matrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), 0); + Matrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI)); Matrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel); accel.x = vel.x * -0.03f; @@ -871,7 +871,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 5, 32, 64, 1, 0, 0, 32, 32)); Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(effect->smokeScaleX * effect->scale, effect->smokeScaleY * effect->scale, 1.0f, MTXMODE_APPLY); Matrix_InsertTranslation(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -897,7 +897,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 15, 32, 64, 1, 0, 0, 32, 32)); Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL); @@ -919,7 +919,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(2.0f * effect->scale, 2.0f * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectDL); diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h index 4211550ecd..db0e797e96 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h @@ -10,7 +10,7 @@ typedef void (*EnCne01ActionFunc)(struct EnCne01*, GlobalContext*); typedef struct EnCne01 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnCne01ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4D4]; + /* 0x0148 */ char unk_148[0x4D4]; } EnCne01; // size = 0x61C extern const ActorInit En_Cne_01_InitVars; diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h index 31d1b980e7..6bab3c11a6 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h @@ -10,7 +10,7 @@ typedef void (*EnColManActionFunc)(struct EnColMan*, GlobalContext*); typedef struct EnColMan { /* 0x0000 */ Actor actor; /* 0x0144 */ EnColManActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x58]; + /* 0x0148 */ char unk_148[0x58]; } EnColMan; // size = 0x1A0 extern const ActorInit En_Col_Man_InitVars; 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 fb917742c8..8f14b6c678 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -103,7 +103,7 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) { (particle->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_InsertTranslation(particle->unk_10.x, particle->unk_10.y, particle->unk_10.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(particle->unk_34, particle->unk_34, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 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 413dbdac65..40eac8099a 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -184,7 +184,7 @@ void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) { s32 day = gSaveContext.day - 1; s32 pad2; - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEI) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { if (this->unk_278 == ENDAIKU_PARAMS_FF_1) { this->actor.textId = 0x2365; } else { 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 4ed2a76ab8..e6a00853e1 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -20,7 +20,7 @@ typedef struct EnDinofos { /* 0x28C */ s16 unk_28C; /* 0x28E */ s16 unk_28E; /* 0x290 */ s16 unk_290; - /* 0x290 */ s16 unk_292; + /* 0x292 */ s16 unk_292; /* 0x294 */ UNK_TYPE1 unk_294[4]; /* 0x298 */ s16 camId; /* 0x29A */ Vec3s unk_29A; diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index c6e7eb942b..be0f95eb93 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -288,7 +288,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) { Matrix_InsertTranslation(arg0->unk_0C.x, arg0->unk_0C.y, arg0->unk_0C.z, MTXMODE_NEW); Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 9edb339d46..21336aa912 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h @@ -10,7 +10,7 @@ typedef void (*EnDnhActionFunc)(struct EnDnh*, GlobalContext*); typedef struct EnDnh { /* 0x0000 */ Actor actor; /* 0x0144 */ EnDnhActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x74]; + /* 0x0148 */ char unk_148[0x74]; } EnDnh; // size = 0x1BC extern const ActorInit En_Dnh_InitVars; 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 a21f7df865..5a6b883685 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -171,7 +171,7 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) { if (func_8013E5CC(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C, &this->actor.prevPos, &this->actor.world.pos, &sp88)) { Math_Vec3f_Diff(&this->actor.world.pos, &crace->actor.home.pos, &sp7C); - Matrix_RotateY(-crace->actor.home.rot.y, 0); + Matrix_RotateY(-crace->actor.home.rot.y, MTXMODE_NEW); Matrix_MultiplyVector3fByState(&sp7C, &sp70); if ((fabsf(sp70.x) < 100.0f) && (sp70.y >= -10.0f) && (sp70.y <= 180.0f) && (sp70.z < 0.0f)) { crace->unk_170 |= 1; @@ -985,7 +985,7 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve func_8012C28C(globalCtx->state.gfxCtx); if (limbIndex == 13) { Matrix_Scale(this->unk_454, this->unk_454, this->unk_454, MTXMODE_APPLY); - Matrix_InsertXRotation_s(this->unk_45C, 1); + Matrix_InsertXRotation_s(this->unk_45C, MTXMODE_APPLY); } gfxOpa = POLY_OPA_DISP; @@ -1005,7 +1005,7 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve frames = globalCtx->gameplayFrames; Matrix_MultiplyVector3fByState(&D_80A73B40, &sp84); func_80A711D0(this, globalCtx, &sp84); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(0.15f, 0.15f, 1.0f, MTXMODE_APPLY); Matrix_InsertTranslation(0.0f, -3200.0f, 0.0f, MTXMODE_APPLY); gfxXlu = func_8012C2B4(POLY_XLU_DISP); 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 1dbc470dc7..7331339fcf 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -8,11 +8,14 @@ struct EnDoor; typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*); typedef struct EnDoor { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x63]; - /* 0x01A7 */ s8 unk_1A7; - /* 0x01A8 */ char unk_1A8[0x20]; - /* 0x01C8 */ EnDoorActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0x5C]; + /* 0x1A0 */ s8 unk_1A0; + /* 0x1A1 */ s8 unk_1A1; + /* 0x1A2 */ char unk_1A2[0x5]; + /* 0x1A7 */ s8 unk_1A7; + /* 0x1A8 */ char unk_1A8[0x20]; + /* 0x1C8 */ EnDoorActionFunc actionFunc; } EnDoor; // size = 0x1CC extern const ActorInit En_Door_InitVars; 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 1e87473cdc..cd574fb318 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -154,12 +154,12 @@ void EnElfbub_Draw(Actor* thisx, GlobalContext* globalCtx2) { func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_InsertTranslation(0.0f, 0.0f, 1.0f, 1); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); - Matrix_Scale(this->xyScale + 1.0f, this->xyScale + 1.0f, 1.0f, 1); - Matrix_InsertZRotation_s(this->zRot, 1); - Matrix_Scale(this->xScale + 1.0f, 1.0f, 1.0f, 1); - Matrix_InsertZRotation_s(this->zRot * -1, 1); + Matrix_InsertTranslation(0.0f, 0.0f, 1.0f, MTXMODE_APPLY); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); + Matrix_Scale(this->xyScale + 1.0f, this->xyScale + 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->zRot, MTXMODE_APPLY); + Matrix_Scale(this->xScale + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->zRot * -1, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_06001000); 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 1efecd2574..6ca10601cd 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -607,7 +607,7 @@ void EnElforg_Draw(Actor* thisx, GlobalContext* globalCtx) { AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C818)); break; } - Matrix_InsertMatrix(&globalCtx->mf_187FC, 1); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index e473615cbe..72638d9a6a 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -10,7 +10,7 @@ typedef void (*EnEncount1ActionFunc)(struct EnEncount1*, GlobalContext*); typedef struct EnEncount1 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnEncount1ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x1C]; + /* 0x0148 */ char unk_148[0x1C]; } EnEncount1; // size = 0x164 extern const ActorInit En_Encount1_InitVars; 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 a5f6b1d7af..f196fa54bb 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -284,7 +284,7 @@ void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); Matrix_InsertZRotation_f(DEGTORAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 49c7ccef43..dbfe780527 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h @@ -10,7 +10,7 @@ typedef void (*EnEncount3ActionFunc)(struct EnEncount3*, GlobalContext*); typedef struct EnEncount3 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnEncount3ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x84]; + /* 0x0148 */ char unk_148[0x84]; } EnEncount3; // size = 0x1CC extern const ActorInit En_Encount3_InitVars; diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.h b/src/overlays/actors/ovl_En_Estone/z_en_estone.h index eec7f2d24b..848d41f8b7 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.h +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.h @@ -10,7 +10,7 @@ typedef void (*EnEstoneActionFunc)(struct EnEstone*, GlobalContext*); typedef struct EnEstone { /* 0x0000 */ Actor actor; /* 0x0144 */ EnEstoneActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x2C2C]; + /* 0x0148 */ char unk_148[0x2C2C]; } EnEstone; // size = 0x2D74 extern const ActorInit En_Estone_InitVars; 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 197f076067..f91ee7a312 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -383,7 +383,7 @@ void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(globalCtx->state.gfxCtx); Matrix_StatePush(); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_StatePop(); @@ -477,7 +477,7 @@ void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_InsertTranslation(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(dustEffect->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 72a4739cbf..e4439ec36b 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -34,7 +34,7 @@ typedef struct EnFirefly { /* 0x2F4 */ u32 unk_2F4; /* 0x2F8 */ Vec3f unk_2F8; /* 0x304 */ Vec3f unk_304; - /* 0x304 */ Vec3f unk_310; + /* 0x310 */ Vec3f unk_310; /* 0x31C */ ColliderSphere collider; } EnFirefly; // size = 0x374 diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 7b52e0a30b..f9dfa048d6 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -1058,7 +1058,7 @@ void EnFish2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, OPEN_DISPS(globalCtx->state.gfxCtx); Matrix_StatePush(); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); 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 b25f19222a..bf159f7de6 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -130,7 +130,7 @@ u16 EnFsn_GetWelcome(GlobalContext* globalCtx) { case PLAYER_MASK_GORON: case PLAYER_MASK_ZORA: return 0x29FD; - case PLAYER_MASK_KAFEI: + case PLAYER_MASK_KAFEIS_MASK: return 0x2364; default: return 0x29FE; 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 558e1cf990..7dcf097d79 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -1463,7 +1463,7 @@ void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { flag = true; } Matrix_InsertTranslation(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(ptr->unk_00, ptr->unk_00, ptr->unk_00, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_0405E6F0)); 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 393106e4cc..6946f58ec6 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 @@ -642,12 +642,12 @@ s32 EnGinkoMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d if (limbIndex == 15) { Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_InsertXRotation_s(this->limb15Rot.y, 1); - Matrix_InsertZRotation_s(this->limb15Rot.x, 1); + Matrix_InsertXRotation_s(this->limb15Rot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->limb15Rot.x, MTXMODE_APPLY); Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); } else if (limbIndex == 8) { - Matrix_InsertXRotation_s(-this->limb8Rot.y, 1); - Matrix_InsertZRotation_s(-this->limb8Rot.x, 1); + Matrix_InsertXRotation_s(-this->limb8Rot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(-this->limb8Rot.x, MTXMODE_APPLY); } return 0; 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 22ea6a953e..92a2270197 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1591,7 +1591,7 @@ void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { sp80.z = ptr->unk_20; Matrix_SetStateRotationAndTranslation(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &sp80); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); func_800BDFC0(globalCtx, phi_fp); if ((ptr->unk_28 != 0) && (ptr->unk_2C > 0)) { @@ -1605,7 +1605,7 @@ void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { func_800C0094(ptr->unk_28, ptr->unk_00.x, ptr->unk_18, ptr->unk_00.z, &sp88); Matrix_SetCurrentState(&sp88); - Matrix_Scale(this->actor.scale.x * 7.5f, 1.0f, this->actor.scale.z * 7.5f, 1); + Matrix_Scale(this->actor.scale.x * 7.5f, 1.0f, this->actor.scale.z * 7.5f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 4b96987f7c..8e50b07947 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -15,7 +15,31 @@ void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnGs_Update(Actor* thisx, GlobalContext* globalCtx); void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80997D14(EnGs* this, GlobalContext* globalCtx); +void func_80997D38(EnGs* this, GlobalContext* globalCtx); +void func_80997E4C(EnGs* this, GlobalContext* globalCtx); +void func_80998040(EnGs* this, GlobalContext* globalCtx); +void func_8099807C(EnGs* this, GlobalContext* globalCtx); +void func_80998300(EnGs* this, GlobalContext* globalCtx); +void func_809984F4(EnGs* this, GlobalContext* globalCtx); +void func_809985B8(EnGs* this, GlobalContext* globalCtx); +void func_80998704(EnGs* this, GlobalContext* globalCtx); +void func_8099874C(EnGs* this, GlobalContext* globalCtx); +void func_809989B4(EnGs* this, GlobalContext* globalCtx); +void func_809989F4(EnGs* this, GlobalContext* globalCtx); +s32 func_80998A48(EnGs* this, GlobalContext* globalCtx); +s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx); +s32 func_80998D44(EnGs* this, GlobalContext* globalCtx); +s32 func_80998F9C(EnGs* this, GlobalContext* globalCtx); +s32 func_809995A4(EnGs* this, GlobalContext* globalCtx); +void func_80999A8C(EnGs* this, GlobalContext* globalCtx); +void func_80999AC0(EnGs* this); + +extern Gfx D_0407D590[]; +extern Gfx D_06000950[]; +extern Gfx D_060009D0[]; +extern Gfx D_06000A60[]; + const ActorInit En_Gs_InitVars = { ACTOR_EN_GS, ACTORCAT_PROP, @@ -28,18 +52,29 @@ const ActorInit En_Gs_InitVars = { (ActorFunc)EnGs_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_8099A3A0 = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_METAL, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 21, 48, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_8099A3CC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_8099A3D8 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0xE), /* Deku Stick */ DMG_ENTRY(0, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -74,78 +109,1002 @@ static DamageTable D_8099A3D8 = { /* Powder Keg */ DMG_ENTRY(0, 0xC), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8099A404[] = { +s8 func_80997A90(s16 arg0, s16 arg1) { + s8 phi_v1; + + if ((arg0 == 0) || ((arg0 != 1) && (arg0 != 2) && (arg0 == 3))) { + phi_v1 = 0; + } else { + phi_v1 = (gSaveContext.roomInf[126][1] >> (arg1 * 3)) & 7; + } + return phi_v1; +} + +void func_80997AFC(s32 idx, Color_RGB8* arg1) { + static Color_RGB8 D_8099A3F8[] = { + { 255, 255, 255 }, + { 150, 255, 100 }, + { 255, 80, 40 }, + { 100, 150, 255 }, + }; + + *arg1 = D_8099A3F8[idx]; +} + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnGs* this = THIS; -extern ColliderCylinderInit D_8099A3A0; -extern CollisionCheckInfoInit2 D_8099A3CC; -extern DamageTable D_8099A3D8; -extern InitChainEntry D_8099A404[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + this->unk_208 = -1; + 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->actor.params = ENGS_GET_F000(thisx); + this->actor.world.rot.z = 0; + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + this->actor.targetMode = 6; + this->unk_216 = 0; + this->unk_218 = 0; + this->unk_200 = 1.0f; + this->unk_194 = func_80997A90(this->actor.params, this->unk_198); -extern UNK_TYPE D_06000950; + func_80997AFC(this->unk_194, &this->unk_1FA); + this->unk_1F4 = this->unk_1FA; + Math_Vec3f_Copy(&this->unk_1B0[0], &D_801C5DB0); + Math_Vec3f_Copy(&this->unk_1B0[1], &D_801C5DB0); + func_8013E3B8(&this->actor, &this->unk_212, 2); + func_801A5080(0); + if (this->actor.params == ENGS_1) { + Actor_SetScale(&this->actor, 0.15f); + this->collider.dim.radius *= 1.5f; + this->collider.dim.height *= 1.5f; + } + func_80997D14(this, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997A90.s") +void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnGs* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997AFC.s") + Collider_DestroyCylinder(globalCtx, &this->collider); + func_80165690(); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/EnGs_Init.s") +void func_80997D14(EnGs* this, GlobalContext* globalCtx) { + this->unk_19A &= ~0x200; + this->actionFunc = func_80997D38; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/EnGs_Destroy.s") +void func_80997D38(EnGs* this, GlobalContext* globalCtx) { + static f32 D_8099A408[] = { 40.0f, 60.0f, 40.0f, 40.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997D14.s") + if (!func_80152498(&globalCtx->msgCtx)) { + if (this->actor.xzDistToPlayer <= D_8099A408[this->actor.params]) { + func_8013E8F8(&this->actor, globalCtx, D_8099A408[this->actor.params], D_8099A408[this->actor.params], 0, + 0x2000, 0x2000); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997D38.s") + if (this->actor.params != ENGS_2) { + func_800B874C(&this->actor, globalCtx, 100.0f, 100.0f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997DEC.s") +void func_80997DEC(EnGs* this, GlobalContext* globalCtx) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) { + this->unk_210 = 0x20D1; + } else { + this->unk_210 = 0x20D0; + } + this->unk_19A |= 0x200; + this->actionFunc = func_80997E4C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997E4C.s") +void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { + switch (func_80152498(&globalCtx->msgCtx)) { + case 0: + func_801518B0(globalCtx, this->unk_210, &this->actor); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80997FF0.s") + case 1: + case 2: + case 3: + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998040.s") + case 4: + case 5: + case 6: + if (func_80147624(globalCtx)) { + switch (globalCtx->msgCtx.unk11F04) { + case 0x20D0: + func_80997D14(this, globalCtx); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_8099807C.s") + case 0x20D1: + switch (this->actor.params) { + case ENGS_0: + this->unk_210 = this->unk_195 + 0x20D3; + if (this->unk_210 >= 0x20D4) { + s32 temp_v1 = this->unk_210 - 0x20D4; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998300.s") + if ((this->unk_210 < 0x20E8) && + ((temp_v1 + ITEM_MASK_TRUTH) == INV_CONTENT(temp_v1 + ITEM_MASK_TRUTH))) { + this->unk_210 = temp_v1 + 0x2103; + } + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998334.s") + case ENGS_3: + this->unk_210 = this->unk_195 + 0x20B0; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_809984F4.s") + case ENGS_1: + this->unk_210 = this->unk_195 + 0x20F3; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_809985B8.s") + case ENGS_2: + this->unk_210 = this->unk_195 + 0x20F7; + break; + } + func_80151938(globalCtx, this->unk_210); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998704.s") + default: + func_80997D14(this, globalCtx); + break; + } + } + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_8099874C.s") +void func_80997FF0(EnGs* this, GlobalContext* globalCtx) { + if (func_8013E2D4(&this->actor, globalCtx->unk_1879C[0], -1, 1)) { + func_80998040(this, globalCtx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_809989B4.s") +void func_80998040(EnGs* this, GlobalContext* globalCtx) { + func_80152434(globalCtx, 1); + this->actionFunc = func_8099807C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_809989F4.s") +void func_8099807C(EnGs* this, GlobalContext* globalCtx) { + switch (globalCtx->msgCtx.unk1202A) { + case 3: + switch (globalCtx->msgCtx.unk1202E) { + case 7: + case 8: + if (!Flags_GetSwitch(globalCtx, this->unk_196)) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 2); + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); + Actor_SetSwitchFlag(globalCtx, this->unk_196); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998A48.s") + case 10: + if (!Flags_GetSwitch(globalCtx, this->unk_196)) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 7); + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); + Actor_SetSwitchFlag(globalCtx, this->unk_196); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998BBC.s") + case 0: + if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_DEKU)) { + this->unk_194 = 1; + this->unk_19C = 5; + this->unk_19A |= 1; + func_80999AC0(this); + func_809984F4(this, globalCtx); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998D44.s") + case 2: + if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_ZORA)) { + this->unk_194 = 3; + this->unk_19C = 5; + this->unk_19A |= 1; + func_80999AC0(this); + func_809984F4(this, globalCtx); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80998F9C.s") + case 1: + if ((this->actor.params == ENGS_1) && (gSaveContext.playerForm == PLAYER_FORM_GORON)) { + this->unk_194 = 2; + this->unk_19C = 5; + this->unk_19A |= 1; + func_80999AC0(this); + func_809984F4(this, globalCtx); + } + break; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80999584.s") + case 0: + case 4: + func_80998300(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_809995A4.s") + case 26: + func_80997D14(this, globalCtx); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80999A8C.s") +void func_80998300(EnGs* this, GlobalContext* globalCtx) { + if (this->actor.cutscene != -1) { + ActorCutscene_Stop(globalCtx->unk_1879C[0]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80999AC0.s") +f32 func_80998334(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, s16* arg4, f32 arg5, f32 arg6, f32 arg7, + s32 arg8, s32 arg9) { + f32 sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80999B34.s") + if (arg9 == 0) { + sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); + this->unk_1B0[0].x = (__sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2) + 1.0f; + this->unk_1B0[0].y = 1.0f - (__sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2); + (*arg4)++; + } + return sp2C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/func_80999BC8.s") +void func_809984F4(EnGs* this, GlobalContext* globalCtx) { + EnGs* gossipStone = NULL; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/EnGs_Update.s") + do { + gossipStone = (EnGs*)func_ActorCategoryIterateById(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); + if (gossipStone != NULL) { + if ((this != gossipStone) && (this->unk_194 == gossipStone->unk_194)) { + gossipStone->unk_19A |= 1; + func_80999AC0(gossipStone); + gossipStone->unk_19C = 3; + func_80998704(gossipStone, globalCtx); + } + gossipStone = (EnGs*)gossipStone->actor.next; + } + } while (gossipStone != NULL); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gs/EnGs_Draw.s") + func_800B7298(globalCtx, &this->actor, 7); + this->actionFunc = func_809985B8; +} + +void func_809985B8(EnGs* this, GlobalContext* globalCtx) { + EnGs* gossipStone; + Vec3f sp38; + + if (func_8013E2D4(&this->actor, this->unk_212, -1, 0)) { + Player* player = GET_PLAYER(globalCtx); + + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledZ(160.0f, &sp38); + Math_Vec3f_Sum(&player->actor.world.pos, &sp38, &player->actor.world.pos); + Math_Vec3f_Copy(&player->actor.prevPos, &player->actor.world.pos); + this->unk_200 = 0.0f; + gSaveContext.roomInf[126][1] = + (gSaveContext.roomInf[126][1] & ~(7 << (this->unk_198 * 3))) | ((this->unk_194 & 7) << (this->unk_198 * 3)); + gossipStone = NULL; + + do { + gossipStone = + (EnGs*)func_ActorCategoryIterateById(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); + if (gossipStone != NULL) { + if ((gossipStone != this) && (gossipStone->actor.params == ENGS_2) && + (gossipStone->unk_198 == this->unk_198)) { + gossipStone->unk_194 = this->unk_194; + gossipStone->unk_200 = 0.0f; + } + gossipStone = (EnGs*)gossipStone->actor.next; + } + } while (gossipStone != NULL); + + func_80998704(this, globalCtx); + } +} + +void func_80998704(EnGs* this, GlobalContext* globalCtx) { + this->unk_19D = 0; + this->unk_19A &= ~(0x100 | 0x4); + Audio_PlayActorSound2(&this->actor, NA_SE_EV_G_STONE_CHANGE_COLOR); + this->actionFunc = func_8099874C; +} + +void func_8099874C(EnGs* this, GlobalContext* globalCtx) { + s32 phi_v0 = 0; + + switch (this->unk_19C) { + case 0: + phi_v0 = func_80998A48(this, globalCtx); + break; + + case 1: + phi_v0 = func_80998BBC(this, globalCtx); + break; + + case 2: + phi_v0 = func_80998D44(this, globalCtx); + break; + + case 3: + case 5: + phi_v0 = func_80998F9C(this, globalCtx); + break; + + case 4: + phi_v0 = func_809995A4(this, globalCtx); + break; + } + + if (phi_v0 == 0) { + this->unk_216 = 0; + if ((this->unk_19C == 5) && (this->unk_194 != 0)) { + s32 i; + + ActorCutscene_Stop(this->unk_212); + phi_v0 = 1; + + for (i = 0; i < 4; i++) { + if (((gSaveContext.roomInf[126][1] >> (i * 3)) & 7) != (u32)this->unk_194) { + phi_v0 = 0; + } + } + + if (phi_v0 != 0) { + this->unk_20C = -1; + switch (this->unk_194) { + case 1: + if (!(gSaveContext.weekEventReg[77] & 8)) { + this->unk_20C = 6; + gSaveContext.weekEventReg[77] |= 8; + } + break; + + case 3: + if (!(gSaveContext.weekEventReg[77] & 0x10)) { + this->unk_20C = 6; + gSaveContext.weekEventReg[77] |= 0x10; + } + break; + + case 2: + if (!(gSaveContext.weekEventReg[77] & 0x20)) { + this->unk_20C = 6; + gSaveContext.weekEventReg[77] |= 0x20; + } + break; + } + + if (!(gSaveContext.weekEventReg[90] & 0x10)) { + gSaveContext.weekEventReg[90] |= 0x10; + this->unk_20C = 12; + } + + if (this->unk_20C > 0) { + func_809989B4(this, globalCtx); + } else { + func_80997D14(this, globalCtx); + } + } else { + func_80997D14(this, globalCtx); + } + } else { + func_80997D14(this, globalCtx); + } + } +} + +void func_809989B4(EnGs* this, GlobalContext* globalCtx) { + func_800B8A1C(&this->actor, globalCtx, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + this->actionFunc = func_809989F4; +} + +void func_809989F4(EnGs* this, GlobalContext* globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.parent = NULL; + func_80997D14(this, globalCtx); + } else { + func_800B8A1C(&this->actor, globalCtx, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + } +} + +s32 func_80998A48(EnGs* this, GlobalContext* globalCtx) { + s32 sp3C = -1; + + if (this->unk_19D == 0) { + this->unk_216 = 200; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); + + this->unk_1D4 = 0; + this->unk_19A |= 1; + this->unk_21C = 5; + this->unk_21E = 40; + this->unk_197++; + this->unk_197 &= 0xF; + this->unk_19D = 1; + + this->unk_1DC = 0.5f; + this->unk_1E0 = 0.0f; + } else if (this->unk_19D == 1) { + if (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.007f, 0.001f, 7, + 0) == 0.0f) { + if ((this->actor.params != ENGS_0) && !func_801690CC(globalCtx) && !func_80152498(&globalCtx->msgCtx)) { + this->unk_216 = 0; + Audio_PlayActorSound2(&this->actor, NA_SE_EV_FAIVE_LUPY_COUNT); + func_801518B0(globalCtx, 0x20D2, NULL); + } + this->unk_19A &= ~1; + sp3C = 0; + } + } + return sp3C; +} + +s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx) { + s32 sp34 = -1; + + if (this->unk_19D == 0) { + this->unk_216 = 200; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); + this->unk_1DC = 0.3f; + this->unk_1E0 = 0.0f; + + this->unk_1D4 = 0; + this->unk_19A |= 1; + this->unk_21C = 5; + this->unk_21E = 40; + this->unk_197--; + this->unk_197 &= 0xF; + this->unk_19D = 1; + } else if (this->unk_19D == 1) { + this->unk_19E[0].z = (this->unk_1D4 % 8) * 0.125f * 360.0f * (0x10000 / 360.0f); + this->unk_19E[1].z = -this->unk_19E[0].z; + if (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.005f, 0.001f, 7, + 0) == 0.0f) { + this->unk_19A &= ~1; + sp34 = 0; + } + } + return sp34; +} + +s32 func_80998D44(EnGs* this, GlobalContext* globalCtx) { + s32 sp3C = -1; + f32 step; + + if (this->unk_19D == 0) { + this->unk_216 = 200; + this->unk_1DC = this->unk_1B0[0].y - 1.0f; + this->unk_1E0 = -0.8f; + Audio_PlayActorSound2(&this->actor, NA_SE_EV_G_STONE_CRUSH); + this->unk_19A |= 1; + this->unk_21C = 40; + this->unk_21E = 11; + this->unk_19D++; + } else if (this->unk_19D == 1) { + step = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, 0.4f, 0.001f); + this->unk_1B0[0].y = this->unk_1DC + 1.0f; + if (step == 0.0f) { + this->unk_216 = 0; + this->unk_1D4 = 0; + this->unk_19D++; + } + } else if (this->unk_19D == 2) { + this->unk_1D4++; + if (this->unk_1D4 >= 100) { + this->unk_216 = 200; + this->unk_19D++; + this->unk_1DC = this->unk_1B0[0].y - 1.0f; + this->unk_1E0 = 0.0f; + } + } else if (this->unk_19D == 3) { + step = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, 0.5f, 0.001f); + this->unk_1B0[0].y = this->unk_1DC + 1.0f; + if (step == 0.0f) { + this->unk_216 = 0; + this->unk_1E0 = 0.0f; + this->unk_1D4 = 0; + this->unk_21C = 10; + this->unk_21E = 10; + this->unk_1DC = 0.5f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); + this->unk_19D += 1; + } + } else if ((this->unk_19D == 4) && (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, + 1.0f, 0.03f, 0.001f, 5, 0) == 0.0f)) { + this->unk_19A &= ~1; + sp3C = 0; + } + return sp3C; +} + +s32 func_80998F9C(EnGs* this, GlobalContext* globalCtx) { + s32 sp4C = -1; + f32 sp48; + f32 sp44; + f32 sp40; + s32 phi_v0_2; + u16 sp3A = this->unk_19E[0].y; + + if (this->unk_19D == 0) { + this->unk_1DC = 0; + this->unk_1E0 = 90.0f; + this->unk_1E4 = 0.1f; + this->unk_1E8 = 2.0f; + this->unk_1EC = 0.0f; + + this->unk_19D = 1; + this->unk_21C = 2; + this->unk_21E = 40; + this->unk_216 = 200; + } + + if (this->unk_19D == 1) { + Math_SmoothStepToF(&this->unk_1E4, this->unk_1E8, 1.0f, 0.1f, 0.001f); + sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, this->unk_1E4, 0.001f); + this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); + if (sp48 == 0.0f) { + this->unk_1D4 = 0; + this->unk_19D = 2; + } + } + + if (this->unk_19D == 2) { + this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); + if ((this->unk_1D4++ <= 40) ^ 1) { + this->unk_1DC = this->unk_1B0[0].y - 1.0f; + this->unk_1E0 = 1.5f; + this->unk_1E4 = this->unk_1B0[1].y - 1.0f; + this->unk_1E8 = -0.3f; + Audio_PlayActorSound2(&this->actor, NA_SE_EV_STONE_GROW_UP); + this->unk_19D = 3; + } + } + + if (this->unk_19D == 3) { + this->unk_19E[0].y += 0x4000; + sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.8f, 0.2f, 0.001f); + Math_SmoothStepToF(&this->unk_1E4, this->unk_1E8, 0.8f, 0.2f, 0.001f); + this->unk_1B0[0].x = this->unk_1E4 + 1.0f; + this->unk_1B0[0].y = this->unk_1DC + 1.0f; + if (sp48 == 0.0f) { + this->unk_1DC = 2.0f * M_PI / 9.0000002; + this->unk_1E0 = M_PI / 9.0000002; + this->unk_19D = 4; + } + } + + if (this->unk_19D == 4) { + sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.8f, 16384.0f, 3640.0f); + this->unk_19E[0].y += (s16)this->unk_1DC; + if (sp48 == 0.0f) { + phi_v0_2 = this->unk_19E[0].y; + if (phi_v0_2 > 0) { + phi_v0_2 += 0xFFFF0000; + } + this->unk_1DC = phi_v0_2; + this->unk_1E0 = 0; + this->unk_19D = 5; + } + } + + if (this->unk_19D == 5) { + phi_v0_2 = this->unk_19E[0].y; + if (phi_v0_2 > 0) { + phi_v0_2 += 0xFFFF0001; + } + this->unk_1DC = phi_v0_2; + + sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.8f, 3640.0f, 0.001f); + this->unk_19E[0].y = (s32)this->unk_1DC; + if (sp48 == 0.0f) { + this->unk_19E[0].y = 0; + this->unk_1D4 = 0; + this->unk_1DC = this->unk_1B0[0].y - 1.0f; + this->unk_1E0 = 0.0f; + this->unk_1E4 = this->unk_1B0[0].x - 1.0f; + this->unk_1E8 = 0.0f; + this->unk_1F0 = 0.0f; + this->unk_1EC = 0.5f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK); + this->unk_21C = 20; + this->unk_21E = 2; + this->unk_19D = 6; + } + } + + if (this->unk_19D == 6) { + sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.8f, 0.1f, 0.001f); + sp44 = Math_SmoothStepToF(&this->unk_1E4, this->unk_1E8, 0.8f, 0.1f, 0.001f); + sp40 = Math_SmoothStepToF(&this->unk_1EC, this->unk_1F0, 0.8f, 0.02f, 0.001f); + this->unk_1B0[0].x = this->unk_1E4 + 1.0f; + this->unk_1B0[0].y = this->unk_1DC + 1.0f; + this->unk_1B0[0].x += __sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; + this->unk_1B0[0].y += __sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; + this->unk_1D4++; + if ((sp48 == 0.0f) && (sp44 == 0.0f) && (sp40 == 0.0f)) { + this->unk_216 = 0; + sp4C = 0; + } + } + + if ((u16)this->unk_19E[0].y < sp3A) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_STONE_ROLLING); + } + + return sp4C; +} + +void func_80999584(Color_RGB8* arg0, Color_RGB8* arg1) { + arg0->r = arg1->r; + arg0->g = arg1->g; + arg0->b = arg1->b; +} + +s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { + static Color_RGB8 flashColours[] = { + { 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 }; + s32 sp7C = -1; + + if (this->unk_19D == 0) { + this->unk_19A |= 0x100; + this->unk_1D4 = 40; + this->unk_19D++; + } + + if (this->unk_19D == 1) { + if (this->unk_1D4-- == 0) { + this->unk_1D4 = 80; + this->unk_19A |= 4; + this->unk_19D++; + } + } + + if (this->unk_19D == 2) { + u8 pad; + + this->unk_1D4--; + func_80999584(&this->unk_1FA, &flashColours[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]); + this->unk_1F4 = this->unk_1FA; + play_sound(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]); + this->unk_1F4 = this->unk_1FA; + play_sound(NA_SE_SY_WARNING_COUNT_N); + this->unk_200 = 0.0f; + } + } + } + + if (this->unk_1D4 <= 0) { + this->unk_19A &= ~4; + this->unk_21C = 3; + this->unk_21E = 40; + this->unk_1D4 = 0; + this->unk_19D++; + } + } + + if (this->unk_19D == 3) { + u8 i; + Vec3f sp6C; + Vec3f sp60; + + for (i = 0; i < 3; i++) { + sp60.x = randPlusMinusPoint5Scaled(15.0f); + sp60.y = Rand_ZeroFloat(-1.0f); + sp60.z = randPlusMinusPoint5Scaled(15.0f); + + sp6C.x = this->actor.world.pos.x + (2.0f * sp60.x); + sp6C.y = this->actor.world.pos.y + 7.0f; + sp6C.z = this->actor.world.pos.z + (2.0f * sp60.z); + + func_800B0EB0(globalCtx, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, + 15); + } + + func_800B9010(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); + + if ((this->unk_1D4++ < 40) ^ 1) { + this->unk_19A |= 0x10; + + this->actor.uncullZoneForward = 12000.0f; + this->actor.gravity = 0.3f; + this->unk_1DC = 0.0f; + + this->unk_19D++; + this->unk_21C = 5; + this->unk_21E = 20; + this->unk_19A |= 1; + this->unk_216 = 200; + this->unk_1E0 = (this->unk_197 >> 2) * 0x444; + } + } + + if (this->unk_19D == 4) { + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 3); + if (this->actor.bgCheckFlags & (0x10 | 0x8)) { + Vec3f sp54; + + sp54.x = this->actor.world.pos.x; + sp54.y = this->actor.world.pos.y; + sp54.z = this->actor.world.pos.z; + Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + EffectSsBomb2_SpawnLayered(globalCtx, &sp54, &bomb2Velocity, &bomb2Accel, 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_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 0.5f, 364.0f, 0.0f); + + this->unk_19E[1].y += (s16)this->unk_1DC; + + if ((this->actor.world.pos.y - this->actor.home.pos.y) >= 4000.0f) { + this->unk_216 = 0; + } + + if (this->actor.playerHeightRel < -12000.0f) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); + Actor_MarkForDeath(&this->actor); + sp7C = 0; + } + } + + return sp7C; +} + +void func_80999A8C(EnGs* this, GlobalContext* globalCtx) { + if (this->unk_1D4-- <= 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void func_80999AC0(EnGs* this) { + static Vec3s D_8099A450 = { 0, 0, 0 }; + static Vec3f D_8099A458 = { 1.0f, 1.0f, 1.0f }; + s32 i; + + for (i = 0; i < ARRAY_COUNT(this->unk_19E); i++) { + this->unk_19E[i] = D_8099A450; + } + + for (i = 0; i < ARRAY_COUNT(this->unk_1B0); i++) { + this->unk_1B0[i] = D_8099A458; + } +} + +void func_80999B34(EnGs* this) { + if (this->unk_216 > 0) { + if (this->unk_218 == 0) { + func_8016566C(this->unk_216); + this->unk_218 = this->unk_216; + } else { + func_80165658(this->unk_218); + } + } else if (this->unk_218 > 0) { + Math_StepToS(&this->unk_218, this->unk_216, 20); + func_80165658(this->unk_218); + if (this->unk_218 <= 0) { + func_80165690(); + } + } +} + +void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + EnGs* this = THIS; + s32 pad; + + if (this->actor.isTargeted && !func_801A5100()) { + this->unk_19D = 0; + this->unk_19A |= 1; + func_80999AC0(this); + this->unk_19C = 0; + func_80998704(this, globalCtx); + this->unk_208 = 0; + } + + if (this->actor.params == ENGS_1) { + Actor_SetHeight(&this->actor, 34.5f); + } else { + Actor_SetHeight(&this->actor, 23.0f); + } + + if (this->unk_21A > 0) { + this->unk_21A--; + if (this->unk_21A <= 0) { + this->unk_21A = 0; + } + } + + if (!(this->unk_19A & (0x200 | 0x10)) && (this->unk_21A == 0)) { + if (this->collider.base.acFlags & AC_HIT) { + this->unk_19D = 0; + this->collider.base.acFlags &= ~AC_HIT; + + switch (this->actor.colChkInfo.damageEffect) { + case 15: + this->unk_19A |= 1; + func_80999AC0(this); + this->unk_19C = 0; + func_80998704(this, globalCtx); + this->unk_21A = 5; + break; + + case 14: + this->unk_19A |= 1; + func_80999AC0(this); + this->unk_19C = 1; + func_80998704(this, globalCtx); + this->unk_21A = 5; + break; + + case 13: + func_80999AC0(this); + this->unk_19C = 2; + func_80998704(this, globalCtx); + this->unk_21A = 5; + break; + + case 12: + this->unk_19A |= 2; + func_80999AC0(this); + this->unk_19C = 4; + func_80998704(this, globalCtx); + this->unk_21A = 5; + break; + + case 11: + this->unk_19A |= 1; + func_80999AC0(this); + this->unk_19C = 3; + func_80998704(this, globalCtx); + this->unk_21A = 5; + break; + } + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } else { + this->collider.base.acFlags &= ~AC_HIT; + } + + this->actionFunc(this, globalCtx); +} + +void EnGs_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnGs* this = THIS; + + if (func_800B84D0(&this->actor, globalCtx)) { + globalCtx->msgCtx.unk11F22 = 0; + globalCtx->msgCtx.unk11F10 = 0; + this->collider.base.acFlags &= ~AC_HIT; + func_80997DEC(this, globalCtx); + } else if (func_800B8718(&this->actor, globalCtx)) { + this->unk_19A |= 0x200; + this->collider.base.acFlags &= ~AC_HIT; + if (this->actor.cutscene != -1) { + this->actionFunc = func_80997FF0; + } else { + func_80998040(this, globalCtx); + } + } else { + s16 sp2E; + s16 sp2C; + + if ((this->actor.flags & 0x40) || (this->unk_19A & 0x100) || (this->unk_19A & 0x200)) { + func_80999BC8(&this->actor, globalCtx); + func_800B8898(globalCtx, &this->actor, &sp2E, &sp2C); + if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > 320) || (sp2C < 0) || + (sp2C > 240)) { + this->unk_216 = 0; + } else if (this->unk_21C > 0) { + func_800BC848(&this->actor, globalCtx, this->unk_21C, this->unk_21E); + } + } else { + this->unk_216 = 0; + } + + if (this->unk_200 < 1.0f) { + if (this->unk_19A & 4) { + Math_StepToF(&this->unk_200, 1.0f, 0.06f); + } else { + 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); + if (this->unk_200 >= 1.0f) { + this->unk_1F4 = this->unk_1FA; + } + } + + if (this->unk_21C > 0) { + this->unk_21C = 0; + } + + func_80999B34(this); + } +} + +void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnGs* this = THIS; + u32 frames; + + if (this->unk_19A & 8) { + return; + } + + OPEN_DISPS(globalCtx->state.gfxCtx); + + frames = globalCtx->gameplayFrames; + + func_8012C28C(globalCtx->state.gfxCtx); + Matrix_StatePush(); + + if (this->unk_19A & 1) { + Matrix_RotateY(this->unk_19E[0].y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->unk_19E[0].x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->unk_19E[0].z, MTXMODE_APPLY); + Matrix_Scale(this->unk_1B0[0].x, this->unk_1B0[0].y, this->unk_1B0[0].z, MTXMODE_APPLY); + Matrix_RotateY(this->unk_19E[1].y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->unk_19E[1].x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->unk_19E[1].z, MTXMODE_APPLY); + } + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_06000950); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1FA.r, this->unk_1FA.g, this->unk_1FA.b, 255); + gSPDisplayList(POLY_OPA_DISP++, D_060009D0); + gSPDisplayList(POLY_OPA_DISP++, D_06000A60); + + Matrix_StatePop(); + + if (this->unk_19A & 2) { + func_8012C2DC(globalCtx->state.gfxCtx); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); + Matrix_Scale(0.05f, -0.05f, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); + gSPDisplayList(POLY_XLU_DISP++, D_0407D590); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} 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 7b01d2c0a2..8b10cb68dc 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -5,9 +5,57 @@ struct EnGs; +typedef void (*EnGsActionFunc)(struct EnGs*, GlobalContext*); + +#define ENGS_GET_1F(thisx) ((thisx)->params & 0x1F) +#define ENGS_GET_FE0(thisx) (((thisx)->params >> 5) & 0x7F) +#define ENGS_GET_F000(thisx) (((thisx)->params >> 0xC) & 0xF) + +enum { + /* 0 */ ENGS_0, + /* 1 */ ENGS_1, + /* 2 */ ENGS_2, + /* 3 */ ENGS_3, +}; + typedef struct EnGs { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0xDC]; + /* 0x144 */ ColliderCylinder collider; + /* 0x190 */ EnGsActionFunc actionFunc; + /* 0x194 */ s8 unk_194; + /* 0x195 */ u8 unk_195; + /* 0x196 */ u8 unk_196; + /* 0x197 */ s8 unk_197; + /* 0x198 */ s16 unk_198; + /* 0x19A */ s16 unk_19A; + /* 0x19C */ s8 unk_19C; + /* 0x19D */ u8 unk_19D; + /* 0x19E */ Vec3s unk_19E[3]; + /* 0x1B0 */ Vec3f unk_1B0[2]; + /* 0x1C8 */ UNK_TYPE1 unk1C8[0xC]; + /* 0x1D4 */ s16 unk_1D4; + /* 0x1D6 */ UNK_TYPE1 unk1D6[0x6]; + /* 0x1DC */ f32 unk_1DC; + /* 0x1E0 */ f32 unk_1E0; + /* 0x1E4 */ f32 unk_1E4; + /* 0x1E8 */ f32 unk_1E8; + /* 0x1EC */ f32 unk_1EC; + /* 0x1F0 */ f32 unk_1F0; + /* 0x1F4 */ Color_RGB8 unk_1F4; + /* 0x1F7 */ Color_RGB8 unk_1F7; + /* 0x1FA */ Color_RGB8 unk_1FA; + /* 0x200 */ f32 unk_200; + /* 0x204 */ s32 unk_204; + /* 0x208 */ s32 unk_208; + /* 0x20C */ s32 unk_20C; + /* 0x210 */ u16 unk_210; + /* 0x212 */ s16 unk_212; + /* 0x214 */ UNK_TYPE1 unk214[2]; + /* 0x216 */ s16 unk_216; + /* 0x218 */ s16 unk_218; + /* 0x21A */ s16 unk_21A; + /* 0x21C */ s16 unk_21C; + /* 0x21E */ s16 unk_21E; } EnGs; // size = 0x220 extern const ActorInit En_Gs_InitVars; diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index 167180dabe..0a0dccef71 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -351,7 +351,7 @@ void func_80B228F4(Actor* thisx, GlobalContext* globalCtx) { void EnHakurock_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C28C(globalCtx->state.gfxCtx); - Matrix_InsertTranslation(-100.0f, 0.0f, 0.0f, 1); + Matrix_InsertTranslation(-100.0f, 0.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_06011100); gSPDisplayList(POLY_OPA_DISP++, D_06011178); diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index 6207c5fc34..f9983e26a3 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -10,7 +10,7 @@ typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, GlobalContext*); typedef struct EnHonotrap { /* 0x0000 */ Actor actor; /* 0x0144 */ EnHonotrapActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x17C]; + /* 0x0148 */ char unk_148[0x17C]; } EnHonotrap; // size = 0x2C4 extern const ActorInit En_Honotrap_InitVars; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 910f7fc7bf..800e44c6fb 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -214,11 +214,11 @@ s32 func_808F3178(EnIn* this, GlobalContext* globalCtx) { u8 tmp; this->unk260 = tmp = func_8013DB90(globalCtx, &this->unk248, -6.0f); - if (this->unk260 != 0 && prevUnk260 == 0 && tmp & 0xFF) { + if (this->unk260 != 0 && prevUnk260 == 0 && tmp) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_CONCRETE); } this->unk261 = tmp = func_8013DB90(globalCtx, &this->unk254, -6.0f); - if (this->unk261 != 0 && prevUnk261 == 0 && tmp & 0xFF) { + if (this->unk261 != 0 && prevUnk261 == 0 && tmp) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_CONCRETE); } return 0; diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 2d29831022..b71a44a342 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -4480,7 +4480,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { gSPSetOtherMode(gfx++, G_SETOTHERMODE_H, 4, 4, 0x00000080); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_NEW); Matrix_GetStateTranslationAndScaledZ(60.0f, &sp80); sp74.x = thisx->world.pos.x + sp80.x; sp74.y = thisx->world.pos.y + sp80.y + 68.0f; @@ -4572,14 +4572,14 @@ void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp5C; Matrix_StatePush(); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_NEW); Matrix_GetStateTranslationAndScaledZ(200.0f, &sp5C); Matrix_StatePop(); sp5C.x += thisx->world.pos.x; sp5C.y += thisx->world.pos.y; sp5C.z += thisx->world.pos.z; EnInvadepoh_SetSysMatrix(&sp5C); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_InsertZRotation_s(((EnInvadepoh*)thisx)->unk304, MTXMODE_APPLY); OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); 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 d565469742..df29dbc602 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 @@ -10,7 +10,7 @@ typedef void (*EnInvadepohDemoActionFunc)(struct EnInvadepohDemo*, GlobalContext typedef struct EnInvadepohDemo { /* 0x0000 */ Actor actor; /* 0x0144 */ EnInvadepohDemoActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x180]; + /* 0x0148 */ char unk_148[0x180]; } EnInvadepohDemo; // size = 0x2C8 extern const ActorInit En_Invadepoh_Demo_InitVars; 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 24aa7d33bc..f459fbf53a 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 @@ -14,10 +14,10 @@ void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx); void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx); +void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx); void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx); void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx); -#if 0 const ActorInit En_Invisible_Ruppe_InitVars = { ACTOR_EN_INVISIBLE_RUPPE, ACTORCAT_NPC, @@ -30,25 +30,95 @@ const ActorInit En_Invisible_Ruppe_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80C25B50 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + + { + ELEMTYPE_UNK4, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, + { 10, 30, 0, { 0, 0, 0 } }, }; -#endif +void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 0.0f, 4); +} -extern ColliderCylinderInit D_80C25B50; +void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx) { + if (this->collider.base.ocFlags1 & OC1_HIT) { + switch (INVISIBLERUPPE_GET_3(this)) { + case 0: + play_sound(NA_SE_SY_GET_RUPY); + Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C258A0.s") + case 1: + play_sound(NA_SE_SY_GET_RUPY); + Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_BLUE); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C2590C.s") + case 2: + play_sound(NA_SE_SY_GET_RUPY); + Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED); + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C259E8.s") + if (this->unk_190 >= 0) { + Actor_SetSwitchFlag(globalCtx, this->unk_190); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Init.s") + this->actionFunc = func_80C259E8; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Destroy.s") +void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx) { + Actor_MarkForDeath(&this->actor); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Update.s") +void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnInvisibleRuppe* this = THIS; + + this->unk_190 = INVISIBLERUPPE_GET_1FC(this); + + if (this->unk_190 == 0x7F) { + this->unk_190 = -1; + } + + if ((this->unk_190 >= 0) && Flags_GetSwitch(globalCtx, this->unk_190)) { + Actor_MarkForDeath(&this->actor); + return; + } + + Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + + this->actionFunc = func_80C2590C; +} + +void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnInvisibleRuppe* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx) { + EnInvisibleRuppe* this = THIS; + + this->actionFunc(this, globalCtx); + func_80C258A0(this, globalCtx); +} 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 66b42d520c..eef1acbfe3 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 @@ -7,9 +7,14 @@ struct EnInvisibleRuppe; typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, GlobalContext*); +#define INVISIBLERUPPE_GET_3(thisx) ((thisx)->actor.params & 3) +#define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->actor.params & 0x1FC) >> 2) + typedef struct EnInvisibleRuppe { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x50]; + /* 0x0144 */ ColliderCylinder collider; + /* 0x0190 */ s16 unk_190; + /* 0x0192 */ s16 unk_192; /* 0x0194 */ EnInvisibleRuppeActionFunc actionFunc; } EnInvisibleRuppe; // size = 0x198 diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h index b34679bd3e..72aeb93b7c 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h @@ -10,7 +10,7 @@ typedef void (*EnKujiyaActionFunc)(struct EnKujiya*, GlobalContext*); typedef struct EnKujiya { /* 0x0000 */ Actor actor; /* 0x0144 */ EnKujiyaActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4]; + /* 0x0148 */ char unk_148[0x4]; } EnKujiya; // size = 0x14C extern const ActorInit En_Kujiya_InitVars; 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 e3756a4d28..612f7b2eff 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -10,7 +10,7 @@ typedef void (*EnKusaActionFunc)(struct EnKusa*, GlobalContext*); typedef struct EnKusa { /* 0x0000 */ Actor actor; /* 0x0144 */ EnKusaActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x54]; + /* 0x0148 */ char unk_148[0x54]; } EnKusa; // size = 0x19C extern const ActorInit En_Kusa_InitVars; 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 d89ed45821..6b55a48a74 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 @@ -1140,7 +1140,7 @@ void EnMaYto_DefaultStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { this->textId = 0x235E; break; - case PLAYER_MASK_KAFEI: + case PLAYER_MASK_KAFEIS_MASK: EnMaYto_SetFaceExpression(this, 1, 2); func_801518B0(globalCtx, 0x235F, &this->actor); this->textId = 0x235F; @@ -1198,7 +1198,7 @@ void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { this->textId = 0x235E; break; - case PLAYER_MASK_KAFEI: + case PLAYER_MASK_KAFEIS_MASK: func_801518B0(globalCtx, 0x235F, &this->actor); this->textId = 0x235F; break; diff --git a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h index 4ed2d7f6ea..df53fbe499 100644 --- a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h +++ b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h @@ -10,7 +10,7 @@ typedef void (*EnMarutaActionFunc)(struct EnMaruta*, GlobalContext*); typedef struct EnMaruta { /* 0x0000 */ Actor actor; /* 0x0144 */ EnMarutaActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xDC]; + /* 0x0148 */ char unk_148[0xDC]; } EnMaruta; // size = 0x224 extern const ActorInit En_Maruta_InitVars; diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h index 854589854a..7ac4dee6cc 100644 --- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h +++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h @@ -10,7 +10,7 @@ typedef void (*EnMinideathActionFunc)(struct EnMinideath*, GlobalContext*); typedef struct EnMinideath { /* 0x0000 */ Actor actor; /* 0x0144 */ EnMinideathActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x164]; + /* 0x0148 */ char unk_148[0x164]; } EnMinideath; // size = 0x2AC extern const ActorInit En_Minideath_InitVars; 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 9095d702b3..4b5585086d 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -622,7 +622,7 @@ void EnMinifrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(globalCtx->state.gfxCtx); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h index 0bc6037484..c80fc7a20e 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h @@ -10,7 +10,7 @@ typedef void (*EnMkkActionFunc)(struct EnMkk*, GlobalContext*); typedef struct EnMkk { /* 0x0000 */ Actor actor; /* 0x0144 */ EnMkkActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x8C]; + /* 0x0148 */ char unk_148[0x8C]; } EnMkk; // size = 0x1D4 extern const ActorInit En_Mkk_InitVars; 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 e9a7793767..efc0ea175b 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -1,7 +1,7 @@ /* * File: z_en_ms.c * Overlay: ovl_En_Ms - * Description: Bean salesman + * Description: Bean Seller */ #include "z_en_ms.h" @@ -15,7 +15,11 @@ void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnMs_Update(Actor* thisx, GlobalContext* globalCtx); void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void EnMs_Wait(EnMs* this, GlobalContext* globalCtx); +void EnMs_Talk(EnMs* this, GlobalContext* globalCtx); +void EnMs_Sell(EnMs* this, GlobalContext* globalCtx); +void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx); + const ActorInit En_Ms_InitVars = { ACTOR_EN_MS, ACTORCAT_NPC, @@ -28,38 +32,156 @@ const ActorInit En_Ms_InitVars = { (ActorFunc)EnMs_Draw, }; -// static ColliderCylinderInitType1 sCylinderInit = { -static ColliderCylinderInitType1 D_80952BA0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInitType1 sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 22, 37, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80952BCC[] = { +static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -#endif +extern AnimationHeader D_060005EC; +extern FlexSkeletonHeader D_06003DC0; -extern ColliderCylinderInit D_80952BA0; -extern InitChainEntry D_80952BCC[]; +void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; -extern UNK_TYPE D_060005EC; + Actor_ProcessInitChain(thisx, sInitChain); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit); + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 35.0f); + Actor_SetScale(&this->actor, 0.015f); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; // Eating Magic Beans all day will do that to you + this->actionFunc = EnMs_Wait; + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.gravity = -1.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/EnMs_Init.s") +void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/EnMs_Destroy.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_80952734.s") +void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { + s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s") + if (gSaveContext.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { + this->actor.textId = 0x92E; // "[...] You're the first customer [...]" + } else { + this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_809529AC.s") + if (func_800B84D0(&this->actor, globalCtx) != 0) { + this->actionFunc = EnMs_Talk; + } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS_ALT(yawDiff) < 0x2000)) { + func_800B8614(&this->actor, globalCtx, 90.0f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_80952A1C.s") +void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { + switch (func_80152498(&globalCtx->msgCtx)) { + case 6: + if (func_80147624(globalCtx) != 0) { + this->actionFunc = EnMs_Wait; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/EnMs_Update.s") + case 5: + if (func_80147624(globalCtx) != 0) { + func_801477B4(globalCtx); + func_800B8A1C(&this->actor, globalCtx, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, + this->actor.playerHeightRel); + this->actionFunc = EnMs_Sell; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/EnMs_Draw.s") + case 4: + if (func_80147624(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: // yes + func_801477B4(globalCtx); + if (gSaveContext.rupees < 10) { + play_sound(NA_SE_SY_ERROR); + func_80151938(globalCtx, 0x935); // "[...] You don't have enough Rupees." + } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { + play_sound(NA_SE_SY_ERROR); + func_80151938(globalCtx, 0x937); // "[...] You can't carry anymore." + } else { + func_8019F208(); + func_800B8A1C(&this->actor, globalCtx, GI_MAGIC_BEANS, 90.0f, 10.0f); + func_801159EC(-10); + this->actionFunc = EnMs_Sell; + } + break; + + case 1: // no + default: + func_8019F230(); + func_80151938(globalCtx, 0x934); // "[...] Well, if your mood changes [...]" + break; + } + } + break; + default: + break; + } +} + +void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.textId = 0; + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + this->actionFunc = EnMs_TalkAfterPurchase; + } else { + func_800B8A1C(&this->actor, globalCtx, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + } +} + +void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx) { + if (func_800B84D0(&this->actor, globalCtx)) { + func_80151938(globalCtx, 0x936); // "You can plant 'em whenever you want [...]" + this->actionFunc = EnMs_Talk; + } else { + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + } +} + +void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMs* this = THIS; + + Actor_SetHeight(&this->actor, 20.0f); + this->actor.targetArrowOffset = 500.0f; + Actor_SetScale(&this->actor, 0.015f); + SkelAnime_Update(&this->skelAnime); + this->actionFunc(this, globalCtx); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} + +void EnMs_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnMs* this = THIS; + + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, NULL, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index cfacb7f60e..2efbdea458 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -8,10 +8,12 @@ struct EnMs; typedef void (*EnMsActionFunc)(struct EnMs*, GlobalContext*); typedef struct EnMs { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0xB0]; - /* 0x01F4 */ EnMsActionFunc actionFunc; - /* 0x01F8 */ char unk_1F8[0x4C]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[9]; + /* 0x1BE */ Vec3s morphTable[9]; + /* 0x1F4 */ EnMsActionFunc actionFunc; + /* 0x1F8 */ ColliderCylinder collider; } EnMs; // size = 0x244 extern const ActorInit En_Ms_InitVars; diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h index 58c625b361..796482b141 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h @@ -10,7 +10,7 @@ typedef void (*EnMttagActionFunc)(struct EnMttag*, GlobalContext*); typedef struct EnMttag { /* 0x0000 */ Actor actor; /* 0x0144 */ EnMttagActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x20]; + /* 0x0148 */ char unk_148[0x20]; } EnMttag; // size = 0x168 extern const ActorInit En_Mt_tag_InitVars; 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 0969c123ab..b2792ec129 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -321,7 +321,7 @@ s32 func_80A68F9C(EnMushi2* this, s16 arg1) { matrix->mf[3][2] = 0.0f; matrix->mf[3][3] = 0.0f; - Matrix_RotateY(arg1, 1); + Matrix_RotateY(arg1, MTXMODE_APPLY); this->unk_310.x = matrix->mf[0][0]; this->unk_310.y = matrix->mf[0][1]; @@ -368,7 +368,7 @@ s32 func_80A690C4(EnMushi2* this, s16 arg1) { matrix->mf[3][2] = 0.0f; matrix->mf[3][3] = 0.0f; - Matrix_InsertXRotation_s(arg1, 1); + Matrix_InsertXRotation_s(arg1, MTXMODE_APPLY); this->unk_310.x = matrix->mf[0][0]; this->unk_310.y = matrix->mf[0][1]; 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 e2fba46080..131fbebcc3 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -144,7 +144,7 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { if (1) {} // Needed to match - if (!this->isInMayorsRoom && Player_GetMask(globalCtx) == PLAYER_MASK_KAFEI) { + if (!this->isInMayorsRoom && Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { this->actor.textId = 0x2363; } 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 3eadcc15ec..c65d794bb6 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1007,7 +1007,7 @@ void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx) { } Matrix_InsertTranslation(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(feather->scale, feather->scale, 1.0f, MTXMODE_APPLY); Matrix_InsertZRotation_f(feather->zRot, MTXMODE_APPLY); Matrix_InsertTranslation(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); 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 d2140a16e3..10f9a1783e 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -171,7 +171,7 @@ void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C28C(globalCtx->state.gfxCtx); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); Matrix_InsertZRotation_s(this->actor.home.rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_04058BA0); 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 0c6cfe423d..53b63236e1 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 @@ -10,7 +10,7 @@ typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, GlobalContext*); typedef struct EnOkarinaTag { /* 0x0000 */ Actor actor; /* 0x0144 */ EnOkarinaTagActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x14]; + /* 0x0148 */ char unk_148[0x14]; } EnOkarinaTag; // size = 0x15C extern const ActorInit En_Okarina_Tag_InitVars; 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 d6c95bad6e..65fd93e867 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -506,7 +506,7 @@ void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx) { Vec3f sp30; sp3E = Actor_YawToPoint(&player->actor, &this->unk_394); - Matrix_RotateY(BINANG_ADD(sp3E, 0x4000), 0); + Matrix_RotateY(BINANG_ADD(sp3E, 0x4000), MTXMODE_NEW); if (this->unk_33C == 2) { Matrix_GetStateTranslationAndScaledZ(26.259998f, &sp30); } else { @@ -1132,7 +1132,7 @@ void func_80B5E078(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { sp54.x = arg1->unk_30; sp54.y = arg1->unk_34; sp54.z = 0.0f; - Matrix_RotateY(temp, 0); + Matrix_RotateY(temp, MTXMODE_NEW); Matrix_MultiplyVector3fByState(&sp54, &arg1->unk_0C); Math_Vec3f_Sum(&arg1->unk_0C, &arg1->unk_50, &arg1->unk_0C); arg1->unk_4C--; 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 514245a327..ab5e2520a1 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -1172,9 +1172,9 @@ void func_8095D074(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); - Matrix_InsertTranslation(0.0f, 500.0f, 0.0f, 1); - Matrix_InsertXRotation_s(this->unk_3D8 - 0x4000, 1); - Matrix_InsertTranslation(0.0f, 0.0f, -500.0f, 1); + Matrix_InsertTranslation(0.0f, 500.0f, 0.0f, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->unk_3D8 - 0x4000, MTXMODE_APPLY); + Matrix_InsertTranslation(0.0f, 0.0f, -500.0f, MTXMODE_APPLY); if (this->unk_3DC >= 0x20) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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 8993cb14a4..9d15d2df31 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -335,7 +335,7 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) { Math3D_CrossProduct(&this->unk_2DC, &floorNorm, &vec2); EnPametfrog_Vec3fNormalize(&vec2); - Matrix_InsertRotationAroundUnitVector_f(rotation, &vec2, 0); + Matrix_InsertRotationAroundUnitVector_f(rotation, &vec2, MTXMODE_NEW); Matrix_MultiplyVector3fByState(&this->unk_2E8, &vec2); Math_Vec3f_Copy(&this->unk_2E8, &vec2); Math3D_CrossProduct(&this->unk_2E8, &floorNorm, &this->unk_2D0); diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.h b/src/overlays/actors/ovl_En_Paper/z_en_paper.h index d2e12e137d..0147442a92 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.h +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.h @@ -10,7 +10,7 @@ typedef void (*EnPaperActionFunc)(struct EnPaper*, GlobalContext*); typedef struct EnPaper { /* 0x0000 */ Actor actor; /* 0x0144 */ EnPaperActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xC40]; + /* 0x0148 */ char unk_148[0xC40]; } EnPaper; // size = 0xD88 extern const ActorInit En_Paper_InitVars; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 2cf6b353fa..5cb68e3df7 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -671,7 +671,7 @@ UNK_TYPE* func_80AF8540(EnPm* this, GlobalContext* globalCtx) { return D_80AFB650; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEI) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { return D_80AFB744; } @@ -861,7 +861,7 @@ void func_80AF8C68(EnPm* this, GlobalContext* globalCtx) { this->unk_360 = 0.0f; } Math_SmoothStepToF(&this->unk_364, this->unk_360, 0.8f, 40.0f, 10.0f); - Matrix_InsertTranslation(this->unk_364, 0.0f, 0.0f, 1); + Matrix_InsertTranslation(this->unk_364, 0.0f, 0.0f, MTXMODE_APPLY); this->unk_388 = sp28; } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.h b/src/overlays/actors/ovl_En_Pm/z_en_pm.h index d571f43bd6..6d545373b8 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.h +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.h @@ -24,11 +24,11 @@ typedef struct EnPm { /* 0x0250 */ s32 unk_250; /* 0x0254 */ s32 unk_254; /* 0x0258 */ u8 unk_258; - /* 0x026C */ UNK_TYPE* unk_25C; + /* 0x025C */ UNK_TYPE* unk_25C; /* 0x0260 */ s8 unk_260; /* 0x0264 */ s32 unk_264; /* 0x0268 */ Actor* unk_268; - /* 0x0268 */ Vec3f unk_26C; + /* 0x026C */ Vec3f unk_26C; /* 0x0278 */ Vec3f unk_278; /* 0x0284 */ Vec3f unk_284; /* 0x0290 */ Vec3s unk_290; 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 08fbedeaf1..4042aecac7 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -893,7 +893,8 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve if (limbIndex == 18) { if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 19) && (this->actor.scale.x != 0.0f)) { - Matrix_Scale(0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 1); + Matrix_Scale(0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, + MTXMODE_APPLY); } Matrix_CopyCurrentState(&this->unk_3D8); func_80B2C910(&sp60, globalCtx); diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h index da4ced9ddf..a4b721f5de 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h @@ -10,7 +10,7 @@ typedef void (*EnRacedogActionFunc)(struct EnRacedog*, GlobalContext*); typedef struct EnRacedog { /* 0x0000 */ Actor actor; /* 0x0144 */ EnRacedogActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x180]; + /* 0x0148 */ char unk_148[0x180]; } EnRacedog; // size = 0x2C8 extern const ActorInit En_Racedog_InitVars; 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 6c3afaa6f0..07f3ca850a 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -15,7 +15,11 @@ void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void EnRecepgirl_SetupWait(EnRecepgirl* this); +void EnRecepgirl_Wait(EnRecepgirl* this, GlobalContext* globalCtx); +void EnRecepgirl_SetupTalk(EnRecepgirl* this); +void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx); + const ActorInit En_Recepgirl_InitVars = { ACTOR_EN_RECEPGIRL, ACTORCAT_NPC, @@ -28,38 +32,193 @@ const ActorInit En_Recepgirl_InitVars = { (ActorFunc)EnRecepgirl_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C106C0[] = { +extern TexturePtr D_0600F8F0; +extern TexturePtr D_0600FCF0; +extern TexturePtr D_060100F0; + +static TexturePtr sEyeTextures[] = { &D_0600F8F0, &D_0600FCF0, &D_060100F0, &D_0600FCF0 }; + +static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), }; -#endif +static s32 texturesDesegmented = false; -extern InitChainEntry D_80C106C0[]; +extern AnimationHeader D_06000968; +extern AnimationHeader D_06001384; +extern AnimationHeader D_06009890; +extern AnimationHeader D_0600A280; +extern AnimationHeader D_0600AD98; +extern FlexSkeletonHeader D_06011B60; -extern UNK_TYPE D_06001384; -extern UNK_TYPE D_06009890; -extern UNK_TYPE D_0600A280; +void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { + EnRecepgirl* this = THIS; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Destroy.s") + if (!texturesDesegmented) { + for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); + } + texturesDesegmented = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s") + this->eyeTexIndex = 2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10148.s") + if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; // hear directions again? + } else { + this->actor.textId = 0x2AD9; // "Welcome..." + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C1019C.s") + EnRecepgirl_SetupWait(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10290.s") +void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C102D4.s") +void EnRecepgirl_UpdateEyes(EnRecepgirl* 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_Recepgirl/EnRecepgirl_Update.s") +void EnRecepgirl_SetupWait(EnRecepgirl* this) { + if (this->skelAnime.animation == &D_06001384) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } + this->actionFunc = EnRecepgirl_Wait; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") +void EnRecepgirl_Wait(EnRecepgirl* this, GlobalContext* globalCtx) { + if (SkelAnime_Update(&this->skelAnime) != 0) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); + } else { + Animation_MorphToLoop(&this->skelAnime, &D_06009890, -4.0f); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") + if (func_800B84D0(&this->actor, globalCtx) != 0) { + EnRecepgirl_SetupTalk(this); + } else if (Actor_IsActorFacingLink(&this->actor, 0x2000)) { + func_800B8614(&this->actor, globalCtx, 60.0f); + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?" + } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + this->actor.textId = 0x2ADC; // hear directions again? + } else { + this->actor.textId = 0x2AD9; // "Welcome..." + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") +void EnRecepgirl_SetupTalk(EnRecepgirl* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + this->actionFunc = EnRecepgirl_Talk; +} + +void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx) { + u8 temp_v0_2; + + if (SkelAnime_Update(&this->skelAnime)) { + if (this->skelAnime.animation == &D_0600A280) { + Animation_PlayLoop(&this->skelAnime, &D_06001384); + } else if (this->skelAnime.animation == &D_0600AD98) { + if (this->actor.textId == 0x2ADA) { // Mayor's office is on the left (meeting ongoing) + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + } else { + Animation_MorphToLoop(&this->skelAnime, &D_06009890, 10.0f); + } + } else { + if (this->actor.textId == 0x2ADA) { // Mayor's office is on the left (meeting ongoing) + Animation_MorphToLoop(&this->skelAnime, &D_06009890, 10.0f); + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); + } + } + } + + temp_v0_2 = func_80152498(&globalCtx->msgCtx); + if (temp_v0_2 == 2) { + this->actor.textId = 0x2ADC; // hear directions again? + EnRecepgirl_SetupWait(this); + } else if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) { + if (this->actor.textId == 0x2AD9) { // "Welcome..." + Actor_SetSwitchFlag(globalCtx, this->actor.params); + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + + if (gSaveContext.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting + this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) + } else { + this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) + } + } else if (this->actor.textId == 0x2ADC) { // hear directions again? + Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); + this->actor.textId = 0x2ADD; // "So..." + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &D_06000968, 10.0f); + + if (this->actor.textId == 0x2ADD) { // "So..." + 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 + } else { + this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment + } + } + func_80151938(globalCtx, this->actor.textId); + } +} + +void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnRecepgirl* this = THIS; + Vec3s sp30; + + this->actionFunc(this, globalCtx); + func_800E9250(globalCtx, &this->actor, &this->headRot, &sp30, this->actor.focus.pos); + EnRecepgirl_UpdateEyes(this); +} + +s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + rot->x += this->headRot.y; + } + return false; +} + +void EnRecepgirl_UnkLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { + EnRecepgirl* this = THIS; + + if (limbIndex == 5) { + Matrix_RotateY(0x400 - this->headRot.x, MTXMODE_APPLY); + Matrix_GetStateTranslationAndScaledX(500.0f, &this->actor.focus.pos); + } +} + +void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnRecepgirl* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->eyeTexIndex]); + + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRecepgirl_OverrideLimbDraw, NULL, EnRecepgirl_UnkLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} 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 0b7cbe0737..a6b858192b 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h @@ -8,10 +8,13 @@ struct EnRecepgirl; typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); typedef struct EnRecepgirl { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x164]; - /* 0x02A8 */ EnRecepgirlActionFunc actionFunc; - /* 0x02AC */ char unk_2AC[0x8]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[24]; + /* 0x218 */ Vec3s morphTable[24]; + /* 0x2A8 */ EnRecepgirlActionFunc actionFunc; + /* 0x2AC */ u8 eyeTexIndex; + /* 0x2AE */ Vec3s headRot; } EnRecepgirl; // size = 0x2B4 extern const ActorInit En_Recepgirl_InitVars; 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 7b4b928b7c..3adecaad3f 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c @@ -72,7 +72,7 @@ s32 EnRsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, EnRsn* this = (EnRsn*)arg; if (limbIndex == 14) { - Matrix_InsertXRotation_s(this->unk1D8.y, 1); + Matrix_InsertXRotation_s(this->unk1D8.y, MTXMODE_APPLY); } return 0; } 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 9b1037ed4d..b368fb584f 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -10,7 +10,7 @@ typedef void (*EnRuActionFunc)(struct EnRu*, GlobalContext*); typedef struct EnRu { /* 0x0000 */ Actor actor; /* 0x0144 */ EnRuActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x30C]; + /* 0x0148 */ char unk_148[0x30C]; } EnRu; // size = 0x454 extern const ActorInit En_Ru_InitVars; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.h b/src/overlays/actors/ovl_En_Shn/z_en_shn.h index 8f02bd8c57..b5d98919d9 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.h +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.h @@ -10,7 +10,7 @@ typedef void (*EnShnActionFunc)(struct EnShn*, GlobalContext*); typedef struct EnShn { /* 0x0000 */ Actor actor; /* 0x0144 */ EnShnActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x1A8]; + /* 0x0148 */ char unk_148[0x1A8]; } EnShn; // size = 0x2F0 extern const ActorInit En_Shn_InitVars; diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.h b/src/overlays/actors/ovl_En_Si/z_en_si.h index 60a7937a98..26e33e728a 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -10,7 +10,7 @@ typedef void (*EnSiActionFunc)(struct EnSi*, GlobalContext*); typedef struct EnSi { /* 0x0000 */ Actor actor; /* 0x0144 */ EnSiActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x58]; + /* 0x0148 */ char unk_148[0x58]; } EnSi; // size = 0x1A0 extern const ActorInit En_Si_InitVars; 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 6269f331e6..c24cae04e1 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.h +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.h @@ -10,7 +10,7 @@ typedef void (*EnSlimeActionFunc)(struct EnSlime*, GlobalContext*); typedef struct EnSlime { /* 0x0000 */ Actor actor; /* 0x0144 */ EnSlimeActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xC0]; + /* 0x0148 */ char unk_148[0xC0]; } EnSlime; // size = 0x208 extern const ActorInit En_Slime_InitVars; 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 53212d0bfb..140fc2c710 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -264,7 +264,7 @@ u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) { return 0x688; case PLAYER_MASK_BLAST: return 0x689; - case PLAYER_MASK_KAFEI: + case PLAYER_MASK_KAFEIS_MASK: return 0x68A; } } else if (this->shopType == ZORA_SHOP) { @@ -1695,7 +1695,7 @@ void EnSob1_DrawBombShopkeeper(Actor* thisx, GlobalContext* globalCtx) { EnSob1_DrawStickDirectionPrompt(globalCtx, this); frames = globalCtx->gameplayFrames; func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, 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 975e4e36d8..4c30b49655 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -43,7 +43,7 @@ typedef struct EnSw { /* 0x047C */ s16 unk_47C[12]; /* 0x0494 */ s16 unk_494; /* 0x0496 */ s16 unk_496; - /* 0x0468 */ s16 unk_498; + /* 0x0498 */ s16 unk_498; /* 0x049C */ s32 unk_49C; /* 0x04A0 */ s32 unk_4A0; } EnSw; // size = 0x4A4 diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h index 22dd08e893..5e9512c7cf 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h @@ -10,7 +10,7 @@ typedef void (*EnTanron2ActionFunc)(struct EnTanron2*, GlobalContext*); typedef struct EnTanron2 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnTanron2ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xB4]; + /* 0x0148 */ char unk_148[0xB4]; } EnTanron2; // size = 0x1FC extern const ActorInit En_Tanron2_InitVars; 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 2de774191f..313a0a1fdb 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -1,10 +1,11 @@ /* * File: z_en_tanron3.c * Overlay: ovl_En_Tanron3 - * Description: Small Fish summoned by Gyorg + * Description: Small fish summoned by Gyorg */ #include "z_en_tanron3.h" +#include "overlays/actors/ovl_Boss_03/z_boss_03.h" #define FLAGS 0x00000035 @@ -15,7 +16,14 @@ void EnTanron3_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx); void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx); +void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx); +void EnTanron3_Die(EnTanron3* this, GlobalContext* globalCtx); + +static Vec3f sZeroVec[] = { 0.0f, 0.0f, 0.0f }; + +static Boss03* sGyorg = NULL; + const ActorInit En_Tanron3_InitVars = { ACTOR_EN_TANRON3, ACTORCAT_BOSS, @@ -28,39 +36,419 @@ const ActorInit En_Tanron3_InitVars = { (ActorFunc)EnTanron3_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BB9750 = { - { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x02 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x00, 0x02 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 7, 10, -5, { 0, 0, 0 } }, }; -#endif +// This actor has two colliders (one for AC and one for AT), but uses the same +// ColliderCylinderInit for both of them, leaving this one totally unused. +static ColliderCylinderInit sUnusedCylinderInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x00, 0x02 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, + { 20, 20, -10, { 0, 0, 0 } }, +}; -extern ColliderCylinderInit D_80BB9750; +extern FlexSkeletonHeader D_0600DA20; +extern AnimationHeader D_0600DAAC; -extern UNK_TYPE D_0600DAAC; +void EnTanron3_CreateEffect(GlobalContext* globalCtx, Vec3f* effectPos) { + UnkTanron3Effect* effectPtr = (UnkTanron3Effect*)globalCtx->specialEffects; + s16 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB85A0.s") + for (i = 0; i < 150; i++, effectPtr++) { + if ((effectPtr->type == 0) || (effectPtr->type == 1)) { + effectPtr->type = 2; + effectPtr->pos = *effectPos; + effectPtr->velocity = *sZeroVec; + effectPtr->accel = *sZeroVec; + effectPtr->accel.y = -2.0f; + effectPtr->unk_34.x = 0.1f; + effectPtr->unk_34.y = 0.0f; + effectPtr->unk_34.z = Rand_ZeroFloat(2 * M_PI); + effectPtr->unk_02 = Rand_ZeroFloat(100.0f); + effectPtr->velocity.x = randPlusMinusPoint5Scaled(25.0f); + effectPtr->velocity.z = randPlusMinusPoint5Scaled(25.0f); + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/EnTanron3_Init.s") +void EnTanron3_Init(Actor* thisx, GlobalContext* globalCtx) { + EnTanron3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/EnTanron3_Destroy.s") + this->actor.gravity = -1.0f; + Collider_InitAndSetCylinder(globalCtx, &this->atCollider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(globalCtx, &this->acCollider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600DA20, &D_0600DAAC, this->jointTable, this->morphTable, 10); + Actor_SetScale(&this->actor, 0.02f); + EnTanron3_SetupLive(this, globalCtx); + this->actor.flags &= ~1; + this->currentRotationAngle = Rand_ZeroFloat(500000.0f); + this->waterSurfaceYPos = 430.0f; + sGyorg = (Boss03*)this->actor.parent; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB87D4.s") +void EnTanron3_Destroy(Actor* thisx, GlobalContext* globalCtx) { + sGyorg->unk_252--; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB897C.s") +void EnTanron3_SpawnBubbles(EnTanron3* this, GlobalContext* globalCtx) { + static Color_RGBA8 sPrimColor = { 100, 55, 55, 255 }; + static Color_RGBA8 sEnvColor = { 50, 10, 10, 255 }; + s32 i; + Vec3f velocity; + Vec3f acceleration; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB8A48.s") + for (i = 0; i < 20; i++) { + Matrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); + Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI)); + Matrix_GetStateTranslationAndScaledZ(Rand_ZeroFloat(3.0f) + 2.0f, &velocity); + acceleration.x = velocity.x * -0.05f; + acceleration.y = velocity.y * -0.05f; + acceleration.z = velocity.z * -0.05f; + EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor, + &sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB91D4.s") +void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx) { + this->actionFunc = EnTanron3_Live; + Animation_MorphToLoop(&this->skelAnime, &D_0600DAAC, -10.0f); + this->rotationStep = 0; + this->rotationScale = 5; + this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] = 50; + this->actor.speedXZ = 5.0f; + this->speedMaxStep = 0.5f; + this->deviation.x = randPlusMinusPoint5Scaled(500.0f); + this->deviation.y = randPlusMinusPoint5Scaled(100.0f); + this->deviation.z = randPlusMinusPoint5Scaled(500.0f); + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + this->timer = Rand_ZeroFloat(100.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB9288.s") +/** + * This controls the vast majority of the fish's behavior while it's alive, including: + * - deciding whether to be hostile or not + * - determing whether the fish is beached or not + * - swimming towards the player to attack them + * - swimming around idly if the player is out of range + * - flopping around on land if it beaches itself + */ +void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { + s32 atanTemp; + f32 xDistance; + f32 yDistance; + f32 zDistance; + f32 xzDistance; + f32 extraScaleY = 0.0f; + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB9308.s") + this->skelAnime.curFrame = 4.0f; + if ((player->actor.bgCheckFlags & 1) && player->actor.shape.feetPos[0].y >= 438.0f) { + // Player is standing on the central platform, so stop chasing them + this->isNonHostile = true; + } else if (this->isNonHostile && this->workTimer[TANRON3_WORK_TIMER_WAIT] == 0 && !(this->timer & 0x1F)) { + xDistance = this->targetPos.x - player->actor.world.pos.x; + zDistance = this->targetPos.z - player->actor.world.pos.z; + if (sqrtf(SQ(xDistance) + SQ(zDistance)) < 500.0f) { + // Player is in the water and close enough, so start chasing them + this->isNonHostile = false; + this->workTimer[TANRON3_WORK_TIMER_ATTACK] = 150; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/EnTanron3_Update.s") + if (this->actor.world.pos.y < this->waterSurfaceYPos) { + // The fish is below the water's surface, so it's no longer beached if it was before + this->isBeached = false; + switch (this->isNonHostile) { + case false: + this->targetSpeedXZ = 5.0f; + this->targetRotationStep = 0x1000; + this->nextRotationAngle = 0x3A98; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/func_80BB95FC.s") + Math_Vec3f_Copy(&this->targetPos, &player->actor.world.pos); + if (!(this->timer & 0xF)) { + if (Rand_ZeroOne() < 0.5f && this->actor.xzDistToPlayer <= 200.0f) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIRANHA_ATTACK); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tanron3/EnTanron3_Draw.s") + // If the player gets eaten by Gyorg, or if the attack timer ran out, + // stop chasing the player for a little bit. + if (this->workTimer[TANRON3_WORK_TIMER_ATTACK] == 0 || (player->stateFlags2 & 0x80)) { + this->workTimer[TANRON3_WORK_TIMER_WAIT] = 150; + this->isNonHostile = true; + } + break; + case true: + if (sGyorg->unk_324 != 0 && !(this->timer & 0x7)) { + this->nextRotationAngle = 0x4E20; + this->actor.speedXZ = 6.0f; + } else { + this->nextRotationAngle = 0x1F40; + } + this->targetRotationStep = 0x200; + this->targetSpeedXZ = 2.0f; + + // If the fish is idly swimming around, this code will make it spin in a circle. + // Its target is constantly updated, so it constantly rotates to face it, and its + // momentum keeps it spinning. This code can also be reached when the fish "give up" + // on attacking the player; in that case, this code will make it turn in the + // opposite direction and swim away. In both cases, the fish's target y-position + // will be slightly above the halfway point of the water. + atanTemp = Math_FAtan2F(this->targetPos.z, this->targetPos.x); + Matrix_RotateY(atanTemp, MTXMODE_NEW); + Matrix_GetStateTranslationAndScaledZ(700.0f, &this->targetPos); + this->targetPos.y = 250.0f; + + extraScaleY = 150.0f; + break; + } + + if (this->workTimer[TANRON3_WORK_TIMER_OUT_OF_WATER] == 0) { + if (this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speedXZ > 1.0f) { + this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); + this->deviation.x = randPlusMinusPoint5Scaled(100.0f); + this->deviation.y = randPlusMinusPoint5Scaled(50.0f + extraScaleY); + this->deviation.z = randPlusMinusPoint5Scaled(100.0f); + } + this->targetPosWithDeviation.y = this->targetPos.y + this->deviation.y + 50.0f; + } + + this->targetPosWithDeviation.x = this->targetPos.x + this->deviation.x; + this->targetPosWithDeviation.z = this->targetPos.z + this->deviation.z; + xDistance = this->targetPosWithDeviation.x - this->actor.world.pos.x; + yDistance = this->targetPosWithDeviation.y - this->actor.world.pos.y; + zDistance = this->targetPosWithDeviation.z - this->actor.world.pos.z; + + // Rotate the fish to look towards its target + xzDistance = sqrtf(SQ(xDistance) + SQ(zDistance)); + atanTemp = Math_FAtan2F(xzDistance, -yDistance); + Math_ApproachS(&this->actor.world.rot.x, atanTemp, this->rotationScale, this->rotationStep); + atanTemp = Math_FAtan2F(zDistance, xDistance); + Math_SmoothStepToS(&this->actor.world.rot.y, atanTemp, this->rotationScale, this->rotationStep, 0); + Math_ApproachS(&this->rotationStep, this->targetRotationStep, 1, 0x100); + + Math_ApproachF(&this->actor.speedXZ, this->targetSpeedXZ, 1.0f, this->speedMaxStep); + Actor_SetVelocityAndMoveXYRotationReverse(&this->actor); + } else { + switch (this->isBeached) { + case false: + // Fish is above water but hasn't touched land before + this->actor.gravity = -1.0f; + this->targetPosWithDeviation.y = this->waterSurfaceYPos - 50.0f; + this->workTimer[TANRON3_WORK_TIMER_OUT_OF_WATER] = 25; + Math_ApproachS(&this->actor.world.rot.x, 0x3000, 5, 0xBD0); + if (this->actor.bgCheckFlags & 8) { + this->actor.speedXZ = 0.0f; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = -1.0f; + } + } + if (this->actor.bgCheckFlags & 1) { + // Fish has touched land + this->isBeached = true; + } + break; + case true: + this->nextRotationAngle = 0x3A98; + this->actor.gravity = -1.5f; + if (this->actor.bgCheckFlags & 1) { + // Fish is still touching land, so it's still beached. Randomly flop around + this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 5.0f; + this->actor.speedXZ = Rand_ZeroFloat(2.0f) + 2.0f; + if (Rand_ZeroOne() < 0.5f) { + this->targetShapeRotation.x = + (s16)randPlusMinusPoint5Scaled(500.0f) + this->targetShapeRotation.x + 0x8000; + } + if (Rand_ZeroOne() < 0.5f) { + this->targetShapeRotation.z = + (s16)randPlusMinusPoint5Scaled(500.0f) + this->targetShapeRotation.z + 0x8000; + } + if (Rand_ZeroOne() < 0.5f) { + this->targetShapeRotation.y = (s16)Rand_ZeroFloat(0x10000); + } + this->actor.world.rot.y = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x) + + (s16)randPlusMinusPoint5Scaled(0xCE20); + } + + Math_ApproachS(&this->actor.shape.rot.y, this->targetShapeRotation.y, 3, 0x500); + Math_ApproachS(&this->actor.shape.rot.x, this->targetShapeRotation.x, 3, 0xC00); + Math_ApproachS(&this->actor.shape.rot.z, this->targetShapeRotation.z, 3, 0xC00); + if ((Rand_ZeroOne() < 0.5f) & !(this->timer & 0x3)) { + Vec3f effectPos; + + effectPos.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x; + effectPos.y = this->actor.world.pos.y; + effectPos.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z; + EnTanron3_CreateEffect(globalCtx, &effectPos); + } + break; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + } + + this->currentRotationAngle += this->nextRotationAngle; + this->trunkRotation = Math_SinS(this->currentRotationAngle) * 5000.0f; + this->bodyRotation = Math_SinS(this->currentRotationAngle + 0x6978) * 5000.0f; + this->tailRotation = Math_SinS(this->currentRotationAngle) * 5000.0f; + if (!this->isBeached) { + this->actor.shape.rot = this->actor.world.rot; + } +} + +void EnTanron3_SetupDie(EnTanron3* this, GlobalContext* globalCtx) { + f32 xDistance; + f32 yDistance; + f32 zDistance; + Player* player = GET_PLAYER(globalCtx); + + this->actionFunc = EnTanron3_Die; + xDistance = this->actor.world.pos.x - player->actor.world.pos.x; + yDistance = this->actor.world.pos.y - player->actor.world.pos.y + 30.0f; + zDistance = this->actor.world.pos.z - player->actor.world.pos.z; + this->actor.world.rot.x = Math_FAtan2F(sqrtf(SQ(xDistance) + SQ(zDistance)), -yDistance); + this->actor.world.rot.y = Math_FAtan2F(zDistance, xDistance); + this->workTimer[TANRON3_WORK_TIMER_DIE] = 6; + this->actor.speedXZ = 10.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KONB_MINI_DEAD); +} + +void EnTanron3_Die(EnTanron3* this, GlobalContext* globalCtx) { + Actor_SetVelocityAndMoveXYRotationReverse(&this->actor); + if (this->workTimer[TANRON3_WORK_TIMER_DIE] == 0) { + EnTanron3_SpawnBubbles(this, globalCtx); + Actor_MarkForDeath(&this->actor); + if (Rand_ZeroOne() < 0.3f) { + Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x60); + } + } +} + +void EnTanron3_CheckCollisions(EnTanron3* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (player->actor.world.pos.y > 350.0f) { + if (this->atCollider.base.atFlags & AT_HIT) { + this->atCollider.base.atFlags &= ~AT_HIT; + func_800B8D50(globalCtx, NULL, 3.0f, Math_FAtan2F(-player->actor.world.pos.z, -player->actor.world.pos.x), + 5.0f, 0); + } + } + if (this->acCollider.base.acFlags & AC_HIT) { + this->acCollider.base.acFlags &= ~AC_HIT; + if (this->deathTimer == 0) { + this->deathTimer = 15; + this->fogTimer = 15; + EnTanron3_SetupDie(this, globalCtx); + sGyorg->unk_324 = 20; + } + } +} + +void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnTanron3* this = THIS; + s16 i; + Vec3f splashPos; + + if (KREG(63) == 0) { + this->timer++; + + for (i = 0; i < TANRON3_WORK_TIMER_MAX; i++) { + if (this->workTimer[i] != 0) { + this->workTimer[i]--; + } + } + if (this->deathTimer != 0) { + this->deathTimer--; + } + if (this->fogTimer != 0) { + this->fogTimer--; + } + + this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 20.0f, 5); + + // The fish has either just entered or just exited the water, so create a splash effect + if (((this->actor.prevPos.y < this->waterSurfaceYPos) && (this->waterSurfaceYPos <= this->actor.world.pos.y)) || + ((this->actor.prevPos.y > this->waterSurfaceYPos) && (this->waterSurfaceYPos >= this->actor.world.pos.y))) { + splashPos.x = this->actor.world.pos.x; + splashPos.y = this->waterSurfaceYPos + 10.0f; + splashPos.z = this->actor.world.pos.z; + EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, 1, 500); + Audio_PlayActorSound2(&this->actor, NA_SE_EV_OUT_OF_WATER); + } + } + + EnTanron3_CheckCollisions(this, globalCtx); + Collider_UpdateCylinder(&this->actor, &this->atCollider); + Collider_UpdateCylinder(&this->actor, &this->acCollider); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->atCollider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->acCollider.base); + + if ((s8)sGyorg->actor.colChkInfo.health <= 0 && this->actionFunc != EnTanron3_Die) { + EnTanron3_SetupDie(this, globalCtx); + this->workTimer[TANRON3_WORK_TIMER_DIE] = 0; + } +} + +s32 EnTanron3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnTanron3* this = THIS; + + if (limbIndex == 1) { + rot->y += this->bodyRotation; + } + if (limbIndex == 3) { + rot->y += this->tailRotation; + } + if (limbIndex == 4) { + rot->y += this->trunkRotation; + } + return false; +} + +void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnTanron3* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + if ((this->fogTimer % 2) != 0) { + POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099); + } + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTanron3_OverrideLimbDraw, NULL, &this->actor); + POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h index 885d65af9d..9a2cb25da7 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h @@ -7,10 +7,53 @@ struct EnTanron3; typedef void (*EnTanron3ActionFunc)(struct EnTanron3*, GlobalContext*); +#define TANRON3_WORK_TIMER_PICK_NEW_DEVIATION 0 +#define TANRON3_WORK_TIMER_DIE 0 +#define TANRON3_WORK_TIMER_OUT_OF_WATER 1 +#define TANRON3_WORK_TIMER_ATTACK 2 +#define TANRON3_WORK_TIMER_WAIT 2 +#define TANRON3_WORK_TIMER_MAX 3 + +typedef struct { + /* 0x00 */ u8 type; + /* 0x02 */ s16 unk_02; + /* 0x04 */ Vec3f pos; + /* 0x10 */ Vec3f velocity; + /* 0x1C */ Vec3f accel; + /* 0x28 */ char unk_28[0xC]; + /* 0x34 */ Vec3f unk_34; + /* 0x40 */ char unk_40[0x4]; +} UnkTanron3Effect; + typedef struct EnTanron3 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x1B4]; - /* 0x02F8 */ EnTanron3ActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[10]; + /* 0x1C4 */ Vec3s morphTable[10]; + /* 0x200 */ s16 timer; + /* 0x202 */ u8 isNonHostile; // If true, the fish will not move towards the player to attack them + /* 0x203 */ u8 isBeached; // If true, the fish is on the central platform flopping around + /* 0x204 */ s16 workTimer[TANRON3_WORK_TIMER_MAX]; + /* 0x20A */ s16 deathTimer; + /* 0x20C */ s16 fogTimer; + /* 0x210 */ Vec3f targetPosWithDeviation; // The destination that the fish actually ends up moving towards + /* 0x21C */ Vec3f targetPos; // The exact destination where the fish wants to be located + /* 0x228 */ Vec3f deviation; // A random amount of "noise" added to targetPos + /* 0x234 */ s16 rotationStep; + /* 0x236 */ s16 targetRotationStep; + /* 0x238 */ s16 rotationScale; + /* 0x23C */ f32 targetSpeedXZ; + /* 0x240 */ f32 speedMaxStep; + /* 0x244 */ f32 waterSurfaceYPos; + /* 0x248 */ Vec3s targetShapeRotation; + /* 0x250 */ s32 currentRotationAngle; + /* 0x254 */ s32 nextRotationAngle; + /* 0x258 */ s16 tailRotation; + /* 0x25A */ s16 trunkRotation; + /* 0x25C */ s16 bodyRotation; + /* 0x260 */ ColliderCylinder atCollider; + /* 0x2AC */ ColliderCylinder acCollider; + /* 0x2F8 */ EnTanron3ActionFunc actionFunc; } EnTanron3; // size = 0x2FC extern const ActorInit En_Tanron3_InitVars; diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index 69d550c8af..4da30599cb 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -1,7 +1,7 @@ /* * File: z_en_test5.c * Overlay: ovl_En_Test5 - * Description: Spring Water + * Description: Spring Water Modifier */ #include "z_en_test5.h" @@ -13,12 +13,9 @@ void EnTest5_Init(Actor* thisx, GlobalContext* globalCtx); void EnTest5_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTest5_Update(Actor* thisx, GlobalContext* globalCtx); - -void func_80A90478(EnTest5* this, GlobalContext* globalCtx); - +void EnTest5_HandleBottleAction(EnTest5* this, GlobalContext* globalCtx); void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc); -#if 0 const ActorInit En_Test5_InitVars = { ACTOR_EN_TEST5, ACTORCAT_ITEMACTION, @@ -31,14 +28,82 @@ const ActorInit En_Test5_InitVars = { (ActorFunc)NULL, }; -#endif +void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test5/EnTest5_SetupAction.s") +void EnTest5_Init(Actor* thisx, GlobalContext* globalCtx2) { + EnTest5* this = THIS; + GlobalContext* globalCtx = globalCtx2; + WaterBox* water; + f32 ySurface; // Unused -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test5/EnTest5_Init.s") + // If not spawned above a water source, immediately despawn + if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &ySurface, &water)) { + Actor_MarkForDeath(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test5/EnTest5_Destroy.s") + Math_Vec3s_ToVec3f(&this->minPos, &water->minPos); + this->xLength = (f32)water->xLength; + this->zLength = (f32)water->zLength; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test5/func_80A90478.s") + EnTest5_SetupAction(this, EnTest5_HandleBottleAction); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test5/EnTest5_Update.s") +void EnTest5_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void EnTest5_HandleBottleAction(EnTest5* this, GlobalContext* globalCtx) { + Player* player; + Vec3f playerPosRelativeToWater; + + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.parent = NULL; + return; + } + + player = GET_PLAYER(globalCtx); + + if (player->unk_388 == NULL || player->unk_384 != GI_MAX) { + Math_Vec3f_DistXYZAndStoreDiff(&this->minPos, &player->actor.world.pos, &playerPosRelativeToWater); + + // Make sure that the player is within the bounds of the water and deep enough to grab some + if (playerPosRelativeToWater.x >= 0.0f && playerPosRelativeToWater.x <= this->xLength && + playerPosRelativeToWater.z >= 0.0f && playerPosRelativeToWater.z <= this->zLength && + fabsf(playerPosRelativeToWater.y) < 100.0f && player->actor.depthInWater > 12.0f) { + func_800B8A1C(&this->actor, globalCtx, GI_MAX, this->actor.xzDistToPlayer, + fabsf(this->actor.playerHeightRel)); + } + } +} + +void EnTest5_Update(Actor* thisx, GlobalContext* globalCtx2) { + EnTest5* this = THIS; + GlobalContext* globalCtx = globalCtx2; + Vec3f steamPos; + CollisionPoly* poly; // Unused + s32 pad; // Unused + + this->actionFunc(this, globalCtx); + + // If it's the hot spring variant, generate steam clouds + if (ENTEST5_IS_HOT_SPRING(&this->actor) && (globalCtx->state.frames % 4) == 0) { + steamPos.x = (Rand_ZeroOne() * this->xLength) + this->minPos.x; + steamPos.y = this->minPos.y + 100.0f; + steamPos.z = (Rand_ZeroOne() * this->zLength) + this->minPos.z; + + if ((BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &steamPos) + 10.0f) < this->minPos.y) { + Vec3f steamVel; + + steamPos.y = this->minPos.y + 10.0f; + steamVel.y = 0.5f; + steamVel.x = 0.0f; + steamVel.z = 0.0f; + + EffectSsIceSmoke_Spawn(globalCtx, &steamPos, &steamVel, &D_801D15B0, + (s16)((-200) - (s32)(Rand_ZeroOne() * 50.0f))); + } + } +} 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 79ea87356b..539f5b3c26 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.h +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.h @@ -3,14 +3,18 @@ #include "global.h" -struct EnTest5; +#define ENTEST5_IS_HOT_SPRING(thisx) ((thisx)->params != 0) + +struct EnTest5; // SpringWaterModifier typedef void (*EnTest5ActionFunc)(struct EnTest5*, GlobalContext*); typedef struct EnTest5 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x14]; - /* 0x0158 */ EnTest5ActionFunc actionFunc; + /* 0x0144 */ Vec3f minPos; + /* 0x0150 */ f32 xLength; + /* 0x0154 */ f32 zLength; + /* 0x0158 */ EnTest5ActionFunc actionFunc; } EnTest5; // size = 0x15C extern const ActorInit En_Test5_InitVars; 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 94f2556228..9cee7cf1d2 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.h +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.h @@ -10,7 +10,7 @@ typedef void (*EnTest6ActionFunc)(struct EnTest6*, GlobalContext*); typedef struct EnTest6 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnTest6ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x140]; + /* 0x0148 */ char unk_148[0x140]; } EnTest6; // size = 0x288 extern const ActorInit En_Test6_InitVars; diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h index 706618774e..de0c6fd2e3 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -10,7 +10,7 @@ typedef void (*EnTgActionFunc)(struct EnTg*, GlobalContext*); typedef struct EnTg { /* 0x0000 */ Actor actor; /* 0x0144 */ EnTgActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x400]; + /* 0x0148 */ char unk_148[0x400]; } EnTg; // size = 0x548 extern const ActorInit En_Tg_InitVars; 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 64374e36c5..89973ff694 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -1078,7 +1078,7 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi OPEN_DISPS(globalCtx->state.gfxCtx); gfx = POLY_OPA_DISP; - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], this->unk_3E4); POLY_OPA_DISP = &gfx[2]; @@ -1136,7 +1136,7 @@ void func_80C13354(EnThiefbird* this, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) { if (ptr->unk_22 != 0) { Matrix_InsertTranslation(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); Matrix_RotateY(ptr->unk_1E, MTXMODE_APPLY); Matrix_InsertZRotation_s(ptr->unk_20, MTXMODE_APPLY); Matrix_InsertTranslation(0.0f, -10.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h index 69fb439fd9..11320af0cb 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h @@ -10,7 +10,7 @@ typedef void (*EnTrt2ActionFunc)(struct EnTrt2*, GlobalContext*); typedef struct EnTrt2 { /* 0x0000 */ Actor actor; /* 0x0144 */ EnTrt2ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x294]; + /* 0x0148 */ char unk_148[0x294]; } EnTrt2; // size = 0x3DC extern const ActorInit En_Trt2_InitVars; 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 240a4f2363..4874ac2496 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -5,6 +5,7 @@ */ #include "z_en_tru.h" +#include "objects/object_tru/object_tru.h" #define FLAGS 0x00000039 @@ -15,10 +16,46 @@ void EnTru_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTru_Update(Actor* thisx, GlobalContext* globalCtx); void EnTru_Draw(Actor* thisx, GlobalContext* globalCtx); +s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx); +s32 func_80A8777C(Actor* thisx, GlobalContext* globalCtx); +s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx); +s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx); +s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx); void func_80A87FD0(EnTru* this, GlobalContext* globalCtx); void func_80A881E0(EnTru* this, GlobalContext* globalCtx); -#if 0 +static UNK_TYPE D_80A88910[] = { + 0x0E08520C, + 0x16100000, +}; + +static UNK_TYPE D_80A88918[] = { + 0x0900000E, + 0x08630C12, + 0x16100000, +}; + +static UNK_TYPE D_80A88924[] = { + 0x0E08660C, + 0x10000000, +}; + +static UNK_TYPE D_80A8892C[] = { + 0x09000004, 0x00050E08, 0x650C1000, 0x1010000B, 0x0E08530C, 0x0F08540C, 0x1900040E, 0x08560C11, + 0x10100E00, 0xFF2B0000, 0x001E0027, 0x2C08640C, 0x2F00000C, 0x15090000, 0x0E08570C, 0x15090000, + 0x0E08580C, 0x15090000, 0x12102C08, 0x550C2F00, 0x000C100E, 0x08550C10, +}; + +static UNK_TYPE D_80A88984[] = { + 0x2CFFFF09, 0x00000E08, 0x640C1509, 0x00000E08, 0x570C1509, 0x00000E08, 0x580C1509, 0x00001210, +}; + +static UNK_TYPE D_80A889A4[] = { + 0x2CFFFF09, + 0x00000E08, + 0x550C1000, +}; + const ActorInit En_Tru_InitVars = { ACTOR_EN_TRU, ACTORCAT_NPC, @@ -31,91 +68,1193 @@ const ActorInit En_Tru_InitVars = { (ActorFunc)EnTru_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_80A8B2A0 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +#include "overlays/ovl_En_Tru/ovl_En_Tru.c" + +static Vec3f D_80A8B250 = { 0.0f, 0.02f, 0.0f }; + +static Color_RGBA8 D_80A8B25C[] = { + { 255, 20, 60, 0 }, { 255, 235, 160, 0 }, { 20, 60, 255, 0 }, + { 100, 100, 100, 0 }, { 255, 255, 200, 0 }, { 100, 100, 100, 0 }, +}; + +static f32 D_80A8B274[] = { 60.0f, 255.0f, 60.0f }; + +static UNK_TYPE D_80A8B280[] = { + &D_0408F7E0, &D_0408F3E0, &D_0408EFE0, &D_0408EBE0, &D_0408E7E0, &D_0408E3E0, &D_0408DFE0, &D_0408DBE0, +}; + +static ColliderSphereInit sSphereInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_SPHERE, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 0, { { 0, 0, 0 }, 32 }, 100 }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80A8B2CC = { 1, 20, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 20, 0, 0, MASS_IMMOVABLE }; +static ActorAnimationEntryS D_80A8B2D8[] = { + { &object_tru_Anim_00F9A0, 1.0f, 0, -1, 0, 0 }, { &object_tru_Anim_00F9A0, 1.0f, 0, -1, 0, -4 }, + { &object_tru_Anim_0108AC, 1.0f, 0, -1, 2, -4 }, { &object_tru_Anim_009348, 1.0f, 0, -1, 2, 0 }, + { &object_tru_Anim_00EEDC, 1.0f, 0, -1, 0, -4 }, { &object_tru_Anim_015CA0, 1.0f, 0, -1, 0, 0 }, + { &object_tru_Anim_015CA0, 1.0f, 0, -1, 0, -4 }, { &object_tru_Anim_014728, 1.0f, 0, -1, 2, 0 }, + { &object_tru_Anim_01B5C4, 1.0f, 0, -1, 2, 0 }, { &object_tru_Anim_007FA0, 1.0f, 0, -1, 2, -4 }, + { &object_tru_Anim_016B4C, 1.0f, 0, -1, 0, -4 }, { &object_tru_Anim_011F88, 1.0f, 0, -1, 2, -4 }, + { &object_tru_Anim_00446C, 1.0f, 0, -1, 0, 0 }, { &object_tru_Anim_003698, 1.0f, 0, -1, 2, -4 }, + { &object_tru_Anim_002BD8, 1.0f, 0, -1, 0, 0 }, { &object_tru_Anim_00446C, 1.0f, 0, -1, 0, 0 }, +}; + +static Vec3f D_80A8B3D8 = { 0.0f, 24.0f, 16.0f }; +static Vec3f D_80A8B3E4 = { 0.0f, -3.0f, 3.0f }; +static Vec3f D_80A8B3F0 = { 0.0f, 0.5f, 0.0f }; +static Vec3f D_80A8B3FC = { 3000.0f, -800.0f, 0.0f }; + +void func_80A85620(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { + s16 i; + + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_00 == 0) { + arg0->unk_02 = Rand_ZeroFloat(20.0f) + arg4; + arg0->unk_01 = arg0->unk_02; + arg0->unk_00 = 1; + arg0->unk_04 = *arg1; + arg0->unk_1C = D_801D15B0; + arg0->unk_10 = D_80A8B250; + arg0->unk_28 = arg2; + arg0->unk_2C = arg3; + break; + } + } +} + +void func_80A85788(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { + s32 i; + s32 flag = false; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_00 == 1) { + f32 alpha; + + if (!flag) { + gSPDisplayList(POLY_XLU_DISP++, D_80A89000); + flag = true; + } + + do { + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= 255.0f; + } while (0); + + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)alpha); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -arg0->unk_02 * 5, 32, 64, 1, 0, 0, 32, 32)); + + Matrix_InsertTranslation(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + Matrix_InsertTranslation(0.0f, 14.0f, 0.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_80A890A8); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80A85AA4(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { + s16 i; + + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_00 == 0) { + arg0->unk_02 = arg4; + arg0->unk_01 = arg0->unk_02; + arg0->unk_00 = 2; + arg0->unk_04 = *arg1; + arg0->unk_1C = D_801D15B0; + arg0->unk_10 = D_801D15B0; + arg0->unk_28 = arg2; + arg0->unk_2C = arg3; + break; + } + } +} + +void func_80A85BCC(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { + s32 i; + s32 flag = false; + + OPEN_DISPS(globalCtx->state.gfxCtx); + if (globalCtx) {} + + func_8012C2DC(globalCtx->state.gfxCtx); + + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_00 == 2) { + f32 alpha; + + if (!flag) { + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 200, 0); + flag = true; + } + + do { + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= 255.0f; + } while (0); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)alpha); + + Matrix_InsertTranslation(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_80A8A108); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80A85E2C(EnTruUnkStruct* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, f32 arg5, f32 arg6, u8 arg7) { + s32 i; + + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_00 == 0) { + arg0->unk_02 = Rand_ZeroFloat(4.0f) + arg6; + arg0->unk_01 = arg0->unk_02; + arg0->unk_00 = arg7; + arg0->unk_04 = *arg1; + arg0->unk_1C = *arg3; + arg0->unk_10 = *arg2; + arg0->unk_28 = arg4; + arg0->unk_2C = arg5; + break; + } + } +} + +#ifdef NON_MATCHING +// s8/s6 flipped, same deal as above functions but the same fixes don't work +void func_80A85F84(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { + u8 flag = false; + s32 i; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + + for (i = 0; i < 30; i++, arg0++) { + f32 alpha; + s32 idx; + + if ((arg0->unk_00 == 3) || (arg0->unk_00 == 4) || (arg0->unk_00 == 5)) { + if (!flag) { + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, sizeof(Gfx) * 0); + gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_01A820); + flag = true; + } + + Matrix_StatePush(); + + do { + alpha = (f32)arg0->unk_02 / arg0->unk_01; + alpha *= D_80A8B274[arg0->unk_00 - 3]; + } while (0); + + gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, + COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); + gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80A8B25C[arg0->unk_00 - 3].r, D_80A8B25C[arg0->unk_00 - 3].g, + D_80A8B25C[arg0->unk_00 - 3].b, (u8)alpha); + gDPSetEnvColor(POLY_XLU_DISP++, D_80A8B25C[arg0->unk_00 - 3].r, D_80A8B25C[arg0->unk_00 - 3].g, + D_80A8B25C[arg0->unk_00 - 3].b, 0); + + Matrix_InsertTranslation(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); + Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + idx = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f; + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B280[idx])); + gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_01A830); + + Matrix_StatePop(); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85F84.s") #endif -extern ColliderSphereInit D_80A8B2A0; -extern CollisionCheckInfoInit2 D_80A8B2CC; +s32 func_80A86384(EnTruUnkStruct* arg0, Vec3f* arg1) { + s32 i; -extern UNK_TYPE D_060020C8; -extern UNK_TYPE D_0601A830; -extern UNK_TYPE D_0601AA60; + for (i = 0; i < 30; i++, arg0++) { + if (arg0->unk_02 != 0) { + if (arg0->unk_00 == 2) { + arg0->unk_04 = *arg1; + } else { + arg0->unk_04.x += arg0->unk_1C.x; + arg0->unk_04.y += arg0->unk_1C.y; + arg0->unk_04.z += arg0->unk_1C.z; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85620.s") + arg0->unk_1C.x += arg0->unk_10.x; + arg0->unk_1C.y += arg0->unk_10.y; + arg0->unk_1C.z += arg0->unk_10.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85788.s") + arg0->unk_02--; + arg0->unk_28 += arg0->unk_2C; + } else { + arg0->unk_00 = 0; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85AA4.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85BCC.s") +s32 func_80A86460(EnTru* this) { + s32 i; + Vec3f spB0; + Vec3f spA4; + Vec3f sp98; + Vec3f sp8C; + f32 temp_f6; + s16 phi_s1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85E2C.s") + Math_Vec3f_Copy(&spB0, &D_801D15B0); + Math_Vec3f_Copy(&sp8C, &D_801D15B0); + Math_Vec3f_Copy(&spA4, &D_801D15B0); + Math_Vec3f_Copy(&sp98, &D_801D15B0); + phi_s1 = (Rand_ZeroOne() * 360.0f) * 182.0f; + spB0.z = 20.0f; + Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.world.rot.y, &spB0, &sp8C); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85F84.s") + for (i = 0; i < 8; i++, phi_s1 += 0x1FFE) { + Math_Vec3f_Copy(&spB0, &D_801D15B0); + spB0.y = 1.0f; + spB0.z = Rand_ZeroOne() + 3.0f; + Lib_Vec3f_TranslateAndRotateY(&D_801D15B0, phi_s1, &spB0, &sp98); + Math_Vec3f_Copy(&spB0, &D_801D15B0); + spB0.z = (Rand_ZeroOne() * 4.0f) + 12.0f; + Lib_Vec3f_TranslateAndRotateY(&sp8C, phi_s1, &spB0, &spA4); + func_80A85E2C(this->unk_394, &spA4, &D_801D15B0, &sp98, 0.4f, 0.06f, 12.0f, 4); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86384.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86460.s") +s32 func_80A86674(EnTru* this) { + s32 pad; + Vec3f sp40; + Vec3f sp34; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86674.s") + Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.world.rot.y, &D_80A8B3D8, &sp40); + Lib_Vec3f_TranslateAndRotateY(&D_801D15B0, this->actor.world.rot.y, &D_80A8B3E4, &sp34); + if (this->unk_390 == 1) { + func_80A85E2C(this->unk_394, &sp40, &D_80A8B3F0, &sp34, 0.2f, 0.1f, 12.0f, 3); + } else if (this->unk_390 == 2) { + func_80A85E2C(this->unk_394, &sp40, &D_80A8B3F0, &sp34, 0.2f, 0.1f, 12.0f, 5); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86770.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A868F8.s") +s32 func_80A86770(EnTru* this) { + s32 pad; + Vec3f sp98; + Vec3f sp8C; + s32 i; + s16 phi_s0 = Rand_ZeroOne() * 360.0f * 182.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86924.s") + for (i = 0; i < 4; i++, phi_s0 += 0x3FFC) { + Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, phi_s0, &D_801D15B0, &sp98); + sp98.y = this->actor.floorHeight + 1.0f; + sp8C.x = Rand_ZeroOne() - 0.5f; + sp8C.z = Rand_ZeroOne() - 0.5f; + sp8C.y = Rand_ZeroOne() * 0.2f; + func_80A85E2C(this->unk_394, &sp98, &sp8C, &D_801D15B0, 1.0f, 0.04f, 28.0f, 4); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A8697C.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A869DC.s") +void func_80A868F8(EnTru* this) { + this->skelAnime.playSpeed = this->unk_358; + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86B0C.s") +s32 func_80A86924(EnTru* this, s32 arg1) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86BAC.s") + if (arg1 != this->unk_37C) { + this->unk_37C = arg1; + ret = func_8013BC6C(&this->skelAnime, D_80A8B2D8, arg1); + this->unk_358 = this->skelAnime.playSpeed; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A86DB8.s") + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A871E0.s") +void func_80A8697C(EnTru* this, GlobalContext* globalCtx) { + this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale; + if (this->actor.draw != NULL) { + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A872AC.s") +s32 func_80A869DC(EnTru* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + Vec3f sp38; + Vec3f sp2C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A873B8.s") + Math_ApproachS(&this->unk_368, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_368 = CLAMP(this->unk_368, -0x1FFE, 0x1FFE); + Math_Vec3f_Copy(&sp38, &player->actor.world.pos); + sp38.y = player->bodyPartsPos[7].y + 3.0f; + Math_Vec3f_Copy(&sp2C, &this->actor.focus.pos); + sp2C.y -= 30.0f; + Math_ApproachS(&this->unk_366, Math_Vec3f_Pitch(&sp2C, &sp38), 4, 0x2AA8); + this->unk_366 = CLAMP(this->unk_366, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A87400.s") + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A875AC.s") +s32 func_80A86B0C(EnTru* this, GlobalContext* globalCtx) { + if (this->unk_34E & 8) { + this->unk_34E &= ~0x10; + this->unk_34E |= 0x20; + func_80A869DC(this, globalCtx); + } else if (this->unk_34E & 0x20) { + this->unk_34E &= ~0x20; + this->unk_366 = 0; + this->unk_368 = 0; + this->unk_36A = 20; + } else if (DECR(this->unk_36A) == 0) { + this->unk_34E |= 0x10; + this->unk_36A = 20; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A8777C.s") + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A87880.s") +s32 func_80A86BAC(EnTru* this, GlobalContext* globalCtx) { + if (this->unk_34E & 0x400) { + Matrix_StatePush(); + func_8012C28C(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A87B48.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A87DC0.s") + switch (this->unk_390) { + case 1: + gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 0, 0); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A87FD0.s") + case 2: + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 200, 0); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A881E0.s") + default: + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 0); + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/EnTru_Init.s") + Matrix_InsertXRotation_s(-0x4000, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/EnTru_Destroy.s") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_tru_DL_0020C8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/EnTru_Update.s") + Matrix_StatePop(); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A885B8.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A88698.s") + if (this->unk_34E & 0x800) { + Matrix_StatePush(); + func_8012C2DC(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A886D4.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/EnTru_Draw.s") + gDPPipeSync(POLY_XLU_DISP++); + + Matrix_InsertXRotation_s(-0x4000, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_001F90); + + Matrix_StatePop(); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + + return false; +} + +s32 func_80A86DB8(EnTru* this) { + if (this->unk_34E & 0x80) { + this->unk_36E = 2; + return false; + } + + switch (this->unk_37C) { + case 0: + case 1: + if (DECR(this->unk_36C) == 0) { + s16 rand = Rand_S16Offset(40, 20); + if (this->unk_36E == 2) { + this->unk_36C = 8; + } else { + this->unk_36C = rand; + } + + if (this->unk_36E == 2) { + this->unk_36E = 1; + } else { + this->unk_36E = 2; + } + } + return false; + + case 2: + if (Animation_OnFrame(&this->skelAnime, 10.0f)) { + this->unk_36E = 1; + } else if ((this->skelAnime.curFrame >= 11.0f) && (this->skelAnime.curFrame <= 32.0f)) { + this->unk_36E = 0; + } else { + this->unk_36E = 2; + } + return false; + + case 3: + if (Animation_OnFrame(&this->skelAnime, 31.0f)) { + this->unk_36E = 1; + } else if (this->skelAnime.curFrame <= 32.0f) { + this->unk_36E = 2; + } else { + this->unk_36E = 0; + } + return false; + + case 9: + if (Animation_OnFrame(&this->skelAnime, 57.0f)) { + this->unk_36C = 0; + this->unk_36E = 0; + } + + if (this->skelAnime.curFrame < 57.0f) { + if (DECR(this->unk_36C) == 0) { + this = this; + this->unk_36C = Rand_S16Offset(8, 8); + this->unk_36E = 2; + } else { + this->unk_36E = 1; + } + } else if (DECR(this->unk_36C) == 0) { + this->unk_36E++; + if (this->unk_36E >= 4) { + this->unk_36C = Rand_S16Offset(20, 10); + this->unk_36E = 0; + } + } + return false; + + case 10: + this->unk_36E = 0; + return false; + + case 11: + if (Animation_OnFrame(&this->skelAnime, 19.0f) || Animation_OnFrame(&this->skelAnime, 45.0f)) { + this->unk_36E = 1; + } else if ((this->skelAnime.curFrame >= 19.0f) && (this->skelAnime.curFrame <= 45.0f)) { + this->unk_36E = 2; + } else { + this->unk_36E = 3; + } + return false; + + case 13: + if (Animation_OnFrame(&this->skelAnime, 19.0f)) { + this->unk_36E = 1; + } else if (this->skelAnime.curFrame >= 19.0f) { + this->unk_36E = 2; + } else { + this->unk_36E = 0; + } + return false; + + default: + if (DECR(this->unk_36C) == 0) { + if ((this->unk_36E != 2) || !(this->unk_34E & 0x80)) { + this->unk_36E++; + } + + if (this->unk_36E >= 4) { + this->unk_36C = Rand_S16Offset(30, 30); + this->unk_36E = 0; + } + } + return false; + } + + return false; +} + +UNK_TYPE* func_80A871E0(EnTru* this, GlobalContext* globalCtx) { + if (this->unk_34E & 0x2000) { + if (this->unk_38C == 35) { + this->unk_390 = 1; + } else { + this->unk_390 = 2; + } + return D_80A88984; + } + + if (this->unk_34E & 0x4000) { + return D_80A889A4; + } + + if (this->unk_34E & 0x80) { + return D_80A88924; + } + + if (!(this->unk_34E & 0x40) && !(gSaveContext.weekEventReg[16] & 0x10)) { + return D_80A88918; + } + + if ((this->unk_34E & 0x1000) && !(gSaveContext.weekEventReg[16] & 0x10)) { + return D_80A88910; + } + + return D_80A8892C; +} + +s32 func_80A872AC(EnTru* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s32 ret = false; + + if (this->unk_34E & 7) { + if (func_800B84D0(&this->actor, globalCtx)) { + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_34E &= ~0x80; + } + this->unk_34E &= ~(0x4000 | 0x2000); + + if ((player->unk_A87 == 35) || (player->unk_A87 == 36)) { + this->unk_34E |= 0x2000; + this->unk_38C = player->unk_A87; + } else if (player->unk_A87 != 0) { + this->unk_34E |= 0x4000; + } + + this->unk_378 = func_80A875AC; + this->unk_390 = 0; + this->unk_364 = 0; + this->unk_354 = func_80A871E0(this, globalCtx); + func_8013AED4(&this->unk_34E, 0, 7); + this->actionFunc = func_80A881E0; + ret = true; + } + } + + return ret; +} + +s32 func_80A873B8(EnTru* this) { + s16 yDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + s32 ret; + + if ((u16)ABS_ALT(yDiff) < 0x1600) { + ret = true; + } else { + ret = false; + } + return ret; +} + +s32 func_80A87400(EnTru* this, GlobalContext* globalCtx) { + Vec3s* sp4C; + Vec3f sp40; + Vec3f sp34; + s16 phi_a1; + s32 ret = false; + + this->actor.velocity.y = Math_SinS(this->unk_360) * this->unk_35C; + this->unk_360 = CLAMP(this->unk_360 + 2000, 0, 0x4000); + + Math_ApproachF(&this->unk_35C, 30.0f, 0.08f, 1000.0f); + Math_ApproachF(&this->actor.speedXZ, 30.0f, 0.2f, 1000.0f); + + if (this->path != NULL) { + sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->path->points); + if (func_8013BD40(&this->actor, this->path, this->unk_384)) { + if (this->unk_384 > this->unk_384 + 1) { + this->unk_384 = this->path->count - 2; + ret = true; + } + this->unk_384++; + } + Math_Vec3s_ToVec3f(&sp34, &sp4C[this->unk_384]); + Math_Vec3f_Copy(&sp40, &this->actor.world.pos); + phi_a1 = Math_Vec3f_Yaw(&sp40, &sp34); + } else { + phi_a1 = this->actor.world.rot.y; + } + + Math_ApproachS(&this->actor.world.rot.y, phi_a1, 4, 3640); + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if ((s32)(this->actor.floorHeight + 80.0f) >= (s32)this->actor.world.pos.y) { + func_80A86770(this); + } + + return ret; +} + +s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + s32 ret = false; + + switch (this->unk_364) { + case 0: + if ((this->unk_34E & 0x40) || (gSaveContext.weekEventReg[16] & 0x10)) { + this->unk_374 = this->actor.cutscene; + this->unk_364++; + } else { + this->unk_364++; + this->unk_364++; + break; + } + + case 1: + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_374); + } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + this->unk_364++; + } else { + ActorCutscene_SetIntentToPlay(this->unk_374); + } + break; + + case 2: + if ((this->unk_37C != 5) && (this->unk_37C != 6)) { + func_80A86924(this, 3); + this->unk_364++; + } else { + func_80A86924(this, 4); + ret = true; + } + break; + + case 3: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->unk_364++; + func_80A86924(this, 4); + ret = true; + } + break; + } + + if (ret == true) { + if (this->unk_390 != 0) { + this->unk_34E |= 8; + this->unk_378 = func_80A87880; + } else { + this->unk_378 = func_80A8777C; + } + this->unk_364 = 0; + } + + return ret; +} + +s32 func_80A8777C(Actor* thisx, GlobalContext* globalCtx) { + s32 temp_v0; + s32 ret = 0; + + temp_v0 = func_80152498(&globalCtx->msgCtx); + + switch (temp_v0) { + default: + if (temp_v0 != 0x10) { + break; + } + if (0) { + + case 4: + case 5: + if (!func_80147624(globalCtx)) { + break; + } + } + + temp_v0 = func_80123810(globalCtx); + if ((temp_v0 == 35) || (temp_v0 == 36)) { + ((EnTru*)thisx)->unk_34E |= 8; + if (temp_v0 == 35) { + ((EnTru*)thisx)->unk_390 = 1; + } else { + ((EnTru*)thisx)->unk_390 = 2; + } + ((EnTru*)thisx)->unk_378 = func_80A87880; + ((EnTru*)thisx)->unk_364 = 0; + ret = 1; + } else if (temp_v0 < 0) { + ret = 3; + } else if (temp_v0 != 0) { + ret = 2; + } + break; + } + + return ret; +} + +s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + EnTru* this = THIS; + s32 ret = false; + + switch (this->unk_364) { + case 0: + ActorCutscene_Stop(this->unk_374); + this->unk_374 = ActorCutscene_GetAdditionalCutscene(this->unk_374); + this->unk_364++; + + case 1: + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_374); + } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + this->unk_364++; + } else { + ActorCutscene_SetIntentToPlay(this->unk_374); + } + break; + + case 2: + this->unk_34E |= 0x10; + this->unk_34E &= ~0x8; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + func_80A86924(this, 7); + this->unk_364++; + break; + + case 3: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->unk_364++; + func_80A86924(this, 9); + this->actor.world.rot.y += 0x4000; + } else if (Animation_OnFrame(&this->skelAnime, 12.0f) && !(this->unk_34E & 0x800)) { + this->unk_34E |= 0x400; + this->unk_34E |= 0x800; + func_80123AA4(player, 3); + } + break; + + case 4: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->unk_364++; + func_80A86924(this, 10); + ret = true; + } else if (Animation_OnFrame(&this->skelAnime, 18.0f) || Animation_OnFrame(&this->skelAnime, 32.0f) || + Animation_OnFrame(&this->skelAnime, 52.0f)) { + if (Animation_OnFrame(&this->skelAnime, 52.0f)) { + this->unk_34E &= ~0x400; + func_80123D50(globalCtx, player, 18, 21); + } + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KOUME_DRINK); + } else if (Animation_OnFrame(&this->skelAnime, 90.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KOUME_REGAIN); + } + + if ((this->skelAnime.curFrame > 90.0f) && (this->skelAnime.curFrame < 95.0f)) { + func_80A86674(this); + } + break; + } + + if (ret == true) { + this->unk_378 = func_80A87B48; + this->unk_364 = 0; + } + + return ret; +} + +s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + Player* player = GET_PLAYER(globalCtx); + Vec3f sp4C; + Vec3f sp40; + s16 sp3E; + s32 pad2; + s32 ret = false; + + switch (this->unk_364) { + case 0: + func_80A86924(this, 11); + this->unk_364++; + break; + + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + sp3E = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); + Math_Vec3f_Copy(&sp4C, &D_801D15B0); + sp4C.z = 40.0f; + Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, sp3E, &sp4C, &sp40); + func_80A85620(this->unk_394, &sp40, 2.0f, 0.08f, 60.0f); + func_8016A268(globalCtx, 1, 160, 160, 160, 0); + this->unk_370 = 20; + this->unk_372 = 10; + this->unk_364++; + } else if (Animation_OnFrame(&this->skelAnime, 22.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KOUME_MAGIC); + func_80A85AA4(this->unk_394, &this->unk_1F8, 1.0f, 0.1f, 40.0f); + } + break; + + case 2: + if (DECR(this->unk_370) != 0) { + MREG(68) = 255.0f - ((fabsf(10.0f - this->unk_370) / 10) * 255.0f); + if (this->unk_370 == 9) { + this->actor.shape.shadowDraw = NULL; + this->unk_34E |= (0x200 | 0x8); + this->unk_34E &= ~0x800; + if (player->unk_A87 != 0) { + player->unk_A87 = 0; + } + func_80A86924(this, 12); + } + } else { + MREG(64) = 0; + ret = true; + } + break; + } + + if (ret == true) { + this->unk_378 = func_80A87DC0; + this->unk_364 = 0; + } + + return ret; +} + +s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + s32 ret = false; + + switch (this->unk_364) { + case 0: + ActorCutscene_Stop(this->unk_374); + this->unk_374 = ActorCutscene_GetAdditionalCutscene(this->unk_374); + this->unk_364++; + + case 1: + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_374); + } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + this->unk_364++; + } else { + ActorCutscene_SetIntentToPlay(this->unk_374); + } + break; + + case 2: + func_801A75E8(NA_SE_EN_KOUME_MAGIC); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KOUME_AWAY); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_KOUME_LAUGH); + func_80A86924(this, 13); + this->skelAnime.baseTransl.y = 0; + this->skelAnime.moveFlags = 2; + this->unk_34E &= ~0x8; + this->unk_34E |= 0x10; + this->unk_364++; + break; + + case 3: + if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + break; + } else { + func_80A86924(this, 14); + this->actor.shape.rot.y = this->actor.world.rot.y; + this->unk_362 = 20; + this->unk_364++; + } + + case 4: + if (func_80A87400(this, globalCtx) || (DECR(this->unk_362) == 0)) { + ret = true; + gSaveContext.weekEventReg[12] |= 8; + } + break; + } + + if (ret == true) { + this->actor.flags &= ~1; + this->actor.draw = NULL; + this->unk_378 = NULL; + this->unk_34E = 0; + this->unk_364 = 0; + } + return ret; +} + +void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { + if (this->actor.draw != NULL) { + if ((this->unk_34E & 0x80) || (gSaveContext.weekEventReg[16] & 0x10)) { + if (func_80A873B8(this)) { + func_8013AED4(&this->unk_34E, 3, 7); + } else { + func_8013AED4(&this->unk_34E, 0, 7); + } + } else if (this->unk_34E & 0x40) { + if (func_80A873B8(this)) { + func_8013AED4(&this->unk_34E, 3, 7); + } else { + func_8013AED4(&this->unk_34E, 0, 7); + } + + if ((this->unk_37C == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->unk_362 = Rand_S16Offset(40, 20); + func_80A86924(this, 1); + func_80A86460(this); + } else if (this->unk_37C != 2) { + if (DECR(this->unk_362) == 0) { + func_80A86924(this, 2); + } + } + } else if (!(gSaveContext.weekEventReg[16] & 0x10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && + (this->actor.xzDistToPlayer < 140.0f)) { + func_8013AED4(&this->unk_34E, 4, 7); + this->unk_34E |= 0x1040; + this->unk_362 = Rand_S16Offset(40, 20); + } else if (func_80A873B8(this)) { + func_8013AED4(&this->unk_34E, 3, 7); + } else { + func_8013AED4(&this->unk_34E, 0, 7); + } + } +} + +void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (func_8010BF58(&this->actor, globalCtx, this->unk_354, this->unk_378, &this->unk_1E8)) { + if (player->transformation != PLAYER_FORM_HUMAN) { + this->unk_34E |= 0x80; + } + + if (ActorCutscene_GetCurrentIndex() != -1) { + ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); + } + + if (!(this->unk_34E & 0x40) && !(gSaveContext.weekEventReg[16] & 0x10)) { + func_80A86924(this, 0); + } else if (this->unk_34E & 0x80) { + func_80A86924(this, 0); + func_80A86460(this); + } else if (gSaveContext.weekEventReg[16] & 0x10) { + func_80A86924(this, 6); + } + + func_8013AED4(&this->unk_34E, 0, 7); + this->unk_34E &= ~(0x1000 | 0x8); + this->unk_34E |= 0x10; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.flags &= ~0x100; + this->unk_1E8 = 0; + this->actionFunc = func_80A87FD0; + } +} + +void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + + if ((gSaveContext.entranceIndex != 0xC200) || (gSaveContext.weekEventReg[12] & 8)) { + Actor_MarkForDeath(&this->actor); + return; + } + + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tru_Skel_01AA60, NULL, this->jointTable, this->morphTable, + 27); + Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + this->unk_37C = -1; + func_80A86924(this, 0); + this->path = func_8013BEDC(globalCtx, this->actor.params & 0xFF, 255, &this->unk_384); + if (this->path != NULL) { + this->unk_384 = 1; + } + + this->actor.targetMode = 0; + Actor_SetScale(&this->actor, 0.008f); + this->unk_34E = 0; + + if (gSaveContext.weekEventReg[16] & 0x10) { + func_80A86924(this, 5); + } else { + this->unk_388 = 0; + } + + this->actionFunc = func_80A87FD0; + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); +} + +void EnTru_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + + Collider_DestroySphere(globalCtx, &this->collider); +} + +void EnTru_Update(Actor* thisx, GlobalContext* globalCtx) { + EnTru* this = THIS; + f32 radius; + + func_80A872AC(this, globalCtx); + + this->actionFunc(this, globalCtx); + + func_80A868F8(this); + func_80A86B0C(this, globalCtx); + func_80A86DB8(this); + + radius = this->collider.dim.worldSphere.radius + 30; + this->unk_388 = !(this->unk_34E & 0x80) ? 0 : 0; + + func_8013C964(&this->actor, globalCtx, radius, 20.0f, this->unk_388, this->unk_34E & 7); + func_80A8697C(this, globalCtx); + func_80A86384(this->unk_394, &this->unk_1F8); +} + +s32 EnTru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + s32 pad; + EnTru* this = THIS; + + if (limbIndex == 21) { + Matrix_GetStateTranslation(&this->actor.focus.pos); + Math_Vec3f_ToVec3s(&this->collider.dim.worldSphere.center, &this->actor.focus.pos); + this->actor.focus.pos.x = (this->actor.focus.pos.x / 10.0f) * 10.0f; + this->actor.focus.pos.y = ((this->actor.focus.pos.y + 10.0f) / 10.0f) * 10.0f; + this->actor.focus.pos.z = (this->actor.focus.pos.z / 10.0f) * 10.0f; + Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); + Matrix_MultiplyVector3fByState(&D_80A8B3FC, &this->unk_1F8); + } + + if (!(this->unk_34E & 0x200) && (limbIndex == 14)) { + *dList = NULL; + } + + return false; +} + +void EnTru_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnTru* this = THIS; + + if (limbIndex == 19) { + func_80A86BAC(this, globalCtx); + } +} + +void func_80A886D4(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { + EnTru* this = THIS; + s32 pad[3]; + s32 sp2C; + s32 phi_v1; + + if (this->unk_34E & 0x10) { + phi_v1 = false; + } else { + phi_v1 = true; + } + + if (this->unk_34E & 0x20) { + sp2C = true; + } else { + sp2C = false; + } + + if (!phi_v1) { + sp2C = false; + } + + if (limbIndex == 21) { + func_8013AD9C(this->unk_366, this->unk_368 + this->actor.shape.rot.y, &this->unk_1EC, &this->unk_204, phi_v1, + sp2C); + Matrix_StatePop(); + Matrix_InsertTranslation(this->unk_1EC.x, this->unk_1EC.y, this->unk_1EC.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + if (sp2C) { + s16 oldZ = this->unk_204.z; + + this->unk_204.z = this->unk_204.x; + this->unk_204.x = oldZ; + } + Matrix_RotateY(this->unk_204.y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->unk_204.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->unk_204.z, MTXMODE_APPLY); + Matrix_StatePush(); + } +} + +void EnTru_Draw(Actor* thisx, GlobalContext* globalCtx) { + static TexturePtr D_80A8B408[] = { + &object_tru_Tex_018FA0, + &object_tru_Tex_0197A0, + &object_tru_Tex_019FA0, + &object_tru_Tex_0197A0, + }; + s32 pad; + EnTru* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B408[this->unk_36E])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80A8B408[this->unk_36E])); + + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTru_OverrideLimbDraw, EnTru_PostLimbDraw, func_80A886D4, &this->actor); + func_80A85788(this->unk_394, globalCtx); + func_80A85BCC(this->unk_394, globalCtx); + func_80A85F84(this->unk_394, globalCtx); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.h b/src/overlays/actors/ovl_En_Tru/z_en_tru.h index 7c21a43a33..4127fcdff8 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.h +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.h @@ -6,12 +6,55 @@ struct EnTru; typedef void (*EnTruActionFunc)(struct EnTru*, GlobalContext*); +typedef s32 (*EnTruUnkFunc)(Actor*, GlobalContext*); + +typedef struct { + /* 0x00 */ u8 unk_00; + /* 0x01 */ u8 unk_01; + /* 0x02 */ u8 unk_02; + /* 0x04 */ Vec3f unk_04; + /* 0x10 */ Vec3f unk_10; + /* 0x1C */ Vec3f unk_1C; + /* 0x28 */ f32 unk_28; + /* 0x2C */ f32 unk_2C; +} EnTruUnkStruct; // size = 0x30 typedef struct EnTru { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ SkelAnime skelAnime; /* 0x0188 */ EnTruActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x7A8]; + /* 0x018C */ ColliderSphere collider; + /* 0x01E4 */ Path* path; + /* 0x01E8 */ s32 unk_1E8; + /* 0x01EC */ Vec3f unk_1EC; + /* 0x01F8 */ Vec3f unk_1F8; + /* 0x0204 */ Vec3s unk_204; + /* 0x020A */ Vec3s jointTable[27]; + /* 0x02AC */ Vec3s morphTable[27]; + /* 0x034E */ u16 unk_34E; + /* 0x0350 */ UNK_TYPE1 unk350[0x4]; + /* 0x0354 */ s32* unk_354; + /* 0x0358 */ f32 unk_358; + /* 0x035C */ f32 unk_35C; + /* 0x0360 */ s16 unk_360; + /* 0x0362 */ s16 unk_362; + /* 0x0364 */ s16 unk_364; + /* 0x0366 */ s16 unk_366; + /* 0x0368 */ s16 unk_368; + /* 0x036A */ s16 unk_36A; + /* 0x036C */ s16 unk_36C; + /* 0x036E */ s16 unk_36E; + /* 0x0370 */ s16 unk_370; + /* 0x0372 */ s16 unk_372; + /* 0x0374 */ s16 unk_374; + /* 0x0378 */ EnTruUnkFunc unk_378; + /* 0x037C */ s32 unk_37C; + /* 0x0380 */ UNK_TYPE1 unk380[0x4]; + /* 0x0384 */ s32 unk_384; + /* 0x0388 */ s32 unk_388; + /* 0x038C */ s32 unk_38C; + /* 0x0390 */ s32 unk_390; + /* 0x0394 */ EnTruUnkStruct unk_394[30]; } EnTru; // size = 0x934 extern const ActorInit En_Tru_InitVars; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h index ed083ec50e..793958ed74 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h @@ -10,7 +10,7 @@ typedef void (*EnTruMtActionFunc)(struct EnTruMt*, GlobalContext*); typedef struct EnTruMt { /* 0x0000 */ Actor actor; /* 0x0144 */ EnTruMtActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x260]; + /* 0x0148 */ char unk_148[0x260]; } EnTruMt; // size = 0x3A8 extern const ActorInit En_Tru_Mt_InitVars; diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index 6b145b0c55..566c21f3ce 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -10,7 +10,7 @@ typedef void (*EnViewerActionFunc)(struct EnViewer*, GlobalContext*); typedef struct EnViewer { /* 0x0000 */ Actor actor; /* 0x0144 */ EnViewerActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x10]; + /* 0x0148 */ char unk_148[0x10]; } EnViewer; // size = 0x158 extern const ActorInit En_Viewer_InitVars; 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 8dd30eec23..2031127f7c 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 @@ -81,7 +81,7 @@ void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) { Vec3f sp24; this->actor.textId = 0; - Matrix_RotateY(this->actor.shape.rot.y, 0); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_MultiplyVector3fByState(&D_80A664FC, &sp24); Math_Vec3f_Sum(&this->actor.world.pos, &sp24, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.shape.rot); diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h index 0ff444fcec..0f5b705f5c 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h @@ -10,7 +10,7 @@ typedef void (*EnWizFireActionFunc)(struct EnWizFire*, GlobalContext*); typedef struct EnWizFire { /* 0x0000 */ Actor actor; /* 0x0144 */ EnWizFireActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x29AC]; + /* 0x0148 */ char unk_148[0x29AC]; } EnWizFire; // size = 0x2AF4 extern const ActorInit En_Wiz_Fire_InitVars; 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 b876205f5f..a823a1ec07 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -10,7 +10,7 @@ typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*); typedef struct EnZo { /* 0x0000 */ Actor actor; /* 0x0144 */ EnZoActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x2DC]; + /* 0x0148 */ char unk_148[0x2DC]; } EnZo; // size = 0x424 extern const ActorInit En_Zo_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 2b3a3189fc..a3073a7e0e 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -285,12 +285,12 @@ void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx) { if (actionFuncTemp) { s16 rotation = Math_SinS(this->unk_198) * 8000.0f; - Matrix_InsertZRotation_s(rotation, 1); - Matrix_Scale(1.3f, 1.0f, 1.0f, 1); - Matrix_InsertZRotation_s(rotation * -1, 1); - Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, 1); + Matrix_InsertZRotation_s(rotation, MTXMODE_APPLY); + Matrix_Scale(1.3f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_InsertZRotation_s(rotation * -1, MTXMODE_APPLY); + Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, MTXMODE_APPLY); } - Matrix_RotateY(yaw, 1); + Matrix_RotateY(yaw, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_0407D590); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h index 2f2dd7b132..76265bcec2 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h @@ -11,7 +11,7 @@ typedef struct ObjBell { /* 0x1B4 */ ColliderSphere collider2; /* 0x20C */ s16 unk_20C; // bell rotation angle? /* 0x20E */ s16 unk_20E; - /* 0x20E */ s16 unk_20F; + /* 0x210 */ s16 unk_210; /* 0x212 */ s16 unk_212; /* 0x214 */ s16 unk_214; /* 0x216 */ char unk_216[0x06]; 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 79fb22868c..5c3235ef2a 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h @@ -10,7 +10,7 @@ typedef void (*ObjBigicicleActionFunc)(struct ObjBigicicle*, GlobalContext*); typedef struct ObjBigicicle { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjBigicicleActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x9C]; + /* 0x0148 */ char unk_148[0x9C]; } ObjBigicicle; // size = 0x1E4 extern const ActorInit Obj_Bigicicle_InitVars; 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 a00ad595b0..8b498f39e5 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h @@ -10,7 +10,7 @@ typedef void (*ObjChanActionFunc)(struct ObjChan*, GlobalContext*); typedef struct ObjChan { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjChanActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x9C]; + /* 0x0148 */ char unk_148[0x9C]; } ObjChan; // size = 0x1E4 extern const ActorInit Obj_Chan_InitVars; 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 9ca91823e8..303a3ed5e5 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -10,7 +10,7 @@ typedef void (*ObjCombActionFunc)(struct ObjComb*, GlobalContext*); typedef struct ObjComb { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjCombActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x74]; + /* 0x0148 */ char unk_148[0x74]; } ObjComb; // size = 0x1BC extern const ActorInit Obj_Comb_InitVars; 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 b2ffc1121b..2631e91bef 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h @@ -10,7 +10,7 @@ typedef void (*ObjDemoActionFunc)(struct ObjDemo*, GlobalContext*); typedef struct ObjDemo { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjDemoActionFunc actionFunc; - /* 0x0148 */ char unk_144[0xC]; + /* 0x0148 */ char unk_148[0xC]; } ObjDemo; // size = 0x154 extern const ActorInit Obj_Demo_InitVars; 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 b4f05d8ab3..30d0b2f0ab 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -36,7 +36,7 @@ void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - 0x8000), 1); + Matrix_RotateY((s16)(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); diff --git a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h index f77913d881..d9ac284bdc 100644 --- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h +++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h @@ -10,7 +10,7 @@ typedef void (*ObjHarikoActionFunc)(struct ObjHariko*, GlobalContext*); typedef struct ObjHariko { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjHarikoActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x10]; + /* 0x0148 */ char unk_148[0x10]; } ObjHariko; // size = 0x158 extern const ActorInit Obj_Hariko_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 9b7582f85a..153a4a914b 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 @@ -156,7 +156,7 @@ void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx) { AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_06001C60)); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_06000D78); - Matrix_NormalizeXYZ(&globalCtx->mf_187FC); + Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_06000C80); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h index 4ee73ecbe3..b306e2552c 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h @@ -10,7 +10,7 @@ typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, GlobalContext*); typedef struct ObjMure2 { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjMure2ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x38]; + /* 0x0148 */ char unk_148[0x38]; } ObjMure2; // size = 0x180 extern const ActorInit Obj_Mure2_InitVars; 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 c000b1e6f5..67252a147d 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -10,7 +10,7 @@ typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, GlobalContext*); typedef struct ObjMure3 { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjMure3ActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x20]; + /* 0x0148 */ char unk_148[0x20]; } ObjMure3; // size = 0x168 extern const ActorInit Obj_Mure3_InitVars; 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 0a98759d03..db43c5c16b 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h @@ -10,7 +10,7 @@ typedef void (*ObjRoomtimerActionFunc)(struct ObjRoomtimer*, GlobalContext*); typedef struct ObjRoomtimer { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjRoomtimerActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4]; + /* 0x0148 */ char unk_148[0x4]; } ObjRoomtimer; // size = 0x14C extern const ActorInit Obj_Roomtimer_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h index 148c8deb6c..680417d506 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h @@ -10,7 +10,7 @@ typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, GlobalContext*); typedef struct ObjSwprize { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjSwprizeActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4]; + /* 0x0148 */ char unk_148[0x4]; } ObjSwprize; // size = 0x14C extern const ActorInit Obj_Swprize_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h index 0d734b85e5..83f267d37f 100644 --- a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h +++ b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h @@ -10,7 +10,7 @@ typedef void (*ObjTakarayaWallActionFunc)(struct ObjTakarayaWall*, GlobalContext typedef struct ObjTakarayaWall { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjTakarayaWallActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x98]; + /* 0x0148 */ char unk_148[0x98]; } ObjTakarayaWall; // size = 0x1E0 extern const ActorInit Obj_Takaraya_Wall_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 837c05ae9f..a62ce6cf6c 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -79,7 +79,7 @@ void ObjTokeiStep_SpawnDust(ObjTokeiStep* this, ObjTokeiStepPanel* panel, Global Vec3f dustSpawnOffset; Vec3f dustSpawnPos; - Matrix_RotateY(this->dyna.actor.shape.rot.y, 0); + Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_NEW); dustSpawnOffset.y = 115.0f; dustSpawnOffset.z = -10.0f; 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 6eedfd5005..0ffa733316 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c @@ -1,7 +1,7 @@ /* * File: z_obj_tree.c * Overlay: ovl_Obj_Tree - * Description: Single tree (e.g. North Clock Town) + * Description: Single branching tree (e.g. North Clock Town) */ #include "z_obj_tree.h" @@ -15,7 +15,10 @@ void ObjTree_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjTree_Update(Actor* thisx, GlobalContext* globalCtx); void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void ObTree_DoNothing(ObjTree* this, GlobalContext* globalCtx); +void ObTree_SetupDoNothing(ObjTree* this); +void ObTree_Sway(ObjTree* this, GlobalContext* globalCtx); + const ActorInit Obj_Tree_InitVars = { ACTOR_OBJ_TREE, ACTORCAT_PROP, @@ -28,15 +31,27 @@ const ActorInit Obj_Tree_InitVars = { (ActorFunc)ObjTree_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B9A570 = { - { COLTYPE_TREE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 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_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x0100020A, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 28, 120, 0, { 0, 0, 0 } }, }; -// static DamageTable sDamageTable = { -static DamageTable D_80B9A59C = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -71,32 +86,115 @@ static DamageTable D_80B9A59C = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80B9A5BC = { 8, 0, 0, 0, MASS_HEAVY }; +static CollisionCheckInfoInit2 sColchkInfoInit = { 8, 0, 0, 0, MASS_HEAVY }; -#endif +extern Gfx D_06000680[]; +extern Gfx D_060007C8[]; +extern CollisionHeader D_06001B2C; -extern ColliderCylinderInit D_80B9A570; -extern DamageTable D_80B9A59C; -extern CollisionCheckInfoInit2 D_80B9A5BC; +void ObjTree_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + ObjTree* this = THIS; + CollisionHeader* colHeader = NULL; -extern UNK_TYPE D_06000680; -extern UNK_TYPE D_06001B2C; + if (OBJTREE_ISLARGE(&this->dyna.actor)) { + Actor_SetScale(&this->dyna.actor, 0.15f); + this->dyna.actor.uncullZoneForward = 4000.0f; + } else { + Actor_SetScale(&this->dyna.actor, 0.1f); + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&D_06001B2C, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/ObjTree_Init.s") + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->dyna.actor.colChkInfo, &sDamageTable, &sColchkInfoInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/ObjTree_Destroy.s") + if (OBJTREE_ISLARGE(&this->dyna.actor)) { + this->collider.dim.height = 220; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/func_80B9A20C.s") + this->swayAmplitude = 0.0f; + this->swayAngle = 0; + this->swayVelocity = 0; + ObTree_SetupDoNothing(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/func_80B9A220.s") +void ObjTree_Destroy(Actor* thisx, GlobalContext* globalCtx) { + ObjTree* this = THIS; + s32 bgId; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/func_80B9A230.s") + if (!OBJTREE_ISLARGE(&this->dyna.actor)) { + bgId = this->dyna.bgId; + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, bgId); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/func_80B9A27C.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/func_80B9A348.s") +void ObTree_SetupDoNothing(ObjTree* this) { + this->actionFunc = ObTree_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/ObjTree_Update.s") +void ObTree_DoNothing(ObjTree* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Tree/ObjTree_Draw.s") +void ObTree_SetupSway(ObjTree* this) { + this->timer = 0; + this->swayAmplitude = 546.0f; + this->swayVelocity = 35 * 0x10000 / 360; + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TREE_SWING); + this->actionFunc = ObTree_Sway; +} + +void ObTree_Sway(ObjTree* this, GlobalContext* globalCtx) { + if (this->timer > 80) { + ObTree_SetupDoNothing(this); + return; + } + + Math_SmoothStepToF(&this->swayAmplitude, 0.0f, 0.1f, 91.0f, 18.0f); + this->swayVelocity += 1 * 0x10000 / 360; + this->swayAngle += this->swayVelocity; + this->dyna.actor.shape.rot.x = Math_SinS(this->swayAngle) * this->swayAmplitude; + this->dyna.actor.shape.rot.z = Math_CosS(this->swayAngle) * this->swayAmplitude; + this->timer++; +} + +void ObTree_UpdateCollision(ObjTree* this, GlobalContext* globalCtx) { + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + + if (this->dyna.actor.xzDistToPlayer < 600.0f) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + if (this->dyna.actor.home.rot.y == 1) { + this->dyna.actor.home.rot.y = 0; + ObTree_SetupSway(this); + } + } +} + +void ObjTree_Update(Actor* thisx, GlobalContext* globalCtx) { + ObjTree* this = THIS; + + this->actionFunc(this, globalCtx); + ObTree_UpdateCollision(this, globalCtx); +} + +void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx) { + s16 xRot = (f32)thisx->shape.rot.x; + s16 zRot = (f32)thisx->shape.rot.z; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_06000680); + + Matrix_InsertRotation(xRot, 0, zRot, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_060007C8); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h index 5c8f08ca0c..b50e3eb408 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h @@ -7,11 +7,16 @@ struct ObjTree; typedef void (*ObjTreeActionFunc)(struct ObjTree*, GlobalContext*); +#define OBJTREE_ISLARGE(thisx) ((thisx)->params & 0x8000) + typedef struct ObjTree { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x64]; - /* 0x01A8 */ ObjTreeActionFunc actionFunc; - /* 0x01AC */ char unk_1AC[0xC]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ ColliderCylinder collider; + /* 0x1A8 */ ObjTreeActionFunc actionFunc; + /* 0x1AC */ f32 swayAmplitude; + /* 0x1B0 */ s16 swayAngle; + /* 0x1B2 */ s16 swayVelocity; + /* 0x1B4 */ s16 timer; } ObjTree; // size = 0x1B8 extern const ActorInit Obj_Tree_InitVars; 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 31b7df5836..d3a188e41d 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -10,7 +10,7 @@ typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, GlobalContext*); typedef struct ObjTsubo { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjTsuboActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x54]; + /* 0x0148 */ char unk_148[0x54]; } ObjTsubo; // size = 0x19C extern const ActorInit Obj_Tsubo_InitVars; 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 4962598534..6e66c9cabe 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -172,7 +172,7 @@ void ObjWarpstone_Draw(Actor* thisx, GlobalContext* globalCtx2) { func_8012C2DC(globalCtx->state.gfxCtx); Matrix_InsertTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 34.0f, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY); + Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); Matrix_InsertTranslation(0.0f, 0.0f, 30.0f, MTXMODE_APPLY); Matrix_Scale(this->dyna.actor.velocity.x, this->dyna.actor.velocity.x, this->dyna.actor.velocity.x, MTXMODE_APPLY); 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 e7e4073a33..0b0b8b3752 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h @@ -10,7 +10,7 @@ typedef void (*ObjWturnActionFunc)(struct ObjWturn*, GlobalContext*); typedef struct ObjWturn { /* 0x0000 */ Actor actor; /* 0x0144 */ ObjWturnActionFunc actionFunc; - /* 0x0148 */ char unk_144[0x4]; + /* 0x0148 */ char unk_148[0x4]; } ObjWturn; // size = 0x14C extern const ActorInit Obj_Wturn_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c index 73ebea007b..2d8689d4fd 100644 --- a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c +++ b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c @@ -15,7 +15,6 @@ void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjYado_Update(Actor* thisx, GlobalContext* globalCtx); void ObjYado_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 const ActorInit Obj_Yado_InitVars = { ACTOR_OBJ_YADO, ACTORCAT_BG, @@ -28,22 +27,50 @@ const ActorInit Obj_Yado_InitVars = { (ActorFunc)ObjYado_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C16420[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +AnimatedMaterial* D_80C16470; -extern InitChainEntry D_80C16420[]; +extern Gfx D_06000320[]; +extern Gfx D_06000430[]; +extern AnimatedMaterial D_060012E8; -extern UNK_TYPE D_06000430; -extern UNK_TYPE D_060012E8; +void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx) { + ObjYado* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yado/ObjYado_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + D_80C16470 = (AnimatedMaterial*)Lib_SegmentedToVirtual(&D_060012E8); + this->isNight = gSaveContext.isNight; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yado/ObjYado_Destroy.s") +void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yado/ObjYado_Update.s") +void ObjYado_Update(Actor* thisx, GlobalContext* globalCtx) { + ObjYado* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yado/ObjYado_Draw.s") + this->isNight = gSaveContext.isNight; +} + +void ObjYado_Draw(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + ObjYado* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + if (this->isNight) { + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 95, 95, 70, 155)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 0, 40, 40, 255)); + } else { + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 255, 255, 215, 110)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 255, 255, 215, 255)); + } + + AnimatedMat_Draw(globalCtx, D_80C16470); + func_800BDFC0(globalCtx, D_06000430); + func_800BE03C(globalCtx, D_06000320); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.h b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.h index ee79705a27..28ffd63dc5 100644 --- a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.h +++ b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.h @@ -7,7 +7,7 @@ struct ObjYado; typedef struct ObjYado { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ u8 isNight; } ObjYado; // size = 0x148 extern const ActorInit Obj_Yado_InitVars; 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 e4b3e791d3..fe070b28de 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 @@ -8,50 +8,350 @@ #define PARAMS ((EffectSsKakeraInitParams*)initParamsx) -s32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -#if 0 +void func_8097E130(EffectSs* this, GlobalContext* globalCtx); + const EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, EffectSsKakera_Init, }; +KakeraColorStruct D_8097EAD8[] = { + { 0, { 255, 255, 255 } }, + { 0, { 235, 170, 130 } }, + { 1, { 210, 190, 170 } }, +}; +f32 D_8097EAE4[] = { 1.0f, 100.0f, 40.0f, 5.0f, 100.0f, 40.0f, 5.0f, 100.0f, 40.0f, 5.0f }; -#endif +u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { + EffectSsKakeraInitParams* params = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/EffectSsKakera_Init.s") + this->pos = params->pos; + this->velocity = params->velocity; + this->life = params->life; + this->priority = 101; + if (params->dList != NULL) { + this->gfx = params->dList; + switch (params->objId) { + case GAMEPLAY_KEEP: + case GAMEPLAY_FIELD_KEEP: + case GAMEPLAY_DANGEON_KEEP: + this->regs[10] = KAKERA_OBJECT_DEFAULT; + break; + default: + this->regs[10] = params->objId; + func_8097E130(this, globalCtx); + break; + } + } else { + __assert("../z_eff_kakera.c", 193); + } + this->draw = EffectSsKakera_Draw; + this->update = EffectSsKakera_Update; + this->vec = params->unk_18; + this->regs[0] = params->unk_2C; + this->regs[1] = params->gravity; + this->regs[2] = Rand_ZeroOne() * 0x8000; + this->regs[3] = Rand_ZeroOne() * 0x8000; + this->regs[4] = params->unk_26; + this->regs[5] = params->unk_28; + this->regs[6] = params->unk_2A; + this->regs[7] = params->scale; + this->regs[8] = params->unk_30; + this->regs[9] = params->unk_32; + this->regs[12] = params->colorIdx; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097DE30.s") +f32 func_8097DE30(f32 center, f32 range) { + return (2.0f * (Rand_ZeroOne() * range) - range) + center; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/EffectSsKakera_Draw.s") +void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + s16 pad; + f32 scale = this->regs[7] / 256.0f; + s32 colorIndex = this->regs[12]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E130.s") + OPEN_DISPS(gfxCtx); + if (this->regs[10] != KAKERA_OBJECT_DEFAULT) { + if ((((this->regs[4] >> 7) & 1) << 7) == 0x80) { + gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[this->regs[11]].segment); + } else { + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->regs[11]].segment); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E19C.s") + Matrix_InsertTranslation(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_RotateY(this->regs[3], MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->regs[2], MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E34C.s") + if ((((this->regs[4] >> 7) & 1) << 7) == 0x80) { + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(globalCtx->state.gfxCtx); + if (colorIndex >= 0) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, D_8097EAD8[colorIndex].lod, D_8097EAD8[colorIndex].color.r, + D_8097EAD8[colorIndex].color.g, D_8097EAD8[colorIndex].color.b, 255); + } + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + } else { + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(globalCtx->state.gfxCtx); + if (colorIndex >= 0) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, D_8097EAD8[colorIndex].lod, D_8097EAD8[colorIndex].color.r, + D_8097EAD8[colorIndex].color.g, D_8097EAD8[colorIndex].color.b, 255); + } + gSPDisplayList(POLY_OPA_DISP++, this->gfx); + } + CLOSE_DISPS(gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E368.s") +void func_8097E130(EffectSs* this, GlobalContext* globalCtx) { + this->regs[11] = Object_GetIndex(&globalCtx->objectCtx, this->regs[10]); + if ((this->regs[11] < 0) || (!Object_IsLoaded(&globalCtx->objectCtx, this->regs[11]))) { + this->life = 0; + this->draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E384.s") +void func_8097E19C(EffectSs* this) { + f32 range; + f32 temp_f12; + f32 temp_f16; + f32 temp_f2; + f32 temp_f18; + f32 temp_f0; + f32 temp_f20; + f32 temp_f2_2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E3C0.s") + temp_f18 = this->regs[5] / 1024.0f; + temp_f20 = this->regs[6] / 1024.0f; + range = (this->regs[9] / 1024.0f) * 4.0f; + temp_f2 = this->velocity.x - func_8097DE30(0.0f, range); + temp_f16 = this->velocity.y - func_8097DE30(0.0f, range); + temp_f12 = this->velocity.z - func_8097DE30(0.0f, range); + temp_f0 = temp_f2 * temp_f18; + temp_f2_2 = SQ(temp_f2) * temp_f20; + if (temp_f2 > 0.0f) { + this->velocity.x -= (temp_f0 + temp_f2_2); + } else { + this->velocity.x -= (temp_f0 - temp_f2_2); + } + temp_f0 = temp_f16 * temp_f18; + temp_f2_2 = SQ(temp_f16) * temp_f20; + if (temp_f16 > 0.0f) { + this->velocity.y -= (temp_f0 + temp_f2_2); + } else { + this->velocity.y -= (temp_f0 - temp_f2_2); + } + if (temp_f12 > 0.0f) { + this->velocity.z -= (temp_f0 + temp_f2_2); + } else { + this->velocity.z -= (temp_f0 - temp_f2_2); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E400.s") +void func_8097E34C(EffectSs* this) { + this->accel.x = this->accel.y = this->accel.z = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E420.s") +f32 func_8097E368(f32 arg0, s32 arg1) { + return 1.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E4B0.s") +f32 func_8097E384(f32 arg0, s32 index) { + if (D_8097EAE4[index] < arg0) { + return D_8097EAE4[index] / arg0; + } else { + return 1.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E4F0.s") +f32 func_8097E3C0(f32 arg0, s32 index) { + f32 square = SQ(arg0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E584.s") + if (D_8097EAE4[index] < square) { + return D_8097EAE4[index] / square; + } else { + return 1.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E660.s") +f32 func_8097E400(f32 arg0, s32 index) { + return func_8097E3C0(arg0, index); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E698.s") +s32 func_8097E420(EffectSs* this, Vec3f* diff, f32 distance) { + static f32 D_8097EB0C[] = { 0.05f, 1.0f }; + f32 phi_f0; + s32 index = this->regs[0] & 3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/func_8097E7E0.s") + if (index != 0) { + if (distance > 1.0f) { + phi_f0 = 1.0f / distance; + } else { + phi_f0 = 1.0f; + } + this->accel.x += D_8097EB0C[index - 1] * diff->z * phi_f0; + this->accel.z -= D_8097EB0C[index - 1] * diff->x * phi_f0; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Kakera/EffectSsKakera_Update.s") +s32 func_8097E4B0(EffectSs* this, Vec3f* diff, f32 distance) { + static f32 D_8097EB14[] = { 4.0f, 0.1f, 0.3f, 0.9f, -0.1f, -0.3f, -0.9f }; + s32 index = (this->regs[0] >> 2) & 7; + + if (index != 0) { + this->accel.y += D_8097EB14[index]; + } + return 1; +} + +s32 func_8097E4F0(EffectSs* this, Vec3f* diff, f32 distance) { + static f32 D_8097EB30[] = { 0.1f, 1.0f, 6.0f }; + f32 phi_f0; + s32 index = (this->regs[0] >> 5) & 3; + + if (index != 0) { + if (distance > 1.0f) { + phi_f0 = 1.0f / distance; + } else { + phi_f0 = 1.0f; + } + this->accel.x -= diff->x * D_8097EB30[index - 1] * phi_f0; + this->accel.z -= diff->z * D_8097EB30[index - 1] * phi_f0; + } + return 1; +} + +s32 func_8097E584(EffectSs* this, Vec3f* diff, f32 distance) { + static f32 (*D_8097EB3C[])(f32, + s32) = { func_8097E368, func_8097E384, func_8097E384, func_8097E384, func_8097E3C0, + func_8097E3C0, func_8097E3C0, func_8097E400, func_8097E400, func_8097E400 }; + f32 center; + f32 rand; + s32 index; + + index = (this->regs[0] >> 7) & 0xF; + center = D_8097EB3C[index](distance, index); + rand = func_8097DE30(center, (this->regs[9] * center) / 1024.0f); + this->accel.x *= rand; + this->accel.y *= rand; + this->accel.z *= rand; + this->accel.x += rand * 0.01f; + this->accel.y += rand * 0.01f; + this->accel.z += rand * 0.01f; + return 1; +} + +s32 func_8097E660(EffectSs* this, Vec3f* diff, f32 distance) { + this->accel.y += this->regs[1] / 256.0f; + return 1; +} + +s32 func_8097E698(EffectSs* this) { + Vec3f diff; + f32 distance; + + func_8097E34C(this); + diff.x = this->pos.x - this->vec.x; + diff.y = this->pos.y - this->vec.y; + diff.z = this->pos.z - this->vec.z; + distance = sqrtf(SQXYZ(diff)); + if (distance > 1000.0f) { + return false; + } + if (this->regs[0] != 0) { + if (func_8097E420(this, &diff, distance) == 0) { + return false; + } + if (func_8097E4B0(this, &diff, distance) == 0) { + return false; + } + if (func_8097E4F0(this, &diff, distance) == 0) { + return false; + } + if (func_8097E584(this, &diff, distance) == 0) { + return false; + } + } + if (func_8097E660(this, &diff, distance) == 0) { + return false; + } else { + return true; + } +} + +void func_8097E7E0(EffectSs* this, GlobalContext* globalCtx) { + static f32 D_8097EB64[] = { 10.0f, 20.0f, 40.0f }; + Player* player = GET_PLAYER(globalCtx); + + if (this->regs[8] == 0) { + if ((((this->regs[4] >> 4) & 1) << 4) == (1 << 4)) { + if (this->pos.y <= (player->actor.floorHeight - ((this->regs[4] >> 2) & 3))) { + this->regs[9] = 0; + this->regs[0] = 0; + this->regs[4] &= ~0x60; + this->accel.x = this->accel.y = this->accel.z = 0.0f; + this->velocity.x = this->velocity.y = this->velocity.z = 0.0f; + this->regs[5] = this->regs[9]; + this->regs[1] = this->regs[9]; + } + } else { + if (this->pos.y <= ((player->actor.floorHeight - ((this->regs[4] >> 2) & 3)) - 600.0f)) { + this->life = 0; + } + } + } else { + switch (this->regs[4] & 3) { + case 0: + this->regs[8] = 0; + break; + case 1: + if ((this->velocity.y < 0.0f) && + (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_8097EB64[(this->regs[4] >> 2) & 3]))) { + this->velocity.x *= func_8097DE30(0.9f, 0.2f); + this->velocity.y *= -0.8f; + this->velocity.z *= func_8097DE30(0.9f, 0.2f); + if (this->regs[8] > 0) { + this->regs[8]--; + } + } + break; + case 2: + if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_8097EB64[(this->regs[4] >> 2) & 3])) { + this->regs[8] = 0; + } + break; + } + } +} + +void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { + switch (((this->regs[4] >> 5) & 3) << 5) { + case 0x20: + this->regs[2] += 0x47B; + this->regs[3] += 0x139; + break; + case 0x40: + this->regs[2] += 0x1A7C; + this->regs[3] += 0x47B; + break; + case 0x60: + this->regs[2] += 0x3F27; + this->regs[3] += 0xCA1; + break; + } + func_8097E19C(this); + if (!func_8097E698(this)) { + this->life = 0; + } + func_8097E7E0(this, globalCtx); + if (this->regs[10] != KAKERA_OBJECT_DEFAULT) { + func_8097E130(this, globalCtx); + } +} 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 12135eb7b6..d55a683cd2 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 @@ -11,6 +11,11 @@ typedef enum { /* 1 */ KAKERA_COLOR_BROWN } KakeraColorIndex; +typedef struct { + /* 0x0 */ u8 lod; + /* 0x1 */ Color_RGB8 color; +} KakeraColorStruct; // size = 0x4 + typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; @@ -29,6 +34,5 @@ typedef struct { /* 0x3C */ Gfx* dList; } EffectSsKakeraInitParams; // size = 0x40 -extern const EffectSsInit Effect_Ss_Kakera_InitVars; #endif diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index 9069a6aca8..1637e19781 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -5,8 +5,8 @@ */ #include "z_daytelop.h" -#include "static/daytelop_static/daytelop_static.h" -#include "static/icon_item_gameover_static/icon_item_gameover_static.h" +#include "misc/daytelop_static/daytelop_static.h" +#include "interface/icon_item_gameover_static/icon_item_gameover_static.h" // unused UNK_TYPE D_808158E0[] = { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 62a85c8633..a98b8e24a5 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -6,7 +6,7 @@ #include "z_title.h" #include "overlays/gamestates/ovl_opening/z_opening.h" -#include "static/nintendo_rogo_static/nintendo_rogo_static.h" +#include "misc/nintendo_rogo_static/nintendo_rogo_static.h" void Title_UpdateCounters(TitleContext* this) { if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) { diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index 94da913d0d..a942638a2e 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = 4f7b8393ec8a3abd59649c2ba669e951fb61f3d2 - parent = 346df1bbc8ca21673fe63d884b6734c23a4d9f4b + commit = 50242eca96a9c36fd84f438bab24548e73b42303 + parent = 744955732b1fc9e8a835c62440aa97799cfe8940 method = merge cmdver = 0.4.3 diff --git a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj b/tools/ZAPD/ExporterTest/ExporterTest.vcxproj index a709a35091..839d451023 100644 --- a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj +++ b/tools/ZAPD/ExporterTest/ExporterTest.vcxproj @@ -79,7 +79,7 @@ true - $(SolutionDir)\ZAPD\;$(SolutionDir)ZAPDUtils;$(SolutionDir)lib\tinyxml2;$(SolutionDir)lib\libgfxd;$(SolutionDir)lib\elfio;$(SolutionDir)lib\stb;$(ProjectDir);$(IncludePath) + $(ProjectDir)..\ZAPD\;$(ProjectDir)..\ZAPDUtils;$(ProjectDir)..\lib\tinyxml2;$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\lib\elfio;$(ProjectDir)..\lib\stb;$(ProjectDir);$(IncludePath) false @@ -120,6 +120,7 @@ true stdcpp17 stdc11 + MultiThreadedDebug Console @@ -156,4 +157,4 @@ - + \ No newline at end of file diff --git a/tools/ZAPD/ExporterTest/Main.cpp b/tools/ZAPD/ExporterTest/Main.cpp index 4f683a1ba3..07fdbeeced 100644 --- a/tools/ZAPD/ExporterTest/Main.cpp +++ b/tools/ZAPD/ExporterTest/Main.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include "CollisionExporter.h" +#include "Globals.h" +#include "RoomExporter.h" +#include "TextureExporter.h" enum class ExporterFileMode { diff --git a/tools/ZAPD/ExporterTest/Makefile b/tools/ZAPD/ExporterTest/Makefile index a2bfa9a814..42033b7c0c 100644 --- a/tools/ZAPD/ExporterTest/Makefile +++ b/tools/ZAPD/ExporterTest/Makefile @@ -1,7 +1,7 @@ # Only used for standalone compilation, usually inherits these from the main makefile CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17 -SRC_DIRS := $(shell find -type d -not -path "*build*") +SRC_DIRS := $(shell find . -type d -not -path "*build*") CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) diff --git a/tools/ZAPD/ExporterTest/RoomExporter.cpp b/tools/ZAPD/ExporterTest/RoomExporter.cpp index c4a6844fb5..6c5552d8f8 100644 --- a/tools/ZAPD/ExporterTest/RoomExporter.cpp +++ b/tools/ZAPD/ExporterTest/RoomExporter.cpp @@ -1,24 +1,24 @@ #include "RoomExporter.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "CollisionExporter.h" +#include "Utils/BinaryWriter.h" +#include "Utils/File.h" +#include "Utils/MemoryStream.h" +#include "ZRoom/Commands/SetCameraSettings.h" +#include "ZRoom/Commands/SetCollisionHeader.h" +#include "ZRoom/Commands/SetCsCamera.h" +#include "ZRoom/Commands/SetEchoSettings.h" +#include "ZRoom/Commands/SetEntranceList.h" +#include "ZRoom/Commands/SetLightingSettings.h" +#include "ZRoom/Commands/SetMesh.h" +#include "ZRoom/Commands/SetRoomBehavior.h" +#include "ZRoom/Commands/SetRoomList.h" +#include "ZRoom/Commands/SetSkyboxModifier.h" +#include "ZRoom/Commands/SetSkyboxSettings.h" +#include "ZRoom/Commands/SetSoundSettings.h" +#include "ZRoom/Commands/SetSpecialObjects.h" +#include "ZRoom/Commands/SetStartPositionList.h" +#include "ZRoom/Commands/SetTimeSettings.h" +#include "ZRoom/Commands/SetWind.h" void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter* writer) { diff --git a/tools/ZAPD/ExporterTest/TextureExporter.h b/tools/ZAPD/ExporterTest/TextureExporter.h index ffe6001dca..41c4e79be2 100644 --- a/tools/ZAPD/ExporterTest/TextureExporter.h +++ b/tools/ZAPD/ExporterTest/TextureExporter.h @@ -1,6 +1,6 @@ #pragma once -#include +#include "Utils/BinaryWriter.h" #include "ZResource.h" #include "ZTexture.h" diff --git a/tools/ZAPD/Jenkinsfile b/tools/ZAPD/Jenkinsfile index 051e5f9982..8db69a1e30 100644 --- a/tools/ZAPD/Jenkinsfile +++ b/tools/ZAPD/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { // Non-parallel ZAPD stage stage('Build ZAPD') { steps { - sh 'make -j' + sh 'make -j WERROR=1' } } @@ -22,13 +22,13 @@ pipeline { } } - stage('Checkout mm') { - steps{ - dir('mm') { - git url: 'https://github.com/zeldaret/mm.git' - } - } - } + // stage('Checkout mm') { + // steps{ + // dir('mm') { + // git url: 'https://github.com/zeldaret/mm.git' + // } + // } + // } } } @@ -51,20 +51,20 @@ pipeline { } } - stage('Setup MM') { - steps { - dir('mm') { - sh 'cp /usr/local/etc/roms/mm.us.rev1.z64 baserom.mm.us.rev1.z64' + // stage('Setup MM') { + // steps { + // dir('mm') { + // sh 'cp /usr/local/etc/roms/mm.us.rev1.z64 baserom.mm.us.rev1.z64' - // Identical to `make setup` except for copying our newer ZAPD.out into mm - sh 'make -C tools' - sh 'cp ../ZAPD.out tools/ZAPD/' - sh 'python3 tools/fixbaserom.py' - sh 'python3 tools/extract_baserom.py' - sh 'python3 extract_assets.py -t 4' - } - } - } + // // Identical to `make setup` except for copying our newer ZAPD.out into mm + // sh 'make -C tools' + // sh 'cp ../ZAPD.out tools/ZAPD/' + // sh 'python3 tools/fixbaserom.py' + // sh 'python3 tools/extract_baserom.py' + // sh 'python3 extract_assets.py -t 4' + // } + // } + // } } } @@ -78,14 +78,14 @@ pipeline { } } } - stage('Build mm') { - steps { - dir('mm') { - sh 'make -j disasm' - sh 'make -j all' - } - } - } + // stage('Build mm') { + // steps { + // dir('mm') { + // sh 'make -j disasm' + // sh 'make -j all' + // } + // } + // } } } } diff --git a/tools/ZAPD/Makefile b/tools/ZAPD/Makefile index 737b85ecf7..2b47a8039b 100644 --- a/tools/ZAPD/Makefile +++ b/tools/ZAPD/Makefile @@ -6,6 +6,7 @@ DEPRECATION_ON ?= 1 DEBUG ?= 0 COPYCHECK_ARGS ?= LLD ?= 0 +WERROR ?= 0 # Use clang++ if available, else use g++ ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0) @@ -23,14 +24,16 @@ ifneq ($(DEBUG),0) CXXFLAGS += -g3 -DDEVELOPMENT -D_DEBUG COPYCHECK_ARGS += --devel DEPRECATION_ON = 0 -else +endif + +ifneq ($(WERROR),0) CXXFLAGS += -Werror endif ifeq ($(OPTIMIZATION_ON),0) OPTFLAGS := -O0 else - OPTFLAGS := -O2 -march=native -mtune=native + OPTFLAGS := -O2 endif ifneq ($(ASAN),0) @@ -53,10 +56,23 @@ ifneq ($(LLD),0) endif UNAME := $(shell uname) +UNAMEM := $(shell uname -m) ifneq ($(UNAME), Darwin) - LDFLAGS += -Wl,-export-dynamic -lstdc++fs + LDFLAGS += -Wl,-export-dynamic -lstdc++fs + EXPORTERS := -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive +else + EXPORTERS := -Wl,-force_load ExporterTest/ExporterTest.a + ifeq ($(UNAMEM),arm64) + ifeq ($(shell brew list libpng > /dev/null 2>&1; echo $$?),0) + LDFLAGS += -L $(shell brew --prefix)/lib + INC += -I $(shell brew --prefix)/include + else + $(error Please install libpng via Homebrew) + endif + endif endif + ZAPD_SRC_DIRS := $(shell find ZAPD -type d) SRC_DIRS = $(ZAPD_SRC_DIRS) lib/tinyxml2 @@ -115,4 +131,4 @@ ZAPDUtils: # Linking ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils - $(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive $(LDFLAGS) $(OUTPUT_OPTION) + $(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION) diff --git a/tools/ZAPD/README.md b/tools/ZAPD/README.md index e2764b6277..44d26b8b3e 100644 --- a/tools/ZAPD/README.md +++ b/tools/ZAPD/README.md @@ -16,6 +16,14 @@ In a Debian/Ubuntu based environment, those could be installed with the followin sudo apt install libpng-dev ``` +On a Mac, you will need to install libpng with Homebrew or MacPorts; we currently only support Homebrew. You can run + +```bash +brew install libpng +``` + +to install it via Homebrew. + ### Building #### Linux / *nix @@ -109,11 +117,51 @@ ZAPD also accepts the following list of extra parameters: - Could be useful for looking at raw data or testing. - Can be used only in `e` or `bsf` modes. - `-tm MODE`: Test Mode (enables certain experimental features). To enable it, set `MODE` to `1`. -- `-wno` / `--warn-no-offsets` : Enable warnings for nodes that dont have offsets specified. Takes priority over `-eno`/ `--error-no-offsets`. -- `-eno` / `--error-no-offsets` : Enable errors for nodes that dont have offsets specified. - `-se` / `--set-exporter` : Sets which exporter to use. -- `--gcc-compat` : Enables GCC compatible mode. Slower. +- `--gcc-compat` : Enables GCC compatibly mode. Slower. - `-s` / `--static` : Mark every asset as `static`. - This behaviour can be overridden per asset using `Static=` in the respective XML node. +- `-W...`: warning flags, see below Additionally, you can pass the flag `--version` to see the current ZAPD version. If that flag is passed, ZAPD will ignore any other parameter passed. + +### Warning flags + +ZAPD contains a variety of warning types, with similar syntax to GCC or Clang's compiler warnings. Warnings can have three levels: + +- Off (does not display anything) +- Warn (print a warning but continue processing) +- Err (behave like an error, i.e. print and throw an exception to crash ZAPD when occurs) + +Each warning type uses one of these by default, but can be modified with flags, similarly to GCC or Clang: + +- `-Wfoo` enables warnings of type `foo` +- `-Wno-foo` disables warnings of type `foo` +- `-Werror=foo` escalates `foo` to behave like an error +- `-Weverything` enables all warnings (they may be turned off using `-Wno-` flags afterwards) +- `-Werror` escalates all enabled warnings to errors + +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 | + +There are also errors that do not have a type, and cannot be disabled. + +For example, here we have invoked ZAPD in the usual way to extract using a (rather badly-written) XML, but escalating `-Wintersection` to an error: + +![ZAPD warnings example](docs/zapd_warning_example.png?raw=true) diff --git a/tools/ZAPD/ZAPD/Declaration.cpp b/tools/ZAPD/ZAPD/Declaration.cpp index d2a86ffcc5..be06b0bea7 100644 --- a/tools/ZAPD/ZAPD/Declaration.cpp +++ b/tools/ZAPD/ZAPD/Declaration.cpp @@ -92,20 +92,20 @@ std::string Declaration::GetNormalDeclarationStr() const if (isArray) { - if (arrayItemCntStr != "") + if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) { output += StringHelper::Sprintf("%s %s[%s];\n", varType.c_str(), varName.c_str(), arrayItemCntStr.c_str()); } - else if (arrayItemCnt == 0) - { - output += StringHelper::Sprintf("%s %s[] = {\n", varType.c_str(), varName.c_str()); - } - else + else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) { output += StringHelper::Sprintf("%s %s[%i] = {\n", varType.c_str(), varName.c_str(), arrayItemCnt); } + else + { + output += StringHelper::Sprintf("%s %s[] = {\n", varType.c_str(), varName.c_str()); + } output += text + "\n"; } @@ -145,16 +145,16 @@ std::string Declaration::GetExternalDeclarationStr() const output += "static "; } - if (arrayItemCntStr != "") + 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[%s] = {\n#include \"%s\"\n};", varType.c_str(), - varName.c_str(), arrayItemCntStr.c_str(), includePath.c_str()); - else if (arrayItemCnt != 0) - output += StringHelper::Sprintf("%s %s[%i] = {\n#include \"%s\"\n};", varType.c_str(), - varName.c_str(), arrayItemCnt, includePath.c_str()); + StringHelper::Sprintf("%s %s[%i] = ", varType.c_str(), varName.c_str(), arrayItemCnt); else - output += StringHelper::Sprintf("%s %s[] = {\n#include \"%s\"\n};", varType.c_str(), - varName.c_str(), includePath.c_str()); + 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 + ""; @@ -178,14 +178,16 @@ std::string Declaration::GetExternStr() const if (isArray) { - if (arrayItemCntStr != "") + if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) { return StringHelper::Sprintf("extern %s %s[%s];\n", varType.c_str(), varName.c_str(), arrayItemCntStr.c_str()); } - else if (arrayItemCnt != 0) + else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) + { return StringHelper::Sprintf("extern %s %s[%i];\n", varType.c_str(), varName.c_str(), arrayItemCnt); + } else return StringHelper::Sprintf("extern %s %s[];\n", varType.c_str(), varName.c_str()); } diff --git a/tools/ZAPD/ZAPD/Declaration.h b/tools/ZAPD/ZAPD/Declaration.h index 138524a4c2..b7bb0d30d2 100644 --- a/tools/ZAPD/ZAPD/Declaration.h +++ b/tools/ZAPD/ZAPD/Declaration.h @@ -38,10 +38,12 @@ public: std::string varType; std::string varName; std::string includePath; + bool isExternal = false; bool isArray = false; + bool forceArrayCnt = false; size_t arrayItemCnt = 0; - std::string arrayItemCntStr; + std::string arrayItemCntStr = ""; std::vector references; bool isUnaccounted = false; bool isPlaceholder = false; diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp index f197493a4a..ae29ba28fa 100644 --- a/tools/ZAPD/ZAPD/GameConfig.cpp +++ b/tools/ZAPD/ZAPD/GameConfig.cpp @@ -25,7 +25,7 @@ GameConfig::~GameConfig() void GameConfig::ReadTexturePool(const fs::path& texturePoolXmlPath) { tinyxml2::XMLDocument doc; - tinyxml2::XMLError eResult = doc.LoadFile(texturePoolXmlPath.c_str()); + tinyxml2::XMLError eResult = doc.LoadFile(texturePoolXmlPath.string().c_str()); if (eResult != tinyxml2::XML_SUCCESS) { @@ -155,7 +155,7 @@ void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath) {"ExternalFile", &GameConfig::ConfigFunc_ExternalFile}, }; - configFilePath = argConfigFilePath; + configFilePath = argConfigFilePath.string(); tinyxml2::XMLDocument doc; tinyxml2::XMLError eResult = doc.LoadFile(configFilePath.c_str()); diff --git a/tools/ZAPD/ZAPD/Globals.cpp b/tools/ZAPD/ZAPD/Globals.cpp index 036e4a5cbf..528a09d256 100644 --- a/tools/ZAPD/ZAPD/Globals.cpp +++ b/tools/ZAPD/ZAPD/Globals.cpp @@ -3,8 +3,9 @@ #include #include -#include -#include +#include "Utils/File.h" +#include "Utils/Path.h" +#include "WarningHandler.h" #include "tinyxml2.h" Globals* Globals::Instance; diff --git a/tools/ZAPD/ZAPD/Globals.h b/tools/ZAPD/ZAPD/Globals.h index 265f1af241..19e193f123 100644 --- a/tools/ZAPD/ZAPD/Globals.h +++ b/tools/ZAPD/ZAPD/Globals.h @@ -20,6 +20,7 @@ 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 { @@ -34,6 +35,7 @@ public: ExporterSetFunc endFileFunc = nullptr; ExporterSetFuncVoid3 beginXMLFunc = nullptr; ExporterSetFuncVoid3 endXMLFunc = nullptr; + ExporterSetResSave resSaveFunc = nullptr; }; class Globals @@ -53,9 +55,6 @@ public: TextureType texType; ZGame game; GameConfig cfg; - bool warnUnaccounted = false; - bool warnNoOffset = false; - bool errorNoOffset = false; bool verboseUnaccounted = false; bool gccCompat = false; bool forceStatic = false; diff --git a/tools/ZAPD/ZAPD/ImageBackend.cpp b/tools/ZAPD/ZAPD/ImageBackend.cpp index 137e326c33..8accb6b4e1 100644 --- a/tools/ZAPD/ZAPD/ImageBackend.cpp +++ b/tools/ZAPD/ZAPD/ImageBackend.cpp @@ -6,6 +6,7 @@ #include #include "Utils/StringHelper.h" +#include "WarningHandler.h" /* ImageBackend */ @@ -20,19 +21,28 @@ void ImageBackend::ReadPng(const char* filename) FILE* fp = fopen(filename, "rb"); if (fp == nullptr) - throw std::runtime_error(StringHelper::Sprintf( - "ImageBackend::ReadPng: Error.\n\t Couldn't open file '%s'.", filename)); + { + std::string errorHeader = StringHelper::Sprintf("could not open file '%s'", filename); + HANDLE_ERROR(WarningType::InvalidPNG, errorHeader, ""); + } png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (!png) - throw std::runtime_error("ImageBackend::ReadPng: Error.\n\t Couldn't create png struct."); + if (png == nullptr) + { + HANDLE_ERROR(WarningType::InvalidPNG, "could not create png struct", ""); + } png_infop info = png_create_info_struct(png); - if (!info) - throw std::runtime_error("ImageBackend::ReadPng: Error.\n\t Couldn't create png info."); + if (info == nullptr) + { + HANDLE_ERROR(WarningType::InvalidPNG, "could not create png info", ""); + } if (setjmp(png_jmpbuf(png))) - throw std::runtime_error("ImageBackend::ReadPng: Error.\n\t setjmp(png_jmpbuf(png))."); + { + // TODO: better warning explanation + HANDLE_ERROR(WarningType::InvalidPNG, "setjmp(png_jmpbuf(png))", ""); + } png_init_io(png, fp); @@ -145,20 +155,30 @@ void ImageBackend::WritePng(const char* filename) assert(hasImageData); FILE* fp = fopen(filename, "wb"); - if (!fp) - throw std::runtime_error(StringHelper::Sprintf( - "ImageBackend::WritePng: Error.\n\t Couldn't open file '%s' in write mode.", filename)); + if (fp == nullptr) + { + std::string errorHeader = + StringHelper::Sprintf("could not open file '%s' in write mode", filename); + HANDLE_ERROR(WarningType::InvalidPNG, errorHeader, ""); + } png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (!png) - throw std::runtime_error("ImageBackend::WritePng: Error.\n\t Couldn't create png struct."); + if (png == nullptr) + { + HANDLE_ERROR(WarningType::InvalidPNG, "could not create png struct", ""); + } png_infop info = png_create_info_struct(png); - if (!info) - throw std::runtime_error("ImageBackend::WritePng: Error.\n\t Couldn't create png info."); + if (info == nullptr) + { + HANDLE_ERROR(WarningType::InvalidPNG, "could not create png info", ""); + } if (setjmp(png_jmpbuf(png))) - throw std::runtime_error("ImageBackend::WritePng: Error.\n\t setjmp(png_jmpbuf(png))."); + { + // TODO: better warning description + HANDLE_ERROR(WarningType::InvalidPNG, "setjmp(png_jmpbuf(png))", ""); + } png_init_io(png, fp); @@ -441,7 +461,7 @@ double ImageBackend::GetBytesPerPixel() const return 1 * bitDepth / 8; default: - throw std::invalid_argument("ImageBackend::GetBytesPerPixel():\n\t Invalid color type."); + HANDLE_ERROR(WarningType::InvalidPNG, "invalid color type", ""); } } diff --git a/tools/ZAPD/ZAPD/Main.cpp b/tools/ZAPD/ZAPD/Main.cpp index 298ca02629..fd2ed06dc0 100644 --- a/tools/ZAPD/ZAPD/Main.cpp +++ b/tools/ZAPD/ZAPD/Main.cpp @@ -1,8 +1,9 @@ -#include -#include -#include #include "Globals.h" #include "Overlays/ZOverlay.h" +#include "Utils/Directory.h" +#include "Utils/File.h" +#include "Utils/Path.h" +#include "WarningHandler.h" #include "ZAnimation.h" #include "ZBackground.h" #include "ZBlob.h" @@ -12,10 +13,10 @@ #if !defined(_MSC_VER) && !defined(__CYGWIN__) #include #include +#include #include // for __cxa_demangle #include // for dladdr #include -#include #include #endif @@ -47,6 +48,7 @@ void ErrorHandler(int sig) const char* crashEasterEgg[] = { "\tYou've met with a terrible fate, haven't you?", "\tSEA BEARS FOAM. SLEEP BEARS DREAMS. \n\tBOTH END IN THE SAME WAY: CRASSSH!", + "ZAPD has fallen and cannot get up." }; srand(time(nullptr)); @@ -97,6 +99,9 @@ int main(int argc, char* argv[]) return 1; } + Globals* g = new Globals(); + WarningHandler::Init(argc, argv); + for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "--version")) @@ -109,12 +114,12 @@ int main(int argc, char* argv[]) printf("Congratulations!\n"); printf("You just found the (unimplemented and undocumented) ZAPD's help message.\n"); printf("Feel free to implement it if you want :D\n"); + + WarningHandler::PrintHelp(); return 0; } } - Globals* g = new Globals; - // Parse other "commands" for (int32_t i = 2; i < argc; i++) { @@ -186,26 +191,15 @@ int main(int argc, char* argv[]) signal(SIGSEGV, ErrorHandler); signal(SIGABRT, ErrorHandler); #else - fprintf(stderr, - "Warning: Tried to set error handler, but this build lacks support for one.\n"); + HANDLE_WARNING(WarningType::Always, + "tried to set error handler, but this ZAPD build lacks support for one", + ""); #endif } else if (arg == "-v") // Verbose { Globals::Instance->verbosity = static_cast(strtol(argv[++i], NULL, 16)); } - else if (arg == "-wu" || arg == "--warn-unaccounted") // Warn unaccounted - { - Globals::Instance->warnUnaccounted = true; - } - else if (arg == "-wno" || arg == "--warn-no-offset") - { - Globals::Instance->warnNoOffset = true; - } - else if (arg == "-eno" || arg == "--error-no-offset") - { - Globals::Instance->errorNoOffset = true; - } else if (arg == "-vu" || arg == "--verbose-unaccounted") // Verbose unaccounted { Globals::Instance->verboseUnaccounted = true; @@ -262,6 +256,11 @@ int main(int argc, char* argv[]) if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) 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) { @@ -334,7 +333,9 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path if (eResult != tinyxml2::XML_SUCCESS) { - fprintf(stderr, "Invalid xml file: '%s'\n", xmlFilePath.c_str()); + // TODO: use XMLDocument::ErrorIDToName to get more specific error messages here + HANDLE_ERROR(WarningType::InvalidXML, + StringHelper::Sprintf("invalid XML file: '%s'", xmlFilePath.c_str()), ""); return false; } @@ -342,7 +343,9 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path if (root == nullptr) { - fprintf(stderr, "Missing Root tag in xml file: '%s'\n", xmlFilePath.c_str()); + HANDLE_WARNING( + WarningType::InvalidXML, + StringHelper::Sprintf("missing Root tag in xml file: '%s'", xmlFilePath.c_str()), ""); return false; } @@ -392,10 +395,11 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path } else { - throw std::runtime_error(StringHelper::Sprintf( - "Parse: Fatal error in '%s'.\n\t A resource was found outside of " - "a File element: '%s'\n", - xmlFilePath.c_str(), child->Name())); + std::string errorHeader = + StringHelper::Sprintf("when parsing file '%s'", xmlFilePath.c_str()); + std::string errorBody = StringHelper::Sprintf( + "Found a resource outside a File element: '%s'", child->Name()); + HANDLE_ERROR(WarningType::InvalidXML, errorHeader, errorBody); } } diff --git a/tools/ZAPD/ZAPD/NuGet/libpng.static.txt b/tools/ZAPD/ZAPD/NuGet/libpng.static.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/ZAPD/ZAPD/Overlays/ZOverlay.cpp b/tools/ZAPD/ZAPD/Overlays/ZOverlay.cpp index a842a7e7d9..510de19aba 100644 --- a/tools/ZAPD/ZAPD/Overlays/ZOverlay.cpp +++ b/tools/ZAPD/ZAPD/Overlays/ZOverlay.cpp @@ -1,13 +1,13 @@ #include "ZOverlay.h" -#include +#include #include - -#include -#include -#include -#include #include "Globals.h" +#include "Utils/Directory.h" +#include "Utils/File.h" +#include "Utils/Path.h" +#include "Utils/StringHelper.h" +#include "WarningHandler.h" using namespace ELFIO; @@ -90,7 +90,7 @@ ZOverlay* ZOverlay::FromBuild(fs::path buildPath, fs::path cfgFolderPath) std::vector readers; for (size_t i = 1; i < cfgLines.size(); i++) { - std::string elfPath = buildPath / (cfgLines[i].substr(0, cfgLines[i].size() - 2) + ".o"); + std::string elfPath = (buildPath / (cfgLines[i].substr(0, cfgLines[i].size() - 2) + ".o")).string(); elfio* reader = new elfio(); if (!reader->load(elfPath)) @@ -128,7 +128,9 @@ ZOverlay* ZOverlay::FromBuild(fs::path buildPath, fs::path cfgFolderPath) SectionType sectionType = GetSectionTypeFromStr(pSec->get_name()); if (sectionType == SectionType::ERROR) - fprintf(stderr, "WARNING: One of the section types returned ERROR\n"); + { + HANDLE_WARNING(WarningType::Always, "one of the section types returned ERROR", ""); + } relocation_section_accessor relocs(*curReader, pSec); for (Elf_Xword j = 0; j < relocs.get_entries_num(); j++) diff --git a/tools/ZAPD/ZAPD/WarningHandler.cpp b/tools/ZAPD/ZAPD/WarningHandler.cpp new file mode 100644 index 0000000000..29f8352a71 --- /dev/null +++ b/tools/ZAPD/ZAPD/WarningHandler.cpp @@ -0,0 +1,443 @@ +/** + * ZAPD Warning- and Error-handling system + * ======================================= + * + * This provides a common standard way to write ZAPD warnings/errors, which should be used for all + * such. It will pretty-print them in a uniform way, with styles defined in the header. + * + * Warnings/errors should be constructed using the macros given in the header; there are now plenty + * of examples in the codebase of how to do this. Their purposes are noted above each category in + * the header. Each warning has a type, one of the ones in warningStringToInitMap, or + * WarningType::Always, which is used for warnings that cannot be disabled and do not display a + * type. + * + * Currently there are three levels of alert a warning can have: + * - Off (does not display anything) + * - Warn (print a warning but continue processing) + * - Err (behave like an error, i.e. print and throw an exception to crash ZAPD when occurs) + * + * Flag use: + * - -Wfoo enables warnings of type foo + * - -Wno-foo disables warnings of type foo + * - -Werror=foo escalates foo to behave like an error + * - -Weverything enables all warnings + * - -Werror escalates all enabled warnings to errors + * + * Errors do not have types, and will always throw an exception; they cannot be disabled. + * + * Format + * === + * Each printed warning/error contains the same three sections: + * - Preamble: automatically generated; the content varies depending on category. It will print the + * file and function that the warning is from, and information about the files being processed + * or extracted. + * - Header: begins with 'warning: ' or 'error:', should contain essential information about the + * warning/error, ends with the warning type if applicable. Printed with emphasis to make it + * stand out. Does not start with a capital letter or end with a '.' + * - Body (optional): indented, should contain further diagnostic information useful for identifying + * and fixing the warning/error. Can be a sentence with captialisation and '.' on the end. + * + * Please think of what the end user will find most useful when writing the header and body, and try + * to keep it brief without sacrificing important information! Also remember that if the user is + * only looking at stderr, they will normally have no other context. + * + * Warning vs error + * === + * The principle that we have operated on so far is + * - issue a warning if ZAPD will still be able to produce a valid, compilable C file that will + * match + * - if this cannot happen, use an error. + * but at the end of the day, it is up to the programmer's discretion what it should be possible to + * disable. + * + * Documentation + * === + * Remember that all warnings also need to be documented in the README.md. The help is generated + * automatically. + */ +#include "WarningHandler.h" + +#include +#include "Globals.h" +#include "Utils/StringHelper.h" + +typedef struct +{ + WarningType type; + WarningLevel defaultLevel; + std::string description; +} WarningInfoInit; + +typedef struct +{ + WarningLevel level; + std::string name; + std::string description; +} WarningInfo; + +/** + * Master list of all default warning types and features + * + * To add a warning type, fill in a new row of this map. Think carefully about what its default + * level should be, and try and make the description both brief and informative: it is used in the + * help message, so again, think about what the end user needs to know. + */ +// clang-format off +static const std::unordered_map warningStringToInitMap = { + {"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"}}, +}; + +/** + * Map constructed at runtime to contain the warning features as set by the user using -W flags. + */ +static std::unordered_map warningTypeToInfoMap; + +void WarningHandler::ConstructTypeToInfoMap() { + for (auto& entry : warningStringToInitMap) { + warningTypeToInfoMap[entry.second.type] = {entry.second.defaultLevel, entry.first, entry.second.description}; + } + warningTypeToInfoMap[WarningType::Always] = {WarningLevel::Warn, "always", "you shouldn't be reading this"}; + assert(warningTypeToInfoMap.size() == static_cast(WarningType::Max)); +} + +/** + * Initialises the main warning type map and reads flags passed to set each warning type's level. + */ +void WarningHandler::Init(int argc, char* argv[]) { + ConstructTypeToInfoMap(); + + bool werror = false; + for (int i = 1; i < argc; i++) { + // If it doesn't start with "-W" skip it. + if (argv[i][0] != '-' || argv[i][1] != 'W' || argv[i][2] == '\0') { + continue; + } + + WarningLevel warningTypeOn = WarningLevel::Warn; + size_t startingIndex = 2; + + // "-Wno-" + if (argv[i][2] == 'n' && argv[i][3] == 'o' && argv[i][4] == '-' && argv[i][5] != '\0') { + warningTypeOn = WarningLevel::Off; + startingIndex = 5; + } + + // Read starting after the "-W" or "-Wno-" + std::string_view currentArgv = &argv[i][startingIndex]; + + if (currentArgv == "error") { + werror = warningTypeOn != WarningLevel::Off; + } else if (currentArgv == "everything") { + for (auto& it: warningTypeToInfoMap) { + if (it.second.level <= WarningLevel::Warn) { + it.second.level = warningTypeOn; + } + } + } else { + // "-Werror=" / "-Wno-error=" parser + if (currentArgv.rfind("error=", 0) == 0) { + // Read starting after the "error=" part + currentArgv = &argv[i][startingIndex + 6]; + warningTypeOn = warningTypeOn != WarningLevel::Off ? WarningLevel::Err : WarningLevel::Warn; + } + + auto it = warningStringToInitMap.find(std::string(currentArgv)); + if (it != warningStringToInitMap.end()) { + warningTypeToInfoMap[it->second.type].level = warningTypeOn; + } + else { + HANDLE_WARNING(WarningType::Always, StringHelper::Sprintf("unknown warning flag '%s'", argv[i]), ""); + } + } + } + + if (werror) { + for (auto& it: warningTypeToInfoMap) { + if (it.second.level >= WarningLevel::Warn) { + it.second.level = WarningLevel::Err; + } + } + } +} + +bool WarningHandler::IsWarningEnabled(WarningType warnType) { + assert(static_cast(warnType) >= 0 && warnType < WarningType::Max); + + return warningTypeToInfoMap.at(warnType).level != WarningLevel::Off; +} + +bool WarningHandler::WasElevatedToError(WarningType warnType) { + assert(static_cast(warnType) >= 0 && warnType < WarningType::Max); + + if (!IsWarningEnabled(warnType)) { + return false; + } + + return warningTypeToInfoMap.at(warnType).level >= WarningLevel::Err; +} + +/** + * Print file/line/function info for debugging + */ +void WarningHandler::FunctionPreamble(const char* filename, int32_t line, const char* function) { + if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) { + fprintf(stderr, "%s:%i: in function %s:\n", filename, line, function); + } +} + +/** + * Print the information about the file(s) being processed (XML for extraction, png etc. for building) + */ +void WarningHandler::ProcessedFilePreamble() { + if (Globals::Instance->inputPath != "") { + fprintf(stderr, "When processing file %s: ", Globals::Instance->inputPath.c_str()); + } +} + +/** + * Print information about the binary file being extracted + */ +void WarningHandler::ExtractedFilePreamble(const ZFile *parent, const ZResource* res, const uint32_t offset) { + fprintf(stderr, "in input binary file %s, ", parent->GetName().c_str()); + if (res != nullptr) { + fprintf(stderr, "resource '%s' at ", res->GetName().c_str()); + } + fprintf(stderr, "offset 0x%06X: \n\t", offset); +} + +/** + * Construct the rest of the message, after warning:/error. The message is filled in one character at a time, with indents added after newlines + */ +std::string WarningHandler::ConstructMessage(std::string message, const std::string& header, const std::string& body) { + message.reserve(message.size() + header.size() + body.size() + 10 * (sizeof(HANG_INDT) - 1)); + message += StringHelper::Sprintf(HILITE("%s"), header.c_str()); + message += "\n"; + + if (body == "") { + return message; + } + + message += HANG_INDT; + for (const char* ptr = body.c_str(); *ptr != '\0'; ptr++) { + message += *ptr; + if (*ptr == '\n') { + message += HANG_INDT; + } + } + message += "\n"; + + return message; +} + +/* Error module functions */ + +void WarningHandler::PrintErrorAndThrow(const std::string& header, const std::string& body) { + std::string errorMsg = ERR_FMT("error: "); + throw std::runtime_error(ConstructMessage(errorMsg, header, body)); +} + +/* Error types, to be used via the macros */ + +void WarningHandler::ErrorType(WarningType warnType, const std::string& header, const std::string& body) { + std::string headerMsg = header; + + for (const auto& iter: warningStringToInitMap) { + if (iter.second.type == warnType) { + headerMsg += StringHelper::Sprintf(" [%s]", iter.first.c_str()); + } + } + + PrintErrorAndThrow(headerMsg, body); +} + +void WarningHandler::Error_Plain(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { + FunctionPreamble(filename, line, function); + + ErrorType(warnType, header, body); +} + +void WarningHandler::Error_Process(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { + FunctionPreamble(filename, line, function); + ProcessedFilePreamble(); + + ErrorType(warnType, header, body); +} + +void WarningHandler::Error_Resource(const char* filename, int32_t line, const char* function, WarningType warnType, const ZFile *parent, const ZResource* res, const uint32_t offset, const std::string& header, const std::string& body) { + assert(parent != nullptr); + + FunctionPreamble(filename, line, function); + ProcessedFilePreamble(); + ExtractedFilePreamble(parent, res, offset); + + ErrorType(warnType, header, body); +} + +/* Warning module functions */ + +void WarningHandler::PrintWarningBody(const std::string& header, const std::string& body) { + std::string errorMsg = WARN_FMT("warning: "); + fprintf(stderr, "%s", ConstructMessage(errorMsg, header, body).c_str()); +} + +void WarningHandler::WarningTypeAndChooseEscalate(WarningType warnType, const std::string& header, const std::string& body) { + std::string headerMsg = header; + + for (const auto& iter: warningStringToInitMap) { + if (iter.second.type == warnType) { + headerMsg += StringHelper::Sprintf(" [-W%s]", iter.first.c_str()); + } + } + + if (WasElevatedToError(warnType)) { + PrintErrorAndThrow(headerMsg, body); + } else { + PrintWarningBody(headerMsg, body); + } +} + + +/* Warning types, to be used via the macros */ + +void WarningHandler::Warning_Plain(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { + if (!IsWarningEnabled(warnType)) { + return; + } + + FunctionPreamble(filename, line, function); + + WarningTypeAndChooseEscalate(warnType, header, body); +} + +void WarningHandler::Warning_Process(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { + if (!IsWarningEnabled(warnType)) { + return; + } + + FunctionPreamble(filename, line, function); + ProcessedFilePreamble(); + + WarningTypeAndChooseEscalate(warnType, header, body); +} + +void WarningHandler::Warning_Resource(const char* filename, int32_t line, const char* function, WarningType warnType, const ZFile *parent, const ZResource* res, const uint32_t offset, const std::string& header, const std::string& body) { + assert(parent != nullptr); + + if (!IsWarningEnabled(warnType)) { + return; + } + + FunctionPreamble(filename, line, function); + ProcessedFilePreamble(); + ExtractedFilePreamble(parent, res, offset); + + WarningTypeAndChooseEscalate(warnType, header, body); +} + + +/* Help-related functions */ + +#include + +/** + * Print each warning name, default status, and description using the init map + */ +void WarningHandler::PrintHelp() { + std::set sortedKeys; + WarningInfoInit warningInfo; + uint32_t columnWidth = 25; + std::string dt; + + // Sort keys through the magic of `set`, to print in alphabetical order + for (auto& it : warningStringToInitMap) { + sortedKeys.insert(it.first); + } + + printf("\nWarning types ( * means enabled by default)\n"); + for (auto& key : sortedKeys) { + warningInfo = warningStringToInitMap.at(key); + if (warningInfo.defaultLevel <= WarningLevel::Warn) { + dt = "-W"; + dt += key; + if (warningInfo.defaultLevel == WarningLevel::Warn) { + dt += " *"; + } + printf(HELP_DT_INDT "%-*s", columnWidth, dt.c_str()); + + if (dt.length() + 2 > columnWidth) { + printf("\n" HELP_DT_INDT "%-*s", columnWidth, ""); + } + printf("%s\n", warningInfo.description.c_str()); + } + } + + printf("\nDefault errors\n"); + for (auto& key : sortedKeys) { + if (warningInfo.defaultLevel > WarningLevel::Warn) { + dt = "-W"; + dt += key; + printf(HELP_DT_INDT "%-*s", columnWidth, dt.c_str()); + + if (dt.length() + 2 > columnWidth) { + printf("\n" HELP_DT_INDT "%*s", columnWidth, ""); + } + printf("%s\n", warningInfo.description.c_str()); + } + } + + printf("\n"); + printf("Other\n" HELP_DT_INDT "-Weverything will enable all existing warnings.\n" HELP_DT_INDT "-Werror will promote all warnings to errors.\n"); + + printf("\n"); + printf("Warnings can be disabled using -Wno-... instead of -W...; -Weverything will override any -Wno-... flags passed before it.\n"); +} + +/** + * Print which warnings are currently enabled + */ +void WarningHandler::PrintWarningsDebugInfo() +{ + std::string dt; + + printf("Warnings status:\n"); + for (auto& it: warningTypeToInfoMap) { + dt = it.second.name; + dt += ": "; + + printf(HELP_DT_INDT "%-25s", dt.c_str()); + switch (it.second.level) + { + case WarningLevel::Off: + printf(VT_FGCOL(LIGHTGRAY) "Off" VT_RST); + break; + case WarningLevel::Warn: + printf(VT_FGCOL(YELLOW) "Warn" VT_RST); + break; + case WarningLevel::Err: + printf(VT_FGCOL(RED) "Err" VT_RST); + break; + + } + printf("\n"); + } + printf("\n"); +} diff --git a/tools/ZAPD/ZAPD/WarningHandler.h b/tools/ZAPD/ZAPD/WarningHandler.h new file mode 100644 index 0000000000..bb0360a813 --- /dev/null +++ b/tools/ZAPD/ZAPD/WarningHandler.h @@ -0,0 +1,145 @@ +#pragma once + +#include +#include +#include +#include + +#include "Utils/vt.h" +#include "ZFile.h" + +#ifdef _MSC_VER +#define __PRETTY_FUNCTION__ __FUNCSIG__ +#elif not defined(__GNUC__) +#define __PRETTY_FUNCTION__ __func__ +#endif + +// ======================================= +/* Formatting macros */ + +// TODO: move this somewhere else so it can be used by other help +#define HELP_DT_INDT " " + +/* Macros for formatting warnings/errors */ +#define VT_HILITE VT_BOLD_FGCOL(WHITE) +#define VT_WARN VT_BOLD_FGCOL(PURPLE) +#define VT_ERR VT_BOLD_FGCOL(RED) + +#define HILITE(string) (VT_HILITE string VT_RST) +#define WARN_FMT(string) (VT_WARN string VT_RST) +#define ERR_FMT(string) (VT_ERR string VT_RST) + +// Maybe make WARN_LF instead +// Currently 8 spaces +#define WARN_INDT " " +// Currently 16 spaces +#define HANG_INDT " " + +// ======================================= +/* Warning and error macros */ +// TODO: better names + +// General-purpose, plain style (only prints function,file,line in the preamble) +#define HANDLE_ERROR(warningType, header, body) \ + WarningHandler::Error_Plain(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, body) +#define HANDLE_WARNING(warningType, header, body) \ + WarningHandler::Warning_Plain(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ + body) + +// For processing XMLs or textures/blobs (preamble contains function,file,line; processed file) +#define HANDLE_ERROR_PROCESS(warningType, header, body) \ + WarningHandler::Error_Process(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ + body) +#define HANDLE_WARNING_PROCESS(warningType, header, body) \ + WarningHandler::Warning_Process(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ + body) + +// For ZResource-related stuff (preamble contains function,file,line; processed file; extracted file +// and offset) +#define HANDLE_ERROR_RESOURCE(warningType, parent, resource, offset, header, body) \ + WarningHandler::Error_Resource(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, parent, \ + resource, offset, header, body) +#define HANDLE_WARNING_RESOURCE(warningType, parent, resource, offset, header, body) \ + WarningHandler::Warning_Resource(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, parent, \ + resource, offset, header, body) + +// ======================================= + +enum class WarningType +{ + Always, // Warnings of this type are always printed, cannot be disabled. + Deprecated, + Unaccounted, + MissingOffsets, + Intersection, + MissingAttribute, + InvalidAttributeValue, + UnknownAttribute, + InvalidXML, + InvalidJPEG, + InvalidPNG, + InvalidExtractedData, + MissingSegment, + HardcodedPointer, + NotImplemented, + Max, +}; + +enum class WarningLevel +{ + Off, + Warn, + Err, +}; + +class WarningHandler +{ +public: + static void ConstructTypeToInfoMap(); + + static void Init(int argc, char* argv[]); + + static bool IsWarningEnabled(WarningType warnType); + static bool WasElevatedToError(WarningType warnType); + + static void FunctionPreamble(const char* filename, int32_t line, const char* function); + static void ProcessedFilePreamble(); + static void ExtractedFilePreamble(const ZFile* parent, const ZResource* res, + const uint32_t offset); + static std::string ConstructMessage(std::string message, const std::string& header, + const std::string& body); + + [[noreturn]] static void PrintErrorAndThrow(const std::string& header, const std::string& body); + static void PrintWarningBody(const std::string& header, const std::string& body); + + [[noreturn]] static void ErrorType(WarningType warnType, const std::string& header, + const std::string& body); + [[noreturn]] static void Error_Plain(const char* filename, int32_t line, const char* function, + WarningType warnType, const std::string& header, + const std::string& body); + [[noreturn]] static void Error_Process(const char* filename, int32_t line, const char* function, + WarningType warnType, const std::string& header, + const std::string& body); + [[noreturn]] static void Error_Resource(const char* filename, int32_t line, + const char* function, WarningType warnType, + const ZFile* parent, const ZResource* res, + const uint32_t offset, const std::string& header, + const std::string& body); + + static void WarningTypeAndChooseEscalate(WarningType warnType, const std::string& header, + const std::string& body); + + static void Warning_Plain(const char* filename, int32_t line, const char* function, + WarningType warnType, const std::string& header, + const std::string& body); + static void Warning_Process(const char* filename, int32_t line, const char* function, + WarningType warnType, const std::string& header, + const std::string& body); + static void Warning_Resource(const char* filename, int32_t line, const char* function, + WarningType warnType, const ZFile* parent, const ZResource* res, + const uint32_t offset, const std::string& header, + const std::string& body); + + static void PrintHelp(); + static void PrintWarningsDebugInfo(); +}; diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj b/tools/ZAPD/ZAPD/ZAPD.vcxproj index c74d28cbec..431abb73b9 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj @@ -1,5 +1,6 @@ + Debug @@ -71,8 +72,8 @@ - $(SolutionDir)lib\libgfxd;$(SolutionDir)x64\Debug;$(SolutionDir)packages\libpng.1.6.28.1\build\native\lib\x64\v140\dynamic\Debug;$(LibraryPath) - $(SolutionDir)ZAPDUtils;$(SolutionDir)lib\tinyxml2;$(SolutionDir)lib\libgfxd;$(SolutionDir)lib\elfio;$(SolutionDir)lib\stb;$(ProjectDir);$(IncludePath) + $(OutDir);$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\packages\libpng-v142.1.6.37.2\build\native\lib\x64\v142\Debug\;$(LibraryPath) + $(ProjectDir)..\ZAPDUtils;$(ProjectDir)..\lib\tinyxml2;$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\lib\elfio;$(ProjectDir)..\lib\stb;$(ProjectDir);$(IncludePath) $(IncludePath) @@ -105,13 +106,16 @@ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks stdc11 + MultiThreadedDebug true - libpng16.lib;ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies) + ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies) + false cd .. +mkdir build\ZAPD python3 ZAPD/genbuildinfo.py @@ -146,6 +150,7 @@ python3 ZAPD/genbuildinfo.py + @@ -153,19 +158,22 @@ python3 ZAPD/genbuildinfo.py - + + + + @@ -213,6 +221,7 @@ python3 ZAPD/genbuildinfo.py + @@ -237,10 +246,13 @@ python3 ZAPD/genbuildinfo.py + + + @@ -253,6 +265,7 @@ python3 ZAPD/genbuildinfo.py + @@ -294,6 +307,7 @@ python3 ZAPD/genbuildinfo.py + @@ -301,24 +315,29 @@ python3 ZAPD/genbuildinfo.py true + + - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + + + \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters index 2d3050ed42..b8a7daaacf 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters @@ -49,6 +49,15 @@ {85600275-99fe-491d-8189-bcc3dc1a8903} + + {ba9990b0-1082-48bb-874c-6108534b5455} + + + {ce9d91b0-ba20-4296-bc2d-8630965bb392} + + + {730beb67-6d59-4849-9d9b-702c4a565fc0} + @@ -135,9 +144,6 @@ Source Files\Z64\ZRoom\Commands - - Source Files\Libraries - Source Files\Z64 @@ -258,6 +264,24 @@ Source Files\Z64 + + Source Files + + + Source Files\Z64 + + + Source Files\Z64 + + + Source Files + + + Source Files\Z64 + + + Source Files + @@ -497,11 +521,32 @@ Header Files\Z64 + + Header Files + + + Header Files\Z64 + + + Header Files\Z64 + + + Header Files\Z64 + + + Header Files + Resource Files + + any\any + + + NuGet + diff --git a/tools/ZAPD/ZAPD/ZAnimation.cpp b/tools/ZAPD/ZAPD/ZAnimation.cpp index 9242f657a8..adb0ae7c9a 100644 --- a/tools/ZAPD/ZAPD/ZAnimation.cpp +++ b/tools/ZAPD/ZAPD/ZAnimation.cpp @@ -6,6 +6,7 @@ #include "Utils/BitConverter.h" #include "Utils/File.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Animation, ZNormalAnimation); @@ -218,11 +219,9 @@ void ZCurveAnimation::ParseXML(tinyxml2::XMLElement* reader) std::string skelOffsetXml = registeredAttributes.at("SkelOffset").value; if (skelOffsetXml == "") { - throw std::runtime_error( - StringHelper::Sprintf("ZCurveAnimation::ParseXML: Fatal error in '%s'.\n" - "\t Missing 'SkelOffset' attribute in ZCurveAnimation.\n" - "\t You need to provide the offset of the curve skeleton.", - name.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, + "missing 'SkelOffset' attribute in ", + "You need to provide the offset of the curve skeleton."); } skelOffset = StringHelper::StrToL(skelOffsetXml, 0); } diff --git a/tools/ZAPD/ZAPD/ZAnimation.h b/tools/ZAPD/ZAPD/ZAnimation.h index e5b69d3ef8..2c04b4ff81 100644 --- a/tools/ZAPD/ZAPD/ZAnimation.h +++ b/tools/ZAPD/ZAPD/ZAnimation.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "Vec3s.h" diff --git a/tools/ZAPD/ZAPD/ZArray.cpp b/tools/ZAPD/ZAPD/ZArray.cpp index b1ba3a6693..ebfb13ee74 100644 --- a/tools/ZAPD/ZAPD/ZArray.cpp +++ b/tools/ZAPD/ZAPD/ZArray.cpp @@ -4,6 +4,7 @@ #include "Globals.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Array, ZArray); @@ -25,13 +26,18 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader) ZResource::ParseXML(reader); arrayCnt = reader->IntAttribute("Count", 0); - // TODO: do a better check. - assert(arrayCnt > 0); + if (arrayCnt <= 0) + { + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'Count' attribute", ""); + } tinyxml2::XMLElement* child = reader->FirstChildElement(); if (child == nullptr) - throw std::runtime_error( - StringHelper::Sprintf("Error! Array needs at least one sub-element.\n")); + { + HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, + " needs one sub-element", ""); + } childName = child->Name(); @@ -42,9 +48,10 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader) ZResource* res = nodeMap->at(childName)(parent); if (!res->DoesSupportArray()) { - throw std::runtime_error(StringHelper::Sprintf( - "Error! Resource %s does not support being wrapped in an array!\n", - childName.c_str())); + std::string errorHeader = StringHelper::Sprintf( + "resource <%s> does not support being wrapped in an ", childName.c_str()); + HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, errorHeader, + ""); } res->parent = parent; res->SetInnerNode(true); @@ -87,7 +94,7 @@ Declaration* ZArray::DeclareVar(const std::string& prefix, const std::string& bo std::string ZArray::GetBodySourceCode() const { - std::string output; + std::string output = ""; for (size_t i = 0; i < arrayCnt; i++) { diff --git a/tools/ZAPD/ZAPD/ZArray.h b/tools/ZAPD/ZAPD/ZArray.h index 46a04d7329..b78a8edfd8 100644 --- a/tools/ZAPD/ZAPD/ZArray.h +++ b/tools/ZAPD/ZAPD/ZArray.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZResource.h" diff --git a/tools/ZAPD/ZAPD/ZBackground.cpp b/tools/ZAPD/ZAPD/ZBackground.cpp index 4125f239f3..0ed1eb7471 100644 --- a/tools/ZAPD/ZAPD/ZBackground.cpp +++ b/tools/ZAPD/ZAPD/ZBackground.cpp @@ -5,6 +5,7 @@ #include "Utils/File.h" #include "Utils/Path.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Background, ZBackground); @@ -63,52 +64,46 @@ void ZBackground::CheckValidJpeg(const std::string& filepath) uint32_t jpegMarker = BitConverter::ToUInt32BE(data, 0); if (jpegMarker != JPEG_MARKER) { - fprintf(stderr, - "ZBackground::CheckValidJpeg: Warning.\n" - "\t Missing jpeg marker at the beginning of file: '%s'.\n" - "\t The game will skip this jpeg.\n", - filename.c_str()); + HANDLE_WARNING_PROCESS( + WarningType::InvalidJPEG, + StringHelper::Sprintf("missing jpeg marker at beginning of file: '%s'", + filename.c_str()), + "The game will skip this jpeg."); } if (data.at(6) != 'J' || data.at(7) != 'F' || data.at(8) != 'I' || data.at(9) != 'F' || data.at(10) != '\0') { std::string jfifIdentifier(data.begin() + 6, data.begin() + 6 + 5); - fprintf(stderr, - "ZBackground::CheckValidJpeg: Warning.\n" - "\t Missing 'JFIF' identifier. File: '%s'.\n" - "\t This image may be corrupted or not be a jpeg iamge.\n" - "\t The identifier found was '%s'.\n", - filename.c_str(), jfifIdentifier.c_str()); + HANDLE_WARNING_PROCESS( + WarningType::InvalidJPEG, "missing 'JFIF' identifier", + StringHelper::Sprintf( + "This image may be corrupted, or not a jpeg. The identifier found was: '%s'", + jfifIdentifier.c_str())); } uint8_t majorVersion = data.at(11); uint8_t minorVersion = data.at(12); if (majorVersion != 0x01 || minorVersion != 0x01) { - fprintf(stderr, - "ZBackground::CheckValidJpeg: Warning.\n" - "\t Wrong JFIF version '%i.%02i'. File: '%s'.\n" - "\t The expected version is '1.01'. The game may not be able to decode this image " - "properly.\n", - majorVersion, minorVersion, filename.c_str()); + HANDLE_WARNING_PROCESS( + WarningType::InvalidJPEG, + StringHelper::Sprintf("wrong JFIF version '%i.%02i'", majorVersion, minorVersion), + "The expected version is '1.01'. The game may be unable to decode this image " + "correctly."); } if (BitConverter::ToUInt16BE(data, 20) != MARKER_DQT) { // This may happen when creating a custom image with Exif, XMP, thumbnail, progressive, etc. // enabled. - fprintf(stderr, - "ZBackground::CheckValidJpeg: Warning.\n" - "\t There seems to be extra data before the image data in file: '%s'.\n" - "\t The game may not be able to decode this image properly.\n", - filename.c_str()); + HANDLE_WARNING_PROCESS(WarningType::InvalidJPEG, + "there seems to be extra data before the image data in this file", + "The game may not be able to decode this image correctly."); } if (data.size() > GetRawDataSize()) { - fprintf(stderr, - "ZBackground::CheckValidJpeg: Warning.\n" - "\t The image is bigger than the screen buffer. File: '%s'.\n" - "\t Image size: %zu bytes.\n" - "\t Screen buffer size: %zu bytes.\n", - filename.c_str(), data.size(), GetRawDataSize()); + HANDLE_WARNING_PROCESS( + WarningType::InvalidJPEG, "the image is bigger than the screen buffer", + StringHelper::Sprintf("Image size: %zu bytes\nScreen buffer size: %zu bytes", + data.size(), GetRawDataSize())); } } @@ -138,6 +133,7 @@ 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; decl->staticConf = staticConf; return decl; } diff --git a/tools/ZAPD/ZAPD/ZBlob.cpp b/tools/ZAPD/ZAPD/ZBlob.cpp index c1f0788206..6812bfaee9 100644 --- a/tools/ZAPD/ZAPD/ZBlob.cpp +++ b/tools/ZAPD/ZAPD/ZBlob.cpp @@ -83,11 +83,6 @@ std::string ZBlob::GetBodySourceCode() const return sourceOutput; } -std::string ZBlob::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return StringHelper::Sprintf("extern u8 %s[];\n", name.c_str()); -} - void ZBlob::Save(const fs::path& outFolder) { File::WriteAllBytes((outFolder / (name + ".bin")).string(), blobData); diff --git a/tools/ZAPD/ZAPD/ZBlob.h b/tools/ZAPD/ZAPD/ZBlob.h index 86623b5119..d7a7feff12 100644 --- a/tools/ZAPD/ZAPD/ZBlob.h +++ b/tools/ZAPD/ZAPD/ZBlob.h @@ -16,7 +16,6 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputHeader(const std::string& prefix) override; void Save(const fs::path& outFolder) override; bool IsExternalResource() const override; diff --git a/tools/ZAPD/ZAPD/ZCollision.cpp b/tools/ZAPD/ZAPD/ZCollision.cpp index f9c0bf7d62..1dfa46b1dd 100644 --- a/tools/ZAPD/ZAPD/ZCollision.cpp +++ b/tools/ZAPD/ZAPD/ZCollision.cpp @@ -88,7 +88,7 @@ void ZCollisionHeader::ParseRawData() void ZCollisionHeader::DeclareReferences(const std::string& prefix) { - std::string declaration; + std::string declaration = ""; std::string auxName = name; if (name == "") @@ -174,7 +174,7 @@ void ZCollisionHeader::DeclareReferences(const std::string& prefix) std::string ZCollisionHeader::GetBodySourceCode() const { - std::string declaration; + std::string declaration = ""; declaration += "\n"; diff --git a/tools/ZAPD/ZAPD/ZCutscene.cpp b/tools/ZAPD/ZAPD/ZCutscene.cpp index 237481079f..ba8fe89638 100644 --- a/tools/ZAPD/ZAPD/ZCutscene.cpp +++ b/tools/ZAPD/ZAPD/ZCutscene.cpp @@ -2,6 +2,7 @@ #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZResource.h" REGISTER_ZFILENODE(Cutscene, ZCutscene); @@ -87,7 +88,7 @@ CutsceneCommandSceneTransFX::~CutsceneCommandSceneTransFX() std::string ZCutscene::GetBodySourceCode() const { - std::string output; + std::string output = ""; uint32_t curPtr = 0; output += StringHelper::Sprintf(" CS_BEGIN_CUTSCENE(%i, %i),\n", commands.size(), endFrame); @@ -225,8 +226,9 @@ void ZCutscene::ParseRawData() cmd = new CutsceneCommandEnd(rawData, currentPtr); break; case CutsceneCommands::Error: - fprintf(stderr, "Cutscene command error %d %s %d\n", (int32_t)cmdID, __FILE__, - __LINE__); + HANDLE_WARNING_RESOURCE(WarningType::NotImplemented, parent, this, rawDataIndex, + StringHelper::Sprintf("cutscene command error %d", cmdID), + ""); break; } @@ -404,7 +406,9 @@ CutsceneCommands ZCutscene::GetCommandFromID(int32_t id) return CutsceneCommands::Unknown; } - fprintf(stderr, "WARNING: Could not identify cutscene command ID 0x%04X\n", id); + HANDLE_WARNING_RESOURCE( + WarningType::NotImplemented, parent, this, rawDataIndex, + StringHelper::Sprintf("could not identify cutscene command. ID 0x%04X", id), ""); return CutsceneCommands::Error; } diff --git a/tools/ZAPD/ZAPD/ZCutscene.h b/tools/ZAPD/ZAPD/ZCutscene.h index cbb6a78b02..8e901e3075 100644 --- a/tools/ZAPD/ZAPD/ZCutscene.h +++ b/tools/ZAPD/ZAPD/ZCutscene.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZFile.h" diff --git a/tools/ZAPD/ZAPD/ZCutsceneMM.h b/tools/ZAPD/ZAPD/ZCutsceneMM.h index 41b7de37f3..44b108d6c1 100644 --- a/tools/ZAPD/ZAPD/ZCutsceneMM.h +++ b/tools/ZAPD/ZAPD/ZCutsceneMM.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZCutscene.h" diff --git a/tools/ZAPD/ZAPD/ZDisplayList.cpp b/tools/ZAPD/ZAPD/ZDisplayList.cpp index 63c5684228..bdb7374fe1 100644 --- a/tools/ZAPD/ZAPD/ZDisplayList.cpp +++ b/tools/ZAPD/ZAPD/ZDisplayList.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "Globals.h" @@ -11,6 +12,7 @@ #include "Utils/File.h" #include "Utils/Path.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "gfxd.h" REGISTER_ZFILENODE(DList, ZDisplayList); @@ -105,7 +107,7 @@ void ZDisplayList::ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int32_t i, switch (opcode) { case F3DZEXOpcode::G_NOOP: - sprintf(line, "gsDPNoOpTag(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsDPNoOpTag(0x%08" PRIX64 "),", data & 0xFFFFFFFF); break; case F3DZEXOpcode::G_DL: Opcode_G_DL(data, prefix, line); @@ -220,7 +222,7 @@ void ZDisplayList::ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int32_t i, break; case F3DZEXOpcode::G_POPMTX: { - sprintf(line, "gsSPPopMatrix(%li),", data); + sprintf(line, "gsSPPopMatrix(%" PRIi64 "),", data); } break; case F3DZEXOpcode::G_LOADTLUT: @@ -297,7 +299,7 @@ void ZDisplayList::ParseF3DEX(F3DEXOpcode opcode, uint64_t data, const std::stri switch (opcode) { case F3DEXOpcode::G_NOOP: - sprintf(line, "gsDPNoOpTag(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsDPNoOpTag(0x%08" PRIX64 "),", data & 0xFFFFFFFF); break; case F3DEXOpcode::G_VTX: Opcode_G_VTX(data, line); @@ -445,11 +447,12 @@ int32_t ZDisplayList::GetDListLength(const std::vector& rawData, uint32 { if (ptr >= rawDataSize) { - throw std::runtime_error(StringHelper::Sprintf( - "%s: Fatal error.\n" - "\t End of file found when trying to find the end of the " - "DisplayList at offset: '0x%X'.\n", - "Raw data size: 0x%zX.\n", __PRETTY_FUNCTION__, rawDataIndex, rawDataSize)); + std::string errorHeader = + StringHelper::Sprintf("reached end of file when trying to find the end of the " + "DisplayList starting at offset 0x%X", + rawDataIndex); + std::string errorBody = StringHelper::Sprintf("Raw data size: 0x%zX.", rawDataSize); + HANDLE_ERROR_PROCESS(WarningType::Always, errorHeader, errorBody); } uint8_t opcode = rawData.at(ptr); @@ -686,20 +689,20 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l if (pp != 0) { if (!Globals::Instance->HasSegment(segNum)) - sprintf(line, "gsSPBranchList(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); else if (dListDecl != nullptr) sprintf(line, "gsSPBranchList(%s),", dListDecl->varName.c_str()); else - sprintf(line, "gsSPBranchList(%sDlist0x%06lX),", prefix.c_str(), GETSEGOFFSET(data)); + sprintf(line, "gsSPBranchList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), GETSEGOFFSET(data)); } else { if (!Globals::Instance->HasSegment(segNum)) - sprintf(line, "gsSPDisplayList(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); else if (dListDecl != nullptr) sprintf(line, "gsSPDisplayList(%s),", dListDecl->varName.c_str()); else - sprintf(line, "gsSPDisplayList(%sDlist0x%06lX),", prefix.c_str(), GETSEGOFFSET(data)); + sprintf(line, "gsSPDisplayList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), GETSEGOFFSET(data)); } // if (segNum == 8 || segNum == 9 || segNum == 10 || segNum == 11 || segNum == 12 || segNum == @@ -707,9 +710,9 @@ void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* l if (!Globals::Instance->HasSegment(segNum)) { if (pp != 0) - sprintf(line, "gsSPBranchList(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); else - sprintf(line, "gsSPDisplayList(0x%08lX),", data & 0xFFFFFFFF); + sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); } else { @@ -941,7 +944,7 @@ void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, ch sprintf(texStr, "%sTex_%06X", prefix.c_str(), texAddress); else { - sprintf(texStr, "0x%08lX", data & 0xFFFFFFFF); + sprintf(texStr, "0x%08" PRIX64, data & 0xFFFFFFFF); } sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %s),", fmtTbl[fmt], sizTbl[siz], www + 1, @@ -1522,11 +1525,6 @@ void ZDisplayList::Opcode_G_ENDDL([[maybe_unused]] const std::string& prefix, ch TextureGenCheck(); } -std::string ZDisplayList::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return ""; -} - static int32_t GfxdCallback_FormatSingleEntry() { ZDisplayList* self = static_cast(gfxd_udata_get()); @@ -1737,7 +1735,7 @@ static int32_t GfxdCallback_Matrix(uint32_t seg) return 1; } -std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) +void ZDisplayList::DeclareReferences(const std::string& prefix) { std::string sourceOutput; @@ -1750,7 +1748,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) if (vertices.size() > 0) { std::vector>> verticesSorted(vertices.begin(), - vertices.end()); + vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -1775,15 +1773,13 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) // Generate Vertex Declarations for (auto& item : vertices) { - std::string declaration; + std::string declaration = ""; offset_t curAddr = item.first; auto& firstVtx = item.second.at(0); for (auto vtx : item.second) - { declaration += StringHelper::Sprintf("\t%s,\n", vtx.GetBodySourceCode().c_str()); - } Declaration* decl = parent->AddDeclarationArray( curAddr, firstVtx.GetDeclarationAlignment(), @@ -1800,7 +1796,7 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) if (vertices.size() > 0) { std::vector>> verticesSorted(vertices.begin(), - vertices.end()); + vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -1863,11 +1859,6 @@ std::string ZDisplayList::GetSourceOutputCode(const std::string& prefix) } } } - - if (parent != nullptr) - return ""; - - return sourceOutput; } std::string ZDisplayList::ProcessLegacy(const std::string& prefix) @@ -1899,10 +1890,10 @@ std::string ZDisplayList::ProcessLegacy(const std::string& prefix) } auto end = std::chrono::steady_clock::now(); - auto diff = std::chrono::duration_cast(end - start).count(); + int64_t diff = std::chrono::duration_cast(end - start).count(); if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG && diff > 5) - printf("F3DOP: 0x%02X, TIME: %lims\n", opcode, diff); + printf("F3DOP: 0x%02X, TIME: %" PRIi64 "ms\n", opcode, diff); sourceOutput += line; @@ -1983,7 +1974,7 @@ bool ZDisplayList::TextureGenCheck(int32_t texWidth, int32_t texHeight, uint32_t } else { - // Try to find a non-external file (ie, one we are actually extracting) + // Try to find a non-external file (i.e., one we are actually extracting) // which has the same segment number we are looking for. for (auto& otherFile : Globals::Instance->cfg.segmentRefFiles[segmentNumber]) { diff --git a/tools/ZAPD/ZAPD/ZDisplayList.h b/tools/ZAPD/ZAPD/ZDisplayList.h index d538666750..96808315dc 100644 --- a/tools/ZAPD/ZAPD/ZDisplayList.h +++ b/tools/ZAPD/ZAPD/ZDisplayList.h @@ -363,8 +363,7 @@ public: size_t GetRawDataSize() const override; DeclarationAlignment GetDeclarationAlignment() const override; - std::string GetSourceOutputHeader(const std::string& prefix) override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void DeclareReferences(const std::string& prefix) override; std::string ProcessLegacy(const std::string& prefix); std::string ProcessGfxDis(const std::string& prefix); diff --git a/tools/ZAPD/ZAPD/ZFile.cpp b/tools/ZAPD/ZAPD/ZFile.cpp index 7cbfeba886..77387fc72c 100644 --- a/tools/ZAPD/ZAPD/ZFile.cpp +++ b/tools/ZAPD/ZAPD/ZFile.cpp @@ -13,6 +13,7 @@ #include "Utils/MemoryStream.h" #include "Utils/Path.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZAnimation.h" #include "ZArray.h" #include "ZBackground.h" @@ -73,19 +74,13 @@ ZFile::ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBas ZFile::~ZFile() { for (ZResource* res : resources) - { delete res; - } for (auto d : declarations) - { delete d.second; - } for (auto sym : symbolResources) - { delete sym.second; - } } void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) @@ -114,8 +109,11 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) else if (std::string_view(gameStr) == "OOT") Globals::Instance->game = ZGame::OOT_RETAIL; else - throw std::runtime_error( - StringHelper::Sprintf("Error: Game type %s not supported.", gameStr)); + { + std::string errorHeader = + StringHelper::Sprintf("'Game' type '%s' is not supported.", gameStr); + HANDLE_ERROR_PROCESS(WarningType::InvalidAttributeValue, errorHeader, ""); + } } if (reader->Attribute("BaseAddress") != nullptr) @@ -128,16 +126,22 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) rangeEnd = StringHelper::StrToL(reader->Attribute("RangeEnd"), 16); if (rangeStart > rangeEnd) - throw std::runtime_error("Error: RangeStart must be before than RangeEnd."); + HANDLE_ERROR_PROCESS( + WarningType::Always, + StringHelper::Sprintf("'RangeStart' 0x%06X must be before 'RangeEnd' 0x%06X", + rangeStart, rangeEnd), + ""); const char* segmentXml = reader->Attribute("Segment"); if (segmentXml != nullptr) { if (!StringHelper::HasOnlyDigits(segmentXml)) { - throw std::runtime_error(StringHelper::Sprintf( - "error: Invalid segment value '%s': must be a decimal between 0 and 15 inclusive", - segmentXml)); + HANDLE_ERROR_PROCESS(WarningType::Always, + StringHelper::Sprintf("error: Invalid segment value '%s': must be " + "a decimal between 0 and 15 inclusive", + segmentXml), + ""); } segment = StringHelper::StrToL(segmentXml, 10); @@ -146,16 +150,19 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) if (segment == 128) { #ifdef DEPRECATION_ON - fprintf(stderr, "warning: segment 128 is deprecated.\n\tRemove " - "'Segment=\"128\"' from the xml to use virtual addresses\n"); + HANDLE_WARNING_PROCESS( + WarningType::Always, "warning: segment 128 is deprecated.", + "Remove 'Segment=\"128\"' from the xml to use virtual addresses\n"); #endif } else { - throw std::runtime_error( + HANDLE_ERROR_PROCESS( + WarningType::Always, StringHelper::Sprintf("error: invalid segment value '%s': must be a decimal " "number between 0 and 15 inclusive", - segmentXml)); + segmentXml), + ""); } } } @@ -176,18 +183,16 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile) { if (!File::Exists((basePath / name).string())) - throw std::runtime_error( - StringHelper::Sprintf("Error! File %s does not exist.", (basePath / name).c_str())); + { + std::string errorHeader = StringHelper::Sprintf("binary file '%s' does not exist.", + (basePath / name).c_str()); + HANDLE_ERROR_PROCESS(WarningType::Always, errorHeader, ""); + } rawData = File::ReadAllBytes((basePath / name).string()); - /* - * TODO: In OoT repo ovl_Boss_Sst has a wrong RangeEnd (0xAD40 instead of 0xAD70), - * so uncommenting the following produces wrong behavior. - * If somebody fixes that in OoT repo, uncomment this. I'm too tired of fixing XMLs. - */ - // if (reader->Attribute("RangeEnd") == nullptr) - // rangeEnd = rawData.size(); + if (reader->Attribute("RangeEnd") == nullptr) + rangeEnd = rawData.size(); } std::unordered_set nameSet; @@ -211,20 +216,17 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) if (offsetSet.find(offsetXml) != offsetSet.end()) { - throw std::runtime_error(StringHelper::Sprintf( - "ZFile::ParseXML: Error in '%s'.\n\t Repeated 'Offset' attribute: %s \n", - name.c_str(), offsetXml)); + std::string errorHeader = + StringHelper::Sprintf("repeated 'Offset' attribute: %s", offsetXml); + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } offsetSet.insert(offsetXml); } - else if (Globals::Instance->warnNoOffset) + else { - fprintf(stderr, "Warning No offset specified for: %s", nameXml); - } - else if (Globals::Instance->errorNoOffset) - { - throw std::runtime_error( - StringHelper::Sprintf("Error no offset specified for %s", nameXml)); + HANDLE_WARNING_RESOURCE(WarningType::MissingOffsets, this, nullptr, rawDataIndex, + StringHelper::Sprintf("no offset specified for %s.", nameXml), + ""); } if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) @@ -234,9 +236,9 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) { if (outNameSet.find(outNameXml) != outNameSet.end()) { - throw std::runtime_error(StringHelper::Sprintf( - "ZFile::ParseXML: Error in '%s'.\n\t Repeated 'OutName' attribute: %s \n", - name.c_str(), outNameXml)); + std::string errorHeader = + StringHelper::Sprintf("repeated 'OutName' attribute: %s", outNameXml); + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } outNameSet.insert(outNameXml); } @@ -244,9 +246,9 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) { if (nameSet.find(nameXml) != nameSet.end()) { - throw std::runtime_error(StringHelper::Sprintf( - "ZFile::ParseXML: Error in '%s'.\n\t Repeated 'Name' attribute: %s \n", - name.c_str(), nameXml)); + std::string errorHeader = + StringHelper::Sprintf("repeated 'Name' attribute: %s", nameXml); + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } nameSet.insert(nameXml); } @@ -279,16 +281,14 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) } else if (std::string_view(child->Name()) == "File") { - throw std::runtime_error(StringHelper::Sprintf( - "ZFile::ParseXML: Error in '%s'.\n\t Can't declare a File inside a File.\n", - name.c_str())); + std::string errorHeader = "Can't declare a inside a "; + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } else { - throw std::runtime_error( - StringHelper::Sprintf("ZFile::ParseXML: Error in '%s'.\n\t Unknown element found " - "inside a File element: '%s'.\n", - name.c_str(), nodeName.c_str())); + std::string errorHeader = StringHelper::Sprintf( + "Unknown element found inside a element: %s", nodeName.c_str()); + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } } } @@ -307,7 +307,7 @@ void ZFile::BuildSourceFile() return; if (!Directory::Exists(outputPath)) - Directory::CreateDirectory(outputPath); + Directory::CreateDirectory(outputPath.string()); GenerateSourceFiles(); } @@ -317,6 +317,11 @@ std::string ZFile::GetName() const return name; } +std::string ZFile::GetOutName() const +{ + return outName.string(); +} + ZFileMode ZFile::GetMode() const { return mode; @@ -338,10 +343,10 @@ void ZFile::ExtractResources() return; if (!Directory::Exists(outputPath)) - Directory::CreateDirectory(outputPath); + Directory::CreateDirectory(outputPath.string()); if (!Directory::Exists(GetSourceOutputFolderPath())) - Directory::CreateDirectory(GetSourceOutputFolderPath()); + Directory::CreateDirectory(GetSourceOutputFolderPath().string()); for (size_t i = 0; i < resources.size(); i++) resources[i]->ParseRawDataLate(); @@ -351,8 +356,8 @@ void ZFile::ExtractResources() if (Globals::Instance->genSourceFile) GenerateSourceFiles(); - MemoryStream* memStream = new MemoryStream(); - BinaryWriter writer = BinaryWriter(memStream); + auto memStreamFile = std::shared_ptr(new MemoryStream()); + BinaryWriter writerFile = BinaryWriter(memStreamFile); ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); @@ -361,6 +366,9 @@ void ZFile::ExtractResources() for (ZResource* res : resources) { + auto memStreamRes = std::shared_ptr(new MemoryStream()); + BinaryWriter writerRes = BinaryWriter(memStreamRes); + if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) printf("Saving resource %s\n", res->GetName().c_str()); @@ -369,18 +377,24 @@ void ZFile::ExtractResources() // Check if we have an exporter "registered" for this resource type ZResourceExporter* exporter = Globals::Instance->GetExporter(res->GetResourceType()); if (exporter != nullptr) - exporter->Save(res, Globals::Instance->outputPath.string(), &writer); + { + //exporter->Save(res, Globals::Instance->outputPath.string(), &writerFile); + exporter->Save(res, Globals::Instance->outputPath.string(), &writerRes); + } + + if (exporterSet != nullptr && exporterSet->resSaveFunc != nullptr) + exporterSet->resSaveFunc(res, writerRes); } - if (memStream->GetLength() > 0) + if (memStreamFile->GetLength() > 0) { File::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", Globals::Instance->outputPath.string().c_str(), GetName().c_str()), - memStream->ToVector()); + memStreamFile->ToVector()); } - writer.Close(); + writerFile.Close(); if (exporterSet != nullptr && exporterSet->endFileFunc != nullptr) exporterSet->endFileFunc(this); @@ -1070,8 +1084,6 @@ std::string ZFile::ProcessDeclarations() } } - output += "\n"; - return output; } @@ -1234,11 +1246,12 @@ bool ZFile::HandleUnaccountedAddress(uint32_t currentAddress, uint32_t lastAddr, { Declaration* currentDecl = declarations.at(currentAddress); - fprintf(stderr, - "WARNING: Intersection detected from 0x%06X:0x%06X (%s), conflicts with " - "0x%06X (%s)\n", - lastAddr, lastAddr + lastSize, lastDecl->varName.c_str(), currentAddress, - currentDecl->varName.c_str()); + 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()); + HANDLE_WARNING_RESOURCE(WarningType::Intersection, this, nullptr, currentAddress, + "intersection detected", intersectionInfo); } } @@ -1309,25 +1322,17 @@ bool ZFile::HandleUnaccountedAddress(uint32_t currentAddress, uint32_t lastAddr, diff, src); decl->isUnaccounted = true; - if (Globals::Instance->warnUnaccounted) + if (nonZeroUnaccounted) { - if (nonZeroUnaccounted) - { - fprintf(stderr, - "Warning in file: %s (%s)\n" - "\t A non-zero unaccounted block was found at offset '0x%06X'.\n" - "\t Block size: '0x%X'.\n", - xmlFilePath.c_str(), name.c_str(), unaccountedAddress, diff); - } - else if (diff >= 16) - { - fprintf(stderr, - "Warning in file: %s (%s)\n" - "\t A big (size>=0x10) zero-only unaccounted block was found " - "at offset '0x%06X'.\n" - "\t Block size: '0x%X'.\n", - xmlFilePath.c_str(), name.c_str(), unaccountedAddress, diff); - } + HANDLE_WARNING_RESOURCE(WarningType::Unaccounted, this, nullptr, unaccountedAddress, + "a non-zero unaccounted block was found", + StringHelper::Sprintf("Block size: '0x%X'", diff)); + } + else if (diff >= 16) + { + HANDLE_WARNING_RESOURCE(WarningType::Unaccounted, this, nullptr, unaccountedAddress, + "a big (size>=0x10) zero-only unaccounted block was found", + StringHelper::Sprintf("Block size: '0x%X'", diff)); } } } diff --git a/tools/ZAPD/ZAPD/ZFile.h b/tools/ZAPD/ZAPD/ZFile.h index 9de6950e4a..7918d5f595 100644 --- a/tools/ZAPD/ZAPD/ZFile.h +++ b/tools/ZAPD/ZAPD/ZFile.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -46,6 +45,7 @@ public: ~ZFile(); std::string GetName() const; + std::string GetOutName() const; ZFileMode GetMode() const; const fs::path& GetXmlFilePath() const; const std::vector& GetRawData() const; diff --git a/tools/ZAPD/ZAPD/ZLimb.cpp b/tools/ZAPD/ZAPD/ZLimb.cpp index 77c66871fe..a47615d6c6 100644 --- a/tools/ZAPD/ZAPD/ZLimb.cpp +++ b/tools/ZAPD/ZAPD/ZLimb.cpp @@ -4,7 +4,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" +#include "WarningHandler.h" REGISTER_ZFILENODE(Limb, ZLimb); @@ -37,17 +37,15 @@ void ZLimb::ParseXML(tinyxml2::XMLElement* reader) if (limbType == "") { - throw std::runtime_error(StringHelper::Sprintf("ZLimb::ParseXML: Error in '%s'.\n" - "\t Missing 'LimbType' attribute in xml.\n", - name.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, + "missing 'LimbType' attribute in ", ""); } type = GetTypeByAttributeName(limbType); if (type == ZLimbType::Invalid) { - throw std::runtime_error(StringHelper::Sprintf("ZLimb::ParseXML: Error in '%s'.\n" - "\t Invalid 'LimbType' found: '%s'.\n", - name.c_str(), limbType.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'LimbType' attribute", ""); } } @@ -109,8 +107,12 @@ void ZLimb::ParseRawData() } break; - default: - throw std::runtime_error("Invalid ZLimb type"); + case ZLimbType::Curve: + case ZLimbType::Legacy: + break; + + case ZLimbType::Invalid: + assert(!"whoops"); break; } } diff --git a/tools/ZAPD/ZAPD/ZPath.cpp b/tools/ZAPD/ZAPD/ZPath.cpp index 4a95c5b91e..e19513db34 100644 --- a/tools/ZAPD/ZAPD/ZPath.cpp +++ b/tools/ZAPD/ZAPD/ZPath.cpp @@ -3,6 +3,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Path, ZPath); @@ -20,10 +21,12 @@ void ZPath::ParseXML(tinyxml2::XMLElement* reader) numPaths = StringHelper::StrToL(registeredAttributes.at("NumPaths").value); if (numPaths < 1) - throw std::runtime_error( - StringHelper::Sprintf("ZPath::ParseXML: Fatal error in '%s'.\n" - "\t Invalid value for attribute 'NumPaths': '%i'\n", - name.c_str(), numPaths)); + { + HANDLE_ERROR_RESOURCE( + WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + StringHelper::Sprintf("invalid value '%d' found for 'NumPaths' attribute", numPaths), + "Should be at least '1'"); + } } void ZPath::ParseRawData() @@ -144,7 +147,7 @@ void PathwayEntry::DeclareReferences(const std::string& prefix) if (addressFound) return; - std::string declaration; + std::string declaration = ""; size_t index = 0; for (const auto& point : points) diff --git a/tools/ZAPD/ZAPD/ZResource.cpp b/tools/ZAPD/ZAPD/ZResource.cpp index cb811f4c3b..2dfe6d5eaa 100644 --- a/tools/ZAPD/ZAPD/ZResource.cpp +++ b/tools/ZAPD/ZAPD/ZResource.cpp @@ -4,6 +4,7 @@ #include #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" ZResource::ZResource(ZFile* nParent) @@ -85,29 +86,33 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) } if (!attrDeclared) - fprintf(stderr, - "ZResource::ParseXML: Warning while parsing '%s'.\n" - "\t Unexpected '%s' attribute in resource '%s'.\n", - parent->GetName().c_str(), attrName.c_str(), reader->Name()); + { + HANDLE_WARNING_RESOURCE( + WarningType::UnknownAttribute, parent, this, rawDataIndex, + StringHelper::Sprintf("unexpected '%s' attribute in resource <%s>", + attrName.c_str(), reader->Name()), + ""); + } attrs = attrs->Next(); } if (!canHaveInner && !reader->NoChildren()) { - throw std::runtime_error( - StringHelper::Sprintf("ZResource::ParseXML: Fatal error in '%s'.\n" - "\t Resource '%s' with inner element/child detected.\n", - name.c_str(), reader->Name())); + std::string errorHeader = StringHelper::Sprintf( + "resource '%s' with inner element/child detected", reader->Name()); + HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); } for (const auto& attr : registeredAttributes) { if (attr.second.isRequired && attr.second.value == "") - throw std::runtime_error(StringHelper::Sprintf( - "ZResource::ParseXML: Fatal error while parsing '%s'.\n" - "\t Missing required attribute '%s' in resource '%s'.\n" - "\t Aborting...", - parent->GetName().c_str(), attr.first.c_str(), reader->Name())); + { + std::string headerMsg = + StringHelper::Sprintf("missing required attribute '%s' in resource <%s>", + attr.first.c_str(), reader->Name()); + HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, + headerMsg, ""); + } } name = registeredAttributes.at("Name").value; @@ -118,10 +123,8 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) { if (!std::regex_match(name, r)) { - throw std::domain_error( - StringHelper::Sprintf("ZResource::ParseXML: Fatal error in '%s'.\n" - "\t Resource with invalid 'Name' attribute.\n", - name.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, + rawDataIndex, "invalid value found for 'Name' attribute", ""); } } @@ -146,7 +149,9 @@ void ZResource::ParseXML(tinyxml2::XMLElement* reader) } else { - throw std::runtime_error("Invalid value for 'Static' attribute."); + HANDLE_ERROR_RESOURCE( + WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + StringHelper::Sprintf("invalid value '%s' for 'Static' attribute", staticConf), ""); } declaredInXml = true; @@ -253,18 +258,21 @@ std::string ZResource::GetDefaultName(const std::string& prefix) const rawDataIndex); } -std::string ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) +void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { std::string bodyStr = GetBodySourceCode(); - Declaration* decl = parent->GetDeclaration(rawDataIndex); - if (decl == nullptr || decl->isPlaceholder) - decl = DeclareVar(prefix, bodyStr); - else - decl->text = bodyStr; - decl->staticConf = staticConf; + if (bodyStr != "ERROR") + { + Declaration* decl = parent->GetDeclaration(rawDataIndex); - return ""; + if (decl == nullptr || decl->isPlaceholder) + decl = DeclareVar(prefix, bodyStr); + else + decl->text = bodyStr; + + decl->staticConf = staticConf; + } } std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) @@ -312,13 +320,13 @@ offset_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress) uint32_t parentBaseOffset = GETSEGOFFSET(parentBaseAddress); if (parentBaseOffset > currentPtr) { - throw std::runtime_error( - StringHelper::Sprintf("\nSeg2Filespace: Segmented address is smaller than " - "'BaseAddress'. Maybe your 'BaseAddress' is wrong?\n" - "\t SegmentedAddress: 0x%08X\n" - "\t BaseAddress: 0x%08X\n", - segmentedAddress, parentBaseAddress)); + HANDLE_ERROR(WarningType::Always, + StringHelper::Sprintf( + "resource address 0x%08X is smaller than 'BaseAddress' 0x%08X", + segmentedAddress, parentBaseAddress), + "Maybe your 'BaseAddress' is wrong?"); } + currentPtr -= parentBaseOffset; } diff --git a/tools/ZAPD/ZAPD/ZResource.h b/tools/ZAPD/ZAPD/ZResource.h index ff35786fac..4dad398955 100644 --- a/tools/ZAPD/ZAPD/ZResource.h +++ b/tools/ZAPD/ZAPD/ZResource.h @@ -1,16 +1,15 @@ #pragma once -#include +#include #include #include -#include #include #include #include "Declaration.h" +#include "Utils/BinaryWriter.h" +#include "Utils/Directory.h" #include "tinyxml2.h" -#include - #define SEGMENT_SCENE 2 #define SEGMENT_ROOM 3 #define SEGMENT_KEEP 4 @@ -113,7 +112,7 @@ public: */ [[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const; - virtual std::string GetSourceOutputCode(const std::string& prefix); + virtual void GetSourceOutputCode(const std::string& prefix); virtual std::string GetSourceOutputHeader(const std::string& prefix); virtual void CalcHash(); /** diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp index d1c8abd5c5..69668c49c1 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp @@ -1,8 +1,10 @@ #include "SetMesh.h" -#include -#include + +#include "Globals.h" #include "Utils/BitConverter.h" +#include "Utils/Path.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZBackground.h" #include "ZFile.h" #include "ZRoom/ZRoom.h" @@ -34,9 +36,8 @@ void SetMesh::ParseRawData() break; default: - throw std::runtime_error(StringHelper::Sprintf("Error in SetMesh::ParseRawData\n" - "\t Unknown meshHeaderType: %i\n", - meshHeaderType)); + HANDLE_ERROR(WarningType::InvalidExtractedData, + StringHelper::Sprintf("unknown meshHeaderType: %i", meshHeaderType), ""); } polyType->ParseRawData(); @@ -53,11 +54,9 @@ void SetMesh::DeclareReferences(const std::string& prefix) void GenDListDeclarations(ZRoom* zRoom, ZFile* parent, ZDisplayList* dList) { if (dList == nullptr) - { return; - } - std::string sourceOutput = dList->GetSourceOutputCode(zRoom->GetName()); + dList->DeclareReferences(zRoom->GetName()); for (ZDisplayList* otherDList : dList->otherDLists) GenDListDeclarations(zRoom, parent, otherDList); @@ -143,21 +142,17 @@ std::string PolygonDlist::GetBodySourceCode() const return bodyStr; } -std::string PolygonDlist::GetSourceOutputCode(const std::string& prefix) +void PolygonDlist::GetSourceOutputCode(const std::string& prefix) { std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str()); Declaration* decl = parent->GetDeclaration(rawDataIndex); - if (decl == nullptr) - { - DeclareVar(prefix, bodyStr); - } - else - { - decl->text = bodyStr; - } - return ""; + if (decl == nullptr) + DeclareVar(prefix, bodyStr); + else + decl->text = bodyStr; + } std::string PolygonDlist::GetSourceTypeName() const @@ -472,8 +467,8 @@ void PolygonType1::DeclareReferences(const std::string& prefix) break; default: - throw std::runtime_error(StringHelper::Sprintf( - "Error in PolygonType1::PolygonType1\n\t Unknown format: %i\n", format)); + HANDLE_ERROR(WarningType::InvalidExtractedData, + StringHelper::Sprintf("unknown format: %i", format), ""); break; } } @@ -582,9 +577,11 @@ void PolygonType2::DeclareReferences(const std::string& prefix) polyDListName = StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), polyDlistType.c_str(), GETSEGOFFSET(start)); - parent->AddDeclarationArray(GETSEGOFFSET(start), DeclarationAlignment::Align4, - polyDLists.size() * polyDLists.at(0).GetRawDataSize(), - polyDlistType, polyDListName, polyDLists.size(), declaration); + Declaration* decl = parent->AddDeclarationArray( + GETSEGOFFSET(start), DeclarationAlignment::Align4, + polyDLists.size() * polyDLists.at(0).GetRawDataSize(), polyDlistType, polyDListName, + polyDLists.size(), declaration); + decl->forceArrayCnt = true; } parent->AddDeclaration(GETSEGOFFSET(end), DeclarationAlignment::Align4, 4, "s32", diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h index 566711a9a7..9d9037417b 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h @@ -28,7 +28,7 @@ public: std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp index 43c3968221..7027fa1f98 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp @@ -115,11 +115,9 @@ std::string RomFile::GetBodySourceCode() const return declaration; } -std::string RomFile::GetSourceOutputCode(const std::string& prefix) +void RomFile::GetSourceOutputCode(const std::string& prefix) { DeclareVar(prefix, GetBodySourceCode()); - - return ""; } std::string RomFile::GetSourceTypeName() const diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h index 4fb2ced176..2ae48b68df 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h @@ -24,7 +24,7 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetSourceTypeName() const override; virtual ZResourceType GetResourceType() const override; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp b/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp index edc0cad029..d47a2e75cb 100644 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp @@ -2,7 +2,9 @@ #include #include #include +#include #include + #include "Commands/EndMarker.h" #include "Commands/SetActorCutsceneList.h" #include "Commands/SetActorList.h" @@ -40,6 +42,7 @@ #include "Utils/File.h" #include "Utils/Path.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZBlob.h" #include "ZCutscene.h" #include "ZFile.h" @@ -123,10 +126,12 @@ void ZRoom::ParseXML(tinyxml2::XMLElement* reader) { hackMode = std::string(reader->Attribute("HackMode")); if (hackMode != "syotes_room") - throw std::runtime_error( - StringHelper::Sprintf("ZRoom::ParseXML: Fatal error in '%s'.\n" - "\t Invalid value for attribute 'HackMode': '%s'\n", - name.c_str(), hackMode.c_str())); + { + std::string headerError = StringHelper::Sprintf( + "invalid value found for 'HackMode' attribute: '%s'", hackMode.c_str()); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + headerError, ""); + } } } @@ -256,9 +261,9 @@ void ZRoom::ParseRawData() if (Globals::Instance->profile) { auto end = std::chrono::steady_clock::now(); - auto diff = std::chrono::duration_cast(end - start).count(); + int64_t diff = std::chrono::duration_cast(end - start).count(); if (diff > 50) - printf("OP: %s, TIME: %lims\n", cmd->GetCommandCName().c_str(), diff); + printf("OP: %s, TIME: %" PRIi64 "ms\n", cmd->GetCommandCName().c_str(), diff); } cmd->cmdIndex = currentIndex; @@ -392,14 +397,10 @@ size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd) return 0; } -std::string ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) +void ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) { - if (hackMode == "syotes_room") - return ""; - - DeclareVar(prefix, GetBodySourceCode()); - - return ""; + if (hackMode != "syotes_room") + DeclareVar(prefix, GetBodySourceCode()); } size_t ZRoom::GetRawDataSize() const diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h b/tools/ZAPD/ZAPD/ZRoom/ZRoom.h index 0993a9d302..e837ec70ac 100644 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h +++ b/tools/ZAPD/ZAPD/ZRoom/ZRoom.h @@ -34,7 +34,7 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; std::string GetBodySourceCode() const override; - std::string GetSourceOutputCode(const std::string& prefix) override; + void GetSourceOutputCode(const std::string& prefix) override; std::string GetDefaultName(const std::string& prefix) const override; size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress); diff --git a/tools/ZAPD/ZAPD/ZScalar.cpp b/tools/ZAPD/ZAPD/ZScalar.cpp index 062fb0e079..7e4be4d57f 100644 --- a/tools/ZAPD/ZAPD/ZScalar.cpp +++ b/tools/ZAPD/ZAPD/ZScalar.cpp @@ -4,6 +4,7 @@ #include "Utils/BitConverter.h" #include "Utils/File.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Scalar, ZScalar); @@ -207,8 +208,8 @@ void ZScalar::ParseRawData() scalarData.f64 = BitConverter::ToDoubleBE(rawData, rawDataIndex); break; case ZScalarType::ZSCALAR_NONE: - fprintf(stderr, "Warning in ZScalar: Invalid type. %d %s %d\n", (int32_t)scalarType, - __FILE__, __LINE__); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'Type' attribute", "Defaulting to ''"); break; } } diff --git a/tools/ZAPD/ZAPD/ZScalar.h b/tools/ZAPD/ZAPD/ZScalar.h index d269995cca..8f98f261d7 100644 --- a/tools/ZAPD/ZAPD/ZScalar.h +++ b/tools/ZAPD/ZAPD/ZScalar.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZResource.h" diff --git a/tools/ZAPD/ZAPD/ZSkeleton.cpp b/tools/ZAPD/ZAPD/ZSkeleton.cpp index 84f00c8187..1a2f93ff7b 100644 --- a/tools/ZAPD/ZAPD/ZSkeleton.cpp +++ b/tools/ZAPD/ZAPD/ZSkeleton.cpp @@ -5,6 +5,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" REGISTER_ZFILENODE(Skeleton, ZSkeleton); REGISTER_ZFILENODE(LimbTable, ZLimbTable); @@ -27,18 +28,19 @@ void ZSkeleton::ParseXML(tinyxml2::XMLElement* reader) type = ZSkeletonType::Curve; else if (skelTypeXml != "Normal") { - throw std::runtime_error(StringHelper::Sprintf("ZSkeleton::ParseXML: Error in '%s'.\n" - "\t Invalid Type found: '%s'.\n", - name.c_str(), skelTypeXml.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'Type' attribute", ""); } std::string limbTypeXml = registeredAttributes.at("LimbType").value; limbType = ZLimb::GetTypeByAttributeName(limbTypeXml); if (limbType == ZLimbType::Invalid) { - throw std::runtime_error(StringHelper::Sprintf("ZSkeleton::ParseXML: Error in '%s'.\n" - "\t Invalid LimbType found: '%s'.\n", - name.c_str(), limbTypeXml.c_str())); + HANDLE_ERROR_RESOURCE( + WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + StringHelper::Sprintf("invalid value '%s' found for 'LimbType' attribute", + limbTypeXml.c_str()), + "Defaulting to 'Standard'."); } } @@ -170,11 +172,9 @@ void ZLimbTable::ParseXML(tinyxml2::XMLElement* reader) limbType = ZLimb::GetTypeByAttributeName(limbTypeXml); if (limbType == ZLimbType::Invalid) { - fprintf(stderr, - "ZLimbTable::ParseXML: Warning in '%s'.\n" - "\t Invalid LimbType found: '%s'.\n" - "\t Defaulting to 'Standard'.\n", - name.c_str(), limbTypeXml.c_str()); + HANDLE_WARNING_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'LimbType' attribute.", + "Defaulting to 'Standard'."); limbType = ZLimbType::Standard; } diff --git a/tools/ZAPD/ZAPD/ZSymbol.cpp b/tools/ZAPD/ZAPD/ZSymbol.cpp index b24c3de4b0..eabfc2faae 100644 --- a/tools/ZAPD/ZAPD/ZSymbol.cpp +++ b/tools/ZAPD/ZAPD/ZSymbol.cpp @@ -1,6 +1,7 @@ #include "ZSymbol.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Symbol, ZSymbol); @@ -20,11 +21,8 @@ void ZSymbol::ParseXML(tinyxml2::XMLElement* reader) if (typeXml == "") { - fprintf(stderr, - "ZSymbol::ParseXML: Warning in '%s'.\n" - "\t Missing 'Type' attribute in xml.\n" - "\t Defaulting to 'void*'.\n", - name.c_str()); + HANDLE_WARNING_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, + "missing 'Type' attribute in ", "Defaulting to 'void*'."); type = "void*"; } else @@ -35,11 +33,8 @@ void ZSymbol::ParseXML(tinyxml2::XMLElement* reader) std::string typeSizeXml = registeredAttributes.at("TypeSize").value; if (typeSizeXml == "") { - fprintf(stderr, - "ZSymbol::ParseXML: Warning in '%s'.\n" - "\t Missing 'TypeSize' attribute in xml.\n" - "\t Defaulting to '4'.\n", - name.c_str()); + HANDLE_WARNING_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, + "missing 'TypeSize' attribute in ", "Defaulting to '4'."); typeSize = 4; // Size of a word. } else @@ -58,7 +53,9 @@ void ZSymbol::ParseXML(tinyxml2::XMLElement* reader) if (registeredAttributes.at("Static").value == "On") { - fprintf(stderr, "A can't be marked as static.\n\t Disabling static\n"); + HANDLE_WARNING_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "a cannot be marked as static", + "Disabling static for this resource."); } staticConf = StaticConfig::Off; } diff --git a/tools/ZAPD/ZAPD/ZTexture.cpp b/tools/ZAPD/ZAPD/ZTexture.cpp index 33ee54d1bc..7bd31438b4 100644 --- a/tools/ZAPD/ZAPD/ZTexture.cpp +++ b/tools/ZAPD/ZAPD/ZTexture.cpp @@ -8,6 +8,7 @@ #include "Utils/Directory.h" #include "Utils/File.h" #include "Utils/Path.h" +#include "WarningHandler.h" REGISTER_ZFILENODE(Texture, ZTexture); @@ -57,17 +58,17 @@ void ZTexture::ParseXML(tinyxml2::XMLElement* reader) if (!StringHelper::HasOnlyDigits(widthXml)) { - throw std::runtime_error( - StringHelper::Sprintf("ZTexture::ParseXML: Error in %s\n" - "\t Value of 'Width' attribute has non-decimal digits: '%s'.\n", - name.c_str(), widthXml.c_str())); + std::string errorHeader = StringHelper::Sprintf( + "value of 'Width' attribute has non-decimal digits: '%s'", widthXml.c_str()); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + errorHeader, ""); } if (!StringHelper::HasOnlyDigits(heightXml)) { - throw std::runtime_error( - StringHelper::Sprintf("ZTexture::ParseXML: Error in %s\n" - "\t Value of 'Height' attribute has non-decimal digits: '%s'.\n", - name.c_str(), heightXml.c_str())); + std::string errorHeader = StringHelper::Sprintf( + "value of 'Height' attribute has non-decimal digits: '%s'", heightXml.c_str()); + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + errorHeader, ""); } width = StringHelper::StrToL(widthXml); @@ -77,7 +78,10 @@ void ZTexture::ParseXML(tinyxml2::XMLElement* reader) format = GetTextureTypeFromString(formatStr); if (format == TextureType::Error) - throw std::runtime_error("Format " + formatStr + " is not supported!"); + { + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + "invalid value found for 'Format' attribute", ""); + } const auto& tlutOffsetAttr = registeredAttributes.at("TlutOffset"); if (tlutOffsetAttr.wasSet) @@ -90,10 +94,9 @@ void ZTexture::ParseXML(tinyxml2::XMLElement* reader) break; default: - throw std::runtime_error(StringHelper::Sprintf( - "ZTexture::ParseXML: Error in %s\n" - "\t 'TlutOffset' declared in non color-indexed (ci4 or ci8) texture.\n", - name.c_str())); + HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, + "'TlutOffset' declared in non color-indexed (ci4 or ci8) texture", + ""); break; } } @@ -102,10 +105,10 @@ void ZTexture::ParseXML(tinyxml2::XMLElement* reader) void ZTexture::ParseRawData() { if (rawDataIndex % 8 != 0) - fprintf(stderr, - "ZTexture::ParseXML: Warning in '%s'.\n" - "\t This texture is not 64-bit aligned.\n", - name.c_str()); + { + HANDLE_WARNING_RESOURCE(WarningType::NotImplemented, parent, this, rawDataIndex, + "this texture is not 64-bit aligned", ""); + } switch (format) { @@ -136,8 +139,11 @@ void ZTexture::ParseRawData() case TextureType::Palette8bpp: PrepareBitmapPalette8(); break; - default: - throw std::runtime_error("Format is not supported!"); + case TextureType::Error: + HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, + StringHelper::Sprintf("Invalid texture format", format), ""); + assert(!"TODO"); + break; } } @@ -375,8 +381,9 @@ void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath) case TextureType::Palette8bpp: PrepareRawDataPalette8(pngFilePath); break; - default: - throw std::runtime_error("Format is not supported!"); + case TextureType::Error: + HANDLE_ERROR_PROCESS(WarningType::InvalidPNG, "Input PNG file has invalid format type", ""); + break; } } @@ -860,13 +867,9 @@ TextureType ZTexture::GetTextureTypeFromString(const std::string& str) else if (str == "rgb5a1") { texType = TextureType::RGBA16bpp; -#ifdef DEPRECATION_ON - fprintf(stderr, "ZTexture::GetTextureTypeFromString: Deprecation warning.\n" - "\t The texture format 'rgb5a1' is currently deprecated, and will be " - "removed in a future " - "version.\n" - "\t Use the format 'rgba16' instead.\n"); -#endif + HANDLE_WARNING(WarningType::Deprecated, + "the texture format 'rgb5a1' is currently deprecated", + "It will be removed in a future version. Use the format 'rgba16' instead."); } else if (str == "i4") texType = TextureType::Grayscale4bpp; @@ -883,7 +886,9 @@ TextureType ZTexture::GetTextureTypeFromString(const std::string& str) else if (str == "ci8") texType = TextureType::Palette8bpp; else - fprintf(stderr, "Encountered Unknown Texture format %s \n", str.c_str()); + // TODO: handle this case in a more coherent way + HANDLE_WARNING(WarningType::InvalidAttributeValue, + "invalid value found for 'Type' attribute", "Defaulting to ''."); return texType; } diff --git a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp b/tools/ZAPD/ZAPD/ZTextureAnimation.cpp index 4332fcf1e5..698054fa87 100644 --- a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp +++ b/tools/ZAPD/ZAPD/ZTextureAnimation.cpp @@ -2,8 +2,8 @@ * File: ZTextureAnimation.cpp * ZResources defined: ZTextureAnimation, ZTextureAnimationParams (XML declaration not supported for * the latter) - * Purpose: extracting texture animating structures from asset files Note: data type is exclusive to - * Majora's Mask + * Purpose: extracting texture animating structures from asset files + * Note: data type is exclusive to Majora's Mask * * Structure of data: * A texture animation consists of a main array of data of the form @@ -82,6 +82,7 @@ #include "Globals.h" #include "Utils/BitConverter.h" +#include "WarningHandler.h" #include "ZFile.h" #include "ZResource.h" #include "tinyxml2.h" @@ -115,7 +116,7 @@ void ZTextureAnimationParams::ExtractFromBinary(uint32_t nRawDataIndex) ParseRawData(); } -// Implemented by TextureScrollingParams only[ +// Implemented by TextureScrollingParams only void ZTextureAnimationParams::ExtractFromBinary([[maybe_unused]] uint32_t nRawDataIndex, [[maybe_unused]] int count) { @@ -217,19 +218,8 @@ void TextureColorChangingParams::ParseRawData() ((type == TextureAnimationParamsType::ColorChange) ? animLength : colorListCount); if (listLength == 0) - throw std::runtime_error(StringHelper::Sprintf( - "When processing file %s: in input binary file %s, offset 0x%06X:" - "\n\t" - "\033[97m" - "TextureColorChangingParams::ParseRawData:" - "\033[0m" - "\033[91m" - " error: " - "\033[0m" - "\033[97m" - "color list length cannot be 0\n" - "\033[0m", - Globals::Instance->inputPath.c_str(), parent->GetName().c_str(), rawDataIndex)); + HANDLE_ERROR_RESOURCE(WarningType::Always, parent, this, rawDataIndex, + "color list length cannot be 0", ""); primColorListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); envColorListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); @@ -378,20 +368,8 @@ void TextureCyclingParams::ParseRawData() cycleLength = BitConverter::ToUInt16BE(rawData, rawDataIndex); if (cycleLength == 0) - throw std::runtime_error( - StringHelper::Sprintf("When processing file %s: in input binary file %s, offset 0x%06X:" - "\n\t" - "\033[97m" - "TextureCyclingParams::ParseRawData:" - "\033[0m" - "\033[91m" - " error: " - "\033[0m" - "\033[97m" - "cycleLength cannot be 0\n" - "\033[0m", - Globals::Instance->inputPath.c_str(), parent->GetName().c_str(), - Seg2Filespace(rawDataIndex, 0))); + HANDLE_ERROR_RESOURCE(WarningType::Always, parent, this, rawDataIndex, + "cycle length cannot be 0", ""); textureListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); textureIndexListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); @@ -454,21 +432,12 @@ void TextureCyclingParams::DeclareReferences([[maybe_unused]] const std::string& { comment = " // Raw pointer, declare texture in XML to use proper symbol"; - fprintf(stderr, - "When processing file %s: in input binary file %s, offset 0x%06X:" - "\n\t" - "\033[97m" - "TextureCyclingParams::DeclareReferences:" - "\033[0m" - "\033[95m" - " warning: " - "\033[0m" - "\033[97m" - "TexCycle declared here points to unknown texture at address %s. " - "Please declare the texture in the XML to use the proper symbol.\n" - "\033[0m", - Globals::Instance->inputPath.c_str(), parent->GetName().c_str(), - Seg2Filespace(textureListAddress, parent->baseAddress), texName.c_str()); + auto msgHeader = StringHelper::Sprintf( + "TexCycle texture array declared here points to unknown texture at address %s", + texName.c_str()); + HANDLE_WARNING_RESOURCE( + WarningType::HardcodedPointer, parent, this, rawDataIndex, msgHeader, + "Please declare the texture in the XML to use the proper symbol."); } texturesBodyStr += StringHelper::Sprintf("\t%s,%s\n", texName.c_str(), comment.c_str()); } @@ -546,22 +515,14 @@ void ZTextureAnimation::ParseRawData() if ((type < 0) || (type > 6)) { - throw std::runtime_error(StringHelper::Sprintf( - "When processing file %s: in input binary file %s, offset 0x%06X:" - "\n\t" - "\033[97m" - "ZTextureAnimation::ParseRawData:" - "\033[0m" - "\033[91m" - " error: " - "\033[0m" - "\033[97m" - "unknown TextureAnimationParams type 0x%02X in TextureAnimation: entry reads\n\t{ " - "0x%02X, 0x%02X, 0x%08X }\n(type should be between " - "0x00 and 0x06)\n" - "\033[0m", - Globals::Instance->inputPath.c_str(), parent->GetName().c_str(), rawDataIndex, type, - currentEntry.segment, type, currentEntry.paramsPtr)); + HANDLE_ERROR_RESOURCE( + WarningType::Always, parent, this, rawDataIndex, + StringHelper::Sprintf( + "unknown TextureAnimationParams type 0x%02X in TextureAnimation", type), + StringHelper::Sprintf( + "Entry reads { 0x%02X, 0x%02X, 0x%08X } , but type should be " + "between 0x00 and 0x06 inclusive.", + currentEntry.segment, type, currentEntry.paramsPtr)); } if (currentEntry.segment <= 0) @@ -589,13 +550,24 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix) if (!parent->HasDeclaration(paramsOffset)) { ZTextureAnimationParams* params; - int count = 2; + int count; switch (entry.type) { case TextureAnimationParamsType::SingleScroll: - count = 1; - [[fallthrough]]; - case TextureAnimationParamsType::DualScroll: + if (true) + { + count = 1; + // The else now allows SingleScroll to fall through to params = ... without + // touching the code in the else block + } + else + { + // The contents of this block can only be run by jumping into it with the + // case label + [[fallthrough]]; + case TextureAnimationParamsType::DualScroll: + count = 2; + } params = new TextureScrollingParams(parent); params->ExtractFromBinary(paramsOffset, count); break; @@ -614,22 +586,12 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix) break; case TextureAnimationParamsType::Empty: - fprintf(stderr, - "When processing file %s: in input binary file %s: offset 0x%06X:" - "\n\t" - "\033[97m" - "ZTextureAnimation::DeclareReferences:" - "\033[0m" - "\033[95m" - " warning: " - "\033[0m" - "\033[97m" - "TextureAnimationParams entry has empty type (6), but params pointer " - "is not NULL. Params read\n\t\t" - "{ 0x%02X, 0x%02X, 0x%08X }\n" - "\033[0m", - Globals::Instance->inputPath.c_str(), parent->GetName().c_str(), - rawDataIndex, entry.segment, (int)entry.type, entry.paramsPtr); + HANDLE_WARNING_RESOURCE( + WarningType::InvalidExtractedData, parent, this, rawDataIndex, + "TextureAnimationParams entry has empty type (6), but params pointer is " + "not NULL", + StringHelper::Sprintf("Params read { 0x%02X, 0x%02X, 0x%08X } .", + entry.segment, (int)entry.type, entry.paramsPtr)); return; default: // Because GCC is worried this could happen diff --git a/tools/ZAPD/ZAPD/ZVector.cpp b/tools/ZAPD/ZAPD/ZVector.cpp index c940b0b0de..a5a059e354 100644 --- a/tools/ZAPD/ZAPD/ZVector.cpp +++ b/tools/ZAPD/ZAPD/ZVector.cpp @@ -6,6 +6,7 @@ #include "Utils/BitConverter.h" #include "Utils/File.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" #include "ZFile.h" REGISTER_ZFILENODE(Vector, ZVector); @@ -86,20 +87,18 @@ std::string ZVector::GetSourceTypeName() const return "Vec3i"; else { - std::string output = StringHelper::Sprintf( - "Encountered unsupported vector type: %d dimensions, %s type", dimensions, + std::string msgHeader = StringHelper::Sprintf( + "encountered unsupported vector type: %d dimensions, %s type", dimensions, ZScalar::MapScalarTypeToOutputType(scalarType).c_str()); - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("%s\n", output.c_str()); - - throw std::runtime_error(output); + HANDLE_ERROR_RESOURCE(WarningType::NotImplemented, parent, this, rawDataIndex, msgHeader, + ""); } } std::string ZVector::GetBodySourceCode() const { - std::string body; + std::string body = ""; for (size_t i = 0; i < scalars.size(); i++) { diff --git a/tools/ZAPD/ZAPD/ZVector.h b/tools/ZAPD/ZAPD/ZVector.h index d1a738968d..a50d3e8083 100644 --- a/tools/ZAPD/ZAPD/ZVector.h +++ b/tools/ZAPD/ZAPD/ZVector.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZResource.h" diff --git a/tools/ZAPD/ZAPD/ZVtx.h b/tools/ZAPD/ZAPD/ZVtx.h index 018a1d4a9a..511048791d 100644 --- a/tools/ZAPD/ZAPD/ZVtx.h +++ b/tools/ZAPD/ZAPD/ZVtx.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "ZResource.h" diff --git a/tools/ZAPD/ZAPD/any/any/zlib.static.txt b/tools/ZAPD/ZAPD/any/any/zlib.static.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tools/ZAPD/ZAPD/packages.config b/tools/ZAPD/ZAPD/packages.config index a7f2abbd29..c387aaed70 100644 --- a/tools/ZAPD/ZAPD/packages.config +++ b/tools/ZAPD/ZAPD/packages.config @@ -1,8 +1,9 @@  - - + + + \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Color3b.h b/tools/ZAPD/ZAPDUtils/Color3b.h index 7e59f6b7f7..507c099f52 100644 --- a/tools/ZAPD/ZAPDUtils/Color3b.h +++ b/tools/ZAPD/ZAPDUtils/Color3b.h @@ -1,6 +1,6 @@ #pragma once -#include +#include struct Color3b { diff --git a/tools/ZAPD/ZAPDUtils/Makefile b/tools/ZAPD/ZAPDUtils/Makefile index aef6780313..e8941ed773 100644 --- a/tools/ZAPD/ZAPDUtils/Makefile +++ b/tools/ZAPD/ZAPDUtils/Makefile @@ -1,7 +1,7 @@ # Only used for standalone compilation, usually inherits these from the main makefile CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17 -SRC_DIRS := $(shell find -type d -not -path "*build*") +SRC_DIRS := $(shell find . -type d -not -path "*build*") CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) diff --git a/tools/ZAPD/ZAPDUtils/StrHash.h b/tools/ZAPD/ZAPDUtils/StrHash.h index 68d22b9cd6..c611bdddad 100644 --- a/tools/ZAPD/ZAPDUtils/StrHash.h +++ b/tools/ZAPD/ZAPDUtils/StrHash.h @@ -1,8 +1,8 @@ #pragma once -#include -#include -#include +#include +#include +#include typedef uint32_t strhash; diff --git a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp b/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp index a4cf782294..35412781cc 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp +++ b/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp @@ -1,5 +1,5 @@ #include "BinaryReader.h" -#include +#include #include #include "Stream.h" @@ -89,7 +89,7 @@ float BinaryReader::ReadSingle() stream->Read((char*)&result, sizeof(float)); - if (isnan(result)) + if (std::isnan(result)) throw std::runtime_error("BinaryReader::ReadSingle(): Error reading stream"); return result; @@ -100,7 +100,7 @@ double BinaryReader::ReadDouble() double result = NAN; stream->Read((char*)&result, sizeof(double)); - if (isnan(result)) + if (std::isnan(result)) throw std::runtime_error("BinaryReader::ReadDouble(): Error reading stream"); return result; diff --git a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h b/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h index 5cca35b319..e672b97c23 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h +++ b/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h @@ -1,7 +1,7 @@ #pragma once +#include #include -#include #include class BitConverter diff --git a/tools/ZAPD/ZAPDUtils/Utils/File.h b/tools/ZAPD/ZAPDUtils/Utils/File.h index e3f8880cb6..084152f794 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/File.h +++ b/tools/ZAPD/ZAPDUtils/Utils/File.h @@ -1,8 +1,8 @@ #pragma once +#include #include #include -#include #include #include #include "Directory.h" diff --git a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp b/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp index 6c27399d6c..6e85c59a04 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp +++ b/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp @@ -1,5 +1,5 @@ #include "MemoryStream.h" -#include +#include #ifndef _MSC_VER #define memcpy_s(dest, destSize, source, sourceSize) memcpy(dest, source, destSize) diff --git a/tools/ZAPD/ZAPDUtils/Utils/Path.h b/tools/ZAPD/ZAPDUtils/Utils/Path.h index 496a0ae13c..0f7ef27431 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/Path.h +++ b/tools/ZAPD/ZAPDUtils/Utils/Path.h @@ -18,13 +18,13 @@ public: static std::string GetFileName(const fs::path& input) { // https://en.cppreference.com/w/cpp/filesystem/path/filename - return input.filename(); + return input.filename().string(); }; static std::string GetFileNameWithoutExtension(const fs::path& input) { // https://en.cppreference.com/w/cpp/filesystem/path/stem - return input.stem(); + return input.stem().string(); }; static std::string GetFileNameExtension(const std::string& input) diff --git a/tools/ZAPD/ZAPDUtils/Utils/Stream.h b/tools/ZAPD/ZAPDUtils/Utils/Stream.h index 060e23cd27..e73a9a70d0 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/Stream.h +++ b/tools/ZAPD/ZAPDUtils/Utils/Stream.h @@ -1,7 +1,7 @@ #pragma once +#include #include -#include enum class SeekOffsetType { diff --git a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h b/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h index 74607ce3a2..0b0d676429 100644 --- a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h +++ b/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h @@ -1,18 +1,12 @@ #pragma once #include +#include #include #include -#include #include #include -#ifdef _MSC_VER -#define __PRETTY_FUNCTION__ __FUNCSIG__ -#elif not defined(__GNUC__) -#define __PRETTY_FUNCTION__ __func__ -#endif - class StringHelper { public: @@ -111,4 +105,10 @@ public: { return std::all_of(str.begin(), str.end(), ::isdigit); } + + static bool IEquals(const std::string& a, const std::string& b) + { + return std::equal(a.begin(), a.end(), b.begin(), b.end(), + [](char a, char b) { return tolower(a) == tolower(b); }); + } }; diff --git a/tools/ZAPD/ZAPDUtils/Utils/vt.h b/tools/ZAPD/ZAPDUtils/Utils/vt.h new file mode 100644 index 0000000000..23f424442b --- /dev/null +++ b/tools/ZAPD/ZAPDUtils/Utils/vt.h @@ -0,0 +1,45 @@ +#ifndef VT_H +#define VT_H + +// clang-format off +#define VT_COLOR_BLACK 0 +#define VT_COLOR_RED 1 +#define VT_COLOR_GREEN 2 +#define VT_COLOR_YELLOW 3 +#define VT_COLOR_BLUE 4 +#define VT_COLOR_PURPLE 5 +#define VT_COLOR_CYAN 6 +#define VT_COLOR_WHITE 7 +#define VT_COLOR_LIGHTGRAY 8 +#define VT_COLOR_DARKGRAY 9 + +#define VT_COLOR_FOREGROUND 3 +#define VT_COLOR_BACKGROUND 4 +// clang-format on + +#define VT_COLOR_EXPAND0(type, color) #type #color +#define VT_COLOR_EXPAND1(type, color) VT_COLOR_EXPAND0(type, color) +#define VT_COLOR(type, color) VT_COLOR_EXPAND1(VT_COLOR_##type, VT_COLOR_##color) + +#define VT_ESC "\x1b" +#define VT_CSI "[" +#define VT_CUP(x, y) VT_ESC VT_CSI y ";" x "H" +#define VT_ED(n) VT_ESC VT_CSI #n "J" +#define VT_SGR(n) VT_ESC VT_CSI n "m" + +// Add more macros if necessary +#define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore)) +#define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color)) +#define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color)) + +// Bold +#define VT_BOLD "1" + +// Bold color support +#define VT_BOLD_FGCOL(color) VT_SGR(VT_BOLD ";" VT_COLOR(FOREGROUND, color)) +#define VT_BOLD_BGCOL(color) VT_SGR(VT_BOLD ";" VT_COLOR(BACKGROUND, color)) + +#define VT_RST VT_SGR("") +#define VT_CLS VT_ED(2) + +#endif diff --git a/tools/ZAPD/ZAPDUtils/Vec2f.h b/tools/ZAPD/ZAPDUtils/Vec2f.h index 9d4beeb465..73e9259a89 100644 --- a/tools/ZAPD/ZAPDUtils/Vec2f.h +++ b/tools/ZAPD/ZAPDUtils/Vec2f.h @@ -1,6 +1,6 @@ #pragma once -#include +#include struct Vec2f { diff --git a/tools/ZAPD/ZAPDUtils/Vec3f.h b/tools/ZAPD/ZAPDUtils/Vec3f.h index 4bfbb3c254..d6e9c5568f 100644 --- a/tools/ZAPD/ZAPDUtils/Vec3f.h +++ b/tools/ZAPD/ZAPDUtils/Vec3f.h @@ -1,6 +1,6 @@ #pragma once -#include +#include struct Vec3f { diff --git a/tools/ZAPD/ZAPDUtils/Vec3s.h b/tools/ZAPD/ZAPDUtils/Vec3s.h index 23e4673b84..05816eddb5 100644 --- a/tools/ZAPD/ZAPDUtils/Vec3s.h +++ b/tools/ZAPD/ZAPDUtils/Vec3s.h @@ -1,6 +1,6 @@ #pragma once -#include +#include struct Vec3s { diff --git a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj index 803cdb5f01..0a09666e03 100644 --- a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj +++ b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj @@ -43,7 +43,7 @@ StaticLibrary true v142 - Unicode + MultiByte Application @@ -116,6 +116,8 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreadedDebug + Default Console @@ -155,6 +157,7 @@ + diff --git a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters index 48117c845f..4765ad5d45 100644 --- a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters +++ b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters @@ -19,6 +19,9 @@ {e047919d-7186-49ca-b115-e48fbb5c8743} + + {3de9dd46-0dfd-4d48-9f20-9f24e5b80fe0} + @@ -74,5 +77,8 @@ Source Files\Utils + + Source Files\Libraries + \ No newline at end of file diff --git a/tools/ZAPD/docs/zapd_warning_example.png b/tools/ZAPD/docs/zapd_warning_example.png new file mode 100644 index 0000000000..a001c64d6a Binary files /dev/null and b/tools/ZAPD/docs/zapd_warning_example.png differ diff --git a/tools/actorfixer.py b/tools/actorfixer.py index e89303ba56..428c6dee5b 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -154,6 +154,154 @@ animdict = { "MainHeap_Init": "ZeldaArena_Init", "MainHeap_Cleanup": "ZeldaArena_Cleanup", "MainHeap_IsInitialized": "ZeldaArena_IsInitialized", + # "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", + # "BgCheck_AddActorMesh": "DynaPoly_SetBgActor", + # "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor", + "BgCheck_PolygonLinkedListNodeInit": "SSNode_SetValue", + "BgCheck_PolygonLinkedListResetHead": "SSList_SetNull", + "BgCheck_ScenePolygonListsNodeInsert": "SSNodeList_SetSSListHead", + "BgCheck_PolygonLinkedListNodeInsert": "DynaSSNodeList_SetSSListHead", + "BgCheck_PolygonLinkedListInit": "DynaSSNodeList_Init", + "BgCheck_PolygonLinkedListAlloc": "DynaSSNodeList_Alloc", + "BgCheck_PolygonLinkedListReset": "DynaSSNodeList_ResetCount", + "BgCheck_AllocPolygonLinkedListNode": "DynaSSNodeList_GetNextNodeIdx", + "BgCheck_CreateVec3fFromVertex": "BgCheck_Vec3sToVec3f", + "BgCheck_CreateVertexFromVec3f": "BgCheck_Vec3fToVec3s", + "BgCheck_PolygonGetMinY": "CollisionPoly_GetMinY", + "BgCheck_PolygonGetNormal": "CollisionPoly_GetNormalF", + "func_800C01B8": "CollisionPoly_GetPointDistanceFromPlane", + "BgCheck_CreateTriNormFromPolygon": "CollisionPoly_GetVertices", + "func_800C02C0": "CollisionPoly_GetVerticesByBgId", + "BgCheck_PolygonCollidesWithSphere": "CollisionPoly_SphVsPoly", + "BgCheck_ScenePolygonListsInsertSorted": "StaticLookup_AddPolyToSSList", + "BgCheck_ScenePolygonListsInsert": "StaticLookup_AddPoly", + "BgCheck_GetPolyMinSubdivisions": "BgCheck_GetSubdivisionMinBounds", + "BgCheck_GetPolyMaxSubdivisions": "BgCheck_GetSubdivisionMaxBounds", + "BgCheck_GetPolyMinMaxSubdivisions": "BgCheck_GetPolySubdivisionBounds", + "func_800C2BE0": "BgCheck_PolyIntersectsSubdivision", + "BgCheck_SplitScenePolygonsIntoSubdivisions": "BgCheck_InitStaticLookup", + "BgCheck_GetIsDefaultSpecialScene": "BgCheck_IsSmallMemScene", + "BgCheck_GetSpecialSceneMaxMemory": "BgCheck_TryGetCustomMemsize", + "BgCheck_CalcSubdivisionSize": "BgCheck_SetSubdivisionDimension", + "BgCheck_Init(": "BgCheck_Allocate(", + "func_800C3C00": "BgCheck_SetContextFlags", + "func_800C3C14": "BgCheck_UnsetContextFlags", + "BgCheck_GetActorMeshHeader": "BgCheck_GetCollisionHeader", + "func_800C3D50": "BgCheck_RaycastFloorImpl", + "func_800C3F40": "BgCheck_CameraRaycastFloor1", + "func_800C3FA0": "BgCheck_EntityRaycastFloor1", + "func_800C4000": "BgCheck_EntityRaycastFloor2", + "func_800C4058": "BgCheck_EntityRaycastFloor2_1", + "func_800C40B4": "BgCheck_EntityRaycastFloor3", + "func_800C411C": "BgCheck_EntityRaycastFloor5", + "func_800C4188": "BgCheck_EntityRaycastFloor5_2", + "func_800C41E4": "BgCheck_EntityRaycastFloor5_3", + "func_800C4240": "BgCheck_EntityRaycastFloor6", + "func_800C42A8": "BgCheck_EntityRaycastFloor7", + "func_800C4314": "BgCheck_AnyRaycastFloor1", + "func_800C43CC": "BgCheck_AnyRaycastFloor2", + "func_800C4488": "BgCheck_CameraRaycastFloor2", + "func_800C44F0": "BgCheck_EntityRaycastFloor8", + "func_800C455C": "BgCheck_EntityRaycastFloor9", + "func_800C45C4": "BgCheck_CheckWallImpl", + "func_800C4C74": "BgCheck_EntitySphVsWall1", + "func_800C4CD8": "BgCheck_EntitySphVsWall2", + "func_800C4D3C": "BgCheck_EntitySphVsWall3", + "func_800C4DA4": "BgCheck_EntitySphVsWall4", + "func_800C4E10": "BgCheck_CheckCeilingImpl", + "func_800C4F38": "BgCheck_AnyCheckCeiling", + "func_800C4F84": "BgCheck_EntityCheckCeiling", + "func_800C54AC": "BgCheck_CameraLineTest1", + "func_800C5538": "BgCheck_CameraLineTest2", + "func_800C55C4": "BgCheck_EntityLineTest1", + "func_800C5650": "BgCheck_EntityLineTest2", + "func_800C56E0": "BgCheck_EntityLineTest3", + "func_800C576C": "BgCheck_ProjectileLineTest", + "func_800C57F8": "BgCheck_AnyLineTest1", + "func_800C583C": "BgCheck_AnyLineTest2", + "func_800C58C8": "BgCheck_AnyLineTest3", + "func_800C5954": "BgCheck_SphVsFirstPolyImpl", + "func_800C5A20": "BgCheck_SphVsFirstPoly", + "func_800C5A64": "BgCheck_SphVsFirstWall", + "BgCheck_ScenePolygonListsInit": "SSNodeList_Init", + "BgCheck_ScenePolygonListsAlloc": "SSNodeList_Alloc", + "func_800C5B80": "SSNodeList_GetNextNode", + "BgCheck_ScenePolygonListsReserveNode": "SSNodeList_GetNextNodeIdx", + "BgCheck_ActorMeshParamsInit": "ScaleRotPos_Init", + "BgCheck_SetActorMeshParams": "ScaleRotPos_SetValue", + "BgCheck_ActorMeshPolyListsHeadsInit": "DynaLookup_ResetLists", + "BgCheck_ActorMeshPolyListsInit": "DynaLookup_Reset", + "BgCheck_ActorMeshVerticesIndexInit": "DynaLookup_ResetVtxStartIndex", + "BgCheck_ActorMeshWaterboxesIndexInit": "DynaLookup_ResetWaterBoxStartIndex", + "BgCheck_ActorMeshInit": "BgActor_Init", + "BgCheck_ActorMeshInitFromActor": "BgActor_SetActor", + "BgCheck_HasActorMeshChanged": "BgActor_IsTransformUnchanged", + "BgCheck_PolygonsInit": "DynaPoly_NullPolyList", + "BgCheck_PolygonsAlloc": "DynaPoly_AllocPolyList", + "BgCheck_VerticesInit": "DynaPoly_NullVtxList", + "BgCheck_VerticesListAlloc": "DynaPoly_AllocVtxList", + "BgCheck_WaterboxListInit": "DynaPoly_InitWaterBoxList", + "BgCheck_WaterboxListAlloc": "DynaPoly_AllocWaterBoxList", + "BgCheck_ActorMeshUpdateParams": "DynaPoly_SetBgActorPrevTransform", + "BgCheck_IsActorMeshIndexValid": "DynaPoly_IsBgIdBgActor", + "BgCheck_DynaInit": "DynaPoly_Init", + "BgCheck_DynaAlloc": "DynaPoly_Alloc", + "BgCheck_AddActorMesh": "DynaPoly_SetBgActor", + "BgCheck_GetActorOfMesh": "DynaPoly_GetActor", + "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor", + "BgCheck_AddActorMeshToLists": "DynaPoly_ExpandSRT", + "BgCheck_Update": "DynaPoly_Setup", + "BgCheck_UpdateAllActorMeshes": "DynaPoly_UpdateBgActorTransforms", + "BgCheck_RelocateMeshHeaderPointers": "CollisionHeader_SegmentedToVirtual", + "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", + "BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders", + "BgCheck_GetPolygonAttributes": "SurfaceType_GetData", + "func_800C9704": "SurfaceType_GetCamDataIndex", + "func_800C9924": "SurfaceType_GetCamPosData", + "func_800C99AC": "SurfaceType_GetSceneExitIndex", + "func_800C9B90": "SurfaceType_IsHorseBlocked", + "func_800C9BDC": "SurfaceType_GetSfx", + "func_800C9C74": "SurfaceType_GetSlope", + "func_800C9C9C": "SurfaceType_GetLightSettingIndex", + "func_800C9CC4": "SurfaceType_GetEcho", + "func_800C9CEC": "SurfaceType_IsHookshotSurface", + "func_800C9D14": "SurfaceType_IsIgnoredByEntities", + "func_800C9D50": "SurfaceType_IsIgnoredByProjectiles", + "func_800C9D8C": "SurfaceType_IsConveyor", + "func_800C9E18": "SurfaceType_GetConveyorSpeed", + "func_800C9E40": "SurfaceType_GetConveyorDirection", + "func_800C9E88": "SurfaceType_IsWallDamage", + "func_800C9EBC": "WaterBox_GetSurfaceImpl", + "func_800CA1AC": "WaterBox_GetSurface1", + "func_800CA1E8": "WaterBox_GetSurface1_2", + "func_800CA22C": "WaterBox_GetSurface2", + "func_800CA6D8": "WaterBox_GetLightSettingIndex", + "func_80179678": "Math3D_PlaneVsLineSegClosestPoint", + "Math3D_DistanceSquared": "Math3D_Vec3fDistSq", + "Math3D_NormalVector": "Math3D_SurfaceNorm", + "func_8017A954": "Math3D_PointRelativeToCubeFaces", + "func_8017AA0C": "Math3D_PointRelativeToCubeEdges", + "func_8017ABBC": "Math3D_PointRelativeToCubeVertices", + "func_8017AD38": "Math3D_LineVsCube", + "Math3D_NormalizedDistanceFromPlane": "Math3D_UDistPlaneToPos", + "Math3D_NormalizedSignedDistanceFromPlane": "Math3D_DistPlaneToPos", + "func_8017BAD0": "Math3D_TriChkPointParaYDist", + "func_8017BE30": "Math3D_TriChkPointParaYIntersectDist", + "func_8017BEE0": "Math3D_TriChkPointParaYIntersectInsideTri", + "func_8017C008": "Math3D_TriChkLineSegParaYIntersect", + "func_8017C494": "Math3D_TriChkPointParaYIntersectInsideTri2", + "func_8017C540": "Math3D_TriChkPointParaXDist", + "func_8017C850": "Math3D_TriChkPointParaXIntersect", + "func_8017C980": "Math3D_TriChkLineSegParaXIntersect", + "func_8017CB7C": "Math3D_TriChkLineSegParaZDist", + "func_8017CEF0": "Math3D_TriChkPointParaZIntersect", + "func_8017D020": "Math3D_TriChkLineSegParaZIntersect", + "Math3D_ColSphereLineSeg": "Math3D_LineVsSph", + "Math3D_ColSphereSphere(": "Math3D_SphVsSph(", + "func_8017F9C0": "Math3D_XZInSphere", + "func_8017FA34": "Math3D_XYInSphere", + "func_8017FAA8": "Math3D_YZInSphere", + "skelanime.unk03": "skelanime.taper", "skelanime.animCurrentSeg": "skelanime.animation", @@ -190,6 +338,9 @@ animdict = { "skelAnime.unk3E": "skelAnime.baseTransl", "actor.yDistToWater" : "actor.depthInWater", "actor.yDistToPlayer" : "actor.playerHeightRel", + + "globalCtx->mf_187FC" : "globalCtx->billboardMtxF", + "globalCtx->projectionMatrix" : "globalCtx->viewProjectionMtxF", } def replace_anim(file): @@ -220,11 +371,25 @@ def replace_anim_all(repo): if(filename.endswith('.c')): file = subdir + os.sep + filename replace_anim(file) + for subdir, dirs, files in os.walk(repo + os.sep + 'asm'): + for filename in files: + if(filename.endswith('.s')): + file = subdir + os.sep + filename + replace_anim(file) + + for subdir, dirs, files in os.walk(repo + os.sep + 'data'): for filename in files: if(filename.endswith('.s')): file = subdir + os.sep + filename replace_anim(file) + + for subdir, dirs, files in os.walk(repo + os.sep + 'docs'): + for filename in files: + if(filename.endswith('.md')): + file = subdir + os.sep + filename + replace_anim(file) + for subdir, dirs, files in os.walk(repo + os.sep + 'tools' + os.sep + 'sizes'): for filename in files: if(filename.endswith('.csv')): diff --git a/tools/asm-differ/.gitrepo b/tools/asm-differ/.gitrepo index d3e4418c9e..241c0ad6b6 100644 --- a/tools/asm-differ/.gitrepo +++ b/tools/asm-differ/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/simonlindholm/asm-differ.git branch = main - commit = f30d43aceba6291aa3c08b7317b0458b6d734321 - parent = e977dfeb374c6de4076ca9a0f44ba5a6a701d849 + commit = 70c33cc125666495f84f8c7bee60d3158b4b1164 + parent = 62341d8db0c29d1d4f0c360196e428309ac373b6 method = merge cmdver = 0.4.3 diff --git a/tools/asm-differ/diff.py b/tools/asm-differ/diff.py index d7ac3f3440..2ec117a126 100755 --- a/tools/asm-differ/diff.py +++ b/tools/asm-differ/diff.py @@ -640,6 +640,7 @@ class Text: class TableMetadata: headers: Tuple[Text, ...] current_score: int + max_score: int previous_score: Optional[int] @@ -832,6 +833,7 @@ class JsonFormatter(Formatter): for h, name in zip(meta.headers, ("base", "current", "previous")) } output["current_score"] = meta.current_score + output["max_score"] = meta.max_score if meta.previous_score is not None: output["previous_score"] = meta.previous_score output_rows: List[Dict[str, Any]] = [] @@ -1184,8 +1186,9 @@ def parse_elf_data_references(data: bytes) -> List[Tuple[int, int, str]]: assert len(symtab_sections) == 1 symtab = sections[symtab_sections[0]] - text_sections = [i for i in range(e_shnum) if sec_names[i] == b".text"] - assert len(text_sections) == 1 + text_sections = [i for i in range(e_shnum) if sec_names[i] == b".text" and sections[i].sh_size != 0] + if len(text_sections) != 1: + return [] text_section = text_sections[0] ret: List[Tuple[int, int, str]] = [] @@ -1327,11 +1330,23 @@ def dump_binary( (objdump_flags + flags2, project.myimg, None), ) +DATA_POOL_PLACEHOLDER = "DATA_POOL_PLACEHOLDER-OFFSET_{}" +DATA_POOL_PLACEHOLDER_PATTERN = re.compile( + r"DATA_POOL_PLACEHOLDER-OFFSET_([a-zA-z0-9]+)" +) -class DifferenceNormalizer: +# Example: "ldr r4, [pc, #56] ; (4c )" +ARM32_LOAD_POOL_PATTERN = r"(ldr\s+r([0-9]|1[0-3]),\s+\[pc,.*;\s*)(\([a-fA-F0-9]+.*\))" + + +# The base class is a no-op. +class AsmProcessor: def __init__(self, config: Config) -> None: self.config = config + def process_reloc(self, row: str, prev: str) -> str: + return prev + def normalize(self, mnemonic: str, row: str) -> str: """This should be called exactly once for each line.""" arch = self.config.arch @@ -1342,9 +1357,143 @@ class DifferenceNormalizer: def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: return row + + def post_process(self, lines: List["Line"]) -> None: + return -class DifferenceNormalizerAArch64(DifferenceNormalizer): +class AsmProcessorMIPS(AsmProcessor): + def process_reloc(self, row: str, prev: str) -> str: + arch = self.config.arch + if "R_MIPS_NONE" in row: + # GNU as emits no-op relocations immediately after real ones when + # assembling with -mabi=64. Return without trying to parse 'imm' as an + # integer. + return prev + before, imm, after = parse_relocated_line(prev) + repl = row.split()[-1] + if imm != "0": + # MIPS uses relocations with addends embedded in the code as immediates. + # If there is an immediate, show it as part of the relocation. Ideally + # we'd show this addend in both %lo/%hi, but annoyingly objdump's output + # doesn't include enough information to pair up %lo's and %hi's... + # TODO: handle unambiguous cases where all addends for a symbol are the + # same, or show "+???". + mnemonic = prev.split()[0] + if ( + mnemonic in arch.instructions_with_address_immediates + and not imm.startswith("0x") + ): + imm = "0x" + imm + repl += "+" + imm if int(imm, 0) > 0 else imm + if "R_MIPS_LO16" in row: + repl = f"%lo({repl})" + elif "R_MIPS_HI16" in row: + # Ideally we'd pair up R_MIPS_LO16 and R_MIPS_HI16 to generate a + # correct addend for each, but objdump doesn't give us the order of + # the relocations, so we can't find the right LO16. :( + repl = f"%hi({repl})" + elif "R_MIPS_26" in row: + # Function calls + pass + elif "R_MIPS_PC16" in row: + # Branch to glabel. This gives confusing output, but there's not much + # we can do here. + pass + else: + assert False, f"unknown relocation type '{row}' for line '{prev}'" + return before + repl + after + + +class AsmProcessorPPC(AsmProcessor): + def process_reloc(self, row: str, prev: str) -> str: + arch = self.config.arch + assert any( + r in row for r in ["R_PPC_REL24", "R_PPC_ADDR16", "R_PPC_EMB_SDA21"] + ), f"unknown relocation type '{row}' for line '{prev}'" + before, imm, after = parse_relocated_line(prev) + repl = row.split()[-1] + if "R_PPC_REL24" in row: + # function calls + pass + elif "R_PPC_ADDR16_HI" in row: + # absolute hi of addr + repl = f"{repl}@h" + elif "R_PPC_ADDR16_HA" in row: + # adjusted hi of addr + repl = f"{repl}@ha" + elif "R_PPC_ADDR16_LO" in row: + # lo of addr + repl = f"{repl}@l" + elif "R_PPC_ADDR16" in row: + # 16-bit absolute addr + if "+0x7" in repl: + # remove the very large addends as they are an artifact of (label-_SDA(2)_BASE_) + # computations and are unimportant in a diff setting. + if int(repl.split("+")[1], 16) > 0x70000000: + repl = repl.split("+")[0] + elif "R_PPC_EMB_SDA21" in row: + # small data area + pass + return before + repl + after + + +class AsmProcessorARM32(AsmProcessor): + def process_reloc(self, row: str, prev: str) -> str: + arch = self.config.arch + before, imm, after = parse_relocated_line(prev) + repl = row.split()[-1] + return before + repl + after + + def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: + if self.config.ignore_addr_diffs: + row = self._normalize_bl(mnemonic, row) + row = self._normalize_data_pool(row) + return row + + def _normalize_bl(self, mnemonic: str, row: str) -> str: + if mnemonic != "bl": + return row + + row, _ = split_off_address(row) + return row + "" + + def _normalize_data_pool(self, row: str) -> str: + pool_match = re.search(ARM32_LOAD_POOL_PATTERN, row) + if pool_match: + offset = pool_match.group(3).split(" ")[0][1:] + repl = DATA_POOL_PLACEHOLDER.format(offset) + return pool_match.group(1) + repl + return row + + def post_process(self, lines: List["Line"]) -> None: + lines_by_line_number = {} + for line in lines: + lines_by_line_number[line.line_num] = line + for line in lines: + reloc_match = re.search( + DATA_POOL_PLACEHOLDER_PATTERN, line.normalized_original + ) + if reloc_match is None: + continue + + # Get value at relocation + reloc = reloc_match.group(0) + line_number = re.search( + DATA_POOL_PLACEHOLDER_PATTERN, reloc).group(1) + line_original = lines_by_line_number[int(line_number, 16)].original + value = line_original.split()[1] + + # Replace relocation placeholder with value + replaced = re.sub( + DATA_POOL_PLACEHOLDER_PATTERN, + f"={value} ({line_number})", + line.normalized_original, + ) + line.original = replaced + + +class AsmProcessorAArch64(AsmProcessor): def __init__(self, config: Config) -> None: super().__init__(config) self._adrp_pair_registers: Set[str] = set() @@ -1394,23 +1543,6 @@ class DifferenceNormalizerAArch64(DifferenceNormalizer): return row -class DifferenceNormalizerARM32(DifferenceNormalizer): - def __init__(self, config: Config) -> None: - super().__init__(config) - - def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: - if self.config.ignore_addr_diffs: - row = self._normalize_bl(mnemonic, row) - return row - - def _normalize_bl(self, mnemonic: str, row: str) -> str: - if mnemonic != "bl": - return row - - row, _ = split_off_address(row) - return row + "" - - @dataclass class ArchSettings: name: str @@ -1420,14 +1552,15 @@ class ArchSettings: re_sprel: Pattern[str] re_large_imm: Pattern[str] re_imm: Pattern[str] + re_reloc: Pattern[str] branch_instructions: Set[str] instructions_with_address_immediates: Set[str] forbidden: Set[str] = field(default_factory=lambda: set(string.ascii_letters + "_")) arch_flags: List[str] = field(default_factory=list) branch_likely_instructions: Set[str] = field(default_factory=set) - difference_normalizer: Type[DifferenceNormalizer] = DifferenceNormalizer + proc: Type[AsmProcessor] = AsmProcessor big_endian: Optional[bool] = True - + delay_slot_instructions: Set[str] = field(default_factory=set) MIPS_BRANCH_LIKELY_INSTRUCTIONS = { "beql", @@ -1543,10 +1676,13 @@ MIPS_SETTINGS = ArchSettings( re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"), re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), re_imm=re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)"), + re_reloc=re.compile(r"R_MIPS_"), arch_flags=["-m", "mips:4300"], branch_likely_instructions=MIPS_BRANCH_LIKELY_INSTRUCTIONS, branch_instructions=MIPS_BRANCH_INSTRUCTIONS, instructions_with_address_immediates=MIPS_BRANCH_INSTRUCTIONS.union({"jal", "j"}), + delay_slot_instructions=MIPS_BRANCH_INSTRUCTIONS.union({"j", "jal", "jr", "jalr"}), + proc=AsmProcessorMIPS, ) MIPSEL_SETTINGS = replace(MIPS_SETTINGS, name="mipsel", big_endian=False) @@ -1566,9 +1702,10 @@ ARM32_SETTINGS = ArchSettings( re_sprel=re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b"), re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), re_imm=re.compile(r"(? Tuple[str, str, str]: return before, imm, after -def process_mips_reloc(row: str, prev: str, arch: ArchSettings) -> str: - if "R_MIPS_NONE" in row: - # GNU as emits no-op relocations immediately after real ones when - # assembling with -mabi=64. Return without trying to parse 'imm' as an - # integer. - return prev - before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - if imm != "0": - # MIPS uses relocations with addends embedded in the code as immediates. - # If there is an immediate, show it as part of the relocation. Ideally - # we'd show this addend in both %lo/%hi, but annoyingly objdump's output - # doesn't include enough information to pair up %lo's and %hi's... - # TODO: handle unambiguous cases where all addends for a symbol are the - # same, or show "+???". - mnemonic = prev.split()[0] - if ( - mnemonic in arch.instructions_with_address_immediates - and not imm.startswith("0x") - ): - imm = "0x" + imm - repl += "+" + imm if int(imm, 0) > 0 else imm - if "R_MIPS_LO16" in row: - repl = f"%lo({repl})" - elif "R_MIPS_HI16" in row: - # Ideally we'd pair up R_MIPS_LO16 and R_MIPS_HI16 to generate a - # correct addend for each, but objdump doesn't give us the order of - # the relocations, so we can't find the right LO16. :( - repl = f"%hi({repl})" - elif "R_MIPS_26" in row: - # Function calls - pass - elif "R_MIPS_PC16" in row: - # Branch to glabel. This gives confusing output, but there's not much - # we can do here. - pass - else: - assert False, f"unknown relocation type '{row}' for line '{prev}'" - return before + repl + after - - -def process_ppc_reloc(row: str, prev: str) -> str: - assert any( - r in row for r in ["R_PPC_REL24", "R_PPC_ADDR16", "R_PPC_EMB_SDA21"] - ), f"unknown relocation type '{row}' for line '{prev}'" - before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - if "R_PPC_REL24" in row: - # function calls - pass - elif "R_PPC_ADDR16_HI" in row: - # absolute hi of addr - repl = f"{repl}@h" - elif "R_PPC_ADDR16_HA" in row: - # adjusted hi of addr - repl = f"{repl}@ha" - elif "R_PPC_ADDR16_LO" in row: - # lo of addr - repl = f"{repl}@l" - elif "R_PPC_ADDR16" in row: - # 16-bit absolute addr - if "+0x7" in repl: - # remove the very large addends as they are an artifact of (label-_SDA(2)_BASE_) - # computations and are unimportant in a diff setting. - if int(repl.split("+")[1], 16) > 0x70000000: - repl = repl.split("+")[0] - elif "R_PPC_EMB_SDA21" in row: - # small data area - pass - return before + repl + after - - -def process_arm_reloc(row: str, prev: str, arch: ArchSettings) -> str: - before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - return before + repl + after - - def pad_mnemonic(line: str) -> str: if "\t" not in line: return line @@ -1741,7 +1803,7 @@ class Line: def process(dump: str, config: Config) -> List[Line]: arch = config.arch - normalizer = arch.difference_normalizer(config) + processor = arch.proc(config) skip_next = False source_lines = [] source_filename = None @@ -1783,7 +1845,7 @@ def process(dump: str, config: Config) -> List[Line]: ) break - if not re.match(r"^ +[0-9a-f]+:\t", row): + if not re.match(r"^\s+[0-9a-f]+:\s+", row): # This regex is conservative, and assumes the file path does not contain "weird" # characters like colons, tabs, or angle brackets. if re.match( @@ -1797,10 +1859,11 @@ def process(dump: str, config: Config) -> List[Line]: m_comment = re.search(arch.re_comment, row) comment = m_comment[0] if m_comment else None row = re.sub(arch.re_comment, "", row) + line_num_str = row.split(":")[0] row = row.rstrip() tabs = row.split("\t") row = "\t".join(tabs[2:]) - line_num = eval_line_num(tabs[0].strip()) + line_num = eval_line_num(line_num_str.strip()) if line_num in data_refs: refs = data_refs[line_num] @@ -1835,20 +1898,13 @@ def process(dump: str, config: Config) -> List[Line]: while i < len(lines): reloc_row = lines[i] - if "R_AARCH64_" in reloc_row: - # TODO: handle relocation - pass - elif "R_MIPS_" in reloc_row: - original = process_mips_reloc(reloc_row, original, arch) - elif "R_PPC_" in reloc_row: - original = process_ppc_reloc(reloc_row, original) - elif "R_ARM_" in reloc_row: - original = process_arm_reloc(reloc_row, original, arch) + if re.search(arch.re_reloc, reloc_row): + original = processor.process_reloc(reloc_row, original) else: break i += 1 - normalized_original = normalizer.normalize(mnemonic, original) + normalized_original = processor.normalize(mnemonic, original) scorable_line = normalized_original if not config.score_stack_differences: @@ -1904,6 +1960,7 @@ def process(dump: str, config: Config) -> List[Line]: elif stop_after_delay_slot: break + processor.post_process(output) return output @@ -2123,8 +2180,15 @@ class OutputLine: class Diff: lines: List[OutputLine] score: int + max_score: int +def trim_nops(lines: List[Line], arch: ArchSettings) -> List[Line]: + lines = lines[:] + while lines and lines[-1].mnemonic == "nop" and (len(lines) == 1 or lines[-2].mnemonic not in arch.delay_slot_instructions): + lines.pop() + return lines + def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: if config.show_source: import cxxfilt @@ -2152,8 +2216,12 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: btset.add(bt) sc(str(bt)) + lines1 = trim_nops(lines1, arch) + lines2 = trim_nops(lines2, arch) + diffed_lines = diff_lines(lines1, lines2, config.algorithm) score = score_diff_lines(diffed_lines, config) + max_score = len(lines1) * config.penalty_deletion line_num_base = -1 line_num_offset = 0 @@ -2385,7 +2453,7 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: ) output = output[config.skip_lines :] - return Diff(lines=output, score=score) + return Diff(lines=output, score=score, max_score=max_score) def chunk_diff_lines( @@ -2461,6 +2529,7 @@ def align_diffs( Text(f"{padding}PREVIOUS ({old_diff.score})"), ), current_score=new_diff.score, + max_score=new_diff.max_score, previous_score=old_diff.score, ) old_chunks = chunk_diff_lines(old_diff.lines) @@ -2504,6 +2573,7 @@ def align_diffs( Text(f"{padding}CURRENT ({new_diff.score})"), ), current_score=new_diff.score, + max_score=new_diff.max_score, previous_score=None, ) diff_lines = [(line, line) for line in new_diff.lines] diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 86f3f7f74f..52d498397e 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -380,7 +380,7 @@ 0x800EFE60 : "z_eff_footmark", 0x800F0390 : "code_800F0390", 0x800F05C0 : "z_elf_message", - 0x800F07C0 : "code_800F07C0", + 0x800F07C0 : "z_en_hy", 0x800F1250 : "z_face_reaction", 0x800F12D0 : "z_env_flags", 0x800F1460 : "z_eventmgr", @@ -556,8 +556,7 @@ 0x801C5D10 : "z_sub_s", 0x801C5DD0 : "z_vimode", 0x801C5E30 : "z_vr_box", - 0x801C5FC0 : "z_vr_box_draw", - 0x801C67B0 : "z_sram_NES", + 0x801C5FC0 : "z_sram_NES", 0x801D0470 : "z_message_nes", 0x801D0B50 : "", 0x801D0B70 : "z_kaleido_manager", @@ -576,6 +575,7 @@ 0x801D15B0 : "", 0x801D15D0 : "sys_math_atan", 0x801D1DE0 : "sys_matrix", + 0x801D1E60 : "sys_ucode", 0x801D1E70 : "", 0x801D2E80 : "audio_data", 0x801D5FB0 : "audio_synthesis", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 84a1d22859..eb59c8aa87 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1616,21 +1616,21 @@ 0x800F0568:("Audio_PlaySoundAtPosition",), 0x800F0590:("func_800F0590",), 0x800F05C0:("ElfMessage_GetFirstCycleHint",), - 0x800F07C0:("func_800F07C0",), - 0x800F0888:("func_800F0888",), - 0x800F0944:("func_800F0944",), - 0x800F09B4:("func_800F09B4",), - 0x800F0A20:("func_800F0A20",), - 0x800F0A94:("func_800F0A94",), + 0x800F07C0:("EnHy_ChangeAnim",), + 0x800F0888:("EnHy_FindNearestDoor",), + 0x800F0944:("EnHy_ChangeObjectAndAnim",), + 0x800F09B4:("EnHy_UpdateSkelAnime",), + 0x800F0A20:("EnHy_Blink",), + 0x800F0A94:("EnHy_Init",), 0x800F0BB4:("func_800F0BB4",), 0x800F0CE4:("func_800F0CE4",), 0x800F0DD4:("func_800F0DD4",), - 0x800F0E94:("func_800F0E94",), - 0x800F0EEC:("func_800F0EEC",), - 0x800F0F28:("func_800F0F28",), - 0x800F0FF0:("func_800F0FF0",), - 0x800F10AC:("func_800F10AC",), - 0x800F112C:("func_800F112C",), + 0x800F0E94:("EnHy_SetPointFowards",), + 0x800F0EEC:("EnHy_SetPointBackwards",), + 0x800F0F28:("EnHy_MoveForwards",), + 0x800F0FF0:("EnHy_MoveBackwards",), + 0x800F10AC:("EnHy_UpdateCollider",), + 0x800F112C:("EnHy_PlayWalkingSound",), 0x800F1250:("Text_GetFaceReaction",), 0x800F12D0:("EnvFlags_UnsetAll",), 0x800F1304:("EnvFlags_Set",), @@ -2170,8 +2170,8 @@ 0x801224E0:("Path_GetByIndex",), 0x80122524:("Path_OrientAndGetDistSq",), 0x801225CC:("Path_CopyLastPoint",), - 0x80122660:("func_80122660",), - 0x80122670:("func_80122670",), + 0x80122660:("FrameAdvance_Init",), + 0x80122670:("FrameAdvance_Update",), 0x801226E0:("func_801226E0",), 0x80122744:("func_80122744",), 0x80122760:("func_80122760",), @@ -2783,10 +2783,10 @@ 0x801431E8:("func_801431E8",), 0x80143324:("func_80143324",), 0x801434E4:("func_801434E4",), - 0x801435A0:("func_801435A0",), - 0x80143624:("func_80143624",), - 0x80143668:("func_80143668",), - 0x80143A04:("func_80143A04",), + 0x801435A0:("SkyboxDraw_UpdateMatrix",), + 0x80143624:("SkyboxDraw_SetColors",), + 0x80143668:("SkyboxDraw_Draw",), + 0x80143A04:("SkyboxDraw_Noop",), 0x80143A10:("func_80143A10",), 0x80143A54:("func_80143A54",), 0x80143AC4:("func_80143AC4",), @@ -2995,7 +2995,7 @@ 0x80167814:("func_80167814",), 0x80167DE4:("func_80167DE4",), 0x80167F0C:("func_80167F0C",), - 0x80168090:("func_80168090",), + 0x80168090:("Play_Draw",), 0x80168DAC:("func_80168DAC",), 0x80168F64:("Play_Update",), 0x801690CC:("func_801690CC",), @@ -7631,10 +7631,10 @@ 0x80951748:("EnGm_Draw",), 0x80952620:("EnMs_Init",), 0x80952708:("EnMs_Destroy",), - 0x80952734:("func_80952734",), - 0x809527F8:("func_809527F8",), - 0x809529AC:("func_809529AC",), - 0x80952A1C:("func_80952A1C",), + 0x80952734:("EnMs_Wait",), + 0x809527F8:("EnMs_Talk",), + 0x809529AC:("EnMs_Sell",), + 0x80952A1C:("EnMs_TalkAfterPurchase",), 0x80952A8C:("EnMs_Update",), 0x80952B24:("EnMs_Draw",), 0x80952C50:("func_80952C50",), @@ -11247,8 +11247,8 @@ 0x80A88334:("EnTru_Init",), 0x80A884BC:("EnTru_Destroy",), 0x80A884E8:("EnTru_Update",), - 0x80A885B8:("func_80A885B8",), - 0x80A88698:("func_80A88698",), + 0x80A885B8:("EnTru_OverrideLimbDraw",), + 0x80A88698:("EnTru_PostLimbDraw",), 0x80A886D4:("func_80A886D4",), 0x80A887E4:("EnTru_Draw",), 0x80A8B770:("EnTrt_ChangeAnim",), @@ -11336,7 +11336,7 @@ 0x80A903B0:("EnTest5_SetupAction",), 0x80A903BC:("EnTest5_Init",), 0x80A90468:("EnTest5_Destroy",), - 0x80A90478:("func_80A90478",), + 0x80A90478:("EnTest5_HandleBottleAction",), 0x80A905A4:("EnTest5_Update",), 0x80A90730:("func_80A90730",), 0x80A90C08:("func_80A90C08",), @@ -14941,11 +14941,11 @@ 0x80B99798:("EnZot_Draw",), 0x80B9A0B0:("ObjTree_Init",), 0x80B9A1BC:("ObjTree_Destroy",), - 0x80B9A20C:("func_80B9A20C",), - 0x80B9A220:("func_80B9A220",), - 0x80B9A230:("func_80B9A230",), - 0x80B9A27C:("func_80B9A27C",), - 0x80B9A348:("func_80B9A348",), + 0x80B9A20C:("ObTree_SetupDoNothing",), + 0x80B9A220:("ObTree_DoNothing",), + 0x80B9A230:("ObTree_SetupSway",), + 0x80B9A27C:("ObTree_Sway",), + 0x80B9A348:("ObTree_UpdateCollision",), 0x80B9A3E8:("ObjTree_Update",), 0x80B9A424:("ObjTree_Draw",), 0x80B9A650:("ObjY2lift_Init",), @@ -15360,17 +15360,17 @@ 0x80BB7800:("EnTanron2_Update",), 0x80BB7B90:("func_80BB7B90",), 0x80BB7C14:("EnTanron2_Draw",), - 0x80BB85A0:("func_80BB85A0",), + 0x80BB85A0:("EnTanron3_CreateEffect",), 0x80BB86BC:("EnTanron3_Init",), 0x80BB87B0:("EnTanron3_Destroy",), - 0x80BB87D4:("func_80BB87D4",), - 0x80BB897C:("func_80BB897C",), - 0x80BB8A48:("func_80BB8A48",), - 0x80BB91D4:("func_80BB91D4",), - 0x80BB9288:("func_80BB9288",), - 0x80BB9308:("func_80BB9308",), + 0x80BB87D4:("EnTanron3_SpawnBubbles",), + 0x80BB897C:("EnTanron3_SetupLive",), + 0x80BB8A48:("EnTanron3_Live",), + 0x80BB91D4:("EnTanron3_SetupDie",), + 0x80BB9288:("EnTanron3_Die",), + 0x80BB9308:("EnTanron3_CheckCollisions",), 0x80BB93EC:("EnTanron3_Update",), - 0x80BB95FC:("func_80BB95FC",), + 0x80BB95FC:("EnTanron3_OverrideLimbDraw",), 0x80BB9670:("EnTanron3_Draw",), 0x80BB98E0:("ObjChan_Init",), 0x80BB99F0:("ObjChan_Destroy",), @@ -16738,14 +16738,14 @@ 0x80C0F758:("func_80C0F758",), 0x80C0FFD0:("EnRecepgirl_Init",), 0x80C100CC:("EnRecepgirl_Destroy",), - 0x80C100DC:("func_80C100DC",), - 0x80C10148:("func_80C10148",), - 0x80C1019C:("func_80C1019C",), - 0x80C10290:("func_80C10290",), - 0x80C102D4:("func_80C102D4",), + 0x80C100DC:("EnRecepgirl_UpdateEyes",), + 0x80C10148:("EnRecepgirl_SetupWait",), + 0x80C1019C:("EnRecepgirl_Wait",), + 0x80C10290:("EnRecepgirl_SetupTalk",), + 0x80C102D4:("EnRecepgirl_Talk",), 0x80C104E8:("EnRecepgirl_Update",), - 0x80C10558:("func_80C10558",), - 0x80C10590:("func_80C10590",), + 0x80C10558:("EnRecepgirl_OverrideLimbDraw",), + 0x80C10590:("EnRecepgirl_UnkLimbDraw",), 0x80C105EC:("EnRecepgirl_Draw",), 0x80C10770:("EnThiefbird_Init",), 0x80C10958:("EnThiefbird_Destroy",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 870579debc..8e75b9cbd4 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -10,7 +10,7 @@ 0x8000031C:("osAppNmiBuffer","s32","[0x10]",0x40), 0x80000500:("gFramebuffer1","u16","[SCREEN_HEIGHT][SCREEN_WIDTH]",0x25800), 0x80025D00:("D_80025D00","u8","[]",0x1), # TODO size - 0x800969C0:("D_800969C0","UNK_TYPE1","",0x1), + 0x800969C0:("rspbootTextStart","u64","[]",0x160), 0x80096B20:("D_80096B20","u8","",0x1), 0x80096B24:("gViConfigUseDefault","vu8","",0x1), 0x80096B28:("gViConfigAdditionalScanLines","u8","",0x1), @@ -923,7 +923,7 @@ 0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1), 0x801BC3F0:("D_801BC3F0","UNK_TYPE1","",0x1), 0x801BC400:("D_801BC400","UNK_TYPE1","",0x1), - 0x801BC410:("D_801BC410","UNK_TYPE1","",0x1), + 0x801BC410:("D_801BC410","s32",[],0x10), 0x801BC420:("sReactionTextIds","u16","[]",0x140A), 0x801BD830:("actorCutscenesGlobalCutscenes","ActorCutscene","[8]",0x80), 0x801BD8B0:("actorCutsceneCurrent","s16","",0x2), @@ -2250,8 +2250,8 @@ 0x801D15D0:("sATan2Tbl","s16","[1025]",0x802), 0x801D1DE0:("D_801D1DE0","Mtx","",0x40), 0x801D1E20:("D_801D1E20","MtxF","",0x40), - 0x801D1E60:("D_801D1E60","UNK_PTR","",0x4), - 0x801D1E64:("D_801D1E64","UNK_PTR","",0x4), + 0x801D1E60:("initialgspUcodeText","UNK_PTR","",0x4), + 0x801D1E64:("initialgspUcodeData","UNK_PTR","",0x4), 0x801D1E70:("D_801D1E70","UNK_TYPE1","",0x1), 0x801D2E80:("D_801D2E80","UNK_TYPE1","",0x1), 0x801D2F80:("D_801D2F80","UNK_TYPE1","",0x1), @@ -3691,7 +3691,7 @@ 0x801E0148:("D_801E0148","f32","",0x4), 0x801E014C:("D_801E014C","f32","",0x4), 0x801E0150:("Math3D_UnitNormalVector_min_length","f32","",0x4), - 0x801E0154:("Math3D_NormalizedDistanceFromPlane_min_length","f32","",0x4), + 0x801E0154:("Math3D_UDistPlaneToPos_min_length","f32","",0x4), 0x801E0158:("D_801E0158","f32","",0x4), 0x801E015C:("D_801E015C","f32","",0x4), 0x801E0160:("D_801E0160","f32","",0x4), @@ -3873,11 +3873,8 @@ 0x801E1070:("jtbl_801E1070","UNK_PTR","",0x4), 0x801E10B0:("jtbl_801E10B0","UNK_PTR","",0x4), 0x801E10C4:("jtbl_801E10C4","UNK_PTR","",0x4), - 0x801E1100:("D_801E1100","UNK_TYPE2","",0x2), - 0x801E1102:("D_801E1102","UNK_TYPE2","",0x2), - 0x801E1104:("D_801E1104","UNK_TYPE4","",0x4), - 0x801E1108:("D_801E1108","UNK_TYPE4","",0x4), - 0x801E110C:("D_801E110C","UNK_TYPE4","",0x4), + 0x801E1100:("gAudioTatumInit","s16","[2]",0x4), + 0x801E1104:("gAudioContextInitSizes","AudioContextInitSizes","",0xC), 0x801E1110:("sGameOverTimer","UNK_TYPE2","",0x2), 0x801E1120:("jtbl_801E1120","UNK_PTR","",0x4), 0x801E1180:("D_801E1180","UNK_TYPE2","",0x2), @@ -3885,8 +3882,8 @@ 0x801E1630:("D_801E1630","UNK_TYPE2","",0x2), 0x801E1E40:("D_801E1E40","UNK_TYPE1","",0x1), 0x801E1E80:("D_801E1E80","UNK_TYPE1","",0x1), - 0x801E2160:("D_801E2160","UNK_TYPE1","",0x1), - 0x801E3790:("D_801E3790","UNK_TYPE1","",0x1), + 0x801E2160:("gspF3DEX2_NoN_fifoTextStart","UNK_TYPE1","",0x1), + 0x801E3790:("gspF3DEX2_NoN_fifoDataStart","UNK_TYPE1","",0x1), 0x801E3BB0:("D_801E3BB0","UNK_TYPE1","",0x1), 0x801E3F40:("gJpegUCodeData","UNK_TYPE1","",0x1), 0x801E3FA0:("D_801E3FA0","UNK_TYPE1","",0x1), @@ -4094,7 +4091,7 @@ 0x801F6AD4:("D_801F6AD4","UNK_TYPE1","",0x1), 0x801F6AD5:("D_801F6AD5","UNK_TYPE1","",0x1), 0x801F6ADA:("D_801F6ADA","UNK_TYPE1","",0x1), - 0x801F6AE0:("D_801F6AE0","UNK_TYPE1","",0x1), + 0x801F6AE0:("sSkyboxDrawMatrix","Mtx*","",0x4), 0x801F6AF0:("D_801F6AF0","UNK_TYPE1","",0x1), 0x801F6AF2:("D_801F6AF2","UNK_TYPE1","",0x1), 0x801F6B00:("D_801F6B00","UNK_TYPE4","",0x4), @@ -4228,8 +4225,8 @@ 0x801FBC46:("D_801FBC46","UNK_TYPE1","",0x1), 0x801FBC48:("D_801FBC48","UNK_TYPE1","",0x1), 0x801FBC58:("D_801FBC58","UNK_TYPE1","",0x1), - 0x801FBC68:("Math3D_NormalVector_temp1","Vec3f","",0xc), - 0x801FBC78:("Math3D_NormalVector_temp2","Vec3f","",0xc), + 0x801FBC68:("Math3D_SurfaceNorm_temp1","Vec3f","",0xc), + 0x801FBC78:("Math3D_SurfaceNorm_temp2","Vec3f","",0xc), 0x801FBC8C:("D_801FBC8C","f32","",0x4), 0x801FBC90:("D_801FBC90","f32","",0x4), 0x801FBC98:("D_801FBC98","f32","",0x4), @@ -12596,8 +12593,7 @@ 0x80A8A188:("D_80A8A188","UNK_TYPE1","",0x1), 0x80A8B188:("D_80A8B188","UNK_TYPE1","",0x1), 0x80A8B250:("D_80A8B250","UNK_TYPE4","",0x4), - 0x80A8B25C:("D_80A8B25C","UNK_TYPE1","",0x1), - 0x80A8B268:("D_80A8B268","UNK_TYPE1","",0x1), + 0x80A8B25C:("D_80A8B25C","Color_RGBA8","[6]",0x18), 0x80A8B280:("D_80A8B280","UNK_TYPE1","",0x1), 0x80A8B2A0:("D_80A8B2A0","UNK_TYPE1","",0x1), 0x80A8B2CC:("D_80A8B2CC","UNK_TYPE1","",0x1), diff --git a/tools/filelists/mm.us.rev1/all.csv b/tools/filelists/mm.us.rev1/all.csv index b722e4938d..836f6d1722 100644 --- a/tools/filelists/mm.us.rev1/all.csv +++ b/tools/filelists/mm.us.rev1/all.csv @@ -1537,3 +1537,16 @@ 1536,KAKUSIANA_room_13 1537,KAKUSIANA_room_14 1538,bump_texture_static +1539,anime_model_1_static +1540,anime_model_2_static +1541,anime_model_3_static +1542,anime_model_4_static +1543,anime_model_5_static +1544,anime_model_6_static +1545,anime_texture_1_static +1546,anime_texture_2_static +1547,anime_texture_3_static +1548,anime_texture_4_static +1549,anime_texture_5_static +1550,anime_texture_6_static +1551,softsprite_matrix_static diff --git a/tools/filelists/mm.us.rev1/archives.csv b/tools/filelists/mm.us.rev1/archives.csv new file mode 100644 index 0000000000..a0b758dfd0 --- /dev/null +++ b/tools/filelists/mm.us.rev1/archives.csv @@ -0,0 +1,7 @@ +15,map_i_static +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 diff --git a/tools/filelists/mm.us.rev1/asm.csv b/tools/filelists/mm.us.rev1/asm.csv index f3364252f0..0bc9311e9c 100644 --- a/tools/filelists/mm.us.rev1/asm.csv +++ b/tools/filelists/mm.us.rev1/asm.csv @@ -2,3 +2,5 @@ 1,boot 2,dmadata 31,code +1135,elf_message_field +1136,elf_message_ydan diff --git a/tools/filelists/mm.us.rev1/deleted.csv b/tools/filelists/mm.us.rev1/deleted.csv new file mode 100644 index 0000000000..12e60f6ee3 --- /dev/null +++ b/tools/filelists/mm.us.rev1/deleted.csv @@ -0,0 +1,3 @@ +8,icon_item_static_old +9,icon_item_24_static_old +21,schedule_dma_static_old diff --git a/tools/filelists/mm.us.rev1/interface.csv b/tools/filelists/mm.us.rev1/interface.csv new file mode 100644 index 0000000000..db78965de0 --- /dev/null +++ b/tools/filelists/mm.us.rev1/interface.csv @@ -0,0 +1,11 @@ +6,kanji +10,icon_item_field_static +11,icon_item_dungeon_static +12,icon_item_gameover_static +13,icon_item_jpn_static +14,icon_item_vtx_static +23,schedule_static +25,do_action_static +26,message_static +27,message_texture_static +28,nes_font_static diff --git a/tools/filelists/mm.us.rev1/misc.csv b/tools/filelists/mm.us.rev1/misc.csv index 60a33ac1b2..caebc3bb1b 100644 --- a/tools/filelists/mm.us.rev1/misc.csv +++ b/tools/filelists/mm.us.rev1/misc.csv @@ -1,6 +1,24 @@ 7,link_animetion +24,story_static +1114,scene_texture_01 +1115,scene_texture_02 +1116,scene_texture_03 +1117,scene_texture_04 +1118,scene_texture_05 +1119,scene_texture_06 +1120,scene_texture_07 +1121,scene_texture_08 1122,nintendo_rogo_static +1123,title_static 1124,memerrmsg 1125,locerrmsg -1135,elf_message_field -1136,elf_message_ydan +1126,parameter_static +1127,week_static +1128,daytelop_static +1129,ger_daytelop_static +1130,fra_daytelop_static +1131,esp_daytelop_static +1132,d2_fine_static +1133,d2_cloud_static +1134,d2_fine_pal_static +1538,bump_texture_static diff --git a/tools/filelists/mm.us.rev1/object.csv b/tools/filelists/mm.us.rev1/objects.csv similarity index 99% rename from tools/filelists/mm.us.rev1/object.csv rename to tools/filelists/mm.us.rev1/objects.csv index 15d1f4ac26..187ec1c11a 100644 --- a/tools/filelists/mm.us.rev1/object.csv +++ b/tools/filelists/mm.us.rev1/objects.csv @@ -1,7 +1,6 @@ 649,gameplay_keep 650,gameplay_field_keep 651,gameplay_dangeon_keep -652,gameplay_object_exchange_static 653,object_link_boy 654,object_link_child 655,object_link_goron diff --git a/tools/filelists/mm.us.rev1/scene.csv b/tools/filelists/mm.us.rev1/scenes.csv similarity index 100% rename from tools/filelists/mm.us.rev1/scene.csv rename to tools/filelists/mm.us.rev1/scenes.csv diff --git a/tools/filelists/mm.us.rev1/segments.csv b/tools/filelists/mm.us.rev1/segments.csv new file mode 100644 index 0000000000..b22534d94e --- /dev/null +++ b/tools/filelists/mm.us.rev1/segments.csv @@ -0,0 +1,14 @@ +652,gameplay_object_exchange_static +1539,anime_model_1_static +1540,anime_model_2_static +1541,anime_model_3_static +1542,anime_model_4_static +1543,anime_model_5_static +1544,anime_model_6_static +1545,anime_texture_1_static +1546,anime_texture_2_static +1547,anime_texture_3_static +1548,anime_texture_4_static +1549,anime_texture_5_static +1550,anime_texture_6_static +1551,softsprite_matrix_static diff --git a/tools/filelists/mm.us.rev1/text.csv b/tools/filelists/mm.us.rev1/text.csv new file mode 100644 index 0000000000..82e09e4dd3 --- /dev/null +++ b/tools/filelists/mm.us.rev1/text.csv @@ -0,0 +1,2 @@ +29,message_data_static +30,staff_message_data_static diff --git a/tools/filelists/mm.us.rev1/texture.csv b/tools/filelists/mm.us.rev1/texture.csv deleted file mode 100644 index 17e4a9cf79..0000000000 --- a/tools/filelists/mm.us.rev1/texture.csv +++ /dev/null @@ -1,43 +0,0 @@ -6,kanji -8,icon_item_static_old -9,icon_item_24_static_old -10,icon_item_field_static -11,icon_item_dungeon_static -12,icon_item_gameover_static -13,icon_item_jpn_static -14,icon_item_vtx_static -15,map_i_static -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 -23,schedule_static -24,story_static -25,do_action_static -26,message_static -27,message_texture_static -28,nes_font_static -29,message_data_static -30,staff_message_data_static -1114,scene_texture_01 -1115,scene_texture_02 -1116,scene_texture_03 -1117,scene_texture_04 -1118,scene_texture_05 -1119,scene_texture_06 -1120,scene_texture_07 -1121,scene_texture_08 -1123,title_static -1126,parameter_static -1127,week_static -1128,daytelop_static -1129,ger_daytelop_static -1130,fra_daytelop_static -1131,esp_daytelop_static -1132,d2_fine_static -1133,d2_cloud_static -1134,d2_fine_pal_static -1538,bump_texture_static diff --git a/tools/progress.py b/tools/progress.py index a5068f792b..dccd743d78 100755 --- a/tools/progress.py +++ b/tools/progress.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import argparse, csv, git, json, os, re +import argparse, csv, git, json, os, re, sys parser = argparse.ArgumentParser() @@ -12,9 +12,18 @@ args = parser.parse_args() NON_MATCHING_PATTERN = r'#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*"(.*?)"\s*\).*?#endif' NOT_ATTEMPTED_PATTERN = r'#pragma\s+GLOBAL_ASM\s*\(\s*"(.*?)"\s*\)' +# This is the format ZAPD uses to autogenerate variable names +# It should not be used for properly documented variables +AUTOGENERATED_ASSET_NAME = re.compile(r".+0[0-9A-Fa-f]{5}") + +ASM_JMP_LABEL = re.compile(r"^(?PL[0-9A-F]{8})$") + # TODO: consider making this a parameter of this script GAME_VERSION = "mm.us.rev1" +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + def GetFunctionsByPattern(pattern, files): functions = [] @@ -46,31 +55,69 @@ def GetCsvFilelist(version, filelist): with open(path, newline='') as f: return list(csv.reader(f, delimiter=',')) -def GetRemovableSize(functions_to_count): +def GetRemovableSize(functionSizes, functions_to_count): size = 0 - for asm_file_path in functions_to_count: - if "//" in asm_file_path: - raise RuntimeError(f"Invalid file path: {asm_file_path}") - file_size = 0 - asm_lines = ReadAllLines(asm_file_path) - shouldCount = True - - for asm_line in asm_lines: - if asm_line[0] == ".": - if asm_line.startswith(".text") or asm_line.startswith(".section .text"): - shouldCount = True - elif ".rdata" in asm_line or ".late_rodata" in asm_line: - shouldCount = False - - if shouldCount: - if (asm_line[0:2] == "/*" and asm_line[28:30] == "*/"): - file_size += 4 - - size += file_size + for func in functions_to_count: + if func in functionSizes: + size += functionSizes[func] return size +def CalculateMapSizes(mapFileList): + for mapFile in mapFileList: + accumulatedSize = 0 + + symbolCount = len(mapFile["symbols"]) + if symbolCount == 0: + continue + + # Calculate size of each symbol + for index in range(symbolCount - 1): + symbol = mapFile["symbols"][index] + nextSymbol = mapFile["symbols"][index+1] + + size = nextSymbol["vram"] - symbol["vram"] + accumulatedSize += size + + mapFile["symbols"][index]["size"] = size + + # Calculate size of last symbol of the file + symbol = mapFile["symbols"][-1] + size = mapFile["size"] - accumulatedSize + mapFile["symbols"][-1]["size"] = size + return mapFileList + +def GetFunctionSizes(mapFileList): + functionSizes = dict() + + for mapFile in mapFileList: + if mapFile["section"] != ".text": + continue + + for symbol in mapFile["symbols"]: + symbolName = symbol["name"] + functionSizes[symbolName] = symbol["size"] + + return functionSizes + +def CalculateNonNamedAssets(mapFileList, assetsTracker): + for mapFile in mapFileList: + if mapFile["section"] != ".data": + continue + if not mapFile["name"].startswith("build/assets/"): + continue + + assetCat = mapFile["name"].split("/")[2] + + for symbol in mapFile["symbols"]: + symbolName = symbol["name"] + if AUTOGENERATED_ASSET_NAME.search(symbolName) is not None: + if assetCat in assetsTracker: + assetsTracker[assetCat]["removableSize"] += symbol["size"] + return assetsTracker + + map_file = ReadAllLines('build/mm.map') # Get list of Non-Matchings @@ -86,91 +133,146 @@ not_attempted_functions = list(set(not_attempted_functions).difference(non_match if not args.matching: non_matching_functions = [] -# Get asset files -audio_files = GetCsvFilelist(GAME_VERSION, "audio.csv") -misc_files = GetCsvFilelist(GAME_VERSION, "misc.csv") -object_files = GetCsvFilelist(GAME_VERSION, "object.csv") -scene_files = GetCsvFilelist(GAME_VERSION, "scene.csv") -texture_files = GetCsvFilelist(GAME_VERSION, "texture.csv") +# 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", + "objects", + "scenes", + "text", + # "deleted", + # "segments", +] +assetsTracker = dict() + +# Manual fixer for files that would be counted in wrong categories +# "filename": "correctSection" +fileSectionFixer = { + "osFlash": "code" # Currently in `src/libultra` (would be counted as boot) +} + +for assetCat in assetsCategories: + assetsTracker[assetCat] = dict() + # Get asset files + assetsTracker[assetCat]["files"] = GetCsvFilelist(GAME_VERSION, f"{assetCat}.csv") + assetsTracker[assetCat]["currentSize"] = 0 + assetsTracker[assetCat]["removableSize"] = 0 + assetsTracker[assetCat]["totalSize"] = 0 + assetsTracker[assetCat]["percent"] = 0 + # Initialize all the code values -src = 0 -src_code = 0 -src_boot = 0 -src_ovl = 0 -src_libultra = 0 -asm = 0 -asm_code = 0 -asm_boot = 0 -asm_ovl = 0 -asm_libultra = 0 -audio = 0 -misc = 0 -object_ = 0 -scene = 0 -texture = 0 +srcCategories = [ + "boot", + "libultra", + "code", + "overlays", +] + +srcCategoriesFixer = { + "boot_O2": "boot", + "boot_O2_g3": "boot", +} + +srcTracker = dict() +asmTracker = dict() + +for srcCat in srcCategories: + srcTracker[srcCat] = dict() + srcTracker[srcCat]["currentSize"] = 0 + srcTracker[srcCat]["totalSize"] = 0 + srcTracker[srcCat]["percent"] = 0 + + asmTracker[srcCat] = dict() + asmTracker[srcCat]["currentSize"] = 0 + asmTracker[srcCat]["totalSize"] = 0 + asmTracker[srcCat]["percent"] = 0 + +mapFileList = [] for line in map_file: line_split = list(filter(None, line.split(" "))) if (len(line_split) == 4 and line_split[0].startswith(".")): section = line_split[0] + obj_vram = int(line_split[1], 16) file_size = int(line_split[2], 16) - obj_file = line_split[3] + obj_file = line_split[3].strip() + objFileSplit = obj_file.split("/") + + fileData = {"name": obj_file, "vram": obj_vram, "size": file_size, "section": section, "symbols": []} + mapFileList.append(fileData) if (section == ".text"): - if (obj_file.startswith("build/src")): - if (obj_file.startswith("build/src/code")): - src_code += file_size - elif (obj_file.startswith("build/src/libultra")): - src_libultra += file_size - elif (obj_file.startswith("build/src/boot")): - src_boot += file_size - elif (obj_file.startswith("build/src/overlays")): - src_ovl += file_size - elif (obj_file.startswith("build/asm")): - if (obj_file.startswith("build/asm/code")): - asm_code += file_size - elif (obj_file.startswith("build/asm/libultra")): - asm_libultra += file_size - elif (obj_file.startswith("build/asm/boot")): - asm_boot += file_size - elif (obj_file.startswith("build/asm/overlays")): - asm_ovl += file_size + objFileName = objFileSplit[-1].split(".o")[0] + srcCat = obj_file.split("/")[2] + if srcCat in srcCategoriesFixer: + srcCat = srcCategoriesFixer[srcCat] + + if objFileName in fileSectionFixer: + correctSection = fileSectionFixer[objFileName] + if correctSection in srcTracker: + srcTracker[correctSection]["totalSize"] += file_size + elif obj_file.startswith("build/src"): + if srcCat in srcTracker: + srcTracker[srcCat]["totalSize"] += file_size + elif (obj_file.startswith("build/asm")): + if srcCat in asmTracker: + asmTracker[srcCat]["totalSize"] += file_size + + if section == ".data": + if obj_file.startswith("build/assets/"): + assetCat = obj_file.split("/")[2] + if assetCat in assetsTracker: + assetsTracker[assetCat]["currentSize"] += file_size + else: + eprint(f"Found file '{obj_file}' in unknown asset category '{assetCat}'") + eprint("I'll ignore this for now, but please fix it!") + + elif len(line_split) == 2 and line_split[0].startswith("0x00000000"): + varVramStr, varName = line_split + varVram = int(varVramStr, 16) + varName = varName.strip() + if varName == "0x0": + continue + if ASM_JMP_LABEL.search(varName) is not None: + # Filter out jump table's labels + continue + symbolData = {"name": varName, "vram": varVram, "size": 0} + mapFileList[-1]["symbols"].append(symbolData) + +mapFileList = CalculateMapSizes(mapFileList) +functionSizes = GetFunctionSizes(mapFileList) + +assetsTracker = CalculateNonNamedAssets(mapFileList, assetsTracker) - if (section == ".data"): - if (obj_file.startswith("build/assets/audio")): - audio += file_size - elif (obj_file.startswith("build/assets/misc")): - misc += file_size - elif (obj_file.startswith("build/assets/objects")): - object_ += file_size - elif (obj_file.startswith("build/assets/scenes")): - scene += file_size - elif (obj_file.startswith("build/assets/textures")): - texture += file_size # Add libultra to boot. -src_boot += src_libultra -asm_boot += asm_libultra +srcTracker["boot"]["totalSize"] += srcTracker["libultra"]["totalSize"] +asmTracker["boot"]["totalSize"] += asmTracker["libultra"]["totalSize"] +del srcTracker["libultra"] +del asmTracker["libultra"] # Calculate Non-Matching -non_matching_functions_ovl = list(filter(lambda x: "/overlays/" in x, non_matching_functions)) -non_matching_functions_code = list(filter(lambda x: "/code/" in x, non_matching_functions)) -non_matching_functions_boot = list(filter(lambda x: "/boot/" in x, non_matching_functions)) +non_matching_functions_ovl = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/overlays/" in x, non_matching_functions))) +non_matching_functions_code = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/code/" in x, non_matching_functions))) +non_matching_functions_boot = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/boot/" in x, non_matching_functions))) -non_matching_asm_ovl = GetRemovableSize(non_matching_functions_ovl) -non_matching_asm_code = GetRemovableSize(non_matching_functions_code) -non_matching_asm_boot = GetRemovableSize(non_matching_functions_boot) +non_matching_asm_ovl = GetRemovableSize(functionSizes, non_matching_functions_ovl) +non_matching_asm_code = GetRemovableSize(functionSizes, non_matching_functions_code) +non_matching_asm_boot = GetRemovableSize(functionSizes, non_matching_functions_boot) # Calculate Not Attempted -not_attempted_functions_ovl = list(filter(lambda x: "/overlays/" in x, not_attempted_functions)) -not_attempted_functions_code = list(filter(lambda x: "/code/" in x, not_attempted_functions)) -not_attempted_functions_boot = list(filter(lambda x: "/boot/" in x, not_attempted_functions)) +not_attempted_functions_ovl = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/overlays/" in x, not_attempted_functions))) +not_attempted_functions_code = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/code/" in x, not_attempted_functions))) +not_attempted_functions_boot = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/boot/" in x, not_attempted_functions))) -not_attempted_asm_ovl = GetRemovableSize(not_attempted_functions_ovl) -not_attempted_asm_code = GetRemovableSize(not_attempted_functions_code) -not_attempted_asm_boot = GetRemovableSize(not_attempted_functions_boot) +not_attempted_asm_ovl = GetRemovableSize(functionSizes, not_attempted_functions_ovl) +not_attempted_asm_code = GetRemovableSize(functionSizes, not_attempted_functions_code) +not_attempted_asm_boot = GetRemovableSize(functionSizes, not_attempted_functions_boot) # All the non matching asm is the sum of non-matching code non_matching_asm = non_matching_asm_ovl + non_matching_asm_code + non_matching_asm_boot @@ -179,60 +281,52 @@ non_matching_asm = non_matching_asm_ovl + non_matching_asm_code + non_matching_a not_attempted_asm = not_attempted_asm_ovl + not_attempted_asm_code + not_attempted_asm_boot # Calculate total decompiled for each bucket by taking out the non-matching and not attempted in ovl/code/boot buckets. -code = src_code - (non_matching_asm_code + not_attempted_asm_code) -boot = src_boot - (non_matching_asm_boot + not_attempted_asm_boot) -ovl = src_ovl - (non_matching_asm_ovl + not_attempted_asm_ovl) +srcTracker["code"]["currentSize"] = srcTracker["code"]["totalSize"] - (non_matching_asm_code + not_attempted_asm_code) +srcTracker["boot"]["currentSize"] = srcTracker["boot"]["totalSize"] - (non_matching_asm_boot + not_attempted_asm_boot) +srcTracker["overlays"]["currentSize"] = srcTracker["overlays"]["totalSize"] - (non_matching_asm_ovl + not_attempted_asm_ovl) # Total code bucket sizes -code_size = src_code + asm_code -boot_size = src_boot + asm_boot -ovl_size = src_ovl + asm_ovl -handwritten = 0 # Currently unsure of any handwritten asm in MM - -# Calculate size of all assets -audio_size = 0 -misc_size = 0 -object_size = 0 -scene_size = 0 -texture_size = 0 -for index, f in audio_files: - audio_size += os.stat(os.path.join("baserom", f)).st_size -for index, f in misc_files: - misc_size += os.stat(os.path.join("baserom", f)).st_size -for index, f in object_files: - object_size += os.stat(os.path.join("baserom", f)).st_size -for index, f in scene_files: - scene_size += os.stat(os.path.join("baserom", f)).st_size -for index, f in texture_files: - texture_size += os.stat(os.path.join("baserom", f)).st_size - -# Calculate asm and src totals -src = src_code + src_boot + src_ovl -asm = asm_code + asm_boot + asm_ovl - -# Take out the non-matchings and not attempted in grand totals -src -= non_matching_asm + not_attempted_asm -asm += non_matching_asm + not_attempted_asm +handwritten = 0 +for srcCat in asmTracker: + handwritten += asmTracker[srcCat]["totalSize"] # Calculate the total amount of decompilable code -total = src + asm +total = 0 +for srcCat in asmTracker: + total += srcTracker[srcCat]["totalSize"] + +# Calculate size of all assets +for assetCat in assetsTracker: + for index, f in assetsTracker[assetCat]["files"]: + assetsTracker[assetCat]["totalSize"] += os.stat(os.path.join("baserom", f)).st_size + +if args.matching: + for assetCat in assetsTracker: + assetsTracker[assetCat]["currentSize"] -= assetsTracker[assetCat]["removableSize"] + +# Calculate asm and src totals +src = 0 +for srcCat in srcTracker: + src += srcTracker[srcCat]["currentSize"] +asm = 0 +for srcCat in asmTracker: + asm += asmTracker[srcCat]["totalSize"] +asm += non_matching_asm + not_attempted_asm # Calculate assets totals -assets = audio + misc + object_ + scene + texture -assets_total = audio_size + misc_size + object_size + scene_size + texture_size +assets = sum(x["currentSize"] for x in assetsTracker.values()) +assets_total = sum(x["totalSize"] for x in assetsTracker.values()) # Convert vaules to percentages src_percent = 100 * src / total asm_percent = 100 * asm / total -code_percent = 100 * code / code_size -boot_percent = 100 * boot / boot_size -ovl_percent = 100 * ovl / ovl_size +for srcCat in ["boot", "code", "overlays"]: + srcTracker[srcCat]["percent"] = 100 * srcTracker[srcCat]["currentSize"] / srcTracker[srcCat]["totalSize"] + assets_percent = 100 * assets / assets_total -audio_percent = 100 * audio / audio_size -misc_percent = 100 * misc / misc_size -object_percent = 100 * object_ / object_size -scene_percent = 100 * scene / scene_size -texture_percent = 100 * texture / texture_size + +for assetCat in assetsTracker: + assetsTracker[assetCat]["percent"] = 100 * assetsTracker[assetCat]["currentSize"] / assetsTracker[assetCat]["totalSize"] # convert bytes to masks and rupees num_masks = 24 @@ -242,47 +336,27 @@ bytes_per_rupee = bytes_per_mask / max_rupees masks = int(src / bytes_per_mask) rupees = int((src % bytes_per_mask) / bytes_per_rupee) -# Debug print statements for the values -#print("Total: ", total) -#print("src: ", src) -#print("asm: ", asm) -#print("") -#print("src_code: ", src_code) -#print("src_boot: ", src_boot) -#print("src_ovl: ", src_ovl) -#print("") -#print("asm_code: ", asm_code) -#print("asm_boot: ", asm_boot) -#print("asm_ovl: ", asm_ovl) -#print("") -#print("Nonmatching code: ", non_matching_asm_code) -#print("Nonmatching boot: ", non_matching_asm_boot) -#print("Nonmatching ovl: ", non_matching_asm_ovl) -#print("") -#print("Not attempted code: ", not_attempted_asm_code) -#print("Not attempted boot: ", not_attempted_asm_boot) -#print("Not attempted ovl: ", not_attempted_asm_ovl) -#print("") -#print("code_size: ", code_size) -#print("boot_size: ", boot_size) -#print("ovl_size: ", ovl_size) -#print("") -#print("code: ", code) -#print("boot: ", boot) -#print("ovl: ", ovl) -#print("") - if args.format == 'csv': - version = 1 + version = 2 git_object = git.Repo().head.object timestamp = str(git_object.committed_date) git_hash = git_object.hexsha - csv_list = [str(version), timestamp, git_hash, str(code), str(code_size), str(boot), str(boot_size), - str(ovl), str(ovl_size), str(src), str(asm), str(len(non_matching_functions)), - str(audio), str(audio_size), str(misc), str(misc_size), str(object_), str(object_size), - str(scene), str(scene_size), str(texture), str(texture_size)] + csv_list = [ + version, timestamp, git_hash, src, total, + ] + for srcCat in ["boot", "code", "overlays"]: + csv_list += [srcTracker[srcCat]["currentSize"], srcTracker[srcCat]["totalSize"]] - print(",".join(csv_list)) + csv_list += [ + asm, len(non_matching_functions), + ] + csv_list += [ + assets, assets_total, + ] + for assetCat in assetsCategories: + csv_list += [assetsTracker[assetCat]["currentSize"], assetsTracker[assetCat]["totalSize"]] + + print(",".join(map(str, csv_list))) elif args.format == 'shield-json': # https://shields.io/endpoint print(json.dumps({ @@ -293,18 +367,20 @@ elif args.format == 'shield-json': })) elif args.format == 'text': adjective = "decompiled" if not args.matching else "matched" + assetsAdjective = "debinarized" if not args.matching else "identified" - print("src: {:>9} / {:>8} total bytes {:<13} {:>9.4f}%".format(src, total, adjective, round(src_percent, 4))) - print(" boot: {:>9} / {:>8} bytes {:<13} {:>9.4f}%".format(boot, boot_size, adjective, round(boot_percent, 4))) - print(" code: {:>9} / {:>8} bytes {:<13} {:>9.4f}%".format(code, code_size, adjective, round(code_percent, 4))) - print(" overlays: {:>9} / {:>8} bytes {:<13} {:>9.4f}%".format(ovl, ovl_size, adjective, round(ovl_percent, 4))) + print("src: {:>9} / {:>8} total bytes {:<13} {:>9.4f}%".format(src, total, adjective, round(src_percent, 4))) + + for srcCat in ["boot", "code", "overlays"]: + src = srcTracker[srcCat] + print(" {:<10} {:>9} / {:>8} bytes {:<13} {:>9.4f}%".format(f"{srcCat}:", src["currentSize"], src["totalSize"], adjective, round(src["percent"], 4))) print() - print("assets: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(assets, assets_total, round(assets_percent, 4))) - print(" audio: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(audio, audio_size, round(audio_percent, 4))) - print(" misc: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(misc, misc_size, round(misc_percent, 4))) - print(" objects: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(object_, object_size, round(object_percent, 4))) - print(" scenes: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(scene, scene_size, round(scene_percent, 4))) - print(" textures: {:>9} / {:>8} bytes reconstructed {:>9.4f}%".format(texture, texture_size, round(texture_percent, 4))) + + print("assets: {:>9} / {:>8} total bytes {:<13} {:>9.4f}%".format(assets, assets_total, assetsAdjective, round(assets_percent, 4))) + for assetCat in assetsTracker: + data = assetsTracker[assetCat] + print(" {:<10} {:>9} / {:>8} bytes {:<13} {:>9.4f}%".format(f"{assetCat}:", data["currentSize"], data["totalSize"], assetsAdjective, round(data["percent"], 4))) + print() print("------------------------------------\n") diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index fba05738ec..8a0090f845 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -413,33 +413,33 @@ asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_FaultPrint.s,ActorOverl asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_FaultAddrConv.s,ActorOverlayTable_FaultAddrConv,0x800BFA78,0x1C asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_Init.s,ActorOverlayTable_Init,0x800BFAE8,0x16 asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_Cleanup.s,ActorOverlayTable_Cleanup,0x800BFB40,0x10 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListNodeInit.s,BgCheck_PolygonLinkedListNodeInit,0x800BFB80,0x7 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListResetHead.s,BgCheck_PolygonLinkedListResetHead,0x800BFB9C,0x4 -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsNodeInsert.s,BgCheck_ScenePolygonListsNodeInsert,0x800BFBAC,0x16 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListNodeInsert.s,BgCheck_PolygonLinkedListNodeInsert,0x800BFC04,0x16 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListInit.s,BgCheck_PolygonLinkedListInit,0x800BFC5C,0x5 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListAlloc.s,BgCheck_PolygonLinkedListAlloc,0x800BFC70,0x14 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonLinkedListReset.s,BgCheck_PolygonLinkedListReset,0x800BFCC0,0x3 -asm/non_matchings/code/z_bgcheck/BgCheck_AllocPolygonLinkedListNode.s,BgCheck_AllocPolygonLinkedListNode,0x800BFCCC,0xC -asm/non_matchings/code/z_bgcheck/BgCheck_CreateVec3fFromVertex.s,BgCheck_CreateVec3fFromVertex,0x800BFCFC,0x11 -asm/non_matchings/code/z_bgcheck/BgCheck_CreateVertexFromVec3f.s,BgCheck_CreateVertexFromVec3f,0x800BFD40,0x11 +asm/non_matchings/code/z_bgcheck/SSNode_SetValue.s,SSNode_SetValue,0x800BFB80,0x7 +asm/non_matchings/code/z_bgcheck/SSList_SetNull.s,SSList_SetNull,0x800BFB9C,0x4 +asm/non_matchings/code/z_bgcheck/SSNodeList_SetSSListHead.s,SSNodeList_SetSSListHead,0x800BFBAC,0x16 +asm/non_matchings/code/z_bgcheck/DynaSSNodeList_SetSSListHead.s,DynaSSNodeList_SetSSListHead,0x800BFC04,0x16 +asm/non_matchings/code/z_bgcheck/DynaSSNodeList_Init.s,DynaSSNodeList_Init,0x800BFC5C,0x5 +asm/non_matchings/code/z_bgcheck/DynaSSNodeList_Alloc.s,DynaSSNodeList_Alloc,0x800BFC70,0x14 +asm/non_matchings/code/z_bgcheck/DynaSSNodeList_ResetCount.s,DynaSSNodeList_ResetCount,0x800BFCC0,0x3 +asm/non_matchings/code/z_bgcheck/DynaSSNodeList_GetNextNodeIdx.s,DynaSSNodeList_GetNextNodeIdx,0x800BFCCC,0xC +asm/non_matchings/code/z_bgcheck/BgCheck_Vec3sToVec3f.s,BgCheck_Vec3sToVec3f,0x800BFCFC,0x11 +asm/non_matchings/code/z_bgcheck/BgCheck_Vec3fToVec3s.s,BgCheck_Vec3fToVec3s,0x800BFD40,0x11 asm/non_matchings/code/z_bgcheck/func_800BFD84.s,func_800BFD84,0x800BFD84,0x1A asm/non_matchings/code/z_bgcheck/func_800BFDEC.s,func_800BFDEC,0x800BFDEC,0x76 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonGetMinY.s,BgCheck_PolygonGetMinY,0x800BFFC4,0x1E -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonGetNormal.s,BgCheck_PolygonGetNormal,0x800C003C,0x16 +asm/non_matchings/code/z_bgcheck/CollisionPoly_GetMinY.s,CollisionPoly_GetMinY,0x800BFFC4,0x1E +asm/non_matchings/code/z_bgcheck/CollisionPoly_GetNormalF.s,CollisionPoly_GetNormalF,0x800C003C,0x16 asm/non_matchings/code/z_bgcheck/func_800C0094.s,func_800C0094,0x800C0094,0x49 -asm/non_matchings/code/z_bgcheck/func_800C01B8.s,func_800C01B8,0x800C01B8,0x1A -asm/non_matchings/code/z_bgcheck/BgCheck_CreateTriNormFromPolygon.s,BgCheck_CreateTriNormFromPolygon,0x800C0220,0x28 -asm/non_matchings/code/z_bgcheck/func_800C02C0.s,func_800C02C0,0x800C02C0,0x20 +asm/non_matchings/code/z_bgcheck/CollisionPoly_GetPointDistanceFromPlane.s,CollisionPoly_GetPointDistanceFromPlane,0x800C01B8,0x1A +asm/non_matchings/code/z_bgcheck/CollisionPoly_GetVertices.s,CollisionPoly_GetVertices,0x800C0220,0x28 +asm/non_matchings/code/z_bgcheck/CollisionPoly_GetVerticesByBgId.s,CollisionPoly_GetVerticesByBgId,0x800C02C0,0x20 asm/non_matchings/code/z_bgcheck/func_800C0340.s,func_800C0340,0x800C0340,0x4D asm/non_matchings/code/z_bgcheck/func_800C0474.s,func_800C0474,0x800C0474,0x7D asm/non_matchings/code/z_bgcheck/func_800C0668.s,func_800C0668,0x800C0668,0x10 asm/non_matchings/code/z_bgcheck/func_800C06A8.s,func_800C06A8,0x800C06A8,0x29 asm/non_matchings/code/z_bgcheck/func_800C074C.s,func_800C074C,0x800C074C,0x29 asm/non_matchings/code/z_bgcheck/func_800C07F0.s,func_800C07F0,0x800C07F0,0xC0 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonCollidesWithSphere.s,BgCheck_PolygonCollidesWithSphere,0x800C0AF0,0x34 -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsInsertSorted.s,BgCheck_ScenePolygonListsInsertSorted,0x800C0BC0,0x88 -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsInsert.s,BgCheck_ScenePolygonListsInsert,0x800C0DE0,0x25 +asm/non_matchings/code/z_bgcheck/CollisionPoly_SphVsPoly.s,CollisionPoly_SphVsPoly,0x800C0AF0,0x34 +asm/non_matchings/code/z_bgcheck/StaticLookup_AddPolyToSSList.s,StaticLookup_AddPolyToSSList,0x800C0BC0,0x88 +asm/non_matchings/code/z_bgcheck/StaticLookup_AddPoly.s,StaticLookup_AddPoly,0x800C0DE0,0x25 asm/non_matchings/code/z_bgcheck/func_800C0E74.s,func_800C0E74,0x800C0E74,0xA2 asm/non_matchings/code/z_bgcheck/func_800C10FC.s,func_800C10FC,0x800C10FC,0x4F asm/non_matchings/code/z_bgcheck/func_800C1238.s,func_800C1238,0x800C1238,0x1B @@ -452,98 +452,98 @@ asm/non_matchings/code/z_bgcheck/func_800C2310.s,func_800C2310,0x800C2310,0x54 asm/non_matchings/code/z_bgcheck/func_800C2460.s,func_800C2460,0x800C2460,0x2D asm/non_matchings/code/z_bgcheck/func_800C2514.s,func_800C2514,0x800C2514,0x33 asm/non_matchings/code/z_bgcheck/func_800C25E0.s,func_800C25E0,0x800C25E0,0x38 -asm/non_matchings/code/z_bgcheck/BgCheck_GetPolyMinSubdivisions.s,BgCheck_GetPolyMinSubdivisions,0x800C26C0,0x69 -asm/non_matchings/code/z_bgcheck/BgCheck_GetPolyMaxSubdivisions.s,BgCheck_GetPolyMaxSubdivisions,0x800C2864,0x73 -asm/non_matchings/code/z_bgcheck/BgCheck_GetPolyMinMaxSubdivisions.s,BgCheck_GetPolyMinMaxSubdivisions,0x800C2A30,0x6C -asm/non_matchings/code/z_bgcheck/func_800C2BE0.s,func_800C2BE0,0x800C2BE0,0x1D5 -asm/non_matchings/code/z_bgcheck/BgCheck_SplitScenePolygonsIntoSubdivisions.s,BgCheck_SplitScenePolygonsIntoSubdivisions,0x800C3334,0x100 -asm/non_matchings/code/z_bgcheck/BgCheck_GetIsDefaultSpecialScene.s,BgCheck_GetIsDefaultSpecialScene,0x800C3734,0x11 -asm/non_matchings/code/z_bgcheck/BgCheck_GetSpecialSceneMaxMemory.s,BgCheck_GetSpecialSceneMaxMemory,0x800C3778,0x11 -asm/non_matchings/code/z_bgcheck/BgCheck_CalcSubdivisionSize.s,BgCheck_CalcSubdivisionSize,0x800C37BC,0x22 +asm/non_matchings/code/z_bgcheck/BgCheck_GetSubdivisionMinBounds.s,BgCheck_GetSubdivisionMinBounds,0x800C26C0,0x69 +asm/non_matchings/code/z_bgcheck/BgCheck_GetSubdivisionMaxBounds.s,BgCheck_GetSubdivisionMaxBounds,0x800C2864,0x73 +asm/non_matchings/code/z_bgcheck/BgCheck_GetPolySubdivisionBounds.s,BgCheck_GetPolySubdivisionBounds,0x800C2A30,0x6C +asm/non_matchings/code/z_bgcheck/BgCheck_PolyIntersectsSubdivision.s,BgCheck_PolyIntersectsSubdivision,0x800C2BE0,0x1D5 +asm/non_matchings/code/z_bgcheck/BgCheck_InitStaticLookup.s,BgCheck_InitStaticLookup,0x800C3334,0x100 +asm/non_matchings/code/z_bgcheck/BgCheck_IsSmallMemScene.s,BgCheck_IsSmallMemScene,0x800C3734,0x11 +asm/non_matchings/code/z_bgcheck/BgCheck_TryGetCustomMemsize.s,BgCheck_TryGetCustomMemsize,0x800C3778,0x11 +asm/non_matchings/code/z_bgcheck/BgCheck_SetSubdivisionDimension.s,BgCheck_SetSubdivisionDimension,0x800C37BC,0x22 asm/non_matchings/code/z_bgcheck/BgCheck_GetSpecialSceneMaxObjects.s,BgCheck_GetSpecialSceneMaxObjects,0x800C3844,0x16 asm/non_matchings/code/z_bgcheck/BgCheck_Init.s,BgCheck_Init,0x800C389C,0xD9 -asm/non_matchings/code/z_bgcheck/func_800C3C00.s,func_800C3C00,0x800C3C00,0x5 -asm/non_matchings/code/z_bgcheck/func_800C3C14.s,func_800C3C14,0x800C3C14,0x6 -asm/non_matchings/code/z_bgcheck/BgCheck_GetActorMeshHeader.s,BgCheck_GetActorMeshHeader,0x800C3C2C,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_SetContextFlags.s,BgCheck_SetContextFlags,0x800C3C00,0x5 +asm/non_matchings/code/z_bgcheck/BgCheck_UnsetContextFlags.s,BgCheck_UnsetContextFlags,0x800C3C14,0x6 +asm/non_matchings/code/z_bgcheck/BgCheck_GetCollisionHeader.s,BgCheck_GetCollisionHeader,0x800C3C2C,0x1A asm/non_matchings/code/z_bgcheck/func_800C3C94.s,func_800C3C94,0x800C3C94,0x2F -asm/non_matchings/code/z_bgcheck/func_800C3D50.s,func_800C3D50,0x800C3D50,0x7C -asm/non_matchings/code/z_bgcheck/func_800C3F40.s,func_800C3F40,0x800C3F40,0x18 -asm/non_matchings/code/z_bgcheck/func_800C3FA0.s,func_800C3FA0,0x800C3FA0,0x18 -asm/non_matchings/code/z_bgcheck/func_800C4000.s,func_800C4000,0x800C4000,0x16 -asm/non_matchings/code/z_bgcheck/func_800C4058.s,func_800C4058,0x800C4058,0x17 -asm/non_matchings/code/z_bgcheck/func_800C40B4.s,func_800C40B4,0x800C40B4,0x1A -asm/non_matchings/code/z_bgcheck/func_800C411C.s,func_800C411C,0x800C411C,0x1B -asm/non_matchings/code/z_bgcheck/func_800C4188.s,func_800C4188,0x800C4188,0x17 -asm/non_matchings/code/z_bgcheck/func_800C41E4.s,func_800C41E4,0x800C41E4,0x17 -asm/non_matchings/code/z_bgcheck/func_800C4240.s,func_800C4240,0x800C4240,0x1A -asm/non_matchings/code/z_bgcheck/func_800C42A8.s,func_800C42A8,0x800C42A8,0x1B -asm/non_matchings/code/z_bgcheck/func_800C4314.s,func_800C4314,0x800C4314,0x2E -asm/non_matchings/code/z_bgcheck/func_800C43CC.s,func_800C43CC,0x800C43CC,0x2F -asm/non_matchings/code/z_bgcheck/func_800C4488.s,func_800C4488,0x800C4488,0x1A -asm/non_matchings/code/z_bgcheck/func_800C44F0.s,func_800C44F0,0x800C44F0,0x1B -asm/non_matchings/code/z_bgcheck/func_800C455C.s,func_800C455C,0x800C455C,0x1A -asm/non_matchings/code/z_bgcheck/func_800C45C4.s,func_800C45C4,0x800C45C4,0x1AC -asm/non_matchings/code/z_bgcheck/func_800C4C74.s,func_800C4C74,0x800C4C74,0x19 -asm/non_matchings/code/z_bgcheck/func_800C4CD8.s,func_800C4CD8,0x800C4CD8,0x19 -asm/non_matchings/code/z_bgcheck/func_800C4D3C.s,func_800C4D3C,0x800C4D3C,0x1A -asm/non_matchings/code/z_bgcheck/func_800C4DA4.s,func_800C4DA4,0x800C4DA4,0x1B -asm/non_matchings/code/z_bgcheck/func_800C4E10.s,func_800C4E10,0x800C4E10,0x4A -asm/non_matchings/code/z_bgcheck/func_800C4F38.s,func_800C4F38,0x800C4F38,0x13 -asm/non_matchings/code/z_bgcheck/func_800C4F84.s,func_800C4F84,0x800C4F84,0x14 +asm/non_matchings/code/z_bgcheck/BgCheck_RaycastFloorImpl.s,BgCheck_RaycastFloorImpl,0x800C3D50,0x7C +asm/non_matchings/code/z_bgcheck/BgCheck_CameraRaycastFloor1.s,BgCheck_CameraRaycastFloor1,0x800C3F40,0x18 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor1.s,BgCheck_EntityRaycastFloor1,0x800C3FA0,0x18 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor2.s,BgCheck_EntityRaycastFloor2,0x800C4000,0x16 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor2_1.s,BgCheck_EntityRaycastFloor2_1,0x800C4058,0x17 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor3.s,BgCheck_EntityRaycastFloor3,0x800C40B4,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor5.s,BgCheck_EntityRaycastFloor5,0x800C411C,0x1B +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor5_2.s,BgCheck_EntityRaycastFloor5_2,0x800C4188,0x17 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor5_3.s,BgCheck_EntityRaycastFloor5_3,0x800C41E4,0x17 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor6.s,BgCheck_EntityRaycastFloor6,0x800C4240,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor7.s,BgCheck_EntityRaycastFloor7,0x800C42A8,0x1B +asm/non_matchings/code/z_bgcheck/BgCheck_AnyRaycastFloor1.s,BgCheck_AnyRaycastFloor1,0x800C4314,0x2E +asm/non_matchings/code/z_bgcheck/BgCheck_AnyRaycastFloor2.s,BgCheck_AnyRaycastFloor2,0x800C43CC,0x2F +asm/non_matchings/code/z_bgcheck/BgCheck_CameraRaycastFloor2.s,BgCheck_CameraRaycastFloor2,0x800C4488,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor8.s,BgCheck_EntityRaycastFloor8,0x800C44F0,0x1B +asm/non_matchings/code/z_bgcheck/BgCheck_EntityRaycastFloor9.s,BgCheck_EntityRaycastFloor9,0x800C455C,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_CheckWallImpl.s,BgCheck_CheckWallImpl,0x800C45C4,0x1AC +asm/non_matchings/code/z_bgcheck/BgCheck_EntitySphVsWall1.s,BgCheck_EntitySphVsWall1,0x800C4C74,0x19 +asm/non_matchings/code/z_bgcheck/BgCheck_EntitySphVsWall2.s,BgCheck_EntitySphVsWall2,0x800C4CD8,0x19 +asm/non_matchings/code/z_bgcheck/BgCheck_EntitySphVsWall3.s,BgCheck_EntitySphVsWall3,0x800C4D3C,0x1A +asm/non_matchings/code/z_bgcheck/BgCheck_EntitySphVsWall4.s,BgCheck_EntitySphVsWall4,0x800C4DA4,0x1B +asm/non_matchings/code/z_bgcheck/BgCheck_CheckCeilingImpl.s,BgCheck_CheckCeilingImpl,0x800C4E10,0x4A +asm/non_matchings/code/z_bgcheck/BgCheck_AnyCheckCeiling.s,BgCheck_AnyCheckCeiling,0x800C4F38,0x13 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityCheckCeiling.s,BgCheck_EntityCheckCeiling,0x800C4F84,0x14 asm/non_matchings/code/z_bgcheck/func_800C4FD4.s,func_800C4FD4,0x800C4FD4,0x124 asm/non_matchings/code/z_bgcheck/func_800C5464.s,func_800C5464,0x800C5464,0x12 -asm/non_matchings/code/z_bgcheck/func_800C54AC.s,func_800C54AC,0x800C54AC,0x23 -asm/non_matchings/code/z_bgcheck/func_800C5538.s,func_800C5538,0x800C5538,0x23 -asm/non_matchings/code/z_bgcheck/func_800C55C4.s,func_800C55C4,0x800C55C4,0x23 -asm/non_matchings/code/z_bgcheck/func_800C5650.s,func_800C5650,0x800C5650,0x24 -asm/non_matchings/code/z_bgcheck/func_800C56E0.s,func_800C56E0,0x800C56E0,0x23 -asm/non_matchings/code/z_bgcheck/func_800C576C.s,func_800C576C,0x800C576C,0x23 -asm/non_matchings/code/z_bgcheck/func_800C57F8.s,func_800C57F8,0x800C57F8,0x11 -asm/non_matchings/code/z_bgcheck/func_800C583C.s,func_800C583C,0x800C583C,0x23 -asm/non_matchings/code/z_bgcheck/func_800C58C8.s,func_800C58C8,0x800C58C8,0x23 -asm/non_matchings/code/z_bgcheck/func_800C5954.s,func_800C5954,0x800C5954,0x33 -asm/non_matchings/code/z_bgcheck/func_800C5A20.s,func_800C5A20,0x800C5A20,0x11 -asm/non_matchings/code/z_bgcheck/func_800C5A64.s,func_800C5A64,0x800C5A64,0x12 -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsInit.s,BgCheck_ScenePolygonListsInit,0x800C5AAC,0x6 -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsAlloc.s,BgCheck_ScenePolygonListsAlloc,0x800C5AC4,0x2F -asm/non_matchings/code/z_bgcheck/func_800C5B80.s,func_800C5B80,0x800C5B80,0xF -asm/non_matchings/code/z_bgcheck/BgCheck_ScenePolygonListsReserveNode.s,BgCheck_ScenePolygonListsReserveNode,0x800C5BBC,0x5 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshParamsInit.s,BgCheck_ActorMeshParamsInit,0x800C5BD0,0xF -asm/non_matchings/code/z_bgcheck/BgCheck_SetActorMeshParams.s,BgCheck_SetActorMeshParams,0x800C5C0C,0x14 +asm/non_matchings/code/z_bgcheck/BgCheck_CameraLineTest1.s,BgCheck_CameraLineTest1,0x800C54AC,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_CameraLineTest2.s,BgCheck_CameraLineTest2,0x800C5538,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityLineTest1.s,BgCheck_EntityLineTest1,0x800C55C4,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityLineTest2.s,BgCheck_EntityLineTest2,0x800C5650,0x24 +asm/non_matchings/code/z_bgcheck/BgCheck_EntityLineTest3.s,BgCheck_EntityLineTest3,0x800C56E0,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_ProjectileLineTest.s,BgCheck_ProjectileLineTest,0x800C576C,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_AnyLineTest1.s,BgCheck_AnyLineTest1,0x800C57F8,0x11 +asm/non_matchings/code/z_bgcheck/BgCheck_AnyLineTest2.s,BgCheck_AnyLineTest2,0x800C583C,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_AnyLineTest3.s,BgCheck_AnyLineTest3,0x800C58C8,0x23 +asm/non_matchings/code/z_bgcheck/BgCheck_SphVsFirstPolyImpl.s,BgCheck_SphVsFirstPolyImpl,0x800C5954,0x33 +asm/non_matchings/code/z_bgcheck/BgCheck_SphVsFirstPoly.s,BgCheck_SphVsFirstPoly,0x800C5A20,0x11 +asm/non_matchings/code/z_bgcheck/BgCheck_SphVsFirstWall.s,BgCheck_SphVsFirstWall,0x800C5A64,0x12 +asm/non_matchings/code/z_bgcheck/SSNodeList_Init.s,SSNodeList_Init,0x800C5AAC,0x6 +asm/non_matchings/code/z_bgcheck/SSNodeList_Alloc.s,SSNodeList_Alloc,0x800C5AC4,0x2F +asm/non_matchings/code/z_bgcheck/SSNodeList_GetNextNode.s,SSNodeList_GetNextNode,0x800C5B80,0xF +asm/non_matchings/code/z_bgcheck/SSNodeList_GetNextNodeIdx.s,SSNodeList_GetNextNodeIdx,0x800C5BBC,0x5 +asm/non_matchings/code/z_bgcheck/ScaleRotPos_Init.s,ScaleRotPos_Init,0x800C5BD0,0xF +asm/non_matchings/code/z_bgcheck/ScaleRotPos_SetValue.s,ScaleRotPos_SetValue,0x800C5C0C,0x14 asm/non_matchings/code/z_bgcheck/BgCheck_AreActorMeshParamsEqual.s,BgCheck_AreActorMeshParamsEqual,0x800C5C5C,0x35 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshPolyListsHeadsInit.s,BgCheck_ActorMeshPolyListsHeadsInit,0x800C5D30,0x10 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshPolyListsInit.s,BgCheck_ActorMeshPolyListsInit,0x800C5D70,0x8 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshVerticesIndexInit.s,BgCheck_ActorMeshVerticesIndexInit,0x800C5D90,0x3 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshWaterboxesIndexInit.s,BgCheck_ActorMeshWaterboxesIndexInit,0x800C5D9C,0x3 -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshInit.s,BgCheck_ActorMeshInit,0x800C5DA8,0x1A -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshInitFromActor.s,BgCheck_ActorMeshInitFromActor,0x800C5E10,0x2E -asm/non_matchings/code/z_bgcheck/BgCheck_HasActorMeshChanged.s,BgCheck_HasActorMeshChanged,0x800C5EC8,0xA -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonsInit.s,BgCheck_PolygonsInit,0x800C5EF0,0x3 -asm/non_matchings/code/z_bgcheck/BgCheck_PolygonsAlloc.s,BgCheck_PolygonsAlloc,0x800C5EFC,0xF -asm/non_matchings/code/z_bgcheck/BgCheck_VerticesInit.s,BgCheck_VerticesInit,0x800C5F38,0x3 -asm/non_matchings/code/z_bgcheck/BgCheck_VerticesListAlloc.s,BgCheck_VerticesListAlloc,0x800C5F44,0x12 -asm/non_matchings/code/z_bgcheck/BgCheck_WaterboxListInit.s,BgCheck_WaterboxListInit,0x800C5F8C,0x4 -asm/non_matchings/code/z_bgcheck/BgCheck_WaterboxListAlloc.s,BgCheck_WaterboxListAlloc,0x800C5F9C,0xF -asm/non_matchings/code/z_bgcheck/BgCheck_ActorMeshUpdateParams.s,BgCheck_ActorMeshUpdateParams,0x800C5FD8,0x13 -asm/non_matchings/code/z_bgcheck/BgCheck_IsActorMeshIndexValid.s,BgCheck_IsActorMeshIndexValid,0x800C6024,0x8 -asm/non_matchings/code/z_bgcheck/BgCheck_DynaInit.s,BgCheck_DynaInit,0x800C6044,0x15 -asm/non_matchings/code/z_bgcheck/BgCheck_DynaAlloc.s,BgCheck_DynaAlloc,0x800C6098,0x3C -asm/non_matchings/code/z_bgcheck/BgCheck_AddActorMesh.s,BgCheck_AddActorMesh,0x800C6188,0x30 -asm/non_matchings/code/z_bgcheck/BgCheck_GetActorOfMesh.s,BgCheck_GetActorOfMesh,0x800C6248,0x1D +asm/non_matchings/code/z_bgcheck/DynaLookup_ResetLists.s,DynaLookup_ResetLists,0x800C5D30,0x10 +asm/non_matchings/code/z_bgcheck/DynaLookup_Reset.s,DynaLookup_Reset,0x800C5D70,0x8 +asm/non_matchings/code/z_bgcheck/DynaLookup_ResetVtxStartIndex.s,DynaLookup_ResetVtxStartIndex,0x800C5D90,0x3 +asm/non_matchings/code/z_bgcheck/DynaLookup_ResetWaterBoxStartIndex.s,DynaLookup_ResetWaterBoxStartIndex,0x800C5D9C,0x3 +asm/non_matchings/code/z_bgcheck/BgActor_Init.s,BgActor_Init,0x800C5DA8,0x1A +asm/non_matchings/code/z_bgcheck/BgActor_InitFromActor.s,BgActor_InitFromActor,0x800C5E10,0x2E +asm/non_matchings/code/z_bgcheck/BgActor_IsTransformUnchanged.s,BgActor_IsTransformUnchanged,0x800C5EC8,0xA +asm/non_matchings/code/z_bgcheck/DynaPoly_NullPolyList.s,DynaPoly_NullPolyList,0x800C5EF0,0x3 +asm/non_matchings/code/z_bgcheck/DynaPoly_AllocPolyList.s,DynaPoly_AllocPolyList,0x800C5EFC,0xF +asm/non_matchings/code/z_bgcheck/DynaPoly_NullVtxList.s,DynaPoly_NullVtxList,0x800C5F38,0x3 +asm/non_matchings/code/z_bgcheck/DynaPoly_AllocVtxList.s,DynaPoly_AllocVtxList,0x800C5F44,0x12 +asm/non_matchings/code/z_bgcheck/DynaPoly_InitWaterBoxList.s,DynaPoly_InitWaterBoxList,0x800C5F8C,0x4 +asm/non_matchings/code/z_bgcheck/DynaPoly_AllocWaterBoxList.s,DynaPoly_AllocWaterBoxList,0x800C5F9C,0xF +asm/non_matchings/code/z_bgcheck/DynaPoly_SetBgActorPrevTransform.s,DynaPoly_SetBgActorPrevTransform,0x800C5FD8,0x13 +asm/non_matchings/code/z_bgcheck/DynaPoly_IsBgIdBgActor.s,DynaPoly_IsBgIdBgActor,0x800C6024,0x8 +asm/non_matchings/code/z_bgcheck/DynaPoly_Init.s,DynaPoly_Init,0x800C6044,0x15 +asm/non_matchings/code/z_bgcheck/DynaPoly_Alloc.s,DynaPoly_Alloc,0x800C6098,0x3C +asm/non_matchings/code/z_bgcheck/DynaPoly_SetBgActor.s,DynaPoly_SetBgActor,0x800C6188,0x30 +asm/non_matchings/code/z_bgcheck/DynaPoly_GetActor.s,DynaPoly_GetActor,0x800C6248,0x1D asm/non_matchings/code/z_bgcheck/func_800C62BC.s,func_800C62BC,0x800C62BC,0x16 asm/non_matchings/code/z_bgcheck/func_800C6314.s,func_800C6314,0x800C6314,0x16 asm/non_matchings/code/z_bgcheck/func_800C636C.s,func_800C636C,0x800C636C,0x16 asm/non_matchings/code/z_bgcheck/func_800C63C4.s,func_800C63C4,0x800C63C4,0x16 asm/non_matchings/code/z_bgcheck/func_800C641C.s,func_800C641C,0x800C641C,0x16 asm/non_matchings/code/z_bgcheck/func_800C6474.s,func_800C6474,0x800C6474,0x16 -asm/non_matchings/code/z_bgcheck/BgCheck_RemoveActorMesh.s,BgCheck_RemoveActorMesh,0x800C64CC,0x22 +asm/non_matchings/code/z_bgcheck/DynaPoly_DeleteBgActor.s,DynaPoly_DeleteBgActor,0x800C64CC,0x22 asm/non_matchings/code/z_bgcheck/func_800C6554.s,func_800C6554,0x800C6554,0x6 asm/non_matchings/code/z_bgcheck/BgCheck_CalcWaterboxDimensions.s,BgCheck_CalcWaterboxDimensions,0x800C656C,0xB3 -asm/non_matchings/code/z_bgcheck/BgCheck_AddActorMeshToLists.s,BgCheck_AddActorMeshToLists,0x800C6838,0x2C5 +asm/non_matchings/code/z_bgcheck/DynaPoly_SetBgActorToLists.s,DynaPoly_SetBgActorToLists,0x800C6838,0x2C5 asm/non_matchings/code/z_bgcheck/BgCheck_ResetFlagsIfLoadedActor.s,BgCheck_ResetFlagsIfLoadedActor,0x800C734C,0x26 -asm/non_matchings/code/z_bgcheck/BgCheck_Update.s,BgCheck_Update,0x800C73E4,0x62 +asm/non_matchings/code/z_bgcheck/DynaPoly_Setup.s,DynaPoly_Setup,0x800C73E4,0x62 asm/non_matchings/code/z_bgcheck/func_800C756C.s,func_800C756C,0x800C756C,0x3C -asm/non_matchings/code/z_bgcheck/BgCheck_UpdateAllActorMeshes.s,BgCheck_UpdateAllActorMeshes,0x800C765C,0x24 +asm/non_matchings/code/z_bgcheck/DynaPoly_SetupAllActorMeshes.s,DynaPoly_SetupAllActorMeshes,0x800C765C,0x24 asm/non_matchings/code/z_bgcheck/func_800C76EC.s,func_800C76EC,0x800C76EC,0xA2 asm/non_matchings/code/z_bgcheck/func_800C7974.s,func_800C7974,0x800C7974,0x133 asm/non_matchings/code/z_bgcheck/func_800C7E40.s,func_800C7E40,0x800C7E40,0x1D0 @@ -556,19 +556,19 @@ asm/non_matchings/code/z_bgcheck/func_800C8EEC.s,func_800C8EEC,0x800C8EEC,0x70 asm/non_matchings/code/z_bgcheck/func_800C90AC.s,func_800C90AC,0x800C90AC,0x5C asm/non_matchings/code/z_bgcheck/func_800C921C.s,func_800C921C,0x800C921C,0x59 asm/non_matchings/code/z_bgcheck/func_800C9380.s,func_800C9380,0x800C9380,0x58 -asm/non_matchings/code/z_bgcheck/BgCheck_RelocateMeshHeaderPointers.s,BgCheck_RelocateMeshHeaderPointers,0x800C94E0,0x21 -asm/non_matchings/code/z_bgcheck/BgCheck_RelocateMeshHeader.s,BgCheck_RelocateMeshHeader,0x800C9564,0xD -asm/non_matchings/code/z_bgcheck/BgCheck_RelocateAllMeshHeaders.s,BgCheck_RelocateAllMeshHeaders,0x800C9598,0x2A +asm/non_matchings/code/z_bgcheck/CollisionHeader_GetVirtualPointers.s,CollisionHeader_GetVirtualPointers,0x800C94E0,0x21 +asm/non_matchings/code/z_bgcheck/CollisionHeader_GetVirtual.s,CollisionHeader_GetVirtual,0x800C9564,0xD +asm/non_matchings/code/z_bgcheck/BgCheck_InitCollisionHeaders.s,BgCheck_InitCollisionHeaders,0x800C9598,0x2A asm/non_matchings/code/z_bgcheck/func_800C9640.s,func_800C9640,0x800C9640,0x15 -asm/non_matchings/code/z_bgcheck/BgCheck_GetPolygonAttributes.s,BgCheck_GetPolygonAttributes,0x800C9694,0x1C -asm/non_matchings/code/z_bgcheck/func_800C9704.s,func_800C9704,0x800C9704,0x9 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetData.s,SurfaceType_GetData,0x800C9694,0x1C +asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamDataIndex.s,SurfaceType_GetCamDataIndex,0x800C9704,0x9 asm/non_matchings/code/z_bgcheck/func_800C9728.s,func_800C9728,0x800C9728,0x12 asm/non_matchings/code/z_bgcheck/func_800C9770.s,func_800C9770,0x800C9770,0x22 asm/non_matchings/code/z_bgcheck/func_800C97F8.s,func_800C97F8,0x800C97F8,0x13 asm/non_matchings/code/z_bgcheck/func_800C9844.s,func_800C9844,0x800C9844,0x22 asm/non_matchings/code/z_bgcheck/func_800C98CC.s,func_800C98CC,0x800C98CC,0x16 -asm/non_matchings/code/z_bgcheck/func_800C9924.s,func_800C9924,0x800C9924,0x22 -asm/non_matchings/code/z_bgcheck/func_800C99AC.s,func_800C99AC,0x800C99AC,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamPosData.s,SurfaceType_GetCamPosData,0x800C9924,0x22 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetSceneExitIndex.s,SurfaceType_GetSceneExitIndex,0x800C99AC,0xA asm/non_matchings/code/z_bgcheck/func_800C99D4.s,func_800C99D4,0x800C99D4,0xA asm/non_matchings/code/z_bgcheck/func_800C99FC.s,func_800C99FC,0x800C99FC,0xA asm/non_matchings/code/z_bgcheck/func_800C9A24.s,func_800C9A24,0x800C9A24,0xA @@ -579,30 +579,30 @@ asm/non_matchings/code/z_bgcheck/func_800C9AE4.s,func_800C9AE4,0x800C9AE4,0xD asm/non_matchings/code/z_bgcheck/func_800C9B18.s,func_800C9B18,0x800C9B18,0xA asm/non_matchings/code/z_bgcheck/func_800C9B40.s,func_800C9B40,0x800C9B40,0xA asm/non_matchings/code/z_bgcheck/func_800C9B68.s,func_800C9B68,0x800C9B68,0xA -asm/non_matchings/code/z_bgcheck/func_800C9B90.s,func_800C9B90,0x800C9B90,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_IsHorseBlocked.s,SurfaceType_IsHorseBlocked,0x800C9B90,0xA asm/non_matchings/code/z_bgcheck/func_800C9BB8.s,func_800C9BB8,0x800C9BB8,0x9 -asm/non_matchings/code/z_bgcheck/func_800C9BDC.s,func_800C9BDC,0x800C9BDC,0x12 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetSfx.s,SurfaceType_GetSfx,0x800C9BDC,0x12 asm/non_matchings/code/z_bgcheck/func_800C9C24.s,func_800C9C24,0x800C9C24,0x14 -asm/non_matchings/code/z_bgcheck/func_800C9C74.s,func_800C9C74,0x800C9C74,0xA -asm/non_matchings/code/z_bgcheck/func_800C9C9C.s,func_800C9C9C,0x800C9C9C,0xA -asm/non_matchings/code/z_bgcheck/func_800C9CC4.s,func_800C9CC4,0x800C9CC4,0xA -asm/non_matchings/code/z_bgcheck/func_800C9CEC.s,func_800C9CEC,0x800C9CEC,0xA -asm/non_matchings/code/z_bgcheck/func_800C9D14.s,func_800C9D14,0x800C9D14,0xF -asm/non_matchings/code/z_bgcheck/func_800C9D50.s,func_800C9D50,0x800C9D50,0xF -asm/non_matchings/code/z_bgcheck/func_800C9D8C.s,func_800C9D8C,0x800C9D8C,0x14 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetSlope.s,SurfaceType_GetSlope,0x800C9C74,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetLightSettingIndex.s,SurfaceType_GetLightSettingIndex,0x800C9C9C,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetEcho.s,SurfaceType_GetEcho,0x800C9CC4,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_IsHookshotSurface.s,SurfaceType_IsHookshotSurface,0x800C9CEC,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByEntities.s,SurfaceType_IsIgnoredByEntities,0x800C9D14,0xF +asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByProjectiles.s,SurfaceType_IsIgnoredByProjectiles,0x800C9D50,0xF +asm/non_matchings/code/z_bgcheck/SurfaceType_IsConveyor.s,SurfaceType_IsConveyor,0x800C9D8C,0x14 asm/non_matchings/code/z_bgcheck/func_800C9DDC.s,func_800C9DDC,0x800C9DDC,0xF -asm/non_matchings/code/z_bgcheck/func_800C9E18.s,func_800C9E18,0x800C9E18,0xA -asm/non_matchings/code/z_bgcheck/func_800C9E40.s,func_800C9E40,0x800C9E40,0x12 -asm/non_matchings/code/z_bgcheck/func_800C9E88.s,func_800C9E88,0x800C9E88,0xD -asm/non_matchings/code/z_bgcheck/func_800C9EBC.s,func_800C9EBC,0x800C9EBC,0xBC -asm/non_matchings/code/z_bgcheck/func_800CA1AC.s,func_800CA1AC,0x800CA1AC,0xF -asm/non_matchings/code/z_bgcheck/func_800CA1E8.s,func_800CA1E8,0x800CA1E8,0x11 -asm/non_matchings/code/z_bgcheck/func_800CA22C.s,func_800CA22C,0x800CA22C,0xCF +asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorSpeed.s,SurfaceType_GetConveyorSpeed,0x800C9E18,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorDirection.s,SurfaceType_GetConveyorDirection,0x800C9E40,0x12 +asm/non_matchings/code/z_bgcheck/SurfaceType_IsWallDamage.s,SurfaceType_IsWallDamage,0x800C9E88,0xD +asm/non_matchings/code/z_bgcheck/WaterBox_GetSurfaceImpl.s,WaterBox_GetSurfaceImpl,0x800C9EBC,0xBC +asm/non_matchings/code/z_bgcheck/WaterBox_GetSurface1.s,WaterBox_GetSurface1,0x800CA1AC,0xF +asm/non_matchings/code/z_bgcheck/WaterBox_GetSurface1_2.s,WaterBox_GetSurface1_2,0x800CA1E8,0x11 +asm/non_matchings/code/z_bgcheck/WaterBox_GetSurface2.s,WaterBox_GetSurface2,0x800CA22C,0xCF asm/non_matchings/code/z_bgcheck/func_800CA568.s,func_800CA568,0x800CA568,0x33 asm/non_matchings/code/z_bgcheck/func_800CA634.s,func_800CA634,0x800CA634,0x5 asm/non_matchings/code/z_bgcheck/func_800CA648.s,func_800CA648,0x800CA648,0x1C asm/non_matchings/code/z_bgcheck/func_800CA6B8.s,func_800CA6B8,0x800CA6B8,0x8 -asm/non_matchings/code/z_bgcheck/func_800CA6D8.s,func_800CA6D8,0x800CA6D8,0x6 +asm/non_matchings/code/z_bgcheck/WaterBox_GetLightSettingIndex.s,WaterBox_GetLightSettingIndex,0x800CA6D8,0x6 asm/non_matchings/code/z_bgcheck/func_800CA6F0.s,func_800CA6F0,0x800CA6F0,0xB8 asm/non_matchings/code/z_bgcheck/func_800CA9D0.s,func_800CA9D0,0x800CA9D0,0x11 asm/non_matchings/code/z_bgcheck/func_800CAA14.s,func_800CAA14,0x800CAA14,0x2F @@ -2509,7 +2509,7 @@ asm/non_matchings/code/z_play/func_80166B30.s,func_80166B30,0x80166B30,0x339 asm/non_matchings/code/z_play/func_80167814.s,func_80167814,0x80167814,0x174 asm/non_matchings/code/z_play/func_80167DE4.s,func_80167DE4,0x80167DE4,0x4A asm/non_matchings/code/z_play/func_80167F0C.s,func_80167F0C,0x80167F0C,0x61 -asm/non_matchings/code/z_play/func_80168090.s,func_80168090,0x80168090,0x347 +asm/non_matchings/code/z_play/Play_Draw.s,Play_Draw,0x80168090,0x347 asm/non_matchings/code/z_play/func_80168DAC.s,func_80168DAC,0x80168DAC,0x6E asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80168F64,0x5A asm/non_matchings/code/z_play/func_801690CC.s,func_801690CC,0x801690CC,0xD @@ -2770,7 +2770,7 @@ asm/non_matchings/code/sys_math/cos_rad.s,cos_rad,0x80179540,0x15 asm/non_matchings/code/sys_math/Rand_ZeroFloat.s,Rand_ZeroFloat,0x80179594,0xB asm/non_matchings/code/sys_math/randPlusMinusPoint5Scaled.s,randPlusMinusPoint5Scaled,0x801795C0,0xC asm/non_matchings/code/sys_math3d/Math3D_Normalize.s,Math3D_Normalize,0x801795F0,0x22 -asm/non_matchings/code/sys_math3d/func_80179678.s,func_80179678,0x80179678,0x48 +asm/non_matchings/code/sys_math3d/Math3D_PlaneVsLineSegClosestPoint.s,Math3D_PlaneVsLineSegClosestPoint,0x80179678,0x48 asm/non_matchings/code/sys_math3d/func_80179798.s,func_80179798,0x80179798,0xAB asm/non_matchings/code/sys_math3d/func_80179A44.s,func_80179A44,0x80179A44,0x3C asm/non_matchings/code/sys_math3d/func_80179B34.s,func_80179B34,0x80179B34,0x18 @@ -2792,46 +2792,46 @@ asm/non_matchings/code/sys_math3d/Math3D_XZDistanceSquared.s,Math3D_XZDistanceSq asm/non_matchings/code/sys_math3d/Math3D_XZDistance.s,Math3D_XZDistance,0x8017A678,0xC asm/non_matchings/code/sys_math3d/Math3D_LengthSquared.s,Math3D_LengthSquared,0x8017A6A8,0xB asm/non_matchings/code/sys_math3d/Math3D_Vec3fMagnitude.s,Math3D_Vec3fMagnitude,0x8017A6D4,0x9 -asm/non_matchings/code/sys_math3d/Math3D_DistanceSquared.s,Math3D_DistanceSquared,0x8017A6F8,0xA +asm/non_matchings/code/sys_math3d/Math3D_Vec3fDistSq.s,Math3D_Vec3fDistSq,0x8017A6F8,0xA asm/non_matchings/code/sys_math3d/Math3D_Distance.s,Math3D_Distance,0x8017A720,0x8 asm/non_matchings/code/sys_math3d/Math3D_DistanceS.s,Math3D_DistanceS,0x8017A740,0x1E asm/non_matchings/code/sys_math3d/func_8017A7B8.s,func_8017A7B8,0x8017A7B8,0x10 asm/non_matchings/code/sys_math3d/func_8017A7F8.s,func_8017A7F8,0x8017A7F8,0x10 asm/non_matchings/code/sys_math3d/func_8017A838.s,func_8017A838,0x8017A838,0x10 asm/non_matchings/code/sys_math3d/Math3D_CrossProduct.s,Math3D_CrossProduct,0x8017A878,0x1D -asm/non_matchings/code/sys_math3d/Math3D_NormalVector.s,Math3D_NormalVector,0x8017A8EC,0x1A -asm/non_matchings/code/sys_math3d/func_8017A954.s,func_8017A954,0x8017A954,0x2E -asm/non_matchings/code/sys_math3d/func_8017AA0C.s,func_8017AA0C,0x8017AA0C,0x6C -asm/non_matchings/code/sys_math3d/func_8017ABBC.s,func_8017ABBC,0x8017ABBC,0x5F -asm/non_matchings/code/sys_math3d/func_8017AD38.s,func_8017AD38,0x8017AD38,0x255 +asm/non_matchings/code/sys_math3d/Math3D_SurfaceNorm.s,Math3D_SurfaceNorm,0x8017A8EC,0x1A +asm/non_matchings/code/sys_math3d/Math3D_PointRelativeToCubeFaces.s,Math3D_PointRelativeToCubeFaces,0x8017A954,0x2E +asm/non_matchings/code/sys_math3d/Math3D_PointRelativeToCubeEdges.s,Math3D_PointRelativeToCubeEdges,0x8017AA0C,0x6C +asm/non_matchings/code/sys_math3d/Math3D_PointRelativeToCubeVertices.s,Math3D_PointRelativeToCubeVertices,0x8017ABBC,0x5F +asm/non_matchings/code/sys_math3d/Math3D_LineVsCube.s,Math3D_LineVsCube,0x8017AD38,0x255 asm/non_matchings/code/sys_math3d/func_8017B68C.s,func_8017B68C,0x8017B68C,0x5B asm/non_matchings/code/sys_math3d/func_8017B7F8.s,func_8017B7F8,0x8017B7F8,0x23 asm/non_matchings/code/sys_math3d/Math3D_UnitNormalVector.s,Math3D_UnitNormalVector,0x8017B884,0x45 asm/non_matchings/code/sys_math3d/Math3D_SignedDistanceFromPlane.s,Math3D_SignedDistanceFromPlane,0x8017B998,0x10 asm/non_matchings/code/sys_math3d/func_8017B9D8.s,func_8017B9D8,0x8017B9D8,0xF -asm/non_matchings/code/sys_math3d/Math3D_NormalizedDistanceFromPlane.s,Math3D_NormalizedDistanceFromPlane,0x8017BA14,0xE -asm/non_matchings/code/sys_math3d/Math3D_NormalizedSignedDistanceFromPlane.s,Math3D_NormalizedSignedDistanceFromPlane,0x8017BA4C,0x21 -asm/non_matchings/code/sys_math3d/func_8017BAD0.s,func_8017BAD0,0x8017BAD0,0xB2 +asm/non_matchings/code/sys_math3d/Math3D_UDistPlaneToPos.s,Math3D_UDistPlaneToPos,0x8017BA14,0xE +asm/non_matchings/code/sys_math3d/Math3D_DistPlaneToPos.s,Math3D_DistPlaneToPos,0x8017BA4C,0x21 +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaYDist.s,Math3D_TriChkPointParaYDist,0x8017BAD0,0xB2 asm/non_matchings/code/sys_math3d/func_8017BD98.s,func_8017BD98,0x8017BD98,0x12 asm/non_matchings/code/sys_math3d/func_8017BDE0.s,func_8017BDE0,0x8017BDE0,0x14 -asm/non_matchings/code/sys_math3d/func_8017BE30.s,func_8017BE30,0x8017BE30,0x2C -asm/non_matchings/code/sys_math3d/func_8017BEE0.s,func_8017BEE0,0x8017BEE0,0x2B +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaYIntersectDist.s,Math3D_TriChkPointParaYIntersectDist,0x8017BE30,0x2C +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaYIntersectInsideTri.s,Math3D_TriChkPointParaYIntersectInsideTri,0x8017BEE0,0x2B asm/non_matchings/code/sys_math3d/func_8017BF8C.s,func_8017BF8C,0x8017BF8C,0x1F -asm/non_matchings/code/sys_math3d/func_8017C008.s,func_8017C008,0x8017C008,0x5D +asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaYIntersect.s,Math3D_TriChkLineSegParaYIntersect,0x8017C008,0x5D asm/non_matchings/code/sys_math3d/func_8017C17C.s,func_8017C17C,0x8017C17C,0x1D asm/non_matchings/code/sys_math3d/func_8017C1F0.s,func_8017C1F0,0x8017C1F0,0xA9 -asm/non_matchings/code/sys_math3d/func_8017C494.s,func_8017C494,0x8017C494,0x2B -asm/non_matchings/code/sys_math3d/func_8017C540.s,func_8017C540,0x8017C540,0xB2 +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaYIntersectInsideTri2.s,Math3D_TriChkPointParaYIntersectInsideTri2,0x8017C494,0x2B +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaXDist.s,Math3D_TriChkPointParaXDist,0x8017C540,0xB2 asm/non_matchings/code/sys_math3d/func_8017C808.s,func_8017C808,0x8017C808,0x12 -asm/non_matchings/code/sys_math3d/func_8017C850.s,func_8017C850,0x8017C850,0x2D +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaXIntersect.s,Math3D_TriChkPointParaXIntersect,0x8017C850,0x2D asm/non_matchings/code/sys_math3d/func_8017C904.s,func_8017C904,0x8017C904,0x1F -asm/non_matchings/code/sys_math3d/func_8017C980.s,func_8017C980,0x8017C980,0x62 +asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaXIntersect.s,Math3D_TriChkLineSegParaXIntersect,0x8017C980,0x62 asm/non_matchings/code/sys_math3d/func_8017CB08.s,func_8017CB08,0x8017CB08,0x1D -asm/non_matchings/code/sys_math3d/func_8017CB7C.s,func_8017CB7C,0x8017CB7C,0xCB +asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaZDist.s,Math3D_TriChkLineSegParaZDist,0x8017CB7C,0xCB asm/non_matchings/code/sys_math3d/func_8017CEA8.s,func_8017CEA8,0x8017CEA8,0x12 -asm/non_matchings/code/sys_math3d/func_8017CEF0.s,func_8017CEF0,0x8017CEF0,0x2D +asm/non_matchings/code/sys_math3d/Math3D_TriChkPointParaZIntersect.s,Math3D_TriChkPointParaZIntersect,0x8017CEF0,0x2D asm/non_matchings/code/sys_math3d/func_8017CFA4.s,func_8017CFA4,0x8017CFA4,0x1F -asm/non_matchings/code/sys_math3d/func_8017D020.s,func_8017D020,0x8017D020,0x63 +asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaZIntersect.s,Math3D_TriChkLineSegParaZIntersect,0x8017D020,0x63 asm/non_matchings/code/sys_math3d/func_8017D1AC.s,func_8017D1AC,0x8017D1AC,0x1D asm/non_matchings/code/sys_math3d/func_8017D220.s,func_8017D220,0x8017D220,0x37 asm/non_matchings/code/sys_math3d/func_8017D2FC.s,func_8017D2FC,0x8017D2FC,0x42 @@ -2843,7 +2843,7 @@ asm/non_matchings/code/sys_math3d/func_8017D7C0.s,func_8017D7C0,0x8017D7C0,0x15 asm/non_matchings/code/sys_math3d/func_8017D814.s,func_8017D814,0x8017D814,0x42 asm/non_matchings/code/sys_math3d/func_8017D91C.s,func_8017D91C,0x8017D91C,0x42 asm/non_matchings/code/sys_math3d/func_8017DA24.s,func_8017DA24,0x8017DA24,0x42 -asm/non_matchings/code/sys_math3d/Math3D_ColSphereLineSeg.s,Math3D_ColSphereLineSeg,0x8017DB2C,0x82 +asm/non_matchings/code/sys_math3d/Math3D_LineVsSph.s,Math3D_LineVsSph,0x8017DB2C,0x82 asm/non_matchings/code/sys_math3d/func_8017DD34.s,func_8017DD34,0x8017DD34,0x50 asm/non_matchings/code/sys_math3d/Math3D_ColSphereTri.s,Math3D_ColSphereTri,0x8017DE74,0x108 asm/non_matchings/code/sys_math3d/func_8017E294.s,func_8017E294,0x8017E294,0x2F @@ -2858,9 +2858,9 @@ asm/non_matchings/code/sys_math3d/Math3D_ColSphereCylinderDistanceAndAmount.s,Ma asm/non_matchings/code/sys_math3d/Math3D_ColCylinderCylinderAmount.s,Math3D_ColCylinderCylinderAmount,0x8017F45C,0x8 asm/non_matchings/code/sys_math3d/Math3D_ColCylinderCylinderAmountAndDistance.s,Math3D_ColCylinderCylinderAmountAndDistance,0x8017F47C,0x74 asm/non_matchings/code/sys_math3d/Math3d_ColTriTri.s,Math3d_ColTriTri,0x8017F64C,0xDD -asm/non_matchings/code/sys_math3d/func_8017F9C0.s,func_8017F9C0,0x8017F9C0,0x1D -asm/non_matchings/code/sys_math3d/func_8017FA34.s,func_8017FA34,0x8017FA34,0x1D -asm/non_matchings/code/sys_math3d/func_8017FAA8.s,func_8017FAA8,0x8017FAA8,0x1D +asm/non_matchings/code/sys_math3d/Math3D_XZInSphere.s,Math3D_XZInSphere,0x8017F9C0,0x1D +asm/non_matchings/code/sys_math3d/Math3D_XYInSphere.s,Math3D_XYInSphere,0x8017FA34,0x1D +asm/non_matchings/code/sys_math3d/Math3D_YZInSphere.s,Math3D_YZInSphere,0x8017FAA8,0x1D asm/non_matchings/code/sys_math3d/func_8017FB1C.s,func_8017FB1C,0x8017FB1C,0x8A asm/non_matchings/code/sys_math3d/func_8017FD44.s,func_8017FD44,0x8017FD44,0x5B asm/non_matchings/code/sys_math_atan/Math_GetAtan2Tbl.s,Math_GetAtan2Tbl,0x8017FEB0,0xD diff --git a/tools/z64compress/.gitrepo b/tools/z64compress/.gitrepo index 9507f81ce9..183bfc3267 100644 --- a/tools/z64compress/.gitrepo +++ b/tools/z64compress/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/z64me/z64compress.git branch = main - commit = 98ef0ac25f7adb47235c839838e29496d3546917 - parent = 69cc19eea8c30e50e280f400e8cf06fe66efca60 + commit = 5da3132606e4fd427a8d72b8428e4f921cd6e56f + parent = 837eb1c80687fe9b57a3c7b841547c33feeed6c7 method = merge cmdver = 0.4.3 diff --git a/tools/z64compress/Makefile b/tools/z64compress/Makefile index bb80891b13..f16167ccd2 100644 --- a/tools/z64compress/Makefile +++ b/tools/z64compress/Makefile @@ -1,23 +1,28 @@ CC := gcc -CFLAGS := -DNDEBUG -s -Os -flto -Wall -Wextra -march=native -mtune=native +CFLAGS := -DNDEBUG -s -Os -flto -Wall -Wextra -OBJ_DIR := o - -# Target platform, specify with TARGET= on the command line, linux64 is default +# Target platform, specify with TARGET= on the command line, linux64 is default. # Currently supported: linux64, linux32, win32 TARGET ?= linux64 ifeq ($(TARGET),linux32) TARGET_CFLAGS := -m32 else ifeq ($(TARGET),win32) -# If using a cross compiler, specify the compiler executable on the command line +# If using a cross compiler, specify the compiler executable on the command line. # make TARGET=win32 CC=~/c/mxe/usr/bin/i686-w64-mingw32.static-gcc TARGET_LIBS := -mconsole -municode else ifneq ($(TARGET),linux64) $(error Supported targets: linux64, linux32, win32) endif -OBJ_DIR := $(OBJ_DIR)/$(TARGET) +# Whether to use native optimizations, specify with NATIVE_OPT=0/1 on the command line, default is 0. +# This is not supported by all compilers which is particularly an issue on Mac, and may inhibit tests. +NATIVE_OPT ?= 0 +ifeq ($(NATIVE_OPT),1) + TARGET_CFLAGS += -march=native -mtune=native +endif + +OBJ_DIR := o/$(TARGET) $(OBJ_DIR)/src/enc/%.o: CFLAGS := -DNDEBUG -s -Ofast -flto -Wall diff --git a/tools/z64compress/src/main.c b/tools/z64compress/src/main.c index 71d1d20400..bd044059d1 100644 --- a/tools/z64compress/src/main.c +++ b/tools/z64compress/src/main.c @@ -221,7 +221,7 @@ wow_main } } - fprintf(printer, "welcome to z64compress 1.0.1 \n"); + fprintf(printer, "welcome to z64compress 1.0.2 \n"); if (argc <= 1) { @@ -356,7 +356,6 @@ wow_main ARG_ZERO_TEST(Ain , "--in" ); ARG_ZERO_TEST(Aout , "--out" ); - ARG_ZERO_TEST(Amb , "--mb" ); ARG_ZERO_TEST(Acodec, "--codec"); #undef ARG_ZERO_TEST diff --git a/tools/z64compress/src/rom.c b/tools/z64compress/src/rom.c index decf8ca1d0..008597b524 100644 --- a/tools/z64compress/src/rom.c +++ b/tools/z64compress/src/rom.c @@ -68,7 +68,9 @@ for (dma = rom->dma; (unsigned)(dma - rom->dma) < rom->dma_num; ++dma) #define PROGRESS_A_B (int)(dma - rom->dma), rom->dma_num -#define ALIGN16(x) (((x) + 0xF) & ~0xF) +#define ALIGN(x, n) (((x) + ((n)-1)) & ~((n)-1)) +#define ALIGN16(x) ALIGN(x, 16) +#define ALIGN8MB(x) ALIGN(x, 8 * 0x100000) /* * @@ -936,7 +938,7 @@ void rom_compress(struct rom *rom, int mb, int numThreads, bool matching) cache = rom->cache; - if (compsz > rom->data_sz || mb <= 0) + if (compsz > rom->data_sz || mb < 0) die("invalid mb argument %d", mb); /* get encoding functions */ @@ -1057,31 +1059,13 @@ void rom_compress(struct rom *rom, int mb, int numThreads, bool matching) /* sort by original start, ascending */ DMASORT(rom, sortfunc_dma_start_ascend); - if (matching) - { - /* fill the entire (compressed) rom space with 00010203...FF... - in order to match retail rom padding */ - unsigned char n = 0; // will intentionally overflow - for (unsigned int j = 0; j < compsz; j++, n++) - { - rom->data[j] = n; - } - } - else - { - /* zero the entire (compressed) rom space */ - memset(rom->data, 0, compsz); - } - - /* go through dma table, injecting compressed files */ + /* determine physical addresses for each segment */ comp_total = 0; DMA_FOR_EACH { - unsigned char *dst; char *fn = dma->compname; unsigned int sz; unsigned int sz16; - fprintf(printer, "\r""injecting file %d/%d: ", PROGRESS_A_B); if (dma->deleted) continue; @@ -1114,9 +1098,6 @@ void rom_compress(struct rom *rom, int mb, int numThreads, bool matching) if (sz16 & 15) sz16 += 16 - (sz16 & 15); - /* put the files in */ - dst = rom->data + comp_total; - dma->Pstart = comp_total; if (dma->compress) { @@ -1130,26 +1111,66 @@ void rom_compress(struct rom *rom, int mb, int numThreads, bool matching) dma->Pend = 0; comp_total += sz16; - if (dma->Pend > compsz) + if (mb != 0 && dma->Pend > compsz) die("ran out of compressed rom space"); + } + + /* adaptive final size */ + if (mb == 0) + compsz = ALIGN8MB(comp_total); + + if (matching) + { + /* fill the entire (compressed) rom space with 00010203...FF... + in order to match retail rom padding */ + unsigned char n = 0; /* will intentionally overflow */ + for (unsigned int j = 0; j < compsz; j++, n++) + { + rom->data[j] = n; + } + } + else + { + /* zero the entire (compressed) rom space */ + memset(rom->data, 0, compsz); + } + + /* inject compressed files */ + comp_total = 0; + DMA_FOR_EACH + { + unsigned char *dst; + char *fn = dma->compname; + unsigned int sz; + fprintf(printer, "\r""injecting file %d/%d: ", PROGRESS_A_B); + + if (dma->deleted) + continue; + + dst = rom->data + dma->Pstart; /* external cached file logic */ if (cache) { + /* skip entries that don't reference compressed files */ + if (!fn) + continue; + /* load file into rom at offset */ dst = file_load_into(cache_codec, fn, &sz, dst); } - /* otherwise, a simple memcpy */ else { memcpy(dst, dma->compbuf, dma->compSz); - if (matching) - { - // since matching rom padding is not zero but file padding is zero, - // fill file padding space with zeros - memset(dst + dma->compSz, 0, ALIGN16(dma->compSz) - dma->compSz); - } + sz = dma->compSz; + } + + if (matching) + { + /* since matching rom padding is not zero but file padding is zero, + fill file padding space with zeros */ + memset(dst + sz, 0, ALIGN16(sz) - sz); } } fprintf(printer, "\r""injecting file %d/%d: ", dma_num, dma_num); diff --git a/tools/z64compress_wrapper.py b/tools/z64compress_wrapper.py index d70db84265..ff2bf1bb6c 100644 --- a/tools/z64compress_wrapper.py +++ b/tools/z64compress_wrapper.py @@ -1,15 +1,19 @@ #!/usr/bin/env python3 # # z64compress wrapper for decomp projects -# Arguments: [cache directory] [num threads] +# https://github.com/z64me/z64compress +# Arguments: [--cache [cache directory]] [--threads [num threads]] [--mb [target rom size]] [--matching] +# Example Makefile usage: +# python3 tools/z64compress_wrapper.py --matching --threads $(shell nproc) $< $@ $(ELF) build/$(SPEC) # import argparse, itertools, subprocess, sys + from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection # Args from command line -parser = argparse.ArgumentParser(description="Compress rom produced by the OoT Decomp project") +parser = argparse.ArgumentParser(description="Compress rom produced by the OoT and MM Decomp projects") parser.add_argument("in_rom", help="uncompressed input rom filename") parser.add_argument("out_rom", help="compressed output rom filename") @@ -17,7 +21,7 @@ parser.add_argument("elf", help="path to the uncompressed rom elf file") parser.add_argument("spec", help="path to processed spec file") parser.add_argument("--cache", help="cache directory") parser.add_argument("--threads", help="number of threads to run compression on, 0 disables multithreading") -parser.add_argument("--mb", help="compressed rom size in MB, default 32") +parser.add_argument("--mb", help="compressed rom size in MB, default is the smallest multiple of 8mb fitting the whole rom") parser.add_argument("--matching", help="matching compression, forfeits some useful optimizations", action="store_true") parser.add_argument("--stderr", help="z64compress will write its output messages to stderr instead of stdout", action="store_true") @@ -26,14 +30,13 @@ args = parser.parse_args() IN_ROM = args.in_rom OUT_ROM = args.out_rom -STDOUT = not args.stderr - elf_path = args.elf CACHE_DIR = args.cache N_THREADS = int(args.threads or 0) -MB = int(args.mb or 32) -matching = args.matching +MB = args.mb +MATCHING = args.matching +STDOUT = not args.stderr # Get segments to compress @@ -83,8 +86,8 @@ def get_dmadata_start_len(): if dmadata_start != -1 and dmadata_end != -1: break - assert dmadata_start != -1 - assert dmadata_end != -1 + assert dmadata_start != -1, "_dmadataSegmentRomStart symbol not found in supplied ELF" + assert dmadata_end != -1, "_dmadataSegmentRomEnd symbol not found in supplied ELF" return dmadata_start, (dmadata_end - dmadata_start)//0x10 @@ -92,13 +95,21 @@ DMADATA_ADDR, DMADATA_COUNT = get_dmadata_start_len() # Run -cmd = f"./tools/z64compress/z64compress --in {IN_ROM} --out {OUT_ROM}{' --matching' if matching else ''} \ ---mb {MB} --codec yaz{f' --cache {CACHE_DIR}' if CACHE_DIR is not None else ''} --dma 0x{DMADATA_ADDR:X},{DMADATA_COUNT} \ ---compress {COMPRESS_INDICES}{f' --threads {N_THREADS}' if N_THREADS > 0 else ''}{f' --only-stdout' if STDOUT else ''}" +cmd = f"./tools/z64compress/z64compress \ +--in {IN_ROM} \ +--out {OUT_ROM}\ +{' --matching' if MATCHING else ''}\ +{f' --mb {MB}' if MB is not None else ''} \ +--codec yaz\ +{f' --cache {CACHE_DIR}' if CACHE_DIR is not None else ''} \ +--dma 0x{DMADATA_ADDR:X},{DMADATA_COUNT} \ +--compress {COMPRESS_INDICES}\ +{f' --threads {N_THREADS}' if N_THREADS > 0 else ''}\ +{f' --only-stdout' if STDOUT else ''}" print(cmd) - try: subprocess.check_call(cmd, shell=True) except subprocess.CalledProcessError as e: + # Return the same error code for the wrapper if z64compress fails sys.exit(e.returncode) diff --git a/undefined_syms.txt b/undefined_syms.txt index e3cb90acdc..ba74050c01 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -127,6 +127,11 @@ D_A4800018 = 0xA4800018; // SI_STATUS_REG gFramebuffer1 = 0x80000500; D_80025D00 = 0x80025D00; +// Ucode symbols + +rspbootTextSize = 0x160; +rspbootTextEnd = rspbootTextStart + rspbootTextSize; + // Segmented Addresses // segment 0x01 @@ -603,6 +608,24 @@ D_06011AB8 = 0x06011AB8; D_06012A80 = 0x06012A80; D_06013138 = 0x06013138; +// z_en_hy.c +D_0600007C = 0x0600007C; +D_0600066C = 0x0600066C; +D_0600071C = 0x0600071C; +D_060008C0 = 0x060008C0; +D_06000AB0 = 0x06000AB0; +D_06000FDC = 0x06000FDC; +D_06001494 = 0x06001494; +D_06001908 = 0x06001908; +D_06001EE0 = 0x06001EE0; +D_06005DC4 = 0x06005DC4; +D_06005D9C = 0x06005D9C; +D_0600DED8 = 0x0600DED8; +D_0600F920 = 0x0600F920; +D_0600FC1C = 0x0600FC1C; +D_0600FEE4 = 0x0600FEE4; +D_06010330 = 0x06010330; + // ovl_Arms_Hook D_0601D960 = 0x0601D960; @@ -3444,6 +3467,9 @@ D_06001384 = 0x06001384; D_06009890 = 0x06009890; D_0600A280 = 0x0600A280; D_0600AD98 = 0x0600AD98; +D_0600F8F0 = 0x0600F8F0; +D_0600FCF0 = 0x0600FCF0; +D_060100F0 = 0x060100F0; D_06011B60 = 0x06011B60; // ovl_En_Rg @@ -3846,9 +3872,25 @@ D_0600FEF0 = 0x0600FEF0; D_06001F90 = 0x06001F90; D_060020C8 = 0x060020C8; +D_06002BD8 = 0x06002BD8; +D_06003698 = 0x06003698; +D_0600446C = 0x0600446C; +D_06007FA0 = 0x06007FA0; +D_06009348 = 0x06009348; +D_0600EEDC = 0x0600EEDC; +D_0600F9A0 = 0x0600F9A0; +D_060108AC = 0x060108AC; +D_06011F88 = 0x06011F88; +D_06014728 = 0x06014728; +D_06015CA0 = 0x06015CA0; +D_06016B4C = 0x06016B4C; +D_06018FA0 = 0x06018FA0; +D_060197A0 = 0x060197A0; +D_06019FA0 = 0x06019FA0; D_0601A820 = 0x0601A820; D_0601A830 = 0x0601A830; D_0601AA60 = 0x0601AA60; +D_0601B5C4 = 0x0601B5C4; // ovl_En_Tru_Mt