Polish WEAPON_M3 and WEAPON_XM1014 by giving it real spread, and allowing
the reload sequence to be interrupted at any time.
This commit is contained in:
parent
6344d561c8
commit
9b620da3fb
3 changed files with 74 additions and 10 deletions
|
@ -152,21 +152,34 @@ w_m3_draw(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void w_m3_release(void);
|
||||
|
||||
void
|
||||
w_m3_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_m3_release();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pl.m3_mag) {
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_temp == M3S_RELOAD && pl.m3_mag >= 1) {
|
||||
pl.mode_temp = M3S_RELOAD_END;
|
||||
w_m3_release();
|
||||
return;
|
||||
} else if (pl.mode_temp > M3S_IDLE) {
|
||||
w_m3_release();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.m3_mag <= 0) {
|
||||
w_m3_release();
|
||||
return;
|
||||
}
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 9);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
pl.m3_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
|
@ -184,7 +197,6 @@ w_m3_primary(void)
|
|||
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_PlayerTop(pl, ANIM_SHOOT_SHOTGUN, 0.45f);
|
||||
|
@ -194,6 +206,14 @@ w_m3_primary(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_m3.fire");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
pl.punchangle[0] = -4 * (9 / 6);
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3);
|
||||
#endif
|
||||
}
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
|
|
@ -151,22 +151,35 @@ w_xm1014_draw(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void w_xm1014_release(void);
|
||||
|
||||
void
|
||||
w_xm1014_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_xm1014_release();
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
if (!pl.xm1014_mag) {
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_temp == XM1014S_RELOAD && pl.xm1014_mag >= 1) {
|
||||
pl.mode_temp = XM1014S_RELOAD_END;
|
||||
w_xm1014_release();
|
||||
return;
|
||||
} else if (pl.mode_temp > XM1014S_IDLE) {
|
||||
w_xm1014_release();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.xm1014_mag <= 0) {
|
||||
w_xm1014_release();
|
||||
return;
|
||||
}
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 6);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
pl.xm1014_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
|
@ -189,10 +202,17 @@ w_xm1014_primary(void)
|
|||
View_AddEvent(w_xm1014_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 22, [accuracy,accuracy], WEAPON_XM1014);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.fire");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
pl.punchangle[0] = -4 * (6 / 6);
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 22, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3);
|
||||
#endif
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
|
|
@ -32,14 +32,38 @@
|
|||
void
|
||||
Cstrike_ShotMultiplierAdd(player pl, int shots)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* more than 12 is enough, you can barely hit the barn */
|
||||
pl.cs_shotmultiplier = bound(0, pl.cs_shotmultiplier + shots, 12);
|
||||
|
||||
pl.cs_shottime = 0.2f;
|
||||
pl.punchangle[0] = -4 * (pl.cs_shotmultiplier / 6);
|
||||
pl.punchangle[1] = random(-1, 1);
|
||||
|
||||
r = (float)input_sequence % 5;
|
||||
switch (r) {
|
||||
case 1:
|
||||
pl.punchangle[1] = -0.1;
|
||||
break;
|
||||
case 2:
|
||||
pl.punchangle[1] = 0.25;
|
||||
break;
|
||||
case 3:
|
||||
pl.punchangle[1] = -0.25;
|
||||
break;
|
||||
case 4:
|
||||
pl.punchangle[1] = 0.5;
|
||||
break;
|
||||
case 5:
|
||||
pl.punchangle[1] = 0.1;
|
||||
break;
|
||||
default:
|
||||
pl.punchangle[1] = -0.5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* generate an accuracy value that we'll pass onto TraceAttack */
|
||||
float
|
||||
Cstrike_CalculateAccuracy(player pl, float divisor)
|
||||
|
|
Loading…
Reference in a new issue