NX/VITA: Draw on-screen Bouncing Betty prompt

This commit is contained in:
cypress 2023-10-28 12:09:37 -04:00
parent 5ededc76b4
commit 1cbf48f0b1
6 changed files with 135 additions and 14 deletions

View file

@ -1222,6 +1222,7 @@ void CL_ParseLimbUpdate (void)
CL_ParseServerMessage CL_ParseServerMessage
===================== =====================
*/ */
extern double bettyprompt_time;
void CL_ParseServerMessage (void) void CL_ParseServerMessage (void)
{ {
int cmd; int cmd;
@ -1549,6 +1550,9 @@ void CL_ParseServerMessage (void)
case svc_pulse: case svc_pulse:
crosshair_pulse_grenade = true; crosshair_pulse_grenade = true;
break; break;
case svc_bettyprompt:
bettyprompt_time = sv.time + 4;
break;
//case svc_bspdecal: //case svc_bspdecal:
// CL_ParseBSPDecal (); // CL_ParseBSPDecal ();

View file

@ -37,6 +37,7 @@ qpic_t *b_ybutton;
qpic_t *b_xbutton; qpic_t *b_xbutton;
qpic_t *b_lt; qpic_t *b_lt;
qpic_t *b_rt; qpic_t *b_rt;
qpic_t *b_touch;
qpic_t *sb_round[5]; qpic_t *sb_round[5];
qpic_t *sb_round_num[10]; qpic_t *sb_round_num[10];
@ -69,6 +70,7 @@ qboolean domaxammo;
qboolean has_chaptertitle; qboolean has_chaptertitle;
double HUD_Change_time;//hide hud when not chagned double HUD_Change_time;//hide hud when not chagned
double bettyprompt_time;
typedef struct typedef struct
{ {
@ -119,6 +121,7 @@ void HUD_Init (void) {
if (sceKernelGetModel() == 0x20000) { // PSTV if (sceKernelGetModel() == 0x20000) { // PSTV
b_lt = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); b_lt = Draw_CachePic ("gfx/butticons/backl1_pstv.tga");
b_rt = Draw_CachePic ("gfx/butticons/backr1_pstv.tga"); b_rt = Draw_CachePic ("gfx/butticons/backr1_pstv.tga");
b_touch = Draw_CachePic ("gfx/butticons/functouch_pstv.tga");
b_lthumb = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); // Not existent b_lthumb = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); // Not existent
b_rthumb = Draw_CachePic ("gfx/butticons/backr1_pstv.tga"); // Not existent b_rthumb = Draw_CachePic ("gfx/butticons/backr1_pstv.tga"); // Not existent
b_lshoulder = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); // Not existent b_lshoulder = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); // Not existent
@ -126,6 +129,7 @@ void HUD_Init (void) {
} else { } else {
b_lt = Draw_CachePic ("gfx/butticons/backl1.tga"); b_lt = Draw_CachePic ("gfx/butticons/backl1.tga");
b_rt = Draw_CachePic ("gfx/butticons/backr1.tga"); b_rt = Draw_CachePic ("gfx/butticons/backr1.tga");
b_touch = Draw_CachePic ("gfx/butticons/functouch.tga");
b_lthumb = Draw_CachePic ("gfx/butticons/backl1.tga"); // Not existent b_lthumb = Draw_CachePic ("gfx/butticons/backl1.tga"); // Not existent
b_rthumb = Draw_CachePic ("gfx/butticons/backr1.tga"); // Not existent b_rthumb = Draw_CachePic ("gfx/butticons/backr1.tga"); // Not existent
b_lshoulder = Draw_CachePic ("gfx/butticons/backl1.tga"); // Not existent b_lshoulder = Draw_CachePic ("gfx/butticons/backl1.tga"); // Not existent
@ -598,18 +602,6 @@ void HUD_MaxAmmo(void)
maxammoy -= cl.time * 0.003; maxammoy -= cl.time * 0.003;
maxammoopac -= cl.time * 0.05; maxammoopac -= cl.time * 0.05;
/*
#ifdef VITA
Draw_ColoredStringScale(vid.width/2 - strlen("Round")*16, 160, "Round", 1, value/255, value/255, 1, 4.0f);
#else
Draw_ColoredStringScale(vid.width/4 - strlen("Round")*8, vid.height*3/4 - sb_round[0]->height - 10, "Round", 1, value/255, value/255, 1, 2.0f);
#endif // VITA
*/
#ifdef VITA #ifdef VITA
Draw_ColoredStringScale(vid.width/2 - strlen("MAX AMMO!")*8, maxammoy, "MAX AMMO!", 255, 255, 255, maxammoopac/255, 2.0f); Draw_ColoredStringScale(vid.width/2 - strlen("MAX AMMO!")*8, maxammoy, "MAX AMMO!", 255, 255, 255, maxammoopac/255, 2.0f);
@ -1941,6 +1933,51 @@ void HUD_Weapon (void)
#endif #endif
} }
/*
===============
HUD_BettyPrompt
===============
*/
void HUD_BettyPrompt (void)
{
char str[64];
char str2[32];
#ifdef VITA
strcpy(str, va("Tap then press %s to\n", GetGrenadeButtonL()));
strcpy(str2, "place a Bouncing Betty\n");
#else
strcpy(str, va("Press %s to place a\n", GetBettyButtonL()));
strcpy(str2, "Bouncing Betty\n");
#endif // VITA
int x, x2, y;
#ifdef VITA
x = (vid.width - strlen(str)*16)/2;
x2 = (vid.width - strlen(str2)*16)/2;
y = 165;
#else
x = (vid.width - strlen(str)*10)/2;
x2 = (vid.width - strlen(str2)*10)/2;
y = vid.height*3/4 - sb_round[0]->height - 15;
#endif // VITA
#ifdef VITA
Draw_ColoredStringScale(x, y, str, 255, 255, 255, 255, 2.0f);
Draw_ColoredStringScale(x, y + 24, str2, 255, 255, 255, 255, 2.0f);
Draw_Pic (x + 4*16 - 6, y - 5, b_touch);
Draw_Pic (x + 18*16, y - 5, GetButtonIcon("+grenade"));
#else
Draw_ColoredStringScale(x, y, str, 255, 255, 255, 255, 1.25f);
Draw_ColoredStringScale(x, y + 12, str2, 255, 255, 255, 255, 1.25f);
Draw_Pic (x + 6*10, y, GetButtonIcon("impulse 33"));
#endif // VITA
}
//============================================================================= //=============================================================================
@ -1977,6 +2014,9 @@ void HUD_Draw (void) {
return; return;
} }
if (bettyprompt_time > sv.time)
HUD_BettyPrompt();
HUD_Blood(); HUD_Blood();
HUD_Rounds(); HUD_Rounds();
HUD_Perks(); HUD_Perks();

View file

@ -243,6 +243,54 @@ char *GetUseButtonL ()
return " "; 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), "LSHOULDER") ||
!strcmp(Key_KeynumToString(j), "RSHOULDER"))
return " ";
else
return " ";
}
}
return " ";
}
char *GetBettyButtonL ()
{
int j;
int l;
char *b;
l = strlen("impulse 33");
for (j=0 ; j<256 ; j++)
{
b = keybindings[j];
if (!b)
continue;
if (!strncmp (b, "impulse 33", l) )
{
if (!strcmp(Key_KeynumToString(j), "LSHOULDER") ||
!strcmp(Key_KeynumToString(j), "RSHOULDER"))
return " ";
else
return " ";
}
}
return " ";
}
char *GetPerkName (int perk) char *GetPerkName (int perk)
{ {
switch (perk) switch (perk)

View file

@ -1299,6 +1299,31 @@ void PF_GrenadePulse(void)
MSG_WriteByte (&client->message,svc_pulse); 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 PF_MaxZombies
@ -3803,8 +3828,9 @@ static builtin_t pr_builtin[] =
NULL, // #499 NULL, // #499
PF_SongEgg, // #500 PF_SongEgg, // #500
PF_MaxAmmo, // #501 PF_MaxAmmo, // #501
PF_GrenadePulse, // #502 PF_GrenadePulse, // #502
PF_MaxZombies, // #503 PF_MaxZombies, // #503
PF_BettyPrompt, // #504
}; };
builtin_t *pr_builtins = pr_builtin; builtin_t *pr_builtins = pr_builtin;

View file

@ -214,6 +214,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_songegg 45 // 45 #define svc_songegg 45 // 45
#define svc_maxammo 46 // 46 #define svc_maxammo 46 // 46
#define svc_pulse 47 // 47 #define svc_pulse 47 // 47
#define svc_bettyprompt 48 // 48
#define svc_limbupdate 51 #define svc_limbupdate 51
#define svc_achievement 52 // [string] name [byte] decal_size [coords] pos #define svc_achievement 52 // [string] name [byte] decal_size [coords] pos

View file

@ -42,6 +42,8 @@ void SCR_EndLoadingPlaque (void);
int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout
qpic_t *GetButtonIcon (char *buttonname); qpic_t *GetButtonIcon (char *buttonname);
char *GetGrenadeButtonL();
char *GetBettyButtonL();
extern float scr_con_current; extern float scr_con_current;
extern float scr_conlines; // lines of console to display extern float scr_conlines; // lines of console to display