- fixed: sprite clipping did not work anymore because the 'invalid' value was inconsistent.

- cleaned up the 'if' condition in PerformSpriteClipAdjustment,
- enabled weapon bobbing interpolation.
This commit is contained in:
Christoph Oelckers 2016-04-07 14:09:07 +02:00
parent 88542bed78
commit 4af859094c
2 changed files with 11 additions and 10 deletions

View file

@ -379,13 +379,14 @@ inline void GLSprite::PutSprite(bool translucent)
void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight)
{
bool smarterclip = false; // Set to true if one condition triggers the test below
if (((thing->player || thing->flags3&MF3_ISMONSTER ||
thing->IsKindOf(RUNTIME_CLASS(AInventory))) && (thing->flags&MF_ICECORPSE ||
!(thing->flags&MF_CORPSE))) || (gl_spriteclip == 3 && (smarterclip = true)) || gl_spriteclip > 1)
const float NO_VAL = 100000000.0f;
bool clipthing = (thing->player || thing->flags3&MF3_ISMONSTER || thing->IsKindOf(RUNTIME_CLASS(AInventory))) && (thing->flags&MF_ICECORPSE || !(thing->flags&MF_CORPSE));
bool smarterclip = !clipthing && gl_spriteclip == 3;
if (clipthing || gl_spriteclip > 1)
{
float btm = 100000000.0f;
float top = -100000000.0f;
float btm = NO_VAL;
float top = -NO_VAL;
extsector_t::xfloor &x = thing->Sector->e->XFloor;
if (x.ffloors.Size())
@ -403,7 +404,7 @@ void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
{
top = ceilingh;
}
if (btm != 100000000.0f && top != -100000000.0f)
if (btm != NO_VAL && top != -NO_VAL)
{
break;
}
@ -418,9 +419,9 @@ void GLSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
top = thing->ceilingz;
}
}
if (btm == 1000000.0f)
if (btm == NO_VAL)
btm = thing->Sector->floorplane.ZatPoint(thing) - thing->Floorclip;
if (top == -1000000.0f)
if (top == NO_VAL)
top = thing->Sector->ceilingplane.ZatPoint(thingpos);
// +/-1 to account for the one pixel empty frame around the sprite.

View file

@ -202,7 +202,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
(r_deathcamera && camera->health <= 0))
return;
P_BobWeapon (player, &player->psprites[ps_weapon], &ofsx, &ofsy);
P_BobWeapon (player, &player->psprites[ps_weapon], &ofsx, &ofsy, r_TicFracF);
// check for fullbright
if (player->fixedcolormap==NOFIXEDCOLORMAP)