Client: Add shell ejection code to WEAPON_GLOCK and WEAPON_MP5

This commit is contained in:
Marco Cawthorne 2021-03-17 14:35:56 +01:00
parent 85dc94b2a7
commit bfb660db02
5 changed files with 13 additions and 10 deletions

View file

@ -39,7 +39,12 @@ struct
entity m_eViewModel;
entity m_eMuzzleflash;
int m_iVMBones;
int m_iVMEjectBone;
/* viewmodel shell ejection */
float m_fEjectModel;
vector m_vecEjectPos;
vector m_vecEjectVel;
int m_iLastWeapon;
int m_iOldWeapon;
float m_flBobTime;

View file

@ -47,5 +47,4 @@ View_UpdateWeapon(entity vm, entity mflash)
skel_delete(mflash.skeletonindex);
mflash.skeletonindex = skel_create(vm.modelindex);
pSeat->m_iVMBones = skel_get_numbones(mflash.skeletonindex) + 1;
pSeat->m_iVMEjectBone = pSeat->m_iVMBones + 1;
}

View file

@ -137,20 +137,16 @@ Damage_Radius(vector org, entity attacker, float dmg, float r, int check, int w)
/* don't bother if it's not anywhere near us */
dist = vlen(org - pos);
if (dist > r) {
if (dist > r)
continue;
}
/* can we physically hit this thing? */
if (Damage_CheckTrace(e, org) == FALSE) {
if (check == TRUE) {
if (check == TRUE)
if (Damage_CheckTrace(e, org) == FALSE)
continue;
}
}
/* calculate new damage values */
diff = vlen(org - pos);
diff = (r - diff) / r;
diff = (r - dist) / r;
new_dmg = rint(dmg * diff);
if (diff > 0) {

View file

@ -138,6 +138,7 @@ w_glock_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_SMALL);
View_EjectShellPos(SHELL_DEFAULT, [26,8,-32], [0, 80, 100]);
Weapons_ViewPunchAngle([-2,0,0]);
if (pl.glock_mag) {
@ -178,6 +179,7 @@ w_glock_secondary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_SMALL);
Weapons_ViewPunchAngle([-2,0,0]);
View_EjectShellPos(SHELL_DEFAULT, [26,8,-32], [0, 80, 100]);
if (pl.glock_mag) {
Weapons_ViewAnimation(GLOCK_SHOOT);

View file

@ -138,6 +138,7 @@ w_mp5_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShellPos(SHELL_DEFAULT, [32,8,-32], [0, 80, 100]);
#else
/* singleplayer is more accurate */
if (cvar("sv_playerslots") == 1) {