More polish on the various weaponry.

This commit is contained in:
Marco Cawthorne 2023-01-23 02:21:39 -08:00
parent 2a754f971a
commit c033b256ea
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
21 changed files with 110 additions and 67 deletions

View File

@ -227,7 +227,7 @@ w_asscan_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
g_tfchud4_spr,
[0,90/256],
[170/256,45/256],
hud_col,
@ -238,7 +238,7 @@ w_asscan_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
g_tfchud3_spr,
[0,45/256],
[170/256,45/256],
hud_col,

View File

@ -61,6 +61,9 @@ w_autorifle_deathmsg(void)
void
w_autorifle_release(player pl)
{
if (pl.w_idle_next > 0)
return;
Weapons_ViewAnimation(pl, SNIPER_AUTOIDLE);
}
@ -68,7 +71,8 @@ void
w_autorifle_draw(player pl)
{
Weapons_SetModel("models/v_tfc_sniper.mdl");
Weapons_ViewAnimation(pl, SNIPER_AUTOIDLE);
Weapons_ViewAnimation(pl, SNIPER_AUTODRAW);
pl.w_idle_next = 1.0f;
}
float
@ -96,11 +100,12 @@ w_autorifle_primary(player pl)
pl.w_attack_next = 0.1f;
break;
case AUTO_EMPTY:
w_autorifle_release(pl);
pl.w_attack_next = 0.2f;
break;
}
pl.w_idle_next = 1.5f;
pl.w_idle_next = 0.0f;
}
void
@ -128,7 +133,7 @@ w_autorifle_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud02.spr_0.tga",
g_tfchud2_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -139,7 +144,7 @@ w_autorifle_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud01.spr_0.tga",
g_tfchud1_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -159,7 +164,7 @@ weapon_t w_autorifle =
.draw = w_autorifle_draw,
.holster = __NULL__,
.primary = w_autorifle_primary,
.secondary = __NULL__,
.secondary = w_autorifle_release,
.reload = __NULL__,
.release = w_autorifle_release,
.postdraw = w_autorifle_postdraw,

View File

@ -144,7 +144,7 @@ w_crowbar_primary(player pl)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
Damage_Apply(trace_ent, pl, 18, WEAPON_CROWBAR, DMG_BLUNT);
if (trace_ent.iBleeds) {
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
}

View File

@ -183,9 +183,9 @@ w_dbs_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
if (s) {
drawsubpic(pos, [170,45], "sprites/640hud4.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_hud4_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], "sprites/640hud1.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_hud1_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}

View File

@ -190,7 +190,7 @@ w_flamer_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
g_tfchud4_spr,
[0,45/256],
[170/256,45/256],
hud_col,
@ -201,7 +201,7 @@ w_flamer_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
g_tfchud3_spr,
[0,0/256],
[170/256,45/256],
hud_col,

View File

@ -83,9 +83,11 @@ w_glauncher_draw(player pl)
Weapons_ViewAnimation(pl, GLAUNCHER_GDRAW);
}
void
w_glauncher_shootnade(player pl)
{
#ifdef SERVER
vector vecNadeVelocity;
static void w_glauncher_shootnade_touch(void) {
@ -98,7 +100,7 @@ w_glauncher_shootnade(player pl)
static void w_glauncher_explode(void) {
float dmg = 100;
FX_Explosion(self.origin);
//Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_GLAUNCHER);
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_GLAUNCHER);
sound(self, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
NSEntity::Destroy();
}
@ -125,6 +127,7 @@ w_glauncher_shootnade(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.gl");
//eNade.traileffectnum = particleeffectnum("weapon_rpg.trail");
#endif
}
void
@ -222,7 +225,7 @@ w_glauncher_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud02.spr_0.tga",
g_tfchud2_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,
@ -233,7 +236,7 @@ w_glauncher_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud01.spr_0.tga",
g_tfchud1_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,

View File

@ -68,7 +68,7 @@ w_grapple_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/640hud4.spr_0.tga",
g_tfchud4_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -79,7 +79,7 @@ w_grapple_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/640hud1.spr_0.tga",
g_tfchud1_spr,
[0,0],
[170/256,45/256],
g_hud_color,

View File

@ -154,7 +154,7 @@ w_incendiary_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
g_tfchud5_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,
@ -165,7 +165,7 @@ w_incendiary_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud06.spr_0.tga",
g_tfchud6_spr,
[0,0],
[170/256,45/256],
g_hud_color,

View File

@ -121,7 +121,7 @@ w_knife_primary(player pl)
// Backstab detection
if (trace_ent.takedamage) {
int damage = 10;
int damage = 36;
damageType_t dmgtype = DMG_BLUNT;
if (trace_ent.classname == "player") {
@ -155,7 +155,7 @@ w_knife_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud04.spr_0.tga",
g_tfchud4_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,
@ -166,7 +166,7 @@ w_knife_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud03.spr_0.tga",
g_tfchud3_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,

View File

@ -142,7 +142,7 @@ w_medkit_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
g_tfchud5_spr,
[0,180/256],
[170/256,45/256],
g_hud_color,
@ -153,7 +153,7 @@ w_medkit_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud06.spr_0.tga",
g_tfchud6_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,

View File

@ -82,6 +82,9 @@ w_nailgun_shootnail(player pl)
DecalGroups_Place("Impact.BigShot", trace_endpos + (v_forward * -2));
SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self.owner, 9, WEAPON_NAILGUN, DMG_BULLET);
}
#endif
remove(self);
}
@ -157,7 +160,7 @@ w_nailgun_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,
@ -168,7 +171,7 @@ w_nailgun_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,

View File

@ -73,7 +73,7 @@ void w_pipebomb_explode(void)
float dmg = 100;
FX_Explosion(self.origin);
//Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_GLAUNCHER);
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_GLAUNCHER);
sound(self, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
NSEntity::Destroy();
}
@ -255,7 +255,7 @@ w_pipebomb_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud02.spr_0.tga",
g_tfchud2_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,
@ -266,7 +266,7 @@ w_pipebomb_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud01.spr_0.tga",
g_tfchud1_spr,
[0,90/256],
[170/256,45/256],
g_hud_color,

