From 1cbf48f0b12ed45e3726b2214cc65761ae807cfb Mon Sep 17 00:00:00 2001 From: cypress Date: Sat, 28 Oct 2023 12:09:37 -0400 Subject: [PATCH] NX/VITA: Draw on-screen Bouncing Betty prompt --- source/cl_parse.c | 4 +++ source/gl_hud.c | 64 +++++++++++++++++++++++++++++++++++++--------- source/gl_screen.c | 48 ++++++++++++++++++++++++++++++++++ source/pr_cmds.c | 30 ++++++++++++++++++++-- source/protocol.h | 1 + source/screen.h | 2 ++ 6 files changed, 135 insertions(+), 14 deletions(-) diff --git a/source/cl_parse.c b/source/cl_parse.c index 68f4f5c..565a47b 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -1222,6 +1222,7 @@ void CL_ParseLimbUpdate (void) CL_ParseServerMessage ===================== */ +extern double bettyprompt_time; void CL_ParseServerMessage (void) { int cmd; @@ -1549,6 +1550,9 @@ void CL_ParseServerMessage (void) case svc_pulse: crosshair_pulse_grenade = true; break; + case svc_bettyprompt: + bettyprompt_time = sv.time + 4; + break; //case svc_bspdecal: // CL_ParseBSPDecal (); diff --git a/source/gl_hud.c b/source/gl_hud.c index 5e12a9b..6b024b2 100644 --- a/source/gl_hud.c +++ b/source/gl_hud.c @@ -37,6 +37,7 @@ qpic_t *b_ybutton; qpic_t *b_xbutton; qpic_t *b_lt; qpic_t *b_rt; +qpic_t *b_touch; qpic_t *sb_round[5]; qpic_t *sb_round_num[10]; @@ -69,6 +70,7 @@ qboolean domaxammo; qboolean has_chaptertitle; double HUD_Change_time;//hide hud when not chagned +double bettyprompt_time; typedef struct { @@ -119,6 +121,7 @@ void HUD_Init (void) { if (sceKernelGetModel() == 0x20000) { // PSTV b_lt = Draw_CachePic ("gfx/butticons/backl1_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_rthumb = Draw_CachePic ("gfx/butticons/backr1_pstv.tga"); // Not existent b_lshoulder = Draw_CachePic ("gfx/butticons/backl1_pstv.tga"); // Not existent @@ -126,6 +129,7 @@ void HUD_Init (void) { } else { b_lt = Draw_CachePic ("gfx/butticons/backl1.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_rthumb = Draw_CachePic ("gfx/butticons/backr1.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; 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 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 } +/* +=============== +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; } + if (bettyprompt_time > sv.time) + HUD_BettyPrompt(); + HUD_Blood(); HUD_Rounds(); HUD_Perks(); diff --git a/source/gl_screen.c b/source/gl_screen.c index 702406a..2e8bd63 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -243,6 +243,54 @@ 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), "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) { switch (perk) diff --git a/source/pr_cmds.c b/source/pr_cmds.c index e4ac6cd..75be6d3 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -1299,6 +1299,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 @@ -3803,8 +3828,9 @@ static builtin_t pr_builtin[] = NULL, // #499 PF_SongEgg, // #500 PF_MaxAmmo, // #501 - PF_GrenadePulse, // #502 - PF_MaxZombies, // #503 + PF_GrenadePulse, // #502 + PF_MaxZombies, // #503 + PF_BettyPrompt, // #504 }; builtin_t *pr_builtins = pr_builtin; diff --git a/source/protocol.h b/source/protocol.h index c090e8a..aac18be 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -214,6 +214,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define svc_songegg 45 // 45 #define svc_maxammo 46 // 46 #define svc_pulse 47 // 47 +#define svc_bettyprompt 48 // 48 #define svc_limbupdate 51 #define svc_achievement 52 // [string] name [byte] decal_size [coords] pos diff --git a/source/screen.h b/source/screen.h index 2ec2ec3..0876cb6 100644 --- a/source/screen.h +++ b/source/screen.h @@ -42,6 +42,8 @@ void SCR_EndLoadingPlaque (void); int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout qpic_t *GetButtonIcon (char *buttonname); +char *GetGrenadeButtonL(); +char *GetBettyButtonL(); extern float scr_con_current; extern float scr_conlines; // lines of console to display