From 3118fff45e79e9161ff20fe3dfe98acc7f5c7c89 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 22 Sep 2013 03:50:16 +0000 Subject: [PATCH] Compute Boss_invulnerable_dot as needed --- d2x-rebirth/main/ai.c | 1 - d2x-rebirth/main/collide.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/d2x-rebirth/main/ai.c b/d2x-rebirth/main/ai.c index 486eea8bd..808727f4a 100644 --- a/d2x-rebirth/main/ai.c +++ b/d2x-rebirth/main/ai.c @@ -3610,7 +3610,6 @@ void init_robots_for_level(void) Buddy_objnum = 0; Buddy_allowed_to_talk = 0; - Boss_invulnerable_dot = F1_0/4 - i2f(Difficulty_level)/8; Boss_dying_start_time = 0; Ai_last_missile_camera = -1; diff --git a/d2x-rebirth/main/collide.c b/d2x-rebirth/main/collide.c index 804fda380..bd1bfa592 100644 --- a/d2x-rebirth/main/collide.c +++ b/d2x-rebirth/main/collide.c @@ -1356,7 +1356,10 @@ extern int boss_spew_robot(object *objp, vms_vector *pos); //--ubyte Boss_invulnerable_spot[NUM_D2_BOSSES] = {0,0,0,0,1,1}; // Set byte if boss is invulnerable in all but a certain spot. (Dot product fvec|vec_to_collision < BOSS_INVULNERABLE_DOT) //#define BOSS_INVULNERABLE_DOT 0 // If a boss is invulnerable over most of his body, fvec(dot)vec_to_collision must be less than this for damage to occur. -int Boss_invulnerable_dot = 0; +static inline int Boss_invulnerable_dot() +{ + return F1_0/4 - i2f(Difficulty_level)/8; +} int Buddy_gave_hint_count = 5; fix64 Last_time_buddy_gave_hint = 0; @@ -1393,7 +1396,7 @@ int do_boss_weapon_collision(object *robot, object *weapon, vms_vector *collisio vm_vec_sub(&tvec1, collision_point, &robot->pos); vm_vec_normalize_quick(&tvec1); // Note, if BOSS_INVULNERABLE_DOT is close to F1_0 (in magnitude), then should probably use non-quick version. dot = vm_vec_dot(&tvec1, &robot->orient.fvec); - if (dot > Boss_invulnerable_dot) { + if (dot > Boss_invulnerable_dot()) { int new_obj; int segnum;