Xylemon here, glad to finally be commiting here!

Changelog:

Improved Glock/Silencer animation logic
All weapons that should have shell ejection now do
Added simple logic for different scope colors for each sniper rifle
Updated weapon API to match current spec (Flamethrower now uses NSProjectile, fixed ammo detection, etc)
Made RPG inherit all duplicate HL functions
Added weapon weights and types for bots
New notification API forked to account for TH weapons/ammo
Updated copyright notices and added some additional info to the README
This commit is contained in:
Xylemon 2022-03-15 00:48:01 -07:00
parent 6fc17211c5
commit cadadedc72
28 changed files with 12031 additions and 358 deletions

View File

@ -1,4 +1,4 @@
# FreeHunger
# FreeHunger (AKA Still Hungry)
Clean-room reimplementation of They Hunger in QuakeC.
![Preview 1](img/preview1.jpg)
@ -16,6 +16,30 @@ then either run Nuclide's ./build_game.sh shell script, or issue 'make' inside
Obviously make sure that Nuclide has fteqw and fteqcc set-up for building.
## 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.
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:
- 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.
- th_shovelstyle 0/1 (default 0)
Gives the shovel visual first person effects, and slows down its attack.
- th_rpgstyle 0/1 (default 0)
Removes the homing secondary toggle making it similar to a real RPG.
You can enable these new CVARs with "exec mp_enhanced.cfg" in console.
## Community
### Matrix
@ -32,9 +56,9 @@ We've had people ask in the oddest of places for help, please don't do that.
## License
ISC License
Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
Copyright (c) 2016-2022 Marco Cawthorne <marco@icculus.org>
Copyright (c) 2019-2020 Gethyn ThomasQuail <xylemon@posteo.net>
Copyright (c) 2019-2022 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

3
mp_enhanced.cfg Normal file
View File

@ -0,0 +1,3 @@
th_medkitstyle 1
serverinfo th_rpgstyle 1
serverinfo th_shovelstyle 1

View File

@ -0,0 +1,137 @@
#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

@ -0,0 +1,89 @@
#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

@ -32,9 +32,9 @@ init.qc
../../../valve/src/client/viewmodel.qc
../../../valve/src/client/view.qc
../../../valve/src/client/obituary.qc
../../../valve/src/client/hud_ammonotify.qc
hud_ammonotify.qc
../../../valve/src/client/hud_dmgnotify.qc
../../../valve/src/client/hud_itemnotify.qc
hud_itemnotify.qc
../../../valve/src/client/hud.qc
../../../valve/src/client/hud_weaponselect.qc
../../../valve/src/client/scoreboard.qc

View File

@ -28,7 +28,7 @@ weapons.h
../../../valve/src/shared/w_handgrenade.qc
../../../valve/src/shared/w_mp5.qc
../../../valve/src/shared/w_python.qc
w_rpg.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
@ -38,6 +38,7 @@ w_chaingun.qc
w_flame.qc
w_silencer.qc
w_medkit.qc
w_rpg.qc
w_shovel.qc
w_sniper.qc
w_sniper2.qc

View File

@ -88,8 +88,8 @@ class player:base_player
PREDICTED_INT(ammo_ap9);
PREDICTED_INT(ammo_taurus);
PREDICTED_INT(ammo_sniper);
PREDICTED_INT(ammo_medkit);
PREDICTED_INT(ammo_gas);
PREDICTED_INT(ammo_medkit);
PREDICTED_INT(mode_silencer);
#ifdef CLIENT
@ -163,8 +163,8 @@ player::ReceiveEntity(float new, float fl)
ammo_ap9 = readbyte();
ammo_taurus = readbyte();
ammo_sniper = readbyte();
ammo_medkit = readbyte();
ammo_gas = readbyte();
ammo_medkit = readbyte();
}
if (fl & PLAYER_AMMO3) {
@ -248,8 +248,8 @@ player::PredictPreFrame(void)
SAVE_STATE(ammo_ap9);
SAVE_STATE(ammo_taurus);
SAVE_STATE(ammo_sniper);
SAVE_STATE(ammo_medkit);
SAVE_STATE(ammo_gas);
SAVE_STATE(ammo_medkit);
SAVE_STATE(mode_silencer);
}
@ -306,8 +306,8 @@ player::PredictPostFrame(void)
ROLL_BACK(ammo_ap9);
ROLL_BACK(ammo_taurus);
ROLL_BACK(ammo_sniper);
ROLL_BACK(ammo_medkit);
ROLL_BACK(ammo_gas);
ROLL_BACK(ammo_medkit);
ROLL_BACK(mode_silencer);
}
@ -376,10 +376,10 @@ player::EvaluateEntity(void)
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_sniper))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_medkit))
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;
@ -432,8 +432,8 @@ player::EvaluateEntity(void)
SAVE_STATE(ammo_ap9);
SAVE_STATE(ammo_taurus);
SAVE_STATE(ammo_sniper);
SAVE_STATE(ammo_medkit);
SAVE_STATE(ammo_gas);
SAVE_STATE(ammo_medkit);
SAVE_STATE(mode_silencer);
}
@ -511,8 +511,8 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, ammo_ap9);
WriteByte(MSG_ENTITY, ammo_taurus);
WriteByte(MSG_ENTITY, ammo_sniper);
WriteByte(MSG_ENTITY, ammo_medkit);
WriteByte(MSG_ENTITY, ammo_gas);
WriteByte(MSG_ENTITY, ammo_medkit);
}
if (fChanged & PLAYER_AMMO3) {

View File

@ -25,6 +25,38 @@ enum
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)
{
@ -70,12 +102,14 @@ w_ap9_pickup(int new, int startammo)
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 (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);
@ -126,6 +160,7 @@ w_ap9_primary(void)
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);
@ -169,6 +204,7 @@ w_ap9_secondary(void)
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);
@ -271,12 +307,30 @@ w_ap9_hudpic(int selected, vector pos, float a)
#endif
}
int
w_ap9_isempty(void)
{
player pl = (player)self;
if (pl.ap9_mag <= 0 && pl.ammo_ap9 <= 0)
return 1;
return 0;
}
weapontype_t
w_ap9_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_ap9 =
{
.name = "ap9",
.id = ITEM_AP9,
.id = ITEM_AP9,
.slot = 1,
.slot_pos = 2,
.weight = WEIGHT_AP9,
.draw = w_ap9_draw,
.holster = w_ap9_holster,
.primary = w_ap9_primary,
@ -291,6 +345,8 @@ weapon_t w_ap9 =
.pmodel = w_ap9_pmodel,
.deathmsg = w_ap9_deathmsg,
.aimanim = w_ap9_aimanim,
.isempty = w_ap9_isempty,
.type = w_ap9_type,
.hudpic = w_ap9_hudpic
};

