Merge remote-tracking branch 'upstream/main' into EnGs_Doc

This commit is contained in:
blackgamma7 2024-02-08 14:24:56 -05:00
commit 01ee3b64a7
55 changed files with 967 additions and 702 deletions

View File

@ -370,6 +370,7 @@ setup: venv
# TODO: for now, we only extract assets from the Debug ROM # TODO: for now, we only extract assets from the Debug ROM
ifeq ($(VERSION),gc-eu-mq-dbg) ifeq ($(VERSION),gc-eu-mq-dbg)
$(PYTHON) extract_assets.py -j$(N_THREADS) $(PYTHON) extract_assets.py -j$(N_THREADS)
$(PYTHON) tools/msgdis.py --text-out assets/text/message_data.h --staff-text-out assets/text/message_data_staff.h
endif endif
disasm: $(DISASM_O_FILES) disasm: $(DISASM_O_FILES)

View File

@ -96,7 +96,7 @@ def processZAPDArgs(argsZ):
def main(): def main():
parser = argparse.ArgumentParser(description="baserom asset extractor") parser = argparse.ArgumentParser(description="baserom asset extractor")
parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep") parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep")
parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones, and text (overwriting current files).", action="store_true") parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones (overwriting current files).", action="store_true")
parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.") parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.")
parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true") parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true")
parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append") parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append")
@ -128,21 +128,6 @@ def main():
del extractedAssetsTracker[fullPath] del extractedAssetsTracker[fullPath]
ExtractFunc(fullPath) ExtractFunc(fullPath)
else: else:
extract_text_path = "assets/text/message_data.h"
extract_staff_text_path = "assets/text/message_data_staff.h"
# Only extract text if the header does not already exist, or if --force was passed
if not args.force:
if os.path.isfile(extract_text_path):
extract_text_path = None
if os.path.isfile(extract_staff_text_path):
extract_staff_text_path = None
if extract_text_path is not None or extract_staff_text_path is not None:
print("Extracting text")
from tools import msgdis
msgdis.extract_all_text(extract_text_path, extract_staff_text_path)
xmlFiles = [] xmlFiles = []
for currentPath, _, files in os.walk(os.path.join("assets", "xml")): for currentPath, _, files in os.walk(os.path.join("assets", "xml")):
for file in files: for file in files:

View File

@ -1155,10 +1155,10 @@ void Sram_WriteSramHeader(SramContext* sramCtx);
void Sram_InitSram(GameState* gameState, SramContext* sramCtx); void Sram_InitSram(GameState* gameState, SramContext* sramCtx);
void Sram_Alloc(GameState* gameState, SramContext* sramCtx); void Sram_Alloc(GameState* gameState, SramContext* sramCtx);
void Sram_Init(PlayState* play, SramContext* sramCtx); void Sram_Init(PlayState* play, SramContext* sramCtx);
void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration,
u8 handlePulse, u32 handleSpeed); u8 handlePulse, u32 handleSpeed);
void SsSram_Dma(void* dramAddr, size_t size, s32 direction); void SsSram_Dma(void* dramAddr, size_t size, s32 direction);
void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction); void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction);
View* View_New(GraphicsContext* gfxCtx); View* View_New(GraphicsContext* gfxCtx);
void View_Free(View* view); void View_Free(View* view);
void View_Init(View*, GraphicsContext*); void View_Init(View*, GraphicsContext*);

62
spec
View File

@ -20,13 +20,17 @@ beginseg
include "$(BUILD_DIR)/src/boot/z_std_dma.o" include "$(BUILD_DIR)/src/boot/z_std_dma.o"
include "$(BUILD_DIR)/src/boot/yaz0.o" include "$(BUILD_DIR)/src/boot/yaz0.o"
include "$(BUILD_DIR)/src/boot/z_locale.o" include "$(BUILD_DIR)/src/boot/z_locale.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/boot/assert.o" include "$(BUILD_DIR)/src/boot/assert.o"
#endif
include "$(BUILD_DIR)/src/boot/is_debug.o" include "$(BUILD_DIR)/src/boot/is_debug.o"
include "$(BUILD_DIR)/src/libultra/io/driverominit.o" include "$(BUILD_DIR)/src/libultra/io/driverominit.o"
include "$(BUILD_DIR)/src/boot/mio0.o" include "$(BUILD_DIR)/src/boot/mio0.o"
include "$(BUILD_DIR)/src/boot/stackcheck.o" include "$(BUILD_DIR)/src/boot/stackcheck.o"
include "$(BUILD_DIR)/src/boot/logutils.o" include "$(BUILD_DIR)/src/boot/logutils.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/sprintf.o" include "$(BUILD_DIR)/src/libultra/libc/sprintf.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/piacs.o" include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o" include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
include "$(BUILD_DIR)/src/libultra/os/stopthread.o" include "$(BUILD_DIR)/src/libultra/os/stopthread.o"
@ -57,10 +61,14 @@ beginseg
include "$(BUILD_DIR)/src/libultra/os/probetlb.o" include "$(BUILD_DIR)/src/libultra/os/probetlb.o"
include "$(BUILD_DIR)/src/libultra/os/getmemsize.o" include "$(BUILD_DIR)/src/libultra/os/getmemsize.o"
include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o" include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o" include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o"
include "$(BUILD_DIR)/src/libultra/io/epidma.o" include "$(BUILD_DIR)/src/libultra/io/epidma.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/string.o" include "$(BUILD_DIR)/src/libultra/libc/string.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/invalicache.o" include "$(BUILD_DIR)/src/libultra/os/invalicache.o"
include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o" include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o"
include "$(BUILD_DIR)/src/libultra/os/invaldcache.o" include "$(BUILD_DIR)/src/libultra/os/invaldcache.o"
@ -88,17 +96,23 @@ beginseg
include "$(BUILD_DIR)/src/libultra/io/epiread.o" include "$(BUILD_DIR)/src/libultra/io/epiread.o"
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o" include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o" include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o" include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o" include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o"
include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o" include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/epiwrite.o" include "$(BUILD_DIR)/src/libultra/io/epiwrite.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o" include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o"
include "$(BUILD_DIR)/src/libultra/os/yieldthread.o" include "$(BUILD_DIR)/src/libultra/os/yieldthread.o"
include "$(BUILD_DIR)/src/libultra/os/getcause.o" include "$(BUILD_DIR)/src/libultra/os/getcause.o"
include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o" include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
#endif
include "$(BUILD_DIR)/src/boot/build.o" include "$(BUILD_DIR)/src/boot/build.o"
include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o" include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o"
include "$(BUILD_DIR)/src/libultra/io/vimgr.o" include "$(BUILD_DIR)/src/libultra/io/vimgr.o"
@ -342,7 +356,9 @@ beginseg
include "$(BUILD_DIR)/src/code/z_lights.o" include "$(BUILD_DIR)/src/code/z_lights.o"
include "$(BUILD_DIR)/src/code/z_malloc.o" include "$(BUILD_DIR)/src/code/z_malloc.o"
include "$(BUILD_DIR)/src/code/z_map_mark.o" include "$(BUILD_DIR)/src/code/z_map_mark.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/z_moji.o" include "$(BUILD_DIR)/src/code/z_moji.o"
#endif
include "$(BUILD_DIR)/src/code/z_prenmi_buff.o" include "$(BUILD_DIR)/src/code/z_prenmi_buff.o"
include "$(BUILD_DIR)/src/code/z_nulltask.o" include "$(BUILD_DIR)/src/code/z_nulltask.o"
include "$(BUILD_DIR)/src/code/z_olib.o" include "$(BUILD_DIR)/src/code/z_olib.o"
@ -369,7 +385,9 @@ beginseg
include "$(BUILD_DIR)/src/code/z_sram.o" include "$(BUILD_DIR)/src/code/z_sram.o"
include "$(BUILD_DIR)/src/code/z_ss_sram.o" include "$(BUILD_DIR)/src/code/z_ss_sram.o"
include "$(BUILD_DIR)/src/code/z_rumble.o" include "$(BUILD_DIR)/src/code/z_rumble.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/data/z_text.data.o" include "$(BUILD_DIR)/data/z_text.data.o"
#endif
include "$(BUILD_DIR)/data/unk_8012ABC0.data.o" include "$(BUILD_DIR)/data/unk_8012ABC0.data.o"
include "$(BUILD_DIR)/src/code/z_view.o" include "$(BUILD_DIR)/src/code/z_view.o"
include "$(BUILD_DIR)/src/code/z_vimode.o" include "$(BUILD_DIR)/src/code/z_vimode.o"
@ -385,9 +403,13 @@ beginseg
include "$(BUILD_DIR)/src/code/z_fbdemo_circle.o" include "$(BUILD_DIR)/src/code/z_fbdemo_circle.o"
include "$(BUILD_DIR)/src/code/z_fbdemo_fade.o" include "$(BUILD_DIR)/src/code/z_fbdemo_fade.o"
include "$(BUILD_DIR)/src/code/shrink_window.o" include "$(BUILD_DIR)/src/code/shrink_window.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/db_camera.o" include "$(BUILD_DIR)/src/code/db_camera.o"
#endif
include "$(BUILD_DIR)/src/code/code_800BB0A0.o" include "$(BUILD_DIR)/src/code/code_800BB0A0.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/mempak.o" include "$(BUILD_DIR)/src/code/mempak.o"
#endif
include "$(BUILD_DIR)/src/code/z_kaleido_manager.o" include "$(BUILD_DIR)/src/code/z_kaleido_manager.o"
include "$(BUILD_DIR)/src/code/z_kaleido_scope_call.o" include "$(BUILD_DIR)/src/code/z_kaleido_scope_call.o"
include "$(BUILD_DIR)/src/code/z_play.o" include "$(BUILD_DIR)/src/code/z_play.o"
@ -415,7 +437,9 @@ beginseg
include "$(BUILD_DIR)/src/code/sys_rumble.o" include "$(BUILD_DIR)/src/code/sys_rumble.o"
include "$(BUILD_DIR)/src/code/code_800D31A0.o" include "$(BUILD_DIR)/src/code/code_800D31A0.o"
include "$(BUILD_DIR)/src/code/irqmgr.o" include "$(BUILD_DIR)/src/code/irqmgr.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/debug_malloc.o" include "$(BUILD_DIR)/src/code/debug_malloc.o"
#endif
include "$(BUILD_DIR)/src/code/fault.o" include "$(BUILD_DIR)/src/code/fault.o"
include "$(BUILD_DIR)/src/code/fault_drawer.o" include "$(BUILD_DIR)/src/code/fault_drawer.o"
#ifndef NON_MATCHING #ifndef NON_MATCHING
@ -423,7 +447,9 @@ beginseg
include "$(BUILD_DIR)/data/fault_drawer.bss.o" include "$(BUILD_DIR)/data/fault_drawer.bss.o"
#endif #endif
include "$(BUILD_DIR)/src/code/kanread.o" include "$(BUILD_DIR)/src/code/kanread.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/ucode_disas.o" include "$(BUILD_DIR)/src/code/ucode_disas.o"
#endif
pad_text // audio library aligned to 32 bytes? pad_text // audio library aligned to 32 bytes?
include "$(BUILD_DIR)/src/audio/lib/data.o" include "$(BUILD_DIR)/src/audio/lib/data.o"
include "$(BUILD_DIR)/src/audio/lib/synthesis.o" include "$(BUILD_DIR)/src/audio/lib/synthesis.o"
@ -445,7 +471,9 @@ beginseg
include "$(BUILD_DIR)/src/code/gfxprint.o" include "$(BUILD_DIR)/src/code/gfxprint.o"
include "$(BUILD_DIR)/src/code/rcp_utils.o" include "$(BUILD_DIR)/src/code/rcp_utils.o"
include "$(BUILD_DIR)/src/code/loadfragment2.o" include "$(BUILD_DIR)/src/code/loadfragment2.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/code/mtxuty-cvt.o" include "$(BUILD_DIR)/src/code/mtxuty-cvt.o"
#endif
include "$(BUILD_DIR)/src/code/relocation.o" include "$(BUILD_DIR)/src/code/relocation.o"
include "$(BUILD_DIR)/src/code/load.o" include "$(BUILD_DIR)/src/code/load.o"
include "$(BUILD_DIR)/src/code/code_800FC620.o" include "$(BUILD_DIR)/src/code/code_800FC620.o"
@ -456,11 +484,16 @@ beginseg
include "$(BUILD_DIR)/src/code/system_malloc.o" include "$(BUILD_DIR)/src/code/system_malloc.o"
include "$(BUILD_DIR)/src/code/code_800FD970.o" include "$(BUILD_DIR)/src/code/code_800FD970.o"
include "$(BUILD_DIR)/src/code/__osMalloc.o" include "$(BUILD_DIR)/src/code/__osMalloc.o"
#if !OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/sprintf.o"
#endif
include "$(BUILD_DIR)/src/code/printutils.o" include "$(BUILD_DIR)/src/code/printutils.o"
include "$(BUILD_DIR)/src/code/sleep.o" include "$(BUILD_DIR)/src/code/sleep.o"
include "$(BUILD_DIR)/src/code/jpegutils.o" include "$(BUILD_DIR)/src/code/jpegutils.o"
include "$(BUILD_DIR)/src/code/jpegdecoder.o" include "$(BUILD_DIR)/src/code/jpegdecoder.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o" include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o"
#endif
include "$(BUILD_DIR)/src/libultra/mgu/scale.o" include "$(BUILD_DIR)/src/libultra/mgu/scale.o"
include "$(BUILD_DIR)/src/libultra/gu/sinf.o" include "$(BUILD_DIR)/src/libultra/gu/sinf.o"
include "$(BUILD_DIR)/src/libultra/gu/sins.o" include "$(BUILD_DIR)/src/libultra/gu/sins.o"
@ -473,19 +506,29 @@ beginseg
include "$(BUILD_DIR)/src/libultra/io/sprawdma.o" include "$(BUILD_DIR)/src/libultra/io/sprawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sirawdma.o" include "$(BUILD_DIR)/src/libultra/io/sirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o" include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsreadwritefile.o" include "$(BUILD_DIR)/src/libultra/io/pfsreadwritefile.o"
include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o" include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o"
#endif
include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o" include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o"
include "$(BUILD_DIR)/src/libultra/gu/lookat.o" include "$(BUILD_DIR)/src/libultra/gu/lookat.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o" include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/stoptimer.o" include "$(BUILD_DIR)/src/libultra/os/stoptimer.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/contpfs.o" include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o" include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o"
include "$(BUILD_DIR)/src/libultra/io/pfsfindfile.o" include "$(BUILD_DIR)/src/libultra/io/pfsfindfile.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o" include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o"
include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o" include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o"
include "$(BUILD_DIR)/src/libultra/io/contquery.o" include "$(BUILD_DIR)/src/libultra/io/contquery.o"
include "$(BUILD_DIR)/src/libultra/gu/lookathil.o" include "$(BUILD_DIR)/src/libultra/gu/lookathil.o"
#if !OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
include "$(BUILD_DIR)/src/libultra/libc/string.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/sp.o" include "$(BUILD_DIR)/src/libultra/io/sp.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o" include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o"
include "$(BUILD_DIR)/src/libultra/gu/position.o" include "$(BUILD_DIR)/src/libultra/gu/position.o"
@ -496,25 +539,44 @@ beginseg
include "$(BUILD_DIR)/src/libultra/mgu/normalize.o" include "$(BUILD_DIR)/src/libultra/mgu/normalize.o"
include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o" include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o" include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o" include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/ortho.o" include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
include "$(BUILD_DIR)/src/libultra/gu/cosf.o" include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o" include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
include "$(BUILD_DIR)/src/libultra/gu/coss.o" include "$(BUILD_DIR)/src/libultra/gu/coss.o"
include "$(BUILD_DIR)/src/libultra/io/visetevent.o" include "$(BUILD_DIR)/src/libultra/io/visetevent.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o" include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/us2dex.o" include "$(BUILD_DIR)/src/libultra/gu/us2dex.o"
include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o" include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o"
include "$(BUILD_DIR)/src/libultra/io/contsetch.o" include "$(BUILD_DIR)/src/libultra/io/contsetch.o"
#if OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o" include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o"
include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o" include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o"
include "$(BUILD_DIR)/src/libultra/io/pfschecker.o" include "$(BUILD_DIR)/src/libultra/io/pfschecker.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/aigetlen.o" include "$(BUILD_DIR)/src/libultra/io/aigetlen.o"
include "$(BUILD_DIR)/src/libultra/mgu/translate.o" include "$(BUILD_DIR)/src/libultra/mgu/translate.o"
include "$(BUILD_DIR)/src/libultra/io/contramwrite.o" include "$(BUILD_DIR)/src/libultra/io/contramwrite.o"
#if !OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o"
include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/contramread.o" include "$(BUILD_DIR)/src/libultra/io/contramread.o"
include "$(BUILD_DIR)/src/libultra/io/crc.o" include "$(BUILD_DIR)/src/libultra/io/crc.o"
#if !OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/settimer.o" include "$(BUILD_DIR)/src/libultra/os/settimer.o"
#if !OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/spgetstat.o" include "$(BUILD_DIR)/src/libultra/io/spgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/spsetstat.o" include "$(BUILD_DIR)/src/libultra/io/spsetstat.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o" include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o"

View File

@ -105,7 +105,7 @@ void AudioMgr_ThreadEntry(void* arg) {
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue); IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue);
// Spin waiting for events // Spin waiting for events
while (true) { for (;;) {
osRecvMesg(&audioMgr->interruptQueue, (OSMesg*)&msg, OS_MESG_BLOCK); osRecvMesg(&audioMgr->interruptQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
switch (*msg) { switch (*msg) {

View File

@ -79,6 +79,7 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = {
SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET
}; };
#if OOT_DEBUG
/** /**
* original name: T_BGCheck_PosErrorCheck * original name: T_BGCheck_PosErrorCheck
*/ */
@ -94,6 +95,7 @@ s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) {
} }
return false; return false;
} }
#endif
/** /**
* Set SSNode * Set SSNode
@ -194,22 +196,15 @@ void BgCheck_Vec3fToVec3s(Vec3s* dst, Vec3f* src) {
* Get CollisionPoly's lowest y point * Get CollisionPoly's lowest y point
*/ */
s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vtxList) { s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vtxList) {
s32 a;
s32 b;
s32 c;
s16 min;
//! @bug Due to rounding errors, some polys with a slight slope have a y normal of 1.0f/-1.0f. As such, this //! @bug Due to rounding errors, some polys with a slight slope have a y normal of 1.0f/-1.0f. As such, this
//! optimization returns the wrong minimum y for a subset of these polys. //! optimization returns the wrong minimum y for a subset of these polys.
if (poly->normal.y == COLPOLY_SNORMAL(1.0f) || poly->normal.y == COLPOLY_SNORMAL(-1.0f)) { if (poly->normal.y == COLPOLY_SNORMAL(1.0f) || poly->normal.y == COLPOLY_SNORMAL(-1.0f)) {
return vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)].y; return vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)].y;
} } else {
s32 a = COLPOLY_VTX_INDEX(poly->flags_vIA);
a = COLPOLY_VTX_INDEX(poly->flags_vIA); s32 b = COLPOLY_VTX_INDEX(poly->flags_vIB);
b = COLPOLY_VTX_INDEX(poly->flags_vIB); s32 c = poly->vIC;
c = poly->vIC; s16 min = vtxList[a].y;
min = vtxList[a].y;
if (min > vtxList[b].y) { if (min > vtxList[b].y) {
min = vtxList[b].y; min = vtxList[b].y;
@ -219,6 +214,7 @@ s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vtxList) {
} }
return vtxList[c].y; return vtxList[c].y;
} }
}
/** /**
* CollisionPoly get unit normal * CollisionPoly get unit normal
@ -491,8 +487,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll
SSNode* curNode; SSNode* curNode;
SSNode* nextNode; SSNode* nextNode;
s32 polyYMin; s32 polyYMin;
u16 newNodeId;
s16 curPolyId; s16 curPolyId;
u16 newNodeId;
// if list is null // if list is null
if (ssList->head == SS_NULL) { if (ssList->head == SS_NULL) {
@ -514,6 +510,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll
while (true) { while (true) {
// if at the end of the list // if at the end of the list
if (curNode->next == SS_NULL) { if (curNode->next == SS_NULL) {
s32 pad;
newNodeId = SSNodeList_GetNextNodeIdx(&colCtx->polyNodes); newNodeId = SSNodeList_GetNextNodeIdx(&colCtx->polyNodes);
SSNode_SetValue(&colCtx->polyNodes.tbl[newNodeId], &polyId, SS_NULL); SSNode_SetValue(&colCtx->polyNodes.tbl[newNodeId], &polyId, SS_NULL);
curNode->next = newNodeId; curNode->next = newNodeId;
@ -681,8 +679,8 @@ s32 BgCheck_ComputeWallDisplacement(CollisionContext* colCtx, CollisionPoly* pol
s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ, s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ,
Vec3f* pos, f32 radius, CollisionPoly** outPoly) { Vec3f* pos, f32 radius, CollisionPoly** outPoly) {
Vec3f resultPos; Vec3f resultPos;
f32 temp_f2; f32 zTemp;
f32 temp_f2_2; f32 xTemp;
f32 planeDist; f32 planeDist;
f32 intersect; f32 intersect;
s32 result; s32 result;
@ -690,17 +688,14 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
CollisionPoly* polyList; CollisionPoly* polyList;
SSNode* curNode; SSNode* curNode;
f32 invNormalXZ; f32 invNormalXZ;
f32 zTemp;
f32 xTemp;
s32 polyId; s32 polyId;
f32 normalXZ; f32 normalXZ;
f32 nx; f32 nx;
f32 ny; f32 ny;
f32 nz; f32 nz;
f32 temp_f16; s32 pad;
Vec3s* vtxList; Vec3s* vtxList;
u16 pad; f32 temp_f16;
f32 zMin; f32 zMin;
f32 zMax; f32 zMax;
f32 xMin; f32 xMin;
@ -780,8 +775,10 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
} }
} }
if (CollisionPoly_CheckZIntersectApprox(curPoly, vtxList, resultPos.x, pos->y, &intersect)) { if (CollisionPoly_CheckZIntersectApprox(curPoly, vtxList, resultPos.x, pos->y, &intersect)) {
if (fabsf(intersect - resultPos.z) <= radius / temp_f16) { f32 zIntersectDist = intersect - resultPos.z;
if ((intersect - resultPos.z) * nz <= 4.0f) {
if (fabsf(zIntersectDist) <= radius / temp_f16) {
if (zIntersectDist * nz <= 4.0f) {
BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz, BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz,
invNormalXZ, planeDist, radius, outPoly); invNormalXZ, planeDist, radius, outPoly);
result = true; result = true;
@ -790,9 +787,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
} }
if (curNode->next == SS_NULL) { if (curNode->next == SS_NULL) {
break; break;
} else {
curNode = &colCtx->polyNodes.tbl[curNode->next];
} }
curNode = &colCtx->polyNodes.tbl[curNode->next];
} }
curNode = &colCtx->polyNodes.tbl[lookup->wall.head]; curNode = &colCtx->polyNodes.tbl[lookup->wall.head];
@ -861,8 +857,10 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
} }
} }
if (CollisionPoly_CheckXIntersectApprox(curPoly, vtxList, pos->y, resultPos.z, &intersect)) { if (CollisionPoly_CheckXIntersectApprox(curPoly, vtxList, pos->y, resultPos.z, &intersect)) {
if (fabsf(intersect - resultPos.x) <= radius / temp_f16) { f32 xIntersectDist = intersect - resultPos.x;
if ((intersect - resultPos.x) * nx <= 4.0f) {
if (fabsf(xIntersectDist) <= radius / temp_f16) {
if (xIntersectDist * nx <= 4.0f) {
BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz, BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz,
invNormalXZ, planeDist, radius, outPoly); invNormalXZ, planeDist, radius, outPoly);
result = true; result = true;
@ -871,10 +869,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
} }
if (curNode->next == SS_NULL) { if (curNode->next == SS_NULL) {
break; break;
} else {
curNode = &colCtx->polyNodes.tbl[curNode->next];
continue;
} }
curNode = &colCtx->polyNodes.tbl[curNode->next];
} }
*outX = resultPos.x; *outX = resultPos.x;
@ -909,6 +905,9 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte
*outY = pos->y; *outY = pos->y;
while (true) { while (true) {
f32 intersectDist;
f32 ny;
curPolyId = curNode->polyId; curPolyId = curNode->polyId;
if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) { if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) {
if (curNode->next == SS_NULL) { if (curNode->next == SS_NULL) {
@ -921,8 +920,8 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte
curPoly = &polyList[curPolyId]; curPoly = &polyList[curPolyId];
if (CollisionPoly_CheckYIntersectApprox2(curPoly, vtxList, pos->x, pos->z, &ceilingY)) { if (CollisionPoly_CheckYIntersectApprox2(curPoly, vtxList, pos->x, pos->z, &ceilingY)) {
f32 intersectDist = ceilingY - *outY; intersectDist = ceilingY - *outY;
f32 ny = COLPOLY_GET_NORMAL(curPoly->normal.y); ny = COLPOLY_GET_NORMAL(curPoly->normal.y);
if (intersectDist > 0.0f && intersectDist < checkHeight && intersectDist * ny <= 0) { if (intersectDist > 0.0f && intersectDist < checkHeight && intersectDist * ny <= 0) {
*outY = ceilingY - checkHeight; *outY = ceilingY - checkHeight;
@ -958,7 +957,6 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16
s32 result; s32 result;
f32 minY; f32 minY;
f32 distSq; f32 distSq;
s16 polyId;
result = false; result = false;
polyList = colCtx->colHeader->polyList; polyList = colCtx->colHeader->polyList;
@ -968,7 +966,8 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16
curNode = &colCtx->polyNodes.tbl[ssList->head]; curNode = &colCtx->polyNodes.tbl[ssList->head];
while (true) { while (true) {
polyId = curNode->polyId; s16 polyId = curNode->polyId;
checkedPoly = &colCtx->polyNodes.polyCheckTbl[polyId]; checkedPoly = &colCtx->polyNodes.polyCheckTbl[polyId];
if (*checkedPoly == true || COLPOLY_VTX_CHECK_FLAGS_ANY(polyList[polyId].flags_vIA, xpFlags1) || if (*checkedPoly == true || COLPOLY_VTX_CHECK_FLAGS_ANY(polyList[polyId].flags_vIA, xpFlags1) ||
@ -1051,13 +1050,12 @@ s32 BgCheck_SphVsFirstStaticPolyList(SSNode* node, u16 xpFlags, CollisionContext
CollisionPoly** outPoly) { CollisionPoly** outPoly) {
CollisionPoly* polyList = colCtx->colHeader->polyList; CollisionPoly* polyList = colCtx->colHeader->polyList;
Vec3s* vtxList = colCtx->colHeader->vtxList; Vec3s* vtxList = colCtx->colHeader->vtxList;
CollisionPoly* curPoly;
u16 nextId;
s16 curPolyId;
while (true) { while (true) {
curPolyId = node->polyId; u16 nextId;
curPoly = &polyList[curPolyId]; s16 curPolyId = node->polyId;
CollisionPoly* curPoly = &polyList[curPolyId];
if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) { if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) {
if (node->next == SS_NULL) { if (node->next == SS_NULL) {
break; break;
@ -1542,10 +1540,10 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
u32 tblMax; u32 tblMax;
u32 memSize; u32 memSize;
u32 lookupTblMemSize; u32 lookupTblMemSize;
SSNodeList* nodeList;
s32 useCustomSubdivisions;
u32 customMemSize;
s32 customNodeListMax; s32 customNodeListMax;
SSNodeList* nodeList;
u32 customMemSize;
s32 useCustomSubdivisions;
s32 i; s32 i;
colCtx->colHeader = colHeader; colCtx->colHeader = colHeader;
@ -1717,11 +1715,15 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla
if (checkPos.y < colCtx->minBounds.y) { if (checkPos.y < colCtx->minBounds.y) {
break; break;
} }
#if OOT_DEBUG
if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) { if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) {
if (actor != NULL) { if (actor != NULL) {
PRINTF("こいつ,pself_actor->name %d\n", actor->id); PRINTF("こいつ,pself_actor->name %d\n", actor->id);
} }
} }
#endif
lookup = BgCheck_GetStaticLookup(colCtx, lookupTbl, &checkPos); lookup = BgCheck_GetStaticLookup(colCtx, lookupTbl, &checkPos);
if (lookup == NULL) { if (lookup == NULL) {
checkPos.y -= colCtx->subdivLength.y; checkPos.y -= colCtx->subdivLength.y;
@ -1735,16 +1737,16 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla
checkPos.y -= colCtx->subdivLength.y; checkPos.y -= colCtx->subdivLength.y;
} }
dynaRaycastDown.play = play;
dynaRaycastDown.colCtx = colCtx; dynaRaycastDown.colCtx = colCtx;
dynaRaycastDown.xpFlags = xpFlags; dynaRaycastDown.xpFlags = xpFlags;
dynaRaycastDown.resultPoly = outPoly;
dynaRaycastDown.yIntersect = yIntersect; dynaRaycastDown.yIntersect = yIntersect;
dynaRaycastDown.pos = pos; dynaRaycastDown.pos = pos;
dynaRaycastDown.bgId = outBgId;
dynaRaycastDown.actor = actor; dynaRaycastDown.actor = actor;
dynaRaycastDown.downChkFlags = downChkFlags; dynaRaycastDown.downChkFlags = downChkFlags;
dynaRaycastDown.chkDist = chkDist; dynaRaycastDown.chkDist = chkDist;
dynaRaycastDown.play = play;
dynaRaycastDown.resultPoly = outPoly;
dynaRaycastDown.bgId = outBgId;
yIntersectDyna = BgCheck_RaycastDownDyna(&dynaRaycastDown); yIntersectDyna = BgCheck_RaycastDownDyna(&dynaRaycastDown);
@ -1951,11 +1953,11 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
Vec3f checkLinePrev; Vec3f checkLinePrev;
f32 n2XZDist; f32 n2XZDist;
f32 n3XZDist; f32 n3XZDist;
f32 nx3, nz3;
s32 bccFlags; s32 bccFlags;
f32 nx;
f32 nz;
Vec3f posIntersect2; Vec3f posIntersect2;
s32 bgId2; s32 bgId2;
f32 nx, ny, nz; // unit normal of polygon
result = false; result = false;
*outBgId = BGCHECK_SCENE; *outBgId = BGCHECK_SCENE;
@ -1966,12 +1968,14 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
dy = posNext->y - posPrev->y; dy = posNext->y - posPrev->y;
dz = posNext->z - posPrev->z; dz = posNext->z - posPrev->z;
#if OOT_DEBUG
if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true || if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true ||
BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) { BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) {
if (actor != NULL) { if (actor != NULL) {
PRINTF("こいつ,pself_actor->name %d\n", actor->id); PRINTF("こいつ,pself_actor->name %d\n", actor->id);
} }
} }
#endif
// if there's movement on the xz plane, and argA flag is 0, // if there's movement on the xz plane, and argA flag is 0,
if ((dx != 0.0f || dz != 0.0f) && (argA & 1) == 0) { if ((dx != 0.0f || dz != 0.0f) && (argA & 1) == 0) {
@ -1980,7 +1984,8 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
result = BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posNext, &posIntersect, &poly, result = BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posNext, &posIntersect, &poly,
&bgId, actor, 1.0f, BGCHECK_CHECK_ALL & ~BGCHECK_CHECK_CEILING); &bgId, actor, 1.0f, BGCHECK_CHECK_ALL & ~BGCHECK_CHECK_CEILING);
if (result) { if (result) {
ny = COLPOLY_GET_NORMAL(poly->normal.y); f32 ny = COLPOLY_GET_NORMAL(poly->normal.y);
// if poly is floor, push result underneath the floor // if poly is floor, push result underneath the floor
if (ny > 0.5f) { if (ny > 0.5f) {
posResult->x = posIntersect.x; posResult->x = posIntersect.x;
@ -2061,8 +2066,9 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
if (dynaPolyCollision == true || *outBgId != BGCHECK_SCENE) { if (dynaPolyCollision == true || *outBgId != BGCHECK_SCENE) {
if (BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posResult, &posIntersect2, &poly, if (BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posResult, &posIntersect2, &poly,
&bgId2, actor, 1.0f, BGCHECK_CHECK_ONE_FACE | BGCHECK_CHECK_WALL)) { &bgId2, actor, 1.0f, BGCHECK_CHECK_ONE_FACE | BGCHECK_CHECK_WALL)) {
nx3 = COLPOLY_GET_NORMAL(poly->normal.x); f32 nx3 = COLPOLY_GET_NORMAL(poly->normal.x);
nz3 = COLPOLY_GET_NORMAL(poly->normal.z); f32 nz3 = COLPOLY_GET_NORMAL(poly->normal.z);
n3XZDist = sqrtf(SQ(nx3) + SQ(nz3)); n3XZDist = sqrtf(SQ(nx3) + SQ(nz3));
// if poly is not a "flat" floor or "flat" ceiling // if poly is not a "flat" floor or "flat" ceiling
@ -2155,11 +2161,15 @@ s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, V
*outBgId = BGCHECK_SCENE; *outBgId = BGCHECK_SCENE;
*outY = pos->y; *outY = pos->y;
#if OOT_DEBUG
if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) { if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) {
if (actor != NULL) { if (actor != NULL) {
PRINTF("こいつ,pself_actor->name %d\n", actor->id); PRINTF("こいつ,pself_actor->name %d\n", actor->id);
} }
} }
#endif
lookupTbl = colCtx->lookupTbl; lookupTbl = colCtx->lookupTbl;
if (!BgCheck_PosInStaticBoundingBox(colCtx, pos)) { if (!BgCheck_PosInStaticBoundingBox(colCtx, pos)) {
return false; return false;
@ -2222,13 +2232,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
Vec3f posBTemp = *posB; Vec3f posBTemp = *posB;
Vec3f sectorMin; Vec3f sectorMin;
Vec3f sectorMax; Vec3f sectorMax;
s32 k;
StaticLookup* lookup;
s32 j;
StaticLookup* jLookup;
s32 temp_lo;
*outBgId = BGCHECK_SCENE; *outBgId = BGCHECK_SCENE;
#if OOT_DEBUG
if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true || if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true ||
BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) { BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) {
if (actor != NULL) { if (actor != NULL) {
@ -2237,6 +2244,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
PRINTF("pself_actor == NULLで犯人不明\n"); PRINTF("pself_actor == NULLで犯人不明\n");
} }
} }
#endif
BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->numPolygons); BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->numPolygons);
BgCheck_GetStaticLookupIndicesFromPos(colCtx, posA, (Vec3i*)&subdivMin); BgCheck_GetStaticLookupIndicesFromPos(colCtx, posA, (Vec3i*)&subdivMin);
@ -2247,6 +2255,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
*outPoly = NULL; *outPoly = NULL;
if (subdivMin[0] != subdivMax[0] || subdivMin[1] != subdivMax[1] || subdivMin[2] != subdivMax[2]) { if (subdivMin[0] != subdivMax[0] || subdivMin[1] != subdivMax[1] || subdivMin[2] != subdivMax[2]) {
s32 k;
s32 temp_lo;
s32 j;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (subdivMax[i] < subdivMin[i]) { if (subdivMax[i] < subdivMin[i]) {
j = subdivMax[i]; j = subdivMax[i];
@ -2260,12 +2272,14 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
sectorMax.z = colCtx->subdivLength.z + sectorMin.z; sectorMax.z = colCtx->subdivLength.z + sectorMin.z;
for (i = subdivMin[2]; i < subdivMax[2] + 1; i++) { for (i = subdivMin[2]; i < subdivMax[2] + 1; i++) {
jLookup = iLookup + subdivMin[1] * colCtx->subdivAmount.x; StaticLookup* jLookup = iLookup + subdivMin[1] * colCtx->subdivAmount.x;
sectorMin.y = subdivMin[1] * colCtx->subdivLength.y + colCtx->minBounds.y; sectorMin.y = subdivMin[1] * colCtx->subdivLength.y + colCtx->minBounds.y;
sectorMax.y = colCtx->subdivLength.y + sectorMin.y; sectorMax.y = colCtx->subdivLength.y + sectorMin.y;
for (j = subdivMin[1]; j < subdivMax[1] + 1; j++) { for (j = subdivMin[1]; j < subdivMax[1] + 1; j++) {
lookup = jLookup + subdivMin[0]; StaticLookup* lookup = jLookup + subdivMin[0];
sectorMin.x = subdivMin[0] * colCtx->subdivLength.x + colCtx->minBounds.x; sectorMin.x = subdivMin[0] * colCtx->subdivLength.x + colCtx->minBounds.x;
sectorMax.x = colCtx->subdivLength.x + sectorMin.x; sectorMax.x = colCtx->subdivLength.x + sectorMin.x;
@ -2443,11 +2457,14 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP
StaticLookup* lookup; StaticLookup* lookup;
*outBgId = BGCHECK_SCENE; *outBgId = BGCHECK_SCENE;
#if OOT_DEBUG
if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) { if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) {
if (actor != NULL) { if (actor != NULL) {
PRINTF("こいつ,pself_actor->name %d\n", actor->id); PRINTF("こいつ,pself_actor->name %d\n", actor->id);
} }
} }
#endif
lookup = BgCheck_GetStaticLookup(colCtx, colCtx->lookupTbl, center); lookup = BgCheck_GetStaticLookup(colCtx, colCtx->lookupTbl, center);
if (lookup == NULL) { if (lookup == NULL) {
@ -2784,12 +2801,12 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
PRINTF(VT_RST); PRINTF(VT_RST);
if (!DynaPoly_IsBgIdBgActor(bgId)) { if (!DynaPoly_IsBgIdBgActor(bgId)) {
#if OOT_DEBUG
if (bgId == -1) { if (bgId == -1) {
PRINTF(VT_FGCOL(GREEN)); PRINTF(VT_FGCOL(GREEN));
// "The index that should have been deleted(? ) was(== -1), processing aborted." // "The index that should have been deleted(? ) was(== -1), processing aborted."
PRINTF("DynaPolyInfo_delReserve():削除されているはずの(?)\nインデックス(== -1)のため,処理を中止します。\n"); PRINTF("DynaPolyInfo_delReserve():削除されているはずの(?)\nインデックス(== -1)のため,処理を中止します。\n");
PRINTF(VT_RST); PRINTF(VT_RST);
return;
} else { } else {
PRINTF(VT_FGCOL(RED)); PRINTF(VT_FGCOL(RED));
// "Unable to deallocate index / index unallocated, processing aborted." // "Unable to deallocate index / index unallocated, processing aborted."
@ -2797,9 +2814,10 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
"確保していない出来なかったインデックスの解放のため、処理を中止します。index == %d\n", "確保していない出来なかったインデックスの解放のため、処理を中止します。index == %d\n",
bgId); bgId);
PRINTF(VT_RST); PRINTF(VT_RST);
return;
}
} }
#endif
} else {
actor = DynaPoly_GetActor(&play->colCtx, bgId); actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) { if (actor != NULL) {
@ -2808,6 +2826,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
dyna->bgActorFlags[bgId] |= BGACTOR_1; dyna->bgActorFlags[bgId] |= BGACTOR_1;
} }
} }
}
void DynaPoly_InvalidateLookup(PlayState* play, DynaCollisionContext* dyna) { void DynaPoly_InvalidateLookup(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
@ -2821,7 +2840,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
MtxF mtx; MtxF mtx;
Actor* actor; Actor* actor;
s32 pad; s32 pad;
s32 pad2; f32 radiusSq;
f32 numVtxInverse; f32 numVtxInverse;
s32 i; s32 i;
Vec3f pos; Vec3f pos;
@ -2851,6 +2870,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
return; return;
} }
#if OOT_DEBUG
if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) { if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) {
PRINTF(VT_FGCOL(RED)); PRINTF(VT_FGCOL(RED));
// "do not use if %d exceeds %d" // "do not use if %d exceeds %d"
@ -2869,6 +2889,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
"pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687); "pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687);
ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices, ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices,
"pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688); "pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688);
#endif
if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) && if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) &&
(BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) { (BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) {
@ -2898,7 +2919,9 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
*polyStartIndex += pbgdata->numPolygons; *polyStartIndex += pbgdata->numPolygons;
*vtxStartIndex += pbgdata->numVertices; *vtxStartIndex += pbgdata->numVertices;
} else { return;
}
SkinMatrix_SetTranslateRotateYXZScale( SkinMatrix_SetTranslateRotateYXZScale(
&mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, &mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y,
dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x,
@ -2911,6 +2934,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
for (i = 0; i < pbgdata->numVertices; i++) { for (i = 0; i < pbgdata->numVertices; i++) {
Vec3f vtx; Vec3f vtx;
Vec3f vtxT; // Vtx after mtx transform Vec3f vtxT; // Vtx after mtx transform
s32 pad2;
Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]);
SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT); SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT);
@ -2937,8 +2961,6 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
newRadiusSq = -SQ(10.0f); newRadiusSq = -SQ(10.0f);
for (i = 0; i < pbgdata->numVertices; i++) { for (i = 0; i < pbgdata->numVertices; i++) {
f32 radiusSq;
newVtx.x = dyna->vtxList[*vtxStartIndex + i].x; newVtx.x = dyna->vtxList[*vtxStartIndex + i].x;
newVtx.y = dyna->vtxList[*vtxStartIndex + i].y; newVtx.y = dyna->vtxList[*vtxStartIndex + i].y;
newVtx.z = dyna->vtxList[*vtxStartIndex + i].z; newVtx.z = dyna->vtxList[*vtxStartIndex + i].z;
@ -2957,10 +2979,10 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
*newPoly = pbgdata->polyList[i]; *newPoly = pbgdata->polyList[i];
// Yeah, this is all kinds of fake, but my God, it matches. // Yeah, this is all kinds of fake, but my God, it matches.
newPoly->flags_vIA = (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex) | newPoly->flags_vIA =
COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIA); (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex) | COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIA);
newPoly->flags_vIB = (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex) | newPoly->flags_vIB =
COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB); (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex) | COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB);
newPoly->vIC = *vtxStartIndex + newPoly->vIC; newPoly->vIC = *vtxStartIndex + newPoly->vIC;
dVtxList = dyna->vtxList; dVtxList = dyna->vtxList;
vtxA.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].x; vtxA.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].x;
@ -3003,7 +3025,6 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
*polyStartIndex += pbgdata->numPolygons; *polyStartIndex += pbgdata->numPolygons;
*vtxStartIndex += pbgdata->numVertices; *vtxStartIndex += pbgdata->numVertices;
} }
}
void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna, Actor* actor) {
DynaPolyActor* dynaActor; DynaPolyActor* dynaActor;
@ -3155,7 +3176,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
s32 i2; s32 i2;
s32 isPaused; s32 isPaused;
DynaPolyActor* dynaActor; DynaPolyActor* dynaActor;
s32 pad; CollisionPoly* poly;
Vec3f polyVtx[3]; Vec3f polyVtx[3];
Vec3f polyNorm; Vec3f polyNorm;
u32 polyIndex; u32 polyIndex;
@ -3167,7 +3188,6 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
Vec3f vtx; Vec3f vtx;
f32 intersect; f32 intersect;
ScaleRotPos* curTransform; ScaleRotPos* curTransform;
CollisionPoly* poly;
result = BGCHECK_Y_MIN; result = BGCHECK_Y_MIN;
*dynaRaycastDown->bgId = BGCHECK_SCENE; *dynaRaycastDown->bgId = BGCHECK_SCENE;
@ -3239,9 +3259,12 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
vtxList = dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].colHeader->vtxList; vtxList = dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].colHeader->vtxList;
for (i2 = 0; i2 < 3; i2++) { for (i2 = 0; i2 < 3; i2++) {
s32 pad;
Math_Vec3s_ToVec3f(&vtx, &vtxList[COLPOLY_VTX_INDEX(poly->vtxData[i2])]); Math_Vec3s_ToVec3f(&vtx, &vtxList[COLPOLY_VTX_INDEX(poly->vtxData[i2])]);
SkinMatrix_Vec3fMtxFMultXYZ(&srpMtx, &vtx, &polyVtx[i2]); SkinMatrix_Vec3fMtxFMultXYZ(&srpMtx, &vtx, &polyVtx[i2]);
} }
Math3D_SurfaceNorm(&polyVtx[0], &polyVtx[1], &polyVtx[2], &polyNorm); Math3D_SurfaceNorm(&polyVtx[0], &polyVtx[1], &polyVtx[2], &polyNorm);
magnitude = Math3D_Vec3fMagnitude(&polyNorm); magnitude = Math3D_Vec3fMagnitude(&polyNorm);
@ -3290,8 +3313,6 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo
f32 invNormalXZ; f32 invNormalXZ;
f32 planeDist; f32 planeDist;
f32 temp_f18; f32 temp_f18;
f32 zIntersectDist;
f32 xIntersectDist;
f32 zMin; f32 zMin;
f32 zMax; f32 zMax;
f32 xMin; f32 xMin;
@ -3360,8 +3381,10 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo
} }
} }
if (CollisionPoly_CheckZIntersectApprox(poly, dyna->vtxList, resultPos.x, pos->y, &intersect)) { if (CollisionPoly_CheckZIntersectApprox(poly, dyna->vtxList, resultPos.x, pos->y, &intersect)) {
if (fabsf(intersect - resultPos.z) <= radius / temp_f18) { f32 zIntersectDist = intersect - resultPos.z;
if ((intersect - resultPos.z) * nz <= 4.0f) {
if (fabsf(zIntersectDist) <= radius / temp_f18) {
if (zIntersectDist * nz <= 4.0f) {
if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz, if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz,
invNormalXZ, planeDist, radius, outPoly)) { invNormalXZ, planeDist, radius, outPoly)) {
*outBgId = bgId; *outBgId = bgId;
@ -3434,7 +3457,8 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo
} }
if (CollisionPoly_CheckXIntersectApprox(poly, dyna->vtxList, pos->y, resultPos.z, &intersect)) { if (CollisionPoly_CheckXIntersectApprox(poly, dyna->vtxList, pos->y, resultPos.z, &intersect)) {
xIntersectDist = intersect - resultPos.x; f32 xIntersectDist = intersect - resultPos.x;
if (fabsf(xIntersectDist) <= radius / temp_f18) { if (fabsf(xIntersectDist) <= radius / temp_f18) {
if (xIntersectDist * nx <= 4.0f) { if (xIntersectDist * nx <= 4.0f) {
if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz, if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz,
@ -4223,6 +4247,8 @@ f32 sZorasDomainWaterBoxMaxZ = -967.0f;
s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) { WaterBox** outWaterBox) {
if (play->sceneId == SCENE_ZORAS_DOMAIN) { if (play->sceneId == SCENE_ZORAS_DOMAIN) {
s32 pad;
if (sZorasDomainWaterBoxMinX < x && x < sZorasDomainWaterBoxMaxX && sZorasDomainWaterBoxMinY < *ySurface && if (sZorasDomainWaterBoxMinX < x && x < sZorasDomainWaterBoxMaxX && sZorasDomainWaterBoxMinY < *ySurface &&
*ySurface < sZorasDomainWaterBoxMaxY && sZorasDomainWaterBoxMinZ < z && z < sZorasDomainWaterBoxMaxZ) { *ySurface < sZorasDomainWaterBoxMaxY && sZorasDomainWaterBoxMinZ < z && z < sZorasDomainWaterBoxMaxZ) {
*outWaterBox = &sZorasDomainWaterBox; *outWaterBox = &sZorasDomainWaterBox;

View File

@ -7048,12 +7048,16 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState
R_CAM_DATA(i) = sCamDataRegsInit[i]; R_CAM_DATA(i) = sCamDataRegsInit[i];
} }
#if OOT_DEBUG
DebugCamera_Reset(camera, &D_8015BD80); DebugCamera_Reset(camera, &D_8015BD80);
#endif
sInitRegs = false; sInitRegs = false;
PREG(88) = -1; PREG(88) = -1;
} }
camera->play = D_8015BD7C = play; camera->play = D_8015BD7C = play;
#if OOT_DEBUG
DebugCamera_Init(&D_8015BD80, camera); DebugCamera_Init(&D_8015BD80, camera);
#endif
curUID = sNextUID; curUID = sNextUID;
sNextUID++; sNextUID++;
while (curUID != 0) { while (curUID != 0) {
@ -7722,7 +7726,9 @@ Vec3s Camera_Update(Camera* camera) {
if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_START)) { if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_START)) {
gDebugCamEnabled ^= 1; gDebugCamEnabled ^= 1;
if (gDebugCamEnabled) { if (gDebugCamEnabled) {
#if OOT_DEBUG
DebugCamera_Enable(&D_8015BD80, camera); DebugCamera_Enable(&D_8015BD80, camera);
#endif
} else if (camera->play->csCtx.state != CS_STATE_IDLE) { } else if (camera->play->csCtx.state != CS_STATE_IDLE) {
Cutscene_StopManual(camera->play, &camera->play->csCtx); Cutscene_StopManual(camera->play, &camera->play->csCtx);
} }
@ -7731,7 +7737,9 @@ Vec3s Camera_Update(Camera* camera) {
// Debug cam update // Debug cam update
if (gDebugCamEnabled) { if (gDebugCamEnabled) {
camera->play->view.fovy = D_8015BD80.fov; camera->play->view.fovy = D_8015BD80.fov;
#if OOT_DEBUG
DebugCamera_Update(&D_8015BD80, camera); DebugCamera_Update(&D_8015BD80, camera);
#endif
View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
if (R_DEBUG_CAM_UPDATE) { if (R_DEBUG_CAM_UPDATE) {
PRINTF("camera: debug out\n"); PRINTF("camera: debug out\n");

View File

@ -40,6 +40,22 @@ Gfx sTransTileSetupDL[] = {
gsSPEndDisplayList(), gsSPEndDisplayList(),
}; };
#define SET_VERTEX(vtx, x, y, z, s, t, nx, ny, nz, alpha) \
{ \
Vtx_tn* vtxn = &(vtx)->n; \
vtxn->ob[0] = (x); \
vtxn->ob[1] = (y); \
vtxn->ob[2] = (z); \
vtxn->flag = 0; \
vtxn->tc[0] = (s); \
vtxn->tc[1] = (t); \
vtxn->n[0] = (nx); \
vtxn->n[1] = (ny); \
vtxn->n[2] = (nz); \
vtxn->a = (alpha); \
} \
(void)0
void TransitionTile_InitGraphics(TransitionTile* this) { void TransitionTile_InitGraphics(TransitionTile* this) {
s32 frame; s32 frame;
s32 col; s32 col;
@ -61,20 +77,7 @@ void TransitionTile_InitGraphics(TransitionTile* this) {
for (row = 0; row < this->rows + 1; row++) { for (row = 0; row < this->rows + 1; row++) {
colTex = 0; colTex = 0;
for (col = 0; col < this->cols + 1; col++) { for (col = 0; col < this->cols + 1; col++) {
Vtx_tn* vtxn = &vtx->n; SET_VERTEX(vtx++, col * 0x20, row * 0x20, -5, colTex << 6, rowTex << 6, 0, 0, 120, 255);
vtx++;
vtxn->tc[0] = colTex << 6;
vtxn->ob[0] = col * 0x20;
vtxn->ob[1] = row * 0x20;
vtxn->ob[2] = -5;
vtxn->flag = 0;
vtxn->tc[1] = rowTex << 6;
vtxn->n[0] = 0;
vtxn->n[1] = 0;
vtxn->n[2] = 120;
vtxn->a = 255;
colTex += 0x20; colTex += 0x20;
} }

View File

@ -62,7 +62,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) {
break; break;
case TRANS_FADE_TYPE_ONE_WAY: case TRANS_FADE_TYPE_ONE_WAY:
this->timer += updateRate; ((TransitionFade*)thisx)->timer += updateRate;
if (this->timer >= gSaveContext.transFadeDuration) { if (this->timer >= gSaveContext.transFadeDuration) {
this->timer = gSaveContext.transFadeDuration; this->timer = gSaveContext.transFadeDuration;
this->isDone = true; this->isDone = true;

View File

@ -162,6 +162,8 @@ void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, Ov
OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279);
if (1) {}
Matrix_Push(); Matrix_Push();
if ((overrideLimbDraw == NULL) || if ((overrideLimbDraw == NULL) ||

View File

@ -80,9 +80,10 @@ void KaleidoManager_Destroy(void) {
void* KaleidoManager_GetRamAddr(void* vram) { void* KaleidoManager_GetRamAddr(void* vram) {
KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl; KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl;
KaleidoMgrOverlay* ovl = iter; KaleidoMgrOverlay* ovl = iter;
u32 i;
if (ovl == NULL) { if (ovl == NULL) {
u32 i;
iter = &gKaleidoMgrOverlayTable[0]; iter = &gKaleidoMgrOverlayTable[0];
for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) { for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) {
if (((uintptr_t)vram >= (uintptr_t)iter->vramStart) && ((uintptr_t)iter->vramEnd >= (uintptr_t)vram)) { if (((uintptr_t)vram >= (uintptr_t)iter->vramStart) && ((uintptr_t)iter->vramEnd >= (uintptr_t)vram)) {

View File

@ -56,19 +56,25 @@ void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
if (IS_PAUSED(pauseCtx)) { if (IS_PAUSED(&play->pauseCtx)) {
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
if (Letterbox_GetSize() == 0) { if (Letterbox_GetSize() == 0) {
#if OOT_DEBUG
R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_HREG_MODE = HREG_MODE_UCODE_DISAS;
R_UCODE_DISAS_LOG_MODE = 3; R_UCODE_DISAS_LOG_MODE = 3;
#endif
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
pauseCtx->unk_1EC = 0; pauseCtx->unk_1EC = 0;
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER
} }
} else if (pauseCtx->state == PAUSE_STATE_8) { } else if (pauseCtx->state == PAUSE_STATE_8) {
#if OOT_DEBUG
R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_HREG_MODE = HREG_MODE_UCODE_DISAS;
R_UCODE_DISAS_LOG_MODE = 3; R_UCODE_DISAS_LOG_MODE = 3;
#endif
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
pauseCtx->unk_1EC = 0; pauseCtx->unk_1EC = 0;

View File

@ -20,7 +20,7 @@ void KaleidoSetup_Update(PlayState* play) {
(play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) { (play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) {
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
if (BREG(0)) { if (OOT_DEBUG && BREG(0)) {
pauseCtx->debugState = 3; pauseCtx->debugState = 3;
} }
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
@ -65,23 +65,20 @@ void KaleidoSetup_Update(PlayState* play) {
void KaleidoSetup_Init(PlayState* play) { void KaleidoSetup_Init(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
u64 temp = 0; // Necessary to match
pauseCtx->state = PAUSE_STATE_OFF; pauseCtx->state = PAUSE_STATE_OFF;
pauseCtx->debugState = 0; pauseCtx->debugState = 0;
pauseCtx->alpha = 0;
pauseCtx->unk_1EA = 0;
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
pauseCtx->mode = 0;
pauseCtx->pageIndex = PAUSE_ITEM;
pauseCtx->unk_1F4 = 160.0f; pauseCtx->eye.x = pauseCtx->eye.y = 0.0f;
pauseCtx->unk_1F8 = 160.0f;
pauseCtx->unk_1FC = 160.0f;
pauseCtx->unk_200 = 160.0f;
pauseCtx->eye.z = 64.0f; pauseCtx->eye.z = 64.0f;
pauseCtx->unk_1F0 = 936.0f; pauseCtx->unk_1F0 = 936.0f;
pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f;
pauseCtx->alpha = 0;
// mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM
pauseCtx->unk_1EA = pauseCtx->mainState = pauseCtx->mode = pauseCtx->pageIndex = 0;
pauseCtx->unk_204 = -314.0f; pauseCtx->unk_204 = -314.0f;
pauseCtx->cursorPoint[PAUSE_ITEM] = 0; pauseCtx->cursorPoint[PAUSE_ITEM] = 0;
@ -94,8 +91,8 @@ void KaleidoSetup_Init(PlayState* play) {
pauseCtx->cursorY[PAUSE_ITEM] = 0; pauseCtx->cursorY[PAUSE_ITEM] = 0;
pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorX[PAUSE_MAP] = 0;
pauseCtx->cursorY[PAUSE_MAP] = 0; pauseCtx->cursorY[PAUSE_MAP] = 0;
pauseCtx->cursorX[PAUSE_QUEST] = temp; pauseCtx->cursorX[PAUSE_QUEST] = 0;
pauseCtx->cursorY[PAUSE_QUEST] = temp; pauseCtx->cursorY[PAUSE_QUEST] = 0;
pauseCtx->cursorX[PAUSE_EQUIP] = 1; pauseCtx->cursorX[PAUSE_EQUIP] = 1;
pauseCtx->cursorY[PAUSE_EQUIP] = 0; pauseCtx->cursorY[PAUSE_EQUIP] = 0;

View File

@ -9,8 +9,10 @@ void func_8006EE50(Font* font, u16 arg1, u16 arg2) {
* at `codePointIndex`. The value of `character` is the ASCII codepoint subtract ' '/0x20. * at `codePointIndex`. The value of `character` is the ASCII codepoint subtract ' '/0x20.
*/ */
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) { void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
u8 charTmp = character;
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex],
(uintptr_t)_nes_font_staticSegmentRomStart + character * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE, (uintptr_t)_nes_font_staticSegmentRomStart + charTmp * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE,
"../z_kanfont.c", 93); "../z_kanfont.c", 93);
} }
@ -31,10 +33,7 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
* the font buffer. * the font buffer.
*/ */
void Font_LoadOrderedFont(Font* font) { void Font_LoadOrderedFont(Font* font) {
u8* fontBuf;
uintptr_t fontStatic;
s32 len; s32 len;
s32 jj;
s32 codePointIndex; s32 codePointIndex;
s32 fontBufIndex; s32 fontBufIndex;
u32 offset; u32 offset;
@ -44,23 +43,22 @@ void Font_LoadOrderedFont(Font* font) {
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len, DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len,
"../z_kanfont.c", 122); "../z_kanfont.c", 122);
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, jj = len);
len = jj; PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len * 1);
for (fontBufIndex = 0, codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
if (codePointIndex > len) { fontBufIndex = 0;
for (codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
if (codePointIndex > (len * 1)) {
PRINTF(" エラー!!! error───\n"); PRINTF(" エラー!!! error───\n");
return; return;
} }
if (font->msgBuf[codePointIndex] != MESSAGE_NEWLINE) { if (font->msgBuf[codePointIndex] != MESSAGE_NEWLINE) {
fontBuf = font->fontBuf + fontBufIndex * 8;
fontStatic = (uintptr_t)_nes_font_staticSegmentRomStart;
PRINTF("nes_mes_buf[%d]=%d\n", codePointIndex, font->msgBuf[codePointIndex]); PRINTF("nes_mes_buf[%d]=%d\n", codePointIndex, font->msgBuf[codePointIndex]);
offset = (font->msgBuf[codePointIndex] - ' ') * FONT_CHAR_TEX_SIZE; offset = (font->msgBuf[codePointIndex] - ' ') * FONT_CHAR_TEX_SIZE;
DMA_REQUEST_SYNC(fontBuf, fontStatic + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134); DMA_REQUEST_SYNC(font->fontBuf + fontBufIndex * 8, (uintptr_t)_nes_font_staticSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134);
fontBufIndex += FONT_CHAR_TEX_SIZE / 8; fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
} }
} }

