physent != playerent fixes (for demoplayback)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3671 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -248,12 +248,16 @@ void drawequipicons(playerent *p)
|
||||
drawequipicon(20, 1650, 1, 0, (p->state!=CS_DEAD && p->health<=20 && !m_osok));
|
||||
|
||||
// weapons
|
||||
int c = p->weaponsel->type, r = 1;
|
||||
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; }
|
||||
// flowtron: another check to avoid segfault on linux in demo playback 20081120
|
||||
if(p!=camera1)
|
||||
{
|
||||
int c = p->weaponsel->type, r = 1;
|
||||
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(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)); // flowtron [second segfault]
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -495,7 +499,7 @@ void damageblend(int n)
|
||||
|
||||
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater)
|
||||
{
|
||||
playerent *p = camera1->type==ENT_PLAYER ? (playerent *)camera1 : player1;
|
||||
playerent *p = camera1->type==ENT_PLAYER ? (playerent *)camera1 : player1; // flowtron : 20081120 : this cast considered harmful
|
||||
bool spectating = player1->isspectating();
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@@ -554,8 +558,8 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
playerent *targetplayer = playerincrosshair();
|
||||
bool menu = menuvisible();
|
||||
bool command = getcurcommand() ? true : false;
|
||||
|
||||
if((p->state==CS_ALIVE || p->state==CS_EDITING) && !p->weaponsel->reloading)
|
||||
// flowtron 20081120 : checking for p!=camera1 fixes crash here
|
||||
if((p->state==CS_ALIVE || p->state==CS_EDITING) && (p!=camera1 && !p->weaponsel->reloading))
|
||||
{
|
||||
bool drawteamwarning = crosshairteamsign && targetplayer && isteam(targetplayer->team, p->team) && targetplayer->state==CS_ALIVE;
|
||||
p->weaponsel->renderaimhelp(drawteamwarning);
|
||||
@@ -667,7 +671,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
{
|
||||
draw_textf("%d", 90, 827, p->health);
|
||||
if(p->armour) draw_textf("%d", 390, 827, p->armour);
|
||||
if(p->weaponsel && p->weaponsel->type>=GUN_KNIFE && p->weaponsel->type<NUMGUNS) p->weaponsel->renderstats(); // flowtron
|
||||
if(p!=camera1 && p->weaponsel && p->weaponsel->type>=GUN_KNIFE && p->weaponsel->type<NUMGUNS) p->weaponsel->renderstats(); // flowtron - yet again 20081120 - old weaponsel fix was just checking for !=NULL, now also p!=camera1
|
||||
}
|
||||
|
||||
if(m_flags && !hidectfhud)
|
||||
|
||||
Reference in New Issue
Block a user