From 379a2a32b7fe19698448da6bb39c3fc41521030c Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 13 Jun 2015 22:42:19 +0000 Subject: [PATCH] Use operator?: for similar gr_printf in gauges --- similar/main/gauges.cpp | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index 572e8735c..50348353f 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -872,10 +872,7 @@ static void sb_show_score(const local_multires_gauge_graphic multires_gauge_grap gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,20,0),-1 ); - if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) - gr_printf(HUD_SCALE_X(SB_SCORE_LABEL_X),HUD_SCALE_Y(SB_SCORE_Y),"%s:", TXT_KILLS); - else - gr_printf(HUD_SCALE_X(SB_SCORE_LABEL_X),HUD_SCALE_Y(SB_SCORE_Y),"%s:", TXT_SCORE); + gr_printf(HUD_SCALE_X(SB_SCORE_LABEL_X), HUD_SCALE_Y(SB_SCORE_Y), "%s:", (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ? TXT_KILLS : TXT_SCORE); gr_set_curfont( GAME_FONT ); if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) @@ -1104,10 +1101,7 @@ static void hud_show_energy(void) if (PlayerCfg.HudMode<2) { gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,31,0),-1 ); - if (Game_mode & GM_MULTI) - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-(LINE_SPACING*5)),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy)); - else - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-LINE_SPACING),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy)); + gr_printf(FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? (LINE_SPACING * 5) : LINE_SPACING),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy)); } if (Newdemo_state == ND_STATE_RECORDING) @@ -1671,17 +1665,7 @@ static void hud_show_shield(void) gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,31,0),-1 ); - if ( Players[Player_num].shields >= 0 ) { - if (Game_mode & GM_MULTI) - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-(LINE_SPACING*6)),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields)); - else - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-(LINE_SPACING*2)),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields)); - } else { - if (Game_mode & GM_MULTI) - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-(LINE_SPACING*6)),"%s: 0", TXT_SHIELD ); - else - gr_printf(FSPACX(1), (grd_curcanv->cv_bitmap.bm_h-(LINE_SPACING*2)),"%s: 0", TXT_SHIELD ); - } + gr_printf(FSPACX(1), grd_curcanv->cv_bitmap.bm_h - ((Game_mode & GM_MULTI) ? LINE_SPACING * 6 : LINE_SPACING * 2), "%s: %i", TXT_SHIELD, Players[Player_num].shields >= 0 ? f2ir(Players[Player_num].shields) : 0); } if (Newdemo_state==ND_STATE_RECORDING ) @@ -1725,10 +1709,7 @@ static void sb_show_lives(const local_multires_gauge_graphic multires_gauge_grap gr_set_curfont( GAME_FONT ); gr_set_fontcolor(BM_XRGB(0,20,0),-1 ); - if (Game_mode & GM_MULTI) - gr_printf(HUD_SCALE_X(SB_LIVES_LABEL_X),HUD_SCALE_Y(y),"%s:", TXT_DEATHS); - else - gr_printf(HUD_SCALE_X(SB_LIVES_LABEL_X),HUD_SCALE_Y(y),"%s:", TXT_LIVES); + gr_printf(HUD_SCALE_X(SB_LIVES_LABEL_X), HUD_SCALE_Y(y), "%s:", (Game_mode & GM_MULTI) ? TXT_DEATHS : TXT_LIVES); if (Game_mode & GM_MULTI) {