diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 7659160564..699036d629 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,37 +1,86 @@ { "configurations": [ { - "name": "hackeroot-mq", - "compilerPath": "/usr/bin/gcc", + "name": "oot-ntsc-1.2", "compilerArgs": [ "-m32" ], - "intelliSenseMode": "gcc-x86", "includePath": [ "include", "include/libc", "src", - "build/hackeroot-mq", + "build/ntsc-1.2", ".", - "extracted/hackeroot-mq" + "extracted/ntsc-1.2" ], "defines": [ "_LANGUAGE_C", + "OOT_VERSION=NTSC_1_2", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=1", + "PLATFORM_GC=0", + "DEBUG_FEATURES=0", + "NDEBUG", + "F3DEX_GBI_2", "ENABLE_HACKEROOT=1", "RELEASE_ROM=0", - "COMPRESS_YAZ=1", - "OOT_VERSION=OOT_GC_EU_MQ_DBG", - "OOT_REGION=REGION_EU", - "OOT_PAL=1", - "OOT_MQ=1", - "OOT_DEBUG=1", + "COMPRESS_YAZ=1" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-jp", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-jp", + ".", + "extracted/gc-jp" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=GC_JP", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", + "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", - "GBI_DOWHILE", - "GBI_DEBUG" + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-jp-mq", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-jp-mq", + ".", + "extracted/gc-jp-mq" ], - "cStandard": "gnu89", - "cppStandard": "${default}" + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=GC_JP_MQ", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" }, { "name": "oot-gc-us", @@ -48,14 +97,38 @@ ], "defines": [ "_LANGUAGE_C", - "ENABLE_HACKEROOT=0", - "RELEASE_ROM=0", - "COMPRESS_YAZ=1", - "OOT_VERSION=OOT_GC_US", + "OOT_VERSION=GC_US", + "OOT_REGION=REGION_US", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, + { + "name": "oot-gc-us-mq", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-us-mq", + ".", + "extracted/gc-us-mq" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=GC_US_MQ", "OOT_REGION=REGION_US", - "OOT_NTSC=1", - "OOT_MQ=0", - "OOT_DEBUG=0", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -63,6 +136,33 @@ ], "cStandard": "gnu89" }, + { + "name": "oot-gc-eu-mq-dbg", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/gc-eu-mq-dbg", + ".", + "extracted/gc-eu-mq-dbg" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=GC_EU_MQ_DBG", + "OOT_REGION=REGION_EU", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=1", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE", + "GBI_DEBUG" + ], + "cStandard": "gnu89" + }, { "name": "oot-gc-eu", "compilerArgs": [ @@ -78,14 +178,11 @@ ], "defines": [ "_LANGUAGE_C", - "ENABLE_HACKEROOT=0", - "RELEASE_ROM=0", - "COMPRESS_YAZ=1", - "OOT_VERSION=OOT_GC_EU", + "OOT_VERSION=GC_EU", "OOT_REGION=REGION_EU", - "OOT_PAL=1", - "OOT_MQ=0", - "OOT_DEBUG=0", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -108,14 +205,11 @@ ], "defines": [ "_LANGUAGE_C", - "ENABLE_HACKEROOT=0", - "RELEASE_ROM=0", - "COMPRESS_YAZ=1", - "OOT_VERSION=OOT_GC_EU_MQ", + "OOT_VERSION=GC_EU_MQ", "OOT_REGION=REGION_EU", - "OOT_PAL=1", - "OOT_MQ=1", - "OOT_DEBUG=0", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -124,7 +218,7 @@ "cStandard": "gnu89" }, { - "name": "oot-gc-eu-mq-dbg", + "name": "oot-gc-jp-ce", "compilerArgs": [ "-m32" ], @@ -132,28 +226,54 @@ "include", "include/libc", "src", - "build/gc-eu-mq-dbg", + "build/gc-jp-ce", ".", - "extracted/gc-eu-mq-dbg" + "extracted/gc-jp-ce" + ], + "defines": [ + "_LANGUAGE_C", + "OOT_VERSION=GC_JP_CE", + "OOT_REGION=REGION_JP", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=0", + "NDEBUG", + "F3DEX_GBI_2", + "F3DEX_GBI_PL", + "GBI_DOWHILE" + ], + "cStandard": "gnu89" + }, + { + "name": "hackeroot", + "compilerArgs": [ + "-m32" + ], + "includePath": [ + "include", + "include/libc", + "src", + "build/hackeroot-mq", + ".", + "extracted/hackeroot-mq" ], "defines": [ "_LANGUAGE_C", - "ENABLE_HACKEROOT=0", - "RELEASE_ROM=0", - "COMPRESS_YAZ=1", "OOT_VERSION=OOT_GC_EU_MQ_DBG", "OOT_REGION=REGION_EU", - "OOT_PAL=1", - "OOT_MQ=1", - "OOT_DEBUG=1", + "PLATFORM_N64=0", + "PLATFORM_GC=1", + "DEBUG_FEATURES=1", + "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", "GBI_DOWHILE", - "GBI_DEBUG" + "ENABLE_HACKEROOT=1", + "RELEASE_ROM=0", + "COMPRESS_YAZ=1" ], "cStandard": "gnu89" } ], "version": 4 } - diff --git a/Dockerfile b/Dockerfile index 4f0095ed7d..70deb0ea4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & pkg-config \ python3 \ python3-pip \ + python3-venv \ git \ wget \ unzip \ diff --git a/Jenkinsfile b/Jenkinsfile index 38de3fab9e..1c10524d57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,10 +29,10 @@ pipeline { // The ROMs are built in an order that maximizes compiler flags coverage in a "fail fast" approach. // Specifically we start with a retail ROM for BSS ordering, and make sure we cover all of // N64/GC/NTSC/PAL/MQ/DEBUG as quickly as possible. - stage('Build ntsc-1.2') { + stage('Build ntsc-1.0') { steps { script { - build('ntsc-1.2', 'oot-ntsc-1.2-us.z64') + build('ntsc-1.0', 'oot-ntsc-1.0-us.z64') } } } @@ -64,6 +64,13 @@ pipeline { } } } + stage('Build ntsc-1.2') { + steps { + script { + build('ntsc-1.2', 'oot-ntsc-1.2-us.z64') + } + } + } stage('Build gc-us') { steps { script { @@ -99,6 +106,13 @@ pipeline { } } } + stage('Build ntsc-1.1') { + steps { + script { + build('ntsc-1.1', 'oot-ntsc-1.1-us.z64') + } + } + } stage('Build gc-us-mq') { steps { script { diff --git a/Makefile b/Makefile index 44ed14fa13..ee635a7184 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ COMPILER ?= gcc # Target game version. Ensure the corresponding input ROM is placed in baseroms/$(VERSION)/baserom.z64. # Currently the following versions are supported: +# ntsc-1.0 N64 NTSC 1.0 (Japan/US depending on REGION) +# ntsc-1.1 N64 NTSC 1.1 (Japan/US depending on REGION) # pal-1.0 N64 PAL 1.0 (Europe) # ntsc-1.2 N64 NTSC 1.2 (Japan/US depending on REGION) # pal-1.1 N64 PAL 1.1 (Europe) @@ -32,9 +34,6 @@ COMPILER ?= gcc # gc-eu-mq GameCube Europe/PAL Master Quest # gc-jp-ce GameCube Japan (Collector's Edition disc) # hackeroot-mq HackerOoT, based on gc-eu-mq-dbg (default) -# The following versions are work-in-progress and not yet matching: -# ntsc-1.0 N64 NTSC 1.0 (Japan/US depending on REGION) -# ntsc-1.1 N64 NTSC 1.1 (Japan/US depending on REGION) # # Note: choosing hackeroot-mq will enable HackerOoT features, # if another version is chosen, this repo will be like @@ -53,6 +52,11 @@ N64_EMULATOR ?= # Set to override game region in the ROM header (options: JP, US, EU). This can be used to build a fake US version # of the debug ROM for better emulator compatibility, or to build US versions of NTSC N64 ROMs. # REGION ?= US +# Set to enable debug features regardless of ROM version. +# Note that by enabling debug features on non-debug ROM versions, some debug ROM specific assets will not be included. +# This means the debug test scenes and some debug graphics in the elf_msg actors will not work as expected. +# This may also be used to disable debug features on debug ROMs by setting DEBUG_FEATURES to 0 +# DEBUG_FEATURES ?= 1 CFLAGS ?= CPPFLAGS ?= @@ -65,65 +69,63 @@ ifeq ($(VERSION),ntsc-1.0) REGIONAL_CHECKSUM := 1 REGION ?= JP PLATFORM := N64 - DEBUG := 0 - COMPARE := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),ntsc-1.1) REGIONAL_CHECKSUM := 1 REGION ?= JP PLATFORM := N64 - DEBUG := 0 - COMPARE := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),pal-1.0) REGION ?= EU PLATFORM := N64 - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),ntsc-1.2) REGIONAL_CHECKSUM := 1 REGION ?= JP PLATFORM := N64 - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),pal-1.1) REGION ?= EU PLATFORM := N64 - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-jp) REGION ?= JP PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-jp-mq) REGION ?= JP PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-us) REGION ?= US PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-us-mq) REGION ?= US PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-eu-mq-dbg) REGION ?= EU PLATFORM := GC - DEBUG := 1 + DEBUG_FEATURES ?= 1 else ifeq ($(VERSION),gc-eu) REGION ?= EU PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-eu-mq) REGION ?= EU PLATFORM := GC - DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),gc-jp-ce) REGION ?= JP PLATFORM := GC DEBUG := 0 + DEBUG_FEATURES ?= 0 else ifeq ($(VERSION),hackeroot-mq) REGION := NULL PLATFORM := GC - PAL := 1 - MQ := 1 DEBUG := 1 + DEBUG_FEATURES ?= 1 else $(error Unsupported version $(VERSION)) endif @@ -180,23 +182,24 @@ ifeq ($(VERSION),hackeroot-mq) OPTFLAGS := -Os ifeq ($(RELEASE),1) - CPP_DEFINES += -DRELEASE_ROM=1 -DOOT_DEBUG=0 - CFLAGS_IDO += -DOOT_DEBUG=0 + CPP_DEFINES += -DRELEASE_ROM=1 -DDEBUG_FEATURES=0 -DNDEBUG + CFLAGS_IDO += -DDEBUG_FEATURES=0 else - CPP_DEFINES += -DRELEASE_ROM=0 -DOOT_DEBUG=1 + CPP_DEFINES += -DRELEASE_ROM=0 -DDEBUG_FEATURES=1 endif else - ifeq ($(DEBUG),1) - CPP_DEFINES += -DOOT_DEBUG=1 + ifeq ($(DEBUG_FEATURES),1) + CPP_DEFINES += -DDEBUG_FEATURES=1 OPTFLAGS := -O2 else - CPP_DEFINES += -DNDEBUG -DOOT_DEBUG=0 + CPP_DEFINES += -DDEBUG_FEATURES=0 -DNDEBUG OPTFLAGS := -O2 -g3 endif CPP_DEFINES += -DENABLE_HACKEROOT=0 endif + # Override optimization flags if using GDB ifeq ($(ARES_GDB),1) OPTFLAGS := -Og -ggdb3 @@ -285,7 +288,7 @@ GBI_DEFINES := -DF3DEX_GBI_2 ifeq ($(PLATFORM),GC) GBI_DEFINES += -DF3DEX_GBI_PL -DGBI_DOWHILE endif -ifeq ($(DEBUG),1) +ifeq ($(DEBUG_FEATURES),1) GBI_DEFINES += -DGBI_DEBUG endif diff --git a/README.md b/README.md index 4767dff524..e49dd6545f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ It builds the following versions: | Name | Build timestamp | Description | MD5 hash of input ROM(s) | |--------------|-------------------|-------------------------------------------|--------------------------| +| ntsc-1.0 | 98-10-21 04:56:31 | NTSC 1.0 (Japan/US) | `9f04c8e68534b870f707c247fa4b50fc`
`5bd1fe107bf8106b2ab6650abecd54d6` | +| ntsc-1.1 | 98-10-26 10:58:45 | NTSC 1.1 (Japan/US) | `1bf5f42b98c3e97948f01155f12e2d88`
`721fdcc6f5f34be55c43a807f2a16af4` | | pal-1.0 | 98-11-10 14:34:22 | PAL 1.0 (Europe) | `e040de91a74b61e3201db0e2323f768a` | | ntsc-1.2 | 98-11-12 18:17:03 | NTSC 1.2 (Japan/US) | `2258052847bdd056c8406a9ef6427f13`
`57a9719ad547c516342e1a15d5c28c3d` | | pal-1.1 | 98-11-18 17:36:49 | PAL 1.1 (Europe) | `d714580dd74c2c033f5e1b6dc0aeac77` | diff --git a/assets/audio/sequences/seq_0.prg.seq b/assets/audio/sequences/seq_0.prg.seq index e2e51f5b7e..602ed791c6 100644 --- a/assets/audio/sequences/seq_0.prg.seq +++ b/assets/audio/sequences/seq_0.prg.seq @@ -2408,7 +2408,11 @@ CHAN_0EDC: .layer LAYER_1029 /* 0x1029 [0xC6 0x2F ] */ instr SF0_INST_47 +#if OOT_VERSION < PAL_1_0 +/* 0x102B [0xCB 0x66 0x4C 0xF0 ] */ env ENVELOPE_664C, 240 +#else /* 0x102B [0xCB 0x66 0x4C 0xFF ] */ env ENVELOPE_664C, 255 +#endif /* 0x102F [0x7E 0x0C 0x6C ] */ notedv PITCH_B5, FRAMERATE_CONST(12, 15), 108 /* 0x1032 [0xFF ] */ end diff --git a/assets/audio/sequences/seq_109.prg.seq b/assets/audio/sequences/seq_109.prg.seq index f4d4247e6a..49b0dfb606 100644 --- a/assets/audio/sequences/seq_109.prg.seq +++ b/assets/audio/sequences/seq_109.prg.seq @@ -603,7 +603,9 @@ LAYER_0452: /* 0x046C [0xE9 0x0E ] */ notepri 0, 14 /* 0x046E [0xE5 0x01 ] */ reverbidx 1 /* 0x0470 [0xD4 0x28 ] */ reverb 40 +#if OOT_VERSION >= PAL_1_0 /* 0x0472 [0xC6 0x00 ] */ font Soundfont_0_ID +#endif /* 0x0474 [0xFC 0x01 0x56 ] */ call CHAN_0156 /* 0x0477 [0xFD 0x60 ] */ delay 96 /* 0x0479 [0xFC 0x01 0x56 ] */ call CHAN_0156 @@ -1147,7 +1149,7 @@ ENVELOPE_08BA: point 20, 20000 hang -#if !OOT_PAL_N64 +#if OOT_VERSION == NTSC_1_2 || PLATFORM_GC .filter FILTER_0932 filter 0, 0, 0, 0, 0, 0, 0, 0 diff --git a/assets/xml/audio/samplebanks/SampleBank_0.xml b/assets/xml/audio/samplebanks/SampleBank_0.xml index e90a084930..5de4e44b12 100644 --- a/assets/xml/audio/samplebanks/SampleBank_0.xml +++ b/assets/xml/audio/samplebanks/SampleBank_0.xml @@ -1,433 +1,436 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/audio/samplebanks/SampleBank_2.xml b/assets/xml/audio/samplebanks/SampleBank_2.xml index 21e76424e2..05d2563d1a 100644 --- a/assets/xml/audio/samplebanks/SampleBank_2.xml +++ b/assets/xml/audio/samplebanks/SampleBank_2.xml @@ -1,4 +1,4 @@ - + diff --git a/assets/xml/audio/samplebanks/SampleBank_3.xml b/assets/xml/audio/samplebanks/SampleBank_3.xml index e6738f8b39..268db38821 100644 --- a/assets/xml/audio/samplebanks/SampleBank_3.xml +++ b/assets/xml/audio/samplebanks/SampleBank_3.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/assets/xml/audio/samplebanks/SampleBank_4.xml b/assets/xml/audio/samplebanks/SampleBank_4.xml index 8d68e285ff..11688e4bc7 100644 --- a/assets/xml/audio/samplebanks/SampleBank_4.xml +++ b/assets/xml/audio/samplebanks/SampleBank_4.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/assets/xml/audio/samplebanks/SampleBank_5.xml b/assets/xml/audio/samplebanks/SampleBank_5.xml index 6eb7356935..899efe7f9c 100644 --- a/assets/xml/audio/samplebanks/SampleBank_5.xml +++ b/assets/xml/audio/samplebanks/SampleBank_5.xml @@ -1,9 +1,9 @@ - - - - - - + + + + + + diff --git a/assets/xml/audio/samplebanks/SampleBank_6.xml b/assets/xml/audio/samplebanks/SampleBank_6.xml index e6971659b0..6b565dd112 100644 --- a/assets/xml/audio/samplebanks/SampleBank_6.xml +++ b/assets/xml/audio/samplebanks/SampleBank_6.xml @@ -1,10 +1,10 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/audio/soundfonts/Soundfont_10.xml b/assets/xml/audio/soundfonts/Soundfont_10.xml index 578101fd4d..126488b548 100644 --- a/assets/xml/audio/soundfonts/Soundfont_10.xml +++ b/assets/xml/audio/soundfonts/Soundfont_10.xml @@ -5,16 +5,19 @@ - + + + + - - - - + + + + diff --git a/assets/xml/scenes/dungeons/ydan.xml b/assets/xml/scenes/dungeons/ydan.xml index 465c5f0ca8..434f40a982 100644 --- a/assets/xml/scenes/dungeons/ydan.xml +++ b/assets/xml/scenes/dungeons/ydan.xml @@ -1,8 +1,8 @@ - - + + diff --git a/assets/xml/scenes/dungeons/ydan_mq.xml b/assets/xml/scenes/dungeons/ydan_mq.xml index c0a47d6dae..f982489d35 100644 --- a/assets/xml/scenes/dungeons/ydan_mq.xml +++ b/assets/xml/scenes/dungeons/ydan_mq.xml @@ -1,8 +1,8 @@ - - + + diff --git a/assets/xml/scenes/overworld/spot12.xml b/assets/xml/scenes/overworld/spot12.xml index 77b0cfb076..9f4efd31e8 100644 --- a/assets/xml/scenes/overworld/spot12.xml +++ b/assets/xml/scenes/overworld/spot12.xml @@ -2,8 +2,8 @@ - - + + diff --git a/assets/xml/scenes/overworld/spot12_pal_n64.xml b/assets/xml/scenes/overworld/spot12_pal_n64.xml index 09c16cb7c3..c771c2e825 100644 --- a/assets/xml/scenes/overworld/spot12_pal_n64.xml +++ b/assets/xml/scenes/overworld/spot12_pal_n64.xml @@ -2,8 +2,8 @@ - - + + diff --git a/data/z_text.data.s b/data/z_text.data.s index d2a76e0b8e..6efaf07205 100644 --- a/data/z_text.data.s +++ b/data/z_text.data.s @@ -1,4 +1,5 @@ .include "macro.inc" +#include "versions.h" /* assembler directives */ .set noat /* allow manual use of $at */ @@ -11,7 +12,7 @@ /* temporary file name, rename to something more appropriate when decompiled */ -#if OOT_DEBUG +#if DEBUG_ASSETS glabel gMojiFontTLUTs .incbin "incbin/gMojiFontTLUTs" diff --git a/docs/c_cpp_properties.json b/docs/c_cpp_properties.json index b863d21c63..c3e94325c2 100644 --- a/docs/c_cpp_properties.json +++ b/docs/c_cpp_properties.json @@ -19,7 +19,7 @@ "OOT_REGION=REGION_JP", "PLATFORM_N64=1", "PLATFORM_GC=0", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2" ], @@ -44,7 +44,7 @@ "OOT_REGION=REGION_JP", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -71,7 +71,7 @@ "OOT_REGION=REGION_JP", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -98,7 +98,7 @@ "OOT_REGION=REGION_US", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -125,7 +125,7 @@ "OOT_REGION=REGION_US", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -152,7 +152,7 @@ "OOT_REGION=REGION_EU", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=1", + "DEBUG_FEATURES=1", "F3DEX_GBI_2", "F3DEX_GBI_PL", "GBI_DOWHILE", @@ -179,7 +179,7 @@ "OOT_REGION=REGION_EU", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -206,7 +206,7 @@ "OOT_REGION=REGION_EU", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", @@ -233,7 +233,7 @@ "OOT_REGION=REGION_JP", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=0", + "DEBUG_FEATURES=0", "NDEBUG", "F3DEX_GBI_2", "F3DEX_GBI_PL", diff --git a/docs/libu64.md b/docs/libu64.md new file mode 100644 index 0000000000..34cc668c8c --- /dev/null +++ b/docs/libu64.md @@ -0,0 +1,77 @@ +# libu64 + +This document explains the reasoning behind organizing the libu64 files. + +libu64 is known about from the Animal Crossing (GameCube) map files. + +Here is the relevant excerpt from the Doubutsu no Mori+ 1.0 map file (for .text): + +``` + 00057f00 00043c 8005d4c0 1 .text libu64.a debug.c + UNUSED 000070 ........ f_debug_range_f libu64.a debug.c + UNUSED 00007c ........ _dbg_range libu64.a debug.c + UNUSED 000158 ........ _dbg_dump libu64.a debug.c + UNUSED 000048 ........ _dbg_array_error libu64.a debug.c + UNUSED 000054 ........ _dbg_bound libu64.a debug.c + UNUSED 000044 ........ _dbg_null libu64.a debug.c + UNUSED 000060 ........ _dbg_ptr libu64.a debug.c + UNUSED 000058 ........ _dbg_here libu64.a debug.c + 00057f00 00005c 8005d4c0 4 _dbg_hungup libu64.a debug.c + UNUSED 000004 ........ Reset libu64.a debug.c + 00057f5c 000b70 8005d51c 1 .text libu64.a gfxprint.c + 00057f5c 0002e8 8005d51c 4 gfxprint_setup libu64.a gfxprint.c + 00058244 00004c 8005d804 4 gfxprint_color libu64.a gfxprint.c + UNUSED 000024 ........ gfxprint_locate libu64.a gfxprint.c + 00058290 000024 8005d850 4 gfxprint_locate8x8 libu64.a gfxprint.c + UNUSED 000014 ........ gfxprint_setoffset libu64.a gfxprint.c + 000582b4 000378 8005d874 4 gfxprint_putc1 libu64.a gfxprint.c + 0005862c 000198 8005dbec 4 gfxprint_putc libu64.a gfxprint.c + UNUSED 000060 ........ gfxprint_write libu64.a gfxprint.c + UNUSED 000054 ........ gfxprint_puts libu64.a gfxprint.c + 000587c4 000064 8005dd84 4 gfxprint_prout libu64.a gfxprint.c + 00058828 000090 8005dde8 4 gfxprint_init libu64.a gfxprint.c + 000588b8 000004 8005de78 4 gfxprint_cleanup libu64.a gfxprint.c + 000588bc 00004c 8005de7c 4 gfxprint_open libu64.a gfxprint.c + 00058908 000038 8005dec8 4 gfxprint_close libu64.a gfxprint.c + UNUSED 000020 ........ gfxprint_vprintf libu64.a gfxprint.c + 00058940 000080 8005df00 4 gfxprint_printf libu64.a gfxprint.c + 000589c0 000000 8005df80 1 .text libu64.a gfxprint_data.c + 000589c0 000164 8005df80 1 .text libu64.a pad.c + UNUSED 000024 ........ pad_init libu64.a pad.c + UNUSED 000004 ........ pad_cleanup libu64.a pad.c + UNUSED 000010 ........ pad_flush libu64.a pad.c + UNUSED 000018 ........ pad_push_only libu64.a pad.c + UNUSED 00001c ........ pad_push_also libu64.a pad.c + UNUSED 00001c ........ pad_on_trigger libu64.a pad.c + UNUSED 00001c ........ pad_off_trigger libu64.a pad.c + UNUSED 000008 ........ pad_button libu64.a pad.c + UNUSED 000008 ........ pad_trigger libu64.a pad.c + UNUSED 00000c ........ pad_physical_stick_x libu64.a pad.c + UNUSED 00000c ........ pad_physical_stick_y libu64.a pad.c + UNUSED 000014 ........ pad_set_logical_stick libu64.a pad.c + UNUSED 00000c ........ pad_logical_stick_x libu64.a pad.c + UNUSED 00000c ........ pad_logical_stick_y libu64.a pad.c + UNUSED 00000c ........ pad_stick_x libu64.a pad.c + UNUSED 00000c ........ pad_stick_y libu64.a pad.c + 000589c0 000054 8005df80 4 pad_correct_stick libu64.a pad.c +``` + +This repository's `debug.c` (formerly `logutils.c`), `gfxprint.c` and `pad.c` (formerly `padutils.c`) line up with the map. + +Note `debug.c` has additional debug-only functions in gc-eu-mq-dbg, hinting that there were two versions of libu64, a debug version and a non-debug version. + +Additionally `debug.c`, `gfxprint.c` and `pad.c` all require compilation flags `-O2` (instead of `-O2 -g3`) to match, as supplementary evidence these were part of a separately compiled library. + +`-O2` is also required for most files between `gfxprint.c` and `pad.c` in the code segment (see spec), hinting that these other files (`loadfragment2_n64.c`, `loadfragment2_gc.c`, `mtxuty-cvt.c`, `relocation_gc.c`, `load_gc.c`, `code_800FC620.c`) are also part of libu64. + +Files `rcp_utils.c` and `logseverity_gc.c` do not strictly require `-O2`, but they do match with `-O2`. + +`padsetup.c` also requires `-O2`. + +On the other hand, the function `Overlay_Load` (in `loadfragment2_n64.c` or `load_gc.c` depending on game version) calls `DmaMgr_RequestSync`, a function that is not part of libu64. +This could suggest these files are not part of libu64, but the other evidence detailed above seems stronger. +It is also a possibility that libu64 expected users to provide the function, and it would have been an undefined symbol in the library. + +All in all this suggests all files in code between the audio code and libc64, are part of libu64. + +In the OoT boot segment, `stackcheck.c` is right next to `debug.c` and requires `-O2`: this hints `stackcheck.c` could be part of libu64 too. This is confirmed by looking at Majora's Mask n64-us, where `stackcheck.c` is in the middle of other libu64 files in the boot segment (see MM spec). diff --git a/docs/vscode.md b/docs/vscode.md index a7fd4d44ce..b63ab7b8ac 100644 --- a/docs/vscode.md +++ b/docs/vscode.md @@ -67,7 +67,7 @@ A more complete `c_cpp_properties.json` with configurations for all supported ve "OOT_REGION=REGION_EU", "PLATFORM_N64=0", "PLATFORM_GC=1", - "OOT_DEBUG=1", + "DEBUG_FEATURES=1", "F3DEX_GBI_2", "F3DEX_GBI_PL", "GBI_DOWHILE", diff --git a/include/attributes.h b/include/attributes.h index 0bee9c40ca..c3154cac7b 100644 --- a/include/attributes.h +++ b/include/attributes.h @@ -1,6 +1,8 @@ #ifndef ATTRIBUTES_H #define ATTRIBUTES_H +#include "versions.h" + #if !defined(__GNUC__) && !defined(__attribute__) #define __attribute__(x) #endif @@ -11,4 +13,17 @@ #define NO_REORDER __attribute__((no_reorder)) #define SECTION_DATA __attribute__((section(".data"))) +#ifdef __GNUC__ +#define UNREACHABLE() __builtin_unreachable() +#else +#define UNREACHABLE() +#endif + +// Variables may be unused in retail versions but used in debug versions +#if DEBUG_FEATURES +#define UNUSED_NDEBUG +#else +#define UNUSED_NDEBUG UNUSED +#endif + #endif diff --git a/include/cic6105.h b/include/cic6105.h index 43ffcc4f98..c4983db8f5 100644 --- a/include/cic6105.h +++ b/include/cic6105.h @@ -3,7 +3,7 @@ #include "ultra64.h" -extern s32 B_80008EE0; +extern u32 B_80008EE0; void func_800014E8(void); void CIC6105_AddFaultClient(void); diff --git a/include/config/config_debug.h b/include/config/config_debug.h index 4f53a963a7..fe66ceba96 100644 --- a/include/config/config_debug.h +++ b/include/config/config_debug.h @@ -59,12 +59,6 @@ */ // #define FIX_GROTTO_CRASH false -/** - * Disable every debug feature - * This will enable Jumper pak compatibility - */ -#define DISABLE_DEBUG_FEATURES false - /** * Disable autoscroll on crash debugger */ diff --git a/include/config/config_memory.h b/include/config/config_memory.h index a82e53197f..76bf698caa 100644 --- a/include/config/config_memory.h +++ b/include/config/config_memory.h @@ -83,13 +83,21 @@ /** * @brief Space allocated for the Debug buffer. */ +#if DEBUG_FEATURES #define DEBUG_BUFFER_SIZE 0xC00 +#else +#define DEBUG_BUFFER_SIZE 0x20 +#endif /** * @brief Vanilla value is 0x8044BE80. Make this a little larger to * account for greater memory usage in other areas. Required for most * of the following memory increases to actually work. */ +#if IS_DEBUG_HEAP_ENABLED +#define SYS_CFB_END 0x8044BE80 +#else #define SYS_CFB_END 0x80800000 +#endif #endif diff --git a/include/config/config_safeguards.h b/include/config/config_safeguards.h index cdc7f38fb4..dd871b7ab4 100644 --- a/include/config/config_safeguards.h +++ b/include/config/config_safeguards.h @@ -18,16 +18,16 @@ #undef BOOT_TO_SCENE #undef BOOT_TO_SCENE_NEW_GAME_ONLY #undef BOOT_TO_FILE_SELECT - #undef DISABLE_DEBUG_FEATURES + #undef DEBUG_FEATURES #define SKIP_N64_BOOT_LOGO false #define BOOT_TO_SCENE false #define BOOT_TO_SCENE_NEW_GAME_ONLY false #define BOOT_TO_FILE_SELECT false - #define DISABLE_DEBUG_FEATURES true + #define DEBUG_FEATURES false #endif -#if DISABLE_DEBUG_FEATURES +#if !DEBUG_FEATURES #undef SHOW_CS_INFOS #undef SHOW_INPUT_DISPLAY #undef SHOW_TIME_INFOS @@ -155,7 +155,7 @@ #undef BOOT_TO_SCENE #undef BOOT_TO_SCENE_NEW_GAME_ONLY #undef BOOT_TO_FILE_SELECT - #undef DISABLE_DEBUG_FEATURES + #undef DEBUG_FEATURES #undef SHOW_CS_INFOS #undef SHOW_INPUT_DISPLAY #undef SHOW_TIME_INFOS @@ -179,7 +179,7 @@ #define BOOT_TO_SCENE false #define BOOT_TO_SCENE_NEW_GAME_ONLY false #define BOOT_TO_FILE_SELECT false - #define DISABLE_DEBUG_FEATURES false + #define DEBUG_FEATURES false #define SHOW_CS_INFOS false #define SHOW_INPUT_DISPLAY false #define SHOW_TIME_INFOS false @@ -200,15 +200,6 @@ #define ENABLE_MOTION_BLUR_DEBUG false #endif -/** - * Used in if statements -*/ -#if ENABLE_HACKEROOT -#define IS_DEBUG (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) -#else -#define IS_DEBUG OOT_DEBUG -#endif - #if ENABLE_PROFILER && !ENABLE_HACKER_DEBUG #error "ENABLE_PROFILER requires ENABLE_HACKER_DEBUG" #endif @@ -223,28 +214,29 @@ */ // General features -#define IS_DEBUG_HEAP_ENABLED (IS_DEBUG && ENABLE_DEBUG_HEAP) -#define IS_NO_CLIP_ENABLED (IS_DEBUG && ENABLE_NO_CLIP) -#define CAN_SHOW_INPUT_DISPLAY (IS_DEBUG && SHOW_INPUT_DISPLAY) -#define CAN_SHOW_CS_INFOS (IS_DEBUG && SHOW_CS_INFOS) -#define IS_CS_CONTROL_ENABLED (IS_DEBUG && ENABLE_CS_CONTROL) +#define IS_DEBUG_HEAP_ENABLED (DEBUG_FEATURES && ENABLE_DEBUG_HEAP) +#define IS_NO_CLIP_ENABLED (DEBUG_FEATURES && ENABLE_NO_CLIP) +#define CAN_SHOW_INPUT_DISPLAY (DEBUG_FEATURES && SHOW_INPUT_DISPLAY) +#define CAN_SHOW_CS_INFOS (DEBUG_FEATURES && SHOW_CS_INFOS) +#define IS_CS_CONTROL_ENABLED (DEBUG_FEATURES && ENABLE_CS_CONTROL) #define CS_CAN_SKIP_TITLE_SCREEN (IS_CS_CONTROL_ENABLED && CS_CTRL_SKIP_TITLE_SCREEN) -#define CAN_SHOW_TIME_INFOS (IS_DEBUG && SHOW_TIME_INFOS) -#define ARE_FRAMERATE_OPTIONS_ENABLED (IS_DEBUG && ENABLE_FRAMERATE_OPTIONS) -#define IS_MAP_SELECT_ENABLED (IS_DEBUG && ENABLE_MAP_SELECT) -#define IS_DEBUG_SAVE_ENABLED (IS_DEBUG && ENABLE_DEBUG_SAVE) -#define CAN_INCLUDE_TEST_SCENES (IS_DEBUG && INCLUDE_TEST_SCENES) +#define CAN_SHOW_TIME_INFOS (DEBUG_FEATURES && SHOW_TIME_INFOS) +#define ARE_FRAMERATE_OPTIONS_ENABLED (DEBUG_FEATURES && ENABLE_FRAMERATE_OPTIONS) +#define IS_MAP_SELECT_ENABLED (DEBUG_FEATURES && ENABLE_MAP_SELECT) +#define IS_DEBUG_SAVE_ENABLED (DEBUG_FEATURES && ENABLE_DEBUG_SAVE) +#define CAN_INCLUDE_TEST_SCENES (DEBUG_ASSETS && INCLUDE_TEST_SCENES) +#define CAN_INCLUDE_EXAMPLE_SCENE (DEBUG_ASSETS && INCLUDE_EXAMPLE_SCENE) // In-game editors -#define IS_INV_EDITOR_ENABLED (IS_DEBUG && ENABLE_INV_EDITOR) -#define IS_EVENT_EDITOR_ENABLED (IS_DEBUG && ENABLE_EVENT_EDITOR) -#define IS_REG_EDITOR_ENABLED (IS_DEBUG && ENABLE_REG_EDITOR) +#define IS_INV_EDITOR_ENABLED (DEBUG_FEATURES && ENABLE_INV_EDITOR) +#define IS_EVENT_EDITOR_ENABLED (DEBUG_FEATURES && ENABLE_EVENT_EDITOR) +#define IS_REG_EDITOR_ENABLED (DEBUG_FEATURES && ENABLE_REG_EDITOR) // In-game debuggers -#define IS_CAMERA_DEBUG_ENABLED (IS_DEBUG && ENABLE_CAMERA_DEBUGGER) -#define IS_AUDIO_DEBUG_ENABLED (IS_DEBUG && ENABLE_AUDIO_DEBUGGER) -#define IS_ACTOR_DEBUG_ENABLED (IS_DEBUG && ENABLE_ACTOR_DEBUGGER) -#define IS_MSG_DEBUG_ENABLED (IS_DEBUG && ENABLE_MSG_DEBUGGER) +#define IS_CAMERA_DEBUG_ENABLED (DEBUG_FEATURES && ENABLE_CAMERA_DEBUGGER) +#define IS_AUDIO_DEBUG_ENABLED (DEBUG_FEATURES && ENABLE_AUDIO_DEBUGGER) +#define IS_ACTOR_DEBUG_ENABLED (DEBUG_FEATURES && ENABLE_ACTOR_DEBUGGER) +#define IS_MSG_DEBUG_ENABLED (DEBUG_FEATURES && ENABLE_MSG_DEBUGGER) /** * Compression diff --git a/include/functions.h b/include/functions.h index 1e94ddb2dc..49713b7c03 100644 --- a/include/functions.h +++ b/include/functions.h @@ -11,17 +11,17 @@ void ViConfig_UpdateVi(u32 black); void ViConfig_UpdateBlack(void); void Locale_Init(void); void Locale_ResetRegion(void); -#if IS_DEBUG +#if DEBUG_FEATURES void isPrintfInit(void); #endif void rmonPrintf(const char* fmt, ...); -#if IS_DEBUG +#if DEBUG_FEATURES void* is_proutSyncPrintf(void* arg, const char* str, size_t count); NORETURN void func_80002384(const char* exp, const char* file, int line); #endif OSPiHandle* osDriveRomInit(void); void Mio0_Decompress(u8* src, u8* dst); -#if IS_DEBUG +#if DEBUG_FEATURES void LogUtils_LogHexDump(void* ptr, s32 size0); void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line); void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line); @@ -46,7 +46,9 @@ s32 func_800635D0(s32); void Regs_Init(void); void DebugCamera_ScreenText(u8 x, u8 y, const char* text); // ENABLE_NO_CLIP void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); // ENABLE_CAMERA_DEBUGGER +#if DEBUG_FEATURES void Regs_UpdateEditor(Input* input); // ENABLE_REG_EDITOR +#endif void Debug_DrawText(GraphicsContext* gfxCtx); // ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR void DebugDisplay_Init(void); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, @@ -228,7 +230,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g void GameState_Destroy(GameState* gameState); GameStateFunc GameState_GetInit(GameState* gameState); u32 GameState_IsRunning(GameState* gameState); -#if IS_DEBUG +#if DEBUG_FEATURES void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line); void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); #endif @@ -272,7 +274,7 @@ void DebugArena_Check(void); void DebugArena_Init(void* start, u32 size); void DebugArena_Cleanup(void); s32 DebugArena_IsInitialized(void); -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); void* DebugArena_MallocDebug(u32 size, const char* file, int line); void* DebugArena_MallocRDebug(u32 size, const char* file, int line); diff --git a/include/gfx.h b/include/gfx.h index 72c3793438..a692902494 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -17,7 +17,7 @@ typedef struct GfxPool { /* 0x0BF08 */ Gfx polyXluBuffer[POLY_XLU_BUFFER_SIZE]; /* 0x0FF08 */ Gfx overlayBuffer[OVERLAY_BUFFER_SIZE]; /* 0x11F08 */ Gfx workBuffer[WORK_BUFFER_SIZE]; - /* 0x11308 */ Gfx debugBuffer[IS_DEBUG ? DEBUG_BUFFER_SIZE : 0x20]; + /* 0x11308 */ Gfx debugBuffer[DEBUG_BUFFER_SIZE]; /* 0x12408 */ u16 tailMagic; // GFXPOOL_TAIL_MAGIC } GfxPool; // size = 0x12410 @@ -52,7 +52,7 @@ typedef struct GraphicsContext { /* 0x02F4 */ f32 xScale; /* 0x02F8 */ f32 yScale; #endif -#if IS_DEBUG +#if DEBUG_FEATURES /* 0x02FC */ Gfx* debugBuffer; TwoHeadGfxArena debug; #endif @@ -83,7 +83,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); #define OVERLAY_DISP __gfxCtx->overlay.p #define DEBUG_DISP __gfxCtx->debug.p -#if IS_DEBUG +#if DEBUG_FEATURES void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); diff --git a/include/libc64/malloc.h b/include/libc64/malloc.h index 9acee66097..86b58d17ca 100644 --- a/include/libc64/malloc.h +++ b/include/libc64/malloc.h @@ -15,7 +15,7 @@ void SystemArena_Init(void* start, u32 size); void SystemArena_Cleanup(void); s32 SystemArena_IsInitialized(void); -#if IS_DEBUG +#if DEBUG_FEATURES void* SystemArena_MallocDebug(u32 size, const char* file, int line); void* SystemArena_MallocRDebug(u32 size, const char* file, int line); void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); diff --git a/include/libc64/os_malloc.h b/include/libc64/os_malloc.h index e31a6f08fa..91b0d93c47 100644 --- a/include/libc64/os_malloc.h +++ b/include/libc64/os_malloc.h @@ -25,7 +25,7 @@ typedef struct ArenaNode { /* 0x04 */ u32 size; /* 0x08 */ struct ArenaNode* next; /* 0x0C */ struct ArenaNode* prev; -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES /* 0x10 */ const char* filename; /* 0x14 */ int line; /* 0x18 */ OSId threadId; @@ -57,15 +57,19 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize); void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc); s32 __osCheckArena(Arena* arena); -#if OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line); void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line); void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line); void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line); -void __osDisplayArena(Arena* arena); +#endif +#if PLATFORM_GC && DEBUG_FEATURES +void __osDisplayArena(Arena* arena); extern u32 __osMalloc_FreeBlockTest_Enable; -#else +#endif + +#if PLATFORM_N64 extern u32 gTotalAllocFailures; #endif diff --git a/include/macros.h b/include/macros.h index e3cce94ab6..24c5775846 100644 --- a/include/macros.h +++ b/include/macros.h @@ -49,7 +49,7 @@ // ensure that these do not use the IDO workaround to avoid errors. #define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX) -#if IS_DEBUG +#if DEBUG_FEATURES #define PRINTF osSyncPrintf #elif IDO_PRINTF_WORKAROUND #define PRINTF(args) (void)0 @@ -57,7 +57,7 @@ #define PRINTF(format, ...) (void)0 #endif -#if IS_DEBUG +#if DEBUG_FEATURES #define LOG(exp, value, format, ...) \ do { \ LogUtils_LogThreadId(__FILE__, __LINE__); \ @@ -83,7 +83,7 @@ (state)->size = sizeof(newStruct); \ } while (0) -#if IS_DEBUG +#if DEBUG_FEATURES #define DMA_REQUEST_SYNC(ram, vrom, size, ...) DmaMgr_RequestSyncDebug(ram, vrom, size, __FILE__, __LINE__) #define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, ...) DmaMgr_RequestAsyncDebug(req, ram, vrom, size, unk5, queue, msg, __FILE__, __LINE__) @@ -113,9 +113,9 @@ #define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, ...) (void)0 #define GAME_ALLOC_MALLOC(alloc, size, ...) GameAlloc_Malloc(alloc, size) -#endif /* IS_DEBUG */ +#endif /* DEBUG_FEATURES */ -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES #define HUNGUP_AND_CRASH(...) Fault_AddHungupAndCrash(__FILE__, __LINE__) #else #define HUNGUP_AND_CRASH(...) LogUtils_HungupThread(__FILE__, __LINE__) @@ -169,7 +169,7 @@ _DW({ \ // HackerOoT -#if IS_DEBUG +#if DEBUG_FEATURES // if using button combo check for the input, else simply return true #define DEBUG_BTN_COMBO(useCombo, btnToHold, btnToPress, input) ((useCombo ? CHECK_BTN_ALL(input->cur.button, btnToHold) : true) && CHECK_BTN_ALL(input->press.button, btnToPress)) #else diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 2d4da158cc..6912df33fc 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -92,7 +92,7 @@ DECLARE_ROM_SEGMENT(debug) DECLARE_BSS_SEGMENT(debug) #endif -// N64-only, not wrapped in these are not wrapped in an `#if PLATFORM_N64` +// N64-only, these are not wrapped in an `#if PLATFORM_N64` // so that the N64DD code can always be built. DECLARE_SEGMENT(n64dd) DECLARE_ROM_SEGMENT(n64dd) @@ -662,8 +662,9 @@ DECLARE_ROM_SEGMENT(spot20_room_0) DECLARE_ROM_SEGMENT(ganon_tou_room_0) -// Room symbols for compiling test scenes, these are not wrapped in an `#if OOT_DEBUG` -// so that debug ROMs (including gc-eu-mq-dbg) can be built with OOT_DEBUG=0. +// Room symbols for compiling test scenes. +// These are not wrapped in an `#if DEBUG_ASSETS` so that debug ROMs +// can be built with DEBUG_ASSETS=0 (e.g. when DEBUG_FEATURES=0) DECLARE_ROM_SEGMENT(test01_room_0) diff --git a/include/sfx.h b/include/sfx.h index d58a498095..47a449e9c4 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -123,7 +123,7 @@ typedef struct SfxParams { u16 params; } SfxParams; -#if IS_DEBUG +#if DEBUG_FEATURES #define SFX_DIST_SCALING 1.0f #else #define SFX_DIST_SCALING 10.0f diff --git a/include/sys_matrix.h b/include/sys_matrix.h index eb1764a16a..2cd8ce1910 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -43,7 +43,7 @@ void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); -#if IS_DEBUG +#if DEBUG_FEATURES Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line); Mtx* Matrix_Finalize(struct GraphicsContext* gfxCtx, const char* file, int line); diff --git a/include/tables/dmadata_table.h b/include/tables/dmadata_table.h index 02f55a9cf1..59ee90adae 100644 --- a/include/tables/dmadata_table.h +++ b/include/tables/dmadata_table.h @@ -1,3 +1,5 @@ +#include "versions.h" + /** * Select dmadata table for version */ diff --git a/include/tables/entrance_table.h b/include/tables/entrance_table.h index 9ddc36d798..2717b41fd0 100644 --- a/include/tables/entrance_table.h +++ b/include/tables/entrance_table.h @@ -1945,7 +1945,7 @@ /* 0x612 */ DEFINE_ENTRANCE(ENTR_DESERT_COLOSSUS_8_2, SCENE_DESERT_COLOSSUS, 8, false, true, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE) /* 0x613 */ DEFINE_ENTRANCE(ENTR_DESERT_COLOSSUS_8_3, SCENE_DESERT_COLOSSUS, 8, false, true, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE) -#if INCLUDE_EXAMPLE_SCENE +#if CAN_INCLUDE_EXAMPLE_SCENE /* 0x614 */ DEFINE_ENTRANCE(ENTR_EXAMPLE_0, SCENE_EXAMPLE, 0, false, true, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE) /* 0x615 */ DEFINE_ENTRANCE(ENTR_EXAMPLE_0_1, SCENE_EXAMPLE, 0, false, true, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE) /* 0x616 */ DEFINE_ENTRANCE(ENTR_EXAMPLE_0_2, SCENE_EXAMPLE, 0, false, true, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE) diff --git a/include/tables/scene_table.h b/include/tables/scene_table.h index 943b621f08..9d9da91289 100644 --- a/include/tables/scene_table.h +++ b/include/tables/scene_table.h @@ -123,6 +123,6 @@ /* 0x6D */ DEFINE_SCENE(testroom_scene, none, SCENE_TESTROOM, SDC_DEFAULT, 0, 0) #endif -#if INCLUDE_EXAMPLE_SCENE +#if CAN_INCLUDE_EXAMPLE_SCENE /* 0x6C */ DEFINE_SCENE(example_scene, none, SCENE_EXAMPLE, SDC_HAUNTED_WASTELAND, 0, 0) #endif diff --git a/include/ultra64/viint.h b/include/ultra64/viint.h index 4fea2259a2..6fbdb023df 100644 --- a/include/ultra64/viint.h +++ b/include/ultra64/viint.h @@ -17,21 +17,23 @@ // For use in initializing OSViMode structures #define BURST(hsync_width, color_width, vsync_width, color_start) \ - (hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20)) -#define WIDTH(v) v -#define VSYNC(v) v -#define HSYNC(duration, leap) (duration | (leap << 16)) -#define LEAP(upper, lower) ((upper << 16) | lower) -#define START(start, end) ((start << 16) | end) - -#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1)) - + ((((u8)(hsync_width) & 0xFF) << 0) | \ + (((u8)(color_width) & 0xFF) << 8) | \ + (((u8)(vsync_width) & 0xF) << 16) | \ + (((u16)(color_start) & 0xFFF) << 20)) +#define WIDTH(v) (v) +#define VSYNC(v) (v) +#define HSYNC(duration, leap) (((u16)(leap) << 16) | (u16)(duration)) +#define LEAP(upper, lower) (((u16)(upper) << 16) | (u16)(lower)) +#define START(start, end) (((u16)(start) << 16) | (u16)(end)) + +#define FTOFIX(val, i, f) ((u32)((val) * (f32)(1 << (f))) & ((1 << ((i) + (f))) - 1)) #define F210(val) FTOFIX(val, 2, 10) -#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16)) +#define SCALE(scaleup, off) (F210(1.0f / (f32)(scaleup)) | (F210((f32)(off)) << 16)) -#define VCURRENT(v) v -#define ORIGIN(v) v -#define VINTR(v) v -#define HSTART START +#define VCURRENT(v) (v) +#define ORIGIN(v) (v) +#define VINTR(v) (v) +#define HSTART(start, end) START(start, end) #endif diff --git a/include/unk.h b/include/unk.h index e28f2bd8cd..f8498b72dd 100644 --- a/include/unk.h +++ b/include/unk.h @@ -11,6 +11,9 @@ #define UNK_FUN_PTR(name) void(*name)(void) #define UNK_ARGS #define UNK_SIZE 1 -#define UNK_LINE 1 + +// Unknown filename and line number for debug macros +#define UNK_FILE "" +#define UNK_LINE 0 #endif diff --git a/include/variables.h b/include/variables.h index c4bc14be74..180ef347ae 100644 --- a/include/variables.h +++ b/include/variables.h @@ -81,7 +81,7 @@ extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" extern u64 gMojiFontTex[]; // original name: "font_ff" extern u8 gBossMarkState; -#if IS_DEBUG +#if DEBUG_FEATURES extern u32 gIsCtrlr2Valid; #endif extern s16* gWaveSamples[9]; @@ -121,19 +121,17 @@ extern u16 D_801333D0; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; - -// ENABLE_AUDIO_DEBUGGER +#if IS_AUDIO_DEBUG_ENABLED extern u8 D_801333F0; extern u8 gAudioSfxSwapOff; extern u8 D_801333F8; - +#endif extern u8 gSeqCmdWritePos; extern u8 gSeqCmdReadPos; extern u8 gStartSeqDisabled; - -// ENABLE_AUDIO_DEBUGGER +#if IS_AUDIO_DEBUG_ENABLED extern u8 gAudioDebugPrintSeqCmd; - +#endif extern u8 gSoundModeList[]; extern u8 gAudioSpecId; extern u8 D_80133418; diff --git a/include/versions.h b/include/versions.h index 778e28d93c..96ae716f06 100644 --- a/include/versions.h +++ b/include/versions.h @@ -46,4 +46,13 @@ #define FRAMERATE_CONST(value60Hz, value50Hz) (value50Hz) #endif +// Debug Assets +// Due to asset extraction limitations, all versions will not have access to some assets present in debug ROMs +// To allow the inclusion of debug features in any version there is a separation between DEBUG_FEATURES and DEBUG_ASSETS +#if OOT_VERSION == GC_EU_MQ_DBG && DEBUG_FEATURES +#define DEBUG_ASSETS 1 +#else +#define DEBUG_ASSETS 0 +#endif + #endif diff --git a/include/z64.h b/include/z64.h index 72f98e7b20..fe22fe1592 100644 --- a/include/z64.h +++ b/include/z64.h @@ -419,12 +419,18 @@ ALIGNED(4) typedef struct PreNmiBuff { } PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused) typedef enum ViModeEditState { +#if OOT_VERSION < PAL_1_0 /* -2 */ VI_MODE_EDIT_STATE_NEGATIVE_2 = -2, /* -1 */ VI_MODE_EDIT_STATE_NEGATIVE_1, + /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, + /* 1 */ VI_MODE_EDIT_STATE_2, // active, more adjustments + /* 2 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode +#else /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, /* 1 */ VI_MODE_EDIT_STATE_ACTIVE, /* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments /* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode +#endif } ViModeEditState; typedef struct ViMode { diff --git a/include/z64actor.h b/include/z64actor.h index 7c908f4c4a..deac35481c 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -14,6 +14,13 @@ #define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC colliders #define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass. +// These are default parameters used for "animation fidgeting", which procedurally generate actor idle animations. +// These calculations may be performed within individual actors, or by using fidget tables with `Actor_UpdateFidgetTables`. +#define FIDGET_FREQ_Y 0x814 +#define FIDGET_FREQ_Z 0x940 +#define FIDGET_FREQ_LIMB 0x32 +#define FIDGET_AMPLITUDE 200.0f + struct Actor; struct ActorEntry; struct CollisionPoly; @@ -41,7 +48,7 @@ typedef struct ActorProfile { /** * @see ACTOROVL_ALLOC_ABSOLUTE */ -#if IS_DEBUG +#if DEBUG_FEATURES #define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 #else #define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 @@ -140,26 +147,32 @@ typedef struct ActorShape { // Actor will retain this flag until `Actor_TalkOfferAccepted` is called or manually turned off by the actor #define ACTOR_FLAG_TALK (1 << 8) -// -#define ACTOR_FLAG_9 (1 << 9) +// When the hookshot attaches to this actor, the actor will be pulled back as the hookshot retracts. +#define ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR (1 << 9) -// -#define ACTOR_FLAG_10 (1 << 10) +// When the hookshot attaches to this actor, Player will be pulled by the hookshot and fly to the actor. +#define ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER (1 << 10) -// -#define ACTOR_FLAG_ENKUSA_CUT (1 << 11) +// A clump of grass (EN_KUSA) has been destroyed. +// This flag is used to communicate with the spawner actor (OBJ_MURE). +#define ACTOR_FLAG_GRASS_DESTROYED (1 << 11) // Actor will not shake when a quake occurs #define ACTOR_FLAG_IGNORE_QUAKE (1 << 12) +// The hookshot is currently attached to this actor. +// The behavior that occurs after attachment is determined by `ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR` and `ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER`. +// If neither of those flags are set attachment cannot occur, and the hookshot will simply act as a damage source. // -#define ACTOR_FLAG_13 (1 << 13) +// This flag is also reused to indicate that an actor is attached to the boomerang. +// This only has an effect for Gold Skulltula Tokens (EN_SI) which has overlapping behavior for hookshot and boomerang. +#define ACTOR_FLAG_HOOKSHOT_ATTACHED (1 << 13) -// -#define ACTOR_FLAG_14 (1 << 14) +// When hit by an arrow, the actor will be able to attach to the arrow and fly with it in the air +#define ACTOR_FLAG_CAN_ATTACH_TO_ARROW (1 << 14) -// -#define ACTOR_FLAG_15 (1 << 15) +// Actor is currently attached to an arrow and flying with it in the air +#define ACTOR_FLAG_ATTACHED_TO_ARROW (1 << 15) // Player automatically accepts a Talk Offer without needing to press the A button. // Player still has to meet all conditions to be able to receive a talk offer (for example, being in range). @@ -188,14 +201,17 @@ typedef struct ActorShape { // Typically an actor can only be thrown when moving, but this allows an actor to be thrown when standing still. #define ACTOR_FLAG_THROW_ONLY (1 << 23) -// -#define ACTOR_FLAG_24 (1 << 24) +// When colliding with Player's body AC collider, a "thump" sound will play indicating his body has been hit +#define ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT (1 << 24) -// -#define ACTOR_FLAG_25 (1 << 25) +// Actor can update even if Player is currently using the ocarina. +// Typically an actor will halt while the ocarina is active (depending on category). +// This flag allows a given actor to be an exception. +#define ACTOR_FLAG_UPDATE_DURING_OCARINA (1 << 25) -// -#define ACTOR_FLAG_26 (1 << 26) +// Actor can press and hold down switches. +// See usages of `DynaPolyActor_SetSwitchPressed` and `DynaPolyActor_IsSwitchPressed` for more context on how switches work. +#define ACTOR_FLAG_CAN_PRESS_SWITCHES (1 << 26) // Player is not able to lock onto the actor. // Navi will still be able to hover over the actor, assuming `ACTOR_FLAG_ATTENTION_ENABLED` is set. @@ -283,7 +299,7 @@ typedef struct Actor { /* 0x130 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll` /* 0x134 */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw` /* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor -#if IS_DEBUG +#if DEBUG_FEATURES /* 0x13C */ char dbgPad[0x10]; #endif } Actor; // size = 0x14C @@ -309,7 +325,7 @@ if neither of the above are set : blue #define DYNA_INTERACT_ACTOR_ON_TOP (1 << 0) // There is an actor standing on the collision of the dynapoly actor #define DYNA_INTERACT_PLAYER_ON_TOP (1 << 1) // The player actor is standing on the collision of the dynapoly actor #define DYNA_INTERACT_PLAYER_ABOVE (1 << 2) // The player is directly above the collision of the dynapoly actor (any distance above) -#define DYNA_INTERACT_3 (1 << 3) // Like the ACTOR_ON_TOP flag but only actors with ACTOR_FLAG_26 +#define DYNA_INTERACT_ACTOR_SWITCH_PRESSED (1 << 3) // An actor that is capable of pressing switches is on top of the dynapoly actor typedef struct DynaPolyActor { /* 0x000 */ struct Actor actor; @@ -739,6 +755,10 @@ typedef struct NpcInteractInfo { #define PARAMS_GET_NOSHIFT(p, s, n) \ ((p) & (NBITS_TO_MASK(n) << (s))) +// Moves the `n`-bit value `p` to bit position `s` for building actor parameters by OR-ing these together +#define PARAMS_PACK(p, s, n) \ + (((p) & NBITS_TO_MASK(n)) << (s)) + // Generates a bitmask for bit position `s` of length `n` #define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n) @@ -802,7 +822,7 @@ int func_8002DD6C(struct Player* player); int func_8002DD78(struct Player* player); s32 func_8002DDE4(struct PlayState* play); s32 func_8002DDF4(struct PlayState* play); -void func_8002DE04(struct PlayState* play, Actor* actorA, Actor* actorB); +void Actor_SwapHookshotAttachment(struct PlayState* play, Actor* srcActor, Actor* destActor); void func_8002DE74(struct PlayState* play, struct Player* player); void Actor_MountHorse(struct PlayState* play, struct Player* player, Actor* horse); int func_8002DEEC(struct Player* player); @@ -913,7 +933,7 @@ void func_80034BA0(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3); -void func_80034F54(struct PlayState* play, s16* arg1, s16* arg2, s32 arg3); +void Actor_UpdateFidgetTables(struct PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen); void Actor_Noop(Actor* actor, struct PlayState* play); void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist); diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 1164abadbd..521a97aa26 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -467,7 +467,7 @@ u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_80042708(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* point, Vec3f* closestPoint); s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); -#if IS_DEBUG +#if DEBUG_FEATURES void BgCheck_DrawDynaCollision(struct PlayState*, CollisionContext*); void BgCheck_DrawStaticCollision(struct PlayState*, CollisionContext*); #endif @@ -479,11 +479,11 @@ void DynaPolyActor_UnsetAllInteractFlags(struct DynaPolyActor* dynaActor); void DynaPolyActor_SetActorOnTop(struct DynaPolyActor* dynaActor); void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId); void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId); -void func_80043538(struct DynaPolyActor* dynaActor); +void DynaPolyActor_SetSwitchPressed(struct DynaPolyActor* dynaActor); s32 DynaPolyActor_IsActorOnTop(struct DynaPolyActor* dynaActor); s32 DynaPolyActor_IsPlayerOnTop(struct DynaPolyActor* dynaActor); s32 DynaPolyActor_IsPlayerAbove(struct DynaPolyActor* dynaActor); -s32 func_800435B4(struct DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsSwitchPressed(struct DynaPolyActor* dynaActor); s32 func_800435D8(struct PlayState* play, struct DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4); #endif diff --git a/include/z64collision_check.h b/include/z64collision_check.h index 6da6400c64..2c27563766 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -471,7 +471,7 @@ typedef struct CollisionCheckInfo { DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* table); -#if IS_DEBUG +#if DEBUG_FEATURES void Collider_DrawRedPoly(struct GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC); void Collider_DrawPoly(struct GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b); #endif @@ -522,7 +522,7 @@ void CollisionCheck_DestroyContext(struct PlayState* play, CollisionCheckContext void CollisionCheck_ClearContext(struct PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_EnableSAC(struct PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_DisableSAC(struct PlayState* play, CollisionCheckContext* colChkCtx); -#if IS_DEBUG +#if DEBUG_FEATURES void Collider_Draw(struct PlayState* play, Collider* col); void CollisionCheck_DrawCollision(struct PlayState* play, CollisionCheckContext* colChkCtx); #endif diff --git a/include/z64dma.h b/include/z64dma.h index 3b60e7d6e1..b9cbf6a42d 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -34,7 +34,7 @@ extern size_t gDmaMgrDmaBuffSize; s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, OSMesg msg); s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size); -#if IS_DEBUG +#if DEBUG_FEATURES s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, OSMesg msg, const char* file, int line); s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line); diff --git a/include/z64pause.h b/include/z64pause.h index f521499e9d..dc24bb4db7 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -65,22 +65,22 @@ typedef enum PauseState { /* 5 */ PAUSE_STATE_OPENING_2, // Finish some animations for opening the menu. /* 6 */ PAUSE_STATE_MAIN, // Pause menu ready for player inputs. /* 7 */ PAUSE_STATE_SAVE_PROMPT, // Save prompt in the pause menu - /* 8 */ PAUSE_STATE_8, - /* 9 */ PAUSE_STATE_9, - /* 10 */ PAUSE_STATE_10, - /* 11 */ PAUSE_STATE_11, - /* 12 */ PAUSE_STATE_12, - /* 13 */ PAUSE_STATE_13, - /* 14 */ PAUSE_STATE_14, - /* 15 */ PAUSE_STATE_15, - /* 16 */ PAUSE_STATE_16, - /* 17 */ PAUSE_STATE_17, + /* 8 */ PAUSE_STATE_GAME_OVER_START, + /* 9 */ PAUSE_STATE_GAME_OVER_WAIT_BG_PRERENDER, + /* 10 */ PAUSE_STATE_GAME_OVER_INIT, + /* 11 */ PAUSE_STATE_GAME_OVER_SHOW_MESSAGE, + /* 12 */ PAUSE_STATE_GAME_OVER_WINDOW_DELAY, + /* 13 */ PAUSE_STATE_GAME_OVER_SHOW_WINDOW, // Show background and animate + /* 14 */ PAUSE_STATE_GAME_OVER_SAVE_PROMPT, // Ask "Would you like to save?", apply the choice + /* 15 */ PAUSE_STATE_GAME_OVER_SAVED, // Show "Game saved.", wait for the delay or input + /* 16 */ PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT, // Ask "Continue playing?" + /* 17 */ PAUSE_STATE_GAME_OVER_FINISH, // Fade out, then apply the choice /* 18 */ PAUSE_STATE_CLOSING, // Animate the pause menu closing /* 19 */ PAUSE_STATE_RESUME_GAMEPLAY // Handles returning to normal gameplay once the pause menu is visually closed } PauseState; #define IS_PAUSE_STATE_GAMEOVER(pauseCtx) \ - (((pauseCtx)->state >= PAUSE_STATE_8) && ((pauseCtx)->state <= PAUSE_STATE_17)) + (((pauseCtx)->state >= PAUSE_STATE_GAME_OVER_START) && ((pauseCtx)->state <= PAUSE_STATE_GAME_OVER_FINISH)) #if ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR #define IS_PAUSED(pauseCtx) \ diff --git a/include/z64play.h b/include/z64play.h index 73e0248558..310c4134c2 100644 --- a/include/z64play.h +++ b/include/z64play.h @@ -149,7 +149,7 @@ void Play_TriggerVoidOut(PlayState* this); void Play_TriggerRespawn(PlayState* this); int Play_CamIsNotFixed(PlayState* this); -#if OOT_DEBUG +#if DEBUG_FEATURES extern void* gDebugCutsceneScript; #endif diff --git a/include/z64player.h b/include/z64player.h index 3f48d07e6d..19acbeff30 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -7,6 +7,28 @@ struct Player; +#define PLAYER_GET_START_MODE(thisx) PARAMS_GET_S(thisx->params, 8, 4) + +typedef enum PlayerStartMode { + /* 0 */ PLAYER_START_MODE_NOTHING, // Update is empty and draw function is NULL, nothing occurs. Useful in cutscenes, for example. + /* 1 */ PLAYER_START_MODE_TIME_TRAVEL, // Arriving from time travel. Automatically adjusts by age. + /* 2 */ PLAYER_START_MODE_BLUE_WARP, // Arriving from a blue warp. + /* 3 */ PLAYER_START_MODE_DOOR, // Unused. Use a door immediately if one is nearby. If no door is in usable range, a softlock occurs. + /* 4 */ PLAYER_START_MODE_GROTTO, // Arriving from a grotto, launched upward from the ground. + /* 5 */ PLAYER_START_MODE_WARP_SONG, // Arriving from a warp song. + /* 6 */ PLAYER_START_MODE_FARORES_WIND, // Arriving from a Farores Wind warp. + /* 7 */ PLAYER_START_MODE_KNOCKED_OVER, // Knocked over on the ground and flashing red. + /* 8 */ PLAYER_START_MODE_UNUSED_8, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW. + /* 9 */ PLAYER_START_MODE_UNUSED_9, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW. + /* 10 */ PLAYER_START_MODE_UNUSED_10, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW. + /* 11 */ PLAYER_START_MODE_UNUSED_11, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW. + /* 12 */ PLAYER_START_MODE_UNUSED_12, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW. + /* 13 */ PLAYER_START_MODE_IDLE, // Idle standing still, or swim if in water. + /* 14 */ PLAYER_START_MODE_MOVE_FORWARD_SLOW, // Take a few steps forward at a slow speed (2.0f), or swim if in water. + /* 15 */ PLAYER_START_MODE_MOVE_FORWARD, // Take a few steps forward, using the speed from the last exit (gSaveContext.entranceSpeed), or swim if in water. + /* 16 */ PLAYER_START_MODE_MAX // Note: By default, this param has 4 bits allocated. The max value is 16. +} PlayerStartMode; + typedef enum PlayerSword { /* 0 */ PLAYER_SWORD_NONE, /* 1 */ PLAYER_SWORD_KOKIRI, @@ -610,14 +632,14 @@ typedef enum PlayerStickDirection { /* 3 */ PLAYER_STICK_DIR_RIGHT } PlayerStickDirection; -typedef enum { +typedef enum PlayerKnockbackType { /* 0 */ PLAYER_KNOCKBACK_NONE, // No knockback /* 1 */ PLAYER_KNOCKBACK_SMALL, // A small hop, remains standing up /* 2 */ PLAYER_KNOCKBACK_LARGE, // Sent flying in the air and lands laying down on the floor /* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK // Same as`PLAYER_KNOCKBACK_LARGE` with a shock effect } PlayerKnockbackType; -typedef enum { +typedef enum PlayerDamageResponseType { /* 0 */ PLAYER_HIT_RESPONSE_NONE, /* 1 */ PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, /* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL, @@ -651,8 +673,8 @@ typedef struct PlayerAgeProperties { /* 0x92 */ u16 unk_92; /* 0x94 */ u16 unk_94; /* 0x98 */ LinkAnimationHeader* unk_98; - /* 0x9C */ LinkAnimationHeader* unk_9C; - /* 0xA0 */ LinkAnimationHeader* unk_A0; + /* 0x9C */ LinkAnimationHeader* timeTravelStartAnim; + /* 0xA0 */ LinkAnimationHeader* timeTravelEndAnim; /* 0xA4 */ LinkAnimationHeader* unk_A4; /* 0xA8 */ LinkAnimationHeader* unk_A8; /* 0xAC */ LinkAnimationHeader* unk_AC[4]; @@ -681,7 +703,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE1_9 (1 << 9) #define PLAYER_STATE1_10 (1 << 10) #define PLAYER_STATE1_CARRYING_ACTOR (1 << 11) // Currently carrying an actor -#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) // Currently charing a spin attack (by holding down the B button) +#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) // Currently charging a spin attack (by holding down the B button) #define PLAYER_STATE1_13 (1 << 13) #define PLAYER_STATE1_14 (1 << 14) #define PLAYER_STATE1_Z_TARGETING (1 << 15) // Either lock-on or parallel is active. This flag is never checked for and is practically unused. @@ -691,7 +713,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE1_19 (1 << 19) #define PLAYER_STATE1_20 (1 << 20) #define PLAYER_STATE1_21 (1 << 21) -#define PLAYER_STATE1_22 (1 << 22) +#define PLAYER_STATE1_SHIELDING (1 << 22) // Shielding in any form (regular, hylian shield as child, "shielding" with a two handed sword, etc.) #define PLAYER_STATE1_23 (1 << 23) #define PLAYER_STATE1_USING_BOOMERANG (1 << 24) // Currently using the boomerang. This includes all phases (aiming, throwing, and catching). #define PLAYER_STATE1_BOOMERANG_THROWN (1 << 25) // Boomerang has been thrown and is flying in the air @@ -729,7 +751,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE2_24 (1 << 24) #define PLAYER_STATE2_25 (1 << 25) #define PLAYER_STATE2_26 (1 << 26) -#define PLAYER_STATE2_27 (1 << 27) +#define PLAYER_STATE2_USING_OCARINA (1 << 27) // Playing the ocarina or warping out from an ocarina warp song #define PLAYER_STATE2_IDLE_FIDGET (1 << 28) // Playing a fidget idle animation (under typical circumstances, see `Player_ChooseNextIdleAnim` for more info) #define PLAYER_STATE2_29 (1 << 29) #define PLAYER_STATE2_30 (1 << 30) @@ -879,16 +901,22 @@ typedef struct Player { /* 0x084F */ union { s8 actionVar1; - s8 facingUpSlope; // Player_Action_SlideOnSlope: facing uphill when sliding on a slope + s8 startedAnim; // Player_Action_TimeTravelEnd: Started playing the animation that was previously frozen + s8 facingUpSlope; // Player_Action_SlideOnSlope: Facing uphill when sliding on a slope + s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene. s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running /* 0x0850 */ union { s16 actionVar2; s16 fallDamageStunTimer; // Player_Action_Idle: Prevents any movement and shakes model up and down quickly to indicate fall damage stun - s16 bonked; // Player_Action_Roll: set to true after bonking into a wall or an actor + s16 bonked; // Player_Action_Roll: Set to true after bonking into a wall or an actor + s16 animDelayTimer; // Player_Action_TimeTravelEnd: Delays playing animation until finished counting down s16 startedTextbox; // Player_Action_SwingBottle: set to true when the textbox is started - s16 inWater; // Player_Action_SwingBottle: true if a bottle is swung in water. Used to determine which bottle swing animation to use. + s16 inWater; // Player_Action_SwingBottle: True if a bottle is swung in water. Used to determine which bottle swing animation to use. + s16 csDelayTimer; // Player_Action_WaitForCutscene: Number of frames to wait before responding to a cutscene + s16 playedLandingSfx; // Player_Action_BlueWarpArrive: Played sfx when landing on the ground + s16 appearTimer; // Player_Action_FaroresWindArrive: Counts up, appear at 20 frames (1 second) } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running /* 0x0854 */ f32 unk_854; diff --git a/include/z64scene.h b/include/z64scene.h index afb6fe6f1a..e5d3744c9b 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -434,7 +434,7 @@ typedef enum SceneID { #undef DEFINE_SCENE // Fake enum values for scenes that are still referenced in the entrance table -#if !IS_DEBUG +#if !DEBUG_ASSETS // Debug-only scenes #define SCENE_TEST01 0x65 #define SCENE_BESITU 0x66 diff --git a/include/z64view.h b/include/z64view.h index 073e1af4ef..6ba959d7da 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -63,7 +63,7 @@ typedef struct View { #define VIEW_FORCE_PROJECTION_PERSPECTIVE (VIEW_PROJECTION_PERSPECTIVE << 4) #define VIEW_FORCE_PROJECTION_ORTHO (VIEW_PROJECTION_ORTHO << 4) -#if IS_DEBUG +#if DEBUG_FEATURES #define VIEW_ERROR_CHECK_EYE_POS(x, y, z) View_ErrorCheckEyePosition((x), (y), (z)) #else #define VIEW_ERROR_CHECK_EYE_POS(x, y, z) (void)0 @@ -84,7 +84,7 @@ void View_SetViewport(View* view, Viewport* viewport); void View_GetViewport(View* view, Viewport* viewport); void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ); void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); -s32 View_SetDistortionSpeed(View* view, f32 speed); +BAD_RETURN(s32) View_SetDistortionSpeed(View* view, f32 speed); void View_InitDistortion(View* view); void View_ClearDistortion(View* view); void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed); @@ -94,7 +94,7 @@ s32 View_ApplyOrthoToOverlay(View* view); s32 View_ApplyPerspectiveToOverlay(View* view); s32 View_UpdateViewingMatrix(View* view); s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); -#if IS_DEBUG +#if DEBUG_FEATURES s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); #endif diff --git a/include/zelda_arena.h b/include/zelda_arena.h index 10409581d8..1d035a0bbe 100644 --- a/include/zelda_arena.h +++ b/include/zelda_arena.h @@ -14,7 +14,7 @@ void ZeldaArena_Init(void* start, u32 size); void ZeldaArena_Cleanup(void); s32 ZeldaArena_IsInitialized(void); -#if IS_DEBUG +#if DEBUG_FEATURES void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); void* ZeldaArena_MallocDebug(u32 size, const char* file, int line); void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line); diff --git a/spec b/spec index adcb297a7c..094c6b784b 100644 --- a/spec +++ b/spec @@ -34,18 +34,18 @@ beginseg #if PLATFORM_N64 include "$(BUILD_DIR)/src/boot/cic6105.o" #endif -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/boot/assert.o" #endif include "$(BUILD_DIR)/src/boot/is_debug.o" include "$(BUILD_DIR)/src/boot/driverominit.o" include "$(BUILD_DIR)/src/boot/mio0.o" - include "$(BUILD_DIR)/src/boot/stackcheck.o" - include "$(BUILD_DIR)/src/boot/logutils.o" + include "$(BUILD_DIR)/src/libu64/stackcheck.o" + include "$(BUILD_DIR)/src/libu64/debug.o" #if PLATFORM_N64 include "$(BUILD_DIR)/src/libc64/sleep.o" #endif -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libc64/sprintf.o" #endif include "$(BUILD_DIR)/src/libultra/io/piacs.o" @@ -88,12 +88,12 @@ beginseg include "$(BUILD_DIR)/src/libultra/os/probetlb.o" include "$(BUILD_DIR)/src/libultra/os/getmemsize.o" include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" #endif include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o" include "$(BUILD_DIR)/src/libultra/io/epidma.o" -#if IS_DEBUG || defined(COMPILER_GCC) +#if DEBUG_FEATURES || defined(COMPILER_GCC) include "$(BUILD_DIR)/src/libultra/libc/string.o" #endif include "$(BUILD_DIR)/src/libultra/os/invalicache.o" @@ -138,19 +138,19 @@ beginseg include "$(BUILD_DIR)/src/libultra/io/visetspecial.o" #endif include "$(BUILD_DIR)/src/libultra/io/cartrominit.o" -#if OOT_PAL_N64 || IS_DEBUG +#if OOT_PAL_N64 || DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o" #endif include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o" include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o" -#if PLATFORM_N64 || IS_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/epiwrite.o" #endif include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o" include "$(BUILD_DIR)/src/libultra/os/yieldthread.o" include "$(BUILD_DIR)/src/libultra/os/getcause.o" include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" @@ -226,7 +226,9 @@ beginseg include "$(BUILD_DIR)/assets/audio/soundfonts/Soundfont_35.o" include "$(BUILD_DIR)/assets/audio/soundfonts/Soundfont_36.o" include "$(BUILD_DIR)/assets/audio/soundfonts/Soundfont_37.o" +#if OOT_VERSION >= PAL_1_0 include "$(BUILD_DIR)/assets/audio/audiobank_padding.o" +#endif endseg beginseg @@ -616,7 +618,7 @@ beginseg include "$(BUILD_DIR)/src/code/z_lights.o" include "$(BUILD_DIR)/src/code/z_malloc.o" include "$(BUILD_DIR)/src/code/z_map_mark.o" -#if IS_DEBUG +#if DEBUG_ASSETS include "$(BUILD_DIR)/src/code/z_moji.o" #endif include "$(BUILD_DIR)/src/code/z_prenmi_buff.o" @@ -647,7 +649,7 @@ beginseg include "$(BUILD_DIR)/src/code/z_sram.o" include "$(BUILD_DIR)/src/code/z_ss_sram.o" include "$(BUILD_DIR)/src/code/z_rumble.o" -#if IS_DEBUG +#if DEBUG_ASSETS include "$(BUILD_DIR)/data/z_text.data.o" #endif include "$(BUILD_DIR)/data/unk_8012ABC0.data.o" @@ -692,7 +694,7 @@ beginseg include "$(BUILD_DIR)/src/code/sys_cfb.o" include "$(BUILD_DIR)/src/code/sys_math.o" include "$(BUILD_DIR)/src/code/sys_math3d.o" -#if OOT_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/code/sys_math3d_draw.o" #endif include "$(BUILD_DIR)/src/code/sys_math_atan.o" @@ -715,7 +717,7 @@ beginseg include "$(BUILD_DIR)/src/code/fault_gc_drawer.o" #endif include "$(BUILD_DIR)/src/code/kanread.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/code/ucode_disas.o" #endif #if OOT_VERSION < NTSC_1_1 || PLATFORM_GC @@ -737,7 +739,7 @@ beginseg include "$(BUILD_DIR)/src/audio/lib/effects.o" include "$(BUILD_DIR)/src/audio/lib/seqplayer.o" include "$(BUILD_DIR)/src/audio/general.o" -#if PLATFORM_GC && !IS_DEBUG +#if PLATFORM_GC && !DEBUG_FEATURES pad_text #endif include "$(BUILD_DIR)/src/audio/sfx_params.o" @@ -746,25 +748,30 @@ beginseg include "$(BUILD_DIR)/src/audio/data.o" include "$(BUILD_DIR)/src/audio/session_config.o" #if PLATFORM_N64 - include "$(BUILD_DIR)/src/code/gfxprint.o" - include "$(BUILD_DIR)/src/code/rcp_utils.o" - include "$(BUILD_DIR)/src/code/loadfragment2_n64.o" - include "$(BUILD_DIR)/src/code/padutils.o" - include "$(BUILD_DIR)/src/code/code_800FC620.o" - include "$(BUILD_DIR)/src/code/padsetup.o" + include "$(BUILD_DIR)/src/libu64/gfxprint.o" + include "$(BUILD_DIR)/src/libu64/rcp_utils.o" + include "$(BUILD_DIR)/src/libu64/loadfragment2_n64.o" +#if DEBUG_FEATURES + // This is here only to allow N64 versions to compile with DEBUG_FEATURES. + // There is no N64 Debug ROM to prove this is correct. + include "$(BUILD_DIR)/src/libu64/mtxuty-cvt.o" +#endif + include "$(BUILD_DIR)/src/libu64/pad.o" + include "$(BUILD_DIR)/src/libu64/code_800FC620.o" + include "$(BUILD_DIR)/src/libu64/padsetup.o" #else - include "$(BUILD_DIR)/src/code/logseverity_gc.o" - include "$(BUILD_DIR)/src/code/gfxprint.o" - include "$(BUILD_DIR)/src/code/rcp_utils.o" - include "$(BUILD_DIR)/src/code/loadfragment2_gc.o" -#if IS_DEBUG - include "$(BUILD_DIR)/src/code/mtxuty-cvt.o" + include "$(BUILD_DIR)/src/libu64/logseverity_gc.o" + include "$(BUILD_DIR)/src/libu64/gfxprint.o" + include "$(BUILD_DIR)/src/libu64/rcp_utils.o" + include "$(BUILD_DIR)/src/libu64/loadfragment2_gc.o" +#if DEBUG_FEATURES + include "$(BUILD_DIR)/src/libu64/mtxuty-cvt.o" #endif - include "$(BUILD_DIR)/src/code/relocation_gc.o" - include "$(BUILD_DIR)/src/code/load_gc.o" - include "$(BUILD_DIR)/src/code/code_800FC620.o" - include "$(BUILD_DIR)/src/code/padutils.o" - include "$(BUILD_DIR)/src/code/padsetup.o" + include "$(BUILD_DIR)/src/libu64/relocation_gc.o" + include "$(BUILD_DIR)/src/libu64/load_gc.o" + include "$(BUILD_DIR)/src/libu64/code_800FC620.o" + include "$(BUILD_DIR)/src/libu64/pad.o" + include "$(BUILD_DIR)/src/libu64/padsetup.o" #endif include "$(BUILD_DIR)/src/libc64/math64.o" include "$(BUILD_DIR)/src/libc64/fp.o" @@ -775,7 +782,7 @@ beginseg #else include "$(BUILD_DIR)/src/libc64/__osMalloc_gc.o" #endif -#if !IS_DEBUG +#if !DEBUG_FEATURES include "$(BUILD_DIR)/src/libc64/sprintf.o" #endif include "$(BUILD_DIR)/src/libc64/aprintf.o" @@ -787,7 +794,7 @@ beginseg #if ENABLE_F3DEX3 include "$(BUILD_DIR)/src/code/occlusionplanes.o" #endif -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o" #endif #if PLATFORM_N64 @@ -809,7 +816,7 @@ beginseg include "$(BUILD_DIR)/src/libultra/io/sprawdma.o" include "$(BUILD_DIR)/src/libultra/io/sirawdma.o" include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsreadwritefile.o" include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o" #endif @@ -820,11 +827,11 @@ beginseg include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o" #endif include "$(BUILD_DIR)/src/libultra/gu/lookat.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o" #endif include "$(BUILD_DIR)/src/libultra/os/stoptimer.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/contpfs.o" #if !PLATFORM_N64 include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o" @@ -835,10 +842,10 @@ beginseg include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o" include "$(BUILD_DIR)/src/libultra/io/contquery.o" include "$(BUILD_DIR)/src/libultra/gu/lookathil.o" -#if !IS_DEBUG +#if !DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" #endif -#if !IS_DEBUG && !defined(COMPILER_GCC) +#if !DEBUG_FEATURES && !defined(COMPILER_GCC) include "$(BUILD_DIR)/src/libultra/libc/string.o" #endif include "$(BUILD_DIR)/src/libultra/io/sp.o" @@ -860,7 +867,7 @@ beginseg #endif include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o" include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o" #endif include "$(BUILD_DIR)/src/libultra/gu/ortho.o" @@ -874,13 +881,13 @@ beginseg include "$(BUILD_DIR)/src/libultra/os/settime.o" #endif include "$(BUILD_DIR)/src/libultra/io/visetevent.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o" #endif include "$(BUILD_DIR)/src/libultra/gu/us2dex.o" include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o" include "$(BUILD_DIR)/src/libultra/io/contsetch.o" -#if IS_DEBUG +#if DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o" include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o" include "$(BUILD_DIR)/src/libultra/io/pfschecker.o" @@ -892,10 +899,10 @@ beginseg include "$(BUILD_DIR)/src/libultra/mgu/translate.o" #endif include "$(BUILD_DIR)/src/libultra/io/contramwrite.o" -#if OOT_VERSION == NTSC_1_2 || (PLATFORM_GC && !IS_DEBUG) +#if OOT_VERSION == NTSC_1_2 || (PLATFORM_GC && !DEBUG_FEATURES) include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o" #endif -#if !IS_DEBUG +#if !DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o" include "$(BUILD_DIR)/src/libultra/io/contpfs.o" #endif @@ -904,7 +911,7 @@ beginseg #endif include "$(BUILD_DIR)/src/libultra/io/contramread.o" include "$(BUILD_DIR)/src/libultra/io/crc.o" -#if !IS_DEBUG +#if !DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o" #endif #if !PLATFORM_N64 @@ -914,7 +921,7 @@ beginseg include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" -#elif !IS_DEBUG +#elif !DEBUG_FEATURES include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" @@ -11642,8 +11649,6 @@ beginseg number 0 endseg -// Scene files are reordered between versions. On GameCube and iQue, dungeon scenes -// have been moved to the beginning. #if PLATFORM_N64 beginseg @@ -17416,7 +17421,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "syotes_scene" romalign 0x1000 @@ -17940,7 +17945,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "testroom_scene" romalign 0x1000 @@ -18024,7 +18029,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "sutaru_scene" romalign 0x1000 @@ -18312,7 +18317,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "sasatest_scene" romalign 0x1000 @@ -19064,7 +19069,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "hairal_niwa2_scene" romalign 0x1000 @@ -19552,7 +19557,7 @@ beginseg number 3 endseg -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "besitu_scene" romalign 0x1000 @@ -19624,12 +19629,9 @@ beginseg number 3 endseg -#endif - -#if CAN_INCLUDE_TEST_SCENES +#if DEBUG_ASSETS beginseg name "test01_scene" - compress romalign 0x1000 include "$(BUILD_DIR)/assets/scenes/test_levels/test01/test01_scene.o" number 2 @@ -19637,13 +19639,14 @@ endseg beginseg name "test01_room_0" - compress romalign 0x1000 include "$(BUILD_DIR)/assets/scenes/test_levels/test01/test01_room_0.o" number 3 endseg #endif +#endif + #if !ENABLE_HACKEROOT beginseg name "bump_texture_static" @@ -19744,7 +19747,7 @@ beginseg endseg #endif -#if INCLUDE_EXAMPLE_SCENE +#if CAN_INCLUDE_EXAMPLE_SCENE beginseg name "example_scene" compress diff --git a/src/audio/data.c b/src/audio/data.c index ddaf03fd7e..627d6c5c64 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -44,18 +44,20 @@ s8 gSfxDefaultReverb = 0; s32 D_801333EC = 0; // unused -// ENABLE_AUDIO_DEBUGGER +#if IS_AUDIO_DEBUG_ENABLED u8 D_801333F0 = 0; u8 gAudioSfxSwapOff = 0; u8 D_801333F8 = 0; s32 D_801333FC = 0; // unused +#endif u8 gSeqCmdWritePos = 0; u8 gSeqCmdReadPos = 0; u8 gStartSeqDisabled = false; -// ENABLE_AUDIO_DEBUGGER +#if IS_AUDIO_DEBUG_ENABLED u8 gAudioDebugPrintSeqCmd = true; +#endif u8 gSoundModeList[] = { SOUNDMODE_STEREO, diff --git a/src/audio/general.c b/src/audio/general.c index 2a25e17bb8..de0875553f 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -133,7 +133,7 @@ f32 D_801305E4[4] = { 1.0f, 1.12246f, 1.33484f, 1.33484f }; // 2**({0, 2, 5, 5}/ f32 D_801305F4 = 1.0f; u8 sGanonsTowerLevelsVol[8] = { 127, 80, 75, 73, 70, 68, 65, 60 }; u8 sEnterGanonsTowerTimer = 0; -#if IS_DEBUG +#if DEBUG_FEATURES s8 sSoundMode = SOUNDMODE_SURROUND; #else s8 sSoundMode = SOUNDMODE_STEREO; @@ -161,7 +161,7 @@ u8 sAudioExtraFilter2 = 0; Vec3f* sSariaBgmPtr = NULL; f32 D_80130650 = 2000.0f; -#if IS_DEBUG +#if DEBUG_FEATURES u8 sSeqModeInput = 0; #endif @@ -1150,10 +1150,10 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { { 0, { 0 } }, }; -// ENABLE_AUDIO_DEBUGGER +#if DEBUG_FEATURES u32 sAudioUpdateStartTime; u32 sAudioUpdateEndTime; - +#endif f32 D_8016B7A8; f32 D_8016B7AC; f32 D_8016B7B0; @@ -1163,7 +1163,7 @@ FreqLerp sWaterfallFreqScaleLerp; f32 D_8016B7D8; s8 D_8016B7DC; f32 D_8016B7E0; -#if IS_DEBUG +#if DEBUG_FEATURES u16 D_8016B7E4; // ENABLE_AUDIO_DEBUGGER @@ -1179,11 +1179,11 @@ u8 sRiverSoundMainBgmLower; u8 sRiverSoundMainBgmRestore; u8 sGanonsTowerVol; SfxPlayerState sSfxChannelState[0x10]; -#if IS_DEBUG +#if DEBUG_FEATURES char sBinToStrBuf[0x20]; #endif u8 sMalonSingingTimer; -#if IS_DEBUG +#if DEBUG_FEATURES u8 sAudioSpecPeakNumNotes[0x12]; #endif u8 sMalonSingingDisabled; @@ -1216,7 +1216,7 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX]; u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX]; u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX]; OcarinaNote sScarecrowsLongSongSecondNote; -#if IS_DEBUG +#if DEBUG_FEATURES u8 sIsMalonSinging; f32 sMalonSingingDist; u32 sDebugPadHold; @@ -3361,7 +3361,7 @@ s32 Audio_IsSequencePlaying(u16 seqId) { void func_800F5ACC(u16 seqId) { u16 curSeqId = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); -#if !IS_DEBUG +#if !DEBUG_FEATURES if (1) {} #endif @@ -3490,7 +3490,7 @@ void Audio_SetSequenceMode(u8 seqMode) { u16 seqId; u8 volumeFadeOutTimer; -#if IS_DEBUG +#if DEBUG_FEATURES sSeqModeInput = seqMode; #endif @@ -3630,7 +3630,7 @@ void Audio_UpdateMalonSinging(f32 dist, u16 seqId) { s8 melodyVolume; s16 curSeqId; -#if IS_DEBUG +#if DEBUG_FEATURES sIsMalonSinging = true; sMalonSingingDist = dist; #endif @@ -3985,7 +3985,7 @@ void Audio_StartNatureAmbienceSequence(u16 playerIO, u16 channelMask) { channelIdx = false; -#if IS_DEBUG +#if DEBUG_FEATURES if (gStartSeqDisabled) { channelIdx = true; SEQCMD_DISABLE_PLAY_SEQUENCES(false); diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 99217c61fc..3e66c79329 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -410,6 +410,7 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { sample->sampleAddr = sampleAddr; } } + //! @bug Missing return, but the return value is never used so it's fine. } s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { @@ -426,6 +427,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { if (instrument->normalRangeHi != 0x7F) { return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId); } + //! @bug Missing return, but the return value is never used so it's fine. } else if (instId == 0x7F) { Drum* drum = Audio_GetDrum(fontId, drumId); @@ -508,10 +510,10 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) { gAudioCtx.seqPlayers[playerIdx].skipTicks = 0; AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, arg2); - // Intentionally missing return. Returning the result of the above function - // call matches but is UB because it too is missing a return, and using the - // result of a non-void function that has failed to return a value is UB. - // The callers of this function do not use the return value, so it's fine. + //! @bug Missing return. Returning the result of the above function call + //! matches but is UB because it too is missing a return, and using the + //! result of a non-void function that has failed to return a value is UB. + //! The callers of this function do not use the return value, so it's fine. } s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) { @@ -521,7 +523,7 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks gAudioCtx.seqPlayers[playerIdx].skipTicks = skipTicks; AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, 0); - // Missing return, see above. + //! @bug Missing return, see comment in AudioLoad_SyncInitSeqPlayer above. } s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { diff --git a/src/audio/sequence.c b/src/audio/sequence.c index 174fbdb32c..54e768f774 100644 --- a/src/audio/sequence.c +++ b/src/audio/sequence.c @@ -43,7 +43,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura if (!gStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) { seqArgs &= 0x7F; - if (IS_DEBUG && (seqArgs == 0x7F)) { + if (DEBUG_FEATURES && (seqArgs == 0x7F)) { // `fadeInDuration` interpreted as seconds, 60 is refresh rate and does not account for PAL skipTicks = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.ticksPerUpdate; AUDIOCMD_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS((u32)seqPlayerIndex, (u32)seqId, skipTicks); @@ -103,11 +103,12 @@ void Audio_ProcessSeqCmd(u32 cmd) { f32 freqScaleTarget; s32 pad; - if (IS_AUDIO_DEBUG_ENABLED && gAudioDebugPrintSeqCmd && - (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_SEQPLAYER_IO << 28)) { +#if IS_AUDIO_DEBUG_ENABLED + if (gAudioDebugPrintSeqCmd && (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_SEQPLAYER_IO << 28)) { AudioDebug_ScrPrt("SEQ H", (cmd >> 16) & 0xFFFF); AudioDebug_ScrPrt(" L", cmd & 0xFFFF); } +#endif op = cmd >> 28; seqPlayerIndex = (cmd & 0xF000000) >> 24; diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 333f700405..01d6952db0 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -34,10 +34,11 @@ u8 sCurSfxPlayerChannelIndex; u8 gSfxBankMuted[7]; UnusedBankLerp sUnusedBankLerp[7]; -//! TODO: audio debug feature? +#if DEBUG_FEATURES u16 gAudioSfxSwapSource[10]; u16 gAudioSfxSwapTarget[10]; u8 gAudioSfxSwapMode[10]; +#endif void Audio_SetSfxBanksMute(u16 muteMask) { u8 bankId; @@ -73,7 +74,8 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) { req = &sSfxRequests[gSfxRequestWriteIndex]; - if (IS_AUDIO_DEBUG_ENABLED && !gAudioSfxSwapOff) { +#if IS_AUDIO_DEBUG_ENABLED + if (!gAudioSfxSwapOff) { for (i = 0; i < 10; i++) { if (sfxId == gAudioSfxSwapSource[i]) { if (gAudioSfxSwapMode[i] == 0) { // "SWAP" @@ -92,6 +94,7 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* } } } +#endif req->sfxId = sfxId; req->pos = pos; @@ -169,10 +172,12 @@ void Audio_ProcessSfxRequest(void) { bankId = SFX_BANK(req->sfxId); - if (IS_AUDIO_DEBUG_ENABLED && ((1 << bankId) & D_801333F0)) { +#if IS_AUDIO_DEBUG_ENABLED + if ((1 << bankId) & D_801333F0) { AudioDebug_ScrPrt("SE", req->sfxId); bankId = SFX_BANK(req->sfxId); } +#endif count = 0; index = gSfxBanks[bankId][0].next; @@ -734,7 +739,8 @@ void Audio_ResetSfx(void) { gSfxBanks[bankId][i].next = 0xFF; } - if (IS_AUDIO_DEBUG_ENABLED && D_801333F8 == 0) { +#if IS_AUDIO_DEBUG_ENABLED + if (D_801333F8 == 0) { for (bankId = 0; bankId < 10; bankId++) { gAudioSfxSwapSource[bankId] = 0; gAudioSfxSwapTarget[bankId] = 0; @@ -742,4 +748,5 @@ void Audio_ResetSfx(void) { } D_801333F8++; } +#endif } diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index 351095c2e7..0c1eeea49e 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -30,7 +30,7 @@ void bootproc(void) { gCartHandle = osCartRomInit(); osDriveRomInit(); -#if IS_DEBUG +#if DEBUG_FEATURES isPrintfInit(); #endif Locale_Init(); diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 0d9c8142fb..0052d98416 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -10,11 +10,11 @@ OSTask D_800067C0_unknown = { 4, 0, rspbootTextStart, 0x3E8, cic6105TextStart, 0x20, (u64*)gBuildCreator, 8, NULL, 0, NULL, 0, NULL, 0, NULL, 0, }; -s32 B_80008EE0; -s32 B_80008EE4; +u32 B_80008EE0; +u32 B_80008EE4; FaultClient sCIC6105FaultClient; -s32 B_80008EF8; -s32 B_80008EFC; +u32 B_80008EF8; +u32 B_80008EFC; void func_800014D0(void) { R_AUDIOMGR_DEBUG_LEVEL = AUDIOMGR_DEBUG_LEVEL_NO_RSP; diff --git a/src/boot/idle.c b/src/boot/idle.c index 0b9a4a1ac0..bd50859ca5 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -88,7 +88,7 @@ void Idle_ThreadEntry(void* arg) { gViConfigYScale = 1.0f; #endif -#if OOT_DEBUG +#if DEBUG_FEATURES // Allow both 60 Hz and 50 Hz switch (osTvType) { case OS_TV_NTSC: diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 99fd5284b3..5415b8a7b3 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -3,7 +3,7 @@ #define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000) #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) -#if IS_DEBUG +#if DEBUG_FEATURES OSPiHandle* sISVHandle; // official name : is_Handle void isPrintfInit(void) { @@ -18,7 +18,7 @@ void osSyncPrintfUnused(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if IS_DEBUG +#if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif @@ -29,7 +29,7 @@ void osSyncPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if IS_DEBUG +#if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif @@ -41,7 +41,7 @@ void rmonPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if IS_DEBUG +#if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif @@ -53,7 +53,7 @@ void func_800015F4(void) { } #endif -#if IS_DEBUG +#if DEBUG_FEATURES void* is_proutSyncPrintf(void* arg, const char* str, size_t count) { u32 data; s32 pos; diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index 86707020bd..82be71b2fd 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -76,7 +76,7 @@ void Locale_ResetRegion(void) { gCurrentRegion = REGION_NULL; } -#if IS_DEBUG +#if DEBUG_FEATURES u32 func_80001F48(void) { if (gCurrentRegion == OOT_REGION) { return 0; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index bdbaaa9eb4..f2195d8206 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -28,7 +28,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:92 pal-1.0:90 pal-1.1:90" + "ntsc-1.2:88 pal-1.0:86 pal-1.1:86" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; @@ -41,7 +41,7 @@ u32 sDmaMgrIsRomCompressed = false; OSThread sDmaMgrThread; STACK(sDmaMgrStack, 0x500); -#if IS_DEBUG +#if DEBUG_FEATURES const char* sDmaMgrCurFileName; s32 sDmaMgrCurFileLine; @@ -57,7 +57,7 @@ const char* sDmaMgrFileNames[] = { #undef DEFINE_DMA_ENTRY -#if PLATFORM_N64 || IS_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES /** * Compares `str1` and `str2`. * @@ -253,7 +253,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) { osRecvMesg(&queue, NULL, OS_MESG_BLOCK); } -#if IS_DEBUG +#if DEBUG_FEATURES /** * DMA error encountered, print error messages and bring up the crash screen. * @@ -316,7 +316,7 @@ NORETURN void DmaMgr_Error(DmaRequest* req, const char* filename, const char* er * @return Pointer to associated filename */ const char* DmaMgr_FindFileName(uintptr_t vrom) { -#if IS_DEBUG +#if DEBUG_FEATURES DmaEntry* iter = gDmaDataTable; const char** name = sDmaMgrFileNames; @@ -340,7 +340,7 @@ const char* DmaMgr_FindFileName(uintptr_t vrom) { #endif const char* DmaMgr_GetFileName(uintptr_t vrom) { -#if IS_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES const char* ret = DmaMgr_FindFileName(vrom); if (ret == NULL) { @@ -353,10 +353,10 @@ const char* DmaMgr_GetFileName(uintptr_t vrom) { return NULL; } return ret; -#elif PLATFORM_N64 - return "??"; #elif PLATFORM_GC return ""; +#elif PLATFORM_N64 + return "??"; #endif } @@ -368,10 +368,10 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { size_t romSize; u8 found = false; DmaEntry* iter; - const char* filename; + UNUSED_NDEBUG const char* filename; s32 i = 0; -#if IS_DEBUG +#if DEBUG_FEATURES // Get the filename (for debugging) filename = DmaMgr_GetFileName(vrom); #elif PLATFORM_GC @@ -545,14 +545,12 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, OSMesg msg) { static s32 sDmaMgrQueueFullLogged = 0; -#if IS_DEBUG +#if DEBUG_FEATURES if ((ram == NULL) || (osMemSize < OS_K0_TO_PHYSICAL(ram) + size) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) || (size & 1)) { - // The line numbers for `DMA_ERROR` are only used in retail builds, but this usage was removed so - // its line number is unknown. //! @bug `req` is passed to `DMA_ERROR` without rom, ram and size being set DMA_ERROR(req, NULL, "ILLIGAL DMA-FUNCTION CALL", T("パラメータ異常です", "Parameter error"), "../z_std_dma.c", - 0, 0, 0); + UNK_LINE, UNK_LINE, UNK_LINE); } #endif @@ -571,7 +569,7 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, req->notifyQueue = queue; req->notifyMsg = msg; -#if IS_DEBUG +#if DEBUG_FEATURES if (1 && (sDmaMgrQueueFullLogged == 0) && MQ_IS_FULL(&sDmaMgrMsgQueue)) { sDmaMgrQueueFullLogged++; PRINTF("%c", BEL); @@ -623,7 +621,7 @@ void DmaMgr_Init(void) { (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart)); PRINTF("dma_rom_ad[]\n"); -#if IS_DEBUG +#if DEBUG_FEATURES name = sDmaMgrFileNames; iter = gDmaDataTable; idx = 0; @@ -674,7 +672,7 @@ void DmaMgr_Init(void) { osStartThread(&sDmaMgrThread); } -#if IS_DEBUG +#if DEBUG_FEATURES /** * Asynchronous DMA Request with source file and line info for debugging. * diff --git a/src/code/PreRender.c b/src/code/PreRender.c index c15981c281..6c650b82a6 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -598,7 +598,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { buffCvg[i] = this->cvgSave[xi + yi * this->width] >> 5; } -#if IS_DEBUG +#if DEBUG_FEATURES if (buffCvg[7] == 7) { PRINTF("Error, should not be in here \n"); return; @@ -693,7 +693,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { (((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \ : (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3)))) -#if IS_DEBUG +#if DEBUG_FEATURES #define R_HREG_MODE_DEBUG R_HREG_MODE #else #define R_HREG_MODE_DEBUG ((void)0, 0) @@ -820,7 +820,7 @@ void PreRender_ApplyFilters(PreRender* this) { } } - if (IS_DEBUG && PRERENDER_DIVOT_CONTROL != 0) { + if (DEBUG_FEATURES && PRERENDER_DIVOT_CONTROL != 0) { // Apply divot filter PreRender_DivotFilter(this); } diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index 75eb8d75a9..2bdfc6bcdc 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -36,7 +36,7 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); carriedActor->world.pos = pos; -#if IS_DEBUG +#if DEBUG_FEATURES if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) { @@ -76,8 +76,8 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) { if (dynaActor != NULL) { DynaPolyActor_SetActorOnTop(dynaActor); - if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_26)) { - func_80043538(dynaActor); + if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_CAN_PRESS_SWITCHES)) { + DynaPolyActor_SetSwitchPressed(dynaActor); } } } diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c index 83ca32149f..1a4d9f58d5 100644 --- a/src/code/code_80043480.c +++ b/src/code/code_80043480.c @@ -44,8 +44,8 @@ void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId) { } } -void func_80043538(DynaPolyActor* dynaActor) { - dynaActor->interactFlags |= DYNA_INTERACT_3; +void DynaPolyActor_SetSwitchPressed(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_SWITCH_PRESSED; } s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor) { @@ -72,8 +72,8 @@ s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor) { } } -s32 func_800435B4(DynaPolyActor* dynaActor) { - if (dynaActor->interactFlags & DYNA_INTERACT_3) { +s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_SWITCH_PRESSED) { return true; } else { return false; diff --git a/src/code/code_800D31A0.c b/src/code/code_800D31A0.c index 59e60968b0..e7bd207d75 100644 --- a/src/code/code_800D31A0.c +++ b/src/code/code_800D31A0.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#if IS_DEBUG +#if DEBUG_FEATURES u32 gIsCtrlr2Valid = false; #endif @@ -12,7 +12,7 @@ NORETURN void func_800D31A0(void) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void func_800D31F0(void) { gIsCtrlr2Valid = (gPadMgr.validCtrlrsMask & 2) != 0; } diff --git a/src/code/code_n64dd_800AD410.c b/src/code/code_n64dd_800AD410.c index 66dcc3cc76..979a95afbb 100644 --- a/src/code/code_n64dd_800AD410.c +++ b/src/code/code_n64dd_800AD410.c @@ -11,8 +11,8 @@ vu8 D_80121214; void func_800AD410(void) { if (!D_80121210) { - DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, - _n64ddSegmentRomEnd - _n64ddSegmentRomStart); + DMA_REQUEST_SYNC(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, + _n64ddSegmentRomEnd - _n64ddSegmentRomStart, UNK_FILE, UNK_LINE); bzero(_n64ddSegmentBssStart, _n64ddSegmentBssEnd - _n64ddSegmentBssStart); D_80121210 = true; D_80121211 = func_801C6E80(); diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 242609295d..ec3ef8ec1f 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,5 +1,9 @@ #include "global.h" +#include "config.h" + +#if IS_CAMERA_DEBUG_ENABLED + #define DEBUG_CAM_CONTROLLER_PORT 2 static PlayState* sPlay; @@ -2366,3 +2370,5 @@ void func_800BB060(void) { int func_800BB06C(void) { return sDebugCamPtr->unk_00 == 2 && sDebugCamAnim.unk_0A != 0; } + +#endif diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index faf41a230c..8397b28c47 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -9,14 +9,16 @@ void __osDisplayArena(Arena* arena); Arena sDebugArena; -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR; void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&sDebugArena); +#endif return; } } else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { @@ -36,7 +38,7 @@ void* DebugArena_Malloc(u32 size) { return ptr; } -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED void* DebugArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sDebugArena, size, file, line); @@ -52,7 +54,7 @@ void* DebugArena_MallocR(u32 size) { return ptr; } -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED void* DebugArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sDebugArena, size, file, line); @@ -67,7 +69,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing" @@ -79,7 +81,7 @@ void DebugArena_Free(void* ptr) { __osFree(&sDebugArena, ptr); } -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED void DebugArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sDebugArena, ptr, file, line); } @@ -98,13 +100,13 @@ void* DebugArena_Calloc(u32 num, u32 size) { return ret; } +#if PLATFORM_GC && IS_DEBUG_HEAP_ENABLED void DebugArena_Display(void) { - if (IS_DEBUG_HEAP_ENABLED) { - // Likely copypasted from ZeldaArena_Display, should say "Debug" - PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); - __osDisplayArena(&sDebugArena); - } + // Likely copypasted from ZeldaArena_Display, should say "Debug" + PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); + __osDisplayArena(&sDebugArena); } +#endif void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&sDebugArena, outMaxFree, outFree, outAlloc); @@ -115,14 +117,14 @@ void DebugArena_Check(void) { } void DebugArena_Init(void* start, u32 size) { -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sDebugArena, start, size); } void DebugArena_Cleanup(void) { -#if IS_DEBUG +#if IS_DEBUG_HEAP_ENABLED gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sDebugArena); diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 49bd25ff75..7b28ffefa3 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -1161,9 +1161,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { // Since the above line triggers an exception and transfers execution to the fault handler // this function does not return and the rest of the function is unreachable. -#ifdef __GNUC__ - __builtin_unreachable(); -#endif + UNREACHABLE(); } /** diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index 5145173e98..7ea68abeb8 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,6 +1,6 @@ #if PLATFORM_N64 -#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "global.h" #include "fault.h" @@ -8,7 +8,7 @@ #include "stack.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.2:96 pal-1.0:96 pal-1.1:96" +#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" typedef struct FaultMgr { OSThread thread; @@ -822,7 +822,7 @@ void Fault_Init(void) { osStartThread(&gFaultMgr.thread); } -void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { +NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { gFaultMsgId = 4; osSyncPrintf("HungUp on Thread %d", osGetThreadId(NULL)); osSyncPrintf("%s\n", exp1 != NULL ? exp1 : "(NULL)"); @@ -843,7 +843,7 @@ void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { } while (true); } -void Fault_AddHungupAndCrash(const char* file, int line) { +NORETURN void Fault_AddHungupAndCrash(const char* file, int line) { char msg[256]; sprintf(msg, "HungUp %s:%d", file, line); diff --git a/src/code/game.c b/src/code/game.c index d84f947fd5..7b7636145f 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -12,11 +12,10 @@ VisZBuf sVisZBuf; VisMono sVisMono; ViMode sViMode; -// IS_DEBUG +#if DEBUG_FEATURES FaultClient sGameFaultClient; u16 sLastButtonPressed; -#if IS_DEBUG void GameState_FaultPrint(void) { static char sBtnChars[] = "ABZSuldr*+LRudlr"; s32 i; @@ -71,18 +70,16 @@ void GameState_SetFBFilter(Gfx** gfxP) { } void func_800C4344(GameState* gameState) { -#if PLATFORM_N64 - if (D_80121212 != 0) { - func_801C7E78(); - } -#elif IS_DEBUG +#if DEBUG_FEATURES Input* selectedInput; s32 hexDumpSize; u16 inputCompareValue; +#if PLATFORM_GC if (R_HREG_MODE == HREG_MODE_HEAP_FREE_BLOCK_TEST) { __osMalloc_FreeBlockTest_Enable = R_HEAP_FREE_BLOCK_TEST_TOGGLE; } +#endif if (R_HREG_MODE == HREG_MODE_INPUT_TEST) { selectedInput = @@ -110,7 +107,7 @@ void func_800C4344(GameState* gameState) { gDmaMgrDmaBuffSize = SREG(21) != 0 ? ALIGN16(SREG(21)) : DMAMGR_DEFAULT_BUFSIZE; gSystemArenaLogSeverity = HREG(61); -#if IS_DEBUG +#if DEBUG_FEATURES gZeldaArenaLogSeverity = HREG(62); #endif @@ -125,47 +122,52 @@ void func_800C4344(GameState* gameState) { if (R_PRINT_MEMORY_TRIGGER < 0) { R_PRINT_MEMORY_TRIGGER = 0; hexDumpSize = (u32)(R_PRINT_MEMORY_SIZE == 0 ? 0x100 : R_PRINT_MEMORY_SIZE * 0x10); -#if IS_DEBUG +#if DEBUG_FEATURES LogUtils_LogHexDump((void*)(0x80000000 + (R_PRINT_MEMORY_ADDR << 8)), hexDumpSize); #endif } } #endif + +#if PLATFORM_N64 + if (D_80121212 != 0) { + func_801C7E78(); + } +#endif } -// SHOW_INPUT_DISPLAY +#if CAN_SHOW_INPUT_DISPLAY void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { - if (CAN_SHOW_INPUT_DISPLAY) { - static const u16 sInpDispBtnColors[] = { - GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), - GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(0, 255, 255, 1), GPACK_RGBA5551(255, 0, 255, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(255, 0, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(0, 255, 0, 1), - GPACK_RGBA5551(0, 0, 255, 1), - }; - s32 i, j, k; - Gfx* gfx = *gfxP; - - gDPPipeSync(gfx++); - gDPSetOtherMode(gfx++, - G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); - - for (i = 0; i < 16; i++) { - j = i; - if (input & (1 << i)) { - gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); - k = i + 1; - gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); - gDPPipeSync(gfx++); - } - } + static const u16 sInpDispBtnColors[] = { + GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), + GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(0, 255, 255, 1), GPACK_RGBA5551(255, 0, 255, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(255, 0, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(0, 255, 0, 1), + GPACK_RGBA5551(0, 0, 255, 1), + }; + s32 i, j, k; + Gfx* gfx = *gfxP; - *gfxP = gfx; + gDPPipeSync(gfx++); + gDPSetOtherMode(gfx++, + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + + for (i = 0; i < 16; i++) { + j = i; + if (input & (1 << i)) { + gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); + k = i + 1; + gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); + gDPPipeSync(gfx++); + } } + + *gfxP = gfx; } +#endif void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { Gfx* newDList; @@ -180,12 +182,14 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { GameState_SetFBFilter(&newDList); } -#if IS_DEBUG +#if DEBUG_FEATURES sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; - if (CAN_SHOW_INPUT_DISPLAY && R_DISABLE_INPUT_DISPLAY == 0) { +#if CAN_SHOW_INPUT_DISPLAY + if (R_DISABLE_INPUT_DISPLAY == 0) { GameState_DrawInputDisplay(sLastButtonPressed, &newDList); } +#endif if (IS_AUDIO_DEBUG_ENABLED && (R_ENABLE_AUDIO_DBG & 1)) { s32 pad; @@ -200,13 +204,27 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { #endif + if (R_ENABLE_ARENA_DBG < 0) { +#if PLATFORM_GC && DEBUG_FEATURES + s32 pad; +#if IS_DEBUG_HEAP_ENABLED + DebugArena_Display(); +#endif + SystemArena_Display(); +#endif + PRINTF(T("ハイラル滅亡まであと %08x バイト(game_alloc)\n", + "%08x bytes left until Hyrule is destroyed (game_alloc)\n"), + THA_GetRemaining(&gameState->tha)); + R_ENABLE_ARENA_DBG = 0; + } + gSPEndDisplayList(newDList++); Gfx_Close(polyOpaP, newDList); POLY_OPA_DISP = newDList; CLOSE_DISPS(gfxCtx, "../game.c", 800); - if (IS_DEBUG && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR)) { + if (DEBUG_FEATURES && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR)) { Debug_DrawText(gfxCtx); } @@ -287,7 +305,7 @@ void GameState_Update(GameState* gameState) { } #endif -#if IS_DEBUG +#if OOT_VERSION >= PAL_1_0 && DEBUG_FEATURES if (SREG(63) == 1u) { if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) { R_VI_MODE_EDIT_STATE = VI_MODE_EDIT_STATE_INACTIVE; @@ -434,7 +452,7 @@ void GameState_Realloc(GameState* gameState, size_t size) { THA_Init(&gameState->tha, NULL, 0); PRINTF(T("ハイラル再確保失敗\n", "Failure to secure Hyrule\n")); -#if IS_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES SystemArena_Display(); #endif @@ -451,8 +469,8 @@ void GameState_Realloc(GameState* gameState, size_t size) { } void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) { - OSTime startTime; - OSTime endTime; + UNUSED_NDEBUG OSTime startTime; + UNUSED_NDEBUG OSTime endTime; PRINTF(T("game コンストラクタ開始\n", "game constructor start\n")); gameState->gfxCtx = gfxCtx; @@ -491,7 +509,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g VisCvg_Init(&sVisCvg); VisZBuf_Init(&sVisZBuf); VisMono_Init(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !IS_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Init(&sViMode); } @@ -505,7 +523,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g PRINTF(T("その他初期化 処理時間 %d us\n", "Other initialization processing time %d us\n"), OS_CYCLES_TO_USEC(endTime - startTime)); -#if IS_DEBUG +#if DEBUG_FEATURES Fault_AddClient(&sGameFaultClient, GameState_FaultPrint, NULL, NULL); #endif @@ -535,12 +553,20 @@ void GameState_Destroy(GameState* gameState) { VisCvg_Destroy(&sVisCvg); VisZBuf_Destroy(&sVisZBuf); VisMono_Destroy(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !IS_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Destroy(&sViMode); } THA_Destroy(&gameState->tha); GameAlloc_Cleanup(&gameState->alloc); +#if PLATFORM_GC && DEBUG_FEATURES + SystemArena_Display(); +#endif + +#if DEBUG_FEATURES + Fault_RemoveClient(&sGameFaultClient); +#endif + PRINTF(T("game デストラクタ終了\n", "game destructor end\n")); } @@ -556,7 +582,7 @@ u32 GameState_IsRunning(GameState* gameState) { return gameState->running; } -#if IS_DEBUG +#if DEBUG_FEATURES void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line) { void* ret; diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index 06fa9b92d7..d625bc65f7 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -12,7 +12,7 @@ void GameAlloc_Log(GameAlloc* this) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line) { GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); diff --git a/src/code/graph.c b/src/code/graph.c index 4657126c4c..150d307753 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -8,7 +8,7 @@ #define GFXPOOL_TAIL_MAGIC 0x5678 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" /** * The time at which the previous `Graph_Update` ended. @@ -30,7 +30,7 @@ OSTime sGraphPrevTaskTimeStart; u16 (*gWorkBuf)[SCREEN_WIDTH * SCREEN_HEIGHT]; // pointer-to-array, array itself is allocated (see below) #endif -#if IS_DEBUG +#if DEBUG_FEATURES FaultClient sGraphFaultClient; UCodeInfo D_8012D230[3] = { @@ -164,21 +164,21 @@ void Graph_Init(GraphicsContext* gfxCtx) { osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); -#if IS_DEBUG +#if DEBUG_FEATURES func_800D31F0(); Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); #endif } void Graph_Destroy(GraphicsContext* gfxCtx) { -#if IS_DEBUG +#if DEBUG_FEATURES func_800D3210(); Fault_RemoveClient(&sGraphFaultClient); #endif } void Graph_TaskSet00(GraphicsContext* gfxCtx) { -#if IS_DEBUG +#if DEBUG_FEATURES static Gfx* sPrevTaskWorkBuffer = NULL; #endif OSTask_t* task = &gfxCtx->task.list.t; @@ -195,7 +195,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osStopTimer(&timer); if (msg == (OSMesg)666) { -#if OOT_DEBUG +#if DEBUG_FEATURES PRINTF(VT_FGCOL(RED)); PRINTF(T("RCPが帰ってきませんでした。", "RCP did not return.")); PRINTF(VT_RST); @@ -218,7 +218,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK); -#if OOT_DEBUG +#if DEBUG_FEATURES sPrevTaskWorkBuffer = gfxCtx->workBuffer; #endif } @@ -295,7 +295,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gameState->inPreNMIState = false; Graph_InitTHGA(gfxCtx); -#if IS_DEBUG +#if DEBUG_FEATURES OPEN_DISPS(gfxCtx, "../graph.c", 966); gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0); @@ -310,7 +310,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GameState_ReqPadData(gameState); GameState_Update(gameState); -#if IS_DEBUG +#if DEBUG_FEATURES OPEN_DISPS(gfxCtx, "../graph.c", 987); gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0); @@ -327,7 +327,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gSPBranchList(WORK_DISP++, gfxCtx->polyOpaBuffer); gSPBranchList(POLY_OPA_DISP++, gfxCtx->polyXluBuffer); gSPBranchList(POLY_XLU_DISP++, gfxCtx->overlayBuffer); -#if IS_DEBUG +#if DEBUG_FEATURES gSPBranchList(OVERLAY_DISP++, gfxCtx->debugBuffer); gSPBranchList(DEBUG_DISP++, WORK_DISP); gDPPipeSync(WORK_DISP++); @@ -341,7 +341,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { CLOSE_DISPS(gfxCtx, "../graph.c", 1028); -#if IS_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_PLAY && R_PLAY_ENABLE_UCODE_DISAS == 2) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_TOGGLE = -1; @@ -436,7 +436,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { Audio_Update(); -#if IS_DEBUG +#if DEBUG_FEATURES if (IS_MAP_SELECT_ENABLED && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { gSaveContext.gameMode = GAMEMODE_NORMAL; @@ -483,7 +483,7 @@ void Graph_ThreadEntry(void* arg0) { gameState = SYSTEM_ARENA_MALLOC(size, "../graph.c", 1196); if (gameState == NULL) { -#if IS_DEBUG +#if DEBUG_FEATURES char faultMsg[0x50]; PRINTF(T("確保失敗\n", "Failure to secure\n")); @@ -536,7 +536,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) { return THGA_AllocTail(&gfxCtx->polyOpa, ALIGN16(size)); } -#if IS_DEBUG +#if DEBUG_FEATURES void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { #if GBI_DEBUG dispRefs[0] = gfxCtx->polyOpa.p; diff --git a/src/code/main.c b/src/code/main.c index c2ef9d893e..ee6515bd22 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -5,7 +5,7 @@ extern uintptr_t gSegments[NUM_SEGMENTS]; #pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:252 gc-jp-ce:252 gc-jp-mq:252 gc-us:252 gc-us-mq:252" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" extern struct PreNmiBuff* gAppNmiBufferPtr; extern struct Scheduler gScheduler; @@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.2:151 pal-1.0:149 pal-1.1:149" + "ntsc-1.0:148 ntsc-1.1:148 ntsc-1.2:148 pal-1.0:146 pal-1.1:146" extern u8 _buffersSegmentEnd[]; @@ -65,7 +65,7 @@ Rainbow gRainbow; u8 gRDPTimingsExist; -#if IS_DEBUG +#if DEBUG_FEATURES void Main_LogSystemHeap(void) { PRINTF(VT_FGCOL(GREEN)); PRINTF( @@ -109,7 +109,8 @@ void Main(void* arg) { fb, gSystemHeapSize); SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap - if (IS_DEBUG_HEAP_ENABLED) { +#if IS_DEBUG_HEAP_ENABLED + { void* debugHeapStart; u32 debugHeapSize; @@ -124,6 +125,7 @@ void Main(void* arg) { PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize); DebugArena_Init(debugHeapStart, debugHeapSize); } +#endif Rainbow_Init(&gRainbow); Regs_Init(); @@ -135,7 +137,7 @@ void Main(void* arg) { osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf)); osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL); -#if IS_DEBUG +#if DEBUG_FEATURES Main_LogSystemHeap(); #endif diff --git a/src/code/padmgr.c b/src/code/padmgr.c index ecd246033e..4486e541a0 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -33,7 +33,7 @@ #include "terminal.h" #define PADMGR_LOG(controllerNum, msg) \ - if (IS_DEBUG) { \ + if (DEBUG_FEATURES) { \ PRINTF(VT_FGCOL(YELLOW)); \ PRINTF(T("padmgr: %dコン: %s\n", "padmgr: Controller %d: %s\n"), (controllerNum) + 1, (msg)); \ PRINTF(VT_RST); \ @@ -68,7 +68,7 @@ s32 gPadMgrLogSeverity = LOG_SEVERITY_CRITICAL; OSMesgQueue* PadMgr_AcquireSerialEventQueue(PadMgr* padMgr) { OSMesgQueue* serialEventQueue; -#if IS_DEBUG +#if DEBUG_FEATURES serialEventQueue = NULL; #endif @@ -184,7 +184,7 @@ void PadMgr_UpdateRumble(PadMgr* padMgr) { } } else { if (padMgr->pakType[i] != CONT_PAK_NONE) { - if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !IS_DEBUG) { + if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !DEBUG_FEATURES) { PADMGR_LOG(i, T("振動パックが抜かれたようです", "It seems that a rumble pak was pulled out")); padMgr->pakType[i] = CONT_PAK_NONE; } else { @@ -363,7 +363,7 @@ void PadMgr_HandleRetrace(PadMgr* padMgr) { osRecvMesg(serialEventQueue, NULL, OS_MESG_BLOCK); osContGetReadData(padMgr->pads); -#if !IS_DEBUG +#if !DEBUG_FEATURES // Clear controllers 2 and 4 bzero(&padMgr->pads[1], sizeof(OSContPad)); bzero(&padMgr->pads[3], sizeof(OSContPad)); diff --git a/src/code/sched.c b/src/code/sched.c index 656c4994fd..fd82aa3d3e 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -54,7 +54,7 @@ OSTime sRSPOtherTimeStart; OSTime sRDPTimeStart; #endif -#if OOT_VERSION < PAL_1_0 || IS_DEBUG +#if OOT_VERSION < PAL_1_0 || DEBUG_FEATURES vs32 sSchedDebugPrintfEnabled = false; #define SCHED_DEBUG_PRINTF \ @@ -85,7 +85,7 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) { Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16); } -#if IS_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_INIT != HREG_MODE_SCHED) { R_SCHED_TOGGLE_SPECIAL_FEATURES = 0; R_SCHED_GAMMA_ON = 0; @@ -151,7 +151,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) { } void Sched_HandlePreNMI(Scheduler* sc) { -#if IS_DEBUG +#if DEBUG_FEATURES OSTime now; if (sc->curRSPTask != NULL) { diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index 73f92cb261..ad8da58d35 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -86,7 +86,7 @@ void Letterbox_Update(s32 updateRate) { sLetterboxState = LETTERBOX_STATE_IDLE; } - if (IS_DEBUG && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { + if (DEBUG_FEATURES && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { if (R_LETTERBOX_INIT != HREG_MODE_LETTERBOX) { R_LETTERBOX_INIT = HREG_MODE_LETTERBOX; R_LETTERBOX_ENABLE_LOGS = 0; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 3e1ea53c09..b3c01f97b5 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -9,14 +9,14 @@ uintptr_t sSysCfbEnd; void SysCfb_Init(s32 n64dd) { u32 screenSize; - uintptr_t tmpFbEnd; + UNUSED_NDEBUG uintptr_t tmpFbEnd; if (osMemSize >= 0x800000) { PRINTF(T("8Mバイト以上のメモリが搭載されています\n", "8MB or more memory is installed\n")); - tmpFbEnd = IS_DEBUG_HEAP_ENABLED ? 0x8044BE80 : SYS_CFB_END; + tmpFbEnd = SYS_CFB_END; if (n64dd == 1) { PRINTF(T("RAM 8M mode (N64DD対応)\n", "RAM 8M mode (N64DD compatible)\n")); -#if IS_DEBUG +#if DEBUG_FEATURES sSysCfbEnd = 0x805FB000; #else sSysCfbEnd = 0x80600000; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 79c8945bca..96b352d693 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -6,7 +6,7 @@ #include "sys_math3d.h" #pragma increment_block_number "gc-eu:103 gc-eu-mq:103 gc-jp:103 gc-jp-ce:103 gc-jp-mq:103 gc-us:103 gc-us-mq:103" \ - "ntsc-1.2:79 pal-1.0:80 pal-1.1:80" + "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:79 pal-1.0:80 pal-1.1:80" s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA); @@ -929,7 +929,7 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane) { * `nx`, `ny`, `nz`, and `originDist` */ f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) { - if (IS_DEBUG && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { + if (DEBUG_FEATURES && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { PRINTF(VT_COL(YELLOW, BLACK)); PRINTF(T("Math3DLengthPlaneAndPos():法線size がゼロ近いです%f %f %f\n", "Math3DLengthPlaneAndPos(): Normal size is near zero %f %f %f\n"), diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c index cec402f72e..bc2197fa1e 100644 --- a/src/code/sys_math3d_draw.c +++ b/src/code/sys_math3d_draw.c @@ -1,7 +1,7 @@ #include "z64.h" #include "functions.h" -#if IS_DEBUG +#if DEBUG_FEATURES void Math3D_VtxF2L(Vtx* r, Vec3f* v) { r->n.ob[0] = Math_FFloorF(0.5f + v->x * 128.0f); r->n.ob[1] = Math_FFloorF(0.5f + v->y * 128.0f); diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index cf82bb9972..19db7799e6 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -1,5 +1,5 @@ #include "global.h" -#if OOT_DEBUG +#if DEBUG_FEATURES #include "fault.h" #endif @@ -609,7 +609,7 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { return dest; } -#if IS_DEBUG +#if DEBUG_FEATURES Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line) { return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest); @@ -629,7 +629,7 @@ Mtx* Matrix_Finalize(GraphicsContext* gfxCtx) { return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); } -#endif /* IS_DEBUG */ +#endif /* DEBUG_FEATURES */ Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) { return Matrix_MtxFToMtx(src, GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); @@ -975,7 +975,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) { } } -#if IS_DEBUG +#if DEBUG_FEATURES MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line) { s32 i, j; diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c index da8b9d8750..10844f3674 100644 --- a/src/code/sys_rumble.c +++ b/src/code/sys_rumble.c @@ -147,7 +147,7 @@ void RumbleMgr_Init(RumbleMgr* rumbleMgr) { } void RumbleMgr_Destroy(RumbleMgr* rumbleMgr) { -#if IS_DEBUG +#if DEBUG_FEATURES bzero(rumbleMgr, sizeof(RumbleMgr)); #endif } diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index 00f1eab8c2..9cba821c85 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,6 +1,8 @@ #include "global.h" #include "ucode_disas.h" +#if DEBUG_FEATURES + typedef struct F3dzexConst { /* 0x00 */ u32 value; /* 0x04 */ const char* name; @@ -1245,3 +1247,5 @@ void UCodeDisas_RegisterUCode(UCodeDisas* this, s32 count, UCodeInfo* ucodeArray void UCodeDisas_SetCurUCode(UCodeDisas* this, void* ptr) { UCodeDisas_SetCurUCodeImpl(this, ptr); } + +#endif diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 90808a1c39..3e80120e93 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -12,12 +12,12 @@ #include "assets/objects/object_bdoor/object_bdoor.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" static CollisionPoly* sCurCeilingPoly; static s32 sCurCeilingBgId; -#if IS_DEBUG +#if DEBUG_FEATURES #define ACTOR_DEBUG_PRINTF \ if (R_ENABLE_ACTOR_DEBUG_PRINTF) \ PRINTF @@ -917,7 +917,7 @@ void Actor_Destroy(Actor* actor, PlayState* play) { actor->destroy(actor, play); actor->destroy = NULL; } else { -#if IS_DEBUG +#if DEBUG_FEATURES overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -1119,15 +1119,24 @@ s32 func_8002DDF4(PlayState* play) { return player->stateFlags2 & PLAYER_STATE2_12; } -void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB) { +/** + * Swap hookshot attachment state from one actor to another. + * + * Note: There is no safety check for a NULL hookshot pointer. + * The responsibility is on the caller to make sure the hookshot exists. + */ +void Actor_SwapHookshotAttachment(PlayState* play, Actor* srcActor, Actor* destActor) { ArmsHook* hookshot = (ArmsHook*)Actor_Find(&play->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); - hookshot->grabbed = actorB; - hookshot->grabbedDistDiff.x = 0.0f; - hookshot->grabbedDistDiff.y = 0.0f; - hookshot->grabbedDistDiff.z = 0.0f; - actorB->flags |= ACTOR_FLAG_13; - actorA->flags &= ~ACTOR_FLAG_13; + hookshot->attachedActor = destActor; + + // The hookshot will attach at exactly the actors world position with 0 offset + hookshot->attachPointOffset.x = 0.0f; + hookshot->attachPointOffset.y = 0.0f; + hookshot->attachPointOffset.z = 0.0f; + + destActor->flags |= ACTOR_FLAG_HOOKSHOT_ATTACHED; + srcActor->flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; } void func_8002DE74(PlayState* play, Player* player) { @@ -1468,7 +1477,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* *hilite = GRAPH_ALLOC(gfxCtx, sizeof(Hilite)); -#if IS_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) { PRINTF("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX, eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z); @@ -2072,7 +2081,7 @@ s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, } #pragma increment_block_number "gc-eu:22 gc-eu-mq:22 gc-jp:22 gc-jp-ce:22 gc-jp-mq:22 gc-us:22 gc-us-mq:22" \ - "ntsc-1.2:22 pal-1.0:22 pal-1.1:22" + "ntsc-1.0:22 ntsc-1.1:22 ntsc-1.2:22 pal-1.0:22 pal-1.1:22" // Local data used for Farore's Wind light (stored in BSS) LightInfo D_8015BC00; @@ -2338,7 +2347,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { Actor* actor; Player* player; u32* categoryFreezeMaskP; - u32 requiredActorFlag; + u32 freezeExceptionFlag; u32 canFreezeCategory; Actor* sp74; ActorEntry* actorEntry; @@ -2351,7 +2360,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } sp74 = NULL; - requiredActorFlag = 0; + freezeExceptionFlag = 0; if (play->numActorEntries != 0) { actorEntry = &play->actorEntryList[0]; @@ -2365,7 +2374,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actorCtx->unk_02--; } -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(0) == -100) { Actor* player = &GET_PLAYER(play)->actor; @@ -2377,8 +2386,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { categoryFreezeMaskP = &sCategoryFreezeMasks[0]; - if (player->stateFlags2 & PLAYER_STATE2_27) { - requiredActorFlag = ACTOR_FLAG_25; + if (player->stateFlags2 & PLAYER_STATE2_USING_OCARINA) { + freezeExceptionFlag = ACTOR_FLAG_UPDATE_DURING_OCARINA; } if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && ((player->actor.textId & 0xFF00) != 0x600)) { @@ -2406,8 +2415,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } else if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_Kill(actor); actor = actor->next; - } else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) || - (!requiredActorFlag && canFreezeCategory && + } else if ((freezeExceptionFlag != 0 && !(actor->flags & freezeExceptionFlag)) || + (freezeExceptionFlag == 0 && canFreezeCategory && !((sp74 == actor) || (actor == player->naviActor) || (actor == player->heldActor) || (&player->actor == actor->parent)))) { CollisionCheck_ResetDamage(&actor->colChkInfo); @@ -2426,7 +2435,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer); actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor); - actor->flags &= ~ACTOR_FLAG_24; + actor->flags &= ~ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) { if (actor == player->focusActor) { @@ -2488,7 +2497,7 @@ void Actor_FaultPrint(Actor* actor, char* command) { Fault_Printf("ACTOR NAME is NULL"); } -#if IS_DEBUG +#if DEBUG_FEATURES overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -2743,22 +2752,22 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { gDPNoOpString(POLY_OPA_DISP++, actorName, i); gDPNoOpString(POLY_XLU_DISP++, actorName, i); - if (IS_DEBUG) { + if (DEBUG_FEATURES) { HREG(66) = i; } - if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } - if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { if (actor->sfx != 0) { Actor_UpdateFlaggedAudio(actor); } } - if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { if (func_800314B0(play, actor)) { actor->flags |= ACTOR_FLAG_6; } else { @@ -2768,7 +2777,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; - if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_REACT_TO_LENS) && ((play->roomCtx.curRoom.lensMode == LENS_MODE_SHOW_ACTORS) || play->actorCtx.lensActive || @@ -2778,7 +2787,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { - if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { Actor_Draw(play, actor); actor->isDrawn = true; @@ -2791,15 +2800,15 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { } } - if (!IS_DEBUG || (HREG(64) != 1) || (HREG(73) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(73) != 0)) { Effect_DrawAll(play->state.gfxCtx); } - if (!IS_DEBUG || (HREG(64) != 1) || (HREG(74) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(74) != 0)) { EffectSs_DrawAll(play); } - if (!IS_DEBUG || (HREG(64) != 1) || (HREG(72) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(72) != 0)) { if (play->actorCtx.lensActive) { Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors); if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) { @@ -2814,11 +2823,11 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { Lights_DrawGlow(play); } - if (!IS_DEBUG || (HREG(64) != 1) || (HREG(75) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(75) != 0)) { TitleCard_Draw(play, &actorCtx->titleCtx); } -#if IS_DEBUG +#if DEBUG_FEATURES if ((HREG(64) != 1) || (HREG(76) != 0)) { CollisionCheck_DrawCollision(play, &play->colChkCtx); } @@ -3011,7 +3020,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos overlayEntry = &gActorOverlayTable[actorId]; ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); -#if IS_DEBUG +#if DEBUG_FEATURES name = overlayEntry->name != NULL ? overlayEntry->name : ""; #endif @@ -3197,7 +3206,7 @@ Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayStat } Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { - char* name; + UNUSED_NDEBUG char* name; Player* player; Actor* newHead; ActorOverlay* overlayEntry; @@ -4040,6 +4049,7 @@ void func_8003424C(PlayState* play, Vec3f* arg1) { } void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration) { + //! @bug This first comparison is always false as COLORFILTER_COLORFLAG_GRAY is out of range of an s16. if ((colorFlag == COLORFILTER_COLORFLAG_GRAY) && !(colorIntensityMax & COLORFILTER_INTENSITY_FLAG)) { Actor_PlaySfx(actor, NA_SE_EN_LIGHT_ARROW_HIT); } @@ -4440,13 +4450,24 @@ void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, frameCount, animationInfo->mode, animationInfo->morphFrames); } -void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3) { +/** + * Fills two tables with rotation angles that can be used to simulate idle animations. + * + * The rotation angles are dependent on the current frame, so should be updated regularly, generally every frame. + * + * This is done for the desired limb by taking either the `sin` of the yTable value or the `cos` of the zTable value, + * multiplying by some scale factor (generally 200), and adding that to the already existing rotation. + * + * Note: With the common scale factor of 200, this effect is practically unnoticeable if the current animation already + * has motion involved. + */ +void Actor_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen) { u32 frames = play->gameplayFrames; s32 i; - for (i = 0; i < arg3; i++) { - arg1[i] = (0x814 + 50 * i) * frames; - arg2[i] = (0x940 + 50 * i) * frames; + for (i = 0; i < tableLen; i++) { + fidgetTableY[i] = (FIDGET_FREQ_Y + FIDGET_FREQ_LIMB * i) * frames; + fidgetTableZ[i] = (FIDGET_FREQ_Z + FIDGET_FREQ_LIMB * i) * frames; } } diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index c34ae6b3f8..52d8ad8556 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -24,7 +24,7 @@ #undef DEFINE_ACTOR_UNSET // Actor Overlay Table definition -#if IS_DEBUG +#if DEBUG_FEATURES #define DEFINE_ACTOR(name, _1, allocType, nameString) \ { \ @@ -80,7 +80,7 @@ s32 gMaxActorId = 0; static FaultClient sFaultClient; void ActorOverlayTable_LogPrint(void) { -#if IS_DEBUG +#if DEBUG_FEATURES ActorOverlay* overlayEntry; u32 i; @@ -100,8 +100,8 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { u32 overlaySize; uintptr_t ramStart; uintptr_t ramEnd; - u32 offset; #if PLATFORM_N64 + u32 offset; uintptr_t pc = gFaultFaultedThread != NULL ? gFaultFaultedThread->context.pc : 0; uintptr_t ra = gFaultFaultedThread != NULL ? gFaultFaultedThread->context.ra : 0; u32 i; @@ -125,7 +125,9 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart; ramStart = (uintptr_t)overlayEntry->loadedRamAddr; ramEnd = ramStart + overlaySize; +#if PLATFORM_N64 offset = (uintptr_t)overlayEntry->vramStart - ramStart; +#endif if (ramStart != 0) { #if PLATFORM_N64 Fault_Printf("%3d %08x-%08x %08x", i, ramStart, ramEnd, offset); @@ -137,7 +139,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { Fault_Printf("\n"); #else Fault_Printf("%3d %08x-%08x %3d %s\n", i, ramStart, ramEnd, overlayEntry->numLoaded, - (IS_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : ""); + (DEBUG_FEATURES && overlayEntry->name != NULL) ? overlayEntry->name : ""); #endif } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7fb0d98b64..b84ef15a77 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.2:136" +#pragma increment_block_number "ntsc-1.0:136 ntsc-1.1:136 ntsc-1.2:136" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); @@ -80,7 +80,7 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = { SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET }; -#if IS_DEBUG +#if DEBUG_FEATURES /** * original name: T_BGCheck_PosErrorCheck */ @@ -1536,7 +1536,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader }; u32 tblMax; u32 memSize; - u32 lookupTblMemSize; + UNUSED_NDEBUG u32 lookupTblMemSize; s32 customNodeListMax; SSNodeList* nodeList; u32 customMemSize; @@ -1719,7 +1719,7 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla break; } -#if IS_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -1971,7 +1971,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul dy = posNext->y - posPrev->y; dz = posNext->z - posPrev->z; -#if IS_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true || BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) { if (actor != NULL) { @@ -2165,7 +2165,7 @@ s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, V *outBgId = BGCHECK_SCENE; *outY = pos->y; -#if IS_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -2238,7 +2238,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, *outBgId = BGCHECK_SCENE; -#if IS_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true || BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) { if (actor != NULL) { @@ -2460,7 +2460,7 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP *outBgId = BGCHECK_SCENE; -#if IS_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -2799,7 +2799,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI PRINTF(VT_RST); if (!DynaPoly_IsBgIdBgActor(bgId)) { -#if IS_DEBUG +#if DEBUG_FEATURES if (bgId == -1) { PRINTF(VT_FGCOL(GREEN)); PRINTF(T("DynaPolyInfo_delReserve():削除されているはずの(?)\n" @@ -2871,7 +2871,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 return; } -#if IS_DEBUG +#if DEBUG_FEATURES if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) { PRINTF(VT_FGCOL(RED)); PRINTF(T("DynaPolyInfo_expandSRT():polygon over %dが%dを越えるとダメ\n", @@ -4425,7 +4425,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec return result; } -#if IS_DEBUG +#if DEBUG_FEATURES /** * Draw a list of dyna polys, specified by `ssList` */ diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 1a1179ae8f..2802a97c8b 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -5,16 +5,12 @@ #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags); s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange); s32 Camera_UpdateWater(Camera* camera); -#if IS_CAMERA_DEBUG_ENABLED -s32 Camera_QRegInit(void); -#endif - #if PLATFORM_N64 #define CAMERA_CHECK_BTN(input, btn) PadUtils_CheckPressed((input), (btn)) #else @@ -22,6 +18,8 @@ s32 Camera_QRegInit(void); #endif #if IS_CAMERA_DEBUG_ENABLED +s32 Camera_QRegInit(void); + #define CAM_DEBUG_RELOAD_PREG(camera) \ if (R_RELOAD_CAM_PARAMS) { \ Camera_CopyPREGToModeValues(camera); \ @@ -612,10 +610,10 @@ Vec3s* Camera_GetBgCamFuncData(Camera* camera) { */ s32 Camera_GetBgCamIndex(Camera* camera, s32* bgId, CollisionPoly* poly) { s32 bgCamIndex; - PosRot playerPosRot; + UNUSED PosRot playerPosRot; s32 ret; - playerPosRot = Actor_GetWorldPosShapeRot(&camera->player->actor); // unused. + playerPosRot = Actor_GetWorldPosShapeRot(&camera->player->actor); bgCamIndex = SurfaceType_GetBgCamIndex(&camera->play->colCtx, poly, *bgId); if (BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, bgCamIndex, *bgId) == CAM_SET_NONE) { @@ -947,7 +945,7 @@ void Camera_UpdateInterface(s16 interfaceField) { Vec3f Camera_BGCheckCorner(Vec3f* linePointA, Vec3f* linePointB, CamColChk* pointAColChk, CamColChk* pointBColChk) { Vec3f closestPoint; - bool result; + UNUSED_NDEBUG bool result; result = func_800427B4(pointAColChk->poly, pointBColChk->poly, linePointA, linePointB, &closestPoint); #if IS_CAMERA_DEBUG_ENABLED @@ -2296,7 +2294,7 @@ s32 Camera_Parallel1(Camera* camera) { camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, camera->fovUpdateRate, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5, 0xA); camera->atLERPStepScale = Camera_ClampLERPScale(camera, sp6A ? roData->unk_1C : roData->unk_14); - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Parallel2(Camera* camera) { @@ -2315,7 +2313,7 @@ s32 Camera_Parallel3(Camera* camera) { if (interfaceField & PARALLEL3_FLAG_1) { camera->stateFlags |= CAM_STATE_CAM_FUNC_FINISH; } - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Parallel4(Camera* camera) { @@ -2341,7 +2339,7 @@ s32 Camera_Jump1(Camera* camera) { VecGeo eyeDiffGeo; VecGeo eyeDiffTarget; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerhead; + UNUSED PosRot playerhead; s16 tangle; Jump1ReadOnlyData* roData = &camera->paramData.jump1.roData; Jump1ReadWriteData* rwData = &camera->paramData.jump1.rwData; @@ -2365,7 +2363,6 @@ s32 Camera_Jump1(Camera* camera) { CAM_DEBUG_RELOAD_PREG(camera); - // playerhead never gets used. playerhead = Actor_GetFocus(&camera->player->actor); eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); @@ -2484,7 +2481,7 @@ s32 Camera_Jump2(Camera* camera) { VecGeo adjAtToEyeDir; VecGeo bgChkPara; VecGeo atToEyeNextDir; - VecGeo atToEyeDir; + UNUSED VecGeo atToEyeDir; f32 temp_f14; f32 temp_f16; f32 sp90; @@ -3115,6 +3112,7 @@ s32 Camera_Battle1(Camera* camera) { : 1.0f) * (fov - ((fov * 0.05f) * distRatio)), camera->fov, camera->fovUpdateRate, 1.0f); + //! @bug Missing return, but the return value is not used. } s32 Camera_Battle2(Camera* camera) { @@ -3461,13 +3459,13 @@ s32 Camera_KeepOn3(Camera* camera) { Actor* colChkActors[2]; VecGeo targetToPlayerDir; VecGeo atToEyeAdj; - VecGeo atToEyeDir; + UNUSED VecGeo atToEyeDir; VecGeo atToEyeNextDir; s32 i; s32 angleCnt; s16 sp82; s16 sp80; - PosRot playerPosRot; + UNUSED PosRot playerPosRot; PosRot* camPlayerPosRot = &camera->playerPosRot; KeepOn3ReadOnlyData* roData = &camera->paramData.keep3.roData; KeepOn3ReadWriteData* rwData = &camera->paramData.keep3.rwData; @@ -3633,7 +3631,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:93 pal-1.0:91 pal-1.1:91" + "ntsc-1.0:90 ntsc-1.1:90 ntsc-1.2:90 pal-1.0:88 pal-1.1:88" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; @@ -3647,7 +3645,7 @@ s32 Camera_KeepOn4(Camera* camera) { f32 temp_f0_2; CollisionPoly* spC0; VecGeo spB8; - VecGeo spB0; + UNUSED VecGeo spB0; VecGeo spA8; s16* temp_s0 = &camera->data2; s16 spA2; @@ -3964,6 +3962,7 @@ s32 Camera_KeepOn4(Camera* camera) { Camera_BGCheck(camera, at, eye); camera->fov = Camera_LERPCeilF(roData->unk_18, camera->fov, camera->fovUpdateRate, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA); + //! @bug Missing return, but the return value is not used. } /** @@ -4200,7 +4199,7 @@ s32 Camera_Fixed3(Camera* camera) { Vec3f* eyeNext = &camera->eyeNext; VecGeo atGeo; BgCamFuncData* bgCamFuncData; - VecGeo eyeAtOffset; + UNUSED VecGeo eyeAtOffset; Fixed3ReadOnlyData* roData = &camera->paramData.fixd3.roData; Fixed3ReadWriteData* rwData = &camera->paramData.fixd3.rwData; s32 pad; @@ -4358,7 +4357,7 @@ s32 Camera_Subj3(Camera* camera) { Vec3f* at = &camera->at; Vec3f* eyeNext = &camera->eyeNext; Vec3f sp98; - Vec3f sp8C; + UNUSED Vec3f sp8C; VecGeo sp84; VecGeo sp7C; VecGeo tGeo; @@ -4753,7 +4752,7 @@ s32 Camera_Unique1(Camera* camera) { VecGeo eyeAtOffset; VecGeo eyeNextAtOffset; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerhead; + UNUSED PosRot playerhead; Unique1ReadOnlyData* roData = &camera->paramData.uniq1.roData; Unique1ReadWriteData* rwData = &camera->paramData.uniq1.rwData; s32 pad; @@ -4796,7 +4795,7 @@ s32 Camera_Unique1(Camera* camera) { camera->animState++; } - playerhead = Actor_GetFocus(&camera->player->actor); // unused + playerhead = Actor_GetFocus(&camera->player->actor); camera->yawUpdateRateInv = Camera_LERPCeilF(100.0f, camera->yawUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->pitchUpdateRateInv = @@ -6731,7 +6730,7 @@ s32 Camera_Demo7(Camera* camera) { camera->stateFlags |= CAM_STATE_DEMO7; camera->animState++; } - //! @bug doesn't return + //! @bug Missing return, but the return value is not used. } s32 Camera_Demo8(Camera* camera) { @@ -6987,7 +6986,7 @@ s32 Camera_Special5(Camera* camera) { CamColChk sp7C; VecGeo sp74; VecGeo sp6C; - VecGeo sp64; + UNUSED VecGeo sp64; VecGeo sp5C; PosRot* playerPosRot = &camera->playerPosRot; Special5ReadOnlyData* roData = &camera->paramData.spec5.roData; @@ -7189,7 +7188,7 @@ s32 Camera_Special6(Camera* camera) { Vec3f eyePosCalc; Vec3f eyeAnim; Vec3f atAnim; - VecGeo eyeAtOffset; + UNUSED VecGeo eyeAtOffset; PosRot* playerPosRot = &camera->playerPosRot; BgCamFuncData* bgCamFuncData; Vec3s bgCamRot; @@ -7894,7 +7893,7 @@ s32 Camera_UpdateWater(Camera* camera) { } Audio_SetExtraFilter(0); } - //! @bug: doesn't always return a value, but sometimes does. + //! @bug Missing return, but the return value is not used. } s32 Camera_UpdateHotRoom(Camera* camera) { @@ -8277,7 +8276,7 @@ Vec3s Camera_Update(Camera* camera) { CAM_BINANG_TO_DEG(camera->camDir.x), camera->camDir.y, CAM_BINANG_TO_DEG(camera->camDir.y)); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (camera->timer != -1 && CAMERA_CHECK_BTN(&D_8015BD7C->state.input[0], BTN_DRIGHT)) { camera->timer = 0; } @@ -8620,7 +8619,7 @@ s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { if (!(camera->behaviorFlags & CAM_BEHAVIOR_BG_PROCESSED)) { requestedCamSetting = Camera_GetBgCamSetting(camera, requestedBgCamIndex); camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; -#if OOT_DEBUG +#if DEBUG_FEATURES settingChangeSuccessful = Camera_RequestSettingImpl(camera, requestedCamSetting, CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX | CAM_REQUEST_SETTING_FORCE_CHANGE) >= 0; @@ -8647,8 +8646,7 @@ s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { #endif return 0x80000000 | requestedBgCamIndex; } - - //! @note: no return here, but return is unused + //! @bug Missing return, but the return value is not used. } Vec3s Camera_GetInputDir(Camera* camera) { @@ -8905,7 +8903,7 @@ void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* d } } -#if OOT_DEBUG +#if DEBUG_FEATURES s32 Camera_QRegInit(void) { if (!R_RELOAD_CAM_PARAMS) { QREG(2) = 1; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 2e29d89161..7534cd5ba7 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,7 +16,7 @@ #include "z_lib.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:104 pal-1.0:104 pal-1.1:104" + "ntsc-1.0:104 ntsc-1.1:104 ntsc-1.2:104 pal-1.0:104 pal-1.1:104" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); @@ -25,7 +25,7 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec #define SAC_ENABLE (1 << 0) -#if IS_DEBUG +#if DEBUG_FEATURES /** * Draws a red triangle with vertices vA, vB, and vC. */ @@ -1028,7 +1028,7 @@ void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCt colChkCtx->sacFlags = 0; CollisionCheck_ClearContext(play, colChkCtx); -#if IS_DEBUG +#if DEBUG_FEATURES AREG(21) = true; AREG(22) = true; AREG(23) = true; @@ -1082,7 +1082,7 @@ void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx colChkCtx->sacFlags &= ~SAC_ENABLE; } -#if IS_DEBUG +#if DEBUG_FEATURES /** * Draws a collider of any shape. * Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn. @@ -2233,7 +2233,7 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk } #pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:252 gc-jp-ce:252 gc-jp-mq:252 gc-us:252 gc-us-mq:252" \ - "ntsc-1.2:252 pal-1.0:252 pal-1.1:252" + "ntsc-1.0:252 ntsc-1.1:252 ntsc-1.2:252 pal-1.0:252 pal-1.1:252" void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol, Collider* acCol) { static TriNorm tri1; @@ -2347,7 +2347,7 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk } } -#if OOT_DEBUG +#if DEBUG_FEATURES static s8 sBssDummy3; static s8 sBssDummy4; #endif @@ -3359,7 +3359,7 @@ void Collider_SetTrisDim(PlayState* play, ColliderTris* tris, s32 elemIndex, Col Collider_SetTrisElementDim(play, &trisElem->dim, src); } -#if OOT_DEBUG +#if DEBUG_FEATURES // The two static Vec3f variables in the function below cross a block index rollover, causing a bss order swap. //! In order to replicate this behavior, we declare a certain amount of sBssDummy variables throughout the file, which //! we fit inside padding added by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in @@ -3742,7 +3742,7 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags) { damage = 8; } -#if IS_DEBUG +#if DEBUG_FEATURES KREG(7) = damage; #endif diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index d493a68924..3af623ce85 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -3,7 +3,7 @@ #include "versions.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" ALIGNED(16) SaveContext gSaveContext; u32 D_8015FA88; diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 9719dd49b4..33f31e84d1 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -16,7 +16,7 @@ typedef struct InputCombo { } InputCombo; // size = 0x4 #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" RegEditor* gRegEditor; // ``gRegEditor->data`` is used by non-debug features in normal gameplay @@ -38,7 +38,7 @@ Color_RGBA8 sDebugCamTextColors[] = { #endif }; -#if IS_DEBUG +#if DEBUG_FEATURES InputCombo sRegGroupInputCombos[REG_GROUPS] = { #if IS_REG_EDITOR_ENABLED { BTN_L, BTN_CUP }, // REG @@ -175,7 +175,7 @@ void DebugCamera_DrawScreenText(GfxPrint* printer) { } } -#if IS_DEBUG +#if DEBUG_FEATURES /** * Updates the state of the Reg Editor according to user input. * Also contains a controller rumble test that can be interfaced with via related REGs. @@ -303,43 +303,41 @@ void Regs_DrawEditor(GfxPrint* printer) { * Draws the Reg Editor and Debug Camera text on screen */ void Debug_DrawText(GraphicsContext* gfxCtx) { - if (IS_DEBUG && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR)) { - Gfx* gfx; - Gfx* opaStart; - GfxPrint printer; - s32 pad; - - OPEN_DISPS(gfxCtx, "../z_debug.c", 628); - - GfxPrint_Init(&printer); - opaStart = POLY_OPA_DISP; - gfx = Gfx_Open(POLY_OPA_DISP); - gSPDisplayList(OVERLAY_DISP++, gfx); - GfxPrint_Open(&printer, gfx); - -#if IS_CAMERA_DEBUG_ENABLED - if (((OREG(0) == 1) || (OREG(0) == 8))) { - DebugCamera_DrawScreenText(&printer); - } -#endif +#if DEBUG_FEATURES && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR) + Gfx* gfx; + Gfx* opaStart; + GfxPrint printer; + s32 pad; + + OPEN_DISPS(gfxCtx, "../z_debug.c", 628); + + GfxPrint_Init(&printer); + opaStart = POLY_OPA_DISP; + gfx = Gfx_Open(POLY_OPA_DISP); + gSPDisplayList(OVERLAY_DISP++, gfx); + GfxPrint_Open(&printer, gfx); + + if ((OREG(0) == 1) || (OREG(0) == 8)) { + DebugCamera_DrawScreenText(&printer); + } #if IS_REG_EDITOR_ENABLED - if (gRegEditor->regPage != 0) { - Regs_DrawEditor(&printer); - } + if (gRegEditor->regPage != 0) { + Regs_DrawEditor(&printer); + } #endif #if IS_CAMERA_DEBUG_ENABLED - sDebugCamTextEntryCount = 0; + sDebugCamTextEntryCount = 0; #endif - gfx = GfxPrint_Close(&printer); - gSPEndDisplayList(gfx++); - Gfx_Close(opaStart, gfx); - POLY_OPA_DISP = gfx; + gfx = GfxPrint_Close(&printer); + gSPEndDisplayList(gfx++); + Gfx_Close(opaStart, gfx); + POLY_OPA_DISP = gfx; - CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); + CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); - GfxPrint_Destroy(&printer); - } + GfxPrint_Destroy(&printer); +#endif } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 0863541277..e0bc95f07f 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -125,8 +125,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:188 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ - "ntsc-1.2:80 pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ + "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; @@ -139,6 +139,7 @@ s16 sQuakeIndex; void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx); +#if DEBUG_FEATURES void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) { if (CAN_SHOW_CS_INFOS) { GfxPrint printer; @@ -160,6 +161,7 @@ void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx GfxPrint_Destroy(&printer); } } +#endif void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_IDLE; @@ -184,8 +186,9 @@ void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { - if (IS_CS_CONTROL_ENABLED) { - Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; +#if IS_CS_CONTROL_ENABLED + { + Input* input = &play->state.input[0]; if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; @@ -200,6 +203,7 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { gSaveContext.cutsceneTrigger = 1; } } +#endif if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) { gSaveContext.cutsceneTrigger = 0; @@ -576,8 +580,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped || (CS_CAN_SKIP_TITLE_SCREEN && (csCtx->curFrame > 20) && - CHECK_BTN_ALL(play->state.input[CS_CTRL_CONTROLLER_PORT].press.button, CS_CTRL_RUN_DEST_CONTROL) && - (gSaveContext.fileNum != 0xFEDC))) { + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && (gSaveContext.fileNum != 0xFEDC))) { csCtx->state = CS_STATE_RUN_UNSTOPPABLE; Audio_SetCutsceneFlag(0); gSaveContext.cutsceneTransitionControl = 1; @@ -737,7 +740,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION: -#if IS_DEBUG +#if DEBUG_FEATURES SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -908,7 +911,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT: -#if IS_DEBUG +#if DEBUG_FEATURES SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -965,7 +968,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_GERUDO_VALLEY_CREDITS: -#if IS_DEBUG +#if DEBUG_FEATURES gSaveContext.gameMode = GAMEMODE_END_CREDITS; Audio_SetSfxBanksMute(0x6F); #endif @@ -1838,13 +1841,13 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) return; } - if (IS_CS_CONTROL_ENABLED) { - Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; - if (DEBUG_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_STOP_CONTROL, input)) { - csCtx->state = CS_STATE_STOP; - return; - } +#if IS_CS_CONTROL_ENABLED + Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; + if (DEBUG_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_STOP_CONTROL, input)) { + csCtx->state = CS_STATE_STOP; + return; } +#endif for (i = 0; i < totalEntries; i++) { MemCpy(&cmdType, script, sizeof(cmdType)); @@ -2262,7 +2265,8 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { - if (CAN_SHOW_CS_INFOS && BREG(0) != 0) { +#if CAN_SHOW_CS_INFOS + if (BREG(0) != 0) { Gfx* displayList; Gfx* prevDisplayList; @@ -2278,10 +2282,11 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); } +#endif csCtx->curFrame++; -#if IS_DEBUG +#if DEBUG_FEATURES if (R_USE_DEBUG_CUTSCENE) { Cutscene_ProcessScript(play, csCtx, gDebugCutsceneScript); } else { diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index ee12c0c2b6..4041426b41 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -10,7 +10,7 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) { EffectSs* effectSs; EffectSsOverlay* overlay; -#if IS_DEBUG +#if DEBUG_FEATURES for (i = 0; i < ARRAY_COUNT(gEffectSsOverlayTable); i++) { overlay = &gEffectSsOverlayTable[i]; PRINTF("effect index %3d:size=%6dbyte romsize=%6dbyte\n", i, diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index e6335307da..f0390a9611 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -102,7 +102,7 @@ void GameOver_Update(PlayState* play) { sGameOverTimer--; if (sGameOverTimer == 0) { - play->pauseCtx.state = PAUSE_STATE_8; + play->pauseCtx.state = PAUSE_STATE_GAME_OVER_START; gameOverCtx->state++; Rumble_Reset(); } diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index deee31dfde..83ec5aafd6 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -240,7 +240,7 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize) { JpegDecoder decoder; JpegDecoderState state; JpegWork* workBuff; - OSTime diff; + UNUSED_NDEBUG OSTime diff; OSTime time; OSTime curTime; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 8a05f1e7d8..69d2b2d9ba 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,5 @@ #pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.2:224 pal-1.0:224 pal-1.1:224" + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" #include "global.h" #include "terminal.h" @@ -60,7 +60,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (IS_PAUSED(&play->pauseCtx)) { if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (Letterbox_GetSize() == 0) { -#if IS_DEBUG +#if DEBUG_FEATURES R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; #endif @@ -70,21 +70,22 @@ void KaleidoScopeCall_Update(PlayState* play) { pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } - } else if (pauseCtx->state == PAUSE_STATE_8) { -#if IS_DEBUG + } else if (pauseCtx->state == PAUSE_STATE_GAME_OVER_START) { +#if DEBUG_FEATURES R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; #endif R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; - pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING; - pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_9 - } else if ((pauseCtx->state == PAUSE_STATE_WAIT_BG_PRERENDER) || (pauseCtx->state == PAUSE_STATE_9)) { + pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING; // copied from pause menu, not needed here + pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_GAME_OVER_WAIT_BG_PRERENDER + } else if ((pauseCtx->state == PAUSE_STATE_WAIT_BG_PRERENDER) || + (pauseCtx->state == PAUSE_STATE_GAME_OVER_WAIT_BG_PRERENDER)) { PRINTF("PR_KAREIDOSCOPE_MODE=%d\n", R_PAUSE_BG_PRERENDER_STATE); if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { - pauseCtx->state++; // PAUSE_STATE_INIT or PAUSE_STATE_10 + pauseCtx->state++; // PAUSE_STATE_INIT or PAUSE_STATE_GAME_OVER_INIT } } else if (pauseCtx->state != PAUSE_STATE_OFF) { if (gKaleidoMgrCurOvl != kaleidoScopeOvl) { @@ -124,7 +125,8 @@ void KaleidoScopeCall_Draw(PlayState* play) { if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) { if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_1) && (play->pauseCtx.state <= PAUSE_STATE_SAVE_PROMPT)) || - ((play->pauseCtx.state >= PAUSE_STATE_11) && (play->pauseCtx.state <= PAUSE_STATE_CLOSING))) { + ((play->pauseCtx.state >= PAUSE_STATE_GAME_OVER_SHOW_MESSAGE) && + (play->pauseCtx.state <= PAUSE_STATE_CLOSING))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeDrawFunc(play); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 21874c4ecf..86d725642c 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -71,9 +71,8 @@ void KaleidoSetup_Update(PlayState* play) { gSaveContext.magicState != MAGIC_STATE_FILL && (play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) { - if (IS_EVENT_EDITOR_ENABLED && CHECK_BTN_ALL(input->cur.button, BTN_L) && - CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - if (BREG(0)) { + if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + if (IS_EVENT_EDITOR_ENABLED && BREG(0)) { pauseCtx->debugState = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index a4ae98c5b1..4093f775a9 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -8,8 +8,9 @@ */ void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) { #if OOT_NTSC - DmaMgr_RequestSync(&font->charTexBuf[codePointIndex], - (uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE); + DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], + (uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE, + "../z_kanfont.c", UNK_LINE); #endif } @@ -53,7 +54,8 @@ void Font_LoadOrderedFont(Font* font) { #if OOT_NTSC len = (u32)size / 2; - DmaMgr_RequestSync(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size); + DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size, + "../z_kanfont.c", UNK_LINE); fontBufIndex = 0; for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) { @@ -63,8 +65,8 @@ void Font_LoadOrderedFont(Font* font) { if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) { offset = Kanji_OffsetFromShiftJIS(font->msgBufWide[codePointIndex]); - DmaMgr_RequestSync(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, - FONT_CHAR_TEX_SIZE); + DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, + FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; } } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 42f6990b55..e040a840e0 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ #pragma increment_block_number "gc-eu:244 gc-eu-mq:244 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.2:224 pal-1.0:252 pal-1.1:252" + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:248 pal-1.1:248" #include "global.h" #include "ultra64.h" @@ -215,7 +215,7 @@ s16 sSunDepthTestX; s16 sSunDepthTestY; #pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.2:224 pal-1.0:240 pal-1.1:240" + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:240 pal-1.1:240" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; @@ -349,7 +349,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) envCtx->sceneTimeSpeed = 0; gTimeSpeed = envCtx->sceneTimeSpeed; -#if IS_DEBUG +#if DEBUG_FEATURES R_ENV_TIME_SPEED_OLD = gTimeSpeed; R_ENV_DISABLE_DBG = true; @@ -421,7 +421,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) gSkyboxIsChanging = false; gSaveContext.retainWeatherMode = false; -#if IS_DEBUG +#if DEBUG_FEATURES R_ENV_LIGHT1_DIR(0) = 80; R_ENV_LIGHT1_DIR(1) = 80; R_ENV_LIGHT1_DIR(2) = 80; @@ -718,7 +718,7 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon } } -#if IS_DEBUG +#if DEBUG_FEATURES if (newSkybox1Index == 0xFF) { PRINTF(VT_COL(RED, WHITE) T("\n環境VRデータ取得失敗! ささきまでご報告を!", "\nEnvironment VR data acquisition failed! Report to Sasaki!") VT_RST); @@ -835,7 +835,7 @@ void Environment_DisableUnderwaterLights(PlayState* play) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { if (CAN_SHOW_TIME_INFOS) { GfxPrint printer; @@ -984,7 +984,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } #if CAN_SHOW_TIME_INFOS - if ((R_ENABLE_ARENA_DBG != 0) || (CREG(2) != 0)) { + if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { Gfx* displayList; Gfx* prevDisplayList; @@ -1150,7 +1150,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend); -#if IS_DEBUG +#if DEBUG_FEATURES if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >= envCtx->numLightSettings) { PRINTF(VT_COL(RED, WHITE) T("\nカラーパレットの設定がおかしいようです!", @@ -1230,7 +1230,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend); } -#if IS_DEBUG +#if DEBUG_FEATURES if (envCtx->lightSetting >= envCtx->numLightSettings) { PRINTF("\n" VT_FGCOL(RED) T("カラーパレットがおかしいようです!", "The color palette seems to be wrong!")); @@ -1304,7 +1304,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex lightCtx->zFar = ENV_ZFAR_MAX; } -#if IS_DEBUG +#if DEBUG_FEATURES // When environment debug is enabled, various environment related variables can be configured via the reg editor if (R_ENV_DISABLE_DBG) { R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0]; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index dc72ebb7b7..5ca9855b02 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -211,8 +211,7 @@ LightNode* Lights_FindBufSlot(void) { return node; } -// return type must not be void to match -s32 Lights_FreeNode(LightNode* light) { +BAD_RETURN(s32) Lights_FreeNode(LightNode* light) { if (light != NULL) { sLightsBuffer.numOccupied--; light->info = NULL; diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 4043620eeb..eaa1408bf4 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -7,14 +7,16 @@ Arena sZeldaArena; -#if IS_DEBUG +#if DEBUG_FEATURES s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR; void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&sZeldaArena); +#endif } } else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { PRINTF(T("%s: %u バイトの%sに成功しました\n", "%s: %u bytes %s succeeded\n"), name, size, action); @@ -34,7 +36,7 @@ void* ZeldaArena_Malloc(u32 size) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sZeldaArena, size, file, line); @@ -50,7 +52,7 @@ void* ZeldaArena_MallocR(u32 size) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line); @@ -65,7 +67,7 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", T("再確保", "Re-securing")); @@ -77,7 +79,7 @@ void ZeldaArena_Free(void* ptr) { __osFree(&sZeldaArena, ptr); } -#if IS_DEBUG +#if DEBUG_FEATURES void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sZeldaArena, ptr, file, line); } @@ -96,7 +98,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) { return ret; } -#if IS_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES void ZeldaArena_Display(void) { PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); __osDisplayArena(&sZeldaArena); @@ -112,14 +114,14 @@ void ZeldaArena_Check(void) { } void ZeldaArena_Init(void* start, u32 size) { -#if IS_DEBUG +#if DEBUG_FEATURES gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sZeldaArena, start, size); } void ZeldaArena_Cleanup(void) { -#if IS_DEBUG +#if DEBUG_FEATURES gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sZeldaArena); diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index c8a89c66f6..b400100bc9 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -167,10 +167,10 @@ void Map_InitData(PlayState* play, s16 room) { #if PLATFORM_N64 if ((B_80121220 != NULL) && (B_80121220->unk_28 != NULL) && B_80121220->unk_28(play)) { } else { - DmaMgr_RequestSync(play->interfaceCtx.mapSegment, - (uintptr_t)_map_i_staticSegmentRomStart + - ((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE), - MAP_I_TEX_SIZE); + DMA_REQUEST_SYNC(play->interfaceCtx.mapSegment, + (uintptr_t)_map_i_staticSegmentRomStart + + ((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE), + MAP_I_TEX_SIZE, "../z_map_exp.c", UNK_LINE); } #else DMA_REQUEST_SYNC(play->interfaceCtx.mapSegment, diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 43485198e4..fe7c9f75cb 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -118,8 +118,9 @@ void MapMark_DrawForDungeon(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - rectLeft = WIDE_INCR((((IS_DEBUG ? GREG(94) : 0) + markPoint->x + 204) << 2), (WIDE_MINIMAP_SHIFT / 2)); - rectTop = ((IS_DEBUG ? GREG(95) : 0) + markPoint->y + 140) << 2; + rectLeft = + WIDE_INCR((((DEBUG_FEATURES ? GREG(94) : 0) + markPoint->x + 204) << 2), (WIDE_MINIMAP_SHIFT / 2)); + rectTop = ((DEBUG_FEATURES ? GREG(95) : 0) + markPoint->y + 140) << 2; gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, WIDE_DIV(markInfo->dsdx, WIDE_GET_RATIO), markInfo->dtdy); diff --git a/src/code/z_message.c b/src/code/z_message.c index aab75a8ce2..c1ab75e2d3 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -8,7 +8,7 @@ #endif #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:112 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:112 pal-1.0:128 pal-1.1:128" #if N64_BTN_COLORS #define OCARINA_BUTTON_A_PRIM_1_R 80 @@ -2050,14 +2050,14 @@ void Message_Decode(PlayState* play) { msgCtx->textboxBackgroundBackColorIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF00) >> 8; msgCtx->textboxBackgroundYOffsetIdx = (font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF0) >> 4; msgCtx->textboxBackgroundUnkArg = font->msgBufWide[msgCtx->msgBufPos + 2] & 0xF; - DmaMgr_RequestSync(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, - (uintptr_t)_message_texture_staticSegmentRomStart + - msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, - MESSAGE_TEXTURE_STATIC_TEX_SIZE); - DmaMgr_RequestSync(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + MESSAGE_TEXTURE_STATIC_TEX_SIZE, - (uintptr_t)_message_texture_staticSegmentRomStart + - (msgCtx->textboxBackgroundIdx + 1) * MESSAGE_TEXTURE_STATIC_TEX_SIZE, - MESSAGE_TEXTURE_STATIC_TEX_SIZE); + DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, + (uintptr_t)_message_texture_staticSegmentRomStart + + msgCtx->textboxBackgroundIdx * MESSAGE_TEXTURE_STATIC_TEX_SIZE, + MESSAGE_TEXTURE_STATIC_TEX_SIZE, "../z_message_PAL.c", UNK_LINE); + DMA_REQUEST_SYNC(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + MESSAGE_TEXTURE_STATIC_TEX_SIZE, + (uintptr_t)_message_texture_staticSegmentRomStart + + (msgCtx->textboxBackgroundIdx + 1) * MESSAGE_TEXTURE_STATIC_TEX_SIZE, + MESSAGE_TEXTURE_STATIC_TEX_SIZE, "../z_message_PAL.c", UNK_LINE); numLines = 2; msgCtx->msgBufPos += 2; R_TEXTBOX_BG_YPOS = R_TEXTBOX_Y + 8; @@ -2542,8 +2542,8 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_60 != NULL) && B_80121220->unk_60(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset, @@ -2558,12 +2558,12 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } else { Message_FindMessageNES(play, textId); @@ -2572,12 +2572,12 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_68 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); #endif } #else @@ -2588,8 +2588,8 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_64(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, @@ -2603,8 +2603,8 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_68(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_ger_message_data_staticSegmentRomStart + font->msgOffset, @@ -2618,8 +2618,8 @@ void Message_OpenText(PlayState* play, u16 textId) { if ((B_80121220 != NULL) && (B_80121220->unk_64 != NULL) && B_80121220->unk_6C_PAL(&play->msgCtx.font)) { } else { - DmaMgr_RequestSync(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, - font->msgLength); + DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, + font->msgLength, "../z_message_PAL.c", UNK_LINE); } #else DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset, @@ -3951,7 +3951,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { *p = gfx; } -#if IS_DEBUG +#if DEBUG_FEATURES /** * If the s16 variable pointed to by `var` changes in value, a black bar and white box * are briefly drawn onto the screen. It can only watch one variable per build due to @@ -4013,7 +4013,9 @@ void Message_DrawDebugText(PlayState* play, Gfx** p) { void Message_Draw(PlayState* play) { Gfx* plusOne; Gfx* polyOpaP; - +#if OOT_VERSION < GC_US + s32 pad; +#endif #if IS_MSG_DEBUG_ENABLED s16 watchVar; #endif @@ -4087,7 +4089,8 @@ void Message_Update(PlayState* play) { sTextboxSkipped = true; } - if (IS_MSG_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_MSG_DEBUG_ENABLED + if (BREG(0) != 0) { static u16 sMessageDebuggerTextboxCount = 0; if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) { @@ -4114,9 +4117,9 @@ void Message_Update(PlayState* play) { } } } +#endif if (msgCtx->msgLength != 0) { - switch (msgCtx->msgMode) { case MSGMODE_TEXT_START: D_8014B2F4++; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 1250bb4fe5..04ffc2f463 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -5255,7 +5255,7 @@ s32 OnePointCutscene_Attention(PlayState* play, Actor* actor) { s32 temp2; s32 timer; -#if IS_DEBUG +#if DEBUG_FEATURES if (sDisableAttention) { PRINTF(VT_COL(YELLOW, BLACK) "actor attention demo camera: canceled by other camera\n" VT_RST); return CAM_ID_NONE; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index a0a1580ebe..1c8de94e6a 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2216,7 +2216,7 @@ void Interface_LoadActionLabelB(PlayState* play, u16 action) { */ s32 Health_ChangeBy(PlayState* play, s16 amount) { u16 heartCount; - u16 healthLevel; + UNUSED_NDEBUG u16 healthLevel; PRINTF(T("***** 増減=%d (now=%d, max=%d) ***", "***** Fluctuation=%d (now=%d, max=%d) ***"), amount, gSaveContext.save.info.playerData.health, gSaveContext.save.info.playerData.healthCapacity); @@ -3195,7 +3195,7 @@ void func_8008A994(InterfaceContext* interfaceCtx) { View_ApplyOrthoToOverlay(&interfaceCtx->view); } -#if IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) +#if DEBUG_FEATURES && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) #define CAN_DRAW_INTERFACE (pauseCtx->debugState == 0) #else #define CAN_DRAW_INTERFACE true @@ -4061,9 +4061,11 @@ void Interface_Draw(PlayState* play) { } } - if (IS_EVENT_EDITOR_ENABLED && (pauseCtx->debugState == 3)) { +#if IS_EVENT_EDITOR_ENABLED + if (pauseCtx->debugState == 3) { FlagSet_Update(play); } +#endif if (interfaceCtx->unk_244 != 0) { gDPPipeSync(OVERLAY_DISP++); @@ -4085,7 +4087,7 @@ void Interface_Update(PlayState* play) { s16 risingAlpha; u16 action; -#if IS_DEBUG +#if OOT_PAL && DEBUG_FEATURES { Input* debugInput = &play->state.input[2]; diff --git a/src/code/z_play.c b/src/code/z_play.c index 8e9be4926b..1f8d3aee10 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -21,13 +21,13 @@ s32 gTransitionTileState; VisMono gPlayVisMono; Color_RGBA8_u32 gVisMonoColor; -#if IS_DEBUG +#if DEBUG_FEATURES FaultClient D_801614B8; #endif s16 sTransitionFillTimer; -#if IS_DEBUG +#if DEBUG_FEATURES void* gDebugCutsceneScript = NULL; UNK_TYPE D_8012D1F4 = 0; // unused #endif @@ -38,7 +38,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn); // This macro prints the number "1" with a file and line number if R_ENABLE_PLAY_LOGS is enabled. // For example, it can be used to trace the play state execution at a high level. -#if IS_DEBUG +#if DEBUG_FEATURES #define PLAY_LOG(line) \ do { \ if (R_ENABLE_PLAY_LOGS) { \ @@ -267,7 +267,7 @@ void Play_Destroy(GameState* thisx) { } #endif -#if IS_DEBUG +#if DEBUG_FEATURES Fault_RemoveClient(&D_801614B8); #endif } @@ -295,7 +295,7 @@ void Play_Init(GameState* thisx) { return; } -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES SystemArena_Display(); #endif @@ -482,7 +482,7 @@ void Play_Init(GameState* thisx) { PRINTF(T("ゼルダヒープ %08x-%08x\n", "Zelda Heap %08x-%08x\n"), zAllocAligned, (u8*)zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc)); -#if IS_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); #endif @@ -519,7 +519,7 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Update(this, &this->animTaskQueue); gSaveContext.respawnFlag = 0; -#if IS_DEBUG +#if DEBUG_FEATURES if (R_USE_DEBUG_CUTSCENE) { static u64 sDebugCutsceneScriptBuf[0xA00]; @@ -538,10 +538,12 @@ void Play_Update(PlayState* this) { s32 isPaused = IS_PAUSED(&this->pauseCtx); s32 pad1; -#if IS_DEBUG +#if DEBUG_FEATURES if ((SREG(1) < 0) || (DREG(0) != 0)) { SREG(1) = 0; +#if PLATFORM_GC ZeldaArena_Display(); +#endif } if ((R_HREG_MODE == HREG_MODE_PRINT_OBJECT_TABLE) && (R_PRINT_OBJECT_TABLE_TRIGGER < 0)) { @@ -633,7 +635,7 @@ void Play_Update(PlayState* this) { } } -#if IS_DEBUG +#if DEBUG_FEATURES if (!R_TRANS_DBG_ENABLED) { Play_SetupTransition(this, this->transitionType); } else { @@ -951,7 +953,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3555); AnimTaskQueue_Reset(&this->animTaskQueue); - if (!IS_DEBUG) {} + if (!DEBUG_FEATURES) {} PLAY_LOG(3561); Object_UpdateEntries(&this->objectCtx); @@ -1086,6 +1088,7 @@ void Play_Update(PlayState* this) { skip: PLAY_LOG(3801); + //! @bug If frame advancing or during tile transitions, isPaused will be used uninitialized. if (!isPaused || IS_DEBUG_CAM_ENABLED) { s32 i; @@ -1319,7 +1322,7 @@ void Play_Draw(PlayState* this) { OcclusionPlane_Draw_Phase(this, OCCLUSION_PLANE_PHASE_START); #endif - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP); POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP); @@ -1342,7 +1345,7 @@ void Play_Draw(PlayState* this) { gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx); - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { Gfx* gfxP; Gfx* sp1CC = POLY_OPA_DISP; @@ -1417,8 +1420,8 @@ void Play_Draw(PlayState* this) { goto Play_Draw_DrawOverlayElements; } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { - if (this->skyboxId != SKYBOX_NONE && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) { if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) { Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); Skybox_Draw(&this->skyboxCtx, gfxCtx, &this->lightCtx, this->skyboxId, this->envCtx.skyboxBlend, @@ -1430,13 +1433,15 @@ void Play_Draw(PlayState* this) { } } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || + (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { if (!this->envCtx.sunMoonDisabled) { Environment_DrawSunAndMoon(this); } } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || + (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { Environment_DrawSkyboxFilters(this); } @@ -1453,22 +1458,22 @@ void Play_Draw(PlayState* this) { OcclusionPlane_Draw_Phase(this, OCCLUSION_PLANE_PHASE_POST_SKY); #endif - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { Environment_UpdateLightningStrike(this); Environment_DrawLightning(this, 0); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx); Lights_BindAll(sp228, this->lightCtx.listHead, NULL); Lights_Draw(sp228, gfxCtx); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { if (VREG(94) == 0) { s32 roomDrawFlags; - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY)) { roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU; } else { roomDrawFlags = R_PLAY_DRAW_ROOM_FLAGS; @@ -1479,7 +1484,7 @@ void Play_Draw(PlayState* this) { } } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if ((this->skyboxCtx.drawType != SKYBOX_DRAW_128) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) { Vec3f quakeOffset; @@ -1496,15 +1501,15 @@ void Play_Draw(PlayState* this) { Environment_DrawRain(this, &this->view, gfxCtx); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, FILL_SCREEN_OPA); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { func_800315AC(this, &this->actorCtx); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { if (!this->envCtx.sunMoonDisabled) { sp21C.x = this->view.eye.x + this->envCtx.sunPos.x; sp21C.y = this->view.eye.y + this->envCtx.sunPos.y; @@ -1514,7 +1519,7 @@ void Play_Draw(PlayState* this) { Environment_DrawCustomLensFlare(this); } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { if (MREG(64) != 0) { Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68), FILL_SCREEN_OPA | FILL_SCREEN_XLU); @@ -1531,13 +1536,13 @@ void Play_Draw(PlayState* this) { } } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { if (this->envCtx.sandstormState != SANDSTORM_OFF) { Environment_DrawSandstorm(this, this->envCtx.sandstormState); } } -#if IS_DEBUG && !NO_DEBUG_DISPLAY +#if DEBUG_FEATURES && !NO_DEBUG_DISPLAY if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) { DebugDisplay_DrawObjects(this); } @@ -1570,7 +1575,7 @@ void Play_Draw(PlayState* this) { OcclusionPlane_Draw_Phase(this, OCCLUSION_PLANE_PHASE_POST_3D); #endif - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { Play_DrawOverlayElements(this); } } @@ -1632,7 +1637,7 @@ void Play_Main(GameState* thisx) { PLAY_LOG(4556); - if (IS_DEBUG && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { + if (DEBUG_FEATURES && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { R_PLAY_RUN_UPDATE = true; R_PLAY_RUN_DRAW = true; R_PLAY_DRAW_SKYBOX = true; @@ -1650,7 +1655,7 @@ void Play_Main(GameState* thisx) { R_PLAY_INIT = HREG_MODE_PLAY; } - if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { Play_Update(this); } @@ -1744,7 +1749,7 @@ void* Play_LoadFileFromDiskDrive(PlayState* this, RomFile* file) { void* allocp; size = file->vromEnd - file->vromStart; - allocp = THA_AllocTailAlign16(&this->state.tha, size); + allocp = GAME_STATE_ALLOC(&this->state, size, "../z_play.c", UNK_LINE); func_801C7C1C(allocp, file->vromStart, size); return allocp; @@ -1780,7 +1785,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { SceneTableEntry* scene; - u32 size; + UNUSED_NDEBUG u32 size; #if PLATFORM_N64 if ((B_80121220 != NULL) && (B_80121220->unk_48 != NULL)) { diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 64680a0d09..d6a473120e 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,7 +1,8 @@ #include "global.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_CAN_PRESS_SWITCHES) #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ntsc-1.2:128 pal-1.1:128" diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 6f8dfdcea5..75275899d6 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -644,7 +644,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 itemAction) { } void Player_SetModelsForHoldingShield(Player* this) { - if ((this->stateFlags1 & PLAYER_STATE1_22) && + if ((this->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) { if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; @@ -1460,7 +1460,7 @@ void Player_UpdateShieldCollider(PlayState* play, Player* this, ColliderQuad* co COL_MATERIAL_METAL, }; - if (this->stateFlags1 & PLAYER_STATE1_22) { + if (this->stateFlags1 & PLAYER_STATE1_SHIELDING) { Vec3f quadDest[4]; this->shieldQuad.base.colMaterial = shieldColMaterials[this->currentShield]; @@ -1494,7 +1494,7 @@ void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && - !(this->stateFlags1 & PLAYER_STATE1_22)) { + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING)) { EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, &this->meleeWeaponInfo[0].base); } diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 6f065920e1..0b4217eac9 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1252,7 +1252,7 @@ Gfx* Gfx_SetupDL_69NoCD(Gfx* gfx) { return gfx; } -#if IS_DEBUG +#if DEBUG_FEATURES #define HREG_21 HREG(21) #define HREG_22 HREG(22) #else @@ -1487,7 +1487,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, s32 clearFB, u8 r, u8 g, u8 b) { if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { s32 letterboxSize = Letterbox_GetSize(); -#if IS_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) { if (R_SETUP_FRAME_INIT != HREG_MODE_SETUP_FRAME) { R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG); diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index ed5d9017c2..b10223500a 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -216,9 +216,9 @@ void Scene_DrawConfigDefault(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4735); } -void* D_8012A2F8[] = { - gYdanTex_00BA18, - gYdanTex_00CA18, +void* sDekuTreeEntranceTextures[] = { + gDekuTreeDayEntranceTex, + gDekuTreeNightEntranceTex, }; void Scene_DrawConfigDekuTree(PlayState* play) { @@ -234,7 +234,8 @@ void Scene_DrawConfigDekuTree(PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A2F8[((void)0, gSaveContext.save.nightFlag)])); + gSPSegment(POLY_OPA_DISP++, 0x08, + SEGMENTED_TO_VIRTUAL(sDekuTreeEntranceTextures[((void)0, gSaveContext.save.nightFlag)])); CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 4783); } @@ -528,7 +529,7 @@ void Scene_DrawConfigThievesHideout(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5507); } -void* D_8012A330[] = { +void* sWaterTempleEntranceTextures[] = { gWaterTempleDayEntranceTex, gWaterTempleNightEntranceTex, }; @@ -545,9 +546,11 @@ void Scene_DrawConfigWaterTemple(PlayState* play) { gameplayFrames = play->gameplayFrames; #if !OOT_MQ - gSPSegment(POLY_XLU_DISP++, 0x06, SEGMENTED_TO_VIRTUAL(D_8012A330[((void)0, gSaveContext.save.nightFlag)])); + gSPSegment(POLY_XLU_DISP++, 0x06, + SEGMENTED_TO_VIRTUAL(sWaterTempleEntranceTextures[((void)0, gSaveContext.save.nightFlag)])); #else - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[((void)0, gSaveContext.save.nightFlag)])); + gSPSegment(POLY_XLU_DISP++, 0x08, + SEGMENTED_TO_VIRTUAL(sWaterTempleEntranceTextures[((void)0, gSaveContext.save.nightFlag)])); #endif if (spB0 == 1) { @@ -967,11 +970,11 @@ void Scene_DrawConfigLonLonBuildings(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 6528); } -void* sGuardHouseView2Textures[] = { +void* sGuardHouseView1Textures[] = { gGuardHouseOutSideView1DayTex, gGuardHouseOutSideView1NightTex, }; -void* sGuardHouseView1Textures[] = { +void* sGuardHouseView2Textures[] = { gGuardHouseOutSideView2DayTex, gGuardHouseOutSideView2NightTex, }; @@ -987,8 +990,8 @@ void Scene_DrawConfigMarketGuardHouse(PlayState* play) { var = gSaveContext.save.nightFlag; } - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGuardHouseView1Textures[var])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sGuardHouseView2Textures[var])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sGuardHouseView2Textures[var])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sGuardHouseView1Textures[var])); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1191,7 +1194,13 @@ void Scene_DrawConfigKokiriForest(PlayState* play) { spA3 = 255 - (u8)play->roomCtx.drawParams[0]; } else if (gSaveContext.sceneLayer == 6) { spA0 = play->roomCtx.drawParams[0] + 500; - } else if ((!IS_CUTSCENE_LAYER || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) { + } else if ( +#if OOT_VERSION < PAL_1_0 + !IS_CUTSCENE_LAYER && GET_EVENTCHKINF(EVENTCHKINF_07) +#else + (!IS_CUTSCENE_LAYER || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07) +#endif + ) { spA0 = 2150; } @@ -1372,15 +1381,16 @@ void Scene_DrawConfigDesertColossus(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7339); } -void* D_8012A380[] = { - gSpot12_009678Tex, - gSpot12_00DE78Tex, +void* sGerudoFortressWallTextures[] = { + gGerudoFortressNightWallTex, + gGerudoFortressDayWallTex, }; void Scene_DrawConfigGerudosFortress(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7363); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A380[((void)0, gSaveContext.save.nightFlag)])); + gSPSegment(POLY_OPA_DISP++, 0x08, + SEGMENTED_TO_VIRTUAL(sGerudoFortressWallTextures[((void)0, gSaveContext.save.nightFlag)])); CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7371); } @@ -1752,7 +1762,7 @@ SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { }; void Scene_Draw(PlayState* play) { -#if IS_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SCENE_CONFIG) { if (R_SCENE_CONFIG_INIT != HREG_MODE_SCENE_CONFIG) { R_SCENE_CONFIG_INIT = HREG_MODE_SCENE_CONFIG; diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 67e27fdcd5..fe500027bc 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -671,7 +671,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt bzero(&gSaveContext.save.totalDays, sizeof(s32)); bzero(&gSaveContext.save.bgsDayCount, sizeof(s32)); -#if IS_DEBUG +#if DEBUG_FEATURES if (!slotNum) { Sram_InitDebugSave(); gSaveContext.save.info.playerData.newf[0] = 'Z'; @@ -795,7 +795,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { gSaveContext.save.dayTime = CLOCK_TIME(10, 0); gSaveContext.save.cutsceneIndex = 0xFFF1; -#if IS_DEBUG +#if DEBUG_FEATURES if (fileSelect->buttonIndex == 0) { gSaveContext.save.cutsceneIndex = 0; } @@ -973,7 +973,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { } #endif -#if IS_DEBUG +#if DEBUG_FEATURES if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) { bzero(sramCtx->readBuff, SRAM_SIZE); for (i = 0; i < CHECKSUM_SIZE; i++) { diff --git a/src/code/z_view.c b/src/code/z_view.c index d8869ef57a..567f11aa6c 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -222,7 +222,7 @@ void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ) { view->distortionScale.z = scaleZ; } -s32 View_SetDistortionSpeed(View* view, f32 speed) { +BAD_RETURN(s32) View_SetDistortionSpeed(View* view, f32 speed) { view->distortionSpeed = speed; } @@ -337,7 +337,7 @@ s32 View_ApplyPerspective(View* view) { height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; - if (IS_DEBUG && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { + if (DEBUG_FEATURES && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { if (R_PERSPECTIVE_INIT != HREG_MODE_PERSPECTIVE) { R_PERSPECTIVE_INIT = HREG_MODE_PERSPECTIVE; R_PERSPECTIVE_FOVY = 60; @@ -352,7 +352,7 @@ s32 View_ApplyPerspective(View* view) { guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale); } -#if IS_DEBUG +#if DEBUG_FEATURES if (QREG(88) & 1) { s32 i; MtxF mf; @@ -401,7 +401,7 @@ s32 View_ApplyPerspective(View* view) { view->viewing = *viewing; -#if IS_DEBUG +#if DEBUG_FEATURES // Debug print view matrix if (QREG(88) & 2) { s32 i; @@ -697,7 +697,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { return 1; } -#if IS_DEBUG +#if DEBUG_FEATURES /** * Logs an error and returns nonzero if camera is too far from the origin. */ diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index a971810758..59fa5df2d0 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -149,15 +149,15 @@ void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antia viMode->customViMode.comRegs.hSync += HSYNC(1, 4); } if (tvType == OS_TV_MPAL) { - viMode->customViMode.comRegs.leap += LEAP((u16)-4, (u16)-2); + viMode->customViMode.comRegs.leap += LEAP(-4, -2); } } else { - viMode->customViMode.fldRegs[0].vStart += START((u16)-3, (u16)-2); + viMode->customViMode.fldRegs[0].vStart += START(-3, -2); if (tvType == OS_TV_MPAL) { - viMode->customViMode.fldRegs[0].vBurst += BURST((u8)-2, (u8)-1, 12, -1); + viMode->customViMode.fldRegs[0].vBurst += BURST(-2, -1, 12, -1); } if (tvType == OS_TV_PAL) { - viMode->customViMode.fldRegs[1].vBurst += BURST((u8)-2, (u8)-1, 2, 0); + viMode->customViMode.fldRegs[1].vBurst += BURST(-2, -1, 2, 0); } } diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index b169f5b026..aac4fa84f9 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -183,7 +183,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) { } void VisMono_DrawOld(VisMono* this) { - Gfx* dListEnd; + UNUSED_NDEBUG Gfx* dListEnd; if (this->tlut == NULL) { this->tlut = SYSTEM_ARENA_MALLOC(256 * G_IM_SIZ_16b_BYTES, "../z_vismono.c", 283); diff --git a/src/libc/absf.s b/src/libc/absf.s index 9df0c0a380..b423334614 100644 --- a/src/libc/absf.s +++ b/src/libc/absf.s @@ -1,6 +1,6 @@ #include "ultra64/asm.h" -#if OOT_DEBUG +#if DEBUG_FEATURES .set noreorder #endif diff --git a/src/libc/sqrt.s b/src/libc/sqrt.s index b4246ec865..6ffb2b7085 100644 --- a/src/libc/sqrt.s +++ b/src/libc/sqrt.s @@ -1,6 +1,6 @@ #include "ultra64/asm.h" -#if OOT_DEBUG +#if DEBUG_FEATURES .set noreorder #endif diff --git a/src/libc64/__osMalloc_gc.c b/src/libc64/__osMalloc_gc.c index f943acccec..f2770767fa 100644 --- a/src/libc64/__osMalloc_gc.c +++ b/src/libc64/__osMalloc_gc.c @@ -20,7 +20,7 @@ #define NODE_IS_VALID(node) (((node) != NULL) && ((node)->magic == NODE_MAGIC)) -#if IS_DEBUG +#if DEBUG_FEATURES #define NODE_GET_NEXT(node) ArenaImpl_GetNextBlock(node) #define NODE_GET_PREV(node) ArenaImpl_GetPrevBlock(node) @@ -76,7 +76,7 @@ OSMesg sArenaLockMsg; void __osMallocAddBlock(Arena* arena, void* start, s32 size); -#if IS_DEBUG +#if DEBUG_FEATURES u32 __osMalloc_FreeBlockTest_Enable; u32 ArenaImpl_GetFillAllocBlock(Arena* arena) { @@ -130,7 +130,7 @@ void ArenaImpl_Unlock(Arena* arena) { osRecvMesg(&arena->lockQueue, NULL, OS_MESG_BLOCK); } -#if IS_DEBUG +#if DEBUG_FEATURES ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) { ArenaNode* next = node->next; @@ -211,7 +211,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void ArenaImpl_RemoveAllBlocks(Arena* arena) { ArenaNode* iter; ArenaNode* next; @@ -230,7 +230,7 @@ void ArenaImpl_RemoveAllBlocks(Arena* arena) { #endif void __osMallocCleanup(Arena* arena) { -#if IS_DEBUG +#if DEBUG_FEATURES ArenaImpl_RemoveAllBlocks(arena); #endif bzero(arena, sizeof(*arena)); @@ -240,7 +240,7 @@ s32 __osMallocIsInitialized(Arena* arena) { return arena->isInit; } -#if IS_DEBUG +#if DEBUG_FEATURES void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) { ArenaNode* node2 = node; u32* start; @@ -497,7 +497,7 @@ void __osFree_NoLock(Arena* arena, void* ptr) { PRINTF(VT_COL(RED, WHITE) T("__osFree:二重解放(%08x)\n", "__osFree: Double release (%08x)\n") VT_RST, ptr); return; } -#if IS_DEBUG +#if DEBUG_FEATURES if (arena != node->arena && arena != NULL) { PRINTF(VT_COL(RED, WHITE) T("__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n", @@ -542,7 +542,7 @@ void __osFree(Arena* arena, void* ptr) { ArenaImpl_Unlock(arena); } -#if IS_DEBUG +#if DEBUG_FEATURES void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, int line) { ArenaNode* node; ArenaNode* next; @@ -711,7 +711,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line) { return __osRealloc(arena, ptr, newSize); } @@ -743,7 +743,7 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll ArenaImpl_Unlock(arena); } -#if IS_DEBUG +#if DEBUG_FEATURES void __osDisplayArena(Arena* arena) { u32 freeSize; u32 allocatedSize; @@ -867,7 +867,7 @@ s32 __osCheckArena(Arena* arena) { while (iter != NULL) { //! @bug: Probably intended to be `!NODE_IS_VALID(iter)` if (NODE_IS_VALID(iter)) { -#if IS_DEBUG +#if DEBUG_FEATURES osSyncPrintf(VT_COL(RED, WHITE) T("おおっと!! (%08x %08x)\n", "Oops!! (%08x %08x)\n") VT_RST, iter, iter->magic); #else @@ -886,7 +886,7 @@ s32 __osCheckArena(Arena* arena) { return error; } -#if IS_DEBUG +#if DEBUG_FEATURES u8 ArenaImpl_GetAllocFailures(Arena* arena) { return arena->allocFailures; } diff --git a/src/libc64/malloc.c b/src/libc64/malloc.c index b88f7dc005..f7a642ce9d 100644 --- a/src/libc64/malloc.c +++ b/src/libc64/malloc.c @@ -9,14 +9,16 @@ Arena gSystemArena; -#if IS_DEBUG +#if DEBUG_FEATURES s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gSystemArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&gSystemArena); +#endif return; } } else if (gSystemArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { @@ -41,7 +43,7 @@ void* SystemArena_Malloc(u32 size) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* SystemArena_MallocDebug(u32 size, const char* file, int line) { DECLARE_INTERRUPT_MASK void* ptr; @@ -67,7 +69,7 @@ void* SystemArena_MallocR(u32 size) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* SystemArena_MallocRDebug(u32 size, const char* file, int line) { DECLARE_INTERRUPT_MASK void* ptr; @@ -92,7 +94,7 @@ void* SystemArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if IS_DEBUG +#if DEBUG_FEATURES void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { DECLARE_INTERRUPT_MASK @@ -113,7 +115,7 @@ void SystemArena_Free(void* ptr) { RESTORE_INTERRUPTS(); } -#if IS_DEBUG +#if DEBUG_FEATURES void SystemArena_FreeDebug(void* ptr, const char* file, int line) { DECLARE_INTERRUPT_MASK @@ -140,8 +142,12 @@ void* SystemArena_Calloc(u32 num, u32 size) { return ret; } +#if PLATFORM_GC && DEBUG_FEATURES void SystemArena_Display(void) { + PRINTF(T("システムヒープ表示\n", "System heap display\n")); + __osDisplayArena(&gSystemArena); } +#endif void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&gSystemArena, outMaxFree, outFree, outAlloc); @@ -152,14 +158,14 @@ void SystemArena_Check(void) { } void SystemArena_Init(void* start, u32 size) { -#if IS_DEBUG +#if DEBUG_FEATURES gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&gSystemArena, start, size); } void SystemArena_Cleanup(void) { -#if IS_DEBUG +#if DEBUG_FEATURES gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&gSystemArena); diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index 1f2caf6d97..fc3235c08c 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -7,7 +7,7 @@ s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; - OSPiHandle* leoDiskHandle; + UNUSED OSPiHandle* leoDiskHandle; volatile LEOCmdInquiry cmdBlockInq; volatile LEOCmd cmdBlockID; LEODiskID thisID; diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index e3a5183005..26ced4f7db 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -7,7 +7,7 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; - OSPiHandle* leoDiskHandle; + UNUSED OSPiHandle* leoDiskHandle; volatile LEOCmdInquiry cmdBlockInq; volatile LEOCmd cmdBlockID; LEODiskID thisID; diff --git a/src/libleo/leo/leomecha.c b/src/libleo/leo/leomecha.c index 861b2970fb..da141616c8 100644 --- a/src/libleo/leo/leomecha.c +++ b/src/libleo/leo/leomecha.c @@ -52,6 +52,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) { if (asic_cmd == 0x80000) { return 0; } + FALLTHROUGH; case 43: if (!(asic_cur_status & 0x800000)) { if (asic_cmd == 0x90000) { @@ -65,6 +66,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) { return 37; } } + FALLTHROUGH; default: break; @@ -72,7 +74,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) { if (asic_cmd & 1) { break; } - + FALLTHROUGH; case 21: return 0; } @@ -265,6 +267,7 @@ u32 leoChk_err_retry(u32 sense) { switch (sense) { case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: unit_atten |= 2; + FALLTHROUGH; case LEO_SENSE_DIAGNOSTIC_FAILURE: case LEO_SENSE_COMMAND_PHASE_ERROR: case LEO_SENSE_WAITING_NMI: @@ -278,8 +281,10 @@ u32 leoChk_err_retry(u32 sense) { switch (sense) { case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: unit_atten |= 2; + FALLTHROUGH; case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED: unit_atten |= 1; + FALLTHROUGH; case LEO_SENSE_DIAGNOSTIC_FAILURE: case LEO_SENSE_COMMAND_PHASE_ERROR: case LEO_SENSE_WAITING_NMI: diff --git a/src/libleo/leo/leotimer.c b/src/libleo/leo/leotimer.c index 9ac64bb2bb..aadfc3b828 100644 --- a/src/libleo/leo/leotimer.c +++ b/src/libleo/leo/leotimer.c @@ -78,6 +78,7 @@ void leoSetTimer(void) { LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } + FALLTHROUGH; case 1: // Month value cannot be 0 if (temp == 0) { @@ -85,6 +86,7 @@ void leoSetTimer(void) { LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } + FALLTHROUGH; default: // Verify max value of each time info if (ymdupper[ymd] < temp) { diff --git a/src/code/code_800FC620.c b/src/libu64/code_800FC620.c similarity index 98% rename from src/code/code_800FC620.c rename to src/libu64/code_800FC620.c index 247c8d725b..94926d838e 100644 --- a/src/code/code_800FC620.c +++ b/src/libu64/code_800FC620.c @@ -14,7 +14,7 @@ typedef struct InitFunc { // .data void* sInitFuncs = NULL; -#if IS_DEBUG +#if DEBUG_FEATURES char sNew[] = "new"; #else char sNew[] = ""; @@ -38,7 +38,7 @@ void* func_800FC800(u32 size) { size = 1; } -#if IS_DEBUG +#if DEBUG_FEATURES ptr = __osMallocDebug(&gSystemArena, size, sNew, 0); #else ptr = __osMalloc(&gSystemArena, size); diff --git a/src/boot/logutils.c b/src/libu64/debug.c similarity index 96% rename from src/boot/logutils.c rename to src/libu64/debug.c index 2b5045be4d..80be25f9d0 100644 --- a/src/boot/logutils.c +++ b/src/libu64/debug.c @@ -2,7 +2,7 @@ #include "fault.h" #include "terminal.h" -#if PLATFORM_N64 || IS_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max) { if (value < min || max < value) { @@ -13,7 +13,7 @@ f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f } #endif -#if OOT_DEBUG +#if DEBUG_FEATURES s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max) { if (value < min || max < value) { @@ -113,14 +113,14 @@ void LogUtils_LogThreadId(const char* name, int line) { void LogUtils_HungupThread(const char* name, int line) { OSId threadId = osGetThreadId(NULL); -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES osSyncPrintf("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line); #endif Fault_AddHungupAndCrash(name, line); } void LogUtils_ResetHungup(void) { -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES osSyncPrintf("*** Reset ***\n"); #endif Fault_AddHungupAndCrash("Reset", 0); diff --git a/src/code/gfxprint.c b/src/libu64/gfxprint.c similarity index 99% rename from src/code/gfxprint.c rename to src/libu64/gfxprint.c index fadc32cc82..1e0abf02c0 100644 --- a/src/code/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -391,7 +391,7 @@ void GfxPrint_Open(GfxPrint* this, Gfx* dList) { this->dList = dList; GfxPrint_Setup(this); } else { -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES osSyncPrintf(T("gfxprint_open:2重オープンです\n", "gfxprint_open: Double open\n")); #endif } diff --git a/src/code/load_gc.c b/src/libu64/load_gc.c similarity index 100% rename from src/code/load_gc.c rename to src/libu64/load_gc.c diff --git a/src/code/loadfragment2_gc.c b/src/libu64/loadfragment2_gc.c similarity index 100% rename from src/code/loadfragment2_gc.c rename to src/libu64/loadfragment2_gc.c diff --git a/src/code/loadfragment2_n64.c b/src/libu64/loadfragment2_n64.c similarity index 100% rename from src/code/loadfragment2_n64.c rename to src/libu64/loadfragment2_n64.c diff --git a/src/code/logseverity_gc.c b/src/libu64/logseverity_gc.c similarity index 100% rename from src/code/logseverity_gc.c rename to src/libu64/logseverity_gc.c diff --git a/src/code/mtxuty-cvt.c b/src/libu64/mtxuty-cvt.c similarity index 100% rename from src/code/mtxuty-cvt.c rename to src/libu64/mtxuty-cvt.c diff --git a/src/code/padutils.c b/src/libu64/pad.c similarity index 100% rename from src/code/padutils.c rename to src/libu64/pad.c diff --git a/src/code/padsetup.c b/src/libu64/padsetup.c similarity index 100% rename from src/code/padsetup.c rename to src/libu64/padsetup.c diff --git a/src/code/rcp_utils.c b/src/libu64/rcp_utils.c similarity index 98% rename from src/code/rcp_utils.c rename to src/libu64/rcp_utils.c index 574a1a5df8..420ac51f98 100644 --- a/src/code/rcp_utils.c +++ b/src/libu64/rcp_utils.c @@ -1,6 +1,6 @@ #include "global.h" -#if PLATFORM_N64 || OOT_DEBUG +#if PLATFORM_N64 || DEBUG_FEATURES #define RCP_UTILS_PRINTF osSyncPrintf #elif IDO_PRINTF_WORKAROUND #define RCP_UTILS_PRINTF(args) (void)0 diff --git a/src/code/relocation_gc.c b/src/libu64/relocation_gc.c similarity index 99% rename from src/code/relocation_gc.c rename to src/libu64/relocation_gc.c index f178121c19..1d2f3193da 100644 --- a/src/code/relocation_gc.c +++ b/src/libu64/relocation_gc.c @@ -58,7 +58,7 @@ void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlReloc u32 dbg; s32 relocOffset = 0; u32 relocatedValue = 0; - uintptr_t unrelocatedAddress = 0; + UNUSED_NDEBUG uintptr_t unrelocatedAddress = 0; uintptr_t relocatedAddress = 0; uintptr_t vramu32 = (uintptr_t)vramStart; diff --git a/src/boot/stackcheck.c b/src/libu64/stackcheck.c similarity index 98% rename from src/boot/stackcheck.c rename to src/libu64/stackcheck.c index 7168bf07ee..a8b32ffcee 100644 --- a/src/boot/stackcheck.c +++ b/src/libu64/stackcheck.c @@ -111,7 +111,7 @@ u32 StackCheck_Check(StackEntry* entry) { return ret; } else { u32* last; - u32 used; + UNUSED_NDEBUG u32 used; u32 free; u32 ret; @@ -143,7 +143,7 @@ u32 StackCheck_Check(StackEntry* entry) { u32 StackCheck_GetState(StackEntry* entry) { u32* last; - u32 used; + UNUSED_NDEBUG u32 used; u32 free; u32 ret; @@ -167,7 +167,7 @@ u32 StackCheck_GetState(StackEntry* entry) { ret = STACK_STATUS_OK; } -#if !IS_DEBUG +#if !DEBUG_FEATURES // This string is still in .rodata for retail builds (void)"(null)"; #endif @@ -176,7 +176,7 @@ u32 StackCheck_GetState(StackEntry* entry) { entry->name != NULL ? entry->name : "(null)"); PRINTF(VT_RST); -#if IS_DEBUG +#if DEBUG_FEATURES if (ret != STACK_STATUS_OK) { LogUtils_LogHexDump(entry->head, (uintptr_t)entry->tail - (uintptr_t)entry->head); } diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index 40e1ba83be..194f4eff78 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -1,7 +1,7 @@ #include "global.h" s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) { - OSTime time; + UNUSED OSTime time; #if !PLATFORM_N64 OSTimer* next; u32 count; diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c index a2fd113309..ddc7790116 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -6,7 +6,7 @@ #include "stack.h" #include "versions.h" -#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" typedef struct struct_801D9C30 { /* 0x000 */ s32 unk_000; // disk start diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 63f929d43e..4b475c9c66 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -74,9 +74,10 @@ void ArmsHook_Init(Actor* thisx, PlayState* play) { void ArmsHook_Destroy(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; - if (this->grabbed != NULL) { - this->grabbed->flags &= ~ACTOR_FLAG_13; + if (this->attachedActor != NULL) { + this->attachedActor->flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; } + Collider_DestroyQuad(play, &this->collider); } @@ -93,7 +94,12 @@ void ArmsHook_Wait(ArmsHook* this, PlayState* play) { } } -void func_80865044(ArmsHook* this) { +/** + * Start pulling Player so he flies toward the hookshot's current location. + * Setting Player's parent pointer indicates that he should begin flying. + * See `Player_UpdateUpperBody` and `Player_Action_HookshotFly` for Player's side of the interation. + */ +void ArmsHook_PullPlayer(ArmsHook* this) { this->actor.child = this->actor.parent; this->actor.parent->parent = &this->actor; } @@ -109,10 +115,10 @@ s32 ArmsHook_AttachToPlayer(ArmsHook* this, Player* player) { return false; } -void ArmsHook_DetachHookFromActor(ArmsHook* this) { - if (this->grabbed != NULL) { - this->grabbed->flags &= ~ACTOR_FLAG_13; - this->grabbed = NULL; +void ArmsHook_DetachFromActor(ArmsHook* this) { + if (this->attachedActor != NULL) { + this->attachedActor->flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; + this->attachedActor = NULL; } } @@ -123,7 +129,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) { if ((player->itemAction != player->heldItemAction) || (player->actor.flags & ACTOR_FLAG_TALK) || ((player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_26)))) { this->timer = 0; - ArmsHook_DetachHookFromActor(this); + ArmsHook_DetachFromActor(this); Math_Vec3f_Copy(&this->actor.world.pos, &player->unk_3C8); return 1; } @@ -131,17 +137,17 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) { return 0; } -void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { - actor->flags |= ACTOR_FLAG_13; - this->grabbed = actor; - Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff); +void ArmsHook_AttachToActor(ArmsHook* this, Actor* actor) { + actor->flags |= ACTOR_FLAG_HOOKSHOT_ATTACHED; + this->attachedActor = actor; + Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->attachPointOffset); } void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) { - ArmsHook_DetachHookFromActor(this); + ArmsHook_DetachFromActor(this); Actor_Kill(&this->actor); return; } @@ -153,11 +159,13 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { (this->collider.elem.atHitElem->elemMaterial != ELEM_MATERIAL_UNK4)) { Actor* touchedActor = this->collider.base.at; - if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) { + if ((touchedActor->update != NULL) && + (touchedActor->flags & (ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER))) { if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HOOKABLE) { - ArmsHook_AttachHookToActor(this, touchedActor); - if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_10)) { - func_80865044(this); + ArmsHook_AttachToActor(this, touchedActor); + + if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) { + ArmsHook_PullPlayer(this); } } } @@ -168,41 +176,50 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { } if (DECR(this->timer) == 0) { - Actor* grabbed; + Actor* attachedActor; Vec3f bodyDistDiffVec; Vec3f newPos; f32 bodyDistDiff; f32 phi_f16; s32 pad1; - f32 curGrabbedDist; - f32 grabbedDist; + f32 curActorOffsetXYZ; + f32 attachPointOffsetXYZ; f32 velocity; - grabbed = this->grabbed; - if (grabbed != NULL) { - if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) { - grabbed = NULL; - this->grabbed = NULL; + attachedActor = this->attachedActor; + + if (attachedActor != NULL) { + if ((attachedActor->update == NULL) || + !CHECK_FLAG_ALL(attachedActor->flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + attachedActor = NULL; + this->attachedActor = NULL; } else if (this->actor.child != NULL) { - curGrabbedDist = Actor_WorldDistXYZToActor(&this->actor, grabbed); - grabbedDist = - sqrtf(SQ(this->grabbedDistDiff.x) + SQ(this->grabbedDistDiff.y) + SQ(this->grabbedDistDiff.z)); - Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos); - if ((curGrabbedDist - grabbedDist) > 50.0f) { - ArmsHook_DetachHookFromActor(this); - grabbed = NULL; + curActorOffsetXYZ = Actor_WorldDistXYZToActor(&this->actor, attachedActor); + attachPointOffsetXYZ = sqrtf(SQ(this->attachPointOffset.x) + SQ(this->attachPointOffset.y) + + SQ(this->attachPointOffset.z)); + + // Keep the hookshot actor at the same relative offset as the initial attachment even if the actor moves + Math_Vec3f_Diff(&attachedActor->world.pos, &this->attachPointOffset, &this->actor.world.pos); + + // If the actor the hookshot is attached to is moving, the hookshot's current relative + // position will be different than the initial attachment position. + // If the distance between those two points is larger than 50 units, detach the hookshot. + if ((curActorOffsetXYZ - attachPointOffsetXYZ) > 50.0f) { + ArmsHook_DetachFromActor(this); + attachedActor = NULL; } } } bodyDistDiff = Math_Vec3f_DistXYZAndStoreDiff(&player->unk_3C8, &this->actor.world.pos, &bodyDistDiffVec); + if (bodyDistDiff < 30.0f) { velocity = 0.0f; phi_f16 = 0.0f; } else { if (this->actor.child != NULL) { velocity = 30.0f; - } else if (grabbed != NULL) { + } else if (attachedActor != NULL) { velocity = 50.0f; } else { velocity = 200.0f; @@ -219,23 +236,25 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { newPos.z = bodyDistDiffVec.z * velocity; if (this->actor.child == NULL) { - if ((grabbed != NULL) && (grabbed->id == ACTOR_BG_SPOT06_OBJECTS)) { - Math_Vec3f_Diff(&grabbed->world.pos, &this->grabbedDistDiff, &this->actor.world.pos); + // Not pulling Player + if ((attachedActor != NULL) && (attachedActor->id == ACTOR_BG_SPOT06_OBJECTS)) { + Math_Vec3f_Diff(&attachedActor->world.pos, &this->attachPointOffset, &this->actor.world.pos); phi_f16 = 1.0f; } else { Math_Vec3f_Sum(&player->unk_3C8, &newPos, &this->actor.world.pos); - if (grabbed != NULL) { - Math_Vec3f_Sum(&this->actor.world.pos, &this->grabbedDistDiff, &grabbed->world.pos); + if (attachedActor != NULL) { + Math_Vec3f_Sum(&this->actor.world.pos, &this->attachPointOffset, &attachedActor->world.pos); } } } else { + // Pulling Player Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity); player->actor.world.rot.x = Math_Atan2S(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y); } if (phi_f16 < 50.0f) { - ArmsHook_DetachHookFromActor(this); + ArmsHook_DetachFromActor(this); if (phi_f16 == 0.0f) { ArmsHook_SetupAction(this, ArmsHook_Wait); if (ArmsHook_AttachToPlayer(this, player)) { @@ -274,11 +293,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (bgId != BGCHECK_SCENE) { dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); + if (dynaPolyActor != NULL) { - ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor); + ArmsHook_AttachToActor(this, &dynaPolyActor->actor); } } - func_80865044(this); + ArmsHook_PullPlayer(this); Audio_PlaySfxGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else { diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h index b624599a53..c1c5790fd9 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -14,8 +14,8 @@ typedef struct ArmsHook { /* 0x01CC */ WeaponInfo hookInfo; /* 0x01E8 */ Vec3f unk_1E8; /* 0x01F4 */ Vec3f unk_1F4; - /* 0x0200 */ Actor* grabbed; - /* 0x0204 */ Vec3f grabbedDistDiff; + /* 0x0200 */ Actor* attachedActor; + /* 0x0204 */ Vec3f attachPointOffset; // Distance from the hookshot attach point to world pos of `attachedActor` /* 0x0210 */ s16 timer; /* 0x0214 */ ArmsHookActionFunc actionFunc; } ArmsHook; // size = 0x0218 diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index d75efab0c9..c590f341e5 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -7,7 +7,7 @@ #include "z_arrow_fire.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowFire_Init(Actor* thisx, PlayState* play); void ArrowFire_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 010a110a13..09815d086c 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowIce_Init(Actor* thisx, PlayState* play); void ArrowIce_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 9a0691649b..f88e2c092e 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowLight_Init(Actor* thisx, PlayState* play); void ArrowLight_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index adb0353a7e..d22c6124eb 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -97,7 +97,7 @@ void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHea CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -251,7 +251,7 @@ void func_8086D5C4(BgBdanSwitch* this) { void func_8086D5E0(BgBdanSwitch* this, PlayState* play) { switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: - if (func_800435B4(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { func_8086D67C(this); func_8086D4B4(this, play); } @@ -290,7 +290,7 @@ void func_8086D730(BgBdanSwitch* this) { void func_8086D754(BgBdanSwitch* this, PlayState* play) { switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case BLUE: - if (!func_800435B4(&this->dyna)) { + if (!DynaPolyActor_IsSwitchPressed(&this->dyna)) { if (this->unk_1D8 <= 0) { func_8086D7FC(this); func_8086D548(this, play); diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index ac55dc86c8..567b141e72 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -15,7 +15,7 @@ #if OOT_VERSION < NTSC_1_1 #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) #else -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #endif typedef enum BgDyYoseizoRewardType { @@ -287,7 +287,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { } if (givingReward) { - if (!IS_CUTSCENE_LAYER || !IS_DEBUG) { + if (!IS_CUTSCENE_LAYER || !DEBUG_FEATURES) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 91b5a96031..ffe3b6c837 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -86,7 +86,7 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { this->treasureFlag = PARAMS_GET_U(thisx->params, 6, 6); thisx->params &= 0x3F; - if (IS_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { + if (DEBUG_FEATURES && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { // "Save bit is not set" PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 373, this->actor.params); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 77971798c0..4888bc381f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -348,7 +348,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { Actor_MoveXZGravity(&this->dyna.actor); func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent); -#if IS_DEBUG +#if DEBUG_FEATURES if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) <= 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 6) { // "[Hammer Step] arg_data strange (arg_data = %d)" PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index c5414e5b39..7a65b45343 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -74,7 +74,7 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); -#if IS_DEBUG +#if DEBUG_FEATURES if (PARAMS_GET_U(thisx->params, 0, 8) < 0 || PARAMS_GET_U(thisx->params, 0, 8) >= 3) { PRINTF("arg_data おかしい 【格子】\n"); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 86829d0ce1..5f9a1a6ca1 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -120,7 +120,7 @@ void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHea CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index f8d136a07b..0e35886304 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -74,7 +74,7 @@ void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeade CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 4280759bac..df98fa50ae 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -50,7 +50,7 @@ void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, Collis CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index ce7e6d4b0e..4c065932f0 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -74,7 +74,7 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { this->puzzleFlags &= ~cobraPuzzleFlags[i]; } -#if IS_DEBUG +#if DEBUG_FEATURES if (curCobraInfo->cobra->dyna.actor.update == NULL) { // "Cobra deleted" PRINTF("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203); @@ -153,7 +153,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y, sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->lightBeams[i] == NULL) { // "Mir Ray generation failed" PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index ade7e39273..6268abe6ab 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -70,7 +70,7 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHe CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 800a1b2855..e40258f9f6 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -123,7 +123,7 @@ void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -138,7 +138,7 @@ void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.actor.child == NULL) { PRINTF(VT_FGCOL(RED)); // "Error : Mir Ray occurrence failure" diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index d74c0abdec..cf15c084b0 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -106,7 +106,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; -#if IS_DEBUG +#if DEBUG_FEATURES if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233); return; @@ -172,7 +172,7 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; -#if IS_DEBUG +#if DEBUG_FEATURES if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362); return; diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 76925e2aae..55f106a0ce 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -48,7 +48,7 @@ void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHea CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 35cae9c9f5..d33e173cee 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -67,7 +67,7 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, Collis CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 219d47b246..2b3abc2733 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -53,7 +53,7 @@ static InitChainEntry sInitChain[] = { u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { u32 ret; -#if IS_DEBUG +#if DEBUG_FEATURES if (bREG(0) != 0) { switch (bREG(1)) { case 0: @@ -300,7 +300,7 @@ void BgMizuWater_Update(Actor* thisx, PlayState* play) { s32 unk1; s32 pad; -#if IS_DEBUG +#if DEBUG_FEATURES if (bREG(15) == 0) { PRINTF("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index f3e270f964..7726f3b2d1 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -58,7 +58,7 @@ void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeade CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index cc5729dc09..3ed26dfe1c 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -89,7 +89,7 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { this->unk_172 = sIsSpawned; this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->moriTexObjectSlot < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index ea0654b066..7db118d243 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -87,7 +87,7 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionH CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index f09948a29a..e1ce8bdc05 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -56,7 +56,7 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, Collisio CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 4d8799783c..e4d30217dd 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -53,7 +53,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); -#if IS_DEBUG +#if DEBUG_FEATURES // "Forest Temple obj. Falling Ceiling" PRINTF("森の神殿 obj. 落下天井 (home posY %f)\n", this->dyna.actor.home.pos.y); if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) || diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index aa5b56024b..459667c5a9 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -7,7 +7,7 @@ #include "z_bg_spot06_objects.h" #include "assets/objects/object_spot06_objects/object_spot06_objects.h" -#define FLAGS ACTOR_FLAG_9 +#define FLAGS ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR typedef enum LakeHyliaObjectsType { /* 0x0 */ LHO_WATER_TEMPLE_ENTRACE_GATE, @@ -335,7 +335,7 @@ void BgSpot06Objects_LockPullOutward(BgSpot06Objects* this, PlayState* play) { if (this->timer == 0) { this->dyna.actor.velocity.y = 0.5f; - this->dyna.actor.flags &= ~ACTOR_FLAG_13; + this->dyna.actor.flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; this->actionFunc = BgSpot06Objects_LockSwimToSurface; } diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index 6d209a6251..f9a7d9c695 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -46,7 +46,7 @@ void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, Coll CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 0666980533..719baddf1b 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -51,7 +51,7 @@ void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHea CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 13b1deeea6..bf53fec356 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -48,7 +48,7 @@ void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collisi CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 27572deef0..d3aa4423c7 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -63,7 +63,7 @@ void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collis CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 669f17ab47..7e2f27fcc9 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -251,7 +251,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { shouldLive = func_808B4E58(this, play); break; -#if IS_DEBUG +#if DEBUG_FEATURES default: PRINTF("Error : arg_data おかしいな(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot16_bombstone.c", 668, this->actor.params); @@ -455,7 +455,7 @@ void func_808B5950(BgSpot16Bombstone* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } -#if IS_DEBUG +#if DEBUG_FEATURES if (mREG(64) == 1) { func_808B561C(this, play); mREG(64) = -10; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 53c58c143f..5363ae0c54 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -730,7 +730,7 @@ void BossDodongo_Roll(BossDodongo* this, PlayState* play) { f32 sp4C; f32 sp48; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; SkelAnime_Update(&this->skelAnime); if (this->unk_1DA == 10) { diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index cd32d075c5..8ea0553c3e 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -687,7 +687,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) { } break; case BOSSFD_FLY_CHASE: - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; temp_y = Math_SinS(this->work[BFD_MOVE_TIMER] * 2396.0f) * 30.0f + this->fwork[BFD_TARGET_Y_OFFSET]; this->targetPosition.x = player->actor.world.pos.x; this->targetPosition.y = player->actor.world.pos.y + temp_y + 30.0f; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index f3f47695c6..d28e4e031d 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -524,7 +524,7 @@ void BossFd2_Vulnerable(BossFd2* this, PlayState* play) { s16 i; this->disableAT = true; - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; SkelAnime_Update(&this->skelAnime); switch (this->work[FD2_ACTION_STATE]) { case 0: @@ -960,7 +960,7 @@ void BossFd2_Update(Actor* thisx, PlayState* play2) { PRINTF("FD2 move start \n"); this->disableAT = false; - this->actor.flags &= ~ACTOR_FLAG_10; + this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->work[FD2_VAR_TIMER]++; this->work[FD2_UNK_TIMER]++; diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 4b3cfe82d9..3266f61006 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -101,22 +101,22 @@ static ColliderCylinderInit sLightBallCylinderInit = { static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \ - "pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" static EnGanonMant* sCape; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 sSeed1; static s32 sSeed2; static s32 sSeed3; #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static BossGanon* sGanondorf; @@ -2580,7 +2580,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfLandAnim); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfLandAnim, 0.0f); this->timers[0] = 70; - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } break; @@ -2613,7 +2613,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { this->unk_2E6 = 80; this->unk_2E8 = 0; - this->actor.flags &= ~ACTOR_FLAG_10; + this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } break; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 7a8f1a7bf6..4a8842ce8e 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -748,7 +748,7 @@ void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_DAMAGE2); } - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } PRINTF("TIME0 %d ********************************************\n", this->timers[0]); @@ -1297,7 +1297,7 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { BossGanondrof* this = (BossGanondrof*)thisx; PRINTF("MOVE START %d\n", this->actor.params); - this->actor.flags &= ~ACTOR_FLAG_10; + this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->colliderBody.base.colMaterial = COL_MATERIAL_HIT3; if (this->killActor) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 9b52c8a52f..de21070a97 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -1296,7 +1296,7 @@ void BossGoma_FloorPrepareAttack(BossGoma* this, PlayState* play) { void BossGoma_FloorAttack(BossGoma* this, PlayState* play) { s16 i; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; SkelAnime_Update(&this->skelanime); switch (this->actionState) { diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 1849c7e41e..df146be4a2 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -630,7 +630,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } break; case MO_TENT_ATTACK: - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EN_MOFER_ATTACK - SFX_FLAG); Math_ApproachF(&this->waterLevelMod, -5.0f, 0.1f, 0.4f); for (indS1 = 0; indS1 < 41; indS1++) { @@ -2232,7 +2232,7 @@ void BossMo_UpdateCore(Actor* thisx, PlayState* play) { } else { MO_WATER_LEVEL(play) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod); } - this->actor.flags |= ACTOR_FLAG_9; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR; this->actor.focus.pos = this->actor.world.pos; this->work[MO_TENT_VAR_TIMER]++; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 85b20fa613..95d7609c70 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -14,7 +14,8 @@ #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "pal-1.0:128 pal-1.1:128" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) #define vParity actionVar #define vVanish actionVar @@ -894,7 +895,7 @@ void BossSst_HeadVulnerable(BossSst* this, PlayState* play) { Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[LEFT].x, 200.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].x, -200.0f, 20.0f); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->timer += 2; this->timer = CLAMP_MAX(this->timer, 50); } else { diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 72b07e4e01..61cac2ec1d 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -838,7 +838,7 @@ s32 BossTw_CheckBeamReflection(BossTw* this, PlayState* play) { Vec3f vec; Player* player = GET_PLAYER(play); - if (player->stateFlags1 & PLAYER_STATE1_22 && + if (player->stateFlags1 & PLAYER_STATE1_SHIELDING && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) > -0x2000) { // player is shielding and facing angles are less than 45 degrees in either direction @@ -980,7 +980,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) { if (this->timers[1] != 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->rotateSpeed); - if ((player->stateFlags1 & PLAYER_STATE1_22) && + if ((player->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) < 0x2000) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) > -0x2000)) { Math_ApproachF(&this->targetPos.x, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, 1.0f, 400.0f); @@ -2974,7 +2974,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { BossTw* this = (BossTw*)thisx; Player* player = GET_PLAYER(play); - this->actor.flags &= ~ACTOR_FLAG_10; + this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->unk_5F8 = 0; this->collider.base.colMaterial = COL_MATERIAL_HIT3; @@ -5252,7 +5252,7 @@ void BossTw_TwinrovaStun(BossTw* this, PlayState* play) { s16 cloudType; this->unk_5F8 = 1; - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; cloudType = sTwinrovaBlastType == 0 ? TWEFF_3 : TWEFF_2; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index f8f6d45c2b..cac3a21812 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -590,7 +590,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { switch (this->actor.params) { case BOSSVA_BODY: SkelAnime_Init(play, &this->skelAnime, &gBarinadeBodySkel, &gBarinadeBodyAnim, NULL, NULL, 0); - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; break; case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: @@ -609,7 +609,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { SkelAnime_InitFlex(play, &this->skelAnime, &gBarinadeStumpSkel, &gBarinadeStumpAnim, NULL, NULL, 0); break; default: - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; SkelAnime_Init(play, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); this->actor.shape.yOffset = 400.0f; break; @@ -1146,6 +1146,8 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { sKillBari++; if ((this->actor.colorFilterTimer != 0) && !(this->actor.colorFilterParams & 0x4000)) { this->invincibilityTimer = this->actor.colorFilterTimer - 5; + //! @bug This condition is always false as this->invincibilityTimer is an s8 so can never + //! be larger than 160. if (this->invincibilityTimer > 160) { this->invincibilityTimer = 0; } diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index f5f8b9c196..4323de1380 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -67,7 +67,7 @@ void DemoDu_SetMouthTexIndex(DemoDu* this, s16 mouthTexIndex) { this->mouthTexIndex = mouthTexIndex; } -#if IS_DEBUG +#if DEBUG_FEATURES // Resets all the values used in this cutscene. void DemoDu_CsAfterGanon_Reset(DemoDu* this) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(0); @@ -777,7 +777,7 @@ void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, PlayState* play) { void DemoDu_UpdateCs_AG_00(DemoDu* this, PlayState* play) { DemoDu_CsAfterGanon_AdvanceTo01(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); #endif } @@ -787,7 +787,7 @@ void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_AdvanceTo02(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); #endif } @@ -797,7 +797,7 @@ void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_BackTo01(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); #endif } diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 0467318591..2a3e8c4531 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -446,7 +446,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { case DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE: case DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL: - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; FALLTHROUGH; case DEMO_EFFECT_TIMEWARP_MASTERSWORD: this->initDrawFunc = DemoEffect_DrawTimeWarp; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 3f8aff556b..a7087e8975 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -166,7 +166,7 @@ void func_809782A0(DemoGeff* this, PlayState* play) { void func_80978308(DemoGeff* this, PlayState* play) { func_809781FC(this, play); func_809782A0(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80978030(this, play); #endif } diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 40d1682acb..d69f207b59 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -230,7 +230,8 @@ s32 DemoGj_FindGanon(DemoGj* this, PlayState* play) { PRINTF("Demo_Gj_Search_Boss_Ganon %d:ガノン発見出来ず\n", this->dyna.actor.params); return false; } - //! @bug: Missing return value when `this->ganon` is already set. + //! @bug Missing return value when `this->ganon` is already set. No caller uses the return value + //! so it doesn't matter. } static InitChainEntry sInitChain[] = { @@ -263,7 +264,7 @@ s32 DemoGj_InitSetIndices(DemoGj* this, PlayState* play, s32 updateMode, s32 dra } void DemoGj_DrawCommon(DemoGj* this, PlayState* play, Gfx* displayList) { - if (!IS_DEBUG || kREG(0) == 0) { + if (!DEBUG_FEATURES || kREG(0) == 0) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1163); @@ -975,7 +976,7 @@ void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); } -#if IS_DEBUG +#if DEBUG_FEATURES void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { } #endif @@ -1095,7 +1096,7 @@ void DemoGj_Update15(DemoGj* this, PlayState* play) { // func_8097B370 void DemoGj_Update18(DemoGj* this, PlayState* play) { func_8097B22C(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoGj_DoNothing1(this, play); #endif } @@ -1112,7 +1113,7 @@ void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); } -#if IS_DEBUG +#if DEBUG_FEATURES void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { } #endif @@ -1230,7 +1231,7 @@ void DemoGj_Update16(DemoGj* this, PlayState* play) { // func_8097B894 void DemoGj_Update19(DemoGj* this, PlayState* play) { func_8097B750(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoGj_DoNothing2(this, play); #endif } @@ -1245,7 +1246,7 @@ void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); } -#if IS_DEBUG +#if DEBUG_FEATURES void DemoGj_DoNothing3(DemoGj* this, PlayState* play) { } #endif @@ -1319,7 +1320,7 @@ void DemoGj_Update17(DemoGj* this, PlayState* play) { // func_8097BBA8 void DemoGj_Update20(DemoGj* this, PlayState* play) { func_8097BA48(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES DemoGj_DoNothing3(this, play); #endif } diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 10ffc6248c..c81aa63e65 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -440,7 +440,7 @@ void func_8097ED64(DemoGt* this, PlayState* play, s32 cueChannel) { } u8 DemoGt_IsCutsceneLayer(void) { - if (IS_DEBUG && (kREG(2) != 0)) { + if (DEBUG_FEATURES && (kREG(2) != 0)) { return true; } else if (!IS_CUTSCENE_LAYER) { return false; @@ -506,7 +506,7 @@ void func_8097EF40(DemoGt* this, PlayState* play) { Vec3f* pos = &this->dyna.actor.world.pos; s32 pad; - if ((IS_DEBUG && (kREG(1) == 20)) || (csCurFrame == 220)) { + if ((DEBUG_FEATURES && (kREG(1) == 20)) || (csCurFrame == 220)) { dustPos.x = pos->x + 256.0f; dustPos.y = pos->y + 679.0f; dustPos.z = pos->z + 82.0f; @@ -529,7 +529,7 @@ void func_8097F0AC(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; s32 pad2; -#if IS_DEBUG +#if DEBUG_FEATURES if (csCurFrame == 140 || kREG(1) == 19) #else if (csCurFrame == 140) @@ -712,7 +712,7 @@ void func_8097F96C(DemoGt* this, PlayState* play) { Actor* actor; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 1059) && (csCurFrame < 1062)) || (IS_DEBUG && (kREG(1) == 17))) { + if (((csCurFrame > 1059) && (csCurFrame < 1062)) || (DEBUG_FEATURES && (kREG(1) == 17))) { static Actor* cloudRing = NULL; pos.x = this->dyna.actor.world.pos.x; @@ -738,7 +738,7 @@ void func_8097FA1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { -12.0f, -17.0, 5.0 }; s32 pad1[3]; - if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (IS_DEBUG && (kREG(1) == 5))) { + if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (DEBUG_FEATURES && (kREG(1) == 5))) { dustPos.x = pos->x + 300.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z - 377.0f; @@ -752,7 +752,7 @@ void func_8097FAFC(DemoGt* this, PlayState* play) { Vec3f pos; f32 new_var = -200.0; - if (((csCurFrame > 582) && (csCurFrame < 683)) || (IS_DEBUG && (kREG(1) == 6))) { + if (((csCurFrame > 582) && (csCurFrame < 683)) || (DEBUG_FEATURES && (kREG(1) == 6))) { static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static f32 arg4 = 280.0f; @@ -782,7 +782,7 @@ void func_8097FC1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if (csCurFrame > 682 || (IS_DEBUG && (kREG(1) == 7))) { + if (csCurFrame > 682 || (DEBUG_FEATURES && (kREG(1) == 7))) { dustPos.x = pos->x + 260.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z + 260.0f; @@ -795,7 +795,7 @@ void func_8097FCE4(DemoGt* this, PlayState* play) { Vec3f vec; u16 csCurFrame = play->csCtx.curFrame; -#if IS_DEBUG +#if DEBUG_FEATURES if (csCurFrame == 503 || kREG(1) == 4) #else if (csCurFrame == 503) @@ -981,7 +981,7 @@ void func_80980430(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; - if (csCurFrame > 709 || (IS_DEBUG && (kREG(1) == 8))) { + if (csCurFrame > 709 || (DEBUG_FEATURES && (kREG(1) == 8))) { dustPos.x = pos->x + 760.0f; dustPos.y = pos->y - 40.0f; dustPos.z = pos->z - 240.0f; @@ -997,7 +997,7 @@ void func_80980504(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 704) || (IS_DEBUG && (kREG(1) == 9))) { + if ((csCurFrame > 704) || (DEBUG_FEATURES && (kREG(1) == 9))) { dustPos.x = pos->x + 830.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 390.0f; @@ -1013,7 +1013,7 @@ void func_809805D8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 15.0f, -26.0, 0.0f }; s32 pad1[3]; - if (((csCurFrame > 739) && (csCurFrame < 781)) || (IS_DEBUG && (kREG(1) == 11))) { + if (((csCurFrame > 739) && (csCurFrame < 781)) || (DEBUG_FEATURES && (kREG(1) == 11))) { dustPos.x = homePos->x + 550.0f; dustPos.y = homePos->y - 110.0f; dustPos.z = homePos->z + 50.0f; @@ -1029,7 +1029,7 @@ void func_809806B8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 964) || (IS_DEBUG && (kREG(1) == 12))) { + if ((csCurFrame > 964) || (DEBUG_FEATURES && (kREG(1) == 12))) { dustPos.x = pos->x + 460.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 760.0f; @@ -1045,7 +1045,7 @@ void func_8098078C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 939) || (IS_DEBUG && (kREG(1) == 14))) { + if ((csCurFrame > 939) || (DEBUG_FEATURES && (kREG(1) == 14))) { dustPos.x = pos->x + 360.0f; dustPos.y = pos->y + 70.0f; dustPos.z = pos->z - 640.0f; @@ -1059,7 +1059,7 @@ void func_8098085C(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; Vec3f* pos = &this->dyna.actor.world.pos; - if ((csCurFrame == 58) || (IS_DEBUG && (kREG(1) == 1))) { + if ((csCurFrame == 58) || (DEBUG_FEATURES && (kREG(1) == 1))) { sp28.x = pos->x + 900.0f; sp28.y = pos->y - 50.0f; sp28.z = pos->z + 93.0f; @@ -1085,7 +1085,7 @@ void func_809809C0(DemoGt* this, PlayState* play2) { Vec3f sp54; s16 pad[3]; - if (((csCurFrame > 469) && (csCurFrame < 481)) || (IS_DEBUG && (kREG(1) == 3))) { + if (((csCurFrame > 469) && (csCurFrame < 481)) || (DEBUG_FEATURES && (kREG(1) == 3))) { Vec3f sp40 = { 20.0f, 6.0f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; s16 pad2[3]; @@ -1105,7 +1105,7 @@ void func_80980AD4(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 477) || (IS_DEBUG && (kREG(2) == 1))) { + if ((csCurFrame == 477) || (DEBUG_FEATURES && (kREG(2) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1120,7 +1120,7 @@ void func_80980B68(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 317) || (IS_DEBUG && (kREG(3) == 1))) { + if ((csCurFrame == 317) || (DEBUG_FEATURES && (kREG(3) == 1))) { pos.x = this->dyna.actor.world.pos.x + 980.0f; pos.y = this->dyna.actor.world.pos.y + 410.0f; pos.z = this->dyna.actor.world.pos.z - 177.0f; @@ -1134,7 +1134,7 @@ void func_80980BFC(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 740) || (IS_DEBUG && (kREG(4) == 1))) { + if ((csCurFrame == 740) || (DEBUG_FEATURES && (kREG(4) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1338,7 +1338,7 @@ void func_80981458(DemoGt* this, PlayState* play) { Vec3f dustPos; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 855) && (csCurFrame < 891)) || (IS_DEBUG && (kREG(1) == 13))) { + if (((csCurFrame > 855) && (csCurFrame < 891)) || (DEBUG_FEATURES && (kREG(1) == 13))) { Vec3f velOffset = { 0.0f, -30.0f, 0.0f }; s32 pad1[3]; diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 6dea40452e..ac9afd8d84 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -58,7 +58,7 @@ static void* sEyeTextures[] = { gImpaEyeClosedTex, }; -#if IS_DEBUG +#if DEBUG_FEATURES static u32 D_8098783C = 0; #endif @@ -119,7 +119,7 @@ void func_80984BE0(DemoIm* this) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80984C68(DemoIm* this) { this->action = 7; this->drawConfig = 0; @@ -500,7 +500,7 @@ void func_80985B34(DemoIm* this, PlayState* play) { void func_80985C10(DemoIm* this, PlayState* play) { func_80985948(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80984C8C(this, play); #endif } @@ -510,7 +510,7 @@ void func_80985C40(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809859E0(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80984C8C(this, play); #endif } @@ -520,7 +520,7 @@ void func_80985C94(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80985B34(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80984C8C(this, play); #endif } @@ -935,7 +935,7 @@ void func_80986CFC(DemoIm* this, PlayState* play) { } void func_80986D40(DemoIm* this, PlayState* play) { -#if IS_DEBUG +#if DEBUG_FEATURES if (gSaveContext.sceneLayer == 6) { this->action = 19; this->drawConfig = 1; 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 9cb632da8a..caea0b981f 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -252,7 +252,7 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->actor.room = -1; this->warpTimer = 35; this->sparkleCounter = 0; diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 305288d43c..63ab50cee7 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -69,7 +69,7 @@ static void* sMouthTextures[] = { gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, }; -#if IS_DEBUG +#if DEBUG_FEATURES static u32 D_80990108 = 0; #endif @@ -128,7 +128,7 @@ void DemoSa_SetMouthIndex(DemoSa* this, s16 mouthIndex) { this->mouthIndex = mouthIndex; } -#if IS_DEBUG +#if DEBUG_FEATURES void func_8098E530(DemoSa* this) { this->action = 7; this->drawConfig = 0; @@ -444,7 +444,7 @@ void func_8098F050(DemoSa* this, PlayState* play) { void func_8098F0E8(DemoSa* this, PlayState* play) { func_8098EEA8(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_8098E554(this, play); #endif } @@ -454,7 +454,7 @@ void func_8098F118(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098EEFC(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_8098E554(this, play); #endif } @@ -464,7 +464,7 @@ void func_8098F16C(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098EDB0(this); func_8098F050(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_8098E554(this, play); #endif } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 7ad6013661..b2b735c3ad 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -7,7 +7,7 @@ #include "z_door_ana.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" -#define FLAGS ACTOR_FLAG_25 +#define FLAGS ACTOR_FLAG_UPDATE_DURING_OCARINA void DoorAna_Init(Actor* thisx, PlayState* play); void DoorAna_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index d79327fc67..f0b2937df3 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -14,7 +14,7 @@ void ElfMsg_Init(Actor* thisx, PlayState* play); void ElfMsg_Destroy(Actor* thisx, PlayState* play); void ElfMsg_Update(Actor* thisx, PlayState* play); -#if IS_DEBUG +#if DEBUG_ASSETS void ElfMsg_Draw(Actor* thisx, PlayState* play); #endif @@ -30,7 +30,7 @@ ActorProfile Elf_Msg_Profile = { /**/ ElfMsg_Init, /**/ ElfMsg_Destroy, /**/ ElfMsg_Update, -#if IS_DEBUG +#if DEBUG_ASSETS /**/ ElfMsg_Draw, #else /**/ NULL, @@ -170,7 +170,7 @@ void ElfMsg_Update(Actor* thisx, PlayState* play) { } } -#if IS_DEBUG +#if DEBUG_ASSETS #include "assets/overlays/ovl_Elf_Msg/ovl_Elf_Msg.c" void ElfMsg_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 20b044a05c..769578d004 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -12,7 +12,7 @@ void ElfMsg2_Init(Actor* thisx, PlayState* play); void ElfMsg2_Destroy(Actor* thisx, PlayState* play); void ElfMsg2_Update(Actor* thisx, PlayState* play); -#if IS_DEBUG +#if DEBUG_ASSETS void ElfMsg2_Draw(Actor* thisx, PlayState* play); #endif @@ -29,7 +29,7 @@ ActorProfile Elf_Msg2_Profile = { /**/ ElfMsg2_Init, /**/ ElfMsg2_Destroy, /**/ ElfMsg2_Update, -#if IS_DEBUG +#if DEBUG_ASSETS /**/ ElfMsg2_Draw, #else /**/ NULL, @@ -153,7 +153,7 @@ void ElfMsg2_Update(Actor* thisx, PlayState* play) { } } -#if IS_DEBUG +#if DEBUG_ASSETS #include "assets/overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.c" void ElfMsg2_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 8fa4faae0d..9b552cc5ac 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -8,7 +8,7 @@ #include "assets/objects/object_am/object_am.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_26) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES) void EnAm_Init(Actor* thisx, PlayState* play); void EnAm_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 00e84f0970..870ac86b15 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -99,9 +99,11 @@ void EnAnubiceTag_Update(Actor* thisx, PlayState* play) { void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 34bc646bd6..3cec8313e6 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -149,7 +149,7 @@ void EnArrow_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyQuad(play, &this->collider); if ((this->hitActor != NULL) && (this->hitActor->update != NULL)) { - this->hitActor->flags &= ~ACTOR_FLAG_15; + this->hitActor->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; } } @@ -287,11 +287,11 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { hitActor = this->collider.base.at; if ((hitActor->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && - (hitActor->flags & ACTOR_FLAG_14)) { + (hitActor->flags & ACTOR_FLAG_CAN_ATTACH_TO_ARROW)) { this->hitActor = hitActor; EnArrow_CarryActor(this, play); Math_Vec3f_Diff(&hitActor->world.pos, &this->actor.world.pos, &this->unk_250); - hitActor->flags |= ACTOR_FLAG_15; + hitActor->flags |= ACTOR_FLAG_ATTACHED_TO_ARROW; this->collider.base.atFlags &= ~AT_HIT; this->actor.speed /= 2.0f; this->actor.velocity.y /= 2.0f; @@ -353,14 +353,14 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { this->hitActor->world.pos.y = hitPoint.y + ((sp54.y <= hitPoint.y) ? 1.0f : -1.0f); this->hitActor->world.pos.z = hitPoint.z + ((sp54.z <= hitPoint.z) ? 1.0f : -1.0f); Math_Vec3f_Diff(&this->hitActor->world.pos, &this->actor.world.pos, &this->unk_250); - this->hitActor->flags &= ~ACTOR_FLAG_15; + this->hitActor->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; this->hitActor = NULL; } else { Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &this->hitActor->world.pos); } if (this->touchedPoly && (this->hitActor != NULL)) { - this->hitActor->flags &= ~ACTOR_FLAG_15; + this->hitActor->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; this->hitActor = NULL; } } else { diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index e337512755..3b26ad61d2 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -8,7 +8,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_Bb/object_Bb.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_24) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) #define vBombHopPhase actionVar1 #define vTrailIdx actionVar1 @@ -345,7 +345,7 @@ void EnBb_Init(Actor* thisx, PlayState* play) { this->flamePrimBlue = this->flameEnvColor.b = 255; thisx->world.pos.y += 50.0f; EnBb_SetupBlue(this); - thisx->flags |= ACTOR_FLAG_14; + thisx->flags |= ACTOR_FLAG_CAN_ATTACH_TO_ARROW; break; case ENBB_RED: thisx->naviEnemyId = NAVI_ENEMY_RED_BUBBLE; @@ -374,7 +374,7 @@ void EnBb_Init(Actor* thisx, PlayState* play) { EnBb_SetupWhite(play, this); EnBb_SetWaypoint(this, play); EnBb_FaceWaypoint(this); - thisx->flags |= ACTOR_FLAG_14; + thisx->flags |= ACTOR_FLAG_CAN_ATTACH_TO_ARROW; break; case ENBB_GREEN_BIG: this->path = this->actionState >> 4; @@ -1237,7 +1237,7 @@ void EnBb_Update(Actor* thisx, PlayState* play2) { if (this->actor.colChkInfo.damageEffect != 0xD) { this->actionFunc(this, play); if ((this->actor.params <= ENBB_BLUE) && (this->actor.speed >= -6.0f) && - ((this->actor.flags & ACTOR_FLAG_15) == 0)) { + !(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { Actor_MoveXZGravity(&this->actor); } if (this->moveMode == BBMOVE_NORMAL) { diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index de7141aa3a..559305e71d 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -785,7 +785,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play2) { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder[i].base); } - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } else { for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder[i].base); diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index f7bbd05f0c..73a8addd8f 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -8,7 +8,8 @@ #include "versions.h" #include "assets/objects/object_bl/object_bl.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) void EnBili_Init(Actor* thisx, PlayState* play); void EnBili_Destroy(Actor* thisx, PlayState* play); @@ -251,7 +252,7 @@ void EnBili_SetupFrozen(EnBili* this, PlayState* play) { s32 i; Vec3f effectPos; - if (!(this->actor.flags & ACTOR_FLAG_15)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; } @@ -456,7 +457,7 @@ void EnBili_Recoil(EnBili* this, PlayState* play) { void EnBili_Burnt(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->actor.flags & ACTOR_FLAG_15) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.colorFilterTimer = 20; } else { if (this->timer != 0) { @@ -477,7 +478,7 @@ void EnBili_Die(EnBili* this, PlayState* play) { s32 i; if (this->actor.draw != NULL) { - if (this->actor.flags & ACTOR_FLAG_15) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { return; } this->actor.draw = NULL; @@ -533,7 +534,7 @@ void EnBili_Frozen(EnBili* this, PlayState* play) { this->timer--; } - if (!(this->actor.flags & ACTOR_FLAG_15)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 56f6bd3452..932e84f68a 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -160,7 +160,7 @@ void EnBoom_Fly(EnBoom* this, PlayState* play) { if (((this->collider.base.at->id == ACTOR_EN_ITEM00) || (this->collider.base.at->id == ACTOR_EN_SI))) { this->grabbed = this->collider.base.at; if (this->collider.base.at->id == ACTOR_EN_SI) { - this->collider.base.at->flags |= ACTOR_FLAG_13; + this->collider.base.at->flags |= ACTOR_FLAG_HOOKSHOT_ATTACHED; } } } @@ -183,7 +183,7 @@ void EnBoom_Fly(EnBoom* this, PlayState* play) { target->gravity = -0.9f; target->bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); } else { - target->flags &= ~ACTOR_FLAG_13; + target->flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; } } // Set player flags and kill the boomerang beacause Link caught it. diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 012ab4fd60..9468fae6bb 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -146,7 +146,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) { this->dyna.actor.flags |= ACTOR_FLAG_4; } else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) { EnBox_SetupAction(this, func_809C9700); - this->dyna.actor.flags |= ACTOR_FLAG_25; + this->dyna.actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; @@ -308,7 +308,7 @@ void func_809C9700(EnBox* this, PlayState* play) { } else if (this->unk_1FB == ENBOX_STATE_2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || (play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { - this->dyna.actor.flags &= ~ACTOR_FLAG_25; + this->dyna.actor.flags &= ~ACTOR_FLAG_UPDATE_DURING_OCARINA; EnBox_SetupAction(this, EnBox_AppearInit); OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_1A8 = 0; diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index b05855a7cb..4c5c38e36a 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -435,7 +435,7 @@ void func_809CF8F0(EnBw* this) { this->unk_222 = 1000; this->actor.velocity.y = 11.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; EnBw_SetupAction(this, func_809CF984); } @@ -465,7 +465,7 @@ void func_809CF984(EnBw* this, PlayState* play) { } Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 3000; - this->actor.flags &= ~ACTOR_FLAG_24; + this->actor.flags &= ~ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); EnBw_SetupAction(this, func_809CE884); diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index 417c7c88fe..ebfb5797b7 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -289,9 +289,11 @@ void EnChanger_Update(Actor* thisx, PlayState* play) { this->timer--; } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 54c261ccd9..c8319a7e79 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -1,7 +1,8 @@ #include "z_en_crow.h" #include "assets/objects/object_crow/object_crow.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) void EnCrow_Init(Actor* thisx, PlayState* play); void EnCrow_Destroy(Actor* thisx, PlayState* play); @@ -175,7 +176,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); } - if (this->actor.flags & ACTOR_FLAG_15) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.speed = 0.0f; } @@ -329,7 +330,7 @@ void EnCrow_Damaged(EnCrow* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; - if (!(this->actor.flags & ACTOR_FLAG_15)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->actor.colorFilterParams & 0x4000) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 1e89ac5ff8..b2d7f0c8af 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1132,7 +1132,7 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { } if (this->actionFunc == EnDekubaba_Lunge) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } if (this->collider.base.acFlags & AC_ON) { diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 0936c81d77..4d0e0c269d 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -1,7 +1,7 @@ #include "z_en_dh.h" #include "assets/objects/object_dh/object_dh.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) typedef enum EnDhAction { /* 0 */ DH_WAIT, diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 9ed06293c0..536be6a77d 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -561,8 +561,8 @@ s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V } if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { - rot->y += Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f; - rot->z += Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f; + rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; } return 0; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 3617c2f50e..5aa697f494 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -77,7 +77,7 @@ static u16 sStartingTextIds[] = { 0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD, }; -#if IS_DEBUG +#if DEBUG_FEATURES static char* sItemDebugTxt[] = { "デクの実売り ", // "Deku Nuts" "デクの棒売り ", // "Deku Sticks" diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index 6ca6fa8337..0899a4592b 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -335,7 +335,8 @@ void EnDntDemo_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0)) { if (this->debugArrowTimer != 0) { if (!(this->debugArrowTimer & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -348,4 +349,5 @@ void EnDntDemo_Update(Actor* thisx, PlayState* play) { 1.0f, 1.0f, 255, 255, 255, 255, 4, play->state.gfxCtx); } } +#endif } diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 0090a17cd3..5438c03f4b 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -535,7 +535,7 @@ void EnDodojr_Stunned(EnDodojr* this, PlayState* play) { } void EnDodojr_JumpAttackBounce(EnDodojr* this, PlayState* play) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; Actor_UpdateVelocityXZGravity(&this->actor); if (EnDodojr_UpdateBounces(this, play)) { diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index c8e747e31e..67ddf4a1f7 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -2,7 +2,7 @@ #include "assets/objects/object_du/object_du.h" #include "assets/scenes/overworld/spot18/spot18_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnDu_Init(Actor* thisx, PlayState* play); void EnDu_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/src/overlays/actors/ovl_En_Eg/z_en_eg.c index 20751b94bf..733a9ccf83 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -48,7 +48,8 @@ void EnEg_Init(Actor* thisx, PlayState* play) { } void func_809FFDC8(EnEg* this, PlayState* play) { - if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && (!IS_DEBUG || kREG(0) == 0)) { + if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && + (!DEBUG_FEATURES || kREG(0) == 0)) { // Void the player out Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 6ce5d545bf..a83552b9bf 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -8,7 +8,7 @@ #include "global.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #define FAIRY_FLAG_TIMED (1 << 8) #define FAIRY_FLAG_BIG (1 << 9) @@ -1379,7 +1379,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { if (player->naviTextId == 0) { if (player->focusActor == NULL) { -#if IS_DEBUG +#if DEBUG_FEATURES if (((gSaveContext.save.info.playerData.naviTimer >= 600) && (gSaveContext.save.info.playerData.naviTimer <= 3000)) || (nREG(89) != 0)) @@ -1423,7 +1423,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { this->actionFunc(this, play); thisx->shape.rot.y = this->unk_2BC; -#if IS_DEBUG +#if DEBUG_FEATURES // `gSaveContext.save.info.sceneFlags[127].chest` (like in the debug string) instead of `HIGH_SCORE(HS_HBA)` // matches too, but, with how the `SaveContext` struct is currently defined, it is an out-of-bounds read in the // `sceneFlags` array. It is theorized the original `room_inf` (currently `sceneFlags`) was an array of length diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index dbc75012ac..bcd652c776 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -334,7 +334,8 @@ void EnEncount1_Update(Actor* thisx, PlayState* play) { this->updateFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { if (this->outOfRangeTimer != 0) { if ((this->outOfRangeTimer & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -347,4 +348,5 @@ void EnEncount1_Update(Actor* thisx, PlayState* play) { 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } } +#endif } diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 88d7ef024d..53234952ce 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -9,7 +9,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_fw/object_fw.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) void EnFd_Init(Actor* thisx, PlayState* play); void EnFd_Destroy(Actor* thisx, PlayState* play); @@ -228,8 +228,8 @@ s32 EnFd_SpawnCore(EnFd* this, PlayState* play) { this->actor.child->colChkInfo.health = 8; } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - func_8002DE04(play, &this->actor, this->actor.child); + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + Actor_SwapHookshotAttachment(play, &this->actor, this->actor.child); } this->coreActive = true; @@ -461,7 +461,7 @@ void EnFd_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colSphs); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xF), &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; Actor_SetScale(&this->actor, 0.01f); this->firstUpdateFlag = true; this->actor.gravity = -1.0f; @@ -668,15 +668,14 @@ void EnFd_Update(Actor* thisx, PlayState* play) { EnFd_SpawnDot(this, play); } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - // has been hookshoted + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { if (EnFd_SpawnCore(this, play)) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->invincibilityTimer = 30; Actor_PlaySfx(&this->actor, NA_SE_EN_FLAME_DAMAGE); Enemy_StartFinishingBlow(play, &this->actor); } else { - this->actor.flags &= ~ACTOR_FLAG_13; + this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_ATTACHED; } } else if (this->actionFunc != EnFd_WaitForCore) { EnFd_ColliderCheck(this, play); diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 9b7ab4a089..c3740bf9e4 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -284,11 +284,13 @@ void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play) { this->playerNearby = 0; } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } +#endif } void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index e1d31a3213..eb1be1b9cf 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -9,7 +9,8 @@ #include "assets/objects/object_firefly/object_firefly.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) void EnFirefly_Init(Actor* thisx, PlayState* play); void EnFirefly_Destroy(Actor* thisx, PlayState* play); @@ -423,7 +424,7 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.colorFilterTimer = 40; SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speed, 0.0f, 0.5f); - if (this->actor.flags & ACTOR_FLAG_15) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.colorFilterTimer = 40; } else { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x6800, 0x200); @@ -687,7 +688,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); - if (!(this->actor.flags & ACTOR_FLAG_15)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { Actor_MoveXZGravity(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 9483d29d19..e08b501210 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -7,7 +7,7 @@ #include "z_en_floormas.h" #include "assets/objects/object_wallmaster/object_wallmaster.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) #define SPAWN_INVISIBLE 0x8000 #define SPAWN_SMALL 0x10 @@ -1047,7 +1047,7 @@ void EnFloormas_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->actionFunc == EnFloormas_Charge) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnFloormas_GrabLink) { diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 5fb1e395e8..ef6b640712 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -3,7 +3,7 @@ #include "terminal.h" #include "assets/objects/object_fr/object_fr.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnFr_Init(Actor* thisx, PlayState* play); void EnFr_Destroy(Actor* thisx, PlayState* play); @@ -1029,11 +1029,13 @@ void EnFr_SetIdle(EnFr* this, PlayState* play) { void EnFr_UpdateIdle(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif this->jumpCounter++; this->actionFunc(this, play); 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 798d7e509d..942bb6777e 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -8,7 +8,7 @@ #include "assets/objects/object_fu/object_fu.h" #include "assets/scenes/indoors/hakasitarelay/hakasitarelay_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #define FU_RESET_LOOK_ANGLE (1 << 0) #define FU_WAIT (1 << 1) @@ -278,8 +278,8 @@ s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) { - rot->y += (Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f); - rot->z += (Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f); + rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 8bb1dda068..c1a18d41c4 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) void EnFw_Init(Actor* thisx, PlayState* play); void EnFw_Destroy(Actor* thisx, PlayState* play); @@ -361,8 +361,7 @@ void EnFw_Update(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; SkelAnime_Update(&this->skelAnime); - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { - // not attached to hookshot. + if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index c7b14455b3..d22dbe06c2 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -1,7 +1,7 @@ #include "z_en_fz.h" #include "assets/objects/object_fz/object_fz.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) void EnFz_Init(Actor* thisx, PlayState* play); void EnFz_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 1be4c0de36..afadb9d886 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -448,11 +448,13 @@ void EnGSwitch_Update(Actor* thisx, PlayState* play) { } } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) && (this->type == ENGSWITCH_SILVER_TRACKER)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 6147ab7a25..bfd827349a 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -777,8 +777,8 @@ s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p // The purpose of the state flag GE1_STATE_STOP_FIDGET is to skip this code, which this actor has in lieu of an idle // animation. if ((limbIndex == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) { - rot->y += Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f; - rot->z += Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; } return 0; } diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index e8a0603a5f..34bd2e0eb1 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -79,7 +79,7 @@ ActorProfile En_GirlA_Profile = { /**/ NULL, }; -#if IS_DEBUG +#if DEBUG_FEATURES static char* sShopItemDescriptions[] = { "デクの実×5 ", // "Deku nut x5" "矢×30 ", // "Arrow x30" diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index dedacead3d..9877909df5 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1033,7 +1033,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || this->actionFunc == func_80A40B1C) { - func_80034F54(play, this->jointTable, this->morphTable, 18); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 18); } EnGo_UpdateShadow(this); @@ -1103,8 +1103,8 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve } if ((limb == 10) || (limb == 11) || (limb == 14)) { - rot->y += Math_SinS(this->jointTable[limb]) * 200.0f; - rot->z += Math_CosS(this->morphTable[limb]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE; } return 0; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index b769cff78f..bd673c9521 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -22,7 +22,6 @@ typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); // /* 0x80 */ // Not Used // /* 0x90 */ GORON1_DMT_BIGGORON, - #define EN_GO_EFFECT_COUNT 20 typedef struct EnGoEffect { @@ -55,8 +54,8 @@ typedef struct EnGo { /* 0x021A */ s16 unk_21A; /* 0x021C */ s16 unk_21C; /* 0x021E */ s16 unk_21E; - /* 0x0220 */ s16 jointTable[18]; - /* 0x0244 */ s16 morphTable[18]; + /* 0x0220 */ s16 fidgetTableY[18]; + /* 0x0244 */ s16 fidgetTableZ[18]; /* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT]; } EnGo; // size = 0x06C8 diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 422e32bad8..52e41a6cf6 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -890,7 +890,7 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->actor.flags &= ~ACTOR_FLAG_24; + this->actor.flags &= ~ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; this->collider.base.acFlags &= ~AC_HIT; EnGo2_StopRolling(this, play); return true; @@ -1351,7 +1351,7 @@ void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { } else { this->actor.speed = 6.0f; } - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; this->animTimer = 10; this->actor.shape.yOffset = 1800.0f; this->actor.speed *= 2.0f; // Speeding up @@ -1997,7 +1997,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) { #endif this->actionFunc(this, play); if (this->unk_211 == true) { - func_80034F54(play, this->unk_226, this->unk_24A, 18); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 18); } func_80A45288(this, play); EnGo2_EyeMouthTexState(this); @@ -2050,8 +2050,8 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); } if ((limb == 10) || (limb == 11) || (limb == 14)) { - rot->y += Math_SinS(this->unk_226[limb]) * 200.0f; - rot->z += Math_CosS(this->unk_24A[limb]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE; } return 0; } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 9651f6bfeb..6fb6229355 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -92,8 +92,8 @@ typedef struct EnGo2 { /* 0x021C */ char unk_21C[0x04]; /* 0x0220 */ f32 alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f /* 0x0224 */ s16 blinkTimer; - /* 0x0226 */ s16 unk_226[18]; // Remains unknown - /* 0x024A */ s16 unk_24A[18]; // Remains unknown + /* 0x0226 */ s16 fidgetTableY[18]; + /* 0x024A */ s16 fidgetTableZ[18]; /* 0x026E */ u16 trackingMode; /* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT]; /* 0x04A0 */ Vec3f subCamEye; diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index ceb7b3649d..5791eccb67 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -498,7 +498,7 @@ void EnGoma_SetupJump(EnGoma* this) { } void EnGoma_Jump(EnGoma* this, PlayState* play) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speed, 10.0f, 0.5f, 5.0f); 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 02ef24bac8..acf8a7b615 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -86,7 +86,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_HEAVY }; static f32 sSpeeds[] = { 10.0f, 9.2f }; -#if IS_DEBUG +#if DEBUG_FEATURES #define EN_GOROIWA_SPEED(this) (R_EN_GOROIWA_SPEED * 0.01f) #else #define EN_GOROIWA_SPEED(this) sSpeeds[(this)->isInKokiri] @@ -135,12 +135,12 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) { void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { if (play->sceneId == SCENE_KOKIRI_FOREST) { this->isInKokiri = true; -#if IS_DEBUG +#if DEBUG_FEATURES R_EN_GOROIWA_SPEED = 920; #endif } else { this->isInKokiri = false; -#if IS_DEBUG +#if DEBUG_FEATURES R_EN_GOROIWA_SPEED = 1000; #endif } @@ -252,7 +252,7 @@ s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; if (nextPointPos->x == currentPointPos->x && nextPointPos->z == currentPointPos->z) { -#if IS_DEBUG +#if DEBUG_FEATURES if (nextPointPos->y == currentPointPos->y) { // "Error: Invalid path data (points overlap)" PRINTF("Error : レールデータ不正(点が重なっている)"); 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 af8376cddb..c1e9ed9d8d 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnGs_Init(Actor* thisx, PlayState* play); void EnGs_Destroy(Actor* thisx, PlayState* play); @@ -139,12 +139,12 @@ s32 func_80A4E3EC(EnGs* this, PlayState* play) { void func_80A4E470(EnGs* this, PlayState* play) { Player* player = GET_PLAYER(play); -#if IS_DEBUG +#if DEBUG_FEATURES bREG(15) = 0; #endif if (this->actor.xzDistToPlayer <= 100.0f) { -#if IS_DEBUG +#if DEBUG_FEATURES bREG(15) = 1; #endif diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index e302681584..5594103fd4 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -157,7 +157,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) { } Npc_TrackPoint(&this->actor, &this->interactInfo, 6, NPC_TRACKING_HEAD_AND_TORSO); - func_80034F54(play, this->unk_2CC, this->unk_2EC, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); @@ -200,8 +200,8 @@ s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* } if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { - rot->y += Math_SinS(this->unk_2CC[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->unk_2EC[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 388); diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/src/overlays/actors/ovl_En_Guest/z_en_guest.h index 6633f2741a..2130ebc74e 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.h +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.h @@ -18,8 +18,8 @@ typedef struct EnGuest { /* 0x02A0 */ NpcInteractInfo interactInfo; /* 0x02C8 */ s16 unk_2C8; /* 0x02CA */ s16 unk_2CA; - /* 0x02CC */ s16 unk_2CC[16]; - /* 0x02EC */ s16 unk_2EC[16]; + /* 0x02CC */ s16 fidgetTableY[16]; + /* 0x02EC */ s16 fidgetTableZ[16]; /* 0x030C */ s8 osAnimeObjectSlot; /* 0x030D */ u8 unk_30D; /* 0x030E */ u8 unk_30E; diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 42588c5580..df24f1f959 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -490,9 +490,11 @@ void EnHeishi1_Draw(Actor* thisx, PlayState* play) { this); func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, play); - if (IS_ACTOR_DEBUG_ENABLED && (this->path == BREG(1)) && (BREG(0) != 0)) { +#if IS_ACTOR_DEBUG_ENABLED + if ((this->path == BREG(1)) && (BREG(0) != 0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 17000, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index a626ae27f3..c23c2a68de 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -7,7 +7,7 @@ #include "z_en_horse_link_child.h" #include "assets/objects/object_horse_link_child/object_horse_link_child.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnHorseLinkChild_Init(Actor* thisx, PlayState* play); void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 9ac751d4e7..b861717e86 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1252,7 +1252,7 @@ void EnHy_Walk(EnHy* this, PlayState* play) { } void EnHy_Fidget(EnHy* this, PlayState* play) { - func_80034F54(play, this->fidgetTableY, this->fidgetTableZ, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX); } void EnHy_DoNothing(EnHy* this, PlayState* play) { @@ -1265,7 +1265,7 @@ void EnHy_SetupPace(EnHy* this, PlayState* play) { this->actionFunc = EnHy_Pace; } - func_80034F54(play, this->fidgetTableY, this->fidgetTableZ, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX); } void EnHy_Pace(EnHy* this, PlayState* play) { @@ -1390,8 +1390,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if ((limbIndex == ENHY_LIMB_TORSO) || (limbIndex == ENHY_LIMB_LEFT_UPPER_ARM) || (limbIndex == ENHY_LIMB_RIGHT_UPPER_ARM)) { - rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index 00aa85bbce..a5c04ed3ab 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -74,8 +74,8 @@ typedef struct EnHy { /* 0x0216 */ char unk_216[2]; // unused /* 0x0218 */ s16 curEyeIndex; /* 0x021A */ s16 nextEyeIndexTimer; - /* 0x021C */ s16 fidgetTableY[16]; - /* 0x023C */ s16 fidgetTableZ[16]; + /* 0x021C */ s16 fidgetTableY[ENHY_LIMB_MAX]; + /* 0x023C */ s16 fidgetTableZ[ENHY_LIMB_MAX]; /* 0x025C */ f32 interactRange; /* 0x0260 */ s32 getItemId; /* 0x0264 */ Vec3f modelOffset; diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 7964c5020f..386b8c5e26 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -357,7 +357,7 @@ void EnIceHono_Update(Actor* thisx, PlayState* play) { sin154 = Math_SinS(this->unk_154); intensity = (Rand_ZeroOne() * 0.05f) + ((sin154 * 0.125f) + (sin156 * 0.1f)) + 0.425f; -#if IS_DEBUG +#if DEBUG_FEATURES if ((intensity > 0.7f) || (intensity < 0.2f)) { PRINTF("ありえない値(ratio = %f)\n", intensity); // "impossible value(ratio = %f)" } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 69644f547f..223b2a515c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -202,7 +202,7 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) { thisx->update = EnIk_UpdateEnemy; thisx->draw = EnIk_DrawEnemy; - thisx->flags |= ACTOR_FLAG_10; + thisx->flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, thisx, &sCylinderInit); diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index c82d070bcf..d5ada18305 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnKakasi_Init(Actor* thisx, PlayState* play); void EnKakasi_Destroy(Actor* thisx, PlayState* play); @@ -73,7 +73,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); this->rot = this->actor.world.rot; - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 923c871434..0a496cfc39 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -8,7 +8,9 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA | \ + ACTOR_FLAG_LOCK_ON_DISABLED) static ColliderCylinderInit sCylinderInit = { { @@ -89,7 +91,7 @@ void EnKakasi2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->height = 60.0f; Actor_SetScale(&this->actor, 0.01f); - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->unk_198 = this->actor.shape.rot.y; if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) { @@ -118,7 +120,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { this->unk_194++; } - if (IS_DEBUG && (BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && + if (DEBUG_FEATURES && (BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) { // debug feature? @@ -219,7 +221,8 @@ void EnKakasi2_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { if (BREG(5) != 0) { PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->actor.player_distance ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistToPlayer); PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->hosei.x ☆☆☆☆☆ %f\n" VT_RST, this->maxSpawnDistance.x); @@ -239,6 +242,7 @@ void EnKakasi2_Update(Actor* thisx, PlayState* play2) { } } } +#endif } void func_80A90948(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 1cc893ad5e..c670a19efb 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnKakasi3_Init(Actor* thisx, PlayState* play); void EnKakasi3_Destroy(Actor* thisx, PlayState* play); @@ -76,7 +76,7 @@ void EnKakasi3_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0); - this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; this->rot = this->actor.world.rot; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index c2631f471b..a1a0369a4a 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -406,7 +406,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { } piece->airTimer = 100; piece->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - piece->actor.flags |= ACTOR_FLAG_25; + piece->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->cutMarkTimer = 5; Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_STRIKE); } diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index cbe494dee1..0eca2870da 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -709,7 +709,7 @@ s32 func_80A97D68(EnKo* this, PlayState* play) { s32 func_80A97E18(EnKo* this, PlayState* play) { s16 trackingMode; - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); if (EnKo_IsWithinTalkAngle(this) == true) { trackingMode = NPC_TRACKING_HEAD_AND_TORSO; } else { @@ -728,7 +728,7 @@ s32 func_80A97EB0(EnKo* this, PlayState* play) { s16 trackingMode; s32 result; - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); result = EnKo_IsWithinTalkAngle(this); trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode); @@ -736,7 +736,7 @@ s32 func_80A97EB0(EnKo* this, PlayState* play) { } s32 func_80A97F20(EnKo* this, PlayState* play) { - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); return 1; } @@ -748,7 +748,7 @@ s32 func_80A97F70(EnKo* this, PlayState* play) { if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC); } - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); trackingMode = NPC_TRACKING_HEAD_AND_TORSO; } else { if ((this->skelAnime.animation == &gKokiriCuttingGrassAnim) == false) { @@ -768,7 +768,7 @@ s32 func_80A98034(EnKo* this, PlayState* play) { if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC); } - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); result = EnKo_IsWithinTalkAngle(this); trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; } else { @@ -784,7 +784,7 @@ s32 func_80A98034(EnKo* this, PlayState* play) { // Same as func_80A97F20 s32 func_80A98124(EnKo* this, PlayState* play) { - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY); return 1; } @@ -798,7 +798,7 @@ s32 func_80A98174(EnKo* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; } if (this->skelAnime.playSpeed == 0.0f) { - func_80034F54(play, this->unk_2E4, this->unk_304, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); } Npc_TrackPoint(&this->actor, &this->interactInfo, 2, (this->skelAnime.playSpeed == 0.0f) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE); @@ -834,6 +834,8 @@ s32 EnKo_ChildStart(EnKo* this, PlayState* play) { case ENKO_TYPE_CHILD_FADO: return func_80A97E18(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } s32 EnKo_ChildStone(EnKo* this, PlayState* play) { @@ -865,6 +867,8 @@ s32 EnKo_ChildStone(EnKo* this, PlayState* play) { case ENKO_TYPE_CHILD_FADO: return func_80A97E18(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } s32 EnKo_ChildSaria(EnKo* this, PlayState* play) { @@ -896,6 +900,8 @@ s32 EnKo_ChildSaria(EnKo* this, PlayState* play) { case ENKO_TYPE_CHILD_FADO: return func_80A97E18(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) { @@ -927,6 +933,8 @@ s32 EnKo_AdultEnemy(EnKo* this, PlayState* play) { case ENKO_TYPE_CHILD_FADO: return func_80A97E18(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } s32 EnKo_AdultSaved(EnKo* this, PlayState* play) { @@ -958,7 +966,10 @@ s32 EnKo_AdultSaved(EnKo* this, PlayState* play) { case ENKO_TYPE_CHILD_FADO: return func_80A97E18(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } + void func_80A9877C(EnKo* this, PlayState* play) { Player* player = GET_PLAYER(play); @@ -1137,6 +1148,8 @@ s32 func_80A98ECC(EnKo* this, PlayState* play) { case ENKO_FQS_ADULT_SAVED: return EnKo_AdultSaved(this, play); } + // Note this function assumes the kokiri type is valid + UNREACHABLE(); } void EnKo_Init(Actor* thisx, PlayState* play) { @@ -1336,8 +1349,8 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) { - rot->y += Math_SinS(this->unk_2E4[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->unk_304[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h index 08aff76f1d..085e9aca54 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -28,8 +28,8 @@ typedef struct EnKo { /* 0x0220 */ f32 modelAlpha; /* 0x0224 */ Vec3s jointTable[16]; /* 0x0284 */ Vec3s morphTable[16]; - /* 0x02E4 */ s16 unk_2E4[16]; - /* 0x0304 */ s16 unk_304[16]; + /* 0x02E4 */ s16 fidgetTableY[16]; + /* 0x0304 */ s16 fidgetTableZ[16]; } EnKo; // size = 0x0324 typedef enum KokiriChildren { diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index f2882cad3d..5f865d2387 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -278,7 +278,7 @@ void EnKusa_SetupWaitForObject(EnKusa* this) { void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { + if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { EnKusa_SetupCut(this); } else { EnKusa_SetupMain(this); @@ -317,7 +317,7 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { } EnKusa_SetupCut(this); - this->actor.flags |= ACTOR_FLAG_ENKUSA_CUT; + this->actor.flags |= ACTOR_FLAG_GRASS_DESTROYED; } else { if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; @@ -466,7 +466,7 @@ void EnKusa_SetupRegrow(EnKusa* this) { EnKusa_SetupAction(this, EnKusa_Regrow); EnKusa_SetScaleSmall(this); this->actor.shape.rot = this->actor.home.rot; - this->actor.flags &= ~ACTOR_FLAG_ENKUSA_CUT; + this->actor.flags &= ~ACTOR_FLAG_GRASS_DESTROYED; } void EnKusa_Regrow(EnKusa* this, PlayState* play) { @@ -490,7 +490,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { + if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { this->actor.shape.yOffset = -6.25f; } else { this->actor.shape.yOffset = 0.0f; @@ -501,7 +501,7 @@ void EnKusa_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gFieldBushDL, object_kusa_DL_000140, object_kusa_DL_000140 }; EnKusa* this = (EnKusa*)thisx; - if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) { + if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { Gfx_DrawDListOpa(play, dLists[PARAMS_GET_U(thisx->params, 0, 2)]); diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 9160bc41b1..18ea64aa3e 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -416,7 +416,7 @@ void EnKz_PreMweepWait(EnKz* this, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->actionFunc = EnKz_SetupMweep; } else { - func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 12); } } @@ -479,7 +479,7 @@ void EnKz_Wait(EnKz* this, PlayState* play) { this->actionFunc = EnKz_SetupGetItem; EnKz_SetupGetItem(this, play); } else { - func_80034F54(play, this->unk_2A6, this->unk_2BE, 12); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 12); } } @@ -546,8 +546,8 @@ s32 EnKz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po EnKz* this = (EnKz*)thisx; if (limbIndex == 8 || limbIndex == 9 || limbIndex == 10) { - rot->y += Math_SinS(this->unk_2A6[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->unk_2BE[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } if (limbIndex) {} return false; diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/src/overlays/actors/ovl_En_Kz/z_en_kz.h index 588dea1778..b5cd380791 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.h +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.h @@ -24,8 +24,8 @@ typedef struct EnKz { /* 0x0214 */ s16 returnToCamId; /* 0x0216 */ Vec3s jointTable[12]; /* 0x025E */ Vec3s morphTable[12]; - /* 0x02A6 */ s16 unk_2A6[12]; - /* 0x02BE */ s16 unk_2BE[12]; + /* 0x02A6 */ s16 fidgetTableY[12]; + /* 0x02BE */ s16 fidgetTableZ[12]; } EnKz; // size = 0x02D8 #endif diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 403613d826..f8c42427d0 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -7,7 +7,9 @@ #include "z_en_ma1.h" #include "assets/objects/object_ma1/object_ma1.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMa1_Init(Actor* thisx, PlayState* play); void EnMa1_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 10ed772e4c..7131f697b5 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -1,7 +1,9 @@ #include "z_en_ma2.h" #include "assets/objects/object_ma2/object_ma2.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMa2_Init(Actor* thisx, PlayState* play); void EnMa2_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 008352b145..82453526c2 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -8,7 +8,7 @@ #include "assets/objects/object_md/object_md.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMd_Init(Actor* thisx, PlayState* play); void EnMd_Destroy(Actor* thisx, PlayState* play); @@ -695,7 +695,7 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) { void func_80AAB874(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->unk_20B != 7)) { func_80AAA92C(this, 7); } @@ -705,7 +705,7 @@ void func_80AAB874(EnMd* this, PlayState* play) { void func_80AAB8F8(EnMd* this, PlayState* play) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); } func_80AAA93C(this); } @@ -757,7 +757,7 @@ void func_80AAB948(EnMd* this, PlayState* play) { } if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { - func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); } if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) { @@ -795,7 +795,7 @@ void func_80AABC10(EnMd* this, PlayState* play) { } void func_80AABD0C(EnMd* this, PlayState* play) { - func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); func_80AAA93C(this); if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { @@ -853,8 +853,8 @@ s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) || (limbIndex == ENMD_LIMB_RIGHT_UPPER_ARM)) { - rot->y += Math_SinS(this->unk_214[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->unk_236[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.h b/src/overlays/actors/ovl_En_Md/z_en_md.h index 57b693a39a..a30ebe047a 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -43,8 +43,8 @@ typedef struct EnMd { /* 0x020E */ s16 eyeIdx; /* 0x0210 */ s16 alpha; /* 0x0212 */ s16 waypoint; - /* 0x0214 */ s16 unk_214[ENMD_LIMB_MAX]; - /* 0x0236 */ s16 unk_236[ENMD_LIMB_MAX]; + /* 0x0214 */ s16 fidgetTableY[ENMD_LIMB_MAX]; + /* 0x0236 */ s16 fidgetTableZ[ENMD_LIMB_MAX]; /* 0x0258 */ Vec3s jointTable[ENMD_LIMB_MAX]; /* 0x02BE */ Vec3s morphTable[ENMD_LIMB_MAX]; } EnMd; // size = 0x0324 diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 4e50a89e08..01c3788df9 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -152,7 +152,7 @@ void EnMu_Destroy(Actor* thisx, PlayState* play) { } void EnMu_Pose(EnMu* this, PlayState* play) { - func_80034F54(play, this->unk_20A, this->unk_22A, 16); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); } void EnMu_Update(Actor* thisx, PlayState* play) { @@ -183,8 +183,8 @@ s32 EnMu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) || (limbIndex == 13) || (limbIndex == 14)) { - rot->y += Math_SinS(this->unk_20A[limbIndex]) * 200.0f; - rot->z += Math_CosS(this->unk_22A[limbIndex]) * 200.0f; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h index 22082271e5..1b098eb417 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -15,8 +15,8 @@ typedef struct EnMu { /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ NpcInteractInfo npcInfo; /* 0x0208 */ u16 defaultTextId; - /* 0x020A */ s16 unk_20A[16]; - /* 0x022A */ s16 unk_22A[17]; + /* 0x020A */ s16 fidgetTableY[16]; + /* 0x022A */ s16 fidgetTableZ[16]; } EnMu; // size = 0x024C #endif diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 4f4b8fc283..6c30a3ec0d 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -83,7 +83,7 @@ static void* sEyeTextures[] = { gNabooruEyeClosedTex, }; -#if IS_DEBUG +#if DEBUG_FEATURES static s32 D_80AB4318 = 0; #endif @@ -194,7 +194,7 @@ void EnNb_UpdateEyes(EnNb* this) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80AB11EC(EnNb* this) { this->action = NB_ACTION_7; this->drawMode = NB_DRAW_NOTHING; @@ -533,7 +533,7 @@ void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { void EnNb_Hide(EnNb* this, PlayState* play) { EnNb_SetupHide(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AB1210(this, play); #endif } @@ -543,7 +543,7 @@ void EnNb_Fade(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckToFade(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AB1210(this, play); #endif } @@ -553,7 +553,7 @@ void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupLightOrb(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AB1210(this, play); #endif } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 3f3176f5de..02887234c5 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -225,7 +225,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { } currentCucco = (EnNiw*)currentCucco->actor.next; } - if (IS_DEBUG && BREG(7) != 0) { + if (DEBUG_FEATURES && BREG(7) != 0) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; @@ -578,8 +578,10 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 } if (this->unk_275 != 0) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += (Math_SinS((play->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f); - rot->z += (Math_CosS((play->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f); + // clang-format off + rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; + // clang-format on } } return false; 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 d2f6fbdea6..016501b5fa 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -156,7 +156,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 7c3d6e11e9..5738063865 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -10,7 +10,7 @@ #include "z64frame_advance.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnOkarinaEffect_Init(Actor* thisx, PlayState* play); void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play); @@ -124,9 +124,11 @@ void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 5fef46e214..3632ae5599 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -10,7 +10,7 @@ #include "terminal.h" #include "versions.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnOkarinaTag_Init(Actor* thisx, PlayState* play); void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play); @@ -339,7 +339,8 @@ void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { if (this->unk_15A != 0) { if (!(this->unk_15A & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -352,4 +353,5 @@ void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } } +#endif } diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 45b047f53f..0360e73379 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -624,7 +624,7 @@ void EnOkuta_Update(Actor* thisx, PlayState* play2) { this->collider.dim.radius = sOctorockColliderInit.dim.radius * this->actor.scale.x * 100.0f; } if (this->actor.params == 0x10) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != EnOkuta_WaitToAppear) { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 596ef6fc23..11ac675e34 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -153,7 +153,7 @@ static s16 sItemShelfRot[] = { 0xEAAC, 0xEAAC, 0xEAAC, 0xEAAC, 0x1554, 0x1554, 0 // unused values? static s16 D_80AC8904[] = { 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025 }; -#if IS_DEBUG +#if DEBUG_FEATURES static char* sShopkeeperPrintName[] = { "コキリの店 ", // "Kokiri Shop" "薬屋 ", // "Potion Shop" diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 2543995736..8761c568d0 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -3,7 +3,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_24) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) #define GROUND_HOVER_HEIGHT 75.0f #define MAX_LARVA 3 diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index a648327dc6..71ab72ebb4 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -8,9 +8,9 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_po_sisters/object_po_sisters.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_IGNORE_QUAKE | \ - ACTOR_FLAG_14) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | \ + ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) void EnPoSisters_Init(Actor* thisx, PlayState* play); void EnPoSisters_Destroy(Actor* thisx, PlayState* play); @@ -210,7 +210,7 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; func_80AD9AA8(this, play); } else { - this->actor.flags &= ~(ACTOR_FLAG_9 | ACTOR_FLAG_14); + this->actor.flags &= ~(ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | ACTOR_FLAG_CAN_ATTACH_TO_ARROW); this->collider.elem.elemMaterial = ELEM_MATERIAL_UNK4; this->collider.elem.acDmgInfo.dmgFlags |= DMG_DEKU_NUT; this->collider.base.ocFlags1 = OC1_NONE; @@ -701,7 +701,7 @@ void func_80ADA9E8(EnPoSisters* this, PlayState* play) { } void func_80ADAAA4(EnPoSisters* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_15)) { + if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->actor.colChkInfo.health != 0) { if (this->unk_194 != 0) { func_80AD96A4(this); @@ -1216,7 +1216,7 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { this->unk_198 = CLAMP_MIN(temp, 1); } if (this->actionFunc == func_80ADA8C0) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_199 & 1) { 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 7a415baff6..ceebba950c 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -996,7 +996,7 @@ void EnPoh_UpdateLiving(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveXZGravity(&this->actor); if (this->actionFunc == EnPoh_Attack && this->unk_198 < 10) { - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } Collider_UpdateCylinder(&this->actor, &this->colliderCyl); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index dfb43d8860..89c9e5ff6b 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -1,7 +1,7 @@ #include "z_en_rd.h" #include "assets/objects/object_rd/object_rd.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) void EnRd_Init(Actor* thisx, PlayState* play); void EnRd_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 555ef5c749..d37ffa8c02 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -695,7 +695,8 @@ void EnReeba_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_reeba.c", 1088); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { Vec3f debugPos; debugPos.x = (Math_SinS(this->actor.world.rot.y) * 30.0f) + this->actor.world.pos.x; @@ -704,4 +705,5 @@ void EnReeba_Draw(Actor* thisx, PlayState* play) { DebugDisplay_AddObject(debugPos.x, debugPos.y, debugPos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index b30b967ef8..8271dc4a6c 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -50,7 +50,7 @@ void func_80AE72D0(EnRl* this) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80AE7358(EnRl* this) { Animation_Change(&this->skelAnime, &object_rl_Anim_000A3C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_000A3C), ANIMMODE_LOOP, 0.0f); @@ -272,7 +272,7 @@ void func_80AE7BF8(EnRl* this, s32 arg1) { void func_80AE7C64(EnRl* this, PlayState* play) { func_80AE7954(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AE73D8(this, play); #endif } @@ -282,7 +282,7 @@ void func_80AE7C94(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE79A4(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AE73D8(this, play); #endif } @@ -294,7 +294,7 @@ void func_80AE7CE8(EnRl* this, PlayState* play) { temp = func_80AE7494(this); func_80AE72D0(this); func_80AE7BF8(this, temp); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AE73D8(this, play); #endif } @@ -304,7 +304,7 @@ void func_80AE7D40(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE7AF8(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AE73D8(this, play); #endif } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 83366209be..0708af32ef 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -9,7 +9,8 @@ #include "terminal.h" #include "versions.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) #define RR_MESSAGE_SHIELD (1 << 0) #define RR_MESSAGE_TUNIC (1 << 1) @@ -77,7 +78,7 @@ ActorProfile En_Rr_Profile = { /**/ EnRr_Draw, }; -#if IS_DEBUG +#if DEBUG_FEATURES static char* sDropNames[] = { // "type 7", "small magic jar", "arrow", "fairy", "20 rupees", "50 rupees" "タイプ7 ", "魔法の壷小", "矢 ", "妖精 ", "20ルピー ", "50ルピー ", diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 2dcacdc42e..2ea4e87dd3 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -10,7 +10,7 @@ #include "versions.h" #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_26) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES) void EnRu1_Init(Actor* thisx, PlayState* play); void EnRu1_Destroy(Actor* thisx, PlayState* play); @@ -341,7 +341,7 @@ s32 func_80AEB1B4(PlayState* play) { return Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING; } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80AEB1D8(EnRu1* this) { this->action = 36; this->drawConfig = 0; @@ -2023,7 +2023,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if (!(IS_DEBUG && IS_CUTSCENE_LAYER) && EnRu1_IsCsStateIdle(play)) { + if (!(DEBUG_FEATURES && IS_CUTSCENE_LAYER) && EnRu1_IsCsStateIdle(play)) { curRoomNum = play->roomCtx.curRoom.num; SET_INFTABLE(INFTABLE_145); Flags_SetSwitch(play, func_80AEADE0(this)); @@ -2060,7 +2060,7 @@ void func_80AEF9D8(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF624(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AEB220(this, play); #endif } @@ -2076,7 +2076,7 @@ void func_80AEFA2C(EnRu1* this, PlayState* play) { func_80AEF5B8(this); func_80AEF40C(this); func_80AEF728(this, something); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AEB220(this, play); #endif } @@ -2086,7 +2086,7 @@ void func_80AEFAAC(EnRu1* this, PlayState* play) { func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); func_80AEF79C(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AEB220(this, play); #endif } @@ -2099,7 +2099,7 @@ void func_80AEFB04(EnRu1* this, PlayState* play) { something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF820(this, something); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AEB220(this, play); #endif } @@ -2110,7 +2110,7 @@ void func_80AEFB68(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF890(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AEB220(this, play); #endif } @@ -2235,7 +2235,7 @@ void func_80AEFF94(EnRu1* this, PlayState* play) { } } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80AF0050(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 36; @@ -2286,7 +2286,7 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { case 6: func_80AEFF94(this, play); break; -#if IS_DEBUG +#if DEBUG_FEATURES case 10: func_80AF0050(this, play); break; diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 325d4d2347..4e15ee767a 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -61,7 +61,7 @@ static void* sEyeTextures[] = { gAdultRutoEyeClosedTex, }; -#if IS_DEBUG +#if DEBUG_FEATURES static UNK_TYPE D_80AF4118 = 0; #endif @@ -138,7 +138,7 @@ s32 func_80AF26A0(EnRu2* this) { return params; } -#if IS_DEBUG +#if DEBUG_FEATURES void func_80AF26AC(EnRu2* this) { this->action = 7; this->drawConfig = 0; @@ -453,7 +453,7 @@ void func_80AF30AC(EnRu2* this, PlayState* play) { void func_80AF3144(EnRu2* this, PlayState* play) { func_80AF2F04(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AF26D0(this, play); #endif } @@ -463,7 +463,7 @@ void func_80AF3174(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2F58(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AF26D0(this, play); #endif } @@ -473,7 +473,7 @@ void func_80AF31C8(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF30AC(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80AF26D0(this, play); #endif } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index bd7f2d3b4f..72eba29b61 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -4,7 +4,7 @@ #include "assets/scenes/overworld/spot04/spot04_scene.h" #include "assets/scenes/overworld/spot05/spot05_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnSa_Init(Actor* thisx, PlayState* play); void EnSa_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index ece2b71957..c8bf25c9b2 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -6,7 +6,7 @@ #include "z_en_si.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_9) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) void EnSi_Init(Actor* thisx, PlayState* play); void EnSi_Destroy(Actor* thisx, PlayState* play); @@ -80,7 +80,7 @@ s32 func_80AFB748(EnSi* this, PlayState* play) { void func_80AFB768(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->actionFunc = func_80AFB89C; } else { Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); @@ -115,7 +115,7 @@ void func_80AFB89C(EnSi* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { + if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Item_Give(play, ITEM_SKULL_TOKEN); if (!DISABLE_PLAYER_FREEZE) { player->actor.freezeTimer = 10; diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 33203ceffc..a05e400777 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -2,7 +2,7 @@ #include "overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h" #include "assets/objects/object_skj/object_skj.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnSkj_Init(Actor* thisx, PlayState* play2); void EnSkj_Destroy(Actor* thisx, PlayState* play); @@ -412,7 +412,7 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { } if ((type < 0) || (type >= 7)) { - this->actor.flags &= ~ACTOR_FLAG_25; + this->actor.flags &= ~ACTOR_FLAG_UPDATE_DURING_OCARINA; } if ((type > 0) && (type < 3)) { @@ -444,7 +444,7 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { this->actor.gravity = -1.0f; EnSkj_CalculateCenter(this); -#if IS_DEBUG +#if DEBUG_FEATURES { Player* player = GET_PLAYER(play); @@ -1349,11 +1349,13 @@ void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { D_80B01EA0 = Actor_TalkOfferAccepted(&this->actor, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } void EnSkj_TurnPlayer(EnSkj* this, Player* player) { @@ -1591,11 +1593,13 @@ void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play) { this->actor.focus.pos.y = -90.0f; this->actor.focus.pos.z = 450.0f; - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 14da6adb97..0804263355 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -7,7 +7,7 @@ #include "z_en_skjneedle.h" #include "assets/objects/object_skj/object_skj.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_9) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) void EnSkjneedle_Init(Actor* thisx, PlayState* play); void EnSkjneedle_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 8c79f61db2..d1dd84467d 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -563,7 +563,9 @@ s32 EnSt_DecrStunTimer(EnSt* this) { if (this->stunTimer == 0) { return 0; } - this->stunTimer--; //! @bug no return but v0 ends up being stunTimer before decrement + this->stunTimer--; + //! @bug No return, v0 ends up being stunTimer before decrement. + //! The return value is not used so it doesn't matter. } /** @@ -798,8 +800,8 @@ void EnSt_Init(Actor* thisx, PlayState* play) { this->actor.naviEnemyId = NAVI_ENEMY_SKULLTULA; } EnSt_CheckCeilingPos(this, play); - this->actor.flags |= ACTOR_FLAG_14; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_CAN_ATTACH_TO_ARROW; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; EnSt_SetColliderScale(this); this->actor.gravity = 0.0f; this->initialYaw = this->actor.world.rot.y; @@ -1013,7 +1015,7 @@ void EnSt_Update(Actor* thisx, PlayState* play) { s32 pad; Color_RGBA8 color = { 0, 0, 0, 0 }; - if (this->actor.flags & ACTOR_FLAG_15) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { SkelAnime_Update(&this->skelAnime); } else if (!EnSt_CheckColliders(this, play)) { // no collision has been detected. diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index acf8e5885a..1d42d4c43c 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -336,7 +336,7 @@ void EnSth_Update2(Actor* thisx, PlayState* play) { s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSth* this = (EnSth*)thisx; - s32 temp_v1; + s32 fidgetFrequency; if (limbIndex == 15) { rot->x += this->headRot.y; @@ -350,9 +350,9 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p } if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - temp_v1 = limbIndex * 0x32; - rot->y += (Math_SinS(play->state.frames * (temp_v1 + 0x814)) * 200.0f); - rot->z += (Math_CosS(play->state.frames * (temp_v1 + 0x940)) * 200.0f); + fidgetFrequency = limbIndex * FIDGET_FREQ_LIMB; + rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; } return 0; } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 2e1091eda7..7f18de1528 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -111,7 +111,7 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) { this->unk_3D8.zw = 0.0f; this->unk_3D8.ww = 1.0f; Matrix_MtxFToYXZRotS(&this->unk_3D8, &this->actor.world.rot, 0); - //! @bug: Does not return. + //! @bug Does not return, but the return value is not used by any caller so it doesn't matter. } CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32* arg4) { diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 5532ffe3e1..9a7301f537 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -343,9 +343,11 @@ void EnSyatekiItm_Update(Actor* thisx, PlayState* play) { this->unkTimer--; } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 8068310a5e..e768c2cc14 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -40,7 +40,7 @@ void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play); void EnSyatekiMan_BlinkWait(EnSyatekiMan* this); void EnSyatekiMan_Blink(EnSyatekiMan* this); -#if IS_DEBUG +#if DEBUG_FEATURES void EnSyatekiMan_SetBgm(void); #endif @@ -56,7 +56,7 @@ ActorProfile En_Syateki_Man_Profile = { /**/ EnSyatekiMan_Draw, }; -#if IS_DEBUG +#if DEBUG_FEATURES static u16 sBgmList[] = { NA_BGM_GENERAL_SFX, NA_BGM_NATURE_AMBIENCE, @@ -473,7 +473,7 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES EnSyatekiMan_SetBgm(); #endif @@ -511,7 +511,7 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { EnSyatekiMan_OverrideLimbDraw, NULL, this); } -#if IS_DEBUG +#if DEBUG_FEATURES void EnSyatekiMan_SetBgm(void) { if (BREG(80)) { BREG(80) = false; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 6990af1ac8..c94f1acef9 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -1282,10 +1282,10 @@ s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po this->stateFlags &= ~TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM; } else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) || (limbIndex == ENTA_LIMB_RIGHT_ARM)) { - s32 limbIdx50 = limbIndex * 50; + s32 fidgetFrequency = limbIndex * FIDGET_FREQ_LIMB; - rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f; - rot->z += Math_CosS(play->state.frames * (limbIdx50 + 0x940)) * 200.0f; + rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; } return false; diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index fec4be1e3b..866329c2ab 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -27,7 +27,7 @@ ActorProfile En_Tana_Profile = { /**/ NULL, }; -#if IS_DEBUG +#if DEBUG_FEATURES //! @bug A third entry is missing here. When printing the string indexed by `params` for type 2, the //! next data entry will be dereferenced and print garbage, stopping any future printing. //! In a non-matching context, this can cause a crash if the next item isn't a valid pointer. diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index eb28e6a164..2471e1e371 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -288,7 +288,7 @@ void EnTite_Attack(EnTite* this, PlayState* play) { case TEKTITE_MID_LUNGE: // Continue trajectory until tektite has negative velocity and has landed on ground/water surface // Snap to ground/water surface, or if falling fast dip into the water and slow fall speed - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) { if (this->actor.velocity.y <= 0.0f) { @@ -571,7 +571,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play) { } else { this->actor.velocity.y = 10.0f; this->actor.speed = 4.0f; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; this->actor.gravity = -1.0f; if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); @@ -582,7 +582,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play) { } else { this->actor.velocity.y = 10.0f; this->actor.speed = 4.0f; - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; this->actor.gravity = -1.0f; if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); @@ -593,7 +593,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, PlayState* play) { // If in midair: } else { // Turn slowly toward player - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0); if (this->actor.velocity.y >= 6.0f) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 41ed3883e7..bef80ab310 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -408,7 +408,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sStickAngle = thisx->yawTowardsPlayer; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && - (this->actor.isLockedOn || !(player->stateFlags1 & PLAYER_STATE1_22))) { + (this->actor.isLockedOn || !(player->stateFlags1 & PLAYER_STATE1_SHIELDING))) { EnTorch2_SwingSword(play, input, this); } else { f32 sp50 = 0.0f; @@ -618,7 +618,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } this->actor.colChkInfo.damage = 0; - this->knockbackDamage = PLAYER_KNOCKBACK_NONE; + this->knockbackDamage = 0; } // Handles being frozen by a deku nut diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index 39708d3be5..81fa2cf06c 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -147,9 +147,11 @@ void EnWallTubo_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 3346708dd3..0e2dccc170 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -333,9 +333,11 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index a096e84c08..0fa5d1c457 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -228,11 +228,14 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { this->timer = this->timerMod + 81; return; } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { + +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } +#endif } } if (this->timer == 1) { @@ -301,11 +304,15 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { Actor_Kill(&this->actor); return; } - } else if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { + } + +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } +#endif } } if (this->timer == 1) { @@ -368,10 +375,12 @@ void EnWonderItem_Update(Actor* thisx, PlayState* play) { colorIndex = 0; } - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, debugArrowColors[colorIndex], debugArrowColors[colorIndex + 1], debugArrowColors[colorIndex + 2], 255, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index 783d1f6011..714f1a1852 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -239,7 +239,8 @@ void EnWonderTalk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->height); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { if (this->unk_15A != 0) { if ((this->unk_15A & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -252,4 +253,5 @@ void EnWonderTalk_Update(Actor* thisx, PlayState* play) { 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } +#endif } diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index b657da9feb..3ae525205c 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -131,7 +131,7 @@ void func_80B3A15C(EnWonderTalk2* this, PlayState* play) { if (!((this->actor.xzDistToPlayer > 40.0f + this->triggerRange) || (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (yawDiff >= 0x4000))) { - if (IS_DEBUG && this->unk_158 >= 2) { + if (DEBUG_FEATURES && this->unk_158 >= 2) { PRINTF("\n\n"); // "Transparent Message Kimi Set" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君せっと %x\n" VT_RST, this->actor.params); @@ -220,7 +220,7 @@ void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f)) && !Play_InCsMode(play)) { - if (IS_DEBUG && this->unk_158 >= 2) { + if (DEBUG_FEATURES && this->unk_158 >= 2) { PRINTF("\n\n"); // "Transparent Message Kimi Seto" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君せっと %x\n" VT_RST, this->actor.params); @@ -278,7 +278,8 @@ void EnWonderTalk2_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->height); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { if (this->unk_158 != 0) { if ((this->unk_158 & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -291,4 +292,5 @@ void EnWonderTalk2_Update(Actor* thisx, PlayState* play) { 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } +#endif } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 1e04ef2966..ccf9bf873f 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -14,8 +14,8 @@ #include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.h" #include "terminal.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \ - "pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #define FLAGS ACTOR_FLAG_4 @@ -229,7 +229,7 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } -#if IS_DEBUG +#if DEBUG_FEATURES s32 EnXc_NoCutscenePlaying(PlayState* play) { if (play->csCtx.state == CS_STATE_IDLE) { return true; @@ -352,8 +352,8 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { } void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { - if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && IS_DEBUG) && !GET_EVENTCHKINF(EVENTCHKINF_52) && - LINK_IS_ADULT) { + if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && DEBUG_FEATURES) && + !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) { s32 pad; this->action = SHEIK_ACTION_SERENADE; @@ -488,7 +488,7 @@ void EnXc_SetColossusWindSFX(PlayState* play) { if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; -#if IS_DEBUG +#if DEBUG_FEATURES static f32 sMaxSpeed = 0.0f; sMaxSpeed = CLAMP_MIN(sMaxSpeed, speed); @@ -1397,7 +1397,7 @@ void func_80B3F3D8(void) { } #pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \ - "ntsc-1.2:64 pal-1.0:64 pal-1.1:64" + "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { static Vec3f D_80B42DA0; @@ -1694,7 +1694,7 @@ void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupShowTriforceAction(this, play); -#if IS_DEBUG +#if DEBUG_FEATURES func_80B3C888(this, play); #endif } @@ -1707,7 +1707,7 @@ void EnXc_ShowTriforce(EnXc* this, PlayState* play) { EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); -#if IS_DEBUG +#if DEBUG_FEATURES func_80B3C888(this, play); #endif } @@ -1849,7 +1849,7 @@ void EnXc_SetupContortions(EnXc* this, PlayState* play) { s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; -#if IS_DEBUG +#if DEBUG_FEATURES Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikIdleAnim), ANIMMODE_LOOP, 0.0f); #endif @@ -2375,7 +2375,7 @@ void EnXc_Init(Actor* thisx, PlayState* play) { case SHEIK_TYPE_9: EnXc_InitTempleOfTime(this, play); break; -#if IS_DEBUG +#if DEBUG_FEATURES case SHEIK_TYPE_0: EnXc_DoNothing(this, play); break; diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index ddaea28848..02683593c9 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -215,9 +215,11 @@ void EnYabusameMark_Update(Actor* thisx, PlayState* play) { Collider_SetQuadVertices(&this->collider, &this->vertexA, &this->vertexB, &this->vertexC, &this->vertexD); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { +#if IS_ACTOR_DEBUG_ENABLED + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); } +#endif } diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 8ac0995c59..4f739acac8 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -134,7 +134,7 @@ void EnYukabyun_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 20.0f, 8.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); - this->actor.flags |= ACTOR_FLAG_24; + this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index fdb12d3b10..5dfe62b79d 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -1595,7 +1595,7 @@ void func_80B52114(EnZl2* this, PlayState* play) { case 4: func_80B51D0C(this, play); break; -#if IS_DEBUG +#if DEBUG_FEATURES case 0: func_80B4FD90(this, play); break; @@ -1612,7 +1612,7 @@ void func_80B521A0(EnZl2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; -#if IS_DEBUG +#if DEBUG_FEATURES if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl2_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index dec42825e6..cca405790a 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -2660,7 +2660,7 @@ void func_80B59DB8(EnZl3* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME2); s32 pad2; -#if IS_DEBUG +#if DEBUG_FEATURES if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl3_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index fd78e537e2..c3080986e1 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -612,7 +612,7 @@ void EnZo_Destroy(Actor* thisx, PlayState* play) { void EnZo_Standing(EnZo* this, PlayState* play) { s16 angle; - func_80034F54(play, this->unk_656, this->unk_67E, 20); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 20); EnZo_SetAnimation(this); if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { this->trackingMode = NPC_TRACKING_FULL_BODY; @@ -654,7 +654,7 @@ void EnZo_Surface(EnZo* this, PlayState* play) { } void EnZo_TreadWater(EnZo* this, PlayState* play) { - func_80034F54(play, this->unk_656, this->unk_67E, 20); + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 20); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->canSpeak = true; this->trackingMode = NPC_TRACKING_FULL_BODY; @@ -770,8 +770,8 @@ s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) { - rot->y += (Math_SinS(this->unk_656[limbIndex]) * 200.0f); - rot->z += (Math_CosS(this->unk_67E[limbIndex]) * 200.0f); + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return 0; 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 837dd260cb..4d7a02ddf0 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -38,8 +38,8 @@ typedef struct EnZo { /* 0x0650 */ s16 timeToDive; /* 0x0652 */ s16 blinkTimer; /* 0x0654 */ s16 eyeTexture; - /* 0x0656 */ s16 unk_656[20]; - /* 0x067E */ s16 unk_67E[20]; + /* 0x0656 */ s16 fidgetTableY[20]; + /* 0x067E */ s16 fidgetTableZ[20]; } EnZo; // size = 0x06A8 #endif diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index f47520e573..c6778bd104 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -651,7 +651,7 @@ void EnfHG_Retreat(EnfHG* this, PlayState* play) { BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s16 paintingIdxReal; s16 paintingIdxFake; - Actor* child; + UNUSED_NDEBUG Actor* child; if (this->actor.params != GND_REAL_BOSS) { this->killActor = true; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index c55b296791..4c5e2ab731 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -35,14 +35,14 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:180 gc-eu-mq:180 gc-jp:180 gc-jp-ce:180 gc-jp-mq:180 gc-us:180 gc-us-mq:180" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:177 gc-eu-mq:177 gc-jp:177 gc-jp-ce:177 gc-jp-mq:177 gc-us:177 gc-us-mq:177" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_4 #define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface -#if IS_DEBUG +#if DEBUG_FEATURES #define KREG_DEBUG(i) KREG(i) #else #define KREG_DEBUG(i) 0 @@ -864,7 +864,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(5) != 0) { sLinkAge = LINK_AGE_CHILD; } else { @@ -949,14 +949,14 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { sFishingFoggy = 0; } -#if IS_DEBUG +#if DEBUG_FEATURES if (((sFishGameNumber & 7) == 6) || (KREG(3) != 0)) #else if ((sFishGameNumber & 7) == 6) #endif { sStormChanceTimer = 100; -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(3) != 0) { KREG(3) = 0; HIGH_SCORE(HS_FISHING) &= ~(HS_FISH_PLAYED * 255); @@ -1015,7 +1015,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { ENKANBAN_FISHING); Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); -#if IS_DEBUG +#if DEBUG_FEATURES if ((KREG(1) == 1) || ((sFishGameNumber & 3) == 3)) #else if ((sFishGameNumber & 3) == 3) @@ -1069,7 +1069,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { this->fishLength += Rand_ZeroFloat(7.99999f); } -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(6) != 0) { this->fishLength = KREG(6) + 80.0f; } @@ -2239,7 +2239,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { case 0: sSinkingLureSegmentIndex = 0; -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(14) != 0) { KREG(14) = 0; sLureEquipped = FS_LURE_SINKING - sLureEquipped; @@ -3167,7 +3167,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } } -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(15) != 0) { KREG(15) = 0; this->fishState = 7; @@ -3270,7 +3270,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { this->fishState = 10; this->fishStateNext = 10; } else if ((KREG_DEBUG(2) != 0) || (((this->unk_1A4 & 0x7FF) == 0) && (this->unk_1A4 < 15000))) { -#if IS_DEBUG +#if DEBUG_FEATURES KREG(2) = 0; #endif this->fishState = -2; @@ -3431,7 +3431,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { chance *= 5.0f; } -#if IS_DEBUG +#if DEBUG_FEATURES if (((this->timerArray[0] == 1) || (Rand_ZeroOne() < chance)) && ((Rand_ZeroOne() < (this->perception * multiplier)) || ((this->isLoach + 1) == KREG(69)))) #else @@ -5105,7 +5105,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { break; case 22: -#if IS_DEBUG +#if DEBUG_FEATURES if (play) {} #endif @@ -5169,7 +5169,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { Player* player = GET_PLAYER(play); Input* input = &play->state.input[0]; -#if IS_DEBUG +#if DEBUG_FEATURES if (0) { // Strings existing only in rodata PRINTF(VT_FGCOL(GREEN)); @@ -5234,7 +5234,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { f32 dz = sOwnerHeadPos.z - sLurePos.z; if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f) || (KREG_DEBUG(77) > 0)) { -#if IS_DEBUG +#if DEBUG_FEATURES KREG(77) = 0; #endif sOwnerHair = FS_OWNER_BALD; @@ -5250,7 +5250,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { HIGH_SCORE(HS_FISHING) &= ~HS_FISH_STOLE_HAT; } -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(77) < 0) { KREG(77) = 0; sIsOwnersHatSunk = true; @@ -5299,7 +5299,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } -#if IS_DEBUG +#if DEBUG_FEATURES if (KREG(0) != 0) { s32 pad[3]; @@ -5653,7 +5653,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { } } -#if IS_DEBUG +#if DEBUG_FEATURES if (sREG(15) != 0) { if (sStormStrengthTarget != (sREG(15) - 1)) { if (sStormStrengthTarget == 0) { @@ -5775,7 +5775,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { gSaveContext.minigameScore = (SQ((f32)sFishLengthToWeigh) * 0.0036f) + 0.5f; #endif -#if IS_DEBUG +#if DEBUG_FEATURES if (BREG(26) != 0) { BREG(26) = 0; Message_StartTextbox(play, 0x407B + BREG(27), NULL); diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 6049a19a27..fc298fca8b 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -7,7 +7,7 @@ #include "z_magic_dark.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicDark_Init(Actor* thisx, PlayState* play); void MagicDark_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 3895bac8be..e36a673c95 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -6,7 +6,7 @@ #include "z_magic_fire.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicFire_Init(Actor* thisx, PlayState* play); void MagicFire_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index f8a9e829e2..1126ae5b0a 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -6,7 +6,7 @@ #include "z_magic_wind.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicWind_Init(Actor* thisx, PlayState* play); void MagicWind_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index ec93a28ad9..570c645a24 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -141,7 +141,7 @@ void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* colli CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -469,7 +469,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || (IS_DEBUG && mREG(1) == 1)) { + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) || (DEBUG_FEATURES && mREG(1) == 1)) { path = PARAMS_GET_U(this->dyna.actor.params, 8, 5); if (path == 0x1F) { PRINTF(VT_COL(RED, WHITE)); @@ -505,7 +505,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { return; } } else if ((Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) != 0) || - (IS_DEBUG && mREG(1) == 1)) { + (DEBUG_FEATURES && mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index 961a707a68..fac468a29c 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -51,7 +51,7 @@ void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collisio CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index e85d123ced..75163663e9 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -60,7 +60,7 @@ void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -98,7 +98,7 @@ void ObjHsblock_Init(Actor* thisx, PlayState* play) { } } -#if IS_DEBUG +#if DEBUG_FEATURES mREG(13) = 255; mREG(14) = 255; mREG(15) = 255; @@ -163,7 +163,7 @@ void ObjHsblock_Draw(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_FIRE_TEMPLE) { color = &sFireTempleColor; } else { -#if IS_DEBUG +#if DEBUG_FEATURES defaultColor.r = mREG(13); defaultColor.g = mREG(14); defaultColor.b = mREG(15); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index f3b101e48e..0e41cff338 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -8,7 +8,7 @@ #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_26) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES) void ObjKibako_Init(Actor* thisx, PlayState* play); void ObjKibako_Destroy(Actor* thisx, PlayState* play2); diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index f60b32d5c6..3c63e0af1f 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -69,7 +69,7 @@ void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* colli CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 607d3e10a5..7b52356690 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -110,7 +110,7 @@ void ObjMure_Init(Actor* thisx, PlayState* play) { PRINTF("群れな敵 (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n", thisx->params, this->chNum, this->ptn, this->svNum, this->type); -#if IS_DEBUG +#if DEBUG_FEATURES if (ObjMure_GetMaxChildSpawns(this) <= 0) { PRINTF("Warning : 個体数が設定されていません(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 268, thisx->params); } @@ -128,7 +128,7 @@ s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { } void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { -#if IS_DEBUG +#if DEBUG_FEATURES if (ptn >= 4) { PRINTF("おかしなの (%s %d)\n", "../z_obj_mure.c", 307); } @@ -145,7 +145,7 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { s32 maxChildren = ObjMure_GetMaxChildSpawns(this); for (i = 0; i < maxChildren; i++) { -#if IS_DEBUG +#if DEBUG_FEATURES if (this->children[i] != NULL) { // "Error: I already have a child(%s %d)(arg_data 0x%04x)" PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, actor->params); @@ -161,7 +161,7 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { - this->children[i]->flags |= ACTOR_FLAG_ENKUSA_CUT; + this->children[i]->flags |= ACTOR_FLAG_GRASS_DESTROYED; this->children[i]->room = actor->room; } else { PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 359); @@ -190,7 +190,7 @@ void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { s32 i; for (i = 0; i < maxChildren; i++) { -#if IS_DEBUG +#if DEBUG_FEATURES if (this->children[i] != NULL) { PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 407, actor->params); } @@ -262,7 +262,7 @@ void ObjMure_CheckChildren(ObjMure* this, PlayState* play) { if (this->children[i] != NULL) { if (this->childrenStates[i] == OBJMURE_CHILD_STATE_0) { if (this->children[i]->update != NULL) { - if (this->children[i]->flags & ACTOR_FLAG_ENKUSA_CUT) { + if (this->children[i]->flags & ACTOR_FLAG_GRASS_DESTROYED) { this->childrenStates[i] = OBJMURE_CHILD_STATE_2; } } else { diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 5aacdad56a..f6bb63bbb3 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -92,7 +92,7 @@ void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeade CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -491,7 +491,7 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { DynaPolyActor_SetActorOnTop(dynaPolyActor); - func_80043538(dynaPolyActor); + DynaPolyActor_SetSwitchPressed(dynaPolyActor); if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, play) && @@ -520,7 +520,7 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { if ((dynaPolyActor != NULL) && (dynaPolyActor->transformFlags & DYNA_TRANSFORM_POS)) { DynaPolyActor_SetActorOnTop(dynaPolyActor); - func_80043538(dynaPolyActor); + DynaPolyActor_SetSwitchPressed(dynaPolyActor); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { ObjOshihiki_SetupFall(this, play); @@ -648,7 +648,7 @@ void ObjOshihiki_Draw(Actor* thisx, PlayState* play) { MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_obj_oshihiki.c", 1308); -#if IS_DEBUG +#if DEBUG_FEATURES switch (play->sceneId) { case SCENE_DEKU_TREE: case SCENE_DODONGOS_CAVERN: diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 85dfce4bcc..ef4f34f9e4 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -198,7 +198,7 @@ void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* c CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); -#if IS_DEBUG +#if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; @@ -410,14 +410,14 @@ void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) { break; case OBJSWITCH_SUBTYPE_HOLD: - if (func_800435B4(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_FloorPressInit(this); ObjSwitch_SetOn(this, play); } break; case OBJSWITCH_SUBTYPE_HOLD_INVERTED: - if (func_800435B4(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_FloorPressInit(this); ObjSwitch_SetOff(this, play); } @@ -467,7 +467,7 @@ void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_HOLD: case OBJSWITCH_SUBTYPE_HOLD_INVERTED: - if (!func_800435B4(&this->dyna) && !Player_InCsMode(play)) { + if (!DynaPolyActor_IsSwitchPressed(&this->dyna) && !Player_InCsMode(play)) { if (this->releaseTimer <= 0) { ObjSwitch_FloorReleaseInit(this); if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_HOLD) { diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index c6ff95c34c..d68f3d3c46 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -9,7 +9,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_syokudai/object_syokudai.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_10) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) void ObjSyokudai_Init(Actor* thisx, PlayState* play); void ObjSyokudai_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index c29b73daa2..0235a0513c 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -7,7 +7,8 @@ #include "z_obj_timeblock.h" #include "assets/objects/object_timeblock/object_timeblock.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_LOCK_ON_DISABLED) void ObjTimeblock_Init(Actor* thisx, PlayState* play); void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index dcb3428672..7877b148a7 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -8,7 +8,8 @@ #include "assets/objects/object_timeblock/object_timeblock.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_LOCK_ON_DISABLED) void ObjWarp2block_Init(Actor* thisx, PlayState* play2); void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 6833366bec..c18ca9f44d 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -9,7 +9,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_spot02_objects/object_spot02_objects.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ObjectKankyo_Init(Actor* thisx, PlayState* play); void ObjectKankyo_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index dd421a8128..0c229ebb12 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -7,7 +7,7 @@ #include "z_oceff_spot.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffSpot_Init(Actor* thisx, PlayState* play); void OceffSpot_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 931b67930f..3d95b4651e 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -6,7 +6,7 @@ #include "z_oceff_storm.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffStorm_Init(Actor* thisx, PlayState* play); void OceffStorm_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 986abc8b17..4235b1c004 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe_Init(Actor* thisx, PlayState* play); void OceffWipe_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 1c07cdbf1f..d613381f81 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe2.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe2_Init(Actor* thisx, PlayState* play); void OceffWipe2_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 5473c3da47..ea5c7eddcd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe3.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe3_Init(Actor* thisx, PlayState* play); void OceffWipe3_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 445e395ff0..0aaee51d08 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe4.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe4_Init(Actor* thisx, PlayState* play); void OceffWipe4_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 3b8f64972f..4d581a4448 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -69,7 +69,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { if (params == 0x40 || params == 0x41) { this->fairySpawnerState = SPAWNER_OUT_OF_RANGE; this->actor.flags |= ACTOR_FLAG_4; - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->actionFunc = ShotSun_UpdateFairySpawner; this->actor.flags |= ACTOR_FLAG_LOCK_ON_DISABLED; } else { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 334c9704f8..28b66bcb35 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -155,17 +155,6 @@ s32 func_80835C08(Player* this, PlayState* play); void Player_UseItem(PlayState* play, Player* this, s32 item); void func_80839F90(Player* this, PlayState* play); s32 func_8083C61C(PlayState* play, Player* this); -void func_8083CA20(PlayState* play, Player* this); -void func_8083CA54(PlayState* play, Player* this); -void func_8083CA9C(PlayState* play, Player* this); -void func_80846648(PlayState* play, Player* this); -void func_80846660(PlayState* play, Player* this); -void func_808467D4(PlayState* play, Player* this); -void func_808468A8(PlayState* play, Player* this); -void func_808468E8(PlayState* play, Player* this); -void func_80846978(PlayState* play, Player* this); -void func_808469BC(PlayState* play, Player* this); -void func_80846A68(PlayState* play, Player* this); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); @@ -317,28 +306,28 @@ void Player_Action_8084E368(Player* this, PlayState* play); void Player_Action_8084E3C4(Player* this, PlayState* play); void Player_Action_8084E604(Player* this, PlayState* play); void Player_Action_8084E6D4(Player* this, PlayState* play); -void Player_Action_8084E9AC(Player* this, PlayState* play); +void Player_Action_TimeTravelEnd(Player* this, PlayState* play); void Player_Action_8084EAC0(Player* this, PlayState* play); void Player_Action_SwingBottle(Player* this, PlayState* play); void Player_Action_8084EED8(Player* this, PlayState* play); void Player_Action_8084EFC0(Player* this, PlayState* play); void Player_Action_ExchangeItem(Player* this, PlayState* play); void Player_Action_SlideOnSlope(Player* this, PlayState* play); -void Player_Action_8084F608(Player* this, PlayState* play); -void Player_Action_8084F698(Player* this, PlayState* play); -void Player_Action_8084F710(Player* this, PlayState* play); +void Player_Action_WaitForCutscene(Player* this, PlayState* play); +void Player_Action_StartWarpSongArrive(Player* this, PlayState* play); +void Player_Action_BlueWarpArrive(Player* this, PlayState* play); void Player_Action_8084F88C(Player* this, PlayState* play); -void Player_Action_8084F9A0(Player* this, PlayState* play); -void Player_Action_8084F9C0(Player* this, PlayState* play); +void Player_Action_TryOpeningDoor(Player* this, PlayState* play); +void Player_Action_ExitGrotto(Player* this, PlayState* play); void Player_Action_8084FA54(Player* this, PlayState* play); void Player_Action_8084FB10(Player* this, PlayState* play); void Player_Action_8084FBF4(Player* this, PlayState* play); void Player_Action_808502D0(Player* this, PlayState* play); void Player_Action_808505DC(Player* this, PlayState* play); void Player_Action_8085063C(Player* this, PlayState* play); -void Player_Action_8085076C(Player* this, PlayState* play); +void Player_Action_FaroresWindArrive(Player* this, PlayState* play); void Player_Action_808507F4(Player* this, PlayState* play); -void Player_Action_80850AEC(Player* this, PlayState* play); +void Player_Action_HookshotFly(Player* this, PlayState* play); void Player_Action_80850C68(Player* this, PlayState* play); void Player_Action_80850E84(Player* this, PlayState* play); void Player_Action_CsAction(Player* this, PlayState* play); @@ -346,21 +335,21 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:64 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:128 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:192 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // .data @@ -432,8 +421,8 @@ static PlayerAgeProperties sAgeProperties[] = { 0, // unk_92 0x80, // unk_94 &gPlayerAnim_link_demo_Tbox_open, // unk_98 - &gPlayerAnim_link_demo_back_to_past, // unk_9C - &gPlayerAnim_link_demo_return_to_past, // unk_A0 + &gPlayerAnim_link_demo_back_to_past, // timeTravelStartAnim + &gPlayerAnim_link_demo_return_to_past, // timeTravelEndAnim &gPlayerAnim_link_normal_climb_startA, // unk_A4 &gPlayerAnim_link_normal_climb_startB, // unk_A8 { &gPlayerAnim_link_normal_climb_upL, &gPlayerAnim_link_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL, @@ -484,8 +473,8 @@ static PlayerAgeProperties sAgeProperties[] = { 0x20, // unk_92 0, // unk_94 &gPlayerAnim_clink_demo_Tbox_open, // unk_98 - &gPlayerAnim_clink_demo_goto_future, // unk_9C - &gPlayerAnim_clink_demo_return_to_future, // unk_A0 + &gPlayerAnim_clink_demo_goto_future, // timeTravelStartAnim + &gPlayerAnim_clink_demo_return_to_future, // timeTravelEndAnim &gPlayerAnim_clink_normal_climb_startA, // unk_A4 &gPlayerAnim_clink_normal_climb_startB, // unk_A8 { &gPlayerAnim_clink_normal_climb_upL, &gPlayerAnim_clink_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL, @@ -1714,7 +1703,6 @@ BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) { this->speedXZ = 0.0f; } -// return type can't be void due to regalloc in func_8083F72C BAD_RETURN(s32) func_80832224(Player* this) { Player_ZeroSpeedXZ(this); this->unk_6AD = 0; @@ -2734,7 +2722,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && #endif - ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) && + ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_SHIELDING)) && (gSaveContext.save.info.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csAction == PLAYER_CSACTION_NONE) && (play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger != TRANS_TRIGGER_START) && @@ -2853,7 +2841,7 @@ s32 func_80834758(PlayState* play, Player* this) { LinkAnimationHeader* anim; f32 frame; - if (!(this->stateFlags1 & (PLAYER_STATE1_22 | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && + if (!(this->stateFlags1 & (PLAYER_STATE1_SHIELDING | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && (play->shootingGalleryStatus == 0) && (this->heldItemAction == this->itemAction) && (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && Player_IsZTargeting(this) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { @@ -2955,7 +2943,7 @@ s32 func_80834B5C(Player* this, PlayState* play) { func_80834894(this); return true; } else { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); return true; } @@ -2971,7 +2959,7 @@ s32 func_80834BD4(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->upperSkelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); } - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); return true; @@ -3416,20 +3404,21 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun this->actionFunc = actionFunc; - if ((this->itemAction != this->heldItemAction) && (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_22))) { + if ((this->itemAction != this->heldItemAction) && + (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_SHIELDING))) { func_8008EC70(this); } if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { func_80834644(play, this); - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } Player_FinishAnimMovement(this); this->stateFlags1 &= ~(PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_26 | PLAYER_STATE1_28 | PLAYER_STATE1_29 | PLAYER_STATE1_31); - this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_27 | PLAYER_STATE2_IDLE_FIDGET); + this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_USING_OCARINA | PLAYER_STATE2_IDLE_FIDGET); this->stateFlags3 &= ~(PLAYER_STATE3_1 | PLAYER_STATE3_3 | PLAYER_STATE3_FLYING_WITH_HOOKSHOT); this->av1.actionVar1 = 0; @@ -3516,7 +3505,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { itemAction = Player_ItemToItemAction(item); if (((this->heldItemAction == this->itemAction) && - (!(this->stateFlags1 & PLAYER_STATE1_22) || (Player_ActionToMeleeWeapon(itemAction) != 0) || + (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || (Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE))) || ((this->itemAction < 0) && ((Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE)))) { @@ -3672,7 +3661,7 @@ int Player_CanUpdateItems(Player* this) { */ s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { - Player_SetupAction(play, this, Player_Action_80850AEC, 1); + Player_SetupAction(play, this, Player_Action_HookshotFly, 1); this->stateFlags3 |= PLAYER_STATE3_FLYING_WITH_HOOKSHOT; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); Player_StartAnimMovement(play, this, @@ -4914,7 +4903,7 @@ s32 func_808382DC(Player* this, PlayState* play) { Actor* ac = this->cylinder.base.ac; s32 sp4C; - if (ac->flags & ACTOR_FLAG_24) { + if (ac->flags & ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) { Player_PlaySfx(this, NA_SE_PL_BODY_HIT); } @@ -5360,7 +5349,7 @@ s32 Player_ActionHandler_1(Player* this, PlayState* play) { if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || ((this->heldActor != NULL) && (this->heldActor->id == ACTOR_EN_RU1)))) { - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (Player_Action_8084F9A0 == this->actionFunc)) { + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (Player_Action_TryOpeningDoor == this->actionFunc)) { doorActor = this->doorActor; if (this->doorType <= PLAYER_DOORTYPE_AJAR) { @@ -5597,7 +5586,7 @@ void func_8083A0F4(PlayState* play, Player* this) { if (interactActorId == ACTOR_BG_TOKI_SWD) { this->interactRangeActor->parent = &this->actor; - Player_SetupAction(play, this, Player_Action_8084F608, 0); + Player_SetupAction(play, this, Player_Action_WaitForCutscene, 0); this->stateFlags1 |= PLAYER_STATE1_29; } else { LinkAnimationHeader* anim; @@ -6116,7 +6105,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { } else { Player_SetupActionPreserveItemAction(play, this, Player_Action_8084E3C4, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); - this->stateFlags2 |= PLAYER_STATE2_27; + this->stateFlags2 |= PLAYER_STATE2_USING_OCARINA; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { this->stateFlags2 |= PLAYER_STATE2_25; @@ -6304,7 +6293,7 @@ void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVe } s32 func_8083BB20(Player* this) { - if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0)) { + if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld(this) != 0)) { if (sUseHeldItem || ((this->actor.category != ACTORCAT_PLAYER) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B))) { return 1; @@ -6490,7 +6479,7 @@ s32 Player_ActionHandler_11(Player* this, PlayState* play) { Player_DetachHeldActor(play, this); if (Player_SetupAction(play, this, Player_Action_80843188, 0)) { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; if (!Player_IsChildWithHylianShield(this)) { Player_SetModelsForHoldingShield(this); @@ -6548,7 +6537,7 @@ void func_8083C50C(Player* this) { s32 Player_ActionHandler_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld2(this) != 0) && + if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld2(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { if ((this->heldItemAction != PLAYER_IA_SWORD_BIGGORON) || (gSaveContext.save.info.playerData.swordHealth > 0.0f)) { @@ -6659,7 +6648,7 @@ void func_8083C8DC(Player* this, PlayState* play, s16 arg2) { func_8083C858(this, play); } -s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { +s32 Player_SetStartingMovement(PlayState* play, Player* this, f32 arg2) { WaterBox* sp2C; f32 sp28; @@ -6683,29 +6672,31 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { return 1; } -void func_8083CA20(PlayState* play, Player* this) { - if (func_8083C910(play, this, 180.0f)) { +void Player_StartMode_Idle(PlayState* play, Player* this) { + if (Player_SetStartingMovement(play, this, 180.0f)) { this->av2.actionVar2 = -20; } } -void func_8083CA54(PlayState* play, Player* this) { +void Player_StartMode_MoveForwardSlow(PlayState* play, Player* this) { this->speedXZ = 2.0f; gSaveContext.entranceSpeed = 2.0f; - if (func_8083C910(play, this, 120.0f)) { + + if (Player_SetStartingMovement(play, this, 120.0f)) { this->av2.actionVar2 = -15; } } -void func_8083CA9C(PlayState* play, Player* this) { +void Player_StartMode_MoveForward(PlayState* play, Player* this) { if (gSaveContext.entranceSpeed < 0.1f) { gSaveContext.entranceSpeed = 0.1f; } this->speedXZ = gSaveContext.entranceSpeed; - if (func_8083C910(play, this, 800.0f)) { + if (Player_SetStartingMovement(play, this, 800.0f)) { this->av2.actionVar2 = -80 / this->speedXZ; + if (this->av2.actionVar2 < -20) { this->av2.actionVar2 = -20; } @@ -7264,7 +7255,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) if (sFloorShapePitch >= 0) { this->av1.facingUpSlope = true; } - Player_AnimChangeLoopMorph(play, this, sSlopeSlideAnims[this->av1.actionVar1]); + Player_AnimChangeLoopMorph(play, this, sSlopeSlideAnims[this->av1.facingUpSlope]); this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->yaw = playerVelYaw; return true; @@ -7296,7 +7287,7 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { Sfx_PlaySfxCentered((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } -#if IS_DEBUG +#if DEBUG_FEATURES #define DEBUG_iREG_67 iREG(67) #else #define DEBUG_iREG_67 0 @@ -7315,7 +7306,7 @@ s32 Player_ActionHandler_2(Player* this, PlayState* play) { if (this->getItemId < GI_MAX) { GetItemEntry* giEntry = &sGetItemTable[this->getItemId - 1]; -#if IS_DEBUG +#if DEBUG_FEATURES if ((interactedActor != &this->actor) && !iREG(67)) { interactedActor->parent = &this->actor; } @@ -9150,9 +9141,9 @@ void Player_Action_80843188(Player* this, PlayState* play) { } if (!Player_IsChildWithHylianShield(this)) { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_UpdateUpperBody(this, play); - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } Player_DecelerateToZero(this); @@ -9207,7 +9198,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { if (Player_ActionHandler_11(this, play)) { func_808428D8(this, play); } else { - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; func_80832318(this); if (Player_IsChildWithHylianShield(this)) { @@ -9231,7 +9222,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { } } - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y; @@ -9257,7 +9248,7 @@ void Player_Action_808435C4(Player* this, PlayState* play) { if ((interruptResult != PLAYER_INTERRUPT_NEW_ACTION) && ((interruptResult >= PLAYER_INTERRUPT_MOVE) || LinkAnimation_Update(play, &this->skelAnime))) { Player_SetupAction(play, this, Player_Action_80843188, 1); - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense, this->modelAnimType); frames = Animation_GetLastFrame(anim); @@ -10506,86 +10497,103 @@ static ColliderQuadInit D_808546A0 = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -void func_8084663C(Actor* thisx, PlayState* play) { +void Player_DoNothing(Actor* thisx, PlayState* play) { } -void func_80846648(PlayState* play, Player* this) { - this->actor.update = func_8084663C; +void Player_StartMode_Nothing(PlayState* play, Player* this) { + this->actor.update = Player_DoNothing; this->actor.draw = NULL; } -void func_80846660(PlayState* play, Player* this) { - Player_SetupAction(play, this, Player_Action_8084F710, 0); +void Player_StartMode_BlueWarp(PlayState* play, Player* this) { + Player_SetupAction(play, this, Player_Action_BlueWarpArrive, 0); + if ((play->sceneId == SCENE_LAKE_HYLIA) && IS_CUTSCENE_LAYER) { - this->av1.actionVar1 = 1; + this->av1.isLakeHyliaCs = true; } + this->stateFlags1 |= PLAYER_STATE1_29; LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, 0.0f); + + // Start high up in the air this->actor.world.pos.y += 800.0f; } -static u8 D_808546F0[] = { ITEM_SWORD_MASTER, ITEM_SWORD_KOKIRI }; - -void func_80846720(PlayState* play, Player* this, s32 arg2) { - s32 item = D_808546F0[(void)0, gSaveContext.save.linkAge]; - s32 itemAction = sItemActions[item]; +/** + * Put the sword item in hand. If `playSfx` is true, the sword unsheathing sound will play. + * Kokiri Sword or Master Sword is used depending on age. + * + * Note: This will not play an animation, the sword instantly appears in hand. + * It is expected that this function is called while an appropriate animation + * is already playing, for example in a cutscene. + */ +void Player_PutSwordInHand(PlayState* play, Player* this, s32 playSfx) { + static u8 sSwordItemIds[] = { ITEM_SWORD_MASTER, ITEM_SWORD_KOKIRI }; + s32 swordItemId = sSwordItemIds[(void)0, gSaveContext.save.linkAge]; + s32 swordItemAction = sItemActions[swordItemId]; Player_DestroyHookshot(this); Player_DetachHeldActor(play, this); - this->heldItemId = item; - this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); + this->heldItemId = swordItemId; + this->nextModelGroup = Player_ActionToModelGroup(this, swordItemAction); - Player_InitItemAction(play, this, itemAction); + Player_InitItemAction(play, this, swordItemAction); func_80834644(play, this); - if (arg2 != 0) { + if (playSfx) { Player_PlaySfx(this, NA_SE_IT_SWORD_PICKOUT); } } -static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; +void Player_StartMode_TimeTravel(PlayState* play, Player* this) { + static Vec3f sPedestalPos = { -1.0f, 69.0f, 20.0f }; -void func_808467D4(PlayState* play, Player* this) { - Player_SetupAction(play, this, Player_Action_8084E9AC, 0); + Player_SetupAction(play, this, Player_Action_TimeTravelEnd, 0); this->stateFlags1 |= PLAYER_STATE1_29; - Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); + + Math_Vec3f_Copy(&this->actor.world.pos, &sPedestalPos); this->yaw = this->actor.shape.rot.y = -0x8000; - LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, - 0.0f); + + // The start frame and end frame are both set to 0 so that that the animation is frozen. + // `Player_Action_TimeTravelEnd` will play the animation after `animDelayTimer` completes. + LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->timeTravelEndAnim, 2.0f / 3.0f, 0.0f, 0.0f, + ANIMMODE_ONCE, 0.0f); Player_StartAnimMovement(play, this, PLAYER_ANIM_MOVEMENT_RESET_BY_AGE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_ENABLE_MOVEMENT | ANIM_FLAG_OVERRIDE_MOVEMENT); + if (LINK_IS_ADULT) { - func_80846720(play, this, 0); + Player_PutSwordInHand(play, this, false); } - this->av2.actionVar2 = 20; + + this->av2.animDelayTimer = 20; } -void func_808468A8(PlayState* play, Player* this) { - Player_SetupAction(play, this, Player_Action_8084F9A0, 0); +void Player_StartMode_Door(PlayState* play, Player* this) { + Player_SetupAction(play, this, Player_Action_TryOpeningDoor, 0); Player_StartAnimMovement(play, this, ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_ENABLE_MOVEMENT | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT); } -void func_808468E8(PlayState* play, Player* this) { +void Player_StartMode_Grotto(PlayState* play, Player* this) { func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); - Player_SetupAction(play, this, Player_Action_8084F9C0, 0); + Player_SetupAction(play, this, Player_Action_ExitGrotto, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->fallStartHeight = this->actor.world.pos.y; OnePointCutscene_Init(play, 5110, 40, &this->actor, CAM_ID_MAIN); } -void func_80846978(PlayState* play, Player* this) { +void Player_StartMode_KnockedOver(PlayState* play, Player* this) { func_80837C0C(play, this, PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } -void func_808469BC(PlayState* play, Player* this) { - Player_SetupAction(play, this, Player_Action_8084F698, 0); - this->actor.draw = NULL; +void Player_StartMode_WarpSong(PlayState* play, Player* this) { + Player_SetupAction(play, this, Player_Action_StartWarpSongArrive, 0); + this->actor.draw = NULL; // Start invisible this->stateFlags1 |= PLAYER_STATE1_29; } @@ -10596,9 +10604,9 @@ Actor* Player_SpawnMagicSpell(PlayState* play, Player* this, s32 spell) { this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } -void func_80846A68(PlayState* play, Player* this) { - this->actor.draw = NULL; - Player_SetupAction(play, this, Player_Action_8085076C, 0); +void Player_StartMode_FaroresWind(PlayState* play, Player* this) { + this->actor.draw = NULL; // Start invisible + Player_SetupAction(play, this, Player_Action_FaroresWindArrive, 0); this->stateFlags1 |= PLAYER_STATE1_29; } @@ -10641,27 +10649,25 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe Collider_SetQuad(play, &this->shieldQuad, &this->actor, &D_808546A0); } -static void (*D_80854738[])(PlayState* play, Player* this) = { - /* 0x0 */ func_80846648, - /* 0x1 */ func_808467D4, // From time travel - /* 0x2 */ func_80846660, - /* 0x3 */ func_808468A8, - /* 0x4 */ func_808468E8, - /* 0x5 */ func_808469BC, - /* 0x6 */ func_80846A68, - /* 0x7 */ func_80846978, - /* 0x8 */ func_8083CA54, - /* 0x9 */ func_8083CA54, - /* 0xA */ func_8083CA54, - /* 0xB */ func_8083CA54, - /* 0xC */ func_8083CA54, - /* 0xD */ func_8083CA20, - /* 0xE */ func_8083CA54, - /* 0xF */ func_8083CA9C, +static void (*sStartModeFuncs[PLAYER_START_MODE_MAX])(PlayState* play, Player* this) = { + Player_StartMode_Nothing, // PLAYER_START_MODE_NOTHING + Player_StartMode_TimeTravel, // PLAYER_START_MODE_TIME_TRAVEL + Player_StartMode_BlueWarp, // PLAYER_START_MODE_BLUE_WARP + Player_StartMode_Door, // PLAYER_START_MODE_DOOR + Player_StartMode_Grotto, // PLAYER_START_MODE_GROTTO + Player_StartMode_WarpSong, // PLAYER_START_MODE_WARP_SONG + Player_StartMode_FaroresWind, // PLAYER_START_MODE_FARORES_WIND + Player_StartMode_KnockedOver, // PLAYER_START_MODE_KNOCKED_OVER + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_8 + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_9 + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_10 + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_11 + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_12 + Player_StartMode_Idle, // PLAYER_START_MODE_IDLE + Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_MOVE_FORWARD_SLOW + Player_StartMode_MoveForward, // PLAYER_START_MODE_MOVE_FORWARD }; -static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; - /** * Iterates in the get item table to get the largest GI object size */ @@ -10689,7 +10695,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; SceneTableEntry* scene = play->loadedScene; u32 titleFileSize; - s32 initMode; + s32 startMode; s32 respawnFlag; s32 respawnMode; @@ -10711,22 +10717,25 @@ void Player_Init(Actor* thisx, PlayState* play2) { this->heldItemId = ITEM_NONE; Player_UseItem(play, this, ITEM_NONE); + Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; + Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.save.linkAge)]); u32 giAllocSize = Player_GetGIAllocSize(); - if (ENABLE_AUTO_GI_ALLOC) { - this->giObjectSegment = (void*)ALIGN16((uintptr_t)ZELDA_ARENA_MALLOC(giAllocSize, __FILE__, __LINE__)); - } else { - ASSERT(giAllocSize < GI_ALLOC_SIZE, "[HackerOoT:ERROR]: GI Object larger than the allocated size.", __FILE__, - __LINE__); - // `giObjectSegment` is used for both "get item" objects and title cards. The maximum size for - // get item objects is 0x2000 (see the assert in func_8083AE40), and the maximum size for - // title cards is 0x1000 * LANGUAGE_MAX since each title card image includes all languages. - this->giObjectSegment = - (void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x1000 * LANGUAGE_MAX + 8, "../z_player.c", 17175) + 8) & ~0xF); - } + +#if ENABLE_AUTO_GI_ALLOC + this->giObjectSegment = (void*)ALIGN16((uintptr_t)ZELDA_ARENA_MALLOC(giAllocSize, __FILE__, __LINE__)); +#else + ASSERT(giAllocSize < GI_ALLOC_SIZE, "[HackerOoT:ERROR]: GI Object larger than the allocated size.", __FILE__, + __LINE__); + // `giObjectSegment` is used for both "get item" objects and title cards. The maximum size for + // get item objects is 0x2000 (see the assert in func_8083AE40), and the maximum size for + // title cards is 0x1000 * LANGUAGE_MAX since each title card image includes all languages. + this->giObjectSegment = + (void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x1000 * LANGUAGE_MAX + 8, "../z_player.c", 17175) + 8) & ~0xF); +#endif respawnFlag = gSaveContext.respawnFlag; @@ -10757,6 +10766,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { if ((respawnFlag == 0) || (respawnFlag < -1)) { titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart; + if ((titleFileSize != 0) && gSaveContext.showTitleCard) { if (!IS_CUTSCENE_LAYER && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].field & @@ -10771,6 +10781,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { TitleCard_InitPlaceName(play, &play->actorCtx.titleCtx, this->giObjectSegment, 160, 120, 144, 24, 20); } } + gSaveContext.showTitleCard = true; } @@ -10784,18 +10795,22 @@ void Player_Init(Actor* thisx, PlayState* play2) { gSaveContext.save.info.infTable[INFTABLE_1AX_INDEX] |= gBitFlags[play->sceneId]; } - initMode = PARAMS_GET_S(thisx->params, 8, 4); - if ((initMode == 5) || (initMode == 6)) { + startMode = PLAYER_GET_START_MODE(thisx); + + if ((startMode == PLAYER_START_MODE_WARP_SONG) || (startMode == PLAYER_START_MODE_FARORES_WIND)) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { - initMode = 13; + startMode = PLAYER_START_MODE_IDLE; } } - D_80854738[initMode](play, this); + sStartModeFuncs[startMode](play, this); - if (initMode != 0) { + if (startMode != PLAYER_START_MODE_NOTHING) { if ((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) { - this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); + static Vec3f sNaviSpawnPosOffset = { 0.0f, 50.0f, 0.0f }; + + this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &sNaviSpawnPosOffset, FAIRY_NAVI); + if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; } @@ -10960,14 +10975,14 @@ void Player_UpdateInterface(PlayState* play, Player* this) { doAction = sDiveNumberDoActions[sp24]; } else if (sp1C && !(this->stateFlags2 & PLAYER_STATE2_10)) { doAction = DO_ACTION_DIVE; - } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_22) || Player_IsZTargeting(this) || + } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || Player_IsZTargeting(this) || !Player_IsChildWithHylianShield(this))) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) && (Player_CheckHostileLockOn(this) || ((sFloorType != FLOOR_TYPE_7) && (Player_FriendlyLockOnOrParallel(this) || ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && - !(this->stateFlags1 & PLAYER_STATE1_22) && + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (controlStickDirection == PLAYER_STICK_DIR_FORWARD))))))) { doAction = DO_ACTION_ATTACK; } else if ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && Player_IsZTargeting(this) && @@ -11996,8 +12011,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_21); } - this->stateFlags1 &= - ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_22); + this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | + PLAYER_STATE1_SHIELDING); this->stateFlags2 &= ~(PLAYER_STATE2_0 | PLAYER_STATE2_2 | PLAYER_STATE2_3 | PLAYER_STATE2_5 | PLAYER_STATE2_6 | PLAYER_STATE2_8 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_12 | PLAYER_STATE2_14 | PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_22 | PLAYER_STATE2_26); @@ -12078,7 +12093,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->cylinder.dim.yShift = phi_f12 - this->actor.world.pos.y; - if (this->stateFlags1 & PLAYER_STATE1_22) { + if (this->stateFlags1 & PLAYER_STATE1_SHIELDING) { this->cylinder.dim.height *= 0.8f; } @@ -12123,7 +12138,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Collider_ResetQuadAT(play, &this->shieldQuad.base); } -#if IS_DEBUG +#if IS_NO_CLIP_ENABLED s32 Player_UpdateNoclip(Player* this, PlayState* play); #endif @@ -12133,7 +12148,7 @@ void Player_Update(Actor* thisx, PlayState* play) { s32 pad; Input input; -#if IS_DEBUG +#if IS_NO_CLIP_ENABLED if (!Player_UpdateNoclip(this, play)) { goto skip_update; } @@ -12183,7 +12198,9 @@ void Player_Update(Actor* thisx, PlayState* play) { Player_UpdateCommon(this, play, &input); +#if DEBUG_FEATURES skip_update:; +#endif { s32 pad; @@ -12734,7 +12751,7 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { Player_PlayVoiceSfx(this, NA_SE_VO_LI_PUSH); } - if (!IS_DEBUG) {} + if (!DEBUG_FEATURES) {} } else { Player_ProcessAnimSfxList(this, D_80854878); } @@ -13861,8 +13878,10 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); play->mainCamera.stateFlags &= ~CAM_STATE_EXTERNAL_FINISHED; + // Setting these flags again is necessary because `Player_TryCsAction` calls + // `Player_SetupAction` which unsets the flags. this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - this->stateFlags2 |= PLAYER_STATE2_27; + this->stateFlags2 |= PLAYER_STATE2_USING_OCARINA; if (Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_OUT) == NULL) { @@ -13965,26 +13984,22 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { } } -static AnimSfxEntry D_808549F0[] = { - { NA_SE_IT_MASTER_SWORD_SWING, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) }, -}; - void func_8084E988(Player* this) { + static AnimSfxEntry D_808549F0[] = { + { NA_SE_IT_MASTER_SWORD_SWING, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) }, + }; + Player_ProcessAnimSfxList(this, D_808549F0); } -#if OOT_VERSION >= PAL_1_0 -static AnimSfxEntry D_808549F4[] = { - { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 5) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 15) }, -}; -#endif - -void Player_Action_8084E9AC(Player* this, PlayState* play) { +void Player_Action_TimeTravelEnd(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->av1.actionVar1 == 0) { - if (DECR(this->av2.actionVar2) == 0) { - this->av1.actionVar1 = 1; + if (!this->av1.startedAnim) { + if (DECR(this->av2.animDelayTimer) == 0) { + this->av1.startedAnim = true; + + // endFrame was previously set to 0 to freeze the animation. + // Set it properly to allow the animation to play. this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -13998,13 +14013,20 @@ void Player_Action_8084E9AC(Player* this, PlayState* play) { #if OOT_VERSION < PAL_1_0 if (!LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 5.0f)) { + // There is a jump sound when leaving the pedestal, but no landing sound when hitting the floor. + // This is fixed in PAL 1.0 and above. Player_PlayVoiceSfx(this, NA_SE_VO_LI_AUTO_JUMP); } else if (LINK_IS_ADULT) { func_8084E988(this); } #else if (!LINK_IS_ADULT) { - Player_ProcessAnimSfxList(this, D_808549F4); + static AnimSfxEntry sJumpOffPedestalAnimSfxList[] = { + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 5) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 15) }, + }; + + Player_ProcessAnimSfxList(this, sJumpOffPedestalAnimSfxList); } else { func_8084E988(this); } @@ -14307,17 +14329,17 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) { shapeYawTarget = downwardSlopeYaw + 0x8000; } - if (this->speedXZ < 0) { + if (this->speedXZ < 0.0f) { downwardSlopeYaw += 0x8000; } xzSpeedTarget = (1.0f - slopeNormal.y) * 40.0f; - xzSpeedTarget = CLAMP(xzSpeedTarget, 0, 10.0f); + xzSpeedTarget = CLAMP(xzSpeedTarget, 0.0f, 10.0f); xzSpeedIncrStep = SQ(xzSpeedTarget) * 0.015f; xzSpeedDecrStep = slopeNormal.y * 0.01f; if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1) { - xzSpeedTarget = 0; + xzSpeedTarget = 0.0f; xzSpeedDecrStep = slopeNormal.y * 10.0f; } @@ -14325,7 +14347,8 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) { xzSpeedIncrStep = 1.0f; } - if (Math_AsymStepToF(&this->speedXZ, xzSpeedTarget, xzSpeedIncrStep, xzSpeedDecrStep) && (xzSpeedTarget == 0)) { + if (Math_AsymStepToF(&this->speedXZ, xzSpeedTarget, xzSpeedIncrStep, xzSpeedDecrStep) && + (xzSpeedTarget == 0.0f)) { LinkAnimationHeader* slideAnimation; if (!this->av1.facingUpSlope) { @@ -14341,41 +14364,54 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) { } } -void Player_Action_8084F608(Player* this, PlayState* play) { - if ((DECR(this->av2.actionVar2) == 0) && Player_StartCsAction(play, this)) { +/** + * Waits to start processing a Cutscene Action. + * First, the timer `csDelayTimer` much reach 0. + * Then, there must be a CS action available to start processing. + * + * When starting the cutscene action, `draw` will be set to make + * Player appear, if he was invisible. + */ +void Player_Action_WaitForCutscene(Player* this, PlayState* play) { + if ((DECR(this->av2.csDelayTimer) == 0) && Player_StartCsAction(play, this)) { func_80852280(play, this, NULL); Player_SetupAction(play, this, Player_Action_CsAction, 0); Player_Action_CsAction(this, play); } } -void Player_Action_8084F698(Player* this, PlayState* play) { - Player_SetupAction(play, this, Player_Action_8084F608, 0); - this->av2.actionVar2 = 40; +void Player_Action_StartWarpSongArrive(Player* this, PlayState* play) { + Player_SetupAction(play, this, Player_Action_WaitForCutscene, 0); + this->av2.csDelayTimer = 40; + + // Note: The warp song sparkles actor is responsible for starting the warp-in cutscene script Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_IN); } -void Player_Action_8084F710(Player* this, PlayState* play) { +void Player_Action_BlueWarpArrive(Player* this, PlayState* play) { s32 pad; - if ((this->av1.actionVar1 != 0) && (play->csCtx.curFrame < 305)) { + if ((this->av1.isLakeHyliaCs) && (play->csCtx.curFrame < 305)) { + // Delay falling down until frame 306 of the Lake Hylia cutscene after completing Water Temple this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (sYDistToFloor < 150.0f) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->av2.actionVar2 == 0) { + if (!this->av2.playedLandingSfx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; Player_PlayLandingSfx(this); - this->av2.actionVar2 = 1; + this->av2.playedLandingSfx = true; } } else { if ((play->sceneId == SCENE_KOKIRI_FOREST) && Player_StartCsAction(play, this)) { return; } + func_80853080(this, play); } } + Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.3f, 8.0f, 0.5f); } @@ -14384,9 +14420,10 @@ void Player_Action_8084F710(Player* this, PlayState* play) { } if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.playerCue != NULL)) { - f32 sp28 = this->actor.world.pos.y; + f32 savedYPos = this->actor.world.pos.y; + func_808529D0(play, this, play->csCtx.playerCue); - this->actor.world.pos.y = sp28; + this->actor.world.pos.y = savedYPos; } } @@ -14418,11 +14455,15 @@ void Player_Action_8084F88C(Player* this, PlayState* play) { } } -void Player_Action_8084F9A0(Player* this, PlayState* play) { +/** + * Automatically open a door (no need for the A button). + * Note: If no door is in useable range, a softlock will occur. + */ +void Player_Action_TryOpeningDoor(Player* this, PlayState* play) { Player_ActionHandler_1(this, play); } -void Player_Action_8084F9C0(Player* this, PlayState* play) { +void Player_Action_ExitGrotto(Player* this, PlayState* play) { this->actor.gravity = -1.0f; LinkAnimation_Update(play, &this->skelAnime); @@ -14491,7 +14532,7 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { Actor_PlaySfx_Flagged2(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } -#if IS_DEBUG +#if IS_NO_CLIP_ENABLED /** * Updates the "Noclip" debug feature, which allows the player to fly around anywhere * in the world and clip through any collision. @@ -14514,152 +14555,149 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { */ s32 Player_UpdateNoclip(Player* this, PlayState* play) { static s32 cameraMode = 0; - if (ENABLE_NO_CLIP) { - sControlInput = &play->state.input[0]; - if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_L | BTN_R | BTN_A) && - CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || - (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && - CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) { + sControlInput = &play->state.input[0]; - sNoclipEnabled ^= 1; - cameraMode = 0; - } + if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_L | BTN_R | BTN_A) && + CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || + (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) { - if (sNoclipEnabled) { - Camera* cam = GET_ACTIVE_CAM(play); - f32 speed; - s32 mod = 0; - f32 yvel = 0.0f; + sNoclipEnabled ^= 1; + cameraMode = 0; + } - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { - speed = 100.0f; - } else { - speed = 20.0f; - } + if (sNoclipEnabled) { + Camera* cam = GET_ACTIVE_CAM(play); + f32 speed; + s32 mod = 0; + f32 yvel = 0.0f; - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { - cameraMode ^= 1; - } + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { + speed = 100.0f; + } else { + speed = 20.0f; + } - if (cameraMode == 0) { - if (cam->mode != CAM_MODE_Z_PARALLEL) { - Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_PARALLEL); - } + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { + cameraMode ^= 1; + } - } else { - if (cam->mode != CAM_MODE_NORMAL) { - Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); - } + if (cameraMode == 0) { + if (cam->mode != CAM_MODE_Z_PARALLEL) { + Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_PARALLEL); } - if (cameraMode == 1) { - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CRIGHT)) { - cam->eye.x += - Math_SinS(Camera_GetCamDirYaw(cam) + 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; - cam->eye.z += - Math_CosS(Camera_GetCamDirYaw(cam) + 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; - cam->eyeNext = cam->eye; - mod = true; - } - - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CLEFT)) { - cam->eye.x += - Math_SinS(Camera_GetCamDirYaw(cam) - 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; - cam->eye.z += - Math_CosS(Camera_GetCamDirYaw(cam) - 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; - cam->eyeNext = cam->eye; - mod = true; - } - } else { - Parallel1* parallel = &cam->paramData.para1; + } else { + if (cam->mode != CAM_MODE_NORMAL) { + Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_NORMAL); + } + } - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CRIGHT)) { - parallel->rwData.yawTarget -= DEG_TO_BINANG(7); - mod = true; - } + if (cameraMode == 1) { + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CRIGHT)) { + cam->eye.x += + Math_SinS(Camera_GetCamDirYaw(cam) + 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; + cam->eye.z += + Math_CosS(Camera_GetCamDirYaw(cam) + 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; + cam->eyeNext = cam->eye; + mod = true; + } - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CLEFT)) { - parallel->rwData.yawTarget += DEG_TO_BINANG(7); - mod = true; - } + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CLEFT)) { + cam->eye.x += + Math_SinS(Camera_GetCamDirYaw(cam) - 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; + cam->eye.z += + Math_CosS(Camera_GetCamDirYaw(cam) - 0x3FFF) * Math_Vec3f_DistXYZ(&cam->eye, &cam->at) * 0.15f; + cam->eyeNext = cam->eye; + mod = true; } + } else { + Parallel1* parallel = &cam->paramData.para1; - if (mod) { - this->actor.shape.rot.y = Camera_GetCamDirYaw(cam); + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CRIGHT)) { + parallel->rwData.yawTarget -= DEG_TO_BINANG(7); + mod = true; } - DebugCamera_ScreenText(3, 2, "DEBUG MODE"); + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CLEFT)) { + parallel->rwData.yawTarget += DEG_TO_BINANG(7); + mod = true; + } + } - if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) { + if (mod) { + this->actor.shape.rot.y = Camera_GetCamDirYaw(cam); + } - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - yvel = 1.0f; - } + DebugCamera_ScreenText(3, 2, "DEBUG MODE"); - else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { - yvel = -1.0f; - } + if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) { - OSContPad* ctrl = &play->state.input[0].cur; - Vec3f zero = { 0.0f, 0.0f, 0.0f }; - Vec3f conpos = { - .x = -((f32)ctrl->stick_x / 128), - .y = 0.0f, - .z = (f32)ctrl->stick_y / 128, - }; - s16 angle; - f32 speedC = Math_Vec3f_DistXZ(&zero, &conpos); + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { + yvel = 1.0f; + } - if (speedC <= 0.1f) { - speedC = 0.0f; - } + else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { + yvel = -1.0f; + } - angle = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT)) { + OSContPad* ctrl = &play->state.input[0].cur; + Vec3f zero = { 0.0f, 0.0f, 0.0f }; + Vec3f conpos = { + .x = -((f32)ctrl->stick_x / 128), + .y = 0.0f, + .z = (f32)ctrl->stick_y / 128, + }; + s16 angle; + f32 speedC = Math_Vec3f_DistXZ(&zero, &conpos); - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP)) { - conpos.z = 1.0f; - } + if (speedC <= 0.1f) { + speedC = 0.0f; + } - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DDOWN)) { - conpos.z = -1.0f; - } + angle = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT)) { - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DLEFT)) { - conpos.x = 1.0f; - } + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP)) { + conpos.z = 1.0f; + } - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DRIGHT)) { - conpos.x = -1.0f; - } + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DDOWN)) { + conpos.z = -1.0f; + } - speedC = 1.0f; + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DLEFT)) { + conpos.x = 1.0f; } - angle += Math_Vec3f_Yaw(&zero, &conpos); + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DRIGHT)) { + conpos.x = -1.0f; + } - this->actor.world.pos.x += speed * Math_SinS(angle) * speedC; - this->actor.world.pos.z += speed * Math_CosS(angle) * speedC; - this->actor.world.pos.y += speed * yvel * 0.5f; + speedC = 1.0f; } - Player_ZeroSpeedXZ(this); + angle += Math_Vec3f_Yaw(&zero, &conpos); - this->actor.gravity = 0.0f; - this->actor.velocity.z = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.velocity.x = 0.0f; + this->actor.world.pos.x += speed * Math_SinS(angle) * speedC; + this->actor.world.pos.z += speed * Math_CosS(angle) * speedC; + this->actor.world.pos.y += speed * yvel * 0.5f; + } - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && - CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { - Flags_SetTempClear(play, play->roomCtx.curRoom.num); - } + Player_ZeroSpeedXZ(this); - Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); + this->actor.gravity = 0.0f; + this->actor.velocity.z = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.velocity.x = 0.0f; - return false; + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { + Flags_SetTempClear(play, play->roomCtx.curRoom.num); } + + Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); + + return false; } return true; @@ -14863,17 +14901,17 @@ void Player_Action_8085063C(Player* this, PlayState* play) { } } -void Player_Action_8085076C(Player* this, PlayState* play) { +void Player_Action_FaroresWindArrive(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; - if (this->av2.actionVar2 > 20) { + if (this->av2.appearTimer > 20) { this->actor.draw = Player_Draw; this->actor.world.pos.y += 60.0f; func_80837B9C(this, play); return; } - if (this->av2.actionVar2++ == 20) { + if (this->av2.appearTimer++ == 20) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = respawnData + 1; Sfx_PlaySfxAtPos(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_WARP); } @@ -14988,7 +15026,7 @@ void Player_Action_808507F4(Player* this, PlayState* play) { Player_DecelerateToZero(this); } -void Player_Action_80850AEC(Player* this, PlayState* play) { +void Player_Action_HookshotFly(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -15605,12 +15643,12 @@ static LinkAnimationHeader* D_80855190[] = { &gPlayerAnim_clink_demo_goto_future, }; -static Vec3f D_80855198 = { -1.0f, 70.0f, 20.0f }; - void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue) { - Math_Vec3f_Copy(&this->actor.world.pos, &D_80855198); + static Vec3f sPedestalPos = { -1.0f, 70.0f, 20.0f }; + + Math_Vec3f_Copy(&this->actor.world.pos, &sPedestalPos); this->actor.shape.rot.y = -0x8000; - Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C); + Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->timeTravelStartAnim); Player_StartAnimMovement(play, this, PLAYER_ANIM_MOVEMENT_RESET_BY_AGE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_ENABLE_MOVEMENT | @@ -15711,7 +15749,7 @@ void func_80851D80(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 6.0f)) { - func_80846720(play, this, 0); + Player_PutSwordInHand(play, this, false); } else { Player_ProcessAnimSfxList(this, D_808551B8); } @@ -15867,7 +15905,7 @@ void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue) { this->av2.actionVar2 = 1; } else if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { - func_80846720(play, this, 1); + Player_PutSwordInHand(play, this, true); } } } @@ -15969,7 +16007,7 @@ void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue) { } void func_80852608(PlayState* play, Player* this, CsCmdActorCue* cue) { - func_80846720(play, this, 0); + Player_PutSwordInHand(play, this, false); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_return_to_past); } @@ -16029,7 +16067,7 @@ void func_8085283C(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80852944(play, this, cue); } else if (this->av2.actionVar2 == 0) { Item_Give(play, ITEM_SWORD_MASTER); - func_80846720(play, this, 0); + Player_PutSwordInHand(play, this, false); } else { func_8084E988(this); } @@ -16041,7 +16079,7 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorCue* cue) { } if (this->heldItemAction != PLAYER_IA_SWORD_MASTER) { - func_80846720(play, this, 1); + Player_PutSwordInHand(play, this, true); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 5351e864ab..4a2d5a584c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -5,6 +5,7 @@ */ #include "z_eff_ss_en_ice.h" +#include "versions.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rLifespan regs[0] @@ -133,9 +134,9 @@ void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { } void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { - s16 rand; - +#if OOT_VERSION >= NTSC_1_1 if ((this->actor != NULL) && (this->actor->update != NULL)) { +#endif if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && !(this->actor->colorFilterParams & 0xC000)) { this->pos.x = this->actor->world.pos.x + this->vec.x; this->pos.y = this->actor->world.pos.y + this->vec.y; @@ -147,9 +148,11 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { this->accel.y = -1.5f; this->velocity.y = 5.0f; } +#if OOT_VERSION >= NTSC_1_1 } else { if (this->life >= 9) { - rand = Rand_CenteredFloat(65535.0f); + s16 rand = Rand_CenteredFloat(65535.0f); + this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f); this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f); this->life = 8; @@ -157,6 +160,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { this->velocity.y = 5.0f; } } +#endif } void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { 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 f3ccd4572a..a839900ec9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -5,6 +5,7 @@ */ #include "z_eff_ss_kakera.h" +#include "versions.h" #define rReg0 regs[0] #define rGravity regs[1] @@ -54,7 +55,11 @@ u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initPa } else { PRINTF("shape_modelがNULL\n"); +#if OOT_VERSION < NTSC_1_1 + LogUtils_HungupThread("../z_eff_kakera.c", 175); +#else LogUtils_HungupThread("../z_eff_kakera.c", 178); +#endif } this->draw = EffectSsKakera_Draw; @@ -78,7 +83,7 @@ u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initPa f32 func_809A9818(f32 arg0, f32 arg1) { f32 temp_f2; -#if IS_DEBUG +#if DEBUG_FEATURES if (arg1 < 0.0f) { PRINTF("範囲がマイナス!!(randomD_sectionUniformity)\n"); } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 7e4f1cde9b..d922733344 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -163,7 +163,7 @@ void FileSelect_DrawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 center s32 pad; s32 i; - OPEN_DISPS(gfxCtx, "../z_file_choose.c", 0); + OPEN_DISPS(gfxCtx, "../z_file_choose.c", UNK_LINE); Gfx_SetupDL_56Opa(gfxCtx); @@ -210,7 +210,7 @@ void FileSelect_DrawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 center } } - CLOSE_DISPS(gfxCtx, "../z_file_choose.c", 0); + CLOSE_DISPS(gfxCtx, "../z_file_choose.c", UNK_LINE); } void FileSelect_DrawInitialLanguageMenu(FileSelectState* this) { @@ -219,7 +219,7 @@ void FileSelect_DrawInitialLanguageMenu(FileSelectState* this) { s32 y1; s32 y2; - OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 0); + OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", UNK_LINE); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 70 + WREG(0)); FileSelect_DrawImageRGBA32(this->state.gfxCtx, 160, 85 + WREG(1), (u8*)gTitleZeldaShieldLogoTex, 160, 160); @@ -294,7 +294,7 @@ void FileSelect_DrawInitialLanguageMenu(FileSelectState* this) { y1 = y2; } - CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", 0); + CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", UNK_LINE); } #endif @@ -717,7 +717,7 @@ void FileSelect_PulsateCursor(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; Input* debugInput = &this->state.input[2]; -#if IS_DEBUG +#if OOT_PAL && DEBUG_FEATURES if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) { sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG; *((u8*)0x80000002) = LANGUAGE_ENG; @@ -1855,14 +1855,17 @@ void FileSelect_FadeOut(GameState* thisx) { void FileSelect_LoadGame(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; - if (MAP_SELECT_ON_FILE_1 && this->buttonIndex == FS_BTN_SELECT_FILE_1) { +#if MAP_SELECT_ON_FILE_1 + if (this->buttonIndex == FS_BTN_SELECT_FILE_1) { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.fileNum = this->buttonIndex; Sram_OpenSave(&this->sramCtx); SET_NEXT_GAMESTATE(&this->state, MapSelect_Init, MapSelectState); this->state.running = false; - } else { + } else +#endif + { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.fileNum = this->buttonIndex; @@ -2337,8 +2340,8 @@ void FileSelect_Init(GameState* thisx) { #if OOT_PAL_N64 size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart; - this->objectMagSegment = GAME_STATE_ALLOC(&this->state, size, "../z_file_choose.c", 0); - DMA_REQUEST_SYNC(this->objectMagSegment, gObjectTable[OBJECT_MAG].vromStart, size, "../z_file_choose.c", 0); + this->objectMagSegment = GAME_STATE_ALLOC(&this->state, size, "../z_file_choose.c", UNK_LINE); + DMA_REQUEST_SYNC(this->objectMagSegment, gObjectTable[OBJECT_MAG].vromStart, size, "../z_file_choose.c", UNK_LINE); #endif Matrix_Init(&this->state); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index c800fda301..f148c1d78b 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -16,7 +16,7 @@ void FileSelect_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx) { #if OOT_NTSC void FileSelect_DrawCharacterTransition(GraphicsContext* gfxCtx, void* texture1, void* texture2, s16 vtx) { - OPEN_DISPS(gfxCtx, "", 0); + OPEN_DISPS(gfxCtx, "../z_file_nameset_PAL.c", UNK_LINE); gDPLoadTextureBlock_4b(POLY_OPA_DISP++, texture1, G_IM_FMT_I, 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); @@ -24,7 +24,7 @@ void FileSelect_DrawCharacterTransition(GraphicsContext* gfxCtx, void* texture1, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); - CLOSE_DISPS(gfxCtx, "", 0); + CLOSE_DISPS(gfxCtx, "../z_file_nameset_PAL.c", UNK_LINE); } #endif @@ -64,7 +64,7 @@ void FileSelect_SetKeyboardVtx(GameState* thisx) { phi_s1 = 0x26; #if OOT_NTSC - for (phi_t2 = 0, phi_s2 = 0, phi_t3 = 0; phi_s2 < 5; phi_s2++) { + for (phi_s2 = 0, phi_t3 = 0; phi_s2 < 5; phi_s2++) { for (phi_t0 = -0x60, phi_t1 = 0; phi_t1 < 13; phi_t1++, phi_t3 += 4) { this->keyboardVtx[phi_t3].v.ob[0] = this->keyboardVtx[phi_t3 + 2].v.ob[0] = phi_t0; this->keyboardVtx[phi_t3 + 1].v.ob[0] = this->keyboardVtx[phi_t3 + 3].v.ob[0] = phi_t0 + 12; @@ -1747,13 +1747,21 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } +#ifndef AVOID_UB //! @bug Mistakenly using sOptionsMenuHeaders instead of sOptionsMenuSettings for the height. //! This is also an OOB read that happens to access the height of the first two elements in //! sOptionsMenuSettings, and since all heights are 16, it works out anyway. +#define sOptionsMenuSettingsBug sOptionsMenuHeaders +#else + // Avoid UB: Use the correct array for the heights to avoid reading out of bounds memory that may not + // happen to work out nicely. +#define sOptionsMenuSettingsBug sOptionsMenuSettings +#endif gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, OPTIONS_MENU_TEXTURE_WIDTH(sOptionsMenuSettings[i]), - OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP, + OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuSettingsBug[i]), 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); +#undef sOptionsMenuSettingsBug gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); } #else @@ -1786,10 +1794,21 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } +#ifndef AVOID_UB + //! @bug Mistakenly using sOptionsMenuHeaders instead of sOptionsMenuSettings for the height. + //! This is also an OOB read that happens to access the height of up to the first three elements + //! in sOptionsMenuSettings, and since all heights are 16, it works out anyway. +#define sOptionsMenuSettingsBug sOptionsMenuHeaders +#else + // Avoid UB: Use the correct array for the heights to avoid reading out of bounds memory that may not + // happen to work out nicely. +#define sOptionsMenuSettingsBug sOptionsMenuSettings +#endif gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, sZTargetSettingWidths[j][gSaveContext.language], - OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP, + OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuSettingsBug[i]), 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); +#undef sOptionsMenuSettingsBug gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0); } @@ -1877,7 +1896,7 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { #if OOT_PAL_N64 Matrix_Push(); Matrix_Translate(0.0f, 0.8f, 0.0f, MTXMODE_APPLY); - MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, this->state.gfxCtx, "../z_file_nameset_PAL.c", 0); + MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, this->state.gfxCtx, "../z_file_nameset_PAL.c", UNK_LINE); gSPVertex(POLY_OPA_DISP++, gOptionsDividerLanguageVtx, 4, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); Matrix_Pop(); diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h index 236c1ca3a9..9c1051759b 100644 --- a/src/overlays/gamestates/ovl_select/z_select.h +++ b/src/overlays/gamestates/ovl_select/z_select.h @@ -62,7 +62,7 @@ static const Color_RGBA8 sColors[] = { static SceneSelectEntry sScenes[] = { { "Title Screen", (void*)MapSelect_LoadTitle, 0 }, -#if INCLUDE_EXAMPLE_SCENE +#if CAN_INCLUDE_EXAMPLE_SCENE { "Example", MapSelect_LoadGame, ENTR_EXAMPLE_0 }, #endif { "Hyrule Field", MapSelect_LoadGame, ENTR_HYRULE_FIELD_0 }, @@ -192,6 +192,10 @@ static SceneSelectEntry sScenes[] = { { "Depth Test", MapSelect_LoadGame, ENTR_DEPTH_TEST_0 }, { "Hyrule Garden Game (Broken)", MapSelect_LoadGame, ENTR_HAIRAL_NIWA2_0 }, #endif +#if PLATFORM_N64 + { "64DD TEST n64dd_SetDiskVersion(1)", (void*)func_80800AD0_unknown, 0 }, + { "64DD TEST2 n64dd_SetDiskVersion(0)", (void*)func_80800B08_unknown, 0 }, +#endif }; static const s16 childLinkSfx[] = { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index dfeb16a3d3..edb24e29cd 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -15,7 +15,7 @@ #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" -#if IS_DEBUG +#if DEBUG_FEATURES void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { Gfx* gfx; GfxPrint* printer; @@ -164,7 +164,7 @@ void ConsoleLogo_Main(GameState* thisx) { ConsoleLogo_Calc(this); ConsoleLogo_Draw(this); -#if IS_DEBUG +#if DEBUG_FEATURES ConsoleLogo_PrintBuildInfo(&POLY_OPA_DISP); #endif diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index e49ad12687..651f4328b8 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -640,7 +640,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { } #endif -#if IS_DEBUG +#if DEBUG_FEATURES if (HREG(15) == 0) { gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index 2ef5079a44..c784ab0b4a 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -10,7 +10,8 @@ void KaleidoScope_UpdatePrompt(PlayState* play) { if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->savePromptState == PAUSE_SAVE_PROMPT_STATE_WAIT_CHOICE)) || - (pauseCtx->state == PAUSE_STATE_14) || (pauseCtx->state == PAUSE_STATE_16)) { + (pauseCtx->state == PAUSE_STATE_GAME_OVER_SAVE_PROMPT) || + (pauseCtx->state == PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT)) { if ((pauseCtx->promptChoice == 0) && (stickAdjX >= 30)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index e4b0654c2e..a34f324102 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -16,7 +16,7 @@ #include "terminal.h" #include "versions.h" -#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #if N64_BTN_COLORS #define KALEIDO_PROMPT_CURSOR_R 100 @@ -1075,8 +1075,10 @@ void KaleidoScope_SetupPageSwitch(PauseContext* pauseCtx, u8 pt) { } void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { - if (IS_INV_EDITOR_ENABLED && (pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { + if ((pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { +#if IS_INV_EDITOR_ENABLED pauseCtx->debugState = 1; +#endif return; } @@ -1551,7 +1553,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->savePromptState < PAUSE_SAVE_PROMPT_STATE_SAVED)) || - (pauseCtx->state == PAUSE_STATE_14)) { + (pauseCtx->state == PAUSE_STATE_GAME_OVER_SAVE_PROMPT)) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sSavePromptMessageTexs[gSaveContext.language], 152, 16, PROMPT_QUAD_MESSAGE * 4); @@ -1579,12 +1581,13 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { 16, PROMPT_QUAD_CHOICE_NO * 4); } else if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->savePromptState >= PAUSE_SAVE_PROMPT_STATE_SAVED)) || - pauseCtx->state == PAUSE_STATE_15) { + pauseCtx->state == PAUSE_STATE_GAME_OVER_SAVED) { #if PLATFORM_N64 POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sSaveConfirmationTexs[gSaveContext.language], 152, 16, PROMPT_QUAD_MESSAGE * 4); #endif - } else if (((pauseCtx->state == PAUSE_STATE_16) || (pauseCtx->state == PAUSE_STATE_17))) { + } else if (((pauseCtx->state == PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT) || + (pauseCtx->state == PAUSE_STATE_GAME_OVER_FINISH))) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, PROMPT_QUAD_MESSAGE * 4); @@ -1616,7 +1619,8 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - if ((pauseCtx->state != PAUSE_STATE_16) && (pauseCtx->state != PAUSE_STATE_17)) { + if ((pauseCtx->state != PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT) && + (pauseCtx->state != PAUSE_STATE_GAME_OVER_FINISH)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 0, pauseCtx->alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); } @@ -1879,7 +1883,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { ITEM_NAME_TEX_HEIGHT, 0); } -#if IS_DEBUG +#if DEBUG_FEATURES if (pauseCtx->pageIndex == PAUSE_MAP) { if (YREG(7) != 0) { PRINTF(VT_FGCOL(YELLOW)); @@ -2835,7 +2839,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { ((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && ((pauseCtx->savePromptState == PAUSE_SAVE_PROMPT_STATE_CLOSING) || (pauseCtx->savePromptState == PAUSE_SAVE_PROMPT_STATE_CLOSING_AFTER_SAVED))) || - ((pauseCtx->state >= PAUSE_STATE_8) && (pauseCtx->state <= PAUSE_STATE_13))) { + ((pauseCtx->state >= PAUSE_STATE_GAME_OVER_START) && (pauseCtx->state <= PAUSE_STATE_GAME_OVER_SHOW_WINDOW))) { // When opening/closing, translate the page vertices so that the pages rotate around their lower edge // instead of the middle. pauseCtx->pagesYOrigin1 = PAUSE_PAGES_Y_ORIGIN_1_LOWER; @@ -3326,7 +3330,7 @@ void KaleidoScope_DrawGameOver(PlayState* play) { CLOSE_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 3169); } -#if IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) +#if DEBUG_FEATURES && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) #define CAN_DRAW_PAUSE_MENU (pauseCtx->debugState == 0) #else #define CAN_DRAW_PAUSE_MENU true @@ -3368,11 +3372,11 @@ void KaleidoScope_Draw(PlayState* play) { } } - if ((pauseCtx->state >= PAUSE_STATE_11) && (pauseCtx->state <= PAUSE_STATE_17)) { + if ((pauseCtx->state >= PAUSE_STATE_GAME_OVER_SHOW_MESSAGE) && (pauseCtx->state <= PAUSE_STATE_GAME_OVER_FINISH)) { KaleidoScope_DrawGameOver(play); } - if (IS_DEBUG && + if (DEBUG_FEATURES && ((ENABLE_INV_EDITOR && (pauseCtx->debugState == 1)) || (ENABLE_EVENT_EDITOR && (pauseCtx->debugState == 2)))) { KaleidoScope_DrawDebugEditor(play); } @@ -3595,7 +3599,7 @@ void KaleidoScope_Update(PlayState* play) { if ((R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) && (((pauseCtx->state >= PAUSE_STATE_OPENING_1) && (pauseCtx->state <= PAUSE_STATE_SAVE_PROMPT)) || - ((pauseCtx->state >= PAUSE_STATE_10) && (pauseCtx->state <= PAUSE_STATE_CLOSING)))) { + ((pauseCtx->state >= PAUSE_STATE_GAME_OVER_INIT) && (pauseCtx->state <= PAUSE_STATE_CLOSING)))) { if ((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) && @@ -3710,12 +3714,12 @@ void KaleidoScope_Update(PlayState* play) { #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN) { size = (uintptr_t)_icon_item_jpn_staticSegmentRomEnd - (uintptr_t)_icon_item_jpn_staticSegmentRomStart; - DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, - size); + DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, size, + "../z_kaleido_scope_PAL.c", UNK_LINE); } else { size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart; - DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, - size); + DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, size, + "../z_kaleido_scope_PAL.c", UNK_LINE); } #else if (gSaveContext.language == LANGUAGE_ENG) { @@ -3746,17 +3750,17 @@ void KaleidoScope_Update(PlayState* play) { if (((void)0, gSaveContext.worldMapArea) < WORLD_MAP_AREA_MAX) { #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN) { - DmaMgr_RequestSync(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE), - (uintptr_t)_map_name_staticSegmentRomStart + - (((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) + - 24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_JPN * MAP_NAME_TEX2_SIZE, - MAP_NAME_TEX2_SIZE); + DMA_REQUEST_SYNC(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE), + (uintptr_t)_map_name_staticSegmentRomStart + + (((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) + + 24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_JPN * MAP_NAME_TEX2_SIZE, + MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", UNK_LINE); } else { - DmaMgr_RequestSync(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE), - (uintptr_t)_map_name_staticSegmentRomStart + - (((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) + - 24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_ENG * MAP_NAME_TEX2_SIZE, - MAP_NAME_TEX2_SIZE); + DMA_REQUEST_SYNC(pauseCtx->nameSegment + MAX(MAP_NAME_TEX1_SIZE, ITEM_NAME_TEX_SIZE), + (uintptr_t)_map_name_staticSegmentRomStart + + (((void)0, gSaveContext.worldMapArea) * MAP_NAME_TEX2_SIZE) + + 24 * MAP_NAME_TEX1_SIZE + 22 * LANGUAGE_ENG * MAP_NAME_TEX2_SIZE, + MAP_NAME_TEX2_SIZE, "../z_kaleido_scope_PAL.c", UNK_LINE); } #else if (gSaveContext.language == LANGUAGE_ENG) { @@ -4259,7 +4263,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->alpha = 0; } } else { - if (IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR)) { + if (DEBUG_FEATURES && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR)) { pauseCtx->debugState = 0; } pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; @@ -4276,7 +4280,7 @@ void KaleidoScope_Update(PlayState* play) { } break; - case PAUSE_STATE_10: + case PAUSE_STATE_GAME_OVER_INIT: pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot = VREG(30) + 3; WREG(16) = -175; @@ -4309,12 +4313,12 @@ void KaleidoScope_Update(PlayState* play) { #if OOT_NTSC if (gSaveContext.language == LANGUAGE_JPN) { size = (uintptr_t)_icon_item_jpn_staticSegmentRomEnd - (uintptr_t)_icon_item_jpn_staticSegmentRomStart; - DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, - size); + DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_jpn_staticSegmentRomStart, size, + "../z_kaleido_scope_PAL.c", UNK_LINE); } else { size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart; - DmaMgr_RequestSync(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, - size); + DMA_REQUEST_SYNC(pauseCtx->iconItemLangSegment, (uintptr_t)_icon_item_nes_staticSegmentRomStart, size, + "../z_kaleido_scope_PAL.c", UNK_LINE); } #else if (gSaveContext.language == LANGUAGE_ENG) { @@ -4345,10 +4349,10 @@ void KaleidoScope_Update(PlayState* play) { D_8082B260 = 30; VREG(88) = 98; pauseCtx->promptChoice = 0; - pauseCtx->state++; // PAUSE_STATE_11 + pauseCtx->state++; // PAUSE_STATE_GAME_OVER_SHOW_MESSAGE break; - case PAUSE_STATE_11: + case PAUSE_STATE_GAME_OVER_SHOW_MESSAGE: stepR = ABS(D_8082AB8C - 30) / D_8082B260; stepG = ABS(D_8082AB90) / D_8082B260; stepB = ABS(D_8082AB94) / D_8082B260; @@ -4404,19 +4408,19 @@ void KaleidoScope_Update(PlayState* play) { D_8082ABA0 = 130; D_8082ABA4 = 0; - pauseCtx->state++; // PAUSE_STATE_12 + pauseCtx->state++; // PAUSE_STATE_GAME_OVER_WINDOW_DELAY D_8082B260 = 40; } break; - case PAUSE_STATE_12: + case PAUSE_STATE_GAME_OVER_WINDOW_DELAY: D_8082B260--; if (D_8082B260 == 0) { - pauseCtx->state = PAUSE_STATE_13; + pauseCtx->state = PAUSE_STATE_GAME_OVER_SHOW_WINDOW; } break; - case PAUSE_STATE_13: + case PAUSE_STATE_GAME_OVER_SHOW_WINDOW: pauseCtx->itemPagePitch = pauseCtx->equipPagePitch = pauseCtx->mapPagePitch = pauseCtx->questPagePitch = pauseCtx->promptPitch -= 160.0f / WREG(6); pauseCtx->infoPanelOffsetY += 40 / WREG(6); @@ -4432,7 +4436,7 @@ void KaleidoScope_Update(PlayState* play) { VREG(88) = 66; R_PAUSE_PAGES_Y_ORIGIN_2 = 0; pauseCtx->alpha = 255; - pauseCtx->state = PAUSE_STATE_14; + pauseCtx->state = PAUSE_STATE_GAME_OVER_SAVE_PROMPT; gSaveContext.save.info.playerData.deaths++; if (gSaveContext.save.info.playerData.deaths > 999) { gSaveContext.save.info.playerData.deaths = 999; @@ -4441,13 +4445,13 @@ void KaleidoScope_Update(PlayState* play) { PRINTF("kscope->angle_s = %f\n", pauseCtx->promptPitch); break; - case PAUSE_STATE_14: + case PAUSE_STATE_GAME_OVER_SAVE_PROMPT: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (pauseCtx->promptChoice != 0) { pauseCtx->promptChoice = 0; Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - pauseCtx->state = PAUSE_STATE_16; + pauseCtx->state = PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT; gameOverCtx->state++; } else { Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -4456,7 +4460,7 @@ void KaleidoScope_Update(PlayState* play) { Play_SaveSceneFlags(play); gSaveContext.save.info.playerData.savedSceneId = play->sceneId; Sram_WriteSave(&play->sramCtx); - pauseCtx->state = PAUSE_STATE_15; + pauseCtx->state = PAUSE_STATE_GAME_OVER_SAVED; #if PLATFORM_N64 sDelayTimer = 90; #else @@ -4466,20 +4470,20 @@ void KaleidoScope_Update(PlayState* play) { } break; - case PAUSE_STATE_15: + case PAUSE_STATE_GAME_OVER_SAVED: sDelayTimer--; if (sDelayTimer == 0) { - pauseCtx->state = PAUSE_STATE_16; + pauseCtx->state = PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT; gameOverCtx->state++; } else if ((sDelayTimer <= 80) && (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START))) { - pauseCtx->state = PAUSE_STATE_16; + pauseCtx->state = PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT; gameOverCtx->state++; func_800F64E0(0); } break; - case PAUSE_STATE_16: + case PAUSE_STATE_GAME_OVER_CONTINUE_PROMPT: if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { if (pauseCtx->promptChoice == 0) { Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -4545,11 +4549,11 @@ void KaleidoScope_Update(PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - pauseCtx->state = PAUSE_STATE_17; + pauseCtx->state = PAUSE_STATE_GAME_OVER_FINISH; } break; - case PAUSE_STATE_17: + case PAUSE_STATE_GAME_OVER_FINISH: if (interfaceCtx->unk_244 != 255) { interfaceCtx->unk_244 += 10; if (interfaceCtx->unk_244 >= 255) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index aff7a598ea..89283bfc16 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -131,7 +131,7 @@ void PauseMapMark_DrawForDungeon(PlayState* play) { Matrix_Push(); -#if IS_DEBUG +#if DEBUG_FEATURES Matrix_Translate(markPoint->x + GREG(92), markPoint->y + GREG(93), 0.0f, MTXMODE_APPLY); #else Matrix_Translate(markPoint->x, markPoint->y, 0.0f, MTXMODE_APPLY); diff --git a/sym_info.py b/sym_info.py index b24ac23375..567ac572f2 100755 --- a/sym_info.py +++ b/sym_info.py @@ -21,7 +21,23 @@ def symInfoMain(): if args.use_expected: mapPath = "expected" / BUILTMAP - mapfile_parser.frontends.sym_info.doSymInfo(mapPath, args.symname) + # Guess if the input is an VROM/VRAM or a symbol name + as_vram = False + as_vrom = False + as_name = False + try: + address = int(args.symname, 0) + if address >= 0x01000000: + as_vram = True + else: + as_vrom = True + except ValueError: + as_name = True + + mapfile_parser.frontends.sym_info.doSymInfo( + mapPath, args.symname, as_vram=as_vram, as_vrom=as_vrom, as_name=as_name + ) + if __name__ == "__main__": symInfoMain() diff --git a/tools/audio/extraction/audio_extract.py b/tools/audio/extraction/audio_extract.py index 9107288068..29bf632e3a 100644 --- a/tools/audio/extraction/audio_extract.py +++ b/tools/audio/extraction/audio_extract.py @@ -8,17 +8,18 @@ from dataclasses import dataclass from multiprocessing.pool import ThreadPool from typing import Dict, List, Tuple, Union -from xml.etree import ElementTree -from xml.etree.ElementTree import Element from .audio_tables import AudioCodeTable, AudioCodeTableEntry, AudioStorageMedium from .audiotable import AudioTableData, AudioTableFile, AudioTableSample from .audiobank_file import AudiobankFile from .disassemble_sequence import CMD_SPEC, SequenceDisassembler, SequenceTableSpec, MMLVersion -from .util import align, debugm, error, incbin, program_get, XMLWriter +from .extraction_xml import ExtractionDescription, SampleBankExtractionDescription, SoundFontExtractionDescription, SequenceExtractionDescription +from .util import align, incbin, program_get, XMLWriter @dataclass class GameVersionInfo: + # Version Name + version_name : str # Music Macro Language Version mml_version : MMLVersion # Soundfont table code offset @@ -49,7 +50,7 @@ class GameVersionInfo: # ====================================================================================================================== def collect_sample_banks(audiotable_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, - table : AudioCodeTable, samplebank_xmls : Dict[int, Tuple[str, Element]]): + table : AudioCodeTable, samplebank_descs : Dict[int, SampleBankExtractionDescription]): sample_banks : List[Union[AudioTableFile, int]] = [] for i,entry in enumerate(table): @@ -72,7 +73,7 @@ def collect_sample_banks(audiotable_seg : memoryview, extracted_dir : str, versi bug = i in version_info.audiotable_buffer_bugs bank = AudioTableFile(i, audiotable_seg, entry, table.rom_addr, buffer_bug=bug, - extraction_xml=samplebank_xmls.get(i, None)) + extraction_desc=samplebank_descs.get(i, None)) if BASEROM_DEBUG: bank.dump_bin(f"{extracted_dir}/baserom_audiotest/audiotable_files/{bank.file_name}.bin") @@ -90,7 +91,7 @@ def bank_data_lookup(sample_banks : List[Union[AudioTableFile, int]], e : Union[ return e def collect_soundfonts(audiobank_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, - sound_font_table : AudioCodeTable, soundfont_xmls : Dict[int, Tuple[str, Element]], + sound_font_table : AudioCodeTable, soundfont_descs : Dict[int, SoundFontExtractionDescription], sample_banks : List[Union[AudioTableFile, int]]): soundfonts = [] @@ -104,7 +105,7 @@ def collect_soundfonts(audiobank_seg : memoryview, extracted_dir : str, version_ # Read the data soundfont = AudiobankFile(audiobank_seg, i, entry, sound_font_table.rom_addr, bank1, bank2, entry.sample_bank_id_1, entry.sample_bank_id_2, - extraction_xml=soundfont_xmls.get(i, None)) + extraction_desc=soundfont_descs.get(i, None)) soundfonts.append(soundfont) if BASEROM_DEBUG: @@ -186,7 +187,7 @@ def disassemble_one_sequence(extracted_dir : str, version_info : GameVersionInfo def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, write_xml : bool, sequence_table : AudioCodeTable, sequence_font_table : memoryview, - sequence_xmls : Dict[int, Element], soundfonts : List[AudiobankFile]): + sequence_descs : Dict[int, SequenceExtractionDescription], soundfonts : List[AudiobankFile]): sequence_font_table_cvg = [0] * len(sequence_font_table) @@ -237,13 +238,13 @@ def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_in with open(f"{extracted_dir}/baserom_audiotest/audioseq_files/seq_{i}{ext}.aseq", "wb") as outfile: outfile.write(seq_data) - extraction_xml = sequence_xmls.get(i, None) - if extraction_xml is None: + extraction_desc = sequence_descs.get(i, None) + if extraction_desc is None: sequence_filename = f"seq_{i}" sequence_name = f"Sequence_{i}" else: - sequence_filename = extraction_xml[0] - sequence_name = extraction_xml[1].attrib["Name"] + sequence_filename = extraction_desc.file_name + sequence_name = extraction_desc.name # Write extraction xml entry if write_xml: @@ -359,27 +360,22 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st # Collect extraction xmls # ================================================================================================================== - samplebank_xmls : Dict[int, Tuple[str, Element]] = {} - soundfont_xmls : Dict[int, Tuple[str, Element]] = {} - sequence_xmls : Dict[int, Tuple[str, Element]] = {} + samplebank_descs : Dict[int, SampleBankExtractionDescription] = {} + soundfont_descs : Dict[int, SoundFontExtractionDescription] = {} + sequence_descs : Dict[int, SequenceExtractionDescription] = {} if read_xml: # Read all present xmls - def walk_xmls(out_dict : Dict[int, Tuple[str, Element]], path : str, typename : str): + def walk_xmls(T : type, out_dict : Dict[int, ExtractionDescription], path : str): for root,_,files in os.walk(path): for f in files: - fullpath = os.path.join(root, f) - xml = ElementTree.parse(fullpath) - xml_root = xml.getroot() + desc : ExtractionDescription = T(os.path.join(root, f), f, version_info.version_name) + out_dict[desc.index] = desc - if xml_root.tag != typename or "Name" not in xml_root.attrib or "Index" not in xml_root.attrib: - error(f"Malformed {typename} extraction xml: \"{fullpath}\"") - out_dict[int(xml_root.attrib["Index"])] = (f.replace(".xml", ""), xml_root) - - walk_xmls(samplebank_xmls, f"assets/xml/audio/samplebanks", "SampleBank") - walk_xmls(soundfont_xmls, f"assets/xml/audio/soundfonts", "SoundFont") - walk_xmls(sequence_xmls, f"assets/xml/audio/sequences", "Sequence") + walk_xmls(SampleBankExtractionDescription, samplebank_descs, f"assets/xml/audio/samplebanks") + walk_xmls(SoundFontExtractionDescription, soundfont_descs, f"assets/xml/audio/soundfonts") + walk_xmls(SequenceExtractionDescription, sequence_descs, f"assets/xml/audio/sequences") # TODO warn about any missing xmls or xmls with a bad index @@ -389,7 +385,7 @@ def walk_xmls(out_dict : Dict[int, Tuple[str, Element]], path : str, typename : if BASEROM_DEBUG: os.makedirs(f"{extracted_dir}/baserom_audiotest/audiotable_files", exist_ok=True) - sample_banks = collect_sample_banks(audiotable_seg, extracted_dir, version_info, sample_bank_table, samplebank_xmls) + sample_banks = collect_sample_banks(audiotable_seg, extracted_dir, version_info, sample_bank_table, samplebank_descs) # ================================================================================================================== # Collect soundfonts @@ -397,7 +393,7 @@ def walk_xmls(out_dict : Dict[int, Tuple[str, Element]], path : str, typename : if BASEROM_DEBUG: os.makedirs(f"{extracted_dir}/baserom_audiotest/audiobank_files", exist_ok=True) - soundfonts = collect_soundfonts(audiobank_seg, extracted_dir, version_info, sound_font_table, soundfont_xmls, + soundfonts = collect_soundfonts(audiobank_seg, extracted_dir, version_info, sound_font_table, soundfont_descs, sample_banks) # ================================================================================================================== @@ -459,4 +455,4 @@ def walk_xmls(out_dict : Dict[int, Tuple[str, Element]], path : str, typename : print("Extracting sequences...") extract_sequences(audioseq_seg, extracted_dir, version_info, write_xml, sequence_table, sequence_font_table, - sequence_xmls, soundfonts) + sequence_descs, soundfonts) diff --git a/tools/audio/extraction/audiobank_file.py b/tools/audio/extraction/audiobank_file.py index 83efbc71c7..cd4e48740b 100644 --- a/tools/audio/extraction/audiobank_file.py +++ b/tools/audio/extraction/audiobank_file.py @@ -5,13 +5,13 @@ # import struct -from typing import Optional, Tuple -from xml.etree.ElementTree import Element +from typing import Optional from .audio_tables import AudioCodeTableEntry from .audiobank_structs import AdpcmBook, AdpcmLoop, Drum, Instrument, SoundFontSample, SoundFontSound -from .envelope import Envelope from .audiotable import AudioTableFile, AudioTableSample +from .envelope import Envelope +from .extraction_xml import SoundFontExtractionDescription from .tuning import pitch_names from .util import XMLWriter, align, debugm, merge_like_ranges, merge_ranges @@ -183,7 +183,7 @@ class AudiobankFile: def __init__(self, audiobank_seg : memoryview, index : int, table_entry : AudioCodeTableEntry, seg_offset : int, bank1 : AudioTableFile, bank2 : AudioTableFile, bank1_num : int, bank2_num : int, - extraction_xml : Tuple[str, Element] = None): + extraction_desc : Optional[SoundFontExtractionDescription] = None): self.bank_num = index self.table_entry : AudioCodeTableEntry = table_entry self.num_instruments = self.table_entry.num_instruments @@ -193,7 +193,7 @@ def __init__(self, audiobank_seg : memoryview, index : int, table_entry : AudioC self.bank1_num = bank1_num self.bank2_num = bank2_num - if extraction_xml is None: + if extraction_desc is None: self.file_name = f"Soundfont_{self.bank_num}" self.name = f"Soundfont_{self.bank_num}" @@ -201,32 +201,22 @@ def __init__(self, audiobank_seg : memoryview, index : int, table_entry : AudioC self.extraction_instruments_info = None self.extraction_drums_info = None self.extraction_effects_info = None + self.extraction_envelopes_info_versions = [] + self.extraction_instruments_info_versions = {} + self.extraction_drums_info_versions = [] + self.extraction_effects_info_versions = [] else: - self.file_name = extraction_xml[0] - self.name = extraction_xml[1].attrib["Name"] - - self.extraction_envelopes_info = [] - self.extraction_instruments_info = {} - self.extraction_drums_info = [] - self.extraction_effects_info = [] - - for item in extraction_xml[1]: - if item.tag == "Envelopes": - for env in item: - assert env.tag == "Envelope" - self.extraction_envelopes_info.append(env.attrib["Name"]) - elif item.tag == "Instruments": - for instr in item: - assert instr.tag == "Instrument" - self.extraction_instruments_info[int(instr.attrib["ProgramNumber"])] = instr.attrib["Name"] - elif item.tag == "Drums": - for drum in item: - self.extraction_drums_info.append(drum.attrib["Name"]) - elif item.tag == "Effects": - for effect in item: - self.extraction_effects_info.append(effect.attrib["Name"]) - else: - assert False, item.tag + self.file_name = extraction_desc.file_name + self.name = extraction_desc.name + + self.extraction_envelopes_info = extraction_desc.envelopes_info + self.extraction_instruments_info = extraction_desc.instruments_info + self.extraction_drums_info = extraction_desc.drums_info + self.extraction_effects_info = extraction_desc.effects_info + self.extraction_envelopes_info_versions = extraction_desc.envelopes_info_versions + self.extraction_instruments_info_versions = extraction_desc.instruments_info_versions + self.extraction_drums_info_versions = extraction_desc.drums_info_versions + self.extraction_effects_info_versions = extraction_desc.effects_info_versions # Coverage consists of a list of itervals of the form [[start,type],[end,type]] self.coverage = [] @@ -755,25 +745,25 @@ def finalize(self): # TODO resolve decay/release index overrides? def envelope_name(self, index): - if self.extraction_envelopes_info is not None: + if self.extraction_envelopes_info is not None and index < len(self.extraction_envelopes_info): return self.extraction_envelopes_info[index] else: return f"Env{index}" def instrument_name(self, program_number): - if self.extraction_instruments_info is not None: + if self.extraction_instruments_info is not None and program_number in self.extraction_instruments_info: return self.extraction_instruments_info[program_number] else: return f"INST_{program_number}" def drum_grp_name(self, index): - if self.extraction_drums_info is not None: + if self.extraction_drums_info is not None and index < len(self.extraction_drums_info): return self.extraction_drums_info[index] else: return f"DRUM_{index}" def effect_name(self, index): - if self.extraction_effects_info is not None: + if self.extraction_effects_info is not None and index < len(self.extraction_effects_info): return self.extraction_effects_info[index] else: return f"EFFECT_{index}" @@ -905,21 +895,41 @@ def write_extraction_xml(self, path): # add contents for names - if len(self.envelopes) != 0: + if len(self.envelopes) != 0 or len(self.extraction_envelopes_info_versions) != 0: xml.write_start_tag("Envelopes") - for i in range(len(self.envelopes)): + # First write envelopes that were defined in the extraction xml, possibly interleaved with envelopes + # we ignored for this version + i = 0 + for envelope_entry,in_version in self.extraction_envelopes_info_versions: + xml.write_element("Envelope", envelope_entry) + # Count how many envelopes we saw that were defined for this version + i += in_version + + # Write any remaining envelopes that weren't defined in the xml + for j in range(i, len(self.envelopes)): xml.write_element("Envelope", { - "Name" : self.envelope_name(i) + "Name" : self.envelope_name(j) }) xml.write_end_tag() - if len(self.instruments) != 0: + if len(self.instruments) != 0 or len(self.extraction_instruments_info_versions) != 0: xml.write_start_tag("Instruments") # Write in struct order - for instr in sorted(self.instruments, key=lambda instr : instr.struct_index): + sorted_instruments = tuple(sorted(self.instruments, key=lambda instr : instr.struct_index)) + + # First write instruments that were defined in the extraction xml, possibly interleaved with instruments + # we ignored for this version + i = 0 + for instr_entry,in_version in self.extraction_instruments_info_versions: + xml.write_element("Instrument", instr_entry) + # Count how many instruments we saw that were defined for this version + i += in_version + + # Write any remaining instruments that weren't defined in the xml + for instr in sorted_instruments[i:]: instr : Instrument if not instr.unused: xml.write_element("Instrument", { @@ -929,23 +939,39 @@ def write_extraction_xml(self, path): xml.write_end_tag() - if any(isinstance(dg, DrumGroup) for dg in self.drum_groups): + if any(isinstance(dg, DrumGroup) for dg in self.drum_groups) or len(self.extraction_drums_info_versions): xml.write_start_tag("Drums") - for i,drum_grp in enumerate(self.drum_groups): + # First write drums that were defined in the extraction xml, possibly interleaved with drums + # we ignored for this version + i = 0 + for drum_entry,in_version in self.extraction_drums_info_versions: + xml.write_element("Drum", drum_entry) + # Count how many drum groups we saw that were defined for this version + i += in_version + + for j,drum_grp in enumerate(self.drum_groups[i:], i): if isinstance(drum_grp, DrumGroup): xml.write_element("Drum", { - "Name" : self.drum_grp_name(i) + "Name" : self.drum_grp_name(j) }) xml.write_end_tag() - if len(self.sfx) != 0: + if len(self.sfx) != 0 or len(self.extraction_effects_info_versions): xml.write_start_tag("Effects") - for i,sfx in enumerate(self.sfx): + # First write effects that were defined in the extraction xml, possibly interleaved with effects + # we ignored for this version + i = 0 + for sfx_entry,in_version in self.extraction_effects_info_versions: + xml.write_element("Effect", sfx_entry) + # Count how many effects we saw that were defined for this version + i += in_version + + for j,sfx in enumerate(self.sfx[i:], i): xml.write_element("Effect", { - "Name" : self.effect_name(i) + "Name" : self.effect_name(j) }) xml.write_end_tag() diff --git a/tools/audio/extraction/audiotable.py b/tools/audio/extraction/audiotable.py index 9511acecda..29a27695ae 100644 --- a/tools/audio/extraction/audiotable.py +++ b/tools/audio/extraction/audiotable.py @@ -5,11 +5,11 @@ # import math, struct -from typing import Dict, Tuple -from xml.etree.ElementTree import Element +from typing import Dict, Optional from .audio_tables import AudioCodeTableEntry from .audiobank_structs import AudioSampleCodec, SoundFontSample, AdpcmBook, AdpcmLoop +from .extraction_xml import SampleBankExtractionDescription from .tuning import pitch_names, note_z64_to_midi, recalc_tuning, rate_from_tuning, rank_rates_notes, BAD_FLOATS from .util import align, error, XMLWriter, f32_to_u32 @@ -207,7 +207,7 @@ def codec_file_extension_decompressed(self): def base_note_number(self): return note_z64_to_midi(pitch_names.index(self.base_note)) - def resolve_basenote_rate(self, extraction_sample_info : Dict[int, Dict[str,str]]): + def resolve_basenote_rate(self, extraction_sample_info : Optional[Dict[str,str]]): assert len(self.notes_rates) != 0 # rate_3ds = None @@ -285,13 +285,9 @@ def update_tuning_map(tuning, rate, note): final_rate,(final_note,) = rank_rates_notes(finalists) if extraction_sample_info is not None: - if self.start in extraction_sample_info: - entry = extraction_sample_info[self.start] - if "SampleRate" in entry and "BaseNote" in entry: - final_rate = int(entry["SampleRate"]) - final_note = entry["BaseNote"] - else: - print(f"WARNING: Missing extraction xml entry for sample at offset=0x{self.start:X}") + assert "SampleRate" in extraction_sample_info and "BaseNote" in extraction_sample_info + final_rate = int(extraction_sample_info["SampleRate"]) + final_note = extraction_sample_info["BaseNote"] # print(" ",len(FINAL_NOTES_RATES), FINAL_NOTES_RATES) # if rate_3ds is not None and len(FINAL_NOTES_RATES) == 1: @@ -385,7 +381,8 @@ class AudioTableFile: """ def __init__(self, bank_num : int, audiotable_seg : memoryview, table_entry : AudioCodeTableEntry, - seg_offset : int, buffer_bug : bool = False, extraction_xml : Tuple[str, Element] = None): + seg_offset : int, buffer_bug : bool = False, + extraction_desc : Optional[SampleBankExtractionDescription] = None): self.bank_num = bank_num self.table_entry : AudioCodeTableEntry = table_entry self.data = self.table_entry.data(audiotable_seg, seg_offset) @@ -393,24 +390,18 @@ def __init__(self, bank_num : int, audiotable_seg : memoryview, table_entry : Au self.samples_final = None - if extraction_xml is None: + if extraction_desc is None: self.file_name = f"SampleBank_{self.bank_num}" self.name = f"SampleBank_{self.bank_num}" + self.extraction_sample_info_versions = [] self.extraction_sample_info = None self.extraction_blob_info = None else: - self.file_name = extraction_xml[0] - self.name = extraction_xml[1].attrib["Name"] - - self.extraction_sample_info = {} - self.extraction_blob_info = {} - for item in extraction_xml[1]: - if item.tag == "Sample": - self.extraction_sample_info[int(item.attrib["Offset"], 16)] = item.attrib - elif item.tag == "Blob": - self.extraction_blob_info[int(item.attrib["Offset"], 16)] = item.attrib - else: - assert False + self.file_name = extraction_desc.file_name + self.name = extraction_desc.name + self.extraction_sample_info_versions = extraction_desc.sample_info_versions + self.extraction_sample_info = extraction_desc.sample_info + self.extraction_blob_info = extraction_desc.blob_info self.pointer_indices = [] @@ -461,28 +452,24 @@ def lookup_sample(self, offset : int) -> AudioTableSample: return self.samples[offset] def sample_name(self, sample : AudioTableSample, index : int): - if self.extraction_sample_info is not None: - if sample.start in self.extraction_sample_info: - return self.extraction_sample_info[sample.start]["Name"] - print(f"WARNING: Missing extraction xml entry for sample at offset=0x{sample.start:X}") + if self.extraction_sample_info is not None and index < len(self.extraction_sample_info): + return self.extraction_sample_info[index]["Name"] + return f"SAMPLE_{self.bank_num}_{index}" def sample_filename(self, sample : AudioTableSample, index : int): ext = sample.codec_file_extension_compressed() - if self.extraction_sample_info is not None: - if sample.start in self.extraction_sample_info: - return self.extraction_sample_info[sample.start]["FileName"] + ext - print(f"WARNING: Missing extraction xml entry for sample at offset=0x{sample.start:X}") + if self.extraction_sample_info is not None and index < len(self.extraction_sample_info): + return self.extraction_sample_info[index]["FileName"] + ext npad = int(math.floor(1 + math.log10(len(self.samples)))) if len(self.samples) != 0 else 0 return f"Sample{index:0{npad}}{ext}" - def blob_filename(self, start, end): - if self.extraction_blob_info is not None: - if start in self.extraction_blob_info: - return self.extraction_blob_info[start]["Name"] - print(f"WARNING: Missing extraction xml entry for blob at offset=0x{start:X}") + def blob_filename(self, start, end, index): + if self.extraction_blob_info is not None and index < len(self.extraction_blob_info): + return self.extraction_blob_info[index]["Name"] + return f"UNACCOUNTED_{start:X}_{end:X}" def finalize_samples(self): @@ -490,7 +477,7 @@ def finalize_samples(self): for i,sample in enumerate(self.samples_final): sample : AudioTableSample - sample.resolve_basenote_rate(self.extraction_sample_info) + sample.resolve_basenote_rate(self.extraction_sample_info[i] if self.extraction_sample_info is not None else None) def finalize_coverage(self, all_sample_banks): if len(self.coverage) != 0: @@ -577,6 +564,7 @@ def finalize_coverage(self, all_sample_banks): def assign_names(self): i = 0 + j = 0 for sample in self.samples_final: if isinstance(sample, AudioTableSample): sample : AudioTableSample @@ -587,9 +575,10 @@ def assign_names(self): else: sample : AudioTableData - name = self.blob_filename(sample.start, sample.end) + name = self.blob_filename(sample.start, sample.end, j) sample.name = name sample.filename = f"{name}.bin" + j += 1 def to_xml(self, base_path): xml = XMLWriter() @@ -635,33 +624,36 @@ def write_extraction_xml(self, path): xml.write_comment("This file is only for extraction of vanilla data. For other purposes see assets/audio/samplebanks/") - start = { + xml.write_start_tag("SampleBank", { "Name" : self.name, "Index" : self.bank_num, - } - xml.write_start_tag("SampleBank", start) + }) + # Write elements from the old xml version verbatim i = 0 - for sample in self.samples_final: + for entry_name,entry_attrs,in_version in self.extraction_sample_info_versions: + xml.write_element(entry_name, entry_attrs) + i += in_version + + # Write any new elements + for sample in self.samples_final[i:]: if isinstance(sample, AudioTableSample): sample : AudioTableSample - xml.write_element("Sample", { + attrs = { "Name" : sample.name, "FileName" : sample.filename.replace(sample.codec_file_extension_compressed(), ""), - "Offset" : f"0x{sample.start:06X}", "SampleRate" : sample.sample_rate, "BaseNote" : sample.base_note, - }) - i += 1 + } + xml.write_element("Sample", attrs) else: sample : AudioTableData - xml.write_element("Blob", { - "Name" : sample.name, - "Offset" : f"0x{sample.start:06X}", - "Size" : f"0x{sample.end - sample.start:X}", - }) + attrs = { + "Name" : sample.name, + } + xml.write_element("Blob", attrs) xml.write_end_tag() diff --git a/tools/audio/extraction/extraction_xml.py b/tools/audio/extraction/extraction_xml.py new file mode 100644 index 0000000000..f54b7749f0 --- /dev/null +++ b/tools/audio/extraction/extraction_xml.py @@ -0,0 +1,135 @@ +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 +# +# +# + +from xml.etree import ElementTree +from xml.etree.ElementTree import Element + +from .util import error + +class ExtractionDescription: + + def __init__(self, file_path : str, file_name : str, version_name : str) -> None: + self.type_name = type(self).__name__.replace("ExtractionDescription", "") + self.file_name = file_name.replace(".xml", "") + self.file_path = file_path + + xml_root = ElementTree.parse(file_path).getroot() + if xml_root.tag != self.type_name or "Name" not in xml_root.attrib or "Index" not in xml_root.attrib: + error(f"Malformed {self.type_name} extraction xml: \"{file_path}\"") + + self.name = xml_root.attrib["Name"] + self.index = int(xml_root.attrib["Index"]) + + self.post_init(xml_root, version_name) + + def post_init(self, xml_root : Element, version_name : str): + raise NotImplementedError() # Implement in subclass + + def in_version(self, version_include, version_exclude, version_name : str): + if version_include == "": + version_include = "All" + if version_exclude == "": + version_exclude = "None" + + # Determine if this layout is the one we need + if version_include != "All": + version_include = version_include.split(",") + if version_exclude != "None": + version_exclude = version_exclude.split(",") + + included = version_include == "All" or version_name in version_include + excluded = version_exclude != "None" and version_name in version_exclude + + return included and not excluded + +class SampleBankExtractionDescription(ExtractionDescription): + + def post_init(self, xml_root : Element, version_name : str): + self.included_version = None + self.sample_info = [] + self.sample_info_versions = [] + self.blob_info = [] + + for item in xml_root: + if item.tag == "Sample": + version_include = item.attrib.get("VersionInclude", "") + version_exclude = item.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.sample_info.append(item.attrib) + self.sample_info_versions.append((item.tag, item.attrib, in_version)) + elif item.tag == "Blob": + version_include = item.attrib.get("VersionInclude", "") + version_exclude = item.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.blob_info.append(item.attrib) + self.sample_info_versions.append((item.attrib, in_version)) + else: + print(xml_root.attrib) + assert False, item.tag + +class SoundFontExtractionDescription(ExtractionDescription): + + def post_init(self, xml_root : Element, version_name : str): + self.envelopes_info = [] + self.instruments_info = {} + self.drums_info = [] + self.effects_info = [] + self.envelopes_info_versions = [] + self.instruments_info_versions = [] + self.drums_info_versions = [] + self.effects_info_versions = [] + + for item in xml_root: + if item.tag == "Envelopes": + for env in item: + assert env.tag == "Envelope" + + version_include = env.attrib.get("VersionInclude", "") + version_exclude = env.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.envelopes_info.append(env.attrib["Name"]) + self.envelopes_info_versions.append((env.attrib, in_version)) + elif item.tag == "Instruments": + for instr in item: + assert instr.tag == "Instrument" + prg_num = int(instr.attrib["ProgramNumber"]) + + version_include = instr.attrib.get("VersionInclude", "") + version_exclude = instr.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.instruments_info[prg_num] = instr.attrib["Name"] + self.instruments_info_versions.append((instr.attrib, in_version)) + elif item.tag == "Drums": + for drum in item: + assert drum.tag == "Drum" + + version_include = drum.attrib.get("VersionInclude", "") + version_exclude = drum.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.drums_info.append(drum.attrib["Name"]) + self.drums_info_versions.append((drum.attrib, in_version)) + elif item.tag == "Effects": + for effect in item: + assert effect.tag == "Effect" + + version_include = effect.attrib.get("VersionInclude", "") + version_exclude = effect.attrib.get("VersionExclude", "") + in_version = self.in_version(version_include, version_exclude, version_name) + if in_version: + self.effects_info.append(effect.attrib["Name"]) + self.effects_info_versions.append((effect.attrib, in_version)) + else: + assert False, item.tag + +class SequenceExtractionDescription(ExtractionDescription): + + def post_init(self, xml_root : Element, version_name : str): + pass diff --git a/tools/audio_extraction.py b/tools/audio_extraction.py index 9c3a202648..ab5d5b3fb4 100644 --- a/tools/audio_extraction.py +++ b/tools/audio_extraction.py @@ -184,7 +184,8 @@ ), } - version_info = GameVersionInfo(MMLVersion.OOT, + version_info = GameVersionInfo(version, + MMLVersion.OOT, soundfont_table_code_offset, seq_font_table_code_offset, seq_table_code_offset, diff --git a/tools/fix_bss.py b/tools/fix_bss.py index 488efb4679..05cf4293a2 100755 --- a/tools/fix_bss.py +++ b/tools/fix_bss.py @@ -183,11 +183,11 @@ def get_file_pointers( build = None -def get_file_pointers_worker_init(version: str): +def get_file_pointers_worker_init(base_path: Path, build_path: Path): global base global build - base = open(f"baseroms/{version}/baserom-decompressed.z64", "rb") - build = open(f"build/{version}/oot-{version}.z64", "rb") + base = open(base_path, "rb") + build = open(build_path, "rb") def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer]: @@ -200,8 +200,14 @@ def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer] # C files to a list of pointers into their BSS sections def compare_pointers(version: str) -> dict[Path, BssSection]: mapfile_path = Path(f"build/{version}/oot-{version}.map") + base_path = Path(f"baseroms/{version}/baserom-decompressed.z64") + build_path = Path(f"build/{version}/oot-{version}.z64") if not mapfile_path.exists(): raise FixBssException(f"Could not open {mapfile_path}") + if not base_path.exists(): + raise FixBssException(f"Could not open {base_path}") + if not build_path.exists(): + raise FixBssException(f"Could not open {build_path}") mapfile = mapfile_parser.mapfile.MapFile() mapfile.readMapFile(mapfile_path) @@ -225,7 +231,7 @@ def compare_pointers(version: str) -> dict[Path, BssSection]: file_results = [] with multiprocessing.Pool( initializer=get_file_pointers_worker_init, - initargs=(version,), + initargs=(base_path, build_path), ) as p: for mapfile_segment in source_code_segments: for file in mapfile_segment: diff --git a/tools/preprocess.sh b/tools/preprocess.sh index 34a5c4d0eb..dc327c09c3 100755 --- a/tools/preprocess.sh +++ b/tools/preprocess.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-FileCopyrightText: © 2024 ZeldaRET # SPDX-License-Identifier: CC0-1.0