Compare commits

...

5 commits

78 changed files with 1649 additions and 5252 deletions

View file

@ -1,44 +1,40 @@
# FreeHunger (AKA Still Hungry)
Clean-room reimplementation of They Hunger in QuakeC.
Clean-room reimplementation of They Hunger in entityDef / QuakeC.
![Preview 1](img/preview1.jpg)
![Preview 2](img/preview2.jpg)
![Preview 3](img/preview3.jpg)
![Preview 4](img/preview4.jpg)
## Building
Clone the repository into the Nuclide-SDK:
## Building / Installation
> git clone REPOURL hunger
then either run Nuclide's ./build_game.sh shell script, or issue 'make' inside
./hunger/src!
Obviously make sure that Nuclide has fteqw and fteqcc set-up for building.
Since this mod is entirely entityDef, no compiling is necessary! Just make sure
you have FreeHL installed, and place this content into your `hunger` folder.
## Status / Changes
So far all the weapons are re-implemented, but SP hasn't been worked on yet, so
no custom NPC skins or behavior.
So far all the weapons are re-implemented, and all custom NPCs are spawning.
Multiplayer is functional, and now has some unique CVARs to give it more of a
personality and make it fit in more with They Hunger's world:
Currently a decent amount of unique NPC behavior/effects are missing at the moment.
Some changes:
- Changed weapon placement for THDM
Included are .ent files that have changed the weapons placed in the default
DM maps for They Hunger. Replacing most Half-Life weapons with TH counter-parts.
- th_medkitstyle 0/1 (default 0)
All medkit pickups turn into the medkit weapon from SP, and each pickup is one
ammo (or shot) that needs to be administered for health.
- All medkit pickups turn into the medkit weapon in DM, and each pickup is one
ammo (or shot) that needs to be administered for health. Can be turned off in
`scripts/maptweaks.cfg`
- th_shovelstyle 0/1 (default 0)
Gives the shovel visual first person effects, and slows down its attack.
- Shovel has enhanced visual first person effects, and slowed down buff'd attack.
- th_rpgstyle 0/1 (default 0)
Removes the homing secondary toggle making it similar to a real RPG.
- Wrench has lower hit points and slightly new sounds.
You can enable these new CVARs with "exec mp_enhanced.cfg" in console.
- Recreated the cut Chainsaw weapon.
- Removes the homing secondary toggle for the RPG similar to the actual
historic weapon.
## Community
@ -56,9 +52,9 @@ We've had people ask in the oddest of places for help, please don't do that.
## License
ISC License
Copyright (c) 2016-2022 Marco Cawthorne <marco@icculus.org>
Copyright (c) 2016-2024 Marco Cawthorne <marco@icculus.org>
Copyright (c) 2019-2022 Gethyn ThomasQuail <xylemon@posteo.net>
Copyright (c) 2019-2024 Gethyn ThomasQuail <gethyn@vera-visions.com>
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,3 +0,0 @@
th_medkitstyle 1
serverinfo th_rpgstyle 1
serverinfo th_shovelstyle 1

View file

@ -1,5 +0,0 @@
CC=fteqcc
all:
cd client && $(MAKE)
cd server && $(MAKE)

View file

@ -1,4 +0,0 @@
CC=fteqcc
all:
$(CC) progs.src

View file

@ -1,137 +0,0 @@
#define AMMO_COUNT 17
string g_ammo_spr;
string g_item_spr;
typedef struct
{
float alpha;
int count;
} ammonote_t;
ammonote_t g_ammonotify[AMMO_COUNT];
vector g_ammotype[AMMO_COUNT] = {
[0/256, 72/128], // pistol
[24/256, 72/128], // revolver
[48/256, 72/128], // grenade
[72/256, 72/128], // shell
[96/256, 72/128], // arrow
[120/256, 72/128], // rocket
[0/256, 96/128], // uranium
[24/256, 96/128], // hornet
[48/256, 96/128], // grenade
[72/256, 96/128], // satchel
[96/256, 96/128], // snark
[120/256, 96/128], // tripmine
// Hunger
[0/256, 72/128], // ap9
[0/256, 72/128], // taurus
[24/256, 72/128], // sniper
[0/256, 96/128], // gas
[176/256, 48/256], // medkit
};
void
HUD_AmmoNotify_Init(void)
{
g_ammo_spr = spriteframe("sprites/640hud7.spr", 0, 0.0f);
}
void
HUD_AmmoNotify_Draw(__inout vector pos)
{
pos[0] = g_hudmins[0] + g_hudres[0] - 40;
for (int i = 0; i < AMMO_COUNT; i++) {
vector srcpos;
float a;
/* make sure we skip any faded entries, and also null them */
if (g_ammonotify[i].alpha <= 0.0f) {
g_ammonotify[i].count = 0;
continue;
}
/* let's get the src img pos for our type */
srcpos = g_ammotype[i];
a = bound(0, g_ammonotify[i].alpha, 1.0);
string spr;
vector scale;
vector sz;
if (i == 8)
sz = [16,24];
else
sz = [24,24];
if (i == 16)
scale = [44/256, 44/256];
else
scale = [24/256, 24/128];
if (i == 16)
spr = g_item_spr;
else
spr = g_ammo_spr;
/* we'll use the alpha to control the offset so it gently glides down when fading out */
pos -= [0, 32 * a]; /* go up a notch */
drawsubpic(pos,
sz,
spr,
srcpos,
scale,
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
drawfont = Font_GetID(FONT_20);
string txt = sprintf("%i", g_ammonotify[i].count);
float offs = stringwidth(txt, FALSE, [20,20]);
drawstring(pos + [-offs - 8,4], sprintf("%i", g_ammonotify[i].count), [20,20], g_hud_color, a, DRAWFLAG_ADDITIVE);
g_ammonotify[i].alpha -= (clframetime * 0.5);
}
}
void
HUD_AmmoNotify_Insert(int type, int count)
{
if (count <= 0)
return;
if (type == 7 && count < 8) // hornet hack!
return;
g_ammonotify[type].count += count;
g_ammonotify[type].alpha = 2.5f;
}
/* called whenever we should check for pickup updates */
void
HUD_AmmoNotify_Check(player pl)
{
HUD_AmmoNotify_Insert(0, pl.ammo_9mm - pl.ammo_9mm_net);
HUD_AmmoNotify_Insert(1, pl.ammo_357 - pl.ammo_357_net);
HUD_AmmoNotify_Insert(2, pl.ammo_m203_grenade - pl.ammo_m203_grenade_net);
HUD_AmmoNotify_Insert(3, pl.ammo_buckshot - pl.ammo_buckshot_net);
HUD_AmmoNotify_Insert(4, pl.ammo_bolt - pl.ammo_bolt_net);
HUD_AmmoNotify_Insert(5, pl.ammo_rocket - pl.ammo_rocket_net);
HUD_AmmoNotify_Insert(6, pl.ammo_uranium - pl.ammo_uranium_net);
HUD_AmmoNotify_Insert(7, pl.ammo_hornet - pl.ammo_hornet_net);
HUD_AmmoNotify_Insert(8, pl.ammo_handgrenade - pl.ammo_handgrenade_net);
HUD_AmmoNotify_Insert(9, pl.ammo_satchel - pl.ammo_satchel_net);
HUD_AmmoNotify_Insert(10, pl.ammo_snark - pl.ammo_snark_net);
HUD_AmmoNotify_Insert(11, pl.ammo_tripmine - pl.ammo_tripmine_net);
// Hunger
HUD_AmmoNotify_Insert(12, pl.ammo_ap9 - pl.ammo_ap9_net);
HUD_AmmoNotify_Insert(13, pl.ammo_taurus - pl.ammo_taurus_net);
HUD_AmmoNotify_Insert(14, pl.ammo_sniper - pl.ammo_sniper_net);
HUD_AmmoNotify_Insert(15, pl.ammo_gas - pl.ammo_gas_net);
HUD_AmmoNotify_Insert(16, pl.ammo_medkit - pl.ammo_medkit_net);
}

View file

@ -1,89 +0,0 @@
#define ITEM_COUNT 3
typedef struct
{
float alpha;
int count;
} itemnote_t;
itemnote_t g_itemnotify[ITEM_COUNT];
vector g_itemtype[ITEM_COUNT] = {
[176/256, 0/256], // battery
[176/256, 48/256], // medkit
[176/256, 96/256], // longjump
};
void
HUD_ItemNotify_Init(void)
{
g_item_spr = spriteframe("sprites/640hud2.spr", 0, 0.0f);
}
void
HUD_ItemNotify_Draw(__inout vector pos)
{
pos[0] = g_hudmins[0] + g_hudres[0] - 44;
for (int i = 0; i < ITEM_COUNT; i++) {
vector srcpos;
float a;
/* make sure we skip any faded entries, and also null them */
if (g_itemnotify[i].alpha <= 0.0f) {
g_itemnotify[i].count = 0;
continue;
}
/* let's get the src img pos for our type */
srcpos = g_itemtype[i];
a = bound(0, g_itemnotify[i].alpha, 1.0);
/* we'll use the alpha to control the offset so it gently glides down when fading out */
pos -= [0, 52 * a]; /* go up a notch */
drawsubpic(pos + [-20,0],
[44,44],
g_item_spr,
srcpos,
[44/256, 44/256],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
if (g_itemnotify[i].count > 1) {
drawfont = Font_GetID(FONT_20);
string txt = sprintf("%i", g_itemnotify[i].count);
float offs = stringwidth(txt, FALSE, [20,20]) + 16;
drawstring(pos + [-offs - 8,12], sprintf("%i", g_itemnotify[i].count), [20,20], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
g_itemnotify[i].alpha -= (clframetime * 0.5);
}
}
void
HUD_ItemNotify_Insert(int type, int count)
{
if (count <= 0)
return;
g_itemnotify[type].count += count;
g_itemnotify[type].alpha = 2.5f;
}
/* called whenever we should check for pickup updates */
void
HUD_ItemNotify_Check(player pl)
{
int healthdiff = bound(0, pl.health - pl.health_net, 100);
int armordiff = bound(0, pl.armor - pl.armor_net, 100);
int longjumpdiff = ((pl.g_items & ITEM_LONGJUMP) > (pl.g_items_net & ITEM_LONGJUMP)) == TRUE;
if (healthdiff > 1)
HUD_ItemNotify_Insert(1, 1);
if (armordiff > 1)
HUD_ItemNotify_Insert(0, 1);
if (longjumpdiff)
HUD_ItemNotify_Insert(2, 1);
}

View file

@ -1,66 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
float(entity foo, float chanid) getchannellevel = #0;
/*
=================
ClientGame_Init
Comparable to worldspawn in SSQC in that it's mostly used for precaches
=================
*/
void
ClientGame_Init(float apilevel, string enginename, float engineversion)
{
Obituary_Init();
}
void
ClientGame_InitDone(void)
{
}
void
ClientGame_RendererRestart(string rstr)
{
Obituary_Precache();
Damage_Precache();
FX_Blood_Init();
precache_model("sprites/640hud1.spr");
precache_model("sprites/640hud2.spr");
precache_model("sprites/640hud3.spr");
precache_model("sprites/640hud4.spr");
precache_model("sprites/640hud5.spr");
precache_model("sprites/640hud6.spr");
precache_model("sprites/tfchud01.spr");
precache_model("sprites/tfchud02.spr");
precache_model("sprites/tfchud03.spr");
precache_model("sprites/tfchud04.spr");
precache_model("sprites/tfchud05.spr");
precache_model("sprites/tfchud06.spr");
precache_model("sprites/tfc_dmsg.spr");
precache_model("sprites/nmxhair2.spr");
BEAM_TRIPMINE = particleeffectnum("weapon_tripmine.beam");
/* there's also muzzleflash.spr, but that's just MUZZLE_SMALL again */
MUZZLE_RIFLE = (int)getmodelindex("sprites/muzzleflash1.spr");
MUZZLE_SMALL = (int)getmodelindex("sprites/muzzleflash2.spr");
MUZZLE_WEIRD = (int)getmodelindex("sprites/muzzleflash3.spr");
}

View file

@ -1,43 +0,0 @@
#pragma target fte_5768
//#pragma flag enable assumeint
#pragma progs_dat "../../csprogs.dat"
#define CSQC
#define CLIENT
#define VALVE
#define HUNGER
#define CLASSIC_VGUI
#includelist
../../../src/shared/fteextensions.qc
../../../src/shared/defs.h
../../../valve/src/client/defs.h
../../../src/client/defs.h
../../../src/vgui/include.src
../../../src/gs-entbase/client.src
../../../src/gs-entbase/shared.src
../shared/include.src
../../../valve/src/client/damage.qc
../../../valve/src/client/draw.qc
init.qc
../../../valve/src/client/flashlight.qc
../../../valve/src/client/entities.qc
../../../valve/src/client/cmds.qc
../../../valve/src/client/game_event.qc
../../../valve/src/client/camera.qc
../../../valve/src/client/viewmodel.qc
../../../valve/src/client/obituary.qc
hud_ammonotify.qc
../../../valve/src/client/hud_dmgnotify.qc
hud_itemnotify.qc
../../../valve/src/client/hud_sprite.qc
../../../valve/src/client/hud.qc
../../../valve/src/client/hud_weaponselect.qc
../../../valve/src/client/scoreboard.qc
../../../src/client/include.src
../../../src/shared/include.src
#endlist

View file

@ -1,2 +0,0 @@
#pragma sourcefile client/progs.src
#pragma sourcefile server/progs.src

View file

@ -1,4 +0,0 @@
CC=fteqcc
all:
$(CC) progs.src

View file

@ -1,173 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2021 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED ammo_egonclip (0 0 0.8) (-16 -16 0) (16 16 32)
THEY HUNGER (1999) ENTITY
Ammo for the Flamethrower.
A single ammo_egonclip will provide 25, er, gas.
*/
class ammo_egonclip:item_ammo
{
void(void) ammo_egonclip;
virtual void(entity) Touch;
};
void
ammo_egonclip::ammo_egonclip(void)
{
model = "models/w_gas.mdl";
Sound_Precache("ammo_gas.pickup");
item_ammo::item_ammo();
}
void
ammo_egonclip::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
}
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_gas < MAX_A_GAS) {
pl.ammo_gas = bound(0, pl.ammo_gas + 25, MAX_A_GAS);
item_ammo::Touch(eToucher);
Sound_Play(other, CHAN_ITEM, "ammo_gas.pickup");
}
}
}
/*QUAKED ammo_th_ap9 (0 0 0.8) (-16 -16 0) (16 16 32)
THEY HUNGER (1999) ENTITY
Ammo for the AP9.
A single ammo_th_ap9 will provide 40 bullets.
*/
class ammo_th_ap9:item_ammo
{
void(void) ammo_th_ap9;
virtual void(entity) Touch;
};
void
ammo_th_ap9::ammo_th_ap9(void)
{
model = "models/w_ap9clip.mdl";
item_ammo::item_ammo();
}
void
ammo_th_ap9::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
}
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_ap9 < MAX_A_AP9) {
pl.ammo_ap9 = bound(0, pl.ammo_ap9 + 40, MAX_A_AP9);
item_ammo::Touch(eToucher);
}
}
}
/*QUAKED ammo_th_taurus (0 0 0.8) (-16 -16 0) (16 16 32)
THEY HUNGER (1999) ENTITY
Ammo for the Taurus Pistol.
A single ammo_th_taurus will provide 10 bullets.
*/
class ammo_th_taurus:item_ammo
{
void(void) ammo_th_taurus;
virtual void(entity) Touch;
};
void
ammo_th_taurus::ammo_th_taurus(void)
{
model = "models/w_taurusclip.mdl";
item_ammo::item_ammo();
}
void
ammo_th_taurus::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
}
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_taurus < MAX_A_TAURUS) {
pl.ammo_taurus = bound(0, pl.ammo_taurus + 10, MAX_A_TAURUS);
item_ammo::Touch(eToucher);
}
}
}
/*QUAKED ammo_einar1 (0 0 0.8) (-16 -16 0) (16 16 32)
THEY HUNGER (1999) ENTITY
Ammo for the Snipers.
A single ammo_th_sniper will provide 5 bullets.
Same as ammo_th_sniper
*/
/*QUAKED ammo_th_sniper (0 0 0.8) (-16 -16 0) (16 16 32)
THEY HUNGER (1999) ENTITY
Ammo for the Snipers.
A single ammo_th_sniper will provide 5 bullets.
Same as ammo_einar1
*/
class ammo_th_sniper:item_ammo
{
void(void) ammo_th_sniper;
virtual void(entity) Touch;
};
void
ammo_th_sniper::ammo_th_sniper(void)
{
model = "models/w_antidote.mdl";
item_ammo::item_ammo();
}
void
ammo_th_sniper::Touch(entity eToucher)
{
if not (other.flags & FL_CLIENT) {
return;
}
if (other.classname == "player") {
player pl = (player)other;
if (pl.ammo_sniper < MAX_A_SNIPER) {
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
item_ammo::Touch(eToucher);
}
}
}
CLASSEXPORT(ammo_einar1, ammo_th_sniper)

View file

@ -1,170 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
var int autocvar_th_medkitstyle = 0;
var int autocvar_th_shovelstyle = 0;
var int autocvar_th_rpgstyle = 0;
void
HLGameRules::LevelDecodeParms(NSClientPlayer pp)
{
player pl = (player)pp;
g_landmarkpos[0] = parm1;
g_landmarkpos[1] = parm2;
g_landmarkpos[2] = parm3;
pl.angles[0] = parm4;
pl.angles[1] = parm5;
pl.angles[2] = parm6;
pl.velocity[0] = parm7;
pl.velocity[1] = parm8;
pl.velocity[2] = parm9;
pl.g_items = parm10;
pl.activeweapon = parm11;
pl.flags = parm64;
pl.ammo_9mm = parm12;
pl.ammo_357 = parm13;
pl.ammo_buckshot = parm14;
pl.ammo_m203_grenade = parm15;
pl.ammo_bolt = parm16;
pl.ammo_rocket = parm17;
pl.ammo_uranium = parm18;
pl.ammo_handgrenade = parm19;
pl.ammo_satchel = parm20;
pl.ammo_tripmine = parm21;
pl.ammo_snark = parm22;
pl.ammo_hornet = parm23;
pl.glock_mag = parm24;
pl.mp5_mag = parm25;
pl.python_mag = parm26;
pl.shotgun_mag = parm27;
pl.crossbow_mag = parm28;
pl.rpg_mag = parm29;
pl.satchel_chg = parm30;
if (pl.flags & FL_CROUCHING) {
setsize(pl, PHY_HULL_CROUCHED_MIN, PHY_HULL_CROUCHED_MAX);
} else {
setsize(pl, PHY_HULL_MIN, PHY_HULL_MAX);
}
}
void
HLGameRules::LevelChangeParms(NSClientPlayer pp)
{
player pl = (player)pp;
parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1];
parm3 = g_landmarkpos[2];
parm4 = pl.angles[0];
parm5 = pl.angles[1];
parm6 = pl.angles[2];
parm7 = pl.velocity[0];
parm8 = pl.velocity[1];
parm9 = pl.velocity[2];
parm64 = pl.flags;
parm10 = pl.g_items;
parm11 = pl.activeweapon;
parm12 = pl.ammo_9mm;
parm13 = pl.ammo_357;
parm14 = pl.ammo_buckshot;
parm15 = pl.ammo_m203_grenade;
parm16 = pl.ammo_bolt;
parm17 = pl.ammo_rocket;
parm18 = pl.ammo_uranium;
parm19 = pl.ammo_handgrenade;
parm20 = pl.ammo_satchel;
parm21 = pl.ammo_tripmine;
parm22 = pl.ammo_snark;
parm23 = pl.ammo_hornet;
parm24 = pl.glock_mag;
parm25 = pl.mp5_mag;
parm26 = pl.python_mag;
parm27 = pl.shotgun_mag;
parm28 = pl.crossbow_mag;
parm29 = pl.rpg_mag;
parm30 = pl.satchel_chg;
}
void
HLGameRules::LevelNewParms(void)
{
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
parm29 = parm30 = 0;
parm64 = FL_CLIENT;
}
/* we check what fields have changed over the course of the frame and network
* only the ones that have actually changed */
void
HLGameRules::PlayerPostFrame(NSClientPlayer pl)
{
}
void
HLGameRules::PlayerConnect(NSClientPlayer pl)
{
if (Plugin_PlayerConnect(pl) == FALSE)
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
}
void
HLGameRules::PlayerDisconnect(NSClientPlayer pl)
{
if (Plugin_PlayerDisconnect(pl) == FALSE)
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
/* Make this unusable */
pl.solid = SOLID_NOT;
pl.movetype = MOVETYPE_NONE;
pl.modelindex = 0;
pl.health = 0;
pl.takedamage = 0;
pl.SendFlags = -1;
}
void
HLGameRules::PlayerKill(NSClientPlayer pl)
{
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
}
void
TriggerFlashlight(NSClient target)
{
entity oldself = self;
self = target;
Flashlight_Toggle();
self = oldself;
}
bool
HLGameRules::ImpulseCommand(NSClient bp, float num)
{
switch (num) {
case 100:
TriggerFlashlight(bp);
break;
default:
return super::ImpulseCommand(bp, num);
}
return true;
}

