Fixprecip #40

Merged
Indev450 merged 6 commits from fixprecip into Saturn 2023-08-29 09:14:14 +02:00
4 changed files with 42 additions and 42 deletions

No files matched your search

+17 -17
View File
@@ -3755,7 +3755,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
}
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts)
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
{
if (cv_grspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
{
@@ -3907,7 +3907,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
}
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, baseWallVerts);
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
// push it toward the camera to mitigate floor-clipping sprites
{
@@ -4254,7 +4254,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// Let dispoffset work first since this adjust each vertex
// ...nah
HWR_RotateSpritePolyToAim(spr, wallVerts);
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
// push it toward the camera to mitigate floor-clipping sprites
{
@@ -4348,7 +4348,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
wallVerts[1].z = wallVerts[2].z = spr->z2;
// Let dispoffset work first since this adjust each vertex
HWR_RotateSpritePolyToAim(spr, wallVerts);
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = gpatch->max_s;
@@ -5253,11 +5253,11 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
unsigned rot = 0;
UINT8 flip;
// uncapped/interpolation
interpmobjstate_t interp = {0};
if (!thing)
return;
// uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
@@ -5326,16 +5326,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos;
// okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
//
// store information in a vissprite
//
@@ -5364,6 +5354,16 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
vis->precip = true;
// okay... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
}
static boolean drewsky = false;
+11 -13
View File
@@ -3792,12 +3792,11 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
{
//(void)mobj;
mobj->precipflags &= ~PCF_THUNK;
R_ResetPrecipitationMobjInterpolationState(mobj);
}
void P_SnowThinker(precipmobj_t *mobj)
{
R_ResetPrecipitationMobjInterpolationState(mobj);
P_CycleStateAnimation((mobj_t *)mobj);
// adjust height
@@ -3810,8 +3809,6 @@ void P_SnowThinker(precipmobj_t *mobj)
void P_RainThinker(precipmobj_t *mobj)
{
R_ResetPrecipitationMobjInterpolationState(mobj);
P_CycleStateAnimation((mobj_t *)mobj);
if (mobj->state != &states[S_RAIN1])
@@ -3838,17 +3835,18 @@ void P_RainThinker(precipmobj_t *mobj)
}
// adjust height
if ((mobj->z += mobj->momz) <= mobj->floorz)
if ((mobj->z += mobj->momz) > mobj->floorz)
return;
// no splashes on sky or bottomless pits
if (mobj->precipflags & PCF_PIT)
{
// no splashes on sky or bottomless pits
if (mobj->precipflags & PCF_PIT)
mobj->z = mobj->ceilingz;
else
{
mobj->z = mobj->floorz;
P_SetPrecipMobjState(mobj, S_SPLASH1);
}
mobj->z = mobj->ceilingz;
return;
}
mobj->z = mobj->floorz;
P_SetPrecipMobjState(mobj, S_SPLASH1);
}
static void P_RingThinker(mobj_t *mobj)
+1
View File
@@ -160,6 +160,7 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
{256, "256"}, {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
{3072, "3072"}, {4096, "4096"},
{0, "None"}, {0, NULL}};
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
+13 -12
View File
@@ -1796,17 +1796,6 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
return;
}
// okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
//SoM: 3/17/2000: Disregard sprites that are out of view..
gzt = interp.z + spritecachedinfo[lump].topoffset;
gz = gzt - spritecachedinfo[lump].height;
@@ -1814,7 +1803,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
if (thing->subsector->sector->cullheight)
{
if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt))
return;
goto weatherthink;
}
// store information in a vissprite
@@ -1878,6 +1867,18 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->precip = true;
vis->vflip = false;
vis->isScaled = false;
weatherthink:
// okay... this is a hack, but weather isn't networked, so it should be ok
if (!(thing->precipflags & PCF_THUNK))
{
if (thing->precipflags & PCF_RAIN)
P_RainThinker(thing);
else
P_SnowThinker(thing);
thing->precipflags |= PCF_THUNK;
}
}
// R_AddSprites