mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Added DavidPH's A_FadeTo patch:
A_FadeTo(float target, float amount = 0.10, bool remove = false) Alters transparency towards target by amount. If remove is true, the actor is destroyed if it reaches target. SVN r2305 (trunk)
This commit is contained in:
parent
4e693e1c98
commit
36c4b39688
2 changed files with 55 additions and 6 deletions
|
@ -1810,11 +1810,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn)
|
|||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_FIXED(reduce, 0);
|
||||
|
||||
if (reduce == 0) reduce = FRACUNIT/10;
|
||||
|
||||
if (reduce == 0)
|
||||
{
|
||||
reduce = FRACUNIT/10;
|
||||
}
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
self->alpha += reduce;
|
||||
//if (self->alpha<=0) self->Destroy();
|
||||
// Should this clamp alpha to 1.0?
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1830,11 +1832,57 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut)
|
|||
ACTION_PARAM_FIXED(reduce, 0);
|
||||
ACTION_PARAM_BOOL(remove, 1);
|
||||
|
||||
if (reduce == 0) reduce = FRACUNIT/10;
|
||||
|
||||
if (reduce == 0)
|
||||
{
|
||||
reduce = FRACUNIT/10;
|
||||
}
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
self->alpha -= reduce;
|
||||
if (self->alpha<=0 && remove) self->Destroy();
|
||||
if (self->alpha <= 0 && remove)
|
||||
{
|
||||
self->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_FadeTo
|
||||
//
|
||||
// fades the actor to a specified transparency by a specified amount and
|
||||
// destroys it if so desired
|
||||
//
|
||||
//===========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo)
|
||||
{
|
||||
ACTION_PARAM_START(3);
|
||||
ACTION_PARAM_FIXED(target, 0);
|
||||
ACTION_PARAM_FIXED(amount, 1);
|
||||
ACTION_PARAM_BOOL(remove, 2);
|
||||
|
||||
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
||||
|
||||
if (self->alpha > target)
|
||||
{
|
||||
self->alpha -= amount;
|
||||
|
||||
if (self->alpha < target)
|
||||
{
|
||||
self->alpha = target;
|
||||
}
|
||||
}
|
||||
else if (self->alpha < target)
|
||||
{
|
||||
self->alpha += amount;
|
||||
|
||||
if (self->alpha > target)
|
||||
{
|
||||
self->alpha = target;
|
||||
}
|
||||
}
|
||||
if (self->alpha == target && remove)
|
||||
{
|
||||
self->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -201,6 +201,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SetTranslucent(float alpha, int style = 0);
|
||||
action native A_FadeIn(float reduce = 0.1);
|
||||
action native A_FadeOut(float reduce = 0.1, bool remove = true);
|
||||
action native A_FadeTo(float target, float amount = 0.1, bool remove = false);
|
||||
action native A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1);
|
||||
action native A_CheckSight(state label);
|
||||
action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
|
||||
|
|
Loading…
Reference in a new issue