599 lines
22 KiB
Text
599 lines
22 KiB
Text
// Custom intermission screens
|
|
Class SWWMStatScreen : StatusScreen
|
|
{
|
|
TextureID gradtex, arttex, bgtex;
|
|
int glarestr, sndcnt;
|
|
int whichart, whichtip;
|
|
int tipalphastate;
|
|
double tipalpha;
|
|
String tipstr;
|
|
transient BrokenLines tipl;
|
|
Font TewiFont, TewiFontOutline, MiniwiFont;
|
|
double FracTic; // for smooth animations
|
|
bool bNoDrawNextLoc;
|
|
int tipflash; // for switching
|
|
|
|
// customizable colors
|
|
int lnamecolor, lauthcolor; // name / author text
|
|
int lsubcolor; // finished / entering text
|
|
int statbasecolor, statcolor0, // stat label / color for numbers
|
|
statcolor1, statcolor2; // color for 100% / color for SUCKS
|
|
int tipcolor0, tipcolor1; // tip header / tip text
|
|
Color glarecolor; // for the eye glare when advancing
|
|
int flashcolor, tipflashcolor;
|
|
|
|
double hs, hs2;
|
|
Vector2 ss, ss2, origin, origin2;
|
|
Font mSmallFont;
|
|
double bgfade;
|
|
bool bFade;
|
|
|
|
SWWMStaticHandler shnd;
|
|
|
|
override void Start( wbstartstruct wbstartstruct )
|
|
{
|
|
Super.Start(wbstartstruct);
|
|
TewiFont = Font.GetFont('TewiFont');
|
|
TewiFontOutline = Font.GetFont('TewiFontOutline');
|
|
MiniwiFont = Font.GetFont('MiniwiFont');
|
|
// support for old author text style
|
|
int iof;
|
|
for ( int i=0; i<=1; i++ )
|
|
{
|
|
if ( (iof = lnametexts[i].RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober
|
|
{
|
|
authortexts[i] = lnametexts[i].Mid(iof+7);
|
|
lnametexts[i].Truncate(iof);
|
|
}
|
|
else if ( (iof = lnametexts[i].RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM
|
|
{
|
|
authortexts[i] = lnametexts[i].Mid(iof+6);
|
|
lnametexts[i].Truncate(iof);
|
|
}
|
|
else if ( (iof = lnametexts[i].RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?)
|
|
{
|
|
authortexts[i] = lnametexts[i].Mid(iof+3);
|
|
lnametexts[i].Truncate(iof);
|
|
}
|
|
// level name may contain trailing whitespace due to DEHACKED nonsense, so strip it
|
|
lnametexts[i].StripRight();
|
|
}
|
|
tipalpha = -1.;
|
|
// defaults
|
|
lnamecolor = Font.CR_WHITE;
|
|
lauthcolor = Font.CR_DARKGRAY;
|
|
lsubcolor = Font.CR_SAPPHIRE;
|
|
statbasecolor = Font.CR_SAPPHIRE;
|
|
statcolor0 = Font.CR_WHITE;
|
|
statcolor1 = Font.CR_GOLD;
|
|
statcolor2 = Font.CR_RED;
|
|
tipcolor0 = Font.CR_SAPPHIRE;
|
|
tipcolor1 = Font.CR_WHITE;
|
|
flashcolor = Font.FindFontColor('MiniFlash');
|
|
tipflashcolor = Font.FindFontColor('MiniWhiteFlash');
|
|
glarecolor = 0xFF4080FF;
|
|
}
|
|
override void StartMusic()
|
|
{
|
|
S_ChangeMusic("music/DRAGONY.XM");
|
|
}
|
|
|
|
private String StatCnt( int a, int b )
|
|
{
|
|
if ( b <= 0 ) return "N/A";
|
|
return String.Format("%s \cu/\c- %s \cu(\c-%3d%%\cu)",SWWMUtility.ThousandsNum(max(a,0)),SWWMUtility.ThousandsNum(b),GetPct(a,b));
|
|
}
|
|
|
|
private String TimeStr( int secs )
|
|
{
|
|
secs = max(secs,0);
|
|
int h = secs/3600;
|
|
int m = (secs/60)%60;
|
|
int s = secs%60;
|
|
if ( h ) return String.Format("%02d\cu:\c-%02d\cu:\c-%02d",h,m,s);
|
|
return String.Format("%02d\cu:\c-%02d",m,s);
|
|
}
|
|
|
|
private int GetPct( int a, int b )
|
|
{
|
|
if ( a < 0 ) return 0;
|
|
if ( b <= 0 ) return 100; // for "missed" percentage
|
|
return (a*100)/b;
|
|
}
|
|
|
|
override int DrawLF()
|
|
{
|
|
if ( sp_state < 1 ) return 0;
|
|
double GameSecs = (bcnt+FracTic)/double(GameTicRate);
|
|
int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*CleanYFac_1; // height of the stats box + margin
|
|
int bh = ((authortexts[0]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*CleanYFac_1; // height of the "level finished" box
|
|
double xx = Screen.GetWidth()/2;
|
|
double yy = (Screen.GetHeight()-th)/2;
|
|
if ( (Screen.GetHeight()/CleanYFac_1) < 480 )
|
|
{
|
|
// upshift to fit tips
|
|
int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75);
|
|
yy -= fct;
|
|
}
|
|
yy -= bh;
|
|
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
|
|
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[0])*CleanXFac_1,yy,lnametexts[0],DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
|
|
yy += TewiFont.GetHeight()*2*CleanYFac_1;
|
|
if ( authortexts[0] != "" )
|
|
{
|
|
Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[0])*CleanXFac_1/2,yy,authortexts[0],DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
yy += MiniwiFont.GetHeight()*CleanYFac_1;
|
|
}
|
|
String str = StringTable.Localize("$SWWM_INTERDONE");
|
|
Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
|
|
if ( (glarestr > 0) && (sp_state < 2) )
|
|
{
|
|
double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2;
|
|
Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf);
|
|
}
|
|
return 0;
|
|
}
|
|
override void DrawEL()
|
|
{
|
|
int th = (TewiFont.GetHeight()*(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime))+32)*CleanYFac_1; // height of the stats box + margin
|
|
int bh = ((authortexts[1]!="")?(MiniwiFont.GetHeight()+TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2):(TewiFont.GetHeight()*2+TewiFontOutline.GetHeight()*2))*CleanYFac_1; // height of the "level finished" box
|
|
double xx = Screen.GetWidth()/2;
|
|
double yy = (Screen.GetHeight()+th)/2;
|
|
if ( (Screen.GetHeight()/CleanYFac_1) < 480 )
|
|
{
|
|
// upshift to fit tips
|
|
int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75);
|
|
yy -= fct;
|
|
}
|
|
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
|
|
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
Screen.DrawTexture(gradtex,false,xx,yy+bh/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,bh+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
String str = StringTable.Localize("$SWWM_INTERNEXT");
|
|
Screen.DrawText(TewiFontOutline,lsubcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2);
|
|
if ( (glarestr > 0) && (sp_state >= 10) )
|
|
{
|
|
double alf = clamp((glarestr-FracTic)/20.,0.,1.)**2;
|
|
Screen.DrawText(TewiFontOutline,flashcolor,xx-TewiFontOutline.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanYFac_1*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf);
|
|
}
|
|
yy += TewiFontOutline.GetHeight()*2*CleanYFac_1;
|
|
Screen.DrawText(TewiFont,lnamecolor,xx-TewiFont.StringWidth(lnametexts[1])*CleanXFac_1,yy,lnametexts[1],DTA_ScaleX,CleanXFac_1*2,DTA_ScaleY,CleanXFac_1*2);
|
|
yy += TewiFont.GetHeight()*2*CleanYFac_1;
|
|
if ( authortexts[0] == "" ) return;
|
|
Screen.DrawText(MiniwiFont,lauthcolor,xx-MiniwiFont.StringWidth(authortexts[1])*CleanXFac_1/2,yy,authortexts[1],DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
}
|
|
override void drawStats( void )
|
|
{
|
|
if ( sp_state < 2 ) return;
|
|
int ne = (sp_state>=8)?(8+(!!wbs.partime)+(wbs.totaltime!=Plrs[me].stime)):(sp_state>=6)?6:(sp_state>=4)?4:2;
|
|
int th = (TewiFont.GetHeight()*ne)*CleanYFac_1; // height of the stats box
|
|
double xx = Screen.GetWidth()/2;
|
|
double yy = (Screen.GetHeight()-th)/2;
|
|
if ( (Screen.GetHeight()/CleanYFac_1) < 480 )
|
|
{
|
|
// upshift to fit tips
|
|
int fct = int(clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)*.75);
|
|
yy -= fct;
|
|
}
|
|
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
|
|
Screen.DrawTexture(gradtex,false,xx,yy+th/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,th+4*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
Screen.DrawTexture(gradtex,false,xx,yy+th/2,DTA_DestWidth,150*CleanXFac_1,DTA_DestHeight,th+4*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
String str = StringTable.Localize("$SWWM_INTERKILLS");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StatCnt(cnt_kills[0],wbs.maxkills);
|
|
Screen.DrawText(TewiFont,((wbs.maxkills>0)&&(cnt_kills[0]>=wbs.maxkills))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
if ( sp_state < 4 ) return;
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StringTable.Localize("$SWWM_INTERITEMS");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StatCnt(cnt_items[0],wbs.maxitems);
|
|
Screen.DrawText(TewiFont,((wbs.maxitems>0)&&(cnt_items[0]>=wbs.maxitems))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
if ( sp_state < 6 ) return;
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StringTable.Localize("$SWWM_INTERSECRETS");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StatCnt(cnt_secret[0],wbs.maxsecret);
|
|
Screen.DrawText(TewiFont,((wbs.maxsecret>0)&&(cnt_secret[0]>=wbs.maxsecret))?statcolor1:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
if ( sp_state < 8 ) return;
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = "┈┈┄┄╌╌────╌╌┄┄┈┈";
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-TewiFont.StringWidth(str)*CleanXFac_1/2,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StringTable.Localize("$SWWM_INTERTIME");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
str = TimeStr(max(cnt_time,0));
|
|
Screen.DrawText(TewiFont,(wbs.partime&&(cnt_time<=(wbs.partime/GameTicRate)))?statcolor1:((wbs.sucktime>0)&&(cnt_time>(wbs.sucktime*3600)))?statcolor2:statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
if ( wbs.partime )
|
|
{
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StringTable.Localize("$SWWM_INTERPAR");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
str = TimeStr(max(cnt_par,0));
|
|
Screen.DrawText(TewiFont,statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
}
|
|
if ( wbs.totaltime == Plrs[me].stime ) return;
|
|
yy += TewiFont.GetHeight()*CleanYFac_1;
|
|
str = StringTable.Localize("$SWWM_INTERTOTAL");
|
|
Screen.DrawText(TewiFont,statbasecolor,xx-80*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
str = TimeStr(max(cnt_total_time,0));
|
|
Screen.DrawText(TewiFont,statcolor0,xx+80*CleanXFac_1-TewiFont.StringWidth(str)*CleanXFac_1,yy,str,DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1);
|
|
}
|
|
|
|
private void drawSWWMBg()
|
|
{
|
|
if ( !shnd ) shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
|
|
if ( !whichart )
|
|
{
|
|
int no = StringTable.Localize("$SWWM_NRENDER").ToInt();
|
|
Array<Int> ents;
|
|
ents.Clear();
|
|
int rno = 0;
|
|
for ( int i=1; i<=no; i++ )
|
|
{
|
|
ents.Push(i);
|
|
rno++;
|
|
}
|
|
no = rno;
|
|
if ( shnd.lastart.Size() >= no )
|
|
{
|
|
// exclude last one, start over
|
|
int excludeme = shnd.lastart[shnd.lastart.Size()-1];
|
|
ents.Delete(excludeme-1);
|
|
shnd.lastart.Clear();
|
|
}
|
|
else
|
|
{
|
|
foreach ( la:shnd.lastart )
|
|
{
|
|
int f = ents.Find(la);
|
|
if ( f != ents.Size() )
|
|
ents.Delete(f);
|
|
}
|
|
}
|
|
whichart = ents[Random[InterArt](0,ents.Size()-1)];
|
|
shnd.lastart.Push(whichart);
|
|
}
|
|
double ar = Screen.GetAspectRatio(), sar;
|
|
Vector2 tsize, vsize;
|
|
Screen.Clear(0,0,Screen.GetWidth(),Screen.GetHeight(),"Black");
|
|
// background pics
|
|
if ( whichart )
|
|
{
|
|
String artstr = StringTable.Localize(String.Format("$SWWM_RENDER%d",whichart));
|
|
if ( !arttex ) arttex = TexMan.CheckForTexture("graphics/Renders/"..artstr);
|
|
tsize = TexMan.GetScaledSize(arttex);
|
|
sar = tsize.x/tsize.y;
|
|
if ( sar > ar ) vsize = (tsize.y*ar,tsize.y);
|
|
else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar);
|
|
else vsize = tsize;
|
|
Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true);
|
|
}
|
|
Screen.Dim("Black",.25,0,0,Screen.GetWidth(),Screen.GetHeight());
|
|
}
|
|
private void drawSWWMFg()
|
|
{
|
|
if ( !shnd ) shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
|
|
// intermission tips at the bottom
|
|
if ( !whichtip )
|
|
{
|
|
int maxtip = StringTable.Localize("$SWWM_NINTERTIP").ToInt();
|
|
Array<Int> ents;
|
|
ents.Clear();
|
|
for ( int i=1; i<=maxtip; i++ ) ents.Push(i);
|
|
if ( shnd.lasttip.Size() >= maxtip )
|
|
{
|
|
// exclude last one, start over
|
|
int excludeme = shnd.lasttip[shnd.lasttip.Size()-1];
|
|
ents.Delete(excludeme-1);
|
|
shnd.lasttip.Clear();
|
|
}
|
|
else
|
|
{
|
|
foreach ( lt:shnd.lasttip )
|
|
{
|
|
int f = ents.Find(lt);
|
|
if ( f != ents.Size() )
|
|
ents.Delete(f);
|
|
}
|
|
}
|
|
whichtip = ents[Random[InterArt](0,ents.Size()-1)];
|
|
tipstr = String.Format(StringTable.Localize("$SWWM_INTERTIP"),whichtip).."\n"..StringTable.Localize(String.Format("$SWWM_INTERTIP%d",whichtip));
|
|
if ( tipl ) tipl.Destroy();
|
|
shnd.lasttip.Push(whichtip);
|
|
}
|
|
if ( tipalpha <= 0. ) return;
|
|
double alf = clamp(tipalpha+(tipalphastate*fractic)/GameTicRate,0.,1.);
|
|
if ( !tipl ) tipl = TewiFontOutline.BreakLines(tipstr,600);
|
|
int lw = 0;
|
|
for ( int i=0; i<tipl.Count(); i++ )
|
|
if ( tipl.StringWidth(i) > lw )
|
|
lw = tipl.StringWidth(i);
|
|
double xx = (Screen.GetWidth()-lw*CleanXFac_1)/2;
|
|
double yy = Screen.GetHeight()-60*CleanYFac_1;
|
|
if ( (Screen.GetHeight()/CleanYFac_1) < 480 )
|
|
{
|
|
// downshift to fit tips
|
|
int fct = clamp(480-(Screen.GetHeight()/CleanYFac_1),0,80)/3;
|
|
yy += fct;
|
|
}
|
|
yy -= (tipl.Count()-1)*TewiFontOutline.GetHeight();
|
|
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png");
|
|
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,yy+TewiFontOutline.GetHeight()*tipl.Count()*CleanYFac_1/2.,DTA_DestWidth,450*CleanXFac_1,DTA_DestHeight,(TewiFontOutline.GetHeight()*tipl.Count()+8)*CleanYFac_1,DTA_Rotate,90,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8*alf,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,yy+TewiFontOutline.GetHeight()*tipl.Count()*CleanYFac_1/2.,DTA_DestWidth,450*CleanXFac_1,DTA_DestHeight,(TewiFontOutline.GetHeight()*tipl.Count()+8)*CleanYFac_1,DTA_Rotate,270,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_Alpha,.8*alf,DTA_TopOffset,256,DTA_LeftOffset,128);
|
|
double alph;
|
|
if ( tipflash && (gametic < tipflash) ) alph = max((tipflash-(gametic+fractic))/25.,0.)**1.5;
|
|
xx -= 8*CleanXFac_1;
|
|
for ( int i=0; i<tipl.Count(); i++ )
|
|
{
|
|
Screen.DrawText(TewiFontOutline,(i==0)?tipcolor0:tipcolor1,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1,DTA_Alpha,alf);
|
|
if ( tipflash && (gametic < tipflash) )
|
|
Screen.DrawText(TewiFontOutline,tipflashcolor,xx,yy,tipl.StringAt(i),DTA_ScaleX,CleanXFac_1,DTA_ScaleY,CleanYFac_1,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf*alph);
|
|
yy += TewiFontOutline.GetHeight()*CleanYFac_1;
|
|
if ( i == 0 ) xx += 16*CleanXFac_1;
|
|
}
|
|
}
|
|
|
|
override void Drawer( void )
|
|
{
|
|
switch ( CurState )
|
|
{
|
|
case StatCount:
|
|
drawSWWMBg();
|
|
drawLF();
|
|
drawStats();
|
|
drawSWWMFg();
|
|
break;
|
|
case ShowNextLoc:
|
|
case NoState:
|
|
case LeavingIntermission:
|
|
drawSWWMBg();
|
|
drawLF();
|
|
drawStats();
|
|
if ( !bNoDrawNextLoc ) drawEL();
|
|
drawSWWMFg();
|
|
break;
|
|
}
|
|
if ( (bgfade <= 0.) || !arttex ) return;
|
|
double alph = bgfade;
|
|
if ( bFade ) alph = min(1.,bgfade+(3.*FracTic)/GameTicRate);
|
|
else alph = max(0.,bgfade-(4.*FracTic)/GameTicRate);
|
|
// redraw BG on top, hiding the rest of the ui
|
|
double ar = Screen.GetAspectRatio();
|
|
Vector2 tsize = TexMan.GetScaledSize(arttex);
|
|
double sar = tsize.x/tsize.y;
|
|
Vector2 vsize;
|
|
if ( sar > ar ) vsize = (tsize.y*ar,tsize.y);
|
|
else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar);
|
|
else vsize = tsize;
|
|
Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alph);
|
|
}
|
|
override void Draw( double smoothratio )
|
|
{
|
|
FracTic = smoothratio;
|
|
Drawer();
|
|
if ( glarestr > 0 )
|
|
Screen.Dim(glarecolor,(clamp((glarestr-fractic)/20.,0.,1.)**2)*.3,0,0,Screen.GetWidth(),Screen.GetHeight());
|
|
}
|
|
|
|
override void Ticker( void )
|
|
{
|
|
bcnt++;
|
|
if ( bcnt == 1 ) StartMusic();
|
|
glarestr = max(glarestr-1,0);
|
|
tipalpha = min(tipalpha+tipalphastate/double(GameTicRate),2.);
|
|
switch (CurState)
|
|
{
|
|
case StatCount:
|
|
tipalphastate = 1;
|
|
updateStats();
|
|
break;
|
|
case ShowNextLoc:
|
|
updateShowNextLoc();
|
|
break;
|
|
case NoState:
|
|
tipalphastate = -2;
|
|
updateNoState();
|
|
break;
|
|
case LeavingIntermission:
|
|
// sorry nothing
|
|
break;
|
|
}
|
|
// check fade
|
|
if ( bFade ) bgfade = min(1.,bgfade+3./GameTicRate);
|
|
else bgfade = max(0.,bgfade-4./GameTicRate);
|
|
}
|
|
override bool OnEvent( InputEvent evt )
|
|
{
|
|
if ( evt.type == InputEvent.Type_KeyDown )
|
|
{
|
|
String cmd = Bindings.GetBinding(evt.KeyScan);
|
|
if ( (cmd ~== "+attack") || (cmd ~== "+use") || (evt.KeyScan == InputEvent.KEY_ENTER) ) // KEY_ENTER needed as fallback for Delta Touch compatibility
|
|
{
|
|
accelerateStage = 1;
|
|
return true;
|
|
}
|
|
if ( cmd ~== "+altattack" )
|
|
{
|
|
bFade = true;
|
|
return true;
|
|
}
|
|
if ( cmd ~== "+reload" )
|
|
{
|
|
PlaySound("misc/chat");
|
|
whichtip = 0;
|
|
tipflash = gametic+25;
|
|
return true;
|
|
}
|
|
if ( cmd ~== "+zoom" )
|
|
{
|
|
PlaySound("misc/chat");
|
|
whichart = 0;
|
|
arttex.SetNull();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
else if ( (evt.type == InputEvent.Type_KeyUp)
|
|
&& (Bindings.GetBinding(evt.KeyScan) ~== "+altattack") )
|
|
{
|
|
bFade = false;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
override void updateNoState()
|
|
{
|
|
// make sure tip alpha is zero, so this transition is less jarring
|
|
if ( tipalpha > 0. ) return;
|
|
Super.updateNoState();
|
|
}
|
|
override void initShowNextLoc()
|
|
{
|
|
if ( wbs.next == "" )
|
|
{
|
|
// the base statscreen skips directly here, which looks
|
|
// very jarring with this one, so just skip to NoState
|
|
bNoDrawNextLoc = true;
|
|
initNoState();
|
|
return;
|
|
}
|
|
CurState = ShowNextLoc;
|
|
acceleratestage = 0;
|
|
cnt = SHOWNEXTLOCDELAY*GameTicRate;
|
|
noautostartmap = false;
|
|
}
|
|
override void initStats()
|
|
{
|
|
CurState = StatCount;
|
|
acceleratestage = 0;
|
|
sp_state = 0;
|
|
cnt_kills[0] = cnt_items[0] = cnt_secret[0] = -1;
|
|
cnt_time = cnt_par = -1;
|
|
cnt_pause = GameTicRate*2;
|
|
cnt_total_time = -1;
|
|
}
|
|
override void updateStats()
|
|
{
|
|
if ( sp_state == 0 )
|
|
{
|
|
if ( bcnt > GameTicRate )
|
|
{
|
|
S_StartSound("misc/interstart",CHAN_WEAPON,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
acceleratestage = 0;
|
|
glarestr = 20;
|
|
sp_state++;
|
|
}
|
|
return;
|
|
}
|
|
if ( acceleratestage && (sp_state != 10) )
|
|
{
|
|
acceleratestage = 0;
|
|
sp_state = 10;
|
|
S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 10;
|
|
cnt_kills[0] = Plrs[me].skills;
|
|
cnt_items[0] = Plrs[me].sitems;
|
|
cnt_secret[0] = Plrs[me].ssecret;
|
|
cnt_time = Thinker.Tics2Seconds(Plrs[me].stime);
|
|
cnt_par = wbs.partime/GameTicRate;
|
|
cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime);
|
|
}
|
|
if ( sp_state == 2 )
|
|
{
|
|
cnt_kills[0] += max((Plrs[me].skills-cnt_kills[0])/GameTicRate,1);
|
|
if ( !((sndcnt++)%2) )
|
|
{
|
|
S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 5;
|
|
}
|
|
if ( cnt_kills[0] >= Plrs[me].skills )
|
|
{
|
|
S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
cnt_kills[0] = Plrs[me].skills;
|
|
glarestr = 10;
|
|
sp_state++;
|
|
}
|
|
}
|
|
else if ( sp_state == 4 )
|
|
{
|
|
cnt_items[0] += max((Plrs[me].sitems-cnt_items[0])/GameTicRate,1);
|
|
if ( !((sndcnt++)%2) )
|
|
{
|
|
S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 5;
|
|
}
|
|
if ( cnt_items[0] >= Plrs[me].sitems )
|
|
{
|
|
S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
cnt_items[0] = Plrs[me].sitems;
|
|
glarestr = 10;
|
|
sp_state++;
|
|
}
|
|
}
|
|
else if ( sp_state == 6 )
|
|
{
|
|
cnt_secret[0] += max((Plrs[me].ssecret-cnt_secret[0])/GameTicRate,1);
|
|
if ( !((sndcnt++)%2) )
|
|
{
|
|
S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 5;
|
|
}
|
|
if ( cnt_secret[0] >= Plrs[me].ssecret )
|
|
{
|
|
S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
cnt_secret[0] = Plrs[me].ssecret;
|
|
glarestr = 10;
|
|
sp_state++;
|
|
}
|
|
}
|
|
else if ( sp_state == 8 )
|
|
{
|
|
int sec = Thinker.Tics2Seconds(Plrs[me].stime);
|
|
int tsec = Thinker.Tics2Seconds(wbs.totaltime);
|
|
int psec = wbs.partime/GameTicRate;
|
|
if ( !((sndcnt++)%2) )
|
|
{
|
|
S_StartSound("misc/intercnt",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 5;
|
|
}
|
|
cnt_time += max((sec-cnt_time)/GameTicRate,1);
|
|
cnt_par += max((psec-cnt_par)/GameTicRate,1);
|
|
cnt_total_time += max((tsec-cnt_total_time)/GameTicRate,1);
|
|
if ( cnt_time >= sec ) cnt_time = sec;
|
|
if ( cnt_total_time >= tsec ) cnt_total_time = tsec;
|
|
if ( cnt_par >= psec )
|
|
{
|
|
cnt_par = psec;
|
|
if ( cnt_time >= sec )
|
|
{
|
|
S_StartSound("misc/intercntdone",CHAN_VOICE,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
cnt_total_time = tsec;
|
|
glarestr = 10;
|
|
sp_state++;
|
|
}
|
|
}
|
|
}
|
|
else if ( sp_state == 10 )
|
|
{
|
|
if ( acceleratestage )
|
|
{
|
|
S_StartSound("misc/interdone",CHAN_WEAPON,CHANF_OVERLAP|CHANF_UI,1.,0.);
|
|
glarestr = 20;
|
|
initShowNextLoc();
|
|
}
|
|
}
|
|
else if ( sp_state&1 )
|
|
{
|
|
if ( !--cnt_pause )
|
|
{
|
|
sp_state++;
|
|
cnt_pause = GameTicRate;
|
|
sndcnt = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|