2021-03-08 03:08:54 -08:00
|
|
|
/*
|
2022-03-13 16:56:32 -07:00
|
|
|
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
2021-03-08 03:08:54 -08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-01-17 14:03:13 -08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NAILGUN_IDLE,
|
|
|
|
NAILGUN_FIDGET1,
|
|
|
|
NAILGUN_UNUSED1,
|
|
|
|
NAILGUN_UNUSED2,
|
|
|
|
NAILGUN_DEPLOY,
|
|
|
|
NAILGUN_SHOOT1,
|
|
|
|
NAILGUN_SHOOT2,
|
|
|
|
NAILGUN_SHOOT3,
|
|
|
|
};
|
|
|
|
|
2021-03-08 03:08:54 -08:00
|
|
|
void
|
|
|
|
w_supernail_precache(void)
|
|
|
|
{
|
2023-01-17 14:03:13 -08:00
|
|
|
#ifdef CLIENT
|
2021-03-08 03:08:54 -08:00
|
|
|
precache_model("models/v_tfc_supernailgun.mdl");
|
2023-01-17 14:03:13 -08:00
|
|
|
#else
|
2021-03-08 03:08:54 -08:00
|
|
|
precache_model("models/w_supernail.mdl");
|
|
|
|
precache_model("models/p_supernail.mdl");
|
2023-01-17 14:03:13 -08:00
|
|
|
precache_model("models/nail.mdl");
|
|
|
|
Sound_Precache("weapon_nailgun.fire");
|
|
|
|
#endif
|
2021-03-08 03:08:54 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
w_supernail_updateammo(player pl)
|
|
|
|
{
|
2023-01-17 14:03:13 -08:00
|
|
|
Weapons_UpdateAmmo(pl, __NULL__, pl.m_iAmmoNails, __NULL__);
|
2021-03-08 03:08:54 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
w_supernail_wmodel(void)
|
|
|
|
{
|
|
|
|
return "models/w_supernail.mdl";
|
|
|
|
}
|
|
|
|
string
|
2022-03-15 19:34:02 -07:00
|
|
|
w_supernail_pmodel(player pl)
|
2021-03-08 03:08:54 -08:00
|
|
|
{
|
|
|
|
return "models/p_supernail.mdl";
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
w_supernail_deathmsg(void)
|
|
|
|
{
|
|
|
|
return "%s was assaulted by %s's Assault Cannon.";
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-03-15 19:34:02 -07:00
|
|
|
w_supernail_draw(player pl)
|
2021-03-08 03:08:54 -08:00
|
|
|
{
|
|
|
|
Weapons_SetModel("models/v_tfc_supernailgun.mdl");
|
2023-01-17 14:03:13 -08:00
|
|
|
Weapons_ViewAnimation(pl, NAILGUN_DEPLOY);
|
2021-03-08 03:08:54 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
float
|
2022-03-15 19:34:02 -07:00
|
|
|
w_supernail_aimanim(player pl)
|
2021-03-08 03:08:54 -08:00
|
|
|
{
|
|
|
|
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
|
|
|
}
|
|
|
|
|
2023-01-17 14:03:13 -08:00
|
|
|
void
|
|
|
|
w_supernail_shootnail(player pl)
|
|
|
|
{
|
|
|
|
static void w_rpg_shootrocket_touch(void) {
|
|
|
|
#ifndef CLIENT
|
|
|
|
/* impact per bullet */
|
|
|
|
if (trace_ent.iBleeds == 0) {
|
|
|
|
DecalGroups_Place("Impact.BigShot", trace_endpos + (v_forward * -2));
|
|
|
|
SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
remove(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
Weapons_MakeVectors(pl);
|
|
|
|
entity p = spawn();
|
|
|
|
setmodel(p, "models/nail.mdl");
|
|
|
|
setorigin(p, Weapons_GetCameraPos(pl) + (v_forward * 14) + (v_up * -4) + (v_right * 2));
|
|
|
|
p.owner = self;
|
|
|
|
p.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
p.solid = SOLID_BBOX;
|
|
|
|
p.gravity = 0.5f;
|
|
|
|
p.velocity = (v_forward * 1000) + (v_up * 4) + (v_right * -2);
|
|
|
|
p.angles = vectoangles(p.velocity);
|
|
|
|
p.touch = w_rpg_shootrocket_touch;
|
|
|
|
p.think = Util_Destroy;
|
|
|
|
p.nextthink = time + 5.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
w_supernail_primary(player pl)
|
|
|
|
{
|
|
|
|
int s = w_baseprojectile_fire_num(pl, WEAPON_NAILGUN, player::m_iAmmoNails, w_supernail_shootnail, 2);
|
|
|
|
|
|
|
|
switch (s) {
|
|
|
|
case AUTO_FIRE_FAILED:
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case AUTO_FIRED:
|
|
|
|
case AUTO_LAST:
|
|
|
|
int r = (float)input_sequence % 3;
|
|
|
|
if (r == 1) {
|
|
|
|
Weapons_ViewAnimation(pl, NAILGUN_SHOOT1);
|
|
|
|
} else if (r == 2) {
|
|
|
|
Weapons_ViewAnimation(pl, NAILGUN_SHOOT2);
|
|
|
|
} else {
|
|
|
|
Weapons_ViewAnimation(pl, NAILGUN_SHOOT3);
|
|
|
|
}
|
|
|
|
Weapons_ViewAnimation(pl, NAILGUN_SHOOT2);
|
|
|
|
Weapons_ViewPunchAngle(pl, [-1,0,0]);
|
2023-01-18 17:04:46 -08:00
|
|
|
#ifdef CLIENT
|
|
|
|
View_SetMuzzleflash(MUZZLE_RIFLE);
|
|
|
|
#endif
|
2023-01-17 14:03:13 -08:00
|
|
|
#ifndef CLIENT
|
|
|
|
Sound_Play(pl, CHAN_WEAPON, "weapon_nailgun.fire");
|
|
|
|
#endif
|
|
|
|
pl.w_attack_next = 0.1f;
|
|
|
|
break;
|
|
|
|
case AUTO_EMPTY:
|
|
|
|
pl.w_attack_next = 0.2f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pl.w_idle_next = 1.5f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
w_supernail_hud(player pl)
|
|
|
|
{
|
|
|
|
#ifdef CLIENT
|
|
|
|
vector aicon_pos;
|
|
|
|
|
2023-01-18 17:04:46 -08:00
|
|
|
Cross_DrawSub(g_cross_spr, [24,24], [0.1875,0], [0.1875, 0.1875]);
|
2023-01-17 14:03:13 -08:00
|
|
|
HUD_DrawAmmo2();
|
|
|
|
|
|
|
|
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
|
|
|
drawsubpic(
|
|
|
|
aicon_pos,
|
|
|
|
[24,24],
|
|
|
|
g_hud7_spr,
|
|
|
|
[0,72/128],
|
|
|
|
[24/256, 24/128],
|
|
|
|
g_hud_color,
|
|
|
|
pSeatLocal->m_flAmmo2Alpha,
|
|
|
|
DRAWFLAG_ADDITIVE
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-03-08 03:08:54 -08:00
|
|
|
void
|
2022-03-15 19:34:02 -07:00
|
|
|
w_supernail_hudpic(player pl, int selected, vector pos, float a)
|
2021-03-08 03:08:54 -08:00
|
|
|
{
|
|
|
|
#ifdef CLIENT
|
|
|
|
if (selected) {
|
|
|
|
drawsubpic(
|
|
|
|
pos,
|
|
|
|
[170,45],
|
|
|
|
"sprites/tfchud07.spr_0.tga",
|
|
|
|
[0,135/256],
|
|
|
|
[170/256,45/256],
|
|
|
|
g_hud_color,
|
|
|
|
a,
|
|
|
|
DRAWFLAG_ADDITIVE
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
drawsubpic(
|
|
|
|
pos,
|
|
|
|
[170,45],
|
|
|
|
"sprites/tfchud07.spr_0.tga",
|
|
|
|
[0,135/256],
|
|
|
|
[170/256,45/256],
|
|
|
|
g_hud_color,
|
|
|
|
a,
|
|
|
|
DRAWFLAG_ADDITIVE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
weapon_t w_supernail =
|
|
|
|
{
|
|
|
|
.name = "supernail",
|
2021-05-20 07:06:03 -07:00
|
|
|
.id = ITEM_SUPERNAIL,
|
2021-03-08 03:08:54 -08:00
|
|
|
.slot = 3,
|
|
|
|
.slot_pos = 2,
|
|
|
|
.draw = w_supernail_draw,
|
|
|
|
.holster = __NULL__,
|
2023-01-17 14:03:13 -08:00
|
|
|
.primary = w_supernail_primary,
|
2021-03-08 03:08:54 -08:00
|
|
|
.secondary = __NULL__,
|
|
|
|
.reload = __NULL__,
|
|
|
|
.release = __NULL__,
|
2023-01-17 14:03:13 -08:00
|
|
|
.postdraw = w_supernail_hud,
|
2021-03-08 03:08:54 -08:00
|
|
|
.precache = w_supernail_precache,
|
|
|
|
.pickup = __NULL__,
|
|
|
|
.updateammo = w_supernail_updateammo,
|
|
|
|
.wmodel = w_supernail_wmodel,
|
|
|
|
.pmodel = w_supernail_pmodel,
|
|
|
|
.deathmsg = w_supernail_deathmsg,
|
|
|
|
.aimanim = w_supernail_aimanim,
|
2023-01-17 11:58:35 -08:00
|
|
|
.hudpic = w_supernail_hudpic,
|
|
|
|
.isempty = w_asscan_isempty
|
2021-03-08 03:08:54 -08:00
|
|
|
};
|