View File

@ -252,7 +252,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
if (((void)0, gSaveContext.save.dayTime) > CLOCK_TIME(18, 0) || //! FAKE: (void)0 on CLOCK_TIME(18, 0)
if (((void)0, gSaveContext.save.dayTime) > ((void)0, CLOCK_TIME(18, 0)) ||
((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(6, 30)) { ((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(6, 30)) {
((void)0, gSaveContext.save.nightFlag = 1); ((void)0, gSaveContext.save.nightFlag = 1);
} else { } else {
@ -335,12 +336,17 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
envCtx->lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; envCtx->lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE;
envCtx->lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE; envCtx->lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE;
R_ENV_TIME_SPEED_OLD = gTimeSpeed = envCtx->sceneTimeSpeed = 0; envCtx->sceneTimeSpeed = 0;
gTimeSpeed = envCtx->sceneTimeSpeed;
#if OOT_DEBUG
R_ENV_TIME_SPEED_OLD = gTimeSpeed;
R_ENV_DISABLE_DBG = true; R_ENV_DISABLE_DBG = true;
if (CREG(3) != 0) { if (CREG(3) != 0) {
gSaveContext.chamberCutsceneNum = CREG(3) - 1; gSaveContext.chamberCutsceneNum = CREG(3) - 1;
} }
#endif
play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0;
play->envCtx.precipitation[PRECIP_RAIN_CUR] = 0; play->envCtx.precipitation[PRECIP_RAIN_CUR] = 0;
@ -405,6 +411,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
gSkyboxIsChanging = false; gSkyboxIsChanging = false;
gSaveContext.retainWeatherMode = false; gSaveContext.retainWeatherMode = false;
#if OOT_DEBUG
R_ENV_LIGHT1_DIR(0) = 80; R_ENV_LIGHT1_DIR(0) = 80;
R_ENV_LIGHT1_DIR(1) = 80; R_ENV_LIGHT1_DIR(1) = 80;
R_ENV_LIGHT1_DIR(2) = 80; R_ENV_LIGHT1_DIR(2) = 80;
@ -419,6 +426,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
cREG(12) = 0; cREG(12) = 0;
cREG(13) = 0; cREG(13) = 0;
cREG(14) = 0; cREG(14) = 0;
#endif
gUseCutsceneCam = true; gUseCutsceneCam = true;
for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) {
@ -512,10 +521,9 @@ u8 Environment_SmoothStepToS8(s8* pvalue, s8 target, u8 scale, u8 step, u8 minSt
f32 Environment_LerpWeight(u16 max, u16 min, u16 val) { f32 Environment_LerpWeight(u16 max, u16 min, u16 val) {
f32 diff = max - min; f32 diff = max - min;
f32 ret;
if (diff != 0.0f) { if (diff != 0.0f) {
ret = 1.0f - (max - val) / diff; f32 ret = 1.0f - (max - val) / diff;
if (!(ret >= 1.0f)) { if (!(ret >= 1.0f)) {
return ret; return ret;
@ -700,10 +708,12 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
} }
} }
#if OOT_DEBUG
if (newSkybox1Index == 0xFF) { if (newSkybox1Index == 0xFF) {
// "Environment VR data acquisition failed! Report to Sasaki!" // "Environment VR data acquisition failed! Report to Sasaki!"
PRINTF(VT_COL(RED, WHITE) "\n環境VRデータ取得失敗! ささきまでご報告を!" VT_RST); PRINTF(VT_COL(RED, WHITE) "\n環境VRデータ取得失敗! ささきまでご報告を!" VT_RST);
} }
#endif
if ((envCtx->skybox1Index != newSkybox1Index) && (envCtx->skyboxDmaState == SKYBOX_DMA_INACTIVE)) { if ((envCtx->skybox1Index != newSkybox1Index) && (envCtx->skyboxDmaState == SKYBOX_DMA_INACTIVE)) {
envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE1_START; envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE1_START;
@ -815,6 +825,7 @@ void Environment_DisableUnderwaterLights(PlayState* play) {
} }
} }
#if OOT_DEBUG
void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) {
GfxPrint printer; GfxPrint printer;
s32 pad[2]; s32 pad[2];
@ -869,6 +880,7 @@ void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) {
*gfx = GfxPrint_Close(&printer); *gfx = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer); GfxPrint_Destroy(&printer);
} }
#endif
void Environment_PlayTimeBasedSequence(PlayState* play); void Environment_PlayTimeBasedSequence(PlayState* play);
void Environment_UpdateRain(PlayState* play); void Environment_UpdateRain(PlayState* play);
@ -881,7 +893,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
u16 j; u16 j;
u16 time; u16 time;
EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList; EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList;
s32 adjustment; u8 blendRate;
if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) &&
(((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) {
@ -951,6 +963,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
gSaveContext.save.nightFlag = 0; gSaveContext.save.nightFlag = 0;
} }
#if OOT_DEBUG
if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) {
Gfx* displayList; Gfx* displayList;
Gfx* prevDisplayList; Gfx* prevDisplayList;
@ -967,19 +980,21 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
if (1) {} if (1) {}
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690); CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690);
} }
#endif
if ((envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) && if ((envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) &&
(envCtx->lightBlendOverride != LIGHT_BLEND_OVERRIDE_FULL_CONTROL) && (envCtx->lightBlendOverride != LIGHT_BLEND_OVERRIDE_FULL_CONTROL) &&
(envCtx->lightSetting != envCtx->lightSettingOverride) && (envCtx->lightBlend >= 1.0f) && (envCtx->lightSetting != envCtx->lightSettingOverride) && (envCtx->lightBlend >= 1.0f) &&
(envCtx->lightSettingOverride <= LIGHT_SETTING_MAX)) { (envCtx->lightSettingOverride <= LIGHT_SETTING_MAX)) {
envCtx->lightBlend = 0.0f;
envCtx->prevLightSetting = envCtx->lightSetting; envCtx->prevLightSetting = envCtx->lightSetting;
envCtx->lightSetting = envCtx->lightSettingOverride; envCtx->lightSetting = envCtx->lightSettingOverride;
envCtx->lightBlend = 0.0f;
} }
if (envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_FULL_CONTROL) { if (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_FULL_CONTROL) {
if ((envCtx->lightMode == LIGHT_MODE_TIME) && // Do nothing; Skip updating lights based on time or light settings
} else if ((envCtx->lightMode == LIGHT_MODE_TIME) &&
(envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) {
for (i = 0; i < ARRAY_COUNT(sTimeBasedLightConfigs[envCtx->lightConfig]); i++) { for (i = 0; i < ARRAY_COUNT(sTimeBasedLightConfigs[envCtx->lightConfig]); i++) {
if ((gSaveContext.skyboxTime >= sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime) && if ((gSaveContext.skyboxTime >= sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime) &&
@ -988,8 +1003,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
u8 blend8[2]; u8 blend8[2];
s16 blend16[2]; s16 blend16[2];
timeChangeBlend = timeChangeBlend = Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime,
Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime,
sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime, sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime,
((void)0, gSaveContext.skyboxTime)); ((void)0, gSaveContext.skyboxTime));
@ -1019,11 +1033,10 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
blend8[1] = LERP( blend8[1] = LERP(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
.ambientColor[j], .ambientColor[j],
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.nextLightSetting]
.ambientColor[j], .ambientColor[j],
timeChangeBlend); timeChangeBlend);
*(envCtx->lightSettings.ambientColor + j) = LERP(blend8[0], blend8[1], configChangeBlend); envCtx->lightSettings.ambientColor[j] = LERP(blend8[0], blend8[1], configChangeBlend);
} }
// set light1 direction for the sun // set light1 direction for the sun
@ -1050,11 +1063,10 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
blend8[1] = LERP( blend8[1] = LERP(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
.light1Color[j], .light1Color[j],
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.nextLightSetting]
.light1Color[j], .light1Color[j],
timeChangeBlend); timeChangeBlend);
*(envCtx->lightSettings.light1Color + j) = LERP(blend8[0], blend8[1], configChangeBlend); envCtx->lightSettings.light1Color[j] = LERP(blend8[0], blend8[1], configChangeBlend);
// blend light2Color // blend light2Color
blend8[0] = blend8[0] =
@ -1066,33 +1078,30 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
blend8[1] = LERP( blend8[1] = LERP(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
.light2Color[j], .light2Color[j],
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.nextLightSetting]
.light2Color[j], .light2Color[j],
timeChangeBlend); timeChangeBlend);
*(envCtx->lightSettings.light2Color + j) = LERP(blend8[0], blend8[1], configChangeBlend); envCtx->lightSettings.light2Color[j] = LERP(blend8[0], blend8[1], configChangeBlend);
} }
// blend fogColor // blend fogColor
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
blend8[0] = blend8[0] = LERP(
LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].fogColor[j],
.fogColor[j],
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting]
.fogColor[j], .fogColor[j],
timeChangeBlend); timeChangeBlend);
blend8[1] = LERP( blend8[1] = LERP(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
.fogColor[j], .fogColor[j],
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.nextLightSetting]
.fogColor[j], .fogColor[j],
timeChangeBlend); timeChangeBlend);
*(envCtx->lightSettings.fogColor + j) = LERP(blend8[0], blend8[1], configChangeBlend); envCtx->lightSettings.fogColor[j] = LERP(blend8[0], blend8[1], configChangeBlend);
} }
blend16[0] = LERP16( blend16[0] =
ENV_LIGHT_SETTINGS_FOG_NEAR( LERP16(ENV_LIGHT_SETTINGS_FOG_NEAR(
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting]
.blendRateAndFogNear), .blendRateAndFogNear),
ENV_LIGHT_SETTINGS_FOG_NEAR( ENV_LIGHT_SETTINGS_FOG_NEAR(
@ -1104,26 +1113,25 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
.blendRateAndFogNear), .blendRateAndFogNear),
ENV_LIGHT_SETTINGS_FOG_NEAR( ENV_LIGHT_SETTINGS_FOG_NEAR(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.nextLightSetting]
.blendRateAndFogNear), .blendRateAndFogNear),
timeChangeBlend); timeChangeBlend);
envCtx->lightSettings.fogNear = LERP16(blend16[0], blend16[1], configChangeBlend); envCtx->lightSettings.fogNear = LERP16(blend16[0], blend16[1], configChangeBlend);
blend16[0] = LERP16( blend16[0] =
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar, LERP16(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar,
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting].zFar, lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting].zFar,
timeChangeBlend); timeChangeBlend);
blend16[1] = LERP16( blend16[1] = LERP16(
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting].zFar,
.zFar,
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
.zFar, .zFar,
timeChangeBlend); timeChangeBlend);
envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend); envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend);
#if OOT_DEBUG
if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >= if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >=
envCtx->numLightSettings) { envCtx->numLightSettings) {
// "The color palette setting seems to be wrong!" // "The color palette setting seems to be wrong!"
@ -1134,6 +1142,8 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting, sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting,
envCtx->numLightSettings - 1); envCtx->numLightSettings - 1);
} }
#endif
break; break;
} }
} }
@ -1153,7 +1163,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
envCtx->lightSettings.zFar = lightSettingsList[envCtx->lightSetting].zFar; envCtx->lightSettings.zFar = lightSettingsList[envCtx->lightSetting].zFar;
envCtx->lightBlend = 1.0f; envCtx->lightBlend = 1.0f;
} else { } else {
u8 blendRate = blendRate =
ENV_LIGHT_SETTINGS_BLEND_RATE_U8(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear); ENV_LIGHT_SETTINGS_BLEND_RATE_U8(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear);
if (blendRate == 0) { if (blendRate == 0) {
@ -1192,15 +1202,16 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
LERP(lightSettingsList[envCtx->prevLightSetting].fogColor[i], LERP(lightSettingsList[envCtx->prevLightSetting].fogColor[i],
lightSettingsList[envCtx->lightSetting].fogColor[i], envCtx->lightBlend); lightSettingsList[envCtx->lightSetting].fogColor[i], envCtx->lightBlend);
} }
envCtx->lightSettings.fogNear = LERP16(
ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->prevLightSetting].blendRateAndFogNear), envCtx->lightSettings.fogNear =
LERP16(ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->prevLightSetting].blendRateAndFogNear),
ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear), ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear),
envCtx->lightBlend); envCtx->lightBlend);
envCtx->lightSettings.zFar = envCtx->lightSettings.zFar = LERP16(lightSettingsList[envCtx->prevLightSetting].zFar,
LERP16(lightSettingsList[envCtx->prevLightSetting].zFar,
lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend); lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend);
} }
#if OOT_DEBUG
if (envCtx->lightSetting >= envCtx->numLightSettings) { if (envCtx->lightSetting >= envCtx->numLightSettings) {
// "The color palette seems to be wrong!" // "The color palette seems to be wrong!"
PRINTF("\n" VT_FGCOL(RED) "カラーパレットがおかしいようです!"); PRINTF("\n" VT_FGCOL(RED) "カラーパレットがおかしいようです!");
@ -1209,7 +1220,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
PRINTF("\n" VT_FGCOL(YELLOW) "設定パレット=[%d] パレット数=[%d]\n" VT_RST, envCtx->lightSetting, PRINTF("\n" VT_FGCOL(YELLOW) "設定パレット=[%d] パレット数=[%d]\n" VT_RST, envCtx->lightSetting,
envCtx->numLightSettings); envCtx->numLightSettings);
} }
} #endif
} }
envCtx->lightBlendEnabled = true; envCtx->lightBlendEnabled = true;
@ -1261,22 +1272,20 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
envCtx->dirLight2.params.dir.z = envCtx->lightSettings.light2Dir[2]; envCtx->dirLight2.params.dir.z = envCtx->lightSettings.light2Dir[2];
// Adjust fog near and far if necessary // Adjust fog near and far if necessary
adjustment = envCtx->lightSettings.fogNear + envCtx->adjFogNear;
if (adjustment <= ENV_FOGNEAR_MAX) { if ((envCtx->lightSettings.fogNear + envCtx->adjFogNear) <= ENV_FOGNEAR_MAX) {
lightCtx->fogNear = adjustment; lightCtx->fogNear = envCtx->lightSettings.fogNear + envCtx->adjFogNear;
} else { } else {
lightCtx->fogNear = ENV_FOGNEAR_MAX; lightCtx->fogNear = ENV_FOGNEAR_MAX;
} }
adjustment = envCtx->lightSettings.zFar + envCtx->adjZFar; if ((envCtx->lightSettings.zFar + envCtx->adjZFar) <= ENV_ZFAR_MAX) {
lightCtx->zFar = envCtx->lightSettings.zFar + envCtx->adjZFar;
if (adjustment <= ENV_ZFAR_MAX) {
lightCtx->zFar = adjustment;
} else { } else {
lightCtx->zFar = ENV_ZFAR_MAX; lightCtx->zFar = ENV_ZFAR_MAX;
} }
#if OOT_DEBUG
// When environment debug is enabled, various environment related variables can be configured via the reg editor // When environment debug is enabled, various environment related variables can be configured via the reg editor
if (R_ENV_DISABLE_DBG) { if (R_ENV_DISABLE_DBG) {
R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0]; R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0];
@ -1357,6 +1366,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
envCtx->windDirection.z = R_ENV_WIND_DIR(2); envCtx->windDirection.z = R_ENV_WIND_DIR(2);
envCtx->windSpeed = R_ENV_WIND_SPEED; envCtx->windSpeed = R_ENV_WIND_SPEED;
} }
#endif
if ((envCtx->dirLight1.params.dir.x == 0) && (envCtx->dirLight1.params.dir.y == 0) && if ((envCtx->dirLight1.params.dir.x == 0) && (envCtx->dirLight1.params.dir.y == 0) &&
(envCtx->dirLight1.params.dir.z == 0)) { (envCtx->dirLight1.params.dir.z == 0)) {
@ -2366,9 +2376,6 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) {
Color_RGBA8 envColor; Color_RGBA8 envColor;
s32 pad; s32 pad;
f32 sp98; f32 sp98;
u16 sp96;
u16 sp94;
u16 sp92;
switch (sandstormState) { switch (sandstormState) {
case SANDSTORM_ACTIVE: case SANDSTORM_ACTIVE:
@ -2475,9 +2482,10 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) {
envColor.g = ((envColor.g * sp98) + ((6.0f - sp98) * primColor.g)) * (1.0f / 6.0f); envColor.g = ((envColor.g * sp98) + ((6.0f - sp98) * primColor.g)) * (1.0f / 6.0f);
envColor.b = ((envColor.b * sp98) + ((6.0f - sp98) * primColor.b)) * (1.0f / 6.0f); envColor.b = ((envColor.b * sp98) + ((6.0f - sp98) * primColor.b)) * (1.0f / 6.0f);
sp96 = (s32)(sSandstormScroll * (11.0f / 6.0f)); {
sp94 = (s32)(sSandstormScroll * (9.0f / 6.0f)); u16 sp96 = (s32)(sSandstormScroll * (11.0f / 6.0f));
sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f)); u16 sp94 = (s32)(sSandstormScroll * (9.0f / 6.0f));
u16 sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f));
OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4044); OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4044);
@ -2488,12 +2496,13 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA);
gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA); gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA);
gSPSegment(POLY_XLU_DISP++, 0x08, gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1, (u32)sp94 % 4096, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1,
4095 - ((u32)sp92 % 4096), 256, 64)); (u32)sp94 % 4096, 4095 - ((u32)sp92 % 4096), 256, 64));
gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE);
gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068); CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068);
}
sSandstormScroll += (s32)sp98; sSandstormScroll += (s32)sp98;
} }

