mirror of https://github.com/zeldaret/mm.git
Rename many functions, structs, and variables to match the oot decomp. Some things have not been renamed as their respective files have not been decompiled yet.
This commit is contained in:
parent
0c35be2381
commit
ff958ad932
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef _SCHED_H_
|
||||
#define _SCHED_H_
|
||||
|
||||
#include <os.h>
|
||||
#include <sptask.h>
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ short type;
|
||||
/* 0x2 */ unsigned char misc[30];
|
||||
} OSScMsg;
|
||||
|
||||
|
||||
typedef struct OSScTask_s {
|
||||
/* 0x0 */ struct OSScTask_s* next;
|
||||
/* 0x4 */ u32 state;
|
||||
/* 0x8 */ u32 flags;
|
||||
/* 0xC */ void* framebuffer;
|
||||
/* 0x10 */ OSTask list;
|
||||
/* 0x50 */ OSMesgQueue* msgQ;
|
||||
/* 0x54 */ OSMesg msg;
|
||||
} OSScTask;
|
||||
|
||||
|
||||
typedef struct OSScClient_s {
|
||||
/* 0x0 */ struct OSScClient_s* next;
|
||||
/* 0x4 */ OSMesgQueue* msgQ;
|
||||
} OSScClient;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ OSScMsg retraceMsg;
|
||||
/* 0x20 */ OSScMsg prenmiMsg;
|
||||
/* 0x40 */ OSMesgQueue interruptQ;
|
||||
/* 0x58 */ OSMesg intBuf[8];
|
||||
/* 0x78 */ OSMesgQueue cmdQ;
|
||||
/* 0x90 */ OSMesg cmdMsgBuf[8];
|
||||
/* 0xB0 */ OSThread thread;
|
||||
/* 0x260 */ OSScClient* clientList;
|
||||
/* 0x264 */ OSScTask* audioListHead;
|
||||
/* 0x268 */ OSScTask* gfxListHead;
|
||||
/* 0x26C */ OSScTask* audioListTail;
|
||||
/* 0x270 */ OSScTask* gfxListTail;
|
||||
/* 0x274 */ OSScTask* curRSPTask;
|
||||
/* 0x278 */ OSScTask* curRDPTask;
|
||||
/* 0x27C */ u32 frameCount;
|
||||
/* 0x280 */ s32 doAudio;
|
||||
} OSSched;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include <PR/ultratypes.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <PR/sched.h>
|
||||
#include <io/controller.h>
|
||||
#include <osint.h>
|
||||
#include <viint.h>
|
||||
|
|
|
|||
5112
include/functions.h
5112
include/functions.h
File diff suppressed because it is too large
Load Diff
1355
include/structs.h
1355
include/structs.h
File diff suppressed because it is too large
Load Diff
1424
include/variables.h
1424
include/variables.h
File diff suppressed because it is too large
Load Diff
|
|
@ -10,9 +10,9 @@ SECTIONS
|
|||
boot : AT(RomLocation)
|
||||
{
|
||||
boot_text_start = .;
|
||||
build/src/boot_O2_g3/boot_0x80080060.o(.text)
|
||||
build/src/boot_O2_g3/boot_main.o(.text)
|
||||
build/src/boot_O2_g3/idle.o(.text)
|
||||
build/src/boot_O2_g3/boot_0x800805E0.o(.text)
|
||||
build/src/boot_O2_g3/viconfig.o(.text)
|
||||
build/src/boot_O2_g3/z_std_dma.o(.text)
|
||||
build/asm/boot_0x80080E30.o(.text)
|
||||
build/src/boot_O2_g3/irqmgr.o(.text)
|
||||
|
|
@ -70,7 +70,7 @@ SECTIONS
|
|||
build/src/libultra/io/sprawdma.o(.text)
|
||||
build/src/libultra/io/sirawdma.o(.text)
|
||||
build/asm/boot_0x8008AE20.o(.text)
|
||||
build/src/libultra/io/virepeatline.o(.text)
|
||||
build/src/libultra/io/viblack.o(.text)
|
||||
build/src/libultra/io/sirawread.o(.text)
|
||||
build/src/libultra/os/getthreadid.o(.text)
|
||||
build/src/libultra/io/sptaskyield.o(.text)
|
||||
|
|
@ -248,7 +248,7 @@ SECTIONS
|
|||
boot_data_end = .;
|
||||
|
||||
boot_rodata_start = .;
|
||||
build/src/boot_O2_g3/boot_0x80080060.o(.rodata)
|
||||
build/src/boot_O2_g3/boot_main.o(.rodata)
|
||||
build/src/boot_O2_g3/idle.o(.rodata)
|
||||
build/asm/boot_rodata_z_std_dma.o(.text)
|
||||
build/asm/boot_rodata_0x80080E30.o(.text)
|
||||
|
|
@ -279,7 +279,7 @@ SECTIONS
|
|||
RomLocation += SegmentSize;
|
||||
|
||||
boot_bss_start = .;
|
||||
. += 0x1C60; /* 0x80080060 */
|
||||
. += 0x1C60; /* boot_main */
|
||||
. += 0x140; /* idle */
|
||||
. += 0x770; /* z_std_dma */
|
||||
. += 0x420; /* 0x80080E30 */
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
ActorInitData bgFuKaitenInitData = {
|
||||
ActorInit bgFuKaitenInitData = {
|
||||
0x01AE,
|
||||
1,
|
||||
0,
|
||||
0x30,
|
||||
0x01A0,
|
||||
0, 0,
|
||||
sizeof(ActorBgFuKaiten),
|
||||
(actor_func)&BgFuKaiten_Init,
|
||||
(actor_func)&BgFuKaiten_Fini,
|
||||
(actor_func)&BgFuKaiten_Main,
|
||||
(actor_func)&BgFuKaiten_Destroy,
|
||||
(actor_func)&BgFuKaiten_Update,
|
||||
(actor_func)&BgFuKaiten_Draw
|
||||
};
|
||||
|
||||
|
|
@ -20,10 +19,10 @@ void BgFuKaiten_Init(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
|||
UNK_TYPE pad1;
|
||||
BgMeshHeader* header = 0;
|
||||
|
||||
Actor_SetScale(&this->bg.base, 1.0);
|
||||
Actor_SetScale(&this->bg.actor, 1.0);
|
||||
BcCheck3_BgActorInit(&this->bg, 3);
|
||||
BgCheck_RelocateMeshHeader(&object_fu_kaiten_002D30, &header);
|
||||
this->bg.bgActorId = BgCheck_AddActorMesh(ctxt, &ctxt->bgCheckContext.dyna, &this->bg, header);
|
||||
this->bg.dynaPolyId = BgCheck_AddActorMesh(ctxt, &ctxt->colCtx.dyna, &this->bg, header);
|
||||
|
||||
this->bouceHeight = 0.0;
|
||||
this->rotationSpeed = 0;
|
||||
|
|
@ -31,38 +30,38 @@ void BgFuKaiten_Init(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
|||
this->bounce = 0;
|
||||
}
|
||||
|
||||
void BgFuKaiten_Fini(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
BgCheck_RemoveActorMesh(ctxt, &ctxt->bgCheckContext.dyna, this->bg.bgActorId);
|
||||
void BgFuKaiten_Destroy(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
BgCheck_RemoveActorMesh(ctxt, &ctxt->colCtx.dyna, this->bg.dynaPolyId);
|
||||
}
|
||||
|
||||
void BgFuKaiten_UpdateRotation(ActorBgFuKaiten* this) {
|
||||
f32 f0;
|
||||
this->bg.base.drawParams.rot.y += this->rotationSpeed;
|
||||
this->bg.actor.shape.rot.y += this->rotationSpeed;
|
||||
if (this->rotationSpeed > 0)
|
||||
{
|
||||
f0 = this->rotationSpeed * .002f;
|
||||
func_8019FAD8(&this->bg.base.unkEC, 8310, f0);
|
||||
func_8019FAD8(&this->bg.actor.unkEC, 8310, f0);
|
||||
}
|
||||
}
|
||||
|
||||
void BgFuKaiten_UpdateHeight(ActorBgFuKaiten* this) {
|
||||
this->bounce += this->bounceSpeed;
|
||||
this->bg.base.currPosRot.pos.y = this->bg.base.initPosRot.pos.y + this->elevation + this->bouceHeight;
|
||||
this->bg.actor.currPosRot.pos.y = this->bg.actor.initPosRot.pos.y + this->elevation + this->bouceHeight;
|
||||
|
||||
this->bg.base.currPosRot.pos.y -= this->bouceHeight * Lib_cos(this->bounce);
|
||||
this->bg.actor.currPosRot.pos.y -= this->bouceHeight * Math_Coss(this->bounce);
|
||||
}
|
||||
|
||||
void BgFuKaiten_Main(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
void BgFuKaiten_Update(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
BgFuKaiten_UpdateRotation(this);
|
||||
BgFuKaiten_UpdateHeight(this);
|
||||
}
|
||||
|
||||
void BgFuKaiten_Draw(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
UNK_TYPE pad;
|
||||
|
||||
func_8012C28C(gCtxt);
|
||||
func_8012C28C(gfxCtx);
|
||||
|
||||
gSPMatrix(gCtxt->polyOpa.append++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->common.gCtxt), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gCtxt->polyOpa.append++, object_fu_kaiten_0005D0);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, object_fu_kaiten_0005D0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
ActorInitData bgIkanaRayInitData = {
|
||||
ActorInit bgIkanaRayInitData = {
|
||||
0x0256,
|
||||
6,
|
||||
0,
|
||||
0,
|
||||
0x0203,
|
||||
0, 0,
|
||||
sizeof(ActorBgIkanaRay),
|
||||
(actor_func)BgIkanaRay_Init,
|
||||
(actor_func)BgIkanaRay_Fini,
|
||||
(actor_func)BgIkanaRay_Main,
|
||||
(actor_func)BgIkanaRay_Destroy,
|
||||
(actor_func)BgIkanaRay_Update,
|
||||
(actor_func)BgIkanaRay_Draw
|
||||
};
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ void BgIkanaRay_Init(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
|||
ColCylinder* collision = &this->collision;
|
||||
u32 pad;
|
||||
|
||||
Lib_ApplyActorInitVars((Actor*)this, bgIkanaRayCompInit);
|
||||
Actor_ProcessInitChain((Actor*)this, bgIkanaRayCompInit);
|
||||
|
||||
Collision_InitCylinderDefault(ctxt, collision);
|
||||
Collision_InitCylinderWithData(ctxt, collision, (Actor*)this, &bgIkanaRayCylinderInit);
|
||||
|
|
@ -42,14 +41,14 @@ void BgIkanaRay_Init(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
|||
|
||||
this->animatedTextures = (AnimatedTexture*)Lib_PtrSegToVirt(object_ikana_obj_001228);
|
||||
|
||||
if (Actor_GetSwitchFlag(ctxt, this->base.variable & 0x7F) != 0) {
|
||||
if (Actor_GetSwitchFlag(ctxt, this->base.params & 0x7F) != 0) {
|
||||
BgIkanaRay_SetActivated(this);
|
||||
} else {
|
||||
BgIkanaRay_SetDeactivated(this);
|
||||
}
|
||||
}
|
||||
|
||||
void BgIkanaRay_Fini(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
void BgIkanaRay_Destroy(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
ColCylinder* collision = &this->collision;
|
||||
Collision_FiniCylinder(ctxt, collision);
|
||||
}
|
||||
|
|
@ -61,7 +60,7 @@ void BgIkanaRay_SetDeactivated(ActorBgIkanaRay* this) {
|
|||
}
|
||||
|
||||
void BgIkanaRay_UpdateCheckForActivation(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
if (Actor_GetSwitchFlag(ctxt, this->base.variable & 0x7F) != 0) {
|
||||
if (Actor_GetSwitchFlag(ctxt, this->base.params & 0x7F) != 0) {
|
||||
BgIkanaRay_SetActivated(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -73,10 +72,10 @@ void BgIkanaRay_SetActivated(ActorBgIkanaRay* this) {
|
|||
}
|
||||
|
||||
void BgIkanaRay_UpdateActivated(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
Collision_AddAT(ctxt, &ctxt->collisionContext, &this->collision.base);
|
||||
Collision_AddAT(ctxt, &ctxt->colCheckCtx, &this->collision.base);
|
||||
}
|
||||
|
||||
void BgIkanaRay_Main(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
void BgIkanaRay_Update(ActorBgIkanaRay* this, GlobalContext* ctxt) {
|
||||
this->update((Actor*)this, ctxt);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void func_80085320(ThreadInfo* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp10, UNK_PTR sp14) {
|
||||
UNK_TYPE* i;
|
||||
ThreadInfo* v0;
|
||||
|
||||
if (a0 == NULL) {
|
||||
ThreadInfoListHead = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
a0->unk8 = a1;
|
||||
a0->unkC = a2;
|
||||
a0->unk10 = a3;
|
||||
a0->unk14 = sp10;
|
||||
a0->unk18 = sp14;
|
||||
|
||||
v0 = ThreadInfoListHead;
|
||||
while (v0 != NULL) {
|
||||
if (v0 == a0) return;
|
||||
v0 = v0->next;
|
||||
}
|
||||
|
||||
a0->prev = ThreadInfoListTail;
|
||||
a0->next = NULL;
|
||||
|
||||
if (ThreadInfoListTail != NULL) {
|
||||
ThreadInfoListTail->next = a0;
|
||||
}
|
||||
|
||||
ThreadInfoListTail = a0;
|
||||
|
||||
if (ThreadInfoListHead == NULL) {
|
||||
ThreadInfoListHead = a0;
|
||||
}
|
||||
|
||||
if (a0->unk14 != -1) {
|
||||
for (i = a0->unk8; i < a0->unkC; i++) {
|
||||
*i = a0->unk10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UNK_RET func_800853F8(ThreadInfo* a0) {
|
||||
if (a0->prev == NULL) {
|
||||
if (ThreadInfoListHead == a0) {
|
||||
ThreadInfoListHead = a0->next;
|
||||
}
|
||||
} else {
|
||||
a0->prev->next = a0->next;
|
||||
}
|
||||
|
||||
if (a0->next == NULL) {
|
||||
if (ThreadInfoListTail == a0) {
|
||||
ThreadInfoListTail = a0->prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UNK_TYPE func_80085468(ThreadInfo* a0) {
|
||||
UNK_TYPE* v1 = a0->unk8;
|
||||
UNK_TYPE* a1 = a0->unkC;
|
||||
UNK_TYPE* v0 = v1;
|
||||
u32 x; // ptr_diff
|
||||
|
||||
while (v0 < a1) {
|
||||
if (*v0++ != a0->unk10) break;
|
||||
a1 = (UNK_TYPE*)((u32)v0 - (u32)v1);
|
||||
}
|
||||
|
||||
x = v0 - v1;
|
||||
|
||||
if (x == 0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ((x < a0->unk14) && (a0->unk14 != -1)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UNK_TYPE func_800854E0(UNK_ARGS) {
|
||||
ThreadInfo* s0 = ThreadInfoListHead;
|
||||
UNK_TYPE ret = 0;
|
||||
while (s0 != NULL) {
|
||||
if (func_80085468(s0) != 0) {
|
||||
ret = 1;
|
||||
}
|
||||
s0 = s0->next;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UNK_RET func_80085538(ThreadInfo* a0) {
|
||||
if (a0 == NULL) {
|
||||
func_800854E0();
|
||||
} else {
|
||||
func_80085468(a0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
UNK_TYPE func_80087830(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) {
|
||||
return func_8008F208(a0, a1) + a2;
|
||||
}
|
||||
|
||||
UNK_TYPE func_80087854(u8* a0, UNK_TYPE a1, UNK_PTR a2) {
|
||||
UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, a2);
|
||||
|
||||
if (v0 >= 0) {
|
||||
a0[v0] = 0;
|
||||
}
|
||||
|
||||
return v0;
|
||||
}
|
||||
|
||||
UNK_TYPE func_800878A4(u8* a0, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3) {
|
||||
UNK_TYPE v0 = func_8008E050(func_80087830, a0, a1, &a2);
|
||||
|
||||
if (v0 >= 0) {
|
||||
a0[v0] = 0;
|
||||
}
|
||||
|
||||
return v0;
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3
|
|||
|
||||
if(1);
|
||||
|
||||
Dmamgr_SendRequestAndWait(allocatedVRamAddr, vRomStart, size);
|
||||
DmaMgr_SendRequest0(allocatedVRamAddr, vRomStart, size);
|
||||
|
||||
end = (void*)(allocatedVRamAddr + size);
|
||||
overlayInfo = (OverlayBlockSizes*)((int)end - *(int*)((int)end + -4));
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
StackEntry* sStackInfoListStart = NULL;
|
||||
StackEntry* sStackInfoListEnd = NULL;
|
||||
|
||||
void StackCheck_Init(StackEntry* entry, u32 stackTop, u32 stackBottom, u32 initValue, s32 minSpace, char* name) {
|
||||
void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name) {
|
||||
StackEntry* iter;
|
||||
u32* addr;
|
||||
|
||||
if (!entry) {
|
||||
sStackInfoListStart = NULL;
|
||||
} else {
|
||||
entry->head = stackTop;
|
||||
entry->tail = stackBottom;
|
||||
entry->head = (u32)stackTop;
|
||||
entry->tail = (u32)stackBottom;
|
||||
entry->initValue = initValue;
|
||||
entry->minSpace = minSpace;
|
||||
entry->name = name;
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void start(void) {
|
||||
StackCheck_Init(&bootStackEntry, (u32)bootStack, (u32)&bootStack[1024], 0, -1, "boot");
|
||||
osMemSize = osGetMemSize();
|
||||
func_800818F4();
|
||||
osInitialize();
|
||||
osUnmapTLBAll();
|
||||
D_80096B40 = osCartRomInit();
|
||||
StackCheck_Init(&idleStackEntry, (u32)idleStack, (u32)&idleStack[1024], 0, 256, "idle");
|
||||
osCreateThread(&idleOSThread, 1, (osCreateThread_func)Idle_ThreadEntry, 0, &idleStack[1024], 12);
|
||||
osStartThread(&idleOSThread);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
UNK_RET func_800805E0(UNK_TYPE a0) {
|
||||
if (a0 != 0) {
|
||||
switch (osTvType) {
|
||||
case 2:
|
||||
osViSetMode(&osViModeMpalLan1);
|
||||
break;
|
||||
case 0:
|
||||
osViSetMode(&osViModePalLan1);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
osViSetMode(&osViModeNtscLan1);
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (viEnabledSpecialFeatures != 0) {
|
||||
osViSetSpecialFeatures(viEnabledSpecialFeatures);
|
||||
}
|
||||
|
||||
if (screenYScale != 1) {
|
||||
osViSetYScale(1);
|
||||
}
|
||||
} else {
|
||||
osViSetMode(&D_8009B240);
|
||||
|
||||
if (D_80096B28 != 0) {
|
||||
func_80087E00(D_80096B28);
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (viEnabledSpecialFeatures != 0) {
|
||||
osViSetSpecialFeatures(viEnabledSpecialFeatures);
|
||||
}
|
||||
|
||||
if (screenXScale != 1) {
|
||||
osViSetXScale(screenXScale);
|
||||
}
|
||||
|
||||
if (screenYScale != 1) {
|
||||
osViSetYScale(screenYScale);
|
||||
}
|
||||
}
|
||||
|
||||
D_80096B24 = a0;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/boot_0x800805E0/func_800805E0.asm")
|
||||
#endif
|
||||
|
||||
UNK_RET func_80080748(void) {
|
||||
if (D_80096B24 != 0) {
|
||||
osViRepeatLine(1);
|
||||
} else {
|
||||
osViRepeatLine(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void bootproc(void) {
|
||||
StackCheck_Init(&sBootThreadInfo, (u32)sBootThreadStack, (u32)&sBootThreadStack[1024], 0, -1, "boot");
|
||||
osMemSize = osGetMemSize();
|
||||
func_800818F4();
|
||||
osInitialize();
|
||||
osUnmapTLBAll();
|
||||
gCartHandle = osCartRomInit();
|
||||
StackCheck_Init(&sIdleThreadInfo, (u32)sIdleThreadStack, (u32)&sIdleThreadStack[1024], 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, (osCreateThread_func)Idle_ThreadEntry, 0, &sIdleThreadStack[1024], 12);
|
||||
osStartThread(&sIdleThread);
|
||||
}
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
#include <global.h>
|
||||
|
||||
u8 D_80096B20 = 1;
|
||||
vu8 D_80096B24 = 1;
|
||||
u8 D_80096B28 = 0;
|
||||
u32 viEnabledSpecialFeatures = 0x42;
|
||||
f32 screenXScale = 1.0f;
|
||||
f32 screenYScale = 1.0f;
|
||||
vu8 gViConfigUseDefault = 1;
|
||||
u8 gViConfigAdditionalScanLines = 0;
|
||||
u32 gViConfigFeatures = 0x42;
|
||||
f32 gViConfigXScale = 1.0f;
|
||||
f32 gViConfigYScale = 1.0f;
|
||||
|
||||
void Idle_ClearMemory(void* begin, void* end){
|
||||
if (begin < end) {
|
||||
|
|
@ -28,9 +28,9 @@ GLOBAL_ASM("./asm/non_matchings/idle/Idle_InitFramebuffer.asm")
|
|||
|
||||
void Idle_InitScreen(void) {
|
||||
Idle_InitFramebuffer((u32*)&D_80000500, 0x25800, 0x00010001);
|
||||
func_800805E0(0);
|
||||
ViConfig_UpdateVi(0);
|
||||
osViSwapBuffer(&D_80000500);
|
||||
osViRepeatLine(0);
|
||||
osViBlack(0);
|
||||
}
|
||||
|
||||
void Idle_InitMemory(void) {
|
||||
|
|
@ -43,7 +43,7 @@ void Idle_InitMemory(void) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc around Dmamgr_SendRequest
|
||||
// regalloc around DmaMgr_SendRequestImpl
|
||||
void Idle_InitCodeAndMemory(void) {
|
||||
DmaRequest dmaReq;
|
||||
OSMesgQueue queue;
|
||||
|
|
@ -52,15 +52,15 @@ void Idle_InitCodeAndMemory(void) {
|
|||
|
||||
osCreateMesgQueue(&queue, &mesg, 1);
|
||||
|
||||
oldSize = dmamgrChunkSize;
|
||||
dmamgrChunkSize = 0;
|
||||
oldSize = sDmaMgrDmaBuffSize;
|
||||
sDmaMgrDmaBuffSize = 0;
|
||||
|
||||
Dmamgr_SendRequest(&dmaReq, (u32)&code_text_start, (u32)&code_vrom_start, (u32)&code_vrom_end - (u32)&code_vrom_start, 0, &queue, 0);
|
||||
DmaMgr_SendRequestImpl(&dmaReq, (u32)&code_text_start, (u32)&code_vrom_start, (u32)&code_vrom_end - (u32)&code_vrom_start, 0, &queue, 0);
|
||||
Idle_InitScreen();
|
||||
Idle_InitMemory();
|
||||
osRecvMesg(&queue, 0, 1);
|
||||
|
||||
dmamgrChunkSize = oldSize;
|
||||
sDmaMgrDmaBuffSize = oldSize;
|
||||
|
||||
Idle_ClearMemory(&code_bss_start, &code_bss_end);
|
||||
}
|
||||
|
|
@ -68,9 +68,9 @@ void Idle_InitCodeAndMemory(void) {
|
|||
GLOBAL_ASM("./asm/non_matchings/idle/Idle_InitCodeAndMemory.asm")
|
||||
#endif
|
||||
|
||||
void Idle_MainThreadEntry(void* arg) {
|
||||
void Main_ThreadEntry(void* arg) {
|
||||
StackCheck_Init(&irqmgrStackEntry, (u32)&irqmgrStack, (u32)&irqmgrStack[1280], 0, 256, "irqmgr");
|
||||
IrqMgr_Start(&irqmgrContext, &irqmgrStackEntry, 18, 1);
|
||||
IrqMgr_Create(&irqmgrContext, &irqmgrStackEntry, 18, 1);
|
||||
Dmamgr_Start();
|
||||
Idle_InitCodeAndMemory();
|
||||
main(arg);
|
||||
|
|
@ -80,9 +80,9 @@ void Idle_MainThreadEntry(void* arg) {
|
|||
void func_8008038C(void) {
|
||||
osCreateViManager(254);
|
||||
|
||||
viEnabledSpecialFeatures = 66;
|
||||
screenXScale = 1.0;
|
||||
screenYScale = 1.0;
|
||||
gViConfigFeatures = 66;
|
||||
gViConfigXScale = 1.0;
|
||||
gViConfigYScale = 1.0;
|
||||
|
||||
switch (osTvType) {
|
||||
case 1:
|
||||
|
|
@ -96,7 +96,7 @@ void func_8008038C(void) {
|
|||
case 0:
|
||||
D_8009B290 = 44;
|
||||
D_8009B240 = D_800980E0;
|
||||
screenYScale = 0.833f;
|
||||
gViConfigYScale = 0.833f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ void Idle_ThreadEntry(void* arg) {
|
|||
func_8008038C();
|
||||
osCreatePiManager(150, &D_8009B228, D_8009B160, 50);
|
||||
StackCheck_Init(&mainStackEntry, (u32)&mainStack, (u32)&mainStack[2304], 0, 1024, "main");
|
||||
osCreateThread(&mainOSThread, 3, (osCreateThread_func)Idle_MainThreadEntry, arg, &mainStack[2304], 12);
|
||||
osCreateThread(&mainOSThread, 3, (osCreateThread_func)Main_ThreadEntry, arg, &mainStack[2304], 12);
|
||||
osStartThread(&mainOSThread);
|
||||
osSetThreadPri(NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
||||
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
|
||||
|
||||
vs32 gPrenmiStage = 0;
|
||||
volatile OSTime sLastPrenmiTime = 0;
|
||||
vu64 gLastFrameDuration = 0;
|
||||
s32 sFrameCount = 0;
|
||||
vs32 gIrqMgrResetStatus = 0;
|
||||
volatile OSTime sIrqMgrResetTime = 0;
|
||||
volatile OSTime sIrqMgrRetraceTime = 0;
|
||||
s32 sIrqMgrRetraceCount = 0;
|
||||
|
||||
void IrqMgr_AddCallback(IrqMgr* irqmgr, OSMesgQueueListNode* param_2, OSMesgQueue* param_3) {
|
||||
void IrqMgr_AddClient(IrqMgr* irqmgr, OSMesgQueueListNode* param_2, OSMesgQueue* param_3) {
|
||||
u32 saveMask;
|
||||
|
||||
saveMask = osSetIntMask(1);
|
||||
|
|
@ -23,14 +23,14 @@ void IrqMgr_AddCallback(IrqMgr* irqmgr, OSMesgQueueListNode* param_2, OSMesgQueu
|
|||
osSetIntMask(saveMask);
|
||||
|
||||
if (irqmgr->prenmiStage > 0) {
|
||||
osSendMesg(param_2->queue, &irqmgr->prenmi1Msg, 0);
|
||||
osSendMesg(param_2->queue, &irqmgr->prenmiMsg.type, 0);
|
||||
}
|
||||
if (irqmgr->prenmiStage > 1) {
|
||||
osSendMesg(param_2->queue, &irqmgr->prenmi2Msg, 0);
|
||||
osSendMesg(param_2->queue, &irqmgr->nmiMsg.type, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void IrqMgr_RemoveCallback(IrqMgr* irqmgr, OSMesgQueueListNode* remove) {
|
||||
void IrqMgr_RemoveClient(IrqMgr* irqmgr, OSMesgQueueListNode* remove) {
|
||||
OSMesgQueueListNode* iter;
|
||||
OSMesgQueueListNode* last;
|
||||
u32 saveMask;
|
||||
|
|
@ -56,7 +56,7 @@ void IrqMgr_RemoveCallback(IrqMgr* irqmgr, OSMesgQueueListNode* remove) {
|
|||
osSetIntMask(saveMask);
|
||||
}
|
||||
|
||||
void IrqMgr_NotifyAllCallbacks(IrqMgr* irqmgr, OSMesg msg) {
|
||||
void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg) {
|
||||
OSMesgQueueListNode* iter = irqmgr->callbacks;
|
||||
|
||||
while (iter != NULL) {
|
||||
|
|
@ -65,7 +65,7 @@ void IrqMgr_NotifyAllCallbacks(IrqMgr* irqmgr, OSMesg msg) {
|
|||
}
|
||||
}
|
||||
|
||||
void IrqMgr_NotifyAllCallbacksWithCapacity(IrqMgr* irqmgr, OSMesg msg) {
|
||||
void IrqMgr_JamMesgForClient(IrqMgr* irqmgr, OSMesg msg) {
|
||||
OSMesgQueueListNode* iter = irqmgr->callbacks;
|
||||
|
||||
while (iter != NULL) {
|
||||
|
|
@ -76,53 +76,53 @@ void IrqMgr_NotifyAllCallbacksWithCapacity(IrqMgr* irqmgr, OSMesg msg) {
|
|||
}
|
||||
}
|
||||
|
||||
void IrqMgr_HandlePrenmi1(IrqMgr* irqmgr) {
|
||||
gPrenmiStage = 1;
|
||||
void IrqMgr_HandlePreNMI(IrqMgr* irqmgr) {
|
||||
gIrqMgrResetStatus = 1;
|
||||
irqmgr->prenmiStage = 1;
|
||||
|
||||
sLastPrenmiTime = irqmgr->lastPrenmiTime = osGetTime();
|
||||
sIrqMgrResetTime = irqmgr->lastPrenmiTime = osGetTime();
|
||||
|
||||
// Wait .45 seconds then generate a stage 2 prenmi interrupt
|
||||
osSetTimer(&irqmgr->prenmiTimer, OS_USEC_TO_CYCLES(450000), 0, &irqmgr->irqQueue, (OSMesg)0x29F);
|
||||
|
||||
IrqMgr_NotifyAllCallbacksWithCapacity(irqmgr, &irqmgr->prenmi1Msg);
|
||||
IrqMgr_JamMesgForClient(irqmgr, &irqmgr->prenmiMsg.type);
|
||||
}
|
||||
|
||||
void IrqMgr_CheckThreadStatusImpl(void) {
|
||||
void IrqMgr_CheckStack(void) {
|
||||
StackCheck_Check(NULL);
|
||||
}
|
||||
|
||||
void IrqMgr_HandlePrenmi2(IrqMgr* irqmgr) {
|
||||
gPrenmiStage = 2;
|
||||
void IrqMgr_HandlePRENMI450(IrqMgr* irqmgr) {
|
||||
gIrqMgrResetStatus = 2;
|
||||
irqmgr->prenmiStage = 2;
|
||||
|
||||
// Wait .03 seconds then generate a stage 3 prenmi interrupt
|
||||
osSetTimer(&irqmgr->prenmiTimer, OS_USEC_TO_CYCLES(30000), 0, &irqmgr->irqQueue, (OSMesg)0x2A0);
|
||||
|
||||
IrqMgr_NotifyAllCallbacks(irqmgr, &irqmgr->prenmi2Msg);
|
||||
IrqMgr_SendMesgForClient(irqmgr, &irqmgr->nmiMsg.type);
|
||||
}
|
||||
|
||||
void IrqMgr_HandlePrenmi3(IrqMgr* irqmgr) {
|
||||
void IrqMgr_HandlePRENMI480(IrqMgr* irqmgr) {
|
||||
// Wait .52 seconds. After this we will have waited an entire second
|
||||
osSetTimer(&irqmgr->prenmiTimer, OS_USEC_TO_CYCLES(520000), 0, &irqmgr->irqQueue, (OSMesg)0x2A1);
|
||||
|
||||
func_8008D710();
|
||||
osAfterPreNMI();
|
||||
}
|
||||
|
||||
void IrqMgr_CheckThreadStatus(IrqMgr* irqmgr) {
|
||||
IrqMgr_CheckThreadStatusImpl();
|
||||
void IrqMgr_HandlePRENMI500(IrqMgr* irqmgr) {
|
||||
IrqMgr_CheckStack();
|
||||
}
|
||||
void IrqMgr_HandleFrame(IrqMgr* irqmgr) {
|
||||
if (gLastFrameDuration == 0) {
|
||||
void IrqMgr_HandleRetrace(IrqMgr* irqmgr) {
|
||||
if (sIrqMgrRetraceTime == 0) {
|
||||
if (irqmgr->lastFrameTime == 0) {
|
||||
irqmgr->lastFrameTime = osGetTime();
|
||||
} else {
|
||||
gLastFrameDuration = osGetTime() - irqmgr->lastFrameTime;
|
||||
sIrqMgrRetraceTime = osGetTime() - irqmgr->lastFrameTime;
|
||||
}
|
||||
}
|
||||
|
||||
sFrameCount += 1;
|
||||
IrqMgr_NotifyAllCallbacks(irqmgr,irqmgr);
|
||||
sIrqMgrRetraceCount += 1;
|
||||
IrqMgr_SendMesgForClient(irqmgr,irqmgr);
|
||||
}
|
||||
|
||||
void IrqMgr_ThreadEntry(IrqMgr* irqmgr) {
|
||||
|
|
@ -137,29 +137,29 @@ void IrqMgr_ThreadEntry(IrqMgr* irqmgr) {
|
|||
osRecvMesg(&irqmgr->irqQueue, (OSMesg*)&interrupt, 1);
|
||||
switch (interrupt) {
|
||||
case 0x29A:
|
||||
IrqMgr_HandleFrame(irqmgr);
|
||||
IrqMgr_HandleRetrace(irqmgr);
|
||||
break;
|
||||
case 0x29D:
|
||||
IrqMgr_HandlePrenmi1(irqmgr);
|
||||
IrqMgr_HandlePreNMI(irqmgr);
|
||||
break;
|
||||
case 0x29F:
|
||||
IrqMgr_HandlePrenmi2(irqmgr);
|
||||
IrqMgr_HandlePRENMI450(irqmgr);
|
||||
break;
|
||||
case 0x2A0:
|
||||
IrqMgr_HandlePrenmi3(irqmgr);
|
||||
IrqMgr_HandlePRENMI480(irqmgr);
|
||||
break;
|
||||
case 0x2A1:
|
||||
IrqMgr_CheckThreadStatus(irqmgr);
|
||||
IrqMgr_HandlePRENMI500(irqmgr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IrqMgr_Start(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
|
||||
void IrqMgr_Create(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
|
||||
irqmgr->callbacks = NULL;
|
||||
irqmgr->verticalRetraceMesg = 1;
|
||||
irqmgr->prenmi1Msg = 4;
|
||||
irqmgr->prenmi2Msg = 3;
|
||||
irqmgr->verticalRetraceMesg.type = 1;
|
||||
irqmgr->prenmiMsg.type = 4;
|
||||
irqmgr->nmiMsg.type = 3;
|
||||
irqmgr->prenmiStage = 0;
|
||||
irqmgr->lastPrenmiTime = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void ViConfig_UpdateVi(u32 arg0) {
|
||||
if (arg0 != 0) {
|
||||
switch (osTvType) {
|
||||
case 2:
|
||||
osViSetMode(&osViModeMpalLan1);
|
||||
break;
|
||||
case 0:
|
||||
osViSetMode(&osViModePalLan1);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
osViSetMode(&osViModeNtscLan1);
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (gViConfigFeatures != 0) {
|
||||
osViSetSpecialFeatures(gViConfigFeatures);
|
||||
}
|
||||
|
||||
if (gViConfigYScale != 1) {
|
||||
osViSetYScale(1);
|
||||
}
|
||||
} else {
|
||||
osViSetMode(&D_8009B240);
|
||||
|
||||
if (gViConfigAdditionalScanLines != 0) {
|
||||
func_80087E00(gViConfigAdditionalScanLines);
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (gViConfigFeatures != 0) {
|
||||
osViSetSpecialFeatures(gViConfigFeatures);
|
||||
}
|
||||
|
||||
if (gViConfigXScale != 1) {
|
||||
osViSetXScale(gViConfigXScale);
|
||||
}
|
||||
|
||||
if (gViConfigYScale != 1) {
|
||||
osViSetYScale(gViConfigYScale);
|
||||
}
|
||||
}
|
||||
|
||||
gViConfigUseDefault = arg0;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/viconfig/ViConfig_UpdateVi.asm")
|
||||
#endif
|
||||
|
||||
void ViConfig_UpdateBlack(void) {
|
||||
if (gViConfigUseDefault != 0) {
|
||||
osViBlack(1);
|
||||
} else {
|
||||
osViBlack(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
UNK_TYPE4 dmamgrChunkSize = 0x2000;
|
||||
UNK_TYPE4 sDmaMgrDmaBuffSize = 0x2000;
|
||||
|
||||
s32 Dmamgr_DoDmaTransfer(u32 a0, void* a1, u32 a2) {
|
||||
s32 DmaMgr_DMARomToRam(u32 a0, void* a1, u32 a2) {
|
||||
OSIoMesg sp60;
|
||||
OSMesgQueue sp48;
|
||||
OSMesg sp44;
|
||||
s32 ret;
|
||||
u32 s0 = dmamgrChunkSize;
|
||||
u32 s0 = sDmaMgrDmaBuffSize;
|
||||
|
||||
osInvalDCache(a1, a2);
|
||||
osCreateMesgQueue(&sp48, &sp44, 1);
|
||||
|
|
@ -20,7 +20,7 @@ s32 Dmamgr_DoDmaTransfer(u32 a0, void* a1, u32 a2) {
|
|||
sp60.devAddr = (u32)a0;
|
||||
sp60.dramAddr = a1;
|
||||
sp60.size = s0;
|
||||
ret = osEPiStartDma(D_80096B40, &sp60, 0);
|
||||
ret = osEPiStartDma(gCartHandle, &sp60, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp48, NULL, 1);
|
||||
|
|
@ -34,7 +34,7 @@ s32 Dmamgr_DoDmaTransfer(u32 a0, void* a1, u32 a2) {
|
|||
sp60.devAddr = (u32)a0;
|
||||
sp60.dramAddr = a1;
|
||||
sp60.size = (u32)a2;
|
||||
ret = osEPiStartDma(D_80096B40, &sp60, 0);
|
||||
ret = osEPiStartDma(gCartHandle, &sp60, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp48, NULL, 1);
|
||||
|
|
@ -45,12 +45,12 @@ END:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void Dmamgr_osEPiStartDmaWrapper(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
void DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
osEPiStartDma(pihandle, mb, direction);
|
||||
}
|
||||
|
||||
DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) {
|
||||
DmadataEntry* curr;
|
||||
DmaEntry* Dmamgr_FindDmaEntry(u32 a0) {
|
||||
DmaEntry* curr;
|
||||
|
||||
for (curr = dmadata; curr->vromEnd != 0; curr++) {
|
||||
if (a0 < curr->vromStart) continue;
|
||||
|
|
@ -63,7 +63,7 @@ DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) {
|
|||
}
|
||||
|
||||
u32 Dmamgr_TranslateVromToRom(u32 a0) {
|
||||
DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
DmaEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
|
||||
if (v0 != NULL) {
|
||||
if (v0->romEnd == 0) {
|
||||
|
|
@ -81,7 +81,7 @@ u32 Dmamgr_TranslateVromToRom(u32 a0) {
|
|||
}
|
||||
|
||||
s32 Dmamgr_FindDmaIndex(u32 a0) {
|
||||
DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
DmaEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
|
||||
if (v0 != NULL) {
|
||||
return v0 - dmadata;
|
||||
|
|
@ -96,7 +96,7 @@ char* func_800809F4(u32 a0) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void Dmamgr_HandleRequest(DmaRequest* a0) {
|
||||
void DmaMgr_ProcessMsg(DmaRequest* a0) {
|
||||
u32 sp34;
|
||||
u32 sp30;
|
||||
UNK_TYPE sp2C;
|
||||
|
|
@ -107,7 +107,7 @@ void Dmamgr_HandleRequest(DmaRequest* a0) {
|
|||
UNK_TYPE sp18;
|
||||
|
||||
sp34 = a0->vromStart;
|
||||
sp30 = a0->vramStart;
|
||||
sp30 = a0->dramAddr;
|
||||
sp2C = a0->size;
|
||||
|
||||
sp1C = Dmamgr_FindDmaIndex(sp34);
|
||||
|
|
@ -117,7 +117,7 @@ void Dmamgr_HandleRequest(DmaRequest* a0) {
|
|||
if (dmadata[sp1C].vromEnd < (sp2C + sp34)) {
|
||||
Fault_AddHungupAndCrash(dmamgrString800981C4, 499);
|
||||
}
|
||||
Dmamgr_DoDmaTransfer((dmadata[sp1C].romStart + sp34) - dmadata[sp1C].vromStart, (u8*)sp30, sp2C);
|
||||
DmaMgr_DMARomToRam((dmadata[sp1C].romStart + sp34) - dmadata[sp1C].vromStart, (u8*)sp30, sp2C);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ void Dmamgr_HandleRequest(DmaRequest* a0) {
|
|||
}
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/z_std_dma/Dmamgr_HandleRequest.asm")
|
||||
GLOBAL_ASM("./asm/non_matchings/z_std_dma/DmaMgr_ProcessMsg.asm")
|
||||
#endif
|
||||
|
||||
void Dmamgr_ThreadEntry(void* a0) {
|
||||
|
|
@ -153,30 +153,30 @@ void Dmamgr_ThreadEntry(void* a0) {
|
|||
osRecvMesg(&dmamgrMsq, &sp34, 1);
|
||||
if (sp34 == NULL) return;
|
||||
s0 = (DmaRequest*)sp34;
|
||||
Dmamgr_HandleRequest(s0);
|
||||
if (s0->callback == NULL) continue;
|
||||
osSendMesg(s0->callback, s0->callbackMesg, 0);
|
||||
DmaMgr_ProcessMsg(s0);
|
||||
if (s0->notifyQueue == NULL) continue;
|
||||
osSendMesg(s0->notifyQueue, s0->notifyMsg, 0);
|
||||
}
|
||||
}
|
||||
|
||||
s32 Dmamgr_SendRequest(DmaRequest* request, u32 vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* callback, void* callbackMesg) {
|
||||
if (gPrenmiStage >= 2) {
|
||||
s32 DmaMgr_SendRequestImpl(DmaRequest* request, u32 vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* callback, void* callbackMesg) {
|
||||
if (gIrqMgrResetStatus >= 2) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
request->vromStart = vromStart;
|
||||
request->vramStart = vramStart;
|
||||
request->dramAddr = vramStart;
|
||||
request->size = size;
|
||||
request->unk14 = 0;
|
||||
request->callback = callback;
|
||||
request->callbackMesg = callbackMesg;
|
||||
request->notifyQueue = callback;
|
||||
request->notifyMsg = callbackMesg;
|
||||
|
||||
osSendMesg(&dmamgrMsq, request, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Dmamgr_SendRequestAndWait(u32 a0, u32 a1, u32 a2) {
|
||||
s32 DmaMgr_SendRequest0(u32 a0, u32 a1, u32 a2) {
|
||||
DmaRequest sp48;
|
||||
OSMesgQueue sp30;
|
||||
OSMesg sp2C;
|
||||
|
|
@ -184,7 +184,7 @@ s32 Dmamgr_SendRequestAndWait(u32 a0, u32 a1, u32 a2) {
|
|||
|
||||
osCreateMesgQueue(&sp30, &sp2C, 1);
|
||||
|
||||
ret = Dmamgr_SendRequest(&sp48, a0, a1, a2, 0, &sp30, 0);
|
||||
ret = DmaMgr_SendRequestImpl(&sp48, a0, a1, a2, 0, &sp30, 0);
|
||||
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
|
|
@ -198,9 +198,9 @@ s32 Dmamgr_SendRequestAndWait(u32 a0, u32 a1, u32 a2) {
|
|||
#ifdef NON_MATCHING
|
||||
// TODO missing a useless move initializing v0, and some reorderings
|
||||
void Dmamgr_Start() {
|
||||
DmadataEntry* v0;
|
||||
DmaEntry* v0;
|
||||
u32 v1;
|
||||
Dmamgr_DoDmaTransfer((u32)&dmadata_vrom_start, dmadata, (u32)&dmadata_vrom_end - (u32)&dmadata_vrom_start);
|
||||
DmaMgr_DMARomToRam((u32)&dmadata_vrom_start, dmadata, (u32)&dmadata_vrom_end - (u32)&dmadata_vrom_start);
|
||||
|
||||
for (v0 = dmadata, v1 = 0; v0->vromEnd != 0; v0++, v1++);
|
||||
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ void Fault_SetFB(void* fb, u16 w, u16 h) {
|
|||
|
||||
void Fault_Start(void){
|
||||
faultCtxt = &faultContextStruct;
|
||||
bzero(faultCtxt, sizeof(FaultContext));
|
||||
bzero(faultCtxt, sizeof(FaultThreadStruct));
|
||||
FaultDrawer_Init();
|
||||
FaultDrawer_SetInputCallback(Fault_WaitForInput);
|
||||
faultCtxt->exitDebugger = 0;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
FaultDrawer* faultDrawContext = &faultDrawContextStruct;
|
||||
FaultDrawer faultDrawContextInit = {
|
||||
FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct;
|
||||
FaultDrawer sFaultDrawerDefault = {
|
||||
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
|
||||
320, 240, // w, h
|
||||
16, 223, // yStart, yEnd
|
||||
|
|
@ -22,7 +22,7 @@ FaultDrawer faultDrawContextInit = {
|
|||
};
|
||||
|
||||
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
faultDrawContext->osSyncPrintfEnabled = enabled;
|
||||
sFaultDrawContext->osSyncPrintfEnabled = enabled;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -32,9 +32,9 @@ void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 col
|
|||
s32 x;
|
||||
s32 y;
|
||||
u16* fb;
|
||||
if (faultDrawContext->w - xstart > 0 && faultDrawContext->h - ystart > 0) {
|
||||
if (sFaultDrawContext->w - xstart > 0 && sFaultDrawContext->h - ystart > 0) {
|
||||
for (y = 0; y < yend - ystart + 1; y++) {
|
||||
fb = &faultDrawContext->fb[faultDrawContext->w * y];
|
||||
fb = &sFaultDrawContext->fb[sFaultDrawContext->w * y];
|
||||
for (x = 0; x < xend - xstart + 1; x++) {
|
||||
*fb++ = color;
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ GLOBAL_ASM("./asm/non_matchings/fault_drawer/FaultDrawer_DrawChar.asm")
|
|||
s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
||||
s32 i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (color == faultDrawContext->printColors[i]) {
|
||||
if (color == sFaultDrawContext->printColors[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
@ -61,13 +61,13 @@ s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
|||
|
||||
void FaultDrawer_UpdatePrintColor() {
|
||||
s32 idx;
|
||||
if (faultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
Fault_Log(D_80099050);
|
||||
idx = FaultDrawer_ColorToPrintColor(faultDrawContext->foreColor);
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->foreColor);
|
||||
if (idx >= 0 && idx < 8) {
|
||||
Fault_Log(D_80099054, idx);
|
||||
}
|
||||
idx = FaultDrawer_ColorToPrintColor(faultDrawContext->backColor);
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->backColor);
|
||||
if (idx >= 0 && idx < 8) {
|
||||
Fault_Log(D_8009905C, idx);
|
||||
}
|
||||
|
|
@ -75,12 +75,12 @@ void FaultDrawer_UpdatePrintColor() {
|
|||
}
|
||||
|
||||
void FaultDrawer_SetForeColor(u16 color) {
|
||||
faultDrawContext->foreColor = color;
|
||||
sFaultDrawContext->foreColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
void FaultDrawer_SetBackColor(u16 color) {
|
||||
faultDrawContext->backColor = color;
|
||||
sFaultDrawContext->backColor = color;
|
||||
FaultDrawer_UpdatePrintColor();
|
||||
}
|
||||
|
||||
|
|
@ -89,31 +89,31 @@ void FaultDrawer_SetFontColor(u16 color) {
|
|||
}
|
||||
|
||||
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
|
||||
faultDrawContext->charWPad = padW;
|
||||
faultDrawContext->charHPad = padH;
|
||||
sFaultDrawContext->charWPad = padW;
|
||||
sFaultDrawContext->charHPad = padH;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCursor(s32 x, s32 y) {
|
||||
if (faultDrawContext->osSyncPrintfEnabled) {
|
||||
Fault_Log(D_80099064, (y - faultDrawContext->yStart) / (faultDrawContext->charH + faultDrawContext->charHPad), (x - faultDrawContext->xStart) / (faultDrawContext->charW + faultDrawContext->charWPad));
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
Fault_Log(D_80099064, (y - sFaultDrawContext->yStart) / (sFaultDrawContext->charH + sFaultDrawContext->charHPad), (x - sFaultDrawContext->xStart) / (sFaultDrawContext->charW + sFaultDrawContext->charWPad));
|
||||
}
|
||||
faultDrawContext->cursorX = x;
|
||||
faultDrawContext->cursorY = y;
|
||||
sFaultDrawContext->cursorX = x;
|
||||
sFaultDrawContext->cursorY = y;
|
||||
}
|
||||
|
||||
void FaultDrawer_FillScreen() {
|
||||
if (faultDrawContext->osSyncPrintfEnabled) {
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
Fault_Log(D_80099070);
|
||||
}
|
||||
|
||||
FaultDrawer_DrawRecImpl(faultDrawContext->xStart, faultDrawContext->yStart, faultDrawContext->xEnd, faultDrawContext->yEnd, faultDrawContext->backColor | 1);
|
||||
FaultDrawer_SetCursor(faultDrawContext->xStart, faultDrawContext->yStart);
|
||||
FaultDrawer_DrawRecImpl(sFaultDrawContext->xStart, sFaultDrawContext->yStart, sFaultDrawContext->xEnd, sFaultDrawContext->yEnd, sFaultDrawContext->backColor | 1);
|
||||
FaultDrawer_SetCursor(sFaultDrawContext->xStart, sFaultDrawContext->yStart);
|
||||
}
|
||||
|
||||
GLOBAL_ASM("./asm/non_matchings/fault_drawer/FaultDrawer_FormatStringFunc.asm")
|
||||
|
||||
void FaultDrawer_VPrintf(char* str, char* args) { //va_list
|
||||
_Printf((printf_func)FaultDrawer_FormatStringFunc, faultDrawContext, str, args);
|
||||
_Printf((printf_func)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args);
|
||||
}
|
||||
|
||||
GLOBAL_ASM("./asm/non_matchings/fault_drawer/FaultDrawer_Printf.asm")
|
||||
|
|
@ -121,18 +121,18 @@ GLOBAL_ASM("./asm/non_matchings/fault_drawer/FaultDrawer_Printf.asm")
|
|||
GLOBAL_ASM("./asm/non_matchings/fault_drawer/FaultDrawer_DrawText.asm")
|
||||
|
||||
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) {
|
||||
faultDrawContext->fb = (u16*)fb;
|
||||
faultDrawContext->w = w;
|
||||
faultDrawContext->h = h;
|
||||
sFaultDrawContext->fb = (u16*)fb;
|
||||
sFaultDrawContext->w = w;
|
||||
sFaultDrawContext->h = h;
|
||||
}
|
||||
|
||||
void FaultDrawer_SetInputCallback(void(*callback)()) {
|
||||
faultDrawContext->inputCallback = callback;
|
||||
sFaultDrawContext->inputCallback = callback;
|
||||
}
|
||||
|
||||
void FaultDrawer_Init() {
|
||||
faultDrawContext = &faultDrawContextStruct;
|
||||
_bcopy(&faultDrawContextInit, faultDrawContext, sizeof(FaultDrawer));
|
||||
faultDrawContext->fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
|
||||
sFaultDrawContext = &sFaultDrawerStruct;
|
||||
_bcopy(&sFaultDrawerDefault, sFaultDrawContext, sizeof(FaultDrawer));
|
||||
sFaultDrawContext->fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
ActorEnAObj* s0 = (ActorEnAObj*)this;
|
||||
s0->base.textId = ((s0->base.variable >> 8) & 0xFF) | 0x300;
|
||||
s0->base.variable = (s0->base.variable & 0xFF) - 9;
|
||||
Lib_ApplyActorInitVars((Actor*)s0, (ActorInitVar*)&enAObjInitVar);
|
||||
Actor_SetDrawParams(&s0->base.drawParams, 0, (actor_post_draw_func)func_800B3FC0, 12);
|
||||
s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
|
||||
s0->base.params = (s0->base.params & 0xFF) - 9;
|
||||
Actor_ProcessInitChain((Actor*)s0, (ActorInitVar*)&enAObjInitVar);
|
||||
Actor_SetDrawParams(&s0->base.shape, 0, (actor_shadow_draw_func)func_800B3FC0, 12);
|
||||
Collision_InitCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
|
||||
Collision_CylinderMoveToActor((Actor*)s0, &s0->collision);
|
||||
s0->base.unkA0.unk16 = 255;
|
||||
s0->base.unkA0.mass = 255;
|
||||
s0->update = (actor_func)EnAObj_Update1;
|
||||
}
|
||||
|
||||
void EnAObj_Fini(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
void EnAObj_Destroy(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
ColCylinder* a2 = &this->collision;
|
||||
Collision_FiniCylinder(ctxt, a2);
|
||||
}
|
||||
|
|
@ -26,9 +26,9 @@ void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt) {
|
|||
if (func_800B84D0((Actor*)this, ctxt) != 0) {
|
||||
this->update = (actor_func)EnAObj_Update2;
|
||||
} else {
|
||||
v0 = this->base.yawToLink - this->base.drawParams.rot.y;
|
||||
v0 = this->base.rotTowardsLinkY - this->base.shape.rot.y;
|
||||
v1 = (v0 < 0)? -v0 : v0;
|
||||
if ((v1 < 10240) || ((this->base.variable == 1) && (v1 > 22528))) {
|
||||
if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
|
||||
func_800B863C((Actor*)this, ctxt);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,12 +40,12 @@ void EnAObj_Update2(ActorEnAObj* this, GlobalContext* ctxt) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnAObj_Main(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
void EnAObj_Update(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
(this->update)((Actor*)this, (GlobalContext*)ctxt);
|
||||
Actor_SetHeight((Actor*)this, 45.0f);
|
||||
Collision_AddOT(ctxt, &ctxt->collisionContext, (ColCommon*)&this->collision);
|
||||
Collision_AddOT(ctxt, &ctxt->colCheckCtx, (ColCommon*)&this->collision);
|
||||
}
|
||||
|
||||
void EnAObj_Draw(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
func_800BDFC0(ctxt, enAObjDisplayLists[this->base.variable]);
|
||||
func_800BDFC0(ctxt, enAObjDisplayLists[this->base.params]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
void func_800BF9A0(s32 a0, s32 a1) {
|
||||
s32 i;
|
||||
ActorOverlayTableEntry* s0;
|
||||
ActorOverlay* s0;
|
||||
s32 v1;
|
||||
|
||||
func_8008439C(-2, 0);
|
||||
|
|
@ -11,27 +11,27 @@ void func_800BF9A0(s32 a0, s32 a1) {
|
|||
func_800847CC(D_801DCBC4);
|
||||
|
||||
for (i = 0, s0 = &actorOverlayTable[0]; i < D_801B4610; i++, s0++) {
|
||||
v1 = s0->vramEnd - s0->vramStart;
|
||||
if (s0->ramAddr == 0) continue;
|
||||
func_800847CC(D_801DCBE4, i, s0->ramAddr, s0->ramAddr + v1, s0->clients, &D_801DCBFC);
|
||||
v1 = (u32)s0->vramEnd - (u32)s0->vramStart;
|
||||
if (s0->loadedRamAddr == NULL) continue;
|
||||
func_800847CC(D_801DCBE4, i, s0->loadedRamAddr, (u32)s0->loadedRamAddr + v1, s0->nbLoaded, &D_801DCBFC);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800BFA78(s32 a0, s32 a1) {
|
||||
s32 i;
|
||||
ActorOverlayTableEntry* v0 = &actorOverlayTable[0];
|
||||
ActorOverlay* v0 = &actorOverlayTable[0];
|
||||
s32 t1;
|
||||
s32 a2;
|
||||
s32 a0_2 = a0;
|
||||
|
||||
for (i = 0; i < D_801B4610; i++, v0++) {
|
||||
t1 = v0->vramStart - v0->ramAddr;
|
||||
a2 = v0->vramEnd - v0->vramStart;
|
||||
t1 = (u32)v0->vramStart - (u32)v0->loadedRamAddr;
|
||||
a2 = (u32)v0->vramEnd - (u32)v0->vramStart;
|
||||
|
||||
if (v0->ramAddr == 0) continue;
|
||||
if (a0_2 < v0->ramAddr) continue;
|
||||
if (v0->loadedRamAddr == NULL) continue;
|
||||
if (a0_2 < (u32)v0->loadedRamAddr) continue;
|
||||
|
||||
if (a0_2 < (v0->ramAddr + a2)) {
|
||||
if (a0_2 < ((u32)v0->loadedRamAddr + a2)) {
|
||||
return a0_2 + t1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,38 +5,38 @@
|
|||
// Perhaps it is called something like z_bgcheck_attach.c
|
||||
// The functions will use the BgCheck2 prefix for now.
|
||||
|
||||
void BgCheck2_UpdateActorPosition(BgCheckContext* bgCtxt, s32 index, Actor* actor) {
|
||||
void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* actor) {
|
||||
z_Matrix prevMatrix;
|
||||
z_Matrix prevMatrixInv;
|
||||
z_Matrix currMatrix;
|
||||
Vector3f newPos;
|
||||
Vector3f posWithInv;
|
||||
Vec3f newPos;
|
||||
Vec3f posWithInv;
|
||||
|
||||
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
|
||||
|
||||
Matrix_MakeTranslationRotationYXZScale(&prevMatrix,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.scale.x,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.scale.y,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.scale.z,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.rotation.x,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.rotation.y,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.rotation.z,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.pos.x,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.pos.y,
|
||||
bgCtxt->dyna.actorMeshes[index].prevParams.pos.z);
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.scale.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.scale.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.scale.z,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.rotation.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.rotation.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.rotation.z,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.pos.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.pos.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].prevParams.pos.z);
|
||||
|
||||
if (Matrix_Invert(&prevMatrix, &prevMatrixInv) == 2) return;
|
||||
|
||||
Matrix_MakeTranslationRotationYXZScale(&currMatrix,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.scale.x,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.scale.y,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.scale.z,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.rotation.x,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.rotation.y,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.rotation.z,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.pos.x,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.pos.y,
|
||||
bgCtxt->dyna.actorMeshes[index].currParams.pos.z);
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.scale.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.scale.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.scale.z,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.rotation.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.rotation.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.rotation.z,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.pos.x,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.pos.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.pos.z);
|
||||
|
||||
Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->currPosRot.pos, &posWithInv);
|
||||
Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos);
|
||||
|
|
@ -44,23 +44,23 @@ void BgCheck2_UpdateActorPosition(BgCheckContext* bgCtxt, s32 index, Actor* acto
|
|||
actor->currPosRot.pos = newPos;
|
||||
}
|
||||
|
||||
void BgCheck2_UpdateActorYRotation(BgCheckContext* bgCtxt, s32 index, Actor* actor) {
|
||||
void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* actor) {
|
||||
s16 angleChange;
|
||||
|
||||
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
|
||||
|
||||
angleChange = bgCtxt->dyna.actorMeshes[index].currParams.rotation.y - bgCtxt->dyna.actorMeshes[index].prevParams.rotation.y;
|
||||
angleChange = bgCtxt->dyna.actorMeshArr[index].currParams.rotation.y - bgCtxt->dyna.actorMeshArr[index].prevParams.rotation.y;
|
||||
|
||||
if (actor->id == 0) {
|
||||
((ActorPlayer*)actor)->unkAD4 += angleChange;
|
||||
}
|
||||
|
||||
actor->drawParams.rot.y += angleChange;
|
||||
actor->shape.rot.y += angleChange;
|
||||
actor->currPosRot.rot.y += angleChange;
|
||||
}
|
||||
|
||||
void BgCheck2_AttachToMesh(BgCheckContext* bgCtxt, Actor* actor, s32 index) {
|
||||
BgActor *meshActor;
|
||||
void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
|
||||
DynaPolyActor *meshActor;
|
||||
|
||||
if (BgCheck_IsActorMeshIndexValid(index) == 0) return;
|
||||
|
||||
|
|
@ -77,13 +77,13 @@ void BgCheck2_AttachToMesh(BgCheckContext* bgCtxt, Actor* actor, s32 index) {
|
|||
}
|
||||
}
|
||||
|
||||
u32 BgCheck2_UpdateActorAttachedToMesh(BgCheckContext* bgCtxt, s32 index, Actor* actor) {
|
||||
u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* bgCtxt, s32 index, Actor* actor) {
|
||||
u32 wasUpdated = 0;
|
||||
BgActor *meshActor;
|
||||
DynaPolyActor *meshActor;
|
||||
|
||||
if (BgCheck_IsActorMeshIndexValid(index) == 0) return 0;
|
||||
|
||||
if (((bgCtxt->dyna.meshParams[index] & 2) != 0) || ((bgCtxt->dyna.meshParams[index] & 1) == 0)) return 0;
|
||||
if (((bgCtxt->dyna.flags[index] & 2) != 0) || ((bgCtxt->dyna.flags[index] & 1) == 0)) return 0;
|
||||
|
||||
meshActor = BgCheck_GetActorOfMesh(bgCtxt,index);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,98 +1,98 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void BcCheck3_BgActorInit(BgActor* actor, UNK_TYPE4 param_2) {
|
||||
actor->bgActorId = -1;
|
||||
void BcCheck3_BgActorInit(DynaPolyActor* actor, UNK_TYPE4 param_2) {
|
||||
actor->dynaPolyId = -1;
|
||||
actor->unk148 = 0;
|
||||
actor->unk14C = 0;
|
||||
actor->unk154 = param_2;
|
||||
actor->bgFlags = 0;
|
||||
actor->dynaFlags = 0;
|
||||
}
|
||||
|
||||
void BgCheck3_LoadMesh(GlobalContext* ctxt, BgActor* actor, BgMeshHeader* meshHeader) {
|
||||
void BgCheck3_LoadMesh(GlobalContext* ctxt, DynaPolyActor* actor, BgMeshHeader* meshHeader) {
|
||||
BgMeshHeader* header;
|
||||
|
||||
header = NULL;
|
||||
BgCheck_RelocateMeshHeader(meshHeader, &header);
|
||||
actor->bgActorId = BgCheck_AddActorMesh(ctxt, &ctxt->bgCheckContext.dyna, actor, header);
|
||||
actor->dynaPolyId = BgCheck_AddActorMesh(ctxt, &ctxt->colCtx.dyna, actor, header);
|
||||
}
|
||||
|
||||
void BgCheck3_ResetFlags(BgActor* actor) {
|
||||
actor->bgFlags = 0;
|
||||
void BgCheck3_ResetFlags(DynaPolyActor* actor) {
|
||||
actor->dynaFlags = 0;
|
||||
}
|
||||
|
||||
void func_800CAE88(BgActor* actor) {
|
||||
actor->bgFlags |= 1;
|
||||
void func_800CAE88(DynaPolyActor* actor) {
|
||||
actor->dynaFlags |= 1;
|
||||
}
|
||||
|
||||
void func_800CAE9C(BgActor* actor) {
|
||||
actor->bgFlags |= 2;
|
||||
void func_800CAE9C(DynaPolyActor* actor) {
|
||||
actor->dynaFlags |= 2;
|
||||
}
|
||||
|
||||
void func_800CAEB0(BgCheckContext* bgCtxt, s32 index) {
|
||||
BgActor* actor;
|
||||
void func_800CAEB0(CollisionContext* bgCtxt, s32 index) {
|
||||
DynaPolyActor* actor;
|
||||
|
||||
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
|
||||
if (actor != (BgActor *)0x0) {
|
||||
if (actor != (DynaPolyActor *)0x0) {
|
||||
func_800CAE9C(actor);
|
||||
}
|
||||
}
|
||||
|
||||
void func_800CAEE0(BgActor* actor) {
|
||||
actor->bgFlags |= 4;
|
||||
void func_800CAEE0(DynaPolyActor* actor) {
|
||||
actor->dynaFlags |= 4;
|
||||
}
|
||||
|
||||
void func_800CAEF4(BgCheckContext* bgCtxt, s32 index) {
|
||||
BgActor* actor;
|
||||
void func_800CAEF4(CollisionContext* bgCtxt, s32 index) {
|
||||
DynaPolyActor* actor;
|
||||
|
||||
actor = BgCheck_GetActorOfMesh(bgCtxt, index);
|
||||
if (actor != (BgActor *)0x0) {
|
||||
if (actor != (DynaPolyActor *)0x0) {
|
||||
func_800CAEE0(actor);
|
||||
}
|
||||
}
|
||||
|
||||
void func_800CAF24(BgActor* actor) {
|
||||
actor->bgFlags |= 8;
|
||||
void func_800CAF24(DynaPolyActor* actor) {
|
||||
actor->dynaFlags |= 8;
|
||||
}
|
||||
|
||||
void func_800CAF38(BgActor* actor) {
|
||||
actor->bgFlags |= 0x10;
|
||||
void func_800CAF38(DynaPolyActor* actor) {
|
||||
actor->dynaFlags |= 0x10;
|
||||
}
|
||||
|
||||
s32 func_800CAF4C(BgActor* actor) {
|
||||
if (actor->bgFlags & 1) {
|
||||
s32 func_800CAF4C(DynaPolyActor* actor) {
|
||||
if (actor->dynaFlags & 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800CAF70(BgActor* actor) {
|
||||
if (actor->bgFlags & 2) {
|
||||
s32 func_800CAF70(DynaPolyActor* actor) {
|
||||
if (actor->dynaFlags & 2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800CAF94(BgActor* actor) {
|
||||
if (actor->bgFlags & 4) {
|
||||
s32 func_800CAF94(DynaPolyActor* actor) {
|
||||
if (actor->dynaFlags & 4) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800CAFB8(BgActor* actor) {
|
||||
if (actor->bgFlags & 8) {
|
||||
s32 func_800CAFB8(DynaPolyActor* actor) {
|
||||
if (actor->dynaFlags & 8) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800CAFDC(BgActor* actor) {
|
||||
if (actor->bgFlags & 0x10) {
|
||||
s32 func_800CAFDC(DynaPolyActor* actor) {
|
||||
if (actor->dynaFlags & 0x10) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -18,26 +18,26 @@ s32 nop_800E8EEC(UNK_TYPE4 param_1) {
|
|||
|
||||
void nop_800E8EFC(UNK_TYPE4 param_1) {}
|
||||
|
||||
s32 func_800E8F08(Vector3s* param_1, Vector3s* param_2) {
|
||||
Lib_ScaleMaxMin_s(¶m_1->y, 0, 6, 6200, 100);
|
||||
Lib_ScaleMaxMin_s(¶m_1->x, 0, 6, 6200, 100);
|
||||
Lib_ScaleMaxMin_s(¶m_2->y, 0, 6, 6200, 100);
|
||||
Lib_ScaleMaxMin_s(¶m_2->x, 0, 6, 6200, 100);
|
||||
s32 func_800E8F08(Vec3s* param_1, Vec3s* param_2) {
|
||||
Math_SmoothScaleMaxMinS(¶m_1->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_1->x, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_2->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(¶m_2->x, 0, 6, 6200, 100);
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800E8FA4(Actor* actor, Vector3f* param_2, Vector3s* param_3, Vector3s* param_4) {
|
||||
s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4) {
|
||||
s16 targetPitch;
|
||||
s16 targetYaw;
|
||||
s16 yawDiffFromTarget;
|
||||
|
||||
targetPitch = Lib_PitchVec3f(&actor->topPosRot.pos,param_2);
|
||||
targetYaw = Lib_YawVec3f(&actor->topPosRot.pos,param_2) - actor->currPosRot.rot.y;
|
||||
targetPitch = Math_Vec3f_Pitch(&actor->topPosRot.pos,param_2);
|
||||
targetYaw = Math_Vec3f_Yaw(&actor->topPosRot.pos,param_2) - actor->currPosRot.rot.y;
|
||||
|
||||
Lib_ScaleMaxMin_s(¶m_3->x, targetPitch, 6, 2000, 1);
|
||||
Math_SmoothScaleMaxMinS(¶m_3->x, targetPitch, 6, 2000, 1);
|
||||
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
|
||||
|
||||
yawDiffFromTarget = Lib_ScaleMaxMin_s(¶m_3->y, targetYaw, 6, 2000, 1);
|
||||
yawDiffFromTarget = Math_SmoothScaleMaxMinS(¶m_3->y, targetYaw, 6, 2000, 1);
|
||||
param_3->y = (param_3->y < -8000)? -8000 : ((8000 < param_3->y)? 8000 : param_3->y);
|
||||
|
||||
if (yawDiffFromTarget != 0) {
|
||||
|
|
@ -46,23 +46,23 @@ s32 func_800E8FA4(Actor* actor, Vector3f* param_2, Vector3s* param_3, Vector3s*
|
|||
}
|
||||
}
|
||||
|
||||
Lib_ScaleMaxMin_s(¶m_4->y, targetYaw - param_3->y, 4, 2000, 1);
|
||||
Math_SmoothScaleMaxMinS(¶m_4->y, targetYaw - param_3->y, 4, 2000, 1);
|
||||
param_4->y = (param_4->y < -12000)? -12000 : ((12000 < param_4->y)? 12000 : param_4->y);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, f32 param_5) {
|
||||
s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) {
|
||||
s16 sVar3;
|
||||
Actor *player;
|
||||
Vector3f local_14;
|
||||
Vec3f local_14;
|
||||
|
||||
player = (ctxt->actorContext).actorTypeLists[2].head;
|
||||
player = (ctxt->actorCtx).actorList[2].first;
|
||||
actor->topPosRot.pos = actor->currPosRot.pos;
|
||||
actor->topPosRot.pos.y += param_5;
|
||||
|
||||
if (((ctxt->cutsceneContext).state == 0) && (D_801D0D50 == 0)) {
|
||||
sVar3 = actor->yawToLink - actor->drawParams.rot.y;
|
||||
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
|
||||
sVar3 = actor->rotTowardsLinkY - actor->shape.rot.y;
|
||||
// TODO is this shifting because of a missing cast?
|
||||
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
|
||||
func_800E8F08(param_3,param_4);
|
||||
|
|
@ -70,7 +70,7 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s
|
|||
}
|
||||
}
|
||||
|
||||
if (((ctxt->cutsceneContext).state != 0) || (D_801D0D50 != 0)) {
|
||||
if (((ctxt->csCtx).state != 0) || (D_801D0D50 != 0)) {
|
||||
local_14 = ctxt->view.eye;
|
||||
} else {
|
||||
local_14 = player->topPosRot.pos;
|
||||
|
|
@ -80,16 +80,16 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s
|
|||
|
||||
return 1;
|
||||
}
|
||||
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s* param_4, Vector3f param_5) {
|
||||
s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) {
|
||||
s16 sVar3;
|
||||
Actor *player;
|
||||
Vector3f local_14;
|
||||
Vec3f local_14;
|
||||
|
||||
player = (ctxt->actorContext).actorTypeLists[2].head;
|
||||
player = (ctxt->actorCtx).actorList[2].first;
|
||||
actor->topPosRot.pos = param_5;
|
||||
|
||||
if (((ctxt->cutsceneContext).state == 0) && (D_801D0D50 == 0)) {
|
||||
sVar3 = actor->yawToLink - actor->drawParams.rot.y;
|
||||
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
|
||||
sVar3 = actor->rotTowardsLinkY - actor->shape.rot.y;
|
||||
// TODO is this shifting because of a missing cast?
|
||||
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
|
||||
func_800E8F08(param_3,param_4);
|
||||
|
|
@ -97,7 +97,7 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vector3s* param_3, Vector3s
|
|||
}
|
||||
}
|
||||
|
||||
if (((ctxt->cutsceneContext).state != 0) || (D_801D0D50 != 0)) {
|
||||
if (((ctxt->csCtx).state != 0) || (D_801D0D50 != 0)) {
|
||||
local_14 = ctxt->view.eye;
|
||||
} else {
|
||||
local_14 = player->topPosRot.pos;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
GLOBAL_ASM("asm/non_matchings/z_actor//Actor_PrintLists.asm")
|
||||
|
||||
void Actor_SetDrawParams(ActorDrawParams* iParm1, f32 yDisplacement, actor_post_draw_func func, f32 scale) {
|
||||
void Actor_SetDrawParams(ActorShape* iParm1, f32 yDisplacement, actor_shadow_draw_func func, f32 scale) {
|
||||
iParm1->yDisplacement = yDisplacement;
|
||||
iParm1->postDrawFunc = func;
|
||||
iParm1->shadowDrawFunc = func;
|
||||
iParm1->scale = scale;
|
||||
iParm1->alphaScale = 255;
|
||||
}
|
||||
|
|
@ -58,73 +58,73 @@ GLOBAL_ASM("asm/non_matchings/z_actor//func_800B5814.asm")
|
|||
|
||||
u32 Actor_GetSwitchFlag(GlobalContext* ctxt, s32 flag) {
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
return ctxt->actorContext.switchFlags[(flag & -0x20) >> 5] & (1 << (flag & 0x1F));
|
||||
return ctxt->actorCtx.switchFlags[(flag & -0x20) >> 5] & (1 << (flag & 0x1F));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Actor_SetSwitchFlag(GlobalContext* ctxt, s32 flag){
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
ctxt->actorContext.switchFlags[(flag & -0x20) >> 5] |= 1 << (flag & 0x1F);
|
||||
ctxt->actorCtx.switchFlags[(flag & -0x20) >> 5] |= 1 << (flag & 0x1F);
|
||||
}
|
||||
}
|
||||
|
||||
void Actor_UnsetSwitchFlag(GlobalContext* ctxt, s32 flag) {
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
ctxt->actorContext.switchFlags[(flag & -0x20) >> 5] &= ~(1 << (flag & 0x1F));
|
||||
ctxt->actorCtx.switchFlags[(flag & -0x20) >> 5] &= ~(1 << (flag & 0x1F));
|
||||
}
|
||||
}
|
||||
|
||||
u32 Actor_GetChestFlag(GlobalContext* ctxt, u32 flag) {
|
||||
return ctxt->actorContext.chestFlags & (1 << flag);
|
||||
return ctxt->actorCtx.chestFlags & (1 << flag);
|
||||
}
|
||||
|
||||
void Actor_SetChestFlag(GlobalContext* ctxt, u32 flag) {
|
||||
ctxt->actorContext.chestFlags |= (1 << flag);
|
||||
ctxt->actorCtx.chestFlags |= (1 << flag);
|
||||
}
|
||||
|
||||
void Actor_SetAllChestFlag(GlobalContext* ctxt, u32 flag) {
|
||||
ctxt->actorContext.chestFlags = flag;
|
||||
ctxt->actorCtx.chestFlags = flag;
|
||||
}
|
||||
|
||||
u32 Actor_GetAllChestFlag(GlobalContext* ctxt) {
|
||||
return ctxt->actorContext.chestFlags;
|
||||
return ctxt->actorCtx.chestFlags;
|
||||
}
|
||||
|
||||
u32 Actor_GetRoomCleared(GlobalContext* ctxt, u32 roomNumber) {
|
||||
return ctxt->actorContext.clearedRooms & (1 << roomNumber);
|
||||
return ctxt->actorCtx.clearedRooms & (1 << roomNumber);
|
||||
}
|
||||
|
||||
void Actor_SetRoomCleared(GlobalContext* ctxt, u32 roomNumber) {
|
||||
ctxt->actorContext.clearedRooms |= (1 << roomNumber);
|
||||
ctxt->actorCtx.clearedRooms |= (1 << roomNumber);
|
||||
}
|
||||
|
||||
void Actor_UnsetRoomCleared(GlobalContext* ctxt, u32 roomNumber) {
|
||||
ctxt->actorContext.clearedRooms &= ~(1 << roomNumber);
|
||||
ctxt->actorCtx.clearedRooms &= ~(1 << roomNumber);
|
||||
}
|
||||
|
||||
u32 Actor_GetRoomClearedTemp(GlobalContext* ctxt, u32 roomNumber) {
|
||||
return ctxt->actorContext.clearedRoomsTemp & (1 << roomNumber);
|
||||
return ctxt->actorCtx.clearedRoomsTemp & (1 << roomNumber);
|
||||
}
|
||||
|
||||
void Actor_SetRoomClearedTemp(GlobalContext* ctxt, u32 roomNumber) {
|
||||
ctxt->actorContext.clearedRoomsTemp |= (1 << roomNumber);
|
||||
ctxt->actorCtx.clearedRoomsTemp |= (1 << roomNumber);
|
||||
}
|
||||
|
||||
void Actor_UnsetRoomClearedTemp(GlobalContext* ctxt, u32 roomNumber) {
|
||||
ctxt->actorContext.clearedRoomsTemp &= ~(1 << roomNumber);
|
||||
ctxt->actorCtx.clearedRoomsTemp &= ~(1 << roomNumber);
|
||||
}
|
||||
|
||||
u32 Actor_GetCollectibleFlag(GlobalContext* ctxt, s32 index) {
|
||||
if (index > 0 && index < 0x80) {
|
||||
return ctxt->actorContext.collectibleFlags[(index & -0x20) >> 5] & (1 << (index & 0x1F));
|
||||
return ctxt->actorCtx.collectibleFlags[(index & -0x20) >> 5] & (1 << (index & 0x1F));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Actor_SetCollectibleFlag(GlobalContext* ctxt, s32 index) {
|
||||
if (index > 0 && index < 0x80) {
|
||||
ctxt->actorContext.collectibleFlags[(index & -0x20) >> 5] |= 1 << (index & 0x1F);
|
||||
ctxt->actorCtx.collectibleFlags[(index & -0x20) >> 5] |= 1 << (index & 0x1F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ GLOBAL_ASM("asm/non_matchings/z_actor//func_800B6680.asm")
|
|||
|
||||
void Actor_MarkForDeath(Actor* actor) {
|
||||
actor->draw = NULL;
|
||||
actor->main = NULL;
|
||||
actor->update = NULL;
|
||||
actor->flags &= ~0x1;
|
||||
}
|
||||
|
||||
|
|
@ -199,11 +199,11 @@ void Actor_SetHeight(Actor* actor, f32 height) {
|
|||
}
|
||||
|
||||
void Actor_SetRotationFromDrawRotation(Actor* actor) {
|
||||
actor->currPosRot.rot = actor->drawParams.rot;
|
||||
actor->currPosRot.rot = actor->shape.rot;
|
||||
}
|
||||
|
||||
void Actor_InitDrawRotation(Actor* actor) {
|
||||
actor->drawParams.rot = actor->currPosRot.rot;
|
||||
actor->shape.rot = actor->currPosRot.rot;
|
||||
}
|
||||
|
||||
void Actor_SetScale(Actor* actor, f32 scale) {
|
||||
|
|
@ -213,7 +213,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
|
|||
}
|
||||
|
||||
void Actor_SetObjectSegment(GlobalContext* ctxt, Actor* actor) {
|
||||
gRspSegmentPhysAddrs[6] = (u32) ctxt->sceneContext.objects[actor->objectIndex].vramAddr + 0x80000000;
|
||||
gRspSegmentPhysAddrs[6] = (u32) ctxt->sceneContext.objects[actor->objBankIndex].vramAddr + 0x80000000;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
|
|
@ -221,11 +221,11 @@ void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) {
|
|||
Actor_InitCurrPosition(actor);
|
||||
Actor_InitDrawRotation(actor);
|
||||
Actor_SetHeight(actor, 0);
|
||||
Lib_CopyVec3f(&actor->lastPos, &actor->currPosRot.pos);
|
||||
Math_Vec3f_Copy(&actor->lastPos, &actor->currPosRot.pos);
|
||||
Actor_SetScale(actor, 0.01);
|
||||
actor->unk1F = 3;
|
||||
actor->minYVelocity = -20.0f;
|
||||
|
||||
|
||||
actor->meshAttachedTo = 0x32;
|
||||
|
||||
actor->sqrdDistToLink = D_801DCA54;
|
||||
|
|
@ -236,8 +236,8 @@ void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) {
|
|||
|
||||
actor->naviMsgId = 255;
|
||||
|
||||
Actor_SetDrawParams(&actor->drawParams, 0, 0, 0);
|
||||
if (Scene_IsObjectLoaded(&ctxt->sceneContext, actor->objectIndex) != 0) {
|
||||
Actor_Setshape(&actor->shape, 0, 0, 0);
|
||||
if (Scene_IsObjectLoaded(&ctxt->sceneContext, actor->objBankIndex) != 0) {
|
||||
Actor_SetObjectSegment(ctxt, actor);
|
||||
actor->init(actor, ctxt);
|
||||
actor->init = NULL;
|
||||
|
|
@ -249,9 +249,9 @@ GLOBAL_ASM("asm/non_matchings/z_actor//Actor_InitToDefaultValues.asm")
|
|||
|
||||
void Actor_FiniActor(Actor* actor, GlobalContext* ctxt) {
|
||||
if (actor->init == NULL) {
|
||||
if (actor->fini != NULL) {
|
||||
actor->fini(actor, ctxt);
|
||||
actor->fini = NULL;
|
||||
if (actor->destroy != NULL) {
|
||||
actor->destroy(actor, ctxt);
|
||||
actor->destroy = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -272,9 +272,9 @@ GLOBAL_ASM("asm/non_matchings/z_actor//Actor_ApplyMovement.asm")
|
|||
|
||||
#ifdef NON_MATCHING
|
||||
void Actor_SetVelocityYRotationAndGravity(Actor* actor) {
|
||||
actor->velocity.x = actor->speed * Lib_sin(actor->currPosRot.rot.x);
|
||||
actor->velocity.x = actor->speedXZ * Math_Sins(actor->currPosRot.rot.x);
|
||||
actor->velocity.y = actor->velocity.y + actor->gravity;
|
||||
actor->velocity.z = actor->speed * Lib_cos(actor->currPosRot.rot.x);
|
||||
actor->velocity.z = actor->speedXZ * Math_Coss(actor->currPosRot.rot.x);
|
||||
|
||||
if (actor->velocity.y < actor->minYVelocity) {
|
||||
actor->velocity.y = actor->minYVelocity;
|
||||
|
|
@ -290,10 +290,10 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
|
|||
}
|
||||
|
||||
void Actor_SetVelocityXYRotation(Actor* actor) {
|
||||
f32 velX = Lib_cos(actor->currPosRot.rot.x) * actor->speed;
|
||||
actor->velocity.x = Lib_sin(actor->currPosRot.rot.y) * velX;
|
||||
actor->velocity.y = Lib_sin(actor->currPosRot.rot.x) * actor->speed;
|
||||
actor->velocity.z = Lib_cos(actor->currPosRot.rot.y) * velX;
|
||||
f32 velX = Math_Coss(actor->currPosRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_Sins(actor->currPosRot.rot.y) * velX;
|
||||
actor->velocity.y = Math_Sins(actor->currPosRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->currPosRot.rot.y) * velX;
|
||||
}
|
||||
|
||||
void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
|
||||
|
|
@ -302,10 +302,10 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
|
|||
}
|
||||
|
||||
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
|
||||
f32 velX = Lib_cos(-actor->currPosRot.rot.x) * actor->speed;
|
||||
actor->velocity.x = Lib_sin(actor->currPosRot.rot.y) * velX;
|
||||
actor->velocity.y = Lib_sin(-actor->currPosRot.rot.x) * actor->speed;
|
||||
actor->velocity.z = Lib_cos(actor->currPosRot.rot.y) * velX;
|
||||
f32 velX = Math_Coss(-actor->currPosRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_Sins(actor->currPosRot.rot.y) * velX;
|
||||
actor->velocity.y = Math_Sins(-actor->currPosRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->currPosRot.rot.y) * velX;
|
||||
}
|
||||
|
||||
void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) {
|
||||
|
|
@ -318,52 +318,52 @@ GLOBAL_ASM("asm/non_matchings/z_actor//func_800B6C04.asm")
|
|||
GLOBAL_ASM("asm/non_matchings/z_actor//func_800B6C58.asm")
|
||||
|
||||
s16 Actor_YawBetweenActors(Actor* from, Actor* to) {
|
||||
return Lib_YawVec3f(&from->currPosRot.pos, &to->currPosRot.pos);
|
||||
return Math_Vec3f_Yaw(&from->currPosRot.pos, &to->currPosRot.pos);
|
||||
}
|
||||
|
||||
s16 Actor_YawBetweenActorsTop(Actor* from, Actor* to) {
|
||||
return Lib_YawVec3f(&from->topPosRot.pos, &to->topPosRot.pos);
|
||||
return Math_Vec3f_Yaw(&from->topPosRot.pos, &to->topPosRot.pos);
|
||||
}
|
||||
|
||||
s16 Actor_YawToPoint(Actor* actor, Vector3f* point) {
|
||||
return Lib_YawVec3f(&actor->currPosRot.pos, point);
|
||||
s16 Actor_YawToPoint(Actor* actor, Vec3f* point) {
|
||||
return Math_Vec3f_Yaw(&actor->currPosRot.pos, point);
|
||||
}
|
||||
|
||||
s16 Actor_PitchBetweenActors(Actor* from, Actor* to) {
|
||||
return Lib_PitchVec3f(&from->currPosRot.pos, &to->currPosRot.pos);
|
||||
return Math_Vec3f_Pitch(&from->currPosRot.pos, &to->currPosRot.pos);
|
||||
}
|
||||
|
||||
s16 Actor_PitchBetweenActorsTop(Actor* from, Actor* to) {
|
||||
return Lib_PitchVec3f(&from->topPosRot.pos, &to->topPosRot.pos);
|
||||
return Math_Vec3f_Pitch(&from->topPosRot.pos, &to->topPosRot.pos);
|
||||
}
|
||||
|
||||
s16 Actor_PitchToPoint(Actor* actor, Vector3f* point) {
|
||||
return Lib_PitchVec3f(&actor->currPosRot.pos, point);
|
||||
s16 Actor_PitchToPoint(Actor* actor, Vec3f* point) {
|
||||
return Math_Vec3f_Pitch(&actor->currPosRot.pos, point);
|
||||
}
|
||||
|
||||
f32 Actor_DistanceBetweenActors(Actor* actor1, Actor* actor2) {
|
||||
return Lib_DistanceVec3f(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
|
||||
return Math_Vec3f_DistXYZ(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
|
||||
}
|
||||
|
||||
f32 Actor_DistanceToPoint(Actor* actor, Vector3f* point) {
|
||||
return Lib_DistanceVec3f(&actor->currPosRot.pos, point);
|
||||
f32 Actor_DistanceToPoint(Actor* actor, Vec3f* point) {
|
||||
return Math_Vec3f_DistXYZ(&actor->currPosRot.pos, point);
|
||||
}
|
||||
|
||||
f32 Actor_XZDistanceBetweenActors(Actor* actor1, Actor* actor2) {
|
||||
return Lib_DistanceXZVec3f(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
|
||||
return Math_Vec3f_DistXZ(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
|
||||
}
|
||||
|
||||
f32 Actor_XZDistanceToPoint(Actor* actor, Vector3f* point) {
|
||||
return Lib_DistanceXZVec3f(&actor->currPosRot.pos, point);
|
||||
f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point) {
|
||||
return Math_Vec3f_DistXZ(&actor->currPosRot.pos, point);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vector3f* offset, Vector3f* point) {
|
||||
void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f* point) {
|
||||
f32 cos_rot_x;
|
||||
f32 sin_rot_x;
|
||||
|
||||
cos_rot_x = Lib_cos(actor->drawParams.rot.x);
|
||||
sin_rot_x = Lib_sin(actor->drawParams.rot.x);
|
||||
cos_rot_x = Math_Coss(actor->shape.rot.x);
|
||||
sin_rot_x = Math_Sins(actor->shape.rot.x);
|
||||
offset->x = (point->x - actor->currPosRot.pos.x * cos_rot_x) - (point->z - actor->currPosRot.pos.z * sin_rot_x);
|
||||
offset->y = point->y - actor->currPosRot.pos.y;
|
||||
offset->z = (point->z - actor->currPosRot.pos.z * cos_rot_x) + (point->x - actor->currPosRot.pos.x * sin_rot_x);
|
||||
|
|
@ -553,8 +553,8 @@ GLOBAL_ASM("asm/non_matchings/z_actor//Actor_DrawActor.asm")
|
|||
GLOBAL_ASM("asm/non_matchings/z_actor//func_800B9D1C.asm")
|
||||
|
||||
void Actor_DrawAllSetup(GlobalContext* ctxt) {
|
||||
ctxt->actorContext.undrawnActorCount = 0;
|
||||
ctxt->actorContext.unkB = 0;
|
||||
ctxt->actorCtx.undrawnActorCount = 0;
|
||||
ctxt->actorCtx.unkB = 0;
|
||||
}
|
||||
|
||||
GLOBAL_ASM("asm/non_matchings/z_actor//Actor_RecordUndrawnActor.asm")
|
||||
|
|
@ -581,20 +581,20 @@ GLOBAL_ASM("asm/non_matchings/z_actor//Actor_InsertIntoTypeList.asm")
|
|||
|
||||
GLOBAL_ASM("asm/non_matchings/z_actor//Actor_RemoveFromTypeList.asm")
|
||||
|
||||
void Actor_FreeOverlay(ActorOverlayTableEntry* entry) {
|
||||
u32 ramAddr;
|
||||
void Actor_FreeOverlay(ActorOverlay* entry) {
|
||||
void* ramAddr;
|
||||
|
||||
if (entry->clients == 0) {
|
||||
ramAddr = entry->ramAddr;
|
||||
if (ramAddr != 0) {
|
||||
if (entry->nbLoaded == 0) {
|
||||
ramAddr = entry->loadedRamAddr;
|
||||
if (ramAddr != NULL) {
|
||||
//Bit 1 - always loaded
|
||||
if ((entry->flags & 2) == 0) {
|
||||
if ((entry->allocType & 2) == 0) {
|
||||
//Bit 0 - don't alloc memory
|
||||
if ((entry->flags & 1) != 0) {
|
||||
entry->ramAddr = 0;
|
||||
if ((entry->allocType & 1) != 0) {
|
||||
entry->loadedRamAddr = NULL;
|
||||
} else {
|
||||
zelda_free(ramAddr);
|
||||
entry->ramAddr = 0;
|
||||
entry->loadedRamAddr = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void BgCheck_PolygonLinkedListInit(GlobalContext* ctxt, BgPolygonLinkedList* lis
|
|||
}
|
||||
|
||||
void BgCheck_PolygonLinkedListAlloc(GlobalContext* ctxt, BgPolygonLinkedList* list, u32 numNodes) {
|
||||
list->nodes = (BgPolygonLinkedListNode*)GameStateHeap_AllocFromEndAligned(&ctxt->common.heap, numNodes << 2, 0xfffffffe);
|
||||
list->nodes = (BgPolygonLinkedListNode*)GameStateHeap_AllocFromEndAligned(&ctxt->state.heap, numNodes << 2, 0xfffffffe);
|
||||
list->maxNodes = numNodes;
|
||||
list->nextFreeNode = 0;
|
||||
}
|
||||
|
|
@ -52,13 +52,13 @@ u16 BgCheck_AllocPolygonLinkedListNode(BgPolygonLinkedList* list) {
|
|||
return index;
|
||||
}
|
||||
|
||||
void BgCheck_CreateVec3fFromVertex(BgVertex* vertex, Vector3f* vector) {
|
||||
void BgCheck_CreateVec3fFromVertex(BgVertex* vertex, Vec3f* vector) {
|
||||
vector->x = vertex->pos.x;
|
||||
vector->y = vertex->pos.y;
|
||||
vector->z = vertex->pos.z;
|
||||
}
|
||||
|
||||
void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vector3f* vector) {
|
||||
void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vec3f* vector) {
|
||||
vertex->pos.x = vector->x;
|
||||
vertex->pos.y = vector->y;
|
||||
vertex->pos.z = vector->z;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void EffFootmark_Init(GlobalContext* ctxt) {
|
|||
}
|
||||
}
|
||||
|
||||
void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, u8 id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
|
||||
void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
|
||||
s32 i;
|
||||
EffFootmark* footmark;
|
||||
EffFootmark* destination = NULL;
|
||||
|
|
@ -100,22 +100,22 @@ void EffFootmark_Update(GlobalContext* ctxt) {
|
|||
void EffFootmark_Draw(GlobalContext* ctxt) {
|
||||
EffFootmark* footmark;
|
||||
s32 i;
|
||||
GraphicsContext *gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext *gfxCtx = ctxt->state.gfxCtx;
|
||||
|
||||
func_8012C448(ctxt->common.gCtxt);
|
||||
func_8012C448(ctxt->state.gfxCtx);
|
||||
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, D_801BC240);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240);
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
SysMatrix_SetCurrentState(&footmark->displayMatrix);
|
||||
SysMatrix_InsertScale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
|
||||
|
||||
gSPMatrix(gCtxt->polyXlu.append++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->common.gCtxt), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
|
||||
gDPSetPrimColor(gCtxt->polyXlu.append++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
|
||||
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
|
||||
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, D_801BC288);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC288);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
|
||||
u32 i;
|
||||
LoadedParticleEntry* iter;
|
||||
ParticleOverlayTableEntry* iter2;
|
||||
ParticleOverlay* iter2;
|
||||
|
||||
EffectSS2Info.data_table = (LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->common.heap, numEntries * sizeof(LoadedParticleEntry));
|
||||
EffectSS2Info.data_table = (LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->state.heap, numEntries * sizeof(LoadedParticleEntry));
|
||||
EffectSS2Info.searchIndex = 0;
|
||||
EffectSS2Info.size = numEntries;
|
||||
|
||||
for (iter = EffectSS2Info.data_table; iter < EffectSS2Info.data_table + EffectSS2Info.size; iter++) {
|
||||
EffectSS_ResetLoadedParticleEntry(iter);
|
||||
EffectSS_ResetEntry(iter);
|
||||
}
|
||||
|
||||
for (i = 0, iter2 = particleOverlayTable; i != 0x27; i++) {
|
||||
|
|
@ -19,10 +19,10 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
|
|||
}
|
||||
}
|
||||
|
||||
void EffectSS_Fini(GlobalContext* ctxt) {
|
||||
void EffectSS_Clear(GlobalContext* ctxt) {
|
||||
u32 i;
|
||||
LoadedParticleEntry* iter;
|
||||
ParticleOverlayTableEntry* iter2;
|
||||
ParticleOverlay* iter2;
|
||||
void* addr;
|
||||
|
||||
EffectSS2Info.data_table = NULL;
|
||||
|
|
@ -57,10 +57,10 @@ void EffectSS_Delete(LoadedParticleEntry* a0) {
|
|||
func_801A72CC((UNK_PTR)&a0->unk2C);
|
||||
}
|
||||
|
||||
EffectSS_ResetLoadedParticleEntry(a0);
|
||||
EffectSS_ResetEntry(a0);
|
||||
}
|
||||
|
||||
void EffectSS_ResetLoadedParticleEntry(LoadedParticleEntry* particle) {
|
||||
void EffectSS_ResetEntry(LoadedParticleEntry* particle) {
|
||||
u32 i;
|
||||
|
||||
particle->type = 0x27;
|
||||
|
|
@ -164,7 +164,7 @@ void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* in
|
|||
u32 initRet;
|
||||
u32 overlaySize;
|
||||
ParticleOverlayInfo* overlayInfo;
|
||||
ParticleOverlayTableEntry* entry = &particleOverlayTable[type];
|
||||
ParticleOverlay* entry = &particleOverlayTable[type];
|
||||
|
||||
if (EffectSS_FindFreeSpace(priority, &index) != 0) {
|
||||
return;
|
||||
|
|
@ -203,7 +203,7 @@ void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* in
|
|||
initRet = (*overlayInfo->init)(ctxt, index, &EffectSS2Info.data_table[index], initData);
|
||||
|
||||
if (initRet == 0) {
|
||||
EffectSS_ResetLoadedParticleEntry(&EffectSS2Info.data_table[index]);
|
||||
EffectSS_ResetEntry(&EffectSS2Info.data_table[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -256,9 +256,9 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
|
|||
LightMapper* s0;
|
||||
s32 i;
|
||||
|
||||
s0 = Lights_CreateMapper(&ctxt->lightsContext, ctxt->common.gCtxt);
|
||||
Lights_MapLights(s0, ctxt->lightsContext.lightsHead, 0, ctxt);
|
||||
Lights_UploadLights(s0, ctxt->common.gCtxt);
|
||||
s0 = Lights_CreateMapper(&ctxt->lightCtx, ctxt->state.gfxCtx);
|
||||
Lights_MapLights(s0, ctxt->lightCtx.lightsHead, 0, ctxt);
|
||||
Lights_UploadLights(s0, ctxt->state.gfxCtx);
|
||||
|
||||
for (i = 0; i < EffectSS2Info.size; i++) {
|
||||
if (EffectSS2Info.data_table[i].life > -1) {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
void Kanfont_Nop800F4F40(GlobalContext* ctxt, UNK_TYPE param_2, UNK_TYPE param_3) {}
|
||||
|
||||
void Kanfont_LoadAsciiChar(GlobalContext* ctxt, u8 character, s32 iParm3) {
|
||||
Dmamgr_SendRequestAndWait((u32)ctxt->msgContext.font.unk0[(ctxt->msgContext).unk11EF0] + iParm3,
|
||||
DmaMgr_SendRequest0((u32)ctxt->msgCtx.font.unk0[(ctxt->msgCtx).unk11EF0] + iParm3,
|
||||
(u32)&nes_font_static_vrom_start + character * 0x80 - 0x1000,
|
||||
0x80);
|
||||
}
|
||||
|
||||
void Kanfont_LoadMessageBoxEnd(Font* font, u16 type) {
|
||||
Dmamgr_SendRequestAndWait((u32)font->unk7800, type * 0x80 + (u32)&message_static_vrom_start + 0x5000, 0x80);
|
||||
DmaMgr_SendRequest0((u32)font->unk7800, type * 0x80 + (u32)&message_static_vrom_start + 0x5000, 0x80);
|
||||
}
|
||||
|
||||
void Kanfont_LoadOrderedFont(Font* font) {
|
||||
|
|
@ -24,7 +24,7 @@ void Kanfont_LoadOrderedFont(Font* font) {
|
|||
if (kanfontOrdering[codePointIndex] == 0) {
|
||||
loadOffset = 0;
|
||||
}
|
||||
Dmamgr_SendRequestAndWait(writeLocation, (u32)&nes_font_static_vrom_start + loadOffset, 0x80);
|
||||
DmaMgr_SendRequest0(writeLocation, (u32)&nes_font_static_vrom_start + loadOffset, 0x80);
|
||||
if (kanfontOrdering[codePointIndex] == 140) break;
|
||||
codePointIndex++;
|
||||
}
|
||||
|
|
|
|||
126
src/code/z_lib.c
126
src/code/z_lib.c
|
|
@ -12,7 +12,7 @@ void* Lib_bcopy(void* dest, void* src, size_t n) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void* Lib_memset(u8* a0, u32 a1, u32 a2) {
|
||||
void* Lib_MemSet(u8* a0, u32 a1, u32 a2) {
|
||||
u8* v0;
|
||||
|
||||
// XXX: realloc is messed up
|
||||
|
|
@ -29,14 +29,14 @@ void* Lib_memset(u8* a0, u32 a1, u32 a2) {
|
|||
return a0;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Lib_memset.asm")
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Lib_MemSet.asm")
|
||||
#endif
|
||||
|
||||
f32 Lib_cos(s16 angle) {
|
||||
f32 Math_Coss(s16 angle) {
|
||||
return coss(angle) * D_801DDA80;
|
||||
}
|
||||
|
||||
f32 Lib_sin(s16 angle) {
|
||||
f32 Math_Sins(s16 angle) {
|
||||
return sins(angle) * D_801DDA84;
|
||||
}
|
||||
|
||||
|
|
@ -216,15 +216,15 @@ void func_800FF3A0(void) {
|
|||
GLOBAL_ASM("./asm/non_matchings/z_lib/func_800FF3A0.asm")
|
||||
#endif
|
||||
|
||||
s16 Lib_rand_s(s16 base, s16 range) {
|
||||
s16 Math_Rand_S16Offset(s16 base, s16 range) {
|
||||
return (s16)(randZeroOne() * range) + base;
|
||||
}
|
||||
|
||||
s16 Lib_randestride_s(s16 base, s16 stride, s16 range) {
|
||||
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) {
|
||||
return (s16)(randZeroOne() * range) * stride + base;
|
||||
}
|
||||
|
||||
void Lib_CopyVec3f(Vector3f* dest, Vector3f* src) {
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) {
|
||||
f32 x = src->x;
|
||||
f32 y = src->y;
|
||||
f32 z = src->z;
|
||||
|
|
@ -234,7 +234,7 @@ void Lib_CopyVec3f(Vector3f* dest, Vector3f* src) {
|
|||
dest->z = z;
|
||||
}
|
||||
|
||||
void Lib_CopyVec3s(Vector3s* dest, Vector3s* src) {
|
||||
void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src) {
|
||||
s16 x = src->x;
|
||||
s16 y = src->y;
|
||||
s16 z = src->z;
|
||||
|
|
@ -244,7 +244,7 @@ void Lib_CopyVec3s(Vector3s* dest, Vector3s* src) {
|
|||
dest->z = z;
|
||||
}
|
||||
|
||||
void Lib_ToVec3f(Vector3f* dest, Vector3s* src) {
|
||||
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src) {
|
||||
f32 x = src->x;
|
||||
f32 y = src->y;
|
||||
f32 z = src->z;
|
||||
|
|
@ -254,7 +254,7 @@ void Lib_ToVec3f(Vector3f* dest, Vector3s* src) {
|
|||
dest->z = z;
|
||||
}
|
||||
|
||||
void Lib_ToVec3s(Vector3s* dest, Vector3f* src) {
|
||||
void Math_Vec3f_ToVec3s(Vec3s* dest, Vec3f* src) {
|
||||
f32 x = src->x;
|
||||
f32 y = src->y;
|
||||
f32 z = src->z;
|
||||
|
|
@ -264,56 +264,56 @@ void Lib_ToVec3s(Vector3s* dest, Vector3f* src) {
|
|||
dest->z = z;
|
||||
}
|
||||
|
||||
void Lib_AddVec3f(Vector3f* l, Vector3f* r, Vector3f* dest) {
|
||||
void Math_Vec3f_Sum(Vec3f* l, Vec3f* r, Vec3f* dest) {
|
||||
dest->x = l->x + r->x;
|
||||
dest->y = l->y + r->y;
|
||||
dest->z = l->z + r->z;
|
||||
}
|
||||
|
||||
void Lib_SubVec3f(Vector3f* l, Vector3f* r, Vector3f* dest) {
|
||||
void Math_Vec3f_Diff(Vec3f* l, Vec3f* r, Vec3f* dest) {
|
||||
dest->x = l->x - r->x;
|
||||
dest->y = l->y - r->y;
|
||||
dest->z = l->z - r->z;
|
||||
}
|
||||
|
||||
void Lib_SubVec3sToVec3f(Vector3f* dest, Vector3s* l, Vector3s* r) {
|
||||
void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* l, Vec3s* r) {
|
||||
dest->x = l->x - r->x;
|
||||
dest->y = l->y - r->y;
|
||||
dest->z = l->z - r->z;
|
||||
}
|
||||
|
||||
void Lib_ScaleInPlaceVec3f(Vector3f* vec, f32 scale) {
|
||||
void Math_Vec3f_Scale(Vec3f* vec, f32 scale) {
|
||||
vec->x *= scale;
|
||||
vec->y *= scale;
|
||||
vec->z *= scale;
|
||||
}
|
||||
|
||||
void Lib_ScaleVec3f(Vector3f* vec, f32 scale, Vector3f* dest) {
|
||||
void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest) {
|
||||
dest->x = vec->x * scale;
|
||||
dest->y = vec->y * scale;
|
||||
dest->z = vec->z * scale;
|
||||
}
|
||||
|
||||
void Lib_LerpVec3f(Vector3f* a, Vector3f* b, f32 t, Vector3f* dest) {
|
||||
void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest) {
|
||||
dest->x = (b->x - a->x) * t + a->x;
|
||||
dest->y = (b->y - a->y) * t + a->y;
|
||||
dest->z = (b->z - a->z) * t + a->z;
|
||||
}
|
||||
|
||||
void Lib_AddScaledVec3f(Vector3f* a, Vector3f* b, f32 scale, Vector3f* dest) {
|
||||
void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) {
|
||||
dest->x = b->x * scale + a->x;
|
||||
dest->y = b->y * scale + a->y;
|
||||
dest->z = b->z * scale + a->z;
|
||||
}
|
||||
|
||||
void Lib_ModifyRandScaled(Vector3f* orig, f32 scale, Vector3f* dest) {
|
||||
void Math_Vec3f_ModifyRand(Vec3f* orig, f32 scale, Vec3f* dest) {
|
||||
dest->x = randPlusMinusPoint5Scaled(scale) + orig->x;
|
||||
dest->y = randPlusMinusPoint5Scaled(scale) + orig->y;
|
||||
dest->z = randPlusMinusPoint5Scaled(scale) + orig->z;
|
||||
}
|
||||
|
||||
void Lib_ScaledNormalizedDifferenceVec3f(Vector3f* a, Vector3f* b, f32 scale, Vector3f* dest) {
|
||||
f32 f0 = Lib_DistanceAndDifferenceVec3f(a, b, dest);
|
||||
void Math_Vec3f_DistXYZAndStoreNormalizedDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) {
|
||||
f32 f0 = Math_Vec3f_DistXYZAndStoreDiff(a, b, dest);
|
||||
f32 f2;
|
||||
|
||||
if (f0 == 0) {
|
||||
|
|
@ -327,34 +327,34 @@ void Lib_ScaledNormalizedDifferenceVec3f(Vector3f* a, Vector3f* b, f32 scale, Ve
|
|||
dest->z *= f2;
|
||||
}
|
||||
|
||||
f32 Lib_DistanceVec3f(Vector3f* a, Vector3f* b) {
|
||||
Vector3f sp1C;
|
||||
Lib_SubVec3f(b, a, &sp1C);
|
||||
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) {
|
||||
Vec3f sp1C;
|
||||
Math_Vec3f_Diff(b, a, &sp1C);
|
||||
return sqrtf((sp1C.x * sp1C.x) + (sp1C.y * sp1C.y) + (sp1C.z * sp1C.z));
|
||||
}
|
||||
|
||||
f32 Lib_DistanceAndDifferenceVec3f(Vector3f* a, Vector3f* b, Vector3f* difference) {
|
||||
Lib_SubVec3f(b, a, difference);
|
||||
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* difference) {
|
||||
Math_Vec3f_Diff(b, a, difference);
|
||||
return sqrtf((difference->x * difference->x) + (difference->y * difference->y) + (difference->z * difference->z));
|
||||
}
|
||||
|
||||
f32 Lib_DistanceXZVec3f(Vector3f* a, Vector3f* b) {
|
||||
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b) {
|
||||
f32 dx = b->x - a->x;
|
||||
f32 dz = b->z - a->z;
|
||||
return sqrtf((dx * dx) + (dz * dz));
|
||||
}
|
||||
|
||||
f32 Lib_DistanceAndDifferenceXZVec3f(Vector3f* a, Vector3f* b, f32* xDiff, f32* zDiff) {
|
||||
f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* xDiff, f32* zDiff) {
|
||||
*xDiff = b->x - a->x;
|
||||
*zDiff = b->z - a->z;
|
||||
return sqrtf((*xDiff * *xDiff) + (*zDiff * *zDiff));
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void Lib_PushAwayXZVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach) {
|
||||
void Math_Vec3f_PushAwayXZ(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
|
||||
f32 sp24;
|
||||
f32 sp20;
|
||||
f32 f0 = Lib_DistanceAndDifferenceXZVec3f(pusher, start, &sp24, &sp20);
|
||||
f32 f0 = Math_Vec3f_DistXZAndStore(pusher, start, &sp24, &sp20);
|
||||
f32 f2 = f0 - distanceToApproach;
|
||||
|
||||
if ((f0 >= distanceToApproach) && (f2 != 0)) {
|
||||
|
|
@ -367,63 +367,63 @@ void Lib_PushAwayXZVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproa
|
|||
start->z = pusher->z + sp20 * f2;
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Lib_PushAwayXZVec3f.asm")
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Math_Vec3f_PushAwayXZ.asm")
|
||||
#endif
|
||||
|
||||
f32 Lib_DistanceYVec3f(Vector3f* a, Vector3f* b) {
|
||||
f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) {
|
||||
return b->y - a->y;
|
||||
}
|
||||
|
||||
s16 Lib_YawVec3f(Vector3f* from, Vector3f* to) {
|
||||
s16 Math_Vec3f_Yaw(Vec3f* from, Vec3f* to) {
|
||||
f32 f14 = to->x - from->x;
|
||||
f32 f12 = to->z - from->z;
|
||||
return atans_flip(f12, f14);
|
||||
}
|
||||
|
||||
s16 Lib_PitchVec3f(Vector3f* from, Vector3f* to) {
|
||||
return atans_flip(Lib_DistanceXZVec3f(from, to), from->y - to->y);
|
||||
s16 Math_Vec3f_Pitch(Vec3f* from, Vec3f* to) {
|
||||
return atans_flip(Math_Vec3f_DistXZ(from, to), from->y - to->y);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVars(Actor* actor, ActorInitVar* init) {
|
||||
void Actor_ProcessInitChain(Actor* actor, ActorInitVar* init) {
|
||||
do {
|
||||
actorInitVarFuncs[init->type]((u8*)actor, init);
|
||||
} while ((init++)->cont);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarByte1(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_u8(u8* actor, ActorInitVar* init) {
|
||||
*(u8*)(actor + init->offset) = (u8)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarByte2(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_s8(u8* actor, ActorInitVar* init) {
|
||||
*(u8*)(actor + init->offset) = (u8)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarShort1(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_u16(u8* actor, ActorInitVar* init) {
|
||||
*(u16*)(actor + init->offset) = (u16)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarShort2(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_s16(u8* actor, ActorInitVar* init) {
|
||||
*(u16*)(actor + init->offset) = (u16)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarWord1(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_u32(u8* actor, ActorInitVar* init) {
|
||||
*(u32*)(actor + init->offset) = (u32)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarWord2(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_s32(u8* actor, ActorInitVar* init) {
|
||||
*(u32*)(actor + init->offset) = (u32)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarFloat(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_f32(u8* actor, ActorInitVar* init) {
|
||||
*(f32*)(actor + init->offset) = (f32)(init->value);
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarFloat1000th(u8* actor, ActorInitVar* init) {
|
||||
void IChain_Apply_f32div1000(u8* actor, ActorInitVar* init) {
|
||||
*(f32*)(actor + init->offset) = (f32)(init->value) / 1000;
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarVector3f(u8* actor, ActorInitVar* init) {
|
||||
Vector3f* v0 = (Vector3f*)(actor + init->offset);
|
||||
void IChain_Apply_Vec3f(u8* actor, ActorInitVar* init) {
|
||||
Vec3f* v0 = (Vec3f*)(actor + init->offset);
|
||||
f32 f0 = (f32)(init->value);
|
||||
|
||||
v0->z = f0;
|
||||
|
|
@ -431,8 +431,8 @@ void Lib_ApplyActorInitVarVector3f(u8* actor, ActorInitVar* init) {
|
|||
v0->x = f0;
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarVector3f1000th(u8* actor, ActorInitVar* init) {
|
||||
Vector3f* v0 = (Vector3f*)(actor + init->offset);
|
||||
void IChain_Apply_Vec3fdiv1000(u8* actor, ActorInitVar* init) {
|
||||
Vec3f* v0 = (Vec3f*)(actor + init->offset);
|
||||
f32 f0 = (f32)(init->value) / 1000;
|
||||
|
||||
v0->z = f0;
|
||||
|
|
@ -440,8 +440,8 @@ void Lib_ApplyActorInitVarVector3f1000th(u8* actor, ActorInitVar* init) {
|
|||
v0->x = f0;
|
||||
}
|
||||
|
||||
void Lib_ApplyActorInitVarVector3s(u8* actor, ActorInitVar* init) {
|
||||
Vector3s* v0 = (Vector3s*)(actor + init->offset);
|
||||
void IChain_Apply_Vec3s(u8* actor, ActorInitVar* init) {
|
||||
Vec3s* v0 = (Vec3s*)(actor + init->offset);
|
||||
s16 v1 = (s16)(init->value);
|
||||
|
||||
v0->z = v1;
|
||||
|
|
@ -449,7 +449,7 @@ void Lib_ApplyActorInitVarVector3s(u8* actor, ActorInitVar* init) {
|
|||
v0->x = v1;
|
||||
}
|
||||
|
||||
f32 func_800FFCD8(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4) {
|
||||
f32 Math_SmoothScaleMaxMinF(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4) {
|
||||
f32 f0;
|
||||
|
||||
if (*a0 != a1) {
|
||||
|
|
@ -489,7 +489,7 @@ f32 func_800FFCD8(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4) {
|
|||
return fabsf(a1 - *a0);
|
||||
}
|
||||
|
||||
void Lib_ScaleMax_f(f32* start, f32 target, f32 scale, f32 maxStep) {
|
||||
void Math_SmoothScaleMaxF(f32* start, f32 target, f32 scale, f32 maxStep) {
|
||||
f32 f2;
|
||||
|
||||
if (*start != target) {
|
||||
|
|
@ -505,7 +505,7 @@ void Lib_ScaleMax_f(f32* start, f32 target, f32 scale, f32 maxStep) {
|
|||
}
|
||||
}
|
||||
|
||||
void Lib_Scale_f(f32* start, f32 scale, f32 maxStep) {
|
||||
void Math_SmoothDownscaleMaxF(f32* start, f32 scale, f32 maxStep) {
|
||||
f32 f0 = *start * scale;
|
||||
|
||||
if (maxStep < f0) {
|
||||
|
|
@ -518,14 +518,14 @@ void Lib_Scale_f(f32* start, f32 scale, f32 maxStep) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
s32 Lib_ScaleMaxMin_s(s16* start, s16 target, s16 scale, s16 maxStep, s16 minStep) {
|
||||
s32 Math_SmoothScaleMaxMinS(s16* start, s16 target, s16 scale, s16 maxStep, s16 minStep) {
|
||||
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Lib_ScaleMaxMin_s.asm")
|
||||
GLOBAL_ASM("./asm/non_matchings/z_lib/Math_SmoothScaleMaxMinS.asm")
|
||||
#endif
|
||||
|
||||
void Lib_ScaleMax_s(s16* start, s16 target, s16 scale, s16 maxStep) {
|
||||
void Math_SmoothScaleMaxS(s16* start, s16 target, s16 scale, s16 maxStep) {
|
||||
s16 v0 = target - *start;
|
||||
v0 /= scale;
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ void Lib_ScaleMax_s(s16* start, s16 target, s16 scale, s16 maxStep) {
|
|||
*start += v0;
|
||||
}
|
||||
|
||||
void Lib_CopyColor(ColorRGBA8* dst, ColorRGBA8* src) {
|
||||
void Color_RGBA8_Copy(ColorRGBA8* dst, ColorRGBA8* src) {
|
||||
dst->red = src->red;
|
||||
dst->green = src->green;
|
||||
dst->blue = src->blue;
|
||||
|
|
@ -561,12 +561,12 @@ void func_801000F4(s32 a0, u16 a1) {
|
|||
func_8019F1C0(a0, a1);
|
||||
}
|
||||
|
||||
void Lib_TranslateAndRotateYVec3f(Vector3f* translation, s16 rotation, Vector3f* src, Vector3f* dst) {
|
||||
void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src, Vec3f* dst) {
|
||||
f32 sp1C;
|
||||
f32 f0;
|
||||
|
||||
sp1C = Lib_cos(rotation);
|
||||
f0 = Lib_sin(rotation);
|
||||
sp1C = Math_Coss(rotation);
|
||||
f0 = Math_Sins(rotation);
|
||||
dst->x = translation->x + (src->x * sp1C + src->z * f0);
|
||||
dst->y = translation->y + src->y;
|
||||
dst->z = translation->z + (src->z * sp1C - src->x * f0);
|
||||
|
|
@ -583,12 +583,12 @@ void Lib_LerpRGB(RGB* a, RGB* b, f32 t, RGB* dst) {
|
|||
GLOBAL_ASM("./asm/non_matchings/z_lib/Lib_LerpRGB.asm")
|
||||
#endif
|
||||
|
||||
f32 Lib_PushAwayVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach) {
|
||||
Vector3f sp24;
|
||||
f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
|
||||
Vec3f sp24;
|
||||
f32 f2;
|
||||
f32 f0;
|
||||
|
||||
Lib_SubVec3f(pusher, start, &sp24);
|
||||
Math_Vec3f_Diff(pusher, start, &sp24);
|
||||
f0 = Math3D_Length(&sp24);
|
||||
if (distanceToApproach < f0) {
|
||||
f2 = distanceToApproach / f0;
|
||||
|
|
@ -597,7 +597,7 @@ f32 Lib_PushAwayVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach)
|
|||
start->y = start->y + f2 * sp24.y;
|
||||
start->z = start->z + f2 * sp24.z;
|
||||
} else {
|
||||
Lib_CopyVec3f(start, pusher);
|
||||
Math_Vec3f_Copy(start, pusher);
|
||||
f0 = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,18 +60,18 @@ void Lights_UploadLights(LightMapper* mapper, GraphicsContext* gCtxt) {
|
|||
Light* l;
|
||||
s32 i;
|
||||
|
||||
gSPNumLights(gCtxt->polyOpa.append++, mapper->numLights);
|
||||
gSPNumLights(gCtxt->polyXlu.append++, mapper->numLights);
|
||||
gSPNumLights(gCtxt->polyOpa.p++, mapper->numLights);
|
||||
gSPNumLights(gCtxt->polyXlu.p++, mapper->numLights);
|
||||
|
||||
l = &mapper->lights.l[0];
|
||||
|
||||
for (i = 0; i < mapper->numLights;) {
|
||||
gSPLight(gCtxt->polyOpa.append++, l, ++i);
|
||||
gSPLight(gCtxt->polyXlu.append++, l++, i);
|
||||
gSPLight(gCtxt->polyOpa.p++, l, ++i);
|
||||
gSPLight(gCtxt->polyXlu.p++, l++, i);
|
||||
}
|
||||
|
||||
gSPLight(gCtxt->polyOpa.append++, &mapper->lights.a, ++i);
|
||||
gSPLight(gCtxt->polyXlu.append++, &mapper->lights.a, i);
|
||||
gSPLight(gCtxt->polyOpa.p++, &mapper->lights.a, ++i);
|
||||
gSPLight(gCtxt->polyXlu.p++, &mapper->lights.a, i);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/z_lights/Lights_UploadLights.asm")
|
||||
|
|
@ -86,7 +86,7 @@ Light* Lights_MapperGetNextFreeSlot(LightMapper* mapper) {
|
|||
|
||||
// XXX regalloc, some reorderings
|
||||
#ifdef NON_MATCHING
|
||||
void Lights_MapPositionalWithReference(LightMapper* mapper, LightInfoPositionalParams* params, Vector3f* pos) {
|
||||
void Lights_MapPositionalWithReference(LightMapper* mapper, LightInfoPositionalParams* params, Vec3f* pos) {
|
||||
f32 xDiff;
|
||||
f32 yDiff;
|
||||
f32 zDiff;
|
||||
|
|
@ -138,8 +138,8 @@ GLOBAL_ASM("asm/non_matchings/z_lights/Lights_MapPositionalWithReference.asm")
|
|||
void Lights_MapPositional(LightMapper* mapper, LightInfoPositionalParams* params, GlobalContext* ctxt) {
|
||||
Light* light;
|
||||
f32 radiusF = params->radius;
|
||||
Vector3f posF;
|
||||
Vector3f adjustedPos;
|
||||
Vec3f posF;
|
||||
Vec3f adjustedPos;
|
||||
u32 pad;
|
||||
if (radiusF > 0) {
|
||||
posF.x = params->posX;
|
||||
|
|
@ -196,7 +196,7 @@ void Lights_MapDirectional(LightMapper* mapper, LightInfoDirectionalParams* para
|
|||
}
|
||||
}
|
||||
|
||||
void Lights_MapLights(LightMapper* mapper, z_Light* lights, Vector3f* refPos, GlobalContext* ctxt) {
|
||||
void Lights_MapLights(LightMapper* mapper, z_Light* lights, Vec3f* refPos, GlobalContext* ctxt) {
|
||||
if (lights != NULL) {
|
||||
if ((refPos == NULL) && (mapper->enablePosLights == 1)) {
|
||||
do {
|
||||
|
|
@ -318,8 +318,8 @@ LightMapper* func_801026E8(GraphicsContext* gCtxt, u8 ambientRed, u8 ambientGree
|
|||
s32 i;
|
||||
|
||||
// TODO allocation should be a macro
|
||||
mapper = (LightMapper *)((int)gCtxt->polyOpa.appendEnd - sizeof(LightMapper));
|
||||
gCtxt->polyOpa.appendEnd = (void*)mapper;
|
||||
mapper = (LightMapper *)((int)gCtxt->polyOpa.d - sizeof(LightMapper));
|
||||
gCtxt->polyOpa.d = (void*)mapper;
|
||||
|
||||
mapper->lights.a.l.col[0] = mapper->lights.a.l.colc[0] = ambientRed;
|
||||
mapper->lights.a.l.col[1] = mapper->lights.a.l.colc[1] = ambientGreen;
|
||||
|
|
@ -345,8 +345,8 @@ LightMapper* Lights_MapperAllocateAndInit(GraphicsContext* gCtxt, u8 red, u8 gre
|
|||
LightMapper* mapper;
|
||||
|
||||
// TODO allocation should be a macro
|
||||
mapper = (LightMapper *)((int)gCtxt->polyOpa.appendEnd - sizeof(LightMapper));
|
||||
gCtxt->polyOpa.appendEnd = (void*)mapper;
|
||||
mapper = (LightMapper *)((int)gCtxt->polyOpa.d - sizeof(LightMapper));
|
||||
gCtxt->polyOpa.d = (void*)mapper;
|
||||
|
||||
mapper->lights.a.l.col[0] = red;
|
||||
mapper->lights.a.l.colc[0] = red;
|
||||
|
|
@ -365,8 +365,8 @@ LightMapper* Lights_MapperAllocateAndInit(GraphicsContext* gCtxt, u8 red, u8 gre
|
|||
void func_80102880(GlobalContext* ctxt) {
|
||||
z_Light* light = ctxt->lightsContext.lightsHead;
|
||||
LightInfoPositionalParams* params;
|
||||
Vector3f local_14;
|
||||
Vector3f local_20;
|
||||
Vec3f local_14;
|
||||
Vec3f local_20;
|
||||
f32 local_24;
|
||||
f32 fVar4;
|
||||
s32 s2;
|
||||
|
|
@ -411,7 +411,7 @@ void func_80102A64(GlobalContext* ctxt) {
|
|||
|
||||
if (light != NULL) {
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
dl = func_8012C7FC(gCtxt->polyXlu.append);
|
||||
dl = func_8012C7FC(gCtxt->polyXlu.p);
|
||||
|
||||
gSPSetOtherMode(dl++, G_SETOTHERMODE_H, 4, 4, 0x00000080); //! This doesn't resolve to any of the macros in gdi.h
|
||||
|
||||
|
|
@ -440,7 +440,7 @@ void func_80102A64(GlobalContext* ctxt) {
|
|||
light = light->next;
|
||||
} while (light != NULL);
|
||||
|
||||
gCtxt->polyXlu.append = dl;
|
||||
gCtxt->polyXlu.p = dl;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -9,33 +9,33 @@ void Room_DrawType0Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
|
|||
RoomMeshType0* mesh;
|
||||
s32 i;
|
||||
RoomMeshType0Params* meshParams;
|
||||
GraphicsContext* gCtxt;
|
||||
GraphicsContext* gfxCtx;
|
||||
UNK_TYPE4 pad;
|
||||
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
if (flags & 1) {
|
||||
func_800BCBF4(&D_801C1D10, ctxt);
|
||||
gSPSegment(gCtxt->polyOpa.append++, 0x03, room->vramAddr);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
|
||||
func_8012C268(ctxt);
|
||||
gSPMatrix(gCtxt->polyOpa.append++, &D_801D1DE0, G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, &D_801D1DE0, G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
}
|
||||
|
||||
if (flags & 2) {
|
||||
func_800BCC68(&D_801C1D10, ctxt);
|
||||
gSPSegment(gCtxt->polyXlu.append++, 0x03, room->vramAddr);
|
||||
func_8012C2DC(ctxt->common.gCtxt);
|
||||
gSPMatrix(gCtxt->polyXlu.append++, &D_801D1DE0, G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
|
||||
func_8012C2DC(ctxt->state.gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, &D_801D1DE0, G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
}
|
||||
|
||||
mesh = &room->mesh->type0;
|
||||
meshParams = (RoomMeshType0Params*)Lib_PtrSegToVirt(mesh->paramsStart);
|
||||
for (i = 0; i < mesh->count; i++) {
|
||||
if ((flags & 1) && (meshParams->opaqueDl != NULL)) {
|
||||
gSPDisplayList(gCtxt->polyOpa.append++, meshParams->opaqueDl);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, meshParams->opaqueDl);
|
||||
}
|
||||
|
||||
if ((flags & 2) && (meshParams->translucentDl != NULL)) {
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, meshParams->translucentDl);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, meshParams->translucentDl);
|
||||
}
|
||||
|
||||
meshParams++;
|
||||
|
|
@ -63,8 +63,8 @@ void Room_DrawType1Mesh(GlobalContext* ctxt, Room* room, u32 flags) {
|
|||
|
||||
void Room_Init(GlobalContext* ctxt, RoomContext* roomCtxt) {
|
||||
s32 i;
|
||||
roomCtxt->currRoom.index = -1;
|
||||
roomCtxt->currRoom.vramAddr = 0;
|
||||
roomCtxt->currRoom.num = -1;
|
||||
roomCtxt->currRoom.segment = NULL;
|
||||
roomCtxt->unk78 = 1;
|
||||
roomCtxt->unk79 = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
|
@ -81,16 +81,16 @@ s32 Room_StartRoomTransition(GlobalContext* ctxt, RoomContext* roomCtxt, s32 ind
|
|||
// XXX: this should use a branch-likely
|
||||
if (roomCtxt->unk31 == 0) {
|
||||
roomCtxt->prevRoom = roomCtxt->currRoom;
|
||||
roomCtxt->currRoom.index = index;
|
||||
roomCtxt->currRoom.vramAddr = NULL;
|
||||
roomCtxt->currRoom.num = index;
|
||||
roomCtxt->currRoom.segment = NULL;
|
||||
roomCtxt->unk31 = 1;
|
||||
|
||||
size = ctxt->roomAddrs[index].vromEnd - ctxt->roomAddrs[index].vromStart;
|
||||
roomCtxt->activeRoomVram = ((s32)roomCtxt->roomMemPages[roomCtxt->activeMemPage] - (size + 8) * roomCtxt->activeMemPage + 8) & 0xfffffff0;
|
||||
|
||||
osCreateMesgQueue(&roomCtxt->roomDmaCallback, roomCtxt->roomDmaCallbackMsg, 1);
|
||||
Dmamgr_SendRequest(&roomCtxt->dmaReq, roomCtxt->activeRoomVram, ctxt->roomAddrs[index].vromStart, size,
|
||||
0, &roomCtxt->roomDmaCallback, NULL);
|
||||
osCreateMesgQueue(&roomCtxt->loadQueue, roomCtxt->loadMsg, 1);
|
||||
DmaMgr_SendRequestImpl(&roomCtxt->dmaRequest, roomCtxt->activeRoomVram, ctxt->roomAddrs[index].vromStart, size,
|
||||
0, &roomCtxt->loadQueue, NULL);
|
||||
roomCtxt->activeMemPage ^= 1;
|
||||
|
||||
return 1;
|
||||
|
|
@ -105,17 +105,17 @@ GLOBAL_ASM("asm/non_matchings/z_room/Room_StartRoomTransition.asm")
|
|||
s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
|
||||
if (roomCtxt->unk31 == 1)
|
||||
{
|
||||
if (!osRecvMesg(&roomCtxt->roomDmaCallback, NULL, OS_MESG_NOBLOCK))
|
||||
if (!osRecvMesg(&roomCtxt->loadQueue, NULL, OS_MESG_NOBLOCK))
|
||||
{
|
||||
roomCtxt->unk31 = 0;
|
||||
roomCtxt->currRoom.vramAddr = (void*)(roomCtxt->activeRoomVram);
|
||||
roomCtxt->currRoom.segment = (void*)(roomCtxt->activeRoomVram);
|
||||
gRspSegmentPhysAddrs[3] = roomCtxt->activeRoomVram + 0x80000000;
|
||||
|
||||
Scene_ProcessHeader(ctxt, (SceneCmd*)roomCtxt->currRoom.vramAddr);
|
||||
func_80123140(ctxt, (ActorPlayer*)ctxt->actorContext.actorTypeLists[2].head);
|
||||
Actor_SpawnTransitionActors(ctxt, &ctxt->actorContext);
|
||||
Scene_ProcessHeader(ctxt, (SceneCmd*)roomCtxt->currRoom.segment);
|
||||
func_80123140(ctxt, (ActorPlayer*)ctxt->actorCtx.actorList[2].first);
|
||||
Actor_SpawnTransitionActors(ctxt, &ctxt->actorCtx);
|
||||
|
||||
if (((ctxt->currentScene != 0x13) || (roomCtxt->currRoom.index != 1)) && (ctxt->currentScene != 0x56)) {
|
||||
if (((ctxt->sceneNum != 0x13) || (roomCtxt->currRoom.num != 1)) && (ctxt->sceneNum != 0x56)) {
|
||||
ctxt->kankyoContext.unkC3 = 0xff;
|
||||
ctxt->kankyoContext.unkE0 = 0;
|
||||
}
|
||||
|
|
@ -132,20 +132,20 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
|
|||
}
|
||||
|
||||
void Room_Draw(GlobalContext* ctxt, Room* room, u32 flags) {
|
||||
if (room->vramAddr != NULL) {
|
||||
gRspSegmentPhysAddrs[3] = (u32)room->vramAddr + 0x80000000;
|
||||
roomDrawFuncs[room->mesh->type0.type](ctxt,room,flags);
|
||||
if (room->segment != NULL) {
|
||||
gRspSegmentPhysAddrs[3] = (u32)room->segment + 0x80000000;
|
||||
roomDrawFuncs[room->mesh->type0.type](ctxt, room, flags);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void func_8012EBF8(GlobalContext* ctxt, RoomContext* roomCtxt){
|
||||
roomCtxt->prevRoom.index = -1;
|
||||
roomCtxt->prevRoom.vramAddr = NULL;
|
||||
func_800BA798(ctxt, &ctxt->actorContext);
|
||||
Actor_SpawnTransitionActors(ctxt, &ctxt->actorContext);
|
||||
if (-1 < roomCtxt->currRoom.index) {
|
||||
func_8010A33C(ctxt, roomCtxt->currRoom.index);
|
||||
roomCtxt->prevRoom.num = -1;
|
||||
roomCtxt->prevRoom.segment = NULL;
|
||||
func_800BA798(ctxt, &ctxt->actorCtx);
|
||||
Actor_SpawnTransitionActors(ctxt, &ctxt->actorCtx);
|
||||
if (-1 < roomCtxt->currRoom.num) {
|
||||
func_8010A33C(ctxt, roomCtxt->currRoom.num);
|
||||
func_8010A2DC(ctxt);
|
||||
}
|
||||
func_801A3CD8(ctxt->roomContext.currRoom.unk4);
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ void Scene_HeaderCommand01(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
temp_a2 = ctxt;
|
||||
temp_a2->sceneNumActorsToLoad = (u16) entry->base.unk1;
|
||||
ctxt = temp_a2;
|
||||
ctxt->sceneActorList = (ActorEntry*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
ctxt->actorContext.unkC = (u16)0;
|
||||
ctxt->setupActorList = (ActorEntry*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
ctxt->actorCtx.unkC = (u16)0;
|
||||
}
|
||||
|
||||
// Scene Command 0x02: Cutscene Camera List
|
||||
|
|
@ -93,18 +93,18 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
temp_s0->waterboxes = (BgWaterBox*)Lib_PtrSegToVirt(temp_s0->waterboxes);
|
||||
}
|
||||
|
||||
BgCheck_Init(&ctxt->bgCheckContext, ctxt, temp_s0);
|
||||
BgCheck_Init(&ctxt->colCtx, ctxt, temp_s0);
|
||||
}
|
||||
|
||||
// Scene Command 0x04: Room List
|
||||
void Scene_HeaderCommand04(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->numRooms = (u8) entry->base.unk1;
|
||||
ctxt->roomAddrs = (RoomFileLocation*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
ctxt->roomList = (RoomFileLocation*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
}
|
||||
|
||||
// Scene Command 0x06: Entrance List
|
||||
void Scene_HeaderCommand06(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->entranceList = (EntranceEntry*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
ctxt->setupEntranceList = (EntranceEntry*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
}
|
||||
|
||||
// Scene Command 0x07: Special Files
|
||||
|
|
@ -130,7 +130,7 @@ void Scene_HeaderCommand08(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
ctxt->roomContext.currRoom.unk3 = entry->base.unk1;
|
||||
ctxt->roomContext.currRoom.unk2 = entry->base.unk4 & 0xFF;
|
||||
ctxt->roomContext.currRoom.unk5 = (entry->base.unk4 >> 8) & 1;
|
||||
ctxt->msgContext.unk12044 = (entry->base.unk4 >> 0xa) & 1;
|
||||
ctxt->msgCtx.unk12044 = (entry->base.unk4 >> 0xa) & 1;
|
||||
ctxt->roomContext.currRoom.enablePosLights = (entry->base.unk4 >> 0xb) & 1;
|
||||
ctxt->kankyoContext.unkE2 = (entry->base.unk4 >> 0xc) & 1;
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ GLOBAL_ASM("./asm/non_matchings/z_scene/Scene_HeaderCommand18.asm")
|
|||
|
||||
// Scene Command 0x17: Cutscene Data
|
||||
void Scene_HeaderCommand17(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->cutsceneContext.cutsceneCount = (u8)entry->base.unk1;
|
||||
ctxt->csCtx.cutsceneCount = (u8)entry->base.unk1;
|
||||
ctxt->cutsceneList = (CutsceneEntry*)Lib_PtrSegToVirt((void*)entry->base.unk4);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ void SceneProc_DrawCurrentSceneAnimatedTextures(GlobalContext* ctxt) {
|
|||
}
|
||||
|
||||
void SceneProc_DrawSceneConfig0(GlobalContext* ctxt) {
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
|
||||
gSPDisplayList(gCtxt->polyOpa.append++, gSceneProcDefaultDl);
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, gSceneProcDefaultDl);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, gSceneProcDefaultDl);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, gSceneProcDefaultDl);
|
||||
}
|
||||
|
||||
Gfx* SceneProc_SetTile1Layer(GlobalContext* ctxt, ScrollingTextureParams* params) {
|
||||
return Rcp_GenerateSetTileSizeDl((ctxt->common).gCtxt,
|
||||
return Rcp_GenerateSetTileSizeDl((ctxt->state).gfxCtx,
|
||||
params->xStep * gSceneProcStep,
|
||||
-(params->yStep * gSceneProcStep),
|
||||
params->width,
|
||||
|
|
@ -24,19 +24,19 @@ void SceneProc_DrawType0Texture(GlobalContext* ctxt, u32 segment, ScrollingTextu
|
|||
Gfx* dl = SceneProc_SetTile1Layer(ctxt, params);
|
||||
|
||||
{
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
if (gSceneProcFlags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, segment, dl);
|
||||
}
|
||||
|
||||
if (gSceneProcFlags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, segment, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* SceneProc_SetTile2Layers(GlobalContext* ctxt, ScrollingTextureParams* params) {
|
||||
return Rcp_GenerateSetTileSize2Dl((ctxt->common).gCtxt,
|
||||
return Rcp_GenerateSetTileSize2Dl((ctxt->state).gfxCtx,
|
||||
0,
|
||||
params[0].xStep * gSceneProcStep,
|
||||
-(params[0].yStep * gSceneProcStep),
|
||||
|
|
@ -53,13 +53,13 @@ void SceneProc_DrawType1Texture(GlobalContext* ctxt, u32 segment, ScrollingTextu
|
|||
Gfx* dl = SceneProc_SetTile2Layers(ctxt, params);
|
||||
|
||||
{
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
if (gSceneProcFlags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, segment, dl);
|
||||
}
|
||||
|
||||
if (gSceneProcFlags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, segment, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,22 +67,22 @@ void SceneProc_DrawType1Texture(GlobalContext* ctxt, u32 segment, ScrollingTextu
|
|||
#ifdef NON_MATCHING
|
||||
// Slight ordering differences at the beginning
|
||||
void SceneProc_DrawFlashingTexture(GlobalContext* ctxt, u32 segment, FlashingTexturePrimColor* primColor, RGBA8* envColor) {
|
||||
GraphicsContext* gCtxt;
|
||||
GraphicsContext* gfxCtx;
|
||||
Gfx* dl;
|
||||
|
||||
{
|
||||
Gfx* _g = (Gfx*)ctxt->common.gCtxt->polyOpa.appendEnd - 4;
|
||||
Gfx* _g = (Gfx*)ctxt->state.gfxCtx->polyOpa.d - 4;
|
||||
dl = _g;
|
||||
ctxt->common.gCtxt->polyOpa.appendEnd = _g;
|
||||
ctxt->state.gfxCtx->polyOpa.d = _g;
|
||||
}
|
||||
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
if (gSceneProcFlags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, segment, dl);
|
||||
}
|
||||
|
||||
if (gSceneProcFlags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, segment, dl);
|
||||
}
|
||||
|
||||
gDPSetPrimColor(dl++,
|
||||
|
|
@ -207,7 +207,7 @@ void SceneProc_DrawType5Texture(GlobalContext* ctxt, u32 segment, CyclingTexture
|
|||
u8* offsets;
|
||||
Gfx** dls;
|
||||
Gfx* dl;
|
||||
GraphicsContext* gCtxt;
|
||||
GraphicsContext* gfxCtx;
|
||||
s32 step;
|
||||
|
||||
dls = (Gfx**)Lib_PtrSegToVirt(params->textureDls);
|
||||
|
|
@ -215,13 +215,13 @@ void SceneProc_DrawType5Texture(GlobalContext* ctxt, u32 segment, CyclingTexture
|
|||
step = gSceneProcStep % params->cycleLength;
|
||||
dl = (Gfx*)Lib_PtrSegToVirt(dls[offsets[step]]);
|
||||
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
if (gSceneProcFlags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, segment, dl);
|
||||
}
|
||||
|
||||
if (gSceneProcFlags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, segment, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, segment, dl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -299,37 +299,37 @@ void SceneProc_DrawSceneConfig1(GlobalContext* ctxt) {
|
|||
#ifdef NON_MATCHING
|
||||
// This function still needs a lot of work
|
||||
void SceneProc_DrawSceneConfig3(GlobalContext* ctxt) {
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
u32 frames = ctxt->unk18840;
|
||||
|
||||
if (0);
|
||||
|
||||
gSPSegment(gCtxt->polyXlu.append++, 8,
|
||||
Rcp_GenerateSetTileSizeDl(ctxt->common.gCtxt, 0, frames & 0x3f, 0x100, 0x10));
|
||||
gSPSegment(gCtxt->polyXlu.append++, 9,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt,
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 8,
|
||||
Rcp_GenerateSetTileSizeDl(ctxt->state.gfxCtx, 0, frames & 0x3f, 0x100, 0x10));
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 9,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->state.gfxCtx,
|
||||
0, 0x7F - (frames & 0x7F), frames & 0x7F, 0x20, 0x20,
|
||||
1, frames & 0x7F, frames & 0x7F, 0x20, 0x20));
|
||||
gSPSegment(gCtxt->polyOpa.append++, 10,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt,
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 10,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->state.gfxCtx,
|
||||
0, 0, 0, 0x20, 0x20,
|
||||
1, 0, 0x7F - (frames & 0x7F), 0x20, 0x20));
|
||||
gSPSegment(gCtxt->polyOpa.append++, 11,
|
||||
Rcp_GenerateSetTileSizeDl(ctxt->common.gCtxt, 0, frames & 0x7F, 0x20, 0x20));
|
||||
gSPSegment(gCtxt->polyXlu.append++, 12,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt,
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 11,
|
||||
Rcp_GenerateSetTileSizeDl(ctxt->state.gfxCtx, 0, frames & 0x7F, 0x20, 0x20));
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 12,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->state.gfxCtx,
|
||||
0, 0, frames * 0x32 & 0x7Ff, 8, 0x200,
|
||||
1, 0, frames * 0x3c & 0x7Ff, 8, 0x200));
|
||||
gSPSegment(gCtxt->polyOpa.append++, 13,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt,
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 13,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->state.gfxCtx,
|
||||
0, 0, 0, 0x20, 0x40,
|
||||
1, 0, frames & 0x7F, 0x20, 0x20));
|
||||
|
||||
gDPPipeSync(gCtxt->polyXlu.append++);
|
||||
gDPSetEnvColor(gCtxt->polyXlu.append++, 0x80, 0x80, 0x80, 0x80);
|
||||
gDPPipeSync(gfxCtx->polyXlu.p++);
|
||||
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80);
|
||||
|
||||
gDPPipeSync(gCtxt->polyOpa.append++);
|
||||
gDPSetEnvColor(gCtxt->polyOpa.append++, 0x80, 0x80, 0x80, 0x80);
|
||||
gDPPipeSync(gfxCtx->polyOpa.p++);
|
||||
gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("./asm/non_matchings/z_scene_proc/SceneProc_DrawSceneConfig3.asm")
|
||||
|
|
@ -337,22 +337,22 @@ GLOBAL_ASM("./asm/non_matchings/z_scene_proc/SceneProc_DrawSceneConfig3.asm")
|
|||
|
||||
void SceneProc_DrawSceneConfig4(GlobalContext* ctxt) {
|
||||
u32 frames;
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
u32 frames2;
|
||||
|
||||
frames = ctxt->unk18840;
|
||||
frames2 = frames * 1;
|
||||
|
||||
gSPSegment(gCtxt->polyXlu.append++, 8,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->common.gCtxt,
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 8,
|
||||
Rcp_GenerateSetTileSize2Dl(ctxt->state.gfxCtx,
|
||||
0, 0x7F - (frames & 0x7F), frames2 & 0x7F, 0x20, 0x20,
|
||||
1, (frames & 0x7F), frames2 & 0x7F, 0x20, 0x20));
|
||||
|
||||
gDPPipeSync(gCtxt->polyOpa.append++);
|
||||
gDPSetEnvColor(gCtxt->polyOpa.append++, 0x80, 0x80, 0x80, 0x80);
|
||||
gDPPipeSync(gfxCtx->polyOpa.p++);
|
||||
gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80);
|
||||
|
||||
gDPPipeSync(gCtxt->polyXlu.append++);
|
||||
gDPSetEnvColor(gCtxt->polyXlu.append++, 0x80, 0x80, 0x80, 0x80);
|
||||
gDPPipeSync(gfxCtx->polyXlu.p++);
|
||||
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80);
|
||||
}
|
||||
|
||||
void SceneProc_DrawSceneConfig2(GlobalContext* ctxt){}
|
||||
|
|
@ -361,13 +361,13 @@ void func_80131DF0(GlobalContext* ctxt, u32 param_2, u32 flags) {
|
|||
Gfx* dl = D_801C3C50[param_2];
|
||||
|
||||
{
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
if (flags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, 12, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 12, dl);
|
||||
}
|
||||
|
||||
if (flags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, 12, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 12, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -376,13 +376,13 @@ void func_80131E58(GlobalContext* ctxt, u32 param_2, u32 flags) {
|
|||
Gfx* dl = D_801C3C80[param_2];
|
||||
|
||||
{
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
|
||||
if (flags & 1) {
|
||||
gSPSegment(gCtxt->polyOpa.append++, 12, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 12, dl);
|
||||
}
|
||||
|
||||
if (flags & 2) {
|
||||
gSPSegment(gCtxt->polyXlu.append++, 12, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 12, dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ void func_80131E58(GlobalContext* ctxt, u32 param_2, u32 flags) {
|
|||
void SceneProc_DrawSceneConfig5(GlobalContext* ctxt) {
|
||||
u32 dlIndex;
|
||||
u32 alpha;
|
||||
GraphicsContext* gCtxt;
|
||||
GraphicsContext* gfxCtx;
|
||||
|
||||
if (ctxt->roomContext.unk7A[0] != 0) {
|
||||
dlIndex = 1;
|
||||
|
|
@ -403,7 +403,7 @@ void SceneProc_DrawSceneConfig5(GlobalContext* ctxt) {
|
|||
if (alpha == 0) {
|
||||
ctxt->roomContext.unk78 = 0;
|
||||
} else {
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
|
||||
ctxt->roomContext.unk78 = 1;
|
||||
|
||||
|
|
@ -411,8 +411,8 @@ void SceneProc_DrawSceneConfig5(GlobalContext* ctxt) {
|
|||
|
||||
func_80131DF0(ctxt, dlIndex, 3);
|
||||
|
||||
gDPSetEnvColor(gCtxt->polyOpa.append++, 0xFF, 0xFF, 0xFF, alpha);
|
||||
gDPSetEnvColor(gCtxt->polyXlu.append++, 0xFF, 0xFF, 0xFF, alpha);
|
||||
gDPSetEnvColor(gfxCtx->polyOpa.p++, 0xFF, 0xFF, 0xFF, alpha);
|
||||
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0xFF, 0xFF, 0xFF, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +425,7 @@ void SceneProc_DrawSceneConfig6(GlobalContext* ctxt) {
|
|||
Gfx* dlHead;
|
||||
u32 pad1;
|
||||
u32 pad2;
|
||||
GraphicsContext* gCtxt;
|
||||
GraphicsContext* gfxCtx;
|
||||
u32 pad3;
|
||||
u32 pad4;
|
||||
u32 pad5;
|
||||
|
|
@ -436,20 +436,20 @@ void SceneProc_DrawSceneConfig6(GlobalContext* ctxt) {
|
|||
Actor_GetSwitchFlag(ctxt,0x34) &&
|
||||
Actor_GetSwitchFlag(ctxt,0x35) &&
|
||||
Actor_GetSwitchFlag(ctxt,0x36)) {
|
||||
func_800C3C00(&ctxt->bgCheckContext, 1);
|
||||
func_800C3C00(&ctxt->colCtx, 1);
|
||||
} else {
|
||||
func_800C3C14(&ctxt->bgCheckContext, 1);
|
||||
func_800C3C14(&ctxt->colCtx, 1);
|
||||
}
|
||||
|
||||
{
|
||||
dl = (Gfx*)ctxt->common.gCtxt->polyOpa.appendEnd - 18;
|
||||
dl = (Gfx*)ctxt->state.gfxCtx->polyOpa.d - 18;
|
||||
//dl = _g;
|
||||
ctxt->common.gCtxt->polyOpa.appendEnd = dl;
|
||||
ctxt->state.gfxCtx->polyOpa.d = dl;
|
||||
}
|
||||
|
||||
SceneProc_DrawAllSceneAnimatedTextures(ctxt, ctxt->sceneTextureAnimations);
|
||||
|
||||
gCtxt = ctxt->common.gCtxt;
|
||||
gfxCtx = ctxt->state.gfxCtx;
|
||||
dlHead = dl;
|
||||
for (i = 0; i < 9; i++, dlHead += 2) {
|
||||
u32 lodFrac = 0;
|
||||
|
|
@ -516,6 +516,6 @@ void SceneProc_DrawSceneConfig6(GlobalContext* ctxt) {
|
|||
gDPSetPrimColor(dlHead, 0, lodFrac, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
gSPSegment(gCtxt->polyOpa.append++, 6, dl);
|
||||
gSPSegment(gCtxt->polyXlu.append++, 6, dl);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 6, dl);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 6, dl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void osViRepeatLine(u8 active) {
|
||||
void osViBlack(u8 active) {
|
||||
register u32 saveMask;
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
boot_0x800805E0
|
||||
boot_0x800968B0
|
||||
fault
|
||||
fault_drawer
|
||||
|
|
@ -6,6 +5,7 @@ idle
|
|||
loadfragment
|
||||
loadfragment2
|
||||
stackcheck
|
||||
viconfig
|
||||
z_actor
|
||||
z_bgcheck
|
||||
z_DLF
|
||||
|
|
|
|||
5134
tables/functions.txt
5134
tables/functions.txt
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
0x80080060:"",
|
||||
0x80080060:"boot_main",
|
||||
0x80080150:"idle",
|
||||
0x800805E0:"",
|
||||
0x800805E0:"viconfig",
|
||||
0x80080790:"z_std_dma",
|
||||
0x80080E30:"",
|
||||
0x80081250:"irqmgr",
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
0x8008AD70:"sirawdma",
|
||||
0x8008ACE0:"sprawdma",
|
||||
0x8008AE20:"",
|
||||
0x8008AE70:"virepeatline",
|
||||
0x8008AE70:"viblack",
|
||||
0x8008AEE0:"sirawread",
|
||||
0x8008AF30:"getthreadid",
|
||||
0x8008AF50:"sptaskyield",
|
||||
|
|
|
|||
1424
tables/variables.txt
1424
tables/variables.txt
File diff suppressed because it is too large
Load Diff
20
undef.txt
20
undef.txt
|
|
@ -8,11 +8,11 @@ osMemSize = 0x80000318;
|
|||
D_8000031C = 0x8000031C;
|
||||
D_80000500 = 0x80000500;
|
||||
D_80025D00 = 0x80025D00;
|
||||
bootStackEntry = boot_bss_start + 0x00000000;
|
||||
idleOSThread = boot_bss_start + 0x00000020;
|
||||
idleStack = boot_bss_start + 0x000001D0;
|
||||
idleStackEntry = boot_bss_start + 0x000005D0;
|
||||
bootStack = boot_bss_start + 0x000005F0;
|
||||
sBootThreadInfo = boot_bss_start + 0x00000000;
|
||||
sIdleThread = boot_bss_start + 0x00000020;
|
||||
sIdleThreadStack = boot_bss_start + 0x000001D0;
|
||||
sIdleThreadInfo = boot_bss_start + 0x000005D0;
|
||||
sBootThreadStack = boot_bss_start + 0x000005F0;
|
||||
irqmgrContext = boot_bss_start + 0x000009F0;
|
||||
irqmgrStack = boot_bss_start + 0x00000C70;
|
||||
irqmgrStackEntry = boot_bss_start + 0x00001170;
|
||||
|
|
@ -42,7 +42,7 @@ faultCopyToLog = boot_bss_start + 0x0000295C;
|
|||
faultStack = boot_bss_start + 0x00002960;
|
||||
faultStackEntry = boot_bss_start + 0x00002F60;
|
||||
faultContextStruct = boot_bss_start + 0x00002F80;
|
||||
faultDrawContextStruct = boot_bss_start + 0x000037D0;
|
||||
sFaultDrawerStruct = boot_bss_start + 0x000037D0;
|
||||
D_8009CD10 = boot_bss_start + 0x00003810;
|
||||
startHeap = boot_bss_start + 0x00003820;
|
||||
randLast = boot_bss_start + 0x00003850;
|
||||
|
|
@ -130,8 +130,14 @@ D_801EDA24 = code_bss_start + 0x00009A84;
|
|||
D_801EDA30 = code_bss_start + 0x00009A90;
|
||||
D_801EDA40 = code_bss_start + 0x00009AA0;
|
||||
D_801EDA80 = code_bss_start + 0x00009AE0;
|
||||
D_801EDA8C = code_bss_start + 0x00009AEC;
|
||||
D_801EDA98 = code_bss_start + 0x00009AF8;
|
||||
D_801EDAA8 = code_bss_start + 0x00009B08;
|
||||
D_801EDAF8 = code_bss_start + 0x00009B58;
|
||||
D_801EDB48 = code_bss_start + 0x00009BA8;
|
||||
D_01EDB54 = code_bss_start + 0x00009BB4;
|
||||
D_01EDB60 = code_bss_start + 0x00009BC0;
|
||||
D_01EDB70 = code_bss_start + 0x00009BD0;
|
||||
D_801EDB7C = code_bss_start + 0x00009BDC;
|
||||
D_801EDB88 = code_bss_start + 0x00009BE8;
|
||||
D_801EDB98 = code_bss_start + 0x00009BF8;
|
||||
|
|
@ -846,7 +852,7 @@ D_80208E99 = code_bss_start + 0x00024EF9;
|
|||
D_80208E9C = code_bss_start + 0x00024EFC;
|
||||
D_80208EA0 = code_bss_start + 0x00024F00;
|
||||
D_80209AA0 = code_bss_start + 0x00025B00;
|
||||
D_80209EA0 = code_bss_start + 0x00025F00;
|
||||
gGfxPools = code_bss_start + 0x00025F00;
|
||||
D_8024A4C0 = code_bss_start + 0x00066520;
|
||||
heap = code_bss_start + 0x0019E520;
|
||||
D_80780000 = code_bss_start + 0x0059C060;
|
||||
|
|
|
|||
Loading…
Reference in New Issue