Project

General

Profile

Revision 308

multiplayer serial structs

View differences:

ent.c
339 339
    return distance <= shooter_radius+bullet_radius;
340 340
}
341 341

  
342
int (gunner_collides_gunner)(const gunner_t *shooter1, const gunner_t *shooter2) {
343
    double shooter1_radius = max(sprite_get_w(shooter1->dude), sprite_get_h(shooter1->dude))/2.0;
342
double (distance_gunners)(const gunner_t *shooter1, const gunner_t *shooter2) {
344 343
    double shooter1_x = gunner_get_x(shooter1);
345 344
    double shooter1_y = gunner_get_y(shooter1);
346 345

  
347
    double shooter2_radius = max(sprite_get_w(shooter2->dude), sprite_get_h(shooter2->dude))/2.0;
348 346
    double shooter2_x = gunner_get_x(shooter2);
349 347
    double shooter2_y = gunner_get_y(shooter2);
350 348

  
351 349
    double dx = shooter1_x - shooter2_x;
352 350
    double dy = shooter1_y - shooter2_y;
353
    double distance = sqrt(dx*dx + dy*dy);
351
    return sqrt(dx*dx + dy*dy);
352
}
353

  
354
int (gunner_collides_gunner)(const gunner_t *shooter1, const gunner_t *shooter2) {
355
    double shooter1_radius = max(sprite_get_w(shooter1->dude), sprite_get_h(shooter1->dude))/2.0;
356
    double shooter2_radius = max(sprite_get_w(shooter2->dude), sprite_get_h(shooter2->dude))/2.0;
357
    double distance = distance_gunners(shooter1, shooter2);
354 358
    return distance <= shooter1_radius+shooter2_radius;
355 359
}
356 360

  

Also available in: Unified diff