- Finally implemented code to keep some or all of your inventory intact when
respawning in coop. Now the new inventory code should finally be complete. :-) - Fixed: PROP_Inventory_PickupMessage was improperly defined for non-VC++ compilation. SVN r197 (trunk)
This commit is contained in:
parent
1bd6ac028b
commit
c87e2252ed
16 changed files with 231 additions and 77 deletions
|
|
@ -1374,27 +1374,18 @@ void G_DoReborn (int playernum, bool freshbot)
|
|||
{
|
||||
// respawn at the start
|
||||
int i;
|
||||
AInventory *oldInv;
|
||||
|
||||
// first disassociate the corpse
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
oldInv = players[playernum].mo->Inventory;
|
||||
players[playernum].mo->Inventory = NULL;
|
||||
G_QueueBody (players[playernum].mo);
|
||||
players[playernum].mo->player = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldInv = NULL;
|
||||
}
|
||||
|
||||
// spawn at random spot if in death match
|
||||
if (deathmatch)
|
||||
{
|
||||
G_DeathMatchSpawnPlayer (playernum);
|
||||
if (players[playernum].mo == NULL)
|
||||
i = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1434,40 +1425,6 @@ void G_DoReborn (int playernum, bool freshbot)
|
|||
}
|
||||
P_SpawnPlayer (&playerstarts[playernum]);
|
||||
}
|
||||
|
||||
// Cooperative net-play, retain keys, weapons, and some ammo,
|
||||
// but throw the other inventory items away.
|
||||
if (!freshbot)
|
||||
{
|
||||
AInventory *probe = oldInv;
|
||||
|
||||
while (probe != NULL)
|
||||
{
|
||||
AInventory *next = probe->Inventory;
|
||||
if (probe->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
// Keep weapons
|
||||
}
|
||||
else if (probe->IsKindOf (RUNTIME_CLASS(AKey)))
|
||||
{
|
||||
// Keep keys
|
||||
}
|
||||
else if (probe->IsKindOf (RUNTIME_CLASS(AAmmo)))
|
||||
{
|
||||
// Take away some ammo
|
||||
if (probe->Amount > 0)
|
||||
{
|
||||
probe->Amount = MAX(1, probe->Amount / 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Eliminate it
|
||||
probe->Destroy ();
|
||||
}
|
||||
probe = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue