Skip to content

Commit 5dae482

Browse files
committed
Fix logic mistake that caused player corpse removal regardless of death flags.
1 parent 52921e7 commit 5dae482

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

engine/openbor.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39390,15 +39390,25 @@ void player_die()
3939039390
player[playerindex].spawnhealth = self->modeldata.health;
3939139391
player[playerindex].spawnmp = self->modeldata.mp;
3939239392

39393-
if(self->modeldata.death_config_flags & ~(DEATH_CONFIG_REMOVE_CORPSE_AIR | DEATH_CONFIG_REMOVE_CORPSE_GROUND))
39394-
{
39395-
kill_entity(self, KILL_ENTITY_TRIGGER_PLAYER_DEATH);
39396-
}
39397-
else
39398-
{
39393+
/*
39394+
* Handle the body. If any corpse flags
39395+
* are set, we leave entity on screen
39396+
* and make it inert. Otherwise we can
39397+
* just run kill function to remove.
39398+
*
39399+
* REMOVE_CORPSE_* flags refer to how
39400+
* the live entity is removed from the
39401+
* game while leaving a corpse behind.
39402+
*/
39403+
39404+
const e_death_config_flags leave_corpse = DEATH_CONFIG_REMOVE_CORPSE_AIR | DEATH_CONFIG_REMOVE_CORPSE_GROUND;
39405+
39406+
if (self->modeldata.death_config_flags & leave_corpse) {
3939939407
self->think = NULL;
3940039408
self->takeaction = NULL;
39401-
self->death_state |= DEATH_STATE_CORPSE;
39409+
self->death_state |= DEATH_STATE_CORPSE;
39410+
} else {
39411+
kill_entity(self, KILL_ENTITY_TRIGGER_PLAYER_DEATH);
3940239412
}
3940339413

3940439414
if(player[playerindex].lives <= 0)

0 commit comments

Comments
 (0)