Weapons with switchable ammos/modes display nametags on change.
This commit is contained in:
parent
5f44dcd530
commit
e30eb24936
8 changed files with 95 additions and 2 deletions
|
|
@ -92,6 +92,7 @@ Class Hellblazer : SWWMWeapon
|
|||
bool magstate[6]; // true: rocket was spent
|
||||
int magpos; // current rotation
|
||||
Class<Ammo> loadammo, nextammo;
|
||||
ui Class<Ammo> lastammo;
|
||||
int spinskipped;
|
||||
HellblazerXSub pickuprockets[6];
|
||||
|
||||
|
|
@ -178,6 +179,22 @@ Class Hellblazer : SWWMWeapon
|
|||
}
|
||||
}
|
||||
|
||||
override void HudTick()
|
||||
{
|
||||
Super.HudTick();
|
||||
if ( lastammo && (lastammo != nextammo) && (Owner.player == players[consoleplayer]) )
|
||||
{
|
||||
let bar = SWWMStatusBar(statusbar);
|
||||
if ( bar )
|
||||
{
|
||||
bar.ntagstr = GetDefaultByType(nextammo).GetTag();
|
||||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
}
|
||||
lastammo = nextammo;
|
||||
}
|
||||
|
||||
override Vector3 GetTraceOffset()
|
||||
{
|
||||
return (10.,3.5,-5.);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Class Eviscerator : SWWMWeapon
|
|||
bool isfiring;
|
||||
// barrel is extended
|
||||
bool extended;
|
||||
ui int lastmode;
|
||||
// pending shell load
|
||||
bool pendingload;
|
||||
// has shell chambered
|
||||
|
|
@ -72,6 +73,22 @@ Class Eviscerator : SWWMWeapon
|
|||
}
|
||||
}
|
||||
|
||||
override void HudTick()
|
||||
{
|
||||
Super.HudTick();
|
||||
if ( lastmode && (lastmode != extended+1) && (Owner.player == players[consoleplayer]) )
|
||||
{
|
||||
let bar = SWWMStatusBar(statusbar);
|
||||
if ( bar )
|
||||
{
|
||||
bar.ntagstr = StringTable.Localize(extended?"$SWWM_TIGHTSPREAD":"$SWWM_WIDESPREAD");
|
||||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
}
|
||||
lastmode = extended+1;
|
||||
}
|
||||
|
||||
action void A_StartLoad( int delay = 0 )
|
||||
{
|
||||
invoker.pendingload = true;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Class Ynykron : SWWMWeapon
|
|||
int chargestate;
|
||||
double chargelevel;
|
||||
bool inverted, invertreload;
|
||||
ui int lastmode;
|
||||
|
||||
double ventalpha, ventfade;
|
||||
int ventcooldown;
|
||||
|
|
@ -47,6 +48,17 @@ Class Ynykron : SWWMWeapon
|
|||
Super.HudTick();
|
||||
if ( !ChargeInter ) ChargeInter = DynamicValueInterpolator.Create(int(chargelevel*10),.5,1,400);
|
||||
ChargeInter.Update(int(chargelevel*10));
|
||||
if ( lastmode && (lastmode != inverted+1) && (Owner.player == players[consoleplayer]) )
|
||||
{
|
||||
let bar = SWWMStatusBar(statusbar);
|
||||
if ( bar )
|
||||
{
|
||||
bar.ntagstr = StringTable.Localize(inverted?"$SWWM_YNYKRONBACKWARD":"$SWWM_YNYKRONFORWARD");
|
||||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
}
|
||||
lastmode = inverted+1;
|
||||
}
|
||||
|
||||
override bool ReportHUDAmmo()
|
||||
|
|
|
|||
|
|
@ -122,11 +122,28 @@ Class Spreadgun : SWWMWeapon
|
|||
bool chambered; // a shell is actually loaded
|
||||
bool emptyup; // next reload will keep the chamber empty
|
||||
Class<Ammo> loadammo, nextammo; // currently loaded shell, next shell to load
|
||||
ui Class<Ammo> lastammo;
|
||||
bool initialized;
|
||||
|
||||
transient ui TextureID WeaponBox, AmmoIcon[7], LoadedIcon[7];
|
||||
transient ui Font TewiFont;
|
||||
|
||||
override void HudTick()
|
||||
{
|
||||
Super.HudTick();
|
||||
if ( lastammo && (lastammo != nextammo) && (Owner.player == players[consoleplayer]) )
|
||||
{
|
||||
let bar = SWWMStatusBar(statusbar);
|
||||
if ( bar )
|
||||
{
|
||||
bar.ntagstr = GetDefaultByType(nextammo).GetTag();
|
||||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
}
|
||||
lastammo = nextammo;
|
||||
}
|
||||
|
||||
override String GetObituary( Actor victim, Actor inflictor, Name mod, bool playerattack )
|
||||
{
|
||||
if ( loadammo is 'RedShell' ) return StringTable.Localize("$O_SPREADGUN_RED");
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ Class SilverBullet : SWWMWeapon
|
|||
{
|
||||
bool chambered, fired;
|
||||
bool fcbchambered, fcbloaded, fcbselected;
|
||||
ui int lastammo;
|
||||
int clipcount;
|
||||
double casex, casey;
|
||||
|
||||
|
|
@ -316,6 +317,17 @@ Class SilverBullet : SWWMWeapon
|
|||
Super.HudTick();
|
||||
if ( !ZoomInter ) ZoomInter = DynamicValueInterpolator.Create(int(zoomlevel*10),.5,1,20);
|
||||
ZoomInter.Update(int(zoomlevel*10));
|
||||
if ( lastammo && (lastammo != fcbselected+1) && (Owner.player == players[consoleplayer]) )
|
||||
{
|
||||
let bar = SWWMStatusBar(statusbar);
|
||||
if ( bar )
|
||||
{
|
||||
bar.ntagstr = StringTable.Localize(fcbselected?"$SWWM_FCBSEL":"$SWWM_XSBSEL");
|
||||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
}
|
||||
lastammo = fcbselected+1;
|
||||
}
|
||||
|
||||
override bool ReportHUDAmmo()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue