Draw on-screen Bouncing Betty prompt

This commit is contained in:
cypress 2023-10-28 12:09:06 -04:00
parent e53e0d48aa
commit ca95865c8c
6 changed files with 86 additions and 1 deletions

View file

@ -66,6 +66,7 @@ int x_value, y_value;
void M_DrawPic (int x, int y, qpic_t *pic);
double HUD_Change_time;//hide hud when not chagned
double bettyprompt_time;
extern cvar_t waypoint_mode;
@ -1348,6 +1349,28 @@ void HUD_Weapon (void)
Draw_String (x_value, y_value, str);
}
/*
===============
HUD_BettyPrompt
===============
*/
void HUD_BettyPrompt (void)
{
char str[32];
char str2[32];
strcpy(str, va("Tap SWAP then press %s to\n", GetGrenadeButtonL()));
strcpy(str2, "place a Bouncing Betty\n");
int x, x2;
x = (vid.width - strlen(str)*8)/2;
x2 = (vid.width - strlen(str2)*8)/2;
Draw_String(x, 60, str);
Draw_String(x2, 72, str2);
Draw_Pic (x + 20*8 - 4, 56, GetButtonIcon("+grenade"));
}
/*
===============
HUD_Draw
@ -1383,6 +1406,9 @@ void HUD_Draw (void)
return;
}
if (bettyprompt_time > sv.time)
HUD_BettyPrompt();
HUD_Blood();
HUD_Rounds();
HUD_Perks();

View file

@ -1021,7 +1021,7 @@ void CL_ParseLimbUpdate (void)
#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
extern double bettyprompt_time;
void CL_ParseServerMessage (void)
{
int cmd;
@ -1114,6 +1114,10 @@ void CL_ParseServerMessage (void)
case svc_pulse:
crosshair_pulse_grenade = true;
break;
case svc_bettyprompt:
bettyprompt_time = sv.time + 4;
break;
case svc_stufftext:
Cbuf_AddText (MSG_ReadString ());

View file

@ -339,6 +339,32 @@ char *GetUseButtonL ()
return " ";
}
char *GetGrenadeButtonL ()
{
int j;
int l;
char *b;
l = strlen("+grenade");
for (j=0 ; j<256 ; j++)
{
b = keybindings[j];
if (!b)
continue;
if (!strncmp (b, "+grenade", l) )
{
if (!strcmp(Key_KeynumToString(j), "SELECT") ||
!strcmp(Key_KeynumToString(j), "LTRIGGER") ||
!strcmp(Key_KeynumToString(j), "RTRIGGER") ||
!strcmp(Key_KeynumToString(j), "HOME"))
return " ";
else
return " ";
}
}
return " ";
}
char *GetPerkName (int perk)
{
switch (perk)

View file

@ -3231,6 +3231,31 @@ void PF_GrenadePulse(void)
MSG_WriteByte (&client->message,svc_pulse);
}
/*
=================
PF_BettyPrompt
draws status on hud on
how to use bouncing
betty.
nzp_bettyprompt()
=================
*/
void PF_BettyPrompt(void)
{
client_t *client;
int entnum;
entnum = G_EDICTNUM(OFS_PARM0);
if (entnum < 1 || entnum > svs.maxclients)
return;
client = &svs.clients[entnum-1];
MSG_WriteByte (&client->message, svc_bettyprompt);
}
/*
=================
PF_MaxZombies
@ -3848,6 +3873,7 @@ PF_SongEgg, // #500
PF_MaxAmmo, // #501
PF_GrenadePulse, // #502
PF_MaxZombies, // #503
PF_BettyPrompt, // #504
PF_Fixme,
};

View file

@ -151,6 +151,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_songegg 44 // [string] track name
#define svc_maxammo 45
#define svc_pulse 46
#define svc_bettyprompt 47
//
// client to server

View file

@ -29,6 +29,8 @@ void SCR_SizeDown (void);
void SCR_BringDownConsole (void);
void SCR_CenterPrint (char *str);
void SCR_UsePrint (int type, int cost, int weapon);
qpic_t *GetButtonIcon (char *buttonname);
char *GetGrenadeButtonL();
void SCR_BeginLoadingPlaque (void);
void SCR_EndLoadingPlaque (void);