From 0b23e06b7729ddd38d40cf600caa363e7d0b8253 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Wed, 16 Oct 2024 12:46:04 -0600 Subject: [PATCH] Fixed stars --- include/functions.h | 1 + include/sf64thread.h | 12 ++++++------ src/engine/fox_bg.c | 25 +++++++++++++------------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/functions.h b/include/functions.h index 887393be..4c253777 100644 --- a/include/functions.h +++ b/include/functions.h @@ -209,6 +209,7 @@ void Effect_Update(Effect*); void TexturedLine_Update(TexturedLine*); void TexturedLine_UpdateAll(void); void Object_Update(void); +float FloatMod(float a, float b); //fox_enmy2 void Actor237_Update(Actor*); diff --git a/include/sf64thread.h b/include/sf64thread.h index cbe8a395..26c8e5b2 100644 --- a/include/sf64thread.h +++ b/include/sf64thread.h @@ -66,12 +66,12 @@ typedef struct { typedef struct { /* 0x00000 */ SPTask task; - /* 0x00050 */ Vp viewports[0x10]; - /* 0x00150 */ Mtx mtx[0x480]; - /* 0x12150 */ Gfx unkDL1[0x180]; - /* 0x12D50 */ Gfx masterDL[0x1380]; - /* 0x1C950 */ Gfx unkDL2[0xD80]; - /* 0x23550 */ Lightsn lights[0x100]; + /* 0x00050 */ Vp viewports[0x10 * 4]; + /* 0x00150 */ Mtx mtx[0x480 * 4]; + /* 0x12150 */ Gfx unkDL1[0x180 * 4]; + /* 0x12D50 */ Gfx masterDL[0x1380 * 4]; + /* 0x1C950 */ Gfx unkDL2[0xD80 * 4]; + /* 0x23550 */ Lightsn lights[0x100 * 4]; } GfxPool; // size = 0x2AD50, 0x8 aligned void Controller_Init(void); diff --git a/src/engine/fox_bg.c b/src/engine/fox_bg.c index a7122565..6acc6a4f 100644 --- a/src/engine/fox_bg.c +++ b/src/engine/fox_bg.c @@ -136,6 +136,19 @@ static Gfx starDLPartial[] = { gsSPEndDisplayList(), }; +// Setup render state for stars +static Gfx starSetupDL[] = { + gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), // Disable texturing + gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_CULL_BACK | + G_SHADING_SMOOTH), + //gsDPPipeSync(), + gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), // Use primitive color + gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_OPA_SURF | G_RM_OPA_SURF2), + gsSPEndDisplayList(), +}; + // @port: Starfield drawn with triangles, re-engineered by @Tharo & @TheBoy181 void Background_DrawStarfield(void) { f32 by; @@ -160,18 +173,6 @@ void Background_DrawStarfield(void) { // Set projection to orthographic before drawing stars Lib_InitOrtho(&gMasterDisp); - // Setup render state for stars - static Gfx starSetupDL[] = { - gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), // Disable texturing - gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_CULL_BACK | - G_SHADING_SMOOTH), - gsDPPipeSync(), - gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), // Use primitive color - gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PIXEL | G_RM_OPA_SURF | G_RM_OPA_SURF2), - gsSPEndDisplayList(), - }; gSPDisplayList(gMasterDisp++, starSetupDL); // Get current screen dimensions