FF_VERTICALFLIP, since I've been messing around with sprite stuff.
* flips the sprite ala MFE_VERTICALFLIP except you don't need to flip the direction of gravity for the object just to draw upside down * stacks properly with reverse gravity
This commit is contained in:
parent
54f463ce81
commit
28523760c3
|
@ -7046,6 +7046,7 @@ struct {
|
||||||
|
|
||||||
// Frame settings
|
// Frame settings
|
||||||
{"FF_FRAMEMASK",FF_FRAMEMASK},
|
{"FF_FRAMEMASK",FF_FRAMEMASK},
|
||||||
|
{"FF_VERTICALFLIP",FF_VERTICALFLIP},
|
||||||
{"FF_PAPERSPRITE",FF_PAPERSPRITE},
|
{"FF_PAPERSPRITE",FF_PAPERSPRITE},
|
||||||
{"FF_ANIMATE",FF_ANIMATE},
|
{"FF_ANIMATE",FF_ANIMATE},
|
||||||
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
|
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
|
||||||
|
|
|
@ -5040,6 +5040,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
size_t lumpoff;
|
size_t lumpoff;
|
||||||
unsigned rot;
|
unsigned rot;
|
||||||
UINT8 flip;
|
UINT8 flip;
|
||||||
|
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP));
|
||||||
|
|
||||||
angle_t ang;
|
angle_t ang;
|
||||||
INT32 heightsec, phs;
|
INT32 heightsec, phs;
|
||||||
|
|
||||||
|
@ -5139,7 +5141,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
tx += FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale;
|
tx += FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width) * this_scale;
|
||||||
x2 = gr_windowcenterx + (tx * gr_centerx / tz);
|
x2 = gr_windowcenterx + (tx * gr_centerx / tz);
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (vflip)
|
||||||
{
|
{
|
||||||
gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale;
|
gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale;
|
||||||
gzt = gz + FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale;
|
gzt = gz + FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale;
|
||||||
|
@ -5216,10 +5218,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
//CONS_Debug(DBG_RENDER, "------------------\nH: sprite : %d\nH: frame : %x\nH: type : %d\nH: sname : %s\n\n",
|
//CONS_Debug(DBG_RENDER, "------------------\nH: sprite : %d\nH: frame : %x\nH: type : %d\nH: sname : %s\n\n",
|
||||||
// thing->sprite, thing->frame, thing->type, sprnames[thing->sprite]);
|
// thing->sprite, thing->frame, thing->type, sprnames[thing->sprite]);
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
vis->vflip = vflip;
|
||||||
vis->vflip = true;
|
|
||||||
else
|
|
||||||
vis->vflip = false;
|
|
||||||
|
|
||||||
vis->precip = false;
|
vis->precip = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1230,7 +1230,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
UINT32 durs = spr->mobj->state->tics;
|
UINT32 durs = spr->mobj->state->tics;
|
||||||
UINT32 tics = spr->mobj->tics;
|
UINT32 tics = spr->mobj->tics;
|
||||||
md2_frame_t *curr, *next = NULL;
|
md2_frame_t *curr, *next = NULL;
|
||||||
const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP);
|
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP));
|
||||||
spritedef_t *sprdef;
|
spritedef_t *sprdef;
|
||||||
spriteframe_t *sprframe;
|
spriteframe_t *sprframe;
|
||||||
float finalscale;
|
float finalscale;
|
||||||
|
@ -1345,7 +1345,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
p.x = FIXED_TO_FLOAT(spr->mobj->x);
|
p.x = FIXED_TO_FLOAT(spr->mobj->x);
|
||||||
p.y = FIXED_TO_FLOAT(spr->mobj->y)+md2->offset;
|
p.y = FIXED_TO_FLOAT(spr->mobj->y)+md2->offset;
|
||||||
|
|
||||||
if (spr->mobj->eflags & MFE_VERTICALFLIP)
|
if (flip)
|
||||||
p.z = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height);
|
p.z = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height);
|
||||||
else
|
else
|
||||||
p.z = FIXED_TO_FLOAT(spr->mobj->z);
|
p.z = FIXED_TO_FLOAT(spr->mobj->z);
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
/// \brief Frame flags: only the frame number
|
/// \brief Frame flags: only the frame number
|
||||||
#define FF_FRAMEMASK 0x1ff
|
#define FF_FRAMEMASK 0x1ff
|
||||||
|
/// \brief Frame flags: Flip sprite vertically (relative to what it should be for its gravity)
|
||||||
|
#define FF_VERTICALFLIP 0x400
|
||||||
/// \brief Frame flags: Thin, paper-like sprite (for collision equivalent, see MF_PAPERCOLLISION)
|
/// \brief Frame flags: Thin, paper-like sprite (for collision equivalent, see MF_PAPERCOLLISION)
|
||||||
#define FF_PAPERSPRITE 0x800
|
#define FF_PAPERSPRITE 0x800
|
||||||
/// \brief Frame flags: Simple stateless animation
|
/// \brief Frame flags: Simple stateless animation
|
||||||
|
|
|
@ -1114,6 +1114,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
size_t rot;
|
size_t rot;
|
||||||
UINT8 flip;
|
UINT8 flip;
|
||||||
|
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP));
|
||||||
|
|
||||||
INT32 lindex;
|
INT32 lindex;
|
||||||
|
|
||||||
|
@ -1123,7 +1124,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
fixed_t iscale;
|
fixed_t iscale;
|
||||||
fixed_t scalestep;
|
fixed_t scalestep;
|
||||||
fixed_t offset, offset2;
|
fixed_t offset, offset2;
|
||||||
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
boolean papersprite = !!(thing->frame & FF_PAPERSPRITE);
|
||||||
|
|
||||||
INT32 dispoffset = thing->info->dispoffset;
|
INT32 dispoffset = thing->info->dispoffset;
|
||||||
|
|
||||||
|
@ -1355,7 +1356,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
}
|
}
|
||||||
|
|
||||||
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
//SoM: 3/17/2000: Disregard sprites that are out of view..
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
if (vflip)
|
||||||
{
|
{
|
||||||
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
|
// When vertical flipped, draw sprites from the top down, at least as far as offsets are concerned.
|
||||||
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
|
// sprite height - sprite topoffset is the proper inverse of the vertical offset, of course.
|
||||||
|
@ -1516,10 +1517,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
vis->precip = false;
|
vis->precip = false;
|
||||||
|
|
||||||
if (thing->eflags & MFE_VERTICALFLIP)
|
vis->vflip = vflip;
|
||||||
vis->vflip = true;
|
|
||||||
else
|
|
||||||
vis->vflip = false;
|
|
||||||
|
|
||||||
vis->isScaled = false;
|
vis->isScaled = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue