From d49d1c2cbb87c5b01865be55b923c17b07798d70 Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 18 May 2008 17:16:49 +0000 Subject: [PATCH] correct weaponselect hud icon when spectating other player git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2038 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/rendergl.cpp | 5 ++--- source/src/renderhud.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 96e8cc6f..4e681d2c 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -354,9 +354,8 @@ void recomputecamera() case SM_FOLLOW3RD: case SM_FOLLOW3RD_TRANSPARENT: { - playerent *f = findfollowplayer(); - if(!f) { togglespect(); return; } - playerent *p = players[player1->followplayercn]; + playerent *p = findfollowplayer(); + if(!p) { togglespect(); return; } static physent followcam; static playerent *lastplayer; if(lastplayer != p || &followcam != camera1) diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index b5510a86..f1177ee0 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -203,22 +203,22 @@ void drawdmgindicator() glEnable(GL_TEXTURE_2D); } -void drawequipicons() +void drawequipicons(playerent *p) { glDisable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1.0f, 1.0f, 1.0f, 0.2f+(sinf(lastmillis/100.0f)+1.0f)/2.0f); // health & armor - if(player1->armour) drawequipicon(620, 1650, 2, 0, false); - drawequipicon(20, 1650, 1, 0, (player1->state!=CS_DEAD && player1->health<=20 && !m_osok)); + if(p->armour) drawequipicon(620, 1650, 2, 0, false); + drawequipicon(20, 1650, 1, 0, (p->state!=CS_DEAD && p->health<=20 && !m_osok)); // weapons - int c = player1->weaponsel->type, r = 1; + int c = p->weaponsel->type, r = 1; if(c==GUN_GRENADE) c = r = 0; else if(c>2) { c -= 3; r = 2; } - drawequipicon(1220, 1650, c, r, (!player1->weaponsel->mag && player1->weaponsel->type != GUN_KNIFE && player1->weaponsel->type != GUN_GRENADE)); + drawequipicon(1220, 1650, c, r, (!p->weaponsel->mag && p->weaponsel->type != GUN_KNIFE && p->weaponsel->type != GUN_GRENADE)); glEnable(GL_BLEND); } @@ -416,7 +416,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat drawdmgindicator(); - if(p->state==CS_ALIVE && !hidehudequipment) drawequipicons(); + if(p->state==CS_ALIVE && !hidehudequipment) drawequipicons(p); glMatrixMode(GL_MODELVIEW); if(!menu && (!hideradar || showmap)) drawradar(w, h);