Rebased against the latest Nuclide commit.

This commit is contained in:
Marco Cawthorne 2022-03-15 19:33:51 -07:00
parent 7d3aac7aa0
commit 2bb6ca9628
Signed by: eukara
GPG key ID: C196CD8BA993248A
13 changed files with 202 additions and 242 deletions

View file

@ -24,11 +24,3 @@ ClientGame_EntityUpdate(float id, float new)
return (1); return (1);
} }
void
ClientGame_EntityRemove(void)
{
if (self.classname == "player")
Player_DestroyWeaponModel((base_player) self);
}

View file

@ -360,13 +360,14 @@ void
HUD_DrawNotify(void) HUD_DrawNotify(void)
{ {
vector pos; vector pos;
player pl = (player)pSeat->m_ePlayer;
if (pSeatLocal->m_flPickupAlpha <= 0.0f) { if (pSeatLocal->m_flPickupAlpha <= 0.0f) {
return; return;
} }
pos = g_hudmins + [g_hudres[0] - 192, g_hudres[1] - 128]; pos = g_hudmins + [g_hudres[0] - 192, g_hudres[1] - 128];
Weapons_HUDPic(pSeatLocal->m_iPickupWeapon, 1, pos, pSeatLocal->m_flPickupAlpha); Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, pSeatLocal->m_flPickupAlpha);
pSeatLocal->m_flPickupAlpha -= clframetime; pSeatLocal->m_flPickupAlpha -= clframetime;
} }
@ -386,7 +387,7 @@ HUD_Draw(void)
g_hud_color = autocvar_con_color * (1 / 255); g_hud_color = autocvar_con_color * (1 / 255);
/* little point in not drawing these, even if you don't have a suit */ /* little point in not drawing these, even if you don't have a suit */
Weapons_DrawCrosshair(); Weapons_DrawCrosshair(pl);
HUD_DrawWeaponSelect(); HUD_DrawWeaponSelect();
Obituary_Draw(); Obituary_Draw();

View file

@ -15,7 +15,7 @@
*/ */
void void
Game_Input(void) Game_Input(player pl)
{ {
#ifdef SERVER #ifdef SERVER
CGameRules rules = (CGameRules)g_grMode; CGameRules rules = (CGameRules)g_grMode;
@ -56,11 +56,11 @@ Game_Input(void)
#endif #endif
if (input_buttons & INPUT_BUTTON0) if (input_buttons & INPUT_BUTTON0)
Weapons_Primary(); Weapons_Primary(pl);
else if (input_buttons & INPUT_BUTTON4) else if (input_buttons & INPUT_BUTTON4)
Weapons_Reload(); Weapons_Reload(pl);
else if (input_buttons & INPUT_BUTTON3) else if (input_buttons & INPUT_BUTTON3)
Weapons_Secondary(); Weapons_Secondary(pl);
else else
Weapons_Release(); Weapons_Release(pl);
} }

View file

@ -55,7 +55,7 @@ w_broom_wmodel(void)
} }
string string
w_broom_pmodel(void) w_broom_pmodel(player pl)
{ {
return "models/p_broom.mdl"; return "models/p_broom.mdl";
} }
@ -67,30 +67,29 @@ w_broom_deathmsg(void)
} }
void void
w_broom_draw(void) w_broom_draw(player pl)
{ {
Weapons_SetModel("models/v_broom.mdl"); Weapons_SetModel("models/v_broom.mdl");
Weapons_ViewAnimation(BROOM_DRAW); Weapons_ViewAnimation(pl, BROOM_DRAW);
} }
void void
w_broom_holster(void) w_broom_holster(player pl)
{ {
Weapons_ViewAnimation(BROOM_HOLSTER); Weapons_ViewAnimation(pl, BROOM_HOLSTER);
} }
void void
w_broom_primary(void) w_broom_primary(player pl)
{ {
int anim = 0; int anim = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
/* make sure we can gib corpses */ /* make sure we can gib corpses */
@ -109,13 +108,13 @@ w_broom_primary(void)
int r = (float)input_sequence % 3; int r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 0: case 0:
Weapons_ViewAnimation(trace_fraction >= 1 ? BROOM_ATTACK1MISS:BROOM_ATTACK1HIT); Weapons_ViewAnimation(pl, trace_fraction >= 1 ? BROOM_ATTACK1MISS:BROOM_ATTACK1HIT);
break; break;
case 1: case 1:
Weapons_ViewAnimation(trace_fraction >= 1 ? BROOM_ATTACK2MISS:BROOM_ATTACK2HIT); Weapons_ViewAnimation(pl, trace_fraction >= 1 ? BROOM_ATTACK2MISS:BROOM_ATTACK2HIT);
break; break;
default: default:
Weapons_ViewAnimation(trace_fraction >= 1 ? BROOM_ATTACK3MISS:BROOM_ATTACK3HIT); Weapons_ViewAnimation(pl, trace_fraction >= 1 ? BROOM_ATTACK3MISS:BROOM_ATTACK3HIT);
} }
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
@ -149,27 +148,26 @@ w_broom_primary(void)
} }
void void
w_broom_release(void) w_broom_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next) { if (pl.w_idle_next) {
return; return;
} }
Weapons_ViewAnimation(BROOM_IDLE); Weapons_ViewAnimation(pl, BROOM_IDLE);
pl.w_idle_next = 15.0f; pl.w_idle_next = 15.0f;
} }
float float
w_broom_aimanim(void) w_broom_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
} }
void void
w_broom_hudpic(int selected, vector pos, float a) w_broom_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -210,7 +208,7 @@ weapon_t w_broom =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_broom_release, .release = w_broom_release,
.crosshair = __NULL__, .postdraw = __NULL__,
.precache = w_broom_precache, .precache = w_broom_precache,
.pickup = __NULL__, .pickup = __NULL__,
.updateammo = w_broom_updateammo, .updateammo = w_broom_updateammo,

View file

@ -66,7 +66,7 @@ w_forks_wmodel(void)
return "models/w_forks.mdl"; return "models/w_forks.mdl";
} }
string string
w_forks_pmodel(void) w_forks_pmodel(player pl)
{ {
return "models/p_fork.mdl"; return "models/p_fork.mdl";
} }
@ -78,10 +78,9 @@ w_forks_deathmsg(void)
} }
int int
w_forks_pickup(int new, int startammo) w_forks_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_forks < MAX_A_FORKS) { if (pl.ammo_forks < MAX_A_FORKS) {
pl.ammo_forks = bound(0, pl.ammo_forks + 6, MAX_A_FORKS); pl.ammo_forks = bound(0, pl.ammo_forks + 6, MAX_A_FORKS);
} else { } else {
@ -91,30 +90,29 @@ w_forks_pickup(int new, int startammo)
return (1); return (1);
} }
void void
w_forks_draw(void) w_forks_draw(player pl)
{ {
Weapons_SetModel("models/v_fork.mdl"); Weapons_SetModel("models/v_fork.mdl");
Weapons_ViewAnimation(FORKS_DRAW); Weapons_ViewAnimation(pl, FORKS_DRAW);
} }
void void
w_forks_holster(void) w_forks_holster(player pl)
{ {
Weapons_ViewAnimation(FORKS_HOLSTER); Weapons_ViewAnimation(pl, FORKS_HOLSTER);
} }
void void
w_forks_primary(void) w_forks_primary(player pl)
{ {
int anim = 0; int anim = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl); traceline(src, src + (v_forward * 32), FALSE, pl);
@ -122,7 +120,7 @@ w_forks_primary(void)
pl.w_attack_next = 0.4f; pl.w_attack_next = 0.4f;
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
Weapons_ViewAnimation(FORKS_STAB); Weapons_ViewAnimation(pl, FORKS_STAB);
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -155,9 +153,8 @@ w_forks_primary(void)
} }
void void
w_forks_secondary(void) w_forks_secondary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -196,10 +193,10 @@ w_forks_secondary(void)
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity fork = spawn(); entity fork = spawn();
setmodel(fork, "models/fork.mdl"); setmodel(fork, "models/fork.mdl");
setorigin(fork, Weapons_GetCameraPos() + (v_forward * 16)); setorigin(fork, Weapons_GetCameraPos(pl) + (v_forward * 16));
fork.owner = self; fork.owner = self;
fork.velocity = v_forward * 2000; fork.velocity = v_forward * 2000;
fork.movetype = MOVETYPE_FLY; fork.movetype = MOVETYPE_FLY;
@ -213,17 +210,16 @@ w_forks_secondary(void)
Sound_Play(pl, CHAN_WEAPON, "weapon_forks.throw"); Sound_Play(pl, CHAN_WEAPON, "weapon_forks.throw");
#endif #endif
Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(FORKS_THROW); Weapons_ViewAnimation(pl, FORKS_THROW);
pl.w_attack_next = 0.5f; pl.w_attack_next = 0.5f;
pl.w_idle_next = 5.0f; pl.w_idle_next = 5.0f;
} }
void void
w_forks_release(void) w_forks_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
return; return;
@ -233,21 +229,21 @@ w_forks_release(void)
r = (float)input_sequence % 3; r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 1: case 1:
Weapons_ViewAnimation(FORKS_IDLE1); Weapons_ViewAnimation(pl, FORKS_IDLE1);
pl.w_idle_next = 1.3f; pl.w_idle_next = 1.3f;
break; break;
case 2: case 2:
Weapons_ViewAnimation(FORKS_IDLE2); Weapons_ViewAnimation(pl, FORKS_IDLE2);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
break; break;
default: default:
Weapons_ViewAnimation(FORKS_IDLE3); Weapons_ViewAnimation(pl, FORKS_IDLE3);
pl.w_idle_next = 1.285f; pl.w_idle_next = 1.285f;
} }
} }
void void
w_forks_crosshair(void) w_forks_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
static vector cross_pos; static vector cross_pos;
@ -278,13 +274,13 @@ w_forks_crosshair(void)
} }
float float
w_forks_aimanim(void) w_forks_aimanim(player pl)
{ {
return w_broom_aimanim(); return w_broom_aimanim(pl);
} }
void void
w_forks_hudpic(int selected, vector pos, float a) w_forks_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -325,7 +321,7 @@ weapon_t w_forks =
.secondary = w_forks_secondary, .secondary = w_forks_secondary,
.reload = __NULL__, .reload = __NULL__,
.release = w_forks_release, .release = w_forks_release,
.crosshair = w_forks_crosshair, .postdraw = w_forks_crosshair,
.precache = w_forks_precache, .precache = w_forks_precache,
.pickup = w_forks_pickup, .pickup = w_forks_pickup,
.updateammo = w_forks_updateammo, .updateammo = w_forks_updateammo,

View file

