Rebased against the latest Nuclide commit.

This commit is contained in:
Marco Cawthorne 2022-03-15 19:35:32 -07:00
parent cadadedc72
commit 02287fee0b
Signed by: eukara
GPG Key ID: C196CD8BA993248A
13 changed files with 302 additions and 356 deletions

View File

@ -15,7 +15,7 @@
*/
void
Game_Input(void)
Game_Input(player pl)
{
#ifdef SERVER
CGameRules rules = (CGameRules)g_grMode;
@ -30,12 +30,11 @@ Game_Input(void)
else
Player_UseUp();
if (self.impulse == 100)
if (pl.impulse == 100)
Flashlight_Toggle();
if (cvar("sv_cheats") == 1) {
player pl = (player)self;
if (self.impulse == 101) {
if (pl.impulse == 101) {
pl.health = 100;
pl.armor = 100;
pl.g_items |= ITEM_SUIT;
@ -63,15 +62,15 @@ Game_Input(void)
}
}
self.impulse = 0;
pl.impulse = 0;
#endif
if (input_buttons & INPUT_BUTTON0)
Weapons_Primary();
Weapons_Primary(pl);
else if (input_buttons & INPUT_BUTTON4)
Weapons_Reload();
Weapons_Reload(pl);
else if (input_buttons & INPUT_BUTTON3)
Weapons_Secondary();
Weapons_Secondary(pl);
else
Weapons_Release();
Weapons_Release(pl);
}

View File

@ -83,7 +83,7 @@ w_ap9_wmodel(void)
}
string
w_ap9_pmodel(void)
w_ap9_pmodel(player pl)
{
return "models/p_ap9.mdl";
}
@ -95,10 +95,9 @@ w_ap9_deathmsg(void)
}
int
w_ap9_pickup(int new, int startammo)
w_ap9_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.ap9_mag = 40;
@ -116,22 +115,21 @@ w_ap9_pickup(int new, int startammo)
}
void
w_ap9_draw(void)
w_ap9_draw(player pl)
{
Weapons_SetModel("models/v_ap9.mdl");
Weapons_ViewAnimation(AP9_DRAW);
Weapons_ViewAnimation(pl, AP9_DRAW);
}
void
w_ap9_holster(void)
w_ap9_holster(player pl)
{
}
void
w_ap9_primary(void)
w_ap9_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -139,18 +137,18 @@ w_ap9_primary(void)
return;
pl.ap9_mag--;
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(AP9_SHOOT1);
Weapons_ViewAnimation(pl, AP9_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(AP9_SHOOT2);
Weapons_ViewAnimation(pl, AP9_SHOOT2);
break;
case 2:
Weapons_ViewAnimation(AP9_SHOOT3);
Weapons_ViewAnimation(pl, AP9_SHOOT3);
break;
}
@ -172,9 +170,8 @@ w_ap9_primary(void)
}
void
w_ap9_secondary(void)
w_ap9_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0)
return;
@ -183,18 +180,18 @@ w_ap9_secondary(void)
pl.ap9_mag -= 3;
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(AP9_SHOOT1);
Weapons_ViewAnimation(pl, AP9_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(AP9_SHOOT2);
Weapons_ViewAnimation(pl, AP9_SHOOT2);
break;
case 2:
Weapons_ViewAnimation(AP9_SHOOT3);
Weapons_ViewAnimation(pl, AP9_SHOOT3);
break;
}
@ -216,9 +213,8 @@ w_ap9_secondary(void)
}
void
w_ap9_reload(void)
w_ap9_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -228,7 +224,7 @@ w_ap9_reload(void)
return;
#ifdef CLIENT
Weapons_ViewAnimation(AP9_RELOAD);
Weapons_ViewAnimation(pl, AP9_RELOAD);
#else
Weapons_ReloadWeapon(pl, player::ap9_mag, player::ammo_ap9, 40);
#endif
@ -238,40 +234,38 @@ w_ap9_reload(void)
}
void
w_ap9_release(void)
w_ap9_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.ap9_mag == 0 && pl.ammo_ap9 > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
Weapons_ViewAnimation(AP9_IDLE);
Weapons_ViewAnimation(pl, AP9_IDLE);
}
float
w_ap9_aimanim(void)
w_ap9_aimanim(player pl)
{
return w_glock_aimanim();
return w_glock_aimanim(pl);
}
void
w_ap9_hud(void)
w_ap9_hud(player pl)
{
w_glock_hud();
w_glock_hud(pl);
}
void
w_ap9_hudpic(int selected, vector pos, float a)
w_ap9_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.ap9_mag == 0 && pl.ammo_ap9 == 0)
@ -308,9 +302,8 @@ w_ap9_hudpic(int selected, vector pos, float a)
}
int
w_ap9_isempty(void)
w_ap9_isempty(player pl)
{
player pl = (player)self;
if (pl.ap9_mag <= 0 && pl.ammo_ap9 <= 0)
return 1;
@ -319,7 +312,7 @@ w_ap9_isempty(void)
}
weapontype_t
w_ap9_type(void)
w_ap9_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -337,7 +330,7 @@ weapon_t w_ap9 =
.secondary = w_ap9_secondary,
.reload = w_ap9_reload,
.release = w_ap9_release,
.crosshair = w_ap9_hud,
.postdraw = w_ap9_hud,
.precache = w_ap9_precache,
.pickup = w_ap9_pickup,
.updateammo = w_ap9_updateammo,

View File

@ -74,10 +74,9 @@ w_chaingun_precache(void)
}
int
w_chaingun_pickup(int new, int startammo)
w_chaingun_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.chaingun_mag = 100;
@ -107,7 +106,7 @@ w_chaingun_wmodel(void)
}
string
w_chaingun_pmodel(void)
w_chaingun_pmodel(player pl)
{
return "models/p_tfac.mdl";
}
@ -119,29 +118,27 @@ w_chaingun_deathmsg(void)
}
void
w_chaingun_draw(void)
w_chaingun_draw(player pl)
{
player pl = (player)self;
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tfac.mdl");
Weapons_ViewAnimation(CHAINGUN_DRAW);
Weapons_ViewAnimation(pl, CHAINGUN_DRAW);
}
void
w_chaingun_holster(void)
w_chaingun_holster(player pl)
{
Weapons_ViewAnimation(CHAINGUN_HOLSTER);
Weapons_ViewAnimation(pl, CHAINGUN_HOLSTER);
}
void
w_chaingun_release(void)
w_chaingun_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.chaingun_mag == 0 && pl.ammo_9mm > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -154,7 +151,7 @@ w_chaingun_release(void)
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spindown");
#endif
Weapons_ViewAnimation(CHAINGUN_SPINDOWN);
Weapons_ViewAnimation(pl, CHAINGUN_SPINDOWN);
pl.w_attack_next = 1.0f;
pl.w_idle_next = pl.w_attack_next;
return;
@ -163,7 +160,7 @@ w_chaingun_release(void)
/* end reload */
if (pl.mode_tempstate == 2) {
pl.mode_tempstate = 0;
Weapons_ViewAnimation(CHAINGUN_DRAW);
Weapons_ViewAnimation(pl, CHAINGUN_DRAW);
pl.w_attack_next = 1.0f;
pl.w_idle_next = pl.w_attack_next;
return;
@ -171,22 +168,21 @@ w_chaingun_release(void)
int r = (float)input_sequence % 2;
if (r) {
Weapons_ViewAnimation(CHAINGUN_IDLE1);
Weapons_ViewAnimation(pl, CHAINGUN_IDLE1);
} else {
Weapons_ViewAnimation(CHAINGUN_IDLE2);
Weapons_ViewAnimation(pl, CHAINGUN_IDLE2);
}
pl.w_idle_next = 15.0f;
}
void
w_chaingun_primary(void)
w_chaingun_primary(player pl)
{
player pl = (player)self;
/* in case we're spamming primary while reloading */
if (pl.mode_tempstate == 2) {
w_chaingun_release();
w_chaingun_release(pl);
return;
}
@ -200,7 +196,7 @@ w_chaingun_primary(void)
/* spin up first */
if (pl.mode_tempstate == 0) {
pl.mode_tempstate = 1;
Weapons_ViewAnimation(CHAINGUN_SPINUP);
Weapons_ViewAnimation(pl, CHAINGUN_SPINUP);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spinup");
#endif
@ -210,14 +206,14 @@ w_chaingun_primary(void)
}
pl.chaingun_mag--;
Weapons_ViewAnimation(CHAINGUN_FIRE);
Weapons_ViewPunchAngle([random(-2, 2),0,0]);
Weapons_ViewAnimation(pl, CHAINGUN_FIRE);
Weapons_ViewPunchAngle(pl, [random(-2, 2),0,0]);
#ifdef CLIENT
View_AddEvent(w_chaingun_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_RIFLE);
#else
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.15,0.15], WEAPON_CHAINGUN);
TraceAttack_FireBullets(1, Weapons_GetCameraPos(pl), 8, [0.15,0.15], WEAPON_CHAINGUN);
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.fire");
#endif
@ -226,11 +222,10 @@ w_chaingun_primary(void)
}
void
w_chaingun_reload(void)
w_chaingun_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
w_chaingun_release();
w_chaingun_release(pl);
return;
}
@ -240,7 +235,7 @@ w_chaingun_reload(void)
if (pl.ammo_9mm <= 0)
return;
Weapons_ViewAnimation(CHAINGUN_HOLSTER);
Weapons_ViewAnimation(pl, CHAINGUN_HOLSTER);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.reload");
@ -253,22 +248,21 @@ w_chaingun_reload(void)
}
void
w_chaingun_hud(void)
w_chaingun_hud(player pl)
{
w_glock_hud();
w_glock_hud(pl);
}
float
w_chaingun_aimanim(void)
w_chaingun_aimanim(player pl)
{
return w_mp5_aimanim();
return w_mp5_aimanim(pl);
}
void
w_chaingun_hudpic(int selected, vector pos, float a)
w_chaingun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.chaingun_mag == 0 && pl.ammo_9mm == 0)
@ -305,9 +299,8 @@ w_chaingun_hudpic(int selected, vector pos, float a)
}
int
w_chaingun_isempty(void)
w_chaingun_isempty(player pl)
{
player pl = (player)self;
if (pl.chaingun_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
@ -316,7 +309,7 @@ w_chaingun_isempty(void)
}
weapontype_t
w_chaingun_type(void)
w_chaingun_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -334,7 +327,7 @@ weapon_t w_chaingun =
.secondary = w_chaingun_release,
.reload = w_chaingun_reload,
.release = w_chaingun_release,
.crosshair = w_chaingun_hud,
.postdraw = w_chaingun_hud,
.precache = w_chaingun_precache,
.pickup = w_chaingun_pickup,
.updateammo = w_chaingun_updateammo,

View File

@ -55,9 +55,9 @@ w_flame_wmodel(void)
}
string
w_flame_pmodel(void)
w_flame_pmodel(player pl)
{
return w_egon_pmodel();
return w_egon_pmodel(pl);
}
string
@ -67,10 +67,9 @@ w_flame_deathmsg(void)
}
int
w_flame_pickup(int new, int startammo)
w_flame_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_gas < MAX_A_GAS) {
pl.ammo_gas = bound(0, pl.ammo_gas + 20, MAX_A_GAS);
@ -83,21 +82,20 @@ w_flame_pickup(int new, int startammo)
}
void
w_flame_draw(void)
w_flame_draw(player pl)
{
w_egon_draw();
w_egon_draw(pl);
}
void
w_flame_holster(void)
w_flame_holster(player pl)
{
w_egon_holster();
w_egon_holster(pl);
}
void
w_flame_primary(void)
w_flame_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -108,10 +106,10 @@ w_flame_primary(void)
pl.ammo_gas--;
#ifdef CLIENT
if (Weapons_GetAnimation() == EGON_IDLE1)
Weapons_ViewAnimation(EGON_ALTFIREON);
else if (Weapons_GetAnimation() == EGON_ALTFIREON)
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
if (Weapons_GetAnimation(pl) == EGON_IDLE1)
Weapons_ViewAnimation(pl, EGON_ALTFIREON);
else if (Weapons_GetAnimation(pl) == EGON_ALTFIREON)
Weapons_ViewAnimation(pl, EGON_ALTFIRECYCLE);
#else
static void w_flame_die(void) {
@ -141,8 +139,8 @@ w_flame_primary(void)
// Also will need check for water contents (so projectile will die underwater)
Weapons_MakeVectors();
ball.SetOrigin(Weapons_GetCameraPos() + (v_forward * 16));
Weapons_MakeVectors(pl);
ball.SetOrigin(Weapons_GetCameraPos(pl) + (v_forward * 16));
ball.SetVelocity(v_forward * 300);
setsize(ball, [0,0,0], [0,0,0]);
@ -153,18 +151,18 @@ w_flame_primary(void)
}
void
w_flame_reload(void)
w_flame_reload(player pl)
{
}
void
w_flame_release(void)
w_flame_release(player pl)
{
w_egon_release();
w_egon_release(pl);
}
void
w_flame_crosshair(void)
w_flame_crosshair(player pl)
{
#ifdef CLIENT
static vector cross_pos;
@ -177,16 +175,15 @@ w_flame_crosshair(void)
}
float
w_flame_aimanim(void)
w_flame_aimanim(player pl)
{
return w_egon_aimanim();
return w_egon_aimanim(pl);
}
void
w_flame_hudpic(int selected, vector pos, float a)
w_flame_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.ammo_gas == 0)
@ -223,9 +220,8 @@ w_flame_hudpic(int selected, vector pos, float a)
}
int
w_flame_isempty(void)
w_flame_isempty(player pl)
{
player pl = (player)self;
if (pl.ammo_gas <= 0)
return 1;
@ -234,7 +230,7 @@ w_flame_isempty(void)
}
weapontype_t
w_flame_type(void)
w_flame_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -252,7 +248,7 @@ weapon_t w_flame =
.secondary = w_flame_release,
.reload = __NULL__,
.release = w_flame_release,
.crosshair = w_flame_crosshair,
.postdraw = w_flame_crosshair,
.precache = w_flame_precache,
.pickup = w_flame_pickup,
.updateammo = w_flame_updateammo,

View File

@ -49,7 +49,7 @@ w_medkit_wmodel(void)
}
string
w_medkit_pmodel(void)
w_medkit_pmodel(player pl)
{
return "models/p_tfc_medkit.mdl";
}
@ -61,10 +61,9 @@ w_medkit_deathmsg(void)
}
int
w_medkit_pickup(int new, int startammo)
w_medkit_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
if (cvar("th_medkitstyle") == 1)
@ -86,16 +85,15 @@ w_medkit_pickup(int new, int startammo)
void
w_medkit_draw(void)
w_medkit_draw(player pl)
{
Weapons_SetModel("models/v_tfc_medkit.mdl");
Weapons_ViewAnimation(MEDKIT_DRAW);
Weapons_ViewAnimation(pl, MEDKIT_DRAW);
}
void
w_medkit_primary(void)
w_medkit_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -106,7 +104,7 @@ w_medkit_primary(void)
if (pl.health >= 100)
return;
else
Weapons_ViewAnimation(MEDKIT_USE);
Weapons_ViewAnimation(pl, MEDKIT_USE);
pl.ammo_medkit--;
@ -126,9 +124,8 @@ w_medkit_primary(void)
}
void
w_medkit_release(void)
w_medkit_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next > 0.0)
return;
@ -136,24 +133,24 @@ w_medkit_release(void)
int r = (float)input_sequence % 2;
switch (r) {
case 0:
Weapons_ViewAnimation(MEDKIT_IDLE1);
Weapons_ViewAnimation(pl, MEDKIT_IDLE1);
pl.w_idle_next = 1.16f;
break;
default:
Weapons_ViewAnimation(MEDKIT_IDLE2);
Weapons_ViewAnimation(pl, MEDKIT_IDLE2);
pl.w_idle_next = 2.36f;
break;
}
}
float
w_medkit_aimanim(void)
w_medkit_aimanim(player pl)
{
return w_snark_aimanim();
return w_snark_aimanim(pl);
}
void
w_medkit_crosshair(void)
w_medkit_crosshair(player pl)
{
#ifdef CLIENT
vector aicon_pos;
@ -175,10 +172,9 @@ w_medkit_crosshair(void)
}
void
w_medkit_hudpic(int selected, vector pos, float a)
w_medkit_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.ammo_medkit == 0)
@ -215,9 +211,8 @@ w_medkit_hudpic(int selected, vector pos, float a)
}
int
w_medkit_isempty(void)
w_medkit_isempty(player pl)
{
player pl = (player)self;
if (pl.ammo_medkit <= 0)
return 1;
@ -226,7 +221,7 @@ w_medkit_isempty(void)
}
weapontype_t
w_medkit_type(void)
w_medkit_type(player pl)
{
return WPNTYPE_CLOSE;
}
@ -244,7 +239,7 @@ weapon_t w_medkit =
.secondary = __NULL__,
.reload = __NULL__,
.release = w_medkit_release,
.crosshair = w_medkit_crosshair,
.postdraw = w_medkit_crosshair,
.precache = w_medkit_precache,
.pickup = w_medkit_pickup,
.updateammo = w_medkit_updateammo,

View File

