+ Invinciball activation now voiced by Demo (thanks, Vyolette). + Retooled exit line merging (should fix those pesky duplicate exit markers). Note: Oneliners for the Eviternity 2 final boss are not voiced yet.
150 lines
4.2 KiB
Text
150 lines
4.2 KiB
Text
// seeeeeeecret
|
|
|
|
Class DemolitionistSecretTab : DemolitionistMenuTab
|
|
{
|
|
TextureID img;
|
|
String sub;
|
|
BrokenLines l;
|
|
double smofs;
|
|
int ofs, maxofs;
|
|
bool drag;
|
|
|
|
override DemolitionistMenuTab Init( DemolitionistMenu master )
|
|
{
|
|
title = StringTable.Localize("$SWWM_SECRETTAB");
|
|
bHidden = true;
|
|
if ( gameinfo.gametype&GAME_Hexen )
|
|
{
|
|
img = TexMan.CheckForTexture("graphics/KBase/Drawing_Kirin.png");
|
|
sub = StringTable.Localize("$SWWM_FROMKIRIN");
|
|
String str = StringTable.Localize("$SWWM_KIRINPOEM");
|
|
l = master.mSmallFont.BreakLines(str,600);
|
|
}
|
|
else if ( (gameinfo.gametype&GAME_Heretic) || SWWMUtility.IsEviternity() || SWWMUtility.IsEviternityTwo() )
|
|
{
|
|
img = TexMan.CheckForTexture("graphics/KBase/Drawing_Ibuki.png");
|
|
sub = StringTable.Localize("$SWWM_CUTIECLUB");
|
|
}
|
|
else
|
|
{
|
|
img = TexMan.CheckForTexture("graphics/KBase/Drawing_Saya.png");
|
|
sub = StringTable.Localize("$SWWM_TODEMO");
|
|
}
|
|
maxofs = max(0,320-int(master.ws.y-40));
|
|
return Super.Init(master);
|
|
}
|
|
|
|
override void OnDestroy()
|
|
{
|
|
Super.OnDestroy();
|
|
if ( l ) l.Destroy();
|
|
}
|
|
|
|
override void OnSelect()
|
|
{
|
|
bHidden = false;
|
|
smofs = ofs;
|
|
}
|
|
override void OnDeselect()
|
|
{
|
|
bHidden = true;
|
|
smofs = ofs;
|
|
}
|
|
|
|
// called when sending a scroll input
|
|
// returns true if the position actually changed
|
|
// speed: how many pixels to move (either back or forward)
|
|
bool Scroll( int speed )
|
|
{
|
|
int oldofs = ofs;
|
|
ofs = clamp(ofs+speed,0,maxofs);
|
|
return (ofs != oldofs);
|
|
}
|
|
|
|
// called when clicking on our scrollbar
|
|
// returns true if the position actually changed
|
|
// y: relative click position
|
|
bool SetOffset( double y )
|
|
{
|
|
int oldofs = ofs;
|
|
ofs = clamp(int(round((y-20.5)/((master.ws.y-41.)/maxofs))),0,maxofs);
|
|
return (ofs != oldofs);
|
|
}
|
|
|
|
override void MenuInput( int key )
|
|
{
|
|
if ( maxofs <= 0 ) return;
|
|
switch ( key )
|
|
{
|
|
case MK_DOWN:
|
|
if ( Scroll(16) ) master.MenuSound("menu/demoscroll");
|
|
break;
|
|
case MK_UP:
|
|
if ( Scroll(-16) ) master.MenuSound("menu/demoscroll");
|
|
break;
|
|
}
|
|
}
|
|
override void MouseInput( Vector2 pos, int btn )
|
|
{
|
|
if ( maxofs <= 0 ) return;
|
|
switch ( btn )
|
|
{
|
|
case MB_LEFT:
|
|
// see if we're clicking the scrollbar (if it exists)
|
|
if ( pos.x > (master.ws.x-8) )
|
|
{
|
|
SetOffset(pos.y);
|
|
master.MenuSound("menu/demoscroll");
|
|
drag = true;
|
|
}
|
|
break;
|
|
case MB_WHEELUP:
|
|
if ( Scroll(-8) ) master.MenuSound("menu/demoscroll");
|
|
break;
|
|
case MB_WHEELDOWN:
|
|
if ( Scroll(8) ) master.MenuSound("menu/demoscroll");
|
|
break;
|
|
case MB_DRAG:
|
|
if ( drag ) SetOffset(pos.y);
|
|
break;
|
|
case MB_RELEASE:
|
|
drag = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
override void Ticker()
|
|
{
|
|
// update smooth scroll
|
|
smofs = (smofs*.6)+(ofs*.4);
|
|
if ( abs(smofs-ofs) < (1./master.hs) ) smofs = ofs;
|
|
}
|
|
|
|
override void Drawer( double fractic )
|
|
{
|
|
double ssmofs = (smofs~==ofs)?smofs:(smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic);
|
|
double xx = 20;
|
|
double yy;
|
|
if ( maxofs <= 0 ) yy = master.ws.y/2-160;
|
|
else yy = 20-ssmofs;
|
|
Screen.SetClipRect(int((master.origin.x+20)*master.hs),int((master.origin.y+20)*master.hs),int((master.ws.x-40)*master.hs),int((master.ws.y-40)*master.hs));
|
|
Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
|
int mxlen = 0;
|
|
if ( l ) for ( int i=0; i<l.Count(); i++ )
|
|
{
|
|
if ( l.StringWidth(i) > mxlen ) mxlen = l.StringWidth(i);
|
|
xx = (i<l.Count()-1)?350:(350+mxlen-l.StringWidth(i));
|
|
Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+xx,master.origin.y+yy+4+i*14,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
|
}
|
|
yy += 306;
|
|
xx = int(master.ws.x-master.mSmallFont.StringWidth(sub))/2;
|
|
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,sub,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
|
Screen.ClearClipRect();
|
|
if ( maxofs <= 0 ) return;
|
|
xx = master.ws.x-8;
|
|
master.DrawVSeparator(xx,14,master.ws.y-28);
|
|
xx += 2;
|
|
yy = floor(ssmofs*((master.ws.y-39)/maxofs))+14;
|
|
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
|
}
|
|
}
|