1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +00:00

Merge branch 'master' into ovl_En_Ru2_new

This commit is contained in:
Ethan Roseman 2020-03-25 18:56:09 -04:00
commit a4be535164
731 changed files with 32380 additions and 35358 deletions

View file

@ -1,14 +1,15 @@
#include <global.h>
volatile u32 sSysCfbFbPtr[2]; // may not be volatile but it currently gets SysCfb_Init closer from matching
u32 sSysCfbFbPtr[2];
u32 sSysCfbEnd;
// small reaordering
#ifdef NON_MATCHING
void SysCfb_Init(s32 n64dd) {
u32 screenSize;
u32 tmpFbEnd;
if (osMemSize >= 0x800000U) {
// 8MB or more memory is installed
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
tmpFbEnd = 0x8044BE80;
if (n64dd == 1) {
// RAM 8M mode (N64DD compatible)
osSyncPrintf("RAM 8M mode (N64DD対応)\n");
@ -16,26 +17,24 @@ void SysCfb_Init(s32 n64dd) {
} else {
// The margin for this version is% dK bytes
osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
sSysCfbEnd = 0x8044BE80;
sSysCfbEnd = tmpFbEnd;
}
} else if (osMemSize >= 0x400000U) {
sSysCfbEnd = 0x80400000;
osSyncPrintf("RAM4M mode\n");
sSysCfbEnd = 0x80400000;
} else {
LogUtils_HungupThread("../sys_cfb.c", 0x162);
}
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
sSysCfbEnd &= ~0x3f;
// The final address used by the system is% 08x
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 2);
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
// Frame buffer addresses are% 08x and% 08x
osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/SysCfb_Init.s")
#endif
void SysCfb_Reset() {
sSysCfbFbPtr[0] = 0;

View file

@ -8,6 +8,7 @@ Mtx gMtxClear = {
0, 0, 0, 0,
0, 0, 0, 0,
};
MtxF gMtxFClear = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
@ -58,23 +59,28 @@ void Matrix_Mult(MtxF* mf, u8 mode) {
}
}
#ifdef NON_MATCHING
// minor ordering and regalloc differences
void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) {
MtxF* cmf = sCurrentMatrix;
f32 tx;
f32 ty;
if (mode == MTXMODE_APPLY) {
cmf->wx += cmf->xx * x + cmf->yx * y + cmf->zx * z;
cmf->wy += cmf->xy * x + cmf->yy * y + cmf->zy * z;
cmf->wz += cmf->xz * x + cmf->yz * y + cmf->zz * z;
cmf->ww += cmf->xw * x + cmf->yw * y + cmf->zw * z;
tx = cmf->xx;
ty = cmf->yx;
cmf->wx += tx * x + ty * y + cmf->zx * z;
tx = cmf->xy;
ty = cmf->yy;
cmf->wy += tx * x + ty * y + cmf->zy * z;
tx = cmf->xz;
ty = cmf->yz;
cmf->wz += tx * x + ty * y + cmf->zz * z;
tx = cmf->xw;
ty = cmf->yw;
cmf->ww += tx * x + ty * y + cmf->zw * z;
} else {
func_800A7A24(cmf, x, y, z);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_Translate.s")
#endif
void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) {
MtxF* cmf = sCurrentMatrix;
@ -289,7 +295,13 @@ void Matrix_RotateZ(f32 z, u8 mode) {
}
}
void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) {
/*
* Rotates the top of the matrix stack by `z` degrees, then
* rotates that matrix by `y` degrees, then rotates that matrix
* by `x` degrees.
* Original Name: Matrix_RotateXYZ, changed to reflect rotation order.
*/
void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) {
MtxF* cmf = sCurrentMatrix;
f32 temp1;
f32 temp2;
@ -374,43 +386,47 @@ void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) {
}
}
void func_800D1340(Vec3f* arg0, Vec3s* arg1) {
/*
* Translates the top of the matrix stack by `translation` units,
* then rotates that matrix by `rotation` in Z-Y-X order
*/
void Matrix_TranslateThenRotateZYX(Vec3f* translation, Vec3s* rotation) {
MtxF* cmf = sCurrentMatrix;
f32 sin;
f32 cos;
f32 temp1;
f32 temp2;
sin = Math_Sins(arg1->z);
cos = Math_Coss(arg1->z);
sin = Math_Sins(rotation->z);
cos = Math_Coss(rotation->z);
temp1 = cmf->xx;
temp2 = cmf->yx;
cmf->wx += temp1 * arg0->x + temp2 * arg0->y + cmf->zx * arg0->z;
cmf->wx += temp1 * translation->x + temp2 * translation->y + cmf->zx * translation->z;
cmf->xx = temp1 * cos + temp2 * sin;
cmf->yx = temp2 * cos - temp1 * sin;
temp1 = cmf->xy;
temp2 = cmf->yy;
cmf->wy += temp1 * arg0->x + temp2 * arg0->y + cmf->zy * arg0->z;
cmf->wy += temp1 * translation->x + temp2 * translation->y + cmf->zy * translation->z;
cmf->xy = temp1 * cos + temp2 * sin;
cmf->yy = temp2 * cos - temp1 * sin;
temp1 = cmf->xz;
temp2 = cmf->yz;
cmf->wz += temp1 * arg0->x + temp2 * arg0->y + cmf->zz * arg0->z;
cmf->wz += temp1 * translation->x + temp2 * translation->y + cmf->zz * translation->z;
cmf->xz = temp1 * cos + temp2 * sin;
cmf->yz = temp2 * cos - temp1 * sin;
temp1 = cmf->xw;
temp2 = cmf->yw;
cmf->ww += temp1 * arg0->x + temp2 * arg0->y + cmf->zw * arg0->z;
cmf->ww += temp1 * translation->x + temp2 * translation->y + cmf->zw * translation->z;
cmf->xw = temp1 * cos + temp2 * sin;
cmf->yw = temp2 * cos - temp1 * sin;
if (arg1->y != 0) {
sin = Math_Sins(arg1->y);
cos = Math_Coss(arg1->y);
if (rotation->y != 0) {
sin = Math_Sins(rotation->y);
cos = Math_Coss(rotation->y);
temp1 = cmf->xx;
temp2 = cmf->zx;
@ -433,9 +449,9 @@ void func_800D1340(Vec3f* arg0, Vec3s* arg1) {
cmf->zw = temp1 * sin + temp2 * cos;
}
if (arg1->x != 0) {
sin = Math_Sins(arg1->x);
cos = Math_Coss(arg1->x);
if (rotation->x != 0) {
sin = Math_Sins(rotation->x);
cos = Math_Coss(rotation->x);
temp1 = cmf->yx;
temp2 = cmf->zx;

View file

@ -9,7 +9,7 @@ void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3
shape->unk_14 = -1;
}
void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, u32 dlist, Color_RGBA8* color) {
void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) {
f32 temp1;
f32 temp2;
MtxF sp60;
@ -41,7 +41,7 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global
func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->unk_80, actor->posRot.pos.z, &sp60);
Matrix_Put(&sp60);
if (dlist != (u32)&D_04049210) {
if (dlist != D_04049210) {
Matrix_RotateY(actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
}
@ -909,7 +909,7 @@ void func_8002D9A4(Actor* actor, f32 arg1) {
void func_8002D9F8(Actor* actor, UNK_PTR arg1) {
Vec3f sp1C;
func_800A54FC(arg1, &sp1C, actor->shape.rot.y, actor);
func_800A54FC(arg1, &sp1C, actor->shape.rot.y);
actor->posRot.pos.x += sp1C.x * actor->scale.x;
actor->posRot.pos.y += sp1C.y * actor->scale.y;
actor->posRot.pos.z += sp1C.z * actor->scale.z;
@ -3884,8 +3884,8 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_80034B54.s")
#endif
void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor,
s16 alpha) {
void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1,
SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
@ -3898,14 +3898,14 @@ void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc
gDPPipeSync(gfxCtx->polyOpa.p++);
gSPSegment(gfxCtx->polyOpa.p++, 0x0C, func_80034B28(globalCtx->state.gfxCtx));
gfxCtx->polyOpa.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount,
unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p);
gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->actorDrawTbl,
skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8860);
}
void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor,
s16 alpha) {
void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1,
SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
@ -3917,8 +3917,8 @@ void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x00, 0x00, 0x00, alpha);
gSPSegment(gfxCtx->polyXlu.p++, 0x0C, func_80034B54(globalCtx->state.gfxCtx));
gfxCtx->polyXlu.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount,
unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p);
gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->actorDrawTbl,
skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8904);
}

View file

@ -83,7 +83,7 @@ static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, Glo
Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY);
Matrix_RotateXYZ(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
gDPLoadTextureBlock(gfxCtx->polyXlu.p++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);

View file

@ -34,10 +34,11 @@ void Sample_Draw(SampleContext* this) {
gfxCtx->polyOpa.p = func_80093708(gfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0);
func_80093D18(gfxCtx);
gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_1CYCLE);
gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE);
gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0,
PRIMITIVE);
gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0xFF, 0xFF, 0x00, 0x00);
func_800C6B54(gfxArr, gfxCtx, "../z_sample.c", 111);

File diff suppressed because it is too large Load diff