[Fix] Only took all day to fix last night sleepy mess. :D

This commit is contained in:
Allanis 2013-02-05 18:31:34 +00:00
parent 141790fe0a
commit 7a8dc43f96
2 changed files with 8 additions and 5 deletions

View File

@ -39,7 +39,7 @@ void player_think(Pilot* player) {
if(player_turn)
player->solid->dir_vel -= player->ship->turn * player_turn;
//if(player_primary) pilot_shoot(player, 0);
if(player_primary) pilot_shoot(player, 0);
vect_pset(&player->solid->force, player->ship->thrust * player_acc, player->solid->dir);
}

View File

@ -91,15 +91,18 @@ static void weapon_update(Weapon* w, const double dt) {
static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2* pos, const Vec2* vel) {
Vec2 v;
double mass = 1; // Presumer lasers have a mass of 1.
double rdir = dir; // Real direction (accuracy).
Weapon* w = MALLOC_L(Weapon);
w->outfit = outfit; // Non-Changeable.
w->update = weapon_update;
w->timer = SDL_GetTicks();
w->think = NULL;
switch(outfit->type) {
case OUTFIT_TYPE_BOLT:
vect_cset(&v, VY(*vel)+outfit->speed*cos(dir), VANGLE(*vel)+outfit->speed*sin(dir));
w->solid = solid_create(mass, dir, pos, &v);
rdir += RNG(-outfit->accuracy/2., outfit->accuracy/2.)/180.*M_PI;
vect_cset(&v, VX(*vel)+outfit->speed*cos(rdir), VANGLE(*vel)+outfit->speed*sin(rdir));
w->solid = solid_create(mass, rdir, pos, &v);
break;
default:
break;
@ -165,11 +168,11 @@ static void weapon_destroy(Weapon* w, WeaponLayer layer) {
nlayer = &nfrontLayer;
break;
}
for(i = 0; wlayer[i] != w; i++) // Get us to the current posision.
for(i = 0; wlayer[i] != w; i++); // Get us to the current posision.
weapon_free(wlayer[i]);
(*nlayer)--;
for(; (*nlayer); i++)
for(; i < (*nlayer); i++)
wlayer[i] = wlayer[i+1];
}