View file

@ -1,150 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
bool
HLSingleplayerRules::IsMultiplayer(void)
{
return false;
}
void
HLSingleplayerRules::PlayerDeath(NSClientPlayer pl)
{
pl.movetype = MOVETYPE_NONE;
pl.solid = SOLID_NOT;
pl.takedamage = DAMAGE_NO;
pl.gflags &= ~GF_FLASHLIGHT;
pl.armor = pl.activeweapon = pl.g_items = pl.weapon = 0;
pl.health = 0;
Sound_Play(pl, CHAN_AUTO, "player.die");
if (cvar("coop") == 1) {
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
}
if (pl.health < -50) {
vector gibDir = vectoangles(pl.origin - g_dmg_eAttacker.origin);
float gibStrength = g_dmg_iDamage * 2.0f;
BreakModel_Entity(pl, gibDir, gibStrength);
}
/* Let's handle corpses on the clientside */
entity corpse = spawn();
setorigin(corpse, pl.origin + [0,0,32]);
setmodel(corpse, pl.model);
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
corpse.movetype = MOVETYPE_TOSS;
corpse.solid = SOLID_TRIGGER;
corpse.modelindex = pl.modelindex;
corpse.frame = ANIM_DIESIMPLE;
corpse.angles = pl.angles;
corpse.velocity = pl.velocity;
}
void
HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
{
pl.classname = "player";
pl.health = pl.max_health = 100;
pl.takedamage = DAMAGE_YES;
pl.SetSolid(SOLID_SLIDEBOX);
pl.SetMovetype(MOVETYPE_WALK);
pl.flags = FL_CLIENT;
pl.viewzoom = 1.0;
pl.model = "models/player.mdl";
if (cvar("coop") == 1) {
string mymodel = infokey(pl, "model");
if (mymodel) {
mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel);
if (whichpack(mymodel)) {
pl.model = mymodel;
}
}
}
setmodel(pl, pl.model);
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
pl.ClearVelocity();
pl.gravity = __NULL__;
pl.SetFrame(1);
pl.SendFlags = UPDATE_ALL;
pl.SetInfoKey("*spec", "0");
pl.SetInfoKey("*dead", "0");
pl.SetInfoKey("*deaths", ftos(pl.deaths));
pl.SetPropData("actor_human");
pl.SetCanBleed(true);
/* this is where the mods want to deviate */
entity spot;
if (startspot != "") {
dprint(sprintf("^3Gamerules_Spawn^7: Startspot is %s\n", startspot));
LevelDecodeParms(pl);
setorigin(pl, Landmark_GetSpot());
} else {
LevelNewParms();
spot = find(world, ::classname, "info_player_start");
setorigin(pl, spot.origin);
pl.angles = spot.angles;
}
Weapons_RefreshAmmo(pl);
Client_FixAngle(pl, pl.angles);
}
bool
HLSingleplayerRules::ImpulseCommand(NSClient bp, float num)
{
switch (num) {
case 101:
player pl = (player)bp;
pl.health = 100;
pl.armor = 100;
pl.g_items |= ITEM_SUIT;
Weapons_AddItem(pl, WEAPON_CROWBAR, -1);
Weapons_AddItem(pl, WEAPON_SHOVEL, -1);
Weapons_AddItem(pl, WEAPON_SPANNER, -1);
Weapons_AddItem(pl, WEAPON_GLOCK, -1);
Weapons_AddItem(pl, WEAPON_PYTHON, -1);
Weapons_AddItem(pl, WEAPON_AP9, -1);
Weapons_AddItem(pl, WEAPON_TAURUS, -1);
Weapons_AddItem(pl, WEAPON_MP5, -1);
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
Weapons_AddItem(pl, WEAPON_CROSSBOW, -1);
Weapons_AddItem(pl, WEAPON_SNIPER, -1);
Weapons_AddItem(pl, WEAPON_SNIPER2, -1);
Weapons_AddItem(pl, WEAPON_RPG, -1);
Weapons_AddItem(pl, WEAPON_GAUSS, -1);
Weapons_AddItem(pl, WEAPON_EGON, -1);
Weapons_AddItem(pl, WEAPON_CHAINGUN, -1);
Weapons_AddItem(pl, WEAPON_HANDGRENADE, -1);
Weapons_AddItem(pl, WEAPON_SATCHEL, -1);
Weapons_AddItem(pl, WEAPON_TRIPMINE, -1);
Weapons_AddItem(pl, WEAPON_SNARK, -1);
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
break;
default:
return super::ImpulseCommand(bp, num);
}
return true;
}

View file

@ -1,107 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2021 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED item_healthkit (0 0 0.8) (-16 -16 0) (16 16 36)
THEY HUNGER (1999) ENTITY
Healthkit item/ammo.
Adds 20 of health to the player, unless th_medkitstyle is set to 1,
then it becomes ammo for the Medkit weapon which provides 15 health
per shot.
*/
class item_healthkit:NSRenderableEntity
{
void(void) item_healthkit;
virtual void(void) Respawn;
virtual void(entity) Touch;
};
void
item_healthkit::Touch(entity eToucher)
{
if (other.classname != "player") {
return;
}
if (cvar("th_medkitstyle") == 1) {
player pl = (player)other;
/* If pl does not have WEAPON_MEDKIT, give it to them */
if (!Weapons_IsPresent(pl, WEAPON_MEDKIT)) {
Sound_Play(other, CHAN_ITEM, "weapon.pickup");
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
} else {
/* don't remove item if we're already fully */
if (pl.ammo_medkit >= MAX_A_MEDKIT)
return;
/* otherwise, just give us ammo */
pl.ammo_medkit = bound(0, pl.ammo_medkit + 1, MAX_A_MEDKIT);
Sound_Play(other, CHAN_ITEM, "ammo.pickup");
Weapons_RefreshAmmo(pl);
Logging_Pickup(other, this, __NULL__);
}
} else {
if (other.health >= other.max_health) {
return;
}
Damage_Apply(other, this, -20, 0, DMG_GENERIC);
Sound_Play(this, CHAN_ITEM, "item.healthkit");
Logging_Pickup(other, this, __NULL__);
}
if (real_owner || cvar("sv_playerslots") == 1) {
remove(self);
} else {
Disappear();
think = Respawn;
nextthink = time + 20.0f;
}
}
void
item_healthkit::Respawn(void)
{
SetSolid(SOLID_TRIGGER);
SetMovetype(MOVETYPE_TOSS);
SetOrigin(GetSpawnOrigin());
SetModel(GetSpawnModel());
SetSize([-16,-16,0],[16,16,16]);
//botinfo = BOTINFO_HEALTH;
think = __NULL__;
nextthink = -1;
if (!real_owner)
Sound_Play(this, CHAN_ITEM, "item.respawn");
DropToFloor();
}
void
item_healthkit::item_healthkit(void)
{
Sound_Precache("ammo.pickup");
Sound_Precache("item.healthkit");
Sound_Precache("item.respawn");
Sound_Precache("weapon.pickup");
model = "models/w_medkit.mdl";
super::NSRenderableEntity();
}

View file

@ -1,52 +0,0 @@
#pragma target fte_5768
//#pragma flag enable assumeint
#pragma progs_dat "../../progs.dat"
#define QWSSQC
#define SERVER
#define VALVE
#define HUNGER
#includelist
../../../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
../../../valve/src/server/defs.h
../shared/include.src
../../../valve/src/server/player.qc
../../../valve/src/server/items.qc
../../../valve/src/server/item_longjump.qc
../../../valve/src/server/item_suit.qc
item_healthkit.qc
../../../valve/src/server/item_battery.qc
../../../valve/src/server/item_weaponbox.qc
../../../valve/src/server/world_items.qc
../../../valve/src/server/xen_spore_small.qc
../../../valve/src/server/xen_spore_medium.qc
../../../valve/src/server/xen_spore_large.qc
../../../valve/src/server/xen_hair.qc
../../../valve/src/server/xen_plantlight.qc
../../../valve/src/server/ammo.qc
ammo_th.qc
../../../src/botlib/include.src
../../../valve/src/server/gamerules.qc
gamerules_singleplayer.qc
../../../valve/src/server/gamerules_multiplayer.qc
../../../valve/src/server/server.qc
../../../valve/src/server/damage.qc
../../../valve/src/server/flashlight.qc
../../../valve/src/server/modelevent.qc
../../../valve/src/server/spawn.qc
../../../src/server/include.src
../../../src/shared/include.src
#endlist

View file

@ -1,44 +0,0 @@
#includelist
../../../valve/src/shared/entities.h
../../../valve/src/shared/events.h
../../../valve/src/shared/flags.h
player.qc
../../../valve/src/shared/weapon_common.h
../../../valve/src/shared/animations.h
../../../valve/src/shared/animations.qc
../../../valve/src/shared/pmove.qc
../../../valve/src/shared/fx_blood.qc
../../../valve/src/shared/fx_gaussbeam.qc
../../../valve/src/shared/fx_corpse.qc
items.h
weapons.h
../../../valve/src/shared/w_crossbow.qc
../../../valve/src/shared/w_crowbar.qc
../../../valve/src/shared/w_egon.qc
../../../valve/src/shared/w_gauss.qc
../../../valve/src/shared/w_glock.qc
../../../valve/src/shared/w_handgrenade.qc
../../../valve/src/shared/w_mp5.qc
../../../valve/src/shared/w_python.qc
../../../valve/src/shared/w_rpg.qc
../../../valve/src/shared/w_satchel.qc
../../../valve/src/shared/w_shotgun.qc
../../../valve/src/shared/w_snark.qc
../../../valve/src/shared/w_tripmine.qc
w_ap9.qc
w_chaingun.qc
w_flame.qc
w_silencer.qc
w_medkit.qc
w_rpg.qc
w_shovel.qc
w_sniper.qc
w_sniper2.qc
w_spanner.qc
w_taurus.qc
w_tnt.qc
weapons.qc
../../../valve/src/shared/weapon_common.qc
#endlist

View file

@ -1,51 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define ITEM_CROWBAR 0x00000001
#define ITEM_GLOCK 0x00000002
#define ITEM_PYTHON 0x00000004
#define ITEM_MP5 0x00000008
#define ITEM_CROSSBOW 0x00000010
#define ITEM_SHOTGUN 0x00000020
#define ITEM_RPG 0x00000040
#define ITEM_GAUSS 0x00000080
#define ITEM_EGON 0x00000100
#define ITEM_CHAINGUN 0x00000200
#define ITEM_HANDGRENADE 0x00000400
#define ITEM_TRIPMINE 0x00000800
#define ITEM_SATCHEL 0x00001000
#define ITEM_SNARK 0x00002000
#define ITEM_SUIT 0x00004000
#define ITEM_LONGJUMP 0x00008000
#define ITEM_SHOVEL 0x00010000
#define ITEM_SPANNER 0x00020000
#define ITEM_AP9 0x00040000
#define ITEM_TAURUS 0x00080000
#define ITEM_SNIPER 0x00100000
#define ITEM_SNIPER2 0x00200000
#define ITEM_MEDKIT2 0x00400000
#define ITEM_UNUSED24 0x00800000
#define ITEM_UNUSED25 0x01000000
#define ITEM_UNUSED26 0x02000000
#define ITEM_UNUSED27 0x04000000
#define ITEM_UNUSED28 0x08000000
#define ITEM_UNUSED29 0x10000000
#define ITEM_UNUSED30 0x20000000
#define ITEM_UNUSED31 0x40000000
#define ITEM_UNUSED32 0x80000000

View file

