- Try to get rid of all implicit casts from string to name, color or class. - Use FindClass where needed. - Used a map in a case where a dictionary was unneeded. - Use new bounce flags where needed. - Replace Legacy of Rust weapons/ammo.
175 lines
7.6 KiB
Text
175 lines
7.6 KiB
Text
// DrawWeapon code for DLC weapons
|
|
|
|
// Combat Hammer
|
|
extend Class ItamexHammer
|
|
{
|
|
ui TextureID WeaponBox, BarTex;
|
|
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ItamexDisplay.png");
|
|
if ( !BarTex ) BarTex = TexMan.CheckForTexture("graphics/HUD/ItamexBar.png");
|
|
double ct = clamp(ChargeInter?ChargeInter.GetValue(TicFrac):charge,0.,100.);
|
|
if ( ct <= 0 ) return;
|
|
double ch = ct*.2;
|
|
Screen.DrawTexture(WeaponBox,false,bx-8,by-25,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
Screen.DrawTexture(BarTex,false,bx-5,by-(2+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,Color(255,0,0,0));
|
|
bool blinking = (ct>=100.)&&(Owner.player.cmd.buttons&BT_ALTATTACK)&&(gametic%4>=2);
|
|
Screen.DrawTexture(BarTex,false,bx-6,by-(3+ch),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcHeight,ch,DTA_DestHeightF,ch,DTA_ColorOverlay,blinking?Color(128,0,0,0):Color(0,0,0,0));
|
|
}
|
|
}
|
|
|
|
// Plasma Blaster
|
|
/*extend Class PlasmaBlast
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}
|
|
|
|
extend Class DualPlasmaBlast
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}
|
|
|
|
// Puntzer Beta
|
|
extend Class PuntzerBeta
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}
|
|
|
|
// Puntzer Gamma
|
|
extend Class PuntzerGamma
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}*/
|
|
|
|
// Sheen HMG
|
|
extend Class HeavyMahSheenGun
|
|
{
|
|
ui TextureID WeaponBox, BulletTex[2], SpeedTex, BarTex;
|
|
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/SheenDisplay.png");
|
|
if ( !BulletTex[0] ) BulletTex[0] = TexMan.CheckForTexture("graphics/HUD/SheenRound.png");
|
|
if ( !BulletTex[1] ) BulletTex[1] = TexMan.CheckForTexture("graphics/HUD/SheenCasing.png");
|
|
if ( !SpeedTex ) SpeedTex = TexMan.CheckForTexture("graphics/HUD/SheenSpeed.png");
|
|
if ( !BarTex ) BarTex = TexMan.CheckForTexture("graphics/HUD/SheenBar.png");
|
|
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);
|
|
double ht = clamp(HeatInter?HeatInter.GetValue(TicFrac):barrelheat,0.,100.);
|
|
double hw = ht*.18;
|
|
bool blinking = (incooldown)&&(gametic%8>=4);
|
|
Screen.DrawTexture(BarTex,false,bx-20,by-21,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcWidth,hw,DTA_DestWidthF,hw,DTA_ColorOverlay,Color(255,0,0,0));
|
|
Screen.DrawTexture(BarTex,false,bx-21,by-22,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcWidth,hw,DTA_DestWidthF,hw,DTA_ColorOverlay,blinking?Color(128,0,0,0):Color(0,0,0,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);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Quadravol
|
|
extend Class Quadravol
|
|
{
|
|
ui TextureID WeaponBox, BulletTex[2];
|
|
ui Font ChargeFont;
|
|
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/QuadravolDisplay.png");
|
|
if ( !BulletTex[0] ) BulletTex[0] = TexMan.CheckForTexture("graphics/HUD/QuadravolRound.png");
|
|
if ( !BulletTex[1] ) BulletTex[1] = TexMan.CheckForTexture("graphics/HUD/QuadravolCasing.png");
|
|
if ( !ChargeFont ) ChargeFont = Font.GetFont('XekkasNum');
|
|
Screen.DrawTexture(WeaponBox,false,bx-16,by-44,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
for ( int i=0; i<clipcount; i++ )
|
|
Screen.DrawTexture(BulletTex[0],false,bx-6,by-(10+i*8),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
if ( chambered ) Screen.DrawTexture(BulletTex[charged],false,bx-14,by-10,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
Screen.DrawText(ChargeFont,Font.CR_UNTRANSLATED,bx-14,by-20,String.Format("%d",chargelevel),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
}
|
|
}
|
|
|
|
// Sparkster Rifle
|
|
/*extend Class ModernSparkster
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}
|
|
|
|
// Ray-Khom
|
|
extend Class RayKhom
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}*/
|
|
|
|
// Mortal Rifle
|
|
extend Class MisterRifle
|
|
{
|
|
ui TextureID WeaponBox, BulletTex[3];
|
|
ui Font ModeFont;
|
|
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/MisterDisplay.png");
|
|
if ( !BulletTex[0] ) BulletTex[0] = TexMan.CheckForTexture("graphics/HUD/MisterRound.png");
|
|
if ( !BulletTex[1] ) BulletTex[1] = TexMan.CheckForTexture("graphics/HUD/MisterGrenade.png");
|
|
if ( !BulletTex[2] ) BulletTex[2] = TexMan.CheckForTexture("graphics/HUD/MisterGrenadeCasing.png");
|
|
if ( !ModeFont ) ModeFont = Font.GetFont('MiniHUDShadow');
|
|
Screen.DrawTexture(WeaponBox,false,bx-23,by-32,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
static const int fmod[] = {0x0050,0x0043,0x0053,0x004F};
|
|
Screen.DrawChar(ModeFont,Font.FindFontColor('MiniBrass'),bx-20,by-20,fmod[firemode],DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
if ( chambered ) Screen.DrawTexture(BulletTex[0],false,bx-12,by-30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fired?0x80000000:0x00000000);
|
|
for ( int i=0; i<clipcount; i++ )
|
|
Screen.DrawTexture(BulletTex[0],false,bx-12,(by-27)+2*i,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
|
if ( gchambered ) Screen.DrawTexture(BulletTex[1+gfired],false,bx-21,by-10,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,gfired?0x80000000:0x00000000);
|
|
}
|
|
}
|
|
|
|
// Rafan-Kos
|
|
/*extend Class RafanKos
|
|
{
|
|
override void DrawWeapon( double TicFrac, double bx, double by, double hs, Vector2 ss )
|
|
{
|
|
}
|
|
}*/
|