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

z_scene_table, z_view, and z_fbdemo_fade OK (#561)

* fbdemo

* the view is clear

* more matchings

* scene table doesn't want to be nice

* small thing in view

* can do

* accidentally a value
This commit is contained in:
petrie911 2020-12-25 15:19:52 -06:00 committed by GitHub
parent 09ddf4f71e
commit a8ae9f48b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 49 additions and 898 deletions

View file

@ -28,8 +28,12 @@ Gfx D_8012B000[] = {
#ifdef NON_EQUIVALENT
// The general control flow is correct and nothing is especially out of order but there are
// many small reoderings and regalloc all over so functional equivalence cannot be verified
// The first loop is down to regalloc. The second needs work.
void TransitionUnk_InitGraphics(TransitionUnk* this) {
Vtx* vtx2;
s32 pad;
s32 pad2;
s32 pad3;
Vtx_t* vtx2;
s32 frame;
s32 rowTex;
s32 row;
@ -45,20 +49,21 @@ void TransitionUnk_InitGraphics(TransitionUnk* this) {
for (frame = 0; frame < 2; frame++) {
this->frame = frame;
vtx = (frame == 0) ? this->vtxFrame1 : this->vtxFrame2;
for (col = 0, colTex = 0; col < this->col + 1; col++, colTex += 0x20) {
for (row = 0, rowTex = 0; row < this->row + 1; row++, rowTex += 0x20) {
vtx2 = vtx;
vtx2->v.tc[0] = rowTex * 0x40;
vtx2->v.ob[0] = rowTex;
vtx2->v.ob[1] = col * 0x20;
vtx2->v.ob[2] = -5;
vtx2->v.flag = 0;
vtx2->v.tc[1] = colTex * 0x40;
vtx2->v.cn[0] = 0;
vtx2->v.cn[1] = 0;
vtx2->v.cn[2] = 120;
vtx2->v.cn[3] = 255;
for (colTex = 0, col = 0; col < this->col + 1; colTex += 0x20, col++) {
for (rowTex = 0, row = 0; row < this->row + 1; rowTex += 0x20, row++) {
vtx2 = &vtx->v;
vtx++;
vtx2->tc[0] = rowTex << 6;
vtx2->ob[0] = row * 0x20;
vtx2->ob[1] = col * 0x20;
vtx2->ob[2] = -5;
vtx2->flag = 0;
vtx2->tc[1] = colTex << 6;
vtx2->cn[0] = 0;
vtx2->cn[1] = 0;
vtx2->cn[2] = 120;
vtx2->cn[3] = 255;
}
}
}

View file

@ -35,8 +35,6 @@ TransitionFade* TransitionFade_Init(TransitionFade* this) {
void TransitionFade_Destroy(TransitionFade* this) {
}
#ifdef NON_MATCHING
// Ordering differences around alpha temp
void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
s32 alpha;
s16 newAlpha;
@ -54,19 +52,20 @@ void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
// Divide by 0! Zero is included in ZCommonGet fade_speed
osSyncPrintf(VT_COL(RED, WHITE) "0除算! ZCommonGet fade_speed に0がはいってる" VT_RST);
}
alpha = (this->fadeTimer * 255.0f) / gSaveContext.fadeDuration;
alpha = (255.0f * this->fadeTimer) / (0, gSaveContext.fadeDuration);
this->fadeColor.a = (this->fadeDirection != 0) ? 255 - alpha : alpha;
break;
case 2:
newAlpha = this->fadeColor.a;
if (iREG(50) != 0) {
if (iREG(50) < 0) {
if (Math_ApproxS(&newAlpha, 255, 255) != 0) {
if (Math_ApproxS(&newAlpha, 255, 255)) {
iREG(50) = 150;
}
} else {
Math_ApproxS(&iREG(50), 20, 60);
if (Math_ApproxS(&newAlpha, 0, iREG(50)) != 0) {
if (Math_ApproxS(&newAlpha, 0, iREG(50))) {
iREG(50) = 0;
this->isDone = 1;
}
@ -76,9 +75,6 @@ void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
break;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Update.s")
#endif
void TransitionFade_Draw(TransitionFade* this, Gfx** gfxP) {
Gfx* gfx;

View file

@ -3047,7 +3047,8 @@ s16 D_80125B5C[] = { 91, 91 }; // unused
// Due to an unknown reason, bss ordering changes within the 5 static variables in the function below.
// In order to restore the correct order, we need a specific number of bss variables in the file before that point.
// For this, we introduce 3 dummy variables which end up in padding at the end of the file's bss, so they don't actually take space.
// For this, we introduce 3 dummy variables which end up in padding at the end of the file's bss, so they don't actually
// take space.
s8 sBssDummy1;
s8 sBssDummy2;
s8 sBssDummy3;

View file

@ -2310,9 +2310,6 @@ void func_8009FC90(GlobalContext* globalCtx) {
f32 D_8012A398 = 0.0f;
// Scene Draw Config 21
#ifdef NON_MATCHING
// regalloc differences and single equivalent instruction difference
void func_8009FE58(GlobalContext* globalCtx) {
static s16 D_8012A39C = 538;
static s16 D_8012A3A0 = 4272;
@ -2346,11 +2343,10 @@ void func_8009FE58(GlobalContext* globalCtx) {
D_8012A3A0 += 1820;
temp = 0.020000001f;
func_800AA76C(&globalCtx->view, Math_Coss(D_8012A39C) * (0.00009587531f * temp),
Math_Sins(D_8012A39C) * (0.00009587531f * temp), Math_Sins(D_8012A3A0) * (0.00009587531f * temp));
func_800AA78C(&globalCtx->view, 1.0f + (Math_Sins(D_8012A3A0) * (0.79999995f * temp)),
1.0f + (Math_Coss(D_8012A3A0) * (0.39999998f * temp)),
1.0f + (Math_Coss(D_8012A39C) * (1 * temp)));
func_800AA76C(&globalCtx->view, 0.00009587531f * temp * Math_Coss(D_8012A39C),
0.00009587531f * temp * Math_Sins(D_8012A39C), 0.00009587531f * temp * Math_Sins(D_8012A3A0));
func_800AA78C(&globalCtx->view, 1.f + (0.79999995f * temp * Math_Sins(D_8012A3A0)),
1.f + (0.39999998f * temp * Math_Coss(D_8012A3A0)), 1.f + (1 * temp * Math_Coss(D_8012A39C)));
func_800AA7AC(&globalCtx->view, 0.95f);
switch (globalCtx->unk_11D30[0]) {
@ -2377,7 +2373,7 @@ void func_8009FE58(GlobalContext* globalCtx) {
}
if (globalCtx->roomCtx.curRoom.num == 2) {
Matrix_Scale(1, sinf(D_8012A398) * 0.8f, 1, MTXMODE_NEW);
Matrix_Scale(1.0f, sinf(D_8012A398) * 0.8f, 1.0f, MTXMODE_NEW);
} else {
Matrix_Scale(1.005f, sinf(D_8012A398) * 0.8f, 1.005f, MTXMODE_NEW);
}
@ -2386,12 +2382,6 @@ void func_8009FE58(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7811);
}
#else
s16 D_8012A39C = 538;
s16 D_8012A3A0 = 4272;
void func_8009FE58(GlobalContext* globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_scene_table/func_8009FE58.s")
#endif
// Scene Draw Config 26
void func_800A0334(GlobalContext* globalCtx) {

View file

@ -194,7 +194,7 @@ void func_800AA78C(View* view, f32 x, f32 y, f32 z) {
view->unk_F4.z = z;
}
void func_800AA7AC(View* view, f32 arg1) {
s32 func_800AA7AC(View* view, f32 arg1) {
view->unk_100 = arg1;
}
@ -260,7 +260,7 @@ s32 func_800AA890(View* view, Mtx* mtx) {
}
void func_800AAA50(View* view, s32 arg1) {
arg1 = (view->flags & arg1) | arg1 >> 4;
arg1 = (view->flags & arg1) | (arg1 >> 4);
if (arg1 & 8) {
func_800AB0A8(view);
@ -522,8 +522,6 @@ s32 func_800AB944(View* view) {
return 1;
}
#ifdef NON_MATCHING
// regalloc differences, skips a t register at arg1's assignment
s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
Gfx* gfx = *gfxp;
GraphicsContext* gfxCtx = view->gfxCtx;
@ -595,9 +593,6 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
return 1;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB9EC.s")
#endif
s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ) {
s32 error = 0;