mirror of
https://github.com/zeldaret/oot
synced 2026-09-08 03:26:47 -04:00
merge
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
|
||||
StackEntry sBootThreadInfo;
|
||||
OSThread sIdleThread;
|
||||
u8 sIdleThreadStack[0x400];
|
||||
STACK(sIdleThreadStack, 0x400);
|
||||
StackEntry sIdleThreadInfo;
|
||||
u8 sBootThreadStack[0x400];
|
||||
STACK(sBootThreadStack, 0x400);
|
||||
|
||||
void cleararena(void) {
|
||||
bzero(_dmadataSegmentStart, osMemSize - OS_K0_TO_PHYSICAL(_dmadataSegmentStart));
|
||||
}
|
||||
|
||||
void bootproc(void) {
|
||||
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot");
|
||||
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot");
|
||||
|
||||
osMemSize = osGetMemSize();
|
||||
cleararena();
|
||||
@@ -23,8 +23,8 @@ void bootproc(void) {
|
||||
isPrintfInit();
|
||||
Locale_Init();
|
||||
|
||||
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack),
|
||||
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, STACK_TOP(sIdleThreadStack), 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, STACK_TOP(sIdleThreadStack),
|
||||
Z_PRIORITY_MAIN);
|
||||
osStartThread(&sIdleThread);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
#include "vt.h"
|
||||
|
||||
OSThread gMainThread;
|
||||
u8 sMainStack[0x900];
|
||||
STACK(sMainStack, 0x900);
|
||||
StackEntry sMainStackInfo;
|
||||
OSMesg sPiMgrCmdBuff[50];
|
||||
OSMesgQueue gPiMgrCmdQ;
|
||||
@@ -79,8 +79,8 @@ void Idle_ThreadEntry(void* arg) {
|
||||
osViBlack(1);
|
||||
osViSwapBuffer(0x803DA80); //! @bug Invalid vram address (probably intended to be 0x803DA800)
|
||||
osCreatePiManager(OS_PRIORITY_PIMGR, &gPiMgrCmdQ, sPiMgrCmdBuff, 50);
|
||||
StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 0x400, "main");
|
||||
osCreateThread(&gMainThread, 3, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), Z_PRIORITY_MAIN);
|
||||
StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x400, "main");
|
||||
osCreateThread(&gMainThread, 3, Main_ThreadEntry, arg, STACK_TOP(sMainStack), Z_PRIORITY_MAIN);
|
||||
osStartThread(&gMainThread);
|
||||
osSetThreadPri(NULL, OS_PRIORITY_IDLE);
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ StackEntry sDmaMgrStackInfo;
|
||||
OSMesgQueue sDmaMgrMsgQueue;
|
||||
OSMesg sDmaMgrMsgs[0x20];
|
||||
OSThread sDmaMgrThread;
|
||||
u8 sDmaMgrStack[0x500];
|
||||
STACK(sDmaMgrStack, 0x500);
|
||||
const char* sDmaMgrCurFileName;
|
||||
s32 sDmaMgrCurFileLine;
|
||||
|
||||
u32 D_80009460 = 0;
|
||||
u32 gDmaMgrDmaBuffSize = 0x2000;
|
||||
u32 sDmaMgrDataExistError = 0;
|
||||
u32 sDmaMgrIsRomCompressed = false;
|
||||
|
||||
// dmadata filenames
|
||||
#define DEFINE_DMA_ENTRY(name) #name,
|
||||
@@ -292,7 +292,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (sDmaMgrDataExistError) {
|
||||
if (sDmaMgrIsRomCompressed) {
|
||||
DmaMgr_Error(req, NULL, "DATA DON'T EXIST", "該当するデータが存在しません");
|
||||
return;
|
||||
}
|
||||
@@ -337,6 +337,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk
|
||||
|
||||
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) ||
|
||||
(size & 1)) {
|
||||
//! @bug `req` is passed to `DmaMgr_Error` without rom, ram and size being set
|
||||
DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です");
|
||||
}
|
||||
|
||||
@@ -388,14 +389,14 @@ void DmaMgr_Init(void) {
|
||||
(u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
|
||||
osSyncPrintf("dma_rom_ad[]\n");
|
||||
|
||||
sDmaMgrDataExistError = 0;
|
||||
sDmaMgrIsRomCompressed = false;
|
||||
name = sDmaMgrFileNames;
|
||||
iter = gDmaDataTable;
|
||||
idx = 0;
|
||||
|
||||
while (iter->vromEnd != 0) {
|
||||
if (iter->romEnd != 0) {
|
||||
sDmaMgrDataExistError = 1;
|
||||
sDmaMgrIsRomCompressed = true;
|
||||
}
|
||||
|
||||
osSyncPrintf(
|
||||
@@ -418,8 +419,8 @@ void DmaMgr_Init(void) {
|
||||
}
|
||||
|
||||
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
|
||||
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 0x100, "dmamgr");
|
||||
osCreateThread(&sDmaMgrThread, 0x12, DmaMgr_ThreadEntry, 0, sDmaMgrStack + sizeof(sDmaMgrStack), Z_PRIORITY_DMAMGR);
|
||||
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, STACK_TOP(sDmaMgrStack), 0, 0x100, "dmamgr");
|
||||
osCreateThread(&sDmaMgrThread, 0x12, DmaMgr_ThreadEntry, 0, STACK_TOP(sDmaMgrStack), Z_PRIORITY_DMAMGR);
|
||||
osStartThread(&sDmaMgrThread);
|
||||
}
|
||||
|
||||
|
||||
@@ -989,7 +989,7 @@ void AudioHeap_Init(void) {
|
||||
AudioLoad_InitAsyncLoads();
|
||||
gAudioContext.unk_4 = 0x1000;
|
||||
AudioLoad_LoadPermanentSamples();
|
||||
intMask = osSetIntMask(1);
|
||||
intMask = osSetIntMask(OS_IM_NONE);
|
||||
osWritebackDCacheAll();
|
||||
osSetIntMask(intMask);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,88 @@
|
||||
#include "global.h"
|
||||
|
||||
u8 D_8016F0E0[0xA0]; // unused
|
||||
AudioContext gAudioContext;
|
||||
void (*D_801755D0)(void);
|
||||
s32 D_801755D8[3]; // unused
|
||||
|
||||
const s16 D_8014A6C0[] = {
|
||||
0x1C00, // unused
|
||||
0x0030, // gTatumsPerBeat
|
||||
};
|
||||
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F00, 0xE0E0, 0xBCE0 };
|
||||
|
||||
ReverbSettings D_80133420[][3] = {
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x20, 0x0800, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x0000, 0x0, 0x0 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x30, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x0000, 0xB, 0xB },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x38, 0x2800, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x0000, 0x7, 0x7 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x50, 0x5000, 0, 0, 0x7FFF, 0x1000, 0x1000, 0xFF, 0x3000, 0x7, 0x7 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x40, 0x5000, 0, 0, 0x7FFF, 0x1800, 0x1800, 0xFF, 0x3000, 0x7, 0x7 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x40, 0x5C00, 0, 0, 0x7FFF, 0x2000, 0x2000, 0xFF, 0x3000, 0x4, 0x4 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x30, 0x6000, 0, 0, 0x7FFF, 0x1000, 0x1000, 0xFF, 0x3000, 0xA, 0xA },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x30, 0x6800, 0, 0, 0x7FFF, 0x1400, 0x1400, 0xFF, 0x3000, 0x6, 0x6 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 2, 0x50, 0x5000, 0, 0, 0x7FFF, 0xD000, 0x3000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x20, 0x0000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x0000, 0x0, 0x0 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x30, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x0000, 0xB, 0xB },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
},
|
||||
{
|
||||
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
{ 1, 0x40, 0x5000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 },
|
||||
},
|
||||
};
|
||||
|
||||
AudioSpec gAudioSpecs[18] = {
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x4000, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[1], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[4], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[5], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[6], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[7], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[9], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 2, D_80133420[10], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x2800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0x4800, 0, 0x4000, 0, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0, 0, 0x4000, 0x4800, 0, 0, 0 },
|
||||
{ 32000, 1, 22, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 22, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 16, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 22050, 1, 24, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3600, 0x2600, 0, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -1409,7 +1409,7 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, u32 size, s
|
||||
} else if (nChunks == 1) {
|
||||
asyncLoad->chunkSize = size;
|
||||
} else {
|
||||
asyncLoad->chunkSize = (((s32)size / nChunks) + 0xFF) & ~0xFF;
|
||||
asyncLoad->chunkSize = ALIGN256((s32)size / nChunks);
|
||||
if (asyncLoad->chunkSize < 0x100) {
|
||||
asyncLoad->chunkSize = 0x100;
|
||||
}
|
||||
|
||||
@@ -1313,8 +1313,8 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
command = parameters[0];
|
||||
|
||||
if (channel->filter != NULL) {
|
||||
lowBits = (command >> 4) & 0xF;
|
||||
command &= 0xF;
|
||||
lowBits = (command >> 4) & 0xF; // LowPassCutoff
|
||||
command &= 0xF; // HighPassCutoff
|
||||
AudioHeap_LoadFilter(channel->filter, lowBits, command);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -62,7 +62,7 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) {
|
||||
if (dynaActor != NULL) {
|
||||
func_800434A8(dynaActor);
|
||||
|
||||
if ((actor->flags & 0x4000000) == 0x4000000) {
|
||||
if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_26)) {
|
||||
func_80043538(dynaActor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
u32 D_8012DBC0 = false;
|
||||
u32 gIsCtrlr2Valid = false;
|
||||
|
||||
void func_800D31A0(void) {
|
||||
osSyncPrintf(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST);
|
||||
@@ -11,9 +11,9 @@ void func_800D31A0(void) {
|
||||
}
|
||||
|
||||
void func_800D31F0(void) {
|
||||
D_8012DBC0 = (gPadMgr.validCtrlrsMask & 2) != 0;
|
||||
gIsCtrlr2Valid = (gPadMgr.validCtrlrsMask & 2) != 0;
|
||||
}
|
||||
|
||||
void func_800D3210(void) {
|
||||
D_8012DBC0 = false;
|
||||
gIsCtrlr2Valid = false;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "global.h"
|
||||
|
||||
void Audio_InvalDCache(void* buf, s32 size) {
|
||||
OSIntMask prevMask = osSetIntMask(1);
|
||||
OSIntMask prevMask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
osInvalDCache(buf, size);
|
||||
osSetIntMask(prevMask);
|
||||
}
|
||||
|
||||
void Audio_WritebackDCache(void* buf, s32 size) {
|
||||
OSIntMask prevMask = osSetIntMask(1);
|
||||
OSIntMask prevMask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
osWritebackDCache(buf, size);
|
||||
osSetIntMask(prevMask);
|
||||
|
||||
+969
-275
File diff suppressed because it is too large
Load Diff
+18
-16
@@ -32,22 +32,24 @@ s32 D_8013338C = 0;
|
||||
char D_80133390[] = "SEQ H";
|
||||
char D_80133398[] = " L";
|
||||
|
||||
// bss
|
||||
extern SoundRequest sSoundRequests[0x100];
|
||||
extern SoundBankEntry D_8016BAD0[9];
|
||||
extern SoundBankEntry D_8016BC80[12];
|
||||
extern SoundBankEntry D_8016BEC0[22];
|
||||
extern SoundBankEntry D_8016C2E0[20];
|
||||
extern SoundBankEntry D_8016C6A0[8];
|
||||
extern SoundBankEntry D_8016C820[3];
|
||||
extern SoundBankEntry D_8016C8B0[5];
|
||||
extern u8 sSoundBankListEnd[7];
|
||||
extern u8 sSoundBankFreeListStart[7];
|
||||
extern u8 sSoundBankUnused[7];
|
||||
extern u8 sCurSfxPlayerChannelIdx;
|
||||
extern UnusedBankLerp sUnusedBankLerp[7];
|
||||
|
||||
// data
|
||||
SoundBankEntry D_8016BAD0[9];
|
||||
SoundBankEntry D_8016BC80[12];
|
||||
SoundBankEntry D_8016BEC0[22];
|
||||
SoundBankEntry D_8016C2E0[20];
|
||||
SoundBankEntry D_8016C6A0[8];
|
||||
SoundBankEntry D_8016C820[3];
|
||||
SoundBankEntry D_8016C8B0[5];
|
||||
SoundRequest sSoundRequests[0x100];
|
||||
u8 sSoundBankListEnd[7];
|
||||
u8 sSoundBankFreeListStart[7];
|
||||
u8 sSoundBankUnused[7];
|
||||
ActiveSound gActiveSounds[7][3];
|
||||
u8 sCurSfxPlayerChannelIdx;
|
||||
u8 gSoundBankMuted[7];
|
||||
UnusedBankLerp sUnusedBankLerp[7];
|
||||
u16 gAudioSfxSwapSource[10];
|
||||
u16 gAudioSfxSwapTarget[10];
|
||||
u8 gAudioSfxSwapMode[10];
|
||||
|
||||
// sSoundRequests ring buffer endpoints. read index <= write index, wrapping around mod 256.
|
||||
u8 sSoundRequestWriteIndex = 0;
|
||||
|
||||
+21
-17
@@ -2,13 +2,23 @@
|
||||
#include "global.h"
|
||||
#include "ultra64/abi.h"
|
||||
|
||||
extern u8 D_8016E348[4];
|
||||
extern u32 sAudioSeqCmds[0x100];
|
||||
extern u8 sSeqCmdRdPos;
|
||||
extern u8 sSeqCmdWrPos;
|
||||
extern u8 D_80133408;
|
||||
extern u8 D_80133418;
|
||||
extern u8 D_80133410[];
|
||||
typedef struct {
|
||||
u8 unk_0;
|
||||
u8 unk_1; // importance?
|
||||
} Struct_8016E320;
|
||||
|
||||
Struct_8016E320 D_8016E320[4][5];
|
||||
u8 D_8016E348[4];
|
||||
u32 sAudioSeqCmds[0x100];
|
||||
unk_D_8016E750 D_8016E750[4];
|
||||
|
||||
u8 sSeqCmdWrPos = 0;
|
||||
u8 sSeqCmdRdPos = 0;
|
||||
u8 D_80133408 = 0;
|
||||
u8 D_8013340C = 1;
|
||||
u8 D_80133410[] = { 0, 1, 2, 3 };
|
||||
u8 gAudioSpecId = 0;
|
||||
u8 D_80133418 = 0;
|
||||
|
||||
// TODO: clean up these macros. They are similar to ones in code_800EC960.c but without casts.
|
||||
#define Audio_StartSeq(playerIdx, fadeTimer, seqId) \
|
||||
@@ -85,12 +95,6 @@ typedef enum {
|
||||
CMDF
|
||||
} SeqCmdType;
|
||||
|
||||
typedef struct {
|
||||
u8 unk_0;
|
||||
u8 unk_1; // importance?
|
||||
} Struct_8016E320;
|
||||
extern Struct_8016E320 D_8016E320[][5]; // sorted by unk_1, descending
|
||||
|
||||
void Audio_ProcessSeqCmd(u32 cmd) {
|
||||
s32 pad[2];
|
||||
u16 fadeTimer;
|
||||
@@ -391,14 +395,14 @@ void func_800FA174(u8 playerIdx) {
|
||||
D_8016E348[playerIdx] = 0;
|
||||
}
|
||||
|
||||
void func_800FA18C(u8 playeridx, u8 arg1) {
|
||||
void func_800FA18C(u8 playerIdx, u8 arg1) {
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < D_8016E750[playeridx].unk_4D; i++) {
|
||||
u8 unkb = (D_8016E750[playeridx].unk_2C[i] & 0xF00000) >> 20;
|
||||
for (i = 0; i < D_8016E750[playerIdx].unk_4D; i++) {
|
||||
u8 unkb = (D_8016E750[playerIdx].unk_2C[i] & 0xF00000) >> 20;
|
||||
|
||||
if (unkb == arg1) {
|
||||
D_8016E750[playeridx].unk_2C[i] = 0xFF000000;
|
||||
D_8016E750[playerIdx].unk_2C[i] = 0xFF000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-16
@@ -1300,8 +1300,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
||||
DbCamera_SetTextValue(dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll, &D_8012D084[10], 3);
|
||||
func_8006376C(0x10, 0x16, (dbCamera->sub.unk_0A == 2) ? 7 : 4, D_8012D084);
|
||||
func_8006376C(0xF, 0x17, (dbCamera->sub.unk_0A == 3) ? 7 : 4,
|
||||
(dbCamera->sub.mode == 1) ? D_8012CF14
|
||||
: (dbCamera->sub.mode == 0) ? *D_8012CF18 : D_8012CFB0);
|
||||
(dbCamera->sub.mode == 1) ? D_8012CF14
|
||||
: (dbCamera->sub.mode == 0) ? *D_8012CF18
|
||||
: D_8012CFB0);
|
||||
if (dbCamera->sub.unk_0C) {
|
||||
D_8012D05C[80] = '>';
|
||||
} else {
|
||||
@@ -1326,9 +1327,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
||||
|
||||
if (dbCamera->sub.mode != 1) {
|
||||
func_8006376C(3, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144)
|
||||
? 7
|
||||
: !D_80161144 ? 4 : 3,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
|
||||
: !D_80161144 ? 4
|
||||
: 3,
|
||||
D_8012CF30);
|
||||
sp110 = 'X';
|
||||
DbCamera_SetTextValue(dbCamera->at.x, &sp111, 6);
|
||||
@@ -1339,10 +1340,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
||||
sp110 = 'Z';
|
||||
DbCamera_SetTextValue(dbCamera->at.z, &sp111, 6);
|
||||
func_8006376C(3, 0x19, 2, &sp110);
|
||||
func_8006376C(
|
||||
0x1E, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 : D_80161144 ? 4 : 3,
|
||||
D_8012CF34);
|
||||
func_8006376C(0x1E, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
|
||||
: D_80161144 ? 4
|
||||
: 3,
|
||||
D_8012CF34);
|
||||
sp110 = 'X';
|
||||
DbCamera_SetTextValue(dbCamera->eye.x, &sp111, 6);
|
||||
func_8006376C(0x1E, 0x17, 2, &sp110);
|
||||
@@ -1357,9 +1359,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
||||
OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp7C);
|
||||
spFC.yaw -= cam->playerPosRot.rot.y;
|
||||
func_8006376C(3, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144)
|
||||
? 7
|
||||
: !D_80161144 ? 4 : 3,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
|
||||
: !D_80161144 ? 4
|
||||
: 3,
|
||||
D_8012CF30);
|
||||
DbCamera_SetTextValue(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4);
|
||||
func_8006376C(3, 0x17, 3, D_8012D0E4);
|
||||
@@ -1369,10 +1371,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
||||
func_8006376C(3, 0x19, 3, D_8012D0D4);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp80);
|
||||
spFC.yaw -= cam->playerPosRot.rot.y;
|
||||
func_8006376C(
|
||||
0x1E, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 : D_80161144 ? 4 : 3,
|
||||
D_8012CF34);
|
||||
func_8006376C(0x1E, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
|
||||
: D_80161144 ? 4
|
||||
: 3,
|
||||
D_8012CF34);
|
||||
DbCamera_SetTextValue(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4);
|
||||
func_8006376C(0x1C, 0x17, 3, D_8012D0E4);
|
||||
DbCamera_SetTextValue(spFC.yaw * 0.00549325f, &D_8012D0F8[10], 4);
|
||||
|
||||
+629
-400
File diff suppressed because it is too large
Load Diff
+132
-100
@@ -1,7 +1,35 @@
|
||||
/**
|
||||
* @file fault_drawer.c
|
||||
*
|
||||
* Implements routines for drawing text with a fixed font directly to a framebuffer, used in displaying
|
||||
* the crash screen implemented by fault.c
|
||||
*/
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
// rodata
|
||||
typedef struct {
|
||||
/* 0x00 */ u16* fb;
|
||||
/* 0x04 */ u16 w;
|
||||
/* 0x08 */ u16 h;
|
||||
/* 0x0A */ u16 yStart;
|
||||
/* 0x0C */ u16 yEnd;
|
||||
/* 0x0E */ u16 xStart;
|
||||
/* 0x10 */ u16 xEnd;
|
||||
/* 0x12 */ u16 foreColor;
|
||||
/* 0x14 */ u16 backColor;
|
||||
/* 0x14 */ u16 cursorX;
|
||||
/* 0x16 */ u16 cursorY;
|
||||
/* 0x18 */ const u32* fontData;
|
||||
/* 0x1C */ u8 charW;
|
||||
/* 0x1D */ u8 charH;
|
||||
/* 0x1E */ s8 charWPad;
|
||||
/* 0x1F */ s8 charHPad;
|
||||
/* 0x20 */ u16 printColors[10];
|
||||
/* 0x34 */ u8 escCode; // bool
|
||||
/* 0x35 */ u8 osSyncPrintfEnabled;
|
||||
/* 0x38 */ void (*inputCallback)(void);
|
||||
} FaultDrawer; // size = 0x3C
|
||||
|
||||
const u32 sFaultDrawerFont[] = {
|
||||
0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, 0x01562990,
|
||||
0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, 0x08BFFB00, 0x0EFFFFC0,
|
||||
@@ -34,25 +62,27 @@ const u32 sFaultDrawerFont[] = {
|
||||
0x05546F50, 0x00A99800, 0x02222080, 0x02001888,
|
||||
};
|
||||
|
||||
#define FAULT_DRAWER_CURSOR_X 22
|
||||
#define FAULT_DRAWER_CURSOR_Y 16
|
||||
|
||||
FaultDrawer sFaultDrawerDefault = {
|
||||
(u16*)(0x80400000 - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])), // fb
|
||||
SCREEN_WIDTH, // w
|
||||
SCREEN_HEIGHT, // h
|
||||
16, // yStart
|
||||
223, // yEnd
|
||||
22, // xStart
|
||||
297, // xEnd
|
||||
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
|
||||
GPACK_RGBA5551(0, 0, 0, 0), // backColor
|
||||
22, // cursorX
|
||||
16, // cursorY
|
||||
sFaultDrawerFont, // font
|
||||
(u16*)(PHYS_TO_K0(0x400000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])),
|
||||
SCREEN_WIDTH,
|
||||
SCREEN_HEIGHT,
|
||||
FAULT_DRAWER_CURSOR_Y,
|
||||
SCREEN_HEIGHT - FAULT_DRAWER_CURSOR_Y - 1,
|
||||
FAULT_DRAWER_CURSOR_X,
|
||||
SCREEN_WIDTH - FAULT_DRAWER_CURSOR_X - 1,
|
||||
GPACK_RGBA5551(255, 255, 255, 1),
|
||||
GPACK_RGBA5551(0, 0, 0, 0),
|
||||
FAULT_DRAWER_CURSOR_X,
|
||||
FAULT_DRAWER_CURSOR_Y,
|
||||
sFaultDrawerFont,
|
||||
8,
|
||||
8,
|
||||
0,
|
||||
0,
|
||||
{
|
||||
// printColors
|
||||
GPACK_RGBA5551(0, 0, 0, 1),
|
||||
GPACK_RGBA5551(255, 0, 0, 1),
|
||||
GPACK_RGBA5551(0, 255, 0, 1),
|
||||
@@ -64,23 +94,23 @@ FaultDrawer sFaultDrawerDefault = {
|
||||
GPACK_RGBA5551(120, 120, 120, 1),
|
||||
GPACK_RGBA5551(176, 176, 176, 1),
|
||||
},
|
||||
0, // escCode
|
||||
0, // osSyncPrintfEnabled
|
||||
NULL, // inputCallback
|
||||
false,
|
||||
false,
|
||||
NULL,
|
||||
};
|
||||
|
||||
FaultDrawer sFaultDrawerStruct;
|
||||
FaultDrawer sFaultDrawer;
|
||||
char D_8016B6C0[0x20];
|
||||
|
||||
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
sFaultDrawerStruct.osSyncPrintfEnabled = enabled;
|
||||
sFaultDrawer.osSyncPrintfEnabled = enabled;
|
||||
}
|
||||
|
||||
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) {
|
||||
u16* fb;
|
||||
s32 x, y;
|
||||
s32 xDiff = sFaultDrawerStruct.w - xStart;
|
||||
s32 yDiff = sFaultDrawerStruct.h - yStart;
|
||||
s32 xDiff = sFaultDrawer.w - xStart;
|
||||
s32 yDiff = sFaultDrawer.h - yStart;
|
||||
s32 xSize = xEnd - xStart + 1;
|
||||
s32 ySize = yEnd - yStart + 1;
|
||||
|
||||
@@ -93,12 +123,12 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col
|
||||
ySize = yDiff;
|
||||
}
|
||||
|
||||
fb = sFaultDrawerStruct.fb + sFaultDrawerStruct.w * yStart + xStart;
|
||||
fb = sFaultDrawer.fb + sFaultDrawer.w * yStart + xStart;
|
||||
for (y = 0; y < ySize; y++) {
|
||||
for (x = 0; x < xSize; x++) {
|
||||
*fb++ = color;
|
||||
}
|
||||
fb += sFaultDrawerStruct.w - xSize;
|
||||
fb += sFaultDrawer.w - xSize;
|
||||
}
|
||||
|
||||
osWritebackDCacheAll();
|
||||
@@ -110,31 +140,29 @@ void FaultDrawer_DrawChar(char c) {
|
||||
s32 x, y;
|
||||
const u32* dataPtr;
|
||||
u32 data;
|
||||
s32 cursorX = sFaultDrawerStruct.cursorX;
|
||||
s32 cursorY = sFaultDrawerStruct.cursorY;
|
||||
const u32** fontData = &sFaultDrawerStruct.fontData;
|
||||
s32 cursorX = sFaultDrawer.cursorX;
|
||||
s32 cursorY = sFaultDrawer.cursorY;
|
||||
const u32** fontData = &sFaultDrawer.fontData;
|
||||
s32 shift = c % 4;
|
||||
|
||||
dataPtr = &fontData[0][(((c / 8) * 16) + ((c & 4) >> 2))];
|
||||
fb = sFaultDrawerStruct.fb + (sFaultDrawerStruct.w * cursorY) + cursorX;
|
||||
fb = sFaultDrawer.fb + (sFaultDrawer.w * cursorY) + cursorX;
|
||||
|
||||
if ((sFaultDrawerStruct.xStart <= cursorX) &&
|
||||
((sFaultDrawerStruct.charW + cursorX - 1) <= sFaultDrawerStruct.xEnd) &&
|
||||
(sFaultDrawerStruct.yStart <= cursorY) &&
|
||||
((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) {
|
||||
for (y = 0; y < sFaultDrawerStruct.charH; y++) {
|
||||
if ((sFaultDrawer.xStart <= cursorX) && ((sFaultDrawer.charW + cursorX - 1) <= sFaultDrawer.xEnd) &&
|
||||
(sFaultDrawer.yStart <= cursorY) && ((sFaultDrawer.charH + cursorY - 1) <= sFaultDrawer.yEnd)) {
|
||||
for (y = 0; y < sFaultDrawer.charH; y++) {
|
||||
u32 mask = 0x10000000 << shift;
|
||||
|
||||
data = *dataPtr;
|
||||
for (x = 0; x < sFaultDrawerStruct.charW; x++) {
|
||||
for (x = 0; x < sFaultDrawer.charW; x++) {
|
||||
if (mask & data) {
|
||||
fb[x] = sFaultDrawerStruct.foreColor;
|
||||
} else if (sFaultDrawerStruct.backColor & 1) {
|
||||
fb[x] = sFaultDrawerStruct.backColor;
|
||||
fb[x] = sFaultDrawer.foreColor;
|
||||
} else if (sFaultDrawer.backColor & 1) {
|
||||
fb[x] = sFaultDrawer.backColor;
|
||||
}
|
||||
mask >>= 4;
|
||||
}
|
||||
fb += sFaultDrawerStruct.w;
|
||||
fb += sFaultDrawer.w;
|
||||
dataPtr += 2;
|
||||
}
|
||||
}
|
||||
@@ -142,37 +170,40 @@ void FaultDrawer_DrawChar(char c) {
|
||||
|
||||
s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
||||
s32 i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (color == sFaultDrawerStruct.printColors[i]) {
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sFaultDrawer.printColors); i++) {
|
||||
if (color == sFaultDrawer.printColors[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FaultDrawer_UpdatePrintColor() {
|
||||
void FaultDrawer_UpdatePrintColor(void) {
|
||||
s32 idx;
|
||||
|
||||
if (sFaultDrawerStruct.osSyncPrintfEnabled) {
|
||||
if (sFaultDrawer.osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_RST);
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.foreColor);
|
||||
if (idx >= 0 && idx < 8) {
|
||||
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawer.foreColor);
|
||||
if (idx >= 0 && idx < ARRAY_COUNT(sFaultDrawer.printColors) - 2) {
|
||||
osSyncPrintf(VT_SGR("3%d"), idx);
|
||||
}
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.backColor);
|
||||
if (idx >= 0 && idx < 8) {
|
||||
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawer.backColor);
|
||||
if (idx >= 0 && idx < ARRAY_COUNT(sFaultDrawer.printColors) - 2) {
|
||||
osSyncPrintf(VT_SGR("4%d"), idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FaultDrawer_SetForeColor(u16 color) {
|
||||
sFaultDrawerStruct.foreColor = color;
|
||||
sFaultDrawer.foreColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
void FaultDrawer_SetBackColor(u16 color) {
|
||||
sFaultDrawerStruct.backColor = color;
|
||||
sFaultDrawer.backColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
@@ -181,101 +212,102 @@ void FaultDrawer_SetFontColor(u16 color) {
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
|
||||
sFaultDrawerStruct.charWPad = padW;
|
||||
sFaultDrawerStruct.charHPad = padH;
|
||||
sFaultDrawer.charWPad = padW;
|
||||
sFaultDrawer.charHPad = padH;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCursor(s32 x, s32 y) {
|
||||
if (sFaultDrawerStruct.osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_CUP("%d", "%d"),
|
||||
(y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad),
|
||||
(x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad));
|
||||
if (sFaultDrawer.osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_CUP("%d", "%d"), (y - sFaultDrawer.yStart) / (sFaultDrawer.charH + sFaultDrawer.charHPad),
|
||||
(x - sFaultDrawer.xStart) / (sFaultDrawer.charW + sFaultDrawer.charWPad));
|
||||
}
|
||||
sFaultDrawerStruct.cursorX = x;
|
||||
sFaultDrawerStruct.cursorY = y;
|
||||
sFaultDrawer.cursorX = x;
|
||||
sFaultDrawer.cursorY = y;
|
||||
}
|
||||
|
||||
void FaultDrawer_FillScreen() {
|
||||
if (sFaultDrawerStruct.osSyncPrintfEnabled) {
|
||||
void FaultDrawer_FillScreen(void) {
|
||||
if (sFaultDrawer.osSyncPrintfEnabled) {
|
||||
osSyncPrintf(VT_CLS);
|
||||
}
|
||||
|
||||
FaultDrawer_DrawRecImpl(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart, sFaultDrawerStruct.xEnd,
|
||||
sFaultDrawerStruct.yEnd, sFaultDrawerStruct.backColor | 1);
|
||||
FaultDrawer_SetCursor(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart);
|
||||
FaultDrawer_DrawRecImpl(sFaultDrawer.xStart, sFaultDrawer.yStart, sFaultDrawer.xEnd, sFaultDrawer.yEnd,
|
||||
sFaultDrawer.backColor | 1);
|
||||
FaultDrawer_SetCursor(sFaultDrawer.xStart, sFaultDrawer.yStart);
|
||||
}
|
||||
|
||||
void* FaultDrawer_FormatStringFunc(void* arg, const char* str, u32 count) {
|
||||
void* FaultDrawer_PrintCallback(void* arg, const char* str, u32 count) {
|
||||
for (; count != 0; count--, str++) {
|
||||
s32 curXStart;
|
||||
s32 curXEnd;
|
||||
|
||||
if (sFaultDrawerStruct.escCode) {
|
||||
sFaultDrawerStruct.escCode = false;
|
||||
if (*str > 0x30 && *str < 0x3A) {
|
||||
FaultDrawer_SetForeColor(sFaultDrawerStruct.printColors[*str - 0x30]);
|
||||
if (sFaultDrawer.escCode) {
|
||||
sFaultDrawer.escCode = false;
|
||||
if (*str > '0' && *str <= '9') {
|
||||
FaultDrawer_SetForeColor(sFaultDrawer.printColors[*str - '0']);
|
||||
}
|
||||
|
||||
curXStart = sFaultDrawerStruct.cursorX;
|
||||
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
|
||||
curXStart = sFaultDrawer.cursorX;
|
||||
curXEnd = sFaultDrawer.xEnd - sFaultDrawer.charW;
|
||||
} else {
|
||||
switch (*str) {
|
||||
case '\n':
|
||||
if (sFaultDrawerStruct.osSyncPrintfEnabled) {
|
||||
if (sFaultDrawer.osSyncPrintfEnabled) {
|
||||
osSyncPrintf("\n");
|
||||
}
|
||||
|
||||
sFaultDrawerStruct.cursorX = sFaultDrawerStruct.w;
|
||||
curXStart = sFaultDrawerStruct.cursorX;
|
||||
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
|
||||
sFaultDrawer.cursorX = sFaultDrawer.w;
|
||||
curXStart = sFaultDrawer.cursorX;
|
||||
curXEnd = sFaultDrawer.xEnd - sFaultDrawer.charW;
|
||||
break;
|
||||
case '\x1A':
|
||||
sFaultDrawerStruct.escCode = true;
|
||||
curXStart = sFaultDrawerStruct.cursorX;
|
||||
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
|
||||
case FAULT_ESC:
|
||||
sFaultDrawer.escCode = true;
|
||||
curXStart = sFaultDrawer.cursorX;
|
||||
curXEnd = sFaultDrawer.xEnd - sFaultDrawer.charW;
|
||||
break;
|
||||
default:
|
||||
if (sFaultDrawerStruct.osSyncPrintfEnabled) {
|
||||
if (sFaultDrawer.osSyncPrintfEnabled) {
|
||||
osSyncPrintf("%c", *str);
|
||||
}
|
||||
|
||||
FaultDrawer_DrawChar(*str);
|
||||
sFaultDrawerStruct.cursorX += sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad;
|
||||
sFaultDrawer.cursorX += sFaultDrawer.charW + sFaultDrawer.charWPad;
|
||||
|
||||
curXStart = sFaultDrawerStruct.cursorX;
|
||||
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
|
||||
curXStart = sFaultDrawer.cursorX;
|
||||
curXEnd = sFaultDrawer.xEnd - sFaultDrawer.charW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (curXEnd <= curXStart) {
|
||||
sFaultDrawerStruct.cursorX = sFaultDrawerStruct.xStart;
|
||||
sFaultDrawerStruct.cursorY += sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad;
|
||||
if (sFaultDrawerStruct.yEnd - sFaultDrawerStruct.charH <= sFaultDrawerStruct.cursorY) {
|
||||
if (sFaultDrawerStruct.inputCallback) {
|
||||
sFaultDrawerStruct.inputCallback();
|
||||
sFaultDrawer.cursorX = sFaultDrawer.xStart;
|
||||
sFaultDrawer.cursorY += sFaultDrawer.charH + sFaultDrawer.charHPad;
|
||||
if (sFaultDrawer.yEnd - sFaultDrawer.charH <= sFaultDrawer.cursorY) {
|
||||
if (sFaultDrawer.inputCallback) {
|
||||
sFaultDrawer.inputCallback();
|
||||
FaultDrawer_FillScreen();
|
||||
}
|
||||
sFaultDrawerStruct.cursorY = sFaultDrawerStruct.yStart;
|
||||
sFaultDrawer.cursorY = sFaultDrawer.yStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osWritebackDCacheAll();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
void FaultDrawer_VPrintf(const char* str, char* args) { // va_list
|
||||
_Printf(FaultDrawer_FormatStringFunc, (char*)&sFaultDrawerStruct, str, args);
|
||||
s32 FaultDrawer_VPrintf(const char* fmt, va_list args) {
|
||||
return _Printf(FaultDrawer_PrintCallback, &sFaultDrawer, fmt, args);
|
||||
}
|
||||
|
||||
void FaultDrawer_Printf(const char* fmt, ...) {
|
||||
s32 FaultDrawer_Printf(const char* fmt, ...) {
|
||||
s32 ret;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
FaultDrawer_VPrintf(fmt, args);
|
||||
ret = FaultDrawer_VPrintf(fmt, args);
|
||||
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
|
||||
@@ -289,20 +321,20 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) {
|
||||
}
|
||||
|
||||
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) {
|
||||
sFaultDrawerStruct.fb = fb;
|
||||
sFaultDrawerStruct.w = w;
|
||||
sFaultDrawerStruct.h = h;
|
||||
sFaultDrawer.fb = fb;
|
||||
sFaultDrawer.w = w;
|
||||
sFaultDrawer.h = h;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetInputCallback(void (*callback)()) {
|
||||
sFaultDrawerStruct.inputCallback = callback;
|
||||
void FaultDrawer_SetInputCallback(void (*callback)(void)) {
|
||||
sFaultDrawer.inputCallback = callback;
|
||||
}
|
||||
|
||||
void FaultDrawer_WritebackFBDCache() {
|
||||
osWritebackDCache(sFaultDrawerStruct.fb, sFaultDrawerStruct.w * sFaultDrawerStruct.h * 2);
|
||||
void FaultDrawer_WritebackFBDCache(void) {
|
||||
osWritebackDCache(sFaultDrawer.fb, sFaultDrawer.w * sFaultDrawer.h * sizeof(u16));
|
||||
}
|
||||
|
||||
void FaultDrawer_SetDefault() {
|
||||
bcopy(&sFaultDrawerDefault, &sFaultDrawerStruct, sizeof(FaultDrawer));
|
||||
sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH]));
|
||||
void FaultDrawer_Init(void) {
|
||||
bcopy(&sFaultDrawerDefault, &sFaultDrawer, sizeof(FaultDrawer));
|
||||
sFaultDrawer.fb = (u16*)(PHYS_TO_K0(osMemSize) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH]));
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ void GameState_FaultPrint(void) {
|
||||
FaultDrawer_DrawText(120, 180, "%08x", sLastButtonPressed);
|
||||
for (i = 0; i < ARRAY_COUNT(sBtnChars); i++) {
|
||||
if (sLastButtonPressed & (1 << i)) {
|
||||
FaultDrawer_DrawText((i * 8) + 0x78, 0xBE, "%c", sBtnChars[i]);
|
||||
FaultDrawer_DrawText((i * 8) + 120, 190, "%c", sBtnChars[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void func_800C4344(GameState* gameState) {
|
||||
HREG(95) = CHECK_BTN_ALL(selectedInput->press.button, hReg82);
|
||||
}
|
||||
|
||||
if (D_8012DBC0 != 0) {
|
||||
if (gIsCtrlr2Valid) {
|
||||
func_8006390C(&gameState->input[1]);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -134,7 +134,7 @@ void Graph_Init(GraphicsContext* gfxCtx) {
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff));
|
||||
func_800D31F0();
|
||||
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, 0, 0);
|
||||
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL);
|
||||
}
|
||||
|
||||
void Graph_Destroy(GraphicsContext* gfxCtx) {
|
||||
@@ -381,14 +381,14 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
sGraphUpdateTime = time;
|
||||
}
|
||||
|
||||
if (D_8012DBC0 && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
|
||||
if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
|
||||
CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
|
||||
gSaveContext.gameMode = 0;
|
||||
SET_NEXT_GAMESTATE(gameState, Select_Init, SelectContext);
|
||||
gameState->running = false;
|
||||
}
|
||||
|
||||
if (D_8012DBC0 && PreNmiBuff_IsResetting(gAppNmiBufferPtr) && !gameState->unk_A0) {
|
||||
if (gIsCtrlr2Valid && PreNmiBuff_IsResetting(gAppNmiBufferPtr) && !gameState->unk_A0) {
|
||||
// "To reset mode"
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "PRE-NMIによりリセットモードに移行します\n" VT_RST);
|
||||
SET_NEXT_GAMESTATE(gameState, PreNMI_Init, PreNMIContext);
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ) {
|
||||
LogUtils_CheckNullPointer("c", c, "../irqmgr.c", 97);
|
||||
LogUtils_CheckNullPointer("msgQ", msgQ, "../irqmgr.c", 98);
|
||||
|
||||
prevInt = osSetIntMask(1);
|
||||
prevInt = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
c->queue = msgQ;
|
||||
c->prev = this->clients;
|
||||
@@ -48,7 +48,7 @@ void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c) {
|
||||
LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 129);
|
||||
LogUtils_CheckNullPointer("c", c, "../irqmgr.c", 130);
|
||||
|
||||
prevInt = osSetIntMask(1);
|
||||
prevInt = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter == c) {
|
||||
|
||||
+13
-13
@@ -11,11 +11,11 @@ PadMgr gPadMgr;
|
||||
IrqMgr gIrqMgr;
|
||||
u32 gSegments[NUM_SEGMENTS];
|
||||
OSThread sGraphThread;
|
||||
u8 sGraphStack[0x1800];
|
||||
u8 sSchedStack[0x600];
|
||||
u8 sAudioStack[0x800];
|
||||
u8 sPadMgrStack[0x500];
|
||||
u8 sIrqMgrStack[0x500];
|
||||
STACK(sGraphStack, 0x1800);
|
||||
STACK(sSchedStack, 0x600);
|
||||
STACK(sAudioStack, 0x800);
|
||||
STACK(sPadMgrStack, 0x500);
|
||||
STACK(sIrqMgrStack, 0x500);
|
||||
StackEntry sGraphStackInfo;
|
||||
StackEntry sSchedStackInfo;
|
||||
StackEntry sAudioStackInfo;
|
||||
@@ -75,25 +75,25 @@ void Main(void* arg) {
|
||||
Main_LogSystemHeap();
|
||||
|
||||
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3C);
|
||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
|
||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
|
||||
IrqMgr_Init(&gIrqMgr, &sGraphStackInfo, Z_PRIORITY_IRQMGR, 1);
|
||||
|
||||
osSyncPrintf("タスクスケジューラの初期化\n"); // "Initialize the task scheduler"
|
||||
StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack + sizeof(sSchedStack), 0, 0x100, "sched");
|
||||
StackCheck_Init(&sSchedStackInfo, sSchedStack, STACK_TOP(sSchedStack), 0, 0x100, "sched");
|
||||
Sched_Init(&gSchedContext, &sAudioStack, Z_PRIORITY_SCHED, D_80013960, 1, &gIrqMgr);
|
||||
|
||||
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
|
||||
|
||||
StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio");
|
||||
AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
|
||||
StackCheck_Init(&sAudioStackInfo, sAudioStack, STACK_TOP(sAudioStack), 0, 0x100, "audio");
|
||||
AudioMgr_Init(&gAudioMgr, STACK_TOP(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
|
||||
|
||||
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr");
|
||||
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, STACK_TOP(sPadMgrStack), 0, 0x100, "padmgr");
|
||||
PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, &sIrqMgrStack);
|
||||
|
||||
AudioMgr_Unlock(&gAudioMgr);
|
||||
|
||||
StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg, sGraphStack + sizeof(sGraphStack), Z_PRIORITY_GRAPH);
|
||||
StackCheck_Init(&sGraphStackInfo, sGraphStack, STACK_TOP(sGraphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg, STACK_TOP(sGraphStack), Z_PRIORITY_GRAPH);
|
||||
osStartThread(&sGraphThread);
|
||||
osSetThreadPri(0, Z_PRIORITY_SCHED);
|
||||
|
||||
@@ -111,6 +111,6 @@ void Main(void* arg) {
|
||||
|
||||
osSyncPrintf("mainproc 後始末\n"); // "Cleanup"
|
||||
osDestroyThread(&sGraphThread);
|
||||
func_800FBFD8();
|
||||
RcpUtils_Reset();
|
||||
osSyncPrintf("mainproc 実行終了\n"); // "End of execution"
|
||||
}
|
||||
|
||||
+3
-3
@@ -165,7 +165,7 @@ void PadMgr_RumbleStop(PadMgr* padMgr) {
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (osMotorInit(ctrlrQ, &padMgr->pfs[i], i) == 0) {
|
||||
if ((gFaultStruct.msgId == 0) && (padMgr->rumbleOnFrames != 0)) {
|
||||
if ((gFaultMgr.msgId == 0) && (padMgr->rumbleOnFrames != 0)) {
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// "Stop vibration pack"
|
||||
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
|
||||
@@ -286,7 +286,7 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
|
||||
mask = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (padMgr->padStatus[i].errno == 0) {
|
||||
if (padMgr->padStatus[i].type == 5) {
|
||||
if (padMgr->padStatus[i].type == CONT_TYPE_NORMAL) {
|
||||
mask |= 1 << i;
|
||||
} else {
|
||||
LOG_HEX("this->pad_status[i].type", padMgr->padStatus[i].type, "../padmgr.c", 458);
|
||||
@@ -297,7 +297,7 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
|
||||
}
|
||||
padMgr->validCtrlrsMask = mask;
|
||||
|
||||
if (gFaultStruct.msgId) {
|
||||
if (gFaultMgr.msgId != 0) {
|
||||
PadMgr_RumbleStop(padMgr);
|
||||
} else if (padMgr->rumbleOffFrames > 0) {
|
||||
--padMgr->rumbleOffFrames;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
if (x & DPC_STATUS_##name) \
|
||||
osSyncPrintf(#name " ")
|
||||
|
||||
void func_800FBCE0() {
|
||||
void RcpUtils_PrintRegisterStatus() {
|
||||
u32 spStatus = __osSpGetStatus();
|
||||
u32 dpStatus = osDpGetStatus();
|
||||
|
||||
@@ -44,9 +44,9 @@ void func_800FBCE0() {
|
||||
osSyncPrintf("\n");
|
||||
}
|
||||
|
||||
void func_800FBFD8() {
|
||||
func_800FBCE0();
|
||||
void RcpUtils_Reset() {
|
||||
RcpUtils_PrintRegisterStatus();
|
||||
osDpSetStatus(DPC_SET_FREEZE | DPC_SET_FLUSH);
|
||||
__osSpSetStatus(SP_SET_HALT | SP_SET_SIG2 | SP_CLR_INTR_BREAK);
|
||||
func_800FBCE0();
|
||||
RcpUtils_PrintRegisterStatus();
|
||||
}
|
||||
+2
-2
@@ -26,7 +26,7 @@ void Sched_SwapFrameBuffer(CfbInfo* cfbInfo) {
|
||||
(cfbInfo != NULL ? cfbInfo->swapBuffer : NULL));
|
||||
}
|
||||
width = cfbInfo->viMode != NULL ? cfbInfo->viMode->comRegs.width : (u32)gScreenWidth;
|
||||
Fault_SetFB(cfbInfo->swapBuffer, width, 0x10);
|
||||
Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 0x10);
|
||||
|
||||
if (HREG(80) == 0xD && HREG(95) != 0xD) {
|
||||
HREG(81) = 0;
|
||||
@@ -78,7 +78,7 @@ void Sched_HandleReset(SchedContext* sc) {
|
||||
OS_CYCLES_TO_USEC(now - sRSPAudioStartTime), "../sched.c", 421);
|
||||
} else if (OS_CYCLES_TO_USEC(now - sRSPGFXStartTime) > 1000000 ||
|
||||
OS_CYCLES_TO_USEC(now - sRDPStartTime) > 1000000) {
|
||||
func_800FBFD8();
|
||||
RcpUtils_Reset();
|
||||
if (sc->curRSPTask != NULL) {
|
||||
LOG_TIME("(((u64)(now - graph_rsp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
||||
OS_CYCLES_TO_USEC(now - sRSPGFXStartTime), "../sched.c", 427);
|
||||
|
||||
@@ -14,7 +14,7 @@ volatile OSTime gRSPGFXTotalTime;
|
||||
volatile OSTime gRSPOtherTotalTime;
|
||||
volatile OSTime D_8016A578;
|
||||
volatile OSTime gRDPTotalTime;
|
||||
SpeedMeterTimeEntry* gSpeedMeterTimeEntryPtr;
|
||||
SpeedMeterTimeEntry* sSpeedMeterTimeEntryPtr;
|
||||
|
||||
SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = {
|
||||
{ &D_8016A520, 0, 0, GPACK_RGBA5551(255, 0, 0, 1) }, { &D_8016A528, 0, 2, GPACK_RGBA5551(255, 255, 0, 1) },
|
||||
@@ -62,11 +62,11 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
|
||||
return;
|
||||
}
|
||||
|
||||
gSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
|
||||
sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
|
||||
for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
|
||||
temp = ((f64) * (gSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0;
|
||||
gSpeedMeterTimeEntryPtr->x = temp + baseX;
|
||||
gSpeedMeterTimeEntryPtr++;
|
||||
temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0;
|
||||
sSpeedMeterTimeEntryPtr->x = temp + baseX;
|
||||
sSpeedMeterTimeEntryPtr++;
|
||||
}
|
||||
|
||||
View_Init(&view, gfxCtx);
|
||||
@@ -88,11 +88,11 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
|
||||
DrawRec(gfx++, GPACK_RGBA5551(255, 0, 0, 1), baseX + 64 * 2, uly, baseX + 64 * 3, lry);
|
||||
DrawRec(gfx++, GPACK_RGBA5551(255, 0, 255, 1), baseX + 64 * 3, uly, baseX + 64 * 4, lry);
|
||||
|
||||
gSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
|
||||
sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
|
||||
for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
|
||||
DrawRec(gfx++, gSpeedMeterTimeEntryPtr->color, baseX, lry + gSpeedMeterTimeEntryPtr->y,
|
||||
gSpeedMeterTimeEntryPtr->x, lry + gSpeedMeterTimeEntryPtr->y + 1);
|
||||
gSpeedMeterTimeEntryPtr++;
|
||||
DrawRec(gfx++, sSpeedMeterTimeEntryPtr->color, baseX, lry + sSpeedMeterTimeEntryPtr->y,
|
||||
sSpeedMeterTimeEntryPtr->x, lry + sSpeedMeterTimeEntryPtr->y + 1);
|
||||
sSpeedMeterTimeEntryPtr++;
|
||||
}
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
|
||||
@@ -78,16 +78,20 @@ static u16 sATan2Tbl[] = {
|
||||
};
|
||||
|
||||
u16 Math_GetAtan2Tbl(f32 x, f32 y) {
|
||||
s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
|
||||
u16 ret;
|
||||
|
||||
if (y == 0.0f) {
|
||||
ret = sATan2Tbl[0];
|
||||
} else if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
|
||||
ret = sATan2Tbl[0];
|
||||
} else {
|
||||
ret = sATan2Tbl[tblIdx];
|
||||
s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
|
||||
|
||||
if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
|
||||
ret = sATan2Tbl[0];
|
||||
} else {
|
||||
ret = sATan2Tbl[tblIdx];
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+234
-220
@@ -470,59 +470,63 @@ void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
||||
/**
|
||||
* Set the current matrix to translate and rotate using YXZ Tait-Bryan angles.
|
||||
* This means a (column) vector is first rotated around Z, then around X, then around Y, then translated.
|
||||
*/
|
||||
void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 sp30 = Math_SinS(vec->y);
|
||||
f32 sp2C = Math_CosS(vec->y);
|
||||
f32 sp28;
|
||||
f32 sp24;
|
||||
f32 temp1 = Math_SinS(rot->y);
|
||||
f32 temp2 = Math_CosS(rot->y);
|
||||
f32 cos;
|
||||
f32 sin;
|
||||
|
||||
cmf->xx = sp2C;
|
||||
cmf->zx = -sp30;
|
||||
cmf->xw = x;
|
||||
cmf->yw = y;
|
||||
cmf->zw = z;
|
||||
cmf->xx = temp2;
|
||||
cmf->zx = -temp1;
|
||||
cmf->xw = translateX;
|
||||
cmf->yw = translateY;
|
||||
cmf->zw = translateZ;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->ww = 1.0f;
|
||||
|
||||
if (vec->x != 0) {
|
||||
sp24 = Math_SinS(vec->x);
|
||||
sp28 = Math_CosS(vec->x);
|
||||
if (rot->x != 0) {
|
||||
sin = Math_SinS(rot->x);
|
||||
cos = Math_CosS(rot->x);
|
||||
|
||||
cmf->zz = sp2C * sp28;
|
||||
cmf->zy = sp2C * sp24;
|
||||
cmf->xz = sp30 * sp28;
|
||||
cmf->xy = sp30 * sp24;
|
||||
cmf->yz = -sp24;
|
||||
cmf->yy = sp28;
|
||||
cmf->zz = temp2 * cos;
|
||||
cmf->zy = temp2 * sin;
|
||||
cmf->xz = temp1 * cos;
|
||||
cmf->xy = temp1 * sin;
|
||||
cmf->yz = -sin;
|
||||
cmf->yy = cos;
|
||||
} else {
|
||||
cmf->zz = sp2C;
|
||||
cmf->xz = sp30;
|
||||
cmf->zz = temp2;
|
||||
cmf->xz = temp1;
|
||||
cmf->yz = 0.0f;
|
||||
cmf->zy = 0.0f;
|
||||
cmf->xy = 0.0f;
|
||||
cmf->yy = 1.0f;
|
||||
}
|
||||
|
||||
if (vec->z != 0) {
|
||||
sp24 = Math_SinS(vec->z);
|
||||
sp28 = Math_CosS(vec->z);
|
||||
if (rot->z != 0) {
|
||||
sin = Math_SinS(rot->z);
|
||||
cos = Math_CosS(rot->z);
|
||||
|
||||
sp30 = cmf->xx;
|
||||
sp2C = cmf->xy;
|
||||
cmf->xx = sp30 * sp28 + sp2C * sp24;
|
||||
cmf->xy = sp2C * sp28 - sp30 * sp24;
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->xy;
|
||||
cmf->xx = temp1 * cos + temp2 * sin;
|
||||
cmf->xy = temp2 * cos - temp1 * sin;
|
||||
|
||||
sp30 = cmf->zx;
|
||||
sp2C = cmf->zy;
|
||||
cmf->zx = sp30 * sp28 + sp2C * sp24;
|
||||
cmf->zy = sp2C * sp28 - sp30 * sp24;
|
||||
temp1 = cmf->zx;
|
||||
temp2 = cmf->zy;
|
||||
cmf->zx = temp1 * cos + temp2 * sin;
|
||||
cmf->zy = temp2 * cos - temp1 * sin;
|
||||
|
||||
sp2C = cmf->yy;
|
||||
cmf->yx = sp2C * sp24;
|
||||
cmf->yy = sp2C * sp28;
|
||||
temp2 = cmf->yy;
|
||||
cmf->yx = temp2 * sin;
|
||||
cmf->yy = temp2 * cos;
|
||||
} else {
|
||||
cmf->yx = 0.0f;
|
||||
}
|
||||
@@ -698,47 +702,58 @@ void Matrix_Transpose(MtxF* mf) {
|
||||
mf->yz = temp;
|
||||
}
|
||||
|
||||
void func_800D1FD4(MtxF* mf) {
|
||||
/**
|
||||
* Changes the 3x3 part of the current matrix to `mf` * S, where S is the scale in the current matrix.
|
||||
*
|
||||
* In details, S is a diagonal where each coefficient is the norm of the column in the 3x3 current matrix.
|
||||
* The 3x3 part can then be written as R * S where R has its columns normalized.
|
||||
* Since R is typically a rotation matrix, and the 3x3 part is changed from R * S to `mf` * S, this operation can be
|
||||
* seen as replacing the R rotation with `mf`, hence the function name.
|
||||
*/
|
||||
void Matrix_ReplaceRotation(MtxF* mf) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 acc;
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 curColNorm;
|
||||
|
||||
temp = cmf->xx;
|
||||
temp *= temp;
|
||||
temp2 = cmf->yx;
|
||||
temp += SQ(temp2);
|
||||
temp2 = cmf->zx;
|
||||
temp += SQ(temp2);
|
||||
temp3 = sqrtf(temp);
|
||||
// compute the Euclidean norm of the first column of the current matrix
|
||||
acc = cmf->xx;
|
||||
acc *= acc;
|
||||
temp = cmf->yx;
|
||||
acc += SQ(temp);
|
||||
temp = cmf->zx;
|
||||
acc += SQ(temp);
|
||||
curColNorm = sqrtf(acc);
|
||||
|
||||
cmf->xx = mf->xx * temp3;
|
||||
cmf->yx = mf->yx * temp3;
|
||||
cmf->zx = mf->zx * temp3;
|
||||
cmf->xx = mf->xx * curColNorm;
|
||||
cmf->yx = mf->yx * curColNorm;
|
||||
cmf->zx = mf->zx * curColNorm;
|
||||
|
||||
temp = cmf->xy;
|
||||
temp *= temp;
|
||||
temp2 = cmf->yy;
|
||||
temp += SQ(temp2);
|
||||
temp2 = cmf->zy;
|
||||
temp += SQ(temp2);
|
||||
temp3 = sqrtf(temp);
|
||||
// second column
|
||||
acc = cmf->xy;
|
||||
acc *= acc;
|
||||
temp = cmf->yy;
|
||||
acc += SQ(temp);
|
||||
temp = cmf->zy;
|
||||
acc += SQ(temp);
|
||||
curColNorm = sqrtf(acc);
|
||||
|
||||
cmf->xy = mf->xy * temp3;
|
||||
cmf->yy = mf->yy * temp3;
|
||||
cmf->zy = mf->zy * temp3;
|
||||
cmf->xy = mf->xy * curColNorm;
|
||||
cmf->yy = mf->yy * curColNorm;
|
||||
cmf->zy = mf->zy * curColNorm;
|
||||
|
||||
temp = cmf->xz;
|
||||
temp *= temp;
|
||||
temp2 = cmf->yz;
|
||||
temp += SQ(temp2);
|
||||
temp2 = cmf->zz;
|
||||
temp += SQ(temp2);
|
||||
temp3 = sqrtf(temp);
|
||||
// third column
|
||||
acc = cmf->xz;
|
||||
acc *= acc;
|
||||
temp = cmf->yz;
|
||||
acc += SQ(temp);
|
||||
temp = cmf->zz;
|
||||
acc += SQ(temp);
|
||||
curColNorm = sqrtf(acc);
|
||||
|
||||
cmf->xz = mf->xz * temp3;
|
||||
cmf->yz = mf->yz * temp3;
|
||||
cmf->zz = mf->zz * temp3;
|
||||
cmf->xz = mf->xz * curColNorm;
|
||||
cmf->yz = mf->yz * curColNorm;
|
||||
cmf->zz = mf->zz * curColNorm;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -844,78 +859,76 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Rotate the matrix by `f` radians around a unit vector `vec`.
|
||||
* NB: vec is assumed to be a unit vector.
|
||||
* Rotate the matrix by `angle` radians around a unit vector `axis`.
|
||||
* NB: `axis` is assumed to be a unit vector.
|
||||
*/
|
||||
void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode) {
|
||||
void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
f32 rCos;
|
||||
f32 vrs;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
f32 temp5;
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
if (f != 0) {
|
||||
if (angle != 0) {
|
||||
cmf = sCurrentMatrix;
|
||||
|
||||
sin = sinf(f);
|
||||
cos = cosf(f);
|
||||
sin = sinf(angle);
|
||||
cos = cosf(angle);
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->xy;
|
||||
temp3 = cmf->xz;
|
||||
temp1 = cmf->xx;
|
||||
temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos);
|
||||
cmf->xx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y);
|
||||
cmf->xy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z);
|
||||
cmf->xz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x);
|
||||
temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos);
|
||||
cmf->xx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y);
|
||||
cmf->xy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z);
|
||||
cmf->xz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x);
|
||||
|
||||
temp1 = cmf->yx;
|
||||
temp2 = cmf->yy;
|
||||
temp3 = cmf->yz;
|
||||
temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos);
|
||||
cmf->yx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y);
|
||||
cmf->yy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z);
|
||||
cmf->yz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x);
|
||||
temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos);
|
||||
cmf->yx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y);
|
||||
cmf->yy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z);
|
||||
cmf->yz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x);
|
||||
|
||||
temp1 = cmf->zx;
|
||||
temp2 = cmf->zy;
|
||||
temp3 = cmf->zz;
|
||||
temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos);
|
||||
cmf->zx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y);
|
||||
cmf->zy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z);
|
||||
cmf->zz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x);
|
||||
temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos);
|
||||
cmf->zx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y);
|
||||
cmf->zy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z);
|
||||
cmf->zz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x);
|
||||
}
|
||||
} else {
|
||||
cmf = sCurrentMatrix;
|
||||
|
||||
if (f != 0) {
|
||||
sin = sinf(f);
|
||||
cos = cosf(f);
|
||||
if (angle != 0) {
|
||||
sin = sinf(angle);
|
||||
cos = cosf(angle);
|
||||
rCos = 1.0f - cos;
|
||||
|
||||
cmf->xx = vec->x * vec->x * rCos + cos;
|
||||
cmf->yy = vec->y * vec->y * rCos + cos;
|
||||
cmf->zz = vec->z * vec->z * rCos + cos;
|
||||
cmf->xx = axis->x * axis->x * rCos + cos;
|
||||
cmf->yy = axis->y * axis->y * rCos + cos;
|
||||
cmf->zz = axis->z * axis->z * rCos + cos;
|
||||
|
||||
if (0) {}
|
||||
|
||||
temp2 = vec->x * rCos * vec->y;
|
||||
temp3 = vec->z * sin;
|
||||
temp2 = axis->x * rCos * axis->y;
|
||||
temp3 = axis->z * sin;
|
||||
cmf->yx = temp2 + temp3;
|
||||
cmf->xy = temp2 - temp3;
|
||||
|
||||
temp2 = vec->x * rCos * vec->z;
|
||||
temp3 = vec->y * sin;
|
||||
temp2 = axis->x * rCos * axis->z;
|
||||
temp3 = axis->y * sin;
|
||||
cmf->zx = temp2 - temp3;
|
||||
cmf->xz = temp2 + temp3;
|
||||
|
||||
temp2 = vec->y * rCos * vec->z;
|
||||
temp3 = vec->x * sin;
|
||||
temp2 = axis->y * rCos * axis->z;
|
||||
temp3 = axis->x * sin;
|
||||
cmf->zy = temp2 + temp3;
|
||||
cmf->yz = temp2 - temp3;
|
||||
|
||||
@@ -963,7 +976,7 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) {
|
||||
return mf;
|
||||
}
|
||||
|
||||
void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
|
||||
void Matrix_SetTranslateUniformScaleMtxF(MtxF* mf, f32 scale, f32 translateX, f32 translateY, f32 translateZ) {
|
||||
mf->yx = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
@@ -973,131 +986,133 @@ void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xx = arg1;
|
||||
mf->yy = arg1;
|
||||
mf->zz = arg1;
|
||||
mf->xw = arg2;
|
||||
mf->yw = arg3;
|
||||
mf->zw = arg4;
|
||||
mf->xx = scale;
|
||||
mf->yy = scale;
|
||||
mf->zz = scale;
|
||||
mf->xw = translateX;
|
||||
mf->yw = translateY;
|
||||
mf->zw = translateZ;
|
||||
mf->ww = 1.0f;
|
||||
}
|
||||
|
||||
void func_800D2A98(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
|
||||
void Matrix_SetTranslateUniformScaleMtx(Mtx* mtx, f32 scale, f32 translateX, f32 translateY, f32 translateZ) {
|
||||
MtxF mf;
|
||||
|
||||
func_800D2A34(&mf, arg1, arg2, arg3, arg4);
|
||||
Matrix_SetTranslateUniformScaleMtxF(&mf, scale, translateX, translateY, translateZ);
|
||||
guMtxF2L(&mf, mtx);
|
||||
}
|
||||
|
||||
void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
|
||||
u16* m1 = (u16*)&mtx->m[0][0];
|
||||
u16* m2 = (u16*)&mtx->m[2][0];
|
||||
u32 temp;
|
||||
void Matrix_SetTranslateUniformScaleMtx2(Mtx* mtx, f32 scale, f32 translateX, f32 translateY, f32 translateZ) {
|
||||
u16* intPart = (u16*)&mtx->m[0][0];
|
||||
u16* fracPart = (u16*)&mtx->m[2][0];
|
||||
u32 fixedPoint;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
m2[0] = temp & 0xFFFF;
|
||||
m1[0] = (temp >> 16) & 0xFFFF;
|
||||
fixedPoint = (s32)(scale * 0x10000);
|
||||
fracPart[0] = fixedPoint & 0xFFFF;
|
||||
intPart[0] = (fixedPoint >> 16) & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
m1[5] = (temp >> 16) & 0xFFFF;
|
||||
m2[5] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(scale * 0x10000);
|
||||
intPart[5] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[5] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
m1[10] = (temp >> 16) & 0xFFFF;
|
||||
m2[10] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(scale * 0x10000);
|
||||
intPart[10] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[10] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg2 * 65536.0f);
|
||||
m1[12] = (temp >> 16) & 0xFFFF;
|
||||
m2[12] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateX * 0x10000);
|
||||
intPart[12] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[12] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg3 * 65536.0f);
|
||||
m1[13] = (temp >> 16) & 0xFFFF;
|
||||
m2[13] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateY * 0x10000);
|
||||
intPart[13] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[13] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg4 * 65536.0f);
|
||||
m1[14] = (temp >> 16) & 0xFFFF;
|
||||
m2[14] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateZ * 0x10000);
|
||||
intPart[14] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[14] = fixedPoint & 0xFFFF;
|
||||
|
||||
m1[1] = 0;
|
||||
m1[2] = 0;
|
||||
m1[3] = 0;
|
||||
m1[4] = 0;
|
||||
m1[6] = 0;
|
||||
m1[7] = 0;
|
||||
m1[8] = 0;
|
||||
m1[9] = 0;
|
||||
m1[11] = 0;
|
||||
m1[15] = 1;
|
||||
intPart[1] = 0;
|
||||
intPart[2] = 0;
|
||||
intPart[3] = 0;
|
||||
intPart[4] = 0;
|
||||
intPart[6] = 0;
|
||||
intPart[7] = 0;
|
||||
intPart[8] = 0;
|
||||
intPart[9] = 0;
|
||||
intPart[11] = 0;
|
||||
intPart[15] = 1;
|
||||
|
||||
m2[1] = 0;
|
||||
m2[2] = 0;
|
||||
m2[3] = 0;
|
||||
m2[4] = 0;
|
||||
m2[6] = 0;
|
||||
m2[7] = 0;
|
||||
m2[8] = 0;
|
||||
m2[9] = 0;
|
||||
m2[11] = 0;
|
||||
m2[15] = 0;
|
||||
fracPart[1] = 0;
|
||||
fracPart[2] = 0;
|
||||
fracPart[3] = 0;
|
||||
fracPart[4] = 0;
|
||||
fracPart[6] = 0;
|
||||
fracPart[7] = 0;
|
||||
fracPart[8] = 0;
|
||||
fracPart[9] = 0;
|
||||
fracPart[11] = 0;
|
||||
fracPart[15] = 0;
|
||||
}
|
||||
|
||||
void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
||||
u16* m1 = (u16*)&mtx->m[0][0];
|
||||
u16* m2 = (u16*)&mtx->m[2][0];
|
||||
u32 temp;
|
||||
void Matrix_SetTranslateScaleMtx1(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY,
|
||||
f32 translateZ) {
|
||||
u16* intPart = (u16*)&mtx->m[0][0];
|
||||
u16* fracPart = (u16*)&mtx->m[2][0];
|
||||
u32 fixedPoint;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
m1[0] = (temp >> 16) & 0xFFFF;
|
||||
m2[0] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(scaleX * 0x10000);
|
||||
intPart[0] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[0] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg2 * 65536.0f);
|
||||
m1[5] = (temp >> 16) & 0xFFFF;
|
||||
m2[5] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(scaleY * 0x10000);
|
||||
intPart[5] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[5] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg3 * 65536.0f);
|
||||
m1[10] = (temp >> 16) & 0xFFFF;
|
||||
m2[10] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(scaleZ * 0x10000);
|
||||
intPart[10] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[10] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg4 * 65536.0f);
|
||||
m1[12] = (temp >> 16) & 0xFFFF;
|
||||
m2[12] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateX * 0x10000);
|
||||
intPart[12] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[12] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg5 * 65536.0f);
|
||||
m1[13] = (temp >> 16) & 0xFFFF;
|
||||
m2[13] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateY * 0x10000);
|
||||
intPart[13] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[13] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg6 * 65536.0f);
|
||||
m1[14] = (temp >> 16) & 0xFFFF;
|
||||
m2[14] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateZ * 0x10000);
|
||||
intPart[14] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[14] = fixedPoint & 0xFFFF;
|
||||
|
||||
m1[1] = 0;
|
||||
m1[2] = 0;
|
||||
m1[3] = 0;
|
||||
m1[4] = 0;
|
||||
m1[6] = 0;
|
||||
m1[7] = 0;
|
||||
m1[8] = 0;
|
||||
m1[9] = 0;
|
||||
m1[11] = 0;
|
||||
m1[15] = 1;
|
||||
intPart[1] = 0;
|
||||
intPart[2] = 0;
|
||||
intPart[3] = 0;
|
||||
intPart[4] = 0;
|
||||
intPart[6] = 0;
|
||||
intPart[7] = 0;
|
||||
intPart[8] = 0;
|
||||
intPart[9] = 0;
|
||||
intPart[11] = 0;
|
||||
intPart[15] = 1;
|
||||
|
||||
m2[1] = 0;
|
||||
m2[2] = 0;
|
||||
m2[3] = 0;
|
||||
m2[4] = 0;
|
||||
m2[6] = 0;
|
||||
m2[7] = 0;
|
||||
m2[8] = 0;
|
||||
m2[9] = 0;
|
||||
m2[11] = 0;
|
||||
m2[15] = 0;
|
||||
fracPart[1] = 0;
|
||||
fracPart[2] = 0;
|
||||
fracPart[3] = 0;
|
||||
fracPart[4] = 0;
|
||||
fracPart[6] = 0;
|
||||
fracPart[7] = 0;
|
||||
fracPart[8] = 0;
|
||||
fracPart[9] = 0;
|
||||
fracPart[11] = 0;
|
||||
fracPart[15] = 0;
|
||||
}
|
||||
|
||||
void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
||||
void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY,
|
||||
f32 translateZ) {
|
||||
Mtx_t* m = &mtx->m;
|
||||
u16* m1 = (u16*)(*m)[0];
|
||||
u16* m2 = (u16*)(*m)[2];
|
||||
u32 temp;
|
||||
u16* intPart = (u16*)&(*m)[0][0];
|
||||
u16* fracPart = (u16*)&(*m)[2][0];
|
||||
u32 fixedPoint;
|
||||
|
||||
(*m)[0][1] = 0;
|
||||
(*m)[2][1] = 0;
|
||||
@@ -1105,33 +1120,32 @@ void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f
|
||||
(*m)[2][3] = 0;
|
||||
(*m)[0][4] = 0;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
(*m)[0][0] = temp;
|
||||
fixedPoint = (s32)(scaleX * 0x10000);
|
||||
(*m)[0][0] = fixedPoint;
|
||||
intPart[1] = 0;
|
||||
(*m)[2][0] = fixedPoint << 16;
|
||||
|
||||
m1[1] = 0;
|
||||
(*m)[2][0] = temp << 16;
|
||||
fixedPoint = (s32)(scaleY * 0x10000);
|
||||
(*m)[0][2] = fixedPoint >> 16;
|
||||
(*m)[2][2] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg2 * 65536.0f);
|
||||
(*m)[0][2] = temp >> 16;
|
||||
(*m)[2][2] = temp & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg3 * 65536.0f);
|
||||
(*m)[1][1] = temp;
|
||||
m1[11] = 0;
|
||||
(*m)[3][1] = temp << 16;
|
||||
fixedPoint = (s32)(scaleZ * 0x10000);
|
||||
(*m)[1][1] = fixedPoint;
|
||||
intPart[11] = 0;
|
||||
(*m)[3][1] = fixedPoint << 16;
|
||||
|
||||
(*m)[2][4] = 0;
|
||||
|
||||
temp = (s32)(arg4 * 65536.0f);
|
||||
m1[12] = (temp >> 16) & 0xFFFF;
|
||||
m2[12] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateX * 0x10000);
|
||||
intPart[12] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[12] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg5 * 65536.0f);
|
||||
m1[13] = (temp >> 16) & 0xFFFF;
|
||||
m2[13] = temp & 0xFFFF;
|
||||
fixedPoint = (s32)(translateY * 0x10000);
|
||||
intPart[13] = (fixedPoint >> 16) & 0xFFFF;
|
||||
fracPart[13] = fixedPoint & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg6 * 65536.0f);
|
||||
m1[14] = (temp >> 16) & 0xFFFF;
|
||||
m1[15] = 1;
|
||||
(*m)[3][3] = temp << 16;
|
||||
fixedPoint = (s32)(translateZ * 0x10000);
|
||||
intPart[14] = (fixedPoint >> 16) & 0xFFFF;
|
||||
intPart[15] = 1;
|
||||
(*m)[3][3] = fixedPoint << 16;
|
||||
}
|
||||
|
||||
+27
-26
@@ -710,11 +710,10 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
||||
Gfillrect setscissor = ptr->fillrect;
|
||||
const char* modeStr;
|
||||
|
||||
modeStr = (setscissor.pad == G_SC_NON_INTERLACE)
|
||||
? "G_SC_NON_INTERLACE"
|
||||
: (setscissor.pad == G_SC_ODD_INTERLACE)
|
||||
? "G_SC_ODD_INTERLACE"
|
||||
: (setscissor.pad == G_SC_EVEN_INTERLACE) ? "G_SC_EVEN_INTERLACE" : "???";
|
||||
modeStr = (setscissor.pad == G_SC_NON_INTERLACE) ? "G_SC_NON_INTERLACE"
|
||||
: (setscissor.pad == G_SC_ODD_INTERLACE) ? "G_SC_ODD_INTERLACE"
|
||||
: (setscissor.pad == G_SC_EVEN_INTERLACE) ? "G_SC_EVEN_INTERLACE"
|
||||
: "???";
|
||||
|
||||
if ((setscissor.x0frac | setscissor.y0frac | setscissor.x1frac | setscissor.y1frac)) {
|
||||
if (1) {}
|
||||
@@ -740,12 +739,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
||||
u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
|
||||
|
||||
DISAS_LOG("gsDPSetColorImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x) ),",
|
||||
(fmt == G_IM_FMT_RGBA)
|
||||
? "RGBA"
|
||||
: (fmt == G_IM_FMT_YUV) ? "YUV"
|
||||
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
|
||||
(siz == G_IM_SIZ_4b) ? "4b"
|
||||
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
|
||||
(fmt == G_IM_FMT_RGBA) ? "RGBA"
|
||||
: (fmt == G_IM_FMT_YUV) ? "YUV"
|
||||
: (fmt == G_IM_FMT_CI) ? "CI"
|
||||
: (fmt == G_IM_FMT_IA) ? "IA"
|
||||
: "I",
|
||||
(siz == G_IM_SIZ_4b) ? "4b"
|
||||
: (siz == G_IM_SIZ_8b) ? "8b"
|
||||
: (siz == G_IM_SIZ_16b) ? "16b"
|
||||
: "32b",
|
||||
(curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
|
||||
|
||||
if (this->pipeSyncRequired) {
|
||||
@@ -768,12 +770,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
||||
u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
|
||||
|
||||
DISAS_LOG("gsDPSetTextureImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x)),",
|
||||
(fmt == G_IM_FMT_RGBA)
|
||||
? "RGBA"
|
||||
: (fmt == G_IM_FMT_YUV) ? "YUV"
|
||||
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
|
||||
(siz == G_IM_SIZ_4b) ? "4b"
|
||||
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
|
||||
(fmt == G_IM_FMT_RGBA) ? "RGBA"
|
||||
: (fmt == G_IM_FMT_YUV) ? "YUV"
|
||||
: (fmt == G_IM_FMT_CI) ? "CI"
|
||||
: (fmt == G_IM_FMT_IA) ? "IA"
|
||||
: "I",
|
||||
(siz == G_IM_SIZ_4b) ? "4b"
|
||||
: (siz == G_IM_SIZ_8b) ? "8b"
|
||||
: (siz == G_IM_SIZ_16b) ? "16b"
|
||||
: "32b",
|
||||
(curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
|
||||
} break;
|
||||
|
||||
@@ -989,15 +994,11 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
|
||||
|
||||
case G_MODIFYVTX: {
|
||||
DISAS_LOG("gsSPModifyVertex(%d, %s, %08x),", curGfx->dma.par,
|
||||
(curGfx->dma.len == G_MWO_POINT_RGBA)
|
||||
? "G_MWO_POINT_RGBA"
|
||||
: (curGfx->dma.len == G_MWO_POINT_ST)
|
||||
? "G_MWO_POINT_ST"
|
||||
: (curGfx->dma.len == G_MWO_POINT_XYSCREEN)
|
||||
? "G_MWO_POINT_XYSCREEN"
|
||||
: (curGfx->dma.len == G_MWO_POINT_ZSCREEN)
|
||||
? "G_MWO_POINT_ZSCREEN"
|
||||
: "G_MWO_POINT_????",
|
||||
(curGfx->dma.len == G_MWO_POINT_RGBA) ? "G_MWO_POINT_RGBA"
|
||||
: (curGfx->dma.len == G_MWO_POINT_ST) ? "G_MWO_POINT_ST"
|
||||
: (curGfx->dma.len == G_MWO_POINT_XYSCREEN) ? "G_MWO_POINT_XYSCREEN"
|
||||
: (curGfx->dma.len == G_MWO_POINT_ZSCREEN) ? "G_MWO_POINT_ZSCREEN"
|
||||
: "G_MWO_POINT_????",
|
||||
curGfx->dma.addr);
|
||||
this->vtxCnt += curGfx->dma.par;
|
||||
this->spvtxCnt++;
|
||||
|
||||
+197
-149
@@ -213,9 +213,9 @@ void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* lef
|
||||
}
|
||||
}
|
||||
|
||||
void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) {
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg1, arg2, arg3);
|
||||
*arg3 = (*arg3 < 1.0f) ? 1.0f : (1.0f / *arg3);
|
||||
void Actor_ProjectPos(GlobalContext* globalCtx, Vec3f* src, Vec3f* xyzDest, f32* cappedInvWDest) {
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, src, xyzDest, cappedInvWDest);
|
||||
*cappedInvWDest = (*cappedInvWDest < 1.0f) ? 1.0f : (1.0f / *cappedInvWDest);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -266,7 +266,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* g
|
||||
}
|
||||
}
|
||||
|
||||
void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) {
|
||||
void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) {
|
||||
NaviColor* naviColor = &sNaviColorList[actorCategory];
|
||||
targetCtx->naviRefPos.x = actor->focus.pos.x;
|
||||
targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y);
|
||||
@@ -286,10 +286,10 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global
|
||||
targetCtx->targetedActor = NULL;
|
||||
targetCtx->unk_40 = 0.0f;
|
||||
targetCtx->unk_8C = NULL;
|
||||
targetCtx->unk_90 = NULL;
|
||||
targetCtx->bgmEnemy = NULL;
|
||||
targetCtx->unk_4B = 0;
|
||||
targetCtx->unk_4C = 0;
|
||||
func_8002BF60(targetCtx, actor, actor->category, globalCtx);
|
||||
Actor_SetNaviToActor(targetCtx, actor, actor->category, globalCtx);
|
||||
func_8002BE98(targetCtx, actor->category, globalCtx);
|
||||
}
|
||||
|
||||
@@ -303,9 +303,9 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
Player* player;
|
||||
s16 spCE;
|
||||
f32 temp1;
|
||||
Vec3f spBC;
|
||||
Vec3f projTargetCenter;
|
||||
s32 spB8;
|
||||
f32 spB4;
|
||||
f32 projTargetCappedInvW;
|
||||
s32 spB0;
|
||||
s32 spAC;
|
||||
f32 var1;
|
||||
@@ -334,24 +334,24 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
spCE = targetCtx->unk_48;
|
||||
}
|
||||
|
||||
func_8002BE04(globalCtx, &targetCtx->targetCenterPos, &spBC, &spB4);
|
||||
Actor_ProjectPos(globalCtx, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW);
|
||||
|
||||
spBC.x = (160 * (spBC.x * spB4)) * var1;
|
||||
spBC.x = CLAMP(spBC.x, -320.0f, 320.0f);
|
||||
projTargetCenter.x = (160 * (projTargetCenter.x * projTargetCappedInvW)) * var1;
|
||||
projTargetCenter.x = CLAMP(projTargetCenter.x, -320.0f, 320.0f);
|
||||
|
||||
spBC.y = (120 * (spBC.y * spB4)) * var1;
|
||||
spBC.y = CLAMP(spBC.y, -240.0f, 240.0f);
|
||||
projTargetCenter.y = (120 * (projTargetCenter.y * projTargetCappedInvW)) * var1;
|
||||
projTargetCenter.y = CLAMP(projTargetCenter.y, -240.0f, 240.0f);
|
||||
|
||||
spBC.z = spBC.z * var1;
|
||||
projTargetCenter.z = projTargetCenter.z * var1;
|
||||
|
||||
targetCtx->unk_4C--;
|
||||
if (targetCtx->unk_4C < 0) {
|
||||
targetCtx->unk_4C = 2;
|
||||
}
|
||||
|
||||
func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z);
|
||||
func_8002BE64(targetCtx, targetCtx->unk_4C, projTargetCenter.x, projTargetCenter.y, projTargetCenter.z);
|
||||
|
||||
if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) {
|
||||
if ((!(player->stateFlags1 & PLAYER_STATE1_6)) || (actor != player->unk_664)) {
|
||||
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39);
|
||||
|
||||
for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
|
||||
@@ -391,7 +391,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
actor = targetCtx->unk_94;
|
||||
if ((actor != NULL) && !(actor->flags & 0x8000000)) {
|
||||
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) {
|
||||
NaviColor* naviColor = &sNaviColorList[actor->category];
|
||||
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x7);
|
||||
@@ -414,8 +414,8 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
s32 pad;
|
||||
Actor* unkActor;
|
||||
s32 actorCategory;
|
||||
Vec3f sp50;
|
||||
f32 sp4C;
|
||||
Vec3f projectedFocusPos;
|
||||
f32 cappedInvWDest;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
@@ -465,12 +465,12 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
targetCtx->naviRefPos.y += temp3 * temp1;
|
||||
targetCtx->naviRefPos.z += temp4 * temp1;
|
||||
} else {
|
||||
func_8002BF60(targetCtx, unkActor, actorCategory, globalCtx);
|
||||
Actor_SetNaviToActor(targetCtx, unkActor, actorCategory, globalCtx);
|
||||
}
|
||||
|
||||
if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) {
|
||||
func_8002BE04(globalCtx, &actorArg->focus.pos, &sp50, &sp4C);
|
||||
if (((sp50.z <= 0.0f) || (1.0f <= fabsf(sp50.x * sp4C))) || (1.0f <= fabsf(sp50.y * sp4C))) {
|
||||
Actor_ProjectPos(globalCtx, &actorArg->focus.pos, &projectedFocusPos, &cappedInvWDest);
|
||||
if (((projectedFocusPos.z <= 0.0f) || (1.0f <= fabsf(projectedFocusPos.x * cappedInvWDest))) || (1.0f <= fabsf(projectedFocusPos.y * cappedInvWDest))) {
|
||||
actorArg = NULL;
|
||||
}
|
||||
}
|
||||
@@ -484,7 +484,8 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
targetCtx->unk_48 = 0;
|
||||
}
|
||||
|
||||
lockOnSfxId = ((actorArg->flags & 5) == 5) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN;
|
||||
lockOnSfxId = CHECK_FLAG_ALL(actorArg->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON
|
||||
: NA_SE_SY_LOCK_ON_HUMAN;
|
||||
func_80078884(lockOnSfxId);
|
||||
}
|
||||
|
||||
@@ -654,7 +655,7 @@ void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8002CDE4(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
void TitleCard_Init(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
titleCtx->durationTimer = titleCtx->delayTimer = titleCtx->intensity = titleCtx->alpha = 0;
|
||||
}
|
||||
|
||||
@@ -700,48 +701,49 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
}
|
||||
|
||||
void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
s32 spCC;
|
||||
s32 spC8;
|
||||
s32 unk1;
|
||||
s32 spC0;
|
||||
s32 sp38;
|
||||
s32 spB8;
|
||||
s32 spB4;
|
||||
s32 spB0;
|
||||
s32 width;
|
||||
s32 height;
|
||||
s32 unused;
|
||||
s32 titleX;
|
||||
s32 doubleWidth;
|
||||
s32 titleY;
|
||||
s32 titleSecondY;
|
||||
s32 textureLanguageOffset;
|
||||
|
||||
if (titleCtx->alpha != 0) {
|
||||
spCC = titleCtx->width;
|
||||
spC8 = titleCtx->height;
|
||||
spC0 = (titleCtx->x * 4) - (spCC * 2);
|
||||
spB8 = (titleCtx->y * 4) - (spC8 * 2);
|
||||
sp38 = spCC * 2;
|
||||
width = titleCtx->width;
|
||||
height = titleCtx->height;
|
||||
titleX = (titleCtx->x * 4) - (width * 2);
|
||||
titleY = (titleCtx->y * 4) - (height * 2);
|
||||
doubleWidth = width * 2;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2824);
|
||||
|
||||
spB0 = spCC * spC8 * gSaveContext.language;
|
||||
spC8 = (spCC * spC8 > 0x1000) ? 0x1000 / spCC : spC8;
|
||||
spB4 = spB8 + (spC8 * 4);
|
||||
textureLanguageOffset = width * height * gSaveContext.language;
|
||||
height = (width * height > 0x1000) ? 0x1000 / width : height;
|
||||
titleSecondY = titleY + (height * 4);
|
||||
|
||||
OVERLAY_DISP = func_80093808(OVERLAY_DISP);
|
||||
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
|
||||
(u8)titleCtx->alpha);
|
||||
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + spB0, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, spC8, 0,
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + textureLanguageOffset, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
|
||||
gSPTextureRectangle(OVERLAY_DISP++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 + (spC8 * 4) - 1, G_TX_RENDERTILE,
|
||||
gSPTextureRectangle(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, G_TX_RENDERTILE,
|
||||
0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
spC8 = titleCtx->height - spC8;
|
||||
height = titleCtx->height - height;
|
||||
|
||||
if (spC8 > 0) {
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + spB0 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, spCC,
|
||||
spC8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
// If texture is bigger than 0x1000, display the rest
|
||||
if (height > 0) {
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + textureLanguageOffset + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, width,
|
||||
height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gSPTextureRectangle(OVERLAY_DISP++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 + (spC8 * 4) - 1,
|
||||
gSPTextureRectangle(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, titleSecondY + (height * 4) - 1,
|
||||
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
|
||||
@@ -749,7 +751,7 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
s32 TitleCard_Clear(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
if ((globalCtx->actorCtx.titleCtx.delayTimer != 0) || (globalCtx->actorCtx.titleCtx.alpha != 0)) {
|
||||
titleCtx->durationTimer = 0;
|
||||
titleCtx->delayTimer = 0;
|
||||
@@ -762,7 +764,7 @@ s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
void Actor_Kill(Actor* actor) {
|
||||
actor->draw = NULL;
|
||||
actor->update = NULL;
|
||||
actor->flags &= ~0x1;
|
||||
actor->flags &= ~ACTOR_FLAG_0;
|
||||
}
|
||||
|
||||
void Actor_SetWorldToHome(Actor* actor) {
|
||||
@@ -947,7 +949,7 @@ f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) {
|
||||
}
|
||||
|
||||
f32 Player_GetHeight(Player* player) {
|
||||
f32 offset = (player->stateFlags1 & 0x800000) ? 32.0f : 0.0f;
|
||||
f32 offset = (player->stateFlags1 & PLAYER_STATE1_23) ? 32.0f : 0.0f;
|
||||
|
||||
if (LINK_IS_ADULT) {
|
||||
return offset + 68.0f;
|
||||
@@ -957,9 +959,9 @@ f32 Player_GetHeight(Player* player) {
|
||||
}
|
||||
|
||||
f32 func_8002DCE4(Player* player) {
|
||||
if (player->stateFlags1 & 0x800000) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_23) {
|
||||
return 8.0f;
|
||||
} else if (player->stateFlags1 & 0x8000000) {
|
||||
} else if (player->stateFlags1 & PLAYER_STATE1_27) {
|
||||
return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f;
|
||||
} else {
|
||||
return R_RUN_SPEED_LIMIT / 100.0f;
|
||||
@@ -967,7 +969,7 @@ f32 func_8002DCE4(Player* player) {
|
||||
}
|
||||
|
||||
s32 func_8002DD6C(Player* player) {
|
||||
return player->stateFlags1 & 0x8;
|
||||
return player->stateFlags1 & PLAYER_STATE1_3;
|
||||
}
|
||||
|
||||
s32 func_8002DD78(Player* player) {
|
||||
@@ -977,19 +979,19 @@ s32 func_8002DD78(Player* player) {
|
||||
s32 func_8002DDA8(GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
return (player->stateFlags1 & 0x800) || func_8002DD78(player);
|
||||
return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player);
|
||||
}
|
||||
|
||||
s32 func_8002DDE4(GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
return player->stateFlags2 & 0x8;
|
||||
return player->stateFlags2 & PLAYER_STATE2_3;
|
||||
}
|
||||
|
||||
s32 func_8002DDF4(GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
return player->stateFlags2 & 0x1000;
|
||||
return player->stateFlags2 & PLAYER_STATE2_12;
|
||||
}
|
||||
|
||||
void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) {
|
||||
@@ -999,8 +1001,8 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) {
|
||||
hookshot->grabbedDistDiff.x = 0.0f;
|
||||
hookshot->grabbedDistDiff.y = 0.0f;
|
||||
hookshot->grabbedDistDiff.z = 0.0f;
|
||||
actorB->flags |= 0x2000;
|
||||
actorA->flags &= ~0x2000;
|
||||
actorB->flags |= ACTOR_FLAG_13;
|
||||
actorA->flags &= ~ACTOR_FLAG_13;
|
||||
}
|
||||
|
||||
void func_8002DE74(GlobalContext* globalCtx, Player* player) {
|
||||
@@ -1011,12 +1013,12 @@ void func_8002DE74(GlobalContext* globalCtx, Player* player) {
|
||||
|
||||
void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse) {
|
||||
player->rideActor = horse;
|
||||
player->stateFlags1 |= 0x800000;
|
||||
player->stateFlags1 |= PLAYER_STATE1_23;
|
||||
horse->child = &player->actor;
|
||||
}
|
||||
|
||||
s32 func_8002DEEC(Player* player) {
|
||||
return (player->stateFlags1 & 0x20000080) || (player->csMode != 0);
|
||||
return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csMode != 0);
|
||||
}
|
||||
|
||||
void func_8002DF18(GlobalContext* globalCtx, Player* player) {
|
||||
@@ -1435,7 +1437,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) {
|
||||
s16 yawTempAbs = ABS(yawTemp);
|
||||
|
||||
if (player->unk_664 != NULL) {
|
||||
if ((yawTempAbs > 0x4000) || (actor->flags & 0x8000000)) {
|
||||
if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) {
|
||||
return FLT_MAX;
|
||||
} else {
|
||||
f32 ret =
|
||||
@@ -1471,7 +1473,7 @@ u32 func_8002F090(Actor* actor, f32 arg1) {
|
||||
}
|
||||
|
||||
s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
|
||||
if ((actor->update == NULL) || !(actor->flags & 1)) {
|
||||
if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1493,8 +1495,8 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
|
||||
}
|
||||
|
||||
u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) {
|
||||
if (actor->flags & 0x100) {
|
||||
actor->flags &= ~0x100;
|
||||
if (actor->flags & ACTOR_FLAG_8) {
|
||||
actor->flags &= ~ACTOR_FLAG_8;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1505,7 +1507,7 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
// This is convoluted but it seems like it must be a single if statement to match
|
||||
if ((player->actor.flags & 0x100) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) ||
|
||||
if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) ||
|
||||
(!actor->isTargeted &&
|
||||
((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) ||
|
||||
(arg2 < actor->xzDistToPlayer)))) {
|
||||
@@ -1549,11 +1551,11 @@ s8 func_8002F368(GlobalContext* globalCtx) {
|
||||
|
||||
void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y) {
|
||||
Vec3f projectedPos;
|
||||
f32 w;
|
||||
f32 cappedInvW;
|
||||
|
||||
func_8002BE04(globalCtx, &actor->focus.pos, &projectedPos, &w);
|
||||
*x = projectedPos.x * w * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2);
|
||||
*y = projectedPos.y * w * -(SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2);
|
||||
Actor_ProjectPos(globalCtx, &actor->focus.pos, &projectedPos, &cappedInvW);
|
||||
*x = projectedPos.x * cappedInvW * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2);
|
||||
*y = projectedPos.y * cappedInvW * -(SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2);
|
||||
}
|
||||
|
||||
u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) {
|
||||
@@ -1567,10 +1569,12 @@ u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) {
|
||||
s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
|
||||
if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
|
||||
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) &&
|
||||
Player_GetExplosiveHeld(player) < 0) {
|
||||
if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) &&
|
||||
(getItemId < GI_MAX)) ||
|
||||
(!(player->stateFlags1 & 0x20000800))) {
|
||||
(!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) {
|
||||
if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) {
|
||||
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
|
||||
s32 absYawDiff = ABS(yawDiff);
|
||||
@@ -1638,7 +1642,9 @@ s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) {
|
||||
u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
if (!(player->stateFlags1 & 0x003C7880)) {
|
||||
if (!(player->stateFlags1 &
|
||||
(PLAYER_STATE1_7 | PLAYER_STATE1_11 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
|
||||
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21))) {
|
||||
player->rideActor = horse;
|
||||
player->mountSide = mountSide;
|
||||
return true;
|
||||
@@ -1708,30 +1714,30 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) {
|
||||
|
||||
void func_8002F8F0(Actor* actor, u16 sfxId) {
|
||||
actor->sfx = sfxId;
|
||||
actor->flags |= 0x80000;
|
||||
actor->flags &= ~0x10300000;
|
||||
actor->flags |= ACTOR_FLAG_19;
|
||||
actor->flags &= ~(ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
||||
}
|
||||
|
||||
void func_8002F91C(Actor* actor, u16 sfxId) {
|
||||
actor->sfx = sfxId;
|
||||
actor->flags |= 0x100000;
|
||||
actor->flags &= ~0x10280000;
|
||||
actor->flags |= ACTOR_FLAG_20;
|
||||
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
||||
}
|
||||
|
||||
void func_8002F948(Actor* actor, u16 sfxId) {
|
||||
actor->sfx = sfxId;
|
||||
actor->flags |= 0x200000;
|
||||
actor->flags &= ~0x10180000;
|
||||
actor->flags |= ACTOR_FLAG_21;
|
||||
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_28);
|
||||
}
|
||||
|
||||
void func_8002F974(Actor* actor, u16 sfxId) {
|
||||
actor->flags &= ~0x10380000;
|
||||
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
|
||||
actor->sfx = sfxId;
|
||||
}
|
||||
|
||||
void func_8002F994(Actor* actor, s32 arg1) {
|
||||
actor->flags |= 0x10000000;
|
||||
actor->flags &= ~0x00380000;
|
||||
actor->flags |= ACTOR_FLAG_28;
|
||||
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21);
|
||||
if (arg1 < 40) {
|
||||
actor->sfx = NA_SE_PL_WALK_DIRT - SFX_FLAG;
|
||||
} else if (arg1 < 100) {
|
||||
@@ -1939,9 +1945,9 @@ void func_80030488(GlobalContext* globalCtx) {
|
||||
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10);
|
||||
}
|
||||
|
||||
void func_800304B0(GlobalContext* globalCtx) {
|
||||
if (globalCtx->actorCtx.unk_03 != 0) {
|
||||
globalCtx->actorCtx.unk_03 = 0;
|
||||
void Actor_DisableLens(GlobalContext* globalCtx) {
|
||||
if (globalCtx->actorCtx.lensActive) {
|
||||
globalCtx->actorCtx.lensActive = false;
|
||||
func_800876C8(globalCtx);
|
||||
}
|
||||
}
|
||||
@@ -1972,7 +1978,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry*
|
||||
actorCtx->flags.clear = savedSceneFlags->clear;
|
||||
actorCtx->flags.collect = savedSceneFlags->collect;
|
||||
|
||||
func_8002CDE4(globalCtx, &actorCtx->titleCtx);
|
||||
TitleCard_Init(globalCtx, &actorCtx->titleCtx);
|
||||
|
||||
actorCtx->absoluteSpace = NULL;
|
||||
|
||||
@@ -1981,9 +1987,19 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry*
|
||||
func_8002FA60(globalCtx);
|
||||
}
|
||||
|
||||
u32 D_80116068[] = {
|
||||
0x100000C0, 0x100000C0, 0x00000000, 0x100004C0, 0x00000080, 0x300000C0,
|
||||
0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0,
|
||||
u32 D_80116068[ACTORCAT_MAX] = {
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
||||
0,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
|
||||
PLAYER_STATE1_7,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
|
||||
PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
||||
0,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
|
||||
0,
|
||||
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
|
||||
};
|
||||
|
||||
void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) {
|
||||
@@ -2028,11 +2044,11 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) {
|
||||
|
||||
sp80 = &D_80116068[0];
|
||||
|
||||
if (player->stateFlags2 & 0x8000000) {
|
||||
unkFlag = 0x2000000;
|
||||
if (player->stateFlags2 & PLAYER_STATE2_27) {
|
||||
unkFlag = ACTOR_FLAG_25;
|
||||
}
|
||||
|
||||
if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) {
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) {
|
||||
sp74 = player->targetActor;
|
||||
}
|
||||
|
||||
@@ -2076,9 +2092,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) {
|
||||
actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer);
|
||||
|
||||
actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor);
|
||||
actor->flags &= ~0x1000000;
|
||||
actor->flags &= ~ACTOR_FLAG_24;
|
||||
|
||||
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & 0x50)) {
|
||||
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) {
|
||||
if (actor == player->unk_664) {
|
||||
actor->isTargeted = true;
|
||||
} else {
|
||||
@@ -2160,17 +2176,17 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
|
||||
lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
|
||||
|
||||
Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->world.pos);
|
||||
Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
|
||||
Lights_Draw(lights, globalCtx->state.gfxCtx);
|
||||
|
||||
if (actor->flags & 0x1000) {
|
||||
func_800D1694(actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x,
|
||||
actor->world.pos.y +
|
||||
(f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y),
|
||||
actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
||||
if (actor->flags & ACTOR_FLAG_12) {
|
||||
Matrix_SetTranslateRotateYXZ(
|
||||
actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x,
|
||||
actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y),
|
||||
actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
||||
} else {
|
||||
func_800D1694(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z, &actor->shape.rot);
|
||||
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z, &actor->shape.rot);
|
||||
}
|
||||
|
||||
Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
|
||||
@@ -2217,33 +2233,45 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
|
||||
}
|
||||
|
||||
void func_80030ED8(Actor* actor) {
|
||||
if (actor->flags & 0x80000) {
|
||||
if (actor->flags & ACTOR_FLAG_19) {
|
||||
Audio_PlaySoundGeneral(actor->sfx, &actor->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (actor->flags & 0x100000) {
|
||||
} else if (actor->flags & ACTOR_FLAG_20) {
|
||||
func_80078884(actor->sfx);
|
||||
} else if (actor->flags & 0x200000) {
|
||||
} else if (actor->flags & ACTOR_FLAG_21) {
|
||||
func_800788CC(actor->sfx);
|
||||
} else if (actor->flags & 0x10000000) {
|
||||
} else if (actor->flags & ACTOR_FLAG_28) {
|
||||
func_800F4C58(&D_801333D4, NA_SE_SY_TIMER - SFX_FLAG, (s8)(actor->sfx - 1));
|
||||
} else {
|
||||
func_80078914(&actor->projectedPos, actor->sfx);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80030FA8(GraphicsContext* gfxCtx) {
|
||||
#define LENS_MASK_WIDTH 64
|
||||
#define LENS_MASK_HEIGHT 64
|
||||
// 26 and 6 are for padding between the mask texture and the screen borders
|
||||
#define LENS_MASK_OFFSET_S ((SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) - 26)
|
||||
#define LENS_MASK_OFFSET_T ((SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) - 6)
|
||||
|
||||
void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) {
|
||||
OPEN_DISPS(gfxCtx, "../z_actor.c", 6161);
|
||||
|
||||
gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0,
|
||||
G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, LENS_MASK_WIDTH,
|
||||
LENS_MASK_HEIGHT, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
|
||||
gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, 384, 224, 892, 732);
|
||||
gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597);
|
||||
gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, (SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2,
|
||||
(SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, (SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1) << 2,
|
||||
(SCREEN_HEIGHT / 2 + LENS_MASK_HEIGHT - 1) << 2);
|
||||
gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE,
|
||||
LENS_MASK_OFFSET_S << 5, LENS_MASK_OFFSET_T << 5,
|
||||
(1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH,
|
||||
(1 << 10) * (SCREEN_HEIGHT - 2 * LENS_MASK_OFFSET_T) / SCREEN_HEIGHT);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183);
|
||||
}
|
||||
|
||||
void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) {
|
||||
void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) {
|
||||
Actor** invisibleActor;
|
||||
GraphicsContext* gfxCtx;
|
||||
s32 i;
|
||||
@@ -2257,27 +2285,40 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
||||
if (globalCtx->roomCtx.curRoom.showInvisActors == 0) {
|
||||
// Update both the color frame buffer and the z-buffer
|
||||
gDPSetOtherMode(POLY_XLU_DISP++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2);
|
||||
|
||||
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255);
|
||||
|
||||
// the z-buffer will later only allow drawing inside the lens circle
|
||||
} else {
|
||||
// Update the z-buffer but not the color frame buffer
|
||||
gDPSetOtherMode(POLY_XLU_DISP++,
|
||||
G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) |
|
||||
GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA));
|
||||
|
||||
// inverts the mask image, which initially is 0 inner and 74 outer,
|
||||
// by setting the combiner to draw 74 - image instead of the image
|
||||
gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0,
|
||||
PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 74, 74, 74, 74);
|
||||
|
||||
// the z-buffer will later only allow drawing outside the lens circle
|
||||
}
|
||||
|
||||
// Together with the depth source set above, this sets the depth to the closest.
|
||||
// For a pixel with such a depth value, the z-buffer will reject drawing to that pixel.
|
||||
gDPSetPrimDepth(POLY_XLU_DISP++, 0, 0);
|
||||
|
||||
func_80030FA8(gfxCtx);
|
||||
// The z-buffer will be updated where the mask is not fully transparent.
|
||||
Actor_DrawLensOverlay(gfxCtx);
|
||||
|
||||
// "Magic lens invisible Actor display START"
|
||||
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", numInvisibleActors);
|
||||
@@ -2293,6 +2334,8 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv
|
||||
gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors);
|
||||
|
||||
if (globalCtx->roomCtx.curRoom.showInvisActors != 0) {
|
||||
// Draw the lens overlay to the color frame buffer
|
||||
|
||||
gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)"
|
||||
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
@@ -2304,7 +2347,7 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv
|
||||
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255);
|
||||
|
||||
func_80030FA8(gfxCtx);
|
||||
Actor_DrawLensOverlay(gfxCtx);
|
||||
|
||||
gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 1); // "Blue spectacles (exterior)"
|
||||
}
|
||||
@@ -2372,18 +2415,18 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) {
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) {
|
||||
if (func_800314B0(globalCtx, actor)) {
|
||||
actor->flags |= 0x40;
|
||||
actor->flags |= ACTOR_FLAG_6;
|
||||
} else {
|
||||
actor->flags &= ~0x40;
|
||||
actor->flags &= ~ACTOR_FLAG_6;
|
||||
}
|
||||
}
|
||||
|
||||
actor->isDrawn = false;
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
|
||||
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) {
|
||||
if ((actor->flags & 0x80) &&
|
||||
((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) ||
|
||||
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) {
|
||||
if ((actor->flags & ACTOR_FLAG_7) &&
|
||||
((globalCtx->roomCtx.curRoom.showInvisActors == 0) || globalCtx->actorCtx.lensActive ||
|
||||
(actor->room != globalCtx->roomCtx.curRoom.num))) {
|
||||
ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX,
|
||||
"invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464);
|
||||
@@ -2411,10 +2454,10 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) {
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || (HREG(72) != 0)) {
|
||||
if (globalCtx->actorCtx.unk_03 != 0) {
|
||||
func_8003115C(globalCtx, invisibleActorCounter, invisibleActors);
|
||||
if (globalCtx->actorCtx.lensActive) {
|
||||
Actor_DrawLensActors(globalCtx, invisibleActorCounter, invisibleActors);
|
||||
if ((globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx)) {
|
||||
func_800304B0(globalCtx);
|
||||
Actor_DisableLens(globalCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2761,6 +2804,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId
|
||||
Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX,
|
||||
f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) {
|
||||
Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params);
|
||||
|
||||
if (spawnedActor == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -2836,8 +2880,8 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
||||
actorCtx->targetCtx.unk_8C = NULL;
|
||||
}
|
||||
|
||||
if (actor == actorCtx->targetCtx.unk_90) {
|
||||
actorCtx->targetCtx.unk_90 = NULL;
|
||||
if (actor == actorCtx->targetCtx.bgmEnemy) {
|
||||
actorCtx->targetCtx.bgmEnemy = NULL;
|
||||
}
|
||||
|
||||
Audio_StopSfxByPos(&actor->projectedPos);
|
||||
@@ -2873,7 +2917,7 @@ s32 func_80032880(GlobalContext* globalCtx, Actor* actor) {
|
||||
Actor* D_8015BBE8;
|
||||
Actor* D_8015BBEC;
|
||||
f32 D_8015BBF0;
|
||||
f32 D_8015BBF4;
|
||||
f32 sbgmEnemyDistSq;
|
||||
s32 D_8015BBF8;
|
||||
s16 D_8015BBFC;
|
||||
|
||||
@@ -2889,11 +2933,14 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla
|
||||
sp84 = player->unk_664;
|
||||
|
||||
while (actor != NULL) {
|
||||
if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) {
|
||||
if ((actorCategory == ACTORCAT_ENEMY) && ((actor->flags & 5) == 5) &&
|
||||
(actor->xyzDistToPlayerSq < 250000.0f) && (actor->xyzDistToPlayerSq < D_8015BBF4)) {
|
||||
actorCtx->targetCtx.unk_90 = actor;
|
||||
D_8015BBF4 = actor->xyzDistToPlayerSq;
|
||||
if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) {
|
||||
|
||||
// This block below is for determining the closest actor to player in determining the volume
|
||||
// used while playing enemy bgm music
|
||||
if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) &&
|
||||
(actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sbgmEnemyDistSq)) {
|
||||
actorCtx->targetCtx.bgmEnemy = actor;
|
||||
sbgmEnemyDistSq = actor->xyzDistToPlayerSq;
|
||||
}
|
||||
|
||||
if (actor != sp84) {
|
||||
@@ -2929,13 +2976,13 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a
|
||||
u8* entry;
|
||||
|
||||
D_8015BBE8 = D_8015BBEC = NULL;
|
||||
D_8015BBF0 = D_8015BBF4 = FLT_MAX;
|
||||
D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX;
|
||||
D_8015BBF8 = 0x7FFFFFFF;
|
||||
|
||||
if (!Player_InCsMode(globalCtx)) {
|
||||
entry = &D_801160A0[0];
|
||||
|
||||
actorCtx->targetCtx.unk_90 = NULL;
|
||||
actorCtx->targetCtx.bgmEnemy = NULL;
|
||||
D_8015BBFC = player->actor.shape.rot.y;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
@@ -2982,7 +3029,7 @@ Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory) {
|
||||
*/
|
||||
void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor) {
|
||||
globalCtx->actorCtx.freezeFlashTimer = 5;
|
||||
Audio_PlaySoundAtPosition(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE);
|
||||
}
|
||||
|
||||
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
||||
@@ -3155,7 +3202,8 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos
|
||||
}
|
||||
}
|
||||
|
||||
void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6) {
|
||||
void func_80033480(GlobalContext* globalCtx, Vec3f* posBase, f32 randRangeDiameter, s32 amountMinusOne, s16 scaleBase,
|
||||
s16 scaleStep, u8 arg6) {
|
||||
Vec3f pos;
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f accel = { 0.0f, 0.3f, 0.0f };
|
||||
@@ -3163,12 +3211,12 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1
|
||||
u32 var2;
|
||||
s32 i;
|
||||
|
||||
for (i = arg3; i >= 0; i--) {
|
||||
pos.x = arg1->x + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.y = arg1->y + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.z = arg1->z + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
for (i = amountMinusOne; i >= 0; i--) {
|
||||
pos.x = posBase->x + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
||||
pos.y = posBase->y + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
||||
pos.z = posBase->z + ((Rand_ZeroOne() - 0.5f) * randRangeDiameter);
|
||||
|
||||
scale = (s16)((Rand_ZeroOne() * arg4) * 0.2f) + arg4;
|
||||
scale = (s16)((Rand_ZeroOne() * scaleBase) * 0.2f) + scaleBase;
|
||||
var2 = arg6;
|
||||
|
||||
if (var2 != 0) {
|
||||
@@ -3383,7 +3431,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista
|
||||
s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
if ((player->stateFlags1 & 0x10) && actor->isTargeted) {
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isTargeted) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -3396,7 +3444,7 @@ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) {
|
||||
s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
if ((player->stateFlags1 & 0x10) && !actor->isTargeted) {
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isTargeted) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -3842,29 +3890,29 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) {
|
||||
}
|
||||
|
||||
if (arg3 < var) {
|
||||
actor->flags &= ~1;
|
||||
actor->flags &= ~ACTOR_FLAG_0;
|
||||
Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1);
|
||||
} else {
|
||||
actor->flags |= 1;
|
||||
actor->flags |= ACTOR_FLAG_0;
|
||||
Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1);
|
||||
}
|
||||
|
||||
return arg2;
|
||||
}
|
||||
|
||||
void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* animations, s32 index) {
|
||||
void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index) {
|
||||
f32 frameCount;
|
||||
|
||||
animations += index;
|
||||
animationInfo += index;
|
||||
|
||||
if (animations->frameCount > 0.0f) {
|
||||
frameCount = animations->frameCount;
|
||||
if (animationInfo->frameCount > 0.0f) {
|
||||
frameCount = animationInfo->frameCount;
|
||||
} else {
|
||||
frameCount = Animation_GetLastFrame(animations->animation);
|
||||
frameCount = Animation_GetLastFrame(animationInfo->animation);
|
||||
}
|
||||
|
||||
Animation_Change(skelAnime, animations->animation, animations->playbackSpeed, animations->startFrame, frameCount,
|
||||
animations->mode, animations->transitionRate);
|
||||
Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame,
|
||||
frameCount, animationInfo->mode, animationInfo->morphFrames);
|
||||
}
|
||||
|
||||
void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) {
|
||||
|
||||
+47
-45
@@ -511,7 +511,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(camera->player->stateFlags1 & 0x8000000)) {
|
||||
if (!(camera->player->stateFlags1 & PLAYER_STATE1_27)) {
|
||||
// player is not swimming
|
||||
*waterY = BGCHECK_Y_MIN;
|
||||
return -1;
|
||||
@@ -701,7 +701,7 @@ f32 Camera_ClampLERPScale(Camera* camera, f32 maxLERPScale) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Camera_CopyModeValuesToPREG(Camera* camera, s16 mode) {
|
||||
void Camera_CopyDataToRegs(Camera* camera, s16 mode) {
|
||||
CameraModeValue* values;
|
||||
CameraModeValue* valueP;
|
||||
s32 i;
|
||||
@@ -714,9 +714,9 @@ void Camera_CopyModeValuesToPREG(Camera* camera, s16 mode) {
|
||||
|
||||
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[mode].valueCnt; i++) {
|
||||
valueP = &values[i];
|
||||
PREG(valueP->param) = valueP->val;
|
||||
PREG(valueP->dataType) = valueP->val;
|
||||
if (PREG(82)) {
|
||||
osSyncPrintf("camera: res: PREG(%02d) = %d\n", valueP->param, valueP->val);
|
||||
osSyncPrintf("camera: res: PREG(%02d) = %d\n", valueP->dataType, valueP->val);
|
||||
}
|
||||
}
|
||||
camera->animState = 0;
|
||||
@@ -729,9 +729,9 @@ s32 Camera_CopyPREGToModeValues(Camera* camera) {
|
||||
|
||||
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[camera->mode].valueCnt; i++) {
|
||||
valueP = &values[i];
|
||||
valueP->val = PREG(valueP->param);
|
||||
valueP->val = R_CAM_DATA(valueP->dataType);
|
||||
if (PREG(82)) {
|
||||
osSyncPrintf("camera: res: %d = PREG(%02d)\n", valueP->val, valueP->param);
|
||||
osSyncPrintf("camera: res: %d = PREG(%02d)\n", valueP->val, valueP->dataType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -999,7 +999,7 @@ s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) {
|
||||
/**
|
||||
* Adjusts the camera's at position for Camera_Parallel1
|
||||
*/
|
||||
s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3, s16 arg4) {
|
||||
s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg3, s16 arg4) {
|
||||
Vec3f* at = &camera->at;
|
||||
Vec3f posOffsetTarget;
|
||||
Vec3f atTarget;
|
||||
@@ -1013,7 +1013,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3,
|
||||
|
||||
temp_f0_4 = Player_GetHeight(camera->player);
|
||||
posOffsetTarget.x = 0.0f;
|
||||
posOffsetTarget.y = temp_f0_4 + arg2;
|
||||
posOffsetTarget.y = temp_f0_4 + yOffset;
|
||||
posOffsetTarget.z = 0.0f;
|
||||
|
||||
if (PREG(76) && arg4) {
|
||||
@@ -1021,7 +1021,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3,
|
||||
}
|
||||
|
||||
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
|
||||
camera->player->stateFlags1 & 0x200000) {
|
||||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
|
||||
*arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, PCT(OREG(43)), 0.1f);
|
||||
phi_f20 = playerPosRot->pos.y - *arg3;
|
||||
posOffsetTarget.y -= phi_f20;
|
||||
@@ -1124,7 +1124,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
|
||||
tmpPos0.z = tmpPos0.z + lookFromOffset.z;
|
||||
|
||||
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
|
||||
camera->player->stateFlags1 & 0x200000) {
|
||||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
|
||||
*yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, PCT(OREG(43)), 0.1f);
|
||||
yPosDelta = playerPosRot->pos.y - *yPosOffset;
|
||||
tmpPos0.y -= yPosDelta;
|
||||
@@ -1690,9 +1690,9 @@ s32 Camera_Normal2(Camera* camera) {
|
||||
anim->unk_20 = BGCAM_ROT(bgData).x;
|
||||
anim->unk_22 = BGCAM_ROT(bgData).y;
|
||||
anim->unk_24 = playerPosRot->pos.y;
|
||||
anim->unk_1C = BGCAM_FOV(bgData) == -1
|
||||
? norm2->unk_14
|
||||
: BGCAM_FOV(bgData) >= 0x169 ? PCT(BGCAM_FOV(bgData)) : BGCAM_FOV(bgData);
|
||||
anim->unk_1C = BGCAM_FOV(bgData) == -1 ? norm2->unk_14
|
||||
: BGCAM_FOV(bgData) >= 0x169 ? PCT(BGCAM_FOV(bgData))
|
||||
: BGCAM_FOV(bgData);
|
||||
|
||||
anim->unk_28 = BGCAM_JFIFID(bgData) == -1 ? 0 : BGCAM_JFIFID(bgData);
|
||||
|
||||
@@ -1974,8 +1974,7 @@ s32 Camera_Parallel1(Camera* camera) {
|
||||
CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
|
||||
f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight));
|
||||
|
||||
para1->unk_00 = NEXTPCT * playerHeight * yNormal;
|
||||
;
|
||||
para1->yOffset = NEXTPCT * playerHeight * yNormal;
|
||||
para1->distTarget = NEXTPCT * playerHeight * yNormal;
|
||||
para1->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
|
||||
para1->yawTarget = DEGF_TO_BINANG(NEXTSETTING);
|
||||
@@ -2060,7 +2059,7 @@ s32 Camera_Parallel1(Camera* camera) {
|
||||
}
|
||||
|
||||
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
|
||||
camera->player->stateFlags1 & 0x200000) {
|
||||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
|
||||
anim->yTarget = playerPosRot->pos.y;
|
||||
sp6A = 0;
|
||||
} else {
|
||||
@@ -2068,7 +2067,7 @@ s32 Camera_Parallel1(Camera* camera) {
|
||||
}
|
||||
|
||||
if (!(para1->interfaceFlags & 0x80) && !sp6A) {
|
||||
Camera_CalcAtForParallel(camera, &atToEyeNextDir, para1->unk_00, &anim->yTarget, para1->interfaceFlags & 1);
|
||||
Camera_CalcAtForParallel(camera, &atToEyeNextDir, para1->yOffset, &anim->yTarget, para1->interfaceFlags & 1);
|
||||
} else {
|
||||
func_800458D4(camera, &atToEyeNextDir, para1->unk_18, &anim->yTarget, para1->interfaceFlags & 1);
|
||||
}
|
||||
@@ -2749,7 +2748,7 @@ s32 Camera_Battle1(Camera* camera) {
|
||||
sp78 = batt1->swingPitchFinal;
|
||||
fov = batt1->fov;
|
||||
|
||||
if (camera->player->stateFlags1 & 0x1000) {
|
||||
if (camera->player->stateFlags1 & PLAYER_STATE1_12) {
|
||||
// charging sword.
|
||||
anim->unk_10 = Camera_LERPCeilF(PCT(OREG(12)) * 0.5f, anim->unk_10, PCT(OREG(25)), 0.1f);
|
||||
camera->xzOffsetUpdateRate = Camera_LERPCeilF(0.2f, camera->xzOffsetUpdateRate, PCT(OREG(25)), 0.1f);
|
||||
@@ -2820,7 +2819,7 @@ s32 Camera_Battle1(Camera* camera) {
|
||||
}
|
||||
|
||||
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
|
||||
camera->player->stateFlags1 & 0x200000) {
|
||||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
|
||||
isOffGround = false;
|
||||
anim->yPosOffset = playerPosRot->pos.y;
|
||||
} else {
|
||||
@@ -2923,7 +2922,9 @@ s32 Camera_Battle1(Camera* camera) {
|
||||
}
|
||||
anim->roll += (((OREG(36) * camera->speedRatio) * (1.0f - distRatio)) - anim->roll) * PCT(OREG(37));
|
||||
camera->roll = DEGF_TO_BINANG(anim->roll);
|
||||
camera->fov = Camera_LERPCeilF((player->swordState != 0 ? 0.8f : gSaveContext.health <= 0x10 ? 0.8f : 1.0f) *
|
||||
camera->fov = Camera_LERPCeilF((player->swordState != 0 ? 0.8f
|
||||
: gSaveContext.health <= 0x10 ? 0.8f
|
||||
: 1.0f) *
|
||||
(fov - ((fov * 0.05f) * distRatio)),
|
||||
camera->fov, camera->fovUpdateRate, 1.0f);
|
||||
}
|
||||
@@ -3138,7 +3139,7 @@ s32 Camera_KeepOn1(Camera* camera) {
|
||||
anim->unk_0C = NULL;
|
||||
cont:
|
||||
if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f ||
|
||||
camera->player->stateFlags1 & 0x200000) {
|
||||
camera->player->stateFlags1 & PLAYER_STATE1_21) {
|
||||
anim->unk_08 = playerPosRot->pos.y;
|
||||
sp80 = 0;
|
||||
} else {
|
||||
@@ -3559,7 +3560,7 @@ s32 Camera_KeepOn4(Camera* camera) {
|
||||
keep4->unk_04 = playerHeight * 1.6f * yNormal;
|
||||
keep4->unk_08 = -2.0f;
|
||||
keep4->unk_0C = 120.0f;
|
||||
keep4->unk_10 = player->stateFlags1 & 0x8000000 ? 0.0f : 20.0f;
|
||||
keep4->unk_10 = player->stateFlags1 & PLAYER_STATE1_27 ? 0.0f : 20.0f;
|
||||
keep4->unk_1C = 0x3212;
|
||||
keep4->unk_1E = 0x1E;
|
||||
keep4->unk_18 = 50.0f;
|
||||
@@ -4005,7 +4006,7 @@ s32 Camera_Fixed3(Camera* camera) {
|
||||
|
||||
if (camera->animState == 0) {
|
||||
anim->updDirTimer = 5;
|
||||
R_CAM_FIXED3_FOV = anim->fov;
|
||||
R_CAM_DATA(CAM_DATA_FOV) = anim->fov;
|
||||
camera->animState++;
|
||||
}
|
||||
|
||||
@@ -4028,7 +4029,7 @@ s32 Camera_Fixed3(Camera* camera) {
|
||||
|
||||
Camera_Vec3fVecSphGeoAdd(at, eye, &atSph);
|
||||
sCameraInterfaceFlags = fixd3->interfaceFlags;
|
||||
anim->fov = R_CAM_FIXED3_FOV;
|
||||
anim->fov = R_CAM_DATA(CAM_DATA_FOV);
|
||||
camera->roll = 0;
|
||||
camera->fov = anim->fov * 0.01f;
|
||||
camera->atLERPStepScale = 0.0f;
|
||||
@@ -4812,7 +4813,7 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
camera->animState++;
|
||||
}
|
||||
|
||||
if (player->stateFlags1 & 0x20000000) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_29) {
|
||||
anim->initalPos = playerPosRot->pos;
|
||||
}
|
||||
|
||||
@@ -4820,7 +4821,7 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
if (anim->animTimer > 0) {
|
||||
anim->animTimer--;
|
||||
anim->initalPos = playerPosRot->pos;
|
||||
} else if ((!(player->stateFlags1 & 0x20000000)) &&
|
||||
} else if ((!(player->stateFlags1 & PLAYER_STATE1_29)) &&
|
||||
((OLib_Vec3fDistXZ(&playerPosRot->pos, &anim->initalPos) >= 10.0f) ||
|
||||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) ||
|
||||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) ||
|
||||
@@ -4848,7 +4849,7 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
anim->initalPos = playerPosRot->pos;
|
||||
}
|
||||
|
||||
if ((!(player->stateFlags1 & 0x20000000)) &&
|
||||
if ((!(player->stateFlags1 & PLAYER_STATE1_29)) &&
|
||||
((0.001f < camera->xzSpeed) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) ||
|
||||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) ||
|
||||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_CLEFT) ||
|
||||
@@ -5065,7 +5066,8 @@ s32 Camera_Unique9(Camera* camera) {
|
||||
D_8011D3AC = anim->curKeyFrame->unk_01 & 0xF;
|
||||
} else if ((anim->curKeyFrame->unk_01 & 0xF0) == 0xC0) {
|
||||
Camera_UpdateInterface(0xF000 | ((anim->curKeyFrame->unk_01 & 0xF) << 8));
|
||||
} else if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) {
|
||||
} else if (camera->player->stateFlags1 & PLAYER_STATE1_27 &&
|
||||
player->currentBoots != PLAYER_BOOTS_IRON) {
|
||||
func_8002DF38(camera->globalCtx, camera->target, 8);
|
||||
osSyncPrintf("camera: demo: player demo set WAIT\n");
|
||||
} else {
|
||||
@@ -5441,7 +5443,7 @@ s32 Camera_Unique9(Camera* camera) {
|
||||
// Set the player's position
|
||||
camera->player->actor.world.pos.x = anim->playerPos.x;
|
||||
camera->player->actor.world.pos.z = anim->playerPos.z;
|
||||
if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) {
|
||||
if (camera->player->stateFlags1 & PLAYER_STATE1_27 && player->currentBoots != PLAYER_BOOTS_IRON) {
|
||||
camera->player->actor.world.pos.y = anim->playerPos.y;
|
||||
}
|
||||
} else {
|
||||
@@ -6002,16 +6004,16 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
|
||||
sDemo5PrevSfxFrame = camera->globalCtx->state.frames;
|
||||
|
||||
if (camera->player->stateFlags1 & 0x8000000 && (player->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||
if (camera->player->stateFlags1 & PLAYER_STATE1_27 && (player->currentBoots != PLAYER_BOOTS_IRON)) {
|
||||
// swimming, and not iron boots
|
||||
player->stateFlags1 |= 0x20000000;
|
||||
player->stateFlags1 |= PLAYER_STATE1_29;
|
||||
// env frozen
|
||||
player->actor.freezeTimer = camera->timer;
|
||||
} else {
|
||||
sp4A = playerhead.rot.y - playerTargetGeo.yaw;
|
||||
if (camera->target->category == ACTORCAT_PLAYER) {
|
||||
pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame;
|
||||
if (player->stateFlags1 & 0x800) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_11) {
|
||||
// holding object over head.
|
||||
func_8002DF54(camera->globalCtx, camera->target, 8);
|
||||
} else if (ABS(pad) > 3000) {
|
||||
@@ -6787,8 +6789,8 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
|
||||
OREG(i) = sOREGInit[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < sPREGInitCnt; i++) {
|
||||
PREG(i) = sPREGInit[i];
|
||||
for (i = 0; i < sCamDataRegsInitCount; i++) {
|
||||
R_CAM_DATA(i) = sCamDataRegsInit[i];
|
||||
}
|
||||
|
||||
DbCamera_Reset(camera, &D_8015BD80);
|
||||
@@ -6943,7 +6945,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) {
|
||||
camera->paramFlags = 0;
|
||||
camera->nextCamDataIdx = -1;
|
||||
camera->atLERPStepScale = 1.0f;
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
Camera_QRegInit();
|
||||
osSyncPrintf(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n");
|
||||
|
||||
@@ -6970,9 +6972,9 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) {
|
||||
values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
|
||||
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[camera->mode].valueCnt; i++) {
|
||||
valueP = &values[i];
|
||||
PREG(valueP->param) = valueP->val;
|
||||
R_CAM_DATA(valueP->dataType) = valueP->val;
|
||||
if (PREG(82)) {
|
||||
osSyncPrintf("camera: change camera status: PREG(%02d) = %d\n", valueP->param, valueP->val);
|
||||
osSyncPrintf("camera: change camera status: PREG(%02d) = %d\n", valueP->dataType, valueP->val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7071,7 +7073,7 @@ s32 Camera_CheckWater(Camera* camera) {
|
||||
}
|
||||
|
||||
if (camera->unk_14C & 0x200) {
|
||||
if (player->stateFlags2 & 0x800) {
|
||||
if (player->stateFlags2 & PLAYER_STATE2_11) {
|
||||
Camera_ChangeSettingFlags(camera, CAM_SET_PIVOT_WATER_SURFACE, 6);
|
||||
camera->unk_14C |= (s16)0x8000;
|
||||
} else if (camera->unk_14C & (s16)0x8000) {
|
||||
@@ -7555,7 +7557,7 @@ void Camera_Finish(Camera* camera) {
|
||||
|
||||
if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) {
|
||||
player->actor.freezeTimer = 0;
|
||||
player->stateFlags1 &= ~0x20000000;
|
||||
player->stateFlags1 &= ~PLAYER_STATE1_29;
|
||||
|
||||
if (player->csMode != 0) {
|
||||
func_8002DF54(camera->globalCtx, &player->actor, 7);
|
||||
@@ -7613,7 +7615,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: change camera mode: force NORMAL: %s %s refused\n" VT_RST,
|
||||
sCameraSettingNames[camera->setting], sCameraModeNames[mode]);
|
||||
camera->mode = CAM_MODE_NORMAL;
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
func_8005A02C(camera);
|
||||
return 0xC0000000 | mode;
|
||||
} else {
|
||||
@@ -7629,7 +7631,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
|
||||
}
|
||||
camera->unk_14A |= 0x20;
|
||||
camera->unk_14A |= 2;
|
||||
Camera_CopyModeValuesToPREG(camera, mode);
|
||||
Camera_CopyDataToRegs(camera, mode);
|
||||
modeChangeFlags = 0;
|
||||
switch (mode) {
|
||||
case CAM_MODE_FIRSTPERSON:
|
||||
@@ -7788,7 +7790,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
|
||||
camera->setting = setting;
|
||||
|
||||
if (Camera_ChangeModeFlags(camera, camera->mode, 1) >= 0) {
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
}
|
||||
|
||||
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames,
|
||||
@@ -7817,7 +7819,7 @@ s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx) {
|
||||
if (settingChangeSuccessful || sCameraSettings[camera->setting].unk_00 & 0x80000000) {
|
||||
camera->camDataIdx = camDataIdx;
|
||||
camera->unk_14A |= 4;
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
} else if (settingChangeSuccessful < -1) {
|
||||
//! @bug: This is likely checking the wrong value. The actual return of Camera_ChangeSettingFlags or
|
||||
// camDataIdx would make more sense.
|
||||
@@ -7992,7 +7994,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 camDataIdx, f32 a
|
||||
doorParams->camDataIdx = camDataIdx;
|
||||
|
||||
if (camDataIdx == -99) {
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
return -99;
|
||||
}
|
||||
|
||||
@@ -8012,7 +8014,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 camDataIdx, f32 a
|
||||
osSyncPrintf("....change door camera ID %d (set %d)\n", camera->camDataIdx, camera->setting);
|
||||
}
|
||||
|
||||
Camera_CopyModeValuesToPREG(camera, camera->mode);
|
||||
Camera_CopyDataToRegs(camera, camera->mode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+1848
-3018
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ void SaveContext_Init(void) {
|
||||
D_8015FA88 = 0;
|
||||
D_8015FA8C = 0;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.natureAmbienceId = 0xFF;
|
||||
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
||||
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
|
||||
gSaveContext.nextCutsceneIndex = 0xFFEF;
|
||||
gSaveContext.cutsceneTrigger = 0;
|
||||
|
||||
+9
-13
@@ -151,19 +151,15 @@ void func_8006390C(Input* input) {
|
||||
gGameInfo->dpadLast = dpad;
|
||||
}
|
||||
|
||||
increment = CHECK_BTN_ANY(dpad, BTN_DRIGHT)
|
||||
? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B)
|
||||
? 1000
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_A)
|
||||
? 100
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 : 1)
|
||||
: CHECK_BTN_ANY(dpad, BTN_DLEFT)
|
||||
? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B)
|
||||
? -1000
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_A)
|
||||
? -100
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 : -1)
|
||||
: 0;
|
||||
increment = CHECK_BTN_ANY(dpad, BTN_DRIGHT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? 1000
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_A) ? 100
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10
|
||||
: 1)
|
||||
: CHECK_BTN_ANY(dpad, BTN_DLEFT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? -1000
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_A) ? -100
|
||||
: CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10
|
||||
: -1)
|
||||
: 0;
|
||||
|
||||
gGameInfo->data[gGameInfo->regCur + regGroup] += increment;
|
||||
if (CHECK_BTN_ANY(dpad, BTN_DUP)) {
|
||||
|
||||
@@ -97,7 +97,7 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte
|
||||
|
||||
gSPSetLights1(POLY_XLU_DISP++, sDebugObjectLights);
|
||||
|
||||
func_800D1694(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
|
||||
Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
|
||||
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228),
|
||||
|
||||
+18
-18
@@ -227,14 +227,14 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
|
||||
switch (cmd->base) {
|
||||
case 1:
|
||||
if (sp3F != 0) {
|
||||
func_800F6D58(0xE, 4, 0x3F);
|
||||
func_800F6D58(0xE, 1, 1);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, 0x3F);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1);
|
||||
globalCtx->envCtx.unk_EE[0] = 20;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sp3F != 0) {
|
||||
func_800F6D58(0xF, 0, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
|
||||
Environment_AddLightningBolts(globalCtx, 3);
|
||||
gLightningStrike.state = LIGHTNING_STRIKE_START;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
|
||||
}
|
||||
if (globalCtx->envCtx.unk_EE[1] == 0) {
|
||||
gWeatherMode = 0;
|
||||
func_800F6D58(14, 1, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
@@ -569,9 +569,9 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
} else {
|
||||
if (gSaveContext.sceneSetupIndex < 4) {
|
||||
if (!LINK_IS_ADULT) {
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
} else {
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
}
|
||||
}
|
||||
globalCtx->nextEntranceIndex = 0x02CA;
|
||||
@@ -670,7 +670,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
globalCtx->fadeTransition = 2;
|
||||
break;
|
||||
case 25:
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
globalCtx->nextEntranceIndex = 0x006B;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF0;
|
||||
@@ -714,7 +714,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
gSaveContext.chamberCutsceneNum = 2;
|
||||
break;
|
||||
case 32:
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x00CD;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF2;
|
||||
@@ -750,7 +750,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
globalCtx->fadeTransition = 4;
|
||||
break;
|
||||
case 40:
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
globalCtx->nextEntranceIndex = 0x0053;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFFA;
|
||||
@@ -827,7 +827,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
case 54:
|
||||
gSaveContext.gameMode = 3;
|
||||
Audio_SetSoundBanksMute(0x6F);
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0117;
|
||||
gSaveContext.cutsceneIndex = 0xFFF2;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
@@ -876,7 +876,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
globalCtx->fadeTransition = 2;
|
||||
break;
|
||||
case 62:
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
globalCtx->nextEntranceIndex = 0x00EE;
|
||||
gSaveContext.cutsceneIndex = 0xFFF6;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
@@ -895,7 +895,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
globalCtx->fadeTransition = 2;
|
||||
break;
|
||||
case 65:
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0157;
|
||||
gSaveContext.cutsceneIndex = 0xFFF2;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
@@ -934,7 +934,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
Player_SetEquipmentData(globalCtx, player);
|
||||
gSaveContext.equips.equipment |= 0x1000;
|
||||
Player_SetEquipmentData(globalCtx, player);
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0053;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF1;
|
||||
@@ -948,7 +948,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
gSaveContext.nextTransition = 2;
|
||||
break;
|
||||
case 73:
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0157;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF2;
|
||||
@@ -962,21 +962,21 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
gSaveContext.nextTransition = 3;
|
||||
break;
|
||||
case 75:
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0157;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF4;
|
||||
globalCtx->fadeTransition = 2;
|
||||
break;
|
||||
case 76:
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
globalCtx->nextEntranceIndex = 0x0157;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF5;
|
||||
globalCtx->fadeTransition = 2;
|
||||
break;
|
||||
case 77:
|
||||
globalCtx->linkAgeOnLoad = 1;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
globalCtx->nextEntranceIndex = 0x0157;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.cutsceneIndex = 0xFFF6;
|
||||
@@ -1207,7 +1207,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
|
||||
case 117:
|
||||
gSaveContext.gameMode = 3;
|
||||
Audio_SetSoundBanksMute(0x6F);
|
||||
globalCtx->linkAgeOnLoad = 0;
|
||||
globalCtx->linkAgeOnLoad = LINK_AGE_ADULT;
|
||||
globalCtx->nextEntranceIndex = 0x00CD;
|
||||
gSaveContext.cutsceneIndex = 0xFFF7;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
|
||||
+3
-3
@@ -422,7 +422,7 @@ void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) {
|
||||
1 * -(globalCtx->state.frames * 8), 16, 32));
|
||||
Matrix_Push();
|
||||
Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY);
|
||||
func_800D1FD4(&globalCtx->billboardMtxF);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
|
||||
@@ -450,7 +450,7 @@ void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) {
|
||||
0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1),
|
||||
1 * -(globalCtx->state.frames * 6), 16, 32));
|
||||
Matrix_Push();
|
||||
func_800D1FD4(&globalCtx->billboardMtxF);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
|
||||
@@ -479,7 +479,7 @@ void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) {
|
||||
0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1),
|
||||
1 * -(globalCtx->state.frames * 6), 32, 32));
|
||||
Matrix_Push();
|
||||
func_800D1FD4(&globalCtx->billboardMtxF);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
|
||||
|
||||
@@ -48,7 +48,7 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
||||
Math_Vec3f_Scale(&sp154, scale);
|
||||
|
||||
SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z);
|
||||
func_800A7EC0(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
|
||||
SkinMatrix_SetRotateAxis(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
|
||||
SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90);
|
||||
SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z);
|
||||
SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50);
|
||||
@@ -804,7 +804,7 @@ void EffectBlure_DrawSimpleVertices(GraphicsContext* gfxCtx, EffectBlure* this,
|
||||
Math_Vec3f_Scale(&sp198, scale);
|
||||
|
||||
SkinMatrix_SetTranslate(&sp154, sp1B0.x, sp1B0.y, sp1B0.z);
|
||||
func_800A7EC0(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z);
|
||||
SkinMatrix_SetRotateAxis(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z);
|
||||
SkinMatrix_MtxFMtxFMult(&sp154, &sp114, &spD4);
|
||||
SkinMatrix_SetTranslate(&sp154, -sp1B0.x, -sp1B0.y, -sp1B0.z);
|
||||
SkinMatrix_MtxFMtxFMult(&spD4, &sp154, &sp94);
|
||||
|
||||
@@ -252,7 +252,7 @@ void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f
|
||||
initParams.envColor = *envColor;
|
||||
initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life));
|
||||
|
||||
EffectSs_Spawn(globalCtx, 1, 128, &initParams);
|
||||
EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams);
|
||||
}
|
||||
|
||||
void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
|
||||
@@ -271,7 +271,7 @@ void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f*
|
||||
Color_RGBA8_Copy(&initParams.envColor, envColor);
|
||||
initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life));
|
||||
|
||||
EffectSs_Spawn(globalCtx, 1, 128, &initParams);
|
||||
EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams);
|
||||
}
|
||||
|
||||
// EffectSsBomb Spawn Functions
|
||||
@@ -833,7 +833,7 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec
|
||||
Math_Vec3f_Copy(&initParams.accel, accel);
|
||||
initParams.scale = scale;
|
||||
initParams.life = life;
|
||||
EffectSs_Spawn(globalCtx, 0x1A, 0x80, &initParams);
|
||||
EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams);
|
||||
}
|
||||
|
||||
void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) {
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#include "vt.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((EnAObj*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -87,7 +85,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) {
|
||||
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad;
|
||||
EnAObj* this = THIS;
|
||||
EnAObj* this = (EnAObj*)thisx;
|
||||
f32 shadowScale = 6.0f;
|
||||
|
||||
this->textId = (thisx->params >> 8) & 0xFF;
|
||||
@@ -142,7 +140,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
break;
|
||||
case A_OBJ_UNKNOWN_6:
|
||||
// clang-format off
|
||||
thisx->flags |= 0x1; this->dyna.bgId = 5; this->focusYoffset = 10.0f;
|
||||
thisx->flags |= ACTOR_FLAG_0; this->dyna.bgId = 5; this->focusYoffset = 10.0f;
|
||||
// clang-format on
|
||||
thisx->gravity = -2.0f;
|
||||
EnAObj_SetupWaitTalk(this, thisx->params);
|
||||
@@ -156,7 +154,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
case A_OBJ_SIGNPOST_ARROW:
|
||||
thisx->textId = (this->textId & 0xFF) | 0x300;
|
||||
// clang-format off
|
||||
thisx->flags |= 0x1 | 0x8; thisx->targetArrowOffset = 500.0f;
|
||||
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; thisx->targetArrowOffset = 500.0f;
|
||||
// clang-format on
|
||||
this->focusYoffset = 45.0f;
|
||||
EnAObj_SetupWaitTalk(this, thisx->params);
|
||||
@@ -186,7 +184,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnAObj* this = THIS;
|
||||
EnAObj* this = (EnAObj*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
|
||||
@@ -320,7 +318,7 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnAObj* this = THIS;
|
||||
EnAObj* this = (EnAObj*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
|
||||
+8
-10
@@ -3,9 +3,7 @@
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
#define THIS ((EnItem00*)thisx)
|
||||
#define FLAGS 0
|
||||
|
||||
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -331,7 +329,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnItem00* this = THIS;
|
||||
EnItem00* this = (EnItem00*)thisx;
|
||||
s32 pad;
|
||||
f32 yOffset = 980.0f;
|
||||
f32 shadowScale = 6.0f;
|
||||
@@ -553,7 +551,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnItem00* this = THIS;
|
||||
EnItem00* this = (EnItem00*)thisx;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
@@ -729,7 +727,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s16 sp3A = 0;
|
||||
s16 i;
|
||||
u32* temp;
|
||||
EnItem00* this = THIS;
|
||||
EnItem00* this = (EnItem00*)thisx;
|
||||
s32 pad;
|
||||
|
||||
if (this->unk_15A > 0) {
|
||||
@@ -933,7 +931,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnItem00* this = THIS;
|
||||
EnItem00* this = (EnItem00*)thisx;
|
||||
f32 mtxScale;
|
||||
|
||||
if (!(this->unk_156 & this->unk_158)) {
|
||||
@@ -1168,7 +1166,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
|
||||
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
|
||||
spawnedActor->actor.room = -1;
|
||||
}
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
spawnedActor->actor.flags |= ACTOR_FLAG_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1200,7 +1198,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
|
||||
spawnedActor->actor.speedXZ = 0.0f;
|
||||
spawnedActor->actor.gravity = param4000 ? 0.0f : -0.9f;
|
||||
spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
spawnedActor->actor.flags |= ACTOR_FLAG_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1312,7 +1310,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
|
||||
spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f;
|
||||
Actor_SetScale(&spawnedActor->actor, 0.0f);
|
||||
EnItem00_SetupAction(spawnedActor, func_8001E304);
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
spawnedActor->actor.flags |= ACTOR_FLAG_4;
|
||||
if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) &&
|
||||
(spawnedActor->actor.params != ITEM00_HEART_PIECE) &&
|
||||
(spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) {
|
||||
|
||||
@@ -34,10 +34,8 @@ Gfx sCircleDList[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#define THIS ((TransitionCircle*)thisx)
|
||||
|
||||
void TransitionCircle_Start(void* thisx) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
this->isDone = 0;
|
||||
|
||||
@@ -92,7 +90,7 @@ void TransitionCircle_Start(void* thisx) {
|
||||
}
|
||||
|
||||
void* TransitionCircle_Init(void* thisx) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
bzero(this, sizeof(*this));
|
||||
return this;
|
||||
@@ -102,7 +100,7 @@ void TransitionCircle_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
void TransitionCircle_Update(void* thisx, s32 updateRate) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
s32 temp_t2;
|
||||
s32 temp_t3;
|
||||
|
||||
@@ -136,7 +134,7 @@ void TransitionCircle_Update(void* thisx, s32 updateRate) {
|
||||
void TransitionCircle_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView;
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
Gfx* texScroll;
|
||||
// These variables are a best guess based on the other transition types.
|
||||
f32 tPos = 0.0f;
|
||||
@@ -176,13 +174,13 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) {
|
||||
}
|
||||
|
||||
s32 TransitionCircle_IsDone(void* thisx) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
return this->isDone;
|
||||
}
|
||||
|
||||
void TransitionCircle_SetType(void* thisx, s32 type) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
if (type & 0x80) {
|
||||
this->unk_14 = (type >> 5) & 0x1;
|
||||
@@ -197,13 +195,13 @@ void TransitionCircle_SetType(void* thisx, s32 type) {
|
||||
}
|
||||
|
||||
void TransitionCircle_SetColor(void* thisx, u32 color) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionCircle_SetEnvColor(void* thisx, u32 envColor) {
|
||||
TransitionCircle* this = THIS;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
this->envColor.rgba = envColor;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,8 @@ static Gfx sRCPSetupFade[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#define THIS ((TransitionFade*)thisx)
|
||||
|
||||
void TransitionFade_Start(void* thisx) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
switch (this->fadeType) {
|
||||
case 0:
|
||||
@@ -32,7 +30,7 @@ void TransitionFade_Start(void* thisx) {
|
||||
}
|
||||
|
||||
void* TransitionFade_Init(void* thisx) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
bzero(this, sizeof(*this));
|
||||
return this;
|
||||
@@ -44,7 +42,7 @@ void TransitionFade_Destroy(void* thisx) {
|
||||
void TransitionFade_Update(void* thisx, s32 updateRate) {
|
||||
s32 alpha;
|
||||
s16 newAlpha;
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
switch (this->fadeType) {
|
||||
case 0:
|
||||
@@ -84,7 +82,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) {
|
||||
}
|
||||
|
||||
void TransitionFade_Draw(void* thisx, Gfx** gfxP) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
Gfx* gfx;
|
||||
Color_RGBA8_u32* color = &this->fadeColor;
|
||||
|
||||
@@ -99,19 +97,19 @@ void TransitionFade_Draw(void* thisx, Gfx** gfxP) {
|
||||
}
|
||||
|
||||
s32 TransitionFade_IsDone(void* thisx) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
return this->isDone;
|
||||
}
|
||||
|
||||
void TransitionFade_SetColor(void* thisx, u32 color) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
this->fadeColor.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionFade_SetType(void* thisx, s32 type) {
|
||||
TransitionFade* this = THIS;
|
||||
TransitionFade* this = (TransitionFade*)thisx;
|
||||
|
||||
if (type == 1) {
|
||||
this->fadeType = 1;
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
#include "code/fbdemo_triforce/z_fbdemo_triforce.c"
|
||||
|
||||
#define THIS ((TransitionTriforce*)thisx)
|
||||
|
||||
void TransitionTriforce_Start(void* thisx) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
switch (this->state) {
|
||||
case 1:
|
||||
@@ -17,7 +15,7 @@ void TransitionTriforce_Start(void* thisx) {
|
||||
}
|
||||
|
||||
void* TransitionTriforce_Init(void* thisx) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
bzero(this, sizeof(*this));
|
||||
guOrtho(&this->projection, -160.0f, 160.0f, -120.0f, 120.0f, -1000.0f, 1000.0f, 1.0f);
|
||||
@@ -32,7 +30,7 @@ void TransitionTriforce_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
void TransitionTriforce_Update(void* thisx, s32 updateRate) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
f32 temp_f0;
|
||||
s32 i;
|
||||
|
||||
@@ -50,20 +48,20 @@ void TransitionTriforce_Update(void* thisx, s32 updateRate) {
|
||||
}
|
||||
|
||||
void TransitionTriforce_SetColor(void* thisx, u32 color) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionTriforce_SetType(void* thisx, s32 type) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
this->fadeDirection = type;
|
||||
}
|
||||
|
||||
// unused
|
||||
void TransitionTriforce_SetState(void* thisx, s32 state) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
this->state = state;
|
||||
}
|
||||
@@ -72,7 +70,7 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView;
|
||||
f32 scale;
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
s32 pad;
|
||||
f32 rotation = this->transPos * 360.0f;
|
||||
|
||||
@@ -119,7 +117,7 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) {
|
||||
}
|
||||
|
||||
s32 TransitionTriforce_IsDone(void* thisx) {
|
||||
TransitionTriforce* this = THIS;
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
s32 ret = 0;
|
||||
|
||||
|
||||
@@ -36,10 +36,8 @@ Gfx sWipeSyncDList[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#define THIS ((TransitionWipe*)thisx)
|
||||
|
||||
void TransitionWipe_Start(void* thisx) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
this->isDone = 0;
|
||||
|
||||
@@ -54,7 +52,7 @@ void TransitionWipe_Start(void* thisx) {
|
||||
}
|
||||
|
||||
void* TransitionWipe_Init(void* thisx) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
bzero(this, sizeof(*this));
|
||||
return this;
|
||||
@@ -64,7 +62,7 @@ void TransitionWipe_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
void TransitionWipe_Update(void* thisx, s32 updateRate) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
u8 unk1419;
|
||||
|
||||
if (this->direction != 0) {
|
||||
@@ -87,7 +85,7 @@ void TransitionWipe_Update(void* thisx, s32 updateRate) {
|
||||
void TransitionWipe_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView;
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
s32 pad[4];
|
||||
Gfx* tex;
|
||||
|
||||
@@ -113,13 +111,13 @@ void TransitionWipe_Draw(void* thisx, Gfx** gfxP) {
|
||||
}
|
||||
|
||||
s32 TransitionWipe_IsDone(void* thisx) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
return this->isDone;
|
||||
}
|
||||
|
||||
void TransitionWipe_SetType(void* thisx, s32 type) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
if (type == 1) {
|
||||
this->direction = 1;
|
||||
@@ -135,13 +133,13 @@ void TransitionWipe_SetType(void* thisx, s32 type) {
|
||||
}
|
||||
|
||||
void TransitionWipe_SetColor(void* thisx, u32 color) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionWipe_SetEnvColor(void* thisx, u32 color) {
|
||||
TransitionWipe* this = THIS;
|
||||
TransitionWipe* this = (TransitionWipe*)thisx;
|
||||
|
||||
this->envColor.rgba = color;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
|
||||
gSaveContext.nayrusLoveTimer = 2000;
|
||||
gSaveContext.naviTimer = 0;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.natureAmbienceId = 0xFF;
|
||||
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
||||
gSaveContext.eventInf[0] = 0;
|
||||
gSaveContext.eventInf[1] = 0;
|
||||
gSaveContext.eventInf[2] = 0;
|
||||
|
||||
+34
-30
@@ -238,9 +238,9 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32
|
||||
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
|
||||
|
||||
if (((void)0, gSaveContext.dayTime) > 0xC000 || ((void)0, gSaveContext.dayTime) < 0x4555) {
|
||||
((void)0, gSaveContext.nightFlag = true);
|
||||
((void)0, gSaveContext.nightFlag = 1);
|
||||
} else {
|
||||
((void)0, gSaveContext.nightFlag = false);
|
||||
((void)0, gSaveContext.nightFlag = 0);
|
||||
}
|
||||
|
||||
globalCtx->state.gfxCtx->callback = Environment_GraphCallback;
|
||||
@@ -820,7 +820,7 @@ void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) {
|
||||
GfxPrint_SetColor(&printer, 55, 255, 255, 64);
|
||||
GfxPrint_SetPos(&printer, 22, 6);
|
||||
|
||||
if (gSaveContext.nightFlag) {
|
||||
if (!IS_DAY) {
|
||||
GfxPrint_Printf(&printer, "%s", "YORU"); // "night"
|
||||
} else {
|
||||
GfxPrint_Printf(&printer, "%s", "HIRU"); // "day"
|
||||
@@ -881,7 +881,7 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li
|
||||
if ((envCtx->unk_1A == 0) && !FrameAdvance_IsEnabled(globalCtx) &&
|
||||
(globalCtx->transitionMode == 0 || ((void)0, gSaveContext.gameMode) != 0)) {
|
||||
|
||||
if (!((void)0, gSaveContext.nightFlag) || gTimeIncrement >= 0x190) {
|
||||
if (IS_DAY || gTimeIncrement >= 0x190) {
|
||||
gSaveContext.dayTime += gTimeIncrement;
|
||||
} else {
|
||||
gSaveContext.dayTime += gTimeIncrement * 2; // time moves twice as fast at night
|
||||
@@ -900,9 +900,9 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li
|
||||
time = gSaveContext.dayTime;
|
||||
|
||||
if (time > 0xC000 || time < 0x4555) {
|
||||
gSaveContext.nightFlag = true;
|
||||
gSaveContext.nightFlag = 1;
|
||||
} else {
|
||||
gSaveContext.nightFlag = false;
|
||||
gSaveContext.nightFlag = 0;
|
||||
}
|
||||
|
||||
if (SREG(0) != 0 || CREG(2) != 0) {
|
||||
@@ -1778,7 +1778,7 @@ void Environment_UpdateLightningStrike(GlobalContext* globalCtx) {
|
||||
sLightningFlashAlpha += 100;
|
||||
|
||||
if (sLightningFlashAlpha >= gLightningStrike.flashAlphaTarget) {
|
||||
func_800F6D58(15, 0, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
|
||||
gLightningStrike.state++;
|
||||
gLightningStrike.flashAlphaTarget = 0;
|
||||
}
|
||||
@@ -1916,25 +1916,25 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kankyo.c", 3353);
|
||||
}
|
||||
|
||||
void func_800758AC(GlobalContext* globalCtx) {
|
||||
void Environment_PlaySceneSequence(GlobalContext* globalCtx) {
|
||||
globalCtx->envCtx.unk_E0 = 0xFF;
|
||||
|
||||
// both lost woods exits on the bridge from kokiri to hyrule field
|
||||
if (((void)0, gSaveContext.entranceIndex) == 0x4DE || ((void)0, gSaveContext.entranceIndex) == 0x5E0) {
|
||||
func_800F6FB4(4);
|
||||
Audio_PlayNatureAmbienceSequence(NATURE_ID_KOKIRI_REGION);
|
||||
} else if (((void)0, gSaveContext.forcedSeqId) != NA_BGM_GENERAL_SFX) {
|
||||
if (!Environment_IsForcedSequenceDisabled()) {
|
||||
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId));
|
||||
}
|
||||
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
|
||||
} else if (globalCtx->sequenceCtx.seqId == NA_BGM_NO_MUSIC) {
|
||||
if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) {
|
||||
if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) {
|
||||
return;
|
||||
}
|
||||
if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) {
|
||||
func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
}
|
||||
} else if (globalCtx->sequenceCtx.natureAmbienceId == 0x13) {
|
||||
} else if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) {
|
||||
// "BGM Configuration"
|
||||
osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", globalCtx->sequenceCtx.seqId,
|
||||
((void)0, gSaveContext.seqId));
|
||||
@@ -1949,7 +1949,7 @@ void func_800758AC(GlobalContext* globalCtx) {
|
||||
globalCtx->envCtx.unk_E0 = 1;
|
||||
} else {
|
||||
if (((void)0, gSaveContext.natureAmbienceId) != globalCtx->sequenceCtx.natureAmbienceId) {
|
||||
func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
}
|
||||
|
||||
if (((void)0, gSaveContext.dayTime) > 0xB71C && ((void)0, gSaveContext.dayTime) < 0xCAAC) {
|
||||
@@ -1974,7 +1974,8 @@ void func_800758AC(GlobalContext* globalCtx) {
|
||||
void func_80075B44(GlobalContext* globalCtx) {
|
||||
switch (globalCtx->envCtx.unk_E0) {
|
||||
case 0:
|
||||
func_800F6D58(86, 1, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
||||
CHANNEL_IO_PORT_1, 0);
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
||||
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
|
||||
func_800F5510(globalCtx->sequenceCtx.seqId);
|
||||
@@ -1997,8 +1998,8 @@ void func_80075B44(GlobalContext* globalCtx) {
|
||||
break;
|
||||
case 3:
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
||||
func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
func_800F6D58(1, 1, 1);
|
||||
Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 1);
|
||||
}
|
||||
globalCtx->envCtx.unk_E0++;
|
||||
break;
|
||||
@@ -2008,9 +2009,10 @@ void func_80075B44(GlobalContext* globalCtx) {
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
func_800F6D58(1, 1, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_1, 0);
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
||||
func_800F6D58(36, 1, 1);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3,
|
||||
CHANNEL_IO_PORT_1, 1);
|
||||
}
|
||||
globalCtx->envCtx.unk_E0++;
|
||||
break;
|
||||
@@ -2029,9 +2031,11 @@ void func_80075B44(GlobalContext* globalCtx) {
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
func_800F6D58(36, 1, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3,
|
||||
CHANNEL_IO_PORT_1, 0);
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
||||
func_800F6D58(86, 1, 1);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
||||
CHANNEL_IO_PORT_1, 1);
|
||||
}
|
||||
globalCtx->envCtx.unk_E0++;
|
||||
break;
|
||||
@@ -2404,24 +2408,24 @@ s32 Environment_IsForcedSequenceDisabled(void) {
|
||||
return isDisabled;
|
||||
}
|
||||
|
||||
void func_80077624(GlobalContext* globalCtx) {
|
||||
if (globalCtx->sequenceCtx.natureAmbienceId == 19) {
|
||||
func_800F6FB4(5);
|
||||
void Environment_PlayStormNatureAmbience(GlobalContext* globalCtx) {
|
||||
if (globalCtx->sequenceCtx.natureAmbienceId == NATURE_ID_NONE) {
|
||||
Audio_PlayNatureAmbienceSequence(NATURE_ID_MARKET_NIGHT);
|
||||
} else {
|
||||
func_800F6FB4(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
Audio_PlayNatureAmbienceSequence(globalCtx->sequenceCtx.natureAmbienceId);
|
||||
}
|
||||
|
||||
func_800F6D58(14, 1, 1);
|
||||
func_800F6D58(15, 1, 1);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 1);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 1);
|
||||
}
|
||||
|
||||
void func_80077684(GlobalContext* globalCtx) {
|
||||
func_800F6D58(14, 1, 0);
|
||||
func_800F6D58(15, 1, 0);
|
||||
void Environment_StopStormNatureAmbience(GlobalContext* globalCtx) {
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0);
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0);
|
||||
|
||||
if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
|
||||
gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN;
|
||||
func_800758AC(globalCtx);
|
||||
Environment_PlaySceneSequence(globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+69
-63
@@ -116,8 +116,8 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
|
||||
|
||||
interfaceCtx->unk_228 = 0x140;
|
||||
interfaceCtx->unk_226 = gSaveContext.health;
|
||||
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
|
||||
interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0;
|
||||
interfaceCtx->beatingHeartOscillator = interfaceCtx->heartColorOscillator = 0;
|
||||
interfaceCtx->beatingHeartOscillatorDirection = interfaceCtx->heartColorOscillatorDirection = 0;
|
||||
|
||||
interfaceCtx->heartsPrimR[0] = HEARTS_PRIM_R;
|
||||
interfaceCtx->heartsPrimG[0] = HEARTS_PRIM_G;
|
||||
@@ -146,7 +146,7 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
|
||||
|
||||
void HealthMeter_Update(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
f32 factor = interfaceCtx->unk_1FE * 0.1f;
|
||||
f32 factor = interfaceCtx->heartColorOscillator * 0.1f;
|
||||
f32 ddFactor;
|
||||
s32 type = 0;
|
||||
s32 ddType;
|
||||
@@ -156,17 +156,17 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
|
||||
|
||||
if (interfaceCtx) {}
|
||||
|
||||
if (interfaceCtx->unk_200 != 0) {
|
||||
interfaceCtx->unk_1FE--;
|
||||
if (interfaceCtx->unk_1FE <= 0) {
|
||||
interfaceCtx->unk_1FE = 0;
|
||||
interfaceCtx->unk_200 = 0;
|
||||
if (interfaceCtx->heartColorOscillatorDirection != 0) {
|
||||
interfaceCtx->heartColorOscillator--;
|
||||
if (interfaceCtx->heartColorOscillator <= 0) {
|
||||
interfaceCtx->heartColorOscillator = 0;
|
||||
interfaceCtx->heartColorOscillatorDirection = 0;
|
||||
}
|
||||
} else {
|
||||
interfaceCtx->unk_1FE++;
|
||||
if (interfaceCtx->unk_1FE >= 10) {
|
||||
interfaceCtx->unk_1FE = 10;
|
||||
interfaceCtx->unk_200 = 1;
|
||||
interfaceCtx->heartColorOscillator++;
|
||||
if (interfaceCtx->heartColorOscillator >= 10) {
|
||||
interfaceCtx->heartColorOscillator = 10;
|
||||
interfaceCtx->heartColorOscillatorDirection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,11 +240,13 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
|
||||
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HEARTS_DD_ENV_B) & 0xFF;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 func_80078E18(GlobalContext* globalCtx) {
|
||||
gSaveContext.health = globalCtx->interfaceCtx.unk_226;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 func_80078E34(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
||||
@@ -259,6 +261,7 @@ s32 func_80078E34(GlobalContext* globalCtx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 func_80078E84(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
||||
@@ -298,19 +301,19 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
u32 curColorSet;
|
||||
f32 offsetX;
|
||||
f32 offsetY;
|
||||
s32 i;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
s32 heartIndex;
|
||||
f32 halfHeartLength;
|
||||
f32 heartCenterX;
|
||||
f32 heartCenterY;
|
||||
f32 heartTexCoordPerPixel;
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
Vtx* sp154 = interfaceCtx->beatingHeartVtx;
|
||||
Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx;
|
||||
s32 curHeartFraction = gSaveContext.health % 0x10;
|
||||
s16 totalHeartCount = gSaveContext.healthCapacity / 0x10;
|
||||
s16 fullHeartCount = gSaveContext.health / 0x10;
|
||||
s32 pad2;
|
||||
f32 sp144 = interfaceCtx->unk_22A * 0.1f;
|
||||
f32 beatingHeartPulsingSize = interfaceCtx->beatingHeartOscillator * 0.1f;
|
||||
s32 curCombineModeSet = 0;
|
||||
u8* curBgImgLoaded = NULL;
|
||||
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
|
||||
@@ -325,9 +328,9 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
offsetY = 0.0f;
|
||||
offsetX = 0.0f;
|
||||
|
||||
for (i = 0; i < totalHeartCount; i++) {
|
||||
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
||||
if (i < fullHeartCount) {
|
||||
for (heartIndex = 0; heartIndex < totalHeartCount; heartIndex++) {
|
||||
if ((ddHeartCountMinusOne < 0) || (heartIndex > ddHeartCountMinusOne)) {
|
||||
if (heartIndex < fullHeartCount) {
|
||||
if (curColorSet != 0) {
|
||||
curColorSet = 0;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -336,7 +339,7 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->heartsEnvR[0], interfaceCtx->heartsEnvG[0],
|
||||
interfaceCtx->heartsEnvB[0], 255);
|
||||
}
|
||||
} else if (i == fullHeartCount) {
|
||||
} else if (heartIndex == fullHeartCount) {
|
||||
if (curColorSet != 1) {
|
||||
curColorSet = 1;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -346,7 +349,7 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
gDPSetEnvColor(OVERLAY_DISP++, interfaceCtx->beatingHeartEnv[0], interfaceCtx->beatingHeartEnv[1],
|
||||
interfaceCtx->beatingHeartEnv[2], 255);
|
||||
}
|
||||
} else if (i > fullHeartCount) {
|
||||
} else if (heartIndex > fullHeartCount) {
|
||||
if (curColorSet != 2) {
|
||||
curColorSet = 2;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -366,15 +369,15 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
if (i < fullHeartCount) {
|
||||
if (heartIndex < fullHeartCount) {
|
||||
heartBgImg = gHeartFullTex;
|
||||
} else if (i == fullHeartCount) {
|
||||
} else if (heartIndex == fullHeartCount) {
|
||||
heartBgImg = sHeartTextures[curHeartFraction];
|
||||
} else {
|
||||
heartBgImg = gHeartEmptyTex;
|
||||
}
|
||||
} else {
|
||||
if (i < fullHeartCount) {
|
||||
if (heartIndex < fullHeartCount) {
|
||||
if (curColorSet != 4) {
|
||||
curColorSet = 4;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -382,7 +385,7 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
interfaceCtx->healthAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, sHeartsDDEnv[0][0], sHeartsDDEnv[0][1], sHeartsDDEnv[0][2], 255);
|
||||
}
|
||||
} else if (i == fullHeartCount) {
|
||||
} else if (heartIndex == fullHeartCount) {
|
||||
if (curColorSet != 5) {
|
||||
curColorSet = 5;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -391,7 +394,7 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
gDPSetEnvColor(OVERLAY_DISP++, sBeatingHeartsDDEnv[0], sBeatingHeartsDDEnv[1],
|
||||
sBeatingHeartsDDEnv[2], 255);
|
||||
}
|
||||
} else if (i > fullHeartCount) {
|
||||
} else if (heartIndex > fullHeartCount) {
|
||||
if (curColorSet != 6) {
|
||||
curColorSet = 6;
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -409,9 +412,9 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
if (i < fullHeartCount) {
|
||||
if (heartIndex < fullHeartCount) {
|
||||
heartBgImg = gDefenseHeartFullTex;
|
||||
} else if (i == fullHeartCount) {
|
||||
} else if (heartIndex == fullHeartCount) {
|
||||
heartBgImg = sHeartDDTextures[curHeartFraction];
|
||||
} else {
|
||||
heartBgImg = gDefenseHeartEmptyTex;
|
||||
@@ -425,8 +428,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
}
|
||||
|
||||
if (i != fullHeartCount) {
|
||||
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
||||
if (heartIndex != fullHeartCount) {
|
||||
if ((ddHeartCountMinusOne < 0) || (heartIndex > ddHeartCountMinusOne)) {
|
||||
if (curCombineModeSet != 1) {
|
||||
curCombineModeSet = 1;
|
||||
func_80094520(gfxCtx);
|
||||
@@ -442,18 +445,18 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
temp3 = 26.0f + offsetY;
|
||||
temp2 = 30.0f + offsetX;
|
||||
temp4 = 1.0f;
|
||||
temp4 /= 0.68f;
|
||||
temp4 *= 1 << 10;
|
||||
temp1 = 8.0f;
|
||||
temp1 *= 0.68f;
|
||||
gSPTextureRectangle(OVERLAY_DISP++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4),
|
||||
(s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0,
|
||||
(s32)temp4, (s32)temp4);
|
||||
heartCenterY = 26.0f + offsetY;
|
||||
heartCenterX = 30.0f + offsetX;
|
||||
heartTexCoordPerPixel = 1.0f;
|
||||
heartTexCoordPerPixel /= 0.68f;
|
||||
heartTexCoordPerPixel *= 1 << 10;
|
||||
halfHeartLength = 8.0f;
|
||||
halfHeartLength *= 0.68f;
|
||||
gSPTextureRectangle(OVERLAY_DISP++, (s32)((heartCenterX - halfHeartLength) * 4), (s32)((heartCenterY - halfHeartLength) * 4),
|
||||
(s32)((heartCenterX + halfHeartLength) * 4), (s32)((heartCenterY + halfHeartLength) * 4), G_TX_RENDERTILE, 0, 0,
|
||||
(s32)heartTexCoordPerPixel, (s32)heartTexCoordPerPixel);
|
||||
} else {
|
||||
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
|
||||
if ((ddHeartCountMinusOne < 0) || (heartIndex > ddHeartCountMinusOne)) {
|
||||
if (curCombineModeSet != 2) {
|
||||
curCombineModeSet = 2;
|
||||
func_80094A14(gfxCtx);
|
||||
@@ -471,16 +474,19 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
|
||||
{
|
||||
Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144),
|
||||
Matrix_SetTranslateScaleMtx2(matrix, 1.0f - (0.32f * beatingHeartPulsingSize), 1.0f - (0.32f * beatingHeartPulsingSize), 1.0f - (0.32f * beatingHeartPulsingSize),
|
||||
-130.0f + offsetX, 94.5f - offsetY, 0.0f);
|
||||
gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPVertex(OVERLAY_DISP++, sp154, 4, 0);
|
||||
gSPVertex(OVERLAY_DISP++, beatingHeartVtx, 4, 0);
|
||||
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Move offset to next heart
|
||||
offsetX += 10.0f;
|
||||
if (i == 9) {
|
||||
|
||||
// Go down one line after 10 hearts
|
||||
if (heartIndex == 9) {
|
||||
offsetY += 10.0f;
|
||||
offsetX = 0.0f;
|
||||
}
|
||||
@@ -489,42 +495,42 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
||||
CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606);
|
||||
}
|
||||
|
||||
void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) {
|
||||
void HealthMeter_UpdateBeatingHeart(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
||||
if (interfaceCtx->unk_22C != 0) {
|
||||
interfaceCtx->unk_22A--;
|
||||
if (interfaceCtx->unk_22A <= 0) {
|
||||
interfaceCtx->unk_22A = 0;
|
||||
interfaceCtx->unk_22C = 0;
|
||||
if (interfaceCtx->beatingHeartOscillatorDirection != 0) {
|
||||
interfaceCtx->beatingHeartOscillator--;
|
||||
if (interfaceCtx->beatingHeartOscillator <= 0) {
|
||||
interfaceCtx->beatingHeartOscillator = 0;
|
||||
interfaceCtx->beatingHeartOscillatorDirection = 0;
|
||||
if (!Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) &&
|
||||
(globalCtx->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) {
|
||||
func_80078884(NA_SE_SY_HITPOINT_ALARM);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
interfaceCtx->unk_22A++;
|
||||
if (interfaceCtx->unk_22A >= 10) {
|
||||
interfaceCtx->unk_22A = 10;
|
||||
interfaceCtx->unk_22C = 1;
|
||||
interfaceCtx->beatingHeartOscillator++;
|
||||
if (interfaceCtx->beatingHeartOscillator >= 10) {
|
||||
interfaceCtx->beatingHeartOscillator = 10;
|
||||
interfaceCtx->beatingHeartOscillatorDirection = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 HealthMeter_IsCritical(void) {
|
||||
s32 var;
|
||||
s32 criticalHealth;
|
||||
|
||||
if (gSaveContext.healthCapacity <= 0x50) {
|
||||
var = 0x10;
|
||||
criticalHealth = 0x10;
|
||||
} else if (gSaveContext.healthCapacity <= 0xA0) {
|
||||
var = 0x18;
|
||||
criticalHealth = 0x18;
|
||||
} else if (gSaveContext.healthCapacity <= 0xF0) {
|
||||
var = 0x20;
|
||||
criticalHealth = 0x20;
|
||||
} else {
|
||||
var = 0x2C;
|
||||
criticalHealth = 0x2C;
|
||||
}
|
||||
|
||||
if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) {
|
||||
if ((criticalHealth >= gSaveContext.health) && (gSaveContext.health > 0)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
+5
-5
@@ -321,7 +321,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
|
||||
LightPoint* params;
|
||||
Vec3f pos;
|
||||
Vec3f multDest;
|
||||
f32 wDest;
|
||||
f32 cappedInvWDest;
|
||||
f32 wX;
|
||||
f32 wY;
|
||||
s32 wZ;
|
||||
@@ -336,13 +336,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
|
||||
pos.x = params->x;
|
||||
pos.y = params->y;
|
||||
pos.z = params->z;
|
||||
func_8002BE04(globalCtx, &pos, &multDest, &wDest);
|
||||
Actor_ProjectPos(globalCtx, &pos, &multDest, &cappedInvWDest);
|
||||
params->drawGlow = false;
|
||||
wX = multDest.x * wDest;
|
||||
wY = multDest.y * wDest;
|
||||
wX = multDest.x * cappedInvWDest;
|
||||
wY = multDest.y * cappedInvWDest;
|
||||
|
||||
if ((multDest.z > 1.0f) && (fabsf(wX) < 1.0f) && (fabsf(wY) < 1.0f)) {
|
||||
wZ = (s32)((multDest.z * wDest) * 16352.0f) + 16352;
|
||||
wZ = (s32)((multDest.z * cappedInvWDest) * 16352.0f) + 16352;
|
||||
zBuf = gZBuffer[(s32)((wY * -120.0f) + 120.0f)][(s32)((wX * 160.0f) + 160.0f)] * 4;
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) {
|
||||
bzero(ret, n);
|
||||
}
|
||||
|
||||
ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保");
|
||||
ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保"); // "Secure"
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -302,15 +302,15 @@ static u8 sSwitchToRoom[10][51] = {
|
||||
|
||||
static u8 sFloorID[10][8] = {
|
||||
/* clang-format off */
|
||||
{ 0, 0, 0, F_3F, F_2F, F_1F, F_B1, F_B2 },
|
||||
{ 0, 0, 0, F_3F, F_2F, F_1F, F_B1, F_B2 },
|
||||
{ 0, 0, 0, 0, 0, 0, F_2F, F_1F },
|
||||
{ 0, 0, 0, 0, 0, 0, F_1F, F_B1 },
|
||||
{ 0, 0, 0, 0, 0, 0, F_1F, F_B1 },
|
||||
{ 0, 0, 0, 0, F_2F, F_1F, F_B1, F_B2 },
|
||||
{ 0, 0, 0, F_5F, F_4F, F_3F, F_2F, F_1F },
|
||||
{ 0, 0, 0, F_5F, F_4F, F_3F, F_2F, F_1F },
|
||||
{ 0, 0, 0, 0, F_3F, F_2F, F_1F, F_B1 },
|
||||
{ 0, 0, 0, 0, F_4F, F_3F, F_2F, F_1F },
|
||||
{ 0, 0, 0, 0, F_4F, F_3F, F_2F, F_1F },
|
||||
{ 0, 0, 0, 0, F_B1, F_B2, F_B3, F_B4 },
|
||||
{ 0, 0, 0, 0, 0, F_B1, F_B2, F_B3 },
|
||||
{ 0, 0, 0, 0, 0, F_B1, F_B2, F_B3 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, F_1F },
|
||||
}; /* clang-format on */
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ void MapMark_Init(GlobalContext* globalCtx) {
|
||||
Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
|
||||
|
||||
sLoadedMarkDataTable = gMapMarkDataTable;
|
||||
sLoadedMarkDataTable = (void*)(u32)(
|
||||
(overlay->vramTable != NULL)
|
||||
? (void*)((u32)overlay->vramTable - (s32)((u32)overlay->vramStart - (u32)overlay->loadedRamAddr))
|
||||
: NULL);
|
||||
sLoadedMarkDataTable = (void*)(u32)((overlay->vramTable != NULL)
|
||||
? (void*)((u32)overlay->vramTable -
|
||||
(s32)((u32)overlay->vramStart - (u32)overlay->loadedRamAddr))
|
||||
: NULL);
|
||||
}
|
||||
|
||||
void MapMark_ClearPointers(GlobalContext* globalCtx) {
|
||||
|
||||
@@ -769,7 +769,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
||||
|
||||
func_8002DF54(globalCtx, NULL, 8);
|
||||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
player->stateFlags1 |= 0x20000000;
|
||||
player->stateFlags1 |= PLAYER_STATE1_29;
|
||||
player->actor.freezeTimer = 90;
|
||||
|
||||
i = Quake_Add(csCam, 1);
|
||||
@@ -966,7 +966,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
||||
if (func_800C0CB8(globalCtx)) {
|
||||
D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f;
|
||||
|
||||
if (player->stateFlags1 & 0x08000000) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_27) {
|
||||
D_801231B4[2].atTargetInit.z = 0.0f;
|
||||
}
|
||||
Actor_GetWorldPosShapeRot(&spA0, &player->actor);
|
||||
@@ -1318,7 +1318,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) {
|
||||
|
||||
// If the previous attention cutscene has an actor in the same category, skip this actor.
|
||||
if (actor->category == vLastHigherCat) {
|
||||
osSyncPrintf("→ " VT_FGCOL(PURPLE) "×" VT_RST " (%d)\n", actor->id);
|
||||
osSyncPrintf("→ " VT_FGCOL(MAGENTA) "×" VT_RST " (%d)\n", actor->id);
|
||||
return SUBCAM_NONE;
|
||||
}
|
||||
osSyncPrintf("→ " VT_FGCOL(BLUE) "○" VT_RST " (%d)\n", actor->id);
|
||||
|
||||
+18
-18
@@ -612,7 +612,7 @@ void func_80083108(GlobalContext* globalCtx) {
|
||||
((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) {
|
||||
gSaveContext.unk_13E7 = 0;
|
||||
|
||||
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) ||
|
||||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
|
||||
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
|
||||
gSaveContext.unk_13E7 = 1;
|
||||
@@ -661,11 +661,11 @@ void func_80083108(GlobalContext* globalCtx) {
|
||||
Interface_ChangeAlpha(8);
|
||||
} else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) {
|
||||
Interface_ChangeAlpha(8);
|
||||
} else if (player->stateFlags1 & 0x00800000) {
|
||||
} else if (player->stateFlags1 & PLAYER_STATE1_23) {
|
||||
Interface_ChangeAlpha(12);
|
||||
}
|
||||
} else {
|
||||
if (player->stateFlags1 & 0x00800000) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_23) {
|
||||
Interface_ChangeAlpha(12);
|
||||
}
|
||||
}
|
||||
@@ -743,7 +743,7 @@ void func_80083108(GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
Interface_ChangeAlpha(50);
|
||||
} else if ((player->stateFlags1 & 0x00200000) || (player->stateFlags2 & 0x00040000)) {
|
||||
} else if ((player->stateFlags1 & PLAYER_STATE1_21) || (player->stateFlags2 & PLAYER_STATE2_18)) {
|
||||
if (gSaveContext.buttonStatus[0] != BTN_DISABLED) {
|
||||
gSaveContext.buttonStatus[0] = BTN_DISABLED;
|
||||
gSaveContext.buttonStatus[1] = BTN_DISABLED;
|
||||
@@ -753,7 +753,7 @@ void func_80083108(GlobalContext* globalCtx) {
|
||||
Interface_ChangeAlpha(50);
|
||||
}
|
||||
} else if ((gSaveContext.eventInf[0] & 0xF) == 1) {
|
||||
if (player->stateFlags1 & 0x00800000) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_23) {
|
||||
if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) &&
|
||||
(gSaveContext.equips.buttonItems[0] != ITEM_BOW)) {
|
||||
if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) {
|
||||
@@ -2272,7 +2272,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) {
|
||||
case 2:
|
||||
if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) {
|
||||
if (gSaveContext.unk_13F0 == 7) {
|
||||
globalCtx->actorCtx.unk_03 = 0;
|
||||
globalCtx->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.unk_13F8 = gSaveContext.magic - arg1;
|
||||
gSaveContext.unk_13F0 = 1;
|
||||
@@ -2284,7 +2284,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) {
|
||||
case 1:
|
||||
if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) {
|
||||
if (gSaveContext.unk_13F0 == 7) {
|
||||
globalCtx->actorCtx.unk_03 = 0;
|
||||
globalCtx->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.unk_13F8 = gSaveContext.magic - arg1;
|
||||
gSaveContext.unk_13F0 = 6;
|
||||
@@ -2312,7 +2312,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) {
|
||||
case 4:
|
||||
if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) {
|
||||
if (gSaveContext.unk_13F0 == 7) {
|
||||
globalCtx->actorCtx.unk_03 = 0;
|
||||
globalCtx->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.unk_13F8 = gSaveContext.magic - arg1;
|
||||
gSaveContext.unk_13F0 = 4;
|
||||
@@ -2459,8 +2459,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) {
|
||||
((gSaveContext.equips.buttonItems[1] != ITEM_LENS) &&
|
||||
(gSaveContext.equips.buttonItems[2] != ITEM_LENS) &&
|
||||
(gSaveContext.equips.buttonItems[3] != ITEM_LENS)) ||
|
||||
(globalCtx->actorCtx.unk_03 == 0)) {
|
||||
globalCtx->actorCtx.unk_03 = 0;
|
||||
!globalCtx->actorCtx.lensActive) {
|
||||
globalCtx->actorCtx.lensActive = false;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
gSaveContext.unk_13F0 = 0;
|
||||
@@ -2730,8 +2730,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
|
||||
|
||||
if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) {
|
||||
temp = 0;
|
||||
} else if ((player->stateFlags1 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) ||
|
||||
(player->stateFlags2 & 0x00040000)) {
|
||||
} else if ((player->stateFlags1 & PLAYER_STATE1_21) || (func_8008F2F8(globalCtx) == 4) ||
|
||||
(player->stateFlags2 & PLAYER_STATE2_18)) {
|
||||
temp = 70;
|
||||
} else {
|
||||
temp = interfaceCtx->healthAlpha;
|
||||
@@ -3157,7 +3157,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
||||
if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
|
||||
Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment, 0);
|
||||
|
||||
if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) ||
|
||||
if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) ||
|
||||
((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
|
||||
@@ -3403,7 +3403,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
|
||||
|
||||
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
|
||||
(globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) &&
|
||||
!(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) &&
|
||||
!(player->stateFlags2 & PLAYER_STATE2_24) && (globalCtx->sceneLoadFlag == 0) &&
|
||||
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx) && (gSaveContext.minigameState != 1) &&
|
||||
(globalCtx->shootingGalleryStatus <= 1) &&
|
||||
!((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) {
|
||||
@@ -3946,7 +3946,7 @@ void Interface_Update(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
HealthMeter_HandleCriticalAlarm(globalCtx);
|
||||
HealthMeter_UpdateBeatingHeart(globalCtx);
|
||||
D_80125A58 = func_8008F2F8(globalCtx);
|
||||
|
||||
if (D_80125A58 == 1) {
|
||||
@@ -3962,8 +3962,8 @@ void Interface_Update(GlobalContext* globalCtx) {
|
||||
HealthMeter_Update(globalCtx);
|
||||
|
||||
if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) &&
|
||||
(msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) &&
|
||||
(globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {}
|
||||
(msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) &&
|
||||
(globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {}
|
||||
|
||||
if (gSaveContext.rupeeAccumulator != 0) {
|
||||
if (gSaveContext.rupeeAccumulator > 0) {
|
||||
@@ -4161,7 +4161,7 @@ void Interface_Update(GlobalContext* globalCtx) {
|
||||
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
|
||||
func_800F6964(30);
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.natureAmbienceId = 0xFF;
|
||||
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
||||
} else {
|
||||
gSaveContext.sunsSongState = SUNSSONG_SPECIAL;
|
||||
}
|
||||
|
||||
+5
-5
@@ -208,7 +208,7 @@ void Gameplay_Init(GameState* thisx) {
|
||||
Audio_SetExtraFilter(0);
|
||||
Quake_Init();
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(globalCtx->cameraPtrs); i++) {
|
||||
globalCtx->cameraPtrs[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void Gameplay_Init(GameState* thisx) {
|
||||
func_80112098(globalCtx);
|
||||
Message_Init(globalCtx);
|
||||
GameOver_Init(globalCtx);
|
||||
func_8006BA00(globalCtx);
|
||||
SoundSource_InitAll(globalCtx);
|
||||
Effect_InitContext(globalCtx);
|
||||
EffectSs_InitInfo(globalCtx, 0x55);
|
||||
CollisionCheck_InitContext(globalCtx, &globalCtx->colChkCtx);
|
||||
@@ -392,7 +392,7 @@ void Gameplay_Init(GameState* thisx) {
|
||||
}
|
||||
|
||||
Interface_SetSceneRestrictions(globalCtx);
|
||||
func_800758AC(globalCtx);
|
||||
Environment_PlaySceneSequence(globalCtx);
|
||||
gSaveContext.seqId = globalCtx->sequenceCtx.seqId;
|
||||
gSaveContext.natureAmbienceId = globalCtx->sequenceCtx.natureAmbienceId;
|
||||
func_8002DF18(globalCtx, GET_PLAYER(globalCtx));
|
||||
@@ -484,7 +484,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
||||
osSyncPrintf("\n\n\nサウンドイニシャル来ました。222");
|
||||
func_800F6964(0x14);
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.natureAmbienceId = 0xFF;
|
||||
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -975,7 +975,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3771);
|
||||
}
|
||||
|
||||
func_8006BA30(globalCtx);
|
||||
SoundSource_UpdateAll(globalCtx);
|
||||
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3777);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
#define FLAGS 0x06000035
|
||||
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26)
|
||||
|
||||
void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx);
|
||||
void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
+164
-126
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "objects/object_link_boy/object_link_boy.h"
|
||||
#include "objects/object_link_child/object_link_child.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -12,7 +13,7 @@ typedef struct {
|
||||
/* 0x04 */ Vec3f pos;
|
||||
} BowStringData; // size = 0x10
|
||||
|
||||
FlexSkeletonHeader* gPlayerSkelHeaders[] = { 0x060377F4, &gLinkChildSkel };
|
||||
FlexSkeletonHeader* gPlayerSkelHeaders[] = { &gLinkAdultSkel, &gLinkChildSkel };
|
||||
|
||||
s16 sBootData[PLAYER_BOOTS_MAX][17] = {
|
||||
{ 200, 1000, 300, 700, 550, 270, 600, 350, 800, 600, -100, 600, 590, 750, 125, 200, 130 },
|
||||
@@ -45,21 +46,33 @@ u8 gPlayerModelTypes[][5] = {
|
||||
};
|
||||
|
||||
Gfx* D_80125CE8[] = {
|
||||
0x060226E0, gLinkChildRightHandClosedNearDL, 0x06027690, gLinkChildRightHandClosedFarDL,
|
||||
0x060226E0, gLinkChildRightFistAndDekuShieldNearDL, 0x06027690, gLinkChildRightFistAndDekuShieldFarDL,
|
||||
0x06022970, gLinkChildRightHandClosedNearDL, 0x06027918, gLinkChildRightHandClosedFarDL,
|
||||
0x060241C0, gLinkChildRightHandClosedNearDL, 0x06028B40, gLinkChildRightHandClosedFarDL,
|
||||
gLinkAdultRightHandClosedNearDL,
|
||||
gLinkChildRightHandClosedNearDL,
|
||||
gLinkAdultRightHandClosedFarDL,
|
||||
gLinkChildRightHandClosedFarDL,
|
||||
gLinkAdultRightHandClosedNearDL,
|
||||
gLinkChildRightFistAndDekuShieldNearDL,
|
||||
gLinkAdultRightHandClosedFarDL,
|
||||
gLinkChildRightFistAndDekuShieldFarDL,
|
||||
gLinkAdultRightHandHoldingHylianShieldNearDL,
|
||||
gLinkChildRightHandClosedNearDL,
|
||||
gLinkAdultRightHandHoldingHylianShieldFarDL,
|
||||
gLinkChildRightHandClosedFarDL,
|
||||
gLinkAdultRightHandHoldingMirrorShieldNearDL,
|
||||
gLinkChildRightHandClosedNearDL,
|
||||
gLinkAdultRightHandHoldingMirrorShieldFarDL,
|
||||
gLinkChildRightHandClosedFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125D28[] = {
|
||||
0x06023160, gLinkChildSwordAndSheathNearDL,
|
||||
0x06027F00, gLinkChildSwordAndSheathFarDL,
|
||||
0x06023160, gLinkChildDekuShieldSwordAndSheathNearDL,
|
||||
0x06027F00, gLinkChildDekuShieldSwordAndSheathFarDL,
|
||||
0x06020A78, gLinkChildHylianShieldSwordAndSheathNearDL,
|
||||
0x06025FB8, gLinkChildHylianShieldSwordAndSheathFarDL,
|
||||
0x060211B8, gLinkChildSwordAndSheathNearDL,
|
||||
0x060264F0, gLinkChildSwordAndSheathFarDL,
|
||||
gLinkAdultMasterSwordAndSheathNearDL, gLinkChildSwordAndSheathNearDL,
|
||||
gLinkAdultMasterSwordAndSheathFarDL, gLinkChildSwordAndSheathFarDL,
|
||||
gLinkAdultMasterSwordAndSheathNearDL, gLinkChildDekuShieldSwordAndSheathNearDL,
|
||||
gLinkAdultMasterSwordAndSheathFarDL, gLinkChildDekuShieldSwordAndSheathFarDL,
|
||||
gLinkAdultHylianShieldSwordAndSheathNearDL, gLinkChildHylianShieldSwordAndSheathNearDL,
|
||||
gLinkAdultHylianShieldSwordAndSheathFarDL, gLinkChildHylianShieldSwordAndSheathFarDL,
|
||||
gLinkAdultMirrorShieldSwordAndSheathNearDL, gLinkChildSwordAndSheathNearDL,
|
||||
gLinkAdultMirrorShieldSwordAndSheathFarDL, gLinkChildSwordAndSheathFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125D68[] = {
|
||||
@@ -67,166 +80,180 @@ Gfx* D_80125D68[] = {
|
||||
};
|
||||
|
||||
Gfx* D_80125D88[] = {
|
||||
0x060249D8, gLinkChildSheathNearDL,
|
||||
0x06028150, gLinkChildSheathFarDL,
|
||||
0x060249D8, gLinkChildDekuShieldAndSheathNearDL,
|
||||
0x06028150, gLinkChildDekuShieldAndSheathFarDL,
|
||||
0x06020E70, gLinkChildHylianShieldAndSheathNearDL,
|
||||
0x060262B8, gLinkChildHylianShieldAndSheathFarDL,
|
||||
0x060216B0, gLinkChildSheathNearDL,
|
||||
0x06026910, gLinkChildSheathFarDL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
0x060249D8, gLinkChildDekuShieldWithMatrixDL,
|
||||
0x060249D8, gLinkChildDekuShieldWithMatrixDL,
|
||||
gLinkAdultSheathNearDL,
|
||||
gLinkChildSheathNearDL,
|
||||
gLinkAdultSheathFarDL,
|
||||
gLinkChildSheathFarDL,
|
||||
gLinkAdultSheathNearDL,
|
||||
gLinkChildDekuShieldAndSheathNearDL,
|
||||
gLinkAdultSheathFarDL,
|
||||
gLinkChildDekuShieldAndSheathFarDL,
|
||||
gLinkAdultHylianShieldAndSheathNearDL,
|
||||
gLinkChildHylianShieldAndSheathNearDL,
|
||||
gLinkAdultHylianShieldAndSheathFarDL,
|
||||
gLinkChildHylianShieldAndSheathFarDL,
|
||||
gLinkAdultMirrorShieldAndSheathNearDL,
|
||||
gLinkChildSheathNearDL,
|
||||
gLinkAdultMirrorShieldAndSheathFarDL,
|
||||
gLinkChildSheathFarDL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gLinkAdultSheathNearDL,
|
||||
gLinkChildDekuShieldWithMatrixDL,
|
||||
gLinkAdultSheathNearDL,
|
||||
gLinkChildDekuShieldWithMatrixDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125DE8[] = {
|
||||
0x060238C8, gLinkChildLeftHandHoldingMasterSwordDL, 0x060286B8, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
0x06023D50, gLinkChildLeftHandHoldingMasterSwordDL, 0x060291E8, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
gLinkAdultLeftHandHoldingBgsNearDL, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
gLinkAdultLeftHandHoldingBgsFarDL, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
gLinkAdultHandHoldingBrokenGiantsKnifeDL, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
gLinkAdultHandHoldingBrokenGiantsKnifeFarDL, gLinkChildLeftHandHoldingMasterSwordDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E08[] = {
|
||||
0x06021AA8,
|
||||
gLinkAdultLeftHandNearDL,
|
||||
gLinkChildLeftHandNearDL,
|
||||
0x06026C58,
|
||||
gLinkAdultLeftHandFarDL,
|
||||
gLinkChildLeftHandFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E18[] = {
|
||||
0x06021CE8,
|
||||
gLinkAdultLeftHandClosedNearDL,
|
||||
gLinkChildLeftFistNearDL,
|
||||
0x06026DF0,
|
||||
gLinkAdultLeftHandClosedFarDL,
|
||||
gLinkChildLeftFistFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E28[] = {
|
||||
0x06021F78,
|
||||
gLinkAdultLeftHandHoldingMasterSwordNearDL,
|
||||
gLinkChildLeftFistAndKokiriSwordNearDL,
|
||||
0x06027078,
|
||||
gLinkAdultLeftHandHoldingMasterSwordFarDL,
|
||||
gLinkChildLeftFistAndKokiriSwordFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E38[] = {
|
||||
0x06021F78,
|
||||
gLinkAdultLeftHandHoldingMasterSwordNearDL,
|
||||
gLinkChildLeftFistAndKokiriSwordNearDL,
|
||||
0x06027078,
|
||||
gLinkAdultLeftHandHoldingMasterSwordFarDL,
|
||||
gLinkChildLeftFistAndKokiriSwordFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E48[] = {
|
||||
0x06022498,
|
||||
gLinkAdultRightHandNearDL,
|
||||
gLinkChildRightHandNearDL,
|
||||
0x060274F8,
|
||||
gLinkAdultRightHandFarDL,
|
||||
gLinkChildRightHandFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E58[] = {
|
||||
0x060226E0,
|
||||
gLinkAdultRightHandClosedNearDL,
|
||||
gLinkChildRightHandClosedNearDL,
|
||||
0x06027690,
|
||||
gLinkAdultRightHandClosedFarDL,
|
||||
gLinkChildRightHandClosedFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E68[] = {
|
||||
0x06022DA8,
|
||||
gLinkChildRightHandHoldingFairySlingshotNearDL,
|
||||
0x06027B88,
|
||||
gLinkChildRightHandHoldingFairySlingshotFarDL,
|
||||
gLinkAdultRightHandHoldingBowNearDL,
|
||||
gLinkChildRightHandHoldingSlingshotNearDL,
|
||||
gLinkAdultRightHandHoldingBowFarDL,
|
||||
gLinkChildRightHandHoldingSlingshotFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E78[] = {
|
||||
0x06023160,
|
||||
gLinkAdultMasterSwordAndSheathNearDL,
|
||||
gLinkChildSwordAndSheathNearDL,
|
||||
0x06027F00,
|
||||
gLinkAdultMasterSwordAndSheathFarDL,
|
||||
gLinkChildSwordAndSheathFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E88[] = {
|
||||
0x060249D8,
|
||||
gLinkAdultSheathNearDL,
|
||||
gLinkChildSheathNearDL,
|
||||
0x06028150,
|
||||
gLinkAdultSheathFarDL,
|
||||
gLinkChildSheathFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125E98[] = {
|
||||
0x06035330,
|
||||
gLinkAdultWaistNearDL,
|
||||
gLinkChildWaistNearDL,
|
||||
0x0602F530,
|
||||
gLinkAdultWaistFarDL,
|
||||
gLinkChildWaistFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125EA8[] = {
|
||||
0x06022DA8,
|
||||
gLinkChildRightHandHoldingFairySlingshotNearDL,
|
||||
0x06027B88,
|
||||
gLinkChildRightHandHoldingFairySlingshotFarDL,
|
||||
gLinkAdultRightHandHoldingBowNearDL,
|
||||
gLinkChildRightHandHoldingSlingshotNearDL,
|
||||
gLinkAdultRightHandHoldingBowFarDL,
|
||||
gLinkChildRightHandHoldingSlingshotFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125EB8[] = {
|
||||
0x06024698,
|
||||
gLinkAdultRightHandHoldingOotNearDL,
|
||||
gLinkChildRightHandHoldingFairyOcarinaNearDL,
|
||||
0x06028F58,
|
||||
gLinkAdultRightHandHoldingOotFarDL,
|
||||
gLinkChildRightHandHoldingFairyOcarinaFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125EC8[] = {
|
||||
0x06024698,
|
||||
gLinkChildRightHandAndOOTNearDL,
|
||||
0x06028F58,
|
||||
gLinkAdultRightHandHoldingOotNearDL,
|
||||
gLinkChildRightHandAndOotNearDL,
|
||||
gLinkAdultRightHandHoldingOotFarDL,
|
||||
gLinkChildRightHandHoldingOOTFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125ED8[] = {
|
||||
0x06024D70,
|
||||
gLinkAdultRightHandHoldingHookshotNearDL,
|
||||
gLinkChildRightHandNearDL,
|
||||
0x06024D70,
|
||||
gLinkAdultRightHandHoldingHookshotNearDL, // The 'far' display list exists but is not used
|
||||
gLinkChildRightHandFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125EE8[] = {
|
||||
0x060233E0,
|
||||
gLinkAdultLeftHandHoldingHammerNearDL,
|
||||
gLinkChildLeftHandNearDL,
|
||||
0x06028288,
|
||||
gLinkAdultLeftHandHoldingHammerFarDL,
|
||||
gLinkChildLeftHandFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125EF8[] = {
|
||||
0x06021AA8,
|
||||
gLinkAdultLeftHandNearDL,
|
||||
gLinkChildLeftFistAndBoomerangNearDL,
|
||||
0x06026C58,
|
||||
gLinkAdultLeftHandFarDL,
|
||||
gLinkChildLeftFistAndBoomerangFarDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F08[] = {
|
||||
0x06024B58,
|
||||
gLinkAdultLeftHandOutNearDL,
|
||||
gLinkChildLeftHandUpNearDL,
|
||||
0x06024B58,
|
||||
gLinkAdultLeftHandOutNearDL,
|
||||
gLinkChildLeftHandUpNearDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F18[] = {
|
||||
0x06029918,
|
||||
Gfx* sArmOutDLs[] = {
|
||||
gLinkAdultRightArmOutNearDL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F20[] = {
|
||||
0x06029C20,
|
||||
Gfx* sHandOutDLs[] = {
|
||||
gLinkAdultRightHandOutNearDL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F28[] = {
|
||||
0x06036E58,
|
||||
gLinkChildLeftShoulderNearDL,
|
||||
Gfx* sRightShoulderNearDLs[] = {
|
||||
gLinkAdultRightShoulderNearDL,
|
||||
gLinkChildRightShoulderNearDL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F30[] = {
|
||||
0x06029FA0,
|
||||
gLinkAdultLeftArmOutNearDL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Gfx* D_80125F38[] = {
|
||||
0x0602A248,
|
||||
Gfx* sHoldingFirstPersonWeaponDLs[] = {
|
||||
gLinkAdultRightHandHoldingBowFirstPersonDL,
|
||||
gLinkChildRightArmStretchedSlingshotDL,
|
||||
};
|
||||
|
||||
@@ -266,7 +293,7 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
|
||||
currentBoots = PLAYER_BOOTS_NORMAL_CHILD;
|
||||
}
|
||||
} else if (currentBoots == PLAYER_BOOTS_IRON) {
|
||||
if (this->stateFlags1 & 0x8000000) {
|
||||
if (this->stateFlags1 & PLAYER_STATE1_27) {
|
||||
currentBoots = PLAYER_BOOTS_IRON_UNDERWATER;
|
||||
}
|
||||
REG(27) = 500;
|
||||
@@ -298,8 +325,9 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
|
||||
}
|
||||
|
||||
s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) {
|
||||
return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (globalCtx->sceneLoadFlag == 0x14) ||
|
||||
(this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) ||
|
||||
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
|
||||
(globalCtx->sceneLoadFlag == 0x14) || (this->stateFlags1 & PLAYER_STATE1_0) ||
|
||||
(this->stateFlags3 & PLAYER_STATE3_7) ||
|
||||
((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
|
||||
}
|
||||
|
||||
@@ -310,11 +338,11 @@ s32 Player_InCsMode(GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
s32 func_8008E9C4(Player* this) {
|
||||
return (this->stateFlags1 & 0x10);
|
||||
return (this->stateFlags1 & PLAYER_STATE1_4);
|
||||
}
|
||||
|
||||
s32 Player_IsChildWithHylianShield(Player* this) {
|
||||
return gSaveContext.linkAge != 0 && (this->currentShield == PLAYER_SHIELD_HYLIAN);
|
||||
return gSaveContext.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
|
||||
}
|
||||
|
||||
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
|
||||
@@ -328,7 +356,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
|
||||
}
|
||||
|
||||
void Player_SetModelsForHoldingShield(Player* this) {
|
||||
if ((this->stateFlags1 & 0x400000) &&
|
||||
if ((this->stateFlags1 & PLAYER_STATE1_22) &&
|
||||
((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) {
|
||||
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
|
||||
this->rightHandType = 10;
|
||||
@@ -404,15 +432,18 @@ void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s
|
||||
|
||||
void func_8008EDF0(Player* this) {
|
||||
this->unk_664 = NULL;
|
||||
this->stateFlags2 &= ~0x2000;
|
||||
this->stateFlags2 &= ~PLAYER_STATE2_13;
|
||||
}
|
||||
|
||||
void func_8008EE08(Player* this) {
|
||||
if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & 0x8A00000) ||
|
||||
(!(this->stateFlags1 & 0xC0000) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) {
|
||||
this->stateFlags1 &= ~0x400F8000;
|
||||
} else if (!(this->stateFlags1 & 0x2C0000)) {
|
||||
this->stateFlags1 |= 0x80000;
|
||||
if ((this->actor.bgCheckFlags & 1) ||
|
||||
(this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) ||
|
||||
(!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) &&
|
||||
((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) {
|
||||
this->stateFlags1 &= ~(PLAYER_STATE1_15 | PLAYER_STATE1_16 | PLAYER_STATE1_17 | PLAYER_STATE1_18 |
|
||||
PLAYER_STATE1_19 | PLAYER_STATE1_30);
|
||||
} else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_21))) {
|
||||
this->stateFlags1 |= PLAYER_STATE1_19;
|
||||
}
|
||||
|
||||
func_8008EDF0(this);
|
||||
@@ -424,7 +455,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
|
||||
func_8008EE08(this);
|
||||
this->unk_664 = actor;
|
||||
this->unk_684 = actor;
|
||||
this->stateFlags1 |= 0x10000;
|
||||
this->stateFlags1 |= PLAYER_STATE1_16;
|
||||
Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor);
|
||||
Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2);
|
||||
}
|
||||
@@ -432,7 +463,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
|
||||
s32 func_8008EF30(GlobalContext* globalCtx) {
|
||||
Player* this = GET_PLAYER(globalCtx);
|
||||
|
||||
return (this->stateFlags1 & 0x800000);
|
||||
return (this->stateFlags1 & PLAYER_STATE1_23);
|
||||
}
|
||||
|
||||
s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) {
|
||||
@@ -589,7 +620,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
|
||||
} else if ((this->unk_840 > 80) &&
|
||||
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater
|
||||
var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) ? 1 : 3;
|
||||
} else if (this->stateFlags1 & 0x8000000) { // Swimming
|
||||
} else if (this->stateFlags1 & PLAYER_STATE1_27) { // Swimming
|
||||
var = 2;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -625,14 +656,15 @@ u8 sEyeMouthIndexes[][2] = {
|
||||
* from adult Link's object are used here.
|
||||
*/
|
||||
void* sEyeTextures[] = {
|
||||
0x06000000, 0x06000800, 0x06001000, 0x06001800, 0x06002000, 0x06002800, 0x06003000, 0x06003800,
|
||||
gLinkAdultEyesOpenTex, gLinkAdultEyesHalfTex, gLinkAdultEyesClosedfTex, gLinkAdultEyesRollLeftTex,
|
||||
gLinkAdultEyesRollRightTex, gLinkAdultEyesShockTex, gLinkAdultEyesUnk1Tex, gLinkAdultEyesUnk2Tex,
|
||||
};
|
||||
|
||||
void* sMouthTextures[] = {
|
||||
0x06004000,
|
||||
0x06004400,
|
||||
0x06004800,
|
||||
0x06004C00,
|
||||
gLinkAdultMouth1Tex,
|
||||
gLinkAdultMouth2Tex,
|
||||
gLinkAdultMouth3Tex,
|
||||
gLinkAdultMouth4Tex,
|
||||
};
|
||||
|
||||
Color_RGB8 sTunicColors[] = {
|
||||
@@ -647,8 +679,8 @@ Color_RGB8 sGauntletColors[] = {
|
||||
};
|
||||
|
||||
Gfx* sBootDListGroups[][2] = {
|
||||
{ 0x06025918, 0x06025A60 },
|
||||
{ 0x06025BA8, 0x06025DB0 },
|
||||
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL },
|
||||
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
|
||||
};
|
||||
|
||||
void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
|
||||
@@ -689,10 +721,12 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
|
||||
color = &sGauntletColors[strengthUpgrade - 2];
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06025218);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06025598);
|
||||
gSPDisplayList(POLY_OPA_DISP++, (D_80160014 == 0) ? D_060252D8 : D_06025438);
|
||||
gSPDisplayList(POLY_OPA_DISP++, (D_80160018 == 8) ? D_06025658 : D_060257B8);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultLeftGauntletPlate1DL);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultRightGauntletPlate1DL);
|
||||
gSPDisplayList(POLY_OPA_DISP++,
|
||||
(D_80160014 == 0) ? gLinkAdultLeftGauntletPlate2DL : gLinkAdultLeftGauntletPlate3DL);
|
||||
gSPDisplayList(POLY_OPA_DISP++,
|
||||
(D_80160018 == 8) ? gLinkAdultRightGauntletPlate2DL : gLinkAdultRightGauntletPlate3DL);
|
||||
}
|
||||
|
||||
if (boots != 0) {
|
||||
@@ -749,7 +783,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
|
||||
s16 temp2;
|
||||
s32 temp3;
|
||||
|
||||
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & 0x80) &&
|
||||
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) &&
|
||||
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
|
||||
s32 pad;
|
||||
|
||||
@@ -893,10 +927,11 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
||||
|
||||
if ((D_80160014 == 4) && (gSaveContext.swordHealth <= 0.0f)) {
|
||||
dLists += 4;
|
||||
} else if ((D_80160014 == 6) && (this->stateFlags1 & 0x2000000)) {
|
||||
} else if ((D_80160014 == 6) && (this->stateFlags1 & PLAYER_STATE1_25)) {
|
||||
dLists = &D_80125E08[gSaveContext.linkAge];
|
||||
D_80160014 = 0;
|
||||
} else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
|
||||
} else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) &&
|
||||
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
||||
dLists = &D_80125E18[gSaveContext.linkAge];
|
||||
D_80160014 = 1;
|
||||
}
|
||||
@@ -907,7 +942,8 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
||||
|
||||
if (D_80160018 == 10) {
|
||||
dLists += this->currentShield * 4;
|
||||
} else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) {
|
||||
} else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) &&
|
||||
!(this->stateFlags1 & PLAYER_STATE1_27)) {
|
||||
dLists = &D_80125E58[gSaveContext.linkAge];
|
||||
D_80160018 = 9;
|
||||
}
|
||||
@@ -943,15 +979,16 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
||||
if (this->unk_6AD != 2) {
|
||||
*dList = NULL;
|
||||
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
|
||||
*dList = D_80125F18[(void)0, gSaveContext.linkAge];
|
||||
*dList = sArmOutDLs[(void)0, gSaveContext.linkAge];
|
||||
} else if (limbIndex == PLAYER_LIMB_L_HAND) {
|
||||
*dList = D_80125F20[(void)0, gSaveContext.linkAge];
|
||||
*dList = sHandOutDLs[(void)0, gSaveContext.linkAge];
|
||||
} else if (limbIndex == PLAYER_LIMB_R_SHOULDER) {
|
||||
*dList = D_80125F28[(void)0, gSaveContext.linkAge];
|
||||
*dList = sRightShoulderNearDLs[(void)0, gSaveContext.linkAge];
|
||||
} else if (limbIndex == PLAYER_LIMB_R_FOREARM) {
|
||||
*dList = D_80125F30[(void)0, gSaveContext.linkAge];
|
||||
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
||||
*dList = Player_HoldsHookshot(this) ? D_0602A738 : D_80125F38[(void)0, gSaveContext.linkAge];
|
||||
*dList = Player_HoldsHookshot(this) ? gLinkAdultRightHandHoldingHookshotFarDL
|
||||
: sHoldingFirstPersonWeaponDLs[(void)0, gSaveContext.linkAge];
|
||||
} else {
|
||||
*dList = NULL;
|
||||
}
|
||||
@@ -1005,7 +1042,7 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide
|
||||
COLTYPE_METAL,
|
||||
};
|
||||
|
||||
if (this->stateFlags1 & 0x400000) {
|
||||
if (this->stateFlags1 & PLAYER_STATE1_22) {
|
||||
Vec3f quadDest[4];
|
||||
|
||||
this->shieldQuad.base.colType = shieldColTypes[this->currentShield];
|
||||
@@ -1039,12 +1076,12 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
|
||||
Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]);
|
||||
|
||||
if (func_80090480(globalCtx, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) &&
|
||||
!(this->stateFlags1 & 0x400000)) {
|
||||
!(this->stateFlags1 & PLAYER_STATE1_22)) {
|
||||
EffectBlure_AddVertex(Effect_GetByIndex(this->swordEffectIndex), &this->swordInfo[0].tip,
|
||||
&this->swordInfo[0].base);
|
||||
}
|
||||
|
||||
if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & 0x20000))) {
|
||||
if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_17))) {
|
||||
func_80090480(globalCtx, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]);
|
||||
func_80090480(globalCtx, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]);
|
||||
}
|
||||
@@ -1093,7 +1130,7 @@ void func_80090A28(Player* this, Vec3f* vecs) {
|
||||
Matrix_MultVec3f(&D_80126098, &vecs[2]);
|
||||
}
|
||||
|
||||
void func_80090AFC(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
||||
void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
||||
static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f };
|
||||
CollisionPoly* sp9C;
|
||||
s32 bgId;
|
||||
@@ -1126,7 +1163,7 @@ void func_80090AFC(GlobalContext* globalCtx, Player* this, f32 arg2) {
|
||||
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
|
||||
gSPDisplayList(OVERLAY_DISP++, D_0602CB48);
|
||||
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592);
|
||||
}
|
||||
@@ -1138,7 +1175,7 @@ f32 sSwordLengths[] = {
|
||||
0.0f, 4000.0f, 3000.0f, 5500.0f, 0.0f, 2500.0f,
|
||||
};
|
||||
|
||||
Gfx* sBottleDLists[] = { 0x0602AD58, gLinkChildBottleDL };
|
||||
Gfx* sBottleDLists[] = { gLinkAdultBottleDL, gLinkChildBottleDL };
|
||||
|
||||
Color_RGB8 sBottleColors[] = {
|
||||
{ 255, 255, 255 }, { 80, 80, 255 }, { 255, 100, 255 }, { 0, 0, 255 }, { 255, 0, 255 },
|
||||
@@ -1149,8 +1186,8 @@ Color_RGB8 sBottleColors[] = {
|
||||
Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f };
|
||||
|
||||
BowStringData sBowStringData[] = {
|
||||
{ 0x0602B108, { 0.0f, -360.4f, 0.0f } }, // bow
|
||||
{ 0x060221A8, { 606.0f, 236.0f, 0.0f } }, // slingshot
|
||||
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // bow
|
||||
{ gLinkChildSlinghotStringDL, { 606.0f, 236.0f, 0.0f } }, // slingshot
|
||||
};
|
||||
|
||||
Vec3f D_80126154[] = {
|
||||
@@ -1241,19 +1278,19 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
||||
|
||||
if (this->actor.scale.y >= 0.0f) {
|
||||
if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) {
|
||||
if (this->stateFlags1 & 0x200) {
|
||||
if (this->stateFlags1 & PLAYER_STATE1_9) {
|
||||
Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos);
|
||||
Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp14C);
|
||||
Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0);
|
||||
hookedActor->shape.rot = hookedActor->world.rot;
|
||||
} else if (this->stateFlags1 & 0x800) {
|
||||
} else if (this->stateFlags1 & PLAYER_STATE1_11) {
|
||||
Vec3s spB8;
|
||||
|
||||
Matrix_Get(&sp14C);
|
||||
Matrix_MtxFToYXZRotS(&sp14C, &spB8, 0);
|
||||
|
||||
if (hookedActor->flags & 0x20000) {
|
||||
if (hookedActor->flags & ACTOR_FLAG_17) {
|
||||
hookedActor->world.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x;
|
||||
} else {
|
||||
hookedActor->world.rot.y = hookedActor->shape.rot.y = this->actor.shape.rot.y + this->unk_3BC.y;
|
||||
@@ -1277,7 +1314,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
||||
Matrix_Push();
|
||||
Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY);
|
||||
|
||||
if ((this->stateFlags1 & 0x200) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) {
|
||||
if ((this->stateFlags1 & PLAYER_STATE1_9) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) {
|
||||
Vec3f sp90;
|
||||
f32 distXYZ;
|
||||
|
||||
@@ -1332,14 +1369,15 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
||||
|
||||
if (func_8002DD78(this) != 0) {
|
||||
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
|
||||
func_80090AFC(globalCtx, this,
|
||||
(this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
|
||||
Player_DrawHookshotReticle(
|
||||
globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->unk_862 != 0) || ((func_8002DD6C(this) == 0) && (heldActor != NULL))) {
|
||||
if (!(this->stateFlags1 & 0x400) && (this->unk_862 != 0) && (this->exchangeItemId != EXCH_ITEM_NONE)) {
|
||||
if (!(this->stateFlags1 & PLAYER_STATE1_10) && (this->unk_862 != 0) &&
|
||||
(this->exchangeItemId != EXCH_ITEM_NONE)) {
|
||||
Math_Vec3f_Copy(&sGetItemRefPos, &this->leftHandPos);
|
||||
} else {
|
||||
sGetItemRefPos.x = (this->bodyPartsPos[15].x + this->leftHandPos.x) * 0.5f;
|
||||
@@ -1513,7 +1551,7 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
|
||||
sp12C[0] = sword;
|
||||
sp12C[1] = shield;
|
||||
|
||||
func_800D1694(pos->x, pos->y, pos->z, rot);
|
||||
Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x04, seg04);
|
||||
|
||||
+2
-2
@@ -246,7 +246,7 @@ s32 func_80096238(void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
|
||||
void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
|
||||
u16 tlutCount, f32 frameX, f32 frameY) {
|
||||
Gfx* displayListHead;
|
||||
uObjBg* bg;
|
||||
@@ -263,7 +263,7 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
|
||||
bg->b.imageY = 0;
|
||||
bg->b.imageH = height * 4;
|
||||
bg->b.frameY = frameY * 4;
|
||||
bg->b.imagePtr = (void*)source;
|
||||
bg->b.imagePtr = source;
|
||||
bg->b.imageLoad = G_BGLT_LOADTILE;
|
||||
bg->b.imageFmt = fmt;
|
||||
bg->b.imageSiz = siz;
|
||||
|
||||
+3
-3
@@ -113,9 +113,9 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) {
|
||||
|
||||
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) {
|
||||
if (objectCtx->status[bankIndex].id > 0) {
|
||||
return 1;
|
||||
return true;
|
||||
} else {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
|
||||
// Scene Command 0x07: Special Files
|
||||
void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
if (cmd->specialFiles.keepObjectId != 0) {
|
||||
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
|
||||
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
|
||||
}
|
||||
|
||||
+28
-121
@@ -21,6 +21,8 @@
|
||||
#include "scenes/indoors/miharigoya/miharigoya_scene.h"
|
||||
#include "scenes/dungeons/ice_doukutu/ice_doukutu_scene.h"
|
||||
|
||||
#include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h"
|
||||
|
||||
#define ENTRANCE(scene, spawn, continueBgm, displayTitleCard, fadeIn, fadeOut) \
|
||||
{ \
|
||||
scene, spawn, \
|
||||
@@ -808,128 +810,32 @@ EntranceInfo gEntranceTable[] = {
|
||||
ENTRANCE(0x5C, 0x08, 0, 1, 0x03, 0x03), ENTRANCE(0x5C, 0x08, 0, 1, 0x03, 0x03),
|
||||
};
|
||||
|
||||
#define TITLED_SCENE(name, title, unk_10, config, unk_12) \
|
||||
{ \
|
||||
(u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, (u32)_##title##SegmentRomStart, \
|
||||
(u32)_##title##SegmentRomEnd, unk_10, config, unk_12, 0 \
|
||||
}
|
||||
// Linker symbol declarations (used in the table below)
|
||||
#define DEFINE_SCENE(name, title, _2, _3, _4, _5) \
|
||||
DECLARE_ROM_SEGMENT(name) \
|
||||
DECLARE_ROM_SEGMENT(title)
|
||||
|
||||
#define UNTITLED_SCENE(name, unk_10, config, unk_12) \
|
||||
{ (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, 0, 0, unk_10, config, unk_12, 0 }
|
||||
#include "tables/scene_table.h"
|
||||
|
||||
#undef DEFINE_SCENE
|
||||
|
||||
// Scene Table definition
|
||||
#define DEFINE_SCENE(name, title, _2, config, unk_10, unk_12) \
|
||||
{ ROM_FILE(name), ROM_FILE(title), unk_10, config, unk_12, 0 },
|
||||
|
||||
// Handle `none` as a special case for scenes without a title card
|
||||
#define _noneSegmentRomStart NULL
|
||||
#define _noneSegmentRomEnd NULL
|
||||
|
||||
SceneTableEntry gSceneTable[] = {
|
||||
TITLED_SCENE(ydan_scene, g_pn_06, 1, 19, 2),
|
||||
TITLED_SCENE(ddan_scene, g_pn_08, 1, 20, 3),
|
||||
TITLED_SCENE(bdan_scene, g_pn_07, 1, 21, 4),
|
||||
TITLED_SCENE(Bmori1_scene, g_pn_01, 2, 22, 5),
|
||||
TITLED_SCENE(HIDAN_scene, g_pn_03, 2, 18, 6),
|
||||
TITLED_SCENE(MIZUsin_scene, g_pn_04, 1, 23, 7),
|
||||
TITLED_SCENE(jyasinzou_scene, g_pn_05, 1, 25, 8),
|
||||
TITLED_SCENE(HAKAdan_scene, g_pn_02, 2, 24, 9),
|
||||
TITLED_SCENE(HAKAdanCH_scene, g_pn_54, 2, 24, 10),
|
||||
TITLED_SCENE(ice_doukutu_scene, g_pn_10, 0, 37, 0),
|
||||
UNTITLED_SCENE(ganon_scene, 2, 0, 0),
|
||||
TITLED_SCENE(men_scene, g_pn_11, 0, 27, 0),
|
||||
TITLED_SCENE(gerudoway_scene, g_pn_49, 0, 40, 0),
|
||||
TITLED_SCENE(ganontika_scene, g_pn_09, 0, 26, 0),
|
||||
UNTITLED_SCENE(ganon_sonogo_scene, 0, 51, 0),
|
||||
UNTITLED_SCENE(ganontikasonogo_scene, 0, 52, 0),
|
||||
TITLED_SCENE(takaraya_scene, g_pn_51, 0, 0, 0),
|
||||
UNTITLED_SCENE(ydan_boss_scene, 0, 28, 0),
|
||||
UNTITLED_SCENE(ddan_boss_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(bdan_boss_scene, 0, 21, 0),
|
||||
UNTITLED_SCENE(moribossroom_scene, 1, 0, 0),
|
||||
UNTITLED_SCENE(FIRE_bs_scene, 0, 18, 0),
|
||||
UNTITLED_SCENE(MIZUsin_bs_scene, 0, 29, 0),
|
||||
UNTITLED_SCENE(jyasinboss_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(HAKAdan_bs_scene, 0, 24, 0),
|
||||
UNTITLED_SCENE(ganon_boss_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(ganon_final_scene, 0, 38, 0),
|
||||
UNTITLED_SCENE(entra_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(entra_n_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(enrui_scene, 0, 0, 0),
|
||||
TITLED_SCENE(market_alley_scene, g_pn_18, 0, 0, 0),
|
||||
TITLED_SCENE(market_alley_n_scene, g_pn_18, 0, 0, 0),
|
||||
TITLED_SCENE(market_day_scene, g_pn_17, 0, 0, 0),
|
||||
TITLED_SCENE(market_night_scene, g_pn_17, 0, 0, 0),
|
||||
TITLED_SCENE(market_ruins_scene, g_pn_17, 0, 0, 0),
|
||||
UNTITLED_SCENE(shrine_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(shrine_n_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(shrine_r_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kokiri_home_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kokiri_home3_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kokiri_home4_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kokiri_home5_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kakariko_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(kakariko3_scene, 0, 0, 0),
|
||||
TITLED_SCENE(shop1_scene, g_pn_23, 0, 0, 0),
|
||||
TITLED_SCENE(kokiri_shop_scene, g_pn_19, 0, 0, 0),
|
||||
TITLED_SCENE(golon_scene, g_pn_20, 0, 0, 0),
|
||||
TITLED_SCENE(zoora_scene, g_pn_21, 0, 0, 0),
|
||||
TITLED_SCENE(drag_scene, g_pn_24, 0, 0, 0),
|
||||
TITLED_SCENE(alley_shop_scene, g_pn_24, 0, 0, 0),
|
||||
TITLED_SCENE(night_shop_scene, g_pn_56, 0, 0, 0),
|
||||
TITLED_SCENE(face_shop_scene, g_pn_50, 0, 0, 0),
|
||||
UNTITLED_SCENE(link_home_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(impa_scene, 0, 0, 0),
|
||||
TITLED_SCENE(malon_stable_scene, g_pn_48, 0, 0, 0),
|
||||
UNTITLED_SCENE(labo_scene, 0, 0, 0),
|
||||
TITLED_SCENE(hylia_labo_scene, g_pn_26, 0, 43, 0),
|
||||
UNTITLED_SCENE(tent_scene, 0, 0, 0),
|
||||
TITLED_SCENE(hut_scene, g_pn_25, 0, 0, 0),
|
||||
TITLED_SCENE(daiyousei_izumi_scene, g_pn_13, 0, 33, 0),
|
||||
TITLED_SCENE(yousei_izumi_tate_scene, g_pn_45, 0, 39, 0),
|
||||
TITLED_SCENE(yousei_izumi_yoko_scene, g_pn_13, 0, 33, 0),
|
||||
UNTITLED_SCENE(kakusiana_scene, 0, 31, 0),
|
||||
UNTITLED_SCENE(hakaana_scene, 0, 48, 0),
|
||||
UNTITLED_SCENE(hakaana2_scene, 0, 39, 0),
|
||||
TITLED_SCENE(hakaana_ouke_scene, g_pn_44, 0, 42, 0),
|
||||
TITLED_SCENE(syatekijyou_scene, g_pn_15, 0, 34, 0),
|
||||
TITLED_SCENE(tokinoma_scene, g_pn_16, 0, 30, 0),
|
||||
TITLED_SCENE(kenjyanoma_scene, g_pn_14, 0, 32, 0),
|
||||
TITLED_SCENE(hairal_niwa_scene, g_pn_12, 0, 35, 0),
|
||||
TITLED_SCENE(hairal_niwa_n_scene, g_pn_12, 0, 35, 0),
|
||||
UNTITLED_SCENE(hiral_demo_scene, 0, 0, 0),
|
||||
TITLED_SCENE(hakasitarelay_scene, g_pn_57, 0, 48, 0),
|
||||
TITLED_SCENE(turibori_scene, g_pn_46, 0, 50, 0),
|
||||
TITLED_SCENE(nakaniwa_scene, g_pn_12, 0, 47, 0),
|
||||
TITLED_SCENE(bowling_scene, g_pn_47, 0, 41, 0),
|
||||
UNTITLED_SCENE(souko_scene, 0, 44, 0),
|
||||
UNTITLED_SCENE(miharigoya_scene, 0, 45, 0),
|
||||
TITLED_SCENE(mahouya_scene, g_pn_24, 0, 46, 0),
|
||||
UNTITLED_SCENE(ganon_demo_scene, 0, 36, 0),
|
||||
TITLED_SCENE(kinsuta_scene, g_pn_22, 0, 0, 0),
|
||||
TITLED_SCENE(spot00_scene, g_pn_27, 0, 1, 0),
|
||||
TITLED_SCENE(spot01_scene, g_pn_28, 0, 2, 0),
|
||||
TITLED_SCENE(spot02_scene, g_pn_29, 0, 0, 0),
|
||||
TITLED_SCENE(spot03_scene, g_pn_30, 0, 3, 0),
|
||||
TITLED_SCENE(spot04_scene, g_pn_31, 0, 4, 0),
|
||||
TITLED_SCENE(spot05_scene, g_pn_52, 0, 47, 0),
|
||||
TITLED_SCENE(spot06_scene, g_pn_32, 0, 5, 0),
|
||||
TITLED_SCENE(spot07_scene, g_pn_33, 0, 6, 0),
|
||||
TITLED_SCENE(spot08_scene, g_pn_34, 0, 7, 0),
|
||||
TITLED_SCENE(spot09_scene, g_pn_35, 0, 8, 0),
|
||||
TITLED_SCENE(spot10_scene, g_pn_36, 0, 9, 0),
|
||||
TITLED_SCENE(spot11_scene, g_pn_55, 0, 10, 0),
|
||||
TITLED_SCENE(spot12_scene, g_pn_53, 0, 11, 0),
|
||||
TITLED_SCENE(spot13_scene, g_pn_37, 0, 12, 0),
|
||||
TITLED_SCENE(spot15_scene, g_pn_38, 0, 13, 0),
|
||||
TITLED_SCENE(spot16_scene, g_pn_39, 0, 14, 0),
|
||||
TITLED_SCENE(spot17_scene, g_pn_40, 0, 15, 0),
|
||||
TITLED_SCENE(spot18_scene, g_pn_41, 0, 16, 0),
|
||||
TITLED_SCENE(spot20_scene, g_pn_42, 0, 17, 0),
|
||||
TITLED_SCENE(ganon_tou_scene, g_pn_43, 0, 36, 0),
|
||||
UNTITLED_SCENE(test01_scene, 0, 47, 0),
|
||||
UNTITLED_SCENE(besitu_scene, 0, 49, 0),
|
||||
UNTITLED_SCENE(depth_test_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(syotes_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(syotes2_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(sutaru_scene, 0, 0, 0),
|
||||
TITLED_SCENE(hairal_niwa2_scene, g_pn_12, 0, 35, 0),
|
||||
UNTITLED_SCENE(sasatest_scene, 0, 0, 0),
|
||||
UNTITLED_SCENE(testroom_scene, 0, 0, 0),
|
||||
#include "tables/scene_table.h"
|
||||
};
|
||||
|
||||
#undef _noneSegmentRomStart
|
||||
#undef _noneSegmentRomEnd
|
||||
|
||||
#undef DEFINE_SCENE
|
||||
|
||||
Gfx sDefaultDisplayList[] = {
|
||||
gsSPSegment(0x08, gEmptyDL),
|
||||
gsSPSegment(0x09, gEmptyDL),
|
||||
@@ -1025,11 +931,11 @@ void* sDCLavaFloorTextures[] = {
|
||||
gDCLavaFloor5Tex, gDCLavaFloor6Tex, gDCLavaFloor7Tex, gDCLavaFloor8Tex,
|
||||
};
|
||||
|
||||
// Scene Draw Config 20
|
||||
// Scene Draw Config 20 - Dodongo's Cavern
|
||||
void func_80099878(GlobalContext* globalCtx) {
|
||||
u32 gameplayFrames;
|
||||
s32 pad;
|
||||
Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 6 * sizeof(Gfx));
|
||||
Gfx* displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx[3]));
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4905);
|
||||
|
||||
@@ -1053,11 +959,12 @@ void func_80099878(GlobalContext* globalCtx) {
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead);
|
||||
gDPPipeSync(displayListHead++);
|
||||
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[0]);
|
||||
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT]);
|
||||
gSPEndDisplayList(displayListHead++);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead);
|
||||
gDPPipeSync(displayListHead++);
|
||||
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[1]);
|
||||
gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT]);
|
||||
gSPEndDisplayList(displayListHead);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4956);
|
||||
|
||||
+165
-121
@@ -1,149 +1,178 @@
|
||||
#include "global.h"
|
||||
|
||||
MtxF D_801600C0[60];
|
||||
char D_80160FC0[0x10];
|
||||
MtxF gSkinLimbMatrices[60]; // holds matrices for each limb of the skeleton currently being drawn
|
||||
|
||||
void func_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* arg3, Vec3f* arg4) {
|
||||
Vtx* temp_s2;
|
||||
Struct_800A57C0* phi_s1;
|
||||
f32 temp_x;
|
||||
f32 temp_y;
|
||||
f32 temp_z;
|
||||
Vec3f sp70;
|
||||
static s32 sUnused;
|
||||
|
||||
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
|
||||
Vtx* vtx;
|
||||
SkinVertex* vertexEntry;
|
||||
f32 xwTemp;
|
||||
f32 ywTemp;
|
||||
f32 zwTemp;
|
||||
Vec3f normal;
|
||||
Vec3f sp64;
|
||||
|
||||
for (phi_s1 = arg1; phi_s1 < arg1 + arg2->unk_0; phi_s1++) {
|
||||
temp_s2 = &arg3[phi_s1->unk_0];
|
||||
temp_s2->n.ob[0] = arg4->x;
|
||||
temp_s2->n.ob[1] = arg4->y;
|
||||
temp_s2->n.ob[2] = arg4->z;
|
||||
temp_x = mtx->xw;
|
||||
temp_y = mtx->yw;
|
||||
temp_z = mtx->zw;
|
||||
mtx->zw = 0.0f;
|
||||
mtx->yw = 0.0f;
|
||||
mtx->xw = 0.0f;
|
||||
sp64.x = phi_s1->unk_6;
|
||||
sp64.y = phi_s1->unk_7;
|
||||
sp64.z = phi_s1->unk_8;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(mtx, &sp64, &sp70);
|
||||
temp_s2->n.n[0] = sp70.x;
|
||||
temp_s2->n.n[1] = sp70.y;
|
||||
temp_s2->n.n[2] = sp70.z;
|
||||
mtx->xw = temp_x;
|
||||
mtx->yw = temp_y;
|
||||
mtx->zw = temp_z;
|
||||
for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) {
|
||||
vtx = &vtxBuf[vertexEntry->index];
|
||||
|
||||
vtx->n.ob[0] = pos->x;
|
||||
vtx->n.ob[1] = pos->y;
|
||||
vtx->n.ob[2] = pos->z;
|
||||
|
||||
xwTemp = mtx->xw;
|
||||
ywTemp = mtx->yw;
|
||||
zwTemp = mtx->zw;
|
||||
|
||||
mtx->xw = mtx->yw = mtx->zw = 0.0f;
|
||||
|
||||
sp64.x = vertexEntry->normX;
|
||||
sp64.y = vertexEntry->normY;
|
||||
sp64.z = vertexEntry->normZ;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(mtx, &sp64, &normal);
|
||||
|
||||
vtx->n.n[0] = normal.x;
|
||||
vtx->n.n[1] = normal.y;
|
||||
vtx->n.n[2] = normal.z;
|
||||
|
||||
mtx->xw = xwTemp;
|
||||
mtx->yw = ywTemp;
|
||||
mtx->zw = zwTemp;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800A598C(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3) {
|
||||
s32 temp_1;
|
||||
void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3) {
|
||||
s32 modifCount;
|
||||
SkinLimb** skeleton;
|
||||
SkinLimb* limb;
|
||||
Struct_800A5E28* data;
|
||||
Struct_800A598C* phi_s6;
|
||||
SkinAvb* avb;
|
||||
s32 temp_a0_2;
|
||||
f32 temp_f20;
|
||||
Struct_800A57C0* temp_v0;
|
||||
Struct_800A598C_2* temp_s3;
|
||||
Vtx* spEC;
|
||||
Struct_800A598C* temp_2;
|
||||
Vec3f spDC;
|
||||
SkinAnimatedLimbData* data;
|
||||
SkinLimbModif* modif;
|
||||
SkinLimbVtx* vtxEntry;
|
||||
s32 transformCount;
|
||||
f32 scale;
|
||||
SkinVertex* skinVertices;
|
||||
SkinTransformation* limbTransformations;
|
||||
Vtx* vtxBuf;
|
||||
SkinLimbModif* modifications;
|
||||
Vec3f vtxPoint;
|
||||
Vec3f spD0;
|
||||
Struct_800A598C_2* phi_s0;
|
||||
SkinTransformation* transformationEntry;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 254);
|
||||
|
||||
skeleton = (SkinLimb**)SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
data = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
|
||||
temp_2 = (Struct_800A598C*)SEGMENTED_TO_VIRTUAL(data->unk_4);
|
||||
modifications = (SkinLimbModif*)SEGMENTED_TO_VIRTUAL(data->limbModifications);
|
||||
|
||||
avb = &skin->avbTbl[limbIndex];
|
||||
vtxEntry = &skin->vtxTable[limbIndex];
|
||||
vtxBuf = vtxEntry->buf[vtxEntry->index];
|
||||
modifCount = data->limbModifCount;
|
||||
|
||||
spEC = avb->buf[avb->unk_0];
|
||||
temp_1 = data->unk_2;
|
||||
for (modif = modifications; modif < modifications + modifCount; modif++) {
|
||||
transformCount = modif->transformCount;
|
||||
skinVertices = (SkinVertex*)SEGMENTED_TO_VIRTUAL(modif->skinVertices);
|
||||
limbTransformations = (SkinTransformation*)SEGMENTED_TO_VIRTUAL(modif->limbTransformations);
|
||||
|
||||
for (phi_s6 = temp_2; phi_s6 < temp_2 + temp_1; phi_s6++) {
|
||||
temp_a0_2 = phi_s6->unk_2;
|
||||
temp_v0 = (Struct_800A57C0*)SEGMENTED_TO_VIRTUAL(phi_s6->unk_8);
|
||||
temp_s3 = (Struct_800A598C_2*)SEGMENTED_TO_VIRTUAL(phi_s6->unk_C);
|
||||
|
||||
if (temp_a0_2 == 1) {
|
||||
if (transformCount == 1) {
|
||||
Vec3f spAC;
|
||||
|
||||
spAC.x = temp_s3[0].x;
|
||||
spAC.y = temp_s3[0].y;
|
||||
spAC.z = temp_s3[0].z;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[temp_s3[0].unk_0], &spAC, &spDC);
|
||||
spAC.x = limbTransformations[0].x;
|
||||
spAC.y = limbTransformations[0].y;
|
||||
spAC.z = limbTransformations[0].z;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[limbTransformations[0].limbIndex], &spAC, &vtxPoint);
|
||||
} else if (arg3 == 1) {
|
||||
Vec3f spA0;
|
||||
|
||||
phi_s0 = &temp_s3[phi_s6->unk_4];
|
||||
transformationEntry = &limbTransformations[modif->unk_4];
|
||||
|
||||
spA0.x = phi_s0->x;
|
||||
spA0.y = phi_s0->y;
|
||||
spA0.z = phi_s0->z;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[phi_s0->unk_0], &spA0, &spDC);
|
||||
spA0.x = transformationEntry->x;
|
||||
spA0.y = transformationEntry->y;
|
||||
spA0.z = transformationEntry->z;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &spA0, &vtxPoint);
|
||||
} else {
|
||||
Vec3f phi_f20;
|
||||
Vec3f sp88;
|
||||
|
||||
phi_f20.x = phi_f20.y = phi_f20.z = 0.0f;
|
||||
|
||||
for (phi_s0 = &temp_s3[0]; phi_s0 < &temp_s3[temp_a0_2]; phi_s0++) {
|
||||
temp_f20 = phi_s0->unk_8 * 0.01f;
|
||||
for (transformationEntry = &limbTransformations[0];
|
||||
transformationEntry < &limbTransformations[transformCount]; transformationEntry++) {
|
||||
scale = transformationEntry->scale * 0.01f;
|
||||
|
||||
sp88.x = transformationEntry->x;
|
||||
sp88.y = transformationEntry->y;
|
||||
sp88.z = transformationEntry->z;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &sp88, &spD0);
|
||||
|
||||
spD0.x *= scale;
|
||||
spD0.y *= scale;
|
||||
spD0.z *= scale;
|
||||
|
||||
sp88.x = phi_s0->x;
|
||||
sp88.y = phi_s0->y;
|
||||
sp88.z = phi_s0->z;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[phi_s0->unk_0], &sp88, &spD0);
|
||||
spD0.x *= temp_f20;
|
||||
spD0.y *= temp_f20;
|
||||
spD0.z *= temp_f20;
|
||||
phi_f20.x += spD0.x;
|
||||
phi_f20.y += spD0.y;
|
||||
phi_f20.z += spD0.z;
|
||||
}
|
||||
spDC.x = phi_f20.x;
|
||||
spDC.y = phi_f20.y;
|
||||
spDC.z = phi_f20.z;
|
||||
}
|
||||
func_800A57C0(&D_801600C0[temp_s3[phi_s6->unk_4].unk_0], temp_v0, phi_s6, spEC, &spDC);
|
||||
}
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, avb->buf[avb->unk_0]);
|
||||
|
||||
avb->unk_0 = (avb->unk_0 == 0) ? 1 : 0;
|
||||
vtxPoint.x = phi_f20.x;
|
||||
vtxPoint.y = phi_f20.y;
|
||||
vtxPoint.z = phi_f20.z;
|
||||
}
|
||||
|
||||
Skin_UpdateVertices(&gSkinLimbMatrices[limbTransformations[modif->unk_4].limbIndex], skinVertices, modif,
|
||||
vtxBuf, &vtxPoint);
|
||||
}
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, vtxEntry->buf[vtxEntry->index]);
|
||||
|
||||
vtxEntry->index = (vtxEntry->index == 0) ? 1 : 0;
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_skin.c", 344);
|
||||
}
|
||||
|
||||
void func_800A5E28(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3, s32 arg4) {
|
||||
/**
|
||||
* Draw a limb of type SKIN_LIMB_TYPE_ANIMATED, of the skeleton `skin` at index `limbIndex`
|
||||
* The vertices of this limb are modified dynamically
|
||||
*/
|
||||
void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags) {
|
||||
SkinLimb** skeleton;
|
||||
Struct_800A5E28* temp_t9;
|
||||
SkinAnimatedLimbData* data;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 364);
|
||||
|
||||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
temp_t9 = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
|
||||
if (!(arg4 & 1)) {
|
||||
func_800A598C(gfxCtx, skin, limbIndex, arg3);
|
||||
data = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
|
||||
|
||||
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) {
|
||||
Skin_ApplyLimbModifications(gfxCtx, skin, limbIndex, arg3);
|
||||
}
|
||||
gSPDisplayList(POLY_OPA_DISP++, temp_t9->unk_8);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, data->dlist);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_skin.c", 377);
|
||||
}
|
||||
|
||||
void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx* arg3, s32 arg4) {
|
||||
Gfx* gfx = arg3;
|
||||
/**
|
||||
* Draw a limb of type SKIN_LIMB_TYPE_NORMAL, of the skeleton `skin` at index `limbIndex`
|
||||
*/
|
||||
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags) {
|
||||
Gfx* gfx = dlistOverride;
|
||||
SkinLimb** skeleton;
|
||||
s32 pad;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 395);
|
||||
|
||||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
if (arg3 == NULL) {
|
||||
|
||||
if (dlistOverride == NULL) {
|
||||
gfx = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment;
|
||||
}
|
||||
|
||||
if (gfx != NULL) {
|
||||
Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &D_801600C0[limbIndex]);
|
||||
Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &gSkinLimbMatrices[limbIndex]);
|
||||
|
||||
if (mtx != NULL) {
|
||||
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
@@ -152,74 +181,89 @@ void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx*
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_skin.c", 433);
|
||||
}
|
||||
|
||||
void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5, s32 arg6, s32 arg7) {
|
||||
void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
|
||||
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
|
||||
s32 i;
|
||||
s32 dataType;
|
||||
s32 segmentType;
|
||||
SkinLimb** skeleton;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 471);
|
||||
if ((arg7 & 1) == 0) {
|
||||
func_800A6AC4(skin, &D_801600C0[0], actor, arg5);
|
||||
|
||||
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) {
|
||||
Skin_ApplyAnimTransformations(skin, gSkinLimbMatrices, actor, setTranslation);
|
||||
}
|
||||
|
||||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
if ((arg7 & 2) == 0) {
|
||||
|
||||
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) {
|
||||
Mtx* mtx;
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &skin->mtx);
|
||||
|
||||
if (mtx == NULL) {
|
||||
goto close_disps;
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
for (i = 0; i < skin->skeletonHeader->limbCount; i++) {
|
||||
s32 phi_a0 = 1;
|
||||
|
||||
if (arg4 != NULL) {
|
||||
phi_a0 = arg4(actor, globalCtx, i, skin);
|
||||
for (i = 0; i < skin->skeletonHeader->limbCount; i++) {
|
||||
s32 shouldDraw = true;
|
||||
|
||||
if (overrideLimbDraw != NULL) {
|
||||
shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin);
|
||||
}
|
||||
dataType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->unk_8;
|
||||
if (dataType == 4 && phi_a0 == 1) {
|
||||
func_800A5E28(gfxCtx, skin, i, arg6, arg7);
|
||||
} else if (dataType == 0xB && phi_a0 == 1) {
|
||||
func_800A5F60(gfxCtx, skin, i, NULL, arg7);
|
||||
|
||||
segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType;
|
||||
|
||||
if (segmentType == SKIN_LIMB_TYPE_ANIMATED && shouldDraw == true) {
|
||||
Skin_DrawAnimatedLimb(gfxCtx, skin, i, arg6, drawFlags);
|
||||
} else if (segmentType == SKIN_LIMB_TYPE_NORMAL && shouldDraw == true) {
|
||||
Skin_DrawLimb(gfxCtx, skin, i, NULL, drawFlags);
|
||||
}
|
||||
}
|
||||
if (callback != NULL) {
|
||||
callback(actor, globalCtx, skin);
|
||||
|
||||
if (postDraw != NULL) {
|
||||
postDraw(actor, globalCtx, skin);
|
||||
}
|
||||
|
||||
close_disps:
|
||||
CLOSE_DISPS(gfxCtx, "../z_skin.c", 534);
|
||||
}
|
||||
|
||||
void func_800A6330(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4) {
|
||||
func_800A60D8(this, globalCtx, skin, callback, NULL, arg4, 0, 0);
|
||||
// allows specifying PostLimbDraw and setTranslation
|
||||
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
|
||||
Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0);
|
||||
}
|
||||
|
||||
void func_800A6360(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5) {
|
||||
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, 0, 0);
|
||||
// allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation
|
||||
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
|
||||
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) {
|
||||
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
|
||||
}
|
||||
|
||||
void func_800A6394(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5, s32 arg6) {
|
||||
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, arg6, 0);
|
||||
// allows specifying OverrideLimbDraw, PostLimbDraw, setTranslation, and arg6
|
||||
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
|
||||
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) {
|
||||
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
|
||||
}
|
||||
|
||||
void func_800A63CC(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5, s32 arg6, s32 arg7) {
|
||||
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, arg6, arg7);
|
||||
// allows specifying all variables
|
||||
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
|
||||
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
|
||||
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags);
|
||||
}
|
||||
|
||||
void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3) {
|
||||
MtxF sp18;
|
||||
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) {
|
||||
MtxF mtxf;
|
||||
|
||||
SkinMatrix_MtxFMtxFMult(&skin->mtx, &D_801600C0[joint], &sp18);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&sp18, arg2, arg3);
|
||||
SkinMatrix_MtxFMtxFMult(&skin->mtx, &gSkinLimbMatrices[limbIndex], &mtxf);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&mtxf, offset, dst);
|
||||
}
|
||||
|
||||
+107
-77
@@ -1,131 +1,155 @@
|
||||
#include "global.h"
|
||||
#include "overlays/actors/ovl_En_fHG/z_en_fhg.h"
|
||||
|
||||
void func_800A6460(GlobalContext* globalCtx, PSkinAwb* skin, s32 limbIndex) {
|
||||
/**
|
||||
* Initialises the Vtx buffers used for limb at index `limbIndex`
|
||||
*/
|
||||
void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) {
|
||||
s32 i;
|
||||
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
Struct_800A5E28* temp_v1 = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
|
||||
Struct_800A598C* temp_v0 = SEGMENTED_TO_VIRTUAL(temp_v1->unk_4);
|
||||
Struct_800A598C* phi_s0;
|
||||
Struct_800A57C0* temp_s1;
|
||||
SkinAnimatedLimbData* animatedLimbData =
|
||||
SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
|
||||
SkinLimbModif* limbModifications = SEGMENTED_TO_VIRTUAL(animatedLimbData->limbModifications);
|
||||
SkinLimbModif* modifEntry;
|
||||
SkinVertex* skinVtxEntry;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
Vtx* temp2 = skin->avbTbl[limbIndex].buf[i];
|
||||
for (i = 0; i < ARRAY_COUNT(skin->vtxTable->buf); i++) {
|
||||
Vtx* vtxBuf = skin->vtxTable[limbIndex].buf[i];
|
||||
|
||||
for (phi_s0 = temp_v0; phi_s0 < temp_v0 + temp_v1->unk_2; phi_s0++) {
|
||||
Struct_800A57C0* phi_s1 = SEGMENTED_TO_VIRTUAL(phi_s0->unk_8);
|
||||
for (modifEntry = limbModifications; modifEntry < limbModifications + animatedLimbData->limbModifCount;
|
||||
modifEntry++) {
|
||||
SkinVertex* skinVertices = SEGMENTED_TO_VIRTUAL(modifEntry->skinVertices);
|
||||
|
||||
for (temp_s1 = phi_s1; temp_s1 < phi_s1 + phi_s0->unk_0; temp_s1++) {
|
||||
Vtx* temp_t5_3 = &temp2[temp_s1->unk_0];
|
||||
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount]; skinVtxEntry++) {
|
||||
Vtx* vtx = &vtxBuf[skinVtxEntry->index];
|
||||
|
||||
temp_t5_3->v.flag = 0;
|
||||
temp_t5_3->v.tc[0] = temp_s1->unk_2;
|
||||
temp_t5_3->v.tc[1] = temp_s1->unk_4;
|
||||
temp_t5_3->v.cn[3] = temp_s1->unk_9;
|
||||
vtx->n.flag = 0;
|
||||
vtx->n.tc[0] = skinVtxEntry->s;
|
||||
vtx->n.tc[1] = skinVtxEntry->t;
|
||||
vtx->n.a = skinVtxEntry->alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* skeletonHeader,
|
||||
AnimationHeader* animationHeader) {
|
||||
/**
|
||||
* Initializes a skin skeleton to looping animation, dynamically allocating the frame tables,
|
||||
* and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs
|
||||
*/
|
||||
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
|
||||
s32 limbCount;
|
||||
s32 i;
|
||||
SkinLimb** skeleton;
|
||||
SkeletonHeader* virtSkelHeader = SEGMENTED_TO_VIRTUAL(skeletonHeader);
|
||||
|
||||
skin->avbCount = virtSkelHeader->limbCount;
|
||||
skin->limbCount = virtSkelHeader->limbCount;
|
||||
skin->skeletonHeader = virtSkelHeader;
|
||||
|
||||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
limbCount = skin->skeletonHeader->limbCount;
|
||||
skin->avbTbl = ZeldaArena_MallocDebug(limbCount * sizeof(SkinAvb), "../z_skin_awb.c", 212);
|
||||
|
||||
ASSERT(skin->avbTbl != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214);
|
||||
skin->vtxTable = ZeldaArena_MallocDebug(limbCount * sizeof(SkinLimbVtx), "../z_skin_awb.c", 212);
|
||||
|
||||
ASSERT(skin->vtxTable != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214);
|
||||
|
||||
for (i = 0; i < limbCount; i++) {
|
||||
SkinAvb* avbEntry = &skin->avbTbl[i];
|
||||
SkinLimbVtx* vtxEntry = &skin->vtxTable[i];
|
||||
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
|
||||
|
||||
if ((limb->unk_8 != 4) || (limb->segment == NULL)) {
|
||||
avbEntry->unk_0 = 0;
|
||||
if ((limb->segmentType != SKIN_LIMB_TYPE_ANIMATED) || (limb->segment == NULL)) {
|
||||
vtxEntry->index = 0;
|
||||
|
||||
avbEntry->buf[0] = NULL;
|
||||
avbEntry->buf[1] = NULL;
|
||||
vtxEntry->buf[0] = NULL;
|
||||
vtxEntry->buf[1] = NULL;
|
||||
} else {
|
||||
Struct_800A5E28* temp_s1 = SEGMENTED_TO_VIRTUAL(((void)0, limb->segment));
|
||||
SkinAnimatedLimbData* animatedLimbData = SEGMENTED_TO_VIRTUAL(((void)0, limb->segment));
|
||||
|
||||
avbEntry->unk_0 = 0;
|
||||
avbEntry->buf[0] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 235);
|
||||
ASSERT(avbEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237);
|
||||
avbEntry->buf[1] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 240);
|
||||
ASSERT(avbEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
|
||||
func_800A6460(globalCtx, skin, i);
|
||||
vtxEntry->index = 0;
|
||||
|
||||
vtxEntry->buf[0] =
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 235);
|
||||
ASSERT(vtxEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237);
|
||||
|
||||
vtxEntry->buf[1] =
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 240);
|
||||
ASSERT(vtxEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
|
||||
|
||||
Skin_InitAnimatedLimb(globalCtx, skin, i);
|
||||
}
|
||||
if (1) {}
|
||||
}
|
||||
|
||||
SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader);
|
||||
}
|
||||
|
||||
void func_800A6888(GlobalContext* globalCtx, PSkinAwb* arg1) {
|
||||
if (arg1->avbTbl != NULL) {
|
||||
/**
|
||||
* Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables
|
||||
*/
|
||||
void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
|
||||
if (skin->vtxTable != NULL) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < arg1->avbCount; i++) {
|
||||
if (arg1->avbTbl[i].buf[0] != 0) {
|
||||
ZeldaArena_FreeDebug(arg1->avbTbl[i].buf[0], "../z_skin_awb.c", 276);
|
||||
arg1->avbTbl[i].buf[0] = 0;
|
||||
for (i = 0; i < skin->limbCount; i++) {
|
||||
if (skin->vtxTable[i].buf[0] != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[0], "../z_skin_awb.c", 276);
|
||||
skin->vtxTable[i].buf[0] = NULL;
|
||||
}
|
||||
if (arg1->avbTbl[i].buf[1] != 0) {
|
||||
ZeldaArena_FreeDebug(arg1->avbTbl[i].buf[1], "../z_skin_awb.c", 280);
|
||||
arg1->avbTbl[i].buf[1] = 0;
|
||||
if (skin->vtxTable[i].buf[1] != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[1], "../z_skin_awb.c", 280);
|
||||
skin->vtxTable[i].buf[1] = NULL;
|
||||
}
|
||||
}
|
||||
if (arg1->avbTbl != NULL) {
|
||||
ZeldaArena_FreeDebug(arg1->avbTbl, "../z_skin_awb.c", 286);
|
||||
|
||||
if (skin->vtxTable != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable, "../z_skin_awb.c", 286);
|
||||
}
|
||||
SkelAnime_Free(&arg1->skelAnime, globalCtx);
|
||||
|
||||
SkelAnime_Free(&skin->skelAnime, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800A698C(PSkinAwb* skin, SkinLimb** skeleton, MtxF* mf, u8 parentIndex, u8 limbIndex) {
|
||||
s32 func_800A698C(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parentIndex, u8 limbIndex) {
|
||||
s32 pad;
|
||||
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
|
||||
MtxF* mtx;
|
||||
s32 temp_ret;
|
||||
s32 ret;
|
||||
MtxF sp28;
|
||||
|
||||
if (parentIndex == 0xFF) {
|
||||
if (parentIndex == LIMB_DONE) {
|
||||
SkinMatrix_GetClear(&mtx);
|
||||
} else {
|
||||
mtx = &mf[(s32)parentIndex];
|
||||
mtx = &limbMatrices[(s32)parentIndex];
|
||||
}
|
||||
|
||||
SkinMatrix_MtxFMtxFMult(mtx, &mf[limbIndex], &sp28);
|
||||
SkinMatrix_MtxFCopy(&sp28, &mf[limbIndex]);
|
||||
SkinMatrix_MtxFMtxFMult(mtx, &limbMatrices[limbIndex], &sp28);
|
||||
SkinMatrix_MtxFCopy(&sp28, &limbMatrices[limbIndex]);
|
||||
|
||||
if (limb->child != 0xFF) {
|
||||
temp_ret = func_800A698C(skin, skeleton, mf, limbIndex, limb->child);
|
||||
if (temp_ret) { // func_800A698C only returns false
|
||||
return temp_ret;
|
||||
if (limb->child != LIMB_DONE) {
|
||||
ret = func_800A698C(skin, skeleton, limbMatrices, limbIndex, limb->child);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (limb->sibling != 0xFF) {
|
||||
temp_ret = func_800A698C(skin, skeleton, mf, parentIndex, limb->sibling);
|
||||
if (temp_ret) { // func_800A698C only returns false
|
||||
return temp_ret;
|
||||
if (limb->sibling != LIMB_DONE) {
|
||||
ret = func_800A698C(skin, skeleton, limbMatrices, parentIndex, limb->sibling);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
|
||||
/**
|
||||
* Recursively applies matrix tranformations to each limb
|
||||
*/
|
||||
s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation) {
|
||||
s32 i;
|
||||
s32 pad;
|
||||
f32 yRot;
|
||||
f32 xRot;
|
||||
f32 zRot;
|
||||
s32 temp_ret;
|
||||
s32 ret;
|
||||
f32 yTransl;
|
||||
f32 xTransl;
|
||||
f32 zTransl;
|
||||
@@ -133,28 +157,33 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
|
||||
Vec3s* jointRot = &skin->skelAnime.jointTable[0];
|
||||
|
||||
jointRot++;
|
||||
xRot = jointRot[0].x;
|
||||
yRot = jointRot[0].y;
|
||||
zRot = jointRot[0].z;
|
||||
|
||||
if (arg3 != 0) {
|
||||
xRot = jointRot->x;
|
||||
yRot = jointRot->y;
|
||||
zRot = jointRot->z;
|
||||
|
||||
if (setTranslation) {
|
||||
jointRot--; // access joint table entry 0 for translation data
|
||||
|
||||
xTransl = jointRot->x;
|
||||
yTransl = jointRot->y;
|
||||
zTransl = jointRot->z;
|
||||
|
||||
jointRot--;
|
||||
xTransl = jointRot[0].x;
|
||||
yTransl = jointRot[0].y;
|
||||
zTransl = jointRot[0].z;
|
||||
jointRot++;
|
||||
|
||||
if (arg3 == 0x23) {
|
||||
if (setTranslation == SKIN_TRANSFORM_IS_FHG) {
|
||||
EnfHG* horse = (EnfHG*)actor;
|
||||
|
||||
yRot += horse->turnRot;
|
||||
}
|
||||
SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, xTransl, yTransl, zTransl);
|
||||
|
||||
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, xTransl, yTransl, zTransl);
|
||||
} else {
|
||||
SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, 0.0f, 0.0f, 0.0f);
|
||||
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
jointRot++;
|
||||
|
||||
for (i = 1; i < skin->skeletonHeader->limbCount; i++) {
|
||||
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
|
||||
|
||||
@@ -165,7 +194,7 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
|
||||
yRot = jointRot->y;
|
||||
zRot = jointRot->z;
|
||||
jointRot++;
|
||||
SkinMatrix_SetTranslateRotateZYX(&arg1[i], xRot, yRot, zRot, xTransl, yTransl, zTransl);
|
||||
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[i], xRot, yRot, zRot, xTransl, yTransl, zTransl);
|
||||
}
|
||||
|
||||
SkinMatrix_SetTranslateRotateYXZScale(
|
||||
@@ -173,9 +202,10 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
|
||||
actor->shape.rot.z, actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z);
|
||||
|
||||
temp_ret = func_800A698C(skin, SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment), arg1, 0xFF, 0);
|
||||
if (!temp_ret) { // func_800A698C only returns false
|
||||
return temp_ret;
|
||||
ret = func_800A698C(skin, SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment), limbMatrices, LIMB_DONE, 0);
|
||||
if (!ret) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+17
-16
@@ -604,9 +604,10 @@ Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces a matrix which rotates vectors by angle a around a unit vector with components (x,y,z)
|
||||
* Produces a matrix which rotates by binary angle `angle` around a unit vector (`axisX`,`axisY`,`axisZ`).
|
||||
* NB: the rotation axis is assumed to be a unit vector.
|
||||
*/
|
||||
void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
|
||||
void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ) {
|
||||
f32 sinA;
|
||||
f32 cosA;
|
||||
f32 xx;
|
||||
@@ -617,28 +618,28 @@ void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
|
||||
f32 xz;
|
||||
f32 pad;
|
||||
|
||||
sinA = Math_SinS(a);
|
||||
cosA = Math_CosS(a);
|
||||
sinA = Math_SinS(angle);
|
||||
cosA = Math_CosS(angle);
|
||||
|
||||
xx = x * x;
|
||||
yy = y * y;
|
||||
zz = z * z;
|
||||
xy = x * y;
|
||||
yz = y * z;
|
||||
xz = x * z;
|
||||
xx = axisX * axisX;
|
||||
yy = axisY * axisY;
|
||||
zz = axisZ * axisZ;
|
||||
xy = axisX * axisY;
|
||||
yz = axisY * axisZ;
|
||||
xz = axisX * axisZ;
|
||||
|
||||
mf->xx = (1.0f - xx) * cosA + xx;
|
||||
mf->yx = (1.0f - cosA) * xy + z * sinA;
|
||||
mf->zx = (1.0f - cosA) * xz - y * sinA;
|
||||
mf->yx = (1.0f - cosA) * xy + axisZ * sinA;
|
||||
mf->zx = (1.0f - cosA) * xz - axisY * sinA;
|
||||
mf->wx = 0.0f;
|
||||
|
||||
mf->xy = (1.0f - cosA) * xy - z * sinA;
|
||||
mf->xy = (1.0f - cosA) * xy - axisZ * sinA;
|
||||
mf->yy = (1.0f - yy) * cosA + yy;
|
||||
mf->zy = (1.0f - cosA) * yz + x * sinA;
|
||||
mf->zy = (1.0f - cosA) * yz + axisX * sinA;
|
||||
mf->wy = 0.0f;
|
||||
|
||||
mf->xz = (1.0f - cosA) * xz + y * sinA;
|
||||
mf->yz = (1.0f - cosA) * yz - x * sinA;
|
||||
mf->xz = (1.0f - cosA) * xz + axisY * sinA;
|
||||
mf->yz = (1.0f - cosA) * yz - axisX * sinA;
|
||||
mf->zz = (1.0f - zz) * cosA + zz;
|
||||
mf->wz = 0.0f;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
void func_8006BA00(GlobalContext* globalCtx) {
|
||||
void SoundSource_InitAll(GlobalContext* globalCtx) {
|
||||
SoundSource* sources = &globalCtx->soundSources[0];
|
||||
s32 i;
|
||||
|
||||
@@ -9,16 +9,16 @@ void func_8006BA00(GlobalContext* globalCtx) {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void func_8006BA30(GlobalContext* globalCtx) {
|
||||
void SoundSource_UpdateAll(GlobalContext* globalCtx) {
|
||||
SoundSource* source = &globalCtx->soundSources[0];
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
|
||||
if (source->countdown != 0) {
|
||||
if (DECR(source->countdown) == 0) {
|
||||
Audio_StopSfxByPos(&source->relativePos);
|
||||
Audio_StopSfxByPos(&source->projectedPos);
|
||||
} else {
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->originPos, &source->relativePos);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void func_8006BA30(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos, s32 duration, u16 sfxId) {
|
||||
void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) {
|
||||
s32 countdown;
|
||||
SoundSource* source;
|
||||
s32 smallestCountdown = 0xFFFF;
|
||||
@@ -39,6 +39,7 @@ void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos, s32 duratio
|
||||
break;
|
||||
}
|
||||
|
||||
// Store the sound source with the smallest remaining countdown
|
||||
countdown = source->countdown;
|
||||
if (countdown < smallestCountdown) {
|
||||
smallestCountdown = countdown;
|
||||
@@ -47,14 +48,15 @@ void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos, s32 duratio
|
||||
source++;
|
||||
}
|
||||
|
||||
// If no sound source is available, replace the sound source with the smallest remaining countdown
|
||||
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
|
||||
source = backupSource;
|
||||
Audio_StopSfxByPos(&source->relativePos);
|
||||
Audio_StopSfxByPos(&source->projectedPos);
|
||||
}
|
||||
|
||||
source->originPos = *pos;
|
||||
source->worldPos = *worldPos;
|
||||
source->countdown = duration;
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->originPos, &source->relativePos);
|
||||
Audio_PlaySoundGeneral(sfxId, &source->relativePos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
|
||||
Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
+2
-2
@@ -59,7 +59,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 entranceIndex;
|
||||
/* 0x04 */ s32 linkAge; // 0: Adult; 1: Child
|
||||
/* 0x04 */ s32 linkAge;
|
||||
/* 0x08 */ s32 cutsceneIndex;
|
||||
/* 0x0C */ u16 dayTime; // "zelda_time"
|
||||
/* 0x10 */ s32 nightFlag;
|
||||
@@ -682,7 +682,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
}
|
||||
|
||||
gSaveContext.entranceIndex = 0xBB;
|
||||
gSaveContext.linkAge = 1;
|
||||
gSaveContext.linkAge = LINK_AGE_CHILD;
|
||||
gSaveContext.dayTime = 0x6AAB;
|
||||
gSaveContext.cutsceneIndex = 0xFFF1;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
extern __OSInode __osPfsInodeCache; // bss
|
||||
s32 __osPfsInodeCacheChannel = -1;
|
||||
u8 __osPfsInodeCacheBank = 250;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ OSMgrArgs __osPiDevMgr = { 0 };
|
||||
OSPiHandle __Dom1SpeedParam;
|
||||
OSPiHandle __Dom2SpeedParam;
|
||||
OSThread piThread;
|
||||
u8 piStackThread[0x1000];
|
||||
STACK(piStackThread, 0x1000);
|
||||
OSMesgQueue piEventQueue;
|
||||
OSMesg piEventBuf[2];
|
||||
OSThread __osThreadSave;
|
||||
@@ -46,7 +46,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
|
||||
__osPiDevMgr.piDmaCallback = __osPiRawStartDma;
|
||||
__osPiDevMgr.epiDmaCallback = __osEPiRawStartDma;
|
||||
|
||||
osCreateThread(&piThread, 0, __osDevMgrMain, (void*)&__osPiDevMgr, piStackThread + sizeof(piStackThread), pri);
|
||||
osCreateThread(&piThread, 0, __osDevMgrMain, (void*)&__osPiDevMgr, STACK_TOP(piStackThread), pri);
|
||||
osStartThread(&piThread);
|
||||
|
||||
__osRestoreInt(prevInt);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ultra64/internal.h"
|
||||
|
||||
OSThread viThread;
|
||||
u8 viThreadStack[0x1000];
|
||||
STACK(viThreadStack, 0x1000);
|
||||
OSMesgQueue viEventQueue;
|
||||
OSMesg viEventBuf[6];
|
||||
OSIoMesg viRetraceMsg;
|
||||
@@ -45,7 +45,7 @@ void osCreateViManager(OSPri pri) {
|
||||
__osViDevMgr.piDmaCallback = NULL;
|
||||
__osViDevMgr.epiDmaCallback = NULL;
|
||||
|
||||
osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack + sizeof(viThreadStack), pri);
|
||||
osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, STACK_TOP(viThreadStack), pri);
|
||||
__osViInit();
|
||||
osStartThread(&viThread);
|
||||
__osRestoreInt(prevInt);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
OSThread* __osThreadTail[2] = { NULL, (OSThread*)-1 };
|
||||
OSThread* __osThreadTail[2] = { NULL, (OSThread*)OS_PRIORITY_THREADTAIL };
|
||||
OSThread* __osRunQueue = (OSThread*)__osThreadTail;
|
||||
OSThread* __osActiveQueue = (OSThread*)__osThreadTail;
|
||||
OSThread* __osRunningThread = NULL;
|
||||
|
||||
@@ -16,7 +16,7 @@ void osDestroyThread(OSThread* thread) {
|
||||
__osActiveQueue = __osActiveQueue->tlnext;
|
||||
} else {
|
||||
s1 = __osActiveQueue;
|
||||
while (s1->priority != -1) {
|
||||
while (s1->priority != OS_PRIORITY_THREADTAIL) {
|
||||
s2 = s1->tlnext;
|
||||
if (s2 == thread) {
|
||||
s1->tlnext = thread->tlnext;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Arms_Hook
|
||||
z_arms_hook.c
|
||||
@@ -1,8 +1,7 @@
|
||||
#include "z_arms_hook.h"
|
||||
#include "objects/object_link_boy/object_link_boy.h"
|
||||
|
||||
#define FLAGS 0x00000030
|
||||
|
||||
#define THIS ((ArmsHook*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
|
||||
|
||||
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -59,15 +58,12 @@ static Vec3f D_80865B94 = { 0.0f, -500.0f, -3000.0f };
|
||||
static Vec3f D_80865BA0 = { 0.0f, 500.0f, 1200.0f };
|
||||
static Vec3f D_80865BAC = { 0.0f, -500.0f, 1200.0f };
|
||||
|
||||
extern Gfx D_0602B288[];
|
||||
extern Gfx D_0602AFF0[];
|
||||
|
||||
void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArmsHook* this = THIS;
|
||||
ArmsHook* this = (ArmsHook*)thisx;
|
||||
|
||||
Collider_InitQuad(globalCtx, &this->collider);
|
||||
Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit);
|
||||
@@ -76,10 +72,10 @@ void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArmsHook* this = THIS;
|
||||
ArmsHook* this = (ArmsHook*)thisx;
|
||||
|
||||
if (this->grabbed != NULL) {
|
||||
this->grabbed->flags &= ~0x2000;
|
||||
this->grabbed->flags &= ~ACTOR_FLAG_13;
|
||||
}
|
||||
Collider_DestroyQuad(globalCtx, &this->collider);
|
||||
}
|
||||
@@ -115,7 +111,7 @@ s32 ArmsHook_AttachToPlayer(ArmsHook* this, Player* player) {
|
||||
|
||||
void ArmsHook_DetachHookFromActor(ArmsHook* this) {
|
||||
if (this->grabbed != NULL) {
|
||||
this->grabbed->flags &= ~0x2000;
|
||||
this->grabbed->flags &= ~ACTOR_FLAG_13;
|
||||
this->grabbed = NULL;
|
||||
}
|
||||
}
|
||||
@@ -124,8 +120,8 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
|
||||
Player* player = (Player*)this->actor.parent;
|
||||
|
||||
if (Player_HoldsHookshot(player)) {
|
||||
if ((player->itemActionParam != player->heldItemActionParam) || ((player->actor.flags & 0x100)) ||
|
||||
((player->stateFlags1 & 0x4000080))) {
|
||||
if ((player->itemActionParam != player->heldItemActionParam) || (player->actor.flags & ACTOR_FLAG_8) ||
|
||||
((player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_26)))) {
|
||||
this->timer = 0;
|
||||
ArmsHook_DetachHookFromActor(this);
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &player->unk_3C8);
|
||||
@@ -136,7 +132,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
|
||||
}
|
||||
|
||||
void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
|
||||
actor->flags |= 0x2000;
|
||||
actor->flags |= ACTOR_FLAG_13;
|
||||
this->grabbed = actor;
|
||||
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff);
|
||||
}
|
||||
@@ -175,10 +171,10 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) &&
|
||||
(this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
|
||||
touchedActor = this->collider.base.at;
|
||||
if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
|
||||
if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) {
|
||||
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HOOKABLE) {
|
||||
ArmsHook_AttachHookToActor(this, touchedActor);
|
||||
if ((touchedActor->flags & 0x400) == 0x400) {
|
||||
if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_10)) {
|
||||
func_80865044(this);
|
||||
}
|
||||
}
|
||||
@@ -189,7 +185,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
} else if (DECR(this->timer) == 0) {
|
||||
grabbed = this->grabbed;
|
||||
if (grabbed != NULL) {
|
||||
if ((grabbed->update == NULL) || (grabbed->flags & 0x2000) != 0x2000) {
|
||||
if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) {
|
||||
grabbed = NULL;
|
||||
this->grabbed = NULL;
|
||||
} else if (this->actor.child != NULL) {
|
||||
@@ -292,7 +288,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArmsHook* this = THIS;
|
||||
ArmsHook* this = (ArmsHook*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->unk_1F4 = this->unk_1E8;
|
||||
@@ -300,7 +296,7 @@ void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
ArmsHook* this = THIS;
|
||||
ArmsHook* this = (ArmsHook*)thisx;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3f sp78;
|
||||
Vec3f sp6C;
|
||||
@@ -326,7 +322,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_0602B288);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);
|
||||
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
|
||||
Math_Vec3f_Diff(&player->unk_3C8, &this->actor.world.pos, &sp78);
|
||||
sp58 = SQ(sp78.x) + SQ(sp78.z);
|
||||
@@ -336,7 +332,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_0602AFF0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Arrow_Fire
|
||||
z_arrow_fire.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_arrow_fire.h"
|
||||
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
|
||||
|
||||
#define FLAGS 0x02000010
|
||||
|
||||
#define THIS ((ArrowFire*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
|
||||
|
||||
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -43,7 +41,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowFire* this = THIS;
|
||||
ArrowFire* this = (ArrowFire*)thisx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->radius = 0;
|
||||
@@ -180,7 +178,7 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowFire* this = THIS;
|
||||
ArrowFire* this = (ArrowFire*)thisx;
|
||||
|
||||
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
|
||||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
|
||||
@@ -191,7 +189,7 @@ void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
ArrowFire* this = THIS;
|
||||
ArrowFire* this = (ArrowFire*)thisx;
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
u32 stateFrames;
|
||||
EnArrow* arrow;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Arrow_Ice
|
||||
z_arrow_ice.c
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
|
||||
|
||||
#define FLAGS 0x02000010
|
||||
|
||||
#define THIS ((ArrowIce*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
|
||||
|
||||
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -44,7 +42,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowIce* this = THIS;
|
||||
ArrowIce* this = (ArrowIce*)thisx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->radius = 0;
|
||||
@@ -181,7 +179,7 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowIce* this = THIS;
|
||||
ArrowIce* this = (ArrowIce*)thisx;
|
||||
|
||||
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
|
||||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
|
||||
@@ -192,7 +190,7 @@ void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowIce* this = THIS;
|
||||
ArrowIce* this = (ArrowIce*)thisx;
|
||||
s32 pad;
|
||||
Actor* tranform;
|
||||
u32 stateFrames = globalCtx->state.frames;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Arrow_Light
|
||||
z_arrow_light.c
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
|
||||
|
||||
#define FLAGS 0x02000010
|
||||
|
||||
#define THIS ((ArrowLight*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
|
||||
|
||||
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -44,7 +42,7 @@ void ArrowLight_SetupAction(ArrowLight* this, ArrowLightActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowLight* this = THIS;
|
||||
ArrowLight* this = (ArrowLight*)thisx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->radius = 0;
|
||||
@@ -179,7 +177,7 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowLight* this = THIS;
|
||||
ArrowLight* this = (ArrowLight*)thisx;
|
||||
|
||||
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
|
||||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
|
||||
@@ -190,7 +188,7 @@ void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ArrowLight* this = THIS;
|
||||
ArrowLight* this = (ArrowLight*)thisx;
|
||||
s32 pad;
|
||||
u32 stateFrames = globalCtx->state.frames;
|
||||
EnArrow* arrow = (EnArrow*)this->actor.parent;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Bdan_Objects
|
||||
z_bg_bdan_objects.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_bg_bdan_objects.h"
|
||||
#include "objects/object_bdan_objects/object_bdan_objects.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgBdanObjects*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -108,7 +106,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) {
|
||||
|
||||
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgBdanObjects* this = THIS;
|
||||
BgBdanObjects* this = (BgBdanObjects*)thisx;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
@@ -116,7 +114,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->switchFlag = (thisx->params >> 8) & 0x3F;
|
||||
thisx->params &= 0xFF;
|
||||
if (thisx->params == 2) {
|
||||
thisx->flags |= 0x30;
|
||||
thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5;
|
||||
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y;
|
||||
this->actionFunc = func_8086C9A8;
|
||||
return;
|
||||
@@ -165,7 +163,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanObjects* this = THIS;
|
||||
BgBdanObjects* this = (BgBdanObjects*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
if (thisx->params == 0) {
|
||||
@@ -439,14 +437,14 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanObjects* this = THIS;
|
||||
BgBdanObjects* this = (BgBdanObjects*)thisx;
|
||||
|
||||
Actor_SetFocus(thisx, 50.0f);
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanObjects* this = THIS;
|
||||
BgBdanObjects* this = (BgBdanObjects*)thisx;
|
||||
|
||||
if (thisx->params == 0) {
|
||||
if (this->actionFunc == func_8086C054) {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Bdan_Switch
|
||||
z_bg_bdan_switch.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_bg_bdan_switch.h"
|
||||
#include "objects/object_bdan_objects/object_bdan_objects.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgBdanSwitch*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -136,7 +134,7 @@ void func_8086D0EC(BgBdanSwitch* this) {
|
||||
}
|
||||
|
||||
void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanSwitch* this = THIS;
|
||||
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
|
||||
s32 pad;
|
||||
s16 type;
|
||||
s32 flag;
|
||||
@@ -162,7 +160,7 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
case YELLOW_TALL_1:
|
||||
case YELLOW_TALL_2:
|
||||
BgBdanSwitch_InitCollision(this, globalCtx);
|
||||
this->dyna.actor.flags |= 1;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_0;
|
||||
this->dyna.actor.targetMode = 4;
|
||||
break;
|
||||
}
|
||||
@@ -203,7 +201,7 @@ void BgBdanSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBdanSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanSwitch* this = THIS;
|
||||
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
|
||||
|
||||
switch (this->dyna.actor.params & 0xFF) {
|
||||
case BLUE:
|
||||
@@ -484,7 +482,7 @@ void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) {
|
||||
|
||||
void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgBdanSwitch* this = THIS;
|
||||
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
|
||||
s32 type;
|
||||
|
||||
if (this->unk_1DA > 0) {
|
||||
@@ -508,15 +506,15 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, Gfx* dlist) {
|
||||
func_800D1694(this->dyna.actor.world.pos.x,
|
||||
this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0),
|
||||
this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
|
||||
Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x,
|
||||
this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0),
|
||||
this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot);
|
||||
Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY);
|
||||
Gfx_DrawDListOpa(globalCtx, dlist);
|
||||
}
|
||||
|
||||
void BgBdanSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBdanSwitch* this = THIS;
|
||||
BgBdanSwitch* this = (BgBdanSwitch*)thisx;
|
||||
|
||||
switch (this->dyna.actor.params & 0xFF) {
|
||||
case YELLOW_HEAVY:
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Bom_Guard
|
||||
z_bg_bom_guard.c
|
||||
@@ -9,9 +9,7 @@
|
||||
#include "objects/object_bowl/object_bowl.h"
|
||||
#include "vt.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgBomGuard*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -36,7 +34,7 @@ void BgBomGuard_SetupAction(BgBomGuard* this, BgBomGuardActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBomGuard* this = THIS;
|
||||
BgBomGuard* this = (BgBomGuard*)thisx;
|
||||
s32 pad[2];
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
@@ -55,7 +53,7 @@ void BgBomGuard_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBomGuard_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBomGuard* this = THIS;
|
||||
BgBomGuard* this = (BgBomGuard*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
@@ -85,7 +83,7 @@ void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBomGuard_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBomGuard* this = THIS;
|
||||
BgBomGuard* this = (BgBomGuard*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Bombwall
|
||||
z_bg_bombwall.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_bg_bombwall.h"
|
||||
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
|
||||
#define FLAGS 0x00400000
|
||||
|
||||
#define THIS ((BgBombwall*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_22
|
||||
|
||||
void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -117,7 +115,7 @@ void BgBombwall_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Vec3f vecs[3];
|
||||
Vec3f sp80;
|
||||
s32 pad;
|
||||
BgBombwall* this = THIS;
|
||||
BgBombwall* this = (BgBombwall*)thisx;
|
||||
f32 sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
@@ -168,7 +166,7 @@ void BgBombwall_DestroyCollision(BgBombwall* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBombwall* this = THIS;
|
||||
BgBombwall* this = (BgBombwall*)thisx;
|
||||
|
||||
BgBombwall_DestroyCollision(this, globalCtx);
|
||||
}
|
||||
@@ -247,7 +245,7 @@ void func_8086EE94(BgBombwall* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBombwall* this = THIS;
|
||||
BgBombwall* this = (BgBombwall*)thisx;
|
||||
|
||||
if (this->actionFunc != NULL) {
|
||||
this->actionFunc(this, globalCtx);
|
||||
@@ -255,7 +253,7 @@ void BgBombwall_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBombwall* this = THIS;
|
||||
BgBombwall* this = (BgBombwall*)thisx;
|
||||
|
||||
Gfx_DrawDListOpa(globalCtx, this->dList);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Bowl_Wall
|
||||
z_bg_bowl_wall.c
|
||||
@@ -10,9 +10,7 @@
|
||||
#include "objects/object_bowl/object_bowl.h"
|
||||
#include "vt.h"
|
||||
|
||||
#define FLAGS 0x00000030
|
||||
|
||||
#define THIS ((BgBowlWall*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
|
||||
|
||||
void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -47,7 +45,7 @@ static Vec3f sBullseyeOffset[] = {
|
||||
static s16 sTargetRot[] = { 0x0000, 0x0000, 0x3FFF, -0x3FFF };
|
||||
|
||||
void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBowlWall* this = THIS;
|
||||
BgBowlWall* this = (BgBowlWall*)thisx;
|
||||
s32 pad1;
|
||||
s32 pad2;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
@@ -69,7 +67,7 @@ void BgBowlWall_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBowlWall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBowlWall* this = THIS;
|
||||
BgBowlWall* this = (BgBowlWall*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
@@ -189,7 +187,7 @@ void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBowlWall* this = THIS;
|
||||
BgBowlWall* this = (BgBowlWall*)thisx;
|
||||
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
@@ -200,7 +198,7 @@ void BgBowlWall_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
void BgBowlWall_Draw(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
BgBowlWall* this = THIS;
|
||||
BgBowlWall* this = (BgBowlWall*)thisx;
|
||||
u32 frames;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_bowl_wall.c", 441);
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Breakwall
|
||||
z_bg_breakwall.c
|
||||
@@ -9,9 +9,7 @@
|
||||
#include "objects/object_bwall/object_bwall.h"
|
||||
#include "objects/object_kingdodongo/object_kingdodongo.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgBreakwall*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ CollisionHeader* colHeader;
|
||||
@@ -79,7 +77,7 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc
|
||||
}
|
||||
|
||||
void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBreakwall* this = THIS;
|
||||
BgBreakwall* this = (BgBreakwall*)thisx;
|
||||
s32 pad;
|
||||
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
|
||||
|
||||
@@ -116,7 +114,7 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBreakwall* this = THIS;
|
||||
BgBreakwall* this = (BgBreakwall*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
@@ -210,7 +208,7 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, GlobalContext* globalCtx) {
|
||||
|
||||
this->dyna.actor.objBankIndex = this->bankIndex;
|
||||
Actor_SetObjectDependency(globalCtx, &this->dyna.actor);
|
||||
this->dyna.actor.flags &= ~0x10;
|
||||
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
|
||||
this->dyna.actor.draw = BgBreakwall_Draw;
|
||||
CollisionHeader_GetVirtual(sBombableWallInfo[wallType].colHeader, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
@@ -276,7 +274,7 @@ void BgBreakwall_LavaCoverMove(BgBreakwall* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgBreakwall* this = THIS;
|
||||
BgBreakwall* this = (BgBreakwall*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
@@ -292,7 +290,7 @@ static Vec3f sColQuadList[][4] = {
|
||||
|
||||
void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgBreakwall* this = THIS;
|
||||
BgBreakwall* this = (BgBreakwall*)thisx;
|
||||
|
||||
if (this->bombableWallDList != NULL) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_breakwall.c", 767);
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Ddan_Jd
|
||||
z_bg_ddan_jd.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_bg_ddan_jd.h"
|
||||
#include "objects/object_ddan_objects/object_ddan_objects.h"
|
||||
|
||||
#define FLAGS 0x00000030
|
||||
|
||||
#define THIS ((BgDdanJd*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
|
||||
|
||||
void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -54,7 +52,7 @@ typedef enum {
|
||||
|
||||
void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgDdanJd* this = THIS;
|
||||
BgDdanJd* this = (BgDdanJd*)thisx;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
@@ -76,7 +74,7 @@ void BgDdanJd_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgDdanJd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDdanJd* this = THIS;
|
||||
BgDdanJd* this = (BgDdanJd*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
@@ -171,7 +169,7 @@ void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgDdanJd_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDdanJd* this = THIS;
|
||||
BgDdanJd* this = (BgDdanJd*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Ddan_Kd
|
||||
z_bg_ddan_kd.c
|
||||
@@ -7,9 +7,7 @@
|
||||
#include "z_bg_ddan_kd.h"
|
||||
#include "objects/object_ddan_objects/object_ddan_objects.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgDdanKd*)thisx)
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -18,7 +16,7 @@ void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx);
|
||||
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx);
|
||||
void func_80871838(BgDdanKd* this, GlobalContext* globalCtx);
|
||||
void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Bg_Ddan_Kd_InitVars = {
|
||||
ACTOR_BG_DDAN_KD,
|
||||
@@ -64,7 +62,7 @@ void BgDdanKd_SetupAction(BgDdanKd* this, BgDdanKdActionFunc actionFunc) {
|
||||
}
|
||||
|
||||
void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDdanKd* this = THIS;
|
||||
BgDdanKd* this = (BgDdanKd*)thisx;
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
@@ -78,16 +76,16 @@ void BgDdanKd_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params) == 0) {
|
||||
if (!Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
|
||||
BgDdanKd_SetupAction(this, BgDdanKd_CheckForExplosions);
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 200.0f - 20.0f;
|
||||
BgDdanKd_SetupAction(this, func_80871838);
|
||||
BgDdanKd_SetupAction(this, BgDdanKd_DoNothing);
|
||||
}
|
||||
}
|
||||
|
||||
void BgDdanKd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDdanKd* this = THIS;
|
||||
BgDdanKd* this = (BgDdanKd*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
@@ -101,13 +99,14 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
osSyncPrintf("dam %d\n", this->dyna.actor.colChkInfo.damage);
|
||||
explosive->params = 2;
|
||||
}
|
||||
|
||||
if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) &&
|
||||
(Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) {
|
||||
BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs);
|
||||
OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, MAIN_CAM);
|
||||
} else {
|
||||
if (this->timer != 0) {
|
||||
this->timer -= 1;
|
||||
this->timer--;
|
||||
} else {
|
||||
this->prevExplosive = explosive;
|
||||
if (explosive != NULL) {
|
||||
@@ -121,65 +120,66 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
static Vec3f D_808718FC = { 0.0f, 5.0f, 0.0f };
|
||||
static Vec3f D_80871908 = { 0.0f, -0.45f, 0.0f };
|
||||
Vec3f sp5C;
|
||||
Vec3f sp50;
|
||||
f32 sp4C;
|
||||
static Vec3f velocity = { 0.0f, 5.0f, 0.0f };
|
||||
static Vec3f accel = { 0.0f, -0.45f, 0.0f };
|
||||
Vec3f pos1;
|
||||
Vec3f pos2;
|
||||
f32 effectStrength;
|
||||
|
||||
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
|
||||
func_800AA000(500.0f, 0x78, 0x14, 0xA);
|
||||
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, (this->dyna.actor.home.pos.y - 200.0f) - 20.0f, 0.075f,
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f,
|
||||
this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
|
||||
Flags_SetSwitch(globalCtx, this->dyna.actor.params);
|
||||
BgDdanKd_SetupAction(this, func_80871838);
|
||||
BgDdanKd_SetupAction(this, BgDdanKd_DoNothing);
|
||||
} else {
|
||||
sp4C = (this->dyna.actor.prevPos.y - this->dyna.actor.world.pos.y) + (this->dyna.actor.speedXZ * 0.25f);
|
||||
effectStrength =
|
||||
(this->dyna.actor.prevPos.y - this->dyna.actor.world.pos.y) + (this->dyna.actor.speedXZ * 0.25f);
|
||||
|
||||
if (globalCtx->state.frames & 1) {
|
||||
sp5C = sp50 = this->dyna.actor.world.pos;
|
||||
pos1 = pos2 = this->dyna.actor.world.pos;
|
||||
|
||||
if (globalCtx->state.frames & 2) {
|
||||
sp5C.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
sp50.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
pos1.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
pos2.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
} else {
|
||||
sp5C.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
sp50.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
pos1.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
pos2.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
}
|
||||
sp5C.x += 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
sp50.x -= 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
sp5C.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
|
||||
sp50.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
|
||||
pos1.x += 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
pos2.x -= 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
pos1.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
|
||||
pos2.y = this->dyna.actor.floorHeight + 20.0f + Rand_ZeroOne();
|
||||
|
||||
func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
func_80033480(globalCtx, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
|
||||
func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1);
|
||||
|
||||
D_808718FC.x = Rand_CenteredFloat(3.0f);
|
||||
D_808718FC.z = Rand_CenteredFloat(3.0f);
|
||||
velocity.x = Rand_CenteredFloat(3.0f);
|
||||
velocity.z = Rand_CenteredFloat(3.0f);
|
||||
|
||||
func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908);
|
||||
func_8003555C(globalCtx, &sp50, &D_808718FC, &D_80871908);
|
||||
func_8003555C(globalCtx, &pos1, &velocity, &accel);
|
||||
func_8003555C(globalCtx, &pos2, &velocity, &accel);
|
||||
|
||||
sp5C = this->dyna.actor.world.pos;
|
||||
sp5C.z += 560.0f + Rand_ZeroOne() * 5.0f;
|
||||
sp5C.x += (Rand_ZeroOne() - 0.5f) * 160.0f;
|
||||
sp5C.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f);
|
||||
pos1 = this->dyna.actor.world.pos;
|
||||
pos1.z += 560.0f + Rand_ZeroOne() * 5.0f;
|
||||
pos1.x += (Rand_ZeroOne() - 0.5f) * 160.0f;
|
||||
pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f);
|
||||
|
||||
func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908);
|
||||
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
|
||||
func_8003555C(globalCtx, &pos1, &velocity, &accel);
|
||||
}
|
||||
Camera_AddQuake(&globalCtx->mainCamera, 0, sp4C * 0.6f, 3);
|
||||
Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3);
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0,
|
||||
&D_801333E0, &D_801333E8);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80871838(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
void BgDdanKd_DoNothing(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgDdanKd_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDdanKd* this = THIS;
|
||||
BgDdanKd* this = (BgDdanKd*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Dodoago
|
||||
z_bg_dodoago.c
|
||||
@@ -8,19 +8,17 @@
|
||||
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
|
||||
#include "objects/object_ddan_objects/object_ddan_objects.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
#define THIS ((BgDodoago*)thisx)
|
||||
#define FLAGS 0
|
||||
|
||||
void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80871CF4(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void func_80871FB8(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void func_80872288(BgDodoago* this, GlobalContext* globalCtx);
|
||||
void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Bg_Dodoago_InitVars = {
|
||||
ACTOR_BG_DODOAGO,
|
||||
@@ -34,7 +32,7 @@ const ActorInit Bg_Dodoago_InitVars = {
|
||||
(ActorFunc)BgDodoago_Draw,
|
||||
};
|
||||
|
||||
static ColliderCylinderInit sColCylinderInit0 = {
|
||||
static ColliderCylinderInit sColCylinderInitMain = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
@@ -54,7 +52,7 @@ static ColliderCylinderInit sColCylinderInit0 = {
|
||||
{ 80, 30, 80, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
static ColliderCylinderInit sColCylinderInit1 = {
|
||||
static ColliderCylinderInit sColCylinderInitLeftRight = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
@@ -74,13 +72,19 @@ static ColliderCylinderInit sColCylinderInit1 = {
|
||||
{ 50, 60, 280, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
static s16 sHasParent = false;
|
||||
static s16 sFirstExplosiveFlag = false;
|
||||
|
||||
static u8 sDisableBombCatcher;
|
||||
|
||||
static u8 sUnused[90]; // unknown length
|
||||
|
||||
static s32 sTimer;
|
||||
|
||||
void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
void BgDodoago_SpawnSparkles(Vec3f* vec, GlobalContext* globalCtx) {
|
||||
void BgDodoago_SpawnSparkles(Vec3f* meanPos, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Color_RGBA8 primColor = { 100, 100, 100, 0 };
|
||||
Color_RGBA8 envColor = { 40, 40, 40, 0 };
|
||||
@@ -89,9 +93,9 @@ void BgDodoago_SpawnSparkles(Vec3f* vec, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
for (i = 4; i > 0; i--) {
|
||||
pos.x = Rand_CenteredFloat(20.0f) + vec->x;
|
||||
pos.y = Rand_CenteredFloat(10.0f) + vec->y;
|
||||
pos.z = Rand_CenteredFloat(20.0f) + vec->z;
|
||||
pos.x = Rand_CenteredFloat(20.0f) + meanPos->x;
|
||||
pos.y = Rand_CenteredFloat(10.0f) + meanPos->y;
|
||||
pos.z = Rand_CenteredFloat(20.0f) + meanPos->z;
|
||||
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &acceleration, &primColor, &envColor);
|
||||
}
|
||||
}
|
||||
@@ -103,12 +107,8 @@ static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static u8 D_808727C0[100];
|
||||
|
||||
static s32 D_80872824;
|
||||
|
||||
void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDodoago* this = THIS;
|
||||
BgDodoago* this = (BgDodoago*)thisx;
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
@@ -118,82 +118,89 @@ void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
|
||||
|
||||
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) {
|
||||
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
|
||||
BgDodoago_SetupAction(this, BgDodoago_DoNothing);
|
||||
this->dyna.actor.shape.rot.x = 0x1333;
|
||||
globalCtx->roomCtx.unk_74[0] = globalCtx->roomCtx.unk_74[1] = 0xFF;
|
||||
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] = globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
Collider_InitCylinder(globalCtx, &this->colliders[0]);
|
||||
Collider_InitCylinder(globalCtx, &this->colliders[1]);
|
||||
Collider_InitCylinder(globalCtx, &this->colliders[2]);
|
||||
Collider_SetCylinder(globalCtx, &this->colliders[0], &this->dyna.actor, &sColCylinderInit0);
|
||||
Collider_SetCylinder(globalCtx, &this->colliders[1], &this->dyna.actor, &sColCylinderInit1);
|
||||
Collider_SetCylinder(globalCtx, &this->colliders[2], &this->dyna.actor, &sColCylinderInit1);
|
||||
BgDodoago_SetupAction(this, func_80871CF4);
|
||||
D_808727C0[0] = 0;
|
||||
Collider_InitCylinder(globalCtx, &this->colliderMain);
|
||||
Collider_InitCylinder(globalCtx, &this->colliderLeft);
|
||||
Collider_InitCylinder(globalCtx, &this->colliderRight);
|
||||
Collider_SetCylinder(globalCtx, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain);
|
||||
Collider_SetCylinder(globalCtx, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight);
|
||||
Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight);
|
||||
|
||||
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
|
||||
sDisableBombCatcher = false;
|
||||
}
|
||||
|
||||
void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDodoago* this = THIS;
|
||||
BgDodoago* this = (BgDodoago*)thisx;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliders[0]);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliders[1]);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliders[2]);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderMain);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderLeft);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderRight);
|
||||
}
|
||||
|
||||
void func_80871CF4(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
Actor* explosive = Actor_GetCollidedExplosive(globalCtx, &this->colliders[0].base);
|
||||
void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
Actor* explosive = Actor_GetCollidedExplosive(globalCtx, &this->colliderMain.base);
|
||||
|
||||
if (explosive != NULL) {
|
||||
this->unk_164 =
|
||||
(Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &explosive->world.pos) >= this->dyna.actor.shape.rot.y) ? 1
|
||||
: 0;
|
||||
this->state =
|
||||
(Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &explosive->world.pos) >= this->dyna.actor.shape.rot.y)
|
||||
? BGDODOAGO_EYE_RIGHT
|
||||
: BGDODOAGO_EYE_LEFT;
|
||||
|
||||
if (((globalCtx->roomCtx.unk_74[0] == 0xFF) && (this->unk_164 == 1)) ||
|
||||
((globalCtx->roomCtx.unk_74[1] == 0xFF) && (this->unk_164 == 0))) {
|
||||
Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F));
|
||||
this->unk_164 = 0;
|
||||
if (((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] == 255) && (this->state == BGDODOAGO_EYE_RIGHT)) ||
|
||||
((globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] == 255) && (this->state == BGDODOAGO_EYE_LEFT))) {
|
||||
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
|
||||
this->state = 0;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
BgDodoago_SetupAction(this, func_80871FB8);
|
||||
BgDodoago_SetupAction(this, BgDodoago_OpenJaw);
|
||||
OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, MAIN_CAM);
|
||||
} else if (globalCtx->roomCtx.unk_74[this->unk_164] == 0) {
|
||||
} else if (globalCtx->roomCtx.unk_74[this->state] == 0) {
|
||||
OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, MAIN_CAM);
|
||||
BgDodoago_SetupAction(this, func_80872288);
|
||||
BgDodoago_SetupAction(this, BgDodoago_LightOneEye);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, MAIN_CAM);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
D_80872824 += 0x1E;
|
||||
sTimer += 30;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sHasParent) {
|
||||
// the flag is never set back to false, so this only runs once
|
||||
if (!sFirstExplosiveFlag) {
|
||||
// this disables the bomb catcher (see BgDodoago_Update) for a few seconds
|
||||
this->dyna.actor.parent = explosive;
|
||||
sHasParent = true;
|
||||
D_80872824 = 0x32;
|
||||
sFirstExplosiveFlag = true;
|
||||
sTimer = 50;
|
||||
}
|
||||
} else if (Flags_GetEventChkInf(0xB0)) {
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliders[0]);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliders[1]);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliders[2]);
|
||||
this->colliders[0].dim.pos.z += 200;
|
||||
this->colliders[1].dim.pos.z += 215;
|
||||
this->colliders[1].dim.pos.x += 90;
|
||||
this->colliders[2].dim.pos.z += 215;
|
||||
this->colliders[2].dim.pos.x -= 90;
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliderMain);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliderLeft);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->colliderRight);
|
||||
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[2].base);
|
||||
this->colliderMain.dim.pos.z += 200;
|
||||
|
||||
this->colliderLeft.dim.pos.z += 215;
|
||||
this->colliderLeft.dim.pos.x += 90;
|
||||
|
||||
this->colliderRight.dim.pos.z += 215;
|
||||
this->colliderRight.dim.pos.x -= 90;
|
||||
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderMain.base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderLeft.base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderRight.base);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80871FB8(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
Vec3f currentPos;
|
||||
Vec3f D_808725CC[] = {
|
||||
void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Vec3f dustOffsets[] = {
|
||||
{ 0.0f, -200.0f, 430.0f }, { 20.0f, -200.0f, 420.0f }, { -20.0f, -200.0f, 420.0f },
|
||||
{ 40.0, -200.0f, 380.0f }, { -40.0, -200.0f, 380.0f }, { 50.0, -200.0f, 350.0f },
|
||||
{ -50.0f, -200.0f, 350.0f }, { 60.0f, -200.0f, 320.0f }, { -60.0f, -200.0f, 320.0f },
|
||||
@@ -201,42 +208,42 @@ void func_80871FB8(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
};
|
||||
s32 i;
|
||||
|
||||
if (globalCtx->roomCtx.unk_74[0] < 0xFF) {
|
||||
globalCtx->roomCtx.unk_74[0] += 5;
|
||||
// make both eyes red (one already is)
|
||||
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] < 255) {
|
||||
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] += 5;
|
||||
}
|
||||
if (globalCtx->roomCtx.unk_74[1] < 0xFF) {
|
||||
globalCtx->roomCtx.unk_74[1] += 5;
|
||||
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] < 255) {
|
||||
globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] += 5;
|
||||
}
|
||||
|
||||
if (globalCtx->roomCtx.unk_74[0] != 0xFF || globalCtx->roomCtx.unk_74[1] != 0xFF) {
|
||||
D_80872824--;
|
||||
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) {
|
||||
sTimer--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (D_80872824 == 0x6C) {
|
||||
for (i = 10; i >= 0; i--) {
|
||||
currentPos.x = D_808725CC[i].x + this->dyna.actor.world.pos.x;
|
||||
currentPos.y = D_808725CC[i].y + this->dyna.actor.world.pos.y;
|
||||
currentPos.z = D_808725CC[i].z + this->dyna.actor.world.pos.z;
|
||||
func_80033480(globalCtx, ¤tPos, 2.0f, 3, 0xC8, 0x4B, 1);
|
||||
if (sTimer == 108) {
|
||||
for (i = ARRAY_COUNT(dustOffsets) - 1; i >= 0; i--) {
|
||||
pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x;
|
||||
pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y;
|
||||
pos.z = dustOffsets[i].z + this->dyna.actor.world.pos.z;
|
||||
func_80033480(globalCtx, &pos, 2.0f, 3, 200, 75, 1);
|
||||
}
|
||||
}
|
||||
|
||||
currentPos.x = this->dyna.actor.world.pos.x + 200.0f;
|
||||
currentPos.y = this->dyna.actor.world.pos.y - 20.0f;
|
||||
currentPos.z = this->dyna.actor.world.pos.z + 100.0f;
|
||||
pos.x = this->dyna.actor.world.pos.x + 200.0f;
|
||||
pos.y = this->dyna.actor.world.pos.y - 20.0f;
|
||||
pos.z = this->dyna.actor.world.pos.z + 100.0f;
|
||||
BgDodoago_SpawnSparkles(&pos, globalCtx);
|
||||
|
||||
BgDodoago_SpawnSparkles(¤tPos, globalCtx);
|
||||
pos.x = this->dyna.actor.world.pos.x - 200.0f;
|
||||
pos.y = this->dyna.actor.world.pos.y - 20.0f;
|
||||
pos.z = this->dyna.actor.world.pos.z + 100.0f;
|
||||
BgDodoago_SpawnSparkles(&pos, globalCtx);
|
||||
|
||||
currentPos.x = this->dyna.actor.world.pos.x - 200.0f;
|
||||
currentPos.y = this->dyna.actor.world.pos.y - 20.0f;
|
||||
currentPos.z = this->dyna.actor.world.pos.z + 100.0f;
|
||||
|
||||
BgDodoago_SpawnSparkles(¤tPos, globalCtx);
|
||||
Math_StepToS(&this->unk_164, 0x64, 3);
|
||||
Math_StepToS(&this->state, 100, 3);
|
||||
func_800AA000(500.0f, 0x78, 0x14, 0xA);
|
||||
|
||||
if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x1333, 0x6E - this->unk_164, 0x3E8, 0x32) == 0) {
|
||||
if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x1333, 110 - this->state, 0x3E8, 0x32) == 0) {
|
||||
BgDodoago_SetupAction(this, BgDodoago_DoNothing);
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_STONE_BOUND, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
@@ -249,42 +256,48 @@ void func_80871FB8(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
void BgDodoago_DoNothing(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_80872288(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
globalCtx->roomCtx.unk_74[this->unk_164] += 5;
|
||||
void BgDodoago_LightOneEye(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
globalCtx->roomCtx.unk_74[this->state] += 5;
|
||||
|
||||
if (globalCtx->roomCtx.unk_74[this->unk_164] == 0xFF) {
|
||||
BgDodoago_SetupAction(this, func_80871CF4);
|
||||
if (globalCtx->roomCtx.unk_74[this->state] == 255) {
|
||||
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
|
||||
}
|
||||
}
|
||||
|
||||
void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDodoago* this = THIS;
|
||||
BgDodoago* this = (BgDodoago*)thisx;
|
||||
Actor* actor;
|
||||
EnBom* bomb;
|
||||
|
||||
if (this->dyna.actor.parent == NULL) {
|
||||
if ((s32)(this->colliders[1].base.ocFlags1 & OC1_HIT) || (this->colliders[2].base.ocFlags1 & OC1_HIT)) {
|
||||
// this is a "bomb catcher", it kills the XZ speed and sets the timer for bombs that are dropped through the
|
||||
// holes in the bridge above the skull
|
||||
if ((this->colliderLeft.base.ocFlags1 & OC1_HIT) || (this->colliderRight.base.ocFlags1 & OC1_HIT)) {
|
||||
|
||||
if ((s32)(this->colliders[1].base.ocFlags1 & OC1_HIT)) {
|
||||
bomb = (EnBom*)this->colliders[1].base.oc;
|
||||
if (this->colliderLeft.base.ocFlags1 & OC1_HIT) {
|
||||
actor = this->colliderLeft.base.oc;
|
||||
} else {
|
||||
bomb = (EnBom*)this->colliders[2].base.oc;
|
||||
actor = this->colliderRight.base.oc;
|
||||
}
|
||||
this->colliders[1].base.ocFlags1 &= ~OC1_HIT;
|
||||
this->colliders[2].base.ocFlags1 &= ~OC1_HIT;
|
||||
if (bomb->actor.category == ACTORCAT_EXPLOSIVE && bomb->actor.id == ACTOR_EN_BOM &&
|
||||
bomb->actor.params == 0) {
|
||||
this->colliderLeft.base.ocFlags1 &= ~OC1_HIT;
|
||||
this->colliderRight.base.ocFlags1 &= ~OC1_HIT;
|
||||
|
||||
if (actor->category == ACTORCAT_EXPLOSIVE && actor->id == ACTOR_EN_BOM && actor->params == 0) {
|
||||
bomb = (EnBom*)actor;
|
||||
// disable the bomb catcher for a few seconds
|
||||
this->dyna.actor.parent = &bomb->actor;
|
||||
bomb->timer = 50;
|
||||
bomb->actor.speedXZ = 0.0f;
|
||||
D_80872824 = 0;
|
||||
sTimer = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
D_80872824++;
|
||||
sTimer++;
|
||||
Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
|
||||
if (D_808727C0[0] == 0 && D_80872824 >= 0x8D) {
|
||||
if (!sDisableBombCatcher && sTimer > 140) {
|
||||
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
|
||||
D_808727C0[0]++;
|
||||
// this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher
|
||||
sDisableBombCatcher++;
|
||||
} else {
|
||||
this->dyna.actor.parent = NULL;
|
||||
}
|
||||
@@ -300,7 +313,7 @@ void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 677),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gDodongoLowerJarDL);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gDodongoLowerJawDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 681);
|
||||
|
||||
@@ -4,14 +4,21 @@
|
||||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ BGDODOAGO_EYE_LEFT,
|
||||
/* 1 */ BGDODOAGO_EYE_RIGHT
|
||||
} BgDodoagoEye;
|
||||
|
||||
struct BgDodoago;
|
||||
|
||||
typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, GlobalContext*);
|
||||
|
||||
typedef struct BgDodoago {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ s16 unk_164;
|
||||
/* 0x0168 */ ColliderCylinder colliders[3];
|
||||
/* 0x0164 */ s16 state; // BgDodoagoEye or a timer-like value
|
||||
/* 0x0168 */ ColliderCylinder colliderMain; // Used to detect explosions for lighting the eyes
|
||||
/* 0x01B4 */ ColliderCylinder colliderLeft; // OC-colliding bombs have their xz speed cleared and timer set
|
||||
/* 0x0200 */ ColliderCylinder colliderRight; // same as colliderLeft
|
||||
/* 0x024C */ BgDodoagoActionFunc actionFunc;
|
||||
} BgDodoago; // size = 0x0250
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Dy_Yoseizo
|
||||
z_bg_dy_yoseizo.c
|
||||
@@ -11,9 +11,7 @@
|
||||
#include "scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.h"
|
||||
#include "scenes/indoors/daiyousei_izumi/daiyousei_izumi_scene.h"
|
||||
|
||||
#define FLAGS 0x02000030
|
||||
|
||||
#define THIS ((BgDyYoseizo*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ FAIRY_UPGRADE_MAGIC,
|
||||
@@ -70,7 +68,7 @@ const ActorInit Bg_Dy_Yoseizo_InitVars = {
|
||||
|
||||
void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
BgDyYoseizo* this = THIS;
|
||||
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
|
||||
|
||||
this->fountainType = globalCtx->curSpawn;
|
||||
|
||||
@@ -246,7 +244,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) {
|
||||
case FAIRY_UPGRADE_HALF_DAMAGE:
|
||||
if (!gSaveContext.doubleDefense) {
|
||||
// "Damage halved"
|
||||
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n" VT_RST);
|
||||
osSyncPrintf(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n" VT_RST);
|
||||
this->givingSpell = true;
|
||||
givingReward = true;
|
||||
}
|
||||
@@ -804,7 +802,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) {
|
||||
|
||||
void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
BgDyYoseizo* this = THIS;
|
||||
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
|
||||
s32 phi_v1;
|
||||
|
||||
this->absoluteTimer++;
|
||||
@@ -869,7 +867,7 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
|
||||
s32 BgDyYoseizo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
void* thisx) {
|
||||
BgDyYoseizo* this = THIS;
|
||||
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
|
||||
|
||||
if (limbIndex == 8) { // Torso
|
||||
rot->x += this->torsoRot.y;
|
||||
@@ -893,7 +891,7 @@ static void* sMouthTextures[] = {
|
||||
};
|
||||
|
||||
void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgDyYoseizo* this = THIS;
|
||||
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609);
|
||||
if (this->actionFunc != BgDyYoseizo_Vanish) {
|
||||
@@ -1028,7 +1026,7 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, particle->envColor.r, particle->envColor.g, particle->envColor.b, 0);
|
||||
|
||||
Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW);
|
||||
func_800D1FD4(&globalCtx->billboardMtxF);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
Matrix_Scale(particle->scale, particle->scale, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZ(particle->roll, MTXMODE_APPLY);
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Ganon_Otyuka
|
||||
z_bg_ganon_otyuka.c
|
||||
@@ -8,9 +8,7 @@
|
||||
#include "overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h"
|
||||
#include "vt.h"
|
||||
|
||||
#define FLAGS 0x00000030
|
||||
|
||||
#define THIS ((BgGanonOtyuka*)thisx)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ FLASH_NONE,
|
||||
@@ -68,7 +66,7 @@ static f32 sSideAngles[] = { M_PI / 2, -M_PI / 2, 0.0f, M_PI };
|
||||
#include "overlays/ovl_Bg_Ganon_Otyuka/ovl_Bg_Ganon_Otyuka.c"
|
||||
|
||||
void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
BgGanonOtyuka* this = THIS;
|
||||
BgGanonOtyuka* this = (BgGanonOtyuka*)thisx;
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
|
||||
@@ -86,7 +84,7 @@ void BgGanonOtyuka_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
}
|
||||
|
||||
void BgGanonOtyuka_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
BgGanonOtyuka* this = THIS;
|
||||
BgGanonOtyuka* this = (BgGanonOtyuka*)thisx;
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
@@ -214,7 +212,7 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
func_80033DB8(globalCtx, 10, 15);
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.world.pos, 0x28, NA_SE_EV_BOX_BREAK);
|
||||
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK);
|
||||
}
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
}
|
||||
@@ -236,7 +234,7 @@ void BgGanonOtyuka_DoNothing(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgGanonOtyuka* this = THIS;
|
||||
BgGanonOtyuka* this = (BgGanonOtyuka*)thisx;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->flashTimer++;
|
||||
@@ -246,7 +244,7 @@ void BgGanonOtyuka_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgGanonOtyuka* this = THIS;
|
||||
BgGanonOtyuka* this = (BgGanonOtyuka*)thisx;
|
||||
s16 i;
|
||||
Gfx* phi_s2;
|
||||
Gfx* phi_s1;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ovl_Bg_Gate_Shutter
|
||||
z_bg_gate_shutter.c
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user