I am trying to make 3 different types of armor: head, body and legs. I guess it's too much to write here what I had to change

Okay, next I've moved CheckArmor() from G_Damage to G_LocationDamage. It's called every time a client gets hit so it doesn't make a difference. I added "int dflags;" and set them to DAMAGE_HEAD when you get hit in the head, DAMAGE_BODY when get hit in the body and DAMAGE_LEGS when you get hit in the legs. CheckArmor has been modified too: just added if(dflags==DAMAGE_HEAD){client->ps.stats[STAT_ARMOR_HEAD] -= take; } ......
compiled it, tested it. Doesn't work. I've been playing around; modified it for testing to look like this:
Code: Select all
int CheckArmor (gentity_t *ent, int damage, int dflags)
{
gclient_t *client;
int save;
if (dflags & DAMAGE_NO_ARMOR)
return 0;
client = ent->client;
if (!client)
return 0;
return 500;
}
hit in the body: health increases
hit in the head: damage
But that's not all; I added this to cg_drawstatusbar:
Code: Select all
trap_R_SetColor( colors[0] );
value = ps->stats[STAT_ARMOR_HEAD];
CG_DrawField (100, 312, 1, value);
value = ps->stats[STAT_ARMOR_BODY];
CG_DrawField (100, 372, 1, value);
value = ps->stats[STAT_ARMOR_LEGS];
CG_DrawField (100, 432, 1, value);
It's really strange to me lol