@ -1,632 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../valve/src/shared/skeleton.h"
/* all potential SendFlags bits we can possibly send */
enumflags
{
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
PLAYER_BOTTOMFRAME,
PLAYER_AMMO1,
PLAYER_AMMO2,
PLAYER_AMMO3,
PLAYER_UNUSED5,
PLAYER_UNUSED6,
PLAYER_UNUSED7
};
class player:NSClientPlayer
{
/* animation */
PREDICTED_INT(anim_top)
PREDICTED_FLOAT(anim_top_time)
PREDICTED_FLOAT(anim_top_delay)
PREDICTED_INT(anim_bottom)
PREDICTED_FLOAT(anim_bottom_time)
/* ammo 1 */
PREDICTED_INT(glock_mag)
PREDICTED_INT(mp5_mag)
PREDICTED_INT(python_mag)
PREDICTED_INT(shotgun_mag)
PREDICTED_INT(crossbow_mag)
PREDICTED_INT(rpg_mag)
PREDICTED_INT(satchel_chg)
/* ammo 2 */
PREDICTED_INT(ammo_9mm)
PREDICTED_INT(ammo_357)
PREDICTED_INT(ammo_buckshot)
PREDICTED_INT(ammo_bolt)
PREDICTED_INT(ammo_rocket)
PREDICTED_INT(ammo_uranium)
PREDICTED_INT(ammo_handgrenade)
PREDICTED_INT(ammo_satchel)
PREDICTED_INT(ammo_tripmine)
PREDICTED_INT(ammo_snark)
PREDICTED_INT(ammo_hornet)
/* ammo 3 */
PREDICTED_INT(ammo_m203_grenade)
PREDICTED_INT(ammo_gauss_volume)
PREDICTED_INT(ammo_rpg_state)
PREDICTED_INT(mode_tempstate)
/* hunger */
PREDICTED_INT(sniper_mag)
PREDICTED_INT(chaingun_mag)
PREDICTED_INT(ap9_mag)
PREDICTED_INT(taurus_mag)
PREDICTED_INT(ammo_ap9)
PREDICTED_INT(ammo_taurus)
PREDICTED_INT(ammo_sniper)
PREDICTED_INT(ammo_gas)
PREDICTED_INT(ammo_medkit)
PREDICTED_INT(mode_silencer)
virtual void UpdatePlayerAnimation(float);
#ifdef CLIENT
virtual void UpdatePlayerAttachments(bool);
virtual void ReceiveEntity(float,float);
virtual void PredictPreFrame(void);
virtual void PredictPostFrame(void);
virtual void UpdateAliveCam(void);
#else
virtual void(void) EvaluateEntity;
virtual float(entity, float) SendEntity;
#endif
};
void Animation_PlayerUpdate(player);
void Animation_TimerUpdate(player, float);
void
player::UpdatePlayerAnimation(float timelength)
{
/* calculate our skeletal progression */
Animation_PlayerUpdate(this);
/* advance animation timers */
Animation_TimerUpdate(this, timelength);
}
#ifdef CLIENT
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
void Camera_StrafeRoll(__inout vector camera_angle);
void Shake_Update(NSClientPlayer);
void
player::UpdateAliveCam(void)
{
vector cam_pos = GetEyePos();
Camera_RunPosBob(view_angles, cam_pos);
g_view.SetCameraOrigin(cam_pos);
Camera_StrafeRoll(view_angles);
g_view.SetCameraAngle(view_angles);
if (vehicle) {
NSVehicle veh = (NSVehicle)vehicle;
if (veh.UpdateView)
veh.UpdateView();
} else if (health) {
if (autocvar_pm_thirdPerson == TRUE) {
makevectors(view_angles);
vector vStart = [pSeat->m_vecPredictedOrigin[0], pSeat->m_vecPredictedOrigin[1], pSeat->m_vecPredictedOrigin[2] + 16] + (v_right * 4);
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
traceline(vStart, vEnd, FALSE, this);
g_view.SetCameraOrigin(trace_endpos + (v_forward * 5));
}
}
Shake_Update(this);
g_view.AddPunchAngle(punchangle);
}
.string oldmodel;
string Weapons_GetPlayermodel(player, int);
void
player::UpdatePlayerAttachments(bool visible)
{
/* draw the flashlight */
if (gflags & GF_FLASHLIGHT) {
vector src;
vector ang;
if (entnum != player_localentnum) {
src = origin + view_ofs;
ang = v_angle;
} else {
src = pSeat->m_vecPredictedOrigin + view_ofs;
ang = view_angles;
}
makevectors(ang);
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
dynamiclight_add(trace_endpos + (trace_plane_normal * 4), 128, [1,1,1]);
} else {
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
dynamiclight_set(p, LFIELD_ANGLES, ang);
dynamiclight_set(p, LFIELD_FLAGS, 3);
}
}
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
if (!visible)
return;
/* what's the current weapon model supposed to be anyway? */
p_model.oldmodel = Weapons_GetPlayermodel(this, activeweapon);
/* we changed weapons, update skeletonindex */
if (p_model.model != p_model.oldmodel) {
/* free memory */
if (p_model.skeletonindex)
skel_delete(p_model.skeletonindex);
/* set the new model and mark us updated */
setmodel(p_model, p_model.oldmodel);
p_model.model = p_model.oldmodel;
/* set the new skeletonindex */
p_model.skeletonindex = skel_create(p_model.modelindex);
/* hack this thing in here FIXME: this should be done when popping in/out of a pvs */
if (autocvar(cl_himodels, 1, "Use high-quality thisayer models over lower-definition ones"))
setcustomskin(this, "", "geomset 0 2\n");
else
setcustomskin(this, "", "geomset 0 1\n");
}
/* follow thisayer at all times */
setorigin(p_model, origin);
p_model.angles = angles;
skel_build(p_model.skeletonindex, p_model, p_model.modelindex,0, 0, -1);
/* we have to loop through all valid bones of the weapon model and match them
* to the thisayer one */
for (float i = 0; i < g_pbones.length; i++) {
vector bpos;
float pbone = gettagindex(this, g_pbones[i]);
float wbone = gettagindex(p_model, g_pbones[i]);
/* if the bone doesn't ignore in either skeletal mesh, ignore */
if (wbone <= 0 || pbone <= 0)
continue;
bpos = gettaginfo(this, pbone);
/* the most expensive bit */
skel_set_bone_world(p_model, wbone, bpos, v_forward, v_right, v_up);
}
}
void Weapons_AmmoUpdate(entity);
void HUD_AmmoNotify_Check(player pl);
void HUD_ItemNotify_Check(player pl);
/*
=================
player::ReceiveEntity
=================
*/
void
player::ReceiveEntity(float new, float fl)
{
NSClientPlayer::ReceiveEntity(new, fl);
/* animation */
if (fl & PLAYER_TOPFRAME) {
anim_top = readbyte();
anim_top_time = readfloat();
anim_top_delay = readfloat();
}
if (fl & PLAYER_BOTTOMFRAME) {
anim_bottom = readbyte();
anim_bottom_time = readfloat();
}
if (fl & PLAYER_AMMO1) {
glock_mag = readbyte();
mp5_mag = readbyte();
python_mag = readbyte();
shotgun_mag = readbyte();
crossbow_mag = readbyte();
rpg_mag = readbyte();
satchel_chg = readbyte();
/* hunger */
sniper_mag = readbyte();
chaingun_mag = readbyte();
ap9_mag = readbyte();
taurus_mag = readbyte();
}
if (fl & PLAYER_AMMO2) {
ammo_9mm = readbyte();
ammo_357 = readbyte();
ammo_buckshot = readbyte();
ammo_bolt = readbyte();
ammo_rocket = readbyte();
ammo_uranium = readbyte();
ammo_handgrenade = readbyte();
ammo_satchel = readbyte();
ammo_tripmine = readbyte();
ammo_snark = readbyte();
ammo_hornet = readbyte();
/* hunger */
ammo_ap9 = readbyte();
ammo_taurus = readbyte();
ammo_sniper = readbyte();
ammo_gas = readbyte();
ammo_medkit = readbyte();
}
if (fl & PLAYER_AMMO3) {
ammo_m203_grenade = readbyte();
ammo_gauss_volume = readbyte();
ammo_rpg_state = readbyte();
mode_tempstate = readbyte();
mode_silencer = readbyte();
}
setorigin(this, origin);
/* these only concern the current player */
CSQC_UpdateSeat();
if (this != pSeat->m_ePlayer)
return;
/* do not notify us of updates when spawning initially */
if (fl == UPDATE_ALL)
PredictPreFrame();
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3) {
Weapons_AmmoUpdate(this);
HUD_AmmoNotify_Check(this);
}
if (fl & PLAYER_ITEMS || fl & PLAYER_HEALTH)
HUD_ItemNotify_Check(this);
}
/*
=================
player::PredictPostFrame
Save the last valid server values away in the _net variants of each field
so we can roll them back later.
=================
*/
void
player::PredictPreFrame(void)
{
NSClientPlayer::PredictPreFrame();
SAVE_STATE(anim_top);
SAVE_STATE(anim_top_delay);
SAVE_STATE(anim_top_time);
SAVE_STATE(anim_bottom);
SAVE_STATE(anim_bottom_time);
SAVE_STATE(glock_mag);
SAVE_STATE(mp5_mag);
SAVE_STATE(python_mag);
SAVE_STATE(shotgun_mag);
SAVE_STATE(crossbow_mag);
SAVE_STATE(rpg_mag);
SAVE_STATE(satchel_chg);
SAVE_STATE(ammo_9mm);
SAVE_STATE(ammo_357);
SAVE_STATE(ammo_buckshot);
SAVE_STATE(ammo_bolt);
SAVE_STATE(ammo_rocket);
SAVE_STATE(ammo_uranium);
SAVE_STATE(ammo_handgrenade);
SAVE_STATE(ammo_satchel);
SAVE_STATE(ammo_tripmine);
SAVE_STATE(ammo_snark);
SAVE_STATE(ammo_hornet);
SAVE_STATE(ammo_m203_grenade);
SAVE_STATE(ammo_gauss_volume);
SAVE_STATE(ammo_rpg_state);
SAVE_STATE(mode_tempstate);
/* hunger */
SAVE_STATE(sniper_mag);
SAVE_STATE(chaingun_mag);
SAVE_STATE(ap9_mag);
SAVE_STATE(taurus_mag);
SAVE_STATE(ammo_ap9);
SAVE_STATE(ammo_taurus);
SAVE_STATE(ammo_sniper);
SAVE_STATE(ammo_gas);
SAVE_STATE(ammo_medkit);
SAVE_STATE(mode_silencer);
}
/*
=================
player::PredictPostFrame
Where we roll back our values to the ones last sent/verified by the server.
=================
*/
void
player::PredictPostFrame(void)
{
NSClientPlayer::PredictPostFrame();
ROLL_BACK(anim_top);
ROLL_BACK(anim_top_delay);
ROLL_BACK(anim_top_time);
ROLL_BACK(anim_bottom);
ROLL_BACK(anim_bottom_time);
ROLL_BACK(glock_mag);
ROLL_BACK(mp5_mag);
ROLL_BACK(python_mag);
ROLL_BACK(shotgun_mag);
ROLL_BACK(crossbow_mag);
ROLL_BACK(rpg_mag);
ROLL_BACK(satchel_chg);
ROLL_BACK(ammo_9mm);
ROLL_BACK(ammo_357);
ROLL_BACK(ammo_buckshot);
ROLL_BACK(ammo_m203_grenade);
ROLL_BACK(ammo_bolt);
ROLL_BACK(ammo_rocket);
ROLL_BACK(ammo_uranium);
ROLL_BACK(ammo_handgrenade);
ROLL_BACK(ammo_satchel);
ROLL_BACK(ammo_tripmine);
ROLL_BACK(ammo_snark);
ROLL_BACK(ammo_hornet);
ROLL_BACK(ammo_m203_grenade);
ROLL_BACK(ammo_gauss_volume);
ROLL_BACK(ammo_rpg_state);
ROLL_BACK(mode_tempstate);
/* hunger */
ROLL_BACK(sniper_mag);
ROLL_BACK(chaingun_mag);
ROLL_BACK(ap9_mag);
ROLL_BACK(taurus_mag);
ROLL_BACK(ammo_ap9);
ROLL_BACK(ammo_taurus);
ROLL_BACK(ammo_sniper);
ROLL_BACK(ammo_gas);
ROLL_BACK(ammo_medkit);
ROLL_BACK(mode_silencer);
}
#else
void
player::EvaluateEntity(void)
{
NSClientPlayer::EvaluateEntity();
/* animation */
if (ATTR_CHANGED(anim_bottom) || ATTR_CHANGED(anim_bottom_time))
SendFlags |= PLAYER_BOTTOMFRAME;
if (ATTR_CHANGED(anim_top) || ATTR_CHANGED(anim_top_time) || ATTR_CHANGED(anim_top_delay))
SendFlags |= PLAYER_TOPFRAME;
/* ammo 1 type updates */
if (ATTR_CHANGED(glock_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(mp5_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(python_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(shotgun_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(crossbow_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(rpg_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(satchel_chg))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(sniper_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(chaingun_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(ap9_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(taurus_mag))
SendFlags |= PLAYER_AMMO1;
/* ammo 2 type updates */
if (ATTR_CHANGED(ammo_9mm))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_357))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_buckshot))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_bolt))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_rocket))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_uranium))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_handgrenade))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_satchel))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_tripmine))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_snark))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_hornet))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_ap9))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_taurus))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_sniper))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_gas))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_medkit))
SendFlags |= PLAYER_AMMO2;
if (ATTR_CHANGED(ammo_m203_grenade))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_gauss_volume))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_rpg_state))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(mode_tempstate))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(mode_silencer)) /* hunger */
SendFlags |= PLAYER_AMMO3;
SAVE_STATE(anim_top);
SAVE_STATE(anim_top_delay);
SAVE_STATE(anim_top_time);
SAVE_STATE(anim_bottom);
SAVE_STATE(anim_bottom_time);
SAVE_STATE(glock_mag);
SAVE_STATE(mp5_mag);
SAVE_STATE(python_mag);
SAVE_STATE(shotgun_mag);
SAVE_STATE(crossbow_mag);
SAVE_STATE(rpg_mag);
SAVE_STATE(satchel_chg);
SAVE_STATE(ammo_9mm);
SAVE_STATE(ammo_357);
SAVE_STATE(ammo_buckshot);
SAVE_STATE(ammo_bolt);
SAVE_STATE(ammo_rocket);
SAVE_STATE(ammo_uranium);
SAVE_STATE(ammo_handgrenade);
SAVE_STATE(ammo_satchel);
SAVE_STATE(ammo_tripmine);
SAVE_STATE(ammo_snark);
SAVE_STATE(ammo_hornet);
SAVE_STATE(ammo_m203_grenade);
SAVE_STATE(ammo_gauss_volume);
SAVE_STATE(ammo_rpg_state);
SAVE_STATE(mode_tempstate);
/* hunger */
SAVE_STATE(sniper_mag);
SAVE_STATE(chaingun_mag);
SAVE_STATE(ap9_mag);
SAVE_STATE(taurus_mag);
SAVE_STATE(ammo_ap9);
SAVE_STATE(ammo_taurus);
SAVE_STATE(ammo_sniper);
SAVE_STATE(ammo_gas);
SAVE_STATE(ammo_medkit);
SAVE_STATE(mode_silencer);
}
/*
=================
player::SendEntity
=================
*/
float
player::SendEntity(entity ePEnt, float flChanged)
{
/* don't broadcast invisible players */
if (IsFakeSpectator() && ePEnt != this)
return (0);
if (!GetModelindex() && ePEnt != this)
return (0);
flChanged = OptimiseChangedFlags(ePEnt, flChanged);
WriteByte(MSG_ENTITY, ENT_PLAYER);
WriteFloat(MSG_ENTITY, flChanged);
NSClientPlayer::SendEntity(ePEnt, flChanged);
if (flChanged & PLAYER_TOPFRAME) {
WriteByte(MSG_ENTITY, anim_top);
WriteFloat(MSG_ENTITY, anim_top_time);
WriteFloat(MSG_ENTITY, anim_top_delay);
}
if (flChanged & PLAYER_BOTTOMFRAME) {
WriteByte(MSG_ENTITY, anim_bottom);
WriteFloat(MSG_ENTITY, anim_bottom_time);
}
if (flChanged & PLAYER_AMMO1) {
WriteByte(MSG_ENTITY, glock_mag);
WriteByte(MSG_ENTITY, mp5_mag);
WriteByte(MSG_ENTITY, python_mag);
WriteByte(MSG_ENTITY, shotgun_mag);
WriteByte(MSG_ENTITY, crossbow_mag);
WriteByte(MSG_ENTITY, rpg_mag);
WriteByte(MSG_ENTITY, satchel_chg);
/* hunger */
WriteByte(MSG_ENTITY, sniper_mag);
WriteByte(MSG_ENTITY, chaingun_mag);
WriteByte(MSG_ENTITY, ap9_mag);
WriteByte(MSG_ENTITY, taurus_mag);
}
if (flChanged & PLAYER_AMMO2) {
WriteByte(MSG_ENTITY, ammo_9mm);
WriteByte(MSG_ENTITY, ammo_357);
WriteByte(MSG_ENTITY, ammo_buckshot);
WriteByte(MSG_ENTITY, ammo_bolt);
WriteByte(MSG_ENTITY, ammo_rocket);
WriteByte(MSG_ENTITY, ammo_uranium);
WriteByte(MSG_ENTITY, ammo_handgrenade);
WriteByte(MSG_ENTITY, ammo_satchel);
WriteByte(MSG_ENTITY, ammo_tripmine);
WriteByte(MSG_ENTITY, ammo_snark);
WriteByte(MSG_ENTITY, ammo_hornet);
/* hunger */
WriteByte(MSG_ENTITY, ammo_ap9);
WriteByte(MSG_ENTITY, ammo_taurus);
WriteByte(MSG_ENTITY, ammo_sniper);
WriteByte(MSG_ENTITY, ammo_gas);
WriteByte(MSG_ENTITY, ammo_medkit);
}
if (flChanged & PLAYER_AMMO3) {
WriteByte(MSG_ENTITY, ammo_m203_grenade);
WriteByte(MSG_ENTITY, ammo_gauss_volume);
WriteByte(MSG_ENTITY, ammo_rpg_state);
WriteByte(MSG_ENTITY, mode_tempstate);
WriteByte(MSG_ENTITY, mode_silencer);
}
return (1);
}
#endif

View file

@ -1,353 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
AP9_IDLE,
AP9_RELOAD,
AP9_DRAW,
AP9_SHOOT1,
AP9_SHOOT2,
AP9_SHOOT3
};
#ifdef CLIENT
void w_pistol_ejectshell(void)
{
static void w_pistol_ejectshell_death(void) {
remove(self);
}
static void w_pistol_ejectshell_touch(void) {
if (other == world)
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
}
entity eShell = spawn();
setmodel(eShell, "models/shell.mdl");
eShell.solid = SOLID_BBOX;
eShell.movetype = MOVETYPE_BOUNCE;
eShell.drawmask = MASK_ENGINE;
eShell.angles = [pSeat->m_eViewModel.angles[0], pSeat->m_eViewModel.angles[1], 0];
eShell.velocity = pSeat->m_vecPredictedVelocity;
makevectors(pSeat->m_eViewModel.angles);
eShell.velocity += (v_forward * 0);
eShell.velocity += (v_right * -60);
eShell.velocity += (v_up * 120);
eShell.touch = w_pistol_ejectshell_touch;
eShell.avelocity = [0,45,900];
eShell.think = w_pistol_ejectshell_death;
eShell.nextthink = time + 2.5f;
setsize(eShell, [0,0,0], [0,0,0]);
setorigin(eShell, pSeat->m_eViewModel.origin + (v_forward * 26) + (v_right * 10) + (v_up * -10));
}
#endif
void
w_ap9_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_ap9.fire");
precache_model("models/w_ap9.mdl");
#else
precache_model("models/v_ap9.mdl");
precache_model("models/p_ap9.mdl");
#endif
}
void
w_ap9_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.ap9_mag, pl.ammo_ap9, -1);
}
string
w_ap9_wmodel(void)
{
return "models/w_ap9.mdl";
}
string
w_ap9_pmodel(player pl)
{
return "models/p_ap9.mdl";
}
string
w_ap9_deathmsg(void)
{
return "%s was unloaded into from %s's AP9.";
}
int
w_ap9_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
pl.ap9_mag = 40;
return (1);
}
if (pl.ammo_ap9 < MAX_A_AP9) {
pl.ammo_ap9 = bound(0, pl.ammo_ap9 + 40, MAX_A_AP9);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_ap9_draw(player pl)
{
Weapons_SetModel("models/v_ap9.mdl");
Weapons_ViewAnimation(pl, AP9_DRAW);
}
void
w_ap9_holster(player pl)
{
}
void
w_ap9_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (!pl.ap9_mag)
return;
pl.ap9_mag--;
Weapons_ViewPunchAngle(pl, [-2,0,0]);
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(pl, AP9_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(pl, AP9_SHOOT2);
break;
case 2:
Weapons_ViewAnimation(pl, AP9_SHOOT3);
break;
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f);
else
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f);
#ifdef CLIENT
View_AddEvent(w_pistol_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_SMALL);
#else
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.1,0.1], WEAPON_AP9);
Sound_Play(pl, CHAN_WEAPON, "weapon_ap9.fire");
#endif
pl.w_attack_next = 0.15f;
pl.w_idle_next = 5.0f;
}
void
w_ap9_secondary(player pl)
{
if (pl.w_attack_next > 0)
return;
if ((pl.ap9_mag - 3) < 0)
return;
pl.ap9_mag -= 3;
Weapons_ViewPunchAngle(pl, [-2,0,0]);
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(pl, AP9_SHOOT1);
break;
case 1:
Weapons_ViewAnimation(pl, AP9_SHOOT2);
break;
case 2:
Weapons_ViewAnimation(pl, AP9_SHOOT3);
break;
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f);
else
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f);
#ifdef CLIENT
View_AddEvent(w_glock_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_SMALL);
#else
TraceAttack_FireBullets(3, pl.origin + pl.view_ofs, 8, [0.02,0.02], WEAPON_AP9);
Sound_Play(pl, CHAN_WEAPON, "weapon_ap9.fire");
#endif
pl.w_attack_next = 1.0f;
pl.w_idle_next = 5.0f;
}
void
w_ap9_reload(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ap9_mag >= 40)
return;
if (pl.a_ammo2 <= 0)
return;
#ifdef CLIENT
Weapons_ViewAnimation(pl, AP9_RELOAD);
#else
Weapons_ReloadWeapon(pl, player::ap9_mag, player::ammo_ap9, 40);
#endif
pl.w_attack_next = 2.0f;
pl.w_idle_next = 10.0f;
}
void
w_ap9_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.ap9_mag == 0 && pl.ammo_ap9 > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
Weapons_ViewAnimation(pl, AP9_IDLE);
}
float
w_ap9_aimanim(player pl)
{
return w_glock_aimanim(pl);
}
void
w_ap9_hud(player pl)
{
w_glock_hud(pl);
}
void
w_ap9_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.ap9_mag == 0 && pl.ammo_ap9 == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_ap9, MAX_A_AP9, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
[0,0],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
[0,0],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_ap9_isempty(player pl)
{
if (pl.ap9_mag <= 0 && pl.ammo_ap9 <= 0)
return 1;
return 0;
}
weapontype_t
w_ap9_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_ap9 =
{
.name = "ap9",
.id = ITEM_AP9,
.slot = 1,
.slot_pos = 2,
.weight = WEIGHT_AP9,
.draw = w_ap9_draw,
.holster = w_ap9_holster,
.primary = w_ap9_primary,
.secondary = w_ap9_secondary,
.reload = w_ap9_reload,
.release = w_ap9_release,
.postdraw = w_ap9_hud,
.precache = w_ap9_precache,
.pickup = w_ap9_pickup,
.updateammo = w_ap9_updateammo,
.wmodel = w_ap9_wmodel,
.pmodel = w_ap9_pmodel,
.deathmsg = w_ap9_deathmsg,
.aimanim = w_ap9_aimanim,
.isempty = w_ap9_isempty,
.type = w_ap9_type,
.hudpic = w_ap9_hudpic
};
/* pickups */
#ifdef SERVER
void
weapon_th_ap9(void)
{
Weapons_InitItem(WEAPON_AP9);
}
#endif

View file

@ -1,350 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* Animations */
enum
{
CHAINGUN_IDLE1,
CHAINGUN_IDLE2,
CHAINGUN_SPINUP,
CHAINGUN_SPINDOWN,
CHAINGUN_FIRE,
CHAINGUN_DRAW,
CHAINGUN_HOLSTER
};
#ifdef CLIENT
void w_chaingun_ejectshell(void)
{
static void w_chaingun_ejectshell_death(void) {
remove(self);
}
static void w_chaingun_ejectshell_touch(void) {
if (other == world)
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
}
entity eShell = spawn();
setmodel(eShell, "models/shell.mdl");
eShell.solid = SOLID_BBOX;
eShell.movetype = MOVETYPE_BOUNCE;
eShell.drawmask = MASK_ENGINE;
eShell.angles = [pSeat->m_eViewModel.angles[0], pSeat->m_eViewModel.angles[1], 0];
eShell.velocity = pSeat->m_vecPredictedVelocity;
makevectors(pSeat->m_eViewModel.angles);
eShell.velocity += (v_forward * 0);
eShell.velocity += (v_right * -80);
eShell.velocity += (v_up * 100);
eShell.touch = w_chaingun_ejectshell_touch;
eShell.avelocity = [0,45,900];
eShell.think = w_chaingun_ejectshell_death;
eShell.nextthink = time + 2.5f;
setsize(eShell, [0,0,0], [0,0,0]);
setorigin(eShell, pSeat->m_eViewModel.origin + (v_forward * 26) + (v_up * -15));
}
#endif
void
w_chaingun_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_chaingun.fire");
Sound_Precache("weapon_chaingun.reload");
Sound_Precache("weapon_chaingun.spindown");
Sound_Precache("weapon_chaingun.spinup");
#endif
precache_model("models/v_tfac.mdl");
precache_model("models/w_tfac.mdl");
precache_model("models/p_tfac.mdl");
}
int
w_chaingun_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
pl.chaingun_mag = 100;
return (1);
}
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 100, MAX_A_9MM);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_chaingun_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.chaingun_mag, pl.ammo_9mm, -1);
}
string
w_chaingun_wmodel(void)
{
return "models/w_tfac.mdl";
}
string
w_chaingun_pmodel(player pl)
{
return "models/p_tfac.mdl";
}
string
w_chaingun_deathmsg(void)
{
return "%s was rolled over by %s' Chaingun.";
}
void
w_chaingun_draw(player pl)
{
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tfac.mdl");
Weapons_ViewAnimation(pl, CHAINGUN_DRAW);
}
void
w_chaingun_holster(player pl)
{
Weapons_ViewAnimation(pl, CHAINGUN_HOLSTER);
}
void
w_chaingun_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.chaingun_mag == 0 && pl.ammo_9mm > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
/* end firing */
if (pl.mode_tempstate == 1) {
pl.mode_tempstate = 0;
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spindown");
#endif
Weapons_ViewAnimation(pl, CHAINGUN_SPINDOWN);
pl.w_attack_next = 1.0f;
pl.w_idle_next = pl.w_attack_next;
return;
}
/* end reload */
if (pl.mode_tempstate == 2) {
pl.mode_tempstate = 0;
Weapons_ViewAnimation(pl, CHAINGUN_DRAW);
pl.w_attack_next = 1.0f;
pl.w_idle_next = pl.w_attack_next;
return;
}
int r = (float)input_sequence % 2;
if (r) {
Weapons_ViewAnimation(pl, CHAINGUN_IDLE1);
} else {
Weapons_ViewAnimation(pl, CHAINGUN_IDLE2);
}
pl.w_idle_next = 15.0f;
}
void
w_chaingun_primary(player pl)
{
/* in case we're spamming primary while reloading */
if (pl.mode_tempstate == 2) {
w_chaingun_release(pl);
return;
}
if (pl.w_attack_next > 0.0)
return;
/* ammo check */
if (pl.chaingun_mag <= 0)
return;
/* spin up first */
if (pl.mode_tempstate == 0) {
pl.mode_tempstate = 1;
Weapons_ViewAnimation(pl, CHAINGUN_SPINUP);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spinup");
#endif
pl.w_attack_next = 0.5f;
pl.w_idle_next = pl.w_attack_next;
return;
}
pl.chaingun_mag--;
Weapons_ViewAnimation(pl, CHAINGUN_FIRE);
Weapons_ViewPunchAngle(pl, [random(-2, 2),0,0]);
#ifdef CLIENT
View_AddEvent(w_chaingun_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_RIFLE);
#else
TraceAttack_FireBullets(1, Weapons_GetCameraPos(pl), 8, [0.15,0.15], WEAPON_CHAINGUN);
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.fire");
#endif
pl.w_attack_next = 0.1f;
pl.w_idle_next = 0.0f;
}
void
w_chaingun_reload(player pl)
{
if (pl.w_attack_next) {
w_chaingun_release(pl);
return;
}
/* ammo check */
if (pl.chaingun_mag >= 100)
return;
if (pl.ammo_9mm <= 0)
return;
Weapons_ViewAnimation(pl, CHAINGUN_HOLSTER);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.reload");
Weapons_ReloadWeapon(pl, player::chaingun_mag, player::ammo_9mm, 100);
#endif
pl.mode_tempstate = 2;
pl.w_attack_next = 10.0f;
pl.w_idle_next = 1.5f;
}
void
w_chaingun_hud(player pl)
{
w_glock_hud(pl);
}
float
w_chaingun_aimanim(player pl)
{
return w_mp5_aimanim(pl);
}
void
w_chaingun_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.chaingun_mag == 0 && pl.ammo_9mm == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_9mm, MAX_A_9MM, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
[0,90/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
[0,45/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_chaingun_isempty(player pl)
{
if (pl.chaingun_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
return 0;
}
weapontype_t
w_chaingun_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_chaingun =
{
.name = "chaingun",
.id = ITEM_CHAINGUN,
.slot = 3,
.slot_pos = 3,
.weight = WEIGHT_CHAINGUN,
.draw = w_chaingun_draw,
.holster = w_chaingun_holster,
.primary = w_chaingun_primary,
.secondary = w_chaingun_release,
.reload = w_chaingun_reload,
.release = w_chaingun_release,
.postdraw = w_chaingun_hud,
.precache = w_chaingun_precache,
.pickup = w_chaingun_pickup,
.updateammo = w_chaingun_updateammo,
.wmodel = w_chaingun_wmodel,
.pmodel = w_chaingun_pmodel,
.deathmsg = w_chaingun_deathmsg,
.aimanim = w_chaingun_aimanim,
.isempty = w_chaingun_isempty,
.type = w_chaingun_type,
.hudpic = w_chaingun_hudpic
};
/* pickups */
#ifdef SERVER
void
weapon_th_chaingun(void)
{
Weapons_InitItem(WEAPON_CHAINGUN);
}
#endif

View file

@ -1,274 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
EGON_IDLE1,
EGON_FIDGET1,
EGON_ALTFIREON,
EGON_ALTFIRECYCLE,
EGON_ALTFIREOFF,
EGON_FIRE1,
EGON_FIRE2,
EGON_FIRE3,
EGON_FIRE4,
EGON_DRAW,
EGON_HOLSTER
};
void
w_flame_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_flame.fire");
#endif
precache_model("sprites/fthrow.spr");
precache_model("models/v_egon.mdl");
precache_model("models/w_egon.mdl");
precache_model("models/p_egon.mdl");
}
void
w_flame_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, -1, pl.ammo_gas, -1);
}
string
w_flame_wmodel(void)
{
return w_egon_wmodel();
}
string
w_flame_pmodel(player pl)
{
return w_egon_pmodel(pl);
}
string
w_flame_deathmsg(void)
{
return "%s burned to a crisp by %s's Flamethrower.";
}
int
w_flame_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (pl.ammo_gas < MAX_A_GAS) {
pl.ammo_gas = bound(0, pl.ammo_gas + 20, MAX_A_GAS);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_flame_draw(player pl)
{
w_egon_draw(pl);
}
void
w_flame_holster(player pl)
{
w_egon_holster(pl);
}
void
w_flame_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* Ammo check */
if (pl.ammo_gas <= 0)
return;
pl.ammo_gas--;
#ifdef CLIENT
if (Weapons_GetAnimation(pl) == EGON_IDLE1)
Weapons_ViewAnimation(pl, EGON_ALTFIREON);
else if (Weapons_GetAnimation(pl) == EGON_ALTFIREON)
Weapons_ViewAnimation(pl, EGON_ALTFIRECYCLE);
#else
static void w_flame_die(void) {
NSEntity meSelf = (NSEntity)self;
meSelf.Destroy();
}
static void w_flame_touch(entity target, entity source) {
if (target.takedamage == DAMAGE_YES) {
NSSurfacePropEntity m = (NSSurfacePropEntity)target;
m.Ignite(source, 5.0f, WEAPON_EGON);
} else {
NSEntity meSelf = (NSEntity)self;
meSelf.Destroy();
}
// To be added to spec
// Damage_Apply(target, source.owner, Skill_GetValue("sk_flame", 13), WEAPON_EGON, DMG_BURN);
}
Sound_Play(pl, CHAN_WEAPON, "weapon_flame.fire");
#ifdef SERVER
NSProjectile ball = spawn(NSProjectile);
ball.SetModel("sprites/fthrow.spr");
ball.SetRenderMode(RM_ADDITIVE);
ball.SetRenderColor([1,1,1]);
ball.SetRenderAmt(1.0);
ball.SetOwner(pl);
ball.SetFrame(2);
ball.SetImpact(w_flame_touch);
ball.SetLightColor([1, 0.75, 0]);
ball.SetLightRadius(256.0f);
ball.AnimateOnce(0, 15, 0.1f);
#endif
// To be added to spec
// ball.Animate(0,15);
// ball.effects |= EF_BRIGHTLIGHT;
// Also will need check for water contents (so projectile will die underwater)
Weapons_MakeVectors(pl);
ball.SetOrigin(Weapons_GetCameraPos(pl) + (v_forward * 16));
ball.SetVelocity(v_forward * 300);
setsize(ball, [0,0,0], [0,0,0]);
#endif
pl.w_attack_next = 0.2f;
pl.w_idle_next = 2.5f;
}
void
w_flame_reload(player pl)
{
}
void
w_flame_release(player pl)
{
w_egon_release(pl);
}
void
w_flame_crosshair(player pl)
{
#ifdef CLIENT
static vector cross_pos;
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo2();
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
drawsubpic(aicon_pos, [24,24], "sprites/640hud7.spr_0.tga", [0,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
#endif
}
float
w_flame_aimanim(player pl)
{
return w_egon_aimanim(pl);
}
void
w_flame_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.ammo_gas == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_gas, MAX_A_GAS, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
[0,45/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
[0,0/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_flame_isempty(player pl)
{
if (pl.ammo_gas <= 0)
return 1;
return 0;
}
weapontype_t
w_flame_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_flame =
{
.name = "flame",
.id = ITEM_EGON,
.slot = 3,
.slot_pos = 2,
.weight = WEIGHT_EGON,
.draw = w_flame_draw,
.holster = w_egon_holster,
.primary = w_flame_primary,
.secondary = w_flame_release,
.reload = __NULL__,
.release = w_flame_release,
.postdraw = w_flame_crosshair,
.precache = w_flame_precache,
.pickup = w_flame_pickup,
.updateammo = w_flame_updateammo,
.wmodel = w_flame_wmodel,
.pmodel = w_flame_pmodel,
.deathmsg = w_flame_deathmsg,
.aimanim = w_flame_aimanim,
.isempty = w_flame_isempty,
.type = w_flame_type,
.hudpic = w_flame_hudpic
};

View file

@ -1,261 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
MEDKIT_IDLE1,
MEDKIT_IDLE2,
MEDKIT_USE,
MEDKIT_UNUSED,
MEDKIT_HOLSTER,
MEDKIT_DRAW
};
void
w_medkit_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_medkit.heal");
#endif
precache_model("models/v_tfc_medkit.mdl");
precache_model("models/w_tfc_medkit.mdl");
precache_model("models/p_tfc_medkit.mdl");
}
void
w_medkit_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, -1, pl.ammo_medkit, -1);
}
string
w_medkit_wmodel(void)
{
return "models/w_tfc_medkit.mdl";
}
string
w_medkit_pmodel(player pl)
{
return "models/p_tfc_medkit.mdl";
}
string
w_medkit_deathmsg(void)
{
return "%s was somehow healed to death by %s's Medkit.";
}
int
w_medkit_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
if (cvar("th_medkitstyle") == 1)
pl.ammo_medkit = 1;
else
pl.ammo_medkit = 8;
return (1);
}
if (pl.ammo_medkit < MAX_A_MEDKIT) {
pl.ammo_medkit = bound(0, pl.ammo_medkit + 8, MAX_A_MEDKIT);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_medkit_draw(player pl)
{
Weapons_SetModel("models/v_tfc_medkit.mdl");
Weapons_ViewAnimation(pl, MEDKIT_DRAW);
}
void
w_medkit_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (!pl.ammo_medkit)
return;
/* Don't give the player more than 100 health */
if (pl.health >= 100)
return;
else
Weapons_ViewAnimation(pl, MEDKIT_USE);
pl.ammo_medkit--;
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f);
else
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f);
#ifdef SERVER
/* We want to only give health to the player & skip armor */
Damage_Apply(pl, pl, -15, WEAPON_MEDKIT, DMG_GENERIC);
Sound_Play(pl, CHAN_WEAPON, "weapon_medkit.heal");
#endif
pl.w_attack_next = 2.4f;
pl.w_idle_next = 5.0f;
}
void
w_medkit_release(player pl)
{
if (pl.w_idle_next > 0.0)
return;
int r = (float)input_sequence % 2;
switch (r) {
case 0:
Weapons_ViewAnimation(pl, MEDKIT_IDLE1);
pl.w_idle_next = 1.16f;
break;
default:
Weapons_ViewAnimation(pl, MEDKIT_IDLE2);
pl.w_idle_next = 2.36f;
break;
}
}
float
w_medkit_aimanim(player pl)
{
return w_snark_aimanim(pl);
}
void
w_medkit_crosshair(player pl)
{
#ifdef CLIENT
vector aicon_pos;
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
HUD_DrawAmmo2();
drawsubpic(
aicon_pos,
[24,24],
"sprites/640hud7.spr_0.tga",
[24/256,96/128],
[24/256, 24/128],
g_hud_color,
pSeatLocal->m_flAmmo2Alpha,
DRAWFLAG_ADDITIVE
);
#endif
}
void
w_medkit_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.ammo_medkit == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_medkit, MAX_A_MEDKIT, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
[0,180/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud06.spr_0.tga",
[0,90/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_medkit_isempty(player pl)
{
if (pl.ammo_medkit <= 0)
return 1;
return 0;
}
weapontype_t
w_medkit_type(player pl)
{
return WPNTYPE_CLOSE;
}
weapon_t w_medkit =
{
.name = "medkit",
.id = ITEM_MEDKIT2,
.slot = 4,
.slot_pos = 4,
.weight = WEIGHT_MEDKIT,
.draw = w_medkit_draw,
.holster = __NULL__,
.primary = w_medkit_primary,
.secondary = __NULL__,
.reload = __NULL__,
.release = w_medkit_release,
.postdraw = w_medkit_crosshair,
.precache = w_medkit_precache,
.pickup = w_medkit_pickup,
.updateammo = w_medkit_updateammo,
.wmodel = w_medkit_wmodel,
.pmodel = w_medkit_pmodel,
.deathmsg = w_medkit_deathmsg,
.aimanim = w_medkit_aimanim,
.isempty = w_medkit_isempty,
.type = w_medkit_type,
.hudpic = w_medkit_hudpic
};
#ifdef SERVER
void
weapon_th_medkit(void)
{
Weapons_InitItem(WEAPON_MEDKIT);
}
#endif

View file

@ -1,187 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED weapon_rpg (0 0 1) (-16 -16 0) (16 16 32)
"model" "models/w_rpg.mdl"
HALF-LIFE (1998) ENTITY
RPG Weapon
*/
enum
{
RPG_IDLE,
RPG_FIDGET,
RPG_RELOAD,
RPG_FIRE2,
RPG_HOLSTER1,
RPG_DRAW1,
RPG_HOLSTER2,
RPG_DRAW_UL,
RPG_IDLE_UL,
RPG_FIDGET_UL,
};
void
w_rpg2_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_rpg.shoot");
precache_model("models/w_rpg.mdl");
precache_model("models/rpgrocket.mdl");
#else
precache_model("models/v_rpg.mdl");
precache_model("models/p_rpg.mdl");
precache_model("sprites/laserdot.spr");
#endif
}
void
w_rpg2_updateammo(player pl)
{
w_rpg_updateammo(pl);
}
string
w_rpg2_wmodel(void)
{
return w_rpg_wmodel();
}
string
w_rpg2_pmodel(player pl)
{
return w_rpg_pmodel(pl);
}
string
w_rpg2_deathmsg(void)
{
return w_rpg_deathmsg();
}
int
w_rpg2_pickup(player pl, int new, int startammo)
{
return w_rpg_pickup(pl, new, startammo);
}
void
w_rpg2_draw(player pl)
{
w_rpg_draw(pl);
}
void
w_rpg2_holster(player pl)
{
}
void
w_rpg2_primary(player pl)
{
w_rpg_primary(pl);
}
void
w_rpg2_reload(player pl)
{
w_rpg_reload(pl);
}
void
w_rpg2_release(player pl)
{
w_rpg_release(pl);
}
void
w_rpg2_secondary(player pl)
{
/* Another change to spice things up */
if (serverkeyfloat("th_rpgstyle") != 1) {
if (pl.w_attack_next > 0.0) {
return;
}
/* toggle laser */
pl.ammo_rpg_state = 1 - pl.ammo_rpg_state;
pl.w_attack_next = 0.25f;
w_rpg2_release(pl);
}
}
float
w_rpg2_aimanim(player pl)
{
return w_rpg_aimanim(pl);
}
void
w_rpg2_hudpic(player pl, int selected, vector pos, float a)
{
w_rpg_hudpic(pl, selected, pos, a);
}
void
w_rpg2_hud(player pl)
{
w_rpg_hud(pl);
}
int
w_rpg2_isempty(player pl)
{
return w_rpg_isempty(pl);
}
weapontype_t
w_rpg2_type(player pl)
{
return w_rpg_type(pl);
}
weapon_t w_rpg2 =
{
.name = "rpg_rocket",
.id = ITEM_RPG,
.slot = 3,
.slot_pos = 0,
.weight = WEIGHT_RPG,
.draw = w_rpg2_draw,
.holster = w_rpg2_holster,
.primary = w_rpg2_primary,
.secondary = w_rpg2_secondary,
.reload = w_rpg2_reload,
.release = w_rpg2_release,
.postdraw = w_rpg2_hud,
.precache = w_rpg2_precache,
.pickup = w_rpg2_pickup,
.updateammo = w_rpg2_updateammo,
.wmodel = w_rpg2_wmodel,
.pmodel = w_rpg2_pmodel,
.deathmsg = w_rpg2_deathmsg,
.aimanim = w_rpg2_aimanim,
.isempty = w_snark_isempty,
.type = w_snark_type,
.hudpic = w_rpg2_hudpic
};

View file

@ -1,251 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
CBAR_IDLE,
CBAR_DRAW,
CBAR_HOLSTER,
CBAR_ATTACK1HIT,
CBAR_ATTACK1MISS,
CBAR_ATTACK2MISS,
CBAR_ATTACK2HIT,
CBAR_ATTACK3MISS,
CBAR_ATTACK3HIT
};
void
w_shovel_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_crowbar.hit");
Sound_Precache("weapon_crowbar.miss");
Sound_Precache("weapon_crowbar.hitbody");
#endif
precache_model("models/v_shovel.mdl");
precache_model("models/w_shovel.mdl");
precache_model("models/p_shovel.mdl");
}
void
w_shovel_updateammo(player pl)
{
w_crowbar_updateammo(pl);
}
string
w_shovel_wmodel(void)
{
return "models/w_shovel.mdl";
}
string
w_shovel_pmodel(player pl)
{
return "models/p_shovel.mdl";
}
string
w_shovel_deathmsg(void)
{
return "%s was buried by %s's Shovel.";
}
void
w_shovel_draw(player pl)
{
Weapons_SetModel("models/v_shovel.mdl");
Weapons_ViewAnimation(pl, CBAR_DRAW);
}
void
w_shovel_holster(player pl)
{
w_crowbar_holster(pl);
}
void
w_shovel_primary(player pl)
{
int anim = 0;
vector src;
if (pl.w_attack_next)
return;
Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs;
/* make sure we can gib corpses */
int oldhitcontents = self.hitcontentsmaski;
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
traceline(src, src + (v_forward * 32), FALSE, pl);
self.hitcontentsmaski = oldhitcontents;
/* Stock shovel is exactly like umbrella
* this cvar will spice things up a bit */
if (serverkeyfloat("th_shovelstyle") == 1) {
if (trace_fraction >= 1.0) {
Weapons_ViewPunchAngle(pl, [5,0,0]);
pl.w_attack_next = 0.85f;
} else {
Weapons_ViewPunchAngle(pl, [-20,0,0]);
pl.w_attack_next = 1.2f;
}
} else {
if (trace_fraction >= 1.0) {
pl.w_attack_next = 0.5f;
} else {
pl.w_attack_next = 0.25f;
}
}
pl.w_idle_next = 2.5f;
int r = (float)input_sequence % 3;
switch (r) {
case 0:
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT);
break;
case 1:
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT);
break;
default:
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
}
if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
} else {
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f);
}
#ifdef SERVER
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
if (trace_fraction >= 1.0)
return;
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
FX_Blood(trace_endpos, [1,0,0]);
} else {
SurfData_Impact(trace_ent, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage) {
if (serverkeyfloat("th_shovelstyle") == 1) {
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10) * 2.0, WEAPON_CROWBAR, DMG_BLUNT);
} else {
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
}
if (trace_ent.iBleeds) {
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
}
} else {
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hit");
}
#endif
}
void
w_shovel_release(player pl)
{
w_crowbar_release(pl);
}
float
w_shovel_aimanim(player pl)
{
return w_crowbar_aimanim(pl);
}
void
w_shovel_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
[0,135/256],
[170/256,45/256],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
[0,90/256],
[170/256,45/256],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_shovel_isempty(player pl)
{
return 0;
}
weapontype_t
w_shovel_type(player pl)
{
return WPNTYPE_CLOSE;
}
weapon_t w_shovel =
{
.name = "shovel",
.id = ITEM_SHOVEL,
.slot = 0,
.slot_pos = 1,
.weight = WEIGHT_SHOVEL,
.draw = w_shovel_draw,
.holster = w_shovel_holster,
.primary = w_shovel_primary,
.secondary = __NULL__,
.reload = __NULL__,
.release = w_shovel_release,
.postdraw = __NULL__,
.precache = w_shovel_precache,
.pickup = __NULL__,
.updateammo = w_shovel_updateammo,
.wmodel = w_shovel_wmodel,
.pmodel = w_shovel_pmodel,
.deathmsg = w_shovel_deathmsg,
.aimanim = w_shovel_aimanim,
.isempty = w_shovel_isempty,
.type = w_shovel_type,
.hudpic = w_shovel_hudpic
};
/* entity definitions for pickups */
#ifdef SERVER
void
weapon_th_shovel(void)
{
Weapons_InitItem(WEAPON_SHOVEL);
}
#endif