@ -64,9 +64,9 @@ w_rpg2_wmodel(void)
}
string
w_rpg2_pmodel(void)
w_rpg2_pmodel(player pl)
{
return w_rpg_pmodel();
return w_rpg_pmodel(pl);
}
string
@ -76,48 +76,47 @@ w_rpg2_deathmsg(void)
}
int
w_rpg2_pickup(int new, int startammo)
w_rpg2_pickup(player pl, int new, int startammo)
{
return w_rpg_pickup(new, startammo);
return w_rpg_pickup(pl, new, startammo);
}
void
w_rpg2_draw(void)
w_rpg2_draw(player pl)
{
w_rpg_draw();
w_rpg_draw(pl);
}
void
w_rpg2_holster(void)
w_rpg2_holster(player pl)
{
}
void
w_rpg2_primary(void)
w_rpg2_primary(player pl)
{
w_rpg_primary();
w_rpg_primary(pl);
}
void
w_rpg2_reload(void)
w_rpg2_reload(player pl)
{
w_rpg_reload();
w_rpg_reload(pl);
}
void
w_rpg2_release(void)
w_rpg2_release(player pl)
{
w_rpg_release();
w_rpg_release(pl);
}
void
w_rpg2_secondary(void)
w_rpg2_secondary(player pl)
{
/* Another change to spice things up */
if (serverkeyfloat("th_rpgstyle") != 1) {
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -127,38 +126,38 @@ w_rpg2_secondary(void)
pl.ammo_rpg_state = 1 - pl.ammo_rpg_state;
pl.w_attack_next = 0.25f;
w_rpg2_release();
w_rpg2_release(pl);
}
}
float
w_rpg2_aimanim(void)
w_rpg2_aimanim(player pl)
{
return w_rpg_aimanim();
return w_rpg_aimanim(pl);
}
void
w_rpg2_hudpic(int selected, vector pos, float a)
w_rpg2_hudpic(player pl, int selected, vector pos, float a)
{
w_rpg_hudpic(selected, pos, a);
w_rpg_hudpic(pl, selected, pos, a);
}
void
w_rpg2_hud(void)
w_rpg2_hud(player pl)
{
w_rpg_hud();
w_rpg_hud(pl);
}
int
w_rpg2_isempty(void)
w_rpg2_isempty(player pl)
{
return w_rpg_isempty();
return w_rpg_isempty(pl);
}
weapontype_t
w_rpg2_type(void)
w_rpg2_type(player pl)
{
return w_rpg_type();
return w_rpg_type(pl);
}
weapon_t w_rpg2 =
@ -174,7 +173,7 @@ weapon_t w_rpg2 =
.secondary = w_rpg2_secondary,
.reload = w_rpg2_reload,
.release = w_rpg2_release,
.crosshair = w_rpg2_hud,
.postdraw = w_rpg2_hud,
.precache = w_rpg2_precache,
.pickup = w_rpg2_pickup,
.updateammo = w_rpg2_updateammo,

View File

@ -53,7 +53,7 @@ w_shovel_wmodel(void)
return "models/w_shovel.mdl";
}
string
w_shovel_pmodel(void)
w_shovel_pmodel(player pl)
{
return "models/p_shovel.mdl";
}
@ -65,29 +65,28 @@ w_shovel_deathmsg(void)
}
void
w_shovel_draw(void)
w_shovel_draw(player pl)
{
Weapons_SetModel("models/v_shovel.mdl");
Weapons_ViewAnimation(CBAR_DRAW);
Weapons_ViewAnimation(pl, CBAR_DRAW);
}
void
w_shovel_holster(void)
w_shovel_holster(player pl)
{
w_crowbar_holster();
w_crowbar_holster(pl);
}
void
w_shovel_primary(void)
w_shovel_primary(player pl)
{
int anim = 0;
vector src;
player pl = (player)self;
if (pl.w_attack_next)
return;
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs;
/* make sure we can gib corpses */
@ -101,10 +100,10 @@ w_shovel_primary(void)
if (serverkeyfloat("th_shovelstyle") == 1) {
if (trace_fraction >= 1.0) {
Weapons_ViewPunchAngle([5,0,0]);
Weapons_ViewPunchAngle(pl, [5,0,0]);
pl.w_attack_next = 0.85f;
} else {
Weapons_ViewPunchAngle([-20,0,0]);
Weapons_ViewPunchAngle(pl, [-20,0,0]);
pl.w_attack_next = 1.2f;
}
} else {
@ -119,13 +118,13 @@ w_shovel_primary(void)
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT);
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT);
break;
case 1:
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT);
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT);
break;
default:
Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
}
if (pl.flags & FL_CROUCHING) {
@ -163,19 +162,19 @@ w_shovel_primary(void)
}
void
w_shovel_release(void)
w_shovel_release(player pl)
{
w_crowbar_release();
w_crowbar_release(pl);
}
float
w_shovel_aimanim(void)
w_shovel_aimanim(player pl)
{
return w_crowbar_aimanim();
return w_crowbar_aimanim(pl);
}
void
w_shovel_hudpic(int selected, vector pos, float a)
w_shovel_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
@ -205,13 +204,13 @@ w_shovel_hudpic(int selected, vector pos, float a)
}
int
w_shovel_isempty(void)
w_shovel_isempty(player pl)
{
return 0;
}
weapontype_t
w_shovel_type(void)
w_shovel_type(player pl)
{
return WPNTYPE_CLOSE;
}
@ -229,7 +228,7 @@ weapon_t w_shovel =
.secondary = __NULL__,
.reload = __NULL__,
.release = w_shovel_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_shovel_precache,
.pickup = __NULL__,
.updateammo = w_shovel_updateammo,

View File

