Rebased against the latest Nuclide commit.

This commit is contained in:
Marco Cawthorne 2022-03-15 19:34:43 -07:00
parent b6164fa05a
commit 5ad48e5917
Signed by: eukara
GPG Key ID: C196CD8BA993248A
14 changed files with 223 additions and 250 deletions

View File

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

View File

@ -279,6 +279,7 @@ HUD_WeaponPickupNotify(int w)
void
HUD_Draw(void)
{
player pl = (player)pSeat->m_ePlayer;
g_hud_color = autocvar_con_color * (1 / 255);
Textmenu_Draw();
@ -286,7 +287,7 @@ HUD_Draw(void)
Damage_Draw();
HUD_DamageNotify_Draw();
HUD_DrawHealth();
Weapons_DrawCrosshair();
Weapons_DrawCrosshair(pl);
HUD_DrawWeaponSelect();
}

View File

@ -212,13 +212,13 @@ 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

@ -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;
Weapons_AddItem(pl, WEAPON_FISTS, -1);
@ -50,15 +49,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

@ -22,33 +22,31 @@ enum
};
void
w_aicore_draw(void)
w_aicore_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_aicore.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(AIC_DRAW);
Weapons_ViewAnimation(pl, AIC_DRAW);
}
void
w_aicore_holster(void)
w_aicore_holster(player pl)
{
}
void
w_aicore_primary(void)
w_aicore_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef CLIENT
//Weapons_ViewAnimation(GP_FIRESINGLE);
//Weapons_ViewAnimation(pl, GP_FIRESINGLE);
#endif
pl.w_attack_next = 0.15f;
@ -56,9 +54,8 @@ w_aicore_primary(void)
}
void
w_aicore_release(void)
w_aicore_release(player pl)
{
player pl = (player)self;
pl.gflags |= GF_SEMI_TOGGLED;
@ -66,7 +63,7 @@ w_aicore_release(void)
return;
}
Weapons_ViewAnimation(AIC_IDLE);
Weapons_ViewAnimation(pl, AIC_IDLE);
pl.w_idle_next = 1.777778f;
}
@ -83,7 +80,7 @@ w_aicore_wmodel(void)
}
string
w_aicore_pmodel(void)
w_aicore_pmodel(player pl)
{
return "models/w_aicore.mdl";
}
@ -95,13 +92,13 @@ w_aicore_deathmsg(void)
}
float
w_aicore_aimanim(void)
w_aicore_aimanim(player pl)
{
return (0);
}
void
w_aicore_hudpic(int selected, vector pos, float a)
w_aicore_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -134,7 +131,7 @@ weapon_t w_aicore =
.secondary = __NULL__,
.reload = __NULL__,
.release = w_aicore_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_aicore_precache,
.pickup = __NULL__,
.updateammo = w_aicore_updateammo,

View File

