From 6b2e5802d91d60f9d399818c542bb82677fbce06 Mon Sep 17 00:00:00 2001 From: cypress Date: Tue, 28 Nov 2023 11:53:23 -0500 Subject: [PATCH] Support displaying Double-Tap 1.0 icon --- source/cl_hud.c | 14 ++++++++++++-- source/cl_parse.c | 5 +++++ source/pr_cmds.c | 31 ++++++++++++++++++++++++++++++- source/protocol.h | 2 +- 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/source/cl_hud.c b/source/cl_hud.c index 61a5da1..272a4f1 100644 --- a/source/cl_hud.c +++ b/source/cl_hud.c @@ -36,6 +36,7 @@ qpic_t *jugpic; qpic_t *floppic; qpic_t *staminpic; qpic_t *doublepic; +qpic_t *doublepic2; qpic_t *speedpic; qpic_t *deadpic; qpic_t *mulepic; @@ -65,6 +66,7 @@ qpic_t *fx_blood_rd; qboolean sb_showscores; qboolean domaxammo; qboolean has_chaptertitle; +qboolean doubletap_has_damage_buff; int x_value, y_value; @@ -130,6 +132,7 @@ void HUD_Init (void) floppic = Draw_CachePic ("gfx/hud/flopper"); staminpic = Draw_CachePic ("gfx/hud/stamin"); doublepic = Draw_CachePic ("gfx/hud/double"); + doublepic2 = Draw_CachePic ("gfx/hud/double2"); speedpic = Draw_CachePic ("gfx/hud/speed"); deadpic = Draw_CachePic ("gfx/hud/dead"); mulepic = Draw_CachePic ("gfx/hud/mule"); @@ -1128,12 +1131,19 @@ void HUD_Perks (void) y = 2; scale = 22; + // Double-Tap 2.0 specialty icon + qpic_t* double_tap_icon; + if (doubletap_has_damage_buff) + double_tap_icon = doublepic2; + else + double_tap_icon = doublepic; + // Draw second column first -- these need to be // overlayed below the first column. for (int i = 4; i < 8; i++) { if (perk_order[i]) { if (perk_order[i] == P_JUG) {Draw_StretchPic(x, y, jugpic, scale, scale);} - if (perk_order[i] == P_DOUBLE) {Draw_StretchPic(x, y, doublepic, scale, scale);} + if (perk_order[i] == P_DOUBLE) {Draw_StretchPic(x, y, double_tap_icon, scale, scale);} if (perk_order[i] == P_SPEED) {Draw_StretchPic(x, y, speedpic, scale, scale);} if (perk_order[i] == P_REVIVE) {Draw_StretchPic(x, y, revivepic, scale, scale);} if (perk_order[i] == P_FLOP) {Draw_StretchPic(x, y, floppic, scale, scale);} @@ -1151,7 +1161,7 @@ void HUD_Perks (void) for (int i = 0; i < 4; i++) { if (perk_order[i]) { if (perk_order[i] == P_JUG) {Draw_StretchPic(x, y, jugpic, scale, scale);} - if (perk_order[i] == P_DOUBLE) {Draw_StretchPic(x, y, doublepic, scale, scale);} + if (perk_order[i] == P_DOUBLE) {Draw_StretchPic(x, y, double_tap_icon, scale, scale);} if (perk_order[i] == P_SPEED) {Draw_StretchPic(x, y, speedpic, scale, scale);} if (perk_order[i] == P_REVIVE) {Draw_StretchPic(x, y, revivepic, scale, scale);} if (perk_order[i] == P_FLOP) {Draw_StretchPic(x, y, floppic, scale, scale);} diff --git a/source/cl_parse.c b/source/cl_parse.c index ced0ef9..9a673a7 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -1143,6 +1143,7 @@ CL_ParseServerMessage ===================== */ extern double bettyprompt_time; +extern qboolean doubletap_has_damage_buff; void CL_ParseServerMessage (void) { int cmd; @@ -1233,6 +1234,10 @@ void CL_ParseServerMessage (void) crosshair_pulse_grenade = true; break; + case svc_doubletap: + doubletap_has_damage_buff = MSG_ReadByte(); + break; + case svc_bettyprompt: bettyprompt_time = sv.time + 4; break; diff --git a/source/pr_cmds.c b/source/pr_cmds.c index af4f223..31cfbdf 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -3299,6 +3299,34 @@ void PF_GrenadePulse(void) MSG_WriteByte (&client->message, svc_pulse); } +/* +================= +PF_SetDoubleTapVersion + +Server tells client which HUD icon +to draw for Double-Tap (damage buff +v.s. just rate of fire enhancement). + +nzp_setdoubletapver() +================= +*/ +void PF_SetDoubleTapVersion(void) +{ + client_t *client; + int entnum; + int state; + + entnum = G_EDICTNUM(OFS_PARM0); + state = G_FLOAT(OFS_PARM1); + + if (entnum < 1 || entnum > svs.maxclients) + return; + + client = &svs.clients[entnum-1]; + MSG_WriteByte (&client->message, svc_doubletap); + MSG_WriteByte (&client->message, state); +} + /* ================= PF_BettyPrompt @@ -3707,7 +3735,8 @@ ebfs_builtin_t pr_ebfs_builtins[] = { 502, "grenade_pulse", PF_GrenadePulse }, { 503, "nzp_maxai", PF_MaxZombies }, { 504, "nzp_bettyprompt", PF_BettyPrompt }, - { 505, "nzp_setplayername", PF_SetPlayerName } + { 505, "nzp_setplayername", PF_SetPlayerName }, + { 506, "nzp_setdoubletapver", PF_SetDoubleTapVersion } // 2001-11-15 DarkPlaces general builtin functions by Lord Havoc end diff --git a/source/protocol.h b/source/protocol.h index 3e6635b..f40284b 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -153,7 +153,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define svc_pulse 46 #define svc_bettyprompt 47 #define svc_playername 48 - +#define svc_doubletap 49 // // client to server