View File

@ -118,8 +118,8 @@ void MapMark_DrawForDungeon(PlayState* play) {
markInfo->textureWidth, markInfo->textureHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, markInfo->textureWidth, markInfo->textureHeight, 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); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
rectLeft = (GREG(94) + markPoint->x + 204) << 2; rectLeft = ((OOT_DEBUG ? GREG(94) : 0) + markPoint->x + 204) << 2;
rectTop = (GREG(95) + markPoint->y + 140) << 2; rectTop = ((OOT_DEBUG ? GREG(95) : 0) + markPoint->y + 140) << 2;
gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft,
rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx, rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx,
markInfo->dtdy); markInfo->dtdy);

View File

@ -1246,23 +1246,33 @@ Gfx* Gfx_SetupDL_69NoCD(Gfx* gfx) {
return gfx; return gfx;
} }
#if OOT_DEBUG
#define HREG_21 HREG(21)
#define HREG_22 HREG(22)
#else
#define HREG_21 0
#define HREG_22 0
#endif
Gfx* func_800947AC(Gfx* gfx) { Gfx* func_800947AC(Gfx* gfx) {
gSPDisplayList(gfx++, sSetupDL[SETUPDL_65]); gSPDisplayList(gfx++, sSetupDL[SETUPDL_65]);
gDPSetColorDither(gfx++, G_CD_DISABLE); gDPSetColorDither(gfx++, G_CD_DISABLE);
// clang-format off // clang-format off
switch (HREG(21)) { switch (HREG_21) {
case 1: gDPSetAlphaDither(gfx++, G_AD_DISABLE); break; case 1: gDPSetAlphaDither(gfx++, G_AD_DISABLE); break;
case 2: gDPSetAlphaDither(gfx++, G_AD_PATTERN); break; case 2: gDPSetAlphaDither(gfx++, G_AD_PATTERN); break;
case 3: gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN); break; case 3: gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN); break;
case 4: gDPSetAlphaDither(gfx++, G_AD_NOISE); break; case 4: gDPSetAlphaDither(gfx++, G_AD_NOISE); break;
default: break;
} }
switch (HREG(22)) { switch (HREG_22) {
case 1: gDPSetColorDither(gfx++, G_CD_DISABLE); break; case 1: gDPSetColorDither(gfx++, G_CD_DISABLE); break;
case 2: gDPSetColorDither(gfx++, G_CD_MAGICSQ); break; case 2: gDPSetColorDither(gfx++, G_CD_MAGICSQ); break;
case 3: gDPSetColorDither(gfx++, G_CD_BAYER); break; case 3: gDPSetColorDither(gfx++, G_CD_BAYER); break;
case 4: gDPSetColorDither(gfx++, G_CD_NOISE); break; case 4: gDPSetColorDither(gfx++, G_CD_NOISE); break;
default: break;
} }
// clang-format on // clang-format on
@ -1472,6 +1482,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) {
s32 letterboxSize = Letterbox_GetSize(); s32 letterboxSize = Letterbox_GetSize();
#if OOT_DEBUG
if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) { if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) {
if (R_SETUP_FRAME_INIT != 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); R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG);
@ -1514,6 +1525,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
b = R_SETUP_FRAME_BASE_COLOR_B; b = R_SETUP_FRAME_BASE_COLOR_B;
} }
} }
#endif
// Set the whole z buffer to maximum depth // Set the whole z buffer to maximum depth
// Don't bother with pixels that are being covered by the letterbox // Don't bother with pixels that are being covered by the letterbox