@ -51,7 +51,7 @@ w_fryingpan_wmodel(void)
return "models/w_pan.mdl"; return "models/w_pan.mdl";
} }
string string
w_fryingpan_pmodel(void) w_fryingpan_pmodel(player pl)
{ {
return "models/p_pan.mdl"; return "models/p_pan.mdl";
} }
@ -63,30 +63,29 @@ w_fryingpan_deathmsg(void)
} }
void void
w_fryingpan_draw(void) w_fryingpan_draw(player pl)
{ {
Weapons_SetModel("models/v_pan.mdl"); Weapons_SetModel("models/v_pan.mdl");
Weapons_ViewAnimation(FRYINGPAN_DRAW); Weapons_ViewAnimation(pl, FRYINGPAN_DRAW);
} }
void void
w_fryingpan_holster(void) w_fryingpan_holster(player pl)
{ {
w_broom_holster(); w_broom_holster(pl);
} }
void void
w_fryingpan_primary(void) w_fryingpan_primary(player pl)
{ {
int anim = 0; int anim = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl); traceline(src, src + (v_forward * 32), FALSE, pl);
@ -94,7 +93,7 @@ w_fryingpan_primary(void)
pl.w_attack_next = 1.0f; pl.w_attack_next = 1.0f;
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
Weapons_ViewAnimation(FRYINGPAN_HIT1); Weapons_ViewAnimation(pl, FRYINGPAN_HIT1);
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -129,17 +128,16 @@ w_fryingpan_primary(void)
} }
void void
w_fryingpan_secondary(void) w_fryingpan_secondary(player pl)
{ {
int anim = 0; int anim = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl); traceline(src, src + (v_forward * 32), FALSE, pl);
@ -147,7 +145,7 @@ w_fryingpan_secondary(void)
pl.w_attack_next = 1.0f; pl.w_attack_next = 1.0f;
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
Weapons_ViewAnimation(FRYINGPAN_HIT2); Weapons_ViewAnimation(pl, FRYINGPAN_HIT2);
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -181,19 +179,19 @@ w_fryingpan_secondary(void)
} }
void void
w_fryingpan_release(void) w_fryingpan_release(player pl)
{ {
w_broom_release(); w_broom_release(pl);
} }
float float
w_fryingpan_aimanim(void) w_fryingpan_aimanim(player pl)
{ {
return w_broom_aimanim(); return w_broom_aimanim(pl);
} }
void void
w_fryingpan_hudpic(int selected, vector pos, float a) w_fryingpan_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -234,7 +232,7 @@ weapon_t w_fryingpan =
.secondary = w_fryingpan_secondary, .secondary = w_fryingpan_secondary,
.reload = __NULL__, .reload = __NULL__,
.release = w_fryingpan_release, .release = w_fryingpan_release,
.crosshair = __NULL__, .postdraw = __NULL__,
.precache = w_fryingpan_precache, .precache = w_fryingpan_precache,
.pickup = __NULL__, .pickup = __NULL__,
.updateammo = w_fryingpan_updateammo, .updateammo = w_fryingpan_updateammo,

View file

@ -62,7 +62,7 @@ w_glove_wmodel(void)
return "models/rune_slasher.mdl"; return "models/rune_slasher.mdl";
} }
string string
w_glove_pmodel(void) w_glove_pmodel(player pl)
{ {
return "models/p_glove.mdl"; return "models/p_glove.mdl";
} }
@ -74,7 +74,7 @@ w_glove_deathmsg(void)
} }
int int
w_glove_pickup(int new, int startammo) w_glove_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
/* Broadcast a message and sound upon picking up Rune */ /* Broadcast a message and sound upon picking up Rune */
@ -105,32 +105,31 @@ w_glove_pickup(int new, int startammo)
} }
void void
w_glove_draw(void) w_glove_draw(player pl)
{ {
Weapons_SetModel("models/v_glove.mdl"); Weapons_SetModel("models/v_glove.mdl");
Weapons_ViewAnimation(GLOVE_DRAW); Weapons_ViewAnimation(pl, GLOVE_DRAW);
} }
void void
w_glove_holster(void) w_glove_holster(player pl)
{ {
Weapons_ViewAnimation(GLOVE_HOLSTER); Weapons_ViewAnimation(pl, GLOVE_HOLSTER);
} }
void void
w_glove_primary(void) w_glove_primary(player pl)
{ {
int anim = 0; int anim = 0;
int r = 0; int r = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl); traceline(src, src + (v_forward * 32), FALSE, pl);
@ -144,11 +143,11 @@ w_glove_primary(void)
r = (float)input_sequence % 2; r = (float)input_sequence % 2;
switch (r) { switch (r) {
case 1: case 1:
Weapons_ViewAnimation(GLOVE_SLICE); Weapons_ViewAnimation(pl, GLOVE_SLICE);
pl.w_idle_next = 3.6f; pl.w_idle_next = 3.6f;
break; break;
default: default:
Weapons_ViewAnimation(GLOVE_DICE); Weapons_ViewAnimation(pl, GLOVE_DICE);
pl.w_idle_next = 3.6f; pl.w_idle_next = 3.6f;
break; break;
} }
@ -189,26 +188,25 @@ w_glove_primary(void)
} }
void void
w_glove_release(void) w_glove_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next) { if (pl.w_idle_next) {
return; return;
} }
Weapons_ViewAnimation(GLOVE_IDLE); Weapons_ViewAnimation(pl, GLOVE_IDLE);
pl.w_idle_next = 2.0f; pl.w_idle_next = 2.0f;
} }
float float
w_glove_aimanim(void) w_glove_aimanim(player pl)
{ {
return w_broom_aimanim(); return w_broom_aimanim(pl);
} }
void void
w_glove_hudpic(int selected, vector pos, float a) w_glove_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -249,7 +247,7 @@ weapon_t w_glove =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_glove_release, .release = w_glove_release,
.crosshair = __NULL__, .postdraw = __NULL__,
.precache = w_glove_precache, .precache = w_glove_precache,
.pickup = w_glove_pickup, .pickup = w_glove_pickup,
.updateammo = w_glove_updateammo, .updateammo = w_glove_updateammo,

View file

