diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 159a0c5e..925052d5 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -410,6 +410,7 @@ set(AMMO_HDR ) set(AMMO_SRC weapon/CBasePlayerAmmo.cpp + weapon/CAmmo556.cpp weapon/CCrossbowAmmo.cpp weapon/CGaussAmmo.cpp weapon/CGlockAmmo.cpp diff --git a/dlls/game/skill.cpp b/dlls/game/skill.cpp index c129189b..1afbd3e1 100644 --- a/dlls/game/skill.cpp +++ b/dlls/game/skill.cpp @@ -240,6 +240,7 @@ skill_cvar_t skill_cvars[] = { DECL_SKILL_CVAR(sk_ammo_max_argrenades, CVAR_TYPE_ITEM), DECL_SKILL_CVAR(sk_ammo_max_spores, CVAR_TYPE_ITEM), DECL_SKILL_CVAR(sk_ammo_max_medkit, CVAR_TYPE_ITEM), + DECL_SKILL_CVAR(sk_ammo_max_556, CVAR_TYPE_ITEM), // World weapons DECL_SKILL_CVAR(sk_12mm_bullet, CVAR_TYPE_DAMAGE), diff --git a/dlls/game/skill.h b/dlls/game/skill.h index 8a77d748..c8415e1c 100644 --- a/dlls/game/skill.h +++ b/dlls/game/skill.h @@ -234,6 +234,7 @@ struct skilldata_t float sk_ammo_max_argrenades; float sk_ammo_max_spores; float sk_ammo_max_medkit; + float sk_ammo_max_556; // World weapons float sk_12mm_bullet; diff --git a/dlls/player/CBasePlayer.cpp b/dlls/player/CBasePlayer.cpp index 244408f8..6a5fc376 100644 --- a/dlls/player/CBasePlayer.cpp +++ b/dlls/player/CBasePlayer.cpp @@ -4435,10 +4435,18 @@ void CBasePlayer::SendAmmoUpdate(void) ASSERT( m_rgAmmo[i] >= 0 ); ASSERT( m_rgAmmo[i] < 255 ); + uint8_t ammoVal = m_rgAmmo[i]; + + // can't update max ammo counter without a client update + // this will at least show the client that ammo is being spent + if (m_rgAmmo[i] > 255) { + ammoVal = 250 + (m_rgAmmo[i] % 6); + } + // send "Ammo" update message MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev ); WRITE_BYTE( i ); - WRITE_BYTE( V_max( V_min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte + WRITE_BYTE(ammoVal); MESSAGE_END(); } } diff --git a/dlls/weapon/CAmmo556.cpp b/dlls/weapon/CAmmo556.cpp new file mode 100644 index 00000000..b37c96e0 --- /dev/null +++ b/dlls/weapon/CAmmo556.cpp @@ -0,0 +1,30 @@ +#include "CBasePlayerAmmo.h" +#include "skill.h" + +class CAmmo556 : public CBasePlayerAmmo +{ + void Spawn( void ) + { + Precache( ); + //SET_MODEL_MERGED(ENT(pev), "models/w_saw_clip.mdl", MERGE_MDL_W_CHAINAMMO); + SET_MODEL(ENT(pev), "models/w_saw_clip.mdl"); + CBasePlayerAmmo::Spawn( ); + } + void Precache( void ) + { + //PRECACHE_REPLACEMENT_MODEL("models/w_saw_clip.mdl"); + PRECACHE_MODEL ("models/w_saw_clip.mdl"); + PRECACHE_SOUND("items/9mmclip1.wav"); + } + BOOL AddAmmo( CBaseEntity *pOther ) + { + int bResult = (pOther->GiveAmmo(AMMO_556_GIVE, "556", gSkillData.sk_ammo_max_556) != -1); + if (bResult) + { + EMIT_SOUND(ENT(pev), CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM); + } + return bResult; + } +}; + +LINK_ENTITY_TO_CLASS( ammo_556, CAmmo556) \ No newline at end of file diff --git a/dlls/weapon/CMP5AmmoBox.cpp b/dlls/weapon/CMP5AmmoBox.cpp index 9b275a15..86735883 100644 --- a/dlls/weapon/CMP5AmmoBox.cpp +++ b/dlls/weapon/CMP5AmmoBox.cpp @@ -24,5 +24,4 @@ class CMP5AmmoBox : public CBasePlayerAmmo } }; -LINK_ENTITY_TO_CLASS( ammo_9mmbox, CMP5AmmoBox) -LINK_ENTITY_TO_CLASS( ammo_556, CMP5AmmoBox) \ No newline at end of file +LINK_ENTITY_TO_CLASS( ammo_9mmbox, CMP5AmmoBox) \ No newline at end of file diff --git a/dlls/weapon/ammo.h b/dlls/weapon/ammo.h index c720168a..29c537e9 100644 --- a/dlls/weapon/ammo.h +++ b/dlls/weapon/ammo.h @@ -8,6 +8,7 @@ #define AMMO_357BOX_GIVE PYTHON_MAX_CLIP #define AMMO_MP5CLIP_GIVE MP5_MAX_CLIP #define AMMO_CHAINBOX_GIVE 200 +#define AMMO_556_GIVE 50 #define AMMO_M203BOX_GIVE 2 #define AMMO_BUCKSHOTBOX_GIVE 12 #define AMMO_CROSSBOWCLIP_GIVE CROSSBOW_MAX_CLIP diff --git a/sevenkewp b/sevenkewp index 1ec6a716..fd4e35de 160000 --- a/sevenkewp +++ b/sevenkewp @@ -1 +1 @@ -Subproject commit 1ec6a71618d109e53b00d018a4c789d629b59ccb +Subproject commit fd4e35ded9e9f2e6338b96942fee34f52a002a9f