NX/VITA: Draw character name on match start

This commit is contained in:
cypress 2023-11-21 22:35:01 -05:00
parent 46e1838d96
commit b1ebe2859f
5 changed files with 70 additions and 0 deletions

View file

@ -1594,6 +1594,10 @@ void CL_ParseServerMessage (void)
case svc_bettyprompt:
bettyprompt_time = sv.time + 4;
break;
case svc_playername:
nameprint_time = sv.time + 11;
strcpy(player_name, MSG_ReadString());
break;
//case svc_bspdecal:
// CL_ParseBSPDecal ();

View file

@ -71,6 +71,9 @@ qboolean has_chaptertitle;
double HUD_Change_time;//hide hud when not chagned
double bettyprompt_time;
double nameprint_time;
char player_name[16];
typedef struct
{
@ -2008,6 +2011,33 @@ void HUD_BettyPrompt (void)
#endif // VITA
}
/*
===============
HUD_PlayerName
===============
*/
void HUD_PlayerName (void)
{
float alpha = 1.0;
int x, y;
float scale;
#ifdef VITA
scale = 2.0f;
x = 147;
y = 413;
#else
scale = 1.25f;
x = 100;
y = 633;
#endif
if (nameprint_time - sv.time < 1)
alpha = (nameprint_time - sv.time);
Draw_ColoredStringScale(x, y, player_name, 255, 255, 255, alpha, scale);
}
//=============================================================================
@ -2047,6 +2077,9 @@ void HUD_Draw (void) {
if (bettyprompt_time > sv.time)
HUD_BettyPrompt();
if (nameprint_time > sv.time)
HUD_PlayerName();
HUD_Blood();
HUD_Rounds();
HUD_Perks();

View file

@ -41,5 +41,7 @@ typedef struct achievement_list_s
void Achievement_Init (void);
extern achievement_list_t achievement_list[MAX_ACHIEVEMENTS];
extern qpic_t *achievement_locked;
extern char player_name[16];
extern double nameprint_time;
void HUD_Parse_Achievement (int ach);

View file

@ -1325,6 +1325,35 @@ void PF_BettyPrompt(void)
MSG_WriteByte (&client->message, svc_bettyprompt);
}
/*
=================
PF_SetPlayerName
sends the name string to
the client, avoids making
a protocol extension and
spamming strings.
nzp_setplayername()
=================
*/
void PF_SetPlayerName(void)
{
client_t *client;
int entnum;
char* s;
entnum = G_EDICTNUM(OFS_PARM0);
s = G_STRING(OFS_PARM1);
if (entnum < 1 || entnum > svs.maxclients)
return;
client = &svs.clients[entnum-1];
MSG_WriteByte (&client->message, svc_playername);
MSG_WriteString (&client->message, s);
}
/*
=================
PF_MaxZombies
@ -3847,6 +3876,7 @@ static builtin_t pr_builtin[] =
PF_GrenadePulse, // #502
PF_MaxZombies, // #503
PF_BettyPrompt, // #504
PF_SetPlayerName, // #505
};
builtin_t *pr_builtins = pr_builtin;

View file

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