Support displaying Double-Tap 1.0 icon

This commit is contained in:
cypress 2023-11-28 11:53:23 -05:00
parent bbb4628670
commit 6b2e5802d9
4 changed files with 48 additions and 4 deletions

View file

@ -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);}

View file

@ -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;

View file

@ -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

View file

@ -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