Make sure we call View_AddEvent() _after_ Weapons_ViewAnimation() so the

cache hack in the upstream Nuclide repo works.
This commit is contained in:
Marco Cawthorne 2021-03-30 07:31:33 +02:00
parent 7bc7388125
commit acbdc62b14
17 changed files with 91 additions and 100 deletions

View File

@ -63,6 +63,7 @@ struct
void(void) m_pEventCall;
float m_flEventTime;
float m_flEventFrame;
int m_iLastWeapon;
int m_iOldWeapon;

View File

@ -159,7 +159,6 @@ w_ak47_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 3;
switch (r) {
@ -173,6 +172,7 @@ w_ak47_primary(void)
Weapons_ViewAnimation(AK47_SHOOT3);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(1);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 36, [accuracy,accuracy], WEAPON_AK47);

View File

@ -126,7 +126,6 @@ w_aug_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 3;
switch (r) {
@ -140,6 +139,7 @@ w_aug_primary(void)
Weapons_ViewAnimation(AUG_SHOOT3);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(1);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 32, [accuracy,accuracy], WEAPON_AUG);

View File

@ -186,8 +186,6 @@ w_elites_primary(void)
int r = (float)input_sequence % 5;
if (pl.mode_temp) {
View_AddEvent(w_pistol_ejectshell_left, 0.0f);
if (pl.elites_mag <= 0) {
Weapons_ViewAnimation(ELITES_SHOOT_LEFTLAST);
} else {
@ -209,8 +207,8 @@ w_elites_primary(void)
break;
}
}
View_AddEvent(w_pistol_ejectshell_left, 0.0f);
} else {
View_AddEvent(w_pistol_ejectshell_right, 0.0f);
if (pl.elites_mag <= 0) {
Weapons_ViewAnimation(ELITES_SHOOT_RIGHTLAST);
} else {
@ -232,6 +230,7 @@ w_elites_primary(void)
break;
}
}
View_AddEvent(w_pistol_ejectshell_right, 0.0f);
}
#else
TraceAttack_SetPenetrationPower(0);

View File

@ -124,7 +124,6 @@ w_g3sg1_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 2;
switch (r) {
@ -135,6 +134,7 @@ w_g3sg1_primary(void)
Weapons_ViewAnimation(SCOUT_SHOOT2);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(2);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 80, [accuracy,accuracy], WEAPON_G3SG1);

View File

@ -157,23 +157,6 @@ w_glock18_primary(void)
#endif
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
if (pl.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
if (pl.mode_glock18) {
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.burstfire");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.fire");
}
#endif
if (pl.mode_glock18) {
int r = (float)input_sequence % 2;
switch (r) {
@ -193,6 +176,23 @@ w_glock18_primary(void)
}
pl.w_attack_next = 0.15f;
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
if (pl.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
if (pl.mode_glock18) {
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.burstfire");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.fire");
}
#endif
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -168,20 +168,6 @@ w_m3_primary(void)
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
pl.m3_mag--;
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(9, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_M3);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
Sound_Play(pl, CHAN_WEAPON, "weapon_m3.fire");
#endif
int r = (float)input_sequence % 2;
switch (r) {
case 0:
@ -193,7 +179,18 @@ w_m3_primary(void)
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_m3_ejectshell, 0.6f);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(9, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_M3);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
Sound_Play(pl, CHAN_WEAPON, "weapon_m3.fire");
#endif
pl.w_attack_next = 1.0f;

View File

@ -146,7 +146,6 @@ w_m4a1_primary(void)
} else {
View_SetMuzzleflash(MUZZLE_RIFLE);
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
/* this stuff is predicted */
int r = (float)input_sequence % 3;
@ -175,6 +174,7 @@ w_m4a1_primary(void)
break;
}
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
/* Different sounds without silencer */
if (pl.mode_m4a1 == 1) {

View File

@ -125,7 +125,6 @@ w_p90_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
int r = (float)input_sequence % 3;
switch (r) {
@ -139,6 +138,7 @@ w_p90_primary(void)
Weapons_ViewAnimation(P90_SHOOT3);
break;
}
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_P90);

View File

@ -124,7 +124,6 @@ w_para_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 2;
switch (r) {
@ -135,6 +134,7 @@ w_para_primary(void)
Weapons_ViewAnimation(SCOUT_SHOOT2);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(1);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 35, [accuracy,accuracy], WEAPON_PARA);

View File

@ -191,6 +191,7 @@ w_scout_primary(void)
Weapons_ViewAnimation(SCOUT_SHOOT2);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.5f);
#else
TraceAttack_SetPenetrationPower(2);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 75, [accuracy,accuracy], WEAPON_SCOUT);
@ -203,10 +204,6 @@ w_scout_primary(void)
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
#endif
#ifdef CLIENT
View_AddEvent(w_rifle_ejectshell, 0.5f);
#endif
pl.w_attack_next = 1.25f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -124,7 +124,6 @@ w_sg550_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 2;
switch (r) {
@ -135,6 +134,7 @@ w_sg550_primary(void)
Weapons_ViewAnimation(SCOUT_SHOOT2);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(1);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 70, [accuracy,accuracy], WEAPON_SG550);

View File

@ -125,7 +125,6 @@ w_sg552_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_rifle_ejectshell, 0.0f);
int r = (float)input_sequence % 3;
switch (r) {
@ -139,6 +138,7 @@ w_sg552_primary(void)
Weapons_ViewAnimation(SG552_SHOOT3);
break;
}
View_AddEvent(w_rifle_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(1);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_SG552);

View File

@ -127,7 +127,6 @@ w_tmp_primary(void)
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
int r = (float)input_sequence % 3;
switch (r) {
@ -141,6 +140,7 @@ w_tmp_primary(void)
Weapons_ViewAnimation(TMP_SHOOT3);
break;
}
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_TMP);

View File

@ -125,6 +125,19 @@ w_ump45_primary(void)
float accuracy = Cstrike_CalculateAccuracy(pl, 210);
pl.ump45_mag--;
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(UMP45_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(UMP45_SHOOT2);
break;
default:
Weapons_ViewAnimation(UMP45_SHOOT3);
break;
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_pistol_ejectshell, 0.0f);
@ -140,19 +153,6 @@ w_ump45_primary(void)
Sound_Play(pl, CHAN_WEAPON, "weapon_ump45.fire");
#endif
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(UMP45_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(UMP45_SHOOT2);
break;
default:
Weapons_ViewAnimation(UMP45_SHOOT3);
break;
}
pl.w_attack_next = 0.105f;
pl.w_idle_next = pl.w_attack_next;
}

View File

@ -147,32 +147,6 @@ w_usp45_primary(void)
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
pl.usp45_mag--;
/* actual firing */
#ifdef CLIENT
if (pl.mode_usp45 == 1) {
View_SetMuzzleflash(0);
} else {
View_SetMuzzleflash(MUZZLE_SMALL);
}
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
/* Different sounds without silencer */
if (pl.mode_usp45 == 1) {
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.silenced");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.fire");
}
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_USP45);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
#endif
/* this stuff is predicted */
int r = (float)input_sequence % 3;
if (pl.mode_usp45 == 1) {
@ -209,6 +183,32 @@ w_usp45_primary(void)
}
}
#ifdef CLIENT
if (pl.mode_usp45 == 1) {
View_SetMuzzleflash(0);
} else {
View_SetMuzzleflash(MUZZLE_SMALL);
}
View_AddEvent(w_pistol_ejectshell, 0.0f);
#else
/* Different sounds without silencer */
if (pl.mode_usp45 == 1) {
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.silenced");
} else {
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.fire");
}
/* actual firing */
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_USP45);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
#endif
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.15f;
pl.w_idle_next = pl.w_attack_next;

View File

@ -168,20 +168,6 @@ w_xm1014_primary(void)
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
pl.xm1014_mag--;
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 22, [accuracy,accuracy], WEAPON_XM1014);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.fire");
#endif
int r = (float)input_sequence % 3;
switch (r) {
case 0:
@ -193,7 +179,18 @@ w_xm1014_primary(void)
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_RIFLE);
View_AddEvent(w_xm1014_ejectshell, 0.0f);
#else
TraceAttack_SetPenetrationPower(0);
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 22, [accuracy,accuracy], WEAPON_XM1014);
if (self.flags & FL_CROUCHING)
Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f);
else
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.fire");
#endif
pl.w_attack_next = 0.25f;