mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-12 10:54:44 +00:00
Merge branch 'main' into doc_pause_menu
This commit is contained in:
commit
77d9a1ec7a
282 changed files with 8441 additions and 7222 deletions
|
@ -23,4 +23,4 @@ AllowShortEnumsOnASingleLine: false
|
|||
AlignEscapedNewlines: Left
|
||||
AlignTrailingComments: true
|
||||
SortIncludes: false
|
||||
TypenameMacros: ['BAD_RETURN']
|
||||
TypenameMacros: ['BAD_RETURN', 'ALIGNED']
|
||||
|
|
23
Makefile
23
Makefile
|
@ -181,10 +181,6 @@ endif
|
|||
|
||||
OBJDUMP_FLAGS := -d -r -z -Mreg-names=32
|
||||
|
||||
DISASM_DATA_DIR := tools/disasm/$(VERSION)
|
||||
DISASM_FLAGS += --custom-suffix _unknown --sequential-label-names --no-use-fpccsr --no-cop0-named-registers
|
||||
DISASM_FLAGS += --config-dir $(DISASM_DATA_DIR) --symbol-addrs $(DISASM_DATA_DIR)/functions.txt --symbol-addrs $(DISASM_DATA_DIR)/variables.txt
|
||||
|
||||
#### Files ####
|
||||
|
||||
# ROM image
|
||||
|
@ -223,11 +219,6 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
|
|||
|
||||
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
|
||||
|
||||
DISASM_BASEROM := $(BASEROM_DIR)/baserom-decompressed.z64
|
||||
DISASM_DATA_FILES := $(wildcard $(DISASM_DATA_DIR)/*.csv) $(wildcard $(DISASM_DATA_DIR)/*.txt)
|
||||
DISASM_S_FILES := $(shell test -e $(PYTHON) && $(PYTHON) tools/disasm/list_generated_files.py -o $(EXPECTED_DIR) --config-dir $(DISASM_DATA_DIR))
|
||||
DISASM_O_FILES := $(DISASM_S_FILES:.s=.o)
|
||||
|
||||
# Automatic dependency files
|
||||
# (Only asm_processor dependencies and reloc dependencies are handled for now)
|
||||
DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
|
||||
|
@ -247,7 +238,7 @@ $(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2
|
|||
$(BUILD_DIR)/src/code/__osMalloc.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/code_800FC620.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/code_800FCE80.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/code_800FD970.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/rand.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/gfxprint.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2
|
||||
$(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2
|
||||
|
@ -370,9 +361,12 @@ setup: venv
|
|||
# TODO: for now, we only extract assets from the Debug ROM
|
||||
ifeq ($(VERSION),gc-eu-mq-dbg)
|
||||
$(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
|
||||
|
||||
disasm: $(DISASM_O_FILES)
|
||||
disasm:
|
||||
$(RM) -r $(EXPECTED_DIR)
|
||||
VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh
|
||||
|
||||
run: $(ROM)
|
||||
ifeq ($(N64_EMULATOR),)
|
||||
|
@ -494,13 +488,6 @@ $(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
|
|||
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
|
||||
$(ZAPD) bren -eh -i $< -o $@
|
||||
|
||||
$(EXPECTED_DIR)/.disasm: $(DISASM_DATA_FILES)
|
||||
$(PYTHON) tools/disasm/disasm.py $(DISASM_FLAGS) $(DISASM_BASEROM) -o $(EXPECTED_DIR) --split-functions $(EXPECTED_DIR)/functions
|
||||
touch $@
|
||||
|
||||
$(EXPECTED_DIR)/%.o: $(EXPECTED_DIR)/.disasm
|
||||
$(AS) $(ASFLAGS) $(@:.o=.s) -o $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
# Print target for debugging
|
||||
|
|
|
@ -103,6 +103,7 @@ cd oot
|
|||
#### 3. Prepare a base ROM
|
||||
|
||||
Place a copy of the Master Quest (Debug) ROM inside the `baseroms/gc-eu-mq-dbg/` folder.
|
||||
If you are under WSL, you can run the command `explorer.exe .` to open the current directory in the Windows file explorer.
|
||||
|
||||
Rename the file to `baserom.z64`, `baserom.n64` or `baserom.v64`, depending on the original extension.
|
||||
|
||||
|
@ -115,7 +116,7 @@ make setup
|
|||
```
|
||||
|
||||
This downloads some dependencies (from pip), and compiles tools for the build process.
|
||||
Then it generates a new ROM "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64" that will have the overdump removed and the header patched.
|
||||
Then it generates a new ROM `baseroms/gc-eu-mq-dbg/baserom-decompressed.z64` that will have the overdump removed and the header patched.
|
||||
It will also extract the individual assets from the ROM.
|
||||
|
||||
#### 5. Build the ROM
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
glabel sFaultDrawer
|
||||
.space 0x3C
|
||||
.space 0x04 # padding
|
||||
|
||||
glabel D_8016B6BC
|
||||
.space 0x24
|
||||
glabel D_8016B6C0
|
||||
.space 0x20
|
||||
|
|
|
@ -96,7 +96,7 @@ def processZAPDArgs(argsZ):
|
|||
def main():
|
||||
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("-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("-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")
|
||||
|
@ -128,21 +128,6 @@ def main():
|
|||
del extractedAssetsTracker[fullPath]
|
||||
ExtractFunc(fullPath)
|
||||
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 = []
|
||||
for currentPath, _, files in os.walk(os.path.join("assets", "xml")):
|
||||
for file in files:
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define ALIGN256(val) (((val) + 0xFF) & ~0xFF)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ALIGNED8 __attribute__ ((aligned (8)))
|
||||
#define ALIGNED(n) __attribute__ ((aligned (n)))
|
||||
#else
|
||||
#define ALIGNED8
|
||||
#define ALIGNED(n)
|
||||
#endif
|
||||
|
||||
#ifdef __sgi /* IDO compiler */
|
||||
|
|
|
@ -44,7 +44,7 @@ void Fault_Init(void);
|
|||
// Fatal Errors
|
||||
|
||||
NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2);
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line);
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, int line);
|
||||
|
||||
// Client Registration
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void isPrintfInit(void);
|
|||
void rmonPrintf(const char* fmt, ...);
|
||||
#if OOT_DEBUG
|
||||
void* is_proutSyncPrintf(void* arg, const char* str, size_t count);
|
||||
NORETURN void func_80002384(const char* exp, const char* file, u32 line);
|
||||
NORETURN void func_80002384(const char* exp, const char* file, int line);
|
||||
#endif
|
||||
OSPiHandle* osDriveRomInit(void);
|
||||
void Mio0_Decompress(u8* src, u8* dst);
|
||||
|
@ -51,11 +51,11 @@ u32 StackCheck_CheckAll(void);
|
|||
u32 StackCheck_Check(StackEntry* entry);
|
||||
#if OOT_DEBUG
|
||||
void LogUtils_LogHexDump(void* ptr, s32 size0);
|
||||
void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line);
|
||||
void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line);
|
||||
void LogUtils_LogThreadId(const char* name, s32 line);
|
||||
void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line);
|
||||
void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line);
|
||||
void LogUtils_LogThreadId(const char* name, int line);
|
||||
#endif
|
||||
void LogUtils_HungupThread(const char* name, s32 line);
|
||||
void LogUtils_HungupThread(const char* name, int line);
|
||||
void LogUtils_ResetHungup(void);
|
||||
void __osPiCreateAccessQueue(void);
|
||||
void __osPiGetAccess(void);
|
||||
|
@ -913,10 +913,10 @@ void ZeldaArena_Cleanup(void);
|
|||
u8 ZeldaArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action);
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, int line);
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line);
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line);
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, int line);
|
||||
void ZeldaArena_Display(void);
|
||||
#endif
|
||||
void MapMark_Init(PlayState* play);
|
||||
|
@ -1155,10 +1155,10 @@ void Sram_WriteSramHeader(SramContext* sramCtx);
|
|||
void Sram_InitSram(GameState* gameState, SramContext* sramCtx);
|
||||
void Sram_Alloc(GameState* gameState, 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);
|
||||
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);
|
||||
void View_Free(View* view);
|
||||
void View_Init(View*, GraphicsContext*);
|
||||
|
@ -1316,8 +1316,8 @@ void GameState_Destroy(GameState* gameState);
|
|||
GameStateFunc GameState_GetInit(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
#if OOT_DEBUG
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line);
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line);
|
||||
#endif
|
||||
void* GameAlloc_Malloc(GameAlloc* this, u32 size);
|
||||
void GameAlloc_Free(GameAlloc* this, void* data);
|
||||
|
@ -1333,8 +1333,8 @@ void Graph_ThreadEntry(void*);
|
|||
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size);
|
||||
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size);
|
||||
#if OOT_DEBUG
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line);
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line);
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line);
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line);
|
||||
#endif
|
||||
Gfx* Gfx_Open(Gfx* gfx);
|
||||
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst);
|
||||
|
@ -1437,8 +1437,8 @@ void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation);
|
|||
void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot);
|
||||
Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest);
|
||||
#if OOT_DEBUG
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line);
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line);
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line);
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line);
|
||||
#else
|
||||
Mtx* Matrix_ToMtx(Mtx* dest);
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx);
|
||||
|
@ -1453,7 +1453,7 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
|||
void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
||||
void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode);
|
||||
#if OOT_DEBUG
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line);
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line);
|
||||
#endif
|
||||
void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY,
|
||||
f32 translateZ);
|
||||
|
@ -1476,10 +1476,10 @@ void DebugArena_Cleanup(void);
|
|||
u8 DebugArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action);
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, int line);
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, int line);
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line);
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, int line);
|
||||
void DebugArena_Display(void);
|
||||
#endif
|
||||
void UCodeDisas_Init(UCodeDisas*);
|
||||
|
@ -1774,10 +1774,10 @@ void SystemArena_Init(void* start, u32 size);
|
|||
void SystemArena_Cleanup(void);
|
||||
u8 SystemArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, int line);
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, int line);
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line);
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, int line);
|
||||
void SystemArena_Display(void);
|
||||
#endif
|
||||
u32 Rand_Next(void);
|
||||
|
@ -1799,10 +1799,10 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize);
|
|||
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc);
|
||||
u32 __osCheckArena(Arena* arena);
|
||||
#if OOT_DEBUG
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line);
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line);
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line);
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line);
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line);
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line);
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line);
|
||||
void __osDisplayArena(Arena* arena);
|
||||
#endif
|
||||
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# Evaluate this file only once in case it's included more than once
|
||||
.ifndef _MACRO_INC_GUARD
|
||||
.internal _MACRO_INC_GUARD
|
||||
.set _MACRO_INC_GUARD, 1
|
||||
|
||||
.macro glabel label
|
||||
.global \label
|
||||
\label:
|
||||
|
@ -47,3 +52,5 @@
|
|||
.set $fs4f, $f29
|
||||
.set $fs5, $f30
|
||||
.set $fs5f, $f31
|
||||
|
||||
.endif
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
// argument errors instead.
|
||||
// Note some tools define __sgi but preprocess with a modern cpp implementation,
|
||||
// ensure that these do not use the IDO workaround to avoid errors.
|
||||
#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !PERMUTER && !M2CTX)
|
||||
#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX)
|
||||
|
||||
#if OOT_DEBUG
|
||||
#define PRINTF osSyncPrintf
|
||||
|
|
|
@ -119,6 +119,12 @@
|
|||
#define BTN_B 0x4000
|
||||
#define BTN_A 0x8000
|
||||
|
||||
#ifdef __GNUC__
|
||||
// Ensure data cache coherency for OSPifRam structures by aligning to the data cache line size.
|
||||
// On older compilers such as IDO this was done by placing each OSPifRam at the top of the file it is declared in,
|
||||
// however file alignment should not be relied on in general.
|
||||
__attribute__((aligned(0x10)))
|
||||
#endif
|
||||
typedef union {
|
||||
struct {
|
||||
/* 0x00 */ u32 ram[15];
|
||||
|
|
|
@ -143,13 +143,17 @@ extern u16 D_801333D0;
|
|||
extern Vec3f gSfxDefaultPos;
|
||||
extern f32 gSfxDefaultFreqAndVolScale;
|
||||
extern s8 gSfxDefaultReverb;
|
||||
#if OOT_DEBUG
|
||||
extern u8 D_801333F0;
|
||||
extern u8 gAudioSfxSwapOff;
|
||||
extern u8 D_801333F8;
|
||||
#endif
|
||||
extern u8 gSeqCmdWritePos;
|
||||
extern u8 gSeqCmdReadPos;
|
||||
extern u8 gStartSeqDisabled;
|
||||
#if OOT_DEBUG
|
||||
extern u8 gAudioDebugPrintSeqCmd;
|
||||
#endif
|
||||
extern u8 gSoundModeList[];
|
||||
extern u8 gAudioSpecId;
|
||||
extern u8 D_80133418;
|
||||
|
@ -231,6 +235,5 @@ extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 byt
|
|||
extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes
|
||||
extern GfxPool gGfxPools[2]; // 0x24820 bytes
|
||||
extern u8 gAudioHeap[0x38000]; // 0x38000 bytes
|
||||
extern u8 gSystemHeap[];
|
||||
|
||||
#endif
|
||||
|
|
|
@ -717,7 +717,7 @@ typedef struct ArenaNode {
|
|||
/* 0x0C */ struct ArenaNode* prev;
|
||||
#if OOT_DEBUG // TODO: This debug info is also present in N64 retail builds
|
||||
/* 0x10 */ const char* filename;
|
||||
/* 0x14 */ s32 line;
|
||||
/* 0x14 */ int line;
|
||||
/* 0x18 */ OSId threadId;
|
||||
/* 0x1C */ Arena* arena;
|
||||
/* 0x20 */ OSTime time;
|
||||
|
@ -755,7 +755,12 @@ typedef struct OverlayRelocationSection {
|
|||
/* 0x14 */ u32 relocations[1]; // size is nRelocations
|
||||
} OverlayRelocationSection; // size >= 0x18
|
||||
|
||||
typedef struct {
|
||||
// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access
|
||||
// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32
|
||||
// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute
|
||||
// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing
|
||||
// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code.
|
||||
ALIGNED(4) typedef struct {
|
||||
/* 0x00 */ u32 resetting;
|
||||
/* 0x04 */ u32 resetCount;
|
||||
/* 0x08 */ OSTime duration;
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef struct {
|
|||
/* 0x04 */ void* dramAddr; // DRAM address (destination)
|
||||
/* 0x08 */ size_t size; // File Transfer size
|
||||
/* 0x0C */ const char* filename; // Filename for debugging
|
||||
/* 0x10 */ s32 line; // Line for debugging
|
||||
/* 0x10 */ int line; // Line number for debugging
|
||||
/* 0x14 */ s32 unk_14;
|
||||
/* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message
|
||||
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
|
||||
|
@ -48,8 +48,8 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size,
|
|||
s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size);
|
||||
#if OOT_DEBUG
|
||||
s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue,
|
||||
OSMesg msg, const char* file, s32 line);
|
||||
s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line);
|
||||
OSMesg msg, const char* file, int line);
|
||||
s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line);
|
||||
#endif
|
||||
|
||||
// Special-purpose DMA Requests
|
||||
|
|
|
@ -14,6 +14,6 @@ pycparser
|
|||
toml
|
||||
|
||||
# tools
|
||||
mapfile-parser>=1.2.1,<2.0.0
|
||||
mapfile-parser>=2.3.5,<3.0.0
|
||||
rabbitizer>=1.0.0,<2.0.0
|
||||
spimdisasm>=1.20.0,<2.0.0
|
||||
spimdisasm>=1.21.0,<2.0.0
|
||||
|
|
|
@ -5,16 +5,34 @@
|
|||
|
||||
import argparse
|
||||
import collections
|
||||
from colorama import Fore, Style
|
||||
from dataclasses import dataclass
|
||||
import difflib
|
||||
from enum import Enum
|
||||
import itertools
|
||||
import math
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import Iterator, List, Optional, Tuple
|
||||
import multiprocessing
|
||||
import multiprocessing.pool
|
||||
from typing import Dict, Iterator, List, Optional, Tuple
|
||||
|
||||
|
||||
def green(s: str) -> str:
|
||||
return f"{Fore.GREEN}{s}{Style.RESET_ALL}"
|
||||
|
||||
|
||||
def red(s: str) -> str:
|
||||
return f"{Fore.RED}{s}{Style.RESET_ALL}"
|
||||
|
||||
|
||||
# Make interrupting with ^C less jank
|
||||
# https://stackoverflow.com/questions/72967793/keyboardinterrupt-with-python-multiprocessing-pool
|
||||
def set_sigint_ignored():
|
||||
import signal
|
||||
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -68,30 +86,25 @@ def parse_inst(func_name: str, line: str) -> Inst:
|
|||
return Inst(func_name, mnemonic, regs, imm, None, None)
|
||||
|
||||
|
||||
def run_objdump(path: Path) -> List[Inst]:
|
||||
def run_objdump(path: Path, args: List[str]) -> str:
|
||||
if not path.exists():
|
||||
raise Exception(f"file {path} does not exist")
|
||||
|
||||
command = [
|
||||
"mips-linux-gnu-objdump",
|
||||
"-drz",
|
||||
"-m",
|
||||
"mips:4300",
|
||||
"-j",
|
||||
".text",
|
||||
str(path),
|
||||
]
|
||||
command = ["mips-linux-gnu-objdump"] + args + [str(path)]
|
||||
try:
|
||||
lines = subprocess.run(
|
||||
return subprocess.run(
|
||||
command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
check=True,
|
||||
encoding="utf-8",
|
||||
).stdout.splitlines()
|
||||
).stdout
|
||||
except subprocess.CalledProcessError as e:
|
||||
return []
|
||||
return ""
|
||||
|
||||
|
||||
def disassemble(path: Path) -> List[Inst]:
|
||||
lines = run_objdump(path, ["-drz", "-m", "mips:4300", "-j", ".text"]).splitlines()
|
||||
result = []
|
||||
|
||||
func_name = None
|
||||
|
@ -156,14 +169,47 @@ def has_diff(inst1: Inst, inst2: Inst) -> bool:
|
|||
return inst1 != inst2
|
||||
|
||||
|
||||
def get_section_sizes(path: Path) -> Dict[str, int]:
|
||||
lines = run_objdump(path, ["-h"]).splitlines()
|
||||
if len(lines) < 5:
|
||||
return {}
|
||||
|
||||
result = {}
|
||||
for i in range(5, len(lines), 2):
|
||||
parts = lines[i].split()
|
||||
name = parts[1]
|
||||
size = int(parts[2], 16)
|
||||
# Pad to 0x10-byte alignment
|
||||
result[parts[1]] = (size + 0xF) & ~0xF
|
||||
return result
|
||||
|
||||
|
||||
def get_section_hex_dump(path: Path, section: str) -> List[str]:
|
||||
lines = run_objdump(path, ["-s", "-j", section]).splitlines()
|
||||
return lines[4:]
|
||||
|
||||
|
||||
def parse_hex_dump(lines: List[str]) -> bytes:
|
||||
result = bytearray()
|
||||
for line in lines:
|
||||
data = line[6:41].replace(" ", "")
|
||||
result.extend(bytes.fromhex(data))
|
||||
|
||||
# pad to 0x10-byte alignment
|
||||
while len(result) % 0x10:
|
||||
result.append(0)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def find_functions_with_diffs(version: str, c_path: str):
|
||||
object_path = Path(c_path).with_suffix(".o")
|
||||
|
||||
expected_dir = Path("expected/build") / version
|
||||
build_dir = Path("build") / version
|
||||
|
||||
insts1 = run_objdump(expected_dir / object_path)
|
||||
insts2 = run_objdump(build_dir / object_path)
|
||||
insts1 = disassemble(expected_dir / object_path)
|
||||
insts2 = disassemble(build_dir / object_path)
|
||||
|
||||
functions_with_diffs = collections.OrderedDict()
|
||||
for inst1, inst2 in pair_instructions(insts1, insts2):
|
||||
|
@ -184,18 +230,98 @@ def find_functions_with_diffs(version: str, c_path: str):
|
|||
print(f" {func_name}")
|
||||
|
||||
|
||||
def print_summary(version: str, csv: bool):
|
||||
def find_data_diffs(version: str, c_path: str):
|
||||
object_path = Path(c_path).with_suffix(".o")
|
||||
|
||||
expected_dir = Path("expected/build") / version
|
||||
build_dir = Path("build") / version
|
||||
|
||||
if csv:
|
||||
print("path,expected,actual,added,removed,changed,progress")
|
||||
for object_file in sorted(expected_dir.glob("src/**/*.o")):
|
||||
object_path = object_file.relative_to(expected_dir)
|
||||
c_path = object_path.with_suffix(".c")
|
||||
sizes1 = get_section_sizes(expected_dir / object_path)
|
||||
sizes2 = get_section_sizes(build_dir / object_path)
|
||||
rodata_dump1 = get_section_hex_dump(expected_dir / object_path, ".rodata")
|
||||
rodata_dump2 = get_section_hex_dump(build_dir / object_path, ".rodata")
|
||||
rodata1 = parse_hex_dump(rodata_dump1)
|
||||
rodata2 = parse_hex_dump(rodata_dump2)
|
||||
|
||||
insts1 = run_objdump(expected_dir / object_path)
|
||||
insts2 = run_objdump(build_dir / object_path)
|
||||
rodata_matches = rodata1 == rodata2
|
||||
data_size_matches = sizes1.get(".data", 0) == sizes2.get(".data", 0)
|
||||
bss_size_matches = sizes1.get(".bss", 0) == sizes2.get(".bss", 0)
|
||||
|
||||
if rodata_matches:
|
||||
print(f"{c_path} .rodata OK")
|
||||
else:
|
||||
print(
|
||||
f"{c_path} .rodata differs: expected size 0x{sizes1.get('.rodata', 0):04x} vs build size 0x{sizes2.get('.rodata', 0):04x}"
|
||||
)
|
||||
print(f" expected:")
|
||||
print("\n".join(rodata_dump1))
|
||||
print(f" build:")
|
||||
print("\n".join(rodata_dump2))
|
||||
|
||||
if data_size_matches:
|
||||
print(f"{c_path} .data size OK")
|
||||
else:
|
||||
print(
|
||||
f"{c_path} .data size differs: expected size 0x{sizes1.get('.data', 0):04x} vs build size 0x{sizes2.get('.data', 0):04x}"
|
||||
)
|
||||
|
||||
if bss_size_matches:
|
||||
print(f"{c_path} .bss size OK")
|
||||
else:
|
||||
print(
|
||||
f"{c_path} .bss size differs: expected size 0x{sizes1.get('.bss', 0):04x} vs build size 0x{sizes2.get('.bss', 0):04x}"
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ObjectDataForComparison:
|
||||
insts1: List[Inst]
|
||||
insts2: List[Inst]
|
||||
sizes1: Dict[str, int]
|
||||
sizes2: Dict[str, int]
|
||||
rodata1: bytes
|
||||
rodata2: bytes
|
||||
|
||||
|
||||
def get_object_data_for_comparison(object1: Path, object2: Path):
|
||||
insts1 = disassemble(object1)
|
||||
insts2 = disassemble(object2)
|
||||
sizes1 = get_section_sizes(object1)
|
||||
sizes2 = get_section_sizes(object2)
|
||||
rodata_dump1 = get_section_hex_dump(object1, ".rodata")
|
||||
rodata_dump2 = get_section_hex_dump(object2, ".rodata")
|
||||
rodata1 = parse_hex_dump(rodata_dump1)
|
||||
rodata2 = parse_hex_dump(rodata_dump2)
|
||||
return ObjectDataForComparison(insts1, insts2, sizes1, sizes2, rodata1, rodata2)
|
||||
|
||||
|
||||
def print_summary(version: str, csv: bool, only_not_ok: bool):
|
||||
expected_dir = Path("expected/build") / version
|
||||
build_dir = Path("build") / version
|
||||
|
||||
expected_object_files = sorted(expected_dir.glob("src/**/*.o"))
|
||||
|
||||
comparison_data_list: List[multiprocessing.pool.AsyncResult] = []
|
||||
|
||||
with multiprocessing.Pool(initializer=set_sigint_ignored) as p:
|
||||
for expected_object in expected_object_files:
|
||||
build_object = build_dir / expected_object.relative_to(expected_dir)
|
||||
comparison_data_list.append(
|
||||
p.apply_async(
|
||||
get_object_data_for_comparison,
|
||||
(expected_object, build_object),
|
||||
)
|
||||
)
|
||||
if csv:
|
||||
print("path,expected,actual,.text,.rodata,.data size,.bss size")
|
||||
for expected_object, data_async in zip(
|
||||
expected_object_files, comparison_data_list
|
||||
):
|
||||
c_path = expected_object.relative_to(expected_dir).with_suffix(".c")
|
||||
data = data_async.get()
|
||||
|
||||
insts1 = data.insts1
|
||||
insts2 = data.insts2
|
||||
|
||||
added = 0
|
||||
removed = 0
|
||||
|
@ -209,24 +335,51 @@ def print_summary(version: str, csv: bool):
|
|||
changed += 1
|
||||
|
||||
if insts1:
|
||||
progress = max(1.0 - (added + removed + changed) / len(insts1), 0)
|
||||
text_progress = max(1.0 - (added + removed + changed) / len(insts1), 0)
|
||||
else:
|
||||
progress = 1.0
|
||||
text_progress = 1.0
|
||||
|
||||
sizes1 = data.sizes1
|
||||
sizes2 = data.sizes2
|
||||
rodata1 = data.rodata1
|
||||
rodata2 = data.rodata2
|
||||
|
||||
rodata_matches = rodata1 == rodata2
|
||||
data_size_matches = sizes1.get(".data", 0) == sizes2.get(".data", 0)
|
||||
bss_size_matches = sizes1.get(".bss", 0) == sizes2.get(".bss", 0)
|
||||
|
||||
if only_not_ok:
|
||||
if (
|
||||
text_progress == 1
|
||||
and rodata_matches
|
||||
and data_size_matches
|
||||
and bss_size_matches
|
||||
):
|
||||
continue
|
||||
|
||||
if csv:
|
||||
print(
|
||||
f"{c_path},{len(insts1)},{len(insts2)},{added},{removed},{changed},{progress:.3f}"
|
||||
f"{c_path},{len(insts1)},{len(insts2)},{text_progress:.3f},{rodata_matches},{data_size_matches},{bss_size_matches}"
|
||||
)
|
||||
elif progress == 1.0:
|
||||
print(f" OK {c_path}")
|
||||
else:
|
||||
print(f" {math.floor(progress * 100):>2}% {c_path}")
|
||||
ok = green("OK")
|
||||
diff = red("diff")
|
||||
text_progress_str = (
|
||||
ok
|
||||
if text_progress == 1
|
||||
else red(f"{math.floor(text_progress * 100):>2}%")
|
||||
)
|
||||
rodata_str = ok if rodata_matches else diff
|
||||
data_size_str = ok if data_size_matches else diff
|
||||
bss_size_str = ok if bss_size_matches else diff
|
||||
print(
|
||||
f"text:{text_progress_str:<13} rodata:{rodata_str:<13} data size:{data_size_str:<13} bss size:{bss_size_str:<13} {c_path}"
|
||||
)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Calculate progress matching .text sections"
|
||||
)
|
||||
parser = argparse.ArgumentParser(description="Calculate progress matching retail")
|
||||
parser.add_argument(
|
||||
"file",
|
||||
metavar="FILE",
|
||||
|
@ -236,10 +389,24 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
"-v", "--version", help="version to compare", default="gc-eu-mq"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--data",
|
||||
help="diff .data size, .bss size, and .rodata contents instead of text",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--not-ok",
|
||||
help="only print non-OK files",
|
||||
action="store_true",
|
||||
dest="only_not_ok",
|
||||
)
|
||||
parser.add_argument("--csv", help="print summary CSV", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.file is not None:
|
||||
if args.data:
|
||||
find_data_diffs(args.version, args.file)
|
||||
else:
|
||||
find_functions_with_diffs(args.version, args.file)
|
||||
else:
|
||||
print_summary(args.version, args.csv)
|
||||
print_summary(args.version, args.csv, args.only_not_ok)
|
||||
|
|
66
spec
66
spec
|
@ -20,13 +20,17 @@ beginseg
|
|||
include "$(BUILD_DIR)/src/boot/z_std_dma.o"
|
||||
include "$(BUILD_DIR)/src/boot/yaz0.o"
|
||||
include "$(BUILD_DIR)/src/boot/z_locale.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/boot/assert.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/boot/is_debug.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/driverominit.o"
|
||||
include "$(BUILD_DIR)/src/boot/mio0.o"
|
||||
include "$(BUILD_DIR)/src/boot/stackcheck.o"
|
||||
include "$(BUILD_DIR)/src/boot/logutils.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/libc/sprintf.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/sendmesg.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/getmemsize.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/epidma.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/libc/string.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/os/invalicache.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.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/visetspecial.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/epiwrite.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/yieldthread.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/getcause.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
|
||||
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
|
||||
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/boot/build.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/sirawwrite.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_malloc.o"
|
||||
include "$(BUILD_DIR)/src/code/z_map_mark.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/z_moji.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/code/z_prenmi_buff.o"
|
||||
include "$(BUILD_DIR)/src/code/z_nulltask.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_ss_sram.o"
|
||||
include "$(BUILD_DIR)/src/code/z_rumble.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/data/z_text.data.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/data/unk_8012ABC0.data.o"
|
||||
include "$(BUILD_DIR)/src/code/z_view.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_fade.o"
|
||||
include "$(BUILD_DIR)/src/code/shrink_window.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/db_camera.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/code/code_800BB0A0.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/mempak.o"
|
||||
#endif
|
||||
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_play.o"
|
||||
|
@ -415,7 +437,9 @@ beginseg
|
|||
include "$(BUILD_DIR)/src/code/sys_rumble.o"
|
||||
include "$(BUILD_DIR)/src/code/code_800D31A0.o"
|
||||
include "$(BUILD_DIR)/src/code/irqmgr.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/debug_malloc.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/code/fault.o"
|
||||
include "$(BUILD_DIR)/src/code/fault_drawer.o"
|
||||
#ifndef NON_MATCHING
|
||||
|
@ -423,7 +447,9 @@ beginseg
|
|||
include "$(BUILD_DIR)/data/fault_drawer.bss.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/code/kanread.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/ucode_disas.o"
|
||||
#endif
|
||||
pad_text // audio library aligned to 32 bytes?
|
||||
include "$(BUILD_DIR)/src/audio/lib/data.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/rcp_utils.o"
|
||||
include "$(BUILD_DIR)/src/code/loadfragment2.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/code/mtxuty-cvt.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/code/relocation.o"
|
||||
include "$(BUILD_DIR)/src/code/load.o"
|
||||
include "$(BUILD_DIR)/src/code/code_800FC620.o"
|
||||
|
@ -454,13 +482,18 @@ beginseg
|
|||
include "$(BUILD_DIR)/src/code/code_800FCE80.o"
|
||||
include "$(BUILD_DIR)/src/code/fp.o"
|
||||
include "$(BUILD_DIR)/src/code/system_malloc.o"
|
||||
include "$(BUILD_DIR)/src/code/code_800FD970.o"
|
||||
include "$(BUILD_DIR)/src/code/rand.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/sleep.o"
|
||||
include "$(BUILD_DIR)/src/code/jpegutils.o"
|
||||
include "$(BUILD_DIR)/src/code/jpegdecoder.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/mgu/scale.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/sinf.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/sirawdma.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/pfsgetstatus.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/lookat.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/os/stoptimer.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
|
||||
include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsfindfile.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/contquery.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/lookathil.o"
|
||||
#if !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/mgu/mtxident.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/io/dpgetstat.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
|
||||
include "$(BUILD_DIR)/src/libultra/gu/coss.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/visetevent.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/gu/us2dex.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/contsetch.o"
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o"
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfschecker.o"
|
||||
#endif
|
||||
include "$(BUILD_DIR)/src/libultra/io/aigetlen.o"
|
||||
include "$(BUILD_DIR)/src/libultra/mgu/translate.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/crc.o"
|
||||
#if !OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
|
||||
#endif
|
||||
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/spsetstat.o"
|
||||
include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o"
|
||||
|
@ -542,7 +604,7 @@ beginseg
|
|||
align 0x40
|
||||
include "$(BUILD_DIR)/src/buffers/zbuffer.o"
|
||||
include "$(BUILD_DIR)/src/buffers/gfxbuffers.o"
|
||||
include "$(BUILD_DIR)/src/buffers/heaps.o"
|
||||
include "$(BUILD_DIR)/src/buffers/audio_heap.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -44,18 +44,20 @@ s8 gSfxDefaultReverb = 0;
|
|||
|
||||
s32 D_801333EC = 0; // unused
|
||||
|
||||
#if OOT_DEBUG
|
||||
u8 D_801333F0 = 0;
|
||||
|
||||
u8 gAudioSfxSwapOff = 0;
|
||||
|
||||
u8 D_801333F8 = 0;
|
||||
|
||||
s32 D_801333FC = 0; // unused
|
||||
#endif
|
||||
|
||||
u8 gSeqCmdWritePos = 0;
|
||||
u8 gSeqCmdReadPos = 0;
|
||||
u8 gStartSeqDisabled = false;
|
||||
|
||||
#if OOT_DEBUG
|
||||
u8 gAudioDebugPrintSeqCmd = true;
|
||||
#endif
|
||||
|
||||
u8 gSoundModeList[] = {
|
||||
SOUNDMODE_STEREO,
|
||||
|
|
|
@ -1212,8 +1212,10 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = {
|
|||
{ 0, { 0 } },
|
||||
};
|
||||
|
||||
#if OOT_DEBUG
|
||||
u32 sAudioUpdateStartTime;
|
||||
u32 sAudioUpdateEndTime;
|
||||
#endif
|
||||
f32 D_8016B7A8;
|
||||
f32 D_8016B7AC;
|
||||
f32 D_8016B7B0;
|
||||
|
@ -1223,20 +1225,26 @@ FreqLerp sWaterfallFreqScaleLerp;
|
|||
f32 D_8016B7D8;
|
||||
s8 D_8016B7DC;
|
||||
f32 D_8016B7E0;
|
||||
#if OOT_DEBUG
|
||||
u16 D_8016B7E4;
|
||||
struct {
|
||||
char str[5];
|
||||
u16 num;
|
||||
} sAudioScrPrtBuf[SCROLL_PRINT_BUF_SIZE];
|
||||
#endif
|
||||
u8 sRiverSoundMainBgmVol;
|
||||
u8 sRiverSoundMainBgmCurrentVol;
|
||||
u8 sRiverSoundMainBgmLower;
|
||||
u8 sRiverSoundMainBgmRestore;
|
||||
u8 sGanonsTowerVol;
|
||||
SfxPlayerState sSfxChannelState[0x10];
|
||||
#if OOT_DEBUG
|
||||
char sBinToStrBuf[0x20];
|
||||
#endif
|
||||
u8 sMalonSingingTimer;
|
||||
#if OOT_DEBUG
|
||||
u8 sAudioSpecPeakNumNotes[0x12];
|
||||
#endif
|
||||
u8 sMalonSingingDisabled;
|
||||
u8 D_8016B9F3;
|
||||
u8 sFanfareStartTimer;
|
||||
|
@ -1264,8 +1272,10 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX];
|
|||
u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX];
|
||||
u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX];
|
||||
OcarinaNote sScarecrowsLongSongSecondNote;
|
||||
#if OOT_DEBUG
|
||||
u8 sIsMalonSinging;
|
||||
f32 sMalonSingingDist;
|
||||
#endif
|
||||
|
||||
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "global.h"
|
||||
|
||||
// clang-format off
|
||||
s16 gSawtoothWaveSample[] = {
|
||||
ALIGNED(16) s16 gSawtoothWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167,
|
||||
8191, 9215, 10239, 11263, 12287, 13311, 14335, 15359,
|
||||
|
@ -43,7 +43,7 @@ s16 gSawtoothWaveSample[] = {
|
|||
0, 8191, 16383, 24575, -32767, -24575, -16383, -8191,
|
||||
};
|
||||
|
||||
s16 gTriangleWaveSample[] = {
|
||||
ALIGNED(16) s16 gTriangleWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 2047, 4095, 6143, 8191, 10239, 12287, 14335,
|
||||
16383, 18431, 20479, 22527, 24575, 26623, 28671, 30719,
|
||||
|
@ -85,7 +85,7 @@ s16 gTriangleWaveSample[] = {
|
|||
0, 16383, 32767, 16383, 0, -16383, -32767, -16383,
|
||||
};
|
||||
|
||||
s16 gSineWaveSample[] = {
|
||||
ALIGNED(16) s16 gSineWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 3211, 6392, 9511, 12539, 15446, 18204, 20787,
|
||||
23169, 25329, 27244, 28897, 30272, 31356, 32137, 32609,
|
||||
|
@ -127,7 +127,7 @@ s16 gSineWaveSample[] = {
|
|||
0, 23169, 32767, 23169, 0, -23169, -32767, -23169,
|
||||
};
|
||||
|
||||
s16 gSquareWaveSample[] = {
|
||||
ALIGNED(16) s16 gSquareWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -169,7 +169,7 @@ s16 gSquareWaveSample[] = {
|
|||
0, 0, 32767, 32767, 0, 0, -32767, -32767,
|
||||
};
|
||||
|
||||
s16 gWhiteNoiseSample[] = {
|
||||
ALIGNED(16) s16 gWhiteNoiseSample[] = {
|
||||
// Frequency of 1
|
||||
0, -25689, -25791, 27803, -27568, -21030, 22174, 6298,
|
||||
27071, -18531, 28649, 2284, 3380, 6890, -12682, -21114,
|
||||
|
@ -212,7 +212,7 @@ s16 gWhiteNoiseSample[] = {
|
|||
};
|
||||
|
||||
// Sine White Noise?
|
||||
s16 D_8012EA90[] = {
|
||||
ALIGNED(16) s16 D_8012EA90[] = {
|
||||
// Frequency of 1
|
||||
0, 16316, 20148, 20257, 27209, -32657, 29264, 27259,
|
||||
-29394, -21494, -26410, 30770, 30033, 29130, 20206, 14129,
|
||||
|
@ -255,7 +255,7 @@ s16 D_8012EA90[] = {
|
|||
};
|
||||
|
||||
// Pulse Wave (duty cycle = 12.5%)
|
||||
s16 gEighthPulseWaveSample[] = {
|
||||
ALIGNED(16) s16 gEighthPulseWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -298,7 +298,7 @@ s16 gEighthPulseWaveSample[] = {
|
|||
};
|
||||
|
||||
// Pulse Wave (duty cycle = 25%)
|
||||
s16 gQuarterPulseWaveSample[] = {
|
||||
ALIGNED(16) s16 gQuarterPulseWaveSample[] = {
|
||||
// Frequency of 1
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -686,7 +686,7 @@ f32 gDefaultPanVolume[] = {
|
|||
0.086471f, 0.074143f, 0.061803f, 0.049454f, 0.037097f, 0.024734f, 0.012368f, 0.0f,
|
||||
};
|
||||
|
||||
s16 gLowPassFilterData[16 * 8] = {
|
||||
ALIGNED(16) s16 gLowPassFilterData[16 * 8] = {
|
||||
/* 0x0 */ 0, 0, 0, 32767, 0, 0, 0, 0, // Identity filter (delta function)
|
||||
/* 0x1 */ 3854, 4188, 4398, 4469, 4398, 4188, 3854, 3416,
|
||||
/* 0x2 */ 3415, 4314, 4915, 5126, 4915, 4314, 3415, 2351,
|
||||
|
@ -705,7 +705,7 @@ s16 gLowPassFilterData[16 * 8] = {
|
|||
/* 0xF */ 841, -853, 863, 26829, 863, -853, 841, -820,
|
||||
};
|
||||
|
||||
s16 gHighPassFilterData[15 * 8] = {
|
||||
ALIGNED(16) s16 gHighPassFilterData[15 * 8] = {
|
||||
/* 0x0 */ -289, -291, -289, 30736, -289, -291, -289, -290,
|
||||
/* 0x1 */ -464, -467, -467, 29506, -467, -467, -464, -463,
|
||||
/* 0x2 */ -662, -670, -672, 28101, -672, -670, -662, -656,
|
||||
|
@ -723,7 +723,7 @@ s16 gHighPassFilterData[15 * 8] = {
|
|||
/* 0xE */ -772, -3, -6985, 17240, -6985, -3, -772, -3,
|
||||
};
|
||||
|
||||
s16 D_80130418[8 * 8] = {
|
||||
ALIGNED(16) s16 D_80130418[8 * 8] = {
|
||||
/* 0x0 */ 0, 6392, 12539, 18204, 23169, 27244, 30272, 32137,
|
||||
/* 0x1 */ 32767, 32137, 30272, 27244, 23169, 18204, 12539, 6392,
|
||||
/* 0x2 */ 0, -3211, -6392, -9511, -12539, -15446, -18204, -20787,
|
||||
|
|
|
@ -1133,9 +1133,19 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
s32 i;
|
||||
u8* audioContextPtr = (u8*)&gAudioCtx;
|
||||
|
||||
#ifndef AVOID_UB
|
||||
//! @bug This clearing loop sets one extra byte to 0 following gAudioCtx.
|
||||
//! In practice this is harmless as it would set the most significant byte in gAudioCustomUpdateFunction to 0,
|
||||
//! which was just reset to NULL above.
|
||||
for (i = sizeof(gAudioCtx); i >= 0; i--) {
|
||||
*audioContextPtr++ = 0;
|
||||
}
|
||||
#else
|
||||
// Avoid out-of-bounds variable access
|
||||
for (i = sizeof(gAudioCtx); i > 0; i--) {
|
||||
*audioContextPtr++ = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// 1000 is a conversion from seconds to milliseconds
|
||||
|
|
|
@ -33,9 +33,12 @@ ActiveSfx gActiveSfx[7][3];
|
|||
u8 sCurSfxPlayerChannelIndex;
|
||||
u8 gSfxBankMuted[7];
|
||||
UnusedBankLerp sUnusedBankLerp[7];
|
||||
|
||||
#if OOT_DEBUG
|
||||
u16 gAudioSfxSwapSource[10];
|
||||
u16 gAudioSfxSwapTarget[10];
|
||||
u8 gAudioSfxSwapMode[10];
|
||||
#endif
|
||||
|
||||
void Audio_SetSfxBanksMute(u16 muteMask) {
|
||||
u8 bankId;
|
||||
|
|
|
@ -46,7 +46,8 @@ void Idle_ThreadEntry(void* arg) {
|
|||
PRINTF("ダイナミックバッファのサイズは %d キロバイトです\n", 0x92);
|
||||
PRINTF("FIFOバッファのサイズは %d キロバイトです\n", 0x60);
|
||||
PRINTF("YIELDバッファのサイズは %d キロバイトです\n", 3);
|
||||
PRINTF("オーディオヒープのサイズは %d キロバイトです\n", ((intptr_t)gSystemHeap - (intptr_t)gAudioHeap) / 1024);
|
||||
PRINTF("オーディオヒープのサイズは %d キロバイトです\n",
|
||||
((intptr_t)&gAudioHeap[ARRAY_COUNT(gAudioHeap)] - (intptr_t)gAudioHeap) / 1024);
|
||||
PRINTF(VT_RST);
|
||||
|
||||
osCreateViManager(OS_PRIORITY_VIMGR);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "global.h"
|
||||
|
||||
OSPiHandle* sISVHandle; // official name : is_Handle
|
||||
|
||||
#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000)
|
||||
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
|
||||
|
||||
#if OOT_DEBUG
|
||||
OSPiHandle* sISVHandle; // official name : is_Handle
|
||||
|
||||
void isPrintfInit(void) {
|
||||
sISVHandle = osCartRomInit();
|
||||
osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0);
|
||||
|
@ -95,7 +95,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, size_t count) {
|
|||
return (void*)1;
|
||||
}
|
||||
|
||||
NORETURN void func_80002384(const char* exp, const char* file, u32 line) {
|
||||
NORETURN void func_80002384(const char* exp, const char* file, int line) {
|
||||
osSyncPrintf("File:%s Line:%d %s \n", file, line, exp);
|
||||
while (true) {
|
||||
;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "terminal.h"
|
||||
|
||||
#if OOT_DEBUG
|
||||
f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min,
|
||||
f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min,
|
||||
const char* maxName, f32 max) {
|
||||
if (value < min || max < value) {
|
||||
PRINTF("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, maxName,
|
||||
|
@ -11,7 +11,7 @@ f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f
|
|||
return value;
|
||||
}
|
||||
|
||||
s32 LogUtils_CheckIntRange(const char* exp, s32 line, const char* valueName, s32 value, const char* minName, s32 min,
|
||||
s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min,
|
||||
const char* maxName, s32 max) {
|
||||
if (value < min || max < value) {
|
||||
PRINTF("%s %d: range error %s(%d) < %s(%d) < %s(%d)\n", exp, line, minName, min, valueName, value, maxName,
|
||||
|
@ -73,11 +73,11 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) {
|
|||
}
|
||||
}
|
||||
|
||||
void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, s32 line) {
|
||||
void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, int line) {
|
||||
PRINTF(VT_COL(RED, WHITE) "%s %d %s[%d] max=%u ptr=%08x\n" VT_RST, file, line, name, value, max, ptr);
|
||||
}
|
||||
|
||||
void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line) {
|
||||
void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, int line) {
|
||||
u32 mask = (unk - 1);
|
||||
|
||||
if (value & mask) {
|
||||
|
@ -85,24 +85,24 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi
|
|||
}
|
||||
}
|
||||
|
||||
void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line) {
|
||||
void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line) {
|
||||
if (ptr == NULL) {
|
||||
PRINTF(VT_COL(RED, WHITE) "%s %d:%s は はヌルポインタです\n" VT_RST, file, line, exp);
|
||||
}
|
||||
}
|
||||
|
||||
void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line) {
|
||||
void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line) {
|
||||
if (ptr == NULL || (u32)ptr < 0x80000000 || (0x80000000 + osMemSize) <= (u32)ptr) {
|
||||
PRINTF(VT_COL(RED, WHITE) "%s %d:ポインタ %s(%08x) が異常です\n" VT_RST, file, line, exp, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void LogUtils_LogThreadId(const char* name, s32 line) {
|
||||
void LogUtils_LogThreadId(const char* name, int line) {
|
||||
PRINTF("<%d %s %d>", osGetThreadId(NULL), name, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
void LogUtils_HungupThread(const char* name, s32 line) {
|
||||
void LogUtils_HungupThread(const char* name, int line) {
|
||||
OSId threadId = osGetThreadId(NULL);
|
||||
|
||||
PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line);
|
||||
|
|
|
@ -98,6 +98,11 @@ u32 StackCheck_GetState(StackEntry* entry) {
|
|||
ret = STACK_STATUS_OK;
|
||||
}
|
||||
|
||||
#if !OOT_DEBUG
|
||||
// This string is still in .rodata for retail builds
|
||||
(void)"(null)";
|
||||
#endif
|
||||
|
||||
PRINTF("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free,
|
||||
entry->name != NULL ? entry->name : "(null)");
|
||||
PRINTF(VT_RST);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "global.h"
|
||||
|
||||
u8 sYaz0DataBuffer[0x400];
|
||||
ALIGNED(16) u8 sYaz0DataBuffer[0x400];
|
||||
u8* sYaz0DataBufferEnd;
|
||||
uintptr_t sYaz0CurRomStart;
|
||||
size_t sYaz0CurSize;
|
||||
|
|
|
@ -598,7 +598,7 @@ void DmaMgr_Init(void) {
|
|||
* @see DmaMgr_RequestAsync
|
||||
*/
|
||||
s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue,
|
||||
OSMesg msg, const char* file, s32 line) {
|
||||
OSMesg msg, const char* file, int line) {
|
||||
req->filename = file;
|
||||
req->line = line;
|
||||
return DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg);
|
||||
|
@ -609,7 +609,7 @@ s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t
|
|||
*
|
||||
* @see DmaMgr_RequestSync
|
||||
*/
|
||||
s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line) {
|
||||
s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line) {
|
||||
DmaRequest req;
|
||||
s32 ret;
|
||||
OSMesgQueue queue;
|
||||
|
|
3
src/buffers/audio_heap.c
Normal file
3
src/buffers/audio_heap.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "z64.h"
|
||||
|
||||
ALIGNED(16) u8 gAudioHeap[0x38000];
|
|
@ -1,13 +1,9 @@
|
|||
#include "z64.h"
|
||||
|
||||
// 0x18000 bytes
|
||||
u64 gGfxSPTaskOutputBuffer[0x3000];
|
||||
ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000];
|
||||
|
||||
// 0xC00 bytes
|
||||
u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)];
|
||||
ALIGNED(16) u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)];
|
||||
|
||||
// 0x400 bytes
|
||||
u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64];
|
||||
ALIGNED(16) u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64];
|
||||
|
||||
// 0x12410 bytes each; 0x24820 bytes total
|
||||
GfxPool gGfxPools[2];
|
||||
ALIGNED(16) GfxPool gGfxPools[2];
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#include "z64.h"
|
||||
|
||||
// 0x38000 bytes
|
||||
u8 gAudioHeap[0x38000];
|
||||
|
||||
u8 gSystemHeap[UNK_SIZE];
|
|
@ -1,4 +1,3 @@
|
|||
#include "z64.h"
|
||||
|
||||
// 0x25800 bytes
|
||||
u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH];
|
||||
ALIGNED(64) u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH];
|
||||
|
|
|
@ -681,6 +681,14 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) {
|
|||
(((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \
|
||||
: (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3))))
|
||||
|
||||
#if OOT_DEBUG
|
||||
#define R_HREG_MODE_DEBUG R_HREG_MODE
|
||||
#else
|
||||
#define R_HREG_MODE_DEBUG ((void)0, 0)
|
||||
#endif
|
||||
|
||||
#define PRERENDER_DIVOT_CONTROL (R_HREG_MODE_DEBUG == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0)
|
||||
|
||||
/**
|
||||
* Applies the Video Interface divot filter to an image.
|
||||
*
|
||||
|
@ -696,7 +704,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) {
|
|||
void PreRender_DivotFilter(PreRender* this) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
s32 pad1;
|
||||
s32 cvg;
|
||||
u8* buffR = alloca(this->width);
|
||||
u8* buffG = alloca(this->width);
|
||||
u8* buffB = alloca(this->width);
|
||||
|
@ -704,14 +712,14 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
s32 pxR;
|
||||
s32 pxG;
|
||||
s32 pxB;
|
||||
Color_RGBA16 pxIn;
|
||||
Color_RGBA16 pxOut;
|
||||
|
||||
for (y = 0; y < this->height; y++) {
|
||||
// The divot filter is applied row-by-row as it only needs to use pixels that are horizontally adjacent
|
||||
|
||||
// Decompose each pixel into color channels
|
||||
for (x = 0; x < this->width; x++) {
|
||||
Color_RGBA16 pxIn;
|
||||
|
||||
pxIn.rgba = this->fbufSave[x + y * this->width];
|
||||
buffR[x] = pxIn.r;
|
||||
buffG[x] = pxIn.g;
|
||||
|
@ -721,8 +729,7 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
// Apply the divot filter itself. For pixels with partial coverage, the filter selects the median value from a
|
||||
// window of 3 pixels in a horizontal row and uses that as the value for the center pixel.
|
||||
for (x = 1; x < this->width - 1; x++) {
|
||||
Color_RGBA16 pxOut;
|
||||
s32 cvg = this->cvgSave[x + y * this->width];
|
||||
cvg = this->cvgSave[x + y * this->width];
|
||||
|
||||
// Reject pixels with full coverage. The hardware video filter divot circuit checks if all 3 pixels in the
|
||||
// window have partial coverage, here only the center pixel is checked.
|
||||
|
@ -732,11 +739,10 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
}
|
||||
|
||||
// This condition is checked before entering this function, it will always pass if it runs.
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {}
|
||||
if (PRERENDER_DIVOT_CONTROL != 0) {
|
||||
if (PRERENDER_DIVOT_CONTROL != 0) {}
|
||||
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_PARTIAL_CVG_RED) {
|
||||
if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_PARTIAL_CVG_RED) {
|
||||
// Fill the pixel with full red, likely for debugging
|
||||
pxR = 31;
|
||||
pxG = 0;
|
||||
|
@ -747,8 +753,7 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
u8* windowG = &buffG[x - 1];
|
||||
u8* windowB = &buffB[x - 1];
|
||||
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_PRINT_COLOR) {
|
||||
if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_PRINT_COLOR) {
|
||||
PRINTF("red=%3d %3d %3d %3d grn=%3d %3d %3d %3d blu=%3d %3d %3d %3d \n", windowR[0], windowR[1],
|
||||
windowR[2], MEDIAN3(windowR[0], windowR[1], windowR[2]), windowG[0], windowG[1],
|
||||
windowG[2], MEDIAN3(windowG[0], windowG[1], windowG[2]), windowB[0], windowB[1],
|
||||
|
@ -758,8 +763,7 @@ void PreRender_DivotFilter(PreRender* this) {
|
|||
// Sample the median value from the 3 pixel wide window
|
||||
|
||||
// (Both blocks contain the same code)
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) ==
|
||||
PRERENDER_DIVOT_ALTERNATE_COLOR) {
|
||||
if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_ALTERNATE_COLOR) {
|
||||
pxR = MEDIAN3(windowR[0], windowR[1], windowR[2]);
|
||||
pxG = MEDIAN3(windowG[0], windowG[1], windowG[2]);
|
||||
pxB = MEDIAN3(windowB[0], windowB[1], windowB[2]);
|
||||
|
@ -803,11 +807,9 @@ void PreRender_ApplyFilters(PreRender* this) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
if (PRERENDER_DIVOT_CONTROL != 0) {
|
||||
// Apply divot filter
|
||||
PreRender_DivotFilter(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) {
|
|||
arena->flag &= ~CHECK_FREE_BLOCK_FLAG;
|
||||
}
|
||||
|
||||
void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) {
|
||||
void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, int line, Arena* arena) {
|
||||
node->filename = file;
|
||||
node->line = line;
|
||||
node->threadId = osGetThreadId(NULL);
|
||||
|
@ -254,7 +254,7 @@ void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) {
|
|||
}
|
||||
}
|
||||
|
||||
void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, int line) {
|
||||
ArenaNode* iter;
|
||||
u32 blockSize;
|
||||
ArenaNode* newNode;
|
||||
|
@ -299,7 +299,7 @@ void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line)
|
|||
return alloc;
|
||||
}
|
||||
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line) {
|
||||
void* alloc;
|
||||
|
||||
ArenaImpl_Lock(arena);
|
||||
|
@ -309,7 +309,7 @@ void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
|||
return alloc;
|
||||
}
|
||||
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* newNode;
|
||||
u32 blockSize;
|
||||
|
@ -528,7 +528,7 @@ void __osFree(Arena* arena, void* ptr) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
||||
void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, int line) {
|
||||
ArenaNode* node;
|
||||
ArenaNode* next;
|
||||
ArenaNode* prev;
|
||||
|
@ -586,7 +586,7 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
|||
}
|
||||
}
|
||||
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line) {
|
||||
ArenaImpl_Lock(arena);
|
||||
__osFree_NoLockDebug(arena, ptr, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
@ -695,7 +695,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line) {
|
||||
return __osRealloc(arena, ptr, newSize);
|
||||
}
|
||||
#endif
|
||||
|
@ -852,7 +852,11 @@ u32 __osCheckArena(Arena* arena) {
|
|||
while (iter != NULL) {
|
||||
if (iter && iter->magic == NODE_MAGIC) {
|
||||
// "Oops!! (%08x %08x)"
|
||||
#if OOT_DEBUG
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "おおっと!! (%08x %08x)\n" VT_RST, iter, iter->magic);
|
||||
#else
|
||||
osSyncPrintf("おおっと!! (%08x %08x)\n", iter, iter->magic);
|
||||
#endif
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ void AudioMgr_ThreadEntry(void* arg) {
|
|||
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue);
|
||||
|
||||
// Spin waiting for events
|
||||
while (true) {
|
||||
for (;;) {
|
||||
osRecvMesg(&audioMgr->interruptQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
|
||||
|
||||
switch (*msg) {
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
// The latest generated random number, used to generate the next number in the sequence.
|
||||
static u32 sRandInt = 1;
|
||||
|
||||
// Space to store a value to be re-interpreted as a float.
|
||||
static u32 sRandFloat;
|
||||
|
||||
/**
|
||||
* Gets the next integer in the sequence of pseudo-random numbers.
|
||||
*/
|
||||
u32 Rand_Next(void) {
|
||||
return sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds the pseudo-random number generator by providing a starting value.
|
||||
*/
|
||||
void Rand_Seed(u32 seed) {
|
||||
sRandInt = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating
|
||||
* the next integer and masking it to an IEEE-754 compliant floating-point number
|
||||
* between 1.0f and 2.0f, returning the result subtract 1.0f.
|
||||
*/
|
||||
f32 Rand_ZeroOne(void) {
|
||||
sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same
|
||||
* manner in which Rand_ZeroOne generates its result.
|
||||
*/
|
||||
f32 Rand_Centered(void) {
|
||||
sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.5f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds a pseudo-random number at rndNum with a provided seed.
|
||||
*/
|
||||
void Rand_Seed_Variable(u32* rndNum, u32 seed) {
|
||||
*rndNum = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random integer from the provided rndNum.
|
||||
*/
|
||||
u32 Rand_Next_Variable(u32* rndNum) {
|
||||
return *rndNum = (*rndNum * 1664525) + 1013904223;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between 0.0f and
|
||||
* 1.0f from the provided rndNum.
|
||||
*/
|
||||
f32 Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum * 1664525) + 1013904223;
|
||||
|
||||
sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
|
||||
return *((f32*)&sRandFloat) - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between -0.5f and
|
||||
* 0.5f from the provided rndNum.
|
||||
*/
|
||||
f32 Rand_Centered_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum * 1664525) + 1013904223;
|
||||
|
||||
*rndNum = next;
|
||||
sRandFloat = (next >> 9) | 0x3F800000;
|
||||
return *((f32*)&sRandFloat) - 1.5f;
|
||||
}
|
|
@ -36,7 +36,7 @@ void* DebugArena_Malloc(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocDebug(&sDebugArena, size, file, line);
|
||||
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_DEBUG", "確保"); // "Secure"
|
||||
|
@ -52,7 +52,7 @@ void* DebugArena_MallocR(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocRDebug(&sDebugArena, size, file, line);
|
||||
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
|
@ -67,7 +67,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) {
|
||||
ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line);
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
|
@ -79,7 +79,7 @@ void DebugArena_Free(void* ptr) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, int line) {
|
||||
__osFreeDebug(&sDebugArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1322,7 +1322,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) {
|
|||
* Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing
|
||||
* filename and line number
|
||||
*/
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) {
|
||||
NORETURN void Fault_AddHungupAndCrash(const char* file, int line) {
|
||||
char msg[256];
|
||||
|
||||
sprintf(msg, "HungUp %s:%d", file, line);
|
||||
|
|
|
@ -102,11 +102,11 @@ FaultDrawer sFaultDrawerDefault = {
|
|||
#ifndef NON_MATCHING
|
||||
// TODO: match .bss (has reordering issues)
|
||||
extern FaultDrawer sFaultDrawer;
|
||||
extern char D_8016B6BC[0x24];
|
||||
extern char D_8016B6C0[0x20];
|
||||
#else
|
||||
// Non-matching version for struct shiftability
|
||||
FaultDrawer sFaultDrawer;
|
||||
char D_8016B6BC[0x24];
|
||||
char D_8016B6C0[0x20];
|
||||
#endif
|
||||
|
||||
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
|
|
|
@ -6,10 +6,11 @@ VisCvg sVisCvg;
|
|||
VisZBuf sVisZBuf;
|
||||
VisMono sVisMono;
|
||||
ViMode sViMode;
|
||||
|
||||
#if OOT_DEBUG
|
||||
FaultClient sGameFaultClient;
|
||||
u16 sLastButtonPressed;
|
||||
|
||||
#if OOT_DEBUG
|
||||
void GameState_FaultPrint(void) {
|
||||
static char sBtnChars[] = "ABZSuldr*+LRudlr";
|
||||
s32 i;
|
||||
|
@ -408,7 +409,10 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
gameState->destroy = NULL;
|
||||
gameState->running = 1;
|
||||
startTime = osGetTime();
|
||||
gameState->size = gameState->init = 0;
|
||||
|
||||
// Thse assignments must be written this way for matching and to avoid a warning due to casting a pointer to an
|
||||
// integer without a cast. This assigns init = NULL and size = 0.
|
||||
gameState->size = (u32)(gameState->init = NULL);
|
||||
|
||||
{
|
||||
s32 requiredScopeTemp;
|
||||
|
@ -494,7 +498,7 @@ u32 GameState_IsRunning(GameState* gameState) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) {
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line) {
|
||||
void* ret;
|
||||
|
||||
if (THA_IsCrash(&gameState->tha)) {
|
||||
|
|
|
@ -13,7 +13,7 @@ void GameAlloc_Log(GameAlloc* this) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) {
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line);
|
||||
|
||||
if (ptr != NULL) {
|
||||
|
|
|
@ -14,8 +14,13 @@ OSTime sGraphPrevUpdateEndTime;
|
|||
*/
|
||||
OSTime sGraphPrevTaskTimeStart;
|
||||
|
||||
#if OOT_DEBUG
|
||||
FaultClient sGraphFaultClient;
|
||||
#endif
|
||||
|
||||
CfbInfo sGraphCfbInfos[3];
|
||||
|
||||
#if OOT_DEBUG
|
||||
FaultClient sGraphUcodeFaultClient;
|
||||
|
||||
UCodeInfo D_8012D230[3] = {
|
||||
|
@ -30,7 +35,6 @@ UCodeInfo D_8012D248[3] = {
|
|||
{ UCODE_S2DEX, gspS2DEX2d_fifoTextStart },
|
||||
};
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Graph_FaultClient(void) {
|
||||
void* nextFb = osViGetNextFramebuffer();
|
||||
void* newFb = (SysCfb_GetFbPtr(0) != nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1);
|
||||
|
@ -501,7 +505,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) {
|
||||
dispRefs[0] = gfxCtx->polyOpa.p;
|
||||
dispRefs[1] = gfxCtx->polyXlu.p;
|
||||
|
@ -513,7 +517,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file,
|
|||
}
|
||||
}
|
||||
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) {
|
||||
if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) {
|
||||
gfxCtx->polyOpa.p = dispRefs[0];
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "global.h"
|
||||
#include "terminal.h"
|
||||
|
||||
extern u8 _buffersSegmentEnd[];
|
||||
|
||||
s32 gScreenWidth = SCREEN_WIDTH;
|
||||
s32 gScreenHeight = SCREEN_HEIGHT;
|
||||
u32 gSystemHeapSize = 0;
|
||||
|
@ -29,7 +31,8 @@ OSMesg sSerialMsgBuf[1];
|
|||
void Main_LogSystemHeap(void) {
|
||||
PRINTF(VT_FGCOL(GREEN));
|
||||
// "System heap size% 08x (% dKB) Start address% 08x"
|
||||
PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
|
||||
PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024,
|
||||
_buffersSegmentEnd);
|
||||
PRINTF(VT_RST);
|
||||
}
|
||||
#endif
|
||||
|
@ -48,7 +51,7 @@ void Main(void* arg) {
|
|||
PreNmiBuff_Init(gAppNmiBufferPtr);
|
||||
Fault_Init();
|
||||
SysCfb_Init(0);
|
||||
systemHeapStart = (uintptr_t)gSystemHeap;
|
||||
systemHeapStart = (uintptr_t)_buffersSegmentEnd;
|
||||
fb = (uintptr_t)SysCfb_GetFbPtr(0);
|
||||
gSystemHeapSize = fb - systemHeapStart;
|
||||
// "System heap initalization"
|
||||
|
|
162
src/code/rand.c
Normal file
162
src/code/rand.c
Normal file
|
@ -0,0 +1,162 @@
|
|||
/**
|
||||
* @file rand.c
|
||||
*
|
||||
* This file implements the primary random number generator the game relies on. The generator is pseudo-random and
|
||||
* implemented as a Linear Congruential Generator (LCG).
|
||||
*
|
||||
* A LCG computes random numbers sequentially via the relation
|
||||
* X(n+1) = (a * X(n) + c) mod m
|
||||
* where m is the modulus, a is the multiplier and c is the increment.
|
||||
*
|
||||
* These three parameters (a,c,m) completely specify the LCG and should be chosen such that
|
||||
* - m > 0
|
||||
* - 0 < a < m
|
||||
* - 0 <= c < m
|
||||
*
|
||||
* The period of the LCG (a, c, m) is the smallest period p such that X(n + p) = X(n), past n=p the sequence will repeat
|
||||
* itself in its outputs.
|
||||
* A good LCG should have the maximum possible period, which will be equal to m as there are at most m possible values
|
||||
* for X. This occurs when (Hull, T.E., & Dobell, A.R. (1962). Random Number Generators. Siam Review, 4, 230-254.):
|
||||
* - m,c are relatively prime, that is the only integer that divides both m and c with no remainder is 1.
|
||||
* - a - 1 is divisible by all prime factors of m.
|
||||
* - a - 1 is divisible by 4 if m is divisible by 4.
|
||||
*
|
||||
* Ideally m is chosen to be a large power of 2 so that the modulo operation is inexpensive to compute. In this case the
|
||||
* prime factors of m = 2^k are just k copies of 2. For k > 1 m is divisible by 4, so a - 1 must be divisible by 4. 2^k
|
||||
* and c can easily be made relatively prime by making c an odd number.
|
||||
* If we let k=32 to match the size of an integer, the modulo operation is made implicit by the width of the data type
|
||||
* and becomes free to compute.
|
||||
*
|
||||
* The parameter a should be selected such that a-1 is divisible by 4 (and hence divisible by 2) and c should be any odd
|
||||
* number. The precise values should fare well against the spectral test, a measure of "how random" a particular LCG is.
|
||||
* A pair (a,c) that satisfies these requirements is (1664525, 1013904223), recommended by "Numerical Recipes in C: The
|
||||
* Art of Scientific Computing" (p. 284).
|
||||
*
|
||||
* Therefore, the LCG with parameters (1664525, 1013904223, 2^32) that is implemented in this file has a maximal period
|
||||
* of 2^32 and produces high-quality pseudo-random numbers.
|
||||
*
|
||||
* @note If sampling the LCG for a n-bit number it is important to use the upper n bits instead of the lower n bits of
|
||||
* the LCG output. The lower n bits only have a period of 2^n which may significantly worsen the quality of the
|
||||
* resulting random numbers compared to the quality of the full 32-bit result.
|
||||
*
|
||||
* @note Original name: qrand.c
|
||||
*/
|
||||
#include "ultra64.h"
|
||||
|
||||
#define RAND_MULTIPLIER 1664525
|
||||
#define RAND_INCREMENT 1013904223
|
||||
|
||||
/**
|
||||
* The latest generated random number, used to generate the next number in the sequence.
|
||||
*
|
||||
* @note Original name: __qrand_idum
|
||||
*/
|
||||
static u32 sRandInt = 1;
|
||||
|
||||
/**
|
||||
* Space to store a value to be re-interpreted as a float.
|
||||
*
|
||||
* @note Orignal name: __qrand_itemp
|
||||
*/
|
||||
static fu sRandFloat;
|
||||
|
||||
/**
|
||||
* Gets the next integer in the sequence of pseudo-random numbers.
|
||||
*
|
||||
* @note Original name: qrand
|
||||
*/
|
||||
u32 Rand_Next(void) {
|
||||
return sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds the pseudo-random number generator by providing a starting value.
|
||||
*
|
||||
* @note Original name: sqrand
|
||||
*/
|
||||
void Rand_Seed(u32 seed) {
|
||||
sRandInt = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating the next integer and masking it
|
||||
* to an IEEE-754 compliant floating-point number between 1.0f and 2.0f, returning the result subtract 1.0f.
|
||||
*
|
||||
* @note This technique for generating pseudo-random floats is recommended as a particularly fast but potentially
|
||||
* non-portable generator in "Numerical Recipes in C: The Art of Scientic Computing", pp. 284-5.
|
||||
*
|
||||
* @note Original name: fqrand
|
||||
*/
|
||||
f32 Rand_ZeroOne(void) {
|
||||
sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
// Samples the upper 23 bits to avoid effectively reducing the LCG period.
|
||||
sRandFloat.i = (sRandInt >> 9) | 0x3F800000;
|
||||
return sRandFloat.f - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same manner in which Rand_ZeroOne
|
||||
* generates its result.
|
||||
*
|
||||
* @see Rand_ZeroOne
|
||||
*
|
||||
* @note Original name: fqrand2
|
||||
*/
|
||||
f32 Rand_Centered(void) {
|
||||
sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
sRandFloat.i = (sRandInt >> 9) | 0x3F800000;
|
||||
return sRandFloat.f - 1.5f;
|
||||
}
|
||||
|
||||
//! All functions below are unused variants of the above four, that use a provided random number variable instead of the
|
||||
//! internal `sRandInt`
|
||||
|
||||
/**
|
||||
* Seeds a pseudo-random number at rndNum with a provided starting value.
|
||||
*
|
||||
* @see Rand_Seed
|
||||
*
|
||||
* @note Original name: sqrand_r
|
||||
*/
|
||||
void Rand_Seed_Variable(u32* rndNum, u32 seed) {
|
||||
*rndNum = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random integer from the provided rndNum.
|
||||
*
|
||||
* @see Rand_Next
|
||||
*
|
||||
* @note Original name: qrand_r
|
||||
*/
|
||||
u32 Rand_Next_Variable(u32* rndNum) {
|
||||
return *rndNum = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between 0.0f and 1.0f from the provided rndNum.
|
||||
*
|
||||
* @see Rand_ZeroOne
|
||||
*
|
||||
* @note Original name: fqrand_r
|
||||
*/
|
||||
f32 Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
|
||||
sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000;
|
||||
return sRandFloat.f - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between -0.5f and 0.5f from the provided rndNum.
|
||||
*
|
||||
* @see Rand_ZeroOne, Rand_Centered
|
||||
*
|
||||
* @note Original name: fqrand2_r
|
||||
*/
|
||||
f32 Rand_Centered_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT;
|
||||
|
||||
sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000;
|
||||
return sRandFloat.f - 1.5f;
|
||||
}
|
|
@ -45,14 +45,14 @@
|
|||
#define RDP_DONE_MSG 668
|
||||
#define NOTIFY_MSG 670 // original name: ENTRY_MSG
|
||||
|
||||
vs32 sSchedDebugPrintfEnabled = false;
|
||||
|
||||
OSTime sRSPGfxTimeStart;
|
||||
OSTime sRSPAudioTimeStart;
|
||||
OSTime sRSPOtherTimeStart;
|
||||
OSTime sRDPTimeStart;
|
||||
|
||||
#if OOT_DEBUG
|
||||
vs32 sSchedDebugPrintfEnabled = false;
|
||||
|
||||
#define SCHED_DEBUG_PRINTF \
|
||||
if (sSchedDebugPrintfEnabled) \
|
||||
PRINTF
|
||||
|
|
|
@ -605,11 +605,11 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
|||
|
||||
#if OOT_DEBUG
|
||||
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line) {
|
||||
return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest);
|
||||
}
|
||||
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) {
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line) {
|
||||
return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)), file, line);
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) {
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line) {
|
||||
s32 i, j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
|
|
@ -36,7 +36,7 @@ void* SystemArena_Malloc(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocDebug(&gSystemArena, size, file, line);
|
||||
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_DEBUG", "確保"); // "Secure"
|
||||
|
@ -52,7 +52,7 @@ void* SystemArena_MallocR(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocRDebug(&gSystemArena, size, file, line);
|
||||
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_r_DEBUG", "確保"); // "Secure"
|
||||
|
@ -67,7 +67,7 @@ void* SystemArena_Realloc(void* ptr, u32 newSize) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) {
|
||||
ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line);
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, newSize, "realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
|
@ -79,7 +79,7 @@ void SystemArena_Free(void* ptr) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, int line) {
|
||||
__osFreeDebug(&gSystemArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#undef DEFINE_ACTOR_UNSET
|
||||
|
||||
// Actor Overlay Table definition
|
||||
#if OOT_DEBUG
|
||||
|
||||
#define DEFINE_ACTOR(name, _1, allocType, nameString) \
|
||||
{ (uintptr_t)_ovl_##name##SegmentRomStart, \
|
||||
(uintptr_t)_ovl_##name##SegmentRomEnd, \
|
||||
|
@ -37,6 +39,24 @@
|
|||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \
|
||||
{ 0, 0, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0 },
|
||||
|
||||
#else
|
||||
|
||||
// Actor name is set to NULL in retail builds
|
||||
#define DEFINE_ACTOR(name, _1, allocType, _3) \
|
||||
{ (uintptr_t)_ovl_##name##SegmentRomStart, \
|
||||
(uintptr_t)_ovl_##name##SegmentRomEnd, \
|
||||
_ovl_##name##SegmentStart, \
|
||||
_ovl_##name##SegmentEnd, \
|
||||
NULL, \
|
||||
&name##_InitVars, \
|
||||
NULL, \
|
||||
allocType, \
|
||||
0 },
|
||||
|
||||
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) { 0, 0, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0 },
|
||||
|
||||
#endif
|
||||
|
||||
#define DEFINE_ACTOR_UNSET(_0) { 0 },
|
||||
|
||||
ActorOverlay gActorOverlayTable[] = {
|
||||
|
|
|
@ -79,10 +79,11 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = {
|
|||
SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET
|
||||
};
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* original name: T_BGCheck_PosErrorCheck
|
||||
*/
|
||||
s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) {
|
||||
s32 BgCheck_PosErrorCheck(Vec3f* pos, const char* file, int line) {
|
||||
if (pos->x >= BGCHECK_XYZ_ABSMAX || pos->x <= -BGCHECK_XYZ_ABSMAX || pos->y >= BGCHECK_XYZ_ABSMAX ||
|
||||
pos->y <= -BGCHECK_XYZ_ABSMAX || pos->z >= BGCHECK_XYZ_ABSMAX || pos->z <= -BGCHECK_XYZ_ABSMAX) {
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
|
@ -94,6 +95,7 @@ s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set SSNode
|
||||
|
@ -194,22 +196,15 @@ void BgCheck_Vec3fToVec3s(Vec3s* dst, Vec3f* src) {
|
|||
* Get CollisionPoly's lowest y point
|
||||
*/
|
||||
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
|
||||
//! 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)) {
|
||||
return vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)].y;
|
||||
}
|
||||
|
||||
a = COLPOLY_VTX_INDEX(poly->flags_vIA);
|
||||
b = COLPOLY_VTX_INDEX(poly->flags_vIB);
|
||||
c = poly->vIC;
|
||||
|
||||
min = vtxList[a].y;
|
||||
} else {
|
||||
s32 a = COLPOLY_VTX_INDEX(poly->flags_vIA);
|
||||
s32 b = COLPOLY_VTX_INDEX(poly->flags_vIB);
|
||||
s32 c = poly->vIC;
|
||||
s16 min = vtxList[a].y;
|
||||
|
||||
if (min > vtxList[b].y) {
|
||||
min = vtxList[b].y;
|
||||
|
@ -219,6 +214,7 @@ s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vtxList) {
|
|||
}
|
||||
return vtxList[c].y;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CollisionPoly get unit normal
|
||||
|
@ -491,8 +487,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll
|
|||
SSNode* curNode;
|
||||
SSNode* nextNode;
|
||||
s32 polyYMin;
|
||||
u16 newNodeId;
|
||||
s16 curPolyId;
|
||||
u16 newNodeId;
|
||||
|
||||
// if list is null
|
||||
if (ssList->head == SS_NULL) {
|
||||
|
@ -514,6 +510,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll
|
|||
while (true) {
|
||||
// if at the end of the list
|
||||
if (curNode->next == SS_NULL) {
|
||||
s32 pad;
|
||||
|
||||
newNodeId = SSNodeList_GetNextNodeIdx(&colCtx->polyNodes);
|
||||
SSNode_SetValue(&colCtx->polyNodes.tbl[newNodeId], &polyId, SS_NULL);
|
||||
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,
|
||||
Vec3f* pos, f32 radius, CollisionPoly** outPoly) {
|
||||
Vec3f resultPos;
|
||||
f32 temp_f2;
|
||||
f32 temp_f2_2;
|
||||
f32 zTemp;
|
||||
f32 xTemp;
|
||||
f32 planeDist;
|
||||
f32 intersect;
|
||||
s32 result;
|
||||
|
@ -690,17 +688,14 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
|
|||
CollisionPoly* polyList;
|
||||
SSNode* curNode;
|
||||
f32 invNormalXZ;
|
||||
f32 zTemp;
|
||||
f32 xTemp;
|
||||
s32 polyId;
|
||||
f32 normalXZ;
|
||||
f32 nx;
|
||||
f32 ny;
|
||||
f32 nz;
|
||||
f32 temp_f16;
|
||||
s32 pad;
|
||||
Vec3s* vtxList;
|
||||
u16 pad;
|
||||
|
||||
f32 temp_f16;
|
||||
f32 zMin;
|
||||
f32 zMax;
|
||||
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 (fabsf(intersect - resultPos.z) <= radius / temp_f16) {
|
||||
if ((intersect - resultPos.z) * nz <= 4.0f) {
|
||||
f32 zIntersectDist = intersect - resultPos.z;
|
||||
|
||||
if (fabsf(zIntersectDist) <= radius / temp_f16) {
|
||||
if (zIntersectDist * nz <= 4.0f) {
|
||||
BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz,
|
||||
invNormalXZ, planeDist, radius, outPoly);
|
||||
result = true;
|
||||
|
@ -790,9 +787,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
|
|||
}
|
||||
if (curNode->next == SS_NULL) {
|
||||
break;
|
||||
} else {
|
||||
curNode = &colCtx->polyNodes.tbl[curNode->next];
|
||||
}
|
||||
curNode = &colCtx->polyNodes.tbl[curNode->next];
|
||||
}
|
||||
|
||||
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 (fabsf(intersect - resultPos.x) <= radius / temp_f16) {
|
||||
if ((intersect - resultPos.x) * nx <= 4.0f) {
|
||||
f32 xIntersectDist = intersect - resultPos.x;
|
||||
|
||||
if (fabsf(xIntersectDist) <= radius / temp_f16) {
|
||||
if (xIntersectDist * nx <= 4.0f) {
|
||||
BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz,
|
||||
invNormalXZ, planeDist, radius, outPoly);
|
||||
result = true;
|
||||
|
@ -871,10 +869,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16
|
|||
}
|
||||
if (curNode->next == SS_NULL) {
|
||||
break;
|
||||
} else {
|
||||
curNode = &colCtx->polyNodes.tbl[curNode->next];
|
||||
continue;
|
||||
}
|
||||
curNode = &colCtx->polyNodes.tbl[curNode->next];
|
||||
}
|
||||
|
||||
*outX = resultPos.x;
|
||||
|
@ -909,6 +905,9 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte
|
|||
*outY = pos->y;
|
||||
|
||||
while (true) {
|
||||
f32 intersectDist;
|
||||
f32 ny;
|
||||
|
||||
curPolyId = curNode->polyId;
|
||||
if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) {
|
||||
if (curNode->next == SS_NULL) {
|
||||
|
@ -921,8 +920,8 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte
|
|||
curPoly = &polyList[curPolyId];
|
||||
|
||||
if (CollisionPoly_CheckYIntersectApprox2(curPoly, vtxList, pos->x, pos->z, &ceilingY)) {
|
||||
f32 intersectDist = ceilingY - *outY;
|
||||
f32 ny = COLPOLY_GET_NORMAL(curPoly->normal.y);
|
||||
intersectDist = ceilingY - *outY;
|
||||
ny = COLPOLY_GET_NORMAL(curPoly->normal.y);
|
||||
|
||||
if (intersectDist > 0.0f && intersectDist < checkHeight && intersectDist * ny <= 0) {
|
||||
*outY = ceilingY - checkHeight;
|
||||
|
@ -958,7 +957,6 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16
|
|||
s32 result;
|
||||
f32 minY;
|
||||
f32 distSq;
|
||||
s16 polyId;
|
||||
|
||||
result = false;
|
||||
polyList = colCtx->colHeader->polyList;
|
||||
|
@ -968,7 +966,8 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16
|
|||
|
||||
curNode = &colCtx->polyNodes.tbl[ssList->head];
|
||||
while (true) {
|
||||
polyId = curNode->polyId;
|
||||
s16 polyId = curNode->polyId;
|
||||
|
||||
checkedPoly = &colCtx->polyNodes.polyCheckTbl[polyId];
|
||||
|
||||
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* polyList = colCtx->colHeader->polyList;
|
||||
Vec3s* vtxList = colCtx->colHeader->vtxList;
|
||||
CollisionPoly* curPoly;
|
||||
u16 nextId;
|
||||
s16 curPolyId;
|
||||
|
||||
while (true) {
|
||||
curPolyId = node->polyId;
|
||||
curPoly = &polyList[curPolyId];
|
||||
u16 nextId;
|
||||
s16 curPolyId = node->polyId;
|
||||
CollisionPoly* curPoly = &polyList[curPolyId];
|
||||
|
||||
if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) {
|
||||
if (node->next == SS_NULL) {
|
||||
break;
|
||||
|
@ -1542,10 +1540,10 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
|
|||
u32 tblMax;
|
||||
u32 memSize;
|
||||
u32 lookupTblMemSize;
|
||||
SSNodeList* nodeList;
|
||||
s32 useCustomSubdivisions;
|
||||
u32 customMemSize;
|
||||
s32 customNodeListMax;
|
||||
SSNodeList* nodeList;
|
||||
u32 customMemSize;
|
||||
s32 useCustomSubdivisions;
|
||||
s32 i;
|
||||
|
||||
colCtx->colHeader = colHeader;
|
||||
|
@ -1717,11 +1715,15 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla
|
|||
if (checkPos.y < colCtx->minBounds.y) {
|
||||
break;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) {
|
||||
if (actor != NULL) {
|
||||
PRINTF("こいつ,pself_actor->name %d\n", actor->id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lookup = BgCheck_GetStaticLookup(colCtx, lookupTbl, &checkPos);
|
||||
if (lookup == NULL) {
|
||||
checkPos.y -= colCtx->subdivLength.y;
|
||||
|
@ -1735,16 +1737,16 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla
|
|||
checkPos.y -= colCtx->subdivLength.y;
|
||||
}
|
||||
|
||||
dynaRaycastDown.play = play;
|
||||
dynaRaycastDown.colCtx = colCtx;
|
||||
dynaRaycastDown.xpFlags = xpFlags;
|
||||
dynaRaycastDown.resultPoly = outPoly;
|
||||
dynaRaycastDown.yIntersect = yIntersect;
|
||||
dynaRaycastDown.pos = pos;
|
||||
dynaRaycastDown.bgId = outBgId;
|
||||
dynaRaycastDown.actor = actor;
|
||||
dynaRaycastDown.downChkFlags = downChkFlags;
|
||||
dynaRaycastDown.chkDist = chkDist;
|
||||
dynaRaycastDown.play = play;
|
||||
dynaRaycastDown.resultPoly = outPoly;
|
||||
dynaRaycastDown.bgId = outBgId;
|
||||
|
||||
yIntersectDyna = BgCheck_RaycastDownDyna(&dynaRaycastDown);
|
||||
|
||||
|
@ -1951,11 +1953,11 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
|
|||
Vec3f checkLinePrev;
|
||||
f32 n2XZDist;
|
||||
f32 n3XZDist;
|
||||
f32 nx3, nz3;
|
||||
s32 bccFlags;
|
||||
f32 nx;
|
||||
f32 nz;
|
||||
Vec3f posIntersect2;
|
||||
s32 bgId2;
|
||||
f32 nx, ny, nz; // unit normal of polygon
|
||||
|
||||
result = false;
|
||||
*outBgId = BGCHECK_SCENE;
|
||||
|
@ -1966,12 +1968,14 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
|
|||
dy = posNext->y - posPrev->y;
|
||||
dz = posNext->z - posPrev->z;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true ||
|
||||
BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) {
|
||||
if (actor != NULL) {
|
||||
PRINTF("こいつ,pself_actor->name %d\n", actor->id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// if there's movement on the xz plane, and argA flag is 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,
|
||||
&bgId, actor, 1.0f, BGCHECK_CHECK_ALL & ~BGCHECK_CHECK_CEILING);
|
||||
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 (ny > 0.5f) {
|
||||
posResult->x = posIntersect.x;
|
||||
|
@ -2061,8 +2066,9 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
|
|||
if (dynaPolyCollision == true || *outBgId != BGCHECK_SCENE) {
|
||||
if (BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posResult, &posIntersect2, &poly,
|
||||
&bgId2, actor, 1.0f, BGCHECK_CHECK_ONE_FACE | BGCHECK_CHECK_WALL)) {
|
||||
nx3 = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
nz3 = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
f32 nx3 = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
f32 nz3 = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
|
||||
n3XZDist = sqrtf(SQ(nx3) + SQ(nz3));
|
||||
|
||||
// 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;
|
||||
*outY = pos->y;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) {
|
||||
if (actor != NULL) {
|
||||
PRINTF("こいつ,pself_actor->name %d\n", actor->id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lookupTbl = colCtx->lookupTbl;
|
||||
if (!BgCheck_PosInStaticBoundingBox(colCtx, pos)) {
|
||||
return false;
|
||||
|
@ -2222,13 +2232,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
Vec3f posBTemp = *posB;
|
||||
Vec3f sectorMin;
|
||||
Vec3f sectorMax;
|
||||
s32 k;
|
||||
StaticLookup* lookup;
|
||||
s32 j;
|
||||
StaticLookup* jLookup;
|
||||
s32 temp_lo;
|
||||
|
||||
*outBgId = BGCHECK_SCENE;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true ||
|
||||
BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) {
|
||||
if (actor != NULL) {
|
||||
|
@ -2237,6 +2244,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
PRINTF("pself_actor == NULLで犯人不明\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->numPolygons);
|
||||
BgCheck_GetStaticLookupIndicesFromPos(colCtx, posA, (Vec3i*)&subdivMin);
|
||||
|
@ -2247,6 +2255,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
*outPoly = NULL;
|
||||
|
||||
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++) {
|
||||
if (subdivMax[i] < subdivMin[i]) {
|
||||
j = subdivMax[i];
|
||||
|
@ -2260,12 +2272,14 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2,
|
|||
sectorMax.z = colCtx->subdivLength.z + sectorMin.z;
|
||||
|
||||
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;
|
||||
sectorMax.y = colCtx->subdivLength.y + sectorMin.y;
|
||||
|
||||
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;
|
||||
sectorMax.x = colCtx->subdivLength.x + sectorMin.x;
|
||||
|
||||
|
@ -2443,11 +2457,14 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP
|
|||
StaticLookup* lookup;
|
||||
|
||||
*outBgId = BGCHECK_SCENE;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) {
|
||||
if (actor != NULL) {
|
||||
PRINTF("こいつ,pself_actor->name %d\n", actor->id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
lookup = BgCheck_GetStaticLookup(colCtx, colCtx->lookupTbl, center);
|
||||
if (lookup == NULL) {
|
||||
|
@ -2784,12 +2801,12 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
|
|||
PRINTF(VT_RST);
|
||||
if (!DynaPoly_IsBgIdBgActor(bgId)) {
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (bgId == -1) {
|
||||
PRINTF(VT_FGCOL(GREEN));
|
||||
// "The index that should have been deleted(? ) was(== -1), processing aborted."
|
||||
PRINTF("DynaPolyInfo_delReserve():削除されているはずの(?)\nインデックス(== -1)のため,処理を中止します。\n");
|
||||
PRINTF(VT_RST);
|
||||
return;
|
||||
} else {
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
// "Unable to deallocate index / index unallocated, processing aborted."
|
||||
|
@ -2797,9 +2814,10 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
|
|||
"確保していない/出来なかったインデックスの解放のため、処理を中止します。index == %d\n",
|
||||
bgId);
|
||||
PRINTF(VT_RST);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
actor = DynaPoly_GetActor(&play->colCtx, bgId);
|
||||
if (actor != NULL) {
|
||||
|
||||
|
@ -2808,6 +2826,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI
|
|||
dyna->bgActorFlags[bgId] |= BGACTOR_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DynaPoly_InvalidateLookup(PlayState* play, DynaCollisionContext* dyna) {
|
||||
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
|
||||
|
@ -2821,7 +2840,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
MtxF mtx;
|
||||
Actor* actor;
|
||||
s32 pad;
|
||||
s32 pad2;
|
||||
f32 radiusSq;
|
||||
f32 numVtxInverse;
|
||||
s32 i;
|
||||
Vec3f pos;
|
||||
|
@ -2851,6 +2870,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
return;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) {
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
// "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);
|
||||
ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices,
|
||||
"pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688);
|
||||
#endif
|
||||
|
||||
if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) &&
|
||||
(BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) {
|
||||
|
@ -2898,7 +2919,9 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
|
||||
*polyStartIndex += pbgdata->numPolygons;
|
||||
*vtxStartIndex += pbgdata->numVertices;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
SkinMatrix_SetTranslateRotateYXZScale(
|
||||
&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,
|
||||
|
@ -2911,6 +2934,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
for (i = 0; i < pbgdata->numVertices; i++) {
|
||||
Vec3f vtx;
|
||||
Vec3f vtxT; // Vtx after mtx transform
|
||||
s32 pad2;
|
||||
|
||||
Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT);
|
||||
|
@ -2937,8 +2961,6 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
newRadiusSq = -SQ(10.0f);
|
||||
|
||||
for (i = 0; i < pbgdata->numVertices; i++) {
|
||||
f32 radiusSq;
|
||||
|
||||
newVtx.x = dyna->vtxList[*vtxStartIndex + i].x;
|
||||
newVtx.y = dyna->vtxList[*vtxStartIndex + i].y;
|
||||
newVtx.z = dyna->vtxList[*vtxStartIndex + i].z;
|
||||
|
@ -2957,10 +2979,10 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
|
|||
*newPoly = pbgdata->polyList[i];
|
||||
|
||||
// Yeah, this is all kinds of fake, but my God, it matches.
|
||||
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) |
|
||||
COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB);
|
||||
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) | COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB);
|
||||
newPoly->vIC = *vtxStartIndex + newPoly->vIC;
|
||||
dVtxList = dyna->vtxList;
|
||||
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;
|
||||
*vtxStartIndex += pbgdata->numVertices;
|
||||
}
|
||||
}
|
||||
|
||||
void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna, Actor* actor) {
|
||||
DynaPolyActor* dynaActor;
|
||||
|
@ -3155,7 +3176,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
|
|||
s32 i2;
|
||||
s32 isPaused;
|
||||
DynaPolyActor* dynaActor;
|
||||
s32 pad;
|
||||
CollisionPoly* poly;
|
||||
Vec3f polyVtx[3];
|
||||
Vec3f polyNorm;
|
||||
u32 polyIndex;
|
||||
|
@ -3167,7 +3188,6 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
|
|||
Vec3f vtx;
|
||||
f32 intersect;
|
||||
ScaleRotPos* curTransform;
|
||||
CollisionPoly* poly;
|
||||
|
||||
result = BGCHECK_Y_MIN;
|
||||
*dynaRaycastDown->bgId = BGCHECK_SCENE;
|
||||
|
@ -3239,9 +3259,12 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
|
|||
vtxList = dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].colHeader->vtxList;
|
||||
|
||||
for (i2 = 0; i2 < 3; i2++) {
|
||||
s32 pad;
|
||||
|
||||
Math_Vec3s_ToVec3f(&vtx, &vtxList[COLPOLY_VTX_INDEX(poly->vtxData[i2])]);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&srpMtx, &vtx, &polyVtx[i2]);
|
||||
}
|
||||
|
||||
Math3D_SurfaceNorm(&polyVtx[0], &polyVtx[1], &polyVtx[2], &polyNorm);
|
||||
magnitude = Math3D_Vec3fMagnitude(&polyNorm);
|
||||
|
||||
|
@ -3290,8 +3313,6 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo
|
|||
f32 invNormalXZ;
|
||||
f32 planeDist;
|
||||
f32 temp_f18;
|
||||
f32 zIntersectDist;
|
||||
f32 xIntersectDist;
|
||||
f32 zMin;
|
||||
f32 zMax;
|
||||
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 (fabsf(intersect - resultPos.z) <= radius / temp_f18) {
|
||||
if ((intersect - resultPos.z) * nz <= 4.0f) {
|
||||
f32 zIntersectDist = intersect - resultPos.z;
|
||||
|
||||
if (fabsf(zIntersectDist) <= radius / temp_f18) {
|
||||
if (zIntersectDist * nz <= 4.0f) {
|
||||
if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz,
|
||||
invNormalXZ, planeDist, radius, outPoly)) {
|
||||
*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)) {
|
||||
xIntersectDist = intersect - resultPos.x;
|
||||
f32 xIntersectDist = intersect - resultPos.x;
|
||||
|
||||
if (fabsf(xIntersectDist) <= radius / temp_f18) {
|
||||
if (xIntersectDist * nx <= 4.0f) {
|
||||
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,
|
||||
WaterBox** outWaterBox) {
|
||||
if (play->sceneId == SCENE_ZORAS_DOMAIN) {
|
||||
s32 pad;
|
||||
|
||||
if (sZorasDomainWaterBoxMinX < x && x < sZorasDomainWaterBoxMaxX && sZorasDomainWaterBoxMinY < *ySurface &&
|
||||
*ySurface < sZorasDomainWaterBoxMaxY && sZorasDomainWaterBoxMinZ < z && z < sZorasDomainWaterBoxMaxZ) {
|
||||
*outWaterBox = &sZorasDomainWaterBox;
|
||||
|
|
|
@ -7048,12 +7048,16 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState
|
|||
R_CAM_DATA(i) = sCamDataRegsInit[i];
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
DebugCamera_Reset(camera, &D_8015BD80);
|
||||
#endif
|
||||
sInitRegs = false;
|
||||
PREG(88) = -1;
|
||||
}
|
||||
camera->play = D_8015BD7C = play;
|
||||
#if OOT_DEBUG
|
||||
DebugCamera_Init(&D_8015BD80, camera);
|
||||
#endif
|
||||
curUID = sNextUID;
|
||||
sNextUID++;
|
||||
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)) {
|
||||
gDebugCamEnabled ^= 1;
|
||||
if (gDebugCamEnabled) {
|
||||
#if OOT_DEBUG
|
||||
DebugCamera_Enable(&D_8015BD80, camera);
|
||||
#endif
|
||||
} else if (camera->play->csCtx.state != CS_STATE_IDLE) {
|
||||
Cutscene_StopManual(camera->play, &camera->play->csCtx);
|
||||
}
|
||||
|
@ -7731,7 +7737,9 @@ Vec3s Camera_Update(Camera* camera) {
|
|||
// Debug cam update
|
||||
if (gDebugCamEnabled) {
|
||||
camera->play->view.fovy = D_8015BD80.fov;
|
||||
#if OOT_DEBUG
|
||||
DebugCamera_Update(&D_8015BD80, camera);
|
||||
#endif
|
||||
View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
|
||||
if (R_DEBUG_CAM_UPDATE) {
|
||||
PRINTF("camera: debug out\n");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "global.h"
|
||||
|
||||
// The use of ALIGNED8 here is just a temporary solution until the SaveContext is re-structured
|
||||
ALIGNED8 SaveContext gSaveContext;
|
||||
ALIGNED(16) SaveContext gSaveContext;
|
||||
u32 D_8015FA88;
|
||||
u32 D_8015FA8C;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ Color_RGBA8 sDebugCamTextColors[] = {
|
|||
{ 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN
|
||||
};
|
||||
|
||||
#if OOT_DEBUG
|
||||
InputCombo sRegGroupInputCombos[REG_GROUPS] = {
|
||||
{ BTN_L, BTN_CUP }, // REG
|
||||
{ BTN_L, BTN_CLEFT }, // SREG
|
||||
|
@ -93,6 +94,7 @@ char sRegGroupChars[REG_GROUPS] = {
|
|||
'k', // kREG
|
||||
'b', // bREG
|
||||
};
|
||||
#endif
|
||||
|
||||
void Regs_Init(void) {
|
||||
s32 i;
|
||||
|
|
|
@ -40,6 +40,22 @@ Gfx sTransTileSetupDL[] = {
|
|||
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) {
|
||||
s32 frame;
|
||||
s32 col;
|
||||
|
@ -61,20 +77,7 @@ void TransitionTile_InitGraphics(TransitionTile* this) {
|
|||
for (row = 0; row < this->rows + 1; row++) {
|
||||
colTex = 0;
|
||||
for (col = 0; col < this->cols + 1; col++) {
|
||||
Vtx_tn* vtxn = &vtx->n;
|
||||
|
||||
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;
|
||||
|
||||
SET_VERTEX(vtx++, col * 0x20, row * 0x20, -5, colTex << 6, rowTex << 6, 0, 0, 120, 255);
|
||||
colTex += 0x20;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) {
|
|||
break;
|
||||
|
||||
case TRANS_FADE_TYPE_ONE_WAY:
|
||||
this->timer += updateRate;
|
||||
((TransitionFade*)thisx)->timer += updateRate;
|
||||
if (this->timer >= gSaveContext.transFadeDuration) {
|
||||
this->timer = gSaveContext.transFadeDuration;
|
||||
this->isDone = true;
|
||||
|
|
|
@ -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);
|
||||
|
||||
if (1) {}
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
if ((overrideLimbDraw == NULL) ||
|
||||
|
|
|
@ -80,9 +80,10 @@ void KaleidoManager_Destroy(void) {
|
|||
void* KaleidoManager_GetRamAddr(void* vram) {
|
||||
KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl;
|
||||
KaleidoMgrOverlay* ovl = iter;
|
||||
u32 i;
|
||||
|
||||
if (ovl == NULL) {
|
||||
u32 i;
|
||||
|
||||
iter = &gKaleidoMgrOverlayTable[0];
|
||||
for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) {
|
||||
if (((uintptr_t)vram >= (uintptr_t)iter->vramStart) && ((uintptr_t)iter->vramEnd >= (uintptr_t)vram)) {
|
||||
|
|
|
@ -56,19 +56,25 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
|||
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
|
||||
if (IS_PAUSED(pauseCtx)) {
|
||||
if (IS_PAUSED(&play->pauseCtx)) {
|
||||
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
|
||||
if (Letterbox_GetSize() == 0) {
|
||||
#if OOT_DEBUG
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_LOG_MODE = 3;
|
||||
#endif
|
||||
|
||||
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER
|
||||
}
|
||||
} else if (pauseCtx->state == PAUSE_STATE_8) {
|
||||
#if OOT_DEBUG
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_LOG_MODE = 3;
|
||||
#endif
|
||||
|
||||
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->savePromptState = PAUSE_SAVE_PROMPT_STATE_APPEARING;
|
||||
|
|
|
@ -50,7 +50,7 @@ void KaleidoSetup_Update(PlayState* play) {
|
|||
(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 (BREG(0)) {
|
||||
if (OOT_DEBUG && BREG(0)) {
|
||||
pauseCtx->debugState = 3;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
|
@ -102,22 +102,23 @@ void KaleidoSetup_Update(PlayState* play) {
|
|||
|
||||
void KaleidoSetup_Init(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
u64 temp = 0; // Necessary to match
|
||||
|
||||
pauseCtx->state = PAUSE_STATE_OFF;
|
||||
pauseCtx->debugState = 0;
|
||||
pauseCtx->alpha = 0;
|
||||
pauseCtx->switchPageTimer = 0;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->nextPageMode = 0;
|
||||
pauseCtx->pageIndex = PAUSE_ITEM;
|
||||
|
||||
pauseCtx->itemPageRoll = pauseCtx->equipPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = 160.0f;
|
||||
// Setting the eye xz here is irrelevant, it's set on pausing in KaleidoSetup_Update
|
||||
// x = -PAUSE_EYE_DIST * PAUSE_ITEM_X
|
||||
pauseCtx->eye.x = pauseCtx->eye.y = 0.0f;
|
||||
pauseCtx->eye.z = -PAUSE_EYE_DIST * PAUSE_ITEM_Z;
|
||||
pauseCtx->eye.y = 0.0f;
|
||||
pauseCtx->eye.x = 0.0f; // -PAUSE_EYE_DIST * PAUSE_ITEM_X
|
||||
|
||||
pauseCtx->savePromptOffsetDepth_ = 936.0f;
|
||||
pauseCtx->itemPageRoll = pauseCtx->equipPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = 160.0f;
|
||||
|
||||
pauseCtx->alpha = 0;
|
||||
|
||||
// mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM
|
||||
pauseCtx->switchPageTimer = pauseCtx->mainState = pauseCtx->nextPageMode = pauseCtx->pageIndex = 0;
|
||||
|
||||
pauseCtx->rollRotSavePrompt_ = -314.0f;
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] = 0;
|
||||
|
@ -130,8 +131,8 @@ void KaleidoSetup_Init(PlayState* play) {
|
|||
pauseCtx->cursorY[PAUSE_ITEM] = 0;
|
||||
pauseCtx->cursorX[PAUSE_MAP] = 0;
|
||||
pauseCtx->cursorY[PAUSE_MAP] = 0;
|
||||
pauseCtx->cursorX[PAUSE_QUEST] = temp;
|
||||
pauseCtx->cursorY[PAUSE_QUEST] = temp;
|
||||
pauseCtx->cursorX[PAUSE_QUEST] = 0;
|
||||
pauseCtx->cursorY[PAUSE_QUEST] = 0;
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] = EQUIP_VALUE_SWORD_KOKIRI;
|
||||
pauseCtx->cursorY[PAUSE_EQUIP] = EQUIP_TYPE_SWORD;
|
||||
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
|
||||
u8 charTmp = character;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -31,10 +33,7 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
|
|||
* the font buffer.
|
||||
*/
|
||||
void Font_LoadOrderedFont(Font* font) {
|
||||
u8* fontBuf;
|
||||
uintptr_t fontStatic;
|
||||
s32 len;
|
||||
s32 jj;
|
||||
s32 codePointIndex;
|
||||
s32 fontBufIndex;
|
||||
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,
|
||||
"../z_kanfont.c", 122);
|
||||
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, jj = len);
|
||||
|
||||
len = jj;
|
||||
for (fontBufIndex = 0, codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
|
||||
if (codePointIndex > len) {
|
||||
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len * 1);
|
||||
|
||||
fontBufIndex = 0;
|
||||
for (codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) {
|
||||
if (codePointIndex > (len * 1)) {
|
||||
PRINTF("ERROR!! エラー!!! error───!!!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
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]);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
|||
|
||||
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.nightFlag = 1);
|
||||
} else {
|
||||
|
@ -335,12 +336,17 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
|||
envCtx->lightSettingOverride = LIGHT_SETTING_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;
|
||||
|
||||
if (CREG(3) != 0) {
|
||||
gSaveContext.chamberCutsceneNum = CREG(3) - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0;
|
||||
play->envCtx.precipitation[PRECIP_RAIN_CUR] = 0;
|
||||
|
@ -405,6 +411,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
|||
gSkyboxIsChanging = false;
|
||||
gSaveContext.retainWeatherMode = false;
|
||||
|
||||
#if OOT_DEBUG
|
||||
R_ENV_LIGHT1_DIR(0) = 80;
|
||||
R_ENV_LIGHT1_DIR(1) = 80;
|
||||
R_ENV_LIGHT1_DIR(2) = 80;
|
||||
|
@ -419,6 +426,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
|
|||
cREG(12) = 0;
|
||||
cREG(13) = 0;
|
||||
cREG(14) = 0;
|
||||
#endif
|
||||
|
||||
gUseCutsceneCam = true;
|
||||
|
||||
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 diff = max - min;
|
||||
f32 ret;
|
||||
|
||||
if (diff != 0.0f) {
|
||||
ret = 1.0f - (max - val) / diff;
|
||||
f32 ret = 1.0f - (max - val) / diff;
|
||||
|
||||
if (!(ret >= 1.0f)) {
|
||||
return ret;
|
||||
|
@ -700,10 +708,12 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (newSkybox1Index == 0xFF) {
|
||||
// "Environment VR data acquisition failed! Report to Sasaki!"
|
||||
PRINTF(VT_COL(RED, WHITE) "\n環境VRデータ取得失敗! ささきまでご報告を!" VT_RST);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((envCtx->skybox1Index != newSkybox1Index) && (envCtx->skyboxDmaState == SKYBOX_DMA_INACTIVE)) {
|
||||
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) {
|
||||
GfxPrint printer;
|
||||
s32 pad[2];
|
||||
|
@ -869,6 +880,7 @@ void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) {
|
|||
*gfx = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Environment_PlayTimeBasedSequence(PlayState* play);
|
||||
void Environment_UpdateRain(PlayState* play);
|
||||
|
@ -881,7 +893,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
u16 j;
|
||||
u16 time;
|
||||
EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList;
|
||||
s32 adjustment;
|
||||
u8 blendRate;
|
||||
|
||||
if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) &&
|
||||
(((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) {
|
||||
|
@ -951,6 +963,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
gSaveContext.save.nightFlag = 0;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) {
|
||||
Gfx* displayList;
|
||||
Gfx* prevDisplayList;
|
||||
|
@ -967,19 +980,21 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
if (1) {}
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) &&
|
||||
(envCtx->lightBlendOverride != LIGHT_BLEND_OVERRIDE_FULL_CONTROL) &&
|
||||
(envCtx->lightSetting != envCtx->lightSettingOverride) && (envCtx->lightBlend >= 1.0f) &&
|
||||
(envCtx->lightSettingOverride <= LIGHT_SETTING_MAX)) {
|
||||
|
||||
envCtx->lightBlend = 0.0f;
|
||||
envCtx->prevLightSetting = envCtx->lightSetting;
|
||||
envCtx->lightSetting = envCtx->lightSettingOverride;
|
||||
envCtx->lightBlend = 0.0f;
|
||||
}
|
||||
|
||||
if (envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_FULL_CONTROL) {
|
||||
if ((envCtx->lightMode == LIGHT_MODE_TIME) &&
|
||||
if (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_FULL_CONTROL) {
|
||||
// Do nothing; Skip updating lights based on time or light settings
|
||||
} else if ((envCtx->lightMode == LIGHT_MODE_TIME) &&
|
||||
(envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTimeBasedLightConfigs[envCtx->lightConfig]); i++) {
|
||||
if ((gSaveContext.skyboxTime >= sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime) &&
|
||||
|
@ -988,8 +1003,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
u8 blend8[2];
|
||||
s16 blend16[2];
|
||||
|
||||
timeChangeBlend =
|
||||
Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime,
|
||||
timeChangeBlend = Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime,
|
||||
sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime,
|
||||
((void)0, gSaveContext.skyboxTime));
|
||||
|
||||
|
@ -1019,11 +1033,10 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
blend8[1] = LERP(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.ambientColor[j],
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i]
|
||||
.nextLightSetting]
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.ambientColor[j],
|
||||
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
|
||||
|
@ -1050,11 +1063,10 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
blend8[1] = LERP(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.light1Color[j],
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i]
|
||||
.nextLightSetting]
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.light1Color[j],
|
||||
timeChangeBlend);
|
||||
*(envCtx->lightSettings.light1Color + j) = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
envCtx->lightSettings.light1Color[j] = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
|
||||
// blend light2Color
|
||||
blend8[0] =
|
||||
|
@ -1066,33 +1078,30 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
blend8[1] = LERP(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.light2Color[j],
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i]
|
||||
.nextLightSetting]
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.light2Color[j],
|
||||
timeChangeBlend);
|
||||
*(envCtx->lightSettings.light2Color + j) = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
envCtx->lightSettings.light2Color[j] = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
}
|
||||
|
||||
// blend fogColor
|
||||
for (j = 0; j < 3; j++) {
|
||||
blend8[0] =
|
||||
LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting]
|
||||
.fogColor[j],
|
||||
blend8[0] = LERP(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].fogColor[j],
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting]
|
||||
.fogColor[j],
|
||||
timeChangeBlend);
|
||||
blend8[1] = LERP(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.fogColor[j],
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i]
|
||||
.nextLightSetting]
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.fogColor[j],
|
||||
timeChangeBlend);
|
||||
*(envCtx->lightSettings.fogColor + j) = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
envCtx->lightSettings.fogColor[j] = LERP(blend8[0], blend8[1], configChangeBlend);
|
||||
}
|
||||
|
||||
blend16[0] = LERP16(
|
||||
ENV_LIGHT_SETTINGS_FOG_NEAR(
|
||||
blend16[0] =
|
||||
LERP16(ENV_LIGHT_SETTINGS_FOG_NEAR(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting]
|
||||
.blendRateAndFogNear),
|
||||
ENV_LIGHT_SETTINGS_FOG_NEAR(
|
||||
|
@ -1104,26 +1113,25 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.blendRateAndFogNear),
|
||||
ENV_LIGHT_SETTINGS_FOG_NEAR(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i]
|
||||
.nextLightSetting]
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.blendRateAndFogNear),
|
||||
timeChangeBlend);
|
||||
|
||||
envCtx->lightSettings.fogNear = LERP16(blend16[0], blend16[1], configChangeBlend);
|
||||
|
||||
blend16[0] = LERP16(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar,
|
||||
blend16[0] =
|
||||
LERP16(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar,
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting].zFar,
|
||||
timeChangeBlend);
|
||||
blend16[1] = LERP16(
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting]
|
||||
.zFar,
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting].zFar,
|
||||
lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting]
|
||||
.zFar,
|
||||
timeChangeBlend);
|
||||
|
||||
envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >=
|
||||
envCtx->numLightSettings) {
|
||||
// "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,
|
||||
envCtx->numLightSettings - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1153,7 +1163,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
envCtx->lightSettings.zFar = lightSettingsList[envCtx->lightSetting].zFar;
|
||||
envCtx->lightBlend = 1.0f;
|
||||
} else {
|
||||
u8 blendRate =
|
||||
blendRate =
|
||||
ENV_LIGHT_SETTINGS_BLEND_RATE_U8(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear);
|
||||
|
||||
if (blendRate == 0) {
|
||||
|
@ -1192,15 +1202,16 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
LERP(lightSettingsList[envCtx->prevLightSetting].fogColor[i],
|
||||
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),
|
||||
envCtx->lightBlend);
|
||||
envCtx->lightSettings.zFar =
|
||||
LERP16(lightSettingsList[envCtx->prevLightSetting].zFar,
|
||||
envCtx->lightSettings.zFar = LERP16(lightSettingsList[envCtx->prevLightSetting].zFar,
|
||||
lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (envCtx->lightSetting >= envCtx->numLightSettings) {
|
||||
// "The color palette seems to be wrong!"
|
||||
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,
|
||||
envCtx->numLightSettings);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
envCtx->lightBlendEnabled = true;
|
||||
|
@ -1261,22 +1272,20 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
envCtx->dirLight2.params.dir.z = envCtx->lightSettings.light2Dir[2];
|
||||
|
||||
// Adjust fog near and far if necessary
|
||||
adjustment = envCtx->lightSettings.fogNear + envCtx->adjFogNear;
|
||||
|
||||
if (adjustment <= ENV_FOGNEAR_MAX) {
|
||||
lightCtx->fogNear = adjustment;
|
||||
if ((envCtx->lightSettings.fogNear + envCtx->adjFogNear) <= ENV_FOGNEAR_MAX) {
|
||||
lightCtx->fogNear = envCtx->lightSettings.fogNear + envCtx->adjFogNear;
|
||||
} else {
|
||||
lightCtx->fogNear = ENV_FOGNEAR_MAX;
|
||||
}
|
||||
|
||||
adjustment = envCtx->lightSettings.zFar + envCtx->adjZFar;
|
||||
|
||||
if (adjustment <= ENV_ZFAR_MAX) {
|
||||
lightCtx->zFar = adjustment;
|
||||
if ((envCtx->lightSettings.zFar + envCtx->adjZFar) <= ENV_ZFAR_MAX) {
|
||||
lightCtx->zFar = envCtx->lightSettings.zFar + envCtx->adjZFar;
|
||||
} else {
|
||||
lightCtx->zFar = ENV_ZFAR_MAX;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
// When environment debug is enabled, various environment related variables can be configured via the reg editor
|
||||
if (R_ENV_DISABLE_DBG) {
|
||||
R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0];
|
||||
|
@ -1357,6 +1366,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
envCtx->windDirection.z = R_ENV_WIND_DIR(2);
|
||||
envCtx->windSpeed = R_ENV_WIND_SPEED;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((envCtx->dirLight1.params.dir.x == 0) && (envCtx->dirLight1.params.dir.y == 0) &&
|
||||
(envCtx->dirLight1.params.dir.z == 0)) {
|
||||
|
@ -2366,9 +2376,6 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) {
|
|||
Color_RGBA8 envColor;
|
||||
s32 pad;
|
||||
f32 sp98;
|
||||
u16 sp96;
|
||||
u16 sp94;
|
||||
u16 sp92;
|
||||
|
||||
switch (sandstormState) {
|
||||
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.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));
|
||||
sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f));
|
||||
{
|
||||
u16 sp96 = (s32)(sSandstormScroll * (11.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);
|
||||
|
||||
|
@ -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);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1, (u32)sp94 % 4096,
|
||||
4095 - ((u32)sp92 % 4096), 256, 64));
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1,
|
||||
(u32)sp94 % 4096, 4095 - ((u32)sp92 % 4096), 256, 64));
|
||||
gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068);
|
||||
}
|
||||
|
||||
sSandstormScroll += (s32)sp98;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ void* ZeldaArena_Malloc(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocDebug(&sZeldaArena, size, file, line);
|
||||
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_DEBUG", "確保"); // "Secure"
|
||||
|
@ -51,7 +51,7 @@ void* ZeldaArena_MallocR(u32 size) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) {
|
||||
void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line);
|
||||
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
|
@ -66,7 +66,7 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) {
|
||||
ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line);
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
|
@ -78,7 +78,7 @@ void ZeldaArena_Free(void* ptr) {
|
|||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) {
|
||||
__osFreeDebug(&sZeldaArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -118,8 +118,8 @@ void MapMark_DrawForDungeon(PlayState* play) {
|
|||
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);
|
||||
|
||||
rectLeft = (GREG(94) + markPoint->x + 204) << 2;
|
||||
rectTop = (GREG(95) + markPoint->y + 140) << 2;
|
||||
rectLeft = ((OOT_DEBUG ? GREG(94) : 0) + markPoint->x + 204) << 2;
|
||||
rectTop = ((OOT_DEBUG ? GREG(95) : 0) + markPoint->y + 140) << 2;
|
||||
gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft,
|
||||
rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx,
|
||||
markInfo->dtdy);
|
||||
|
|
|
@ -291,17 +291,15 @@ void Message_GrowTextbox(MessageContext* msgCtx) {
|
|||
void Message_FindMessage(PlayState* play, u16 textId) {
|
||||
const char* foundSeg;
|
||||
const char* nextSeg;
|
||||
Font* font = &play->msgCtx.font;
|
||||
MessageTableEntry* messageTableEntry = sNesMessageEntryTablePtr;
|
||||
const char** languageSegmentTable;
|
||||
Font* font;
|
||||
const char* seg;
|
||||
|
||||
if (gSaveContext.language == LANGUAGE_ENG) {
|
||||
seg = messageTableEntry->segment;
|
||||
|
||||
while (messageTableEntry->textId != 0xFFFF) {
|
||||
font = &play->msgCtx.font;
|
||||
|
||||
if (messageTableEntry->textId == textId) {
|
||||
foundSeg = messageTableEntry->segment;
|
||||
font->charTexBuf[0] = messageTableEntry->typePos;
|
||||
|
@ -323,8 +321,6 @@ void Message_FindMessage(PlayState* play, u16 textId) {
|
|||
seg = messageTableEntry->segment;
|
||||
|
||||
while (messageTableEntry->textId != 0xFFFF) {
|
||||
font = &play->msgCtx.font;
|
||||
|
||||
if (messageTableEntry->textId == textId) {
|
||||
foundSeg = *languageSegmentTable;
|
||||
font->charTexBuf[0] = messageTableEntry->typePos;
|
||||
|
@ -344,7 +340,6 @@ void Message_FindMessage(PlayState* play, u16 textId) {
|
|||
}
|
||||
// "Message not found!!!"
|
||||
PRINTF(" メッセージが,見つからなかった!!! = %x\n", textId);
|
||||
font = &play->msgCtx.font;
|
||||
messageTableEntry = sNesMessageEntryTablePtr;
|
||||
|
||||
if (gSaveContext.language == LANGUAGE_ENG) {
|
||||
|
@ -368,13 +363,11 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId) {
|
|||
const char* foundSeg;
|
||||
const char* nextSeg;
|
||||
const char* seg;
|
||||
Font* font = &play->msgCtx.font;
|
||||
MessageTableEntry* messageTableEntry = sStaffMessageEntryTablePtr;
|
||||
Font* font;
|
||||
|
||||
seg = messageTableEntry->segment;
|
||||
while (messageTableEntry->textId != 0xFFFF) {
|
||||
font = &play->msgCtx.font;
|
||||
|
||||
if (messageTableEntry->textId == textId) {
|
||||
foundSeg = messageTableEntry->segment;
|
||||
font->charTexBuf[0] = messageTableEntry->typePos;
|
||||
|
@ -981,7 +974,8 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
|||
sMessageHasSetSfx = true;
|
||||
// "Sound (SE)"
|
||||
PRINTF("サウンド(SE)\n");
|
||||
sfxHi = msgCtx->msgBufDecoded[i + 1] << 8;
|
||||
sfxHi = msgCtx->msgBufDecoded[i + 1];
|
||||
sfxHi <<= 8;
|
||||
Audio_PlaySfxGeneral(sfxHi | msgCtx->msgBufDecoded[i + 2], &gSfxDefaultPos, 4,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
@ -1369,8 +1363,8 @@ void Message_Decode(PlayState* play) {
|
|||
}
|
||||
if (loadChar) {
|
||||
Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx);
|
||||
msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0';
|
||||
charTexIdx += FONT_CHAR_TEX_SIZE;
|
||||
msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0';
|
||||
PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]);
|
||||
decodedBufPos++;
|
||||
}
|
||||
|
@ -1390,8 +1384,8 @@ void Message_Decode(PlayState* play) {
|
|||
for (i = 0; i < 2; i++) {
|
||||
if (i == 1 || digits[i] != 0) {
|
||||
Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx);
|
||||
msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0';
|
||||
charTexIdx += FONT_CHAR_TEX_SIZE;
|
||||
msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0';
|
||||
PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]);
|
||||
decodedBufPos++;
|
||||
}
|
||||
|
@ -1579,9 +1573,10 @@ void Message_OpenText(PlayState* play, u16 textId) {
|
|||
Font* font = &msgCtx->font;
|
||||
s16 textBoxType;
|
||||
|
||||
if (msgCtx->msgMode == MSGMODE_NONE) {
|
||||
gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode;
|
||||
}
|
||||
// clang-format off
|
||||
if (msgCtx->msgMode == MSGMODE_NONE) { gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; }
|
||||
// clang-format on
|
||||
|
||||
if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) {
|
||||
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE);
|
||||
}
|
||||
|
@ -1707,6 +1702,7 @@ void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) {
|
|||
}
|
||||
|
||||
void Message_ContinueTextbox(PlayState* play, u16 textId) {
|
||||
s32 pad;
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
|
||||
PRINTF(VT_FGCOL(GREEN));
|
||||
|
@ -2951,6 +2947,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
|
|||
*p = gfx;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* If the s16 variable pointed to by `var` changes in value, a black bar and white box
|
||||
* are briefly drawn onto the screen. It can only watch one variable per build due to
|
||||
|
@ -3002,14 +2999,19 @@ void Message_DrawDebugText(PlayState* play, Gfx** p) {
|
|||
*p = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Message_Draw(PlayState* play) {
|
||||
Gfx* plusOne;
|
||||
Gfx* polyOpaP;
|
||||
|
||||
#if OOT_DEBUG
|
||||
s16 watchVar;
|
||||
#endif
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3554);
|
||||
|
||||
#if OOT_DEBUG
|
||||
watchVar = gSaveContext.save.info.scarecrowLongSongSet;
|
||||
Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx);
|
||||
if (BREG(0) != 0 && play->msgCtx.textId != 0) {
|
||||
|
@ -3021,6 +3023,8 @@ void Message_Draw(PlayState* play) {
|
|||
POLY_OPA_DISP = plusOne;
|
||||
}
|
||||
if (1) {}
|
||||
#endif
|
||||
|
||||
plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, plusOne);
|
||||
Message_DrawMain(play, &plusOne);
|
||||
|
@ -3063,6 +3067,7 @@ void Message_Update(PlayState* play) {
|
|||
s16 playerFocusScreenPosY;
|
||||
s16 actorFocusScreenPosY;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BREG(0) != 0) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) {
|
||||
PRINTF("msgno=%d\n", D_80153D78);
|
||||
|
@ -3088,10 +3093,9 @@ void Message_Update(PlayState* play) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (msgCtx->msgLength == 0) {
|
||||
return;
|
||||
}
|
||||
if (msgCtx->msgLength != 0) {
|
||||
|
||||
switch (msgCtx->msgMode) {
|
||||
case MSGMODE_TEXT_START:
|
||||
|
@ -3119,8 +3123,8 @@ void Message_Update(PlayState* play) {
|
|||
} else {
|
||||
averageY = ((actorFocusScreenPosY - playerFocusScreenPosY) / 2) + playerFocusScreenPosY;
|
||||
}
|
||||
PRINTF("dxpos=%d dypos=%d dypos1 dypos2=%d\n", focusScreenPosX, averageY, playerFocusScreenPosY,
|
||||
actorFocusScreenPosY);
|
||||
PRINTF("dxpos=%d dypos=%d dypos1 dypos2=%d\n", focusScreenPosX, averageY,
|
||||
playerFocusScreenPosY, actorFocusScreenPosY);
|
||||
} else {
|
||||
R_TEXTBOX_X = R_TEXTBOX_X_TARGET;
|
||||
R_TEXTBOX_Y = R_TEXTBOX_Y_TARGET;
|
||||
|
@ -3240,7 +3244,8 @@ void Message_Update(PlayState* play) {
|
|||
}
|
||||
} else if (msgCtx->textboxEndType != TEXTBOX_ENDTYPE_PERSISTENT &&
|
||||
msgCtx->textboxEndType != TEXTBOX_ENDTYPE_EVENT && YREG(31) == 0) {
|
||||
if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && play->msgCtx.ocarinaMode == OCARINA_MODE_01) {
|
||||
if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE &&
|
||||
play->msgCtx.ocarinaMode == OCARINA_MODE_01) {
|
||||
if (Message_ShouldAdvance(play)) {
|
||||
PRINTF("OCARINA_MODE=%d -> ", play->msgCtx.ocarinaMode);
|
||||
play->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04;
|
||||
|
@ -3272,9 +3277,9 @@ void Message_Update(PlayState* play) {
|
|||
(msgCtx->textId >= 0xFA && msgCtx->textId < 0xFE)) {
|
||||
gSaveContext.healthAccumulator = 0x140; // Refill 20 hearts
|
||||
}
|
||||
if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC || msgCtx->textId == 0xCF ||
|
||||
msgCtx->textId == 0x21C || msgCtx->textId == 9 || msgCtx->textId == 0x4078 ||
|
||||
msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) {
|
||||
if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC ||
|
||||
msgCtx->textId == 0xCF || msgCtx->textId == 0x21C || msgCtx->textId == 9 ||
|
||||
msgCtx->textId == 0x4078 || msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) {
|
||||
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
|
||||
}
|
||||
if (play->csCtx.state == 0) {
|
||||
|
@ -3340,6 +3345,7 @@ void Message_Update(PlayState* play) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Message_SetTables(void) {
|
||||
sNesMessageEntryTablePtr = sNesMessageEntryTable;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -10,9 +10,12 @@ TransitionTile sTransitionTile;
|
|||
s32 gTransitionTileState;
|
||||
VisMono sPlayVisMono;
|
||||
Color_RGBA8_u32 gVisMonoColor;
|
||||
|
||||
#if OOT_DEBUG
|
||||
FaultClient D_801614B8;
|
||||
#endif
|
||||
|
||||
s16 sTransitionFillTimer;
|
||||
u64 sDebugCutsceneScriptBuf[0xA00];
|
||||
|
||||
void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn);
|
||||
|
||||
|
@ -451,7 +454,10 @@ void Play_Init(GameState* thisx) {
|
|||
AnimationContext_Update(this, &this->animationCtx);
|
||||
gSaveContext.respawnFlag = 0;
|
||||
|
||||
if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) {
|
||||
#if OOT_DEBUG
|
||||
if (R_USE_DEBUG_CUTSCENE) {
|
||||
static u64 sDebugCutsceneScriptBuf[0xA00];
|
||||
|
||||
gDebugCutsceneScript = sDebugCutsceneScriptBuf;
|
||||
PRINTF("\nkawauso_data=[%x]", gDebugCutsceneScript);
|
||||
|
||||
|
@ -459,6 +465,7 @@ void Play_Init(GameState* thisx) {
|
|||
// Presumably the ROM was larger at a previous point in development when this debug feature was used.
|
||||
DmaMgr_DmaRomToRam(0x03FEB000, gDebugCutsceneScript, sizeof(sDebugCutsceneScriptBuf));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Play_Update(PlayState* this) {
|
||||
|
|
|
@ -152,6 +152,7 @@ void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton,
|
|||
}
|
||||
(*mtx)++;
|
||||
} else if (limbDList != NULL) {
|
||||
if (1) {}
|
||||
MATRIX_TO_MTX(*mtx, "../z_skelanime.c", 954);
|
||||
(*mtx)++;
|
||||
}
|
||||
|
@ -366,6 +367,7 @@ void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton,
|
|||
gSPDisplayList(POLY_OPA_DISP++, newDList);
|
||||
(*limbMatrices)++;
|
||||
} else if (limbDList != NULL) {
|
||||
if (1) {}
|
||||
MATRIX_TO_MTX(*limbMatrices, "../z_skelanime.c", 1249);
|
||||
(*limbMatrices)++;
|
||||
}
|
||||
|
@ -467,7 +469,7 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount
|
|||
u16 staticIndexMax = animHeader->staticIndexMax;
|
||||
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)) {
|
||||
LOG_ADDRESS("out", frameTable, "../z_skelanime.c", 1392);
|
||||
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];
|
||||
frameTable->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_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);
|
||||
entry++;
|
||||
}
|
||||
|
||||
sAnimQueueFlags = 1;
|
||||
|
|
|
@ -511,8 +511,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
|
|||
gSaveContext.save.info.checksum = 0;
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
j = 0;
|
||||
checksum = j = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20) {
|
||||
|
@ -612,12 +611,15 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
|
|||
bzero(&gSaveContext.save.entranceIndex, sizeof(s32));
|
||||
bzero(&gSaveContext.save.linkAge, sizeof(s32));
|
||||
bzero(&gSaveContext.save.cutsceneIndex, sizeof(s32));
|
||||
// note that gSaveContext.save.dayTime is not actually the sizeof(s32)
|
||||
//! @bug gSaveContext.save.dayTime is a u16 but is cleared as a 32-bit value. This is harmless as-is
|
||||
//! since it is followed by nightFlag which is also reset here, but can become an issue if the save
|
||||
//! layout is changed.
|
||||
bzero(&gSaveContext.save.dayTime, sizeof(s32));
|
||||
bzero(&gSaveContext.save.nightFlag, sizeof(s32));
|
||||
bzero(&gSaveContext.save.totalDays, sizeof(s32));
|
||||
bzero(&gSaveContext.save.bgsDayCount, sizeof(s32));
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (!slotNum) {
|
||||
Sram_InitDebugSave();
|
||||
gSaveContext.save.info.playerData.newf[0] = 'Z';
|
||||
|
@ -633,6 +635,9 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
|
|||
} else {
|
||||
Sram_InitNewSave();
|
||||
}
|
||||
#else
|
||||
Sram_InitNewSave();
|
||||
#endif
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
PRINTF("\n--------------------------------------------------------------\n");
|
||||
|
@ -718,20 +723,26 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
|||
u16* ptr;
|
||||
u16 checksum;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (fileSelect->buttonIndex != 0) {
|
||||
Sram_InitNewSave();
|
||||
} else {
|
||||
Sram_InitDebugSave();
|
||||
}
|
||||
#else
|
||||
Sram_InitNewSave();
|
||||
#endif
|
||||
|
||||
gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0;
|
||||
gSaveContext.save.linkAge = LINK_AGE_CHILD;
|
||||
gSaveContext.save.dayTime = CLOCK_TIME(10, 0);
|
||||
gSaveContext.save.cutsceneIndex = 0xFFF1;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (fileSelect->buttonIndex == 0) {
|
||||
gSaveContext.save.cutsceneIndex = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (offset = 0; offset < 8; offset++) {
|
||||
gSaveContext.save.info.playerData.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset];
|
||||
|
@ -753,10 +764,8 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
|||
PRINTF("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
||||
|
||||
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);
|
||||
checksum += *ptr++;
|
||||
if (++j == 0x20) {
|
||||
|
@ -893,6 +902,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
|||
Sram_WriteSramHeader(sramCtx);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
|
@ -901,6 +911,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
|||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
PRINTF("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
||||
}
|
||||
#endif
|
||||
|
||||
// "GOOD! GOOD! Size = %d + %d = %d"
|
||||
PRINTF("GOOD!GOOD! サイズ=%d + %d = %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4);
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef struct {
|
|||
|
||||
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) {
|
||||
u32 prevInt;
|
||||
OSPiHandle* handle = &sSsSramContext.piHandle;
|
||||
|
@ -49,7 +49,7 @@ void SsSram_Dma(void* dramAddr, size_t size, s32 direction) {
|
|||
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);
|
||||
SsSram_Init(addr, DEVICE_TYPE_SRAM, PI_DOMAIN2, 5, 0xD, 2, 0xC, 0);
|
||||
SsSram_Dma(dramAddr, size, direction);
|
||||
|
|
|
@ -47,14 +47,18 @@ extern u16 D_0E000000[];
|
|||
void VisZBuf_Init(VisZBuf* this) {
|
||||
this->vis.type = VIS_ZBUF_TYPE_IA;
|
||||
this->vis.scissorType = VIS_NO_SETSCISSOR;
|
||||
|
||||
this->vis.primColor.r = 255;
|
||||
this->vis.primColor.g = 255;
|
||||
this->vis.primColor.b = 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.r = 0;
|
||||
this->vis.envColor.g = 0;
|
||||
this->vis.envColor.b = 0;
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void VisZBuf_Destroy(VisZBuf* this) {
|
||||
|
|
|
@ -139,25 +139,6 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
|
|||
|
||||
void ArmsHook_Shoot(ArmsHook* this, PlayState* 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))) {
|
||||
ArmsHook_DetachHookFromActor(this);
|
||||
|
@ -170,7 +151,8 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
|
|||
|
||||
if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) &&
|
||||
(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 (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) {
|
||||
ArmsHook_AttachHookToActor(this, touchedActor);
|
||||
|
@ -182,7 +164,20 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
|
|||
this->timer = 0;
|
||||
Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&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;
|
||||
if (grabbed != NULL) {
|
||||
if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) {
|
||||
|
@ -250,6 +245,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
CollisionPoly* poly;
|
||||
s32 bgId;
|
||||
Vec3f intersectPos;
|
||||
Vec3f prevFrameDiff;
|
||||
Vec3f sp60;
|
||||
|
||||
Actor_MoveXZGravity(&this->actor);
|
||||
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
|
||||
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,
|
||||
&bgId) &&
|
||||
!func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) {
|
||||
polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
f32 polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
f32 polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
s32 pad;
|
||||
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos);
|
||||
this->actor.world.pos.x += 10.0f * polyNormalX;
|
||||
this->actor.world.pos.z += 10.0f * polyNormalZ;
|
||||
this->timer = 0;
|
||||
if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) {
|
||||
DynaPolyActor* dynaPolyActor;
|
||||
|
||||
if (bgId != BGCHECK_SCENE) {
|
||||
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
|
||||
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)) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850);
|
||||
|
||||
if (1) {}
|
||||
|
||||
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
|
||||
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
|
||||
Matrix_MultVec3f(&D_80865B88, &hookNewTip);
|
||||
|
|
|
@ -90,17 +90,21 @@ static InitChainEntry sInitChain[] = {
|
|||
static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f };
|
||||
|
||||
void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) {
|
||||
s16 pad1;
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s16 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
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,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) {
|
||||
|
|
|
@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (givingReward) {
|
||||
if (!IS_CUTSCENE_LAYER) {
|
||||
if (!IS_CUTSCENE_LAYER || !OOT_DEBUG) {
|
||||
if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
|
||||
switch (this->fountainType) {
|
||||
case FAIRY_SPELL_FARORES_WIND:
|
||||
|
|
|
@ -97,12 +97,11 @@ void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) {
|
|||
void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
Actor* prop;
|
||||
BgGanonOtyuka* platform;
|
||||
s16 i;
|
||||
f32 dx;
|
||||
f32 dy;
|
||||
f32 dz;
|
||||
Vec3f center;
|
||||
s16 i;
|
||||
|
||||
if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) {
|
||||
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)) {
|
||||
prop = prop->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
platform = (BgGanonOtyuka*)prop;
|
||||
} else {
|
||||
BgGanonOtyuka* platform = (BgGanonOtyuka*)prop;
|
||||
|
||||
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;
|
||||
|
@ -124,10 +122,10 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) {
|
|||
if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) {
|
||||
platform->visibleSides |= sSides[i];
|
||||
break;
|
||||
} else {
|
||||
prop = prop->next;
|
||||
}
|
||||
}
|
||||
prop = prop->next;
|
||||
}
|
||||
}
|
||||
|
||||
PRINTF("OTC O 2\n");
|
||||
|
|
|
@ -125,15 +125,18 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) {
|
|||
} else if ((this->unk_198 % 6) == 0) {
|
||||
s32 i;
|
||||
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;
|
||||
vecB.y = thisx->world.pos.y;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
|
||||
f32 temp_3 = Math_SinS(temp_1);
|
||||
f32 temp_4 = Math_CosS(temp_1);
|
||||
f32 distXZ;
|
||||
temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
|
||||
temp_3 = Math_SinS(temp_1);
|
||||
temp_4 = Math_CosS(temp_1);
|
||||
|
||||
vecB.x = thisx->world.pos.x + (120.0f * temp_3);
|
||||
vecB.z = thisx->world.pos.z + (120.0f * temp_4);
|
||||
|
|
|
@ -315,8 +315,6 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) {
|
|||
if (this->vFlameScale > 0) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716);
|
||||
|
||||
if (1) {}
|
||||
|
||||
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
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_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY);
|
||||
scale = this->vFlameScale * 0.00001f;
|
||||
|
||||
if (1) {}
|
||||
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
|
|
@ -85,14 +85,14 @@ void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void func_8087DB24(BgHakaMegane* this, PlayState* play) {
|
||||
CollisionHeader* colHeader;
|
||||
CollisionHeader* collision;
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
|
||||
this->dyna.actor.objectSlot = this->requiredObjectSlot;
|
||||
this->dyna.actor.draw = BgHakaMegane_Draw;
|
||||
Actor_SetObjectDependency(play, &this->dyna.actor);
|
||||
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {
|
||||
CollisionHeader* colHeader;
|
||||
CollisionHeader* collision;
|
||||
|
||||
this->actionFunc = func_8087DBF0;
|
||||
collision = sCollisionHeaders[this->dyna.actor.params];
|
||||
if (collision != NULL) {
|
||||
|
|
|
@ -199,7 +199,11 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) {
|
|||
f32 angleTemp;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528);
|
||||
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
if (1) {}
|
||||
|
||||
if (this->dyna.actor.params == 0) {
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534),
|
||||
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);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568);
|
||||
|
||||
if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) {
|
||||
s32 pad;
|
||||
Vec3f sp2C;
|
||||
|
|
|
@ -352,6 +352,7 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
|
|||
f32 floorHeight;
|
||||
f32 yIntersect;
|
||||
s32 i;
|
||||
s32 bgId;
|
||||
|
||||
this->dyna.actor.velocity.y *= 1.6f;
|
||||
|
||||
|
@ -366,8 +367,6 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) {
|
|||
floorHeight = this->dyna.actor.floorHeight;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
s32 bgId;
|
||||
|
||||
yIntersect =
|
||||
BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) -
|
||||
25.0f;
|
||||
|
|
|
@ -490,6 +490,8 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) {
|
|||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904);
|
||||
|
||||
if (1) {}
|
||||
|
||||
if (BgHeavyBlock_LiftedUp == this->actionFunc) {
|
||||
Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z,
|
||||
&thisx->shape.rot);
|
||||
|
|
|
@ -86,11 +86,12 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) {
|
|||
this->treasureFlag = (thisx->params >> 6) & 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"
|
||||
PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c",
|
||||
373, this->actor.params);
|
||||
}
|
||||
|
||||
Actor_SetScale(&this->actor, hcParams->scale);
|
||||
Collider_InitCylinder(play, &this->collider);
|
||||
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
|
|
|
@ -58,8 +58,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE };
|
|||
void BgHidanFirewall_Init(Actor* thisx, PlayState* play) {
|
||||
BgHidanFirewall* this = (BgHidanFirewall*)thisx;
|
||||
|
||||
this->actor.scale.x = 0.12f;
|
||||
this->actor.scale.z = 0.12f;
|
||||
this->actor.scale.x = this->actor.scale.z = 0.12f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
|
||||
this->unk_150 = 0;
|
||||
|
|
|
@ -347,11 +347,13 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
|
|||
Actor_MoveXZGravity(&this->dyna.actor);
|
||||
func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (((this->dyna.actor.params & 0xFF) <= 0) || ((this->dyna.actor.params & 0xFF) >= 6)) {
|
||||
// "[Hammer Step] arg_data strange (arg_data = %d)"
|
||||
PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params);
|
||||
PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) <=
|
||||
sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1]) &&
|
||||
|
|
|
@ -82,6 +82,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
CollisionHeader* collisionHeader = NULL;
|
||||
Vec3f* vtx;
|
||||
|
||||
Actor_ProcessInitChain(thisx, sInitChain);
|
||||
this->unk_16A = thisx->params & 0x3F;
|
||||
|
@ -103,7 +104,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) {
|
|||
|
||||
if (1) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
Vec3f* vtx = &colliderElementInit->dim.vtx[j];
|
||||
vtx = &colliderElementInit->dim.vtx[j];
|
||||
|
||||
vertices[j].x = vtx->z * sinRotY + (thisx->home.pos.x + vtx->x * cosRotY);
|
||||
vertices[j].y = vtx->y + thisx->home.pos.y;
|
||||
|
|
|
@ -73,9 +73,12 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) {
|
|||
((s32)thisx->params >> 8) & 0xFF);
|
||||
|
||||
Actor_ProcessInitChain(thisx, sInitChain);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) {
|
||||
PRINTF("arg_data おかしい 【格子】\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
|
||||
|
|
|
@ -130,9 +130,10 @@ void func_8088CEC0(BgHidanSekizou* this, s32 arg1, s16 arg2) {
|
|||
s32 end = start + 3;
|
||||
f32 sp30 = Math_SinS(arg2);
|
||||
f32 sp2C = Math_CosS(arg2);
|
||||
ColliderJntSphElement* element;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
ColliderJntSphElement* element = &this->collider.elements[i];
|
||||
element = &this->collider.elements[i];
|
||||
|
||||
element->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + (sp2C * element->dim.modelSphere.center.x) +
|
||||
(sp30 * element->dim.modelSphere.center.z);
|
||||
|
@ -301,8 +302,8 @@ Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3,
|
|||
f32 phi_f12;
|
||||
|
||||
arg6 = (((arg6 + arg2) % 8) * 7) * (1 / 7.0f);
|
||||
arg2++;
|
||||
gSPSegment(arg7++, 9, SEGMENTED_TO_VIRTUAL(sFireballsTexs[arg6]));
|
||||
arg2++;
|
||||
if (arg2 != 4) {
|
||||
phi_f12 = arg2 + ((4 - this->unk_170) / 4.0f);
|
||||
} else {
|
||||
|
|
|
@ -115,17 +115,20 @@ void BgIceShelter_InitColliders(BgIceShelter* this, PlayState* play) {
|
|||
void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, moveFlag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
s32 pad2;
|
||||
|
||||
// "Warning : move BG registration failed"
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgIceShelter_RotateY(Vec3f* dest, Vec3f* src, s16 angle) {
|
||||
|
@ -144,7 +147,6 @@ static InitChainEntry sInitChain[] = {
|
|||
};
|
||||
|
||||
void BgIceShelter_Init(Actor* thisx, PlayState* play) {
|
||||
static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f };
|
||||
BgIceShelter* this = (BgIceShelter*)thisx;
|
||||
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) {
|
||||
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 {
|
||||
Actor_SetScale(&this->dyna.actor, sRedIceScales[type]);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) {
|
|||
f32 sp24;
|
||||
CollisionHeader* colHeader;
|
||||
s32 sp28;
|
||||
f32 temp_f6;
|
||||
|
||||
colHeader = NULL;
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
|
@ -78,7 +77,8 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
if (sp28 == 2) {
|
||||
temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f;
|
||||
f32 temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f;
|
||||
|
||||
this->dyna.actor.focus.pos.x =
|
||||
(Math_SinS(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y;
|
||||
|
|
|
@ -69,17 +69,20 @@ static InitChainEntry sInitChain[] = {
|
|||
void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, moveFlag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
s32 pad2;
|
||||
|
||||
// "Warning : move BG login failed"
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) {
|
||||
|
|
|
@ -45,15 +45,19 @@ static InitChainEntry sInitChain[] = {
|
|||
void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) {
|
||||
s32 pad1;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
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,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) {
|
||||
|
|
|
@ -74,10 +74,12 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) {
|
|||
this->puzzleFlags &= ~cobraPuzzleFlags[i];
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (curCobraInfo->cobra->dyna.actor.update == NULL) {
|
||||
// "Cobra deleted"
|
||||
PRINTF("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild(
|
||||
&play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y,
|
||||
|
@ -136,17 +138,10 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
|||
this->lightBeams[1] = NULL;
|
||||
this->lightBeams[0] = NULL;
|
||||
} else {
|
||||
puzzleSolved = !!(this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM));
|
||||
|
||||
if (puzzleSolved) {
|
||||
puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED);
|
||||
|
||||
if (puzzleSolved) {
|
||||
puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED);
|
||||
}
|
||||
}
|
||||
lightBeamToggles[0] = puzzleSolved; // Only spawn if puzzle solved
|
||||
if (1) {}
|
||||
// Only spawn if puzzle solved
|
||||
lightBeamToggles[0] = (this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)) &&
|
||||
(this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) &&
|
||||
(this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED);
|
||||
lightBeamToggles[1] = lightBeamToggles[2] =
|
||||
this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM);
|
||||
|
||||
|
@ -158,10 +153,12 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
|
|||
Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y,
|
||||
sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->lightBeams[i] == NULL) {
|
||||
// "Mir Ray generation failed"
|
||||
PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (this->lightBeams[i] != NULL) {
|
||||
|
|
|
@ -63,19 +63,22 @@ static InitChainEntry sInitChain[] = {
|
|||
};
|
||||
|
||||
void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) {
|
||||
s16 pad1;
|
||||
s32 pad1;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s16 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
s32 pad2;
|
||||
|
||||
// "Warning: move BG registration failed"
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) {
|
||||
|
|
|
@ -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) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flags);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
s32 pad2;
|
||||
|
||||
// "Warning : move BG Registration Failure"
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) {
|
||||
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x,
|
||||
this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.actor.child == NULL) {
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
// "Error : Mir Ray occurrence failure"
|
||||
PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_cobra.c", 270);
|
||||
PRINTF(VT_RST);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void func_80895A70(BgJyaCobra* this) {
|
||||
|
|
|
@ -106,10 +106,13 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk
|
|||
f32 sins;
|
||||
s32 pad[2];
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) {
|
||||
PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233, enIk->unk_2FF);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF);
|
||||
rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1];
|
||||
|
||||
|
@ -169,10 +172,13 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk
|
|||
f32 sins;
|
||||
s32 pad[2];
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) {
|
||||
PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362, enIk->unk_2FF);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF);
|
||||
rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1];
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
|
|
@ -43,15 +43,19 @@ static InitChainEntry sInitChain[] = {
|
|||
void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
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,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgJyaKanaami_Init(Actor* thisx, PlayState* play) {
|
||||
|
|
|
@ -217,10 +217,11 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) {
|
|||
|
||||
void BgJyaMegami_SetupExplode(BgJyaMegami* this) {
|
||||
u32 i;
|
||||
Vec3f* pos = &this->dyna.actor.world.pos;
|
||||
|
||||
this->actionFunc = BgJyaMegami_Explode;
|
||||
for (i = 0; i < ARRAY_COUNT(this->pieces); i++) {
|
||||
Math_Vec3f_Copy(&this->pieces[i].pos, &this->dyna.actor.world.pos);
|
||||
Math_Vec3f_Copy(&this->pieces[i].pos, pos);
|
||||
this->pieces[i].vel.x = sPiecesInit[i].velX;
|
||||
}
|
||||
this->explosionTimer = 0;
|
||||
|
|
|
@ -62,15 +62,19 @@ static InitChainEntry sInitChain[] = {
|
|||
void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, flag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
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,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) {
|
||||
|
|
|
@ -182,7 +182,14 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
switch ((u16)this->dyna.actor.params & 0xF) {
|
||||
case MIZUBWALL_FLOOR:
|
||||
case MIZUBWALL_FLOOR: {
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
|
||||
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dList = NULL;
|
||||
|
@ -194,12 +201,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -217,7 +220,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MIZUBWALL_RUTO_ROOM:
|
||||
}
|
||||
case MIZUBWALL_RUTO_ROOM: {
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
|
||||
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dList = NULL;
|
||||
|
@ -229,12 +240,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitRutoWall); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -252,7 +259,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MIZUBWALL_UNUSED:
|
||||
}
|
||||
case MIZUBWALL_UNUSED: {
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
|
||||
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dList = NULL;
|
||||
|
@ -264,12 +279,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -289,7 +300,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MIZUBWALL_STINGER_ROOM_1:
|
||||
}
|
||||
case MIZUBWALL_STINGER_ROOM_1: {
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
|
||||
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dList = NULL;
|
||||
|
@ -302,12 +321,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -327,7 +342,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MIZUBWALL_STINGER_ROOM_2:
|
||||
}
|
||||
case MIZUBWALL_STINGER_ROOM_2: {
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
|
||||
if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dList = NULL;
|
||||
|
@ -340,12 +363,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.params);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f offset;
|
||||
Vec3f vtx[3];
|
||||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
@ -367,6 +386,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
|
@ -377,9 +397,8 @@ void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
void BgMizuBwall_SetAlpha(BgMizuBwall* this, PlayState* play) {
|
||||
f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface;
|
||||
|
||||
if (play->colCtx.colHeader->waterBoxes) {}
|
||||
WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes;
|
||||
f32 waterLevel = waterBoxes[2].ySurface;
|
||||
|
||||
if (waterLevel < WATER_TEMPLE_WATER_F1_Y) {
|
||||
this->scrollAlpha1 = 255;
|
||||
|
|
|
@ -53,6 +53,7 @@ static InitChainEntry sInitChain[] = {
|
|||
u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) {
|
||||
u32 ret;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (bREG(0) != 0) {
|
||||
switch (bREG(1)) {
|
||||
case 0:
|
||||
|
@ -67,6 +68,8 @@ u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) {
|
|||
}
|
||||
bREG(0) = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) {
|
||||
ret = 3;
|
||||
} else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) {
|
||||
|
@ -297,10 +300,13 @@ void BgMizuWater_Update(Actor* thisx, PlayState* play) {
|
|||
s32 unk1;
|
||||
s32 pad;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (bREG(15) == 0) {
|
||||
PRINTF("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG),
|
||||
Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this->type == 0) {
|
||||
posY = this->actor.world.pos.y;
|
||||
unk0 = 0;
|
||||
|
|
|
@ -53,17 +53,20 @@ void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc
|
|||
void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, moveFlag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
s32 pad2;
|
||||
|
||||
// "Warning : move BG login failed"
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue