Added co-op option to remember last used weapon when respawning

This commit is contained in:
Boondorl 2024-03-24 19:40:40 -04:00 committed by Rachael Alexanderson
commit 29a2ca0b13
5 changed files with 19 additions and 3 deletions

View file

@ -5508,6 +5508,7 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag
p->mo = mobj;
mobj->player = p;
state = p->playerstate;
const auto heldWeap = state == PST_REBORN && (dmflags3 & DF3_REMEMBER_LAST_WEAP) ? p->ReadyWeapon : nullptr;
if (state == PST_REBORN || state == PST_ENTER)
{
PlayerReborn (playernum);
@ -5608,7 +5609,7 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag
{ // Special inventory handling for respawning in coop
IFVM(PlayerPawn, FilterCoopRespawnInventory)
{
VMValue params[] = { p->mo, oldactor };
VMValue params[] = { p->mo, oldactor, ((heldWeap == nullptr || (heldWeap->ObjectFlags & OF_EuthanizeMe)) ? nullptr : heldWeap) };
VMCall(func, params, 2, nullptr, 0);
}
}