View file

@ -1,334 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
GLOCK_IDLE1,
GLOCK_IDLE2,
GLOCK_IDLE3,
GLOCK_SHOOT,
GLOCK_SHOOT_EMPTY,
GLOCK_RELOAD_EMPTY,
GLOCK_RELOAD,
GLOCK_DRAW,
GLOCK_HOLSTER,
GLOCK_SILENCER
};
void
w_silencer_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_glock.fire");
Sound_Precache("weapon_silencer.fire");
#endif
precache_model("models/v_9mmhandgun.mdl");
precache_model("models/w_9mmhandgun.mdl");
precache_model("models/p_9mmhandgun.mdl");
Sound_Precache("modelevent_shell.land");
}
void
w_silencer_updateammo(player pl)
{
w_glock_updateammo(pl);
}
string
w_silencer_wmodel(void)
{
return "models/w_silencer.mdl";
}
string
w_silencer_pmodel(player pl)
{
return w_glock_pmodel(pl);
}
string
w_silencer_deathmsg(void)
{
return "%s was silenced by %s's Beretta.";
}
int
w_silencer_pickup(player pl, int new, int startammo)
{
return w_glock_pickup(pl, new, startammo);
}
void
w_silencer_draw(player pl)
{
w_glock_draw(pl);
#ifdef CLIENT
if (pl.mode_silencer) {
Weapons_SetGeomset("geomset 2 2\n");
} else {
Weapons_SetGeomset("geomset 2 0\n");
}
#endif
}
void
w_silencer_holster(player pl)
{
w_glock_holster(pl);
}
void
w_silencer_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* ammo check */
if (!pl.glock_mag)
return;
pl.glock_mag--;
/* actual firing */
Weapons_ViewPunchAngle(pl, [-2,0,0]);
if (pl.glock_mag) {
Weapons_ViewAnimation(pl, GLOCK_SHOOT);
} else {
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f);
else
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f);
#ifdef CLIENT
View_AddEvent(w_glock_ejectshell, 0.0f);
if (pl.mode_silencer == 1) {
View_SetMuzzleflash(0);
} else {
View_SetMuzzleflash(MUZZLE_SMALL);
}
#else
/* Different sound & accuracy without silencer */
if (pl.mode_silencer == 1) {
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01, 0.01], WEAPON_GLOCK);
Sound_Play(pl, CHAN_WEAPON, "weapon_silencer.fire");
} else {
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK);
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
}
#endif
/* Fires faster without silencer */
if (pl.mode_silencer == 1) {
pl.w_attack_next = 0.3f;
} else {
pl.w_attack_next = 0.2f;
}
pl.w_idle_next = 5.0f;
}
#ifdef CLIENT
void
w_silencer_add(void)
{
Weapons_SetGeomset("geomset 2 2\n");
}
void
w_silencer_remove(void)
{
Weapons_SetGeomset("geomset 2 0\n");
}
#endif
void
w_silencer_secondary(player pl)
{
if (pl.w_attack_next > 0)
return;
/* toggle silencer */
pl.mode_silencer = 1 - pl.mode_silencer;
if (pl.mode_silencer) {
pl.w_attack_next = 3.3f;
pl.w_idle_next = pl.w_attack_next;
Weapons_ViewAnimation(pl, GLOCK_SILENCER);
#ifdef CLIENT
View_AddEvent(w_silencer_add, 1.0f);
#endif
} else {
pl.w_attack_next = 2.0f;
pl.w_idle_next = 1.0f;
Weapons_ViewAnimation(pl, GLOCK_HOLSTER);
pl.mode_tempstate = 1;
#ifdef CLIENT
View_AddEvent(w_silencer_remove, 0.9f);
#endif
}
}
void
w_silencer_reload(player pl)
{
w_glock_reload(pl);
}
void
w_silencer_release(player pl)
{
int r;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.glock_mag == 0 && pl.ammo_9mm > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0) {
return;
}
if (pl.mode_tempstate == 1)
{
Weapons_ViewAnimation(pl, GLOCK_DRAW);
pl.w_idle_next = 1.0f;
pl.w_attack_next = pl.w_idle_next;
pl.mode_tempstate = 0;
return;
}
r = floor(pseudorandom() * 3.0f);
switch (r) {
case 1:
Weapons_ViewAnimation(pl, GLOCK_IDLE2);
pl.w_idle_next = 2.5f;
break;
case 2:
Weapons_ViewAnimation(pl, GLOCK_IDLE3);
pl.w_idle_next = 3.5f;
break;
default:
Weapons_ViewAnimation(pl, GLOCK_IDLE1);
pl.w_idle_next = 3.75f;
break;
}
}
float
w_silencer_aimanim(player pl)
{
return w_glock_aimanim(pl);
}
void
w_silencer_hud(player pl)
{
w_glock_hud(pl);
}
void
w_silencer_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.glock_mag == 0 && pl.ammo_9mm == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_9mm, MAX_A_9MM, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
[0,135/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud06.spr_0.tga",
[0,45/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_silencer_isempty(player pl)
{
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
return 0;
}
weapontype_t
w_silencer_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_silencer =
{
.name = "silencer",
.id = ITEM_GLOCK,
.slot = 1,
.slot_pos = 0,
.weight = WEIGHT_GLOCK,
.draw = w_silencer_draw,
.holster = w_silencer_holster,
.primary = w_silencer_primary,
.secondary = w_silencer_secondary,
.reload = w_silencer_reload,
.release = w_silencer_release,
.postdraw = w_silencer_hud,
.precache = w_silencer_precache,
.pickup = w_silencer_pickup,
.updateammo = w_silencer_updateammo,
.wmodel = w_silencer_wmodel,
.pmodel = w_silencer_pmodel,
.deathmsg = w_silencer_deathmsg,
.aimanim = w_silencer_aimanim,
.isempty = w_silencer_isempty,
.type = w_silencer_type,
.hudpic = w_silencer_hudpic
};

View file

@ -1,369 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
SNIPER_IDLE1,
SNIPER_UNUSED1,
SNIPER_FIRE1,
SNIPER_DRAW,
SNIPER_HOLSTER,
SNIPER_IDLE2
};
void
w_sniper_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_sniper.fire");
Sound_Precache("weapon_sniper.reload");
#endif
precache_model("models/v_tfc_sniper.mdl");
precache_model("models/w_isotopebox.mdl");
precache_model("models/p_sniper.mdl");
}
int
w_sniper_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
pl.sniper_mag = 5;
return (1);
}
if (pl.ammo_sniper < MAX_A_SNIPER) {
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_sniper_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_sniper, -1);
}
string
w_sniper_wmodel(void)
{
return "models/w_isotopebox.mdl";
}
string
w_sniper_pmodel(player pl)
{
return "models/p_sniper.mdl";
}
string
w_sniper_deathmsg(void)
{
return "%s was taken out by %s's Sniper.";
}
void
w_sniper_draw(player pl)
{
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tfc_sniper.mdl");
Weapons_ViewAnimation(pl, SNIPER_DRAW);
}
void
w_sniper_holster(player pl)
{
Weapons_ViewAnimation(pl, SNIPER_HOLSTER);
}
void
w_sniper_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.sniper_mag == 0 && pl.ammo_sniper > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
if (pl.mode_tempstate == 1) {
Weapons_ViewAnimation(pl, SNIPER_DRAW);
pl.mode_tempstate = 0;
pl.w_attack_next = 0.0f;
pl.w_idle_next = 15.0f;
return;
}
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(pl, SNIPER_IDLE1);
pl.w_idle_next = 3.0f;
break;
case 1:
Weapons_ViewAnimation(pl, SNIPER_IDLE2);
pl.w_idle_next = 2.0f;
break;
}
pl.w_idle_next = 15.0f;
}
void
w_sniper_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* Ammo check */
if (pl.sniper_mag <= 0)
return;
pl.sniper_mag--;
Weapons_ViewPunchAngle(pl, [-20,0,0]);
Weapons_ViewAnimation(pl, SNIPER_FIRE1);
#ifdef CLIENT
View_AddEvent(w_chaingun_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_SMALL);
#else
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.008, 0.008], WEAPON_SNIPER);
Sound_Play(pl, CHAN_WEAPON, "weapon_sniper.fire");
#endif
/* Simple toggle of fovs */
if (pl.viewzoom == 1.0f) {
pl.w_attack_next = 0.1f;
} else {
pl.w_attack_next = 1.0f;
}
pl.w_idle_next = 10.0f;
}
void
w_sniper_secondary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* Simple toggle of fovs */
if (pl.viewzoom == 1.0f) {
pl.viewzoom = 0.25f;
} else {
pl.viewzoom = 1.0f;
}
pl.w_attack_next = 0.5f;
}
void
w_sniper_reload(player pl)
{
if (pl.w_attack_next) {
w_sniper_release(pl);
return;
}
if (pl.sniper_mag >= 5)
return;
if (pl.ammo_sniper <= 0)
return;
Weapons_ViewAnimation(pl, SNIPER_HOLSTER);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_sniper.reload");
Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_sniper, 5);
#endif
pl.mode_tempstate = 1;
pl.w_attack_next = 2.5f;
pl.w_idle_next = 2.0f;
}
void
w_sniper_crosshair(player pl)
{
#ifdef CLIENT
static vector cross_pos;
vector aicon_pos;
if (pl.viewzoom < 1.0f) {
vector col;
// although no accurate, gives the second sniper more character
if (pl.activeweapon == WEAPON_SNIPER)
col = [0,0.2,0];
else
col = [0.2,0,0];
drawfill(
video_mins,
video_res,
col,
1.0f,
DRAWFLAG_ADDITIVE
);
cross_pos = g_hudmins + (g_hudres / 2) + [-128,-104];
drawpic(
cross_pos,
"sprites/nmxhair2.spr_0.tga",
[256,208],
[1,1,1],
1.0f,
DRAWFLAG_NORMAL
);
} else {
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],
"sprites/crosshairs.spr_0.tga",
[48/128,0],
[24/128,24/128],
[1,1,1],
1.0f,
DRAWFLAG_NORMAL
);
}
HUD_DrawAmmo1();
HUD_DrawAmmo2();
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
drawsubpic(
aicon_pos,
[24,24],
"sprites/640hud7.spr_0.tga",
[24/256,72/128],
[24/256, 24/128],
g_hud_color,
pSeatLocal->m_flAmmo2Alpha,
DRAWFLAG_ADDITIVE
);
#endif
}
float
w_sniper_aimanim(player pl)
{
return w_crossbow_aimanim(pl);
}
void
w_sniper_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.sniper_mag == 0 && pl.ammo_sniper == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
HUD_DrawAmmoBar(pos, pl.ammo_sniper, MAX_A_SNIPER, a);
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud02.spr_0.tga",
[0,45/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud01.spr_0.tga",
[0,45/256],
[170/256,45/256],
hud_col,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_sniper_isempty(player pl)
{
if (pl.sniper_mag <= 0 && pl.ammo_sniper <= 0)
return 1;
return 0;
}
weapontype_t
w_sniper_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_sniper =
{
.name = "sniper",
.id = ITEM_SNIPER,
.slot = 2,
.slot_pos = 3,
.weight = WEIGHT_SNIPER,
.draw = w_sniper_draw,
.holster = w_sniper_holster,
.primary = w_sniper_primary,
.secondary = w_sniper_secondary,
.reload = w_sniper_reload,
.release = w_sniper_release,
.postdraw = w_sniper_crosshair,
.precache = w_sniper_precache,
.pickup = w_sniper_pickup,
.updateammo = w_sniper_updateammo,
.wmodel = w_sniper_wmodel,
.pmodel = w_sniper_pmodel,
.deathmsg = w_sniper_deathmsg,
.aimanim = w_sniper_aimanim,
.isempty = w_sniper_isempty,
.type = w_sniper_type,
.hudpic = w_sniper_hudpic
};
/* pickups */
#ifdef SERVER
void
weapon_einar1(void)
{
Weapons_InitItem(WEAPON_SNIPER);
}
#endif

View file

@ -1,234 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
SNIPER_IDLE,
SNIPER_RELOAD,
SNIPER_DRAW,
SNIPER_FIRE
};
void
w_sniper2_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_sniper.fire");
#endif
precache_model("models/v_hkg36.mdl");
precache_model("models/w_hkg36.mdl");
precache_model("models/p_hkg36.mdl");
}
int
w_sniper2_pickup(player pl, int new, int startammo)
{
return w_sniper_pickup(pl, new, startammo);
}
void
w_sniper2_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_sniper, -1);
}
string
w_sniper2_wmodel(void)
{
return "models/w_hkg36.mdl";
}
string
w_sniper2_pmodel(player pl)
{
return "models/p_hkg36.mdl";
}
string
w_sniper2_deathmsg(void)
{
return "%s was taken out by %s's Sniper.";
}
void
w_sniper2_draw(player pl)
{
Weapons_SetModel("models/v_hkg36.mdl");
Weapons_ViewAnimation(pl, SNIPER_DRAW);
}
void
w_sniper2_holster(player pl)
{
}
void
w_sniper2_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.sniper_mag == 0 && pl.ammo_sniper > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(pl, SNIPER_IDLE1);
pl.w_idle_next = 3.0f;
break;
case 1:
Weapons_ViewAnimation(pl, SNIPER_IDLE2);
pl.w_idle_next = 2.0f;
break;
}
pl.w_idle_next = 15.0f;
}
void
w_sniper2_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* Ammo check */
if (pl.sniper_mag <= 0)
return;
pl.sniper_mag--;
Weapons_ViewPunchAngle(pl, [-20,0,0]);
Weapons_ViewAnimation(pl, SNIPER_FIRE);
#ifdef CLIENT
View_AddEvent(w_pistol_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_SMALL);
#else
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.008, 0.008], WEAPON_SNIPER);
Sound_Play(pl, CHAN_WEAPON, "weapon_sniper.fire");
#endif
/* Simple toggle of fovs */
if (pl.viewzoom == 1.0f) {
pl.w_attack_next = 0.1f;
} else {
pl.w_attack_next = 1.0f;
}
pl.w_idle_next = 10.0f;
}
void
w_sniper2_secondary(player pl)
{
w_sniper_secondary(pl);
}
void
w_sniper2_reload(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.sniper_mag >= 5)
return;
if (pl.ammo_sniper <= 0)
return;
Weapons_ViewAnimation(pl, SNIPER_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_sniper, 5);
#endif
pl.w_attack_next = 3.82f;
pl.w_idle_next = 5.0f;
}
void
w_sniper2_crosshair(player pl)
{
#ifdef CLIENT
w_sniper_crosshair(pl);
#endif
}
float
w_sniper2_aimanim(player pl)
{
return w_crossbow_aimanim(pl);
}
void
w_sniper2_hudpic(player pl, int selected, vector pos, float a)
{
w_sniper_hudpic(pl, selected, pos, a);
}
int
w_sniper2_isempty(player pl)
{
return w_sniper_isempty(pl);
}
weapontype_t
w_sniper2_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_sniper2 =
{
.name = "sniper2",
.id = ITEM_SNIPER2,
.slot = 2,
.slot_pos = 4,
.weight = WEIGHT_SNIPER2,
.draw = w_sniper2_draw,
.holster = w_sniper2_holster,
.primary = w_sniper2_primary,
.secondary = w_sniper2_secondary,
.reload = w_sniper2_reload,
.release = w_sniper2_release,
.postdraw = w_sniper2_crosshair,
.precache = w_sniper2_precache,
.pickup = w_sniper2_pickup,
.updateammo = w_sniper2_updateammo,
.wmodel = w_sniper2_wmodel,
.pmodel = w_sniper2_pmodel,
.deathmsg = w_sniper2_deathmsg,
.aimanim = w_sniper2_aimanim,
.isempty = w_sniper2_isempty,
.type = w_sniper2_type,
.hudpic = w_sniper2_hudpic
};
/* pickups */
#ifdef SERVER
void
weapon_th_sniper(void)
{
Weapons_InitItem(WEAPON_SNIPER2);
}
#endif

View file

@ -1,223 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
CBAR_IDLE,
CBAR_ATTACK1,
CBAR_ATTACK2,
CBAR_UNUSED,
CBAR_DRAW,
CBAR_HOLSTER
};
void
w_spanner_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_crowbar.hit");
Sound_Precache("weapon_crowbar.miss");
Sound_Precache("weapon_crowbar.hitbody");
#endif
precache_model("models/v_tfc_spanner.mdl");
precache_model("models/backpack.mdl");
precache_model("models/p_spanner.mdl");
}
void
w_spanner_updateammo(player pl)
{
w_crowbar_updateammo(pl);
}
string
w_spanner_wmodel(void)
{
return "models/backpack.mdl";
}
string
w_spanner_pmodel(player pl)
{
return "models/p_spanner.mdl";
}
string
w_spanner_deathmsg(void)
{
return "%s was retooled by %'s Wrench.";
}
void
w_spanner_draw(player pl)
{
Weapons_SetModel("models/v_tfc_spanner.mdl");
Weapons_ViewAnimation(pl, CBAR_DRAW);
}
void
w_spanner_holster(player pl)
{
w_crowbar_holster(pl);
}
void
w_spanner_primary(player pl)
{
int anim = 0;
vector src;
if (pl.w_attack_next)
return;
Weapons_MakeVectors(pl);
src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_fraction >= 1.0) {
pl.w_attack_next = 0.375f;
} else {
pl.w_attack_next = 0.20f;
}
pl.w_idle_next = 2.5f;
if (random() < 0.5) {
Weapons_ViewAnimation(pl, CBAR_ATTACK1);
} else {
Weapons_ViewAnimation(pl, CBAR_ATTACK2);
}
if (pl.flags & FL_CROUCHING) {
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
} else {
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f);
}
#ifdef SERVER
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
if (trace_fraction >= 1.0)
return;
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
FX_Blood(trace_endpos, [1,0,0]);
} else {
SurfData_Impact(trace_ent, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
if (!trace_ent.iBleeds) {
return;
}
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
} else {
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hit");
}
#endif
}
void
w_spanner_release(player pl)
{
w_crowbar_release(pl);
}
float
w_spanner_aimanim(player pl)
{
return w_crowbar_aimanim(pl);
}
void
w_spanner_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
[0,180/256],
[170/256,45/256],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
} else {
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
[0,135/256],
[170/256,45/256],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
}
#endif
}
int
w_spanner_isempty(player pl)
{
return 0;
}
weapontype_t
w_spanner_type(player pl)
{
return WPNTYPE_CLOSE;
}
weapon_t w_spanner =
{
.name = "spanner",
.id = ITEM_SPANNER,
.slot = 0,
.slot_pos = 2,
.weight = WEIGHT_SPANNER,
.draw = w_spanner_draw,
.holster = w_spanner_holster,
.primary = w_spanner_primary,
.secondary = __NULL__,
.reload = __NULL__,
.release = w_spanner_release,
.postdraw = __NULL__,
.precache = w_spanner_precache,
.pickup = __NULL__,
.updateammo = w_spanner_updateammo,
.wmodel = w_spanner_wmodel,
.pmodel = w_spanner_pmodel,
.deathmsg = w_spanner_deathmsg,
.aimanim = w_spanner_aimanim,
.isempty = w_spanner_isempty,
.type = w_spanner_type,
.hudpic = w_spanner_hudpic
};
/* entity definitions for pickups */
#ifdef SERVER
void
weapon_th_spanner(void)
{
Weapons_InitItem(WEAPON_SPANNER);
}
#endif

View file

@ -1,271 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
TAURUS_IDLE1,
TAURUS_IDLE2,
TAURUS_IDLE3,
TAURUS_SHOOT,
TAURUS_SHOOT2,
TAURUS_SHOOT3,
TAURUS_SHOOT_EMPTY,
TAURUS_RELOAD,
TAURUS_RELOAD2,
TAURUS_DRAW,
TAURUS_HOLSTER
};
void
w_taurus_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_taurus.fire");
#endif
precache_model("models/v_taurus.mdl");
precache_model("models/w_taurus.mdl");
precache_model("models/p_taurus.mdl");
}
void
w_taurus_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.taurus_mag, pl.ammo_taurus, -1);
}
string
w_taurus_wmodel(void)
{
return "models/w_taurus.mdl";
}
string
w_taurus_pmodel(player pl)
{
return "models/p_taurus.mdl";
}
string
w_taurus_deathmsg(void)
{
return "%s is seeing blue from %s's Taurus.";
}
int
w_taurus_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
pl.taurus_mag = 10;
return (1);
}
if (pl.ammo_taurus < MAX_A_TAURUS) {
pl.ammo_taurus = bound(0, pl.ammo_taurus + 10, MAX_A_TAURUS);
} else {
if (!new)
return (0);
}
#endif
return (1);
}
void
w_taurus_draw(player pl)
{
Weapons_SetModel("models/v_taurus.mdl");
Weapons_ViewAnimation(pl, TAURUS_DRAW);
}
void
w_taurus_holster(player pl)
{
Weapons_ViewAnimation(pl, TAURUS_HOLSTER);
}
void
w_taurus_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
/* ammo check */
if (!pl.taurus_mag)
return;
pl.taurus_mag--;
Weapons_ViewPunchAngle(pl, [-2,0,0]);
if (pl.taurus_mag) {
Weapons_ViewAnimation(pl, TAURUS_SHOOT);
} else {
Weapons_ViewAnimation(pl, TAURUS_SHOOT_EMPTY);
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f);
else
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f);
/* actual firing */
#ifdef CLIENT
View_AddEvent(w_pistol_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_SMALL);
#else
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 12, [0.01,0.01], WEAPON_TAURUS);
Sound_Play(pl, CHAN_WEAPON, "weapon_taurus.fire");
#endif
pl.w_attack_next = 0.25f;
pl.w_idle_next = 5.0f;
}
void
w_taurus_secondary(player pl)
{
}
void
w_taurus_reload(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.taurus_mag >= 10)
return;
if (pl.ammo_taurus <= 0)
return;
if (pl.taurus_mag) {
Weapons_ViewAnimation(pl, TAURUS_RELOAD);
} else {
Weapons_ViewAnimation(pl, TAURUS_RELOAD2);
}
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::taurus_mag, player::ammo_taurus, 10);
#endif
pl.w_attack_next = 2.0f;
pl.w_idle_next = 10.0f;
}
void
w_taurus_release(player pl)
{
int r;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.taurus_mag == 0 && pl.ammo_taurus > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0)
return;
r = floor(random(0,3));
switch (r) {
case 1:
Weapons_ViewAnimation(pl, TAURUS_IDLE2);
pl.w_idle_next = 2.25f;
break;
case 2:
Weapons_ViewAnimation(pl, TAURUS_IDLE3);
pl.w_idle_next = 2.5f;
break;
default:
Weapons_ViewAnimation(pl, TAURUS_IDLE1);
pl.w_idle_next = 2.81f;
break;
}
}
float
w_taurus_aimanim(player pl)
{
return w_glock_aimanim(pl);
}
void
w_taurus_hud(player pl)
{
w_glock_hud(pl);
}
void
w_taurus_hudpic(player pl, int selected, vector pos, float a)
{
w_glock_hudpic(pl, selected, pos, a);
}
int
w_taurus_isempty(player pl)
{
if (pl.taurus_mag <= 0 && pl.ammo_taurus <= 0)
return 1;
return 0;
}
weapontype_t
w_taurus_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_taurus =
{
.name = "taurus",
.id = ITEM_TAURUS,
.slot = 1,
.slot_pos = 3,
.weight = WEIGHT_TAURUS,
.draw = w_taurus_draw,
.holster = w_taurus_holster,
.primary = w_taurus_primary,
.secondary = w_taurus_secondary,
.reload = w_taurus_reload,
.release = w_taurus_release,
.postdraw = w_taurus_hud,
.precache = w_taurus_precache,
.pickup = w_taurus_pickup,
.updateammo = w_taurus_updateammo,
.wmodel = w_taurus_wmodel,
.pmodel = w_taurus_pmodel,
.deathmsg = w_taurus_deathmsg,
.aimanim = w_taurus_aimanim,
.isempty = w_taurus_isempty,
.type = w_taurus_type,
.hudpic = w_taurus_hudpic
};
/* pickups */
#ifdef SERVER
void
weapon_th_taurus(void)
{
Weapons_InitItem(WEAPON_TAURUS);
}
#endif

View file