@ -55,9 +55,9 @@ w_silencer_wmodel(void)
}
string
w_silencer_pmodel(void)
w_silencer_pmodel(player pl)
{
return w_glock_pmodel();
return w_glock_pmodel(pl);
}
string
@ -67,18 +67,17 @@ w_silencer_deathmsg(void)
}
int
w_silencer_pickup(int new, int startammo)
w_silencer_pickup(player pl, int new, int startammo)
{
return w_glock_pickup(new, startammo);
return w_glock_pickup(pl, new, startammo);
}
void
w_silencer_draw(void)
w_silencer_draw(player pl)
{
w_glock_draw();
w_glock_draw(pl);
#ifdef CLIENT
player pl = (player)self;
if (pl.mode_silencer) {
Weapons_SetGeomset("geomset 2 2\n");
} else {
@ -87,15 +86,14 @@ w_silencer_draw(void)
#endif
}
void
w_silencer_holster(void)
w_silencer_holster(player pl)
{
w_glock_holster();
w_glock_holster(pl);
}
void
w_silencer_primary(void)
w_silencer_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -107,12 +105,12 @@ w_silencer_primary(void)
pl.glock_mag--;
/* actual firing */
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
if (pl.glock_mag) {
Weapons_ViewAnimation(GLOCK_SHOOT);
Weapons_ViewAnimation(pl, GLOCK_SHOOT);
} else {
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
}
if (self.flags & FL_CROUCHING)
@ -167,9 +165,8 @@ w_silencer_remove(void)
void
w_silencer_secondary(void)
w_silencer_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0)
return;
@ -180,14 +177,14 @@ w_silencer_secondary(void)
if (pl.mode_silencer) {
pl.w_attack_next = 3.3f;
pl.w_idle_next = pl.w_attack_next;
Weapons_ViewAnimation(GLOCK_SILENCER);
Weapons_ViewAnimation(pl, GLOCK_SILENCER);
#ifdef CLIENT
View_AddEvent(w_silencer_add, 1.0f);
#endif
} else {
pl.w_attack_next = 2.0f;
pl.w_idle_next = 1.0f;
Weapons_ViewAnimation(GLOCK_HOLSTER);
Weapons_ViewAnimation(pl, GLOCK_HOLSTER);
pl.mode_tempstate = 1;
#ifdef CLIENT
View_AddEvent(w_silencer_remove, 0.9f);
@ -196,21 +193,20 @@ w_silencer_secondary(void)
}
void
w_silencer_reload(void)
w_silencer_reload(player pl)
{
w_glock_reload();
w_glock_reload(pl);
}
void
w_silencer_release(void)
w_silencer_release(player pl)
{
player pl = (player)self;
int r;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.glock_mag == 0 && pl.ammo_9mm > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -220,7 +216,7 @@ w_silencer_release(void)
if (pl.mode_tempstate == 1)
{
Weapons_ViewAnimation(GLOCK_DRAW);
Weapons_ViewAnimation(pl, GLOCK_DRAW);
pl.w_idle_next = 1.0f;
pl.w_attack_next = pl.w_idle_next;
pl.mode_tempstate = 0;
@ -230,37 +226,36 @@ w_silencer_release(void)
r = floor(pseudorandom() * 3.0f);
switch (r) {
case 1:
Weapons_ViewAnimation(GLOCK_IDLE2);
Weapons_ViewAnimation(pl, GLOCK_IDLE2);
pl.w_idle_next = 2.5f;
break;
case 2:
Weapons_ViewAnimation(GLOCK_IDLE3);
Weapons_ViewAnimation(pl, GLOCK_IDLE3);
pl.w_idle_next = 3.5f;
break;
default:
Weapons_ViewAnimation(GLOCK_IDLE1);
Weapons_ViewAnimation(pl, GLOCK_IDLE1);
pl.w_idle_next = 3.75f;
break;
}
}
float
w_silencer_aimanim(void)
w_silencer_aimanim(player pl)
{
return w_glock_aimanim();
return w_glock_aimanim(pl);
}
void
w_silencer_hud(void)
w_silencer_hud(player pl)
{
w_glock_hud();
w_glock_hud(pl);
}
void
w_silencer_hudpic(int selected, vector pos, float a)
w_silencer_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.glock_mag == 0 && pl.ammo_9mm == 0)
@ -297,9 +292,8 @@ w_silencer_hudpic(int selected, vector pos, float a)
}
int
w_silencer_isempty(void)
w_silencer_isempty(player pl)
{
player pl = (player)self;
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
@ -308,7 +302,7 @@ w_silencer_isempty(void)
}
weapontype_t
w_silencer_type(void)
w_silencer_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -326,7 +320,7 @@ weapon_t w_silencer =
.secondary = w_silencer_secondary,
.reload = w_silencer_reload,
.release = w_silencer_release,
.crosshair = w_silencer_hud,
.postdraw = w_silencer_hud,
.precache = w_silencer_precache,
.pickup = w_silencer_pickup,
.updateammo = w_silencer_updateammo,

View File

