Skip to content

Commit

Permalink
bug: do not animate weapon when player is dead
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 17, 2023
1 parent d7525b8 commit 1db7de3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!-- Bugs -->
<!-- ------ -->
<!-- on death do not animate sword -->
<!-- on death do not drop player items -->
<!-- ------ -->
<!-- -->
Expand Down
4 changes: 2 additions & 2 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ void Game::place_player(void)
d->wake("");
}
if (0) {
level->thing_new("troll_stone", point(x + 2, y));
level->thing_new("troll_fire", point(x + 2, y + 2));
level->thing_new("exit1", point(x - 3, y + 2));
level->thing_new("gnome_rock", point(x + 2, y + 1));
level->thing_new("tentacleye", point(x + 1, y + 1));
Expand All @@ -409,8 +411,6 @@ void Game::place_player(void)
level->thing_new("centipede", point(x - 2, y + 1));
level->thing_new("demon_fire", point(x + 4, y));
level->thing_new("ogre", point(x + 4, y));
level->thing_new("troll_stone", point(x + 2, y));
level->thing_new("troll_fire", point(x + 2, y + 2));
level->thing_new("ettin", point(x + 2, y));
level->thing_new("cthulite", point(x + 2, y));
level->thing_new("cyclops", point(x + 2, y));
Expand Down
23 changes: 21 additions & 2 deletions src/thing_anim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,29 @@ void Thing::animate_choose_tile(Tilemap *tmap, std::vector< Tilep > *tiles, bool
//
if (gfx_pixelart_anim_synced_with_owner()) {
if (owner) {
if (owner->is_dead || owner->is_sleeping) {
//
// If this is a sword animation, stop it moving once the owner is dead.
//
if (owner->is_dead_or_dying()) {
#ifdef DEBUG_ANIM
if (debug || is_debug_type()) {
con("Animate: no owner is sleeping");
}
#endif
//
// Even when dead, the bodyparts needs to fall down.
//
if (owner->is_player()) {
if (! is_player_bodypart()) {
return;
}
}
}

if (owner->is_sleeping) {
#ifdef DEBUG_ANIM
if (debug || is_debug_type()) {
con("Animate: no owner is dead or sleeping");
con("Animate: no owner is sleeping");
}
#endif
return;
Expand Down

0 comments on commit 1db7de3

Please sign in to comment.