@@ -200,9 +200,7 @@ static void ClientPrint(const int playerIndex, const char* msg)
200200 if (engineServer->GetPlayerInfo (i, &playerInfo))
201201 {
202202 if (CBasePlayer* pPlayer = UTIL_PlayerByIndex (i))
203- {
204- UTIL_ClientPrint (pPlayer, HUD_PRINTTALK , msg);
205- }
203+ UTIL_ClientPrint (pPlayer, HUD_PRINTCENTER , msg);
206204 }
207205 }
208206 return ;
@@ -215,42 +213,50 @@ static void ClientPrint(const int playerIndex, const char* msg)
215213 return ;
216214 }
217215
218- UTIL_ClientPrint (pPlayer, HUD_PRINTTALK , msg);
216+ UTIL_ClientPrint (pPlayer, HUD_PRINTCENTER , msg);
219217}
220218
221- // ---------------------------------------------------------------------------------
222- // Purpose: Print a message to the screen based on what the game_text entity does.
223- // See the Valve Developer Commentary page for the game_text entity to read
224- // what each field does. Specifying no playerIndex or 0 sends to all players.
225- // Supports printing localization strings but those that require formatting can't be formatted.
226- // Vectors are in place for sets of RGB values.
227- // Vector is used to consolidate x, y, and channel parameters together.
228- // Vector is used to consolidate fadeinTime, fadeoutTime, and holdTime.
229- // ---------------------------------------------------------------------------------
219+ /* *
220+ * @brief Print a message to the screen based on what the game_text entity does. See the Valve Developer Commentary page for the game_text entity to read
221+ * what each field does and what values to input. Specifying no playerIndex or 0 sends to all players.
222+ * Supports printing localization strings but those that require formatting can't be formatted.
223+ * Vectors are used to consolidate some parameters so function isn't monstrously big.
224+ * @param playerIndex Player index to display message to, or 0 to send to all players
225+ * @param msg Message that should be displayed.
226+ * @param posChannel Location on screen and channel to display message to.
227+ * @param effect Effect text should use when displaying.
228+ * @param fxTime How long the effect should last.
229+ * @param RGB1 Color of text.
230+ * @param alpha1 Alpha of text.
231+ * @param RGB2 Transition color of text.
232+ * @param alpha2 Transition color of text.
233+ * @param showTimes Fade in, fade out, and hold time of text.
234+ */
230235static void HudPrint
231236 (
232- const int playerIndex, const char * msg,
233- Vector posChannel, const int effect, const float fxTime,
234- Vector RGB1 , const int alpha1, Vector RGB2 , const int alpha2,
235- Vector showTimes
237+ const int playerIndex, const char * msg,
238+ const Vector& posChannel, const int effect, const float fxTime,
239+ const Vector& RGB1 , const int alpha1, const Vector& RGB2 , const int alpha2,
240+ const Vector& showTimes
236241 )
237242{
238- if (!msg) return ;
243+ if (!msg)
244+ return ;
239245
240246 HudMessageParams hudTextParams;
241247 hudTextParams.x = posChannel.x ;
242248 hudTextParams.y = posChannel.y ;
243- hudTextParams.channel = posChannel.z ;
249+ hudTextParams.channel = static_cast < int >( posChannel.z ) ;
244250 hudTextParams.effect = effect;
245251 hudTextParams.fxTime = fxTime;
246- hudTextParams.r1 = RGB1 .x ;
247- hudTextParams.g1 = RGB1 .y ;
248- hudTextParams.b1 = RGB1 .z ;
249- hudTextParams.a1 = alpha1;
250- hudTextParams.r2 = RGB2 .x ;
251- hudTextParams.g2 = RGB2 .y ;
252- hudTextParams.b2 = RGB2 .z ;
253- hudTextParams.a2 = alpha2;
252+ hudTextParams.r1 = static_cast <byte>( RGB1 .x ) ;
253+ hudTextParams.g1 = static_cast <byte>( RGB1 .y ) ;
254+ hudTextParams.b1 = static_cast <byte>( RGB1 .z ) ;
255+ hudTextParams.a1 = static_cast <byte>( alpha1) ;
256+ hudTextParams.r2 = static_cast <byte>( RGB2 .x ) ;
257+ hudTextParams.g2 = static_cast <byte>( RGB2 .y ) ;
258+ hudTextParams.b2 = static_cast <byte>( RGB2 .z ) ;
259+ hudTextParams.a2 = static_cast <byte>( alpha2) ;
254260 hudTextParams.fadeinTime = showTimes.x ;
255261 hudTextParams.fadeoutTime = showTimes.y ;
256262 hudTextParams.holdTime = showTimes.z ;
@@ -271,18 +277,25 @@ static void HudPrint
271277 UTIL_HudMessage (pPlayer, hudTextParams, msg);
272278}
273279
274- // ---------------------------------------------------------------------------------
275- // Purpose: Self-explanatory.
276- // ---------------------------------------------------------------------------------
280+ /* *
281+ * @brief Returns the current max players in the server.
282+ * @return Max players in server.
283+ */
277284static int GetMaxPlayers ()
278285{
279286 return MAX_PLAYERS ;
280287}
281288
282- // ---------------------------------------------------------------------------------
283- // Purpose: Enable or disable displaying the score board for a player.
284- // ---------------------------------------------------------------------------------
285- static void ShowScoreboard (const int playerIndex, const bool bEnable)
289+ /* *
290+ * @brief Enable or disable displaying the score board for a player.
291+ * @param playerIndex Index of player to enable/disable the scoreboard of.
292+ * @param enable Whather the scoreboard should be enabled for this player.
293+ */
294+ static void ShowScoreboard (const int playerIndex, const bool enable)
295+ {
296+ CBasePlayer__ShowViewPortPanel (playerIndex, " scores" , enable);
297+ }
298+
286299{
287300 CBasePlayer__ShowViewPortPanel (playerIndex, " scores" , bEnable);
288301}
@@ -326,16 +339,14 @@ void RegisterFuncsAndRun()
326339 );
327340 ScriptRegisterFunction (g_pScriptVM, HudPrint, " Print a message to the screen based on what the game_text entity does."
328341 " See the Valve Developer Commentary page for the game_text entity to read"
329- " what each field does. Specifying no playerIndex or 0 sends to all players."
342+ " what each field does and what values to input . Specifying no playerIndex or 0 sends to all players."
330343 " Supports printing localization strings but those that require formatting can't be formatted."
331- " Vectors are in place for sets of RGB values."
332- " Vector is used to consolidate x, y, and channel parameters together."
333- " Vector is used to consolidate fadeinTime, fadeoutTime, and holdTime."
344+ " Vectors are used to consolidate some parameters so function isn't monstrously big."
334345 );
335346 ScriptRegisterFunction (g_pScriptVM, GetMaxPlayers, " Self-explanatory." );
336347 ScriptRegisterFunction (g_pScriptVM, ShowScoreboard, " Enable or disable displaying the score board for players." );
337348 ScriptRegisterFunction (g_pScriptVM, RemovePlayerUI, " Display UI for either banning or kicking so host can ban or kick a player." );
338349
339- // Load up the main P2:MM VScript and set
350+ // Load up the main P2:MM VScript.
340351 g_pScriptVM->Run (" IncludeScript(\" multiplayermod/p2mm\" );" );
341352}
0 commit comments