mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-05 03:07:33 -04:00
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:
+11
-11
@@ -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]);
|
||||
}
|
||||
|
||||
+10
-10
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+29
-29
@@ -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);
|
||||
|
||||
|
||||
+33
-33
@@ -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;
|
||||
|
||||
+23
-23
@@ -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;
|
||||
|
||||
+66
-66
@@ -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++;
|
||||
}
|
||||
|
||||
+63
-63
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+18
-18
@@ -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
|
||||
|
||||
+31
-31
@@ -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);
|
||||
|
||||
+7
-7
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+63
-63
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user