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

@ -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;
}
}