diff --git a/source/cl_parse.c b/source/cl_parse.c index 6b3381d..331b7d3 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -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 (); diff --git a/source/gl_hud.c b/source/gl_hud.c index 2f5ec72..ae66c57 100644 --- a/source/gl_hud.c +++ b/source/gl_hud.c @@ -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(); diff --git a/source/gl_hud.h b/source/gl_hud.h index 65fbfc4..2d085cd 100644 --- a/source/gl_hud.h +++ b/source/gl_hud.h @@ -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); \ No newline at end of file diff --git a/source/menu.c b/source/menu.c index 458ad35..ddadbd6 100644 --- a/source/menu.c +++ b/source/menu.c @@ -583,7 +583,7 @@ int m_main_cursor; #ifdef VITA #define MAIN_ITEMS 5 #else -#define MAIN_ITEMS 4 +#define MAIN_ITEMS 3 #endif @@ -638,7 +638,7 @@ void M_Main_Draw (void) DRAW_BLANKOPTION("Achievements", true); DRAW_MENUOPTION(2, "Credits", m_main_cursor, true); - DRAW_MENUOPTION(3, "Exit", m_main_cursor, false); + //DRAW_MENUOPTION(3, "Exit", m_main_cursor, false); #endif // VITA @@ -655,7 +655,7 @@ void M_Main_Draw (void) #else case 2: DRAW_DESCRIPTION("View Credits for NZ:P."); break; - case 3: DRAW_DESCRIPTION("Return to Horizon."); break; + //case 3: DRAW_DESCRIPTION("Return to Horizon."); break; #endif // VITA @@ -746,11 +746,9 @@ void M_Main_Key (int key) break; #ifdef VITA case 4: - #else - case 3: - #endif M_Menu_Quit_f (); break; + #endif } } } diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 718f3af..24afe5b 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -1327,6 +1327,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 @@ -3891,6 +3920,7 @@ static builtin_t pr_builtin[] = PF_GrenadePulse, // #502 PF_MaxZombies, // #503 PF_BettyPrompt, // #504 + PF_SetPlayerName, // #505 }; builtin_t *pr_builtins = pr_builtin; diff --git a/source/protocol.h b/source/protocol.h index 9682089..f8fe235 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -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