tr2/objects/grenade: test target item intelligence and status

This ensures grenades that hit inactive or unintelligent creatures have
no effect on the item's hit points. We continue to explode the grenade
in the creature's position though, as it's still a collidable entity.

Resolves #1561.
This commit is contained in:
lahm86 2024-11-02 15:38:02 +00:00
parent b13106b9c1
commit fc4fe988dd
3 changed files with 8 additions and 3 deletions

View file

@ -54,6 +54,7 @@
- fixed the console not being drawn during credits (#1802)
- fixed grenades launched at too slow speeds (#1760, regression from 0.3)
- fixed the dragon counting as more than one kill if allowed to revive (#1771)
- fixed a crash when firing grenades at Xian guards in statue form (#1561)
## [0.5](https://github.com/LostArtefacts/TRX/compare/afaf12a...tr2-0.5) - 2024-10-08
- added `/sfx` command

View file

@ -33,6 +33,7 @@ decompilation process. We recognize that there is much work to be done.
- fixed grenades counting as double kills in the game statistics
- fixed the ammo counter being hidden while a demo plays in NG+
- fixed the game hanging if exited during the level stats, credits, or final stats
- fixed a crash when firing grenades at Xian guards in statue form
#### Statistics
- fixed the dragon counting as more than one kill if allowed to revive

View file

@ -117,10 +117,13 @@ void __cdecl Grenade_Control(int16_t item_num)
if (target_item->object_id == O_WINDOW_1) {
SmashWindow(target_item_num);
} else {
// XXX: missing check if obj is intelligent?
Gun_HitTarget(target_item, NULL, 30);
explode = true;
if (!target_obj->intelligent || target_item->status != IS_ACTIVE) {
continue;
}
Gun_HitTarget(target_item, NULL, 30);
g_SaveGame.statistics.hits++;
if (target_item->hit_points <= 0) {