Added HUD message overload that accepts CRecipientFilter.

This commit is contained in:
hlstriker 2013-11-07 12:09:24 +00:00 committed by squeek
parent a629a38627
commit a9147a53bd
4 changed files with 25 additions and 6 deletions

View file

@ -31,6 +31,18 @@ void FF_UTIL_HudMessageFormat(CBasePlayer *pToPlayer, float x, float y, HUD_MSG_
} }
void FF_UTIL_HudMessage(CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage) void FF_UTIL_HudMessage(CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage)
{
CRecipientFilter filter;
if( pToPlayer )
filter.AddRecipient( pToPlayer );
else
filter.AddAllPlayers();
FF_UTIL_HudMessage(filter, x, y, effect, color1, color2, fadeInTime, fadeOutTime, holdTime, fxTime, channel, pszMessage);
}
void FF_UTIL_HudMessage(CRecipientFilter &filter, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage)
{ {
hudtextparms_s params; hudtextparms_s params;
params.x = x; params.x = x;
@ -50,5 +62,5 @@ void FF_UTIL_HudMessage(CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT
params.fxTime = fxTime; params.fxTime = fxTime;
params.channel = channel; params.channel = channel;
UTIL_HudMessage(pToPlayer, params, pszMessage); UTIL_HudMessage(filter, params, pszMessage);
} }

View file

@ -11,6 +11,7 @@ enum HUD_MSG_EFFECT
HUD_EFFECT_WRITE_OUT HUD_EFFECT_WRITE_OUT
}; };
void FF_UTIL_HudMessage( CRecipientFilter &filter, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage );
void FF_UTIL_HudMessage( CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage ); void FF_UTIL_HudMessage( CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage );
void FF_UTIL_HudMessageFormat( CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszFormat, ... ); void FF_UTIL_HudMessageFormat( CBasePlayer *pToPlayer, float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszFormat, ... );
void FF_UTIL_HudMessageAll( float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage ); void FF_UTIL_HudMessageAll( float x, float y, HUD_MSG_EFFECT effect, color32 color1, color32 color2, float fadeInTime, float fadeOutTime, float holdTime, float fxTime, int channel, const char *pszMessage );

View file

@ -1017,20 +1017,23 @@ void UTIL_ScreenFade( CBaseEntity *pEntity, const color32 &color, float fadeTime
UTIL_ScreenFadeWrite( fade, pEntity ); UTIL_ScreenFadeWrite( fade, pEntity );
} }
// FF --> hlstriker: Modified
void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage ) void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage )
{ {
CRecipientFilter filter; CRecipientFilter filter;
if( pToPlayer ) if( pToPlayer )
{
filter.AddRecipient( pToPlayer ); filter.AddRecipient( pToPlayer );
}
else else
{
filter.AddAllPlayers(); filter.AddAllPlayers();
}
UTIL_HudMessage( filter, textparms, pMessage );
}
// FF <--
// FF --> hlstriker: Added
void UTIL_HudMessage( CRecipientFilter &filter, const hudtextparms_t &textparms, const char *pMessage )
{
filter.MakeReliable(); filter.MakeReliable();
UserMessageBegin( filter, "HudMsg" ); UserMessageBegin( filter, "HudMsg" );
@ -1053,6 +1056,7 @@ void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, c
WRITE_STRING( pMessage ); WRITE_STRING( pMessage );
MessageEnd(); MessageEnd();
} }
// FF <--
void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage ) void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage )
{ {

View file

@ -181,6 +181,7 @@ inline bool FNullEnt(const edict_t* pent)
class CBaseEntity; class CBaseEntity;
class CBasePlayer; class CBasePlayer;
class CRecipientFilter; // FF --> hlstriker: Added for the filter version of UTIL_HudMessage.
extern CGlobalVars *gpGlobals; extern CGlobalVars *gpGlobals;
@ -470,6 +471,7 @@ void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName );
// prints as transparent 'title' to the HUD // prints as transparent 'title' to the HUD
void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage ); void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage );
void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage ); void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage );
void UTIL_HudMessage( CRecipientFilter &filter, const hudtextparms_t &textparms, const char *pMessage ); // FF --> hlstriker: Added
// brings up hud keyboard hints display // brings up hud keyboard hints display
void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage ); void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage );