Merge branch 'dev'

This commit is contained in:
Allanis 2014-04-14 22:28:37 +01:00
commit 0e45699035
5 changed files with 13 additions and 30 deletions

View File

@ -78,7 +78,7 @@ void opt_menuKeybinds(void) {
snprintf(str[j], 64, "%s <ja%d>", keybindNames[j], key);
break;
default:
snprintf(str[j], 64, keybindNames[j]);
snprintf(str[j], 64, "%s", keybindNames[j]);
break;
}
}

View File

@ -65,12 +65,6 @@ static void pilot_pause(void) {
pilot_stack[i]->tcontrol -= t;
for(j = 0; j < MAX_AI_TIMERS; j++)
pilot_stack[i]->timer[j] -= t;
/* Pause outfits. */
for(j = 0; j < pilot_stack[i]->noutfits; j++) {
if(pilot_stack[i]->outfits[j].timer > 0)
pilot_stack[i]->outfits[j].timer -= t;
}
}
}
@ -84,12 +78,6 @@ static void pilot_unpause(void) {
pilot_stack[i]->tcontrol += t;
for(j = 0; j < MAX_AI_TIMERS; j++)
pilot_stack[i]->timer[j] += t;
/* Pause outfits. */
for(j = 0; j < pilot_stack[i]->noutfits; j++) {
if(pilot_stack[i]->outfits[j].timer > 0)
pilot_stack[i]->outfits[j].timer += t;
}
}
}
@ -101,11 +89,6 @@ static void pilot_delay(unsigned int delay) {
pilot_stack[i]->tcontrol += delay;
for(j = 0; j < MAX_AI_TIMERS; j++)
pilot_stack[i]->timer[j] += delay;
for(j = 0; j < pilot_stack[i]->noutfits; j++) {
if(pilot_stack[i]->outfits[j].timer > 0)
pilot_stack[i]->outfits[j].timer += delay;
}
}
}

View File

@ -307,14 +307,8 @@ void pilot_shootStop(Pilot* p, const int secondary) {
* @param t Pilot's target.
*/
static void pilot_shootWeapon(Pilot* p, PilotOutfit* w) {
int quantity, delay;
/* WElll... Trying to shoot when you have no ammo?? FUUU */
quantity = pilot_oquantity(p,w);
delay = outfit_delay(w->outfit);
/* Check to see if weapon is ready. */
if((w->timer > 0) &&
(SDL_GetTicks() - w->timer) < (unsigned int)(delay/quantity))
if(w->timer > 0.)
return;
/* Regular bolt weapons. */
if(outfit_isBolt(w->outfit)) {
@ -383,8 +377,7 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w) {
WARN("Shooting unknown weapon type: %s", w->outfit->name);
}
/* Update the weapon last used timer. */
w->timer = SDL_GetTicks();
w->timer += ((double)outfit_delay(w->outfit) / (double)w->quantity)/1000.;
}
/**
@ -719,6 +712,7 @@ static void pilot_update(Pilot* pilot, const double dt) {
unsigned int t, l;
double a, px, py, vx, vy;
char buf[16];
PilotOutfit* o;
/* She's dead D: */
if(pilot_isFlag(pilot, PILOT_DEAD)) {
@ -838,6 +832,13 @@ static void pilot_update(Pilot* pilot, const double dt) {
} else /* Normal limit. */
limit_speed(&pilot->solid->vel, pilot->speed, dt);
}
/* Update outfits. */
for(i = 0; i < pilot->noutfits; i++) {
o = &pilot->outfits[i];
if(o->timer > 0.)
o->timer -= dt;
}
}
/* Pilot is getting ready or is in, hyperspace. */

View File

@ -89,7 +89,7 @@ typedef struct PilotOutfit_ {
int quantity; /**< Number of outfits of this type that the pilot has. */
PilotOutfitState state; /**< State of the outfit. */
int beamid; /**< ID of the beam used in this outfit, only for beams. */
unsigned int timer; /**< Used to store last used weapon time. */
double timer; /**< Used to store last used weapon time. */
} PilotOutfit;
/**

View File

@ -1046,8 +1046,7 @@ void player_renderGUI(double dt) {
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))
if(player->secondary->timer > 0.)
c = &cGrey;
else
c = &cConsole;