diff --git a/src/pilot.c b/src/pilot.c index 2b45c49..6eb4f39 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -64,7 +64,6 @@ static void pilot_calcCargo(Pilot* pilot); void pilot_free(Pilot* p); static Fleet* fleet_parse(const xmlNodePtr parent); static void pilot_dead(Pilot* p); -static int pilot_oquantity(Pilot* p, PilotOutfit* w); /** * @fn unsinged int pilot_getNextID(const unsigned int id) @@ -187,7 +186,7 @@ int pilot_getJumps(const Pilot* p) { } /* Return quantity of a pilot outfit. */ -static int pilot_oquantity(Pilot* p, PilotOutfit* w) { +int pilot_oquantity(Pilot* p, PilotOutfit* w) { return (outfit_isAmmo(w->outfit) && p->secondary) ? p->secondary->quantity : w->quantity; } diff --git a/src/pilot.h b/src/pilot.h index ad80af8..c152f91 100644 --- a/src/pilot.h +++ b/src/pilot.h @@ -236,6 +236,7 @@ int pilot_addOutfit(Pilot* pilot, Outfit* outfit, int quantity); int pilot_rmOutfit(Pilot* pilot, Outfit* outfit, int quantity); char* pilot_getOutfits(Pilot* pilot); void pilot_calcStats(Pilot* pilot); +int pilot_oquantity(Pilot* p, PilotOutfit* w); /* Normal cargo. */ int pilot_cargoUsed(Pilot* pilot); /* Get amount of cargo onboard. */ int pilot_cargoFree(Pilot* p); /* Cargo space. */ diff --git a/src/player.c b/src/player.c index 0143dcd..be5c91e 100644 --- a/src/player.c +++ b/src/player.c @@ -838,6 +838,7 @@ void player_renderGUI(void) { glFont* f; StarSystem* sys; unsigned int t; + int quantity, delay; t = SDL_GetTicks(); @@ -962,6 +963,18 @@ void player_renderGUI(void) { gui.weapon.y - 10 - gl_defFont.h, &cGrey, "None"); } else { f = &gl_defFont; + + quantity = pilot_oquantity(player, player->secondary); + delay = outfit_delay(player->secondary->outfit); + + /* Check to see if weapon is ready. */ + if((player->secondary->timer > 0) && + (SDL_GetTicks() - player->secondary->timer) < (unsigned int)(delay/quantity)) + c = &cGrey; + else + c = &cConsole; + + /* Launcher. */ if(outfit_isLauncher(player->secondary->outfit)) { /* Use the ammunitions name. */ i = gl_printWidth(f, "%s", player->secondary->outfit->u.lau.ammo); @@ -971,12 +984,13 @@ void player_renderGUI(void) { gl_printMid(f, (int)gui.weapon.w, gui.weapon.x, gui.weapon.y - 5, - &cConsole, "%s", player->secondary->outfit->u.lau.ammo); + c, "%s", player->secondary->outfit->u.lau.ammo); /* Print ammo underneath to the left. */ gl_printMid(&gl_smallFont, (int)gui.weapon.w, gui.weapon.x, gui.weapon.y - 10 - gl_defFont.h, NULL, "%d", (player->ammo) ? player->ammo->quantity : 0); + /* Other. */ } else { /* Just print the item name. */ i = gl_printWidth(f, "%s", player->secondary->outfit->name); @@ -985,7 +999,7 @@ void player_renderGUI(void) { 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); + c, "%s", player->secondary->outfit->name); } }