@ -38,10 +38,9 @@ w_sniper_precache(void)
}
int
w_sniper_pickup(int new, int startammo)
w_sniper_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.sniper_mag = 5;
@ -71,7 +70,7 @@ w_sniper_wmodel(void)
}
string
w_sniper_pmodel(void)
w_sniper_pmodel(player pl)
{
return "models/p_sniper.mdl";
}
@ -83,30 +82,28 @@ w_sniper_deathmsg(void)
}
void
w_sniper_draw(void)
w_sniper_draw(player pl)
{
player pl = (player)self;
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tfc_sniper.mdl");
Weapons_ViewAnimation(SNIPER_DRAW);
Weapons_ViewAnimation(pl, SNIPER_DRAW);
}
void
w_sniper_holster(void)
w_sniper_holster(player pl)
{
Weapons_ViewAnimation(SNIPER_HOLSTER);
Weapons_ViewAnimation(pl, SNIPER_HOLSTER);
}
void
w_sniper_release(void)
w_sniper_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.sniper_mag == 0 && pl.ammo_sniper > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -114,7 +111,7 @@ w_sniper_release(void)
return;
if (pl.mode_tempstate == 1) {
Weapons_ViewAnimation(SNIPER_DRAW);
Weapons_ViewAnimation(pl, SNIPER_DRAW);
pl.mode_tempstate = 0;
pl.w_attack_next = 0.0f;
pl.w_idle_next = 15.0f;
@ -124,11 +121,11 @@ w_sniper_release(void)
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(SNIPER_IDLE1);
Weapons_ViewAnimation(pl, SNIPER_IDLE1);
pl.w_idle_next = 3.0f;
break;
case 1:
Weapons_ViewAnimation(SNIPER_IDLE2);
Weapons_ViewAnimation(pl, SNIPER_IDLE2);
pl.w_idle_next = 2.0f;
break;
}
@ -137,9 +134,8 @@ w_sniper_release(void)
}
void
w_sniper_primary(void)
w_sniper_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -150,8 +146,8 @@ w_sniper_primary(void)
pl.sniper_mag--;
Weapons_ViewPunchAngle([-20,0,0]);
Weapons_ViewAnimation(SNIPER_FIRE1);
Weapons_ViewPunchAngle(pl, [-20,0,0]);
Weapons_ViewAnimation(pl, SNIPER_FIRE1);
#ifdef CLIENT
View_AddEvent(w_chaingun_ejectshell, 0.0f);
@ -172,9 +168,8 @@ w_sniper_primary(void)
}
void
w_sniper_secondary(void)
w_sniper_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -190,11 +185,10 @@ w_sniper_secondary(void)
}
void
w_sniper_reload(void)
w_sniper_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
w_sniper_release();
w_sniper_release(pl);
return;
}
if (pl.sniper_mag >= 5)
@ -202,7 +196,7 @@ w_sniper_reload(void)
if (pl.ammo_sniper <= 0)
return;
Weapons_ViewAnimation(SNIPER_HOLSTER);
Weapons_ViewAnimation(pl, SNIPER_HOLSTER);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_sniper.reload");
@ -215,10 +209,9 @@ w_sniper_reload(void)
}
void
w_sniper_crosshair(void)
w_sniper_crosshair(player pl)
{
#ifdef CLIENT
player pl = (player)self;
static vector cross_pos;
vector aicon_pos;
@ -280,16 +273,15 @@ w_sniper_crosshair(void)
}
float
w_sniper_aimanim(void)
w_sniper_aimanim(player pl)
{
return w_crossbow_aimanim();
return w_crossbow_aimanim(pl);
}
void
w_sniper_hudpic(int selected, vector pos, float a)
w_sniper_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.sniper_mag == 0 && pl.ammo_sniper == 0)
@ -326,9 +318,8 @@ w_sniper_hudpic(int selected, vector pos, float a)
}
int
w_sniper_isempty(void)
w_sniper_isempty(player pl)
{
player pl = (player)self;
if (pl.sniper_mag <= 0 && pl.ammo_sniper <= 0)
return 1;
@ -337,7 +328,7 @@ w_sniper_isempty(void)
}
weapontype_t
w_sniper_type(void)
w_sniper_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -355,7 +346,7 @@ weapon_t w_sniper =
.secondary = w_sniper_secondary,
.reload = w_sniper_reload,
.release = w_sniper_release,
.crosshair = w_sniper_crosshair,
.postdraw = w_sniper_crosshair,
.precache = w_sniper_precache,
.pickup = w_sniper_pickup,
.updateammo = w_sniper_updateammo,

View File

@ -35,9 +35,9 @@ w_sniper2_precache(void)
}
int
w_sniper2_pickup(int new, int startammo)
w_sniper2_pickup(player pl, int new, int startammo)
{
return w_sniper_pickup(new, startammo);
return w_sniper_pickup(pl, new, startammo);
}
void
@ -53,7 +53,7 @@ w_sniper2_wmodel(void)
}
string
w_sniper2_pmodel(void)
w_sniper2_pmodel(player pl)
{
return "models/p_hkg36.mdl";
}
@ -65,26 +65,25 @@ w_sniper2_deathmsg(void)
}
void
w_sniper2_draw(void)
w_sniper2_draw(player pl)
{
Weapons_SetModel("models/v_hkg36.mdl");
Weapons_ViewAnimation(SNIPER_DRAW);
Weapons_ViewAnimation(pl, SNIPER_DRAW);
}
void
w_sniper2_holster(void)
w_sniper2_holster(player pl)
{
}
void
w_sniper2_release(void)
w_sniper2_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.sniper_mag == 0 && pl.ammo_sniper > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -94,11 +93,11 @@ w_sniper2_release(void)
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(SNIPER_IDLE1);
Weapons_ViewAnimation(pl, SNIPER_IDLE1);
pl.w_idle_next = 3.0f;
break;
case 1:
Weapons_ViewAnimation(SNIPER_IDLE2);
Weapons_ViewAnimation(pl, SNIPER_IDLE2);
pl.w_idle_next = 2.0f;
break;
}
@ -107,9 +106,8 @@ w_sniper2_release(void)
}
void
w_sniper2_primary(void)
w_sniper2_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -120,8 +118,8 @@ w_sniper2_primary(void)
pl.sniper_mag--;
Weapons_ViewPunchAngle([-20,0,0]);
Weapons_ViewAnimation(SNIPER_FIRE);
Weapons_ViewPunchAngle(pl, [-20,0,0]);
Weapons_ViewAnimation(pl, SNIPER_FIRE);
#ifdef CLIENT
View_AddEvent(w_pistol_ejectshell, 0.0f);
@ -142,15 +140,14 @@ w_sniper2_primary(void)
}
void
w_sniper2_secondary(void)
w_sniper2_secondary(player pl)
{
w_sniper_secondary();
w_sniper_secondary(pl);
}
void
w_sniper2_reload(void)
w_sniper2_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -159,7 +156,7 @@ w_sniper2_reload(void)
if (pl.ammo_sniper <= 0)
return;
Weapons_ViewAnimation(SNIPER_RELOAD);
Weapons_ViewAnimation(pl, SNIPER_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_sniper, 5);
@ -170,33 +167,33 @@ w_sniper2_reload(void)
}
void
w_sniper2_crosshair(void)
w_sniper2_crosshair(player pl)
{
#ifdef CLIENT
w_sniper_crosshair();
w_sniper_crosshair(pl);
#endif
}
float
w_sniper2_aimanim(void)
w_sniper2_aimanim(player pl)
{
return w_crossbow_aimanim();
return w_crossbow_aimanim(pl);
}
void
w_sniper2_hudpic(int selected, vector pos, float a)
w_sniper2_hudpic(player pl, int selected, vector pos, float a)
{
w_sniper_hudpic(selected, pos, a);
w_sniper_hudpic(pl, selected, pos, a);
}
int
w_sniper2_isempty(void)
w_sniper2_isempty(player pl)
{
w_sniper_isempty();
return w_sniper_isempty(pl);
}
weapontype_t
w_sniper2_type(void)
w_sniper2_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -214,7 +211,7 @@ weapon_t w_sniper2 =
.secondary = w_sniper2_secondary,
.reload = w_sniper2_reload,
.release = w_sniper2_release,
.crosshair = w_sniper2_crosshair,
.postdraw = w_sniper2_crosshair,
.precache = w_sniper2_precache,
.pickup = w_sniper2_pickup,
.updateammo = w_sniper2_updateammo,

