mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- floatification of some alpha parameters.
This commit is contained in:
parent
a652c061f6
commit
1eb106e2c5
9 changed files with 33 additions and 30 deletions
|
@ -499,8 +499,7 @@ int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis)
|
|||
{
|
||||
if (Mode == NAME_Ghost && !(Owner->flags & MF_SHADOW))
|
||||
{
|
||||
double wp_alpha = MIN<double>(0.25 + Owner->Alpha*0.75, 1.);
|
||||
vis->alpha = FLOAT2FIXED(wp_alpha);
|
||||
vis->Alpha = MIN<float>(0.25f + (float)Owner->Alpha*0.75f, 1.f);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
|
@ -616,7 +615,7 @@ void APowerInvisibility::DoEffect ()
|
|||
Super::DoEffect();
|
||||
// Due to potential interference with other PowerInvisibility items
|
||||
// the effect has to be refreshed each tic.
|
||||
double ts = FIXED2DBL((Strength/100) * (special1 + 1));
|
||||
double ts = (Strength / 100) * (special1 + 1);
|
||||
|
||||
if (ts > 1.) ts = 1.;
|
||||
Owner->Alpha = clamp((1. - ts), 0., 1.);
|
||||
|
@ -698,14 +697,14 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis)
|
|||
if (changed == 0 && EffectTics < 4*32 && !(EffectTics & 8))
|
||||
{
|
||||
vis->RenderStyle = STYLE_Normal;
|
||||
vis->alpha = OPAQUE;
|
||||
vis->Alpha = 1.f;
|
||||
return 1;
|
||||
}
|
||||
else if (changed == 1)
|
||||
{
|
||||
// something else set the weapon sprite back to opaque but this item is still active.
|
||||
fixed_t ts = (Strength/100) * (special1 + 1); if (ts > FRACUNIT) ts = FRACUNIT;
|
||||
vis->alpha = clamp<fixed_t>((OPAQUE - ts), 0, OPAQUE);
|
||||
float ts = float((Strength / 100) * (special1 + 1));
|
||||
vis->Alpha = clamp<>((1.f - ts), 0.f, 1.f);
|
||||
switch (Mode)
|
||||
{
|
||||
case (NAME_Fuzzy):
|
||||
|
@ -735,9 +734,9 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis)
|
|||
}
|
||||
}
|
||||
// Handling of Strife-like cumulative invisibility powerups, the weapon itself shouldn't become invisible
|
||||
if ((vis->alpha < TRANSLUC25 && special1 > 0) || (vis->alpha == 0))
|
||||
if ((vis->Alpha < 0.25f && special1 > 0) || (vis->Alpha == 0))
|
||||
{
|
||||
vis->alpha = clamp<fixed_t>((OPAQUE - (Strength/100)), 0, OPAQUE);
|
||||
vis->Alpha = clamp((1.f - float(Strength/100)), 0.f, 1.f);
|
||||
vis->colormap = SpecialColormaps[INVERSECOLORMAP].Colormap;
|
||||
}
|
||||
return -1; // This item is valid so another one shouldn't reset the translucency
|
||||
|
@ -754,7 +753,7 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis)
|
|||
|
||||
bool APowerInvisibility::HandlePickup (AInventory *item)
|
||||
{
|
||||
if (Mode == NAME_Cumulative && ((Strength * special1) < FRACUNIT) && item->GetClass() == GetClass())
|
||||
if (Mode == NAME_Cumulative && ((Strength * special1) < 1.) && item->GetClass() == GetClass())
|
||||
{
|
||||
APowerup *power = static_cast<APowerup *>(item);
|
||||
if (power->EffectTics == 0)
|
||||
|
@ -1789,7 +1788,7 @@ void APowerRegeneration::DoEffect()
|
|||
Super::DoEffect();
|
||||
if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0)
|
||||
{
|
||||
if (P_GiveBody(Owner, Strength/FRACUNIT))
|
||||
if (P_GiveBody(Owner, int(Strength)))
|
||||
{
|
||||
S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
int EffectTics;
|
||||
PalEntry BlendColor;
|
||||
FNameNoInit Mode;
|
||||
fixed_t Strength;
|
||||
double Strength;
|
||||
|
||||
protected:
|
||||
virtual void InitEffect ();
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
int EffectTics; // Non-0 to override the powerup's default tics
|
||||
PalEntry BlendColor; // Non-0 to override the powerup's default blend
|
||||
FNameNoInit Mode; // Meaning depends on powerup - used for Invulnerability and Invisibility
|
||||
fixed_t Strength; // Meaning depends on powerup - currently used only by Invisibility
|
||||
double Strength; // Meaning depends on powerup - currently used only by Invisibility
|
||||
};
|
||||
|
||||
class APowerInvulnerable : public APowerup
|
||||
|
|
|
@ -1287,7 +1287,7 @@ typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
|||
struct visstyle_t
|
||||
{
|
||||
lighttable_t *colormap;
|
||||
fixed_t alpha;
|
||||
float Alpha;
|
||||
FRenderStyle RenderStyle;
|
||||
};
|
||||
|
||||
|
|
|
@ -269,6 +269,10 @@ enum ESPSResult
|
|||
DoDraw1, // draw this as if r_columnmethod is 1
|
||||
};
|
||||
ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, DWORD color);
|
||||
inline ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translation, DWORD color)
|
||||
{
|
||||
return R_SetPatchStyle(style, FLOAT2FIXED(alpha), translation, color);
|
||||
}
|
||||
|
||||
// Call this after finished drawing the current thing, in case its
|
||||
// style was STYLE_Shade
|
||||
|
|
|
@ -408,7 +408,7 @@ void R_DrawVisSprite (vissprite_t *vis)
|
|||
|
||||
dc_colormap = vis->Style.colormap;
|
||||
|
||||
mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.alpha, vis->Translation, vis->FillColor);
|
||||
mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.Alpha, vis->Translation, vis->FillColor);
|
||||
|
||||
if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Shaded])
|
||||
{ // For shaded sprites, R_SetPatchStyle sets a dc_colormap to an alpha table, but
|
||||
|
@ -564,7 +564,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
dc_x = x1;
|
||||
ESPSResult mode;
|
||||
|
||||
mode = R_SetPatchStyle (spr->Style.RenderStyle, spr->Style.alpha, spr->Translation, spr->FillColor);
|
||||
mode = R_SetPatchStyle (spr->Style.RenderStyle, spr->Style.Alpha, spr->Translation, spr->FillColor);
|
||||
|
||||
// R_SetPatchStyle can modify basecolormap.
|
||||
if (rereadcolormap)
|
||||
|
@ -655,7 +655,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
|||
|
||||
// Do setup for blending.
|
||||
dc_colormap = spr->Style.colormap;
|
||||
mode = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.alpha, spr->Translation, spr->FillColor);
|
||||
mode = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.Alpha, spr->Translation, spr->FillColor);
|
||||
|
||||
if (mode == DontDraw)
|
||||
{
|
||||
|
@ -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 = FLOAT2FIXED(thing->Alpha);
|
||||
vis->Style.Alpha = float(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 = FLOAT2FIXED(thing->Alpha);
|
||||
vis->Style.Alpha = float(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 = FLOAT2FIXED(owner->Alpha);
|
||||
vis->Style.Alpha = float(owner->Alpha);
|
||||
vis->Style.RenderStyle = owner->RenderStyle;
|
||||
|
||||
// The software renderer cannot invert the source without inverting the overlay
|
||||
|
@ -1665,7 +1665,7 @@ void R_DrawRemainingPlayerSprites()
|
|||
DTA_ClipTop, viewwindowy,
|
||||
DTA_ClipRight, viewwindowx + viewwidth,
|
||||
DTA_ClipBottom, viewwindowy + viewheight,
|
||||
DTA_Alpha, vis->Style.alpha,
|
||||
DTA_AlphaF, vis->Style.Alpha,
|
||||
DTA_RenderStyle, vis->Style.RenderStyle,
|
||||
DTA_FillColor, vis->FillColor,
|
||||
DTA_SpecialColormap, special,
|
||||
|
|
|
@ -2258,7 +2258,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, duration, I, Inventory)
|
|||
//==========================================================================
|
||||
DEFINE_CLASS_PROPERTY_PREFIX(powerup, strength, F, Inventory)
|
||||
{
|
||||
fixed_t *pStrength;
|
||||
double *pStrength;
|
||||
|
||||
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
|
||||
{
|
||||
|
@ -2273,7 +2273,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, strength, F, Inventory)
|
|||
I_Error("\"powerup.strength\" requires an actor of type \"Powerup\"\n");
|
||||
return;
|
||||
}
|
||||
PROP_FIXED_PARM(f, 0);
|
||||
PROP_DOUBLE_PARM(f, 0);
|
||||
*pStrength = f;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void STACK_ARGS DCanvas::DrawTextureV(FTexture *img, double x, double y, uint32
|
|||
}
|
||||
|
||||
fixedcolormap = dc_colormap;
|
||||
ESPSResult mode = R_SetPatchStyle (parms.style, parms.alpha, 0, parms.fillcolor);
|
||||
ESPSResult mode = R_SetPatchStyle (parms.style, parms.Alpha, 0, parms.fillcolor);
|
||||
|
||||
BYTE *destorgsave = dc_destorg;
|
||||
dc_destorg = screen->GetBuffer();
|
||||
|
@ -363,7 +363,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
parms->destheight = parms->texheight;
|
||||
parms->top = img->GetScaledTopOffset();
|
||||
parms->left = img->GetScaledLeftOffset();
|
||||
parms->alpha = FRACUNIT;
|
||||
parms->Alpha = 1.f;
|
||||
parms->fillcolor = -1;
|
||||
parms->remap = NULL;
|
||||
parms->translation = NULL;
|
||||
|
@ -531,11 +531,11 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
break;
|
||||
|
||||
case DTA_Alpha:
|
||||
parms->alpha = MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t));
|
||||
parms->Alpha = FIXED2FLOAT(MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t)));
|
||||
break;
|
||||
|
||||
case DTA_AlphaF:
|
||||
parms->alpha = FLOAT2FIXED(MIN<double>(1., va_arg(tags, double)));
|
||||
parms->Alpha = (float)(MIN<double>(1., va_arg(tags, double)));
|
||||
break;
|
||||
|
||||
case DTA_AlphaChannel:
|
||||
|
@ -723,7 +723,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
{
|
||||
parms->style = STYLE_Shaded;
|
||||
}
|
||||
else if (parms->alpha < OPAQUE)
|
||||
else if (parms->Alpha < 1.f)
|
||||
{
|
||||
parms->style = STYLE_TranslucentStencil;
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
|
|||
parms->style = STYLE_Stencil;
|
||||
}
|
||||
}
|
||||
else if (parms->alpha < OPAQUE)
|
||||
else if (parms->Alpha < 1.f)
|
||||
{
|
||||
parms->style = STYLE_Translucent;
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ public:
|
|||
int rclip;
|
||||
double top;
|
||||
double left;
|
||||
fixed_t alpha;
|
||||
float Alpha;
|
||||
uint32 fillcolor;
|
||||
FRemapTable *remap;
|
||||
const BYTE *translation;
|
||||
|
|
|
@ -3535,7 +3535,7 @@ bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &
|
|||
}
|
||||
else
|
||||
{
|
||||
alpha = clamp<fixed_t> (parms.alpha, 0, FRACUNIT) / 65536.f;
|
||||
alpha = clamp(parms.Alpha, 0.f, 1.f);
|
||||
}
|
||||
|
||||
style.CheckFuzz();
|
||||
|
|
Loading…
Reference in a new issue