swwmgz_m/zscript/menu/swwm_title.zsc

472 lines
19 KiB
Text

// Things for the titlemap
Struct TitleExplosion
{
bool bInit;
int frame;
Vector2 pos;
double scale;
bool flipx, flipy;
double angle;
}
Class SWWMTitleStuff : EventHandler
{
ui bool bInitialized;
ui TextureID tex[6];
ui TextureID letters[13];
ui TextureID camtex; // must be drawn for shaders to actually use it
ui BrokenLines stitle;
ui Array<String> scrolls;
ui int sline;
ui double sbase;
ui String lastlang, lastlang2;
ui bool lastlogo;
ui TitleExplosion smk[64];
ui TextureID smk_frame[19];
ui int titletimer;
int playtimer; // required for the logo fader
ui int rss;
ui int stopinit_t;
ui bool bFadeIn;
ui Font mSmallFont, mBigFont;
private ui int GetUIRandom()
{
return (rss = (rss<<1)*35447+(rss/87));
}
private ui double RandomShiver()
{
int sd = GetUIRandom();
return ((abs(sd)%11)-5)*.1;
}
private ui void TickExplosions()
{
if ( stopinit_t > 0 ) stopinit_t--;
bool stopinit = (stopinit_t>0);
for ( int i=0; i<64; i++ )
{
if ( (!smk[i].bInit && !stopinit) || (smk[i].frame > 18) )
{
smk[i].frame = Random[UIStuff](smk[i].bInit?-20:-4,0);
smk[i].pos = (FRandom[UIStuff](0.,1.),FRandom[UIStuff](0.,1.));
smk[i].scale = FRandom[UIStuff](3.,6.);
smk[i].angle = FRandom[UIStuff](0.,360.);
smk[i].flipx = Random[UIStuff](0,1);
smk[i].flipy = Random[UIStuff](0,1);
if ( !smk[i].bInit )
{
smk[i].bInit = true;
stopinit = true;
stopinit_t = 4;
}
}
if ( !smk[i].bInit ) continue;
if ( (smk[i].frame == 0) && (titletimer < -20 ) )
S_StartSound("title/explo",CHAN_WEAPON,CHANF_UI|CHANF_OVERLAP,1.,ATTN_NONE,FRandom[UIStuff](.95,1.05));
smk[i].frame++;
}
}
override void WorldLoaded( WorldEvent e )
{
let f = LogoFader(Actor.Spawn("LogoFader"));
f.hnd = self;
TexMan.SetCameraToTexture(f,"LOGOFADE",90);
// fallback in case netevents fail (old gzdoom)
playtimer = -65536;
}
// synchronize ui->play timer
override void NetworkProcess( ConsoleEvent e )
{
if ( e.Name == "swwmtitle.timer" )
playtimer = e.Args[0];
}
override void UiTick()
{
// you're not supposed to be here
if ( gamestate == GS_LEVEL )
ThrowAbortException("Attempted to warp into TITLEMAP");
if ( !bInitialized )
{
bInitialized = true;
titletimer = -300;
// birthday event
if ( SystemTime.Format("%d%m",SystemTime.Now()) == "2001" )
titletimer = -500;
let shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
if ( shnd )
{
if ( shnd.titlefirst )
{
titletimer = GameTicRate*22; // skip to logo
S_ChangeMusic("music/TRAUMATI.XM",1); // skip to order 1
bFadeIn = true;
}
shnd.titlefirst = true;
}
}
if ( titletimer == -250 )
{
if ( gameinfo.gametype&GAME_Hexen ) S_ChangeMusic("HEXEN");
else if ( gameinfo.gametype&GAME_Heretic ) S_ChangeMusic("MUS_TITL");
else
{
// check if the doom 1 music exists
if ( Wads.FindLump("D_INTRO",ns:wads.ns_music) != -1 )
S_ChangeMusic("D_INTRO");
else S_ChangeMusic("D_DM2TTL");
}
}
if ( titletimer == -75 ) S_ChangeMusic("");
if ( (titletimer > -80) && (titletimer < -20) ) TickExplosions();
if ( titletimer == 0 ) S_ChangeMusic("music/TRAUMATI.XM");
if ( !swwm_oldlogo )
{
// title lettering
if ( ((double(titletimer)/GameTicRate) >= 23.) && ((double(titletimer)/GameTicRate) <= 25.4) && !(titletimer%5) )
S_StartSound("title/thump",CHAN_WEAPON,CHANF_UI|CHANF_OVERLAP,1.,ATTN_NONE);
}
titletimer++;
EventHandler.SendNetworkEvent("swwmtitle.timer",titletimer);
if ( menuactive && (titletimer < -80) && (titletimer >= -300) ) titletimer = -80;
}
private ui void RenderExplosions()
{
for ( int i=0; i<64; i++ )
{
int frm = smk[i].frame;
if ( (frm < 0) || (frm > 18) ) continue;
if ( !smk_frame[frm] ) smk_frame[frm] = TexMan.CheckForTexture(String.Format("XEX0%c0",0x41+frm),TexMan.Type_Sprite);
Vector2 vpos;
vpos.x = smk[i].pos.x*Screen.GetWidth();
vpos.y = smk[i].pos.y*Screen.GetHeight();
Screen.DrawTexture(smk_frame[frm],false,vpos.x,vpos.y,DTA_ScaleX,smk[i].scale*CleanXFac,DTA_ScaleY,smk[i].scale*CleanYFac,DTA_FlipX,smk[i].flipx,DTA_FlipY,smk[i].flipy,DTA_Rotate,smk[i].angle,DTA_LegacyRenderStyle,STYLE_Add);
}
}
override void RenderUnderlay( RenderEvent e )
{
if ( !mSmallFont ) mSmallFont = Font.GetFont('TewiFont');
if ( !mBigFont ) mBigFont = Font.GetFont('TewiFontOutline');
if ( !camtex ) camtex = TexMan.CheckForTexture("LOGOFADE",TexMan.Type_Any);
Screen.DrawTexture(camtex,false,0,0);
if ( !tex[2] ) tex[2] = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any);
if ( !tex[5] ) tex[5] = TexMan.CheckForTexture("graphics/DemoIcon.png",TexMan.Type_Any);
Vector2 tsize, vsize;
if ( titletimer < -300 )
{
Screen.Dim("Black",1.,0,0,Screen.GetWidth(),Screen.GetHeight());
double alf;
if ( titletimer < -420 ) alf = clamp((titletimer+450)/30.,0.,1.);
else if ( titletimer > -330 ) alf = clamp(1.-(titletimer+330)/30.,0.,1.);
else alf = 1.;
double xx, yy;
Screen.DrawTexture(tex[5],false,Screen.GetWidth()/2,Screen.GetHeight()/2,DTA_CleanNoMove_1,true,DTA_Alpha,alf);
String str = "2148-01-20";
xx = int(Screen.GetWidth()-mBigFont.StringWidth(str)*CleanXFac_1*3.)/2;
yy = Screen.GetHeight()/2-(72.+mBigFont.GetHeight()*3.)*CleanYFac_1;
Screen.DrawText(mBigFont,Font.CR_WHITE,xx,yy,str,DTA_Alpha,alf,DTA_ScaleX,CleanXFac_1*3.,DTA_ScaleY,CleanYFac_1*3.);
str = "Happy Birthday, \cdDemo-chan\c-!";
xx = int(Screen.GetWidth()-mBigFont.StringWidth(str)*CleanXFac_1*2.)/2;
yy = Screen.GetHeight()/2+72.*CleanYFac_1;
Screen.DrawText(mBigFont,Font.CR_WHITE,xx,yy,str,DTA_Alpha,alf,DTA_ScaleX,CleanXFac_1*2.,DTA_ScaleY,CleanYFac_1*2.);
return;
}
if ( !tex[3] ) tex[3] = TexMan.CheckForTexture((gameinfo.gametype&GAME_Raven)?"TITLE":"TITLEPIC",TexMan.Type_MiscPatch);
if ( titletimer < 0 )
{
Screen.Dim("Black",1.,0,0,Screen.GetWidth(),Screen.GetHeight());
if ( titletimer < -20 )
{
rss = int(MSTimeF()*(GameTicRate/1000.));
Vector2 ofs = (RandomShiver(),RandomShiver())*clamp((80+titletimer+e.FracTic)/50.,0.,1.);
tsize = TexMan.GetScaledSize(tex[3]);
ofs *= tsize.y/10.;
Screen.DrawTexture(tex[3],true,ofs.x,ofs.y,DTA_VirtualWidthF,tsize.x,DTA_VirtualHeightF,tsize.y,DTA_FullscreenScale,FSMode_ScaleToFit43);
RenderExplosions();
}
if ( titletimer > -20 ) Screen.Dim("White",1.-clamp((20+titletimer+e.FracTic)/20.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
else if ( titletimer > -80 ) Screen.Dim("White",clamp((80+titletimer+e.FracTic)/50.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
if ( titletimer <= -250 ) Screen.Dim("Black",1.-clamp((270+titletimer+e.FracTic)/20.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
return;
}
if ( swwm_fuzz )
{
tsize = TexMan.GetScaledSize(tex[2]);
double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y));
vsize = (Screen.GetWidth(),Screen.GetHeight())/zoom;
Screen.DrawTexture(tex[2],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(192,0,0,0));
Screen.Dim("Black",clamp(1.-((titletimer+e.FracTic)/GameTicRate)*.05,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
}
else Screen.Dim("Black",1.,0,0,Screen.GetWidth(),Screen.GetHeight());
double hs = max(min(floor(Screen.GetWidth()/320.),floor(Screen.GetHeight()/200.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
if ( swwm_oldlogo ) Render_OldTitle(e,ss);
else Render_NewTitle(e);
if ( (titletimer/GameTicRate) < 30 ) return;
// scrolls
if ( (scrolls.Size() <= 0 ) || (lastlang != language) || ((sline == 0) && (lastlogo != swwm_oldlogo)) )
{
scrolls.Clear();
int nstr = StringTable.Localize("$SWWM_NTITLESCROLL").ToInt();
for ( int i=1; i<=nstr; i++ )
{
if ( (i == 1) && !swwm_oldlogo ) scrolls.Push(StringTable.Localize("$SWWM_TITLESCROLL1_NEW"));
else scrolls.Push(StringTable.Localize("$SWWM_TITLESCROLL"..i));
}
sbase = (titletimer+e.FracTic)/GameTicRate;
if ( sline >= scrolls.Size() ) sline = 0;
}
lastlang = language;
lastlogo = swwm_oldlogo;
// estimate scroll length
double llen = mSmallFont.StringWidth(scrolls[sline]);
double soffset = 40*((titletimer+e.FracTic)/GameTicRate-sbase);
if ( soffset > llen+ss.x )
{
sline++;
if ( sline >= scrolls.Size() ) sline = 0;
sbase = (titletimer+e.FracTic)/GameTicRate;
soffset = 0;
}
double xx = ss.x-soffset;
int tlen = scrolls[sline].CodePointCount();
double alf;
for ( int i=0, pos=0; i<tlen; i++ )
{
int ch;
[ch, pos] = scrolls[sline].GetNextCodePoint(pos);
if ( (xx > -8) && (xx < ss.x) )
{
for ( double trl = .1; trl < 1.; trl += .04 )
{
double yy = (ss.y-35)+10*sin(15*i+160*(titletimer+e.FracTic)/GameTicRate-90.*(1.-trl));
alf = max(0,1.-abs((ss.x/2)-xx)/(ss.x/2))**.5;
alf *= .2*trl;
double xxofs = 5*sin(15*i+120*(titletimer+e.FracTic)/GameTicRate-90.*(1.-trl))-16*(1.-trl);
Screen.DrawChar(mSmallFont,Font.CR_BLUE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf,DTA_LegacyRenderStyle,STYLE_Add);
}
double yy = (ss.y-35)+10*sin(15*i+160*(titletimer+e.FracTic)/GameTicRate);
alf = max(0,1.-abs((ss.x/2)-xx)/(ss.x/2))**.5;
double xxofs = 5*sin(15*i+120*(titletimer+e.FracTic)/GameTicRate);
Color c = Color(int(127.5+127.5*sin(10*i+80*(titletimer+e.FracTic)/GameTicRate)),0,0);
Screen.DrawChar(mSmallFont,Font.CR_SAPPHIRE,xx-xxofs,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf);
}
xx += mSmallFont.GetCharWidth(ch)+mSmallFont.GetDefaultKerning();
}
}
private ui void Render_OldTitle( RenderEvent e, Vector2 ss )
{
if ( !tex[0] ) tex[0] = TexMan.CheckForTexture("graphics/UnSXLogo.png",TexMan.Type_Any);
if ( !tex[1] ) tex[1] = TexMan.CheckForTexture("graphics/SWWMGZLogo.png",TexMan.Type_Any);
double ar = Screen.GetAspectRatio();
Vector2 tsize = TexMan.GetScaledSize(tex[0]);
double sar = tsize.x/tsize.y;
Vector2 vsize;
if ( sar > ar ) vsize = (tsize.x,tsize.x/ar);
else if ( sar < ar ) vsize = (tsize.y*ar,tsize.y);
else vsize = tsize;
double alf = clamp(((titletimer+e.FracTic)/GameTicRate)-2,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-8,0.,1.);
Screen.DrawTexture(tex[0],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf);
String str = StringTable.Localize("$SWWM_TITLEPRESENTS");
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-10,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-16,0.,1.);
Screen.DrawText(mSmallFont,Font.CR_WHITE,(ss.x-mSmallFont.StringWidth(str))/2,(ss.y-mSmallFont.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf);
if ( bFadeIn ) Screen.Dim("Black",1.-clamp(((titletimer+e.FracTic)/GameTicRate)-22,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
else
{
str = StringTable.Localize("$SWWM_TITLEMODBY");
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-18,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-24,0.,1.);
Screen.DrawText(mSmallFont,Font.CR_WHITE,(ss.x-mSmallFont.StringWidth(str))/2,(ss.y-mSmallFont.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf);
}
tsize = TexMan.GetScaledSize(tex[1]);
sar = tsize.x/tsize.y;
if ( sar > ar ) vsize = (tsize.x,tsize.x/ar);
else if ( sar < ar ) vsize = (tsize.y*ar,tsize.y);
else vsize = tsize;
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-26,0.,2.)*.5;
Screen.DrawTexture(tex[1],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf);
}
private ui void Render_NewTitle( RenderEvent e )
{
if ( !tex[4] ) tex[4] = TexMan.CheckForTexture("graphics/NewLogo.png",TexMan.Type_Any);
for ( int i=0; i<13; i++ )
{
if ( !letters[i] ) letters[i] = TexMan.CheckForTexture("graphics/NewLogo_Letter"..i..".png",TexMan.Type_Any);
}
double alf = clamp(((titletimer+e.FracTic)/GameTicRate)-1,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-4,0.,1.);
String str = StringTable.Localize("$SWWM_TITLEPRESENTSA");
Screen.DrawText(mSmallFont,Font.CR_FIRE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(mSmallFont.GetHeight()*CleanYFac),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEPRESENTSB");
Screen.DrawText(mSmallFont,Font.CR_WHITE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-5,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-8,0.,1.);
str = StringTable.Localize("$SWWM_TITLEMODBYA");
Screen.DrawText(mSmallFont,Font.CR_WHITE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(mSmallFont.GetHeight()*CleanYFac),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEMODBYB");
Screen.DrawText(mSmallFont,Font.CR_FIRE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-10,0.,1.);
alf *= 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-21,0.,1.);
str = StringTable.Localize("$SWWM_TITLEINTROA");
Screen.DrawText(mSmallFont,Font.CR_WHITE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(mSmallFont.GetHeight()*CleanYFac*3)/2,str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEINTROB");
Screen.DrawText(mSmallFont,Font.CR_WHITE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(mSmallFont.GetHeight()*CleanYFac)/2,str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEINTROC");
Screen.DrawText(mSmallFont,Font.CR_WHITE,(Screen.GetWidth()-mSmallFont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)+(mSmallFont.GetHeight()*CleanYFac)/2,str,DTA_CleanNoMove,true,DTA_Alpha,alf);
double ar = Screen.GetAspectRatio();
Vector2 tsize = TexMan.GetScaledSize(tex[4]);
double sar = tsize.x/tsize.y;
Vector2 vsize;
if ( sar > ar ) vsize = (tsize.x,tsize.x/ar);
else if ( sar < ar ) vsize = (tsize.y*ar,tsize.y);
else vsize = tsize;
if ( (titletimer+e.FracTic)/GameTicRate < 22 ) return;
if ( bFadeIn ) Screen.Dim("Black",1.-clamp(((titletimer+e.FracTic)/GameTicRate)-22,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
if ( (titletimer+e.FracTic)/GameTicRate < 27 )
{
static const int lofs[] =
{
153, 311, 489, 690, 844, 946, 1065, 1186, 1319, 1493, 1626, 1754, 1910
};
// draw letters one by one
double alph = 1.-clamp(((titletimer+e.FracTic)/GameTicRate)-26.5,0.,1.);
for ( int i=0; i<13; i++ )
{
if ( ((titletimer+e.FracTic)/GameTicRate) < (23.+i*.2) ) continue;
double alf = 1.-clamp((((titletimer+e.FracTic)/GameTicRate)-(23+i*.2))*5.,0.,1.);
double zoom = 1.+.2*alf;
Screen.DrawTexture(letters[i],false,(vsize.x-tsize.x)/2+lofs[i],(vsize.y-tsize.y)/2+513,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_ScaleX,zoom,DTA_ScaleY,zoom,DTA_ColorOverlay,Color(int(128*(alf**2)),255,255,255),DTA_Alpha,alph);
}
}
if ( (titletimer+e.FracTic)/GameTicRate > 25 )
{
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-25.5,0.,1.);
Screen.DrawTexture(tex[4],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf);
}
double scl = Screen.GetHeight()/vsize.y;
double tscl1 = max(1.,floor((Screen.GetHeight()*4.)/vsize.y)+3.);
str = "CODENAME";
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-22,0.,1.);
Screen.DrawText(mBigFont,Font.CR_SAPPHIRE,int(Screen.GetWidth()-tscl1*mBigFont.StringWidth(str))/2,int(Screen.GetHeight()-(scl*400+mBigFont.GetHeight()*tscl1))/2,str,DTA_ScaleX,tscl1,DTA_ScaleY,tscl1,DTA_Alpha,alf);
double tscl2 = max(1.,floor((Screen.GetHeight()*4.)/vsize.y));
if ( !stitle || (lastlang2 != language) )
{
Array<String> done;
Array<int> candidates;
let c = CVar.FindCVar('swwm_titlesubhistory');
String cstr = c.GetString();
int which = 1;
if ( cstr != "" )
{
cstr.Split(done,";");
int nsub = StringTable.Localize("$SWWM_NTITLESUB").ToInt();
for ( int i=1; i<=nsub; i++ )
{
String sn = String.Format("%d",i);
if ( done.Find(sn) < done.Size() ) continue;
candidates.Push(i);
}
if ( candidates.Size() == 0 ) c.SetString("1");
else
{
which = candidates[Random[UIStuff](0,candidates.Size()-1)];
c.SetString(cstr..";"..which);
}
}
else c.SetString("1");
if ( stitle ) stitle.Destroy();
stitle = mBigFont.BreakLines(StringTable.Localize("$SWWM_TITLESUB"..which),int.max);
}
lastlang2 = language;
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-27,0.,1.);
double xx;
double yy = int(Screen.GetHeight()+(scl*360+(1.-alf)*80*tscl2))/2;
for ( int i=0; i<stitle.Count(); i++ )
{
xx = int(Screen.GetWidth()-tscl2*mBigFont.StringWidth(stitle.StringAt(i)))/2;
Screen.DrawText(mBigFont,Font.CR_SAPPHIRE,xx,yy,stitle.StringAt(i),DTA_ScaleX,tscl2,DTA_ScaleY,tscl2,DTA_Alpha,alf);
yy += int(tscl2*mBigFont.GetHeight());
}
if ( (((titletimer+e.FracTic)/GameTicRate) >= 23.) && (((titletimer+e.FracTic)/GameTicRate) < 25.6) )
{
double alf = 1.-SWWMUtility.fract(((titletimer+e.FracTic)/GameTicRate)*5.);
Screen.Dim("White",.05*alf,0,0,Screen.GetWidth(),Screen.GetHeight());
}
}
}
const LOGOFADERBASE = 60000.;
Class LogoFader : Actor
{
Actor base;
SWWMTitleStuff hnd;
Default
{
+NOGRAVITY;
+NOBLOCKMAP;
+NOINTERACTION;
+DONTSPLASH;
Radius .1;
Height 0;
}
override void PostBeginPlay()
{
SetOrigin((LOGOFADERBASE+32,LOGOFADERBASE,0),false);
SetZ(floorz);
roll = 180;
angle = 180;
double halfstretch = (1.+level.pixelstretch)/2.;
if ( !base ) base = Spawn("LogoFaderSurface",(LOGOFADERBASE,LOGOFADERBASE-32.,floorz+32.*halfstretch));
}
override void Tick()
{
// old gzdoom fallback
// won't look as nice, but it's better than nothing
if ( hnd.playtimer == -65536 )
{
double alf = clamp(double((gametic-GameTicRate*3)%(GameTicRate*5))/GameTicRate,0.,1.);
base.SetShade(Color(255,int(255*alf),0));
return;
}
double alf1 = clamp(((double(hnd.playtimer)/GameTicRate)-26.5)*.5,0.,1.);
double alf2 = (hnd.playtimer>28*GameTicRate)?clamp((double((hnd.playtimer-GameTicRate*3)%(GameTicRate*5))/GameTicRate),0.,1.):0.;
base.SetShade(Color(int(255*alf1),int(255*alf2),0));
}
}
Class LogoFaderSurface : Actor
{
Default
{
Radius .1;
Height 0.;
RenderRadius 256;
+NOBLOCKMAP;
+NOGRAVITY;
+NOINTERACTION;
+DONTSPLASH;
+WALLSPRITE;
RenderStyle "Stencil";
}
override void Tick(){}
States
{
Spawn:
LGFD A -1 Bright;
Stop;
}
}