Implement a "weapon bar" (optional).
This commit is contained in:
parent
8522b47e69
commit
47b0cad882
41 changed files with 443 additions and 5 deletions
|
|
@ -5,6 +5,8 @@ extend Class SWWMHandler
|
|||
transient Array<MenuTransaction> checklist;
|
||||
// for the compact hud
|
||||
transient int WeaponFlash[10];
|
||||
// weapon selector
|
||||
transient ui SWWMWeaponSelect wsel;
|
||||
|
||||
override void ConsoleProcess( ConsoleEvent e )
|
||||
{
|
||||
|
|
@ -511,6 +513,24 @@ extend Class SWWMHandler
|
|||
}
|
||||
else if ( e.Name ~== "swwmccstart" )
|
||||
gdat.ccstartonce = true;
|
||||
else if ( e.Name.Left(14) ~== "swwmselweapon." )
|
||||
{
|
||||
Class<Weapon> wpn = e.Name.Mid(14);
|
||||
if ( !wpn ) return;
|
||||
let w = Weapon(players[e.player].mo.FindInventory(wpn));
|
||||
if ( !w ) return;
|
||||
if ( !w.CheckAmmo(Weapon.EitherFire,false) )
|
||||
{
|
||||
S_StartSound("menu/democlose",CHAN_AUTO,CHANF_UI);
|
||||
return;
|
||||
}
|
||||
players[e.player].mo.UseInventory(w);
|
||||
if ( e.player != consoleplayer ) return;
|
||||
bool rslt = (players[e.player].PendingWeapon == w);
|
||||
if ( (w is 'SWWMWeapon') && (players[e.player].PendingWeapon == w.SisterWeapon) )
|
||||
rslt = true; // switching to dual gun
|
||||
S_StartSound(rslt?"menu/demosel":"menu/democlose",CHAN_AUTO,CHANF_UI);
|
||||
}
|
||||
// cheats go here
|
||||
else CheatEvent(e);
|
||||
}
|
||||
|
|
@ -519,13 +539,50 @@ extend Class SWWMHandler
|
|||
{
|
||||
if ( e.Type != InputEvent.TYPE_KeyDown ) return false;
|
||||
// block invprev/next inputs when paused
|
||||
String cmd = Bindings.GetBinding(e.KeyScan);
|
||||
if ( paused )
|
||||
{
|
||||
String cmd = Bindings.GetBinding(e.KeyScan);
|
||||
if ( (cmd ~== "invprev") || (cmd ~== "invnext") ) return true;
|
||||
// skip the rest of this function
|
||||
return false;
|
||||
}
|
||||
// weapon selector is active
|
||||
int WeapSel = 0;
|
||||
if ( cmd ~== "weapnext" ) WeapSel = 1;
|
||||
else if ( cmd ~== "weapprev" ) WeapSel = -1;
|
||||
if ( wsel && (wsel.stage < 2) )
|
||||
{
|
||||
if ( WeapSel == 1 )
|
||||
{
|
||||
wsel.WeapNext();
|
||||
return true;
|
||||
}
|
||||
if ( WeapSel == -1 )
|
||||
{
|
||||
wsel.WeapPrev();
|
||||
return true;
|
||||
}
|
||||
if ( cmd ~== "+attack" )
|
||||
{
|
||||
wsel.WeapSel();
|
||||
return true;
|
||||
}
|
||||
if ( cmd ~== "+altattack" )
|
||||
{
|
||||
wsel.WeapCancel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( WeapSel && swwm_useweaponbar && !paused && (players[consoleplayer].playerstate == PST_LIVE) && players[consoleplayer].mo && (gamestate == GS_LEVEL) )
|
||||
{
|
||||
// only if player owns any selectable weapons
|
||||
if ( !wsel && SWWMWeaponSelect.PlayerHasWeapons(players[consoleplayer].mo) )
|
||||
{
|
||||
wsel = new("SWWMWeaponSelect").Init(players[consoleplayer].mo);
|
||||
StatusBar.AttachMessage(wsel,-2920);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// F
|
||||
if ( e.KeyChar == 0x66 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue