//Some helpful macros for doing funky HUD stuff.
#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
#define _RGB( v, r, g, b ) { v[0]=r;v[1]=g;v[2]=b; }
#define _RGBA( v, r, g, b, a ) { v[0]=r; v[1]=g; v[2]=b; v[3]=a; }
#define RED 0
#define GREEN 1
#define BLUE 2
#define ALPHA 3
#define CLAMP_CHAN( vec, chan, min, max ) if ( vec[chan] < min ) vec[chan] = min;\
if ( vec[chan] > max ) vec[chan] = max;
#define DRAW_MASK(x) {CG_DrawPic( 0.0f, 0.0f, 640.0f, 480.0f, x );}
if ( cg.snap->ps.stats[STAT_HEALTH] < (cg.snap->ps.stats[STAT_CLASS_MAXHEALTH] * 0.75f) && !cg.intermissionStarted )
{//We have < 75% health
static vec4_t color = { 1.0, 0.0f, 0.0f, 1.0f };
//Now, some funky math to pulse it
color[3] = ( (cg.snap->ps.stats[STAT_CLASS_MAXHEALTH]*0.75f) - (cg.snap->ps.stats[STAT_HEALTH]-(cg.snap->ps.stats[STAT_HEALTH]*.75f)) ) * 0.015f;
color[3] *= Q_fabs( sinf(cg.time/350.0f) * .75f );
// color[3] *= cg.am_HUDOpacity * .75;
if (color[ALPHA] >= 0.5f) color[ALPHA] = 0.5f;
trap_R_SetColor( color );
DRAW_MASK( cgs.media.am_lowHealth );
trap_R_SetColor( NULL );
}
I've got a few fancy macros and variables etc, but that should help you a bit.
self->client->ps.clientNum should suffice for their client num..and ent-g_entities
Like so: trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", G_GetStringEdString("MP_SVGAME", "NOCHEATS")));
Now, using 'cp' aka centerprint, you can only show one at a time..so you might want to rig up a custom system to display text in a notification (The latest source of OJP/JKE has a thing called AddText which is a fine example of it)
I also planned on implementing different crosshairs for different weapons ...It seems we're doing much of the same stuff. =]
Last edited by Raz0r; December 5th, 2009 at 07:40 AM.
Now if only my shaders weren't screwed up...
Here's a little something-something for Authuran...
Spoiler:
This is what is bothering me:
Spoiler:
Code:
DRAW_MASK( cgs.media.am_lowHealth );
Any new shader I make, or even if I use a new shader, will be messed up (either it won't show or it won't allow for transparency, even if I DIRECTLY COPY an old shader and give it a new name)
Also, could it be possible to maybe rig up a graphic that shows up instead of the CP text? It's worth a shot.
Gunslinger's Academy: "basicly like killin jedis n stuff with big guns" Add me to PSN: j3LL1b33n
Last edited by eezstreet; December 5th, 2009 at 08:36 AM.
Which Final Fantasy Character Are You?
Pwned! as in thats what you just were.
Everyone is entitled to their own opinion. It's just that yours is stupid.
I am a special person .
I'll get around to this next week (Going on holiday in a few hours)
Maybe I could set up an SVN repository and continue development?
I'd like to restructure some of the code to make it easier to use.
This site is part of the Defy Media Gaming network
The best serving of video game culture, since 2001. Whether you're looking for news, reviews, walkthroughs, or the biggest collection of PC gaming files on the planet, Game Front has you covered. We also make no illusions about gaming: it's supposed to be fun. Browse gaming galleries, humor lists, and honest, short-form reporting. Game on!