diff --git a/Jenkinsfile b/Jenkinsfile
index 7212f269b..df06c6a09 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -4,6 +4,12 @@ pipeline {
}
stages {
+ stage('Check formatting') {
+ steps {
+ echo 'Checking formatting...'
+ sh 'bash -c "tools/check_format.sh 2>&1 >(tee tools/check_format.txt)"'
+ }
+ }
stage('Copy ROM') {
steps {
echo 'Setting up ROM...'
@@ -17,7 +23,7 @@ pipeline {
}
stage('Check setup warnings') {
steps {
- sh 'python3 tools/warnings_count/compare_warnings.py tools/warnings_count/warnings_setup_current.txt tools/warnings_count/warnings_setup_new.txt'
+ sh 'bash -c "./tools/warnings_count/compare_warnings.sh setup"'
}
}
stage('Disasm') {
@@ -27,7 +33,7 @@ pipeline {
}
stage('Check disasm warnings') {
steps {
- sh 'python3 tools/warnings_count/compare_warnings.py tools/warnings_count/warnings_disasm_current.txt tools/warnings_count/warnings_disasm_new.txt'
+ sh 'bash -c "./tools/warnings_count/compare_warnings.sh disasm"'
}
}
stage('Build') {
@@ -37,7 +43,7 @@ pipeline {
}
stage('Check build warnings') {
steps {
- sh 'python3 tools/warnings_count/compare_warnings.py tools/warnings_count/warnings_build_current.txt tools/warnings_count/warnings_build_new.txt'
+ sh 'bash -c "./tools/warnings_count/compare_warnings.sh build"'
}
}
stage('Report Progress') {
@@ -68,6 +74,9 @@ pipeline {
}
}
post {
+ failure {
+ sh 'cat tools/check_format.txt tools/warnings_count/warnings_setup_new.txt tools/warnings_count/warnings_disasm_new.txt tools/warnings_count/warnings_build_new.txt'
+ }
always {
cleanWs()
}
diff --git a/Makefile b/Makefile
index bc71a02e1..349c50b67 100644
--- a/Makefile
+++ b/Makefile
@@ -79,7 +79,7 @@ endif
# Check code syntax with host compiler
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label
-CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -include stdarg.h $(CHECK_WARNINGS)
+CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -include stdarg.h $(CHECK_WARNINGS)
CPP := cpp
ELF2ROM := tools/buildtools/elf2rom
@@ -129,7 +129,8 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
-S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s))
+S_FILES := $(shell grep -F "build/asm" spec | sed 's/.*build\/// ; s/\.o\".*/.s/') \
+ $(shell grep -F "build/data" spec | sed 's/.*build\/// ; s/\.o\".*/.s/')
O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \
$(foreach f,$(wildcard baserom/*),build/$f.o) \
$(foreach f,$(C_FILES:.c=.o),build/$f) \
diff --git a/assets/xml/overlays/ovl_Arrow_Ice.xml b/assets/xml/overlays/ovl_Arrow_Ice.xml
new file mode 100644
index 000000000..96c0f2522
--- /dev/null
+++ b/assets/xml/overlays/ovl_Arrow_Ice.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/overlays/ovl_En_Clear_Tag.xml b/assets/xml/overlays/ovl_En_Clear_Tag.xml
index 82a1e2fe8..0cbfcf80a 100644
--- a/assets/xml/overlays/ovl_En_Clear_Tag.xml
+++ b/assets/xml/overlays/ovl_En_Clear_Tag.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/assets/xml/overlays/ovl_En_Holl.xml b/assets/xml/overlays/ovl_En_Holl.xml
index 5679e1605..2baa5737c 100644
--- a/assets/xml/overlays/ovl_En_Holl.xml
+++ b/assets/xml/overlays/ovl_En_Holl.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/format.sh b/format.sh
index c705e9aff..89a0906ad 100755
--- a/format.sh
+++ b/format.sh
@@ -1,15 +1,22 @@
#!/usr/bin/env bash
+FORMAT_VER="11"
FORMAT_OPTS="-i -style=file"
TIDY_OPTS="-p . --fix --fix-errors"
COMPILER_OPTS="-fno-builtin -std=gnu90 -Iinclude -Isrc -D_LANGUAGE_C -DNON_MATCHING"
shopt -s globstar
+if [ -z `command -v clang-format-${FORMAT_VER}` ]
+then
+ echo "clang-format-${FORMAT_VER} not found. Exiting."
+ exit 1
+fi
+
if (( $# > 0 )); then
echo "Formatting file(s) $*"
echo "Running clang-format..."
- clang-format-11 ${FORMAT_OPTS} "$@"
+ clang-format-${FORMAT_VER} ${FORMAT_OPTS} "$@"
echo "Running clang-tidy..."
clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."
@@ -20,9 +27,10 @@ fi
echo "Formatting C files. This will take a bit"
echo "Running clang-format..."
-clang-format-11 ${FORMAT_OPTS} src/**/*.c
+clang-format-${FORMAT_VER} ${FORMAT_OPTS} src/**/*.c
echo "Running clang-tidy..."
clang-tidy ${TIDY_OPTS} src/**/*.c -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."
find src/ -type f -name "*.c" -exec sed -i -e '$a\' {} \;
+find assets/xml/ -type f -name "*.xml" -exec sed -i -e '$a\' {} \;
echo "Done formatting all files."
diff --git a/include/PR/mbi.h b/include/PR/mbi.h
index 85410c912..736018c56 100644
--- a/include/PR/mbi.h
+++ b/include/PR/mbi.h
@@ -92,7 +92,7 @@
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
#ifndef NULL
-#define NULL 0
+#define NULL ((void*)0)
#endif
#endif /* !_MBI_H_ */
diff --git a/include/functions.h b/include/functions.h
index f6dd9476b..6f977f711 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -14,22 +14,23 @@ void bootproc(void);
void Idle_ThreadEntry(void* arg);
void ViConfig_UpdateVi(u32 arg0);
void ViConfig_UpdateBlack(void);
-s32 DmaMgr_DMARomToRam(u32 src, void* dst, u32 size);
-void DmaMgr_DmaCallback0(OSPiHandle* pOParm1, OSIoMesg* pOParm2, s32 OParm3);
+s32 DmaMgr_DMARomToRam(u32 src, void* dst, size_t size);
+void DmaMgr_DmaCallback0(OSPiHandle* piHandle, OSIoMesg* mb, s32 direction);
DmaEntry* DmaMgr_FindDmaEntry(u32 vromAddr);
u32 DmaMgr_TranslateVromToRom(u32 vromAddr);
s32 DmaMgr_FindDmaIndex(u32 vromAddr);
const char* func_800809F4(u32 param_1);
-void DmaMgr_ProcessMsg(DmaRequest* request);
+void DmaMgr_ProcessMsg(DmaRequest* req);
void DmaMgr_ThreadEntry(void* arg);
-s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* callback, void* callbackMesg);
-s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size);
+s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, size_t size, UNK_TYPE4 unused,
+ OSMesgQueue* callback, void* callbackMesg);
+s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, size_t size);
void DmaMgr_Start(void);
void DmaMgr_Stop(void);
void* Yaz0_FirstDMA(void);
void* Yaz0_NextDMA(void* curSrcPos);
s32 Yaz0_DecompressImpl(u8* hdr, u8* dst);
-void Yaz0_Decompress(u32 romStart, void* dst, u32 size);
+void Yaz0_Decompress(u32 romStart, void* dst, size_t size);
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* add, OSMesgQueue* msgQ);
void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove);
void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg);
@@ -54,7 +55,7 @@ void rmonPrintf(const char* fmt, ...);
void Fault_SleepImpl(u32 duration);
void Fault_AddClient(FaultClient* client, fault_client_func callback, void* param0, void* param1);
void Fault_RemoveClient(FaultClient* client);
-void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param);
+void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param);
void Fault_RemoveAddrConvClient(FaultAddrConvClient* client);
void* Fault_ConvertAddress(void* addr);
void Fault_Sleep(u32 duration);
@@ -75,7 +76,7 @@ void osSyncPrintfThreadContext(OSThread* t);
OSThread* Fault_FindFaultedThread(void);
void Fault_Wait5Seconds(void);
void Fault_WaitForButtonCombo(void);
-void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3);
+void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3);
void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1);
void Fault_FindNextStackCall(u32** sp, u32** pc, u32** ra);
void Fault_DrawStackTrace(OSThread* t, u32 flags);
@@ -107,7 +108,7 @@ void FaultDrawer_VPrintf(const char* str, char* args);
void FaultDrawer_Printf(const char* fmt, ...);
void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...);
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h);
-void FaultDrawer_SetInputCallback(func_ptr func);
+void FaultDrawer_SetInputCallback(void* func);
void FaultDrawer_Init(void);
void func_80084940(void);
void func_80084968(void);
@@ -116,7 +117,7 @@ s32 Load_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 allocatedVRa
void* Load_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart);
void Load2_Relocate(u32 allocatedVRamAddr, OverlayRelocationSection* overlayInfo, u32 vRamStart);
s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u32 allocatedVRamAddr);
-void* Load2_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd);
+void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd);
void PadUtils_Init(Input* input);
void func_80085150(void);
void PadUtils_ResetPressRel(Input* input);
@@ -139,24 +140,24 @@ void StackCheck_Cleanup(StackEntry* entry);
StackStatus StackCheck_GetState(StackEntry* entry);
u32 StackCheck_CheckAll(void);
u32 StackCheck_Check(StackEntry* entry);
-void GfxPrint_InitDlist(GfxPrint*);
-void GfxPrint_SetColor(GfxPrint*, u32, u32, u32, u32);
-void GfxPrint_SetPosPx(GfxPrint*, s32, s32);
-void GfxPrint_SetPos(GfxPrint*, s32, s32);
-void GfxPrint_SetBasePosPx(GfxPrint* this, s32 param_2, s32 param_3);
-void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c);
-void GfxPrint_PrintChar(GfxPrint* this, u8 c);
-void GfxPrint_PrintStringWithSize(GfxPrint*, const void*, size_t, size_t);
-void GfxPrint_PrintString(GfxPrint*, const char*);
-GfxPrint* GfxPrint_Callback(GfxPrint*, const char*, size_t);
-void GfxPrint_Init(GfxPrint*);
-void GfxPrint_Destroy(GfxPrint*);
-void GfxPrint_Open(GfxPrint*, Gfx*);
-Gfx* GfxPrint_Close(GfxPrint*);
-void GfxPrint_VPrintf(GfxPrint*, const char*, va_list);
-void GfxPrint_Printf(GfxPrint*, const char*, ...);
-// void MtxConv_F2L(void);
-// void MtxConv_L2F(void);
+void GfxPrint_InitDlist(GfxPrint* printer);
+void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a);
+void GfxPrint_SetPosPx(GfxPrint* printer, s32 x, s32 y);
+void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
+void GfxPrint_SetBasePosPx(GfxPrint* printer, s32 x, s32 y);
+void GfxPrint_PrintCharImpl(GfxPrint* printer, u8 c);
+void GfxPrint_PrintChar(GfxPrint* printer, u8 c);
+void GfxPrint_PrintStringWithSize(GfxPrint* printer, const void* buffer, size_t charSize, size_t charCount);
+void GfxPrint_PrintString(GfxPrint* printer, const char* str);
+GfxPrint* GfxPrint_Callback(GfxPrint* printer, const char* str, size_t size);
+void GfxPrint_Init(GfxPrint* printer);
+void GfxPrint_Destroy(GfxPrint* printer);
+void GfxPrint_Open(GfxPrint* printer, Gfx* dList);
+Gfx* GfxPrint_Close(GfxPrint* printer);
+s32 GfxPrint_VPrintf(GfxPrint* printer, const char* fmt, va_list args);
+s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...);
+void MtxConv_F2L(MatrixInternal* m1, MtxF* m2);
+void MtxConv_L2F(MtxF* m1, MatrixInternal* m2);
void __assert(const char* file, u32 lineNum);
// void func_800862B4(void);
void* SystemArena_MallocMin1(u32 size);
@@ -201,14 +202,14 @@ s32 func_80086D40(f64 param_1);
f64 func_80086D6C(f64 param_1);
s32 func_80086D8C(f32 param_1);
s32 func_80086DAC(f64 param_1);
-void* SystemArena_Malloc(u32 size);
-void* SystemArena_MallocR(u32 size);
-void* SystemArena_Realloc(void* oldPtr, u32 newSize);
+void* SystemArena_Malloc(size_t size);
+void* SystemArena_MallocR(size_t size);
+void* SystemArena_Realloc(void* oldPtr, size_t newSize);
void SystemArena_Free(void* ptr);
-void* SystemArena_Calloc(u32 elements, u32 size);
-void SystemArena_AnalyzeArena(u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocated);
+void* SystemArena_Calloc(u32 elements, size_t size);
+void SystemArena_AnalyzeArena(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
u32 SystemArena_CheckArena(void);
-void SystemArena_InitArena(void* start, u32 size);
+void SystemArena_InitArena(void* start, size_t size);
void SystemArena_Cleanup(void);
u8 SystemArena_IsInitialized(void);
s32 Rand_Next(void);
@@ -223,26 +224,26 @@ void ArenaImpl_LockInit(Arena* heap);
void ArenaImpl_Lock(Arena* heap);
void ArenaImpl_Unlock(Arena* heap);
ArenaNode* ArenaImpl_GetLastBlock(Arena* param_1);
-void __osMallocInit(Arena* heap, void* heapBase, u32 heapSize);
+void __osMallocInit(Arena* heap, void* heapBase, size_t heapSize);
void __osMallocAddBlock(Arena* heap, void* start, s32 size);
void __osMallocCleanup(Arena* heap);
u8 __osMallocIsInitalized(Arena* heap);
-void* __osMalloc(Arena* heap, u32 size);
-void* __osMallocR(Arena* heap, u32 size);
+void* __osMalloc(Arena* heap, size_t size);
+void* __osMallocR(Arena* heap, size_t size);
void __osFree(Arena* heap, void* ptr);
-void* __osRealloc(Arena* heap, void* oldPtr, u32 newSize);
-void __osAnalyzeArena(Arena* heap, u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocated);
+void* __osRealloc(Arena* heap, void* oldPtr, size_t newSize);
+void __osAnalyzeArena(Arena* heap, size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
u32 __osCheckArena(Arena* heap);
void* proutSprintf(void* s, const char* buf, size_t n);
s32 vsprintf(char* dst, char* fmt, va_list args);
s32 sprintf(char* s, char* fmt, ...);
-void PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
-void PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
+s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
+s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
void Sleep_Cycles(OSTime time);
-// void Sleep_Nsec(void);
-void Sleep_Usec(s32);
-void Sleep_Msec(u32 param_1);
-// void Sleep_Sec(void);
+void Sleep_Nsec(u32 nsec);
+void Sleep_Usec(u32 usec);
+void Sleep_Msec(u32 ms);
+void Sleep_Sec(u32 sec);
// void __osSetCause(void);
s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags);
// void osPfsFreeBlocks(void);
@@ -282,7 +283,7 @@ void __osDequeueThread(OSThread** param_1, OSThread* param_2);
void osDestroyThread(OSThread* puParm1);
// void __osVoiceCheckResult(void);
void bzero(void* begin, s32 length);
-// void osSetRumble(void);
+s32 osSetRumble(OSPfs* pfs, u32 vibrate);
// void osSetUpMempakWrite(void);
// void osProbeRumblePak(void);
void __osSiCreateAccessQueue(void);
@@ -306,9 +307,9 @@ void __osInitialize_autodetect(void);
void* osViGetNextFramebuffer(void);
void guPerspectiveF(float mf[4][4], u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale);
void guPerspective(Mtx* m, u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale);
-s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, u32 size);
+s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size);
s32 __osSiRawStartDma(s32 direction, void* dramAddr);
-// void osEPiLinkHandle(void);
+s32 osEPiLinkHandle(OSPiHandle* handle);
void osViBlack(u8 active);
s32 __osSiRawReadIo(u32 devAddr, u32* data);
OSId osGetThreadId(OSThread* t);
@@ -334,14 +335,14 @@ void __osPiGetAccess(void);
void __osPiRelAccess(void);
void __osDevMgrMain(void* arg);
// void func_8008C640(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7, UNK_TYPE1 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE4 param_13, UNK_TYPE4 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16, UNK_TYPE4 param_17, UNK_TYPE4 param_18);
-s32 osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, u32 size);
-// void __osSumcalc(void);
-// void __osIdCheckSum(void);
-// void __osRepairPackId(void);
+s32 __osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size);
+u16 __osSumcalc(u8* ptr, s32 length);
+s32 __osIdCheckSum(u16* ptr, u16* checkSum, u16* idSum);
+s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid);
// void __osCheckPackId(void);
// void __osGetId(void);
-// void __osCheckId(void);
-// void __osPfsRWInode(void);
+s32 __osCheckId(OSPfs* pfs);
+s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank);
u32 osGetCount(void);
void guMtxL2F(MtxF* m1, Mtx* m2);
u32 osGetMemSize(void);
@@ -377,11 +378,11 @@ s32 __osSiDeviceBusy(void);
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag);
void osSetThreadPri(OSThread* t, OSPri pri);
OSPri osGetThreadPri(OSThread* t);
-s32 osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data);
+s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data);
void osViSwapBuffer(void* frameBufPtr);
void guPositionF(float mf[4][4], f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z);
void guPosition(Mtx* m, f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z);
-s32 osEPiRawStartDma(OSPiHandle*, s32, u32, void*, u32);
+s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size);
OSYieldResult osSpTaskYielded(OSTask* task);
s32 bcmp(void* __s1, void* __s2, size_t __n);
OSTime osGetTime(void);
@@ -426,7 +427,7 @@ s32 osPfsIsPlug(OSMesgQueue* queue, u8* pattern);
s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status);
OSPiHandle* osCartRomInit(void);
// void guS2DInitBg(void);
-// s32 __osPfsSelectBank(OSPfs* pfs, UNK_TYPE4 param_2);
+s32 __osPfsSelectBank(OSPfs* pfs, u8 bank);
s32 osContSetCh(u8 ch);
u32 __osSetFpcCsr(u32 value);
u32 __osGetFpcCsr(void);
@@ -479,20 +480,15 @@ void* osViGetCurrentFramebuffer(void);
s32 __osSpSetPc(void* data);
// void __osVoiceContWrite4(void);
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg);
-// void __osSetHWIntrRoutine(void);
+void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg);
u32 __osGetWatchLo(void);
void __osSetWatchLo(u32 value);
f32 fmodf(f32 dividend, f32 divisor);
-void* __osMemset(void* ptr, s32 val, u32 size);
+void* __osMemset(void* ptr, s32 val, size_t size);
s32 __osStrcmp(const char* str1, const char* str2);
char* __osStrcpy(char* dst, const char* src);
void* __osMemcpy(void* dst, void* src, size_t size);
-void EnAObj_Init(ActorEnAObj* this, GlobalContext* globalCtx);
-void EnAObj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx);
-void EnAObj_Update1(ActorEnAObj* this, GlobalContext* globalCtx);
-void EnAObj_Update2(ActorEnAObj* this, GlobalContext* globalCtx);
-void EnAObj_Update(ActorEnAObj* this, GlobalContext* globalCtx);
-void EnAObj_Draw(ActorEnAObj* this, GlobalContext* globalCtx);
+
// void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale);
// void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
// void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
@@ -681,10 +677,10 @@ void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f*
// void func_800B31BC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6);
void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale);
// void EffectSsIceBlock_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5);
-void func_800B32D0(GameState* gamestate);
-// void func_800B3644(void);
-void DLF_LoadGameState(GameStateOverlay* gameState);
-void DLF_FreeGameState(GameStateOverlay* gameState);
+void FlagSet_Update(GameState* gameState);
+void FlagSet_Draw(GameState* gameState);
+void Overlay_LoadGameState(GameStateOverlay* gameState);
+void Overlay_FreeGameState(GameStateOverlay* gameState);
void Actor_PrintLists(ActorContext* actorCtx);
void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc func, f32 scale);
void ActorShadow_Draw(Actor* actor, Lights* mapper, GlobalContext* globalCtx, Gfx* displayList, Color_RGBA8* color);
@@ -1547,7 +1543,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4);
s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5);
s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5);
u8 func_800E9360(void);
-// void static_context_init(void);
+void GameInfo_Init(void);
// void func_800E9470(void);
void DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx);
void DebugDisplay_DrawObjects(GlobalContext* globalCtx);
@@ -1690,14 +1686,16 @@ s16 ActorCutscene_GetCurrentCamera(s16 index);
s32 func_800F22C4(s16 param_1, Actor* actor);
void ActorCutscene_SetReturnCamera(s16 index);
// void func_800F23E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
-// void func_800F2478(void);
-// void func_800F2620(void);
-// void func_800F2650(void);
-// void func_800F26C0(void);
-// void func_800F26F0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
-// void func_800F2728(void);
-// void func_800F29A0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
-// void func_800F2CD8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
+f32 func_800F2478(f32 target, TransformData* transData, s32 refIdx);
+void SkelCurve_Clear(SkelAnimeCurve* skelCurve);
+s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg,
+ TransformUpdateIndex* transUpdIdx);
+void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve);
+void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame,
+ f32 animCurFrame, f32 animSpeed);
+s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve);
+void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve,
+ OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx);
void FireObj_InitWithParams(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init);
void FireObj_SetState(FireObj* fire, f32 dynamicSizeStep, u8 newState);
void FireObj_SetPosition(FireObj* fire, Vec3f* pos);
@@ -1738,7 +1736,7 @@ void Font_LoadOrderedFont(Font* font);
// void func_800F50D4(void);
void Kankyo_Init(GlobalContext* globalCtx, EnvironmentContext* envCtx);
u32 func_800F5954(u8* param_1, u32 param_2, u32 param_3, u8 param_4, u8 param_5);
-// void func_800F5A8C(void);
+f32 func_800F5A8C(u16 arg0, u16 arg1, u16 arg2, GlobalContext* globalContext);
// void func_800F5B10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
// void func_800F5CD0(void);
// void func_800F6834(void);
@@ -1771,9 +1769,9 @@ void func_800FB320(GlobalContext* globalCtx, u8 param_2);
void func_800FB758(GlobalContext* globalCtx);
// void func_800FB9B4(void);
// void func_800FBCBC(void);
-// void func_800FBDEC(void);
-void func_800FBF3C(GlobalContext* globalCtx);
-// void func_800FC158(void);
+void Kankyo_InitGameOverLights(GlobalContext* globalCtx);
+void Kankyo_FadeInGameOverLights(GlobalContext* globalCtx);
+void Kankyo_FadeOutGameOverLights(GlobalContext* globalCtx);
// void func_800FC3DC(void);
void func_800FC444(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4, UNK_TYPE arg5);
// void func_800FC64C(void);
@@ -1919,16 +1917,16 @@ Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8
Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB);
void Lights_GlowCheck(GlobalContext* globalCtx);
void Lights_DrawGlow(GlobalContext* globalCtx);
-void* zelda_malloc(u32 size);
-void* zelda_mallocR(u32 size);
-void* zelda_realloc(void* oldPtr, u32 newSize);
-void zelda_free(void* param_1);
-void* zelda_calloc(u32 num, u32 size);
-void MainHeap_AnalyzeArena(u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocated);
-// s32 MainHeap_Check(void);
-void MainHeap_Init(u32 base, u32 size);
-// void MainHeap_Cleanup(void);
-// u32 MainHeap_IsInitialized(void);
+void* ZeldaArena_Malloc(size_t size);
+void* ZeldaArena_MallocR(size_t size);
+void* ZeldaArena_Realloc(void* oldPtr, size_t newSize);
+void ZeldaArena_Free(void* param_1);
+void* ZeldaArena_Calloc(u32 num, size_t size);
+void ZeldaArena_GetSizes(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
+void ZeldaArena_Check();
+void ZeldaArena_Init(void* start, size_t size);
+void ZeldaArena_Cleanup();
+u8 ZeldaArena_IsInitialized();
// void func_80102E40(void);
// void func_80102E90(void);
// void func_80102EA4(void);
@@ -2089,8 +2087,8 @@ void func_8010A33C(GlobalContext* globalCtx, s16 param_2);
// void func_8010BEF0(void);
// void func_8010BF24(void);
s32 func_8010BF58(Actor* actor, GlobalContext* globalCtx, s32* param_3, UNK_PTR param_4, s32* param_5);
-// void Nmi_Init(void);
-// void Nmi_SetPrenmiStart(void);
+void Nmi_Init(void);
+void Nmi_SetPrenmiStart(void);
// s32 Nmi_GetPrenmiHasStarted(void);
// void func_8010C1B0(void);
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
@@ -2161,8 +2159,8 @@ void func_80115908(GlobalContext* globalCtx, u8 param_2);
void func_801159c0(s16 param_1);
void func_801159EC(s16 arg0);
void func_80115A14(s32 arg0, s16 arg1);
-// void Parameter_AddMagic(void);
-// void func_80115D5C(void);
+void Parameter_AddMagic(GlobalContext* globalCtx, s16 arg1);
+void func_80115D5C(GameState* gamestate);
// void func_80115DB4(void);
// void func_80116088(void);
// void func_80116114(void);
@@ -2196,7 +2194,7 @@ void func_8011C808(GlobalContext* globalCtx);
// void func_80121F94(void);
void func_80121FC4(GlobalContext* globalCtx);
s32 func_801224E0(s32 param_1, s16 param_2, s16 param_3);
-// void func_80122524(void);
+f32 func_80122524(Actor* actor, Path* path, s16 arg2, s16* arg3);
// void func_801225CC(void);
// void func_80122660(void);
// UNK_TYPE4 func_80122670(s32* param_1, Input* input);
@@ -2442,7 +2440,7 @@ void func_8012F1BC(s16 sceneIndex);
s16 func_8012F22C(s16 sceneIndex);
void func_8012F278(GlobalContext* globalCtx);
s32 Object_Spawn(ObjectContext* objectCtx, s16 id);
-void Object_InitBank(GameState* gamestate, ObjectContext* objectCtx);
+void Object_InitBank(GameState* gameState, ObjectContext* objectCtx);
void Object_UpdateBank(ObjectContext* objectCtx);
s32 Object_GetIndex(ObjectContext* objectCtx, s16 id);
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index);
@@ -2461,7 +2459,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd);
void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd);
void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd);
void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd);
-void Door_InitContext(GameState* gamestate, DoorContext* doorCtx);
+void Door_InitContext(GameState* gameState, DoorContext* doorCtx);
void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd);
s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex);
void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd);
@@ -2544,96 +2542,115 @@ s32 Entrance_GetTransitionFlags(u16 entranceIndex);
// void func_80132E9C(void);
// void func_80132FDC(void);
// void func_80133000(void);
-s32 func_80133038(GlobalContext* globalCtx, UNK_PTR arg1, struct_80133038_arg2* arg2);
-void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex);
-void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex);
-void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex, RSPMatrix** mtx);
-void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex);
-void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
-void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
-void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, RSPMatrix** limbMatricies);
-void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor);
-void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor, RSPMatrix** mtx);
-void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor);
-void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst);
-s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg);
-Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
-Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
-Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, RSPMatrix** mtx, Gfx* gfx);
-Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx);
-s32 func_80134FFC(s32 arg0, s32 arg1, Vec3s* dst);
-s16 func_801353D4(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg);
-s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg);
-void SkelAnime_InterpolateVec3s(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf);
-void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx);
-void func_801358D4(GlobalContext* globalCtx);
-void func_801358F4(GlobalContext* globalCtx);
-AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type);
-void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimationHeader* linkAnimetionSeg, s32 frame, s32 limbCount, void* ram);
-void SkelAnime_LoadAnimationType1(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src);
-void SkelAnime_LoadAnimationType2(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4);
-void SkelAnime_LoadAnimationType3(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index);
-void SkelAnime_LoadAnimationType4(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index);
-void SkelAnime_LoadAnimationType5(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3);
-void SkelAnime_LinkAnimetionLoaded(GlobalContext* globalCtx, AnimationEntryType0* entry);
-void SkelAnime_AnimationType1Loaded(GlobalContext* globalCtx, AnimationEntryType1* entry);
-void SkelAnime_AnimationType2Loaded(GlobalContext* globalCtx, AnimationEntryType2* entry);
-void SkelAnime_AnimationType3Loaded(GlobalContext* globalCtx, AnimationEntryType3* entry);
-void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry);
-void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry);
-void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx);
-void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* linkAnimationHeaderSeg, s32 flags, Vec3s* limbDrawTbl, Vec3s* transitionDrawTbl, s32 limbBufCount);
-void func_801360A8(SkelAnime* skelAnime);
-s32 func_801360E0(GlobalContext* globalCtx, SkelAnime* skelAnime);
-s32 func_80136104(GlobalContext* globalCtx, SkelAnime* skelAnime);
-void func_801361BC(GlobalContext* globalCtx, SkelAnime* skelAnime);
-s32 func_80136288(GlobalContext* globalCtx, SkelAnime* skelAnime);
-s32 func_8013631C(GlobalContext* globalCtx, SkelAnime* skelAnime);
-void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate);
-void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate);
-void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg);
-void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed);
-void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg);
-void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed);
-void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime);
-void func_8013673C(GlobalContext* globalCtx, SkelAnime* skelAnime);
-void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 frame);
-void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 frame);
-void func_801367F4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame);
-void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl);
-void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg, f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate, Vec3s* limbDrawTbl);
-void SkelAnime_SetModeStop(SkelAnime* skelAnime);
-s32 func_80136990(SkelAnime* skelAnime, f32 arg1, f32 updateRate);
-s32 func_80136A48(SkelAnime* skelAnime, f32 arg1);
-void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount);
-void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount);
+UNK_TYPE func_80133038(GlobalContext* globalCtx, UNK_TYPE* arg1, struct_80133038_arg2* arg2);
+void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod);
+void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod);
+void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx);
+void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor,
+ s32 lod);
+void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor);
+void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor);
+void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor,
+ Mtx** limbMatricies);
+void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor);
+void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, UnkActorDraw unkDraw, Actor* actor,
+ Mtx** mtx);
+void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, UnkActorDraw unkDraw, Actor* actor);
+void SkelAnime_GetFrameData(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst);
+s16 Animation_GetLength(void* animation);
+s16 Animation_GetLastFrame(void* animation);
+Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx);
+Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx);
+Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor,
+ Mtx** mtx, Gfx* gfx);
+Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx);
+s16 SkelAnime_GetFrameData2(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable);
+s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation);
+s16 Animation_GetLength2(LegacyAnimationHeader* animation);
+s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation);
+void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf);
+void AnimationContext_Reset(AnimationContext* animationCtx);
+void AnimationContext_SetNextQueue(GlobalContext* globalCtx);
+void AnimationContext_DisableQueue(GlobalContext* globalCtx);
+AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, AnimationType type);
+void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame,
+ s32 limbCount, Vec3s* frameTable);
+void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src);
+void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4);
+void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index);
+void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index);
+void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3);
+void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data);
+void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx);
+void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
+ LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable,
+ Vec3s* morphTable, s32 limbBufCount);
+void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime);
+s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime);
+s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime);
+void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime);
+s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime);
+s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime);
+void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate);
+void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate);
+void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg);
+void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 playbackSpeed);
+void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg);
+void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 playbackSpeed);
+void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime);
+void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime);
+void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 frame);
+void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 frame);
+void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame);
+void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 transitionFrame, LinkAnimationHeader* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, Vec3s* jointTable);
+void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg, f32 transitionFrame, LinkAnimationHeader* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, Vec3s* jointTable);
+void LinkAnimation_EndLoop(SkelAnime* skelAnime);
+s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 arg1, f32 updateRate);
+s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 arg1);
+void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount);
+void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
+ AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount);
void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg);
-void func_80136C84(SkelAnime* skelAnime);
-s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime);
-s32 func_80136CF4(SkelAnime* skelAnime);
-s32 func_80136D98(SkelAnime* skelAnime);
-void func_80136F04(SkelAnime* skelAnime);
-s32 func_8013702C(SkelAnime* skelAnime);
-s32 func_801370B0(SkelAnime* skelAnime);
-s32 func_8013713C(SkelAnime* skelAnime);
-void SkelAnime_ChangeAnimImpl(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationType, f32 transitionRate, s8 unk2);
-void SkelAnime_ChangeAnim(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 mode, f32 transitionRate);
-void SkelAnime_ChangeAnimDefaultStop(SkelAnime* skelAnime, AnimationHeader* animationSeg);
-void SkelAnime_ChangeAnimTransitionStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate);
-void SkelAnime_ChangeAnimPlaybackStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed);
-void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg);
-void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate);
-void SkelAnime_ChangeAnimPlaybackRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed);
-void SkelAnime_AnimSetStop(SkelAnime* skelAnime);
-void SkelAnime_AnimReverse(SkelAnime* skelAnime);
-void func_80137674(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index);
-void func_801376DC(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3);
-void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
-s32 func_801378B8(SkelAnime* skelAnime, f32 arg1);
+void SkelAnime_SetUpdate(SkelAnime* skelAnime);
+s32 SkelAnime_Update(SkelAnime* skelAnime);
+s32 SkelAnime_Morph(SkelAnime* skelAnime);
+s32 SkelAnime_MorphTaper(SkelAnime* skelAnime);
+void SkelAnime_AnimateFrame(SkelAnime* skelAnime);
+s32 SkelAnime_LoopFull(SkelAnime* skelAnime);
+s32 SkelAnime_LoopPartial(SkelAnime* skelAnime);
+s32 SkelAnime_Once(SkelAnime* skelAnime);
+void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationType, f32 transitionRate, s8 unk2);
+void Animation_Change(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame, f32 frameCount, u8 mode, f32 transitionRate);
+void Animation_PlayOnce(SkelAnime* skelAnime, AnimationHeader* animationSeg);
+void Animation_MorphToPlayOnce(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate);
+void Animation_PlayOnceSetSpeed(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed);
+void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animationSeg);
+void Animation_MorphToLoop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate);
+void Animation_PlayLoopSetSpeed(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed);
+void Animation_EndLoop(SkelAnime* skelAnime);
+void Animation_Reverse(SkelAnime* skelAnime);
+void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index);
+void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3);
+void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
+s32 Animation_OnFrame(SkelAnime* skelAnime, f32 arg1);
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx);
-void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
+void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
// void func_80137970(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
// void func_80137B34(void);
// void func_80137EBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
@@ -2683,7 +2700,7 @@ s16 func_8013A504(s16 val);
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError);
// void func_8013A7C0(void);
// void func_8013A860(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10);
-Gfx* func_8013AB00(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount, void* func1, void* func2, void* func3, Actor* actor, Gfx* gfx);
+Gfx* func_8013AB00(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, void* func1, void* func2, void* func3, Actor* actor, Gfx* gfx);
s32 func_8013AD6C(GlobalContext* globalCtx);
// void func_8013AD9C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
void func_8013AED4(u16* param_1, u16 param_2, u16 param_3);
@@ -2697,7 +2714,7 @@ Path* func_8013BB34(GlobalContext* globalCtx, u8 arg1, s32 arg2);
Actor* func_8013BB7C(Actor* actor, GlobalContext* globalCtx, s32 actorCategory, s32 actorId);
s32 func_8013BC6C(SkelAnime* skelAnime, ActorAnimationEntryS* arg1, s32 arg2);
// void func_8013BD40(void);
-// void func_8013BEDC(void);
+s32 func_8013BEDC(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32* arg3);
// void func_8013C068(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
// void func_8013C624(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_8013C8B8(void);
@@ -2741,7 +2758,7 @@ void func_8013ECE0(f32 xyzDistToPlayerSq, u8 arg1, u8 arg2, u8 arg3);
void func_8013ED9C(void);
void func_8013EDD0(void);
// void func_8013EE04(void);
-// void func_8013EE24(void);
+void func_8013EE24(void);
// void func_8013EE38(void);
// void func_8013EE48(void);
void View_ViewportToVp(Vp* dest, Viewport* src);
@@ -2765,7 +2782,7 @@ s32 View_SetQuakeSpeed(View* view, f32 speed);
s32 View_InitCameraQuake(View* view);
s32 View_ClearQuake(View* view);
s32 View_SetQuake(View* view, Vec3f rot, Vec3f scale, f32 speed);
-s32 View_StepQuake(View* view, RSPMatrix* matrix);
+s32 View_StepQuake(View* view, Mtx* matrix);
void View_RenderView(View* view, s32 uParm2);
s32 View_RenderToPerspectiveMatrix(View* view);
s32 View_RenderToOrthographicMatrix(View* view);
@@ -2803,11 +2820,12 @@ void VisMono_Draw(void* arg0, Gfx** gfx, u32 arg2);
void func_801420C0(void* arg0);
void func_801420F4(void* arg0);
void func_80142100(void* arg0, Gfx** gfx, u32 arg2);
-s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* vtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8);
-void func_80143148(SkyboxContext* skyboxCtx, s32 arg1);
-void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType);
+s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* vtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7,
+ s32 arg8);
+void func_80143148(SkyboxContext* skyboxCtx, s32 arg1);
+void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType);
void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType);
-void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType);
+void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType);
// void func_801435A0(void);
// void func_80143624(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7);
// void func_80143668(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
@@ -2826,13 +2844,13 @@ void Sram_InitDebugSave(void);
// void func_80144E78(void);
// void func_8014546C(void);
// void func_80145698(void);
-void func_801457CC(GameState* gamestate, SramContext* param_2);
+void func_801457CC(GameState* gameState, SramContext* param_2);
void func_80146580(s32 param_1, SramContext* param_2, s32 param_3);
// void func_80146628(void);
// void func_80146AA0(void);
// void func_80146DF8(void);
void func_80146E40(GameState* gameState, SramContext* sramCtx);
-void Sram_Alloc(GameState* gamestate, SramContext* sramCtx);
+void Sram_Alloc(GameState* gameState, SramContext* sramCtx);
// void func_80146EBC(SramContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3);
// void func_80146EE8(void);
// void func_80146F5C(void);
@@ -2927,8 +2945,8 @@ s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetPillarboxMagnitude(void);
void ShrinkWindow_Init(void);
-void ShrinkWindow_Fini(void);
-void ShrinkWindow_Step(s32 framerateDivisor);
+void ShrinkWindow_Destroy(void);
+void ShrinkWindow_Update(s32 framerateDivisor);
void ShrinkWindow_Draw(GraphicsContext* gfxCtx);
// void func_80161180(void);
// void func_8016119C(void);
@@ -3010,7 +3028,7 @@ void func_80165690(void);
// void func_80165EC0(void);
// void func_80166060(void);
Gfx* func_801660B8(GlobalContext* globalCtx, Gfx* gfx);
-void Play_Fini(GlobalContext* globalCtx);
+void Play_Fini(GameState* gameState);
// void func_801663C4(void);
// void func_80166644(void);
// void func_801668B4(void);
@@ -3052,7 +3070,7 @@ void func_80169DCC(GlobalContext* globalCtx, s32 arg1, u16 arg2, s32 arg3, s32 a
void func_80169E6C(GlobalContext* globalCtx, s32 param_1, s32 param_2);
// void func_80169ECC(void);
void func_80169EFC(GlobalContext* globalCtx);
-// void func_80169F78(void);
+void func_80169F78(GlobalContext* globalCtx);
// void func_80169FDC(void);
// void func_80169FFC(void);
s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx);
@@ -3101,8 +3119,9 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this);
void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this);
void func_801720C4(PreRender* this);
void func_801720FC(PreRenderParams* params, Gfx** gfxp);
-void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags);
-void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size);
+void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x,
+ f32 y, f32 xScale, f32 yScale, u32 flags);
+void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size);
void THGA_Dt(TwoHeadGfxArena* thga);
u32 THGA_IsCrash(TwoHeadGfxArena* thga);
void THGA_Init(TwoHeadGfxArena* thga);
@@ -3113,7 +3132,7 @@ Gfx* THGA_GetTail(TwoHeadGfxArena* thga);
Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count);
Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga);
Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga);
-Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size);
+Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size);
Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count);
Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga);
Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count);
@@ -3121,15 +3140,15 @@ Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga);
void* THA_GetHead(TwoHeadArena* tha);
void THA_SetHead(TwoHeadArena* tha, void* start);
void* THA_GetTail(TwoHeadArena* tha);
-void* THA_AllocStart(TwoHeadArena* tha, u32 size);
+void* THA_AllocStart(TwoHeadArena* tha, size_t size);
void* THA_AllocStart1(TwoHeadArena* tha);
-void* THA_AllocEnd(TwoHeadArena* tha, u32 size);
-void* THA_AllocEndAlign16(TwoHeadArena* tha, u32 size);
-void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask);
+void* THA_AllocEnd(TwoHeadArena* tha, size_t size);
+void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size);
+void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask);
s32 THA_GetSize(TwoHeadArena* tha);
u32 THA_IsCrash(TwoHeadArena* tha);
void THA_Init(TwoHeadArena* tha);
-void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size);
+void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size);
void THA_Dt(TwoHeadArena* tha);
void func_80172BC0(void);
void func_80172C30(AudioMgr* audioMgr);
@@ -3145,46 +3164,46 @@ void TitleSetup_Init(GameState* gameState);
void Game_UpdateFramerateVariables(s32 divisor);
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor);
void GameState_SetFBFilter(Gfx** gfx, u32 arg1);
-void Game_Nop80173534(GameState* gamestate);
-void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx);
-void Game_ResetSegments(GraphicsContext* gfxCtx);
-void func_801736DC(GraphicsContext* gfxCtx);
-void Game_UpdateInput(GameState* gamestate);
-void Game_Update(GameState* gamestate);
-void Game_IncrementFrameCount(GameState* gamestate);
-void Game_InitHeap(GameState* gamestate, u32 size);
-void Game_ResizeHeap(GameState* gamestate, u32 size);
-void Game_StateInit(GameState* gamestate, GameStateFunc gameStateInit, GraphicsContext* gfxCtx);
-void Game_StateFini(GameState* gamestate);
-GameStateFunc Game_GetNextStateInit(GameState* gamestate);
-u32 Game_GetNextStateSize(GameState* gamestate);
-u32 Game_GetShouldContinue(GameState* gamestate);
-s32 Game_GetHeapFreeSize(GameState* gamestate);
-s32 func_80173B48(GameState* gamestate);
-GameAlloc* func_80173BF0(GameAlloc* heap);
-void* Gamealloc_Alloc(GameAlloc* heap, u32 size);
-void Gamealloc_Free(GameAlloc* heap, void* ptr);
-void Gamealloc_FreeAll(GameAlloc* heap);
-void Gamealloc_Init(GameAlloc* iParm1);
+void Game_Nop80173534(GameState* gameState);
+void GameState_Draw(GameState* gameState, GraphicsContext* gCtxt);
+void GameState_SetFrameBuffer(GraphicsContext* gCtxt);
+void func_801736DC(GraphicsContext* gCtxt);
+void Game_UpdateInput(GameState* gameState);
+void Game_Update(GameState* gameState);
+void Game_IncrementFrameCount(GameState* gameState);
+void GameState_InitArena(GameState* gameState, size_t size);
+void GameState_Realloc(GameState* gameState, size_t size);
+void GameState_Init(GameState* gameState, GameStateFunc gameStateInit, GraphicsContext* gfxCtx);
+void GameState_Destroy(GameState* gameState);
+GameStateFunc GameState_GetNextStateInit(GameState* gameState);
+size_t Game_GetNextStateSize(GameState* gameState);
+u32 GameState_IsRunning(GameState* gameState);
+s32 GameState_GetArenaSize(GameState* gameState);
+s32 func_80173B48(GameState* gameState);
+void GameAlloc_Log(GameAlloc* heap);
+void* GameAlloc_Malloc(GameAlloc* heap, size_t size);
+void GameAlloc_Free(GameAlloc* heap, void* ptr);
+void GameAlloc_Cleanup(GameAlloc* heap);
+void GameAlloc_Init(GameAlloc* iParm1);
// void Graph_FaultClient(void);
-void Graph_DlAlloc(TwoHeadGfxArena* dl, void* memoryBlock, u32 size);
+void Graph_DlAlloc(TwoHeadGfxArena* dl, void* memoryBlock, size_t size);
void Graph_InitTHGA(GraphicsContext* gfxCtx);
-GameStateOverlay* Graph_GetNextGameState(GameState* gamestate);
+GameStateOverlay* Graph_GetNextGameState(GameState* gameState);
void* Graph_FaultAddrConvFunc(void* addr);
void Graph_Init(GraphicsContext* gfxCtx);
// void Graph_Destroy(void);
-void Graph_Render(GraphicsContext* gfxCtx, GameState* gamestate);
-void Graph_FrameSetup(GameState* gamestate);
-void Graph_RenderFrame(GraphicsContext* gfxCtx, GameState* gamestate);
-void Graph_DoFrame(GraphicsContext* gfxCtx, GameState* gamestate);
+void Graph_Render(GraphicsContext* gfxCtx, GameState* gameState);
+void Graph_FrameSetup(GameState* gameState);
+void Graph_RenderFrame(GraphicsContext* gfxCtx, GameState* gameState);
+void Graph_DoFrame(GraphicsContext* gfxCtx, GameState* gameState);
void Graph_ThreadEntry(void* arg);
Gfx* Graph_GfxPlusOne(Gfx* gfx);
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst);
-void* Graph_DlistAlloc(Gfx** gfx, u32 size);
-void func_80174AA0(ListAlloc* alloc);
-// void func_80174AB4(void);
-// void func_80174B20(void);
-void func_80174BA0(ListAlloc* alloc);
+void* Graph_DlistAlloc(Gfx** gfx, size_t size);
+ListAlloc* ListAlloc_Init(ListAlloc* this);
+// void ListAlloc_Alloc(void);
+// void ListAlloc_Free(void);
+void ListAlloc_FreeAll(ListAlloc* this);
void Main(void* arg);
u32 Padmgr_GetControllerBitmask(void);
// void func_80174F24(void);
@@ -3213,7 +3232,7 @@ void func_80175E68(Input* input, s32 param_2);
void Padmgr_GetInput(Input* input, s32 param_2);
void Padmgr_GetInput2(Input* input, s32 param_2);
void Padmgr_ThreadEntry(PadMgr* padmgr);
-void Padmgr_Start(OSMesgQueue* siEventCallbackQueue, IrqMgr* irqmgr, OSId threadId, OSPri threadPri, void* stack);
+void PadMgr_Init(OSMesgQueue* siEventCallbackQueue, IrqMgr* irqmgr, OSId threadId, OSPri threadPri, void* stack);
void Sched_SwapFramebuffer(CfbInfo* cfbInfo);
void Sched_RetraceUpdateFramebuffer(SchedContext* sched, CfbInfo* cfbInfo);
void Sched_HandleReset(SchedContext* sched);
@@ -3239,9 +3258,9 @@ void Sched_Init(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE arg3, UNK_
// void func_80177390(void);
void func_801773A0(void* arg0);
void func_801773C4(void* arg0);
-void SpeedMeter_DrawTimeEntries(void* displayList, GraphicsContext* gCtx);
-// void func_80177A84(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9);
-// void func_80177AC8(void);
+void SpeedMeter_DrawTimeEntries(void* displayList, GraphicsContext* gfxCtx);
+// void func_80177A84(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9);
+//void func_80177AC8(void);
void SpeedMeter_DrawAllocEntries(void* displayList, GraphicsContext* gfxCtx, GameState* gameState);
void func_801780F0(Mtx* param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5, f32 param_6, f32 param_7);
// void func_801781EC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
@@ -3267,8 +3286,8 @@ void Check_DrawI4Texture(u16* buffer, u32 x, u32 y, u32 width, u32 height, u8* t
void Check_ClearRGBA16(s16* buffer);
// void Check_DrawExpansionPakErrorMessage(void);
// void Check_DrawRegionLockErrorMessage(void);
-// void Check_ExpansionPak(void);
-// void Check_RegionIsSupported(void);
+void Check_ExpansionPak(void);
+void Check_RegionIsSupported(void);
f32 func_80179300(f32 n);
f32 func_80179400(s32 n);
f32 pow_int(f32 base, s32 exp);
@@ -3375,46 +3394,48 @@ s16 Math_Atan2S(f32 opposite, f32 adjacent);
f32 Math_Atan2F(f32 opposite, f32 adjacent);
s16 Math_FAtan2F(f32 adjacent, f32 opposite);
f32 Math_Acot2F(f32 adjacent, f32 opposite);
-void SysMatrix_StateAlloc(GameState* gamestate);
-void SysMatrix_StatePush(void);
-void SysMatrix_StatePop(void);
-void SysMatrix_CopyCurrentState(MtxF* matrix);
-void SysMatrix_SetCurrentState(MtxF* matrix);
-MtxF* SysMatrix_GetCurrentState(void);
-void SysMatrix_InsertMatrix(MtxF* matrix, s32 appendToState);
-void SysMatrix_InsertTranslation(f32 x, f32 y, f32 z, s32 appendToState);
+void Matrix_StateAlloc(GameState* gameState);
+void Matrix_StatePush(void);
+void Matrix_StatePop(void);
+void Matrix_CopyCurrentState(MtxF* matrix);
+void Matrix_SetCurrentState(MtxF* matrix);
+MtxF* Matrix_GetCurrentState(void);
+void Matrix_InsertMatrix(MtxF* matrix, s32 appendToState);
+void Matrix_InsertTranslation(f32 x, f32 y, f32 z, s32 appendToState);
void Matrix_Scale(f32 xScale, f32 yScale, f32 zScale, s32 appendToState);
-void SysMatrix_InsertXRotation_s(s16 rotation, s32 appendToState);
-void SysMatrix_InsertXRotation_f(f32 rotation, s32 appendToState);
-void SysMatrix_RotateStateAroundXAxis(f32 rotation);
-void SysMatrix_SetStateXRotation(f32 rotation);
-void Matrix_RotateY(s16 rotation, u8 appendToState);
-void SysMatrix_InsertYRotation_f(f32 rotation, s32 appendToState);
-void SysMatrix_InsertZRotation_s(s16 rotation, s32 appendToState);
-void SysMatrix_InsertZRotation_f(f32 rotation, s32 appendToState);
-void SysMatrix_InsertRotation(s16 xRotation, s16 yRotation, s16 zRotation, s32 appendToState);
-void SysMatrix_RotateAndTranslateState(Vec3f* translation, Vec3s* rotation);
-void SysMatrix_SetStateRotationAndTranslation(f32 x, f32 y, f32 z, Vec3s* rotation);
-RSPMatrix* SysMatrix_ToRSPMatrix(MtxF* src, RSPMatrix* dst);
-RSPMatrix* SysMatrix_GetStateAsRSPMatrix(RSPMatrix* matrix);
+void Matrix_InsertXRotation_s(s16 rotation, s32 appendToState);
+void Matrix_InsertXRotation_f(f32 rotation, s32 appendToState);
+void Matrix_RotateStateAroundXAxis(f32 rotation);
+void Matrix_SetStateXRotation(f32 rotation);
+void Matrix_RotateY(s16 rotation, s32 appendToState);
+void Matrix_InsertYRotation_f(f32 rotation, s32 appendToState);
+void Matrix_InsertZRotation_s(s16 rotation, s32 appendToState);
+void Matrix_InsertZRotation_f(f32 rotation, s32 appendToState);
+void Matrix_InsertRotation(s16 xRotation, s16 yRotation, s16 zRotation, s32 appendToState);
+void Matrix_JointPosition(Vec3f* position, Vec3s* rotation);
+void Matrix_RotateAndTranslateState(Vec3f* translation, Vec3s* rotation);
+void Matrix_SetStateRotationAndTranslation(f32 x, f32 y, f32 z, Vec3s* rotation);
+RSPMatrix* Matrix_ToRSPMatrix(MtxF* src, RSPMatrix* dst);
+Mtx* Matrix_ToMtx(Mtx* dest);
+RSPMatrix* Matrix_GetStateAsRSPMatrix(RSPMatrix* matrix);
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx);
-RSPMatrix* SysMatrix_AppendStateToPolyOpaDisp(GraphicsContext* gfxCtx);
-void SysMatrix_AppendToPolyOpaDisp(MtxF* mtx, GraphicsContext* gfxCtx);
-void SysMatrix_MultiplyVector3fByState(Vec3f* src, Vec3f* dst);
-void SysMatrix_GetStateTranslation(Vec3f* dst);
-void SysMatrix_GetStateTranslationAndScaledX(f32 scale, Vec3f* dst);
-void SysMatrix_GetStateTranslationAndScaledY(f32 scale, Vec3f* dst);
-void SysMatrix_GetStateTranslationAndScaledZ(f32 scale, Vec3f* dst);
-void SysMatrix_MultiplyVector3fXZByCurrentState(Vec3f* src, Vec3f* dst);
+RSPMatrix* Matrix_AppendStateToPolyOpaDisp(GraphicsContext* gfxCtx);
+void Matrix_AppendToPolyOpaDisp(MtxF* mtx, GraphicsContext* gfxCtx);
+void Matrix_MultiplyVector3fByState(Vec3f* src, Vec3f* dst);
+void Matrix_GetStateTranslation(Vec3f* dst);
+void Matrix_GetStateTranslationAndScaledX(f32 scale, Vec3f* dst);
+void Matrix_GetStateTranslationAndScaledY(f32 scale, Vec3f* dst);
+void Matrix_GetStateTranslationAndScaledZ(f32 scale, Vec3f* dst);
+void Matrix_MultiplyVector3fXZByCurrentState(Vec3f* src, Vec3f* dst);
void Matrix_MtxFCopy(MtxF* dst, MtxF* src);
-void SysMatrix_FromRSPMatrix(RSPMatrix* src, MtxF* dst);
-void SysMatrix_MultiplyVector3fByMatrix(Vec3f* src, Vec3f* dst, MtxF* matrix);
-void SysMatrix_TransposeXYZ(MtxF* matrix);
-void SysMatrix_NormalizeXYZ(MtxF* matrix);
+void Matrix_FromRSPMatrix(Mtx* src, MtxF* dst);
+void Matrix_MultiplyVector3fByMatrix(Vec3f* src, Vec3f* dst, MtxF* matrix);
+void Matrix_TransposeXYZ(MtxF* matrix);
+void Matrix_NormalizeXYZ(MtxF* matrix);
void func_8018219C(MtxF* pfParm1, Vec3s* psParm2, s32 iParm3);
// void func_801822C4(void);
-void SysMatrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 appendToState);
-void SysMatrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState);
+void Matrix_InsertRotationAroundUnitVector_f(f32 rotation, Vec3f* vector, s32 appendToState);
+void Matrix_InsertRotationAroundUnitVector_s(s16 rotation, Vec3f* vector, s32 appendToState);
// void func_80182C90(void);
// void func_80182CA0(void);
// void func_80182CBC(void);
@@ -4002,7 +4023,7 @@ void func_801A5CFC(u16 sfxId, Vec3f* arg1, s32 arg2, f32* arg3, f32* arg4, s8* a
// void func_801A7168(void);
// void func_801A7284(void);
void func_801A72CC(Vec3f* uParm1);
-// void func_801A7328(void);
+void func_801A7328(Vec3f* pos, u16 sfxId);
// void func_801A7484(void);
// void func_801A75E8(void);
// void func_801A7720(void);
@@ -4037,9 +4058,9 @@ s32 func_801A8A50(s32 param1);
// void func_801AA248(void);
// void func_801AA3E4(void);
// void func_801AA520(void);
-void func_801AA610(GlobalContext* globalCtx);
-void func_801AA624(GlobalContext* globalCtx);
-// void func_801AA68C(UNK_TYPE4 ctxt);
+void GameOver_Init(GlobalContext* globalCtx);
+void GameOver_FadeLights(GlobalContext* globalCtx);
+void GameOver_Update(GlobalContext* globalCtx);
void func_801AAAA0(GlobalContext* globalCtx);
#endif
diff --git a/include/io/controller.h b/include/io/controller.h
index e976402ec..50add3561 100644
--- a/include/io/controller.h
+++ b/include/io/controller.h
@@ -139,7 +139,8 @@ typedef struct {
/* 0x01 */ u8 txsize;
/* 0x02 */ u8 rxsize;
/* 0x03 */ u8 cmd;
- /* 0x04 */ u16 address;
+ /* 0x04 */ u8 hi;
+ /* 0x05 */ u8 lo;
/* 0x06 */ u8 data[32];
/* 0x26 */ u8 datacrc;
} __OSContRamReadFormat;
diff --git a/include/macros.h b/include/macros.h
index fc03fa4ff..607e5e9bc 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -17,8 +17,7 @@
#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr)-0x80000000)
#define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr))
-// Currently most often called ctxt in MM, TODO: Refactor names when its used
-#define ACTIVE_CAM globalCtx->cameraPtrs[globalCtx->activeCamera]
+#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera])
#define MAIN_CAM 0
#define SUBCAM_FREE 0
@@ -37,9 +36,9 @@
} \
(void)0
-#define PLAYER ((Player*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first)
+#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorList[ACTORCAT_PLAYER].first)
-#define FIRST_ENEMY ((Actor*)globalCtx->actorCtx.actorList[ACTORCAT_ENEMY].first)
+#define GET_FIRST_ENEMY(globalCtx) ((Actor*)(globalCtx)->actorCtx.actorList[ACTORCAT_ENEMY].first)
// linkAge still exists in MM, but is always set to 0 (always adult)
// There are remnants of these macros from OOT, but they are essentially useless
@@ -62,11 +61,13 @@
#define CUR_UPG_VALUE_VOID(upg) \
((((void)0, gSaveContext.inventory.upgrades) & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
+#define CUR_FORM ((gSaveContext.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.playerForm)
+
#define ALL_EQUIP_VALUE(equip) ((gSaveContext.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
#define CUR_EQUIP_VALUE(equip) ((gSaveContext.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
#define CUR_UPG_VALUE(upg) ((gSaveContext.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
#define TAKE_EQUIPPED_ITEM(equip) (gSaveContext.equips.equipment = ((((void)0, gSaveContext.equips.equipment) & (gEquipNegMasks[equip])) | (u16)(0 << gEquipShifts[equip])))
-#define CUR_FORM_EQUIP(button) (gSaveContext.equips.buttonItems[gSaveContext.playerForm == PLAYER_FORM_HUMAN ? 0 : gSaveContext.playerForm][button])
+#define CUR_FORM_EQUIP(button) (gSaveContext.equips.buttonItems[CUR_FORM][button])
#define CHECK_QUEST_ITEM(item) (((void)0, gSaveContext.inventory.questItems) & gBitFlags[item])
#define REMOVE_QUEST_ITEM(item) (gSaveContext.inventory.questItems = (((void)0, gSaveContext.inventory.questItems) & (-1 - gBitFlags[item])))
diff --git a/include/os.h b/include/os.h
index 50f3b10c4..b182d4e47 100644
--- a/include/os.h
+++ b/include/os.h
@@ -1,6 +1,7 @@
#ifndef _OS_H_
#define _OS_H_
+#include "stdlib.h"
#include "ultra64/thread.h"
#include "ultra64/message.h"
@@ -65,7 +66,7 @@ typedef struct {
/* 0x00 */ OSIoMesgHdr hdr;
/* 0x08 */ void* dramAddr;
/* 0x0C */ u32 devAddr;
- /* 0x10 */ u32 size;
+ /* 0x10 */ size_t size;
/* 0x14 */ OSPiHandle* piHandle;
} OSIoMesg; // size = 0x88
@@ -76,8 +77,8 @@ typedef struct {
/* 0x08 */ OSMesgQueue* cmdQueue;
/* 0x0C */ OSMesgQueue* evtQueue;
/* 0x10 */ OSMesgQueue* acsQueue;
- /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, u32);
- /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, u32);
+ /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t);
+ /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
} OSDevMgr; // size = 0x1C
diff --git a/include/os_internal.h b/include/os_internal.h
index b00548092..3c6d4eee4 100644
--- a/include/os_internal.h
+++ b/include/os_internal.h
@@ -6,4 +6,14 @@ typedef struct {
/* 0x04 */ OSMesg msg;
} __osHwInt; // size = 0x08
+typedef struct {
+ /* 0x00 */ u32 initialized;
+ /* 0x04 */ OSThread* mgrThread;
+ /* 0x08 */ OSMesgQueue* cmdQueue;
+ /* 0x0C */ OSMesgQueue* eventQueue;
+ /* 0x10 */ OSMesgQueue* accessQueue;
+ /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t);
+ /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t);
+} OSMgrArgs; // size = 0x1C
+
#endif
diff --git a/include/regs.h b/include/regs.h
index d75e11cff..e39e53d69 100644
--- a/include/regs.h
+++ b/include/regs.h
@@ -43,57 +43,57 @@
#define bREG(r) BASE_REG(28, r)
/* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */
-#define R_ENABLE_ARENA_DBG SREG(0)
-#define R_RUN_SPEED_LIMIT REG(45)
-#define R_UPDATE_RATE SREG(30)
-#define R_PAUSE_MENU_MODE SREG(94)
-#define R_C_UP_ICON_X YREG(88)
-#define R_C_UP_ICON_Y YREG(89)
-#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i)
-#define R_C_BTN_COLOR(i) ZREG(39 + i)
-#define R_B_BTN_COLOR(i) ZREG(43 + i)
-#define R_START_LABEL_DD(i) ZREG(48 + i)
-#define R_START_LABEL_Y(i) ZREG(51 + i)
-#define R_START_LABEL_X(i) ZREG(54 + i)
-#define R_C_UP_BTN_X ZREG(62)
-#define R_C_UP_BTN_Y ZREG(63)
-#define R_START_BTN_X ZREG(68)
-#define R_START_BTN_Y ZREG(69)
-#define R_ITEM_BTN_X(i) ZREG(70 + i)
-#define R_ITEM_BTN_Y(i) ZREG(74 + i)
-#define R_ITEM_BTN_DD(i) ZREG(78 + i)
-#define R_ITEM_ICON_X(i) ZREG(82 + i)
-#define R_ITEM_ICON_Y(i) ZREG(86 + i)
-#define R_ITEM_ICON_DD(i) ZREG(90 + i)
-#define R_A_BTN_Y XREG(16)
-#define R_A_BTN_X XREG(17)
-#define R_A_ICON_Y XREG(19)
-#define R_A_ICON_X XREG(20)
-#define R_A_BTN_COLOR(i) XREG(22 + i)
-#define R_MAGIC_BAR_SMALL_Y XREG(48)
-#define R_MAGIC_BAR_X XREG(49)
-#define R_MAGIC_BAR_LARGE_Y XREG(50)
-#define R_MAGIC_FILL_X XREG(51)
-#define R_B_LABEL_DD WREG(0)
-#define R_OW_MINIMAP_X WREG(29)
-#define R_OW_MINIMAP_Y WREG(30)
-#define R_MINIMAP_TOGGLED WREG(31)
-#define R_B_LABEL_X(i) WREG(40 + i)
-#define R_B_LABEL_Y(i) WREG(43 + i)
-#define R_DGN_MINIMAP_X WREG(68)
-#define R_DGN_MINIMAP_Y WREG(69)
-#define R_MAP_INDEX VREG(11)
-#define R_MAP_TEX_INDEX_BASE VREG(12)
-#define R_MAP_TEX_INDEX VREG(13)
-#define R_COMPASS_SCALE_X VREG(14)
-#define R_COMPASS_SCALE_Y VREG(15)
-#define R_COMPASS_OFFSET_X VREG(16)
-#define R_COMPASS_OFFSET_Y VREG(17)
-#define R_MINIMAP_COLOR(i) VREG(18 + i)
-#define R_ITEM_AMMO_X(i) VREG(64 + i)
-#define R_ITEM_AMMO_Y(i) VREG(68 + i)
-#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
-#define R_ITEM_BTN_WIDTH(i) VREG(80 + i)
+#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT
+#define R_RUN_SPEED_LIMIT REG(45)
+#define R_UPDATE_RATE SREG(30)
+#define R_PAUSE_MENU_MODE SREG(94)
+#define R_C_UP_ICON_X YREG(88)
+#define R_C_UP_ICON_Y YREG(89)
+#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i)
+#define R_C_BTN_COLOR(i) ZREG(39 + i)
+#define R_B_BTN_COLOR(i) ZREG(43 + i)
+#define R_START_LABEL_DD(i) ZREG(48 + i)
+#define R_START_LABEL_Y(i) ZREG(51 + i)
+#define R_START_LABEL_X(i) ZREG(54 + i)
+#define R_C_UP_BTN_X ZREG(62)
+#define R_C_UP_BTN_Y ZREG(63)
+#define R_START_BTN_X ZREG(68)
+#define R_START_BTN_Y ZREG(69)
+#define R_ITEM_BTN_X(i) ZREG(70 + i)
+#define R_ITEM_BTN_Y(i) ZREG(74 + i)
+#define R_ITEM_BTN_DD(i) ZREG(78 + i)
+#define R_ITEM_ICON_X(i) ZREG(82 + i)
+#define R_ITEM_ICON_Y(i) ZREG(86 + i)
+#define R_ITEM_ICON_DD(i) ZREG(90 + i)
+#define R_A_BTN_Y XREG(16)
+#define R_A_BTN_X XREG(17)
+#define R_A_ICON_Y XREG(19)
+#define R_A_ICON_X XREG(20)
+#define R_A_BTN_COLOR(i) XREG(22 + i)
+#define R_MAGIC_BAR_SMALL_Y XREG(48)
+#define R_MAGIC_BAR_X XREG(49)
+#define R_MAGIC_BAR_LARGE_Y XREG(50)
+#define R_MAGIC_FILL_X XREG(51)
+#define R_B_LABEL_DD WREG(0)
+#define R_OW_MINIMAP_X WREG(29)
+#define R_OW_MINIMAP_Y WREG(30)
+#define R_MINIMAP_TOGGLED WREG(31)
+#define R_B_LABEL_X(i) WREG(40 + i)
+#define R_B_LABEL_Y(i) WREG(43 + i)
+#define R_DGN_MINIMAP_X WREG(68)
+#define R_DGN_MINIMAP_Y WREG(69)
+#define R_MAP_INDEX VREG(11)
+#define R_MAP_TEX_INDEX_BASE VREG(12)
+#define R_MAP_TEX_INDEX VREG(13)
+#define R_COMPASS_SCALE_X VREG(14)
+#define R_COMPASS_SCALE_Y VREG(15)
+#define R_COMPASS_OFFSET_X VREG(16)
+#define R_COMPASS_OFFSET_Y VREG(17)
+#define R_MINIMAP_COLOR(i) VREG(18 + i)
+#define R_ITEM_AMMO_X(i) VREG(64 + i)
+#define R_ITEM_AMMO_Y(i) VREG(68 + i)
+#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
+#define R_ITEM_BTN_WIDTH(i) VREG(80 + i)
#define R_FB_FILTER_TYPE SREG(80)
#define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c)
diff --git a/include/stdlib.h b/include/stdlib.h
index f10cfef4b..a7b44961a 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -18,7 +18,7 @@ typedef struct {
/* 0x8 */ long long rem;
} lldiv_t;
-typedef unsigned int size_t;
+typedef unsigned long size_t;
typedef int ssize_t;
diff --git a/include/string.h b/include/string.h
deleted file mode 100644
index c519b1406..000000000
--- a/include/string.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _STRING_H_
-#define _STRING_H_
-
-#define NULL 0
-typedef unsigned int size_t;
-
-#endif
diff --git a/include/variables.h b/include/variables.h
index 3043c18c1..2b223b9a7 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -30,8 +30,8 @@ extern vs32 gIrqMgrResetStatus;
extern volatile OSTime sIrqMgrResetTime;
extern volatile OSTime sIrqMgrRetraceTime;
extern s32 sIrqMgrRetraceCount;
-extern char* D_80096B80[18];
-extern char* sExceptionNames[6];
+extern const char* sCpuExceptions[18];
+extern const char* sFpuExceptions[6];
extern FaultDrawer* sFaultDrawContext;
extern FaultDrawer sFaultDrawerDefault;
// extern UNK_TYPE4 D_80096C20;
@@ -67,8 +67,8 @@ extern OSPiHandle* __osPiTable;
extern OSPiHandle* __osCurrentHandle[];
extern UNK_TYPE4 __osPiAccessQueueEnabled;
extern OSViMode osViModeNtscHpn1;
-// extern UNK_TYPE4 D_80097F00;
-// extern UNK_TYPE1 D_80097F04;
+extern s32 __osPfsInodeCacheChannel;
+extern u8 __osPfsInodeCacheBank;
extern UNK_TYPE4 D_80097F10;
extern char spaces[];
extern char zeroes[];
@@ -207,8 +207,8 @@ extern char D_80098A00[];
extern char D_80098A0C[];
extern char D_80098A1C[];
extern char D_80098A20[34];
-extern char D_80098A44[];
-extern char D_80098A68[];
+extern const char D_80098A44[];
+extern const char D_80098A68[];
extern char D_80098A88[53];
extern char D_80098AC0[49];
extern char D_80098AF4[51];
@@ -218,7 +218,7 @@ extern char D_80098B68[];
extern char D_80098B84[];
extern char D_80098BA0[];
extern char D_80098BBC[];
-extern char faultThreadName[];
+extern const char faultThreadName[];
extern char D_80098BE0[];
extern char D_80098BF8[];
extern char D_80098BFC[];
@@ -230,15 +230,14 @@ extern char D_80098C2C[];
extern char D_80098C34[];
extern char D_80098C38[];
extern char D_80098C40[];
-extern u8 sFaultDrawerFont[8][128];
extern char D_80099050[];
extern char D_80099054[];
extern char D_8009905C[];
extern char D_80099064[];
extern char D_80099070[];
-extern char D_80099078[];
-extern char D_8009907C[];
-extern char D_80099080[];
+extern const char D_80099078[];
+extern const char D_8009907C[];
+extern const char D_80099080[];
extern char D_800990B0[];
extern f32 D_800990C0[9];
extern f32 D_800990E4;
@@ -288,7 +287,7 @@ extern char gBuildMakeOption[];
// extern u8 sIdleThreadStack[0x400];
// extern StackEntry sIdleThreadInfo;
// extern u8 sBootThreadStack[0x400];
-// extern IrqMgr gIrqMgr;
+extern IrqMgr gIrqMgr;
// extern u8 sIrqMgrStack[0x500];
// extern StackEntry sIrqMgrStackInfo;
// extern OSThread gMainThread;
@@ -325,10 +324,10 @@ extern FaultDrawer sFaultDrawerStruct;
// extern Arena gSystemArena;
extern u32 sRandFloat;
// extern UNK_TYPE4 sArenaLockMsg;
-// extern OSTask tmp_task;
-// extern UNK_TYPE1 D_8009CDB0;
-// extern OSMesg siAccessBuf[1];
-// extern OSMesgQueue __osSiAccessQueue;
+extern OSTask tmp_task;
+extern OSPifRam osPifBuffers[4];
+extern OSMesg siAccessBuf[1];
+extern OSMesgQueue __osSiAccessQueue;
extern OSPifRam __osContPifRam;
// extern UNK_TYPE1 D_8009CF0C;
extern u8 __osContLastCmd;
@@ -418,10 +417,10 @@ extern EffectSsInfo EffectSS2Info;
// extern UNK_TYPE1 D_801AE48C;
// extern UNK_TYPE1 D_801AE490;
extern EffectSsOverlay particleOverlayTable[39];
-extern UNK_PTR D_801AE8F0;
-// extern UNK_TYPE4 D_801AEC70;
-// extern UNK_TYPE4 D_801AEC74;
-// extern UNK_TYPE4 D_801AEC78;
+// extern FlagSetEntry sFlagEntries[];
+// extern s32 sEntryIndex;
+// extern u32 sCurrentBit;
+// extern s32 sTimer;
extern Color_RGBA8 D_801AEC80;
extern s801AEC84 D_801AEC84[13];
extern f32 actorMovementScale;
@@ -937,13 +936,13 @@ extern s16 actorCutsceneReturnCamera;
extern s16 D_801BD8C6;
extern ColliderCylinderInit fireObjCollisionInit;
extern FireObjLightParams D_801BD8FC[2];
-extern GameStateOverlay gGameStateOverlayTable;
-extern GameStateOverlay D_801BD940;
-extern GameStateOverlay titleGameStateInfo;
-extern GameStateOverlay mainGameStateInfo;
-extern GameStateOverlay openingGameStateInfo;
-extern GameStateOverlay fileChooseGameStateInfo;
-extern GameStateOverlay daytelopGameStateInfo;
+extern GameStateOverlay gGameStateOverlayTable[];
+// extern GameStateOverlay D_801BD940;
+// extern GameStateOverlay titleGameStateInfo;
+// extern GameStateOverlay mainGameStateInfo;
+// extern GameStateOverlay openingGameStateInfo;
+// extern GameStateOverlay fileChooseGameStateInfo;
+// extern GameStateOverlay daytelopGameStateInfo;
// extern UNK_TYPE4 graphNumGameStates;
// extern UNK_TYPE2 D_801BDA70;
// extern UNK_TYPE2 D_801BDA74;
@@ -1665,7 +1664,7 @@ extern u32 D_801D1510;
extern u32 D_801D1514[3];
extern s32 gScreenWidth;
extern s32 gScreenHeight;
-// extern UNK_TYPE4 startHeapSize;
+extern u32 startHeapSize;
extern PadMgr* padmgrContext;
// extern UNK_TYPE4 controllerInputsCaptured;
// extern UNK_TYPE4 D_801D1538;
@@ -1673,7 +1672,7 @@ extern UNK_PTR D_801D1540;
// extern f32 sFactorialTbl[13];
extern Vec3f D_801D15B0;
extern Vec3s D_801D15BC;
-extern RSPMatrix D_801D1DE0;
+extern Mtx D_801D1DE0;
extern MtxF D_801D1E20;
extern UNK_PTR D_801D1E60;
extern UNK_PTR D_801D1E64;
@@ -3135,7 +3134,6 @@ extern UNK_PTR D_801E10B0;
// extern UNK_TYPE4 D_801E1104;
// extern UNK_TYPE4 D_801E1108;
// extern UNK_TYPE4 D_801E110C;
-// extern UNK_TYPE2 D_801E1110;
// extern UNK_TYPE2 D_801E1180;
// extern UNK_TYPE1 D_801E1420;
// extern UNK_TYPE2 D_801E1630;
@@ -3263,7 +3261,6 @@ extern TriNorm D_801EF590;
extern TriNorm D_801EF5C8;
extern TriNorm D_801EF600;
extern TriNorm D_801EF638;
-// extern UNK_TYPE1 D_801EF66D;
extern SaveContext gSaveContext;
// extern UNK_TYPE2 D_801F3F38;
// extern UNK_TYPE1 D_801F3F3A;
@@ -3342,7 +3339,7 @@ extern s16 D_801F4E7A;
// extern UNK_TYPE1 D_801F4F68;
// extern UNK_TYPE1 D_801F4F6A;
extern LightsBuffer sLightsBuffer;
-extern Arena mainHeap;
+extern Arena sZeldaArena;
// extern UNK_TYPE1 D_801F5130;
// extern UNK_TYPE1 D_801F5270;
// extern UNK_TYPE1 D_801F528E;
@@ -3351,7 +3348,7 @@ extern Arena mainHeap;
// extern UNK_TYPE1 D_801F5730;
// extern UNK_TYPE1 D_801F57B4;
// extern UNK_TYPE1 D_801F5834;
-extern s32* gNMIBuffer;
+// extern NmiBuff* gNMIBuffer;
// extern UNK_TYPE1 D_801F5850;
// extern UNK_TYPE1 D_801F58B0;
// extern UNK_TYPE1 D_801F59AC;
@@ -3366,13 +3363,6 @@ extern s32* gNMIBuffer;
// extern UNK_TYPE1 D_801F59F0;
// extern UNK_TYPE1 D_801F59F4;
// extern UNK_TYPE1 D_801F59F8;
-// extern QuakeRequest sQuakeRequest[4];
-// extern Quake2Context sQuake2Context;
-// extern s32 sMatAnimStep;
-// extern u32 sMatAnimFlags;
-// extern f32 sMatAnimAlphaRatio;
-extern s32 D_801F5AB0;
-extern s32 D_801F5AB4;
// extern UNK_TYPE1 D_801F5AC0;
// extern UNK_TYPE1 D_801F69D0;
// extern UNK_TYPE1 D_801F6A10;
@@ -3435,19 +3425,19 @@ extern FaultClient graphFaultClient;
extern Gfx* graphDlEntry;
// extern UNK_TYPE1 D_801F80F8;
extern u64 lastRenderFrameTimestamp;
-extern OSMesgQueue siEventCallbackQueue;
-extern OSMesg siEventCallbackBuffer[1];
+extern OSMesgQueue sSiIntMsgQ;
+extern OSMesg sSiIntMsgBuf[1];
extern u32 gSegments[NUM_SEGMENTS];
-extern SchedContext schedContext;
-extern IrqMgrClient mainIrqmgrCallbackNode;
-extern OSMesgQueue mainIrqmgrCallbackQueue;
-extern OSMesg mainIrqCallbackBuffer[60];
-extern OSThread graphOSThread;
-extern u8 graphStack[0x1800];
-extern u8 schedStack[0x600];
-extern u8 audioStack[0x800];
-extern u8 padmgrStack[0x500];
-extern StackEntry graphStackEntry;
+extern SchedContext gSchedContext;
+extern IrqMgrClient irqClient;
+extern OSMesgQueue irqMgrMsgQ;
+extern OSMesg irqMgrMsgBuf[60];
+extern OSThread sGraphThread;
+extern u8 sGraphStack[6144];
+extern u8 schedStack[1536];
+extern u8 audioStack[2048];
+extern u8 padmgrStack[1280];
+extern StackEntry sGraphStackInfo;
extern StackEntry schedStackEntry;
extern StackEntry audioStackEntry;
extern StackEntry padmgrStackEntry;
diff --git a/include/z64.h b/include/z64.h
index a13ffedb6..cd00fb86f 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -36,6 +36,7 @@
#include "z64scene.h"
#include "z64save.h"
#include "z64transition.h"
+#include "regs.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
@@ -46,16 +47,20 @@
#define Z_THREAD_ID_IDLE 1
#define Z_THREAD_ID_SLOWLY 2
#define Z_THREAD_ID_MAIN 3
+#define Z_THREAD_ID_GRAPH 4
#define Z_THREAD_ID_SCHED 5
#define Z_THREAD_ID_DMAMGR 18
#define Z_THREAD_ID_IRQMGR 19
-#define Z_PRIORITY_SLOWLY 5
-#define Z_PRIORITY_GRAPH 9
-#define Z_PRIORITY_IDLE 12
-#define Z_PRIORITY_MAIN 12
-#define Z_PRIORITY_DMAMGR 17
-#define Z_PRIORITY_IRQMGR 18
+#define Z_PRIORITY_SLOWLY 5
+#define Z_PRIORITY_GRAPH 9
+#define Z_PRIORITY_AUDIOMGR 11
+#define Z_PRIORITY_IDLE 12
+#define Z_PRIORITY_MAIN 12
+#define Z_PRIORITY_PADMGR 15
+#define Z_PRIORITY_SCHED 16
+#define Z_PRIORITY_DMAMGR 17
+#define Z_PRIORITY_IRQMGR 18
#define EQUIP_SLOT_B 0
#define EQUIP_SLOT_C_LEFT 1
@@ -238,14 +243,16 @@ typedef struct {
/* 0x11D88 */ u8 unk_11D88;
} Font; // size = 0x11D8C
+// Game Info aka. Static Context
+// Data normally accessed through REG macros (see regs.h)
typedef struct {
- /* 0x0000 */ u8 unk0;
- /* 0x0001 */ u8 unk1;
- /* 0x0002 */ u8 unk2;
- /* 0x0003 */ u8 unk3;
- /* 0x0004 */ u32 unk4;
- /* 0x0008 */ UNK_TYPE1 pad8[0xC];
- /* 0x0014 */ s16 data[2784]; // Accessed through REG macros
+ /* 0x00 */ u8 unk_00; // regPage;? // 1 is first page
+ /* 0x01 */ u8 unk_01; // regGroup;? // "register" group (R, RS, RO, RP etc.)
+ /* 0x02 */ u8 unk_02; // regCur;? // selected register within page
+ /* 0x03 */ u8 unk_03; // dpadLast;?
+ /* 0x04 */ u32 unk_04; // repeat;?
+ /* 0x08 */ UNK_TYPE1 pad_08[0xC];
+ /* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 entries
} GameInfo; // size = 0x15D4
typedef struct {
@@ -301,7 +308,7 @@ typedef struct GraphicsContext {
/* 0x1B4 */ Gfx* unk1B4;
/* 0x1B8 */ TwoHeadGfxArena unk1B8;
/* 0x1C8 */ UNK_TYPE1 pad1C8[0xAC];
- /* 0x274 */ OSViMode* unk274;
+ /* 0x274 */ OSViMode* viMode;
/* 0x278 */ void* zbuffer;
/* 0x27C */ UNK_TYPE1 pad27C[0x1C];
/* 0x298 */ TwoHeadGfxArena overlay;
@@ -344,6 +351,13 @@ typedef struct {
/* 0x14 */ u32 relocations[1];
} OverlayRelocationSection; // size >= 0x18
+typedef struct {
+ /* 0x00 */ u32 resetting;
+ /* 0x04 */ u32 resetCount;
+ /* 0x08 */ OSTime duration;
+ /* 0x10 */ OSTime resetTime;
+} NmiBuff; // size >= 0x18
+
typedef struct {
/* 0x00 */ s16 intPart[16];
/* 0x20 */ u16 fracPart[16];
@@ -396,17 +410,13 @@ typedef struct {
/* 0xC */ s32 rightX;
} Viewport; // size = 0x10
-typedef void*(*fault_address_converter_func)(void* addr, void* arg);
+typedef void*(*FaultAddrConvFunc)(void* addr, void* arg);
typedef void(*fault_client_func)(void* arg1, void* arg2);
-typedef unsigned long(*func)(void);
-
-typedef void(*func_ptr)(void);
-
typedef void(*osCreateThread_func)(void*);
-typedef void* (*PrintCallback)(void*, const char*, u32);
+typedef void* (*PrintCallback)(void*, const char*, size_t);
typedef enum {
SLOWLY_CALLBACK_NO_ARGS,
@@ -529,7 +539,7 @@ typedef struct {
/* 0x20 */ u16 printColors[10];
/* 0x34 */ u8 escCode;
/* 0x35 */ u8 osSyncPrintfEnabled;
- /* 0x38 */ func_ptr inputCallback;
+ /* 0x38 */ void* inputCallback;
} FaultDrawer; // size = 0x3C
typedef struct GfxPrint {
@@ -553,19 +563,23 @@ typedef enum {
GFXPRINT_OPEN = 0x80
} GfxPrintFlag;
+typedef struct GameState GameState;
+
+typedef void (*GameStateFunc)(GameState* gameState);
+
typedef struct {
- /* 0x00 */ void* loadedRamAddr;
- /* 0x04 */ u32 vromStart;
- /* 0x08 */ u32 vromEnd;
- /* 0x0C */ void* vramStart;
- /* 0x10 */ void* vramEnd;
- /* 0x14 */ UNK_TYPE4 unk14;
- /* 0x18 */ func_ptr init;
- /* 0x1C */ func_ptr destroy;
- /* 0x20 */ UNK_TYPE4 unk20;
- /* 0x24 */ UNK_TYPE4 unk24;
- /* 0x28 */ UNK_TYPE4 unk28;
- /* 0x2C */ u32 instanceSize;
+ /* 0x00 */ void* loadedRamAddr;
+ /* 0x04 */ uintptr_t vromStart; // if applicable
+ /* 0x08 */ uintptr_t vromEnd; // if applicable
+ /* 0x0C */ void* vramStart; // if applicable
+ /* 0x10 */ void* vramEnd; // if applicable
+ /* 0x14 */ UNK_PTR unk_14;
+ /* 0x18 */ GameStateFunc init; // initializes and executes the given context
+ /* 0x1C */ GameStateFunc destroy; // deconstructs the context, and sets the next context to load
+ /* 0x20 */ UNK_PTR unk_20;
+ /* 0x24 */ UNK_PTR unk_24;
+ /* 0x28 */ UNK_TYPE unk_28;
+ /* 0x2C */ size_t instanceSize;
} GameStateOverlay; // size = 0x30
typedef struct {
@@ -953,7 +967,7 @@ typedef struct {
/* 0x12020 */ u8 unk12020;
/* 0x12021 */ u8 choiceIndex;
/* 0x12022 */ UNK_TYPE1 unk12022;
- /* 0x12023 */ s8 unk12023;
+ /* 0x12023 */ u8 unk12023;
/* 0x12024 */ UNK_TYPE1 unk12024[0x6];
/* 0x1202A */ u16 unk1202A;
/* 0x1202C */ UNK_TYPE1 pad1202C[0x2];
@@ -974,18 +988,10 @@ typedef struct {
/* 0x120D8 */ UNK_TYPE1 pad120D8[0x8];
} MessageContext; // size = 0x120E0
-typedef struct ActorBgMbarChair ActorBgMbarChair;
-
-typedef struct ActorEnBji01 ActorEnBji01;
-
-typedef struct ActorEnTest ActorEnTest;
-
-typedef struct ActorListEntry ActorListEntry;
-
typedef struct ArenaNode_t {
/* 0x0 */ s16 magic; // Should always be 0x7373
/* 0x2 */ s16 isFree;
- /* 0x4 */ u32 size;
+ /* 0x4 */ size_t size;
/* 0x8 */ struct ArenaNode_t* next;
/* 0xC */ struct ArenaNode_t* prev;
} ArenaNode; // size = 0x10
@@ -999,19 +1005,11 @@ typedef struct {
/* 0x22 */ u8 flag;
} Arena; // size = 0x24
-typedef struct ActorEnBom ActorEnBom;
-
-typedef struct ActorEnFirefly ActorEnFirefly;
-
-typedef struct ActorObjBell ActorObjBell;
-
-typedef struct ActorBgIknvObj ActorBgIknvObj;
-
typedef struct FaultAddrConvClient FaultAddrConvClient;
struct FaultAddrConvClient {
/* 0x0 */ FaultAddrConvClient* next;
- /* 0x4 */ fault_address_converter_func callback;
+ /* 0x4 */ FaultAddrConvFunc callback;
/* 0x8 */ void* param;
}; // size = 0xC
@@ -1046,50 +1044,47 @@ typedef struct FireObj FireObj;
typedef struct FireObjLight FireObjLight;
-typedef struct GameAlloc GameAlloc;
+typedef struct GameAllocNode {
+ /* 0x0 */ struct GameAllocNode* next;
+ /* 0x4 */ struct GameAllocNode* prev;
+ /* 0x8 */ size_t size;
+ /* 0xC */ u32 unk_0C;
+} GameAllocEntry; // size = 0x10
-typedef struct GameState GameState;
-
-typedef struct PreNMIContext PreNMIContext;
-
-typedef struct GameAllocNode GameAllocNode;
-
-struct GameAllocNode {
- /* 0x0 */ GameAllocNode* next;
- /* 0x4 */ GameAllocNode* prev;
- /* 0x8 */ u32 size;
- /* 0xC */ UNK_TYPE1 padC[0x4];
-}; // size = 0x10
-
-struct GameAlloc {
- /* 0x00 */ GameAllocNode base;
- /* 0x10 */ GameAllocNode* head;
-}; // size = 0x14
-
-typedef void (*GameStateFunc)(struct GameState* gameState);
+typedef struct GameAlloc {
+ /* 0x00 */ GameAllocEntry base;
+ /* 0x10 */ GameAllocEntry* head;
+} GameAlloc; // size = 0x14
struct GameState {
/* 0x00 */ GraphicsContext* gfxCtx;
/* 0x04 */ GameStateFunc main;
/* 0x08 */ GameStateFunc destroy;
/* 0x0C */ GameStateFunc nextGameStateInit;
- /* 0x10 */ u32 nextGameStateSize;
+ /* 0x10 */ size_t nextGameStateSize;
/* 0x14 */ Input input[4];
/* 0x74 */ TwoHeadArena heap;
/* 0x84 */ GameAlloc alloc;
/* 0x98 */ UNK_TYPE1 pad98[0x3];
/* 0x9B */ u8 running; // If 0, switch to next game state
/* 0x9C */ u32 frames;
- /* 0xA0 */ UNK_TYPE1 padA0[0x2];
+ /* 0xA0 */ u8 padA0[0x2];
/* 0xA2 */ u8 framerateDivisor; // game speed?
/* 0xA3 */ UNK_TYPE1 unkA3;
}; // size = 0xA4
-struct PreNMIContext {
+typedef struct PreNMIContext {
/* 0x00 */ GameState state;
/* 0xA4 */ u32 timer;
/* 0xA8 */ UNK_TYPE4 unkA8;
-}; // size = 0xAC
+} PreNMIContext; // size = 0xAC
+
+typedef struct {
+ /* 0x00 */ u32 resetting;
+ /* 0x04 */ u32 resetCount;
+ /* 0x08 */ OSTime duration;
+ /* 0x10 */ OSTime resetTime;
+} PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused)
typedef struct GlobalContext GlobalContext;
@@ -1272,7 +1267,7 @@ typedef struct {
/* 0x024 */ UNK_TYPE4 unk24;
/* 0x028 */ OSMesg lockMesg[1];
/* 0x02C */ OSMesg interrupts[8];
- /* 0x04C */ OSMesgQueue siEventCallbackQueue;
+ /* 0x04C */ OSMesgQueue sSiIntMsgQ;
/* 0x064 */ OSMesgQueue lock;
/* 0x07C */ OSMesgQueue irqmgrCallbackQueue;
/* 0x094 */ IrqMgrClient irqmgrCallbackQueueNode;
@@ -1363,11 +1358,11 @@ struct FireObjLight {
/* 0x12 */ u8 unk12;
}; // size = 0x13
-struct ActorListEntry {
+typedef struct ActorListEntry {
/* 0x0 */ s32 length; // number of actors loaded of this type
/* 0x4 */ Actor* first; // pointer to first actor of this type
/* 0x8 */ UNK_TYPE1 pad8[0x4];
-}; // size = 0xC
+} ActorListEntry; // size = 0xC
#define OS_SC_RETRACE_MSG 1
#define OS_SC_DONE_MSG 2
@@ -1514,6 +1509,19 @@ typedef struct {
/* 0x04 */ s32 timer;
} FrameAdvanceContext; // size = 0x8
+typedef enum {
+ /* 00 */ GAMEOVER_INACTIVE,
+ /* 01 */ GAMEOVER_DEATH_START,
+ /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground
+ /* 03 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out
+
+ /* 20 */ GAMEOVER_REVIVE_START = 20,
+ /* 21 */ GAMEOVER_REVIVE_RUMBLE,
+ /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground
+ /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body
+ /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up
+} GameOverState;
+
typedef struct {
/* 0x00 */ u16 state;
} GameOverContext; // size = 0x02
@@ -1631,108 +1639,6 @@ typedef struct {
/* 0x8 */ s32 unk8;
} struct_80133038_arg2; // size = 0xC
-typedef struct {
- /* 0x000 */ Actor base;
- /* 0x144 */ ColliderQuad unk144;
- /* 0x1C4 */ ColliderQuad unk1C4;
- /* 0x244 */ Vec3f unk244;
- /* 0x250 */ f32 unk250;
- /* 0x254 */ f32 unk254;
- /* 0x258 */ ActorFunc update;
- /* 0x25C */ s16 unk25C;
- /* 0x25E */ u16 unk25E;
- /* 0x260 */ u8 unk260;
- /* 0x261 */ UNK_TYPE1 pad261[0x3];
-} ActorArrowFire; // size = 0x264
-
-struct ActorBgMbarChair {
- /* 0x000 */ Actor base;
- /* 0x144 */ UNK_TYPE1 pad144[0x18];
-}; // size = 0x15C
-
-struct ActorEnBji01 {
- /* 0x000 */ Actor base;
- /* 0x144 */ UNK_TYPE1 pad144[0x170];
-}; // size = 0x2B4
-
-struct ActorEnBom {
- /* 0x000 */ Actor base;
- /* 0x144 */ ColliderCylinder unk144;
- /* 0x190 */ ColliderJntSph unk190;
- /* 0x1B0 */ ColliderJntSphElement unk1B0[1];
- /* 0x1F0 */ s16 unk1F0;
- /* 0x1F2 */ UNK_TYPE1 pad1F2[0x6];
- /* 0x1F8 */ u8 unk1F8;
- /* 0x1F9 */ u8 unk1F9;
- /* 0x1FA */ UNK_TYPE1 pad1FA[0x2];
- /* 0x1FC */ u8 unk1FC;
- /* 0x1FD */ UNK_TYPE1 pad1FD[0x3];
- /* 0x200 */ func_ptr unk200;
-}; // size = 0x204
-
-struct ActorEnFirefly {
- /* 0x000 */ Actor base;
- /* 0x144 */ UNK_TYPE1 pad144[0x1C];
- /* 0x160 */ f32 unk160;
- /* 0x164 */ UNK_TYPE1 pad164[0x24];
- /* 0x188 */ func_ptr updateFunc;
- /* 0x18C */ UNK_TYPE1 type;
- /* 0x18D */ u8 unk18D;
- /* 0x18E */ u8 unk18E;
- /* 0x18F */ u8 unk18F;
- /* 0x190 */ s16 unk190;
- /* 0x192 */ UNK_TYPE1 pad192[0x152];
- /* 0x2E4 */ f32 unk2E4;
- /* 0x2E8 */ f32 unk2E8;
- /* 0x2EC */ f32 unk2EC;
- /* 0x2F0 */ f32 unk2F0;
- /* 0x2F4 */ UNK_TYPE1 pad2F4[0x28];
- /* 0x31C */ ColliderSphere collision;
-}; // size = 0x374
-
-struct ActorEnTest {
- /* 0x000 */ Actor base;
- /* 0x144 */ UNK_TYPE1 pad144[0x10];
- /* 0x154 */ f32 unk154;
- /* 0x158 */ UNK_TYPE1 pad158[0xB0];
- /* 0x208 */ u8 unk208;
- /* 0x209 */ UNK_TYPE1 pad209[0x1];
- /* 0x20A */ u8 unk20A;
- /* 0x20B */ UNK_TYPE1 pad20B[0x1];
- /* 0x20C */ ActorEnTest20C unk20C[20];
-}; // size = 0x6BC
-
-typedef struct {
- /* 0x000 */ Actor base;
- /* 0x144 */ s8 unk144;
- /* 0x145 */ u8 unk145;
- /* 0x146 */ u16 unk146;
- /* 0x148 */ u16 unk148;
- /* 0x14A */ u16 unk14A;
- /* 0x14C */ u8 unk14C;
- /* 0x14D */ UNK_TYPE1 pad14D[0x3];
- /* 0x150 */ ActorFunc unk150;
-} ActorEnTest4; // size = 0x154
-
-struct ActorObjBell {
- /* 0x000 */ Actor base;
- /* 0x144 */ UNK_TYPE1 pad144[0x18];
- /* 0x15C */ ColliderSphere unk15C;
- /* 0x1B4 */ ColliderSphere unk1B4;
- /* 0x20C */ UNK_TYPE1 pad20C[0x2];
- /* 0x20E */ s16 unk20E;
- /* 0x210 */ UNK_TYPE1 pad210[0x4];
- /* 0x214 */ s16 unk214;
- /* 0x216 */ UNK_TYPE1 pad216[0x12];
-}; // size = 0x228
-
-struct ActorBgIknvObj {
- /* 0x000 */ DynaPolyActor bg;
- /* 0x15C */ ColliderCylinder collision;
- /* 0x1A8 */ u32 displayListAddr;
- /* 0x1AC */ ActorFunc updateFunc;
-}; // size = 0x1B0
-
typedef struct {
/* 0x00 */ u32 type;
/* 0x04 */ u32 setScissor;
@@ -1766,4 +1672,9 @@ typedef struct {
/* 0x20 */ u16 fracPart[4][4];
} MatrixInternal; // size = 0x40
+typedef struct {
+ /* 0x00 */ u8* value;
+ /* 0x04 */ const char* name;
+} FlagSetEntry; // size = 0x08
+
#endif
diff --git a/include/z64actor.h b/include/z64actor.h
index 48c53e8a2..5876251fb 100644
--- a/include/z64actor.h
+++ b/include/z64actor.h
@@ -141,7 +141,7 @@ typedef struct {
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
/* 0x14 */ u8 shadowAlpha; // Default is 255
/* 0x15 */ u8 feetFloorFlags; // Set if the actor's foot is clipped under the floor. & 1 is right foot, & 2 is left
- /* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDraw
+ /* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa
} ActorShape; // size = 0x30
typedef struct Actor {
@@ -289,12 +289,16 @@ typedef struct EnItem00 {
/* 0x1A4 */ s8 unk1A4;
} EnItem00; // size = 0x1A8
-typedef struct {
- /* 0x000 */ Actor base;
- /* 0x144 */ ActorFunc update;
+struct EnAObj;
+
+typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*);
+
+typedef struct EnAObj {
+ /* 0x000 */ Actor actor;
+ /* 0x144 */ EnAObjActionFunc actionFunc;
/* 0x148 */ ColliderCylinder collision;
/* 0x194 */ UNK_TYPE1 pad194[0x14];
-} ActorEnAObj; // size = 0x1A8
+} EnAObj; // size = 0x1A8
typedef enum {
/* 0x00 */ ACTORCAT_SWITCH,
diff --git a/include/z64animation.h b/include/z64animation.h
index aa5148e3b..2eed33ffd 100644
--- a/include/z64animation.h
+++ b/include/z64animation.h
@@ -6,196 +6,216 @@
#include "z64dma.h"
#include "z64math.h"
+struct GlobalContext;
+struct Actor;
+struct SkelAnime;
+
#define LINK_ANIMETION_OFFSET(addr, offset) \
(SEGMENT_ROM_START(link_animetion) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
#define LIMB_DONE 0xFF
#define ANIMATION_ENTRY_MAX 50
-#define ANIM_FLAG_UPDATEXZ 0x02
-#define ANIM_FLAG_UPDATEY 0x10
+#define ANIM_FLAG_UPDATEY (1 << 1)
+#define ANIM_FLAG_NOMOVE (1 << 4)
-struct GlobalContext;
-struct Actor;
-typedef struct SkelAnime SkelAnime;
+typedef enum {
+ /* 0 */ ANIMMODE_LOOP,
+ /* 1 */ ANIMMODE_LOOP_INTERP,
+ /* 2 */ ANIMMODE_ONCE,
+ /* 3 */ ANIMMODE_ONCE_INTERP,
+ /* 4 */ ANIMMODE_LOOP_PARTIAL,
+ /* 5 */ ANIMMODE_LOOP_PARTIAL_INTERP
+} AnimationModes;
+
+typedef enum {
+ /* -1 */ ANIMTAPER_DECEL = -1,
+ /* 0 */ ANIMTAPER_NONE,
+ /* 1 */ ANIMTAPER_ACCEL
+} AnimationTapers;
typedef struct {
- /* 0x000 */ Vec3s translation; // Translation relative to parent limb. root limb is a tranlation for entire model.
- /* 0x006 */ u8 firstChildIndex; // The first child's index into the limb table.
- /* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table.
- /* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the
- // far model display list.
-} StandardLimb; // Size = 0xC
+ /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
+ /* 0x06 */ u8 child; // The first child's index into the limb table.
+ /* 0x07 */ u8 sibling; // The parent limb's next limb index into the limb table.
+ /* 0x08 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the
+ // far model display list.
+} StandardLimb; // size = 0xC
// Model has limbs with only rigid meshes
typedef struct {
- /* 0x000 */ void** skeletonSeg; // Segment address of SkelLimbIndex.
- /* 0x004 */ u8 limbCount; // Number of limbs in the model.
+ /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
+ /* 0x06 */ u8 child;
+ /* 0x07 */ u8 sibling;
+ /* 0x08 */ Gfx* dLists[2]; // Near and far
+} LodLimb; // size = 0x10
+
+// Model has limbs with only rigid meshes
+typedef struct {
+ /* 0x00 */ void** segment;
+ /* 0x04 */ u8 limbCount;
} SkeletonHeader; // size = 0x8
// Model has limbs with flexible meshes
typedef struct {
- /* 0x000 */ SkeletonHeader sh;
- /* 0x008 */ u8 dListCount; // Number of display lists in the model.
+ /* 0x00 */ SkeletonHeader sh;
+ /* 0x08 */ u8 dListCount;
} FlexSkeletonHeader; // size = 0xC
-typedef s16 AnimationRotationValue;
-
+// Index into the frame data table.
typedef struct {
- /* 0x000 */ u16 x;
- /* 0x002 */ u16 y;
- /* 0x004 */ u16 z;
+ /* 0x00 */ u16 x;
+ /* 0x02 */ u16 y;
+ /* 0x04 */ u16 z;
} JointIndex; // size = 0x06
typedef struct {
- /* 0x000 */ s16 frameCount;
- /* 0x002 */ s16 unk02;
-} AnimationHeaderCommon; // size = 0x4
+ /* 0x00 */ s16 frameCount;
+} AnimationHeaderCommon;
typedef struct {
- /* 0x00 */ AnimationHeaderCommon common;
- /* 0x04 */ s16* frameData; // referenced as tbl
- /* 0x08 */ JointIndex* jointIndices; // referenced as ref_tbl
- /* 0x0C */ u16 staticIndexMax;
+ /* 0x000 */ AnimationHeaderCommon common;
+ /* 0x004 */ s16* frameData; // referenced as tbl
+ /* 0x008 */ JointIndex* jointIndices; // referenced as ref_tbl
+ /* 0x00C */ u16 staticIndexMax;
} AnimationHeader; // size = 0x10
+typedef struct {
+ /* 0x00 */ s16 xMax;
+ /* 0x02 */ s16 x;
+ /* 0x04 */ s16 yMax;
+ /* 0x06 */ s16 y;
+ /* 0x08 */ s16 zMax;
+ /* 0x10 */ s16 z;
+} JointKey; // size = 0x12
+
+typedef struct {
+ /* 0x00 */ s16 frameCount;
+ /* 0x02 */ s16 limbCount;
+ /* 0x04 */ s16* frameData;
+ /* 0x08 */ JointKey* jointKey;
+} LegacyAnimationHeader; // size = 0xC
+
typedef enum {
ANIMATION_LINKANIMETION,
- ANIMATION_TYPE1,
- ANIMATION_TYPE2,
- ANIMATION_TYPE3,
- ANIMATION_TYPE4,
- ANIMATION_TYPE5
+ ANIMENTRY_COPYALL,
+ ANIMENTRY_INTERP,
+ ANIMENTRY_COPYTRUE,
+ ANIMENTRY_COPYFALSE,
+ ANIMENTRY_MOVEACTOR
} AnimationType;
typedef struct {
/* 0x000 */ DmaRequest req;
/* 0x020 */ OSMesgQueue msgQueue;
/* 0x038 */ OSMesg msg;
-} AnimationEntryType0; // size = 0x3C
+} AnimEntryLoadFrame; // size = 0x3C
typedef struct {
- /* 0x000 */ u8 unk00;
+ /* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
-} AnimationEntryType1; // size = 0xC
+} AnimEntryCopyAll; // size = 0xC
typedef struct {
- /* 0x000 */ u8 unk00;
- /* 0x001 */ u8 limbCount;
- /* 0x004 */ Vec3s* unk04;
- /* 0x008 */ Vec3s* unk08;
- /* 0x00C */ f32 unk0C;
-} AnimationEntryType2; // size = 0x10
+ /* 0x000 */ u8 queueFlag;
+ /* 0x001 */ u8 vecCount;
+ /* 0x004 */ Vec3s* base;
+ /* 0x008 */ Vec3s* mod;
+ /* 0x00C */ f32 weight;
+} AnimEntryInterp; // size = 0x10
typedef struct {
- /* 0x000 */ u8 unk00;
+ /* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
- /* 0x00C */ u8* index;
-} AnimationEntryType3; // size = 0x10
+ /* 0x00C */ u8* copyFlag;
+} AnimEntryCopyTrue; // size = 0x10
typedef struct {
- /* 0x000 */ u8 unk00;
+ /* 0x000 */ u8 queueFlag;
/* 0x001 */ u8 vecCount;
- /* 0x002 */ char unk02[0x2];
/* 0x004 */ Vec3s* dst;
/* 0x008 */ Vec3s* src;
- /* 0x00C */ u8* index;
-} AnimationEntryType4; // size = 0x10
+ /* 0x00C */ u8* copyFlag;
+} AnimEntryCopyFalse; // size = 0x10
typedef struct {
/* 0x000 */ struct Actor* actor;
- /* 0x004 */ SkelAnime* skelAnime;
+ /* 0x004 */ struct SkelAnime* skelAnime;
/* 0x008 */ f32 unk08;
-} AnimationEntryType5; // size = 0xC
-
-typedef struct {
- /* 0x000 */ u8 raw[0x3C];
-} AnimationEntryRaw; // size = 0x3C
+} AnimEntryMoveActor; // size = 0xC
typedef union {
- AnimationEntryRaw raw;
- AnimationEntryType0 type0;
- AnimationEntryType1 type1;
- AnimationEntryType2 type2;
- AnimationEntryType3 type3;
- AnimationEntryType4 type4;
- AnimationEntryType5 type5;
-} AnimationEntryType; // size = 0x3C
+ AnimEntryLoadFrame load;
+ AnimEntryCopyAll copy;
+ AnimEntryInterp interp;
+ AnimEntryCopyTrue copy1;
+ AnimEntryCopyFalse copy0;
+ AnimEntryMoveActor move;
+} AnimationEntryData; // size = 0x3C
typedef struct {
/* 0x000 */ u8 type;
- /* 0x001 */ u8 unk01;
- /* 0x004 */ AnimationEntryType types;
+ /* 0x004 */ AnimationEntryData data;
} AnimationEntry; // size = 0x40
typedef struct AnimationContext {
/* 0x000 */ s16 animationCount;
- /* 0x002 */ char unk02[2];
/* 0x004 */ AnimationEntry entries[ANIMATION_ENTRY_MAX];
} AnimationContext; // size = 0xC84
typedef struct {
- /* 0x00 */ AnimationHeaderCommon common;
- /* 0x04 */ u32 segment;
+ /* 0x000 */ AnimationHeaderCommon common;
+ /* 0x004 */ u32 segment;
} LinkAnimationHeader; // size = 0x8
-struct SkelAnime {
- /* 0x00 */ u8 limbCount; // joint_Num
- /* modes 0 and 1 repeat the animation indefinitely
- * modes 2 and 3 play the animaton once then stop
- * modes >= 4 play the animation once, and always start at frame 0.
- */
- /* 0x01 */ u8 mode;
- /* 0x02 */ u8 dListCount;
- /* 0x03 */ s8 unk03;
+typedef struct SkelAnime {
+ /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton
+ /* 0x01 */ u8 mode; // 0: loop, 2: play once, 4: partial loop. +1 to interpolate between frames.
+ /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton
+ /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1.
/* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb.
- /* 0x08 */
- union {
- AnimationHeader* animCurrentSeg;
- LinkAnimationHeader* linkAnimetionSeg;
- AnimationHeaderCommon* genericSeg;
- };
- /* 0x0C */ f32 initialFrame;
- /* 0x10 */ f32 animFrameCount;
- /* 0x14 */ f32 totalFrames;
- /* 0x18 */ f32 animCurrentFrame;
- /* 0x1C */ f32 animPlaybackSpeed;
- /* 0x20 */ Vec3s* limbDrawTbl; // now_joint
- /* 0x24 */ Vec3s* transitionDrawTbl; // morf_joint
- /* 0x28 */ f32 transCurrentFrame;
- /* 0x2C */ f32 transitionStep;
- /* 0x30 */ s32 (*animUpdate)();
- /* 0x34 */ s8 initFlags;
- /* 0x35 */ u8 flags;
- /* 0x36 */ s16 prevFrameRot;
- /* 0x38 */ Vec3s prevFramePos;
- /* 0x3E */ Vec3s unk3E;
-}; // size = 0x44
+ /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader.
+ /* 0x0C */ f32 startFrame; // In mode 4, start of partial loop.
+ /* 0x10 */ f32 endFrame; // In mode 2, Update returns true when curFrame is equal to this. In mode 4, end of partial loop.
+ /* 0x14 */ f32 animLength; // Total number of frames in the current animation's file.
+ /* 0x18 */ f32 curFrame; // Current frame in the animation
+ /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate.
+ /* 0x20 */ Vec3s* jointTable; // Current translation of model and rotations of all limbs
+ /* 0x24 */ Vec3s* morphTable; // Table of values used to morph between animations
+ /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1]
+ /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph
+ /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph
+ /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton
+ /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace.
+ /* 0x36 */ s16 prevRot; // Previous rotation in worldspace.
+ /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation.
+ /* 0x3E */ Vec3s baseTransl; // Base modelspace translation.
+} SkelAnime; // size = 0x44
-typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ struct Actor* actor);
+
+typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
struct Actor* actor);
+typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ struct Actor* actor, Gfx** gfx);
+
typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
- struct Actor* actor);
+ struct Actor* actor, Gfx** gfx);
-typedef s32 (*OverrideLimbDraw2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- struct Actor* actor, Gfx** gfx);
+typedef s32 (*OverrideLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ struct Actor* actor);
-typedef void (*PostLimbDraw2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
- struct Actor* actor, Gfx** gfx);
-
-typedef s32 (*OverrideLimbDrawSV)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- struct Actor* actor);
-
-typedef void (*PostLimbDrawSV)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot,
- struct Actor* actor);
+typedef void (*PostLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot,
+ struct Actor* actor);
typedef void (*UnkActorDraw)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* actor);
-typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryType*);
+typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryData*);
extern u32 link_animetion_segment;
diff --git a/include/z64cutscene.h b/include/z64cutscene.h
index 3629aba74..51e60799e 100644
--- a/include/z64cutscene.h
+++ b/include/z64cutscene.h
@@ -29,7 +29,11 @@ typedef struct {
/* 0x00 */ u16 unk0; // action; // "dousa"
/* 0x02 */ u16 startFrame;
/* 0x04 */ u16 endFrame;
- /* 0x06 */ UNK_TYPE1 pad6[0x2A];
+ /* 0x06 */ UNK_TYPE1 pad6[0xA];
+ /* 0x10 */ s32 unk10;
+ /* 0x14 */ UNK_TYPE1 pad14[0x8];
+ /* 0x1C */ s32 unk1C;
+ /* 0x20 */ UNK_TYPE1 pad20[0x10];
} CsCmdActorAction; // size = 0x30
typedef struct {
diff --git a/include/z64effect.h b/include/z64effect.h
index f84ae9c9a..adb690732 100644
--- a/include/z64effect.h
+++ b/include/z64effect.h
@@ -274,16 +274,37 @@ typedef struct {
/* 0x8 */ s32 size;
} EffectSsInfo; // size = 0xC
+typedef struct {
+ /* 0x0 */ EffectSs* data_table; // Name from debug assert
+ /* 0x4 */ s32 searchIndex;
+ /* 0x8 */ s32 size;
+} EffectTableInfo; // size = 0xC
+
+typedef struct {
+ /* 0x0 */ UNK_TYPE4 unk0;
+ /* 0x4 */ EffectSsInitFunc init;
+} ParticleOverlayInfo; // size = 0x8
+
+typedef struct {
+ /* 0x00 */ u32 vromStart;
+ /* 0x04 */ u32 vromEnd;
+ /* 0x08 */ void* vramStart;
+ /* 0x0C */ void* vramEnd;
+ /* 0x10 */ void* loadedRamAddr;
+ /* 0x14 */ ParticleOverlayInfo* overlayInfo;
+ /* 0x18 */ u32 unk18; // Always 0x01000000?
+} ParticleOverlay; // size = 0x1C
+
typedef enum {
/* 0x00 */ EFFECT_SS_DUST,
/* 0x01 */ EFFECT_SS_KIRAKIRA,
- /* 0x02 */ EFFECT_SS_UNSET_02,
+ /* 0x02 */ EFFECT_SS_UNSET_02, // Deleted
/* 0x03 */ EFFECT_SS_BOMB2,
/* 0x04 */ EFFECT_SS_BLAST,
/* 0x05 */ EFFECT_SS_G_SPK,
/* 0x06 */ EFFECT_SS_D_FIRE,
/* 0x07 */ EFFECT_SS_BUBBLE,
- /* 0x08 */ EFFECT_SS_UNSET_08,
+ /* 0x08 */ EFFECT_SS_UNSET_08, // Deleted
/* 0x09 */ EFFECT_SS_G_RIPPLE,
/* 0x0A */ EFFECT_SS_G_SPLASH,
/* 0x0B */ EFFECT_SS_UNSET_0B,
@@ -293,8 +314,8 @@ typedef enum {
/* 0x0F */ EFFECT_SS_HAHEN,
/* 0x10 */ EFFECT_SS_STICK,
/* 0x11 */ EFFECT_SS_SIBUKI,
- /* 0x12 */ EFFECT_SS_UNSET_12,
- /* 0x13 */ EFFECT_SS_UNSET_13,
+ /* 0x12 */ EFFECT_SS_UNSET_12, // Deleted
+ /* 0x13 */ EFFECT_SS_UNSET_13, // Deleted
/* 0x14 */ EFFECT_SS_STONE1,
/* 0x15 */ EFFECT_SS_HITMARK,
/* 0x16 */ EFFECT_SS_FHG_FLASH,
@@ -306,11 +327,11 @@ typedef enum {
/* 0x1C */ EFFECT_SS_FIRE_TAIL,
/* 0x1D */ EFFECT_SS_EN_FIRE,
/* 0x1E */ EFFECT_SS_EXTRA,
- /* 0x1F */ EFFECT_SS_UNSET_1F,
+ /* 0x1F */ EFFECT_SS_UNSET_1F, // Deleted
/* 0x20 */ EFFECT_SS_DEAD_DB,
/* 0x21 */ EFFECT_SS_DEAD_DD,
/* 0x22 */ EFFECT_SS_DEAD_DS,
- /* 0x23 */ EFFECT_SS_UNSET_23,
+ /* 0x23 */ EFFECT_SS_UNSET_23, // Deleted
/* 0x24 */ EFFECT_SS_ICE_SMOKE,
/* 0x25 */ EFFECT_EN_ICE_BLOCK,
/* 0x26 */ EFFECT_SS_SBN,
diff --git a/include/z64item.h b/include/z64item.h
index 11c0201d6..434b565fb 100644
--- a/include/z64item.h
+++ b/include/z64item.h
@@ -34,6 +34,7 @@ typedef enum {
/* 0x16 */ ITEM_FAIRY,
/* 0x17 */ ITEM_DEKU_PRINCESS,
/* 0x1E */ ITEM_MUSHROOM = 0x1E,
+ /* 0x32 */ ITEM_MASK_DEKU = 0x32,
/* 0x38 */ ITEM_MASK_ALL_NIGHT = 0x38,
/* 0x3A */ ITEM_MASK_KEATON = 0x3A,
/* 0x3B */ ITEM_MASK_GARO,
@@ -43,7 +44,8 @@ typedef enum {
/* 0x4D */ ITEM_SWORD_KOKIRI = 0x4D,
/* 0x4E */ ITEM_SWORD_RAZOR,
/* 0x4F */ ITEM_SWORD_GILDED,
- /* 0x51 */ ITEM_SHIELD_HERO = 0x51,
+ /* 0x50 */ ITEM_SWORD_DEITY,
+ /* 0x51 */ ITEM_SHIELD_HERO,
/* 0x52 */ ITEM_SHIELD_MIRROR,
/* 0x56 */ ITEM_BOMB_BAG_20 = 0x56,
/* 0x57 */ ITEM_BOMB_BAG_30,
diff --git a/include/z64save.h b/include/z64save.h
index d701d0a42..a1ec72ab9 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -175,8 +175,9 @@ typedef struct {
/* 0x3F60 */ u8 unk_3F60; // "framescale_flag"
/* 0x3F64 */ f32 unk_3F64; // "framescale_scale"
/* 0x3F68 */ u32 unk_3F68[5][120];
- /* 0x48C8 */ u16 unk_48C8; // "scene_id_mix"
- /* 0x48CA */ u8 unk_48CA[27];
+ /* 0x48C8 */ u16 unk_48C8; // "scene_id_mix"
+ /* 0x48CA */ u8 maskMaskBit[3]; // masks given away on the Moon
+ /* 0x48CD */ char unk_48CD[24];
} SaveContext; // size = 0x48C8
typedef enum {
diff --git a/include/z64scene.h b/include/z64scene.h
index 5427d473b..333569974 100644
--- a/include/z64scene.h
+++ b/include/z64scene.h
@@ -215,8 +215,8 @@ typedef struct {
} SCmdMinimapChests;
typedef struct {
- /* 0x0 */ u32 opaqueDl;
- /* 0x4 */ u32 translucentDl;
+ /* 0x0 */ Gfx* opaqueDl;
+ /* 0x4 */ Gfx* translucentDl;
} RoomMeshType0Params; // size = 0x8
// Fields TODO
diff --git a/spec b/spec
index fd6d04663..bcdb24b47 100644
--- a/spec
+++ b/spec
@@ -25,7 +25,6 @@ beginseg
include "build/src/boot_O2_g3/CIC6105.o"
include "build/src/boot_O2_g3/syncprintf.o"
include "build/src/boot_O2_g3/fault.o"
- include "build/data/boot/fault.data.o"
include "build/data/boot/fault.bss.o"
include "build/src/boot_O2_g3/fault_drawer.o"
include "build/data/boot/fault_drawer.bss.o"
@@ -448,9 +447,8 @@ beginseg
include "build/data/code/z_effect_soft_sprite.data.o"
include "build/src/code/z_effect_soft_sprite_old_init.o"
include "build/data/code/z_effect_soft_sprite_old_init.data.o"
- include "build/data/code/flg_set_table.data.o"
include "build/src/code/flg_set.o"
- include "build/data/code/flg_set.data.o"
+ include "build/src/code/pad_801DC9C0.o"
include "build/src/code/z_DLF.o"
include "build/src/code/z_actor.o"
include "build/data/code/z_actor.data.o"
@@ -472,7 +470,6 @@ beginseg
include "build/src/code/z_common_data.o"
include "build/data/code/z_common_data.bss.o"
include "build/src/code/z_debug.o"
- include "build/data/code/z_debug.bss.o"
include "build/src/code/z_debug_display.o"
include "build/data/code/z_debug_display.data.o"
include "build/data/code/z_debug_display.bss.o"
@@ -493,12 +490,12 @@ beginseg
include "build/src/code/code_800F12D0.o"
include "build/src/code/z_eventmgr.o"
include "build/data/code/z_eventmgr.bss.o"
- include "build/src/code/code_800F23E0.o"
+ include "build/src/code/z_fcurve_data.o"
include "build/src/code/z_fcurve_data_skelanime.o"
include "build/data/code/code_801BD830.data.o"
include "build/src/code/z_fireobj.o"
include "build/data/code/z_fireobj.data.o"
- include "build/data/code/code_801BD910.data.o"
+ include "build/src/code/z_game_dlftbls.o"
include "build/src/code/z_horse.o"
include "build/data/code/z_horse.data.o"
include "build/src/code/z_jpeg.o"
@@ -523,14 +520,14 @@ beginseg
include "build/src/code/z_msgevent.o"
include "build/data/code/z_msgevent.data.o"
include "build/src/code/z_nmi_buff.o"
- include "build/data/code/z_nmi_buff.bss.o"
+ include "build/src/code/code_8010C1B0.o"
include "build/src/code/z_olib.o"
pad_text
include "build/src/code/z_parameter.o"
include "build/data/code/z_parameter.data.o"
include "build/data/code/z_parameter.bss.o"
include "build/src/code/z_path.o"
- include "build/src/code/code_80122660.o"
+ include "build/src/code/z_pause.o"
include "build/src/code/z_player_lib.o"
include "build/data/code/z_player_lib.data.o"
include "build/data/code/z_player_lib.bss.o"
@@ -581,7 +578,6 @@ beginseg
include "build/src/code/z_player_call.o"
include "build/data/code/z_player_call.bss.o"
include "build/src/code/z_shrink_window.o"
- include "build/data/code/z_shrink_window.bss.o"
include "build/src/code/db_camera.o"
include "build/data/code/db_camera.bss.o"
include "build/data/code/code_801D0B50.data.o"
@@ -679,7 +675,7 @@ beginseg
include "build/data/code/code_801A7B10.bss.o"
include "build/src/code/code_801AA020.o"
include "build/data/code/code_801AA020.bss.o"
- include "build/src/code/z_game_over.o"
+ include_readonly "build/src/code/z_game_over.o"
include "build/src/code/z_construct.o"
include "build/data/code/code_801D9090.data.o"
include "build/data/code/code_801E1180.rodata.o"
@@ -1203,8 +1199,11 @@ beginseg
name "ovl_En_Sw"
compress
include "build/src/overlays/actors/ovl_En_Sw/z_en_sw.o"
- include "build/data/ovl_En_Sw/ovl_En_Sw.data.o"
- include "build/data/ovl_En_Sw/ovl_En_Sw.reloc.o"
+ #ifdef NON_MATCHING
+ include "build/src/overlays/actors/ovl_En_Sw/ovl_En_Sw_reloc.o"
+ #else
+ include "build/data/ovl_En_Sw/ovl_En_Sw.reloc.o"
+ #endif
endseg
beginseg
@@ -1415,9 +1414,7 @@ beginseg
name "ovl_Arrow_Ice"
compress
include "build/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.o"
- include "build/data/ovl_Arrow_Ice/ovl_Arrow_Ice.data.o"
- include "build/data/ovl_Arrow_Ice/ovl_Arrow_Ice.bss.o"
- include "build/data/ovl_Arrow_Ice/ovl_Arrow_Ice.reloc.o"
+ include "build/src/overlays/actors/ovl_Arrow_Ice/ovl_Arrow_Ice_reloc.o"
endseg
beginseg
@@ -1685,8 +1682,7 @@ beginseg
name "ovl_En_Owl"
compress
include "build/src/overlays/actors/ovl_En_Owl/z_en_owl.o"
- include "build/data/ovl_En_Owl/ovl_En_Owl.data.o"
- include "build/data/ovl_En_Owl/ovl_En_Owl.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Owl/ovl_En_Owl_reloc.o"
endseg
beginseg
@@ -1723,8 +1719,7 @@ beginseg
name "ovl_En_Fu"
compress
include "build/src/overlays/actors/ovl_En_Fu/z_en_fu.o"
- include "build/data/ovl_En_Fu/ovl_En_Fu.data.o"
- include "build/data/ovl_En_Fu/ovl_En_Fu.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Fu/ovl_En_Fu_reloc.o"
endseg
beginseg
@@ -3594,8 +3589,7 @@ beginseg
name "ovl_En_Elfbub"
compress
include "build/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.o"
- include "build/data/ovl_En_Elfbub/ovl_En_Elfbub.data.o"
- include "build/data/ovl_En_Elfbub/ovl_En_Elfbub.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Elfbub/ovl_En_Elfbub_reloc.o"
endseg
beginseg
@@ -3893,8 +3887,7 @@ beginseg
name "ovl_En_Giant"
compress
include "build/src/overlays/actors/ovl_En_Giant/z_en_giant.o"
- include "build/data/ovl_En_Giant/ovl_En_Giant.data.o"
- include "build/data/ovl_En_Giant/ovl_En_Giant.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Giant/ovl_En_Giant_reloc.o"
endseg
beginseg
@@ -4075,8 +4068,7 @@ beginseg
name "ovl_En_Poh"
compress
include "build/src/overlays/actors/ovl_En_Poh/z_en_poh.o"
- include "build/data/ovl_En_Poh/ovl_En_Poh.data.o"
- include "build/data/ovl_En_Poh/ovl_En_Poh.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Poh/ovl_En_Poh_reloc.o"
endseg
beginseg
@@ -5010,8 +5002,7 @@ beginseg
name "ovl_En_Muto"
compress
include "build/src/overlays/actors/ovl_En_Muto/z_en_muto.o"
- include "build/data/ovl_En_Muto/ovl_En_Muto.data.o"
- include "build/data/ovl_En_Muto/ovl_En_Muto.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Muto/ovl_En_Muto_reloc.o"
endseg
beginseg
diff --git a/src/boot_O1/viextendvstart.c b/src/boot_O1/viextendvstart.c
new file mode 100644
index 000000000..ce9f718d0
--- /dev/null
+++ b/src/boot_O1/viextendvstart.c
@@ -0,0 +1,5 @@
+#include "global.h"
+
+void osViExtendVStart(u32 a0) {
+ __additional_scanline = a0;
+}
diff --git a/src/boot_O2/__osMalloc.c b/src/boot_O2/__osMalloc.c
index 40572a59f..503c7c25a 100644
--- a/src/boot_O2/__osMalloc.c
+++ b/src/boot_O2/__osMalloc.c
@@ -45,7 +45,7 @@ ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) {
return last;
}
-void __osMallocInit(Arena* arena, void* start, u32 size) {
+void __osMallocInit(Arena* arena, void* start, size_t size) {
bzero(arena, sizeof(*arena));
ArenaImpl_LockInit(arena);
__osMallocAddBlock(arena, start, size);
@@ -91,7 +91,7 @@ u8 __osMallocIsInitalized(Arena* arena) {
return arena->isInit;
}
-void* __osMalloc(Arena* arena, u32 size) {
+void* __osMalloc(Arena* arena, size_t size) {
ArenaNode* iter;
ArenaNode* newNode;
void* alloc;
@@ -134,7 +134,7 @@ void* __osMalloc(Arena* arena, u32 size) {
return alloc;
}
-void* __osMallocR(Arena* arena, u32 size) {
+void* __osMallocR(Arena* arena, size_t size) {
ArenaNode* iter;
ArenaNode* newNode;
u32 blockSize;
@@ -219,7 +219,7 @@ end:
#pragma GLOBAL_ASM("asm/non_matchings/boot/__osMalloc/__osRealloc.s")
-void __osAnalyzeArena(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
+void __osAnalyzeArena(Arena* arena, size_t* outMaxFree, size_t* outFree, size_t* outAlloc) {
ArenaNode* iter;
ArenaImpl_Lock(arena);
diff --git a/src/boot_O2/__osMemset.c b/src/boot_O2/__osMemset.c
index 3a5469855..0c4172e9f 100644
--- a/src/boot_O2/__osMemset.c
+++ b/src/boot_O2/__osMemset.c
@@ -1,6 +1,6 @@
#include "global.h"
-void* __osMemset(void* ptr, s32 val, u32 size) {
+void* __osMemset(void* ptr, s32 val, size_t size) {
u8* dst = ptr;
register s32 rem;
diff --git a/src/boot_O2/gfxprint.c b/src/boot_O2/gfxprint.c
index f65d88200..a6f84a7a4 100644
--- a/src/boot_O2/gfxprint.c
+++ b/src/boot_O2/gfxprint.c
@@ -171,15 +171,18 @@ Gfx* GfxPrint_Close(GfxPrint* this) {
return ret;
}
-void GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
- PrintUtils_VPrintf((PrintCallback*)&this->callback, fmt, args);
+s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
+ return PrintUtils_VPrintf((PrintCallback*)&this->callback, fmt, args);
}
-void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
+s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
+ s32 ret;
va_list args;
va_start(args, fmt);
- GfxPrint_VPrintf(this, fmt, args);
+ ret = GfxPrint_VPrintf(this, fmt, args);
va_end(args);
+
+ return ret;
}
diff --git a/src/boot_O2/loadfragment2.c b/src/boot_O2/loadfragment2.c
index b9ea4533d..5c884be96 100644
--- a/src/boot_O2/loadfragment2.c
+++ b/src/boot_O2/loadfragment2.c
@@ -71,7 +71,7 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayRelocationSection* overlayInfo
s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u32 allocatedVRamAddr) {
int nbytes;
u32 pad;
- u32 size;
+ size_t size;
void* end;
OverlayRelocationSection* overlayInfo;
@@ -106,9 +106,9 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
#pragma GLOBAL_ASM("asm/non_matchings/boot/loadfragment2/Load2_LoadOverlay.s")
#endif
-void* Load2_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd) {
+void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd) {
void* allocatedVRamAddr;
- u32 size;
+ size_t size;
size = vRamEnd - vRamStart;
allocatedVRamAddr = SystemArena_MallocR(size);
diff --git a/src/boot_O2/printutils.c b/src/boot_O2/printutils.c
index ca62b91b7..3fb8cf367 100644
--- a/src/boot_O2/printutils.c
+++ b/src/boot_O2/printutils.c
@@ -1,14 +1,17 @@
#include "global.h"
-void PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) {
- _Printf(*pfn, pfn, fmt, args);
+s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) {
+ return _Printf(*pfn, pfn, fmt, args);
}
-void PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) {
+s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) {
+ s32 ret;
va_list args;
va_start(args, fmt);
- PrintUtils_VPrintf(pfn, fmt, args);
+ ret = PrintUtils_VPrintf(pfn, fmt, args);
va_end(args);
+
+ return ret;
}
diff --git a/src/boot_O2/sleep.c b/src/boot_O2/sleep.c
index b794d08ca..01a85c5cc 100644
--- a/src/boot_O2/sleep.c
+++ b/src/boot_O2/sleep.c
@@ -1,11 +1,27 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sleep/Sleep_Cycles.s")
+void Sleep_Cycles(u64 time) {
+ OSMesgQueue mq;
+ OSMesg msg;
+ OSTimer timer;
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sleep/Sleep_Nsec.s")
+ osCreateMesgQueue(&mq, &msg, OS_MESG_BLOCK);
+ osSetTimer(&timer, time, 0, &mq, NULL);
+ osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sleep/Sleep_Usec.s")
+void Sleep_Nsec(u32 nsec) {
+ Sleep_Cycles(OS_NSEC_TO_CYCLES(nsec));
+}
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sleep/Sleep_Msec.s")
+void Sleep_Usec(u32 usec) {
+ Sleep_Cycles(OS_USEC_TO_CYCLES(usec));
+}
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sleep/Sleep_Sec.s")
+void Sleep_Msec(u32 ms) {
+ Sleep_Cycles((ms * OS_CPU_COUNTER) / 1000ULL);
+}
+
+void Sleep_Sec(u32 sec) {
+ Sleep_Cycles(sec * OS_CPU_COUNTER);
+}
diff --git a/src/boot_O2/system_malloc.c b/src/boot_O2/system_malloc.c
index 61906ce42..ad2bb6345 100644
--- a/src/boot_O2/system_malloc.c
+++ b/src/boot_O2/system_malloc.c
@@ -2,15 +2,15 @@
Arena gSystemArena;
-void* SystemArena_Malloc(u32 size) {
+void* SystemArena_Malloc(size_t size) {
return __osMalloc(&gSystemArena, size);
}
-void* SystemArena_MallocR(u32 size) {
+void* SystemArena_MallocR(size_t size) {
return __osMallocR(&gSystemArena, size);
}
-void* SystemArena_Realloc(void* oldPtr, u32 newSize) {
+void* SystemArena_Realloc(void* oldPtr, size_t newSize) {
return __osRealloc(&gSystemArena, oldPtr, newSize);
}
@@ -18,9 +18,9 @@ void SystemArena_Free(void* ptr) {
__osFree(&gSystemArena, ptr);
}
-void* SystemArena_Calloc(u32 elements, u32 size) {
+void* SystemArena_Calloc(u32 elements, size_t size) {
void* ptr;
- u32 totalSize = elements * size;
+ size_t totalSize = elements * size;
ptr = __osMalloc(&gSystemArena, totalSize);
if (ptr != NULL) {
@@ -29,7 +29,7 @@ void* SystemArena_Calloc(u32 elements, u32 size) {
return ptr;
}
-void SystemArena_AnalyzeArena(u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocated) {
+void SystemArena_AnalyzeArena(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated) {
__osAnalyzeArena(&gSystemArena, maxFreeBlock, bytesFree, bytesAllocated);
}
@@ -37,7 +37,7 @@ u32 SystemArena_CheckArena(void) {
return __osCheckArena(&gSystemArena);
}
-void SystemArena_InitArena(void* start, u32 size) {
+void SystemArena_InitArena(void* start, size_t size) {
__osMallocInit(&gSystemArena, start, size);
}
diff --git a/src/boot_O2_g3/boot_main.c b/src/boot_O2_g3/boot_main.c
index 04bb9a33a..ec6b446e7 100644
--- a/src/boot_O2_g3/boot_main.c
+++ b/src/boot_O2_g3/boot_main.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "prevent_bss_reordering.h"
StackEntry sBootThreadInfo;
OSThread sIdleThread;
diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c
index 3cc3deb35..1851d21cb 100644
--- a/src/boot_O2_g3/fault.c
+++ b/src/boot_O2_g3/fault.c
@@ -1,7 +1,32 @@
+#include "ultra64.h"
#include "global.h"
#include "vt.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/fault/D_800982B0.s")
+// data
+const char* sCpuExceptions[] = {
+ "Interrupt",
+ "TLB modification",
+ "TLB exception on load",
+ "TLB exception on store",
+ "Address error on load",
+ "Address error on store",
+ "Bus error on inst.",
+ "Bus error on data",
+ "System call exception",
+ "Breakpoint exception",
+ "Reserved instruction",
+ "Coprocessor unusable",
+ "Arithmetic overflow",
+ "Trap exception",
+ "Virtual coherency on inst.",
+ "Floating point exception",
+ "Watchpoint exception",
+ "Virtual coherency on data",
+};
+
+const char* sFpuExceptions[] = {
+ "Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation",
+};
void Fault_SleepImpl(u32 duration) {
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
@@ -79,7 +104,7 @@ void Fault_RemoveClient(FaultClient* client) {
}
}
-void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param) {
+void Fault_AddAddrConvClient(FaultAddrConvClient* client, FaultAddrConvFunc callback, void* param) {
OSIntMask mask;
u32 alreadyExists = 0;
@@ -269,9 +294,9 @@ void Fault_PrintFPCR(u32 value) {
u32 flag = 0x20000;
FaultDrawer_Printf("FPCSR:%08xH ", value);
- for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
+ for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) {
if (value & flag) {
- FaultDrawer_Printf("(%s)", sExceptionNames[i]);
+ FaultDrawer_Printf("(%s)", sFpuExceptions[i]);
break;
}
flag >>= 1;
@@ -284,9 +309,9 @@ void osSyncPrintfFPCR(u32 value) {
u32 flag = 0x20000;
osSyncPrintf("FPCSR:%08xH ", value);
- for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
+ for (i = 0; i < ARRAY_COUNT(sFpuExceptions); i++) {
if (value & flag) {
- osSyncPrintf("(%s)\n", sExceptionNames[i]);
+ osSyncPrintf("(%s)\n", sFpuExceptions[i]);
break;
}
flag >>= 1;
@@ -308,7 +333,7 @@ void Fault_PrintThreadContext(OSThread* t) {
FaultDrawer_SetCursor(0x16, 0x14);
ctx = &t->context;
- FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
+ FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]);
FaultDrawer_SetCharPad(-1, 0);
FaultDrawer_Printf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
@@ -368,7 +393,7 @@ void osSyncPrintfThreadContext(OSThread* t) {
ctx = &t->context;
osSyncPrintf("\n");
- osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, D_80096B80[causeStrIdx]);
+ osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, sCpuExceptions[causeStrIdx]);
osSyncPrintf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
osSyncPrintf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
@@ -444,7 +469,7 @@ void Fault_WaitForButtonCombo(void) {
} while (!CHECK_BTN_ALL(input->cur.button, BTN_DLEFT | BTN_L | BTN_R | BTN_CRIGHT));
}
-void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) {
+void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
u32* alignedAddr;
u32* writeAddr;
s32 y;
@@ -741,9 +766,9 @@ void Fault_SetOptionsFromController3(void) {
}
if (faultCustomOptions) {
- graphPC = graphOSThread.context.pc;
- graphRA = graphOSThread.context.ra;
- graphSP = graphOSThread.context.sp;
+ graphPC = sGraphThread.context.pc;
+ graphRA = sGraphThread.context.ra;
+ graphSP = sGraphThread.context.sp;
if (CHECK_BTN_ALL(input3->press.button, BTN_R)) {
faultCopyToLog = !faultCopyToLog;
FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog);
diff --git a/src/boot_O2_g3/fault_drawer.c b/src/boot_O2_g3/fault_drawer.c
index 74a3b7e5e..949faadf1 100644
--- a/src/boot_O2_g3/fault_drawer.c
+++ b/src/boot_O2_g3/fault_drawer.c
@@ -1,6 +1,8 @@
#include "global.h"
#include "vt.h"
+extern const u32 sFaultDrawerFont[];
+
FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct;
FaultDrawer sFaultDrawerDefault = {
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
@@ -14,7 +16,7 @@ FaultDrawer sFaultDrawerDefault = {
GPACK_RGBA5551(0, 0, 0, 0), // backColor
22, // cursorX
16, // cursorY
- (u32*)&sFaultDrawerFont, // font
+ (u32*)sFaultDrawerFont, // font
8, // charW
8, // charH
0, // charWPad
@@ -142,7 +144,7 @@ void FaultDrawer_FillScreen() {
#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.s")
-#pragma GLOBAL_ASM("asm/non_matchings/boot/fault_drawer/D_80099080.s")
+const char D_80099080[] = "(null)";
void FaultDrawer_VPrintf(const char* str, char* args) { // va_list
_Printf((PrintCallback)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args);
@@ -173,7 +175,7 @@ void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) {
sFaultDrawContext->h = h;
}
-void FaultDrawer_SetInputCallback(void (*callback)()) {
+void FaultDrawer_SetInputCallback(void* callback) {
sFaultDrawContext->inputCallback = callback;
}
diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c
index bb39f53da..4be8a1094 100644
--- a/src/boot_O2_g3/idle.c
+++ b/src/boot_O2_g3/idle.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "prevent_bss_reordering.h"
u8 D_80096B20 = 1;
vu8 gViConfigUseDefault = 1;
diff --git a/src/boot_O2_g3/yaz0.c b/src/boot_O2_g3/yaz0.c
index bf42adf3f..094c0bb38 100644
--- a/src/boot_O2_g3/yaz0.c
+++ b/src/boot_O2_g3/yaz0.c
@@ -122,7 +122,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) {
return 0;
}
-void Yaz0_Decompress(u32 romStart, void* dst, u32 size) {
+void Yaz0_Decompress(u32 romStart, void* dst, size_t size) {
s32 status;
u32 pad;
char sp80[0x50];
diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c
index 3a447b0e8..2903b488f 100644
--- a/src/boot_O2_g3/z_std_dma.c
+++ b/src/boot_O2_g3/z_std_dma.c
@@ -9,7 +9,7 @@ OSMesg sDmaMgrMsgs[32];
OSThread sDmaMgrThread;
u8 sDmaMgrStack[0x500];
-s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) {
+s32 DmaMgr_DMARomToRam(u32 rom, void* ram, size_t size) {
OSIoMesg ioMsg;
OSMesgQueue queue;
OSMesg msg[1];
@@ -111,7 +111,7 @@ const char* func_800809F4(u32 a0) {
void DmaMgr_ProcessMsg(DmaRequest* req) {
u32 vrom;
void* ram;
- u32 size;
+ size_t size;
u32 romStart;
u32 romSize;
DmaEntry* dmaEntry;
@@ -172,7 +172,7 @@ void DmaMgr_ThreadEntry(void* a0) {
}
}
-s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused,
+s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, size_t size, UNK_TYPE4 unused,
OSMesgQueue* queue, OSMesg msg) {
if (gIrqMgrResetStatus >= 2) {
return -2;
@@ -190,7 +190,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart,
return 0;
}
-s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) {
+s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, size_t size) {
DmaRequest req;
OSMesgQueue queue;
OSMesg msg[1];
diff --git a/src/code/PreRender.c b/src/code/PreRender.c
index bdf4d326c..0afb1df68 100644
--- a/src/code/PreRender.c
+++ b/src/code/PreRender.c
@@ -17,7 +17,7 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf,
void PreRender_Init(PreRender* this) {
bzero(this, sizeof(PreRender));
- func_80174AA0(&this->alloc);
+ ListAlloc_Init(&this->alloc);
}
/**
@@ -35,7 +35,7 @@ void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, voi
}
void PreRender_Destroy(PreRender* this) {
- func_80174BA0(&this->alloc);
+ ListAlloc_FreeAll(&this->alloc);
}
void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4) {
diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c
index b4262e3c6..83d5be3d1 100644
--- a/src/code/TwoHeadArena.c
+++ b/src/code/TwoHeadArena.c
@@ -12,7 +12,7 @@ void* THA_GetTail(TwoHeadArena* tha) {
return tha->tail;
}
-void* THA_AllocStart(TwoHeadArena* tha, u32 size) {
+void* THA_AllocStart(TwoHeadArena* tha, size_t size) {
void* start = tha->head;
tha->head = (u32)tha->head + size;
@@ -23,7 +23,7 @@ void* THA_AllocStart1(TwoHeadArena* tha) {
return THA_AllocStart(tha, 1);
}
-void* THA_AllocEnd(TwoHeadArena* tha, u32 size) {
+void* THA_AllocEnd(TwoHeadArena* tha, size_t size) {
u32 mask;
if (size >= 0x10) {
@@ -42,14 +42,14 @@ void* THA_AllocEnd(TwoHeadArena* tha, u32 size) {
return tha->tail;
}
-void* THA_AllocEndAlign16(TwoHeadArena* tha, u32 size) {
+void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size) {
u32 mask = ~0xF;
tha->tail = (((u32)tha->tail & mask) - size) & mask;
return tha->tail;
}
-void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask) {
+void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask) {
tha->tail = (((u32)tha->tail & mask) - size) & mask;
return tha->tail;
}
@@ -67,7 +67,7 @@ void THA_Init(TwoHeadArena* tha) {
tha->tail = (u32)tha->bufp + tha->size;
}
-void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size) {
+void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size) {
bzero(tha, sizeof(TwoHeadArena));
tha->bufp = ptr;
tha->size = size;
diff --git a/src/code/TwoHeadGfxArena.c b/src/code/TwoHeadGfxArena.c
index 81a3a383b..2f1629765 100644
--- a/src/code/TwoHeadGfxArena.c
+++ b/src/code/TwoHeadGfxArena.c
@@ -1,6 +1,6 @@
#include "global.h"
-void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size) {
+void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size) {
THA_Ct((TwoHeadArena*)thga, start, size);
}
@@ -44,7 +44,7 @@ Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) {
return THGA_AllocStart8(thga);
}
-Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size) {
+Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size) {
return THA_AllocEnd((TwoHeadArena*)thga, size);
}
diff --git a/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c
index ca2e9e841..754b8759d 100644
--- a/src/code/code_800E8EA0.c
+++ b/src/code/code_800E8EA0.c
@@ -54,7 +54,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
}
s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 sVar3;
Vec3f local_14;
s16 sVar3A;
@@ -83,7 +83,7 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s*
}
s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 sVar3;
Vec3f local_14;
s16 sVar3A;
diff --git a/src/code/code_800F23E0.c b/src/code/code_800F23E0.c
deleted file mode 100644
index 008a95db3..000000000
--- a/src/code/code_800F23E0.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "global.h"
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F23E0/func_800F23E0.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F23E0/func_800F2478.s")
diff --git a/src/code/code_8010C1B0.c b/src/code/code_8010C1B0.c
new file mode 100644
index 000000000..12e0eadb4
--- /dev/null
+++ b/src/code/code_8010C1B0.c
@@ -0,0 +1,20 @@
+#include "global.h"
+
+// Blocks the current thread until all currently queued scheduler tasks have been completed
+void func_8010C1B0(void) {
+ OSScTask task;
+ OSMesgQueue queue;
+ OSMesg msg;
+
+ task.next = NULL;
+ task.flags = OS_SC_RCP_MASK;
+ task.msgQ = &queue;
+ task.msg = NULL;
+ task.framebuffer = NULL;
+ task.list.t.type = M_NULTASK;
+
+ osCreateMesgQueue(task.msgQ, &msg, 1);
+ osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
+ Sched_SendEntryMsg(&gSchedContext);
+ osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
+}
diff --git a/src/code/code_80122660.c b/src/code/code_80122660.c
deleted file mode 100644
index 7c0da2932..000000000
--- a/src/code/code_80122660.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "global.h"
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80122660/func_80122660.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80122660/func_80122670.s")
diff --git a/src/code/flg_set.c b/src/code/flg_set.c
index b46433a70..780884c85 100644
--- a/src/code/flg_set.c
+++ b/src/code/flg_set.c
@@ -1,9 +1,314 @@
+/**
+ * File: flg_set.c
+ * Description: Event Editor, used to view and edit weekEventReg, eventInf and maskMaskBit flags.
+ * Controls:
+ * + Left and Right: select different flags/bits in array element
+ * + Up and Down: select array element (byte) 1 up/down
+ * C Up and Down: select array element (byte) 10 up/down
+ * A: toggle flag
+ * B: exit
+ * Hold Start and press B: clear all weekEventReg and eventInf flags
+ */
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/func_800B32D0.s")
+static FlagSetEntry sFlagEntries[] = {
+ { &gSaveContext.weekEventReg[0], "week_event_reg[0]" },
+ { &gSaveContext.weekEventReg[1], "week_event_reg[1]" },
+ { &gSaveContext.weekEventReg[2], "week_event_reg[2]" },
+ { &gSaveContext.weekEventReg[3], "week_event_reg[3]" },
+ { &gSaveContext.weekEventReg[4], "week_event_reg[4]" },
+ { &gSaveContext.weekEventReg[5], "week_event_reg[5]" },
+ { &gSaveContext.weekEventReg[6], "week_event_reg[6]" },
+ { &gSaveContext.weekEventReg[7], "week_event_reg[7]" },
+ { &gSaveContext.weekEventReg[8], "week_event_reg[8]" },
+ { &gSaveContext.weekEventReg[9], "week_event_reg[9]" },
+ { &gSaveContext.weekEventReg[10], "week_event_reg[10]" },
+ { &gSaveContext.weekEventReg[11], "week_event_reg[11]" },
+ { &gSaveContext.weekEventReg[12], "week_event_reg[12]" },
+ { &gSaveContext.weekEventReg[13], "week_event_reg[13]" },
+ { &gSaveContext.weekEventReg[14], "week_event_reg[14]" },
+ { &gSaveContext.weekEventReg[15], "week_event_reg[15]" },
+ { &gSaveContext.weekEventReg[16], "week_event_reg[16]" },
+ { &gSaveContext.weekEventReg[17], "week_event_reg[17]" },
+ { &gSaveContext.weekEventReg[18], "week_event_reg[18]" },
+ { &gSaveContext.weekEventReg[19], "week_event_reg[19]" },
+ { &gSaveContext.weekEventReg[20], "week_event_reg[20]" },
+ { &gSaveContext.weekEventReg[21], "week_event_reg[21]" },
+ { &gSaveContext.weekEventReg[22], "week_event_reg[22]" },
+ { &gSaveContext.weekEventReg[23], "week_event_reg[23]" },
+ { &gSaveContext.weekEventReg[24], "week_event_reg[24]" },
+ { &gSaveContext.weekEventReg[25], "week_event_reg[25]" },
+ { &gSaveContext.weekEventReg[26], "week_event_reg[26]" },
+ { &gSaveContext.weekEventReg[27], "week_event_reg[27]" },
+ { &gSaveContext.weekEventReg[28], "week_event_reg[28]" },
+ { &gSaveContext.weekEventReg[29], "week_event_reg[29]" },
+ { &gSaveContext.weekEventReg[30], "week_event_reg[30]" },
+ { &gSaveContext.weekEventReg[31], "week_event_reg[31]" },
+ { &gSaveContext.weekEventReg[32], "week_event_reg[32]" },
+ { &gSaveContext.weekEventReg[33], "week_event_reg[33]" },
+ { &gSaveContext.weekEventReg[34], "week_event_reg[34]" },
+ { &gSaveContext.weekEventReg[35], "week_event_reg[35]" },
+ { &gSaveContext.weekEventReg[36], "week_event_reg[36]" },
+ { &gSaveContext.weekEventReg[37], "week_event_reg[37]" },
+ { &gSaveContext.weekEventReg[38], "week_event_reg[38]" },
+ { &gSaveContext.weekEventReg[39], "week_event_reg[39]" },
+ { &gSaveContext.weekEventReg[40], "week_event_reg[40]" },
+ { &gSaveContext.weekEventReg[41], "week_event_reg[41]" },
+ { &gSaveContext.weekEventReg[42], "week_event_reg[42]" },
+ { &gSaveContext.weekEventReg[43], "week_event_reg[43]" },
+ { &gSaveContext.weekEventReg[44], "week_event_reg[44]" },
+ { &gSaveContext.weekEventReg[45], "week_event_reg[45]" },
+ { &gSaveContext.weekEventReg[46], "week_event_reg[46]" },
+ { &gSaveContext.weekEventReg[47], "week_event_reg[47]" },
+ { &gSaveContext.weekEventReg[48], "week_event_reg[48]" },
+ { &gSaveContext.weekEventReg[49], "week_event_reg[49]" },
+ { &gSaveContext.weekEventReg[50], "week_event_reg[50]" },
+ { &gSaveContext.weekEventReg[51], "week_event_reg[51]" },
+ { &gSaveContext.weekEventReg[52], "week_event_reg[52]" },
+ { &gSaveContext.weekEventReg[53], "week_event_reg[53]" },
+ { &gSaveContext.weekEventReg[54], "week_event_reg[54]" },
+ { &gSaveContext.weekEventReg[55], "week_event_reg[55]" },
+ { &gSaveContext.weekEventReg[56], "week_event_reg[56]" },
+ { &gSaveContext.weekEventReg[57], "week_event_reg[57]" },
+ { &gSaveContext.weekEventReg[58], "week_event_reg[58]" },
+ { &gSaveContext.weekEventReg[59], "week_event_reg[59]" },
+ { &gSaveContext.weekEventReg[60], "week_event_reg[60]" },
+ { &gSaveContext.weekEventReg[61], "week_event_reg[61]" },
+ { &gSaveContext.weekEventReg[62], "week_event_reg[62]" },
+ { &gSaveContext.weekEventReg[63], "week_event_reg[63]" },
+ { &gSaveContext.weekEventReg[64], "week_event_reg[64]" },
+ { &gSaveContext.weekEventReg[65], "week_event_reg[65]" },
+ { &gSaveContext.weekEventReg[66], "week_event_reg[66]" },
+ { &gSaveContext.weekEventReg[67], "week_event_reg[67]" },
+ { &gSaveContext.weekEventReg[68], "week_event_reg[68]" },
+ { &gSaveContext.weekEventReg[69], "week_event_reg[69]" },
+ { &gSaveContext.weekEventReg[70], "week_event_reg[70]" },
+ { &gSaveContext.weekEventReg[71], "week_event_reg[71]" },
+ { &gSaveContext.weekEventReg[72], "week_event_reg[72]" },
+ { &gSaveContext.weekEventReg[73], "week_event_reg[73]" },
+ { &gSaveContext.weekEventReg[74], "week_event_reg[74]" },
+ { &gSaveContext.weekEventReg[75], "week_event_reg[75]" },
+ { &gSaveContext.weekEventReg[76], "week_event_reg[76]" },
+ { &gSaveContext.weekEventReg[77], "week_event_reg[77]" },
+ { &gSaveContext.weekEventReg[78], "week_event_reg[78]" },
+ { &gSaveContext.weekEventReg[79], "week_event_reg[79]" },
+ { &gSaveContext.weekEventReg[80], "week_event_reg[80]" },
+ { &gSaveContext.weekEventReg[81], "week_event_reg[81]" },
+ { &gSaveContext.weekEventReg[82], "week_event_reg[82]" },
+ { &gSaveContext.weekEventReg[83], "week_event_reg[83]" },
+ { &gSaveContext.weekEventReg[84], "week_event_reg[84]" },
+ { &gSaveContext.weekEventReg[85], "week_event_reg[85]" },
+ { &gSaveContext.weekEventReg[86], "week_event_reg[86]" },
+ { &gSaveContext.weekEventReg[87], "week_event_reg[87]" },
+ { &gSaveContext.weekEventReg[88], "week_event_reg[88]" },
+ { &gSaveContext.weekEventReg[89], "week_event_reg[89]" },
+ { &gSaveContext.weekEventReg[90], "week_event_reg[90]" },
+ { &gSaveContext.weekEventReg[91], "week_event_reg[91]" },
+ { &gSaveContext.weekEventReg[92], "week_event_reg[92]" },
+ { &gSaveContext.weekEventReg[93], "week_event_reg[93]" },
+ { &gSaveContext.weekEventReg[94], "week_event_reg[94]" },
+ { &gSaveContext.weekEventReg[95], "week_event_reg[95]" },
+ { &gSaveContext.weekEventReg[96], "week_event_reg[96]" },
+ { &gSaveContext.weekEventReg[97], "week_event_reg[97]" },
+ { &gSaveContext.weekEventReg[98], "week_event_reg[98]" },
+ { &gSaveContext.weekEventReg[99], "week_event_reg[99]" },
-#pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/D_801DC120.s")
+ { &gSaveContext.eventInf[0], "event_inf[0]" },
+ { &gSaveContext.eventInf[1], "event_inf[1]" },
+ { &gSaveContext.eventInf[2], "event_inf[2]" },
+ { &gSaveContext.eventInf[3], "event_inf[3]" },
+ { &gSaveContext.eventInf[4], "event_inf[4]" },
+ { &gSaveContext.eventInf[5], "event_inf[5]" },
+ { &gSaveContext.eventInf[6], "event_inf[6]" },
+ { &gSaveContext.eventInf[7], "event_inf[7]" },
-#pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/func_800B3644.s")
+ { &gSaveContext.maskMaskBit[0], "mask_mask_bit[0]" },
+ { &gSaveContext.maskMaskBit[1], "mask_mask_bit[1]" },
+ { &gSaveContext.maskMaskBit[2], "mask_mask_bit[2]" },
-#pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/D_801DC9B8.s")
+ { NULL, NULL }, // used in the code to detect array end
+};
+
+static s32 sEntryIndex = 0;
+static u32 sCurrentBit = 0;
+static s32 sTimer = 0;
+
+void FlagSet_Update(GameState* gameState) {
+ GlobalContext* globalCtx = (GlobalContext*)gameState;
+ Input* input = CONTROLLER1(globalCtx);
+
+ /* Intra-byte navigation */
+
+ if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
+ sCurrentBit++;
+ sTimer = 10;
+ }
+
+ if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
+ sCurrentBit--;
+ sTimer = 10;
+ }
+
+ if (sTimer == 0) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
+ sCurrentBit++;
+ sTimer = 2;
+ }
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
+ sCurrentBit--;
+ sTimer = 2;
+ }
+ }
+
+ // Wrap cursor position at beginning/end of line
+ sCurrentBit %= 8;
+
+ /* Navigation between bytes */
+
+ // + Up/Down scroll 1 at a time
+ if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
+ sEntryIndex--;
+ if (sEntryIndex < 0) {
+ sEntryIndex = 0;
+ }
+ sTimer = 10;
+ }
+
+ if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
+ sEntryIndex++;
+ if (sFlagEntries[sEntryIndex].value == NULL) { // End of array
+ sEntryIndex--;
+ }
+ sTimer = 10;
+ }
+
+ // C Up/Down scroll 10 at a time
+ if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
+ sEntryIndex -= 10;
+ if (sEntryIndex < 0) {
+ sEntryIndex = 0;
+ }
+ sTimer = 10;
+ }
+
+ if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
+ sEntryIndex += 10;
+ if (sEntryIndex > 100) {
+ sEntryIndex = 100;
+ }
+ sTimer = 10;
+ }
+
+ if (sTimer == 0) {
+ if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
+ sEntryIndex--;
+ if (sEntryIndex < 0) {
+ sEntryIndex = 0;
+ }
+ sTimer = 2;
+
+ } else if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
+ sEntryIndex++;
+ if (sFlagEntries[sEntryIndex].value == NULL) { // End of array
+ sEntryIndex--;
+ }
+ sTimer = 2;
+
+ } else if (CHECK_BTN_ALL(input->cur.button, BTN_CUP)) {
+ sEntryIndex -= 10;
+ if (sEntryIndex < 0) {
+ sEntryIndex = 0;
+ }
+ sTimer = 2;
+
+ } else if (CHECK_BTN_ALL(input->cur.button, BTN_CDOWN)) {
+ sEntryIndex += 10;
+ if (sEntryIndex > 100) {
+ sEntryIndex = 100;
+ }
+ sTimer = 2;
+ }
+ }
+
+ /* Other controls */
+
+ // A toggles the selected flag
+ if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
+ *sFlagEntries[sEntryIndex].value ^= (1 << sCurrentBit);
+ }
+
+ if (sTimer != 0) {
+ sTimer--;
+ }
+
+ // Hold Start and press B will reset the first two flag arrays
+ if (CHECK_BTN_ALL(input->cur.button, BTN_START)) {
+ if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
+ s16 i;
+ for (i = 0; i < ARRAY_COUNT(gSaveContext.weekEventReg); i++) {
+ gSaveContext.weekEventReg[i] = 0;
+ }
+ for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) {
+ gSaveContext.eventInf[i] = 0;
+ }
+ }
+
+ // Pressing B will exit
+ } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
+ globalCtx->pauseCtx.debugState = 0;
+ }
+}
+
+extern s32 D_801ED890;
+
+void FlagSet_Draw(GameState* gameState) {
+ GraphicsContext* gfxCtx = gameState->gfxCtx;
+ Gfx* gfx;
+ Gfx* polyOpa;
+
+ OPEN_DISPS(gfxCtx);
+ GfxPrint printer;
+ s32 pad;
+
+ polyOpa = POLY_OPA_DISP;
+ gfx = Graph_GfxPlusOne(polyOpa);
+ gSPDisplayList(OVERLAY_DISP++, gfx);
+
+ GfxPrint_Init(&printer);
+ GfxPrint_Open(&printer, gfx);
+ GfxPrint_SetColor(&printer, 250, 50, 50, 255);
+ GfxPrint_SetPos(&printer, 8, 13);
+ GfxPrint_Printf(&printer, sFlagEntries[sEntryIndex].name);
+ GfxPrint_SetPos(&printer, 12, 15);
+
+ // Print the flag bits in the current byte, largest to smallest
+ for (D_801ED890 = 7; D_801ED890 >= 0; D_801ED890--) {
+ // Highlight current flag bit in white, rest in grey
+ if ((u32)D_801ED890 == sCurrentBit) {
+ GfxPrint_SetColor(&printer, 200, 200, 200, 255);
+ } else {
+ GfxPrint_SetColor(&printer, 100, 100, 100, 255);
+ }
+
+ // Display 1 if flag set and 0 if not
+ if (*sFlagEntries[sEntryIndex].value & (1 << D_801ED890)) {
+ GfxPrint_Printf(&printer, "1");
+ } else {
+ GfxPrint_Printf(&printer, "0");
+ }
+
+ // Add a space after each group of 4
+ if ((D_801ED890 % 4) == 0) {
+ GfxPrint_Printf(&printer, " ");
+ }
+ }
+
+ gfx = GfxPrint_Close(&printer);
+ GfxPrint_Destroy(&printer);
+
+ gSPEndDisplayList(gfx++);
+ Graph_BranchDlist(polyOpa, gfx);
+ POLY_OPA_DISP = gfx;
+
+ CLOSE_DISPS(gfxCtx);
+}
diff --git a/src/code/game.c b/src/code/game.c
index 4fe094497..a90fc7ac2 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -22,7 +22,7 @@ void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) {
}
void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
- Gfx* _gfx = *gfx;
+ Gfx* dlist = *gfx;
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
D_801F8010.type = R_FB_FILTER_TYPE;
@@ -30,7 +30,7 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
D_801F8010.color.g = R_FB_FILTER_PRIM_COLOR(1);
D_801F8010.color.b = R_FB_FILTER_PRIM_COLOR(2);
D_801F8010.color.a = R_FB_FILTER_A;
- func_80140D10(&D_801F8010, &_gfx, arg1);
+ func_80140D10(&D_801F8010, &dlist, arg1);
} else {
if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
D_801F8020.useRgba = (R_FB_FILTER_TYPE == 6);
@@ -42,7 +42,7 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
D_801F8020.envColor.g = R_FB_FILTER_ENV_COLOR(1);
D_801F8020.envColor.b = R_FB_FILTER_ENV_COLOR(2);
D_801F8020.envColor.a = R_FB_FILTER_A;
- func_80142100(&D_801F8020, &_gfx, arg1);
+ func_80142100(&D_801F8020, &dlist, arg1);
} else {
if (R_FB_FILTER_TYPE == 7) {
sMonoColors.unk_00 = 0;
@@ -54,28 +54,25 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
sMonoColors.envColor.a = R_FB_FILTER_A;
- VisMono_Draw(&sMonoColors, &_gfx, arg1);
+ VisMono_Draw(&sMonoColors, &dlist, arg1);
}
}
}
- *gfx = _gfx;
+ *gfx = dlist;
}
-void Game_Nop80173534(GameState* gamestate) {
- ;
+void Game_Nop80173534(GameState* gameState) {
}
-void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx) {
+void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
Gfx* nextDisplayList;
- Gfx* _polyOpa;
- // Unused vars impact regalloc
- Gfx* temp_t2;
- u32 temp_v1;
+ Gfx* polyOpa;
- _polyOpa = gfxCtx->polyOpa.p;
- nextDisplayList = Graph_GfxPlusOne(gfxCtx->polyOpa.p);
- gSPDisplayList(gfxCtx->overlay.p++, nextDisplayList);
+ OPEN_DISPS(gfxCtx);
+
+ nextDisplayList = Graph_GfxPlusOne(polyOpa = POLY_OPA_DISP);
+ gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
GameState_SetFBFilter(&nextDisplayList, (u32)gfxCtx->zbuffer);
@@ -86,141 +83,154 @@ void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx) {
}
gSPEndDisplayList(nextDisplayList++);
- Graph_BranchDlist(_polyOpa, nextDisplayList);
- gfxCtx->polyOpa.p = nextDisplayList;
+ Graph_BranchDlist(polyOpa, nextDisplayList);
+ POLY_OPA_DISP = nextDisplayList;
-lblUnk:; // Label prevents reordering, if(1) around the above block don't seem to help unlike in OoT
- func_800E9F78(gfxCtx);
+ // Block prevents reordering, if(1) around the above block don't seem to help unlike in OoT
+ {
+ s32 requiredScopeTemp;
+
+ func_800E9F78(gfxCtx);
+ }
if (R_ENABLE_ARENA_DBG != 0) {
SpeedMeter_DrawTimeEntries(&D_801F7FF0, gfxCtx);
- SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, gamestate);
+ SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, gameState);
}
+
+ CLOSE_DISPS(gfxCtx);
}
-void Game_ResetSegments(GraphicsContext* gfxCtx) {
- gSPSegment(gfxCtx->polyOpa.p++, 0, 0);
- gSPSegment(gfxCtx->polyOpa.p++, 0xF, gfxCtx->framebuffer);
- gSPSegment(gfxCtx->polyXlu.p++, 0, 0);
- gSPSegment(gfxCtx->polyXlu.p++, 0xF, gfxCtx->framebuffer);
- gSPSegment(gfxCtx->overlay.p++, 0, 0);
- gSPSegment(gfxCtx->overlay.p++, 0xF, gfxCtx->framebuffer);
+void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) {
+ OPEN_DISPS(gfxCtx);
+
+ gSPSegment(POLY_OPA_DISP++, 0, NULL);
+ gSPSegment(POLY_OPA_DISP++, 0xF, gfxCtx->framebuffer);
+ gSPSegment(POLY_XLU_DISP++, 0, NULL);
+ gSPSegment(POLY_XLU_DISP++, 0xF, gfxCtx->framebuffer);
+ gSPSegment(OVERLAY_DISP++, 0, NULL);
+ gSPSegment(OVERLAY_DISP++, 0xF, gfxCtx->framebuffer);
+
+ CLOSE_DISPS(gfxCtx);
}
void func_801736DC(GraphicsContext* gfxCtx) {
Gfx* nextDisplayList;
- Gfx* _polyOpa;
+ Gfx* polyOpa;
- nextDisplayList = Graph_GfxPlusOne(_polyOpa = gfxCtx->polyOpa.p);
- gSPDisplayList(gfxCtx->overlay.p++, nextDisplayList);
+ OPEN_DISPS(gfxCtx);
+
+ nextDisplayList = Graph_GfxPlusOne(polyOpa = gfxCtx->polyOpa.p);
+ gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
gSPEndDisplayList(nextDisplayList++);
- Graph_BranchDlist(_polyOpa, nextDisplayList);
+ Graph_BranchDlist(polyOpa, nextDisplayList);
- gfxCtx->polyOpa.p = nextDisplayList;
+ POLY_OPA_DISP = nextDisplayList;
+
+ CLOSE_DISPS(gfxCtx);
}
-void Game_UpdateInput(GameState* gamestate) {
- Padmgr_GetInput(gamestate->input, 1);
+void Game_UpdateInput(GameState* gameState) {
+ Padmgr_GetInput(gameState->input, 1);
}
-void Game_Update(GameState* gamestate) {
- GraphicsContext* _gCtx;
- _gCtx = gamestate->gfxCtx;
+void Game_Update(GameState* gameState) {
+ GraphicsContext* gfxCtx = gameState->gfxCtx;
- Game_ResetSegments(gamestate->gfxCtx);
+ GameState_SetFrameBuffer(gameState->gfxCtx);
- gamestate->main(gamestate);
+ gameState->main(gameState);
if (R_PAUSE_MENU_MODE != 2) {
- GameState_Draw(gamestate, _gCtx);
- func_801736DC(_gCtx);
+ GameState_Draw(gameState, gfxCtx);
+ func_801736DC(gfxCtx);
}
}
-void Game_IncrementFrameCount(GameState* gamestate) {
- Game_Nop80173534(gamestate);
- gamestate->frames++;
+void Game_IncrementFrameCount(GameState* gameState) {
+ Game_Nop80173534(gameState);
+ gameState->frames++;
}
-void Game_InitHeap(GameState* gamestate, u32 size) {
- GameState* _ctx;
- void* buf;
-
- _ctx = gamestate;
- buf = Gamealloc_Alloc(&_ctx->alloc, size);
+void GameState_InitArena(GameState* gameState, size_t size) {
+ GameAlloc* alloc = &gameState->alloc;
+ void* buf = GameAlloc_Malloc(alloc, size);
if (buf) {
- THA_Ct(&gamestate->heap, buf, size);
+ THA_Ct(&gameState->heap, buf, size);
return;
}
- THA_Ct(&gamestate->heap, NULL, 0);
- __assert("../game.c", 0x40B);
+ THA_Ct(&gameState->heap, NULL, 0);
+ __assert("../game.c", 1035);
}
-void Game_ResizeHeap(GameState* gamestate, u32 size) {
+void GameState_Realloc(GameState* gameState, size_t size) {
GameAlloc* alloc;
- void* buf;
- u32 systemMaxFree;
- u32 bytesFree;
- u32 bytesAllocated;
+ void* gameArena;
+ size_t systemMaxFree;
+ size_t bytesFree;
+ size_t bytesAllocated;
void* heapStart;
- heapStart = gamestate->heap.bufp;
- alloc = &gamestate->alloc;
- THA_Dt(&gamestate->heap);
- Gamealloc_Free(alloc, heapStart);
+ heapStart = gameState->heap.bufp;
+ alloc = &gameState->alloc;
+ THA_Dt(&gameState->heap);
+ GameAlloc_Free(alloc, heapStart);
SystemArena_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size);
- if (!size) {
+ if (size == 0) {
size = systemMaxFree - (sizeof(ArenaNode));
}
- if ((buf = Gamealloc_Alloc(alloc, size)) != NULL) {
- THA_Ct(&gamestate->heap, buf, size);
+ if ((gameArena = GameAlloc_Malloc(alloc, size)) != NULL) {
+ THA_Ct(&gameState->heap, gameArena, size);
} else {
- THA_Ct(&gamestate->heap, 0, 0);
- __assert("../game.c", 0x432);
+ THA_Ct(&gameState->heap, 0, 0);
+ __assert("../game.c", 1074);
}
}
-void Game_StateInit(GameState* gamestate, GameStateFunc gameStateInit, GraphicsContext* gfxCtx) {
- gamestate->gfxCtx = gfxCtx;
- gamestate->frames = 0U;
- gamestate->main = NULL;
- gamestate->destroy = NULL;
- gamestate->running = 1;
- gfxCtx->unk274 = D_801FBB88;
+void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) {
+ gameState->gfxCtx = gfxCtx;
+ gameState->frames = 0U;
+ gameState->main = NULL;
+ gameState->destroy = NULL;
+ gameState->running = 1;
+ gfxCtx->viMode = D_801FBB88;
gfxCtx->viConfigFeatures = gViConfigFeatures;
gfxCtx->viConfigXScale = gViConfigXScale;
gfxCtx->viConfigYScale = gViConfigYScale;
- gamestate->nextGameStateInit = NULL;
- gamestate->nextGameStateSize = 0U;
+ gameState->nextGameStateInit = NULL;
+ gameState->nextGameStateSize = 0U;
-lblUnk:;
- Gamealloc_Init(&gamestate->alloc);
- Game_InitHeap(gamestate, 0x100000);
- Game_SetFramerateDivisor(gamestate, 3);
+ {
+ s32 requiredScopeTemp;
- gameStateInit(gamestate);
+ GameAlloc_Init(&gameState->alloc);
+ GameState_InitArena(gameState, 0x100000);
+ Game_SetFramerateDivisor(gameState, 3);
- func_80140CE0(&D_801F8010);
- func_801420C0(&D_801F8020);
- func_801418B0(&sMonoColors);
- func_80140898(&D_801F8048);
- func_801773A0(&D_801F7FF0);
- func_8013ED9C();
+ init(gameState);
- osSendMesg(&gamestate->gfxCtx->unk5C, NULL, 1);
+ func_80140CE0(&D_801F8010);
+ func_801420C0(&D_801F8020);
+ func_801418B0(&sMonoColors);
+ func_80140898(&D_801F8048);
+ func_801773A0(&D_801F7FF0);
+ func_8013ED9C();
+
+ osSendMesg(&gameState->gfxCtx->unk5C, NULL, 1);
+ }
}
-void Game_StateFini(GameState* gamestate) {
+void GameState_Destroy(GameState* gameState) {
func_80172BC0();
func_8019E014();
- osRecvMesg(&gamestate->gfxCtx->unk5C, 0, 1);
+ osRecvMesg(&gameState->gfxCtx->unk5C, NULL, OS_MESG_BLOCK);
- if (gamestate->destroy != 0) {
- gamestate->destroy(gamestate);
+ if (gameState->destroy != NULL) {
+ gameState->destroy(gameState);
}
func_8013EDD0();
@@ -229,28 +239,28 @@ void Game_StateFini(GameState* gamestate) {
func_801420F4(&D_801F8020);
func_80141900(&sMonoColors);
func_80140900(&D_801F8048);
- THA_Dt(&gamestate->heap);
- Gamealloc_FreeAll(&gamestate->alloc);
+ THA_Dt(&gameState->heap);
+ GameAlloc_Cleanup(&gameState->alloc);
}
-GameStateFunc Game_GetNextStateInit(GameState* gamestate) {
- return gamestate->nextGameStateInit;
+GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
+ return gameState->nextGameStateInit;
}
-u32 Game_GetNextStateSize(GameState* gamestate) {
- return gamestate->nextGameStateSize;
+size_t Game_GetNextStateSize(GameState* gameState) {
+ return gameState->nextGameStateSize;
}
-u32 Game_GetShouldContinue(GameState* gamestate) {
- return gamestate->running;
+u32 GameState_IsRunning(GameState* gameState) {
+ return gameState->running;
}
-s32 Game_GetHeapFreeSize(GameState* gamestate) {
- return THA_GetSize(&gamestate->heap);
+s32 GameState_GetArenaSize(GameState* gameState) {
+ return THA_GetSize(&gameState->heap);
}
-s32 func_80173B48(GameState* gamestate) {
- s32 result;
- result = OS_CYCLES_TO_NSEC(gamestate->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
+s32 func_80173B48(GameState* gameState) {
+ s32 result = OS_CYCLES_TO_NSEC(gameState->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
+
return result;
}
diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c
index 34d595f79..541f9125b 100644
--- a/src/code/gamealloc.c
+++ b/src/code/gamealloc.c
@@ -1,11 +1,59 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/func_80173BF0.s")
+void GameAlloc_Log(GameAlloc* this) {
+ GameAllocEntry* iter;
-#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Alloc.s")
+ iter = this->base.next;
+ while (iter != &this->base) {
+ iter = iter->next;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Free.s")
+void* GameAlloc_Malloc(GameAlloc* this, size_t size) {
+ GameAllocEntry* ptr = SystemArena_Malloc(size + sizeof(GameAllocEntry));
-#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_FreeAll.s")
+ if (ptr != NULL) {
+ ptr->size = size;
+ ptr->prev = this->head;
+ this->head->next = ptr;
+ this->head = ptr;
+ ptr->next = &this->base;
+ this->base.prev = this->head;
+ return ptr + 1;
+ } else {
+ return NULL;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Init.s")
+void GameAlloc_Free(GameAlloc* this, void* data) {
+ GameAllocEntry* ptr;
+
+ if (data != NULL) {
+ ptr = &((GameAllocEntry*)data)[-1];
+ ptr->prev->next = ptr->next;
+ ptr->next->prev = ptr->prev;
+ this->head = this->base.prev;
+ SystemArena_Free(ptr);
+ }
+}
+
+void GameAlloc_Cleanup(GameAlloc* this) {
+ GameAllocEntry* next = this->base.next;
+ GameAllocEntry* cur;
+
+ while (&this->base != next) {
+ cur = next;
+ next = next->next;
+ SystemArena_Free(cur);
+ }
+
+ this->head = &this->base;
+ this->base.next = &this->base;
+ this->base.prev = &this->base;
+}
+
+void GameAlloc_Init(GameAlloc* this) {
+ this->head = &this->base;
+ this->base.next = &this->base;
+ this->base.prev = &this->base;
+}
diff --git a/src/code/listalloc.c b/src/code/listalloc.c
index 3880806a1..da294a109 100644
--- a/src/code/listalloc.c
+++ b/src/code/listalloc.c
@@ -1,9 +1,62 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174AA0.s")
+ListAlloc* ListAlloc_Init(ListAlloc* this) {
+ this->prev = NULL;
+ this->next = NULL;
+ return this;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174AB4.s")
+void* ListAlloc_Alloc(ListAlloc* this, size_t size) {
+ ListAlloc* ptr = SystemArena_Malloc(size + sizeof(ListAlloc));
+ ListAlloc* next;
-#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174B20.s")
+ if (ptr == NULL) {
+ return NULL;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174BA0.s")
+ next = this->next;
+ if (next != NULL) {
+ next->next = ptr;
+ }
+
+ ptr->prev = next;
+ ptr->next = NULL;
+ this->next = ptr;
+
+ if (this->prev == NULL) {
+ this->prev = ptr;
+ }
+
+ return (u8*)ptr + sizeof(ListAlloc);
+}
+
+void ListAlloc_Free(ListAlloc* this, void* data) {
+ ListAlloc* ptr = &((ListAlloc*)data)[-1];
+
+ if (ptr->prev != NULL) {
+ ptr->prev->next = ptr->next;
+ }
+
+ if (ptr->next != NULL) {
+ ptr->next->prev = ptr->prev;
+ }
+
+ if (this->prev == ptr) {
+ this->prev = ptr->next;
+ }
+
+ if (this->next == ptr) {
+ this->next = ptr->prev;
+ }
+
+ SystemArena_Free(ptr);
+}
+
+void ListAlloc_FreeAll(ListAlloc* this) {
+ ListAlloc* iter = this->prev;
+
+ while (iter != NULL) {
+ ListAlloc_Free(this, (u8*)iter + sizeof(ListAlloc));
+ iter = this->prev;
+ }
+}
diff --git a/src/code/main.c b/src/code/main.c
index 59471ea19..59ffb6a32 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -1,3 +1,77 @@
+/**
+ * This file has unmigrated bss. It is not practical to migrate it until we have a better way of dealing with bss
+ * reordering than just prevent_bss_reordering.h: there is too much of it to control, and it cannot be split into
+ * separate files since most of it is at addresses ending in 8.
+ */
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/main/Main.s")
+void Main(void* arg) {
+ intptr_t fb;
+ intptr_t sysHeap;
+ s32 exit;
+ s16* msg;
+
+ gScreenWidth = SCREEN_WIDTH;
+ gScreenHeight = SCREEN_HEIGHT;
+
+ Nmi_Init();
+ Fault_Start();
+ Check_RegionIsSupported();
+ Check_ExpansionPak();
+
+ sysHeap = gSystemHeap;
+ fb = 0x80780000;
+ startHeapSize = fb - sysHeap;
+ SystemArena_Init(sysHeap, startHeapSize);
+
+ GameInfo_Init();
+
+ R_ENABLE_ARENA_DBG = 0;
+
+ osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, ARRAY_COUNT(sSiIntMsgBuf));
+ osSetEventMesg(OS_EVENT_SI, &sSiIntMsgQ, NULL);
+
+ osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
+
+ StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched");
+ Sched_Init(&gSchedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
+
+ CIC6105_AddRomInfoFaultPage();
+
+ IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
+
+ StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio");
+ AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
+
+ StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr");
+ PadMgr_Init(&sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
+
+ AudioMgr_Unlock(&audioContext);
+
+ StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph");
+ osCreateThread(&sGraphThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, sGraphStack + sizeof(sGraphStack),
+ Z_PRIORITY_GRAPH);
+ osStartThread(&sGraphThread);
+
+ exit = false;
+
+ while (!exit) {
+ msg = NULL;
+ osRecvMesg(&irqMgrMsgQ, (OSMesg)&msg, OS_MESG_BLOCK);
+ if (msg == NULL) {
+ break;
+ }
+
+ switch (*msg) {
+ case OS_SC_PRE_NMI_MSG:
+ Nmi_SetPrenmiStart();
+ break;
+ case OS_SC_NMI_MSG:
+ exit = true;
+ break;
+ }
+ }
+
+ IrqMgr_RemoveClient(&gIrqMgr, &irqClient);
+ osDestroyThread(&sGraphThread);
+}
diff --git a/src/code/pad_801DC9C0.c b/src/code/pad_801DC9C0.c
new file mode 100644
index 000000000..f386919de
--- /dev/null
+++ b/src/code/pad_801DC9C0.c
@@ -0,0 +1 @@
+static const char pad_801DC9C0[] = { 0 };
diff --git a/src/code/padmgr.c b/src/code/padmgr.c
index 65b9d0ff4..a8ef1db15 100644
--- a/src/code/padmgr.c
+++ b/src/code/padmgr.c
@@ -54,4 +54,4 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_ThreadEntry.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_Start.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_Init.s")
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index cab2e563a..a4d5b9379 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -1,92 +1,92 @@
#include "global.h"
-void SysMatrix_StateAlloc(GameState* gamestate) {
- sMatrixStack = (MtxF*)THA_AllocEndAlign16(&gamestate->heap, 0x500);
+void Matrix_StateAlloc(GameState* gameState) {
+ sMatrixStack = (MtxF*)THA_AllocEndAlign16(&gameState->heap, 0x500);
sCurrentMatrix = sMatrixStack;
}
-void SysMatrix_StatePush(void) {
+void Matrix_StatePush(void) {
MtxF* prev = sCurrentMatrix;
sCurrentMatrix++;
Matrix_MtxFCopy(sCurrentMatrix, prev);
}
-void SysMatrix_StatePop(void) {
+void Matrix_StatePop(void) {
sCurrentMatrix--;
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_CopyCurrentState.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetCurrentState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetCurrentState.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetCurrentState.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertMatrix.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertMatrix.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertTranslation.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertTranslation.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_Scale.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_s.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertXRotation_s.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_f.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertXRotation_f.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_RotateStateAroundXAxis.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_RotateStateAroundXAxis.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetStateXRotation.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetStateXRotation.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_RotateY.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertYRotation_f.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertYRotation_f.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_s.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertZRotation_s.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_f.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertZRotation_f.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotation.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotation.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_RotateAndTranslateState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_JointPosition.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetStateRotationAndTranslation.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetStateRotationAndTranslation.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_ToRSPMatrix.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_ToRSPMatrix.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateAsRSPMatrix.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_ToMtx.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_NewMtx.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_AppendToPolyOpaDisp.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_AppendToPolyOpaDisp.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fByState.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslation.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslation.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledX.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledX.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledY.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledY.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledZ.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledZ.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fXZByCurrentState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fXZByCurrentState.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MtxFCopy.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_FromRSPMatrix.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_FromRSPMatrix.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByMatrix.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fByMatrix.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_TransposeXYZ.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_TransposeXYZ.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_NormalizeXYZ.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_NormalizeXYZ.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_8018219C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_801822C4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_f.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_f.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_s.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_s.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182C90.s")
diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c
index 1ae43c91d..688a5af15 100644
--- a/src/code/z_DLF.c
+++ b/src/code/z_DLF.c
@@ -1,5 +1,5 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/DLF_LoadGameState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_LoadGameState.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/DLF_FreeGameState.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_FreeGameState.s")
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 2f1277057..8d87e539b 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -53,7 +53,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
}
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
- SysMatrix_SetCurrentState(&mtx);
+ Matrix_SetCurrentState(&mtx);
if (dlist != D_04076BC0) {
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
@@ -117,7 +117,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
arg6 *= (4.5f - (light->l.dir[1] * 0.035f));
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
- SysMatrix_SetCurrentState(arg2);
+ Matrix_SetCurrentState(arg2);
Matrix_RotateY(sp58, MTXMODE_APPLY);
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
@@ -744,7 +744,7 @@ void Actor_FreeOverlay(ActorOverlay* entry) {
if ((entry->allocType & 1) != 0) {
entry->loadedRamAddr = NULL;
} else {
- zelda_free(ramAddr);
+ ZeldaArena_Free(ramAddr);
entry->loadedRamAddr = NULL;
}
}
diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c
index 4165e4c9b..f33fcd538 100644
--- a/src/code/z_actor_dlftbls.c
+++ b/src/code/z_actor_dlftbls.c
@@ -736,7 +736,7 @@ void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1) {
s32 i;
u8* ramStart;
u8* ramEnd;
- u32 size;
+ size_t size;
u32 offset;
for (i = 0; i < gMaxActorId; i++, overlayEntry++) {
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index 40ea71ee0..059fbce09 100644
--- a/src/code/z_collision_check.c
+++ b/src/code/z_collision_check.c
@@ -327,7 +327,7 @@ s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) {
collider->count = 0;
if (collider->elements != NULL) {
- zelda_free(collider->elements);
+ ZeldaArena_Free(collider->elements);
}
collider->elements = NULL;
return 1;
@@ -359,7 +359,7 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* collider
Collider_SetBaseToActor(globalCtx, &collider->base, &src->base);
collider->count = src->count;
- collider->elements = zelda_malloc(src->count * sizeof(ColliderJntSphElement));
+ collider->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement));
if (collider->elements == NULL) {
collider->count = 0;
@@ -385,7 +385,7 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* spher
Collider_SetBaseType1(globalCtx, &sphereGroup->base, actor, &src->base);
sphereGroup->count = src->count;
- sphereGroup->elements = zelda_malloc(src->count * sizeof(ColliderJntSphElement));
+ sphereGroup->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement));
if (sphereGroup->elements == NULL) {
sphereGroup->count = 0;
@@ -681,7 +681,7 @@ s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) {
tris->count = 0;
if (tris->elements != NULL) {
- zelda_free(tris->elements);
+ ZeldaArena_Free(tris->elements);
}
tris->elements = NULL;
@@ -714,7 +714,7 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* tris, Act
Collider_SetBaseType1(globalCtx, &tris->base, actor, &src->base);
tris->count = src->count;
- tris->elements = zelda_malloc(tris->count * sizeof(ColliderTrisElement));
+ tris->elements = ZeldaArena_Malloc(tris->count * sizeof(ColliderTrisElement));
if (tris->elements == NULL) {
tris->count = 0;
@@ -2913,8 +2913,8 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt,
/**
* Iterates through all AT colliders, testing them for AC collisions with each AC collider, setting the info regarding
* the collision for each AC and AT collider that collided. Then spawns hitmarks and plays sound effects for each
- * successful collision. To collide, an AT collider must share a type (PLAYER, ENEMY, or BOMB) with the AC collider and
- * the toucher and bumper elements that overlapped must share a dmgFlag.
+ * successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER)
+ * with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag.
*/
void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) {
Collider** col;
@@ -3691,7 +3691,7 @@ void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider) {
D_801EE1C0.x = collider->elements[i].dim.modelSphere.center.x;
D_801EE1C0.y = collider->elements[i].dim.modelSphere.center.y;
D_801EE1C0.z = collider->elements[i].dim.modelSphere.center.z;
- SysMatrix_MultiplyVector3fByState(&D_801EE1C0, &D_801EE1D0);
+ Matrix_MultiplyVector3fByState(&D_801EE1C0, &D_801EE1D0);
collider->elements[i].dim.worldSphere.center.x = D_801EE1D0.x;
collider->elements[i].dim.worldSphere.center.y = D_801EE1D0.y;
collider->elements[i].dim.worldSphere.center.z = D_801EE1D0.z;
@@ -3733,7 +3733,7 @@ void Collider_UpdateSphere(s32 limb, ColliderSphere* collider) {
D_801EE1E0.x = collider->dim.modelSphere.center.x;
D_801EE1E0.y = collider->dim.modelSphere.center.y;
D_801EE1E0.z = collider->dim.modelSphere.center.z;
- SysMatrix_MultiplyVector3fByState(&D_801EE1E0, &D_801EE1F0);
+ Matrix_MultiplyVector3fByState(&D_801EE1E0, &D_801EE1F0);
collider->dim.worldSphere.center.x = D_801EE1F0.x;
collider->dim.worldSphere.center.y = D_801EE1F0.y;
collider->dim.worldSphere.center.z = D_801EE1F0.z;
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index e6f03bb5f..924a2ad30 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -1,3 +1,19 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/static_context_init.s")
+GameInfo* gGameInfo;
+
+void GameInfo_Init(void) {
+ s32 i;
+
+ gGameInfo = (GameInfo*)SystemArena_Malloc(sizeof(GameInfo));
+ if (1) {}
+ gGameInfo->unk_00 = 0;
+ gGameInfo->unk_01 = 0;
+ gGameInfo->unk_02 = 0;
+ gGameInfo->unk_04 = 0;
+ gGameInfo->unk_03 = 0;
+
+ for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
+ gGameInfo->data[i] = 0;
+ }
+}
diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c
index ba2c79f71..d246aaffa 100644
--- a/src/code/z_eff_footmark.c
+++ b/src/code/z_eff_footmark.c
@@ -106,8 +106,8 @@ void EffFootmark_Draw(GlobalContext* globalCtx) {
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
if (footmark->actor != NULL) {
- SysMatrix_SetCurrentState(&footmark->displayMatrix);
- Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
+ Matrix_SetCurrentState(&footmark->displayMatrix);
+ Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 0ed19c050..47c2202f1 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -41,7 +41,7 @@ void EffectSS_Clear(GlobalContext* globalCtx) {
for (i = 0; i < EFFECT_SS_MAX; i++) {
addr = overlay->loadedRamAddr;
if (addr != NULL) {
- zelda_free(addr);
+ ZeldaArena_Free(addr);
}
overlay->loadedRamAddr = 0;
@@ -175,7 +175,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
initInfo = entry->initInfo;
} else {
if (entry->loadedRamAddr == NULL) {
- entry->loadedRamAddr = zelda_mallocR(overlaySize);
+ entry->loadedRamAddr = ZeldaArena_MallocR(overlaySize);
if (entry->loadedRamAddr == NULL) {
return;
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index 39cc4af73..cf27d2251 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -403,7 +403,7 @@ void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
// EffectSsDFire Spawn Functions
void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
- s16 alpha, s16 fadeDelay, s16 life, s32 arg9) {
+ s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
EffectSsDFireInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -413,8 +413,8 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.scaleStep = scaleStep;
initParams.alpha = alpha;
initParams.fadeDelay = fadeDelay;
+ initParams.unk_2C = arg8;
initParams.life = life;
- initParams.unk_30 = arg9;
EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams);
}
@@ -535,8 +535,8 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec
/**
* Spawn a single fragment
*
- * Notes:
- * - if a display list is not provided, D_0400C0D0 (wilted deku fragment) will be used as default
+ * * Notes:
+ * - if a display list is not provided, an unknown default will be used as default
* - the unused arg does not do anything, any value can be passed here
* - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will
* only live for 200 frames
@@ -899,7 +899,7 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f*
#endif
void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EffectSsFireTail_SpawnFlame(globalCtx, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart,
colorIntensity);
@@ -960,6 +960,7 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
}
// EffectSsDeadDb Spawn Functions
+
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
EffectSsDeadDbInitParams initParams;
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c
index fbd323885..d5125d249 100644
--- a/src/code/z_en_a_keep.c
+++ b/src/code/z_en_a_keep.c
@@ -1,48 +1,57 @@
#include "global.h"
-void EnAObj_Init(ActorEnAObj* this, GlobalContext* globalCtx) {
- ActorEnAObj* s0 = (ActorEnAObj*)this;
- s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
- s0->base.params = (s0->base.params & 0xFF) - 9;
- Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar);
- ActorShape_Init(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
- Collider_InitAndSetCylinder(globalCtx, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
- Collider_UpdateCylinder((Actor*)s0, &s0->collision);
- s0->base.colChkInfo.mass = 255;
- s0->update = (ActorFunc)EnAObj_Update1;
+#define THIS ((EnAObj*)thisx)
+
+void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx);
+void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx);
+
+void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnAObj* this = THIS;
+
+ this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300;
+ this->actor.params = (this->actor.params & 0xFF) - 9;
+ Actor_ProcessInitChain(&this->actor, &enAObjInitVar);
+ ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 12);
+ Collider_InitAndSetCylinder(globalCtx, &this->collision, &this->actor, &enAObjCylinderInit);
+ Collider_UpdateCylinder(&this->actor, &this->collision);
+ this->actor.colChkInfo.mass = 255;
+ this->actionFunc = EnAObj_Update1;
}
-void EnAObj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) {
- ColliderCylinder* a2 = &this->collision;
- Collider_DestroyCylinder(globalCtx, a2);
+void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnAObj* this = THIS;
+
+ Collider_DestroyCylinder(globalCtx, &this->collision);
}
-void EnAObj_Update1(ActorEnAObj* this, GlobalContext* globalCtx) {
- s16 v0;
- s32 v1;
- if (func_800B84D0((Actor*)this, globalCtx) != 0) {
- this->update = (ActorFunc)EnAObj_Update2;
+void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx) {
+ s32 yawDiff;
+
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ this->actionFunc = EnAObj_Update2;
} else {
- v0 = this->base.yawTowardsPlayer - this->base.shape.rot.y;
- v1 = (v0 < 0) ? -v0 : v0;
- if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
- func_800B863C((Actor*)this, globalCtx);
+ yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
+
+ if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) {
+ func_800B863C(&this->actor, globalCtx);
}
}
}
-void EnAObj_Update2(ActorEnAObj* this, GlobalContext* globalCtx) {
- if (func_800B867C((Actor*)this, globalCtx) != 0) {
- this->update = (ActorFunc)EnAObj_Update1;
+void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx) {
+ if (func_800B867C(&this->actor, globalCtx)) {
+ this->actionFunc = EnAObj_Update1;
}
}
-void EnAObj_Update(ActorEnAObj* this, GlobalContext* globalCtx) {
- (this->update)((Actor*)this, (GlobalContext*)globalCtx);
- Actor_SetHeight((Actor*)this, 45.0f);
- CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)&this->collision);
+void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnAObj* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+ Actor_SetHeight(&this->actor, 45.0f);
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collision.base);
}
-void EnAObj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) {
- func_800BDFC0(globalCtx, enAObjDisplayLists[this->base.params]);
+void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ func_800BDFC0(globalCtx, enAObjDisplayLists[thisx->params]);
}
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 13be40c0a..acae2e0ce 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -403,7 +403,7 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
}
void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->unk14A != 0) {
if (Actor_HasParent(&this->actor, globalCtx) == 0) {
@@ -439,7 +439,7 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = THIS;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 sp38 = player->stateFlags3 & 0x1000;
s32 getItemId = GI_NONE;
s32 pad2;
@@ -660,7 +660,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->unk152 = -2;
}
} else {
- Matrix_Scale(16.0f, 16.0f, 16.0f, 1);
+ Matrix_Scale(16.0f, 16.0f, 16.0f, MTXMODE_APPLY);
GetItem_Draw(globalCtx, 8);
}
break;
@@ -785,7 +785,7 @@ void EnItem00_DrawHeartContainer(EnItem00* actor, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- Matrix_Scale(20.0f, 20.0f, 20.0f, 1);
+ Matrix_Scale(20.0f, 20.0f, 20.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
diff --git a/src/code/z_fcurve_data.c b/src/code/z_fcurve_data.c
new file mode 100644
index 000000000..a0bf887e1
--- /dev/null
+++ b/src/code/z_fcurve_data.c
@@ -0,0 +1,5 @@
+#include "global.h"
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data/func_800F23E0.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data/func_800F2478.s")
diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c
index 79439550d..c6ee50d87 100644
--- a/src/code/z_fcurve_data_skelanime.c
+++ b/src/code/z_fcurve_data_skelanime.c
@@ -1,15 +1,181 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F2620.s")
+void SkelCurve_Clear(SkelAnimeCurve* skelCurve) {
+ skelCurve->limbCount = 0;
+ skelCurve->limbList = NULL;
+ skelCurve->transUpdIdx = NULL;
+ skelCurve->animCurFrame = 0.0f;
+ skelCurve->animSpeed = 0.0f;
+ skelCurve->animFinalFrame = 0.0f;
+ skelCurve->unk0C = 0.0f;
+ skelCurve->transforms = NULL;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F2650.s")
+s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg,
+ TransformUpdateIndex* transUpdIdx) {
+ SkelCurveLimb** limbs;
+ SkelCurveLimbList* limbList = (SkelCurveLimbList*)Lib_SegmentedToVirtual(limbListSeg);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F26C0.s")
+ skelCurve->limbCount = limbList->limbCount;
+ skelCurve->limbList = (SkelCurveLimb**)Lib_SegmentedToVirtual(limbList->limbs);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F26F0.s")
+ skelCurve->transforms = ZeldaArena_Malloc(sizeof(*skelCurve->transforms) * skelCurve->limbCount);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F2728.s")
+ do {
+ skelCurve->animCurFrame = 0.0f;
+ } while (0);
+ return 1;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F29A0.s")
+void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
+ if (skelCurve->transforms != NULL) {
+ ZeldaArena_Free(skelCurve->transforms);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_800F2CD8.s")
+void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame,
+ f32 animCurFrame, f32 animSpeed) {
+ skelCurve->unk0C = arg2 - skelCurve->animSpeed;
+ skelCurve->animFinalFrame = animFinalFrame;
+ skelCurve->animCurFrame = animCurFrame;
+ skelCurve->animSpeed = animSpeed;
+ skelCurve->transUpdIdx = transUpdIdx;
+}
+
+#ifdef NON_MATCHING
+/* Should be functionally equivalent, also migrating rodata makes it a lot cleaner */
+s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
+ s16* transforms;
+ u8* transformRefIdx;
+ TransformUpdateIndex* transformIndex;
+ u16* transformCopyValues;
+ s32 i;
+ s32 ret = 0;
+ s32 k;
+ TransformData* transData;
+ f32 transformValue;
+ s32 j;
+
+ transformIndex = Lib_SegmentedToVirtual(skelCurve->transUpdIdx);
+ transformRefIdx = Lib_SegmentedToVirtual(transformIndex->refIndex);
+ transData = Lib_SegmentedToVirtual(transformIndex->transformData);
+ transformCopyValues = Lib_SegmentedToVirtual(transformIndex->copyValues);
+ transforms = (s16*)skelCurve->transforms;
+
+ skelCurve->animCurFrame += skelCurve->animSpeed * (globalCtx->state.framerateDivisor * 0.5f);
+
+ if ((skelCurve->animSpeed >= 0.0f && skelCurve->animCurFrame > skelCurve->animFinalFrame) ||
+ (skelCurve->animSpeed < 0.0f && skelCurve->animCurFrame < skelCurve->animFinalFrame)) {
+ skelCurve->animCurFrame = skelCurve->animFinalFrame;
+ ret = 1;
+ }
+
+ for (i = 0; i < skelCurve->limbCount; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 3; k++, transformRefIdx++, transforms++) {
+ if (*transformRefIdx == 0) {
+ transformValue = *transformCopyValues;
+ *transforms = transformValue;
+ transformCopyValues++;
+ } else {
+ transformValue = func_800F2478(skelCurve->animCurFrame, transData, *transformRefIdx);
+ transData += *transformRefIdx;
+ if (j == 0) {
+ *transforms = transformValue * 1024.0f;
+ } else if (j == 1) {
+ *transforms = transformValue * (32768.0f / 180.0f);
+ } else {
+ *transforms = transformValue * 100.0f;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/SkelCurve_Update.s")
+#endif
+
+void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve,
+ OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
+ SkelCurveLimb* limb = (SkelCurveLimb*)Lib_SegmentedToVirtual(skelCurve->limbList[limbIndex]);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ Matrix_StatePush();
+
+ if (overrideLimbDraw == NULL ||
+ (overrideLimbDraw != NULL && overrideLimbDraw(globalCtx, skelCurve, limbIndex, thisx))) {
+ Vec3f scale;
+ Vec3s rot;
+ Vec3f pos;
+ Gfx* dList;
+ Vec3s* transform = (Vec3s*)&skelCurve->transforms[limbIndex];
+
+ scale.x = transform->x / 1024.0f;
+ scale.y = transform->y / 1024.0f;
+ scale.z = transform->z / 1024.0f;
+ transform++;
+ rot.x = transform->x;
+ rot.y = transform->y;
+ rot.z = transform->z;
+ transform++;
+ pos.x = transform->x;
+ pos.y = transform->y;
+ pos.z = transform->z;
+
+ Matrix_JointPosition(&pos, &rot);
+ Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY);
+
+ if (lod == 0) {
+ s32 pad1;
+
+ dList = limb->dList[0];
+ if (dList != NULL) {
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, dList);
+ }
+ } else if (lod == 1) {
+ s32 pad2;
+
+ dList = limb->dList[0];
+ if (dList != NULL) {
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, dList);
+ }
+ dList = limb->dList[1];
+ if (dList != NULL) {
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, dList);
+ }
+ }
+ }
+
+ if (postLimbDraw != NULL) {
+ postLimbDraw(globalCtx, skelCurve, limbIndex, thisx);
+ }
+
+ if (limb->firstChildIdx != LIMB_DONE) {
+ SkelCurve_DrawLimb(globalCtx, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
+ }
+
+ Matrix_StatePop();
+
+ if (limb->nextLimbIdx != LIMB_DONE) {
+ SkelCurve_DrawLimb(globalCtx, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve,
+ OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
+ if (skelCurve->transforms != NULL) {
+ SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
+ }
+}
diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c
new file mode 100644
index 000000000..4e2590a6a
--- /dev/null
+++ b/src/code/z_game_dlftbls.c
@@ -0,0 +1,26 @@
+#include "global.h"
+#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
+#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
+#include "overlays/gamestates/ovl_opening/z_opening.h"
+#include "overlays/gamestates/ovl_select/z_select.h"
+#include "overlays/gamestates/ovl_title/z_title.h"
+
+#define GAMESTATE_OVERLAY(name, init, destroy, size) \
+ { \
+ NULL, SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \
+ SEGMENT_END(ovl_##name), 0, init, destroy, 0, 0, 0, size \
+ }
+#define GAMESTATE_OVERLAY_INTERNAL(init, destroy, size) \
+ { NULL, 0, 0, NULL, NULL, 0, init, destroy, 0, 0, 0, size }
+
+GameStateOverlay gGameStateOverlayTable[] = {
+ GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
+ GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)),
+ GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
+ GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(GlobalContext)),
+ GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
+ GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
+ GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)),
+};
+
+s32 graphNumGameStates = ARRAY_COUNT(gGameStateOverlayTable);
diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c
index 412cb7080..c510c1974 100644
--- a/src/code/z_game_over.c
+++ b/src/code/z_game_over.c
@@ -1,7 +1,117 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA610.s")
+void GameOver_Init(GlobalContext* globalCtx) {
+ globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA624.s")
+void GameOver_FadeLights(GlobalContext* globalCtx) {
+ GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_game_over/func_801AA68C.s")
+ if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) ||
+ (gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) {
+ Kankyo_FadeInGameOverLights(globalCtx);
+ }
+}
+
+static s16 sGameOverTimer = 0;
+
+void GameOver_Update(GlobalContext* globalCtx) {
+ GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
+ s16 i;
+
+ switch (gameOverCtx->state) {
+ case GAMEOVER_DEATH_START:
+ func_801477B4(globalCtx);
+
+ for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
+ gSaveContext.unk_3DD0[i] = 0;
+ }
+
+ gSaveContext.eventInf[1] &= ~1;
+
+ if (CUR_FORM == 0) {
+ if (CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI &&
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR &&
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED &&
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_DEITY) {
+
+ if (gSaveContext.buttonStatus[0] != BTN_ENABLED) {
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[0];
+ } else {
+ CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
+ }
+ }
+ }
+
+ gSaveContext.unk_3DC0 = 2000;
+ gSaveContext.naviTimer = 0;
+ gSaveContext.seqIndex = 0xFF;
+ gSaveContext.nightSeqIndex = 0xFF;
+ gSaveContext.eventInf[0] = 0;
+ gSaveContext.eventInf[1] = 0;
+ gSaveContext.eventInf[2] = 0;
+ gSaveContext.eventInf[3] = 0;
+ gSaveContext.buttonStatus[0] = BTN_ENABLED;
+ gSaveContext.buttonStatus[1] = BTN_ENABLED;
+ gSaveContext.buttonStatus[2] = BTN_ENABLED;
+ gSaveContext.buttonStatus[3] = BTN_ENABLED;
+ gSaveContext.buttonStatus[4] = BTN_ENABLED;
+ gSaveContext.unk_3F1E = 0;
+ gSaveContext.unk_3F20 = 0;
+ gSaveContext.unk_3F22 = 0;
+ gSaveContext.unk_3F24 = 0;
+ Kankyo_InitGameOverLights(globalCtx);
+ sGameOverTimer = 20;
+ func_8013ECE0(0.0f, 126, 124, 63);
+ gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
+ break;
+ case GAMEOVER_DEATH_FADE_OUT:
+ if (func_801A8A50(1) != 32) {
+ func_80169F78(globalCtx);
+ if (gSaveContext.respawnFlag != -7) {
+ gSaveContext.respawnFlag = -6;
+ }
+ gSaveContext.nextTransition = 2;
+ gSaveContext.health = 48;
+ gameOverCtx->state++;
+ if (gSaveContext.inventory.items[SLOT(ITEM_MASK_DEKU)] == ITEM_MASK_DEKU) {
+ gSaveContext.playerForm = PLAYER_FORM_HUMAN;
+ gSaveContext.equippedMask = PLAYER_MASK_NONE;
+ }
+ func_8013EE24();
+ }
+ break;
+ case GAMEOVER_REVIVE_START:
+ gameOverCtx->state++;
+ sGameOverTimer = 0;
+ Kankyo_InitGameOverLights(globalCtx);
+ ShrinkWindow_SetLetterboxTarget(32);
+ break;
+ case GAMEOVER_REVIVE_RUMBLE:
+ sGameOverTimer = 50;
+ gameOverCtx->state++;
+ func_8013ECE0(0.0f, 126, 124, 63);
+ break;
+ case GAMEOVER_REVIVE_WAIT_GROUND:
+ sGameOverTimer--;
+ if (sGameOverTimer == 0) {
+ sGameOverTimer = 64;
+ gameOverCtx->state++;
+ }
+ break;
+ case GAMEOVER_REVIVE_WAIT_FAIRY:
+ sGameOverTimer--;
+ if (sGameOverTimer == 0) {
+ sGameOverTimer = 50;
+ gameOverCtx->state++;
+ }
+ break;
+ case GAMEOVER_REVIVE_FADE_OUT:
+ Kankyo_FadeOutGameOverLights(globalCtx);
+ sGameOverTimer--;
+ if (sGameOverTimer == 0) {
+ gameOverCtx->state = GAMEOVER_INACTIVE;
+ }
+ break;
+ }
+}
diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c
index 22c96883e..6221e0910 100644
--- a/src/code/z_kankyo.c
+++ b/src/code/z_kankyo.c
@@ -74,11 +74,11 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBCBC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBDEC.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBF3C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC158.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC3DC.s")
diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c
index bbfad829f..73a59f477 100644
--- a/src/code/z_lifemeter.c
+++ b/src/code/z_lifemeter.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "prevent_bss_reordering.h"
static s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } };
static s16 sHeartsEnvColors[3][3] = { { 50, 40, 60 }, { 255, 0, 0 }, { 0, 0, 255 } };
diff --git a/src/code/z_lights.c b/src/code/z_lights.c
index 3e2e041b3..80d3f7131 100644
--- a/src/code/z_lights.c
+++ b/src/code/z_lights.c
@@ -432,7 +432,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
- SysMatrix_InsertTranslation(params->x, params->y, params->z, 0);
+ Matrix_InsertTranslation(params->x, params->y, params->z, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c
index f99519e9b..8d0bba44a 100644
--- a/src/code/z_malloc.c
+++ b/src/code/z_malloc.c
@@ -1,21 +1,54 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/zelda_malloc.s")
+void* ZeldaArena_Malloc(size_t size) {
+ void* ptr = __osMalloc(&sZeldaArena, size);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/zelda_mallocR.s")
+ return ptr;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/zelda_realloc.s")
+void* ZeldaArena_MallocR(size_t size) {
+ void* ptr = __osMallocR(&sZeldaArena, size);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/zelda_free.s")
+ return ptr;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/zelda_calloc.s")
+void* ZeldaArena_Realloc(void* ptr, size_t newSize) {
+ ptr = __osRealloc(&sZeldaArena, ptr, newSize);
+ return ptr;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/MainHeap_AnalyzeArena.s")
+void ZeldaArena_Free(void* ptr) {
+ __osFree(&sZeldaArena, ptr);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/MainHeap_Check.s")
+void* ZeldaArena_Calloc(u32 num, size_t size) {
+ void* ret;
+ u32 n = num * size;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/MainHeap_Init.s")
+ ret = __osMalloc(&sZeldaArena, n);
+ if (ret != NULL) {
+ bzero(ret, n);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/MainHeap_Cleanup.s")
+ return ret;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_malloc/MainHeap_IsInitialized.s")
+void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc) {
+ __osAnalyzeArena(&sZeldaArena, outMaxFree, outFree, outAlloc);
+}
+
+void ZeldaArena_Check() {
+ __osCheckArena(&sZeldaArena);
+}
+
+void ZeldaArena_Init(void* start, size_t size) {
+ __osMallocInit(&sZeldaArena, start, size);
+}
+
+void ZeldaArena_Cleanup() {
+ __osMallocCleanup(&sZeldaArena);
+}
+
+u8 ZeldaArena_IsInitialized() {
+ return __osMallocIsInitalized(&sZeldaArena);
+}
diff --git a/src/code/z_nmi_buff.c b/src/code/z_nmi_buff.c
index a12fa6591..205bd8d0f 100644
--- a/src/code/z_nmi_buff.c
+++ b/src/code/z_nmi_buff.c
@@ -1,9 +1,30 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_Init.s")
+#define COLD_RESET 0
+#define NMI 1
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_SetPrenmiStart.s")
+NmiBuff* gNMIBuffer;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_GetPrenmiHasStarted.s")
+void Nmi_Init(void) {
+ gNMIBuffer = (NmiBuff*)osAppNmiBuffer;
+ gNMIBuffer->resetting = false;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/func_8010C1B0.s")
+ if (osResetType == COLD_RESET) {
+ gNMIBuffer->resetCount = 0;
+ gNMIBuffer->duration = 0;
+ } else {
+ gNMIBuffer->resetCount++;
+ gNMIBuffer->duration += gNMIBuffer->resetTime;
+ }
+
+ gNMIBuffer->resetTime = 0;
+}
+
+void Nmi_SetPrenmiStart(void) {
+ gNMIBuffer->resetting = true;
+ gNMIBuffer->resetTime = osGetTime();
+}
+
+u32 Nmi_GetPrenmiHasStarted(void) {
+ return gNMIBuffer->resetting;
+}
diff --git a/src/code/z_pause.c b/src/code/z_pause.c
new file mode 100644
index 000000000..44be6238a
--- /dev/null
+++ b/src/code/z_pause.c
@@ -0,0 +1,5 @@
+#include "global.h"
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122660.s")
+
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122670.s")
diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c
index f0403b4f3..df55d2488 100644
--- a/src/code/z_prenmi.c
+++ b/src/code/z_prenmi.c
@@ -16,21 +16,20 @@ void PreNMI_Update(PreNMIContext* prenmiCtx) {
prenmiCtx->timer--;
}
-#ifdef NON_MATCHING
-// Minor reordering around call to func_8012C470
void PreNMI_Draw(PreNMIContext* prenmiCtx) {
GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
func_8012CF0C(gfxCtx, 1, 1, 0, 0, 0);
+
+ OPEN_DISPS(gfxCtx);
+
func_8012C470(gfxCtx);
- gDPSetFillColor(gfxCtx->polyOpa.p++,
- (GPACK_RGBA5551(0xFF, 0xFF, 0xFF, 1) << 16) | GPACK_RGBA5551(0xFF, 0xFF, 0xFF, 1));
- gDPFillRectangle(gfxCtx->polyOpa.p++, 0, prenmiCtx->timer + 100, 320 /*SCREEN_WIDTH*/ - 1, prenmiCtx->timer + 100);
+ gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
+ gDPFillRectangle(POLY_OPA_DISP++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100);
+
+ CLOSE_DISPS(gfxCtx);
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_prenmi/PreNMI_Draw.s")
-#endif
void PreNMI_Main(PreNMIContext* prenmiCtx) {
PreNMI_Update(prenmiCtx);
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index b45e02381..aeb8370ab 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -444,7 +444,7 @@ void Quake2_Update(void) {
Player* player;
GlobalContext* globalCtx = sQuake2Context.globalCtx;
PosRot playerPosRot;
- Camera* camera = globalCtx->cameraPtrs[globalCtx->activeCamera];
+ Camera* camera = GET_ACTIVE_CAM(globalCtx);
f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f);
if (sQuake2Context.type != 0) {
@@ -605,7 +605,7 @@ void Quake2_Update(void) {
angle1 = 0x3F0;
angle2 = 0x156;
sQuake2Context.countdown = 2;
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (&player->actor != NULL) {
func_800B8248(&playerPosRot, player);
@@ -654,7 +654,7 @@ void Quake2_Update(void) {
angle1 = 0x3F0;
angle2 = 0x156;
sQuake2Context.countdown = 2;
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
angle1Speed = 359.2f;
angle2Speed = -18.5f;
rotX = 0.0f;
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 0a11f83fe..5163f1f29 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -77,7 +77,7 @@ void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) {
#ifdef NON_MATCHING
s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 index) {
- u32 size;
+ size_t size;
// XXX: this should use a branch-likely
if (roomCtx->unk31 == 0) {
@@ -114,7 +114,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment);
- func_80123140(globalCtx, PLAYER);
+ func_80123140(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index e77144528..b744af5d0 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -1,7 +1,7 @@
#include "global.h"
s32 Object_Spawn(ObjectContext* objectCtx, s16 id) {
- u32 size;
+ size_t size;
objectCtx->status[objectCtx->num].id = id;
size = objectFileTable[id].vromEnd - objectFileTable[id].vromStart;
@@ -23,8 +23,8 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) {
return objectCtx->num - 1;
}
-void Object_InitBank(GameState* gamestate, ObjectContext* objectCtx) {
- GlobalContext* globalCtx = (GlobalContext*)gamestate;
+void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) {
+ GlobalContext* globalCtx = (GlobalContext*)gameState;
s32 pad;
u32 spaceSize;
s32 i;
@@ -49,7 +49,7 @@ void Object_InitBank(GameState* gamestate, ObjectContext* objectCtx) {
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; }
// clang-format on
- objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&gamestate->heap, spaceSize);
+ objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&gameState->heap, spaceSize);
objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP);
@@ -60,7 +60,7 @@ void Object_UpdateBank(ObjectContext* objectCtx) {
s32 i;
ObjectStatus* status = &objectCtx->status[0];
RomFile* objectFile;
- u32 size;
+ size_t size;
for (i = 0; i < objectCtx->num; i++) {
if (status->id < 0) {
@@ -354,7 +354,7 @@ s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) {
{ SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) },
};
u32 vromStart = sceneTextureFiles[fileIndex].vromStart;
- u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
+ size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) {
globalCtx->roomCtx.unk74 = THA_AllocEndAlign16(&globalCtx->state.heap, size);
diff --git a/src/code/z_shrink_window.c b/src/code/z_shrink_window.c
index 3b2d86114..194ee5083 100644
--- a/src/code/z_shrink_window.c
+++ b/src/code/z_shrink_window.c
@@ -1,25 +1,121 @@
+/**
+ * File: z_shrink_window.c
+ * Description: Draws black top/bottom/side borders on the viewing window (e.g. Z-targeting, talking to NPC)
+ */
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxTarget.s")
+ShrinkWindowContext gShrinkWindowContext;
+ShrinkWindowContext* gShrinkWindowContextPtr;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxTarget.s")
+void ShrinkWindow_SetLetterboxTarget(s32 target) {
+ gShrinkWindowContextPtr->letterboxTarget = target;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxMagnitude.s")
+s32 ShrinkWindow_GetLetterboxTarget(void) {
+ return gShrinkWindowContextPtr->letterboxTarget;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxMagnitude.s")
+void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude) {
+ gShrinkWindowContextPtr->letterboxMagnitude = magnitude;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetPillarboxTarget.s")
+s32 ShrinkWindow_GetLetterboxMagnitude(void) {
+ return gShrinkWindowContextPtr->letterboxMagnitude;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetPillarboxTarget.s")
+void ShrinkWindow_SetPillarboxTarget(s32 target) {
+ gShrinkWindowContextPtr->pillarboxTarget = target;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetPillarboxMagnitude.s")
+s32 ShrinkWindow_GetPillarboxTarget(void) {
+ return gShrinkWindowContextPtr->pillarboxTarget;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetPillarboxMagnitude.s")
+void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude) {
+ gShrinkWindowContextPtr->pillarboxMagnitude = magnitude;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_Init.s")
+s32 ShrinkWindow_GetPillarboxMagnitude(void) {
+ return gShrinkWindowContextPtr->pillarboxMagnitude;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_Fini.s")
+void ShrinkWindow_Init(void) {
+ gShrinkWindowContextPtr = &gShrinkWindowContext;
+ bzero(gShrinkWindowContextPtr, sizeof(gShrinkWindowContext));
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_Step.s")
+void ShrinkWindow_Destroy(void) {
+ gShrinkWindowContextPtr = NULL;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_shrink_window/ShrinkWindow_Draw.s")
+void ShrinkWindow_Update(s32 framerateDivisor) {
+ s32 step = ((framerateDivisor == 3) ? 10 : 30 / framerateDivisor);
+ s32 nextMagnitude;
+
+ nextMagnitude = gShrinkWindowContextPtr->letterboxMagnitude;
+ Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->letterboxTarget, step);
+ gShrinkWindowContextPtr->letterboxMagnitude = nextMagnitude;
+
+ nextMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude;
+ Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->pillarboxTarget, step);
+ gShrinkWindowContextPtr->pillarboxMagnitude = nextMagnitude;
+}
+
+void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
+ Gfx* gfx;
+ s8 letterboxMagnitude = gShrinkWindowContextPtr->letterboxMagnitude;
+ s8 pillarboxMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude;
+
+ if (letterboxMagnitude > 0) {
+ OPEN_DISPS(gfxCtx);
+
+ gfx = OVERLAY_DISP;
+
+ gDPPipeSync(gfx++);
+ gDPSetCycleType(gfx++, G_CYC_FILL);
+ gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2);
+ gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
+ gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, letterboxMagnitude - 1);
+ gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude, gScreenWidth - 1, gScreenHeight - 1);
+
+ gDPPipeSync(gfx++);
+ gDPSetCycleType(gfx++, G_CYC_1CYCLE);
+ gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0);
+ gDPFillRectangle(gfx++, 0, letterboxMagnitude, gScreenWidth, letterboxMagnitude + 1);
+ gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude - 1, gScreenWidth,
+ gScreenHeight - letterboxMagnitude);
+
+ gDPPipeSync(gfx++);
+ OVERLAY_DISP = gfx++;
+
+ CLOSE_DISPS(gfxCtx);
+ }
+ if (pillarboxMagnitude > 0) {
+ OPEN_DISPS(gfxCtx);
+
+ gfx = OVERLAY_DISP;
+
+ gDPPipeSync(gfx++);
+ gDPSetCycleType(gfx++, G_CYC_FILL);
+ gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2);
+ gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
+
+ gDPFillRectangle(gfx++, 0, 0, pillarboxMagnitude - 1, gScreenHeight - 1);
+ gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude, 0, gScreenWidth - 1, gScreenHeight - 1);
+
+ gDPPipeSync(gfx++);
+ gDPSetCycleType(gfx++, G_CYC_1CYCLE);
+ gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0);
+
+ gDPFillRectangle(gfx++, pillarboxMagnitude, 0, pillarboxMagnitude + 2, gScreenHeight);
+ gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude - 2, 0, gScreenWidth - pillarboxMagnitude,
+ gScreenHeight);
+
+ gDPPipeSync(gfx++);
+ OVERLAY_DISP = gfx++;
+
+ CLOSE_DISPS(gfxCtx);
+ }
+}
diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c
index 16428023a..4cd9734f6 100644
--- a/src/code/z_skelanime.c
+++ b/src/code/z_skelanime.c
@@ -1,63 +1,57 @@
#include "global.h"
-s32 func_80136288(GlobalContext* globalCtx, SkelAnime* skelAnime);
-s32 func_8013631C(GlobalContext* globalCtx, SkelAnime* skelAnime);
-s32 func_8013702C(SkelAnime* skelAnime);
-s32 func_801370B0(SkelAnime* skelAnime);
-s32 func_8013713C(SkelAnime* skelAnime);
-void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg);
-void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
-void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount,
- u8 animationMode, f32 transitionRate);
-void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
-void SkelAnime_LinkAnimetionLoaded(GlobalContext* globalCtx, AnimationEntryType0* entry);
-void SkelAnime_AnimationType1Loaded(GlobalContext* globalCtx, AnimationEntryType1* entry);
-void SkelAnime_AnimationType2Loaded(GlobalContext* globalCtx, AnimationEntryType2* entry);
-void SkelAnime_AnimationType3Loaded(GlobalContext* globalCtx, AnimationEntryType3* entry);
-void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry);
-void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry);
+#define ANIM_INTERP 1
+
+s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime);
+s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime);
+s32 SkelAnime_LoopFull(SkelAnime* skelAnime);
+s32 SkelAnime_LoopPartial(SkelAnime* skelAnime);
+s32 SkelAnime_Once(SkelAnime* skelAnime);
+void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animationSeg);
+void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
+void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimetionEntrySeg,
+ f32 playbackSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 transitionRate);
+void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
static AnimationEntryCallback sAnimationLoadDone[] = {
- (AnimationEntryCallback)SkelAnime_LinkAnimetionLoaded, (AnimationEntryCallback)SkelAnime_AnimationType1Loaded,
- (AnimationEntryCallback)SkelAnime_AnimationType2Loaded, (AnimationEntryCallback)SkelAnime_AnimationType3Loaded,
- (AnimationEntryCallback)SkelAnime_AnimationType4Loaded, (AnimationEntryCallback)SkelAnime_AnimationType5Loaded,
+ AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp,
+ AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor,
};
-s32 D_801F5AB0;
-s32 D_801F5AB4;
+s32 sAnimQueueFlags;
+s32 sDisableAnimQueueFlags;
/*
* Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`
*/
-void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) {
- StandardLimb* limbEntry;
+void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod) {
+ LodLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- s32 pad;
- SysMatrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ Matrix_StatePush();
+ limb = (LodLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
+ rot = jointTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- dList = limbEntry->displayLists[dListIndex];
+ dList = limb->dLists[lod];
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPDisplayList(&polyTemp[1], dList);
+ POLY_OPA_DISP = &polyTemp[2];
}
}
@@ -65,58 +59,58 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skele
postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex);
+ if (limb->child != LIMB_DONE) {
+ SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex);
+ if (limb->sibling != LIMB_DONE) {
+ SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ lod);
}
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-/*
- * Draws the Skeleton described by `skeleton` with a level of detail display list indexed by `dListIndex`
+/**
+ * Draw all limbs of type `LodLimb` in a given skeleton
+ * Near or far display list is specified via `lod`
*/
-void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex) {
- StandardLimb* limbEntry;
+void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod) {
+ LodLimb* rootLimb;
s32 pad;
Gfx* dList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx;
- s32 pad2;
if (skeleton == NULL) {
return;
}
- gfxCtx = globalCtx->state.gfxCtx;
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
+ rootLimb = (LodLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
- rot = limbDrawTable[1];
- dList = limbEntry->displayLists[dListIndex];
+ rot = jointTable[1];
+ dList = rootLimb->dLists[lod];
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList);
+ gSPDisplayList(&polyTemp[1], dList);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ POLY_OPA_DISP = &polyTemp[2];
}
}
@@ -124,167 +118,169 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra
postLimbDraw(globalCtx, 1, &dList, &rot, actor);
}
- if (limbEntry->firstChildIndex != 0xFF) {
- SkelAnime_LodDrawLimb(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex);
+ if (rootLimb->child != LIMB_DONE) {
+ SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ lod);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-/*
- * Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`, Limb matrices come
- * from a dynamic allocation from the graph arena.
+/**
+ * Draw a limb of type `LodLimb` contained within a flexible skeleton
+ * Near or far display list is specified via `lod`
*/
-void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor,
- s32 dListIndex, RSPMatrix** mtx) {
- StandardLimb* limbEntry;
- Gfx* dList[2];
+void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor,
+ s32 lod, Mtx** mtx) {
+ LodLimb* limb;
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- s32 pad;
- SysMatrix_StatePush();
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ Matrix_StatePush();
+
+ limb = (LodLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
+ rot = jointTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
- // Double assignment here would not work.
- dList[0] = limbEntry->displayLists[dListIndex];
- dList[1] = dList[0];
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList[1] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*mtx);
- gSPMatrix(gfxCtx->polyOpa.p++, *mtx, G_MTX_LOAD);
- gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]);
+ newDList = limbDList = limb->dLists[lod];
+
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ Matrix_ToMtx(*mtx);
+ gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD);
+ gSPDisplayList(POLY_OPA_DISP++, newDList);
(*mtx)++;
- } else if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*mtx);
+ } else if (limbDList != NULL) {
+ Matrix_ToMtx(*mtx);
(*mtx)++;
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, limbIndex, &dList[1], &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, limbIndex, &newDList, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex, mtx);
+ if (limb->child != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ lod, mtx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex, mtx);
+ if (limb->sibling != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ lod, mtx);
}
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-/*
- * Draws the Skeleton described by `skeleton` with a level of detail display list indexed by `dListIndex`
- * Matricies for the limbs are dynamically allocted from the graph arena. The dynamic allocation occurs
- * because the Skeleton is too large to be supported by the normal matrix stack.
+/**
+ * Draws all limbs of type `LodLimb` in a given flexible skeleton
+ * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
+ * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
-void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
- OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor,
- s32 dListIndex) {
- StandardLimb* limbEntry;
+void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor,
+ s32 lod) {
+ LodLimb* rootLimb;
s32 pad;
- Gfx* dList[2];
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- RSPMatrix* mtx;
- GraphicsContext* gfxCtx;
- s32 pad2;
-
- mtx = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(RSPMatrix) * dListCount));
+ Mtx* mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
if (skeleton == NULL) {
return;
}
- gfxCtx = globalCtx->state.gfxCtx;
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
- SysMatrix_StatePush();
+ gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
+ rootLimb = (LodLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
- rot = limbDrawTable[1];
+ rot = jointTable[1];
- dList[0] = limbEntry->displayLists[dListIndex];
- dList[1] = dList[0];
+ newDList = limbDList = rootLimb->dLists[lod];
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList[1] != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, SysMatrix_GetStateAsRSPMatrix(mtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList[1]);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], newDList);
+ POLY_OPA_DISP = &polyTemp[2];
mtx++;
- } else if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(mtx);
+ } else if (limbDList != NULL) {
+ Matrix_ToMtx(mtx);
mtx++;
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, 1, &dList[1], &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, 1, &newDList, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, dListIndex, &mtx);
+ if (rootLimb->child != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, lod, &mtx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
/*
* Draws the limb of the Skeleton `skeleton` at `limbIndex`
*/
-void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) {
- StandardLimb* limbEntry;
+void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor) {
+ StandardLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- s32 pad;
- SysMatrix_StatePush();
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ Matrix_StatePush();
+
+ limb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
- dList = limbEntry->displayLists[0];
+ rot = jointTable[limbIndex];
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
+ dList = limb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], dList);
+ POLY_OPA_DISP = &polyTemp[2];
}
}
@@ -292,53 +288,54 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_DrawLimb(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor);
+ if (limb->child != LIMB_DONE) {
+ SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
- actor);
+ if (limb->sibling != LIMB_DONE) {
+ SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
}
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw,
- PostLimbDraw postLimbDraw, Actor* actor) {
+/**
+ * Draw all limbs of type `StandardLimb` in a given skeleton to the polyOpa buffer
+ */
+void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor) {
StandardLimb* rootLimb;
s32 pad;
Gfx* dList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx;
- s32 pad2;
if (skeleton == NULL) {
return;
}
- gfxCtx = globalCtx->state.gfxCtx;
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_StatePush();
- rootLimb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ Matrix_StatePush();
+ rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
- rot = limbDrawTable[1];
- dList = rootLimb->displayLists[0];
+ rot = jointTable[1];
+ dList = rootLimb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], dList);
+ POLY_OPA_DISP = &polyTemp[2];
}
}
@@ -346,318 +343,333 @@ void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTa
postLimbDraw(globalCtx, 1, &dList, &rot, actor);
}
- if (rootLimb->firstChildIndex != LIMB_DONE) {
- SkelAnime_DrawLimb(globalCtx, rootLimb->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor);
+ if (rootLimb->child != LIMB_DONE) {
+ SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor,
- RSPMatrix** limbMatricies) {
- StandardLimb* limbEntry;
- Gfx* dList[2];
+void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor,
+ Mtx** limbMatricies) {
+ StandardLimb* limb;
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- s32 pad;
- SysMatrix_StatePush();
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ Matrix_StatePush();
+
+ limb = Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
+ rot = jointTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- dList[0] = limbEntry->displayLists[0];
- dList[1] = dList[0];
+ newDList = limbDList = limb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList[1] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*limbMatricies);
- gSPMatrix(gfxCtx->polyOpa.p++, *limbMatricies, G_MTX_LOAD);
- gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]);
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ Matrix_ToMtx(*limbMatricies);
+ gSPMatrix(POLY_OPA_DISP++, *limbMatricies, G_MTX_LOAD);
+ gSPDisplayList(POLY_OPA_DISP++, newDList);
(*limbMatricies)++;
- } else if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*limbMatricies);
+ } else if (limbDList != NULL) {
+ Matrix_ToMtx(*limbMatricies);
(*limbMatricies)++;
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, limbIndex, &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_DrawLimbSV(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, limbMatricies);
+ if (limb->child != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ limbMatricies);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, limbMatricies);
+ if (limb->sibling != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ limbMatricies);
}
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor) {
- StandardLimb* limbEntry;
+/**
+ * Draw all limbs of type `StandardLimb` in a given flexible skeleton to the polyOpa buffer
+ * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
+ * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
+ */
+void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor) {
+ StandardLimb* rootLimb;
s32 pad;
- Gfx* dList[2];
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- RSPMatrix* mtx;
- GraphicsContext* gfxCtx;
- s32 pad2;
-
- mtx = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(RSPMatrix) * dListCount));
+ Mtx* mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
if (skeleton == NULL) {
return;
}
- gfxCtx = globalCtx->state.gfxCtx;
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
+ gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
- rot = limbDrawTable[1];
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
+ rot = jointTable[1];
- dList[0] = limbEntry->displayLists[0];
- dList[1] = dList[0];
+ newDList = limbDList = rootLimb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList[1] != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, SysMatrix_GetStateAsRSPMatrix(mtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList[1]);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], newDList);
+ POLY_OPA_DISP = &polyTemp[2];
mtx++;
} else {
- if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(mtx);
+ if (limbDList != NULL) {
+ Matrix_ToMtx(mtx);
mtx++;
}
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, 1, &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, 1, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- SkelAnime_DrawLimbSV(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, &mtx);
+ if (rootLimb->child != LIMB_DONE) {
+ SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, &mtx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor,
- RSPMatrix** mtx) {
- StandardLimb* limbEntry;
- Gfx* dList[2];
+void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, UnkActorDraw unkDraw,
+ Actor* actor, Mtx** mtx) {
+ StandardLimb* limb;
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- s32 pad2;
- SysMatrix_StatePush();
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ Matrix_StatePush();
+
+ limb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
+ rot = jointTable[limbIndex];
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- dList[0] = limbEntry->displayLists[0];
- dList[1] = dList[0];
+ newDList = limbDList = limb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- SysMatrix_StatePush();
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ Matrix_StatePush();
+
+ //! @bug Does not check unkDraw is not NULL before calling it.
unkDraw(globalCtx, limbIndex, actor);
- if (dList[1] != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
+ if (newDList != NULL) {
+ Gfx* polyTemp = POLY_OPA_DISP;
- gSPMatrix(polyTemp, SysMatrix_GetStateAsRSPMatrix(*mtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList[1]);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ gSPMatrix(&polyTemp[0], Matrix_ToMtx(*mtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], newDList);
+ POLY_OPA_DISP = &polyTemp[2];
(*mtx)++;
} else {
- if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*mtx);
+ if (limbDList != NULL) {
+ Matrix_ToMtx(*mtx);
(*mtx)++;
}
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, limbIndex, &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- func_80134148(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
- unkDraw, actor, mtx);
+ if (limb->child != LIMB_DONE) {
+ func_80134148(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, unkDraw, actor,
+ mtx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- func_80134148(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
- unkDraw, actor, mtx);
+ if (limb->sibling != LIMB_DONE) {
+ func_80134148(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, unkDraw, actor,
+ mtx);
}
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
- OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor) {
- StandardLimb* limbEntry;
+void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, UnkActorDraw unkDraw,
+ Actor* actor) {
+ StandardLimb* rootLimb;
s32 pad;
- Gfx* dList[2];
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- RSPMatrix* mtx;
- GraphicsContext* gfxCtx;
- s32 pad2;
+ Mtx* mtx;
if (skeleton == NULL) {
return;
}
- gfxCtx = globalCtx->state.gfxCtx;
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- mtx = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(RSPMatrix) * dListCount));
+ mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
- gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
+ gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ rootLimb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
- rot = limbDrawTable[1];
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
+ rot = jointTable[1];
- dList[0] = limbEntry->displayLists[0];
- dList[1] = dList[0];
+ newDList = limbDList = rootLimb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- SysMatrix_StatePush();
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) {
+ Matrix_JointPosition(&pos, &rot);
+ Matrix_StatePush();
+
+ //! @bug Does not check unkDraw is not NULL before calling it.
unkDraw(globalCtx, 1, actor);
- if (dList[1] != NULL) {
- Gfx* polyTemp = gfxCtx->polyOpa.p;
- gSPMatrix(polyTemp, SysMatrix_GetStateAsRSPMatrix(mtx), G_MTX_LOAD);
- gSPDisplayList(polyTemp + 1, dList[1]);
- gfxCtx->polyOpa.p = polyTemp + 2;
+ if (newDList != NULL) {
+ Gfx* polyTemp = POLY_OPA_DISP;
+
+ gSPMatrix(&polyTemp[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
+ gSPDisplayList(&polyTemp[1], newDList);
+ POLY_OPA_DISP = &polyTemp[2];
mtx++;
} else {
- if (dList[0] != NULL) {
- SysMatrix_GetStateAsRSPMatrix(mtx++);
+ if (limbDList != NULL) {
+ Matrix_ToMtx(mtx++);
}
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, 1, &dList[0], &rot, actor);
+ postLimbDraw(globalCtx, 1, &limbDList, &rot, actor);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- func_80134148(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
- unkDraw, actor, &mtx);
+ if (rootLimb->child != LIMB_DONE) {
+ func_80134148(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, unkDraw, actor,
+ &mtx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-/*
- * Copies the rotation values from the rotation value table, indexed by the rotation index table
- * When a rotation index is >= the animation limit, the output rotation value is copied from the frame's
- * rotation value list, otherwise it is copied from the initial rotation value list
+/**
+ * Copies frame data from the frame data table, indexed by the joint index table.
+ * Indices below staticIndexMax are copied from that entry in the static frame data table.
+ * Indices above staticIndexMax are offsets to a frame data array indexed by the frame.
*/
-void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32 limbCount, Vec3s* dst) {
- AnimationHeader* animationHeader = Lib_SegmentedToVirtual(animationSeg);
- JointIndex* index = Lib_SegmentedToVirtual(animationHeader->jointIndices);
- AnimationRotationValue* rotationValueTable = Lib_SegmentedToVirtual(animationHeader->frameData);
- AnimationRotationValue* frameRotationValueTable = &rotationValueTable[currentFrame];
+void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable) {
+ AnimationHeader* animHeader = Lib_SegmentedToVirtual(animation);
+ JointIndex* jointIndices = Lib_SegmentedToVirtual(animHeader->jointIndices);
+ s16* frameData = Lib_SegmentedToVirtual(animHeader->frameData);
+ s16* dynamicData = &frameData[frame];
s32 i;
- u16 limit = animationHeader->staticIndexMax;
+ u16 staticIndexMax = animHeader->staticIndexMax;
for (i = 0; i < limbCount; i++) {
// Debug prints here, this is needed to prevent loop unrolling
if (0) {
if (0) {};
}
- dst->x = index->x >= limit ? frameRotationValueTable[index->x] : rotationValueTable[index->x];
- dst->y = index->y >= limit ? frameRotationValueTable[index->y] : rotationValueTable[index->y];
- dst->z = index->z >= limit ? frameRotationValueTable[index->z] : rotationValueTable[index->z];
- index++, dst++;
+ frameTable->x = jointIndices->x >= staticIndexMax ? dynamicData[jointIndices->x] : frameData[jointIndices->x];
+ frameTable->y = jointIndices->y >= staticIndexMax ? dynamicData[jointIndices->y] : frameData[jointIndices->y];
+ frameTable->z = jointIndices->z >= staticIndexMax ? dynamicData[jointIndices->z] : frameData[jointIndices->z];
+ jointIndices++, frameTable++;
}
}
-s16 SkelAnime_GetTotalFrames(AnimationHeaderCommon* animationSeg) {
- AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
- return animation->frameCount;
+s16 Animation_GetLength(void* animation) {
+ AnimationHeaderCommon* common = Lib_SegmentedToVirtual(animation);
+
+ return common->frameCount;
}
-s16 SkelAnime_GetFrameCount(AnimationHeaderCommon* animationSeg) {
- AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
+s16 Animation_GetLastFrame(void* animation) {
+ AnimationHeaderCommon* common = Lib_SegmentedToVirtual(animation);
- return (u16)animation->frameCount - 1;
+ return (u16)common->frameCount - 1;
}
/*
* Draws the Skeleton `skeleton`'s limb at index `limbIndex`. Appends all generated graphics commands to
* `gfx`. Returns a pointer to the next gfx to be appended to.
*/
-Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
- StandardLimb* limbEntry;
+Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
+ StandardLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ limb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
+ rot = jointTable[limbIndex];
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- dList = limbEntry->displayLists[0];
+ dList = limb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx)) {
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(gfx + 1, dList);
- gfx = gfx + 2;
+ gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPDisplayList(&gfx[1], dList);
+ gfx = &gfx[2];
}
}
@@ -665,16 +677,16 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleto
postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor, &gfx);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, gfx);
+ if (limb->child != LIMB_DONE) {
+ gfx = SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ gfx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, gfx);
+ if (limb->sibling != LIMB_DONE) {
+ gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor,
+ gfx);
}
return gfx;
@@ -684,9 +696,9 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleto
* Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the
* next gfx to be appended to.
*/
-Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
- StandardLimb* limbEntry;
+Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
+ PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
+ StandardLimb* rootLimb;
s32 pad;
Gfx* dList;
Vec3f pos;
@@ -696,23 +708,24 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawT
return NULL;
}
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ rootLimb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
- rot = limbDrawTable[1];
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
- dList = limbEntry->displayLists[0];
+ rot = jointTable[1];
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
+ dList = rootLimb->dList;
+
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx)) {
+ Matrix_JointPosition(&pos, &rot);
if (dList != NULL) {
- gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
- gSPDisplayList(gfx + 1, dList);
- gfx = gfx + 2;
+ gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
+ gSPDisplayList(&gfx[1], dList);
+ gfx = &gfx[2];
}
}
@@ -720,202 +733,285 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawT
postLimbDraw(globalCtx, 1, &dList, &rot, actor, &gfx);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, gfx);
+ if (rootLimb->child != LIMB_DONE) {
+ gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, gfx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
return gfx;
}
-/*
- * Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the
- * next gfx to be appended to. Allocates matricies for display lists on the graph heap.
+/**
+ * Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer
*/
-Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable,
- OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor,
- RSPMatrix** mtx, Gfx* gfx) {
- StandardLimb* limbEntry;
- Gfx* dList1;
- Gfx* dList2;
+Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Mtx** mtx,
+ Gfx* gfx) {
+ StandardLimb* limb;
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
+ limb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]);
limbIndex++;
- rot = limbDrawTable[limbIndex];
+ rot = jointTable[limbIndex];
- pos.x = limbEntry->translation.x;
- pos.y = limbEntry->translation.y;
- pos.z = limbEntry->translation.z;
+ pos.x = limb->jointPos.x;
+ pos.y = limb->jointPos.y;
+ pos.z = limb->jointPos.z;
- dList1 = dList2 = limbEntry->displayLists[0];
+ newDList = limbDList = limb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList1, &pos, &rot, actor, &gfx) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList1 != NULL) {
- gSPMatrix(gfx, SysMatrix_GetStateAsRSPMatrix(*mtx), G_MTX_LOAD);
- gSPDisplayList(gfx + 1, dList1);
- gfx = gfx + 2;
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ gSPMatrix(&gfx[0], Matrix_ToMtx(*mtx), G_MTX_LOAD);
+ gSPDisplayList(&gfx[1], newDList);
+ gfx = &gfx[2];
(*mtx)++;
} else {
- if (dList2 != NULL) {
- SysMatrix_GetStateAsRSPMatrix(*mtx);
+ if (limbDList != NULL) {
+ Matrix_ToMtx(*mtx);
(*mtx)++;
}
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, limbIndex, &dList2, &rot, actor, &gfx);
+ postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, mtx, gfx);
+ if (limb->child != LIMB_DONE) {
+ gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, mtx, gfx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
- if (limbEntry->nextLimbIndex != LIMB_DONE) {
- gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, mtx, gfx);
+ if (limb->sibling != LIMB_DONE) {
+ gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, mtx, gfx);
}
return gfx;
}
-Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, s32 dListCount,
- OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, Gfx* gfx) {
- StandardLimb* limbEntry;
+/**
+ * Draw all limbs of type `StandardLimb` in a given flexible skeleton to the specified display buffer
+ * Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
+ * An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
+ */
+Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
+ OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
+ StandardLimb* rootLimb;
s32 pad;
- Gfx* dList1;
- Gfx* dList2;
+ Gfx* newDList;
+ Gfx* limbDList;
Vec3f pos;
Vec3s rot;
- RSPMatrix* mtx;
+ Mtx* mtx;
if (skeleton == NULL) {
return NULL;
}
- mtx = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(RSPMatrix) * dListCount));
+ mtx = (Mtx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount));
gSPSegment(gfx++, 0xD, mtx);
- SysMatrix_StatePush();
+ Matrix_StatePush();
- limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]);
+ rootLimb = Lib_SegmentedToVirtual(skeleton[0]);
- pos.x = limbDrawTable[0].x;
- pos.y = limbDrawTable[0].y;
- pos.z = limbDrawTable[0].z;
+ pos.x = jointTable[0].x;
+ pos.y = jointTable[0].y;
+ pos.z = jointTable[0].z;
- rot = limbDrawTable[1];
+ rot = jointTable[1];
- dList1 = dList2 = limbEntry->displayLists[0];
+ newDList = limbDList = rootLimb->dList;
- if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList1, &pos, &rot, actor, &gfx) == 0)) {
- SysMatrix_RotateAndTranslateState(&pos, &rot);
- if (dList1 != NULL) {
- gSPMatrix(gfx, SysMatrix_GetStateAsRSPMatrix(mtx), G_MTX_LOAD);
- gSPDisplayList(gfx + 1, dList1);
- gfx = gfx + 2;
+ if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor, &gfx)) {
+ Matrix_JointPosition(&pos, &rot);
+ if (newDList != NULL) {
+ gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD);
+ gSPDisplayList(&gfx[1], newDList);
+ gfx = &gfx[2];
mtx++;
} else {
- if (dList2 != NULL) {
- SysMatrix_GetStateAsRSPMatrix(mtx);
+ if (limbDList != NULL) {
+ Matrix_ToMtx(mtx);
mtx++;
}
}
}
if (postLimbDraw != NULL) {
- postLimbDraw(globalCtx, 1, &dList2, &rot, actor, &gfx);
+ postLimbDraw(globalCtx, 1, &limbDList, &rot, actor, &gfx);
}
- if (limbEntry->firstChildIndex != LIMB_DONE) {
- gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->firstChildIndex, skeleton, limbDrawTable, overrideLimbDraw,
- postLimbDraw, actor, &mtx, gfx);
+ if (rootLimb->child != LIMB_DONE) {
+ gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
+ actor, &mtx, gfx);
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
return gfx;
}
-// Function is unused.
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_80134FFC.s")
-
-s16 func_801353D4(AnimationHeaderCommon* animationSeg) {
- AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
-
- return animation->unk02;
-}
-
-/*
- * Appears to be unused anywhere in the game. Appears to be a clone of
- * SkelAnime_GetTotalFrames
+/**
+ * Unpacks frame data for the animation at the given frame into frameTable
+ * Used by the legacy animation format
*/
-s16 SkelAnime_GetTotalFrames2(AnimationHeaderCommon* animationSeg) {
- AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
-
- return animation->frameCount;
-}
-
-/*
- * Appears to be unused anywhere in the game. Appears to be a clone of
- * SkelAnime_GetFrameCount
- */
-s16 SkelAnime_GetFrameCount2(AnimationHeaderCommon* animationSeg) {
- AnimationHeaderCommon* animation = Lib_SegmentedToVirtual(animationSeg);
-
- return animation->frameCount - 1;
-}
-
-void SkelAnime_InterpolateVec3s(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf) {
+#ifdef NON_MATCHING
+// equivalent, minor reordering
+s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable) {
+ LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation);
+ s16 limbCount = animHeader->limbCount;
+ JointKey* key = Lib_SegmentedToVirtual(animHeader->jointKey);
+ s16* frameData = Lib_SegmentedToVirtual(animHeader->frameData);
+ s16* staticData = &frameData[0];
+ s16* dynamicData = &frameData[frame];
s32 i;
- s16 dist;
- s16 temp2;
- if (unkf < 1.0f) {
- for (i = 0; i < limbCount; i++, dst++, vec2++, vec3++) {
- temp2 = vec2->x;
- dist = vec3->x - temp2;
- dst->x = (s16)(dist * unkf) + temp2;
- temp2 = vec2->y;
- dist = vec3->y - temp2;
- dst->y = (s16)(dist * unkf) + temp2;
- temp2 = vec2->z;
- dist = vec3->z - temp2;
- dst->z = (s16)(dist * unkf) + temp2;
+ /**
+ *Equivalent to the following, but the compiler optimizes the loop in a way I can't replicate
+ */
+ /*
+ for(i = 0, frameTable++, key++; i < limbCount + 1; i++, key++, frameTable++) {
+ frameTable->x = frame < key->xMax ? dynamicData[key->x] : staticData[key->x];
+ frameTable->y = frame < key->yMax ? dynamicData[key->y] : staticData[key->y];
+ frameTable->z = frame < key->zMax ? dynamicData[key->z] : staticData[key->z];
+ }
+ */
+ frameTable->x = frame < key->xMax ? dynamicData[key->x] : staticData[key->x];
+ frameTable->y = frame < key->yMax ? dynamicData[key->y] : staticData[key->y];
+ frameTable->z = frame < key->zMax ? dynamicData[key->z] : staticData[key->z];
+
+ i = 1;
+ frameTable++;
+ key++;
+
+ if (limbCount & 1) {}
+
+ if (limbCount > 0) {
+ if (limbCount & 1) {
+ i++;
+ frameTable->x = frame < key->xMax ? dynamicData[key->x] : staticData[key->x];
+ frameTable->y = frame < key->yMax ? dynamicData[key->y] : staticData[key->y];
+ frameTable->z = frame < key->zMax ? dynamicData[key->z] : staticData[key->z];
+ key++;
+ frameTable++;
+ if (limbCount + 1 == i) {
+ goto ret;
+ }
+ }
+ do {
+ i += 2;
+ frameTable->x = frame < key->xMax ? dynamicData[key->x] : staticData[key->x];
+ frameTable->y = frame < key->yMax ? dynamicData[key->y] : staticData[key->y];
+ frameTable->z = frame < key->zMax ? dynamicData[key->z] : staticData[key->z];
+ key++;
+ frameTable++;
+ frameTable->x = frame < key->xMax ? dynamicData[key->x] : staticData[key->x];
+ frameTable->y = frame < key->yMax ? dynamicData[key->y] : staticData[key->y];
+ frameTable->z = frame < key->zMax ? dynamicData[key->z] : staticData[key->z];
+ key++;
+ frameTable++;
+ } while (i != limbCount + 1);
+ }
+
+ret:
+ return limbCount;
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_GetFrameData2.s")
+#endif
+
+/**
+ * Used by legacy animation format
+ */
+s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation) {
+ LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation);
+
+ return animHeader->limbCount;
+}
+
+/**
+ * Used by legacy animation format
+ */
+s16 Animation_GetLength2(LegacyAnimationHeader* animation) {
+ LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation);
+
+ return animHeader->frameCount;
+}
+
+/**
+ * Used by legacy animation format
+ */
+s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation) {
+ AnimationHeaderCommon* animHeader = Lib_SegmentedToVirtual(animation);
+
+ return animHeader->frameCount - 1;
+}
+
+/**
+ * Linearly interpolates the start and tactoret frame tables with the given weight, putting the result in dst
+ */
+void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* tactoret, f32 weight) {
+ s32 i;
+ s16 diff;
+ s16 base;
+
+ if (weight < 1.0f) {
+ for (i = 0; i < limbCount; i++, dst++, start++, tactoret++) {
+ base = start->x;
+ diff = tactoret->x - base;
+ dst->x = (s16)(diff * weight) + base;
+ base = start->y;
+ diff = tactoret->y - base;
+ dst->y = (s16)(diff * weight) + base;
+ base = start->z;
+ diff = tactoret->z - base;
+ dst->z = (s16)(diff * weight) + base;
}
} else {
- for (i = 0; i < limbCount; i++, dst++, vec3++) {
- dst->x = vec3->x;
- dst->y = vec3->y;
- dst->z = vec3->z;
+ for (i = 0; i < limbCount; i++, dst++, tactoret++) {
+ dst->x = tactoret->x;
+ dst->y = tactoret->y;
+ dst->z = tactoret->z;
}
}
}
-void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx) {
+/**
+ * Zeroes out the current request count
+ */
+void AnimationContext_Reset(AnimationContext* animationCtx) {
animationCtx->animationCount = 0;
}
-void func_801358D4(GlobalContext* globalCtx) {
- D_801F5AB0 *= 2;
+/**
+ * Shifts the queue flag to the next queue
+ */
+void AnimationContext_SetNextQueue(GlobalContext* globalCtx) {
+ sAnimQueueFlags <<= 1;
}
-void func_801358F4(GlobalContext* globalCtx) {
- D_801F5AB4 |= D_801F5AB0;
+/**
+ * Disables the current animation queue. Only load and move actor requests will be processed for that queue.
+ */
+void AnimationContext_DisableQueue(GlobalContext* globalCtx) {
+ sDisableAnimQueueFlags |= sAnimQueueFlags;
}
-AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationType type) {
+AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, AnimationType type) {
AnimationEntry* entry;
s16 index = animationCtx->animationCount;
@@ -929,807 +1025,991 @@ AnimationEntry* SkelAnime_NextEntry(AnimationContext* animationCtx, AnimationTyp
return entry;
}
-/*
- * The next 6 functions are coordinate with the AnimationType enum
+/**
+ * Requests loading frame data from the Link animation into frameTable
*/
-
-void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimationHeader* linkAnimetionSeg, s32 frame,
- s32 limbCount, void* ram) {
- AnimationEntry* entry;
- LinkAnimationHeader* LinkAnimationHeader;
- s32 pad;
-
- entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_LINKANIMETION);
+void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
+ Vec3s* frameTable) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMATION_LINKANIMETION);
if (entry != NULL) {
- LinkAnimationHeader = Lib_SegmentedToVirtual(linkAnimetionSeg);
- osCreateMesgQueue(&entry->types.type0.msgQueue, &entry->types.type0.msg, 1);
- DmaMgr_SendRequestImpl(
- &entry->types.type0.req, ram,
- LINK_ANIMETION_OFFSET(LinkAnimationHeader->segment, (sizeof(Vec3s) * limbCount + 2) * frame),
- sizeof(Vec3s) * limbCount + 2, 0, &entry->types.type0.msgQueue, NULL);
+ LinkAnimationHeader* linkAnimHeader = (LinkAnimationHeader*)Lib_SegmentedToVirtual(animation);
+ u32 ram = frameTable;
+
+ osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
+ DmaMgr_SendRequestImpl(&entry->data.load.req, ram,
+ LINK_ANIMETION_OFFSET(linkAnimHeader->segment, (sizeof(Vec3s) * limbCount + 2) * frame),
+ sizeof(Vec3s) * limbCount + 2, 0, &entry->data.load.msgQueue, NULL);
}
}
-void SkelAnime_LoadAnimationType1(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) {
- AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE1);
+/**
+ * Requests copying all vectors from src frame table into dst frame table
+ */
+void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYALL);
if (entry != NULL) {
- entry->types.type1.unk00 = D_801F5AB0;
- entry->types.type1.vecCount = vecCount;
- entry->types.type1.dst = dst;
- entry->types.type1.src = src;
+ entry->data.copy.queueFlag = sAnimQueueFlags;
+ entry->data.copy.vecCount = vecCount;
+ entry->data.copy.dst = dst;
+ entry->data.copy.src = src;
}
}
-void SkelAnime_LoadAnimationType2(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4) {
- AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE2);
+/**
+ * Requests interpolating between base and mod frame tables with the given weight, placing the result in base
+ */
+void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_INTERP);
if (entry != NULL) {
- entry->types.type2.unk00 = D_801F5AB0;
- entry->types.type2.limbCount = limbCount;
- entry->types.type2.unk04 = arg2;
- entry->types.type2.unk08 = arg3;
- entry->types.type2.unk0C = arg4;
+ entry->data.interp.queueFlag = sAnimQueueFlags;
+ entry->data.interp.vecCount = vecCount;
+ entry->data.interp.base = base;
+ entry->data.interp.mod = mod;
+ entry->data.interp.weight = weight;
}
}
-void SkelAnime_LoadAnimationType3(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index) {
- AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE3);
+/**
+ * Requests copying vectors from src frame table to dst frame table whose load flag is true
+ */
+void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYTRUE);
if (entry != NULL) {
- entry->types.type3.unk00 = D_801F5AB0;
- entry->types.type3.vecCount = vecCount;
- entry->types.type3.dst = dst;
- entry->types.type3.src = src;
- entry->types.type3.index = index;
+ entry->data.copy1.queueFlag = sAnimQueueFlags;
+ entry->data.copy1.vecCount = vecCount;
+ entry->data.copy1.dst = dst;
+ entry->data.copy1.src = src;
+ entry->data.copy1.copyFlag = copyFlag;
}
}
-void SkelAnime_LoadAnimationType4(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index) {
- AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE4);
+/**
+ * Requests copying vectors from src frame table to dst frame table whose load flag is false
+ */
+void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYFALSE);
if (entry != NULL) {
- entry->types.type4.unk00 = D_801F5AB0;
- entry->types.type4.vecCount = vecCount;
- entry->types.type4.dst = dst;
- entry->types.type4.src = src;
- entry->types.type4.index = index;
+ entry->data.copy0.queueFlag = sAnimQueueFlags;
+ entry->data.copy0.vecCount = vecCount;
+ entry->data.copy0.dst = dst;
+ entry->data.copy0.src = src;
+ entry->data.copy0.copyFlag = copyFlag;
}
}
-void SkelAnime_LoadAnimationType5(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3) {
- AnimationEntry* entry = SkelAnime_NextEntry(&globalCtx->animationCtx, ANIMATION_TYPE5);
+/**
+ * Requests moving an actor according to the translation of its root limb
+ */
+void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 actor3) {
+ AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_MOVEACTOR);
if (entry != NULL) {
- entry->types.type5.actor = actor;
- entry->types.type5.skelAnime = skelAnime;
- entry->types.type5.unk08 = arg3;
+ entry->data.move.actor = actor;
+ entry->data.move.skelAnime = skelAnime;
+ entry->data.move.unk08 = actor3;
}
}
-/* The next functions are callbacks to loading animations */
+/**
+ * Receives the request for Link's animation frame data
+ */
+void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryLoadFrame* entry = &data->load;
-void SkelAnime_LinkAnimetionLoaded(GlobalContext* globalCtx, AnimationEntryType0* entry) {
osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK);
}
-void SkelAnime_AnimationType1Loaded(GlobalContext* globalCtx, AnimationEntryType1* entry) {
- s32 i;
- Vec3s* dst;
- Vec3s* src;
- AnimationEntryRaw* genericEntry = (AnimationEntryRaw*)entry;
+/**
+ * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table
+ */
+void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryCopyAll* entry = &data->copy;
- if ((genericEntry->raw[0] & D_801F5AB4) != 0) {
- return;
- }
+ if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
+ Vec3s* dst = entry->dst;
+ Vec3s* src = entry->src;
+ s32 i;
- for (dst = entry->dst, src = entry->src, i = 0; i < genericEntry->raw[1]; i++) {
- *dst++ = *src++;
+ for (i = 0; i < entry->vecCount; i++) {
+ *dst++ = *src++;
+ }
}
}
-void SkelAnime_AnimationType2Loaded(GlobalContext* globalCtx, AnimationEntryType2* entry) {
- if ((entry->unk00 & D_801F5AB4) == 0) {
- SkelAnime_InterpolateVec3s(entry->limbCount, entry->unk04, entry->unk04, entry->unk08, entry->unk0C);
+/**
+ * If the entry's queue is enabled, interpolates between the base and mod frame tables, placing the result in base
+ */
+void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryInterp* entry = &data->interp;
+
+ if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
+ SkelAnime_InterpFrameTable(entry->vecCount, entry->base, entry->base, entry->mod, entry->weight);
}
}
-void SkelAnime_AnimationType3Loaded(GlobalContext* globalCtx, AnimationEntryType3* entry) {
- s32 i;
- Vec3s* dst;
- Vec3s* src;
- u8* index;
- AnimationEntryRaw* rawEntry = (AnimationEntryRaw*)entry;
+/**
+ * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is true
+ */
+void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryCopyTrue* entry = &data->copy1;
- if ((rawEntry->raw[0] & D_801F5AB4) == 0) {
- for (dst = entry->dst, src = entry->src, index = entry->index, i = 0; i < rawEntry->raw[1]; i++, dst++, src++) {
- if (*index++) {
+ if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
+ Vec3s* dst = entry->dst;
+ Vec3s* src = entry->src;
+ u8* copyFlag = entry->copyFlag;
+ s32 i;
+
+ for (i = 0; i < entry->vecCount; i++, dst++, src++) {
+ if (*copyFlag++) {
*dst = *src;
}
}
}
}
-void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType4* entry) {
- s32 i;
- Vec3s* dst;
- Vec3s* src;
- u8* index;
- AnimationEntryRaw* rawEntry = (AnimationEntryRaw*)entry;
+/**
+ * If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is false
+ */
+void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryCopyFalse* entry = &data->copy0;
- if ((rawEntry->raw[0] & D_801F5AB4) == 0) {
- for (dst = entry->dst, src = entry->src, index = entry->index, i = 0; i < rawEntry->raw[1]; i++, dst++, src++) {
- if (*index++ < 1U) {
+ if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
+ Vec3s* dst = entry->dst;
+ Vec3s* src = entry->src;
+ u8* copyFlag = entry->copyFlag;
+ s32 i;
+
+ for (i = 0; i < entry->vecCount; i++, dst++, src++) {
+ if (!(*copyFlag++)) {
*dst = *src;
}
}
}
}
-void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry) {
- s32 pad;
+/**
+ * Moves an actor according to the translation of its root limb
+ */
+void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data) {
+ AnimEntryMoveActor* entry = &data->move;
Actor* actor = entry->actor;
- Vec3f pos;
+ Vec3f diff;
- func_80137748(entry->skelAnime, &pos, actor->shape.rot.y);
- actor->world.pos.x += (pos.x * actor->scale.x) * entry->unk08;
- actor->world.pos.y += (pos.y * actor->scale.y) * entry->unk08;
- actor->world.pos.z += (pos.z * actor->scale.z) * entry->unk08;
+ SkelAnime_UpdateTranslation(entry->skelAnime, &diff, actor->shape.rot.y);
+ actor->world.pos.x += diff.x * actor->scale.x * entry->unk08;
+ actor->world.pos.y += diff.y * actor->scale.y * entry->unk08;
+ actor->world.pos.z += diff.z * actor->scale.z * entry->unk08;
}
-void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx) {
+/**
+ * Performs all requests in the animation queue, then resets the queue flags.
+ */
+void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx) {
AnimationEntry* entry = animationCtx->entries;
for (; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) {
- sAnimationLoadDone[entry->type](globalCtx, &entry->types);
+ sAnimationLoadDone[entry->type](globalCtx, &entry->data);
}
- D_801F5AB0 = 1;
- D_801F5AB4 = 0;
+ sAnimQueueFlags = 1;
+ sDisableAnimQueueFlags = 0;
}
-void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
- LinkAnimationHeader* linkAnimationHeaderSeg, s32 flags, Vec3s* limbDrawTbl,
- Vec3s* transitionDrawTbl, s32 limbBufCount) {
+/**
+ * Initializes a skeleton to be used with Link animations to a looping animation, dynamically allocating the frame
+ * tables if not given.
+ */
+void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
+ LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable,
+ s32 limbBufCount) {
FlexSkeletonHeader* skeletonHeader;
- s32 headerCount;
+ s32 headerJointCount;
s32 limbCount;
- u32 allocSize;
+ size_t allocSize;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
- headerCount = skeletonHeader->sh.limbCount;
+ headerJointCount = skeletonHeader->sh.limbCount;
skelAnime->initFlags = flags;
- limbCount = (flags & 2) ? headerCount : 1;
+ limbCount = (flags & 2) ? headerJointCount : 1;
if (flags & 1) {
- limbCount += headerCount;
+ limbCount += headerJointCount;
}
if (flags & 4) {
- limbCount += headerCount;
+ limbCount += headerJointCount;
}
skelAnime->limbCount = limbCount;
skelAnime->dListCount = skeletonHeader->dListCount;
- skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.skeletonSeg);
+ skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.segment);
allocSize = sizeof(Vec3s) * limbCount;
if (flags & 8) {
allocSize += 2;
}
- if (limbDrawTbl == NULL) {
- skelAnime->limbDrawTbl = zelda_malloc(allocSize);
- skelAnime->transitionDrawTbl = zelda_malloc(allocSize);
+ if (jointTable == NULL) {
+ skelAnime->jointTable = ZeldaArena_Malloc(allocSize);
+ skelAnime->morphTable = ZeldaArena_Malloc(allocSize);
} else {
- skelAnime->limbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl);
- skelAnime->transitionDrawTbl = (Vec3s*)ALIGN16((u32)transitionDrawTbl);
+ skelAnime->jointTable = (Vec3s*)ALIGN16((u32)jointTable);
+ skelAnime->morphTable = (Vec3s*)ALIGN16((u32)morphTable);
}
- SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f, 0.0f, 0, 0.0f);
+ LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
}
-void func_801360A8(SkelAnime* skelAnime) {
- if (skelAnime->mode < 2) {
- skelAnime->animUpdate = func_80136288;
+/**
+ * Sets the update function of a SkelAnime that uses Link animations based on its mode
+ */
+void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) {
+ if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) {
+ skelAnime->update = LinkAnimation_Loop;
} else {
- skelAnime->animUpdate = func_8013631C;
+ skelAnime->update = LinkAnimation_Once;
}
- skelAnime->transCurrentFrame = 0.0f;
+ skelAnime->morphWeight = 0.0f;
}
-s32 func_801360E0(GlobalContext* globalCtx, SkelAnime* skelAnime) {
- return skelAnime->animUpdate(globalCtx, skelAnime);
+/**
+ * Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it
+ * finishes.
+ */
+s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+ return skelAnime->update(globalCtx, skelAnime);
}
-s32 func_80136104(GlobalContext* globalCtx, SkelAnime* skelAnime) {
- f32 prevUnk28 = skelAnime->transCurrentFrame;
+/**
+ * Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the
+ * animation frame
+ */
+s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+ f32 prevMorphWeight = skelAnime->morphWeight;
f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f;
- skelAnime->transCurrentFrame -= skelAnime->transitionStep * updateRate;
- if (skelAnime->transCurrentFrame <= 0.0f) {
- func_801360A8(skelAnime);
+ skelAnime->morphWeight -= skelAnime->morphRate * updateRate;
+ if (skelAnime->morphWeight <= 0.0f) {
+ LinkAnimation_SetUpdateFunction(skelAnime);
}
- SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->transitionDrawTbl,
- 1.0f - (skelAnime->transCurrentFrame / prevUnk28));
+ AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
+ 1.0f - (skelAnime->morphWeight / prevMorphWeight));
return 0;
}
-void func_801361BC(GlobalContext* globalCtx, SkelAnime* skelAnime) {
- SkelAnime_LoadLinkAnimetion(globalCtx, skelAnime->linkAnimetionSeg, skelAnime->animCurrentFrame,
- skelAnime->limbCount, skelAnime->limbDrawTbl);
- if (skelAnime->transCurrentFrame != 0) {
+/**
+ * Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between
+ * jointTable and morphTable
+ */
+void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+ AnimationContext_SetLoadFrame(globalCtx, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount,
+ skelAnime->jointTable);
+ if (skelAnime->morphWeight != 0) {
f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f;
- skelAnime->transCurrentFrame -= skelAnime->transitionStep * updateRate;
- if (skelAnime->transCurrentFrame <= 0.0f) {
- skelAnime->transCurrentFrame = 0.0f;
+ skelAnime->morphWeight -= skelAnime->morphRate * updateRate;
+ if (skelAnime->morphWeight <= 0.0f) {
+ skelAnime->morphWeight = 0.0f;
} else {
- SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl,
- skelAnime->transitionDrawTbl, skelAnime->transCurrentFrame);
+ AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
+ skelAnime->morphWeight);
}
}
}
-s32 func_80136288(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+/**
+ * Advances a Link animation that loops over its full length
+ */
+s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) {
f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f;
- skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate;
- if (skelAnime->animCurrentFrame < 0.0f) {
- skelAnime->animCurrentFrame += skelAnime->totalFrames;
- } else if (skelAnime->totalFrames <= skelAnime->animCurrentFrame) {
- skelAnime->animCurrentFrame -= skelAnime->totalFrames;
+ skelAnime->curFrame += skelAnime->playSpeed * updateRate;
+ if (skelAnime->curFrame < 0.0f) {
+ skelAnime->curFrame += skelAnime->animLength;
+ } else if (skelAnime->animLength <= skelAnime->curFrame) {
+ skelAnime->curFrame -= skelAnime->animLength;
}
- func_801361BC(globalCtx, skelAnime);
+ LinkAnimation_AnimateFrame(globalCtx, skelAnime);
return 0;
}
-s32 func_8013631C(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+/**
+ * Advances a Link animation that stops at endFrame and returns true when it is reached.
+ */
+s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) {
f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f;
- if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) {
- func_801361BC(globalCtx, skelAnime);
+ if (skelAnime->curFrame == skelAnime->endFrame) {
+ LinkAnimation_AnimateFrame(globalCtx, skelAnime);
return 1;
}
- skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate;
+ skelAnime->curFrame += skelAnime->playSpeed * updateRate;
- if (((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed) > 0.0f) {
- skelAnime->animCurrentFrame = skelAnime->animFrameCount;
+ if (((skelAnime->curFrame - skelAnime->endFrame) * skelAnime->playSpeed) > 0.0f) {
+ skelAnime->curFrame = skelAnime->endFrame;
} else {
- if (skelAnime->animCurrentFrame < 0.0f) {
- skelAnime->animCurrentFrame += skelAnime->totalFrames;
- } else if (skelAnime->totalFrames <= skelAnime->animCurrentFrame) {
- skelAnime->animCurrentFrame -= skelAnime->totalFrames;
+ if (skelAnime->curFrame < 0.0f) {
+ skelAnime->curFrame += skelAnime->animLength;
+ } else if (skelAnime->animLength <= skelAnime->curFrame) {
+ skelAnime->curFrame -= skelAnime->animLength;
}
}
- func_801361BC(globalCtx, skelAnime);
+ LinkAnimation_AnimateFrame(globalCtx, skelAnime);
return 0;
}
-void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate) {
- skelAnime->transCurrentFrame = 1.0f;
- skelAnime->transitionStep = 1.0f / transitionRate;
+/**
+ * Sets a new morph and resets the morph weight for the current animation.
+ */
+void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames) {
+ skelAnime->morphWeight = 1.0f;
+ skelAnime->morphRate = 1.0f / morphFrames;
}
-void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed, f32 frame, f32 frameCount,
- u8 animationMode, f32 transitionRate) {
- skelAnime->mode = animationMode;
- if ((transitionRate != 0.0f) &&
- ((linkAnimationHeaderSeg != skelAnime->linkAnimetionSeg) || (frame != skelAnime->animCurrentFrame))) {
- if (transitionRate < 0) {
- func_801360A8(skelAnime);
- SkelAnime_CopyVec3s(skelAnime, skelAnime->transitionDrawTbl, skelAnime->limbDrawTbl);
- transitionRate = -transitionRate;
+/**
+ * General way to set a new Link animation, allowing choice of playback speed, start frame, end frame, play mode, and
+ * number of transition frames. Positive morph frames morph from the current pose to the start pose of the new
+ * animation, then start the new animation. Negative morph frames start the new animation immediately, modified by the
+ * pose immediately before the animation change.
+ */
+void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
+ f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) {
+ skelAnime->mode = mode;
+ if ((morphFrames != 0.0f) && ((animation != skelAnime->animation) || (startFrame != skelAnime->curFrame))) {
+ if (morphFrames < 0) {
+ LinkAnimation_SetUpdateFunction(skelAnime);
+ SkelAnime_CopyFrameTable(skelAnime, skelAnime->morphTable, skelAnime->jointTable);
+ morphFrames = -morphFrames;
} else {
- skelAnime->animUpdate = func_80136104;
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
- skelAnime->transitionDrawTbl);
+ skelAnime->update = LinkAnimation_Morph;
+ AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
+ skelAnime->morphTable);
}
- skelAnime->transCurrentFrame = 1.0f;
- skelAnime->transitionStep = 1.0f / transitionRate;
+ skelAnime->morphWeight = 1.0f;
+ skelAnime->morphRate = 1.0f / morphFrames;
} else {
- func_801360A8(skelAnime);
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
- skelAnime->limbDrawTbl);
- skelAnime->transCurrentFrame = 0.0f;
+ LinkAnimation_SetUpdateFunction(skelAnime);
+ AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
+ skelAnime->jointTable);
+ skelAnime->morphWeight = 0.0f;
}
- skelAnime->linkAnimetionSeg = linkAnimationHeaderSeg;
- skelAnime->animCurrentFrame = 0.0f;
- skelAnime->initialFrame = frame;
- skelAnime->animCurrentFrame = frame;
- skelAnime->animFrameCount = frameCount;
- skelAnime->totalFrames = SkelAnime_GetTotalFrames(&linkAnimationHeaderSeg->common);
- skelAnime->animPlaybackSpeed = playbackSpeed;
+ skelAnime->animation = animation;
+ skelAnime->curFrame = 0.0f;
+ skelAnime->startFrame = startFrame;
+ skelAnime->curFrame = startFrame;
+ skelAnime->endFrame = endFrame;
+ skelAnime->animLength = Animation_GetLength(animation);
+ skelAnime->playSpeed = playSpeed;
}
-void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg) {
- SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 2, 0.0f);
+/**
+ * Immediately changes to a Link animation that plays once at the default speed.
+ */
+void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
+ LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common),
+ ANIMMODE_ONCE, 0.0f);
}
-void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed) {
- SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, playbackSpeed, 0.0f,
- SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 2, 0.0f);
+/**
+ * Immediately changes to a Link animation that plays once at the specified speed.
+ */
+void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
+ f32 playSpeed) {
+ LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common),
+ ANIMMODE_ONCE, 0.0f);
}
-void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg) {
- SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 0, 0.0f);
+/**
+ * Immediately changes to a Link animation that loops at the default speed.
+ */
+void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
+ LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common),
+ ANIMMODE_LOOP, 0.0f);
}
-void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime,
- LinkAnimationHeader* linkAnimationHeaderSeg, f32 playbackSpeed) {
- SkelAnime_ChangeLinkAnim(globalCtx, skelAnime, linkAnimationHeaderSeg, playbackSpeed, 0.0f,
- SkelAnime_GetFrameCount(&linkAnimationHeaderSeg->common), 0, 0.0f);
+/**
+ * Immediately changes to a Link animation that loops at the specified speed.
+ */
+void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
+ f32 playSpeed) {
+ LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common),
+ ANIMMODE_LOOP, 0.0f);
}
-void func_8013670C(GlobalContext* globalCtx, SkelAnime* skelAnime) {
- SkelAnime_LoadAnimationType1(globalCtx, skelAnime->limbCount, skelAnime->transitionDrawTbl, skelAnime->limbDrawTbl);
+/**
+ * Requests copying jointTable to morphTable
+ */
+void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+ AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable);
}
-void func_8013673C(GlobalContext* globalCtx, SkelAnime* skelAnime) {
- SkelAnime_LoadAnimationType1(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->transitionDrawTbl);
+/**
+ * Requests copying morphTable to jointTable
+ */
+void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime) {
+ AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable);
}
-void func_8013676C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
- f32 frame) {
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
- skelAnime->transitionDrawTbl);
+/**
+ * Requests loading frame data from the Link animation into morphTable
+ */
+void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
+ f32 frame) {
+ AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable);
}
-void func_801367B0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
- f32 frame) {
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)frame, skelAnime->limbCount,
- skelAnime->limbDrawTbl);
+/**
+ * Requests loading frame data from the Link animation into jointTable
+ */
+void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
+ f32 frame) {
+ AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable);
}
-void func_801367F4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame) {
- SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->transitionDrawTbl,
- frame);
+/**
+ * Requests interpolating between jointTable and morphTable, placing the result in jointTable
+ */
+void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 weight) {
+ AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight);
}
-void func_8013682C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
- f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate,
- Vec3s* limbDrawTbl) {
- Vec3s* alignedLimbDrawTbl;
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)transitionFrame, skelAnime->limbCount,
- skelAnime->limbDrawTbl);
+/**
+ * Requests loading frame data from the Link animations and blending them, placing the result in jointTable
+ */
+void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
+ f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
+ Vec3s* blendTable) {
+ Vec3s* alignedBlendTable;
- alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl);
+ AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
- SkelAnime_LoadLinkAnimetion(globalCtx, LinkAnimationHeaderSeg2, (s32)frame, skelAnime->limbCount,
- alignedLimbDrawTbl);
- SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->limbDrawTbl, alignedLimbDrawTbl,
- transitionRate);
+ alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
+
+ AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
+ AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
}
-void func_801368CC(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* linkAnimationHeaderSeg,
- f32 transitionFrame, LinkAnimationHeader* LinkAnimationHeaderSeg2, f32 frame, f32 transitionRate,
- Vec3s* limbDrawTbl) {
- Vec3s* alignedLimbDrawTbl;
+/**
+ * Requests loading frame data from the Link animations and blending them, placing the result in morphTable
+ */
+void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
+ f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
+ Vec3s* blendTable) {
+ Vec3s* alignedBlendTable;
- SkelAnime_LoadLinkAnimetion(globalCtx, linkAnimationHeaderSeg, (s32)transitionFrame, skelAnime->limbCount,
- skelAnime->transitionDrawTbl);
+ AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
- alignedLimbDrawTbl = (Vec3s*)ALIGN16((u32)limbDrawTbl);
+ alignedBlendTable = (Vec3s*)ALIGN16((u32)blendTable);
- SkelAnime_LoadLinkAnimetion(globalCtx, LinkAnimationHeaderSeg2, (s32)frame, skelAnime->limbCount,
- alignedLimbDrawTbl);
- SkelAnime_LoadAnimationType2(globalCtx, skelAnime->limbCount, skelAnime->transitionDrawTbl, alignedLimbDrawTbl,
- transitionRate);
+ AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
+ AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
}
-void SkelAnime_SetModeStop(SkelAnime* skelAnime) {
- skelAnime->mode = 2;
- func_801360A8(skelAnime);
+/**
+ * Changes a looping animation to one that stops at the end.
+ */
+void LinkAnimation_EndLoop(SkelAnime* skelAnime) {
+ skelAnime->mode = ANIMMODE_ONCE;
+ LinkAnimation_SetUpdateFunction(skelAnime);
}
-s32 func_80136990(SkelAnime* skelAnime, f32 arg1, f32 updateRate) {
+/**
+ * Checks if the current frame is after frame and the previous frame was before it.
+ */
+s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate) {
f32 updateSpeed;
- f32 temp_f12;
+ f32 curFrameDiff;
f32 nextFrame;
- updateSpeed = skelAnime->animPlaybackSpeed * updateRate;
- nextFrame = skelAnime->animCurrentFrame - updateSpeed;
+ updateSpeed = skelAnime->playSpeed * updateRate;
+ nextFrame = skelAnime->curFrame - updateSpeed;
if (nextFrame < 0.0f) {
- nextFrame += skelAnime->totalFrames;
- } else if (skelAnime->totalFrames <= nextFrame) {
- nextFrame -= skelAnime->totalFrames;
+ nextFrame += skelAnime->animLength;
+ } else if (skelAnime->animLength <= nextFrame) {
+ nextFrame -= skelAnime->animLength;
}
- if ((arg1 == 0.0f) && (updateSpeed > 0.0f)) {
- arg1 = skelAnime->totalFrames;
+ if ((frame == 0.0f) && (updateSpeed > 0.0f)) {
+ frame = skelAnime->animLength;
}
- temp_f12 = (nextFrame + updateSpeed) - arg1;
- if ((0.0f <= (temp_f12 * updateSpeed)) && (((temp_f12 - updateSpeed) * updateSpeed) < 0.0f)) {
- return 1;
+ curFrameDiff = (nextFrame + updateSpeed) - frame;
+ if ((0.0f <= (curFrameDiff * updateSpeed)) && (((curFrameDiff - updateSpeed) * updateSpeed) < 0.0f)) {
+ return true;
}
- return 0;
+ return false;
}
-s32 func_80136A48(SkelAnime* skelAnime, f32 arg1) {
+/**
+ * Checks if the current Link animation has reached the specified frame
+ */
+s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) {
f32 updateRate = gFramerateDivisorHalf;
- return func_80136990(skelAnime, arg1, updateRate);
+ return Animation_OnFrameImpl(skelAnime, frame, updateRate);
}
+/**
+ * Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided.
+ */
void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
- AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
+ AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
SkeletonHeader* skeletonHeader;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
skelAnime->limbCount = skeletonHeader->limbCount + 1;
- skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
- if (limbDrawTbl == NULL) {
- skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
- skelAnime->transitionDrawTbl = zelda_malloc(sizeof(*skelAnime->transitionDrawTbl) * skelAnime->limbCount);
+ skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->segment);
+ if (jointTable == NULL) {
+ skelAnime->jointTable = ZeldaArena_Malloc(sizeof(*skelAnime->jointTable) * skelAnime->limbCount);
+ skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount);
} else {
- skelAnime->limbDrawTbl = limbDrawTbl;
- skelAnime->transitionDrawTbl = transitionDrawTable;
+ skelAnime->jointTable = jointTable;
+ skelAnime->morphTable = morphTable;
}
- if (animationSeg != NULL) {
- SkelAnime_ChangeAnimDefaultRepeat(skelAnime, animationSeg);
+ if (animation != NULL) {
+ Animation_PlayLoop(skelAnime, animation);
}
}
-void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
- AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
+/**
+ * Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given.
+ */
+void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
+ AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
FlexSkeletonHeader* skeletonHeader;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
skelAnime->limbCount = skeletonHeader->sh.limbCount + 1;
skelAnime->dListCount = skeletonHeader->dListCount;
- skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.skeletonSeg);
+ skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->sh.segment);
- if (limbDrawTbl == NULL) {
- skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
+ if (jointTable == NULL) {
+ skelAnime->jointTable = ZeldaArena_Malloc(sizeof(*skelAnime->jointTable) * skelAnime->limbCount);
- skelAnime->transitionDrawTbl = zelda_malloc(sizeof(*skelAnime->transitionDrawTbl) * skelAnime->limbCount);
+ skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount);
} else {
- skelAnime->limbDrawTbl = limbDrawTbl;
- skelAnime->transitionDrawTbl = transitionDrawTable;
+ skelAnime->jointTable = jointTable;
+ skelAnime->morphTable = morphTable;
}
- if (animationSeg != NULL) {
- SkelAnime_ChangeAnimDefaultRepeat(skelAnime, animationSeg);
+ if (animation != NULL) {
+ Animation_PlayLoop(skelAnime, animation);
}
}
+/**
+ * Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables.
+ */
void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
- AnimationHeader* animationSeg) {
+ AnimationHeader* animation) {
SkeletonHeader* skeletonHeader;
skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
skelAnime->limbCount = skeletonHeader->limbCount + 1;
- skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->skeletonSeg);
- skelAnime->limbDrawTbl = zelda_malloc(sizeof(*skelAnime->limbDrawTbl) * skelAnime->limbCount);
- skelAnime->transitionDrawTbl = zelda_malloc(sizeof(*skelAnime->transitionDrawTbl) * skelAnime->limbCount);
+ skelAnime->skeleton = Lib_SegmentedToVirtual(skeletonHeader->segment);
+ skelAnime->jointTable = ZeldaArena_Malloc(sizeof(*skelAnime->jointTable) * skelAnime->limbCount);
+ skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount);
// Debug prints here, required to match.
if (1) {};
- if (animationSeg != NULL) {
- SkelAnime_ChangeAnimDefaultRepeat(skelAnime, animationSeg);
+ if (animation != NULL) {
+ Animation_PlayLoop(skelAnime, animation);
}
}
-void func_80136C84(SkelAnime* skelAnime) {
- if (skelAnime->mode < 2) {
- skelAnime->animUpdate = func_8013702C;
- } else if (skelAnime->mode < 4) {
- skelAnime->animUpdate = func_8013713C;
+/**
+ * Sets the SkelAnime's update function based on its current mode.
+ */
+void SkelAnime_SetUpdate(SkelAnime* skelAnime) {
+ if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) {
+ skelAnime->update = SkelAnime_LoopFull;
+ } else if (skelAnime->mode <= ANIMMODE_ONCE_INTERP) {
+ skelAnime->update = SkelAnime_Once;
} else {
- skelAnime->animUpdate = func_801370B0;
+ skelAnime->update = SkelAnime_LoopPartial;
}
}
-s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime) {
- return skelAnime->animUpdate(skelAnime);
+/**
+ * Advances the current animation and updates all frame tables. If the animation plays once, returns true when it
+ * finishes.
+ */
+s32 SkelAnime_Update(SkelAnime* skelAnime) {
+ return skelAnime->update(skelAnime);
}
-s32 func_80136CF4(SkelAnime* skelAnime) {
- f32 prevUnk28 = skelAnime->transCurrentFrame;
+/**
+ * Morphs from the pose in jointTable to the one in morphTable, advancing the morph but not the animation frame
+ */
+s32 SkelAnime_Morph(SkelAnime* skelAnime) {
+ f32 prevMorphWeight = skelAnime->morphWeight;
f32 updateRate = gFramerateDivisorThird;
- skelAnime->transCurrentFrame -= skelAnime->transitionStep * updateRate;
- if (skelAnime->transCurrentFrame <= 0.0f) {
- func_80136C84(skelAnime);
- skelAnime->transCurrentFrame = 0.0f;
+ skelAnime->morphWeight -= skelAnime->morphRate * updateRate;
+ if (skelAnime->morphWeight <= 0.0f) {
+ SkelAnime_SetUpdate(skelAnime);
+ skelAnime->morphWeight = 0.0f;
}
- SkelAnime_InterpolateVec3s(skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->limbDrawTbl,
- skelAnime->transitionDrawTbl, 1.0f - (skelAnime->transCurrentFrame / prevUnk28));
+ SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable,
+ skelAnime->morphTable, 1.0f - (skelAnime->morphWeight / prevMorphWeight));
return 0;
}
-s32 func_80136D98(SkelAnime* skelAnime) {
- s16 temp_a2 = (s16)(skelAnime->transCurrentFrame * 16384.0f);
- s16 temp_a1;
- f32 sp28;
- f32 phi_f2;
+/**
+ * Performs a tapered morph from the pose in jointTable to the one in morphTable, advancing the morph but not the
+ * animation frame
+ */
+s32 SkelAnime_MorphTaper(SkelAnime* skelAnime) {
+ s16 prevPhase = skelAnime->morphWeight * 0x4000;
+ s16 curPhase;
+ f32 prevWeight;
+ f32 curWeight;
f32 updateRate = gFramerateDivisorThird;
- skelAnime->transCurrentFrame -= skelAnime->transitionStep * updateRate;
- if (skelAnime->transCurrentFrame <= 0.0f) {
- func_80136C84(skelAnime);
- skelAnime->transCurrentFrame = 0.0f;
+ skelAnime->morphWeight -= skelAnime->morphRate * updateRate;
+ if (skelAnime->morphWeight <= 0.0f) {
+ SkelAnime_SetUpdate(skelAnime);
+ skelAnime->morphWeight = 0.0f;
}
- temp_a1 = (s16)(skelAnime->transCurrentFrame * 16384.0f);
- if (skelAnime->unk03 < 0) {
- sp28 = 1.0f - Math_CosS(temp_a2);
- phi_f2 = 1.0f - Math_CosS(temp_a1);
+ curPhase = skelAnime->morphWeight * 0x4000;
+ if (skelAnime->taper < 0) {
+ prevWeight = 1.0f - Math_CosS(prevPhase);
+ curWeight = 1.0f - Math_CosS(curPhase);
} else {
- sp28 = Math_SinS(temp_a2);
- phi_f2 = Math_SinS(temp_a1);
+ prevWeight = Math_SinS(prevPhase);
+ curWeight = Math_SinS(curPhase);
}
- if (phi_f2 != 0.0f) {
- phi_f2 /= sp28;
+ if (curWeight != 0.0f) {
+ curWeight /= prevWeight;
} else {
- phi_f2 = 0.0f;
+ curWeight = 0.0f;
}
- SkelAnime_InterpolateVec3s(skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->limbDrawTbl,
- skelAnime->transitionDrawTbl, 1.0f - phi_f2);
+ SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable,
+ skelAnime->morphTable, 1.0f - curWeight);
return 0;
}
-void func_80136F04(SkelAnime* skelAnime) {
- s32 t;
- s32 pad[2];
- Vec3s sp38[98];
- f32 temp_f10;
- f32 temp_f2;
+/**
+ * Gets frame data for the current frame as modified by morphTable and advances the morph
+ */
+void SkelAnime_AnimateFrame(SkelAnime* skelAnime) {
+ Vec3s nextjointTable[100];
- SkelAnime_AnimateFrame(skelAnime->animCurrentSeg, skelAnime->animCurrentFrame, skelAnime->limbCount,
- skelAnime->limbDrawTbl);
- if (skelAnime->mode & 0x1) {
- t = (s32)skelAnime->animCurrentFrame;
- temp_f10 = t;
- temp_f2 = skelAnime->animCurrentFrame - temp_f10;
- t++;
- if (t >= (s32)skelAnime->totalFrames) {
- t = 0;
+ SkelAnime_GetFrameData(skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable);
+ if (skelAnime->mode & ANIM_INTERP) {
+ s32 frame = skelAnime->curFrame;
+ f32 partialFrame = skelAnime->curFrame - frame;
+
+ if (++frame >= (s32)skelAnime->animLength) {
+ frame = 0;
}
- SkelAnime_AnimateFrame(skelAnime->animCurrentSeg, t, skelAnime->limbCount, sp38);
- SkelAnime_InterpolateVec3s(skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->limbDrawTbl, sp38, temp_f2);
+ SkelAnime_GetFrameData(skelAnime->animation, frame, skelAnime->limbCount, nextjointTable);
+ SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable, nextjointTable,
+ partialFrame);
}
- if (skelAnime->transCurrentFrame != 0) {
+ if (skelAnime->morphWeight != 0) {
f32 updateRate = gFramerateDivisorThird;
- skelAnime->transCurrentFrame -= skelAnime->transitionStep * updateRate;
- if (skelAnime->transCurrentFrame <= 0.0f) {
- skelAnime->transCurrentFrame = 0.0f;
- return;
+
+ skelAnime->morphWeight -= skelAnime->morphRate * updateRate;
+ if (skelAnime->morphWeight <= 0.0f) {
+ skelAnime->morphWeight = 0.0f;
+ } else {
+ SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable,
+ skelAnime->morphTable, skelAnime->morphWeight);
}
- SkelAnime_InterpolateVec3s(skelAnime->limbCount, skelAnime->limbDrawTbl, skelAnime->limbDrawTbl,
- skelAnime->transitionDrawTbl, skelAnime->transCurrentFrame);
}
}
-
-s32 func_8013702C(SkelAnime* skelAnime) {
+/**
+ * Advances an animation that loops over its full length and updates the frame tables
+ */
+s32 SkelAnime_LoopFull(SkelAnime* skelAnime) {
f32 updateRate = gFramerateDivisorThird;
- skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate;
- if (skelAnime->animCurrentFrame < 0.0f) {
- skelAnime->animCurrentFrame += skelAnime->totalFrames;
- } else if (skelAnime->totalFrames <= skelAnime->animCurrentFrame) {
- skelAnime->animCurrentFrame -= skelAnime->totalFrames;
+ skelAnime->curFrame += skelAnime->playSpeed * updateRate;
+ if (skelAnime->curFrame < 0.0f) {
+ skelAnime->curFrame += skelAnime->animLength;
+ } else if (skelAnime->animLength <= skelAnime->curFrame) {
+ skelAnime->curFrame -= skelAnime->animLength;
}
- func_80136F04(skelAnime);
+ SkelAnime_AnimateFrame(skelAnime);
return 0;
}
-s32 func_801370B0(SkelAnime* skelAnime) {
+/**
+ * Advances an animation that loops over part of its length and updates the frame tables
+ */
+s32 SkelAnime_LoopPartial(SkelAnime* skelAnime) {
f32 updateRate = gFramerateDivisorThird;
- skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate;
- if (skelAnime->animCurrentFrame < skelAnime->initialFrame) {
- skelAnime->animCurrentFrame =
- (skelAnime->animCurrentFrame - skelAnime->initialFrame) + skelAnime->animFrameCount;
- } else if (skelAnime->animFrameCount <= skelAnime->animCurrentFrame) {
- skelAnime->animCurrentFrame =
- (skelAnime->animCurrentFrame - skelAnime->animFrameCount) + skelAnime->initialFrame;
+ skelAnime->curFrame += skelAnime->playSpeed * updateRate;
+ if (skelAnime->curFrame < skelAnime->startFrame) {
+ skelAnime->curFrame = (skelAnime->curFrame - skelAnime->startFrame) + skelAnime->endFrame;
+ } else if (skelAnime->endFrame <= skelAnime->curFrame) {
+ skelAnime->curFrame = (skelAnime->curFrame - skelAnime->endFrame) + skelAnime->startFrame;
}
- func_80136F04(skelAnime);
+ SkelAnime_AnimateFrame(skelAnime);
return 0;
}
-s32 func_8013713C(SkelAnime* skelAnime) {
+/**
+ * Advances an animation that stops at endFrame and returns true when it is reached.
+ */
+s32 SkelAnime_Once(SkelAnime* skelAnime) {
f32 updateRate = gFramerateDivisorThird;
- if (skelAnime->animCurrentFrame == skelAnime->animFrameCount) {
- SkelAnime_AnimateFrame(skelAnime->animCurrentSeg, (s32)skelAnime->animCurrentFrame, skelAnime->limbCount,
- skelAnime->limbDrawTbl);
- func_80136F04(skelAnime);
+ if (skelAnime->curFrame == skelAnime->endFrame) {
+ SkelAnime_GetFrameData(skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable);
+ SkelAnime_AnimateFrame(skelAnime);
return 1;
}
- skelAnime->animCurrentFrame += skelAnime->animPlaybackSpeed * updateRate;
- if (((skelAnime->animCurrentFrame - skelAnime->animFrameCount) * skelAnime->animPlaybackSpeed) > 0.0f) {
- skelAnime->animCurrentFrame = skelAnime->animFrameCount;
+ skelAnime->curFrame += skelAnime->playSpeed * updateRate;
+ if (((skelAnime->curFrame - skelAnime->endFrame) * skelAnime->playSpeed) > 0.0f) {
+ skelAnime->curFrame = skelAnime->endFrame;
} else {
- if (skelAnime->animCurrentFrame < 0.0f) {
- skelAnime->animCurrentFrame += skelAnime->totalFrames;
+ if (skelAnime->curFrame < 0.0f) {
+ skelAnime->curFrame += skelAnime->animLength;
} else {
- if (skelAnime->totalFrames <= skelAnime->animCurrentFrame) {
- skelAnime->animCurrentFrame -= skelAnime->totalFrames;
+ if (skelAnime->animLength <= skelAnime->curFrame) {
+ skelAnime->curFrame -= skelAnime->animLength;
}
}
}
- func_80136F04(skelAnime);
+ SkelAnime_AnimateFrame(skelAnime);
return 0;
}
-void SkelAnime_ChangeAnimImpl(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame,
- f32 frameCount, u8 animationType, f32 transitionRate, s8 unk2) {
- skelAnime->mode = animationType;
- if ((transitionRate != 0.0f) &&
- ((animationSeg != skelAnime->animCurrentSeg) || (frame != skelAnime->animCurrentFrame))) {
- if (transitionRate < 0) {
- func_80136C84(skelAnime);
- SkelAnime_CopyVec3s(skelAnime, skelAnime->transitionDrawTbl, skelAnime->limbDrawTbl);
- transitionRate = -transitionRate;
- } else {
- if (unk2 != 0) {
- skelAnime->animUpdate = func_80136D98;
- skelAnime->unk03 = unk2;
- } else {
- skelAnime->animUpdate = func_80136CF4;
- }
- SkelAnime_AnimateFrame(animationSeg, frame, skelAnime->limbCount, skelAnime->transitionDrawTbl);
- }
- skelAnime->transCurrentFrame = 1.0f;
- skelAnime->transitionStep = 1.0f / transitionRate;
- } else {
- func_80136C84(skelAnime);
- SkelAnime_AnimateFrame(animationSeg, frame, skelAnime->limbCount, skelAnime->limbDrawTbl);
- skelAnime->transCurrentFrame = 0.0f;
- }
-
- skelAnime->animCurrentSeg = animationSeg;
- skelAnime->initialFrame = frame;
- skelAnime->animFrameCount = frameCount;
- skelAnime->totalFrames = SkelAnime_GetTotalFrames(&animationSeg->common);
- if (skelAnime->mode >= 4) {
- skelAnime->animCurrentFrame = 0.0f;
- } else {
- skelAnime->animCurrentFrame = frame;
- if (skelAnime->mode < 2) {
- skelAnime->animFrameCount = skelAnime->totalFrames - 1.0f;
- }
- }
- skelAnime->animPlaybackSpeed = playbackSpeed;
-}
-
-void SkelAnime_ChangeAnim(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed, f32 frame,
- f32 frameCount, u8 mode, f32 transitionRate) {
- SkelAnime_ChangeAnimImpl(skelAnime, animationSeg, playbackSpeed, frame, frameCount, mode, transitionRate, 0);
-}
-
-void SkelAnime_ChangeAnimDefaultStop(SkelAnime* skelAnime, AnimationHeader* animationSeg) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common), 2, 0.0f);
-}
-
-void SkelAnime_ChangeAnimTransitionStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0, SkelAnime_GetFrameCount(&animationSeg->common), 2,
- transitionRate);
-}
-
-void SkelAnime_ChangeAnimPlaybackStop(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common),
- 2, 0.0f);
-}
-
-void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common), 0, 0.0f);
-}
-
-void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 transitionRate) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, 1.0f, 0.0f, 0.0f, 0, transitionRate);
-}
-
-void SkelAnime_ChangeAnimPlaybackRepeat(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 playbackSpeed) {
- SkelAnime_ChangeAnim(skelAnime, animationSeg, playbackSpeed, 0.0f, SkelAnime_GetFrameCount(&animationSeg->common),
- 0, 0.0f);
-}
-
-void SkelAnime_AnimSetStop(SkelAnime* skelAnime) {
- skelAnime->mode = 2;
- skelAnime->animFrameCount = skelAnime->totalFrames;
- func_80136C84(skelAnime);
-}
-
-void SkelAnime_AnimReverse(SkelAnime* skelAnime) {
- f32 initialFrame = skelAnime->initialFrame;
-
- skelAnime->initialFrame = skelAnime->animFrameCount;
- skelAnime->animPlaybackSpeed = -skelAnime->animPlaybackSpeed;
- skelAnime->animFrameCount = initialFrame;
-}
-
-void func_80137674(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index) {
- s32 i;
-
- for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) {
- if (*index++) {
- *dst = *src;
- }
- }
-}
-
-void func_801376DC(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3) {
- s32 i;
-
- for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) {
- if (*arg3++ < 1U) {
- *dst = *src;
- }
- }
-}
-
-/*
- * Moves `pos` backwards on the xz plane from `angle`
+/**
+ * Fully general way to set a new animation, allowing choice of playback speed, start frame, end frame, play mode,
+ * number of transition frames, and tapering of the transition. Positive morph frames morph from the current pose to the
+ * start pose of the new animation, then start the new animation. Negative morph frames start the new animation
+ * immediately, modified by the pose immediately before the animation change.
*/
-void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle) {
+void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame,
+ u8 mode, f32 morphFrames, s8 taper) {
+ skelAnime->mode = mode;
+ if ((morphFrames != 0.0f) && ((animation != skelAnime->animation) || (startFrame != skelAnime->curFrame))) {
+ if (morphFrames < 0) {
+ SkelAnime_SetUpdate(skelAnime);
+ SkelAnime_CopyFrameTable(skelAnime, skelAnime->morphTable, skelAnime->jointTable);
+ morphFrames = -morphFrames;
+ } else {
+ if (taper != ANIMTAPER_NONE) {
+ skelAnime->update = SkelAnime_MorphTaper;
+ skelAnime->taper = taper;
+ } else {
+ skelAnime->update = SkelAnime_Morph;
+ }
+ SkelAnime_GetFrameData(animation, startFrame, skelAnime->limbCount, skelAnime->morphTable);
+ }
+ skelAnime->morphWeight = 1.0f;
+ skelAnime->morphRate = 1.0f / morphFrames;
+ } else {
+ SkelAnime_SetUpdate(skelAnime);
+ SkelAnime_GetFrameData(animation, startFrame, skelAnime->limbCount, skelAnime->jointTable);
+ skelAnime->morphWeight = 0.0f;
+ }
+
+ skelAnime->animation = animation;
+ skelAnime->startFrame = startFrame;
+ skelAnime->endFrame = endFrame;
+ skelAnime->animLength = Animation_GetLength(&animation->common);
+ if (skelAnime->mode >= ANIMMODE_LOOP_PARTIAL) {
+ skelAnime->curFrame = 0.0f;
+ } else {
+ skelAnime->curFrame = startFrame;
+ if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) {
+ skelAnime->endFrame = skelAnime->animLength - 1.0f;
+ }
+ }
+ skelAnime->playSpeed = playSpeed;
+}
+
+/**
+ * General way to set a new animation, allowing choice of playback speed, start frame, end frame, play mode, and number
+ * of transition frames. Positive morph frames morph from the current pose to the start pose of the new animation, then
+ * start the new animation. Negative morph frames start the new animation immediately, modified by the pose immediately
+ * before the animation change.
+ */
+void Animation_Change(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame,
+ u8 mode, f32 morphFrames) {
+ Animation_ChangeImpl(skelAnime, animation, playSpeed, startFrame, endFrame, mode, morphFrames, ANIMTAPER_NONE);
+}
+
+/**
+ * Immediately changes to an animation that plays once at the default speed.
+ */
+void Animation_PlayOnce(SkelAnime* skelAnime, AnimationHeader* animation) {
+ Animation_Change(skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), ANIMMODE_ONCE, 0.0f);
+}
+
+/**
+ * Smoothly transitions to an animation that plays once at the default speed.
+ * Positive morph frames morph from the current pose to the start pose of the new animation, then start the new
+ * animation. Negative morph frames start the new animation immediately, modified by the pose immediately before the
+ * animation change.
+ */
+void Animation_MorphToPlayOnce(SkelAnime* skelAnime, AnimationHeader* animationSeg, f32 morphFrames) {
+ Animation_Change(skelAnime, animationSeg, 1.0f, 0, Animation_GetLastFrame(&animationSeg->common), ANIMMODE_ONCE,
+ morphFrames);
+}
+
+/**
+ * Immediately changes to an animation that plays once at the specified speed.
+ */
+void Animation_PlayOnceSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed) {
+ Animation_Change(skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), ANIMMODE_ONCE,
+ 0.0f);
+}
+
+/**
+ * Immediately changes to an animation that loops at the default.
+ */
+void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation) {
+ Animation_Change(skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), ANIMMODE_LOOP, 0.0f);
+}
+
+/**
+ * Smoothly transitions to a looping animation, specifying the number of frames for the transition.
+ * Positive morph frames morph from the current pose to the start pose of the new animation, then start the new
+ * animation. Negative morph frames start the new animation immediately, modified by the pose immediately before the
+ * animation change.
+ */
+void Animation_MorphToLoop(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames) {
+ Animation_Change(skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, morphFrames);
+}
+
+/**
+ * Immediately changes to an animation that loops at the specified speed.
+ */
+void Animation_PlayLoopSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playbackSpeed) {
+ Animation_Change(skelAnime, animation, playbackSpeed, 0.0f, Animation_GetLastFrame(&animation->common),
+ ANIMMODE_LOOP, 0.0f);
+}
+
+/**
+ * Changes a looping animation to one that stops at the end. Unused
+ */
+void Animation_EndLoop(SkelAnime* skelAnime) {
+ skelAnime->mode = ANIMMODE_ONCE;
+ skelAnime->endFrame = skelAnime->animLength;
+ SkelAnime_SetUpdate(skelAnime);
+}
+
+/**
+ * Reverses the current animation.
+ */
+void Animation_Reverse(SkelAnime* skelAnime) {
+ f32 startFrame = skelAnime->startFrame;
+
+ skelAnime->startFrame = skelAnime->endFrame;
+ skelAnime->playSpeed = -skelAnime->playSpeed;
+ skelAnime->endFrame = startFrame;
+}
+
+/**
+ * Copies the src frame table to the dst frame table if copyFlag for that limb is true.
+ */
+void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag) {
+ s32 i;
+
+ for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) {
+ if (*copyFlag++) {
+ *dst = *src;
+ }
+ }
+}
+
+/**
+ * Copies the src frame table to the dst frame table if copyFlag for that limb is false.
+ */
+void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag) {
+ s32 i;
+
+ for (i = 0; i < skelAnime->limbCount; i++, dst++, src++) {
+ if (!*copyFlag++) {
+ *dst = *src;
+ }
+ }
+}
+
+/**
+ * Updates translation of the root limb and calculates `pos`, the difference between
+ * the old and new positions of the root limb as rotated by `angle`. Used to allow
+ * animations to change an actor's position.
+ */
+void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) {
f32 x;
f32 z;
f32 sin;
f32 cos;
- if (skelAnime->flags & 0x10) {
- pos->z = 0.0f;
- pos->x = 0.0f;
+ if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) {
+ diff->z = 0.0f;
+ diff->x = 0.0f;
} else {
// `angle` rotation around y axis.
- x = skelAnime->limbDrawTbl->x - skelAnime->prevFramePos.x;
- z = skelAnime->limbDrawTbl->z - skelAnime->prevFramePos.z;
+ x = skelAnime->jointTable->x - skelAnime->prevTransl.x;
+ z = skelAnime->jointTable->z - skelAnime->prevTransl.z;
sin = Math_SinS(angle);
cos = Math_CosS(angle);
- pos->x = x * cos + z * sin;
- pos->z = z * cos - x * sin;
+ diff->x = x * cos + z * sin;
+ diff->z = z * cos - x * sin;
}
- skelAnime->prevFramePos.x = skelAnime->limbDrawTbl->x;
- skelAnime->limbDrawTbl->x = skelAnime->unk3E.x;
- skelAnime->prevFramePos.z = skelAnime->limbDrawTbl->z;
- skelAnime->limbDrawTbl->z = skelAnime->unk3E.z;
- if (skelAnime->flags & ANIM_FLAG_UPDATEXZ) {
- if (skelAnime->flags & ANIM_FLAG_UPDATEY) {
- pos->y = 0.0f;
+ skelAnime->prevTransl.x = skelAnime->jointTable->x;
+ skelAnime->jointTable->x = skelAnime->baseTransl.x;
+ skelAnime->prevTransl.z = skelAnime->jointTable->z;
+ skelAnime->jointTable->z = skelAnime->baseTransl.z;
+ if (skelAnime->moveFlags & ANIM_FLAG_UPDATEY) {
+ if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) {
+ diff->y = 0.0f;
} else {
- pos->y = skelAnime->limbDrawTbl->y - skelAnime->prevFramePos.y;
+ diff->y = skelAnime->jointTable->y - skelAnime->prevTransl.y;
}
- skelAnime->prevFramePos.y = skelAnime->limbDrawTbl->y;
- skelAnime->limbDrawTbl->y = skelAnime->unk3E.y;
+ skelAnime->prevTransl.y = skelAnime->jointTable->y;
+ skelAnime->jointTable->y = skelAnime->baseTransl.y;
} else {
- pos->y = 0.0f;
- skelAnime->prevFramePos.y = skelAnime->limbDrawTbl->y;
+ diff->y = 0.0f;
+ skelAnime->prevTransl.y = skelAnime->jointTable->y;
}
- skelAnime->flags &= ~ANIM_FLAG_UPDATEY;
+ skelAnime->moveFlags &= ~ANIM_FLAG_NOMOVE;
}
-s32 func_801378B8(SkelAnime* skelAnime, f32 arg1) {
- return func_80136990(skelAnime, arg1, 1.0f);
+/**
+ * Checks if the current animation is at the specified frame
+ */
+s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame) {
+ return Animation_OnFrameImpl(skelAnime, frame, 1.0f);
}
+/**
+ * Frees the frame tables for a skelAnime with dynamically allocated tables.
+ */
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) {
- if (skelAnime->limbDrawTbl != NULL) {
- zelda_free(skelAnime->limbDrawTbl);
+ if (skelAnime->jointTable != NULL) {
+ ZeldaArena_Free(skelAnime->jointTable);
}
- if (skelAnime->transitionDrawTbl != NULL) {
- zelda_free(skelAnime->transitionDrawTbl);
+ if (skelAnime->morphTable != NULL) {
+ ZeldaArena_Free(skelAnime->morphTable);
}
}
-void SkelAnime_CopyVec3s(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src) {
+/**
+ * Copies the src frame table to the dst frame table.
+ */
+void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src) {
bcopy(src, dst, sizeof(Vec3s) * skelAnime->limbCount);
}
diff --git a/src/code/z_snap.c b/src/code/z_snap.c
index b6538a685..120861ff5 100644
--- a/src/code/z_snap.c
+++ b/src/code/z_snap.c
@@ -119,7 +119,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
s32 ret = 0;
u32 unk2;
- camera = ACTIVE_CAM;
+ camera = GET_ACTIVE_CAM(globalCtx);
distance = OLib_Vec3fDist(pos, &camera->eye);
if ((distance < distanceMin) || (distanceMax < distance)) {
@@ -148,7 +148,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
}
actors[0] = actor;
- actors[1] = &PLAYER->actor;
+ actors[1] = &GET_PLAYER(globalCtx)->actor;
if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2) != 0) {
func_8013A41C(0x3b);
ret |= 0x3b;
diff --git a/src/code/z_view.c b/src/code/z_view.c
index 034f045b1..c325fd563 100644
--- a/src/code/z_view.c
+++ b/src/code/z_view.c
@@ -237,7 +237,7 @@ s32 View_SetQuake(View* view, Vec3f rot, Vec3f scale, f32 speed) {
return 1;
}
-s32 View_StepQuake(View* view, RSPMatrix* matrix) {
+s32 View_StepQuake(View* view, Mtx* matrix) {
MtxF mf;
if (view->quakeSpeed == 0.0f) {
@@ -256,16 +256,16 @@ s32 View_StepQuake(View* view, RSPMatrix* matrix) {
view->currQuakeScale.z += ((view->quakeScale.z - view->currQuakeScale.z) * view->quakeSpeed);
}
- SysMatrix_FromRSPMatrix(matrix, &mf);
- SysMatrix_SetCurrentState(&mf);
- SysMatrix_RotateStateAroundXAxis(view->currQuakeRot.x);
- SysMatrix_InsertYRotation_f(view->currQuakeRot.y, 1);
- SysMatrix_InsertZRotation_f(view->currQuakeRot.z, 1);
- Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1);
- SysMatrix_InsertZRotation_f(-view->currQuakeRot.z, 1);
- SysMatrix_InsertYRotation_f(-view->currQuakeRot.y, 1);
- SysMatrix_RotateStateAroundXAxis(-view->currQuakeRot.x);
- SysMatrix_GetStateAsRSPMatrix(matrix);
+ Matrix_FromRSPMatrix(matrix, &mf);
+ Matrix_SetCurrentState(&mf);
+ Matrix_RotateStateAroundXAxis(view->currQuakeRot.x);
+ Matrix_InsertYRotation_f(view->currQuakeRot.y, 1);
+ Matrix_InsertZRotation_f(view->currQuakeRot.z, 1);
+ Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, MTXMODE_APPLY);
+ Matrix_InsertZRotation_f(-view->currQuakeRot.z, 1);
+ Matrix_InsertYRotation_f(-view->currQuakeRot.y, 1);
+ Matrix_RotateStateAroundXAxis(-view->currQuakeRot.x);
+ Matrix_ToMtx(matrix);
return 1;
}
@@ -310,7 +310,7 @@ s32 View_RenderToPerspectiveMatrix(View* view) {
guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale);
view->projection = *projection;
//! @bug: This cast of `projection` is invalid
- View_StepQuake(view, (RSPMatrix*)projection);
+ View_StepQuake(view, (Mtx*)projection);
gSPPerspNormalize(POLY_OPA_DISP++, view->normal);
gSPMatrix(POLY_OPA_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c
index 1fca4801d..9e949beac 100644
--- a/src/code/z_vr_box.c
+++ b/src/code/z_vr_box.c
@@ -35,9 +35,9 @@ void func_80143148(SkyboxContext* skyboxCtx, s32 arg1) {
}
}
-void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType) {
- GlobalContext* globalCtx = (GlobalContext*)gamestate;
- u32 size;
+void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) {
+ GlobalContext* globalCtx = (GlobalContext*)gameState;
+ size_t size;
void* offset;
s32 pad;
@@ -82,7 +82,7 @@ void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType)
}
void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType) {
- u32 size;
+ size_t size;
if (1) {}
@@ -133,22 +133,22 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
}
}
-void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType) {
+void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) {
skyboxCtx->skyboxShouldDraw = 0;
skyboxCtx->rotX = skyboxCtx->rotY = skyboxCtx->rotZ = 0.0f;
- func_801431E8(gamestate, skyboxCtx, skyType);
+ func_801431E8(gameState, skyboxCtx, skyType);
if (skyType != 0) {
- skyboxCtx->unk17C = THA_AllocEndAlign16(&gamestate->heap, 0x3840);
+ skyboxCtx->unk17C = THA_AllocEndAlign16(&gameState->heap, 0x3840);
if (skyType == 5) {
// Allocate enough space for the vertices for a 6 sided skybox (cube)
- skyboxCtx->roomVtx = THA_AllocEndAlign16(&gamestate->heap, sizeof(Vtx) * 32 * 6);
+ skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6);
func_80143148(skyboxCtx, 6);
} else {
// Allocate enough space for the vertices for a 5 sided skybox (bottom is missing)
- skyboxCtx->roomVtx = THA_AllocEndAlign16(&gamestate->heap, sizeof(Vtx) * 32 * 5);
+ skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5);
func_80143148(skyboxCtx, 5);
}
}
diff --git a/src/libultra/io/contpfs.c b/src/libultra/io/contpfs.c
index b5e6e0288..42009674f 100644
--- a/src/libultra/io/contpfs.c
+++ b/src/libultra/io/contpfs.c
@@ -1,15 +1,308 @@
+#include "ultra64.h"
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osSumcalc.s")
+u16 __osSumcalc(u8* ptr, s32 length) {
+ s32 i;
+ u32 sum = 0;
+ u8* temp = ptr;
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osIdCheckSum.s")
+ for (i = 0; i < length; i++) {
+ sum += *temp++;
+ }
+ return sum & 0xFFFF;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osRepairPackId.s")
+s32 __osIdCheckSum(u16* ptr, u16* checkSum, u16* idSum) {
+ u16 data = 0;
+ u32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osCheckPackId.s")
+ *checkSum = *idSum = 0;
+ for (i = 0; i < ((sizeof(__OSPackId) - sizeof(u32)) / sizeof(u8)); i += 2) {
+ data = *((u16*)((u32)ptr + i));
+ *checkSum += data;
+ *idSum += ~data;
+ }
+ return 0;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osGetId.s")
+s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid) {
+ s32 ret = 0;
+ u8 temp[BLOCKSIZE];
+ u8 comp[BLOCKSIZE];
+ u8 mask = 0;
+ s32 i, j = 0;
+ u16 index[4];
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osCheckId.s")
+ newid->repaired = 0xFFFFFFFF;
+ newid->random = osGetCount();
+ newid->serialMid = badid->serialMid;
+ newid->serialLow = badid->serialLow;
-#pragma GLOBAL_ASM("asm/non_matchings/boot/contpfs/__osPfsRWInode.s")
+ if ((pfs->activebank != 0) && ((ret = __osPfsSelectBank(pfs, 0)) != 0)) {
+ return ret;
+ }
+
+ do {
+ if ((ret = __osPfsSelectBank(pfs, j)) != 0) {
+ return ret;
+ }
+
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, 0, temp)) != 0) {
+ return ret;
+ }
+ temp[0] = j | 0x80;
+ for (i = 1; i < BLOCKSIZE; i++) {
+ temp[i] = ~temp[i];
+ }
+
+ if ((ret = __osContRamWrite(pfs->queue, pfs->channel, 0, temp, 0)) != 0) {
+ return ret;
+ }
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, 0, comp)) != 0) {
+ return (ret);
+ }
+ for (i = 0; i < BLOCKSIZE; i++) {
+ if (comp[i] != temp[i]) {
+ break;
+ }
+ }
+ if (i != BLOCKSIZE) {
+ break;
+ }
+
+ if (j > 0) {
+ if ((ret = __osPfsSelectBank(pfs, 0)) != 0) {
+ return ret;
+ }
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, 0, temp)) != 0) {
+ return ret;
+ }
+ if (temp[0] != 0x80) {
+ break;
+ }
+ }
+
+ j++;
+ } while (j < PFS_MAX_BANKS);
+
+ if ((pfs->activebank != 0) && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
+ return ret;
+ }
+
+ mask = (j > 0) ? 1 : 0;
+ newid->deviceid = (badid->deviceid & 0xFFFE) | mask;
+ newid->banks = j;
+ newid->version = badid->version;
+ __osIdCheckSum((u16*)newid, &newid->checksum, &newid->invertedChecksum);
+
+ index[0] = PFS_ID_0AREA;
+ index[1] = PFS_ID_1AREA;
+ index[2] = PFS_ID_2AREA;
+ index[3] = PFS_ID_3AREA;
+ for (i = 0; i < 4; i++) {
+ if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[i], (u8*)newid, PFS_FORCE)) != 0) {
+ return ret;
+ }
+ }
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) {
+ return ret;
+ }
+ for (i = 0; i < BLOCKSIZE; i++) {
+ if (temp[i] != *(u8*)((s32)newid + i)) {
+ return PFS_ERR_DEVICE;
+ }
+ }
+ return 0;
+}
+
+s32 __osCheckPackId(OSPfs* pfs, __OSPackId* check) {
+ u16 index[4];
+ s32 ret = 0;
+ u16 sum;
+ u16 idSum;
+ s32 i;
+ s32 j;
+
+ if ((pfs->activebank != 0) && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
+ return ret;
+ }
+
+ index[0] = PFS_ID_0AREA;
+ index[1] = PFS_ID_1AREA;
+ index[2] = PFS_ID_2AREA;
+ index[3] = PFS_ID_3AREA;
+ for (i = 1; i < 4; i++) {
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, index[i], (u8*)check)) != 0) {
+ return ret;
+ }
+ __osIdCheckSum((u16*)check, &sum, &idSum);
+ if ((check->checksum == sum) && (check->invertedChecksum == idSum)) {
+ break;
+ }
+ }
+ if (i == 4) {
+ return PFS_ERR_ID_FATAL;
+ }
+
+ for (j = 0; j < 4; j++) {
+ if (j != i) {
+ if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[j], (u8*)check, PFS_FORCE)) != 0) {
+ return ret;
+ }
+ }
+ }
+ return 0;
+}
+
+s32 __osGetId(OSPfs* pfs) {
+ u16 sum;
+ u16 isum;
+ u8 temp[BLOCKSIZE];
+ __OSPackId* id;
+ __OSPackId newid;
+ s32 ret;
+
+ if (pfs->activebank != 0) {
+ if ((ret = __osPfsSelectBank(pfs, 0)) != 0) {
+ return ret;
+ }
+ }
+
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) {
+ return ret;
+ }
+
+ __osIdCheckSum((u16*)temp, &sum, &isum);
+ id = (__OSPackId*)temp;
+ if ((id->checksum != sum) || (id->invertedChecksum != isum)) {
+ if ((ret = __osCheckPackId(pfs, id)) == PFS_ERR_ID_FATAL) {
+ ret = __osRepairPackId(pfs, id, &newid);
+ if (ret) {
+ return ret;
+ }
+ id = &newid;
+ } else if (ret != 0) {
+ return ret;
+ }
+ }
+
+ if ((id->deviceid & 0x01) == 0) {
+ ret = __osRepairPackId(pfs, id, &newid);
+ if (ret) {
+ return ret;
+ }
+ id = &newid;
+ if ((id->deviceid & 0x01) == 0) {
+ return PFS_ERR_DEVICE;
+ }
+ }
+
+ bcopy(id, pfs->id, BLOCKSIZE);
+
+ if (0) {}
+
+ pfs->version = id->version;
+
+ pfs->banks = id->banks;
+ pfs->inodeStartPage = 1 + DEF_DIR_PAGES + (2 * pfs->banks);
+ pfs->dir_size = DEF_DIR_PAGES * PFS_ONE_PAGE;
+ pfs->inode_table = 1 * PFS_ONE_PAGE;
+ pfs->minode_table = (1 + pfs->banks) * PFS_ONE_PAGE;
+ pfs->dir_table = pfs->minode_table + (pfs->banks * PFS_ONE_PAGE);
+
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_LABEL_AREA, pfs->label)) != 0) {
+ return ret;
+ }
+
+ return 0;
+}
+
+s32 __osCheckId(OSPfs* pfs) {
+ u8 temp[BLOCKSIZE];
+ s32 ret;
+
+ if (pfs->activebank != 0) {
+ ret = __osPfsSelectBank(pfs, 0);
+ if (ret == PFS_ERR_NEW_PACK) {
+ ret = __osPfsSelectBank(pfs, 0);
+ }
+ if (ret != 0) {
+ return ret;
+ }
+ }
+
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) {
+ if (ret != PFS_ERR_NEW_PACK) {
+ return ret;
+ }
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) {
+ return ret;
+ }
+ }
+
+ if (bcmp(pfs->id, temp, BLOCKSIZE) != 0) {
+ return PFS_ERR_NEW_PACK;
+ }
+
+ return 0;
+}
+
+s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank) {
+ u8 sum;
+ s32 j;
+ s32 ret;
+ s32 offset;
+ u8* addr;
+
+ if (flag == PFS_READ && bank == __osPfsInodeCacheBank && (pfs->channel == __osPfsInodeCacheChannel)) {
+ bcopy(&__osPfsInodeCache, inode, sizeof(__OSInode));
+ return 0;
+ }
+
+ if ((pfs->activebank != 0) && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
+ return ret;
+ }
+
+ offset = ((bank > 0) ? 1 : pfs->inodeStartPage);
+
+ if (flag == PFS_WRITE) {
+ inode->inodePage[0].inode_t.page =
+ __osSumcalc((u8*)(inode->inodePage + offset), (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
+ }
+
+ for (j = 0; j < PFS_ONE_PAGE; j++) {
+ addr = (u8*)(((u8*)inode) + (j * BLOCKSIZE));
+ if (flag == PFS_WRITE) {
+ ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + (bank * PFS_ONE_PAGE) + j, addr, 0);
+ ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->minode_table + (bank * PFS_ONE_PAGE) + j, addr, 0);
+ } else {
+ ret = __osContRamRead(pfs->queue, pfs->channel, pfs->inode_table + (bank * PFS_ONE_PAGE) + j, addr);
+ }
+ if (ret) {
+ return ret;
+ }
+ }
+
+ if (flag == PFS_READ) {
+ sum = __osSumcalc((u8*)(inode->inodePage + offset), (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
+ if (sum != inode->inodePage[0].inode_t.page) {
+ for (j = 0; j < PFS_ONE_PAGE; j++) {
+ addr = (u8*)(((u8*)inode) + (j * BLOCKSIZE));
+ ret = __osContRamRead(pfs->queue, pfs->channel, pfs->minode_table + (bank * PFS_ONE_PAGE) + j, addr);
+ }
+ sum = __osSumcalc((u8*)(inode->inodePage + offset), (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
+ if (sum != inode->inodePage[0].inode_t.page) {
+ return PFS_ERR_INCONSISTENT;
+ }
+ for (j = 0; j < PFS_ONE_PAGE; j++) {
+ addr = (u8*)(((u8*)inode) + (j * BLOCKSIZE));
+ ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + (bank * PFS_ONE_PAGE) + j, addr, 0);
+ }
+ }
+ }
+ __osPfsInodeCacheBank = bank;
+ bcopy(inode, &__osPfsInodeCache, sizeof(__OSInode));
+ __osPfsInodeCacheChannel = pfs->channel;
+
+ return 0;
+}
diff --git a/src/libultra/io/devmgr.c b/src/libultra/io/devmgr.c
index 0a5d7e0bb..c0f69c456 100644
--- a/src/libultra/io/devmgr.c
+++ b/src/libultra/io/devmgr.c
@@ -1,3 +1,104 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/devmgr/__osDevMgrMain.s")
+void __osDevMgrMain(void* arg) {
+ OSIoMesg* ioMesg;
+ OSMesg sp70;
+ OSMesg sp6C; // "dummy"
+ s32 ret;
+ OSDevMgr* devMgr;
+ s32 msgVar = 0;
+
+ devMgr = (OSDevMgr*)arg;
+ ioMesg = NULL;
+ ret = 0;
+
+ while (true) {
+ osRecvMesg(devMgr->cmdQueue, (OSMesg)&ioMesg, OS_MESG_BLOCK);
+ if ((ioMesg->piHandle != NULL) && (ioMesg->piHandle->type == 2) &&
+ ((ioMesg->piHandle->transferInfo.cmdType == OS_READ) ||
+ (ioMesg->piHandle->transferInfo.cmdType == OS_WRITE))) {
+ __OSBlockInfo* block;
+ __OSTranxInfo* transfer;
+
+ transfer = &ioMesg->piHandle->transferInfo;
+ block = &transfer->block[transfer->blockNum];
+ transfer->sectorNum = -1;
+ if (transfer->transferMode != 3) {
+ block->dramAddr = (void*)((u32)block->dramAddr - block->sectorSize);
+ }
+
+ if ((transfer->transferMode == 2) && (ioMesg->piHandle->transferInfo.cmdType == OS_READ)) {
+ msgVar = 1;
+ } else {
+ msgVar = 0;
+ }
+
+ osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK);
+ __osResetGlobalIntMask(0x00100401);
+ __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x80000000);
+
+ label:
+ osRecvMesg(devMgr->evtQueue, &sp70, OS_MESG_BLOCK);
+ transfer = &ioMesg->piHandle->transferInfo;
+ block = &transfer->block[transfer->blockNum];
+ if (block->errStatus == 0x1D) {
+ u32 status;
+
+ __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x10000000);
+ __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow);
+ __osEPiRawReadIo(ioMesg->piHandle, 0x05000508, &status);
+ if (status & 0x02000000) {
+ __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x1000000);
+ }
+ block->errStatus = 4;
+ HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
+ __osSetGlobalIntMask(0x00100C01);
+ }
+ osSendMesg(ioMesg->hdr.retQueue, (OSMesg)ioMesg, OS_MESG_NOBLOCK);
+
+ if ((msgVar == 1) && (ioMesg->piHandle->transferInfo.block[0].errStatus == 0)) {
+ msgVar = 0;
+ goto label;
+ }
+
+ osSendMesg(devMgr->acsQueue, NULL, OS_MESG_NOBLOCK);
+ if (ioMesg->piHandle->transferInfo.blockNum == 1) {
+ osYieldThread();
+ }
+ } else {
+ switch (ioMesg->hdr.type) {
+ case 11:
+ osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK);
+ ret = devMgr->piDmaCallback(OS_READ, ioMesg->devAddr, ioMesg->dramAddr, ioMesg->size);
+ break;
+ case 12:
+ osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK);
+ ret = devMgr->piDmaCallback(OS_WRITE, ioMesg->devAddr, ioMesg->dramAddr, ioMesg->size);
+ break;
+ case 15:
+ osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK);
+ ret = devMgr->epiDmaCallback(ioMesg->piHandle, OS_READ, ioMesg->devAddr, ioMesg->dramAddr,
+ ioMesg->size);
+ break;
+ case 16:
+ osRecvMesg(devMgr->acsQueue, &sp6C, OS_MESG_BLOCK);
+ ret = devMgr->epiDmaCallback(ioMesg->piHandle, OS_WRITE, ioMesg->devAddr, ioMesg->dramAddr,
+ ioMesg->size);
+ break;
+ case 10:
+ osSendMesg(ioMesg->hdr.retQueue, ioMesg, OS_MESG_NOBLOCK);
+ ret = -1;
+ break;
+ default:
+ ret = -1;
+ break;
+ }
+
+ if (ret == 0) {
+ osRecvMesg(devMgr->evtQueue, &sp70, OS_MESG_BLOCK);
+ osSendMesg(ioMesg->hdr.retQueue, ioMesg, OS_MESG_NOBLOCK);
+ osSendMesg(devMgr->acsQueue, NULL, OS_MESG_NOBLOCK);
+ }
+ }
+ }
+}
diff --git a/src/libultra/io/epilinkhandle.c b/src/libultra/io/epilinkhandle.c
index 59efbc66e..bedd6d71c 100644
--- a/src/libultra/io/epilinkhandle.c
+++ b/src/libultra/io/epilinkhandle.c
@@ -1,3 +1,12 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/epilinkhandle/osEPiLinkHandle.s")
+s32 osEPiLinkHandle(OSPiHandle* handle) {
+ u32 saveMask = __osDisableInt();
+
+ handle->next = __osPiTable;
+ __osPiTable = handle;
+
+ __osRestoreInt(saveMask);
+
+ return 0;
+}
diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c
index e6ee17d5f..f9e2e0f97 100644
--- a/src/libultra/io/epirawdma.c
+++ b/src/libultra/io/epirawdma.c
@@ -1,3 +1,3 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/epirawdma/osEPiRawStartDma.s")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/epirawdma/__osEPiRawStartDma.s")
diff --git a/src/libultra/io/epirawread.c b/src/libultra/io/epirawread.c
index 0a175189e..e910cee4d 100644
--- a/src/libultra/io/epirawread.c
+++ b/src/libultra/io/epirawread.c
@@ -1,3 +1,3 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/epirawread/osEPiRawReadIo.s")
+#pragma GLOBAL_ASM("asm/non_matchings/boot/epirawread/__osEPiRawReadIo.s")
diff --git a/src/libultra/io/motor.c b/src/libultra/io/motor.c
new file mode 100644
index 000000000..25254c61b
--- /dev/null
+++ b/src/libultra/io/motor.c
@@ -0,0 +1,120 @@
+#include "ultra64.h"
+#include "global.h"
+
+#define BANK_ADDR 0x400
+#define MOTOR_ID 0x80
+
+s32 __osPfsSelectBank(OSPfs* pfs, u8 bank);
+
+s32 osSetRumble(OSPfs* pfs, u32 vibrate) {
+ s32 i;
+ s32 ret;
+ u8* buf = (u8*)&osPifBuffers[pfs->channel];
+
+ if (!(pfs->status & 8)) {
+ return 5;
+ }
+
+ __osSiGetAccess();
+ osPifBuffers[pfs->channel].pifstatus = 1;
+ buf += pfs->channel;
+ for (i = 0; i < BLOCKSIZE; i++) {
+ ((__OSContRamReadFormat*)buf)->data[i] = vibrate;
+ }
+
+ __osContLastCmd = CONT_CMD_END;
+ __osSiRawStartDma(OS_WRITE, &osPifBuffers[pfs->channel]);
+ osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK);
+ __osSiRawStartDma(OS_READ, &osPifBuffers[pfs->channel]);
+ osRecvMesg(pfs->queue, NULL, OS_MESG_BLOCK);
+
+ ret = ((__OSContRamReadFormat*)buf)->rxsize & 0xC0;
+ if (!ret) {
+ if (!vibrate) {
+ if (((__OSContRamReadFormat*)buf)->datacrc != 0) {
+ ret = PFS_ERR_CONTRFAIL;
+ }
+ } else {
+ if (((__OSContRamReadFormat*)buf)->datacrc != 0xEB) {
+ ret = PFS_ERR_CONTRFAIL;
+ }
+ }
+ }
+
+ __osSiRelAccess();
+
+ return ret;
+}
+void osSetUpMempakWrite(u32 channel, OSPifRam* buf) {
+ u8* bufptr = (u8*)buf;
+ __OSContRamReadFormat mempakwr;
+ u32 i;
+
+ mempakwr.dummy = 0xFF;
+ mempakwr.txsize = 0x23;
+ mempakwr.rxsize = 1;
+ mempakwr.cmd = 3; // write mempak
+ mempakwr.hi = 0x600 >> 3;
+ mempakwr.lo = (u8)(__osContAddressCrc(0x600) | (0x600 << 5));
+
+ if (channel != 0) {
+ for (i = 0; i < channel; i++) {
+ *bufptr++ = 0;
+ }
+ }
+
+ *(__OSContRamReadFormat*)bufptr = mempakwr;
+ bufptr += sizeof(mempakwr);
+ *bufptr = 0xFE;
+}
+
+s32 osProbeRumblePak(OSMesgQueue* ctrlrqueue, OSPfs* pfs, u32 channel) {
+ s32 ret;
+ u8 sp24[BLOCKSIZE];
+
+ pfs->queue = ctrlrqueue;
+ pfs->channel = channel;
+ pfs->activebank = 0xFF;
+ pfs->status = 0;
+
+ ret = __osPfsSelectBank(pfs, 0xFE);
+ if (ret == 2) {
+ ret = __osPfsSelectBank(pfs, MOTOR_ID);
+ }
+ if (ret != 0) {
+ return ret;
+ }
+ ret = __osContRamRead(ctrlrqueue, channel, 0x400, sp24);
+ if (ret == 2) {
+ ret = 4; // "Controller pack communication error"
+ }
+ if (ret != 0) {
+ return ret;
+ }
+ if (sp24[BLOCKSIZE - 1] == 0xFE) {
+ return 0xB;
+ }
+ ret = __osPfsSelectBank(pfs, MOTOR_ID);
+ if (ret == 2) {
+ ret = 4; // "Controller pack communication error"
+ }
+ if (ret != 0) {
+ return ret;
+ }
+ ret = __osContRamRead(ctrlrqueue, channel, BANK_ADDR, sp24);
+ if (ret == 2) {
+ ret = 4; // "Controller pack communication error"
+ }
+ if (ret != 0) {
+ return ret;
+ }
+ if (sp24[BLOCKSIZE - 1] != MOTOR_ID) {
+ return 0xB;
+ }
+ if ((pfs->status & PFS_MOTOR_INITIALIZED) == 0) {
+ osSetUpMempakWrite(channel, &osPifBuffers[channel]);
+ }
+ pfs->status = PFS_MOTOR_INITIALIZED;
+
+ return 0; // "Recognized rumble pak"
+}
diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c
index f5081c050..74b1075a1 100644
--- a/src/libultra/io/pimgr.c
+++ b/src/libultra/io/pimgr.c
@@ -31,9 +31,9 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
__osPiDevMgr.cmdQueue = cmdQ;
__osPiDevMgr.evtQueue = &D_8009E3D0;
__osPiDevMgr.acsQueue = &__osPiAccessQueue;
- __osPiDevMgr.piDmaCallback = osPiRawStartDma;
- __osPiDevMgr.epiDmaCallback = osEPiRawStartDma;
- osCreateThread(&D_8009D220, 0, __osDevMgrMain, &__osPiDevMgr, &piManagerStack[0x1000], pri);
+ __osPiDevMgr.piDmaCallback = __osPiRawStartDma;
+ __osPiDevMgr.epiDmaCallback = __osEPiRawStartDma;
+ osCreateThread(&D_8009D220, 0, __osDevMgrMain, (void*)&__osPiDevMgr, &piManagerStack[4096], pri);
osStartThread(&D_8009D220);
__osRestoreInt(savedMask);
if (oldPri != -1) {
diff --git a/src/libultra/io/pirawdma.c b/src/libultra/io/pirawdma.c
index b133fadf5..242a91c24 100644
--- a/src/libultra/io/pirawdma.c
+++ b/src/libultra/io/pirawdma.c
@@ -1,6 +1,6 @@
#include "global.h"
-s32 osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, u32 size) {
+s32 __osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size) {
register int stat;
stat = *(vu32*)0xA4600010;
diff --git a/src/libultra/io/sprawdma.c b/src/libultra/io/sprawdma.c
index 01e944c5f..95395a29d 100644
--- a/src/libultra/io/sprawdma.c
+++ b/src/libultra/io/sprawdma.c
@@ -1,6 +1,6 @@
#include "global.h"
-s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, u32 size) {
+s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size) {
if (__osSpDeviceBusy() != 0) {
return -1;
}
diff --git a/src/libultra/libc/string.c b/src/libultra/libc/string.c
index 5f085f677..b23bf564d 100644
--- a/src/libultra/libc/string.c
+++ b/src/libultra/libc/string.c
@@ -1,4 +1,4 @@
-#include "string.h"
+#include "global.h"
const char* strchr(const char* s, int c) {
const unsigned char ch = c;
diff --git a/src/libultra/os/resetglobalintmask.c b/src/libultra/os/resetglobalintmask.c
index 3d93a17e7..c2561d712 100644
--- a/src/libultra/os/resetglobalintmask.c
+++ b/src/libultra/os/resetglobalintmask.c
@@ -1,3 +1,8 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/resetglobalintmask/__osResetGlobalIntMask.s")
+void __osResetGlobalIntMask(u32 mask) {
+ register s32 prevInt = __osDisableInt();
+
+ __OSGlobalIntMask &= ~(mask & ~0x401);
+ __osRestoreInt(prevInt);
+}
diff --git a/src/libultra/os/setglobalintmask.c b/src/libultra/os/setglobalintmask.c
index 40b539b7f..6b7895d6d 100644
--- a/src/libultra/os/setglobalintmask.c
+++ b/src/libultra/os/setglobalintmask.c
@@ -1,3 +1,8 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/setglobalintmask/__osSetGlobalIntMask.s")
+void __osSetGlobalIntMask(u32 mask) {
+ register s32 prevInt = __osDisableInt();
+
+ __OSGlobalIntMask |= mask;
+ __osRestoreInt(prevInt);
+}
diff --git a/src/libultra/os/sethwinterrupt.c b/src/libultra/os/sethwinterrupt.c
index 86dfd2c64..6ba72be7a 100644
--- a/src/libultra/os/sethwinterrupt.c
+++ b/src/libultra/os/sethwinterrupt.c
@@ -1,3 +1,10 @@
#include "global.h"
-#pragma GLOBAL_ASM("asm/non_matchings/boot/sethwinterrupt/__osSetHWIntrRoutine.s")
+void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg) {
+ register s32 prevInt = __osDisableInt();
+
+ __osHwIntTable[idx].queue = queue;
+ __osHwIntTable[idx].msg = msg;
+
+ __osRestoreInt(prevInt);
+}
diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
index ac175b7e4..62bac2109 100644
--- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
+++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
@@ -72,7 +72,7 @@ void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
if (this->actor.parent == NULL) {
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_800B6C04(&this->actor, 20.0f);
- this->actor.parent = &PLAYER->actor;
+ this->actor.parent = &GET_PLAYER(globalCtx)->actor;
this->timer = 26;
}
}
@@ -120,7 +120,7 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
}
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->actor.parent == NULL) || (!func_801240C8(player))) {
ArmsHook_DetachHookFromActor(this);
@@ -287,50 +287,47 @@ static Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
- s32 pad;
- Player* player = PLAYER;
- Vec3f sp68;
- Vec3f sp5C;
- Vec3f sp50;
- f32 sp4C;
- f32 sp48;
+ f32 f0;
+ Player* player = GET_PLAYER(globalCtx);
if (player->actor.draw != NULL && player->rightHandType == 0xB) {
- // OPEN_DISP macro
- {
- GraphicsContext* sp44 = globalCtx->state.gfxCtx;
- f32 f0;
+ Vec3f sp68;
+ Vec3f sp5C;
+ Vec3f sp50;
+ f32 sp4C;
+ f32 sp48;
- if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
- SysMatrix_MultiplyVector3fByState(&D_808C1C10, &this->unk1E0);
- SysMatrix_MultiplyVector3fByState(&D_808C1C28, &sp5C);
- SysMatrix_MultiplyVector3fByState(&D_808C1C34, &sp50);
- this->unk1C4 = 0;
- } else {
- SysMatrix_MultiplyVector3fByState(&D_808C1C1C, &this->unk1E0);
- SysMatrix_MultiplyVector3fByState(&D_808C1C40, &sp5C);
- SysMatrix_MultiplyVector3fByState(&D_808C1C4C, &sp50);
- }
- func_80126440(globalCtx, &this->collider.base, &this->unk1C4, &sp5C, &sp50);
- func_8012C28C(globalCtx->state.gfxCtx);
- func_80122868(globalCtx, player);
+ OPEN_DISPS(globalCtx->state.gfxCtx);
- gSPMatrix(sp44->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(sp44->polyOpa.p++, D_0601D960);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
- MTXMODE_NEW);
- Math_Vec3f_Diff(&player->rightHandWorld.pos, &this->actor.world.pos, &sp68);
- sp48 = SQ(sp68.x) + SQ(sp68.z);
- sp4C = sqrtf(sp48);
- Matrix_RotateY(Math_Atan2S(sp68.x, sp68.z), MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(Math_Atan2S(-sp68.y, sp4C), MTXMODE_APPLY);
- f0 = sqrtf(SQ(sp68.y) + sp48);
- Matrix_Scale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
- gSPMatrix(sp44->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(sp44->polyOpa.p++, D_040008D0);
- func_801229A0(globalCtx, player);
+ if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
+ Matrix_MultiplyVector3fByState(&D_808C1C10, &this->unk1E0);
+ Matrix_MultiplyVector3fByState(&D_808C1C28, &sp5C);
+ Matrix_MultiplyVector3fByState(&D_808C1C34, &sp50);
+ this->unk1C4 = 0;
+ } else {
+ Matrix_MultiplyVector3fByState(&D_808C1C1C, &this->unk1E0);
+ Matrix_MultiplyVector3fByState(&D_808C1C40, &sp5C);
+ Matrix_MultiplyVector3fByState(&D_808C1C4C, &sp50);
}
+ func_80126440(globalCtx, &this->collider.base, &this->unk1C4, &sp5C, &sp50);
+ func_8012C28C(globalCtx->state.gfxCtx);
+ func_80122868(globalCtx, player);
+
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, D_0601D960);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
+ MTXMODE_NEW);
+ Math_Vec3f_Diff(&player->rightHandWorld.pos, &this->actor.world.pos, &sp68);
+ sp48 = SQXZ(sp68);
+ sp4C = sqrtf(SQXZ(sp68));
+ Matrix_RotateY(Math_Atan2S(sp68.x, sp68.z), MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(Math_Atan2S(-sp68.y, sp4C), MTXMODE_APPLY);
+ f0 = sqrtf(SQ(sp68.y) + sp48);
+ Matrix_Scale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, D_040008D0);
+ func_801229A0(globalCtx, player);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
}
}
diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c
index a4dad8770..ed513eef3 100644
--- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c
+++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c
@@ -1,4 +1,11 @@
+/*
+ * File: z_arrow_ice.c
+ * Overlay: ovl_Arrow_Ice
+ * Description: Ice Arrow. Spawned as a child of a normal arrow.
+ */
+
#include "z_arrow_ice.h"
+#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x02000010
@@ -9,13 +16,14 @@ void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx);
-void func_809224DC(ArrowIce* this, GlobalContext* globalCtx);
-void func_80922628(ArrowIce* this, GlobalContext* globalCtx);
-void func_809227F4(ArrowIce* this, GlobalContext* globalCtx);
+void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx);
+void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx);
+void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx);
-void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc);
+#include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c"
+
+s32 unused; // Needed for bss
-#if 0
const ActorInit Arrow_Ice_InitVars = {
ACTOR_ARROW_ICE,
ACTORCAT_ITEMACTION,
@@ -28,33 +36,206 @@ const ActorInit Arrow_Ice_InitVars = {
(ActorFunc)ArrowIce_Draw,
};
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_809241F0[] = {
+static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP),
};
-#endif
+extern Gfx D_0E0002E0[];
-extern InitChainEntry D_809241F0[];
+void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) {
+ this->actionFunc = actionFunc;
+}
-extern UNK_TYPE D_0E0002E0;
+void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
+ ArrowIce* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/D_80924200.s")
+ Actor_ProcessInitChain(&this->actor, sInitChain);
+ this->radius = 0;
+ this->height = 1.0f;
+ ArrowIce_SetupAction(this, ArrowIce_Charge);
+ Actor_SetScale(&this->actor, 0.01f);
+ this->alpha = 100;
+ this->timer = 0;
+ this->blueingEffectMagnitude = 0.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/ArrowIce_SetupAction.s")
+void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ func_80115D5C(&globalCtx->state);
+ (void)"消滅"; // Unreferenced in retail, means "Disappearance"
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/ArrowIce_Init.s")
+void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {
+ EnArrow* arrow = (EnArrow*)this->actor.parent;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/ArrowIce_Destroy.s")
+ if ((arrow == NULL) || (arrow->actor.update == NULL)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/func_809224DC.s")
+ if (this->radius < 10) {
+ this->radius++;
+ }
+ // copy position and rotation from arrow
+ this->actor.world.pos = arrow->actor.world.pos;
+ this->actor.shape.rot = arrow->actor.shape.rot;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/func_809225D0.s")
+ func_800B9010(&this->actor, NA_SE_PL_ARROW_CHARGE_ICE - SFX_FLAG);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/func_80922628.s")
+ // if arrow has no parent, player has fired the arrow
+ if (arrow->actor.parent == NULL) {
+ this->firedPos = this->actor.world.pos;
+ this->radius = 10;
+ ArrowIce_SetupAction(this, ArrowIce_Fly);
+ this->alpha = 255;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/func_809227F4.s")
+void ArrowIce_LerpFiredPosition(Vec3f* firedPos, Vec3f* icePos, f32 scale) {
+ VEC3F_LERPIMPDST(firedPos, firedPos, icePos, scale);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/ArrowIce_Update.s")
+void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) {
+ f32 scale;
+ f32 offset;
+ u16 timer;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Arrow_Ice/ArrowIce_Draw.s")
+ if (this->actor.projectedW < 50.0f) {
+ scale = 10.0f;
+ } else if (this->actor.projectedW > 950.0f) {
+ scale = 310.0f;
+ } else {
+ scale = this->actor.projectedW;
+ scale = (scale - 50.0f) * (1.0f / 3.0f) + 10.0f;
+ }
+
+ timer = this->timer;
+ if (timer != 0) {
+ this->timer--;
+
+ if (this->timer >= 8) {
+ offset = ((this->timer - 8) * (1.0f / 24.0f));
+ offset = SQ(offset);
+ this->radius = (((1.0f - offset) * scale) + 10.0f);
+ this->height += ((2.0f - this->height) * 0.1f);
+ if (this->timer < 16) {
+ if (1) {}
+ this->alpha = ((this->timer * 35) - 280);
+ }
+ }
+ }
+
+ if (this->timer >= 9) {
+ if (this->blueingEffectMagnitude < 1.0f) {
+ this->blueingEffectMagnitude += 0.25f;
+ }
+ } else {
+ if (this->blueingEffectMagnitude > 0.0f) {
+ this->blueingEffectMagnitude -= 0.125f;
+ }
+ }
+
+ if (this->timer < 8) {
+ this->alpha = 0;
+ }
+
+ if (this->timer == 0) {
+ this->timer = 255;
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
+ EnArrow* arrow = (EnArrow*)this->actor.parent;
+ f32 distanceScaled;
+ s32 pad;
+
+ if ((arrow == NULL) || (arrow->actor.update == NULL)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ // copy position and rotation from arrow
+ this->actor.world.pos = arrow->actor.world.pos;
+ this->actor.shape.rot = arrow->actor.shape.rot;
+ distanceScaled = Math_Vec3f_DistXYZ(&this->firedPos, &this->actor.world.pos) * (1.0f / 24.0f);
+ this->height = distanceScaled;
+ if (distanceScaled < 1.0f) {
+ this->height = 1.0f;
+ }
+ ArrowIce_LerpFiredPosition(&this->firedPos, &this->actor.world.pos, 0.05f);
+
+ if (arrow->unk_261 & 1) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_ICE);
+ ArrowIce_SetupAction(this, ArrowIce_Hit);
+ this->timer = 32;
+ this->alpha = 255;
+ } else if (arrow->unk_260 < 34) {
+ if (this->alpha < 35) {
+ Actor_MarkForDeath(&this->actor);
+ } else {
+ this->alpha -= 25;
+ }
+ }
+}
+
+void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
+ ArrowIce* this = THIS;
+
+ if ((globalCtx->msgCtx.unk11F22 == 0xE) || (globalCtx->msgCtx.unk11F22 == 0x12)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ } else {
+ this->actionFunc(this, globalCtx);
+ }
+}
+
+void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ ArrowIce* this = THIS;
+ Actor* transform;
+ u32 stateFrames = globalCtx->state.frames;
+ EnArrow* arrow = (EnArrow*)this->actor.parent;
+
+ if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
+ transform = (arrow->unk_261 & 2) ? &this->actor : &arrow->actor;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ Matrix_InsertTranslation(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
+ Matrix_RotateY(transform->shape.rot.y, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(transform->shape.rot.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(transform->shape.rot.z, MTXMODE_APPLY);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
+
+ // Draw blue effect over the screen when arrow hits
+ if (this->blueingEffectMagnitude > 0.0f) {
+ POLY_XLU_DISP = func_8012BFC4(POLY_XLU_DISP);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, (s32)(this->blueingEffectMagnitude * 10.0f) & 0xFF,
+ (s32)(50.0f * this->blueingEffectMagnitude) & 0xFF,
+ (s32)(150.0f * this->blueingEffectMagnitude) & 0xFF);
+ gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
+ gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
+ gSPDisplayList(POLY_XLU_DISP++, D_0E0002E0);
+ }
+
+ // Draw ice on the arrow
+ func_8012C2DC(globalCtx->state.gfxCtx);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, (s32)(this->alpha * 0.5f) & 0xFF);
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128);
+ Matrix_InsertRotation(0x4000, 0, 0, MTXMODE_APPLY);
+ if (this->timer != 0) {
+ Matrix_InsertTranslation(0.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ } else {
+ Matrix_InsertTranslation(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY);
+ }
+ Matrix_Scale(this->radius * 0.2f, this->height * 3.0f, this->radius * 0.2f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, sIceArrowDL);
+ gSPDisplayList(POLY_XLU_DISP++,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
+ 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16));
+ gSPDisplayList(POLY_XLU_DISP++, sIceArrowVtxDL);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h
index 44a5ed945..a731d9d44 100644
--- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h
+++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h
@@ -9,7 +9,12 @@ typedef void (*ArrowIceActionFunc)(struct ArrowIce*, GlobalContext*);
typedef struct ArrowIce {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x1C];
+ /* 0x0144 */ s16 radius;
+ /* 0x0146 */ u16 timer;
+ /* 0x0148 */ u8 alpha;
+ /* 0x014C */ Vec3f firedPos;
+ /* 0x0158 */ f32 height;
+ /* 0x015C */ f32 blueingEffectMagnitude;
/* 0x0160 */ ArrowIceActionFunc actionFunc;
} ArrowIce; // size = 0x164
diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c
index c2554ec61..18b8a343c 100644
--- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c
+++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c
@@ -90,14 +90,14 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) {
rotZ = this->dyna.actor.shape.rot.z & 0x1FFF;
if ((flags != 0) && (rotZ < 0x1B58) && (rotZ >= 0x1388)) {
Matrix_RotateY(this->dyna.actor.home.rot.y, 0);
- SysMatrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1);
- SysMatrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1);
+ Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1);
+ Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1);
for (i = 0; i < 4; i++) {
if ((u32)Rand_Next() >= 0x40000000) {
splashOffset.x = D_80AD3270[i].x - (Rand_ZeroOne() * 30.0f);
splashOffset.y = D_80AD3270[i].y;
splashOffset.z = D_80AD3270[i].z;
- SysMatrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
+ Matrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f);
splashSpawnPos.y += this->dyna.actor.world.pos.y;
splashSpawnPos.z += this->dyna.actor.world.pos.z + ((Rand_ZeroOne() * 20.0f) - 10.0f);
@@ -108,14 +108,14 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) {
if ((rotZ < 0x1F4) && (rotZ >= 0)) {
if (flags != 0) {
Matrix_RotateY(this->dyna.actor.home.rot.y, 0);
- SysMatrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1);
- SysMatrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1);
+ Matrix_InsertXRotation_s(this->dyna.actor.home.rot.x, 1);
+ Matrix_InsertZRotation_s(this->dyna.actor.home.rot.z, 1);
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
splashOffset.x = D_80AD32A0[i].x + (Rand_ZeroOne() * 10.0f);
splashOffset.y = D_80AD32A0[i].y;
splashOffset.z = D_80AD32A0[i].z;
- SysMatrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
+ Matrix_MultiplyVector3fByState(&splashOffset, &splashSpawnPos);
splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f);
splashSpawnPos.y += this->dyna.actor.world.pos.y;
splashSpawnPos.z += this->dyna.actor.world.pos.z + ((Rand_ZeroOne() * 20.0f) - 10.0f);
diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c
index 55d5564c8..68371797b 100644
--- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c
+++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c
@@ -59,7 +59,7 @@ void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = BgCtowerRot_CorridorRotate;
return;
}
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (this->dyna.actor.params == MAIN_DOOR) {
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06017410);
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y + 0x4000;
@@ -85,7 +85,7 @@ void BgCtowerRot_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f offset;
f32 rotZ;
f32 offsetDiffZ;
@@ -128,7 +128,7 @@ void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) {
}
void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f offset;
Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos);
diff --git a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h
index 45c78a181..ffb4cc8d8 100644
--- a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h
+++ b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h
@@ -7,7 +7,8 @@ struct BgFuMizu;
typedef struct BgFuMizu {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x20];
+ /* 0x144 */ char unk_144[0x1C];
+ /* 0x160 */ s16 unk_160;
} BgFuMizu; // size = 0x164
extern const ActorInit Bg_Fu_Mizu_InitVars;
diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c
index 9a6d2348b..34ad8fb1f 100644
--- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c
+++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c
@@ -116,9 +116,9 @@ void BgHakaTomb_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
Matrix_RotateY(this->dyna.actor.world.rot.y, MTXMODE_NEW);
- SysMatrix_InsertXRotation_s(this->dyna.actor.world.rot.x, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->dyna.actor.world.rot.z, MTXMODE_APPLY);
- SysMatrix_MultiplyVector3fByState(&D_80BD68A4, &vec);
+ Matrix_InsertXRotation_s(this->dyna.actor.world.rot.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->dyna.actor.world.rot.z, MTXMODE_APPLY);
+ Matrix_MultiplyVector3fByState(&D_80BD68A4, &vec);
Math_Vec3f_Sum(&this->dyna.actor.world.pos, &vec, &this->dyna.actor.focus.pos);
}
diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c
index 7df92fc57..453bd919c 100644
--- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c
+++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c
@@ -234,7 +234,7 @@ BgHakuginPostUnkStruct1* func_80A9B32C(BgHakuginPostUnkStruct* unkStruct, BgHaku
}
void func_80A9B384(Vec3f* arg0) {
- MtxF* matrix = SysMatrix_GetCurrentState();
+ MtxF* matrix = Matrix_GetCurrentState();
matrix->mf[3][0] = arg0->x;
matrix->mf[3][1] = arg0->y;
@@ -523,8 +523,8 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU
sp44.x = this->dyna.actor.home.pos.x + unkStruct1->unk_14.x;
sp44.y = this->unk_16C + unkStruct1->unk_14.y;
sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z;
- func_8013ECE0(Math3D_DistanceSquared(&sp44, &PLAYER->actor.world.pos), 255, 20, 150);
- quake = Quake_Add(ACTIVE_CAM, 3);
+ func_8013ECE0(Math3D_DistanceSquared(&sp44, &GET_PLAYER(globalCtx)->actor.world.pos), 255, 20, 150);
+ quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3);
Quake_SetSpeed(quake, 20000);
Quake_SetQuakeValues(quake, 7, 0, 0, 0);
Quake_SetCountdown(quake, 12);
@@ -540,8 +540,8 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU
void func_80A9C18C(BgHakuginPost* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
- Camera* activeCam = ACTIVE_CAM;
+ Player* player = GET_PLAYER(globalCtx);
+ Camera* activeCam = GET_ACTIVE_CAM(globalCtx);
s16 quake;
func_8013ECE0(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z,
@@ -814,7 +814,7 @@ void func_80A9CE00(BgHakuginPost* this) {
void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
ColliderCylinder* collider;
s32 yDiff;
s32 i;
@@ -1013,8 +1013,8 @@ void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
- SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
- this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
+ Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
for (i = 0; i < D_80A9E028.count; i++) {
@@ -1035,8 +1035,8 @@ void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) {
for (i = 0; i < ARRAY_COUNT(D_80A9E028.unk_02A4); i++) {
unkStruct2 = &D_80A9E028.unk_02A4[i];
if (unkStruct2->unk_2C > 0) {
- SysMatrix_SetStateRotationAndTranslation(unkStruct2->unk_04.x, unkStruct2->unk_04.y,
- unkStruct2->unk_04.z, &unkStruct2->unk_20);
+ Matrix_SetStateRotationAndTranslation(unkStruct2->unk_04.x, unkStruct2->unk_04.y, unkStruct2->unk_04.z,
+ &unkStruct2->unk_20);
Matrix_Scale(unkStruct2->unk_00, unkStruct2->unk_00, unkStruct2->unk_00, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c
index 6c590ab9d..986b8b8ae 100644
--- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c
+++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c
@@ -146,7 +146,7 @@ void func_80BD5A18(BgIkanaShutter* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y *= 0.978f;
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) {
- quake = Quake_Add(ACTIVE_CAM, 3);
+ quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3);
Quake_SetSpeed(quake, 0x5420);
Quake_SetQuakeValues(quake, 4, 0, 0, 0);
Quake_SetCountdown(quake, 12);
diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c
index fa4bdd85d..123a1248f 100644
--- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c
+++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c
@@ -49,7 +49,7 @@ static InitChainEntry sInitChain[] = {
s32 func_80C0A740(BgIkninSusceil* this, GlobalContext* globalCtx) {
s32 pad2[2];
Vec3f offset;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos);
@@ -66,7 +66,7 @@ void func_80C0A838(BgIkninSusceil* this, GlobalContext* globalCtx) {
void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 verticalMag, s16 countdown, s32 arg4) {
s32 pad;
- s16 quake = Quake_Add(ACTIVE_CAM, 3);
+ s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3);
Quake_SetSpeed(quake, 0x7B30);
Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0);
@@ -84,7 +84,7 @@ s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) {
s32 phi_t0 = true;
s32 i;
f32 new_var;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f offset;
f32 temp1, temp2, temp3, temp4;
@@ -218,7 +218,7 @@ void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx) {
void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgIkninSusceil* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk168 == 0) && (this->unk166 > 0) && (player->stateFlags3 & 0x100) && (player->unk_B48 > 1000.0f)) {
this->unk168 = 2;
diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c
index a9ce12ce9..2d1fb8ca2 100644
--- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c
+++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c
@@ -138,11 +138,11 @@ void BgKin2Fence_SpawnEyeSparkles(BgKin2Fence* this, GlobalContext* globalCtx, s
Vec3f sp58;
s32 pad[2];
- SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
- this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
+ Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
for (i = 0; i < 2; i++) {
- SysMatrix_MultiplyVector3fByState(&eyeSparkleSpawnPositions[mask][i], &sp58);
+ Matrix_MultiplyVector3fByState(&eyeSparkleSpawnPositions[mask][i], &sp58);
EffectSsKiraKira_SpawnDispersed(globalCtx, &sp58, &D_801D15B0, &D_801D15B0, &primColor, &envColor, 6000, -10);
}
}
@@ -156,9 +156,9 @@ void BgKin2Fence_Init(Actor* thisx, GlobalContext* globalCtx) {
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000908);
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements);
- SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
- this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
- Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, 1);
+ Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
+ Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
for (i = 0; i < 4; i++) {
Collider_UpdateSpheres(i, &this->collider);
diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c
index 063af19d2..72b196ab0 100644
--- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c
+++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c
@@ -25,7 +25,7 @@ extern Gfx D_06000088[];
extern CollisionHeader D_060011C0;
void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 cutsceneId = this->dyna.actor.cutscene;
s16 prevTimer;
diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.c b/src/overlays/actors/ovl_Boss_07/z_boss_07.c
index bcdef5ee1..480945074 100644
--- a/src/overlays/actors/ovl_Boss_07/z_boss_07.c
+++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.c
@@ -68,15 +68,16 @@ void func_809FF6B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
void func_809FF810(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx);
void Boss07_Static_DrawEffects(GlobalContext* globalCtx);
void Boss07_Static_DrawLight(Boss07* this, GlobalContext* globalCtx);
-void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull,
- Vec3f* arg6, f32 arg7, u8 arg8, f32 arg9);
+void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot,
+ Vec3f* pull, Vec3f* arg6, f32 arg7, u8 arg8, f32 arg9);
void Boss07_Mask_DrawTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* rot, f32 arg4, f32 arg5);
void Boss07_Mask_DrawBeam(Boss07* this, GlobalContext* globalCtx);
void Boss07_Mask_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
-void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull, f32 arg6,
- f32 arg7, f32 arg8, f32 arg9, Vec3s* argA, s16 argB, f32 scale, s32 whipHand);
+void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull,
+ f32 arg6, f32 arg7, f32 arg8, f32 arg9, Vec3s* argA, s16 argB, f32 scale, s32 whipHand);
void Boss07_Wrath_DrawWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* rot, f32 arg4, s32 whipHand);
-s32 Boss07_Wrath_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
+s32 Boss07_Wrath_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx);
void Boss07_Wrath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
void Boss07_Wrath_UnkLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx);
void Boss07_Wrath_DrawShocks(Boss07* this, GlobalContext* globalCtx);
@@ -451,7 +452,7 @@ const ActorInit Boss_07_InitVars = {
(ActorFunc)Boss07_Wrath_Draw,
};
-static ColliderJntSphElementInit D_80A07A40[11] = {
+static ColliderJntSphElementInit sWrathJntSphElementsInit1[11] = {
{
{
ELEMTYPE_UNK3,
@@ -585,7 +586,7 @@ static ColliderJntSphInit sWrathJntSphInit1 = {
COLSHAPE_JNTSPH,
},
11,
- D_80A07A40,
+ sWrathJntSphElementsInit1,
};
static ColliderCylinderInit sWrathCylInit = {
@@ -608,7 +609,7 @@ static ColliderCylinderInit sWrathCylInit = {
{ 80, 200, 0, { 0, 0, 0 } },
};
-static ColliderJntSphElementInit D_80A07C08[1] = {
+static ColliderJntSphElementInit sWrathJntSphElementsInit2[1] = {
{
{
ELEMTYPE_UNK3,
@@ -632,7 +633,7 @@ static ColliderJntSphInit sWrathJntSphInit2 = {
COLSHAPE_JNTSPH,
},
1,
- D_80A07C08,
+ sWrathJntSphElementsInit2,
};
static ColliderQuadInit sMaskQuadInit1 = {
@@ -675,7 +676,7 @@ static ColliderQuadInit sMaskQuadInit2 = {
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
-static ColliderJntSphElementInit D_80A07CDC[11] = {
+static ColliderJntSphElementInit sIncarnationJntSphElementsInit[11] = {
{
{
ELEMTYPE_UNK3,
@@ -809,7 +810,7 @@ static ColliderJntSphInit sIncarnationJntSphInit1 = {
COLSHAPE_JNTSPH,
},
11,
- D_80A07CDC,
+ sIncarnationJntSphElementsInit,
};
static ColliderCylinderInit sShotCylInit = {
@@ -940,7 +941,7 @@ void Boss07_UpdateSpheres(s32 index, ColliderJntSph* collider, Vec3f* pos) {
}
s32 Boss07_IsFacingPlayer(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x3000) &&
(ABS_ALT((s16)(this->actor.yawTowardsPlayer - (s16)(player->actor.shape.rot.y + 0x8000))) < 0x3000)) {
@@ -957,8 +958,8 @@ void func_809F4CBC(Boss07* this, f32 arg1) {
}
void func_809F4D10(Vec3f* arg0, f32 arg1) {
- SysMatrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), 0);
- SysMatrix_GetStateTranslationAndScaledZ(arg1, arg0);
+ Matrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), 0);
+ Matrix_GetStateTranslationAndScaledZ(arg1, arg0);
}
void func_809F4D54(Boss07* this, GlobalContext* globalCtx, u8 arg2, u8 arg3) {
@@ -984,14 +985,14 @@ void func_809F4D54(Boss07* this, GlobalContext* globalCtx, u8 arg2, u8 arg3) {
spB0.z = this->unk_1788[phi_s1].z + randPlusMinusPoint5Scaled(20.0f);
spB0.x = this->unk_1788[phi_s1].x + randPlusMinusPoint5Scaled(20.0f);
}
- func_800B0EB0(globalCtx, &spB0, &spA4, &sp98, &sDarkOrange1, &sDarkRed1, Rand_ZeroFloat(150.0f) + 350.0f, 10,
- Rand_ZeroFloat(5.0f) + 14.0f);
+ func_800B0EB0(globalCtx, &spB0, &spA4, &sp98, &sDarkOrange1, &sDarkRed1, Rand_ZeroFloat(150.0f) + 350.0f,
+ 10, Rand_ZeroFloat(5.0f) + 14.0f);
}
}
}
void func_809F4FAC(GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (SQXZ(player->actor.world.pos) < SQ(80.0f)) {
player->actor.world.pos.z = 90.0f;
@@ -1021,7 +1022,7 @@ void func_809F4FF8(GlobalContext* globalCtx, Vec3f* arg1, u8 arg2) {
}
void func_809F51E8(Boss07* this, GlobalContext* globalCtx, u8 arg2) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk_15C == 0) && (((this->actionFunc != func_809F7968) && (this->actionFunc != func_809F76D0) &&
(this->actionFunc != func_809F77A8)) ||
@@ -1079,8 +1080,8 @@ void Boss07_Wrath_BlastWhip(Vec3f* bombPos, Vec3f* pos, Vec3f* pull) {
sp50.y = push;
sp50.z = push;
- SysMatrix_InsertYRotation_f(Math_Acot2F(dz, dx), 0);
- SysMatrix_MultiplyVector3fByState(&sp50, pull);
+ Matrix_InsertYRotation_f(Math_Acot2F(dz, dx), 0);
+ Matrix_MultiplyVector3fByState(&sp50, pull);
}
}
}
@@ -1113,7 +1114,12 @@ static Vec3s sRemainsEnd[REMAINS_COUNT] = {
#ifdef NON_MATCHING
// reordering when loading Boss07_Projectile_Update
void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
- static s16 sRemainsParams[REMAINS_COUNT] = { MAJORA_REMAINS + REMAINS_ODOLWA, MAJORA_REMAINS + REMAINS_GOHT, MAJORA_REMAINS + REMAINS_GYORG, MAJORA_REMAINS + REMAINS_TWINMOLD, };
+ static s16 sRemainsParams[REMAINS_COUNT] = {
+ MAJORA_REMAINS + REMAINS_ODOLWA,
+ MAJORA_REMAINS + REMAINS_GOHT,
+ MAJORA_REMAINS + REMAINS_GYORG,
+ MAJORA_REMAINS + REMAINS_TWINMOLD,
+ };
static EffTireMarkInit sTopTireMarkInit = { 0, 40, { 0, 0, 15, 200 } };
static EffTireMarkInit sMaskTireMarkInit = { 0, 40, { 0, 0, 15, 200 } };
GlobalContext* globalCtx = globalCtx2;
@@ -1143,15 +1149,15 @@ void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
sBossRemains[i] = NULL;
}
}
-
+
this->actor.targetMode = 5;
this->actor.colChkInfo.mass = MASS_HEAVY;
this->actor.gravity = -2.5f;
- if(1) {}
+ if (1) {}
if (this->actor.params >= MAJORA_REMAINS) {
this->actor.update = Boss07_Remains_Update;
this->actor.draw = Boss07_Remains_Draw;
- if(1) {}
+ if (1) {}
sBossRemains[this->actor.params - MAJORA_REMAINS] = this;
if (gSaveContext.eventInf[6] & 2) {
Actor_SetScale(&this->actor, 0.03f);
@@ -1213,15 +1219,15 @@ void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
Collider_InitAndSetQuad(globalCtx, &this->quad1, &this->actor, &sMaskQuadInit1);
Collider_InitAndSetQuad(globalCtx, &this->quad2, &this->actor, &sMaskQuadInit2);
this->actor.colChkInfo.health = 14;
- for (i = 0; i < ARRAY_COUNT(sBossRemains); i++) {
+ for (i = 0; i < ARRAY_COUNT(sRemainsParams); i++) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_07, 0.0f, 0.0f, 0.0f, 0, 0, 0,
sRemainsParams[i]);
}
}
} else if ((this->actor.params == MAJORA_INCARNATION) || (this->actor.params == MAJORA_AFTERIMAGE)) {
Actor_SetScale(&this->actor, 0.015000001f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060099A0, &D_0600A6AC, this->jointTable1,
- this->morphTable1, MAJORA_INCARNATION_LIMB_COUNT);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060099A0, &D_0600A6AC, this->jointTable1,
+ this->morphTable1, MAJORA_INCARNATION_LIMB_COUNT);
if (this->actor.params == MAJORA_AFTERIMAGE) {
this->timers[0] = this->actor.world.rot.z;
this->actor.world.rot.z = 0;
@@ -1233,7 +1239,8 @@ void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.colChkInfo.health = 30;
this->actor.update = Boss07_Incarnation_Update;
this->actor.draw = Boss07_Incarnation_Draw;
- Collider_InitAndSetJntSph(globalCtx, &this->sph1, &this->actor, &sIncarnationJntSphInit1, this->sphElems1);
+ Collider_InitAndSetJntSph(globalCtx, &this->sph1, &this->actor, &sIncarnationJntSphInit1,
+ this->sphElems1);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 80.0f);
this->csCamIndex = this->actor.shape.rot.z;
if (this->csCamIndex != 0) {
@@ -1265,12 +1272,12 @@ void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->whipScale = whipScale;
Audio_QueueSeqCmd(0x8069);
}
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060335F0, &D_0603CBD0, this->jointTable1,
- this->morphTable1, MAJORA_WRATH_LIMB_COUNT);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060335F0, &D_0603CBD0, this->jointTable1,
+ this->morphTable1, MAJORA_WRATH_LIMB_COUNT);
Collider_InitAndSetJntSph(globalCtx, &this->sph1, &this->actor, &sWrathJntSphInit1, this->sphElems1);
Collider_InitAndSetJntSph(globalCtx, &this->sph2, &this->actor, &sWrathJntSphInit2, this->sphElems2);
Collider_InitAndSetCylinder(globalCtx, &this->cyl1, &this->actor, &sWrathCylInit);
-
+
this->leftWhip.stiffness = this->rightWhip.stiffness = 0.7f;
this->leftWhip.drag = this->rightWhip.drag = 2.0f;
this->leftWhip.gravity = this->rightWhip.gravity = -15.0f;
@@ -1278,7 +1285,6 @@ void Boss07_Init(Actor* thisx, GlobalContext* globalCtx2) {
sWhipSegCount = 44;
this->unk_17E0 = 1.0f;
-
}
}
}
@@ -1305,7 +1311,7 @@ void Boss07_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
void func_809F5E14(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809F5E88;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06023DAC, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06023DAC, 0.0f);
this->actor.flags &= ~1;
this->unk_17D8 = 0x7F00;
this->unk_15C = 20;
@@ -1318,9 +1324,9 @@ void func_809F5E88(Boss07* this, GlobalContext* globalCtx) {
{ 60.0f, 390.0f, 110.0f }, { 30.0f, 430.0f, 110.0f },
};
this->unk_15C = 20;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_ABC8++;
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
switch (this->csState) {
case 0:
@@ -1348,7 +1354,7 @@ void func_809F5E88(Boss07* this, GlobalContext* globalCtx) {
}
}
if (this->unk_ABC8 > 60) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 dataIndex = 0;
if (0) {}
@@ -1367,8 +1373,8 @@ void func_809F5E88(Boss07* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->csCamNextAt.y, D_80A07F6C[dataIndex][2], 0.075f, this->csCamSpeedMod * 7.0f);
Math_ApproachF(&this->csCamSpeedMod, 1.0f, 1.0f, 0.01f);
if (this->unk_ABC8 == 70) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06025018, -15.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06025018);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06025018, -15.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06025018);
func_8019FE1C(&this->actor.projectedPos, NA_SE_EV_ICE_PILLAR_RISING, 1.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_SHOUT);
}
@@ -1394,7 +1400,7 @@ void func_809F5E88(Boss07* this, GlobalContext* globalCtx) {
Actor_TitleCardCreate(globalCtx, &globalCtx->actorCtx.titleCtxt,
Lib_SegmentedToVirtual(&D_06032040), 0xA0, 0xB4, 0x80, 0x28);
}
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
s32 i;
Camera* sp48 = Play_GetCamera(globalCtx, 0);
@@ -1418,8 +1424,8 @@ void func_809F5E88(Boss07* this, GlobalContext* globalCtx) {
}
break;
}
- SysMatrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
+ Matrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
+ Matrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
if (this->csCamIndex != 0) {
ShrinkWindow_SetLetterboxTarget(0x1B);
Play_CameraSetAtEye(globalCtx, this->csCamIndex, &this->csCamAt, &this->csCamEye);
@@ -1440,7 +1446,7 @@ void func_809F64F4(Boss07* this, GlobalContext* globalCtx) {
this->leftWhip.tension = 0.0f;
this->rightWhip.gravity = -15.0f;
this->leftWhip.gravity = -15.0f;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06022BB4, 0.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06022BB4, 0.0f);
this->actor.flags &= ~1;
this->csState = 0;
this->unk_ABC8 = 0;
@@ -1458,7 +1464,7 @@ void func_809F65F4(Boss07* this, GlobalContext* globalCtx) {
s32 i;
s32 spC0 = 0;
Vec3f spB4;
- Vec3f spA8 = {0.0f, 0.0f, 0.0f};
+ Vec3f spA8 = { 0.0f, 0.0f, 0.0f };
f32 spA4;
f32 spA0;
Camera* camera;
@@ -1526,7 +1532,7 @@ void func_809F65F4(Boss07* this, GlobalContext* globalCtx) {
spA0 = 1.0f;
} else if ((this->unk_ABC8 >= 80) && (this->unk_ABC8 < 110)) {
if (this->unk_ABC8 == 80) {
- this->skelAnime.animCurrentFrame -= 30.0f;
+ this->skelAnime.curFrame -= 30.0f;
func_8019F1C0(&sSfxPoint, NA_SE_EN_LAST3_DEAD_WIND2_OLD);
}
spB4.x = -10.0f;
@@ -1635,8 +1641,8 @@ void func_809F65F4(Boss07* this, GlobalContext* globalCtx) {
this->csCamRotVel = 0.02f;
}
if (this->unk_ABC8 >= (sREG(93) + 180)) {
- Vec3f sp84 = {0.0f, 10.0f, 0.0f};
- Vec3f sp78 = {0.0f, -0.5f, 0.0f};
+ Vec3f sp84 = { 0.0f, 10.0f, 0.0f };
+ Vec3f sp78 = { 0.0f, -0.5f, 0.0f };
Vec3f sp6C;
f32 sp68;
@@ -1662,8 +1668,8 @@ void func_809F65F4(Boss07* this, GlobalContext* globalCtx) {
}
break;
}
- SysMatrix_InsertYRotation_f(this->csCamRotY, 0);
- SysMatrix_MultiplyVector3fByState(&spB4, &this->csCamNextEye);
+ Matrix_InsertYRotation_f(this->csCamRotY, 0);
+ Matrix_MultiplyVector3fByState(&spB4, &this->csCamNextEye);
this->csCamNextEye.x += this->actor.focus.pos.x;
this->csCamNextEye.y += this->actor.focus.pos.y;
this->csCamNextEye.z += this->actor.focus.pos.z;
@@ -1683,7 +1689,7 @@ void func_809F65F4(Boss07* this, GlobalContext* globalCtx) {
sp5C.z = this->csCamAt.z + spA8.z;
Play_CameraSetAtEye(globalCtx, this->csCamIndex, &sp5C, &this->csCamEye);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_ABC8++;
}
#else
@@ -1695,7 +1701,7 @@ static Vec3f D_80A07FC0 = { 0.0f, -0.5f, 0.0f };
void func_809F7400(Boss07* this, GlobalContext* globalCtx, s16 arg2) {
this->actionFunc = func_809F748C;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0603CBD0, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0603CBD0, -10.0f);
if (arg2 != 0) {
this->timers[0] = arg2;
} else {
@@ -1705,9 +1711,9 @@ void func_809F7400(Boss07* this, GlobalContext* globalCtx, s16 arg2) {
}
void func_809F748C(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
this->rightWhip.stiffness = 0.7f;
this->leftWhip.stiffness = 0.7f;
@@ -1741,12 +1747,12 @@ void func_809F748C(Boss07* this, GlobalContext* globalCtx) {
void func_809F7688(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809F76D0;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06025878, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06025878, -5.0f);
this->unk_14C = 0;
}
void func_809F76D0(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->rightWhip.stiffness = 0.7f;
this->leftWhip.stiffness = 0.7f;
this->rightWhip.drag = 2.0f;
@@ -1768,7 +1774,7 @@ void func_809F77A8(Boss07* this, GlobalContext* globalCtx) {
if (this->unk_14C == 13) {
func_8019F1C0(&sSfxPoint, NA_SE_EN_LAST3_VOICE_LAUGH_OLD);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 1) {
func_809F7400(this, globalCtx, 1);
this->unk_156 = 5;
@@ -1791,13 +1797,13 @@ void func_809F783C(Boss07* this, GlobalContext* globalCtx) {
temp = this->actor.yawTowardsPlayer - (s16)(Math_Acot2F(dz, dx) * (0x8000 / M_PI));
if (temp < 0) {
dx = 200.0f;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603D224, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603D224, -5.0f);
} else {
dx = -200.0f;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603D7F0, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603D7F0, -5.0f);
}
Matrix_RotateY(this->actor.yawTowardsPlayer, 0);
- SysMatrix_GetStateTranslationAndScaledX(dx, &sp30);
+ Matrix_GetStateTranslationAndScaledX(dx, &sp30);
dx = sp30.x - this->actor.world.pos.x;
dz = sp30.z - this->actor.world.pos.z;
this->actor.world.rot.y = Math_Acot2F(dz, dx) * (0x8000 / M_PI);
@@ -1807,7 +1813,7 @@ void func_809F783C(Boss07* this, GlobalContext* globalCtx) {
void func_809F7968(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->rightWhip.stiffness = 0.7f;
this->leftWhip.stiffness = 0.7f;
this->rightWhip.drag = 2.0f;
@@ -1838,19 +1844,19 @@ void func_809F7AB4(Boss07* this, GlobalContext* globalCtx) {
s16 sp22;
this->actionFunc = func_809F7BC4;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0603DD1C, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0603DD1C, -5.0f);
phi_f14 = -this->actor.world.pos.x;
phi_f12 = -this->actor.world.pos.z;
sp22 = this->actor.yawTowardsPlayer - (s16)(Math_Acot2F(phi_f12, phi_f14) * (0x8000 / M_PI));
Matrix_RotateY(this->actor.shape.rot.y, 0);
if (sp22 < 0) {
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
phi_f14 = 300.0f;
} else {
- this->skelAnime.animPlaybackSpeed = -1.0f;
+ this->skelAnime.playSpeed = -1.0f;
phi_f14 = -300.0f;
}
- SysMatrix_GetStateTranslationAndScaledX(phi_f14, &this->unk_164);
+ Matrix_GetStateTranslationAndScaledX(phi_f14, &this->unk_164);
this->unk_164.x += this->actor.world.pos.x;
this->unk_164.z += this->actor.world.pos.z;
this->timers[1] = 21;
@@ -1860,7 +1866,7 @@ void func_809F7AB4(Boss07* this, GlobalContext* globalCtx) {
}
void func_809F7BC4(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk_14C == 20) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST3_VOICE_KICK_OLD);
}
@@ -1890,7 +1896,7 @@ void func_809F7BC4(Boss07* this, GlobalContext* globalCtx) {
}
void func_809F7D2C(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actionFunc = func_809F805C;
this->timers[1] = 0;
@@ -1910,45 +1916,45 @@ void func_809F7D2C(Boss07* this, GlobalContext* globalCtx) {
}
switch (this->unk_14E) {
case 0:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06033F80, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06033F80);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06033F80, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06033F80);
break;
case 1:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06034E64, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06034E64);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06034E64, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06034E64);
break;
case 2:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060358C4, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_060358C4);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060358C4, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_060358C4);
break;
case 3:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06036A7C, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06036A7C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06036A7C, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06036A7C);
break;
case 4:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603C4E0, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_0603C4E0);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603C4E0, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_0603C4E0);
func_809F4D10(&this->unk_164, 650.0f);
this->unk_170 = 0.0f;
break;
case 5:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06037ADC, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06037ADC);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06037ADC, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06037ADC);
break;
case 6:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603918C, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_0603918C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603918C, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_0603918C);
break;
case 7:
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06026204, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06026204);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06026204, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06026204);
break;
}
this->unk_14C = 0;
}
void func_809F805C(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
this->rightWhip.stiffness = 0.79999995f;
this->leftWhip.stiffness = 0.79999995f;
@@ -2088,20 +2094,20 @@ void func_809F805C(Boss07* this, GlobalContext* globalCtx) {
}
break;
}
- if (func_801378B8(&this->skelAnime, this->unk_1D4) || (this->timers[1] == 1)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4) || (this->timers[1] == 1)) {
func_809F7400(this, globalCtx, 0);
}
}
void func_809F8658(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809F86B8;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06026EA0, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06026EA0);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06026EA0, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06026EA0);
this->unk_14C = 0;
}
void func_809F86B8(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - 0x800, 3, 0x2000);
func_809F4CBC(this, 2.0f);
this->rightWhip.stiffness = 0.79999995f;
@@ -2123,9 +2129,9 @@ void func_809F86B8(Boss07* this, GlobalContext* globalCtx) {
void func_809F87C8(Boss07* this, GlobalContext* globalCtx) {
s32 sp2C;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
player->actor.world.pos = this->unk_F80;
this->actor.flags &= ~1;
@@ -2135,8 +2141,8 @@ void func_809F87C8(Boss07* this, GlobalContext* globalCtx) {
func_8019F1C0(&sSfxPoint, NA_SE_EN_LAST3_VOICE_THROW_OLD);
play_sound(NA_SE_EN_LAST3_COIL_ATTACK_OLD);
this->actionFunc = func_809F8908;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06027270, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06027270);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06027270, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06027270);
this->unk_14C = 0;
}
if ((func_800B64FC(globalCtx, 1000.0f, &this->actor.world.pos, &sp2C) >= 0.0f) && (sp2C == 1)) {
@@ -2145,12 +2151,12 @@ void func_809F87C8(Boss07* this, GlobalContext* globalCtx) {
}
void func_809F8908(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 phi_f0;
f32 phi_f2;
s32 sp30;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_15A = 20;
if (this->unk_14C == 6) {
this->unk_F7E = 0;
@@ -2180,7 +2186,7 @@ void func_809F8908(Boss07* this, GlobalContext* globalCtx) {
func_809F8AB0(this, globalCtx);
}
}
- if (func_801378B8(&this->skelAnime, this->unk_1D4) != 0) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4) != 0) {
func_809F7400(this, globalCtx, 0);
}
}
@@ -2204,9 +2210,9 @@ void func_809F8AB0(Boss07* this, GlobalContext* globalCtx) {
void func_809F8B1C(Boss07* this, GlobalContext* globalCtx) {
s32 i;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
player->actor.world.pos = this->unk_F80;
this->actor.flags &= ~1;
@@ -2228,8 +2234,8 @@ void func_809F8B1C(Boss07* this, GlobalContext* globalCtx) {
}
if (this->unk_32C > 4.0f) {
this->actionFunc = func_809F8D04;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603B330, -10.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_0603B330);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603B330, -10.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_0603B330);
this->unk_F7E = 0;
if (&this->actor == player->actor.parent) {
player->unk_AE8 = 101;
@@ -2245,7 +2251,7 @@ void func_809F8B1C(Boss07* this, GlobalContext* globalCtx) {
void func_809F8D04(Boss07* this, GlobalContext* globalCtx) {
s32 i;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_15A = 20;
for (i = 0; i < 2; i++) {
if (this->unk_780 != 0) {
@@ -2258,7 +2264,7 @@ void func_809F8D04(Boss07* this, GlobalContext* globalCtx) {
play_sound(NA_SE_EN_BIRI_SPARK - SFX_FLAG);
Math_ApproachF(&globalCtx->envCtx.unk_DC, 1.0f, 1.0f, 0.3f);
}
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
func_809F51E8(this, globalCtx, true);
}
}
@@ -2266,8 +2272,8 @@ void func_809F8D04(Boss07* this, GlobalContext* globalCtx) {
void func_809F8DEC(Boss07* this, GlobalContext* globalCtx) {
if (this->actionFunc != func_809F91D4) {
this->actionFunc = func_809F91D4;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0603B330, -10.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_0603B330);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0603B330, -10.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_0603B330);
}
this->unk_158 = 10;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE_OLD);
@@ -2275,8 +2281,8 @@ void func_809F8DEC(Boss07* this, GlobalContext* globalCtx) {
void func_809F8E68(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809F8EC8;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060269EC, -5.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_060269EC);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060269EC, -5.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_060269EC);
this->unk_14C = 0;
}
@@ -2300,7 +2306,7 @@ void func_809F8EC8(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST3_VOICE_KOMA_OLD);
}
if ((this->unk_14C < (s16)(KREG(40) + 14)) || ((s16)(KREG(41) + 17) < this->unk_14C)) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
if ((this->unk_14C >= (s16)(KREG(40) + 14)) &&
((this->unk_14C <= (s16)(KREG(41) + 17)) || ((s16)(KREG(42) + 21) <= this->unk_14C))) {
@@ -2316,7 +2322,7 @@ void func_809F8EC8(Boss07* this, GlobalContext* globalCtx) {
this->leftWhip.tension = this->rightWhip.tension = 0.0f;
this->rightWhip.gravity = -5.0f;
this->leftWhip.gravity = -15.0f;
-
+
if (((s16)(KREG(43) + 12) <= this->unk_14C) && (this->unk_14C <= (s16)(KREG(44) + 17))) {
this->rightWhip.tension = KREG(6) + 500.0f;
}
@@ -2326,14 +2332,14 @@ void func_809F8EC8(Boss07* this, GlobalContext* globalCtx) {
}
void func_809F91D4(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_8019F1C0(&sSfxPoint, NA_SE_EN_COMMON_WEAKENED - SFX_FLAG);
func_809F4CBC(this, 2.0f);
this->leftWhip.stiffness = this->rightWhip.stiffness = 0.7f;
this->leftWhip.gravity = this->rightWhip.gravity = -15.0f;
this->leftWhip.tension = this->rightWhip.tension = 0.0f;
this->leftWhip.drag = this->rightWhip.drag = 2.0f;
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
func_809F51E8(this, globalCtx, true);
}
}
@@ -2353,22 +2359,22 @@ void func_809F9280(Boss07* this, GlobalContext* globalCtx, u8 arg2, u8 arg3) {
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE2_OLD);
if (this->actionFunc != func_809F93DC) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0601DEB4, -10.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0601DEB4, -10.0f);
this->actionFunc = func_809F93DC;
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_0601DEB4);
+ this->unk_1D4 = Animation_GetLastFrame(&D_0601DEB4);
this->unk_ABCC = 0;
} else if (arg3 == 14) {
- if (this->skelAnime.animCurrentFrame <= (this->unk_1D4 - 5.0f)) {
+ if (this->skelAnime.curFrame <= (this->unk_1D4 - 5.0f)) {
this->unk_158 = 30;
} else {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0601DEB4, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0601DEB4, -5.0f);
}
}
}
}
void func_809F93DC(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_ABCC++;
if ((this->unk_ABCC % 16) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_WALK2_OLD);
@@ -2382,7 +2388,7 @@ void func_809F93DC(Boss07* this, GlobalContext* globalCtx) {
this->leftWhip.drag = 2.0f;
this->rightWhip.tension = 0.0f;
this->leftWhip.tension = 0.0f;
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
func_809F51E8(this, globalCtx, true);
}
}
@@ -2390,7 +2396,7 @@ void func_809F93DC(Boss07* this, GlobalContext* globalCtx) {
void func_809F94AC(Vec3f* arg0, f32 arg1, Boss07* this, GlobalContext* globalCtx) {
s32 i;
s32 sp98 = -1;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 dx;
f32 dy;
f32 dz;
@@ -2477,7 +2483,7 @@ void func_809F99C4(Boss07* this, GlobalContext* globalCtx) {
s32 i;
s32 j;
u8 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->unk_15C == 0) {
if (this->sph2.elements[0].info.toucherFlags & 2) {
@@ -2657,7 +2663,7 @@ void Boss07_Wrath_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Boss07* this = THIS;
s32 i;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
globalCtx->envCtx.unk_C1 = 2;
globalCtx->envCtx.unk_C2 = 0;
@@ -2778,8 +2784,9 @@ void Boss07_Wrath_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
}
-void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull, f32 gravity,
- f32 stiffness, f32 drag, f32 tension, Vec3s* baseRot, s16 argB, f32 scale, s32 whipHand) {
+void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull,
+ f32 gravity, f32 stiffness, f32 drag, f32 tension, Vec3s* baseRot, s16 argB, f32 scale,
+ s32 whipHand) {
s32 i;
s32 phi_s6;
f32 temp_f20;
@@ -2789,7 +2796,7 @@ void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* bas
f32 phi_f0;
Vec3f* temp = pull;
f32 temp1;
- Vec3f spB8 = {0.0f, 0.0f, 0.0f};
+ Vec3f spB8 = { 0.0f, 0.0f, 0.0f };
Vec3f spAC;
Vec3f spA0;
Vec3f sp94;
@@ -2809,18 +2816,18 @@ void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* bas
}
spAC.z = 20.0f;
Matrix_RotateY(baseRot->y, 0);
- SysMatrix_InsertXRotation_s(baseRot->x, 1);
- SysMatrix_InsertZRotation_s(baseRot->z, 1);
+ Matrix_InsertXRotation_s(baseRot->x, 1);
+ Matrix_InsertZRotation_s(baseRot->z, 1);
Matrix_RotateY(0x4000, 1);
- SysMatrix_GetStateTranslationAndScaledZ(spAC.z, &sp94);
+ Matrix_GetStateTranslationAndScaledZ(spAC.z, &sp94);
if (argB != 0) {
spAC.z = 200.0f;
- SysMatrix_InsertYRotation_f(this->unk_F8C, 0);
- SysMatrix_RotateStateAroundXAxis(this->unk_F90);
+ Matrix_InsertYRotation_f(this->unk_F8C, 0);
+ Matrix_RotateStateAroundXAxis(this->unk_F90);
} else {
spAC.z = tension;
}
- SysMatrix_GetStateTranslationAndScaledZ(spAC.z, &sp7C);
+ Matrix_GetStateTranslationAndScaledZ(spAC.z, &sp7C);
pos++;
rot++;
@@ -2852,9 +2859,9 @@ void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* bas
temp1 = -Math_Acot2F(sqrtf(SQ(temp_f24) + SQ(temp_f20)), temp_f26);
(rot - 1)->y = temp_f22;
(rot - 1)->x = temp1;
- SysMatrix_InsertYRotation_f(temp_f22, 0);
- SysMatrix_RotateStateAroundXAxis(temp1);
- SysMatrix_GetStateTranslationAndScaledZ(spB8.z, &spA0);
+ Matrix_InsertYRotation_f(temp_f22, 0);
+ Matrix_RotateStateAroundXAxis(temp1);
+ Matrix_GetStateTranslationAndScaledZ(spB8.z, &spA0);
if (1) {}
temp_f24 = pos->x;
temp_f26 = pos->y;
@@ -2868,7 +2875,7 @@ void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* bas
spAC.x = 15.0f;
spAC.y = -30.0f;
spAC.z = -12.0f;
- SysMatrix_MultiplyVector3fByState(&spAC, &spA0);
+ Matrix_MultiplyVector3fByState(&spAC, &spA0);
this->unk_F80.x = pos->x + spA0.x;
this->unk_F80.y = pos->y + spA0.y;
this->unk_F80.z = pos->z + spA0.z;
@@ -2877,7 +2884,7 @@ void Boss07_Wrath_UpdateWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* bas
spAC.x = KREG(60);
spAC.y = KREG(61);
spAC.z = KREG(62);
- SysMatrix_MultiplyVector3fByState(&spAC, &spA0);
+ Matrix_MultiplyVector3fByState(&spAC, &spA0);
this->unk_F80.x = pos->x + spA0.x;
this->unk_F80.y = pos->y + spA0.y;
this->unk_F80.z = pos->z + spA0.z;
@@ -2921,10 +2928,10 @@ void Boss07_Wrath_DrawWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* pos,
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sREG(48) + 45, 35, 75, 255);
phi_s6 = (hand == 0) ? this->unk_778 : 0;
for (i = 0; i < (sWhipSegCount - phi_s6) - 1; i++, pos++, rot++) {
- SysMatrix_InsertTranslation(pos->x, 0.0f, pos->z, 0);
+ Matrix_InsertTranslation(pos->x, 0.0f, pos->z, 0);
Matrix_Scale(1.0f, 0.0f, 1.0f, 1);
- SysMatrix_InsertYRotation_f(rot->y, 1);
- SysMatrix_RotateStateAroundXAxis(rot->x);
+ Matrix_InsertYRotation_f(rot->y, 1);
+ Matrix_RotateStateAroundXAxis(rot->x);
phi_f12 = (i > 24) ? 0.025f : ((f32)(24 - i) * 1 * 0.001f) + 0.025f;
Matrix_Scale(phi_f12, phi_f12, ((2 * arg4) + 0.5f) * 0.01f, 1);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
@@ -2935,9 +2942,9 @@ void Boss07_Wrath_DrawWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* pos,
gSPDisplayList(POLY_OPA_DISP++, D_0602EE50);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 80, 255);
for (i = 0; i < (sWhipSegCount - phi_s6) - 1; i++, pos++, rot++) {
- SysMatrix_InsertTranslation(pos->x, pos->y, pos->z, 0);
- SysMatrix_InsertYRotation_f(rot->y, 1);
- SysMatrix_RotateStateAroundXAxis(rot->x);
+ Matrix_InsertTranslation(pos->x, pos->y, pos->z, 0);
+ Matrix_InsertYRotation_f(rot->y, 1);
+ Matrix_RotateStateAroundXAxis(rot->x);
phi_f12 = (i > 24) ? 0.025f : ((f32)(24 - i) * 1 * 0.001f) + 0.025f;
Matrix_Scale(phi_f12, phi_f12, ((2 * arg4) + 0.5f) * 0.01f, 1);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
@@ -2946,7 +2953,8 @@ void Boss07_Wrath_DrawWhips(Boss07* this, GlobalContext* globalCtx, Vec3f* pos,
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
-s32 Boss07_Wrath_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+s32 Boss07_Wrath_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx) {
Boss07* this = THIS;
if (limbIndex == 26) {
@@ -2978,36 +2986,36 @@ void Boss07_Wrath_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
sp6B = sWrathBodyParts[limbIndex];
if (sp6B >= 0) {
- SysMatrix_GetStateTranslation(&this->bodyPartsPos[sp6B]);
+ Matrix_GetStateTranslation(&this->bodyPartsPos[sp6B]);
}
sp6B = sWrathColliders[limbIndex];
if (sp6B >= 0) {
if (this->unk_158 != 0) {
- SysMatrix_GetStateTranslationAndScaledZ(100000.0f, &sp5C);
+ Matrix_GetStateTranslationAndScaledZ(100000.0f, &sp5C);
} else {
- SysMatrix_MultiplyVector3fByState(&sWrathColliderOffsets[sp6B], &sp5C);
+ Matrix_MultiplyVector3fByState(&sWrathColliderOffsets[sp6B], &sp5C);
}
Boss07_UpdateSpheres(sp6B, &this->sph1, &sp5C);
}
if (limbIndex == 26) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
if (limbIndex == 19) {
- SysMatrix_MultiplyVector3fByState(&sWhipOffset, &this->rightWhip.basePos);
+ Matrix_MultiplyVector3fByState(&sWhipOffset, &this->rightWhip.basePos);
}
if (limbIndex == 17) {
- SysMatrix_CopyCurrentState(&sp1C);
+ Matrix_CopyCurrentState(&sp1C);
func_8018219C(&sp1C, &this->rightWhip.baseRot, 0);
}
if (limbIndex == 24) {
- SysMatrix_MultiplyVector3fByState(&sWhipOffset, &this->leftWhip.basePos);
+ Matrix_MultiplyVector3fByState(&sWhipOffset, &this->leftWhip.basePos);
}
if (limbIndex == 22) {
- SysMatrix_CopyCurrentState(&sp1C);
+ Matrix_CopyCurrentState(&sp1C);
func_8018219C(&sp1C, &this->leftWhip.baseRot, 0);
}
if (limbIndex == 12) {
- SysMatrix_GetStateTranslation(&sp5C);
+ Matrix_GetStateTranslation(&sp5C);
Boss07_UpdateSpheres(0, &this->sph2, &sp5C);
}
}
@@ -3035,19 +3043,19 @@ void Boss07_Wrath_DrawShocks(Boss07* this, GlobalContext* globalCtx) {
if (this->unk_32C > 0.0f) {
gSPDisplayList(POLY_XLU_DISP++, D_04023348);
for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) {
- SysMatrix_InsertTranslation(this->bodyPartsPos[i].x, this->bodyPartsPos[i].y, this->bodyPartsPos[i].z, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(this->bodyPartsPos[i].x, this->bodyPartsPos[i].y, this->bodyPartsPos[i].z, 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(this->unk_32C, this->unk_32C, this->unk_32C, 1);
- SysMatrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
+ Matrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
}
for (i = this->unk_780; i >= this->unk_784; i--) {
- SysMatrix_InsertTranslation(this->rightWhip.pos[i].x, this->rightWhip.pos[i].y,
- this->rightWhip.pos[i].z, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(this->rightWhip.pos[i].x, this->rightWhip.pos[i].y, this->rightWhip.pos[i].z,
+ 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(1.5f, 1.5f, 1.5f, 1);
- SysMatrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
+ Matrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
}
@@ -3055,12 +3063,12 @@ void Boss07_Wrath_DrawShocks(Boss07* this, GlobalContext* globalCtx) {
if (this->unk_330 > 0.0f) {
gSPDisplayList(POLY_XLU_DISP++, D_040233B8);
for (i = 0; i < 2 * ARRAY_COUNT(this->bodyPartsPos); i++) {
- SysMatrix_InsertTranslation(this->bodyPartsPos[i / 2].x + randPlusMinusPoint5Scaled(30.0f),
- this->bodyPartsPos[i / 2].y + randPlusMinusPoint5Scaled(30.0f),
- this->bodyPartsPos[i / 2].z + randPlusMinusPoint5Scaled(30.0f), 0);
+ Matrix_InsertTranslation(this->bodyPartsPos[i / 2].x + randPlusMinusPoint5Scaled(30.0f),
+ this->bodyPartsPos[i / 2].y + randPlusMinusPoint5Scaled(30.0f),
+ this->bodyPartsPos[i / 2].z + randPlusMinusPoint5Scaled(30.0f), 0);
Matrix_Scale(this->unk_330, this->unk_330, this->unk_330, 1);
- SysMatrix_RotateStateAroundXAxis(Rand_ZeroFloat(2.0f * M_PI));
- SysMatrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
+ Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2.0f * M_PI));
+ Matrix_InsertZRotation_f(Rand_ZeroFloat(2.0f * M_PI), 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
}
@@ -3086,12 +3094,13 @@ void Boss07_Wrath_DrawDeathLights(Boss07* this, GlobalContext* globalCtx, Vec3f*
temp = D_80A07950[0];
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, temp[0], temp[1], temp[2], 40);
temp_f20 = (Boss07_Wrath_RandZeroOne() * 40.0f) - 30.0f;
- SysMatrix_InsertTranslation(this->bodyPartsPos[2].x, this->bodyPartsPos[2].y - 30.0f + 50.0f + temp_f20 + 25.0f,
- this->bodyPartsPos[2].z, 0);
- SysMatrix_InsertTranslation(arg2->x, arg2->y + temp_f20, arg2->z, 0);
- SysMatrix_InsertYRotation_f(Boss07_Wrath_RandZeroOne() * M_PI * 2.0f, 1);
- SysMatrix_RotateStateAroundXAxis(-0.024999999f * temp_f20);
- SysMatrix_InsertZRotation_f(Boss07_Wrath_RandZeroOne() * M_PI * 2.0f, 1);
+ Matrix_InsertTranslation(this->bodyPartsPos[2].x,
+ this->bodyPartsPos[2].y - 30.0f + 50.0f + temp_f20 + 25.0f,
+ this->bodyPartsPos[2].z, 0);
+ Matrix_InsertTranslation(arg2->x, arg2->y + temp_f20, arg2->z, 0);
+ Matrix_InsertYRotation_f(Boss07_Wrath_RandZeroOne() * M_PI * 2.0f, 1);
+ Matrix_RotateStateAroundXAxis(-0.024999999f * temp_f20);
+ Matrix_InsertZRotation_f(Boss07_Wrath_RandZeroOne() * M_PI * 2.0f, 1);
if (this->unk_AB50[i] > 0.0f) {
Matrix_Scale(this->unk_AB50[i], 1.0f, 12.0f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
@@ -3103,9 +3112,9 @@ void Boss07_Wrath_DrawDeathLights(Boss07* this, GlobalContext* globalCtx, Vec3f*
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, (u8)(220 + sREG(18)), (u8)(170 + sREG(16)));
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, (u8)(100 + sREG(22)), 128);
- SysMatrix_InsertTranslation(this->bodyPartsPos[2].x, this->bodyPartsPos[2].y, this->bodyPartsPos[2].z, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
- SysMatrix_InsertZRotation_s(globalCtx->gameplayFrames * 0x80, 1);
+ Matrix_InsertTranslation(this->bodyPartsPos[2].x, this->bodyPartsPos[2].y, this->bodyPartsPos[2].z, 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertZRotation_s(globalCtx->gameplayFrames * 0x80, 1);
temp_f12_2 = (sREG(17) + 800) * 0.01f * this->unk_AB4C;
Matrix_Scale(temp_f12_2, temp_f12_2, 1.0f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
@@ -3120,10 +3129,9 @@ void Boss07_Static_DrawLight(Boss07* this, GlobalContext* globalCtx) {
f32 sp54;
f32 sp50;
Player* player;
-
OPEN_DISPS(gfxCtx = globalCtx->state.gfxCtx);
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (this->unk_AB44 > 0.0f) {
func_8012C2DC(globalCtx->state.gfxCtx);
@@ -3141,13 +3149,13 @@ void Boss07_Static_DrawLight(Boss07* this, GlobalContext* globalCtx) {
sp54 -= 43.0f;
}
- SysMatrix_InsertTranslation(player->actor.world.pos.x,
- player->actor.world.pos.y + func_800B6FC8(player) - 20.0f + sp54 + sREG(60),
- player->actor.world.pos.z + sREG(61) - 15.0f + sp50, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(player->actor.world.pos.x,
+ player->actor.world.pos.y + func_800B6FC8(player) - 20.0f + sp54 + sREG(60),
+ player->actor.world.pos.z + sREG(61) - 15.0f + sp50, 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(this->unk_AB44, this->unk_AB44, this->unk_AB44, 1);
- SysMatrix_InsertZRotation_s(globalCtx->gameplayFrames * 0x40, 1);
+ Matrix_InsertZRotation_s(globalCtx->gameplayFrames * 0x40, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
}
@@ -3167,19 +3175,21 @@ void Boss07_Wrath_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if ((this->unk_15E % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
}
- SysMatrix_InsertYRotation_f(this->unk_184, 1);
- SysMatrix_RotateStateAroundXAxis(this->unk_188);
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, (s32)this->skelAnime.dListCount,
+ Matrix_InsertYRotation_f(this->unk_184, 1);
+ Matrix_RotateStateAroundXAxis(this->unk_188);
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount,
Boss07_Wrath_OverrideLimbDraw, Boss07_Wrath_PostLimbDraw, Boss07_Wrath_UnkLimbDraw, &this->actor);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
if (((KREG(63) == 0) || (KREG(63) == 2)) && (this->unk_149 != 0)) {
Boss07_Wrath_UpdateWhips(this, globalCtx, &this->rightWhip.basePos, this->rightWhip.pos, this->rightWhip.rot,
- this->rightWhip.pull, this->rightWhip.gravity, this->rightWhip.stiffness, this->rightWhip.drag,
- this->rightWhip.tension, &this->rightWhip.baseRot, this->unk_F7E, this->whipScale, 0);
+ this->rightWhip.pull, this->rightWhip.gravity, this->rightWhip.stiffness,
+ this->rightWhip.drag, this->rightWhip.tension, &this->rightWhip.baseRot, this->unk_F7E,
+ this->whipScale, 0);
Boss07_Wrath_UpdateWhips(this, globalCtx, &this->leftWhip.basePos, this->leftWhip.pos, this->leftWhip.rot,
- this->leftWhip.pull, this->leftWhip.gravity, this->leftWhip.stiffness, this->leftWhip.drag,
- this->leftWhip.tension, &this->leftWhip.baseRot, 0, this->whipScale, 1);
+ this->leftWhip.pull, this->leftWhip.gravity, this->leftWhip.stiffness,
+ this->leftWhip.drag, this->leftWhip.tension, &this->leftWhip.baseRot, 0,
+ this->whipScale, 1);
}
Boss07_Wrath_DrawWhips(this, globalCtx, this->rightWhip.pos, this->rightWhip.rot, this->whipScale, 0);
Boss07_Wrath_DrawWhips(this, globalCtx, this->leftWhip.pos, this->leftWhip.rot, this->whipScale, 1);
@@ -3229,7 +3239,7 @@ void Boss07_Wrath_MakeShadowCircles(Boss07* this, u8* shadowTex, f32 weight) {
sp74.y = this->bodyPartsPos[i].y - this->actor.world.pos.y + 76.0f + 30.0f + 30.0f + 100.0f;
sp74.z = this->bodyPartsPos[i].z - this->actor.world.pos.z;
}
- SysMatrix_MultiplyVector3fByState(&sp74, &sp68);
+ Matrix_MultiplyVector3fByState(&sp74, &sp68);
sp68.x *= 0.2f;
sp68.y *= 0.2f;
@@ -3284,7 +3294,7 @@ void Boss07_Wrath_MakeShadowTex(u8* shadowTex, Boss07* this, GlobalContext* glob
for (i = 0; i < 0x400; i++, shadowTex32++) {
*shadowTex32 = 0;
}
- SysMatrix_SetStateXRotation(1.0f);
+ Matrix_SetStateXRotation(1.0f);
for (i = 0; i < 6; i++) {
Boss07_Wrath_MakeShadowCircles(this, shadowTex, i / 5.0f);
}
@@ -3303,7 +3313,7 @@ void Boss07_Wrath_DrawShadowTex(u8* arg0, Boss07* this, GlobalContext* globalCtx
phi_f0 = CLAMP_MAX(phi_f0, 1.0f);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(s32)(phi_f0 * 80.0f) & 0xFF);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, 0);
Matrix_Scale(1.75f, 1.0f, 1.75f, 1);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_OPA_DISP++, D_0602EF68);
@@ -3317,7 +3327,7 @@ void func_809FCBC8(Boss07* this) {
s32 phi_v0 = (Rand_ZeroOne() < 0.5f) ? 0x4000 : -0x4000;
Matrix_RotateY(this->actor.yawTowardsPlayer + phi_v0, MTXMODE_NEW);
- SysMatrix_GetStateTranslationAndScaledZ(200.0f, &this->unk_164);
+ Matrix_GetStateTranslationAndScaledZ(200.0f, &this->unk_164);
this->timers[1] = 30;
this->unk_164.x += this->actor.world.pos.x;
this->unk_164.z += this->actor.world.pos.z;
@@ -3326,21 +3336,21 @@ void func_809FCBC8(Boss07* this) {
void func_809FCC70(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FCCCC;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002D84, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06002D84, 0.0f);
this->actor.flags &= ~1;
this->unk_17D8 = 0x6E00;
}
-#ifndef NON_MATCHING
+#ifdef NON_MATCHING
// float literals for 1.0f
void func_809FCCCC(Boss07* this, GlobalContext* globalCtx) {
s32 i;
f32 sp58;
Camera* sp54;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_ABC8++;
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
sp58 = Math_SinS(this->unk_14C * 0x4500) * 0.3f;
switch (this->csState) {
@@ -3426,8 +3436,8 @@ void func_809FCCCC(Boss07* this, GlobalContext* globalCtx) {
break;
case 5:
if (this->unk_ABC8 == 20) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002C40, 0.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06002C40);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06002C40, 0.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06002C40);
}
if (this->unk_ABC8 >= 20) {
sREG(28) = this->unk_ABC8;
@@ -3456,7 +3466,7 @@ void func_809FCCCC(Boss07* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->csCamNextEye.z, 220.0f, 0.05f, this->csCamSpeedMod * 180.0f);
Math_ApproachF(&this->csCamNextAt.y, 110.0f, 0.05f, this->csCamSpeedMod * 80.0f);
Math_ApproachF(&this->csCamSpeedMod, 0.1f, 1.0f, 0.005f);
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
sp54 = Play_GetCamera(globalCtx, 0);
this->csState = 0;
@@ -3472,11 +3482,11 @@ void func_809FCCCC(Boss07* this, GlobalContext* globalCtx) {
}
break;
}
- for (i = 0; i < ArRAY_COUNT(this->unk_17C8); i++) {
+ for (i = 0; i < ARRAY_COUNT(this->unk_17C8); i++) {
Math_ApproachZeroF(&this->unk_17C8[i], 0.5f, 0.1f);
}
- SysMatrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
+ Matrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
+ Matrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
if (this->csCamIndex != 0) {
ShrinkWindow_SetLetterboxTarget(0x1B);
Play_CameraSetAtEye(globalCtx, this->csCamIndex, &this->csCamAt, &this->csCamEye);
@@ -3487,24 +3497,24 @@ void func_809FCCCC(Boss07* this, GlobalContext* globalCtx) {
#endif
void func_809FD5F8(Boss07* this, GlobalContext* globalCtx) {
- static AnimationHeader* sDanceAnims[3] = { &D_0600A6AC, &D_0600AB04, &D_0600AD84};
+ static AnimationHeader* sDanceAnims[3] = { &D_0600A6AC, &D_0600AB04, &D_0600AD84 };
this->actionFunc = func_809FD710;
this->unk_14E = Rand_ZeroFloat(2.999f);
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, sDanceAnims[this->unk_14E], -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, sDanceAnims[this->unk_14E], -10.0f);
this->actor.flags |= 1;
this->timers[0] = Rand_ZeroFloat(50.0f) + 50.0f;
}
void func_809FD710(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->unk_14E < 2) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_WAIT_OLD - SFX_FLAG);
- } else if ((this->unk_14E == 2) && func_801378B8(&this->skelAnime, 5.0f)) {
+ } else if ((this->unk_14E == 2) && Animation_OnFrame(&this->skelAnime, 5.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_JUMP_OLD);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x2000);
if ((this->timers[0] == 0) || (player->unk_D57 == 4) || (this->actor.xzDistToPlayer <= 300.0f)) {
@@ -3517,8 +3527,8 @@ void func_809FD710(Boss07* this, GlobalContext* globalCtx) {
void func_809FD818(Boss07* this, GlobalContext* globalCtx, s16 arg2) {
if (this->actionFunc != func_809FD89C) {
this->actionFunc = func_809FD89C;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009C7C, -10.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06009C7C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009C7C, -10.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06009C7C);
}
this->unk_158 = 10;
this->timers[0] = arg2;
@@ -3527,13 +3537,13 @@ void func_809FD818(Boss07* this, GlobalContext* globalCtx, s16 arg2) {
void func_809FD89C(Boss07* this, GlobalContext* globalCtx) {
this->actor.shape.shadowAlpha = 0;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 1.0f);
if (this->timers[1] == 1) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_HIPLOOP_LAND);
}
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009EA8, -5.0f);
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
+ Animation_MorphToLoop(&this->skelAnime, &D_06009EA8, -5.0f);
this->unk_1D4 = 1000.0f;
}
if (this->unk_1D4 == 1000.0f) {
@@ -3548,14 +3558,14 @@ void func_809FD89C(Boss07* this, GlobalContext* globalCtx) {
void func_809FD984(Boss07* this, GlobalContext* globalCtx, u8 arg2, u8 arg3) {
if (this->actionFunc != func_809FDAB0) {
this->actionFunc = func_809FDAB0;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000D0C, -2.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06000D0C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000D0C, -2.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06000D0C);
} else if (arg3 == 14) {
- if (this->skelAnime.animCurrentFrame <= (this->unk_1D4 - 5.0f)) {
+ if (this->skelAnime.curFrame <= (this->unk_1D4 - 5.0f)) {
this->unk_158 = 30;
this->unk_15C = 30;
} else {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, (AnimationHeader*)&D_06000D0C, -2.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, (AnimationHeader*)&D_06000D0C, -2.0f);
}
}
@@ -3575,16 +3585,16 @@ void func_809FD984(Boss07* this, GlobalContext* globalCtx, u8 arg2, u8 arg3) {
void func_809FDAB0(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_BIRD2_OLD - SFX_FLAG);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 2.0f);
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
func_809FDB2C(this, globalCtx);
}
func_809F4D54(this, globalCtx, 1, false);
}
void func_809FDB2C(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A400, -2.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600A400, -2.0f);
this->actionFunc = func_809FDBA0;
this->timers[0] = Rand_ZeroFloat(100.0f) + 150.0f;
func_809FCBC8(this);
@@ -3601,7 +3611,7 @@ void func_809FDBA0(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_WALK2_OLD);
this->unk_AB40 = 0;
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if ((func_800B64FC(globalCtx, 5.0f, &this->actor.world.pos, &sp2C) >= 0.0f) && (sp2C == 0)) {
func_809FD818(this, globalCtx, 50);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_DAMAGE_OLD);
@@ -3647,20 +3657,20 @@ void func_809FDBA0(Boss07* this, GlobalContext* globalCtx) {
void func_809FDEDC(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FDF54;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000428, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000428, -5.0f);
this->timers[0] = Rand_ZeroFloat(50.0f) + 30.0f;
this->unk_188C = 0.0f;
}
void func_809FDF54(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 3.0f);
Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 3, 0x3000);
- if (func_801378B8(&this->skelAnime, 4.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_07, this->unk_17A0.x, this->unk_17A0.y,
this->unk_17A0.z, 0, 0, 0, MAJORA_INCARNATION_SHOT);
}
- if (func_801378B8(&this->skelAnime, 9.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_07, this->unk_17AC.x, this->unk_17AC.y,
this->unk_17AC.z, 0, 0, 0, MAJORA_INCARNATION_SHOT);
}
@@ -3672,15 +3682,15 @@ void func_809FDF54(Boss07* this, GlobalContext* globalCtx) {
void func_809FE068(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FE0E4;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06003A64, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06003A64, -5.0f);
this->timers[0] = Rand_ZeroFloat(100.0f) + 100.0f;
this->timers[1] = 0;
this->unk_ABC8 = 0;
}
void func_809FE0E4(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 5.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 5.0f)) {
if ((this->unk_ABC8 % 2) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO1_OLD);
} else {
@@ -3715,14 +3725,14 @@ void func_809FE0E4(Boss07* this, GlobalContext* globalCtx) {
void func_809FE2D4(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FE348;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A194, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600A194, -10.0f);
this->timers[0] = Rand_ZeroFloat(50.0f) + 70.0f;
this->timers[1] = 0;
}
void func_809FE348(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_MOONWALK_OLD - SFX_FLAG);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ApproachF(&this->actor.speedXZ, KREG(69) + -10.0f, 1.0f, 3.0f);
if (this->timers[1] == 0) {
if ((this->unk_14C == 0) && (Rand_ZeroOne() < 0.5f)) {
@@ -3746,14 +3756,14 @@ void func_809FE348(Boss07* this, GlobalContext* globalCtx) {
void func_809FE4B0(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FE524;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000194, -10.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000194, -10.0f);
this->timers[0] = Rand_ZeroFloat(70.0f) + 70.0f;
this->timers[1] = 0;
}
void func_809FE524(Boss07* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST2_BALLET_OLD - SFX_FLAG);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ApproachF(&this->actor.speedXZ, KREG(69) + 10.0f, 1.0f, 1.0f);
if (this->timers[1] == 0) {
if (((this->unk_14C % 0x40) == 0) && (Rand_ZeroOne() < 0.5f)) {
@@ -3781,8 +3791,8 @@ void func_809FE524(Boss07* this, GlobalContext* globalCtx) {
void func_809FE6B0(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = func_809FE734;
func_809F4FAC(globalCtx);
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000D0C, -2.0f);
- this->unk_1D4 = SkelAnime_GetFrameCount(&D_06000D0C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000D0C, -2.0f);
+ this->unk_1D4 = Animation_GetLastFrame(&D_06000D0C);
this->csState = 0;
this->unk_ABC8 = 0;
this->actor.flags &= ~1;
@@ -3790,12 +3800,12 @@ void func_809FE6B0(Boss07* this, GlobalContext* globalCtx) {
}
void func_809FE734(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 sp4B = 0;
this->unk_15C = 20;
this->unk_ABC8++;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 3.0f);
switch (this->csState) {
case 0:
@@ -3820,10 +3830,10 @@ void func_809FE734(Boss07* this, GlobalContext* globalCtx) {
this->csCamNextAt.z = 0.0f;
Math_ApproachF(&this->actor.world.pos.x, 0.0f, 0.1f, 5.0f);
Math_ApproachF(&this->actor.world.pos.z, 0.0f, 0.1f, 5.0f);
- if (func_801378B8(&this->skelAnime, this->unk_1D4)) {
+ if (Animation_OnFrame(&this->skelAnime, this->unk_1D4)) {
this->unk_ABC8 = 0;
this->csState = 1;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06003854, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06003854, -5.0f);
}
break;
case 1:
@@ -3840,7 +3850,7 @@ void func_809FE734(Boss07* this, GlobalContext* globalCtx) {
this->csCamNextAt.z = -20.0f;
this->unk_17E8 = 1.0f;
this->unk_17EC = 0.4f;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060031E4, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_060031E4, -5.0f);
this->actor.shape.rot.y = 0;
this->actor.world.rot.y = this->actor.shape.rot.y;
Math_ApproachF(&this->actor.world.pos.x, 0.0f, 1.0f, 200.0f);
@@ -3898,10 +3908,10 @@ void func_809FE734(Boss07* this, GlobalContext* globalCtx) {
}
break;
}
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
+ Matrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
+ Matrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
if (sp4B == 1) {
this->unk_17E0 = (Math_SinS(this->unk_ABC8 * 0x3000) * this->unk_17EC) + this->unk_17E8;
Math_ApproachF(&this->unk_17E8, 2.0f, 1.0f, 0.05f);
@@ -3987,7 +3997,6 @@ void Boss07_Incarnation_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Boss07* this = THIS;
s32 i;
-
this->actor.hintId = 51;
this->unk_14C++;
@@ -4043,10 +4052,10 @@ void Boss07_Incarnation_Update(Actor* thisx, GlobalContext* globalCtx2) {
Boss07* afterimage = (Boss07*)Actor_SpawnAsChild(
&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_07, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, 7, 21);
-
+
if (afterimage != NULL) {
for (i = 0; i < MAJORA_INCARNATION_LIMB_COUNT; i++) {
- afterimage->skelAnime.limbDrawTbl[i] = this->skelAnime.limbDrawTbl[i];
+ afterimage->skelAnime.jointTable[i] = this->skelAnime.jointTable[i];
}
}
}
@@ -4061,8 +4070,8 @@ void Boss07_Afterimage_Draw(Actor* thisx, GlobalContext* globalCtx2) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 0, 0, 100, 155, 900, 1099);
- SkelAnime_DrawSV(globalCtx, sp34->skelAnime.skeleton, this->skelAnime.limbDrawTbl, sp34->skelAnime.dListCount,
- NULL, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, sp34->skelAnime.skeleton, this->skelAnime.jointTable, sp34->skelAnime.dListCount,
+ NULL, NULL, &this->actor);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -4099,32 +4108,32 @@ void func_809FF6B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
s8 i;
if (limbIndex == 0x18) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
i = sIncarnationBodyParts[limbIndex];
if (i >= 0) {
- SysMatrix_GetStateTranslation(&this->bodyPartsPos[i]);
+ Matrix_GetStateTranslation(&this->bodyPartsPos[i]);
}
i = sIncarnationColliders[limbIndex];
if (i >= 0) {
if (this->unk_158 != 0) {
- SysMatrix_GetStateTranslationAndScaledZ(100000.0f, &sp28);
+ Matrix_GetStateTranslationAndScaledZ(100000.0f, &sp28);
} else {
- SysMatrix_MultiplyVector3fByState(&sIncarnationColliderOffsets[i], &sp28);
+ Matrix_MultiplyVector3fByState(&sIncarnationColliderOffsets[i], &sp28);
}
Boss07_UpdateSpheres(i, &this->sph1, &sp28);
}
if (limbIndex == 8) {
- SysMatrix_GetStateTranslation(&this->unk_1788[0]);
+ Matrix_GetStateTranslation(&this->unk_1788[0]);
}
if (limbIndex == 0x17) {
- SysMatrix_GetStateTranslation(&this->unk_1788[1]);
+ Matrix_GetStateTranslation(&this->unk_1788[1]);
}
if (limbIndex == 0xD) {
- SysMatrix_GetStateTranslation(&this->unk_17AC);
+ Matrix_GetStateTranslation(&this->unk_17AC);
}
if (limbIndex == 0x12) {
- SysMatrix_GetStateTranslation(&this->unk_17A0);
+ Matrix_GetStateTranslation(&this->unk_17A0);
}
i = D_80A081C8[limbIndex];
if (i >= 0) {
@@ -4158,7 +4167,7 @@ void Boss07_Incarnation_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if ((this->unk_15E % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
}
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_809FF678, func_809FF6B0, func_809FF810, &this->actor);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
func_800BE680(globalCtx, &this->actor, this->bodyPartsPos, 0xF, this->unk_17F8, this->unk_17FC, this->unk_1800,
@@ -4168,7 +4177,7 @@ void Boss07_Incarnation_Draw(Actor* thisx, GlobalContext* globalCtx2) {
void Boss07_SetupIdle(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = Boss07_Idle;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06019E48, -20.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06019E48, -20.0f);
this->timers[2] = Rand_ZeroFloat(150.0f) + 60.0f;
this->unk_1870 = 1.0f;
}
@@ -4180,9 +4189,9 @@ void Boss07_Idle(Boss07* this, GlobalContext* globalCtx) {
f32 sp2C;
f32 sp28;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG);
if (this->timers[0] == 0) {
if (this->timers[2] == 0) {
@@ -4248,7 +4257,7 @@ void Boss07_Mask_Spin(Boss07* this, GlobalContext* globalCtx) {
f32 sp2C;
f32 sp28;
f32 sp24;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actor.shape.rot.z -= this->unk_18D4;
switch (this->unk_14E) {
@@ -4318,13 +4327,13 @@ void Boss07_Mask_Spin(Boss07* this, GlobalContext* globalCtx) {
void Boss07_Mask_SetupStunned(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = Boss07_Mask_Stunned;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600AE40, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600AE40, -10.0f);
this->timers[0] = 100;
this->unk_170 = 0.0f;
}
void Boss07_Mask_Stunned(Boss07* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_8019F1C0(&sSfxPoint, NA_SE_EN_COMMON_WEAKENED - SFX_FLAG);
func_809F4CBC(this, 0.5f);
Math_ApproachS(&this->actor.shape.rot.x, -0x1000 + 0x4B0 * Math_SinS(this->unk_14C * 0xBB8), 5, 0x800);
@@ -4345,7 +4354,7 @@ void Boss07_Mask_Stunned(Boss07* this, GlobalContext* globalCtx) {
}
void Boss07_Mask_SetupDamaged(Boss07* this, GlobalContext* globalCtx, u8 arg2, Actor* arg3) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actionFunc = Boss07_Mask_Damaged;
this->timers[0] = 40;
@@ -4375,7 +4384,7 @@ void Boss07_Mask_SetupDamaged(Boss07* this, GlobalContext* globalCtx, u8 arg2, A
void Boss07_Mask_Damaged(Boss07* this, GlobalContext* globalCtx) {
this->unk_15C = 20;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 1) {
func_809F4CBC(this, 1.0f);
Math_ApproachS(&this->actor.shape.rot.x, -0x4000, 1, 0x1000);
@@ -4435,7 +4444,7 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
s16 sp178;
Vec3f sp16C;
Vec3f sp160;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
CollisionPoly* sp158;
Vec3f sp14C;
u8 sp14B = 0;
@@ -4518,9 +4527,9 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
sp16C.x = player->actor.world.pos.x - this->unk_189C.x;
sp16C.y = player->actor.world.pos.y - this->unk_189C.y + 10.0f;
sp16C.z = player->actor.world.pos.z - this->unk_189C.z;
- SysMatrix_InsertXRotation_s(-this->actor.shape.rot.x, 0);
+ Matrix_InsertXRotation_s(-this->actor.shape.rot.x, 0);
Matrix_RotateY(-this->actor.shape.rot.y, 1);
- SysMatrix_MultiplyVector3fByState(&sp16C, &sp160);
+ Matrix_MultiplyVector3fByState(&sp16C, &sp160);
if ((fabsf(sp160.x) < 20.0f) && (fabsf(sp160.y) < 50.0f) && (sp160.z > 40.0f) &&
(sp160.z <= (this->unk_1894 * 20))) {
if (func_8012405C(globalCtx) && (player->transformation == 4) && (player->stateFlags1 & 0x400000) &&
@@ -4549,10 +4558,10 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
sp16C.y = this->actor.world.pos.y - this->unk_18A8.y;
sp16C.z = this->actor.world.pos.z - this->unk_18A8.z;
sp180 = sqrtf(SQXYZ(sp16C));
- SysMatrix_InsertXRotation_s(-this->unk_18C4, 0);
+ Matrix_InsertXRotation_s(-this->unk_18C4, 0);
Matrix_RotateY(-this->unk_18C6, 1);
- SysMatrix_StatePush();
- SysMatrix_MultiplyVector3fByState(&sp16C, &sp160);
+ Matrix_StatePush();
+ Matrix_MultiplyVector3fByState(&sp16C, &sp160);
if ((fabsf(sp160.x) < 60.0f) && (fabsf(sp160.y) < 60.0f) && (sp160.z > 40.0f) &&
(sp160.z <= (this->unk_18C0 * 16.666668f)) && (this->unk_14E != 5)) {
s32 phi_s0_2;
@@ -4600,7 +4609,7 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
}
}
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
for (sp178 = 0; sp178 < ARRAY_COUNT(sBossRemains); sp178++) {
if (sBossRemains[sp178]->unk_14E >= 2) {
continue;
@@ -4609,7 +4618,7 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
sp16C.y = sBossRemains[sp178]->actor.world.pos.y - this->unk_18A8.y;
sp16C.z = sBossRemains[sp178]->actor.world.pos.z - this->unk_18A8.z;
sp180 = sqrtf(SQXYZ(sp16C));
- SysMatrix_MultiplyVector3fByState(&sp16C, &sp160);
+ Matrix_MultiplyVector3fByState(&sp16C, &sp160);
if ((fabsf(sp160.x) < 60.0f) && (fabsf(sp160.y) < 60.0f) && (sp160.z > 40.0f) &&
(sp160.z <= (this->unk_18C0 * 16.666668f)) && (this->unk_14E != 5)) {
s32 pad;
@@ -4620,12 +4629,9 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
this->unk_18D8 += 2;
this->unk_18C0 = sp180 * 0.062f;
if (this->unk_18D8 < 5) {
- spE0.x =
- sBossRemains[sp178]->actor.world.pos.x + randPlusMinusPoint5Scaled(40.0f);
- spE0.y =
- sBossRemains[sp178]->actor.world.pos.y + randPlusMinusPoint5Scaled(40.0f);
- spE0.z =
- sBossRemains[sp178]->actor.world.pos.z + randPlusMinusPoint5Scaled(40.0f);
+ spE0.x = sBossRemains[sp178]->actor.world.pos.x + randPlusMinusPoint5Scaled(40.0f);
+ spE0.y = sBossRemains[sp178]->actor.world.pos.y + randPlusMinusPoint5Scaled(40.0f);
+ spE0.z = sBossRemains[sp178]->actor.world.pos.z + randPlusMinusPoint5Scaled(40.0f);
spD4.x = 0.0f;
spD4.y = 6.0f;
spD4.z = 0.0f;
@@ -4653,11 +4659,10 @@ void Boss07_Mask_Beam(Boss07* this, GlobalContext* globalCtx) {
spC8.y = spD4.y * -0.05f;
spC8.z = spD4.z * -0.05f;
Boss07_SpawnEffect(globalCtx, &spE0, &spD4, &spC8,
- Rand_ZeroFloat(10.0f) + 25.0f);
+ Rand_ZeroFloat(10.0f) + 25.0f);
}
}
}
-
}
if (func_800C55C4(&globalCtx->colCtx, &this->unk_18A8, &this->unk_18B4, &sp14C, &sp158, 1, 1, 1,
1, &sp144) &&
@@ -4727,21 +4732,22 @@ void Boss07_Mask_SetupIntro(Boss07* this, GlobalContext* globalCtx) {
func_8016566C(this->unk_160);
}
+static Vec3s sCameraEyes[4] = {
+ { 616, 402, -46 },
+ { -622, 380, -86 },
+ { 400, 300, 463 },
+ { -400, 470, 496 },
+};
+static Vec3s sCameraAts[4] = {
+ { 646, 394, -150 },
+ { -648, 380, -190 },
+ { 502, 321, 438 },
+ { -500, 445, 468 },
+};
+
void Boss07_Mask_Intro(Boss07* this, GlobalContext* globalCtx) {
- static Vec3s sCameraEyes[4] = {
- { 616, 402, -46 },
- { -622, 380, -86 },
- { 400, 300, 463 },
- { -400, 470, 496 },
- };
- static Vec3s sCameraAts[4] = {
- { 646, 394, -150 },
- { -648, 380, -190 },
- { 502, 321, 438 },
- { -500, 445, 468 },
- };
f32 sp8C = 0.0f;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->unk_ABC8++;
SREG(90) = this->unk_160;
@@ -4905,7 +4911,7 @@ void Boss07_Mask_Intro(Boss07* this, GlobalContext* globalCtx) {
if (this->unk_ABC8 == 10) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG);
Math_ApproachF(&this->unk_1870, 1.0f, 1.0f, 0.02f);
Math_ApproachF(&this->actor.world.pos.z, -642.5f, 0.05f, 30.0f);
@@ -4918,9 +4924,12 @@ void Boss07_Mask_Intro(Boss07* this, GlobalContext* globalCtx) {
Audio_QueueSeqCmd(0x806B);
}
if (this->unk_ABC8 > 100) {
- Math_ApproachF(&this->csCamEye.x, player->actor.world.pos.x + 40.0f, 0.1f, this->csCamSpeedMod * 20.0f);
- Math_ApproachF(&this->csCamEye.y, player->actor.world.pos.y + 10.0f, 0.1f, this->csCamSpeedMod * 20.0f);
- Math_ApproachF(&this->csCamEye.z, player->actor.world.pos.z + 90.0f, 0.1f, this->csCamSpeedMod * 60.0f);
+ Math_ApproachF(&this->csCamEye.x, player->actor.world.pos.x + 40.0f, 0.1f,
+ this->csCamSpeedMod * 20.0f);
+ Math_ApproachF(&this->csCamEye.y, player->actor.world.pos.y + 10.0f, 0.1f,
+ this->csCamSpeedMod * 20.0f);
+ Math_ApproachF(&this->csCamEye.z, player->actor.world.pos.z + 90.0f, 0.1f,
+ this->csCamSpeedMod * 60.0f);
Math_ApproachF(&this->csCamSpeedMod, 1.0f, 1.0f, 0.03f);
}
if (this->unk_ABC8 == 175) {
@@ -4969,7 +4978,7 @@ void Boss07_Mask_Intro(Boss07* this, GlobalContext* globalCtx) {
void Boss07_Mask_SetupDeath(Boss07* this, GlobalContext* globalCtx) {
this->actionFunc = Boss07_Mask_Death;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600AE40, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600AE40, -10.0f);
this->actor.world.rot.y = this->actor.shape.rot.y =
Math_Acot2F(-this->actor.world.pos.z, -this->actor.world.pos.x) * (0x8000 / M_PI);
this->csState = 0;
@@ -4979,19 +4988,19 @@ void Boss07_Mask_SetupDeath(Boss07* this, GlobalContext* globalCtx) {
}
void Boss07_Mask_Death(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp60;
Vec3f sp54;
this->unk_ABC8++;
this->unk_15C = 20;
this->unk_1884 = 1;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_809F4CBC(this, 0.5f);
Math_ApproachF(&this->actor.world.pos.x, 0.0f, 0.05f, 5.0f);
Math_ApproachF(&this->actor.world.pos.z, 0.0f, 0.05f, 5.0f);
Math_ApproachF(&this->actor.world.pos.y, 130.0f, 0.05f, 3.0f);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
switch (this->csState) {
case 0:
@@ -5011,8 +5020,8 @@ void Boss07_Mask_Death(Boss07* this, GlobalContext* globalCtx) {
this->csCamNextEye.z = 270.0f;
this->csCamNextAt.x = 0.0f;
this->csCamNextAt.y = -30.0f;
- SysMatrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
+ Matrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
+ Matrix_MultiplyVector3fByState(&this->csCamNextAt, &this->csCamAt);
} else {
break;
}
@@ -5043,8 +5052,8 @@ void Boss07_Mask_Death(Boss07* this, GlobalContext* globalCtx) {
break;
}
- SysMatrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
- SysMatrix_MultiplyVector3fByState(&this->csCamNextAt, &sp60);
+ Matrix_MultiplyVector3fByState(&this->csCamNextEye, &this->csCamEye);
+ Matrix_MultiplyVector3fByState(&this->csCamNextAt, &sp60);
Math_ApproachF(&this->csCamAt.x, sp60.x, 0.1f, 10.0f);
Math_ApproachF(&this->csCamAt.y, sp60.y, 0.1f, 10.0f);
Math_ApproachF(&this->csCamAt.z, sp60.z, 0.1f, 10.0f);
@@ -5059,7 +5068,7 @@ void Boss07_Mask_Death(Boss07* this, GlobalContext* globalCtx) {
}
void Boss07_Mask_CollisionCheck(Boss07* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
ColliderInfo* hitbox;
u8 sp27;
Actor* hit;
@@ -5095,7 +5104,7 @@ void Boss07_Mask_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Boss07* this = THIS;
s32 i;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp9C;
Vec3f sp90;
Vec3f sp84;
@@ -5158,40 +5167,40 @@ void Boss07_Mask_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.colChkInfo.health = 0;
}
Boss07_Mask_CollisionCheck(this, globalCtx);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
- MTXMODE_NEW);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
+ MTXMODE_NEW);
Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->actor.shape.rot.x, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->actor.shape.rot.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z, MTXMODE_APPLY);
sp6C.x = -55.0f;
sp6C.y = 55.0f;
sp6C.z = 10.0f;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp9C);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp9C);
sp6C.x = -55.0f;
sp6C.y = -55.0f;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp90);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp90);
sp6C.x = 55.0f;
sp6C.y = 55.0f;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp84);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp84);
sp6C.x = 55.0f;
sp6C.y = -55.0f;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp78);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp78);
Collider_SetQuadVertices(&this->quad1, &sp9C, &sp90, &sp84, &sp78);
sp68 = (player->stateFlags3 & 0x200) ? 70.0f : 40.0f;
sp6C.x = -sp68;
sp6C.y = sp68;
sp6C.z = -10.0f;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp9C);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp9C);
sp6C.x = -sp68;
sp6C.y = -sp68;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp90);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp90);
sp6C.x = sp68;
sp6C.y = sp68;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp84);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp84);
sp6C.x = sp68;
sp6C.y = -sp68;
- SysMatrix_MultiplyVector3fByState(&sp6C, &sp78);
+ Matrix_MultiplyVector3fByState(&sp6C, &sp78);
Collider_SetQuadVertices(&this->quad2, &sp9C, &sp90, &sp84, &sp78);
if (player->stateFlags3 & 0x200) {
@@ -5227,8 +5236,8 @@ void Boss07_Mask_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
}
-void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot, Vec3f* pull,
- Vec3f* arg6, f32 arg7, u8 arg8, f32 arg9) {
+void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* base, Vec3f* pos, Vec3f* rot,
+ Vec3f* pull, Vec3f* arg6, f32 arg7, u8 arg8, f32 arg9) {
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
@@ -5245,16 +5254,16 @@ void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f*
if (this->unk_1874 != 0) {
for (i = 0; i < MAJORA_TENT_LENGTH; i++) {
- SysMatrix_StatePush();
- SysMatrix_InsertZRotation_f(arg9, 1);
+ Matrix_StatePush();
+ Matrix_InsertZRotation_f(arg9, 1);
sp98.x = Math_SinS((2 * i + this->unk_14C) * 0x1600) * 10;
sp98.y = 10.0f;
sp98.z = 0.0f;
- SysMatrix_MultiplyVector3fByState(&sp98, &sp8C);
+ Matrix_MultiplyVector3fByState(&sp98, &sp8C);
pos[i].x += sp8C.x;
pos[i].y += sp8C.y;
pos[i].z += sp8C.z;
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
}
for (i = 0; i < MAJORA_TENT_LENGTH; i++, pull++) {
@@ -5299,9 +5308,9 @@ void Boss07_Mask_UpdateTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f*
temp1 = -Math_Acot2F(temp2, temp_f22);
(rot - 1)->y = temp_f26;
(rot - 1)->x = temp1;
- SysMatrix_InsertYRotation_f(temp_f26, 0);
- SysMatrix_RotateStateAroundXAxis(temp1);
- SysMatrix_GetStateTranslationAndScaledZ(sp98.z, &sp8C);
+ Matrix_InsertYRotation_f(temp_f26, 0);
+ Matrix_RotateStateAroundXAxis(temp1);
+ Matrix_GetStateTranslationAndScaledZ(sp98.z, &sp8C);
temp_f24 = pos->x;
temp_f22 = pos->y;
temp_f20 = pos->z;
@@ -5320,10 +5329,10 @@ void Boss07_Mask_DrawTentacles(Boss07* this, GlobalContext* globalCtx, Vec3f* ar
OPEN_DISPS(globalCtx->state.gfxCtx);
for (i = 0; i < MAJORA_TENT_LENGTH - 1; i++, arg2++, arg3++) {
- SysMatrix_InsertTranslation(arg2->x, arg2->y, arg2->z, 0);
- SysMatrix_InsertYRotation_f(arg3->y, 1);
- SysMatrix_RotateStateAroundXAxis(arg3->x);
- SysMatrix_InsertZRotation_f(arg5, 1);
+ Matrix_InsertTranslation(arg2->x, arg2->y, arg2->z, 0);
+ Matrix_InsertYRotation_f(arg3->y, 1);
+ Matrix_RotateStateAroundXAxis(arg3->x);
+ Matrix_InsertZRotation_f(arg5, 1);
if (i <= (MAJORA_TENT_LENGTH - 1) / 2) {
phi_f12 = 0.035f;
} else {
@@ -5346,66 +5355,66 @@ void Boss07_Mask_DrawBeam(Boss07* this, GlobalContext* globalCtx) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 60, 200);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
- SysMatrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
+ Matrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);
- SysMatrix_StatePush();
- SysMatrix_StatePush();
- SysMatrix_StatePush();
+ Matrix_StatePush();
+ Matrix_StatePush();
+ Matrix_StatePush();
- SysMatrix_InsertTranslation(250.0f, 0.0f, 200.0f, 1);
+ Matrix_InsertTranslation(250.0f, 0.0f, 200.0f, 1);
Matrix_RotateY(-0xA00, 1);
Matrix_Scale(this->unk_1898 * 0.05f, this->unk_1898 * 0.05f, this->unk_188C * 0.05f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_0600C7D8);
- SysMatrix_StatePop();
+ Matrix_StatePop();
- SysMatrix_InsertTranslation(-250.0f, 0.0f, 200.0f, 1);
+ Matrix_InsertTranslation(-250.0f, 0.0f, 200.0f, 1);
Matrix_RotateY(0xA00, 1);
Matrix_Scale(this->unk_1898 * 0.05f, this->unk_1898 * 0.05f, this->unk_188C * 0.05f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_0600C7D8);
gSPDisplayList(POLY_XLU_DISP++, D_04023348);
- SysMatrix_StatePop();
+ Matrix_StatePop();
- SysMatrix_InsertTranslation(0.0f, 0.0f, 1200.0f, 1);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(0.0f, 0.0f, 1200.0f, 1);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(this->unk_1890 * 40.0f * this->unk_1898, this->unk_1890 * 40.0f * this->unk_1898, 0.0f, 1);
- SysMatrix_InsertZRotation_s(this->unk_14C * 0x100, 1);
+ Matrix_InsertZRotation_s(this->unk_14C * 0x100, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 60, sREG(89) + 80);
Matrix_Scale(6.0f, 6.0f, 0.0f, 1);
- SysMatrix_InsertZRotation_s(0x4000, 1);
+ Matrix_InsertZRotation_s(0x4000, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 60, 200);
- SysMatrix_StatePop();
+ Matrix_StatePop();
- SysMatrix_InsertTranslation(0.0f, 0.0f, 1150.0f, 1);
- SysMatrix_GetStateTranslation(&this->unk_189C);
+ Matrix_InsertTranslation(0.0f, 0.0f, 1150.0f, 1);
+ Matrix_GetStateTranslation(&this->unk_189C);
Matrix_Scale(this->unk_1898 * 0.05f, this->unk_1898 * 0.05f, (this->unk_1894 * 0.01f) - 0.01f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_0600C7D8);
- SysMatrix_GetStateTranslationAndScaledZ(20100.0f, &this->unk_18A8);
+ Matrix_GetStateTranslationAndScaledZ(20100.0f, &this->unk_18A8);
if (this->unk_18C0 > 0.0f) {
Vec3f sp50;
- SysMatrix_GetStateTranslationAndScaledZ(20000.0f, &sp50);
- SysMatrix_InsertTranslation(this->unk_18A8.x, this->unk_18A8.y, this->unk_18A8.z, 0);
+ Matrix_GetStateTranslationAndScaledZ(20000.0f, &sp50);
+ Matrix_InsertTranslation(this->unk_18A8.x, this->unk_18A8.y, this->unk_18A8.z, 0);
Matrix_RotateY(this->unk_18C6, 1);
- SysMatrix_InsertXRotation_s(this->unk_18C4, 1);
+ Matrix_InsertXRotation_s(this->unk_18C4, 1);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);
Matrix_Scale(this->unk_1898 * 0.05f, this->unk_1898 * 0.05f, this->unk_18C0 * 0.01f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_0600C7D8);
- SysMatrix_GetStateTranslationAndScaledZ(20100.0f, &this->unk_18B4);
- SysMatrix_InsertTranslation(sp50.x, sp50.y, sp50.z, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_GetStateTranslationAndScaledZ(20100.0f, &this->unk_18B4);
+ Matrix_InsertTranslation(sp50.x, sp50.y, sp50.z, 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(this->unk_1898 * 5.0f, this->unk_1898 * 5.0f, 0.0f, 1);
- SysMatrix_InsertZRotation_s(this->unk_14C * 0x100, 1);
+ Matrix_InsertZRotation_s(this->unk_14C * 0x100, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023348);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
@@ -5418,7 +5427,7 @@ void Boss07_Mask_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
Boss07* this = THIS;
if (limbIndex == 2) {
- SysMatrix_GetStateTranslationAndScaledX(500.0f, &this->unk_1878);
+ Matrix_GetStateTranslationAndScaledX(500.0f, &this->unk_1878);
}
}
@@ -5442,14 +5451,14 @@ void Boss07_Mask_Draw(Actor* thisx, GlobalContext* globalCtx2) {
func_8012C2DC(globalCtx->state.gfxCtx);
temp_f20 = this->unk_186C * (M_PI / 4.0f) * 0.06666667f;
temp_f22 = Math_SinS(this->unk_186C * 0x3500) * temp_f20 * 0.5f;
- SysMatrix_InsertYRotation_f(Math_SinS(this->unk_186C * 0x4500) * temp_f20, 1);
- SysMatrix_RotateStateAroundXAxis(temp_f22);
+ Matrix_InsertYRotation_f(Math_SinS(this->unk_186C * 0x4500) * temp_f20, 1);
+ Matrix_RotateStateAroundXAxis(temp_f22);
if ((this->unk_15E % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099);
}
gSPSegment(POLY_OPA_DISP++, 8, Lib_SegmentedToVirtual(D_80A082E0[this->unk_1884]));
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, NULL, Boss07_Mask_PostLimbDraw,
- &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, Boss07_Mask_PostLimbDraw,
+ &this->actor);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
gSPDisplayList(POLY_OPA_DISP++, D_0600AFB0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 80, 255);
@@ -5460,33 +5469,33 @@ void Boss07_Mask_Draw(Actor* thisx, GlobalContext* globalCtx2) {
: 0;
Matrix_RotateY(this->actor.shape.rot.y, 0);
- SysMatrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
- SysMatrix_GetStateTranslationAndScaledZ(-3.0f, &sp90);
+ Matrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
+ Matrix_GetStateTranslationAndScaledZ(-3.0f, &sp90);
spA8.x = 0.0f;
spA8.y = 20.0f;
spA8.z = -2.0f;
phi_f24 = 0.0f;
for (i = 0; i < MAJORA_TENT_COUNT; i++) {
- SysMatrix_StatePush();
- SysMatrix_StatePush();
- SysMatrix_InsertZRotation_f(phi_f24, 1);
- SysMatrix_MultiplyVector3fByState(&spA8, &sp9C);
+ Matrix_StatePush();
+ Matrix_StatePush();
+ Matrix_InsertZRotation_f(phi_f24, 1);
+ Matrix_MultiplyVector3fByState(&spA8, &sp9C);
this->tentacles[i].base.x = this->unk_1878.x + sp9C.x;
this->tentacles[i].base.y = this->unk_1878.y + sp9C.y;
this->tentacles[i].base.z = this->unk_1878.z + sp9C.z;
pad2 = (1 - (i * 0.008f)) * this->unk_1870;
- SysMatrix_StatePop();
+ Matrix_StatePop();
if (this->unk_149 != 0) {
- Boss07_Mask_UpdateTentacles(this, globalCtx, &this->tentacles[i].base, this->tentacles[i].pos, this->tentacles[i].rot,
- this->tentacles[i].pull, &sp90, pad2, phi_s6, phi_f24);
+ Boss07_Mask_UpdateTentacles(this, globalCtx, &this->tentacles[i].base, this->tentacles[i].pos,
+ this->tentacles[i].rot, this->tentacles[i].pull, &sp90, pad2, phi_s6, phi_f24);
}
Boss07_Mask_DrawTentacles(this, globalCtx, this->tentacles[i].pos, this->tentacles[i].rot, pad2, i * 0.9f);
phi_f24 += 0.5f;
spA8.y += 1.0f;
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
Boss07_Mask_DrawBeam(this, globalCtx);
this->unk_149 = 0;
@@ -5501,7 +5510,7 @@ void Boss07_Projectile_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Boss07* this = THIS;
f32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->unk_14C++;
if (this->actor.params == MAJORA_REMAINS_SHOT) {
@@ -5555,10 +5564,10 @@ void Boss07_Projectile_Draw(Actor* thisx, GlobalContext* globalCtx2) {
D_80A07968[this->unk_181C][2], 255);
gDPSetEnvColor(POLY_XLU_DISP++, D_80A07950[this->unk_181C][0], D_80A07950[this->unk_181C][1],
D_80A07950[this->unk_181C][2], 128);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, 0.0f, 1);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023348);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
@@ -5592,7 +5601,7 @@ void func_80A04768(Boss07* this, GlobalContext* globalCtx) {
Boss07_Remains_DamageSfx(this);
}
Matrix_RotateY(this->actor.yawTowardsPlayer, 0);
- SysMatrix_GetStateTranslationAndScaledZ(-20.0f, &sp2C);
+ Matrix_GetStateTranslationAndScaledZ(-20.0f, &sp2C);
this->unk_18CC = sp2C.x;
this->unk_18D0 = sp2C.z;
}
@@ -5615,7 +5624,7 @@ void func_80A04890(Boss07* this, GlobalContext* globalCtx) {
f32 sp34;
s16 sp32;
s16 sp30;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
switch (this->unk_14E) {
case 0:
@@ -5898,8 +5907,8 @@ void Boss07_Remains_Draw(Actor* thisx, GlobalContext* globalCtx2) {
}
sp64 = this->unk_15C * (M_PI / 4.0f) * 0.06666667f;
sp60 = Math_SinS(this->unk_15C * 0x3500) * sp64 * 0.5f;
- SysMatrix_InsertYRotation_f(Math_SinS(this->unk_15C * 0x4500) * sp64, 1);
- SysMatrix_RotateStateAroundXAxis(sp60);
+ Matrix_InsertYRotation_f(Math_SinS(this->unk_15C * 0x4500) * sp64, 1);
+ Matrix_RotateStateAroundXAxis(sp60);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
switch (this->actor.params) {
case MAJORA_REMAINS + REMAINS_ODOLWA:
@@ -5921,10 +5930,10 @@ void Boss07_Remains_Draw(Actor* thisx, GlobalContext* globalCtx2) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, 200);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 128);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_Scale(this->unk_188C, this->unk_188C, 0.0f, 1);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
- SysMatrix_InsertZRotation_s(this->unk_18C8, 1);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertZRotation_s(this->unk_18C8, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_04023348);
gSPDisplayList(POLY_XLU_DISP++, D_04023428);
@@ -6112,7 +6121,7 @@ void func_80A06500(Boss07* this, GlobalContext* globalCtx) {
void func_80A06990(Boss07* this, GlobalContext* globalCtx) {
s32 sp3C;
s32 sp38 = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad[3];
if (this->cyl2.base.acFlags & 2) {
@@ -6204,10 +6213,10 @@ void Boss07_Top_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if ((this->unk_15E % 2) != 0) {
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 780, 1099);
}
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
Matrix_RotateY(this->actor.shape.rot.y, 1);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
- SysMatrix_InsertYRotation_f(this->unk_178, 1);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
+ Matrix_InsertYRotation_f(this->unk_178, 1);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), 2);
gSPDisplayList(POLY_OPA_DISP++, D_0602F640);
@@ -6218,12 +6227,12 @@ void Boss07_Top_Draw(Actor* thisx, GlobalContext* globalCtx2) {
void Boss07_Static_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Boss07* this = THIS;
-
+
Boss07_Static_UpdateEffects(globalCtx);
if (sHeartbeatTimer != 0) {
sHeartbeatTimer--;
- dummy_label:;
+ dummy_label:;
play_sound(NA_SE_EN_LAST2_HEARTBEAT_OLD - SFX_FLAG);
}
if (this->unk_1808 != 0) {
@@ -6413,8 +6422,8 @@ void Boss07_Static_DrawEffects(GlobalContext* globalCtx) {
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (3 * effect->unk_2) & 0x7F,
(15 * -effect->unk_2) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20));
- SysMatrix_InsertTranslation(effect->unk_4.x, effect->unk_4.y, effect->unk_4.z, 0);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(effect->unk_4.x, effect->unk_4.y, effect->unk_4.z, 0);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(effect->unk_34, effect->unk_34, 1.0f, 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), 2);
gSPDisplayList(POLY_XLU_DISP++, D_0600CEE8);
diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c
index 2b7492754..1e36f9e29 100644
--- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c
+++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c
@@ -72,7 +72,7 @@ void DmNb_Init(Actor* thisx, GlobalContext* globalCtx) {
DmNb* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06008C40, NULL, this->limbDrawTable, this->transitionDrawTable, 8);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06008C40, NULL, this->jointTable, this->morphTable, 8);
this->unk1F0 = -1;
func_80C1DED0(this, 0);
this->actor.flags &= ~1;
@@ -87,17 +87,17 @@ void DmNb_Update(Actor* thisx, GlobalContext* globalCtx) {
DmNb* this = THIS;
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 0x4);
+ SkelAnime_Update(&this->skelAnime);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
}
-void DmNb_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* actor) {
+void DmNb_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
}
void DmNb_Draw(Actor* thisx, GlobalContext* globalCtx) {
DmNb* this = THIS;
func_8012C5B0(globalCtx->state.gfxCtx);
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
NULL, DmNb_UnkActorDraw, &this->actor);
}
diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h
index f31d0c3de..a417ea070 100644
--- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h
+++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h
@@ -11,8 +11,8 @@ typedef struct DmNb {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ DmNbActionFunc actionFunc;
- /* 0x18C */ Vec3s limbDrawTable[8];
- /* 0x1BC */ Vec3s transitionDrawTable[8];
+ /* 0x18C */ Vec3s jointTable[8];
+ /* 0x1BC */ Vec3s morphTable[8];
/* 0x1EC */ u8 unk1EC;
/* 0x1F0 */ s32 unk1F0;
/* 0x1F4 */ s32 unk1F4;
diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
index b5ddf40a0..02101b113 100644
--- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
+++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c
@@ -33,12 +33,12 @@ void func_80A2E960(SkelAnime* arg0, ActorAnimationEntry* animations, u16 index)
animations += index;
if (animations->frameCount < 0.0f) {
- frameCount = SkelAnime_GetFrameCount(&animations->animation->common);
+ frameCount = Animation_GetLastFrame(animations->animation);
} else {
frameCount = animations->frameCount;
}
- SkelAnime_ChangeAnim(arg0, animations->animation, animations->playSpeed, animations->startFrame, frameCount,
- animations->mode, animations->morphFrames);
+ Animation_Change(arg0, animations->animation, animations->playSpeed, animations->startFrame, frameCount,
+ animations->mode, animations->morphFrames);
}
void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) {
@@ -48,7 +48,7 @@ void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) {
this->alpha = 0xFF;
this->actor.targetArrowOffset = 3000.0f;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013328, NULL, 0, 0, 0);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013328, NULL, 0, 0, 0);
func_80A2E960(&this->skelAnime, D_80A2ED00, 0);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = DmSa_DoNothing;
@@ -63,7 +63,7 @@ void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx) {
void DmSa_Update(Actor* thisx, GlobalContext* globalCtx) {
DmSa* this = THIS;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->alpha += 0;
this->actionFunc(this, globalCtx);
}
@@ -114,7 +114,7 @@ void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EBB0(globalCtx->state.gfxCtx, this->alpha));
}
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_80A2EB10, func_80A2EB2C, func_80A2EB44, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c
index 9370c4b14..4db7316e4 100644
--- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c
+++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c
@@ -118,7 +118,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) {
}
void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 dooranaType = GET_DOORANA_TYPE(this);
s8 pad[4];
s32 entranceIndex;
@@ -129,13 +129,13 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) {
(player->stateFlags1 & 0x80000000) && (player->unk_AE7 == 0)) {
if (dooranaType == DOORANA_TYPE_ADJACENT) {
+ s32 requiredScopeTemp;
+
// 300 uses scene exit addresses, not static DoorAna entrance addresses,
// eg. deku playground gets address in the NCT scene exit table
entranceIndex = GET_DOORANA_ADJACENT_ENTRANCE(this);
globalCtx->nextEntranceIndex = globalCtx->setupExitList[entranceIndex];
- lblUnk_808E03B8:; // required to convince compiler to not use delay slot
-
} else {
// unused in vanilla, the highest params bits can directly index an address
entranceIndex = GET_DOORANA_DIRECT_ENTRANCE(this);
@@ -187,7 +187,7 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) {
}
if ((this->actor.yDistToPlayer <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x;
player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z;
}
@@ -197,7 +197,7 @@ void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) {
DoorAna* this = THIS;
this->actionFunc(this, globalCtx);
- this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(globalCtx->cameraPtrs[globalCtx->activeCamera]));
+ this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)));
}
void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) {
diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c
index e767e3f35..1978756a2 100644
--- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c
+++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c
@@ -223,7 +223,7 @@ void DoorSpiral_WaitForObject(DoorSpiral* this, GlobalContext* globalCtx) {
*/
f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 yOffset, f32 spiralWidth,
f32 spiralHeight) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f target;
Vec3f offset;
@@ -244,7 +244,7 @@ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32
* Checks if the player should climb the stairs.
*/
s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(func_801233E4(globalCtx))) {
SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType];
@@ -277,7 +277,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) {
if (this->shouldClimb) {
DoorSpiral_SetupAction(this, DoorSpiral_PlayerClimb);
} else if (DoorSpiral_PlayerShouldClimb(this, globalCtx)) {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
player->doorType = 4;
player->doorDirection = this->orientation;
@@ -293,7 +293,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) {
* Player is climbing the stairs.
*/
void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(player->stateFlags1 & 0x20000000)) {
DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject);
@@ -304,7 +304,7 @@ void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) {
void DoorSpiral_Update(Actor* thisx, GlobalContext* globalCtx) {
DoorSpiral* this = (DoorSpiral*)thisx;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((!(player->stateFlags1 & 0x100004C0)) || (this->actionFunc == DoorSpiral_WaitForObject)) {
this->actionFunc(this, globalCtx);
diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
index b5a6f4c86..3ca55d7b8 100644
--- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
+++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
@@ -163,7 +163,7 @@ void func_80918FE4(EffDust* this, GlobalContext* globalCtx) {
void func_80919230(EffDust* this, GlobalContext* globalCtx) {
s16 theta;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor* parent = this->actor.parent;
f32* distanceTraveled = this->distanceTraveled;
s32 i;
@@ -262,7 +262,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) {
s16 sp92;
Vec3f activeCamEye;
- activeCamEye = ACTIVE_CAM->eye;
+ activeCamEye = GET_ACTIVE_CAM(globalCtx)->eye;
sp92 = Math_Vec3f_Yaw(&activeCamEye, &thisx->world.pos);
OPEN_DISPS(gfxCtx);
@@ -281,14 +281,14 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) {
for (i = 0; i < ARRAY_COUNT(this->distanceTraveled); i++) {
if (*distanceTraveled < 1.0f) {
aux = 1.0f - SQ(*distanceTraveled);
- SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(sp92, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
- initialPositions->y * ((this->dy * aux) + (1.0f - this->dy)),
- initialPositions->z * ((this->dz * aux) + (1.0f - this->dz)), MTXMODE_APPLY);
- Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, 1);
+ Matrix_InsertTranslation(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
+ initialPositions->y * ((this->dy * aux) + (1.0f - this->dy)),
+ initialPositions->z * ((this->dz * aux) + (1.0f - this->dz)), MTXMODE_APPLY);
+ Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -313,7 +313,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) {
Vec3f* initialPositions;
s32 i;
f32 aux;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
OPEN_DISPS(gfxCtx);
func_8012C28C(gfxCtx);
@@ -337,15 +337,15 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (*distanceTraveled * 255.0f));
aux = 1.0f - SQ(*distanceTraveled);
- SysMatrix_InsertMatrix(&player->mf_CC4, MTXMODE_NEW);
- SysMatrix_InsertTranslation(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
- (initialPositions->y * (1.0f - *distanceTraveled)) + 320.0f,
- (initialPositions->z * (1.0f - *distanceTraveled)) + -20.0f, MTXMODE_APPLY);
+ Matrix_InsertMatrix(&player->mf_CC4, MTXMODE_NEW);
+ Matrix_InsertTranslation(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)),
+ (initialPositions->y * (1.0f - *distanceTraveled)) + 320.0f,
+ (initialPositions->z * (1.0f - *distanceTraveled)) + -20.0f, MTXMODE_APPLY);
Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor,
*distanceTraveled * this->scalingFactor, MTXMODE_APPLY);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING);
diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h
index e022d21a0..119507d4d 100644
--- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h
+++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h
@@ -11,7 +11,10 @@ typedef struct EnArrow {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x7C];
/* 0x01C0 */ s32 unk_1C0;
- /* 0x01C4 */ char unk_1C4[0xB0];
+ /* 0x01C4 */ char unk_1C4[0x9C];
+ /* 0x0260 */ u8 unk_260; // timer in OoT
+ /* 0x0261 */ u8 unk_261; // hitFlags in OoT
+ /* 0x0262 */ char unk_262[0x12];
/* 0x0274 */ EnArrowActionFunc actionFunc;
} EnArrow; // size = 0x278
diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c
index b054b20e8..d9bb0f9fc 100644
--- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c
+++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c
@@ -69,7 +69,7 @@ void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBaisen* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007908, &D_060011C0, this->jointTable, this->morphTable, 20);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007908, &D_060011C0, this->jointTable, this->morphTable, 20);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->paramCopy = this->actor.params;
if (this->actor.params == 0) {
@@ -103,9 +103,9 @@ void EnBaisen_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnBaisen_ChangeAnimation(EnBaisen* this, s32 animIndex) {
this->animIndex = animIndex;
- this->frameCount = SkelAnime_GetFrameCount(&D_80BE8E4C[animIndex]->common);
- SkelAnime_ChangeAnim(&this->skelAnime, D_80BE8E4C[this->animIndex], 1.0f, 0.0f, this->frameCount,
- animModes[this->animIndex], -10.0f);
+ this->frameCount = Animation_GetLastFrame(D_80BE8E4C[animIndex]);
+ Animation_Change(&this->skelAnime, D_80BE8E4C[this->animIndex], 1.0f, 0.0f, this->frameCount,
+ animModes[this->animIndex], -10.0f);
}
void func_80BE871C(EnBaisen* this) {
@@ -201,7 +201,7 @@ void func_80BE89D8(EnBaisen* this, GlobalContext* globalCtx) {
}
if ((globalCtx->msgCtx.unk11F04 == 0x2AC6) || (globalCtx->msgCtx.unk11F04 == 0x2AC7) ||
(globalCtx->msgCtx.unk11F04 == 0x2AC8)) {
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
this->unk29E = this->actor.yawTowardsPlayer;
}
if (this->unk2AC == 2) { // Note: This variable is only ever set to 1.
@@ -244,7 +244,7 @@ void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnBaisen* this = THIS;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unusedCounter != 0) {
this->unusedCounter--;
}
@@ -284,6 +284,6 @@ void EnBaisen_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBaisen* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnBaisen_OverrideLimbDraw, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnBaisen_OverrideLimbDraw, NULL, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
index f1da2dc1d..2cb90b98d 100644
--- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
+++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
@@ -74,8 +74,6 @@ void EnBigpo_WaitingForDampe(EnBigpo* this, GlobalContext* globalCtx);
void EnBigpo_RevealedFireGrowing(EnBigpo* this, GlobalContext* globalCtx);
// draw funcs
-void EnBigpo_PostLimbDraw(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* actor,
- Gfx** gfx);
void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx);
void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx);
void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx);
@@ -404,7 +402,7 @@ void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, GlobalContext* globalCtx) {
* big poe starts to visibly appear
*/
void EnBigpo_SpawnCutsceneStage5(EnBigpo* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001360);
+ Animation_PlayLoop(&this->skelAnime, &D_06001360);
this->actor.draw = EnBigpo_DrawMainBigpo;
Actor_SetScale(&this->actor, 0.014f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR);
@@ -419,7 +417,7 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, GlobalContext* globalCtx) {
s32 i;
s32 alphaPlus; // color alpha + 10
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.shape.rot.y += this->rotVelocity;
alphaPlus = this->mainColor.a + 10; // decrease transparency
func_80B61914(this);
@@ -466,7 +464,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx) {
Actor* dampe;
Camera* subCam;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->idleTimer--;
if (this->idleTimer == 0) {
subCam = Play_GetCamera(globalCtx, this->cutsceneSubCamId);
@@ -513,12 +511,12 @@ void EnBigpo_WarpingOut(EnBigpo* this, GlobalContext* globalCtx) {
}
void EnBigpo_SetupWarpIn(EnBigpo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 distance = CLAMP_MIN(this->actor.xzDistToPlayer, 200.0f);
s16 randomYaw = (Rand_Next() >> 0x14) + this->actor.yawTowardsPlayer;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR);
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001360);
+ Animation_PlayLoop(&this->skelAnime, &D_06001360);
this->rotVelocity = 0x2000;
this->actor.world.pos.x = (Math_SinS(randomYaw) * distance) + player->actor.world.pos.x;
this->actor.world.pos.z = (Math_CosS(randomYaw) * distance) + player->actor.world.pos.z;
@@ -545,7 +543,7 @@ void EnBigpo_WarpingIn(EnBigpo* this, GlobalContext* globalCtx) {
}
void EnBigpo_SetupIdleFlying(EnBigpo* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000924, -5.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000924, -5.0f);
// if poe missed attack, idle 4 seconds, otherwise its reappearing: attack immediately
this->idleTimer = (this->actionFunc == EnBigpo_SpinningDown) ? 80 : 0;
this->hoverHeightCycleTimer = 40;
@@ -559,9 +557,9 @@ void EnBigpo_SetupIdleFlying(EnBigpo* this) {
}
void EnBigpo_IdleFlying(EnBigpo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
DECR(this->idleTimer);
// flight position calculations
@@ -596,7 +594,7 @@ void EnBigpo_SetupSpinUp(EnBigpo* this) {
}
void EnBigpo_SpinningUp(EnBigpo* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->rotVelocity += 0x200;
EnBigpo_UpdateSpin(this);
if (this->rotVelocity >= 0x3C00) {
@@ -611,10 +609,10 @@ void EnBigpo_SetupSpinAttack(EnBigpo* this) {
}
void EnBigpo_SpinAttack(EnBigpo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yawDiff;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_StepToF(&this->actor.speedXZ, 10.0f, 1.0f);
Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 0.3f, 7.5f, 1.0f);
EnBigpo_UpdateSpin(this);
@@ -636,9 +634,9 @@ void EnBigpo_SetupSpinDown(EnBigpo* this) {
}
void EnBigpo_SpinningDown(EnBigpo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 100.0f, 0.3f, 5.0f, 1.0f);
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f);
if (Math_ScaledStepToS(&this->rotVelocity, 0, 0x200)) {
@@ -656,7 +654,7 @@ void EnBigpo_SpinningDown(EnBigpo* this, GlobalContext* globalCtx) {
* called by EnBigpo_ApplyDamage
*/
void EnBigpo_HitStun(EnBigpo* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000454, -6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000454, -6.0f);
func_800BCB70(&this->actor, 0x4000, 0xFF, 0, 0x10);
this->collider.base.acFlags &= ~AC_ON;
func_800BE504(&this->actor, &this->collider);
@@ -669,7 +667,7 @@ void EnBigpo_HitStun(EnBigpo* this) {
*/
void EnBigpo_CheckHealth(EnBigpo* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->actor.colChkInfo.health == 0) {
EnBigpo_SetupDeath(this);
} else {
@@ -699,7 +697,7 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) {
this->idleTimer++;
if (this->idleTimer < 8) {
- cam = func_800DFCDC(ACTIVE_CAM) + 0x4800;
+ cam = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800;
if (this->idleTimer < 5) {
unkTemp = (this->idleTimer << 0xC) - 0x4000;
// 1.4.0...1 is NOT 1.4, the rodata demands it
@@ -869,7 +867,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx)
s32 fireCount = 0;
// count the number of possible fires we can find (4 in vanilla)
- for (enemyPtr = FIRST_ENEMY; enemyPtr != NULL; enemyPtr = enemyPtr->next) {
+ for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) {
if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) {
fireCount++;
}
@@ -887,7 +885,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx)
// for available possiblefires, pick three to be random fires
for (fireIndex = 0; fireIndex < ARRAY_COUNT(this->fires); fireIndex++, fireCount--) {
- enemyPtr = FIRST_ENEMY;
+ enemyPtr = GET_FIRST_ENEMY(globalCtx);
randomIndex = ((s32)Rand_ZeroFloat(fireCount)) % fireCount;
while (enemyPtr != NULL) {
@@ -920,7 +918,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx)
}
// remove unused fires
- for (enemyPtr = FIRST_ENEMY; enemyPtr != NULL; enemyPtr = enemyPtr->next) {
+ for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) {
if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) {
randomFirePo = (EnBigpo*)enemyPtr;
randomFirePo->actionFunc = EnBigpo_Die;
@@ -1227,12 +1225,12 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) {
*/
void EnBigpo_UpdateFire(Actor* thisx, GlobalContext* globalCtx) {
EnBigpo* this = (EnBigpo*)thisx;
- this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(ACTIVE_CAM));
+ this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)));
this->actionFunc(this, globalCtx);
}
-s32 EnBigpo_OverrideLimbDraw(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- struct Actor* actor, Gfx** gfx) {
+s32 EnBigpo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor,
+ Gfx** gfx) {
EnBigpo* this = (EnBigpo*)actor;
// not fully invisible
if (!(this->mainColor.a != 0 && limbIndex != 7) ||
@@ -1259,36 +1257,37 @@ void EnBigpo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
if (limbIndex == 7) {
// we scale the vec3f... then do nothing with it?
- SysMatrix_GetStateTranslationAndScaledY(1400.0f, &unusedVec);
+ Matrix_GetStateTranslationAndScaledY(1400.0f, &unusedVec);
if ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer > 18)) {
- if (actor->scale.x != 0.0f) {
- Matrix_Scale(0.014f / actor->scale.x, 0.014f / actor->scale.x, 0.014f / actor->scale.x, 1);
+ if (this->actor.scale.x != 0.0f) {
+ Matrix_Scale(0.014f / this->actor.scale.x, 0.014f / this->actor.scale.x, 0.014f / this->actor.scale.x,
+ 1);
}
}
- SysMatrix_CopyCurrentState(&this->drawMtxF);
+ Matrix_CopyCurrentState(&this->drawMtxF);
}
limbByte = D_80B65078[limbIndex];
if (limbByte != -1) {
if (limbByte < 3) {
- SysMatrix_GetStateTranslation(&this->limbPos[limbByte]);
+ Matrix_GetStateTranslation(&this->limbPos[limbByte]);
return;
}
if (limbByte == 3) {
- SysMatrix_GetStateTranslationAndScaledX(3000.0f, &this->limbPos[limbByte]);
+ Matrix_GetStateTranslationAndScaledX(3000.0f, &this->limbPos[limbByte]);
return;
}
if (limbByte == 4) {
- SysMatrix_GetStateTranslationAndScaledY(-2000.0f, &this->limbPos[limbByte]);
+ Matrix_GetStateTranslationAndScaledY(-2000.0f, &this->limbPos[limbByte]);
return;
}
v2ptr = &this->limbPos[limbByte + 1];
v1ptr = D_80B65084;
- SysMatrix_GetStateTranslationAndScaledX(-4000.0f, &this->limbPos[limbByte]);
+ Matrix_GetStateTranslationAndScaledX(-4000.0f, &this->limbPos[limbByte]);
for (i = limbByte + 1; i < ARRAY_COUNT(this->limbPos); i++) {
- SysMatrix_MultiplyVector3fByState(v1ptr, v2ptr);
+ Matrix_MultiplyVector3fByState(v1ptr, v2ptr);
v2ptr++;
v1ptr++;
}
@@ -1310,8 +1309,8 @@ void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(&dispHead[2], 0x08,
Gfx_EnvColor(globalCtx->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b,
this->mainColor.a));
- POLY_OPA_DISP = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]);
+ POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]);
} else {
dispHead = POLY_XLU_DISP;
@@ -1320,15 +1319,15 @@ void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(&dispHead[2], 0x08,
Gfx_EnvColor(globalCtx->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b,
this->mainColor.a));
- POLY_XLU_DISP = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]);
+ POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]);
}
// 71.428566f might be 500/7 context unknown
func_800BE680(globalCtx, &this->actor, this->limbPos, 9, this->actor.scale.x * 71.428566f * this->unk220, 0,
this->unk21C, 0x14);
- SysMatrix_SetCurrentState(&this->drawMtxF);
+ Matrix_SetCurrentState(&this->drawMtxF);
EnBigpo_DrawLantern(&this->actor, globalCtx);
if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) {
EnBigpo_DrawCircleFlames(&this->actor, globalCtx);
@@ -1357,7 +1356,7 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) {
this->actor.world.pos.z, this->mainColor.r, this->mainColor.g, this->mainColor.b,
this->mainColor.a * 2);
- Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1377,7 +1376,7 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) {
Gfx* dispHead;
Vec3f vec1;
Vec3f vec2;
- Camera* cam = ACTIVE_CAM;
+ Camera* cam = GET_ACTIVE_CAM(globalCtx);
if (cam != NULL) {
Math_Vec3f_Diff(&cam->eye, &cam->at, &vec1);
@@ -1404,7 +1403,7 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(&dispHead[1], 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 0, 255, this->mainColor.a));
- SysMatrix_GetStateTranslationAndScaledY(1400.0f, &vec2);
+ Matrix_GetStateTranslationAndScaledY(1400.0f, &vec2);
Lights_PointGlowSetInfo(&this->fires[0].info, vec2.x + vec1.x, vec2.y + vec1.y, vec2.z + vec1.z,
this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, this->lanternColor.a);
@@ -1433,11 +1432,11 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) {
MtxF* mtfxPtr;
s32 i;
- mtfxPtr = SysMatrix_GetCurrentState();
+ mtfxPtr = Matrix_GetCurrentState();
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)), MTXMODE_NEW);
+ Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_NEW);
if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) {
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
fireRadius = 500;
diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c
index 9f06cdc16..45370609b 100644
--- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c
+++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c
@@ -26,9 +26,8 @@ void func_809CD6C0(EnBji01* this, GlobalContext* globalCtx);
void func_809CD70C(EnBji01* this, GlobalContext* globalCtx);
void func_809CD77C(EnBji01* this, GlobalContext* globalCtx);
-s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- Actor* actor);
-void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor);
+s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg);
+void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg);
extern AnimationHeader D_06000FDC;
extern AnimationHeader D_06005B58;
@@ -80,7 +79,7 @@ static struct_80B8E1A8 D_809CDC7C[] = {
};
void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp58;
s32 pad[2];
@@ -297,7 +296,7 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) {
func_809CCE98(this, globalCtx);
break;
}
- if ((this->animationIndex == 3) && (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount)) {
+ if ((this->animationIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) {
func_8013E1C8(&this->skelAnime, D_809CDC7C, 2, &this->animationIndex);
}
}
@@ -339,8 +338,8 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBji01* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 30.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600578C, &D_06000FDC, this->jointTable, this->morphTable,
- BJI_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600578C, &D_06000FDC, this->jointTable, this->morphTable,
+ BJI_LIMB_MAX);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@@ -386,7 +385,7 @@ void EnBji01_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
Actor_UpdateBgCheckInfo(globalCtx, (Actor*)this, 0.0f, 0.0f, 0.0f, 4U);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->blinkTimer-- <= 0) {
if (--this->blinkSeqIndex < 0) {
@@ -438,7 +437,7 @@ void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
sp20.x += temp_f4 * 0.1f;
sp20.y += temp_f4 * 0.1f;
sp20.z += temp_f4 * 0.1f;
- SysMatrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
}
}
@@ -449,7 +448,7 @@ void EnBji01_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnBji01_OverrideLimbDraw, EnBji01_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnBji01_OverrideLimbDraw, EnBji01_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.c b/src/overlays/actors/ovl_En_Bu/z_en_bu.c
index ad001d6e0..8a7d39086 100644
--- a/src/overlays/actors/ovl_En_Bu/z_en_bu.c
+++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.c
@@ -47,11 +47,11 @@ void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z, 1);
Matrix_RotateY(this->actor.shape.rot.y, 1);
- SysMatrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
- Matrix_Scale(0.01f, 0.01f, 0.01f, 1);
+ Matrix_InsertXRotation_s(this->actor.shape.rot.x, 1);
+ Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, this->displayListPtr);
diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c
index 1df7f22e1..9a1280c29 100644
--- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c
+++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c
@@ -118,7 +118,7 @@ void EnCha_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnCha* this = THIS;
func_800BDFC0(globalCtx, D_06000710);
- SysMatrix_InsertTranslation(-1094.0f, 4950.0f, 9.0f, 1);
- SysMatrix_InsertXRotation_s(this->actor.home.rot.x, 1);
+ Matrix_InsertTranslation(-1094.0f, 4950.0f, 9.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->actor.home.rot.x, 1);
func_800BDFC0(globalCtx, D_06000958);
}
diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c
index aee46c2f1..b7ad8e6f3 100644
--- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c
+++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c
@@ -244,6 +244,8 @@ void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* v
// Look for an available effect to allocate a light ray effect to.
for (i = 0; i < ARRAY_COUNT(this->effect) - 1; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) {
+ s32 requiredScopeTemp;
+
effect->type = CLEAR_TAG_EFFECT_LIGHT_RAYS;
effect->position = *position;
@@ -271,7 +273,6 @@ void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* v
break;
}
- dummy:;
}
}
@@ -415,9 +416,9 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) {
for (i = 0; i < 54; i++) {
lightRayMaxScale =
sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]);
- SysMatrix_InsertYRotation_f(Rand_ZeroFloat(M_PI * 2), 0);
- SysMatrix_RotateStateAroundXAxis(Rand_ZeroFloat(M_PI * 2));
- SysMatrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel);
+ Matrix_InsertYRotation_f(Rand_ZeroFloat(M_PI * 2), 0);
+ Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(M_PI * 2));
+ Matrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel);
accel.x = vel.x * -0.03f;
accel.y = vel.y * -0.03f;
accel.z = vel.z * -0.03f;
@@ -488,9 +489,9 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) {
pos = this->actor.world.pos;
for (i = 0; i < 44; i++) {
lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]);
- SysMatrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), 0);
- SysMatrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI));
- SysMatrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel);
+ Matrix_InsertYRotation_f(Rand_ZeroFloat(2 * M_PI), 0);
+ Matrix_RotateStateAroundXAxis(Rand_ZeroFloat(2 * M_PI));
+ Matrix_GetStateTranslationAndScaledZ(lightRayMaxScale, &vel);
accel.x = vel.x * -0.03f;
accel.y = vel.y * -0.03f;
accel.z = vel.z * -0.03f;
@@ -508,7 +509,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) {
}
void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Camera* camera;
s32 pad;
@@ -797,10 +798,10 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
}
// Draw the debris effect.
- SysMatrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
- SysMatrix_InsertYRotation_f(effect->rotationY, MTXMODE_APPLY);
- SysMatrix_RotateStateAroundXAxis(effect->rotationX);
+ Matrix_InsertYRotation_f(effect->rotationY, MTXMODE_APPLY);
+ Matrix_RotateStateAroundXAxis(effect->rotationX);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gClearTagDebrisEffectDL);
}
@@ -816,7 +817,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, (s8)effect->primColor.a);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)effect->primColor.a);
func_800C0094(this->actor.floorPoly, effect->position.x, effect->position.y, effect->position.z, &mtxF);
- SysMatrix_SetCurrentState(&mtxF);
+ Matrix_SetCurrentState(&mtxF);
Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_04030100);
@@ -841,7 +842,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)(effect->primColor.a * 0.7f));
func_800C0094(this->actor.floorPoly, effect->position.x, this->actor.floorHeight, effect->position.z,
&mtxF);
- SysMatrix_SetCurrentState(&mtxF);
+ Matrix_SetCurrentState(&mtxF);
Matrix_Scale(effect->scale * 3.0f, 1.0f, effect->scale * 3.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectGroundDL);
@@ -869,10 +870,10 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(
POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 5, 32, 64, 1, 0, 0, 32, 32));
- SysMatrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(effect->smokeScaleX * effect->scale, effect->smokeScaleY * effect->scale, 1.0f, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, 20.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, 20.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL);
}
@@ -895,8 +896,8 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(
POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 15, 32, 64, 1, 0, 0, 32, 32));
- SysMatrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL);
@@ -917,8 +918,8 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
// Draw the flash billboard effect.
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a);
- SysMatrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(2.0f * effect->scale, 2.0f * effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectDL);
@@ -942,12 +943,12 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
// Draw the light ray effect.
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)effect->primColor.r, (u8)effect->primColor.g,
(u8)effect->primColor.b, (u8)effect->primColor.a);
- SysMatrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
- SysMatrix_InsertYRotation_f(effect->rotationY, MTXMODE_APPLY);
- SysMatrix_RotateStateAroundXAxis(effect->rotationX);
- SysMatrix_InsertZRotation_f(effect->rotationZ, MTXMODE_APPLY);
+ Matrix_InsertTranslation(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
+ Matrix_InsertYRotation_f(effect->rotationY, MTXMODE_APPLY);
+ Matrix_RotateStateAroundXAxis(effect->rotationX);
+ Matrix_InsertZRotation_f(effect->rotationZ, MTXMODE_APPLY);
Matrix_Scale(effect->scale * 0.5f, effect->scale * 0.5f, effect->maxScale * effect->scale, MTXMODE_APPLY);
- SysMatrix_RotateStateAroundXAxis(M_PI / 2);
+ Matrix_RotateStateAroundXAxis(M_PI / 2);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gClearTagLightRayEffectDL);
}
@@ -967,8 +968,8 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
// Apply material 16 times along a circle to give the appearance of a splash
for (j = 0; j < 16; j++) {
- SysMatrix_InsertYRotation_f(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_NEW);
- SysMatrix_GetStateTranslationAndScaledZ(effect->maxScale, &vec);
+ Matrix_InsertYRotation_f(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_NEW);
+ Matrix_GetStateTranslationAndScaledZ(effect->maxScale, &vec);
/**
* Get the water surface at point (`x`, `ySurface`, `z`). `ySurface` doubles as position y input
* returns true if point is within the xz boundaries of an active water box, else false
@@ -979,10 +980,10 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
&ySurface, &waterBox)) {
if ((effect->position.y - ySurface) < 200.0f) {
// Draw the splash effect.
- SysMatrix_InsertTranslation(effect->position.x + vec.x, ySurface, effect->position.z + vec.z,
- MTXMODE_NEW);
- SysMatrix_InsertYRotation_f(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_APPLY);
- SysMatrix_RotateStateAroundXAxis(effect->rotationX);
+ Matrix_InsertTranslation(effect->position.x + vec.x, ySurface, effect->position.z + vec.z,
+ MTXMODE_NEW);
+ Matrix_InsertYRotation_f(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_APPLY);
+ Matrix_RotateStateAroundXAxis(effect->rotationX);
Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0403A0F0);
diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c
index c09c0dd3a..fb917742c 100644
--- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c
+++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c
@@ -16,7 +16,6 @@ void EnDai_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDai_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80B3F00C(EnDai* this, GlobalContext* globalCtx);
-void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx);
void func_80B3EF90(EnDai* this, GlobalContext* globalCtx);
extern AnimationHeader D_060107B0;
@@ -92,7 +91,7 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) {
isDisplayListSet = true;
}
- SysMatrix_StatePush();
+ Matrix_StatePush();
alpha = (particle->unk_02 / (f32)particle->unk_01);
alpha *= 255.0f;
@@ -103,15 +102,15 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) {
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (particle->unk_02 + (i * 3)) * 3,
(particle->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20));
- SysMatrix_InsertTranslation(particle->unk_10.x, particle->unk_10.y, particle->unk_10.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(particle->unk_10.x, particle->unk_10.y, particle->unk_10.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(particle->unk_34, particle->unk_34, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_060002E8);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
}
@@ -281,8 +280,7 @@ s16 func_80B3E8BC(EnDai* this, s32 arg1) {
}
while (i < end) {
- if ((D_80B3FCB4[i] <= this->skelAnime.animCurrentFrame) &&
- (D_80B3FCE4[i] >= this->skelAnime.animCurrentFrame)) {
+ if ((D_80B3FCB4[i] <= this->skelAnime.curFrame) && (D_80B3FCE4[i] >= this->skelAnime.curFrame)) {
return D_80B3FD14[i];
}
i++;
@@ -298,7 +296,7 @@ s32 func_80B3E96C(EnDai* this, GlobalContext* globalCtx) {
Vec3f sp50;
if ((DECR(this->unk_1DA) == 0) &&
- ((this->unk_1DC == 0) || func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount))) {
+ ((this->unk_1DC == 0) || Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame))) {
switch (this->unk_1DC) {
case 0:
func_80B3E5DC(this, 2);
@@ -374,10 +372,10 @@ s32 func_80B3EC84(EnDai* this) {
s32 ret = false;
for (i = 0; i < ARRAY_COUNT(D_80B3FD6C); i++) {
- if ((this->unk_1DC == D_80B3FD6C[i]) && (D_80B3FD2C[i] < this->skelAnime.animCurrentFrame) &&
- (D_80B3FD4C[i] >= this->skelAnime.animCurrentFrame)) {
- func_80B3EC10(D_80B3FD2C[i], D_80B3FD7C[i], D_80B3FD4C[i], D_80B3FD7C[i + 1],
- this->skelAnime.animCurrentFrame, &this->unk_1F0);
+ if ((this->unk_1DC == D_80B3FD6C[i]) && (D_80B3FD2C[i] < this->skelAnime.curFrame) &&
+ (D_80B3FD4C[i] >= this->skelAnime.curFrame)) {
+ func_80B3EC10(D_80B3FD2C[i], D_80B3FD7C[i], D_80B3FD4C[i], D_80B3FD7C[i + 1], this->skelAnime.curFrame,
+ &this->unk_1F0);
ret = true;
break;
}
@@ -401,10 +399,10 @@ s32 func_80B3ED88(EnDai* this) {
s32 ret = false;
for (i = 0; i < ARRAY_COUNT(D_80B3FE00); i++) {
- if ((this->unk_1DC == D_80B3FE00[i]) && (D_80B3FDE8[i] < this->skelAnime.animCurrentFrame) &&
- (D_80B3FDF4[i] >= this->skelAnime.animCurrentFrame)) {
- func_80B3EC10(D_80B3FDE8[i], D_80B3FE08[i], D_80B3FDF4[i], D_80B3FE08[i + 1],
- this->skelAnime.animCurrentFrame, &this->unk_1FC);
+ if ((this->unk_1DC == D_80B3FE00[i]) && (D_80B3FDE8[i] < this->skelAnime.curFrame) &&
+ (D_80B3FDF4[i] >= this->skelAnime.curFrame)) {
+ func_80B3EC10(D_80B3FDE8[i], D_80B3FE08[i], D_80B3FDF4[i], D_80B3FE08[i + 1], this->skelAnime.curFrame,
+ &this->unk_1FC);
ret = true;
break;
}
@@ -424,7 +422,7 @@ void func_80B3EE8C(EnDai* this, GlobalContext* globalCtx) {
}
void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.unk1202A == 3) &&
(globalCtx->msgCtx.unk1202E == 1)) {
@@ -497,24 +495,24 @@ void func_80B3F044(EnDai* this, GlobalContext* globalCtx) {
if (globalCtx->csCtx.frames == 360) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIGOLON_SLEEP3 - SFX_FLAG);
}
- if (func_801378B8(&this->skelAnime, 43.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 43.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GORON_BOUND_1);
}
this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC);
break;
case 3:
- if (func_801378B8(&this->skelAnime, 6.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIGOLON_SLEEP1);
}
this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC);
break;
case 4:
- if (func_801378B8(&this->skelAnime, 30.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 30.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DAIGOLON_SLEEP2);
}
- if (func_801378B8(&this->skelAnime, 35.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 35.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GORON_BOUND_0);
}
this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC);
@@ -528,7 +526,7 @@ void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDai* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 0.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060130D0, NULL, this->jointTable, this->morphTable, 19);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060130D0, NULL, this->jointTable, this->morphTable, 19);
this->unk_A70 = -1;
func_80B3E5DC(this, 0);
Actor_SetScale(&this->actor, 0.2f);
@@ -564,17 +562,17 @@ void EnDai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnDai_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDai* this = THIS;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!func_80B3E7C8(this, globalCtx) && func_80B3E69C(this, globalCtx)) {
func_80B3F044(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B3E834(this);
func_80B3E460(this);
} else {
this->actionFunc(this, globalCtx);
if (!(player->stateFlags2 & 0x8000000)) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B3E834(this);
if (!(this->unk_1CE & 0x200)) {
func_8013C964(&this->actor, globalCtx, 0.0f, 0.0f, 0, this->unk_1CE & 7);
@@ -593,7 +591,7 @@ s32 func_80B3F598(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
}
if (limbIndex == 11) {
- SysMatrix_MultiplyVector3fByState(&D_801D15B0, &this->unk_1E4);
+ Matrix_MultiplyVector3fByState(&D_801D15B0, &this->unk_1E4);
}
if (limbIndex == 10) {
@@ -615,15 +613,15 @@ void func_80B3F614(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
D_80B3FE4C.x = sREG(0);
D_80B3FE4C.y = sREG(1);
D_80B3FE4C.z = sREG(2);
- SysMatrix_MultiplyVector3fByState(&D_80B3FE4C, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80B3FE4C, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
- SysMatrix_CopyCurrentState(&sp24);
+ Matrix_CopyCurrentState(&sp24);
func_8018219C(&sp24, &sp64, 0);
this->unk_1D4 = BINANG_SUB(sp64.y, 0x4000);
break;
case 10:
- SysMatrix_CopyCurrentState(&this->unk_18C);
+ Matrix_CopyCurrentState(&this->unk_18C);
break;
}
}
@@ -672,10 +670,10 @@ void func_80B3F78C(EnDai* this, GlobalContext* globalCtx) {
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE58[this->unk_1D6]));
POLY_XLU_DISP =
- func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_80B3F598, func_80B3F614, func_80B3F6EC, &this->actor, POLY_XLU_DISP);
if (this->unk_1CE & 0x40) {
- SysMatrix_SetCurrentState(&this->unk_18C);
+ Matrix_SetCurrentState(&this->unk_18C);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0600C538);
@@ -704,9 +702,9 @@ void func_80B3F920(EnDai* this, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE70[this->unk_1D6]));
POLY_OPA_DISP =
- func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_80B3F598, func_80B3F614, func_80B3F6EC, &this->actor, POLY_OPA_DISP);
- SysMatrix_SetCurrentState(&this->unk_18C);
+ Matrix_SetCurrentState(&this->unk_18C);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_0600C538);
@@ -723,9 +721,9 @@ void func_80B3F920(EnDai* this, GlobalContext* globalCtx) {
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE70[this->unk_1D6]));
POLY_XLU_DISP =
- func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_8013AB00(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_80B3F598, func_80B3F614, func_80B3F6EC, &this->actor, POLY_XLU_DISP);
- SysMatrix_SetCurrentState(&this->unk_18C);
+ Matrix_SetCurrentState(&this->unk_18C);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0600C538);
diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
index c07c78398..40eac8099 100644
--- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
+++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
@@ -108,18 +108,18 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_27E = this->unk_278 * 4 + 4;
case ENDAIKU_PARAMS_FF_1:
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable, this->morphTable,
- 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable,
+ this->morphTable, 17);
break;
case ENDAIKU_PARAMS_FF_2:
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_0600B690, this->jointTable, this->morphTable,
- 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A850, &D_0600B690, this->jointTable,
+ this->morphTable, 17);
break;
case ENDAIKU_PARAMS_FF_3:
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06001114, this->jointTable, this->morphTable,
- 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A850, &D_06001114, this->jointTable,
+ this->morphTable, 17);
break;
}
@@ -141,8 +141,8 @@ void func_8094373C(EnDaiku* this, s32 arg1) {
0, 0, 0, 0, 2, 0, 0, 2, 2,
};
- this->unk_284 = SkelAnime_GetFrameCount(&D_809440A4[arg1]->common);
- SkelAnime_ChangeAnim(&this->skelAnime, D_809440A4[arg1], 1.0f, 0.0f, this->unk_284, D_809440C8[arg1], -4.0f);
+ this->unk_284 = Animation_GetLastFrame(D_809440A4[arg1]);
+ Animation_Change(&this->skelAnime, D_809440A4[arg1], 1.0f, 0.0f, this->unk_284, D_809440C8[arg1], -4.0f);
}
void func_809437C8(EnDaiku* this) {
@@ -179,7 +179,7 @@ void func_80943820(EnDaiku* this) {
}
void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) {
- f32 currentFrame = this->skelAnime.animCurrentFrame;
+ f32 currentFrame = this->skelAnime.curFrame;
s32 pad;
s32 day = gSaveContext.day - 1;
s32 pad2;
@@ -245,7 +245,7 @@ void func_80943BC0(EnDaiku* this) {
}
void func_80943BDC(EnDaiku* this, GlobalContext* globalCtx) {
- f32 currentFrame = this->skelAnime.animCurrentFrame;
+ f32 currentFrame = this->skelAnime.curFrame;
if ((this->unk_278 == ENDAIKU_PARAMS_FF_2) && (this->unk_284 <= currentFrame)) {
if (Rand_ZeroOne() < 0.5f) {
@@ -266,7 +266,7 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
if (this->unk_27E == 0) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
if ((this->unk_278 == ENDAIKU_PARAMS_FF_0) && (gSaveContext.day == 3) && (gSaveContext.isNight)) {
@@ -353,8 +353,8 @@ void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_80943E18, func_80943E60, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80943E18, func_80943E60, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c
index 9e34154a2..daa159788 100644
--- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c
+++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c
@@ -96,7 +96,7 @@ void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 40.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable, this->morphTable, 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable, this->morphTable, 17);
this->actor.targetMode = 0;
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->unk_278 = ENDAIKU2_GET_7F(&this->actor);
@@ -144,12 +144,12 @@ void func_80BE6408(EnDaiku2* this, s32 arg1) {
f32 sp34 = 1.0f;
this->unk_276 = arg1;
- this->unk_284 = SkelAnime_GetFrameCount(&sAnimations[this->unk_276]->common);
+ this->unk_284 = Animation_GetLastFrame(sAnimations[this->unk_276]);
if (this->unk_276 == 3) {
sp34 = 2.0f;
}
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[this->unk_276], sp34, 0.0f, this->unk_284,
- D_80BE7958[this->unk_276], -4.0f);
+ Animation_Change(&this->skelAnime, sAnimations[this->unk_276], sp34, 0.0f, this->unk_284, D_80BE7958[this->unk_276],
+ -4.0f);
}
s32 func_80BE64C0(EnDaiku2* this, GlobalContext* globalCtx) {
@@ -212,7 +212,7 @@ void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) {
}
void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) {
- f32 sp9C = this->skelAnime.animCurrentFrame;
+ f32 sp9C = this->skelAnime.curFrame;
s32 sp98 = gSaveContext.day - 1;
s32 i;
Vec3f sp88;
@@ -244,7 +244,7 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) {
}
func_800B8614(&this->actor, globalCtx, 80.0f);
- if ((this->unk_276 == 8) && func_801378B8(&this->skelAnime, 6.0f)) {
+ if ((this->unk_276 == 8) && Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_ROCK_BROKEN);
for (i = 0; i < 10; i++) {
@@ -274,8 +274,8 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) {
if ((this->unk_276 == 5) || (this->unk_276 == 9)) {
func_80BE6408(this, 10);
} else if ((this->unk_276 == 10) && (this->unk_284 <= sp9C)) {
- this->unk_284 = SkelAnime_GetFrameCount(&D_06002134.common);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06002134, -1.0f, this->unk_284, 0.0f, 2, -4.0f);
+ this->unk_284 = Animation_GetLastFrame(&D_06002134);
+ Animation_Change(&this->skelAnime, &D_06002134, -1.0f, this->unk_284, 0.0f, 2, -4.0f);
this->unk_276 = 11;
} else if ((this->unk_276 == 11) && (sp9C <= 0.0f)) {
func_80BE6408(this, 8);
@@ -371,7 +371,7 @@ void func_80BE6EB0(EnDaiku2* this) {
}
void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) {
- f32 sp5C = this->skelAnime.animCurrentFrame;
+ f32 sp5C = this->skelAnime.curFrame;
s32 pad[4];
Vec3f sp40;
s16 var;
@@ -440,7 +440,7 @@ void func_80BE71A0(EnDaiku2* this) {
}
void func_80BE71D8(EnDaiku2* this, GlobalContext* globalCtx) {
- f32 currentFrame = this->skelAnime.animCurrentFrame;
+ f32 currentFrame = this->skelAnime.curFrame;
if (func_80BE64C0(this, globalCtx)) {
func_80BE6CFC(this);
@@ -457,7 +457,7 @@ void EnDaiku2_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDaiku2* this = THIS;
s32 pad;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actionFunc(this, globalCtx);
this->actor.shape.rot.y = this->actor.world.rot.y;
Actor_SetHeight(&this->actor, 65.0f);
@@ -496,8 +496,8 @@ void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- EnDaiku2_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, EnDaiku2_PostLimbDraw, &this->actor);
func_80BE7718(this, globalCtx);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -561,17 +561,17 @@ void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) {
for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) {
if (particle->isEnabled) {
- SysMatrix_StatePush();
- SysMatrix_InsertTranslation(particle->unk_04.x, particle->unk_04.y, particle->unk_04.z, MTXMODE_NEW);
- SysMatrix_InsertXRotation_s(particle->unk_28.x, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertTranslation(particle->unk_04.x, particle->unk_04.y, particle->unk_04.z, MTXMODE_NEW);
+ Matrix_InsertXRotation_s(particle->unk_28.x, MTXMODE_APPLY);
Matrix_RotateY(particle->unk_28.y, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(particle->unk_28.z, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(particle->unk_28.z, MTXMODE_APPLY);
Matrix_Scale(particle->unk_30, particle->unk_30, particle->unk_30, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_060009E0);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
}
}
diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c
index 4dd551259..39acd872d 100644
--- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c
+++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c
@@ -178,7 +178,7 @@ void func_808BD3B4(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BD428(EnDekunuts* this) {
- SkelAnime_ChangeAnimPlaybackStop(&this->skelAnime, &D_06003180, 0.0f);
+ Animation_PlayOnceSetSpeed(&this->skelAnime, &D_06003180, 0.0f);
this->unk_190 = Rand_S16Offset(100, 50);
this->collider.dim.height = 5;
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos);
@@ -189,7 +189,7 @@ void func_808BD428(EnDekunuts* this) {
void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) {
s32 phi_v1 = false;
- if (this->skelAnime.animPlaybackSpeed < 0.5f) {
+ if (this->skelAnime.playSpeed < 0.5f) {
phi_v1 = true;
}
@@ -197,18 +197,18 @@ void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) {
this->unk_190--;
}
- if (func_801378B8(&this->skelAnime, 9.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
this->collider.base.acFlags |= AC_ON;
- } else if (func_801378B8(&this->skelAnime, 8.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
}
- this->collider.dim.height = (s32)((CLAMP(this->skelAnime.animCurrentFrame, 9.0f, 12.0f) - 9.0f) * 9.0f) + 5;
+ this->collider.dim.height = (s32)((CLAMP(this->skelAnime.curFrame, 9.0f, 12.0f) - 9.0f) * 9.0f) + 5;
if (!phi_v1 && (this->actor.params == ENDEKUNUTS_GET_FF00_0) &&
(Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) && (this->actor.xzDistToPlayer < 120.0f)) {
func_808BDC9C(this);
- } else if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ } else if (SkelAnime_Update(&this->skelAnime)) {
if (((this->unk_190 == 0) && (this->actor.xzDistToPlayer > 320.0f)) ||
(Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK)) {
func_808BD78C(this);
@@ -228,19 +228,19 @@ void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) {
((this->actor.params == ENDEKUNUTS_GET_FF00_2) && (this->actor.yDistToPlayer > -60.0f)) ||
(this->actor.params == ENDEKUNUTS_GET_FF00_1)) &&
((this->unk_190 == 0) || (this->actor.xzDistToPlayer < 480.0f))) {
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
}
}
void func_808BD78C(EnDekunuts* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06002FA4);
+ Animation_PlayLoop(&this->skelAnime, &D_06002FA4);
this->unk_190 = 2;
this->actionFunc = func_808BD7D4;
}
void func_808BD7D4(EnDekunuts* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -253,7 +253,7 @@ void func_808BD7D4(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BD870(EnDekunuts* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600326C, -3.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600326C, -3.0f);
if (this->actionFunc == func_808BDA4C) {
this->unk_190 = 4098;
} else {
@@ -263,8 +263,8 @@ void func_808BD870(EnDekunuts* this) {
}
void func_808BD8D8(EnDekunuts* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -292,7 +292,7 @@ void func_808BD8D8(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BDA08(EnDekunuts* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000168);
+ Animation_PlayOnce(&this->skelAnime, &D_06000168);
this->unk_190 = this->unk_194;
this->actionFunc = func_808BDA4C;
}
@@ -307,24 +307,24 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
if (this->actor.params == ENDEKUNUTS_GET_FF00_2) {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
sp58.x = player->actor.world.pos.x;
sp58.z = player->actor.world.pos.z;
sp58.y = player->actor.world.pos.y + 40.0f;
pitch = Actor_PitchToPoint(&this->actor, &sp58);
pitch = CLAMP(pitch, -0x3800, -0x2000);
- if (this->skelAnime.animCurrentFrame < 7.0f) {
+ if (this->skelAnime.curFrame < 7.0f) {
Math_ScaledStepToS(&this->actor.world.rot.x, pitch, 0x800);
} else {
Math_ScaledStepToS(&this->actor.world.rot.x, 0, 0x800);
}
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->actor.world.rot.x = 0;
func_808BD870(this);
- } else if (func_801378B8(&this->skelAnime, 7.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 7.0f)) {
val = Math_CosS(this->actor.world.rot.x) * 15.0f;
pos.x = (Math_SinS(this->actor.shape.rot.y) * val) + this->actor.world.pos.x;
pos.y = (this->actor.world.pos.y + 12.0f) - (Math_SinS(this->actor.world.rot.x) * 15.0f);
@@ -335,8 +335,8 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) {
this->actor.world.rot.x, this->actor.shape.rot.y, 0, params) != NULL) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW);
}
- } else if ((this->unk_190 >= 2) && func_801378B8(&this->skelAnime, 12.0f)) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000168, -3.0f);
+ } else if ((this->unk_190 >= 2) && Animation_OnFrame(&this->skelAnime, 12.0f)) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000168, -3.0f);
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -344,14 +344,14 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BDC9C(EnDekunuts* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002A5C, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06002A5C, -5.0f);
this->unk_190 = 0;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN);
this->actionFunc = func_808BDD54;
}
void func_808BDCF0(EnDekunuts* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002A5C, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06002A5C, -5.0f);
this->collider.base.acFlags &= ~AC_ON;
this->unk_190 = 80;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN);
@@ -359,7 +359,7 @@ void func_808BDCF0(EnDekunuts* this) {
}
void func_808BDD54(EnDekunuts* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -368,10 +368,10 @@ void func_808BDD54(EnDekunuts* this, GlobalContext* globalCtx) {
func_808BD428(this);
}
} else {
- this->collider.dim.height = (s32)((3.0f - CLAMP(this->skelAnime.animCurrentFrame, 1.0f, 3.0f)) * 12.0f) + 5;
+ this->collider.dim.height = (s32)((3.0f - CLAMP(this->skelAnime.curFrame, 1.0f, 3.0f)) * 12.0f) + 5;
}
- if (func_801378B8(&this->skelAnime, 4.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
this->collider.base.acFlags &= ~AC_ON;
}
Math_ApproachF(&this->actor.world.pos.x, this->actor.home.pos.x, 0.5f, 3.0f);
@@ -379,7 +379,7 @@ void func_808BDD54(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BDE7C(EnDekunuts* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002DD4, -3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06002DD4, -3.0f);
this->collider.dim.height = 37;
this->actor.colChkInfo.mass = 50;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE);
@@ -390,7 +390,7 @@ void func_808BDE7C(EnDekunuts* this) {
}
void func_808BDEF8(EnDekunuts* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer);
this->unk_18D = 3;
func_808BDF60(this);
@@ -399,7 +399,7 @@ void func_808BDEF8(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BDF60(EnDekunuts* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06003780);
+ Animation_PlayLoop(&this->skelAnime, &D_06003780);
this->unk_190 = 2;
this->unk_18C = 0;
this->collider.base.acFlags |= AC_ON;
@@ -410,8 +410,8 @@ void func_808BDFB8(EnDekunuts* this, GlobalContext* globalCtx) {
s16 yaw;
s16 yaw2;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -456,7 +456,7 @@ void func_808BDFB8(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BE1CC(EnDekunuts* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060033E4);
+ Animation_PlayLoop(&this->skelAnime, &D_060033E4);
this->unk_190 = 3;
this->actor.speedXZ = 0.0f;
if (this->unk_18D != 0) {
@@ -466,8 +466,8 @@ void func_808BE1CC(EnDekunuts* this) {
}
void func_808BE22C(EnDekunuts* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
if (this->unk_190 != 0) {
this->unk_190--;
}
@@ -479,7 +479,7 @@ void func_808BE22C(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BE294(EnDekunuts* this, s32 arg1) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0600259C, -3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0600259C, -3.0f);
if (this->actor.params == ENDEKUNUTS_GET_FF00_0) {
this->actor.speedXZ = 10.0f;
if (arg1 != 0) {
@@ -492,12 +492,12 @@ void func_808BE294(EnDekunuts* this, s32 arg1) {
this->actionFunc = func_808BE358;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_CUTBODY);
- func_800BCB70(&this->actor, 0x4000, 255, 0, SkelAnime_GetFrameCount(&D_0600259C.common));
+ func_800BCB70(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&D_0600259C));
}
void func_808BE358(EnDekunuts* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_808BE484(this);
}
}
@@ -531,7 +531,7 @@ void func_808BE3FC(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BE484(EnDekunuts* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06002BD4);
+ Animation_PlayOnce(&this->skelAnime, &D_06002BD4);
this->actionFunc = func_808BE4D4;
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DEAD);
@@ -543,7 +543,7 @@ void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx) {
s32 pad;
Vec3f sp40;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
sp40.x = this->actor.world.pos.x;
sp40.y = this->actor.world.pos.y + 18.0f;
sp40.z = this->actor.world.pos.z;
@@ -560,12 +560,12 @@ void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx) {
}
void func_808BE680(EnDekunuts* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600326C, -3.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600326C, -3.0f);
this->actionFunc = func_808BE6C4;
}
void func_808BE6C4(EnDekunuts* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
}
@@ -678,7 +678,7 @@ s32 func_808BEBD0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
if (this->actionFunc == func_808BDA4C) {
if (limbIndex == 5) {
- currentFrame = this->skelAnime.animCurrentFrame;
+ currentFrame = this->skelAnime.curFrame;
if (currentFrame <= 6.0f) {
arg2 = 1.0f - (currentFrame * 0.0833f);
arg1 = (currentFrame * 0.1167f) + 1.0f;
@@ -719,30 +719,30 @@ void func_808BED30(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (value != -1) {
if (value < 3) {
- SysMatrix_GetStateTranslationAndScaledX(1000.0f, &this->unk_21C[value]);
+ Matrix_GetStateTranslationAndScaledX(1000.0f, &this->unk_21C[value]);
} else {
- SysMatrix_GetStateTranslation(&this->unk_21C[value]);
+ Matrix_GetStateTranslation(&this->unk_21C[value]);
ptr1 = &D_808BEFA4[0];
ptr2 = &this->unk_21C[value + 1];
for (i = value + 1; i < ARRAY_COUNT(this->unk_21C); i++) {
- SysMatrix_MultiplyVector3fByState(ptr1, ptr2);
+ Matrix_MultiplyVector3fByState(ptr1, ptr2);
ptr1++, ptr2++;
}
}
}
if (limbIndex == 2) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
}
void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDekunuts* this = THIS;
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, func_808BEBD0, func_808BED30,
- &this->actor);
- SysMatrix_SetStateRotationAndTranslation(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z,
- &this->actor.home.rot);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_808BEBD0, func_808BED30,
+ &this->actor);
+ Matrix_SetStateRotationAndTranslation(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z,
+ &this->actor.home.rot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->actor.colorFilterTimer != 0) {
func_800AE5A0(globalCtx);
diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c
index a134bc874..c0c17367d 100644
--- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c
+++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c
@@ -157,17 +157,17 @@ void func_80989140(SkelAnime* skelAnime, ActorAnimationEntryS arg1[], s32 arg2)
arg1 += arg2;
if (arg1->frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&arg1->animationSeg->common);
+ frameCount = Animation_GetLastFrame(arg1->animationSeg);
} else {
frameCount = arg1->frameCount;
}
- SkelAnime_ChangeAnim(skelAnime, arg1->animationSeg, arg1->playbackSpeed + (BREG(88) * 0.1f), arg1->frame,
- frameCount, arg1->mode, arg1->transitionRate);
+ Animation_Change(skelAnime, arg1->animationSeg, arg1->playbackSpeed + (BREG(88) * 0.1f), arg1->frame, frameCount,
+ arg1->mode, arg1->transitionRate);
}
void func_80989204(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->collider.dim.pos.x = this->actor.world.pos.x;
this->collider.dim.pos.y = this->actor.world.pos.y;
@@ -294,7 +294,7 @@ void func_80989674(EnDg* this, GlobalContext* globalCtx) {
}
void func_80989864(EnDg* this, GlobalContext* globalCtx) {
- s16 frame = this->skelAnime.animCurrentFrame;
+ s16 frame = this->skelAnime.curFrame;
s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3;
Vec3f sp38;
@@ -307,31 +307,31 @@ void func_80989864(EnDg* this, GlobalContext* globalCtx) {
}
void func_80989974(EnDg* this) {
- if (func_801378B8(&this->skelAnime, 1.0f) || func_801378B8(&this->skelAnime, 7.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_MONKEY_WALK);
}
}
void func_809899C8(EnDg* this, f32 arg1) {
- if (func_801378B8(&this->skelAnime, arg1)) {
+ if (Animation_OnFrame(&this->skelAnime, arg1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_BARK);
}
}
void func_80989A08(EnDg* this, f32 arg1) {
- if (func_801378B8(&this->skelAnime, arg1)) {
+ if (Animation_OnFrame(&this->skelAnime, arg1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK);
}
}
void func_80989A48(EnDg* this) {
- if (func_801378B8(&this->skelAnime, 23.0f) || func_801378B8(&this->skelAnime, 28.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 23.0f) || Animation_OnFrame(&this->skelAnime, 28.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_WHINE);
}
}
void func_80989A9C(EnDg* this, f32 arg1) {
- if (func_801378B8(&this->skelAnime, arg1)) {
+ if (Animation_OnFrame(&this->skelAnime, arg1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_GROAN);
}
}
@@ -455,7 +455,7 @@ s32 func_80989FC8(GlobalContext* globalCtx) {
}
void func_8098A064(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (player->stateFlags3 & 0x20000000) {
if (D_8098C2A4.unk_00 == 99) {
@@ -483,7 +483,7 @@ void func_8098A064(EnDg* this, GlobalContext* globalCtx) {
}
s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
switch (player->transformation) {
case PLAYER_FORM_GORON:
@@ -503,7 +503,7 @@ s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098A234(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(this->actor.bgCheckFlags & 0x20)) {
switch (player->transformation) {
@@ -562,7 +562,7 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098A468(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actor.velocity.y = 0.0f;
this->actor.gravity = -3.0f;
@@ -586,7 +586,7 @@ void func_8098A468(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098A55C(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (player->transformation == PLAYER_FORM_HUMAN) {
func_80989E18(this, globalCtx);
@@ -627,7 +627,7 @@ void func_8098A618(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098A70C(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 phi_a1;
if (this->actor.xzDistToPlayer < 250.0f) {
@@ -657,9 +657,9 @@ void func_8098A70C(EnDg* this, GlobalContext* globalCtx) {
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
func_80989974(this);
- if (func_801378B8(&this->skelAnime, 3.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_CRY);
- } else if (func_801378B8(&this->skelAnime, 6.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_MONKEY_WALK);
}
}
@@ -678,7 +678,7 @@ void func_8098A89C(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098A938(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actor.velocity.y = 0.0f;
this->actor.gravity = -3.0f;
@@ -689,7 +689,7 @@ void func_8098A938(EnDg* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->actor.xzDistToPlayer < 70.0f) {
Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 1.0f);
- if (func_801378B8(&this->skelAnime, 7.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 7.0f)) {
s16 y = ABS_ALT(player->actor.shape.rot.y - this->actor.shape.rot.y);
this->unk_28E = 20;
@@ -726,7 +726,7 @@ void func_8098AAAC(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098AB48(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(this->actor.bgCheckFlags & 1)) {
this->actionFunc = func_8098AF98;
@@ -751,7 +751,7 @@ void func_8098AB48(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098AC34(EnDg* this, GlobalContext* globalCtx) {
- s16 sp26 = this->skelAnime.animCurrentFrame;
+ s16 sp26 = this->skelAnime.curFrame;
if ((this->actor.xyzDistToPlayerSq < 800.0f) && (this->collider.base.atFlags & AT_BOUNCED)) {
this->unk_28E = 60;
@@ -772,13 +772,13 @@ void func_8098AC34(EnDg* this, GlobalContext* globalCtx) {
}
if (sp26 < 9) {
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
sAnimations[14].playbackSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f;
}
func_80989864(this, globalCtx);
} else {
this->unk_280 |= 2;
- if (func_801378B8(&this->skelAnime, 9.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
f32 rand = randPlusMinusPoint5Scaled(1.5f);
sAnimations[14].playbackSpeed = 1.2f;
@@ -834,7 +834,7 @@ void func_8098AF98(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098B004(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actor.velocity.y = 0.0f;
this->actor.gravity = -3.0f;
@@ -1070,7 +1070,7 @@ void func_8098BA64(EnDg* this, GlobalContext* globalCtx) {
}
void func_8098BB10(EnDg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->actor.bgCheckFlags & 1) {
if (this->unk_280 & 0x10) {
@@ -1116,7 +1116,7 @@ void EnDg_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060080F0, NULL, this->jointTable, this->morphTable, 13);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060080F0, NULL, this->jointTable, this->morphTable, 13);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
@@ -1147,7 +1147,7 @@ void EnDg_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnDg_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDg* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
Vec3f sp28 = { 0.0f, 0.0f, 0.0f };
@@ -1170,7 +1170,7 @@ void EnDg_Update(Actor* thisx, GlobalContext* globalCtx) {
func_8098933C(this, &sp28);
Math_ApproachF(&this->unk_294.x, sp28.x, 0.2f, 0.1f);
Math_ApproachF(&this->unk_294.z, sp28.z, 0.2f, 0.1f);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
}
@@ -1185,9 +1185,9 @@ void func_8098BFD4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (limbIndex == 5) {
if (this->actionFunc == func_8098BBEC) {
sp20.x = 5000.0f;
- SysMatrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
} else if (this->actionFunc != func_8098BC54) {
- SysMatrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp20, &this->actor.focus.pos);
}
}
}
@@ -1225,13 +1225,13 @@ void EnDg_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
- SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
- SysMatrix_RotateStateAroundXAxis(this->unk_294.x);
- SysMatrix_InsertZRotation_f(this->unk_294.z, MTXMODE_APPLY);
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ Matrix_RotateStateAroundXAxis(this->unk_294.x);
+ Matrix_InsertZRotation_f(this->unk_294.z, MTXMODE_APPLY);
Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_8098BFB8, func_8098BFD4, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_8098BFB8, func_8098BFD4, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c
index add94bf4b..8670600fe 100644
--- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c
+++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c
@@ -293,7 +293,7 @@ void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) {
this->colliderJntSphElement);
Collider_InitAndSetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06009570, &D_06002E40, this->jointTable, this->morphTable, 21);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06009570, &D_06002E40, this->jointTable, this->morphTable, 21);
if (D_8089E364 == 0) {
for (i = 0; i < ARRAY_COUNT(D_8089E33C); i++) {
@@ -425,7 +425,7 @@ void func_8089AD70(EnDinofos* this) {
}
s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 temp_v1_2;
Actor* temp_v0;
@@ -480,11 +480,11 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) {
Camera* camera = Play_GetCamera(globalCtx, this->camId);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp3C;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06001CCC, 1.0f, SkelAnime_GetFrameCount(&D_06001CCC.common),
- SkelAnime_GetFrameCount(&D_06001CCC.common), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_06001CCC, 1.0f, Animation_GetLastFrame(&D_06001CCC),
+ Animation_GetLastFrame(&D_06001CCC), 2, 0.0f);
func_800BE33C(&camera->eye, &camera->at, &this->unk_29A, 1);
Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &sp3C);
this->unk_2BC.x = player->actor.world.pos.x + (0.4f * sp3C.x);
@@ -549,7 +549,7 @@ void func_8089B4A4(EnDinofos* this) {
if (this->unk_290 < 10) {
func_801A2E54(0x38);
}
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600C974);
+ Animation_PlayOnce(&this->skelAnime, &D_0600C974);
this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x;
this->unk_2BC.y = this->actor.floorHeight + 11.0f;
this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z;
@@ -567,38 +567,38 @@ void func_8089B580(EnDinofos* this, GlobalContext* globalCtx) {
Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye);
}
- if (this->skelAnime.animCurrentFrame > 35.0f) {
- if ((globalCtx->sceneNum == SCENE_MITURIN) && func_801378B8(&this->skelAnime, 38.0f)) {
+ if (this->skelAnime.curFrame > 35.0f) {
+ if ((globalCtx->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) {
globalCtx->envCtx.unk_C3 = 11;
}
Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f);
Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye);
- if (this->skelAnime.animCurrentFrame <= 55.0f) {
+ if (this->skelAnime.curFrame <= 55.0f) {
func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG);
}
}
- if ((globalCtx->sceneNum == SCENE_MITURIN) && func_801378B8(&this->skelAnime, 55.0f)) {
+ if ((globalCtx->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) {
globalCtx->envCtx.unk_C3 = 0xFF;
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_8089B6E8(this);
}
}
void func_8089B6E8(EnDinofos* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009B70, -3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009B70, -3.0f);
this->actionFunc = func_8089B72C;
}
void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, 2.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ATTACK);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_8089ABF4(this, globalCtx);
this->actor.flags &= ~0x00100000;
this->actor.cutscene = -1;
@@ -607,7 +607,7 @@ void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089B7B0(EnDinofos* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002E40, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06002E40, -4.0f);
this->unk_290 = (s32)Rand_ZeroFloat(20.0f) + 40;
this->unk_292 = 30;
this->actor.speedXZ = 0.0f;
@@ -617,7 +617,7 @@ void func_8089B7B0(EnDinofos* this) {
}
void func_8089B834(EnDinofos* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk_292 != 0) {
this->unk_292--;
} else if (func_8089A968(this)) {
@@ -635,7 +635,7 @@ void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx) {
f32 phi_f0;
if (this->actionFunc != func_8089B98C) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000580, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000580, -4.0f);
if (func_800BC5EC(globalCtx, &this->actor)) {
phi_f0 = 170.0f;
} else {
@@ -656,7 +656,7 @@ void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) {
f32 phi_f0;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (!func_8089AE00(this, globalCtx)) {
if (func_800BC5EC(globalCtx, &this->actor)) {
phi_f0 = 170.0f;
@@ -682,7 +682,7 @@ void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) {
func_8089A9B0(this, globalCtx);
}
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 6.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
}
}
@@ -690,7 +690,7 @@ void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089BAC0(EnDinofos* this) {
if (this->actionFunc != func_8089BB60) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000580, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000580, -4.0f);
this->actor.speedXZ = 0.0f;
}
if (BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y) > 0) {
@@ -704,7 +704,7 @@ void func_8089BAC0(EnDinofos* this) {
}
void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_28C, 0x400)) {
func_8089A9B0(this, globalCtx);
}
@@ -712,7 +712,7 @@ void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->actionFunc != func_8089BD28) {
s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y;
@@ -729,10 +729,10 @@ void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) {
}
if (this->actionFunc == func_8089D1E0) {
- this->skelAnime.animPlaybackSpeed = this->actor.speedXZ * 0.166666671634f;
+ this->skelAnime.playSpeed = this->actor.speedXZ * 0.166666671634f;
} else {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * 0.166666671634f, 0.0f, 0.0f, 0,
- -4.0f);
+ Animation_Change(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * 0.166666671634f, 0.0f, 0.0f, 0,
+ -4.0f);
}
this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000);
@@ -744,7 +744,7 @@ void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 phi_v0;
f32 sp2C = 0.0f;
@@ -776,9 +776,9 @@ void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) {
}
if (this->actor.speedXZ > 0.0f) {
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
} else {
- this->skelAnime.animPlaybackSpeed = -1.0f;
+ this->skelAnime.playSpeed = -1.0f;
}
this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000);
@@ -796,14 +796,14 @@ void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) {
this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2A4;
this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2A4;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk_292 != 0) {
this->unk_292--;
} else {
func_8089A9B0(this, globalCtx);
}
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 5.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
}
}
@@ -811,10 +811,10 @@ void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089C024(EnDinofos* this, s32 arg1) {
if (arg1 == 0) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001CCC, 2.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001CCC, 2.0f);
func_8089AD70(this);
} else {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001CCC, -1.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001CCC, -1.0f);
if ((arg1 == 2) || (arg1 == 3)) {
this->colliderJntSph.base.acFlags &= ~AC_ON;
func_8089AD70(this);
@@ -830,8 +830,8 @@ void func_8089C024(EnDinofos* this, s32 arg1) {
void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1000);
this->actor.world.rot.y = this->actor.shape.rot.y;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 1.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 1.0f)) {
if (this->unk_290 == 3) {
func_8089C244(this);
} else {
@@ -858,7 +858,7 @@ void func_8089C164(EnDinofos* this) {
}
void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 1) {
func_8089C398(this);
}
@@ -875,13 +875,13 @@ void func_8089C244(EnDinofos* this) {
}
void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_290++;
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1800);
- if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animCurrentSeg == &D_06001CCC)) {
+ if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animation == &D_06001CCC)) {
this->colliderQuad.base.atFlags |= AT_ON;
this->colliderJntSph.base.acFlags |= AC_ON;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060025B4, 1.0f, 7.0f, 13.0f, 2, -2.0f);
+ Animation_Change(&this->skelAnime, &D_060025B4, 1.0f, 7.0f, 13.0f, 2, -2.0f);
}
if (this->actor.bgCheckFlags & 1) {
@@ -892,9 +892,9 @@ void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx) {
void func_8089C398(EnDinofos* this) {
if (this->actionFunc != func_8089C2A8) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000AF0);
+ Animation_PlayOnce(&this->skelAnime, &D_06000AF0);
} else {
- this->skelAnime.animFrameCount = SkelAnime_GetFrameCount(&D_060025B4.common);
+ this->skelAnime.endFrame = Animation_GetLastFrame(&D_060025B4);
}
if (this->actor.speedXZ < 0.0f) {
@@ -910,7 +910,7 @@ void func_8089C398(EnDinofos* this) {
}
void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if ((this->unk_290 == 1) && (this->actor.xzDistToPlayer < 280.0f) && func_8089A968(this) &&
(Rand_ZeroOne() < 0.6f)) {
func_8089CA14(this);
@@ -921,7 +921,7 @@ void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089C4F8(EnDinofos* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060025B4);
+ Animation_PlayOnce(&this->skelAnime, &D_060025B4);
this->colliderQuad.base.atFlags &= ~AT_BOUNCED;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY);
this->unk_290 = 0;
@@ -935,24 +935,24 @@ void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx) {
this->unk_290++;
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_800A8514(Effect_GetParams(this->unk_2A0));
this->colliderQuad.base.atFlags &= ~AT_ON;
func_8089A9B0(this, globalCtx);
- } else if (func_801378B8(&this->skelAnime, 7.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 7.0f)) {
this->colliderQuad.base.atFlags |= AT_ON;
func_8089AD70(this);
- } else if (func_801378B8(&this->skelAnime, 13.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
this->colliderQuad.base.atFlags &= ~AT_ON;
- } else if (func_801378B8(&this->skelAnime, 11.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ATTACK);
- } else if (this->skelAnime.animCurrentFrame < 7.0f) {
+ } else if (this->skelAnime.curFrame < 7.0f) {
func_8089AE00(this, globalCtx);
}
}
void func_8089C690(EnDinofos* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060025B4, -1.0f, this->skelAnime.animCurrentFrame, 0.0f, 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_060025B4, -1.0f, this->skelAnime.curFrame, 0.0f, 2, 0.0f);
this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED);
if (this->actionFunc != func_8089C2A8) {
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -967,7 +967,7 @@ void func_8089C724(EnDinofos* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_8089A9B0(this, globalCtx);
}
}
@@ -1002,7 +1002,7 @@ void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089C87C(EnDinofos* this, s32 arg1) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600D21C);
+ Animation_PlayOnce(&this->skelAnime, &D_0600D21C);
func_800BE5CC(&this->actor, &this->colliderJntSph, arg1);
this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y);
this->actor.speedXZ = 10.0f;
@@ -1018,7 +1018,7 @@ void func_8089C87C(EnDinofos* this, s32 arg1) {
void func_8089C938(EnDinofos* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) {
+ if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) {
if (this->actor.colChkInfo.health == 0) {
if (this->actor.cutscene == -1) {
func_8089CFAC(this);
@@ -1035,7 +1035,7 @@ void func_8089C938(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089CA14(EnDinofos* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001040, -5.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001040, -5.0f);
this->colliderJntSph.base.acFlags |= AC_ON;
this->actor.speedXZ = 0.0f;
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -1045,9 +1045,9 @@ void func_8089CA14(EnDinofos* this) {
void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800);
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_8089CB10(this, globalCtx);
- } else if (!func_8089AE00(this, globalCtx) && func_801378B8(&this->skelAnime, 12.0f)) {
+ } else if (!func_8089AE00(this, globalCtx) && Animation_OnFrame(&this->skelAnime, 12.0f)) {
this->actor.speedXZ = 8.0f;
}
}
@@ -1056,7 +1056,7 @@ void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx) {
s32 i;
Sphere16* worldSphere;
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060013C0);
+ Animation_PlayLoop(&this->skelAnime, &D_060013C0);
this->unk_290 = 20;
this->actor.speedXZ = 0.0f;
this->colliderJntSph.base.atFlags |= AT_ON;
@@ -1087,7 +1087,7 @@ void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) {
f32 temp_f22;
s32 temp_s0;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800);
temp_f20 = Math_SinS(temp_s3);
temp_f22 = Math_CosS(temp_s3);
@@ -1128,7 +1128,7 @@ void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060017B8);
+ Animation_PlayOnce(&this->skelAnime, &D_060017B8);
this->colliderJntSph.base.atFlags &= ~AT_ON;
if (globalCtx->sceneNum == SCENE_MITURIN) {
globalCtx->envCtx.unk_C3 = 255;
@@ -1137,13 +1137,13 @@ void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx) {
}
void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_8089A9B0(this, globalCtx);
}
}
void func_8089CFAC(EnDinofos* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600ABD0);
+ Animation_PlayOnce(&this->skelAnime, &D_0600ABD0);
this->actor.flags &= ~1;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DEAD);
this->actor.speedXZ = 0.0f;
@@ -1152,7 +1152,7 @@ void func_8089CFAC(EnDinofos* this) {
}
void func_8089D018(EnDinofos* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
s32 temp_v0 = this->unk_288 - 10;
if (this->actor.category == ACTORCAT_ENEMY) {
@@ -1172,7 +1172,7 @@ void func_8089D018(EnDinofos* this, GlobalContext* globalCtx) {
}
this->actor.shape.shadowAlpha = this->unk_288;
- } else if (func_801378B8(&this->skelAnime, 26.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 26.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_DOWN);
}
}
@@ -1183,7 +1183,7 @@ void func_8089D11C(EnDinofos* this, s16 arg1) {
} else {
this->actor.speedXZ = 15.0f;
}
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * (1.0f / 7.5f), 0.0f, 0.0f, 0, -4.0f);
+ Animation_Change(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * (1.0f / 7.5f), 0.0f, 0.0f, 0, -4.0f);
this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000);
this->unk_292 = 10;
this->unk_2A4 = 0.0f;
@@ -1195,17 +1195,17 @@ void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8);
Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f);
- this->skelAnime.animPlaybackSpeed =
+ this->skelAnime.playSpeed =
(1.0f + fabsf(this->actor.speedXZ * (1.0f / 15.0f))) * ((this->actor.speedXZ >= 0.0f) ? 1.0f : -1.0f);
this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk_292 != 0) {
this->unk_292--;
} else {
func_8089A9B0(this, globalCtx);
}
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 5.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
}
}
@@ -1443,15 +1443,15 @@ void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Collider_UpdateSpheres(limbIndex, &this->colliderJntSph);
if (D_8089E3B0[limbIndex] != -1) {
- SysMatrix_GetStateTranslation(&this->unk_2D4[D_8089E3B0[limbIndex]]);
+ Matrix_GetStateTranslation(&this->unk_2D4[D_8089E3B0[limbIndex]]);
}
if ((limbIndex == 14) && (this->unk_292 != this->unk_290) &&
((this->actionFunc == func_8089C56C) || (this->actionFunc == func_8089C2A8))) {
Math_Vec3f_Copy(&sp74, &this->colliderQuad.dim.quad[0]);
Math_Vec3f_Copy(&sp80, &this->colliderQuad.dim.quad[1]);
- SysMatrix_MultiplyVector3fByState(&D_8089E38C, &sp68);
- SysMatrix_MultiplyVector3fByState(&D_8089E398, &sp5C);
+ Matrix_MultiplyVector3fByState(&D_8089E38C, &sp68);
+ Matrix_MultiplyVector3fByState(&D_8089E398, &sp5C);
Collider_SetQuadVertices(&this->colliderQuad, &sp5C, &sp68, &sp74, &sp80);
if (this->colliderQuad.base.atFlags & AT_ON) {
func_800A81F0(Effect_GetParams(this->unk_2A0), &sp68, &sp5C);
@@ -1460,18 +1460,18 @@ void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
if (limbIndex == 4) {
- SysMatrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[0]);
+ Matrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[0]);
} else if (limbIndex == 7) {
- SysMatrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[1]);
+ Matrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[1]);
}
if ((limbIndex == 16) && (this->actionFunc == func_8089B580)) {
- if ((this->skelAnime.animCurrentFrame > 38.0f) && (this->skelAnime.animCurrentFrame <= 55.0f) &&
+ if ((this->skelAnime.curFrame > 38.0f) && (this->skelAnime.curFrame <= 55.0f) &&
(this->unk_292 != this->unk_290)) {
- sp48 = SysMatrix_GetCurrentState();
- sp58 = 48 - (s32)this->skelAnime.animCurrentFrame;
+ sp48 = Matrix_GetCurrentState();
+ sp58 = 48 - (s32)this->skelAnime.curFrame;
sp58 = CLAMP_MIN(sp58, 0);
- SysMatrix_MultiplyVector3fByState(&D_8089E3A4, &sp4C);
+ Matrix_MultiplyVector3fByState(&D_8089E3A4, &sp4C);
sp4C.x -= sp48->mf[3][0];
sp4C.y -= sp48->mf[3][1];
sp4C.z -= sp48->mf[3][2];
@@ -1495,8 +1495,8 @@ void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx) {
Scene_SetRenderModeXlu(globalCtx, 0, 1);
POLY_OPA_DISP =
- SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_OPA_DISP);
+ SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_OPA_DISP);
} else {
func_8012C2DC(globalCtx->state.gfxCtx);
func_800B8118(&this->actor, globalCtx, 0);
@@ -1506,8 +1506,8 @@ void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx) {
Scene_SetRenderModeXlu(globalCtx, 1, 2);
POLY_XLU_DISP =
- SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP);
+ SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP);
}
func_800BE680(globalCtx, &this->actor, this->unk_2D4, 12, this->unk_2B4, this->unk_2B8, this->unk_2B0,
diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c
index 6aab7a2cd..780ce1cda 100644
--- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c
+++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c
@@ -163,17 +163,17 @@ void func_80A50510(EnDnb* this, GlobalContext* globalCtx) {
func_8012C2DC(globalCtx->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(this->particles); i++) {
- SysMatrix_StatePush();
- SysMatrix_InsertTranslation(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y,
- this->particles[i].unk_0C.z, MTXMODE_NEW);
- SysMatrix_InsertXRotation_s(this->particles[i].unk_18.x, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertTranslation(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y, this->particles[i].unk_0C.z,
+ MTXMODE_NEW);
+ Matrix_InsertXRotation_s(this->particles[i].unk_18.x, MTXMODE_APPLY);
Matrix_RotateY(this->particles[i].unk_18.y, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->particles[i].unk_18.z, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->particles[i].unk_18.z, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gfx[i]);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -188,17 +188,17 @@ void func_80A5063C(EnDnb* this, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(this->particles); i++) {
- SysMatrix_StatePush();
- SysMatrix_InsertTranslation(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y,
- this->particles[i].unk_0C.z, MTXMODE_NEW);
- SysMatrix_InsertXRotation_s(this->particles[i].unk_18.x, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertTranslation(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y, this->particles[i].unk_0C.z,
+ MTXMODE_NEW);
+ Matrix_InsertXRotation_s(this->particles[i].unk_18.x, MTXMODE_APPLY);
Matrix_RotateY(this->particles[i].unk_18.y, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->particles[i].unk_18.z, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->particles[i].unk_18.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gfx[i]);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -279,16 +279,16 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 0);
isGfxSetup = true;
}
- SysMatrix_StatePush();
+ Matrix_StatePush();
if (1) {};
arg0->unk_24 = (arg0->unk_01 / (f32)arg0->unk_02) * 255.0f;
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)arg0->unk_24);
- SysMatrix_InsertTranslation(arg0->unk_0C.x, arg0->unk_0C.y, arg0->unk_0C.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(arg0->unk_0C.x, arg0->unk_0C.y, arg0->unk_0C.z, MTXMODE_NEW);
Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -296,7 +296,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) {
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A50CBC[idx]));
gSPDisplayList(POLY_XLU_DISP++, D_06000020);
- SysMatrix_StatePop();
+ Matrix_StatePop();
sp5C += 1;
}
}
diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c
index 067f16642..59a39f65a 100644
--- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c
+++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c
@@ -148,14 +148,14 @@ s32 func_80A514F0(SkelAnime* skelAnime, s16 animIndex) {
sp30 = true;
frameCount = sAnimations[animIndex].frameCount;
if (frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&(sAnimations[animIndex].animationSeg)->common);
+ frameCount = Animation_GetLastFrame(sAnimations[animIndex].animationSeg);
}
frame = sAnimations[animIndex].frame;
if (frame < 0) {
frame = frameCount;
}
- SkelAnime_ChangeAnim(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
- frame, frameCount, sAnimations[animIndex].mode, sAnimations[animIndex].transitionRate);
+ Animation_Change(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
+ frame, frameCount, sAnimations[animIndex].mode, sAnimations[animIndex].transitionRate);
}
}
return sp30;
@@ -263,7 +263,7 @@ void EnDnk_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80A515C4(this);
Actor_SetHeight(&this->actor, 34.0f);
Collider_UpdateCylinder(&this->actor, &this->collider);
@@ -288,10 +288,10 @@ void func_80A51AA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Vec3s sp3C;
if (limbIndex == 2) {
- SysMatrix_MultiplyVector3fByState(&sp50, &sp44);
- SysMatrix_CopyCurrentState(&sp5C);
+ Matrix_MultiplyVector3fByState(&sp50, &sp44);
+ Matrix_CopyCurrentState(&sp5C);
func_8018219C(&sp5C, &sp3C, 0);
- SysMatrix_InsertTranslation(sp44.x, sp44.y, sp44.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(sp44.x, sp44.y, sp44.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->unk_28C & 0x10) {
if (this->unk_28C & 0x20) {
@@ -315,8 +315,8 @@ void func_80A51AA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
Matrix_RotateY(this->unk_292, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_290, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_294, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_290, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_294, MTXMODE_APPLY);
}
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -342,8 +342,8 @@ void func_80A51CB8(EnDnk* this, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A5245C[this->unk_2A0]));
gDPPipeSync(POLY_OPA_DISP++);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, func_80A51A78, func_80A51AA4,
- &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51A78, func_80A51AA4,
+ &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -364,10 +364,10 @@ void func_80A51DA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Vec3s sp3C;
if (limbIndex == 2) {
- SysMatrix_MultiplyVector3fByState(&sp50, &sp44);
- SysMatrix_CopyCurrentState(&sp5C);
+ Matrix_MultiplyVector3fByState(&sp50, &sp44);
+ Matrix_CopyCurrentState(&sp5C);
func_8018219C(&sp5C, &sp3C, 0);
- SysMatrix_InsertTranslation(sp44.x, sp44.y, sp44.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(sp44.x, sp44.y, sp44.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (this->unk_28C & 0x10) {
@@ -392,8 +392,8 @@ void func_80A51DA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
Matrix_RotateY(this->unk_292, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_290, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_294, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_290, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_294, MTXMODE_APPLY);
}
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -406,8 +406,8 @@ void func_80A51DA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
void func_80A51FC0(EnDnk* this, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, func_80A51D78, func_80A51DA4,
- &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51D78, func_80A51DA4,
+ &this->actor);
}
void func_80A52018(Actor* thisx, GlobalContext* globalCtx) {
diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c
index b39ac6640..ff7e3de3b 100644
--- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c
+++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c
@@ -172,7 +172,7 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) {
&this->actor.world.pos, &sp88)) {
Math_Vec3f_Diff(&this->actor.world.pos, &crace->actor.home.pos, &sp7C);
Matrix_RotateY(-crace->actor.home.rot.y, 0);
- SysMatrix_MultiplyVector3fByState(&sp7C, &sp70);
+ Matrix_MultiplyVector3fByState(&sp7C, &sp70);
if ((fabsf(sp70.x) < 100.0f) && (sp70.y >= -10.0f) && (sp70.y <= 180.0f) && (sp70.z < 0.0f)) {
crace->unk_170 |= 1;
}
@@ -213,19 +213,19 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) {
if (actor == NULL) {
Actor_ProcessInitChain(thisx, sInitChain);
ActorShape_Init(&thisx->shape, 0.0f, func_800B3FC0, 21.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600E1F8, &D_06007CA4, this->jointTable, this->morphTable,
- 28);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600E1F8, &D_06007CA4, this->jointTable,
+ this->morphTable, 28);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, 4);
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[14].animationSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&(sAnimations[14].animationSeg)->common), sAnimations[14].mode,
- sAnimations[14].transitionRate);
+ Animation_Change(&this->skelAnime, sAnimations[14].animationSeg, 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimations[14].animationSeg), sAnimations[14].mode,
+ sAnimations[14].transitionRate);
this->unk_3BE = 0x3E93;
this->unk_3C0 = 60.0f;
this->unk_3B0 = 0;
this->unk_468 = 99;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
switch (ENDNO_GET_C000(thisx)) {
case ENDNO_GET_C000_0:
@@ -309,7 +309,7 @@ void func_80A71C3C(EnDno* this, GlobalContext* globalCtx) {
case 3:
case 10:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 13, &this->unk_32C);
}
break;
@@ -319,7 +319,7 @@ void func_80A71C3C(EnDno* this, GlobalContext* globalCtx) {
break;
case 15:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 6, &this->unk_32C);
}
@@ -390,8 +390,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
case 0x80F:
if (this->unk_32C == 13) {
func_8013E1C8(&this->skelAnime, sAnimations, 4, &this->unk_32C);
- } else if ((this->unk_32C == 4) &&
- (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount)) {
+ } else if ((this->unk_32C == 4) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) {
func_8013E1C8(&this->skelAnime, sAnimations, 11, &this->unk_32C);
func_801518B0(globalCtx, this->unk_464, &this->actor);
}
@@ -404,7 +403,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.unk11F04 == 0x80B) {
switch (this->unk_32C) {
case 16:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 9, &this->unk_32C);
}
Math_ScaledStepToS(&this->actor.shape.rot.y,
@@ -412,7 +411,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
break;
case 10:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_801477B4(globalCtx);
func_8013E1C8(&this->skelAnime, sAnimations, 0xD, &this->unk_32C);
func_80A71B68(this, globalCtx);
@@ -429,7 +428,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
case 0x80B:
switch (this->unk_32C) {
case 16:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 9, &this->unk_32C);
}
break;
@@ -442,7 +441,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
break;
case 10:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_801477B4(globalCtx);
func_8013E1C8(&this->skelAnime, sAnimations, 13, &this->unk_32C);
func_80A71B68(this, globalCtx);
@@ -467,7 +466,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
if (this->unk_32C == 11) {
func_8013E1C8(&this->skelAnime, sAnimations, 3, &this->unk_32C);
} else if (this->unk_32C == 3) {
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 13, &this->unk_32C);
}
} else if ((this->unk_32C == 13) && func_80147624(globalCtx)) {
@@ -496,7 +495,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) {
break;
case 15:
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
func_8013E1C8(&this->skelAnime, sAnimations, 6, &this->unk_32C);
}
break;
@@ -564,8 +563,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) {
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) {
func_8013E1C8(&this->skelAnime, sAnimations, 5, &this->unk_32C);
}
- } else if ((this->unk_32C == 5) &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if ((this->unk_32C == 5) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (Flags_GetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor))) {
func_801518B0(globalCtx, 0x801, &this->actor);
} else if (Player_GetMask(globalCtx) == PLAYER_MASK_MASK_OF_SCENTS) {
@@ -596,18 +594,18 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) {
if (((globalCtx->msgCtx.unk11F04 == 0x800) || (globalCtx->msgCtx.unk11F04 == 0x801)) &&
(this->unk_32C == 8)) {
Math_SmoothStepToF(&this->unk_454, 1.0f, 1.0f, 0.1f, 0.01f);
- if (this->skelAnime.animCurrentFrame <= 23.0f) {
+ if (this->skelAnime.curFrame <= 23.0f) {
this->unk_452 = 3;
- if (func_801378B8(&this->skelAnime, 23.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 23.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_OPEN_AMBRELLA);
}
- } else if (this->skelAnime.animCurrentFrame <= 24.0f) {
+ } else if (this->skelAnime.curFrame <= 24.0f) {
this->unk_452 = 4;
- } else if (this->skelAnime.animCurrentFrame >= 25.0f) {
+ } else if (this->skelAnime.curFrame >= 25.0f) {
this->unk_452 = 2;
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_8013E1C8(&this->skelAnime, sAnimations, 12, &this->unk_32C);
func_801518B0(globalCtx, 0x803, &this->actor);
}
@@ -656,8 +654,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) {
this->unk_3B0 |= 0x40;
}
}
- } else if ((this->unk_32C == 5) &&
- (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount)) {
+ } else if ((this->unk_32C == 5) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) {
func_801477B4(globalCtx);
func_80A72438(this, globalCtx);
}
@@ -684,7 +681,7 @@ void func_80A72AE4(EnDno* this, GlobalContext* globalCtx) {
}
void func_80A72B3C(EnDno* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_44E = 0;
func_80A72C04(this, globalCtx);
}
@@ -785,7 +782,7 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) {
f32 temp_f10;
s32 phi_a2;
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
phi_a2 = -1;
switch (this->unk_32C) {
case 0:
@@ -850,18 +847,18 @@ void func_80A732C8(EnDno* this, GlobalContext* globalCtx) {
func_8013E1C8(&this->skelAnime, sAnimations, 7, &this->unk_32C);
}
} else if (this->unk_44E == 3) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_8013E1C8(&this->skelAnime, sAnimations, 14, &this->unk_32C);
func_80A72438(this, globalCtx);
} else {
- if (this->skelAnime.animCurrentFrame >= 20.0f) {
+ if (this->skelAnime.curFrame >= 20.0f) {
Math_SmoothStepToF(&this->unk_454, 0.0f, 1.0f, 0.125f, 0.01f);
}
- if (func_801378B8(&this->skelAnime, 4.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CLOSE_AMBRELLA);
this->unk_452 = 4;
- } else if (func_801378B8(&this->skelAnime, 5.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 5.0f)) {
this->unk_452 = 3;
}
}
@@ -899,7 +896,7 @@ void func_80A73408(EnDno* this, GlobalContext* globalCtx) {
func_800EDF24(&this->actor, globalCtx, temp_v0);
}
- if ((func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) && (this->unk_32C == 17)) {
+ if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->unk_32C == 17)) {
if (0) {};
func_8013E1C8(&this->skelAnime, sAnimations, 18, &this->unk_32C);
}
@@ -909,7 +906,7 @@ void EnDno_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDno* this = THIS;
s32 pad;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80A73408(this, globalCtx);
this->actionFunc(this, globalCtx);
if (this->unk_3B0 & 4) {
@@ -923,8 +920,8 @@ void EnDno_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnDno_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDno* this = THIS;
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnDno_OverrideLimbDraw, EnDno_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnDno_OverrideLimbDraw, EnDno_PostLimbDraw, &this->actor);
}
s32 EnDno_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
@@ -987,8 +984,8 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
func_8012C28C(globalCtx->state.gfxCtx);
if (limbIndex == 13) {
- Matrix_Scale(this->unk_454, this->unk_454, this->unk_454, 1);
- SysMatrix_InsertXRotation_s(this->unk_45C, 1);
+ Matrix_Scale(this->unk_454, this->unk_454, this->unk_454, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_45C, 1);
}
gfxOpa = POLY_OPA_DISP;
@@ -1004,13 +1001,13 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_StatePush();
+ Matrix_StatePush();
frames = globalCtx->gameplayFrames;
- SysMatrix_MultiplyVector3fByState(&D_80A73B40, &sp84);
+ Matrix_MultiplyVector3fByState(&D_80A73B40, &sp84);
func_80A711D0(this, globalCtx, &sp84);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
- Matrix_Scale(0.15f, 0.15f, 1.0f, 1);
- SysMatrix_InsertTranslation(0.0f, -3200.0f, 0.0f, 1);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_Scale(0.15f, 0.15f, 1.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, -3200.0f, 0.0f, MTXMODE_APPLY);
gfxXlu = func_8012C2B4(POLY_XLU_DISP);
gSPMatrix(gfxXlu, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1022,7 +1019,7 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
POLY_XLU_DISP = gfxXlu + 5;
- SysMatrix_StatePop();
+ Matrix_StatePop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c
index 30b40c499..7477bbcc5 100644
--- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c
+++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c
@@ -102,38 +102,38 @@ static s32 D_80B3DE58[] = {
s32 func_80B3CA20(EnDnp* this) {
if ((this->unk_340 == 2) || (this->unk_340 == 9)) {
- if (func_801378B8(&this->skelAnime, 1.0f) || func_801378B8(&this->skelAnime, 5.0f) ||
- func_801378B8(&this->skelAnime, 9.0f) || func_801378B8(&this->skelAnime, 13.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
+ Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_TURN);
}
} else if ((this->unk_340 == 24) || (this->unk_340 == 7)) {
- if (func_801378B8(&this->skelAnime, 1.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 1.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_TURN);
}
} else if (this->unk_340 == 14) {
- if (func_801378B8(&this->skelAnime, 7.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 7.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_GREET);
}
- if (func_801378B8(&this->skelAnime, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 22.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_GREET2);
}
} else if (this->unk_340 == 8) {
- if (func_801378B8(&this->skelAnime, 9.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_GREET);
}
- if (func_801378B8(&this->skelAnime, 18.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 18.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_GREET2);
}
} else if ((this->unk_340 == 17) && (this->unk_340 == 18)) {
- if (func_801378B8(&this->skelAnime, 7.0f) || func_801378B8(&this->skelAnime, 15.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_WALK);
}
} else if (this->unk_340 == 21) {
- if (func_801378B8(&this->skelAnime, 17.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 17.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_WALK);
}
} else if (this->unk_340 == 23) {
- if (func_801378B8(&this->skelAnime, 3.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEKUHIME_WALK);
}
}
@@ -172,7 +172,7 @@ void func_80B3CD1C(EnDnp* this) {
}
s32 func_80B3CDA4(EnDnp* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_s0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
Vec3f sp3C;
Vec3f sp30;
@@ -289,7 +289,7 @@ void func_80B3D11C(EnDnp* this, GlobalContext* globalCtx) {
this->unk_324 = val;
if (((this->unk_340 == 10) || (this->unk_340 == 12) || (this->unk_340 == 5) || (this->unk_340 == 19) ||
(this->unk_340 == 22) || (this->unk_340 == 24)) &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80B3CC38(this, this->unk_340 + 1);
}
func_800EDF24(&this->actor, globalCtx, temp_v0);
@@ -305,7 +305,7 @@ void func_80B3D2D4(EnDnp* this, GlobalContext* globalCtx) {
}
void func_80B3D338(EnDnp* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk_32E != 0) && (func_80152498(&globalCtx->msgCtx) == 2)) {
Actor_MarkForDeath(&this->actor);
@@ -358,7 +358,7 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDnp* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 16.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06010D60, NULL, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06010D60, NULL, this->jointTable, this->morphTable, 26);
this->unk_340 = -1;
func_80B3CC38(this, 15);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -405,12 +405,12 @@ void EnDnp_Update(Actor* thisx, GlobalContext* globalCtx) {
if (!func_80B3CF60(this, globalCtx) && func_80B3D044(this, globalCtx)) {
func_80B3D11C(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B3CD1C(this);
func_80B3CEC0(this, globalCtx);
} else {
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B3CD1C(this);
func_80B3CEC0(this, globalCtx);
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
@@ -435,8 +435,8 @@ s32 func_80B3D974(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar
Vec3s sp6C;
MtxF sp2C;
- SysMatrix_MultiplyVector3fByState(&D_801D15B0, &sp74);
- SysMatrix_CopyCurrentState(&sp2C);
+ Matrix_MultiplyVector3fByState(&D_801D15B0, &sp74);
+ Matrix_CopyCurrentState(&sp2C);
func_8018219C(&sp2C, &sp6C, 0);
*arg2 = sp74;
if (arg4 == 0) {
@@ -478,13 +478,13 @@ void func_80B3DAA0(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
if (limbIndex == 12) {
func_80B3D974(this->unk_330 + 0x4000, this->unk_332 + this->actor.shape.rot.y + 0x4000, &this->unk_1D8,
&this->unk_1E4, phi_v1, phi_v0);
- SysMatrix_StatePop();
- SysMatrix_InsertTranslation(this->unk_1D8.x, this->unk_1D8.y, this->unk_1D8.z, MTXMODE_NEW);
+ Matrix_StatePop();
+ Matrix_InsertTranslation(this->unk_1D8.x, this->unk_1D8.y, this->unk_1D8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateY(this->unk_1E4.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_1E4.x, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_1E4.z, MTXMODE_APPLY);
- SysMatrix_StatePush();
+ Matrix_InsertXRotation_s(this->unk_1E4.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_1E4.z, MTXMODE_APPLY);
+ Matrix_StatePush();
}
}
@@ -504,8 +504,8 @@ void EnDnp_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3DEAC[this->unk_336]));
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- NULL, func_80B3DA88, func_80B3DAA0, &this->actor);
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
+ func_80B3DA88, func_80B3DAA0, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
index ac92ed454..e392e6d60 100644
--- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
+++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
@@ -148,7 +148,7 @@ s32 func_80A526F8(EnDnq* this) {
this->unk_38C = ((s32)(Rand_ZeroOne() * 100.0f) % 4) + 3;
this->unk_388 = 0;
this->unk_386 = 1;
- } else if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
switch (this->unk_398) {
case 8:
if (DECR(this->unk_38C) == 0) {
@@ -186,7 +186,7 @@ s32 func_80A526F8(EnDnq* this) {
}
if (this->unk_386 != 0) {
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
}
}
@@ -204,7 +204,7 @@ s32 func_80A52944(EnDnq* this) {
this->unk_386 = 1;
phi_v1 = this->unk_38C * 0x2000;
this->actor.shape.rot.y += phi_v1;
- } else if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_386++;
if (this->unk_386 >= 6) {
func_80A5257C(this, 12);
@@ -212,11 +212,11 @@ s32 func_80A52944(EnDnq* this) {
phi_v1 = this->unk_38C * 0x2000;
} else if (this->unk_386 <= 3) {
this->unk_38C = -this->unk_38C;
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
phi_v1 = this->unk_38C * 0x2000;
} else {
func_80A5257C(this, 13);
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
}
this->actor.shape.rot.y = this->actor.world.rot.y;
this->actor.shape.rot.y += phi_v1;
@@ -242,14 +242,14 @@ s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) {
this->unk_38C--;
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (this->unk_38C == 0) {
this->unk_38C = Rand_S16Offset(20, 20);
this->unk_388 += 3;
this->unk_388 %= 5;
}
func_80A5257C(this, D_80A535DC[this->unk_388]);
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
}
this->unk_386 = 0;
@@ -257,7 +257,7 @@ s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) {
}
s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u16 temp = globalCtx->msgCtx.unk11F04;
if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->actor)) {
@@ -297,7 +297,7 @@ s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) {
}
void func_80A52C6C(EnDnq* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
Vec3f sp34 = { 0.0f, 0.0f, 110.0f };
Vec3f sp28;
@@ -335,7 +335,7 @@ s32 func_80A52D44(EnDnq* this, GlobalContext* globalCtx) {
}
void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
if (yaw <= 0x3800) {
@@ -403,12 +403,12 @@ void func_80A53038(EnDnq* this, GlobalContext* globalCtx) {
this->unk_1DC = temp_v1;
}
- if ((this->unk_398 == 4) && func_801378B8(&this->skelAnime, 2.0f)) {
+ if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KINGNUTS_DAMAGE);
}
if (((this->unk_398 == 3) || (this->unk_398 == 6)) &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80A5257C(this, this->unk_398 + 1);
}
@@ -420,7 +420,7 @@ void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDnq* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 14.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600EB48, NULL, this->jointTable, this->morphTable, 33);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600EB48, NULL, this->jointTable, this->morphTable, 33);
this->unk_398 = -1;
func_80A5257C(this, 0);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -450,11 +450,11 @@ void EnDnq_Update(Actor* thisx, GlobalContext* globalCtx) {
if (!func_80A52D44(this, globalCtx) && func_80A52648(this, globalCtx)) {
func_80A53038(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
} else {
this->actionFunc(this, globalCtx);
func_80A52B68(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
this->unk_394 = this->actor.xzDistToPlayer;
func_80A52C6C(this, globalCtx);
@@ -470,6 +470,6 @@ void EnDnq_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDnq* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, NULL, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
index 1249e2430..373e69880 100644
--- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c
+++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
@@ -84,7 +84,7 @@ void func_8092C5C0(EnDns* this) {
s32 pad;
if (((this->unk_2F8 == 2) || (this->unk_2F8 == 3) || (this->unk_2F8 == 6) || (this->unk_2F8 == 7)) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 3.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 3.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
}
@@ -128,7 +128,7 @@ void func_8092C6FC(EnDns* this, GlobalContext* globalCtx) {
}
void func_8092C740(EnDns* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
Vec3f sp34;
Vec3f sp28;
@@ -171,7 +171,7 @@ void func_8092C934(EnDns* this) {
}
s32* func_8092C9BC(EnDns* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(gSaveContext.weekEventReg[23] & 0x20)) {
if (player->transformation != PLAYER_FORM_DEKU) {
@@ -226,7 +226,7 @@ s32 func_8092CAD0(EnDns* this, GlobalContext* globalCtx) {
if (ENDNS_GET_4000(&this->actor)) {
this->unk_2F0 = 0.0f;
if (this->unk_2D2 != 0) {
- this->unk_2F0 = this->skelAnime.animCurrentFrame;
+ this->unk_2F0 = this->skelAnime.curFrame;
func_8092C63C(this, 2);
}
this->unk_2DA = this->actor.world.rot.y;
@@ -260,7 +260,7 @@ s32 func_8092CB98(EnDns* this, GlobalContext* globalCtx) {
}
s32 func_8092CC68(GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad[2];
s32 ret = false;
s16 bgId;
@@ -276,7 +276,7 @@ s32 func_8092CC68(GlobalContext* globalCtx) {
}
s32 func_8092CCEC(EnDns* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
Vec3f sp3C = player->actor.world.pos;
Vec3f sp30 = this->actor.world.pos;
@@ -303,10 +303,10 @@ s32 func_8092CE38(EnDns* this) {
Vec3f sp2C;
s32 ret = false;
- if ((this->unk_2C6 & 0x200) || func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if ((this->unk_2C6 & 0x200) || Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_8092C63C(this, D_8092DE00[this->unk_2D2]);
this->unk_2C6 &= ~0x200;
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
if (this->unk_2D2 == 2) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_JUMP);
}
@@ -317,25 +317,25 @@ s32 func_8092CE38(EnDns* this) {
ret = true;
} else {
if (this->unk_2D2 == 0) {
- if (func_801378B8(&this->skelAnime, 13.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y);
this->unk_2E4 = 0.0f;
this->actor.shape.rot.y = this->actor.world.rot.y;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_JUMP);
- } else if (this->skelAnime.animCurrentFrame < 13.0f) {
- frame = this->skelAnime.animCurrentFrame;
+ } else if (this->skelAnime.curFrame < 13.0f) {
+ frame = this->skelAnime.curFrame;
this->actor.shape.rot.y = this->actor.world.rot.y;
frame *= 2520;
this->actor.shape.rot.y += frame;
this->unk_2E4 -= -(40.0f / 13.0f);
}
} else {
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 6.0f) ||
- func_801378B8(&this->skelAnime, 13.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) ||
+ Animation_OnFrame(&this->skelAnime, 13.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
- if (this->skelAnime.animCurrentFrame > 7.0f) {
+ if (this->skelAnime.curFrame > 7.0f) {
this->unk_2E4 += -(20.0f / 13.0f);
}
}
@@ -371,8 +371,8 @@ void func_8092D108(EnDns* this, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
- SysMatrix_SetStateRotationAndTranslation(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z,
- &this->actor.home.rot);
+ Matrix_SetStateRotationAndTranslation(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z,
+ &this->actor.home.rot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -382,7 +382,7 @@ void func_8092D108(EnDns* this, GlobalContext* globalCtx) {
}
void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 sp22 = this->actor.world.rot.y;
if (ENDNS_GET_4000(&this->actor)) {
@@ -450,7 +450,7 @@ void func_8092D4D8(EnDns* this, GlobalContext* globalCtx) {
this->unk_2F4 = NULL;
if (ENDNS_GET_4000(&this->actor)) {
if (!(gSaveContext.eventInf[1] & 0x20)) {
- this->skelAnime.animCurrentFrame = this->unk_2F0;
+ this->skelAnime.curFrame = this->unk_2F0;
this->actor.world.rot.y = this->unk_2DA;
func_8092C63C(this, 8);
}
@@ -478,7 +478,7 @@ void func_8092D5E8(EnDns* this, GlobalContext* globalCtx) {
}
if (((this->unk_2F8 == 4) || (this->unk_2F8 == 6)) &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_8092C63C(this, this->unk_2F8 + 1);
}
@@ -529,11 +529,11 @@ void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) {
if (!func_8092CAD0(this, globalCtx) && func_8092CB98(this, globalCtx)) {
func_8092D5E8(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_8092C5C0(this);
} else {
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_8092C934(this);
func_8092C86C(this, globalCtx);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
@@ -549,8 +549,8 @@ s32 func_8092D954(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar
Vec3s sp6C;
MtxF sp2C;
- SysMatrix_MultiplyVector3fByState(&D_801D15B0, &sp74);
- SysMatrix_CopyCurrentState(&sp2C);
+ Matrix_MultiplyVector3fByState(&D_801D15B0, &sp74);
+ Matrix_CopyCurrentState(&sp2C);
func_8018219C(&sp2C, &sp6C, 0);
*arg2 = sp74;
@@ -600,11 +600,11 @@ void EnDns_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
if (limbIndex == 2) {
func_8092D954(this->unk_2CC, this->unk_2CE + this->actor.shape.rot.y, &this->unk_218, &this->unk_224, phi_v1,
phi_v0);
- SysMatrix_InsertTranslation(this->unk_218.x, this->unk_218.y, this->unk_218.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(this->unk_218.x, this->unk_218.y, this->unk_218.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateY(this->unk_224.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_224.z, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_224.x, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_224.z, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_224.x, MTXMODE_APPLY);
}
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -626,8 +626,8 @@ void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_8092DE1C[this->unk_2E0]));
gDPPipeSync(POLY_OPA_DISP++);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnDns_OverrideLimbDraw,
- EnDns_PostLimbDraw, &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDns_OverrideLimbDraw,
+ EnDns_PostLimbDraw, &this->actor);
func_8092D108(this, globalCtx);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c
index a411f81ab..62cfddd0f 100644
--- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c
+++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c
@@ -389,7 +389,7 @@ void func_80876930(EnDodongo* this, GlobalContext* globalCtx, Vec3f* arg2) {
}
void func_80876B08(EnDodongo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (ABS_ALT(yDiff) < 0x4000) {
@@ -513,15 +513,15 @@ void func_80876DC4(EnDodongo* this, GlobalContext* globalCtx) {
}
s32 func_8087721C(EnDodongo* this) {
- if ((this->actionFunc == func_8087784C) && (this->skelAnime.animCurrentFrame >= 29.0f) &&
- (this->skelAnime.animCurrentFrame <= 43.0f)) {
+ if ((this->actionFunc == func_8087784C) && (this->skelAnime.curFrame >= 29.0f) &&
+ (this->skelAnime.curFrame <= 43.0f)) {
return true;
}
return false;
}
s32 func_80877278(EnDodongo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor* explosive = globalCtx->actorCtx.actorList[ACTORCAT_EXPLOSIVES].first;
Vec3f sp44;
@@ -544,45 +544,45 @@ s32 func_80877278(EnDodongo* this, GlobalContext* globalCtx) {
}
void func_808773C4(EnDodongo* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06004C20, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06004C20, -4.0f);
this->actor.speedXZ = 0.0f;
this->timer = Rand_S16Offset(30, 50);
this->actionFunc = func_80877424;
}
void func_80877424(EnDodongo* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer != 0) {
this->timer--;
}
if (this->timer == 0) {
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
func_80877494(this);
}
}
}
void func_80877494(EnDodongo* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06008B1C, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06008B1C, -4.0f);
this->actor.speedXZ = this->unk_334 * 1.5f;
this->timer = Rand_S16Offset(50, 70);
this->actionFunc = func_80877500;
}
void func_80877500(EnDodongo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
s16 temp_v1;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 19.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 19.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK);
sp30.x = this->collider1Elements[2].dim.worldSphere.center.x;
sp30.y = this->collider1Elements[2].dim.worldSphere.center.y;
sp30.z = this->collider1Elements[2].dim.worldSphere.center.z;
func_80876930(this, globalCtx, &sp30);
- } else if (func_801378B8(&this->skelAnime, 39.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 39.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_WALK);
sp30.x = this->collider1Elements[1].dim.worldSphere.center.x;
sp30.y = this->collider1Elements[1].dim.worldSphere.center.y;
@@ -623,7 +623,7 @@ void func_808777A8(EnDodongo* this) {
s32 i;
Sphere16* sph;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060028F0, -4.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060028F0, -4.0f);
this->actor.speedXZ = 0.0f;
for (i = 0; i < ARRAY_COUNT(this->collider3Elements); i++) {
@@ -648,13 +648,13 @@ void func_8087784C(EnDodongo* this, GlobalContext* globalCtx) {
f32 temp_f2;
f32 temp_f12;
- if (func_801378B8(&this->skelAnime, 24.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_CRY);
}
if (func_8087721C(this)) {
func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG);
- frame = this->skelAnime.animCurrentFrame - 29.0f;
+ frame = this->skelAnime.curFrame - 29.0f;
end = frame >> 1;
if (end > 3) {
end = 3;
@@ -678,29 +678,29 @@ void func_8087784C(EnDodongo* this, GlobalContext* globalCtx) {
D_80879348.z = 2.5f * temp_f12;
EffectSsDFire_Spawn(globalCtx, &this->unk_348[0], &D_80879354, &D_80879348, this->unk_334 * 100.0f,
this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8);
- } else if ((this->skelAnime.animCurrentFrame >= 2.0f) && (this->skelAnime.animCurrentFrame <= 20.0f)) {
+ } else if ((this->skelAnime.curFrame >= 2.0f) && (this->skelAnime.curFrame <= 20.0f)) {
func_800B9010(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_80877D50(this);
}
}
void func_80877D50(EnDodongo* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06003088);
+ Animation_PlayOnce(&this->skelAnime, &D_06003088);
this->actionFunc = func_80877D90;
}
void func_80877D90(EnDodongo* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_808773C4(this);
this->timer = Rand_S16Offset(10, 20);
}
}
void func_80877DE0(EnDodongo* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060028F0, -1.0f, 35.0f, 0.0f, 2, -4.0f);
+ Animation_Change(&this->skelAnime, &D_060028F0, -1.0f, 35.0f, 0.0f, 2, -4.0f);
this->actor.flags |= 0x10;
this->timer = 25;
this->actionFunc = func_80877E60;
@@ -735,14 +735,14 @@ void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) {
this->actor.child->freezeTimer = 30000; // 25 minutes
}
- if (func_801378B8(&this->skelAnime, 28.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 28.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_EAT);
if (this->actor.child != NULL) {
Actor_MarkForDeath(this->actor.child);
this->actor.child = NULL;
}
this->actor.flags &= ~0x10;
- } else if (this->skelAnime.animPlaybackSpeed > -0.5f) {
+ } else if (this->skelAnime.playSpeed > -0.5f) {
this->timer--;
if (this->timer == 10) {
for (i = 10; i >= 0; i--) {
@@ -768,13 +768,13 @@ void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) {
}
func_800BCB70(&this->actor, 0x4000, 0x78, 0, 8);
}
- } else if (func_801378B8(&this->skelAnime, 24.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
this->timer--;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
}
- if (this->skelAnime.animCurrentFrame <= 27.0f) {
- if ((this->skelAnime.animCurrentFrame <= 25.0f) && (this->timer < 11)) {
+ if (this->skelAnime.curFrame <= 27.0f) {
+ if ((this->skelAnime.curFrame <= 25.0f) && (this->timer < 11)) {
func_80876DC4(this, globalCtx);
} else {
sp5E = this->unk_334 * 50.0f;
@@ -793,7 +793,7 @@ void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) {
this->unk_314.z = Math_SinS((this->actor.colorFilterTimer * 0x1000) >> 1) + 1.0f;
this->unk_314.x = Math_SinS(this->actor.colorFilterTimer * 0x1000) + 1.0f;
this->unk_314.y = this->unk_314.z;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer == 0) {
if (this->actor.colChkInfo.health == 0) {
func_80878724(this);
@@ -819,7 +819,7 @@ void func_80878354(EnDodongo* this) {
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_TAIL);
- SkelAnime_ChangeAnimPlaybackStop(&this->skelAnime, sp18, 2.0f);
+ Animation_PlayOnceSetSpeed(&this->skelAnime, sp18, 2.0f);
this->timer = 0;
this->collider1.base.atFlags |= AT_ON;
this->unk_304 = -1;
@@ -827,11 +827,11 @@ void func_80878354(EnDodongo* this) {
}
void func_80878424(EnDodongo* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp20;
this->timer++;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (!(player->stateFlags1 & 0x800000) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK)) {
this->collider1.base.atFlags &= ~AT_ON;
func_808777A8(this);
@@ -878,7 +878,7 @@ void func_808785B0(EnDodongo* this, GlobalContext* globalCtx) {
}
void func_8087864C(EnDodongo* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001A44, -4.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001A44, -4.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_DAMAGE);
this->timer = 0;
this->unk_304 = 0;
@@ -892,13 +892,13 @@ void func_808786C8(EnDodongo* this, GlobalContext* globalCtx) {
func_80876DC4(this, globalCtx);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_80876B08(this, globalCtx);
}
}
void func_80878724(EnDodongo* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060013C4, -8.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060013C4, -8.0f);
this->timer = 0;
this->unk_304 = 0;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_J_DEAD);
@@ -911,7 +911,7 @@ void func_80878724(EnDodongo* this) {
void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) {
s32 pad;
- if (this->skelAnime.animCurrentFrame < 35.0f) {
+ if (this->skelAnime.curFrame < 35.0f) {
if (this->unk_304 != 0) {
func_80876DC4(this, globalCtx);
}
@@ -919,7 +919,7 @@ void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) {
func_800BCB70(&this->actor, 0x4000, 0x78, 0, 4);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->timer == 0) {
EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
@@ -928,7 +928,7 @@ void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) {
}
this->timer = 8;
}
- } else if (func_801378B8(&this->skelAnime, 52.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 52.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_DOWN);
}
@@ -1086,16 +1086,16 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
Collider_UpdateSpheres(limbIndex, &this->collider1);
Collider_UpdateSpheres(limbIndex, &this->collider2);
if (D_80879388[limbIndex] != -1) {
- SysMatrix_GetStateTranslation(&this->unk_348[D_80879388[limbIndex]]);
+ Matrix_GetStateTranslation(&this->unk_348[D_80879388[limbIndex]]);
}
if (limbIndex == 7) {
- SysMatrix_MultiplyVector3fByState(&D_80879370, &this->unk_308);
- SysMatrix_MultiplyVector3fByState(&D_8087937C, &this->unk_348[0]);
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
- SysMatrix_GetStateTranslationAndScaledY(-200.0f, &this->unk_348[1]);
+ Matrix_MultiplyVector3fByState(&D_80879370, &this->unk_308);
+ Matrix_MultiplyVector3fByState(&D_8087937C, &this->unk_348[0]);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslationAndScaledY(-200.0f, &this->unk_348[1]);
} else if (limbIndex == 13) {
- SysMatrix_GetStateTranslationAndScaledX(1600.0f, &this->unk_320);
+ Matrix_GetStateTranslationAndScaledX(1600.0f, &this->unk_320);
}
if ((limbIndex == 30) && (this->actionFunc == func_80878424) && (this->timer != this->unk_304)) {
@@ -1108,8 +1108,8 @@ void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDodongo* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnDodongo_OverrideLimbDraw,
- EnDodongo_PostLimbDraw, &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw,
+ EnDodongo_PostLimbDraw, &this->actor);
func_800BE680(globalCtx, &this->actor, this->unk_348, ARRAY_COUNT(this->unk_348), this->unk_340 * this->unk_334,
this->unk_344 * this->unk_334, this->unk_33C, this->unk_300);
}
diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
index 954e5fa06..e8145f806 100644
--- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
+++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_elfbub.c
+ * Overlay: ovl_En_Elfbub
+ * Description: Stray fairy in bubble
+ */
+
#include "z_en_elfbub.h"
#define FLAGS 0x00000001
@@ -9,7 +15,9 @@ void EnElfbub_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnElfbub_Update(Actor* thisx, GlobalContext* globalCtx);
void EnElfbub_Draw(Actor* thisx, GlobalContext* globalCtx);
-#if 0
+void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx);
+void EnElfbub_Idle(EnElfbub* this, GlobalContext* globalCtx);
+
const ActorInit En_Elfbub_InitVars = {
ACTOR_EN_ELFBUB,
ACTORCAT_MISC,
@@ -22,27 +30,138 @@ const ActorInit En_Elfbub_InitVars = {
(ActorFunc)EnElfbub_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80ACE270 = {
- { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_PLAYER,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 16, 32, 0, { 0, 0, 0 } },
};
-#endif
+extern Gfx D_06001000[];
-extern ColliderCylinderInit D_80ACE270;
+void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnElfbub* this = THIS;
+ Actor* childActor;
-extern UNK_TYPE D_06001000;
+ if (Flags_GetSwitch(globalCtx, ENELFBUB_GET_SWITCHFLAG(&this->actor))) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/EnElfbub_Init.s")
+ ActorShape_Init(&this->actor.shape, 16.0f, func_800B3FC0, 0.2f);
+ this->actor.hintId = 0x16;
+ Actor_SetScale(&this->actor, 1.25f);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/EnElfbub_Destroy.s")
+ this->actionFunc = EnElfbub_Idle;
+ this->zRot = randPlusMinusPoint5Scaled(0x10000);
+ this->zRotDelta = 1000;
+ this->xScale = 0.08f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/func_80ACDE60.s")
+ Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
+ this->actor.colChkInfo.mass = MASS_IMMOVABLE;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/func_80ACE030.s")
+ childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELFORG,
+ this->actor.world.pos.x, this->actor.world.pos.y + 12.0f, this->actor.world.pos.z,
+ this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z,
+ ((ENELFBUB_GET_SWITCHFLAG(&this->actor) & 0x7F) << 9) | 2);
+ if (childActor != NULL) {
+ childActor->parent = &this->actor;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/EnElfbub_Update.s")
+ this->oscillationAngle = 0;
+ this->actor.flags &= ~1;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Elfbub/EnElfbub_Draw.s")
+void EnElfbub_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnElfbub* this = THIS;
+ Collider_DestroyCylinder(globalCtx, &this->collider);
+}
+
+void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx) {
+ static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 };
+ static Color_RGBA8 sEnvColor = { 150, 150, 150, 0 };
+ static Vec3f sAccel = { 0.0f, -0.5f, 0.0f };
+ s32 effectCounter;
+ Vec3f velocity;
+ Vec3f pos;
+
+ Math_SmoothStepToF(&this->xyScale, 3.0f, 0.1f, 1000.0f, 0.0f);
+ Math_SmoothStepToF(&this->xScale, 0.2f, 0.1f, 1000.0f, 0.0f);
+ this->zRotDelta += 1000;
+ this->zRot += this->zRotDelta;
+ this->popTimer--;
+ if (this->popTimer <= 0) {
+ pos.x = this->actor.world.pos.x;
+ pos.y = this->actor.world.pos.y;
+ pos.z = this->actor.world.pos.z;
+
+ for (effectCounter = 0; effectCounter < 20; effectCounter++) {
+ velocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f;
+ velocity.y = Rand_ZeroOne() * 7.0f;
+ velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
+ EffectSsDtBubble_SpawnCustomColor(globalCtx, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor,
+ Rand_S16Offset(100, 50), 25, 0);
+ }
+
+ Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+void EnElfbub_Idle(EnElfbub* this, GlobalContext* globalCtx) {
+ s32 pad;
+
+ this->zRot += this->zRotDelta;
+ this->actor.world.pos.y += Math_SinS(this->oscillationAngle);
+ this->oscillationAngle += 0x200;
+
+ if (this->collider.base.acFlags & AC_HIT || this->collider.base.ocFlags1 & OC1_HIT) {
+ this->actionFunc = EnElfbub_Pop;
+ this->popTimer = 6;
+ return;
+ }
+
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+}
+
+void EnElfbub_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnElfbub* this = THIS;
+ Collider_UpdateCylinder(&this->actor, &this->collider);
+ this->actionFunc(this, globalCtx);
+ Actor_SetHeight(&this->actor, this->actor.shape.yOffset);
+}
+
+void EnElfbub_Draw(Actor* thisx, GlobalContext* globalCtx2) {
+ GlobalContext* globalCtx = globalCtx2;
+ EnElfbub* this = THIS;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C2DC(globalCtx->state.gfxCtx);
+
+ Matrix_InsertTranslation(0.0f, 0.0f, 1.0f, 1);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_Scale(this->xyScale + 1.0f, this->xyScale + 1.0f, 1.0f, 1);
+ Matrix_InsertZRotation_s(this->zRot, 1);
+ Matrix_Scale(this->xScale + 1.0f, 1.0f, 1.0f, 1);
+ Matrix_InsertZRotation_s(this->zRot * -1, 1);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, D_06001000);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h
index 47151cf6f..62a4b69a6 100644
--- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h
+++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h
@@ -3,13 +3,21 @@
#include "global.h"
+#define ENELFBUB_GET_SWITCHFLAG(thisx) ((((thisx)->params) & 0xFE00) >> 9)
+
struct EnElfbub;
typedef void (*EnElfbubActionFunc)(struct EnElfbub*, GlobalContext*);
typedef struct EnElfbub {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x5C];
+ /* 0x0144 */ ColliderCylinder collider;
+ /* 0x0190 */ s16 zRot;
+ /* 0x0192 */ s16 zRotDelta;
+ /* 0x0194 */ s16 oscillationAngle;
+ /* 0x0196 */ s16 popTimer;
+ /* 0x0198 */ f32 xScale;
+ /* 0x019C */ f32 xyScale;
/* 0x01A0 */ EnElfbubActionFunc actionFunc;
} EnElfbub; // size = 0x1A4
diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
index b61b73c58..ba444eb6c 100644
--- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
+++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
@@ -270,7 +270,7 @@ void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx) {
func_8012C2DC(globalCtx->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) {
if (sPtr->enabled) {
- SysMatrix_InsertTranslation(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW);
Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20);
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(&D_04079B10));
@@ -278,8 +278,8 @@ void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha);
- SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_f(DEGTORAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY);
+ Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
+ Matrix_InsertZRotation_f(DEGTORAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0407AB58);
diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
index f32c5cc5a..089ee3788 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c
@@ -42,8 +42,7 @@ void EnEndingHero_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600B0CC, &D_06000BE0, this->limbDrawTable,
- this->transitionDrawTable, 15);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B0CC, &D_06000BE0, this->jointTable, this->morphTable, 15);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
func_80C1E748(this);
}
@@ -57,7 +56,7 @@ void func_80C1E748(EnEndingHero* this) {
}
void func_80C1E764(EnEndingHero* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -93,8 +92,8 @@ void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1E984[index]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, 0, 0,
- &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ 0, 0, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h
index bd81f7e06..95991fee8 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h
+++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h
@@ -10,8 +10,8 @@ typedef void (*EnEndingHeroActionFunc)(struct EnEndingHero*, GlobalContext*);
typedef struct EnEndingHero {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[15];
- /* 0x1E2 */ Vec3s transitionDrawTable[15];
+ /* 0x188 */ Vec3s jointTable[15];
+ /* 0x1E2 */ Vec3s morphTable[15];
/* 0x23C */ EnEndingHeroActionFunc actionFunc;
/* 0x240 */ s16 unk240;
/* 0x242 */ s16 unk242;
diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c
index 8b201a7ae..0ff95496d 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c
@@ -34,8 +34,7 @@ void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007908, &D_060011C0, this->limbDrawTable,
- this->transitionDrawTable, 20);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007908, &D_060011C0, this->jointTable, this->morphTable, 20);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
func_80C232E8(this);
}
@@ -49,7 +48,7 @@ void func_80C232E8(EnEndingHero2* this) {
}
void func_80C23304(EnEndingHero2* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero2_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -65,6 +64,6 @@ void EnEndingHero2_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, 0, 0,
- &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ 0, 0, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h
index 99f57ab6a..fe7e6bf2e 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h
+++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h
@@ -10,8 +10,8 @@ typedef void (*EnEndingHero2ActionFunc)(struct EnEndingHero2*, GlobalContext*);
typedef struct EnEndingHero2 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[20];
- /* 0x200 */ Vec3s transitionDrawTable[20];
+ /* 0x188 */ Vec3s jointTable[20];
+ /* 0x200 */ Vec3s morphTable[20];
/* 0x278 */ EnEndingHero2ActionFunc actionFunc;
/* 0x27C */ u16 unk27C;
} EnEndingHero2; // size = 0x280
diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c
index 73d28cd18..91a42c409 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c
@@ -34,8 +34,7 @@ void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007150, &D_06000E50, this->limbDrawTable,
- this->transitionDrawTable, 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007150, &D_06000E50, this->jointTable, this->morphTable, 17);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
func_80C23518(this);
}
@@ -49,7 +48,7 @@ void func_80C23518(EnEndingHero3* this) {
}
void func_80C23534(EnEndingHero3* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero3_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -65,6 +64,6 @@ void EnEndingHero3_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, 0, 0,
- &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ 0, 0, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h
index fc5bb9c0f..b61452d77 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h
+++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h
@@ -10,8 +10,8 @@ typedef void (*EnEndingHero3ActionFunc)(struct EnEndingHero3*, GlobalContext*);
typedef struct EnEndingHero3 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[17];
- /* 0x1EE */ Vec3s transitionDrawTable[17];
+ /* 0x188 */ Vec3s jointTable[17];
+ /* 0x1EE */ Vec3s morphTable[17];
/* 0x254 */ EnEndingHero3ActionFunc actionFunc;
/* 0x258 */ u16 unk258;
} EnEndingHero3; // size = 0x25C
diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c
index 38729764a..949999b57 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c
@@ -34,8 +34,7 @@ void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600D640, &D_06002A84, this->limbDrawTable,
- this->transitionDrawTable, 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600D640, &D_06002A84, this->jointTable, this->morphTable, 17);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
func_80C23748(this);
}
@@ -49,7 +48,7 @@ void func_80C23748(EnEndingHero4* this) {
}
void func_80C23764(EnEndingHero4* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero4_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -65,6 +64,6 @@ void EnEndingHero4_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, 0, 0,
- &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ 0, 0, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h
index 048757932..09e3a72ee 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h
+++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h
@@ -10,8 +10,8 @@ typedef void (*EnEndingHero4ActionFunc)(struct EnEndingHero4*, GlobalContext*);
typedef struct EnEndingHero4 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[17];
- /* 0x1EE */ Vec3s transitionDrawTable[17];
+ /* 0x188 */ Vec3s jointTable[17];
+ /* 0x1EE */ Vec3s morphTable[17];
/* 0x254 */ EnEndingHero4ActionFunc actionFunc;
/* 0x258 */ u16 unk258;
} EnEndingHero4; // size = 0x25C
diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c
index ec48db441..1e392ef12 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c
@@ -40,8 +40,7 @@ void EnEndingHero5_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->limbDrawTable,
- this->transitionDrawTable, 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable, this->morphTable, 17);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
this->unk25C = this->actor.params;
func_80C23980(this);
@@ -56,7 +55,7 @@ void func_80C23980(EnEndingHero5* this) {
}
void func_80C2399C(EnEndingHero5* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero5_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -106,8 +105,8 @@ void EnEndingHero5_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- func_80C23A30, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, func_80C23A30, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h
index a630b56f4..e9f3ecf18 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h
+++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h
@@ -10,8 +10,8 @@ typedef void (*EnEndingHero5ActionFunc)(struct EnEndingHero5*, GlobalContext*);
typedef struct EnEndingHero5 {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[17];
- /* 0x1EE */ Vec3s transitionDrawTable[17];
+ /* 0x188 */ Vec3s jointTable[17];
+ /* 0x1EE */ Vec3s morphTable[17];
/* 0x254 */ EnEndingHero5ActionFunc actionFunc;
/* 0x258 */ u16 unk258;
/* 0x25C */ s32 unk25C;
diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
index 334856872..d692d4f11 100644
--- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
+++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c
@@ -76,8 +76,8 @@ void EnEndingHero6_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.gravity = -3.0f;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, sSkeletons[this->npcIndex], sAnimations[this->npcIndex],
- this->jointTable, this->morphTable, sLimbCounts[this->npcIndex]);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeletons[this->npcIndex], sAnimations[this->npcIndex],
+ this->jointTable, this->morphTable, sLimbCounts[this->npcIndex]);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
EnEndingHero6_SetupIdle(this);
}
@@ -87,8 +87,8 @@ void EnEndingHero6_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnEndingHero6_InitSkelAnime(EnEndingHero6* this, s32 npcIndex) {
this->animIndex = npcIndex;
- this->frameCount = SkelAnime_GetFrameCount(&sAnimations[npcIndex]->common);
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.f, this->frameCount, 0, 0.0f);
+ this->frameCount = Animation_GetLastFrame(sAnimations[npcIndex]);
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.f, this->frameCount, 0, 0.0f);
}
void EnEndingHero6_SetupIdle(EnEndingHero6* this) {
@@ -98,7 +98,7 @@ void EnEndingHero6_SetupIdle(EnEndingHero6* this) {
}
void EnEndingHero6_Idle(EnEndingHero6* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void EnEndingHero6_Update(Actor* thisx, GlobalContext* globalCtx) {
@@ -182,8 +182,8 @@ void EnEndingHero6_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C24294[index]));
}
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, NULL, EnEndingHero6_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, NULL, EnEndingHero6_PostLimbDraw, &this->actor);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c
index 3b94a5732..197f07606 100644
--- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c
+++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c
@@ -117,11 +117,11 @@ s32 EnFg_UpdateAnimation(SkelAnime* skelAnime, s16 animIndex) {
ret = true;
frameCount = sAnimations[animIndex].frameCount;
if (frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&sAnimations[animIndex].animationSeg->common);
+ frameCount = Animation_GetLastFrame(sAnimations[animIndex].animationSeg);
}
- SkelAnime_ChangeAnim(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
- sAnimations[animIndex].frame, frameCount, sAnimations[animIndex].mode,
- sAnimations[animIndex].transitionRate);
+ Animation_Change(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
+ sAnimations[animIndex].frame, frameCount, sAnimations[animIndex].mode,
+ sAnimations[animIndex].transitionRate);
}
return ret;
}
@@ -137,7 +137,7 @@ void func_80A2D348(EnFg* this, GlobalContext* globalCtx) {
}
void func_80A2D3D4(EnFg* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
u8 EnFg_UpdateHealth(EnFg* this) {
@@ -185,7 +185,7 @@ void EnFg_Idle(EnFg* this, GlobalContext* globalCtx) {
case FG_DMGEFFECT_DEKUSTICK:
this->actor.flags &= ~1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_CRY_1);
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
this->actor.shape.shadowDraw = NULL;
this->actor.scale.x *= 1.5f;
this->actor.scale.z *= 1.5f;
@@ -197,7 +197,7 @@ void EnFg_Idle(EnFg* this, GlobalContext* globalCtx) {
break;
case FG_DMGEFFECT_ARROW:
this->actor.flags &= ~1;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
rotY = this->collider.base.ac->world.rot.y;
rotX = this->collider.base.ac->world.rot.x;
this->actor.scale.x = fabsf(0.01f * Math_CosS(rotY));
@@ -213,7 +213,7 @@ void EnFg_Idle(EnFg* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_CRY_0);
if (1) {}
this->actor.params = FG_BLACK;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
ac = this->collider.base.ac;
this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos);
this->actor.shape.rot = this->actor.world.rot;
@@ -245,7 +245,7 @@ void EnFg_Jump(EnFg* this, GlobalContext* globalCtx) {
switch (EnFg_GetDamageEffect(this)) {
case FG_DMGEFFECT_ARROW:
this->actor.flags &= ~1;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
ac = this->collider.base.ac;
rotY = ac->world.rot.y;
rotX = ac->world.rot.x;
@@ -264,7 +264,7 @@ void EnFg_Jump(EnFg* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_CRY_0);
EnFg_UpdateAnimation(&this->skelAnime, 0);
this->actor.params = FG_BLACK;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ this->skelAnime.playSpeed = 0.0f;
ac = this->collider.base.ac;
this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos);
this->actor.shape.rot = this->actor.world.rot;
@@ -276,9 +276,9 @@ void EnFg_Jump(EnFg* this, GlobalContext* globalCtx) {
this->actionFunc = EnFg_Knockback;
break;
default:
- if (func_801378B8(&this->skelAnime, 8.0f)) {
- this->skelAnime.animCurrentFrame = 8.0f;
- this->skelAnime.animPlaybackSpeed = 0.0f;
+ if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
+ this->skelAnime.curFrame = 8.0f;
+ this->skelAnime.playSpeed = 0.0f;
}
if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & 1)) {
@@ -321,7 +321,7 @@ void EnFg_Init(Actor* thisx, GlobalContext* globalCtx) {
EnFg* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 10.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600B538, NULL, this->limbDrawTbl, this->transitionDrawTbl, 24);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B538, NULL, this->jointTable, this->morphTable, 24);
EnFg_UpdateAnimation(&this->skelAnime, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -360,8 +360,8 @@ void EnFg_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80A2D348(this, globalCtx);
}
-s32 EnFg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
- EnFg* this = THIS;
+s32 EnFg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg) {
+ EnFg* this = (EnFg*)arg;
if ((limbIndex == 7) || (limbIndex == 8)) {
*dList = NULL;
@@ -375,23 +375,23 @@ s32 EnFg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return 0;
}
-void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnFg* this = THIS;
+void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnFg* this = (EnFg*)arg;
s16 pad;
Vec3f vec1 = { 0.0f, 0.0f, 0.0f };
if ((limbIndex == 7) || (limbIndex == 8)) {
OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_StatePush();
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_StatePush();
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, *dList);
- SysMatrix_StatePop();
+ Matrix_StatePop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
if (limbIndex == 4) {
- SysMatrix_MultiplyVector3fByState(&vec1, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&vec1, &this->actor.focus.pos);
}
}
@@ -403,9 +403,9 @@ void EnFg_Draw(Actor* thisx, GlobalContext* globalCtx) {
{ 120, 130, 230, 255 }, { 190, 190, 190, 255 }, { 0, 0, 0, 255 },
};
- SysMatrix_StatePush();
+ Matrix_StatePush();
EnFg_DrawDust(globalCtx, &this->dustEffect[0]);
- SysMatrix_StatePop();
+ Matrix_StatePop();
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
@@ -414,8 +414,8 @@ void EnFg_Draw(Actor* thisx, GlobalContext* globalCtx) {
envColor[this->actor.params].b, envColor[this->actor.params].a);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_060059A0));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(&D_060059A0));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnFg_OverrideLimbDraw, EnFg_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnFg_OverrideLimbDraw, EnFg_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -476,8 +476,8 @@ void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect) {
alpha = (255.0f / 16.0f) * dustEffect->timer;
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, alpha);
gDPPipeSync(POLY_XLU_DISP++);
- SysMatrix_InsertTranslation(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(dustEffect->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.h b/src/overlays/actors/ovl_En_Fg/z_en_fg.h
index 5f12fca6e..45f643a1c 100644
--- a/src/overlays/actors/ovl_En_Fg/z_en_fg.h
+++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.h
@@ -42,8 +42,8 @@ typedef struct EnFg {
/* 0x144 */ EnFgActionFunc actionFunc;
/* 0x148 */ SkelAnime skelAnime;
/* 0x18C */ ColliderCylinder collider;
- /* 0x1D8 */ Vec3s limbDrawTbl[24];
- /* 0x268 */ Vec3s transitionDrawTbl[24];
+ /* 0x1D8 */ Vec3s jointTable[24];
+ /* 0x268 */ Vec3s morphTable[24];
/* 0x2F8 */ s16 timer;
/* 0x2FA */ s16 bounceCounter;
/* 0x2FC */ EnFgEffectDust dustEffect[10];
diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
index a6297afed..716c460a8 100644
--- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
+++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
@@ -194,7 +194,7 @@ void EnFirefly_Ignite(EnFirefly* this) {
}
s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 distFromHome;
if (this->actor.params != KEESE_NORMAL_PERCH) {
@@ -268,7 +268,7 @@ void EnFirefly_SetupFlyIdle(EnFirefly* this) {
this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f;
Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300);
this->targetPitch = ((this->maxAltitude < this->actor.world.pos.y) ? 0xC00 : -0xC00) + 0x1554;
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
this->actionFunc = EnFirefly_FlyIdle;
}
@@ -276,12 +276,12 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) {
s32 isSkelAnimeUpdated;
f32 rand;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer != 0) {
this->timer--;
}
- isSkelAnimeUpdated = func_801378B8(&this->skelAnime, 0.0f);
+ isSkelAnimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f);
this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f;
if (!EnFirefly_ReturnToPerch(this, globalCtx) && !EnFirefly_SeekTorch(this, globalCtx)) {
@@ -331,7 +331,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) {
void EnFirefly_SetupFall(EnFirefly* this, GlobalContext* globalCtx) {
this->timer = 40;
this->actor.velocity.y = 0.0f;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600017C, 0.0f, 6.0f, 6.0f, 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_0600017C, 0.0f, 6.0f, 6.0f, 2, 0.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_DEAD);
this->actor.flags |= 0x10;
@@ -411,16 +411,16 @@ void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) {
void EnFirefly_SetupDiveAttack(EnFirefly* this) {
this->timer = Rand_S16Offset(70, 100);
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
this->targetPitch = ((this->actor.yDistToPlayer > 0.0f) ? -0xC00 : 0xC00) + 0x1554;
this->actionFunc = EnFirefly_DiveAttack;
}
void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f preyPos;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer != 0) {
this->timer--;
@@ -432,9 +432,9 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300);
Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100);
} else if (Actor_IsActorFacingLink(&this->actor, 0x2800)) {
- if (func_801378B8(&this->skelAnime, 4.0f)) {
- this->skelAnime.animPlaybackSpeed = 0.0f;
- this->skelAnime.animCurrentFrame = 4.0f;
+ if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
+ this->skelAnime.playSpeed = 0.0f;
+ this->skelAnime.curFrame = 4.0f;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300);
@@ -444,7 +444,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &preyPos) + 0x1554, 2, 0x400,
0x100);
} else {
- this->skelAnime.animPlaybackSpeed = 1.5f;
+ this->skelAnime.playSpeed = 1.5f;
if (this->actor.xzDistToPlayer > 80.0f) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300);
}
@@ -471,14 +471,14 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
void EnFirefly_SetupRebound(EnFirefly* this) {
this->actor.world.rot.x = 0x7000;
this->timer = 18;
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
this->actor.speedXZ = 2.5f;
this->actionFunc = EnFirefly_Rebound;
}
// Knockback after hitting player
void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100);
Math_StepToF(&this->actor.velocity.y, 0.0f, 0.4f);
if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.15f)) {
@@ -496,11 +496,11 @@ void EnFirefly_SetupFlyAway(EnFirefly* this) {
this->timer = 150;
this->targetPitch = 0x954;
this->actionFunc = EnFirefly_FlyAway;
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
}
void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer != 0) {
this->timer--;
@@ -584,8 +584,8 @@ void EnFirefly_SetupPerch(EnFirefly* this) {
void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100);
if (this->timer != 0) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 6.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
this->timer--;
}
} else if (Rand_ZeroOne() < 0.02f) {
@@ -598,7 +598,7 @@ void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) {
}
void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) {
- this->skelAnime.animPlaybackSpeed = 3.0f;
+ this->skelAnime.playSpeed = 3.0f;
this->actor.shape.rot.x = 0x1554;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->timer = 50;
@@ -607,10 +607,10 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) {
}
void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f preyPos;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->timer != 0) {
this->timer--;
@@ -705,7 +705,7 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (func_801378B8(&this->skelAnime, 5.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 5.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_FLY);
}
}
@@ -762,7 +762,7 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
((this->auraType == KEESE_AURA_FIRE) || (this->auraType == KEESE_AURA_ICE)) &&
((limbIndex == 15) || (limbIndex == 21))) {
if (this->actionFunc != EnFirefly_Die) {
- SysMatrix_GetStateTranslation(&auraPos);
+ Matrix_GetStateTranslation(&auraPos);
auraPos.x += Rand_ZeroFloat(5.0f);
auraPos.y += Rand_ZeroFloat(5.0f);
auraPos.z += Rand_ZeroFloat(5.0f);
@@ -795,11 +795,11 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
}
if (limbIndex == 15) {
- SysMatrix_GetStateTranslation(&this->unk_2F8);
+ Matrix_GetStateTranslation(&this->unk_2F8);
} else if (limbIndex == 21) {
- SysMatrix_GetStateTranslation(&this->unk_304);
+ Matrix_GetStateTranslation(&this->unk_304);
} else if (limbIndex == 10) {
- SysMatrix_GetStateTranslation(&this->unk_310);
+ Matrix_GetStateTranslation(&this->unk_310);
}
}
@@ -824,8 +824,8 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetEnvColor(&gfx[1], 0, 0, 0, 255);
}
- gfx = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnFirefly_OverrideLimbDraw,
- EnFirefly_PostLimbDraw, &this->actor, &gfx[2]);
+ gfx = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw,
+ EnFirefly_PostLimbDraw, &this->actor, &gfx[2]);
if (this->isInvisible) {
POLY_XLU_DISP = gfx;
} else {
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
index bace8a29b..606e5f955 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
@@ -708,11 +708,11 @@ void EnFsn_InitShop(EnFsn* this, GlobalContext* globalCtx) {
}
void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->animationIdx == 4) {
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animationSeg->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animationSeg);
if (curFrame == frameCount) {
this->animationIdx = 5;
func_8013BC6C(&this->skelAnime, sAnimations, this->animationIdx);
@@ -745,15 +745,15 @@ void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) {
}
void EnFsn_Haggle(EnFsn* this, GlobalContext* globalCtx) {
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animationSeg->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animationSeg);
if (this->flags & ENFSN_ANGRY) {
this->flags &= ~ENFSN_ANGRY;
this->animationIdx = 11;
func_8013BC6C(&this->skelAnime, sAnimations, this->animationIdx);
} else {
- if (this->animationIdx == 11 && func_801378B8(&this->skelAnime, 18.0f)) {
+ if (this->animationIdx == 11 && Animation_OnFrame(&this->skelAnime, 18.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HANKO);
}
if (this->flags & ENFSN_CALM_DOWN) {
@@ -770,7 +770,7 @@ void EnFsn_Haggle(EnFsn* this, GlobalContext* globalCtx) {
this->animationIdx = 5;
func_8013BC6C(&this->skelAnime, sAnimations, this->animationIdx);
} else {
- if (func_801378B8(&this->skelAnime, 28.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 28.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HANKO);
}
return;
@@ -807,7 +807,7 @@ void EnFsn_BeginInteraction(EnFsn* this, GlobalContext* globalCtx) {
void EnFsn_StartBuying(EnFsn* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnFsn_HandleLookToShopkeeperBuyingCutscene(this);
if (talkState == 5 && func_80147624(globalCtx)) {
@@ -903,7 +903,7 @@ void EnFsn_SetupDeterminePrice(EnFsn* this, GlobalContext* globalCtx) {
}
void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 itemGiven;
u8 buttonItem;
@@ -941,7 +941,7 @@ void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) {
void EnFsn_MakeOffer(EnFsn* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (talkState == 4 && func_80147624(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
@@ -989,7 +989,7 @@ void EnFsn_GiveItem(EnFsn* this, GlobalContext* globalCtx) {
}
this->actor.parent = NULL;
if (ENFSN_IS_SHOP(&this->actor) && !this->isSelling) {
- func_80123D50(globalCtx, PLAYER, 18, 21);
+ func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21);
}
this->actionFunc = EnFsn_SetupResumeInteraction;
} else if (this->isSelling == true) {
@@ -1398,8 +1398,7 @@ void EnFsn_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 20.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013320, &D_06012C34, this->limbDrawTable,
- this->transitionDrawTable, 19);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013320, &D_06012C34, this->jointTable, this->morphTable, 19);
if (ENFSN_IS_SHOP(&this->actor)) {
this->actor.shape.rot.y = BINANG_ROT180(this->actor.shape.rot.y);
this->actor.flags &= ~1;
@@ -1442,7 +1441,7 @@ void EnFsn_Update(Actor* thisx, GlobalContext* globalCtx) {
EnFsn_UpdateStickDirectionPromptAnim(this);
EnFsn_UpdateCursorAnim(this);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (ENFSN_IS_BACKROOM(&this->actor)) {
EnFsn_UpdateCollider(this, globalCtx);
}
@@ -1559,7 +1558,7 @@ s32 EnFsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
s32 limbRotTableIdx;
if (limbIndex == 16) {
- SysMatrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
}
if (ENFSN_IS_BACKROOM(&this->actor)) {
switch (limbIndex) {
@@ -1614,8 +1613,8 @@ void EnFsn_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C5B0(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnFsn_OverrideLimbDraw, EnFsn_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnFsn_OverrideLimbDraw, EnFsn_PostLimbDraw, &this->actor);
for (i = 0; i < this->totalSellingItems; i++) {
this->items[i]->actor.scale.x = 0.2f;
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
index 945bb0d76..139e145da 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
@@ -27,8 +27,8 @@ typedef struct EnFsn {
/* 0x24E */ s16 limbRotZTable[19];
/* 0x274 */ Vec3s headRot;
/* 0x27A */ Vec3s unk27A; // Set but never used
- /* 0x280 */ Vec3s limbDrawTable[19];
- /* 0x2F2 */ Vec3s transitionDrawTable[19];
+ /* 0x280 */ Vec3s jointTable[19];
+ /* 0x2F2 */ Vec3s morphTable[19];
/* 0x364 */ s16 eyeTextureIdx;
/* 0x366 */ s16 blinkTimer;
/* 0x368 */ s16 cutsceneState;
diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c
index 99c23126f..550a54f62 100644
--- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c
+++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c
@@ -1,3 +1,14 @@
+/*
+ * File: z_en_fu.c
+ * Overlay: ovl_En_Fu
+ * Description: Honey & Darling
+ */
+
+#include "overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h"
+#include "overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h"
+#include "overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h"
+#include "overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.h"
+#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "z_en_fu.h"
#define FLAGS 0x0A000019
@@ -9,7 +20,50 @@ void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnFu_Update(Actor* thisx, GlobalContext* globalCtx);
void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx);
-#if 0
+void func_809622FC(EnFu* this);
+void func_80962340(EnFu* this, GlobalContext* globalCtx);
+void func_809628BC(EnFu* this);
+void func_809628D0(EnFu* this, GlobalContext* globalCtx);
+void func_809629F8(EnFu* this);
+void func_80962A10(EnFu* this, GlobalContext* globalCtx);
+void func_80962BA8(EnFu* this);
+void func_80962BCC(EnFu* this, GlobalContext* globalCtx);
+void func_80962D48(EnFu* this);
+void func_80962D60(EnFu* this, GlobalContext* globalCtx);
+void func_80962F10(EnFu* this);
+void func_80962F4C(EnFu* this, GlobalContext* globalCtx);
+void func_8096326C(EnFu* this, GlobalContext* globalCtx);
+void func_809632D0(EnFu* this);
+void func_80963350(EnFu* this, GlobalContext* globalCtx);
+void func_80963540(EnFu* this);
+void func_80963560(EnFu* this, GlobalContext* globalCtx);
+void func_80963610(EnFu* this);
+void func_80963630(EnFu* this, GlobalContext* globalCtx);
+s32 func_80963810(GlobalContext* globalCtx, Vec3f pos);
+s32 func_809638F8(GlobalContext* globalCtx);
+void func_809639D0(EnFu* this, GlobalContext* globalCtx);
+void func_80963DE4(EnFu* this, GlobalContext* globalCtx);
+void func_80963EAC(EnFu* this, GlobalContext* globalCtx);
+void func_80963F44(EnFu* this, GlobalContext* globalCtx);
+void func_80963F88(EnFu* this, GlobalContext* globalCtx);
+void func_80963FF8(EnFu* this, GlobalContext* globalCtx);
+void func_8096413C(EnFu* this, GlobalContext* globalCtx);
+void func_80964190(EnFu* this, GlobalContext* globalCtx);
+void func_8096426C(EnFu* this, GlobalContext* globalCtx);
+void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len);
+void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len);
+void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len);
+
+extern AnimationHeader D_06001F74;
+extern AnimationHeader D_06002F64;
+extern AnimationHeader D_06004904;
+extern AnimationHeader D_06005304;
+extern AnimationHeader D_060053E0;
+extern Gfx D_0600B0A0[];
+extern Gfx D_0600B0E0[];
+extern FlexSkeletonHeader D_0600B2B0;
+extern AnimationHeader D_0600BAC4;
+
const ActorInit En_Fu_InitVars = {
ACTOR_EN_FU,
ACTORCAT_NPC,
@@ -22,126 +76,1401 @@ const ActorInit En_Fu_InitVars = {
(ActorFunc)EnFu_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80964BD8 = {
- { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static s32 D_80964B00[] = { 300, 100, 100 };
+
+static Vec3f D_80964B0C = { 0.0f, 60.0f, -8.0f };
+static Vec3f D_80964B18 = { 0.0f, 55.0f, 12.0f };
+static Vec3f D_80964B24 = { 0.0f, 60.0f, 0.0f };
+
+static ActorAnimationEntry sAnimations[] = {
+ { &D_060053E0, 1.0f, 0.0f, 0.0f, 0, -4.0f }, { &D_06001F74, 1.0f, 0.0f, 0.0f, 0, -4.0f },
+ { &D_06002F64, 1.0f, 0.0f, 0.0f, 0, -4.0f }, { &D_06004904, 1.0f, 0.0f, 0.0f, 0, 0.0f },
+ { &D_06005304, 1.0f, 0.0f, 0.0f, 0, -8.0f }, { &D_06005304, 1.0f, 0.0f, 0.0f, 0, 0.0f },
+ { &D_0600BAC4, 1.0f, 0.0f, 0.0f, 2, 0.0f },
+};
+
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_HIT0,
+ AT_NONE,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 20, 50, 0, { 0, 0, 0 } },
};
-#endif
+void func_809616E0(EnFu* this, GlobalContext* globalCtx) {
+ s32 i;
+ f32 temp_f20;
+ f32 temp_f22;
+ s16 atan;
+ s16 spA0 = false;
+ Vec3f sp94;
-extern ColliderCylinderInit D_80964BD8;
+ if ((gSaveContext.playerForm == PLAYER_FORM_DEKU) && (CURRENT_DAY == 3)) {
+ spA0 = true;
+ }
+ this->unk_54C = 0;
-extern UNK_TYPE D_06001F74;
-extern UNK_TYPE D_0600B0E0;
+ for (i = 0; i < this->unk_520; i++) {
+ temp_f20 = this->actor.world.pos.x - this->unk_538[i].x;
+ temp_f22 = this->actor.world.pos.z - this->unk_538[i].z;
+ atan = Math_FAtan2F(temp_f22, temp_f20);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809616E0.s")
+ if (!spA0 || ((i % 2) != 0)) {
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, this->unk_544, this->unk_538[i].x, this->unk_538[i].y,
+ this->unk_538[i].z, 0, atan, 0, i);
+ this->unk_54C++;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809619D0.s")
+ if (this->unk_546 == 1) {
+ Vec3f sp88 = { 0.0f, 0.0f, 0.0f };
+ Vec3f sp7C = { 0.0f, 0.2f, 0.0f };
+ Color_RGBA8 sp78 = { 255, 255, 255, 255 };
+ Color_RGBA8 sp74 = { 198, 198, 198, 255 };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/EnFu_Init.s")
+ sp94.x = this->unk_538[i].x;
+ sp94.y = this->unk_538[i].y;
+ sp94.z = this->unk_538[i].z;
+ func_800B0EB0(globalCtx, &sp94, &sp88, &sp7C, &sp78, &sp74, 100, 150, 10);
+ sp94.x -= 0.1f * temp_f20;
+ sp94.z -= 0.1f * temp_f22;
+ func_800B3030(globalCtx, &sp94, &sp88, &sp7C, 100, 0, 3);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/EnFu_Destroy.s")
+void func_809619D0(EnFu* this, GlobalContext* globalCtx) {
+ s32 i;
+ Path* path = &globalCtx->setupPathList[ENFU_GET_FF00(&this->actor)];
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961D10.s")
+ switch (CURRENT_DAY) {
+ case 1:
+ this->unk_542 = 2;
+ this->unk_544 = ACTOR_EN_FU_MATO;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961D7C.s")
+ case 2:
+ this->unk_542 = 1;
+ this->unk_544 = ACTOR_EN_FU_KAGO;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961E88.s")
+ case 3:
+ this->unk_542 = 0;
+ this->unk_544 = ACTOR_EN_FU_MATO;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961EC8.s")
+ default:
+ this->unk_544 = ACTOR_EN_FU_MATO;
+ this->unk_542 = 2;
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961F00.s")
+ for (i = 0; i < this->unk_542; i++) {
+ path = &globalCtx->setupPathList[path->unk1];
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80961F38.s")
+ this->unk_520 = path->count;
+ this->unk_538 = (Vec3s*)Lib_SegmentedToVirtual(path->points);
+ func_809616E0(this, globalCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_8096209C.s")
+void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ EnFu* this = THIS;
+ Actor* fuKaiten = globalCtx->actorCtx.actorList[ACTORCAT_BG].first;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809622FC.s")
+ while (fuKaiten != NULL) {
+ if (fuKaiten->id == ACTOR_BG_FU_KAITEN) {
+ this->actor.child = fuKaiten;
+ break;
+ }
+ fuKaiten = fuKaiten->next;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962340.s")
+ if (fuKaiten != NULL) {
+ ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 36.0f);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B2B0, &D_06001F74, this->jointTable, this->morphTable,
+ 21);
+ Collider_InitCylinder(globalCtx, &this->collider);
+ Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
+ this->actor.colChkInfo.mass = MASS_IMMOVABLE;
+ Actor_SetScale(&this->actor, 0.01f);
+ this->actor.flags &= ~1;
+ this->actor.gravity = -0.2f;
+ this->actor.shape.rot.y += 0x4000;
+ this->actor.world.rot = this->actor.shape.rot;
+ this->unk_546 = 0;
+ this->unk_54A = 1;
+ this->unk_54C = 0;
+ this->unk_53C = 0;
+ this->unk_53E = 0;
+ this->unk_540 = 0;
+ this->unk_54E = 0;
+ this->unk_550 = 0;
+ func_809622FC(this);
+ this->actor.targetMode = 6;
+ func_809619D0(this, globalCtx);
+ if (CURRENT_DAY == 2) {
+ Vec3f sp40 = this->actor.child->home.pos;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962588.s")
+ this->unk_2D4 = (BgFuMizu*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_FU_MIZU, sp40.x, sp40.y,
+ sp40.z, 0, 0, 0, 0);
+ } else {
+ this->unk_2D4 = NULL;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962660.s")
+void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnFu* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809628BC.s")
+ gSaveContext.weekEventReg[63] &= (u8)~0x1;
+ gSaveContext.weekEventReg[8] &= (u8)~0x1;
+ Collider_DestroyCylinder(globalCtx, &this->collider);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809628D0.s")
+s32 func_80961D10(EnFu* this) {
+ if ((this->collider.base.acFlags & AC_HIT) && (this->unk_542 == 0)) {
+ return true;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809629F8.s")
+ if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->unk_542 == 2)) {
+ Actor* actor = this->collider.base.oc;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962A10.s")
+ if (actor->id == ACTOR_EN_BOM_CHU) {
+ return true;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962BA8.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962BCC.s")
+void func_80961D7C(GlobalContext* globalCtx) {
+ Actor* explosive = globalCtx->actorCtx.actorList[ACTORCAT_EXPLOSIVES].first;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962D48.s")
+ while (explosive != NULL) {
+ if ((explosive->id == ACTOR_EN_BOM) && (explosive->bgCheckFlags & 1)) {
+ EnBom* bomb = (EnBom*)explosive;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962D60.s")
+ if (bomb->actor.floorBgId != BGCHECK_SCENE) {
+ DynaPolyActor* fuKago = BgCheck_GetActorOfMesh(&globalCtx->colCtx, bomb->actor.floorBgId);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962EBC.s")
+ if ((fuKago != NULL) && (fuKago->actor.id == ACTOR_EN_FU_KAGO)) {
+ Math_SmoothStepToF(&bomb->actor.world.pos.x, fuKago->actor.world.pos.x, 0.1f, 1.0f, 0.5f);
+ Math_SmoothStepToF(&bomb->actor.world.pos.z, fuKago->actor.world.pos.z, 0.1f, 1.0f, 0.5f);
+ }
+ }
+ }
+ explosive = explosive->next;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962F10.s")
+void func_80961E88(GlobalContext* globalCtx) {
+ Actor* explosive = globalCtx->actorCtx.actorList[ACTORCAT_EXPLOSIVES].first;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80962F4C.s")
+ while (explosive != NULL) {
+ Actor_MarkForDeath(explosive);
+ explosive = explosive->next;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963258.s")
+void func_80961EC8(GlobalContext* globalCtx) {
+ Actor* fuMato = globalCtx->actorCtx.actorList[ACTORCAT_BG].first;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_8096326C.s")
+ while (fuMato != NULL) {
+ if (fuMato->id == ACTOR_EN_FU_MATO) {
+ ((EnFuMato*)fuMato)->unk_30A = 1;
+ }
+ fuMato = fuMato->next;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809632D0.s")
+void func_80961F00(GlobalContext* globalCtx) {
+ Actor* fuKago = globalCtx->actorCtx.actorList[ACTORCAT_BG].first;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963350.s")
+ while (fuKago != NULL) {
+ if (fuKago->id == ACTOR_EN_FU_KAGO) {
+ ((EnFuKago*)fuKago)->unk_33C = 1;
+ }
+ fuKago = fuKago->next;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963540.s")
+void func_80961F38(GlobalContext* globalCtx, Vec3f* arg1, s16* arg2, s16 arg3, s16 arg4, s16 arg5) {
+ Player* player = GET_PLAYER(globalCtx);
+ s16 sp42;
+ s16 sp40;
+ Vec3f sp34 = player->actor.focus.pos;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963560.s")
+ sp40 = Math_Vec3f_Yaw(arg1, &sp34) - arg3;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963610.s")
+ if (arg5 < ABS_ALT(sp40)) {
+ Math_SmoothStepToS(&arg2[0], 0, 6, 6200, 100);
+ Math_SmoothStepToS(&arg2[1], 0, 6, 6200, 100);
+ } else {
+ sp42 = Math_Vec3f_Pitch(arg1, &sp34);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963630.s")
+ Math_SmoothStepToS(&arg2[0], sp42, 6, 6200, 100);
+ Math_SmoothStepToS(&arg2[1], sp40, 6, 6200, 100);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963810.s")
+ if (arg4 < ABS_ALT(arg2[1])) {
+ if (arg2[1] > 0) {
+ arg2[1] = arg4;
+ } else {
+ arg2[1] = -arg4;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809638F8.s")
+ Math_SmoothStepToS(&arg2[2], 0, 6, 2000, 100);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809639D0.s")
+void func_8096209C(EnFu* this, GlobalContext* globalCtx) {
+ Vec3f sp34;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963DE4.s")
+ if (this->unk_53C & 1) {
+ func_80961F38(globalCtx, &this->unk_508, this->unk_524, this->actor.shape.rot.y, 0x38E3, 0x6AAA);
+ } else {
+ Math_SmoothStepToS(&this->unk_524[0], 0, 6, 6000, 100);
+ Math_SmoothStepToS(&this->unk_524[1], 0, 6, 6000, 100);
+ Math_SmoothStepToS(&this->unk_524[2], 0, 6, 6000, 100);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963EAC.s")
+ if (this->unk_53C & 2) {
+ s16 rotY = BINANG_SUB(this->actor.shape.rot.y, 0x8000);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963F44.s")
+ func_80961F38(globalCtx, &this->unk_514, this->unk_52A, rotY, 0x38E3, 0x5555);
+ } else {
+ Math_SmoothStepToS(&this->unk_52A[0], 0, 6, 6000, 100);
+ Math_SmoothStepToS(&this->unk_52A[1], 0, 6, 6000, 100);
+ Math_SmoothStepToS(&this->unk_52A[2], 0, 6, 6000, 100);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963F88.s")
+ if ((this->unk_53C & 1) && (this->unk_53C & 2)) {
+ sp34 = D_80964B24;
+ } else if (this->unk_53C & 1) {
+ sp34 = D_80964B0C;
+ } else if (this->unk_53C & 2) {
+ sp34 = D_80964B18;
+ } else {
+ sp34 = D_80964B24;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80963FF8.s")
+ Matrix_StatePush();
+ Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW);
+ Matrix_MultiplyVector3fByState(&sp34, &this->actor.focus.pos);
+ Matrix_StatePop();
+ this->actor.focus.pos.x += this->actor.world.pos.x;
+ this->actor.focus.pos.y += this->actor.world.pos.y;
+ this->actor.focus.pos.z += this->actor.world.pos.z;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80964034.s")
+void func_809622FC(EnFu* this) {
+ func_800BDC5C(&this->skelAnime, sAnimations, 1);
+ this->actionFunc = func_80962340;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809640D8.s")
+void func_80962340(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_8096413C.s")
+ if (this->unk_54A == 2) {
+ this->actor.flags |= 0x10000;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80964190.s")
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ if (this->unk_54A == 2) {
+ if (this->unk_552 == 0x287D) {
+ if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
+ func_801518B0(globalCtx, 0x287E, &this->actor);
+ this->unk_552 = 0x287E;
+ } else if ((CURRENT_DAY == 3) && (gSaveContext.weekEventReg[22] & 0x10) &&
+ (gSaveContext.weekEventReg[22] & 0x20)) {
+ if ((gSaveContext.weekEventReg[22] & 0x40)) {
+ func_801518B0(globalCtx, 0x2883, &this->actor);
+ this->unk_552 = 0x2883;
+ } else {
+ func_801518B0(globalCtx, 0x2880, &this->actor);
+ this->unk_552 = 0x2880;
+ }
+ } else {
+ func_801518B0(globalCtx, 0x287E, &this->actor);
+ this->unk_552 = 0x287E;
+ }
+ } else if ((gSaveContext.unk_3DE0[4] == 0) && (this->unk_552 != 0x2888)) {
+ func_801518B0(globalCtx, 0x2886, &this->actor);
+ this->unk_552 = 0x2886;
+ } else {
+ func_801518B0(globalCtx, 0x2889, &this->actor);
+ this->unk_552 = 0x2889;
+ }
+ this->actor.flags &= ~0x10000;
+ player->stateFlags1 &= ~0x20;
+ this->unk_54A = 1;
+ } else {
+ func_801518B0(globalCtx, 0x283C, &this->actor);
+ this->unk_552 = 0x283C;
+ }
+ func_809628BC(this);
+ } else if (this->unk_54A == 2) {
+ func_800B8614(&this->actor, globalCtx, 500.0f);
+ } else {
+ func_800B8614(&this->actor, globalCtx, 100.0f);
+ }
+ Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_SUB(this->actor.child->shape.rot.y, 0x4000), 10, 3000, 100);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_8096426C.s")
+void func_80962588(EnFu* this, GlobalContext* globalCtx) {
+ if (func_80147624(globalCtx) && (this->unk_552 == 0x2871)) {
+ if (1) {}
+ if (globalCtx->msgCtx.choiceIndex == 0) {
+ if (gSaveContext.rupees >= 10) {
+ func_8019F208();
+ func_801159EC(-10);
+ func_80963DE4(this, globalCtx);
+ } else {
+ play_sound(NA_SE_SY_ERROR);
+ func_801518B0(globalCtx, 0x2873, &this->actor);
+ this->unk_552 = 0x2873;
+ }
+ } else {
+ func_8019F230();
+ func_801518B0(globalCtx, 0x2872, &this->actor);
+ this->unk_552 = 0x2872;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809642E0.s")
+void func_80962660(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/EnFu_Update.s")
+ if (func_80147624(globalCtx)) {
+ switch (this->unk_552) {
+ case 0x283C:
+ func_80963F44(this, globalCtx);
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809643FC.s")
+ case 0x283D:
+ func_809639D0(this, globalCtx);
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_8096450C.s")
+ case 0x283E:
+ case 0x283F:
+ case 0x2841:
+ case 0x2843:
+ case 0x2845:
+ func_80963F44(this, globalCtx);
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/EnFu_Draw.s")
+ case 0x2846:
+ func_801518B0(globalCtx, 0x2849, &this->actor);
+ this->unk_552 = 0x2849;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80964694.s")
+ case 0x2847:
+ case 0x2849:
+ case 0x284B:
+ case 0x284D:
+ case 0x284F:
+ case 0x2851:
+ case 0x2853:
+ case 0x2855:
+ case 0x2857:
+ case 0x2859:
+ case 0x285B:
+ case 0x285D:
+ case 0x285F:
+ case 0x2861:
+ case 0x2863:
+ case 0x2865:
+ case 0x2867:
+ case 0x2869:
+ case 0x286B:
+ case 0x286D:
+ case 0x286F:
+ case 0x2873:
+ case 0x2875:
+ case 0x2877:
+ case 0x2879:
+ case 0x287B:
+ func_80963F44(this, globalCtx);
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_809647EC.s")
+ case 0x2848:
+ case 0x284A:
+ case 0x284E:
+ case 0x2850:
+ case 0x2852:
+ case 0x2856:
+ case 0x2858:
+ case 0x285A:
+ case 0x285C:
+ case 0x285E:
+ case 0x2860:
+ case 0x2862:
+ case 0x2864:
+ case 0x2866:
+ case 0x2868:
+ case 0x286A:
+ case 0x286C:
+ case 0x286E:
+ func_801518B0(globalCtx, 0x2871, &this->actor);
+ this->unk_552 = 0x2871;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fu/func_80964950.s")
+ case 0x2876:
+ case 0x2878:
+ case 0x287A:
+ case 0x287C:
+ func_801518B0(globalCtx, 0x287D, &this->actor);
+ this->unk_552 = 0x287D;
+ break;
+
+ case 0x287D:
+ gSaveContext.weekEventReg[63] |= 0x1;
+ gSaveContext.weekEventReg[63] &= (u8)~0x2;
+ func_801477B4(globalCtx);
+ player->stateFlags1 |= 0x20;
+ this->unk_53C = 0;
+ func_800BDC5C(&this->skelAnime, sAnimations, 3);
+ func_801A2BB8(0x25);
+ if (this->unk_542 == 0) {
+ if (this->unk_546 == 1) {
+ func_80961EC8(globalCtx);
+ }
+ func_809629F8(this);
+ } else if (this->unk_542 == 1) {
+ if (this->unk_546 == 1) {
+ func_80961F00(globalCtx);
+ }
+ func_80962BA8(this);
+ } else if (this->unk_542 == 2) {
+ if (this->unk_546 == 1) {
+ func_80961EC8(globalCtx);
+ }
+ func_80962D48(this);
+ }
+ break;
+
+ case 0x287E:
+ case 0x2880:
+ case 0x2883:
+ func_801477B4(globalCtx);
+ func_80963540(this);
+ func_80963560(this, globalCtx);
+ break;
+
+ case 0x2886:
+ case 0x2889:
+ func_80963F44(this, globalCtx);
+ break;
+ }
+ }
+}
+
+void func_809628BC(EnFu* this) {
+ this->actionFunc = func_809628D0;
+}
+
+void func_809628D0(EnFu* this, GlobalContext* globalCtx) {
+ u8 sp27 = func_80152498(&globalCtx->msgCtx);
+
+ switch (sp27) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ break;
+
+ case 4:
+ func_80962588(this, globalCtx);
+ break;
+
+ case 5:
+ func_80962660(this, globalCtx);
+ break;
+
+ case 6:
+ if (func_80147624(globalCtx)) {
+ this->unk_54A = 1;
+ switch (this->unk_552) {
+ case 0x287F:
+ case 0x2881:
+ case 0x2882:
+ case 0x2884:
+ case 0x2887:
+ case 0x288A:
+ gSaveContext.weekEventReg[63] &= (u8)~0x1;
+ gSaveContext.weekEventReg[63] &= (u8)~0x2;
+ func_809622FC(this);
+ break;
+
+ default:
+ func_809622FC(this);
+ break;
+ }
+ }
+ break;
+ }
+
+ if (sp27 != 3) {
+ func_80964190(this, globalCtx);
+ func_8096426C(this, globalCtx);
+ }
+
+ func_8096413C(this, globalCtx);
+}
+
+void func_809629F8(EnFu* this) {
+ this->unk_54A = 0;
+ this->actionFunc = func_80962A10;
+}
+
+void func_80962A10(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+ BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child;
+
+ this->unk_53C = 0;
+ if ((fuKaiten->rotationSpeed < 300) || (fuKaiten->bouceHeight < 40.0f) || (fuKaiten->bounceSpeed < 600)) {
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, 300, 10, 5, 5);
+ Math_SmoothStepToS(&fuKaiten->bounceSpeed, 600, 20, 10, 10);
+ Math_SmoothStepToF(&fuKaiten->bouceHeight, 40.0f, 0.1f, 1.0f, 1.0f);
+ return;
+ }
+
+ play_sound(NA_SE_SY_FOUND);
+ player->stateFlags1 &= ~0x20;
+ func_8010E9F0(4, 60);
+ if (this->unk_546 == 1) {
+ func_809616E0(this, globalCtx);
+ } else {
+ this->unk_546 = 1;
+ }
+
+ if ((gSaveContext.playerForm == PLAYER_FORM_DEKU) && gSaveContext.magicAcquired) {
+ s16 temp = gSaveContext.unk_3F30;
+
+ Parameter_AddMagic(globalCtx, temp + (gSaveContext.doubleMagic * 48) + 48);
+ }
+
+ func_80962F10(this);
+}
+
+void func_80962BA8(EnFu* this) {
+ BgFuMizu* mizu = this->unk_2D4;
+
+ this->unk_54A = 0;
+ mizu->unk_160 = 1;
+ this->actionFunc = func_80962BCC;
+}
+
+void func_80962BCC(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+ BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child;
+
+ if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bouceHeight < 30.0f) || (fuKaiten->bounceSpeed < 600)) {
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, 100, 10, 5, 5);
+ Math_SmoothStepToS(&fuKaiten->bounceSpeed, 600, 20, 10, 10);
+ Math_SmoothStepToF(&fuKaiten->elevation, 10.0f, 0.1f, 1.0f, 1.0f);
+ Math_SmoothStepToF(&fuKaiten->bouceHeight, 30.0f, 0.1f, 1.0f, 1.0f);
+ return;
+ }
+
+ play_sound(NA_SE_SY_FOUND);
+ player->stateFlags1 &= ~0x20;
+ player->stateFlags3 |= 0x400000;
+ func_8010E9F0(4, 60);
+
+ if (this->unk_546 == 1) {
+ func_809616E0(this, globalCtx);
+ } else {
+ this->unk_546 = 1;
+ }
+
+ globalCtx->unk_1887E = 30;
+ func_80962F10(this);
+}
+
+void func_80962D48(EnFu* this) {
+ this->unk_54A = 0;
+ this->actionFunc = func_80962D60;
+}
+
+void func_80962D60(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+ BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child;
+
+ if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bouceHeight < 40.0f) || (fuKaiten->bounceSpeed < 600)) {
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, 100, 10, 5, 5);
+ Math_SmoothStepToS(&fuKaiten->bounceSpeed, 600, 20, 10, 10);
+ Math_SmoothStepToF(&fuKaiten->bouceHeight, 40.0f, 0.1f, 1.0f, 1.0f);
+ return;
+ }
+
+ play_sound(NA_SE_SY_FOUND);
+ player->stateFlags1 &= ~0x20;
+ player->stateFlags3 |= 0x400000;
+ func_8010E9F0(4, 60);
+
+ if (this->unk_546 == 1) {
+ func_809616E0(this, globalCtx);
+ } else {
+ this->unk_546 = 1;
+ }
+
+ globalCtx->unk_1887D = 30;
+ func_80962F10(this);
+}
+
+void func_80962EBC(EnFu* this, GlobalContext* globalCtx) {
+ if (this->unk_542 != 0) {
+ if (this->actor.cutscene != -1) {
+ func_800DFB14(globalCtx->cameraPtrs[MAIN_CAM], ActorCutscene_GetCutscene(this->actor.cutscene)->unk4);
+ }
+ }
+}
+
+void func_80962F10(EnFu* this) {
+ this->unk_548 = 0;
+ this->actor.flags &= ~1;
+ gSaveContext.weekEventReg[8] |= 1;
+ this->actionFunc = func_80962F4C;
+}
+
+void func_80962F4C(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+ BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child;
+
+ switch (this->unk_542) {
+ case 0:
+ if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
+ player->stateFlags3 |= 0x400;
+ }
+ break;
+
+ case 1:
+ globalCtx->unk_1887E = 30;
+ break;
+
+ case 2:
+ globalCtx->unk_1887D = 30;
+ break;
+ }
+
+ if (gSaveContext.unk_3DE0[4] < 2000) {
+ s16 val = D_80964B00[this->unk_542] + 200;
+
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
+ } else if (gSaveContext.unk_3DE0[4] < 4000) {
+ s16 val = D_80964B00[this->unk_542] + 100;
+
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
+ }
+
+ if (func_80961D10(this)) {
+ func_801518B0(globalCtx, 0x288B, &this->actor);
+ }
+
+ if ((!func_800CAF94((DynaPolyActor*)this->actor.child) && (player->actor.bgCheckFlags & 1)) ||
+ (gSaveContext.unk_3DE0[4] < 1) || (this->unk_548 == this->unk_54C)) {
+ player->stateFlags3 &= ~0x400000;
+ func_80961E88(globalCtx);
+ player->stateFlags1 |= 0x20;
+ if (this->unk_548 < this->unk_54C) {
+ if (gSaveContext.unk_3DE0[4] == 0) {
+ func_801518B0(globalCtx, 0x2885, &this->actor);
+ this->unk_552 = 0x2885;
+ } else {
+ func_801518B0(globalCtx, 0x2888, &this->actor);
+ this->unk_552 = 0x2888;
+ }
+ func_801A2C20();
+ gSaveContext.unk_3DE0[4] = 0;
+ gSaveContext.unk_3DD0[4] = 5;
+ this->unk_548 = 0;
+ func_809632D0(this);
+ } else {
+ this->unk_548 = 0;
+ func_801A2C20();
+ gSaveContext.unk_3DE0[4] = 0;
+ gSaveContext.unk_3DD0[4] = 5;
+ func_801A3098(0x922);
+ func_8011B4E0(globalCtx, 1);
+ this->unk_54A = 3;
+ func_809632D0(this);
+ }
+ }
+ func_80962EBC(this, globalCtx);
+}
+
+void func_80963258(EnFu* this) {
+ this->actionFunc = func_8096326C;
+}
+
+void func_8096326C(EnFu* this, GlobalContext* globalCtx) {
+ func_80963FF8(this, globalCtx);
+ if (func_80963810(globalCtx, this->actor.world.pos)) {
+ func_809622FC(this);
+ }
+}
+
+void func_809632D0(EnFu* this) {
+ if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
+ Interface_ChangeAlpha(50);
+ }
+
+ gSaveContext.weekEventReg[8] &= (u8)~0x1;
+
+ if (this->unk_2D4 != NULL) {
+ BgFuMizu* mizu = this->unk_2D4;
+
+ mizu->unk_160 = 0;
+ }
+
+ this->actor.flags |= 1;
+ this->actionFunc = func_80963350;
+}
+
+void func_80963350(EnFu* this, GlobalContext* globalCtx) {
+ static s32 D_80964C24 = 0;
+ BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child;
+
+ if ((this->unk_54A == 0) && (((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) ||
+ ((func_80152498(&globalCtx->msgCtx) == 2) && (globalCtx->msgCtx.unk12023 == 1)))) {
+ func_801477B4(globalCtx);
+ this->unk_54A = 2;
+ D_80964C24 = 1;
+ }
+
+ if ((this->unk_54A == 3) && (globalCtx->interfaceCtx.unk_286 == 0)) {
+ this->unk_54A = 2;
+ D_80964C24 = 1;
+ }
+
+ if ((fuKaiten->rotationSpeed != 0) || (fuKaiten->bounceSpeed != 0) || (fuKaiten->bouceHeight > 0.0f) ||
+ !func_809638F8(globalCtx)) {
+ Math_SmoothStepToS(&fuKaiten->rotationSpeed, 0, 10, 10, 5);
+ Math_SmoothStepToS(&fuKaiten->bounceSpeed, 0, 10, 15, 5);
+ Math_SmoothStepToF(&fuKaiten->bouceHeight, 0.0f, 0.1f, 1.0f, 1.0f);
+ Math_SmoothStepToF(&fuKaiten->elevation, 0.0f, 0.1f, 1.0f, 1.0f);
+ func_80962EBC(this, globalCtx);
+ } else if (D_80964C24 == 1) {
+ D_80964C24 = 0;
+ fuKaiten->bounce = 0;
+ func_80963F88(this, globalCtx);
+ globalCtx->actorCtx.unk268 = 1;
+ func_80963258(this);
+ }
+}
+
+void func_80963540(EnFu* this) {
+ this->actor.child->freezeTimer = 10;
+ this->actionFunc = func_80963560;
+}
+
+void func_80963560(EnFu* this, GlobalContext* globalCtx) {
+ if (Actor_HasParent(&this->actor, globalCtx)) {
+ this->actor.parent = NULL;
+ func_80963610(this);
+ } else if ((this->unk_552 == 0x2880) && !(gSaveContext.weekEventReg[22] & 0x80)) {
+ func_800B8A1C(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f);
+ } else {
+ func_800B8A1C(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f);
+ }
+ this->actor.child->freezeTimer = 10;
+}
+
+void func_80963610(EnFu* this) {
+ this->actor.child->freezeTimer = 10;
+ this->actionFunc = func_80963630;
+}
+
+void func_80963630(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20) && (CURRENT_DAY == 3) &&
+ (gSaveContext.playerForm == PLAYER_FORM_HUMAN)) {
+ if (gSaveContext.weekEventReg[22] & 0x40) {
+ func_801518B0(globalCtx, 0x2884, &this->actor);
+ this->unk_552 = 0x2884;
+ } else if (!(gSaveContext.weekEventReg[22] & 0x80)) {
+ gSaveContext.weekEventReg[22] |= 0x80;
+ func_801518B0(globalCtx, 0x2882, &this->actor);
+ this->unk_552 = 0x2882;
+ } else {
+ func_801518B0(globalCtx, 0x2881, &this->actor);
+ this->unk_552 = 0x2881;
+ }
+ } else {
+ func_801518B0(globalCtx, 0x287F, &this->actor);
+ this->unk_552 = 0x287F;
+ }
+
+ this->actor.flags &= ~0x10000;
+ this->actor.child->freezeTimer = 0;
+ func_809628BC(this);
+
+ if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
+ switch (CURRENT_DAY) {
+ case 1:
+ gSaveContext.weekEventReg[22] |= 0x10;
+ break;
+
+ case 2:
+ gSaveContext.weekEventReg[22] |= 0x20;
+ break;
+
+ case 3:
+ gSaveContext.weekEventReg[22] |= 0x40;
+ break;
+ }
+ }
+ player->stateFlags1 &= ~0x20;
+ } else {
+ this->actor.child->freezeTimer = 10;
+ func_800B85E0(&this->actor, globalCtx, 500.0f, -1);
+ }
+}
+
+s32 func_80963810(GlobalContext* globalCtx, Vec3f pos) {
+ Player* player = GET_PLAYER(globalCtx);
+ f32 sp28;
+ f32 phi_f0;
+ s16 sp22;
+
+ sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &pos);
+ sp28 = Math_Vec3f_DistXZ(&player->actor.world.pos, &pos);
+
+ if (sp28 < 80.0f) {
+ phi_f0 = 10.0f;
+ } else if (sp28 < 90.0f) {
+ phi_f0 = 40.0f;
+ } else {
+ phi_f0 = 80.0f;
+ }
+
+ globalCtx->actorCtx.unk268 = 1;
+ func_800B6F20(globalCtx, globalCtx->actorCtx.pad26C, phi_f0, sp22);
+
+ if (sp28 < 80.0f) {
+ return true;
+ }
+ return false;
+}
+
+s32 func_809638F8(GlobalContext* globalCtx) {
+ s32 ret = true;
+
+ if (globalCtx->envCtx.unk_8C.diffuseColor1[0] > 25) {
+ globalCtx->envCtx.unk_8C.diffuseColor1[0] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.diffuseColor1[0] = 0;
+ }
+
+ if (globalCtx->envCtx.unk_8C.diffuseColor1[1] > 25) {
+ globalCtx->envCtx.unk_8C.diffuseColor1[1] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.diffuseColor1[1] = 0;
+ }
+
+ if (globalCtx->envCtx.unk_8C.diffuseColor1[2] > 25) {
+ globalCtx->envCtx.unk_8C.diffuseColor1[2] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.diffuseColor1[2] = 0;
+ }
+
+ if (globalCtx->envCtx.unk_8C.ambientColor[0] > 25) {
+ globalCtx->envCtx.unk_8C.ambientColor[0] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.ambientColor[0] = 0;
+ }
+
+ if (globalCtx->envCtx.unk_8C.ambientColor[1] > 25) {
+ globalCtx->envCtx.unk_8C.ambientColor[1] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.ambientColor[1] = 0;
+ }
+
+ if (globalCtx->envCtx.unk_8C.ambientColor[2] > 25) {
+ globalCtx->envCtx.unk_8C.ambientColor[2] -= 25;
+ ret = false;
+ } else {
+ globalCtx->envCtx.unk_8C.ambientColor[2] = 0;
+ }
+ return ret;
+}
+
+void func_809639D0(EnFu* this, GlobalContext* globalCtx) {
+ switch (CURRENT_DAY) {
+ case 1:
+ if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
+ if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) {
+ func_801518B0(globalCtx, 0x2853, &this->actor);
+ this->unk_552 = 0x2853;
+ } else if (gSaveContext.weekEventReg[22] & 0x10) {
+ func_801518B0(globalCtx, 0x284D, &this->actor);
+ this->unk_552 = 0x284D;
+ } else if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x284F, &this->actor);
+ this->unk_552 = 0x284F;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x2851, &this->actor);
+ this->unk_552 = 0x2851;
+ }
+ } else {
+ func_801518B0(globalCtx, 0x286F, &this->actor);
+ this->unk_552 = 0x286F;
+ }
+ break;
+
+ case 2:
+ if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) {
+ func_801518B0(globalCtx, 0x286F, &this->actor);
+ this->unk_552 = 0x286F;
+ } else if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) {
+ func_801518B0(globalCtx, 0x2853, &this->actor);
+ this->unk_552 = 0x2853;
+ } else if (!(gSaveContext.weekEventReg[22] & 0x10)) {
+ if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x285B, &this->actor);
+ this->unk_552 = 0x285B;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x285D, &this->actor);
+ this->unk_552 = 0x285D;
+ }
+ } else if (gSaveContext.weekEventReg[22] & 0x20) {
+ func_801518B0(globalCtx, 0x2855, &this->actor);
+ this->unk_552 = 0x2855;
+ } else if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x2857, &this->actor);
+ this->unk_552 = 0x2857;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x2859, &this->actor);
+ this->unk_552 = 0x2859;
+ }
+ break;
+
+ case 3:
+ if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) {
+ if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
+ func_80963EAC(this, globalCtx);
+ } else {
+ func_801518B0(globalCtx, 0x2841, &this->actor);
+ this->unk_552 = 0x2841;
+ }
+ } else if (CUR_UPG_VALUE(UPG_QUIVER) == 0) {
+ func_801518B0(globalCtx, 0x284B, &this->actor);
+ this->unk_552 = 0x284B;
+ } else if (gSaveContext.weekEventReg[22] & 0x40) {
+ if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20)) {
+ func_801518B0(globalCtx, 0x285F, &this->actor);
+ this->unk_552 = 0x285F;
+ } else {
+ func_801518B0(globalCtx, 0x2861, &this->actor);
+ this->unk_552 = 0x2861;
+ }
+ } else if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20)) {
+ if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x2863, &this->actor);
+ this->unk_552 = 0x2863;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x2865, &this->actor);
+ this->unk_552 = 0x2865;
+ }
+ } else if ((gSaveContext.weekEventReg[22] & 0x10) || (gSaveContext.weekEventReg[22] & 0x20)) {
+ if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x2867, &this->actor);
+ this->unk_552 = 0x2867;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x2869, &this->actor);
+ this->unk_552 = 0x2869;
+ }
+ } else if (this->unk_53E == 1) {
+ func_801518B0(globalCtx, 0x286B, &this->actor);
+ this->unk_552 = 0x286B;
+ } else {
+ this->unk_53E = 1;
+ func_801518B0(globalCtx, 0x286D, &this->actor);
+ this->unk_552 = 0x286D;
+ }
+ break;
+ }
+}
+
+void func_80963DE4(EnFu* this, GlobalContext* globalCtx) {
+ switch (this->unk_542) {
+ case 0:
+ if (gSaveContext.playerForm != PLAYER_FORM_HUMAN) {
+ func_801518B0(globalCtx, 0x2875, &this->actor);
+ this->unk_552 = 0x2875;
+ } else {
+ func_801518B0(globalCtx, 0x2877, &this->actor);
+ this->unk_552 = 0x2877;
+ }
+ break;
+
+ case 1:
+ func_801518B0(globalCtx, 0x2879, &this->actor);
+ this->unk_552 = 0x2879;
+ break;
+
+ case 2:
+ func_801518B0(globalCtx, 0x287B, &this->actor);
+ this->unk_552 = 0x287B;
+ break;
+ }
+}
+
+void func_80963EAC(EnFu* this, GlobalContext* globalCtx) {
+ if (gSaveContext.magicAcquired) {
+ if (this->unk_540 == 1) {
+ func_801518B0(globalCtx, 0x2847, &this->actor);
+ this->unk_552 = 0x2847;
+ } else {
+ this->unk_540 = 1;
+ func_801518B0(globalCtx, 0x2845, &this->actor);
+ this->unk_552 = 0x2845;
+ }
+ } else {
+ func_801518B0(globalCtx, 0x2843, &this->actor);
+ this->unk_552 = 0x2843;
+ }
+}
+
+void func_80963F44(EnFu* this, GlobalContext* globalCtx) {
+ u16 sp1E = this->unk_552 + 1;
+
+ func_801518B0(globalCtx, sp1E, &this->actor);
+ this->unk_552 = sp1E;
+}
+
+void func_80963F88(EnFu* this, GlobalContext* globalCtx) {
+ if (this->unk_542 == 1) {
+ func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 75);
+ globalCtx->unk_1887E = 0;
+ } else if (this->unk_542 == 2) {
+ globalCtx->unk_1887D = 0;
+ func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 75);
+ }
+}
+
+void func_80963FF8(EnFu* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+
+ if (player->stateFlags1 & 0x100000) {
+ globalCtx->actorCtx.unk268 = 1;
+ globalCtx->actorCtx.unk278 = 0x8000;
+ } else {
+ globalCtx->actorCtx.unk268 = 1;
+ }
+}
+
+void func_80964034(EnFu* this, GlobalContext* globalCtx) {
+ Vec3f sp2C;
+
+ if (DECR(this->unk_54E) == 0) {
+ this->unk_54E = 12;
+ sp2C = this->actor.world.pos;
+ sp2C.y += 62.0f;
+ func_80964694(this, this->unk_2D8, &sp2C, ARRAY_COUNT(this->unk_2D8));
+ }
+ func_809647EC(globalCtx, this->unk_2D8, ARRAY_COUNT(this->unk_2D8));
+}
+
+void func_809640D8(EnFu* this, GlobalContext* globalCtx) {
+ if ((this->actionFunc == func_80962A10) || (this->actionFunc == func_80962BCC) ||
+ (this->actionFunc == func_80962D60) || (this->actionFunc == func_80962F4C) ||
+ (this->actionFunc == func_80963350)) {
+ this->actor.shape.rot.y += 0x400;
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ }
+}
+
+void func_8096413C(EnFu* this, GlobalContext* globalCtx) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_SUB(this->actor.yawTowardsPlayer, 0x4000), 5, 1000, 100);
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+}
+
+void func_80964190(EnFu* this, GlobalContext* globalCtx) {
+ if (func_80147624(globalCtx)) {
+ switch (this->unk_552) {
+ case 0x2842:
+ case 0x2844:
+ case 0x2848:
+ func_800BDC5C(&this->skelAnime, sAnimations, 1);
+ break;
+
+ case 0x2840:
+ case 0x2841:
+ case 0x2843:
+ case 0x2847:
+ case 0x2849:
+ case 0x284B:
+ case 0x284D:
+ case 0x284F:
+ case 0x2851:
+ case 0x2853:
+ case 0x2855:
+ case 0x2857:
+ case 0x2859:
+ case 0x285B:
+ case 0x285D:
+ case 0x2861:
+ case 0x2863:
+ case 0x2865:
+ case 0x2867:
+ case 0x2869:
+ case 0x286B:
+ case 0x286D:
+ case 0x2871:
+ func_800BDC5C(&this->skelAnime, sAnimations, 4);
+ break;
+
+ case 0x2860:
+ func_800BDC5C(&this->skelAnime, sAnimations, 5);
+ break;
+
+ case 0x285F:
+ func_800BDC5C(&this->skelAnime, sAnimations, 6);
+ break;
+
+ case 0x287E:
+ case 0x2880:
+ case 0x2883:
+ func_800BDC5C(&this->skelAnime, sAnimations, 2);
+ break;
+ }
+ }
+}
+
+void func_8096426C(EnFu* this, GlobalContext* globalCtx) {
+ if (func_80147624(globalCtx)) {
+ switch (this->unk_552) {
+ case 0x2840:
+ case 0x2841:
+ case 0x2843:
+ case 0x2847:
+ case 0x2849:
+ case 0x284D:
+ case 0x284F:
+ case 0x2851:
+ case 0x2853:
+ case 0x2855:
+ case 0x2857:
+ case 0x2859:
+ case 0x285B:
+ case 0x285D:
+ case 0x2861:
+ case 0x2863:
+ case 0x2865:
+ case 0x2867:
+ case 0x2869:
+ case 0x286B:
+ case 0x286D:
+ case 0x2871:
+ case 0x2875:
+ case 0x2877:
+ case 0x2879:
+ case 0x287B:
+ case 0x287D:
+ this->unk_53C = 1;
+ break;
+
+ case 0x2848:
+ case 0x284A:
+ case 0x284E:
+ case 0x2850:
+ case 0x2852:
+ case 0x2856:
+ case 0x2858:
+ case 0x285A:
+ case 0x285C:
+ case 0x285E:
+ case 0x2860:
+ case 0x2862:
+ case 0x2864:
+ case 0x2866:
+ case 0x2868:
+ case 0x286A:
+ case 0x286C:
+ case 0x286E:
+ this->unk_53C = 2;
+ break;
+
+ default:
+ this->unk_53C = 0;
+ break;
+ }
+ }
+}
+
+void func_809642E0(EnFu* this, GlobalContext* globalCtx) {
+ Collider_UpdateCylinder(&this->actor, &this->collider);
+ if (this->unk_542 == 0) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+}
+
+void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnFu* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+
+ func_809642E0(this, globalCtx);
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ func_8096209C(this, globalCtx);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
+ SkelAnime_Update(&this->skelAnime);
+ func_80961D7C(globalCtx);
+ func_809640D8(this, globalCtx);
+ func_80964034(this, globalCtx);
+}
+
+s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnFu* this = THIS;
+
+ if (limbIndex == 9) {
+ Matrix_InsertTranslation(1600.0f, 300.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_524[1], MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_524[0], MTXMODE_APPLY);
+ Matrix_RotateY(this->unk_524[2], MTXMODE_APPLY);
+ Matrix_InsertTranslation(-1600.0f, -300.0f, 0.0f, MTXMODE_APPLY);
+ } else if (limbIndex == 20) {
+ Matrix_InsertTranslation(1800.0f, 200.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_52A[1], MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_52A[0], MTXMODE_APPLY);
+ Matrix_RotateY(this->unk_52A[2], MTXMODE_APPLY);
+ Matrix_InsertTranslation(-1800.0f, -200.0f, 0.0f, MTXMODE_APPLY);
+ }
+ return false;
+}
+
+void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ static Vec3f D_80964C28 = { -2500.0f, 0.0f, 0.0f };
+ static Vec3f D_80964C34 = { -3500.0f, 0.0f, 0.0f };
+ EnFu* this = THIS;
+
+ if (limbIndex == 9) {
+ Matrix_MultiplyVector3fByState(&D_80964C28, &this->unk_508);
+ } else if (limbIndex == 20) {
+ Matrix_MultiplyVector3fByState(&D_80964C34, &this->unk_514);
+ }
+}
+
+void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ EnFu* this = THIS;
+
+ Matrix_StatePush();
+ func_80964950(globalCtx, this->unk_2D8, ARRAY_COUNT(this->unk_2D8));
+ Matrix_StatePop();
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gDPPipeSync(POLY_OPA_DISP++);
+ gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 0, 50, 160, 0));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0));
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, &this->actor);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len) {
+ Vec3f sp2C = { 0.0f, 1.5f, 0.0f };
+ Vec3f sp20 = { 0.0f, 0.0f, 0.0f };
+ s32 i = 0;
+
+ while ((i < len) && (ptr->unk_36 != 0)) {
+ i++;
+ ptr++;
+ }
+
+ if (i < len) {
+ ptr->unk_36 = 1;
+ ptr->unk_08 = *arg2;
+ ptr->unk_20 = sp2C;
+ ptr->unk_14 = sp20;
+ ptr->unk_00 = 0.01f;
+
+ ptr->unk_08.x += 4.0f * Math_SinS(this->actor.shape.rot.y);
+ ptr->unk_08.z += 4.0f * Math_CosS(this->actor.shape.rot.y);
+ ptr->unk_37 = 16;
+ }
+}
+
+void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) {
+ Vec3f sp44 = { 0.0f, 0.0f, 0.0f };
+ s16 activeCam = func_800DFC68(GET_ACTIVE_CAM(globalCtx));
+ s32 i;
+
+ for (i = 0; i < len; i++, ptr++) {
+ if (ptr->unk_36 == 1) {
+ if (DECR(ptr->unk_37) == 0) {
+ ptr->unk_36 = false;
+ }
+ ptr->unk_08.y += ptr->unk_20.y;
+ ptr->unk_08.x += 2.0f * Math_SinS(ptr->unk_2C);
+ ptr->unk_08.z += 2.0f * Math_CosS(ptr->unk_2C);
+ Matrix_StatePush();
+ Matrix_InsertTranslation(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW);
+ Matrix_RotateY(activeCam, MTXMODE_APPLY);
+ Matrix_MultiplyVector3fByState(&sp44, &ptr->unk_08);
+ Matrix_StatePop();
+ ptr->unk_2C += 6000;
+ }
+ }
+}
+
+void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) {
+ s32 i;
+ s32 flag = false;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
+ POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
+
+ for (i = 0; i < len; i++, ptr++) {
+ if (ptr->unk_36 == 1) {
+ if (!flag) {
+ gSPDisplayList(POLY_OPA_DISP++, D_0600B0A0);
+ flag = true;
+ }
+ Matrix_InsertTranslation(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_Scale(ptr->unk_00, ptr->unk_00, ptr->unk_00, MTXMODE_APPLY);
+
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_0405E6F0));
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, D_0600B0E0);
+ }
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h
index 61aefe315..b16ea4620 100644
--- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h
+++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h
@@ -7,11 +7,48 @@ struct EnFu;
typedef void (*EnFuActionFunc)(struct EnFu*, GlobalContext*);
+#define ENFU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF)
+
+typedef struct {
+ /* 0x00 */ f32 unk_00;
+ /* 0x04 */ char unk_04[0x4];
+ /* 0x08 */ Vec3f unk_08;
+ /* 0x14 */ Vec3f unk_14;
+ /* 0x20 */ Vec3f unk_20;
+ /* 0x2C */ s16 unk_2C;
+ /* 0x2E */ char unk_2E[0x8];
+ /* 0x36 */ u8 unk_36;
+ /* 0x37 */ u8 unk_37;
+} EnFuUnkStruct; // size = 0x38
+
typedef struct EnFu {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x90];
+ /* 0x0144 */ ColliderCylinder collider;
+ /* 0x0190 */ SkelAnime skelAnime;
/* 0x01D4 */ EnFuActionFunc actionFunc;
- /* 0x01D8 */ char unk_1D8[0x37C];
+ /* 0x01D8 */ Vec3s jointTable[21];
+ /* 0x0256 */ Vec3s morphTable[21];
+ /* 0x02D4 */ BgFuMizu* unk_2D4;
+ /* 0x02D8 */ EnFuUnkStruct unk_2D8[10];
+ /* 0x0508 */ Vec3f unk_508;
+ /* 0x0514 */ Vec3f unk_514;
+ /* 0x0520 */ s32 unk_520;
+ /* 0x0524 */ s16 unk_524[3];
+ /* 0x052A */ s16 unk_52A[3];
+ /* 0x0530 */ char unk530[0x8];
+ /* 0x0538 */ Vec3s* unk_538;
+ /* 0x053C */ s16 unk_53C;
+ /* 0x053E */ s16 unk_53E;
+ /* 0x0540 */ s16 unk_540;
+ /* 0x0542 */ s16 unk_542;
+ /* 0x0544 */ s16 unk_544;
+ /* 0x0546 */ s16 unk_546;
+ /* 0x0548 */ s16 unk_548;
+ /* 0x054A */ s16 unk_54A;
+ /* 0x054C */ s16 unk_54C;
+ /* 0x054E */ s16 unk_54E;
+ /* 0x0550 */ s16 unk_550;
+ /* 0x0552 */ u16 unk_552;
} EnFu; // size = 0x554
extern const ActorInit En_Fu_InitVars;
diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h
index 2e5f62f4c..db37f2f2d 100644
--- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h
+++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h
@@ -11,7 +11,8 @@ typedef struct EnFuKago {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x18];
/* 0x015C */ EnFuKagoActionFunc actionFunc;
- /* 0x0160 */ char unk_160[0x1E0];
+ /* 0x0160 */ char unk_160[0x1DC];
+ /* 0x033C */ s16 unk_33C;
} EnFuKago; // size = 0x340
extern const ActorInit En_Fu_Kago_InitVars;
diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h
index 34b592021..51dbf177f 100644
--- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h
+++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h
@@ -11,7 +11,8 @@ typedef struct EnFuMato {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x18];
/* 0x015C */ EnFuMatoActionFunc actionFunc;
- /* 0x0160 */ char unk_160[0x1AC];
+ /* 0x0160 */ char unk_160[0x1AA];
+ /* 0x030A */ s16 unk_30A;
} EnFuMato; // size = 0x30C
extern const ActorInit En_Fu_Mato_InitVars;
diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c
index 2bf3bbd53..62da9b9f6 100644
--- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c
+++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_giant.c
+ * Overlay: ovl_En_Giant
+ * Description: Giant
+ */
+
#include "z_en_giant.h"
#define FLAGS 0x00000030
@@ -9,11 +15,10 @@ void EnGiant_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnGiant_Update(Actor* thisx, GlobalContext* globalCtx);
void EnGiant_Draw(Actor* thisx, GlobalContext* globalCtx);
-void func_80B023D0(EnGiant* this, GlobalContext* globalCtx);
-void func_80B024AC(EnGiant* this, GlobalContext* globalCtx);
-void func_80B024D8(EnGiant* this, GlobalContext* globalCtx);
+void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, GlobalContext* globalCtx);
+void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, GlobalContext* globalCtx);
+void EnGiant_PerformCutsceneActions(EnGiant* this, GlobalContext* globalCtx);
-#if 0
const ActorInit En_Giant_InitVars = {
ACTOR_EN_GIANT,
ACTORCAT_NPC,
@@ -26,42 +31,460 @@ const ActorInit En_Giant_InitVars = {
(ActorFunc)EnGiant_Draw,
};
-#endif
+extern AnimationHeader D_06002168;
+extern Gfx D_06005A80[];
+extern Gfx D_06006280[];
+extern Gfx D_06007610[];
+extern Gfx D_06006A80[];
+extern FlexSkeletonHeader D_060079B0;
+extern AnimationHeader D_06008394;
+extern AnimationHeader D_060096E4;
+extern AnimationHeader D_0600A1C4;
+extern AnimationHeader D_0600ACA4;
+extern AnimationHeader D_0600B784;
+extern AnimationHeader D_0600C5D4;
+extern AnimationHeader D_0600D040;
+extern AnimationHeader D_0600DE84;
+extern AnimationHeader D_060102A4;
+extern AnimationHeader D_060116E4;
+extern AnimationHeader D_06012A38;
+extern AnimationHeader D_06013004;
+extern AnimationHeader D_06013FE8;
+extern AnimationHeader D_06015334;
+extern AnimationHeader D_06017944;
-extern UNK_TYPE D_06002168;
-extern UNK_TYPE D_06007610;
-extern UNK_TYPE D_060116E4;
+static AnimationHeader* sAnimationTable[] = {
+ &D_06008394, &D_060096E4, &D_060102A4, &D_060116E4, &D_06012A38, &D_06013004, &D_06013FE8, &D_06015334,
+ &D_06017944, &D_0600A1C4, &D_0600D040, &D_0600DE84, &D_0600ACA4, &D_0600B784, &D_0600C5D4,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B01990.s")
+void EnGiant_ChangeAnimation(EnGiant* this, s16 newAnimationId) {
+ if (newAnimationId >= GIANT_ANIMATION_LOOK_UP_START && newAnimationId < GIANT_ANIMATION_MAX) {
+ if ((this->animationId == GIANT_ANIMATION_WALKING_LOOP && newAnimationId != GIANT_ANIMATION_WALKING_LOOP) ||
+ (newAnimationId == GIANT_ANIMATION_WALKING_LOOP && this->animationId != GIANT_ANIMATION_WALKING_LOOP)) {
+ Animation_Change(&this->skelAnime, sAnimationTable[newAnimationId], 1.0f, 0.0f,
+ Animation_GetLastFrame(&sAnimationTable[newAnimationId]->common), 2, 10.0f);
+ } else {
+ Animation_PlayOnce(&this->skelAnime, sAnimationTable[newAnimationId]);
+ }
+ this->animationId = newAnimationId;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B01A74.s")
+s32 EnGiant_IsImprisoned(EnGiant* this) {
+ switch (GIANT_TYPE(&this->actor)) {
+ case GIANT_TYPE_SWAMP_TERMINA_FIELD:
+ case GIANT_TYPE_SWAMP_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_SWAMP_GIANTS_CHAMBER_AND_ENDING:
+ case GIANT_TYPE_SWAMP_CLOCK_TOWER_FAILURE:
+ if (!CHECK_QUEST_ITEM(0)) {
+ return true;
+ }
+ break;
+ case GIANT_TYPE_MOUNTAIN_TERMINA_FIELD:
+ case GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_MOUNTAIN_GIANTS_CHAMBER_AND_ENDING:
+ case GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE:
+ if (!CHECK_QUEST_ITEM(1)) {
+ return true;
+ }
+ break;
+ case GIANT_TYPE_OCEAN_TERMINA_FIELD:
+ case GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING:
+ case GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE:
+ if (!CHECK_QUEST_ITEM(2)) {
+ return true;
+ }
+ break;
+ case GIANT_TYPE_CANYON_TERMINA_FIELD:
+ case GIANT_TYPE_CANYON_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_CANYON_GIANTS_CHAMBER_AND_ENDING:
+ case GIANT_TYPE_CANYON_CLOCK_TOWER_FAILURE:
+ if (!CHECK_QUEST_ITEM(3)) {
+ return true;
+ }
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/EnGiant_Init.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/EnGiant_Destroy.s")
+void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnGiant* this = THIS;
+ s32 type = GIANT_TYPE(thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B01E84.s")
+ this->actor.uncullZoneForward = 4000.0f;
+ this->actor.uncullZoneScale = 2000.0f;
+ this->actor.uncullZoneDownward = 2400.0f;
+ Actor_SetScale(&this->actor, 0.32f);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060079B0, &D_06002168, this->jointTable, this->morphTable, 16);
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP);
+ this->csAction = GIANT_CS_ACTION_NONE;
+ this->actionFunc = EnGiant_PerformCutsceneActions;
+ this->actor.draw = NULL;
+ this->alpha = 0;
+ this->actor.velocity.y = -10.0f;
+ this->actor.minVelocityY = -10.0f;
+ this->actor.gravity = -5.0f;
+ switch (type) {
+ case GIANT_TYPE_CANYON_TERMINA_FIELD:
+ case GIANT_TYPE_CANYON_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_CANYON_GIANTS_CHAMBER_AND_ENDING:
+ this->unk_24A = 0x1C6;
+ break;
+ case GIANT_TYPE_SWAMP_TERMINA_FIELD:
+ case GIANT_TYPE_SWAMP_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_SWAMP_GIANTS_CHAMBER_AND_ENDING:
+ this->unk_24A = 0x1C7;
+ break;
+ case GIANT_TYPE_OCEAN_TERMINA_FIELD:
+ case GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS:
+ case GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING:
+ this->unk_24A = 0x1C8;
+ break;
+ default:
+ this->unk_24A = 0x1C5;
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B01EE8.s")
+ if (GIANT_TYPE_IS_CLOCK_TOWER_SUCCESS(type)) {
+ if (!(gSaveContext.weekEventReg[0x19] & 2)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ this->unk_24A = 0x1C5;
+ Actor_SetScale(&this->actor, 0.32f);
+ this->actionFunc = EnGiant_PerformClockTowerSuccessActions;
+ Animation_Change(&this->skelAnime, &D_060116E4, 0.0f, Animation_GetLastFrame(&D_060116E4) - 1.0f,
+ Animation_GetLastFrame(&D_060116E4), 2, 0.0f);
+ this->actor.draw = EnGiant_Draw;
+ this->actor.velocity.y = 0.0f;
+ this->actor.minVelocityY = 0.0f;
+ this->actor.gravity = 0.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B020A0.s")
+ if (GIANT_TYPE_IS_CLOCK_TOWER_FAILURE(type)) {
+ Actor_SetScale(&this->actor, 0.32f);
+ this->actionFunc = EnGiant_PlayClockTowerFailureAnimation;
+ Animation_Change(&this->skelAnime, &D_06013FE8, 1.0f, 0.0f, Animation_GetLastFrame(&D_06013004), 0, 0.0f);
+ this->actor.draw = EnGiant_Draw;
+ this->actor.velocity.y = 0.0f;
+ this->actor.minVelocityY = 0.0f;
+ this->actor.gravity = 0.0f;
+ if (EnGiant_IsImprisoned(this)) {
+ Actor_MarkForDeath(&this->actor);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B0211C.s")
+ if (GIANT_TYPE_IS_NOT_TERMINA_FIELD(type)) {
+ this->alpha = 255;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B02234.s")
+ this->sfxId = 0xFFFF;
+ if (GIANT_TYPE_IS_CHAMBER_OR_ENDING(type)) {
+ switch (gSaveContext.sceneSetupIndex) {
+ case 0:
+ case 10:
+ this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE2 - SFX_FLAG;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE1 - SFX_FLAG;
+ break;
+ default:
+ this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE0 - SFX_FLAG;
+ break;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B02354.s")
+void EnGiant_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B023D0.s")
+/**
+ * The animations in sAnimationTable are organized such that looping animations
+ * appear immediately after their respective starting animations. The point of
+ * this function is to play the requested start animation if it has not been
+ * played yet and play the respetive looping animation otherwise.
+ */
+void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimationId) {
+ s16 nextAnimationId = requestedAnimationId + 1;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B024AC.s")
+ if (this->animationId != nextAnimationId) {
+ if (this->animationId != requestedAnimationId) {
+ EnGiant_ChangeAnimation(this, requestedAnimationId);
+ } else {
+ EnGiant_ChangeAnimation(this, nextAnimationId);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B024D8.s")
+/**
+ * Immediately switches to the specified animation for this cutscene action.
+ */
+void EnGiant_ChangeAnimationBasedOnCsAction(EnGiant* this) {
+ switch (this->csAction) {
+ case GIANT_CS_ACTION_IDLE:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP);
+ break;
+ case GIANT_CS_ACTION_WALKING:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP);
+ break;
+ case GIANT_CS_ACTION_STRUGGLING:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_STRUGGLE_START);
+ break;
+ case GIANT_CS_ACTION_FALLING_OVER:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_FALLING_OVER);
+ break;
+ case GIANT_CS_ACTION_IDLE_FADE_IN:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP);
+ this->alpha = 0;
+ break;
+ case GIANT_CS_ACTION_TALKING:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_START);
+ break;
+ case GIANT_CS_ACTION_DONE_TALKING:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_END);
+ break;
+ case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_START);
+ break;
+ case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_END);
+ break;
+ case GIANT_CS_ACTION_UNKNOWN_12:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP);
+ break;
+ case GIANT_CS_ACTION_UNKNOWN_13:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP);
+ break;
+ case GIANT_CS_ACTION_UNKNOWN_14:
+ if (this->animationId != GIANT_ANIMATION_WALKING_LOOP) {
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP);
+ }
+ break;
+ case GIANT_CS_ACTION_HOLDING_UP_MOON_IN_CLOCK_TOWER:
+ Animation_Change(&this->skelAnime, &D_060116E4, 0.0f, Animation_GetLastFrame(&D_060116E4) - 1.0f,
+ Animation_GetLastFrame(&D_060116E4), 2, 0.0f);
+ break;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/EnGiant_Update.s")
+void EnGiant_UpdateAlpha(EnGiant* this) {
+ switch (this->csAction) {
+ case GIANT_CS_ACTION_FALLING_OVER:
+ if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) {
+ this->alpha -= 12;
+ }
+ break;
+ case GIANT_CS_ACTION_UNKNOWN_14:
+ this->alpha -= 12;
+ break;
+ default:
+ if (this->alpha < 255) {
+ this->alpha += 8;
+ }
+ break;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B02688.s")
+/**
+ * Plays the currently specified animation and, if the animation is done playing,
+ * switches to the animation appropriate for the current cutscene action. This
+ * function can be used to play the appropriate starting or looping animation for
+ * a given cutscene action, depending on what animation has already been played.
+ */
+void EnGiant_PlayAndUpdateAnimation(EnGiant* this) {
+ if (SkelAnime_Update(&this->skelAnime) &&
+ (this->animationId != GIANT_ANIMATION_FALLING_OVER || this->csAction != GIANT_CS_ACTION_FALLING_OVER)) {
+ EnGiant_ChangeAnimation(this, this->animationId);
+ switch (this->csAction) {
+ case GIANT_CS_ACTION_LOOKING_UP:
+ EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_LOOK_UP_START);
+ break;
+ case GIANT_CS_ACTION_RAISING_ARMS:
+ EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_RAISED_ARMS_START);
+ break;
+ case GIANT_CS_ACTION_STRUGGLING:
+ EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_STRUGGLE_START);
+ break;
+ case GIANT_CS_ACTION_FALLING_OVER:
+ // Unused
+ EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_FALLING_OVER);
+ break;
+ case GIANT_CS_ACTION_TALKING:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_LOOP);
+ break;
+ case GIANT_CS_ACTION_DONE_TALKING:
+ case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP);
+ break;
+ case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER:
+ EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_LOOP);
+ break;
+ }
+ SkelAnime_Update(&this->skelAnime);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/func_80B026C4.s")
+void EnGiant_PlaySound(EnGiant* this) {
+ if (this->actor.draw != NULL && this->alpha > 0) {
+ if (this->animationId == GIANT_ANIMATION_WALKING_LOOP &&
+ (Animation_OnFrame(&this->skelAnime, 40.0f) || Animation_OnFrame(&this->skelAnime, 100.0f))) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EV_KYOJIN_WALK);
+ }
+ if (this->animationId == GIANT_ANIMATION_FALLING_OVER && Animation_OnFrame(&this->skelAnime, 40.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EV_KYOJIN_VOICE_FAIL);
+ }
+ if (this->sfxId != 0xFFFF &&
+ ((this->animationId == GIANT_ANIMATION_BIG_CALL_START && this->skelAnime.curFrame >= 18.0f) ||
+ this->animationId == GIANT_ANIMATION_BIG_CALL_LOOP)) {
+ func_800B9010(&this->actor, this->sfxId);
+ }
+ if ((this->animationId == GIANT_ANIMATION_SMALL_CALL_START && this->skelAnime.curFrame >= 18.0f) ||
+ this->animationId == GIANT_ANIMATION_SMALL_CALL_LOOP) {
+ func_800B9010(&this->actor, NA_SE_EV_KYOJIN_SIGN - SFX_FLAG);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Giant/EnGiant_Draw.s")
+void EnGiant_UpdatePosition(EnGiant* this, GlobalContext* globalCtx, u32 actionIndex) {
+ CsCmdActorAction* actorAction = globalCtx->csCtx.npcActions[actionIndex];
+ f32 floatUnk10 = actorAction->unk10;
+ s32 pad[2];
+ f32 floatUnk1C = actorAction->unk1C;
+ f32 functionTemp;
+
+ functionTemp = func_800F5A8C(actorAction->endFrame, actorAction->startFrame, globalCtx->csCtx.frames, globalCtx);
+ this->actor.world.pos.y = ((floatUnk1C - floatUnk10) * functionTemp) + floatUnk10;
+}
+
+void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, GlobalContext* globalCtx) {
+ if (func_800EE29C(globalCtx, this->unk_24A)) {
+ EnGiant_UpdatePosition(this, globalCtx, func_800EE200(globalCtx, this->unk_24A));
+ if (this->csAction != globalCtx->csCtx.npcActions[func_800EE200(globalCtx, this->unk_24A)]->unk0) {
+ this->csAction = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, this->unk_24A)]->unk0;
+ EnGiant_ChangeAnimationBasedOnCsAction(this);
+ }
+ EnGiant_UpdateAlpha(this);
+ }
+
+ EnGiant_PlaySound(this);
+ if (this->csAction == GIANT_CS_ACTION_STRUGGLING) {
+ func_800B9010(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG);
+ }
+ EnGiant_PlayAndUpdateAnimation(this);
+}
+
+void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, GlobalContext* globalCtx) {
+ SkelAnime_Update(&this->skelAnime);
+}
+
+void EnGiant_PerformCutsceneActions(EnGiant* this, GlobalContext* globalCtx) {
+ this->actor.draw = EnGiant_Draw;
+
+ if (func_800EE29C(globalCtx, this->unk_24A)) {
+ func_800EDF24(&this->actor, globalCtx, func_800EE200(globalCtx, this->unk_24A));
+ if (this->csAction != globalCtx->csCtx.npcActions[func_800EE200(globalCtx, this->unk_24A)]->unk0) {
+ this->csAction = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, this->unk_24A)]->unk0;
+ EnGiant_ChangeAnimationBasedOnCsAction(this);
+ }
+ EnGiant_UpdateAlpha(this);
+ }
+
+ if (GIANT_TYPE_IS_TERMINA_FIELD(GIANT_TYPE(&this->actor)) && EnGiant_IsImprisoned(this)) {
+ this->actor.draw = NULL;
+ }
+
+ EnGiant_PlaySound(this);
+ EnGiant_PlayAndUpdateAnimation(this);
+}
+
+void EnGiant_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnGiant* this = THIS;
+ s32 blinkTimerTemp;
+
+ this->actionFunc(this, globalCtx);
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
+
+ if (this->blinkTimer == 0) {
+ blinkTimerTemp = 0;
+ } else {
+ this->blinkTimer--;
+ blinkTimerTemp = this->blinkTimer;
+ }
+
+ if (!blinkTimerTemp) {
+ this->blinkTimer = Rand_S16Offset(60, 60);
+ }
+ this->faceIndex = this->blinkTimer;
+ if (this->faceIndex >= 3) {
+ this->faceIndex = 0;
+ }
+}
+
+void EnGiant_PostLimbDrawOpa(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ if (limbIndex == 1) {
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ gSPDisplayList(POLY_OPA_DISP++, D_06007610);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
+
+void EnGiant_PostLimbDrawXlu(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx,
+ Gfx** gfx) {
+ EnGiant* this = THIS;
+
+ if (limbIndex == 1) {
+ Matrix_CopyCurrentState(&this->unk_254);
+ }
+}
+
+void EnGiant_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ EnGiant* this = THIS;
+
+ /**
+ * 0 = eyes fully open face
+ * 1 = eyes half-closed face
+ * 2 = eyes fully closed face
+ */
+ static TexturePtr sFaceTextures[] = { D_06005A80, D_06006280, D_06006A80 };
+
+ if (this->alpha > 0) {
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ if (this->alpha >= 255) {
+ func_8012C28C(globalCtx->state.gfxCtx);
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sFaceTextures[this->faceIndex]));
+ gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
+ Scene_SetRenderModeXlu(globalCtx, 0, 1);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, NULL, EnGiant_PostLimbDrawOpa, thisx);
+ } else if (this->alpha > 0) {
+ if (this->alpha >= 129) {
+ func_8012C2B4(POLY_XLU_DISP++);
+ Scene_SetRenderModeXlu(globalCtx, 2, 2);
+ } else {
+ func_8012C304(POLY_XLU_DISP++);
+ Scene_SetRenderModeXlu(globalCtx, 1, 2);
+ }
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sFaceTextures[this->faceIndex]));
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha);
+ POLY_XLU_DISP =
+ SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, NULL, EnGiant_PostLimbDrawXlu, thisx, POLY_XLU_DISP);
+ Matrix_InsertMatrix(&this->unk_254, MTXMODE_NEW);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, D_06007610);
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.h b/src/overlays/actors/ovl_En_Giant/z_en_giant.h
index 9c75272fa..6f50370f7 100644
--- a/src/overlays/actors/ovl_En_Giant/z_en_giant.h
+++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.h
@@ -3,14 +3,107 @@
#include "global.h"
+#define GIANT_TYPE(thisx) ((thisx)->params & 0xF)
+#define GIANT_TYPE_IS_NOT_TERMINA_FIELD(type) (type > GIANT_TYPE_OCEAN_TERMINA_FIELD)
+#define GIANT_TYPE_IS_TERMINA_FIELD(type) (type <= GIANT_TYPE_OCEAN_TERMINA_FIELD)
+#define GIANT_TYPE_IS_CLOCK_TOWER_SUCCESS(type) (type >= GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_SUCCESS && type <= GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS)
+#define GIANT_TYPE_IS_CHAMBER_OR_ENDING(type) (type >= GIANT_TYPE_MOUNTAIN_GIANTS_CHAMBER_AND_ENDING && type <= GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING)
+#define GIANT_TYPE_IS_CLOCK_TOWER_FAILURE(type) (type >= GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE && type <= GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE)
+
+/**
+ * The giants are divided into types based on where in the game they appear.
+ * - TERMINA_FIELD: These appear in all non-ending cutscenes that take place in Termina Field.
+ * - CLOCK_TOWER_SUCCESS: These appear in the Clock Tower when the Oath to Order is played and all giants are freed.
+ * - GIANTS_CHAMBER_AND_ENDING: These giants appear in the Giant's Chamber or in all cutscenes that play after defeating Majora.
+ * - CLOCK_TOWER_FAILURE: These appear in the Clock Tower when the Oath to Order is played and all giants are NOT freed.
+ *
+ * The SWAMP, MOUNTAIN, OCEAN, and CANYON signifiers are used to identify which of the four giants it is,
+ * but the devs were not always consistent about this. For example, the giants in the Giant's Chamber are
+ * always GIANT_TYPE_MOUNTAIN_GIANTS_CHAMBER_AND_ENDING, regardless of which boss was just defeated. These
+ * are named such that EnGiant_IsImprisoned has the expected behavior; the devs were only inconsistent in
+ * the cases where they weren't calling this function.
+ */
+typedef enum {
+ /* 0 */ GIANT_TYPE_MOUNTAIN_TERMINA_FIELD,
+ /* 1 */ GIANT_TYPE_CANYON_TERMINA_FIELD,
+ /* 2 */ GIANT_TYPE_SWAMP_TERMINA_FIELD,
+ /* 3 */ GIANT_TYPE_OCEAN_TERMINA_FIELD,
+ /* 4 */ GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_SUCCESS,
+ /* 5 */ GIANT_TYPE_CANYON_CLOCK_TOWER_SUCCESS,
+ /* 6 */ GIANT_TYPE_SWAMP_CLOCK_TOWER_SUCCESS,
+ /* 7 */ GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS,
+ /* 8 */ GIANT_TYPE_MOUNTAIN_GIANTS_CHAMBER_AND_ENDING,
+ /* 9 */ GIANT_TYPE_CANYON_GIANTS_CHAMBER_AND_ENDING,
+ /* 10 */ GIANT_TYPE_SWAMP_GIANTS_CHAMBER_AND_ENDING,
+ /* 11 */ GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING,
+ /* 12 */ GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE,
+ /* 13 */ GIANT_TYPE_CANYON_CLOCK_TOWER_FAILURE,
+ /* 14 */ GIANT_TYPE_SWAMP_CLOCK_TOWER_FAILURE,
+ /* 15 */ GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE,
+} GiantType;
+
+/**
+ * These values are used to index into sAnimationTable to pick the appropriate animation.
+ */
+typedef enum {
+ /* 0 */ GIANT_ANIMATION_LOOK_UP_START,
+ /* 1 */ GIANT_ANIMATION_LOOK_UP_LOOP,
+ /* 2 */ GIANT_ANIMATION_FALLING_OVER,
+ /* 3 */ GIANT_ANIMATION_RAISED_ARMS_START,
+ /* 4 */ GIANT_ANIMATION_RAISED_ARMS_LOOP,
+ /* 5 */ GIANT_ANIMATION_STRUGGLE_START,
+ /* 6 */ GIANT_ANIMATION_STRUGGLE_LOOP,
+ /* 7 */ GIANT_ANIMATION_IDLE_LOOP,
+ /* 8 */ GIANT_ANIMATION_WALKING_LOOP,
+ /* 9 */ GIANT_ANIMATION_BIG_CALL_START,
+ /* 10 */ GIANT_ANIMATION_BIG_CALL_LOOP,
+ /* 11 */ GIANT_ANIMATION_BIG_CALL_END,
+ /* 12 */ GIANT_ANIMATION_SMALL_CALL_START,
+ /* 13 */ GIANT_ANIMATION_SMALL_CALL_LOOP,
+ /* 14 */ GIANT_ANIMATION_SMALL_CALL_END,
+ /* 15 */ GIANT_ANIMATION_MAX
+} GiantAnimationIndex;
+
+/**
+ * Used as values for csAction. The UNKNOWN ones are never used in-game.
+ */
+typedef enum {
+ /* 0 */ GIANT_CS_ACTION_NONE,
+ /* 1 */ GIANT_CS_ACTION_IDLE,
+ /* 2 */ GIANT_CS_ACTION_WALKING,
+ /* 3 */ GIANT_CS_ACTION_LOOKING_UP,
+ /* 4 */ GIANT_CS_ACTION_RAISING_ARMS,
+ /* 5 */ GIANT_CS_ACTION_STRUGGLING,
+ /* 6 */ GIANT_CS_ACTION_FALLING_OVER,
+ /* 7 */ GIANT_CS_ACTION_IDLE_FADE_IN,
+ /* 8 */ GIANT_CS_ACTION_TALKING,
+ /* 9 */ GIANT_CS_ACTION_DONE_TALKING,
+ /* 10 */ GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER,
+ /* 11 */ GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER,
+ /* 12 */ GIANT_CS_ACTION_UNKNOWN_12,
+ /* 13 */ GIANT_CS_ACTION_UNKNOWN_13,
+ /* 14 */ GIANT_CS_ACTION_UNKNOWN_14,
+ /* 15 */ GIANT_CS_ACTION_HOLDING_UP_MOON_IN_CLOCK_TOWER
+} GiantCsActionIndex;
+
struct EnGiant;
typedef void (*EnGiantActionFunc)(struct EnGiant*, GlobalContext*);
typedef struct EnGiant {
- /* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x154];
- /* 0x0298 */ EnGiantActionFunc actionFunc;
+ /* 0x000 */ Actor actor;
+ /* 0x144 */ SkelAnime skelAnime;
+ /* 0x188 */ Vec3s jointTable[16];
+ /* 0x1E8 */ Vec3s morphTable[16];
+ /* 0x248 */ s16 animationId;
+ /* 0x24A */ u16 unk_24A;
+ /* 0x24C */ u16 csAction;
+ /* 0x24E */ s16 alpha;
+ /* 0x250 */ u16 sfxId;
+ /* 0x254 */ MtxF unk_254;
+ /* 0x294 */ s16 faceIndex;
+ /* 0x296 */ s16 blinkTimer;
+ /* 0x298 */ EnGiantActionFunc actionFunc;
} EnGiant; // size = 0x29C
extern const ActorInit En_Giant_InitVars;
diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
index 25f89e6f7..9997acd54 100644
--- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
+++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c
@@ -63,8 +63,7 @@ void EnGinkoMan_Init(Actor* thisx, GlobalContext* globalCtx) {
this->isStampChecked = false;
this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET;
this->serviceFee = 0;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600C240, &D_060043F0, this->limbDrawTbl, this->transitionDrawTbl,
- 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600C240, &D_060043F0, this->jointTable, this->morphTable, 16);
EnGinkoMan_SetupIdle(this);
}
@@ -496,8 +495,7 @@ void EnGinkoMan_Dialogue(EnGinkoMan* this, GlobalContext* globalCtx) {
break;
}
- if ((this->skelAnime.animCurrentSeg == &D_060008C0) &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if ((this->skelAnime.animation == &D_060008C0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_BANK_MAN_HAND_HIT);
}
}
@@ -566,11 +564,11 @@ void EnGinkoMan_SetupStamp(EnGinkoMan* this) {
void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) {
if ((this->curTextId == 0x464) // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt."
- && (func_801378B8(&this->skelAnime, 10.0f))) {
+ && (Animation_OnFrame(&this->skelAnime, 10.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HANKO); // "stamp"
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
switch (this->curTextId) {
case 0x464: // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt."
func_800BDC5C(&this->skelAnime, animations, GINKO_SITTING);
@@ -597,12 +595,12 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) {
void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, GlobalContext* globalCtx) {
if (this->actor.xzDistToPlayer > 160.0f) {
if (this->animTimer == 0) {
- if (this->skelAnime.animCurrentSeg != &D_06004A7C) {
+ if (this->skelAnime.animation != &D_06004A7C) {
this->animTimer = 40;
func_800BDC5C(&this->skelAnime, animations, GINKO_ADVERTISING);
}
}
- } else if ((this->animTimer == 0) && (this->skelAnime.animCurrentSeg != &D_06000AC4)) {
+ } else if ((this->animTimer == 0) && (this->skelAnime.animation != &D_06000AC4)) {
this->animTimer = 40;
func_800BDC5C(&this->skelAnime, animations, GINKO_AMAZED);
}
@@ -611,8 +609,8 @@ void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, GlobalContext* globalCtx) {
}
void EnGinkoMan_FacePlayer(EnGinkoMan* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (this->skelAnime.animCurrentSeg != &D_06004A7C) {
+ SkelAnime_Update(&this->skelAnime);
+ if (this->skelAnime.animation != &D_06004A7C) {
func_800E9250(globalCtx, &this->actor, &this->limb15Rot, &this->limb8Rot, this->actor.focus.pos);
} else {
func_800E8F08(&this->limb15Rot, &this->limb8Rot);
@@ -629,27 +627,27 @@ void EnGinkoMan_Update(Actor* thisx, GlobalContext* globalCtx) {
}
s32 EnGinkoMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- Actor* thisx) {
- EnGinkoMan* this = THIS;
+ Actor* arg) {
+ EnGinkoMan* this = (EnGinkoMan*)arg;
if (limbIndex == 15) {
*dList = D_0600B1D8;
}
if (limbIndex == 15) {
- SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, 1);
- SysMatrix_InsertXRotation_s(this->limb15Rot.y, 1);
- SysMatrix_InsertZRotation_s(this->limb15Rot.x, 1);
- SysMatrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, 1);
+ Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->limb15Rot.y, 1);
+ Matrix_InsertZRotation_s(this->limb15Rot.x, 1);
+ Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else if (limbIndex == 8) {
- SysMatrix_InsertXRotation_s(-this->limb8Rot.y, 1);
- SysMatrix_InsertZRotation_s(-this->limb8Rot.x, 1);
+ Matrix_InsertXRotation_s(-this->limb8Rot.y, 1);
+ Matrix_InsertZRotation_s(-this->limb8Rot.x, 1);
}
return 0;
}
-void EnGinkoMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+void EnGinkoMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
}
void EnGinkoMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
@@ -663,8 +661,8 @@ void EnGinkoMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 50, 80, 0, 0));
gDPPipeSync(POLY_OPA_DISP++);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- &EnGinkoMan_OverrideLimbDraw, &EnGinkoMan_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnGinkoMan_OverrideLimbDraw, EnGinkoMan_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
index ce992c0b3..e605be1d6 100644
--- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
+++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h
@@ -11,8 +11,8 @@ typedef struct EnGinkoMan {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ EnGinkoManActionFunc actionFunc;
- /* 0x18C */ Vec3s limbDrawTbl[0x10];
- /* 0x1EC */ Vec3s transitionDrawTbl[0x10];
+ /* 0x18C */ Vec3s jointTable[0x10];
+ /* 0x1EC */ Vec3s morphTable[0x10];
/* 0x24C */ Vec3s limb15Rot;
/* 0x252 */ Vec3s limb8Rot;
/* 0x258 */ s16 curTextId;
diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
index 32c8cac05..71e0c8cd0 100644
--- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
+++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c
@@ -80,7 +80,7 @@ void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 19.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable, 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06006C90, &D_06000B04, this->jointTable, this->morphTable, 16);
this->actor.targetMode = 0;
if (this->actor.params != 2) {
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -112,9 +112,9 @@ void EnGuruguru_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void EnGuruguru_ChangeAnimation(EnGuruguru* this, s32 arg1) {
- this->frameCount = SkelAnime_GetFrameCount(&D_80BC79CC[arg1]->common);
- SkelAnime_ChangeAnim(&this->skelAnime, D_80BC79CC[arg1], D_80BC79D8[arg1], 0.0f, this->frameCount, D_80BC79D4[arg1],
- -4.0f);
+ this->frameCount = Animation_GetLastFrame(D_80BC79CC[arg1]);
+ Animation_Change(&this->skelAnime, D_80BC79CC[arg1], D_80BC79D8[arg1], 0.0f, this->frameCount, D_80BC79D4[arg1],
+ -4.0f);
}
void EnGuruguru_DoNothing(EnGuruguru* this, GlobalContext* globalCtx) {
@@ -152,9 +152,9 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) {
s16 yaw;
s16 yawTemp;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk270 != 0) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->textIdIndex = 3;
if (player->transformation == PLAYER_FORM_DEKU) {
@@ -178,7 +178,7 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) {
}
void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk268 != 0) &&
(player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU)) {
@@ -191,10 +191,10 @@ void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) {
}
void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->unk268 != 0) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
} else if (this->unusedTimer == 0) {
this->unusedTimer = 6;
if (func_80152498(&globalCtx->msgCtx) != 5) {
@@ -262,11 +262,11 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) {
this->texIndex = 1;
}
if ((this->unk268 != 0) && (this->textIdIndex >= 7)) {
- this->skelAnime.animPlaybackSpeed = 2.0f;
+ this->skelAnime.playSpeed = 2.0f;
func_801A29D4(3, 1.18921f, 2);
func_801A3B48(0);
} else {
- if (this->skelAnime.animPlaybackSpeed == 2.0f) {
+ if (this->skelAnime.playSpeed == 2.0f) {
func_801A29D4(3, 1.0f, 2);
}
if (this->unk268 == 0) {
@@ -274,7 +274,7 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) {
} else {
func_801A3B48(0);
}
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
}
this->unk266 = 1;
func_80151938(globalCtx, textIDs[this->textIdIndex]);
@@ -295,7 +295,7 @@ void func_80BC73F4(EnGuruguru* this) {
}
void func_80BC7440(EnGuruguru* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL;
this->textIdIndex++;
@@ -311,7 +311,7 @@ void func_80BC7440(EnGuruguru* this, GlobalContext* globalCtx) {
}
void func_80BC7520(EnGuruguru* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (func_800B84D0(&this->actor, globalCtx)) {
this->actionFunc = func_80BC7068;
} else {
@@ -322,7 +322,7 @@ void func_80BC7520(EnGuruguru* this, GlobalContext* globalCtx) {
void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) {
EnGuruguru* this = THIS;
s32 yaw;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yawTemp;
if (!gSaveContext.isNight) {
@@ -394,7 +394,7 @@ void EnGuruguru_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->texIndex]));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->texIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnGuruguru_OverrideLimbDraw, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnGuruguru_OverrideLimbDraw, NULL, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c
index 779e32edd..7de50c75d 100644
--- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c
+++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c
@@ -27,8 +27,8 @@ void func_80BCF6D0(EnHg* this, GlobalContext* globalCtx);
void func_80BCF8A0(EnHg* this, GlobalContext* globalCtx);
void func_80BCF93C(EnHg* this);
void func_80BCF95C(EnHg* this, GlobalContext* globalCtx);
-s32 EnHg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
-void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
+s32 EnHg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg);
+void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg);
extern AnimationHeader D_06000370;
extern AnimationHeader D_06001138;
@@ -127,8 +127,8 @@ void EnHg_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 i;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06008580, &D_0600260C, this->limbDrawTbl, this->transitionDrawTbl,
- HG_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06008580, &D_0600260C, this->jointTable, this->morphTable,
+ HG_LIMB_MAX);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2);
@@ -178,13 +178,13 @@ void func_80BCF468(EnHg* this) {
}
void func_80BCF4AC(EnHg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
this->actor.speedXZ = 1.6f;
if (!(player->stateFlags2 & 0x08000000) && !func_80152498(&globalCtx->msgCtx)) {
- if (((this->skelAnime.animCurrentFrame > 9.0f) && (this->skelAnime.animCurrentFrame < 16.0f)) ||
- ((this->skelAnime.animCurrentFrame > 44.0f) && (this->skelAnime.animCurrentFrame < 51.0f))) {
+ if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) ||
+ ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) {
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3E8, 0x14);
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -202,7 +202,7 @@ void func_80BCF5F0(EnHg* this) {
}
void func_80BCF634(EnHg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos) < 200.0f) {
func_80BCF468(this);
@@ -215,7 +215,7 @@ void func_80BCF68C(EnHg* this) {
}
void func_80BCF6D0(EnHg* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80BCF5F0(this);
}
}
@@ -283,7 +283,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) {
this->cutscenes[3] = globalCtx->csCtx.npcActions[actionIndex]->unk0;
switch (globalCtx->csCtx.npcActions[actionIndex]->unk0) {
case 1:
- this->currentAnimation = NULL;
+ this->currentAnimation = 0;
func_800BDC5C(&this->skelAnime, sAnimations, 0);
break;
case 2:
@@ -314,7 +314,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) {
break;
}
} else {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
switch (this->currentAnimation) {
case 3:
this->currentAnimation = 4;
@@ -351,7 +351,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) {
}
void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->actor.colChkInfo.health == 1 && !(fabsf(this->actor.yDistToPlayer) >= 80.0f)) {
if (player->stateFlags2 & 0x08000000) {
@@ -393,7 +393,7 @@ void EnHg_Update(Actor* thisx, GlobalContext* globalCtx) {
EnHg* this = THIS;
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80BCF7D8(this, globalCtx);
func_80BCFC0C(this, globalCtx);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 0.0f, 5);
@@ -407,9 +407,9 @@ s32 EnHg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnHg* this = THIS;
if (limbIndex == HG_LIMB_HEAD) {
- SysMatrix_CopyCurrentState(&this->unk1D8);
+ Matrix_CopyCurrentState(&this->unk1D8);
} else if (limbIndex == HG_LIMB_PELVIS) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
}
@@ -418,9 +418,9 @@ void EnHg_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnHg_OverrideLimbDraw, EnHg_PostLimbDraw, &this->actor);
- SysMatrix_SetCurrentState(&this->unk1D8);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnHg_OverrideLimbDraw, EnHg_PostLimbDraw, &this->actor);
+ Matrix_SetCurrentState(&this->unk1D8);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06005E28);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.h b/src/overlays/actors/ovl_En_Hg/z_en_hg.h
index e6825ea45..489db0afb 100644
--- a/src/overlays/actors/ovl_En_Hg/z_en_hg.h
+++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.h
@@ -38,8 +38,8 @@ typedef struct EnHg {
/* 0x1D8 */ MtxF unk1D8;
/* 0x218 */ s32 unk218;
/* 0x21C */ s32 currentAnimation;
- /* 0x220 */ Vec3s limbDrawTbl[HG_LIMB_MAX];
- /* 0x292 */ Vec3s transitionDrawTbl[HG_LIMB_MAX];
+ /* 0x220 */ Vec3s jointTable[HG_LIMB_MAX];
+ /* 0x292 */ Vec3s morphTable[HG_LIMB_MAX];
/* 0x304 */ UNK_TYPE1 pad304[0xC];
/* 0x310 */ u16 cutscenes[4];
} EnHg; // size = 0x318
diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c
index 1d7dc33f6..b2e0a09d9 100644
--- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c
+++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c
@@ -106,7 +106,7 @@ void EnHoll_SetupAction(EnHoll* this) {
}
void EnHoll_SetPlayerSide(GlobalContext* globalCtx, EnHoll* this, Vec3f* transformedPlayerPos) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor_CalcOffsetOrientedToDrawRotation(&this->actor, transformedPlayerPos, &player->actor.world.pos);
this->playerSide = (transformedPlayerPos->z < 0.0f) ? EN_HOLL_BEHIND : EN_HOLL_BEFORE;
@@ -217,7 +217,7 @@ void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) {
}
void EnHoll_TransparentIdle(EnHoll* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 useViewEye = D_801D0D50 || globalCtx->csCtx.state != 0;
Vec3f transformedPlayerPos;
f32 enHollTop;
@@ -307,7 +307,7 @@ void EnHoll_RoomTransitionIdle(EnHoll* this, GlobalContext* globalCtx) {
void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) {
EnHoll* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0) && !(player->stateFlags1 & 0x200)) {
this->actionFunc(this, globalCtx);
@@ -330,7 +330,7 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
dl = Gfx_CallSetupDL(dl, dlIndex);
if (this->playerSide == EN_HOLL_BEHIND) {
- SysMatrix_InsertYRotation_f(M_PI, MTXMODE_APPLY);
+ Matrix_InsertYRotation_f(M_PI, MTXMODE_APPLY);
}
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(dl++, 0, 0, 0, 0, 0, this->alpha);
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index 389028cc5..fe421558f 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -199,11 +199,11 @@ s32 func_808F30B0(SkelAnime* skelAnime, s16 animIndex) {
ret = true;
frameCount = sAnimations[animIndex].frameCount;
if (frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&sAnimations[animIndex].animationSeg->common);
+ frameCount = Animation_GetLastFrame(sAnimations[animIndex].animationSeg);
}
- SkelAnime_ChangeAnim(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
- sAnimations[animIndex].frame, frameCount, sAnimations[animIndex].mode,
- sAnimations[animIndex].transitionRate);
+ Animation_Change(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
+ sAnimations[animIndex].frame, frameCount, sAnimations[animIndex].mode,
+ sAnimations[animIndex].transitionRate);
}
return ret;
}
@@ -251,7 +251,7 @@ s32 func_808F3310(EnIn* this, GlobalContext* globalCtx) {
}
s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->colliderJntSph.base.atFlags & AT_HIT) {
this->colliderJntSph.base.atFlags &= ~AT_HIT;
@@ -275,11 +275,11 @@ s32 func_808F33B8(void) {
}
void func_808F3414(EnIn* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
if (this->unk23D == 0) {
- this->unk494 = SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ this->unk494 = SkelAnime_Update(&this->skelAnime);
}
if (func_8013D5E8(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) {
sp30.x = player->actor.world.pos.x;
@@ -346,8 +346,8 @@ void func_808F374C(EnIn* this, GlobalContext* globalCtx) {
AnimationHeader* animations[] = { &D_06015E38, &D_06016A60, &D_060177AC, &D_06016484,
&D_060170DC, &D_06018240, &D_060187C8, &D_060198A8 };
- if (this->skelAnime.animCurrentSeg == &D_06016484 || this->skelAnime.animCurrentSeg == &D_060170DC) {
- if (func_801378B8(&this->skelAnime, 8.0f)) {
+ if (this->skelAnime.animation == &D_06016484 || this->skelAnime.animation == &D_060170DC) {
+ if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
func_8019F88C(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2);
if (Rand_ZeroOne() < 0.3f) {
func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_INGO_HORSE_NEIGH);
@@ -355,13 +355,13 @@ void func_808F374C(EnIn* this, GlobalContext* globalCtx) {
func_8019F1C0(&this->actor.projectedPos, NA_SE_IT_LASH);
}
}
- if (this->skelAnime.animCurrentSeg == &D_060198A8 && func_801378B8(&this->skelAnime, 20.0f)) {
+ if (this->skelAnime.animation == &D_060198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_VO_IN_CRY_0);
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->unk486 = this->unk488 %= 8;
- SkelAnime_ChangeAnim(&this->skelAnime, animations[this->unk488], 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&animations[this->unk488]->common), 2, -10.0f);
+ Animation_Change(&this->skelAnime, animations[this->unk488], 1.0f, 0.0f,
+ Animation_GetLastFrame(animations[this->unk488]), 2, -10.0f);
}
}
@@ -500,6 +500,8 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) {
u16 textId = 0;
if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK) {
+ s32 requiredScopeTemp;
+
if (!(gSaveContext.weekEventReg[63] & 0x40)) {
return 0x34A9;
} else if (this->unk4AC & 8) {
@@ -507,7 +509,6 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) {
} else {
textId = 0x34AF;
}
- dummy_label_895710:; // POSSIBLE FAKE MATCH
} else {
switch (arg2) {
case 0:
@@ -1259,9 +1260,10 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) {
return 1;
}
if (*arg3 == 1) {
- player = PLAYER;
+ s32 requiredScopeTemp;
+
+ player = GET_PLAYER(globalCtx);
func_808F5994(this, globalCtx, &player->actor.world.pos, 0xC80);
- dummy_label_895711:; // POSSIBLE FAKE MATCH
} else {
rotDiff = this->actor.home.rot.y - this->actor.world.rot.y;
if (rotDiff > 0x320) {
@@ -1397,7 +1399,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 30.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06014EA8, NULL, this->limbDrawTbl, this->transitionDrawTbl, 20);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06014EA8, NULL, this->jointTable, this->morphTable, 20);
func_808F30B0(&this->skelAnime, 0);
Collider_InitCylinder(globalCtx, &this->colliderCylinder);
Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit);
@@ -1413,8 +1415,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
if (type == ENIN_HORSE_RIDER_YELLOW_SHIRT || type == ENIN_HORSE_RIDER_BLUE_SHIRT) {
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
this->unk488 = 1;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06016A60, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_06016A60.common), 2,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_06016A60, 1.0f, 0.0f, Animation_GetLastFrame(&D_06016A60), 2, 0.0f);
Actor_SetScale(&this->actor, 0.01f);
this->unk23C = 0;
this->unk23D = 1;
@@ -1441,8 +1442,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
func_808F30B0(&this->skelAnime, 4);
}
if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 2) {
- this->skelAnime.animCurrentFrame =
- ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.animFrameCount;
+ this->skelAnime.curFrame = ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.endFrame;
}
if (this->unk4AC & 8) {
this->actionFunc = func_808F39DC;
@@ -1514,14 +1514,14 @@ void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void func_808F6334(EnIn* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 newUnk4C8;
newUnk4C8 = func_80152498(&globalCtx->msgCtx);
this->unk4C4 += this->unk4C0 != 0.0f ? 40.0f : -40.0f;
this->unk4C4 = CLAMP(this->unk4C4, 0.0f, 80.0f);
- SysMatrix_InsertTranslation(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY);
if (this == (EnIn*)player->targetActor &&
!(globalCtx->msgCtx.unk11F04 >= 0xFF && globalCtx->msgCtx.unk11F04 <= 0x200) && newUnk4C8 == 3 &&
this->unk4C8 == 3) {
@@ -1534,8 +1534,8 @@ void func_808F6334(EnIn* this, GlobalContext* globalCtx) {
this->unk4C8 = newUnk4C8;
}
-s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
- EnIn* this = THIS;
+s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg) {
+ EnIn* this = (EnIn*)arg;
s32 pad;
Gfx* sp50[] = {
NULL, NULL, D_060149A8, D_06014AE0, D_06014C30, D_060145D8, D_06014710,
@@ -1563,15 +1563,15 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
CLOSE_DISPS(globalCtx->state.gfxCtx);
if (limbIndex == 16) {
- SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk35A, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(-this->unk358, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk35A, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(-this->unk358, MTXMODE_APPLY);
+ Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
func_808F6334(this, globalCtx);
}
if (limbIndex == 9) {
Matrix_RotateY(this->unk360, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk35E, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk35E, MTXMODE_APPLY);
}
if (limbIndex == 9 || limbIndex == 10 || limbIndex == 13) {
rot->y += (s16)(Math_SinS(this->unk376[limbIndex]) * 200.0f);
@@ -1595,22 +1595,22 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return 0;
}
-void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnIn* this = THIS;
+void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnIn* this = (EnIn*)arg;
Vec3f sp50 = { 1600.0f, 0.0f, 0.0f };
Vec3f sp44 = { 0.0f, 0.0f, 0.0f };
if (limbIndex == 16) {
- SysMatrix_MultiplyVector3fByState(&sp50, &this->unk4B4);
+ Matrix_MultiplyVector3fByState(&sp50, &this->unk4B4);
Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk4B4);
}
if (this->unk23D == 0) {
Collider_UpdateSpheres(limbIndex, &this->colliderJntSph);
if (limbIndex == 4) {
- SysMatrix_MultiplyVector3fByState(&sp44, &this->unk248);
+ Matrix_MultiplyVector3fByState(&sp44, &this->unk248);
}
if (limbIndex == 7) {
- SysMatrix_MultiplyVector3fByState(&sp44, &this->unk254);
+ Matrix_MultiplyVector3fByState(&sp44, &this->unk254);
}
if (this->unk23C == 0) {
if (!(this->unk4AC & 8)) {
@@ -1640,7 +1640,7 @@ void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnIn_OverrideLimbDraw, EnIn_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnIn_OverrideLimbDraw, EnIn_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h
index e874ced5d..ca67df431 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.h
+++ b/src/overlays/actors/ovl_En_In/z_en_in.h
@@ -34,8 +34,8 @@ typedef struct EnIn {
/* 0x254 */ Vec3f unk254;
/* 0x260 */ u8 unk260;
/* 0x261 */ u8 unk261;
- /* 0x262 */ Vec3s limbDrawTbl[20];
- /* 0x2DA */ Vec3s transitionDrawTbl[20];
+ /* 0x262 */ Vec3s jointTable[20];
+ /* 0x2DA */ Vec3s morphTable[20];
/* 0x352 */ s16 unk352;
/* 0x354 */ s16 unk354;
/* 0x356 */ char unk356[0x2];
diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
index 1e5dd6e6e..42b9a6c91 100644
--- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
+++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
@@ -325,7 +325,7 @@ static Gfx* D_80B4E984[] = {
static s8 D_80B4E994 = 0;
-static s8 D_80B4E998 = NULL;
+static s8 D_80B4E998 = 0;
static s8 D_80B4E99C[] = { 0 };
@@ -1369,7 +1369,7 @@ void func_80B454BC(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void EnInvadepoh_SetSysMatrix(Vec3f* vec) {
- MtxF* sysMatrix = SysMatrix_GetCurrentState();
+ MtxF* sysMatrix = Matrix_GetCurrentState();
sysMatrix->wx = vec->x;
sysMatrix->wy = vec->y;
@@ -2160,7 +2160,7 @@ void func_80B474DC(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B47568(EnInvadepoh* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001D80, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06001D80, -6.0f);
this->collider.base.atFlags &= ~0x1;
this->collider.base.acFlags &= ~0x1;
this->collider.base.ocFlags1 &= ~0x1;
@@ -2202,8 +2202,8 @@ void func_80B47600(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B4770C(EnInvadepoh* this) {
- if (this->skelAnime.animCurrentSeg != &D_06001D80) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001D80, -6.0f);
+ if (this->skelAnime.animation != &D_06001D80) {
+ Animation_MorphToLoop(&this->skelAnime, &D_06001D80, -6.0f);
}
this->collider.base.atFlags |= 1;
this->collider.base.acFlags |= 1;
@@ -2231,7 +2231,7 @@ void func_80B47830(EnInvadepoh* this) {
this->collider.base.atFlags &= ~1;
this->collider.base.acFlags &= ~1;
this->collider.base.ocFlags1 |= 1;
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060006C8);
+ Animation_PlayLoop(&this->skelAnime, &D_060006C8);
func_800BCB70(&this->actor, 0x4000, 255, 0, 16);
this->alienAlpha = 255;
this->actor.draw = func_80B4DB14;
@@ -2256,7 +2256,7 @@ void func_80B47938(EnInvadepoh* this) {
this->collider.base.atFlags &= ~1;
this->collider.base.acFlags &= ~1;
this->collider.base.ocFlags1 &= ~1;
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06000608);
+ Animation_PlayLoop(&this->skelAnime, &D_06000608);
this->actor.flags &= ~1;
this->actionTimer = 10;
this->alienAlpha = 255;
@@ -2327,9 +2327,9 @@ void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B45080();
this->actor.update = func_80B47D30;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004E50, &D_06001D80, this->limbDrawTable,
- this->transitionDrawTable, 14);
- this->skelAnime.animCurrentFrame = (this->actor.params & 7) * this->skelAnime.animFrameCount * 0.125f;
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004E50, &D_06001D80, this->jointTable, this->morphTable,
+ 14);
+ this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.125f;
func_80B444BC(this, globalCtx);
func_80B442E4(this);
func_80B447C0(this, globalCtx);
@@ -2378,7 +2378,7 @@ void func_80B47D30(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
if (thisx->draw != NULL) {
- this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ this->animPlayFlag = SkelAnime_Update(&this->skelAnime);
}
Collider_UpdateCylinder(&this->actor, &this->collider);
@@ -2410,9 +2410,8 @@ void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, thisx);
this->actor.update = func_80B48060;
this->actor.draw = func_80B4E158;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004010, NULL, this->limbDrawTable, this->transitionDrawTable,
- 6);
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06004264);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004010, NULL, this->jointTable, this->morphTable, 6);
+ Animation_PlayLoop(&this->skelAnime, &D_06004264);
}
}
@@ -2429,19 +2428,19 @@ void func_80B48060(Actor* thisx, GlobalContext* globalCtx) {
}
temp = this->actor.params & 7;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[temp], 0x32);
if (this->actor.child != NULL) {
- SysMatrix_StatePush();
- SysMatrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y,
- this->actor.world.pos.z, &this->actor.shape.rot);
- SysMatrix_InsertTranslation(0, 57.0f, -36.0f, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY);
- SysMatrix_GetStateTranslation(&this->actor.child->world.pos);
- SysMatrix_CopyCurrentState(&unkMtx);
+ Matrix_StatePush();
+ Matrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
+ &this->actor.shape.rot);
+ Matrix_InsertTranslation(0, 57.0f, -36.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY);
+ Matrix_GetStateTranslation(&this->actor.child->world.pos);
+ Matrix_CopyCurrentState(&unkMtx);
func_8018219C(&unkMtx, &this->actor.child->shape.rot, 0);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
}
@@ -2454,9 +2453,8 @@ void func_80B481C4(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, &this->actor);
this->actor.update = func_80B4827C;
this->actor.draw = func_80B4E1B0;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004C30, NULL, this->limbDrawTable, this->transitionDrawTable,
- 6);
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06004E98);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004C30, NULL, this->jointTable, this->morphTable, 6);
+ Animation_PlayLoop(&this->skelAnime, &D_06004E98);
}
}
@@ -2468,12 +2466,12 @@ void func_80B4827C(Actor* thisx, GlobalContext* globalCtx) {
return;
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
void func_80B482D4(EnInvadepoh* this) {
this->actionTimer = 40;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002A8C, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06002A8C, -10.0f);
this->actor.draw = NULL;
this->actionFunc = func_80B48324;
}
@@ -2489,7 +2487,7 @@ void func_80B48324(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B48374(EnInvadepoh* this) {
this->actionTimer = 60;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002A8C, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06002A8C, -10.0f);
this->actor.draw = func_80B4E324;
this->actionFunc = func_80B483CC;
}
@@ -2521,7 +2519,7 @@ void func_80B4843C(EnInvadepoh* this) {
this->behaviorInfo.unk44 = 0.1f;
this->behaviorInfo.unk48 = 2000;
this->actionTimer = 50;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06007328, 2.0f, 0.0f, 0.0f, 0, -5.0f);
+ Animation_Change(&this->skelAnime, &D_06007328, 2.0f, 0.0f, 0.0f, 0, -5.0f);
this->actor.draw = func_80B4E324;
this->actionFunc = func_80B484EC;
}
@@ -2551,7 +2549,7 @@ void func_80B48588(EnInvadepoh* this) {
this->behaviorInfo.unk42 = 0;
this->behaviorInfo.unk44 = 0.28f;
this->behaviorInfo.unk48 = 7000;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009E58, -10.0f);
this->actor.draw = func_80B4E324;
this->actionFunc = func_80B48610;
}
@@ -2568,10 +2566,10 @@ void func_80B48620(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44F58();
this->actor.update = func_80B4873C;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->limbDrawTable,
- this->transitionDrawTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->jointTable, this->morphTable,
+ 23);
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &D_801D15BC, 5000, 0.05f, 0.3f, 0.12f);
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06009E58);
+ Animation_PlayLoop(&this->skelAnime, &D_06009E58);
func_80B482D4(this);
}
}
@@ -2586,7 +2584,7 @@ void func_80B4873C(Actor* thisx, GlobalContext* globalCtx) {
return;
}
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B45CE0(substruct);
if (substruct->unk40 != 0) {
this->actor.shape.rot.x = -substruct->unk40;
@@ -2604,7 +2602,7 @@ void func_80B487B4(EnInvadepoh* this) {
substruct->unk26.z = 0;
substruct->unk30 = 0.1f;
substruct->unk2C = 800;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06014088, -10.0f);
this->actionFunc = func_80B48848;
}
@@ -2621,7 +2619,7 @@ void func_80B48848(EnInvadepoh* this, GlobalContext* globalCtx) {
}
func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x46);
if (((this->actor.flags & 0x40) == 0x40) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
if (this->actionTimer > 0) {
@@ -2664,7 +2662,7 @@ void func_80B48948(EnInvadepoh* this) {
substruct->unk2C = 1000;
}
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
this->actionFunc = func_80B48AD4;
}
@@ -2681,8 +2679,10 @@ void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) {
}
if (this->rand == 0) {
+ s32 requiredScopeTemp;
+
if ((this->actor.xzDistToPlayer < 350.0f) && ((globalCtx->gameplayFrames & 0x60) != 0)) {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f;
temp_v1 -= this->actor.shape.rot.x;
substruct->unk26.x = CLAMP(temp_v1, -2500, 2500);
@@ -2690,9 +2690,6 @@ void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) {
temp_v1 = new_var3 * 0.7f;
substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40);
}
-
- dummy:;
-
} else {
substruct->unk26.x = 0;
substruct->unk26.y = 0;
@@ -2736,7 +2733,7 @@ void func_80B48DE4(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
this->actor.speedXZ = 0.0f;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
this->behaviorInfo.unk4C = 0;
substruct->unk30 = 0.05f;
substruct->unk2C = 1200;
@@ -2745,7 +2742,7 @@ void func_80B48DE4(EnInvadepoh* this) {
void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -2773,8 +2770,8 @@ void func_80B48FB0(Actor* thisx, GlobalContext* globalCtx) {
this->actor.update = func_80B490F0;
this->actor.draw = func_80B4E324;
this->actor.textId = 0x3330;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->limbDrawTable,
- this->transitionDrawTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06009E58, this->jointTable, this->morphTable,
+ 23);
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &D_801D15BC, 100, 0.03, 0.3, 0.03);
func_80B444F4(this, globalCtx);
EnInvadepoh_SetPathPointToWorldPos(this, 0);
@@ -2796,7 +2793,7 @@ void func_80B490F0(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
if (sp2C) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B45CE0(&this->behaviorInfo);
if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) {
func_800B8614(&this->actor, globalCtx, 100.0f);
@@ -3043,7 +3040,7 @@ void func_80B49B1C(Actor* thisx, GlobalContext* globalCtx) {
void func_80B49BD0(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06014088, -10.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -3075,7 +3072,7 @@ void func_80B49C38(EnInvadepoh* this, GlobalContext* globalCtx) {
}
if (((this->actor.flags & 0x40) == 0x40) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
if (this->clockTime >= 0.9999f) {
@@ -3087,13 +3084,13 @@ void func_80B49DA0(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 2000;
this->behaviorInfo.unk4C = 0;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
this->actionFunc = func_80B49DFC;
}
void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -3125,8 +3122,8 @@ void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) {
this->actor.objBankIndex = this->bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44F58();
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable,
- this->transitionDrawTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->jointTable, this->morphTable,
+ 23);
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &D_801D15BC, 100, 0.03, 0.3, 0.03);
func_80B44540(this, globalCtx);
func_80B44570(this);
@@ -3179,7 +3176,7 @@ void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
if (sp2C && this->actor.update != NULL) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B45CE0(&this->behaviorInfo);
if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) {
func_800B8614(&this->actor, globalCtx, 350.0f);
@@ -3192,7 +3189,7 @@ void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx) {
void func_80B4A2C0(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -3223,7 +3220,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) {
Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40);
if (this->actor.xzDistToPlayer < 300.0f) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos);
temp_v1_2 *= 0.85f;
@@ -3251,7 +3248,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4A570(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06002A8C, -10.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06002A8C, -10.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -3270,7 +3267,7 @@ void func_80B4A5E4(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4A614(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06014088, 0.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -3301,7 +3298,7 @@ void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx) {
this->actor.flags |= (0x8 | 0x1);
}
if (((this->actor.flags & 0x40) == 0x40) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
if (this->pathIndex == this->endPoint) {
@@ -3313,13 +3310,13 @@ void func_80B4A7C0(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 2000;
this->behaviorInfo.unk4C = 0;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, 0.0f);
this->actionFunc = func_80B4A81C;
}
void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -3356,8 +3353,8 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) {
this->actor.objBankIndex = this->bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44F58();
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable,
- this->transitionDrawTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->jointTable, this->morphTable,
+ 23);
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f);
func_80B44620(this, globalCtx);
if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) {
@@ -3408,7 +3405,7 @@ void func_80B4ABDC(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
if (sp2C) {
- this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ this->animPlayFlag = SkelAnime_Update(&this->skelAnime);
func_80B45CE0(&this->behaviorInfo);
if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) {
func_800B8614(&this->actor, globalCtx, 100.0f);
@@ -3531,9 +3528,9 @@ void func_80B4B0C4(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44F58();
this->actor.update = func_80B4B218;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable,
- this->transitionDrawTable, 23);
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, 0.0f);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->jointTable, this->morphTable,
+ 23);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, 0.0f);
substruct = &this->behaviorInfo;
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &D_801D15BC, 2000, 0.08f, 0.3f, 0.03f);
substruct->unk30 = 0.08f;
@@ -3554,8 +3551,8 @@ void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
if (sp38 && this->actor.update != NULL) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- player = PLAYER;
+ SkelAnime_Update(&this->skelAnime);
+ player = GET_PLAYER(globalCtx);
Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40);
temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f);
@@ -3574,13 +3571,13 @@ void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) {
void func_80B4B3DC(EnInvadepoh* this) {
s32 pad;
- if (func_801378B8(&this->skelAnime, 1.0f) || func_801378B8(&this->skelAnime, 7.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_MONKEY_WALK);
}
}
void func_80B4B430(EnInvadepoh* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060021C8, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_060021C8, -6.0f);
this->actionTimer = Rand_S16Offset(50, 80);
this->actionFunc = func_80B4B484;
}
@@ -3603,7 +3600,7 @@ void func_80B4B484(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B4B510(EnInvadepoh* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001BD8, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06001BD8, -6.0f);
this->actionTimer = Rand_S16Offset(50, 200);
this->actionFunc = func_80B4B564;
}
@@ -3647,7 +3644,7 @@ void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B4B724(EnInvadepoh* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000998, -6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000998, -6.0f);
this->actionFunc = func_80B4B768;
}
@@ -3658,7 +3655,7 @@ void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.world.rot.y, Actor_YawBetweenActors(&this->actor, &D_80B5040C->actor), 5, 0x1388,
0x64);
func_80B44E90(this, globalCtx);
- if (func_801378B8(&this->skelAnime, 13.0f) || func_801378B8(&this->skelAnime, 19.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK);
}
if (this->animPlayFlag) {
@@ -3667,7 +3664,7 @@ void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B4B820(EnInvadepoh* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001560, -6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001560, -6.0f);
this->actionFunc = func_80B4B864;
}
@@ -3686,8 +3683,8 @@ void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx) {
if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) {
this->actor.objBankIndex = this->bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060080F0, &D_060021C8, this->limbDrawTable,
- this->transitionDrawTable, 13);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060080F0, &D_060021C8, this->jointTable, this->morphTable,
+ 13);
func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &D_801D15BC, 3000, 0.1f, 0.0f, 0.0f);
func_80B44664(this, globalCtx);
EnInvadepoh_SetPathPointToWorldPos(this, 0);
@@ -3756,7 +3753,7 @@ void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
- this->animPlayFlag = SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ this->animPlayFlag = SkelAnime_Update(&this->skelAnime);
if (sp34 && (this->actor.update != NULL)) {
func_80B45CE0(&this->behaviorInfo);
Collider_UpdateCylinder(&this->actor, &this->collider);
@@ -3767,7 +3764,7 @@ void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx) {
void func_80B4BBE0(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06016720, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06016720, -6.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -3835,7 +3832,7 @@ void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) {
}
if (((this->actor.flags & 0x40) == 0x40) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 12.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
if (gSaveContext.time > CLOCK_TIME(20, 15)) {
@@ -3848,14 +3845,14 @@ void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4BFFC(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 2000;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A174, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600A174, -6.0f);
this->behaviorInfo.unk4C = 0;
this->actionFunc = func_80B4C058;
}
void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -3880,14 +3877,14 @@ void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4C1BC(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 2000;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600A174, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600A174, -6.0f);
this->behaviorInfo.unk4C = 0;
this->actionFunc = func_80B4C218;
}
void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor* temp_v0;
s16 temp_v1;
s16 diff;
@@ -3920,8 +3917,8 @@ void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) {
this->actor.objBankIndex = this->bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44FEC();
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06015C28, &D_06016720, this->limbDrawTable,
- this->transitionDrawTable, 22);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06015C28, &D_06016720, this->jointTable, this->morphTable,
+ 22);
func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f);
this->actor.textId = 0x33CD;
if (currentTime < 0xD5A0) {
@@ -3970,7 +3967,7 @@ void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
if (sp2C && (this->actor.update != NULL)) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B45CE0(&this->behaviorInfo);
if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) {
func_800B8614(&this->actor, globalCtx, 350.0f);
@@ -3983,7 +3980,7 @@ void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx) {
void func_80B4C6C8(EnInvadepoh* this) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06014088, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06014088, -10.0f);
substruct->unk26.x = 0;
substruct->unk26.y = 0;
substruct->unk26.z = 0;
@@ -4056,7 +4053,7 @@ void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) {
}
if (((this->actor.flags & 0x40) == 0x40) &&
- (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 7.0f))) {
+ (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
@@ -4073,14 +4070,14 @@ void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4CAB0(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 4000;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
this->behaviorInfo.unk4C = 0;
this->actionFunc = func_80B4CB0C;
}
void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -4102,14 +4099,14 @@ void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) {
void func_80B4CC70(EnInvadepoh* this) {
this->behaviorInfo.unk30 = 0.08f;
this->behaviorInfo.unk2C = 2000;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06009E58, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06009E58, -10.0f);
this->behaviorInfo.unk4C = 0;
this->actionFunc = func_80B4CCCC;
}
void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx) {
AlienBehaviorInfo* substruct = &this->behaviorInfo;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v1;
s16 diff;
@@ -4141,8 +4138,8 @@ void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) {
this->actor.objBankIndex = this->bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B44F58();
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->limbDrawTable,
- this->transitionDrawTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, &D_06014088, this->jointTable, this->morphTable,
+ 23);
func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &D_801D15BC, 100, 0.03f, 0.3f, 0.03f);
func_80B446D0(this, globalCtx);
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -4186,7 +4183,7 @@ void func_80B4D054(Actor* thisx, GlobalContext* globalCtx) {
}
this->actionFunc(this, globalCtx);
if (sp2C && this->actor.update != NULL) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80B45CE0(&this->behaviorInfo);
if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) {
func_800B8614(thisx, globalCtx, 350.0f);
@@ -4201,8 +4198,8 @@ void func_80B4D15C(EnInvadepoh* this) {
s32 temp_v1 = this->actor.params & 7;
unkstruct80B4EE0C* temp_v0;
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001674);
- this->skelAnime.animCurrentFrame = ((this->actor.params & 7) * this->skelAnime.animFrameCount) * 0.25f;
+ Animation_PlayLoop(&this->skelAnime, &D_06001674);
+ this->skelAnime.curFrame = ((this->actor.params & 7) * this->skelAnime.endFrame) * 0.25f;
this->alienAlpha = 255;
this->actor.draw = func_80B4DB14;
this->drawAlien = true;
@@ -4253,8 +4250,8 @@ void func_80B4D290(EnInvadepoh* this, GlobalContext* globalCtx) {
}
void func_80B4D3E4(EnInvadepoh* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001674);
- this->skelAnime.animCurrentFrame = (this->actor.params & 7) * this->skelAnime.animFrameCount * 0.25f;
+ Animation_PlayLoop(&this->skelAnime, &D_06001674);
+ this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f;
this->alienAlpha = 255;
this->actor.draw = NULL;
this->drawAlien = true;
@@ -4330,8 +4327,8 @@ void func_80B4D670(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetObjectSegment(globalCtx, &this->actor);
func_80B45080();
this->actor.update = func_80B4D760;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004E50, &D_06001674, this->limbDrawTable,
- this->transitionDrawTable, 14);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004E50, &D_06001674, this->jointTable, this->morphTable,
+ 14);
if (invadepohType < 3) {
func_80B453F4(this, globalCtx, invadepohType);
func_80B4D15C(this);
@@ -4347,7 +4344,7 @@ void func_80B4D760(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
if (this->actor.update != NULL) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG);
}
}
@@ -4366,7 +4363,7 @@ void func_80B4D7B8(GlobalContext* globalCtx) {
temp_v0 = globalCtx->gameplayFrames;
temp_s5 = (temp_v0 + ((0x10 * i) & 0xFFU)) & 0x7F;
temp_s6 = (u8)(temp_v0 * -0xF);
- SysMatrix_InsertTranslation(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, phi_s2->unk2);
@@ -4395,22 +4392,22 @@ void func_80B4D9F4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
EnInvadepoh* this = THIS;
if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) {
- SysMatrix_StatePush();
- SysMatrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY);
Matrix_RotateY(-0x3830, MTXMODE_APPLY);
Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY);
- SysMatrix_CopyCurrentState(&D_80B502A0);
- SysMatrix_StatePop();
+ Matrix_CopyCurrentState(&D_80B502A0);
+ Matrix_StatePop();
} else if ((limbIndex == 13) && (this->alienBeamAlpha != 0)) {
- SysMatrix_StatePush();
- SysMatrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertZRotation_s(-0x53ED, MTXMODE_APPLY);
Matrix_RotateY(-0x47D0, MTXMODE_APPLY);
Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY);
- SysMatrix_CopyCurrentState(&D_80B502E0);
- SysMatrix_StatePop();
+ Matrix_CopyCurrentState(&D_80B502E0);
+ Matrix_StatePop();
}
if (limbIndex == 11) {
- SysMatrix_MultiplyVector3fByState(&D_80B4EE24, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80B4EE24, &this->actor.focus.pos);
}
}
@@ -4421,7 +4418,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(spCC);
func_8012C2DC(spCC);
- SysMatrix_StatePush();
+ Matrix_StatePush();
if (this->drawAlien) {
Gfx* new_var6;
Gfx* spBC;
@@ -4432,16 +4429,16 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
AnimatedMat_Draw(globalCtx, D_80B50400);
Scene_SetRenderModeXlu(globalCtx, 0, 1);
gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255);
- spCC->polyOpa.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor,
- spCC->polyOpa.p);
+ spCC->polyOpa.p = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor,
+ spCC->polyOpa.p);
} else {
AnimatedMat_Draw(globalCtx, D_80B50400);
Scene_SetRenderModeXlu(globalCtx, 1, 2);
gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha);
- spCC->polyXlu.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor,
- spCC->polyXlu.p);
+ spCC->polyXlu.p = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor,
+ spCC->polyXlu.p);
}
if (this->alienBeamAlpha != 0) {
@@ -4451,10 +4448,10 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
gDPPipeSync(spBC++);
gDPSetPrimColor(spBC++, 0, 255, 240, 180, 100, 60);
gDPSetEnvColor(spBC++, 255, 255, 255, this->alienBeamAlpha * (150.0f / 255.0f));
- SysMatrix_InsertMatrix(&D_80B502A0, MTXMODE_NEW);
+ Matrix_InsertMatrix(&D_80B502A0, MTXMODE_NEW);
gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(spBC++, D_06000080);
- SysMatrix_InsertMatrix(&D_80B502E0, MTXMODE_NEW);
+ Matrix_InsertMatrix(&D_80B502E0, MTXMODE_NEW);
gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(spBC++, D_06000080);
spB8->polyXlu.p = spBC;
@@ -4462,8 +4459,8 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->drawAlienDeathEffect) {
- SysMatrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f,
- this->actor.world.pos.z, &this->actor.shape.rot);
+ Matrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f,
+ this->actor.world.pos.z, &this->actor.shape.rot);
Matrix_Scale(this->alienDeathEffectScale.x, this->alienDeathEffectScale.y, this->alienDeathEffectScale.z,
MTXMODE_APPLY);
gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
@@ -4483,12 +4480,12 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
gSPSetOtherMode(gfx++, G_SETOTHERMODE_H, 4, 4, 0x00000080);
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
- SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW);
- SysMatrix_GetStateTranslationAndScaledZ(60.0f, &sp80);
+ Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW);
+ Matrix_GetStateTranslationAndScaledZ(60.0f, &sp80);
sp74.x = thisx->world.pos.x + sp80.x;
sp74.y = thisx->world.pos.y + sp80.y + 68.0f;
sp74.z = thisx->world.pos.z + sp80.z;
- SysMatrix_InsertTranslation(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY);
alpha2 = this->alienAlpha * (100.0f / 255.0f);
gSPDisplayList(gfx++, D_04029CB0);
@@ -4502,7 +4499,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) {
}
}
- SysMatrix_StatePop();
+ Matrix_StatePop();
CLOSE_DISPS(spCC);
}
@@ -4518,26 +4515,28 @@ void func_80B4E158(Actor* thisx, GlobalContext* globalCtx) {
EnInvadepoh* this = THIS;
func_8012C5B0(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_80B4E120, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80B4E120, NULL, &this->actor);
}
void func_80B4E1B0(Actor* thisx, GlobalContext* globalCtx) {
EnInvadepoh* this = THIS;
func_8012C5B0(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, NULL, &this->actor);
}
s32 func_80B4E200(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
if (limbIndex == 14) {
EnInvadepoh* this = THIS; // both of these needed to match
+
rot->x += this->behaviorInfo.unk20.y;
rot->y += this->behaviorInfo.unk20.z;
rot->z += this->behaviorInfo.unk20.x;
} else if (limbIndex == 13) {
EnInvadepoh* this = THIS; // both of these needed to match
+
rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y);
rot->z += this->behaviorInfo.unk40;
}
@@ -4552,7 +4551,7 @@ void func_80B4E2AC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
gSPDisplayList(POLY_OPA_DISP++, D_060003B0);
CLOSE_DISPS(globalCtx->state.gfxCtx);
} else if (limbIndex == 14) {
- SysMatrix_MultiplyVector3fByState(&D_80B4EE30, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80B4EE30, &this->actor.focus.pos);
}
}
@@ -4563,8 +4562,8 @@ void func_80B4E324(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E958[this->behaviorInfo.unk10.unkF]);
gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E944[this->behaviorInfo.unk0.unkF]);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_80B4E200, func_80B4E2AC, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80B4E200, func_80B4E2AC, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -4572,16 +4571,16 @@ void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx) {
s32 pad[2];
Vec3f sp5C;
- SysMatrix_StatePush();
- SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW);
- SysMatrix_GetStateTranslationAndScaledZ(200.0f, &sp5C);
- SysMatrix_StatePop();
+ Matrix_StatePush();
+ Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_NEW);
+ Matrix_GetStateTranslationAndScaledZ(200.0f, &sp5C);
+ Matrix_StatePop();
sp5C.x += thisx->world.pos.x;
sp5C.y += thisx->world.pos.y;
sp5C.z += thisx->world.pos.z;
EnInvadepoh_SetSysMatrix(&sp5C);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
- SysMatrix_InsertZRotation_s(((EnInvadepoh*)thisx)->unk304, MTXMODE_APPLY);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertZRotation_s(((EnInvadepoh*)thisx)->unk304, MTXMODE_APPLY);
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -4599,6 +4598,7 @@ void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx) {
s32 func_80B4E5B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7)) {
EnInvadepoh* this = THIS;
+
rot->x += this->behaviorInfo.unk20.x;
rot->y += this->behaviorInfo.unk20.y;
rot->z += this->behaviorInfo.unk20.z;
@@ -4608,8 +4608,10 @@ s32 func_80B4E5B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
}
void func_80B4E61C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ EnInvadepoh* this = THIS;
+
if (limbIndex == 5) {
- SysMatrix_GetStateTranslationAndScaledY(20.0f, &thisx->focus.pos);
+ Matrix_GetStateTranslationAndScaledY(20.0f, &this->actor.focus.pos);
}
}
@@ -4619,27 +4621,31 @@ void func_80B4E660(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_80B4E5B0, func_80B4E61C, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80B4E5B0, func_80B4E61C, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
s32 func_80B4E6E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
if (limbIndex == 9) {
EnInvadepoh* this = THIS; // both of these needed to match
+
rot->x += this->behaviorInfo.unk20.y;
rot->y += this->behaviorInfo.unk20.z;
rot->z += this->behaviorInfo.unk20.x;
} else if (limbIndex == 2) {
EnInvadepoh* this = THIS; // both of these needed to match
+
rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y);
}
return 0;
}
void func_80B4E784(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ EnInvadepoh* this = THIS;
+
if (limbIndex == 9) {
- SysMatrix_GetStateTranslation(&thisx->focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
}
@@ -4650,7 +4656,7 @@ void func_80B4E7BC(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E984[this->behaviorInfo.unk10.unkF]);
gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E96C[this->behaviorInfo.unk0.unkF]);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- func_80B4E6E4, func_80B4E784, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ func_80B4E6E4, func_80B4E784, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h
index 8b766189f..3a242eace 100644
--- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h
+++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h
@@ -109,8 +109,8 @@ typedef struct AlienBehaviorInfo {
typedef struct EnInvadepoh {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[23];
- /* 0x212 */ Vec3s transitionDrawTable[23];
+ /* 0x188 */ Vec3s jointTable[23];
+ /* 0x212 */ Vec3s morphTable[23];
/* 0x29C */ s8 animPlayFlag;
/* 0x2A0 */ ColliderCylinder collider;
/* 0x2EC */ EnInvadepohActionFunc actionFunc;
diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
index 3fee5e073..7390d9f7c 100644
--- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
+++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
@@ -163,6 +163,6 @@ void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000390);
- SysMatrix_MultiplyVector3fByState(&movement, &this->pos);
+ Matrix_MultiplyVector3fByState(&movement, &this->pos);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
index 6a37e5e05..26bf172bc 100644
--- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
+++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c
@@ -67,7 +67,7 @@ void EnKgy_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 i;
Actor_SetScale(&this->actor, 0.01f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600F910, &D_06004B98, this->jointTable, this->morphTable, 23);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600F910, &D_06004B98, this->jointTable, this->morphTable, 23);
this->unk_2D2 = -1;
this->unk_29C = 0;
this->unk_2E4 = 0;
@@ -131,8 +131,8 @@ void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 transitionRate) {
&D_06001764, &D_06003334, &D_06010B84, &D_06001EA4, &D_06003D88,
};
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&sAnimations[animIndex]->common), mode, transitionRate);
+ Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimations[animIndex]), mode, transitionRate);
this->unk_2D2 = animIndex;
}
@@ -313,7 +313,7 @@ void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B411DC(EnKgy* this, GlobalContext* globalCtx, s32 arg2) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
switch (arg2) {
case 0:
@@ -432,7 +432,7 @@ void func_80B415A8(GlobalContext* globalCtx, Vec3f* arg1) {
void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) {
this->actor.focus.pos = this->unk_2A8;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 6) {
if (this->unk_2EA > 0) {
EnKgy_ChangeAnim(this, 6, 2, 0.0f);
@@ -444,10 +444,10 @@ void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) {
} else {
EnKgy_ChangeAnim(this, 6, 2, -5.0f);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
- switch ((s32)this->skelAnime.animCurrentFrame) {
+ switch ((s32)this->skelAnime.curFrame) {
case 1:
case 7:
case 13:
@@ -508,7 +508,7 @@ void func_80B418C4(EnKgy* this, GlobalContext* globalCtx) {
void func_80B419B0(EnKgy* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_80B4163C(this, globalCtx);
if (func_800B84D0(&this->actor, globalCtx) || (&this->actor == player->targetActor)) {
@@ -523,7 +523,7 @@ void func_80B419B0(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B41A48(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->unk_2E4 > 0) {
this->unk_2E4--;
} else {
@@ -534,9 +534,9 @@ void func_80B41A48(EnKgy* this, GlobalContext* globalCtx) {
void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) {
s32 temp_v0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (func_80152498(&globalCtx->msgCtx) == 0x10) {
temp_v0 = func_80123810(globalCtx);
if (temp_v0 != 0) {
@@ -577,7 +577,7 @@ void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B41C30(EnKgy* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (&this->actor != player->targetActor) {
this->actionFunc = func_80B42508;
@@ -585,7 +585,7 @@ void func_80B41C30(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B41C54(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (func_800B867C(&this->actor, globalCtx)) {
this->actionFunc = func_80B41C30;
this->actor.flags &= ~0x100;
@@ -594,7 +594,7 @@ void func_80B41C54(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B41CBC(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (func_800B84D0(&this->actor, globalCtx)) {
this->actor.flags &= ~0x10000;
func_80B40E18(this, this->actor.textId);
@@ -606,7 +606,7 @@ void func_80B41CBC(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B41D64(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = func_80B41CBC;
this->actor.flags |= 0x10000;
@@ -620,9 +620,9 @@ void func_80B41D64(EnKgy* this, GlobalContext* globalCtx) {
void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) {
u16 temp;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->unk_2D2 == 3)) {
+ if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 3)) {
func_80B40BC0(this, 4);
}
@@ -758,7 +758,7 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) {
case 0xC46:
case 0xC55:
- func_80123D50(globalCtx, PLAYER, 0x12, 0x15);
+ func_80123D50(globalCtx, GET_PLAYER(globalCtx), 0x12, 0x15);
player->unk_A87 = 0;
this->unk_29C &= ~0x8;
globalCtx->msgCtx.unk11F10 = 0;
@@ -842,9 +842,9 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) {
void func_80B42508(EnKgy* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.focus.pos = this->unk_2A8;
if (func_800B84D0(&this->actor, globalCtx) || (&this->actor == player->targetActor)) {
this->actionFunc = func_80B41E18;
@@ -854,7 +854,7 @@ void func_80B42508(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B425A0(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.focus.pos = this->unk_2A8;
if (func_800B84D0(&this->actor, globalCtx)) {
this->actionFunc = func_80B41E18;
@@ -867,7 +867,7 @@ void func_80B425A0(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B42660(EnKgy* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.focus.pos = this->unk_2A8;
if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
func_801477B4(globalCtx);
@@ -881,9 +881,9 @@ void func_80B42660(EnKgy* this, GlobalContext* globalCtx) {
void func_80B42714(EnKgy* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.focus.pos = this->unk_2A8;
if (func_800B84D0(&this->actor, globalCtx) || (&this->actor == player->targetActor)) {
func_80B411DC(this, globalCtx, 4);
@@ -900,7 +900,7 @@ void func_80B427C8(EnKgy* this, GlobalContext* globalCtx) {
s32 pad;
u16 temp_a2;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 5) {
func_80B40BC0(this, 7);
}
@@ -946,7 +946,7 @@ void func_80B427C8(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B4296C(EnKgy* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->unk_2D2 == 8)) {
+ if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
func_80B40BC0(this, 2);
}
@@ -971,7 +971,7 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) {
u16 temp_a2;
s32 pad;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 5) {
func_80B40BC0(this, 1);
}
@@ -1058,7 +1058,7 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) {
}
void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->unk_2D2 == 8)) {
+ if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
func_80B40BC0(this, 2);
}
@@ -1134,11 +1134,11 @@ void EnKgy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
EnKgy* this = THIS;
if (limbIndex == 11) {
- SysMatrix_MultiplyVector3fByState(&D_80B432D8, &this->unk_2A8);
+ Matrix_MultiplyVector3fByState(&D_80B432D8, &this->unk_2A8);
}
if (limbIndex == 16) {
- SysMatrix_MultiplyVector3fByState(&D_80B432E4, &this->unk_2C0);
+ Matrix_MultiplyVector3fByState(&D_80B432E4, &this->unk_2C0);
}
}
@@ -1150,9 +1150,9 @@ void func_80B43074(EnKgy* this, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
func_800B8050(&this->actor, globalCtx, MTXMODE_NEW);
- SysMatrix_StatePush();
- SysMatrix_InsertTranslation(-800.0f, 3100.0f, 8400.0f, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(0x4000, MTXMODE_APPLY);
+ Matrix_StatePush();
+ Matrix_InsertTranslation(-800.0f, 3100.0f, 8400.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(0x4000, MTXMODE_APPLY);
if (func_80B40D8C(globalCtx)) {
AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(D_0600F6A0));
@@ -1174,7 +1174,7 @@ void func_80B43074(EnKgy* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_StatePop();
+ Matrix_StatePop();
}
void EnKgy_Draw(Actor* thisx, GlobalContext* globalCtx) {
@@ -1184,6 +1184,6 @@ void EnKgy_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (this->unk_29C & 1) {
func_80B43074(this, globalCtx);
}
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnKgy_OverrideLimbDraw, EnKgy_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnKgy_OverrideLimbDraw, EnKgy_PostLimbDraw, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
index 6f4c463cf..e2ff014c9 100644
--- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
+++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
@@ -154,18 +154,18 @@ static struct_80B8E1A8 sAnimationInfo[] = {
};
void EnMa4_ChangeAnim(EnMa4* this, s32 index) {
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&sAnimationInfo[index].animationSeg->common),
- sAnimationInfo[index].mode, sAnimationInfo[index].transitionRate);
+ Animation_Change(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimationInfo[index].animationSeg), sAnimationInfo[index].mode,
+ sAnimationInfo[index].transitionRate);
}
void func_80ABDD9C(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 flag;
if (this->unk_1D8.unk_00 == 0 &&
- ((this->skelAnime.animCurrentSeg == &D_06007328) || (this->skelAnime.animCurrentSeg == &D_06002A8C) ||
- (this->skelAnime.animCurrentSeg == &D_06015B7C))) {
+ ((this->skelAnime.animation == &D_06007328) || (this->skelAnime.animation == &D_06002A8C) ||
+ (this->skelAnime.animation == &D_06015B7C))) {
flag = 1;
} else {
flag = (this->type == MA4_TYPE_ALIENS_WON && this->actionFunc != EnMa4_DialogueHandler) ? 1 : 0;
@@ -201,8 +201,8 @@ void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 18.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, NULL, this->limbDrawTable, this->transitionDrawTable,
- MA1_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, NULL, this->jointTable, this->morphTable,
+ MA1_LIMB_MAX);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -270,7 +270,7 @@ void EnMa4_RunInCircles(EnMa4* this, GlobalContext* globalCtx) {
s32 pad;
s16 sp2E;
- if (sCurrentAnim != 9 && func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (sCurrentAnim != 9 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (sCurrentAnim == 3) {
if (D_80AC0250 < 3) {
D_80AC0250++;
@@ -286,7 +286,7 @@ void EnMa4_RunInCircles(EnMa4* this, GlobalContext* globalCtx) {
}
}
- if (sCurrentAnim == 13 && func_801378B8(&this->skelAnime, 37.0f)) {
+ if (sCurrentAnim == 13 && Animation_OnFrame(&this->skelAnime, 37.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK);
}
@@ -318,8 +318,8 @@ void EnMa4_RunInCircles(EnMa4* this, GlobalContext* globalCtx) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
- if (this->skelAnime.animCurrentSeg == &D_06007328) { // Walking animation
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 4.0f)) {
+ if (this->skelAnime.animation == &D_06007328) { // Walking animation
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_ROMANI_WALK);
}
}
@@ -346,14 +346,14 @@ void EnMa4_SetupWait(EnMa4* this) {
}
void EnMa4_Wait(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yaw = this->actor.shape.rot.y - this->actor.yawTowardsPlayer;
if ((this->state == MA4_STATE_AFTERHORSEBACKGAME) || (this->state == MA4_STATE_AFTERDESCRIBETHEMCS)) {
this->actor.flags |= 0x10000;
} else if (this->type != MA4_TYPE_ALIENS_WON) {
EnMa4_RunInCircles(this, globalCtx);
- } else if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->animTimer++;
if (this->animTimer == 5) {
EnMa4_ChangeAnim(this, 17); // Traumatized anim
@@ -506,7 +506,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx) {
}
void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 aux;
if (func_80147624(globalCtx) != 0) {
@@ -708,7 +708,7 @@ void EnMa4_HorsebackGameTalking(EnMa4* this, GlobalContext* globalCtx) {
}
void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
globalCtx->interfaceCtx.unk_280 = 1;
func_8010E9F0(4, 0);
@@ -719,7 +719,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) {
}
void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (globalCtx->interfaceCtx.unk_280 == 8) {
this->actionFunc = EnMa4_HorsebackGameWait;
@@ -729,7 +729,7 @@ void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) {
void EnMa4_HorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) {
static s16 D_80AC0258 = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
player->stateFlags3 |= 0x400;
EnMa4_HorsebackGameCheckPlayerInteractions(this, globalCtx);
@@ -756,7 +756,7 @@ void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
static s32 sFrameCounter = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (player->stateFlags1 & 0x100000) {
globalCtx->actorCtx.unk268 = 1;
@@ -843,12 +843,11 @@ void EnMa4_EponasSongCs(EnMa4* this, GlobalContext* globalCtx) {
}
func_800EDF24(&this->actor, globalCtx, actionIndex);
- if (D_80AC0260 == 2 && this->animTimer == 0 &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (D_80AC0260 == 2 && this->animTimer == 0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
EnMa4_ChangeAnim(this, 7);
}
} else {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
player->stateFlags1 |= 0x20;
func_800B85E0(&this->actor, globalCtx, 200.0f, -1);
@@ -863,7 +862,7 @@ void EnMa4_SetupEndEponasSongCs(EnMa4* this) {
}
void EnMa4_EndEponasSongCs(EnMa4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actor.flags |= 0x10000;
if (func_800B84D0(&this->actor, globalCtx) != 0) {
@@ -1042,7 +1041,7 @@ void EnMa4_Update(Actor* thisx, GlobalContext* globalCtx) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnMa4_UpdateEyes(this);
this->actionFunc(this, globalCtx);
func_80ABDD9C(this, globalCtx);
@@ -1071,7 +1070,7 @@ void EnMa4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
Vec3f sp28 = { 800.0f, 0.0f, 0.0f };
if (limbIndex == MA1_LIMB_HEAD) {
- SysMatrix_MultiplyVector3fByState(&sp28, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp28, &this->actor.focus.pos);
} else if (limbIndex == MA1_LIMB_HAND_LEFT) {
if (this->hasBow == true) {
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -1095,8 +1094,8 @@ void EnMa4_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex]));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnMa4_OverrideLimbDraw, EnMa4_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnMa4_OverrideLimbDraw, EnMa4_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h
index 1ecc67ed5..b1e25569b 100644
--- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h
+++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h
@@ -15,9 +15,9 @@ typedef struct EnMa4 {
/* 0x18C */ ColliderCylinder collider;
/* 0x1D8 */ struct_800BD888_arg1 unk_1D8;
/* 0x200 */ Vec3s* pathPoints;
- /* 0x204 */ Vec3s limbDrawTable[MA1_LIMB_MAX];
+ /* 0x204 */ Vec3s jointTable[MA1_LIMB_MAX];
/* 0x28E */ UNK_TYPE1 unk28E[0x6];
- /* 0x294 */ Vec3s transitionDrawTable[MA1_LIMB_MAX];
+ /* 0x294 */ Vec3s morphTable[MA1_LIMB_MAX];
/* 0x31E */ UNK_TYPE1 unk31E[0x6];
/* 0x324 */ s16 pathIndex;
/* 0x326 */ s16 pathPointsCount;
diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
index 1c9987a8e..9d9969e68 100644
--- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
+++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
@@ -189,8 +189,8 @@ void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx) {
}
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 18.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06015C28, NULL, this->limbDrawTbl, this->transitionDrawTbl,
- MA2_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06015C28, NULL, this->jointTable, this->morphTable,
+ MA2_LIMB_MAX);
EnMaYto_InitAnimation(this, globalCtx);
Collider_InitCylinder(globalCtx, &this->collider);
@@ -464,8 +464,8 @@ void EnMaYto_DefaultDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3000, 0x100);
- if (this->textId == 0x3395 && this->skelAnime.animCurrentSeg == &D_0600AF7C &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (this->textId == 0x3395 && this->skelAnime.animation == &D_0600AF7C &&
+ Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
EnMaYto_ChangeAnim(this, 4);
}
}
@@ -1081,8 +1081,8 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx) {
}
func_800EDF24(&this->actor, globalCtx, csActionIndex);
- if (D_80B915F0 == 2 && this->skelAnime.animCurrentSeg == &D_06001FD0 &&
- func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (D_80B915F0 == 2 && this->skelAnime.animation == &D_06001FD0 &&
+ Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
EnMaYto_ChangeAnim(this, 20);
}
} else {
@@ -1293,16 +1293,16 @@ void EnMaYto_BarnStartDialogue(EnMaYto* this, GlobalContext* globalCtx) {
}
void EnMaYto_ChangeAnim(EnMaYto* this, s32 index) {
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&sAnimationInfo[index].animationSeg->common),
- sAnimationInfo[index].mode, sAnimationInfo[index].transitionRate);
+ Animation_Change(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimationInfo[index].animationSeg), sAnimationInfo[index].mode,
+ sAnimationInfo[index].transitionRate);
}
void func_80B90C78(EnMaYto* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 flag;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
flag = this->unk31E == 2 ? true : false;
if (this->unk31E == 0) {
@@ -1464,12 +1464,12 @@ s32 EnMaYto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
rot->x += sp4.y;
rot->z += sp4.x;
} else if (limbIndex == MA2_LIMB_TORSO) {
- if (this->skelAnime.animCurrentSeg != &D_06007E28 && this->skelAnime.animCurrentSeg != &D_06003D54) {
+ if (this->skelAnime.animation != &D_06007E28 && this->skelAnime.animation != &D_06003D54) {
sp4 = this->unk_1D8.unk_0E;
rot->x += sp4.y;
- if (this->skelAnime.animCurrentSeg == &D_0600A174 || this->skelAnime.animCurrentSeg == &D_060070EC ||
- this->skelAnime.animCurrentSeg == &D_06003D54) {
+ if (this->skelAnime.animation == &D_0600A174 || this->skelAnime.animation == &D_060070EC ||
+ this->skelAnime.animation == &D_06003D54) {
rot->z += sp4.x;
}
}
@@ -1481,7 +1481,7 @@ void EnMaYto_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
EnMaYto* this = THIS;
if (limbIndex == MA2_LIMB_HEAD) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
}
@@ -1499,8 +1499,8 @@ void EnMaYto_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sMouthTextures[this->mouthTexIndex]));
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyesTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnMaYto_OverrideLimbDraw, EnMaYto_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnMaYto_OverrideLimbDraw, EnMaYto_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h
index 0fe7e009f..0feaea48a 100644
--- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h
+++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h
@@ -42,8 +42,8 @@ typedef struct EnMaYto {
/* 0x1D8 */ struct_800BD888_arg1 unk_1D8;
/* 0x200 */ s32 unk200; // unused
/* 0x204 */ s32 type;
- /* 0x208 */ Vec3s limbDrawTbl[MA2_LIMB_MAX];
- /* 0x28C */ Vec3s transitionDrawTbl[MA2_LIMB_MAX];
+ /* 0x208 */ Vec3s jointTable[MA2_LIMB_MAX];
+ /* 0x28C */ Vec3s morphTable[MA2_LIMB_MAX];
/* 0x310 */ s16 unk310; // state?
/* 0x312 */ UNK_TYPE1 unk_312[0x2];
/* 0x314 */ s16 currentAnim; // Used only in DefaultWait
diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c
index 76ad7447c..266ba90e9 100644
--- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c
+++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c
@@ -125,12 +125,6 @@ static struct_80B8E1A8 sAnimationInfo[] = {
{ &D_060180DC, 1.0f, 2, 0.0f }, { &D_060180DC, 1.0f, 2, -6.0f }, // Turns around anim
};
-void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) {
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&sAnimationInfo[index].animationSeg->common),
- sAnimationInfo[index].mode, sAnimationInfo[index].transitionRate);
-}
-
static void* sMouthTextures[] = {
D_060127C8,
D_06012BC8,
@@ -142,8 +136,14 @@ static void* sEyeTextures[] = {
D_0600FFC8, D_060107C8, D_06010FC8, D_060117C8, D_06011FC8,
};
+void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) {
+ Animation_Change(&this->skelAnime, sAnimationInfo[index].animationSeg, 1.0f, 0.0f,
+ Animation_GetLastFrame(sAnimationInfo[index].animationSeg), sAnimationInfo[index].mode,
+ sAnimationInfo[index].transitionRate);
+}
+
void func_80B8D12C(EnMaYts* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 flag = this->unk_32C == 2 ? true : false;
if (this->unk_32C == 0 || this->actor.parent == NULL) {
@@ -246,8 +246,8 @@ void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_MarkForDeath(&this->actor);
}
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 18.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013928, NULL, this->limbDrawTbl, this->transitionDrawTbl,
- MA1_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013928, NULL, this->jointTable, this->morphTable,
+ MA1_LIMB_MAX);
EnMaYts_InitAnimation(this, globalCtx);
Collider_InitCylinder(globalCtx, &this->collider);
@@ -435,7 +435,7 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx) {
func_800EDF24(&this->actor, globalCtx, actionIndex);
if ((D_80B8E32C == 2) && (this->endCreditsFlag == 0) &&
- (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount) != 0)) {
+ (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0)) {
this->endCreditsFlag++;
EnMaYts_ChangeAnim(this, 5);
}
@@ -517,20 +517,19 @@ void EnMaYts_Update(Actor* thisx, GlobalContext* globalCtx) {
collider = &this->collider;
Collider_UpdateCylinder(&this->actor, collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnMaYts_UpdateEyes(this);
func_80B8D12C(this, globalCtx);
}
-s32 EnMaYts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- Actor* thisx) {
- EnMaYts* this = THIS;
+s32 EnMaYts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg) {
+ EnMaYts* this = (EnMaYts*)arg;
Vec3s sp4;
if (limbIndex == MA1_LIMB_HEAD) {
sp4 = this->unk_1D8.unk_08;
rot->x += sp4.y;
- if ((this->skelAnime.animCurrentSeg == &D_06009E58) || (this->skelAnime.animCurrentSeg == &D_06007D98)) {
+ if ((this->skelAnime.animation == &D_06009E58) || (this->skelAnime.animation == &D_06007D98)) {
rot->z += sp4.x;
}
} else if (limbIndex == MA1_LIMB_TORSO) {
@@ -542,11 +541,11 @@ s32 EnMaYts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
return 0;
}
-void EnMaYts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnMaYts* this = THIS;
+void EnMaYts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnMaYts* this = (EnMaYts*)arg;
if (limbIndex == MA1_LIMB_HEAD) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
} else if (limbIndex == MA1_LIMB_HAND_LEFT) {
if (this->hasBow == true) {
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -565,8 +564,8 @@ void EnMaYts_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex]));
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnMaYts_OverrideLimbDraw, EnMaYts_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnMaYts_OverrideLimbDraw, EnMaYts_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h
index 75f0ee0b6..2fcc20509 100644
--- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h
+++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h
@@ -41,9 +41,9 @@ typedef struct EnMaYts {
/* 0x18C */ ColliderCylinder collider;
/* 0x1D8 */ struct_800BD888_arg1 unk_1D8;
/* 0x200 */ s32 unk_200; // Set, but not used
- /* 0x204 */ Vec3s limbDrawTbl[MA1_LIMB_MAX];
+ /* 0x204 */ Vec3s jointTable[MA1_LIMB_MAX];
/* 0x28E */ char unk_28E[0x6];
- /* 0x294 */ Vec3s transitionDrawTbl[MA1_LIMB_MAX];
+ /* 0x294 */ Vec3s morphTable[MA1_LIMB_MAX];
/* 0x31E */ char unk_31E[0x8];
/* 0x326 */ s16 blinkTimer;
/* 0x328 */ s16 overrideEyeTexIndex; // If non-zero, then this index will be used instead of eyeTexIndex
diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
index 41d80f637..9de59a963 100644
--- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
+++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c
@@ -92,8 +92,7 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 15.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600B538, &D_06001534, this->limbDrawTable,
- this->transitionDrawTable, 24);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B538, &D_06001534, this->jointTable, this->morphTable, 24);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -181,7 +180,7 @@ EnMinifrog* EnMinifrog_GetFrog(GlobalContext* globalCtx) {
void EnMinifrog_SetJumpState(EnMinifrog* this) {
if (this->jumpState == MINIFROG_STATE_GROUND) {
this->jumpState = MINIFROG_STATE_JUMP;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060007BC, 1.0f, 0.0f, 7.0f, 2, -5.0f);
+ Animation_Change(&this->skelAnime, &D_060007BC, 1.0f, 0.0f, 7.0f, 2, -5.0f);
}
}
@@ -195,10 +194,10 @@ void EnMinifrog_JumpTimer(EnMinifrog* this) {
}
void EnMinifrog_Jump(EnMinifrog* this) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
switch (this->jumpState) {
case MINIFROG_STATE_JUMP:
- if (func_801378B8(&this->skelAnime, 4.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
this->actor.bgCheckFlags &= ~1;
this->actor.velocity.y = 6.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FROG_JUMP);
@@ -208,8 +207,8 @@ void EnMinifrog_Jump(EnMinifrog* this) {
case MINIFROG_STATE_AIR:
if (this->actor.bgCheckFlags & 1) {
this->jumpState = MINIFROG_STATE_GROUND;
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06001534, -2.5f);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ Animation_MorphToLoop(&this->skelAnime, &D_06001534, -2.5f);
+ SkelAnime_Update(&this->skelAnime);
}
break;
}
@@ -238,7 +237,7 @@ void EnMinifrog_SetCamera(EnMinifrog* this, GlobalContext* globalCtx) {
Vec3f eye;
s32 i;
- eye = ACTIVE_CAM->eye;
+ eye = GET_ACTIVE_CAM(globalCtx)->eye;
yaw = Math_Vec3f_Yaw(&eye, &this->actor.world.pos);
pitch = -Math_Vec3f_Pitch(&eye, &this->actor.world.pos);
vec5.x = this->actor.world.pos.x - (5.0f * Math_SinS(yaw) * Math_CosS(pitch));
@@ -606,7 +605,7 @@ void EnMinifrog_UpdateMissingFrog(Actor* thisx, GlobalContext* globalCtx) {
}
s32 EnMinifrog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- Actor* thisx) {
+ Actor* arg) {
if (limbIndex == 1) {
pos->z -= 500.0f;
}
@@ -618,19 +617,19 @@ s32 EnMinifrog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d
return 0;
}
-void EnMinifrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnMinifrog* this = THIS;
+void EnMinifrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnMinifrog* this = (EnMinifrog*)arg;
if ((limbIndex == 7) || (limbIndex == 8)) {
OPEN_DISPS(globalCtx->state.gfxCtx);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, *dList);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
if (limbIndex == 4) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
}
@@ -648,7 +647,7 @@ void EnMinifrog_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, D_808A4D74[0]);
gSPSegment(POLY_OPA_DISP++, 0x09, D_808A4D74[0]);
gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, envColor->a);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnMinifrog_OverrideLimbDraw, EnMinifrog_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnMinifrog_OverrideLimbDraw, EnMinifrog_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h
index 1dc4a53de..201ef5c47 100644
--- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h
+++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h
@@ -27,8 +27,8 @@ typedef enum {
typedef struct EnMinifrog {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[24];
- /* 0x218 */ Vec3s transitionDrawTable[24];
+ /* 0x188 */ Vec3s jointTable[24];
+ /* 0x218 */ Vec3s morphTable[24];
/* 0x2A8 */ EnMinifrogActionFunc actionFunc;
/* 0x2AC */ struct EnMinifrog* frog;
/* 0x2B0 */ s16 frogIndex;
diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c
index 75fd10737..18be1dc95 100644
--- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c
+++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c
@@ -234,7 +234,7 @@ void EnMinislime_Disappear(EnMinislime* this, GlobalContext* globalCtx) {
}
void EnMinislime_SetupFall(EnMinislime* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 yaw;
this->collider.base.atFlags |= AT_ON;
@@ -324,6 +324,8 @@ void EnMinislime_IceArrowDamage(EnMinislime* this, GlobalContext* globalCtx) {
Math_Vec3f_Copy(&this->shakeRefPos, &this->actor.world.pos);
} else if (this->frozenTimer > 0) {
if ((this->frozenTimer < 20) || ((this->frozenTimer < 40) && ((this->frozenTimer % 2) != 0))) {
+ s32 requiredScopeTemp;
+
invFrozenTimer = 1.0f / this->frozenTimer;
randFloat = Rand_ZeroFloat(invFrozenTimer);
randSign = Rand_ZeroOne() < 0.5f ? -1 : 1;
@@ -331,7 +333,6 @@ void EnMinislime_IceArrowDamage(EnMinislime* this, GlobalContext* globalCtx) {
randFloat = Rand_ZeroFloat(invFrozenTimer);
randSign = Rand_ZeroOne() < 0.5f ? -1 : 1;
this->actor.world.pos.z = randSign * (invFrozenTimer + randFloat) + this->shakeRefPos.z;
- dummy:; // required for match
}
}
} else {
@@ -761,7 +762,7 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->actor.bgCheckFlags & 2) {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
vec1.x = this->actor.world.pos.x;
vec1.z = this->actor.world.pos.z;
vec1.y = player->actor.world.pos.y + player->actor.yDistToWater;
diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c
index e8e88b6df..041fad748 100644
--- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c
+++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_muto.c
+ * Overlay: ovl_En_Muto
+ * Description: Mutoh, leader of the carpenters
+ */
+
#include "z_en_muto.h"
#define FLAGS 0x00000009
@@ -9,10 +15,17 @@ void EnMuto_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx);
void EnMuto_Draw(Actor* thisx, GlobalContext* globalCtx);
-void func_80BE7DEC(EnMuto* this, GlobalContext* globalCtx);
-void func_80BE7FEC(EnMuto* this, GlobalContext* globalCtx);
+void EnMuto_ChangeAnim(EnMuto* this, s32 arg1);
+void EnMuto_SetHeadRotation(EnMuto* this);
+void EnMuto_SetupIdle(EnMuto* this);
+void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx);
+void EnMuto_SetupDialogue(EnMuto* this, GlobalContext* globalCtx);
+void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx);
+s32 EnMuto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
+
+extern AnimationHeader D_06000E50;
+extern FlexSkeletonHeader D_06007150;
-#if 0
const ActorInit En_Muto_InitVars = {
ACTOR_EN_MUTO,
ACTORCAT_NPC,
@@ -25,37 +38,266 @@ const ActorInit En_Muto_InitVars = {
(ActorFunc)EnMuto_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80BE841C = {
- { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
+static u16 sTextIds[] = { 0x2ABD, 0x2ABB, 0x0624, 0x0623, 0x2AC6 };
+
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_NONE,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_2,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
{ 20, 60, 0, { 0, 0, 0 } },
};
-#endif
+void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnMuto* this = THIS;
-extern ColliderCylinderInit D_80BE841C;
+ this->actor.colChkInfo.mass = MASS_IMMOVABLE;
+ ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 40.0f);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007150, &D_06000E50, this->jointTable, this->morphTable, 17);
-extern UNK_TYPE D_06000E50;
+ this->isInMayorsRoom = this->actor.params;
+ if (!this->isInMayorsRoom) {
+ this->shouldSetHeadRotation = true;
+ this->textIdIndex = 2;
+ if (gSaveContext.weekEventReg[60] & 0x80) {
+ this->textIdIndex = 3;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/EnMuto_Init.s")
+ if (gSaveContext.day != 3 || !gSaveContext.isNight) {
+ Actor_MarkForDeath(&this->actor);
+ }
+ } else {
+ this->collider.dim.radius = 30;
+ this->collider.dim.height = 60;
+ this->collider.dim.yShift = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/EnMuto_Destroy.s")
+ if (gSaveContext.weekEventReg[63] & 0x80 || (gSaveContext.day == 3 && gSaveContext.isNight)) {
+ Actor_MarkForDeath(&this->actor);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7C94.s")
+ this->actor.targetMode = 6;
+ this->actor.gravity = -3.0f;
+ Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
+ EnMuto_SetupIdle(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7D20.s")
+void EnMuto_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnMuto* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7DB4.s")
+ Collider_DestroyCylinder(globalCtx, &this->collider);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7DEC.s")
+void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) {
+ static AnimationHeader* sAnimations[] = { &D_06000E50, &D_06000E50 };
+ static u8 sAnimationModes[] = { 0, 2 };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7F88.s")
+ this->animIndex = animIndex;
+ this->frameIndex = Animation_GetLastFrame(&sAnimations[animIndex]->common);
+ Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameIndex,
+ sAnimationModes[this->animIndex], -4.0f);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE7FEC.s")
+void EnMuto_SetHeadRotation(EnMuto* this) {
+ s32 yawRotToTarget = ABS_ALT(BINANG_SUB(this->yawTowardsTarget, this->actor.world.rot.y));
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/EnMuto_Update.s")
+ this->headRotTarget.y = 0;
+ if (this->actor.xzDistToPlayer < 200.0f && yawRotToTarget < 0x4E20) {
+ this->headRotTarget.y = BINANG_SUB(this->yawTowardsTarget, this->actor.world.rot.y);
+ if (this->headRotTarget.y > 0x2710) {
+ this->headRotTarget.y = 0x2710;
+ } else if (this->headRotTarget.y < -0x2710) {
+ this->headRotTarget.y = -0x2710;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/func_80BE8328.s")
+void EnMuto_SetupIdle(EnMuto* this) {
+ EnMuto_ChangeAnim(this, 0);
+ this->isInDialogue = false;
+ this->actionFunc = EnMuto_Idle;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Muto/EnMuto_Draw.s")
+void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) {
+ Player* player;
+ this->actor.textId = sTextIds[this->textIdIndex];
+
+ if (!this->isInMayorsRoom && (player = GET_PLAYER(globalCtx))->transformation == PLAYER_FORM_DEKU) {
+ if (!(gSaveContext.weekEventReg[0x58] & 8)) {
+ this->actor.textId = 0x62C;
+ } else {
+ this->actor.textId = 0x62B;
+ }
+ }
+
+ if (1) {} // Needed to match
+
+ if (!this->isInMayorsRoom && Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) {
+ this->actor.textId = 0x2363;
+ }
+
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ EnMuto_SetupDialogue(this, globalCtx);
+ return;
+ }
+
+ if (!this->isInMayorsRoom) {
+ s16 yawRotToPlayer = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y));
+
+ this->yawTowardsTarget = this->actor.yawTowardsPlayer;
+ if (yawRotToPlayer > 0x2890) {
+ return;
+ }
+ } else {
+ this->textIdIndex = 0;
+ if (gSaveContext.weekEventReg[0x3C] & 8) {
+ this->textIdIndex = 1;
+ }
+ if (Player_GetMask(globalCtx) == PLAYER_MASK_COUPLES_MASK) {
+ this->textIdIndex = 4;
+ }
+
+ if (this->cutsceneState == 1) {
+ EnMuto_SetupDialogue(this, globalCtx);
+ return;
+ }
+ }
+
+ func_800B8614(&this->actor, globalCtx, 80.0f);
+}
+
+void EnMuto_SetupDialogue(EnMuto* this, GlobalContext* globalCtx) {
+ if (!this->isInMayorsRoom) {
+ this->yawTowardsTarget = 0;
+ }
+
+ if (this->targetActor != NULL) {
+ this->shouldSetHeadRotation = true;
+ this->cutsceneState = 1;
+ func_800B86C8(this->targetActor, globalCtx, this->targetActor);
+ }
+
+ this->isInDialogue = true;
+ this->actionFunc = EnMuto_InDialogue;
+}
+
+void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx) {
+ if (!this->isInMayorsRoom) {
+ this->yawTowardsTarget = this->actor.yawTowardsPlayer;
+ if (func_80152498(&globalCtx->msgCtx) == 5 && func_80147624(globalCtx)) {
+ func_801477B4(globalCtx);
+
+ if (this->actor.textId == 0x62C) {
+ gSaveContext.weekEventReg[88] |= 8;
+ }
+ if (this->actor.textId == 0x624) {
+ gSaveContext.weekEventReg[60] |= 0x80;
+ }
+
+ this->textIdIndex = 3;
+
+ EnMuto_SetupIdle(this);
+ }
+ return;
+ }
+
+ if (this->targetActor == &this->actor) {
+ this->yawTowardsTarget = this->actor.world.rot.y;
+ if (this->skelAnime.playSpeed == 0.0f) {
+ this->skelAnime.playSpeed = 1.0f;
+ }
+ } else {
+ f32 frameIndex = this->skelAnime.curFrame;
+
+ this->yawTowardsTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->targetActor->world.pos);
+ if (this->frameIndex <= frameIndex) {
+ this->skelAnime.playSpeed = 0.0f;
+ }
+ }
+
+ if (globalCtx->msgCtx.unk11F04 == 0x2AC6 || globalCtx->msgCtx.unk11F04 == 0x2AC7 ||
+ globalCtx->msgCtx.unk11F04 == 0x2AC8) {
+ this->skelAnime.playSpeed = 0.0f;
+ this->yawTowardsTarget = this->actor.yawTowardsPlayer;
+ this->skelAnime.curFrame = 30.0f;
+ }
+ if (globalCtx->msgCtx.unk11F04 == 0x2ACF) {
+ this->skelAnime.playSpeed = 0.0f;
+ }
+
+ if (this->cutsceneState == 2) {
+ EnMuto_SetupIdle(this);
+ }
+}
+
+void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx2) {
+ GlobalContext* globalCtx = globalCtx2;
+ EnMuto* this = THIS;
+
+ SkelAnime_Update(&this->skelAnime);
+
+ if (this->shouldSetHeadRotation) {
+ EnMuto_SetHeadRotation(this);
+ }
+
+ if (this->isInMayorsRoom && gSaveContext.day == 3 && gSaveContext.isNight) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+
+ this->actionFunc(this, globalCtx);
+
+ DECR(this->unusedCounter);
+
+ Actor_SetScale(&this->actor, 0.01f);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ Actor_SetHeight(&this->actor, 60.0f);
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+
+ Math_SmoothStepToS(&this->headRot.y, this->headRotTarget.y, 1, 0xBB8, 0);
+ Math_SmoothStepToS(&this->headRot.x, this->headRotTarget.x, 1, 0x3E8, 0);
+ Math_SmoothStepToS(&this->waistRot.y, this->waistRotTarget.y, 1, 0xBB8, 0);
+
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1DU);
+
+ this->actor.uncullZoneForward = 500.0f;
+
+ Collider_UpdateCylinder(&this->actor, &this->collider);
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+}
+
+s32 EnMuto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx) {
+ EnMuto* this = THIS;
+
+ if (limbIndex == 1) {
+ rot->x += this->waistRot.y;
+ }
+
+ if (limbIndex == 15) {
+ rot->x += this->headRot.y;
+ rot->z += this->headRot.x;
+ }
+
+ return false;
+}
+
+void EnMuto_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnMuto* this = THIS;
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnMuto_OverrideLimbDraw, NULL, &this->actor);
+}
diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.h b/src/overlays/actors/ovl_En_Muto/z_en_muto.h
index 817c4ea8a..29af0d624 100644
--- a/src/overlays/actors/ovl_En_Muto/z_en_muto.h
+++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.h
@@ -9,9 +9,25 @@ typedef void (*EnMutoActionFunc)(struct EnMuto*, GlobalContext*);
typedef struct EnMuto {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x110];
+ /* 0x0144 */ SkelAnime skelAnime;
+ /* 0x0188 */ Vec3s jointTable[17];
+ /* 0x01EE */ Vec3s morphTable[17];
/* 0x0254 */ EnMutoActionFunc actionFunc;
- /* 0x0258 */ char unk_258[0x88];
+ /* 0x0258 */ Vec3s headRot;
+ /* 0x025E */ Vec3s headRotTarget;
+ /* 0x0262 */ Vec3s waistRot;
+ /* 0x026A */ Vec3s waistRotTarget;
+ /* 0x0270 */ s16 unusedCounter;
+ /* 0x0274 */ f32 frameIndex;
+ /* 0x0278 */ s16 isInDialogue;
+ /* 0x027A */ s16 textIdIndex;
+ /* 0x027C */ s16 yawTowardsTarget;
+ /* 0x0280 */ s32 isInMayorsRoom;
+ /* 0x0284 */ s32 shouldSetHeadRotation;
+ /* 0x0288 */ Actor* targetActor;
+ /* 0x028C */ s32 cutsceneState;
+ /* 0x0290 */ s32 animIndex;
+ /* 0x0294 */ ColliderCylinder collider;
} EnMuto; // size = 0x2E0
extern const ActorInit En_Muto_InitVars;
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
index 1a6dfb9ea..4bad3b031 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
@@ -8,6 +8,8 @@
#define FLAGS 0x00800010
+#define THIS ((EnNiw*)thisx)
+
void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx);
void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx);
@@ -28,7 +30,6 @@ void EnNiw_UpdateFeather(EnNiw* this, GlobalContext* globalCtx);
void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx);
void EnNiw_CheckRage(EnNiw* this, GlobalContext* globalCtx);
void func_80891320(EnNiw* this, GlobalContext* globalCtx, s16 arg2);
-s32 EnNiw_LimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, struct Actor* actor);
void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale);
extern FlexSkeletonHeader D_06002530;
@@ -125,8 +126,8 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) {
ActorShape_Init(&thisx->shape, 0.0f, func_800B3FC0, 25.0f);
- SkelAnime_InitSV(globalCtx, &this->skelanime, &D_06002530, &D_060000E8, this->limbDrawTbl,
- this->transitionDrawtable, ENNIW_LIMBCOUNT);
+ SkelAnime_InitFlex(globalCtx, &this->skelanime, &D_06002530, &D_060000E8, this->jointTable, this->morphTable,
+ ENNIW_LIMBCOUNT);
Math_Vec3f_Copy(&this->unk2A4, &this->actor.world.pos);
Math_Vec3f_Copy(&this->unk2B0, &this->actor.world.pos);
@@ -326,8 +327,7 @@ void func_808917F8(EnNiw* this, GlobalContext* globalCtx, s32 arg2) {
}
void EnNiw_SetupIdle(EnNiw* this) {
- SkelAnime_ChangeAnim(&this->skelanime, &D_060000E8, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_060000E8.common), 0,
- -10.0f);
+ Animation_Change(&this->skelanime, &D_060000E8, 1.0f, 0.0f, Animation_GetLastFrame(&D_060000E8), 0, -10.0f);
this->unknownState28E = 0;
this->actionFunc = EnNiw_Idle;
}
@@ -629,8 +629,7 @@ void EnNiw_CuccoStorm(EnNiw* this, GlobalContext* globalCtx) {
}
void EnNiw_SetupRunAway(EnNiw* this) {
- SkelAnime_ChangeAnim(&this->skelanime, &D_060000E8, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_060000E8.common), 0,
- -10.0f);
+ Animation_Change(&this->skelanime, &D_060000E8, 1.0f, 0.0f, Animation_GetLastFrame(&D_060000E8), 0, -10.0f);
this->unk29A = Rand_ZeroFloat(1.99f);
this->unknownState28E = 7;
this->actionFunc = EnNiw_RunAway;
@@ -638,7 +637,7 @@ void EnNiw_SetupRunAway(EnNiw* this) {
}
void EnNiw_RunAway(EnNiw* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f tempVec3f = D_808934E8;
s16 temp298;
f32 dX;
@@ -736,7 +735,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
EnNiw* this = (EnNiw*)thisx;
s8 pad0;
s16 i;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 pad1;
s16 featherCount;
Vec3f pos;
@@ -907,8 +906,8 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
-s32 EnNiw_LimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor) {
- EnNiw* this = (EnNiw*)actor;
+s32 EnNiw_LimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnNiw* this = THIS;
if (limbIndex == 13) {
rot->y += (s16)this->limbDRot;
@@ -933,8 +932,8 @@ void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnNiw* this = (EnNiw*)thisx;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelanime.skeleton, this->skelanime.limbDrawTbl, this->skelanime.dListCount,
- EnNiw_LimbDraw, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount,
+ EnNiw_LimbDraw, NULL, &this->actor);
EnNiw_DrawFeathers(this, globalCtx);
}
@@ -1007,11 +1006,11 @@ void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx) {
isMaterialApplied++;
}
- SysMatrix_InsertTranslation(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(feather->scale, feather->scale, 1.0f, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_f(feather->zRot, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertZRotation_f(feather->zRot, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h
index 07d958893..5a03215bc 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h
@@ -25,8 +25,8 @@ typedef struct {
typedef struct EnNiw {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelanime;
- /* 0x188 */ Vec3s limbDrawTbl[ENNIW_LIMBCOUNT];
- /* 0x1E8 */ Vec3s transitionDrawtable[ENNIW_LIMBCOUNT];
+ /* 0x188 */ Vec3s jointTable[ENNIW_LIMBCOUNT];
+ /* 0x1E8 */ Vec3s morphTable[ENNIW_LIMBCOUNT];
/* 0x248 */ EnNiwActionFunc actionFunc;
/* 0x24C */ s16 unkTimer24C;
/* 0x24E */ s16 unkTimer24E;
diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c
index 45c8b9bf0..b9aa32a0c 100644
--- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c
+++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c
@@ -83,7 +83,7 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) {
EnNutsball* this = THIS;
GlobalContext* globalCtx2 = globalCtx;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f worldPos;
Vec3s worldRot;
Vec3f spawnBurstPos;
@@ -165,8 +165,8 @@ void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
- SysMatrix_InsertMatrix(&globalCtx->mf_187FC, 1);
- SysMatrix_InsertZRotation_s(this->actor.home.rot.z, 1);
+ Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->actor.home.rot.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_04058BA0);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
index d7f9e18bc..be2c4b570 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
@@ -197,7 +197,7 @@ void EnOssan_CheckValidSpawn(EnOssan* this) {
}
void EnOssan_RotateHead(EnOssan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->actor.params == ENOSSAN_PART_TIME_WORKER) {
if (player->transformation == PLAYER_FORM_ZORA) {
@@ -262,7 +262,7 @@ void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) {
}
void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_800B84D0(&this->actor, globalCtx);
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -327,7 +327,7 @@ void EnOssan_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnOssan* t
}
void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_8013D9C8(globalCtx, this->limbRotTableY, this->limbRotTableZ, 19);
if (func_800B84D0(&this->actor, globalCtx)) {
@@ -355,8 +355,8 @@ void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) {
void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) {
ActorAnimationEntryS* animations = sAnimations[this->actor.params];
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&animations[this->animationIdx].animationSeg->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(animations[this->animationIdx].animationSeg);
if (this->animationIdx == 3) {
frameCount = 0;
@@ -525,7 +525,7 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) {
ActorAnimationEntryS* animations = sAnimations[this->actor.params];
u8 talkState = func_80152498(&globalCtx->msgCtx);
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnOssan_RotateHead(this, globalCtx);
if (talkState == 5 && func_80147624(globalCtx)) {
@@ -550,14 +550,14 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) {
this->animationIdx = 9;
func_8013BC6C(&this->skelAnime, animations, 9);
}
- if (this->animationIdx == 11 && func_801378B8(&this->skelAnime, 18.0f)) {
+ if (this->animationIdx == 11 && Animation_OnFrame(&this->skelAnime, 18.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HANKO);
}
}
s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx) {
ActorAnimationEntryS* animations = sAnimations[this->actor.params];
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
switch (globalCtx->msgCtx.choiceIndex) {
case 0:
@@ -583,7 +583,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx
void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 cursorIdx;
if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) {
@@ -944,7 +944,7 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, GlobalContext* globalCtx)
}
void EnOssan_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -1080,7 +1080,7 @@ void EnOssan_SetupItemPurchased(EnOssan* this, GlobalContext* globalCtx) {
void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnGirlA* item;
if (talkState == 4) {
@@ -1120,7 +1120,7 @@ void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) {
}
void EnOssan_ItemPurchased(EnOssan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -1329,19 +1329,17 @@ void EnOssan_Blink(EnOssan* this) {
}
void EnOssan_InitCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013320, &D_06012C34, this->limbDrawTbl, this->transitionDrawTbl,
- 19);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06013320, &D_06012C34, this->jointTable, this->morphTable, 19);
this->actor.draw = EnOssan_DrawCuriosityShopMan;
}
void EnOssan_InitPartTimeWorker(EnOssan* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060028A0, &D_06009D34, this->limbDrawTbl, this->transitionDrawTbl,
- 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060028A0, &D_06009D34, this->jointTable, this->morphTable, 16);
this->actor.draw = EnOssan_DrawPartTimeWorker;
}
u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u16 textId = Text_GetFaceReaction(globalCtx, 0x2F);
if (textId != 0) {
@@ -1374,7 +1372,7 @@ u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx)
}
u16 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u16 textId = Text_GetFaceReaction(globalCtx, 0x36);
if (textId != 0) {
@@ -1521,7 +1519,7 @@ void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx) {
func_800E9250(globalCtx, &this->actor, &this->headRot, &this->unk2CC, this->actor.focus.pos);
this->actionFunc(this, globalCtx);
Actor_SetHeight(&this->actor, 90.0f);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
} else {
this->actionFunc(this, globalCtx);
}
@@ -1642,7 +1640,7 @@ s32 EnOssan_OverrideLimbDrawCuriosityShopMan(GlobalContext* globalCtx, s32 limbI
EnOssan* this = THIS;
if (limbIndex == 16) {
- SysMatrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
}
return false;
}
@@ -1652,8 +1650,8 @@ s32 EnOssan_OverrideLimbDrawPartTimeWorker(GlobalContext* globalCtx, s32 limbInd
EnOssan* this = THIS;
if (limbIndex == 15) {
- SysMatrix_InsertXRotation_s(this->headRotPartTimeWorker.y, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->headRotPartTimeWorker.x, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRotPartTimeWorker.y, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->headRotPartTimeWorker.x, MTXMODE_APPLY);
}
return false;
}
@@ -1674,7 +1672,7 @@ void EnOssan_PostLimbDrawPartTimeWorker(GlobalContext* globalCtx, s32 limbIndex,
EnOssan* this = THIS;
if (limbIndex == 15) {
- SysMatrix_MultiplyVector3fByState(&sPartTimeWorkerFocusOffset, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sPartTimeWorkerFocusOffset, &this->actor.focus.pos);
}
}
@@ -1686,8 +1684,8 @@ void EnOssan_DrawCuriosityShopMan(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnOssan_OverrideLimbDrawCuriosityShopMan, EnOssan_PostLimbDrawCuriosityShopMan, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnOssan_OverrideLimbDrawCuriosityShopMan, EnOssan_PostLimbDrawCuriosityShopMan, &this->actor);
EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@@ -1701,8 +1699,8 @@ void EnOssan_DrawPartTimeWorker(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnOssan_OverrideLimbDrawPartTimeWorker, EnOssan_PostLimbDrawPartTimeWorker, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnOssan_OverrideLimbDrawPartTimeWorker, EnOssan_PostLimbDrawPartTimeWorker, &this->actor);
EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
index 689d352cf..53f8b8f39 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
@@ -50,8 +50,8 @@ typedef struct EnOssan {
/* 0x2CC */ Vec3s unk2CC; // Set but never used
/* 0x2D2 */ s16 limbRotTableY[19];
/* 0x2F8 */ s16 limbRotTableZ[19];
- /* 0x31E */ Vec3s limbDrawTbl[19];
- /* 0x390 */ Vec3s transitionDrawTbl[19];
+ /* 0x31E */ Vec3s jointTable[19];
+ /* 0x390 */ Vec3s morphTable[19];
/* 0x402 */ s16 animationIdx;
/* 0x404 */ Vec3s headRotPartTimeWorker;
/* 0x40A */ u16 flags;
diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c
index 19872cc69..f0a2327fd 100644
--- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c
+++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_owl.c
+ * Overlay: ovl_En_Owl
+ * Description: Kaepora Gaebora (Owl)
+ */
+
#include "z_en_owl.h"
#define FLAGS 0x00000019
@@ -26,8 +32,33 @@ void func_8095B960(EnOwl* this, GlobalContext* globalCtx);
void func_8095BA84(EnOwl* this, GlobalContext* globalCtx);
void func_8095BE0C(EnOwl* this, GlobalContext* globalCtx);
void func_8095BF20(EnOwl* this, GlobalContext* globalCtx);
+void func_8095BF58(EnOwl* this, GlobalContext* globalCtx);
+void func_8095C1C8(EnOwl* this, GlobalContext* globalCtx);
+void func_8095C328(EnOwl* this);
+void func_8095C408(EnOwl* this);
+void func_8095C484(EnOwl* this);
+void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx);
+void func_8095D074(Actor* thisx, GlobalContext* globalCtx);
+void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, EnOwlFunc unkFunc, SkelAnime* skelAnime,
+ AnimationHeader* animationSeg, f32 transitionRate);
+
+typedef enum {
+ /* 0x00 */ OWL_REPEAT,
+ /* 0x01 */ OWL_OK
+} EnOwlMessageChoice;
+
+extern AnimationHeader D_06001168;
+extern Gfx D_06001200[];
+extern AnimationHeader D_06001ADC;
+extern TexturePtr D_06008EB8;
+extern TexturePtr D_060092B8;
+extern TexturePtr D_060096B8;
+extern FlexSkeletonHeader D_0600C5F8;
+extern AnimationHeader D_0600C6D4;
+extern AnimationHeader D_0600CB94;
+extern AnimationHeader D_0600CDB0;
+extern FlexSkeletonHeader D_060105C0;
-#if 0
const ActorInit En_Owl_InitVars = {
ACTOR_EN_OWL,
ACTORCAT_NPC,
@@ -40,137 +71,1136 @@ const ActorInit En_Owl_InitVars = {
(ActorFunc)EnOwl_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_8095D2F0 = {
- { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_ENEMY, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_ON | AC_TYPE_ENEMY,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 30, 40, 0, { 0, 0, 0 } },
};
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_8095D31C[] = {
+static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 25, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 2400, ICHAIN_STOP),
};
-#endif
+void func_8095A510(EnOwl* this, GlobalContext* globalCtx) {
+ this->unk_3FC = ENOWL_GET_F000(&this->actor);
+ if (this->unk_3FC == 15) {
+ this->unk_3FC = -1;
+ this->path = NULL;
+ } else {
+ this->unk_3F8 = 0;
+ this->path = &globalCtx->setupPathList[this->unk_3FC];
+ }
+}
-extern ColliderCylinderInit D_8095D2F0;
-extern InitChainEntry D_8095D31C[];
+void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ EnOwl* this = THIS;
+ s32 i;
+ s16 cutscene = this->actor.cutscene;
+ s32 owlType;
+ s32 switchFlag;
-extern UNK_TYPE D_06001168;
-extern UNK_TYPE D_06001200;
-extern UNK_TYPE D_06001ADC;
-extern UNK_TYPE D_0600C6D4;
-extern UNK_TYPE D_0600CB94;
-extern UNK_TYPE D_0600CDB0;
+ for (i = 0; i < ARRAY_COUNT(this->unk_400); i++) {
+ this->unk_400[i] = cutscene;
+ if (cutscene != -1) {
+ this->actor.cutscene = cutscene;
+ cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095A510.s")
+ this->actor.cutscene = this->unk_400[0];
+ Actor_ProcessInitChain(&this->actor, sInitChain);
+ if (ENOWL_GET_TYPE(&this->actor) == ENOWL_GET_TYPE_30) {
+ Actor_SetScale(&this->actor, 0.1f);
+ this->actor.update = func_8095CCF4;
+ this->actor.draw = func_8095D074;
+ this->actor.flags &= ~1;
+ this->unk_3D8 = 0;
+ this->unk_3DA = 0x320;
+ this->unk_3DC = 0x12C;
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/EnOwl_Init.s")
+ ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 36.0f);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime1, &D_0600C5F8, &D_06001ADC, this->jointTable1, this->morphTable1,
+ 21);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime2, &D_060105C0, &D_0600CDB0, this->jointTable2, this->morphTable2,
+ 16);
+ Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
+ this->actor.colChkInfo.mass = MASS_IMMOVABLE;
+ this->actor.minVelocityY = -10.0f;
+ this->actor.targetArrowOffset = 500.0f;
+ EnOwl_ChangeMode(this, func_8095BF58, func_8095C484, &this->skelAnime2, &D_0600CDB0, 0.0f);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/EnOwl_Destroy.s")
+ this->actionFlags = 0;
+ this->unk_40D = 0;
+ this->unk_40A = 0;
+ this->unk_409 = 4;
+ this->unk_40B = this->unk_408 = 0;
+ this->unk_40C = 4;
+ this->unk_406 = -1;
+ owlType = ENOWL_GET_TYPE(&this->actor);
+ switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095A920.s")
+ switch (owlType) {
+ case ENOWL_GET_TYPE_1:
+ if ((switchFlag < 0x7F) && Flags_GetSwitch(globalCtx, switchFlag)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095A978.s")
+ case ENOWL_GET_TYPE_2:
+ if (gSaveContext.inventory.items[14] == 14) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095A9FC.s")
+ case ENOWL_GET_TYPE_3:
+ if (CHECK_QUEST_ITEM(15)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AA70.s")
+ this->unk_3DA = 0;
+ this->unk_3F0 = this->actor.home.pos.y;
+ this->unk_3EC = this->actor.home.rot.y;
+ func_8095A510(this, globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AAD0.s")
+ switch (owlType) {
+ case ENOWL_GET_TYPE_1:
+ this->actionFunc = func_8095AEC0;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AB1C.s")
+ case ENOWL_GET_TYPE_2:
+ this->actionFunc = func_8095BE0C;
+ if (gSaveContext.weekEventReg[9] & 0x20) {
+ this->actor.textId = 0xBF0;
+ } else {
+ this->actor.textId = 0xBEA;
+ }
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AB4C.s")
+ case ENOWL_GET_TYPE_3:
+ this->actionFunc = func_8095AFEC;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095ABA8.s")
+ case ENOWL_GET_TYPE_1000:
+ this->actionFunc = func_8095BF20;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095ABF0.s")
+ default:
+ this->actionFlags |= 2;
+ this->unk_3DA = 0x20;
+ this->actionFunc = func_8095BF58;
+ break;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AC50.s")
+void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnOwl* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095ACEC.s")
+ if (ENOWL_GET_TYPE(&this->actor) != ENOWL_GET_TYPE_30) {
+ Collider_DestroyCylinder(globalCtx, &this->collider);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AD54.s")
+void func_8095A920(EnOwl* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AE00.s")
+ this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 6, 0x3E8, 0xC8);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AE60.s")
+s32 func_8095A978(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 targetDist, f32 arg4) {
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ return true;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AEC0.s")
+ this->actor.textId = textId;
+ if (this->actor.xzDistToPlayer < targetDist) {
+ this->actor.flags |= 0x10000;
+ func_800B8500(&this->actor, globalCtx, targetDist, arg4, 0);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AF2C.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095AFEC.s")
+s32 func_8095A9FC(EnOwl* this, GlobalContext* globalCtx, u16 textId) {
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ return true;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B06C.s")
+ this->actor.textId = textId;
+ if (this->actor.xzDistToPlayer < 120.0f) {
+ func_800B8500(&this->actor, globalCtx, 350.0f, 1000.0f, 0);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B0C8.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B158.s")
+void func_8095AA70(EnOwl* this) {
+ EnOwl_ChangeMode(this, func_8095C1C8, func_8095C484, &this->skelAnime1, &D_0600CB94, 0.0f);
+ this->eyeTexIndex = 0;
+ this->blinkTimer = Rand_S16Offset(60, 60);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B1E4.s")
+void func_8095AAD0(EnOwl* this, GlobalContext* globalCtx) {
+ s32 switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B254.s")
+ if (switchFlag < 0x7F) {
+ Actor_SetSwitchFlag(globalCtx, switchFlag);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B2F8.s")
+ func_8095AA70(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B3DC.s")
+void func_8095AB1C(EnOwl* this, GlobalContext* globalCtx) {
+ if ((this->unk_3DA % 64) == 0) {
+ func_8095AAD0(this, globalCtx);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B480.s")
+void func_8095AB4C(EnOwl* this) {
+ if (randPlusMinusPoint5Scaled(1.0f) < 0.0f) {
+ this->actionFlags |= 0x20;
+ } else {
+ this->actionFlags &= ~0x20;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B574.s")
+// Unused?
+void func_8095ABA8(EnOwl* this) {
+ func_8095AB4C(this);
+ this->unk_40B = 0;
+ this->unk_3DE = 0;
+ this->actionFlags |= 0x10;
+ this->unk_40C = 4;
+ this->unk_408 = 0;
+ this->unk_40A = 0;
+ this->unk_409 = 4;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B650.s")
+void func_8095ABF0(EnOwl* this, GlobalContext* globalCtx) {
+ if (func_800B867C(&this->actor, globalCtx)) {
+ Audio_QueueSeqCmd(0x110000FF);
+ func_8095AAD0(this, globalCtx);
+ this->actor.flags &= ~0x10000;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B6C8.s")
+// Unused?
+void func_8095AC50(EnOwl* this, GlobalContext* globalCtx) {
+ if (func_800B867C(&this->actor, globalCtx)) {
+ Audio_QueueSeqCmd(0x110000FF);
+ if ((this->unk_3DA % 64) == 0) {
+ func_8095AAD0(this, globalCtx);
+ } else {
+ this->actionFlags &= ~2;
+ func_8095ABA8(this);
+ this->actionFunc = func_8095AB1C;
+ }
+ this->actor.flags &= ~0x10000;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B76C.s")
+void func_8095ACEC(EnOwl* this) {
+ this->actionFlags &= ~0x40;
+ if (this->unk_406 >= 0) {
+ if (ActorCutscene_GetCurrentIndex() == this->unk_400[this->unk_406]) {
+ ActorCutscene_Stop(this->unk_400[this->unk_406]);
+ }
+ this->unk_406 = -1;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B960.s")
+void func_8095AD54(EnOwl* this, GlobalContext* globalCtx) {
+ if ((func_80152498(&globalCtx->msgCtx) == 4) && func_80147624(globalCtx)) {
+ switch (globalCtx->msgCtx.choiceIndex) {
+ case OWL_REPEAT:
+ func_80151938(globalCtx, 0x7D1);
+ this->actionFunc = func_8095AE00;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095B9FC.s")
+ case OWL_OK:
+ func_80151938(globalCtx, 0x7D3);
+ this->actionFunc = func_8095ABF0;
+ break;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095BA84.s")
+void func_8095AE00(EnOwl* this, GlobalContext* globalCtx) {
+ if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
+ func_80151938(globalCtx, 0x7D2);
+ this->actionFunc = func_8095AD54;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095BE0C.s")
+void func_8095AE60(EnOwl* this, GlobalContext* globalCtx) {
+ if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
+ func_80151938(globalCtx, 0x7D1);
+ this->actionFunc = func_8095AE00;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095BF20.s")
+void func_8095AEC0(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+ if (func_8095A978(this, globalCtx, 0x7D0, 360.0f, 200.0f)) {
+ func_801A3098(0x45);
+ this->actionFunc = func_8095AE60;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095BF58.s")
+void func_8095AF2C(EnOwl* this, GlobalContext* globalCtx) {
+ switch (func_80152498(&globalCtx->msgCtx)) {
+ case 5:
+ if (func_80147624(globalCtx)) {
+ if (globalCtx->msgCtx.unk11F04 == 0xBFE) {
+ func_8095ACEC(this);
+ func_801477B4(globalCtx);
+ this->actionFunc = func_8095ABF0;
+ } else {
+ func_80151938(globalCtx, globalCtx->msgCtx.unk11F04 + 1);
+ }
+ }
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095BF78.s")
+ case 6:
+ func_8095ACEC(this);
+ this->actionFunc = func_8095ABF0;
+ break;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C09C.s")
+void func_8095AFEC(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+ if (func_8095A978(this, globalCtx, 0xBF6, 200.0f, 100.0f)) {
+ func_801A3098(0x45);
+ this->actionFunc = func_8095AF2C;
+ this->unk_406 = 0;
+ this->actionFlags |= 0x40;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C1C8.s")
+s32 func_8095B06C(EnOwl* this) {
+ if ((this->actor.world.pos.y + 2.0f) < this->unk_3F0) {
+ this->actor.world.pos.y += 2.0f;
+ return false;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C258.s")
+ if (this->unk_3F0 < (this->actor.world.pos.y - 2.0f)) {
+ this->actor.world.pos.y -= 2.0f;
+ return false;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C328.s")
+ return true;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C408.s")
+void func_8095B0C8(EnOwl* this) {
+ s32 pad;
+ Vec3s* points = (Vec3s*)Lib_SegmentedToVirtual(this->path->points);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C484.s")
+ points += this->unk_3F8;
+ this->unk_3EC = Math_FAtan2F(points->z - this->actor.world.pos.z, points->x - this->actor.world.pos.x);
+ this->unk_3F0 = points->y;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C510.s")
+void func_8095B158(EnOwl* this) {
+ if (Animation_OnFrame(&this->skelAnime1, 2.0f) || Animation_OnFrame(&this->skelAnime1, 9.0f) ||
+ Animation_OnFrame(&this->skelAnime1, 23.0f) || Animation_OnFrame(&this->skelAnime1, 40.0f) ||
+ Animation_OnFrame(&this->skelAnime1, 58.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_OWL_FLUTTER);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095C568.s")
+void func_8095B1E4(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actor.speedXZ < 6.0f) {
+ this->actor.speedXZ += 1.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/EnOwl_Update.s")
+ if (this->actor.xzDistToPlayer > 6000.0f) {
+ Actor_MarkForDeath(&this->actor);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095CCF4.s")
+void func_8095B254(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actor.speedXZ < 6.0f) {
+ this->actor.speedXZ += 1.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095CE18.s")
+ if (this->actionFlags & 1) {
+ EnOwl_ChangeMode(this, func_8095B1E4, func_8095C328, &this->skelAnime1, &D_06001ADC, 0.0f);
+ this->unk_3EA = 6;
+ this->actor.flags |= 0x20;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095CF44.s")
+ func_8095B158(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/EnOwl_Draw.s")
+void func_8095B2F8(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095B06C(this);
+ if (this->skelAnime1.curFrame >= 18.0f) {
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x200, 0x80);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095D074.s")
+ if ((this->actor.shape.rot.y == this->unk_3EC) && (this->actionFlags & 1)) {
+ this->actionFunc = func_8095B254;
+ Animation_Change(this->skelAnime3, this->skelAnime3->animation, 1.0f, 19.0f,
+ Animation_GetLastFrame(&D_06001168), 2, 0.0f);
+ this->unk_414 = func_8095C484;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Owl/func_8095D24C.s")
+ func_8095B158(this);
+}
+
+void func_8095B3DC(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actionFlags & 1) {
+ this->actionFunc = func_8095B2F8;
+ Animation_Change(this->skelAnime3, &D_06001168, 1.0f, 0.0f, 35.0f, 2, 0.0f);
+ this->unk_414 = func_8095C408;
+ this->unk_3EC = 0x5500;
+ this->actor.world.pos.y += 100.0f;
+ this->unk_3F0 = this->actor.world.pos.y;
+ }
+}
+
+void func_8095B480(EnOwl* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+
+ if (player->stateFlags3 & 0x10000000) {
+ this->actor.textId = 0xBF1;
+ EnOwl_ChangeMode(this, func_8095BF58, func_8095C484, &this->skelAnime2, &D_0600CDB0, 0.0f);
+ this->eyeTexIndex = 0;
+ this->actionFlags &= ~8;
+ this->blinkTimer = Rand_S16Offset(60, 60);
+ this->actor.home.rot.x = 0;
+ this->actionFlags |= 8;
+ func_8095ACEC(this);
+ this->unk_3F0 = this->actor.home.pos.y;
+ this->unk_3EC = this->actor.home.rot.y;
+ this->actor.world.pos = this->actor.home.pos;
+ func_8095A510(this, globalCtx);
+ this->actor.speedXZ = 0.0f;
+ this->actionFunc = func_8095BE0C;
+ }
+}
+
+void func_8095B574(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ this->actionFunc = func_8095BA84;
+ func_801A3098(0x45);
+ this->actionFlags |= 0x40;
+ this->unk_406 = 2;
+ } else if (this->actor.xzDistToPlayer < 200.0f) {
+ this->actor.flags |= 0x10000;
+ func_800B8500(&this->actor, globalCtx, 200.0f, 400.0f, 0);
+ } else {
+ this->actor.flags &= ~0x10000;
+ }
+ func_8095B480(this, globalCtx);
+}
+
+void func_8095B650(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actionFlags & 1) {
+ EnOwl_ChangeMode(this, func_8095B574, func_8095C484, &this->skelAnime2, &D_0600CDB0, 0.0f);
+ this->actor.textId = 0xBF5;
+ this->actionFlags &= ~8;
+ }
+ func_8095B480(this, globalCtx);
+}
+
+void func_8095B6C8(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actionFlags & 1) {
+ Animation_Change(this->skelAnime3, &D_0600CB94, -1.0f, Animation_GetLastFrame(&D_0600CB94), 0.0f, 2, 0.0f);
+ this->unk_414 = func_8095C484;
+ this->actionFunc = func_8095B650;
+ }
+ func_8095B158(this);
+ func_8095B480(this, globalCtx);
+}
+
+void func_8095B76C(EnOwl* this, GlobalContext* globalCtx) {
+ s32 pad;
+ s16 sp4A;
+ f32 sp44 = func_80122524(&this->actor, this->path, this->unk_3F8, &sp4A);
+ Vec3s* points;
+
+ Math_SmoothStepToS(&this->actor.world.rot.y, sp4A, 6, 0x800, 0x200);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ if (sp44 < SQ(this->actor.speedXZ)) {
+ this->actor.speedXZ = 0.0f;
+ points = (Vec3s*)Lib_SegmentedToVirtual(this->path->points);
+ points += this->unk_3F8;
+
+ do {
+ this->actor.world.pos.x = points->x;
+ this->actor.world.pos.z = points->z;
+ } while (0);
+
+ this->unk_3F8++;
+ if (this->path->count <= this->unk_3F8) {
+ this->actionFunc = func_8095B6C8;
+ return;
+ }
+
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OWL, this->actor.world.pos.x, this->actor.world.pos.y,
+ this->actor.world.pos.z, 0, 0, 0, 0xF00);
+ this->actor.home.rot.x++;
+ if (this->actor.home.rot.x >= 3) {
+ func_8095ACEC(this);
+ }
+ func_8095B0C8(this);
+ } else if (sp44 < SQ(21.0f)) {
+ if (this->actor.speedXZ > 1.0f) {
+ this->actor.speedXZ -= 1.0f;
+ } else {
+ this->actor.speedXZ = 1.0f;
+ }
+ } else if (this->actor.speedXZ < 6.0f) {
+ this->actor.speedXZ += 1.0f;
+ }
+
+ func_8095B06C(this);
+ func_8095B158(this);
+ func_8095B480(this, globalCtx);
+}
+
+void func_8095B960(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->skelAnime1.curFrame >= 18.0f) {
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x200, 0x80);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ }
+
+ func_8095B06C(this);
+ if (this->actor.shape.rot.y == this->unk_3EC) {
+ this->actionFunc = func_8095B76C;
+ }
+
+ func_8095B158(this);
+ func_8095B480(this, globalCtx);
+}
+
+void func_8095B9FC(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actionFlags & 1) {
+ this->actionFunc = func_8095B960;
+ Animation_Change(this->skelAnime3, &D_06001168, 1.0f, 0.0f, 35.0f, 2, 0.0f);
+ this->unk_414 = func_8095C408;
+ func_8095B0C8(this);
+ }
+}
+
+void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+
+ switch (func_80152498(&globalCtx->msgCtx)) {
+ case 4:
+ if (func_80147624(globalCtx)) {
+ switch (globalCtx->msgCtx.unk11F04) {
+ case 0xBEC:
+ switch (globalCtx->msgCtx.choiceIndex) {
+ case 0:
+ func_8019F208();
+ if (gSaveContext.weekEventReg[9] & 0x40) {
+ func_80151938(globalCtx, 0xBF4);
+ } else {
+ gSaveContext.weekEventReg[9] |= 0x40;
+ func_80151938(globalCtx, 0xBED);
+ }
+ break;
+
+ case 1:
+ func_8019F230();
+ func_80151938(globalCtx, 0xBEF);
+ break;
+ }
+ break;
+
+ case 0xBF2:
+ switch (globalCtx->msgCtx.choiceIndex) {
+ case 0:
+ func_8019F208();
+ func_80151938(globalCtx, 0xBF4);
+ return;
+
+ case 1:
+ func_8019F230();
+ func_80151938(globalCtx, 0xBF3);
+ return;
+ }
+ break;
+ }
+ }
+ break;
+
+ case 5:
+ if (func_80147624(globalCtx)) {
+ switch (globalCtx->msgCtx.unk11F04) {
+ case 0xBEA:
+ gSaveContext.weekEventReg[9] |= 0x20;
+ func_80151938(globalCtx, 0xBEB);
+ break;
+
+ case 0xBEB:
+ case 0xBF0:
+ func_80151938(globalCtx, 0xBEC);
+ break;
+
+ case 0xBED:
+ case 0xBF4:
+ func_80151938(globalCtx, 0xBEE);
+ break;
+
+ case 0xBEE:
+ func_801477B4(globalCtx);
+ Audio_QueueSeqCmd(0x110000FF);
+ EnOwl_ChangeMode(this, func_8095B9FC, func_8095C484, &this->skelAnime1, &D_0600CB94, 0.0f);
+ this->eyeTexIndex = 0;
+ this->blinkTimer = Rand_S16Offset(60, 60);
+ this->actionFlags |= 8;
+ this->actor.flags &= ~0x10000;
+ this->actor.home.rot.x = 0;
+ func_8095ACEC(this);
+ this->unk_406 = 0;
+ this->actionFlags |= 0x40;
+ break;
+
+ case 0xBEF:
+ case 0xBF3:
+ func_801477B4(globalCtx);
+ Audio_QueueSeqCmd(0x110000FF);
+ func_8095ACEC(this);
+ this->actor.flags &= ~0x10000;
+ this->actor.textId = 0xBF0;
+ this->actionFunc = func_8095BE0C;
+ break;
+
+ case 0xBF1:
+ func_80151938(globalCtx, 0xBF2);
+ break;
+
+ case 0xBF5:
+ func_801477B4(globalCtx);
+ Audio_QueueSeqCmd(0x110000FF);
+ this->actor.flags &= ~0x10000;
+ EnOwl_ChangeMode(this, func_8095B3DC, func_8095C484, &this->skelAnime1, &D_0600CB94, 0.0f);
+ this->eyeTexIndex = 0;
+ this->blinkTimer = Rand_S16Offset(60, 60);
+ this->actionFlags |= 8;
+ func_8095ACEC(this);
+ break;
+ }
+ }
+ break;
+ }
+}
+
+void func_8095BE0C(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+ if (func_800B84D0(&this->actor, globalCtx)) {
+ this->actionFunc = func_8095BA84;
+ func_801A3098(0x45);
+ this->unk_406 = 1;
+ this->actionFlags |= 0x40;
+ } else if (this->actor.textId == 0xBF0) {
+ if (this->actor.isTargeted) {
+ func_800B8500(&this->actor, globalCtx, 200.0f, 200.0f, 0);
+ }
+ } else if (this->actor.xzDistToPlayer < 200.0f) {
+ this->actor.flags |= 0x10000;
+ func_800B8500(&this->actor, globalCtx, 200.0f, 200.0f, 0);
+ } else {
+ this->actor.flags &= ~0x10000;
+ }
+}
+
+void func_8095BF20(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A9FC(this, globalCtx, 0x7D0);
+ this->actionFunc = func_8095ABF0;
+}
+
+void func_8095BF58(EnOwl* this, GlobalContext* globalCtx) {
+ func_8095A920(this, globalCtx);
+}
+
+void func_8095BF78(EnOwl* this, GlobalContext* globalCtx) {
+ this->actor.flags |= 0x20;
+ if (this->actor.xzDistToPlayer > 6000.0f) {
+ Actor_MarkForDeath(&this->actor);
+ }
+
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x80, 0x40);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ if (this->actor.speedXZ < 16.0f) {
+ this->actor.speedXZ += 0.5f;
+ }
+
+ if ((this->unk_3E4 + 1000.0f) < this->actor.world.pos.y) {
+ if (this->actor.velocity.y > 0.0f) {
+ this->actor.velocity.y -= 0.4f;
+ }
+ } else if (this->actor.velocity.y < 4.0f) {
+ this->actor.velocity.y += 0.2f;
+ }
+}
+
+void func_8095C09C(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->skelAnime1.curFrame > 10.0f) {
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x400, 0x40);
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ }
+
+ if (this->skelAnime1.curFrame > 45.0f) {
+ this->actor.velocity.y = 2.0f;
+ this->actor.gravity = 0.0f;
+ this->actor.speedXZ = 8.0f;
+ } else if (this->skelAnime1.curFrame > 17.0f) {
+ this->actor.velocity.y = 6.0f;
+ this->actor.gravity = 0.0f;
+ this->actor.speedXZ = 4.0f;
+ }
+
+ if (this->actionFlags & 1) {
+ EnOwl_ChangeMode(this, func_8095BF78, func_8095C328, &this->skelAnime1, &D_06001ADC, 0.0f);
+ this->unk_3EA = 6;
+ this->unk_3EC += 0x2000;
+ }
+
+ func_8095B158(this);
+}
+
+void func_8095C1C8(EnOwl* this, GlobalContext* globalCtx) {
+ if (this->actionFlags & 1) {
+ this->unk_3EA = 3;
+ EnOwl_ChangeMode(this, func_8095C09C, func_8095C484, &this->skelAnime1, &D_06001168, 0.0f);
+ this->unk_3EC = BINANG_ADD(this->actor.world.rot.y, 0x4000);
+ this->unk_3E4 = this->actor.world.pos.y;
+ this->actor.velocity.y = 2.0f;
+ }
+ this->actionFlags |= 8;
+}
+
+void func_8095C258(EnOwl* this) {
+ SkelAnime_Update(this->skelAnime3);
+ if (this->unk_3EA > 0) {
+ this->unk_3EA--;
+ this->actor.shape.rot.z = Math_SinS(this->unk_3EA * 0x333) * 1000.0f;
+ } else {
+ this->unk_414 = func_8095C328;
+ this->unk_3EA = 6;
+ Animation_Change(this->skelAnime3, &D_06001ADC, 1.0f, 0.0f, Animation_GetLastFrame(&D_06001ADC), 2, 5.0f);
+ }
+}
+
+void func_8095C328(EnOwl* this) {
+ if (SkelAnime_Update(this->skelAnime3)) {
+ if (this->unk_3EA > 0) {
+ this->unk_3EA--;
+ Animation_Change(this->skelAnime3, this->skelAnime3->animation, 1.0f, 0.0f,
+ Animation_GetLastFrame(this->skelAnime3->animation), 2, 0.0f);
+ } else {
+ this->unk_3EA = 160;
+ this->unk_414 = func_8095C258;
+ Animation_Change(this->skelAnime3, &D_0600C6D4, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600C6D4), 0, 5.0f);
+ }
+ }
+}
+
+void func_8095C408(EnOwl* this) {
+ if (SkelAnime_Update(this->skelAnime3)) {
+ Animation_Change(this->skelAnime3, this->skelAnime3->animation, 1.0f, 18.0f, 35.0f, 2, 0.0f);
+ this->actionFlags |= 1;
+ } else {
+ this->actionFlags &= ~1;
+ }
+}
+
+void func_8095C484(EnOwl* this) {
+ if (SkelAnime_Update(this->skelAnime3)) {
+ Animation_Change(this->skelAnime3, this->skelAnime3->animation, 1.0f, 0.0f,
+ Animation_GetLastFrame(this->skelAnime3->animation), 2, 0.0f);
+ this->actionFlags |= 1;
+ } else {
+ this->actionFlags &= ~1;
+ }
+}
+
+s32 func_8095C510(EnOwl* this) {
+ s32 phi_v1;
+
+ if (this->actionFlags & 2) {
+ phi_v1 = 0x20;
+ } else {
+ phi_v1 = 0;
+ }
+
+ if (phi_v1 == (this->unk_3DA & 0x3F)) {
+ return true;
+ }
+
+ if (this->actionFlags & 0x20) {
+ this->unk_3DA += 4;
+ } else {
+ this->unk_3DA -= 4;
+ }
+
+ return false;
+}
+
+void func_8095C568(EnOwl* this) {
+ if (this->actionFlags & 0x40) {
+ if ((this->unk_406 < 0) || (this->unk_400[this->unk_406] < 0)) {
+ this->actionFlags &= ~0x40;
+ } else if (ActorCutscene_GetCurrentIndex() == 0x7C) {
+ ActorCutscene_Stop(0x7C);
+ ActorCutscene_SetIntentToPlay(this->unk_400[this->unk_406]);
+ } else if (ActorCutscene_GetCanPlayNext(this->unk_400[this->unk_406])) {
+ ActorCutscene_StartAndSetUnkLinkFields(this->unk_400[this->unk_406], &this->actor);
+ this->actionFlags &= ~0x40;
+ } else {
+ ActorCutscene_SetIntentToPlay(this->unk_400[this->unk_406]);
+ }
+ }
+}
+
+void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) {
+ s32 pad;
+ EnOwl* this = THIS;
+ s16 sp36;
+
+ if (this->actor.draw != NULL) {
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ }
+
+ if (this->unk_414 != NULL) {
+ this->unk_414(this);
+ }
+
+ this->actionFunc(this, globalCtx);
+ func_8095C568(this);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4);
+ Collider_UpdateCylinder(&this->actor, &this->collider);
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ if (this->actor.update != NULL) {
+ if ((this->skelAnime1.animation == &D_06001ADC) && Animation_OnFrame(&this->skelAnime1, 4.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_OWL_FLUTTER);
+ }
+
+ if (this->actionFlags & 2) {
+ this->eyeTexIndex = 2;
+ } else {
+ if (DECR(this->blinkTimer) == 0) {
+ this->blinkTimer = Rand_S16Offset(60, 60);
+ }
+ this->eyeTexIndex = this->blinkTimer;
+ if (this->eyeTexIndex >= 3) {
+ this->eyeTexIndex = 0;
+ }
+ }
+
+ if (!(this->actionFlags & 8)) {
+ sp36 = 0;
+
+ if (this->actionFlags & 0x10) {
+ switch (this->unk_408) {
+ case 0:
+ this->unk_408 = 1;
+ this->unk_409 = 6;
+ break;
+
+ case 1:
+ this->unk_409--;
+ if (this->unk_409 != 0) {
+ sp36 = Math_CosS(this->unk_409 * 0x2000) * 0x1000;
+ } else {
+ if (this->actionFlags & 2) {
+ this->unk_3DA = 0;
+ } else {
+ this->unk_3DA = 0x20;
+ }
+
+ if (this->actionFlags & 0x20) {
+ this->unk_3DA -= 4;
+ } else {
+ this->unk_3DA += 4;
+ }
+ this->unk_408++;
+ }
+
+ if (this->actionFlags & 0x20) {
+ sp36 = -sp36;
+ }
+ break;
+
+ case 2:
+ if (func_8095C510(this)) {
+ this->actionFlags &= ~0x10;
+ this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60;
+ this->unk_408 = 0;
+ func_8095AB4C(this);
+ }
+ break;
+ }
+ } else {
+ if (this->unk_40A > 0) {
+ this->unk_40A--;
+ } else {
+ if (this->unk_408 == 0) {
+ if (Rand_ZeroOne() < 0.3f) {
+ this->unk_408 = 4;
+ this->unk_409 = 12;
+ } else {
+ this->unk_408 = 1;
+ this->unk_409 = 4;
+ }
+ }
+ this->unk_409--;
+
+ switch (this->unk_408) {
+ case 1:
+ sp36 = Math_SinS((-this->unk_409 * 0x1000) + 0x4000) * 5000.0f;
+ if (this->unk_409 <= 0) {
+ this->unk_409 = (s32)(Rand_ZeroFloat(15.0f) + 5.0f);
+ this->unk_408 = 2;
+ }
+ break;
+
+ case 2:
+ sp36 = 0x1388;
+ if (this->unk_409 <= 0) {
+ this->unk_408 = 3;
+ this->unk_409 = 4;
+ }
+ break;
+
+ case 3:
+ sp36 = Math_SinS(this->unk_409 * 0x1000) * 5000.0f;
+ if (this->unk_409 <= 0) {
+ this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60;
+ this->unk_408 = 0;
+ func_8095AB4C(this);
+ }
+ break;
+
+ case 4:
+ sp36 = Math_SinS(this->unk_409 * 0x2000) * 5000.0f;
+ if (this->unk_409 <= 0) {
+ this->unk_40A = (s32)Rand_ZeroFloat(20.0f) + 60;
+ this->unk_408 = 0;
+ func_8095AB4C(this);
+ }
+ break;
+ }
+
+ if (this->actionFlags & 0x20) {
+ sp36 = -sp36;
+ }
+ }
+
+ if (this->unk_40D > 0) {
+ this->unk_40D--;
+ } else {
+ this->unk_40C--;
+ switch (this->unk_40B) {
+ case 0:
+ this->unk_3DE = (-this->unk_40C * 0x5DC) + 0x1770;
+ if (this->unk_40C <= 0) {
+ this->unk_40B = 1;
+ this->unk_40C = (s8)(Rand_ZeroFloat(15.0f) + 5.0f);
+ }
+ break;
+
+ case 1:
+ this->unk_3DE = 0x1770;
+ if (this->unk_40C <= 0) {
+ this->unk_40B = 2;
+ this->unk_40C = 4;
+ }
+ break;
+
+ case 2:
+ this->unk_3DE = this->unk_40C * 0x5DC;
+ if (this->unk_40C <= 0) {
+ this->unk_40B = 0;
+ this->unk_40C = 4;
+ this->unk_40D = (s32)Rand_ZeroFloat(40.0f) + 160;
+ }
+ break;
+ }
+ }
+ }
+
+ if (sp36) {}
+ this->unk_3DC = (u16)((this->unk_3DA << 2) << 8) + sp36;
+ this->unk_3D8 = ABS(this->unk_3DC) >> 3;
+ } else {
+ this->unk_3DE = 0;
+ if (this->actionFlags & 2) {
+ this->unk_3DC = -0x8000;
+ } else {
+ this->unk_3DC = 0;
+ }
+
+ this->unk_3D8 = ABS(this->unk_3DC) >> 3;
+ }
+ }
+}
+
+void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx) {
+ EnOwl* this = THIS;
+ Player* player = GET_PLAYER(globalCtx);
+
+ if (player->stateFlags3 & 0x10000000) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+
+ if (this->actor.world.pos.y < (this->unk_3F0 - 1000.0f)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+
+ this->actor.world.pos.y -= 1.0f;
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4);
+ if (this->actor.bgCheckFlags & 1) {
+ this->unk_3DA = (this->unk_3DA >> 3) * 7;
+ if (this->unk_3DC > 0) {
+ this->unk_3DC--;
+ } else {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ }
+
+ this->unk_3D8 += this->unk_3DA;
+ this->unk_3DA -= (s16)(this->unk_3D8 >> 6);
+}
+
+s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnOwl* this = THIS;
+
+ switch (limbIndex) {
+ case 3:
+ rot->x += this->unk_3DC;
+ rot->z += this->unk_3D8;
+ rot->z -= this->unk_3DE;
+ break;
+
+ case 2:
+ rot->z += this->unk_3DE;
+ break;
+
+ case 4:
+ if (!(this->actionFlags & 8)) {
+ rot->y -= (s16)(this->unk_3D8 * 1.5f);
+ }
+ break;
+
+ case 5:
+ if (!(this->actionFlags & 8)) {
+ rot->y += (s16)(this->unk_3D8 * 1.5f);
+ }
+ break;
+ }
+
+ return false;
+}
+
+void EnOwl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ EnOwl* this = THIS;
+ Vec3f sp18;
+
+ sp18.z = 0.0f;
+ if (this->actionFlags & 2) {
+ sp18.x = 700.0f;
+ sp18.y = 400.0f;
+ } else {
+ sp18.y = 0.0f;
+ sp18.x = 1400.0f;
+ }
+
+ if (limbIndex == 3) {
+ Matrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
+ }
+}
+
+void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ static TexturePtr eyeTextures[] = {
+ &D_06008EB8,
+ &D_060092B8,
+ &D_060096B8,
+ };
+ s32 pad;
+ EnOwl* this = THIS;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C5B0(globalCtx->state.gfxCtx);
+
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeTexIndex]));
+
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime3->skeleton, this->skelAnime3->jointTable,
+ this->skelAnime3->dListCount, EnOwl_OverrideLimbDraw, EnOwl_PostLimbDraw, &this->actor);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void func_8095D074(Actor* thisx, GlobalContext* globalCtx) {
+ EnOwl* this = THIS;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ Matrix_InsertTranslation(0.0f, 500.0f, 0.0f, 1);
+ Matrix_InsertXRotation_s(this->unk_3D8 - 0x4000, 1);
+ Matrix_InsertTranslation(0.0f, 0.0f, -500.0f, 1);
+ if (this->unk_3DC >= 0x20) {
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2);
+ gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
+ gSPDisplayList(POLY_OPA_DISP++, D_06001200);
+ } else {
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ func_8012C2DC(globalCtx->state.gfxCtx);
+
+ gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_XLU_SURF2);
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)(this->unk_3DC * 8));
+ gSPDisplayList(POLY_XLU_DISP++, D_06001200);
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, EnOwlFunc unkFunc, SkelAnime* skelAnime,
+ AnimationHeader* animationSeg, f32 transitionRate) {
+ this->skelAnime3 = skelAnime;
+ Animation_Change(this->skelAnime3, animationSeg, 1.0f, 0.0f, Animation_GetLastFrame(animationSeg), 2,
+ transitionRate);
+ this->actionFunc = actionFunc;
+ this->unk_414 = unkFunc;
+}
diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h
index f53d19361..ee9e1fdd8 100644
--- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h
+++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h
@@ -6,12 +6,54 @@
struct EnOwl;
typedef void (*EnOwlActionFunc)(struct EnOwl*, GlobalContext*);
+typedef void (*EnOwlFunc)(struct EnOwl*);
+
+#define ENOWL_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC)
+#define ENOWL_GET_TYPE(thisx) (((thisx)->params & 0xF80) >> 7)
+#define ENOWL_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F)
+
+typedef enum {
+ /* 0x001 */ ENOWL_GET_TYPE_1 = 1,
+ /* 0x002 */ ENOWL_GET_TYPE_2,
+ /* 0x003 */ ENOWL_GET_TYPE_3,
+ /* 0x01E */ ENOWL_GET_TYPE_30 = 30,
+ /* 0x3E8 */ ENOWL_GET_TYPE_1000 = 1000,
+} EnOwlType;
typedef struct EnOwl {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x2CC];
+ /* 0x0144 */ ColliderCylinder collider;
+ /* 0x0190 */ SkelAnime skelAnime1;
+ /* 0x01D4 */ Vec3s jointTable1[21];
+ /* 0x0252 */ Vec3s morphTable1[21];
+ /* 0x02D0 */ SkelAnime skelAnime2;
+ /* 0x0314 */ Vec3s jointTable2[16];
+ /* 0x0374 */ Vec3s morphTable2[16];
+ /* 0x03D4 */ SkelAnime* skelAnime3;
+ /* 0x03D8 */ s16 unk_3D8;
+ /* 0x03DA */ s16 unk_3DA;
+ /* 0x03DC */ s16 unk_3DC;
+ /* 0x03DE */ s16 unk_3DE;
+ /* 0x03E0 */ s16 eyeTexIndex;
+ /* 0x03E2 */ s16 blinkTimer;
+ /* 0x03E4 */ f32 unk_3E4;
+ /* 0x03E8 */ u16 actionFlags;
+ /* 0x03EA */ s16 unk_3EA;
+ /* 0x03EC */ s16 unk_3EC;
+ /* 0x03F0 */ f32 unk_3F0;
+ /* 0x03F4 */ Path* path;
+ /* 0x03F8 */ s32 unk_3F8;
+ /* 0x03FC */ s32 unk_3FC;
+ /* 0x0400 */ s16 unk_400[3];
+ /* 0x0406 */ s16 unk_406;
+ /* 0x0408 */ u8 unk_408;
+ /* 0x0409 */ u8 unk_409;
+ /* 0x040A */ u8 unk_40A;
+ /* 0x040B */ u8 unk_40B;
+ /* 0x040C */ u8 unk_40C;
+ /* 0x040D */ u8 unk_40D;
/* 0x0410 */ EnOwlActionFunc actionFunc;
- /* 0x0414 */ char unk_414[0x4];
+ /* 0x0414 */ EnOwlFunc unk_414;
} EnOwl; // size = 0x418
extern const ActorInit En_Owl_InitVars;
diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
index 7a99b804a..bb7a5ffbd 100644
--- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
+++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
@@ -152,8 +152,8 @@ void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) {
Vec3f sp44;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 15.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06008448, &D_060005BC, this->limbDrawTbl, this->transitionDrawTbl,
- PAMERA_LIMB_MAX);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06008448, &D_060005BC, this->jointTable, this->morphTable,
+ PAMERA_LIMB_MAX);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit2);
@@ -406,7 +406,7 @@ void EnPamera_LookDownWell(EnPamera* this) {
void func_80BD8F60(EnPamera* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x3000, 0x1000);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_800BDC5C(&this->skelAnime, sAnimations, 2);
this->actor.speedXZ = 3.0f;
func_80BD93CC(this, 0, 0);
@@ -432,7 +432,7 @@ void func_80BD909C(EnPamera* this, GlobalContext* globalCtx) {
}
void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK && (this->actionFunc != func_80BD8758) &&
(this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) &&
@@ -510,12 +510,12 @@ void func_80BD93CC(EnPamera* this, s16 arg1, s16 arg2) {
void func_80BD93F4(EnPamera* this, GlobalContext* globalCtx) {
if ((this->actionFunc == func_80BD8B70) || (this->actionFunc == func_80BD8DB0) ||
(this->actionFunc == func_80BD8964) || (this->actionFunc == func_80BD8A7C)) {
- if (this->skelAnime.animCurrentSeg == &D_06008AE0) {
- if (func_801378B8(&this->skelAnime, 9.0f) || func_801378B8(&this->skelAnime, 18.0f)) {
+ if (this->skelAnime.animation == &D_06008AE0) {
+ if (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
- } else if ((this->skelAnime.animCurrentSeg == &D_06008E38) &&
- (func_801378B8(&this->skelAnime, 2.0f) || func_801378B8(&this->skelAnime, 6.0f))) {
+ } else if ((this->skelAnime.animation == &D_06008E38) &&
+ (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
}
@@ -536,7 +536,7 @@ void EnPamera_Update(Actor* thisx, GlobalContext* globalCtx) {
EnPamera* this = THIS;
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80BD90AC(this, globalCtx);
func_80BD9384(this, globalCtx);
func_80BD94E0(this, globalCtx);
@@ -557,8 +557,10 @@ s32 EnPamera_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
}
void EnPamera_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
+ EnPamera* this = THIS;
+
if (limbIndex == PAMERA_LIMB_HAIR) {
- SysMatrix_MultiplyVector3fByState(&D_80BDA5F0, &thisx->focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80BDA5F0, &this->actor.focus.pos);
}
}
@@ -570,8 +572,8 @@ void EnPamera_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BDA604[this->unk_312]));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80BDA610[this->unk_314]));
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80BDA5FC[this->unk_310]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnPamera_OverrideLimbDraw, EnPamera_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnPamera_OverrideLimbDraw, EnPamera_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -775,13 +777,13 @@ void func_80BD9EE0(EnPamera* this) {
void func_80BD9F3C(EnPamera* this, GlobalContext* globalCtx) {
if (this->unk_31E == 1) {
- if (func_801378B8(&this->skelAnime, 2.0f) || func_801378B8(&this->skelAnime, 6.0f) ||
- func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 14.0f) ||
- func_801378B8(&this->skelAnime, 18.0f) || func_801378B8(&this->skelAnime, 22.0f) ||
- func_801378B8(&this->skelAnime, 25.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) ||
+ Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f) ||
+ Animation_OnFrame(&this->skelAnime, 18.0f) || Animation_OnFrame(&this->skelAnime, 22.0f) ||
+ Animation_OnFrame(&this->skelAnime, 25.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_31E = 0;
func_80BD93CC(this, 0, 0);
func_800BDC5C(&this->skelAnime, sAnimations, 6);
@@ -808,7 +810,7 @@ void func_80BDA0A0(EnPamera* this) {
void func_80BDA0FC(EnPamera* this, GlobalContext* globalCtx) {
if (this->unk_31E == 1) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_31E = 0;
func_80BD93CC(this, 0, 0);
func_800BDC5C(&this->skelAnime, sAnimations, 6);
@@ -825,11 +827,11 @@ void func_80BDA170(EnPamera* this) {
void func_80BDA1C8(EnPamera* this, GlobalContext* globalCtx) {
if (this->unk_31E == 1) {
- if (func_801378B8(&this->skelAnime, 2.0f) || func_801378B8(&this->skelAnime, 6.0f) ||
- func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 14.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) ||
+ Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_31E = 0;
func_80BD93CC(this, 0, 0);
func_800BDC5C(&this->skelAnime, sAnimations, 10);
@@ -846,7 +848,7 @@ void func_80BDA288(EnPamera* this) {
void func_80BDA2E0(EnPamera* this, GlobalContext* globalCtx) {
if (this->unk_31E == 1) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_31E = 0;
func_800BDC5C(&this->skelAnime, sAnimations, 12);
}
@@ -858,7 +860,7 @@ void func_80BDA344(Actor* thisx, GlobalContext* globalCtx) {
EnPamera* this = THIS;
this->actionFunc(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_80BD9384(this, globalCtx);
if (func_80BD9CB8(this, globalCtx)) {
// Pamela is outside
diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h
index 4ad65de5e..d19030aae 100644
--- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h
+++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h
@@ -46,8 +46,8 @@ typedef struct EnPamera {
/* 0x1E4 */ s32 pathPointsCount;
/* 0x1E8 */ s32 pathId;
/* 0x1EC */ s32 unk_1EC;
- /* 0x1F0 */ Vec3s limbDrawTbl[PAMERA_LIMB_MAX];
- /* 0x27A */ Vec3s transitionDrawTbl[PAMERA_LIMB_MAX];
+ /* 0x1F0 */ Vec3s jointTable[PAMERA_LIMB_MAX];
+ /* 0x27A */ Vec3s morphTable[PAMERA_LIMB_MAX];
/* 0x304 */ Vec3s limb9Rot;
/* 0x30A */ Vec3s limb8Rot;
/* 0x310 */ s16 unk_310;
diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c
index 9e47e89bb..2b8246f34 100644
--- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c
+++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c
@@ -207,8 +207,7 @@ void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 55.0f);
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInit);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600DF98, &D_0600F990, this->limbDrawTable,
- this->transitionDrawTable, 24);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600DF98, &D_0600F990, this->jointTable, this->morphTable, 24);
Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colElement);
this->params = CLAMP(this->actor.params, 1, 4);
if (Actor_GetRoomCleared(globalCtx, globalCtx->roomCtx.currRoom.num)) {
@@ -336,8 +335,8 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) {
Math3D_CrossProduct(&this->unk_2DC, &floorNorm, &vec2);
EnPametfrog_Vec3fNormalize(&vec2);
- SysMatrix_InsertRotationAroundUnitVector_f(rotation, &vec2, 0);
- SysMatrix_MultiplyVector3fByState(&this->unk_2E8, &vec2);
+ Matrix_InsertRotationAroundUnitVector_f(rotation, &vec2, 0);
+ Matrix_MultiplyVector3fByState(&this->unk_2E8, &vec2);
Math_Vec3f_Copy(&this->unk_2E8, &vec2);
Math3D_CrossProduct(&this->unk_2E8, &floorNorm, &this->unk_2D0);
EnPametfrog_Vec3fNormalize(&this->unk_2D0);
@@ -398,9 +397,9 @@ void EnPametfrog_PlaceSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_JumpOnGround(EnPametfrog* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, 1.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 1.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_JUMP);
- } else if (func_801378B8(&this->skelAnime, 11.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
EnPametfrog_JumpWaterEffects(this, globalCtx);
Audio_PlayActorSound2(&this->actor, NA_SE_EV_WALK_WATER);
}
@@ -440,11 +439,11 @@ void EnPametfrog_ApplyStun(EnPametfrog* this) {
void EnPametfrog_SetupRearOnSnapper(EnPametfrog* this) {
if (this->actionFunc == EnPametfrog_RearOnSnapperRise) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06005694);
+ Animation_PlayOnce(&this->skelAnime, &D_06005694);
} else if (this->actionFunc == EnPametfrog_RearOnSnapperWave) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060052EC);
+ Animation_PlayOnce(&this->skelAnime, &D_060052EC);
} else {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06004680);
+ Animation_PlayOnce(&this->skelAnime, &D_06004680);
}
this->actor.flags &= ~1;
@@ -457,11 +456,11 @@ void EnPametfrog_RearOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
Vec3f rearingPoint;
s32 pad;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (Rand_ZeroOne() < 0.5f) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06004D50);
+ Animation_PlayOnce(&this->skelAnime, &D_06004D50);
} else {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06004680);
+ Animation_PlayOnce(&this->skelAnime, &D_06004680);
}
}
@@ -479,13 +478,13 @@ void EnPametfrog_RearOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupRearOnSnapperWave(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06004894);
+ Animation_PlayOnce(&this->skelAnime, &D_06004894);
this->timer = 15;
this->actionFunc = EnPametfrog_RearOnSnapperWave;
}
void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && this->timer > 0) {
+ if (SkelAnime_Update(&this->skelAnime) && this->timer > 0) {
this->timer--;
if (this->timer == 0) {
EnPametfrog_SetupRearOnSnapper(this);
@@ -494,7 +493,7 @@ void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, GlobalContext* globalCtx)
}
void EnPametfrog_SetupRearOnSnapperRise(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060050B8);
+ Animation_PlayOnce(&this->skelAnime, &D_060050B8);
this->timer = 10;
this->actor.params = GEKKO_REAR_ON_SNAPPER;
this->actor.shape.rot.x = 0;
@@ -504,7 +503,7 @@ void EnPametfrog_SetupRearOnSnapperRise(EnPametfrog* this) {
}
void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->timer--;
if (this->timer == 0) {
EnPametfrog_SetupRearOnSnapper(this);
@@ -518,7 +517,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx
Vec3f eye;
s16 yaw;
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06001F20);
+ Animation_PlayOnce(&this->skelAnime, &D_06001F20);
this->actor.params = GEKKO_FALL_OFF_SNAPPER;
this->actor.speedXZ = 7.0f;
this->actor.velocity.y = 15.0f;
@@ -539,7 +538,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx
void EnPametfrog_FallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
f32 sin;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.shape.rot.x += 0x800;
this->actor.shape.rot.z += 0x1000;
if (this->timer != 0) {
@@ -555,7 +554,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupJumpToWall(EnPametfrog* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060039C4, 2.0f, 0.0f, 0.0f, 0, -2.0f);
+ Animation_Change(&this->skelAnime, &D_060039C4, 2.0f, 0.0f, 0.0f, 0, -2.0f);
this->actor.shape.rot.x = 0;
this->actor.shape.rot.z = 0;
this->actor.bgCheckFlags &= ~8;
@@ -564,13 +563,13 @@ void EnPametfrog_SetupJumpToWall(EnPametfrog* this) {
}
void EnPametfrog_JumpToWall(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnPametfrog_JumpOnGround(this, globalCtx);
if ((this->actor.bgCheckFlags & 1) && (this->actor.bgCheckFlags & 8) && (this->actor.wallBgId == BGCHECK_SCENE) &&
(COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.y) < 0.5f)) {
EnPametfrog_SetupWallCrawl(this);
} else if (!(this->actor.bgCheckFlags & 1) ||
- ((this->skelAnime.animCurrentFrame > 1.0f) && (this->skelAnime.animCurrentFrame < 12.0f))) {
+ ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) {
this->actor.speedXZ = 12.0f;
} else {
this->actor.speedXZ = 0.0f;
@@ -579,7 +578,7 @@ void EnPametfrog_JumpToWall(EnPametfrog* this, GlobalContext* globalCtx) {
void EnPametfrog_SetupWallCrawl(EnPametfrog* this) {
if (this->actionFunc == EnPametfrog_JumpToWall) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001E14);
+ Animation_PlayLoop(&this->skelAnime, &D_06001E14);
this->collider.base.acFlags |= AC_ON;
this->unk_2D0.x = 0.0f;
this->unk_2D0.z = 0.0f;
@@ -599,7 +598,7 @@ void EnPametfrog_SetupWallCrawl(EnPametfrog* this) {
this->actor.floorPoly = this->actor.wallPoly;
this->wallPauseTimer = 10;
} else {
- this->skelAnime.animPlaybackSpeed = 1.0f;
+ this->skelAnime.playSpeed = 1.0f;
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_RUNAWAY);
@@ -623,7 +622,7 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx) {
if (this->freezeTimer > 0) {
this->freezeTimer--;
} else {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->timer--;
this->actor.speedXZ = 8.0f;
doubleSpeedXZ = this->actor.speedXZ * 2.0f;
@@ -657,7 +656,7 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx) {
func_8086A238(this);
}
- if (func_801378B8(&this->skelAnime, 15.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 15.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BOMCHU_WALK);
}
@@ -682,7 +681,7 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) {
f32 randFloat;
this->actor.speedXZ = 0.0f;
- this->skelAnime.animPlaybackSpeed = 1.5f;
+ this->skelAnime.playSpeed = 1.5f;
if (this->timer != 0) {
this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PI / 30) : (-M_PI / 30);
} else {
@@ -700,10 +699,10 @@ void EnPametfrog_WallPause(EnPametfrog* this, GlobalContext* globalCtx) {
if (this->freezeTimer > 0) {
this->freezeTimer--;
} else {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->timer--;
- SysMatrix_InsertRotationAroundUnitVector_f(this->wallRotation, &this->unk_2DC, 0);
- SysMatrix_MultiplyVector3fByState(&this->unk_2D0, &vec);
+ Matrix_InsertRotationAroundUnitVector_f(this->wallRotation, &this->unk_2DC, 0);
+ Matrix_MultiplyVector3fByState(&this->unk_2D0, &vec);
Math_Vec3f_Copy(&this->unk_2D0, &vec);
Math3D_CrossProduct(&this->unk_2DC, &this->unk_2D0, &this->unk_2E8);
func_8086A238(this);
@@ -720,8 +719,7 @@ void EnPametfrog_WallPause(EnPametfrog* this, GlobalContext* globalCtx) {
void EnPametfrog_SetupClimbDownWall(EnPametfrog* this) {
s16 yaw;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060039C4, 0.0f, 0.0f, SkelAnime_GetFrameCount(&D_060039C4.common), 2,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_060039C4, 0.0f, 0.0f, Animation_GetLastFrame(&D_060039C4), 2, 0.0f);
this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child);
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.shape.rot.x = 0;
@@ -755,31 +753,30 @@ void EnPametfrog_ClimbDownWall(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupRunToSnapper(EnPametfrog* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060039C4, 2.0f, 0.0f, 0.0f, 0, -2.0f);
+ Animation_Change(&this->skelAnime, &D_060039C4, 2.0f, 0.0f, 0.0f, 0, -2.0f);
this->actor.params = GEKKO_RETURN_TO_SNAPPER;
this->actionFunc = EnPametfrog_RunToSnapper;
}
void EnPametfrog_RunToSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnPametfrog_JumpOnGround(this, globalCtx);
this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (!(this->actor.bgCheckFlags & 1) ||
- ((this->skelAnime.animCurrentFrame > 1.0f) && (this->skelAnime.animCurrentFrame < 12.0f))) {
+ if (!(this->actor.bgCheckFlags & 1) || ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) {
this->actor.speedXZ = 12.0f;
} else {
this->actor.speedXZ = 0.0f;
}
if ((this->actor.child->params == 1) && (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < 120.0f) &&
- func_801378B8(&this->skelAnime, 0.0f)) {
+ Animation_OnFrame(&this->skelAnime, 0.0f)) {
EnPametfrog_SetupJumpOnSnapper(this);
}
}
void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06004680, 6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06004680, 6.0f);
this->timer = 6;
this->collider.base.ocFlags1 &= ~OC1_ON;
this->collider.base.acFlags &= ~AC_ON;
@@ -796,7 +793,7 @@ void EnPametfrog_JumpOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
f32 temp_f0;
EnBigpamet* bigpamet;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->timer--;
if (this->timer == 0) {
EnPametfrog_SetupLandOnSnapper(this);
@@ -811,14 +808,14 @@ void EnPametfrog_JumpOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupLandOnSnapper(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000994);
+ Animation_PlayOnce(&this->skelAnime, &D_06000994);
this->actor.shape.rot.y = this->actor.child->shape.rot.y;
this->actor.params = GEKKO_ON_SNAPPER;
this->actionFunc = EnPametfrog_LandOnSnapper;
}
void EnPametfrog_LandOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
EnPametfrog_StopCutscene(this, globalCtx);
EnPametfrog_SetupRearOnSnapper(this);
}
@@ -829,7 +826,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) {
Vec3f eye;
f32 xzDist;
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06001F20);
+ Animation_PlayOnce(&this->skelAnime, &D_06001F20);
if (this->actor.colChkInfo.health > 0) {
this->actor.params = GEKKO_RETURN_TO_SNAPPER;
}
@@ -868,7 +865,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->actor.colorFilterTimer = 0x10;
if (this->timer > 0) {
this->timer--;
@@ -890,7 +887,7 @@ void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupFallOnGround(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06004298);
+ Animation_PlayOnce(&this->skelAnime, &D_06004298);
this->actor.shape.rot.x = 0;
this->actor.shape.rot.y += this->spinYaw;
this->actor.shape.rot.z = 0;
@@ -903,15 +900,15 @@ void EnPametfrog_SetupFallOnGround(EnPametfrog* this, GlobalContext* globalCtx)
}
void EnPametfrog_FallOnGround(EnPametfrog* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
- if (this->skelAnime.animCurrentSeg == &D_06004298) {
+ if (SkelAnime_Update(&this->skelAnime)) {
+ if (this->skelAnime.animation == &D_06004298) {
if (this->actor.colChkInfo.health == 0) {
this->timer--;
if (this->timer == 0) {
EnPametfrog_SetupDefeatGekko(this, globalCtx);
}
} else {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060030E4);
+ Animation_PlayOnce(&this->skelAnime, &D_060030E4);
}
} else {
EnPametfrog_SetupRunToSnapper(this);
@@ -972,7 +969,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) {
static Vec3f sAccel = { 0.0f, -0.5f, 0.0f };
static Color_RGBA8 primColor = { 250, 250, 250, 255 };
static Color_RGBA8 envColor = { 180, 180, 180, 255 };
- s16 yaw = BINANG_ROT180(func_800DFCDC(ACTIVE_CAM));
+ s16 yaw = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)));
Vec3f vec1;
Vec3f vel;
s32 i;
@@ -1044,7 +1041,7 @@ void EnPametfrog_PlayCutscene(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupLookAround(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060066B4);
+ Animation_PlayOnce(&this->skelAnime, &D_060066B4);
this->collider.base.atFlags &= ~AT_ON;
this->actor.speedXZ = 0.0f;
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -1055,7 +1052,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx) {
EnPametfrog_IdleWaterEffects(this, globalCtx);
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x400, 0x80);
this->actor.shape.rot.y = this->actor.world.rot.y;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (func_801690CC(globalCtx) == 0)) {
+ if (SkelAnime_Update(&this->skelAnime) && (func_801690CC(globalCtx) == 0)) {
if (!this->unk_2AE) {
func_801A2E54(0x38);
this->unk_2AE = true;
@@ -1065,7 +1062,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupJumpToLink(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060039C4);
+ Animation_PlayLoop(&this->skelAnime, &D_060039C4);
this->collider.base.acFlags |= AC_ON;
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actionFunc = EnPametfrog_JumpToLink;
@@ -1074,10 +1071,9 @@ void EnPametfrog_SetupJumpToLink(EnPametfrog* this) {
void EnPametfrog_JumpToLink(EnPametfrog* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x80);
this->actor.shape.rot.y = this->actor.world.rot.y;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnPametfrog_JumpOnGround(this, globalCtx);
- if (!(this->actor.bgCheckFlags & 1) ||
- (this->skelAnime.animCurrentFrame > 1.0f && this->skelAnime.animCurrentFrame < 12.0f)) {
+ if (!(this->actor.bgCheckFlags & 1) || (this->skelAnime.curFrame > 1.0f && this->skelAnime.curFrame < 12.0f)) {
this->actor.speedXZ = 8.0f;
} else {
this->actor.speedXZ = 0.0f;
@@ -1085,13 +1081,13 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, GlobalContext* globalCtx) {
if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) &&
Actor_IsActorFacingLink(&this->actor, 0x3000) &&
- (this->skelAnime.animCurrentFrame <= 2.0f || this->skelAnime.animCurrentFrame >= 11.0f)) {
+ (this->skelAnime.curFrame <= 2.0f || this->skelAnime.curFrame >= 11.0f)) {
EnPametfrog_SetupMeleeAttack(this);
}
}
void EnPametfrog_SetupMeleeAttack(EnPametfrog* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600F990);
+ Animation_PlayOnce(&this->skelAnime, &D_0600F990);
this->timer = 7;
this->actor.speedXZ = 0.0f;
this->actionFunc = EnPametfrog_MeleeAttack;
@@ -1106,23 +1102,23 @@ static AnimationHeader* sAttackAnimations[] = {
void EnPametfrog_MeleeAttack(EnPametfrog* this, GlobalContext* globalCtx) {
EnPametfrog_IdleWaterEffects(this, globalCtx);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->timer--;
if (this->timer == 0) {
EnPametfrog_SetupLookAround(this);
} else if (this->timer == 6) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600F990);
+ Animation_PlayOnce(&this->skelAnime, &D_0600F990);
} else {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, sAttackAnimations[(s32)Rand_ZeroFloat(4.0f) % 4]);
+ Animation_PlayOnce(&this->skelAnime, sAttackAnimations[(s32)Rand_ZeroFloat(4.0f) % 4]);
}
}
- if ((this->skelAnime.animCurrentSeg == &D_0600347C && func_801378B8(&this->skelAnime, 2.0f)) ||
- (this->skelAnime.animCurrentSeg == &D_060070C4 && func_801378B8(&this->skelAnime, 9.0f)) ||
- (this->skelAnime.animCurrentSeg == &D_06003F28 && func_801378B8(&this->skelAnime, 2.0f)) ||
- ((this->skelAnime.animCurrentSeg == &D_0600F048) && func_801378B8(&this->skelAnime, 27.0f))) {
+ if ((this->skelAnime.animation == &D_0600347C && Animation_OnFrame(&this->skelAnime, 2.0f)) ||
+ (this->skelAnime.animation == &D_060070C4 && Animation_OnFrame(&this->skelAnime, 9.0f)) ||
+ (this->skelAnime.animation == &D_06003F28 && Animation_OnFrame(&this->skelAnime, 2.0f)) ||
+ ((this->skelAnime.animation == &D_0600F048) && Animation_OnFrame(&this->skelAnime, 27.0f))) {
this->collider.base.atFlags |= AT_ON;
- if (this->skelAnime.animCurrentSeg == &D_06003F28) {
+ if (this->skelAnime.animation == &D_06003F28) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_KICK);
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_PUNCH1);
@@ -1133,7 +1129,7 @@ void EnPametfrog_MeleeAttack(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupDamage(EnPametfrog* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06005D54, -3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06005D54, -3.0f);
this->timer = 20;
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
@@ -1146,7 +1142,7 @@ void EnPametfrog_SetupDamage(EnPametfrog* this) {
}
void EnPametfrog_Damage(EnPametfrog* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->timer--;
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
if (this->timer == 0) {
@@ -1159,9 +1155,9 @@ void EnPametfrog_Damage(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_SetupStun(EnPametfrog* this) {
- if (this->skelAnime.animCurrentSeg == &D_060039C4) {
- this->skelAnime.animCurrentFrame = 0.0f;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ if (this->skelAnime.animation == &D_060039C4) {
+ this->skelAnime.curFrame = 0.0f;
+ SkelAnime_Update(&this->skelAnime);
}
this->collider.base.atFlags &= ~AT_ON;
@@ -1191,7 +1187,7 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
Vec3f at;
s16 yawDiff;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001B08, 3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001B08, 3.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_GREET);
this->actor.flags &= ~1;
this->actor.colChkInfo.health = 6;
@@ -1219,7 +1215,7 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
}
void EnPametfrog_CallSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
EnPametfrog_SetupSnapperSpawn(this, globalCtx);
}
}
@@ -1245,7 +1241,7 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx)
// Zooms in on Snapper spawn point
Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye);
- this->quake = Quake_Add(ACTIVE_CAM, 6);
+ this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6);
Quake_SetSpeed(this->quake, 18000);
Quake_SetQuakeValues(this->quake, 2, 0, 0, 0);
Quake_SetCountdown(this->quake, 15);
@@ -1268,7 +1264,7 @@ void EnPametfrog_SnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) {
void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx) {
this->actor.params = GEKKO_GET_SNAPPER;
Quake_RemoveFromIdx(this->quake);
- this->quake = Quake_Add(ACTIVE_CAM, 3);
+ this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3);
Quake_SetSpeed(this->quake, 20000);
Quake_SetQuakeValues(this->quake, 17, 0, 0, 0);
Quake_SetCountdown(this->quake, 12);
@@ -1408,16 +1404,16 @@ static s8 limbPosIndex[] = {
-1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, 6, -1, 7, 8, 9, -1, 10, -1, 11, -1, -1,
};
-void EnPametfrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnPametfrog* this = THIS;
+void EnPametfrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnPametfrog* this = (EnPametfrog*)arg;
Vec3f vec;
Vec3s* center;
s8 index;
if (limbIndex == GEKKO_LIMB_HEAD) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
this->actor.focus.rot.y = this->actor.shape.rot.y;
- SysMatrix_GetStateTranslationAndScaledY(2500.0f, &vec);
+ Matrix_GetStateTranslationAndScaledY(2500.0f, &vec);
center = &this->collider.elements[0].dim.worldSphere.center;
center->x = vec.x;
center->y = vec.y;
@@ -1430,7 +1426,7 @@ void EnPametfrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
index = limbPosIndex[limbIndex];
if (index != -1) {
- SysMatrix_GetStateTranslation(&this->limbPos[index]);
+ Matrix_GetStateTranslation(&this->limbPos[index]);
}
}
@@ -1439,8 +1435,8 @@ void EnPametfrog_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
Matrix_RotateY(this->spinYaw, MTXMODE_APPLY);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- EnPametfrog_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, EnPametfrog_PostLimbDraw, &this->actor);
func_800BE680(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->unk_2C8, this->unk_2CC,
this->unk_2C4, this->drawEffect);
}
diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
index 58b8dcf4b..f00acecb5 100644
--- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
+++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
@@ -58,8 +58,8 @@ typedef enum {
typedef struct EnPametfrog {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[GEKKO_LIMB_MAX];
- /* 0x218 */ Vec3s transitionDrawTable[GEKKO_LIMB_MAX];
+ /* 0x188 */ Vec3s jointTable[GEKKO_LIMB_MAX];
+ /* 0x218 */ Vec3s morphTable[GEKKO_LIMB_MAX];
/* 0x2A8 */ EnPametfrogActionFunc actionFunc;
/* 0x2AC */ u8 drawEffect;
/* 0x2AD */ u8 wallPauseTimer; // Gekko stops 10 times along wall/ceiling after being blown off of Snapper
diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
index b4d540fe7..c578e3d37 100644
--- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
+++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c
@@ -26,7 +26,7 @@ void EnPoFusen_Pop(EnPoFusen* this, GlobalContext* globalCtx);
void EnPoFusen_Idle(EnPoFusen* this, GlobalContext* globalCtx);
void EnPoFusen_IdleFuse(EnPoFusen* this, GlobalContext* globalCtx);
s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- struct Actor* actor);
+ Actor* arg);
extern AnimationHeader D_06000040;
extern FlexSkeletonHeader D_060024F0;
@@ -111,7 +111,7 @@ void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) {
if (0) {}
this->collider.dim.worldSphere.radius = 40;
- SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, this->limbDrawTbl, this->transitionDrawTbl, 10);
+ SkelAnime_InitFlex(globalCtx, &this->anime, &D_060024F0, &D_06000040, this->jointTable, this->morphTable, 10);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x4);
@@ -271,8 +271,8 @@ void EnPoFusen_Update(Actor* thisx, GlobalContext* globalCtx) {
}
s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
- struct Actor* actor) {
- EnPoFusen* this = (EnPoFusen*)actor;
+ Actor* arg) {
+ EnPoFusen* this = (EnPoFusen*)arg;
f32 zScale;
f32 yScale;
f32 xScale;
@@ -289,10 +289,10 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
yScale = yScale * yScale;
xRot = ((Math_SinS(this->randXZRotChange) * 2730.0f));
zRot = ((Math_CosS(this->randXZRotChange) * 2730.0f));
- SysMatrix_InsertRotation(xRot, 0, zRot, 1);
- Matrix_Scale(xScale, yScale, zScale, 1);
- SysMatrix_InsertZRotation_s(-zRot, 1);
- SysMatrix_InsertXRotation_s(-xRot, 1);
+ Matrix_InsertRotation(xRot, 0, zRot, MTXMODE_APPLY);
+ Matrix_Scale(xScale, yScale, zScale, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(-zRot, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(-xRot, MTXMODE_APPLY);
} else if (limbIndex == 3) {
rot->y += this->limb3Rot;
} else if (limbIndex == 6) {
@@ -310,15 +310,15 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
return 0;
}
-void EnPoFusen_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor) {
+void EnPoFusen_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
}
-void EnPoFusen_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* actor) {
+void EnPoFusen_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
}
void EnPoFusen_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnPoFusen* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- func_801343C0(globalCtx, this->anime.skeleton, this->anime.limbDrawTbl, this->anime.dListCount,
+ func_801343C0(globalCtx, this->anime.skeleton, this->anime.jointTable, this->anime.dListCount,
EnPoFusen_OverrideLimbDraw, EnPoFusen_PostLimbDraw, EnPoFusen_UnkActorDraw, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h
index b19cc01f9..5a879ddb1 100644
--- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h
+++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h
@@ -12,8 +12,8 @@ typedef struct EnPoFusen {
/* 0x144 */ SkelAnime anime;
/* 0x188 */ EnPoFusenActionFunc actionFunc;
/* 0x18C */ ColliderSphere collider;
- /* 0x1E4 */ Vec3s limbDrawTbl[0xA];
- /* 0x220 */ Vec3s transitionDrawTbl[0xA];
+ /* 0x1E4 */ Vec3s jointTable[0xA];
+ /* 0x220 */ Vec3s morphTable[0xA];
/* 0x25C */ s16 randScaleChange;
/* 0x25E */ s16 randXZRotChange;
/* 0x260 */ s16 randYRotChange;
diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c
index ae56732b7..bddd970b9 100644
--- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c
+++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_poh.c
+ * Overlay: ovl_En_Poh
+ * Description: Poe
+ */
+
#include "z_en_poh.h"
#define FLAGS 0x00001205
@@ -10,23 +16,46 @@ void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx);
void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2CB60(EnPoh* this);
void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2CD14(EnPoh* this);
void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2CEC8(EnPoh* this);
void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx);
void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2D0E8(EnPoh* this);
void func_80B2D140(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2D2C0(EnPoh* this);
void func_80B2D300(EnPoh* this, GlobalContext* globalCtx);
void func_80B2D628(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2D694(EnPoh* this);
void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx);
void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx);
void func_80B2D980(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2DAD0(EnPoh* this);
void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx);
void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2E0B0(EnPoh* this);
void func_80B2E180(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2E1D8(EnPoh* this);
void func_80B2E230(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2E3B0(EnPoh* this);
void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx);
+void func_80B2F328(Actor* thisx, GlobalContext* globalCtx);
+void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx);
+
+extern AnimationHeader D_060001A8;
+extern AnimationHeader D_060004EC;
+extern AnimationHeader D_060006E0;
+extern AnimationHeader D_06000A60;
+extern AnimationHeader D_060011C4;
+extern AnimationHeader D_060015B0;
+extern Gfx D_06002608[];
+extern Gfx D_06002D28[];
+extern Gfx D_06003850[];
+extern SkeletonHeader D_060050D0;
-#if 0
const ActorInit En_Poh_InitVars = {
ACTOR_EN_POH,
ACTORCAT_ENEMY,
@@ -39,29 +68,54 @@ const ActorInit En_Poh_InitVars = {
(ActorFunc)EnPoh_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80B2F680 = {
- { COLTYPE_HIT3, AT_NONE, AC_NONE | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CBFFFE, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_HIT3,
+ AT_NONE,
+ AC_NONE | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0xF7CBFFFE, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON | BUMP_HOOKABLE,
+ OCELEM_ON,
+ },
{ 20, 40, 20, { 0, 0, 0 } },
};
-// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
-static ColliderJntSphElementInit D_80B2F6AC[1] = {
+static ColliderJntSphElementInit sJntSphElementsInit[1] = {
{
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x08 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
{ 18, { { 0, 1400, 0 }, 10 }, 100 },
},
};
-// static ColliderJntSphInit sJntSphInit = {
-static ColliderJntSphInit D_80B2F6D0 = {
- { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
- 1, D_80B2F6AC, // sJntSphElementsInit,
+static ColliderJntSphInit sJntSphInit = {
+ {
+ COLTYPE_HIT3,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_JNTSPH,
+ },
+ 1,
+ sJntSphElementsInit,
};
-// static DamageTable sDamageTable = {
-static DamageTable D_80B2F6E0 = {
+static DamageTable sDamageTable = {
/* Deku Nut */ DMG_ENTRY(0, 0xF),
/* Deku Stick */ DMG_ENTRY(1, 0x0),
/* Horse trample */ DMG_ENTRY(0, 0x0),
@@ -96,123 +150,874 @@ static DamageTable D_80B2F6E0 = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-// sColChkInfoInit
-static CollisionCheckInfoInit D_80B2F700 = { 3, 25, 50, 50 };
+static CollisionCheckInfoInit sColChkInfoInit = { 3, 25, 50, 50 };
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_80B2F708[] = {
+static InitChainEntry sInitChain[] = {
ICHAIN_S8(hintId, 68, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP),
};
-#endif
+void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnPoh* this = THIS;
+ s32 pad;
-extern ColliderCylinderInit D_80B2F680;
-extern ColliderJntSphElementInit D_80B2F6AC[1];
-extern ColliderJntSphInit D_80B2F6D0;
-extern DamageTable D_80B2F6E0;
-extern CollisionCheckInfoInit D_80B2F700;
-extern InitChainEntry D_80B2F708[];
+ Actor_ProcessInitChain(&this->actor, sInitChain);
+ ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 30.0f);
+ Collider_InitAndSetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, this->colliderSphElements);
+ this->colliderSph.elements[0].dim.worldSphere.radius = 0;
+ this->colliderSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x;
+ this->colliderSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y;
+ this->colliderSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z;
+ Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit);
+ CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
+ this->unk_18D = 32;
+ this->unk_190 = Rand_S16Offset(700, 300);
+ this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
+ Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z,
+ 255, 255, 255, 0);
+ SkelAnime_Init(globalCtx, &this->skelAnime, &D_060050D0, &D_06000A60, this->jointTable, this->morphTable, 21);
+ this->actor.bgCheckFlags |= 0x400;
+ func_80B2D0E8(this);
+}
-extern UNK_TYPE D_060001A8;
-extern UNK_TYPE D_060004EC;
-extern UNK_TYPE D_060006E0;
-extern UNK_TYPE D_06000A60;
-extern UNK_TYPE D_060011C4;
-extern UNK_TYPE D_060015B0;
-extern UNK_TYPE D_06002608;
-extern UNK_TYPE D_06002D28;
+void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnPoh* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Init.s")
+ LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode);
+ Collider_DestroyJntSph(globalCtx, &this->colliderSph);
+ Collider_DestroyCylinder(globalCtx, &this->colliderCylinder);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Destroy.s")
+void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) {
+ Camera* activeCam = GET_ACTIVE_CAM(globalCtx);
+ Vec3f sp20;
+ f32 temp_f0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2C910.s")
+ if (activeCam != NULL) {
+ Math_Vec3f_Diff(&activeCam->eye, &activeCam->at, &sp20);
+ temp_f0 = Math3D_Vec3fMagnitude(&sp20);
+ if (temp_f0 > 1.0f) {
+ temp_f0 = 11.0f / temp_f0;
+ } else {
+ temp_f0 = 11.0f;
+ }
+ Math_Vec3f_ScaleAndStore(&sp20, temp_f0, vec);
+ } else {
+ Math_Vec3f_Copy(vec, &D_801D15B0);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2C9B8.s")
+void func_80B2C9B8(EnPoh* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CA4C.s")
+ Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f);
+ this->actor.world.pos.y += 2.5f * Math_SinS(this->unk_18D * 0x800);
+ if (this->unk_18D != 0) {
+ this->unk_18D--;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CAA4.s")
+ if (!this->unk_18D) {
+ this->unk_18D = 32;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CB60.s")
+void func_80B2CA4C(EnPoh* this) {
+ Animation_PlayLoop(&this->skelAnime, &D_060015B0);
+ this->unk_18E = Rand_S16Offset(2, 3);
+ this->actionFunc = func_80B2CAA4;
+ this->actor.speedXZ = 0.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CBBC.s")
+void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) {
+ this->unk_18E--;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CD14.s")
+ func_80B2C9B8(this, globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CD64.s")
+ if (this->actor.xzDistToPlayer < 200.0f) {
+ func_80B2CD14(this);
+ } else if (this->unk_18E == 0) {
+ func_80B2CB60(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CEC8.s")
+ if (this->unk_197 == 255) {
+ func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CF28.s")
+void func_80B2CB60(EnPoh* this) {
+ Animation_PlayLoop(&this->skelAnime, &D_06000A60);
+ this->unk_18E = Rand_S16Offset(15, 3);
+ this->colliderCylinder.base.acFlags |= AC_ON;
+ this->actionFunc = func_80B2CBBC;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2CFF8.s")
+void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx) {
+ SkelAnime_Update(&this->skelAnime);
+ Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) {
+ this->unk_18E--;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D07C.s")
+ if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 400.0f) {
+ this->unk_192 = Actor_YawToPoint(&this->actor, &this->actor.home.pos);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D0E8.s")
+ Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C);
+ func_80B2C9B8(this, globalCtx);
+ if ((this->actor.xzDistToPlayer < 200.0f) && (this->unk_18E < 19)) {
+ func_80B2CD14(this);
+ } else if (this->unk_18E == 0) {
+ if (Rand_ZeroOne() < 0.1f) {
+ func_80B2D694(this);
+ } else {
+ func_80B2CA4C(this);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D140.s")
+ if (this->unk_197 == 255) {
+ func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D2C0.s")
+void func_80B2CD14(EnPoh* this) {
+ Animation_PlayLoop(&this->skelAnime, &D_06000A60);
+ this->actionFunc = func_80B2CD64;
+ this->unk_18E = 0;
+ this->actor.speedXZ = 2.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D300.s")
+void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+ s16 yawDiff;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D5DC.s")
+ SkelAnime_Update(&this->skelAnime);
+ if (this->unk_18E != 0) {
+ this->unk_18E--;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D628.s")
+ yawDiff = this->actor.yawTowardsPlayer - player->actor.shape.rot.y;
+ if (yawDiff > 0x3000) {
+ Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C);
+ } else if (yawDiff < -0x3000) {
+ Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x3000, 0x71C);
+ } else {
+ Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D694.s")
+ func_80B2C9B8(this, globalCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D6EC.s")
+ if (this->actor.xzDistToPlayer > 280.0f) {
+ func_80B2CB60(this);
+ } else if ((this->unk_18E == 0) && (this->actor.xzDistToPlayer < 140.0f) &&
+ !Actor_IsLinkFacingActor(&this->actor, 0x2AAA, globalCtx)) {
+ func_80B2CEC8(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D76C.s")
+ if (this->unk_197 == 255) {
+ func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D7D4.s")
+void func_80B2CEC8(EnPoh* this) {
+ Animation_MorphToLoop(&this->skelAnime, &D_060001A8, -6.0f);
+ this->unk_18E = 12;
+ this->actor.speedXZ = 0.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
+ this->actionFunc = func_80B2CF28;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D924.s")
+void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_KANTERA);
+ if (this->unk_18E != 0) {
+ this->unk_18E--;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2D980.s")
+ func_80B2C9B8(this, globalCtx);
+ if (this->unk_18E >= 10) {
+ Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xAAA);
+ } else if (this->unk_18E == 9) {
+ this->actor.speedXZ = 5.0f;
+ this->skelAnime.playSpeed = 2.0f;
+ } else if (this->unk_18E == 0) {
+ func_80B2CB60(this);
+ this->unk_18E = 0x17;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DAD0.s")
+void func_80B2CFF8(EnPoh* this) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060004EC, -6.0f);
+ func_800BE504(&this->actor, &this->colliderCylinder);
+ this->colliderCylinder.base.acFlags &= ~AC_ON;
+ this->actor.speedXZ = 5.0f;
+ func_800BCB70(&this->actor, 0x4000, 255, 0, 16);
+ this->actionFunc = func_80B2D07C;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DB44.s")
+void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx) {
+ Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
+ if (SkelAnime_Update(&this->skelAnime)) {
+ if (this->actor.colChkInfo.health != 0) {
+ func_80B2DAD0(this);
+ } else {
+ func_80B2D2C0(this);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DC50.s")
+void func_80B2D0E8(EnPoh* this) {
+ this->unk_197 = 0;
+ this->actor.flags &= ~1;
+ Animation_PlayOnceSetSpeed(&this->skelAnime, &D_060011C4, 0.0f);
+ this->actionFunc = func_80B2D140;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DD2C.s")
+void func_80B2D140(EnPoh* this, GlobalContext* globalCtx) {
+ if (SkelAnime_Update(&this->skelAnime)) {
+ this->unk_197 = 255;
+ this->unk_190 = Rand_S16Offset(700, 300);
+ this->actor.flags |= 1;
+ func_80B2CB60(this);
+ } else if (this->skelAnime.curFrame > 10.0f) {
+ this->unk_197 = (this->skelAnime.curFrame - 10.0f) * 0.05f * 255.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2DDF8.s")
+ if ((this->skelAnime.playSpeed < 0.5f) && (this->actor.xzDistToPlayer < 280.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR);
+ this->skelAnime.playSpeed = 1.0f;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E0B0.s")
+void func_80B2D2C0(EnPoh* this) {
+ this->actor.speedXZ = 0.0f;
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ this->unk_18E = 0;
+ this->actor.hintId = 0xFF;
+ this->actor.flags &= ~1;
+ this->actionFunc = func_80B2D300;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E180.s")
+void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) {
+ static Vec3f D_80B2F710 = { 0.0f, 3.0f, 0.0f };
+ Vec3f sp44;
+ f32 sp40;
+ s32 pad;
+ s16 sp3A;
+ s16 sp38;
+ s16 sp36;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E1D8.s")
+ this->unk_18E++;
+ if (this->unk_18E < 8) {
+ sp38 = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800;
+ if (this->unk_18E < 5) {
+ sp3A = (this->unk_18E * 0x1000) - 0x4000;
+ sp44.y = (Math_SinS(sp3A) * 23.0f) + (this->actor.world.pos.y + 40.0f);
+ sp40 = Math_CosS(sp3A) * 23.0f;
+ sp44.x = (Math_SinS(sp38) * sp40) + this->actor.world.pos.x;
+ sp44.z = (Math_CosS(sp38) * sp40) + this->actor.world.pos.z;
+ } else {
+ sp44.y = this->actor.world.pos.y + 40.0f + (15.0f * (this->unk_18E - 5));
+ sp44.x = (Math_SinS(sp38) * 23.0f) + this->actor.world.pos.x;
+ sp44.z = (Math_CosS(sp38) * 23.0f) + this->actor.world.pos.z;
+ }
+ sp36 = (this->unk_18E * 10) + 80;
+ func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2);
+ sp44.x = (2.0f * this->actor.world.pos.x) - sp44.x;
+ sp44.z = (2.0f * this->actor.world.pos.z) - sp44.z;
+ func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2);
+ sp44.x = this->actor.world.pos.x;
+ sp44.z = this->actor.world.pos.z;
+ func_800B3030(globalCtx, &sp44, &D_80B2F710, &D_801D15B0, sp36, 0, 2);
+ } else if (this->unk_18E == 28) {
+ func_80B2DC50(this, globalCtx);
+ } else if (this->unk_18E > 18) {
+ this->actor.scale.x = (28 - this->unk_18E) * 0.001f;
+ this->actor.scale.y = (28 - this->unk_18E) * 0.001f;
+ this->actor.scale.z = (28 - this->unk_18E) * 0.001f;
+ this->actor.world.pos.y += 5.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E230.s")
+ if (this->unk_18E < 18) {
+ func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E3B0.s")
+ if (this->unk_18E == 18) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_WIZ_DISAPPEAR);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E3F8.s")
+void func_80B2D5DC(EnPoh* this) {
+ Animation_PlayOnce(&this->skelAnime, &D_06000A60);
+ this->actionFunc = func_80B2D628;
+ this->actor.speedXZ = -5.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E438.s")
+void func_80B2D628(EnPoh* this, GlobalContext* globalCtx) {
+ if (SkelAnime_Update(&this->skelAnime)) {
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ func_80B2CB60(this);
+ this->unk_18E = 23;
+ } else {
+ Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
+ this->actor.shape.rot.y += 0x1000;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E55C.s")
+void func_80B2D694(EnPoh* this) {
+ Animation_PlayLoop(&this->skelAnime, &D_060015B0);
+ this->unk_192 = BINANG_ROT180(this->actor.world.rot.y);
+ this->actionFunc = func_80B2D6EC;
+ this->actor.speedXZ = 0.0f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E6C0.s")
+void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C)) {
+ func_80B2CB60(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2E8E0.s")
+ if (this->actor.xzDistToPlayer < 200.0f) {
+ func_80B2CD14(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Update.s")
+ func_80B2C9B8(this, globalCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2ED14.s")
+void func_80B2D76C(EnPoh* this) {
+ this->unk_18C = 32;
+ this->unk_192 = 0x2000;
+ this->actor.speedXZ = 0.0f;
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DISAPPEAR);
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
+ this->colliderCylinder.base.acFlags &= ~AC_ON;
+ this->actionFunc = func_80B2D7D4;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2EDD0.s")
+void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx) {
+ if (this->unk_18C != 0) {
+ this->unk_18C--;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/EnPoh_Draw.s")
+ this->actor.world.rot.y += this->unk_192;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2F328.s")
+ if (this->unk_18C < 16) {
+ Math_ScaledStepToS(&this->unk_192, 0, 0x200);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Poh/func_80B2F37C.s")
+ func_80B2C9B8(this, globalCtx);
+ this->unk_197 = this->unk_18C * (255.0f / 32.0f);
+ if (this->unk_18C == 0) {
+ this->unk_190 = Rand_S16Offset(100, 50);
+ this->colliderCylinder.info.bumper.dmgFlags = 0x40001;
+ func_80B2CB60(this);
+ }
+}
+
+void func_80B2D924(EnPoh* this) {
+ this->unk_18C = 0;
+ this->unk_192 = 0x2000;
+ this->actor.speedXZ = 0.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKIDS_APPEAR);
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
+ this->colliderCylinder.base.acFlags &= ~AC_ON;
+ this->actionFunc = func_80B2D980;
+}
+
+void func_80B2D980(EnPoh* this, GlobalContext* globalCtx) {
+ this->unk_18C++;
+ this->actor.world.rot.y -= this->unk_192;
+ if (this->unk_18C > 15) {
+ Math_ScaledStepToS(&this->unk_192, 0, 0x200);
+ }
+
+ func_80B2C9B8(this, globalCtx);
+ this->unk_197 = this->unk_18C * (255.0f / 32.0f);
+ if (this->unk_18C == 32) {
+ this->unk_190 = Rand_S16Offset(700, 300);
+ this->unk_18C = 0;
+ this->colliderCylinder.info.bumper.dmgFlags = ~0x8340001;
+ func_80B2CB60(this);
+ }
+}
+
+void func_80B2DAD0(EnPoh* this) {
+ Animation_MorphToLoop(&this->skelAnime, &D_060006E0, -5.0f);
+ this->actor.speedXZ = 5.0f;
+ this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y);
+ this->colliderCylinder.base.acFlags |= AC_ON;
+ this->unk_18E = 200;
+ this->actionFunc = func_80B2DB44;
+}
+
+void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx) {
+ f32 sp24;
+
+ SkelAnime_Update(&this->skelAnime);
+ sp24 = Math_SinS(this->unk_18D * 0x800) * 3.0f;
+ this->actor.world.pos.x -= sp24 * Math_CosS(this->actor.shape.rot.y);
+ this->actor.world.pos.z += sp24 * Math_SinS(this->actor.shape.rot.y);
+ Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C);
+ func_80B2C9B8(this, globalCtx);
+ this->unk_18E--;
+ if ((this->unk_18E == 0) || (this->actor.xzDistToPlayer > 250.0f)) {
+ this->actor.world.rot.y = this->actor.shape.rot.y;
+ func_80B2CB60(this);
+ }
+ func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG);
+}
+
+void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx) {
+ this->actor.update = func_80B2F328;
+ this->actor.draw = func_80B2F37C;
+ this->actor.shape.shadowDraw = NULL;
+ this->actor.world.pos.x = this->unk_3D8.wx;
+ this->actor.world.pos.y = this->unk_3D8.wy;
+ this->actor.world.pos.z = this->unk_3D8.wz;
+ Actor_SetScale(&this->actor, 0.01f);
+ this->actor.flags |= 0x10;
+ this->actor.gravity = -1.0f;
+ this->actor.shape.yOffset = 1500.0f;
+ this->actor.world.pos.y -= 15.0f;
+ this->actor.shape.rot.x = -0x8000;
+ func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 8);
+ this->actor.flags &= ~(0x4 | 0x1);
+ this->actionFunc = func_80B2DD2C;
+}
+
+void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx) {
+ if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight <= BGCHECK_Y_MIN)) {
+ EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO, 10, D_06002D28);
+ func_80B2E0B0(this);
+ }
+
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4);
+}
+
+void func_80B2DDF8(EnPoh* this, s32 arg1) {
+ f32 temp_f2;
+
+ this->unk_197 = CLAMP(this->unk_197 + arg1, 0, 255);
+
+ if (arg1 < 0) {
+ temp_f2 = this->unk_197 * (1.0f / 255.0f);
+ this->actor.scale.x = this->actor.scale.z = (0.0056000003f * temp_f2) + 0.0014000001f;
+ this->actor.scale.y = (0.007f - (0.007f * temp_f2)) + 0.007f;
+ } else {
+ temp_f2 = 1.0f;
+ this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = this->unk_197 * 0.000027450982f;
+ this->actor.world.pos.y = this->actor.home.pos.y + ((15.0f / 255.0f) * this->unk_197);
+ }
+
+ this->unk_194 = 100.0f * temp_f2;
+ this->unk_195 = 0;
+ this->unk_196 = 150.0f * temp_f2;
+ Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y,
+ this->actor.world.pos.z, 100, 0, 150, this->unk_197 * (200.0f / 255.0f));
+}
+
+void func_80B2E0B0(EnPoh* this) {
+ Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y,
+ this->actor.world.pos.z, 0, 0, 0, 0);
+ this->unk_190 = 0;
+ this->actor.shape.rot.y = 0;
+ this->unk_194 = 0;
+ this->unk_197 = 0;
+ this->unk_195 = 0;
+ this->unk_196 = 200;
+ this->actor.shape.rot.x = 0;
+ this->actor.shape.yOffset = 0.0f;
+ this->actor.gravity = 0.0f;
+ this->actor.velocity.y = 0.0f;
+ this->actor.home.pos.y = this->actor.world.pos.y;
+ this->actor.scale.x = 0.0f;
+ this->actor.scale.y = 0.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EV_METAL_BOX_BOUND);
+ this->actionFunc = func_80B2E180;
+}
+
+void func_80B2E180(EnPoh* this, GlobalContext* globalCtx) {
+ this->actor.home.pos.y += 2.0f;
+ func_80B2DDF8(this, 20);
+ if (this->unk_197 == 255) {
+ func_80B2E1D8(this);
+ }
+}
+
+void func_80B2E1D8(EnPoh* this) {
+ this->actor.home.pos.y = this->actor.world.pos.y;
+ Actor_SetHeight(&this->actor, -10.0f);
+ this->unk_18E = 200;
+ this->unk_18D = 32;
+ this->actor.flags |= 1;
+ this->actionFunc = func_80B2E230;
+}
+
+void func_80B2E230(EnPoh* this, GlobalContext* globalCtx) {
+
+ if (Actor_HasParent(&this->actor, globalCtx)) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+
+ this->unk_18E--;
+ if (this->unk_18E == 0) {
+ func_80B2E3B0(this);
+ return;
+ }
+
+ func_800B8A1C(&this->actor, globalCtx, 0xBA, 35.0f, 60.0f);
+ this->actor.world.pos.y = (Math_SinS(this->unk_18D * 0x800) * 5.0f) + this->actor.home.pos.y;
+ if (this->unk_18D) {
+ this->unk_18D--;
+ }
+
+ if (this->unk_18D == 0) {
+ this->unk_18D = 32;
+ }
+
+ Actor_SetHeight(&this->actor, -10.0f);
+ Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y,
+ this->actor.world.pos.z, 100, 0, 150, this->unk_197 * (40.0f / 51.0f));
+}
+
+void func_80B2E3B0(EnPoh* this) {
+ func_801A7328(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
+ this->actionFunc = func_80B2E3F8;
+}
+
+void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx) {
+ func_80B2DDF8(this, -13);
+ if (this->unk_197 == 0) {
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+void func_80B2E438(EnPoh* this, GlobalContext* globalCtx) {
+ if (this->colliderCylinder.base.acFlags & AC_HIT) {
+ this->colliderCylinder.base.acFlags &= ~AC_HIT;
+ if (!Actor_ApplyDamage(&this->actor)) {
+ Enemy_StartFinishingBlow(globalCtx, &this->actor);
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DEAD);
+ } else if (this->actor.colChkInfo.damage != 0) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_DAMAGE);
+ }
+
+ if (this->actor.colChkInfo.damageEffect != 14) {
+ if (this->actor.colChkInfo.damageEffect == 15) {
+ func_80B2D924(this);
+ } else {
+ if (this->actor.colChkInfo.damageEffect == 4) {
+ this->unk_298 = 4.0f;
+ this->unk_29C = 0.45f;
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG,
+ this->colliderCylinder.info.bumper.hitPos.x,
+ this->colliderCylinder.info.bumper.hitPos.y,
+ this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS);
+ }
+ func_80B2CFF8(this);
+ }
+ }
+ }
+}
+
+void func_80B2E55C(EnPoh* this) {
+ if ((this->actionFunc != func_80B2D980) && (this->actionFunc != func_80B2D7D4) &&
+ (this->actionFunc != func_80B2D140)) {
+ if (this->unk_190 != 0) {
+ this->unk_190--;
+ }
+
+ if (this->unk_197 == 255) {
+ if (this->actor.isTargeted) {
+ this->unk_18C++;
+ this->unk_18C = CLAMP_MAX(this->unk_18C, 20);
+ } else {
+ this->unk_18C = 0;
+ }
+
+ if (((this->unk_18C == 20) || (this->unk_190 == 0)) &&
+ ((this->actionFunc == func_80B2CAA4) || (this->actionFunc == func_80B2CBBC) ||
+ (this->actionFunc == func_80B2CD64) || (this->actionFunc == func_80B2DB44) ||
+ (this->actionFunc == func_80B2D6EC))) {
+ func_80B2D76C(this);
+ }
+ } else if ((this->unk_197 == 0) && (this->unk_190 == 0) &&
+ ((this->actionFunc == func_80B2CAA4) || (this->actionFunc == func_80B2CBBC) ||
+ (this->actionFunc == func_80B2CD64) || (this->actionFunc == func_80B2D6EC))) {
+ func_80B2D924(this);
+ }
+ }
+}
+
+void func_80B2E6C0(EnPoh* this) {
+ if (this->actionFunc == func_80B2CF28) {
+ this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 255);
+ this->unk_195 = CLAMP_MIN((s16)(this->unk_195 - 5), 50);
+ this->unk_196 = CLAMP_MIN((s16)(this->unk_196 - 5), 0);
+ } else if (this->actionFunc == func_80B2DB44) {
+ this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 80);
+ this->unk_195 = CLAMP_MAX((s16)(this->unk_195 + 5), 255);
+ this->unk_196 = CLAMP_MAX((s16)(this->unk_196 + 5), 225);
+ } else if (this->actionFunc == func_80B2D07C) {
+ if ((this->actor.colorFilterTimer & 2) != 0) {
+ this->unk_194 = 0;
+ this->unk_195 = 0;
+ this->unk_196 = 0;
+ } else {
+ this->unk_194 = 80;
+ this->unk_195 = 255;
+ this->unk_196 = 225;
+ }
+ } else {
+ u8 temp;
+
+ this->unk_194 = CLAMP_MAX((s16)(this->unk_194 + 5), 255);
+ this->unk_195 = CLAMP_MAX((s16)(this->unk_195 + 5), 255);
+ temp = this->unk_196;
+ if (this->unk_196 > 210) {
+ this->unk_196 = CLAMP_MIN((s16)(temp - 5), 210);
+ } else {
+ this->unk_196 = CLAMP_MAX((s16)(temp + 5), 210);
+ }
+ }
+}
+
+void func_80B2E8E0(EnPoh* this) {
+ if ((this->actionFunc == func_80B2D140) && (this->skelAnime.curFrame < 12.0f)) {
+ this->unk_198 = this->unk_199 = this->unk_19A = (this->skelAnime.curFrame * 16.66f) + 55.0f;
+ this->unk_19B = this->skelAnime.curFrame * 16.666666f;
+ } else {
+ f32 rand = Rand_ZeroOne();
+
+ this->unk_198 = (s32)(rand * 30.0f) + 225;
+ this->unk_199 = (s32)(rand * 100.0f) + 155;
+ this->unk_19A = (s32)(rand * 160.0f) + 95;
+ this->unk_19B = 200;
+ }
+}
+
+void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx2) {
+ EnPoh* this = THIS;
+ GlobalContext* globalCtx = globalCtx2;
+ s32 pad;
+
+ if (this->colliderSph.base.atFlags & AT_HIT) {
+ this->colliderSph.base.atFlags &= ~AT_HIT;
+ func_80B2D5DC(this);
+ }
+
+ func_80B2E438(this, globalCtx);
+ func_80B2E55C(this);
+ this->actionFunc(this, globalCtx);
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ if ((this->actionFunc == func_80B2CF28) && (this->unk_18E < 10)) {
+ this->actor.flags |= 0x1000000;
+ CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base);
+ }
+
+ Collider_UpdateCylinder(&this->actor, &this->colliderCylinder);
+ if (this->colliderCylinder.base.acFlags & AC_ON) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
+ }
+
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base);
+ Actor_SetHeight(&this->actor, 42.0f);
+
+ if ((this->actionFunc != func_80B2D07C) && (this->actionFunc != func_80B2D628)) {
+ if (this->actionFunc == func_80B2DB44) {
+ this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y);
+ } else {
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ }
+ }
+
+ func_80B2E8E0(this);
+ this->actor.shape.shadowAlpha = this->unk_197;
+ if (this->unk_298 > 0.0f) {
+ Math_StepToF(&this->unk_298, 0.0f, 0.05f);
+ if (this->unk_197 != 255) {
+ if (this->unk_197 * (1.0f / 255.0f) < this->unk_197) {
+ this->unk_298 = this->unk_197 * (1.0f / 255.0f);
+ }
+ }
+
+ this->unk_29C = (this->unk_298 + 1.0f) * (9.0f / 40.0f);
+ this->unk_29C = CLAMP_MAX(this->unk_29C, 0.45f);
+ }
+}
+
+s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx,
+ Gfx** gfx) {
+ EnPoh* this = THIS;
+
+ if ((this->unk_197 == 0) || (limbIndex == 18) || ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2))) {
+ *dList = NULL;
+ }
+
+ if (limbIndex == 19) {
+ gDPPipeSync((*gfx)++);
+ gDPSetEnvColor((*gfx)++, this->unk_194, this->unk_195, this->unk_196, this->unk_197);
+ }
+
+ return false;
+}
+
+void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
+ static s8 D_80B2F71C[] = {
+ -1, -1, -1, -1, 4, 5, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, 3, -1,
+ };
+ static Vec3f D_80B2F734[] = {
+ { -600.0f, 500.0f, 1700.0f },
+ { -600.0f, 500.0f, -1700.0f },
+ { 1000.0f, 1700.0f, 0.0f },
+ };
+ s32 temp_s3;
+ Vec3f sp60;
+ EnPoh* this = THIS;
+ s32 pad;
+
+ Collider_UpdateSpheres(limbIndex, &this->colliderSph);
+ if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2) && (limbIndex == 5)) {
+ gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList((*gfx)++, D_06002608);
+ }
+
+ if (limbIndex == 18) {
+ if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 19) && (this->actor.scale.x != 0.0f)) {
+ Matrix_Scale(0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 1);
+ }
+ Matrix_CopyCurrentState(&this->unk_3D8);
+ func_80B2C910(&sp60, globalCtx);
+ Lights_PointGlowSetInfo(&this->lightInfo, this->colliderSph.elements[0].dim.worldSphere.center.x + (s32)sp60.x,
+ this->colliderSph.elements[0].dim.worldSphere.center.y + (s32)sp60.y,
+ this->colliderSph.elements[0].dim.worldSphere.center.z + (s32)sp60.z, this->unk_198,
+ this->unk_199, this->unk_19A, this->unk_19B * (200.0f / 255.0f));
+ }
+
+ temp_s3 = D_80B2F71C[limbIndex];
+ if (temp_s3 != -1) {
+ if (temp_s3 < 4) {
+ Matrix_GetStateTranslation(&this->unk_2A0[temp_s3]);
+ } else if (temp_s3 == 4) {
+ Matrix_GetStateTranslationAndScaledX(2000.0f, &this->unk_2A0[temp_s3]);
+ } else {
+ s32 i;
+ Vec3f* vec = &this->unk_2A0[temp_s3 + 2];
+ Vec3f* vec2 = &D_80B2F734[0];
+
+ Matrix_GetStateTranslationAndScaledX(-2000.0f, &this->unk_2A0[temp_s3]);
+ Matrix_GetStateTranslationAndScaledY(-2000.0f, &this->unk_2A0[temp_s3 + 1]);
+
+ for (i = temp_s3 + 2; i < ARRAY_COUNT(this->unk_2A0); i++, vec++, vec2++) {
+ Matrix_MultiplyVector3fByState(vec2, vec);
+ }
+ }
+ }
+}
+
+void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnPoh* this = THIS;
+ Gfx* gfx;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_80B2E6C0(this);
+ if ((this->unk_197 == 255) || (this->unk_197 == 0)) {
+ gfx = POLY_OPA_DISP;
+
+ gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]);
+ gDPSetEnvColor(&gfx[1], this->unk_194, this->unk_195, this->unk_196, this->unk_197);
+ gSPSegment(&gfx[2], 0x08, D_801AEFA0);
+
+ gfx = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw,
+ EnPoh_PostLimbDraw, &this->actor, &gfx[3]);
+
+ POLY_OPA_DISP = gfx;
+ } else {
+ gfx = POLY_XLU_DISP;
+
+ gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]);
+ gDPSetEnvColor(&gfx[1], 255, 255, 255, this->unk_197);
+ gSPSegment(&gfx[2], 0x08, D_801AEF88);
+
+ POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, &gfx[3]);
+
+ gfx = POLY_OPA_DISP;
+ gSPDisplayList(gfx++, &sSetupDL[6 * 25]);
+ }
+
+ gDPPipeSync(&gfx[0]);
+ gDPSetEnvColor(&gfx[1], this->unk_198, this->unk_199, this->unk_19A, 255);
+
+ Matrix_SetCurrentState(&this->unk_3D8);
+
+ gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&gfx[3], D_06002D28);
+
+ POLY_OPA_DISP = &gfx[4];
+ func_800BE680(globalCtx, &this->actor, this->unk_2A0, 10, this->actor.scale.x * 100.0f * this->unk_29C, 0.0f,
+ this->unk_298, 20);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void func_80B2F328(Actor* thisx, GlobalContext* globalCtx) {
+ EnPoh* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+ if (this->actionFunc != func_80B2DD2C) {
+ this->unk_190++;
+ }
+
+ func_80B2E8E0(this);
+}
+
+void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) {
+ EnPoh* this = THIS;
+ s32 pad;
+ Vec3f sp7C;
+ Gfx* gfx;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ if (this->actionFunc == func_80B2DD2C) {
+ gfx = POLY_OPA_DISP;
+
+ gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]);
+ gDPSetEnvColor(&gfx[1], this->unk_198, this->unk_199, this->unk_19A, 255);
+
+ func_80B2C910(&sp7C, globalCtx);
+ Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x + sp7C.x, this->actor.world.pos.y + sp7C.y,
+ this->actor.world.pos.z + sp7C.z, this->unk_198, this->unk_199, this->unk_19A, 200);
+
+ gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(&gfx[3], D_06002D28);
+
+ POLY_OPA_DISP = &gfx[4];
+ } else {
+ func_8012C2DC(globalCtx->state.gfxCtx);
+
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_190 * -8) & 0x1FF,
+ 0x20, 0x80));
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255);
+
+ Matrix_InsertYRotation_f((func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, D_06003850);
+ }
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h
index fe6776f60..fe579e027 100644
--- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h
+++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h
@@ -9,9 +9,32 @@ typedef void (*EnPohActionFunc)(struct EnPoh*, GlobalContext*);
typedef struct EnPoh {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x44];
+ /* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ EnPohActionFunc actionFunc;
- /* 0x018C */ char unk_18C[0x28C];
+ /* 0x018C */ u8 unk_18C;
+ /* 0x018D */ u8 unk_18D;
+ /* 0x018E */ s16 unk_18E;
+ /* 0x0190 */ s16 unk_190;
+ /* 0x0192 */ s16 unk_192;
+ /* 0x0194 */ u8 unk_194;
+ /* 0x0195 */ u8 unk_195;
+ /* 0x0196 */ u8 unk_196;
+ /* 0x0197 */ u8 unk_197;
+ /* 0x0198 */ u8 unk_198;
+ /* 0x0199 */ u8 unk_199;
+ /* 0x019A */ u8 unk_19A;
+ /* 0x019B */ u8 unk_19B;
+ /* 0x019C */ Vec3s jointTable[21];
+ /* 0x021A */ Vec3s morphTable[21];
+ /* 0x0298 */ f32 unk_298;
+ /* 0x029C */ f32 unk_29C;
+ /* 0x02A0 */ Vec3f unk_2A0[10];
+ /* 0x0318 */ LightNode* lightNode;
+ /* 0x031C */ LightInfo lightInfo;
+ /* 0x032C */ ColliderCylinder colliderCylinder;
+ /* 0x0378 */ ColliderJntSph colliderSph;
+ /* 0x0398 */ ColliderJntSphElement colliderSphElements[1];
+ /* 0x03D8 */ MtxF unk_3D8;
} EnPoh; // size = 0x418
extern const ActorInit En_Poh_InitVars;
diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
index b6dfea065..5f9fe203a 100644
--- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
+++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c
@@ -220,7 +220,7 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) {
}
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 28.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable, 26);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
@@ -292,7 +292,7 @@ void func_80BA59F0(EnRailgibud* this) {
}
void func_80BA5A34(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 rot = this->actor.shape.rot.y + this->unk_3E2 + this->unk_3E8;
s16 yaw = BINANG_SUB(this->actor.yawTowardsPlayer, rot);
@@ -318,7 +318,7 @@ void func_80BA5AF0(EnRailgibud* this) {
}
void func_80BA5B64(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xFA);
@@ -354,7 +354,7 @@ void func_80BA5B64(EnRailgibud* this, GlobalContext* globalCtx) {
this->unk_3F4--;
}
- if (func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
} else if ((globalCtx->gameplayFrames & 95) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
@@ -370,7 +370,7 @@ void func_80BA5DBC(EnRailgibud* this) {
}
void func_80BA5E18(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player2 = PLAYER;
+ Player* player2 = GET_PLAYER(globalCtx);
Player* player = player2;
s32 sp34;
u16 sp32;
@@ -378,7 +378,7 @@ void func_80BA5E18(EnRailgibud* this, GlobalContext* globalCtx) {
switch (this->unk_3F0) {
case 0:
sp34 = func_80BA7088(this, globalCtx);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount) && (sp34 == 1)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (sp34 == 1)) {
this->unk_3F0 = 1;
func_800BDC5C(&this->skelAnime, sAnimations, 0);
} else if (!(player->stateFlags2 & 0x80)) {
@@ -391,17 +391,18 @@ void func_80BA5E18(EnRailgibud* this, GlobalContext* globalCtx) {
case 1:
if (this->unk_3F2 == 20) {
+ s16 requiredScopeTemp;
+
sp32 = player->ageProperties->unk_92 + 0x6805;
globalCtx->damagePlayer(globalCtx, -8);
func_800B8E58(&player->actor, sp32);
func_8013ECE0(this->actor.xzDistToPlayer, 240, 1, 12);
this->unk_3F2 = 0;
- label:;
} else {
this->unk_3F2++;
}
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_ATTACK);
}
@@ -418,7 +419,7 @@ void func_80BA5E18(EnRailgibud* this, GlobalContext* globalCtx) {
break;
case 2:
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_3F4 = 40;
this->actor.shape.yOffset = 0.0f;
func_80BA5AF0(this);
@@ -444,7 +445,7 @@ void func_80BA60B0(EnRailgibud* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
Math_SmoothStepToS(&this->unk_3E2, 0, 1, 0x12C, 0);
Math_SmoothStepToS(&this->unk_3E8, 0, 1, 0x12C, 0);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80BA6158(this);
}
@@ -515,12 +516,12 @@ void func_80BA64AC(EnRailgibud* this, GlobalContext* globalCtx) {
this->actor.speedXZ += 0.15f;
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_405 = -1;
this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->unk_3F6 > 0) && (this->unk_404 == 0) && (this->unk_3F8 == 0)) {
this->actor.hintId = 0x2A;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06010B88, NULL, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06010B88, NULL, this->jointTable, this->morphTable, 26);
this->unk_3F8 = 1;
}
func_80BA6284(this);
@@ -583,7 +584,7 @@ void func_80BA66C8(EnRailgibud* this, GlobalContext* globalCtx) {
}
if ((this->unk_3F2 == 20) && (this->unk_3F6 > 0) && (this->unk_404 == 0) && (this->unk_3F8 == 0)) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06010B88, NULL, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06010B88, NULL, this->jointTable, this->morphTable, 26);
this->unk_3F8 = 1;
}
}
@@ -662,7 +663,7 @@ void func_80BA6B9C(EnRailgibud* this, GlobalContext* globalCtx) {
}
s32 func_80BA6D10(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO_MASK) {
return false;
@@ -677,7 +678,7 @@ s32 func_80BA6D10(EnRailgibud* this, GlobalContext* globalCtx) {
}
s32 func_80BA6DAC(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 100.0f) {
return true;
@@ -687,7 +688,7 @@ s32 func_80BA6DAC(EnRailgibud* this, GlobalContext* globalCtx) {
}
void func_80BA6DF8(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk_3FA != 1) && (this->collider.base.acFlags & AC_HIT)) {
if (this->actionFunc == func_80BA57F8) {
@@ -762,7 +763,7 @@ void func_80BA6DF8(EnRailgibud* this, GlobalContext* globalCtx) {
}
s32 func_80BA7088(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp40;
f32 sp3C;
f32 sp38 = 0.0f;
@@ -794,7 +795,7 @@ void func_80BA71E4(EnRailgibud* this, GlobalContext* globalCtx) {
}
void func_80BA7234(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
if ((this->actionFunc == func_80BA5E18) && (this->unk_3F0 != 2)) {
@@ -891,7 +892,7 @@ void func_80BA7578(EnRailgibud* this, GlobalContext* globalCtx) {
}
void func_80BA76C4(EnRailgibud* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->actionFunc != func_80BA66C8) && ((this->actionFunc != func_80BA5E18) || (this->unk_3F0 == 2))) {
Collider_UpdateCylinder(&this->actor, &this->collider);
@@ -911,7 +912,7 @@ void EnRailgibud_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80BA6DF8(this, globalCtx);
this->actionFunc(this, globalCtx);
if (this->actionFunc != func_80BA6604) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
func_80BA71E4(this, globalCtx);
func_80BA76C4(this, globalCtx);
@@ -948,7 +949,7 @@ void EnRailgibud_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
((limbIndex == 3) || (limbIndex == 4) || (limbIndex == 6) || (limbIndex == 8) || (limbIndex == 9) ||
(limbIndex == 11) || (limbIndex == 14) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18) ||
(limbIndex == 20) || (limbIndex == 21) || (limbIndex == 22) || (limbIndex == 24) || (limbIndex == 25))) {
- SysMatrix_GetStateTranslation(&this->unk_1D8[this->unk_28C]);
+ Matrix_GetStateTranslation(&this->unk_1D8[this->unk_28C]);
this->unk_28C++;
}
}
@@ -965,18 +966,18 @@ void EnRailgibud_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha);
gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0);
- POLY_OPA_DISP = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw,
- EnRailgibud_PostLimbDraw, &this->actor, POLY_OPA_DISP);
+ POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw,
+ EnRailgibud_PostLimbDraw, &this->actor, POLY_OPA_DISP);
} else {
func_8012C2DC(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha);
gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88);
- POLY_XLU_DISP = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw,
- EnRailgibud_PostLimbDraw, &this->actor, POLY_XLU_DISP);
+ POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw,
+ EnRailgibud_PostLimbDraw, &this->actor, POLY_XLU_DISP);
}
if (this->unk_3F6 > 0) {
@@ -995,7 +996,7 @@ void func_80BA7B6C(EnRailgibud* this, GlobalContext* globalCtx) {
this->actor.flags |= 0x100000;
this->actor.flags |= 0x10;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 28.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable, 26);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
@@ -1090,7 +1091,7 @@ s32 func_80BA7DC8(EnRailgibud* this, GlobalContext* globalCtx) {
func_800BDC5C(&this->skelAnime, sAnimations, 10);
break;
}
- } else if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (this->unk_3F0 == 15) {
this->unk_3F0 = 16;
func_800BDC5C(&this->skelAnime, sAnimations, 16);
@@ -1112,7 +1113,7 @@ s32 func_80BA7DC8(EnRailgibud* this, GlobalContext* globalCtx) {
break;
case 5:
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (globalCtx->csCtx.frames < 280) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
} else {
@@ -1135,5 +1136,5 @@ void func_80BA8050(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
func_80BA7DC8(this, globalCtx);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c
index 0e58c9029..c6359ba89 100644
--- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c
+++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c
@@ -163,9 +163,11 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->actor.params >= ENRD_GET_MINUS_1) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06010B88, &D_0600ABE0, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06010B88, &D_0600ABE0, this->jointTable, this->morphTable,
+ 26);
} else {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable, 26);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060053E8, &D_0600ABE0, this->jointTable, this->morphTable,
+ 26);
}
Collider_InitCylinder(globalCtx, &this->collider);
@@ -217,7 +219,7 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) {
func_808D4DC4(this);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.params == ENRD_GET_3) {
this->actor.flags |= 0x80;
@@ -279,9 +281,9 @@ void func_808D4260(EnRd* this, GlobalContext* globalCtx) {
void func_808D4308(EnRd* this) {
if (this->actor.params != ENRD_GET_2) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600ABE0, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600ABE0, -6.0f);
} else {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060081A8);
+ Animation_PlayLoop(&this->skelAnime, &D_060081A8);
}
this->unk_3EF = 0;
@@ -292,20 +294,20 @@ void func_808D4308(EnRd* this) {
}
void func_808D43AC(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
- if ((this->actor.params == ENRD_GET_2) && func_801378B8(&this->skelAnime, 0.0f)) {
+ if ((this->actor.params == ENRD_GET_2) && Animation_OnFrame(&this->skelAnime, 0.0f)) {
if (Rand_ZeroOne() >= 0.5f) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060081A8);
+ Animation_PlayLoop(&this->skelAnime, &D_060081A8);
} else {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06007BBC);
+ Animation_PlayLoop(&this->skelAnime, &D_06007BBC);
}
} else {
this->unk_3D6--;
if (this->unk_3D6 == 0) {
this->unk_3D6 = (Rand_ZeroOne() * 10.0f) + 10.0f;
- this->skelAnime.animCurrentFrame = 0.0f;
+ this->skelAnime.curFrame = 0.0f;
}
}
@@ -342,7 +344,7 @@ void func_808D43AC(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D45D4(EnRd* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0601216C, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0601216C, -6.0f);
this->unk_3EF = 14;
this->unk_3D6 = (Rand_ZeroOne() * 10.0f) + 5.0f;
this->unk_3E4 = 0;
@@ -352,7 +354,7 @@ void func_808D45D4(EnRd* this) {
}
void func_808D4660(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
if (this->unk_3EC != 0) {
@@ -366,7 +368,7 @@ void func_808D4660(EnRd* this, GlobalContext* globalCtx) {
} else {
this->actor.hintId = 0x2A;
}
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
+ Animation_Change(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
this->actionFunc = func_808D49E4;
}
@@ -385,7 +387,7 @@ void func_808D4660(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D47DC(EnRd* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06011DB8, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06011DB8, -6.0f);
this->unk_3EF = 15;
this->unk_3D6 = (Rand_ZeroOne() * 10.0f) + 5.0f;
this->unk_3E4 = 0;
@@ -395,7 +397,7 @@ void func_808D47DC(EnRd* this) {
}
void func_808D4868(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
if (this->unk_3EC != 0) {
@@ -409,7 +411,7 @@ void func_808D4868(EnRd* this, GlobalContext* globalCtx) {
} else {
this->actor.hintId = 0x2A;
}
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
+ Animation_Change(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
this->actionFunc = func_808D49E4;
}
@@ -428,7 +430,7 @@ void func_808D4868(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D49E4(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
}
@@ -445,7 +447,7 @@ void func_808D49E4(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D4A90(EnRd* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060118D8, -6.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_060118D8, -6.0f);
this->unk_3EF = 16;
this->unk_3D6 = (Rand_ZeroOne() * 10.0f) + 5.0f;
this->unk_3E4 = 4370;
@@ -455,7 +457,7 @@ void func_808D4A90(EnRd* this) {
}
void func_808D4B20(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
if (this->unk_3EC != 0) {
@@ -485,9 +487,9 @@ void func_808D4B20(EnRd* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->unk_3E4 = 4370;
- } else if (func_801378B8(&this->skelAnime, 15.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 15.0f)) {
this->unk_3E4 = 6554;
}
@@ -496,7 +498,7 @@ void func_808D4B20(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D4CA8(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
}
@@ -506,7 +508,7 @@ void func_808D4CA8(EnRd* this, GlobalContext* globalCtx) {
this->unk_3E4 -= 100;
if ((this->unk_3E4 < 2100) && (this->unk_3E4 >= 2000)) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
+ Animation_Change(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, 19.0f, 2, -10.0f);
} else if (this->unk_3E4 < 1000) {
if ((this->actor.params != ENRD_GET_2) && (this->unk_3EC == 0)) {
func_808D5C54(this);
@@ -517,8 +519,7 @@ void func_808D4CA8(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D4DC4(EnRd* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600ABE0, 0.0f, 0.0f, SkelAnime_GetFrameCount(&D_0600ABE0.common), 0,
- -6.0f);
+ Animation_Change(&this->skelAnime, &D_0600ABE0, 0.0f, 0.0f, Animation_GetLastFrame(&D_0600ABE0), 0, -6.0f);
this->unk_3EF = 13;
this->unk_3D6 = 6;
this->actor.shape.rot.x = -0x4000;
@@ -552,25 +553,25 @@ void func_808D4E60(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D4FE0(EnRd* this, GlobalContext* globalCtx) {
- f32 frameCount = SkelAnime_GetFrameCount(&D_060113EC.common);
+ f32 frameCount = Animation_GetLastFrame(&D_060113EC);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060113EC, 1.0f, 4.0f, frameCount, 1, -4.0f);
+ Animation_Change(&this->skelAnime, &D_060113EC, 1.0f, 4.0f, frameCount, 1, -4.0f);
this->actor.speedXZ = 0.4f;
this->unk_3EF = 4;
this->actionFunc = func_808D506C;
}
void func_808D506C(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
s16 sp36 = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_3D8) - this->unk_3DA;
- this->skelAnime.animPlaybackSpeed = this->actor.speedXZ;
+ this->skelAnime.playSpeed = this->actor.speedXZ;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 250, 0);
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) {
func_808D53C0(this, globalCtx);
@@ -583,7 +584,7 @@ void func_808D506C(EnRd* this, GlobalContext* globalCtx) {
if (!(this->unk_3DC & 0x80)) {
player->actor.freezeTimer = 40;
func_80123E90(globalCtx, &this->actor);
- PLAYER->unk_A78 = &this->actor;
+ GET_PLAYER(globalCtx)->unk_A78 = &this->actor;
func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150);
}
this->unk_3ED = 60;
@@ -619,7 +620,7 @@ void func_808D506C(EnRd* this, GlobalContext* globalCtx) {
}
}
- if (func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
} else if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
@@ -627,14 +628,13 @@ void func_808D506C(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D53C0(EnRd* this, GlobalContext* globalCtx) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, SkelAnime_GetFrameCount(&D_060113EC.common), 1,
- -4.0f);
+ Animation_Change(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, Animation_GetLastFrame(&D_060113EC), 1, -4.0f);
this->unk_3EF = 2;
this->actionFunc = func_808D5440;
}
void func_808D5440(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
s16 sp36 = Actor_YawToPoint(&this->actor, &this->actor.home.pos);
@@ -654,7 +654,7 @@ void func_808D5440(EnRd* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 100, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 100, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (!(player->stateFlags1 & (0x200000 | 0x80000 | 0x40000 | 0x4000 | 0x2000 | 0x80)) &&
!(player->stateFlags2 & 0x4080) && (player->transformation != PLAYER_FORM_GORON) &&
@@ -670,7 +670,7 @@ void func_808D5440(EnRd* this, GlobalContext* globalCtx) {
}
}
- if (func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
} else if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
@@ -678,9 +678,9 @@ void func_808D5440(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D5660(EnRd* this) {
- f32 frameCount = SkelAnime_GetFrameCount(&D_060113EC.common);
+ f32 frameCount = Animation_GetLastFrame(&D_060113EC);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, frameCount, 1, -4.0f);
+ Animation_Change(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, frameCount, 1, -4.0f);
this->unk_3EF = 3;
this->unk_3EC = 1;
this->actionFunc = func_808D56E4;
@@ -713,9 +713,9 @@ void func_808D56E4(EnRd* this, GlobalContext* globalCtx) {
}
this->actor.world.rot.y = this->actor.shape.rot.y;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 10.0f) || func_801378B8(&this->skelAnime, 22.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK);
} else if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
@@ -723,7 +723,7 @@ void func_808D56E4(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D586C(EnRd* this) {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06006EEC);
+ Animation_PlayOnce(&this->skelAnime, &D_06006EEC);
this->unk_3D6 = 0;
this->unk_3EB = 0;
this->unk_3EA = 200;
@@ -733,16 +733,16 @@ void func_808D586C(EnRd* this) {
}
void func_808D58CC(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->unk_3EB++;
}
switch (this->unk_3EB) {
case 1:
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06006678);
+ Animation_PlayLoop(&this->skelAnime, &D_06006678);
this->unk_3EB++;
globalCtx->damagePlayer(globalCtx, -8);
func_8013ECE0(this->actor.xzDistToPlayer, 255, 1, 12);
@@ -758,8 +758,8 @@ void func_808D58CC(EnRd* this, GlobalContext* globalCtx) {
player->stateFlags2 &= ~0x80;
player->unk_AE8 = 100;
}
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06006B08, 0.5f, 0.0f,
- SkelAnime_GetFrameCount(&D_06006B08.common), 3, 0.0f);
+ Animation_Change(&this->skelAnime, &D_06006B08, 0.5f, 0.0f, Animation_GetLastFrame(&D_06006B08), 3,
+ 0.0f);
this->unk_3EB++;
this->unk_3EF = 4;
break;
@@ -786,7 +786,7 @@ void func_808D58CC(EnRd* this, GlobalContext* globalCtx) {
0.0f);
Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 6000, 0);
- if (func_801378B8(&this->skelAnime, 0.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_ATTACK);
}
@@ -819,14 +819,13 @@ void func_808D58CC(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D5C54(EnRd* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, SkelAnime_GetFrameCount(&D_060073A4.common), 2,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_060073A4, 0.0f, 0.0f, Animation_GetLastFrame(&D_060073A4), 2, 0.0f);
this->unk_3EF = 7;
this->actionFunc = func_808D5CCC;
}
void func_808D5CCC(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v0 = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_3D8) - this->unk_3DA;
if (ABS_ALT(temp_v0) < 0x2008) {
@@ -842,7 +841,7 @@ void func_808D5CCC(EnRd* this, GlobalContext* globalCtx) {
void func_808D5D88(EnRd* this) {
this->unk_3EF = 8;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009900, -6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009900, -6.0f);
this->actor.speedXZ = -2.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_DAMAGE);
this->unk_3EF = 8;
@@ -857,16 +856,16 @@ void func_808D5DF4(EnRd* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 300, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 300, 0);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->actor.world.rot.y = this->actor.shape.rot.y;
func_808D5E98(this);
}
}
void func_808D5E98(EnRd* this) {
- f32 frameCount = SkelAnime_GetFrameCount(&D_060113EC.common);
+ f32 frameCount = Animation_GetLastFrame(&D_060113EC);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, frameCount, 1, -4.0f);
+ Animation_Change(&this->skelAnime, &D_060113EC, 0.5f, 0.0f, frameCount, 1, -4.0f);
this->unk_3EF = 9;
this->unk_3D4 = 0;
this->actionFunc = func_808D5F18;
@@ -880,19 +879,19 @@ void func_808D5F18(EnRd* this, GlobalContext* globalCtx) {
this->unk_3D4 = 0;
} else {
this->unk_3D8 = Math_SinS(this->unk_3D4 * 4000) * (9583.0f * ((60 - this->unk_3D4) / 60.0f));
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
this->unk_3D4++;
}
}
void func_808D6008(EnRd* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_0600A450, -4.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A450, -4.0f);
this->unk_3EF = 5;
this->actionFunc = func_808D6054;
}
void func_808D6054(EnRd* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->actor.parent != NULL) {
func_808D5660(this);
} else {
@@ -902,21 +901,20 @@ void func_808D6054(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D60B0(EnRd* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600A450, -1.0f, SkelAnime_GetFrameCount(&D_0600A450.common), 0.0f, 2,
- -4.0f);
+ Animation_Change(&this->skelAnime, &D_0600A450, -1.0f, Animation_GetLastFrame(&D_0600A450), 0.0f, 2, -4.0f);
this->unk_3EF = 6;
this->actionFunc = func_808D6130;
}
void func_808D6130(EnRd* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
func_808D4308(this);
}
}
void func_808D616C(EnRd* this) {
this->actor.shape.yOffset = 0.0f;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009900, -6.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009900, -6.0f);
if (this->actor.bgCheckFlags & 1) {
this->actor.speedXZ = -2.0f;
}
@@ -928,7 +926,7 @@ void func_808D616C(EnRd* this) {
}
void func_808D6200(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->actor.speedXZ < 0.0f) {
this->actor.speedXZ += 0.15f;
@@ -938,7 +936,7 @@ void func_808D6200(EnRd* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 300, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 300, 0);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->actor.parent != NULL) {
func_808D5660(this);
@@ -952,7 +950,7 @@ void func_808D6200(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D6310(EnRd* this) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009298, -1.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06009298, -1.0f);
this->unk_3EF = 12;
this->unk_3D6 = 300;
this->actor.flags &= ~1;
@@ -969,7 +967,7 @@ void func_808D6388(EnRd* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->unk_3D8, 0, 1, 2000, 0);
Math_SmoothStepToS(&this->unk_3DA, 0, 1, 2000, 0);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_3D6 == 0) {
if (!Flags_GetSwitch(globalCtx, this->unk_3DC & 0x7F)) {
Actor_SetSwitchFlag(globalCtx, this->unk_3DC & 0x7F);
@@ -987,7 +985,7 @@ void func_808D6388(EnRd* this, GlobalContext* globalCtx) {
} else {
this->unk_3D6--;
}
- } else if (func_801378B8(&this->skelAnime, 33.0f) || func_801378B8(&this->skelAnime, 40.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 33.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_DOWN);
}
}
@@ -1061,7 +1059,7 @@ void func_808D66A0(EnRd* this, GlobalContext* globalCtx) {
void func_808D6814(EnRd* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((gSaveContext.unk_3F58 != 0) && (this->actor.shape.rot.x == 0) && (this->unk_3E9 == 0) &&
(this->unk_3EF != 11) && (this->unk_3EF != 12) && (this->unk_3EF != 1)) {
@@ -1145,7 +1143,7 @@ void func_808D6814(EnRd* this, GlobalContext* globalCtx) {
}
void func_808D6A94(EnRd* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->actor.colChkInfo.health > 0) && (this->unk_3EF != 10)) {
Collider_UpdateCylinder(&this->actor, &this->collider);
@@ -1224,7 +1222,7 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
((limbIndex == 3) || (limbIndex == 4) || (limbIndex == 6) || (limbIndex == 8) || (limbIndex == 9) ||
(limbIndex == 11) || (limbIndex == 14) || (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18) ||
(limbIndex == 20) || (limbIndex == 21) || (limbIndex == 22) || (limbIndex == 24) || (limbIndex == 25))) {
- SysMatrix_GetStateTranslation(&this->unk_1DC[this->unk_290]);
+ Matrix_GetStateTranslation(&this->unk_1DC[this->unk_290]);
this->unk_290++;
}
}
@@ -1245,9 +1243,9 @@ void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_3DE);
gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0);
- POLY_OPA_DISP = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw,
- &this->actor, POLY_OPA_DISP);
+ POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw,
+ &this->actor, POLY_OPA_DISP);
func_800BC620(&sp54, &D_808D7138, 255, globalCtx);
} else {
@@ -1257,8 +1255,8 @@ void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88);
POLY_XLU_DISP =
- SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
- this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);
+ SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);
func_800BC620(&sp54, &D_808D7138, this->unk_3DE, globalCtx);
}
diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
index 94db2b4bc..a5e91243b 100644
--- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
+++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c
@@ -42,7 +42,7 @@ void EnRsn_Init(Actor* thisx, GlobalContext* globalCtx) {
EnRsn* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 20.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06009220, &D_06009120, NULL, NULL, 0);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06009220, &D_06009120, NULL, NULL, 0);
this->actor.flags &= ~1;
func_80C25D40(this);
}
@@ -58,36 +58,37 @@ void EnRsn_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_800E9250(globalCtx, &this->actor, &this->unk1D8, &this->unk1DE, this->actor.focus.pos);
}
-s32 EnRsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
- EnRsn* this = THIS;
+s32 EnRsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* arg) {
+ EnRsn* this = (EnRsn*)arg;
if (limbIndex == 14) {
- SysMatrix_InsertXRotation_s(this->unk1D8.y, 1);
+ Matrix_InsertXRotation_s(this->unk1D8.y, 1);
}
return 0;
}
static Vec3f D_80C26028 = { 0.0f, 0.0f, 0.0f };
-void EnRsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
- EnRsn* this = THIS;
+void EnRsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* arg) {
+ EnRsn* this = (EnRsn*)arg;
Vec3f sp18 = D_80C26028;
if (limbIndex == 14) {
- SysMatrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
}
}
void EnRsn_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnRsn* this = THIS;
+
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C5B0(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_06005458));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnRsn_OverrideLimbDraw, EnRsn_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnRsn_OverrideLimbDraw, EnRsn_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c
index 673a5445f..a860e49fb 100644
--- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c
+++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c
@@ -117,8 +117,7 @@ void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.colChkInfo.damageTable = &sDamageTable;
this->actor.colChkInfo.mass = 0xA;
this->actor.colChkInfo.health = 2;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06002BF0, &D_06000194, this->limbDrawTable,
- this->transitionDrawTable, 9);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06002BF0, &D_06000194, this->jointTable, this->morphTable, 9);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->isDead = false;
@@ -150,45 +149,45 @@ void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) {
}
void EnSb_SetupWaitClosed(EnSb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600004C, 1.0f, 0, SkelAnime_GetFrameCount(&D_0600004C.common), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_0600004C, 1.0f, 0, Animation_GetLastFrame(&D_0600004C), 2, 0.0f);
this->state = SHELLBLADE_WAIT_CLOSED;
this->actionFunc = EnSb_Idle;
}
void EnSb_SetupOpen(EnSb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06000194, 1.0f, 0, SkelAnime_GetFrameCount(&D_06000194.common), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_06000194, 1.0f, 0, Animation_GetLastFrame(&D_06000194), 2, 0.0f);
this->state = SHELLBLADE_OPEN;
this->actionFunc = EnSb_Open;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE);
}
void EnSb_SetupWaitOpen(EnSb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06002C8C, 1.0f, 0, SkelAnime_GetFrameCount(&D_06002C8C.common), 0, 0.0f);
+ Animation_Change(&this->skelAnime, &D_06002C8C, 1.0f, 0, Animation_GetLastFrame(&D_06002C8C), 0, 0.0f);
this->state = SHELLBLADE_WAIT_OPEN;
this->actionFunc = EnSb_WaitOpen;
}
void EnSb_SetupLunge(EnSb* this) {
- f32 frameCount = SkelAnime_GetFrameCount(&D_06000124.common);
+ f32 frameCount = Animation_GetLastFrame(&D_06000124);
f32 playbackSpeed = this->actor.yDistToWater > 0.0f ? 1.0f : 0.0f;
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frameCount, 2, 0);
+ Animation_Change(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frameCount, 2, 0);
this->state = SHELLBLADE_LUNGE;
this->actionFunc = EnSb_Lunge;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE);
}
void EnSb_SetupBounce(EnSb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060000B4, 1.0f, 0, SkelAnime_GetFrameCount(&D_060000B4.common), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_060000B4, 1.0f, 0, Animation_GetLastFrame(&D_060000B4), 2, 0.0f);
this->state = SHELLBLADE_BOUNCE;
this->actionFunc = EnSb_Bounce;
}
void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) {
- f32 frameCount = SkelAnime_GetFrameCount(&D_0600004C.common);
+ f32 frameCount = Animation_GetLastFrame(&D_0600004C);
if (this->state != SHELLBLADE_WAIT_CLOSED) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600004C, 1.0f, 0, frameCount, 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_0600004C, 1.0f, 0, frameCount, 2, 0.0f);
}
this->state = SHELLBLADE_WAIT_CLOSED;
if (changeSpeed) {
@@ -216,9 +215,9 @@ void EnSb_Idle(EnSb* this, GlobalContext* globalCtx) {
}
void EnSb_Open(EnSb* this, GlobalContext* globalCtx) {
- f32 currentFrame = this->skelAnime.animCurrentFrame;
+ f32 currentFrame = this->skelAnime.curFrame;
- if (SkelAnime_GetFrameCount(&D_06000194.common) <= currentFrame) {
+ if (Animation_GetLastFrame(&D_06000194) <= currentFrame) {
this->vulnerableTimer = 20;
EnSb_SetupWaitOpen(this);
} else {
@@ -281,8 +280,8 @@ void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) {
void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) {
s32 pad;
- f32 currentFrame = currentFrame = this->skelAnime.animCurrentFrame;
- f32 frameCount = frameCount = SkelAnime_GetFrameCount(&D_060000B4.common);
+ f32 currentFrame = currentFrame = this->skelAnime.curFrame;
+ f32 frameCount = frameCount = Animation_GetLastFrame(&D_060000B4);
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f);
if (currentFrame == frameCount) {
@@ -361,7 +360,7 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnSb* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->isDead) {
if (this->actor.yDistToWater > 0.0f) {
@@ -384,7 +383,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) {
}
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
}
@@ -411,8 +410,8 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) {
s16 fireDecr;
func_800B8050(&this->actor, globalCtx, 1);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- EnSb_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, EnSb_PostLimbDraw, &this->actor);
if (this->fireCount != 0) {
this->actor.colorFilterTimer++;
fireDecr = this->fireCount - 1;
diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.h b/src/overlays/actors/ovl_En_Sb/z_en_sb.h
index 935a697ca..167a0c5c8 100644
--- a/src/overlays/actors/ovl_En_Sb/z_en_sb.h
+++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.h
@@ -18,8 +18,8 @@ typedef enum {
typedef struct EnSb {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTable[9];
- /* 0x1BE */ Vec3s transitionDrawTable[9];
+ /* 0x188 */ Vec3s jointTable[9];
+ /* 0x1BE */ Vec3s morphTable[9];
/* 0x1F4 */ EnSbActionFunc actionFunc;
/* 0x1F8 */ ColliderCylinder collider;
/* 0x244 */ s16 fireCount;
diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c
index 619827776..badcc5501 100644
--- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c
+++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c
@@ -133,7 +133,7 @@ void func_80ADADD0(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADAE64(EnSellnuts* this) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
+ s16 currentFrame = this->skelAnime.curFrame;
switch (currentFrame) {
case 10:
@@ -194,7 +194,7 @@ void func_80ADAE64(EnSellnuts* this) {
}
void func_80ADAFC0(EnSellnuts* this) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
+ s16 currentFrame = this->skelAnime.curFrame;
switch (currentFrame) {
case 10:
@@ -233,7 +233,7 @@ Actor* func_80ADB040(GlobalContext* globalCtx) {
f32 func_80ADB08C(GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Actor* sp18 = func_80ADB040(globalCtx);
if (sp18 != NULL) {
@@ -244,8 +244,8 @@ f32 func_80ADB08C(GlobalContext* globalCtx) {
}
void func_80ADB0D8(EnSellnuts* this, GlobalContext* globalCtx) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if (currentFrame == frameCount) {
switch (this->unk_340) {
@@ -298,8 +298,8 @@ void func_80ADB0D8(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADB254(EnSellnuts* this, GlobalContext* globalCtx) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38);
if (((this->actor.yDistToPlayer < 50.0f) && (this->actor.yDistToPlayer > -50.0f) ? true : false) &&
@@ -339,14 +339,14 @@ void func_80ADB254(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADB4F4(EnSellnuts* this, GlobalContext* globalCtx) {
- if (this->skelAnime.animCurrentFrame == this->skelAnime.animFrameCount) {
+ if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
this->actionFunc = func_80ADB544;
func_8013BC6C(&this->skelAnime, D_80ADD990, 0);
}
}
void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
@@ -425,7 +425,7 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 temp_v0 = func_80152498(&globalCtx->msgCtx);
s32 temp_v0_2;
@@ -463,8 +463,8 @@ void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx) {
void func_80ADBAB8(EnSellnuts* this, GlobalContext* globalCtx) {
u8 sp27 = func_80152498(&globalCtx->msgCtx);
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if (this->unk_368 == 0x28) {
this->unk_34C = 5;
@@ -516,8 +516,8 @@ void func_80ADBCE4(EnSellnuts* this, GlobalContext* globalCtx) {
void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx) {
u8 sp27 = func_80152498(&globalCtx->msgCtx);
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if ((currentFrame == frameCount) && (this->unk_34C == 7)) {
this->unk_34C = 0;
@@ -536,8 +536,8 @@ void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADBE80(EnSellnuts* this, GlobalContext* globalCtx) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
func_80ADAE64(this);
if (this->unk_366 == 0) {
@@ -598,8 +598,8 @@ void func_80ADC034(EnSellnuts* this, GlobalContext* globalCtx) {
void func_80ADC118(EnSellnuts* this, GlobalContext* globalCtx) {
Vec3f sp34;
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if (currentFrame == frameCount) {
Math_SmoothStepToS(&this->unk_364, 0x1C71, 3, 0x100, 0);
@@ -704,7 +704,7 @@ void func_80ADC580(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
player->linearVelocity = 0.0f;
@@ -727,7 +727,7 @@ void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -817,8 +817,8 @@ void func_80ADC8C4(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if (this->unk_34C == 22) {
Math_SmoothStepToS(&this->unk_364, 0, 3, 0x100, 0);
@@ -852,8 +852,8 @@ void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx) {
}
void func_80ADCC04(EnSellnuts* this, GlobalContext* globalCtx) {
- s16 currentFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&D_80ADD990[this->unk_34C].animationSeg->common);
+ s16 currentFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg);
if (this->unk_34C == 3) {
if (currentFrame == frameCount) {
@@ -954,7 +954,7 @@ f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) {
void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) {
EnSellnuts* this = THIS;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad2;
if ((gSaveContext.weekEventReg[17] & 0x80) || (gSaveContext.weekEventReg[61] & 0x10)) {
@@ -962,7 +962,7 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) {
}
Actor_ProcessInitChain(&this->actor, sInitChain);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600AC70, &D_06005488, this->jointTable, this->morphTable, 28);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600AC70, &D_06005488, this->jointTable, this->morphTable, 28);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit);
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 35.0f);
@@ -1040,7 +1040,7 @@ void EnSellnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) {
EnSellnuts* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->unk_328++;
if (player->transformation == PLAYER_FORM_DEKU) {
@@ -1055,7 +1055,7 @@ void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetHeight(&this->actor, 60.0f);
Actor_SetScale(&this->actor, 0.01f);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
this->actionFunc(this, globalCtx);
if (this->unk_338 & 8) {
@@ -1110,7 +1110,7 @@ s32 EnSellnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d
}
if (limbIndex == 24) {
- SysMatrix_InsertXRotation_s(this->unk_342, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_342, MTXMODE_APPLY);
}
if (limbIndex == 26) {
@@ -1148,6 +1148,6 @@ void EnSellnuts_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnSellnuts* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnSellnuts_OverrideLimbDraw, EnSellnuts_PostLimbDraw, func_80ADD7CC, &this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c
index bb21a4e57..3fd19ef91 100644
--- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c
+++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c
@@ -297,7 +297,7 @@ void func_80994E2C(EnSkb* this) {
}
void func_80994E94(EnSkb* this, GlobalContext* globalCtx) {
- if (this->skelAnime.animCurrentFrame < 4.0f) {
+ if (this->skelAnime.curFrame < 4.0f) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
} else {
@@ -310,7 +310,7 @@ void func_80994E94(EnSkb* this, GlobalContext* globalCtx) {
func_809947B0(globalCtx, this, &this->actor.world.pos);
}
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount) && (this->actor.shape.yOffset == 0.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.shape.yOffset == 0.0f)) {
func_80995A30(this);
}
this->unk_3D0++;
@@ -471,13 +471,13 @@ void func_809954F8(EnSkb* this) {
void func_8099556C(EnSkb* this, GlobalContext* globalCtx) {
s16 sp26;
- if (this->skelAnime.animCurrentFrame < 15.0f) {
- sp26 = this->skelAnime.animCurrentFrame - 7.5f;
+ if (this->skelAnime.curFrame < 15.0f) {
+ sp26 = this->skelAnime.curFrame - 7.5f;
} else {
- sp26 = 22.5f - this->skelAnime.animCurrentFrame;
+ sp26 = 22.5f - this->skelAnime.curFrame;
}
- if (func_801378B8(&this->skelAnime, 22.5f)) {
+ if (Animation_OnFrame(&this->skelAnime, 22.5f)) {
this->unk_3D4 = (u32)Rand_Next() % 0x7D0;
}
@@ -487,7 +487,7 @@ void func_8099556C(EnSkb* this, GlobalContext* globalCtx) {
this->actor.flags |= (0x8 | 0x1);
func_80994F7C(this, globalCtx);
} else if (Actor_IsActorFacingLink(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f) &&
- (this->skelAnime.animCurrentFrame > 24.0f) && (this->skelAnime.animCurrentFrame < 28.0f)) {
+ (this->skelAnime.curFrame > 24.0f) && (this->skelAnime.curFrame < 28.0f)) {
this->actor.hintId = 0x55;
this->actor.colChkInfo.mass = MASS_HEAVY;
this->actor.targetArrowOffset = 2000.0f;
@@ -521,7 +521,7 @@ void func_80995818(EnSkb* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f);
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 0x10, 0x7D0, 0x64);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.shape.rot.x = 0;
this->actor.gravity = -2.0f;
func_80995A30(this);
@@ -536,8 +536,7 @@ void func_80995818(EnSkb* this, GlobalContext* globalCtx) {
}
void func_809958F4(EnSkb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06003584, -1.0f, SkelAnime_GetFrameCount(&D_06003584.common), 0.0f, 2,
- -4.0f);
+ Animation_Change(&this->skelAnime, &D_06003584, -1.0f, Animation_GetLastFrame(&D_06003584), 0.0f, 2, -4.0f);
this->unk_3E4 = 0;
this->actor.flags &= ~1;
this->actor.speedXZ = 0.0f;
@@ -555,7 +554,7 @@ void func_8099599C(EnSkb* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Actor_MarkForDeath(&this->actor);
}
}
@@ -585,7 +584,7 @@ void func_80995A8C(EnSkb* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_3DA, 1, 0x2EE, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
- if (func_801378B8(&this->skelAnime, 8.0f) || func_801378B8(&this->skelAnime, 15.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) {
Audio_PlayActorSound2(&this->actor, 0x3830);
}
@@ -605,23 +604,23 @@ void func_80995C24(EnSkb* this) {
}
void func_80995C84(EnSkb* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, 3.0f) && (this->unk_3E4 == 0)) {
+ if (Animation_OnFrame(&this->skelAnime, 3.0f) && (this->unk_3E4 == 0)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK);
this->unk_3E4 = 1;
- } else if (func_801378B8(&this->skelAnime, 6.0f)) {
+ } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
this->unk_3E4 = 0;
}
if (this->collider.base.atFlags & AT_BOUNCED) {
this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT);
func_80995D3C(this);
- } else if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80994DA8(this, globalCtx);
}
}
void func_80995D3C(EnSkb* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06002190, -0.4f, this->skelAnime.animCurrentFrame - 1.0f, 0.0f, 3, 0.0f);
+ Animation_Change(&this->skelAnime, &D_06002190, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, 3, 0.0f);
this->collider.base.atFlags &= ~AT_BOUNCED;
this->unk_3DE = 4;
this->unk_3E4 = 0;
@@ -629,7 +628,7 @@ void func_80995D3C(EnSkb* this) {
}
void func_80995DC4(EnSkb* this, GlobalContext* globalCtx) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80994DA8(this, globalCtx);
}
}
@@ -720,7 +719,7 @@ void func_809960AC(EnSkb* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 0x10, 0x7D0, 0x64);
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount) && (this->actor.bgCheckFlags & 1)) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.bgCheckFlags & 1)) {
this->actor.shape.rot.x = 0;
this->actor.world.rot = this->actor.shape.rot;
func_80994DA8(this, globalCtx);
@@ -870,7 +869,7 @@ s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) {
void func_8099672C(EnSkb* this, GlobalContext* globalCtx) {
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((this->unk_3DE != 6) && (this->unk_3DE != 7)) {
if ((this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) {
@@ -1049,7 +1048,7 @@ void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
if ((this->actionFunc != func_80995E64) && (this->actionFunc != func_80996284) &&
(this->actionFunc != func_8099630C) && (this->actionFunc != func_809963D8)) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
}
func_8099672C(this, globalCtx);
@@ -1087,7 +1086,7 @@ s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
}
if (limbIndex == 10) {
- SysMatrix_GetStateTranslation(&this->actor.focus.pos);
+ Matrix_GetStateTranslation(&this->actor.focus.pos);
}
return false;
@@ -1112,10 +1111,10 @@ void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) ||
(limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) ||
(limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) {
- SysMatrix_GetStateTranslation(&this->unk_234[this->unk_2DC]);
+ Matrix_GetStateTranslation(&this->unk_234[this->unk_2DC]);
this->unk_2DC++;
} else if ((limbIndex == 11) && !(this->unk_3D8 & 2)) {
- SysMatrix_MultiplyVector3fByState(&D_80997564, &this->unk_234[this->unk_2DC]);
+ Matrix_MultiplyVector3fByState(&D_80997564, &this->unk_234[this->unk_2DC]);
this->unk_2DC++;
}
}
@@ -1126,8 +1125,8 @@ void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->unk_2DC = 0;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnSkb_OverrideLimbDraw,
- EnSkb_PostLimbDraw, &this->actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw,
+ EnSkb_PostLimbDraw, &this->actor);
if (this->unk_3D2 > 0) {
func_800BE680(globalCtx, &this->actor, this->unk_234, this->unk_2DC, this->unk_230, 0.5f, this->unk_22C,
this->unk_3E6);
diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
index 6473c327a..8f79570b6 100644
--- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
+++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
@@ -171,12 +171,12 @@ void EnSob1_ChangeAnim(SkelAnime* skelAnime, ActorAnimationEntryS* animations, s
animations += idx;
if (animations->frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&animations->animationSeg->common);
+ frameCount = Animation_GetLastFrame(animations->animationSeg);
} else {
frameCount = animations->frameCount;
}
- SkelAnime_ChangeAnim(skelAnime, animations->animationSeg, animations->playbackSpeed, animations->frame, frameCount,
- animations->mode, animations->transitionRate);
+ Animation_Change(skelAnime, animations->animationSeg, animations->playbackSpeed, animations->frame, frameCount,
+ animations->mode, animations->transitionRate);
}
void EnSob1_SetupAction(EnSob1* this, EnSob1ActionFunc action) {
@@ -195,7 +195,7 @@ s32 EnSob1_TestItemSelected(GlobalContext* globalCtx) {
}
u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->shopType == BOMB_SHOP) {
if (gSaveContext.day == 1 && gSaveContext.time >= CLOCK_TIME(6, 00)) {
@@ -231,7 +231,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) {
}
u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->shopType == BOMB_SHOP) {
switch (Player_GetMask(globalCtx)) {
@@ -443,7 +443,7 @@ void EnSob1_UpdateCursorPos(GlobalContext* globalCtx, EnSob1* this) {
}
void EnSob1_EndInteraction(GlobalContext* globalCtx, EnSob1* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) {
ActorCutscene_Stop(this->cutscene);
@@ -522,7 +522,7 @@ void EnSob1_EndingInteraction(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((player->actor.world.pos.x >= 0.0f && player->actor.world.pos.x <= 390.0f) &&
(player->actor.world.pos.z >= 72.0f && player->actor.world.pos.z <= 365.0f)) {
@@ -531,7 +531,7 @@ void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->headRotTarget = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (func_800B84D0(&this->actor, globalCtx)) {
@@ -721,8 +721,8 @@ void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, GlobalContext* globalCtx) {
void EnSob1_EndWalk(EnSob1* this, GlobalContext* globalCtx) {
s32 pad;
f32 distSq;
- s16 animCurrentFrame = this->skelAnime.animCurrentFrame / this->skelAnime.animPlaybackSpeed;
- s16 animLastFrame = SkelAnime_GetFrameCount(&D_06009120.common) / (s16)this->skelAnime.animPlaybackSpeed;
+ s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&D_06009120) / (s16)this->skelAnime.playSpeed;
Math_SmoothStepToS(
&this->actor.world.rot.y,
@@ -732,7 +732,7 @@ void EnSob1_EndWalk(EnSob1* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f);
if (distSq < 12.0f) {
this->actor.speedXZ = 0.0f;
- if (animLastFrame == animCurrentFrame) {
+ if (animLastFrame == curFrame) {
EnSob1_ChangeAnim(&this->skelAnime, sAnimationsBombShopkeeper, 1);
EnSob1_SetupAction(this, EnSob1_SetupIdle);
}
@@ -741,9 +741,9 @@ void EnSob1_EndWalk(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_SetupIdle(EnSob1* this, GlobalContext* globalCtx) {
- s16 animCurrentFrame = this->skelAnime.animCurrentFrame;
+ s16 curFrame = this->skelAnime.curFrame;
- if (SkelAnime_GetFrameCount(&D_06008268.common) == animCurrentFrame) {
+ if (Animation_GetLastFrame(&D_06008268) == curFrame) {
EnSob1_ChangeAnim(&this->skelAnime, sAnimationsBombShopkeeper, 2);
EnSob1_SetupAction(this, EnSob1_Idle);
}
@@ -782,7 +782,7 @@ void EnSob1_Walk(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -816,7 +816,7 @@ void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_ItemPurchased(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -938,7 +938,7 @@ void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnSob1* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -1096,7 +1096,7 @@ void EnSob1_SetupItemPurchased(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_ContinueShopping(EnSob1* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnGirlA* item;
if ((func_80152498(&globalCtx->msgCtx) == 5) && (func_80147624(globalCtx))) {
@@ -1334,31 +1334,26 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_InitZoraShopkeeper(EnSob1* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600D208, NULL, this->limbDrawTable, this->transitionDrawTable,
- 20);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600D208, NULL, this->jointTable, this->morphTable, 20);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndices[2]].segment);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0600078C, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_0600078C.common), 0,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_0600078C, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600078C), 0, 0.0f);
this->actor.draw = EnSob1_DrawZoraShopkeeper;
this->changeObjectFunc = EnSob1_ChangeObject;
}
void EnSob1_InitGoronShopkeeper(EnSob1* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06011AC8, NULL, this->limbDrawTable, this->transitionDrawTable,
- 18);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011AC8, NULL, this->jointTable, this->morphTable, 18);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndices[2]].segment);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_060000FC, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_060000FC.common), 0,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_060000FC, 1.0f, 0.0f, Animation_GetLastFrame(&D_060000FC), 0, 0.0f);
this->actor.draw = EnSob1_DrawGoronShopkeeper;
this->changeObjectFunc = EnSob1_ChangeObject;
}
void EnSob1_InitBombShopkeeper(EnSob1* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06009220, &D_06009120, this->limbDrawTable,
- this->transitionDrawTable, 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06009220, &D_06009120, this->jointTable, this->morphTable, 16);
this->actor.draw = EnSob1_DrawBombShopkeeper;
this->changeObjectFunc = NULL;
- this->skelAnime.animPlaybackSpeed = 2.0f;
+ this->skelAnime.playSpeed = 2.0f;
}
void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) {
@@ -1483,7 +1478,7 @@ void EnSob1_Update(Actor* thisx, GlobalContext* globalCtx) {
if (changeObjectFunc != NULL) {
changeObjectFunc(this, globalCtx);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
} else {
this->actionFunc(this, globalCtx);
}
@@ -1613,7 +1608,7 @@ s32 EnSob1_OverrideLimbDrawBombShopkeeper(GlobalContext* globalCtx, s32 limbInde
EnSob1* this = THIS;
if (limbIndex == 15) {
- SysMatrix_InsertXRotation_s(this->headRot, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRot, MTXMODE_APPLY);
}
return false;
}
@@ -1647,8 +1642,8 @@ void EnSob1_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x0C, EnSob1_EndDList(globalCtx->state.gfxCtx));
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sZoraShopkeeperEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnSob1_OverrideLimbDrawZoraShopkeeper, NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnSob1_OverrideLimbDrawZoraShopkeeper, NULL, &this->actor);
for (i = 0; i < ARRAY_COUNT(this->items); i++) {
this->items[i]->actor.scale.x = 0.2f;
this->items[i]->actor.scale.y = 0.2f;
@@ -1668,8 +1663,8 @@ void EnSob1_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sGoronShopkeeperEyeTextures[this->eyeTexIndex]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, NULL, &this->actor);
for (i = 0; i < ARRAY_COUNT(this->items); i++) {
this->items[i]->actor.scale.x = 0.2f;
this->items[i]->actor.scale.y = 0.2f;
@@ -1689,8 +1684,8 @@ void EnSob1_DrawBombShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&D_06005458));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnSob1_OverrideLimbDrawBombShopkeeper, EnSob1_PostLimbDrawBombShopkeeper, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnSob1_OverrideLimbDrawBombShopkeeper, EnSob1_PostLimbDrawBombShopkeeper, &this->actor);
for (i = 0; i < ARRAY_COUNT(this->items); i++) {
this->items[i]->actor.scale.x = 0.2f;
this->items[i]->actor.scale.y = 0.2f;
@@ -1700,7 +1695,7 @@ void EnSob1_DrawBombShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
EnSob1_DrawStickDirectionPrompt(globalCtx, this);
frames = globalCtx->gameplayFrames;
func_8012C2DC(globalCtx->state.gfxCtx);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x08,
diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h
index a7f8262fe..c1dfd3849 100644
--- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h
+++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h
@@ -32,8 +32,8 @@ typedef struct EnSob1 {
/* 0x1EA */ s8 objIndices[3];
/* 0x1EE */ s16 headRot;
/* 0x1F0 */ s16 headRotTarget;
- /* 0x1F2 */ Vec3s limbDrawTable[20];
- /* 0x26A */ Vec3s transitionDrawTable[20];
+ /* 0x1F2 */ Vec3s jointTable[20];
+ /* 0x26A */ Vec3s morphTable[20];
/* 0x2E2 */ s16 eyeTexIndex;
/* 0x2E4 */ s16 blinkTimer;
/* 0x2E8 */ EnSob1BlinkFunc blinkFunc;
diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
index eb7f9910a..7449b0f5d 100644
--- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
+++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
@@ -215,8 +215,8 @@ s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BAA9B4(EnSuttari* this) {
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
switch (this->textId) {
case 0x1454:
@@ -331,7 +331,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) {
case 0:
if (gSaveContext.weekEventReg[0x51] & 1) {
this->textId = 0x1455;
- ((EnElf*)PLAYER->tatlActor)->unk264 |= 8;
+ ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 8;
this->flags2 |= 1;
} else {
this->textId = 0x1450;
@@ -353,7 +353,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) {
case 0x1453:
this->flags1 |= 0x400;
gSaveContext.weekEventReg[0x51] |= 1;
- ((EnElf*)PLAYER->tatlActor)->unk264 |= 8;
+ ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 8;
this->flags2 |= 1;
this->textId = 0x1454;
break;
@@ -382,8 +382,8 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BAAF1C(EnSuttari* this) {
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
if (this->animationIdx == 5) {
this->animationIdx = 3;
@@ -405,11 +405,11 @@ void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) {
effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 10.0f;
effectPos.y += 60.0f;
effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 10.0f;
- SysMatrix_StatePush();
+ Matrix_StatePush();
Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW);
effectVelOffset.z = 20.0f;
- SysMatrix_MultiplyVector3fByState(&effectVelOffset, &effectVel);
- SysMatrix_StatePop();
+ Matrix_MultiplyVector3fByState(&effectVelOffset, &effectVel);
+ Matrix_StatePop();
if (this->unk3F0 == 0) {
EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &D_801D15B0, 50, &this->unk3F0, 1);
}
@@ -437,11 +437,11 @@ void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) {
effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 350.0f;
effectPos.y += 60.0f;
effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 350.0f;
- SysMatrix_StatePush();
+ Matrix_StatePush();
Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW);
effectVelOffset.z = 20.0f;
- SysMatrix_MultiplyVector3fByState(&effectVelOffset, &effectVel);
- SysMatrix_StatePop();
+ Matrix_MultiplyVector3fByState(&effectVelOffset, &effectVel);
+ Matrix_StatePop();
if (this->unk3F0 == 0) {
EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &D_801D15B0, 50, &this->unk3F0, 1);
}
@@ -462,7 +462,7 @@ void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BAB374(EnSuttari* this, GlobalContext* globalCtx) {
- s16 curFrame = this->skelAnime.animCurrentFrame;
+ s16 curFrame = this->skelAnime.curFrame;
Vec3f sp38;
if ((curFrame % 3) == 0) {
@@ -484,13 +484,13 @@ void EnSuttari_GetPaths(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
if (this->flags1 & 0x80) {
EnSuttari_UpdateCollider(this, globalCtx);
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (!(this->flags1 & 4) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK)) {
if (func_8013D5E8(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) != 0) {
sp30.x = player->actor.world.pos.x;
@@ -815,9 +815,9 @@ s32 func_80BAC220(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ Player* player = GET_PLAYER(globalCtx);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
switch (this->unk428) {
case 12:
@@ -913,7 +913,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) {
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600C240, &D_0600071C, this->jointTable, this->morphTable, 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600C240, &D_0600071C, this->jointTable, this->morphTable, 16);
this->actor.draw = EnSuttari_Draw;
this->actor.flags |= 1;
if (globalCtx->sceneNum == SCENE_IKANA) {
@@ -979,7 +979,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->animationIdx == 1 || this->animationIdx == 8) {
this->animationIdx = 2;
@@ -1006,7 +1006,7 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 target;
this->unk3F2 = this->unk2DE;
@@ -1037,7 +1037,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) {
}
void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->unk3F2 = this->unk2DE;
if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) {
@@ -1170,7 +1170,7 @@ void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((player->stateFlags1 & 0x40) && (globalCtx->msgCtx.unk11F04 != 0x2A31)) {
this->flags1 |= 0x8000;
@@ -1220,8 +1220,8 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) {
u32* unk_14 = &gSaveContext.unk_14;
struct_80133038_arg2 unkStruct;
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
if ((curFrame == frameCount) && (this->animationIdx == 0) && (this->flags1 & 0x20)) {
this->animationIdx = 2;
@@ -1256,8 +1256,8 @@ void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx) {
u32* unk_14 = &gSaveContext.unk_14;
struct_80133038_arg2 unkStruct;
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
if (this->enFsn == NULL) {
this->enFsn = (EnFsn*)EnSuttari_GetActorById(globalCtx, ACTOR_EN_FSN);
@@ -1305,8 +1305,8 @@ void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) {
u8 talkstate = func_80152498(&globalCtx->msgCtx);
- s16 curFrame = this->skelAnime.animCurrentFrame;
- s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common);
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIdx].animation);
if (this->flags1 & 1) {
this->unk3F2 = this->unk2DE;
@@ -1323,7 +1323,7 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) {
}
this->flags1 &= ~0x400;
if (this->flags2 & 1) {
- ((EnElf*)PLAYER->tatlActor)->unk264 |= 0x10;
+ ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 0x10;
this->flags2 &= ~1;
}
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -1446,7 +1446,7 @@ void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) {
EnSuttari* this = THIS;
s32 pad;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->actionFunc(this, globalCtx);
if ((this->flags1 & 8) && (this->flags2 & 0x10) && (player->stateFlags1 & 0x10000000)) {
@@ -1460,11 +1460,11 @@ void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->unk428 != 0) {
if (this->animationIdx == 2 || this->animationIdx == 6) {
- if (func_801378B8(&this->skelAnime, 8.0f) || func_801378B8(&this->skelAnime, 16.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
} else if (this->animationIdx == 0 || this->animationIdx == 5) {
- if (func_801378B8(&this->skelAnime, 8.0f) || func_801378B8(&this->skelAnime, 17.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK);
}
}
@@ -1478,15 +1478,15 @@ s32 EnSuttari_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
if (limbIndex == 15) {
*dList = D_0600AF90;
if (!(this->flags1 & 4)) {
- SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk3F2, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(-this->unk2DC, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk3F2, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(-this->unk2DC, MTXMODE_APPLY);
+ Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
}
if (limbIndex == 8) {
- SysMatrix_InsertXRotation_s(-this->unk2E4, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(-this->unk2E2, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(-this->unk2E4, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(-this->unk2E2, MTXMODE_APPLY);
}
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 0xC) {
rot->y += (s16)(Math_SinS(this->unk2FA[limbIndex]) * 200.0f);
@@ -1506,8 +1506,8 @@ void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
if (((this->flags1 & 8) && (this->flags1 & 0x10)) || ((this->flags1 & 2) && !(this->flags1 & 0x20)) ||
((this->flags1 & 4) && !(this->flags1 & 0x20))) {
if (limbIndex == 8) {
- curState = SysMatrix_GetCurrentState();
- SysMatrix_MultiplyVector3fByState(&D_80BAE95C, &this->unk3F8);
+ curState = Matrix_GetCurrentState();
+ Matrix_MultiplyVector3fByState(&D_80BAE95C, &this->unk3F8);
if (this->actor.child == NULL) {
if (this->flags1 & 0x100) {
bombBag =
@@ -1526,7 +1526,7 @@ void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
}
}
if (limbIndex == 15) {
- SysMatrix_MultiplyVector3fByState(&D_80BAE950, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80BAE950, &this->actor.focus.pos);
}
}
@@ -1545,7 +1545,7 @@ void EnSuttari_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0));
gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 55, 55, 255, 0));
gDPPipeSync(POLY_OPA_DISP++);
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnSuttari_OverrideLimbDraw, EnSuttari_PostLimbDraw, EnSuttari_UnkDraw, &this->actor);
if (this->flags1 & 0x80) {
func_8012C2DC(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
index b5244fd12..9cc79183e 100644
--- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c
+++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
@@ -1,3 +1,9 @@
+/*
+ * File: z_en_sw.c
+ * Overlay: ovl_En_Sw
+ * Description: Skullwalltula
+ */
+
#include "z_en_sw.h"
#define FLAGS 0x00000005
@@ -21,7 +27,21 @@ void func_808DB100(EnSw* this, GlobalContext* globalCtx);
void func_808DB25C(EnSw* this, GlobalContext* globalCtx);
void func_808DB2E0(EnSw* this, GlobalContext* globalCtx);
-#if 0
+extern AnimationHeader D_06000304;
+extern Gfx D_06003FB0[];
+extern Gfx D_060043D8[];
+extern Gfx D_060045C0[];
+extern Gfx D_06004658[];
+extern Gfx D_060046F0[];
+extern Gfx D_06004788[];
+extern Gfx D_06004820[];
+extern Gfx D_060048B8[];
+extern Gfx D_06004950[];
+extern Gfx D_060049E8[];
+extern SkeletonHeader D_06005298;
+extern AnimationHeader D_060055A8;
+extern AnimationHeader D_06005B98;
+
const ActorInit En_Sw_InitVars = {
ACTOR_EN_SW,
ACTORCAT_NPC,
@@ -34,18 +54,29 @@ const ActorInit En_Sw_InitVars = {
(ActorFunc)EnSw_Draw,
};
-// static ColliderSphereInit sSphereInit = {
-static ColliderSphereInit D_808DB9E0 = {
- { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, },
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static ColliderSphereInit sSphereInit = {
+ {
+ COLTYPE_NONE,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_SPHERE,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 0, { { 0, 0, 0 }, 16 }, 100 },
};
-// sColChkInfoInit
-static CollisionCheckInfoInit2 D_808DBA0C = { 1, 0, 0, 0, MASS_IMMOVABLE };
+static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE };
-// static DamageTable sDamageTable = {
-static DamageTable D_808DBA18 = {
+static DamageTable sDamageTable = {
/* Deku Nut */ DMG_ENTRY(1, 0x0),
/* Deku Stick */ DMG_ENTRY(1, 0x0),
/* Horse trample */ DMG_ENTRY(0, 0x0),
@@ -80,11 +111,9 @@ static DamageTable D_808DBA18 = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-// sColChkInfoInit
-static CollisionCheckInfoInit2 D_808DBA38 = { 1, 0, 0, 0, MASS_IMMOVABLE };
+static CollisionCheckInfoInit2 sColChkInfoInit2 = { 1, 0, 0, 0, MASS_IMMOVABLE };
-// static DamageTable sDamageTable = {
-static DamageTable D_808DBA44 = {
+static DamageTable sDamageTable2 = {
/* Deku Nut */ DMG_ENTRY(0, 0x1),
/* Deku Stick */ DMG_ENTRY(1, 0x0),
/* Horse trample */ DMG_ENTRY(0, 0x0),
@@ -119,89 +148,1196 @@ static DamageTable D_808DBA44 = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
+static ActorAnimationEntryS sAnimations[] = {
+ { &D_06000304, 1.0f, 0, -1, 3, 0 },
+ { &D_06000304, 1.0f, 0, -1, 3, -4 },
+ { &D_060055A8, 1.0f, 0, -1, 1, -4 },
+ { &D_06005B98, 1.0f, 0, -1, 1, -4 },
+};
+
+void func_808D8940(EnSw* this, GlobalContext* globalCtx) {
+ static Color_RGBA8 D_808DBAA4 = { 170, 130, 90, 255 };
+ static Color_RGBA8 D_808DBAA8 = { 100, 60, 20, 0 };
+ s32 i;
+ Vec3f spB8;
+ Vec3f spAC;
+ Vec3f spA0;
+ Vec3f sp94;
+ s32 temp_f4;
+ s16 temp_s0;
+
+ temp_s0 = (Rand_ZeroOne() - 0.5f) * 0x10000;
+ spA0.y = this->actor.floorHeight;
+
+ for (i = 0; i < 8; i++, temp_s0 += 0x1FFE) {
+ temp_f4 = (Rand_ZeroOne() * 4.0f) + 8.0f;
+ sp94.x = 0.0f;
+ sp94.y = (Rand_ZeroOne() * 0.2f) + 0.1f;
+ sp94.z = Rand_ZeroOne() + 1.0f;
+ Lib_Vec3f_TranslateAndRotateY(&D_801D15B0, temp_s0, &sp94, &spAC);
+ sp94.x = 0.0f;
+ sp94.y = 0.7f;
+ sp94.z = 2.0f;
+ Lib_Vec3f_TranslateAndRotateY(&D_801D15B0, temp_s0, &sp94, &spB8);
+ spA0.x = this->actor.world.pos.x + (2.0f * spB8.x);
+ spA0.z = this->actor.world.pos.z + (2.0f * spB8.z);
+ func_800B0EB0(globalCtx, &spA0, &spB8, &spAC, &D_808DBAA4, &D_808DBAA8, 60, 30, temp_f4);
+ }
+}
+
+s32 func_808D8B58(EnSw* this) {
+ s16 phi_s2 = (s16)((s16)(Rand_ZeroOne() * 1000.0f) % ARRAY_COUNT(this->unk_464)) * 0x1555;
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_464); i++, phi_s2 += 0x1555) {
+ if (this->unk_412 != 10) {
+ this->unk_464[i] = (Rand_ZeroOne() * 16.0f) + 8.0f;
+ } else {
+ this->unk_464[i] = 80;
+ }
+ this->unk_47C[i] = this->unk_464[i];
+ this->unk_418[i] = 0.45000002f;
+ if ((this->unk_412 == 0) || (this->unk_412 == 1) || (this->unk_412 == 10)) {
+ this->unk_380[i].y = (Rand_ZeroOne() - 0.5f) * 20.0f;
+ } else {
+ this->unk_380[i].y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + 10.0f;
+ }
+ this->unk_380[i].x = Math_SinS(phi_s2) * 10.0f;
+ this->unk_380[i].z = Math_CosS(phi_s2) * 10.0f;
+ }
+ this->unk_462 = 1;
+ return 0;
+}
+
+s32 func_808D8D60(EnSw* this, GlobalContext* globalCtx, s32 arg2) {
+ s32 ret = false;
+ u8 sp53;
+ Vec3f sp44;
+ f32 sp40;
+
+ if (arg2 < this->unk_462) {
+ if (this->unk_464[arg2] != 0) {
+ sp40 = (f32)this->unk_464[arg2] / this->unk_47C[arg2];
+ sp53 = this->unk_412;
+ Math_ApproachF(&this->unk_418[arg2], 0.3f, 0.3f, 0.5f);
+ Math_Vec3f_Copy(&sp44, &this->actor.world.pos);
+ sp44.x += this->unk_380[arg2].x;
+ sp44.y += this->unk_380[arg2].y;
+ sp44.z += this->unk_380[arg2].z;
+ if (sp53 == 10) {
+ if ((this->unk_47C[arg2] - this->unk_464[arg2]) < 20) {
+ sp53 = 11;
+ }
+ sp40 = 1.0f;
+ }
+ func_800BE680(globalCtx, &this->actor, &sp44, 1, 0.3f, this->unk_418[arg2], sp40, sp53);
+ ret = true;
+ }
+ }
+ return ret;
+}
+
+void func_808D8ED0(EnSw* this, GlobalContext* globalCtx) {
+ Vec3f sp54;
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(this->unk_380); i++) {
+ Math_Vec3f_Copy(&sp54, &this->actor.world.pos);
+ sp54.x += this->unk_380[i].x;
+ sp54.y += this->unk_380[i].y;
+ sp54.z += this->unk_380[i].z;
+ Math_Vec3f_Copy(&this->unk_380[i], &sp54);
+ }
+ func_800BF7CC(globalCtx, &this->actor, this->unk_380, ARRAY_COUNT(this->unk_380), 3, 0.1f, 0.3f);
+}
+
+void func_808D8FC4(EnSw* this, GlobalContext* globalCtx) {
+ Math_Vec3f_ToVec3s(&this->collider.dim.worldSphere.center, &this->actor.world.pos);
+ this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale;
+ if (!(this->unk_410 & 0x10) && (this->actor.colChkInfo.health != 0) && (DECR(this->unk_458) <= 10)) {
+ CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+
+ if (!(this->unk_410 & 0x10) && (this->actor.colChkInfo.health != 0)) {
+ CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+
+ if (this->unk_410 & 4) {
+ CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
+ }
+}
+
+s32 func_808D90C4(EnSw* this) {
+ if (this->actor.colChkInfo.damage < this->actor.colChkInfo.health) {
+ this->actor.colChkInfo.health -= this->actor.colChkInfo.damage;
+ } else {
+ this->actor.colChkInfo.health = 0;
+ }
+ return this->actor.colChkInfo.health;
+}
+
+void func_808D90F0(EnSw* this, s32 arg1, s16 arg2) {
+ Vec3f sp2C;
+ s16 sp2A;
+ s16 temp;
+
+ if (arg1 == 1) {
+ sp2A = this->unk_494;
+ Math_ApproachS(&this->unk_494, this->unk_496, 4, 0xE38);
+ temp = this->unk_494 - sp2A;
+ } else {
+ temp = arg2;
+ }
+
+ Matrix_InsertRotationAroundUnitVector_f(BINANG_TO_RAD(temp), &this->unk_368, 0);
+ Matrix_MultiplyVector3fByState(&this->unk_350, &sp2C);
+ Math_Vec3f_Copy(&this->unk_350, &sp2C);
+ Math3D_CrossProduct(&this->unk_368, &this->unk_350, &this->unk_35C);
+}
+
+s32 func_808D91C4(EnSw* this, CollisionPoly* arg1) {
+ f32 sp4C;
+ f32 temp_f12;
+ f32 temp_f0;
+ Vec3f sp38;
+ Vec3f sp2C;
+
+ this->actor.floorPoly = arg1;
+ if (arg1 != 0) {
+ sp38.x = COLPOLY_GET_NORMAL(arg1->normal.x);
+ sp38.y = COLPOLY_GET_NORMAL(arg1->normal.y);
+ sp38.z = COLPOLY_GET_NORMAL(arg1->normal.z);
+ } else {
+ return false;
+ }
+
+ temp_f12 = DOTXYZ(sp38, this->unk_368);
+ if (fabsf(temp_f12) >= 0.999f) {
+ return false;
+ }
+
+ sp4C = func_80086C48(temp_f12);
+ if (sp4C < 0.001f) {
+ return false;
+ }
+
+ Math3D_CrossProduct(&this->unk_368, &sp38, &sp2C);
+ temp_f0 = Math3D_Vec3fMagnitude(&sp2C);
+ if (temp_f0 < 0.001f) {
+ return false;
+ }
+
+ Math_Vec3f_Scale(&sp2C, 1.0f / temp_f0);
+ Matrix_InsertRotationAroundUnitVector_f(sp4C, &sp2C, MTXMODE_NEW);
+ Matrix_MultiplyVector3fByState(&this->unk_35C, &sp2C);
+ Math_Vec3f_Copy(&this->unk_35C, &sp2C);
+ Math3D_CrossProduct(&this->unk_35C, &sp38, &this->unk_350);
+
+ temp_f0 = Math3D_Vec3fMagnitude(&this->unk_350);
+ if (temp_f0 < 0.001f) {
+ return false;
+ }
+
+ Math_Vec3f_Scale(&this->unk_350, 1.0f / temp_f0);
+ Math_Vec3f_Copy(&this->unk_368, &sp38);
+
+ return true;
+}
+
+void func_808D93BC(EnSw* this) {
+ MtxF sp18;
+
+ sp18.xx = this->unk_35C.x;
+ sp18.xy = this->unk_35C.y;
+ sp18.xz = this->unk_35C.z;
+ sp18.yx = this->unk_368.x;
+ sp18.yy = this->unk_368.y;
+ sp18.yz = this->unk_368.z;
+ sp18.zx = this->unk_350.x;
+ sp18.zy = this->unk_350.y;
+ sp18.zz = this->unk_350.z;
+ func_8018219C(&sp18, &this->actor.world.rot, 0);
+ this->actor.world.rot.x = -this->actor.world.rot.x;
+}
+
+s32 func_808D9440(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, CollisionPoly** arg4, u32* arg5) {
+ s32 ret = false;
+
+ if (func_800C55C4(&globalCtx->colCtx, arg1, arg2, arg3, arg4, 1, 1, 1, 1, arg5) &&
+ !(func_800C9A4C(&globalCtx->colCtx, *arg4, *arg5) & 0x30)) {
+ ret = true;
+ }
+ return ret;
+}
+
+#ifdef NON_MATCHING
+void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 arg4) {
+ CollisionPoly* spA4;
+ CollisionPoly* spA0;
+ s32 pad;
+ Vec3f sp90;
+ Vec3f sp84;
+ Vec3f sp78;
+ Vec3f sp6C;
+ u32 sp68;
+ u32 sp64;
+ Actor* thisx = &this->actor;
+ f32 temp_f20;
+ s32 i;
+
+ spA4 = NULL;
+ spA0 = NULL;
+ sp68 = 50;
+ sp64 = 50;
+ func_808D90F0(this, arg3, arg4);
+ this->actor.speedXZ = this->unk_44C;
+ temp_f20 = thisx->speedXZ * 2.0f;
+
+ sp90.x = this->actor.world.pos.x + (this->unk_368.x * 2.0f);
+ sp90.y = this->actor.world.pos.y + (this->unk_368.y * 2.0f);
+ sp90.z = this->actor.world.pos.z + (this->unk_368.z * 2.0f);
+
+ sp84.x = this->actor.world.pos.x - (this->unk_368.x * 4.0f);
+ sp84.y = this->actor.world.pos.y - (this->unk_368.y * 4.0f);
+ sp84.z = this->actor.world.pos.z - (this->unk_368.z * 4.0f);
+
+ if (func_808D9440(globalCtx, &sp90, &sp84, &sp6C, &spA0, &sp68)) {
+ sp84.x = (this->unk_350.x * temp_f20) + sp90.x;
+ sp84.y = (this->unk_350.y * temp_f20) + sp90.y;
+ sp84.z = (this->unk_350.z * temp_f20) + sp90.z;
+ if (func_808D9440(globalCtx, &sp90, &sp84, &sp78, &spA4, &sp64)) {
+ func_808D91C4(this, spA4);
+ Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
+ this->actor.floorBgId = sp64;
+ this->actor.speedXZ = 0.0f;
+ } else {
+ if (spA0 != this->actor.floorPoly) {
+ func_808D91C4(this, spA0);
+ }
+ Math_Vec3f_Copy(&this->actor.world.pos, &sp6C);
+ this->actor.floorBgId = sp68;
+ }
+ } else {
+ this->actor.speedXZ = 0.0f;
+ temp_f20 *= 3.0f;
+ Math_Vec3f_Copy(&sp90, &sp84);
+
+ for (i = 0; i < 3; i++) {
+ if (i == 0) {
+ if (this && this && this) {}
+ sp84.x = sp90.x - (this->unk_350.x * temp_f20);
+ sp84.y = sp90.y - (this->unk_350.y * temp_f20);
+ sp84.z = sp90.z - (this->unk_350.z * temp_f20);
+ } else if (i == 1) {
+ sp84.x = sp90.x + (this->unk_35C.x * temp_f20);
+ sp84.y = sp90.y + (this->unk_35C.y * temp_f20);
+ sp84.z = sp90.z + (this->unk_35C.z * temp_f20);
+ } else {
+ sp84.x = sp90.x - (this->unk_35C.x * temp_f20);
+ sp84.y = sp90.y - (this->unk_35C.y * temp_f20);
+ sp84.z = sp90.z - (this->unk_35C.z * temp_f20);
+ }
+
+ if (func_808D9440(globalCtx, &sp90, &sp84, &sp78, &spA4, &sp64)) {
+ func_808D91C4(this, spA4);
+ Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
+ this->actor.floorBgId = sp64;
+ break;
+ }
+ }
+ }
+
+ func_808D93BC(this);
+ this->actor.shape.rot.x = -this->actor.world.rot.x;
+ this->actor.shape.rot.y = this->actor.world.rot.y;
+ this->actor.shape.rot.z = this->actor.world.rot.z;
+
+ if (this->actor.speedXZ != 0.0f) {
+ this->unk_44C = this->actor.speedXZ;
+ }
+
+ if (arg2 == 1) {
+ Actor_SetVelocityAndMoveXYRotation(&this->actor);
+ }
+}
+#else
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D94D0.s")
#endif
-extern ColliderSphereInit D_808DB9E0;
-extern CollisionCheckInfoInit2 D_808DBA0C;
-extern DamageTable D_808DBA18;
-extern CollisionCheckInfoInit2 D_808DBA38;
-extern DamageTable D_808DBA44;
+void func_808D9894(EnSw* this, Vec3f* vec) {
+ Vec3f sp5C;
+ MtxF sp1C;
-extern UNK_TYPE D_06004788;
-extern UNK_TYPE D_06005298;
+ sp1C.xx = this->unk_35C.x;
+ sp1C.yx = this->unk_35C.y;
+ sp1C.zx = this->unk_35C.z;
+ sp1C.wx = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D8940.s")
+ sp1C.xy = this->unk_368.x;
+ sp1C.yy = this->unk_368.y;
+ sp1C.zy = this->unk_368.z;
+ sp1C.wy = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D8B58.s")
+ sp1C.xz = this->unk_350.x;
+ sp1C.yz = this->unk_350.y;
+ sp1C.zz = this->unk_350.z;
+ sp1C.wz = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D8D60.s")
+ sp1C.xw = 0.0f;
+ sp1C.yw = 0.0f;
+ sp1C.zw = 0.0f;
+ sp1C.ww = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D8ED0.s")
+ Matrix_SetCurrentState(&sp1C);
+ sp5C.x = vec->x - this->actor.world.pos.x;
+ sp5C.y = vec->y - this->actor.world.pos.y;
+ sp5C.z = vec->z - this->actor.world.pos.z;
+ Matrix_MultiplyVector3fByState(&sp5C, vec);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D8FC4.s")
+s32 func_808D9968(EnSw* this, GlobalContext* globalCtx) {
+ s32 ret = false;
+ u8 param = ENSW_GET_3FC(&this->actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D90C4.s")
+ if (ENSW_GET_3(&this->actor)) {
+ if ((param != 0x3F) && Actor_GetChestFlag(globalCtx, param)) {
+ ret = true;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D90F0.s")
+ return ret;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D91C4.s")
+s32 func_808D99C8(EnSw* this, GlobalContext* globalCtx) {
+ s32 phi_v1 = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D93BC.s")
+ if (ENSW_GET_3(&this->actor) || (this->unk_458 > 10) || (this->actor.colChkInfo.health == 0)) {
+ return false;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9440.s")
+ if ((this->actor.xyzDistToPlayerSq < ((sREG(16) * 10) + 60000)) && (globalCtx->actorCtx.unk1F5 != 0) &&
+ (globalCtx->actorCtx.unk1F4 == 0)) {
+ this->actor.colChkInfo.damage = 4;
+ phi_v1 = true;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D94D0.s")
+ return phi_v1;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9894.s")
+s32 func_808D9A70(EnSw* this, GlobalContext* globalCtx) {
+ s16 sp2E = 0;
+ f32 frame;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9968.s")
+ if (DECR(this->unk_454) == 0) {
+ if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ frame = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ sp2E = (80.0f * frame) * this->unk_450;
+ } else {
+ if (this->unk_456 != 0) {
+ if (!ENSW_GET_3(&this->actor)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_ROLL);
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALGOLD_ROLL);
+ }
+ this->unk_456--;
+ this->skelAnime.curFrame = 0.0f;
+ } else {
+ this->unk_454 = Rand_S16Offset(20, 20);
+ this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D99C8.s")
+ if (this->unk_456 % 2) {
+ if (Rand_ZeroOne() < 0.5f) {
+ this->unk_450 = -1.0f;
+ } else {
+ this->unk_450 = 1.0f;
+ }
+ }
+ }
+ func_808D94D0(this, globalCtx, 0, 0, sp2E);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9A70.s")
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9C18.s")
+s32 func_808D9C18(EnSw* this) {
+ Vec3f sp3C;
+ Vec3f sp30;
+ f32 new_var;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9DA0.s")
+ if ((this->unk_498 == 0xF9) || (this->unk_498 == 0x82) || (this->unk_498 == 0xE4) || (this->unk_498 == 0xE5)) {
+ this->actor.velocity.x = this->actor.speedXZ;
+ this->actor.velocity.z = this->actor.speedXZ;
+ this->actor.velocity.x *= Math_SinS(this->actor.world.rot.y);
+ this->actor.velocity.z *= Math_CosS(this->actor.world.rot.y);
+ } else {
+ new_var = this->actor.speedXZ * this->unk_350.x;
+ this->actor.velocity.x = new_var + (this->actor.speedXZ * this->unk_368.x);
+ new_var = this->actor.speedXZ * this->unk_350.z;
+ this->actor.velocity.z = new_var + this->actor.speedXZ * this->unk_368.z;
+ this->actor.velocity.y = 14.0f;
+ Math_Vec3f_Copy(&sp3C, &this->actor.world.pos);
+ Math_Vec3f_Copy(&sp30, &this->actor.world.pos);
+ sp30.x += this->actor.velocity.x;
+ sp30.y += this->actor.velocity.y;
+ sp30.z += this->actor.velocity.z;
+ this->actor.world.rot.x = 0;
+ this->actor.world.rot.z = 0;
+ this->actor.world.rot.y = Math_Vec3f_Yaw(&sp3C, &sp30);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9E44.s")
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTURA_APPEAR);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9F08.s")
+ if (ENSW_GET_3(&this->actor) == 1) {
+ Actor_SetScale(&this->actor, 0.0f);
+ this->actor.world.rot.x = 0;
+ this->actor.world.rot.z = 0;
+ Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot);
+ this->unk_410 |= 4;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D9F78.s")
+ this->actor.gravity = -1.4f;
+ this->actor.parent = NULL;
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA024.s")
+void func_808D9DA0(EnSw* this) {
+ static Vec3f D_808DBAAC = { 0.0f, 1.0f, 0.0f };
+ s32 pad;
+ MtxF sp24;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA08C.s")
+ SkinMatrix_SetRotateYRP(&sp24, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z);
+ SkinMatrix_Vec3fMtxFMultXYZ(&sp24, &D_808DBAAC, &this->unk_368);
+ this->unk_350.x = Math_SinS(this->actor.shape.rot.y);
+ this->unk_350.y = 0.0f;
+ this->unk_350.z = Math_CosS(this->actor.shape.rot.y);
+ this->unk_35C.x = Math_SinS(BINANG_ADD(this->actor.shape.rot.y, 0x4000));
+ this->unk_35C.y = 0.0f;
+ this->unk_35C.z = Math_CosS(BINANG_ADD(this->actor.shape.rot.y, 0x4000));
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA350.s")
+void func_808D9E44(EnSw* this) {
+ Vec3f sp1C;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA3F4.s")
+ this->actor.shape.rot.z = -0x8000;
+ this->actor.shape.rot.x = 0;
+ this->actor.shape.rot.y = 0;
+ Math_Vec3s_Copy(&this->actor.world.rot, &this->actor.shape.rot);
+ this->actor.gravity = -1.4f;
+ this->actor.velocity.y = 0.0f;
+ this->unk_456 = 2;
+ Math_Vec3f_Copy(&sp1C, &this->actor.world.pos);
+ sp1C.x += this->unk_368.x * 16.0f;
+ sp1C.y += this->unk_368.y * 16.0f;
+ sp1C.z += this->unk_368.z * 16.0f;
+ Math_Vec3f_Copy(&this->actor.world.pos, &sp1C);
+}
+void func_808D9F08(EnSw* this) {
+ this->unk_454 = Rand_S16Offset(20, 20);
+ this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f;
+ this->unk_414 = 0.0f;
+ this->unk_45E = this->unk_460;
+}
+
+void func_808D9F78(EnSw* this, GlobalContext* globalCtx, s32 arg2) {
+ if (arg2 != 0) {
+ func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5);
+ }
+ Actor_SetScale(&this->actor, 0.02f);
+ func_808D9DA0(this);
+ this->actor.speedXZ = 10.0f;
+ this->unk_44C = 10.0f;
+ func_808D94D0(this, globalCtx, 0, 0, 0);
+ this->actor.speedXZ = 0.0f;
+ this->unk_44C = 0.0f;
+ this->unk_450 = 1.0f;
+ Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
+ this->unk_410 |= 4;
+}
+
+void func_808DA024(EnSw* this, GlobalContext* globalCtx) {
+ func_808D9DA0(this);
+ this->actor.speedXZ = 10.0f;
+ this->unk_44C = 10.0f;
+ func_808D94D0(this, globalCtx, 0, 0, 0);
+ this->actor.speedXZ = 0.0f;
+ this->unk_44C = 0.0f;
+ this->unk_450 = 1.0f;
+}
+
+s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) {
+ s32 ret = 0;
+ s32 i;
+
+ if (func_808D99C8(this, globalCtx) || (this->collider.base.acFlags & AC_HIT)) {
+ this->collider.base.acFlags &= ~AC_HIT;
+
+ if (this->actor.colChkInfo.damageEffect == 4) {
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x,
+ this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS);
+ }
+
+ if (this->unk_412 == 10) {
+ // clang-format off
+ for (i = 0; i < ARRAY_COUNT(this->unk_464); i++) { this->unk_464[i] = 0; }
+ // clang-format on
+
+ this->unk_45C = 0;
+ } else if (!func_808D90C4(this)) {
+ Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD);
+ Enemy_StartFinishingBlow(globalCtx, &this->actor);
+ this->actor.flags &= ~1;
+ if (!ENSW_GET_3(&this->actor)) {
+ func_8013BC6C(&this->skelAnime, sAnimations, 3);
+ }
+
+ switch (this->actor.colChkInfo.damageEffect) {
+ case 4:
+ this->unk_412 = 20;
+ this->unk_45C = 20;
+ func_808D8B58(this);
+ break;
+
+ case 3:
+ this->unk_412 = 10;
+ this->unk_45C = 0;
+ func_808D8B58(this);
+ break;
+
+ case 2:
+ this->unk_412 = 0;
+ this->unk_45C = 20;
+ func_808D8B58(this);
+ break;
+
+ case 5:
+ this->unk_412 = 30;
+ this->unk_45C = 20;
+ func_808D8B58(this);
+ break;
+
+ default:
+ this->unk_412 = 1;
+ this->unk_45C = 0;
+ break;
+ }
+
+ if (!ENSW_GET_3(&this->actor) && (this->unk_412 != 10)) {
+ func_808D9E44(this);
+ }
+ this->unk_458 = 20;
+ this->unk_45A = 0;
+ func_800BCB70(&this->actor, 0x4000, 200, 0, this->unk_458);
+ ret = true;
+ } else if (this->actor.colChkInfo.damageEffect == 1) {
+ if (this->unk_45A == 0) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_COMMON_FREEZE);
+ this->unk_45A = 40;
+ func_800BCB70(&this->actor, 0, 200, 0, this->unk_45A);
+ }
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE);
+ this->unk_458 = 20;
+ this->unk_45A = 0;
+ func_800BCB70(&this->actor, 0x4000, 200, 0, this->unk_458);
+ }
+ }
+ return ret;
+}
+
+void func_808DA350(EnSw* this, GlobalContext* globalCtx) {
+ Player* player = GET_PLAYER(globalCtx);
+
+ if ((player->stateFlags1 & 0x200000) && (this->actor.xyzDistToPlayerSq < 8000.0f)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_LAUGH);
+ Math_Vec3f_Copy(&this->unk_374, &player->actor.world.pos);
+ this->unk_410 &= ~0x20;
+ this->unk_414 = 0.0f;
+ this->actionFunc = func_808DA3F4;
+ } else {
+ func_808D9A70(this, globalCtx);
+ }
+}
+
+void func_808DA3F4(EnSw* this, GlobalContext* globalCtx) {
+ s16 temp_v0;
+ s16 temp_s1 = 0;
+ Vec3f sp38;
+ f32 temp_f16;
+
+ if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ temp_f16 = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ temp_s1 = (s16)(80.0f * temp_f16);
+ Math_Vec3f_Copy(&sp38, &this->unk_374);
+ func_808D9894(this, &sp38);
+
+ temp_v0 = Math_FAtan2F(sp38.z, sp38.x);
+ if (ABS_ALT(temp_v0) < temp_s1) {
+ this->skelAnime.curFrame = 0.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_DASH);
+ this->unk_414 = 0.0f;
+ if (this->unk_410 & 0x20) {
+ this->actionFunc = func_808DA6FC;
+ } else {
+ this->actionFunc = func_808DA578;
+ }
+ temp_s1 = ABS_ALT(temp_v0);
+ }
+ temp_s1 *= (temp_v0 < 0) ? -1 : 1;
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_ROLL);
+ this->skelAnime.curFrame = 0.0f;
+ }
+ func_808D94D0(this, globalCtx, 0, 0, temp_s1);
+}
+
+#ifdef NON_MATCHING
+void func_808DA578(EnSw* this, GlobalContext* globalCtx) {
+ f32 temp_f0;
+ s32 test;
+ s32 test2;
+ Vec3f sp30;
+
+ if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ this->unk_44C = 0.3f * temp_f0;
+ func_808D94D0(this, globalCtx, 1, 0, 0);
+ if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) {
+ Math_Vec3f_Copy(&sp30, &this->unk_374);
+ func_808D9894(this, &sp30);
+ func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp30.z, sp30.x));
+ }
+ } else if (this->unk_410 & 0x20) {
+ Math_Vec3f_Copy(&this->unk_374, &this->actor.home.pos);
+ this->actionFunc = func_808DA3F4;
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_DASH);
+ this->skelAnime.curFrame = 0.0f;
+ }
+
+ temp_f0 = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374);
+ if (!(this->unk_410 & 0x20)) {
+ test = this->unk_414;
+ test2 = temp_f0;
+ if ((test != 0) && (test < test2)) {
+ this->unk_410 |= 0x20;
+ }
+ }
+ this->unk_414 = temp_f0;
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA578.s")
+#endif
+#ifdef NON_MATCHING
+void func_808DA6FC(EnSw* this, GlobalContext* globalCtx) {
+ f32 sp4C;
+ s32 temp;
+ s32 temp2;
+ Vec3f sp38;
+ f32 temp_f0;
+
+ if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ this->unk_44C = 0.14f * temp_f0;
+ func_808D94D0(this, globalCtx, 1, 0, 0);
+ if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) {
+ Math_Vec3f_Copy(&sp38, &this->unk_374);
+ func_808D9894(this, &sp38);
+ func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp38.z, sp38.x));
+ }
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_DASH);
+ this->skelAnime.curFrame = 0.0f;
+ }
+
+ sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374);
+ temp = this->unk_414;
+ temp2 = sp4C;
+ if ((temp != 0) && (temp < temp2)) {
+ Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374);
+ this->unk_454 = Rand_S16Offset(20, 20);
+ this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f;
+ this->actionFunc = func_808DA350;
+ this->skelAnime.curFrame = 0.0f;
+ }
+ this->unk_414 = sp4C;
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA6FC.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA89C.s")
+void func_808DA89C(EnSw* this, GlobalContext* globalCtx) {
+ if (this->unk_412 == 10) {
+ s32 i;
+ s32 count;
+ s16 phi_a0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DAA60.s")
+ for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) {
+ if (this->unk_464[i] == 0) {
+ phi_a0 = 0;
+ } else {
+ this->unk_464[i]--;
+ phi_a0 = this->unk_464[i];
+ }
+ if (phi_a0 == 0) {
+ count++;
+ }
+ }
+ if (count == ARRAY_COUNT(this->unk_464)) {
+ if (!ENSW_GET_3(&this->actor)) {
+ func_808D9E44(this);
+ }
+ this->unk_412 = 1;
+ func_808D8ED0(this, globalCtx);
+ }
+ return;
+ if (1) {}
+ }
+
+ if (ENSW_GET_3(&this->actor)) {
+ this->actionFunc = func_808DAEB4;
+ return;
+ }
+
+ if (this->actor.bgCheckFlags & 1) {
+ f32 temp_f2;
+
+ this->actor.shape.yOffset = 400.0f;
+ temp_f2 = fabsf(this->actor.velocity.y) * 0.6f;
+ this->actor.velocity.y = temp_f2;
+ this->unk_448 = temp_f2;
+ this->actor.speedXZ = 0.0f;
+ if ((s32)temp_f2 != 0) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTURA_BOUND);
+ } else {
+ this->actionFunc = func_808DAEB4;
+ this->actor.velocity.y = 0.0f;
+ }
+ if ((s32)this->actor.velocity.y >= 2) {
+ func_808D8940(this, globalCtx);
+ }
+ } else {
+ Math_ApproachF(&this->actor.shape.yOffset, 400.0f, 0.3f, 1000.0f);
+ }
+
+ Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
+}
+
+void func_808DAA60(EnSw* this, GlobalContext* globalCtx) {
+ Vec3s* sp44;
+ s16 temp_v0;
+ s16 sp40;
+ Vec3f sp34;
+ f32 temp_f16;
+
+ sp44 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_1E4->unk_04);
+ sp40 = 0;
+
+ if (DECR(this->unk_454) == 0) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 0) {
+ temp_f16 = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ sp40 = 80.0f * temp_f16;
+ if (this->unk_45E == 0) {
+ Math_Vec3s_ToVec3f(&sp34, &sp44[this->unk_4A0]);
+ func_808D9894(this, &sp34);
+ temp_v0 = Math_FAtan2F(sp34.z, sp34.x);
+ if (ABS_ALT(temp_v0) < sp40) {
+ this->skelAnime.curFrame = 0.0f;
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_DASH);
+ Math_Vec3s_ToVec3f(&this->unk_374, &sp44[this->unk_4A0]);
+ this->actionFunc = func_808DACF4;
+ this->unk_414 = 0.0f;
+ sp40 = ABS_ALT(temp_v0);
+ }
+ sp40 *= (temp_v0 < 0) ? -1 : 1;
+ }
+ } else {
+ if (this->unk_456 != 0) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALGOLD_ROLL);
+ this->unk_456--;
+ this->skelAnime.curFrame = 0.0f;
+ } else {
+ this->unk_454 = Rand_S16Offset(20, 20);
+ this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f;
+ if (this->unk_45E != 0) {
+ this->unk_45E--;
+ }
+ }
+
+ if (this->unk_456 % 2) {
+ if (Rand_ZeroOne() < 0.5f) {
+ this->unk_450 = -1.0f;
+ } else {
+ this->unk_450 = 1.0f;
+ }
+ }
+ }
+ }
+ func_808D94D0(this, globalCtx, 0, 0, sp40);
+}
+
+#ifdef NON_MATCHING
+void func_808DACF4(EnSw* this, GlobalContext* globalCtx) {
+ f32 sp4C;
+ f32 temp_f0;
+ s32 temp_f6;
+
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 0) {
+ Vec3f sp38;
+ f32 temp;
+
+ temp = this->skelAnime.endFrame - this->skelAnime.curFrame;
+ this->unk_44C = 0.1f * temp;
+ func_808D94D0(this, globalCtx, 1, 0, 0);
+ if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) {
+
+ Math_Vec3f_Copy(&sp38, &this->unk_374);
+ func_808D9894(this, &sp38);
+ func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp38.z, sp38.x));
+ }
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_DASH);
+ this->skelAnime.curFrame = 0.0f;
+ }
+
+ sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374);
+ temp_f6 = this->unk_414;
+ if ((temp_f6 != 0) && (temp_f6 < (s32)sp4C)) {
+ Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374);
+ this->unk_4A0 += this->unk_49C;
+ if ((this->unk_4A0 >= this->unk_1E4->unk_00) || (this->unk_4A0 < 0)) {
+ this->unk_49C = -this->unk_49C;
+ this->unk_4A0 += this->unk_49C * 2;
+ }
+
+ if (this->unk_410 & 8) {
+ func_808D9F08(this);
+ this->actionFunc = func_808DAA60;
+ } else {
+ this->actionFunc = func_808DB100;
+ }
+ }
+ this->unk_414 = sp4C;
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DACF4.s")
+#endif
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DAEB4.s")
+void func_808DAEB4(EnSw* this, GlobalContext* globalCtx) {
+ Vec3f sp5C;
+ s32 i;
+ s32 count;
+ s16 phi_a0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DB100.s")
+ if (this->unk_410 & 2) {
+ if (!ENSW_GET_3(&this->actor)) {
+ if (this->unk_410 & 4) {
+ phi_a0 = DECR(this->unk_45C);
+ if (phi_a0 == 0) {
+ this->unk_410 &= ~4;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DB25C.s")
+ for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) {
+ if (this->unk_464[i] == 0) {
+ phi_a0 = 0;
+ } else {
+ this->unk_464[i]--;
+ phi_a0 = this->unk_464[i];
+ }
+ if (phi_a0 == 0) {
+ count++;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DB2E0.s")
+ if (count == ARRAY_COUNT(this->unk_464)) {
+ Actor_MarkForDeath(&this->actor);
+ }
+ } else {
+ Math_ApproachF(&this->actor.scale.x, 0.0f, 0.08f, 1.0f);
+ Actor_SetScale(&this->actor, this->actor.scale.x);
+ if ((s32)(this->actor.scale.x * 100.0f) == 0) {
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/EnSw_Init.s")
+ Math_Vec3f_Copy(&sp5C, &this->actor.world.pos);
+ sp5C.x += this->unk_368.x * 10.0f;
+ sp5C.y += this->unk_368.y * 10.0f;
+ sp5C.z += this->unk_368.z * 10.0f;
+ if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SI, sp5C.x, sp5C.y,
+ sp5C.z, 0, 0, 0, this->actor.params) != NULL) {
+ play_sound(NA_SE_SY_KINSTA_MARK_APPEAR);
+ }
+ Actor_MarkForDeath(&this->actor);
+ }
+ func_808D94D0(this, globalCtx, 0, 0, 0x1554);
+ }
+ } else {
+ phi_a0 = DECR(this->unk_45C);
+ if (phi_a0 == 0) {
+ this->unk_410 |= 2;
+ if (!ENSW_GET_3(&this->actor) && (this->unk_412 == 1)) {
+ func_808D8B58(this);
+ this->unk_45C = 10;
+ } else {
+ this->unk_45C = 20;
+ }
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/EnSw_Destroy.s")
+void func_808DB100(EnSw* this, GlobalContext* globalCtx) {
+ if (this->actor.parent != NULL) {
+ this->unk_498 = this->actor.parent->id;
+ this->unk_456 = 0;
+ this->unk_454 = 0;
+ this->skelAnime.curFrame = 0.0f;
+ func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 4);
+ this->actionFunc = func_808DB25C;
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/EnSw_Update.s")
+ if (!(this->unk_410 & 1)) {
+ func_808D9A70(this, globalCtx);
+ return;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DB7F4.s")
+ if ((DECR(this->unk_454) == 0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
+ if (this->unk_456 != 0) {
+ if (!ENSW_GET_3(&this->actor)) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_ROLL);
+ } else {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALGOLD_ROLL);
+ }
+ this->unk_456--;
+ this->skelAnime.curFrame = 0.0f;
+ } else {
+ this->unk_454 = Rand_S16Offset(20, 20);
+ this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/EnSw_Draw.s")
+void func_808DB25C(EnSw* this, GlobalContext* globalCtx) {
+ if (ActorCutscene_GetCurrentIndex() == 0x7C) {
+ ActorCutscene_Stop(0x7C);
+ } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
+ ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
+ func_808D9C18(this);
+ this->actionFunc = func_808DB2E0;
+ } else {
+ ActorCutscene_SetIntentToPlay(this->actor.cutscene);
+ }
+}
+
+void func_808DB2E0(EnSw* this, GlobalContext* globalCtx) {
+ f32 temp_f2;
+
+ if (this->actor.bgCheckFlags & 1) {
+ func_808D9F78(this, globalCtx, 0);
+ temp_f2 = fabsf(this->actor.velocity.y) * 0.6f;
+ this->actor.velocity.x *= 0.5f;
+ this->actor.velocity.y = temp_f2;
+ this->unk_448 = temp_f2;
+ this->actor.velocity.z *= 0.5f;
+
+ if ((s32)temp_f2 != 0) {
+ Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTURA_BOUND);
+ } else {
+ func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5);
+ Math_Vec3f_Copy(&this->actor.velocity, &D_801D15B0);
+ this->unk_410 &= ~(0x10 | 0x1);
+ this->actionFunc = func_808DB100;
+ }
+
+ if ((s32)this->actor.velocity.y >= 2) {
+ func_808D8940(this, globalCtx);
+ }
+ }
+
+ Math_ApproachF(&this->actor.scale.x, 0.02f, 0.4f, 1.0f);
+ Actor_SetScale(&this->actor, this->actor.scale.x);
+ this->actor.velocity.y += this->actor.gravity;
+ Actor_ApplyMovement(&this->actor);
+ Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
+}
+
+void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnSw* this = THIS;
+ s32 pad;
+
+ if (!func_808D9968(this, globalCtx)) {
+ ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
+ SkelAnime_Init(globalCtx, &this->skelAnime, &D_06005298, NULL, this->jointTable, this->morphTable, 30);
+ func_8013BC6C(&this->skelAnime, sAnimations, 0);
+ this->skelAnime.playSpeed = 4.0f;
+
+ Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit);
+ if (!ENSW_GET_3(&this->actor)) {
+ this->actor.hintId = 0x1F;
+ CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
+ this->collider.info.toucher.damage = 8;
+ } else {
+ this->actor.hintId = 0x20;
+ CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable2, &sColChkInfoInit2);
+ this->collider.info.toucher.damage = 16;
+ }
+
+ this->unk_1E4 = func_8013BEDC(globalCtx, ENSW_GET_FF00(&this->actor), 255, &this->unk_4A0);
+ if (this->unk_1E4 != NULL) {
+ this->unk_4A0 = 1;
+ }
+
+ switch (ENSW_GET_3(&this->actor)) {
+ case 0:
+ func_808D9F78(this, globalCtx, 1);
+ this->actionFunc = func_808DA350;
+ break;
+
+ case 1:
+ this->actor.flags &= ~1;
+ this->actor.flags |= 0x10;
+
+ if (this->actor.world.rot.z < 0) {
+ this->unk_460 = -thisx->world.rot.z;
+ } else {
+ this->unk_460 = thisx->world.rot.z;
+ }
+
+ if (this->actor.world.rot.z >= 0) {
+ this->unk_410 |= 8;
+ }
+
+ func_808DA024(this, globalCtx);
+ this->unk_410 |= (0x10 | 0x1);
+ this->unk_410 &= ~4;
+ this->actionFunc = func_808DB100;
+ break;
+
+ case 2:
+ case 3:
+ this->actor.flags &= ~1;
+ this->actor.flags |= 0x10;
+
+ if (this->actor.world.rot.z < 0) {
+ this->unk_460 = -thisx->world.rot.z;
+ } else {
+ this->unk_460 = thisx->world.rot.z;
+ }
+
+ if (this->actor.world.rot.z >= 0) {
+ this->unk_410 |= 8;
+ }
+
+ func_808D9F78(this, globalCtx, 1);
+ if (this->unk_1E4 != NULL) {
+ this->unk_49C = 1;
+ func_808D9F08(this);
+ this->actionFunc = func_808DAA60;
+ } else {
+ this->actionFunc = func_808DB100;
+ }
+ break;
+ }
+ } else {
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnSw* this = THIS;
+
+ Collider_DestroySphere(globalCtx, &this->collider);
+}
+
+void EnSw_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnSw* this = THIS;
+
+ if (func_808DA08C(this, globalCtx)) {
+ this->actionFunc = func_808DA89C;
+ } else if (DECR(this->unk_45A) == 0) {
+ this->actionFunc(this, globalCtx);
+ }
+
+ if ((this->unk_412 != 10) || (this->unk_45A != 0)) {
+ SkelAnime_Update(&this->skelAnime);
+ }
+
+ Actor_SetHeight(&this->actor, 0.0f);
+ func_808D8FC4(this, globalCtx);
+}
+
+s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnSw* this = THIS;
+
+ if (ENSW_GET_3(&this->actor)) {
+ switch (limbIndex) {
+ case 23:
+ *dList = D_06004788;
+ break;
+
+ case 8:
+ *dList = D_060046F0;
+ break;
+
+ case 14:
+ *dList = D_06004658;
+ break;
+
+ case 11:
+ *dList = D_060045C0;
+ break;
+
+ case 26:
+ *dList = D_06004820;
+ break;
+
+ case 20:
+ *dList = D_060048B8;
+ break;
+
+ case 17:
+ *dList = D_06004950;
+ break;
+
+ case 29:
+ *dList = D_060049E8;
+ break;
+
+ case 5:
+ *dList = D_06003FB0;
+ break;
+
+ case 4:
+ *dList = D_060043D8;
+ break;
+ }
+ }
+ return false;
+}
+
+void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnSw* this = THIS;
+ s32 i;
+ s32 count;
+
+ if (this->unk_410 & 4) {
+ if (ENSW_GET_3(&this->actor)) {
+ func_800B8050(&this->actor, globalCtx, MTXMODE_NEW);
+ }
+ func_8012C28C(globalCtx->state.gfxCtx);
+ Matrix_InsertXRotation_s(-0x3C72, MTXMODE_APPLY);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, NULL,
+ &this->actor);
+ }
+
+ for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) {
+ count += func_808D8D60(this, globalCtx, i);
+ }
+
+ if (count != 0) {
+ this->unk_462 += 3;
+ }
+}
diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h
index e6d240569..b64b6d02a 100644
--- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h
+++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h
@@ -7,11 +7,50 @@ struct EnSw;
typedef void (*EnSwActionFunc)(struct EnSw*, GlobalContext*);
+#define ENSW_GET_3(thisx) (((thisx)->params & 3) & 0xFF)
+#define ENSW_GET_3FC(thisx) (((thisx)->params & 0x3FC) >> 2)
+#define ENSW_GET_FF00(thisx) ((((thisx)->params & 0xFF00) >> 8) & 0xFF)
+
+typedef struct {
+ u8 unk_00;
+ s32 unk_04;
+} EnSwUnkStruct;
+
typedef struct EnSw {
/* 0x0000 */ Actor actor;
- /* 0x0144 */ char unk_144[0x44];
+ /* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ EnSwActionFunc actionFunc;
- /* 0x018C */ char unk_18C[0x318];
+ /* 0x018C */ ColliderSphere collider;
+ /* 0x01E4 */ EnSwUnkStruct* unk_1E4;
+ /* 0x01E8 */ Vec3s jointTable[30];
+ /* 0x029C */ Vec3s morphTable[30];
+ /* 0x0350 */ Vec3f unk_350;
+ /* 0x035C */ Vec3f unk_35C;
+ /* 0x0368 */ Vec3f unk_368;
+ /* 0x0374 */ Vec3f unk_374;
+ /* 0x0380 */ Vec3f unk_380[12];
+ /* 0x0410 */ u16 unk_410;
+ /* 0x0412 */ u8 unk_412;
+ /* 0x0414 */ f32 unk_414;
+ /* 0x0418 */ f32 unk_418[12];
+ /* 0x0448 */ f32 unk_448;
+ /* 0x044C */ f32 unk_44C;
+ /* 0x0450 */ f32 unk_450;
+ /* 0x0454 */ s16 unk_454;
+ /* 0x0456 */ s16 unk_456;
+ /* 0x0458 */ s16 unk_458;
+ /* 0x045A */ s16 unk_45A;
+ /* 0x045C */ s16 unk_45C;
+ /* 0x045E */ s16 unk_45E;
+ /* 0x0460 */ s16 unk_460;
+ /* 0x0462 */ s16 unk_462;
+ /* 0x0464 */ s16 unk_464[12];
+ /* 0x047C */ s16 unk_47C[12];
+ /* 0x0494 */ s16 unk_494;
+ /* 0x0496 */ s16 unk_496;
+ /* 0x0468 */ s16 unk_498;
+ /* 0x049C */ s32 unk_49C;
+ /* 0x04A0 */ s32 unk_4A0;
} EnSw; // size = 0x4A4
extern const ActorInit En_Sw_InitVars;
diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c
index 67b0fe886..7e641a4ed 100644
--- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c
+++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c
@@ -141,9 +141,11 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.targetMode = 1;
Actor_SetScale(&this->actor, 0.01f);
if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600E7D0, &D_0600DFEC, this->jointTable, this->morphTable, 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600E7D0, &D_0600DFEC, this->jointTable, this->morphTable,
+ 16);
} else {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600E7D0, &D_0600D9D0, this->jointTable, this->morphTable, 16);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600E7D0, &D_0600D9D0, this->jointTable, this->morphTable,
+ 16);
}
this->actor.colChkInfo.cylRadius = 100;
@@ -175,7 +177,7 @@ void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 sp28;
f32 phi_f0;
s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1);
@@ -209,7 +211,7 @@ void func_809C6810(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
u16 sp22;
@@ -257,7 +259,7 @@ void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_80147624(globalCtx)) {
if (globalCtx->msgCtx.choiceIndex == 0) {
@@ -314,7 +316,7 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_80147624(globalCtx)) {
switch (this->unk_284) {
@@ -373,7 +375,7 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (player->stateFlags1 & 0x20) {
player->stateFlags1 |= 0x20;
@@ -415,8 +417,8 @@ void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) {
break;
}
- if (this->skelAnime.animCurrentSeg == &D_0600D2F8) {
- if (func_801378B8(&this->skelAnime, this->skelAnime.animFrameCount)) {
+ if (this->skelAnime.animation == &D_0600D2F8) {
+ if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_800BDC5C(&this->skelAnime, sAnimations, 0);
}
}
@@ -524,7 +526,7 @@ void func_809C72D8(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_80147624(globalCtx)) {
if (globalCtx->msgCtx.choiceIndex == 0) {
@@ -587,7 +589,7 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_80147624(globalCtx)) {
switch (this->unk_284) {
@@ -626,7 +628,7 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) {
case 0x3FD:
case 0x3FF:
- if (this->unk_26A == 4U) {
+ if (this->unk_26A == 4) {
if (this->unk_284 == 0x3FD) {
func_801518B0(globalCtx, 0x3FE, &this->actor);
this->unk_284 = 0x3FE;
@@ -707,7 +709,7 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (player->stateFlags1 & 0x20) {
player->stateFlags1 |= 0x20;
@@ -749,7 +751,7 @@ void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Actor_HasParent(&this->actor, globalCtx)) {
if (!(gSaveContext.weekEventReg[59] & 0x10)) {
@@ -778,7 +780,7 @@ void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
if ((CURRENT_DAY == 3) && (gSaveContext.time > CLOCK_TIME(12, 00))) {
@@ -799,7 +801,7 @@ void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Actor_HasParent(&this->actor, globalCtx)) {
if (this->unk_284 == 0x407) {
@@ -836,7 +838,7 @@ void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (CURRENT_DAY != 3) {
if ((func_80152498(&globalCtx->msgCtx) == 6) && func_80147624(globalCtx)) {
@@ -861,7 +863,7 @@ void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_809C6720(globalCtx, D_809C9474)) {
player->stateFlags1 |= 0x20;
@@ -880,7 +882,7 @@ void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx) {
void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) {
static s16 D_809C9498 = 30;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (D_809C9498 > 0) {
player->actor.world.pos = D_809C9474;
@@ -910,7 +912,7 @@ void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) {
void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx) {
static s16 D_809C949C = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (((this->unk_272 == 0) || (this->unk_26C > 140)) && (D_809C949C == 0) && (this->unk_27C < 4)) {
D_809C949C = 1;
@@ -1020,7 +1022,7 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) {
void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) {
static s32 D_809C94A0 = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
player->stateFlags1 |= 0x20;
if (globalCtx->interfaceCtx.unk_286 == 0) {
@@ -1067,7 +1069,7 @@ void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) {
void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx) {
static s16 D_809C94A4 = 30;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (D_809C94A4 == 30) {
if (player->transformation == PLAYER_FORM_FIERCE_DEITY) {
@@ -1104,7 +1106,7 @@ void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) {
0x00026984, 0x00012852, 0x00011999, 0x00022895, 0x0000056A, 0x0002A451, 0x00004115,
};
static s32 D_809C94A8 = 0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 sp30;
s32 pad;
u64 sp20;
@@ -1239,7 +1241,7 @@ void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.focus.pos.y = 70.0f;
Actor_SetHeight(&this->actor, 70.0f);
if (this->unk_26A != 1) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
func_800E9250(globalCtx, &this->actor, &this->unk_258, &this->unk_25E, this->actor.focus.pos);
}
}
@@ -1253,12 +1255,12 @@ s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx**
}
if (limbIndex == 15) {
- SysMatrix_InsertTranslation(3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_258.x, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_258.y, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(-3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_258.x, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_258.y, MTXMODE_APPLY);
+ Matrix_InsertTranslation(-3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else if (limbIndex == 8) {
- SysMatrix_InsertXRotation_s(-this->unk_25E.y, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(-this->unk_25E.y, MTXMODE_APPLY);
}
return false;
@@ -1269,7 +1271,7 @@ void EnSyatekiMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
Vec3f sp18 = { 1600.0f, 0.0f, 0.0f };
if (limbIndex == 15) {
- SysMatrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
}
}
@@ -1299,7 +1301,7 @@ void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_809C94B8[this->unk_264]));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_809C94B8[this->unk_264]));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnSyatekiMan_OverrideLimbDraw, EnSyatekiMan_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c
index 1abbd9617..f5f460141 100644
--- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c
+++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c
@@ -292,7 +292,7 @@ void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) {
void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 dayTemp;
EnTest4* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s8 temp_v0 = this->actor.cutscene;
sCutscenes[0] = temp_v0;
@@ -371,7 +371,7 @@ void EnTest4_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((globalCtx->unk_18B4A == 0) && (func_801690CC(globalCtx) == 0) && (globalCtx->numSetupActors <= 0) &&
(globalCtx->roomCtx.unk31 == 0) && (func_8016A168() == 0)) {
@@ -496,7 +496,7 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) {
}
}
if (this->transitionCsTimer == 60) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
gSaveContext.time += CLOCK_TIME_MINUTE;
this->unk_146 = gSaveContext.time;
@@ -568,7 +568,7 @@ void func_80A4323C(EnTest4* this, GlobalContext* globalCtx) {
void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx) {
EnTest4* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (!(player->stateFlags1 & 2)) {
this->actionFunc(this, globalCtx);
diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
index d0a7b9498..b303ed877 100644
--- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
+++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c
@@ -37,17 +37,14 @@ extern AnimationHeader D_06000278;
extern AnimationHeader D_06000604;
extern Gfx D_06003060[];
extern Gfx D_060030D8[];
-extern UNK_PTR D_060033B0;
-extern UNK_PTR D_06003D58;
-extern UNK_TYPE D_06004348;
-extern UNK_TYPE D_06004B88;
-extern UNK_TYPE D_060055E0;
+extern Gfx D_060033B0[];
+extern Gfx D_06003D58[];
+extern Gfx D_06004348[];
+extern Gfx D_06004B88[];
+extern Gfx D_060055E0[];
extern FlexSkeletonHeader D_060061A0;
extern AnimationHeader D_060063C4;
-static Vec3f D_80C13920;
-static s32 D_80C1392C;
-
const ActorInit En_Thiefbird_InitVars = {
ACTOR_EN_THIEFBIRD,
ACTORCAT_ENEMY,
@@ -156,13 +153,16 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP),
};
+static Vec3f D_80C13920;
+static s32 D_80C1392C;
+
void EnThiefbird_Init(Actor* thisx, GlobalContext* globalCtx) {
EnThiefbird* this = THIS;
s32 i;
ColliderJntSphElementDim* dim;
Actor_ProcessInitChain(&this->actor, sInitChain);
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060061A0, &D_06000604, this->jointTable, this->morphTable, 17);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060061A0, &D_06000604, this->jointTable, this->morphTable, 17);
Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements);
for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) {
@@ -217,7 +217,7 @@ void func_80C10984(EnThiefbird* this, s32 arg1) {
}
s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) {
- static UNK_TYPE D_80C13680[] = { &D_06004348, &D_06004B88, &D_060055E0 };
+ static Gfx* D_80C13680[] = { D_06004348, D_06004B88, D_060055E0 };
s32 isItemFound = false;
s32 phi_a3 = 0;
s32 i = 18;
@@ -249,7 +249,7 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) {
if (isItemFound) {
func_801149A0(sp1E, i);
- this->unk_3E8 = &D_060033B0;
+ this->unk_3E8 = D_060033B0;
if (!func_80152498(&globalCtx->msgCtx)) {
func_801518B0(globalCtx, 0xF4, NULL);
}
@@ -266,7 +266,7 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) {
phi_t0_3 = phi_a3 + 0x4C;
if (phi_a3 == 4) {
func_801149A0(16, 16);
- this->unk_3E8 = &D_06003D58;
+ this->unk_3E8 = D_06003D58;
phi_t0_3 = 0x10;
} else {
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
@@ -311,7 +311,7 @@ void func_80C10DE8(s32 items[], s32 count, s32 item) {
}
s32 func_80C10E98(GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 phi_s0_2;
s32 phi_s2;
s32 spB0;
@@ -419,7 +419,7 @@ s32 func_80C10E98(GlobalContext* globalCtx) {
}
void func_80C11338(EnThiefbird* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnItem00* item = NULL;
f32 phi_f20 = 5000.0f;
s32 i;
@@ -471,18 +471,18 @@ void func_80C114C0(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C11538(EnThiefbird* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000604, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000604, -4.0f);
this->unk_18E = 60;
this->collider.base.acFlags |= AC_ON;
this->actionFunc = func_80C11590;
}
void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 sp38;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- sp38 = func_801378B8(&this->skelAnime, 0.0f);
+ SkelAnime_Update(&this->skelAnime);
+ sp38 = Animation_OnFrame(&this->skelAnime, 0.0f);
this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 3.0f;
if (this->actor.bgCheckFlags & 8) {
@@ -535,18 +535,18 @@ void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C118E4(EnThiefbird* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_060063C4, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_060063C4, -10.0f);
this->unk_18E = 300;
this->actionFunc = func_80C1193C;
this->actor.speedXZ = 5.0f;
}
void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 pitch;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- if (func_801378B8(&this->skelAnime, 1.0f)) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Animation_OnFrame(&this->skelAnime, 1.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_FLUTTER);
}
@@ -602,7 +602,7 @@ void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) {
void func_80C11C60(EnThiefbird* this) {
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000088);
+ Animation_PlayOnce(&this->skelAnime, &D_06000088);
this->actor.bgCheckFlags &= ~1;
this->actor.shape.rot.x = 0;
this->unk_18E = 40;
@@ -674,7 +674,7 @@ void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C11F6C(EnThiefbird* this, GlobalContext* globalCtx) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000278, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000278, -4.0f);
func_80C10984(this, 15);
if (this->actor.colChkInfo.damageEffect != 3) {
this->actor.speedXZ = 4.0f;
@@ -732,7 +732,7 @@ void func_80C1215C(EnThiefbird* this, GlobalContext* globalCtx) {
}
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) {
this->unk_192 = this->actor.wallYaw;
} else if (this->unk_3E8 == 0) {
@@ -758,7 +758,7 @@ void func_80C1215C(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C12308(EnThiefbird* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000278, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000278, -4.0f);
func_80C10984(this, 15);
this->unk_190 = -0x1000;
this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer);
@@ -771,7 +771,7 @@ void func_80C12378(EnThiefbird* this, GlobalContext* globalCtx) {
this->unk_18E--;
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) {
this->unk_192 = this->actor.wallYaw;
} else {
@@ -787,7 +787,7 @@ void func_80C12378(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C1242C(EnThiefbird* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06000278, 2.0f, 0.0f, 0.0f, 0, -4.0f);
+ Animation_Change(&this->skelAnime, &D_06000278, 2.0f, 0.0f, 0.0f, 0, -4.0f);
this->actor.flags |= 0x10;
this->collider.base.acFlags |= AC_ON;
this->actionFunc = func_80C124B0;
@@ -798,7 +798,7 @@ void func_80C124B0(EnThiefbird* this, GlobalContext* globalCtx) {
Actor* temp_v0;
s16 temp_v1;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) {
this->unk_192 = this->actor.wallYaw;
} else {
@@ -839,7 +839,7 @@ void func_80C126A8(EnThiefbird* this) {
}
void func_80C126D8(EnThiefbird* this, GlobalContext* globalCtx) {
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
Math_ApproachS(&this->actor.shape.rot.x, 0x3000, 6, 0x1000);
if (this->actor.yDistToPlayer > 100.0f) {
Actor_MarkForDeath(&this->actor);
@@ -847,22 +847,22 @@ void func_80C126D8(EnThiefbird* this, GlobalContext* globalCtx) {
}
void func_80C12744(EnThiefbird* this) {
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000604, -4.0f);
- SkelAnime_ChangeAnim(&this->skelAnime, &D_06000604, 1.0f, 0.0f, 0.0f, 1, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_06000604, -4.0f);
+ Animation_Change(&this->skelAnime, &D_06000604, 1.0f, 0.0f, 0.0f, 1, -4.0f);
this->unk_190 = 0;
this->collider.base.acFlags |= AC_ON;
this->actor.flags |= 0x10;
this->actionFunc = func_80C127F4;
this->actor.speedXZ = 4.0f;
- this->skelAnime.animPlaybackSpeed = 3.0f;
+ this->skelAnime.playSpeed = 3.0f;
}
void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 temp_v0;
f32 temp_f0;
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if ((this->unk_3EC != NULL) && ((this->unk_3EC->actor.update == NULL) || (this->unk_3EC->unk152 == 0) ||
(Actor_XZDistanceBetweenActors(&player->actor, &this->unk_3EC->actor) <= 10.0f))) {
this->unk_3EC = NULL;
@@ -1041,8 +1041,8 @@ void EnThiefbird_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
func_80C12D00(this);
- if (((this->skelAnime.animCurrentSeg == &D_06000604) && func_801378B8(&this->skelAnime, 13.0f)) ||
- ((this->skelAnime.animCurrentSeg == &D_06000278) && func_801378B8(&this->skelAnime, 1.0f))) {
+ if (((this->skelAnime.animation == &D_06000604) && Animation_OnFrame(&this->skelAnime, 13.0f)) ||
+ ((this->skelAnime.animation == &D_06000278) && Animation_OnFrame(&this->skelAnime, 1.0f))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_FLUTTER);
}
}
@@ -1077,17 +1077,17 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
OPEN_DISPS(globalCtx->state.gfxCtx);
gfx = POLY_OPA_DISP;
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&gfx[1], this->unk_3E4);
POLY_OPA_DISP = &gfx[2];
CLOSE_DISPS(globalCtx->state.gfxCtx);
} else if (limbIndex == 16) {
- if (this->unk_3E8 != 0) {
+ if (this->unk_3E8 != NULL) {
OPEN_DISPS(globalCtx->state.gfxCtx);
- if (this->unk_3E8 == &D_060033B0) {
+ if (this->unk_3E8 == D_060033B0) {
gfx = POLY_XLU_DISP;
} else {
gfx = POLY_OPA_DISP;
@@ -1096,7 +1096,7 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&gfx[1], this->unk_3E8);
- if (this->unk_3E8 == &D_060033B0) {
+ if (this->unk_3E8 == D_060033B0) {
POLY_XLU_DISP = &gfx[2];
} else {
POLY_OPA_DISP = &gfx[2];
@@ -1109,11 +1109,11 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi
idx = D_80C13698[limbIndex];
if (idx != -1) {
if (idx == 9) {
- SysMatrix_GetStateTranslationAndScaledX(1000.0f, &this->unk_350[idx]);
+ Matrix_GetStateTranslationAndScaledX(1000.0f, &this->unk_350[idx]);
} else {
- SysMatrix_GetStateTranslation(&this->unk_350[idx]);
+ Matrix_GetStateTranslation(&this->unk_350[idx]);
if ((idx == 3) || (idx == 5)) {
- SysMatrix_GetStateTranslationAndScaledX(2000.0f, &this->unk_350[idx + 1]);
+ Matrix_GetStateTranslationAndScaledX(2000.0f, &this->unk_350[idx + 1]);
}
}
}
@@ -1134,11 +1134,11 @@ void func_80C13354(EnThiefbird* this, GlobalContext* globalCtx2) {
for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) {
if (ptr->unk_22 != 0) {
- SysMatrix_InsertTranslation(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_InsertTranslation(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
Matrix_RotateY(ptr->unk_1E, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(ptr->unk_20, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, -10.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(ptr->unk_20, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, -10.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(ptr->unk_18, ptr->unk_18, 1.0f, MTXMODE_APPLY);
gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -1155,8 +1155,8 @@ void EnThiefbird_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnThiefbird* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnThiefbird_OverrideLimbDraw, EnThiefbird_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnThiefbird_OverrideLimbDraw, EnThiefbird_PostLimbDraw, &this->actor);
if (this->actor.colorFilterTimer > 0) {
func_800AE5A0(globalCtx);
}
diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h
index 7e3e3c32a..5581f1155 100644
--- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h
+++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h
@@ -37,7 +37,7 @@ typedef struct EnThiefbird {
/* 0x03DC */ f32 unk_3DC;
/* 0x03E0 */ f32 unk_3E0;
/* 0x03E4 */ Gfx* unk_3E4;
- /* 0x03E8 */ UNK_PTR unk_3E8;
+ /* 0x03E8 */ Gfx* unk_3E8;
/* 0x03EC */ EnItem00* unk_3EC;
/* 0x03F0 */ EnThiefbirdUnkStruct unk_3F0[40];
} EnThiefbird; // size = 0x990
diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c
index 07f6cfce2..4716439cb 100644
--- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c
+++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c
@@ -205,8 +205,9 @@ void EnToto_Init(Actor* thisx, GlobalContext* globalCtx) {
}
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 30.0f);
this->actor.bgCheckFlags |= 0x400;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A978, globalCtx->sceneNum == 0x12 ? &D_06003AA8 : &D_0600C880,
- this->limbDrawTbl, this->transitionDrawTbl, 18);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600A978,
+ ((globalCtx->sceneNum == 0x12) ? &D_06003AA8 : &D_0600C880), this->jointTable, this->morphTable,
+ 18);
func_80BA36C0(this, globalCtx, 0);
this->actor.shape.rot.x = 0;
}
@@ -218,14 +219,13 @@ void EnToto_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80BA383C(EnToto* this, GlobalContext* globalCtx) {
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && this->actionFuncIndex == 1 &&
- this->skelAnime.animCurrentSeg != &D_06000C80) {
+ if (SkelAnime_Update(&this->skelAnime) && this->actionFuncIndex == 1 && this->skelAnime.animation != &D_06000C80) {
if (globalCtx->msgCtx.unk11F04 != 0x2A98 && globalCtx->msgCtx.unk11F04 != 0x2A99) {
if (this->unk2B4 & 1 || Rand_ZeroOne() > 0.5f) {
this->unk2B4 = (this->unk2B4 + 1) & 3;
}
}
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, D_80BA5078[this->unk2B4]);
+ Animation_PlayOnce(&this->skelAnime, D_80BA5078[this->unk2B4]);
}
func_800BBB74(&this->unk260, 0x14, 0x50, 3);
}
@@ -236,7 +236,7 @@ void func_80BA3930(EnToto* this, GlobalContext* globalCtx) {
if (globalCtx->sceneNum == 0x12) {
animationHeader = &D_06003AA8;
}
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, animationHeader, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, animationHeader, -4.0f);
}
s32 func_80BA397C(EnToto* this, s16 arg1) {
@@ -250,7 +250,7 @@ s32 func_80BA397C(EnToto* this, s16 arg1) {
}
void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_80BA383C(this, globalCtx);
if (func_800B84D0(&this->actor, globalCtx) != 0) {
@@ -298,13 +298,13 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) {
void func_80BA3BFC(EnToto* this, GlobalContext* globalCtx) {
if (globalCtx->sceneNum == 0x12) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000C80, -4.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06000C80, -4.0f);
this->unk2B4 = 0;
} else {
if (this->text->unk0 == 4) {
func_80151BB4(globalCtx, 9);
}
- SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_0600B3E0, -4.0f);
+ Animation_MorphToLoop(&this->skelAnime, &D_0600B3E0, -4.0f);
}
}
@@ -343,7 +343,7 @@ void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) {
return;
}
} else {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (player->stateFlags1 & 0x400 && player->unk_AE7 != 0) {
func_80151BB4(globalCtx, 48);
func_80151BB4(globalCtx, 9);
@@ -410,7 +410,7 @@ s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx) {
s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
- ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &PLAYER->actor);
+ ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &GET_PLAYER(globalCtx)->actor);
return 1;
}
@@ -458,7 +458,7 @@ s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) {
}
s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u32 phi_s0 = 0;
Vec3s* end = &D_80BA510C[3];
@@ -514,7 +514,7 @@ s32 func_80BA44D4(EnTotoUnkStruct2* arg0, Player* player) {
}
s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnTotoUnkStruct2* temp_s0;
s32 i;
u16 tmp;
@@ -556,22 +556,22 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) {
s32 func_80BA46D8(EnToto* this, GlobalContext* globalCtx) {
func_800B7298(globalCtx, NULL, 0x44);
- func_80152434(globalCtx, D_80BA5120[gSaveContext.playerForm == 4 ? 0 : gSaveContext.playerForm]);
+ func_80152434(globalCtx, D_80BA5120[CUR_FORM]);
return 0;
}
s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.unk1202A == 4) {
- if (gSaveContext.playerForm == 4) {
+ if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
gSaveContext.weekEventReg[56] |= 0x10;
}
- if (gSaveContext.playerForm == 3) {
+ if (gSaveContext.playerForm == PLAYER_FORM_DEKU) {
gSaveContext.weekEventReg[56] |= 0x20;
}
- if (gSaveContext.playerForm == 2) {
+ if (gSaveContext.playerForm == PLAYER_FORM_ZORA) {
gSaveContext.weekEventReg[56] |= 0x40;
}
- if (gSaveContext.playerForm == 1) {
+ if (gSaveContext.playerForm == PLAYER_FORM_GORON) {
gSaveContext.weekEventReg[56] |= 0x80;
}
return 1;
@@ -622,7 +622,7 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) {
if (DECR(this->unk2B1) == 0) {
if (!func_801A2DE0(0x54)) {
- actor = (Actor*)PLAYER; // Needed for regalloc, possible FAKE MATCH
+ actor = (Actor*)GET_PLAYER(globalCtx); // Needed for regalloc, possible FAKE MATCH
actor = actor->next;
while (actor != NULL) {
Actor_MarkForDeath(actor);
@@ -651,8 +651,8 @@ s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx) {
Player* player;
if (func_80BA40D4(this, globalCtx)) {
- player = PLAYER;
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060028B8, -4.0f);
+ player = GET_PLAYER(globalCtx);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_060028B8, -4.0f);
if (player->transformation == PLAYER_FORM_ZORA) {
if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) {
Actor_SetSwitchFlag(globalCtx, this->actor.params & 0x7F);
@@ -695,9 +695,9 @@ void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) {
this->unk2B5 = action->unk0;
if (this->unk2B5 != 4) {
if (this->unk2B5 == 3) {
- SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001DF0, -4.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &D_06001DF0, -4.0f);
} else {
- SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, this->unk2B5 == 1 ? &D_060016A4 : &D_060022C8);
+ Animation_PlayOnce(&this->skelAnime, this->unk2B5 == 1 ? &D_060016A4 : &D_060022C8);
if (this->unk2B5 == 2 && this->unk2B3 != 0xF) {
func_80151BB4(globalCtx, 9);
func_80151BB4(globalCtx, 10);
@@ -706,9 +706,9 @@ void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) {
}
}
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x320);
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk2B5 != 3) {
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, this->unk2B5 == 1 ? &D_0600C880 : &D_06001324);
+ Animation_PlayLoop(&this->skelAnime, this->unk2B5 == 1 ? &D_0600C880 : &D_06001324);
}
}
if (this->unk2B5 == 4 && !Actor_HasParent(&this->actor, globalCtx)) {
@@ -743,8 +743,8 @@ void EnToto_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp4C[this->unk260]));
Scene_SetRenderModeXlu(globalCtx, 0, 1);
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL,
- NULL, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, NULL, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h
index 01f036880..aa9628426 100644
--- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h
+++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h
@@ -24,8 +24,8 @@ typedef struct EnTotoUnkStruct2 {
typedef struct EnToto {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
- /* 0x188 */ Vec3s limbDrawTbl[18];
- /* 0x1F4 */ Vec3s transitionDrawTbl[18];
+ /* 0x188 */ Vec3s jointTable[18];
+ /* 0x1F4 */ Vec3s morphTable[18];
/* 0x260 */ s16 unk260;
/* 0x264 */ ColliderCylinder collider;
/* 0x2B0 */ u8 actionFuncIndex;
diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
index dde048caf..0291851a1 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
@@ -112,12 +112,12 @@ void EnTrt_ChangeAnim(SkelAnime* skelAnime, ActorAnimationEntryS* animations, s3
animations += idx;
if (animations->frameCount < 0) {
- frameCount = SkelAnime_GetFrameCount(&animations->animationSeg->common);
+ frameCount = Animation_GetLastFrame(animations->animationSeg);
} else {
frameCount = animations->frameCount;
}
- SkelAnime_ChangeAnim(skelAnime, animations->animationSeg, animations->playbackSpeed, animations->frame, frameCount,
- animations->mode, animations->transitionRate);
+ Animation_Change(skelAnime, animations->animationSeg, animations->playbackSpeed, animations->frame, frameCount,
+ animations->mode, animations->transitionRate);
}
s32 EnTrt_TestItemSelected(GlobalContext* globalCtx) {
@@ -207,7 +207,7 @@ u16 EnTrt_GetItemChoiceTextId(EnTrt* this) {
}
void EnTrt_EndInteraction(GlobalContext* globalCtx, EnTrt* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) {
ActorCutscene_Stop(this->cutscene);
@@ -332,7 +332,7 @@ void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx) {
void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->tmpGetMushroomCutscene = this->getMushroomCutscene;
if (this->cutsceneState != ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
@@ -346,7 +346,7 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) {
this->textId = 0x884;
func_801518B0(globalCtx, this->textId, &this->actor);
gSaveContext.weekEventReg[0x35] |= 8;
- func_80123D50(globalCtx, PLAYER, 18, 21);
+ func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21);
break;
case 0x888:
this->textId = 0x889;
@@ -372,7 +372,7 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) {
void EnTrt_PayForMushroom(EnTrt* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL;
- func_80123D50(globalCtx, PLAYER, 18, 21);
+ func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21);
this->actionFunc = EnTrt_SetupItemGiven;
} else {
func_800B8A1C(&this->actor, globalCtx, GI_RUPEE_RED, 300.0f, 300.0f);
@@ -439,7 +439,7 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL;
@@ -644,7 +644,7 @@ void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnTrt* this) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
globalCtx->msgCtx.unk11F22 = 0x43;
@@ -749,7 +749,7 @@ void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((gSaveContext.weekEventReg[0x55] & 8) && !(gSaveContext.weekEventReg[0x54] & 0x40)) {
this->textId = 0x88F;
@@ -806,7 +806,7 @@ void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
this->flags &= ~ENTRT_FULLY_AWAKE;
if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_FIERCE_DEITY) {
@@ -851,8 +851,8 @@ void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) {
- s16 animCurrentFrame = this->skelAnime.animCurrentFrame / this->skelAnime.animPlaybackSpeed;
- s16 animLastFrame = SkelAnime_GetFrameCount(&D_060030EC.common) / (s16)this->skelAnime.animPlaybackSpeed;
+ s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&D_060030EC) / (s16)this->skelAnime.playSpeed;
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -863,7 +863,7 @@ void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) {
}
} else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
if (this->animationIdx != 5) {
- if (animCurrentFrame == animLastFrame) {
+ if (curFrame == animLastFrame) {
EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 3);
this->animationIdx = 3;
this->blinkFunc = EnTrt_OpenEyesThenSetToBlink;
@@ -983,7 +983,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -1032,7 +1032,7 @@ void EnTrt_SetupEndInteraction(EnTrt* this, GlobalContext* globalCtx) {
void EnTrt_ShopkeeperGone(EnTrt* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
func_801518B0(globalCtx, this->textId, &this->actor);
@@ -1099,7 +1099,7 @@ void EnTrt_SetupItemGiven(EnTrt* this, GlobalContext* globalCtx) {
void EnTrt_ContinueShopping(EnTrt* this, GlobalContext* globalCtx) {
u8 talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
EnGirlA* item;
if (talkState == 4) {
@@ -1341,11 +1341,11 @@ void EnTrt_NodOff(EnTrt* this) {
}
void EnTrt_OpenThenCloseEyes(EnTrt* this) {
- if (this->skelAnime.animCurrentFrame >= 40.0f) {
+ if (this->skelAnime.curFrame >= 40.0f) {
EnTrt_CloseEyes(this);
- } else if (this->skelAnime.animCurrentFrame >= 35.0f) {
+ } else if (this->skelAnime.curFrame >= 35.0f) {
this->eyeTextureIdx = 1;
- } else if (this->skelAnime.animCurrentFrame >= 10.0f) {
+ } else if (this->skelAnime.curFrame >= 10.0f) {
EnTrt_OpenEyes(this);
}
}
@@ -1359,7 +1359,7 @@ void EnTrt_OpenEyes2(EnTrt* this) {
}
void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) {
- if (this->skelAnime.animCurrentFrame >= 7.0f) {
+ if (this->skelAnime.curFrame >= 7.0f) {
EnTrt_OpenEyes(this);
if (this->eyeTextureIdx == 0) {
this->blinkFunc = EnTrt_Blink;
@@ -1369,7 +1369,7 @@ void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) {
void EnTrt_TalkToShopkeeper(EnTrt* this, GlobalContext* globalCtx) {
u8 talkState = talkState = func_80152498(&globalCtx->msgCtx);
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 itemGiven;
if (talkState == 5) {
@@ -1452,7 +1452,7 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, GlobalContext* globalCtx) {
}
void EnTrt_InitShopkeeper(EnTrt* this, GlobalContext* globalCtx) {
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600FEF0, &D_0600FD34, NULL, NULL, 0);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600FEF0, &D_0600FD34, NULL, NULL, 0);
if (!(gSaveContext.weekEventReg[0xC] & 8) && !(gSaveContext.weekEventReg[0x54] & 0x40) && gSaveContext.day >= 2) {
this->actor.draw = NULL;
} else {
@@ -1691,12 +1691,12 @@ void EnTrt_Update(Actor* thisx, GlobalContext* globalCtx) {
EnTrt_UpdateHeadYawAndPitch(this, globalCtx);
this->actionFunc(this, globalCtx);
Actor_SetHeight(&this->actor, 90.0f);
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
EnTrt_UpdateCollider(this, globalCtx);
}
void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
Vec3f playerPos;
Vec3f pos;
@@ -1716,8 +1716,8 @@ void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 i
Vec3s newRot;
MtxF currentState;
- SysMatrix_MultiplyVector3fByState(&D_801D15B0tmp, &newPos);
- SysMatrix_CopyCurrentState(¤tState);
+ Matrix_MultiplyVector3fByState(&D_801D15B0tmp, &newPos);
+ Matrix_CopyCurrentState(¤tState);
func_8018219C(¤tState, &newRot, MTXMODE_NEW);
*pos = newPos;
if (isFullyAwake) {
@@ -1759,11 +1759,11 @@ void EnTrt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
}
if (limbIndex == 21) {
EnTrt_UpdateHeadPosAndRot(this->headPitch, this->headYaw, &this->headPos, &this->headRot, isFullyAwake);
- SysMatrix_InsertTranslation(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateY(this->headRot.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->headRot.x, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->headRot.z, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRot.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->headRot.z, MTXMODE_APPLY);
}
}
@@ -1771,11 +1771,11 @@ void EnTrt_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnTrt* this = THIS;
if (limbIndex == 21) {
- SysMatrix_InsertTranslation(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateY(this->headRot.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->headRot.x, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->headRot.z, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->headRot.x, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->headRot.z, MTXMODE_APPLY);
}
}
@@ -1789,7 +1789,7 @@ void EnTrt_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
+ func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnTrt_OverrideLimbDraw, EnTrt_PostLimbDraw, EnTrt_UnkActorDraw, &this->actor);
EnTrt_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnTrt_DrawStickDirectionPrompt(globalCtx, this);
diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c
index df8a039e7..06ef6ef3f 100644
--- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c
+++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c
@@ -163,8 +163,8 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx)
}
void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
- Player* player2 = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
+ Player* player2 = GET_PLAYER(globalCtx);
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) {
EnTuboTrap_SpawnEffectsInWater(this, globalCtx);
@@ -219,7 +219,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) {
static s8 sTransformationHeight[] = {
40, 40, 40, 25, 28,
};
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 currentHeight;
f32 transformationHeight;
s16 startingRotation;
diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c
index 56b4e1143..8dd30eec2 100644
--- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c
+++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c
@@ -82,7 +82,7 @@ void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) {
this->actor.textId = 0;
Matrix_RotateY(this->actor.shape.rot.y, 0);
- SysMatrix_MultiplyVector3fByState(&D_80A664FC, &sp24);
+ Matrix_MultiplyVector3fByState(&D_80A664FC, &sp24);
Math_Vec3f_Sum(&this->actor.world.pos, &sp24, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.shape.rot);
this->actionFunc = func_80A66278;
@@ -95,7 +95,7 @@ void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) {
s16 phi_v1;
do {
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (func_800B84D0(&this->actor, globalCtx)) {
func_80A66384(this, globalCtx);
} else {
diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
index 4db53de3c..401bf50b2 100644
--- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
+++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
@@ -110,7 +110,7 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) {
// called WeatherTag_CheckEnableWeatherEffect in OOT, that's where "weatherMode" came from
u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24,
u8 weatherMode) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 returnVal = 0;
if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) {
@@ -140,7 +140,7 @@ u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_
// called WeatherTag_CheckRestoreWeather in OOT
u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20,
u16 new24) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 returnVal = 0;
if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) {
@@ -166,7 +166,7 @@ u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_
// modify wind?
void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
f32 distance;
f32 partialResult;
@@ -410,13 +410,14 @@ void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx)
// WEATHERTAG_TYPE_WATERMURK: (pinnacle rock, zora cape, zora coast)
void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 pad;
f32 distance;
f32 range;
f32 strength = 0.0f;
- func_800BCCDC(this->pathPoints, this->pathCount, &PLAYER->actor.world.pos, &this->actor.world.pos, 0);
+ func_800BCCDC(this->pathPoints, this->pathCount, &GET_PLAYER(globalCtx)->actor.world.pos, &this->actor.world.pos,
+ 0);
distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor);
range = WEATHER_TAG_RANGE100(this);
@@ -441,7 +442,7 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) {
// WEATHERTAG_TYPE_LOCALDAY2RAIN: rain proximity as approaching rainy scene
// (milk road day 2 approaching ranch it rains, walking away towards termfield no rain)
void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) {
if (CURRENT_DAY == 2) {
@@ -465,7 +466,8 @@ void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) {
// WEATHERTAG_TYPE_LOCALDAY2RAIN 2
void func_80967608(EnWeatherTag* this, GlobalContext* globalCtx) {
- if ((WEATHER_TAG_RANGE100(this) + 10.0f) < Actor_XZDistanceBetweenActors(&PLAYER->actor, &this->actor)) {
+ if ((WEATHER_TAG_RANGE100(this) + 10.0f) <
+ Actor_XZDistanceBetweenActors(&GET_PLAYER(globalCtx)->actor, &this->actor)) {
D_801BDBB0 = 0;
EnWeatherTag_SetupAction(this, func_809674C8);
}
diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
index b49ccaef1..c1f0b3351 100644
--- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c
+++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
@@ -100,8 +100,8 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) {
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 20.0f);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = func_80B97100;
- SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600D208, &D_06004248, this->jointTable, this->morphTable, 20);
- SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_0600DE20);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600D208, &D_06004248, this->jointTable, this->morphTable, 20);
+ Animation_PlayLoop(&this->skelAnime, &D_0600DE20);
this->unk_2F0 = 0;
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@@ -255,10 +255,10 @@ void func_80B96BEC(EnZot* this, s16 arg1, u8 arg2) {
if ((arg1 >= 0) && (arg1 < 10)) {
if (arg1 >= 8) {
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[arg1], 0.0f, arg1 - 8, arg1 - 8, arg2, 0.0f);
+ Animation_Change(&this->skelAnime, sAnimations[arg1], 0.0f, arg1 - 8, arg1 - 8, arg2, 0.0f);
} else {
- SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&sAnimations[arg1]->common), arg2, -5.0f);
+ Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[arg1]),
+ arg2, -5.0f);
}
this->unk_2F0 = arg1;
}
@@ -552,7 +552,7 @@ void func_80B9765C(EnZot* this, GlobalContext* globalCtx) {
}
void func_80B97708(EnZot* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s32 phi_v1;
func_80B96D4C(this);
@@ -754,7 +754,7 @@ void func_80B97D6C(EnZot* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 8.0f;
}
- if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 5.0f)) {
+ if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_ZORA_WALK);
}
}
@@ -961,7 +961,7 @@ void func_80B9854C(EnZot* this, GlobalContext* globalCtx) {
void func_80B985EC(EnZot* this, GlobalContext* globalCtx) {
s32 temp_v0;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
func_80B98348(this, globalCtx);
if (func_80152498(&globalCtx->msgCtx) == 0x10) {
@@ -1329,7 +1329,7 @@ void EnZot_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 30.0f, 5);
this->unk_2F2 &= ~0x40;
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->unk_2F0 != 0)) {
+ if (SkelAnime_Update(&this->skelAnime) && (this->unk_2F0 != 0)) {
this->unk_2F2 |= 0x40;
}
@@ -1368,15 +1368,15 @@ s32 EnZot_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
s32 pad;
if (limbIndex == 15) {
- SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(this->unk_2C4.y, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_2C4.x, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_2C4.y, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_2C4.x, MTXMODE_APPLY);
+ Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
- SysMatrix_InsertXRotation_s(this->unk_2CA.y * -1, MTXMODE_APPLY);
- SysMatrix_InsertZRotation_s(this->unk_2CA.x * -1, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(this->unk_2CA.y * -1, MTXMODE_APPLY);
+ Matrix_InsertZRotation_s(this->unk_2CA.x * -1, MTXMODE_APPLY);
}
if (((this->unk_2F0 == 8) || (this->unk_2F0 == 9)) &&
@@ -1392,7 +1392,7 @@ void EnZot_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
EnZot* this = THIS;
if (limbIndex == 15) {
- SysMatrix_MultiplyVector3fByState(&D_80B99934, &this->actor.focus.pos);
+ Matrix_MultiplyVector3fByState(&D_80B99934, &this->actor.focus.pos);
}
}
@@ -1412,8 +1412,8 @@ void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp4C[this->unk_2EC]));
gSPSegment(POLY_OPA_DISP++, 0x0C, func_80B99580(globalCtx->state.gfxCtx));
- SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
- EnZot_OverrideLimbDraw, EnZot_PostLimbDraw, &this->actor);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ EnZot_OverrideLimbDraw, EnZot_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c
index 5c0aa5cb1..2111f1d0f 100644
--- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c
+++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c
@@ -285,9 +285,9 @@ void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (actionFuncTemp) {
s16 rotation = Math_SinS(this->unk_198) * 8000.0f;
- SysMatrix_InsertZRotation_s(rotation, 1);
+ Matrix_InsertZRotation_s(rotation, 1);
Matrix_Scale(1.3f, 1.0f, 1.0f, 1);
- SysMatrix_InsertZRotation_s(rotation * -1, 1);
+ Matrix_InsertZRotation_s(rotation * -1, 1);
Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, 1);
}
Matrix_RotateY(yaw, 1);
diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
index a0d90123f..de7f30fbd 100644
--- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
+++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c
@@ -223,13 +223,13 @@ void func_80A358FC(ObjBell* this, GlobalContext* globalCtx) {
}
void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) {
- SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, 2600.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, 2600.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateY(thisx->world.rot.y, MTXMODE_APPLY);
- SysMatrix_InsertXRotation_s(thisx->world.rot.x, MTXMODE_APPLY);
+ Matrix_InsertXRotation_s(thisx->world.rot.x, MTXMODE_APPLY);
Matrix_RotateY(-thisx->world.rot.y, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, -2600.0f, 0.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, -2600.0f, 0.0f, MTXMODE_APPLY);
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -241,7 +241,7 @@ void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80A35B18(Actor* thisx, GlobalContext* globalCtx) {
- SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
Matrix_RotateY(thisx->shape.rot.y, MTXMODE_APPLY);
OPEN_DISPS(globalCtx->state.gfxCtx);
@@ -252,7 +252,7 @@ void func_80A35B18(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80A35BD4(Actor* thisx, GlobalContext* globalCtx) {
- SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y - 4.0f, thisx->world.pos.z, MTXMODE_NEW);
+ Matrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y - 4.0f, thisx->world.pos.z, MTXMODE_NEW);
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
@@ -300,9 +300,9 @@ void ObjBell_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80A35BD4(thisx, globalCtx);
func_80A359B4(thisx, globalCtx);
Math_Vec3s_ToVec3f(&sp30, &this->collider1.dim.modelSphere.center);
- SysMatrix_MultiplyVector3fByState(&sp30, &sp24);
+ Matrix_MultiplyVector3fByState(&sp30, &sp24);
Math_Vec3f_ToVec3s(&this->collider1.dim.worldSphere.center, &sp24);
Math_Vec3s_ToVec3f(&sp30, &this->collider2.dim.modelSphere.center);
- SysMatrix_MultiplyVector3fByState(&sp30, &sp24);
+ Matrix_MultiplyVector3fByState(&sp30, &sp24);
Math_Vec3f_ToVec3s(&this->collider2.dim.worldSphere.center, &sp24);
}
diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c
index 0fba2130c..0d5a2c1b9 100644
--- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c
+++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c
@@ -104,7 +104,7 @@ Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* nu
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
*num = 0;
- return &PLAYER->actor;
+ return &GET_PLAYER(globalCtx)->actor;
}
if (this->collider.base.ocFlags1 & OC2_UNK1) {
diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c
index b5272432e..f252efbd5 100644
--- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c
+++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c
@@ -120,20 +120,18 @@ void ObjEtcetera_DoNormalOscillation(ObjEtcetera* this, GlobalContext* globalCtx
}
void ObjEtcetera_StartSmallFlutterAnimation(ObjEtcetera* this) {
- SkelAnime_ChangeAnim(&this->skelAnime, &D_040117A8, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_040117A8.common), 2,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_040117A8, 1.0f, 0.0f, Animation_GetLastFrame(&D_040117A8), 2, 0.0f);
this->dyna.actor.draw = ObjEtcetera_DrawAnimated;
this->actionFunc = ObjEtcetera_PlaySmallFlutterAnimation;
}
void ObjEtcetera_Idle(ObjEtcetera* this, GlobalContext* globalCtx) {
s16 minOscillationTimer;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((player->stateFlags3 & 0x200) && (this->dyna.actor.xzDistToPlayer < 20.0f)) {
// Player is launching out of the Deku Flower
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0400EB7C, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_0400EB7C.common), 2,
- 0.0f);
+ Animation_Change(&this->skelAnime, &D_0400EB7C, 1.0f, 0.0f, Animation_GetLastFrame(&D_0400EB7C), 2, 0.0f);
this->dyna.actor.draw = ObjEtcetera_DrawAnimated;
this->actionFunc = ObjEtcetera_DoIntenseOscillation;
Actor_SetScale(&this->dyna.actor, 0.01f);
@@ -182,7 +180,7 @@ void ObjEtcetera_PlaySmallFlutterAnimation(ObjEtcetera* this, GlobalContext* glo
} else {
this->burrowFlag &= ~1;
}
- if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
+ if (SkelAnime_Update(&this->skelAnime)) {
this->dyna.actor.draw = ObjEtcetera_DrawIdle;
this->actionFunc = ObjEtcetera_Idle;
}
@@ -201,7 +199,7 @@ void ObjEtcetera_DoIntenseOscillation(ObjEtcetera* this, GlobalContext* globalCt
} else {
this->burrowFlag &= ~1;
}
- SkelAnime_FrameUpdateMatrix(&this->skelAnime);
+ SkelAnime_Update(&this->skelAnime);
if (this->oscillationTimer > 0) {
this->oscillationTimer--;
} else {
@@ -272,8 +270,8 @@ void ObjEtcetera_Setup(ObjEtcetera* this, GlobalContext* globalCtx) {
break;
case DEKU_FLOWER_TYPE_PINK_SPAWNED_FROM_MAD_SCRUB:
case DEKU_FLOWER_TYPE_GOLD_SPAWNED_FROM_MAD_SCRUB:
- SkelAnime_ChangeAnim(&this->skelAnime, &D_0400EB7C, 1.0f, 0.0f,
- SkelAnime_GetFrameCount(&D_0400EB7C.common), 2, 0.0f);
+ Animation_Change(&this->skelAnime, &D_0400EB7C, 1.0f, 0.0f, Animation_GetLastFrame(&D_0400EB7C), 2,
+ 0.0f);
this->dyna.actor.draw = ObjEtcetera_DrawAnimated;
this->actionFunc = ObjEtcetera_DoIntenseOscillation;
Actor_SetScale(&this->dyna.actor, 0.0f);
@@ -317,5 +315,5 @@ void ObjEtcetera_DrawAnimated(Actor* thisx, GlobalContext* globalCtx) {
ObjEtcetera* this = THIS;
func_8012C5B0(globalCtx->state.gfxCtx);
- SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, NULL, NULL, &this->dyna.actor);
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor);
}
diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c
index a1c51e097..04f4635a6 100644
--- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c
+++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c
@@ -30,7 +30,7 @@ void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- Matrix_RotateY((s16)(func_800DFCDC(ACTIVE_CAM) - 0x8000), 1);
+ Matrix_RotateY((s16)(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - 0x8000), 1);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c
index e2a6b9c8b..7a20bab74 100644
--- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c
+++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c
@@ -72,7 +72,7 @@ void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx) {
}
void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
if (func_800B84D0(&this->dyna.actor, globalCtx)) {
@@ -129,7 +129,7 @@ void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx) {
}
void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
u8 stepTemp = Math_StepToS(&this->unk_168, 0x64, 1);
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + this->unk_168;
diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c
index 9d6fc0a54..3fc376dc4 100644
--- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c
+++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c
@@ -120,7 +120,7 @@ void func_80926318(ObjKibako* this, GlobalContext* globalCtx) {
s32 pad;
if (this->actor.xzDistToPlayer < 100.0f) {
- angle = this->actor.yawTowardsPlayer - PLAYER->actor.world.rot.y;
+ angle = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y;
if (ABS_ALT(angle) >= 0x5556) {
func_800B8A1C(&this->actor, globalCtx, 0, 36.0f, 30.0f);
}
diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c
index c6b2daf66..4237e0992 100644
--- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c
+++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c
@@ -89,10 +89,10 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx)
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->elements);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
- SysMatrix_SetStateRotationAndTranslation(
- this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y),
- this->actor.world.pos.z, &this->actor.shape.rot);
- Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);
+ Matrix_SetStateRotationAndTranslation(this->actor.world.pos.x,
+ this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y),
+ this->actor.world.pos.z, &this->actor.shape.rot);
+ Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Collider_UpdateSpheres(0, &this->collider);
}
@@ -384,13 +384,13 @@ void ObjLightSwitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) {
tempRot.x = this->actor.shape.rot.x;
tempRot.y = this->actor.shape.rot.y;
tempRot.z = this->actor.shape.rot.z + this->edgeRot;
- SysMatrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
+ Matrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000398);
tempRot.z = this->actor.shape.rot.z - this->edgeRot;
- SysMatrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
+ Matrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000408);
@@ -420,13 +420,13 @@ void ObjLightSwitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) {
tempRot.x = this->actor.shape.rot.x;
tempRot.y = this->actor.shape.rot.y;
tempRot.z = this->actor.shape.rot.z + this->edgeRot;
- SysMatrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
+ Matrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06000398);
tempRot.z = this->actor.shape.rot.z - this->edgeRot;
- SysMatrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
+ Matrix_SetStateRotationAndTranslation(tempPos.x, tempPos.y, tempPos.z, &tempRot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06000408);
diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c
index 227c2b79c..13379e5f0 100644
--- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c
+++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c
@@ -74,7 +74,7 @@ void func_80C0662C(ObjMoonStone* this) {
}
void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx) {
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
s16 sp1A = this->actor.yawTowardsPlayer - 0x8000;
sp1A -= player->actor.shape.rot.y;
@@ -140,7 +140,7 @@ void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) {
void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjMoonStone* this = THIS;
- Player* player = PLAYER;
+ Player* player = GET_PLAYER(globalCtx);
if ((player->stateFlags1 & 0x10000282) == 0) {
this->actionFunc(this, globalCtx);
@@ -156,7 +156,7 @@ void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx) {
AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_06001C60));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000D78);
- SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC);
+ Matrix_NormalizeXYZ(&globalCtx->mf_187FC);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06000C80);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c
index 67d3200f5..eb9202197 100644
--- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c
+++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c
@@ -234,6 +234,8 @@ void ObjRaillift_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
if (OBJRAILLIFT_SHOULD_REACT_TO_WEIGHT(thisx)) {
+ s32 requiredScopeTemp;
+
this->isWeightOnPrev = this->isWeightOn;
if (func_800CAF70(&this->dyna)) {
this->isWeightOn = true;
@@ -251,7 +253,6 @@ void ObjRaillift_Update(Actor* thisx, GlobalContext* globalCtx) {
target = this->isWeightOn ? -8.0f : 0.0f;
Math_StepToF(&this->cycleSpeed, target, step);
this->dyna.actor.shape.yOffset = ((Math_SinS(this->cycle) * this->maxHeight) + this->cycleSpeed) * 10.0f;
- dummy:;
}
if (OBJRAILLIFT_GET_TYPE(thisx) == DEKU_FLOWER_PLATFORM && this->dyna.actor.child != NULL) {
if (this->dyna.actor.child->update == NULL) {
diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
index 997270a6b..fb7074693 100644
--- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
+++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
@@ -169,7 +169,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) {
} else {
s32 interaction = OBJ_SYOKUDAI_INTERACTION_NONE;
u32 flameColliderHurtboxDmgFlags = 0;
- player = PLAYER;
+ player = GET_PLAYER(globalCtx);
if (OBJ_SYOKUDAI_GET_START_LIT(thisx)) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
@@ -310,8 +310,8 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) {
(this->flameTexScroll * -OBJ_SYOKUDAI_SNUFF_DEFAULT) & 0x1FF, 0x20, 0x80));
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
- SysMatrix_InsertTranslation(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY);
- Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM) - thisx->shape.rot.y), MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y), MTXMODE_APPLY);
Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0407D590);
diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c
index 7df2a0ecb..22bcddc57 100644
--- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c
+++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c
@@ -56,7 +56,7 @@ extern CollisionHeader D_06000968;
void ObjTokeiStep_SetSysMatrix(ObjTokeiStepPanel* panel) {
MtxF* sysMatrix;
- sysMatrix = SysMatrix_GetCurrentState();
+ sysMatrix = Matrix_GetCurrentState();
sysMatrix->wx = panel->pos.x;
sysMatrix->wy = panel->pos.y;
sysMatrix->wz = panel->pos.z;
@@ -66,7 +66,7 @@ void ObjTokeiStep_AddQuake(ObjTokeiStep* this, GlobalContext* globalCtx) {
s32 pad[2];
s16 quake;
- quake = Quake_Add(ACTIVE_CAM, 3);
+ quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3);
Quake_SetSpeed(quake, 0x4E20);
Quake_SetQuakeValues(quake, 1, 0, 0, 0);
Quake_SetCountdown(quake, 7);
@@ -85,7 +85,7 @@ void ObjTokeiStep_SpawnDust(ObjTokeiStep* this, ObjTokeiStepPanel* panel, Global
dustSpawnOffset.z = -10.0f;
for (i = 0; i < 7; i++) {
dustSpawnOffset.x = dustSpawnXOffsets[i];
- SysMatrix_MultiplyVector3fByState(&dustSpawnOffset, &dustSpawnPos);
+ Matrix_MultiplyVector3fByState(&dustSpawnOffset, &dustSpawnPos);
dustSpawnPos.x += panel->pos.x;
dustSpawnPos.y += panel->pos.y;
dustSpawnPos.z += panel->pos.z;
@@ -100,15 +100,15 @@ void ObjTokeiStep_InitSteps(ObjTokeiStep* this) {
Vec3f panelOffset;
s32 pad;
- SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
- this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
+ Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
panelOffset.x = 0.0f;
panelOffset.y = 0.0f;
for (i = 0; i < 7; i++) {
panel = &this->panels[i];
panelOffset.z = i * -20.0f;
- SysMatrix_MultiplyVector3fByState(&panelOffset, &panel->pos);
+ Matrix_MultiplyVector3fByState(&panelOffset, &panel->pos);
panel->posChangeY = 0.0f;
panel->numBounces = 0;
}
@@ -119,15 +119,15 @@ void ObjTokeiStep_InitStepsOpen(ObjTokeiStep* this) {
ObjTokeiStepPanel* panel;
Vec3f panelOffset;
- SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
- this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
+ Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
panelOffset.x = 0.0f;
for (i = 0; i < 7; i++) {
panel = &this->panels[i];
panelOffset.y = panelXOffsets[i];
panelOffset.z = i * -20.0f;
- SysMatrix_MultiplyVector3fByState(&panelOffset, &panel->pos);
+ Matrix_MultiplyVector3fByState(&panelOffset, &panel->pos);
}
}
diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c
index 8d9511df8..496259853 100644
--- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c
+++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c
@@ -170,21 +170,21 @@ void ObjWarpstone_Draw(Actor* thisx, GlobalContext* globalCtx2) {
if (this->dyna.actor.home.rot.x != 0) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
- SysMatrix_InsertTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 34.0f,
- this->dyna.actor.world.pos.z, MTXMODE_NEW);
- SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
- SysMatrix_InsertTranslation(0.0f, 0.0f, 30.0f, MTXMODE_APPLY);
+ Matrix_InsertTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 34.0f,
+ this->dyna.actor.world.pos.z, MTXMODE_NEW);
+ Matrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
+ Matrix_InsertTranslation(0.0f, 0.0f, 30.0f, MTXMODE_APPLY);
Matrix_Scale(this->dyna.actor.velocity.x, this->dyna.actor.velocity.x, this->dyna.actor.velocity.x,
MTXMODE_APPLY);
- SysMatrix_StatePush();
+ Matrix_StatePush();
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, this->dyna.actor.home.rot.x);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255);
- SysMatrix_InsertZRotation_f((((globalCtx->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
+ Matrix_InsertZRotation_f((((globalCtx->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_04023210);
- SysMatrix_StatePop();
- SysMatrix_InsertZRotation_f((~((globalCtx->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
+ Matrix_StatePop();
+ Matrix_InsertZRotation_f((~((globalCtx->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_04023210);
CLOSE_DISPS(globalCtx->state.gfxCtx);
diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h
index 1d199eee6..09298249d 100644
--- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h
+++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h
@@ -11,8 +11,8 @@ typedef struct {
/* 0x26 */ s16 scaleStep;
/* 0x28 */ s16 alpha;
/* 0x2A */ s16 fadeDelay;
- /* 0x2C */ s16 life;
- /* 0x30 */ s32 unk_30;
+ /* 0x2C */ s16 unk_2C;
+ /* 0x30 */ s32 life;
} EffectSsDFireInitParams; // size = 0x34
extern const EffectSsInit Effect_Ss_D_Fire_InitVars;
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
index ba34c2448..9069a6aca 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
@@ -205,7 +205,7 @@ void Daytelop_Main(GameState* thisx) {
}
void Daytelop_Destroy(GameState* thisx) {
- ShrinkWindow_Fini();
+ ShrinkWindow_Destroy();
}
void Daytelop_nop80815770(DaytelopContext* this) {
@@ -226,8 +226,8 @@ void Daytelop_Init(GameState* thisx) {
DaytelopContext* this = (DaytelopContext*)thisx;
Game_SetFramerateDivisor(thisx, 1);
- SysMatrix_StateAlloc(thisx);
- ShrinkWindow_Fini();
+ Matrix_StateAlloc(thisx);
+ ShrinkWindow_Destroy();
View_Init(&this->view, thisx->gfxCtx);
thisx->main = Daytelop_Main;
thisx->destroy = Daytelop_Destroy;
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
index bae203c68..d2e71587d 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
@@ -8,6 +8,7 @@ void FileChoose_Destroy(GameState* thisx);
typedef struct {
/* 0x00000 */ GameState state;
+ /* 0x000A4 */ Vtx* unk_A4;
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
/* 0x000B0 */ u8* titleSegment;
@@ -16,6 +17,7 @@ typedef struct {
/* 0x00248 */ SkyboxContext skyboxCtx;
/* 0x00470 */ MessageContext msgCtx;
/* 0x12550 */ Font font;
+ /* 0x242DC */ UNK_TYPE1 unk_242DC[4];
/* 0x242E0 */ EnvironmentContext envCtx;
/* 0x243E0 */ Vtx* unk_243E0;
/* 0x243E4 */ Vtx* unk_243E4;
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c
index b19955071..96fe615fc 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.c
+++ b/src/overlays/gamestates/ovl_opening/z_opening.c
@@ -43,14 +43,14 @@ void Opening_Main(GameState* thisx) {
}
void Opening_Destroy(GameState* thisx) {
- ShrinkWindow_Fini();
+ ShrinkWindow_Destroy();
}
void Opening_Init(GameState* thisx) {
OpeningContext* this = (OpeningContext*)thisx;
Game_SetFramerateDivisor(&this->gameState, 1);
- SysMatrix_StateAlloc(&this->gameState);
+ Matrix_StateAlloc(&this->gameState);
ShrinkWindow_Init();
View_Init(&this->view, this->gameState.gfxCtx);
this->gameState.main = Opening_Main;
diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c
index da6808725..d58f7ac85 100644
--- a/src/overlays/gamestates/ovl_select/z_select.c
+++ b/src/overlays/gamestates/ovl_select/z_select.c
@@ -887,7 +887,7 @@ void Select_Main(GameState* thisx) {
}
void Select_Destroy(GameState* thisx) {
- ShrinkWindow_Fini();
+ ShrinkWindow_Destroy();
}
void Select_Init(GameState* thisx) {
diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c
index 83e3f487a..ed732fc3d 100644
--- a/src/overlays/gamestates/ovl_title/z_title.c
+++ b/src/overlays/gamestates/ovl_title/z_title.c
@@ -80,9 +80,9 @@ void Title_Draw(GameState* thisx) {
Title_RenderView(this, 0.0f, 150.0f, 300.0f);
func_8012C28C(this->gameState.gfxCtx);
- SysMatrix_InsertTranslation(-53.0f, -5.0f, 0.0f, MTXMODE_NEW);
+ Matrix_InsertTranslation(-53.0f, -5.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- SysMatrix_InsertRotation(0, titleRotation, 0, MTXMODE_APPLY);
+ Matrix_InsertRotation(0, titleRotation, 0, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(this->gameState.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoNDL);
@@ -145,7 +145,7 @@ void Title_Destroy(GameState* thisx) {
TitleContext* this = (TitleContext*)thisx;
func_80146E40(&this->gameState, &this->sramCtx);
- ShrinkWindow_Fini();
+ ShrinkWindow_Destroy();
CIC6105_Nop80081828();
}
@@ -158,7 +158,7 @@ void Title_Init(GameState* thisx) {
DmaMgr_SendRequest0(this->staticSegment, (uintptr_t)_nintendo_rogo_staticSegmentRomStart, segmentSize);
Game_SetFramerateDivisor(thisx, 1);
- SysMatrix_StateAlloc(thisx);
+ Matrix_StateAlloc(thisx);
ShrinkWindow_Init();
View_Init(&this->view, thisx->gfxCtx);
diff --git a/tools/ZAPD/.gitignore b/tools/ZAPD/.gitignore
index 00ec03b0f..68c502e36 100644
--- a/tools/ZAPD/.gitignore
+++ b/tools/ZAPD/.gitignore
@@ -338,3 +338,4 @@ ZAPDUtils/ZAPDUtils.a
.vscode/
build/
ZAPDUtils/build/
+ZAPD/BuildInfo.h
diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo
index 7201aacd3..94da913d0 100644
--- a/tools/ZAPD/.gitrepo
+++ b/tools/ZAPD/.gitrepo
@@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/zeldaret/ZAPD.git
branch = master
- commit = 623d779f8ea111cb8cbb78a218c8454e819c4c13
- parent = 9f2368dd710e740ced0f8086de91228b87f41512
+ commit = 4f7b8393ec8a3abd59649c2ba669e951fb61f3d2
+ parent = 346df1bbc8ca21673fe63d884b6734c23a4d9f4b
method = merge
cmdver = 0.4.3
diff --git a/tools/ZAPD/ExporterTest/CollisionExporter.cpp b/tools/ZAPD/ExporterTest/CollisionExporter.cpp
index 81a9b5464..e00f5c1b0 100644
--- a/tools/ZAPD/ExporterTest/CollisionExporter.cpp
+++ b/tools/ZAPD/ExporterTest/CollisionExporter.cpp
@@ -1,6 +1,7 @@
#include "CollisionExporter.h"
-void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]]fs::path outPath, BinaryWriter* writer)
+void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]] fs::path outPath,
+ BinaryWriter* writer)
{
ZCollisionHeader* col = (ZCollisionHeader*)res;
@@ -35,9 +36,10 @@ void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]]fs::path ou
for (uint16_t i = 0; i < col->vertices.size(); i++)
{
- writer->Write(col->vertices[i].x);
- writer->Write(col->vertices[i].y);
- writer->Write(col->vertices[i].z);
+ for (uint32_t j = 0; j < col->vertices[i].dimensions; j++)
+ {
+ writer->Write(col->vertices[i].scalars[j].scalarData.s16);
+ }
}
writer->Seek(col->polySegmentOffset, SeekOffsetType::Start);
diff --git a/tools/ZAPD/ExporterTest/CollisionExporter.h b/tools/ZAPD/ExporterTest/CollisionExporter.h
index 2828995d0..5f48e6557 100644
--- a/tools/ZAPD/ExporterTest/CollisionExporter.h
+++ b/tools/ZAPD/ExporterTest/CollisionExporter.h
@@ -1,7 +1,7 @@
#pragma once
-#include "ZResource.h"
#include "ZCollision.h"
+#include "ZResource.h"
class ExporterExample_Collision : public ZResourceExporter
{
diff --git a/tools/ZAPD/ExporterTest/Main.cpp b/tools/ZAPD/ExporterTest/Main.cpp
index 1fb6bea77..4f683a1ba 100644
--- a/tools/ZAPD/ExporterTest/Main.cpp
+++ b/tools/ZAPD/ExporterTest/Main.cpp
@@ -1,7 +1,7 @@
-#include
-#include
#include
#include
+#include
+#include
enum class ExporterFileMode
{
@@ -10,7 +10,7 @@ enum class ExporterFileMode
ModeExample3 = (int)ZFileMode::Custom + 3,
};
-static void ExporterParseFileMode(std::string buildMode, ZFileMode& fileMode)
+static void ExporterParseFileMode(const std::string& buildMode, ZFileMode& fileMode)
{
if (buildMode == "me1")
fileMode = (ZFileMode)ExporterFileMode::ModeExample1;
@@ -20,17 +20,15 @@ static void ExporterParseFileMode(std::string buildMode, ZFileMode& fileMode)
fileMode = (ZFileMode)ExporterFileMode::ModeExample3;
}
-static void ExporterParseArgs([[maybe_unused]]int argc, char* argv[], int& i)
+static void ExporterParseArgs([[maybe_unused]] int argc, char* argv[], int& i)
{
std::string arg = argv[i];
if (arg == "--do-x")
{
-
}
else if (arg == "--do-y")
{
-
}
}
@@ -61,7 +59,8 @@ static void ExporterFileEnd(ZFile* file)
static void ImportExporters()
{
// In this example we set up a new exporter called "EXAMPLE".
- // By running ZAPD with the argument -se EXAMPLE, we tell it that we want to use this exporter for our resources.
+ // By running ZAPD with the argument -se EXAMPLE, we tell it that we want to use this exporter
+ // for our resources.
ExporterSet* exporterSet = new ExporterSet();
exporterSet->processFileModeFunc = ExporterProcessFileMode;
exporterSet->parseFileModeFunc = ExporterParseFileMode;
@@ -75,5 +74,6 @@ static void ImportExporters()
Globals::AddExporter("EXAMPLE", exporterSet);
}
-// When ZAPD starts up, it will automatically call the below function, which in turn sets up our exporters.
-REGISTER_EXPORTER(ImportExporters)
\ No newline at end of file
+// When ZAPD starts up, it will automatically call the below function, which in turn sets up our
+// exporters.
+REGISTER_EXPORTER(ImportExporters);
diff --git a/tools/ZAPD/ExporterTest/RoomExporter.cpp b/tools/ZAPD/ExporterTest/RoomExporter.cpp
index dc8c82302..c4a6844fb 100644
--- a/tools/ZAPD/ExporterTest/RoomExporter.cpp
+++ b/tools/ZAPD/ExporterTest/RoomExporter.cpp
@@ -1,41 +1,41 @@
#include "RoomExporter.h"
+#include
#include
-#include
#include
-#include
-#include
-#include
-#include
+#include
#include
+#include
+#include
+#include
+#include
+#include
#include
#include
-#include
#include
-#include
-#include
+#include
+#include
+#include
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter* writer)
{
- ZRoom* room = (ZRoom*)res;
+ ZRoom* room = dynamic_cast(res);
- //MemoryStream* memStream = new MemoryStream();
- //BinaryWriter* writer = new BinaryWriter(memStream);
+ // MemoryStream* memStream = new MemoryStream();
+ // BinaryWriter* writer = new BinaryWriter(memStream);
- for (uint i = 0; i < room->commands.size() * 8; i++)
+ for (size_t i = 0; i < room->commands.size() * 8; i++)
writer->Write((uint8_t)0);
- for (uint i = 0; i < room->commands.size(); i++)
+ for (size_t i = 0; i < room->commands.size(); i++)
{
ZRoomCommand* cmd = room->commands[i];
-
+
writer->Seek(i * 8, SeekOffsetType::Start);
-
+
writer->Write((uint8_t)cmd->cmdID);
switch (cmd->cmdID)
@@ -44,115 +44,115 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
{
SetWind* cmdSetWind = (SetWind*)cmd;
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdSetWind->windWest); // 0x04
- writer->Write(cmdSetWind->windVertical); // 0x05
- writer->Write(cmdSetWind->windSouth); // 0x06
- writer->Write(cmdSetWind->clothFlappingStrength); // 0x07
+ writer->Write(cmdSetWind->windWest); // 0x04
+ writer->Write(cmdSetWind->windVertical); // 0x05
+ writer->Write(cmdSetWind->windSouth); // 0x06
+ writer->Write(cmdSetWind->clothFlappingStrength); // 0x07
}
- break;
+ break;
case RoomCommand::SetTimeSettings:
{
SetTimeSettings* cmdTime = (SetTimeSettings*)cmd;
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdTime->hour); // 0x04
- writer->Write(cmdTime->min); // 0x05
- writer->Write(cmdTime->unk); // 0x06
- writer->Write((uint8_t)0); // 0x07
+ writer->Write(cmdTime->hour); // 0x04
+ writer->Write(cmdTime->min); // 0x05
+ writer->Write(cmdTime->unk); // 0x06
+ writer->Write((uint8_t)0); // 0x07
}
break;
case RoomCommand::SetSkyboxModifier:
{
SetSkyboxModifier* cmdSkybox = (SetSkyboxModifier*)cmd;
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdSkybox->disableSky); // 0x04
- writer->Write(cmdSkybox->disableSunMoon); // 0x05
- writer->Write((uint8_t)0); // 0x06
- writer->Write((uint8_t)0); // 0x07
+ writer->Write(cmdSkybox->disableSky); // 0x04
+ writer->Write(cmdSkybox->disableSunMoon); // 0x05
+ writer->Write((uint8_t)0); // 0x06
+ writer->Write((uint8_t)0); // 0x07
}
break;
case RoomCommand::SetEchoSettings:
{
SetEchoSettings* cmdEcho = (SetEchoSettings*)cmd;
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)0); // 0x04
- writer->Write((uint8_t)0); // 0x05
- writer->Write((uint8_t)0); // 0x06
- writer->Write((uint8_t)cmdEcho->echo); // 0x07
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x04
+ writer->Write((uint8_t)0); // 0x05
+ writer->Write((uint8_t)0); // 0x06
+ writer->Write((uint8_t)cmdEcho->echo); // 0x07
}
break;
case RoomCommand::SetSoundSettings:
{
SetSoundSettings* cmdSound = (SetSoundSettings*)cmd;
- writer->Write((uint8_t)cmdSound->reverb); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)0); // 0x04
- writer->Write((uint8_t)0); // 0x05
+ writer->Write((uint8_t)cmdSound->reverb); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x04
+ writer->Write((uint8_t)0); // 0x05
- writer->Write(cmdSound->nightTimeSFX); // 0x06
- writer->Write(cmdSound->musicSequence); // 0x07
+ writer->Write(cmdSound->nightTimeSFX); // 0x06
+ writer->Write(cmdSound->musicSequence); // 0x07
}
break;
case RoomCommand::SetSkyboxSettings:
{
SetSkyboxSettings* cmdSkybox = (SetSkyboxSettings*)cmd;
- writer->Write((uint8_t)cmdSkybox->unk1); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)cmdSkybox->skyboxNumber); // 0x04
- writer->Write((uint8_t)cmdSkybox->cloudsType); // 0x05
- writer->Write((uint8_t)cmdSkybox->isIndoors); // 0x06
+ writer->Write((uint8_t)cmdSkybox->unk1); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)cmdSkybox->skyboxNumber); // 0x04
+ writer->Write((uint8_t)cmdSkybox->cloudsType); // 0x05
+ writer->Write((uint8_t)cmdSkybox->isIndoors); // 0x06
}
break;
case RoomCommand::SetRoomBehavior:
{
SetRoomBehavior* cmdRoom = (SetRoomBehavior*)cmd;
- writer->Write((uint8_t)cmdRoom->gameplayFlags); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdRoom->gameplayFlags2); // 0x04
+ writer->Write((uint8_t)cmdRoom->gameplayFlags); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(cmdRoom->gameplayFlags2); // 0x04
}
break;
case RoomCommand::SetCsCamera:
{
SetCsCamera* cmdCsCam = (SetCsCamera*)cmd;
- writer->Write((uint8_t)cmdCsCam->cameras.size()); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)cmdCsCam->cameras.size()); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdCsCam->segmentOffset); // 0x04
+ writer->Write(cmdCsCam->segmentOffset); // 0x04
}
break;
case RoomCommand::SetMesh:
{
SetMesh* cmdMesh = (SetMesh*)cmd;
-
+
int baseStreamEnd = writer->GetStream().get()->GetLength();
- writer->Write((uint8_t)cmdMesh->data); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)cmdMesh->data); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- writer->Write(baseStreamEnd); // 0x04
+ writer->Write(baseStreamEnd); // 0x04
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
@@ -163,15 +163,13 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
if (cmdMesh->meshHeaderType == 0)
{
- //writer->Write(cmdMesh->)
+ // writer->Write(cmdMesh->)
}
else if (cmdMesh->meshHeaderType == 1)
{
-
}
else if (cmdMesh->meshHeaderType == 2)
{
-
}
writer->Seek(oldOffset, SeekOffsetType::Start);
@@ -181,20 +179,20 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
{
SetCameraSettings* cmdCam = (SetCameraSettings*)cmd;
- writer->Write((uint8_t)cmdCam->cameraMovement); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdCam->mapHighlight); // 0x04
+ writer->Write((uint8_t)cmdCam->cameraMovement); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(cmdCam->mapHighlight); // 0x04
}
break;
case RoomCommand::SetLightingSettings:
{
SetLightingSettings* cmdLight = (SetLightingSettings*)cmd;
- writer->Write((uint8_t)cmdLight->settings.size()); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(cmdLight->segmentOffset); // 0x04
+ writer->Write((uint8_t)cmdLight->settings.size()); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(cmdLight->segmentOffset); // 0x04
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(cmdLight->segmentOffset, SeekOffsetType::Start);
@@ -236,17 +234,17 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
{
SetRoomList* cmdRoom = (SetRoomList*)cmd;
- writer->Write((uint8_t)cmdRoom->rooms.size()); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)cmdRoom->romfile->rooms.size()); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
- int baseStreamEnd = writer->GetLength();
- writer->Write(baseStreamEnd); // 0x04
+ auto baseStreamEnd = writer->GetLength();
+ writer->Write(baseStreamEnd); // 0x04
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
- for (RoomEntry entry : cmdRoom->rooms)
+ for (const auto& entry : cmdRoom->romfile->rooms)
{
writer->Write(entry.virtualAddressStart);
writer->Write(entry.virtualAddressEnd);
@@ -261,10 +259,10 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
int streamEnd = writer->GetStream().get()->GetLength();
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(streamEnd); // 0x04
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(streamEnd); // 0x04
// TODO: NOT DONE
@@ -284,10 +282,10 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
uint32_t baseStreamEnd = writer->GetStream().get()->GetLength();
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(baseStreamEnd); // 0x04
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(baseStreamEnd); // 0x04
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
@@ -305,12 +303,12 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
{
SetSpecialObjects* cmdSpecObj = (SetSpecialObjects*)cmd;
- writer->Write((uint8_t)cmdSpecObj->elfMessage); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)0); // 0x04
- writer->Write((uint8_t)0); // 0x05
- writer->Write((uint16_t)cmdSpecObj->globalObject); // 0x06
+ writer->Write((uint8_t)cmdSpecObj->elfMessage); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x04
+ writer->Write((uint8_t)0); // 0x05
+ writer->Write((uint16_t)cmdSpecObj->globalObject); // 0x06
}
break;
case RoomCommand::SetStartPositionList:
@@ -319,10 +317,10 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
uint32_t baseStreamEnd = writer->GetStream().get()->GetLength();
- writer->Write((uint8_t)cmdStartPos->actors.size()); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write(baseStreamEnd); // 0x04
+ writer->Write((uint8_t)cmdStartPos->actors.size()); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write(baseStreamEnd); // 0x04
uint32_t oldOffset = writer->GetBaseAddress();
writer->Seek(baseStreamEnd, SeekOffsetType::Start);
@@ -344,30 +342,31 @@ void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter*
break;
case RoomCommand::EndMarker:
{
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)0); // 0x04
- writer->Write((uint8_t)0); // 0x05
- writer->Write((uint8_t)0); // 0x06
- writer->Write((uint8_t)0); // 0x07
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x04
+ writer->Write((uint8_t)0); // 0x05
+ writer->Write((uint8_t)0); // 0x06
+ writer->Write((uint8_t)0); // 0x07
}
break;
default:
printf("UNIMPLEMENTED COMMAND: %i\n", (int)cmd->cmdID);
- writer->Write((uint8_t)0); // 0x01
- writer->Write((uint8_t)0); // 0x02
- writer->Write((uint8_t)0); // 0x03
- writer->Write((uint8_t)0); // 0x04
- writer->Write((uint8_t)0); // 0x05
- writer->Write((uint8_t)0); // 0x06
- writer->Write((uint8_t)0); // 0x07
+ writer->Write((uint8_t)0); // 0x01
+ writer->Write((uint8_t)0); // 0x02
+ writer->Write((uint8_t)0); // 0x03
+ writer->Write((uint8_t)0); // 0x04
+ writer->Write((uint8_t)0); // 0x05
+ writer->Write((uint8_t)0); // 0x06
+ writer->Write((uint8_t)0); // 0x07
break;
}
}
- //writer->Close();
- //File::WriteAllBytes(StringHelper::Sprintf("%s", res->GetName().c_str()), memStream->ToVector());
+ // writer->Close();
+ // File::WriteAllBytes(StringHelper::Sprintf("%s", res->GetName().c_str()),
+ // memStream->ToVector());
}
diff --git a/tools/ZAPD/ExporterTest/TextureExporter.cpp b/tools/ZAPD/ExporterTest/TextureExporter.cpp
index 95d84b8f7..6488bed3a 100644
--- a/tools/ZAPD/ExporterTest/TextureExporter.cpp
+++ b/tools/ZAPD/ExporterTest/TextureExporter.cpp
@@ -1,12 +1,14 @@
#include "TextureExporter.h"
#include "../ZAPD/ZFile.h"
-void ExporterExample_Texture::Save(ZResource* res, [[maybe_unused]]fs::path outPath, BinaryWriter* writer)
+void ExporterExample_Texture::Save(ZResource* res, [[maybe_unused]] fs::path outPath,
+ BinaryWriter* writer)
{
ZTexture* tex = (ZTexture*)res;
auto data = tex->parent->GetRawData();
- for (uint i = tex->GetRawDataIndex(); i < tex->GetRawDataIndex() + tex->GetRawDataSize(); i++)
+ for (offset_t i = tex->GetRawDataIndex(); i < tex->GetRawDataIndex() + tex->GetRawDataSize();
+ i++)
writer->Write(data[i]);
-}
\ No newline at end of file
+}
diff --git a/tools/ZAPD/ExporterTest/TextureExporter.h b/tools/ZAPD/ExporterTest/TextureExporter.h
index fcee8be5a..ffe6001dc 100644
--- a/tools/ZAPD/ExporterTest/TextureExporter.h
+++ b/tools/ZAPD/ExporterTest/TextureExporter.h
@@ -1,8 +1,8 @@
#pragma once
+#include
#include "ZResource.h"
#include "ZTexture.h"
-#include
class ExporterExample_Texture : public ZResourceExporter
{
diff --git a/tools/ZAPD/Makefile b/tools/ZAPD/Makefile
index e8f6c92a3..737b85ecf 100644
--- a/tools/ZAPD/Makefile
+++ b/tools/ZAPD/Makefile
@@ -5,17 +5,22 @@ ASAN ?= 0
DEPRECATION_ON ?= 1
DEBUG ?= 0
COPYCHECK_ARGS ?=
-# Set LLD=1 to use ld.lld as the linker
LLD ?= 0
-CXX := g++
+# Use clang++ if available, else use g++
+ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0)
+ CXX := clang++
+else
+ CXX := g++
+endif
+
INC := -I ZAPD -I lib/elfio -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils
CXXFLAGS := -fpic -std=c++17 -Wall -Wextra -fno-omit-frame-pointer
OPTFLAGS :=
ifneq ($(DEBUG),0)
OPTIMIZATION_ON = 0
- DEPRECATION_OFF = 1
+ CXXFLAGS += -g3 -DDEVELOPMENT -D_DEBUG
COPYCHECK_ARGS += --devel
DEPRECATION_ON = 0
else
@@ -29,7 +34,7 @@ else
endif
ifneq ($(ASAN),0)
- CXXFLAGS += -fsanitize=address
+ CXXFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined
endif
ifneq ($(DEPRECATION_ON),0)
CXXFLAGS += -DDEPRECATION_ON
@@ -38,6 +43,11 @@ endif
LDFLAGS := -lm -ldl -lpng
+# Use LLD if available. Set LLD=0 to not use it
+ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
+ LLD := 1
+endif
+
ifneq ($(LLD),0)
LDFLAGS += -fuse-ld=lld
endif
@@ -105,4 +115,4 @@ ZAPDUtils:
# Linking
ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils
- $(CXX) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive $(LDFLAGS) $(OUTPUT_OPTION)
+ $(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive $(LDFLAGS) $(OUTPUT_OPTION)
diff --git a/tools/ZAPD/README.md b/tools/ZAPD/README.md
index 4d7ade27e..e2764b627 100644
--- a/tools/ZAPD/README.md
+++ b/tools/ZAPD/README.md
@@ -30,7 +30,7 @@ You can configure a bit your ZAPD build with the following options:
- `DEBUG`: If non-zero, ZAPD will be compiled in _development mode_. This implies the following:
- Debugging symbols enabled (`-g3`). They are disabled by default.
- `OPTIMIZATION_ON=0`: Disables optimizations (`-O0`).
- - `DEPRECATION_OFF=1`: Disables deprecation warnings.
+ - `DEPRECATION_ON=0`: Disables deprecation warnings.
- `LLD=1`: builds with the LLVM linker `ld.lld` instead of the system default.
As an example, if you want to build ZAPD with optimizations disabled and use the address sanitizer, you could use the following command:
@@ -110,8 +110,10 @@ ZAPD also accepts the following list of extra parameters:
- Can be used only in `e` or `bsf` modes.
- `-tm MODE`: Test Mode (enables certain experimental features). To enable it, set `MODE` to `1`.
- `-wno` / `--warn-no-offsets` : Enable warnings for nodes that dont have offsets specified. Takes priority over `-eno`/ `--error-no-offsets`.
-- `-eno`/ `--error-no-offsets` : Enable errors for nodes that dont have offsets specified.
+- `-eno` / `--error-no-offsets` : Enable errors for nodes that dont have offsets specified.
- `-se` / `--set-exporter` : Sets which exporter to use.
- `--gcc-compat` : Enables GCC compatible mode. Slower.
+- `-s` / `--static` : Mark every asset as `static`.
+ - This behaviour can be overridden per asset using `Static=` in the respective XML node.
Additionally, you can pass the flag `--version` to see the current ZAPD version. If that flag is passed, ZAPD will ignore any other parameter passed.
diff --git a/tools/ZAPD/ZAPD/Declaration.cpp b/tools/ZAPD/ZAPD/Declaration.cpp
index 63a391805..d2a86ffcc 100644
--- a/tools/ZAPD/ZAPD/Declaration.cpp
+++ b/tools/ZAPD/ZAPD/Declaration.cpp
@@ -1,37 +1,31 @@
#include "Declaration.h"
-Declaration::Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nText)
+#include "Globals.h"
+#include "Utils/StringHelper.h"
+
+Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nText)
{
+ address = nAddress;
alignment = nAlignment;
- padding = nPadding;
size = nSize;
text = nText;
}
-Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, std::string nText)
- : Declaration(nAlignment, DeclarationPadding::None, nSize, nText)
+Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ const std::string& nText)
+ : Declaration(nAddress, nAlignment, nSize, nText)
{
varType = nVarType;
varName = nVarName;
isArray = nIsArray;
}
-Declaration::Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nVarType, std::string nVarName, bool nIsArray,
- std::string nText)
- : Declaration(nAlignment, nPadding, nSize, nText)
-{
- varType = nVarType;
- varName = nVarName;
- isArray = nIsArray;
-}
-
-Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, size_t nArrayItemCnt,
- std::string nText)
- : Declaration(nAlignment, DeclarationPadding::None, nSize, nText)
+Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ size_t nArrayItemCnt, const std::string& nText)
+ : Declaration(nAddress, nAlignment, nSize, nText)
{
varType = nVarType;
varName = nVarName;
@@ -39,10 +33,10 @@ Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::str
arrayItemCnt = nArrayItemCnt;
}
-Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, std::string nArrayItemCntStr,
- std::string nText)
- : Declaration(nAlignment, DeclarationPadding::None, nSize, nText)
+Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ const std::string& nArrayItemCntStr, const std::string& nText)
+ : Declaration(nAddress, nAlignment, nSize, nText)
{
varType = nVarType;
varName = nVarName;
@@ -50,30 +44,179 @@ Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::str
arrayItemCntStr = nArrayItemCntStr;
}
-Declaration::Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, size_t nArrayItemCnt,
- std::string nText, bool nIsExternal)
- : Declaration(nAlignment, nSize, nVarType, nVarName, nIsArray, nArrayItemCnt, nText)
+Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ size_t nArrayItemCnt, const std::string& nText, bool nIsExternal)
+ : Declaration(nAddress, nAlignment, nSize, nVarType, nVarName, nIsArray, nArrayItemCnt, nText)
{
isExternal = nIsExternal;
}
-Declaration::Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nVarType, std::string nVarName, bool nIsArray,
- size_t nArrayItemCnt, std::string nText)
- : Declaration(nAlignment, nPadding, nSize, nText)
-{
- varType = nVarType;
- varName = nVarName;
- isArray = nIsArray;
- arrayItemCnt = nArrayItemCnt;
-}
-
-Declaration::Declaration(std::string nIncludePath, size_t nSize, std::string nVarType,
- std::string nVarName)
- : Declaration(DeclarationAlignment::None, DeclarationPadding::None, nSize, "")
+Declaration::Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName)
+ : Declaration(nAddress, DeclarationAlignment::Align4, nSize, "")
{
includePath = nIncludePath;
varType = nVarType;
varName = nVarName;
}
+
+bool Declaration::IsStatic() const
+{
+ switch (staticConf)
+ {
+ case StaticConfig::Off:
+ return false;
+
+ case StaticConfig::Global:
+ return Globals::Instance->forceStatic;
+
+ case StaticConfig::On:
+ return true;
+ }
+
+ return false;
+}
+
+std::string Declaration::GetNormalDeclarationStr() const
+{
+ std::string output;
+
+ if (preText != "")
+ output += preText + "\n";
+
+ if (IsStatic())
+ {
+ output += "static ";
+ }
+
+ if (isArray)
+ {
+ if (arrayItemCntStr != "")
+ {
+ output += StringHelper::Sprintf("%s %s[%s];\n", varType.c_str(), varName.c_str(),
+ arrayItemCntStr.c_str());
+ }
+ else if (arrayItemCnt == 0)
+ {
+ output += StringHelper::Sprintf("%s %s[] = {\n", varType.c_str(), varName.c_str());
+ }
+ else
+ {
+ output += StringHelper::Sprintf("%s %s[%i] = {\n", varType.c_str(), varName.c_str(),
+ arrayItemCnt);
+ }
+
+ output += text + "\n";
+ }
+ else
+ {
+ output += StringHelper::Sprintf("%s %s = { ", varType.c_str(), varName.c_str());
+ output += text;
+ }
+
+ if (output.back() == '\n')
+ output += "};";
+ else
+ output += " };";
+
+ if (rightText != "")
+ output += " " + rightText + "";
+
+ output += "\n";
+
+ if (postText != "")
+ output += postText + "\n";
+
+ output += "\n";
+
+ return output;
+}
+
+std::string Declaration::GetExternalDeclarationStr() const
+{
+ std::string output;
+
+ if (preText != "")
+ output += preText + "\n";
+
+ if (IsStatic())
+ {
+ output += "static ";
+ }
+
+ if (arrayItemCntStr != "")
+ output +=
+ StringHelper::Sprintf("%s %s[%s] = {\n#include \"%s\"\n};", varType.c_str(),
+ varName.c_str(), arrayItemCntStr.c_str(), includePath.c_str());
+ else if (arrayItemCnt != 0)
+ output += StringHelper::Sprintf("%s %s[%i] = {\n#include \"%s\"\n};", varType.c_str(),
+ varName.c_str(), arrayItemCnt, includePath.c_str());
+ else
+ output += StringHelper::Sprintf("%s %s[] = {\n#include \"%s\"\n};", varType.c_str(),
+ varName.c_str(), includePath.c_str());
+
+ if (rightText != "")
+ output += " " + rightText + "";
+
+ output += "\n";
+
+ if (postText != "")
+ output += postText + "\n";
+
+ output += "\n";
+
+ return output;
+}
+
+std::string Declaration::GetExternStr() const
+{
+ if (IsStatic() || varType == "")
+ {
+ return "";
+ }
+
+ if (isArray)
+ {
+ if (arrayItemCntStr != "")
+ {
+ return StringHelper::Sprintf("extern %s %s[%s];\n", varType.c_str(), varName.c_str(),
+ arrayItemCntStr.c_str());
+ }
+ else if (arrayItemCnt != 0)
+ return StringHelper::Sprintf("extern %s %s[%i];\n", varType.c_str(), varName.c_str(),
+ arrayItemCnt);
+ else
+ return StringHelper::Sprintf("extern %s %s[];\n", varType.c_str(), varName.c_str());
+ }
+
+ return StringHelper::Sprintf("extern %s %s;\n", varType.c_str(), varName.c_str());
+}
+
+std::string Declaration::GetStaticForwardDeclarationStr() const
+{
+ if (!IsStatic() || isUnaccounted)
+ return "";
+
+ if (isArray)
+ {
+ if (arrayItemCntStr == "" && arrayItemCnt == 0)
+ {
+ // Forward declaring static arrays without specifying the size is not allowed.
+ return "";
+ }
+
+ if (arrayItemCntStr != "")
+ {
+ return StringHelper::Sprintf("static %s %s[%s];\n", varType.c_str(), varName.c_str(),
+ arrayItemCntStr.c_str());
+ }
+ else
+ {
+ return StringHelper::Sprintf("static %s %s[%i];\n", varType.c_str(), varName.c_str(),
+ arrayItemCnt);
+ }
+ }
+
+ return StringHelper::Sprintf("static %s %s;\n", varType.c_str(), varName.c_str());
+}
diff --git a/tools/ZAPD/ZAPD/Declaration.h b/tools/ZAPD/ZAPD/Declaration.h
index f955110e7..138524a4c 100644
--- a/tools/ZAPD/ZAPD/Declaration.h
+++ b/tools/ZAPD/ZAPD/Declaration.h
@@ -3,63 +3,77 @@
#include
#include
+// TODO: should we drop the `_t` suffix because of UNIX compliance?
+typedef uint32_t segptr_t;
+typedef uint32_t offset_t;
+
+#define SEGMENTED_NULL ((segptr_t)0)
+
enum class DeclarationAlignment
{
- None,
Align4,
Align8,
Align16
};
-enum class DeclarationPadding
+enum class StaticConfig
{
- None,
- Pad4,
- Pad8,
- Pad16
+ Off,
+ Global,
+ On
};
class Declaration
{
public:
+ offset_t address;
DeclarationAlignment alignment;
- DeclarationPadding padding;
size_t size;
- std::string preText = "";
- std::string text = "";
- std::string rightText = "";
- std::string postText = "";
- std::string preComment = "";
- std::string postComment = "";
- std::string varType = "";
- std::string varName = "";
- std::string includePath = "";
+ std::string preText;
+ std::string text;
+ std::string rightText;
+ std::string postText;
+ std::string preComment;
+ std::string postComment;
+ std::string varType;
+ std::string varName;
+ std::string includePath;
bool isExternal = false;
bool isArray = false;
size_t arrayItemCnt = 0;
- std::string arrayItemCntStr = "";
- std::vector references;
+ std::string arrayItemCntStr;
+ std::vector references;
bool isUnaccounted = false;
bool isPlaceholder = false;
+ bool declaredInXml = false;
+ StaticConfig staticConf = StaticConfig::Global;
- Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, std::string nText);
- Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nVarType, std::string nVarName, bool nIsArray, std::string nText);
- Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, size_t nArrayItemCnt, std::string nText);
- Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, std::string nArrayItemCntStr,
- std::string nText);
- Declaration(DeclarationAlignment nAlignment, size_t nSize, std::string nVarType,
- std::string nVarName, bool nIsArray, size_t nArrayItemCnt, std::string nText,
- bool nIsExternal);
- Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nVarType, std::string nVarName, bool nIsArray, size_t nArrayItemCnt,
- std::string nText);
- Declaration(std::string nIncludePath, size_t nSize, std::string nVarType, std::string nVarName);
+ Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ const std::string& nText);
+ Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ size_t nArrayItemCnt, const std::string& nText);
+ Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ const std::string& nArrayItemCntStr, const std::string& nText);
+ Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName, bool nIsArray,
+ size_t nArrayItemCnt, const std::string& nText, bool nIsExternal);
+
+ Declaration(offset_t nAddress, const std::string& nIncludePath, size_t nSize,
+ const std::string& nVarType, const std::string& nVarName);
+
+ bool IsStatic() const;
+
+ std::string GetNormalDeclarationStr() const;
+ std::string GetExternalDeclarationStr() const;
+
+ std::string GetExternStr() const;
+
+ std::string GetStaticForwardDeclarationStr() const;
protected:
- Declaration(DeclarationAlignment nAlignment, DeclarationPadding nPadding, size_t nSize,
- std::string nText);
-};
\ No newline at end of file
+ Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize,
+ const std::string& nText);
+};
diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp
new file mode 100644
index 000000000..f197493a4
--- /dev/null
+++ b/tools/ZAPD/ZAPD/GameConfig.cpp
@@ -0,0 +1,184 @@
+#include "GameConfig.h"
+
+#include
+#include
+
+#include "Utils/Directory.h"
+#include "Utils/File.h"
+#include "Utils/Path.h"
+#include "ZFile.h"
+#include "tinyxml2.h"
+
+using ConfigFunc = void (GameConfig::*)(const tinyxml2::XMLElement&);
+
+GameConfig::~GameConfig()
+{
+ for (auto& declPair : segmentRefFiles)
+ {
+ for (auto& file : declPair.second)
+ {
+ delete file;
+ }
+ }
+}
+
+void GameConfig::ReadTexturePool(const fs::path& texturePoolXmlPath)
+{
+ tinyxml2::XMLDocument doc;
+ tinyxml2::XMLError eResult = doc.LoadFile(texturePoolXmlPath.c_str());
+
+ if (eResult != tinyxml2::XML_SUCCESS)
+ {
+ fprintf(stderr, "Warning: Unable to read texture pool XML with error code %i\n", eResult);
+ return;
+ }
+
+ tinyxml2::XMLNode* root = doc.FirstChild();
+
+ if (root == nullptr)
+ return;
+
+ for (tinyxml2::XMLElement* child = root->FirstChildElement(); child != nullptr;
+ child = child->NextSiblingElement())
+ {
+ if (std::string_view(child->Name()) == "Texture")
+ {
+ std::string crcStr = child->Attribute("CRC");
+ fs::path texPath = child->Attribute("Path");
+ std::string texName;
+
+ uint32_t crc = strtoul(crcStr.c_str(), nullptr, 16);
+
+ texturePool[crc].path = texPath;
+ }
+ }
+}
+
+void GameConfig::GenSymbolMap(const fs::path& symbolMapPath)
+{
+ auto symbolLines = File::ReadAllLines(symbolMapPath);
+
+ for (std::string& symbolLine : symbolLines)
+ {
+ auto split = StringHelper::Split(symbolLine, " ");
+ uint32_t addr = strtoul(split[0].c_str(), nullptr, 16);
+ std::string symbolName = split[1];
+
+ symbolMap[addr] = std::move(symbolName);
+ }
+}
+
+void GameConfig::ConfigFunc_SymbolMap(const tinyxml2::XMLElement& element)
+{
+ std::string fileName = element.Attribute("File");
+ GenSymbolMap(Path::GetDirectoryName(configFilePath) / fileName);
+}
+
+void GameConfig::ConfigFunc_ActorList(const tinyxml2::XMLElement& element)
+{
+ std::string fileName = element.Attribute("File");
+ std::vector lines =
+ File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName);
+
+ for (auto& line : lines)
+ actorList.emplace_back(std::move(line));
+}
+
+void GameConfig::ConfigFunc_ObjectList(const tinyxml2::XMLElement& element)
+{
+ std::string fileName = element.Attribute("File");
+ std::vector lines =
+ File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName);
+
+ for (auto& line : lines)
+ objectList.emplace_back(std::move(line));
+}
+
+void GameConfig::ConfigFunc_TexturePool(const tinyxml2::XMLElement& element)
+{
+ std::string fileName = element.Attribute("File");
+ ReadTexturePool(Path::GetDirectoryName(configFilePath) / fileName);
+}
+
+void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element)
+{
+ bgScreenWidth = element.IntAttribute("ScreenWidth", 320);
+ bgScreenHeight = element.IntAttribute("ScreenHeight", 240);
+}
+
+void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element)
+{
+ const char* pathValue = element.Attribute("Path");
+ if (pathValue == nullptr)
+ {
+ throw std::runtime_error(
+ StringHelper::Sprintf("Parse: Fatal error in configuration file.\n"
+ "\t Missing 'Path' attribute in `ExternalXMLFolder` element.\n"));
+ }
+ if (externalXmlFolder != "")
+ {
+ throw std::runtime_error(StringHelper::Sprintf("Parse: Fatal error in configuration file.\n"
+ "\t `ExternalXMLFolder` is duplicated.\n"));
+ }
+ externalXmlFolder = pathValue;
+}
+
+void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element)
+{
+ const char* xmlPathValue = element.Attribute("XmlPath");
+ if (xmlPathValue == nullptr)
+ {
+ throw std::runtime_error(
+ StringHelper::Sprintf("Parse: Fatal error in configuration file.\n"
+ "\t Missing 'XmlPath' attribute in `ExternalFile` element.\n"));
+ }
+ const char* outPathValue = element.Attribute("OutPath");
+ if (outPathValue == nullptr)
+ {
+ throw std::runtime_error(
+ StringHelper::Sprintf("Parse: Fatal error in configuration file.\n"
+ "\t Missing 'OutPath' attribute in `ExternalFile` element.\n"));
+ }
+
+ externalFiles.push_back(ExternalFile(fs::path(xmlPathValue), fs::path(outPathValue)));
+}
+
+void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath)
+{
+ static const std::map ConfigFuncDictionary = {
+ {"SymbolMap", &GameConfig::ConfigFunc_SymbolMap},
+ {"ActorList", &GameConfig::ConfigFunc_ActorList},
+ {"ObjectList", &GameConfig::ConfigFunc_ObjectList},
+ {"TexturePool", &GameConfig::ConfigFunc_TexturePool},
+ {"BGConfig", &GameConfig::ConfigFunc_BGConfig},
+ {"ExternalXMLFolder", &GameConfig::ConfigFunc_ExternalXMLFolder},
+ {"ExternalFile", &GameConfig::ConfigFunc_ExternalFile},
+ };
+
+ configFilePath = argConfigFilePath;
+ tinyxml2::XMLDocument doc;
+ tinyxml2::XMLError eResult = doc.LoadFile(configFilePath.c_str());
+
+ if (eResult != tinyxml2::XML_SUCCESS)
+ {
+ throw std::runtime_error("Error: Unable to read config file.");
+ }
+
+ tinyxml2::XMLNode* root = doc.FirstChild();
+
+ if (root == nullptr)
+ return;
+
+ for (tinyxml2::XMLElement* child = root->FirstChildElement(); child != nullptr;
+ child = child->NextSiblingElement())
+ {
+ auto it = ConfigFuncDictionary.find(child->Name());
+ if (it == ConfigFuncDictionary.end())
+ {
+ fprintf(stderr, "Unsupported configuration variable: %s\n", child->Name());
+ continue;
+ }
+
+ std::invoke(it->second, *this, *child);
+ }
+}
diff --git a/tools/ZAPD/ZAPD/GameConfig.h b/tools/ZAPD/ZAPD/GameConfig.h
new file mode 100644
index 000000000..c478d16ce
--- /dev/null
+++ b/tools/ZAPD/ZAPD/GameConfig.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#include
+#include