@ -59,7 +59,7 @@ w_hairspray_wmodel(void)
} }
string string
w_hairspray_pmodel(void) w_hairspray_pmodel(player pl)
{ {
return "models/p_hairspray.mdl"; return "models/p_hairspray.mdl";
} }
@ -71,10 +71,9 @@ w_hairspray_deathmsg(void)
} }
int int
w_hairspray_pickup(int new, int startammo) w_hairspray_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_spray < MAX_A_SPRAY) { if (pl.ammo_spray < MAX_A_SPRAY) {
pl.ammo_spray = bound(0, pl.ammo_spray + 20, MAX_A_SPRAY); pl.ammo_spray = bound(0, pl.ammo_spray + 20, MAX_A_SPRAY);
} else { } else {
@ -85,16 +84,16 @@ w_hairspray_pickup(int new, int startammo)
} }
void void
w_hairspray_draw(void) w_hairspray_draw(player pl)
{ {
Weapons_SetModel("models/v_hairspray.mdl"); Weapons_SetModel("models/v_hairspray.mdl");
Weapons_ViewAnimation(HAIRSPRAY_DRAW); Weapons_ViewAnimation(pl, HAIRSPRAY_DRAW);
} }
void void
w_hairspray_holster(void) w_hairspray_holster(player pl)
{ {
Weapons_ViewAnimation(HAIRSPRAY_HOLSTER); Weapons_ViewAnimation(pl, HAIRSPRAY_HOLSTER);
} }
@ -115,9 +114,8 @@ Flame_Touch(void)
void void
w_hairspray_primary(void) w_hairspray_primary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
} }
@ -135,13 +133,13 @@ w_hairspray_primary(void)
/* Actual firing */ /* Actual firing */
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewAnimation(HAIRSPRAY_FIRE); Weapons_ViewAnimation(pl, HAIRSPRAY_FIRE);
pl.ammo_spray--; pl.ammo_spray--;
#else #else
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity flame = spawn(); entity flame = spawn();
setmodel(flame, "sprites/flame.spr"); setmodel(flame, "sprites/flame.spr");
setorigin(flame, Weapons_GetCameraPos() + (v_forward * 16)); setorigin(flame, Weapons_GetCameraPos(pl) + (v_forward * 16));
flame.owner = self; flame.owner = self;
flame.velocity = v_forward * 300; flame.velocity = v_forward * 300;
flame.movetype = MOVETYPE_FLYMISSILE; flame.movetype = MOVETYPE_FLYMISSILE;
@ -170,20 +168,19 @@ w_hairspray_primary(void)
} }
void void
w_hairspray_release(void) w_hairspray_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next) { if (pl.w_idle_next) {
return; return;
} }
sound(pl, CHAN_WEAPON, "", 1.0, ATTN_NORM); sound(pl, CHAN_WEAPON, "", 1.0, ATTN_NORM);
Weapons_ViewAnimation(HAIRSPRAY_IDLE); Weapons_ViewAnimation(pl, HAIRSPRAY_IDLE);
pl.w_idle_next = 2.0f; pl.w_idle_next = 2.0f;
} }
void void
w_hairspray_crosshair(void) w_hairspray_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
static vector cross_pos; static vector cross_pos;
@ -214,13 +211,13 @@ w_hairspray_crosshair(void)
} }
float float
w_hairspray_aimanim(void) w_hairspray_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW; return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
} }
void void
w_hairspray_hudpic(int selected, vector pos, float a) w_hairspray_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -261,7 +258,7 @@ weapon_t w_hairspray =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_hairspray_release, .release = w_hairspray_release,
.crosshair = w_hairspray_crosshair, .postdraw = w_hairspray_crosshair,
.precache = w_hairspray_precache, .precache = w_hairspray_precache,
.pickup = w_hairspray_pickup, .pickup = w_hairspray_pickup,
.updateammo = w_hairspray_updateammo, .updateammo = w_hairspray_updateammo,

View file

@ -63,7 +63,7 @@ w_knife_wmodel(void)
} }
string string
w_knife_pmodel(void) w_knife_pmodel(player pl)
{ {
return "models/p_knife.mdl"; return "models/p_knife.mdl";
} }
@ -75,10 +75,9 @@ w_knife_deathmsg(void)
} }
int int
w_knife_pickup(int new, int startammo) w_knife_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_knives < MAX_A_KNIVES) { if (pl.ammo_knives < MAX_A_KNIVES) {
pl.ammo_knives = bound(0, pl.ammo_knives + 1, MAX_A_KNIVES); pl.ammo_knives = bound(0, pl.ammo_knives + 1, MAX_A_KNIVES);
@ -90,22 +89,21 @@ w_knife_pickup(int new, int startammo)
} }
void void
w_knife_draw(void) w_knife_draw(player pl)
{ {
Weapons_SetModel("models/v_knife.mdl"); Weapons_SetModel("models/v_knife.mdl");
Weapons_ViewAnimation(KNIFE_DRAW); Weapons_ViewAnimation(pl, KNIFE_DRAW);
} }
void void
w_knife_holster(void) w_knife_holster(player pl)
{ {
Weapons_ViewAnimation(KNIFE_HOLSTER); Weapons_ViewAnimation(pl, KNIFE_HOLSTER);
} }
void void
w_knife_primary(void) w_knife_primary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -145,10 +143,10 @@ w_knife_primary(void)
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity knife = spawn(); entity knife = spawn();
setmodel(knife, "models/w_knife.mdl"); setmodel(knife, "models/w_knife.mdl");
setorigin(knife, Weapons_GetCameraPos()); setorigin(knife, Weapons_GetCameraPos(pl));
knife.owner = self; knife.owner = self;
knife.velocity = v_forward * 1200; knife.velocity = v_forward * 1200;
knife.movetype = MOVETYPE_FLY; knife.movetype = MOVETYPE_FLY;
@ -173,8 +171,8 @@ w_knife_primary(void)
return; return;
} }
#else #else
Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(KNIFE_THROW); Weapons_ViewAnimation(pl, KNIFE_THROW);
/* Knife randomly changes submodel upon firing */ /* Knife randomly changes submodel upon firing */
int r = (float)input_sequence % 2; int r = (float)input_sequence % 2;
Weapons_SetGeomset(r == 1 ? "geomset 0 0\n" : "geomset 0 1\n"); Weapons_SetGeomset(r == 1 ? "geomset 0 0\n" : "geomset 0 1\n");
@ -185,9 +183,8 @@ w_knife_primary(void)
} }
void void
w_knife_release(void) w_knife_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
return; return;
@ -197,21 +194,21 @@ w_knife_release(void)
r = (float)input_sequence % 3; r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 1: case 1:
Weapons_ViewAnimation(KNIFE_IDLE1); Weapons_ViewAnimation(pl, KNIFE_IDLE1);
pl.w_idle_next = 2.0f; pl.w_idle_next = 2.0f;
break; break;
case 2: case 2:
Weapons_ViewAnimation(KNIFE_IDLE2); Weapons_ViewAnimation(pl, KNIFE_IDLE2);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
break; break;
default: default:
Weapons_ViewAnimation(KNIFE_IDLE3); Weapons_ViewAnimation(pl, KNIFE_IDLE3);
pl.w_idle_next = 1.285f; pl.w_idle_next = 1.285f;
} }
} }
void void
w_knife_crosshair(void) w_knife_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
static vector cross_pos; static vector cross_pos;
@ -242,13 +239,13 @@ w_knife_crosshair(void)
} }
float float
w_knife_aimanim(void) w_knife_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW; return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
} }
void void
w_knife_hudpic(int selected, vector pos, float a) w_knife_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -289,7 +286,7 @@ weapon_t w_knife =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_knife_release, .release = w_knife_release,
.crosshair = w_knife_crosshair, .postdraw = w_knife_crosshair,
.precache = w_knife_precache, .precache = w_knife_precache,
.pickup = w_knife_pickup, .pickup = w_knife_pickup,
.updateammo = w_knife_updateammo, .updateammo = w_knife_updateammo,

