[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> | ||||
| <lockon>1</lockon> | ||||
| <thrust>1600</thrust> | ||||
| <turn>200</turn> | ||||
| <turn>60</turn> | ||||
| <speed>800</speed> | ||||
| <damage type="kinetic">20</damage> | ||||
| </specific> | ||||
| @ -212,8 +212,8 @@ | ||||
| <duration>7</duration> | ||||
| <lockon>0.5</lockon> | ||||
| <thrust>1300</thrust> | ||||
| <turn>200</turn> | ||||
| <speed>650</speed> | ||||
| <turn>90</turn> | ||||
| <speed>550</speed> | ||||
| <damage type="kinetic">20</damage> | ||||
| </specific> | ||||
| </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); | ||||
| /* Think. */ | ||||
| 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. */ | ||||
| void weapon_minimap(const double res, const double w, | ||||
|     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. :) */ | ||||
| static void think_seeker(Weapon* w, const double dt) { | ||||
|   double diff; | ||||
|   double vel; | ||||
|   if(w->target == w->parent) return; /* HEY! Self harm is not allowed. */ | ||||
| 
 | ||||
|   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.. */ | ||||
|   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; | ||||
|     /* Face the target. */ | ||||
|     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; | ||||
|   } | ||||
| 
 | ||||
|   vect_pset(&w->solid->force, w->outfit->u.amm.thrust, w->solid->dir); | ||||
| 
 | ||||
|   limit_speed(&w->solid->vel, w->outfit->u.amm.speed, dt); | ||||
|   /* Limit speed here. */ | ||||
|   vel = MIN(w->outfit->u.amm.speed, VMOD(w->solid->vel) + w->outfit->u.amm.thrust*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. | ||||
|  * ======================================================== | ||||
|  */ | ||||
| #if 0 | ||||
| static void think_smart(Weapon* w, const double dt) { | ||||
|   Vec2 sv, tv; | ||||
|   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); | ||||
| 
 | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| /* Update all the weapon layers. */ | ||||
| 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++; | ||||
| 
 | ||||
|     /* 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; | ||||
|     else if(outfit->type == OUTFIT_TYPE_MISSILE_SEEK_SMART_AMMO) | ||||
|       w->think = think_smart; | ||||
|       w->think = think_smart;*/ | ||||
|     break; | ||||
|   | ||||
|   /* Just dump it where the player is. */ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Allanis
						Allanis