@ -1,243 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
enum
{
HANDGRENADE_IDLE,
HANDGRENADE_FIDGET,
HANDGRENADE_PULLPIN,
HANDGRENADE_THROW1,
HANDGRENADE_THROW2,
HANDGRENADE_THROW3,
HANDGRENADE_HOLSTER,
HANDGRENADE_DRAW
};
void
w_tnt_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_handgrenade.bounce");
#endif
precache_model("models/v_tnt.mdl");
precache_model("models/w_tnt.mdl");
precache_model("models/p_tnt.mdl");
}
void
w_tnt_updateammo(player pl)
{
w_handgrenade_updateammo(pl);
}
string
w_tnt_wmodel(void)
{
return "models/w_tnt.mdl";
}
string
w_tnt_pmodel(player pl)
{
return "models/p_tnt.mdl";
}
string
w_tnt_deathmsg(void)
{
return w_handgrenade_deathmsg();
}
int
w_tnt_pickup(player pl, int new, int startammo)
{
return w_handgrenade_pickup(pl, new, startammo);
}
#ifdef SERVER
void
w_tnt_throw(player pl)
{
static void WeaponFrag_Throw_Explode(void) {
float dmg = Skill_GetValue("plr_hand_grenade", 100);
pointparticles(particleeffectnum("fx_explosion.main"), self.origin, [0,0,0], 1);
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_HANDGRENADE);
sound(self, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
remove(self);
}
static void WeaponFrag_Throw_Touch(void) {
if (other.takedamage == DAMAGE_YES)
Damage_Apply(other, self.owner, 15, WEAPON_HANDGRENADE, DMG_BLUNT);
else
Sound_Play(self, CHAN_BODY, "weapon_handgrenade.bounce");
self.frame = 0;
}
vector vPLAngle = pl.v_angle;
if (vPLAngle[0] < 0)
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
else
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
float flVel = (90 - vPLAngle[0]) * 5;
if (flVel > 1000)
flVel = 1000;
makevectors(vPLAngle);
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
vector vecThrow = v_forward * flVel + pl.velocity;
entity eGrenade = spawn();
eGrenade.owner = pl;
eGrenade.classname = "remove_me";
eGrenade.solid = SOLID_BBOX;
eGrenade.frame = 1;
eGrenade.velocity = vecThrow;
eGrenade.movetype = MOVETYPE_BOUNCE;
eGrenade.think = WeaponFrag_Throw_Explode;
eGrenade.touch = WeaponFrag_Throw_Touch;
eGrenade.nextthink = time + 4.0f;
setmodel(eGrenade, "models/w_tnt.mdl");
setsize(eGrenade, [0,0,0], [0,0,0]);
setorigin(eGrenade, vecSrc);
}
#endif
void
w_tnt_draw(player pl)
{
pl.mode_tempstate = 0;
Weapons_SetModel("models/v_tnt.mdl");
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
}
void
w_tnt_holster(player pl)
{
}
void
w_tnt_primary(player pl)
{
w_handgrenade_primary(pl);
}
void
w_tnt_hud(player pl)
{
#ifdef CLIENT
HUD_DrawAmmo2();
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
drawsubpic(aicon_pos, [16,24], "sprites/640hud7.spr_0.tga", [48/256,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
#endif
}
void
w_tnt_release(player pl)
{
if (pl.w_idle_next > 0.0)
return;
if (pl.mode_tempstate == 1) {
#ifdef SERVER
w_tnt_throw(pl);
#endif
Weapons_ViewAnimation(pl, HANDGRENADE_THROW1);
pl.ammo_handgrenade--;
pl.mode_tempstate = 2;
pl.w_attack_next = 1.0f;
pl.w_idle_next = 0.5f;
} else if (pl.mode_tempstate == 2) {
#ifdef SERVER
if (!pl.ammo_handgrenade)
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
#endif
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
pl.mode_tempstate = 0;
} else {
int r = (float)input_sequence % 8;
if (r == 1) {
Weapons_ViewAnimation(pl, HANDGRENADE_FIDGET);
pl.w_idle_next = 2.5f;
} else {
Weapons_ViewAnimation(pl, HANDGRENADE_IDLE);
pl.w_idle_next = 3.0f;
}
}
}
float
w_tnt_aimanim(player pl)
{
return w_handgrenade_aimanim(pl);
}
void
w_tnt_hudpic(player pl, int selected, vector pos, float a)
{
w_handgrenade_hudpic(pl, selected, pos, a);
}
int
w_tnt_isempty(player pl)
{
if (pl.ammo_handgrenade <= 0)
return 1;
return 0;
}
weapontype_t
w_tnt_type(player pl)
{
return WPNTYPE_RANGED;
}
weapon_t w_tnt =
{
.name = "tnt",
.id = ITEM_HANDGRENADE,
.slot = 4,
.slot_pos = 0,
.weight = WEIGHT_HANDGRENADE,
.draw = w_tnt_draw,
.holster = w_tnt_holster,
.primary = w_tnt_primary,
.secondary = w_tnt_release,
.reload = w_tnt_release,
.release = w_tnt_release,
.postdraw = w_tnt_hud,
.precache = w_tnt_precache,
.pickup = w_tnt_pickup,
.updateammo = w_tnt_updateammo,
.wmodel = w_tnt_wmodel,
.pmodel = w_tnt_pmodel,
.deathmsg = w_tnt_deathmsg,
.aimanim = w_tnt_aimanim,
.isempty = w_snark_isempty,
.type = w_snark_type,
.hudpic = w_tnt_hudpic
};

View file

@ -1,87 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* weapon Indices for the weapon table */
enum
{
WEAPON_NONE,
WEAPON_CROWBAR,
WEAPON_SHOVEL,
WEAPON_SPANNER,
WEAPON_GLOCK,
WEAPON_PYTHON,
WEAPON_AP9,
WEAPON_TAURUS,
WEAPON_MP5,
WEAPON_SHOTGUN,
WEAPON_CROSSBOW,
WEAPON_SNIPER,
WEAPON_SNIPER2,
WEAPON_RPG,
WEAPON_GAUSS,
WEAPON_EGON,
WEAPON_CHAINGUN,
WEAPON_HANDGRENADE,
WEAPON_SATCHEL,
WEAPON_TRIPMINE,
WEAPON_SNARK,
WEAPON_MEDKIT
};
enum
{
WEIGHT_NONE,
WEIGHT_MEDKIT,
WEIGHT_CROWBAR,
WEIGHT_SHOVEL,
WEIGHT_SPANNER,
WEIGHT_HANDGRENADE,
WEIGHT_SATCHEL,
WEIGHT_TRIPMINE,
WEIGHT_SNARK,
WEIGHT_GLOCK,
WEIGHT_PYTHON,
WEIGHT_AP9,
WEIGHT_TAURUS,
WEIGHT_MP5,
WEIGHT_SHOTGUN,
WEIGHT_CROSSBOW,
WEIGHT_SNIPER,
WEIGHT_SNIPER2,
WEIGHT_RPG,
WEIGHT_GAUSS,
WEIGHT_EGON,
WEIGHT_CHAINGUN
};
/* Medkit max ammo is 12 in stock, changed for multiplayer */
#define MAX_A_9MM 250
#define MAX_A_357 36
#define MAX_A_AP9 200
#define MAX_A_TAURUS 80
#define MAX_A_BUCKSHOT 125
#define MAX_A_M203_GRENADE 10
#define MAX_A_BOLT 50
#define MAX_A_SNIPER 50
#define MAX_A_ROCKET 5
#define MAX_A_URANIUM 100
#define MAX_A_GAS 100
#define MAX_A_HANDGRENADE 10
#define MAX_A_SATCHEL 5
#define MAX_A_TRIPMINE 10
#define MAX_A_SNARK 10
#define MAX_A_HORNET 8
#define MAX_A_MEDKIT 8

View file

@ -1,41 +0,0 @@
/*
* 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
weapon_t w_null = {};
weapon_t g_weapons[] = {
w_null,
w_crowbar,
w_shovel,
w_spanner,
w_silencer,
w_python,
w_ap9,
w_taurus,
w_mp5,
w_shotgun,
w_crossbow,
w_sniper,
w_sniper2,
w_rpg2,
w_gauss,
w_flame,
w_chaingun,
w_tnt,
w_satchel,
w_tripmine,
w_snark,
w_medkit
};

View file

@ -0,0 +1,53 @@
set sk_boss_health1 "2500"
set sk_boss_health2 "2500"
set sk_boss_health3 "2500"
set sk_cyberfranklin_health1 "1500"
set sk_cyberfranklin_health2 "1500"
set sk_cyberfranklin_health3 "1500"
set sk_zombiebull_health1 "350"
set sk_zombiebull_health2 "350"
set sk_zombiebull_health3 "350"
set sk_plr_ap9_bullet1 "8"
set sk_plr_ap9_bullet2 "8"
set sk_plr_ap9_bullet3 "8"
set sk_plr_chaingun1 "10"
set sk_plr_chaingun2 "10"
set sk_plr_chaingun3 "10"
set sk_plr_chainsaw1 "20"
set sk_plr_chainsaw2 "20"
set sk_plr_chainsaw3 "20"
set sk_plr_chainsaw_swing1 "50"
set sk_plr_chainsaw_swing2 "50"
set sk_plr_chainsaw_swing3 "50"
set sk_plr_egon1 "13"
set sk_plr_egon2 "13"
set sk_plr_egon3 "13"
set sk_plr_egon_afterburn1 "5"
set sk_plr_egon_afterburn2 "5"
set sk_plr_egon_afterburn3 "5"
set sk_plr_sniper_bullet1 "40"
set sk_plr_sniper_bullet2 "40"
set sk_plr_sniper_bullet3 "40"
// 10 in stock
set sk_plr_shovel1 "20"
set sk_plr_shovel2 "20"
set sk_plr_shovel3 "20"
// 10 in stock
set sk_plr_spanner1 "5"
set sk_plr_spanner2 "5"
set sk_plr_spanner3 "5"
set sk_plr_taurus_bullet1 "12"
set sk_plr_taurus_bullet2 "12"
set sk_plr_taurus_bullet3 "12"

View file

@ -0,0 +1,2 @@
exec "skill.cfg"
exec "skill_hunger.cfg"

View file

@ -0,0 +1,73 @@
#include "ammo/base.def"
#include "ammo/357.def"
#include "ammo/9mmAR.def"
#include "ammo/9mmbox.def"
#include "ammo/9mmclip.def"
#include "ammo/ap9.def"
#include "ammo/ARgrenades.def"
#include "ammo/buckshot.def"
#include "ammo/crossbow.def"
#include "ammo/gas.def"
#include "ammo/medkit.def"
#include "ammo/rpgclip.def"
#include "ammo/sniper.def"
#include "ammo/taurus.def"
// these have to be defined by the game.
entityDef ammo_types {
"ammo_none" "0"
"ammo_9mm" "1"
"ammo_357" "2"
"ammo_buckshot" "3"
"ammo_bolt" "4"
"ammo_rocket" "5"
"ammo_gas" "6"
"ammo_handgrenade" "7"
"ammo_satchel" "8"
"ammo_tripmine" "9"
"ammo_snark" "10"
"ammo_m203_grenade" "11"
"ammo_medkit" "12"
"ammo_ap9" "13"
"ammo_taurus" "14"
"ammo_sniper" "15"
}
entityDef ammo_names {
"ammo_none" "None"
"ammo_9mm" "9mm Bullets"
"ammo_357" ".357 Bullets"
"ammo_buckshot" "Buckshot Shells"
"ammo_bolt" "Bolts"
"ammo_rocket" "Rockets"
"ammo_gas" "Gas"
"ammo_handgrenade" "Hand Grenades"
"ammo_satchel" "Satchel Charge"
"ammo_tripmine" "Tripmines"
"ammo_snark" "Squeak Grenades"
"ammo_m203_grenade" "M203 Grenades"
"ammo_medkit" "Medkits"
"ammo_ap9" "AP9 Bullets"
"ammo_taurus" "Taurus Bullets"
"ammo_sniper" "Sniper Bullets"
}
entityDef ammo_max {
"ammo_none" "0"
"ammo_9mm" "250"
"ammo_357" "36"
"ammo_buckshot" "125"
"ammo_bolt" "50"
"ammo_rocket" "5"
"ammo_gas" "100"
"ammo_handgrenade" "10"
"ammo_satchel" "5"
"ammo_tripmine" "10"
"ammo_snark" "10"
"ammo_m203_grenade" "10"
"ammo_medkit" "10"
"ammo_ap9" "200"
"ammo_taurus" "80"
"ammo_sniper" "50"
}

View file

@ -0,0 +1,12 @@
entityDef ammo_th_ap9
{
"editor_usage" "THEY HUNGER (1999) ENTITY"
"editor_usage2" ""
"editor_usage3" "Ammo for the TEC-9 (AutoPistol), provides 40 Bullets."
"inherit" "ammo_base"
"model" "models/w_ap9clip.mdl"
"inv_ammo_ap9" "40"
}
// TODO ammo icon not working?

View file

@ -0,0 +1,11 @@
entityDef ammo_egonclip
{
"editor_usage" "THEY HUNGER (1999) ENTITY"
"editor_usage2" ""
"editor_usage3" "Ammo for the Flamethrower, provides 25 Gas."
"inherit" "ammo_base"
"model" "models/w_gas.mdl"
"snd_acquire" "ammo_gas.pickup"
"inv_ammo_gas" "25"
}

View file

@ -0,0 +1,13 @@
entityDef ammo_medkit
{
"editor_usage" "THEY HUNGER (1999) ENTITY"
"editor_usage2" ""
"editor_usage3" "Ammo for the Medkit, provides one Medkit."
"inherit" "ammo_base"
"model" "models/w_medkit.mdl"
"inv_ammo_medkit" "1"
"inv_weapon" "weapon_th_medkit"
}
// TODO ammo icon not working?

View file

@ -0,0 +1,17 @@
entityDef ammo_th_sniper
{
"editor_usage" "THEY HUNGER (1999) ENTITY"
"editor_usage2" ""
"editor_usage3" "Ammo for the Sniper Rifles, provides 5 Bullets."
"inherit" "ammo_base"
"model" "models/w_antidote.mdl"
"inv_ammo_sniper" "5"
}
entityDef ammo_einar1
{
"inherit" "ammo_th_sniper"
}
// TODO ammo icon not working?

View file

@ -0,0 +1,12 @@
entityDef ammo_th_taurus
{
"editor_usage" "THEY HUNGER (1999) ENTITY"
"editor_usage2" ""
"editor_usage3" "Ammo for the Taurus PT145, provides 10 Bullets."
"inherit" "ammo_base"
"model" "models/w_taurusclip.mdl"
"inv_ammo_taurus" "10"
}
// TODO ammo icon not working?

View file

@ -0,0 +1,33 @@
entityDef item_battery
{
"spawnclass" "ncItem"
"model" "models/w_battery.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"
"snd_acquire" "item.battery"
"snd_respawn" "item.respawn"
"inv_armor" "skill:battery"
"requires" "item_suit"
}
entityDef item_healthkit
{
"spawnclass" "ncItem"
"model" "models/w_medkit.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"
"snd_acquire" "item.healthkit"
"snd_respawn" "item.respawn"
"inv_health" "skill:healthkit"
}
entityDef item_suit
{
"spawnclass" "ncItem"
"model" "models/w_suit.mdl"
"mins" "-16 -16 0"
"maxs" "16 16 16"
"snd_acquire" "item.suit"
"snd_respawn" "item.respawn"
"inv_carry" "1"
}

View file

@ -0,0 +1,52 @@
#include "monsters/alien_controller.def"
#include "monsters/alien_grunt.def"
#include "monsters/alien_slave.def"
#include "monsters/apache.def"
#include "monsters/babycrab.def"
#include "monsters/babykelly.def"
#include "monsters/barnacle.def"
#include "monsters/barney.def"
#include "monsters/barney_dead.def"
#include "monsters/bigmomma.def"
#include "monsters/bloater.def"
#include "monsters/boss.def"
#include "monsters/bull.def"
#include "monsters/bullchicken.def"
#include "monsters/bullchicken_th.def"
#include "monsters/chicken.def"
#include "monsters/cockroach.def"
#include "monsters/cyberfranklin.def"
#include "monsters/dog.def"
#include "monsters/einar_civ.def"
#include "monsters/einar_civ_dead.def"
#include "monsters/einar_civ_sitting.def"
#include "monsters/einar_hand.def"
#include "monsters/frankenstein.def"
#include "monsters/flyer_flock.def"
#include "monsters/gargantua.def"
#include "monsters/gman.def"
#include "monsters/headcrab.def"
#include "monsters/headcrab_th.def"
#include "monsters/hevsuit_dead.def"
#include "monsters/hgrunt_dead.def"
#include "monsters/houndeye.def"
#include "monsters/human_assassin.def"
#include "monsters/human_grunt.def"
#include "monsters/ichthyosaur.def"
#include "monsters/leech.def"
#include "monsters/megasquid.def"
#include "monsters/miniturret.def"
#include "monsters/nihilanth.def"
#include "monsters/osprey.def"
#include "monsters/rat.def"
#include "monsters/scientist.def"
#include "monsters/scientist_dead.def"
#include "monsters/sheriff.def"
#include "monsters/skeleton.def"
#include "monsters/sentry.def"
#include "monsters/sitting_scientist.def"
#include "monsters/skeleton_dead.def"
#include "monsters/tentacle.def"
#include "monsters/tripmine.def"
#include "monsters/turret.def"
#include "monsters/zombie.def"

View file

@ -0,0 +1,8 @@
entityDef monster_th_babykelly
{
"spawnclass" "ncMonster"
"inherit" "monster_alien_slave"
"netname" "Small Skeleton"
"model" "models/babykelly.mdl"
"propdata" "actor_human"
}

View file

@ -0,0 +1,65 @@
entityDef monster_barney
{
"spawnclass" "ncTalkMonster"
"model" "models/barney.mdl"
"netname" "Barney"
"health" "skill:barney_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "0"
"propdata" "actor_human"
"def_attack_ranged" "ranged_barney_shot"
"attack_ranged_range" "1024"
"reload_count" "18"
"follow_on_use" "1"
"weapon_drawn" "0"
"body_on_draw" "1:2"
"speed_walk" "64"
"speed_run" "364"
"snd_pain" "monster_barney.pain"
"snd_death" "monster_barney.die"
"snd_ranged_attack" "weapon_glock.fire"
"snd_reload" "monster_human_grunt.reload"
"snd_thud" "monster_generic.thud"
"talk_answer" "!BA_ANSWER"
"talk_ask" "!BA_QUESTION"
"talk_ally_shoot" "!BA_SHOOT"
"talk_idle" "!BA_IDLE"
"talk_hearing" "!BA_HEAR"
"talk_smelling" "!BA_SMELL"
"talk_stare" "!BA_STARE"
"talk_survived" "!BA_WOUND"
"talk_wounded" "!BA_WOUND"
"talk_player_ask" "!BA_QUESTION"
"talk_player_greet" "!BA_HELLO"
"talk_player_idle" "!BA_IDLE"
"talk_player_wounded1" "!BA_CUREA"
"talk_player_wounded2" "!BA_CUREB"
"talk_player_wounded3" "!BA_CUREC"
"talk_unfollow" "!BA_WAIT"
"talk_follow" "!BA_OK"
"talk_stop_follow" "!BA_STOP"
"talk_deny_follow" "!BA_POK"
// pre-disaster
when "spawnflags" contains "256" {
"follow_on_use" "0"
}
// Zombie Cop
when "spawnflags" contains "64" {
"team" "2"
"follow_on_use" "0"
}
}
entityDef ranged_barney_shot
{
"damage" "skill:hgrunt_pellets"
"delay" "0.5"
}

View file

@ -0,0 +1,20 @@
entityDef monster_th_boss
{
"spawnclass" "ncMonster"
"model" "models/boss.mdl"
"netname" "Boss (Rockwood)"
"health" "skill:boss_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "2"
"propdata" "actor_alien"
"speed_walk" "72"
"speed_run" "72"
"snd_sight" "monster_boss.alert"
"snd_idle" "monster_boss.idle"
"snd_pain" "monster_boss.pain"
"snd_death" ""
}

View file

@ -0,0 +1,9 @@
entityDef monster_th_zombiebull
{
"spawnclass" "ncMonster"
"inherit" "monster_houndeye"
"netname" "Zombie Bull"
"health" "skill:zombiebull_health"
"model" "models/zombiebull.mdl"
"propdata" "actor_human"
}

View file

@ -0,0 +1,7 @@
entityDef monster_th_bullchicken
{
"spawnclass" "ncMonster"
"inherit" "monster_bullchicken"
"netname" "Zombie Bullchicken"
"propdata" "actor_human"
}

View file

@ -0,0 +1,7 @@
entityDef monster_th_chicken
{
"spawnclass" "ncMonster"
"inherit" "monster_headcrab"
"netname" "Zombie Chicken"
"model" "models/chicken.mdl"
}

View file

@ -0,0 +1,21 @@
entityDef monster_th_cyberfranklin
{
"spawnclass" "ncMonster"
"inherit" "monster_alien_grunt"
"model" "models/franklin2.mdl"
"netname" "Cyber Dr. Franklin"
"health" "skill:cyberfranklin_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "2"
"propdata" "actor_human"
"speed_walk" "72"
"speed_run" "72"
"snd_sight" "monster_cyberfranklin.alert"
"snd_idle" "monster_cyberfranklin.idle"
"snd_pain" "monster_cyberfranklin.pain"
"snd_death" ""
}

View file

@ -0,0 +1,7 @@
entityDef monster_th_dog
{
"spawnclass" "ncMonster"
"inherit" "monster_houndeye"
"netname" "Zombie Dog"
"propdata" "actor_human"
}

View file

@ -0,0 +1,9 @@
entityDef einar_civ
{
"spawnclass" "ncMonster"
"inherit" "monster_scientist"
"netname" "Civilian"
"model" "models/civ.mdl"
}

View file

@ -0,0 +1,9 @@
entityDef einar_civ_dead
{
"spawnclass" "ncMonster"
"inherit" "monster_scientist_dead"
"netname" "Civilian (Dead)"
"model" "models/civ.mdl"
}

View file

@ -0,0 +1,9 @@
entityDef einar_civ_sit
{
"spawnclass" "ncMonster"
"inherit" "monster_sitting_scientist"
"netname" "Civilian (Sitting)"
"model" "models/civ.mdl"
}

View file

@ -0,0 +1,7 @@
entityDef einar_hand
{
"spawnclass" "ncMonster"
"inherit" "monster_headcrab"
"netname" "Zombie Hand"
"model" "models/thehand.mdl"
}

View file

@ -0,0 +1,7 @@
entityDef monster_th_frankenstein
{
"spawnclass" "ncMonster"
"inherit" "monster_alien_grunt"
"netname" "Frankenstein's Monster"
"propdata" "actor_human"
}

View file

@ -0,0 +1,7 @@
entityDef monster_th_headcrab
{
"spawnclass" "ncMonster"
"inherit" "monster_headcrab"
"netname" "Zombie Heacrab"
"propdata" "actor_human"
}

View file

@ -0,0 +1,8 @@
entityDef monster_th_megasquid
{
"spawnclass" "ncMonster"
"inherit" "monster_bullsquid"
"netname" "Mega Bullsquid"
"model" "models/megasquid.mdl"
"propdata" "actor_human"
}

View file

@ -0,0 +1,8 @@
entityDef monster_th_sheriff
{
"spawnclass" "ncMonster"
"inherit" "monster_gman"
"netname" "Sheriff Chester Rockwood"
"team" "2"
"propdata" "actor_human"
}

View file

@ -0,0 +1,6 @@
entityDef monster_th_skeleton
{
"spawnclass" "ncMonster"
"inherit" "monster_alien_slave"
"netname" "Skeleton"
}

View file

@ -0,0 +1,73 @@
entityDef monster_zombie
{
"spawnclass" "ncMonster"
"model" "models/zombie.mdl"
"netname" "Zombie"
"health" "skill:zombie_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "2"
"propdata" "actor_human"
"speed_walk" "72"
"speed_run" "72"
"def_attack_melee" "melee_zombie_stab"
"melee_range" "96"
"snd_melee_attack" "monster_zombie.attack"
"snd_melee_attack_hit" "monster_zombie.attackhit"
"snd_melee_attack_miss" "monster_zombie.attackmiss"
"snd_thud" "monster_generic.thud"
when "message" equals "zombie" {
"snd_melee_attack" "monster_zombie.attack"
"snd_sight" "monster_zombie.alert"
"snd_idle" "monster_zombie.idle"
"snd_pain" "monster_zombie.pain"
"snd_death" ""
}
when "message" equals "zombiecop" {
"snd_melee_attack" "monster_zombie_zombiecop.attack"
"snd_sight" "monster_zombie_zombiecop.alert"
"snd_idle" "monster_zombie_zombiecop.idle"
"snd_pain" "monster_zombie_zombiecop.pain"
"snd_death" ""
}
when "message" equals "zombienew" {
"snd_melee_attack" "monster_zombie_zombienew.attack"
"snd_sight" "monster_zombie_zombienew.alert"
"snd_idle" "monster_zombie_zombienew.idle"
"snd_pain" "monster_zombie_zombienew.pain"
"snd_death" ""
}
when "message" equals "zfemale" {
"snd_melee_attack" "monster_zombie_zfemale.attack"
"snd_sight" "monster_zombie_zfemale.alert"
"snd_idle" "monster_zombie_zfemale.idle"
"snd_pain" "monster_zombie_zfemale.pain"
"snd_death" ""
}
when "message" equals "znusre" {
"snd_melee_attack" "monster_zombie_znurse.attack"
"snd_sight" "monster_zombie_znurse.alert"
"snd_idle" "monster_zombie_znurse.idle"
"snd_pain" "monster_zombie_znurse.pain"
"snd_death" ""
}
}
entityDef melee_zombie_stab
{
"damage" "skill:zombie_dmg_one_slash"
"delay" "0.25f"
"wait" "0.5"
"attempts" "2"
}

View file

@ -0,0 +1,22 @@
#include "weapons/357.def"
#include "weapons/9mmAR.def"
#include "weapons/ap9.def"
#include "weapons/chaingun.def"
#include "weapons/chainsaw.def"
#include "weapons/crossbow.def"
#include "weapons/crowbar.def"
#include "weapons/flamethrower.def"
#include "weapons/handgrenade.def"
#include "weapons/medkit.def"
#include "weapons/rpg.def"
#include "weapons/satchel.def"
#include "weapons/shotgun.def"
#include "weapons/shovel.def"
#include "weapons/silencer.def"
#include "weapons/snark.def"
#include "weapons/sniper.def"
#include "weapons/sniper2.def"
#include "weapons/spanner.def"
#include "weapons/taurus.def"
#include "weapons/tnt.def"
#include "weapons/tripmine.def"

View file

@ -0,0 +1,71 @@
entityDef weapon_th_ap9
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "TEC-9 (AutoPistol)"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_ap9.mdl"
"model_view" "models/v_ap9.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_ap9"
"def_altFireInfo" "fireInfo_altAP9"
"inv_name" "TEC-9 (AutoPistol)"
"clipSize" "40"
"ammoType" "ammo_ap9"
"punchAngle" "-2 0 0"
"act_fire" "3,4,5"
"actAltFire" "3,4,5"
// "act_holster" ""
"act_reload" "1"
"act_draw" "2"
"act_idle" "0"
"snd_fire" "weapon_ap9.fire"
"snd_altfire" "weapon_ap9.fire"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "1"
"hudSlotPos" "2"
"weight" "10"
}
entityDef projectile_ap9
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_ap9_bullet"
"spread" "0.01 0.01"
}
entityDef projectile_ap9_burst
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_ap9_bullet"
"spread" "0.02 0.02"
}
entityDef fireInfo_ap9
{
"def_onFire" "projectile_ap9"
"fireRate" "0.15"
"model_flash" "sprites/muzzleflash2.spr"
"ammoRequired" "1"
"ammoPerShot" "1"
}
entityDef fireInfo_altAP9
{
"def_onFire" "projectile_ap9_burst"
"fireRate" "1.0"
"model_flash" "sprites/muzzleflash2.spr"
"ammoRequired" "3"
"ammoPerShot" "3"
"hitscans" "3"
}

View file

@ -0,0 +1,65 @@
#define THAC_IDLE 0
#define THAC_IDLE2 1
#define THAC_SPIN_START 2
#define THAC_SPIN_STOP 3
#define THAC_SPIN_FIRE 4
#define THAC_DRAW 5
#define THAC_HOLSTER 6
entityDef weapon_th_chaingun
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Chain Gun"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_tfac.mdl"
"model_view" "models/v_tfac.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_chaingun"
"inv_name" "Chain Gun"
"clipSize" "100"
"ammoType" "ammo_9mm"
"ammoRequired" "2"
"ammoPerShot" "2"
"act_fireStart" "2"
"act_loop" "4"
"act_fireStop" "3"
"act_reload "6"
"act_reloadEnd" "5"
"act_idle" "0,1"
"act_draw" "5"
"snd_fireStart" "weapon_chaingun.start"
"snd_fireLoop" "weapon_chaingun.loop"
"snd_fireEnd" "weapon_chaingun.stop"
"snd_reload" "weapon_chaingun.reload"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "3"
"hudSlotPos" "3"
"weight" "30"
}
entityDef projectile_chaingun
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_chaingun"
"hitscans" "4"
"spread" "0.095 0.085"
}
entityDef fireInfo_chaingun
{
"def_onFire" "projectile_chaingun"
"fireRate" "0.1"
"punchAngle" "-2 0 0"
"model_flash" "sprites/muzzleflash2.spr"
}

View file

@ -0,0 +1,79 @@
entityDef weapon_th_chainsaw
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Chainsaw"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_weaponbox.mdl"
"model_view" "models/v_chainsaw.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"snd_idle" "weapon_chainsaw.idle"
"snd_draw" "weapon_chainsaw.draw"
// weapon specific
"def_fireInfo" "fireInfo_chainsaw"
"def_altFireInfo" "fireInfo_altChainsaw"
"testDistance" "48"
"inv_name" "Chainsaw"
"ammoType" ""
"ammoRequired" "0"
"act_idle" "0"
"act_draw" "5"
"act_draw1" "1"
"act_holster" "6"
"snd_hit" "weapon_chainsaw.hit"
"snd_failed" "weapon_chainsaw.miss"
// HLWeapon specific
"hudSlot" "0"
"hudSlotPos" "3"
"weight" "1"
"crosshair" "none"
"ammoIcon" "none"
}
// TODO fx_spark.main
entityDef projectile_chainsaw
{
"spawnclass" "ncProjectile"
"damage" "skill:plr_chainsaw"
"is_bullet" "1"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
}
entityDef projectile_chainsawSwing
{
"spawnclass" "ncProjectile"
"damage" "skill:plr_chainsaw_swing"
"is_bullet" "1"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
}
entityDef fireInfo_chainsaw
{
"def_onFire" "projectile_chainsaw"
"failRate" "0.8"
"fireRate" "0.1"
"act_fire" "3,4"
}
entityDef fireInfo_altChainsaw
{
"def_onFire" "projectile_chainsawSwing"
"failRate" "1.2"
"fireRate" "0.1"
"act_fire" "2"
}

View file

@ -0,0 +1,88 @@
entityDef weapon_egon
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Flamethrower"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_egon.mdl"
"model_view" "models/v_egon.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_flamethrower"
"inv_name" "Flamethrower"
"inv_ammo_gas" "20"
"ammoType" "ammo_gas"
"ammoRequired" "1"
"act_fire" "5,6,7,8"
"act_holster" "10"
"act_draw" "9"
"act_idle" "0,1"
"snd_fire" "weapon_egon.fire"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "3"
"hudSlotPos" "2"
"weight" "30"
}
// TODO sprite animation and ignite
entityDef projectile_fire
{
"spawnclass" "ncProjectile"
"model" "sprites/fthrow.spr"
"rendermode" "$RM_ADDITIVE"
"renderamt" "255"
"rendercolor" "255 255 255"
"animStartFrame" "0"
"animEndFrame" "15"
"animEndRemoves" "1"
"animFrameRate" "10"
"offset" "30 8 0"
"def_damage" "fireDirect"
"velocity" "200"
"angular_velocity" "0 0 0"
"detonate_on_fuse" "1"
"detonate_on_death" "1"
"detonate_on_world" "1"
"detonate_on_actor" "1"
"impact_damage_effect" "1"
"impact_gib" "1"
"thrust" "2000"
"thrust_start" "0.1"
"thrust_end" "2"
"light_color" "1 0.8 0.4"
"light_radius" "160"
"light_offset" "0 0 0"
}
entityDef damage_fireDirect
{
"damage" "skill:plr_egon"
}
entityDef damage_fireAfterburn
{
"damage" "skill:plr_egon_afterburn"
}
entityDef fireInfo_flamethrower
{
"def_onFire" "projectile_fire"
"ammoPerShot" "1"
"fireRate" "0.2"
"act_fire" "5,6"
"model_flash" "sprites/muzzleflash2.spr"
}

View file

@ -0,0 +1,46 @@
entityDef weapon_th_medkit
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Medkit"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/p_tfc_medkit.mdl"
"model_view" "models/v_tfc_medkit.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_melee" "damage_medkit"
"melee_distance" "0"
"inv_name" "Medikit"
"ammoType" "ammo_medkit"
"ammoRequired" "1"
"silent_fire" "1"
"meleeRateMiss" "0.35"
"meleeRateHit" "0.35"
"act_idle" "0,1"
"act_draw" "5"
"act_holster" "4"
"act_fireFailed" "3"
"act_fire" "2"
// HLWeapon specific
"hudSlot" "4"
"hudSlotPos" "4"
"weight" "30"
"crosshair" "none"
}
// TODO healing
entityDef damage_medkit
{
"snd_hitFlesh" "weapon_medkit.heal"
"inv_health" "skill:healthkit"
}

View file

@ -0,0 +1,105 @@
entityDef weapon_rpg
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Rocket Launcher"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_rpg.mdl"
"model_view" "models/v_rpg.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"def_fireInfo" "fireInfo_rpg"
// "def_altFireInfo" "fireInfo_rpg_homing"
"ammoType" "ammo_rocket"
"clipSize" "1"
"ammoRequired" "1"
"ammoPerShot" "1"
"inv_ammo_rocket" "1"
"fireRate" "2.5"
"act_idle" "0,1"
"act_idleEmpty" "8,9"
"act_holster" "4"
"act_holsterEmpty" "6"
"act_draw" "5"
"act_drawEmpty" "7"
"act_fire" "3"
"act_reload" "2"
// HLWeapon specific
"hudSlot" "3"
"hudSlotPos" "0"
"weight" "20"
// "altLaser" "1"
}
entityDef projectile_rocket
{
"spawnclass" "ncProjectile"
"model" "models/rpgrocket.mdl"
"def_damage" "damage_rocketDirect"
"def_splash_damage" "damage_rocketSplash"
"health" "0"
"velocity" "250"
"angular_velocity" "0 0 200"
"fuse" "10"
"detonate_on_fuse" "0"
"detonate_on_death" "1"
"detonate_on_world" "1"
"detonate_on_actor" "1"
"impact_damage_effect" "1"
"impact_gib" "1"
"thrust" "2000"
"thrust_start" "0.1"
"thrust_end" "2"
"smoke_fly" "weapon_rpg.trail"
"decal_detonate" "ExplosionScorch"
"model_detonate" "fx_explosion.main"
"light_color" "1 0.8 0.4"
"light_radius" "160"
"light_offset" "0 0 0"
"explode_light_color" "2 1.6 0.8"
"explode_light_radius" "320"
"explode_light_fadetime" "0.5"
"snd_explode" "fx.explosion"
}
entityDef projectile_rocket_homing
{
"inherit" "projectile_rocket"
"thrust_homing" "1"
}
entityDef damage_rocketDirect
{
"damage" "skill:plr_rocketlauncher_impact"
"damage_random" "skill:plr_rocketlauncher_impact_rand"
}
entityDef damage_rocketSplash
{
"damage" "skill:plr_rpg"
"radius" "250"
}
entityDef fireInfo_rpg
{
"def_onFire" "projectile_rocket"
"punchAngle" "-10 0 0"
}
entityDef fireInfo_rpg_homing
{
"def_onFire" "projectile_rocket_homing"
"punchAngle" "-10 0 0"
}

View file

@ -0,0 +1,50 @@
entityDef weapon_th_shovel
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Shovel"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_shovel.mdl"
"model_view" "models/v_shovel.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_onFire" "projectile_shovel"
"testDistance" "-48"
"inv_name" "Shovel"
"ammoRequired" "0"
"silent_fire" "1"
"punchAngle" "-3 0 0"
"failRate" "0.85"
"fireRate" "0.85"
"snd_hit" "weapon_shovel.hit"
"snd_hitFlesh" "weapon_shovel.hitbody"
"snd_failed" "weapon_shovel.miss"
"act_idle" "0"
"act_draw" "1"
"act_holster" "2"
"act_fireFailed" "4,5,7"
"act_fire" "3,6,8"
// HLWeapon specific
"hudSlot" "0"
"hudSlotPos" "1"
"weight" "0"
"crosshair" "none"
"ammoIcon" "none"
}
entityDef projectile_shovel
{
"spawnclass" "ncProjectile"
"damage" "skill:plr_shovel"
"is_bullet" "1"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
}

View file

@ -0,0 +1,74 @@
entityDef weapon_9mmhandgun
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Beretta 92 (Silencer)"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_9mmhandgun.mdl"
"model_view" "models/v_9mmhandgun.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_glock"
"def_altFireInfo" "fireInfo_altGlock"
"inv_name" "Beretta 92 (Silencer)"
"clipSize" "17"
"ammoType" "ammo_9mm"
"ammoRequired" "1"
"ammoPerShot" "1"
"punchAngle" "-2 0 0"
"act_fire" "3"
"act_fireLast" "4"
"act_holster" "8"
"act_reload" "6"
"act_reloadEmpty" "5"
"act_draw" "7"
"act_idle" "0,1,2"
"altMode" "1"
"act_modeOn" "8"
"act_modeOff" "9"
"snd_empty" "weapon_glock.empty"
// HLWeapon specific
"hudSlot" "1"
"hudSlotPos" "0"
"weight" "10"
}
entityDef projectile_glock
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_9mm_bullet"
"spread" "0.01 0.01"
}
entityDef projectile_glock_fast
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_9mm_bullet"
"spread" "0.1 0.1"
}
entityDef fireInfo_glock
{
"snd_fire" "weapon_glock.silencer"
"def_onFire" "projectile_glock"
"fireRate" "0.35"
"model_flash" "sprites/muzzleflash2.spr"
"view_geomset" "geomset 2 2\n"
}
entityDef fireInfo_altGlock
{
"snd_fire" "Weapon_Glock.Single"
"def_onFire" "projectile_glock_fast"
"fireRate" "0.2"
"model_flash" "sprites/muzzleflash2.spr"
"view_geomset" "geomset 2 0\n"
}

View file

@ -0,0 +1,70 @@
entityDef weapon_einar1
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Sniper Rifle"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_isotopebox.mdl"
"model_view" "models/v_tfc_sniper.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_sniper"
"def_altFireInfo" "fireInfo_altSniper"
"inv_name" "Sniper Rifle"
"clipSize" "5"
"ammoType" "ammo_sniper"
"ammoRequired" "1"
"ammoPerShot" "1"
"altMode" "1"
"act_fire" "2"
"act_holster" "4"
"act_draw" "3"
"act_idle" "0,5"
"act_reload" "4"
"act_reload2" "3"
"snd_fire" "weapon_sniper.fire"
"snd_reload" "weapon_sniper.reload"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "2"
"hudSlotPos" "3"
"weight" "20"
}
entityDef projectile_sniperBullet
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_sniper_bullet"
"spread" "0.008 0.008"
}
entityDef fireInfo_sniper
{
"def_onFire" "projectile_sniperBullet"
"ammoType" "ammo_sniper"
"fireRate" "0.1"
"punchAngle" "-20 0 0"
"model_flash" "sprites/muzzleflash1.spr"
}
entityDef fireInfo_altSniper
{
"def_onFire" "projectile_sniperBullet"
"ammoType" "ammo_sniper"
"fireRate" "0.8"
"punchAngle" "-5 0 0"
"model_flash" "sprites/muzzleflash1.spr"
"zoomFov" "20"
// "zoomColor" "0 0.2 0" TODO
// "zoomCrosshair" "weapon_th_sniper.zoom" TODO
}

View file

@ -0,0 +1,37 @@
entityDef weapon_th_sniper
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Heckler & Koch G36"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_hkg36.mdl"
"model_view" "models/v_hkg36.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_sniper"
"def_altFireInfo" "fireInfo_altSniper"
"inv_name" "Heckler & Koch G36"
"clipSize" "5"
"ammoType" "ammo_sniper"
"ammoRequired" "1"
"ammoPerShot" "1"
"altMode" "1"
"act_fire" "3"
"act_draw" "2"
"act_idle" "0"
"act_reload" "1"
"snd_fire" "weapon_sniper.fire"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "2"
"hudSlotPos" "3"
"weight" "20"
}

View file

@ -0,0 +1,49 @@
entityDef weapon_th_spanner
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Wrench"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/backpack.mdl"
"model_view" "models/v_tfc_spanner.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_onFire" "projectile_spanner"
"testDistance" "-32"
"inv_name" "Wrench"
"ammoRequired" "0"
"silent_fire" "1"
"act_idle" "0"
"act_draw" "4"
"act_holster" "5"
"act_fireFailed" "1,2"
"act_fire" "1,2"
// HLWeapon specific
"hudSlot" "0"
"hudSlotPos" "2"
"weight" "0"
"crosshair" "none"
"ammoIcon" "none"
}
entityDef projectile_spanner
{
"spawnclass" "ncProjectile"
"damage" "skill:plr_spanner"
"is_bullet" "1"
"range" "32"
"decal_impact" "Impact.Shot"
"detonate_on_world" "1"
"failRate" "0.375"
"fireRate" "0.2"
"snd_hitWorld" "weapon_spanner.hit"
"snd_hitBody" "weapon_spanner.hitbody"
"snd_fireFailed" "weapon_spanner.miss"
}

View file

@ -0,0 +1,53 @@
entityDef weapon_th_taurus
{
"editor_color" ".3 .3 1"
"editor_mins" "-16 -16 -16"
"editor_maxs" "16 16 16"
"editor_usage" "Taurus PT145"
"editor_rotatable" "1"
"spawnclass" "HLWeapon"
"model" "models/w_taurus.mdl"
"model_view" "models/v_taurus.mdl"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
// weapon specific
"def_fireInfo" "fireInfo_taurus"
"inv_name" "Taurus PT145"
"clipSize" "10"
"ammoType" "ammo_taurus"
"ammoRequired" "1"
"ammoPerShot" "1"
"punchAngle" "-2 0 0"
"act_fire" "3,4,5"
"act_fireLast" "6"
"act_holster" "10"
"act_reload" "7,8"
"act_draw" "9"
"act_idle" "0,1,2"
"snd_fire" "weapon_taurus.fire"
"snd_empty" "weapon.empty"
// HLWeapon specific
"hudSlot" "1"
"hudSlotPos" "3"
"weight" "10"
}
entityDef projectile_taurus
{
"inherit" "projectile_bullet_base"
"damage" "skill:plr_taurus_bullet"
"spread" "0.01 0.01"
}
entityDef fireInfo_taurus
{
"snd_fire" "weapon_taurus.fire"
"def_onFire" "projectile_taurus"
"fireRate" "0.25"
"model_flash" "sprites/muzzleflash2.spr"
}

View file

@ -0,0 +1,27 @@
entityDef weapon_tnt
{
"inherit" "weapon_handgrenade"
"model" "models/w_tnt.mdl"
"model_view" "models/v_tnt.mdl"
"inv_name" "TNT"
"inv_weapon" "weapon_tnt"
"def_onRelease" "projectile_tnt"
// HLWeapon specific
"hudSlot" "4"
"hudSlotPos" "0"
"weight" "5"
"crosshair" "none"
"ammoIcon" "weapon_handgrenade.ammo"
"icon" "weapon_handgrenade.weapon"
"iconSelected" "weapon_handgrenade.weapon_s"
}
entityDef projectile_tnt
{
"inherit" "projectile_handgrenade"
"model" "models/w_tnt.mdl"
}

View file

@ -0,0 +1,148 @@
monster_zombie.alert
{
sample zombie/zo_alert10.wav
sample zombie/zo_alert20.wav
sample zombie/zo_alert30.wav
}
monster_zombie.attack
{
sample zombie/zo_attack1.wav
sample zombie/zo_attack2.wav
}
monster_zombie.attackhit
{
sample zombie/claw_strike1.wav
sample zombie/claw_strike2.wav
sample zombie/claw_strike3.wav
}
monster_zombie.attackmiss
{
sample zombie/claw_miss1.wav
sample zombie/claw_miss2.wav
}
monster_zombie.idle
{
sample zombie/zo_idle1.wav
sample zombie/zo_idle2.wav
sample zombie/zo_idle3.wav
sample zombie/zo_idle4.wav
}
monster_zombie.pain
{
sample zombie/zo_pain1.wav
sample zombie/zo_pain2.wav
}
monster_zombie_zombiecop.alert
{
sample zombiecop/zo_alert10.wav
sample zombiecop/zo_alert20.wav
sample zombiecop/zo_alert30.wav
}
monster_zombie_zombiecop.attack
{
sample zombiecop/zo_attack1.wav
sample zombiecop/zo_attack2.wav
}
monster_zombie_zombiecop.idle
{
sample zombiecop/zo_idle1.wav
sample zombiecop/zo_idle2.wav
sample zombiecop/zo_idle3.wav
sample zombiecop/zo_idle4.wav
}
monster_zombie_zombiecop.pain
{
sample zombiecop/zo_pain1.wav
sample zombiecop/zo_pain2.wav
}
monster_zombie_zombienew.alert
{
sample zombienew/zo_alert10.wav
sample zombienew/zo_alert20.wav
sample zombienew/zo_alert30.wav
}
monster_zombie_zombienew.attack
{
sample zombienew/zo_attack1.wav
sample zombienew/zo_attack2.wav
}
monster_zombie_zombienew.idle
{
sample zombienew/zo_idle1.wav
sample zombienew/zo_idle2.wav
sample zombienew/zo_idle3.wav
sample zombienew/zo_idle4.wav
}
monster_zombie_zombienew.pain
{
sample zombienew/zo_pain1.wav
sample zombienew/zo_pain2.wav
}
monster_zombie_zfemale.alert
{
sample zfemale/zo_alert10.wav
sample zfemale/zo_alert20.wav
sample zfemale/zo_alert30.wav
}
monster_zombie_zfemale.attack
{
sample zfemale/zo_attack1.wav
sample zfemale/zo_attack2.wav
}
monster_zombie_zfemale.idle
{
sample zfemale/zo_idle1.wav
sample zfemale/zo_idle2.wav
sample zfemale/zo_idle3.wav
sample zfemale/zo_idle4.wav
}
monster_zombie_zfemale.pain
{
sample zfemale/zo_pain1.wav
sample zfemale/zo_pain2.wav
}
monster_zombie_znurse.alert
{
sample znurse/zo_alert10.wav
sample znurse/zo_alert20.wav
sample znurse/zo_alert30.wav
}
monster_zombie_znurse.attack
{
sample znurse/zo_attack1.wav
sample znurse/zo_attack2.wav
}
monster_zombie_znurse.idle
{
sample znurse/zo_idle1.wav
sample znurse/zo_idle2.wav
sample znurse/zo_idle3.wav
sample znurse/zo_idle4.wav
}
monster_zombie_znurse.pain
{
sample znurse/zo_pain1.wav
sample znurse/zo_pain2.wav
}

View file

@ -4,7 +4,7 @@ weapon_ap9.fire
sample weapons/ap9_fire.wav
}
weapon_chaingun.fire
weapon_chaingun.loop
{
alerts
sample weapons/asscan2.wav
@ -15,22 +15,16 @@ weapon_chaingun.reload
sample weapons/reload3.wav
}
weapon_chaingun.spindown
weapon_chaingun.stop
{
sample weapons/asscan3.wav
}
weapon_chaingun.spinup
weapon_chaingun.start
{
sample weapons/asscan1.wav
}
weapon_chainsaw.attack
{
alerts
sample weapons/chainsaw_attack.wav
}
weapon_chainsaw.draw
{
alerts
@ -43,7 +37,7 @@ weapon_chainsaw.hit
sample weapons/chainsaw_cutinto.wav
}
weapon_chainsaw.hitflesh
weapon_chainsaw.hitbody
{
alerts
sample weapons/chainsaw_cutintoflesh.wav
@ -55,30 +49,58 @@ weapon_chainsaw.idle
sample weapons/chainsaw_idle.wav
}
weapon_chainsaw.startup
weapon_chainsaw.miss
{
sample weapons/chainsaw_attack.wav
}
weapon_chainsaw.start
{
alerts
sample weapons/chainsaw_startup.wav
}
weapon_medkit.heal
{
alerts
sample items/smallmedkit1.wav
}
weapon_flame.fire
weapon_egon.fire
{
alerts
sample weapons/flmfire2.wav
}
weapon_silencer.fire
weapon_glock.silencer
{
sample weapons/pl_gun1.wav
sample weapons/pl_gun2.wav
}
weapon_medkit.heal
{
sample items/smallmedkit1.wav
}
weapon_shovel.hit
{
alerts
shakes 0.2
pitch 0.7
sample debris/metal6.wav
}
weapon_shovel.hitbody
{
alerts
shakes 0.2
pitch 0.8
sample weapons/cbar_hitbod1.wav
sample weapons/cbar_hitbod2.wav
sample weapons/cbar_hitbod3.wav
}
weapon_shovel.miss
{
pitch 0.5
sample weapons/cbar_miss1.wav
}
weapon_sniper.fire
{
alerts
@ -90,6 +112,29 @@ weapon_sniper.reload
sample weapons/reload3.wav
}
weapon_spanner.hit
{
alerts
pitch 1.2
sample weapons/cbar_hit1.wav
sample weapons/cbar_hit2.wav
}
weapon_spanner.hitbody
{
alerts
pitch 1.2
sample weapons/cbar_hitbod1.wav
sample weapons/cbar_hitbod2.wav
sample weapons/cbar_hitbod3.wav
}
weapon_spanner.miss
{
pitch 1.2
sample weapons/cbar_miss1.wav
}
weapon_taurus.fire
{
alerts

View file

@ -0,0 +1,17 @@
enhanced_overrides
{
when-serverinfo *bspversion equals 30
replace item_healthkit ammo_medkit
replace weapon_handgrenade weapon_tnt
}
npc_overrides
{
when-serverinfo *bspversion equals 30
replace monster_alien_grunt monster_th_frankenstein
replace monster_alien_slave monster_th_skeleton
replace monster_bullchicken monster_th_bullchicken
replace monster_gman monster_th_sheriff
replace monster_headcrab monster_th_headcrab
replace monster_houndeye monster_th_dog
}