swwmgz_m/zscript/dlc1/swwm_dlcweapons_hud.zsc

58 lines
3 KiB
Text

// DrawWeapon code for DLC weapons
// Sheen HMG
extend Class HeavyMahSheenGun
{
ui TextureID WeaponBox, BulletTex[2], SpeedTex, BarTex[4];
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
{
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/SheenDisplay.png",TexMan.Type_Any);
if ( !BulletTex[0] ) BulletTex[0] = TexMan.CheckForTexture("graphics/HUD/SheenRound.png",TexMan.Type_Any);
if ( !BulletTex[1] ) BulletTex[1] = TexMan.CheckForTexture("graphics/HUD/SheenCasing.png",TexMan.Type_Any);
if ( !SpeedTex ) SpeedTex = TexMan.CheckForTexture("graphics/HUD/SheenSpeed.png",TexMan.Type_Any);
if ( !BarTex[0] ) BarTex[0] = TexMan.CheckForTexture("graphics/HUD/SheenBar0.png",TexMan.Type_Any);
if ( !BarTex[1] ) BarTex[1] = TexMan.CheckForTexture("graphics/HUD/SheenBar1.png",TexMan.Type_Any);
if ( !BarTex[2] ) BarTex[2] = TexMan.CheckForTexture("graphics/HUD/SheenBar2.png",TexMan.Type_Any);
if ( !BarTex[3] ) BarTex[3] = TexMan.CheckForTexture("graphics/HUD/SheenBar3.png",TexMan.Type_Any);
Screen.DrawTexture(WeaponBox,false,bx-23,by-24,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( firespeed == 0 ) for ( int i=0; i<2; i++ ) Screen.DrawTexture(SpeedTex,false,bx-21,(by-14)+i*8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else if ( firespeed == 1 ) for ( int i=0; i<3; i++ ) Screen.DrawTexture(SpeedTex,false,bx-21,(by-14)+i*4,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else if ( firespeed == 2 ) for ( int i=0; i<5; i++ ) Screen.DrawTexture(SpeedTex,false,bx-21,(by-14)+i*2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
// TODO heat bar
Screen.DrawText(NewConsoleFont,Font.CR_RED,64,64,String.Format("heat: %g\nshake: %g\nspread: %g\ntimer: %d",barrelheat,vibrate,aimerror,firetimer?((gametic-firetimer)/GameTicRate):0));
bool isfired = !!fired;
double firefact = 0.;
if ( firespeed == 0 )
{
isfired = isfired&&((fired+7)>=gametic);
firefact = clamp((gametic+TicFrac)-fired,0.,7.)/7.;
}
else if ( firespeed == 1 )
{
isfired = isfired&&((fired+3)>=gametic);
firefact = clamp((gametic+TicFrac)-fired,0.,3.)/3.;
}
else if ( firespeed == 2 )
{
isfired = isfired&&((fired+1)>=gametic);
firefact = TicFrac;
}
bool infammo = (sv_infiniteammo||Owner.FindInventory('PowerInfiniteAmmo',true));
if ( isfired )
{
Screen.DrawTexture(BulletTex[1],false,bx-15,(by-10)-4*firefact,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-firefact);
for ( int i=0; i<2; i++ )
{
if ( !infammo && (Ammo1.Amount <= i) ) break;
Screen.DrawTexture(BulletTex[0],false,bx-15,(by-6)-4*firefact+i*4,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ClipBottom,int((by-2)*hs),DTA_Alpha,(i==0)?1.:firefact);
}
return;
}
for ( int i=0; i<2; i++ )
{
if ( !infammo && (Ammo1.Amount <= i) ) break;
Screen.DrawTexture(BulletTex[0],false,bx-15,(by-10)+i*4,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}
}