View file

@ -58,7 +58,7 @@ w_lego_wmodel(void)
} }
string string
w_lego_pmodel(void) w_lego_pmodel(player pl)
{ {
return "models/p_lego.mdl"; return "models/p_lego.mdl";
} }
@ -70,10 +70,9 @@ w_lego_deathmsg(void)
} }
int int
w_lego_pickup(int new, int startammo) w_lego_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_legogrenade < MAX_A_LEGOGRENADE) { if (pl.ammo_legogrenade < MAX_A_LEGOGRENADE) {
pl.ammo_legogrenade = bound(0, pl.ammo_legogrenade + 1, MAX_A_LEGOGRENADE); pl.ammo_legogrenade = bound(0, pl.ammo_legogrenade + 1, MAX_A_LEGOGRENADE);
@ -86,7 +85,7 @@ w_lego_pickup(int new, int startammo)
#ifdef SERVER #ifdef SERVER
void void
w_lego_throw(void) w_lego_throw(player pl)
{ {
static void WeaponLego_Throw_Touch(void) { static void WeaponLego_Throw_Touch(void) {
float dmg = Skill_GetValue("plr_hand_grenade", 150); float dmg = Skill_GetValue("plr_hand_grenade", 150);
@ -95,7 +94,6 @@ w_lego_throw(void)
remove(self); remove(self);
} }
player pl = (player)self;
vector vPLAngle = pl.v_angle; vector vPLAngle = pl.v_angle;
if (vPLAngle[0] < 0) { if (vPLAngle[0] < 0) {
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0); vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
@ -128,24 +126,23 @@ w_lego_throw(void)
#endif #endif
void void
w_lego_draw(void) w_lego_draw(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
Weapons_SetModel("models/v_lego.mdl"); Weapons_SetModel("models/v_lego.mdl");
Weapons_ViewAnimation(LEGO_DRAW); Weapons_ViewAnimation(pl, LEGO_DRAW);
#endif #endif
} }
void void
w_lego_holster(void) w_lego_holster(player pl)
{ {
} }
void void
w_lego_primary(void) w_lego_primary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
} }
@ -167,7 +164,7 @@ w_lego_primary(void)
#endif #endif
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewAnimation(LEGO_PULLPIN); Weapons_ViewAnimation(pl, LEGO_PULLPIN);
#endif #endif
pl.a_ammo3 = 1; pl.a_ammo3 = 1;
@ -176,7 +173,7 @@ w_lego_primary(void)
} }
void void
w_lego_hud(void) w_lego_hud(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
static vector cross_pos; static vector cross_pos;
@ -207,9 +204,8 @@ w_lego_hud(void)
} }
void void
w_lego_release(void) w_lego_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
return; return;
@ -218,17 +214,17 @@ w_lego_release(void)
if (pl.a_ammo3 == 1) { if (pl.a_ammo3 == 1) {
#ifdef CLIENT #ifdef CLIENT
pl.ammo_legogrenade--; pl.ammo_legogrenade--;
Weapons_ViewAnimation(LEGO_THROW); Weapons_ViewAnimation(pl, LEGO_THROW);
#else #else
pl.ammo_legogrenade--; pl.ammo_legogrenade--;
w_lego_throw(); w_lego_throw(pl);
#endif #endif
pl.a_ammo3 = 2; pl.a_ammo3 = 2;
pl.w_attack_next = 1.0f; pl.w_attack_next = 1.0f;
pl.w_idle_next = 0.5f; pl.w_idle_next = 0.5f;
} else if (pl.a_ammo3 == 2) { } else if (pl.a_ammo3 == 2) {
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewAnimation(LEGO_DRAW); Weapons_ViewAnimation(pl, LEGO_DRAW);
#else #else
if (!pl.ammo_legogrenade) { if (!pl.ammo_legogrenade) {
Weapons_RemoveItem(pl, WEAPON_LEGO); Weapons_RemoveItem(pl, WEAPON_LEGO);
@ -238,19 +234,19 @@ w_lego_release(void)
pl.w_idle_next = 0.5f; pl.w_idle_next = 0.5f;
pl.a_ammo3 = 0; pl.a_ammo3 = 0;
} else { } else {
Weapons_ViewAnimation(LEGO_IDLE); Weapons_ViewAnimation(pl, LEGO_IDLE);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
} }
} }
float float
w_lego_aimanim(void) w_lego_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; return pl.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
} }
void void
w_lego_hudpic(int selected, vector pos, float a) w_lego_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -273,7 +269,7 @@ weapon_t w_lego =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_lego_release, .release = w_lego_release,
.crosshair = w_lego_hud, .postdraw = w_lego_hud,
.precache = w_lego_precache, .precache = w_lego_precache,
.pickup = w_lego_pickup, .pickup = w_lego_pickup,
.updateammo = w_lego_updateammo, .updateammo = w_lego_updateammo,

View file

