Some OOT transfers, some renaming, etc (#75)

* Progress on various files

* gfxprint stuff

* split some rodata, add iconv for rodata string parsing

* z_std_dma rodata

* 2 nonmatchings in gfxprint

* mtxuty-cvt ok

* more

* match a function in idle.c

* progress

* Cleanup

* Rename BgPolygon to CollisionPoly

* progress

* some effect stuff

* more effect progress

* updates

* made suggested changes

* z_effect_soft_sprite_old_init mostly ok

Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com>
Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>
This commit is contained in:
Lucas Shaw
2021-03-27 14:17:41 -07:00
committed by GitHub
parent fee7a49abc
commit 623b6d5318
84 changed files with 4327 additions and 1207 deletions
+1 -3
View File
@@ -8,11 +8,9 @@ void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) {
s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
s0->base.params = (s0->base.params & 0xFF) - 9;
Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar);
Actor_SetDrawParams(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
ActorShape_Init(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
Collider_InitAndSetCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
Collider_UpdateCylinder((Actor*)s0, &s0->collision);
s0->base.colChkInfo.mass = 255;
s0->update = (ActorFunc)EnAObj_Update1;
}
+2 -2
View File
@@ -10,14 +10,14 @@ EffInfo sEffInfoTable[] = {
(eff_draw_func)EffectSpark_Draw,
},
{
sizeof(EffBlureParams),
sizeof(EffectBlure),
(eff_init_func)EffectBlure_Init1,
(eff_destroy_func)EffectBlure_Destroy,
(eff_update_func)EffectBlure_Update,
(eff_draw_func)EffectBlure_Draw,
},
{
sizeof(EffBlureParams),
sizeof(EffectBlure),
(eff_init_func)EffectBlure_Init2,
(eff_destroy_func)EffectBlure_Destroy,
(eff_update_func)EffectBlure_Update,
+2 -2
View File
@@ -38,8 +38,8 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
bgCtxt->dyna.actorMeshArr[index].currParams.pos.y,
bgCtxt->dyna.actorMeshArr[index].currParams.pos.z);
Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos);
SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos);
actor->world.pos = newPos;
}
+12
View File
@@ -0,0 +1,12 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans_first_8th.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/Math_FAtan2F.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan_flip.asm")
+99
View File
@@ -0,0 +1,99 @@
#include <ultra64.h>
#include <global.h>
void Matrix_Init(GameState* state) {
sMatrixStack = (MtxF *)THA_AllocEndAlign16(&state->heap, 0x500);
sCurrentMatrix = sMatrixStack;
}
void Matrix_Push(void) {
MtxF* prev = sCurrentMatrix;
sCurrentMatrix++;
Matrix_MtxFCopy(sCurrentMatrix, prev);
}
void Matrix_Pop(void) {
sCurrentMatrix--;
}
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Put.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertMatrix.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertTranslation.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Scale.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_s.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_f.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateStateAroundXAxis.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateXRotation.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_RotateY.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertYRotation_f.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_s.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_f.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotation.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateAndTranslateState.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateRotationAndTranslation.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_ToRSPMatrix.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateAsRSPMatrix.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_NewMtx.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_AppendToPolyOpaDisp.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByState.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslation.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledX.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledY.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledZ.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fXZByCurrentState.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_MtxFCopy.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_FromRSPMatrix.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByMatrix.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_TransposeXYZ.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_NormalizeXYZ.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_8018219C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_801822C4.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_f.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_s.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182C90.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CA0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CBC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CCC.asm")
+138 -25
View File
@@ -5,26 +5,139 @@
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PrintLists.asm")
void Actor_PrintLists(ActorContext *actorCtx) {
ActorListEntry* actorList = &actorCtx->actorList[0];
Actor* actor;
s32 i;
void Actor_SetDrawParams(ActorShape* actorShape, f32 yOffset, ActorShadowFunc func, f32 scale) {
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf(D_801DC9D0, gMaxActorId);
FaultDrawer_Printf(D_801DC9D8);
for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) {
actor = actorList[i].first;
while (actor != NULL) {
FaultDrawer_Printf(D_801DC9F8, i, actor, actor->id, actor->category, D_801DCA10);
actor = actor->next;
}
}
}
void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) {
actorShape->yOffset = yOffset;
actorShape->shadowDraw = func;
actorShape->shadowScale = scale;
actorShape->shadowDraw = shadowDraw;
actorShape->shadowScale = shadowScale;
actorShape->shadowAlpha = 255;
}
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PostDraw.asm")
#ifdef NON_MATCHING
void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) {
if (actor->floorPoly != NULL) {
f32 dy = actor->world.pos.y - actor->floorHeight;
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B3FC0.asm")
if (dy >= -50.0f && dy < 500.0f) {
f32 shadowScale;
MtxF mtx;
OPEN_DISPS(globalCtx->state.gfxCtx);
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4024.asm")
POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C);
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4088.asm")
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
COMBINED);
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40B8.asm")
dy = CLAMP(dy, 0.0f, 150.0f);
shadowScale = 1.0f - (dy * D_801DCA14);
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40E0.asm")
if (color != NULL) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->red, color->green, color->blue,
(u8)(actor->shape.shadowAlpha * shadowScale));
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(actor->shape.shadowAlpha * shadowScale));
}
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
Matrix_Put(&mtx);
if (dlist != D_04076BC0) {
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
}
shadowScale = 1.0f - (dy * D_801DCA14);
shadowScale *= actor->shape.shadowScale;
Matrix_Scale(shadowScale * actor->scale.x, 1.0f, shadowScale * actor->scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//ActorShadow_Draw.asm")
#endif
/* ActorShadow_DrawCircle */
void func_800B3FC0(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
if (actor->bgCheckFlags & 0x400) {
func_800B4AEC(globalCtx, actor, 50.0f);
}
ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, NULL);
}
/* ActorShadow_DrawSquare */
void func_800B4024(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
if (actor->bgCheckFlags & 0x400) {
func_800B4AEC(globalCtx, actor, 50.0f);
}
ActorShadow_Draw(actor, lights, globalCtx, D_04075A40, NULL);
}
/* ActorShadow_DrawWhiteCircle */
void func_800B4088(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, &D_801AEC80);
}
/* ActorShadow_DrawHorse */
void func_800B40B8(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
ActorShadow_Draw(actor, lights, globalCtx, D_04077480, NULL);
}
/* ActorShadow_DrawFoot */
#ifdef NON_MATCHING
void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) {
s32 pad1;
s16 sp58;
s32 pad2[2];
OPEN_DISPS(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0,
(u32)(((arg3 * D_801DCA18) > 1.0f ? 1.0f : (arg3 * D_801DCA18)) * arg4) & 0xFF);
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
arg6 *= (4.5f - (light->l.dir[1] * D_801DCA1C));
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
Matrix_Put(arg2);
Matrix_RotateY(sp58, MTXMODE_APPLY);
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, D_04075B30);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800B40E0.asm")
#endif
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B42F8.asm")
@@ -214,10 +327,10 @@ void Actor_SetScale(Actor* actor, f32 scale) {
void Actor_SetObjectSegment(GlobalContext* ctxt, Actor* actor) {
// TODO: Segment number enum
gRspSegmentPhysAddrs[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].vramAddr);
gSegments[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].segment);
}
#ifdef NON_MATCHING
#if 0
void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) {
Actor_InitCurrPosition(actor);
Actor_InitDrawRotation(actor);
@@ -271,11 +384,11 @@ void Actor_ApplyMovement(Actor* actor) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_ApplyMovement.asm")
#endif
#ifdef NON_MATCHING
#if 0
void Actor_SetVelocityYRotationAndGravity(Actor* actor) {
actor->velocity.x = actor->speedXZ * Math_Sins(actor->world.rot.x);
actor->velocity.x = actor->speedXZ * Math_SinS(actor->world.rot.x);
actor->velocity.y = actor->velocity.y + actor->gravity;
actor->velocity.z = actor->speedXZ * Math_Coss(actor->world.rot.x);
actor->velocity.z = actor->speedXZ * Math_CosS(actor->world.rot.x);
if (actor->velocity.y < actor->minYVelocity) {
actor->velocity.y = actor->minYVelocity;
@@ -291,10 +404,10 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
}
void Actor_SetVelocityXYRotation(Actor* actor) {
f32 velX = Math_Coss(actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
actor->velocity.y = Math_Sins(actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
}
void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
@@ -303,10 +416,10 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
}
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
f32 velX = Math_Coss(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
actor->velocity.y = Math_Sins(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
}
void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) {
@@ -364,8 +477,8 @@ void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f*
f32 imm_x;
f32 imm_z;
cos_rot_y = Math_Coss(actor->shape.rot.y);
sin_rot_y = Math_Sins(actor->shape.rot.y);
cos_rot_y = Math_CosS(actor->shape.rot.y);
sin_rot_y = Math_SinS(actor->shape.rot.y);
imm_x = point->x - actor->world.pos.x;
imm_z = point->z - actor->world.pos.z;
offset->x = ((imm_x * cos_rot_y) - (imm_z * sin_rot_y));
+1 -1
View File
@@ -162,7 +162,7 @@ void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vec3f* vector) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm")
f32 func_800C411C(CollisionContext* bgCtxt, BgPolygon* arg1, s32* arg2, Actor* actor, Vec3f* pos) {
f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Actor* actor, Vec3f* pos) {
return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0);
}
+7 -7
View File
@@ -1455,7 +1455,7 @@ void CollisionCheck_GreenBlood(GlobalContext* ctxt, Collider* collider, Vec3f* v
* Used by collider type HIT4.
*/
void CollisionCheck_WaterBurst(GlobalContext* ctxt, Collider* collider, Vec3f* v) {
func_800B249C(ctxt, v);
EffectSsSibuki_SpawnBurst(ctxt, v);
CollisionCheck_SpawnWaterDroplets(ctxt, v);
}
@@ -1481,28 +1481,28 @@ void CollisionCheck_HitSolid(GlobalContext* ctxt, ColliderInfo* info, Collider*
s32 flags = info->toucherFlags & TOUCH_SFX_NONE;
if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) {
func_800B2684(ctxt, 0, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
if (collider->actor == NULL) {
play_sound(0x1806);
} else {
func_8019F1C0(&collider->actor->projectedPos, 0x1806);
}
} else if (flags == TOUCH_SFX_NORMAL) {
func_800B2684(ctxt, 3, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, 3, hitPos);
if (collider->actor == NULL) {
CollisionCheck_SpawnShieldParticlesMetal(ctxt, hitPos);
} else {
CollisionCheck_SpawnShieldParticlesMetalSound(ctxt, hitPos, &collider->actor->projectedPos);
}
} else if (flags == TOUCH_SFX_HARD) {
func_800B2684(ctxt, 0, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
if (collider->actor == NULL) {
play_sound(0x1806);
} else {
func_8019F1C0(&collider->actor->projectedPos, 0x1806);
}
} else if (flags == TOUCH_SFX_WOOD) {
func_800B2684(ctxt, 1, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, 1, hitPos);
if (collider->actor == NULL) {
play_sound(0x1837);
} else {
@@ -1568,13 +1568,13 @@ void CollisionCheck_HitEffects(GlobalContext* ctxt, Collider* at, ColliderInfo*
CollisionCheck_SpawnShieldParticlesWood(ctxt, hitPos, &at->actor->projectedPos);
}
} else if (sHitInfo[ac->colType].effect != HIT_NONE) {
func_800B2684(ctxt, sHitInfo[ac->colType].effect, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, sHitInfo[ac->colType].effect, hitPos);
if (!(acInfo->bumperFlags & BUMP_NO_SWORD_SFX)) {
CollisionCheck_SwordHitAudio(at, acInfo);
}
}
} else {
func_800B2684(ctxt, 0, hitPos);
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
if (ac->actor == NULL) {
play_sound(0x1806);
} else {
+105
View File
@@ -0,0 +1,105 @@
#include <ultra64.h>
#include <global.h>
#ifdef NON_MATCHING
void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
EffectBlureElement* elem;
s32 numElements;
Vec3f sp16C;
Vec3f sp160;
Vec3f sp154;
f32 scale;
MtxF sp110;
MtxF spD0;
MtxF sp90;
MtxF sp50;
Vec3f sp44;
Vec3f sp38;
if (this != NULL) {
numElements = this->numElements;
if (numElements >= 16) {
return;
}
elem = &this->elements[numElements];
elem->state = 1;
if (!(this->flags & 2)) {
elem->p1.x = p1->x;
elem->p1.y = p1->y;
elem->p1.z = p1->z;
elem->p2.x = p2->x;
elem->p2.y = p2->y;
elem->p2.z = p2->z;
} else {
sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f;
sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f;
sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f;
sp160.x = (p1->x + p2->x) * 0.5f;
sp160.y = (p1->y + p2->y) * 0.5f;
sp160.z = (p1->z + p2->z) * 0.5f;
Math_Vec3f_Diff(&sp160, &sp16C, &sp154);
scale = Math3D_Vec3fMagnitude(&sp154);
if (!(fabsf(scale) < D_801DC080)) {
scale = 1.0f / scale;
Math_Vec3f_Scale(&sp154, scale);
SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z);
Matrix_MakeRotationAroundUnitVector(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90);
SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z);
SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50);
SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p1, &sp38);
SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p2, &sp44);
elem->p1.x = sp38.x;
elem->p1.y = sp38.y;
elem->p1.z = sp38.z;
elem->p2.x = sp44.x;
elem->p2.y = sp44.y;
elem->p2.z = sp44.z;
}
}
elem->timer = 1;
this->numElements++;
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A81F0.asm")
#endif
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8514.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Initcommon.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init1.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init2.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Destroy.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Update.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8C78.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8DE8.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A92FC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9330.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9804.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA190.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA460.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA498.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA700.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AABE0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Draw.asm")
+4 -4
View File
@@ -52,7 +52,7 @@ void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor,
if (destination == NULL) {
destination = oldest;
}
SysMatrix_Copy(&destination->displayMatrix,displayMatrix);
Matrix_MtxFCopy(&destination->displayMatrix,displayMatrix);
destination->actor = actor;
destination->location.x = location->x;
destination->location.y = location->y;
@@ -106,10 +106,10 @@ void EffFootmark_Draw(GlobalContext* ctxt) {
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);
Matrix_Put(&footmark->displayMatrix);
Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
gSPMatrix(gfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
+37 -37
View File
@@ -3,10 +3,10 @@
void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
u32 i;
LoadedParticleEntry* iter;
EffectSs* iter;
ParticleOverlay* iter2;
EffectSS2Info.data_table = (LoadedParticleEntry*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(LoadedParticleEntry));
EffectSS2Info.data_table = (EffectSs*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(EffectSs));
EffectSS2Info.searchIndex = 0;
EffectSS2Info.size = numEntries;
@@ -21,7 +21,7 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
void EffectSS_Clear(GlobalContext* ctxt) {
u32 i;
LoadedParticleEntry* iter;
EffectSs* iter;
ParticleOverlay* iter2;
void* addr;
@@ -44,47 +44,47 @@ void EffectSS_Clear(GlobalContext* ctxt) {
}
}
LoadedParticleEntry* EffectSS_GetTable() {
EffectSs* EffectSS_GetTable() {
return EffectSS2Info.data_table;
}
void EffectSS_Delete(LoadedParticleEntry* a0) {
void EffectSS_Delete(EffectSs* a0) {
if (a0->flags & 0x2) {
func_801A72CC((UNK_PTR)&a0->position);
func_801A72CC((UNK_PTR)&a0->pos);
}
if (a0->flags & 0x4) {
func_801A72CC((UNK_PTR)&a0->unk2C);
func_801A72CC((UNK_PTR)&a0->vec);
}
EffectSS_ResetEntry(a0);
}
void EffectSS_ResetEntry(LoadedParticleEntry* particle) {
void EffectSS_ResetEntry(EffectSs* particle) {
u32 i;
particle->type = EFFECT_SS2_TYPE_LAST_LABEL;
particle->acceleration.z = 0;
particle->acceleration.y = 0;
particle->acceleration.x = 0;
particle->accel.z = 0;
particle->accel.y = 0;
particle->accel.x = 0;
particle->velocity.z = 0;
particle->velocity.y = 0;
particle->velocity.x = 0;
particle->unk2C.z = 0;
particle->unk2C.y = 0;
particle->unk2C.x = 0;
particle->position.z = 0;
particle->position.y = 0;
particle->position.x = 0;
particle->vec.z = 0;
particle->vec.y = 0;
particle->vec.x = 0;
particle->pos.z = 0;
particle->pos.y = 0;
particle->pos.x = 0;
particle->life = -1;
particle->flags = 0;
particle->priority = 128;
particle->draw = NULL;
particle->update = NULL;
particle->displayList = 0;
particle->unk3C = 0;
particle->gfx = NULL;
particle->actor = NULL;
for (i = 0; i != 13; i++) {
for (i = 0; i != ARRAY_COUNT(particle->regs); i++) {
particle->regs[i] = 0;
}
}
@@ -148,7 +148,7 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_FindFreeSpace.asm")
#endif
void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) {
void EffectSS_Copy(GlobalContext* ctxt, EffectSs* a1) {
u32 index;
if (func_8016A01C(ctxt) != 1) {
if (EffectSS_FindFreeSpace(a1->priority, &index) == 0) {
@@ -159,7 +159,7 @@ void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) {
}
#ifdef NON_MATCHING
void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* initData) {
void EffectSs_Spawn(GlobalContext* ctxt, s32 type, s32 priority, void* initData) {
u32 index;
u32 initRet;
u32 overlaySize;
@@ -208,20 +208,20 @@ void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* in
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_LoadParticle.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSs_Spawn.asm")
#endif
void EffectSS_UpdateParticle(GlobalContext* ctxt, s32 index) {
LoadedParticleEntry* particle = &EffectSS2Info.data_table[index];
EffectSs* particle = &EffectSS2Info.data_table[index];
if (particle->update != NULL) {
particle->velocity.x += particle->acceleration.x;
particle->velocity.y += particle->acceleration.y;
particle->velocity.z += particle->acceleration.z;
particle->velocity.x += particle->accel.x;
particle->velocity.y += particle->accel.y;
particle->velocity.z += particle->accel.z;
particle->position.x += particle->velocity.x;
particle->position.y += particle->velocity.y;
particle->position.z += particle->velocity.z;
particle->pos.x += particle->velocity.x;
particle->pos.y += particle->velocity.y;
particle->pos.z += particle->velocity.z;
(*particle->update)(ctxt, index, particle);
}
@@ -246,7 +246,7 @@ void EffectSS_UpdateAllParticles(GlobalContext* ctxt) {
}
void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) {
LoadedParticleEntry* entry = &EffectSS2Info.data_table[index];
EffectSs* entry = &EffectSS2Info.data_table[index];
if (entry->draw != 0) {
(*entry->draw)(ctxt, index, entry);
}
@@ -262,12 +262,12 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
for (i = 0; i < EffectSS2Info.size; i++) {
if (EffectSS2Info.data_table[i].life > -1) {
if (EffectSS2Info.data_table[i].position.x > 32000 ||
EffectSS2Info.data_table[i].position.x < -32000 ||
EffectSS2Info.data_table[i].position.y > 32000 ||
EffectSS2Info.data_table[i].position.y < -32000 ||
EffectSS2Info.data_table[i].position.z > 32000 ||
EffectSS2Info.data_table[i].position.z < -32000
if (EffectSS2Info.data_table[i].pos.x > 32000 ||
EffectSS2Info.data_table[i].pos.x < -32000 ||
EffectSS2Info.data_table[i].pos.y > 32000 ||
EffectSS2Info.data_table[i].pos.y < -32000 ||
EffectSS2Info.data_table[i].pos.z > 32000 ||
EffectSS2Info.data_table[i].pos.z < -32000
) {
EffectSS_Delete(&EffectSS2Info.data_table[i]);
} else {
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -28,11 +28,11 @@ void* Lib_MemSet(u8* a0, u32 a1, u32 a2) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/Lib_MemSet.asm")
#endif
f32 Math_Coss(s16 angle) {
f32 Math_CosS(s16 angle) {
return coss(angle) * D_801DDA80;
}
f32 Math_Sins(s16 angle) {
f32 Math_SinS(s16 angle) {
return sins(angle) * D_801DDA84;
}
@@ -212,12 +212,12 @@ void func_800FF3A0(void) {
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/func_800FF3A0.asm")
#endif
s16 Math_Rand_S16Offset(s16 base, s16 range) {
return (s16)(randZeroOne() * range) + base;
s16 Rand_S16Offset(s16 base, s16 range) {
return (s16)(Rand_ZeroOne() * range) + base;
}
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) {
return (s16)(randZeroOne() * range) * stride + base;
return (s16)(Rand_ZeroOne() * range) * stride + base;
}
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) {
@@ -373,11 +373,11 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) {
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);
return Math_FAtan2F(f12, f14);
}
s16 Math_Vec3f_Pitch(Vec3f* from, Vec3f* to) {
return atans_flip(Math_Vec3f_DistXZ(from, to), from->y - to->y);
return Math_FAtan2F(Math_Vec3f_DistXZ(from, to), from->y - to->y);
}
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* init) {
@@ -561,8 +561,8 @@ void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src,
f32 sp1C;
f32 f0;
sp1C = Math_Coss(rotation);
f0 = Math_Sins(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);
@@ -585,7 +585,7 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
f32 f0;
Math_Vec3f_Diff(pusher, start, &sp24);
f0 = Math3D_Length(&sp24);
f0 = Math3D_Vec3fMagnitude(&sp24);
if (distanceToApproach < f0) {
f2 = distanceToApproach / f0;
f0 = f0 - distanceToApproach;
+7 -3
View File
@@ -132,7 +132,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global
posF.x = params->point.x;
posF.y = params->point.y;
posF.z = params->point.z;
Matrix_MultiplyByVectorXYZ(&globalCtx->unk187B0,&posF,&adjustedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0,&posF,&adjustedPos);
if ((adjustedPos.z > -radiusF) &&
(600 + radiusF > adjustedPos.z) &&
(400 > fabsf(adjustedPos.x) - radiusF) &&
@@ -398,6 +398,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
}
}
#if 1
void Lights_DrawGlow(GlobalContext* globalCtx) {
Gfx* dl;
LightPoint* params;
@@ -424,9 +425,9 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
SysMatrix_InsertTranslation(params->x, params->y, params->z, 0);
SysMatrix_InsertScale(scale,scale,scale,1);
Matrix_Scale(scale,scale,scale, MTXMODE_APPLY);
gSPMatrix(dl++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(dl++, &D_04029CF0);
}
@@ -440,3 +441,6 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lights/Lights_DrawGlow.asm")
#endif
+4 -4
View File
@@ -1229,9 +1229,9 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
s32 i;
Gfx* gfx;
gRspSegmentPhysAddrs[0] = 0;
gRspSegmentPhysAddrs[14] = (u32)graphDlEntry;
gRspSegmentPhysAddrs[15] = (u32)gCtxt->framebuffer;
gSegments[0] = 0;
gSegments[14] = (u32)graphDlEntry;
gSegments[15] = (u32)gCtxt->framebuffer;
gfx = graphDlEntry + 0x16;
gSPDisplayList(gfx + 0, &D_0E000140);
@@ -1285,7 +1285,7 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
if (i == 0xE) {
gSPNoOp(gfx + i);
} else {
gSPSegment(gfx + i, i, gRspSegmentPhysAddrs[i]);
gSPSegment(gfx + i, i, gSegments[i]);
}
}
gSPEndDisplayList(gfx + i);
+2 -2
View File
@@ -110,7 +110,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
roomCtxt->unk31 = 0;
roomCtxt->currRoom.segment = roomCtxt->activeRoomVram;
// TODO: Segment number enum
gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram);
gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram);
Scene_ProcessHeader(ctxt, (SceneCmd*)roomCtxt->currRoom.segment);
func_80123140(ctxt, (ActorPlayer*)ctxt->actorCtx.actorList[2].first);
@@ -135,7 +135,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
void Room_Draw(GlobalContext* ctxt, Room* room, u32 flags) {
if (room->segment != NULL) {
// TODO: Segment number enum
gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(room->segment);
gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment);
roomDrawFuncs[room->mesh->type0.type](ctxt, room, flags);
}
return;
+22 -22
View File
@@ -19,14 +19,14 @@ s32 Scene_LoadObject(SceneContext* sceneCtxt, s16 id) {
if (sceneCtxt) {}
if (size) {
DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].vramAddr, objectFileTable[id].vromStart, size);
DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].segment, objectFileTable[id].vromStart, size);
}
// TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT
if (sceneCtxt->objectCount < 0x22) {
sceneCtxt->objects[sceneCtxt->objectCount + 1].vramAddr =
sceneCtxt->objects[sceneCtxt->objectCount + 1].segment =
// UB to cast pointer to u32
(void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].vramAddr + size);
(void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].segment + size);
}
sceneCtxt->objectCount++;
@@ -59,18 +59,18 @@ void Scene_Init(GlobalContext* ctxt, SceneContext* sceneCtxt) {
// TODO: 0x23 is OBJECT_EXCHANGE_BANK_MAX in OOT
for (i = 0; i < 0x23; i++) sceneCtxt->objects[i].id = 0;
sceneCtxt->objectVramStart = sceneCtxt->objects[0].vramAddr = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize);
sceneCtxt->objectVramStart = sceneCtxt->objects[0].segment = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize);
// UB to cast sceneCtxt->objectVramStart to s32
sceneCtxt->objectVramEnd = (void*)((u32)sceneCtxt->objectVramStart + spaceSize);
// TODO: Second argument here is an object enum
sceneCtxt->mainKeepIndex = Scene_LoadObject(sceneCtxt, 1);
// TODO: Segment number enum?
gRspSegmentPhysAddrs[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].vramAddr);
gSegments[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].segment);
}
void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) {
s32 i;
SceneObject* status;
ObjectStatus* status;
ObjectFileTableEntry* objectFile;
u32 size;
@@ -86,7 +86,7 @@ void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) {
status->id = 0;
} else {
osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1);
DmaMgr_SendRequestImpl(&status->dmaReq, status->vramAddr, objectFile->vromStart,
DmaMgr_SendRequestImpl(&status->dmaReq, status->segment, objectFile->vromStart,
size, 0, &status->loadQueue, NULL);
}
} else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) {
@@ -128,7 +128,7 @@ void Scene_DmaAllObjects(SceneContext* sceneCtxt) {
continue;
}
DmaMgr_SendRequest0(sceneCtxt->objects[i].vramAddr, objectFileTable[id].vromStart, vromSize);
DmaMgr_SendRequest0(sceneCtxt->objects[i].segment, objectFileTable[id].vromStart, vromSize);
}
}
@@ -143,7 +143,7 @@ void* func_8012F73C(SceneContext* sceneCtxt, s32 iParm2, s16 id) {
fileTableEntry = &objectFileTable[id];
vromSize = fileTableEntry->vromEnd - fileTableEntry->vromStart;
// TODO: UB to cast void to u32
addr = ((u32)sceneCtxt->objects[iParm2].vramAddr) + vromSize;
addr = ((u32)sceneCtxt->objects[iParm2].segment) + vromSize;
addr = ALIGN16(addr);
// UB to cast u32 to pointer
return (void*)addr;
@@ -167,7 +167,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
}
loadedCount = Scene_LoadObject(&ctxt->sceneContext, OBJECT_LINK_CHILD);
objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].vramAddr;
objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].segment;
ctxt->sceneContext.objectCount = loadedCount;
ctxt->sceneContext.spawnedObjectCount = loadedCount;
unk20 = gSaveContext.perm.unk20;
@@ -175,7 +175,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
gActorOverlayTable[0].initInfo->objectId = temp16;
Scene_LoadObject(&ctxt->sceneContext, temp16);
ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].vramAddr = objectVramAddr;
ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].segment = objectVramAddr;
}
// Scene Command 0x01: Actor List
@@ -198,7 +198,7 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) {
temp_ret = (BgMeshHeader*)Lib_PtrSegToVirt(entry->colHeader.segment);
temp_s0 = temp_ret;
temp_s0->vertices = (BgVertex*)Lib_PtrSegToVirt(temp_ret->vertices);
temp_s0->polygons = (BgPolygon*)Lib_PtrSegToVirt(temp_s0->polygons);
temp_s0->polygons = (CollisionPoly*)Lib_PtrSegToVirt(temp_s0->polygons);
if (temp_s0->attributes != 0) {
temp_s0->attributes = (BgPolygonAttributes*)Lib_PtrSegToVirt(temp_s0->attributes);
}
@@ -229,8 +229,8 @@ void Scene_HeaderCommand07(GlobalContext* ctxt, SceneCmd* entry) {
ctxt->sceneContext.keepObjectId = Scene_LoadObject(&ctxt->sceneContext,
entry->specialFiles.keepObjectId);
// TODO: Segment number enum?
gRspSegmentPhysAddrs[5] =
PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].vramAddr);
gSegments[5] =
PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].segment);
}
if (entry->specialFiles.cUpElfMsgNum != 0) {
@@ -256,9 +256,9 @@ void Scene_HeaderCommand0A(GlobalContext* ctxt, SceneCmd* entry) {
// Scene Command 0x0B: Object List
void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
s32 i, j, k;
SceneObject* firstObject;
SceneObject* status;
SceneObject* status2;
ObjectStatus* firstObject;
ObjectStatus* status;
ObjectStatus* status2;
s16* objectEntry;
void* nextPtr;
@@ -292,7 +292,7 @@ void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
// TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT
if (i < 0x22) {
firstObject[i + 1].vramAddr = nextPtr;
firstObject[i + 1].segment = nextPtr;
}
i++;
k++;
@@ -386,15 +386,15 @@ void Scene_HeaderCommand10(GlobalContext *ctxt, SceneCmd *entry) {
if (gSaveContext.extra.unk2b8 == 0) {
// TODO: Needs REG macro
gStaticContext->data[0x0F] = ctxt->kankyoContext.unk2;
gGameInfo->data[0x0F] = ctxt->kankyoContext.unk2;
}
dayTime = gSaveContext.perm.time;
ctxt->kankyoContext.unk4 = -(Math_Sins(dayTime - 0x8000) * 120.0f) * 25.0f;
ctxt->kankyoContext.unk4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f;
dayTime = gSaveContext.perm.time;
ctxt->kankyoContext.unk8 = (Math_Coss(dayTime - 0x8000) * 120.0f) * 25.0f;
ctxt->kankyoContext.unk8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f;
dayTime = gSaveContext.perm.time;
ctxt->kankyoContext.unkC = (Math_Coss(dayTime - 0x8000) * 20.0f) * 25.0f;
ctxt->kankyoContext.unkC = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f;
if (ctxt->kankyoContext.unk2 == 0 && gSaveContext.perm.cutscene < 0xFFF0) {
gSaveContext.extra.environmentTime = gSaveContext.perm.time;
+44 -44
View File
@@ -38,7 +38,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
rot = limbDrawTable[limbIndex];
@@ -53,7 +53,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
if (dList != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(polyTemp + 1, dList);
gfxCtx->polyOpa.p = polyTemp + 2;
@@ -69,7 +69,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
postLimbDraw, actor, dListIndex);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
@@ -96,7 +96,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
gfxCtx = globalCtx->state.gfxCtx;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
pos.x = limbDrawTable[0].x;
@@ -111,7 +111,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
if (dList != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(polyTemp + 1, dList);
@@ -128,7 +128,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
postLimbDraw, actor, dListIndex);
}
SysMatrix_StatePop();
Matrix_Pop();
}
/*
@@ -145,7 +145,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -181,7 +181,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
postLimbDraw, actor, dListIndex, mtx);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
@@ -215,7 +215,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
gfxCtx = globalCtx->state.gfxCtx;
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
pos.x = limbDrawTable[0].x;
@@ -251,7 +251,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
postLimbDraw, actor, dListIndex, &mtx);
}
SysMatrix_StatePop();
Matrix_Pop();
}
/*
@@ -266,7 +266,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -281,7 +281,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
if (dList != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(polyTemp + 1, dList);
gfxCtx->polyOpa.p = polyTemp + 2;
}
@@ -296,7 +296,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
postLimbDraw, actor);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
@@ -320,7 +320,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
gfxCtx = globalCtx->state.gfxCtx;
SysMatrix_StatePush();
Matrix_Push();
rootLimb = Lib_PtrSegToVirt(skeleton->limbs[0]);
pos.x = limbDrawTable[0].x;
@@ -335,7 +335,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
if (dList != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(polyTemp + 1, dList);
gfxCtx->polyOpa.p = polyTemp + 2;
}
@@ -350,7 +350,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
postLimbDraw, actor);
}
SysMatrix_StatePop();
Matrix_Pop();
}
void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable,
@@ -363,7 +363,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -398,7 +398,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
postLimbDraw, actor, limbMatricies);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
@@ -427,7 +427,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
@@ -465,7 +465,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
postLimbDraw, actor, &mtx);
}
SysMatrix_StatePop();
Matrix_Pop();
}
void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable,
@@ -478,7 +478,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad2;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -493,7 +493,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) {
SysMatrix_RotateAndTranslateState(&pos, &rot);
SysMatrix_StatePush();
Matrix_Push();
unkDraw(globalCtx, limbIndex, actor);
if (dList[1] != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
@@ -508,7 +508,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
(*mtx)++;
}
}
SysMatrix_StatePop();
Matrix_Pop();
}
if (postLimbDraw != NULL) {
@@ -520,7 +520,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
unkDraw, actor, mtx);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
func_80134148(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
@@ -549,7 +549,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
@@ -563,7 +563,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) {
SysMatrix_RotateAndTranslateState(&pos, &rot);
SysMatrix_StatePush();
Matrix_Push();
unkDraw(globalCtx, 1, actor);
if (dList[1] != NULL) {
Gfx* polyTemp = gfxCtx->polyOpa.p;
@@ -577,7 +577,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
SysMatrix_GetStateAsRSPMatrix(mtx++);
}
}
SysMatrix_StatePop();
Matrix_Pop();
}
if (postLimbDraw != NULL) {
@@ -589,7 +589,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
unkDraw, actor, &mtx);
}
SysMatrix_StatePop();
Matrix_Pop();
}
/*
@@ -639,7 +639,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
Vec3f pos;
Vec3s rot;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -654,7 +654,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) {
SysMatrix_RotateAndTranslateState(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(gfx + 1, dList);
gfx = gfx + 2;
}
@@ -669,7 +669,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
postLimbDraw, actor, gfx);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
@@ -695,7 +695,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
return NULL;
}
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
@@ -709,7 +709,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) {
SysMatrix_RotateAndTranslateState(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(gfx + 1, dList);
gfx = gfx + 2;
}
@@ -724,7 +724,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
postLimbDraw, actor, gfx);
}
SysMatrix_StatePop();
Matrix_Pop();
return gfx;
}
@@ -742,7 +742,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
Vec3f pos;
Vec3s rot;
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
limbIndex++;
@@ -778,7 +778,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
postLimbDraw, actor, mtx, gfx);
}
SysMatrix_StatePop();
Matrix_Pop();
if (limbEntry->nextLimbIndex != LIMB_DONE) {
gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
@@ -806,7 +806,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
gSPSegment(gfx++, 0xD, mtx);
SysMatrix_StatePush();
Matrix_Push();
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
@@ -842,7 +842,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
postLimbDraw, actor, &mtx, gfx);
}
SysMatrix_StatePop();
Matrix_Pop();
return gfx;
}
@@ -1462,11 +1462,11 @@ s32 func_80136D98(SkelAnime* skelAnime) {
}
temp_a1 = (s16)(skelAnime->transCurrentFrame * 16384.0f);
if (skelAnime->unk03 < 0) {
sp28 = 1.0f - Math_Coss(temp_a2);
phi_f2 = 1.0f - Math_Coss(temp_a1);
sp28 = 1.0f - Math_CosS(temp_a2);
phi_f2 = 1.0f - Math_CosS(temp_a1);
} else {
sp28 = Math_Sins(temp_a2);
phi_f2 = Math_Sins(temp_a1);
sp28 = Math_SinS(temp_a2);
phi_f2 = Math_SinS(temp_a1);
}
if (phi_f2 != 0.0f) {
phi_f2 /= sp28;
@@ -1691,8 +1691,8 @@ void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle) {
// `angle` rotation around y axis.
x = skelAnime->limbDrawTbl->x - skelAnime->prevFramePos.x;
z = skelAnime->limbDrawTbl->z - skelAnime->prevFramePos.z;
sin = Math_Sins(angle);
cos = Math_Coss(angle);
sin = Math_SinS(angle);
cos = Math_CosS(angle);
pos->x = x * cos + z * sin;
pos->z = z * cos - x * sin;
}
+2 -2
View File
@@ -256,11 +256,11 @@ s32 View_StepQuake(View* view, RSPMatrix* matrix) {
}
SysMatrix_FromRSPMatrix(matrix, &mf);
SysMatrix_SetCurrentState(&mf);
Matrix_Put(&mf);
SysMatrix_RotateStateAroundXAxis(view->currQuakeRot.x);
SysMatrix_InsertYRotation_f(view->currQuakeRot.y, 1);
SysMatrix_InsertZRotation_f(view->currQuakeRot.z, 1);
SysMatrix_InsertScale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1);
Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1);
SysMatrix_InsertZRotation_f(-view->currQuakeRot.z, 1);
SysMatrix_InsertYRotation_f(-view->currQuakeRot.y, 1);
SysMatrix_RotateStateAroundXAxis(-view->currQuakeRot.x);