Reimplement intermission input handling.
This commit is contained in:
parent
6fd8bd4810
commit
e1fafcb329
3 changed files with 94 additions and 2 deletions
|
|
@ -8,6 +8,8 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
Font mSmallFont;
|
||||
String tipstr;
|
||||
transient BrokenLines tipl;
|
||||
double bgfade;
|
||||
bool bFade;
|
||||
|
||||
override void Start( wbstartstruct wbstartstruct )
|
||||
{
|
||||
|
|
@ -224,6 +226,19 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
drawNoState();
|
||||
break;
|
||||
}
|
||||
if ( bgfade <= 0. ) return;
|
||||
// redraw BG on top, hiding the rest of the ui
|
||||
TextureID tx;
|
||||
if ( whichart ) tx = arttex;
|
||||
else tx = bgtex;
|
||||
double ar = Screen.GetAspectRatio();
|
||||
Vector2 tsize = TexMan.GetScaledSize(tx);
|
||||
double sar = tsize.x/tsize.y;
|
||||
Vector2 vsize;
|
||||
if ( sar > ar ) vsize = (tsize.y*ar,tsize.y);
|
||||
else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar);
|
||||
else vsize = tsize;
|
||||
Screen.DrawTexture(tx,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,bgfade);
|
||||
}
|
||||
override void Ticker( void )
|
||||
{
|
||||
|
|
@ -244,6 +259,9 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
// sorry nothing
|
||||
break;
|
||||
}
|
||||
// check fade
|
||||
if ( bFade ) bgfade = min(1.,bgfade+3./GameTicRate);
|
||||
else bgfade = max(0.,bgfade-4./GameTicRate);
|
||||
// force toggle
|
||||
if ( !swwm_interart && (whichart != 0) )
|
||||
{
|
||||
|
|
@ -267,6 +285,65 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
if ( b <= 0 ) return inv?0:100; // for "missed" percentage
|
||||
return (a*100)/b;
|
||||
}
|
||||
|
||||
override bool OnEvent( InputEvent evt )
|
||||
{
|
||||
if ( evt.type == InputEvent.Type_KeyDown )
|
||||
{
|
||||
Array<int> usekey, firekey, altfirekey, reloadkey, zoomkey;
|
||||
Bindings.GetAllKeysForCommand(usekey,"+use");
|
||||
for ( int i=0; i<usekey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != usekey[i] ) continue;
|
||||
accelerateStage = 1;
|
||||
return true;
|
||||
}
|
||||
Bindings.GetAllKeysForCommand(firekey,"+attack");
|
||||
for ( int i=0; i<firekey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != firekey[i] ) continue;
|
||||
accelerateStage = 1;
|
||||
return true;
|
||||
}
|
||||
Bindings.GetAllKeysForCommand(altfirekey,"+altattack");
|
||||
for ( int i=0; i<altfirekey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != altfirekey[i] ) continue;
|
||||
bFade = true;
|
||||
return true;
|
||||
}
|
||||
Bindings.GetAllKeysForCommand(reloadkey,"+reload");
|
||||
for ( int i=0; i<reloadkey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != reloadkey[i] ) continue;
|
||||
if ( !swwm_nointertips ) PlaySound("menu/demoscroll");
|
||||
whichtip = 0;
|
||||
return true;
|
||||
}
|
||||
Bindings.GetAllKeysForCommand(zoomkey,"+zoom");
|
||||
for ( int i=0; i<zoomkey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != zoomkey[i] ) continue;
|
||||
if ( swwm_interart ) PlaySound("menu/demoscroll");
|
||||
whichart = 0;
|
||||
arttex.SetNull();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if ( evt.type == InputEvent.Type_KeyUp )
|
||||
{
|
||||
Array<int> altfirekey;
|
||||
Bindings.GetAllKeysForCommand(altfirekey,"+altattack");
|
||||
for ( int i=0; i<altfirekey.Size(); i++ )
|
||||
{
|
||||
if ( evt.KeyScan != altfirekey[i] ) continue;
|
||||
bFade = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Class SWWMStatScreen_SP : SWWMStatScreen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue