From b0dbd92aca3a8d8cdf33c1e03b1f09fd1a471a3c Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Sat, 6 Aug 2022 12:05:51 -0700 Subject: [PATCH] WEAPON_SATCHEL: Draw satchel viewmodel again if there's no more satchels we can detonate. --- src/shared/w_satchel.qc | 18 +++++++++++++----- src/shared/w_shotgun.qc | 4 ---- src/shared/w_snark.qc | 4 +++- src/shared/w_tripmine.qc | 3 --- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/shared/w_satchel.qc b/src/shared/w_satchel.qc index 46f0b18..9c3bad0 100644 --- a/src/shared/w_satchel.qc +++ b/src/shared/w_satchel.qc @@ -158,7 +158,6 @@ w_satchel_holster(player pl) void w_satchel_primary(player pl) { - if (pl.w_attack_next) { return; } @@ -184,6 +183,7 @@ w_satchel_primary(player pl) s_satchel_drop(pl, pl.origin, throw); 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); @@ -218,7 +218,6 @@ w_satchel_primary(player pl) void w_satchel_secondary(player pl) { - if (pl.w_attack_next) { return; } @@ -245,9 +244,10 @@ w_satchel_secondary(player pl) 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 = 2.5f; + pl.w_idle_next = 0.5f; } void @@ -259,11 +259,19 @@ w_satchel_reload(player pl) void w_satchel_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_satchel.mdl"); + Weapons_ViewAnimation(pl, SATCHEL_DRAW); + pl.w_idle_next = 15.0f; + return; + } + if (pl.satchel_chg <= 0) { Weapons_ViewAnimation(pl, SATCHEL_FIDGET); } else { @@ -321,7 +329,7 @@ w_satchel_type(player pl) weapon_t w_satchel = { .name = "satchel", - .id = ITEM_SATCHEL, + .id = ITEM_SATCHEL, .slot = 4, .slot_pos = 1, .weight = -20, diff --git a/src/shared/w_shotgun.qc b/src/shared/w_shotgun.qc index 71cf2bf..bc0cb19 100644 --- a/src/shared/w_shotgun.qc +++ b/src/shared/w_shotgun.qc @@ -124,7 +124,6 @@ int w_shotgun_pickup(player pl, int new, int startammo) { #ifdef SERVER - if (new) { pl.shotgun_mag = 8; return (1); @@ -160,7 +159,6 @@ void w_shotgun_release(player pl); void w_shotgun_reload(player pl) { - if (pl.shotgun_mag >= 8) { return; } @@ -308,7 +306,6 @@ w_shotgun_secondary(player pl) void w_shotgun_release(player pl) { - /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.mode_tempstate == SHOTTY_IDLE && pl.shotgun_mag == 0 && pl.ammo_buckshot > 0) { @@ -416,7 +413,6 @@ w_shotgun_hudpic(player pl, int selected, vector pos, float a) int w_shotgun_isempty(player pl) { - if (pl.shotgun_mag <= 0 && pl.ammo_buckshot <= 0) return 1; diff --git a/src/shared/w_snark.qc b/src/shared/w_snark.qc index 5ae2c7a..5c94d68 100644 --- a/src/shared/w_snark.qc +++ b/src/shared/w_snark.qc @@ -213,14 +213,17 @@ void w_snark_primary(player pl) pl.w_attack_next = 0.25f; } + void w_snark_secondary(player pl) { } + void w_snark_reload(player pl) { } + void w_snark_release(player pl) { int r; @@ -298,7 +301,6 @@ void w_snark_hud(player pl) void w_snark_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - if (selected) { drawsubpic(pos, [170,45], g_hud6_spr, [0,135/256], [170/256,45/256], diff --git a/src/shared/w_tripmine.qc b/src/shared/w_tripmine.qc index c4acd0d..760aa7b 100644 --- a/src/shared/w_tripmine.qc +++ b/src/shared/w_tripmine.qc @@ -305,7 +305,6 @@ w_tripmine_primary(player pl) void w_tripmine_release(player pl) { - if (pl.w_idle_next > 0.0) { return; } @@ -360,7 +359,6 @@ void w_tripmine_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - if (selected) { drawsubpic(pos, [170,45], g_hud6_spr, [0,90/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE); } else { @@ -374,7 +372,6 @@ w_tripmine_hudpic(player pl, int selected, vector pos, float a) int w_tripmine_isempty(player pl) { - if (pl.ammo_tripmine <= 0) return 1;