View File

@ -59,7 +59,7 @@ void
w_railgun_draw(player pl)
{
Weapons_SetModel("models/v_tfc_railgun.mdl");
Weapons_ViewAnimation(pl, 0);
Weapons_ViewAnimation(pl, RAILGUN_DRAW);
}
float
@ -71,6 +71,7 @@ w_railgun_aimanim(player pl)
void
w_railgun_shootbeam(player pl)
{
#ifdef SERVER
static void w_railgun_shootbeam_touch(void) {
#ifndef CLIENT
/* impact per bullet */
@ -78,6 +79,9 @@ w_railgun_shootbeam(player pl)
DecalGroups_Place("Impact.BigShot", trace_endpos + (v_forward * -2));
SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self.owner, 23, WEAPON_RAILGUN, DMG_BULLET);
}
#endif
remove(self);
}
@ -85,16 +89,19 @@ w_railgun_shootbeam(player pl)
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));
setorigin(p, Weapons_GetCameraPos(pl) + (v_forward * 14) + (v_up * -5) + (v_right * 3.5));
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.velocity = (v_forward * 1000) + (v_up * 5) + (v_right * -3.5);
p.angles = vectoangles(p.velocity);
p.touch = w_railgun_shootbeam_touch;
p.think = Util_Destroy;
p.nextthink = time + 5.0f;
p.alpha = 0.01f;
p.traileffectnum = particleeffectnum("weapon_railgun.trail");
#endif
}
void
@ -143,7 +150,7 @@ w_railgun_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -154,7 +161,7 @@ w_railgun_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,0],
[170/256,45/256],
g_hud_color,

View File

