Draw on-screen Bouncing Betty prompt

This commit is contained in:
cypress 2023-10-28 12:09:23 -04:00
parent 33dc5e3c9f
commit a9190e7ef0
6 changed files with 88 additions and 1 deletions

View file

@ -71,6 +71,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;
@ -1385,6 +1386,29 @@ void HUD_Weapon (void)
Draw_String (x_value, y_value, str);
}
/*
===============
HUD_BettyPrompt
===============
*/
void HUD_BettyPrompt (void)
{
char str[64];
char str2[32];
strcpy(str, va("Double-tap %s then press %s\n", GetUseButtonL(), GetGrenadeButtonL()));
strcpy(str2, "to 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, 70, str2);
Draw_Pic (x + 11*8, 60, GetButtonIcon("+use"));
Draw_Pic (x + 25*8, 60, GetButtonIcon("+grenade"));
}
/*
===============
HUD_Draw
@ -1419,6 +1443,9 @@ void HUD_Draw (void)
return;
}
if (bettyprompt_time > sv.time)
HUD_BettyPrompt();
HUD_Blood();
HUD_Rounds();
HUD_Perks();

View file

@ -1142,6 +1142,7 @@ void CL_ParseLimbUpdate (void)
CL_ParseServerMessage
=====================
*/
extern double bettyprompt_time;
void CL_ParseServerMessage (void)
{
int cmd;
@ -1232,6 +1233,10 @@ void CL_ParseServerMessage (void)
crosshair_pulse_grenade = true;
break;
case svc_bettyprompt:
bettyprompt_time = sv.time + 4;
break;
case svc_stufftext:
Cbuf_AddText (MSG_ReadString ());
break;

View file

@ -3255,6 +3255,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
@ -3606,7 +3631,8 @@ ebfs_builtin_t pr_ebfs_builtins[] =
{ 500, "songegg", PF_SongEgg },
{ 501, "nzp_maxammo", PF_MaxAmmo },
{ 502, "grenade_pulse", PF_GrenadePulse },
{ 503, "nzp_maxai", PF_MaxZombies }
{ 503, "nzp_maxai", PF_MaxZombies },
{ 504, "nzp_bettyprompt", PF_BettyPrompt }
// 2001-11-15 DarkPlaces general builtin functions by Lord Havoc end

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

View file

@ -353,6 +353,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

@ -30,6 +30,8 @@ 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();
char *GetUseButtonL();
void SCR_BeginLoadingPlaque (void);
void SCR_EndLoadingPlaque (void);