View File

@ -27,6 +27,38 @@ enum
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)
{
@ -49,12 +81,14 @@ w_chaingun_pickup(int new, int startammo)
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 (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);
@ -180,6 +214,7 @@ w_chaingun_primary(void)
Weapons_ViewPunchAngle([random(-2, 2),0,0]);
#ifdef CLIENT
View_AddEvent(w_chaingun_ejectshell, 0.0f);
View_SetMuzzleflash(MUZZLE_RIFLE);
#else
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.15,0.15], WEAPON_CHAINGUN);
@ -269,12 +304,30 @@ w_chaingun_hudpic(int selected, vector pos, float a)
#endif
}
int
w_chaingun_isempty(void)
{
player pl = (player)self;
if (pl.chaingun_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
return 0;
}
weapontype_t
w_chaingun_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_chaingun =
{
.name = "chaingun",
.id = ITEM_CHAINGUN,
.id = ITEM_CHAINGUN,
.slot = 3,
.slot_pos = 3,
.weight = WEIGHT_CHAINGUN,
.draw = w_chaingun_draw,
.holster = w_chaingun_holster,
.primary = w_chaingun_primary,
@ -289,6 +342,8 @@ weapon_t w_chaingun =
.pmodel = w_chaingun_pmodel,
.deathmsg = w_chaingun_deathmsg,
.aimanim = w_chaingun_aimanim,
.isempty = w_chaingun_isempty,
.type = w_chaingun_type,
.hudpic = w_chaingun_hudpic
};

View File

@ -71,10 +71,12 @@ w_flame_pickup(int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (pl.ammo_gas < MAX_A_GAS) {
pl.ammo_gas = bound(0, pl.ammo_gas + 20, MAX_A_GAS);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);
@ -92,23 +94,6 @@ w_flame_holster(void)
w_egon_holster();
}
#ifdef SERVER
void
Flame_Touch(void)
{
if (other.takedamage != DAMAGE_YES) {
remove(self);
return;
}
/* anything else that can take damage */
Damage_Apply(other, self.owner, 40, WEAPON_EGON, DMG_BURN);
remove(self);
}
#endif
void
w_flame_primary(void)
{
@ -129,23 +114,38 @@ w_flame_primary(void)
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
#else
static void w_flame_die(void) {
remove(self);
}
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);
}
// 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");
NSProjectile ball = spawn(NSProjectile);
ball.SetModel("sprites/fthrow.spr");
ball.SetRenderMode(RM_ADDITIVE);
ball.SetOwner(pl);
ball.SetImpact(w_flame_touch);
ball.think = w_flame_die;
ball.nextthink = time + 1.75f;
// 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();
entity flame = spawn();
setmodel(flame, "sprites/fthrow.spr");
setorigin(flame, Weapons_GetCameraPos() + (v_forward * 16));
flame.owner = self;
flame.velocity = v_forward * 300;
flame.movetype = MOVETYPE_FLYMISSILE;
flame.solid = SOLID_BBOX;
//flame.flags |= FL_LAGGEDMOVE;
flame.angles = vectoangles(flame.velocity);
flame.avelocity[2] = 10;
flame.touch = Flame_Touch;
/*frame.think = Flame_Touch;
flame.nextthink = time + 2.0f;*/
flame.effects |= EF_BRIGHTLIGHT;
setsize(flame, [0,0,0], [0,0,0]);
ball.SetOrigin(Weapons_GetCameraPos() + (v_forward * 16));
ball.SetVelocity(v_forward * 300);
setsize(ball, [0,0,0], [0,0,0]);
#endif
pl.w_attack_next = 0.2f;
@ -222,12 +222,30 @@ w_flame_hudpic(int selected, vector pos, float a)
#endif
}
int
w_flame_isempty(void)
{
player pl = (player)self;
if (pl.ammo_gas <= 0)
return 1;
return 0;
}
weapontype_t
w_flame_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_flame =
{
.name = "flame",
.id = ITEM_EGON,
.id = ITEM_EGON,
.slot = 3,
.slot_pos = 2,
.weight = WEIGHT_EGON,
.draw = w_flame_draw,
.holster = w_egon_holster,
.primary = w_flame_primary,
@ -242,5 +260,7 @@ weapon_t w_flame =
.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

@ -67,17 +67,18 @@ w_medkit_pickup(int new, int startammo)
player pl = (player)self;
if (new) {
if (cvar("th_medkitstyle") == 1) {
if (cvar("th_medkitstyle") == 1)
pl.ammo_medkit = 1;
} else {
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 (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);
@ -213,12 +214,30 @@ w_medkit_hudpic(int selected, vector pos, float a)
#endif
}
int
w_medkit_isempty(void)
{
player pl = (player)self;
if (pl.ammo_medkit <= 0)
return 1;
return 0;
}
weapontype_t
w_medkit_type(void)
{
return WPNTYPE_CLOSE;
}
weapon_t w_medkit =
{
.name = "medkit",
.id = ITEM_MEDKIT2,
.id = ITEM_MEDKIT2,
.slot = 4,
.slot_pos = 4,
.weight = WEIGHT_MEDKIT,
.draw = w_medkit_draw,
.holster = __NULL__,
.primary = w_medkit_primary,
@ -233,6 +252,8 @@ weapon_t w_medkit =
.pmodel = w_medkit_pmodel,
.deathmsg = w_medkit_deathmsg,
.aimanim = w_medkit_aimanim,
.isempty = w_medkit_isempty,
.type = w_medkit_type,
.hudpic = w_medkit_hudpic
};

View File

@ -38,7 +38,7 @@ enum
};
void
w_rpg_precache(void)
w_rpg2_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_rpg.shoot");
@ -52,188 +52,67 @@ w_rpg_precache(void)
}
void
w_rpg_updateammo(player pl)
w_rpg2_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, -1);
w_rpg_updateammo(pl);
}
string
w_rpg_wmodel(void)
w_rpg2_wmodel(void)
{
return "models/w_rpg.mdl";
return w_rpg_wmodel();
}
string
w_rpg_pmodel(void)
w_rpg2_pmodel(void)
{
return "models/p_rpg.mdl";
return w_rpg_pmodel();
}
string
w_rpg_deathmsg(void)
w_rpg2_deathmsg(void)
{
return "";
return w_rpg_deathmsg();
}
int
w_rpg_pickup(int new, int startammo)
w_rpg2_pickup(int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.rpg_mag = 1;
} else {
if (pl.ammo_rocket < MAX_A_ROCKET) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
} else {
return (0);
}
}
#endif
return (1);
return w_rpg_pickup(new, startammo);
}
void
w_rpg_draw(void)
w_rpg2_draw(void)
{
Weapons_SetModel("models/v_rpg.mdl");
Weapons_ViewAnimation(RPG_DRAW1);
w_rpg_draw();
}
void
w_rpg_holster(void)
w_rpg2_holster(void)
{
}
void
w_rpg_primary(void)
w_rpg2_primary(void)
{
player pl = (player)self;
if (pl.w_attack_next > 0.0)
return;
/* Ammo check */
if (pl.rpg_mag <= 0)
return;
pl.rpg_mag--;
Weapons_ViewAnimation(RPG_FIRE2);
Weapons_ViewPunchAngle([-10,0,0]);
#ifdef SERVER
static void Rocket_Touch(void) {
float dmg = Skill_GetValue("plr_rpg", 100);
FX_Explosion(self.origin);
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_RPG);
sound(self, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
remove(self);
}
static void Rocket_BuildSpeed(void){
/* Calculate new direction */
if (self.weapon) {
makevectors(self.owner.v_angle);
traceline(self.owner.origin, self.owner.origin + v_forward * 8096, FALSE, self.owner);
self.angles = vectoangles(trace_endpos - self.origin);
}
/* Increase speed towards it */
makevectors(self.angles);
self.velocity += (v_forward * 2000) * frametime;
self.nextthink = time;
}
Weapons_MakeVectors();
entity rocket = spawn();
setmodel(rocket, "models/rpgrocket.mdl");
setorigin(rocket, Weapons_GetCameraPos() + (v_forward * 16));
rocket.owner = self;
rocket.movetype = MOVETYPE_FLY;
rocket.solid = SOLID_BBOX;
//bolt.flags |= FL_LAGGEDMOVE;
rocket.gravity = 0.5f;
rocket.velocity = (v_forward * 250);
rocket.angles = vectoangles(rocket.velocity);
rocket.avelocity[2] = 10;
rocket.touch = Rocket_Touch;
rocket.think = Rocket_BuildSpeed;
rocket.nextthink = time + 0.15f;
rocket.traileffectnum = particleeffectnum("weapon_rpg.trail");
if (pl.ammo_rpg_state > 0) {
rocket.weapon = 1;
}
setsize(rocket, [0,0,0], [0,0,0]);
Sound_Play(pl, CHAN_WEAPON, "weapon_rpg.shoot");
#endif
pl.w_attack_next =
pl.w_idle_next = 2.5f;
w_rpg_primary();
}
void
w_rpg_reload(void)
w_rpg2_reload(void)
{
player pl = (player)self;
if (pl.w_attack_next > 0)
return;
/* Ammo check */
if (pl.rpg_mag >= 1)
return;
if (pl.ammo_rocket <= 0)
return;
Weapons_ViewAnimation(RPG_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
#endif
pl.w_attack_next = 2.25f;
pl.w_idle_next = 10.0f;
w_rpg_reload();
}
void
w_rpg_release(void)
w_rpg2_release(void)
{
player pl = (player)self;
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.rpg_mag == 0 && pl.ammo_rocket > 0) {
Weapons_Reload();
return;
}
if (pl.w_idle_next > 0.0)
return;
int r = (float)input_sequence % 3;
if (pl.a_ammo1 > 0) {
if (r == 1) {
Weapons_ViewAnimation(RPG_FIDGET);
} else {
Weapons_ViewAnimation(RPG_IDLE);
}
} else {
if (r == 1) {
Weapons_ViewAnimation(RPG_FIDGET_UL);
} else {
Weapons_ViewAnimation(RPG_IDLE_UL);
}
}
pl.w_idle_next = 6.0f;
w_rpg_release();
}
void
w_rpg_secondary(void)
w_rpg2_secondary(void)
{
/* Another change to spice things up */
@ -248,127 +127,62 @@ w_rpg_secondary(void)
pl.ammo_rpg_state = 1 - pl.ammo_rpg_state;
pl.w_attack_next = 0.25f;
w_rpg_release();
w_rpg2_release();
}
}
float
w_rpg_aimanim(void)
w_rpg2_aimanim(void)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMRPG : ANIM_AIMRPG;
return w_rpg_aimanim();
}
void
w_rpg_hudpic(int selected, vector pos, float a)
w_rpg2_hudpic(int selected, vector pos, float a)
{
#ifdef CLIENT
player pl = (player)self;
vector hud_col;
if (pl.rpg_mag == 0 && pl.ammo_rocket == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
if (selected) {
drawsubpic(pos, [170,45], g_hud5_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
}
HUD_DrawAmmoBar(pos, pl.ammo_rocket, MAX_A_ROCKET, a);
#endif
w_rpg_hudpic(selected, pos, a);
}
void
w_rpg_hud(void)
w_rpg2_hud(void)
{
#ifdef CLIENT
player pl = (player)self;
vector cross_pos;
vector aicon_pos;
/* crosshair/laser */
if (pl.ammo_rpg_state == 1) {
float lerp;
vector jitter;
Weapons_MakeVectors();
vector src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 256), FALSE, pl);
lerp = Math_Lerp(18,6, trace_fraction);
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
jitter[1] = (random(0,2) - 2) * (1 - trace_fraction);
cross_pos = g_hudmins + (g_hudres / 2) + ([-lerp,-lerp] / 2);
drawsubpic(
cross_pos + jitter,
[lerp,lerp],
g_laser_spr,
[0,0],
[1.0, 1.0],
[1,1,1],
1.0f,
DRAWFLAG_ADDITIVE
);
} else {
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],
g_cross_spr,
[0,0],
[0.1875, 0.1875],
[1,1,1],
1,
DRAWFLAG_NORMAL
);
}
/* ammo counters */
HUD_DrawAmmo1();
HUD_DrawAmmo2();
/* ammo icon */
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
drawsubpic(
aicon_pos,
[24,24],
"sprites/640hud7.spr_0.tga",
[120/256,72/128],
[24/256, 24/128],
g_hud_color,
pSeatLocal->m_flAmmo2Alpha,
DRAWFLAG_ADDITIVE
);
#endif
w_rpg_hud();
}
weapon_t w_rpg =
int
w_rpg2_isempty(void)
{
return w_rpg_isempty();
}
weapontype_t
w_rpg2_type(void)
{
return w_rpg_type();
}
weapon_t w_rpg2 =
{
.name = "rpg_rocket",
.id = ITEM_RPG,
.id = ITEM_RPG,
.slot = 3,
.slot_pos = 0,
.draw = w_rpg_draw,
.holster = w_rpg_holster,
.primary = w_rpg_primary,
.secondary = w_rpg_secondary,
.reload = w_rpg_reload,
.release = w_rpg_release,
.crosshair = w_rpg_hud,
.precache = w_rpg_precache,
.pickup = w_rpg_pickup,
.updateammo = w_rpg_updateammo,
.wmodel = w_rpg_wmodel,
.pmodel = w_rpg_pmodel,
.deathmsg = w_rpg_deathmsg,
.aimanim = w_rpg_aimanim,
.hudpic = w_rpg_hudpic
.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,
.crosshair = 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
};
#ifdef SERVER
void
weapon_rpg(void)
{
Weapons_InitItem(WEAPON_RPG);
}
#endif

