Rebased against the latest Nuclide commit.

This commit is contained in:
Marco Cawthorne 2022-03-15 19:34:53 -07:00
parent 7c145d0b46
commit 2392c1502c
Signed by: eukara
GPG Key ID: C196CD8BA993248A
11 changed files with 234 additions and 288 deletions

View File

@ -210,14 +210,14 @@ HUD_DrawWeaponSelect(void)
slot_selected = TRUE;
if (x == wantpos) {
// Selected Sprite
Weapons_HUDPic(pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f);
Weapons_HUDPic(pl, pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f);
drawsubpic(vecPos, [170,45], "sprites/640hud3.spr_0.tga",
[0,180/256], [170/256,45/256],
g_hud_color, 1, DRAWFLAG_ADDITIVE);
vecPos[1] += 50;
} else if ((b=HUD_InSlotPos(i, x)) != -1) {
// Unselected Sprite
Weapons_HUDPic(b, 0, vecPos, 1.0f);
Weapons_HUDPic(pl, b, 0, vecPos, 1.0f);
vecPos[1] += 50;
}
} else if (HUD_InSlotPos(i, x) != -1) {

View File

@ -71,7 +71,7 @@ w_displacer_wmodel(void)
}
string
w_displacer_pmodel(void)
w_displacer_pmodel(player pl)
{
return "models/p_displacer.mdl";
}
@ -83,10 +83,9 @@ w_displacer_deathmsg(void)
}
int
w_displacer_pickup(int new, int startammo)
w_displacer_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 40, MAX_A_URANIUM);
@ -98,16 +97,16 @@ w_displacer_pickup(int new, int startammo)
}
void
w_displacer_draw(void)
w_displacer_draw(player pl)
{
Weapons_SetModel("models/v_displacer.mdl");
Weapons_ViewAnimation(DISP_DRAW);
Weapons_ViewAnimation(pl, DISP_DRAW);
}
void
w_displacer_holster(void)
w_displacer_holster(player pl)
{
Weapons_ViewAnimation(DISP_HOLSTER);
Weapons_ViewAnimation(pl, DISP_HOLSTER);
}
void
@ -127,10 +126,9 @@ w_displacer_teleport(entity target)
}
void
w_displacer_fireball(void)
w_displacer_fireball(player pl)
{
#ifdef SERVER
player pl = (player)self;
static void displacerball_touch(void)
{
@ -152,11 +150,11 @@ w_displacer_fireball(void)
self.nextthink = time + 0.1f;
}
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
entity ball = spawn();
setmodel(ball, "sprites/exit1.spr");
setorigin(ball, Weapons_GetCameraPos() + (v_forward * 16));
setorigin(ball, Weapons_GetCameraPos(pl) + (v_forward * 16));
ball.owner = self;
ball.velocity = v_forward * 500;
ball.movetype = MOVETYPE_FLYMISSILE;
@ -172,23 +170,22 @@ w_displacer_fireball(void)
}
void
w_displacer_release(void)
w_displacer_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next > 0.0) {
return;
}
if (pl.mode_displacer == 1) {
Weapons_ViewAnimation(DISP_FIRE);
w_displacer_fireball();
Weapons_ViewAnimation(pl, DISP_FIRE);
w_displacer_fireball(pl);
pl.mode_displacer = 0;
pl.w_idle_next = pl.w_attack_next = 1.0f;
pl.ammo_uranium -= 20;
return;
} else if (pl.mode_displacer == 2) {
Weapons_ViewAnimation(DISP_FIRE);
Weapons_ViewAnimation(pl, DISP_FIRE);
w_displacer_teleport(pl);
pl.mode_displacer = 0;
pl.w_idle_next = pl.w_attack_next = 1.0f;
@ -198,19 +195,17 @@ w_displacer_release(void)
int r = (float)input_sequence % 3;
if (r == 1) {
Weapons_ViewAnimation(DISP_IDLE1);
Weapons_ViewAnimation(pl, DISP_IDLE1);
} else {
Weapons_ViewAnimation(DISP_IDLE2);
Weapons_ViewAnimation(pl, DISP_IDLE2);
}
pl.w_idle_next = 3.0f;
}
void
w_displacer_primary(void)
w_displacer_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
@ -222,13 +217,13 @@ w_displacer_primary(void)
/* we're already in spinning mode */
if (pl.mode_displacer > 0) {
w_displacer_release();
w_displacer_release(pl);
return;
}
pl.mode_displacer = 1;
Weapons_ViewAnimation(DISP_SPINUP);
Weapons_ViewAnimation(pl, DISP_SPINUP);
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM);
@ -237,9 +232,8 @@ w_displacer_primary(void)
}
void
w_displacer_secondary(void)
w_displacer_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -251,12 +245,12 @@ w_displacer_secondary(void)
/* we're already in spinning mode */
if (pl.mode_displacer > 0) {
w_displacer_release();
w_displacer_release(pl);
return;
}
pl.mode_displacer = 2;
Weapons_ViewAnimation(DISP_SPINUP);
Weapons_ViewAnimation(pl, DISP_SPINUP);
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM);
@ -265,13 +259,13 @@ w_displacer_secondary(void)
}
float
w_displacer_aimanim(void)
w_displacer_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
}
void
w_displacer_hud(void)
w_displacer_hud(player pl)
{
#ifdef CLIENT
vector cross_pos;
@ -307,9 +301,8 @@ w_displacer_hud(void)
}
int
w_displacer_isempty(void)
w_displacer_isempty(player pl)
{
player pl = (player)self;
if (pl.ammo_uranium <= 0)
return 1;
@ -318,13 +311,12 @@ w_displacer_isempty(void)
}
void
w_displacer_hudpic(int selected, vector pos, float a)
w_displacer_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_displacer_isempty())
if (w_displacer_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -369,7 +361,7 @@ weapon_t w_displacer =
.secondary = w_displacer_secondary,
.reload = __NULL__,
.release = w_displacer_release,
.crosshair = w_displacer_hud,
.postdraw = w_displacer_hud,
.precache = w_displacer_precache,
.pickup = w_displacer_pickup,
.updateammo = w_displacer_updateammo,

View File

@ -53,10 +53,9 @@ w_eagle_precache(void)
}
int
w_eagle_pickup(int new, int startammo)
w_eagle_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.eagle_mag = 7;
@ -83,7 +82,7 @@ w_eagle_wmodel(void)
return "models/w_desert_eagle.mdl";
}
string
w_eagle_pmodel(void)
w_eagle_pmodel(player pl)
{
return "models/p_desert_eagle.mdl";
}
@ -94,27 +93,26 @@ w_eagle_deathmsg(void)
}
void
w_eagle_draw(void)
w_eagle_draw(player pl)
{
Weapons_SetModel("models/v_desert_eagle.mdl");
Weapons_ViewAnimation(EAGLE_DRAW);
Weapons_ViewAnimation(pl, EAGLE_DRAW);
}
void
w_eagle_holster(void)
w_eagle_holster(player pl)
{
Weapons_ViewAnimation(EAGLE_HOLSTER);
Weapons_ViewAnimation(pl, EAGLE_HOLSTER);
}
void
w_eagle_release(void)
w_eagle_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.eagle_mag == 0 && pl.ammo_357 > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -129,27 +127,26 @@ w_eagle_release(void)
int r = (float)input_sequence % 4;
switch (r) {
case 0:
Weapons_ViewAnimation(EAGLE_IDLE1);
Weapons_ViewAnimation(pl, EAGLE_IDLE1);
pl.w_idle_next = 2.5f;
break;
case 1:
Weapons_ViewAnimation(EAGLE_IDLE2);
Weapons_ViewAnimation(pl, EAGLE_IDLE2);
pl.w_idle_next = 2.5f;
break;
case 2:
Weapons_ViewAnimation(EAGLE_IDLE3);
Weapons_ViewAnimation(pl, EAGLE_IDLE3);
pl.w_idle_next = 1.633333f;
break;
default:
Weapons_ViewAnimation(EAGLE_IDLE4);
Weapons_ViewAnimation(pl, EAGLE_IDLE4);
pl.w_idle_next = 2.5f;
}
}
void
w_eagle_primary(void)
w_eagle_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
@ -172,12 +169,12 @@ w_eagle_primary(void)
}
pl.eagle_mag--;
Weapons_ViewPunchAngle([-10,0,0]);
Weapons_ViewPunchAngle(pl, [-10,0,0]);
if (pl.eagle_mag <= 0) {
Weapons_ViewAnimation(EAGLE_SHOOT_EMPTY);
Weapons_ViewAnimation(pl, EAGLE_SHOOT_EMPTY);
} else {
Weapons_ViewAnimation(EAGLE_SHOOT);
Weapons_ViewAnimation(pl, EAGLE_SHOOT);
}
#ifdef SERVER
@ -189,9 +186,8 @@ w_eagle_primary(void)
}
void
w_eagle_secondary(void)
w_eagle_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -209,13 +205,12 @@ w_eagle_secondary(void)
#endif
pl.w_attack_next = 1.0f;
w_eagle_release();
w_eagle_release(pl);
}
void
w_eagle_reload(void)
w_eagle_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -230,9 +225,9 @@ w_eagle_reload(void)
}
if (pl.eagle_mag <= 0) {
Weapons_ViewAnimation(EAGLE_RELOAD);
Weapons_ViewAnimation(pl, EAGLE_RELOAD);
} else {
Weapons_ViewAnimation(EAGLE_RELOAD_NOSHOT);
Weapons_ViewAnimation(pl, EAGLE_RELOAD_NOSHOT);
}
/* Audio-Visual bit */
@ -251,10 +246,9 @@ w_eagle_reload(void)
}
void
w_eagle_crosshair(void)
w_eagle_crosshair(player pl)
{
#ifdef CLIENT
player pl = (player)self;
vector cross_pos;
vector aicon_pos;
@ -262,7 +256,7 @@ w_eagle_crosshair(void)
if (pl.mode_eagle == 1) {
float lerp;
vector jitter;
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
vector src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 256), FALSE, pl);
lerp = Math_Lerp(18,6, trace_fraction);
@ -313,15 +307,14 @@ w_eagle_crosshair(void)
}
float
w_eagle_aimanim(void)
w_eagle_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
}
int
w_eagle_isempty(void)
w_eagle_isempty(player pl)
{
player pl = (player)self;
if (pl.eagle_mag <= 0 && pl.ammo_357 <= 0)
return 1;
@ -330,13 +323,12 @@ w_eagle_isempty(void)
}
void
w_eagle_hudpic(int selected, vector pos, float a)
w_eagle_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_eagle_isempty())
if (w_eagle_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -381,7 +373,7 @@ weapon_t w_eagle =
.secondary = w_eagle_secondary,
.reload = w_eagle_reload,
.release = w_eagle_release,
.crosshair = w_eagle_crosshair,
.postdraw = w_eagle_crosshair,
.precache = w_eagle_precache,
.pickup = w_eagle_pickup,
.updateammo = w_eagle_updateammo,

View File

@ -76,7 +76,7 @@ w_grapple_wmodel(void)
}
string
w_grapple_pmodel(void)
w_grapple_pmodel(player pl)
{
return "models/p_bgrap.mdl";
}
@ -88,16 +88,16 @@ w_grapple_deathmsg(void)
}
void
w_grapple_draw(void)
w_grapple_draw(player pl)
{
Weapons_SetModel("models/v_bgrap.mdl");
Weapons_ViewAnimation(BARN_DRAW);
Weapons_ViewAnimation(pl, BARN_DRAW);
}
void
w_grapple_holster(void)
w_grapple_holster(player pl)
{
Weapons_ViewAnimation(BARN_HOLSTER);
Weapons_ViewAnimation(pl, BARN_HOLSTER);
}
/* called once the tongue hits a wall */
@ -143,15 +143,14 @@ grapple_predraw(void)
/* spawn and pull */
void
w_grapple_primary(void)
w_grapple_primary(player pl)
{
player pl = (player)self;
if (pl.hook != __NULL__) {
/* play the looping reel anim once */
if (pl.a_ammo1 == 1) {
pl.a_ammo1 = 2;
Weapons_ViewAnimation(BARN_FIRETRAVEL);
Weapons_ViewAnimation(pl, BARN_FIRETRAVEL);
} else if (pl.a_ammo1 == 2) {
pl.hook.skin = 1; /* grappled */
}
@ -161,8 +160,8 @@ w_grapple_primary(void)
}
#ifdef SERVER
Weapons_MakeVectors();
vector src = Weapons_GetCameraPos();
Weapons_MakeVectors(pl);
vector src = Weapons_GetCameraPos(pl);
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_ent.takedamage == DAMAGE_YES && trace_ent.iBleeds) {
Damage_Apply(trace_ent, pl, 25, WEAPON_GRAPPLE, DMG_GENERIC);
@ -172,7 +171,7 @@ w_grapple_primary(void)
return;
}
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
pl.hook = spawn();
#ifdef CLIENT
@ -183,7 +182,7 @@ w_grapple_primary(void)
sound(pl, CHAN_WEAPON, "weapons/bgrapple_fire.wav", 1.0, ATTN_NORM);
sound(pl, CHAN_VOICE, "weapons/bgrapple_pull.wav", 1.0, ATTN_NORM);
#endif
setorigin(pl.hook, Weapons_GetCameraPos() + (v_forward * 16));
setorigin(pl.hook, Weapons_GetCameraPos(pl) + (v_forward * 16));
pl.hook.owner = self;
pl.hook.velocity = v_forward * 1500;
pl.hook.movetype = MOVETYPE_FLYMISSILE;
@ -191,14 +190,13 @@ w_grapple_primary(void)
pl.hook.angles = vectoangles(pl.hook.velocity);
pl.hook.touch = Grapple_Touch;
setsize(pl.hook, [0,0,0], [0,0,0]);
Weapons_ViewAnimation(BARN_FIRE);
Weapons_ViewAnimation(pl, BARN_FIRE);
}
/* let go, hang */
void
w_grapple_secondary(void)
w_grapple_secondary(player pl)
{
player pl = (player)self;
if (pl.hook == __NULL__) {
return;
}
@ -208,16 +206,15 @@ w_grapple_secondary(void)
/* de-spawn and play idle anims */
void
w_grapple_release(void)
w_grapple_release(player pl)
{
player pl = (player)self;
if (pl.hook != __NULL__) {
pl.a_ammo1 = 0; /* cache */
pl.hook.skin = 0; /* ungrappled */
remove(pl.hook);
#ifdef CLIENT
Weapons_ViewAnimation(BARN_FIRERELEASE);
Weapons_ViewAnimation(pl, BARN_FIRERELEASE);
#else
sound(pl, CHAN_VOICE, "weapons/bgrapple_release.wav", 1.0, ATTN_NORM);
#endif
@ -232,28 +229,28 @@ w_grapple_release(void)
int r = (float)input_sequence % 3;
switch (r) {
case 1:
Weapons_ViewAnimation(BARN_IDLE1);
Weapons_ViewAnimation(pl, BARN_IDLE1);
pl.w_idle_next = 2.566667f;
break;
case 2:
Weapons_ViewAnimation(BARN_IDLE2);
Weapons_ViewAnimation(pl, BARN_IDLE2);
pl.w_idle_next = 10.0f;
break;
default:
Weapons_ViewAnimation(BARN_IDLE3);
Weapons_ViewAnimation(pl, BARN_IDLE3);
pl.w_idle_next = 1.35f;
break;
}
}
float
w_grapple_aimanim(void)
w_grapple_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
}
void
w_grapple_hudpic(int selected, vector pos, float a)
w_grapple_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
@ -294,7 +291,7 @@ weapon_t w_grapple =
.secondary = w_grapple_secondary,
.reload = __NULL__,
.release = w_grapple_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_grapple_precache,
.pickup = __NULL__,
.updateammo = w_grapple_updateammo,

View File

@ -69,7 +69,7 @@ w_knife_wmodel(void)
}
string
w_knife_pmodel(void)
w_knife_pmodel(player pl)
{
return "models/p_knife.mdl";
}
@ -81,31 +81,30 @@ w_knife_deathmsg(void)
}
void
w_knife_draw(void)
w_knife_draw(player pl)
{
Weapons_SetModel("models/v_knife.mdl");
Weapons_ViewAnimation(KNIFE_DRAW);
Weapons_ViewAnimation(pl, KNIFE_DRAW);
}
void
w_knife_holster(void)
w_knife_holster(player pl)
{
Weapons_ViewAnimation(KNIFE_HOLSTER);
Weapons_ViewAnimation(pl, KNIFE_HOLSTER);
}
void
w_knife_primary(void)
w_knife_primary(player pl)
{
int anim = 0;
int r;
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);
@ -127,7 +126,7 @@ w_knife_primary(void)
default:
anim = trace_fraction >= 1 ? KNIFE_ATTACK3MISS:KNIFE_ATTACK3HIT;
}
Weapons_ViewAnimation(anim);
Weapons_ViewAnimation(pl, anim);
if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -182,10 +181,9 @@ w_knife_primary(void)
}
void
w_knife_release(void)
w_knife_release(player pl)
{
int r;
player pl = (player)self;
if (pl.w_idle_next) {
return;
@ -194,27 +192,27 @@ w_knife_release(void)
r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(KNIFE_IDLE1);
Weapons_ViewAnimation(pl, KNIFE_IDLE1);
pl.w_idle_next = 2.7f;
break;
case 1:
Weapons_ViewAnimation(KNIFE_IDLE2);
Weapons_ViewAnimation(pl, KNIFE_IDLE2);
pl.w_idle_next = 5.3f;
break;
default:
Weapons_ViewAnimation(KNIFE_IDLE3);
Weapons_ViewAnimation(pl, KNIFE_IDLE3);
pl.w_idle_next = 5.3f;
}
}
float
w_knife_aimanim(void)
w_knife_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
}
void
w_knife_hudpic(int selected, vector pos, float a)
w_knife_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
@ -255,7 +253,7 @@ weapon_t w_knife =
.secondary = __NULL__,
.reload = __NULL__,
.release = w_knife_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_knife_precache,
.pickup = __NULL__,
.updateammo = w_knife_updateammo,

View File

@ -52,10 +52,9 @@ w_m249_precache(void)
}
int
w_m249_pickup(int new, int startammo)
w_m249_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.m249_mag = 50;
@ -83,7 +82,7 @@ w_m249_wmodel(void)
}
string
w_m249_pmodel(void)
w_m249_pmodel(player pl)
{
return "models/p_saw.mdl";
}
@ -95,27 +94,26 @@ w_m249_deathmsg(void)
}
void
w_m249_draw(void)
w_m249_draw(player pl)
{
Weapons_SetModel("models/v_saw.mdl");
Weapons_ViewAnimation(M249_DRAW);
Weapons_ViewAnimation(pl, M249_DRAW);
}
void
w_m249_holster(void)
w_m249_holster(player pl)
{
Weapons_ViewAnimation(M249_DRAW);
Weapons_ViewAnimation(pl, M249_DRAW);
}
void
w_m249_release(void)
w_m249_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.mode_m249 == 0 && pl.m249_mag == 0 && pl.ammo_556 > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -124,7 +122,7 @@ w_m249_release(void)
}
if (pl.mode_m249 == 1) {
Weapons_ViewAnimation(M249_RELOAD2);
Weapons_ViewAnimation(pl, M249_RELOAD2);
pl.mode_m249 = 0;
pl.w_attack_next = 2.45f;
pl.w_idle_next = 15.0f;
@ -133,22 +131,21 @@ w_m249_release(void)
int r = (float)input_sequence % 2;
if (r < 1) {
Weapons_ViewAnimation(M249_IDLE1);
Weapons_ViewAnimation(pl, M249_IDLE1);
} else {
Weapons_ViewAnimation(M249_IDLE2);
Weapons_ViewAnimation(pl, M249_IDLE2);
}
pl.w_idle_next = 15.0f;
}
void
w_m249_primary(void)
w_m249_primary(player pl)
{
player pl = (player)self;
vector push;
if (pl.mode_m249 == 1) {
w_m249_release();
w_m249_release(pl);
return;
}
@ -161,8 +158,8 @@ w_m249_primary(void)
return;
}
Weapons_ViewPunchAngle([-5,0,0]);
Weapons_ViewAnimation(M249_FIRE);
Weapons_ViewPunchAngle(pl, [-5,0,0]);
Weapons_ViewAnimation(pl, M249_FIRE);
push = v_forward * -64;
push[2] *= 0.25f; /* gravity duh */
@ -193,12 +190,11 @@ w_m249_primary(void)
}
void
w_m249_reload(void)
w_m249_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
w_m249_release();
w_m249_release(pl);
return;
}
@ -207,7 +203,7 @@ w_m249_reload(void)
if (pl.ammo_556 <= 0)
return;
Weapons_ViewAnimation(M249_RELOAD1);
Weapons_ViewAnimation(pl, M249_RELOAD1);
#ifdef SERVER
static void w_m249_reload_done(void) {
@ -224,7 +220,7 @@ w_m249_reload(void)
}
void
w_m249_crosshair(void)
w_m249_crosshair(player pl)
{
#ifdef CLIENT
vector cross_pos;
@ -263,15 +259,14 @@ w_m249_crosshair(void)
}
float
w_m249_aimanim(void)
w_m249_aimanim(player pl)
{
return self.flags & ANIM_CR_AIMMP5 ? ANIM_CR_AIMCROWBAR : ANIM_AIMMP5;
}
int
w_m249_isempty(void)
w_m249_isempty(player pl)
{
player pl = (player)self;
if (pl.m249_mag <= 0 && pl.ammo_556 <= 0)
return 1;
@ -280,13 +275,12 @@ w_m249_isempty(void)
}
void
w_m249_hudpic(int selected, vector pos, float a)
w_m249_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_m249_isempty())
if (w_m249_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -331,7 +325,7 @@ weapon_t w_m249 =
.secondary = __NULL__,
.reload = w_m249_reload,
.release = w_m249_release,
.crosshair = w_m249_crosshair,
.postdraw = w_m249_crosshair,
.precache = w_m249_precache,
.pickup = w_m249_pickup,
.updateammo = w_m249_updateammo,

View File

@ -34,10 +34,9 @@ enum
};
int
w_penguin_pickup(int new, int startammo)
w_penguin_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_penguin < MAX_A_PENGUIN) {
pl.ammo_penguin = bound(0, pl.ammo_penguin + 3, MAX_A_PENGUIN);
@ -49,14 +48,14 @@ w_penguin_pickup(int new, int startammo)
}
void
w_penguin_draw(void)
w_penguin_draw(player pl)
{
Weapons_SetModel("models/v_penguin.mdl");
Weapons_ViewAnimation(PENGUIN_DRAW);
Weapons_ViewAnimation(pl, PENGUIN_DRAW);
}
void
w_penguin_holster(void)
w_penguin_holster(player pl)
{
}
@ -184,9 +183,8 @@ w_penguin_deploy(void)
#endif
void
w_penguin_primary(void)
w_penguin_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -197,7 +195,7 @@ w_penguin_primary(void)
}
pl.ammo_penguin--;
Weapons_ViewAnimation(PENGUIN_THROW);
Weapons_ViewAnimation(pl, PENGUIN_THROW);
/* Audio-Visual Bit */
#ifdef SERVER
@ -214,22 +212,21 @@ w_penguin_primary(void)
}
void
w_penguin_secondary(void)
w_penguin_secondary(player pl)
{
}
void
w_penguin_reload(void)
w_penguin_reload(player pl)
{
}
void
w_penguin_release(void)
w_penguin_release(player pl)
{
int r;
player pl = (player)self;
if (pl.w_idle_next > 0.0) {
return;
}
@ -237,15 +234,15 @@ w_penguin_release(void)
r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(PENGUIN_IDLE);
Weapons_ViewAnimation(pl, PENGUIN_IDLE);
pl.w_idle_next = 1.875f;
break;
case 1:
Weapons_ViewAnimation(PENGUIN_FIDGET1);
Weapons_ViewAnimation(pl, PENGUIN_FIDGET1);
pl.w_idle_next = 4.375f;
break;
default:
Weapons_ViewAnimation(PENGUIN_FIDGET2);
Weapons_ViewAnimation(pl, PENGUIN_FIDGET2);
pl.w_idle_next = 5.0f;
break;
}
@ -281,7 +278,7 @@ w_penguin_wmodel(void)
}
string
w_penguin_pmodel(void)
w_penguin_pmodel(player pl)
{
return "models/p_penguin.mdl";
}
@ -294,13 +291,13 @@ w_penguin_deathmsg(void)
float
w_penguin_aimanim(void)
w_penguin_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
}
void
w_penguin_hud(void)
w_penguin_hud(player pl)
{
#ifdef CLIENT
HUD_DrawAmmo2();
@ -310,10 +307,9 @@ w_penguin_hud(void)
}
void
w_penguin_hudpic(int s, vector pos, float a)
w_penguin_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.ammo_penguin == 0)
@ -347,7 +343,7 @@ weapon_t w_penguin =
.secondary = w_penguin_secondary,
.reload = w_penguin_reload,
.release = w_penguin_release,
.crosshair = w_penguin_hud,
.postdraw = w_penguin_hud,
.precache = w_penguin_precache,
.pickup = w_penguin_pickup,
.updateammo = w_penguin_updateammo,

View File

@ -78,7 +78,7 @@ w_pipewrench_wmodel(void)
}
string
w_pipewrench_pmodel(void)
w_pipewrench_pmodel(player pl)
{
return "models/p_pipe_wrench.mdl";
}
@ -90,31 +90,30 @@ w_pipewrench_deathmsg(void)
}
void
w_pipewrench_draw(void)
w_pipewrench_draw(player pl)
{
Weapons_SetModel("models/v_pipe_wrench.mdl");
Weapons_ViewAnimation(PIPE_DRAW);
Weapons_ViewAnimation(pl, PIPE_DRAW);
}
void
w_pipewrench_holster(void)
w_pipewrench_holster(player pl)
{
Weapons_ViewAnimation(PIPE_HOLSTER);
Weapons_ViewAnimation(pl, PIPE_HOLSTER);
}
void
w_pipewrench_primary(void)
w_pipewrench_primary(player pl)
{
int anim = 0;
vector src;
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
Weapons_MakeVectors();
src = Weapons_GetCameraPos();
Weapons_MakeVectors(pl);
src = Weapons_GetCameraPos(pl);
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_fraction >= 1.0) {
@ -135,7 +134,7 @@ w_pipewrench_primary(void)
default:
anim = trace_fraction >= 1 ? PIPE_ATTACK3MISS:PIPE_ATTACK3HIT;
}
Weapons_ViewAnimation(anim);
Weapons_ViewAnimation(pl, anim);
if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -182,14 +181,13 @@ w_pipewrench_primary(void)
}
void
w_pipewrench_secondary(void)
w_pipewrench_secondary(player pl)
{
player pl = (player)self;
if (!pl.w_attack_next) {
/* Hack */
if (pl.mode_wrench != 1) {
Weapons_ViewAnimation(PIPE_ATTACKBIGWIND);
Weapons_ViewAnimation(pl, PIPE_ATTACKBIGWIND);
pl.mode_wrench = 1;
pl.w_attack_next = 0.75f;
}
@ -198,10 +196,9 @@ w_pipewrench_secondary(void)
}
void
w_pipewrench_release(void)
w_pipewrench_release(player pl)
{
vector src;
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
@ -213,8 +210,8 @@ w_pipewrench_release(void)
string snd;
#endif
/* attack! */
Weapons_MakeVectors();
src = Weapons_GetCameraPos();
Weapons_MakeVectors(pl);
src = Weapons_GetCameraPos(pl);
traceline(src, src + (v_forward * 64), FALSE, pl);
if (trace_fraction < 1.0) {
@ -234,10 +231,10 @@ w_pipewrench_release(void)
FX_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}
#endif
Weapons_ViewAnimation(PIPE_ATTACKBIGHIT);
Weapons_ViewPunchAngle([-10,0,0]);
Weapons_ViewAnimation(pl, PIPE_ATTACKBIGHIT);
Weapons_ViewPunchAngle(pl, [-10,0,0]);
} else {
Weapons_ViewAnimation(PIPE_ATTACKBIGMISS);
Weapons_ViewAnimation(pl, PIPE_ATTACKBIGMISS);
}
#ifdef SERVER
snd = "weapons/pwrench_big_miss.wav";
@ -267,28 +264,28 @@ w_pipewrench_release(void)
int r = floor(random(0,3));
switch (r) {
case 0:
Weapons_ViewAnimation(PIPE_IDLE1);
Weapons_ViewAnimation(pl, PIPE_IDLE1);
pl.w_idle_next = 2.0f;
break;
case 1:
Weapons_ViewAnimation(PIPE_IDLE2);
Weapons_ViewAnimation(pl, PIPE_IDLE2);
pl.w_idle_next = 3.0f;
break;
case 2:
Weapons_ViewAnimation(PIPE_IDLE3);
Weapons_ViewAnimation(pl, PIPE_IDLE3);
pl.w_idle_next = 3.0f;
break;
}
}
float
w_pipewrench_aimanim(void)
w_pipewrench_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
}
void
w_pipewrench_hudpic(int selected, vector pos, float a)
w_pipewrench_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
@ -329,7 +326,7 @@ weapon_t w_pipewrench =
.secondary = w_pipewrench_secondary,
.reload = w_pipewrench_release,
.release = w_pipewrench_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_pipewrench_precache,
.pickup = __NULL__,
.updateammo = w_pipewrench_updateammo,

