titlescreen code cleanup.
This commit is contained in:
parent
dff690c46d
commit
51c1ef11bc
2 changed files with 35 additions and 34 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r225 \cu(Wed 27 Jul 17:07:27 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r225 \cu(2022-07-27 17:07:27)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r226 \cu(Thu 28 Jul 18:00:50 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r226 \cu(2022-07-28 18:00:50)\c-";
|
||||
|
|
|
|||
|
|
@ -175,37 +175,38 @@ Class SWWMTitleStuff : EventHandler
|
|||
if ( titletimer <= -250 ) Screen.Dim("Black",1.-clamp((270+titletimer+e.FracTic)/20.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
|
||||
return;
|
||||
}
|
||||
double GameSecs = (titletimer+e.FracTic)/GameTicRate;
|
||||
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());
|
||||
Screen.Dim("Black",clamp(1.-GameSecs*.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;
|
||||
Render_NewTitle(e);
|
||||
if ( (titletimer/GameTicRate) < 30 ) return;
|
||||
Render_NewTitle(e,GameSecs);
|
||||
if ( GameSecs < 30 ) return;
|
||||
// scrolls
|
||||
if ( (scrolls.Size() <= 0 ) || (lastlang != language) )
|
||||
{
|
||||
scrolls.Clear();
|
||||
int nstr = StringTable.Localize("$SWWM_NTITLESCROLL").ToInt();
|
||||
for ( int i=1; i<=nstr; i++ ) scrolls.Push(StringTable.Localize("$SWWM_TITLESCROLL"..i));
|
||||
sbase = (titletimer+e.FracTic)/GameTicRate;
|
||||
sbase = GameSecs;
|
||||
if ( sline >= scrolls.Size() ) sline = 0;
|
||||
}
|
||||
lastlang = language;
|
||||
// estimate scroll length
|
||||
double llen = mSmallFont.StringWidth(scrolls[sline]);
|
||||
double soffset = 40*((titletimer+e.FracTic)/GameTicRate-sbase);
|
||||
double soffset = 40*(GameSecs-sbase);
|
||||
if ( soffset > llen+ss.x )
|
||||
{
|
||||
sline++;
|
||||
if ( sline >= scrolls.Size() ) sline = 0;
|
||||
sbase = (titletimer+e.FracTic)/GameTicRate;
|
||||
sbase = GameSecs;
|
||||
soffset = 0;
|
||||
}
|
||||
double xx = ss.x-soffset;
|
||||
|
|
@ -219,43 +220,43 @@ Class SWWMTitleStuff : EventHandler
|
|||
{
|
||||
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));
|
||||
double yy = (ss.y-35)+10*sin(15*i+160*GameSecs-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);
|
||||
double xxofs = 5*sin(15*i+120*GameSecs-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);
|
||||
double yy = (ss.y-35)+10*sin(15*i+160*GameSecs);
|
||||
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);
|
||||
double xxofs = 5*sin(15*i+120*GameSecs);
|
||||
Color c = Color(int(127.5+127.5*sin(10*i+80*GameSecs)),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_NewTitle( RenderEvent e )
|
||||
private ui void Render_NewTitle( RenderEvent e, double GameSecs )
|
||||
{
|
||||
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.);
|
||||
double alf = clamp(GameSecs-1,0.,1.);
|
||||
alf *= 1.-clamp(GameSecs-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.);
|
||||
alf = clamp(GameSecs-5,0.,1.);
|
||||
alf *= 1.-clamp(GameSecs-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.);
|
||||
alf = clamp(GameSecs-10,0.,1.);
|
||||
alf *= 1.-clamp(GameSecs-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");
|
||||
|
|
@ -269,36 +270,36 @@ Class SWWMTitleStuff : EventHandler
|
|||
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;
|
||||
double alf1 = clamp((((titletimer+e.FracTic)/GameTicRate)-26.5)*.5,0.,1.);
|
||||
double alf2 = ((titletimer+e.FracTic)/GameTicRate>28)?clamp((double(((titletimer+e.FracTic)-GameTicRate*3)%(GameTicRate*5))/GameTicRate),0.,1.):0.;
|
||||
if ( GameSecs < 22 ) return;
|
||||
double alf1 = clamp((GameSecs-26.5)*.5,0.,1.);
|
||||
double alf2 = (GameSecs>28)?clamp((GameSecs-3)%5,0.,1.):0.;
|
||||
lfade.Clear(0,0,4,4,Color(int(255*alf1),int(255*alf2),0));
|
||||
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 )
|
||||
if ( bFadeIn ) Screen.Dim("Black",1.-clamp(GameSecs-22,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
|
||||
if ( GameSecs < 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.);
|
||||
double alph = 1.-clamp(GameSecs-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.);
|
||||
if ( GameSecs < (23.+i*.2) ) continue;
|
||||
double alf = 1.-clamp((GameSecs-(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 )
|
||||
if ( GameSecs > 25 )
|
||||
{
|
||||
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-25.5,0.,1.);
|
||||
alf = clamp(GameSecs-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.);
|
||||
alf = clamp(GameSecs-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) )
|
||||
|
|
@ -330,7 +331,7 @@ Class SWWMTitleStuff : EventHandler
|
|||
stitle = mBigFont.BreakLines(StringTable.Localize("$SWWM_TITLESUB"..which),int.max);
|
||||
}
|
||||
lastlang2 = language;
|
||||
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-27,0.,1.);
|
||||
alf = clamp(GameSecs-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++ )
|
||||
|
|
@ -339,9 +340,9 @@ Class SWWMTitleStuff : EventHandler
|
|||
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) )
|
||||
if ( (GameSecs >= 23.) && (GameSecs < 25.6) )
|
||||
{
|
||||
double alf = 1.-SWWMUtility.fract(((titletimer+e.FracTic)/GameTicRate)*5.);
|
||||
double alf = 1.-SWWMUtility.fract(GameSecs*5.);
|
||||
Screen.Dim("White",.05*alf,0,0,Screen.GetWidth(),Screen.GetHeight());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue