From 67c8b23b93c166f1ac4e60d34e368e37ee18226a Mon Sep 17 00:00:00 2001 From: hlstriker Date: Mon, 4 Nov 2013 03:18:30 +0000 Subject: [PATCH] Added wrapper functions for HUD messages. --- mp/src/game/server/ff/ff_sv_util.cpp | 61 ++++++++++++++++++++++++++++ mp/src/game/server/ff/ff_sv_util.h | 18 ++++++++ mp/src/game/server/server_ff.vpc | 3 ++ 3 files changed, 82 insertions(+) create mode 100644 mp/src/game/server/ff/ff_sv_util.cpp create mode 100644 mp/src/game/server/ff/ff_sv_util.h diff --git a/mp/src/game/server/ff/ff_sv_util.cpp b/mp/src/game/server/ff/ff_sv_util.cpp new file mode 100644 index 00000000..225bf4ad --- /dev/null +++ b/mp/src/game/server/ff/ff_sv_util.cpp @@ -0,0 +1,61 @@ +#include "cbase.h" +#include "util.h" +#include "ff_sv_util.h" + +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 *pszFormat, ...) +{ + char szMessage[512]; + va_list argptr; + va_start(argptr, pszFormat); + Q_vsnprintf(szMessage, sizeof(szMessage), pszFormat, argptr); + va_end(argptr); + + hudtextparms_s params; + params.x = x; + params.y = y; + params.effect = effect; + params.r1 = color1.r; + params.g1 = color1.g; + params.b1 = color1.b; + params.a1 = color1.a; + params.r2 = color2.r; + params.g2 = color2.g; + params.b2 = color2.b; + params.a2 = color2.a; + params.fadeinTime = fadeInTime; + params.fadeoutTime = fadeOutTime; + params.holdTime = holdTime; + params.fxTime = fxTime; + params.channel = channel; + + UTIL_HudMessageAll(params, szMessage); +} + +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 *pszFormat, ...) +{ + char szMessage[512]; + va_list argptr; + va_start(argptr, pszFormat); + Q_vsnprintf(szMessage, sizeof(szMessage), pszFormat, argptr); + va_end(argptr); + + hudtextparms_s params; + params.x = x; + params.y = y; + params.effect = effect; + params.r1 = color1.r; + params.g1 = color1.g; + params.b1 = color1.b; + params.a1 = color1.a; + params.r2 = color2.r; + params.g2 = color2.g; + params.b2 = color2.b; + params.a2 = color2.a; + params.fadeinTime = fadeInTime; + params.fadeoutTime = fadeOutTime; + params.holdTime = holdTime; + params.fxTime = fxTime; + params.channel = channel; + + UTIL_HudMessage(pToPlayer, params, szMessage); +} \ No newline at end of file diff --git a/mp/src/game/server/ff/ff_sv_util.h b/mp/src/game/server/ff/ff_sv_util.h new file mode 100644 index 00000000..2ae6e154 --- /dev/null +++ b/mp/src/game/server/ff/ff_sv_util.h @@ -0,0 +1,18 @@ +#pragma once + +#ifndef FF_SV_UTIL_H +#define FF_SV_UTIL_H + +// HUD Messages +typedef enum +{ + HUD_EFFECT_FADE_IN_OUT = 0, + HUD_EFFECT_FLICKER, + HUD_EFFECT_WRITE_OUT +} HUD_MSG_EFFECT; + +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 *pszFormat, ... ); +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 *pszFormat, ... ); + + +#endif //FF_SV_UTIL_H diff --git a/mp/src/game/server/server_ff.vpc b/mp/src/game/server/server_ff.vpc index 0509e888..d6e95944 100644 --- a/mp/src/game/server/server_ff.vpc +++ b/mp/src/game/server/server_ff.vpc @@ -40,6 +40,9 @@ $Project "Server (FF)" $File "ff\ff_sv_player.cpp" $File "ff\ff_sv_player.h" } + + $File "ff\ff_sv_util.cpp" + $File "ff\ff_sv_util.h" }