Revision 339
more changes
ent.c | ||
---|---|---|
375 | 375 |
return distance <= shooter_radius+bullet_radius; |
376 | 376 |
} |
377 | 377 |
|
378 |
double (distance_gunners)(const gunner_t *shooter1, const gunner_t *shooter2) { |
|
379 |
double shooter1_x = gunner_get_x(shooter1); |
|
380 |
double shooter1_y = gunner_get_y(shooter1); |
|
381 |
|
|
382 |
double shooter2_x = gunner_get_x(shooter2); |
|
383 |
double shooter2_y = gunner_get_y(shooter2); |
|
384 |
|
|
385 |
double dx = shooter1_x - shooter2_x; |
|
386 |
double dy = shooter1_y - shooter2_y; |
|
387 |
return sqrt(dx*dx + dy*dy); |
|
388 |
} |
|
389 |
|
|
390 | 378 |
int (gunner_collides_gunner)(const gunner_t *shooter1, const gunner_t *shooter2) { |
391 | 379 |
if (shooter1 == shooter2) return false; |
392 | 380 |
double shooter1_radius = max_d(sprite_get_w(shooter1->dude), sprite_get_h(shooter1->dude))/2.0; |
393 | 381 |
double shooter2_radius = max_d(sprite_get_w(shooter2->dude), sprite_get_h(shooter2->dude))/2.0; |
394 |
double distance = distance_gunners(shooter1, shooter2);
|
|
382 |
double distance = gunner_distance(shooter1, shooter2);
|
|
395 | 383 |
return distance <= shooter1_radius+shooter2_radius; |
396 | 384 |
} |
397 | 385 |
|
Also available in: Unified diff