From f52e61dbd06ba4884908b54f941db096c6683536 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 26 Jul 2024 14:51:01 -0700 Subject: [PATCH] weapon_{shotgun,rpg}: add punchangle HLWeapon: draw ammo2 icon --- src/shared/HLWeapon.qc | 17 +++++++++++++++++ zpak001.pk3dir/def/weapons/rpg.def | 2 ++ zpak001.pk3dir/def/weapons/shotgun.def | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/src/shared/HLWeapon.qc b/src/shared/HLWeapon.qc index 79e4a10..bef775f 100644 --- a/src/shared/HLWeapon.qc +++ b/src/shared/HLWeapon.qc @@ -50,6 +50,7 @@ HLWeapon:NSWeapon int m_iHudSlotPos; string m_ammoIcon; + string m_ammo2Icon; string m_crossHair; NSWeapon m_nextWeapon; virtual void UpdateGUI(void); @@ -129,6 +130,12 @@ HLWeapon::AddedToInventory(void) m_ammoIcon = sprintf("%s.ammo", strtolower(classname)); } + m_ammo2Icon = GetDefString("ammoIcon"); + + if (m_ammo2Icon == "") { + m_ammo2Icon = sprintf("%s.ammo2", strtolower(classname)); + } + m_crossHair = GetDefString("crosshair"); if (m_crossHair == "") { @@ -139,6 +146,10 @@ HLWeapon::AddedToInventory(void) m_ammoIcon = __NULL__; } + if (m_ammo2Icon == "none") { + m_ammo2Icon = __NULL__; + } + if (m_crossHair == "none") { m_crossHair = __NULL__; } @@ -185,6 +196,12 @@ HLWeapon::UpdateGUI(void) if (m_secondaryAmmoType && m_primaryAmmoType != m_secondaryAmmoType) { ourOwner.a_ammo3 = ourOwner.GetReserveAmmo(m_secondaryAmmoType); HUD_DrawAmmo3(); + + /* draw ammo icon */ + if (m_ammo2Icon) { + vector ammoPos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 74]; + HLSprite_Draw_RGBA(m_ammo2Icon, ammoPos, g_hud_color, pSeatLocal->m_flAmmo2Alpha, true); + } } } diff --git a/zpak001.pk3dir/def/weapons/rpg.def b/zpak001.pk3dir/def/weapons/rpg.def index 67529da..208f1c4 100644 --- a/zpak001.pk3dir/def/weapons/rpg.def +++ b/zpak001.pk3dir/def/weapons/rpg.def @@ -95,9 +95,11 @@ entityDef damage_rocketSplash entityDef fireInfo_rpg { "def_onFire" "projectile_rocket" + "punchAngle" "-10 0 0" } entityDef fireInfo_rpg_homing { "def_onFire" "projectile_rocket_homing" + "punchAngle" "-10 0 0" } diff --git a/zpak001.pk3dir/def/weapons/shotgun.def b/zpak001.pk3dir/def/weapons/shotgun.def index fd73ee4..a90641e 100644 --- a/zpak001.pk3dir/def/weapons/shotgun.def +++ b/zpak001.pk3dir/def/weapons/shotgun.def @@ -62,6 +62,7 @@ entityDef fireInfo_shotgun "def_onFire" "projectile_shotgun" "ammoPerShot" "1" "fireRate" "0.75" + "punchAngle" "-5 0 0" "model_flash" "sprites/muzzleflash2.spr" } @@ -71,6 +72,7 @@ entityDef fireInfo_altShotgun "ammoPerShot" "2" "fireRate" "1.5" "actFire" "2" + "punchAngle" "-10 0 0" "snd_fire" "weapon_shotgun.double" "model_flash" "sprites/muzzleflash2.spr" } @@ -97,6 +99,7 @@ entityDef fireInfo_shotgun_mp "def_onFire" "projectile_shotgun_mp" "ammoPerShot" "1" "fireRate" "1.25" + "punchAngle" "-5 0 0" "model_flash" "sprites/muzzleflash2.spr" } @@ -105,6 +108,7 @@ entityDef fireInfo_altShotgun_mp "def_onFire" "projectile_shotgun_alt_mp" "ammoPerShot" "2" "fireRate" "1.5" + "punchAngle" "-10 0 0" "model_flash" "sprites/muzzleflash2.spr" }