This commit is contained in:
Rachael Alexanderson 2017-05-04 02:38:13 -04:00
commit 118976129d
12 changed files with 44 additions and 10 deletions

View file

@ -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 ---

View file

@ -682,6 +682,13 @@ void D_Display ()
// [RH] change the screen mode if needed
if (setmodeneeded)
{
int oldrenderer;
extern int currentrenderer;
EXTERN_CVAR(Int, vid_renderer)
oldrenderer = vid_renderer; // [SP] Save pending vid_renderer setting (hack)
if (currentrenderer != vid_renderer)
vid_renderer = currentrenderer;
// Change screen mode.
if (Video->SetResolution (NewWidth, NewHeight, NewBits))
{
@ -700,6 +707,7 @@ void D_Display ()
// Reset the mouse cursor in case the bit depth changed
vid_cursor.Callback();
}
vid_renderer = oldrenderer; // [SP] Restore pending vid_renderer setting
}
// change the view size if needed

View file

@ -521,7 +521,7 @@ void gl_InitModels()
path = "";
sc.MustGetString();
memset(&smf, 0, sizeof(smf));
smf.modelIDs[1] = smf.modelIDs[2] = smf.modelIDs[3] = -1;
smf.modelIDs[0] = smf.modelIDs[1] = smf.modelIDs[2] = smf.modelIDs[3] = -1;
smf.xscale=smf.yscale=smf.zscale=1.f;
smf.type = PClass::FindClass(sc.String);

View file

@ -800,7 +800,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
sprangle = 0.;
rot = 0;
}
patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror);
patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror, !!(thing->flags7 & MF7_SPRITEFLIP));
}
if (!patch.isValid()) return;
@ -814,6 +814,11 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
if (thing->renderflags & RF_YFLIP) std::swap(vt, vb);
gltexture->GetSpriteRect(&r);
// [SP] SpriteFlip
if (thing->flags7 & MF7_SPRITEFLIP)
thing->renderflags ^= RF_XFLIP;
if (mirror ^ !!(thing->renderflags & RF_XFLIP))
{
r.left = -r.width - r.left; // mirror the sprite's x-offset
@ -826,6 +831,9 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
ur = gltexture->GetSpriteUL();
}
if (thing->flags7 & MF7_SPRITEFLIP) // [SP] Flip back
thing->renderflags ^= RF_XFLIP;
r.Scale(sprscale.X, sprscale.Y);
float rightfac = -r.left;

View file

@ -322,7 +322,6 @@ std::pair<FRenderStyle, float> DPSprite::GetRenderStyle(FRenderStyle ownerstyle,
mystyle.CheckFuzz();
if (Flags & PSPF_RENDERSTYLE)
{
ownerstyle.CheckFuzz();
if (Flags & PSPF_FORCESTYLE)
{
returnstyle = mystyle;
@ -372,6 +371,10 @@ std::pair<FRenderStyle, float> DPSprite::GetRenderStyle(FRenderStyle ownerstyle,
returnalpha = owneralpha * alpha;
}
}
else
{
returnalpha = owneralpha;
}
// Should normal renderstyle come out on top at the end and we desire alpha,
// switch it to translucent. Normal never applies any sort of alpha.
@ -381,7 +384,7 @@ std::pair<FRenderStyle, float> DPSprite::GetRenderStyle(FRenderStyle ownerstyle,
returnalpha = owneralpha * alpha;
}
return{ returnstyle, clamp<float>(float(alpha), 0.f, 1.f) };
return{ returnstyle, clamp<float>(float(returnalpha), 0.f, 1.f) };
}
//---------------------------------------------------------------------------

View file

@ -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;

View file

@ -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;

View file

@ -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),

View file

@ -52,7 +52,7 @@ FModule MPG123Module{"MPG123"};
#elif defined(__APPLE__)
#define MPG123LIB "libmpg123.0.dylib"
#else
#define MPG123LIB "libmpg123.so.1"
#define MPG123LIB "libmpg123.so.0"
#endif
bool IsMPG123Present()

View file

@ -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)

View file

@ -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;

View file

@ -81,7 +81,7 @@ class SVETalismanRed : Inventory
toucher.FindInventory("SVETalismanBlue"))
{
toucher.A_Print("$MSG_TALISMANPOWER");
GiveInventoryType("SVETalismanPowerup");
toucher.GiveInventoryType("SVETalismanPowerup");
}
}
return useok;