swwmgz_m/zscript/compat/swwm_hdoom.zsc

120 lines
4.4 KiB
Text

// HORNY
// enjoy getting bonked, you pervy perv
Class SWWMHDoomHandler : StaticEventHandler
{
int callout_len;
ui int timer;
ui TextureID bonker, bonk, bonked;
bool detected;
ui int rss;
ui Font mBigFont;
private ui int GetUIRandom()
{
return (rss = (rss<<1)*35447+(rss/87));
}
private ui double RandomShiver()
{
int sd = GetUIRandom();
return ((abs(sd)%11)-5)*.1;
}
override void OnRegister()
{
foreach ( cls:AllActorClasses )
{
if ( cls.GetClassName() != "HDoomPlayer" ) continue;
detected = true;
break;
}
if ( !detected )
return;
callout_len = int(ceil((S_GetLength("hdoom/horny")*GameTicRate)/16)*16);
SetRandomSeed[hdscreen](Random[hdscreen]()+consoleplayer+int(MSTimeF()));
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cfOh my, someone appears to be \cgH \ckO \cdR \cvN \chY \ct♥ \cx┃\c-\n"
"\cx┃ \cfWell, too bad, this mod isn't compatible with H-Doom \cx┃\c-\n"
"\cx┃ ┃\c-\n"
"\cx┃ \cfget bonked \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();
}
static bool IsSexyTime( Actor a )
{
Class p = a.GetClass();
while ( p.GetParentClass() && (p.GetParentClass() != 'Actor') )
{
p = p.GetParentClass();
if ( (p.GetClassName() == 'SexActor') || (p.GetClassName() == 'StaticSexActor') )
return true;
}
return false;
}
override void WorldThingSpawned( WorldEvent e )
{
// no interaction available
if ( IsSexyTime(e.Thing) ) e.Thing.bUSESPECIAL = false;
}
override void UiTick()
{
if ( !detected || (gamestate != GS_LEVEL) )
{
timer = 0;
return;
}
if ( timer == 16 )
{
S_StartSound("hdoom/horny",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
S_StartSound("hdoom/horny",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
if ( timer == callout_len+24 )
{
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);
bonker = TexMan.CheckForTexture("graphics/HDoom_Bonker.png");
bonk = TexMan.CheckForTexture("graphics/HDoom_Bonk.png");
bonked = TexMan.CheckForTexture("graphics/HDoom_Bonked.png");
}
else if ( (timer >= callout_len+32) && !(timer%16) )
{
double ptch = FRandom[hdscreen](.95,1.05);
S_StartSound("hdoom/bonk",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE,ptch);
S_StartSound("hdoom/bonk",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE,ptch);
}
timer++;
}
override void RenderOverlay( RenderEvent e )
{
if ( !detected || (timer < callout_len+24) ) return;
if ( !mBigFont ) mBigFont = Font.GetFont('TewiFontOutline');
double scl = max(min(floor(Screen.GetWidth()/120.),floor(Screen.GetHeight()/100)),1.);
double iscl = scl/4.;
double ox = Screen.GetWidth()/2;
double oy = Screen.GetHeight()/2-4*scl;
String str = "HORNY";
double alf = clamp(16-((timer%16)+e.FracTic)*2,0,16)/16.;
rss = MSTime()/10;
Vector2 ofs = (RandomShiver(),RandomShiver())*3.*scl*alf;
Screen.DrawText(mBigFont,Font.CR_SAPPHIRE,ox-(mBigFont.StringWidth(str)*scl*2)/2+ofs.x,oy+8*scl+ofs.y,str,DTA_ScaleX,scl*2,DTA_ScaleY,scl*2);
Screen.DrawText(mBigFont,Font.FindFontColor('MiniFlash'),ox-(mBigFont.StringWidth(str)*scl*2)/2+ofs.x,oy+8*scl+ofs.y,str,DTA_ScaleX,scl*2,DTA_ScaleY,scl*2,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alf);
double phase = cos(((timer+e.FracTic)-32)*22.5)*.5+.5;
Screen.DrawTexture(bonker,false,ox+18*scl,oy,DTA_ScaleX,iscl,DTA_ScaleY,iscl,DTA_Rotate,-15+phase*5);
Screen.DrawTexture(bonked,false,ox-22*scl,oy,DTA_ScaleX,iscl,DTA_ScaleY,iscl*(1.-max(phase-.8,0.)),DTA_Rotate,5-phase*5);
Screen.DrawTexture(bonk,false,ox+10*scl,oy+2*scl,DTA_ScaleX,iscl,DTA_ScaleY,iscl,DTA_Rotate,-45+phase*45);
}
}