View File

@ -50,7 +50,7 @@ w_spanner_wmodel(void)
return "models/backpack.mdl";
}
string
w_spanner_pmodel(void)
w_spanner_pmodel(player pl)
{
return "models/p_spanner.mdl";
}
@ -62,29 +62,28 @@ w_spanner_deathmsg(void)
}
void
w_spanner_draw(void)
w_spanner_draw(player pl)
{
Weapons_SetModel("models/v_tfc_spanner.mdl");
Weapons_ViewAnimation(CBAR_DRAW);
Weapons_ViewAnimation(pl, CBAR_DRAW);
}
void
w_spanner_holster(void)
w_spanner_holster(player pl)
{
w_crowbar_holster();
w_crowbar_holster(pl);
}
void
w_spanner_primary(void)
w_spanner_primary(player pl)
{
int anim = 0;
vector src;
player pl = (player)self;
if (pl.w_attack_next)
return;
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl);
@ -96,9 +95,9 @@ w_spanner_primary(void)
pl.w_idle_next = 2.5f;
if (random() < 0.5) {
Weapons_ViewAnimation(CBAR_ATTACK1);
Weapons_ViewAnimation(pl, CBAR_ATTACK1);
} else {
Weapons_ViewAnimation(CBAR_ATTACK2);
Weapons_ViewAnimation(pl, CBAR_ATTACK2);
}
if (pl.flags & FL_CROUCHING) {
@ -135,19 +134,19 @@ w_spanner_primary(void)
}
void
w_spanner_release(void)
w_spanner_release(player pl)
{
w_crowbar_release();
w_crowbar_release(pl);
}
float
w_spanner_aimanim(void)
w_spanner_aimanim(player pl)
{
return w_crowbar_aimanim();
return w_crowbar_aimanim(pl);
}
void
w_spanner_hudpic(int selected, vector pos, float a)
w_spanner_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
@ -177,13 +176,13 @@ w_spanner_hudpic(int selected, vector pos, float a)
}
int
w_spanner_isempty(void)
w_spanner_isempty(player pl)
{
return 0;
}
weapontype_t
w_spanner_type(void)
w_spanner_type(player pl)
{
return WPNTYPE_CLOSE;
}
@ -201,7 +200,7 @@ weapon_t w_spanner =
.secondary = __NULL__,
.reload = __NULL__,
.release = w_spanner_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_spanner_precache,
.pickup = __NULL__,
.updateammo = w_spanner_updateammo,

View File

@ -54,7 +54,7 @@ w_taurus_wmodel(void)
}
string
w_taurus_pmodel(void)
w_taurus_pmodel(player pl)
{
return "models/p_taurus.mdl";
}
@ -66,10 +66,9 @@ w_taurus_deathmsg(void)
}
int
w_taurus_pickup(int new, int startammo)
w_taurus_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.taurus_mag = 10;
@ -87,22 +86,21 @@ w_taurus_pickup(int new, int startammo)
}
void
w_taurus_draw(void)
w_taurus_draw(player pl)
{
Weapons_SetModel("models/v_taurus.mdl");
Weapons_ViewAnimation(TAURUS_DRAW);
Weapons_ViewAnimation(pl, TAURUS_DRAW);
}
void
w_taurus_holster(void)
w_taurus_holster(player pl)
{
Weapons_ViewAnimation(TAURUS_HOLSTER);
Weapons_ViewAnimation(pl, TAURUS_HOLSTER);
}
void
w_taurus_primary(void)
w_taurus_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -113,12 +111,12 @@ w_taurus_primary(void)
pl.taurus_mag--;
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
if (pl.taurus_mag) {
Weapons_ViewAnimation(TAURUS_SHOOT);
Weapons_ViewAnimation(pl, TAURUS_SHOOT);
} else {
Weapons_ViewAnimation(TAURUS_SHOOT_EMPTY);
Weapons_ViewAnimation(pl, TAURUS_SHOOT_EMPTY);
}
if (self.flags & FL_CROUCHING)
@ -140,15 +138,14 @@ w_taurus_primary(void)
}
void
w_taurus_secondary(void)
w_taurus_secondary(player pl)
{
}
void
w_taurus_reload(void)
w_taurus_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -158,9 +155,9 @@ w_taurus_reload(void)
return;
if (pl.taurus_mag) {
Weapons_ViewAnimation(TAURUS_RELOAD);
Weapons_ViewAnimation(pl, TAURUS_RELOAD);
} else {
Weapons_ViewAnimation(TAURUS_RELOAD2);
Weapons_ViewAnimation(pl, TAURUS_RELOAD2);
}
#ifdef SERVER
@ -172,15 +169,14 @@ w_taurus_reload(void)
}
void
w_taurus_release(void)
w_taurus_release(player pl)
{
player pl = (player)self;
int r;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.taurus_mag == 0 && pl.ammo_taurus > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -190,42 +186,41 @@ w_taurus_release(void)
r = floor(random(0,3));
switch (r) {
case 1:
Weapons_ViewAnimation(TAURUS_IDLE2);
Weapons_ViewAnimation(pl, TAURUS_IDLE2);
pl.w_idle_next = 2.25f;
break;
case 2:
Weapons_ViewAnimation(TAURUS_IDLE3);
Weapons_ViewAnimation(pl, TAURUS_IDLE3);
pl.w_idle_next = 2.5f;
break;
default:
Weapons_ViewAnimation(TAURUS_IDLE1);
Weapons_ViewAnimation(pl, TAURUS_IDLE1);
pl.w_idle_next = 2.81f;
break;
}
}
float
w_taurus_aimanim(void)
w_taurus_aimanim(player pl)
{
return w_glock_aimanim();
return w_glock_aimanim(pl);
}
void
w_taurus_hud(void)
w_taurus_hud(player pl)
{
w_glock_hud();
w_glock_hud(pl);
}
void
w_taurus_hudpic(int selected, vector pos, float a)
w_taurus_hudpic(player pl, int selected, vector pos, float a)
{
w_glock_hudpic(selected, pos, a);
w_glock_hudpic(pl, selected, pos, a);
}
int
w_taurus_isempty(void)
w_taurus_isempty(player pl)
{
player pl = (player)self;
if (pl.taurus_mag <= 0 && pl.ammo_taurus <= 0)
return 1;
@ -234,7 +229,7 @@ w_taurus_isempty(void)
}
weapontype_t
w_taurus_type(void)
w_taurus_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -252,7 +247,7 @@ weapon_t w_taurus =
.secondary = w_taurus_secondary,
.reload = w_taurus_reload,
.release = w_taurus_release,
.crosshair = w_taurus_hud,
.postdraw = w_taurus_hud,
.precache = w_taurus_precache,
.pickup = w_taurus_pickup,
.updateammo = w_taurus_updateammo,