View File

@ -204,12 +204,25 @@ w_shovel_hudpic(int selected, vector pos, float a)
#endif
}
int
w_shovel_isempty(void)
{
return 0;
}
weapontype_t
w_shovel_type(void)
{
return WPNTYPE_CLOSE;
}
weapon_t w_shovel =
{
.name = "shovel",
.id = ITEM_SHOVEL,
.id = ITEM_SHOVEL,
.slot = 0,
.slot_pos = 1,
.weight = WEIGHT_SHOVEL,
.draw = w_shovel_draw,
.holster = w_shovel_holster,
.primary = w_shovel_primary,
@ -224,6 +237,8 @@ weapon_t w_shovel =
.pmodel = w_shovel_pmodel,
.deathmsg = w_shovel_deathmsg,
.aimanim = w_shovel_aimanim,
.isempty = w_shovel_isempty,
.type = w_shovel_type,
.hudpic = w_shovel_hudpic
};

View File

@ -36,10 +36,10 @@ w_silencer_precache(void)
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
@ -121,6 +121,7 @@ w_silencer_primary(void)
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 {
@ -148,6 +149,23 @@ w_silencer_primary(void)
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(void)
{
@ -159,21 +177,21 @@ w_silencer_secondary(void)
/* toggle silencer */
pl.mode_silencer = 1 - pl.mode_silencer;
if (pl.mode_silencer) {
Weapons_SetGeomset("geomset 2 2\n");
Weapons_ViewAnimation(GLOCK_SILENCER);
} else {
Weapons_SetGeomset("geomset 2 0\n");
Weapons_ViewAnimation(GLOCK_HOLSTER);
}
if (pl.mode_silencer) {
pl.w_attack_next = 3.3f;
pl.w_idle_next = pl.w_attack_next;
Weapons_ViewAnimation(GLOCK_SILENCER);
#ifdef CLIENT
View_AddEvent(w_silencer_add, 1.0f);
#endif
} else {
pl.w_attack_next = 0.94f;
pl.w_idle_next = pl.w_attack_next;
pl.w_attack_next = 2.0f;
pl.w_idle_next = 1.0f;
Weapons_ViewAnimation(GLOCK_HOLSTER);
pl.mode_tempstate = 1;
#ifdef CLIENT
View_AddEvent(w_silencer_remove, 0.9f);
#endif
}
}
@ -186,7 +204,44 @@ w_silencer_reload(void)
void
w_silencer_release(void)
{
w_glock_release();
player pl = (player)self;
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();
return;
}
if (pl.w_idle_next > 0.0) {
return;
}
if (pl.mode_tempstate == 1)
{
Weapons_ViewAnimation(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(GLOCK_IDLE2);
pl.w_idle_next = 2.5f;
break;
case 2:
Weapons_ViewAnimation(GLOCK_IDLE3);
pl.w_idle_next = 3.5f;
break;
default:
Weapons_ViewAnimation(GLOCK_IDLE1);
pl.w_idle_next = 3.75f;
break;
}
}
float
@ -241,12 +296,30 @@ w_silencer_hudpic(int selected, vector pos, float a)
#endif
}
int
w_silencer_isempty(void)
{
player pl = (player)self;
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
return 1;
return 0;
}
weapontype_t
w_silencer_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_silencer =
{
.name = "silencer",
.id = ITEM_GLOCK,
.id = ITEM_GLOCK,
.slot = 1,
.slot_pos = 0,
.weight = WEIGHT_GLOCK,
.draw = w_silencer_draw,
.holster = w_silencer_holster,
.primary = w_silencer_primary,
@ -261,5 +334,7 @@ weapon_t w_silencer =
.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

@ -45,12 +45,14 @@ w_sniper_pickup(int new, int startammo)
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 (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);
@ -152,6 +154,7 @@ w_sniper_primary(void)
Weapons_ViewAnimation(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);
@ -220,10 +223,18 @@ w_sniper_crosshair(void)
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(
g_hudmins,
g_hudres,
[0,0.2,0],
video_mins,
video_res,
col,
1.0f,
DRAWFLAG_ADDITIVE
);
@ -314,12 +325,30 @@ w_sniper_hudpic(int selected, vector pos, float a)
#endif
}
int
w_sniper_isempty(void)
{
player pl = (player)self;
if (pl.sniper_mag <= 0 && pl.ammo_sniper <= 0)
return 1;
return 0;
}
weapontype_t
w_sniper_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_sniper =
{
.name = "sniper",
.id = ITEM_SNIPER,
.id = ITEM_SNIPER,
.slot = 2,
.slot_pos = 3,
.weight = WEIGHT_SNIPER,
.draw = w_sniper_draw,
.holster = w_sniper_holster,
.primary = w_sniper_primary,
@ -334,6 +363,8 @@ weapon_t w_sniper =
.pmodel = w_sniper_pmodel,
.deathmsg = w_sniper_deathmsg,
.aimanim = w_sniper_aimanim,
.isempty = w_sniper_isempty,
.type = w_sniper_type,
.hudpic = w_sniper_hudpic
};

View File

@ -37,20 +37,7 @@ w_sniper2_precache(void)
int
w_sniper2_pickup(int new, int startammo)
{
#ifdef SERVER
player pl = (player)self;
if (new) {
pl.sniper_mag = 5;
} else {
if (pl.ammo_sniper < MAX_A_SNIPER) {
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
} else {
return (0);
}
}
#endif
return (1);
return w_sniper_pickup(new, startammo);
}
void
@ -137,6 +124,7 @@ w_sniper2_primary(void)
Weapons_ViewAnimation(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);
@ -201,12 +189,25 @@ w_sniper2_hudpic(int selected, vector pos, float a)
w_sniper_hudpic(selected, pos, a);
}
int
w_sniper2_isempty(void)
{
w_sniper_isempty();
}
weapontype_t
w_sniper2_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_sniper2 =
{
.name = "sniper2",
.id = ITEM_SNIPER2,
.id = ITEM_SNIPER2,
.slot = 2,
.slot_pos = 4,
.weight = WEIGHT_SNIPER2,
.draw = w_sniper2_draw,
.holster = w_sniper2_holster,
.primary = w_sniper2_primary,
@ -221,6 +222,8 @@ weapon_t w_sniper2 =
.pmodel = w_sniper2_pmodel,
.deathmsg = w_sniper2_deathmsg,
.aimanim = w_sniper2_aimanim,
.isempty = w_sniper2_isempty,
.type = w_sniper2_type,
.hudpic = w_sniper2_hudpic
};

View File

@ -176,12 +176,25 @@ w_spanner_hudpic(int selected, vector pos, float a)
#endif
}
int
w_spanner_isempty(void)
{
return 0;
}
weapontype_t
w_spanner_type(void)
{
return WPNTYPE_CLOSE;
}
weapon_t w_spanner =
{
.name = "spanner",
.id = ITEM_SPANNER,
.id = ITEM_SPANNER,
.slot = 0,
.slot_pos = 2,
.weight = WEIGHT_SPANNER,
.draw = w_spanner_draw,
.holster = w_spanner_holster,
.primary = w_spanner_primary,
@ -196,6 +209,8 @@ weapon_t w_spanner =
.pmodel = w_spanner_pmodel,
.deathmsg = w_spanner_deathmsg,
.aimanim = w_spanner_aimanim,
.isempty = w_spanner_isempty,
.type = w_spanner_type,
.hudpic = w_spanner_hudpic
};

View File

@ -73,12 +73,14 @@ w_taurus_pickup(int new, int startammo)
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 (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);
@ -126,6 +128,7 @@ w_taurus_primary(void)
/* 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);
@ -219,12 +222,30 @@ w_taurus_hudpic(int selected, vector pos, float a)
w_glock_hudpic(selected, pos, a);
}
int
w_taurus_isempty(void)
{
player pl = (player)self;
if (pl.taurus_mag <= 0 && pl.ammo_taurus <= 0)
return 1;
return 0;
}
weapontype_t
w_taurus_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_taurus =
{
.name = "taurus",
.id = ITEM_TAURUS,
.id = ITEM_TAURUS,
.slot = 1,
.slot_pos = 3,
.weight = WEIGHT_TAURUS,
.draw = w_taurus_draw,
.holster = w_taurus_holster,
.primary = w_taurus_primary,
@ -239,6 +260,8 @@ weapon_t w_taurus =
.pmodel = w_taurus_pmodel,
.deathmsg = w_taurus_deathmsg,
.aimanim = w_taurus_aimanim,
.isempty = w_taurus_isempty,
.type = w_taurus_type,
.hudpic = w_taurus_hudpic
};

View File

@ -203,12 +203,30 @@ w_tnt_hudpic(int selected, vector pos, float a)
w_handgrenade_hudpic(selected, pos, a);
}
int
w_tnt_isempty(void)
{
player pl = (player)self;
if (pl.ammo_handgrenade <= 0)
return 1;
return 0;
}
weapontype_t
w_tnt_type(void)
{
return WPNTYPE_RANGED;
}
weapon_t w_tnt =
{
.name = "tnt",
.id = ITEM_HANDGRENADE,
.id = ITEM_HANDGRENADE,
.slot = 4,
.slot_pos = 0,
.weight = WEIGHT_HANDGRENADE,
.draw = w_tnt_draw,
.holster = w_tnt_holster,
.primary = w_tnt_primary,
@ -223,5 +241,7 @@ weapon_t w_tnt =
.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

@ -41,6 +41,32 @@ enum
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

View File

@ -29,7 +29,7 @@ weapon_t g_weapons[] = {
w_crossbow,
w_sniper,
w_sniper2,
w_rpg,
w_rpg2,
w_gauss,
w_flame,
w_chaingun,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,962 @@
{
"wad" "\sierra\half-life\valve\halflife.wad;\sierra\half-life\valve\neilm2.wad;\sierra\half-life\valve\pcglogo.wad"
"skyname" "theyh3"
"classname" "worldspawn"
}
{
"origin" "640 864 400"
"angle" "270"
"classname" "info_player_deathmatch"
}
{
"origin" "-464 -400 324"
"scale" "0.5"
"model" "sprites/fire.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "200"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "-464 -400 320"
"_light" "128 64 0 225"
"classname" "light"
}
{
"origin" "-464 -400 320"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "4"
"message" "ambience/burning3.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "-464 304 320"
"_light" "128 64 0 225"
"classname" "light"
}
{
"origin" "176 -640 128"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "4"
"message" "ambience/crickets.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "0 0 704"
"_light" "250 200 130 14"
"pitch" "-50"
"angle" "168"
"classname" "light_environment"
}
{
"origin" "-320 -376 288"
"angle" "160"
"classname" "weapon_shotgun"
}
{
"origin" "-880 -720 336"
"angle" "315"
"classname" "weapon_rpg"
}
{
"origin" "-880 -800 336"
"classname" "ammo_rpgclip"
}
{
"origin" "-696 272 272"
"classname" "item_battery"
}
{
"origin" "-696 304 272"
"classname" "item_healthkit"
}
{
"origin" "80 944 272"
"angle" "270"
"classname" "ammo_buckshot"
}
{
"origin" "496 688 124"
"classname" "item_healthkit"
}
{
"origin" "448 688 128"
"classname" "item_battery"
}
{
"origin" "544 192 80"
"angle" "90"
"classname" "ammo_egonclip"
}
{
"origin" "400 192 240"
"angle" "135"
"classname" "weapon_9mmAR"
}
{
"origin" "440 192 240"
"angle" "180"
"classname" "ammo_ARgrenades"
}
{
"model" "*1"
"WaveHeight" "0"
"skin" "-3"
"unlocked_sentence" "0"
"locked_sentence" "0"
"unlocked_sound" "0"
"locked_sound" "0"
"health" "0"
"delay" "0"
"dmg" "0"
"lip" "0"
"wait" "4"
"stopsnd" "0"
"movesnd" "0"
"speed" "100"
"_minlight" "0.7"
"classname" "func_water"
}
{
"origin" "-192 -896 192"
"angle" "90"
"classname" "info_player_deathmatch"
}
{
"origin" "888 936 384"
"angle" "90"
"classname" "ammo_egonclip"
}
{
"origin" "-320 -344 288"
"angle" "135"
"classname" "ammo_buckshot"
}
{
"origin" "-928 928 288"
"angle" "270"
"classname" "info_player_deathmatch"
}
{
"origin" "-920 576 272"
"angle" "90"
"classname" "ammo_9mmAR"
}
{
"origin" "896 -720 256"
"classname" "ammo_th_taurus"
}
{
"origin" "0 0 640"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "2"
"message" "ambience/alienwind2.wav"
"spawnflags" "1"
"classname" "ambient_generic"
}
{
"origin" "720 192 272"
"angle" "180"
"classname" "info_player_start"
}
{
"origin" "-920 696 272"
"angle" "90"
"classname" "ammo_th_taurus"
}
{
"model" "*2"
"classname" "func_wall"
}
{
"origin" "-928 672 288"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "10"
"message" "ambience/flies.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "0 0 512"
"roomtype" "21"
"radius" "1024"
"classname" "env_sound"
}
{
"origin" "-580 -352 170"
"angles" "0 80 0"
"classname" "weapon_th_chaingun"
}
{
"model" "*3"
"classname" "func_ladder"
}
{
"origin" "360 192 240"
"angle" "90"
"classname" "ammo_9mmAR"
}
{
"model" "*4"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*5"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*6"
"classname" "func_wall"
}
{
"origin" "-408 -456 160"
"classname" "item_healthkit"
}
{
"model" "*7"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"model" "*8"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"model" "*9"
"_minlight" ".15"
"skin" "-1"
"renderamt" "255"
"rendermode" "4"
"classname" "func_illusionary"
}
{
"origin" "592 624 416"
"_light" "255 128 128 100"
"classname" "light"
}
{
"origin" "704 192 392"
"_light" "255 128 128 100"
"classname" "light"
}
{
"origin" "632 -200 352"
"_light" "255 128 128 100"
"classname" "light"
}
{
"model" "*10"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"model" "*11"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"origin" "740 928 440"
"scale" "0.5"
"model" "sprites/fire.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "200"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "740 928 436"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "3"
"message" "ambience/burning3.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "940 736 440"
"scale" "0.5"
"model" "sprites/fire.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "200"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "940 736 436"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "3"
"message" "ambience/burning3.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "940 740 444"
"_light" "128 64 0 175"
"classname" "light"
}
{
"origin" "744 920 444"
"_light" "128 64 0 175"
"classname" "light"
}
{
"origin" "928 888 384"
"angle" "210"
"classname" "weapon_egon"
}
{
"origin" "624 640 304"
"classname" "ammo_rpgclip"
}
{
"origin" "-656 496 480"
"angle" "270"
"classname" "info_player_deathmatch"
}
{
"origin" "944 -720 256"
"angle" "45"
"classname" "weapon_th_taurus"
}
{
"origin" "944 -672 256"
"angle" "90"
"classname" "ammo_th_taurus"
}
{
"origin" "-804 632 160"
"angle" "120"
"classname" "ammo_th_ap9"
}
{
"origin" "-804 576 160"
"classname" "weapon_th_ap9"
}
{
"origin" "176 -880 576"
"classname" "weapon_handgrenade"
}
{
"origin" "-340 248 112"
"classname" "ammo_egonclip"
}
{
"origin" "544 -248 80"
"classname" "item_battery"
}
{
"origin" "-804 688 156"
"classname" "item_healthkit"
}
{
"origin" "-928 576 288"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "10"
"message" "ambience/flies.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"model" "*12"
"wait" "120"
"delay" "0"
"sounds" "0"
"style" "32"
"target" "howl"
"classname" "trigger_multiple"
}
{
"origin" "-368 -456 168"
"classname" "ammo_9mmAR"
}
{
"origin" "560 -208 88"
"classname" "item_battery"
}
{
"origin" "-340 280 112"
"classname" "weapon_th_chainsaw"
}
{
"origin" "304 192 512"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "10"
"message" "ambience/des_wind1.wav"
"targetname" "howl"
"spawnflags" "49"
"classname" "ambient_generic"
}
{
"origin" "-928 624 288"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "10"
"message" "ambience/flies.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"model" "*13"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"model" "*14"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"origin" "-464 -48 272"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "5"
"message" "ambience/burning3.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"model" "*15"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"origin" "-464 368 320"
"_light" "128 64 0 200"
"classname" "light"
}
{
"origin" "-464 368 324"
"scale" "0.5"
"model" "sprites/fire.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "200"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "-464 304 324"
"scale" "0.5"
"model" "sprites/fire.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "200"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "-464 360 320"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "5"
"message" "ambience/burning3.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "-808 688 208"
"_light" "255 128 0 50"
"classname" "light"
}
{
"origin" "-808 584 208"
"_light" "255 128 0 50"
"classname" "light"
}
{
"model" "*16"
"classname" "func_wall"
}
{
"model" "*17"
"classname" "func_wall"
}
{
"model" "*18"
"classname" "func_wall"
}
{
"model" "*19"
"classname" "func_wall"
}
{
"model" "*20"
"classname" "func_wall"
}
{
"model" "*21"
"classname" "func_wall"
}
{
"model" "*22"
"classname" "func_wall"
}
{
"model" "*23"
"classname" "func_wall"
}
{
"model" "*24"
"classname" "func_wall"
}
{
"model" "*25"
"classname" "func_wall"
}
{
"model" "*26"
"classname" "func_ladder"
}
{
"origin" "-464 -48 268"
"scale" "2"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderfx" "0"
"model" "sprites/xffloor.spr"
"renderamt" "225"
"rendermode" "5"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"origin" "-464 -48 272"
"style" "6"
"_light" "128 64 0 125"
"classname" "light"
}
{
"model" "*27"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*28"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*29"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*30"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*31"
"skin" "-1"
"classname" "func_illusionary"
}
{
"model" "*32"
"damagetype" "8"
"delay" "0"
"dmg" "8"
"classname" "trigger_hurt"
}
{
"model" "*33"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"origin" "80 944 264"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "4"
"message" "ambience/cricket.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "-464 -48 608"
"scale" "3.5"
"model" "sprites/xssmke1.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "50"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"angle" "-2"
"classname" "env_sprite"
}
{
"model" "*34"
"_minlight" "0.1"
"classname" "func_wall"
}
{
"model" "*35"
"classname" "func_wall"
}
{
"origin" "744 736 544"
"angle" "45"
"classname" "weapon_einar1"
}
{
"model" "*36"
"_minlight" ".15"
"skin" "-1"
"renderamt" "255"
"rendermode" "4"
"classname" "func_illusionary"
}
{
"model" "*37"
"_minlight" ".15"
"skin" "-1"
"renderamt" "255"
"rendermode" "4"
"classname" "func_illusionary"
}
{
"model" "*38"
"classname" "func_wall"
}
{
"origin" "696 -104 392"
"frequency" "175"
"duration" "0.5"
"radius" "256"
"amplitude" "2"
"targetname" "shakem"
"classname" "env_shake"
}
{
"model" "*39"
"target" "boomer"
"classname" "func_tankcontrols"
}
{
"model" "*40"
"origin" "626 -100 264"
"spriteflash" "sprites/muzzleflash1.spr"
"iMagnitude" "150"
"_minlight" "0.01"
"maxRange" "0"
"minRange" "0"
"firespread" "0"
"persistence" "1"
"bullet_damage" "100"
"firerate" "0"
"spritescale" "1.5"
"barrelz" "0"
"barrely" "0"
"barrel" "24"
"pitchtolerance" "5"
"pitchrange" "25"
"pitchrate" "120"
"yawtolerance" "15"
"yawrange" "100"
"yawrate" "350"
"target" "shakem"
"targetname" "boomer"
"spawnflags" "32"
"angle" "180"
"classname" "func_tankmortar"
}
{
"model" "*41"
"_minlight" "0.01"
"classname" "func_wall"
}
{
"origin" "-896 -464 224"
"classname" "ammo_egonclip"
}
{
"model" "*42"
"classname" "func_wall"
}
{
"model" "*43"
"classname" "func_wall"
}
{
"model" "*44"
"classname" "func_wall"
}
{
"model" "*45"
"WaveHeight" "0"
"skin" "-5"
"unlocked_sentence" "0"
"locked_sentence" "0"
"unlocked_sound" "0"
"locked_sound" "0"
"health" "0"
"delay" "0"
"dmg" "0"
"lip" "0"
"wait" "4"
"stopsnd" "0"
"movesnd" "0"
"speed" "100"
"_minlight" "1"
"classname" "func_water"
}
{
"origin" "-336 -352 104"
"scale" "0.7"
"model" "sprites/enter1.spr"
"framerate" "10.0"
"rendercolor" "0 0 0"
"renderamt" "150"
"rendermode" "5"
"renderfx" "0"
"spawnflags" "1"
"classname" "env_sprite"
}
{
"model" "*46"
"delay" "0"
"sounds" "0"
"style" "32"
"target" "tele1"
"classname" "trigger_teleport"
}
{
"origin" "856 696 536"
"targetname" "tele1"
"angle" "130"
"classname" "info_teleport_destination"
}
{
"origin" "-336 -352 88"
"cspinup" "0"
"lfomodvol" "0"
"lfomodpitch" "0"
"lforate" "0"
"lfotype" "0"
"spindown" "0"
"spinup" "0"
"pitchstart" "100"
"pitch" "100"
"fadeout" "0"
"fadein" "0"
"volstart" "0"
"preset" "0"
"health" "5"
"message" "ambience/alien_beacon.wav"
"spawnflags" "2"
"classname" "ambient_generic"
}
{
"origin" "-520 272 112"
"classname" "info_player_deathmatch"
}
{
"model" "*47"
"_minlight" "0.02"
"classname" "func_wall"
}
{
"origin" "-464 -184 104"
"_light" "255 128 0 150"
"classname" "light"
}
{
"origin" "-536 56 104"
"_light" "255 128 0 100"
"classname" "light"
}
{
"origin" "-400 144 104"
"_light" "255 128 0 100"
"classname" "light"
}
{
"model" "*48"
"classname" "func_wall"
}
{
"origin" "896 -672 272"
"_light" "255 128 128 40"
"classname" "light"
}
{
"origin" "864 -544 272"
"_light" "255 128 128 40"
"classname" "light"
}
{
"origin" "720 192 272"
"angle" "180"
"classname" "info_player_deathmatch"
}
{
"origin" "768 -704 272"
"_light" "255 128 128 40"
"classname" "light"
}
{
"origin" "-465 448 440"
"angle" "135"
"classname" "weapon_einar1"
}
{
"origin" "-540 490 440"
"classname" "ammo_th_sniper"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
weapon_ap9.fire
{
alerts
sample weapons/ap9_fire.wav
}
weapon_chaingun.fire
{
alerts
sample weapons/asscan2.wav
}
@ -23,13 +25,51 @@ weapon_chaingun.spinup
sample weapons/asscan1.wav
}
weapon_chainsaw.attack
{
alerts
sample weapons/chainsaw_attack.wav
}
weapon_chainsaw.draw
{
alerts
sample weapons/chainsaw_pullout.wav
}
weapon_chainsaw.hit
{
alerts
sample weapons/chainsaw_cutinto.wav
}
weapon_chainsaw.hitflesh
{
alerts
sample weapons/chainsaw_cutintoflesh.wav
}
weapon_chainsaw.idle
{
alerts
sample weapons/chainsaw_idle.wav
}
weapon_chainsaw.startup
{
alerts
sample weapons/chainsaw_startup.wav
}
weapon_medkit.heal
{
alerts
sample items/smallmedkit1.wav
}
weapon_flame.fire
{
alerts
sample weapons/flmfire2.wav
}
@ -41,6 +81,7 @@ weapon_silencer.fire
weapon_sniper.fire
{
alerts
sample weapons/sniper.wav
}
@ -51,5 +92,6 @@ weapon_sniper.reload
weapon_taurus.fire
{
alerts
sample weapons/tau_fire.wav
}