swwmgz_m/zscript/weapons/swwm_weapons_hud.zsc

240 lines
13 KiB
Text

// DrawWeapon code for all weapons
// Deep Impact
extend Class DeepImpact
{
ui TextureID WeaponBox, AmmoBar;
ui Font AmmoFont;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/DeepImpactDisplay.png");
if ( !AmmoBar ) AmmoBar = TexMan.CheckForTexture("graphics/HUD/DeepImpactBar.png");
if ( !AmmoFont ) AmmoFont = Font.GetFont("MiniHudShadow");
Screen.DrawTexture(WeaponBox,false,bx-24,by-25,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double chg = clamp(ChargeInter?ChargeInter.GetValue(TicFrac):clipcount,0.,100.);
bool blinking = (failtime>gametic)&&((failtime-gametic)%8>=4);
Screen.DrawText(AmmoFont,Font.FindFontColor("MiniIce"),bx-22,by-8,String.Format("%3d",clamp(int(chg),0,100)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,blinking?Color(128,0,0,0):Color(0,0,0,0));
double ch = chg*20./100.;
Screen.DrawTexture(AmmoBar,false,bx-5,by-(2+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcY,20.-ch,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,Color(255,0,0,0));
Screen.DrawTexture(AmmoBar,false,bx-6,by-(3+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcY,20.-ch,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,blinking?Color(128,0,0,0):Color(0,0,0,0));
}
}
// Explodium Gun
extend Class ExplodiumGun
{
ui TextureID WeaponBox, RoundTex;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ExplodiumDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/ExplodiumRound.png");
Screen.DrawTexture(WeaponBox,false,bx-10,by-21,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( chambered ) Screen.DrawTexture(RoundTex,false,bx-8,by-19,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<clipcount; i++ ) Screen.DrawTexture(RoundTex,false,bx-8,by-(16-i*2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
extend Class DualExplodiumGun
{
ui TextureID WeaponBox, RoundTex;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ExplodiumDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/ExplodiumRound.png");
Screen.DrawTexture(WeaponBox,false,bx-22,by-21,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( chambered ) Screen.DrawTexture(RoundTex,false,bx-20,by-19,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<clipcount; i++ ) Screen.DrawTexture(RoundTex,false,bx-20,by-(16-i*2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture(WeaponBox,false,bx-10,by-21,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( ExplodiumGun(SisterWeapon).chambered ) Screen.DrawTexture(RoundTex,false,bx-8,by-19,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<ExplodiumGun(SisterWeapon).clipcount; i++ ) Screen.DrawTexture(RoundTex,false,bx-8,by-(16-i*2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
// Spreadgun
extend Class Spreadgun
{
ui TextureID WeaponBox, RoundTex[2];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/SpreadgunDisplay.png");
if ( !RoundTex[0] ) RoundTex[0] = TexMan.CheckForTexture("graphics/HUD/ShellRed.png");
if ( !RoundTex[1] ) RoundTex[1] = TexMan.CheckForTexture("graphics/HUD/ShellGold.png");
Screen.DrawTexture(WeaponBox,false,bx-13,by-8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( !chambered ) return;
Screen.DrawTexture(RoundTex[goldload],false,bx-11,by-6,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(fired?128:0,0,0,0));
}
}
// Wallbuster (less of a fuck in the alt hud)
extend Class Wallbuster
{
ui TextureID WeaponBox, RoundTex, CursorTex;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/WallbusterDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/ShellRedSmall.png");
if ( !CursorTex ) CursorTex = TexMan.CheckForTexture("graphics/HUD/WallbusterCursor.png");
Screen.DrawTexture(WeaponBox,false,bx-12,by-75,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int curpos = 73-(rotation[5]*15+rotation[rotation[5]]*2);
Screen.DrawTexture(CursorTex,false,bx-10,by-curpos,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<25; i++ )
{
curpos = 73-(i*2+(i/5)*5);
if ( !loaded[i] ) continue;
Screen.DrawTexture(RoundTex,false,bx-8,by-curpos,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(fired[i]?128:0,0,0,0));
}
}
}
// Eviscerator
extend Class Eviscerator
{
ui TextureID WeaponBox, RoundTex, SpreadIcon[2];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/EvisceratorDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/EvisceratorRound.png");
if ( !SpreadIcon[0] ) SpreadIcon[0] = TexMan.CheckForTexture("graphics/HUD/EvisceratorWide.png");
if ( !SpreadIcon[1] ) SpreadIcon[1] = TexMan.CheckForTexture("graphics/HUD/EvisceratorTight.png");
Screen.DrawTexture(WeaponBox,false,bx-10,by-20,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture(RoundTex,false,bx-8,by-8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,chambered?Color(0,0,0,0):Color(128,0,0,0));
Screen.DrawTexture(SpreadIcon[extended],false,bx-8,by-18,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
// Hellblazer
extend Class Hellblazer
{
ui TextureID WeaponBox, RoundTex;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/HellblazerDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/HellblazerMissile.png");
Screen.DrawTexture(WeaponBox,false,bx-13,by-29,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int yy = 27;
for ( int i=0; i<6; i++ )
{
Screen.DrawTexture(RoundTex,false,bx-11,by-yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,((i<=magpos)&&(i>=(magpos-preload)))?magstate[i]?Color(128,0,0,0):Color(0,0,0,0):magstate[i]?Color(160,0,0,0):Color(96,0,0,0),DTA_Desaturate,magstate[i]?192:0);
yy -= 4;
}
}
}
// Biospark Carbine
extend Class Sparkster
{
ui TextureID WeaponBox, RoundTex[2];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/BiosparkDisplay.png");
if ( !RoundTex[0] ) RoundTex[0] = TexMan.CheckForTexture("graphics/HUD/BiosparkShot.png");
if ( !RoundTex[1] ) RoundTex[1] = TexMan.CheckForTexture("graphics/HUD/BiosparkRed.png");
bool blinking = (failtime>gametic)&&((failtime-gametic)%16>=8);
if ( doublestacc )
{
Screen.DrawTexture(WeaponBox,false,bx-8,by-34,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture(WeaponBox,false,bx-8,by-17,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( nomag ) return;
bool bRed;
int yy = 32;
for ( int i=0; i<8; i++ )
{
if ( clipcount <= i ) Screen.DrawTexture(RoundTex[0],false,bx-6,by-yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Desaturate,255,DTA_ColorOverlay,Color(160,0,0,0));
else
{
bRed = ((i>=4)&&(clipcount<6)||(i<4)&&(clipcount<2));
Screen.DrawTexture(RoundTex[bRed],false,bx-6,by-yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(blinking?96:0,0,0,0));
}
yy -= 3;
if ( i == 3 ) yy -= 5;
}
}
else
{
Screen.DrawTexture(WeaponBox,false,bx-8,by-17,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( nomag ) return;
bool bRed;
int yy = 15;
for ( int i=0; i<4; i++ )
{
if ( clipcount <= i ) Screen.DrawTexture(RoundTex[0],false,bx-6,by-yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Desaturate,255,DTA_ColorOverlay,Color(160,0,0,0));
else
{
bRed = (clipcount<2);
Screen.DrawTexture(RoundTex[bRed],false,bx-6,by-yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(blinking?96:0,0,0,0));
}
yy -= 3;
}
}
}
}
// Silver Bullet JET
extend Class SilverBullet
{
ui TextureID WeaponBox[2], ZoomBar, RoundTex[2];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox[0] ) WeaponBox[0] = TexMan.CheckForTexture("graphics/HUD/SilverBulletDisplay.png");
if ( !WeaponBox[1] ) WeaponBox[1] = TexMan.CheckForTexture("graphics/HUD/SilverBulletZoomDisplay.png");
if ( !ZoomBar ) ZoomBar = TexMan.CheckForTexture("graphics/HUD/SilverBulletZoomBar.png");
if ( !RoundTex[0] ) RoundTex[0] = TexMan.CheckForTexture("graphics/HUD/SilverBulletRound.png");
if ( !RoundTex[1] ) RoundTex[1] = TexMan.CheckForTexture("graphics/HUD/SilverBulletCasing.png");
double zl = clamp(ZoomInter?ZoomInter.GetValue(TicFrac):(zoomlevel*10),0.,160.);
if ( zl >= 10. )
{
Screen.DrawTexture(WeaponBox[1],false,bx-20,by-39,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double zw = zl*15./160.;
Screen.DrawTexture(ZoomBar,false,bx-17,by-36,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,zw,DTA_ColorOverlay,Color(255,0,0,0));
Screen.DrawTexture(ZoomBar,false,bx-18,by-37,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,zw);
}
Screen.DrawTexture(WeaponBox[0],false,bx-20,by-29,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( chambered ) Screen.DrawTexture(RoundTex[fired],false,bx-18,by-27,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<clipcount; i++ )
Screen.DrawTexture(RoundTex[0],false,bx-18,by-(22-i*4),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
// Candy Gun
extend Class CandyGun
{
ui TextureID WeaponBox, RoundTex;
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ExplodiumDisplay.png");
if ( !RoundTex ) RoundTex = TexMan.CheckForTexture("graphics/HUD/CandyRound.png");
Screen.DrawTexture(WeaponBox,false,bx-10,by-21,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( chambered ) Screen.DrawTexture(RoundTex,false,bx-8,by-19,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<clipcount; i++ ) Screen.DrawTexture(RoundTex,false,bx-8,by-(16-i*2),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
// Ynykron
extend Class Ynykron
{
ui TextureID WeaponBox, ChargeBar[2], BoxSide[2];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/YnykronDisplay.png");
if ( !ChargeBar[0] ) ChargeBar[0] = TexMan.CheckForTexture("graphics/HUD/YnykronBarBeam.png");
if ( !ChargeBar[1] ) ChargeBar[1] = TexMan.CheckForTexture("graphics/HUD/YnykronBarVortex.png");
if ( !BoxSide[0] ) BoxSide[0] = TexMan.CheckForTexture("graphics/HUD/YnykronIconBeam.png");
if ( !BoxSide[1] ) BoxSide[1] = TexMan.CheckForTexture("graphics/HUD/YnykronIconVortex.png");
Screen.DrawTexture(WeaponBox,false,bx-10,by-40,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double chg = clamp(ChargeInter?ChargeInter.GetValue(TicFrac):(chargelevel*10),0.,400.);
double ch = chg/16.;
Screen.DrawTexture(BoxSide[inverted],false,bx-8,by-38,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,clipcount?Color(0,0,0,0):Color(128,0,0,0));
Screen.DrawTexture(ChargeBar[inverted],false,bx-7,by-(2+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcY,25.-ch,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,Color(255,0,0,0));
Screen.DrawTexture(ChargeBar[inverted],false,bx-8,by-(3+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcY,25.-ch,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,(chargestate==CS_READY)?Color(int(clamp(sin((level.maptime+TicFrac)*8)*40+24,0.,64.)),255,255,255):Color(0,0,0,0));
}
}