[Change] Missiles now hack the physics subsystem, Needs fixing.
This commit is contained in:
parent
0bcc2c3135
commit
6dbfe22d90
@ -177,7 +177,7 @@
|
|||||||
<duration>5</duration>
|
<duration>5</duration>
|
||||||
<lockon>1</lockon>
|
<lockon>1</lockon>
|
||||||
<thrust>1600</thrust>
|
<thrust>1600</thrust>
|
||||||
<turn>200</turn>
|
<turn>60</turn>
|
||||||
<speed>800</speed>
|
<speed>800</speed>
|
||||||
<damage type="kinetic">20</damage>
|
<damage type="kinetic">20</damage>
|
||||||
</specific>
|
</specific>
|
||||||
@ -212,8 +212,8 @@
|
|||||||
<duration>7</duration>
|
<duration>7</duration>
|
||||||
<lockon>0.5</lockon>
|
<lockon>0.5</lockon>
|
||||||
<thrust>1300</thrust>
|
<thrust>1300</thrust>
|
||||||
<turn>200</turn>
|
<turn>90</turn>
|
||||||
<speed>650</speed>
|
<speed>550</speed>
|
||||||
<damage type="kinetic">20</damage>
|
<damage type="kinetic">20</damage>
|
||||||
</specific>
|
</specific>
|
||||||
</outfit>
|
</outfit>
|
||||||
|
19
src/weapon.c
19
src/weapon.c
@ -72,7 +72,7 @@ static void weapon_destroy(Weapon* w, WeaponLayer layer);
|
|||||||
static void weapon_free(Weapon* w);
|
static void weapon_free(Weapon* w);
|
||||||
/* Think. */
|
/* Think. */
|
||||||
static void think_seeker(Weapon* w, const double dt);
|
static void think_seeker(Weapon* w, const double dt);
|
||||||
static void think_smart(Weapon* w, const double dt);
|
/*static void think_smart(Weapon* w, const double dt);*/
|
||||||
/* Extern. */
|
/* Extern. */
|
||||||
void weapon_minimap(const double res, const double w,
|
void weapon_minimap(const double res, const double w,
|
||||||
const double h, const RadarShape shape);
|
const double h, const RadarShape shape);
|
||||||
@ -104,6 +104,7 @@ void weapon_minimap(const double res, const double w,
|
|||||||
/* Seeker brain, You get what you pay for. :) */
|
/* Seeker brain, You get what you pay for. :) */
|
||||||
static void think_seeker(Weapon* w, const double dt) {
|
static void think_seeker(Weapon* w, const double dt) {
|
||||||
double diff;
|
double diff;
|
||||||
|
double vel;
|
||||||
if(w->target == w->parent) return; /* HEY! Self harm is not allowed. */
|
if(w->target == w->parent) return; /* HEY! Self harm is not allowed. */
|
||||||
|
|
||||||
Pilot* p = pilot_get(w->target);
|
Pilot* p = pilot_get(w->target);
|
||||||
@ -114,7 +115,7 @@ static void think_seeker(Weapon* w, const double dt) {
|
|||||||
|
|
||||||
/* Ammo isn't locked on yet.. */
|
/* Ammo isn't locked on yet.. */
|
||||||
if(SDL_GetTicks() > (w->outfit->u.amm.lockon)) {
|
if(SDL_GetTicks() > (w->outfit->u.amm.lockon)) {
|
||||||
diff = angle_diff(w->solid->dir, vect_angle(&w->solid->pos, &p->solid->pos));
|
/*diff = angle_diff(w->solid->dir, vect_angle(&w->solid->pos, &p->solid->pos));*/
|
||||||
w->solid->dir_vel = 10 * diff * w->outfit->u.amm.turn;
|
w->solid->dir_vel = 10 * diff * w->outfit->u.amm.turn;
|
||||||
/* Face the target. */
|
/* Face the target. */
|
||||||
if(w->solid->dir_vel > w->outfit->u.amm.turn)
|
if(w->solid->dir_vel > w->outfit->u.amm.turn)
|
||||||
@ -123,15 +124,17 @@ static void think_seeker(Weapon* w, const double dt) {
|
|||||||
w->solid->dir_vel = -w->outfit->u.amm.turn;
|
w->solid->dir_vel = -w->outfit->u.amm.turn;
|
||||||
}
|
}
|
||||||
|
|
||||||
vect_pset(&w->solid->force, w->outfit->u.amm.thrust, w->solid->dir);
|
/* Limit speed here. */
|
||||||
|
vel = MIN(w->outfit->u.amm.speed, VMOD(w->solid->vel) + w->outfit->u.amm.thrust*dt);
|
||||||
limit_speed(&w->solid->vel, w->outfit->u.amm.speed, dt);
|
vect_pset(&w->solid->vel, vel, w->solid->dir);
|
||||||
|
/*limit_speed(&w->solid->vel, w->outfit->u.amm.speed, dt);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================
|
/* ========================================================
|
||||||
* Smart seeker brain. Much better at homing.
|
* Smart seeker brain. Much better at homing.
|
||||||
* ========================================================
|
* ========================================================
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
static void think_smart(Weapon* w, const double dt) {
|
static void think_smart(Weapon* w, const double dt) {
|
||||||
Vec2 sv, tv;
|
Vec2 sv, tv;
|
||||||
double t;
|
double t;
|
||||||
@ -168,6 +171,7 @@ static void think_smart(Weapon* w, const double dt) {
|
|||||||
limit_speed(&w->solid->vel, w->outfit->u.amm.speed, dt);
|
limit_speed(&w->solid->vel, w->outfit->u.amm.speed, dt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Update all the weapon layers. */
|
/* Update all the weapon layers. */
|
||||||
void weapons_update(const double dt) {
|
void weapons_update(const double dt) {
|
||||||
@ -385,10 +389,11 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
|
|||||||
pilot_target->lockons++;
|
pilot_target->lockons++;
|
||||||
|
|
||||||
/* Only diff is AI. */
|
/* Only diff is AI. */
|
||||||
if(outfit->type == OUTFIT_TYPE_MISSILE_SEEK_AMMO)
|
w->think = think_seeker; /* AI is the same atm. */
|
||||||
|
/*if(outfit->type == OUTFIT_TYPE_MISSILE_SEEK_AMMO)
|
||||||
w->think = think_seeker;
|
w->think = think_seeker;
|
||||||
else if(outfit->type == OUTFIT_TYPE_MISSILE_SEEK_SMART_AMMO)
|
else if(outfit->type == OUTFIT_TYPE_MISSILE_SEEK_SMART_AMMO)
|
||||||
w->think = think_smart;
|
w->think = think_smart;*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Just dump it where the player is. */
|
/* Just dump it where the player is. */
|
||||||
|
Loading…
Reference in New Issue
Block a user