View File

@ -152,6 +152,7 @@ void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton,
} }
(*mtx)++; (*mtx)++;
} else if (limbDList != NULL) { } else if (limbDList != NULL) {
if (1) {}
MATRIX_TO_MTX(*mtx, "../z_skelanime.c", 954); MATRIX_TO_MTX(*mtx, "../z_skelanime.c", 954);
(*mtx)++; (*mtx)++;
} }
@ -366,6 +367,7 @@ void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton,
gSPDisplayList(POLY_OPA_DISP++, newDList); gSPDisplayList(POLY_OPA_DISP++, newDList);
(*limbMatrices)++; (*limbMatrices)++;
} else if (limbDList != NULL) { } else if (limbDList != NULL) {
if (1) {}
MATRIX_TO_MTX(*limbMatrices, "../z_skelanime.c", 1249); MATRIX_TO_MTX(*limbMatrices, "../z_skelanime.c", 1249);
(*limbMatrices)++; (*limbMatrices)++;
} }
@ -467,7 +469,7 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount
u16 staticIndexMax = animHeader->staticIndexMax; u16 staticIndexMax = animHeader->staticIndexMax;
s32 i; s32 i;
for (i = 0; i < limbCount; i++, frameTable++, jointIndices++) { for (i = 0; i < limbCount; i++) {
if ((frameTable == NULL) || (jointIndices == NULL) || (dynamicData == NULL) || (staticData == NULL)) { if ((frameTable == NULL) || (jointIndices == NULL) || (dynamicData == NULL) || (staticData == NULL)) {
LOG_ADDRESS("out", frameTable, "../z_skelanime.c", 1392); LOG_ADDRESS("out", frameTable, "../z_skelanime.c", 1392);
LOG_ADDRESS("ref_tbl", jointIndices, "../z_skelanime.c", 1393); LOG_ADDRESS("ref_tbl", jointIndices, "../z_skelanime.c", 1393);
@ -481,6 +483,8 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount
(jointIndices->y >= staticIndexMax) ? dynamicData[jointIndices->y] : staticData[jointIndices->y]; (jointIndices->y >= staticIndexMax) ? dynamicData[jointIndices->y] : staticData[jointIndices->y];
frameTable->z = frameTable->z =
(jointIndices->z >= staticIndexMax) ? dynamicData[jointIndices->z] : staticData[jointIndices->z]; (jointIndices->z >= staticIndexMax) ? dynamicData[jointIndices->z] : staticData[jointIndices->z];
jointIndices++;
frameTable++;
} }
} }
@ -1024,10 +1028,11 @@ void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) {
AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp, AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp,
AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor, AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor,
}; };
AnimationEntry* entry; AnimationEntry* entry = animationCtx->entries;
for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { for (; animationCtx->animationCount != 0; animationCtx->animationCount--) {
animFuncs[entry->type](play, &entry->data); animFuncs[entry->type](play, &entry->data);
entry++;
} }
sAnimQueueFlags = 1; sAnimQueueFlags = 1;

View File

@ -511,8 +511,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
gSaveContext.save.info.checksum = 0; gSaveContext.save.info.checksum = 0;
ptr = (u16*)&gSaveContext; ptr = (u16*)&gSaveContext;
checksum = 0; checksum = j = 0;
j = 0;
for (offset = 0; offset < CHECKSUM_SIZE; offset++) { for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
if (++j == 0x20) { if (++j == 0x20) {
@ -618,6 +617,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
bzero(&gSaveContext.save.totalDays, sizeof(s32)); bzero(&gSaveContext.save.totalDays, sizeof(s32));
bzero(&gSaveContext.save.bgsDayCount, sizeof(s32)); bzero(&gSaveContext.save.bgsDayCount, sizeof(s32));
#if OOT_DEBUG
if (!slotNum) { if (!slotNum) {
Sram_InitDebugSave(); Sram_InitDebugSave();
gSaveContext.save.info.playerData.newf[0] = 'Z'; gSaveContext.save.info.playerData.newf[0] = 'Z';
@ -633,6 +633,9 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
} else { } else {
Sram_InitNewSave(); Sram_InitNewSave();
} }
#else
Sram_InitNewSave();
#endif
ptr = (u16*)&gSaveContext; ptr = (u16*)&gSaveContext;
PRINTF("\n--------------------------------------------------------------\n"); PRINTF("\n--------------------------------------------------------------\n");
@ -718,20 +721,26 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
u16* ptr; u16* ptr;
u16 checksum; u16 checksum;
#if OOT_DEBUG
if (fileSelect->buttonIndex != 0) { if (fileSelect->buttonIndex != 0) {
Sram_InitNewSave(); Sram_InitNewSave();
} else { } else {
Sram_InitDebugSave(); Sram_InitDebugSave();
} }
#else
Sram_InitNewSave();
#endif
gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0; gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0;
gSaveContext.save.linkAge = LINK_AGE_CHILD; gSaveContext.save.linkAge = LINK_AGE_CHILD;
gSaveContext.save.dayTime = CLOCK_TIME(10, 0); gSaveContext.save.dayTime = CLOCK_TIME(10, 0);
gSaveContext.save.cutsceneIndex = 0xFFF1; gSaveContext.save.cutsceneIndex = 0xFFF1;
#if OOT_DEBUG
if (fileSelect->buttonIndex == 0) { if (fileSelect->buttonIndex == 0) {
gSaveContext.save.cutsceneIndex = 0; gSaveContext.save.cutsceneIndex = 0;
} }
#endif
for (offset = 0; offset < 8; offset++) { for (offset = 0; offset < 8; offset++) {
gSaveContext.save.info.playerData.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset]; gSaveContext.save.info.playerData.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset];
@ -753,10 +762,8 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
PRINTF("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"); PRINTF("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
ptr = (u16*)&gSaveContext; ptr = (u16*)&gSaveContext;
j = 0;
checksum = 0;
for (offset = 0; offset < CHECKSUM_SIZE; offset++) { for (j = 0, checksum = 0, offset = 0; offset < CHECKSUM_SIZE; offset++) {
PRINTF("%x ", *ptr); PRINTF("%x ", *ptr);
checksum += *ptr++; checksum += *ptr++;
if (++j == 0x20) { if (++j == 0x20) {
@ -893,6 +900,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
Sram_WriteSramHeader(sramCtx); Sram_WriteSramHeader(sramCtx);
} }
#if OOT_DEBUG
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) { if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
bzero(sramCtx->readBuff, SRAM_SIZE); bzero(sramCtx->readBuff, SRAM_SIZE);
for (i = 0; i < CHECKSUM_SIZE; i++) { for (i = 0; i < CHECKSUM_SIZE; i++) {
@ -901,6 +909,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE); SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
PRINTF("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !" PRINTF("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
} }
#endif
// "GOOD! GOOD! Size = %d + %d = %d" // "GOOD! GOOD! Size = %d + %d = %d"
PRINTF(" サイズ=%d + %d %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4); PRINTF(" サイズ=%d + %d %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4);

View File

@ -9,7 +9,7 @@ typedef struct {
SsSramContext sSsSramContext = { 0 }; SsSramContext sSsSramContext = { 0 };
void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration,
u8 handlePulse, u32 handleSpeed) { u8 handlePulse, u32 handleSpeed) {
u32 prevInt; u32 prevInt;
OSPiHandle* handle = &sSsSramContext.piHandle; OSPiHandle* handle = &sSsSramContext.piHandle;
@ -49,7 +49,7 @@ void SsSram_Dma(void* dramAddr, size_t size, s32 direction) {
osInvalDCache(dramAddr, size); osInvalDCache(dramAddr, size);
} }
void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction) { void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction) {
PRINTF("ssSRAMReadWrite:%08x %08x %08x %d\n", addr, dramAddr, size, direction); PRINTF("ssSRAMReadWrite:%08x %08x %08x %d\n", addr, dramAddr, size, direction);
SsSram_Init(addr, DEVICE_TYPE_SRAM, PI_DOMAIN2, 5, 0xD, 2, 0xC, 0); SsSram_Init(addr, DEVICE_TYPE_SRAM, PI_DOMAIN2, 5, 0xD, 2, 0xC, 0);
SsSram_Dma(dramAddr, size, direction); SsSram_Dma(dramAddr, size, direction);

View File

@ -47,14 +47,18 @@ extern u16 D_0E000000[];
void VisZBuf_Init(VisZBuf* this) { void VisZBuf_Init(VisZBuf* this) {
this->vis.type = VIS_ZBUF_TYPE_IA; this->vis.type = VIS_ZBUF_TYPE_IA;
this->vis.scissorType = VIS_NO_SETSCISSOR; this->vis.scissorType = VIS_NO_SETSCISSOR;
this->vis.primColor.r = 255; this->vis.primColor.r = 255;
this->vis.primColor.g = 255; this->vis.primColor.g = 255;
this->vis.primColor.b = 255; this->vis.primColor.b = 255;
this->vis.primColor.a = 255; this->vis.primColor.a = 255;
// clang-format off
this->vis.envColor.r = 0; \
this->vis.envColor.g = 0; \
this->vis.envColor.b = 0; \
this->vis.envColor.a = 255; this->vis.envColor.a = 255;
this->vis.envColor.r = 0; // clang-format on
this->vis.envColor.g = 0;
this->vis.envColor.b = 0;
} }
void VisZBuf_Destroy(VisZBuf* this) { void VisZBuf_Destroy(VisZBuf* this) {

View File

@ -139,25 +139,6 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
Actor* touchedActor;
Actor* grabbed;
Vec3f bodyDistDiffVec;
Vec3f newPos;
f32 bodyDistDiff;
f32 phi_f16;
DynaPolyActor* dynaPolyActor;
f32 curGrabbedDist;
f32 grabbedDist;
s32 pad;
CollisionPoly* poly;
s32 bgId;
Vec3f intersectPos;
Vec3f prevFrameDiff;
Vec3f sp60;
f32 polyNormalX;
f32 polyNormalZ;
f32 velocity;
s32 pad1;
if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) { if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) {
ArmsHook_DetachHookFromActor(this); ArmsHook_DetachHookFromActor(this);
@ -170,7 +151,8 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) && if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) &&
(this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) { (this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) {
touchedActor = this->collider.base.at; 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_9 | ACTOR_FLAG_10))) {
if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) { if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) {
ArmsHook_AttachHookToActor(this, touchedActor); ArmsHook_AttachHookToActor(this, touchedActor);
@ -182,7 +164,20 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
this->timer = 0; this->timer = 0;
Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else if (DECR(this->timer) == 0) { return;
}
if (DECR(this->timer) == 0) {
Actor* grabbed;
Vec3f bodyDistDiffVec;
Vec3f newPos;
f32 bodyDistDiff;
f32 phi_f16;
s32 pad1;
f32 curGrabbedDist;
f32 grabbedDist;
f32 velocity;
grabbed = this->grabbed; grabbed = this->grabbed;
if (grabbed != NULL) { if (grabbed != NULL) {
if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) { if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) {
@ -250,6 +245,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
} }
} }
} else { } else {
CollisionPoly* poly;
s32 bgId;
Vec3f intersectPos;
Vec3f prevFrameDiff;
Vec3f sp60;
Actor_MoveXZGravity(&this->actor); Actor_MoveXZGravity(&this->actor);
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff); Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8); Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8);
@ -260,13 +261,17 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true, if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true,
&bgId) && &bgId) &&
!func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) { !func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) {
polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); f32 polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x);
polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); f32 polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z);
s32 pad;
Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos); Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos);
this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.x += 10.0f * polyNormalX;
this->actor.world.pos.z += 10.0f * polyNormalZ; this->actor.world.pos.z += 10.0f * polyNormalZ;
this->timer = 0; this->timer = 0;
if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) { if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) {
DynaPolyActor* dynaPolyActor;
if (bgId != BGCHECK_SCENE) { if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) { if (dynaPolyActor != NULL) {
@ -308,6 +313,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) {
OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850); OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850);
if (1) {}
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
Matrix_MultVec3f(&D_80865B88, &hookNewTip); Matrix_MultVec3f(&D_80865B88, &hookNewTip);

View File

@ -90,17 +90,21 @@ static InitChainEntry sInitChain[] = {
static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f };
void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s16 pad1; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s16 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) {

View File

@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
} }
if (givingReward) { if (givingReward) {
if (!IS_CUTSCENE_LAYER) { if (!IS_CUTSCENE_LAYER || !OOT_DEBUG) {
if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
switch (this->fountainType) { switch (this->fountainType) {
case FAIRY_SPELL_FARORES_WIND: case FAIRY_SPELL_FARORES_WIND:

View File

@ -97,12 +97,11 @@ void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) {
void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
Actor* prop; Actor* prop;
BgGanonOtyuka* platform; s16 i;
f32 dx; f32 dx;
f32 dy; f32 dy;
f32 dz; f32 dz;
Vec3f center; Vec3f center;
s16 i;
if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) {
PRINTF("OTC O 1\n"); PRINTF("OTC O 1\n");
@ -113,9 +112,8 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) {
prop = prop->next; prop = prop->next;
continue; continue;
} } else {
BgGanonOtyuka* platform = (BgGanonOtyuka*)prop;
platform = (BgGanonOtyuka*)prop;
dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x; dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x;
dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y; dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y;
@ -124,10 +122,10 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) { if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) {
platform->visibleSides |= sSides[i]; platform->visibleSides |= sSides[i];
break; break;
} else {
prop = prop->next;
} }
} }
prop = prop->next;
}
} }
PRINTF("OTC O 2\n"); PRINTF("OTC O 2\n");

View File

