Player keeps any keys collected on a secret level even if they die on the secret level

This commit is contained in:
Chris Taylor 2017-01-24 18:19:50 +08:00
parent 4b3a34f943
commit 2f4db4a048
2 changed files with 11 additions and 0 deletions

View file

@ -87,6 +87,11 @@ public:
flags |= rhs.flags;
return *this;
}
player_flags &operator|=(const uint32_t &rhs)
{
flags |= rhs;
return *this;
}
player_flags operator|(const player_flags &rhs) const
{
return player_flags(flags | rhs.flags);

View file

@ -1536,6 +1536,12 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
do_cloak_invul_secret_stuff(old_gametime, ret_pl_info);
} else {
get_local_player() = dummy_player;
// Keep keys even if they died on secret level (otherwise game becomes impossible)
// Example: Cameron 'Stryker' Fultz's Area 51
pl_info.powerup_flags |= (plrobj.ctype.player_info.powerup_flags &
(PLAYER_FLAGS_BLUE_KEY |
PLAYER_FLAGS_RED_KEY |
PLAYER_FLAGS_GOLD_KEY));
}
} else
#endif