@ -27,38 +27,35 @@ enum
};
void
w_beamgun_draw(void)
w_beamgun_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_beam.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(BEAMGUN_DRAW);
Weapons_ViewAnimation(pl, BEAMGUN_DRAW);
}
void
w_beamgun_holster(void)
w_beamgun_holster(player pl)
{
}
void
w_beamgun_release(void)
w_beamgun_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
}
Weapons_ViewAnimation(BEAMGUN_IDLE);
Weapons_ViewAnimation(pl, BEAMGUN_IDLE);
pl.w_idle_next = 2.6f;
}
void
w_beamgun_primary(void)
w_beamgun_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -67,7 +64,7 @@ w_beamgun_primary(void)
if (pl.a_ammo1 > 0) {
pl.a_ammo1 = 0;
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(BEAMGUN_CONFIG);
Weapons_ViewAnimation(pl, BEAMGUN_CONFIG);
pl.w_attack_next = 2.26087f;
pl.w_idle_next = 2.26087f;
return;
@ -77,10 +74,10 @@ w_beamgun_primary(void)
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef CLIENT
//Weapons_ViewAnimation(GP_FIRESINGLE);
//Weapons_ViewAnimation(pl, GP_FIRESINGLE);
#endif
pl.w_attack_next = 0.15f;
@ -88,9 +85,8 @@ w_beamgun_primary(void)
}
void
w_beamgun_secondary(void)
w_beamgun_secondary(player pl)
{
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -125,7 +121,7 @@ w_beamgun_wmodel(void)
}
string
w_beamgun_pmodel(void)
w_beamgun_pmodel(player pl)
{
return "models/p_egon.mdl";
}
@ -137,13 +133,13 @@ w_beamgun_deathmsg(void)
}
float
w_beamgun_aimanim(void)
w_beamgun_aimanim(player pl)
{
return (0);
}
void
w_beamgun_hud(void)
w_beamgun_hud(player pl)
{
#ifdef CLIENT
static string rmodes[] = {
@ -170,7 +166,6 @@ w_beamgun_hud(void)
"BALL"
};
vector pos;
player pl = (player)self;
/* menu */
if (pl.a_ammo1 > 0) {
@ -228,7 +223,7 @@ w_beamgun_hud(void)
}
void
w_beamgun_hudpic(int selected, vector pos, float a)
w_beamgun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -267,7 +262,7 @@ weapon_t w_beamgun =
.secondary = w_beamgun_secondary,
.reload = __NULL__,
.release = w_beamgun_release,
.crosshair = w_beamgun_hud,
.postdraw = w_beamgun_hud,
.precache = w_beamgun_precache,
.pickup = __NULL__,
.updateammo = w_beamgun_updateammo,

View File

@ -25,25 +25,23 @@ enum
};
void
w_chemicalgun_draw(void)
w_chemicalgun_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_chemgun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(CHEMGUN_DRAW);
Weapons_ViewAnimation(pl, CHEMGUN_DRAW);
}
void
w_chemicalgun_holster(void)
w_chemicalgun_holster(player pl)
{
}
void
w_chemicalgun_primary(void)
w_chemicalgun_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -52,7 +50,7 @@ w_chemicalgun_primary(void)
if (pl.a_ammo1 > 0) {
pl.a_ammo1 = 0;
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(CHEMGUN_CONFIG);
Weapons_ViewAnimation(pl, CHEMGUN_CONFIG);
pl.w_attack_next = 2.08f;
pl.w_idle_next = pl.w_attack_next;
return;
@ -62,10 +60,10 @@ w_chemicalgun_primary(void)
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef CLIENT
//Weapons_ViewAnimation(GP_FIRESINGLE);
//Weapons_ViewAnimation(pl, GP_FIRESINGLE);
#endif
pl.w_attack_next = 0.15f;
@ -73,9 +71,8 @@ w_chemicalgun_primary(void)
}
void
w_chemicalgun_secondary(void)
w_chemicalgun_secondary(player pl)
{
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -96,15 +93,14 @@ w_chemicalgun_secondary(void)
}
void
w_chemicalgun_release(void)
w_chemicalgun_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
}
Weapons_ViewAnimation(CHEMGUN_IDLE);
Weapons_ViewAnimation(pl, CHEMGUN_IDLE);
pl.w_idle_next = 2.08f;
}
@ -121,7 +117,7 @@ w_chemicalgun_wmodel(void)
}
string
w_chemicalgun_pmodel(void)
w_chemicalgun_pmodel(player pl)
{
return "models/p_hgun.mdl";
}
@ -133,16 +129,15 @@ w_chemicalgun_deathmsg(void)
}
float
w_chemicalgun_aimanim(void)
w_chemicalgun_aimanim(player pl)
{
return (0);
}
int
w_chemicalgun_pickup(int new, int startammo)
w_chemicalgun_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.chem_acid = 5;
@ -246,11 +241,10 @@ w_chemgun_drawpressure(vector pos, int length, vector col)
#endif
void
w_chemicalgun_hud(void)
w_chemicalgun_hud(player pl)
{
#ifdef CLIENT
vector pos;
player pl = (player)self;
pos = g_hudmins + [g_hudres[0] - 125, g_hudres[1] - 42];
for (int i = 0; i < 3; i++) {
@ -316,7 +310,7 @@ w_chemicalgun_hud(void)
}
void
w_chemicalgun_hudpic(int selected, vector pos, float a)
w_chemicalgun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -369,7 +363,7 @@ weapon_t w_chemicalgun =
.secondary = w_chemicalgun_secondary,
.reload = __NULL__,
.release = w_chemicalgun_release,
.crosshair = w_chemicalgun_hud,
.postdraw = w_chemicalgun_hud,
.precache = w_chemicalgun_precache,
.pickup = w_chemicalgun_pickup,
.updateammo = w_chemicalgun_updateammo,

View File

@ -73,25 +73,23 @@ enum
/* functions */
void
w_dml_draw(void)
w_dml_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_dml.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(DML_DRAW);
Weapons_ViewAnimation(pl, DML_DRAW);
}
void
w_dml_holster(void)
w_dml_holster(player pl)
{
}
void
w_dml_release(void)
w_dml_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
@ -99,9 +97,9 @@ w_dml_release(void)
if (pl.dml_state == DS_RELOADING) {
if (pl.menu_active == 1) {
Weapons_ViewAnimation(DML_RELOADRIGHT);
Weapons_ViewAnimation(pl, DML_RELOADRIGHT);
} else {
Weapons_ViewAnimation(DML_RELOADLEFT);
Weapons_ViewAnimation(pl, DML_RELOADLEFT);
}
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_dml.reload");
@ -118,20 +116,43 @@ w_dml_release(void)
case 1:
case 2:
case 3:
Weapons_ViewAnimation(DML_IDLE);
Weapons_ViewAnimation(pl, DML_IDLE);
pl.w_idle_next = 10.0f;
break;
default:
Weapons_ViewAnimation(DML_FIDGET);
Weapons_ViewAnimation(pl, DML_FIDGET);
pl.w_idle_next = 2.0f;
}
}
#ifdef SERVER
void
w_dml_primary(void)
w_dml_firerocket(player pl)
{
static void w_dml_rocket_impact(entity target, entity source) {
Damage_Apply(target, source.owner, Skill_GetValue("sk_gaussfast_d", 13), WEAPON_GAUSSPISTOL, DMG_GENERIC);
}
NSProjectile ball = spawn(NSProjectile);
ball.SetModel("models/rocket.mdl");
ball.SetAngles(self.v_angle);
ball.SetScale(0.25f);
ball.SetRenderMode(RM_ADDITIVE);
ball.SetOwner(pl);
ball.SetImpact(w_dml_rocket_impact);
makevectors(pl.v_angle);
ball.SetOrigin(Weapons_GetCameraPos(pl) + (v_forward * 8));
ball.SetVelocity(v_forward * 500);
}
#endif
void
w_dml_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -140,7 +161,7 @@ w_dml_primary(void)
if (pl.menu_active > 0) {
pl.menu_active = 0;
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(DML_CUSTOMIZE);
Weapons_ViewAnimation(pl, DML_CUSTOMIZE);
#ifdef SERVER
Sound_Play(pl, 8, "weapon_dml.customize");
#endif
@ -154,26 +175,27 @@ w_dml_primary(void)
}
if (pl.dml_state == DS_RELOADING) {
w_dml_release();
w_dml_release(pl);
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef SERVER
w_dml_firerocket(pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_dml.fire");
#endif
Weapons_ViewAnimation(DML_FIRE);
Weapons_ViewAnimation(pl, DML_FIRE);
pl.w_attack_next = 1.222222f;
pl.w_idle_next = 1.222222f;
pl.dml_state = DS_RELOADING;
}
void
w_dml_secondary(void)
w_dml_secondary(player pl)
{
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -206,7 +228,7 @@ w_dml_wmodel(void)
}
string
w_dml_pmodel(void)
w_dml_pmodel(player pl)
{
return "models/p_crossbow.mdl";
}
@ -218,16 +240,15 @@ w_dml_deathmsg(void)
}
float
w_dml_aimanim(void)
w_dml_aimanim(player pl)
{
return (0);
}
int
w_dml_pickup(int new, int startammo)
w_dml_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_rocket < 100) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 2, 100);
@ -239,7 +260,7 @@ w_dml_pickup(int new, int startammo)
}
void
w_dml_hud(void)
w_dml_hud(player pl)
{
#ifdef CLIENT
static string lmodes[] = {
@ -264,11 +285,11 @@ w_dml_hud(void)
vector pos;
vector jitter;
float lerp;
player pl = (player)self;
/* laser */
Weapons_MakeVectors();
vector src = Weapons_GetCameraPos();
if (pl.dml_flightpath == FLIGHTPATH_GUIDED) {
Weapons_MakeVectors(pl);
vector src = Weapons_GetCameraPos(pl);
traceline(src, src + (v_forward * 256), FALSE, pl);
lerp = Math_Lerp(18,6, trace_fraction);
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
@ -284,6 +305,7 @@ w_dml_hud(void)
1.0f,
DRAWFLAG_ADDITIVE
);
}
/* menu */
if (pl.menu_active > 0) {
@ -344,7 +366,7 @@ w_dml_hud(void)
}
void
w_dml_hudpic(int selected, vector pos, float a)
w_dml_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -389,7 +411,7 @@ weapon_t w_dml =
.secondary = w_dml_secondary,
.reload = __NULL__,
.release = w_dml_release,
.crosshair = w_dml_hud,
.postdraw = w_dml_hud,
.precache = w_dml_precache,
.pickup = w_dml_pickup,
.updateammo = w_dml_updateammo,

View File

@ -50,30 +50,27 @@ w_fists_updateammo(player pl)
}
void
w_fists_draw(void)
w_fists_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
player pl = (player)self;
Weapons_SetModel("models/v_hands.mdl");
Weapons_SetGeomset("geomset 1 2\n");
Weapons_ViewAnimation(KNIFE_DRAW);
Weapons_ViewAnimation(pl, KNIFE_DRAW);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_fists.knifedraw");
#endif
}
void
w_fists_holster(void)
w_fists_holster(player pl)
{
Weapons_ViewAnimation(KNIFE_HOLSTER);
Weapons_ViewAnimation(pl, KNIFE_HOLSTER);
}
void
w_fists_release(void)
w_fists_release(player pl)
{
int r;
player pl = (player)self;
if (pl.w_idle_next) {
return;
@ -83,14 +80,14 @@ w_fists_release(void)
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_fists.knifedraw");
#endif
Weapons_ViewAnimation(KNIFE_DRAW);
Weapons_ViewAnimation(pl, KNIFE_DRAW);
Weapons_SetGeomset("geomset 1 2\n");
pl.a_ammo3 = HS_KNIFE;
pl.w_attack_next = 0.75f;
pl.w_idle_next = pl.w_attack_next;
return;
} else if (pl.a_ammo3 == HS_KNIFE_TO_FISTS) {
Weapons_ViewAnimation(FISTS_DRAW);
Weapons_ViewAnimation(pl, FISTS_DRAW);
Weapons_SetGeomset("geomset 1 1\n");
pl.a_ammo3 = HS_FISTS;
pl.w_attack_next = 1.4f;
@ -105,11 +102,11 @@ w_fists_release(void)
case 1:
case 2:
case 3:
Weapons_ViewAnimation(KNIFE_IDLE);
Weapons_ViewAnimation(pl, KNIFE_IDLE);
pl.w_idle_next = 10.0f;
break;
default:
Weapons_ViewAnimation(KNIFE_FIDGET);
Weapons_ViewAnimation(pl, KNIFE_FIDGET);
pl.w_idle_next = 2.0f;
}
} else {
@ -118,24 +115,23 @@ w_fists_release(void)
case 0:
case 1:
case 2:
Weapons_ViewAnimation(FISTS_IDLE);
Weapons_ViewAnimation(pl, FISTS_IDLE);
pl.w_idle_next = 10.0f;
break;
case 3:
Weapons_ViewAnimation(FISTS_FIDGET1);
Weapons_ViewAnimation(pl, FISTS_FIDGET1);
pl.w_idle_next = 3.0f;
break;
default:
Weapons_ViewAnimation(FISTS_FIDGET2);
Weapons_ViewAnimation(pl, FISTS_FIDGET2);
pl.w_idle_next = 2.333333f;
}
}
}
void
w_fists_primary(void)
w_fists_primary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
@ -147,16 +143,16 @@ w_fists_primary(void)
Sound_Play(pl, 8, "weapon_fists.missknife");
#endif
if (pl.a_ammo1 == 1) {
Weapons_ViewAnimation(KNIFE_ATTACK1);
Weapons_ViewAnimation(pl, KNIFE_ATTACK1);
} else {
Weapons_ViewAnimation(KNIFE_ATTACK2);
Weapons_ViewAnimation(pl, KNIFE_ATTACK2);
}
#ifdef SERVER
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + (v_forward * 96),\
traceline(Weapons_GetCameraPos(pl), Weapons_GetCameraPos(pl) + (v_forward * 96),\
FALSE, pl);
if (trace_ent && trace_fraction <= 1.0) {
if (trace_ent.takedamage = DAMAGE_YES) {
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, pl, Skill_GetValue("sk_knife1_d", 25), WEAPON_GAUSSPISTOL, DMG_GENERIC);
}
}
@ -166,22 +162,22 @@ w_fists_primary(void)
pl.w_idle_next = pl.w_attack_next;
} else {
if (pl.a_ammo1 == 1) {
Weapons_ViewAnimation(FISTS_RIGHT);
Weapons_ViewAnimation(pl, FISTS_RIGHT);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_fists.hitright");
#endif
} else {
Weapons_ViewAnimation(FISTS_LEFT);
Weapons_ViewAnimation(pl, FISTS_LEFT);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_fists.hitleft");
#endif
}
#ifdef SERVER
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + (v_forward * 96),\
traceline(Weapons_GetCameraPos(pl), Weapons_GetCameraPos(pl) + (v_forward * 96),\
FALSE, pl);
if (trace_ent && trace_fraction <= 1.0) {
if (trace_ent.takedamage = DAMAGE_YES) {
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, pl, Skill_GetValue("sk_twohandpunch_d", 10), WEAPON_GAUSSPISTOL, DMG_GENERIC);
}
}
@ -193,22 +189,21 @@ w_fists_primary(void)
}
void
w_fists_secondary(void)
w_fists_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
w_fists_release();
w_fists_release(pl);
return;
}
if (pl.a_ammo3 == HS_KNIFE) {
Weapons_ViewAnimation(KNIFE_HOLSTER);
Weapons_ViewAnimation(pl, KNIFE_HOLSTER);
pl.a_ammo3 = HS_KNIFE_TO_FISTS;
pl.w_attack_next = 0.75f;
pl.w_idle_next = pl.w_attack_next;
} else if (pl.a_ammo3 == HS_FISTS) {
Weapons_ViewAnimation(FISTS_HOLSTER);
Weapons_ViewAnimation(pl, FISTS_HOLSTER);
pl.a_ammo3 = HS_FISTS_TO_KNIFE;
pl.w_attack_next = 0.7f;
pl.w_idle_next = pl.w_attack_next;
@ -222,7 +217,7 @@ w_fists_wmodel(void)
}
string
w_fists_pmodel(void)
w_fists_pmodel(player pl)
{
/* if (pl.a_ammo3 == HS_KNIFE) {
return "";
@ -239,16 +234,15 @@ w_fists_deathmsg(void)
}
float
w_fists_aimanim(void)
w_fists_aimanim(player pl)
{
return (0);
}
int
w_fists_pickup(int new, int startammo)
w_fists_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_minigun < 100) {
pl.ammo_minigun = bound(0, pl.ammo_minigun + 30, 100);
@ -260,7 +254,7 @@ w_fists_pickup(int new, int startammo)
}
void
w_fists_hudpic(int selected, vector pos, float a)
w_fists_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -300,7 +294,7 @@ weapon_t w_fists =
.secondary = w_fists_secondary,
.reload = __NULL__,
.release = w_fists_release,
.crosshair = __NULL__,
.postdraw = __NULL__,
.precache = w_fists_precache,
.pickup = __NULL__,
.updateammo = w_fists_updateammo,

View File

@ -40,25 +40,23 @@ enum
};
void
w_gausspistol_draw(void)
w_gausspistol_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_guasspistol.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(GP_DRAW);
Weapons_ViewAnimation(pl, GP_DRAW);
}
void
w_gausspistol_holster(void)
w_gausspistol_holster(player pl)
{
Weapons_ViewAnimation(GP_HOLSTER);
Weapons_ViewAnimation(pl, GP_HOLSTER);
}
void
w_gausspistol_release(void)
w_gausspistol_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
@ -70,11 +68,11 @@ w_gausspistol_release(void)
case 1:
case 2:
case 3:
Weapons_ViewAnimation(GP_IDLE1);
Weapons_ViewAnimation(pl, GP_IDLE1);
pl.w_idle_next = 3.75f;
break;
default:
Weapons_ViewAnimation(GP_IDLE2);
Weapons_ViewAnimation(pl, GP_IDLE2);
pl.w_idle_next = 3.0f;
}
}
@ -119,11 +117,10 @@ w_gausspistol_firerapid(vector pos, player pl)
#endif
void
w_gausspistol_primary(void)
w_gausspistol_primary(player pl)
{
vector src;
int take = 1;
player pl = (player)self;
if (pl.menu_active > 0) {
pl.menu_active = 0;
@ -157,9 +154,9 @@ w_gausspistol_primary(void)
switch (pl.gauss_mode) {
case GM_FAST:
Weapons_ViewAnimation(GP_FIREFAST);
Weapons_ViewAnimation(pl, GP_FIREFAST);
#ifdef SERVER
w_gausspistol_firerapid(Weapons_GetCameraPos(), pl);
w_gausspistol_firerapid(Weapons_GetCameraPos(pl), pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_gausspistol.firefast");
#endif
pl.w_attack_next = 0.1f;
@ -167,9 +164,9 @@ w_gausspistol_primary(void)
break;
case GM_CHARGE:
take = 10;
Weapons_ViewAnimation(GP_FIRECHARGE);
Weapons_ViewAnimation(pl, GP_FIRECHARGE);
#ifdef SERVER
w_gausspistol_firecharge(Weapons_GetCameraPos(), pl);
w_gausspistol_firecharge(Weapons_GetCameraPos(pl), pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_gausspistol.firecharge");
Sound_Play(pl, 8, "weapon_gausspistol.charge");
#endif
@ -178,9 +175,9 @@ w_gausspistol_primary(void)
break;
default:
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(GP_FIRESINGLE);
Weapons_ViewAnimation(pl, GP_FIRESINGLE);
#ifdef SERVER
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + (v_forward * 1024),\
traceline(Weapons_GetCameraPos(pl), Weapons_GetCameraPos(pl) + (v_forward * 1024),\
FALSE, pl);
if (trace_fraction <= 1.0) {
@ -189,7 +186,7 @@ w_gausspistol_primary(void)
}
}
FX_GaussBeam(Weapons_GetCameraPos(), input_angles, pl);
FX_GaussBeam(Weapons_GetCameraPos(pl), input_angles, pl);
Sound_Play(pl, CHAN_WEAPON, "weapon_gausspistol.firesingle");
#endif
pl.w_attack_next = 0.15f;
@ -197,20 +194,19 @@ w_gausspistol_primary(void)
break;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_WEIRD);
#endif
pl.ammo_gauss -= take;
Weapons_ViewPunchAngle([-5,0,0]);
Weapons_ViewPunchAngle(pl, [-5,0,0]);
}
void
w_gausspistol_secondary(void)
w_gausspistol_secondary(player pl)
{
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -220,7 +216,7 @@ w_gausspistol_secondary(void)
/* activate menu */
pl.menu_active = 1;
w_gausspistol_release();
w_gausspistol_release(pl);
}
void
@ -236,7 +232,7 @@ w_gausspistol_wmodel(void)
}
string
w_gausspistol_pmodel(void)
w_gausspistol_pmodel(player pl)
{
return "models/p_357.mdl";
}
@ -248,16 +244,15 @@ w_gausspistol_deathmsg(void)
}
float
w_gausspistol_aimanim(void)
w_gausspistol_aimanim(player pl)
{
return (0);
}
int
w_gausspistol_pickup(int new, int startammo)
w_gausspistol_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_gauss < 150) {
pl.ammo_gauss = bound(0, pl.ammo_gauss + 35, 150);
@ -269,11 +264,10 @@ w_gausspistol_pickup(int new, int startammo)
}
void
w_gausspistol_hud(void)
w_gausspistol_hud(player pl)
{
#ifdef CLIENT
vector pos;
player pl = (player)self;
pos = g_hudmins + [g_hudres[0] - 125, g_hudres[1] - 42];
for (int i = 0; i < 3; i++) {
@ -389,7 +383,7 @@ w_gausspistol_hud(void)
}
void
w_gausspistol_hudpic(int selected, vector pos, float a)
w_gausspistol_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -433,7 +427,7 @@ weapon_t w_gausspistol =
.secondary = w_gausspistol_secondary,
.reload = __NULL__,
.release = w_gausspistol_release,
.crosshair = w_gausspistol_hud,
.postdraw = w_gausspistol_hud,
.precache = w_gausspistol_precache,
.pickup = w_gausspistol_pickup,
.updateammo = w_gausspistol_updateammo,

View File

@ -27,25 +27,23 @@ enum
};
void
w_grenade_draw(void)
w_grenade_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_grenade.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(GREN_DRAW);
Weapons_ViewAnimation(pl, GREN_DRAW);
}
void
w_grenade_holster(void)
w_grenade_holster(player pl)
{
}
void
w_grenade_primary(void)
w_grenade_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -54,7 +52,7 @@ w_grenade_primary(void)
if (pl.a_ammo1 > 0) {
pl.a_ammo1 = 0;
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(GREN_FIDGET);
Weapons_ViewAnimation(pl, GREN_FIDGET);
pl.w_attack_next = 1.2f;
pl.w_idle_next = pl.w_attack_next;
return;
@ -64,10 +62,10 @@ w_grenade_primary(void)
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef CLIENT
//Weapons_ViewAnimation(GP_FIRESINGLE);
//Weapons_ViewAnimation(pl, GP_FIRESINGLE);
#endif
pl.w_attack_next = 0.15f;
@ -75,9 +73,8 @@ w_grenade_primary(void)
}
void
w_grenade_secondary(void)
w_grenade_secondary(player pl)
{
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -102,15 +99,14 @@ w_grenade_secondary(void)
}
void
w_grenade_release(void)
w_grenade_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
}
Weapons_ViewAnimation(GREN_IDLE1);
Weapons_ViewAnimation(pl, GREN_IDLE1);
pl.w_idle_next = 1.777778f;
}
@ -127,7 +123,7 @@ w_grenade_wmodel(void)
}
string
w_grenade_pmodel(void)
w_grenade_pmodel(player pl)
{
return "models/p_grenade.mdl";
}
@ -139,17 +135,16 @@ w_grenade_deathmsg(void)
}
float
w_grenade_aimanim(void)
w_grenade_aimanim(player pl)
{
return (0);
}
void
w_grenade_hud(void)
w_grenade_hud(player pl)
{
#ifdef CLIENT
vector pos;
player pl = (player)self;
static string dmodes[] = {
"WHEN TRIPPED",
@ -193,7 +188,7 @@ w_grenade_hud(void)
}
void
w_grenade_hudpic(int selected, vector pos, float a)
w_grenade_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -231,7 +226,7 @@ weapon_t w_grenade =
.secondary = w_grenade_secondary,
.reload = __NULL__,
.release = w_grenade_release,
.crosshair = w_grenade_hud,
.postdraw = w_grenade_hud,
.precache = w_grenade_precache,
.pickup = __NULL__,
.updateammo = w_grenade_updateammo,

View File

@ -28,31 +28,29 @@ enum
};
void
w_minigun_draw(void)
w_minigun_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_mechagun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(MG_DRAW);
Weapons_ViewAnimation(pl, MG_DRAW);
}
void
w_minigun_holster(void)
w_minigun_holster(player pl)
{
Weapons_ViewAnimation(MG_DRAW);
Weapons_ViewAnimation(pl, MG_DRAW);
}
void
w_minigun_release(void)
w_minigun_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
}
if (pl.menu_active == 1) {
Weapons_ViewAnimation(MG_IDLELOOP);
Weapons_ViewAnimation(pl, MG_IDLELOOP);
pl.w_idle_next = 0.666667f;
return;
}
@ -63,29 +61,28 @@ w_minigun_release(void)
case 1:
case 2:
case 3:
Weapons_ViewAnimation(MG_IDLE);
Weapons_ViewAnimation(pl, MG_IDLE);
pl.w_idle_next = 10.0f;
break;
default:
Weapons_ViewAnimation(MG_FIDGET);
Weapons_ViewAnimation(pl, MG_FIDGET);
pl.w_idle_next = 2.0f;
}
}
void
w_minigun_primary(void)
w_minigun_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
if (pl.ammo_minigun <= 0) {
w_minigun_release();
w_minigun_release(pl);
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_minigun.fire");
@ -93,20 +90,20 @@ w_minigun_primary(void)
View_SetMuzzleflash(MUZZLE_RIFLE);
#endif
Weapons_ViewPunchAngle([-2,0,0]);
Weapons_ViewPunchAngle(pl, [-2,0,0]);
pl.ammo_minigun--;
if (pl.menu_active == 1) {
Weapons_ViewAnimation(MG_FIRELOOP);
Weapons_ViewAnimation(pl, MG_FIRELOOP);
#ifdef SERVER
TraceAttack_FireBullets(1, src, Skill_GetValue("sk_9mmAR_bullet", 10), [0.1,0.1], WEAPON_MINIGUN);
#endif
pl.w_attack_next = 0.1f;
pl.w_idle_next = 0.1f;
} else {
Weapons_ViewAnimation(MG_FIRE);
Weapons_ViewAnimation(pl, MG_FIRE);
#ifdef SERVER
TraceAttack_FireBullets(1, src, Skill_GetValue("sk_9mmAR_bullet", 10), [0.05,0.05], WEAPON_MINIGUN);
#endif
@ -116,9 +113,8 @@ w_minigun_primary(void)
}
void
w_minigun_secondary(void)
w_minigun_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
return;
}
@ -132,9 +128,9 @@ w_minigun_secondary(void)
#endif
if (pl.menu_active == 0) {
Weapons_ViewAnimation(MG_SPINUP);
Weapons_ViewAnimation(pl, MG_SPINUP);
} else {
Weapons_ViewAnimation(MG_SPINDOWN);
Weapons_ViewAnimation(pl, MG_SPINDOWN);
}
pl.menu_active = 1 - pl.menu_active;
@ -156,7 +152,7 @@ w_minigun_wmodel(void)
}
string
w_minigun_pmodel(void)
w_minigun_pmodel(player pl)
{
return "models/p_9mmar.mdl";
}
@ -168,16 +164,15 @@ w_minigun_deathmsg(void)
}
float
w_minigun_aimanim(void)
w_minigun_aimanim(player pl)
{
return (0);
}
int
w_minigun_pickup(int new, int startammo)
w_minigun_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_minigun < 100) {
pl.ammo_minigun = bound(0, pl.ammo_minigun + 30, 100);
@ -189,7 +184,7 @@ w_minigun_pickup(int new, int startammo)
}
void
w_minigun_hud(void)
w_minigun_hud(player pl)
{
#ifdef CLIENT
vector pos;
@ -223,7 +218,7 @@ w_minigun_hud(void)
}
void
w_minigun_hudpic(int selected, vector pos, float a)
w_minigun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -262,7 +257,7 @@ weapon_t w_minigun =
.secondary = w_minigun_secondary,
.reload = __NULL__,
.release = w_minigun_release,
.crosshair = w_minigun_hud,
.postdraw = w_minigun_hud,
.precache = w_minigun_precache,
.pickup = w_minigun_pickup,
.updateammo = w_minigun_updateammo,