@ -59,7 +59,7 @@ w_legolauncher_wmodel(void)
} }
string string
w_legolauncher_pmodel(void) w_legolauncher_pmodel(player pl)
{ {
return "models/p_legolauncher.mdl"; return "models/p_legolauncher.mdl";
} }
@ -71,10 +71,9 @@ w_legolauncher_deathmsg(void)
} }
int int
w_legolauncher_pickup(int new, int startammo) w_legolauncher_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_legos < MAX_A_LEGOS) { if (pl.ammo_legos < MAX_A_LEGOS) {
pl.ammo_legos = bound(0, pl.ammo_legos + 40, MAX_A_LEGOS); pl.ammo_legos = bound(0, pl.ammo_legos + 40, MAX_A_LEGOS);
@ -86,23 +85,22 @@ w_legolauncher_pickup(int new, int startammo)
} }
void void
w_legolauncher_draw(void) w_legolauncher_draw(player pl)
{ {
Weapons_SetModel("models/v_legolauncher.mdl"); Weapons_SetModel("models/v_legolauncher.mdl");
Weapons_ViewAnimation(LEGOLAUNCHER_DRAW); Weapons_ViewAnimation(pl, LEGOLAUNCHER_DRAW);
} }
void void
w_legolauncher_holster(void) w_legolauncher_holster(player pl)
{ {
Weapons_ViewAnimation(LEGOLAUNCHER_HOLSTER); Weapons_ViewAnimation(pl, LEGOLAUNCHER_HOLSTER);
} }
#ifdef SERVER #ifdef SERVER
void void
w_legolauncher_shootlego(void) w_legolauncher_shootlego(player pl)
{ {
player pl = (player)self;
static void Lego_Touch(void) { static void Lego_Touch(void) {
FX_LegoPiece(trace_endpos); FX_LegoPiece(trace_endpos);
@ -122,11 +120,11 @@ w_legolauncher_shootlego(void)
remove(self); remove(self);
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity lego = spawn(); entity lego = spawn();
setmodel(lego, "models/lego.mdl"); setmodel(lego, "models/lego.mdl");
/* TODO needs to spawn more to the right */ /* TODO needs to spawn more to the right */
setorigin(lego, Weapons_GetCameraPos() + (v_forward * 16) + (v_right * 4) + (v_up * -8)); setorigin(lego, Weapons_GetCameraPos(pl) + (v_forward * 16) + (v_right * 4) + (v_up * -8));
lego.owner = self; lego.owner = self;
lego.velocity = v_forward * 2000; lego.velocity = v_forward * 2000;
lego.movetype = MOVETYPE_FLY; lego.movetype = MOVETYPE_FLY;
@ -139,9 +137,8 @@ w_legolauncher_shootlego(void)
#endif #endif
void void
w_legolauncher_primary(void) w_legolauncher_primary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -160,12 +157,12 @@ w_legolauncher_primary(void)
/* Actual firing */ /* Actual firing */
#ifdef SERVER #ifdef SERVER
w_legolauncher_shootlego(); w_legolauncher_shootlego(pl);
pl.ammo_legos--; pl.ammo_legos--;
Sound_Play(pl, CHAN_WEAPON, "weapon_legolauncher.fire"); Sound_Play(pl, CHAN_WEAPON, "weapon_legolauncher.fire");
#else #else
Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(LEGOLAUNCHER_SHOOT); Weapons_ViewAnimation(pl, LEGOLAUNCHER_SHOOT);
#endif #endif
if (self.flags & FL_CROUCHING) if (self.flags & FL_CROUCHING)
@ -178,21 +175,20 @@ w_legolauncher_primary(void)
} }
void void
w_legolauncher_release(void) w_legolauncher_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
return; return;
} }
Weapons_ViewAnimation(LEGOLAUNCHER_IDLE); Weapons_ViewAnimation(pl, LEGOLAUNCHER_IDLE);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
} }
void void
w_legolauncher_crosshair(void) w_legolauncher_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
vector aicon_pos; vector aicon_pos;
@ -227,13 +223,13 @@ w_legolauncher_crosshair(void)
} }
float float
w_legolauncher_aimanim(void) w_legolauncher_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW; return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
} }
void void
w_legolauncher_hudpic(int selected, vector pos, float a) w_legolauncher_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -274,7 +270,7 @@ weapon_t w_legolauncher =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_legolauncher_release, .release = w_legolauncher_release,
.crosshair = w_legolauncher_crosshair, .postdraw = w_legolauncher_crosshair,
.precache = w_legolauncher_precache, .precache = w_legolauncher_precache,
.pickup = w_legolauncher_pickup, .pickup = w_legolauncher_pickup,
.updateammo = w_legolauncher_updateammo, .updateammo = w_legolauncher_updateammo,

View file

@ -52,7 +52,7 @@ w_machette_wmodel(void)
return "models/w_machette.mdl"; return "models/w_machette.mdl";
} }
string string
w_machette_pmodel(void) w_machette_pmodel(player pl)
{ {
return "models/p_machette.mdl"; return "models/p_machette.mdl";
} }
@ -64,7 +64,7 @@ w_machette_deathmsg(void)
} }
int int
w_machette_pickup(int new, int startammo) w_machette_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
/* Broadcast a message and sound upon picking up Rune */ /* Broadcast a message and sound upon picking up Rune */
@ -75,30 +75,29 @@ w_machette_pickup(int new, int startammo)
} }
void void
w_machette_draw(void) w_machette_draw(player pl)
{ {
Weapons_SetModel("models/v_machette.mdl"); Weapons_SetModel("models/v_machette.mdl");
Weapons_ViewAnimation(MACHETTE_DRAW); Weapons_ViewAnimation(pl, MACHETTE_DRAW);
} }
void void
w_machette_holster(void) w_machette_holster(player pl)
{ {
Weapons_ViewAnimation(MACHETTE_HOLSTER); Weapons_ViewAnimation(pl, MACHETTE_HOLSTER);
} }
void void
w_machette_primary(void) w_machette_primary(player pl)
{ {
int anim = 0; int anim = 0;
vector src; vector src;
player pl = (player)self;
if (pl.w_attack_next) { if (pl.w_attack_next) {
return; return;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs; src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl); traceline(src, src + (v_forward * 32), FALSE, pl);
@ -106,7 +105,7 @@ w_machette_primary(void)
pl.w_attack_next = 0.4f; pl.w_attack_next = 0.4f;
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
Weapons_ViewAnimation(MACHETTE_THROW); Weapons_ViewAnimation(pl, MACHETTE_THROW);
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
@ -140,9 +139,8 @@ w_machette_primary(void)
#ifdef SERVER #ifdef SERVER
void void
w_machette_throw(void) w_machette_throw(player pl)
{ {
player pl = (player)self;
static void Machette_Touch(void) { static void Machette_Touch(void) {
setmodel(self, "models/machette.mdl"); setmodel(self, "models/machette.mdl");
@ -163,10 +161,10 @@ w_machette_throw(void)
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity machette = spawn(); entity machette = spawn();
setmodel(machette, "models/machette.mdl"); setmodel(machette, "models/machette.mdl");
setorigin(machette, Weapons_GetCameraPos() + (v_forward * 16)); setorigin(machette, Weapons_GetCameraPos(pl) + (v_forward * 16));
machette.owner = self; machette.owner = self;
machette.velocity = v_forward * 2000; machette.velocity = v_forward * 2000;
machette.movetype = MOVETYPE_FLY; machette.movetype = MOVETYPE_FLY;
@ -179,9 +177,8 @@ w_machette_throw(void)
#endif #endif
void void
w_machette_secondary(void) w_machette_secondary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -189,11 +186,11 @@ w_machette_secondary(void)
/* Actual firing */ /* Actual firing */
#ifdef SERVER #ifdef SERVER
w_machette_throw(); w_machette_throw(pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_machette.throw"); Sound_Play(pl, CHAN_WEAPON, "weapon_machette.throw");
#else #else
Weapons_ViewPunchAngle([-2,0,0]); Weapons_ViewPunchAngle(pl, [-2,0,0]);
Weapons_ViewAnimation(MACHETTE_THROW); Weapons_ViewAnimation(pl, MACHETTE_THROW);
#endif #endif
if (self.flags & FL_CROUCHING) if (self.flags & FL_CROUCHING)
@ -206,9 +203,8 @@ w_machette_secondary(void)
} }
void void
w_machette_release(void) w_machette_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next > 0.0) { if (pl.w_idle_next > 0.0) {
return; return;
@ -218,27 +214,27 @@ w_machette_release(void)
r = (float)input_sequence % 3; r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 1: case 1:
Weapons_ViewAnimation(MACHETTE_IDLE1); Weapons_ViewAnimation(pl, MACHETTE_IDLE1);
pl.w_idle_next = 1.3f; pl.w_idle_next = 1.3f;
break; break;
case 2: case 2:
Weapons_ViewAnimation(MACHETTE_IDLE2); Weapons_ViewAnimation(pl, MACHETTE_IDLE2);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
break; break;
default: default:
Weapons_ViewAnimation(MACHETTE_IDLE3); Weapons_ViewAnimation(pl, MACHETTE_IDLE3);
pl.w_idle_next = 1.285f; pl.w_idle_next = 1.285f;
} }
} }
float float
w_machette_aimanim(void) w_machette_aimanim(player pl)
{ {
return w_broom_aimanim(); return w_broom_aimanim(pl);
} }
void void
w_machette_hudpic(int selected, vector pos, float a) w_machette_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -279,7 +275,7 @@ weapon_t w_machette =
.secondary = w_machette_secondary, .secondary = w_machette_secondary,
.reload = __NULL__, .reload = __NULL__,
.release = w_machette_release, .release = w_machette_release,
.crosshair = __NULL__, .postdraw = __NULL__,
.precache = w_machette_precache, .precache = w_machette_precache,
.pickup = w_machette_pickup, .pickup = w_machette_pickup,
.updateammo = w_machette_updateammo, .updateammo = w_machette_updateammo,

View file

@ -54,10 +54,9 @@ w_sodalauncher_precache(void)
} }
int int
w_sodalauncher_pickup(int new, int startammo) w_sodalauncher_pickup(player pl, int new, int startammo)
{ {
#ifdef SERVER #ifdef SERVER
player pl = (player)self;
if (pl.ammo_soda < MAX_A_SODA) { if (pl.ammo_soda < MAX_A_SODA) {
pl.ammo_soda = bound(0, pl.ammo_soda + 3, MAX_A_SODA); pl.ammo_soda = bound(0, pl.ammo_soda + 3, MAX_A_SODA);
} else { } else {
@ -80,7 +79,7 @@ w_sodalauncher_wmodel(void)
} }
string string
w_sodalauncher_pmodel(void) w_sodalauncher_pmodel(player pl)
{ {
return "models/p_soda.mdl"; return "models/p_soda.mdl";
} }
@ -92,11 +91,11 @@ w_sodalauncher_deathmsg(void)
} }
void void
w_sodalauncher_draw(void) w_sodalauncher_draw(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
Weapons_SetModel("models/v_soda.mdl"); Weapons_SetModel("models/v_soda.mdl");
Weapons_ViewAnimation(SODA_DRAW); Weapons_ViewAnimation(pl, SODA_DRAW);
/* needs the skin value to be set, no API yet /* needs the skin value to be set, no API yet
* the soda cans in the viewmodel sync up with * the soda cans in the viewmodel sync up with
* the projectile and spill decals */ * the projectile and spill decals */
@ -104,18 +103,17 @@ w_sodalauncher_draw(void)
} }
void void
w_sodalauncher_holster(void) w_sodalauncher_holster(player pl)
{ {
Weapons_ViewAnimation(SODA_HOLSTER); Weapons_ViewAnimation(pl, SODA_HOLSTER);
} }
/* TODO now just need parameters */ /* TODO now just need parameters */
#ifdef SERVER #ifdef SERVER
void void
w_sodalauncher_shoot(void) w_sodalauncher_shoot(player pl)
{ {
player pl = (player)self;
/* Apply force */ /* Apply force */
if (pl.flags & FL_ONGROUND) { if (pl.flags & FL_ONGROUND) {
@ -132,10 +130,10 @@ w_sodalauncher_shoot(void)
remove(self); remove(self);
} }
Weapons_MakeVectors(); Weapons_MakeVectors(pl);
entity soda = spawn(); entity soda = spawn();
setmodel(soda, "models/sodacan.mdl"); setmodel(soda, "models/sodacan.mdl");
setorigin(soda, Weapons_GetCameraPos() + (v_forward * 16)); setorigin(soda, Weapons_GetCameraPos(pl) + (v_forward * 16));
soda.skin = floor(random(0,6)); soda.skin = floor(random(0,6));
soda.owner = self; soda.owner = self;
soda.velocity = v_forward * 800; soda.velocity = v_forward * 800;
@ -155,9 +153,9 @@ w_sodalauncher_shoot(void)
* Sprite code in Nuclide is still WIP * Sprite code in Nuclide is still WIP
* so this is client-only for now */ * so this is client-only for now */
void void
w_sodalauncher_exhaust(void) { w_sodalauncher_exhaust(player pl) {
env_sprite eExhaust = spawn(env_sprite); env_sprite eExhaust = spawn(env_sprite);
setorigin(eExhaust, Weapons_GetCameraPos() + (v_forward * 16)); setorigin(eExhaust, Weapons_GetCameraPos(pl) + (v_forward * 16));
setmodel(eExhaust, "sprites/co2_puff.spr"); setmodel(eExhaust, "sprites/co2_puff.spr");
eExhaust.effects = EF_ADDITIVE; eExhaust.effects = EF_ADDITIVE;
@ -172,9 +170,8 @@ w_sodalauncher_exhaust(void) {
#endif #endif
void void
w_sodalauncher_primary(void) w_sodalauncher_primary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -194,11 +191,11 @@ w_sodalauncher_primary(void)
/* Actual firing /* Actual firing
* TODO make this one fast straight */ * TODO make this one fast straight */
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewPunchAngle([-10,0,0]); Weapons_ViewPunchAngle(pl, [-10,0,0]);
Weapons_ViewAnimation(SODA_SHOOT_RELOAD); Weapons_ViewAnimation(pl, SODA_SHOOT_RELOAD);
w_sodalauncher_exhaust(); w_sodalauncher_exhaust(pl);
#else #else
w_sodalauncher_shoot(); w_sodalauncher_shoot(pl);
pl.ammo_soda--; pl.ammo_soda--;
Sound_Play(pl, CHAN_WEAPON, "weapon_sodalauncher.fire"); Sound_Play(pl, CHAN_WEAPON, "weapon_sodalauncher.fire");
#endif #endif
@ -208,9 +205,8 @@ w_sodalauncher_primary(void)
} }
/* TODO Actual secondary fire is the current primary fire code, just WIP */ /* TODO Actual secondary fire is the current primary fire code, just WIP */
void void
w_sodalauncher_secondary(void) w_sodalauncher_secondary(player pl)
{ {
player pl = (player)self;
if (pl.w_attack_next > 0.0) { if (pl.w_attack_next > 0.0) {
return; return;
@ -229,11 +225,11 @@ w_sodalauncher_secondary(void)
/* TODO make this one sag and slower */ /* TODO make this one sag and slower */
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewPunchAngle([-10,0,0]); Weapons_ViewPunchAngle(pl, [-10,0,0]);
Weapons_ViewAnimation(SODA_SHOOT_RELOAD); Weapons_ViewAnimation(pl, SODA_SHOOT_RELOAD);
w_sodalauncher_exhaust(); w_sodalauncher_exhaust(pl);
#else #else
w_sodalauncher_shoot(); w_sodalauncher_shoot(pl);
pl.ammo_soda--; pl.ammo_soda--;
Sound_Play(pl, CHAN_WEAPON, "weapon_sodalauncher.fire"); Sound_Play(pl, CHAN_WEAPON, "weapon_sodalauncher.fire");
#endif #endif
@ -243,20 +239,19 @@ w_sodalauncher_secondary(void)
} }
void void
w_sodalauncher_release(void) w_sodalauncher_release(player pl)
{ {
player pl = (player)self;
if (pl.w_idle_next) { if (pl.w_idle_next) {
return; return;
} }
Weapons_ViewAnimation(SODA_IDLE); Weapons_ViewAnimation(pl, SODA_IDLE);
pl.w_idle_next = 3.0f; pl.w_idle_next = 3.0f;
} }
void void
w_sodalauncher_crosshair(void) w_sodalauncher_crosshair(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
static vector cross_pos; static vector cross_pos;
@ -287,13 +282,13 @@ w_sodalauncher_crosshair(void)
} }
float float
w_sodalauncher_aimanim(void) w_sodalauncher_aimanim(player pl)
{ {
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW; return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
} }
void void
w_sodalauncher_hudpic(int selected, vector pos, float a) w_sodalauncher_hudpic(player pl, int selected, vector pos, float a)
{ {
#ifdef CLIENT #ifdef CLIENT
if (selected) { if (selected) {
@ -333,7 +328,7 @@ weapon_t w_sodalauncher = {
.secondary = w_sodalauncher_secondary, .secondary = w_sodalauncher_secondary,
.reload = __NULL__, .reload = __NULL__,
.release = w_sodalauncher_release, .release = w_sodalauncher_release,
.crosshair = w_sodalauncher_crosshair, .postdraw = w_sodalauncher_crosshair,
.precache = w_sodalauncher_precache, .precache = w_sodalauncher_precache,
.pickup = w_sodalauncher_pickup, .pickup = w_sodalauncher_pickup,
.updateammo = w_sodalauncher_updateammo, .updateammo = w_sodalauncher_updateammo,