Fixing the hud icon for the weapons.

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4859 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-05-14 20:17:40 +00:00
parent 4768241b3d
commit 2dea41a0c6
2 changed files with 6 additions and 7 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

+6 -7
View File
@@ -10,11 +10,11 @@ void drawicon(Texture *tex, float x, float y, float s, int col, int row, float t
void drawequipicon(float x, float y, int col, int row, float blend)
{
static Texture *tex = NULL;
if(!tex) tex = textureload("packages/misc/items.png", 3);
if(!tex) tex = textureload("packages/misc/items-tmp.png", 4);
if(tex)
{
if(blend) glEnable(GL_BLEND);
drawicon(tex, x, y, 120, col, row, 1/3.0f);
drawicon(tex, x, y, 120, col, row, 1/4.0f);
if(blend) glDisable(GL_BLEND);
}
}
@@ -268,14 +268,13 @@ void drawequipicons(playerent *p)
glColor4f(1.0f, 1.0f, 1.0f, 0.2f+(sinf(lastmillis/100.0f)+1.0f)/2.0f);
// health & armor
if(p->armour) drawequipicon(620, 1650, 2, 0, false);
drawequipicon(20, 1650, 1, 0, (p->state!=CS_DEAD && p->health<=20 && !m_osok));
if(p->armour) drawequipicon(620, 1650, 3, 3, false);
drawequipicon(20, 1650, 2, 3, (p->state!=CS_DEAD && p->health<=20 && !m_osok));
// weapons
int c = p->weaponsel->type, r = 1;
int c = p->weaponsel->type, r = 0;
if(c==GUN_AKIMBO) c = GUN_PISTOL; // same icon for akimb & pistol
if(c==GUN_GRENADE) c = r = 0;
else if(c>2) { c -= 3; r = 2; }
if(c>3) { c -= 4; r = 1; }
if(p->weaponsel && p->weaponsel->type>=GUN_KNIFE && p->weaponsel->type<NUMGUNS) drawequipicon(1220, 1650, c, r, (!p->weaponsel->mag && p->weaponsel->type != GUN_KNIFE && p->weaponsel->type != GUN_GRENADE));
glEnable(GL_BLEND);