View File

@ -49,26 +49,24 @@ string gsmodes[] = {
#endif
void
w_shotgun_draw(void)
w_shotgun_draw(player pl)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_shotgun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(SHOTGUN_DRAW);
Weapons_ViewAnimation(pl, SHOTGUN_DRAW);
}
void
w_shotgun_holster(void)
w_shotgun_holster(player pl)
{
Weapons_ViewAnimation(SHOTGUN_DRAW);
Weapons_ViewAnimation(pl, SHOTGUN_DRAW);
}
void
w_shotgun_primary(void)
w_shotgun_primary(player pl)
{
vector src;
player pl = (player)self;
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
@ -77,7 +75,7 @@ w_shotgun_primary(void)
if (pl.menu_active > 0) {
pl.menu_active = 0;
pl.gflags |= GF_SEMI_TOGGLED;
Weapons_ViewAnimation(SHOTGUN_CUSTOMIZE);
Weapons_ViewAnimation(pl, SHOTGUN_CUSTOMIZE);
pl.w_attack_next = 2.25f;
pl.w_idle_next = 2.25f;
return;
@ -87,7 +85,7 @@ w_shotgun_primary(void)
return;
}
src = Weapons_GetCameraPos();
src = Weapons_GetCameraPos(pl);
pl.velocity += v_forward * -128;
@ -114,21 +112,21 @@ w_shotgun_primary(void)
View_SetMuzzleflash(MUZZLE_SMALL);
#endif
Weapons_ViewPunchAngle([-5,0,0]);
Weapons_ViewPunchAngle(pl, [-5,0,0]);
int r = floor(pseudorandom() * 4.0);
switch (r) {
case 0:
Weapons_ViewAnimation(SHOTGUN_SHOOT1);
Weapons_ViewAnimation(pl, SHOTGUN_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(SHOTGUN_SHOOT2);
Weapons_ViewAnimation(pl, SHOTGUN_SHOOT2);
break;
case 2:
Weapons_ViewAnimation(SHOTGUN_SHOOT3);
Weapons_ViewAnimation(pl, SHOTGUN_SHOOT3);
break;
default:
Weapons_ViewAnimation(SHOTGUN_SHOOT4);
Weapons_ViewAnimation(pl, SHOTGUN_SHOOT4);
}
pl.w_attack_next = 0.846154f;
@ -136,9 +134,8 @@ w_shotgun_primary(void)
}
void
w_shotgun_secondary(void)
w_shotgun_secondary(player pl)
{
player pl = (player)self;
if (pl.w_attack_next) {
return;
@ -163,9 +160,8 @@ w_shotgun_secondary(void)
}
void
w_shotgun_release(void)
w_shotgun_release(player pl)
{
player pl = (player)self;
if (pl.w_idle_next) {
return;
@ -177,11 +173,11 @@ w_shotgun_release(void)
case 1:
case 2:
case 3:
Weapons_ViewAnimation(SHOTGUN_IDLE);
Weapons_ViewAnimation(pl, SHOTGUN_IDLE);
pl.w_idle_next = 10.0f;
break;
default:
Weapons_ViewAnimation(SHOTGUN_FIDGET);
Weapons_ViewAnimation(pl, SHOTGUN_FIDGET);
pl.w_idle_next = 2.0f;
}
}
@ -199,7 +195,7 @@ w_shotgun_wmodel(void)
}
string
w_shotgun_pmodel(void)
w_shotgun_pmodel(player pl)
{
return "models/p_shotgun.mdl";
}
@ -211,16 +207,15 @@ w_shotgun_deathmsg(void)
}
float
w_shotgun_aimanim(void)
w_shotgun_aimanim(player pl)
{
return (0);
}
int
w_shotgun_pickup(int new, int startammo)
w_shotgun_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.shotgun_shells = 2;
@ -237,11 +232,10 @@ w_shotgun_pickup(int new, int startammo)
}
void
w_shotgun_hud(void)
w_shotgun_hud(player pl)
{
#ifdef CLIENT
vector pos;
player pl = (player)self;
pos = g_hudmins + [g_hudres[0] - 125, g_hudres[1] - 42];
for (int i = 0; i < 3; i++) {
@ -301,7 +295,7 @@ w_shotgun_hud(void)
}
void
w_shotgun_hudpic(int selected, vector pos, float a)
w_shotgun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
drawpic(
@ -339,7 +333,7 @@ weapon_t w_shotgun =
.secondary = w_shotgun_secondary,
.reload = __NULL__,
.release = w_shotgun_release,
.crosshair = w_shotgun_hud,
.postdraw = w_shotgun_hud,
.precache = w_shotgun_precache,
.pickup = w_shotgun_pickup,
.updateammo = w_shotgun_updateammo,

View File

@ -44,17 +44,17 @@ enum
WEIGHT_CHEMICALGUN
};
weapontype_t gunman_wpntype_ranged(void)
weapontype_t gunman_wpntype_ranged(player pl)
{
return WPNTYPE_RANGED;
}
weapontype_t gunman_wpntype_close(void)
weapontype_t gunman_wpntype_close(player pl)
{
return WPNTYPE_CLOSE;
}
weapontype_t gunman_wpntype_throw(void)
weapontype_t gunman_wpntype_throw(player pl)
{
return WPNTYPE_THROW;
}