View File

@ -51,7 +51,7 @@ w_tnt_wmodel(void)
}
string
w_tnt_pmodel(void)
w_tnt_pmodel(player pl)
{
return "models/p_tnt.mdl";
}
@ -63,14 +63,14 @@ w_tnt_deathmsg(void)
}
int
w_tnt_pickup(int new, int startammo)
w_tnt_pickup(player pl, int new, int startammo)
{
return w_handgrenade_pickup(new, startammo);
return w_handgrenade_pickup(pl, new, startammo);
}
#ifdef SERVER
void
w_tnt_throw(void)
w_tnt_throw(player pl)
{
static void WeaponFrag_Throw_Explode(void) {
float dmg = Skill_GetValue("plr_hand_grenade", 100);
@ -89,7 +89,6 @@ w_tnt_throw(void)
self.frame = 0;
}
player pl = (player)self;
vector vPLAngle = pl.v_angle;
if (vPLAngle[0] < 0)
@ -122,28 +121,27 @@ w_tnt_throw(void)
#endif
void
w_tnt_draw(void)
w_tnt_draw(player pl)
{
player pl = (player)self;
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tnt.mdl");
Weapons_ViewAnimation(HANDGRENADE_DRAW);
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
}
void
w_tnt_holster(void)
w_tnt_holster(player pl)
{
}
void
w_tnt_primary(void)
w_tnt_primary(player pl)
{
w_handgrenade_primary();
w_handgrenade_primary(pl);
}
void
w_tnt_hud(void)
w_tnt_hud(player pl)
{
#ifdef CLIENT
HUD_DrawAmmo2();
@ -154,18 +152,17 @@ w_tnt_hud(void)
void
w_tnt_release(void)
w_tnt_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next > 0.0)
return;
if (pl.mode_tempstate == 1) {
#ifdef SERVER
w_tnt_throw();
w_tnt_throw(pl);
#endif
Weapons_ViewAnimation(HANDGRENADE_THROW1);
Weapons_ViewAnimation(pl, HANDGRENADE_THROW1);
pl.ammo_handgrenade--;
pl.mode_tempstate = 2;
pl.w_attack_next = 1.0f;
@ -175,38 +172,37 @@ w_tnt_release(void)
if (!pl.ammo_handgrenade)
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
#endif
Weapons_ViewAnimation(HANDGRENADE_DRAW);
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
pl.mode_tempstate = 0;
} else {
int r = (float)input_sequence % 8;
if (r == 1) {
Weapons_ViewAnimation(HANDGRENADE_FIDGET);
Weapons_ViewAnimation(pl, HANDGRENADE_FIDGET);
pl.w_idle_next = 2.5f;
} else {
Weapons_ViewAnimation(HANDGRENADE_IDLE);
Weapons_ViewAnimation(pl, HANDGRENADE_IDLE);
pl.w_idle_next = 3.0f;
}
}
}
float
w_tnt_aimanim(void)
w_tnt_aimanim(player pl)
{
return w_handgrenade_aimanim();
return w_handgrenade_aimanim(pl);
}
void
w_tnt_hudpic(int selected, vector pos, float a)
w_tnt_hudpic(player pl, int selected, vector pos, float a)
{
w_handgrenade_hudpic(selected, pos, a);
w_handgrenade_hudpic(pl, selected, pos, a);
}
int
w_tnt_isempty(void)
w_tnt_isempty(player pl)
{
player pl = (player)self;
if (pl.ammo_handgrenade <= 0)
return 1;
@ -215,7 +211,7 @@ w_tnt_isempty(void)
}
weapontype_t
w_tnt_type(void)
w_tnt_type(player pl)
{
return WPNTYPE_RANGED;
}
@ -233,7 +229,7 @@ weapon_t w_tnt =
.secondary = w_tnt_release,
.reload = w_tnt_release,
.release = w_tnt_release,
.crosshair = w_tnt_hud,
.postdraw = w_tnt_hud,
.precache = w_tnt_precache,
.pickup = w_tnt_pickup,
.updateammo = w_tnt_updateammo,