- Added ACS support for setting HUD messages alpha levels. This is an additional optional

parameter added to the end of the HudMessage command's existing parameter lists. So for
  HUDMSG_PLAIN, it comes after the hold time. For HUDMSG_FADEOUT and HUDMSG_TYPEONE, it comes
  after the fade time. And for HUDMSG_FADEINOUT, it comes after the out time.
  - Alpha is a fixed point number between 0.0 and 1.0.
  - Example:
    Without alpha (unchanged from before):
      HudMessage(s:"Some text", HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 0.5, 0.5, 3.0);
    With alpha (alpha is added to the end):
      HudMessage(s:"Some text", HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 0.5, 0.5, 3.0, 0.5 /* this is the alpha */);

SVN r3825 (trunk)
This commit is contained in:
Randy Heit 2012-08-12 23:24:41 +00:00
parent c9b480e0ec
commit 26c17dc697

View file

@ -5683,6 +5683,7 @@ scriptwait:
float x = FIXED2FLOAT(Stack[optstart-3]);
float y = FIXED2FLOAT(Stack[optstart-2]);
float holdTime = FIXED2FLOAT(Stack[optstart-1]);
fixed_t alpha;
DHUDMessage *msg;
if (type & HUDMSG_COLORSTRING)
@ -5697,11 +5698,13 @@ scriptwait:
switch (type & 0xFF)
{
default: // normal
alpha = (optstart < sp) ? Stack[optstart] : FRACUNIT;
msg = new DHUDMessage (activefont, work, x, y, hudwidth, hudheight, color, holdTime);
break;
case 1: // fade out
{
float fadeTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.5f;
alpha = (optstart < sp-1) ? Stack[optstart+1] : FRACUNIT;
msg = new DHUDMessageFadeOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
}
break;
@ -5709,6 +5712,7 @@ scriptwait:
{
float typeTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.05f;
float fadeTime = (optstart < sp-1) ? FIXED2FLOAT(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? Stack[optstart+2] : FRACUNIT;
msg = new DHUDMessageTypeOnFadeOut (activefont, work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime);
}
break;
@ -5716,11 +5720,13 @@ scriptwait:
{
float inTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.5f;
float outTime = (optstart < sp-1) ? FIXED2FLOAT(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? Stack[optstart+2] : FRACUNIT;
msg = new DHUDMessageFadeInOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
}
break;
}
msg->SetVisibility((type & HUDMSG_VISIBILITY_MASK) >> HUDMSG_VISIBILITY_SHIFT);
msg->SetAlpha(alpha);
if (type & HUDMSG_ADDBLEND)
{
msg->SetRenderStyle(STYLE_Add);