summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-02-13 12:58:13 -0300
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-02-13 12:58:13 -0300
commit571e58f443f2e26cf104538038bb6ae120186302 (patch)
tree1028a90bd02911b4c5719e1d69273ab3dcb31849
parent3bc7126f7b6d1e10c2ea1cbd1d12edb73497b36d (diff)
Fix AllRange Floors360floors
-rw-r--r--src/engine/fox_bg.c393
1 files changed, 145 insertions, 248 deletions
diff --git a/src/engine/fox_bg.c b/src/engine/fox_bg.c
index 0eca76a6..9af4f76c 100644
--- a/src/engine/fox_bg.c
+++ b/src/engine/fox_bg.c
@@ -43,28 +43,41 @@ f32 gAndrossUnkBrightness; // can be static
f32 gAndrossUnkAlpha = 0.0f;
u16 gBolseDynamicGround = true;
s32 D_bg_800C9C38 = 0; // unused?
+
static f32 sGroundPositions360x_FIX[] = {
- 5999.0f, -5999.0f, 5999.0f, -5999.0f, // Center pieces X : 0 - 3
- 5999.0f * 3.0f, // lower right corner piece : 4
- 5999.0f * 1.0f, -5999.0f * 1.0f, // Lower middle pieces : 5 - 6
- -5999.0f * 3.0f, // lower left corner piece : 7
+ // center pieces : 0 - 3
+ 5999.0f, -5999.0f, 5999.0f, -5999.0f,
+ 5999.0f * 3.0f, // lower right corner piece : 4
+ 5999.0f * 1.0f, // lower middle left piece : 5
+ -5999.0f * 1.0f, // lower middle right piece : 6
+ -5999.0f * 3.0f, // lower left corner piece : 7
-5999.0f * 3.0f, // upper left corner piece : 8
- -5999.0f * 1.0f, +5999.0f * 1.0f, // Upper middle pieces X : 9 - 10
- +5999.0f * 3.0f, // upper right corner piece : 11
- -5999.0f * 3.0f, -5999.0f * 3.0f, // Side left pieces : 12 - 13
- +5999.0f * 3.0f, +5999.0f * 3.0f, // Side Right pieces : 14 - 15
+ -5999.0f * 1.0f, // uppder middle left piece : 9
+ +5999.0f * 1.0f, // Upper middle right pieceX : 10
+ +5999.0f * 3.0f, // upper right corner piece : 11
+ -5999.0f * 3.0f, // side upper left piece : 12
+ -5999.0f * 3.0f, // side lower left piece : 13
+ +5999.0f * 3.0f, // side upper right piece: 14
+ +5999.0f * 3.0f, // side lower right piece : 15
};
+
static f32 sGroundPositions360z_FIX[] = {
- 5999.0f, 5999.0f, -5999.0f, -5999.0f, // Center pieces Z
+ // center pieces : 0 - 3
+ 5999.0f, 5999.0f, -5999.0f, -5999.0f,
5999.0f * 3.0f, // lower right corner piece : 4
- 5999.0f * 3.0f, +5999.0f * 3.0f, // Lower pieces Z : 5 - 6
- 5999.0f * 3.0f, // lower left corner piece : 7
- -5999.0f * 3.0f, -5999.0f * 3.0f, // Upper pieces X : 9 - 11
- -5999.0f * 3.0f, // upper right corner piece : 12
- -5999.0f * 3.0f, // upper left corner piece : 8
- -5999.0f * 1.0f, 5999.0f * 1.0f, // Side left pieces
- -5999.0f * 1.0f, 5999.0f * 1.0f, // Side Right pieces
+ 5999.0f * 3.0f, // lower middle left piece : 5
+ +5999.0f * 3.0f, // lower middle right piece : 6
+ 5999.0f * 3.0f, // lower left corner piece : 7
+ -5999.0f * 3.0f, // upper left corner piece : 8
+ -5999.0f * 3.0f, // uppder middle left piece : 9
+ -5999.0f * 3.0f, // Upper middle right pieceX : 10
+ -5999.0f * 3.0f, // upper right corner piece : 11
+ -5999.0f * 1.0f, // side upper left piece : 12
+ 5999.0f * 1.0f, // side lower left piece : 13
+ -5999.0f * 1.0f, // side upper right piece: 14
+ 5999.0f * 1.0f, // side lower right piece : 15
};
+
u16 gStarColors[16] = {
0x108B, 0x108B, 0x1087, 0x1089, 0x39FF, 0x190D, 0x108B, 0x1089,
0x294B, 0x18DF, 0x294B, 0x1085, 0x39FF, 0x108B, 0x18CD, 0x108B,
@@ -1181,10 +1194,103 @@ Vtx dynaFloor1Vtx[17 * 17];
Vtx dynaFloor2Vtx[17 * 17];
#endif
-static u8 skipInterpolationGround = 0;
-static u8 skipInterpolationGround2 = 0;
-static f32 prevPlayerPath = 0.0f;
-static f32 prevPlayerPath2 = 0.0f;
+void AllRangeGround_Draw(void) {
+ for (int i = 0; i < ARRAY_COUNT(sGroundPositions360x_FIX); i++) {
+ const f32 maxDistZ = 0.0f;
+ const f32 maxDistX = 0.0f;
+
+ // UPPER LEFT QUADRANT
+ if (gPlayer[0].pos.x < maxDistX && gPlayer[0].pos.z < maxDistZ) {
+ // upper left corner piece : 8
+ // side upper left piece : 12
+ // side lower left piece : 13
+ // Upper middle right piece : 10
+ // upper middle left piece : 9
+ if ((i > 3) && (i != 8) && (i != 12) && (i != 9) && (i != 13) && (i != 10)) {
+ continue;
+ }
+ }
+
+ // LOWER LEFT QUADRANT
+ if (gPlayer[0].pos.x < maxDistX && gPlayer[0].pos.z > maxDistZ) {
+ // lower middle left piece: 5
+ // lower middle right piece : 6
+ // lower left corner piece: 7
+ // side upper left piece : 12
+ // side lower left piece : 13
+ if ((i > 3) && (i != 5) && (i != 7) && (i != 13) && (i != 6) && (i != 12)) {
+ continue;
+ }
+ }
+
+ // UPPER RIGHT QUADRANT
+ if (gPlayer[0].pos.x > maxDistX && gPlayer[0].pos.z < maxDistZ) {
+ // uppder middle left piece : 9
+ // Upper middle right piece : 10
+ // upper right corner piece : 11
+ // side upper right piece: 14
+ // side lower right piece : 15
+ if ((i > 3) && (i != 10) && (i != 11) && (i != 14) && (i != 9) && (i != 15)) {
+ continue;
+ }
+ }
+
+ // LOWER RIGHT QUADRANT
+ if (gPlayer[0].pos.x > maxDistX && gPlayer[0].pos.z > maxDistZ) {
+ // lower right corner piece : 4
+ // // lower middle left piece : 5
+ // lower middle right piece : 6
+ // side upper right piece: 14
+ // side lower right piece : 15
+ if ((i > 3) && ((i != 4) && (i != 6) && (i != 15) && (i != 14) && (i != 5))) {
+ continue;
+ }
+ }
+
+ Matrix_Push(&gGfxMatrix);
+
+ FrameInterpolation_RecordOpenChild("360Ground", i);
+
+ Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i], MTXF_APPLY);
+
+ if (gCurrentLevel == LEVEL_TRAINING) {
+ Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY);
+ }
+ Matrix_SetGfxMtx(&gMasterDisp);
+
+ switch (gCurrentLevel) {
+ case LEVEL_FORTUNA:
+ gSPDisplayList(gMasterDisp++, D_FO_6001360);
+ break;
+ case LEVEL_KATINA:
+ gSPDisplayList(gMasterDisp++, D_KA_6009250);
+ break;
+ case LEVEL_BOLSE:
+ gSPDisplayList(gMasterDisp++, D_BO_600A810);
+ break;
+ case LEVEL_VENOM_2:
+ gSPDisplayList(gMasterDisp++, D_VE2_6010700);
+ break;
+ case LEVEL_CORNERIA:
+ gSPDisplayList(gMasterDisp++, D_CO_601EAA0);
+ break;
+ case LEVEL_TRAINING:
+ gSPDisplayList(gMasterDisp++, D_TR_6005880);
+ break;
+ case LEVEL_VERSUS:
+ if (gVersusStage == VS_STAGE_CORNERIA) {
+ gSPDisplayList(gMasterDisp++, D_versus_3018800);
+ } else {
+ gSPDisplayList(gMasterDisp++, D_versus_30160A0);
+ }
+ break;
+ }
+ Matrix_Pop(&gGfxMatrix);
+
+ // @port: Tag the transform.
+ FrameInterpolation_RecordCloseChild();
+ }
+}
void Background_DrawGround(void) {
f32 sp1D4;
@@ -1195,14 +1301,6 @@ void Background_DrawGround(void) {
Gfx* sp1C0;
f32 temp_fv1;
f32 temp_fa0;
- bool sQuadrantX1 = false;
- bool sQuadrantZ1 = false;
- bool sQuadrantX2 = false;
- bool sQuadrantZ2 = false;
- bool sQuadrantX3 = false;
- bool sQuadrantZ3 = false;
- bool sQuadrantX4 = false;
- bool sQuadrantZ4 = false;
if ((gCurrentLevel != LEVEL_VENOM_2) && ((gPlayer[0].cam.eye.y > 4000.0f) || !gDrawGround)) {
return;
@@ -1235,53 +1333,37 @@ void Background_DrawGround(void) {
Matrix_RotateY(gCalcMatrix, -gPlayer[gPlayerNum].camYaw, MTXF_NEW);
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp1B4, &sp1A8);
+ // @port: We no longer warp the floor.
+#if 0
temp_fv1 = gPlayer[gPlayerNum].cam.eye.x + sp1A8.x;
temp_fa0 = gPlayer[gPlayerNum].cam.eye.z + sp1A8.z;
- // printf("X: %f\n Z: %f\n\n", temp_fv1, temp_fa0);
-
if (temp_fv1 > 6000.0f) {
- // gPlayer[gPlayerNum].xPath = 12000.0f;
- //printf("X QUADRANT 1 ");
- sQuadrantX1 = true;
+ gPlayer[gPlayerNum].xPath = 12000.0f;
}
if (temp_fv1 > 18000.0f) {
- // gPlayer[gPlayerNum].xPath = 24000.0f;
- //printf("X QUADRANT 2 ");
- sQuadrantX2 = true;
+ gPlayer[gPlayerNum].xPath = 24000.0f;
}
if (temp_fv1 < -6000.0f) {
- // gPlayer[gPlayerNum].xPath = -12000.0f;
- //printf("X QUADRANT 3 ");
- sQuadrantX3 = true;
+ gPlayer[gPlayerNum].xPath = -12000.0f;
}
if (temp_fv1 < -18000.0f) {
- // gPlayer[gPlayerNum].xPath = -24000.0f;
- //printf("X QUADRANT 4 ");
- sQuadrantX4 = true;
+ gPlayer[gPlayerNum].xPath = -24000.0f;
}
if (temp_fa0 > 6000.0f) {
- // sp1D4 = 12000.0f;
- //printf("Z QUADRANT 1 ");
- sQuadrantZ1 = true;
+ sp1D4 = 12000.0f;
}
if (temp_fa0 > 18000.0f) {
- // sp1D4 = 24000.0f;
- // printf("Z QUADRANT 2 ");
- sQuadrantZ2 = true;
+ sp1D4 = 24000.0f;
}
if (temp_fa0 < -6000.0f) {
- // sp1D4 = -12000.0f;
- //printf("Z QUADRANT 3 ");
- sQuadrantZ3 = true;
+ sp1D4 = -12000.0f;
}
if (temp_fa0 < -18000.0f) {
- // sp1D4 = -24000.0f;
- // printf("Z QUADRANT 4 ");
- sQuadrantZ4 = true;
+ sp1D4 = -24000.0f;
}
- // printf("\n");
+#endif
}
Matrix_Push(&gGfxMatrix);
@@ -1375,38 +1457,7 @@ void Background_DrawGround(void) {
gGroundSurface = SURFACE_GRASS;
gBgColor = 0x845; // 8, 8, 32
- skipInterpolationGround = prevPlayerPath != gPlayer[gPlayerNum].xPath;
- skipInterpolationGround2 = prevPlayerPath2 != sp1D4;
-
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port Skip interpolation
- FrameInterpolation_ShouldInterpolateFrame(false);
- }
-
- for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordOpenChild("360Ground", i);
- }
-
- Matrix_Push(&gGfxMatrix);
- Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i],
- MTXF_APPLY);
- Matrix_SetGfxMtx(&gMasterDisp);
- gSPDisplayList(gMasterDisp++, D_CO_601EAA0);
-
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordCloseChild();
- }
- Matrix_Pop(&gGfxMatrix);
- }
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port renable interpolation
- FrameInterpolation_ShouldInterpolateFrame(true);
- }
- prevPlayerPath = gPlayer[gPlayerNum].xPath;
- prevPlayerPath2 = sp1D4;
+ AllRangeGround_Draw();
}
break;
@@ -1530,7 +1581,7 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, sp1C0);
Matrix_Pop(&gGfxMatrix);
- // Mirrored Display - Left Side
+ // Mirrored Display - Left side
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -2500.0f /*+ gPathTexScroll*/,
MTXF_APPLY); // Move left by the width of the original (-8000.0f)
@@ -1539,7 +1590,7 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, sp1C0);
Matrix_Pop(&gGfxMatrix);
- // Mirrored Display - Right Side
+ // Mirrored Display - Right side
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -2500.0f /*+ gPathTexScroll*/,
MTXF_APPLY); // Move right by the width of the original (+8000.0f)
@@ -1556,7 +1607,7 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, sp1C0);
Matrix_Pop(&gGfxMatrix);
- // Mirrored Display - Left Side for the second section
+ // Mirrored Display - Left side for the second section
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -8435.0f + 65 /*+ gPathTexScroll*/,
MTXF_APPLY); // Move left by the width of the original (-8000.0f)
@@ -1565,7 +1616,7 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, sp1C0);
Matrix_Pop(&gGfxMatrix);
- // Mirrored Display - Right Side for the second section
+ // Mirrored Display - Right side for the second section
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -8435.0f + 65 /*+ gPathTexScroll*/,
MTXF_APPLY); // Move right by the width of the original (+8000.0f)
@@ -1574,36 +1625,8 @@ void Background_DrawGround(void) {
gSPDisplayList(gMasterDisp++, sp1C0);
Matrix_Pop(&gGfxMatrix);
} else {
- skipInterpolationGround = prevPlayerPath != gPlayer[gPlayerNum].xPath;
- skipInterpolationGround2 = prevPlayerPath2 != sp1D4;
-
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port Skip interpolation
- FrameInterpolation_ShouldInterpolateFrame(false);
- }
-
- for (i = 0; i < ARRAY_COUNT(sGroundPositions360x_FIX); i++) {
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordOpenChild("360Ground", i);
- }
-
- Matrix_Push(&gGfxMatrix);
- Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i],
- MTXF_APPLY);
- Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY);
- Matrix_SetGfxMtx(&gMasterDisp);
- gSPDisplayList(gMasterDisp++, D_TR_6005880);
-
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordCloseChild();
- }
- Matrix_Pop(&gGfxMatrix);
- }
+ AllRangeGround_Draw();
}
- prevPlayerPath = gPlayer[gPlayerNum].xPath;
- prevPlayerPath2 = sp1D4;
break;
}
@@ -1780,100 +1803,7 @@ void Background_DrawGround(void) {
RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
}
- printf("Player X: %f ", gPlayer[0].pos.x);
- printf("Player Z: %f ", gPlayer[0].pos.z);
- printf("\n");
-
- for (i = 0; i < ARRAY_COUNT(sGroundPositions360x_FIX); i++) {
- const f32 dist = 4000.0f;
-
- #if 1
- // lower right corner piece Z + X +
- if ((i == 4) && gPlayer[0].pos.z < -dist && gPlayer[0].pos.x < -dist) {
- continue;
- }
- // lower left corner piece Z + X -
- if ((i == 7) && gPlayer[0].pos.z < -dist && gPlayer[0].pos.x > dist) {
- continue;
- }
-
- // upper left corner piece Z - X -
- if ((i == 8) && gPlayer[0].pos.z > dist && gPlayer[0].pos.x > dist) {
- continue;
- }
-
- // upper right corner piece Z - X +
- if ((i == 11) && gPlayer[0].pos.z > dist && gPlayer[0].pos.x < -dist) {
- continue;
- }
-
- // Lower middle pieces
- if ((i >= 5 && i <= 6) && gPlayer[0].pos.z < -dist) {
- continue;
- }
-
- // Upper middle pieces
- if ((i >= 9 && i <= 11) && gPlayer[0].pos.z > dist) {
- continue;
- }
-
- // Side Left pieces
- if ((i >= 12 && i <= 13) && gPlayer[0].pos.x > dist) {
- continue;
- }
-
- // Side Right pieces
- if ((i >= 14 && i <= 15) && gPlayer[0].pos.x < -dist) {
- continue;
- }
- #else
- f32 xDist = sGroundPositions360x_FIX[i] + gPlayer[0].pos.x;
- f32 zDist = sGroundPositions360z_FIX[i] + gPlayer[0].pos.z;
- f32 xPDist = gPlayer[0].pos.x;
- f32 zPDist = gPlayer[0].pos.z;
-
- if (xDist > xPDist || zDist > zPDist) {
- continue;
- }
- #endif
-
- // if ((i == 4 || i == 5) && !sQuadrantX1 && !sQuadrantZ1) {
- // continue;
- // }
-
- //if (i == 5 && !sQuadrantX3 && !sQuadrantZ1) {
- // continue;
- //}
-
- Matrix_Push(&gGfxMatrix);
-
- FrameInterpolation_RecordOpenChild("360Ground", i);
-
- Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i],
- MTXF_APPLY);
- Matrix_SetGfxMtx(&gMasterDisp);
-
- if (gCurrentLevel == LEVEL_FORTUNA) {
- gSPDisplayList(gMasterDisp++, D_FO_6001360);
- } else if (gCurrentLevel == LEVEL_KATINA) {
- gSPDisplayList(gMasterDisp++, D_KA_6009250);
- } else if (gCurrentLevel == LEVEL_BOLSE) {
- gSPDisplayList(gMasterDisp++, D_BO_600A810);
- } else if (gCurrentLevel == LEVEL_VENOM_2) {
- gSPDisplayList(gMasterDisp++, D_VE2_6010700);
- }
-
-
- // @port: Tag the transform.
- FrameInterpolation_RecordCloseChild();
- Matrix_Pop(&gGfxMatrix);
- }
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port renable interpolation
- FrameInterpolation_ShouldInterpolateFrame(true);
- }
- prevPlayerPath = gPlayer[gPlayerNum].xPath;
- prevPlayerPath2 = sp1D4;
+ AllRangeGround_Draw();
break;
case LEVEL_VERSUS:
@@ -1883,40 +1813,7 @@ void Background_DrawGround(void) {
RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
}
- skipInterpolationGround = prevPlayerPath != gPlayer[gPlayerNum].xPath;
- skipInterpolationGround2 = prevPlayerPath2 != sp1D4;
-
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port Skip interpolation
- FrameInterpolation_ShouldInterpolateFrame(false);
- }
-
- for (i = 0; i < ARRAY_COUNT(sGroundPositions360x); i++) {
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordOpenChild("360Ground", i);
- }
-
- Matrix_Push(&gGfxMatrix);
- Matrix_Translate(gGfxMatrix, sGroundPositions360x[i], 0.0f, sGroundPositions360z[i], MTXF_APPLY);
- Matrix_SetGfxMtx(&gMasterDisp);
- if (gVersusStage == VS_STAGE_CORNERIA) {
- gSPDisplayList(gMasterDisp++, D_versus_3018800);
- } else {
- gSPDisplayList(gMasterDisp++, D_versus_30160A0);
- }
- if (!skipInterpolationGround && !skipInterpolationGround2) {
- // @port: Tag the transform.
- FrameInterpolation_RecordCloseChild();
- }
- Matrix_Pop(&gGfxMatrix);
- }
- if (skipInterpolationGround || skipInterpolationGround2) {
- // @port renable interpolation
- FrameInterpolation_ShouldInterpolateFrame(true);
- }
- prevPlayerPath = gPlayer[gPlayerNum].xPath;
- prevPlayerPath2 = sp1D4;
+ AllRangeGround_Draw();
break;
case LEVEL_SOLAR: // WIP