Update copyright information

Remove pmodel attributes from the player class.
Fix shotgun and DML menu. Add fix for the gauss-pistol triggering a client-side fire upon closing the menu.
This commit is contained in:
Marco Cawthorne 2022-03-13 16:58:38 -07:00
parent 1ee8be9c9f
commit 92ac106b5d
Signed by: eukara
GPG key ID: C196CD8BA993248A
31 changed files with 123 additions and 57 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -10,6 +10,7 @@
../../../src/shared/fteextensions.qc
../../../src/shared/defs.h
../../../src/server/defs.h
../../../src/botlib/botinfo.h
../../../src/gs-entbase/server.src
../../../src/gs-entbase/shared.src

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -80,12 +80,6 @@ class player:base_player
PREDICTED_INT(dml_state);
#ifdef CLIENT
/* External model */
entity p_model;
int p_hand_bone;
int p_model_bone;
float lastweapon;
virtual void(void) draw;
virtual float() predraw;
virtual void(void) postdraw;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -24,6 +24,8 @@ enum
void
w_aicore_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_aicore.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(AIC_DRAW);
@ -122,7 +124,8 @@ w_aicore_precache(void)
weapon_t w_aicore =
{
.name = "aicore",
.id = ITEM_AICORE,
.id = ITEM_AICORE,
.weight = WEIGHT_AICORE,
.slot = 0,
.slot_pos = 1,
.draw = w_aicore_draw,
@ -139,6 +142,7 @@ weapon_t w_aicore =
.pmodel = w_aicore_pmodel,
.deathmsg = w_aicore_deathmsg,
.aimanim = w_aicore_aimanim,
.type = gunman_wpntype_close,
.hudpic = w_aicore_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -29,6 +29,8 @@ enum
void
w_beamgun_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_beam.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(BEAMGUN_DRAW);
@ -255,7 +257,8 @@ w_beamgun_precache(void)
weapon_t w_beamgun =
{
.name = "beamgun",
.id = ITEM_BEAMGUN,
.id = ITEM_BEAMGUN,
.weight = WEIGHT_BEAMGUN,
.slot = 3,
.slot_pos = 0,
.draw = w_beamgun_draw,
@ -272,6 +275,7 @@ weapon_t w_beamgun =
.pmodel = w_beamgun_pmodel,
.deathmsg = w_beamgun_deathmsg,
.aimanim = w_beamgun_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_beamgun_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -27,6 +27,8 @@ enum
void
w_chemicalgun_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_chemgun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(CHEMGUN_DRAW);
@ -357,7 +359,8 @@ w_chemicalgun_precache(void)
weapon_t w_chemicalgun =
{
.name = "chemicalgun",
.id = ITEM_CHEMICALGUN,
.id = ITEM_CHEMICALGUN,
.weight = WEIGHT_CHEMICALGUN,
.slot = 4,
.slot_pos = 1,
.draw = w_chemicalgun_draw,
@ -374,6 +377,7 @@ weapon_t w_chemicalgun =
.pmodel = w_chemicalgun_pmodel,
.deathmsg = w_chemicalgun_deathmsg,
.aimanim = w_chemicalgun_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_chemicalgun_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -75,6 +75,8 @@ enum
void
w_dml_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_dml.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(DML_DRAW);
@ -304,10 +306,10 @@ w_dml_hud(void)
break;
}
txt1 = sprintf("LAUNCH: %s", lmodes[getstati(42)]);
txt2 = sprintf("FLIGHTPATH: %s", fmodes[getstati(43)]);
txt3 = sprintf("DETONATE: %s", dmodes[getstati(44)]);
txt4 = sprintf("PAYLOAD: %s", pmodes[getstati(45)]);
txt1 = sprintf("LAUNCH: %s", lmodes[pl.dml_launch]);
txt2 = sprintf("FLIGHTPATH: %s", fmodes[pl.dml_flightpath]);
txt3 = sprintf("DETONATE: %s", dmodes[pl.dml_detonate]);
txt4 = sprintf("PAYLOAD: %s", pmodes[pl.dml_payload]);
pos = g_hudmins + (g_hudres / 2) + [-80,-48];
drawfont = Font_GetID(FONT_20);
@ -377,7 +379,8 @@ w_dml_precache(void)
weapon_t w_dml =
{
.name = "dml",
.id = ITEM_DML,
.id = ITEM_DML,
.weight = WEIGHT_DML,
.slot = 3,
.slot_pos = 1,
.draw = w_dml_draw,
@ -394,6 +397,7 @@ weapon_t w_dml =
.pmodel = w_dml_pmodel,
.deathmsg = w_dml_deathmsg,
.aimanim = w_dml_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_dml_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -52,6 +52,8 @@ w_fists_updateammo(player pl)
void
w_fists_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
player pl = (player)self;
Weapons_SetModel("models/v_hands.mdl");
Weapons_SetGeomset("geomset 1 2\n");
@ -153,7 +155,7 @@ w_fists_primary(void)
#ifdef SERVER
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + (v_forward * 96),\
FALSE, pl);
if (trace_fraction <= 1.0) {
if (trace_ent && trace_fraction <= 1.0) {
if (trace_ent.takedamage = DAMAGE_YES) {
Damage_Apply(trace_ent, pl, Skill_GetValue("sk_knife1_d", 25), WEAPON_GAUSSPISTOL, DMG_GENERIC);
}
@ -178,7 +180,7 @@ w_fists_primary(void)
#ifdef SERVER
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + (v_forward * 96),\
FALSE, pl);
if (trace_fraction <= 1.0) {
if (trace_ent && trace_fraction <= 1.0) {
if (trace_ent.takedamage = DAMAGE_YES) {
Damage_Apply(trace_ent, pl, Skill_GetValue("sk_twohandpunch_d", 10), WEAPON_GAUSSPISTOL, DMG_GENERIC);
}
@ -288,7 +290,8 @@ w_fists_precache(void)
weapon_t w_fists =
{
.name = "fists",
.id = ITEM_FISTS,
.id = ITEM_FISTS,
.weight = WEIGHT_FISTS,
.slot = 0,
.slot_pos = 0,
.draw = w_fists_draw,
@ -305,5 +308,6 @@ weapon_t w_fists =
.pmodel = __NULL__,
.deathmsg = w_fists_deathmsg,
.aimanim = w_fists_aimanim,
.type = gunman_wpntype_close,
.hudpic = w_fists_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -42,6 +42,8 @@ enum
void
w_gausspistol_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_guasspistol.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(GP_DRAW);
@ -122,13 +124,20 @@ w_gausspistol_primary(void)
vector src;
int take = 1;
player pl = (player)self;
if (pl.menu_active > 0) {
pl.menu_active = 0;
pl.gflags |= GF_SEMI_TOGGLED;
pl.w_attack_next = 0.25f;
return;
}
if (pl.gflags & GF_SEMI_TOGGLED) {
return;
}
if (pl.a_ammo1 > 0) {
pl.a_ammo1 = 0;
if (pl.menu_active > 0) {
pl.menu_active = 0;
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
@ -210,7 +219,7 @@ w_gausspistol_secondary(void)
pl.gflags |= GF_SEMI_TOGGLED;
/* activate menu */
pl.a_ammo1 = 1;
pl.menu_active = 1;
w_gausspistol_release();
}
@ -282,7 +291,7 @@ w_gausspistol_hud(void)
HUD_DrawAmmo2();
/* menu */
if (pl.a_ammo1 > 0) {
if (pl.menu_active > 0) {
pos = g_hudmins + (g_hudres / 2) + [-96,-72];
/* far left */
@ -415,6 +424,7 @@ weapon_t w_gausspistol =
{
.name = "gausspistol",
.id = ITEM_GAUSSPISTOL,
.weight = WEIGHT_GAUSSPISTOL,
.slot = 1,
.slot_pos = 0,
.draw = w_gausspistol_draw,
@ -431,6 +441,7 @@ weapon_t w_gausspistol =
.pmodel = w_gausspistol_pmodel,
.deathmsg = w_gausspistol_deathmsg,
.aimanim = w_gausspistol_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_gausspistol_hudpic
};
@ -447,7 +458,7 @@ weapon_gausspistol(void)
int
w_gausspistol_hudforward(player pl)
{
if (pl.a_ammo1 <= 0) {
if (pl.menu_active <= 0) {
return (1);
}
@ -459,7 +470,7 @@ w_gausspistol_hudforward(player pl)
int
w_gausspistol_hudback(player pl)
{
if (pl.a_ammo1 <= 0) {
if (pl.menu_active <= 0) {
return (1);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -29,6 +29,8 @@ enum
void
w_grenade_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_grenade.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(GREN_DRAW);
@ -219,7 +221,8 @@ w_grenade_precache(void)
weapon_t w_grenade =
{
.name = "grenade",
.id = ITEM_GRENADE,
.id = ITEM_GRENADE,
.weight = WEIGHT_GRENADE,
.slot = 4,
.slot_pos = 0,
.draw = w_grenade_draw,
@ -236,6 +239,7 @@ weapon_t w_grenade =
.pmodel = w_grenade_pmodel,
.deathmsg = w_grenade_deathmsg,
.aimanim = w_grenade_aimanim,
.type = gunman_wpntype_throw,
.hudpic = w_grenade_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -30,6 +30,8 @@ enum
void
w_minigun_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_mechagun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(MG_DRAW);
@ -268,6 +270,7 @@ weapon_t w_minigun =
.pmodel = w_minigun_pmodel,
.deathmsg = w_minigun_deathmsg,
.aimanim = w_minigun_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_minigun_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -51,6 +51,8 @@ string gsmodes[] = {
void
w_shotgun_draw(void)
{
player pl = (player)self;
pl.menu_active = 0;
Weapons_SetModel("models/v_shotgun.mdl");
Weapons_SetGeomset("geomset 1 1\n");
Weapons_ViewAnimation(SHOTGUN_DRAW);
@ -271,8 +273,8 @@ w_shotgun_hud(void)
break;
}
shellstr = sprintf("SHELLS: %i", getstati(40));
spreadstr = sprintf("SPREAD: %s", gsmodes[getstati(41)]);
shellstr = sprintf("SHELLS: %i", pl.shotgun_shells);
spreadstr = sprintf("SPREAD: %s", gsmodes[pl.shotgun_spread]);
pos = g_hudmins + (g_hudres / 2) + [-48,-16];
drawfont = Font_GetID(FONT_20);
@ -345,6 +347,7 @@ weapon_t w_shotgun =
.pmodel = w_shotgun_pmodel,
.deathmsg = w_shotgun_deathmsg,
.aimanim = w_shotgun_aimanim,
.type = gunman_wpntype_ranged,
.hudpic = w_shotgun_hudpic
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -28,3 +28,33 @@ enum
WEAPON_GRENADE,
WEAPON_CHEMICALGUN
};
/* weight table... I just guessed this was a good compromise */
enum
{
WEIGHT_AICORE,
WEIGHT_NONE,
WEIGHT_FISTS,
WEIGHT_GRENADE,
WEIGHT_GAUSSPISTOL,
WEIGHT_DML,
WEIGHT_SHOTGUN,
WEIGHT_MINIGUN,
WEIGHT_BEAMGUN,
WEIGHT_CHEMICALGUN
};
weapontype_t gunman_wpntype_ranged(void)
{
return WPNTYPE_RANGED;
}
weapontype_t gunman_wpntype_close(void)
{
return WPNTYPE_CLOSE;
}
weapontype_t gunman_wpntype_throw(void)
{
return WPNTYPE_THROW;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above