Format everything (#141)

* Add trailing comma

* Run format and add some missing trailing commas

* Enforce the same clang-format version for everybody

* z_en_m_fire1
This commit is contained in:
Anghelo Carvajal 2021-05-18 20:00:36 -04:00 committed by GitHub
parent 091219d742
commit c56934038a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
639 changed files with 2537 additions and 2312 deletions

View File

@ -9,7 +9,7 @@ shopt -s globstar
if (( $# > 0 )); then
echo "Formatting file(s) $*"
echo "Running clang-format..."
clang-format ${FORMAT_OPTS} "$@"
clang-format-11 ${FORMAT_OPTS} "$@"
echo "Running clang-tidy..."
clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."
@ -20,7 +20,7 @@ fi
echo "Formatting C files. This will take a bit"
echo "Running clang-format..."
clang-format ${FORMAT_OPTS} src/**/*.c
clang-format-11 ${FORMAT_OPTS} src/**/*.c
echo "Running clang-tidy..."
clang-tidy ${TIDY_OPTS} src/**/*.c -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."

View File

@ -82,7 +82,6 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) {
}
}
void __osMallocCleanup(Arena* arena) {
bzero(arena, sizeof(*arena));
}
@ -97,11 +96,11 @@ void* __osMalloc(Arena* arena, u32 size) {
void* alloc;
u32 blockSize;
alloc = NULL;
size = ALIGN16(size);
ArenaImpl_Lock(arena);
iter = arena->head;
while (iter != NULL) {
if (iter->isFree && iter->size >= size) {
ArenaNode* next;
@ -134,7 +133,6 @@ void* __osMalloc(Arena* arena, u32 size) {
return alloc;
}
void* __osMallocR(Arena* arena, u32 size) {
ArenaNode* iter;
ArenaNode* newNode;

View File

@ -99,15 +99,12 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
(c & 3) << 1, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
}
}
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, (u16)(tile & 7),
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
this->posX += 32;
}
@ -133,7 +130,7 @@ void GfxPrint_PrintString(GfxPrint* this, const char* str) {
}
}
GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) {
GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) {
GfxPrint_PrintStringWithSize(this, str, sizeof(char), size);
return this;
}
@ -142,7 +139,7 @@ void GfxPrint_Init(GfxPrint* this) {
this->flag &= ~GFXPRINT_OPEN;
this->callback = GfxPrint_Callback;
this->dlist = NULL;
this->posX = 0;
this->posY = 0;
@ -156,7 +153,6 @@ void GfxPrint_Init(GfxPrint* this) {
}
void GfxPrint_Destroy(GfxPrint* this) {
}
void GfxPrint_Open(GfxPrint* this, Gfx* dlist) {
@ -164,7 +160,7 @@ void GfxPrint_Open(GfxPrint* this, Gfx* dlist) {
this->flag |= GFXPRINT_OPEN;
this->dlist = dlist;
GfxPrint_InitDlist(this);
}
}
}
Gfx* GfxPrint_Close(GfxPrint* this) {

View File

@ -4,9 +4,10 @@
UNK_TYPE4 D_80096C30 = 2;
#ifdef NON_MATCHING
// This needs lots of work. Mostly regalloc and getting the address of D_80096C30 placed in s5 at the beginning of the function
// This needs lots of work. Mostly regalloc and getting the address of D_80096C30 placed in s5 at the beginning of the
// function
void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 vRamStart) {
s32 sectionLocations [4];
s32 sectionLocations[4];
u32* regReferences[32];
u32 regValues[32];
u32 i;
@ -24,34 +25,36 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 v
for (i = 0, relocationIndex = 0; i < overlayInfo->amountOfRelocations; relocationIndex++) {
relocation = overlayInfo->relocations[relocationIndex];
i++;
inst = (u32 *)(sectionLocations[relocation >> 0x1e] + (relocation & 0xffffff));
inst = (u32*)(sectionLocations[relocation >> 0x1e] + (relocation & 0xffffff));
switch (relocation & 0x3f000000) {
case 0x2000000:
if ((*inst & 0xf000000) == 0) {
*inst = (*inst - vRamStart) + allocatedVRamAddr;
} else {
if (D_80096C30 > 2);
}
break;
case 0x4000000:
*inst = (*inst & 0xfc000000) |
(((((*inst & 0x3ffffff) << 2 | 0x80000000) - vRamStart) + allocatedVRamAddr & 0xfffffff) >> 2);
break;
case 0x5000000:
regReferences[*inst >> 0x10 & 0x1f] = inst;
regValues[*inst >> 0x10 & 0x1f] = *inst;
break;
case 0x6000000:
lastInst = regReferences[*inst >> 0x15 & 0x1f];
signedOffset = (s16)*inst;
if ((signedOffset + *lastInst * 0x10000 & 0xf000000) == 0) {
relocatedAddress = ((signedOffset + regValues[*inst >> 0x15 & 0x1f] * 0x10000) - vRamStart) + allocatedVRamAddr;
*lastInst = (((relocatedAddress >> 0x10) & 0xFFFF) + ((relocatedAddress & 0x8000)? 1 : 0)) |
(*lastInst & 0xffff0000);
*inst = *inst & 0xffff0000 | relocatedAddress & 0xffff;
}
break;
case 0x2000000:
if ((*inst & 0xf000000) == 0) {
*inst = (*inst - vRamStart) + allocatedVRamAddr;
} else {
if (D_80096C30 > 2)
;
}
break;
case 0x4000000:
*inst = (*inst & 0xfc000000) |
(((((*inst & 0x3ffffff) << 2 | 0x80000000) - vRamStart) + allocatedVRamAddr & 0xfffffff) >> 2);
break;
case 0x5000000:
regReferences[*inst >> 0x10 & 0x1f] = inst;
regValues[*inst >> 0x10 & 0x1f] = *inst;
break;
case 0x6000000:
lastInst = regReferences[*inst >> 0x15 & 0x1f];
signedOffset = (s16)*inst;
if ((signedOffset + *lastInst * 0x10000 & 0xf000000) == 0) {
relocatedAddress =
((signedOffset + regValues[*inst >> 0x15 & 0x1f] * 0x10000) - vRamStart) + allocatedVRamAddr;
*lastInst = (((relocatedAddress >> 0x10) & 0xFFFF) + ((relocatedAddress & 0x8000) ? 1 : 0)) |
(*lastInst & 0xffff0000);
*inst = *inst & 0xffff0000 | relocatedAddress & 0xffff;
}
break;
}
}
}
@ -70,14 +73,18 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
size = vRomEnd - vRomStart;
if(1);
if (1) {
;
}
DmaMgr_SendRequest0(allocatedVRamAddr, vRomStart, size);
end = (void*)(allocatedVRamAddr + size);
overlayInfo = (OverlayBlockSizes*)((int)end - *(int*)((int)end + -4));
if(1);
if (1) {
;
}
Load2_Relocate(allocatedVRamAddr, overlayInfo, vRamStart);

View File

@ -15,5 +15,5 @@ void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
}
void MtxConv_L2F(MtxF* m1, MatrixInternal* m2) {
guMtxL2F(m1, (Mtx *)m2);
guMtxL2F(m1, (Mtx*)m2);
}

View File

@ -92,4 +92,3 @@ void PadUtils_UpdateRelXY(Input* input) {
PadUtils_SetRelXY(input, relX, relY);
}

View File

@ -4,7 +4,8 @@
StackEntry* sStackInfoListStart = NULL;
StackEntry* sStackInfoListEnd = NULL;
void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name) {
void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace,
const char* name) {
StackEntry* iter;
u32* addr;
@ -99,7 +100,7 @@ u32 StackCheck_CheckAll() {
u32 ret = 0;
StackEntry* iter = sStackInfoListStart;
while(iter) {
while (iter) {
u32 state = StackCheck_GetState(iter);
if (state) {
ret = 1;

View File

@ -1,9 +1,11 @@
#include <ultra64.h>
#include <global.h>
void CIC6105_Nop80081820(void) {}
void CIC6105_Nop80081820(void) {
}
void CIC6105_Nop80081828(void) {}
void CIC6105_Nop80081828(void) {
}
void CIC6105_PrintRomInfo(void) {
FaultDrawer_DrawText(80, 200, "SP_STATUS %08x", (UNK_PTR)(*(u32*)0xA4040010));

View File

@ -3,6 +3,9 @@
// This file contains print functions that are used by fault.c, so they are placed in the fault module
void Fault_Nop80081920(UNK_TYPE4 param_1, ...) {}
void Fault_Log(char* str, ...) {}
void Fault_Nop80081958(UNK_TYPE4 param_1, ...) {}
void Fault_Nop80081920(UNK_TYPE4 param_1, ...) {
}
void Fault_Log(char* str, ...) {
}
void Fault_Nop80081958(UNK_TYPE4 param_1, ...) {
}

View File

@ -11,7 +11,7 @@ s32 func_800968B0(const char* str1, const char* str2) {
currentCharStr1 = *str1++;
currentCharStr2 = *str2++;
if (currentCharStr1 != currentCharStr2) {
return currentCharStr1 - currentCharStr2;
return currentCharStr1 - currentCharStr2;
}
} while (currentCharStr1);

View File

@ -9,6 +9,7 @@ void bootproc(void) {
osUnmapTLBAll();
gCartHandle = osCartRomInit();
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle");
osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), Z_PRIORITY_IDLE);
osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack),
Z_PRIORITY_IDLE);
osStartThread(&sIdleThread);
}

View File

@ -52,7 +52,8 @@ void Idle_InitCodeAndMemory(void) {
oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, (u32)&code_text_start, (u32)_codeSegmentRomStart, (u32)_codeSegmentRomEnd - (u32)_codeSegmentRomStart, 0, &queue, 0);
DmaMgr_SendRequestImpl(&dmaReq, (u32)&code_text_start, (u32)_codeSegmentRomStart,
(u32)_codeSegmentRomEnd - (u32)_codeSegmentRomStart, 0, &queue, 0);
Idle_InitScreen();
Idle_InitMemory();
osRecvMesg(&queue, NULL, 1);
@ -82,19 +83,19 @@ void Idle_InitVideo(void) {
gViConfigYScale = 1.0;
switch (osTvType) {
case 1:
D_8009B290 = 2;
gViConfigMode = osViModeNtscLan1;
break;
case 2:
D_8009B290 = 30;
gViConfigMode = osViModeMpalLan1;
break;
case 0:
D_8009B290 = 44;
gViConfigMode = osViModeFpalLan1;
gViConfigYScale = 0.833f;
break;
case 1:
D_8009B290 = 2;
gViConfigMode = osViModeNtscLan1;
break;
case 2:
D_8009B290 = 30;
gViConfigMode = osViModeMpalLan1;
break;
case 0:
D_8009B290 = 44;
gViConfigMode = osViModeFpalLan1;
gViConfigYScale = 0.833f;
break;
}
D_80096B20 = 1;
@ -104,9 +105,12 @@ void Idle_ThreadEntry(void* arg) {
Idle_InitVideo();
osCreatePiManager(150, &gPiMgrCmdQ, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 1024, "main");
osCreateThread(&gMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), Z_PRIORITY_MAIN);
osCreateThread(&gMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack),
Z_PRIORITY_MAIN);
osStartThread(&gMainThread);
osSetThreadPri(NULL, 0);
for(;;);
for (;;) {
;
}
}

View File

@ -2,9 +2,9 @@
#include <global.h>
// TODO move out
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4)
#define OS_USEC_TO_CYCLES(n) (((u64)(n) * (OS_CPU_COUNTER / 15625LL)) / (1000000LL / 15625LL))
vs32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0;
@ -122,7 +122,7 @@ void IrqMgr_HandleRetrace(IrqMgr* irqmgr) {
}
sIrqMgrRetraceCount += 1;
IrqMgr_SendMesgForClient(irqmgr,irqmgr);
IrqMgr_SendMesgForClient(irqmgr, irqmgr);
}
void IrqMgr_ThreadEntry(IrqMgr* irqmgr) {
@ -132,25 +132,27 @@ void IrqMgr_ThreadEntry(IrqMgr* irqmgr) {
interrupt = 0;
stop = 0;
while (stop == 0) {
if (stop);
if (stop) {
;
}
osRecvMesg(&irqmgr->irqQueue, (OSMesg*)&interrupt, 1);
switch (interrupt) {
case 0x29A:
IrqMgr_HandleRetrace(irqmgr);
break;
case 0x29D:
IrqMgr_HandlePreNMI(irqmgr);
break;
case 0x29F:
IrqMgr_HandlePRENMI450(irqmgr);
break;
case 0x2A0:
IrqMgr_HandlePRENMI480(irqmgr);
break;
case 0x2A1:
IrqMgr_HandlePRENMI500(irqmgr);
break;
case 0x29A:
IrqMgr_HandleRetrace(irqmgr);
break;
case 0x29D:
IrqMgr_HandlePreNMI(irqmgr);
break;
case 0x29F:
IrqMgr_HandlePRENMI450(irqmgr);
break;
case 0x2A0:
IrqMgr_HandlePRENMI480(irqmgr);
break;
case 0x2A1:
IrqMgr_HandlePRENMI500(irqmgr);
break;
}
}
}
@ -163,7 +165,7 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
irqmgr->prenmiStage = 0;
irqmgr->lastPrenmiTime = 0;
osCreateMesgQueue(&irqmgr->irqQueue,(OSMesg *)irqmgr->irqBuffer,8);
osCreateMesgQueue(&irqmgr->irqQueue, (OSMesg*)irqmgr->irqBuffer, 8);
osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D);
osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount);

View File

@ -4,16 +4,16 @@
void ViConfig_UpdateVi(u32 mode) {
if (mode != 0) {
switch (osTvType) {
case 2:
osViSetMode(&osViModeMpalLan1);
break;
case 0:
osViSetMode(&osViModePalLan1);
break;
case 1:
case 2:
osViSetMode(&osViModeMpalLan1);
break;
case 0:
osViSetMode(&osViModePalLan1);
break;
case 1:
default:
osViSetMode(&osViModeNtscLan1);
break;
osViSetMode(&osViModeNtscLan1);
break;
}
if (gViConfigFeatures != 0) {
@ -46,7 +46,6 @@ void ViConfig_UpdateVi(u32 mode) {
gViConfigUseDefault = mode;
}
void ViConfig_UpdateBlack(void) {
if (gViConfigUseDefault != 0) {
osViBlack(1);

View File

@ -60,9 +60,9 @@ void* Yaz0_NextDMA(void* curSrcPos) {
typedef struct {
/* 0x00 */ u32 magic; // Yaz0
/* 0x04 */ u32 decSize;
/* 0x08 */ u32 compInfoOffset; // only used in mio0
/* 0x08 */ u32 compInfoOffset; // only used in mio0
/* 0x0C */ u32 uncompDataOffset; // only used in mio0
} Yaz0Header; // size = 0x10
} Yaz0Header; // size = 0x10
#define YAZ0_MAGIC 0x59617A30 // "Yaz0"

View File

@ -21,7 +21,9 @@ s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) {
ioMsg.dramAddr = ram;
ioMsg.size = buffSize;
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
if (ret) goto END;
if (ret) {
goto END;
}
osRecvMesg(&queue, NULL, 1);
size -= buffSize;
@ -35,7 +37,9 @@ s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) {
ioMsg.dramAddr = ram;
ioMsg.size = (u32)size;
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
if (ret) goto END;
if (ret) {
goto END;
}
osRecvMesg(&queue, NULL, 1);
@ -53,8 +57,12 @@ DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) {
DmaEntry* curr;
for (curr = dmadata; curr->vromEnd != 0; curr++) {
if (vrom < curr->vromStart) continue;
if (vrom >= curr->vromEnd) continue;
if (vrom < curr->vromStart) {
continue;
}
if (vrom >= curr->vromEnd) {
continue;
}
return curr;
}
@ -84,7 +92,7 @@ s32 DmaMgr_FindDmaIndex(u32 vrom) {
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
if (entry != NULL) {
return entry - dmadata;
return entry - dmadata;
}
return -1;
@ -149,17 +157,17 @@ void DmaMgr_ThreadEntry(void* a0) {
break;
}
req = (DmaRequest *)msg;
req = (DmaRequest*)msg;
DmaMgr_ProcessMsg(req);
if (req->notifyQueue) {
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
}
}
}
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* queue, OSMesg msg) {
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused,
OSMesgQueue* queue, OSMesg msg) {
if (gIrqMgrResetStatus >= 2) {
return -2;
}
@ -177,22 +185,22 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart,
}
s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) {
DmaRequest req;
DmaRequest req;
OSMesgQueue queue;
OSMesg msg[1];
s32 ret;
s32 ret;
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
ret = DmaMgr_SendRequestImpl(&req, vramStart, vromStart, size, 0, &queue, NULL);
ret = DmaMgr_SendRequestImpl(&req, vramStart, vromStart, size, 0, &queue, NULL);
if (ret == -1) {
return ret;
} else {
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
}
if (ret == -1) {
return ret;
} else {
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
}
return 0;
return 0;
}
const char dmamgrThreadName[] = "dmamgr";
@ -200,19 +208,22 @@ const char dmamgrThreadName[] = "dmamgr";
#ifdef NON_MATCHING
// TODO missing a useless move initializing v0, and some reorderings
void DmaMgr_Start() {
DmaEntry* iter;
u32 idx;
DmaEntry* iter;
u32 idx;
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, dmadata, (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, dmadata, (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
for (iter = dmadata, idx = 0; iter->vromEnd != 0; iter++, idx++);
for (iter = dmadata, idx = 0; iter->vromEnd != 0; iter++, idx++) {
;
}
numDmaEntries = idx;
numDmaEntries = idx;
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 256, dmamgrThreadName);
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack), Z_PRIORITY_DMAMGR);
osStartThread(&sDmaMgrThread);
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 256, dmamgrThreadName);
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack),
Z_PRIORITY_DMAMGR);
osStartThread(&sDmaMgrThread);
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/boot/z_std_dma/DmaMgr_Start.asm")

View File

@ -742,17 +742,17 @@ void Fault_SetOptionsFromController3(void) {
graphRA = graphOSThread.context.ra;
graphSP = graphOSThread.context.sp;
if (CHECK_BTN_ALL(input3->press.button, BTN_R)) {
faultCopyToLog = !faultCopyToLog;
FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog);
faultCopyToLog = !faultCopyToLog;
FaultDrawer_SetOsSyncPrintfEnabled(faultCopyToLog);
}
if (CHECK_BTN_ALL(input3->press.button, BTN_A)) {
Fault_Log(D_80098A44, graphPC, graphRA, graphSP);
Fault_Log(D_80098A44, graphPC, graphRA, graphSP);
}
if (CHECK_BTN_ALL(input3->press.button, BTN_B)) {
FaultDrawer_SetDrawerFB(osViGetNextFramebuffer(), 0x140, 0xF0);
Fault_DrawRec(0, 0xD7, 0x140, 9, 1);
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x20, 0xD8, D_80098A68, graphPC, graphRA, graphSP);
FaultDrawer_SetDrawerFB(osViGetNextFramebuffer(), 0x140, 0xF0);
Fault_DrawRec(0, 0xD7, 0x140, 9, 1);
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x20, 0xD8, D_80098A68, graphPC, graphRA, graphSP);
}
}
}

View File

@ -19,7 +19,8 @@ FaultDrawer sFaultDrawerDefault = {
8, // charH
0, // charWPad
0, // charHPad
{ // printColors
{
// printColors
GPACK_RGBA5551(0, 0, 0, 1),
GPACK_RGBA5551(255, 0, 0, 1),
GPACK_RGBA5551(0, 255, 0, 1),
@ -40,7 +41,6 @@ void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
sFaultDrawContext->osSyncPrintfEnabled = enabled;
}
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) {
u16* fb;
s32 x, y;
@ -110,7 +110,7 @@ void FaultDrawer_SetBackColor(u16 color) {
}
void FaultDrawer_SetFontColor(u16 color) {
FaultDrawer_SetForeColor(color | 1); //force alpha to be set
FaultDrawer_SetForeColor(color | 1); // force alpha to be set
}
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
@ -120,7 +120,9 @@ void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
void FaultDrawer_SetCursor(s32 x, s32 y) {
if (sFaultDrawContext->osSyncPrintfEnabled) {
Fault_Log(D_80099064, (y - sFaultDrawContext->yStart) / (sFaultDrawContext->charH + sFaultDrawContext->charHPad), (x - sFaultDrawContext->xStart) / (sFaultDrawContext->charW + sFaultDrawContext->charWPad));
Fault_Log(D_80099064,
(y - sFaultDrawContext->yStart) / (sFaultDrawContext->charH + sFaultDrawContext->charHPad),
(x - sFaultDrawContext->xStart) / (sFaultDrawContext->charW + sFaultDrawContext->charWPad));
}
sFaultDrawContext->cursorX = x;
sFaultDrawContext->cursorY = y;
@ -131,13 +133,14 @@ void FaultDrawer_FillScreen() {
Fault_Log(D_80099070);
}
FaultDrawer_DrawRecImpl(sFaultDrawContext->xStart, sFaultDrawContext->yStart, sFaultDrawContext->xEnd, sFaultDrawContext->yEnd, sFaultDrawContext->backColor | 1);
FaultDrawer_DrawRecImpl(sFaultDrawContext->xStart, sFaultDrawContext->yStart, sFaultDrawContext->xEnd,
sFaultDrawContext->yEnd, sFaultDrawContext->backColor | 1);
FaultDrawer_SetCursor(sFaultDrawContext->xStart, sFaultDrawContext->yStart);
}
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.asm")
void FaultDrawer_VPrintf(char* str, char* args) { //va_list
void FaultDrawer_VPrintf(char* str, char* args) { // va_list
_Printf((printf_func)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args);
}
@ -162,7 +165,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;
}
@ -171,4 +174,3 @@ void FaultDrawer_Init() {
bcopy(&sFaultDrawerDefault, sFaultDrawContext, sizeof(FaultDrawer));
sFaultDrawContext->fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
}

View File

@ -27,7 +27,7 @@ void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt) {
this->update = (ActorFunc)EnAObj_Update2;
} else {
v0 = this->base.yawTowardsPlayer - this->base.shape.rot.y;
v1 = (v0 < 0)? -v0 : v0;
v1 = (v0 < 0) ? -v0 : v0;
if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
func_800B863C((Actor*)this, ctxt);
}

View File

@ -128,51 +128,51 @@ void Effect_Add(GlobalContext* ctxt, s32* index, s32 type, u8 param_4, u8 param_
if (func_8016A01C(ctxt) != 1) {
slotFound = 0;
switch (type) {
case 0:
for (i = 0; i < 3; i++) {
if (sEffTable.sparks[i].base.active == 0) {
slotFound = 1;
*index = i;
params = &sEffTable.sparks[i].params;
common = &sEffTable.sparks[i].base;
break;
case 0:
for (i = 0; i < 3; i++) {
if (sEffTable.sparks[i].base.active == 0) {
slotFound = 1;
*index = i;
params = &sEffTable.sparks[i].params;
common = &sEffTable.sparks[i].base;
break;
}
}
}
break;
case 1:
case 2:
for (i = 0; i < 25; i++) {
if (sEffTable.blures[i].base.active == 0) {
slotFound = 1;
*index = i + 3;
params = &sEffTable.blures[i].params;
common = &sEffTable.blures[i].base;
break;
break;
case 1:
case 2:
for (i = 0; i < 25; i++) {
if (sEffTable.blures[i].base.active == 0) {
slotFound = 1;
*index = i + 3;
params = &sEffTable.blures[i].params;
common = &sEffTable.blures[i].base;
break;
}
}
}
break;
case 3:
for (i = 0; i < 3; i++) {
if (sEffTable.shieldParticles[i].base.active == 0) {
slotFound = 1;
*index = i + 28;
params = &sEffTable.shieldParticles[i].params;
common = &sEffTable.shieldParticles[i].base;
break;
break;
case 3:
for (i = 0; i < 3; i++) {
if (sEffTable.shieldParticles[i].base.active == 0) {
slotFound = 1;
*index = i + 28;
params = &sEffTable.shieldParticles[i].params;
common = &sEffTable.shieldParticles[i].base;
break;
}
}
}
break;
case 4:
for (i = 0; i < 15; i++) {
if (sEffTable.tireMarks[i].base.active == 0) {
slotFound = 1;
*index = i + 31;
params = &sEffTable.tireMarks[i].params;
common = &sEffTable.tireMarks[i].base;
break;
break;
case 4:
for (i = 0; i < 15; i++) {
if (sEffTable.tireMarks[i].base.active == 0) {
slotFound = 1;
*index = i + 31;
params = &sEffTable.tireMarks[i].params;
common = &sEffTable.tireMarks[i].base;
break;
}
}
}
break;
break;
}
if (slotFound) {
@ -264,28 +264,28 @@ void Effect_Destroy(GlobalContext* ctxt, s32 index) {
}
if (index < 3) {
sEffTable.sparks[index].base.active = 0 ;
sEffTable.sparks[index].base.active = 0;
sEffInfoTable[0].destroy(&sEffTable.sparks[index].params);
return;
}
index -= 3;
if (index < 25) {
sEffTable.blures[index].base.active = 0 ;
sEffTable.blures[index].base.active = 0;
sEffInfoTable[1].destroy(&sEffTable.blures[index].params);
return;
}
index -= 25;
if (index < 3) {
sEffTable.shieldParticles[index].base.active = 0 ;
sEffTable.shieldParticles[index].base.active = 0;
sEffInfoTable[3].destroy(&sEffTable.shieldParticles[index].params);
return;
}
index -= 3;
if (index < 15) {
sEffTable.tireMarks[index].base.active = 0 ;
sEffTable.tireMarks[index].base.active = 0;
sEffInfoTable[4].destroy(&sEffTable.tireMarks[index].params);
return;
}
@ -314,4 +314,3 @@ void Effect_DestroyAll(GlobalContext* ctxt) {
sEffInfoTable[4].destroy(&sEffTable.tireMarks[i].params);
}
}

View File

@ -12,31 +12,27 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
Vec3f newPos;
Vec3f posWithInv;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
SkinMatrix_SetScaleRotateYRPTranslate(&prevMatrix,
bgCtxt->dyna.bgActors[index].prevTransform.scale.x,
bgCtxt->dyna.bgActors[index].prevTransform.scale.y,
bgCtxt->dyna.bgActors[index].prevTransform.scale.z,
bgCtxt->dyna.bgActors[index].prevTransform.rot.x,
bgCtxt->dyna.bgActors[index].prevTransform.rot.y,
bgCtxt->dyna.bgActors[index].prevTransform.rot.z,
bgCtxt->dyna.bgActors[index].prevTransform.pos.x,
bgCtxt->dyna.bgActors[index].prevTransform.pos.y,
bgCtxt->dyna.bgActors[index].prevTransform.pos.z);
SkinMatrix_SetScaleRotateYRPTranslate(
&prevMatrix, bgCtxt->dyna.bgActors[index].prevTransform.scale.x,
bgCtxt->dyna.bgActors[index].prevTransform.scale.y, bgCtxt->dyna.bgActors[index].prevTransform.scale.z,
bgCtxt->dyna.bgActors[index].prevTransform.rot.x, bgCtxt->dyna.bgActors[index].prevTransform.rot.y,
bgCtxt->dyna.bgActors[index].prevTransform.rot.z, bgCtxt->dyna.bgActors[index].prevTransform.pos.x,
bgCtxt->dyna.bgActors[index].prevTransform.pos.y, bgCtxt->dyna.bgActors[index].prevTransform.pos.z);
if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) return;
if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) {
return;
}
SkinMatrix_SetScaleRotateYRPTranslate(&currMatrix,
bgCtxt->dyna.bgActors[index].curTransform.scale.x,
bgCtxt->dyna.bgActors[index].curTransform.scale.y,
bgCtxt->dyna.bgActors[index].curTransform.scale.z,
bgCtxt->dyna.bgActors[index].curTransform.rot.x,
bgCtxt->dyna.bgActors[index].curTransform.rot.y,
bgCtxt->dyna.bgActors[index].curTransform.rot.z,
bgCtxt->dyna.bgActors[index].curTransform.pos.x,
bgCtxt->dyna.bgActors[index].curTransform.pos.y,
bgCtxt->dyna.bgActors[index].curTransform.pos.z);
SkinMatrix_SetScaleRotateYRPTranslate(
&currMatrix, bgCtxt->dyna.bgActors[index].curTransform.scale.x,
bgCtxt->dyna.bgActors[index].curTransform.scale.y, bgCtxt->dyna.bgActors[index].curTransform.scale.z,
bgCtxt->dyna.bgActors[index].curTransform.rot.x, bgCtxt->dyna.bgActors[index].curTransform.rot.y,
bgCtxt->dyna.bgActors[index].curTransform.rot.z, bgCtxt->dyna.bgActors[index].curTransform.pos.x,
bgCtxt->dyna.bgActors[index].curTransform.pos.y, bgCtxt->dyna.bgActors[index].curTransform.pos.z);
SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos);
@ -47,7 +43,9 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* actor) {
s16 angleChange;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
angleChange = bgCtxt->dyna.bgActors[index].curTransform.rot.y - bgCtxt->dyna.bgActors[index].prevTransform.rot.y;
@ -60,11 +58,13 @@ void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* a
}
void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
DynaPolyActor *meshActor;
DynaPolyActor* meshActor;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return;
}
meshActor = BgCheck_GetActorOfMesh(bgCtxt,index);
meshActor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (meshActor != NULL) {
func_800CAE88(meshActor);
@ -79,26 +79,31 @@ void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* bgCtxt, s32 index, Actor* actor) {
u32 wasUpdated = 0;
DynaPolyActor *meshActor;
DynaPolyActor* meshActor;
if (BgCheck_IsActorMeshIndexValid(index) == 0) return 0;
if (BgCheck_IsActorMeshIndexValid(index) == 0) {
return 0;
}
if (((bgCtxt->dyna.bgActorFlags[index] & 2) != 0) || ((bgCtxt->dyna.bgActorFlags[index] & 1) == 0)) return 0;
if (((bgCtxt->dyna.bgActorFlags[index] & 2) != 0) || ((bgCtxt->dyna.bgActorFlags[index] & 1) == 0)) {
return 0;
}
meshActor = BgCheck_GetActorOfMesh(bgCtxt,index);
meshActor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (meshActor == NULL) return 0;
if (meshActor == NULL) {
return 0;
}
if ((meshActor->unk154 & 1) != 0) {
BgCheck2_UpdateActorPosition(bgCtxt,index,actor);
BgCheck2_UpdateActorPosition(bgCtxt, index, actor);
wasUpdated = 1;
}
if ((meshActor->unk154 & 2) != 0) {
BgCheck2_UpdateActorYRotation(bgCtxt,index,actor);
BgCheck2_UpdateActorYRotation(bgCtxt, index, actor);
wasUpdated = 1;
}
return wasUpdated;
}

View File

@ -33,7 +33,7 @@ void func_800CAEB0(CollisionContext* bgCtxt, s32 index) {
DynaPolyActor* actor;
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (actor != (DynaPolyActor *)0x0) {
if (actor != (DynaPolyActor*)0x0) {
func_800CAE9C(actor);
}
}
@ -46,7 +46,7 @@ void func_800CAEF4(CollisionContext* bgCtxt, s32 index) {
DynaPolyActor* actor;
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
if (actor != (DynaPolyActor *)0x0) {
if (actor != (DynaPolyActor*)0x0) {
func_800CAEE0(actor);
}
}

View File

@ -10,20 +10,22 @@ s32 nop_800E8ED0(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EE0(UNK_TYPE4 param_1) {}
void nop_800E8EE0(UNK_TYPE4 param_1) {
}
s32 nop_800E8EEC(UNK_TYPE4 param_1) {
return 0;
}
void nop_800E8EFC(UNK_TYPE4 param_1) {}
void nop_800E8EFC(UNK_TYPE4 param_1) {
}
s32 func_800E8F08(Vec3s* param_1, Vec3s* param_2) {
Math_SmoothStepToS(&param_1->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->x, 0, 6, 6200, 100);
return 1;
Math_SmoothStepToS(&param_1->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_1->x, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->y, 0, 6, 6200, 100);
Math_SmoothStepToS(&param_2->x, 0, 6, 6200, 100);
return 1;
}
s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4) {
@ -31,30 +33,30 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
s16 targetYaw;
s16 yawDiffFromTarget;
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos,param_2);
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos,param_2) - actor->world.rot.y;
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos, param_2);
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos, param_2) - actor->world.rot.y;
Math_SmoothStepToS(&param_3->x, targetPitch, 6, 2000, 1);
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
param_3->x = (param_3->x < -6000) ? -6000 : ((6000 < param_3->x) ? 6000 : param_3->x);
yawDiffFromTarget = Math_SmoothStepToS(&param_3->y, targetYaw, 6, 2000, 1);
param_3->y = (param_3->y < -8000)? -8000 : ((8000 < param_3->y)? 8000 : param_3->y);
param_3->y = (param_3->y < -8000) ? -8000 : ((8000 < param_3->y) ? 8000 : param_3->y);
if (yawDiffFromTarget != 0) {
if ((param_3->y < 0? -param_3->y : param_3->y) < 8000) {
if ((param_3->y < 0 ? -param_3->y : param_3->y) < 8000) {
return 0;
}
}
Math_SmoothStepToS(&param_4->y, targetYaw - param_3->y, 4, 2000, 1);
param_4->y = (param_4->y < -12000)? -12000 : ((12000 < param_4->y)? 12000 : param_4->y);
param_4->y = (param_4->y < -12000) ? -12000 : ((12000 < param_4->y) ? 12000 : param_4->y);
return 1;
}
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) {
s16 sVar3;
Actor *player;
Actor* player;
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
@ -64,8 +66,8 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3, param_4);
return 0;
}
}
@ -76,13 +78,13 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
func_800E8FA4(actor, &local_14, param_3, param_4);
return 1;
}
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) {
s16 sVar3;
Actor *player;
Actor* player;
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
@ -91,8 +93,8 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
if (0x42ff < (sVar3 < 0 ? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3, param_4);
return 0;
}
}
@ -103,8 +105,7 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
func_800E8FA4(actor, &local_14, param_3, param_4);
return 1;
}

View File

@ -2,5 +2,7 @@
#include <global.h>
void func_80183070(void) {
for(;;) func_80087A6C(1000);
for (;;) {
func_80087A6C(1000);
}
}

View File

@ -11,13 +11,13 @@ u32 D_801D1514[3] = { 0 };
void Game_UpdateFramerateVariables(s32 divisor) {
gFramerateDivisor = divisor;
gFramerateDivisorF = (f32) divisor;
gFramerateDivisorHalf = (f32) (divisor * 0.5f);
gFramerateDivisorThird = (f32) (divisor / 3.0f);
gFramerateDivisorF = (f32)divisor;
gFramerateDivisorHalf = (f32)(divisor * 0.5f);
gFramerateDivisorThird = (f32)(divisor / 3.0f);
}
void Game_SetFramerateDivisor(GameState *gameState, s32 divisor) {
R_UPDATE_RATE = (s16) divisor;
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) {
R_UPDATE_RATE = (s16)divisor;
gameState->framerateDivisor = divisor;
Game_UpdateFramerateVariables(divisor);
}
@ -63,11 +63,11 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
*gfx = _gfx;
}
void Game_Nop80173534(GameState *ctxt) {
void Game_Nop80173534(GameState* ctxt) {
;
}
void GameState_Draw(GameState *ctxt, GraphicsContext *gCtxt) {
void GameState_Draw(GameState* ctxt, GraphicsContext* gCtxt) {
Gfx* nextDisplayList;
Gfx* _polyOpa;
// Unused vars impact regalloc
@ -79,7 +79,7 @@ void GameState_Draw(GameState *ctxt, GraphicsContext *gCtxt) {
gSPDisplayList(gCtxt->overlay.p++, nextDisplayList);
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
GameState_SetFBFilter(&nextDisplayList, (u32) gCtxt->zbuffer);
GameState_SetFBFilter(&nextDisplayList, (u32)gCtxt->zbuffer);
}
if (R_ENABLE_ARENA_DBG < 0) {
@ -99,7 +99,7 @@ lblUnk:; // Label prevents reordering, if(1) around the above block don't seem t
}
}
void Game_ResetSegments(GraphicsContext *gCtxt) {
void Game_ResetSegments(GraphicsContext* gCtxt) {
gSPSegment(gCtxt->polyOpa.p++, 0, 0);
gSPSegment(gCtxt->polyOpa.p++, 0xF, gCtxt->framebuffer);
gSPSegment(gCtxt->polyXlu.p++, 0, 0);
@ -108,7 +108,7 @@ void Game_ResetSegments(GraphicsContext *gCtxt) {
gSPSegment(gCtxt->overlay.p++, 0xF, gCtxt->framebuffer);
}
void func_801736DC(GraphicsContext *gCtxt) {
void func_801736DC(GraphicsContext* gCtxt) {
Gfx* nextDisplayList;
Gfx* _polyOpa;
@ -120,11 +120,11 @@ void func_801736DC(GraphicsContext *gCtxt) {
gCtxt->polyOpa.p = nextDisplayList;
}
void Game_UpdateInput(GameState *ctxt) {
void Game_UpdateInput(GameState* ctxt) {
Padmgr_GetInput(ctxt->input, 1);
}
void Game_Update(GameState *ctxt) {
void Game_Update(GameState* ctxt) {
GraphicsContext* _gCtx;
_gCtx = ctxt->gfxCtx;
@ -138,14 +138,14 @@ void Game_Update(GameState *ctxt) {
}
}
void Game_IncrementFrameCount(GameState *ctxt) {
void Game_IncrementFrameCount(GameState* ctxt) {
Game_Nop80173534(ctxt);
ctxt->frames++;
}
void Game_InitHeap(GameState *ctxt, u32 size) {
GameState *_ctx;
void *buf;
void Game_InitHeap(GameState* ctxt, u32 size) {
GameState* _ctx;
void* buf;
_ctx = ctxt;
buf = Gamealloc_Alloc(&_ctx->alloc, size);
@ -159,14 +159,13 @@ void Game_InitHeap(GameState *ctxt, u32 size) {
assert_fail("../game.c", 0x40B);
}
void Game_ResizeHeap(GameState *ctxt, u32 size)
{
GameAlloc *alloc;
void *buf;
void Game_ResizeHeap(GameState* ctxt, u32 size) {
GameAlloc* alloc;
void* buf;
u32 systemMaxFree;
u32 bytesFree;
u32 bytesAllocated;
void *heapStart;
void* heapStart;
heapStart = ctxt->heap.bufp;
alloc = &ctxt->alloc;
@ -174,23 +173,19 @@ void Game_ResizeHeap(GameState *ctxt, u32 size)
Gamealloc_Free(alloc, heapStart);
StartHeap_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size);
if (!size)
{
if (!size) {
size = systemMaxFree - (sizeof(ArenaNode));
}
if (buf = Gamealloc_Alloc(alloc, size))
{
if (buf = Gamealloc_Alloc(alloc, size)) {
THA_Ct(&ctxt->heap, buf, size);
}
else
{
} else {
THA_Ct(&ctxt->heap, 0, 0);
assert_fail("../game.c", 0x432);
}
}
void Game_StateInit(GameState *ctxt, GameStateFunc gameStateInit, GraphicsContext *gCtxt) {
void Game_StateInit(GameState* ctxt, GameStateFunc gameStateInit, GraphicsContext* gCtxt) {
ctxt->gfxCtx = gCtxt;
ctxt->frames = 0U;
ctxt->main = NULL;
@ -220,7 +215,7 @@ lblUnk:;
osSendMesg(&ctxt->gfxCtx->unk5C, NULL, 1);
}
void Game_StateFini(GameState *ctxt) {
void Game_StateFini(GameState* ctxt) {
func_80172BC0();
func_8019E014();
osRecvMesg(&ctxt->gfxCtx->unk5C, 0, 1);
@ -239,23 +234,23 @@ void Game_StateFini(GameState *ctxt) {
Gamealloc_FreeAll(&ctxt->alloc);
}
GameStateFunc Game_GetNextStateInit(GameState *ctxt) {
GameStateFunc Game_GetNextStateInit(GameState* ctxt) {
return ctxt->nextGameStateInit;
}
u32 Game_GetNextStateSize(GameState *ctxt) {
u32 Game_GetNextStateSize(GameState* ctxt) {
return ctxt->nextGameStateSize;
}
u32 Game_GetShouldContinue(GameState *ctxt) {
u32 Game_GetShouldContinue(GameState* ctxt) {
return ctxt->running;
}
s32 Game_GetHeapFreeSize(GameState *ctxt) {
s32 Game_GetHeapFreeSize(GameState* ctxt) {
return THA_GetSize(&ctxt->heap);
}
s32 func_80173B48(GameState *ctxt) {
s32 func_80173B48(GameState* ctxt) {
s32 result;
result = OS_CYCLES_TO_NSEC(ctxt->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
return result;

View File

@ -2,7 +2,7 @@
#include <global.h>
void Matrix_Init(GameState* state) {
sMatrixStack = (MtxF *)THA_AllocEndAlign16(&state->heap, 0x500);
sMatrixStack = (MtxF*)THA_AllocEndAlign16(&state->heap, 0x500);
sCurrentMatrix = sMatrixStack;
}
@ -11,7 +11,6 @@ void Matrix_Push(void) {
sCurrentMatrix++;
Matrix_MtxFCopy(sCurrentMatrix, prev);
}
void Matrix_Pop(void) {

View File

@ -1,22 +1,22 @@
#include <ultra64.h>
#include <global.h>
#define SLOWLY_STATUS_DONE (1 << 0)
#define SLOWLY_STATUS_DONE (1 << 0)
#define SLOWLY_STATUS_STARTED (1 << 1)
void Slowly_Main(SlowlyTask* slowly) {
slowly->status |= SLOWLY_STATUS_STARTED;
switch (slowly->callbackArgCount) {
case SLOWLY_CALLBACK_NO_ARGS:
slowly->callback0();
break;
case SLOWLY_CALLBACK_ONE_ARG:
slowly->callback1(slowly->callbackArg0);
break;
case SLOWLY_CALLBACK_TWO_ARGS:
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
break;
case SLOWLY_CALLBACK_NO_ARGS:
slowly->callback0();
break;
case SLOWLY_CALLBACK_ONE_ARG:
slowly->callback1(slowly->callbackArg0);
break;
case SLOWLY_CALLBACK_TWO_ARGS:
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
break;
}
slowly->status |= SLOWLY_STATUS_DONE;

View File

@ -45,22 +45,23 @@ void TitleSetup_GameStateResetContext(void) {
YREG(43) = 0xB1;
}
void TitleSetup_InitImpl(GameState *gameState) {
void TitleSetup_InitImpl(GameState* gameState) {
func_80185908();
func_800E9360();
TitleSetup_GameStateResetContext();
gameState->running = 0;
setNextGamestate:; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
setNextGamestate
:; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
}
void TitleSetup_Destroy(GameState *gameState) {
void TitleSetup_Destroy(GameState* gameState) {
;
}
void TitleSetup_Init(GameState *gameState) {
void TitleSetup_Init(GameState* gameState) {
gameState->destroy = &TitleSetup_Destroy;
TitleSetup_InitImpl(gameState);
}

View File

@ -1,11 +1,11 @@
#include <ultra64.h>
#include <global.h>
//From OOT
// From OOT
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
void Actor_PrintLists(ActorContext *actorCtx) {
void Actor_PrintLists(ActorContext* actorCtx) {
ActorListEntry* actorList = &actorCtx->actorList[0];
Actor* actor;
s32 i;
@ -13,7 +13,7 @@ void Actor_PrintLists(ActorContext *actorCtx) {
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf(D_801DC9D0, gMaxActorId);
FaultDrawer_Printf(D_801DC9D8);
for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) {
actor = actorList[i].first;
@ -21,7 +21,6 @@ void Actor_PrintLists(ActorContext *actorCtx) {
FaultDrawer_Printf(D_801DC9F8, i, actor, actor->id, actor->category, D_801DCA10);
actor = actor->next;
}
}
}
@ -40,10 +39,9 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
if (dy >= -50.0f && dy < 500.0f) {
f32 shadowScale;
MtxF mtx;
OPEN_DISPS(globalCtx->state.gfxCtx);
POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C);
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
@ -66,12 +64,11 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
}
shadowScale = 1.0f - (dy * D_801DCA14);
shadowScale = 1.0f - (dy * D_801DCA14);
shadowScale *= actor->shape.shadowScale;
Matrix_Scale(shadowScale * actor->scale.x, 1.0f, shadowScale * actor->scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@ -129,8 +126,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
Matrix_RotateY(sp58, MTXMODE_APPLY);
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, D_04075B30);
CLOSE_DISPS(globalCtx->state.gfxCtx);
@ -178,7 +174,7 @@ u32 Flags_GetSwitch(GlobalContext* ctxt, s32 flag) {
return 0;
}
void Actor_SetSwitchFlag(GlobalContext* ctxt, s32 flag){
void Actor_SetSwitchFlag(GlobalContext* ctxt, s32 flag) {
if (flag >= 0 && flag < 0x80) {
ctxt->actorCtx.switchFlags[(flag & -0x20) >> 5] |= 1 << (flag & 0x1F);
}
@ -250,7 +246,8 @@ void Actor_TitleCardContextInit(GlobalContext* ctxt, TitleCardContext* titleCtxt
titleCtxt->alpha = 0;
}
void Actor_TitleCardCreate(GlobalContext* ctxt, TitleCardContext* titleCtxt, u32 texture, s16 param_4, s16 param_5, u8 param_6, u8 param_7) {
void Actor_TitleCardCreate(GlobalContext* ctxt, TitleCardContext* titleCtxt, u32 texture, s16 param_4, s16 param_5,
u8 param_6, u8 param_7) {
titleCtxt->texture = texture;
titleCtxt->unk4 = param_4;
titleCtxt->unk6 = param_5;
@ -404,7 +401,7 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
}
void Actor_SetVelocityXYRotation(Actor* actor) {
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
@ -416,7 +413,7 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
}
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
@ -740,9 +737,9 @@ void Actor_FreeOverlay(ActorOverlay* entry) {
if (entry->nbLoaded == 0) {
ramAddr = entry->loadedRamAddr;
if (ramAddr != NULL) {
//Bit 1 - always loaded
// Bit 1 - always loaded
if ((entry->allocType & 2) == 0) {
//Bit 0 - don't alloc memory
// Bit 0 - don't alloc memory
if ((entry->allocType & 1) != 0) {
entry->loadedRamAddr = NULL;
} else {

View File

@ -2,10 +2,10 @@
#include <global.h>
#include "initvars.h"
#define ACTOR_OVERLAY(name, allocType) \
{ \
(u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \
#define ACTOR_OVERLAY(name, allocType) \
{ \
(u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \
}
#define ACTOR_OVERLAY_INTERNAL(name, allocType) \

View File

@ -431,4 +431,3 @@ f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Acto
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800CA9D0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800CAA14.asm")

View File

@ -55,7 +55,7 @@ DamageTable sDamageTablePresets[] = {
* is out of range.
*/
DamageTable* DamageTable_Get(s32 index) {
if (index < 0 || index > ARRAY_COUNT(sDamageTablePresets)-1) {
if (index < 0 || index > ARRAY_COUNT(sDamageTablePresets) - 1) {
return NULL;
}

View File

@ -329,8 +329,8 @@ s32 Collider_SetJntSphToActor(GlobalContext* ctxt, ColliderJntSph* collider, Col
return 0;
}
for (destElem = collider->elements, srcElem = src->elements;
destElem < &collider->elements[collider->count]; destElem++, srcElem++) {
for (destElem = collider->elements, srcElem = src->elements; destElem < &collider->elements[collider->count];
destElem++, srcElem++) {
Collider_InitJntSphElement(ctxt, destElem);
Collider_SetJntSphElement(ctxt, destElem, srcElem);
}

View File

@ -17,7 +17,8 @@ void EffFootmark_Init(GlobalContext* ctxt) {
}
}
void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red,
u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
s32 i;
EffFootmark* footmark;
EffFootmark* destination = NULL;
@ -52,7 +53,7 @@ void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8
if (destination == NULL) {
destination = oldest;
}
Matrix_MtxFCopy(&destination->displayMatrix,displayMatrix);
Matrix_MtxFCopy(&destination->displayMatrix, displayMatrix);
destination->actor = actor;
destination->location.x = location->x;
destination->location.y = location->y;
@ -98,7 +99,7 @@ void EffFootmark_Update(GlobalContext* ctxt) {
void EffFootmark_Draw(GlobalContext* ctxt) {
EffFootmark* footmark;
s32 i;
GraphicsContext *gfxCtx = ctxt->state.gfxCtx;
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
func_8012C448(ctxt->state.gfxCtx);
@ -111,10 +112,10 @@ void EffFootmark_Draw(GlobalContext* ctxt) {
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue,
footmark->alpha >> 8);
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC288);
}
}
}

View File

@ -112,7 +112,9 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
i = 0;
}
if (i == EffectSS2Info.searchIndex) break;
if (i == EffectSS2Info.searchIndex) {
break;
}
}
if (ret == 1) {
@ -137,7 +139,6 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
return ret;
}
}
}
*tableEntry = i;
@ -183,7 +184,8 @@ void EffectSs_Spawn(GlobalContext* ctxt, s32 type, s32 priority, void* initData)
return;
}
load_and_relocate_overlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, entry->loadedRamAddr);
load_and_relocate_overlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd,
entry->loadedRamAddr);
}
// XXX this should use a0, but it doesn't
@ -262,13 +264,9 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
for (i = 0; i < EffectSS2Info.size; i++) {
if (EffectSS2Info.data_table[i].life > -1) {
if (EffectSS2Info.data_table[i].pos.x > 32000 ||
EffectSS2Info.data_table[i].pos.x < -32000 ||
EffectSS2Info.data_table[i].pos.y > 32000 ||
EffectSS2Info.data_table[i].pos.y < -32000 ||
EffectSS2Info.data_table[i].pos.z > 32000 ||
EffectSS2Info.data_table[i].pos.z < -32000
) {
if (EffectSS2Info.data_table[i].pos.x > 32000 || EffectSS2Info.data_table[i].pos.x < -32000 ||
EffectSS2Info.data_table[i].pos.y > 32000 || EffectSS2Info.data_table[i].pos.y < -32000 ||
EffectSS2Info.data_table[i].pos.z > 32000 || EffectSS2Info.data_table[i].pos.z < -32000) {
EffectSS_Delete(&EffectSS2Info.data_table[i]);
} else {
EffectSS_DrawParticle(ctxt, i);

View File

@ -343,7 +343,6 @@ void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor);
}
extern Color_RGBA8 D_801AE3D8;
extern Color_RGBA8 D_801AE3DC;
@ -782,7 +781,8 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc
// EffectSsEnIce Spawn Functions
void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f * pos, Color_RGBA8 * prim, Color_RGBA8 * env, f32 scale) {
void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Color_RGBA8* prim,
Color_RGBA8* env, f32 scale) {
EffectSsEnIceInitParams initParams;
@ -936,8 +936,8 @@ 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) {
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;
Math_Vec3f_Copy(&initParams.pos, pos);
@ -960,13 +960,15 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
extern Color_RGBA8 D_801AE48C;
extern Color_RGBA8 D_801AE490[4];
void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex) {
void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s32 colorIndex) {
EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &D_801AE48C, &D_801AE490[colorIndex], scale, scaleStep, 9);
}
// EffectSsDeadDd Spawn Functions
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) {
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) {
EffectSsDeadDdInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);

View File

@ -30,13 +30,16 @@ ActorInit En_Item00_InitVars = {
ColliderCylinderInit enItem00CylinderInit = {
{ COLTYPE_NONE, AT_NONE, AC_ON | AT_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER },
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000010, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE },
{ ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000010, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_NONE },
{ 10, 30, 0, { 0, 0, 0 } },
};
InitChainEntry enItem00InitVars[1] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP)
};
InitChainEntry enItem00InitVars[1] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP) };
void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale) {
Actor_SetObjectSegment(globalCtx, &this->actor);
@ -79,89 +82,89 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk150 = 1;
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED:
Actor_SetScale(&this->actor, 0.015f);
this->unk154 = 0.015f;
shadowOffset = 750.0f;
break;
case ITEM00_SMALL_KEY:
this->unk150 = 0;
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 350.0f;
break;
case ITEM00_HEART_PIECE:
case ITEM00_HEART_CONTAINER:
this->unk150 = 0;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
shadowOffset = 650.0f;
if (this->actor.params == ITEM00_HEART_CONTAINER) {
sp30 = -1;
}
break;
case ITEM00_HEART:
this->actor.home.rot.z = randPlusMinusPoint5Scaled(65535.0f);
shadowOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
break;
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
case ITEM00_ARROWS_40:
case ITEM00_ARROWS_50:
Actor_SetScale(&this->actor, 0.035f);
this->unk154 = 0.035f;
shadowOffset = 250.0f;
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
case ITEM00_NUTS_1:
case ITEM00_STICK:
case ITEM00_MAGIC_SMALL:
case ITEM00_NUTS_10:
case ITEM00_BOMBS_0:
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 320.0f;
break;
case ITEM00_MAGIC_LARGE:
Actor_SetScale(&this->actor, 0.044999998f);
this->unk154 = 0.044999998f;
shadowOffset = 320.0f;
break;
case ITEM00_RUPEE_ORANGE:
Actor_SetScale(&this->actor, 0.044999998f);
this->unk154 = 0.044999998f;
shadowOffset = 750.0f;
break;
case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 750.0f;
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
shadowOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f);
this->unk154 = 0.01f;
break;
case ITEM00_SHIELD_HERO:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
case ITEM00_MAP:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MAP);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
case ITEM00_COMPASS:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_COMPASS);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
default:
break;
case ITEM00_RUPEE_GREEN:
case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED:
Actor_SetScale(&this->actor, 0.015f);
this->unk154 = 0.015f;
shadowOffset = 750.0f;
break;
case ITEM00_SMALL_KEY:
this->unk150 = 0;
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 350.0f;
break;
case ITEM00_HEART_PIECE:
case ITEM00_HEART_CONTAINER:
this->unk150 = 0;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
shadowOffset = 650.0f;
if (this->actor.params == ITEM00_HEART_CONTAINER) {
sp30 = -1;
}
break;
case ITEM00_HEART:
this->actor.home.rot.z = randPlusMinusPoint5Scaled(65535.0f);
shadowOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
break;
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
case ITEM00_ARROWS_40:
case ITEM00_ARROWS_50:
Actor_SetScale(&this->actor, 0.035f);
this->unk154 = 0.035f;
shadowOffset = 250.0f;
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
case ITEM00_NUTS_1:
case ITEM00_STICK:
case ITEM00_MAGIC_SMALL:
case ITEM00_NUTS_10:
case ITEM00_BOMBS_0:
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 320.0f;
break;
case ITEM00_MAGIC_LARGE:
Actor_SetScale(&this->actor, 0.044999998f);
this->unk154 = 0.044999998f;
shadowOffset = 320.0f;
break;
case ITEM00_RUPEE_ORANGE:
Actor_SetScale(&this->actor, 0.044999998f);
this->unk154 = 0.044999998f;
shadowOffset = 750.0f;
break;
case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 750.0f;
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
shadowOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f);
this->unk154 = 0.01f;
break;
case ITEM00_SHIELD_HERO:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
case ITEM00_MAP:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MAP);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
case ITEM00_COMPASS:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_COMPASS);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
break;
default:
break;
}
this->unk14E = 0;
@ -189,61 +192,61 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.gravity = 0.0f;
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
Item_Give(globalCtx, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_ORANGE);
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
break;
case ITEM00_SMALL_KEY:
Item_Give(globalCtx, ITEM_KEY_SMALL);
break;
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
default:
break;
case ITEM00_RUPEE_GREEN:
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
Item_Give(globalCtx, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_ORANGE);
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
break;
case ITEM00_SMALL_KEY:
Item_Give(globalCtx, ITEM_KEY_SMALL);
break;
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
default:
break;
}
if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, globalCtx) == 0)) {
@ -271,9 +274,11 @@ void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx) {
}
void func_800A640C(EnItem00* this, GlobalContext* ctxt) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk152 < 0)) || (this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk152 < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) && (this->actor.params < ITEM00_BOMBS_0)) {
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) &&
(this->actor.params < ITEM00_BOMBS_0)) {
if (this->unk152 == -1) {
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500)) {
this->unk152 = -2;
@ -295,13 +300,15 @@ void func_800A640C(EnItem00* this, GlobalContext* ctxt) {
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
if (this->unk14C == 0) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && (this->actor.params != ITEM00_HEART_CONTAINER)) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) &&
(this->actor.params != ITEM00_HEART_CONTAINER)) {
this->unk14C = -1;
}
}
if (this->unk152 == 0) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && (this->actor.params != ITEM00_HEART_CONTAINER)) {
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) &&
(this->actor.params != ITEM00_HEART_CONTAINER)) {
Actor_MarkForDeath(&this->actor);
}
}
@ -355,14 +362,17 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
this->actor.velocity.y = -1.5f;
}
this->actor.home.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f);
this->actor.world.pos.x += (Math_CosS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)));
this->actor.world.pos.z += (Math_SinS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)));
this->actor.world.pos.x +=
(Math_CosS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)));
this->actor.world.pos.z +=
(Math_SinS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)));
}
}
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y += 960;
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) && (this->actor.params != ITEM00_BOMBS_0)) {
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) &&
(this->actor.params != ITEM00_BOMBS_0)) {
this->actor.world.rot.x -= 700;
this->actor.shape.rot.y += 400;
this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000;
@ -460,7 +470,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
Collision_CylinderMoveToActor(&this->actor, &this->collider);
Collision_AddAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base);
if ((this->actor.params == ITEM00_SHIELD_HERO) || (this->actor.params == ITEM00_MAP) || (this->actor.params == ITEM00_COMPASS)) {
if ((this->actor.params == ITEM00_SHIELD_HERO) || (this->actor.params == ITEM00_MAP) ||
(this->actor.params == ITEM00_COMPASS)) {
this->actor.shape.yOffset = fabsf(Math_CosS(this->actor.shape.rot.x) * 37.0f);
}
@ -468,8 +479,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
return;
}
if (!((sp38 != 0) && (this->actor.xzDistToPlayer <= 60.0f) && (this->actor.yDistToPlayer >= -100.0f) && (this->actor.yDistToPlayer <= 100.0f)) &&
!((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) && (this->actor.yDistToPlayer <= 50.0f))) {
if (!((sp38 != 0) && (this->actor.xzDistToPlayer <= 60.0f) && (this->actor.yDistToPlayer >= -100.0f) &&
(this->actor.yDistToPlayer <= 100.0f)) &&
!((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) &&
(this->actor.yDistToPlayer <= 50.0f))) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
return;
}
@ -480,84 +493,84 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_ORANGE);
break;
case ITEM00_STICK:
getItemId = GI_STICKS_1;
break;
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
break;
case ITEM00_SMALL_KEY:
getItemId = GI_KEY_SMALL;
break;
case ITEM00_HEART_PIECE:
getItemId = GI_HEART_PIECE;
break;
case ITEM00_HEART_CONTAINER:
getItemId = GI_HEART_CONTAINER;
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
break;
case ITEM00_SHIELD_HERO:
getItemId = GI_SHIELD_HERO;
break;
case ITEM00_MAP:
getItemId = GI_MAP;
break;
case ITEM00_COMPASS:
getItemId = GI_COMPASS;
break;
default:
break;
case ITEM00_RUPEE_GREEN:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_ORANGE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_ORANGE);
break;
case ITEM00_STICK:
getItemId = GI_STICKS_1;
break;
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
break;
case ITEM00_SMALL_KEY:
getItemId = GI_KEY_SMALL;
break;
case ITEM00_HEART_PIECE:
getItemId = GI_HEART_PIECE;
break;
case ITEM00_HEART_CONTAINER:
getItemId = GI_HEART_CONTAINER;
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
break;
case ITEM00_SHIELD_HERO:
getItemId = GI_SHIELD_HERO;
break;
case ITEM00_MAP:
getItemId = GI_MAP;
break;
case ITEM00_COMPASS:
getItemId = GI_COMPASS;
break;
default:
break;
}
if (getItemId != GI_NONE) {
@ -567,19 +580,19 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
switch (this->actor.params) {
case ITEM00_HEART_PIECE:
case ITEM00_HEART_CONTAINER:
case ITEM00_SMALL_KEY:
case ITEM00_SHIELD_HERO:
case ITEM00_MAP:
case ITEM00_COMPASS:
if (Actor_HasParent(&this->actor, globalCtx)) {
Actor_SetCollectibleFlag(globalCtx, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
}
return;
default:
break;
case ITEM00_HEART_PIECE:
case ITEM00_HEART_CONTAINER:
case ITEM00_SMALL_KEY:
case ITEM00_SHIELD_HERO:
case ITEM00_MAP:
case ITEM00_COMPASS:
if (Actor_HasParent(&this->actor, globalCtx)) {
Actor_SetCollectibleFlag(globalCtx, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
}
return;
default:
break;
}
if ((this->actor.params <= ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_RUPEE_ORANGE)) {
@ -623,63 +636,63 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (!(this->unk14E & this->unk150)) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED:
case ITEM00_RUPEE_ORANGE:
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, globalCtx);
break;
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, globalCtx);
break;
case ITEM00_HEART_CONTAINER:
EnItem00_DrawHeartContainer(this, globalCtx);
break;
case ITEM00_HEART:
if (this->unk152 < 0) {
if (this->unk152 == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
this->unk152 = -2;
}
} else {
Matrix_Scale(16.0f, 16.0f, 16.0f, 1);
GetItem_Draw(globalCtx, 8);
}
case ITEM00_RUPEE_GREEN:
case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED:
case ITEM00_RUPEE_ORANGE:
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, globalCtx);
break;
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, globalCtx);
break;
case ITEM00_HEART_CONTAINER:
EnItem00_DrawHeartContainer(this, globalCtx);
break;
case ITEM00_HEART:
if (this->unk152 < 0) {
if (this->unk152 == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectSegment(globalCtx, &this->actor);
this->unk152 = -2;
}
} else {
Matrix_Scale(16.0f, 16.0f, 16.0f, 1);
GetItem_Draw(globalCtx, 8);
}
break;
}
case ITEM00_BOMBS_A:
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
case ITEM00_ARROWS_40:
case ITEM00_ARROWS_50:
case ITEM00_BOMBS_B:
case ITEM00_NUTS_1:
case ITEM00_STICK:
case ITEM00_MAGIC_LARGE:
case ITEM00_MAGIC_SMALL:
case ITEM00_SMALL_KEY:
case ITEM00_NUTS_10:
case ITEM00_BOMBS_0:
EnItem00_DrawSprite(this, globalCtx);
break;
case ITEM00_SHIELD_HERO:
GetItem_Draw(globalCtx, GID_SHIELD_HERO);
break;
case ITEM00_MAP:
GetItem_Draw(globalCtx, GID_DUNGEON_MAP);
break;
case ITEM00_COMPASS:
GetItem_Draw(globalCtx, GID_COMPASS);
case ITEM00_MASK:
case ITEM00_FLEXIBLE:
case ITEM00_3_HEARTS:
case ITEM00_NOTHING:
case ITEM00_BIG_FAIRY:
break;
}
case ITEM00_BOMBS_A:
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
case ITEM00_ARROWS_40:
case ITEM00_ARROWS_50:
case ITEM00_BOMBS_B:
case ITEM00_NUTS_1:
case ITEM00_STICK:
case ITEM00_MAGIC_LARGE:
case ITEM00_MAGIC_SMALL:
case ITEM00_SMALL_KEY:
case ITEM00_NUTS_10:
case ITEM00_BOMBS_0:
EnItem00_DrawSprite(this, globalCtx);
break;
case ITEM00_SHIELD_HERO:
GetItem_Draw(globalCtx, GID_SHIELD_HERO);
break;
case ITEM00_MAP:
GetItem_Draw(globalCtx, GID_DUNGEON_MAP);
break;
case ITEM00_COMPASS:
GetItem_Draw(globalCtx, GID_COMPASS);
case ITEM00_MASK:
case ITEM00_FLEXIBLE:
case ITEM00_3_HEARTS:
case ITEM00_NOTHING:
case ITEM00_BIG_FAIRY:
break;
}
}
}
@ -728,7 +741,7 @@ UNK_PTR D_801ADF44[12] = {
&D_040617C0, // Magic (Large)
&D_0405FFC0, // Magic (Small)
NULL,
&D_0405F7C0 // Small Key
&D_0405F7C0 // Small Key
};
void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) {
@ -800,8 +813,11 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
s16 func_800A7650(s16 dropId) {
s16 maxLife;
if ((((dropId == ITEM00_BOMBS_A) || (dropId == ITEM00_BOMBS_0) || (dropId == ITEM00_BOMBS_B)) && (gSaveContext.perm.inv.items[D_801C207E] == 0xFF)) ||
(((dropId == ITEM00_ARROWS_10) || (dropId == ITEM00_ARROWS_30) || (dropId == ITEM00_ARROWS_40) || (dropId == ITEM00_ARROWS_50)) && (gSaveContext.perm.inv.items[D_801C2079] == 0xFF)) ||
if ((((dropId == ITEM00_BOMBS_A) || (dropId == ITEM00_BOMBS_0) || (dropId == ITEM00_BOMBS_B)) &&
(gSaveContext.perm.inv.items[D_801C207E] == 0xFF)) ||
(((dropId == ITEM00_ARROWS_10) || (dropId == ITEM00_ARROWS_30) || (dropId == ITEM00_ARROWS_40) ||
(dropId == ITEM00_ARROWS_50)) &&
(gSaveContext.perm.inv.items[D_801C2079] == 0xFF)) ||
(((dropId == ITEM00_MAGIC_LARGE) || (dropId == ITEM00_MAGIC_SMALL)) && (gSaveContext.perm.unk24.unk14 == 0))) {
return ITEM00_NO_DROP;
}
@ -846,16 +862,20 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
} else if (paramFF == ITEM00_MUSHROOM_CLOUD) {
param7F00 >>= 8;
if (!Actor_GetCollectibleFlag(globalCtx, param7F00)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, param7F00);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0,
0, param7F00);
}
} else if (((paramFF == ITEM00_FLEXIBLE) || ((params & 0xFF) == ITEM00_BIG_FAIRY)) && (param10000 == 0)) {
if ((params & 0xFF) == ITEM00_FLEXIBLE) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
if (!Actor_GetCollectibleFlag(globalCtx, (param7F00 >> 8) & 0x7F)) {
func_800F0568(globalCtx, spawnPos, 0x28, 0x28E7);
}
} else {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
spawnedActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
if (param20000 == 0) {
if (!Actor_GetCollectibleFlag(globalCtx, (param7F00 >> 8) & 0x7F)) {
func_800F0568(globalCtx, spawnPos, 0x28, 0x28E7);
@ -867,7 +887,8 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
params = func_800A7650(params & 0xFF);
}
if (params != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
if ((spawnedActor != NULL) && (param8000 == 0)) {
if (param10000 == 0) {
spawnedActor->actor.velocity.y = 8.0f;
@ -880,7 +901,9 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 pa
Actor_SetScale(spawnedActor, 0.0f);
spawnedActor->actionFunc = func_800A6780;
spawnedActor->unk152 = 0xDC;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && (spawnedActor->actor.params != ITEM00_HEART_PIECE) && (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
spawnedActor->actor.room = -1;
}
spawnedActor->actor.flags |= 0x0010;
@ -914,9 +937,12 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, u32 para
if (((params == ITEM00_FLEXIBLE) || (params == ITEM00_BIG_FAIRY)) && (param10000 == 0)) {
if (params == ITEM00_FLEXIBLE) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
} else {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
spawnedActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
}
if (Actor_GetCollectibleFlag(globalCtx, (param7F00 >> 8) & 0x7F) == 0) {
func_800F0568(globalCtx, spawnPos, 0x28, 0x28E7);
@ -924,7 +950,8 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, u32 para
} else {
params = func_800A7650(params);
if (params != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, params | param8000 | param7F00);
if (spawnedActor != NULL) {
if (param8000 == 0) {
spawnedActor->velocity.y = 0.0f;
@ -948,43 +975,79 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, u32 para
#endif
u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = {
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_MASK, ITEM00_MASK, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED,
ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_30, ITEM00_ARROWS_30, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE,
ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NUTS_1, ITEM00_NUTS_1, ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_STICK, ITEM00_STICK, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_30, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_STICK, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_HEART, ITEM00_HEART, ITEM00_MAGIC_SMALL, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A,
ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_HEART,
ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE,
ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP,
ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_MASK,
ITEM00_MASK, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART,
ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_RUPEE_BLUE,
ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE,
ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED,
ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED,
ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10,
ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10,
ITEM00_ARROWS_30, ITEM00_ARROWS_30, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE,
ITEM00_MAGIC_LARGE, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_BOMBS_A,
ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A,
ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL,
ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL,
ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL,
ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE,
ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NUTS_1, ITEM00_NUTS_1,
ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_STICK,
ITEM00_STICK, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP,
ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_30, ITEM00_BOMBS_A, ITEM00_NO_DROP,
ITEM00_STICK, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_HEART, ITEM00_HEART,
ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_HEART, ITEM00_HEART, ITEM00_MAGIC_SMALL,
ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP,
};
u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
#ifdef NON_MATCHING
@ -1029,7 +1092,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
} else if ((fromActor->dropFlag & 2) != 0) {
dropId = ITEM00_HEART;
params = 0x10;
} else if ((fromActor->dropFlag & 0x20) != 0) {
} else if ((fromActor->dropFlag & 0x20) != 0) {
dropId = ITEM00_RUPEE_PURPLE;
}
dropQuantity = 1;
@ -1038,7 +1101,8 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (dropId == ITEM00_FLEXIBLE) {
if (gSaveContext.perm.unk24.currentLife < 0x11) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 2);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, 2);
func_800F0568(globalCtx, spawnPos, 0x28, 0x28E7);
return;
}
@ -1051,11 +1115,12 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
params = 0x10;
dropId = ITEM00_HEART;
dropQuantity = 1;
} else if ((gSaveContext.perm.unk24.unk14 != 0) && (gSaveContext.perm.unk24.currentMagic == 0)) {
} else if ((gSaveContext.perm.unk24.unk14 != 0) && (gSaveContext.perm.unk24.currentMagic == 0)) {
params = 0xD0;
dropId = ITEM00_MAGIC_LARGE;
dropQuantity = 1;
} else if ((gSaveContext.perm.unk24.unk14 != 0) && ((gSaveContext.perm.unk24.unk14 >> 1) >= gSaveContext.perm.unk24.currentMagic)) {
} else if ((gSaveContext.perm.unk24.unk14 != 0) &&
((gSaveContext.perm.unk24.unk14 >> 1) >= gSaveContext.perm.unk24.currentMagic)) {
params = 0xD0;
dropId = ITEM00_MAGIC_LARGE;
dropQuantity = 1;
@ -1067,7 +1132,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
params = 0xB0;
dropId = ITEM00_BOMBS_A;
dropQuantity = 1;
} else if (gSaveContext.perm.unk24.unk16 < 11) {
} else if (gSaveContext.perm.unk24.unk14 < 11) {
params = 0xA0;
dropId = ITEM00_RUPEE_RED;
dropQuantity = 1;
@ -1079,7 +1144,8 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (param8000 == 0) {
dropId = func_800A7650(dropId);
if (dropId != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != 0) && (dropId != ITEM00_NO_DROP)) {
spawnedActor->actor.velocity.y = 8.0f;
spawnedActor->actor.speedXZ = 2.0f;
@ -1088,7 +1154,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
Actor_SetScale(spawnedActor, 0.0f);
spawnedActor->actionFunc = func_800A6780;
spawnedActor->actor.flags = spawnedActor->actor.flags | 0x10;
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && (spawnedActor->actor.params != ITEM00_HEART_PIECE) && (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
spawnedActor->actor.room = -1;
}
spawnedActor->unk152 = 220;
@ -1107,40 +1175,14 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_en_item00/Item_DropCollectibleRandom.asm")
#endif
s32 D_801AE194[32] = {
ITEM00_NO_DROP,
ITEM00_RUPEE_GREEN,
ITEM00_RUPEE_BLUE,
ITEM00_NO_DROP,
ITEM00_RUPEE_RED,
ITEM00_RUPEE_PURPLE,
ITEM00_NO_DROP,
ITEM00_RUPEE_ORANGE,
ITEM00_COMPASS,
ITEM00_MUSHROOM_CLOUD,
ITEM00_HEART,
ITEM00_3_HEARTS,
ITEM00_HEART_PIECE,
ITEM00_HEART_CONTAINER,
ITEM00_MAGIC_SMALL,
ITEM00_MAGIC_LARGE,
ITEM00_FLEXIBLE,
ITEM00_BIG_FAIRY,
ITEM00_NO_DROP,
ITEM00_NUTS_10,
ITEM00_NO_DROP,
ITEM00_BOMBS_A,
ITEM00_NO_DROP,
ITEM00_NO_DROP,
ITEM00_NO_DROP,
ITEM00_STICK,
ITEM00_NO_DROP,
ITEM00_NO_DROP,
ITEM00_NO_DROP,
ITEM00_NO_DROP,
ITEM00_ARROWS_10,
ITEM00_ARROWS_30
};
s32 D_801AE194[32] = { ITEM00_NO_DROP, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP,
ITEM00_RUPEE_RED, ITEM00_RUPEE_PURPLE, ITEM00_NO_DROP, ITEM00_RUPEE_ORANGE,
ITEM00_COMPASS, ITEM00_MUSHROOM_CLOUD, ITEM00_HEART, ITEM00_3_HEARTS,
ITEM00_HEART_PIECE, ITEM00_HEART_CONTAINER, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE,
ITEM00_FLEXIBLE, ITEM00_BIG_FAIRY, ITEM00_NO_DROP, ITEM00_NUTS_10,
ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_STICK, ITEM00_NO_DROP, ITEM00_NO_DROP,
ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_30 };
s32 func_800A8150(s32 index) {
if ((index < 0) || (index >= ARRAY_COUNT(D_801AE194))) {

View File

@ -1,13 +1,13 @@
#include <ultra64.h>
#include <global.h>
void Kanfont_Nop800F4F40(GlobalContext* ctxt, UNK_TYPE param_2, UNK_TYPE param_3) {}
void Kanfont_Nop800F4F40(GlobalContext* ctxt, UNK_TYPE param_2, UNK_TYPE param_3) {
}
void Kanfont_LoadAsciiChar(GlobalContext* ctxt, u8 character, s32 iParm3) {
// UB to convert pointer to u32
DmaMgr_SendRequest0((void*)((u32)&ctxt->msgCtx.font.unk0[(ctxt->msgCtx).unk11EF0] + iParm3),
(u32)_nes_font_staticSegmentRomStart + character * 0x80 - 0x1000,
0x80);
(u32)_nes_font_staticSegmentRomStart + character * 0x80 - 0x1000, 0x80);
}
void Kanfont_LoadMessageBoxEnd(Font* font, u16 type) {
@ -28,7 +28,9 @@ void Kanfont_LoadOrderedFont(Font* font) {
}
// UB to convert pointer to u32
DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, 0x80);
if (kanfontOrdering[codePointIndex] == 140) break;
if (kanfontOrdering[codePointIndex] == 140) {
break;
}
codePointIndex++;
}
}

View File

@ -568,15 +568,15 @@ void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep) {
}
void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep) {
f32 f0 = *pValue * scale;
f32 f0 = *pValue * scale;
if (maxStep < f0) {
f0 = maxStep;
} else if (f0 < -maxStep) {
f0 = -maxStep;
}
if (maxStep < f0) {
f0 = maxStep;
} else if (f0 < -maxStep) {
f0 = -maxStep;
}
*pValue = *pValue - f0;
*pValue = *pValue - f0;
}
s32 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep) {
@ -695,7 +695,8 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed) {
return f0;
}
void Lib_Nop801004FC(void) {}
void Lib_Nop801004FC(void) {
}
void* Lib_SegmentedToVirtual(void* ptr) {
return SEGMENTED_TO_VIRTUAL(ptr);

View File

@ -132,10 +132,8 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global
posF.x = params->point.x;
posF.y = params->point.y;
posF.z = params->point.z;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0,&posF,&adjustedPos);
if ((adjustedPos.z > -radiusF) &&
(600 + radiusF > adjustedPos.z) &&
(400 > fabsf(adjustedPos.x) - radiusF) &&
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0, &posF, &adjustedPos);
if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) &&
(400 > fabsf(adjustedPos.y) - radiusF)) {
light = Lights_FindSlot(lights);
if (light != NULL) {
@ -190,7 +188,8 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) {
*/
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalContext* globalCtx) {
static LightsPosBindFunc posBindFuncs[] = { Lights_BindPoint, Lights_BindDirectional, Lights_BindPoint };
static LightsBindFunc dirBindFuncs[] = { Lights_BindPointWithReference, Lights_BindDirectional, Lights_BindPointWithReference };
static LightsBindFunc dirBindFuncs[] = { Lights_BindPointWithReference, Lights_BindDirectional,
Lights_BindPointWithReference };
if (listHead != NULL) {
if ((refPos == NULL) && (lights->enablePosLights == 1)) {
@ -233,7 +232,9 @@ void Lights_FreeNode(LightNode* light) {
if (light != NULL) {
sLightsBuffer.numOccupied--;
light->info = NULL;
sLightsBuffer.searchIndex = (light - sLightsBuffer.lights) / (s32)sizeof(LightNode); //! @bug Due to pointer arithmetic, the division is unnecessary
sLightsBuffer.searchIndex =
(light - sLightsBuffer.lights) /
(s32)sizeof(LightNode); //! @bug Due to pointer arithmetic, the division is unnecessary
}
}
@ -262,7 +263,7 @@ void func_80102544(LightContext* lightCtx, u8 a1, u8 a2, u8 a3, s16 numLights, s
* Allocate a new Lights group and initilize the ambient color with that provided by LightContext
*/
Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) {
return Lights_New(gfxCtx, lightCtx->ambient.r, lightCtx->ambient.g, lightCtx->ambient.b);
return Lights_New(gfxCtx, lightCtx->ambient.r, lightCtx->ambient.g, lightCtx->ambient.b);
}
void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) {
@ -317,12 +318,13 @@ void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx,
}
}
Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB, u8 numLights, u8 r, u8 g, u8 b, s8 x, s8 y, s8 z) {
Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambientB, u8 numLights, u8 r, u8 g,
u8 b, s8 x, s8 y, s8 z) {
Lights* lights;
s32 i;
// TODO allocation should be a macro
lights = (Lights *)((int)gfxCtx->polyOpa.d - sizeof(Lights));
lights = (Lights*)((int)gfxCtx->polyOpa.d - sizeof(Lights));
gfxCtx->polyOpa.d = (void*)lights;
lights->l.a.l.col[0] = lights->l.a.l.colc[0] = ambientR;
@ -340,7 +342,7 @@ Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8
lights->l.l[i].l.dir[2] = z;
}
Lights_Draw(lights,gfxCtx);
Lights_Draw(lights, gfxCtx);
return lights;
}
@ -349,7 +351,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient
Lights* lights;
// TODO allocation should be a macro
lights = (Lights *)((int)gfxCtx->polyOpa.d - sizeof(Lights));
lights = (Lights*)((int)gfxCtx->polyOpa.d - sizeof(Lights));
gfxCtx->polyOpa.d = (void*)lights;
lights->l.a.l.col[0] = ambientR;
@ -409,10 +411,11 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
dl = func_8012C7FC(POLY_XLU_DISP);
gSPSetOtherMode(dl++, G_SETOTHERMODE_H, 4, 4, 0x00000080); //! This doesn't resolve to any of the macros in gdi.h
gSPSetOtherMode(dl++, G_SETOTHERMODE_H, 4, 4,
0x00000080); //! This doesn't resolve to any of the macros in gdi.h
gDPSetCombineLERP(dl++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0,
0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
gDPSetCombineLERP(dl++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0);
gSPDisplayList(dl++, D_04029CB0);
@ -425,9 +428,10 @@ 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_Scale(scale,scale,scale, MTXMODE_APPLY);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(dl++, D_04029CF0);
}