@ -125,15 +125,18 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) {
} else if ((this->unk_198 % 6) == 0) { } else if ((this->unk_198 % 6) == 0) {
s32 i; s32 i;
s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
s16 temp_1;
f32 temp_3;
f32 temp_4;
f32 distXZ;
vecA.y = 0.0f; vecA.y = 0.0f;
vecB.y = thisx->world.pos.y; vecB.y = thisx->world.pos.y;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2; temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
f32 temp_3 = Math_SinS(temp_1); temp_3 = Math_SinS(temp_1);
f32 temp_4 = Math_CosS(temp_1); temp_4 = Math_CosS(temp_1);
f32 distXZ;
vecB.x = thisx->world.pos.x + (120.0f * temp_3); vecB.x = thisx->world.pos.x + (120.0f * temp_3);
vecB.z = thisx->world.pos.z + (120.0f * temp_4); vecB.z = thisx->world.pos.z + (120.0f * temp_4);

View File

@ -315,8 +315,6 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) {
if (this->vFlameScale > 0) { if (this->vFlameScale > 0) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716); OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716);
if (1) {}
Gfx_SetupDL_25Xlu(play->state.gfxCtx); Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08, gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0,
@ -327,6 +325,9 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) {
Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY);
scale = this->vFlameScale * 0.00001f; scale = this->vFlameScale * 0.00001f;
if (1) {}
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744), gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -85,14 +85,14 @@ void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) {
} }
void func_8087DB24(BgHakaMegane* this, PlayState* play) { void func_8087DB24(BgHakaMegane* this, PlayState* play) {
CollisionHeader* colHeader;
CollisionHeader* collision;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.objectSlot = this->requiredObjectSlot;
this->dyna.actor.draw = BgHakaMegane_Draw; this->dyna.actor.draw = BgHakaMegane_Draw;
Actor_SetObjectDependency(play, &this->dyna.actor); Actor_SetObjectDependency(play, &this->dyna.actor);
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
CollisionHeader* colHeader;
CollisionHeader* collision;
this->actionFunc = func_8087DBF0; this->actionFunc = func_8087DBF0;
collision = sCollisionHeaders[this->dyna.actor.params]; collision = sCollisionHeaders[this->dyna.actor.params];
if (collision != NULL) { if (collision != NULL) {

View File

@ -199,7 +199,11 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) {
f32 angleTemp; f32 angleTemp;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528); OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528);
Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Opa(play->state.gfxCtx);
if (1) {}
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534), gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -220,7 +224,9 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910);
} }
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568); CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568);
if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) {
s32 pad; s32 pad;
Vec3f sp2C; Vec3f sp2C;

View File

@ -352,6 +352,7 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
f32 floorHeight; f32 floorHeight;
f32 yIntersect; f32 yIntersect;
s32 i; s32 i;
s32 bgId;
this->dyna.actor.velocity.y *= 1.6f; this->dyna.actor.velocity.y *= 1.6f;
@ -366,8 +367,6 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
floorHeight = this->dyna.actor.floorHeight; floorHeight = this->dyna.actor.floorHeight;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
s32 bgId;
yIntersect = yIntersect =
BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) - BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) -
25.0f; 25.0f;

View File

@ -490,6 +490,8 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904); OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904);
if (1) {}
if (BgHeavyBlock_LiftedUp == this->actionFunc) { if (BgHeavyBlock_LiftedUp == this->actionFunc) {
Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z,
&thisx->shape.rot); &thisx->shape.rot);

View File

@ -86,11 +86,12 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) {
this->treasureFlag = (thisx->params >> 6) & 0x3F; this->treasureFlag = (thisx->params >> 6) & 0x3F;
thisx->params &= 0x3F; thisx->params &= 0x3F;
if ((this->actor.params < 0) || (this->actor.params > 0x3F)) { if (OOT_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) {
// "Save bit is not set" // "Save bit is not set"
PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c",
373, this->actor.params); 373, this->actor.params);
} }
Actor_SetScale(&this->actor, hcParams->scale); Actor_SetScale(&this->actor, hcParams->scale);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);

View File

