mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Match retail z_skin.c, z_skin_awb.c, z_skin_matrix.c (#1697)
* Match retail z_skin_matrix.c * Match retail z_skin_awb.c * Match retail z_skin.c * Remove same-line hacks
This commit is contained in:
parent
f23a05eecd
commit
67d4f0f36a
4 changed files with 24 additions and 22 deletions
|
@ -21,6 +21,14 @@
|
|||
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
||||
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
|
||||
|
||||
#define SWAP(type, a, b) \
|
||||
{ \
|
||||
type _temp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = _temp; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
|
||||
|
||||
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
|
||||
|
|
|
@ -7,13 +7,14 @@ static s32 sUnused;
|
|||
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
|
||||
Vtx* vtx;
|
||||
SkinVertex* vertexEntry;
|
||||
f32 xwTemp;
|
||||
f32 ywTemp;
|
||||
f32 zwTemp;
|
||||
Vec3f normal;
|
||||
Vec3f sp64;
|
||||
|
||||
for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) {
|
||||
f32 xwTemp;
|
||||
f32 ywTemp;
|
||||
f32 zwTemp;
|
||||
Vec3f normal;
|
||||
Vec3f sp64;
|
||||
|
||||
vtx = &vtxBuf[vertexEntry->index];
|
||||
|
||||
vtx->n.ob[0] = pos->x;
|
||||
|
@ -94,12 +95,13 @@ void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIn
|
|||
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &spA0, &vtxPoint);
|
||||
} else {
|
||||
Vec3f phi_f20;
|
||||
Vec3f sp88;
|
||||
|
||||
phi_f20.x = phi_f20.y = phi_f20.z = 0.0f;
|
||||
|
||||
for (transformationEntry = &limbTransformations[0];
|
||||
transformationEntry < &limbTransformations[transformCount]; transformationEntry++) {
|
||||
Vec3f sp88;
|
||||
|
||||
scale = transformationEntry->scale * 0.01f;
|
||||
|
||||
sp88.x = transformationEntry->x;
|
||||
|
@ -191,7 +193,7 @@ void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postD
|
|||
s32 segmentType;
|
||||
SkinLimb** skeleton;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
s32 pad;
|
||||
Mtx* mtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 471);
|
||||
|
||||
|
@ -202,8 +204,6 @@ void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postD
|
|||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
|
||||
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) {
|
||||
Mtx* mtx;
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &skin->mtx);
|
||||
|
||||
|
|
|
@ -20,13 +20,14 @@ void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) {
|
|||
modifEntry++) {
|
||||
SkinVertex* skinVertices = SEGMENTED_TO_VIRTUAL(modifEntry->skinVertices);
|
||||
|
||||
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount]; skinVtxEntry++) {
|
||||
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount];) {
|
||||
Vtx* vtx = &vtxBuf[skinVtxEntry->index];
|
||||
|
||||
vtx->n.flag = 0;
|
||||
vtx->n.tc[0] = skinVtxEntry->s;
|
||||
vtx->n.tc[1] = skinVtxEntry->t;
|
||||
vtx->n.a = skinVtxEntry->alpha;
|
||||
skinVtxEntry++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,21 +193,21 @@ void SkinMatrix_GetClear(MtxF** mfp) {
|
|||
|
||||
void SkinMatrix_Clear(MtxF* mf) {
|
||||
mf->xx = 1.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
mf->yx = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->ww = 1.0f;
|
||||
}
|
||||
|
||||
void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) {
|
||||
|
@ -237,8 +237,6 @@ void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) {
|
|||
s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
|
||||
MtxF mfCopy;
|
||||
s32 i;
|
||||
s32 pad;
|
||||
f32 temp2;
|
||||
f32 temp1;
|
||||
s32 thisCol;
|
||||
s32 thisRow;
|
||||
|
@ -264,13 +262,8 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
|
|||
// Diagonal element mf[thisCol][thisCol] is zero.
|
||||
// Swap the rows thisCol and thisRow.
|
||||
for (i = 0; i < 4; i++) {
|
||||
temp1 = mfCopy.mf[i][thisRow];
|
||||
mfCopy.mf[i][thisRow] = mfCopy.mf[i][thisCol];
|
||||
mfCopy.mf[i][thisCol] = temp1;
|
||||
|
||||
temp2 = dest->mf[i][thisRow];
|
||||
dest->mf[i][thisRow] = dest->mf[i][thisCol];
|
||||
dest->mf[i][thisCol] = temp2;
|
||||
SWAP(f32, mfCopy.mf[i][thisRow], mfCopy.mf[i][thisCol]);
|
||||
SWAP(f32, dest->mf[i][thisRow], dest->mf[i][thisCol]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue