In our mod we draw several things over a players head depending on if
they're a teammate, disguised, calling for a medic or engy, etc...

In your client side player class DrawModel function (ours is in
c_ff_player.cpp -> C_FFPlayer::DrawModel) we have something like:

// No point putting these on self even in 3rd person mode
if( IsLocalPlayer() && !ShouldDraw() )
        return;

C_FFPlayer *pPlayer = GetLocalFFPlayer();

if( pPlayer->IsObserver() || !pPlayer->IsAlive() )
        return;

float flOffset = 0.0f;

[<removed>... Some condition code for this drawing ...</removed>]

IMaterial *pMaterial = materials->FindMaterial(
"sprites/ff_sprite_teammate", TEXTURE_GROUP_CLIENT_EFFECTS );
if( pMaterial )
{
        materials->Bind( pMaterial );

        // These items get team colored...
        Color clr = Color( 255, 255, 255, 255 );

        [<removed>... Code to determine actual color to use, fallbacks to
white if no color chosen ...</removed>]

        color32 c = { clr.r(), clr.g(), clr.b(), 255 };
        DrawSprite( Vector( GetAbsOrigin().x, GetAbsOrigin().y,
EyePosition().z + 16.0f ), 15.0f, 15.0f, c );

        // Increment offset for next image to 'stack' on top of this one if
its deemed there's another one to draw
        flOffset += 16.0f;
}

[<removed>... Some more icon drawing ...</removed>]

Then at the beginning of that file (or somewhere in a file included from
that file) you need to do something like:

CLIENTEFFECT_REGISTER_BEGIN( PrecacheTeamMate )
CLIENTEFFECT_MATERIAL( "sprites/ff_sprite_teammate" )
CLIENTEFFECT_REGISTER_END()

Then of course you have to create the texture sprites/ff_sprite_teammate
correctly with whatever flags - one of our art guys made it so I'm no help
w/ the texture creation.


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to