toggle to scale weather with mobjscale

toggle since it may tank performance on certain maps for some + may make visability worse
This commit is contained in:
Alug committed 2024-08-27 15:58:52 +02:00
1 parent 4894d42e67
commit 0840e5be3f
6 files changed
+57 -39

No files matched your search

+3 -2
View File
@@ -4672,14 +4672,15 @@ static void HWR_AddPrecipitationSprites(void)
{
//const fixed_t drawdist = cv_drawdist_precip.value * mapobjectscale;
fixed_t drawdist;
fixed_t precipscale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th;
if (current_bsp_culling_distance)
drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * mapobjectscale);
drawdist = min((fixed_t)current_bsp_culling_distance, (fixed_t)(cv_drawdist_precip.value) * precipscale);
else
drawdist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale;
drawdist = (fixed_t)(cv_drawdist_precip.value) * precipscale;
// No to infinite precipitation draw distance.
if (drawdist == 0)
+8 -5
View File
@@ -1479,17 +1479,18 @@ static menuitem_t OP_ExpOptionsMenu[] =
{IT_HEADER, NULL, "Advanced Options", NULL, 10},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 20},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 30},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 35},
{IT_STRING | IT_CVAR, NULL, "Scale Weather with Mobjscale", &cv_mobjscaleprecip, 35},
{IT_STRING | IT_CVAR, NULL, "Less Weather Effects", &cv_lessprecip, 40},
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 45},
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 50},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 55},
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 60},
#ifdef USE_FBO_OGL
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 60},
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 65},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 70},
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 75},
#endif
};
@@ -1498,6 +1499,7 @@ static const char* OP_ExpTooltips[] =
NULL,
"How far Mobj interpolation should take effect.",
"Should weather be interpolated? Weather should look about the\nsame but perform a bit better when disabled.",
"Should weather be scaled with Mapobjectscale?.",
"When weather is on this will cut the object amount used in half.",
"Toggle being able to see the sky.",
#ifdef HWRENDER
@@ -1514,6 +1516,7 @@ enum
op_exp_header,
op_exp_interpdist,
op_exp_precipinter,
op_exp_precipmoscale,
op_exp_lessprecip,
op_exp_skybox,
#ifdef HWRENDER
+42 -30
View File
@@ -10218,8 +10218,9 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHE
void P_SpawnPrecipitation(void)
{
INT32 i, mrand;
fixed_t basex, basey, x, y, height;
INT32 i, j, k, mrand;
fixed_t basex, basey, x, y, z, height;
fixed_t precipscale = cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT;
subsector_t *precipsector = NULL;
precipmobj_t *rainmo = NULL;
@@ -10232,10 +10233,9 @@ void P_SpawnPrecipitation(void)
basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE;
basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE;
//for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always
for (j = 0; j < FRACUNIT; j += precipscale)
{
INT32 floorz;
INT32 ceilingz;
UINT16 numparticles = 0;
x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
@@ -10251,37 +10251,49 @@ void P_SpawnPrecipitation(void)
if (precipsector->sector->ceilingpic != skyflatnum)
continue;
height = precipsector->sector->ceilingheight - precipsector->sector->floorheight;
height = FixedDiv(height, precipscale);
// Exists, but is too small for reasonable precipitation.
if (!(precipsector->sector->floorheight <= precipsector->sector->ceilingheight - (32<<FRACBITS)))
if (height < 64<<FRACBITS)
continue;
// Don't set height yet...
height = precipsector->sector->ceilingheight;
// Hack around a quirk of this entire system, where taller sectors look like they get less precipitation.
numparticles = 1 + (height / (MAPBLOCKUNITS<<4<<FRACBITS));
if (curWeather == PRECIP_SNOW)
{
rainmo = P_SpawnPrecipMobj(x, y, height, MT_SNOWFLAKE);
mrand = M_RandomByte();
if (mrand < 64)
P_SetPrecipMobjState(rainmo, S_SNOW3);
else if (mrand < 144)
P_SetPrecipMobjState(rainmo, S_SNOW2);
}
else // everything else.
rainmo = P_SpawnPrecipMobj(x, y, height, MT_RAIN);
// Don't set z properly yet...
z = precipsector->sector->ceilingheight;
floorz = rainmo->floorz >> FRACBITS;
ceilingz = rainmo->ceilingz >> FRACBITS;
for (k = 0; k < numparticles; k++)
{
INT32 floorz;
INT32 ceilingz;
if (floorz < ceilingz)
{
// Randomly assign a height, now that floorz is set.
rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS;
}
else
{
// ...except if the floor is above the ceiling.
rainmo->z = ceilingz << FRACBITS;
if (curWeather == PRECIP_SNOW)
{
rainmo = P_SpawnPrecipMobj(x, y, z, MT_SNOWFLAKE);
mrand = M_RandomByte();
if (mrand < 64)
P_SetPrecipMobjState(rainmo, S_SNOW3);
else if (mrand < 144)
P_SetPrecipMobjState(rainmo, S_SNOW2);
}
else // everything else.
rainmo = P_SpawnPrecipMobj(x, y, z, MT_RAIN);
floorz = rainmo->floorz >> FRACBITS;
ceilingz = rainmo->ceilingz >> FRACBITS;
if (floorz < ceilingz)
{
// Randomly assign a height, now that floorz is set.
rainmo->z = M_RandomRange(floorz, ceilingz) << FRACBITS;
}
else
{
// ...except if the floor is above the ceiling.
rainmo->z = ceilingz << FRACBITS;
}
}
}
}
+2
View File
@@ -210,6 +210,7 @@ consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, N
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1885,6 +1886,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_drawdist);
CV_RegisterVar(&cv_drawdist_precip);
CV_RegisterVar(&cv_lessprecip);
CV_RegisterVar(&cv_mobjscaleprecip);
CV_RegisterVar(&cv_fov);
CV_RegisterVar(&cv_chasecam);
+1 -1
View File
@@ -118,7 +118,7 @@ extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4;
extern consvar_t cv_shadow, cv_shadowoffs;
extern consvar_t cv_ffloorclip, cv_spriteclip;
extern consvar_t cv_translucency;
extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip;
extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip, cv_mobjscaleprecip;
extern consvar_t cv_fov;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
+1 -1
View File
@@ -2054,7 +2054,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
//
void R_AddPrecipitationSprites(void)
{
const fixed_t drawdist = (fixed_t)(cv_drawdist_precip.value) * mapobjectscale;
fixed_t drawdist = (fixed_t)(cv_drawdist_precip.value) * (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
INT32 xl, xh, yl, yh, bx, by;
precipmobj_t *th, *next;