@ -194,7 +194,7 @@ w_rpg_hud(player pl)
drawsubpic(
aicon_pos,
[24,24],
"sprites/640hud7.spr_0.tga",
g_hud7_spr,
[120/256,72/128],
[24/256, 24/128],
g_hud_color,
@ -210,9 +210,9 @@ w_rpg_hudpic(player pl, int selected, vector pos, float a)
{
#ifdef CLIENT
if (selected) {
drawsubpic(pos, [170,45], "sprites/640hud5.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_hud5_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], "sprites/640hud2.spr_0.tga", [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}

View File

@ -171,9 +171,9 @@ w_sbs_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
if (s) {
drawsubpic(pos, [170,45], "sprites/tfchud02.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_tfchud2_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], "sprites/tfchud01.spr_0.tga", [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
drawsubpic(pos, [170,45], g_tfchud1_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}

View File

@ -62,7 +62,8 @@ void
w_sniper_draw(player pl)
{
Weapons_SetModel("models/v_tfc_sniper.mdl");
Weapons_ViewAnimation(pl, SNIPER_IDLE);
Weapons_ViewAnimation(pl, SNIPER_DRAW);
pl.w_idle_next = 1.0f;
}
float
@ -74,7 +75,7 @@ w_sniper_aimanim(player pl)
void
w_sniper_release(player pl)
{
if (pl.w_attack_next > 0.0)
if (pl.w_idle_next > 0.0)
return;
if (pl.mode_tempstate > 0) {
@ -86,7 +87,7 @@ w_sniper_release(player pl)
#endif
Weapons_Sound(pl, CHAN_WEAPON, "weapon_sniper.fire");
pl.w_attack_next = 2.0f;
pl.w_idle_next = 1.5f;
pl.w_idle_next = 0.5f;
pl.mode_tempstate = 0;
}
}
@ -105,20 +106,30 @@ w_sniper_primary(player pl)
return;
/* if we aren't already, 'aim' down... */
if (pl.mode_tempstate == 0) {
Weapons_ViewAnimation(pl, SNIPER_AIM);
}
pl.mode_tempstate += 1;
pl.w_attack_next = 1.0f;
if (pl.mode_tempstate == 0) {
Weapons_ViewAnimation(pl, SNIPER_AIM);
pl.w_idle_next = pl.w_attack_next;
}
}
void
w_sniper_secondary(player pl)
{
if (pl.w_attack_next) {
if (!(input_buttons & INPUT_BUTTON0)) {
if (pl.mode_tempstate != 0) {
w_sniper_release(pl);
return;
}
}
if (pl.w_idle_next > 0) {
return;
}
/* Simple toggle of fovs */
if (pl.viewzoom == 1.0f) {
pl.viewzoom = 0.2f;
@ -126,19 +137,14 @@ w_sniper_secondary(player pl)
pl.viewzoom = 1.0f;
}
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.25f;
}
void
w_sniper_postdraw(player pl)
{
#ifdef CLIENT
// crosshair
if (pl.viewzoom == 1) {
Cross_DrawSub(g_cross_spr, [24,24], [72/128,0], [0.1875, 0.1875]);
} else {
Cross_DrawSub(g_cross_spr, [104,16], [24/128,96/128], [104/128, 16/128]);
}
Cross_DrawSub(g_cross_spr, [24,24], [72/128,0], [0.1875, 0.1875]);
if (pl.mode_tempstate) {
vector laser_pos;
@ -146,8 +152,9 @@ w_sniper_postdraw(player pl)
vector jitter = [0.0f, 0.0f, 0.0f];
Weapons_MakeVectors(pl);
vector src = pl.origin + pl.view_ofs;
float a = bound(0.0, (pl.mode_tempstate / 10), 1.0) * 0.75;
traceline(src, src + (v_forward * 256), FALSE, pl);
lerp = Math_Lerp(18,6, trace_fraction);
lerp = Math_Lerp(32,16, trace_fraction);
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
jitter[1] = (random(0,2) - 2) * (1 - trace_fraction);
laser_pos = g_hudmins + (g_hudres / 2) + ([-lerp,-lerp] / 2);
@ -158,8 +165,8 @@ w_sniper_postdraw(player pl)
g_laser_spr,
[0,0],
[1.0, 1.0],
[1,1,1],
1.0f,
[1,1,1] * (0.25 + a),
1.0,
DRAWFLAG_ADDITIVE
);
}
@ -167,7 +174,7 @@ w_sniper_postdraw(player pl)
// ammo counter
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", [72/256,72/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [72/256,72/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
#endif
}
@ -179,7 +186,7 @@ w_sniper_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud02.spr_0.tga",
g_tfchud2_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -190,7 +197,7 @@ w_sniper_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud01.spr_0.tga",
g_tfchud1_spr,
[0,0],
[170/256,45/256],
g_hud_color,

View File

@ -85,6 +85,9 @@ w_supernail_shootnail(player pl)
DecalGroups_Place("Impact.BigShot", trace_endpos + (v_forward * -2));
SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self.owner, 14, WEAPON_NAILGUN, DMG_BULLET);
}
#endif
remove(self);
}
@ -172,7 +175,7 @@ w_supernail_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,
@ -183,7 +186,7 @@ w_supernail_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud07.spr_0.tga",
g_tfchud7_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,

View File

@ -77,6 +77,9 @@ w_tranquil_shootdart(player pl)
DecalGroups_Place("Impact.BigShot", trace_endpos + (v_forward * -2));
SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal);
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self.owner, 18, WEAPON_TRANQUIL, DMG_BULLET);
}
#endif
remove(self);
}
@ -151,7 +154,7 @@ w_tranquil_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud05.spr_0.tga",
g_tfchud5_spr,
[0,135/256],
[170/256,45/256],
g_hud_color,
@ -162,7 +165,7 @@ w_tranquil_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/tfchud06.spr_0.tga",
g_tfchud6_spr,
[0,45/256],
[170/256,45/256],
g_hud_color,

View File

@ -138,7 +138,7 @@ w_umbrella_primary(player pl)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, WEAPON_UMBRELLA, DMG_BLUNT);
Damage_Apply(trace_ent, self, 18, WEAPON_UMBRELLA, DMG_BLUNT);
if (!trace_ent.iBleeds) {
return;
@ -187,7 +187,7 @@ w_umbrella_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/640hud4.spr_0.tga",
g_hud4_spr,
[0,0],
[170/256,45/256],
g_hud_color,
@ -198,7 +198,7 @@ w_umbrella_hudpic(player pl, int selected, vector pos, float a)
drawsubpic(
pos,
[170,45],
"sprites/640hud1.spr_0.tga",
g_hud1_spr,
[0,0],
[170/256,45/256],
g_hud_color,

View File

@ -141,7 +141,7 @@ w_wrench_primary(player pl)
/* Damage without armor is between 12 - 20, so let's just do 15 for now */
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_wrench", 15), WEAPON_WRENCH, DMG_BLUNT);
Damage_Apply(trace_ent, pl, 18, WEAPON_WRENCH, DMG_BLUNT);
if (trace_ent.iBleeds) {
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
}

View File

@ -0,0 +1,12 @@
r_part trail
{
texture "particles/fteparticlefont.tga"
tcoords 97 97 191 191 256
scale 1
rgbf 0 1 0
blend add
step 4
die 0.075
randomvel 0
type beam
}