swwmgz_m/zscript/compat/swwm_shame.zsc

210 lines
6.3 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
Class SWWMBrutalHandler : StaticEventHandler
{
ui int timer;
ui Font fnt;
ui TextureID boydance[10], boykiss;
ui int boyframe, boystate, boyloop1, boyloop2, boytimer, boyseq[12];
bool detected;
String which, whichshort;
const BOYTICRATE = 5;
override void OnRegister()
{
// check for brutal doom
foreach ( cls:AllActorClasses )
{
if ( cls.GetClassName() == 'BDoomer' )
{
detected = true;
which = "Brutal Doom";
whichshort = "BD";
}
else if ( (cls.GetClassName() == 'BrutalDoomer') || (cls.GetClassName() == 'PB_PlayerPawn') )
{
detected = true;
which = "Project Brutality";
whichshort = "PB";
}
if ( !detected ) continue;
let shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler"));
shnd.isbd = true;
shnd.bdname = which;
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cfIf you have "..whichshort.." 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);
break;
}
}
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;
}
if ( timer == 70 )
{
boykiss = TexMan.CheckForTexture("graphics/BDScreen/BOYKISSR.png");
fnt = Font.GetFont("TewiFontOutline");
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);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\n\n\cjYou like playing \cg"..which.."\cj don't you?\c-\n\n\n");
}
else if ( timer == 140 )
{
for ( int i=0; i<10; i++ )
boydance[i] = TexMan.CheckForTexture(String.Format("graphics/BDScreen/BOYKISS%d.png",i));
// map frames to states
boyseq[0] = 0;
boyseq[1] = 1;
boyseq[2] = 2;
boyseq[3] = 3;
boyseq[4] = 4;
boyseq[5] = 5;
boyseq[6] = 3;
boyseq[7] = 2;
boyseq[8] = 6;
boyseq[9] = 7;
boyseq[10] = 8;
boyseq[11] = 9;
S_ChangeMusic("music/thepenis.it",force:true);
}
else if ( timer == 2100 ) ThrowAbortException("This manual abort is for your own safety");
timer++;
if ( timer >= 105 )
{
boyframe = boyseq[boystate];
boytimer++;
if ( boytimer%BOYTICRATE ) return;
// funni state machine
switch ( boystate )
{
case 0: // up
boystate = 1;
break;
case 1: // down
if ( boyloop1 >= 2 )
{
boyloop1 = 0;
boystate = 2;
break;
}
boyloop1++;
boystate = 0;
break;
case 2: // turn A
boystate = 3;
break;
case 3: // turn B
boystate = 4;
break;
case 4: // down
boystate = 5;
break;
case 5: // up
if ( boyloop1 >= 2 )
{
boyloop1 = 0;
boystate = 6;
break;
}
boyloop1++;
boystate = 4;
break;
case 6: // turn B
boystate = 7;
break;
case 7: // turn A
if ( boyloop2 >= 2 )
{
boyloop2 = 0;
boystate = 8;
break;
}
boyloop2++;
boystate = 0;
break;
case 8: // spin left
boystate = 9;
break;
case 9: // spin back
boystate = 10;
break;
case 10: // spin right
boystate = 11;
break;
case 11: // spin front
if ( boyloop1 >= 2 )
{
boyloop1 = 0;
boystate = 0;
break;
}
boyloop1++;
boystate = 8;
break;
}
}
}
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("White",clamp((timer+e.fractic)/70.,0.,1.),0,0,Screen.GetWidth(),Screen.GetHeight());
if ( timer < 70 ) return;
String str = "You like playing \cg"..which.."\c- don't you?";
int boxh = fnt?((fnt.GetHeight()+16)*CleanYFac):0;
double scl = (Screen.GetHeight()-boxh)/2048.;
if ( boykiss.IsValid() ) Screen.DrawTexture(boykiss,false,Screen.GetWidth()/2,(Screen.GetHeight()-boxh)/2,DTA_CenterOffset,true,DTA_ScaleX,scl,DTA_ScaleY,scl);
if ( fnt )
{
Screen.Dim("Black",.8,0,Screen.GetHeight()-boxh,Screen.GetWidth(),boxh);
Screen.DrawText(fnt,Font.CR_WHITE,(Screen.GetWidth()-fnt.StringWidth(str)*CleanXFac)/2,Screen.GetHeight()-(boxh-8*CleanYFac),str,DTA_CleanNoMove,true);
}
if ( timer < 140 ) return;
if ( boydance[boyframe].IsValid() )
{
Screen.DrawTexture(boydance[boyframe],false,112*CleanXFac_1,192*CleanYFac_1,DTA_CleanNoMove_1,true);
Screen.DrawTexture(boydance[boyframe],false,Screen.GetWidth()-112*CleanXFac_1,192*CleanYFac_1,DTA_CleanNoMove_1,true);
Screen.DrawTexture(boydance[boyframe],false,112*CleanXFac_1,Screen.GetHeight()-(boxh+32*CleanYFac_1),DTA_CleanNoMove_1,true);
Screen.DrawTexture(boydance[boyframe],false,Screen.GetWidth()-112*CleanXFac_1,Screen.GetHeight()-(boxh+32*CleanYFac_1),DTA_CleanNoMove_1,true);
}
}
}