From 4d0e838d848a22cd48ac8e05b06702a728733fba Mon Sep 17 00:00:00 2001 From: Allanis Date: Fri, 8 Mar 2013 14:42:14 +0000 Subject: [PATCH] [Change] Cleaned up that last commit. --- src/player.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/src/player.c b/src/player.c index 43a86c8..18bb99f 100644 --- a/src/player.c +++ b/src/player.c @@ -415,45 +415,31 @@ void player_render(void) { gui.weapon.y - 10 - gl_defFont.h, &cGrey, "None"); } else { f = &gl_defFont; - if(player->ammo == NULL) { - if(outfit_isLauncher(player->secondary->outfit)) { - // Out of ammo. - i = gl_printWidth(f, "%s", player->secondary->outfit->u.lau.ammo); - if(i > (int)gui.weapon.w) - // Font is too big. - f = &gl_smallFont; - gl_printMid(f, (int)gui.weapon.w, - gui.weapon.x, gui.weapon.y - 5, - &cConsole, "%s", player->secondary->outfit->u.lau.ammo); - gl_printMid(&gl_smallFont, (int)gui.weapon.w, - gui.weapon.x, gui.weapon.y - 10 - gl_defFont.h, - NULL, "0"); - } else { - // Not a launcher. - i = gl_printWidth(f, "%s", player->secondary->outfit->name); - if(i > (int)gui.weapon.w) - // Font is too big. - f = &gl_smallFont; - gl_printMid(f, (int) gui.weapon.w, - gui.weapon.x, gui.weapon.y - (gui.weapon.h - f->h)/2., - &cConsole, "%s", player->secondary->outfit->name); - } - } else { + if(outfit_isLauncher(player->secondary->outfit)) { // Use the ammunitions name. - i = gl_printWidth(f, "%s", player->secondary->outfit->name); + i = gl_printWidth(f, "%s", player->secondary->outfit->u.lau.ammo); if(i > gui.weapon.w) // Font is too big. f = &gl_smallFont; gl_printMid(f, (int)gui.weapon.w, gui.weapon.x, gui.weapon.y - 5, - &cConsole, "%s", player->ammo->outfit->name); + &cConsole, "%s", player->ammo->outfit->u.lau.ammo); // Print ammo underneath to the left. gl_printMid(&gl_smallFont, gui.weapon.w, gui.weapon.x, gui.weapon.y - 10 - gl_defFont.h, - NULL, "%d", player->ammo->quantity); - } + NULL, "%d", (player->ammo) ? player->ammo->quantity : 0); + } else { + // Just print the item name. + i = gl_printWidth(f, "%s", player->secondary->outfit->name); + if(i > (int)gui.weapon.w) + // Font is too big. + f = &gl_smallFont; + gl_printMid(f, (int)gui.weapon.w, + gui.weapon.x, gui.weapon.y - (gui.weapon.h - f->h)/2., + &cConsole, "%s", player->secondary->outfit->name); + } } // Target.