Mod rebranding to "Codename: Demolitionist".

This commit is contained in:
Mari the Deer 2022-01-13 00:27:14 +01:00
commit 4c17c145f1
53 changed files with 632 additions and 110 deletions

View file

@ -115,7 +115,8 @@ Class SWWMCreditsMenu : GenericMenu
String oldlang;
Vector2 ss;
double hs;
int logow, logoh;
Vector2 logosz;
double logow, logoh;
String oldmus;
int oldorder;
@ -139,8 +140,13 @@ Class SWWMCreditsMenu : GenericMenu
Super.Init(parent);
bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any);
UpdateSize();
logo = TexMan.CheckForTexture("graphics/M_SWWM.png",TexMan.Type_Any);
[logow, logoh] = TexMan.GetSize(logo);
logo = TexMan.CheckForTexture(swwm_oldlogo?"graphics/M_SWWM.png":"graphics/M_DEMOLITIONIST.png",TexMan.Type_Any);
logosz = TexMan.GetScaledSize(logo);
if ( !swwm_oldlogo )
{
logosz *= (2./3.);
logosz.y += 36.;
}
stitle = StringTable.Localize("$SWWM_CSTITLE");
stitle2 = StringTable.Localize("$SWWM_CSTITLE2");
sdev = StringTable.Localize("$SWWM_CLEAD");
@ -175,8 +181,7 @@ Class SWWMCreditsMenu : GenericMenu
clocal.Push(new("SWWMCreditsEntry").Init("Marisa Kirisame","$SWWM_LOCES"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Snacks"));
cpatrons.Push(new("SWWMCreditsEntry").Init("john"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Jonas Höglund"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Alexa Jones-Gonzales"));
cpatrons.Push(new("SWWMCreditsEntry").Init("FireFly"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Corey Hectus"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Dac"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Pietro Gagliardi"));
@ -185,7 +190,6 @@ Class SWWMCreditsMenu : GenericMenu
cpatrons.Push(new("SWWMCreditsEntry").Init("John"));
cpatrons.Push(new("SWWMCreditsEntry").Init("VoanHead"));
cpatrons.Push(new("SWWMCreditsEntry").Init("NekoMithos"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Ceyne Taikato"));
cpatrons.Push(new("SWWMCreditsEntry").Init("bouncytem"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Brett Saltzer"));
cpatrons.Push(new("SWWMCreditsEntry").Init("Clint Walker"));
@ -210,9 +214,9 @@ Class SWWMCreditsMenu : GenericMenu
cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CDEVS1","$SWWM_CDEVS2"));
cthanks.Push(new("SWWMCreditsEntry").Init("$SWWM_CYOU1","$SWWM_CYOU2"));
speed = 16.;
spos = ss.y-logoh;
spos = ss.y-logosz.y;
// calc total height
theight = logoh;
theight = int(logosz.y);
theight += 8*(SECTION_PAD+bigfont.GetHeight());
for ( int i=0; i<cdev.Size(); i++ )
{
@ -263,17 +267,18 @@ Class SWWMCreditsMenu : GenericMenu
double DrawLogo( double x, double y )
{
// don't draw if we're offscreen, saves time
if ( (y+logoh < 0) || (y > ss.y) ) return logoh;
Screen.DrawTexture(logo,true,x-logow/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(smallfont,Font.CR_SAPPHIRE,x-smallfont.StringWidth(stitle)/2,y+(logoh-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( (y+logosz.y < 0) || (y > ss.y) ) return logosz.y;
if ( swwm_oldlogo ) Screen.DrawTexture(logo,true,x-logosz.x/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else Screen.DrawTexture(logo,true,x-logosz.x/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,(2./3.),DTA_ScaleY,(2./3.));
Screen.DrawText(smallfont,Font.CR_SAPPHIRE,x-smallfont.StringWidth(stitle)/2,y+(logosz.y-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
// underline
int w = max(smallfont.StringWidth(stitle),smallfont.StringWidth(stitle2));
int cw = int(ceil((w+8)/6.))*6;
double xx = x-cw/2;
for ( int i=0; i<cw; i+=6 )
Screen.DrawChar(smallfont,Font.CR_SAPPHIRE,xx+i,y+(logoh-22),0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(smallfont,Font.CR_WHITE,x-smallfont.StringWidth(stitle2)/2,y+(logoh-9),stitle2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
return logoh;
Screen.DrawChar(smallfont,Font.CR_SAPPHIRE,xx+i,y+(logosz.y-22),0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(smallfont,Font.CR_WHITE,x-smallfont.StringWidth(stitle2)/2,y+(logosz.y-9),stitle2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
return logosz.y;
}
double DrawSection( double x, double y, String txt )
{

View file

@ -284,32 +284,84 @@ Class SWWMCleanMenu : ListMenu
Class SWWMMainMenu : SWWMCleanMenu
{
TextureID demotex;
TextureID demotex, gradtex;
double demopos;
transient uint prevms;
private TextureID GetDemoTex()
{
if ( swwm_oldlogo ) return TexMan.CheckForTexture("graphics/M_DEMOCHAN.png",TexMan.Type_Any);
Array<String> done;
Array<int> candidates;
let c = CVar.FindCVar('swwm_menuposehistory');
String str = c.GetString();
if ( str != "" ) str.Split(done,";");
else
{
c.SetString("2");
return TexMan.CheckForTexture(StringTable.Localize("$SWWM_MENUPOSE2"),TexMan.Type_Any);
}
int npose = StringTable.Localize("$SWWM_NMENUPOSE").ToInt();
for ( int i=1; i<=npose; i++ )
{
String sn = String.Format("%d",i);
if ( done.Find(sn) < done.Size() ) continue;
candidates.Push(i);
}
if ( candidates.Size() == 0 )
{
c.SetString("2");
return TexMan.CheckForTexture(StringTable.Localize("$SWWM_MENUPOSE2"),TexMan.Type_Any);
}
int which = candidates[Random[UIStuff](0,candidates.Size()-1)];
c.SetString(str..";"..which);
return TexMan.CheckForTexture(StringTable.Localize("$SWWM_MENUPOSE"..which),TexMan.Type_Any);
}
override void Init( Menu parent, ListMenuDescriptor desc )
{
Super.Init(parent,desc);
demotex = TexMan.CheckForTexture("graphics/M_DEMOCHAN.png",TexMan.Type_Any);
demotex = GetDemoTex();
demopos = 120;
prevms = MSTime();
}
override void OnReturn()
{
demotex = GetDemoTex();
demopos = 120;
prevms = MSTime();
}
private int GetMenuYOffset()
{
int mofs = CleanHeight_1/2-160;
return mofs;
}
override void Drawer()
{
double frametime = (MSTime()-prevms)/1000.;
double theta = clamp(2.*frametime,0.,1.); // naive, but whatever
if ( prevms ) demopos = demopos*(1.-theta)-40*theta;
double alph = clamp(1.-(demopos/100),0.,1.);
Screen.DrawTexture(demotex,false,(demopos-160)*CleanXFac_1+(Screen.GetWidth()*.5),(Screen.GetHeight()-400*CleanYFac_1)/2 + sin(gametic*GameTicRate*.1)*CleanYFac_1*8*(alph**2),DTA_CleanNoMove_1,true,DTA_Alpha,alph,DTA_ColorOverlay,Color(64+int(191*(1.-(alph**2))),0,0,0));
if ( !swwm_oldlogo )
{
if ( !gradtex ) gradtex = TexMan.CheckForTexture("graphics/M_GRAD.png",TexMan.Type_Any);
double scl = Screen.GetHeight()/960.;
Screen.DrawTexture(gradtex,false,0,Screen.GetHeight(),DTA_DestWidth,Screen.GetWidth(),DTA_DestHeight,256*CleanYFac_1,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_TopOffset,256,DTA_Alpha,.35);
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,Screen.GetHeight(),DTA_Rotate,90,DTA_DestHeight,Screen.GetHeight(),DTA_DestWidthF,600*scl*alph,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_TopOffset,256,DTA_Alpha,alph*.5);
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,0,DTA_Rotate,270,DTA_DestHeight,Screen.GetHeight(),DTA_DestWidthF,600*scl*alph,DTA_LegacyRenderStyle,STYLE_Shaded,DTA_FillColor,Color(0,0,0),DTA_TopOffset,256,DTA_Alpha,alph*.5);
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,Screen.GetHeight(),DTA_Rotate,90,DTA_DestHeight,Screen.GetHeight(),DTA_DestWidthF,500*scl*alph,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,Color(40,80,120),DTA_TopOffset,256,DTA_Alpha,alph);
Screen.DrawTexture(gradtex,false,Screen.GetWidth()/2,0,DTA_Rotate,270,DTA_DestHeight,Screen.GetHeight(),DTA_DestWidthF,500*scl*alph,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,Color(40,80,120),DTA_TopOffset,256,DTA_Alpha,alph);
Screen.DrawTexture(demotex,false,Screen.GetWidth()/2,0,DTA_ScaleX,scl,DTA_ScaleY,scl,DTA_Alpha,alph,DTA_ColorOverlay,Color(int(255*(1.-(alph**2))),0,0,0));
}
else Screen.DrawTexture(demotex,false,(demopos-160)*CleanXFac_1+(Screen.GetWidth()*.5),(Screen.GetHeight()-400*CleanYFac_1)/2 + sin(gametic*GameTicRate*.1)*CleanYFac_1*8*(alph**2),DTA_CleanNoMove_1,true,DTA_Alpha,alph,DTA_ColorOverlay,Color(64+int(191*(1.-(alph**2))),0,0,0));
if ( !swwm_oldlogo ) for ( int i=0; i<mDesc.mItems.Size(); i++ )
mDesc.mItems[i].OffsetPositionY(GetMenuYOffset());
Super.Drawer();
if ( !swwm_oldlogo ) for ( int i=0; i<mDesc.mItems.Size(); i++ )
mDesc.mItems[i].OffsetPositionY(-GetMenuYOffset());
int xx, yy;
String str = StringTable.Localize("$SWWM_MODVER");
int width = smallfont.StringWidth(str)+8;
@ -320,6 +372,16 @@ Class SWWMMainMenu : SWWMCleanMenu
Screen.DrawText(smallfont,Font.CR_GOLD,(xx+4)*CleanXFac_1,(yy+2)*CleanYFac_1,str,DTA_CleanNoMove_1,true);
prevms = MSTime();
}
override bool MouseEvent( int type, int x, int y )
{
if ( !swwm_oldlogo ) for ( int i=0; i<mDesc.mItems.Size(); i++ )
mDesc.mItems[i].OffsetPositionY(GetMenuYOffset());
let res = Super.MouseEvent(type,x,y);
if ( !swwm_oldlogo ) for ( int i=0; i<mDesc.mItems.Size(); i++ )
mDesc.mItems[i].OffsetPositionY(-GetMenuYOffset());
return res;
}
}
// skill/episode menu hack
@ -536,35 +598,42 @@ Class ListMenuItemSWWMStaticTextM : ListMenuItem
// scaled SWWM GZ logo
class ListMenuItemSWWMLogo : ListMenuItem
{
TextureID mTexture;
TextureID mTexture, mOldTexture;
void Init( ListMenuDescriptor desc )
{
Super.Init(desc.mXpos,desc.mYpos);
mTexture = TexMan.CheckForTexture("graphics/M_SWWM.png",TexMan.Type_Any);
mTexture = TexMan.CheckForTexture("graphics/M_DEMOLITIONIST.png",TexMan.Type_Any);
mOldTexture = TexMan.CheckForTexture("graphics/M_SWWM.png",TexMan.Type_Any);
}
private int GetMenuYOffset()
{
int mofs = CleanHeight_1/2-160;
return mofs;
}
override void Draw( bool selected, ListMenuDescriptor desc )
{
if ( !mTexture.Exists() )
let tex = swwm_oldlogo?mOldTexture:mTexture;
if ( !tex.Exists() )
return;
int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale;
int h = desc?desc.DisplayHeight():-1;
Vector2 vs = TexMan.GetScaledSize(mTexture);
double scl = 256./vs.x;
vs *= scl;
Vector2 vs = TexMan.GetScaledSize(tex);
double scl = swwm_oldlogo?(256./vs.x):(2./3.);
double x;
if ( w == ListMenuDescriptor.CleanScale )
{
x = (320-vs.x)/2;
double y = -48;
x = (320-vs.x*scl)/2;
double y = swwm_oldlogo?(-48):(-24+GetMenuYOffset());
SWWMUtility.AdjustClean_1(x,y);
Screen.DrawTexture(mTexture,false,x,y,DTA_ScaleX,CleanXFac_1*scl,DTA_ScaleY,CleanYFac_1*scl);
Screen.DrawTexture(tex,false,x,y,DTA_ScaleX,CleanXFac_1*scl,DTA_ScaleY,CleanYFac_1*scl);
}
else
{
x = (w-vs.x)/2;
Screen.DrawTexture(mTexture,false,x,-48,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_ScaleX,scl,DTA_ScaleY,scl);
x = (w-vs.x*scl)/2;
Screen.DrawTexture(tex,false,x,swwm_oldlogo?(-48):(-24+GetMenuYOffset()),DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_ScaleX,scl,DTA_ScaleY,scl);
}
}
}
@ -777,17 +846,17 @@ class ListMenuItemSWWMTextItemM : ListMenuItemSelectable
yofs *= CleanYFac_1;
double x = (320-GetWidth())/2;
SWWMUtility.AdjustClean_1(x,y);
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_CleanNoMove_1,true,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (320+GetWidth())/2;
SWWMUtility.AdjustClean_1x(x);
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_CleanNoMove_1,true,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
}
else
{
double x = (w-GetWidth())/2;
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (w+GetWidth())/2;
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
}
}
}
@ -838,21 +907,24 @@ Class ListMenuItemSWWMPatchItemM : ListMenuItemSelectable
if ( tex.isNull() ) return;
int w = desc?desc.DisplayWidth():ListMenuDescriptor.CleanScale;
int h = desc?desc.DisplayHeight():-1;
Vector2 vs = TexMan.GetScaledSize(mTexture);
double y = mYpos+vs.y/2;
double y = mYpos+mHeight/2;
if ( w == ListMenuDescriptor.CleanScale )
{
double x = (320-vs.x)/2;
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_Clean,true,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (320+vs.x)/2;
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_Clean,true,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
xofs *= CleanXFac_1;
yofs *= CleanYFac_1;
double x = (320-GetWidth())/2;
SWWMUtility.AdjustClean_1(x,y);
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (320+GetWidth())/2;
SWWMUtility.AdjustClean_1x(x);
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
}
else
{
double x = (w-vs.x)/2;
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (w+vs.x)/2;
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
double x = (w-GetWidth())/2;
Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,15.*sin(8*Menu.MenuTime()));
x = (w+GetWidth())/2;
Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_CenterOffset,true,DTA_Rotate,-15.*sin(8*Menu.MenuTime()));
}
}
}

View file

@ -12,16 +12,21 @@ Struct TitleExplosion
Class SWWMTitleStuff : EventHandler
{
ui TextureID tex[4];
ui TextureID tex[5];
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;
ui String lastlang, lastlang2;
ui bool lastlogo;
ui TitleExplosion smk[64];
ui TextureID smk_frame[19];
int titletimer;
ui int rss;
ui int stopinit_t;
bool bFadeIn;
private ui int GetUIRandom()
{
@ -84,13 +89,17 @@ Class SWWMTitleStuff : EventHandler
override void WorldLoaded( WorldEvent e )
{
let f = LogoFader(Actor.Spawn("LogoFader"));
f.hnd = self;
TexMan.SetCameraToTexture(f,"LOGOFADE",90);
titletimer = -300;
let shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
if ( !shnd ) return;
if ( shnd.titlefirst )
{
titletimer = GameTicRate*26; // skip to logo
S_ChangeMusic("music/TRAUMATI.XM",2); // skip to order 2
titletimer = GameTicRate*22; // skip to logo
S_ChangeMusic("music/TRAUMATI.XM",1); // skip to order 1
bFadeIn = true;
}
shnd.titlefirst = true;
}
@ -98,6 +107,12 @@ Class SWWMTitleStuff : EventHandler
override void UiTick()
{
if ( (titletimer > -80) && (titletimer < -20) ) TickExplosions();
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);
}
if ( gamestate != GS_LEVEL ) return;
// you're not supposed to be here
Menu.SetMenu('EndGameMenu');
@ -122,8 +137,8 @@ Class SWWMTitleStuff : EventHandler
override void RenderUnderlay( RenderEvent e )
{
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);
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[3] ) tex[3] = TexMan.CheckForTexture((gameinfo.gametype&GAME_Raven)?"TITLE":"TITLEPIC",TexMan.Type_MiscPatch);
Vector2 tsize, vsize;
@ -155,42 +170,25 @@ Class SWWMTitleStuff : EventHandler
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;
double ar = Screen.GetAspectRatio();
tsize = TexMan.GetScaledSize(tex[0]);
double 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;
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(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.GetHeight())/2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alf);
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(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.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);
if ( swwm_oldlogo ) Render_OldTitle(e,ss);
else Render_NewTitle(e);
if ( (titletimer/GameTicRate) < 30 ) return;
// scrolls
if ( (scrolls.Size() <= 0 ) || (lastlang != language) )
if ( (scrolls.Size() <= 0 ) || (lastlang != language) || ((sline == 0) && (lastlogo != swwm_oldlogo)) )
{
scrolls.Clear();
String sstr = StringTable.Localize("$SWWM_TITLESCROLL");
sstr.Split(scrolls,"\n");
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;
// estimate scrool length
lastlogo = swwm_oldlogo;
// estimate scroll length
double llen = smallfont.StringWidth(scrolls[sline]);
double soffset = 40*((titletimer+e.FracTic)/GameTicRate-sbase);
if ( soffset > llen+ss.x )
@ -202,6 +200,7 @@ Class SWWMTitleStuff : EventHandler
}
double xx = ss.x-soffset;
int tlen = scrolls[sline].CodePointCount();
double alf;
for ( int i=0, pos=0; i<tlen; i++ )
{
int ch;
@ -210,13 +209,13 @@ Class SWWMTitleStuff : EventHandler
{
for ( double trl = .1; trl < 1.; trl += .04 )
{
double yy = (ss.y-40)+10*sin(15*i+160*(titletimer+e.FracTic)/GameTicRate-90.*(1.-trl));
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(smallfont,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-40)+10*sin(15*i+160*(titletimer+e.FracTic)/GameTicRate);
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);
@ -225,4 +224,204 @@ Class SWWMTitleStuff : EventHandler
xx += smallfont.GetCharWidth(ch)+smallfont.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(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.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(smallfont,Font.CR_WHITE,(ss.x-smallfont.StringWidth(str))/2,(ss.y-smallfont.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(smallfont,Font.CR_FIRE,(Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(smallfont.GetHeight()*CleanYFac),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEPRESENTSB");
Screen.DrawText(smallfont,Font.CR_WHITE,(Screen.GetWidth()-smallfont.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(smallfont,Font.CR_WHITE,(Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(smallfont.GetHeight()*CleanYFac),str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEMODBYB");
Screen.DrawText(smallfont,Font.CR_FIRE,(Screen.GetWidth()-smallfont.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(smallfont,Font.CR_WHITE,(Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(smallfont.GetHeight()*CleanYFac*3)/2,str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEINTROB");
Screen.DrawText(smallfont,Font.CR_WHITE,(Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)-(smallfont.GetHeight()*CleanYFac)/2,str,DTA_CleanNoMove,true,DTA_Alpha,alf);
str = StringTable.Localize("$SWWM_TITLEINTROC");
Screen.DrawText(smallfont,Font.CR_WHITE,(Screen.GetWidth()-smallfont.StringWidth(str)*CleanXFac)/2,(Screen.GetHeight()/2)+(smallfont.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./3.,(floor((Screen.GetHeight()*3.)/vsize.y)+4.)/3.);
str = "CODENAME";
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-22,0.,1.);
Screen.DrawText(BigFont,Font.CR_SAPPHIRE,(Screen.GetWidth()-tscl1*BigFont.StringWidth(str))/2,(Screen.GetHeight()-(scl*400+BigFont.GetHeight()*tscl1))/2,str,DTA_ScaleX,tscl1,DTA_ScaleY,tscl1,DTA_Alpha,alf);
double tscl2 = max(1./3.,(floor((Screen.GetHeight()*3.)/vsize.y)+1.)/3.);
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 = BigFont.BreakLines(StringTable.Localize("$SWWM_TITLESUB"..which),int.max);
}
lastlang2 = language;
alf = clamp(((titletimer+e.FracTic)/GameTicRate)-27,0.,1.);
double xx;
double yy = (Screen.GetHeight()+(scl*360+(1.-alf)*80*tscl2))/2;
for ( int i=0; i<stitle.Count(); i++ )
{
xx = (Screen.GetWidth()-tscl2*BigFont.StringWidth(stitle.StringAt(i)))/2;
Screen.DrawText(BigFont,Font.CR_SAPPHIRE,xx,yy,stitle.StringAt(i),DTA_ScaleX,tscl2,DTA_ScaleY,tscl2,DTA_Alpha,alf);
yy += tscl2*BigFont.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()
{
double alf1 = clamp(((double(hnd.titletimer)/GameTicRate)-26.5)*.5,0.,1.);
double alf2 = (hnd.titletimer>28*GameTicRate)?clamp((double((hnd.titletimer-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;
}
}