Skip to content

Commit

Permalink
tr2: fix enemies not looking at Lara
Browse files Browse the repository at this point in the history
Resolves #2080. Regression made in d531d0b.

List of affected enemies:

- bird guardian
- dobermans
- monks
- mice
- sharks
- tigers
- trex
- goons
- Xian swordmen
- Xian spearmen
- yetis
  • Loading branch information
rr- committed Dec 20, 2024
1 parent 2ab543f commit 33d9d15
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 67 deletions.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- added an option to allow disabling the developer console (#2063)
- fixed Lara prioritising throwing a spent flare while mid-air, so to avoid missing ledge grabs (#1989)
- fixed software renderer not applying underwater tint (#2066, regression from 0.7)
- fixed some enemies not looking at Lara (#2080, regression from 0.6)

## [0.7.1](https://github.com/LostArtefacts/TRX/compare/tr2-0.7...tr2-0.7.1) - 2024-12-17
- fixed a crash when selecting the sound option (#2057, regression from 0.6)
Expand Down
18 changes: 9 additions & 9 deletions src/tr2/game/objects/creatures/bandit.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ void Bandit1_Setup(void)
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 24] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 32] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 8 * 4] |= BF_ROT_Y;
}

void Bandit2_Setup(void)
Expand All @@ -52,13 +52,13 @@ void Bandit2_Setup(void)
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 24] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 32] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 8 * 4] |= BF_ROT_Y;
}

void Bandit2B_Setup(void)
Expand All @@ -82,11 +82,11 @@ void Bandit2B_Setup(void)
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 24] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 32] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 8 * 4] |= BF_ROT_Y;
}
6 changes: 3 additions & 3 deletions src/tr2/game/objects/creatures/barracuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ void Barracuda_Setup(void)
obj->pivot_length = 200;

obj->intelligent = 1;
obj->water_creature = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;

g_AnimBones[obj->bone_idx + 24] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
}

void __cdecl Barracuda_Control(const int16_t item_num)
Expand Down
4 changes: 2 additions & 2 deletions src/tr2/game/objects/creatures/big_eel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ void BigEel_Setup(void)

obj->hit_points = BIG_EEL_HITPOINTS;

obj->water_creature = 1;
obj->save_hitpoints = 1;
obj->save_anim = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;
}

void __cdecl BigEel_Control(const int16_t item_num)
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/game/objects/creatures/big_spider.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ void BigSpider_Setup(void)
obj->shadow_size = UNIT_SHADOW / 2;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}

void __cdecl BigSpider_Control(const int16_t item_num)
Expand Down
6 changes: 3 additions & 3 deletions src/tr2/game/objects/creatures/bird.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ void Bird_SetupEagle(void)
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}

void Bird_SetupCrow(void)
Expand All @@ -73,16 +73,16 @@ void Bird_SetupCrow(void)
obj->control = Bird_Control;
obj->collision = Creature_Collision;

obj->shadow_size = UNIT_SHADOW / 2;
obj->hit_points = CROW_HITPOINTS;
obj->radius = BIRD_RADIUS;
obj->shadow_size = UNIT_SHADOW / 2;
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}

void __cdecl Bird_Initialise(const int16_t item_num)
Expand Down
4 changes: 3 additions & 1 deletion src/tr2/game/objects/creatures/bird_guardian.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ void BirdGuardian_Setup(void)
obj->radius = BIRD_GUARDIAN_RADIUS;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 14 * 4] |= BF_ROT_Y;
}

void __cdecl BirdGuardian_Control(const int16_t item_num)
Expand Down
13 changes: 7 additions & 6 deletions src/tr2/game/objects/creatures/cultist.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ void Cultist1_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx] |= BF_ROT_Y;
}
Expand All @@ -59,10 +59,10 @@ void Cultist1A_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx] |= BF_ROT_Y;
}
Expand All @@ -88,10 +88,10 @@ void Cultist1B_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx] |= BF_ROT_Y;
}
Expand All @@ -112,13 +112,13 @@ void Cultist2_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 32] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 8 * 4] |= BF_ROT_Y;
}

void Cultist3_Setup(void)
Expand All @@ -135,10 +135,11 @@ void Cultist3_Setup(void)
obj->hit_points = CULTIST_3_HITPOINTS;
obj->radius = CULTIST_RADIUS;
obj->shadow_size = UNIT_SHADOW / 2;
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}
8 changes: 4 additions & 4 deletions src/tr2/game/objects/creatures/diver.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ void Diver_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->water_creature = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;

