Basic entityDef items for the weapons - also add SLAM and STUNSTICK from HL2MP
This commit is contained in:
parent
da7b1ea4ee
commit
b7941fb3dc
25 changed files with 784 additions and 15 deletions
|
@ -177,7 +177,7 @@ HUD_DrawNums(float fNumber, vector vecPos, float fAlpha, vector vColor)
|
|||
|
||||
/* if we're a zero, but a leading one... */
|
||||
if (b == 0)
|
||||
if ((fNumber < 100 && x == 2) || (fNumber < 10 && x == 1) || (fNumber == 0))
|
||||
if ((fNumber < 100 && x == 2) || (fNumber < 10 && x == 1))
|
||||
fAlpha = 0.25f;
|
||||
|
||||
if (x == 1) {
|
||||
|
@ -234,7 +234,7 @@ HUD_DrawNumsS(float fNumber, vector vecPos, float fAlpha, vector vColor)
|
|||
|
||||
/* if we're a zero, but a leading one... */
|
||||
if (b == 0)
|
||||
if ((fNumber < 100 && x == 2) || (fNumber < 10 && x == 1) || (fNumber == 0))
|
||||
if ((fNumber < 100 && x == 2) || (fNumber < 10 && x == 1))
|
||||
fAlpha = 0.25f;
|
||||
|
||||
if (x == 1) {
|
||||
|
@ -360,7 +360,7 @@ HUD_DrawArmor(void)
|
|||
g_hud7_spr,
|
||||
[spr_armor[0], spr_armor[1]],
|
||||
[spr_armor[2], spr_armor[3]],
|
||||
g_hud_color,
|
||||
[1,0,0],
|
||||
pSeatLocal->m_flArmorAlpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ vector g_vecHUDNums[8] =
|
|||
[131 / 256,44 / 64],
|
||||
[153 / 256,44 / 64],
|
||||
[175 / 256,44 / 64],
|
||||
[197 / 256,44 / 64],
|
||||
[24/256, 44/64]
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -107,8 +107,6 @@ HUD_DrawWeaponSelect_Last(void)
|
|||
void
|
||||
HUD_DrawWeaponSelect_Num2(vector vecPos, float fValue)
|
||||
{
|
||||
drawsubpic(vecPos, [16,16], g_hud7_spr, [24/256, 44/64], [16/256, 16/64], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
|
||||
drawsubpic(vecPos, [16,16], g_hud7_spr, g_vecHUDNums[fValue], [16/255, 16/64], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
|
@ -212,7 +210,6 @@ HUD_DrawWeaponSelect(void)
|
|||
int slot_selected = 0;
|
||||
vecPos[1] = g_hudmins[1] + 16;
|
||||
|
||||
|
||||
if (i == wantslot)
|
||||
HUD_DrawWeaponSelect_Num2(vecPos, i);
|
||||
else
|
||||
|
@ -239,7 +236,7 @@ HUD_DrawWeaponSelect(void)
|
|||
}
|
||||
|
||||
if (slot_selected == TRUE) {
|
||||
vecPos[0] += 128;
|
||||
vecPos[0] += 132;
|
||||
} else {
|
||||
vecPos[0] += 25;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ w_pistol.qc
|
|||
w_rpg.qc
|
||||
w_shotgun.qc
|
||||
w_smg1.qc
|
||||
w_stunstick.qc
|
||||
w_slam.qc
|
||||
weapons.qc
|
||||
../../../valve/src/shared/weapon_common.qc
|
||||
#endlist
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#define ITEM_FRAG 0x00000100i
|
||||
#define ITEM_RPG 0x00000200i
|
||||
#define ITEM_BUGBAIT 0x00000400i
|
||||
#define ITEM_TRIPMINE 0x00000800i
|
||||
#define ITEM_SATCHEL 0x00001000i
|
||||
#define ITEM_STUNSTICK 0x00000800i
|
||||
#define ITEM_SLAM 0x00001000i
|
||||
#define ITEM_SNARK 0x00002000i
|
||||
#define ITEM_SUIT 0x00004000i
|
||||
#define ITEM_LONGJUMP 0x00008000i
|
||||
|
|
|
@ -137,8 +137,6 @@ void w_bugbait_secondary(player pl)
|
|||
void w_bugbait_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
vector pos = g_hudmins + [g_hudres[0] / 2, g_hudres[1] / 2];
|
||||
Font_DrawText_RGBA(pos + [-7, -14], "Q", g_hud_color, 1.0, FONT_HUD_CROSS);
|
||||
#endif
|
||||
|
@ -235,8 +233,6 @@ w_bugbait_hudpic(player pl, int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_handgrenade, MAX_A_HANDGRENADE, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ weapon_t w_gravitygun =
|
|||
.name = "egon",
|
||||
.id = ITEM_GRAVITYGUN,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.slot_pos = 2,
|
||||
.weight = 15,
|
||||
.draw = w_gravitygun_draw,
|
||||
.holster = w_gravitygun_holster,
|
||||
|
|
326
src/shared/w_slam.qc
Normal file
326
src/shared/w_slam.qc
Normal file
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
* 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
|
||||
{
|
||||
SLAM_IDLE,
|
||||
SLAM_FIDGET,
|
||||
SLAM_DRAW,
|
||||
SLAM_THROW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RADIO_IDLE,
|
||||
RADIO_FIDGET,
|
||||
RADIO_DRAW,
|
||||
RADIO_USE,
|
||||
RADIO_HOLSTER
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
s_slam_detonate(entity master)
|
||||
{
|
||||
for (entity b = world; (b = find(b, ::classname, "projectile_slam"));) {
|
||||
if (b.owner != master)
|
||||
continue;
|
||||
|
||||
NSEntity slamEnt = (NSEntity)b;
|
||||
slamEnt.Trigger(master, TRIG_TOGGLE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_slam_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.satchel_chg, pl.ammo_satchel, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_slam_wmodel(void)
|
||||
{
|
||||
return "models/w_slam.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_slam_pmodel(player pl)
|
||||
{
|
||||
return "models/p_slam.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_slam_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_slam.bounce");
|
||||
precache_model("models/w_slam.mdl");
|
||||
#else
|
||||
precache_model("models/weapons/v_slam.mdl");
|
||||
precache_model("models/v_slam_radio.mdl");
|
||||
precache_model("models/p_slam.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_slam_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 1 : startammo;
|
||||
|
||||
if (pl.ammo_satchel < MAX_A_SATCHEL) {
|
||||
pl.ammo_satchel = bound(0, pl.ammo_satchel + addAmmo, MAX_A_SATCHEL);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_draw(player pl)
|
||||
{
|
||||
if (pl.satchel_chg > 0) {
|
||||
Weapons_SetModel("models/v_slam_radio.mdl");
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
|
||||
} else {
|
||||
Weapons_SetModel("models/weapons/v_slam.mdl");
|
||||
Weapons_ViewAnimation(pl, SLAM_DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.satchel_chg <= 0 && pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RADIO_USE);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
/* if we don't have any slams placed yet, place one */
|
||||
if (!pl.satchel_chg) {
|
||||
NSProjectile_SpawnDef("projectile_slam", pl);
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
pl.mode_tempstate = 1; /* mark us as having deployed something */
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
} else {
|
||||
/* detonate all we have */
|
||||
s_slam_detonate(pl);
|
||||
pl.satchel_chg = 0;
|
||||
|
||||
/* no slams left to place? just get rid of this thing */
|
||||
if (pl.ammo_satchel <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SLAM);
|
||||
}
|
||||
}
|
||||
#else
|
||||
Weapons_SetModel("models/v_slam_radio.mdl");
|
||||
|
||||
/* same thing as the SERVER ifdef above... */
|
||||
if (!pl.satchel_chg) {
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
} else {
|
||||
pl.satchel_chg = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_SetModel("models/v_slam_radio.mdl");
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
|
||||
#ifdef SERVER
|
||||
NSProjectile_SpawnDef("projectile_slam", pl);
|
||||
#endif
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
pl.mode_tempstate = 1; /* mark us as having deployed something */
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_reload(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* keep track of the model via tempstates */
|
||||
if (pl.satchel_chg < 1i && pl.mode_tempstate != 0) {
|
||||
pl.mode_tempstate = 0;
|
||||
Weapons_SetModel("models/v_slam.mdl");
|
||||
Weapons_ViewAnimation(pl, SLAM_DRAW);
|
||||
pl.w_idle_next = 15.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(pl, SLAM_FIDGET);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RADIO_FIDGET);
|
||||
}
|
||||
pl.w_idle_next = 15.0f;
|
||||
}
|
||||
|
||||
float
|
||||
w_slam_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
HUD_DrawAmmo2();
|
||||
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [72/256,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_slam_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[128,64],
|
||||
"materials/Sprites/w_icons2",
|
||||
[0.5, 0.25],
|
||||
[128/256,64/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[128,64],
|
||||
"materials/Sprites/w_icons2",
|
||||
[0.5, 0.25],
|
||||
[128/256,64/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_satchel, MAX_A_SATCHEL, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_slam_isempty(player pl)
|
||||
{
|
||||
if (pl.ammo_satchel <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_slam_type(player pl)
|
||||
{
|
||||
return WPNTYPE_THROW;
|
||||
}
|
||||
|
||||
weapon_t w_slam =
|
||||
{
|
||||
.name = "slam",
|
||||
.id = ITEM_SLAM,
|
||||
.slot = 4,
|
||||
.slot_pos = 2,
|
||||
.weight = -20,
|
||||
.draw = w_slam_draw,
|
||||
.holster = w_slam_holster,
|
||||
.primary = w_slam_primary,
|
||||
.secondary = w_slam_secondary,
|
||||
.reload = w_slam_reload,
|
||||
.release = w_slam_release,
|
||||
.postdraw = w_slam_hud,
|
||||
.precache = w_slam_precache,
|
||||
.pickup = w_slam_pickup,
|
||||
.updateammo = w_slam_updateammo,
|
||||
.wmodel = w_slam_wmodel,
|
||||
.pmodel = w_slam_pmodel,
|
||||
.deathmsg = w_slam_deathmsg,
|
||||
.aimanim = w_slam_aimanim,
|
||||
.isempty = w_slam_isempty,
|
||||
.type = w_slam_type,
|
||||
.hudpic = w_slam_hudpic
|
||||
};
|
234
src/shared/w_stunstick.qc
Normal file
234
src/shared/w_stunstick.qc
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
CBAR_IDLE,
|
||||
CBAR_DRAW,
|
||||
CBAR_ATTACK1MISS,
|
||||
CBAR_ATTACK2MISS,
|
||||
CBAR_ATTACK1HIT,
|
||||
CBAR_ATTACK2HIT,
|
||||
CBAR_ATTACK3HIT,
|
||||
CBAR_ATTACK3MISS,
|
||||
CBAR_HOLSTER
|
||||
};
|
||||
|
||||
void
|
||||
w_stunstick_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_stunstick.hit");
|
||||
Sound_Precache("weapon_stunstick.miss");
|
||||
Sound_Precache("weapon_stunstick.hitbody");
|
||||
precache_model("models/w_stunstick.mdl");
|
||||
#else
|
||||
precache_model("models/weapons/v_stunstick.mdl");
|
||||
precache_model("models/p_stunstick.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_updateammo(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string
|
||||
w_stunstick_wmodel(void)
|
||||
{
|
||||
return "models/w_stunstick.mdl";
|
||||
}
|
||||
string
|
||||
w_stunstick_pmodel(player pl)
|
||||
{
|
||||
return "models/p_stunstick.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_stunstick_deathmsg(void)
|
||||
{
|
||||
return "%s was assaulted by %s's Stunstick.";
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/weapons/v_stunstick.mdl");
|
||||
Weapons_ViewAnimation(pl, CBAR_DRAW);
|
||||
pl.w_idle_next = 0.8f;
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, CBAR_HOLSTER);
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_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 = pl.hitcontentsmaski;
|
||||
pl.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
traceline(src, src + (v_forward * 64), FALSE, pl);
|
||||
pl.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else {
|
||||
pl.w_attack_next = 0.45f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
}
|
||||
|
||||
int r = (float)input_sequence % 3.0f;
|
||||
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_ATTACK2MISS:CBAR_ATTACK3HIT);
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "Weapon_Stunstick.Single");
|
||||
|
||||
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_stunstick", 10), WEAPON_STUNSTICK, DMG_BLUNT);
|
||||
if (trace_ent.iBleeds) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "Weapon_Stunstick.Melee_Hit");
|
||||
}
|
||||
} else {
|
||||
//Sound_Play(pl, CHAN_WEAPON, "Weapon_Stunstick.Melee_HitWorld");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, CBAR_IDLE);
|
||||
pl.w_idle_next = 15.0f;
|
||||
}
|
||||
|
||||
float
|
||||
w_stunstick_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
}
|
||||
|
||||
void
|
||||
w_stunstick_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[128,64],
|
||||
"materials/Sprites/w_icons1",
|
||||
[0, 0.75],
|
||||
[128/256,64/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[128,64],
|
||||
"materials/Sprites/w_icons1",
|
||||
[0, 0.75],
|
||||
[128/256,64/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_stunstick_isempty(player pl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t w_stunstick_type(player pl)
|
||||
{
|
||||
return WPNTYPE_CLOSE;
|
||||
}
|
||||
|
||||
weapon_t w_stunstick =
|
||||
{
|
||||
.name = "stunstick",
|
||||
.id = ITEM_STUNSTICK,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.weight = 0,
|
||||
.draw = w_stunstick_draw,
|
||||
.holster = w_stunstick_holster,
|
||||
.primary = w_stunstick_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_stunstick_release,
|
||||
.postdraw = __NULL__,
|
||||
.precache = w_stunstick_precache,
|
||||
.pickup = __NULL__,
|
||||
.updateammo = w_stunstick_updateammo,
|
||||
.wmodel = w_stunstick_wmodel,
|
||||
.pmodel = w_stunstick_pmodel,
|
||||
.deathmsg = w_stunstick_deathmsg,
|
||||
.aimanim = w_stunstick_aimanim,
|
||||
.isempty = w_stunstick_isempty,
|
||||
.type = w_stunstick_type,
|
||||
.hudpic = w_stunstick_hudpic
|
||||
};
|
|
@ -19,6 +19,7 @@ enum
|
|||
{
|
||||
WEAPON_NONE,
|
||||
WEAPON_CROWBAR,
|
||||
WEAPON_STUNSTICK,
|
||||
WEAPON_GRAVITYGUN,
|
||||
WEAPON_PISTOL,
|
||||
WEAPON_357,
|
||||
|
@ -28,6 +29,7 @@ enum
|
|||
WEAPON_CROSSBOW,
|
||||
WEAPON_FRAG,
|
||||
WEAPON_RPG,
|
||||
WEAPON_SLAM,
|
||||
WEAPON_BUGBAIT
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ weapon_t w_null = {};
|
|||
weapon_t g_weapons[] = {
|
||||
w_null,
|
||||
w_crowbar,
|
||||
w_stunstick,
|
||||
w_gravitygun,
|
||||
w_pistol,
|
||||
w_357,
|
||||
|
@ -27,5 +28,6 @@ weapon_t g_weapons[] = {
|
|||
w_crossbow,
|
||||
w_frag,
|
||||
w_rpg,
|
||||
w_slam,
|
||||
w_bugbait,
|
||||
};
|
||||
|
|
13
zpak001.pk3dir/def/weapons.def
Normal file
13
zpak001.pk3dir/def/weapons.def
Normal file
|
@ -0,0 +1,13 @@
|
|||
include weapons/crowbar.def
|
||||
include weapons/gravitygun.def
|
||||
include weapons/pistol.def
|
||||
include weapons/357.def
|
||||
include weapons/smg1.def
|
||||
include weapons/ar2.def
|
||||
include weapons/shotgun.def
|
||||
include weapons/crossbow.def
|
||||
include weapons/frag.def
|
||||
include weapons/rpg.def
|
||||
include weapons/bugbait.def
|
||||
include weapons/stunstick.def
|
||||
include weapons/slam.def
|
14
zpak001.pk3dir/def/weapons/357.def
Normal file
14
zpak001.pk3dir/def/weapons/357.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_357
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_357"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/ar2.def
Normal file
14
zpak001.pk3dir/def/weapons/ar2.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_ar2
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_AR2"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/bugbait.def
Normal file
14
zpak001.pk3dir/def/weapons/bugbait.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_bugbait
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_BUGBAIT"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/crossbow.def
Normal file
14
zpak001.pk3dir/def/weapons/crossbow.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_crossbow
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_CROSSBOW"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/crowbar.def
Normal file
14
zpak001.pk3dir/def/weapons/crowbar.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_crowbar
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_CROWBAR"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/frag.def
Normal file
14
zpak001.pk3dir/def/weapons/frag.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_frag
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_FRAG"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/gravitygun.def
Normal file
14
zpak001.pk3dir/def/weapons/gravitygun.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_physcannon
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_GRAVITYGUN"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/pistol.def
Normal file
14
zpak001.pk3dir/def/weapons/pistol.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_pistol
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_PISTOL"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/rpg.def
Normal file
14
zpak001.pk3dir/def/weapons/rpg.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_rpg
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_RPG"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/shotgun.def
Normal file
14
zpak001.pk3dir/def/weapons/shotgun.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_shotgun
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_SHOTGUN"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/slam.def
Normal file
14
zpak001.pk3dir/def/weapons/slam.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_slam
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_slam.mdl"
|
||||
"inv_item" "$WEAPON_SLAM"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/smg1.def
Normal file
14
zpak001.pk3dir/def/weapons/smg1.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_smg1
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_crowbar.mdl"
|
||||
"inv_item" "$WEAPON_SMG1"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
14
zpak001.pk3dir/def/weapons/stunstick.def
Normal file
14
zpak001.pk3dir/def/weapons/stunstick.def
Normal file
|
@ -0,0 +1,14 @@
|
|||
entityDef weapon_stunstick
|
||||
{
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_usage" "Crowbar"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"spawnclass" "NSItem"
|
||||
"model" "models/weapons/w_stunstick.mdl"
|
||||
"inv_item" "$WEAPON_STUNSTICK"
|
||||
"snd_acquire" "weapon.pickup"
|
||||
"snd_respawn" "item.respawn"
|
||||
}
|
15
zpak001.pk3dir/scripts/constants.txt
Normal file
15
zpak001.pk3dir/scripts/constants.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
// weapon constants
|
||||
WEAPON_NONE 0
|
||||
WEAPON_CROWBAR 1
|
||||
WEAPON_STUNSTICK 2
|
||||
WEAPON_GRAVITYGUN 3
|
||||
WEAPON_PISTOL 4
|
||||
WEAPON_357 5
|
||||
WEAPON_SMG1 6
|
||||
WEAPON_AR2 7
|
||||
WEAPON_SHOTGUN 8
|
||||
WEAPON_CROSSBOW 9
|
||||
WEAPON_FRAG 10
|
||||
WEAPON_RPG 11
|
||||
WEAPON_SLAM 12
|
||||
WEAPON_BUGBAIT 13
|
Loading…
Reference in a new issue