View File

@ -54,10 +54,9 @@ w_shockrifle_precache(void)
}
int
w_shockrifle_pickup(int new, int startammo)
w_shockrifle_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
/* only pick it up once */
if (new) {
@ -81,7 +80,7 @@ w_shockrifle_wmodel(void)
}
string
w_shockrifle_pmodel(void)
w_shockrifle_pmodel(player pl)
{
return "models/p_shock.mdl";
}
@ -93,21 +92,21 @@ w_shockrifle_deathmsg(void)
}
void
w_shockrifle_draw(void)
w_shockrifle_draw(player pl)
{
Weapons_SetModel("models/v_shock.mdl");
Weapons_ViewAnimation(SHOCKRIFLE_DRAW);
Weapons_ViewAnimation(pl, SHOCKRIFLE_DRAW);
}
void
w_shockrifle_holster(void)
w_shockrifle_holster(player pl)
{
}
#ifdef SERVER
void
w_shockrifle_shoothornet(void)
w_shockrifle_shoothornet(player pl)
{
static void Hornet_Touch(void) {
if (other.takedamage == DAMAGE_YES) {
@ -121,10 +120,10 @@ w_shockrifle_shoothornet(void)
}
remove(self);
}
Weapons_MakeVectors();
Weapons_MakeVectors(pl);
entity bolt = spawn();
//setmodel(bolt, "models/hornet.mdl");
setorigin(bolt, Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8));
setorigin(bolt, Weapons_GetCameraPos(pl) + (v_forward * 16) + (v_up * -8));
bolt.owner = self;
bolt.velocity = v_forward * 1000;
bolt.movetype = MOVETYPE_FLY;
@ -138,9 +137,8 @@ w_shockrifle_shoothornet(void)
#endif
void
w_shockrifle_release(void)
w_shockrifle_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next > 0.0) {
return;
@ -157,36 +155,35 @@ w_shockrifle_release(void)
int r = (float)input_sequence % 2;
if (r < 1) {
Weapons_ViewAnimation(SHOCKRIFLE_IDLE1);
Weapons_ViewAnimation(pl, SHOCKRIFLE_IDLE1);
} else {
Weapons_ViewAnimation(SHOCKRIFLE_IDLE2);
Weapons_ViewAnimation(pl, SHOCKRIFLE_IDLE2);
}
pl.w_idle_next = 3.333333f;
}
void
w_shockrifle_primary(void)
w_shockrifle_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
if (pl.ammo_shock <= 0) {
w_shockrifle_release();
w_shockrifle_release(pl);
return;
}
pl.ammo_shock--;
Weapons_ViewAnimation(SHOCKRIFLE_SHOOT);
Weapons_ViewAnimation(pl, SHOCKRIFLE_SHOOT);
#ifdef SERVER
w_shockrifle_shoothornet();
w_shockrifle_shoothornet(pl);
sound(pl, CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM);
#else
Weapons_MakeVectors();
vector src = Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8);
Weapons_MakeVectors(pl);
vector src = Weapons_GetCameraPos(pl) + (v_forward * 16) + (v_up * -8);
pointparticles(PART_SHOCKPIECE, src, v_forward * 1000, 1);
#endif
@ -195,7 +192,7 @@ w_shockrifle_primary(void)
}
void
w_shockrifle_crosshair(void)
w_shockrifle_crosshair(player pl)
{
#ifdef CLIENT
vector cross_pos;
@ -233,15 +230,14 @@ w_shockrifle_crosshair(void)
}
float
w_shockrifle_aimanim(void)
w_shockrifle_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMHIVE : ANIM_AIMHIVE;
}
int
w_shockrifle_isempty(void)
w_shockrifle_isempty(player pl)
{
player pl = (player)self;
if (pl.ammo_shock <= 0)
return 1;
@ -250,13 +246,12 @@ w_shockrifle_isempty(void)
}
void
w_shockrifle_hudpic(int selected, vector pos, float a)
w_shockrifle_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_shockrifle_isempty())
if (w_shockrifle_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -301,7 +296,7 @@ weapon_t w_shockrifle =
.secondary = w_shockrifle_release,
.reload = w_shockrifle_release,
.release = w_shockrifle_release,
.crosshair = w_shockrifle_crosshair,
.postdraw = w_shockrifle_crosshair,
.precache = w_shockrifle_precache,
.pickup = w_shockrifle_pickup,
.updateammo = w_shockrifle_updateammo,

View File

@ -50,10 +50,9 @@ w_sniperrifle_precache(void)
}
int
w_sniperrifle_pickup(int new, int startammo)
w_sniperrifle_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.sniper_mag = 5;
@ -81,7 +80,7 @@ w_sniperrifle_wmodel(void)
}
string
w_sniperrifle_pmodel(void)
w_sniperrifle_pmodel(player pl)
{
return "models/p_m40a1.mdl";
}
@ -93,22 +92,21 @@ w_sniperrifle_deathmsg(void)
}
void
w_sniperrifle_draw(void)
w_sniperrifle_draw(player pl)
{
Weapons_SetModel("models/v_m40a1.mdl");
Weapons_ViewAnimation(SNIPER_DRAW);
Weapons_ViewAnimation(pl, SNIPER_DRAW);
}
void
w_sniperrifle_holster(void)
w_sniperrifle_holster(player pl)
{
Weapons_ViewAnimation(SNIPER_HOLSTER);
Weapons_ViewAnimation(pl, SNIPER_HOLSTER);
}
void
w_sniperrifle_primary(void)
w_sniperrifle_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -116,12 +114,12 @@ w_sniperrifle_primary(void)
return;
pl.sniper_mag--;
Weapons_ViewPunchAngle([-10,0,0]);
Weapons_ViewPunchAngle(pl, [-10,0,0]);
if (pl.sniper_mag) {
Weapons_ViewAnimation(SNIPER_FIRE1);
Weapons_ViewAnimation(pl, SNIPER_FIRE1);
} else {
Weapons_ViewAnimation(SNIPER_FIRE2);
Weapons_ViewAnimation(pl, SNIPER_FIRE2);
}
#ifdef SERVER
@ -140,9 +138,8 @@ w_sniperrifle_primary(void)
}
void
w_sniperrifle_secondary(void)
w_sniperrifle_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
@ -156,9 +153,8 @@ w_sniperrifle_secondary(void)
}
void
w_sniperrifle_reload(void)
w_sniperrifle_reload(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0) {
return;
}
@ -172,7 +168,7 @@ w_sniperrifle_reload(void)
/* Audio-Visual bit */
/* TODO has a couple reloading states */
Weapons_ViewAnimation(SNIPER_RELOAD3);
Weapons_ViewAnimation(pl, SNIPER_RELOAD3);
#ifdef SERVER
static void w_sniperrifle_reload_done(void) {
player pl = (player)self;
@ -186,14 +182,13 @@ w_sniperrifle_reload(void)
pl.w_idle_next = 10.0f;
}
void
w_sniperrifle_release(void)
w_sniperrifle_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_762 > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -203,18 +198,17 @@ w_sniperrifle_release(void)
int r = (float)input_sequence % 2;
if (r == 1) {
Weapons_ViewAnimation(SNIPER_IDLE1);
Weapons_ViewAnimation(pl, SNIPER_IDLE1);
} else {
Weapons_ViewAnimation(SNIPER_IDLE2);
Weapons_ViewAnimation(pl, SNIPER_IDLE2);
}
pl.w_idle_next = 15.0f;
}
void
w_sniperrifle_crosshair(void)
w_sniperrifle_crosshair(player pl)
{
#ifdef CLIENT
player pl = (player)self;
static vector cross_pos;
if (pl.viewzoom == 1.0f) {
@ -252,15 +246,14 @@ w_sniperrifle_crosshair(void)
}
float
w_sniperrifle_aimanim(void)
w_sniperrifle_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
}
int
w_sniperrifle_isempty(void)
w_sniperrifle_isempty(player pl)
{
player pl = (player)self;
if (pl.sniper_mag <= 0 && pl.ammo_762 <= 0)
return 1;
@ -269,13 +262,12 @@ w_sniperrifle_isempty(void)
}
void
w_sniperrifle_hudpic(int s, vector pos, float a)
w_sniperrifle_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_sniperrifle_isempty())
if (w_sniperrifle_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -302,7 +294,7 @@ weapon_t w_sniperrifle =
.secondary = w_sniperrifle_secondary,
.reload = w_sniperrifle_reload,
.release = w_sniperrifle_release,
.crosshair = w_sniperrifle_crosshair,
.postdraw = w_sniperrifle_crosshair,
.precache = w_sniperrifle_precache,
.pickup = w_sniperrifle_pickup,
.updateammo = w_sniperrifle_updateammo,

View File

@ -174,7 +174,7 @@ w_sporelauncher_wmodel(void)
}
string
w_sporelauncher_pmodel(void)
w_sporelauncher_pmodel(player pl)
{
return "models/p_spore_launcher.mdl";
}
@ -186,10 +186,9 @@ w_sporelauncher_deathmsg(void)
}
int
w_sporelauncher_pickup(int new, int startammo)
w_sporelauncher_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.sporelauncher_mag = 5;
@ -205,22 +204,21 @@ w_sporelauncher_pickup(int new, int startammo)
}
void
w_sporelauncher_draw(void)
w_sporelauncher_draw(player pl)
{
Weapons_SetModel("models/v_spore_launcher.mdl");
Weapons_ViewAnimation(SPORE_DRAW);
Weapons_ViewAnimation(pl, SPORE_DRAW);
}
void
w_sporelauncher_holster(void)
w_sporelauncher_holster(player pl)
{
Weapons_ViewAnimation(SPORE_HOLSTER);
Weapons_ViewAnimation(pl, SPORE_HOLSTER);
}
void
w_sporelauncher_primary(void)
w_sporelauncher_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -228,12 +226,12 @@ w_sporelauncher_primary(void)
return;
pl.sporelauncher_mag--;
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewAnimation(SPORE_FIRE);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(pl, SPORE_FIRE);
#ifdef SERVER
Weapons_MakeVectors();
Sporelauncher_Fire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward);
Weapons_MakeVectors(pl);
Sporelauncher_Fire(self, Weapons_GetCameraPos(pl) + (v_forward * 16), v_forward);
#endif
pl.w_attack_next = 0.75f;
@ -241,9 +239,8 @@ w_sporelauncher_primary(void)
}
void
w_sporelauncher_secondary(void)
w_sporelauncher_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
@ -252,12 +249,12 @@ w_sporelauncher_secondary(void)
pl.sporelauncher_mag--;
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewAnimation(SPORE_FIRE);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(pl, SPORE_FIRE);
#ifdef SERVER
Weapons_MakeVectors();
Sporelauncher_AltFire(self, Weapons_GetCameraPos() + (v_forward * 16), v_forward);
Weapons_MakeVectors(pl);
Sporelauncher_AltFire(self, Weapons_GetCameraPos(pl) + (v_forward * 16), v_forward);
#endif
pl.w_attack_next = 0.75f;
@ -265,14 +262,13 @@ w_sporelauncher_secondary(void)
}
void
w_sporelauncher_release(void)
w_sporelauncher_release(player pl)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.mode_sporelauncher == SLSTATE_IDLE && pl.sporelauncher_mag == 0 && pl.ammo_spore > 0) {
Weapons_Reload();
Weapons_Reload(pl);
return;
}
@ -284,24 +280,24 @@ w_sporelauncher_release(void)
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(SPORE_IDLE1);
Weapons_ViewAnimation(pl, SPORE_IDLE1);
pl.w_idle_next = 2.0f;
break;
case 1:
Weapons_ViewAnimation(SPORE_FIDGET);
Weapons_ViewAnimation(pl, SPORE_FIDGET);
pl.w_idle_next = 4.0f;
break;
case 2:
Weapons_ViewAnimation(SPORE_IDLE2);
Weapons_ViewAnimation(pl, SPORE_IDLE2);
pl.w_idle_next = 4.0f;
break;
}
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD_START) {
Weapons_ViewAnimation(SPORE_RELOAD1);
Weapons_ViewAnimation(pl, SPORE_RELOAD1);
pl.mode_sporelauncher = SLSTATE_RELOAD;
pl.w_idle_next = 0.65f;
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD) {
Weapons_ViewAnimation(SPORE_RELOAD2);
Weapons_ViewAnimation(pl, SPORE_RELOAD2);
pl.sporelauncher_mag++;
pl.ammo_spore--;
@ -312,7 +308,7 @@ w_sporelauncher_release(void)
pl.w_idle_next = 1.0f;
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD_END) {
Weapons_ViewAnimation(SPORE_RELOAD3);
Weapons_ViewAnimation(pl, SPORE_RELOAD3);
pl.mode_sporelauncher = SLSTATE_IDLE;
pl.w_idle_next = 10.0f;
@ -321,9 +317,8 @@ w_sporelauncher_release(void)
}
void
w_sporelauncher_reload(void)
w_sporelauncher_reload(player pl)
{
player pl = (player)self;
if (pl.sporelauncher_mag >= 5)
return;
@ -337,7 +332,7 @@ w_sporelauncher_reload(void)
}
void
w_sporelauncher_crosshair(void)
w_sporelauncher_crosshair(player pl)
{
#ifdef CLIENT
vector cross_pos;
@ -376,15 +371,14 @@ w_sporelauncher_crosshair(void)
}
float
w_sporelauncher_aimanim(void)
w_sporelauncher_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
}
int
w_sporelauncher_isempty(void)
w_sporelauncher_isempty(player pl)
{
player pl = (player)self;
if (pl.sporelauncher_mag <= 0 && pl.ammo_spore <= 0)
return 1;
@ -393,13 +387,12 @@ w_sporelauncher_isempty(void)
}
void
w_sporelauncher_hudpic(int selected, vector pos, float a)
w_sporelauncher_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (w_sporelauncher_isempty())
if (w_sporelauncher_isempty(pl))
hud_col = [1,0,0];
else
hud_col = g_hud_color;
@ -444,7 +437,7 @@ weapon_t w_sporelauncher =
.secondary = w_sporelauncher_secondary,
.reload = w_sporelauncher_reload,
.release = w_sporelauncher_release,
.crosshair = w_sporelauncher_crosshair,
.postdraw = w_sporelauncher_crosshair,
.precache = w_sporelauncher_precache,
.pickup = w_sporelauncher_pickup,
.updateammo = w_sporelauncher_updateammo,