improve ground

This commit is contained in:
Sonic Dreamcaster 2024-11-17 18:03:31 -03:00
parent 1924a4eeed
commit a144f44d5e
2 changed files with 55 additions and 34 deletions

View File

@ -501,7 +501,7 @@ void Background_DrawBackdrop(void) {
if (skipInterpolation) { if (skipInterpolation) {
// @port Skip interpolation // @port Skip interpolation
FrameInterpolation_ShouldInterpolateFrame(false); FrameInterpolation_ShouldInterpolateFrame(true);
} else { } else {
// @port Pop the transform id. // @port Pop the transform id.
FrameInterpolation_RecordCloseChild(); FrameInterpolation_RecordCloseChild();
@ -557,7 +557,7 @@ void Background_DrawBackdrop(void) {
if (skipInterpolation) { if (skipInterpolation) {
// @port Skip interpolation // @port Skip interpolation
FrameInterpolation_ShouldInterpolateFrame(false); FrameInterpolation_ShouldInterpolateFrame(true);
} else { } else {
// @port Pop the transform id. // @port Pop the transform id.
FrameInterpolation_RecordCloseChild(); FrameInterpolation_RecordCloseChild();
@ -658,7 +658,7 @@ void Background_DrawBackdrop(void) {
} }
if (skipInterpolation) { if (skipInterpolation) {
// @port Skip interpolation // @port Skip interpolation
FrameInterpolation_ShouldInterpolateFrame(false); FrameInterpolation_ShouldInterpolateFrame(true);
} else { } else {
// @port Pop the transform id. // @port Pop the transform id.
FrameInterpolation_RecordCloseChild(); FrameInterpolation_RecordCloseChild();
@ -722,7 +722,6 @@ void Background_DrawBackdrop(void) {
sp13C = Math_ModF(sp13C, 7280.0f); sp13C = Math_ModF(sp13C, 7280.0f);
f32 corneriaCamYawDeg = Math_RadToDeg(gPlayer[0].camYaw); f32 corneriaCamYawDeg = Math_RadToDeg(gPlayer[0].camYaw);
if (gLevelMode == LEVELMODE_ON_RAILS) { if (gLevelMode == LEVELMODE_ON_RAILS) {
if (corneriaCamYawDeg < 180.0f) { if (corneriaCamYawDeg < 180.0f) {
sp13C = -(7280.0f - sp13C); sp13C = -(7280.0f - sp13C);
@ -746,7 +745,7 @@ void Background_DrawBackdrop(void) {
// Render the textures across a wider range to cover the screen // Render the textures across a wider range to cover the screen
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (skipInterpolation) { if (skipInterpolation) {
// @port Skip interpolation // @port Skip interpolation
FrameInterpolation_ShouldInterpolateFrame(false); FrameInterpolation_ShouldInterpolateFrame(false);
} else { } else {
@ -772,7 +771,7 @@ void Background_DrawBackdrop(void) {
if (skipInterpolation) { if (skipInterpolation) {
// @port Skip interpolation // @port Skip interpolation
FrameInterpolation_ShouldInterpolateFrame(false); FrameInterpolation_ShouldInterpolateFrame(true);
} else { } else {
// @port Pop the transform id. // @port Pop the transform id.
FrameInterpolation_RecordCloseChild(); FrameInterpolation_RecordCloseChild();
@ -1127,6 +1126,11 @@ Vtx dynaFloor1Vtx[17 * 17];
Vtx dynaFloor2Vtx[17 * 17]; Vtx dynaFloor2Vtx[17 * 17];
#endif #endif
static u8 skipInterpolationGround = 0;
static u8 skipInterpolationGround2 = 0;
static f32 prevPlayerPath = 0.0f;
static f32 prevPlayerPath2 = 0.0f;
void Background_DrawGround(void) { void Background_DrawGround(void) {
f32 sp1D4; f32 sp1D4;
s32 i; s32 i;
@ -1651,22 +1655,42 @@ void Background_DrawGround(void) {
RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); RCP_SetupDL_20(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar);
} }
for (i = 0; i < ARRAY_COUNT(sGroundPositions360x_FIX); i++) { skipInterpolationGround = (fabsf(gPlayer[gPlayerNum].xPath - prevPlayerPath) > 12000.0f / 2.0f);
Matrix_Push(&gGfxMatrix); skipInterpolationGround2 = prevPlayerPath2 != sp1D4;
Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i],
MTXF_APPLY); // if (skipInterpolationGround || skipInterpolationGround2) {
Matrix_SetGfxMtx(&gMasterDisp); // printf(" Ground interpolation Skipped! \n");
if (gCurrentLevel == LEVEL_FORTUNA) { // }
gSPDisplayList(gMasterDisp++, D_FO_6001360);
} else if (gCurrentLevel == LEVEL_KATINA) { {
gSPDisplayList(gMasterDisp++, D_KA_6009250); u32 skipInfo = skipInterpolationGround << 8 | skipInterpolationGround2 << 16;
} else if (gCurrentLevel == LEVEL_BOLSE) {
gSPDisplayList(gMasterDisp++, D_BO_600A810); printf("skipInfo: %x \n", skipInfo);
} else if (gCurrentLevel == LEVEL_VENOM_2) {
gSPDisplayList(gMasterDisp++, D_VE2_6010700); for (i = 0; i < ARRAY_COUNT(sGroundPositions360x_FIX); i++) {
FrameInterpolation_RecordOpenChild("Ground", i | skipInfo);
FrameInterpolation_RecordMarker(__FILE__, __LINE__);
Matrix_Push(&gGfxMatrix);
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);
}
Matrix_Pop(&gGfxMatrix);
FrameInterpolation_RecordCloseChild();
} }
Matrix_Pop(&gGfxMatrix);
} }
prevPlayerPath = gPlayer[gPlayerNum].xPath;
prevPlayerPath2 = sp1D4;
break; break;
case LEVEL_VERSUS: case LEVEL_VERSUS:

View File

@ -7,6 +7,9 @@
#include "assets/ast_sector_z.h" #include "assets/ast_sector_z.h"
#include "port/interpolation/FrameInterpolation.h" #include "port/interpolation/FrameInterpolation.h"
// f32 path1 = 0.0f;
// f32 path2 = 0.0f;
Vec3f D_display_801613B0[4]; Vec3f D_display_801613B0[4];
Vec3f D_display_801613E0[4]; Vec3f D_display_801613E0[4];
s16 gReflectY; s16 gReflectY;
@ -2068,6 +2071,7 @@ void Display_Update(void) {
if (gControllerPress[0].button & L_TRIG) { if (gControllerPress[0].button & L_TRIG) {
pl->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; pl->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE;
gMissionStatus = MISSION_ACCOMPLISHED;
} }
} }
@ -2102,22 +2106,15 @@ void Display_Update(void) {
gLaserStrength[0] = 2; gLaserStrength[0] = 2;
} }
Hit64_Main(); Hit64_Main();
// background testing // ground testing
#if 0 #if 0
RCP_SetupDL(&gMasterDisp, SETUPDL_83); RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
if (gTestVarF > 0.0f) { Graphics_DisplaySmallText(10, 210, 1.0f, 1.0f, "PATH1:");
Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "TEST:"); Graphics_DisplaySmallNumber(60, 210, (int) ABS(path1));
} else { Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "PATH2:");
Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "TESTNEG:"); Graphics_DisplaySmallNumber(60, 220, (int) ABS(path2));
} if (path1 < 0.0f) Graphics_DisplaySmallText(110, 210, 1.0f, 1.0f, "NEG:");
Graphics_DisplaySmallNumber(80, 220, (int) ABS(gTestVarF)); if (path2 < 0.0f) Graphics_DisplaySmallText(110, 220, 1.0f, 1.0f, "NEG:");
if (gControllerPress[0].button & Z_TRIG) {
gTestVarF -= 10;
} else if (gControllerPress[0].button & R_TRIG) {
gTestVarF += 10;
}
#endif #endif
} }