g_AnimBones[obj->bone_idx + 40] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 56] |= BF_ROT_Z;
g_AnimBones[obj->bone_idx + 10 * 4] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 14 * 4] |= BF_ROT_Z;
}

void __cdecl Diver_Control(int16_t item_num)
Expand Down
6 changes: 4 additions & 2 deletions src/tr2/game/objects/creatures/dog.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ void Dog_Setup(void)
obj->shadow_size = UNIT_SHADOW / 2;
obj->pivot_length = 300;

obj->save_anim = 1;
obj->intelligent = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->intelligent = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 19 * 4] |= BF_ROT_Y;
}

void __cdecl Dog_Control(const int16_t item_num)
Expand Down
4 changes: 2 additions & 2 deletions src/tr2/game/objects/creatures/dragon.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ void Dragon_SetupFront(void)
obj->pivot_length = 300;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 40] |= BF_ROT_Z;
g_AnimBones[obj->bone_idx + 10 * 4] |= BF_ROT_Z;
}

void Dragon_SetupBack(void)
Expand Down
4 changes: 2 additions & 2 deletions src/tr2/game/objects/creatures/eel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ void Eel_Setup(void)

obj->hit_points = EEL_HITPOINTS;

obj->water_creature = 1;
obj->save_hitpoints = 1;
obj->save_anim = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;
}

void __cdecl Eel_Control(const int16_t item_num)
Expand Down
3 changes: 2 additions & 1 deletion src/tr2/game/objects/creatures/jelly.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ void Jelly_Setup(void)
obj->shadow_size = UNIT_SHADOW / 2;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;
}

void __cdecl Jelly_Control(const int16_t item_num)
Expand Down
8 changes: 5 additions & 3 deletions src/tr2/game/objects/creatures/monk.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ void Monk1_Setup(void)
obj->pivot_length = 0;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 24] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
}

void Monk2_Setup(void)
Expand All @@ -48,8 +48,10 @@ void Monk2_Setup(void)
obj->shadow_size = UNIT_SHADOW / 2;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 6 * 4] |= BF_ROT_Y;
}
4 changes: 3 additions & 1 deletion src/tr2/game/objects/creatures/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ void Mouse_Setup(void)
obj->pivot_length = 50;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 3 * 4] |= BF_ROT_Y;
}

void __cdecl Mouse_Control(const int16_t item_num)
Expand Down
6 changes: 4 additions & 2 deletions src/tr2/game/objects/creatures/shark.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ void Shark_Setup(void)
obj->pivot_length = 200;

obj->intelligent = 1;
obj->water_creature = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
obj->water_creature = 1;

g_AnimBones[obj->bone_idx + 9 * 4] |= BF_ROT_Y;
}

void __cdecl Shark_Control(const int16_t item_num)
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/game/objects/creatures/skidoo_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ void SkidooDriver_Setup(void)
obj->hit_points = 1;

obj->save_position = 1;
obj->save_anim = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}

void __cdecl SkidooDriver_Initialise(const int16_t item_num)
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/game/objects/creatures/spider.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ void Spider_Setup(void)
obj->shadow_size = UNIT_SHADOW / 2;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;
}

void __cdecl Spider_Leap(const int16_t item_num, const int16_t angle)
Expand Down
4 changes: 3 additions & 1 deletion src/tr2/game/objects/creatures/tiger.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ void Tiger_Setup(void)
obj->pivot_length = 200;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 21 * 4] |= BF_ROT_Y;
}

void __cdecl Tiger_Control(const int16_t item_num)
Expand Down
5 changes: 3 additions & 2 deletions src/tr2/game/objects/creatures/trex.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ void TRex_Setup(void)
obj->pivot_length = 1800;

obj->intelligent = 1;
obj->save_anim = 1;
obj->save_position = 1;
obj->save_hitpoints = 1;
obj->save_flags = 1;
obj->save_anim = 1;

g_AnimBones[obj->bone_idx + 40] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 10 * 4] |= BF_ROT_Y;
g_AnimBones[obj->bone_idx + 11 * 4] |= BF_ROT_Y;
}

void __cdecl TRex_Control(const int16_t item_num)
Expand Down
Loading

0 comments on commit 33d9d15

Please sign in to comment.