Client: Add shell ejection for pistols, smgs and rifles.

This commit is contained in:
Marco Cawthorne 2021-03-17 13:26:12 +01:00
parent 81d7630dd7
commit 29009ffbb9
20 changed files with 33 additions and 3 deletions

View file

@ -50,6 +50,10 @@ var string g_cs_scope6;
var string g_cs_scope7;
var string g_cs_scope8;
var float SHELL_PISTOL;
var float SHELL_RIFLE;
var float SHELL_RIFLELARGE;
struct
{
/* viewmodel stuff */
@ -57,6 +61,7 @@ struct
entity m_eMuzzleflash;
int m_iVMBones;
int m_iVMEjectBone;
float m_fEjectModel;
int m_iLastWeapon;
int m_iOldWeapon;
float m_flBobTime;

View file

@ -132,6 +132,10 @@ ClientGame_RendererRestart(string rstr)
g_cs_scope7 = spriteframe("sprites/bottom.spr", 0, 0.0f);
g_cs_scope8 = spriteframe("sprites/bottom_right.spr", 0, 0.0f);
SHELL_PISTOL = getmodelindex("models/pshell.mdl");
SHELL_RIFLE = getmodelindex("models/rshell.mdl");
SHELL_RIFLELARGE = getmodelindex("models/rshell_big.mdl");
Obituary_Precache();
FX_Blood_Init();

View file

@ -126,6 +126,7 @@ w_ak47_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 3;
switch (r) {

View file

@ -126,6 +126,7 @@ w_aug_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 3;
switch (r) {

View file

@ -129,6 +129,7 @@ w_deagle_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
if (pl.deagle_mag <= 0) {
Weapons_ViewAnimation(DEAGLE_SHOOT_EMPTY);

View file

@ -144,6 +144,8 @@ w_elites_primary(void)
int r = (float)input_sequence % 5;
if (pl.mode_temp) {
View_EjectShell(SHELL_PISTOL, 1);
if (pl.elites_mag <= 0) {
Weapons_ViewAnimation(ELITES_SHOOT_LEFTLAST);
} else {
@ -166,6 +168,7 @@ w_elites_primary(void)
}
}
} else {
View_EjectShell(SHELL_PISTOL, 0);
if (pl.elites_mag <= 0) {
Weapons_ViewAnimation(ELITES_SHOOT_RIGHTLAST);
} else {

View file

@ -129,6 +129,7 @@ w_fiveseven_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
if (pl.fiveseven_mag <= 0) {
Weapons_ViewAnimation(FIVESEVEN_SHOOT_EMPTY);

View file

@ -124,6 +124,7 @@ w_g3sg1_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 2;
switch (r) {

View file

@ -159,6 +159,7 @@ w_glock18_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
#else
if (pl.flags & FL_CROUCHING)

View file

@ -146,6 +146,7 @@ w_m4a1_primary(void)
} else {
View_SetMuzzleflash(MUZZLE_RIFLE);
}
View_EjectShell(SHELL_RIFLE, 0);
/* this stuff is predicted */
int r = (float)input_sequence % 3;

View file

@ -125,6 +125,7 @@ w_mac10_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
int r = (float)input_sequence % 3;
switch (r) {

View file

@ -125,6 +125,7 @@ w_mp5_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 3;
switch (r) {

View file

@ -129,6 +129,7 @@ w_p228_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
if (pl.p228_mag <= 0) {
Weapons_ViewAnimation(P228_SHOOT_EMPTY);

View file

@ -125,6 +125,7 @@ w_p90_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
int r = (float)input_sequence % 3;
switch (r) {

View file

@ -124,6 +124,7 @@ w_para_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 2;
switch (r) {

View file

@ -124,6 +124,7 @@ w_sg550_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 2;
switch (r) {
@ -282,7 +283,7 @@ weapon_t w_sg550 =
.primary = w_sg550_primary,
.secondary = w_sg550_secondary,
.reload = w_sg550_reload,
.release = w_cstrike_weaponrelease,
.release = w_sg550_release,
.crosshair = w_sg550_hud,
.precache = w_sg550_precache,
.pickup = w_sg550_pickup,

View file

@ -125,6 +125,7 @@ w_sg552_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_RIFLE, 0);
int r = (float)input_sequence % 3;
switch (r) {
@ -290,7 +291,7 @@ weapon_t w_sg552 =
.primary = w_sg552_primary,
.secondary = w_sg552_secondary,
.reload = w_sg552_reload,
.release = w_cstrike_weaponrelease,
.release = w_sg552_release,
.crosshair = w_sg552_hud,
.precache = w_sg552_precache,
.pickup = w_sg552_pickup,

View file

@ -127,6 +127,7 @@ w_tmp_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
int r = (float)input_sequence % 3;
switch (r) {
@ -267,7 +268,7 @@ weapon_t w_tmp =
.primary = w_tmp_primary,
.secondary = __NULL__,
.reload = w_tmp_reload,
.release = w_cstrike_weaponrelease,
.release = w_tmp_release,
.crosshair = w_tmp_hud,
.precache = w_tmp_precache,
.pickup = w_tmp_pickup,

View file

@ -127,6 +127,7 @@ w_ump45_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_EjectShell(SHELL_PISTOL, 0);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 30, [accuracy,accuracy], WEAPON_UMP45);

View file

@ -154,6 +154,8 @@ w_usp45_primary(void)
} else {
View_SetMuzzleflash(MUZZLE_SMALL);
}
View_EjectShell(SHELL_PISTOL, 0);
#else
/* Different sounds without silencer */
if (pl.mode_usp45 == 1) {