swwmgz_m/zscript/compat/swwm_shame.zsc

200 lines
7.4 KiB
Text

// SHAMEFUL DISPLAY
// Hello yes how do I explain this?
//
// Some people try to autoload this stuff without realizing that not all big
// gameplay mods can be combined just like that, they will break in funky ways™
//
// For those who are not aware, there are "monsters only" versions of these
// types of mods, and you can load them fine, they should just work™
//
// Still, if you insist on doing "the funny thing", this event handler is there
// so you know what I think of your attempt at being funny
//
// So, yeah, thanks for giving me an excuse to make this silly script
//
// PS: I actually like Project Brutality, no joke
// Brutal Doom is still poopy junk tho, every single fork of it is better
// (except Black Edition, that one is just embarrassing)
Class SWWMBrutalHandler : StaticEventHandler
{
Mixin SWWMUIRandom;
ui int timer;
ui Font fnt;
ui TextureID eztex[7];
ui bool ezstate[7];
ui float ezslide[4];
ui String eztext[5];
ui BrokenLines ezlines[5];
ui Vector2 eztextpos[5];
ui double ezlinesw[5];
ui int ezcolor[5];
bool detected;
override void OnRegister()
{
// check for brutal doom
if ( FindClass('Doomer','PlayerPawn') || FindClass('BDoomer','PlayerPawn') || FindClass('BEDoomer','PlayerPawn') )
detected = true;
if ( !detected )
return;
let shnd = SWWMStaticHandler(StaticEventHandler.Find('SWWMStaticHandler'));
shnd.isbd = true;
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cfIf you have BD on your autoload you really shouldn't.\cx ┃\c-\n"
"\cx┃ \cfIf you manually loaded it with this mod, why would you?\cx ┃\c-\n"
"\cx┃ \cfThey're not compatible and never will be.\cx ┃\c-\n"
"\cx┃ \cfThis mod will now shit the bed once you go in-game,\cx ┃\c-\n"
"\cx┃ \cfand trust me, it's better this way.\cx ┃\c-\n"
"\cx┃ \cf<See you again, have a nice day>\cx ┃\c-\n"
"\cx┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\c-");
S_StartSound("compat/warn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
override void WorldLoaded( WorldEvent e )
{
// get rid of ourselves if not needed
if ( !detected && !bDestroyed )
Destroy();
}
override void UiTick()
{
if ( !detected || (gamestate != GS_LEVEL) )
{
timer = 0;
return;
}
switch ( timer )
{
case 50:
eztex[0] = TexMan.CheckForTexture("graphics/BDScreen/BDBorder.png");
eztex[1] = TexMan.CheckForTexture("graphics/BDScreen/BDSaya.png");
eztex[2] = TexMan.CheckForTexture("graphics/BDScreen/BDDemo.png");
eztex[3] = TexMan.CheckForTexture("graphics/BDScreen/BDBubble0.png");
eztex[4] = TexMan.CheckForTexture("graphics/BDScreen/BDBubble1.png");
eztex[5] = TexMan.CheckForTexture("graphics/BDScreen/BDBubble2.png");
eztex[6] = TexMan.CheckForTexture("graphics/BDScreen/BDBubble3.png");
for ( int i=0; i<6; i++ ) ezstate[i] = false;
for ( int i=0; i<4; i++ ) ezslide[i] = 1400.;
eztext[0] = "Eeeeeh?\nReally\nnow\n!?";
eztext[1] = "\c[BDRed]Brutal\nDoom\c-?\n\nThat's\ncringe";
eztext[2] = "Only a\ncomplete\nfool\nwould try\nto load\n\c[BDRed]Brutal Doom\c-\nwith\nother game-\nplay mods,\nright?";
eztext[3] = "Ha\nha\nha\nha";
eztext[4] = "Ki\nhi\nhi\nhi";
eztextpos[0] = (1250.,50.);
eztextpos[1] = (810.,790.);
eztextpos[2] = (40.,70.);
eztextpos[3] = (50.,830.);
eztextpos[4] = (150.,830.);
ezcolor[0] = Font.FindFontColor('BDSayaRed');
ezcolor[1] = Font.FindFontColor('BDSayaRed');
ezcolor[2] = Font.FindFontColor('BDDemoGreen');
ezcolor[3] = Font.FindFontColor('BDDemoGreen');
ezcolor[4] = Font.FindFontColor('BDSayaRed');
fnt = Font.GetFont('TewiFontOutline');
for ( int i=0; i<5; i++ )
{
ezlines[i] = fnt.BreakLines(eztext[i],500);
ezlinesw[i] = 0.;
for ( int j=0; j<ezlines[i].Count(); j++ )
ezlinesw[i] = max(ezlinesw[i],ezlines[i].StringWidth(j));
}
S_StartSound("misc/spawn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1.,ATTN_NONE);
S_StartSound("misc/spawn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1.,ATTN_NONE);
S_ChangeMusic("",force:true);
case 60:
ezstate[0] = true;
break;
case 80:
ezstate[2] = true;
break;
case 120:
ezstate[3] = true;
break;
case 180:
ezstate[1] = true;
break;
case 200:
ezstate[4] = true;
break;
case 280:
ezstate[5] = true;
ezstate[6] = true;
break;
case 400:
ThrowAbortException("This manual abort is for your own safety");
break;
}
if ( ezstate[0] )
{
ezslide[1] = ezslide[0];
if ( ezslide[0] < double.epsilon ) ezslide[0] = 0.;
else ezslide[0] *= .8;
}
if ( ezstate[1] )
{
ezslide[3] = ezslide[2];
if ( ezslide[2] < double.epsilon ) ezslide[2] = 0.;
else ezslide[2] *= .8;
}
timer++;
}
override void WorldTick()
{
if ( !detected ) return;
for ( int i=0; i<MAXPLAYERS; i++ ) if ( playeringame[i] ) players[i].cheats |= CF_TOTALLYFROZEN;
}
override void RenderOverlay( RenderEvent e )
{
if ( !detected ) return;
Screen.Dim(0xFF000000,clamp((timer+e.fractic)/50.,0.,.5),0,0,Screen.GetWidth(),Screen.GetHeight());
if ( timer < 50 ) return;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.)/3.;
Vector2 pos = ((Screen.GetWidth()-(1400.*hs))/2.,(Screen.GetHeight()-(1050.*hs))/2.);
if ( timer > 300 )
{
double fact = clamp(((timer+e.fractic)-300.)/100.,0.,1.);
Screen.Dim(0xFFFF0000,fact,0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Add);
SetUIRandom(MSTime()/10);
pos.x += RandomShiver()*64.*hs*fact*fact;
pos.y += RandomShiver()*64.*hs*fact*fact;
}
Screen.SetClipRect(int(pos.x),int(pos.y),int(1400.*hs),int(1050.*hs));
Screen.Dim(0xFFFFFFFF,1.,int(pos.x),int(pos.y),int(1400.*hs),int(1050.*hs));
SetUIRandom(MSTime()/40);
for ( int i=0; i<6; i++ )
{
double ypos = RandomOffset()*1050.*hs;
Screen.DrawThickLine(pos.x,pos.y+ypos,pos.x+1400.*hs,pos.y+ypos,4.*hs,0xFF000000);
}
for ( int i=0; i<12; i++ )
{
double ypos = RandomOffset()*1050.*hs;
Screen.DrawThickLine(pos.x,pos.y+ypos,pos.x+1400.*hs,pos.y+ypos,hs,0xFF000000);
}
if ( ezstate[1] )
Screen.DrawTexture(eztex[2],false,pos.x+SWWMUtility.Lerp(ezslide[3],ezslide[2],e.fractic),pos.y,DTA_ScaleX,hs,DTA_ScaleY,hs);
if ( ezstate[0] )
Screen.DrawTexture(eztex[1],false,pos.x+SWWMUtility.Lerp(ezslide[1],ezslide[0],e.fractic),pos.y,DTA_ScaleX,hs,DTA_ScaleY,hs);
for ( int i=0; i<5; i++ )
{
if ( !ezstate[2+i] ) continue;
if ( i<4 ) Screen.DrawTexture(eztex[3+i],false,pos.x,pos.y,DTA_ScaleX,hs,DTA_ScaleY,hs);
for ( int j=0; j<ezlines[i].Count(); j++ )
{
double xofs = (ezlinesw[i]-ezlines[i].StringWidth(j))*1.5*hs;
double yofs = (fnt.GetHeight()+2)*j*3.*hs;
Screen.DrawText(fnt,ezcolor[i],pos.x+eztextpos[i].x*hs+xofs,pos.y+eztextpos[i].y*hs+yofs,ezlines[i].StringAt(j),DTA_ScaleX,hs*3.,DTA_ScaleY,hs*3.);
}
}
Screen.ClearClipRect();
Screen.DrawTexture(eztex[0],false,pos.x,pos.y,DTA_ScaleX,hs,DTA_ScaleY,hs);
if ( timer > 300 )
Screen.Dim(0xFFFF0000,clamp(((timer+e.fractic)-350.)/50.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Translucent);
}
}