BMAP* skin;
var UV[3], pixel, AlphaValue;
...
you=NULL;
dist = c_move(me, reldist, NULL, IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES);
if(you!=NULL)
{ //hit some entity
c_trace(me.x, you.x, IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES);
vec_for_uv (UV, you, hitvertex); //get UV co-ordinate of hit vertex
skin = bmap_for_entity (you, you.frame); //get skin at you's current frame
format = bmap_lock(skin,0); //open BMAP for reading and get its format
pixel = pixel_for_bmap(skin, UV[0], UV[1]); //get the pixel of the UV co-ordinate
bmap_unlock(skin); //close BMAP now its been read
pixel_to_vec(NULL, AlphaValue, format, pixel); //get pixels AlphaValue
//do something with AlphaValue. Like
switch(AlphaValue)
{
case 10:
HitArms(you);
break;
case 25:
HitLegs(you);
break;
case 50:
HitTorso(you);
break;
case 100:
HeadShot(you);
break;
default:
Clipped(you);
}
}
...