@ -58,8 +58,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE };
void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { void BgHidanFirewall_Init(Actor* thisx, PlayState* play) {
BgHidanFirewall* this = (BgHidanFirewall*)thisx; BgHidanFirewall* this = (BgHidanFirewall*)thisx;
this->actor.scale.x = 0.12f; this->actor.scale.x = this->actor.scale.z = 0.12f;
this->actor.scale.z = 0.12f;
this->actor.scale.y = 0.01f; this->actor.scale.y = 0.01f;
this->unk_150 = 0; this->unk_150 = 0;

View File

@ -115,17 +115,20 @@ void BgIceShelter_InitColliders(BgIceShelter* this, PlayState* play) {
void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG registration failed" // "Warning : move BG registration failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_ice_shelter.c", 362, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_ice_shelter.c", 362,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgIceShelter_RotateY(Vec3f* dest, Vec3f* src, s16 angle) { void BgIceShelter_RotateY(Vec3f* dest, Vec3f* src, s16 angle) {
@ -144,7 +147,6 @@ static InitChainEntry sInitChain[] = {
}; };
void BgIceShelter_Init(Actor* thisx, PlayState* play) { void BgIceShelter_Init(Actor* thisx, PlayState* play) {
static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f };
BgIceShelter* this = (BgIceShelter*)thisx; BgIceShelter* this = (BgIceShelter*)thisx;
s16 type = BGICESHELTER_GET_TYPE(&this->dyna.actor); s16 type = BGICESHELTER_GET_TYPE(&this->dyna.actor);
@ -158,7 +160,9 @@ void BgIceShelter_Init(Actor* thisx, PlayState* play) {
} }
if (type == RED_ICE_KING_ZORA) { if (type == RED_ICE_KING_ZORA) {
Math_Vec3f_Copy(&this->dyna.actor.scale, &kzIceScale); static Vec3f sKingZoraRedIceScale = { 0.18f, 0.27f, 0.24f };
Math_Vec3f_Copy(&this->dyna.actor.scale, &sKingZoraRedIceScale);
} else { } else {
Actor_SetScale(&this->dyna.actor, sRedIceScales[type]); Actor_SetScale(&this->dyna.actor, sRedIceScales[type]);
} }

View File

@ -69,17 +69,20 @@ static InitChainEntry sInitChain[] = {
void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG login failed" // "Warning : move BG login failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_1flift.c", 179, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_1flift.c", 179,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) {

View File

@ -45,15 +45,19 @@ static InitChainEntry sInitChain[] = {
void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s32 pad1; s32 pad1;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) { void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) {

View File

@ -63,19 +63,22 @@ static InitChainEntry sInitChain[] = {
}; };
void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s16 pad1; s32 pad1;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s16 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning: move BG registration failed" // "Warning: move BG registration failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombiwa.c", 174, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombiwa.c", 174,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) {

View File

@ -118,27 +118,34 @@ void func_808958F0(Vec3f* dest, Vec3f* src, f32 arg2, f32 arg3) {
void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* collision, s32 flags) { void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG Registration Failure" // "Warning : move BG Registration Failure"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_cobra.c", 247, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_cobra.c", 247,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) {
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, 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); this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6);
#if OOT_DEBUG
if (this->dyna.actor.child == NULL) { if (this->dyna.actor.child == NULL) {
PRINTF(VT_FGCOL(RED)); PRINTF(VT_FGCOL(RED));
// " : Mir Ray occurrence failure" // " : Mir Ray occurrence failure"
PRINTF(" : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_cobra.c", 270); PRINTF(" : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_cobra.c", 270);
PRINTF(VT_RST); PRINTF(VT_RST);
} }
#endif
} }
void func_80895A70(BgJyaCobra* this) { void func_80895A70(BgJyaCobra* this) {

View File

@ -43,15 +43,19 @@ static InitChainEntry sInitChain[] = {
void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { void BgJyaKanaami_Init(Actor* thisx, PlayState* play) {

View File

@ -62,15 +62,19 @@ static InitChainEntry sInitChain[] = {
void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) { void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) {

View File

@ -53,17 +53,20 @@ void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc
void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG login failed" // "Warning : move BG login failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_bigst.c", 190, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_bigst.c", 190,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgMoriBigst_Init(Actor* thisx, PlayState* play) { void BgMoriBigst_Init(Actor* thisx, PlayState* play) {

View File

@ -78,19 +78,21 @@ static InitChainEntry sInitChainLadder[] = {
void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader; CollisionHeader* colHeader = NULL;
s32 pad2;
colHeader = NULL;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG login failed" // "Warning : move BG login failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashigo.c", 164, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashigo.c", 164,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) { void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) {
@ -260,9 +262,9 @@ void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play) {
} }
void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this) { void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this) {
this->actionFunc = NULL;
this->dyna.actor.gravity = 0.0f; this->dyna.actor.gravity = 0.0f;
this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.y = 0.0f;
this->actionFunc = NULL;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
} }

View File

@ -50,19 +50,21 @@ void BgMoriHashira4_SetupAction(BgMoriHashira4* this, BgMoriHashira4ActionFunc a
void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader; CollisionHeader* colHeader = NULL;
s32 pad2;
colHeader = NULL;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG login failed" // "Warning : move BG login failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashira4.c", 155, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashira4.c", 155,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { void BgMoriHashira4_Init(Actor* thisx, PlayState* play) {

View File

@ -41,16 +41,20 @@ void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockAction
void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) { void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning: move BG registration failed" // "Warning: move BG registration failed"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xD9, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xD9,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
// Sets params to 0x10 (medium, nonrotating) if not in the cases listed. // Sets params to 0x10 (medium, nonrotating) if not in the cases listed.

View File

@ -46,15 +46,19 @@ static InitChainEntry sInitChain[] = {
void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { void BgSpot12Gate_Init(Actor* thisx, PlayState* play) {
@ -105,17 +109,19 @@ void func_808B317C(BgSpot12Gate* this) {
void func_808B318C(BgSpot12Gate* this, PlayState* play) { void func_808B318C(BgSpot12Gate* this, PlayState* play) {
s32 pad; s32 pad;
s32 quakeIndex;
Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f); Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f,
this->dyna.actor.velocity.y)) { this->dyna.actor.velocity.y)) {
func_808B3274(this); func_808B3274(this);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); {
s32 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -0x3CB0); Quake_SetSpeed(quakeIndex, -0x3CB0);
Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0); Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
Quake_SetDuration(quakeIndex, 12); Quake_SetDuration(quakeIndex, 12);
}
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
} else { } else {

View File

@ -43,15 +43,19 @@ static InitChainEntry sInitChain[] = {
void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) { void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { void BgSpot12Saku_Init(Actor* thisx, PlayState* play) {

View File

@ -58,17 +58,19 @@ static Vec3f sBoxGroundCheckPoints[] = {
void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collision, s32 flags) { void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
u32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 171, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 171,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void BgSpot15Rrbox_RotatePoint(Vec3f* outPos, Vec3f* pos, f32 arg2, f32 arg3) { void BgSpot15Rrbox_RotatePoint(Vec3f* outPos, Vec3f* pos, f32 arg2, f32 arg3) {
@ -224,11 +226,9 @@ s32 func_808B4010(BgSpot15Rrbox* this, PlayState* play) {
} }
void func_808B4084(BgSpot15Rrbox* this, PlayState* play) { void func_808B4084(BgSpot15Rrbox* this, PlayState* play) {
this->actionFunc = func_808B40AC;
this->dyna.actor.gravity = 0.0f; this->dyna.actor.gravity = 0.0f;
this->dyna.actor.velocity.x = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f;
this->dyna.actor.velocity.y = 0.0f; this->actionFunc = func_808B40AC;
this->dyna.actor.velocity.z = 0.0f;
} }
void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) { void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) {
@ -301,9 +301,7 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) {
} }
void func_808B4380(BgSpot15Rrbox* this, PlayState* play) { void func_808B4380(BgSpot15Rrbox* this, PlayState* play) {
this->dyna.actor.velocity.x = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f;
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.velocity.z = 0.0f;
this->dyna.actor.gravity = -1.0f; this->dyna.actor.gravity = -1.0f;
this->dyna.actor.floorHeight = BgSpot15Rrbox_GetFloorHeight(this, play); this->dyna.actor.floorHeight = BgSpot15Rrbox_GetFloorHeight(this, play);
this->actionFunc = func_808B43D0; this->actionFunc = func_808B43D0;

View File

@ -135,19 +135,20 @@ void ObjBean_InitCollider(Actor* thisx, PlayState* play) {
void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader; CollisionHeader* colHeader = NULL;
s32 pad2;
colHeader = NULL;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_bean.c", 374, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_bean.c", 374,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void ObjBean_FindFloor(ObjBean* this, PlayState* play) { void ObjBean_FindFloor(ObjBean* this, PlayState* play) {
@ -240,14 +241,8 @@ void ObjBean_FollowPath(ObjBean* this, PlayState* play) {
Path* path; Path* path;
Vec3f acell; Vec3f acell;
Vec3f pathPointsFloat; Vec3f pathPointsFloat;
f32 speed;
Vec3s* nextPathPoint;
Vec3s* currentPoint;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
f32 sp30;
f32 mag; f32 mag;
Vec3s* nextPathPoint;
Math_StepToF(&this->dyna.actor.speed, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel); Math_StepToF(&this->dyna.actor.speed, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel);
path = &play->pathList[(this->dyna.actor.params >> 8) & 0x1F]; path = &play->pathList[(this->dyna.actor.params >> 8) & 0x1F];
@ -257,8 +252,13 @@ void ObjBean_FollowPath(ObjBean* this, PlayState* play) {
Math_Vec3f_Diff(&pathPointsFloat, &this->pathPoints, &acell); Math_Vec3f_Diff(&pathPointsFloat, &this->pathPoints, &acell);
mag = Math3D_Vec3fMagnitude(&acell); mag = Math3D_Vec3fMagnitude(&acell);
speed = CLAMP_MIN(this->dyna.actor.speed, 0.5f); if (CLAMP_MIN(this->dyna.actor.speed, 0.5f) > mag) {
if (speed > mag) { Vec3s* currentPoint;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
f32 sp30;
currentPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->currentPointIndex]; currentPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->currentPointIndex];
Math_Vec3f_Copy(&this->pathPoints, &pathPointsFloat); Math_Vec3f_Copy(&this->pathPoints, &pathPointsFloat);

View File

@ -46,16 +46,19 @@ void ObjElevator_SetupAction(ObjElevator* this, ObjElevatorActionFunc actionFunc
void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collision, s32 flag) { void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collision, s32 flag) {
s16 pad1; s16 pad1;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s16 pad2;
Actor* thisx = &this->dyna.actor;
DynaPolyActor_Init(&this->dyna, flag); DynaPolyActor_Init(&this->dyna, flag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, thisx->id, s32 pad2;
thisx->params);
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136,
this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void ObjElevator_Init(Actor* thisx, PlayState* play) { void ObjElevator_Init(Actor* thisx, PlayState* play) {

View File

@ -55,15 +55,19 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) {
void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2[2];
DynaPolyActor_Init(&this->dyna, moveFlags); DynaPolyActor_Init(&this->dyna, moveFlags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_hsblock.c", 163, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_hsblock.c", 163,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void func_80B93BF0(ObjHsblock* this, PlayState* play) { void func_80B93BF0(ObjHsblock* this, PlayState* play) {

View File

@ -64,16 +64,19 @@ void ObjLift_SetupAction(ObjLift* this, ObjLiftActionFunc actionFunc) {
void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* collision, s32 flags) { void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* collision, s32 flags) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, flags); DynaPolyActor_Init(&this->dyna, flags);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_lift.c", 188, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_lift.c", 188,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void ObjLift_SpawnFragments(ObjLift* this, PlayState* play) { void ObjLift_SpawnFragments(ObjLift* this, PlayState* play) {

View File

@ -87,17 +87,20 @@ static Vec2f sFaceDirection[] = {
void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG registration failure" // "Warning : move BG registration failure"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 280, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 280,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void ObjOshihiki_RotateXZ(Vec3f* out, Vec3f* in, f32 sn, f32 cs) { void ObjOshihiki_RotateXZ(Vec3f* out, Vec3f* in, f32 sn, f32 cs) {
@ -242,14 +245,13 @@ void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) {
} }
} }
void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play2) {
Color_RGB8* src; PlayState* play = play2;
s16 paramsColorIdx = (this->dyna.actor.params >> 6) & 3;
Color_RGB8* color = &this->color; Color_RGB8* color = &this->color;
s16 paramsColorIdx; Color_RGB8* src;
s32 i; s32 i;
paramsColorIdx = (this->dyna.actor.params >> 6) & 3;
for (i = 0; i < ARRAY_COUNT(sSceneIds); i++) { for (i = 0; i < ARRAY_COUNT(sSceneIds); i++) {
if (sSceneIds[i] == play->sceneId) { if (sSceneIds[i] == play->sceneId) {
break; break;
@ -315,14 +317,12 @@ void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) {
} }
void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) {
s32 pad;
Vec3f colCheckPoint;
Vec3f colCheckOffset;
s32 i; s32 i;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
Vec3f colCheckPoint;
Vec3f colCheckOffset;
CollisionPoly** floorPoly;
s32* floorBgId;
colCheckOffset.x = sColCheckPoints[i].x * (this->dyna.actor.scale.x * 10.0f); colCheckOffset.x = sColCheckPoints[i].x * (this->dyna.actor.scale.x * 10.0f);
colCheckOffset.y = sColCheckPoints[i].y * (this->dyna.actor.scale.y * 10.0f); colCheckOffset.y = sColCheckPoints[i].y * (this->dyna.actor.scale.y * 10.0f);
colCheckOffset.z = sColCheckPoints[i].z * (this->dyna.actor.scale.z * 10.0f); colCheckOffset.z = sColCheckPoints[i].z * (this->dyna.actor.scale.z * 10.0f);
@ -331,10 +331,8 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) {
colCheckPoint.y += this->dyna.actor.prevPos.y; colCheckPoint.y += this->dyna.actor.prevPos.y;
colCheckPoint.z += this->dyna.actor.world.pos.z; colCheckPoint.z += this->dyna.actor.world.pos.z;
floorPoly = &this->floorPolys[i]; this->floorHeights[i] = BgCheck_EntityRaycastDown6(&play->colCtx, &this->floorPolys[i], &this->floorBgIds[i],
floorBgId = &this->floorBgIds[i]; &this->dyna.actor, &colCheckPoint, 0.0f);
this->floorHeights[i] =
BgCheck_EntityRaycastDown6(&play->colCtx, floorPoly, floorBgId, &this->dyna.actor, &colCheckPoint, 0.0f);
} }
} }
@ -445,9 +443,9 @@ s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, PlayState* play) {
void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play) {
this->stateFlags |= PUSHBLOCK_SETUP_ON_SCENE; this->stateFlags |= PUSHBLOCK_SETUP_ON_SCENE;
this->actionFunc = ObjOshihiki_OnScene;
this->dyna.actor.gravity = 0.0f; this->dyna.actor.gravity = 0.0f;
this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f;
this->actionFunc = ObjOshihiki_OnScene;
} }
void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) {
@ -472,9 +470,9 @@ void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) {
void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) {
this->stateFlags |= PUSHBLOCK_SETUP_ON_ACTOR; this->stateFlags |= PUSHBLOCK_SETUP_ON_ACTOR;
this->actionFunc = ObjOshihiki_OnActor;
this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f;
this->dyna.actor.gravity = -1.0f; this->dyna.actor.gravity = -1.0f;
this->actionFunc = ObjOshihiki_OnActor;
} }
void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) {
@ -649,6 +647,7 @@ void ObjOshihiki_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_oshihiki.c", 1308), gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_oshihiki.c", 1308),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
#if OOT_DEBUG
switch (play->sceneId) { switch (play->sceneId) {
case SCENE_DEKU_TREE: case SCENE_DEKU_TREE:
case SCENE_DODONGOS_CAVERN: case SCENE_DODONGOS_CAVERN:
@ -664,6 +663,9 @@ void ObjOshihiki_Draw(Actor* thisx, PlayState* play) {
gDPSetEnvColor(POLY_OPA_DISP++, mREG(13), mREG(14), mREG(15), 255); gDPSetEnvColor(POLY_OPA_DISP++, mREG(13), mREG(14), mREG(15), 255);
break; break;
} }
#else
gDPSetEnvColor(POLY_OPA_DISP++, this->color.r, this->color.g, this->color.b, 255);
#endif
gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_obj_oshihiki.c", 1334); CLOSE_DISPS(play->state.gfxCtx, "../z_obj_oshihiki.c", 1334);

View File

@ -192,17 +192,20 @@ void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 rotY) {
void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2;
DynaPolyActor_Init(&this->dyna, moveFlag); DynaPolyActor_Init(&this->dyna, moveFlag);
CollisionHeader_GetVirtual(collision, &colHeader); CollisionHeader_GetVirtual(collision, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
#if OOT_DEBUG
if (this->dyna.bgId == BG_ACTOR_MAX) { if (this->dyna.bgId == BG_ACTOR_MAX) {
s32 pad2;
// "Warning : move BG registration failure" // "Warning : move BG registration failure"
PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_switch.c", 531, PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_switch.c", 531,
this->dyna.actor.id, this->dyna.actor.params); this->dyna.actor.id, this->dyna.actor.params);
} }
#endif
} }
void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) { void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) {

View File

@ -179,7 +179,6 @@ void func_80846978(PlayState* play, Player* this);
void func_808469BC(PlayState* play, Player* this); void func_808469BC(PlayState* play, Player* this);
void func_80846A68(PlayState* play, Player* this); void func_80846A68(PlayState* play, Player* this);
void Player_UpdateCommon(Player* this, PlayState* play, Input* input); void Player_UpdateCommon(Player* this, PlayState* play, Input* input);
s32 func_8084FCAC(Player* this, PlayState* play);
void func_8084FF7C(Player* this); void func_8084FF7C(Player* this);
void Player_UpdateBunnyEars(Player* this); void Player_UpdateBunnyEars(Player* this);
void func_80851008(PlayState* play, Player* this, void* anim); void func_80851008(PlayState* play, Player* this, void* anim);
@ -493,7 +492,7 @@ static PlayerAgeProperties sAgeProperties[] = {
}, },
}; };
static u32 D_808535D0 = false; static u32 sNoclipEnabled = false;
static f32 sControlStickMagnitude = 0.0f; static f32 sControlStickMagnitude = 0.0f;
static s16 sControlStickAngle = 0; static s16 sControlStickAngle = 0;
static s16 D_808535DC = 0; static s16 D_808535DC = 0;
@ -1605,7 +1604,6 @@ static LinkAnimationHeader* D_808543D4[] = {
&gPlayerAnim_link_hook_wait, &gPlayerAnim_link_hook_wait,
}; };
// return type can't be void due to regalloc in func_8084FCAC
BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) { BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) {
this->actor.speed = 0.0f; this->actor.speed = 0.0f;
this->speedXZ = 0.0f; this->speedXZ = 0.0f;
@ -5224,16 +5222,16 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3,
} }
s32 func_8083A6AC(Player* this, PlayState* play) { s32 func_8083A6AC(Player* this, PlayState* play) {
//! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, because the player
//! left the ground. The angles will always be zero and therefore will always pass these checks.
//! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope.
if ((this->actor.yDistToWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) {
CollisionPoly* sp84; CollisionPoly* sp84;
s32 sp80; s32 sp80;
Vec3f sp74; Vec3f sp74;
Vec3f sp68; Vec3f sp68;
f32 temp1; f32 temp1;
//! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, because the player
//! left the ground. The angles will always be zero and therefore will always pass these checks.
//! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope.
if ((this->actor.yDistToWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) {
sp74.x = this->actor.prevPos.x - this->actor.world.pos.x; sp74.x = this->actor.prevPos.x - this->actor.world.pos.x;
sp74.z = this->actor.prevPos.z - this->actor.world.pos.z; sp74.z = this->actor.prevPos.z - this->actor.world.pos.z;
@ -7847,7 +7845,6 @@ void Player_Action_808414F8(Player* this, PlayState* play) {
f32 speedTarget; f32 speedTarget;
s16 yawTarget; s16 yawTarget;
s32 sp2C; s32 sp2C;
s16 sp2A;
func_80841138(this, play); func_80841138(this, play);
@ -7871,7 +7868,7 @@ void Player_Action_808414F8(Player* this, PlayState* play) {
} }
} }
} else { } else {
sp2A = yawTarget - this->yaw; s16 sp2A = yawTarget - this->yaw;
Math_AsymStepToF(&this->speedXZ, speedTarget * 1.5f, 1.5f, 2.0f); Math_AsymStepToF(&this->speedXZ, speedTarget * 1.5f, 1.5f, 2.0f);
Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f); Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f);
@ -8483,15 +8480,6 @@ s32 func_80842DF4(PlayState* play, Player* this) {
} }
void Player_Action_80843188(Player* this, PlayState* play) { void Player_Action_80843188(Player* this, PlayState* play) {
f32 sp54;
f32 sp50;
s16 sp4E;
s16 sp4C;
s16 sp4A;
s16 sp48;
s16 sp46;
f32 sp40;
if (LinkAnimation_Update(play, &this->skelAnime)) { if (LinkAnimation_Update(play, &this->skelAnime)) {
if (!Player_IsChildWithHylianShield(this)) { if (!Player_IsChildWithHylianShield(this)) {
Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType));
@ -8509,6 +8497,15 @@ void Player_Action_80843188(Player* this, PlayState* play) {
func_8083721C(this); func_8083721C(this);
if (this->av2.actionVar2 != 0) { if (this->av2.actionVar2 != 0) {
f32 sp54;
f32 sp50;
s16 sp4E;
s16 sp4C;
s16 sp4A;
s16 sp48;
s16 sp46;
f32 sp40;
sp54 = sControlInput->rel.stick_y * 100; sp54 = sControlInput->rel.stick_y * 100;
sp50 = sControlInput->rel.stick_x * -120; sp50 = sControlInput->rel.stick_x * -120;
sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
@ -11301,27 +11298,37 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
Collider_ResetQuadAT(play, &this->shieldQuad.base); Collider_ResetQuadAT(play, &this->shieldQuad.base);
} }
static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; #if OOT_DEBUG
s32 Player_UpdateNoclip(Player* this, PlayState* play);
#endif
void Player_Update(Actor* thisx, PlayState* play) { void Player_Update(Actor* thisx, PlayState* play) {
static Vec3f sDogSpawnPos;
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
s32 dogParams; s32 dogParams;
s32 pad; s32 pad;
Input sp44; Input input;
Actor* dog;
#if OOT_DEBUG
if (!Player_UpdateNoclip(this, play)) {
goto skip_update;
}
#endif
if (func_8084FCAC(this, play)) {
if (gSaveContext.dogParams < 0) { if (gSaveContext.dogParams < 0) {
static Vec3f sDogSpawnOffset = { 0.0f, 0.0f, -30.0f };
static Vec3f sDogSpawnPos;
if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) { if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) {
gSaveContext.dogParams = 0; gSaveContext.dogParams = 0;
} else { } else {
Actor* dog;
gSaveContext.dogParams &= 0x7FFF; gSaveContext.dogParams &= 0x7FFF;
Player_GetRelativePosition(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); Player_GetRelativePosition(this, &this->actor.world.pos, &sDogSpawnOffset, &sDogSpawnPos);
dogParams = gSaveContext.dogParams; dogParams = gSaveContext.dogParams;
dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, 0,
0, this->actor.shape.rot.y, 0, dogParams | 0x8000); this->actor.shape.rot.y, 0, dogParams | 0x8000);
if (dog != NULL) { if (dog != NULL) {
dog->room = 0; dog->room = 0;
} }
@ -11337,23 +11344,29 @@ void Player_Update(Actor* thisx, PlayState* play) {
} }
if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) {
bzero(&sp44, sizeof(sp44)); bzero(&input, sizeof(input));
} else { } else {
sp44 = play->state.input[0]; input = play->state.input[0];
if (this->unk_88E != 0) { if (this->unk_88E != 0) {
sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); input.cur.button &= ~(BTN_A | BTN_B | BTN_CUP);
sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP); input.press.button &= ~(BTN_A | BTN_B | BTN_CUP);
} }
} }
Player_UpdateCommon(this, play, &sp44); Player_UpdateCommon(this, play, &input);
}
skip_update:;
{
s32 pad;
MREG(52) = this->actor.world.pos.x; MREG(52) = this->actor.world.pos.x;
MREG(53) = this->actor.world.pos.y; MREG(53) = this->actor.world.pos.y;
MREG(54) = this->actor.world.pos.z; MREG(54) = this->actor.world.pos.z;
MREG(55) = this->actor.world.rot.y; MREG(55) = this->actor.world.rot.y;
} }
}
typedef struct { typedef struct {
/* 0x0 */ Vec3s rot; /* 0x0 */ Vec3s rot;
@ -13618,21 +13631,42 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) {
func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92);
} }
s32 func_8084FCAC(Player* this, PlayState* play) { #if OOT_DEBUG
/**
* Updates the "Noclip" debug feature, which allows the player to fly around anywhere
* in the world and clip through any collision.
*
* Noclip can be toggled on and off with two different button combos:
* Hold L + R + A and press B
* or
* Hold L and press D-pad right
*
* To control Noclip mode:
* - Move horizontally with the 4 D-pad directions
* - Move up with B
* - Move down with A
* - Hold R to move faster
*
* With Noclip enabled, another button combination can be pressed to set all "temp clear" flags
* in the current room. To do so hold L and press D-pad left.
*
* @return true if Noclip is disabled, false if enabled
*/
s32 Player_UpdateNoclip(Player* this, PlayState* play) {
sControlInput = &play->state.input[0]; sControlInput = &play->state.input[0];
if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_A | BTN_L | BTN_R) && 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->press.button, BTN_B)) ||
(CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) { (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) {
D_808535D0 ^= 1; sNoclipEnabled ^= 1;
if (D_808535D0) { if (sNoclipEnabled) {
Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_AIM); Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_AIM);
} }
} }
if (D_808535D0) { if (sNoclipEnabled) {
f32 speed; f32 speed;
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) {
@ -13672,9 +13706,7 @@ s32 func_8084FCAC(Player* this, PlayState* play) {
Player_ZeroSpeedXZ(this); Player_ZeroSpeedXZ(this);
this->actor.gravity = 0.0f; this->actor.gravity = 0.0f;
this->actor.velocity.z = 0.0f; this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.velocity.x = 0.0f;
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) {
Flags_SetTempClear(play, play->roomCtx.curRoom.num); Flags_SetTempClear(play, play->roomCtx.curRoom.num);
@ -13682,11 +13714,12 @@ s32 func_8084FCAC(Player* this, PlayState* play) {
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
return 0; return false;
} }
return 1; return true;
} }
#endif
void func_8084FF7C(Player* this) { void func_8084FF7C(Player* this) {
this->unk_858 += this->unk_85C; this->unk_858 += this->unk_85C;

21
tools/msgdis.py Normal file → Executable file
View File

@ -5,6 +5,7 @@
import re, struct import re, struct
from os import path from os import path
import argparse
# =================================================== # ===================================================
# Util # Util
@ -404,3 +405,23 @@ def extract_all_text(text_out, staff_text_out):
with open(staff_text_out, "w", encoding="utf8") as outfile: with open(staff_text_out, "w", encoding="utf8") as outfile:
outfile.write(out.strip() + "\n") outfile.write(out.strip() + "\n")
def main():
parser = argparse.ArgumentParser(
description="Extract text from the baserom into .h files"
)
parser.add_argument("--text-out", help="Path to output .h file for text")
parser.add_argument(
"--staff-text-out", help="Path to output .h file for staff text"
)
args = parser.parse_args()
if not (args.text_out or args.staff_text_out):
parser.error("No output file requested")
extract_all_text(args.text_out, args.staff_text_out)
if __name__ == "__main__":
main()