mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- made AActor::alpha a floating point value
- replaced some uses of FRACUNIT with OPAQUE when it was about translucency. - simplified some overly complicated translucency multiplications in the SBARINFO code.
This commit is contained in:
parent
b29058c1ab
commit
4e60ea0252
50 changed files with 235 additions and 216 deletions
20
src/actor.h
20
src/actor.h
|
@ -415,24 +415,12 @@ enum ActorRenderFlag
|
|||
RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting)
|
||||
};
|
||||
|
||||
#define TRANSLUC25 (FRACUNIT/4)
|
||||
#define TRANSLUC33 (FRACUNIT/3)
|
||||
#define TRANSLUC50 (FRACUNIT/2)
|
||||
#define TRANSLUC66 ((FRACUNIT*2)/3)
|
||||
#define TRANSLUC75 ((FRACUNIT*3)/4)
|
||||
|
||||
// <wingdi.h> also #defines OPAQUE
|
||||
#ifndef OPAQUE
|
||||
#define OPAQUE (FRACUNIT)
|
||||
#endif
|
||||
|
||||
// This translucency value produces the closest match to Heretic's TINTTAB.
|
||||
// ~40% of the value of the overlaid image shows through.
|
||||
#define HR_SHADOW (0x6800)
|
||||
|
||||
const double HR_SHADOW = (0x6800 / 65536.);
|
||||
// Hexen's TINTTAB is the same as Heretic's, just reversed.
|
||||
#define HX_SHADOW (0x9800)
|
||||
#define HX_ALTSHADOW (0x6800)
|
||||
const double HX_SHADOW = (0x9800 / 65536.);
|
||||
const double HX_ALTSHADOW = (0x6800 / 65536.);
|
||||
|
||||
// This could easily be a bool but then it'd be much harder to find later. ;)
|
||||
enum replace_t
|
||||
|
@ -1104,7 +1092,7 @@ public:
|
|||
ActorRenderFlags renderflags; // Different rendering flags
|
||||
FTextureID picnum; // Draw this instead of sprite if valid
|
||||
DWORD effects; // [RH] see p_effect.h
|
||||
fixed_t alpha;
|
||||
double Alpha; // Since P_CheckSight makes an alpha check this can't be a float. It has to be a double.
|
||||
DWORD fillcolor; // Color to draw when STYLE_Shaded
|
||||
|
||||
// interaction info
|
||||
|
|
|
@ -802,7 +802,7 @@ static bool stopped = true;
|
|||
static void AM_calcMinMaxMtoF();
|
||||
|
||||
static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
|
||||
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle);
|
||||
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle);
|
||||
|
||||
void AM_rotatePoint (fixed_t *x, fixed_t *y);
|
||||
void AM_rotate (fixed_t *x, fixed_t *y, angle_t an);
|
||||
|
@ -2716,7 +2716,7 @@ void AM_drawPlayers ()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (p->mo->alpha < OPAQUE)
|
||||
if (p->mo->Alpha < 1.)
|
||||
{
|
||||
color = AMColors[AMColors.AlmostBackgroundColor];
|
||||
}
|
||||
|
@ -2848,7 +2848,7 @@ void AM_drawThings ()
|
|||
const fixed_t spriteYScale = fixed_t(t->Scale.Y * 10 * scale_mtof);
|
||||
|
||||
DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)),
|
||||
spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]);
|
||||
spriteXScale, spriteYScale, t->Translation, 1., 0, LegacyRenderStyles[STYLE_Normal]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2936,7 +2936,7 @@ void AM_drawThings ()
|
|||
//=============================================================================
|
||||
|
||||
static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
|
||||
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle)
|
||||
INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, double alpha, DWORD fillcolor, FRenderStyle renderstyle)
|
||||
{
|
||||
if (tex == NULL || tex->UseType == FTexture::TEX_Null)
|
||||
{
|
||||
|
@ -2955,7 +2955,7 @@ static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust,
|
|||
DTA_ClipRight, f_x + f_w,
|
||||
DTA_FlipX, flip,
|
||||
DTA_Translation, TranslationToTable(translation),
|
||||
DTA_Alpha, alpha,
|
||||
DTA_AlphaF, alpha,
|
||||
DTA_FillColor, fillcolor,
|
||||
DTA_RenderStyle, DWORD(renderstyle),
|
||||
TAG_DONE);
|
||||
|
@ -3043,7 +3043,7 @@ void AM_drawAuthorMarkers ()
|
|||
{
|
||||
DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0,
|
||||
flip, FLOAT2FIXED(mark->Scale.X), FLOAT2FIXED(mark->Scale.Y), mark->Translation,
|
||||
mark->alpha, mark->fillcolor, mark->RenderStyle);
|
||||
mark->Alpha, mark->fillcolor, mark->RenderStyle);
|
||||
}
|
||||
marked = mark->args[0] != 0 ? it.Next() : NULL;
|
||||
}
|
||||
|
|
|
@ -896,7 +896,7 @@ static int PatchThing (int thingy)
|
|||
}
|
||||
else if (linelen == 12 && stricmp (Line1, "Translucency") == 0)
|
||||
{
|
||||
info->alpha = val;
|
||||
info->Alpha = FIXED2DBL(val);
|
||||
info->RenderStyle = STYLE_Translucent;
|
||||
hadTranslucency = true;
|
||||
hadStyle = true;
|
||||
|
@ -923,7 +923,7 @@ static int PatchThing (int thingy)
|
|||
}
|
||||
else if (stricmp (Line1, "Alpha") == 0)
|
||||
{
|
||||
info->alpha = (fixed_t)(atof (Line2) * FRACUNIT);
|
||||
info->Alpha = atof (Line2);
|
||||
hadTranslucency = true;
|
||||
}
|
||||
else if (stricmp (Line1, "Scale") == 0)
|
||||
|
@ -1226,11 +1226,11 @@ static int PatchThing (int thingy)
|
|||
{
|
||||
hadTranslucency = true;
|
||||
if (value[2] & 1)
|
||||
info->alpha = TRANSLUC25;
|
||||
info->Alpha = 0.25;
|
||||
else if (value[2] & 2)
|
||||
info->alpha = TRANSLUC50;
|
||||
info->Alpha = 0.5;
|
||||
else if (value[2] & 4)
|
||||
info->alpha = TRANSLUC75;
|
||||
info->Alpha = 0.75;
|
||||
info->RenderStyle = STYLE_Translucent;
|
||||
}
|
||||
if (value[2] & 8)
|
||||
|
@ -1268,7 +1268,7 @@ static int PatchThing (int thingy)
|
|||
if (!hadStyle)
|
||||
info->RenderStyle = STYLE_OptFuzzy;
|
||||
if (!hadTranslucency)
|
||||
info->alpha = FRACUNIT/5;
|
||||
info->Alpha = 0.5;
|
||||
}
|
||||
else
|
||||
{ // changed from shadow
|
||||
|
@ -1853,7 +1853,7 @@ static int PatchMisc (int dummy)
|
|||
}
|
||||
else if (stricmp (Line1, "Rocket Explosion Alpha") == 0)
|
||||
{
|
||||
deh.ExplosionAlpha = (fixed_t)(atof (Line2) * FRACUNIT);
|
||||
deh.ExplosionAlpha = atof (Line2);
|
||||
}
|
||||
else if (stricmp (Line1, "Monsters Infight") == 0)
|
||||
{
|
||||
|
|
|
@ -359,7 +359,7 @@ struct FMapThing
|
|||
int args[5];
|
||||
int Conversation;
|
||||
double Gravity;
|
||||
fixed_t alpha;
|
||||
double Alpha;
|
||||
DWORD fillcolor;
|
||||
DVector2 Scale;
|
||||
int health;
|
||||
|
|
|
@ -234,7 +234,7 @@ struct DehInfo
|
|||
int KFAAC;
|
||||
char PlayerSprite[5];
|
||||
BYTE ExplosionStyle;
|
||||
fixed_t ExplosionAlpha;
|
||||
double ExplosionAlpha;
|
||||
int NoAutofreeze;
|
||||
int BFGCells;
|
||||
};
|
||||
|
|
|
@ -275,7 +275,7 @@ static void parseSector(FScanner &sc)
|
|||
EDSector sec;
|
||||
|
||||
memset(&sec, 0, sizeof(sec));
|
||||
sec.overlayalpha[sector_t::floor] = sec.overlayalpha[sector_t::ceiling] = FRACUNIT;
|
||||
sec.overlayalpha[sector_t::floor] = sec.overlayalpha[sector_t::ceiling] = OPAQUE;
|
||||
sec.floorterrain = sec.ceilingterrain = -1;
|
||||
|
||||
sc.MustGetStringName("{");
|
||||
|
|
|
@ -115,7 +115,7 @@ void DHUDPicManager::DoDraw (int linenum, int x, int y, int hudheight, float tra
|
|||
{
|
||||
FTexture * tex = TexMan[piclist[i].texturenum];
|
||||
if (tex) screen->DrawTexture(tex, piclist[i].xpos, piclist[i].ypos, DTA_320x200, true,
|
||||
DTA_Alpha, (fixed_t)(translucent*basetrans*FRACUNIT), TAG_DONE);
|
||||
DTA_AlphaF, translucent*basetrans, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1288,7 +1288,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags)
|
|||
p->mo->flags &= ~MF_SHADOW;
|
||||
}
|
||||
p->mo->RenderStyle = p->mo->GetDefault()->RenderStyle;
|
||||
p->mo->alpha = p->mo->GetDefault()->alpha;
|
||||
p->mo->Alpha = p->mo->GetDefault()->Alpha;
|
||||
p->extralight = 0; // cancel gun flashes
|
||||
p->fixedcolormap = NOFIXEDCOLORMAP; // cancel ir goggles
|
||||
p->fixedlightlevel = -1;
|
||||
|
|
|
@ -51,7 +51,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
|
|||
|
||||
self->AddZ(32, false);
|
||||
self->RenderStyle = STYLE_Add;
|
||||
self->alpha = OPAQUE;
|
||||
self->Alpha = 1.;
|
||||
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
|
||||
P_CheckSplash(self, 128);
|
||||
return 0;
|
||||
|
|
|
@ -53,7 +53,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WizAtk2)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
A_FaceTarget (self);
|
||||
self->alpha = HR_SHADOW;
|
||||
self->Alpha = HR_SHADOW;
|
||||
self->RenderStyle = STYLE_Translucent;
|
||||
self->flags3 |= MF3_GHOST;
|
||||
return 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ void A_Unblock(AActor *self, bool drop)
|
|||
// [RH] Andy Baker's stealth monsters
|
||||
if (self->flags & MF_STEALTH)
|
||||
{
|
||||
self->alpha = OPAQUE;
|
||||
self->Alpha = 1.;
|
||||
self->visdir = 0;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
|
|||
// [RH] Andy Baker's stealth monsters
|
||||
if (self->flags & MF_STEALTH)
|
||||
{
|
||||
self->alpha = OPAQUE;
|
||||
self->Alpha = 1;
|
||||
self->visdir = 0;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
|
|||
mo->Vel.Z = (mo->Z() - self->Z()) / self->Height * 4;
|
||||
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
|
||||
mo->RenderStyle = self->RenderStyle;
|
||||
mo->alpha = self->alpha;
|
||||
mo->Alpha = self->Alpha;
|
||||
}
|
||||
}
|
||||
if (self->player)
|
||||
|
@ -326,7 +326,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
|
|||
}
|
||||
head->Angles.Pitch = 0.;
|
||||
head->RenderStyle = self->RenderStyle;
|
||||
head->alpha = self->alpha;
|
||||
head->Alpha = self->Alpha;
|
||||
if (head->player->camera == self)
|
||||
{
|
||||
head->player->camera = head;
|
||||
|
|
|
@ -415,28 +415,28 @@ void APowerInvulnerable::DoEffect ()
|
|||
// Don't mess with the translucency settings if an
|
||||
// invisibility powerup is active.
|
||||
Owner->RenderStyle = STYLE_Translucent;
|
||||
if (!(level.time & 7) && Owner->alpha > 0 && Owner->alpha < OPAQUE)
|
||||
if (!(level.time & 7) && Owner->Alpha > 0 && Owner->Alpha < 1)
|
||||
{
|
||||
if (Owner->alpha == HX_SHADOW)
|
||||
if (Owner->Alpha == HX_SHADOW)
|
||||
{
|
||||
Owner->alpha = HX_ALTSHADOW;
|
||||
Owner->Alpha = HX_ALTSHADOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner->alpha = 0;
|
||||
Owner->Alpha = 0;
|
||||
Owner->flags2 |= MF2_NONSHOOTABLE;
|
||||
}
|
||||
}
|
||||
if (!(level.time & 31))
|
||||
{
|
||||
if (Owner->alpha == 0)
|
||||
if (Owner->Alpha == 0)
|
||||
{
|
||||
Owner->flags2 &= ~MF2_NONSHOOTABLE;
|
||||
Owner->alpha = HX_ALTSHADOW;
|
||||
Owner->Alpha = HX_ALTSHADOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner->alpha = HX_SHADOW;
|
||||
Owner->Alpha = HX_SHADOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ void APowerInvulnerable::EndEffect ()
|
|||
// Don't mess with the translucency settings if an
|
||||
// invisibility powerup is active.
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
}
|
||||
}
|
||||
else if (Mode == NAME_Reflective)
|
||||
|
@ -499,8 +499,8 @@ int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis)
|
|||
{
|
||||
if (Mode == NAME_Ghost && !(Owner->flags & MF_SHADOW))
|
||||
{
|
||||
fixed_t wp_alpha = MIN<fixed_t>(FRACUNIT/4 + Owner->alpha*3/4, FRACUNIT);
|
||||
if (wp_alpha != FIXED_MAX) vis->alpha = wp_alpha;
|
||||
double wp_alpha = MIN<double>(0.25 + Owner->Alpha*0.75, 1.);
|
||||
vis->alpha = FLOAT2FIXED(wp_alpha);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
|
@ -616,8 +616,10 @@ void APowerInvisibility::DoEffect ()
|
|||
Super::DoEffect();
|
||||
// Due to potential interference with other PowerInvisibility items
|
||||
// the effect has to be refreshed each tic.
|
||||
fixed_t ts = (Strength/100) * (special1 + 1); if (ts > FRACUNIT) ts = FRACUNIT;
|
||||
Owner->alpha = clamp<fixed_t>((OPAQUE - ts), 0, OPAQUE);
|
||||
double ts = FIXED2DBL((Strength/100) * (special1 + 1));
|
||||
|
||||
if (ts > 1.) ts = 1.;
|
||||
Owner->Alpha = clamp((1. - ts), 0., 1.);
|
||||
switch (Mode)
|
||||
{
|
||||
case (NAME_Fuzzy):
|
||||
|
@ -645,7 +647,7 @@ void APowerInvisibility::DoEffect ()
|
|||
break;
|
||||
default: // Something's wrong
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -666,7 +668,7 @@ void APowerInvisibility::EndEffect ()
|
|||
Owner->flags5 &= ~(flags5 & INVISIBILITY_FLAGS5);
|
||||
|
||||
Owner->RenderStyle = STYLE_Normal;
|
||||
Owner->alpha = OPAQUE;
|
||||
Owner->Alpha = 1.;
|
||||
|
||||
// Check whether there are other invisibility items and refresh their effect.
|
||||
// If this isn't done there will be one incorrectly drawn frame when this
|
||||
|
@ -1180,14 +1182,14 @@ IMPLEMENT_CLASS (APlayerSpeedTrail)
|
|||
|
||||
void APlayerSpeedTrail::Tick ()
|
||||
{
|
||||
const int fade = OPAQUE*6/10/8;
|
||||
if (alpha <= fade)
|
||||
const double fade = .6 / 8;
|
||||
if (Alpha <= fade)
|
||||
{
|
||||
Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha -= fade;
|
||||
Alpha -= fade;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ IMPLEMENT_CLASS (DImpactDecal)
|
|||
|
||||
DBaseDecal::DBaseDecal ()
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
|
@ -74,7 +74,7 @@ DBaseDecal::DBaseDecal ()
|
|||
|
||||
DBaseDecal::DBaseDecal (fixed_t z)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
|
@ -83,7 +83,7 @@ DBaseDecal::DBaseDecal (fixed_t z)
|
|||
|
||||
DBaseDecal::DBaseDecal (int statnum, fixed_t z)
|
||||
: DThinker(statnum),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(FRACUNIT),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
|
@ -93,7 +93,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
|
|||
DBaseDecal::DBaseDecal (const AActor *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(FLOAT2FIXED(basis->Scale.X)), ScaleY(FLOAT2FIXED(basis->Scale.Y)),
|
||||
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
|
||||
Alpha(FLOAT2FIXED(basis->Alpha)), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
|
||||
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
|
|||
morphed->tid = actor->tid;
|
||||
morphed->Angles.Yaw = actor->Angles.Yaw;
|
||||
morphed->UnmorphedMe = actor;
|
||||
morphed->alpha = actor->alpha;
|
||||
morphed->Alpha = actor->Alpha;
|
||||
morphed->RenderStyle = actor->RenderStyle;
|
||||
morphed->Score = actor->Score;
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
|
|||
{
|
||||
public:
|
||||
SBarInfoMainBlock(SBarInfo *script) : SBarInfoCommandFlowControl(script),
|
||||
alpha(FRACUNIT), currentAlpha(FRACUNIT), forceScaled(false),
|
||||
alpha(OPAQUE), currentAlpha(OPAQUE), forceScaled(false),
|
||||
fullScreenOffsets(false)
|
||||
{
|
||||
SetTruth(true, NULL, NULL);
|
||||
|
@ -309,7 +309,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
|
|||
{
|
||||
this->xOffset = xOffset;
|
||||
this->yOffset = yOffset;
|
||||
this->currentAlpha = fixed_t((((double) this->alpha / (double) FRACUNIT) * ((double) alpha / (double) FRACUNIT)) * FRACUNIT);
|
||||
this->currentAlpha = FixedMul(this->alpha, alpha);
|
||||
SBarInfoCommandFlowControl::Draw(this, statusBar);
|
||||
}
|
||||
bool ForceScaled() const { return forceScaled; }
|
||||
|
@ -334,7 +334,7 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
|
|||
}
|
||||
}
|
||||
sc.MustGetToken(TK_FloatConst);
|
||||
alpha = fixed_t(FRACUNIT * sc.Float);
|
||||
alpha = fixed_t(OPAQUE * sc.Float);
|
||||
}
|
||||
SBarInfoCommandFlowControl::Parse(sc, this->fullScreenOffsets);
|
||||
}
|
||||
|
@ -870,11 +870,11 @@ void Popup::tick()
|
|||
if(moving)
|
||||
{
|
||||
if(opened)
|
||||
alpha = clamp(alpha + speed, 0, FRACUNIT);
|
||||
alpha = clamp<int>(alpha + speed, 0, OPAQUE);
|
||||
else
|
||||
alpha = clamp(alpha - speed2, 0, FRACUNIT);
|
||||
alpha = clamp<int>(alpha - speed2, 0, OPAQUE);
|
||||
}
|
||||
if(alpha == 0 || alpha == FRACUNIT)
|
||||
if(alpha == 0 || alpha == OPAQUE)
|
||||
moving = false;
|
||||
else
|
||||
moving = true;
|
||||
|
@ -912,9 +912,7 @@ int Popup::getYOffset()
|
|||
|
||||
int Popup::getAlpha(int maxAlpha)
|
||||
{
|
||||
double a = (double) alpha / (double) FRACUNIT;
|
||||
double b = (double) maxAlpha / (double) FRACUNIT;
|
||||
return fixed_t((a * b) * FRACUNIT);
|
||||
return FixedMul(alpha, maxAlpha);
|
||||
}
|
||||
|
||||
int Popup::getXDisplacement()
|
||||
|
@ -1458,7 +1456,7 @@ public:
|
|||
}
|
||||
if(drawshadow)
|
||||
{
|
||||
int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT);
|
||||
fixed_t salpha = fixed_t(alpha *HR_SHADOW);
|
||||
double srx = rx + (shadowX*xScale);
|
||||
double sry = ry + (shadowY*yScale);
|
||||
screen->DrawTexture(character, srx, sry,
|
||||
|
|
|
@ -77,7 +77,7 @@ struct Popup
|
|||
bool isDoneMoving();
|
||||
int getXOffset();
|
||||
int getYOffset();
|
||||
int getAlpha(int maxAlpha=FRACUNIT);
|
||||
int getAlpha(int maxAlpha=OPAQUE);
|
||||
int getXDisplacement();
|
||||
int getYDisplacement();
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
translatable(false), type(NORMAL_IMAGE), image(-1), maxwidth(-1),
|
||||
maxheight(-1), spawnScaleX(1.0f), spawnScaleY(1.0f), flags(0),
|
||||
applyscale(false), offset(static_cast<Offset> (TOP|LEFT)),
|
||||
texture(NULL), alpha(FRACUNIT)
|
||||
texture(NULL), alpha(OPAQUE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
int w = maxwidth, h = maxheight;
|
||||
|
||||
// We must calculate this per frame in order to prevent glitches with cl_capfps true.
|
||||
fixed_t frameAlpha = block->Alpha();
|
||||
if(alpha != FRACUNIT)
|
||||
frameAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) alpha / (double) OPAQUE) * FRACUNIT);
|
||||
fixed_t frameAlpha = FixedMul(block->Alpha(), alpha);
|
||||
|
||||
if(flags & DI_DRAWINBOX)
|
||||
{
|
||||
|
@ -236,7 +234,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
|
||||
|
||||
texture = NULL;
|
||||
alpha = FRACUNIT;
|
||||
alpha = OPAQUE;
|
||||
if (applyscale)
|
||||
{
|
||||
spawnScaleX = spawnScaleY = 1.0f;
|
||||
|
@ -284,7 +282,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
if (harmor->Slots[armorType] > 0 && harmor->SlotsIncrement[armorType] > 0)
|
||||
{
|
||||
//combine the alpha values
|
||||
alpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) MIN<fixed_t> (OPAQUE, Scale(harmor->Slots[armorType], OPAQUE, harmor->SlotsIncrement[armorType])) / (double) OPAQUE) * FRACUNIT);
|
||||
alpha = FixedMul(alpha, MIN<fixed_t> (OPAQUE, Scale(harmor->Slots[armorType], OPAQUE, harmor->SlotsIncrement[armorType])));
|
||||
texture = statusBar->Images[image];
|
||||
}
|
||||
else
|
||||
|
@ -1645,7 +1643,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
|
|||
{
|
||||
if(itemflash && itemflashFade)
|
||||
{
|
||||
fixed_t flashAlpha = fixed_t(((double) block->Alpha() / (double) FRACUNIT) * ((double) itemflashFade / (double) OPAQUE) * FRACUNIT);
|
||||
fixed_t flashAlpha = FixedMul(block->Alpha(), itemflashFade);
|
||||
statusBar->DrawGraphic(statusBar->Images[statusBar->invBarOffset + imgCURSOR], imgx-4, imgy+2, block->XOffset(), block->YOffset(), flashAlpha, block->FullScreenOffsets(),
|
||||
translatable, false, offset);
|
||||
}
|
||||
|
@ -2114,7 +2112,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
|||
|
||||
int bgalpha = block->Alpha();
|
||||
if(translucent)
|
||||
bgalpha = fixed_t((((double) block->Alpha() / (double) FRACUNIT) * ((double) HX_SHADOW / (double) FRACUNIT)) * FRACUNIT);
|
||||
bgalpha = fixed_t(block->Alpha() * HX_SHADOW);
|
||||
|
||||
AInventory *item;
|
||||
unsigned int i = 0;
|
||||
|
|
|
@ -767,7 +767,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
|
|||
|
||||
if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) )
|
||||
{
|
||||
int trans = rover==CPlayer->mo->InvSel ? FRACUNIT : 0x6666;
|
||||
int trans = rover==CPlayer->mo->InvSel ? OPAQUE : 0x6666;
|
||||
|
||||
DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans);
|
||||
if (rover->Amount>1)
|
||||
|
@ -934,7 +934,7 @@ static void DrawTime()
|
|||
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
|
||||
const int height = SmallFont->GetHeight();
|
||||
|
||||
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, FRACUNIT);
|
||||
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, OPAQUE);
|
||||
}
|
||||
|
||||
static bool IsAltHUDTextVisible()
|
||||
|
@ -992,7 +992,7 @@ static void DrawLatency()
|
|||
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
|
||||
const int height = SmallFont->GetHeight() * (ST_IsTimeVisible() ? 2 : 1);
|
||||
|
||||
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, FRACUNIT);
|
||||
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, OPAQUE);
|
||||
}
|
||||
|
||||
bool ST_IsLatencyVisible()
|
||||
|
@ -1083,7 +1083,7 @@ void DrawHUD()
|
|||
{
|
||||
seconds = Tics2Seconds(level.totaltime);
|
||||
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
||||
DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT);
|
||||
DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, OPAQUE);
|
||||
bottom -= fonth;
|
||||
}
|
||||
|
||||
|
@ -1093,14 +1093,14 @@ void DrawHUD()
|
|||
{
|
||||
seconds = Tics2Seconds(level.time);
|
||||
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
||||
DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT);
|
||||
DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, OPAQUE);
|
||||
bottom -= fonth;
|
||||
}
|
||||
|
||||
// Single level time for hubs
|
||||
seconds= Tics2Seconds(level.maptime);
|
||||
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
||||
DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT);
|
||||
DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, OPAQUE);
|
||||
}
|
||||
|
||||
ST_FormatMapName(mapname);
|
||||
|
|
|
@ -762,7 +762,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
|
|||
else if (val == 0)
|
||||
{
|
||||
screen->DrawTexture (Images[imgINumbers], x + 1, y + 1,
|
||||
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
||||
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
|
||||
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
||||
screen->DrawTexture (Images[imgINumbers], x, y,
|
||||
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
||||
|
@ -776,7 +776,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
|
|||
while (val != 0)
|
||||
{
|
||||
screen->DrawTexture (Images[imgINumbers + val % 10], x + 1, y + 1,
|
||||
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
||||
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
|
||||
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
||||
x -= w;
|
||||
val /= 10;
|
||||
|
@ -784,7 +784,7 @@ void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center,
|
|||
if (negative)
|
||||
{
|
||||
screen->DrawTexture (Images[imgNEGATIVE], x + 1, y + 1,
|
||||
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
||||
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
|
||||
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
||||
}
|
||||
|
||||
|
@ -839,7 +839,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
|
|||
{
|
||||
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
TAG_DONE);
|
||||
screen->DrawTexture (pic, xpos - pic->GetWidth()/2, y,
|
||||
|
@ -865,7 +865,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
|
|||
{
|
||||
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) con
|
|||
{
|
||||
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
|||
pic = BigFont->GetChar ('0', &v);
|
||||
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
||||
TAG_DONE);
|
||||
|
@ -966,7 +966,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
|||
pic = BigFont->GetChar ('0' + val % 10, &v);
|
||||
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
||||
TAG_DONE);
|
||||
|
@ -980,7 +980,7 @@ void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size)
|
|||
{
|
||||
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
||||
DTA_HUDRules, HUD_Normal,
|
||||
DTA_Alpha, HR_SHADOW,
|
||||
DTA_AlphaF, HR_SHADOW,
|
||||
DTA_FillColor, 0,
|
||||
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
||||
TAG_DONE);
|
||||
|
|
|
@ -95,7 +95,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeShadowyFoe)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
self->RenderStyle = STYLE_Translucent;
|
||||
self->alpha = HR_SHADOW;
|
||||
self->Alpha = HR_SHADOW;
|
||||
self->flags &= ~MF_FRIENDLY;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetShadow)
|
|||
|
||||
self->flags |= MF_STRIFEx8000000|MF_SHADOW;
|
||||
self->RenderStyle = STYLE_Translucent;
|
||||
self->alpha = HR_SHADOW;
|
||||
self->Alpha = HR_SHADOW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearShadow)
|
|||
|
||||
self->flags &= ~(MF_STRIFEx8000000|MF_SHADOW);
|
||||
self->RenderStyle = STYLE_Normal;
|
||||
self->alpha = OPAQUE;
|
||||
self->Alpha = 1.;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ private:
|
|||
screen->DrawTexture (Images[CursorImage],
|
||||
42 + 35*i + ST_X, 12 + ST_Y,
|
||||
DTA_Bottom320x200, Scaled,
|
||||
DTA_Alpha, FRACUNIT - ItemFlash,
|
||||
DTA_Alpha, OPAQUE - ItemFlash,
|
||||
TAG_DONE);
|
||||
}
|
||||
if (item->Icon.isValid())
|
||||
|
|
|
@ -627,7 +627,7 @@ void DIntermissionScreenCast::Drawer ()
|
|||
DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y,
|
||||
DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X,
|
||||
DTA_RenderStyle, mDefaults->RenderStyle,
|
||||
DTA_Alpha, mDefaults->alpha,
|
||||
DTA_AlphaF, mDefaults->Alpha,
|
||||
DTA_Translation, casttranslation,
|
||||
TAG_DONE);
|
||||
}
|
||||
|
|
|
@ -680,12 +680,12 @@ void M_Ticker (void)
|
|||
}
|
||||
if (BackbuttonTime > 0)
|
||||
{
|
||||
if (BackbuttonAlpha < FRACUNIT) BackbuttonAlpha += FRACUNIT/10;
|
||||
if (BackbuttonAlpha < OPAQUE) BackbuttonAlpha += OPAQUE/10;
|
||||
BackbuttonTime--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BackbuttonAlpha > 0) BackbuttonAlpha -= FRACUNIT/10;
|
||||
if (BackbuttonAlpha > 0) BackbuttonAlpha -= OPAQUE/10;
|
||||
if (BackbuttonAlpha < 0) BackbuttonAlpha = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
|
|||
// The engine cannot handle sloped translucent floors. Sorry
|
||||
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b)
|
||||
{
|
||||
ffloor->alpha = FRACUNIT;
|
||||
ffloor->alpha = OPAQUE;
|
||||
ffloor->flags &= ~FF_ADDITIVETRANS;
|
||||
}
|
||||
|
||||
|
|
|
@ -3843,7 +3843,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
|||
break;
|
||||
|
||||
case APROP_Alpha:
|
||||
actor->alpha = value;
|
||||
actor->Alpha = ACSToDouble(value);
|
||||
break;
|
||||
|
||||
case APROP_RenderStyle:
|
||||
|
@ -4039,7 +4039,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
|
|||
case APROP_Damage: return actor->GetMissileDamage(0,1);
|
||||
case APROP_DamageFactor:return actor->DamageFactor;
|
||||
case APROP_DamageMultiplier: return actor->DamageMultiply;
|
||||
case APROP_Alpha: return actor->alpha;
|
||||
case APROP_Alpha: return DoubleToACS(actor->Alpha);
|
||||
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)
|
||||
{ // Check for a legacy render style that matches.
|
||||
if (LegacyRenderStyles[style] == actor->RenderStyle)
|
||||
|
@ -8000,13 +8000,13 @@ scriptwait:
|
|||
switch (type & 0xFF)
|
||||
{
|
||||
default: // normal
|
||||
alpha = (optstart < sp) ? Stack[optstart] : FRACUNIT;
|
||||
alpha = (optstart < sp) ? Stack[optstart] : OPAQUE;
|
||||
msg = new DHUDMessage (activefont, work, x, y, hudwidth, hudheight, color, holdTime);
|
||||
break;
|
||||
case 1: // fade out
|
||||
{
|
||||
float fadeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
|
||||
alpha = (optstart < sp-1) ? Stack[optstart+1] : FRACUNIT;
|
||||
alpha = (optstart < sp-1) ? Stack[optstart+1] : OPAQUE;
|
||||
msg = new DHUDMessageFadeOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
|
||||
}
|
||||
break;
|
||||
|
@ -8022,7 +8022,7 @@ scriptwait:
|
|||
{
|
||||
float inTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
|
||||
float outTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
|
||||
alpha = (optstart < sp-2) ? Stack[optstart+2] : FRACUNIT;
|
||||
alpha = (optstart < sp-2) ? Stack[optstart+2] : OPAQUE;
|
||||
msg = new DHUDMessageFadeInOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -595,11 +595,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
|
|||
{
|
||||
if (walls[i].cstat & 512)
|
||||
{
|
||||
lines[j].Alpha = FRACUNIT/3;
|
||||
lines[j].Alpha = TRANSLUC33;
|
||||
}
|
||||
else
|
||||
{
|
||||
lines[j].Alpha = FRACUNIT*2/3;
|
||||
lines[j].Alpha = TRANSLUC66;
|
||||
}
|
||||
}
|
||||
if (walls[i].cstat & 1)
|
||||
|
@ -707,7 +707,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
|
|||
mapthings[count].special = 0;
|
||||
mapthings[count].Gravity = 1.;
|
||||
mapthings[count].RenderStyle = STYLE_Count;
|
||||
mapthings[count].alpha = -1;
|
||||
mapthings[count].Alpha = -1;
|
||||
mapthings[count].health = -1;
|
||||
mapthings[count].FloatbobPhase = -1;
|
||||
|
||||
|
@ -890,7 +890,7 @@ void ACustomSprite::BeginPlay ()
|
|||
if (cstat & 2)
|
||||
{
|
||||
RenderStyle = STYLE_Translucent;
|
||||
alpha = (cstat & 512) ? TRANSLUC66 : TRANSLUC33;
|
||||
Alpha = (cstat & 512) ? 0.6666 : 0.3333;
|
||||
}
|
||||
if (cstat & 4)
|
||||
renderflags |= RF_XFLIP;
|
||||
|
|
|
@ -989,10 +989,10 @@ public:
|
|||
|
||||
mysnprintf (goldstr, countof(goldstr), "%d", coin != NULL ? coin->Amount : 0);
|
||||
screen->DrawText (SmallFont, CR_GRAY, 21, 191, goldstr, DTA_320x200, true,
|
||||
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
|
||||
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
|
||||
screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon),
|
||||
3, 190, DTA_320x200, true,
|
||||
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
|
||||
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
|
||||
screen->DrawText (SmallFont, CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE);
|
||||
screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon),
|
||||
2, 189, DTA_320x200, true, TAG_DONE);
|
||||
|
|
|
@ -2708,9 +2708,9 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
|
|||
if (corpsehit->Height == 0)
|
||||
{
|
||||
// Make raised corpses look ghostly
|
||||
if (corpsehit->alpha > TRANSLUC50)
|
||||
if (corpsehit->Alpha > 0.5)
|
||||
{
|
||||
corpsehit->alpha /= 2;
|
||||
corpsehit->Alpha /= 2;
|
||||
}
|
||||
// This will only work if the render style is changed as well.
|
||||
if (corpsehit->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||
|
|
|
@ -1024,7 +1024,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
|
|||
// [RH] Andy Baker's Stealth monsters
|
||||
if (target->flags & MF_STEALTH)
|
||||
{
|
||||
target->alpha = OPAQUE;
|
||||
target->Alpha = 1.;
|
||||
target->visdir = -1;
|
||||
}
|
||||
if (target->flags & MF_SKULLFLY)
|
||||
|
|
|
@ -3099,7 +3099,7 @@ FUNC(LS_TranslucentLine)
|
|||
int linenum;
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
lines[linenum].Alpha = Scale(clamp(arg1, 0, 255), FRACUNIT, 255);
|
||||
lines[linenum].Alpha = Scale(clamp(arg1, 0, 255), OPAQUE, 255);
|
||||
if (arg2 == 0)
|
||||
{
|
||||
lines[linenum].flags &= ~ML_ADDTRANS;
|
||||
|
|
|
@ -238,6 +238,8 @@ void AActor::Serialize(FArchive &arc)
|
|||
<< __pos.y
|
||||
<< __pos.z
|
||||
<< Angles.Yaw
|
||||
<< Angles.Pitch
|
||||
<< Angles.Roll
|
||||
<< frame
|
||||
<< Scale
|
||||
<< RenderStyle
|
||||
|
@ -249,10 +251,8 @@ void AActor::Serialize(FArchive &arc)
|
|||
<< LastLookPlayerNumber
|
||||
<< LastLookActor
|
||||
<< effects
|
||||
<< alpha
|
||||
<< Alpha
|
||||
<< fillcolor
|
||||
<< Angles.Pitch // move these up when savegame compatibility is broken!
|
||||
<< Angles.Roll // For now they have to remain here.
|
||||
<< Sector
|
||||
<< floorz
|
||||
<< ceilingz
|
||||
|
@ -1272,7 +1272,7 @@ bool AActor::Grind(bool items)
|
|||
if (gib != NULL)
|
||||
{
|
||||
gib->RenderStyle = RenderStyle;
|
||||
gib->alpha = alpha;
|
||||
gib->Alpha = Alpha;
|
||||
gib->Height = 0;
|
||||
gib->radius = 0;
|
||||
|
||||
|
@ -1469,18 +1469,18 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
|
|||
if (addrocketexplosion)
|
||||
{
|
||||
mo->RenderStyle = STYLE_Add;
|
||||
mo->alpha = FRACUNIT;
|
||||
mo->Alpha = 1.;
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->RenderStyle = STYLE_Translucent;
|
||||
mo->alpha = FRACUNIT*2/3;
|
||||
mo->Alpha = 0.6666;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mo->RenderStyle = ERenderStyle(deh.ExplosionStyle);
|
||||
mo->alpha = deh.ExplosionAlpha;
|
||||
mo->Alpha = deh.ExplosionAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ bool AActor::CanSeek(AActor *target) const
|
|||
if ((flags2 & MF2_DONTSEEKINVISIBLE) &&
|
||||
((target->flags & MF_SHADOW) ||
|
||||
(target->renderflags & RF_INVISIBLE) ||
|
||||
!target->RenderStyle.IsVisible(target->alpha)
|
||||
!target->RenderStyle.IsVisible(target->Alpha)
|
||||
)
|
||||
) return false;
|
||||
return true;
|
||||
|
@ -3500,19 +3500,19 @@ void AActor::Tick ()
|
|||
{
|
||||
if (visdir > 0)
|
||||
{
|
||||
alpha += 0x800;
|
||||
if (alpha >= OPAQUE)
|
||||
Alpha += 1/32.;
|
||||
if (Alpha >= 1.)
|
||||
{
|
||||
alpha = OPAQUE;
|
||||
Alpha = 1.;
|
||||
visdir = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha -= 0x800;
|
||||
if (alpha <= TRANSLUC25)
|
||||
Alpha -= 1/32.;
|
||||
if (Alpha <= 0.25)
|
||||
{
|
||||
alpha = TRANSLUC25;
|
||||
Alpha = 0.25;
|
||||
visdir = 1;
|
||||
}
|
||||
}
|
||||
|
@ -3523,19 +3523,19 @@ void AActor::Tick ()
|
|||
RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
if (visdir > 0)
|
||||
{
|
||||
alpha += 2*FRACUNIT/TICRATE;
|
||||
if (alpha > OPAQUE)
|
||||
Alpha += 2./TICRATE;
|
||||
if (Alpha > 1.)
|
||||
{
|
||||
alpha = OPAQUE;
|
||||
Alpha = 1.;
|
||||
visdir = 0;
|
||||
}
|
||||
}
|
||||
else if (visdir < 0)
|
||||
{
|
||||
alpha -= 3*FRACUNIT/TICRATE/2;
|
||||
if (alpha < 0)
|
||||
Alpha -= 1.5/TICRATE;
|
||||
if (Alpha < 0)
|
||||
{
|
||||
alpha = 0;
|
||||
Alpha = 0;
|
||||
visdir = 0;
|
||||
}
|
||||
}
|
||||
|
@ -4380,7 +4380,7 @@ void AActor::HandleSpawnFlags ()
|
|||
{
|
||||
flags |= MF_SHADOW;
|
||||
RenderStyle = STYLE_Translucent;
|
||||
alpha = TRANSLUC25;
|
||||
Alpha = 0.25;
|
||||
}
|
||||
else if (SpawnFlags & MTF_ALTSHADOW)
|
||||
{
|
||||
|
@ -5174,8 +5174,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
}
|
||||
|
||||
// Set various UDMF options
|
||||
if (mthing->alpha != -1)
|
||||
mobj->alpha = mthing->alpha;
|
||||
if (mthing->Alpha >= 0)
|
||||
mobj->Alpha = mthing->Alpha;
|
||||
if (mthing->RenderStyle != STYLE_Count)
|
||||
mobj->RenderStyle = (ERenderStyle)mthing->RenderStyle;
|
||||
if (mthing->Scale.X != 0)
|
||||
|
@ -6691,7 +6691,7 @@ void PrintMiscActorInfo(AActor *query)
|
|||
if (query->BounceFlags & 1<<flagi) Printf(" %s", flagnamesb[flagi]);*/
|
||||
Printf("\nRender style = %i:%s, alpha %f\nRender flags: %x",
|
||||
querystyle, (querystyle < STYLE_Count ? renderstyles[querystyle] : "Unknown"),
|
||||
FIXED2DBL(query->alpha), query->renderflags.GetValue());
|
||||
query->Alpha, query->renderflags.GetValue());
|
||||
/*for (flagi = 0; flagi < 31; flagi++)
|
||||
if (query->renderflags & 1<<flagi) Printf(" %s", flagnamesr[flagi]);*/
|
||||
Printf("\nSpecial+args: %s(%i, %i, %i, %i, %i)\nspecial1: %i, special2: %i.",
|
||||
|
|
|
@ -1527,8 +1527,8 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
|||
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
|
||||
ss->prevsec = -1; // stair retriggering until build completes
|
||||
|
||||
ss->SetAlpha(sector_t::floor, FRACUNIT);
|
||||
ss->SetAlpha(sector_t::ceiling, FRACUNIT);
|
||||
ss->SetAlpha(sector_t::floor, OPAQUE);
|
||||
ss->SetAlpha(sector_t::ceiling, OPAQUE);
|
||||
ss->SetXScale(sector_t::floor, FRACUNIT); // [RH] floor and ceiling scaling
|
||||
ss->SetYScale(sector_t::floor, FRACUNIT);
|
||||
ss->SetXScale(sector_t::ceiling, FRACUNIT);
|
||||
|
@ -1760,7 +1760,7 @@ void P_LoadThings (MapData * map)
|
|||
mti[i].SkillFilter = MakeSkill(flags);
|
||||
mti[i].ClassFilter = 0xffff; // Doom map format doesn't have class flags so spawn for all player classes
|
||||
mti[i].RenderStyle = STYLE_Count;
|
||||
mti[i].alpha = -1;
|
||||
mti[i].Alpha = -1;
|
||||
mti[i].health = 1;
|
||||
mti[i].FloatbobPhase = -1;
|
||||
|
||||
|
@ -1856,7 +1856,7 @@ void P_LoadThings2 (MapData * map)
|
|||
|
||||
mti[i].Gravity = 1;
|
||||
mti[i].RenderStyle = STYLE_Count;
|
||||
mti[i].alpha = -1;
|
||||
mti[i].Alpha = -1;
|
||||
mti[i].health = 1;
|
||||
mti[i].FloatbobPhase = -1;
|
||||
}
|
||||
|
@ -2055,7 +2055,7 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
additive = true;
|
||||
}
|
||||
|
||||
alpha = Scale(alpha, FRACUNIT, 255);
|
||||
alpha = Scale(alpha, OPAQUE, 255);
|
||||
if (!ld->args[0])
|
||||
{
|
||||
ld->Alpha = alpha;
|
||||
|
@ -2172,7 +2172,7 @@ void P_LoadLineDefs (MapData * map)
|
|||
ld = lines;
|
||||
for (i = 0; i < numlines; i++, mld++, ld++)
|
||||
{
|
||||
ld->Alpha = FRACUNIT; // [RH] Opaque by default
|
||||
ld->Alpha = OPAQUE; // [RH] Opaque by default
|
||||
ld->portalindex = UINT_MAX;
|
||||
|
||||
// [RH] Translate old linedef special and flags to be
|
||||
|
@ -2276,7 +2276,7 @@ void P_LoadLineDefs2 (MapData * map)
|
|||
|
||||
ld->v1 = &vertexes[LittleShort(mld->v1)];
|
||||
ld->v2 = &vertexes[LittleShort(mld->v2)];
|
||||
ld->Alpha = FRACUNIT; // [RH] Opaque by default
|
||||
ld->Alpha = OPAQUE; // [RH] Opaque by default
|
||||
|
||||
P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0]));
|
||||
P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1]));
|
||||
|
|
|
@ -849,7 +849,7 @@ sightcounts[0]++;
|
|||
//
|
||||
// [RH] Andy Baker's stealth monsters:
|
||||
// Cannot see an invisible object
|
||||
if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
|
||||
if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->Alpha)))
|
||||
{ // small chance of an attack being made anyway
|
||||
if ((bglobal.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
|
||||
{
|
||||
|
|
|
@ -473,7 +473,7 @@ public:
|
|||
memset(th, 0, sizeof(*th));
|
||||
th->Gravity = 1;
|
||||
th->RenderStyle = STYLE_Count;
|
||||
th->alpha = -1;
|
||||
th->Alpha = -1;
|
||||
th->health = 1;
|
||||
th->FloatbobPhase = -1;
|
||||
sc.MustGetToken('{');
|
||||
|
@ -694,7 +694,7 @@ public:
|
|||
break;
|
||||
|
||||
case NAME_Alpha:
|
||||
th->alpha = CheckFixed(key);
|
||||
th->Alpha = CheckFloat(key);
|
||||
break;
|
||||
|
||||
case NAME_FillColor:
|
||||
|
@ -790,7 +790,7 @@ public:
|
|||
FString tagstring;
|
||||
|
||||
memset(ld, 0, sizeof(*ld));
|
||||
ld->Alpha = FRACUNIT;
|
||||
ld->Alpha = OPAQUE;
|
||||
ld->portalindex = UINT_MAX;
|
||||
ld->sidedef[0] = ld->sidedef[1] = NULL;
|
||||
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
|
||||
|
@ -1092,13 +1092,13 @@ public:
|
|||
{
|
||||
ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough;
|
||||
}
|
||||
if (strifetrans && ld->Alpha == FRACUNIT)
|
||||
if (strifetrans && ld->Alpha == OPAQUE)
|
||||
{
|
||||
ld->Alpha = FRACUNIT * 3/4;
|
||||
ld->Alpha = TRANSLUC75;
|
||||
}
|
||||
if (strifetrans2 && ld->Alpha == FRACUNIT)
|
||||
{
|
||||
ld->Alpha = FRACUNIT * 1/4;
|
||||
ld->Alpha = TRANSLUC25;
|
||||
}
|
||||
if (ld->sidedef[0] == NULL)
|
||||
{
|
||||
|
@ -1292,8 +1292,8 @@ public:
|
|||
sec->SetYScale(sector_t::floor, FRACUNIT);
|
||||
sec->SetXScale(sector_t::ceiling, FRACUNIT);
|
||||
sec->SetYScale(sector_t::ceiling, FRACUNIT);
|
||||
sec->SetAlpha(sector_t::floor, FRACUNIT);
|
||||
sec->SetAlpha(sector_t::ceiling, FRACUNIT);
|
||||
sec->SetAlpha(sector_t::floor, OPAQUE);
|
||||
sec->SetAlpha(sector_t::ceiling, OPAQUE);
|
||||
sec->thinglist = NULL;
|
||||
sec->touching_thinglist = NULL; // phares 3/14/98
|
||||
sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
|
||||
|
|
|
@ -87,10 +87,10 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid)
|
|||
passthrough = true;
|
||||
break;
|
||||
case -2:
|
||||
ld->Alpha = FRACUNIT*3/4;
|
||||
ld->Alpha = TRANSLUC75;
|
||||
break;
|
||||
case -3:
|
||||
ld->Alpha = FRACUNIT / 4;
|
||||
ld->Alpha = TRANSLUC25;
|
||||
break;
|
||||
default:
|
||||
newflags |= LineFlagTranslations[i].newvalue;
|
||||
|
|
|
@ -1176,7 +1176,7 @@ void R_Subsector (subsector_t *sub)
|
|||
if (!(fakeFloor->flags & FF_RENDERPLANES)) continue;
|
||||
if (fakeFloor->alpha == 0) continue;
|
||||
if (fakeFloor->flags & FF_THISINSIDE && fakeFloor->flags & FF_INVERTSECTOR) continue;
|
||||
fakeAlpha = MIN(Scale(fakeFloor->alpha, OPAQUE, 255), OPAQUE);
|
||||
fakeAlpha = MIN<fixed_t>(Scale(fakeFloor->alpha, OPAQUE, 255), OPAQUE);
|
||||
if (fakeFloor->validcount != validcount)
|
||||
{
|
||||
fakeFloor->validcount = validcount;
|
||||
|
@ -1237,7 +1237,7 @@ void R_Subsector (subsector_t *sub)
|
|||
if (!(fakeFloor->flags & FF_RENDERPLANES)) continue;
|
||||
if (fakeFloor->alpha == 0) continue;
|
||||
if (!(fakeFloor->flags & FF_THISINSIDE) && (fakeFloor->flags & (FF_SWIMMABLE|FF_INVERTSECTOR)) == (FF_SWIMMABLE|FF_INVERTSECTOR)) continue;
|
||||
fakeAlpha = MIN(Scale(fakeFloor->alpha, OPAQUE, 255), OPAQUE);
|
||||
fakeAlpha = MIN<fixed_t>(Scale(fakeFloor->alpha, OPAQUE, 255), OPAQUE);
|
||||
|
||||
if (fakeFloor->validcount != validcount)
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ FArchive &operator<< (FArchive &arc, FRenderStyle &style)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
|
||||
bool FRenderStyle::IsVisible(double alpha) const throw()
|
||||
{
|
||||
if (BlendOp == STYLEOP_None)
|
||||
{
|
||||
|
@ -124,13 +124,13 @@ bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
|
|||
{
|
||||
if (Flags & STYLEF_Alpha1)
|
||||
{
|
||||
alpha = FRACUNIT;
|
||||
alpha = 1.;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp(alpha, 0, FRACUNIT);
|
||||
alpha = clamp(alpha, 0., 1.);
|
||||
}
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
|
||||
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != OPAQUE;
|
||||
}
|
||||
// Treat anything else as visible.
|
||||
return true;
|
||||
|
@ -192,10 +192,23 @@ fixed_t GetAlpha(int type, fixed_t alpha)
|
|||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return FRACUNIT;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return alpha;
|
||||
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
|
||||
case STYLEALPHA_InvSrc: return OPAQUE - alpha;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fixed_t GetAlpha(int type, double alpha)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STYLEALPHA_Zero: return 0;
|
||||
case STYLEALPHA_One: return OPAQUE;
|
||||
case STYLEALPHA_Src: return FLOAT2FIXED(alpha);
|
||||
case STYLEALPHA_InvSrc: return FLOAT2FIXED(1. - alpha);
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,20 @@
|
|||
**
|
||||
*/
|
||||
|
||||
// <wingdi.h> also #defines OPAQUE
|
||||
#ifdef OPAQUE
|
||||
#undef OPAQUE
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
OPAQUE = 65536,
|
||||
TRANSLUC25 = (OPAQUE / 4),
|
||||
TRANSLUC33 = (OPAQUE / 3),
|
||||
TRANSLUC66 = ((OPAQUE * 2) / 3),
|
||||
TRANSLUC75 = ((OPAQUE * 3) / 4),
|
||||
};
|
||||
|
||||
// Legacy render styles
|
||||
enum ERenderStyle
|
||||
{
|
||||
|
@ -127,7 +141,7 @@ union FRenderStyle
|
|||
operator uint32() const { return AsDWORD; }
|
||||
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
|
||||
void CheckFuzz();
|
||||
bool IsVisible(fixed_t alpha) const throw();
|
||||
bool IsVisible(double alpha) const throw();
|
||||
private:
|
||||
// Code that compares an actor's render style with a legacy render
|
||||
// style value should be updated. Making these conversion operators
|
||||
|
@ -152,5 +166,6 @@ class FArchive;
|
|||
|
||||
FArchive &operator<< (FArchive &arc, FRenderStyle &style);
|
||||
fixed_t GetAlpha(int type, fixed_t alpha);
|
||||
fixed_t GetAlpha(int type, double alpha);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2359,13 +2359,13 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
|
|||
if (style.BlendOp == STYLEOP_Shadow)
|
||||
{
|
||||
style = LegacyRenderStyles[STYLE_TranslucentStencil];
|
||||
alpha = FRACUNIT*3/10;
|
||||
alpha = TRANSLUC33;
|
||||
color = 0;
|
||||
}
|
||||
|
||||
if (style.Flags & STYLEF_TransSoulsAlpha)
|
||||
{
|
||||
alpha = fixed_t(transsouls * FRACUNIT);
|
||||
alpha = fixed_t(transsouls * OPAQUE);
|
||||
}
|
||||
else if (style.Flags & STYLEF_Alpha1)
|
||||
{
|
||||
|
@ -2373,7 +2373,7 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
|
|||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp<fixed_t> (alpha, 0, FRACUNIT);
|
||||
alpha = clamp<fixed_t> (alpha, 0, OPAQUE);
|
||||
}
|
||||
|
||||
dc_translation = NULL;
|
||||
|
|
|
@ -625,7 +625,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
|
|||
if (fake3D & (FAKE3D_FAKEFLOOR|FAKE3D_FAKECEILING)) sky = 0x80000000 | fakeAlpha;
|
||||
else sky = 0; // not skyflatnum so it can't be a sky
|
||||
skybox = NULL;
|
||||
alpha = FRACUNIT;
|
||||
alpha = OPAQUE;
|
||||
}
|
||||
|
||||
// New visplane algorithm uses hash table -- killough
|
||||
|
|
|
@ -243,7 +243,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|||
ESPSResult drawmode;
|
||||
|
||||
drawmode = R_SetPatchStyle (LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
|
||||
MIN(curline->linedef->Alpha, FRACUNIT), 0, 0);
|
||||
MIN<fixed_t>(curline->linedef->Alpha, OPAQUE), 0, 0);
|
||||
|
||||
if ((drawmode == DontDraw && !ds->bFogBoundary && !ds->bFakeBoundary))
|
||||
{
|
||||
|
|
|
@ -755,7 +755,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
// Don't waste time projecting sprites that are definitely not visible.
|
||||
if (thing == NULL ||
|
||||
(thing->renderflags & RF_INVISIBLE) ||
|
||||
!thing->RenderStyle.IsVisible(thing->alpha) ||
|
||||
!thing->RenderStyle.IsVisible(thing->Alpha) ||
|
||||
!thing->IsVisibleToPlayer())
|
||||
{
|
||||
return;
|
||||
|
@ -1063,7 +1063,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
vis->FillColor = thing->fillcolor;
|
||||
vis->Translation = thing->Translation; // [RH] thing translation table
|
||||
vis->FakeFlatStat = fakeside;
|
||||
vis->Style.alpha = thing->alpha;
|
||||
vis->Style.alpha = FLOAT2FIXED(thing->Alpha);
|
||||
vis->fakefloor = fakefloor;
|
||||
vis->fakeceiling = fakeceiling;
|
||||
vis->ColormapNum = 0;
|
||||
|
@ -1204,7 +1204,7 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f
|
|||
vis->FillColor = thing->fillcolor;
|
||||
vis->Translation = thing->Translation;
|
||||
vis->FakeFlatStat = 0;
|
||||
vis->Style.alpha = thing->alpha;
|
||||
vis->Style.alpha = FLOAT2FIXED(thing->Alpha);
|
||||
vis->fakefloor = NULL;
|
||||
vis->fakeceiling = NULL;
|
||||
vis->ColormapNum = 0;
|
||||
|
@ -1388,7 +1388,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
|
|||
noaccel = false;
|
||||
if (pspnum <= ps_flash)
|
||||
{
|
||||
vis->Style.alpha = owner->alpha;
|
||||
vis->Style.alpha = FLOAT2FIXED(owner->Alpha);
|
||||
vis->Style.RenderStyle = owner->RenderStyle;
|
||||
|
||||
// The software renderer cannot invert the source without inverting the overlay
|
||||
|
|
|
@ -593,7 +593,7 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
|
|||
|
||||
memset (&info, 0, sizeof(info));
|
||||
info.alpha = Parts[i].Alpha;
|
||||
info.invalpha = FRACUNIT - info.alpha;
|
||||
info.invalpha = OPAQUE - info.alpha;
|
||||
info.op = ECopyOp(Parts[i].op);
|
||||
PalEntry b = Parts[i].Blend;
|
||||
if (b.a == 0 && b != BLEND_NONE)
|
||||
|
@ -1165,7 +1165,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i
|
|||
else if (sc.Compare("alpha"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
part.Alpha = clamp(FLOAT2FIXED(sc.Float), 0, FRACUNIT);
|
||||
part.Alpha = clamp<fixed_t>(FLOAT2FIXED(sc.Float), 0, OPAQUE);
|
||||
// bComplex is not set because it is only needed when the style is not OP_COPY.
|
||||
}
|
||||
else if (sc.Compare("style"))
|
||||
|
|
|
@ -440,7 +440,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
|
|||
else if (sc.Compare ("Alpha"))
|
||||
{
|
||||
sc.MustGetFloat ();
|
||||
defaults->alpha = int(clamp (sc.Float, 0.0, 1.0) * OPAQUE);
|
||||
defaults->Alpha = clamp (sc.Float, 0.0, 1.0);
|
||||
}
|
||||
else if (sc.Compare ("Scale"))
|
||||
{
|
||||
|
|
|
@ -2334,7 +2334,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
|||
}
|
||||
if (flags & SIXF_TRANSFERALPHA)
|
||||
{
|
||||
mo->alpha = self->alpha;
|
||||
mo->Alpha = self->Alpha;
|
||||
}
|
||||
if (flags & SIXF_TRANSFERRENDERSTYLE)
|
||||
{
|
||||
|
@ -2739,13 +2739,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt)
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_FIXED (alpha);
|
||||
PARAM_FLOAT (alpha);
|
||||
PARAM_INT_OPT (mode) { mode = 0; }
|
||||
|
||||
mode = mode == 0 ? STYLE_Translucent : mode == 2 ? STYLE_Fuzzy : STYLE_Add;
|
||||
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
self->alpha = clamp<fixed_t>(alpha, 0, FRACUNIT);
|
||||
self->Alpha = clamp(alpha, 0., 1.);
|
||||
self->RenderStyle = ERenderStyle(mode);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2767,21 +2767,21 @@ enum FadeFlags
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_FIXED_OPT(reduce) { reduce = FRACUNIT/10; }
|
||||
PARAM_FLOAT_OPT(reduce) { reduce = 0.1; }
|
||||
PARAM_INT_OPT(flags) { flags = 0; }
|
||||
|
||||
if (reduce == 0)
|
||||
{
|
||||
reduce = FRACUNIT / 10;
|
||||
reduce = 0.1;
|
||||
}
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
self->alpha += reduce;
|
||||
self->Alpha += reduce;
|
||||
|
||||
if (self->alpha >= FRACUNIT)
|
||||
if (self->Alpha >= 1.)
|
||||
{
|
||||
if (flags & FTF_CLAMP)
|
||||
{
|
||||
self->alpha = FRACUNIT;
|
||||
self->Alpha = 1.;
|
||||
}
|
||||
if (flags & FTF_REMOVE)
|
||||
{
|
||||
|
@ -2801,20 +2801,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn)
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_FIXED_OPT(reduce) { reduce = FRACUNIT/10; }
|
||||
PARAM_FLOAT_OPT(reduce) { reduce = 0.1; }
|
||||
PARAM_INT_OPT(flags) { flags = FTF_REMOVE; }
|
||||
|
||||
if (reduce == 0)
|
||||
{
|
||||
reduce = FRACUNIT/10;
|
||||
reduce = 0.1;
|
||||
}
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
self->alpha -= reduce;
|
||||
if (self->alpha <= 0)
|
||||
self->Alpha -= reduce;
|
||||
if (self->Alpha <= 0)
|
||||
{
|
||||
if (flags & FTF_CLAMP)
|
||||
{
|
||||
self->alpha = 0;
|
||||
self->Alpha = 0;
|
||||
}
|
||||
if (flags & FTF_REMOVE)
|
||||
{
|
||||
|
@ -2835,35 +2835,35 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut)
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_FIXED (target);
|
||||
PARAM_FIXED_OPT (amount) { amount = fixed_t(0.1*FRACUNIT); }
|
||||
PARAM_FLOAT (target);
|
||||
PARAM_FLOAT_OPT (amount) { amount = 0.1; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
|
||||
if (self->alpha > target)
|
||||
if (self->Alpha > target)
|
||||
{
|
||||
self->alpha -= amount;
|
||||
self->Alpha -= amount;
|
||||
|
||||
if (self->alpha < target)
|
||||
if (self->Alpha < target)
|
||||
{
|
||||
self->alpha = target;
|
||||
self->Alpha = target;
|
||||
}
|
||||
}
|
||||
else if (self->alpha < target)
|
||||
else if (self->Alpha < target)
|
||||
{
|
||||
self->alpha += amount;
|
||||
self->Alpha += amount;
|
||||
|
||||
if (self->alpha > target)
|
||||
if (self->Alpha > target)
|
||||
{
|
||||
self->alpha = target;
|
||||
self->Alpha = target;
|
||||
}
|
||||
}
|
||||
if (flags & FTF_CLAMP)
|
||||
{
|
||||
self->alpha = clamp(self->alpha, 0, FRACUNIT);
|
||||
self->Alpha = clamp(self->Alpha, 0., 1.);
|
||||
}
|
||||
if (self->alpha == target && (flags & FTF_REMOVE))
|
||||
if (self->Alpha == target && (flags & FTF_REMOVE))
|
||||
{
|
||||
P_RemoveThing(self);
|
||||
}
|
||||
|
@ -3334,7 +3334,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
|
|||
mo->Vel.X = pr_burst.Random2() / 128.;
|
||||
mo->Vel.Y = pr_burst.Random2() / 128.;
|
||||
mo->RenderStyle = self->RenderStyle;
|
||||
mo->alpha = self->alpha;
|
||||
mo->Alpha = self->Alpha;
|
||||
mo->CopyFriendliness(self, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,7 +619,7 @@ void InitThingdef()
|
|||
// Define some member variables we feel like exposing to the user
|
||||
PSymbolTable &symt = RUNTIME_CLASS(AActor)->Symbols;
|
||||
PType *array5 = NewArray(TypeSInt32, 5);
|
||||
symt.AddSymbol(new PField(NAME_Alpha, TypeFixed, VARF_Native, myoffsetof(AActor,alpha)));
|
||||
symt.AddSymbol(new PField(NAME_Alpha, TypeFloat64, VARF_Native, myoffsetof(AActor,Alpha)));
|
||||
symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw)));
|
||||
symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args)));
|
||||
symt.AddSymbol(new PField(NAME_CeilingZ, TypeFloat64, VARF_Native, myoffsetof(AActor,ceilingz)));
|
||||
|
|
|
@ -850,7 +850,7 @@ DEFINE_PROPERTY(renderstyle, S, Actor)
|
|||
//==========================================================================
|
||||
DEFINE_PROPERTY(defaultalpha, 0, Actor)
|
||||
{
|
||||
defaults->alpha = gameinfo.gametype == GAME_Heretic ? HR_SHADOW : HX_SHADOW;
|
||||
defaults->Alpha = gameinfo.gametype == GAME_Heretic ? HR_SHADOW : HX_SHADOW;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -858,8 +858,8 @@ DEFINE_PROPERTY(defaultalpha, 0, Actor)
|
|||
//==========================================================================
|
||||
DEFINE_PROPERTY(alpha, F, Actor)
|
||||
{
|
||||
PROP_FIXED_PARM(id, 0);
|
||||
defaults->alpha = id;
|
||||
PROP_DOUBLE_PARM(id, 0);
|
||||
defaults->Alpha = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -531,7 +531,11 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
break;
|
||||
|
||||
case DTA_Alpha:
|
||||
parms->alpha = MIN<fixed_t>(FRACUNIT, va_arg (tags, fixed_t));
|
||||
parms->alpha = MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t));
|
||||
break;
|
||||
|
||||
case DTA_AlphaF:
|
||||
parms->alpha = FLOAT2FIXED(MIN<double>(1., va_arg(tags, double)));
|
||||
break;
|
||||
|
||||
case DTA_AlphaChannel:
|
||||
|
@ -640,7 +644,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
break;
|
||||
|
||||
case DTA_ShadowAlpha:
|
||||
parms->shadowAlpha = MIN<fixed_t>(FRACUNIT, va_arg (tags, fixed_t));
|
||||
parms->shadowAlpha = MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t));
|
||||
break;
|
||||
|
||||
case DTA_ShadowColor:
|
||||
|
@ -719,7 +723,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
{
|
||||
parms->style = STYLE_Shaded;
|
||||
}
|
||||
else if (parms->alpha < FRACUNIT)
|
||||
else if (parms->alpha < OPAQUE)
|
||||
{
|
||||
parms->style = STYLE_TranslucentStencil;
|
||||
}
|
||||
|
@ -728,7 +732,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
parms->style = STYLE_Stencil;
|
||||
}
|
||||
}
|
||||
else if (parms->alpha < FRACUNIT)
|
||||
else if (parms->alpha < OPAQUE)
|
||||
{
|
||||
parms->style = STYLE_Translucent;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ enum
|
|||
DTA_DestWidth, // width of area to draw to
|
||||
DTA_DestHeight, // height of area to draw to
|
||||
DTA_Alpha, // alpha value for translucency
|
||||
DTA_AlphaF, // alpha value for translucency
|
||||
DTA_FillColor, // color to stencil onto the destination (RGB is the color for truecolor drawers, A is the palette index for paletted drawers)
|
||||
DTA_Translation, // translation table to recolor the source
|
||||
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
||||
|
|
Loading…
Reference in a new issue