From dfcff1a365511938d22dd2a174d94e2d58d64929 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Wed, 27 Nov 2024 04:33:56 -0300 Subject: [PATCH] training ground fix for OnRails --- src/engine/fox_bg.c | 55 ++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/src/engine/fox_bg.c b/src/engine/fox_bg.c index 585e6199..52392689 100644 --- a/src/engine/fox_bg.c +++ b/src/engine/fox_bg.c @@ -1418,66 +1418,91 @@ void Background_DrawGround(void) { break; case LEVEL_TRAINING: + static Vtx trainingGroundVtx_FIX[] = { + { { { 4000, 0, -6000 }, 0, { 20947, -19923 }, { 0, 120, 0, 255 } } }, + { { { -4000, 0, -6000 }, 0, { 0, -19923 }, { 0, 120, 0, 255 } } }, + { { { -4000, 0, 0 }, 0, { 0, -9449 }, { 0, 120, 0, 255 } } }, + { { { 4000, 0, 0 }, 0, { 20947, -9449 }, { 0, 120, 0, 255 } } }, + { { { -4000, 0, 6000 }, 0, { 0, 1023 }, { 0, 120, 0, 255 } } }, + { { { 4000, 0, 6000 }, 0, { 20947, 1023 }, { 0, 120, 0, 255 } } }, + }; + + static Gfx trainingGroundDL_FIX[] = { + gsSPVertex(trainingGroundVtx_FIX, 6, 0), + gsSP2Triangles(1, 2, 3, 0, 1, 3, 0, 0), + gsSP2Triangles(4, 5, 3, 0, 4, 3, 2, 0), + gsSPEndDisplayList(), + }; + + sp1C4 = D_TR_6005938; + sp1C0 = trainingGroundDL_FIX; + gDPLoadTextureBlock(gMasterDisp++, sp1C4, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); skipInterpolationGround = (fabsf(gPlayer[gPlayerNum].xPath - prevPlayerPath) > 12000.0f / 2.0f); skipInterpolationGround2 = prevPlayerPath2 != sp1D4; if (gLevelMode == LEVELMODE_ON_RAILS) { - if (gPathTexScroll > (32.0f * 36.7f) / 2.0f) { - gPathTexScroll -= (32.0f * 36.7f) / 2.0f; - } + // if (gPathTexScroll > (32.0f * 36.7f) / 2.0f) { + // gPathTexScroll -= (32.0f * 36.7f) / 2.0f; + // } + gDPSetTextureImage(gMasterDisp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, sp1C4); + temp_s0 = fabsf(Math_ModF(2.0f * (gPathTexScroll * 0.2133333f), 128.0f)); // 0.64f / 3.0f + temp_fv0 = Math_ModF((10000.0f - gPlayer[gPlayerNum].xPath) * 0.32f, 128.0f); + gDPSetupTile(gMasterDisp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, temp_fv0, temp_s0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); // Original Display (Center) Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -2500.0f + gPathTexScroll, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -2500.0f /*+ gPathTexScroll*/, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); // Mirrored Display - Left Side Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -2500.0f + gPathTexScroll, + Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -2500.0f /*+ gPathTexScroll*/, MTXF_APPLY); // Move left by the width of the original (-8000.0f) Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); // Mirrored Display - Right Side Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -2500.0f + gPathTexScroll, + Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -2500.0f /*+ gPathTexScroll*/, MTXF_APPLY); // Move right by the width of the original (+8000.0f) Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); // Original Display for the second section (Center) Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -8435.0f + 65 + gPathTexScroll, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -8435.0f + 65 /*+ gPathTexScroll*/, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); // Mirrored Display - Left Side for the second section Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -8435.0f + 65 + gPathTexScroll, + Matrix_Translate(gGfxMatrix, -8000.0f, 0.0f, -8435.0f + 65 /*+ gPathTexScroll*/, MTXF_APPLY); // Move left by the width of the original (-8000.0f) Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); // Mirrored Display - Right Side for the second section Matrix_Push(&gGfxMatrix); - Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -8435.0f + 65 + gPathTexScroll, + Matrix_Translate(gGfxMatrix, 8000.0f, 0.0f, -8435.0f + 65 /*+ gPathTexScroll*/, MTXF_APPLY); // Move right by the width of the original (+8000.0f) Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 0.5f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, D_TR_6005880); + gSPDisplayList(gMasterDisp++, sp1C0); Matrix_Pop(&gGfxMatrix); } else { u32 skipInfo = skipInterpolationGround << 8 | skipInterpolationGround2 << 16;