mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Add support for face sprite Y flipping
This commit is contained in:
parent
809a9d801c
commit
2f4dc17954
1 changed files with 40 additions and 21 deletions
|
@ -359,11 +359,24 @@ void R_DrawVisSprite (vissprite_t *vis)
|
||||||
spryscale = vis->yscale;
|
spryscale = vis->yscale;
|
||||||
sprflipvert = false;
|
sprflipvert = false;
|
||||||
dc_iscale = 0xffffffffu / (unsigned)vis->yscale;
|
dc_iscale = 0xffffffffu / (unsigned)vis->yscale;
|
||||||
dc_texturemid = vis->texturemid;
|
|
||||||
frac = vis->startfrac;
|
frac = vis->startfrac;
|
||||||
xiscale = vis->xiscale;
|
xiscale = vis->xiscale;
|
||||||
|
dc_texturemid = vis->texturemid;
|
||||||
|
|
||||||
|
|
||||||
|
if (vis->renderflags & RF_YFLIP)
|
||||||
|
{
|
||||||
|
sprflipvert = true;
|
||||||
|
spryscale = -spryscale;
|
||||||
|
dc_iscale = -dc_iscale;
|
||||||
|
dc_texturemid -= (vis->pic->GetHeight() << FRACBITS);
|
||||||
|
sprtopscreen = centeryfrac + FixedMul(dc_texturemid, spryscale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprflipvert = false;
|
||||||
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
|
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
|
||||||
|
}
|
||||||
|
|
||||||
dc_x = vis->x1;
|
dc_x = vis->x1;
|
||||||
x2 = vis->x2;
|
x2 = vis->x2;
|
||||||
|
@ -652,8 +665,6 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
FTexture *tex;
|
FTexture *tex;
|
||||||
FVoxelDef *voxel;
|
FVoxelDef *voxel;
|
||||||
|
|
||||||
WORD flip;
|
|
||||||
|
|
||||||
vissprite_t* vis;
|
vissprite_t* vis;
|
||||||
|
|
||||||
fixed_t iscale;
|
fixed_t iscale;
|
||||||
|
@ -681,6 +692,12 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
int spritenum = thing->sprite;
|
int spritenum = thing->sprite;
|
||||||
fixed_t spritescaleX = thing->scaleX;
|
fixed_t spritescaleX = thing->scaleX;
|
||||||
fixed_t spritescaleY = thing->scaleY;
|
fixed_t spritescaleY = thing->scaleY;
|
||||||
|
int renderflags = thing->renderflags;
|
||||||
|
if (spritescaleY < 0)
|
||||||
|
{
|
||||||
|
spritescaleY = -spritescaleY;
|
||||||
|
renderflags ^= RF_YFLIP;
|
||||||
|
}
|
||||||
if (thing->player != NULL)
|
if (thing->player != NULL)
|
||||||
{
|
{
|
||||||
P_CheckPlayerSprite(thing, spritenum, spritescaleX, spritescaleY);
|
P_CheckPlayerSprite(thing, spritenum, spritescaleX, spritescaleY);
|
||||||
|
@ -695,7 +712,6 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
flip = 0;
|
|
||||||
|
|
||||||
if (tex->Rotations != 0xFFFF)
|
if (tex->Rotations != 0xFFFF)
|
||||||
{
|
{
|
||||||
|
@ -712,7 +728,10 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
rot = (ang - thing->angle + (angle_t)(ANGLE_45/2)*9-(angle_t)(ANGLE_180/16)) >> 28;
|
rot = (ang - thing->angle + (angle_t)(ANGLE_45/2)*9-(angle_t)(ANGLE_180/16)) >> 28;
|
||||||
}
|
}
|
||||||
picnum = sprframe->Texture[rot];
|
picnum = sprframe->Texture[rot];
|
||||||
flip = sprframe->Flip & (1 << rot);
|
if (sprframe->Flip & (1 << rot))
|
||||||
|
{
|
||||||
|
renderflags ^= RF_XFLIP;
|
||||||
|
}
|
||||||
tex = TexMan[picnum]; // Do not animate the rotation
|
tex = TexMan[picnum]; // Do not animate the rotation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -748,7 +767,10 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
rot = (ang - thing->angle + (angle_t)(ANGLE_45/2)*9-(angle_t)(ANGLE_180/16)) >> 28;
|
rot = (ang - thing->angle + (angle_t)(ANGLE_45/2)*9-(angle_t)(ANGLE_180/16)) >> 28;
|
||||||
}
|
}
|
||||||
picnum = sprframe->Texture[rot];
|
picnum = sprframe->Texture[rot];
|
||||||
flip = sprframe->Flip & (1 << rot);
|
if (sprframe->Flip & (1 << rot))
|
||||||
|
{
|
||||||
|
renderflags ^= RF_XFLIP;
|
||||||
|
}
|
||||||
tex = TexMan[picnum]; // Do not animate the rotation
|
tex = TexMan[picnum]; // Do not animate the rotation
|
||||||
if (r_drawvoxels)
|
if (r_drawvoxels)
|
||||||
{
|
{
|
||||||
|
@ -759,16 +781,16 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
if (spritescaleX < 0)
|
if (spritescaleX < 0)
|
||||||
{
|
{
|
||||||
spritescaleX = -spritescaleX;
|
spritescaleX = -spritescaleX;
|
||||||
flip = !flip;
|
renderflags ^= RF_XFLIP;
|
||||||
}
|
}
|
||||||
if (voxel == NULL && (tex == NULL || tex->UseType == FTexture::TEX_Null))
|
if (voxel == NULL && (tex == NULL || tex->UseType == FTexture::TEX_Null))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thing->renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
||||||
{
|
{
|
||||||
R_ProjectWallSprite(thing, fx, fy, fz, picnum, spritescaleX, spritescaleY, flip);
|
R_ProjectWallSprite(thing, fx, fy, fz, picnum, spritescaleX, spritescaleY, renderflags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,16 +877,13 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Flip for mirrors and renderflags
|
// [RH] Flip for mirrors
|
||||||
if ((MirrorFlags ^ thing->renderflags) & RF_XFLIP)
|
renderflags ^= MirrorFlags & RF_XFLIP;
|
||||||
{
|
|
||||||
flip = !flip;
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate edges of the shape
|
// calculate edges of the shape
|
||||||
const fixed_t thingxscalemul = DivScale16(spritescaleX, tex->xScale);
|
const fixed_t thingxscalemul = DivScale16(spritescaleX, tex->xScale);
|
||||||
|
|
||||||
tx -= (flip ? (tex->GetWidth() - tex->LeftOffset - 1) : tex->LeftOffset) * thingxscalemul;
|
tx -= ((renderflags & RF_XFLIP) ? (tex->GetWidth() - tex->LeftOffset - 1) : tex->LeftOffset) * thingxscalemul;
|
||||||
x1 = centerx + MulScale32 (tx, xscale);
|
x1 = centerx + MulScale32 (tx, xscale);
|
||||||
|
|
||||||
// off the right side?
|
// off the right side?
|
||||||
|
@ -895,7 +914,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
vis->x2 = x2 > WindowRight ? WindowRight : x2;
|
vis->x2 = x2 > WindowRight ? WindowRight : x2;
|
||||||
vis->angle = thing->angle;
|
vis->angle = thing->angle;
|
||||||
|
|
||||||
if (flip)
|
if (renderflags & RF_XFLIP)
|
||||||
{
|
{
|
||||||
vis->startfrac = (tex->GetWidth() << FRACBITS) - 1;
|
vis->startfrac = (tex->GetWidth() << FRACBITS) - 1;
|
||||||
vis->xiscale = -iscale;
|
vis->xiscale = -iscale;
|
||||||
|
@ -949,7 +968,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
vis->gzt = gzt; // killough 3/27/98
|
vis->gzt = gzt; // killough 3/27/98
|
||||||
vis->deltax = fx - viewx;
|
vis->deltax = fx - viewx;
|
||||||
vis->deltay = fy - viewy;
|
vis->deltay = fy - viewy;
|
||||||
vis->renderflags = thing->renderflags;
|
vis->renderflags = renderflags;
|
||||||
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
||||||
vis->Style.RenderStyle = thing->RenderStyle;
|
vis->Style.RenderStyle = thing->RenderStyle;
|
||||||
vis->FillColor = thing->fillcolor;
|
vis->FillColor = thing->fillcolor;
|
||||||
|
@ -1022,7 +1041,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
{
|
{
|
||||||
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev;
|
||||||
}
|
}
|
||||||
else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||||
{ // full bright
|
{ // full bright
|
||||||
vis->Style.colormap = mybasecolormap->Maps;
|
vis->Style.colormap = mybasecolormap->Maps;
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1054,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t fz, FTextureID picnum, fixed_t xscale, fixed_t yscale, INTBOOL flip)
|
static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t fz, FTextureID picnum, fixed_t xscale, fixed_t yscale, int renderflags)
|
||||||
{
|
{
|
||||||
FWallCoords wallc;
|
FWallCoords wallc;
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
|
@ -1089,7 +1108,7 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f
|
||||||
vis->gzt = gzt;
|
vis->gzt = gzt;
|
||||||
vis->deltax = fx - viewx;
|
vis->deltax = fx - viewx;
|
||||||
vis->deltay = fy - viewy;
|
vis->deltay = fy - viewy;
|
||||||
vis->renderflags = thing->renderflags;
|
vis->renderflags = renderflags;
|
||||||
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
||||||
vis->Style.RenderStyle = thing->RenderStyle;
|
vis->Style.RenderStyle = thing->RenderStyle;
|
||||||
vis->FillColor = thing->fillcolor;
|
vis->FillColor = thing->fillcolor;
|
||||||
|
|
Loading…
Reference in a new issue