mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
- Added +SPRITEFLIP which reverses a sprite's left-rightness.
This commit is contained in:
parent
8303d8bbd1
commit
2acb485121
6 changed files with 19 additions and 4 deletions
|
@ -396,6 +396,7 @@ enum ActorFlag7
|
|||
MF7_FORCEZERORADIUSDMG = 0x10000000, // passes zero radius damage on to P_DamageMobj, this is necessary in some cases where DoSpecialDamage gets overrideen.
|
||||
MF7_NOINFIGHTSPECIES = 0x20000000, // don't start infights with one's own species.
|
||||
MF7_FORCEINFIGHTING = 0x40000000, // overrides a map setting of 'no infighting'.
|
||||
MF7_SPRITEFLIP = 0x80000000, // sprite flipped on x-axis
|
||||
};
|
||||
|
||||
// --- mobj.renderflags ---
|
||||
|
|
|
@ -64,7 +64,7 @@ PalEntry OtherGameSkinPalette[256];
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FTextureID spritedef_t::GetSpriteFrame(int frame, int rot, DAngle ang, bool *mirror)
|
||||
FTextureID spritedef_t::GetSpriteFrame(int frame, int rot, DAngle ang, bool *mirror, bool flipagain)
|
||||
{
|
||||
if ((unsigned)frame >= numframes)
|
||||
{
|
||||
|
@ -77,10 +77,18 @@ FTextureID spritedef_t::GetSpriteFrame(int frame, int rot, DAngle ang, bool *mir
|
|||
spriteframe_t *sprframe = &SpriteFrames[spriteframes + frame];
|
||||
if (rot == -1)
|
||||
{
|
||||
if (sprframe->Texture[0] == sprframe->Texture[1])
|
||||
if ((sprframe->Texture[0] == sprframe->Texture[1]) && flipagain)
|
||||
{
|
||||
rot = (360.0 - ang + 45.0 / 2 * 9).BAMs() >> 28;
|
||||
}
|
||||
else if (sprframe->Texture[0] == sprframe->Texture[1])
|
||||
{
|
||||
rot = (ang + 45.0 / 2 * 9).BAMs() >> 28;
|
||||
}
|
||||
else if (flipagain)
|
||||
{
|
||||
rot = (360.0 - ang + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28;
|
||||
}
|
||||
else
|
||||
{
|
||||
rot = (ang + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct spritedef_t
|
|||
uint8_t numframes;
|
||||
uint16_t spriteframes;
|
||||
|
||||
FTextureID GetSpriteFrame(int frame, int rot, DAngle ang, bool *mirror);
|
||||
FTextureID GetSpriteFrame(int frame, int rot, DAngle ang, bool *mirror, bool flipagain = false);
|
||||
};
|
||||
|
||||
extern TArray<spriteframe_t> SpriteFrames;
|
||||
|
|
|
@ -322,6 +322,7 @@ static FFlagDef ActorFlagDefs[]=
|
|||
DEFINE_FLAG(MF7, FORCEZERORADIUSDMG, AActor, flags7),
|
||||
DEFINE_FLAG(MF7, NOINFIGHTSPECIES, AActor, flags7),
|
||||
DEFINE_FLAG(MF7, FORCEINFIGHTING, AActor, flags7),
|
||||
DEFINE_FLAG(MF7, SPRITEFLIP, AActor, flags7),
|
||||
|
||||
// Effect flags
|
||||
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
|
||||
|
|
|
@ -1006,7 +1006,8 @@ namespace swrenderer
|
|||
auto &viewpoint = Thread->Viewport->viewpoint;
|
||||
DAngle sprangle = thing->GetSpriteAngle((sprite.pos - viewpoint.Pos).Angle(), viewpoint.TicFrac);
|
||||
bool flipX;
|
||||
FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX);
|
||||
|
||||
FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX, !!(thing->flags7 & MF7_SPRITEFLIP));
|
||||
if (!tex.isValid()) return false;
|
||||
|
||||
if (flipX)
|
||||
|
|
|
@ -145,6 +145,10 @@ namespace swrenderer
|
|||
// [RH] Flip for mirrors
|
||||
renderflags ^= renderportal->MirrorFlags & RF_XFLIP;
|
||||
|
||||
// [SP] SpriteFlip
|
||||
if (thing->flags7 & MF7_SPRITEFLIP)
|
||||
renderflags ^= RF_XFLIP;
|
||||
|
||||
// calculate edges of the shape
|
||||
const double thingxscalemul = spriteScale.X / tex->Scale.X;
|
||||
|
||||
|
|
Loading…
Reference in a new issue