View File

@ -40,7 +40,8 @@ void PreNMI_Main(PreNMIContext* prenmiCtx) {
prenmiCtx->state.unkA3 = 1;
}
void PreNMI_Destroy(PreNMIContext* prenmiCtx) {}
void PreNMI_Destroy(PreNMIContext* prenmiCtx) {
}
void PreNMI_Init(PreNMIContext* prenmiCtx) {
prenmiCtx->state.main = (GameStateFunc)PreNMI_Main;

View File

@ -1256,8 +1256,7 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
gDPPipeSync(gfx + 1);
gDPSetCycleType(gfx + 2, G_CYC_FILL);
gDPSetRenderMode(gfx + 3, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(gfx + 4,
(GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0) << 16) | GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0));
gDPSetFillColor(gfx + 4, (GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0) << 16) | GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0));
gSPDisplayList(gfx + 5, &D_0E0002C8);
gDPSetColorImage(gfx + 6, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gCtxt->zbuffer);
gSPEndDisplayList(gfx + 7);
@ -1309,8 +1308,7 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
void func_8012D374(GraphicsContext* gCtxt, u8 r, u8 g, u8 b) {
if ((R_PAUSE_MENU_MODE < 2) && (D_801F6D10 < 2)) {
func_8012CF0C(gCtxt, 1, 1, r, g, b);
}
else {
} else {
func_8012CF0C(gCtxt, 0, 0, r, g, b);
}
}
@ -1326,4 +1324,3 @@ void func_8012D40C(f32* param_1, f32* param_2, s16* param_3) {
param_2[1] = param_1[1] / (gScreenHeight / 2);
param_2[3] = param_1[3] - param_1[1];
}

View File

@ -1,9 +1,11 @@
#include <ultra64.h>
#include <global.h>
void Room_nop8012D510(GlobalContext* ctxt, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) {}
void Room_nop8012D510(GlobalContext* ctxt, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) {
}
void Room_DrawType3Mesh(GlobalContext* ctxt, Room* room, u32 flags) {}
void Room_DrawType3Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
}
void Room_DrawType0Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
RoomMeshType0* mesh;
@ -53,11 +55,11 @@ void Room_DrawType0Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
void Room_DrawType1Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
RoomMeshType1* mesh = &room->mesh->type1;
if (mesh->format == 1) {
func_8012DEE8(ctxt,room,flags);
func_8012DEE8(ctxt, room, flags);
} else if (mesh->format == 2) {
func_8012E32C(ctxt,room,flags);
func_8012E32C(ctxt, room, flags);
} else {
assert_fail(D_801DDFAC,0x3c5);
assert_fail(D_801DDFAC, 0x3c5);
}
}
@ -86,11 +88,13 @@ s32 Room_StartRoomTransition(GlobalContext* ctxt, RoomContext* roomCtxt, s32 ind
roomCtxt->unk31 = 1;
size = ctxt->roomAddrs[index].vromEnd - ctxt->roomAddrs[index].vromStart;
roomCtxt->activeRoomVram = (void*)((s32)roomCtxt->roomMemPages[roomCtxt->activeMemPage] - (size + 8) * roomCtxt->activeMemPage + 8) & 0xfffffff0;
roomCtxt->activeRoomVram =
(void*)((s32)roomCtxt->roomMemPages[roomCtxt->activeMemPage] - (size + 8) * roomCtxt->activeMemPage + 8) &
0xfffffff0;
osCreateMesgQueue(&roomCtxt->loadQueue, roomCtxt->loadMsg, 1);
DmaMgr_SendRequestImpl(&roomCtxt->dmaRequest, roomCtxt->activeRoomVram, ctxt->roomAddrs[index].vromStart, size,
0, &roomCtxt->loadQueue, NULL);
0, &roomCtxt->loadQueue, NULL);
roomCtxt->activeMemPage ^= 1;
return 1;
@ -103,10 +107,8 @@ s32 Room_StartRoomTransition(GlobalContext* ctxt, RoomContext* roomCtxt, s32 ind
#endif
s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
if (roomCtxt->unk31 == 1)
{
if (!osRecvMesg(&roomCtxt->loadQueue, NULL, OS_MESG_NOBLOCK))
{
if (roomCtxt->unk31 == 1) {
if (!osRecvMesg(&roomCtxt->loadQueue, NULL, OS_MESG_NOBLOCK)) {
roomCtxt->unk31 = 0;
roomCtxt->currRoom.segment = roomCtxt->activeRoomVram;
// TODO: Segment number enum
@ -116,7 +118,8 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
func_80123140(ctxt, (ActorPlayer*)ctxt->actorCtx.actorList[2].first);
Actor_SpawnTransitionActors(ctxt, &ctxt->actorCtx);
if (((ctxt->sceneNum != SCENE_IKANA) || (roomCtxt->currRoom.num != 1)) && (ctxt->sceneNum != SCENE_IKNINSIDE)) {
if (((ctxt->sceneNum != SCENE_IKANA) || (roomCtxt->currRoom.num != 1)) &&
(ctxt->sceneNum != SCENE_IKNINSIDE)) {
ctxt->kankyoContext.unkC3 = 0xff;
ctxt->kankyoContext.unkE0 = 0;
}
@ -141,7 +144,7 @@ void Room_Draw(GlobalContext* ctxt, Room* room, u32 flags) {
return;
}
void func_8012EBF8(GlobalContext* ctxt, RoomContext* roomCtxt){
void func_8012EBF8(GlobalContext* ctxt, RoomContext* roomCtxt) {
roomCtxt->prevRoom.num = -1;
roomCtxt->prevRoom.segment = NULL;
func_800BA798(ctxt, &ctxt->actorCtx);

View File

@ -847,7 +847,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
return gfx;
}
//Function is unused.
// Function is unused.
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_skelanime/func_80134FFC.asm")
s16 func_801353D4(GenericAnimationHeader* animationSeg) {

View File

@ -254,7 +254,7 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
if (thisCol != thisRow) { // responsible for swapping columns if zero on diagonal
for (i = 0; i < 4; i++) {
SWAP(f32, mfCopy.mf[i][thisCol], mfCopy.mf[i][thisRow]);
SWAP(f32, dest->mf[i][thisCol], dest->mf[i][thisRow]);
SWAP(f32, dest->mf[i][thisCol], dest->mf[i][thisRow]);
}
}
@ -796,7 +796,6 @@ void SkinMatrix_SetZRotation(MtxF* mf, s16 a) {
mf->wy = 0.0f;
mf->wz = 0.0f;
mf->zz = 1.0f;
mf->ww = 1.0f;

View File

@ -25,38 +25,40 @@ s32 func_8013A240(GlobalContext* ctxt) {
seen = 0;
switch (ctxt->sceneNum) {
case SCENE_20SICHITAI:
if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) {
seen = 1;
}
break;
default:
seen = 0;
case SCENE_20SICHITAI:
if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) {
seen = 1;
}
break;
default:
seen = 0;
}
if (actor->id); // Needed to match
if (actor->id) {
; // Needed to match
}
switch (actor->id) {
case ACTOR_EN_KAKASI:
if ((actor->params & 1) == 1) {
case ACTOR_EN_KAKASI:
if ((actor->params & 1) == 1) {
seen |= 2;
break; //! @bug break is inside conditional, meaning it falls through if it is false
}
case ACTOR_EN_ZOV:
seen |= 2;
break; //! @bug break is inside conditional, meaning it falls through if it is false
}
case ACTOR_EN_ZOV:
seen |= 2;
break;
case ACTOR_EN_BAL:
seen |= 2;
break;
case ACTOR_EN_DNQ:
seen |= 2;
break;
case ACTOR_EN_GE1:
case ACTOR_EN_GE3:
case ACTOR_EN_KAIZOKU:
case ACTOR_EN_GE2:
seen |= 2;
break;
break;
case ACTOR_EN_BAL:
seen |= 2;
break;
case ACTOR_EN_DNQ:
seen |= 2;
break;
case ACTOR_EN_GE1:
case ACTOR_EN_GE3:
case ACTOR_EN_KAIZOKU:
case ACTOR_EN_GE2:
seen |= 2;
break;
}
if (seen != 0) {
@ -105,7 +107,8 @@ s16 func_8013A504(s16 val) {
return (val >= 0) ? val : -val;
}
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError) {
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin,
f32 distanceMax, s16 angleError) {
Vec3f screenSpace;
s16 x;
s16 y;
@ -157,4 +160,3 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
return ret;
}

View File

@ -28,7 +28,9 @@ void View_Init(View* view, GraphicsContext* gfxCtx) {
view->unk164 = 0;
view->flags = 1 | 2 | 4;
if (1);
if (1) {
;
}
view->scale = 1.0f;
view->upDir.y = 1.0f;
@ -339,7 +341,7 @@ s32 View_RenderToPerspectiveMatrix(View* view) {
}
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->focalPoint.x, view->focalPoint.y, view->focalPoint.z,
view->upDir.x, view->upDir.y, view->upDir.z);
view->upDir.x, view->upDir.y, view->upDir.z);
view->viewing = *viewing;
@ -382,8 +384,8 @@ s32 View_RenderToOrthographicMatrix(View* view) {
}
view->projectionPtr = projection;
guOrtho(projection, -0.5f ,0.5f, screenWidth * -0.5f, screenWidth * 0.5f,
screenHeight * -0.5f, screenHeight * 0.5f, view->zNear);
guOrtho(projection, -0.5f, 0.5f, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f,
gScreenHeight * 0.5f, view->zNear);
view->projection = *projection;
@ -401,9 +403,8 @@ s32 View_RenderToOrthographicMatrix(View* view) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_view/func_8013FD74.asm")
s32 func_80140024(View* view) {
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z,
view->focalPoint.x, view->focalPoint.y, view->focalPoint.z,
view->upDir.x, view->upDir.y, view->upDir.z);
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->focalPoint.x, view->focalPoint.y,
view->focalPoint.z, view->upDir.x, view->upDir.y, view->upDir.z);
view->unkE0 = *view->viewingPtr;
view->viewingPtr = &view->unkE0;
@ -412,4 +413,3 @@ s32 func_80140024(View* view) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_view/func_801400CC.asm")

View File

@ -158,4 +158,4 @@ void func_801434E4(GameState* state, SkyboxContext* skyboxCtx, s16 skyType) {
func_80143148(skyboxCtx, 5);
}
}
}
}

View File

@ -19,7 +19,7 @@ void guOrthoF(float m[4][4], float l, float r, float b, float t, float n, float
}
}
void guOrtho(Mtx *m, float l, float r, float b, float t, float n, float f, float scale) {
void guOrtho(Mtx* m, float l, float r, float b, float t, float n, float f, float scale) {
float mf[4][4];
guOrthoF(mf, l, r, b, t, n, f, scale);
guMtxF2L(mf, m);

View File

@ -27,7 +27,7 @@ void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, fl
if (near + far <= 2.0) {
*perspNorm = 65535;
} else {
*perspNorm = (double) (1 << 17) / (near + far);
*perspNorm = (double)(1 << 17) / (near + far);
if (*perspNorm <= 0) {
*perspNorm = 1;
}

View File

@ -44,7 +44,7 @@ void guRotateF(float m[4][4], float a, float x, float y, float z) {
m[0][1] = ab + zs;
}
void guRotate(Mtx *m, float a, float x, float y, float z) {
void guRotate(Mtx* m, float a, float x, float y, float z) {
float mf[4][4];
guRotateF(mf, a, x, y, z);
guMtxF2L(mf, m);

View File

@ -1,25 +1,22 @@
#include <math.h>
static const du P[] = {
{0x3FF00000, 0x00000000},
{0xBFC55554, 0xBC83656D},
{0x3F8110ED, 0x3804C2A0},
{0xBF29F6FF, 0xEEA56814},
{0x3EC5DBDF, 0x0E314BFE},
static const du P[] = {
{ 0x3FF00000, 0x00000000 }, { 0xBFC55554, 0xBC83656D }, { 0x3F8110ED, 0x3804C2A0 },
{ 0xBF29F6FF, 0xEEA56814 }, { 0x3EC5DBDF, 0x0E314BFE },
};
static const du rpi = {0x3FD45F30, 0x6DC9C883};
static const du rpi = { 0x3FD45F30, 0x6DC9C883 };
static const du pihi = {0x400921FB, 0x50000000};
static const du pihi = { 0x400921FB, 0x50000000 };
static const du pilo = {0x3E6110B4, 0x611A6263};
static const du pilo = { 0x3E6110B4, 0x611A6263 };
static const fu zero = {0x00000000};
static const fu zero = { 0x00000000 };
extern float __libm_qnan_f;
float __sinf(float x) {
double dx; // double x
double dx; // double x
double xsq; // x squared
double poly;
double dn;

View File

@ -1,7 +1,7 @@
#include <ultra64.h>
#include <global.h>
void osViSetEvent(OSMesgQueue *mq, OSMesg m, u32 retraceCount) {
void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount) {
register u32 saveMask = __osDisableInt();
__osViNext->msgq = mq;

View File

@ -1,8 +1,7 @@
#include <ultra64.h>
#include <global.h>
s32 osContStartQuery(OSMesgQueue* mq)
{
s32 osContStartQuery(OSMesgQueue* mq) {
s32 ret;
__osSiGetAccess();
@ -22,8 +21,7 @@ s32 osContStartQuery(OSMesgQueue* mq)
return ret;
}
void osContGetQuery(OSContStatus* data)
{
void osContGetQuery(OSContStatus* data) {
u8 pattern;
__osContGetInitData(&pattern, data);

View File

@ -58,7 +58,7 @@ void __osPackReadData() {
readformat.stick_y = -1;
for (i = 0; i < __osMaxControllers; i++) {
*(__OSContReadFormat*)ptr = readformat;
ptr+=sizeof(__OSContReadFormat);
ptr += sizeof(__OSContReadFormat);
}
*ptr = 254;
}

View File

@ -12,7 +12,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
if (!__osPiAccessQueueEnabled) {
__osPiCreateAccessQueue();
}
osSetEventMesg(8, &D_8009E3D0, (OSMesg) 0x22222222);
osSetEventMesg(8, &D_8009E3D0, (OSMesg)0x22222222);
oldPri = -1;
myPri = osGetThreadPri(NULL);
if (myPri < pri) {
@ -27,7 +27,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
__osPiDevMgr.acsQueue = &__osPiAccessQueue;
__osPiDevMgr.dma = (s32(*)(void))osPiRawStartDma;
__osPiDevMgr.unk18 = (s32(*)(void))func_800900C0;
osCreateThread(&D_8009D220, 0, __osDevMgrMain, (void *) &__osPiDevMgr, &piManagerStack[4096], pri);
osCreateThread(&D_8009D220, 0, __osDevMgrMain, (void*)&__osPiDevMgr, &piManagerStack[4096], pri);
osStartThread(&D_8009D220);
__osRestoreInt(savedMask);
if (oldPri != -1) {

View File

@ -14,14 +14,14 @@ s32 osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, u32 size) {
*(u32*)0xA4600004 = ((osRomBase | devAddr) & 0x1fffffff);
switch (direction) {
case 0:
*(u32*)0xA460000C = size - 1;
break;
case 1:
*(u32*)0xA4600008 = size - 1;
break;
default:
return -1;
case 0:
*(u32*)0xA460000C = size - 1;
break;
case 1:
*(u32*)0xA4600008 = size - 1;
break;
default:
return -1;
}
return 0;
}

View File

@ -2,7 +2,7 @@
#include <osint.h>
#include <assert.h>
s32 __osSpRawStartDma(s32 direction, u32 devAddr , void* dramAddr, u32 size) {
s32 __osSpRawStartDma(s32 direction, u32 devAddr, void* dramAddr, u32 size) {
if (__osSpDeviceBusy() != 0) {
return -1;
}

View File

@ -1,8 +1,7 @@
#include <ultra64.h>
#include <global.h>
OSTask* _VirtualToPhysicalTask(OSTask* intp)
{
OSTask* _VirtualToPhysicalTask(OSTask* intp) {
OSTask* tp = &tmp_task;
bcopy((void*)intp, (void*)tp, sizeof(OSTask));
if (tp->t.ucode) {
@ -30,8 +29,7 @@ OSTask* _VirtualToPhysicalTask(OSTask* intp)
return &tmp_task;
}
void osSpTaskLoad(OSTask* intp)
{
void osSpTaskLoad(OSTask* intp) {
OSTask* tp;
tp = _VirtualToPhysicalTask(intp);
@ -51,15 +49,24 @@ void osSpTaskLoad(OSTask* intp)
__osSpSetStatus(11008);
while (__osSpSetPc(0x04001000) == -1);
while (__osSpRawStartDma(1, 0x04000FC0, (void*)tp, sizeof(OSTask)) == -1);
while (__osSpDeviceBusy());
while (__osSpRawStartDma(1, 0x04001000, (void*)tp->t.ucode_boot, tp->t.ucode_boot_size) == -1);
while (__osSpSetPc(0x04001000) == -1) {
;
}
while (__osSpRawStartDma(1, 0x04000FC0, (void*)tp, sizeof(OSTask)) == -1) {
;
}
while (__osSpDeviceBusy()) {
;
}
while (__osSpRawStartDma(1, 0x04001000, (void*)tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
;
}
}
void osSpTaskStartGo(OSTask* tp)
{
while (__osSpDeviceBusy());
void osSpTaskStartGo(OSTask* tp) {
while (__osSpDeviceBusy()) {
;
}
__osSpSetStatus(293);
}

View File

@ -21,7 +21,9 @@ void __osViInit(void) {
__osViNext->state = 0x20;
__osViNext->control = __osViNext->modep->comRegs.ctrl;
while (*(vu32*)0xA4400010 > 10);
while (*(vu32*)0xA4400010 > 10) {
;
}
*(vu32*)0xA4400000 = 0;
__osViSwapContext();

View File

@ -29,7 +29,8 @@ long long __ll_mul(long long left, long long right) {
return left * right;
}
void __ull_divremi(unsigned long long *quotient, unsigned long long *remainder, unsigned long long dividend, unsigned short divisor) {
void __ull_divremi(unsigned long long* quotient, unsigned long long* remainder, unsigned long long dividend,
unsigned short divisor) {
*quotient = dividend / divisor;
*remainder = dividend % divisor;
}

View File

@ -1,39 +1,38 @@
#include <string.h>
unsigned char* strchr(const unsigned char* s, int c)
{
unsigned char* strchr(const unsigned char* s, int c) {
const unsigned char ch = c;
while ( *s != ch) {
while (*s != ch) {
if (*s == '\0') {
return NULL;
}
s++;
}
return (unsigned char*)s;
}
size_t strlen(const unsigned char* s)
{
size_t strlen(const unsigned char* s) {
const unsigned char* sc = s;
while (*sc != '\0') sc++;
while (*sc != '\0') {
sc++;
}
return (size_t)(sc - s);
}
void* memcpy(void* s1, const void* s2, size_t n)
{
void* memcpy(void* s1, const void* s2, size_t n) {
unsigned char* su1 = (unsigned char*)s1;
const unsigned char* su2 = (const unsigned char*)s2;
while (n > 0) {
*su1 = *su2;
su1++;
su2++;
n--;
}
return s1;
}

View File

@ -2,8 +2,8 @@
#include <global.h>
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msq, s32 count) {
mq->mtqueue = (OSThread *)&__osThreadTail;
mq->fullqueue = (OSThread *)&__osThreadTail;
mq->mtqueue = (OSThread*)&__osThreadTail;
mq->fullqueue = (OSThread*)&__osThreadTail;
mq->validCount = 0;
mq->first = 0;
mq->msgCount = count;

View File

@ -1,8 +1,7 @@
#include <ultra64.h>
#include <global.h>
void osDestroyThread(OSThread* t)
{
void osDestroyThread(OSThread* t) {
register u32 saveMask;
register OSThread* pred;
register OSThread* succ;

View File

@ -1,6 +1,6 @@
#include <ultra64.h>
#include <global.h>
OSThread* __osGetActiveQueue(void){
OSThread* __osGetActiveQueue(void) {
return __osActiveQueue;
}

View File

@ -14,17 +14,16 @@ u32 osGetMemSize(void) {
sp4 = *(u32*)(0xA0000000 + sp8);
sp0 = *(u32*)(0xA00FFFFC + sp8);
*(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF;
spC[0x000FFFFC/4] = spC[0x000FFFFC/4] ^ 0xFFFFFFFF;
spC[0x000FFFFC / 4] = spC[0x000FFFFC / 4] ^ 0xFFFFFFFF;
if ((spC[0] != (sp4 ^ 0xFFFFFFFF)) ||
(spC[0x000FFFFC/4] != (sp0 ^ 0xFFFFFFFF))) {
if ((spC[0] != (sp4 ^ 0xFFFFFFFF)) || (spC[0x000FFFFC / 4] != (sp0 ^ 0xFFFFFFFF))) {
return sp8;
}
*spC = sp4;
spC[0x000FFFFC/4] = sp0;
spC[0x000FFFFC / 4] = sp0;
sp8 = sp8 + 0x100000;
} while(sp8 < 0x800000);
} while (sp8 < 0x800000);
return sp8;
}

View File

@ -32,8 +32,12 @@ void osInitialize(void) {
__osSetFpcCsr(0x01000800);
__osSetWatchLo(0x04900000);
while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0);
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0);
while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0) {
;
}
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0) {
;
}
*(__osExceptionVector*)0x80000000 = *((__osExceptionVector*)__osExceptionPreamble);
*(__osExceptionVector*)0x80000080 = *((__osExceptionVector*)__osExceptionPreamble);
@ -59,8 +63,10 @@ void osInitialize(void) {
osViClock = 0x02E6D354;
}
if((__osGetCause() & 0x1000) != 0) {
while(1);
if ((__osGetCause() & 0x1000) != 0) {
while (1) {
;
}
}
*(u32*)0xA4500008 = 1;
@ -68,4 +74,5 @@ void osInitialize(void) {
*(u32*)0xA4500014 = 15;
}
void func_8008A9A8(void) {}
void func_8008A9A8(void) {
}

View File

@ -6,10 +6,8 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) {
saveMask = __osDisableInt();
while (mq->validCount == 0)
{
if (flags == 0)
{
while (mq->validCount == 0) {
if (flags == 0) {
__osRestoreInt(saveMask);
return -1;
}

View File

@ -22,7 +22,9 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes
saveMask = __osDisableInt();
if (__osTimerList->next != __osTimerList) {
if (0);
if (0) {
;
}
spC = __osTimerList->next;
sp14 = osGetCount();
sp10 = sp14 - __osTimerCounter;

View File

@ -7,20 +7,20 @@ void osStartThread(OSThread* t) {
saveMask = __osDisableInt();
switch (t->state) {
case 8:
t->state = 2;
__osEnqueueThread(&__osRunQueue, t);
break;
case 1:
if ((t->queue == NULL) || (t->queue == &__osRunQueue)) {
case 8:
t->state = 2;
__osEnqueueThread(&__osRunQueue, t);
} else {
t->state = 8;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__osRunQueue, __osPopThread(t->queue));
}
break;
break;
case 1:
if ((t->queue == NULL) || (t->queue == &__osRunQueue)) {
t->state = 2;
__osEnqueueThread(&__osRunQueue, t);
} else {
t->state = 8;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__osRunQueue, __osPopThread(t->queue));
}
break;
}
if (__osRunningThread == NULL) {

View File

@ -13,17 +13,16 @@ void osStopThread(OSThread* t) {
state = t->state;
}
switch (state)
{
case 4:
__osRunningThread->state = 1;
__osEnqueueAndYield(NULL);
break;
case 2:
case 8:
t->state = 1;
__osDequeueThread(t->queue, t);
break;
switch (state) {
case 4:
__osRunningThread->state = 1;
__osEnqueueAndYield(NULL);
break;
case 2:
case 8:
t->state = 1;
__osDequeueThread(t->queue, t);
break;
}
__osRestoreInt(saveMask);

View File

@ -1,8 +1,7 @@
#include <ultra64.h>
#include <global.h>
s32 osStopTimer(OSTimer* t)
{
s32 osStopTimer(OSTimer* t) {
register u32 savedMask;
OSTimer* timep;

View File

@ -8,8 +8,7 @@ OSThread* __osActiveQueue = (OSThread*)&__osThreadTail;
OSThread* __osRunningThread = NULL;
OSThread* __osFaultedThread = NULL;
void __osDequeueThread(OSThread** queue, OSThread* t)
{
void __osDequeueThread(OSThread** queue, OSThread* t) {
register OSThread* pred;
register OSThread* succ;

View File

@ -1,29 +1,29 @@
#include <ultra64.h>
#include <global.h>
#define ATOI(i, a) \
for (i = 0; *a >= '0' && *a <= '9'; a++) \
if (i < 999) \
#define ATOI(i, a) \
for (i = 0; *a >= '0' && *a <= '9'; a++) \
if (i < 999) \
i = *a + i * 10 - '0';
#define _PROUT(fmt, _size) \
if (_size > 0) { \
arg = (void*)pfn(arg, fmt, _size); \
if (arg != 0) \
x.nchar += _size; \
else \
return x.nchar; \
#define _PROUT(fmt, _size) \
if (_size > 0) { \
arg = (void*)pfn(arg, fmt, _size); \
if (arg != 0) \
x.nchar += _size; \
else \
return x.nchar; \
}
#define _PAD(m, src, extracond) \
if (extracond && m > 0) { \
int i; \
int j; \
for (j = m; j > 0; j -= i) { \
if ((u32) j > 32) \
i = 32; \
else \
i = j; \
_PROUT(src, i); \
} \
#define _PAD(m, src, extracond) \
if (extracond && m > 0) { \
int i; \
int j; \
for (j = m; j > 0; j -= i) { \
if ((u32)j > 32) \
i = 32; \
else \
i = j; \
_PROUT(src, i); \
} \
}
#define FLAGS_SPACE 1
@ -56,7 +56,7 @@ int _Printf(printf_func pfn, void* arg, char* fmt, va_list ap) {
if (c == 0) {
return x.nchar;
}
fmt = (char *) ++s;
fmt = (char*)++s;
x.flags = 0;
// TODO the cast isn't necessary because strchr should take it in as const, but it currently doesn't
for (; (t = strchr((char*)fchar, *s)) != NULL; s++) {
@ -94,23 +94,21 @@ int _Printf(printf_func pfn, void* arg, char* fmt, va_list ap) {
s++;
}
_Putfld(&x, &ap, *s, ac);
x.width -= x.n0 + x.nz0 + x.n1 + x.nz1
+ x.n2 + x.nz2;
x.width -= x.n0 + x.nz0 + x.n1 + x.nz1 + x.n2 + x.nz2;
_PAD(x.width, spaces, !(x.flags & FLAGS_MINUS));
_PROUT((char *) ac, x.n0);
_PROUT((char*)ac, x.n0);
_PAD(x.nz0, zeroes, 1);
_PROUT(x.s, x.n1);
_PAD(x.nz1, zeroes, 1);
_PROUT((char *) (&x.s[x.n1]), x.n2)
_PROUT((char*)(&x.s[x.n1]), x.n2)
_PAD(x.nz2, zeroes, 1);
_PAD(x.width, spaces, x.flags & FLAGS_MINUS);
fmt = (char *) s + 1;
fmt = (char*)s + 1;
}
}
void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
px->n0 = px->nz0 = px->n1 = px->nz1 = px->n2 =
px->nz2 = 0;
px->n0 = px->nz0 = px->n1 = px->nz1 = px->n2 = px->nz2 = 0;
switch (code) {
@ -129,7 +127,7 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
}
if (px->qual == 'h') {
px->v.ll = (s16) px->v.ll;
px->v.ll = (s16)px->v.ll;
}
if (px->v.ll < 0) {
@ -140,7 +138,7 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
ac[px->n0++] = ' ';
}
px->s = (char *) &ac[px->n0];
px->s = (char*)&ac[px->n0];
_Litob(px, code);
break;
@ -158,9 +156,9 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
}
if (px->qual == 'h') {
px->v.ll = (u16) px->v.ll;
px->v.ll = (u16)px->v.ll;
} else if (px->qual == 0) {
px->v.ll = (u32) px->v.ll;
px->v.ll = (u32)px->v.ll;
}
if (px->flags & FLAGS_HASH) {
@ -170,7 +168,7 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
ac[px->n0++] = code;
}
}
px->s = (char *) &ac[px->n0];
px->s = (char*)&ac[px->n0];
_Litob(px, code);
break;
@ -191,30 +189,30 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) {
}
}
px->s = (char *) &ac[px->n0];
px->s = (char*)&ac[px->n0];
_Ldtob(px, code);
break;
case 'n':
if (px->qual == 'h') {
*(va_arg(*pap, u16 *)) = px->nchar;
*(va_arg(*pap, u16*)) = px->nchar;
} else if (px->qual == 'l') {
*va_arg(*pap, u32 *) = px->nchar;
*va_arg(*pap, u32*) = px->nchar;
} else if (px->qual == 'L') {
*va_arg(*pap, u64 *) = px->nchar;
*va_arg(*pap, u64*) = px->nchar;
} else {
*va_arg(*pap, u32 *) = px->nchar;
*va_arg(*pap, u32*) = px->nchar;
}
break;
case 'p':
px->v.ll = (long) va_arg(*pap, void *);
px->s = (char *) &ac[px->n0];
px->v.ll = (long)va_arg(*pap, void*);
px->s = (char*)&ac[px->n0];
_Litob(px, 'x');
break;
case 's':
px->s = va_arg(*pap, char *);
px->s = va_arg(*pap, char*);
px->n1 = strlen(px->s);
if (px->prec >= 0 && px->n1 > px->prec) {
px->n1 = px->prec;

View File

@ -6,7 +6,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) {
__OSContRequestHeaderAligned header;
s32 ret = 0;
s32 i;
u8* ptr = (u8 *)&__osContPifRam;
u8* ptr = (u8*)&__osContPifRam;
s32 var = 2;
__osSiGetAccess();
@ -19,8 +19,8 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) {
;
}
*ptr++ = 1;
*ptr++ = 3;
*ptr++ = 1;
*ptr++ = 3;
*ptr = CONT_CMD_REQUEST_STATUS;
ptr += 4;
*ptr = CONT_CMD_END;
@ -32,7 +32,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) {
ret = __osSiRawStartDma(OS_READ, &__osContPifRam);
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
ptr = (u8 *)&__osContPifRam + port;
ptr = (u8*)&__osContPifRam + port;
header = *((__OSContRequestHeaderAligned*)ptr);

View File

@ -21,7 +21,7 @@ const ActorInit Arms_Hook_InitVars = {
(ActorFunc)ArmsHook_Init,
(ActorFunc)ArmsHook_Destroy,
(ActorFunc)ArmsHook_Update,
(ActorFunc)ArmsHook_Draw
(ActorFunc)ArmsHook_Draw,
};
ColliderQuadInit D_808C1BC0 = {

View File

@ -19,7 +19,7 @@ const ActorInit Arrow_Fire_InitVars = {
(ActorFunc)ArrowFire_Init,
(ActorFunc)ArrowFire_Destroy,
(ActorFunc)ArrowFire_Update,
(ActorFunc)ArrowFire_Draw
(ActorFunc)ArrowFire_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Arrow_Ice_InitVars = {
(ActorFunc)ArrowIce_Init,
(ActorFunc)ArrowIce_Destroy,
(ActorFunc)ArrowIce_Update,
(ActorFunc)ArrowIce_Draw
(ActorFunc)ArrowIce_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Arrow_Light_InitVars = {
(ActorFunc)ArrowLight_Init,
(ActorFunc)ArrowLight_Destroy,
(ActorFunc)ArrowLight_Update,
(ActorFunc)ArrowLight_Draw
(ActorFunc)ArrowLight_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Astr_Bombwall_InitVars = {
(ActorFunc)BgAstrBombwall_Init,
(ActorFunc)BgAstrBombwall_Destroy,
(ActorFunc)BgAstrBombwall_Update,
(ActorFunc)BgAstrBombwall_Draw
(ActorFunc)BgAstrBombwall_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Botihasira_InitVars = {
(ActorFunc)BgBotihasira_Init,
(ActorFunc)BgBotihasira_Destroy,
(ActorFunc)BgBotihasira_Update,
(ActorFunc)BgBotihasira_Draw
(ActorFunc)BgBotihasira_Draw,
};
*/

View File

@ -17,7 +17,7 @@ const ActorInit Bg_Breakwall_InitVars = {
(ActorFunc)BgBreakwall_Init,
(ActorFunc)NULL,
(ActorFunc)BgBreakwall_Update,
(ActorFunc)NULL
(ActorFunc)NULL,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Crace_Movebg_InitVars = {
(ActorFunc)BgCraceMovebg_Init,
(ActorFunc)BgCraceMovebg_Destroy,
(ActorFunc)BgCraceMovebg_Update,
(ActorFunc)BgCraceMovebg_Draw
(ActorFunc)BgCraceMovebg_Draw,
};
*/

View File

@ -27,7 +27,6 @@ void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx);
void BgCtowerGear_DrawOrgan(Actor* thisx, GlobalContext* globalCtx);
const ActorInit Bg_Ctower_Gear_InitVars = {
ACTOR_BG_CTOWER_GEAR,
ACTORCAT_PROP,
@ -37,7 +36,7 @@ const ActorInit Bg_Ctower_Gear_InitVars = {
(ActorFunc)BgCtowerGear_Init,
(ActorFunc)BgCtowerGear_Destroy,
(ActorFunc)BgCtowerGear_Update,
(ActorFunc)BgCtowerGear_Draw
(ActorFunc)BgCtowerGear_Draw,
};
extern Gfx D_06010828[];
@ -55,16 +54,13 @@ extern Gfx D_06018118[];
extern CollisionHeader D_06018588;
static Vec3f D_80AD3270[] = {
{-70.0f, -60.0f, 8.0f},
{-60.0f, -60.0f, -9.1f},
{-75.0f, -60.0f, -9.1f},
{-70.0f, -60.0f, -26.2f}
{ -70.0f, -60.0f, 8.0f }, { -60.0f, -60.0f, -9.1f }, { -75.0f, -60.0f, -9.1f }, { -70.0f, -60.0f, -26.2f }
};
static Vec3f D_80AD32A0[] = {
{85.0f, -60.0f, 8.0f},
{80.0f, -60.0f, -9.1f},
{85.0f, -60.0f, -26.2f},
{ 85.0f, -60.0f, 8.0f },
{ 80.0f, -60.0f, -9.1f },
{ 85.0f, -60.0f, -26.2f },
};
static InitChainEntry sInitChain[] = {
@ -85,9 +81,9 @@ static InitChainEntry sInitChainOrgan[] = {
ICHAIN_F32(uncullZoneDownward, 570, ICHAIN_STOP),
};
static Gfx* D_80AD32E8[] = {D_06010828, D_06017018, D_06018118};
static Gfx* D_80AD32E8[] = { D_06010828, D_06017018, D_06018118 };
void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* GlobalContext) {
int i;
s32 flags;
Vec3f splashSpawnPos;
@ -102,8 +98,8 @@ void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
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);
for(i=0; i<4; i++) {
if ((u32) Rand_Next() >= 0x40000000) {
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;
@ -111,7 +107,7 @@ void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
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);
EffectSsGSplash_Spawn(GlobalContext, &splashSpawnPos, NULL, NULL, 0, ((u32) Rand_Next() >> 25) + 340);
EffectSsGSplash_Spawn(GlobalContext, &splashSpawnPos, NULL, NULL, 0, ((u32)Rand_Next() >> 25) + 340);
}
}
}
@ -120,8 +116,8 @@ void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
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);
for(i=0; i<3; i++) {
for(j=0; j<2; j++) {
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;
@ -129,7 +125,8 @@ void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
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);
EffectSsGSplash_Spawn(GlobalContext, &splashSpawnPos, NULL, NULL, 0, ((u32) Rand_Next() >> 25) + 280);
EffectSsGSplash_Spawn(GlobalContext, &splashSpawnPos, NULL, NULL, 0,
((u32)Rand_Next() >> 25) + 280);
}
}
}
@ -137,8 +134,8 @@ void BgCtowerGear_Splash(BgCtowerGear *this, GlobalContext *GlobalContext) {
}
}
void BgCtowerGear_Init(Actor *thisx, GlobalContext *globalCtx) {
BgCtowerGear *this = THIS;
void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx) {
BgCtowerGear* this = THIS;
s32 type;
type = BGCTOWERGEAR_GET_TYPE(this);
@ -162,8 +159,8 @@ void BgCtowerGear_Init(Actor *thisx, GlobalContext *globalCtx) {
}
}
void BgCtowerGear_Destroy(Actor *thisx, GlobalContext *globalCtx) {
BgCtowerGear *this = THIS;
void BgCtowerGear_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgCtowerGear* this = THIS;
s32 type;
type = BGCTOWERGEAR_GET_TYPE(this);
@ -172,26 +169,24 @@ void BgCtowerGear_Destroy(Actor *thisx, GlobalContext *globalCtx) {
}
}
void BgCtowerGear_Update(Actor *thisx, GlobalContext *globalCtx) {
BgCtowerGear *this = THIS;
void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx) {
BgCtowerGear* this = THIS;
s32 type;
type = BGCTOWERGEAR_GET_TYPE(this);
if (type == CEILING_COG) {
this->dyna.actor.shape.rot.x -= 0x1F4;
}
else if (type == CENTER_COG) {
} else if (type == CENTER_COG) {
this->dyna.actor.shape.rot.y += 0x1F4;
func_800B9010(&this->dyna.actor, 0x2085);
}
else if (type == WATER_WHEEL) {
} else if (type == WATER_WHEEL) {
this->dyna.actor.shape.rot.z -= 0x1F4;
BgCtowerGear_Splash(this, globalCtx);
}
}
void BgCtowerGear_UpdateOrgan(Actor *thisx, GlobalContext *globalCtx) {
BgCtowerGear *this = THIS;
void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx) {
BgCtowerGear* this = THIS;
if (func_800EE29C(globalCtx, 0x68)) {
switch (globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x68)]->unk0) {
@ -210,12 +205,12 @@ void BgCtowerGear_UpdateOrgan(Actor *thisx, GlobalContext *globalCtx) {
}
}
//Using BgCtowerGear *this = THIS causes regalloc issues
void BgCtowerGear_Draw(Actor *thisx, GlobalContext *globalCtx) {
// Using BgCtowerGear *this = THIS causes regalloc issues
void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_800BDFC0(globalCtx, D_80AD32E8[BGCTOWERGEAR_GET_TYPE(thisx)]);
}
void BgCtowerGear_DrawOrgan(Actor *thisx, GlobalContext *globalCtx) {
void BgCtowerGear_DrawOrgan(Actor* thisx, GlobalContext* globalCtx) {
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);

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Ctower_Rot_InitVars = {
(ActorFunc)BgCtowerRot_Init,
(ActorFunc)BgCtowerRot_Destroy,
(ActorFunc)BgCtowerRot_Update,
(ActorFunc)BgCtowerRot_Draw
(ActorFunc)BgCtowerRot_Draw,
};
*/

View File

@ -18,7 +18,7 @@ const ActorInit Bg_Danpei_Movebg_InitVars = {
(ActorFunc)BgDanpeiMovebg_Init,
(ActorFunc)BgDanpeiMovebg_Destroy,
(ActorFunc)BgDanpeiMovebg_Update,
(ActorFunc)NULL
(ActorFunc)NULL,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Dblue_Balance_InitVars = {
(ActorFunc)BgDblueBalance_Init,
(ActorFunc)BgDblueBalance_Destroy,
(ActorFunc)BgDblueBalance_Update,
(ActorFunc)BgDblueBalance_Draw
(ActorFunc)BgDblueBalance_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Dblue_Elevator_InitVars = {
(ActorFunc)BgDblueElevator_Init,
(ActorFunc)BgDblueElevator_Destroy,
(ActorFunc)BgDblueElevator_Update,
(ActorFunc)BgDblueElevator_Draw
(ActorFunc)BgDblueElevator_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Dblue_Movebg_InitVars = {
(ActorFunc)BgDblueMovebg_Init,
(ActorFunc)BgDblueMovebg_Destroy,
(ActorFunc)BgDblueMovebg_Update,
(ActorFunc)BgDblueMovebg_Draw
(ActorFunc)BgDblueMovebg_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Dblue_Waterfall_InitVars = {
(ActorFunc)BgDblueWaterfall_Init,
(ActorFunc)BgDblueWaterfall_Destroy,
(ActorFunc)BgDblueWaterfall_Update,
(ActorFunc)BgDblueWaterfall_Draw
(ActorFunc)BgDblueWaterfall_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Dkjail_Ivy_InitVars = {
(ActorFunc)BgDkjailIvy_Init,
(ActorFunc)BgDkjailIvy_Destroy,
(ActorFunc)BgDkjailIvy_Update,
(ActorFunc)BgDkjailIvy_Draw
(ActorFunc)BgDkjailIvy_Draw,
};
*/

View File

@ -18,7 +18,7 @@ const ActorInit Bg_Dy_Yoseizo_InitVars = {
(ActorFunc)BgDyYoseizo_Init,
(ActorFunc)BgDyYoseizo_Destroy,
(ActorFunc)BgDyYoseizo_Update,
(ActorFunc)NULL
(ActorFunc)NULL,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_F40_Block_InitVars = {
(ActorFunc)BgF40Block_Init,
(ActorFunc)BgF40Block_Destroy,
(ActorFunc)BgF40Block_Update,
(ActorFunc)BgF40Block_Draw
(ActorFunc)BgF40Block_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_F40_Flift_InitVars = {
(ActorFunc)BgF40Flift_Init,
(ActorFunc)BgF40Flift_Destroy,
(ActorFunc)BgF40Flift_Update,
(ActorFunc)BgF40Flift_Draw
(ActorFunc)BgF40Flift_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_F40_Switch_InitVars = {
(ActorFunc)BgF40Switch_Init,
(ActorFunc)BgF40Switch_Destroy,
(ActorFunc)BgF40Switch_Update,
(ActorFunc)BgF40Switch_Draw
(ActorFunc)BgF40Switch_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_F40_Swlift_InitVars = {
(ActorFunc)BgF40Swlift_Init,
(ActorFunc)BgF40Swlift_Destroy,
(ActorFunc)BgF40Swlift_Update,
(ActorFunc)BgF40Swlift_Draw
(ActorFunc)BgF40Swlift_Draw,
};
*/

View File

@ -18,7 +18,7 @@ const ActorInit Bg_Fire_Wall_InitVars = {
(ActorFunc)BgFireWall_Init,
(ActorFunc)BgFireWall_Destroy,
(ActorFunc)BgFireWall_Update,
(ActorFunc)NULL
(ActorFunc)NULL,
};
*/

View File

@ -18,7 +18,7 @@ const ActorInit Bg_Fu_Kaiten_InitVars = {
(ActorFunc)BgFuKaiten_Init,
(ActorFunc)BgFuKaiten_Destroy,
(ActorFunc)BgFuKaiten_Update,
(ActorFunc)BgFuKaiten_Draw
(ActorFunc)BgFuKaiten_Draw,
};
void BgFuKaiten_Init(Actor* thisx, GlobalContext* globalCtx) {
@ -44,8 +44,7 @@ void BgFuKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgFuKaiten_UpdateRotation(BgFuKaiten* this) {
f32 f0;
this->bg.actor.shape.rot.y += this->rotationSpeed;
if (this->rotationSpeed > 0)
{
if (this->rotationSpeed > 0) {
f0 = this->rotationSpeed * .002f;
func_8019FAD8(&this->bg.actor.projectedPos, 8310, f0);
}

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Fu_Mizu_InitVars = {
(ActorFunc)BgFuMizu_Init,
(ActorFunc)BgFuMizu_Destroy,
(ActorFunc)BgFuMizu_Update,
(ActorFunc)BgFuMizu_Draw
(ActorFunc)BgFuMizu_Draw,
};
*/

View File

@ -19,7 +19,7 @@ const ActorInit Bg_Goron_Oyu_InitVars = {
(ActorFunc)BgGoronOyu_Init,
(ActorFunc)BgGoronOyu_Destroy,
(ActorFunc)BgGoronOyu_Update,
(ActorFunc)BgGoronOyu_Draw
(ActorFunc)BgGoronOyu_Draw,
};
*/

Some files were not shown because too many files have changed in this diff Show More