Skip to content

Commit

Permalink
tr2/creatures/dragon: count dragon kill only once
Browse files Browse the repository at this point in the history
This ensures that the dragon kill is only counted in the statistics
when it is finally defeated rather than after each time it is taken
down.

Resolves LostArtefacts#1771.
  • Loading branch information
lahm86 committed Nov 2, 2024
1 parent 490cdff commit b13106b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
- fixed the game hanging if exited during the level stats, credits, or final stats (#1585)
- 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)

## [0.5](https://github.com/LostArtefacts/TRX/compare/afaf12a...tr2-0.5) - 2024-10-08
- added `/sfx` command
Expand Down
3 changes: 3 additions & 0 deletions docs/tr2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ decompilation process. We recognize that there is much work to be done.
- 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

#### Statistics
- fixed the dragon counting as more than one kill if allowed to revive

#### Visuals

- fixed TGA screenshots crashing the game
Expand Down
3 changes: 2 additions & 1 deletion src/tr2/game/gun/gun_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ void __cdecl Gun_FindTargetPoint(
void __cdecl Gun_HitTarget(
ITEM *const item, const GAME_VECTOR *const hit_pos, const int32_t damage)
{
if (item->hit_points > 0 && item->hit_points <= damage) {
if (item->hit_points > 0 && item->hit_points <= damage
&& item->object_id != O_DRAGON_FRONT) {
g_SaveGame.statistics.kills++;
}
Item_TakeDamage(item, damage, true);
Expand Down
1 change: 1 addition & 0 deletions src/tr2/game/objects/creatures/dragon.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static void M_MarkDragonDead(const ITEM *const dragon_back_item)
const ITEM *const dragon_front_item = Item_Get(dragon_front_item_num);
CREATURE *const creature = dragon_front_item->data;
creature->flags = -1;
g_SaveGame.statistics.kills++;
}

static void M_PushLaraAway(
Expand Down

0 comments on commit b13106b

Please sign in to comment.