I saw an interesting feature in the Etsquad mod, it displays an indicator above friendly covert-op’s heads. I would like to display such indicator too in my mod, but I can’t figure out how to do it. Can someone help me?
Thanks in advance.
Indicators above head?
If I change cg_players.c then I have to include cgame.mp.i386.so (/.dll), right? Is there a way to do it in the g_*.c code?
There would be absolutely no point to call that in g_* code - stuff like getting input, rendering gfx or sfx makes only sense on the client.
//Find in cg_players.c: static void CG_PlayerSprites( centity_t *cent ) {
//Place correctly
if ( cent->currentState.powerups & (1<<PW_OPS_DISGUISED)
&& cg.snap->ps.persistant[PERS_TEAM] == team ) {
CG_PlayerFloatSprite( cent, cgs.media.spawnCovertSprite, 56 );
return;
}
//Find in cg_main.c: cgs.media.objectiveShader = trap_R_RegisterShader( "sprites/objective" );
//Add
cgs.media.spawnCovertSprite = trap_R_RegisterShader( "sprites/covert_hd" );
//Find in cg_local.h: qhandle_t objectiveShader;
//Add
qhandle_t spawnCovertSprite;

Yes, I know that the drawing is done client side, but I was wondering if its possible for the server to tell the client to draw icons above players heads.
h0nd, thanks for the help. I guess I’ll have to do it in cg_*.c then.
There’s no need to create a new sprite, you can simply use the noshoot sprite (like I did in baconET).
True, but still, I find it a little easier with a new “I’m a Covert Ops” sprite, as I like to call it, hehe
I took buddy.tga and put a C in it 
I got it working, only have one small problem.
All items like dynamite, anti-tank guns etc. are gone in my command map.
If i press the - and + sometimes they are back again, but i need to do it on the start of every mission.
Did i do something wrong?
Could someone help me out…
I can’t seem to get the proper sprite to load above someone’s head. No matter what sprite I use all I get is a black box with orange outlines. I decided to screw my code and try the recommended code above to see what I was doing wrong, however, I still hot the black box. Any help?
you’re referencing a shader # that isn’t loaded yet. the black box with orange outline is the ‘null shader’
Alright i got the shader working. Using friendShader. Now problem is you can see the little red no sign through walls and everywhere. So my question is: is this because of the shader or do I need to somehow check if the player is visible?
Hmm? Yet medic shaders etc are not seen through walls. Do they have a function already done for them? And is there any examples I could get ahold of to see exactly what needs to be done. I’m not real familair with the engine.
//Find in cg_players.c: static void CG_PlayerSprites( centity_t *cent ) {
//Place correctly
if ( cent->currentState.powerups & (1<<PW_OPS_DISGUISED)
&& cg.snap->ps.persistant[PERS_TEAM] == team ) {
CG_PlayerFloatSprite( cent, cgs.media.spawnCovertSprite, 56 );
return;
}
how must i change the code, to draw an indicator over every head of my teammates??
ind in cg_players.c: static void CG_PlayerSprites( centity_t *cent ) {
//Place correctly
if (cg.snap->ps.persistant[PERS_TEAM] == team ) {
CG_PlayerFloatSprite( cent, cgs.media.friend, 56 );
return;
}
I think you must do this , you also need define cgs.media.friend
I also added a covert ops sign to the scoreboard, in order to let your team know who
is in disguise.
You can do it like this:
In cg_scoreboard.c
Under:
if ( ci->team != TEAM_SPECTATOR ) {
if ( ci->powerups & ( (1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) ) ) {
CG_DrawPic( tempx-4, y, 16, 16, cgs.media.objectiveShader );
offset += 8;
tempx += 12;
maxchars -= 2;
}
Add:
if( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && ci->powerups & ( 1<<PW_OPS_DISGUISED) ) {
CG_DrawPic( tempx-4, y, 16, 16, cgs.media.friendShader );
offset += 8;
tempx += 12;
maxchars -= 2;
}