diff --git a/common/sbar.c b/common/sbar.c index b32af7f..1625d9d 100644 --- a/common/sbar.c +++ b/common/sbar.c @@ -80,6 +80,20 @@ void Sbar_MiniDeathmatchOverlay (void); static qboolean largegame = false; #endif +/* + Sbar_Items + + Return a target-independant items list +*/ +int +Sbar_Items ( void ) +{ +#ifdef QUAKEWORLD + return cl.stats[STAT_ITEMS]; +#else + return cl.items; +#endif // QUAKEWORLD +} /* =============== Sbar_ShowScores @@ -710,11 +724,7 @@ void Sbar_DrawInventory (void) // weapons for (i=0 ; i<7 ; i++) { -#ifdef QUAKEWORLD - if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN< cl.time - 2 && flashon ) - { // flash frame + if (time && time > cl.time - 2 && flashon ) { // flash frame sb_updates = 0; } else { @@ -855,7 +860,7 @@ void Sbar_DrawInventory (void) // hipnotic items if (hipnotic) { for (i=0 ; i<2 ; i++) { - if (cl.items & (1<<(24+i))) { + if (Sbar_Items() & (1<<(24+i))) { time = cl.item_gettime[24+i]; if (time && time > cl.time - 2 && flashon ) { // flash frame sb_updates = 0; @@ -872,7 +877,7 @@ void Sbar_DrawInventory (void) if (rogue) { // new rogue items for (i=0 ; i<2 ; i++) { - if (cl.items & (1<<(29+i))) { + if (Sbar_Items() & (1<<(29+i))) { time = cl.item_gettime[29+i]; if (time && time > cl.time - 2 && flashon ) { // flash frame @@ -889,11 +894,7 @@ void Sbar_DrawInventory (void) #endif // !QUAKEWORLD // sigils for (i=0 ; i<4 ; i++) { -#ifdef QUAKEWORLD - if (cl.stats[STAT_ITEMS] & (1<<(28+i))) { -#else - if (cl.items & (1<<(28+i))) { -#endif // QUAKEWORLD + if (Sbar_Items() & (1<<(28+i))) { time = cl.item_gettime[28+i]; if (time && time > cl.time - 2 && flashon ) { // flash frame sb_updates = 0; @@ -1060,51 +1061,23 @@ void Sbar_DrawFace (void) // PGM 01/19/97 - team color drawing #endif // !QUAKEWORLD -#ifdef QUAKEWORLD - if ( (cl.stats[STAT_ITEMS] & (IT_INVISIBILITY | IT_INVULNERABILITY) ) - == (IT_INVISIBILITY | IT_INVULNERABILITY) ) - { + if ( (Sbar_Items() & (IT_INVISIBILITY | IT_INVULNERABILITY) ) + == (IT_INVISIBILITY | IT_INVULNERABILITY) ) { Sbar_DrawPic (112, 0, sb_face_invis_invuln); return; } - if (cl.stats[STAT_ITEMS] & IT_QUAD) - { + if (Sbar_Items() & IT_QUAD) { Sbar_DrawPic (112, 0, sb_face_quad ); return; } - if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) - { + if (Sbar_Items() & IT_INVISIBILITY) { Sbar_DrawPic (112, 0, sb_face_invis ); return; } - if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) - { + if (Sbar_Items() & IT_INVULNERABILITY) { Sbar_DrawPic (112, 0, sb_face_invuln); return; } -#else - if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) ) - == (IT_INVISIBILITY | IT_INVULNERABILITY) ) - { - Sbar_DrawPic (112, 0, sb_face_invis_invuln); - return; - } - if (cl.items & IT_QUAD) - { - Sbar_DrawPic (112, 0, sb_face_quad ); - return; - } - if (cl.items & IT_INVISIBILITY) - { - Sbar_DrawPic (112, 0, sb_face_invis ); - return; - } - if (cl.items & IT_INVULNERABILITY) - { - Sbar_DrawPic (112, 0, sb_face_invuln); - return; - } -#endif // QUAKEWORLD if (cl.stats[STAT_HEALTH] >= 100) f = 4; @@ -1133,54 +1106,42 @@ void Sbar_DrawNormal (void) #ifndef QUAKEWORLD if (hipnotic) { - if (cl.items & IT_KEY1) + if (Sbar_Items() & IT_KEY1) Sbar_DrawPic (209, 3, sb_items[0]); - if (cl.items & IT_KEY2) + if (Sbar_Items() & IT_KEY2) Sbar_DrawPic (209, 12, sb_items[1]); } -#endif // QUAKEWORLD +#endif // !QUAKEWORLD // armor -#ifdef QUAKEWORLD - if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) { - Sbar_DrawNum (24, 0, 666, 3, 1); - Sbar_DrawPic (0, 0, draw_disc); - } else { - Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3 - , cl.stats[STAT_ARMOR] <= 25); - if (cl.stats[STAT_ITEMS] & IT_ARMOR3) - Sbar_DrawPic (0, 0, sb_armor[2]); - else if (cl.stats[STAT_ITEMS] & IT_ARMOR2) - Sbar_DrawPic (0, 0, sb_armor[1]); - else if (cl.stats[STAT_ITEMS] & IT_ARMOR1) - Sbar_DrawPic (0, 0, sb_armor[0]); - } -#else - if (cl.items & IT_INVULNERABILITY) { + if (Sbar_Items() & IT_INVULNERABILITY) { Sbar_DrawNum (24, 0, 666, 3, 1); Sbar_DrawPic (0, 0, draw_disc); } else { +#ifndef QUAKEWORLD if (rogue) { Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25); - if (cl.items & RIT_ARMOR3) + if (Sbar_Items() & RIT_ARMOR3) Sbar_DrawPic (0, 0, sb_armor[2]); - else if (cl.items & RIT_ARMOR2) + else if (Sbar_Items() & RIT_ARMOR2) Sbar_DrawPic (0, 0, sb_armor[1]); - else if (cl.items & RIT_ARMOR1) + else if (Sbar_Items() & RIT_ARMOR1) Sbar_DrawPic (0, 0, sb_armor[0]); } else { +#endif // QUAKEWORLD Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3 , cl.stats[STAT_ARMOR] <= 25); - if (cl.items & IT_ARMOR3) + if (Sbar_Items() & IT_ARMOR3) Sbar_DrawPic (0, 0, sb_armor[2]); - else if (cl.items & IT_ARMOR2) + else if (Sbar_Items() & IT_ARMOR2) Sbar_DrawPic (0, 0, sb_armor[1]); - else if (cl.items & IT_ARMOR1) + else if (Sbar_Items() & IT_ARMOR1) Sbar_DrawPic (0, 0, sb_armor[0]); +#ifndef QUAKEWORLD } +#endif } -#endif // QUAKEWORLD // face Sbar_DrawFace (); @@ -1190,42 +1151,35 @@ void Sbar_DrawNormal (void) , cl.stats[STAT_HEALTH] <= 25); // ammo icon -#ifdef QUAKEWORLD - if (cl.stats[STAT_ITEMS] & IT_SHELLS) - Sbar_DrawPic (224, 0, sb_ammo[0]); - else if (cl.stats[STAT_ITEMS] & IT_NAILS) - Sbar_DrawPic (224, 0, sb_ammo[1]); - else if (cl.stats[STAT_ITEMS] & IT_ROCKETS) - Sbar_DrawPic (224, 0, sb_ammo[2]); - else if (cl.stats[STAT_ITEMS] & IT_CELLS) - Sbar_DrawPic (224, 0, sb_ammo[3]); -#else +#ifndef QUAKEWORLD if (rogue) { - if (cl.items & RIT_SHELLS) + if (Sbar_Items() & RIT_SHELLS) Sbar_DrawPic (224, 0, sb_ammo[0]); - else if (cl.items & RIT_NAILS) + else if (Sbar_Items() & RIT_NAILS) Sbar_DrawPic (224, 0, sb_ammo[1]); - else if (cl.items & RIT_ROCKETS) + else if (Sbar_Items() & RIT_ROCKETS) Sbar_DrawPic (224, 0, sb_ammo[2]); - else if (cl.items & RIT_CELLS) + else if (Sbar_Items() & RIT_CELLS) Sbar_DrawPic (224, 0, sb_ammo[3]); - else if (cl.items & RIT_LAVA_NAILS) + else if (Sbar_Items() & RIT_LAVA_NAILS) Sbar_DrawPic (224, 0, rsb_ammo[0]); - else if (cl.items & RIT_PLASMA_AMMO) + else if (Sbar_Items() & RIT_PLASMA_AMMO) Sbar_DrawPic (224, 0, rsb_ammo[1]); - else if (cl.items & RIT_MULTI_ROCKETS) + else if (Sbar_Items() & RIT_MULTI_ROCKETS) Sbar_DrawPic (224, 0, rsb_ammo[2]); } else { - if (cl.items & IT_SHELLS) +#endif // !QUAKEWORLD + if (Sbar_Items() & IT_SHELLS) Sbar_DrawPic (224, 0, sb_ammo[0]); - else if (cl.items & IT_NAILS) + else if (Sbar_Items() & IT_NAILS) Sbar_DrawPic (224, 0, sb_ammo[1]); - else if (cl.items & IT_ROCKETS) + else if (Sbar_Items() & IT_ROCKETS) Sbar_DrawPic (224, 0, sb_ammo[2]); - else if (cl.items & IT_CELLS) + else if (Sbar_Items() & IT_CELLS) Sbar_DrawPic (224, 0, sb_ammo[3]); +#ifndef QUAKEWORLD } -#endif // QUAKEWORLD +#endif // !QUAKEWORLD Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3 , cl.stats[STAT_AMMO] <= 10); }