mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- Fixed: The backpack didn't give extra ammo in baby and nightmare modes.
SVN r387 (trunk)
This commit is contained in:
parent
4b7b95663e
commit
824fa1a557
2 changed files with 22 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
November 24, 2006
|
November 24, 2006
|
||||||
|
- Fixed: The backpack didn't give extra ammo in baby and nightmare modes.
|
||||||
- Fixed: When P_SpawnPlayer() calls DObject::PointerSubstitution() to
|
- Fixed: When P_SpawnPlayer() calls DObject::PointerSubstitution() to
|
||||||
redirect player pointers, it affects the bodyque too. That meant that in
|
redirect player pointers, it affects the bodyque too. That meant that in
|
||||||
multiplayer games, once the bodyque filled up, anybody was in danger of
|
multiplayer games, once the bodyque filled up, anybody was in danger of
|
||||||
|
|
|
@ -1920,10 +1920,19 @@ AInventory *ABackpack::CreateCopy (AActor *other)
|
||||||
((AAmmo *)GetDefaultByType (type))->BackpackAmount > 0)
|
((AAmmo *)GetDefaultByType (type))->BackpackAmount > 0)
|
||||||
{
|
{
|
||||||
AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory (type));
|
AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory (type));
|
||||||
|
int amount = static_cast<AAmmo *>(GetDefaultByType(type))->BackpackAmount;
|
||||||
|
// extra ammo in baby mode and nightmare mode
|
||||||
|
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
|
||||||
|
{
|
||||||
|
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
|
||||||
|
amount <<= 1;
|
||||||
|
else
|
||||||
|
amount += amount >> 1;
|
||||||
|
}
|
||||||
if (ammo == NULL)
|
if (ammo == NULL)
|
||||||
{ // The player did not have the ammo. Add it.
|
{ // The player did not have the ammo. Add it.
|
||||||
ammo = static_cast<AAmmo *>(Spawn (type, 0, 0, 0, NO_REPLACE));
|
ammo = static_cast<AAmmo *>(Spawn (type, 0, 0, 0, NO_REPLACE));
|
||||||
ammo->Amount = bDepleted ? 0 : ammo->BackpackAmount;
|
ammo->Amount = bDepleted ? 0 : amount;
|
||||||
ammo->MaxAmount = ammo->BackpackMaxAmount;
|
ammo->MaxAmount = ammo->BackpackMaxAmount;
|
||||||
ammo->AttachToOwner (other);
|
ammo->AttachToOwner (other);
|
||||||
}
|
}
|
||||||
|
@ -1935,7 +1944,7 @@ AInventory *ABackpack::CreateCopy (AActor *other)
|
||||||
}
|
}
|
||||||
if (!bDepleted && ammo->Amount < ammo->MaxAmount)
|
if (!bDepleted && ammo->Amount < ammo->MaxAmount)
|
||||||
{
|
{
|
||||||
ammo->Amount += static_cast<AAmmo*>(ammo->GetDefault())->BackpackAmount;
|
ammo->Amount += amount;
|
||||||
if (ammo->Amount > ammo->MaxAmount)
|
if (ammo->Amount > ammo->MaxAmount)
|
||||||
{
|
{
|
||||||
ammo->Amount = ammo->MaxAmount;
|
ammo->Amount = ammo->MaxAmount;
|
||||||
|
@ -1969,7 +1978,16 @@ bool ABackpack::HandlePickup (AInventory *item)
|
||||||
{
|
{
|
||||||
if (probe->Amount < probe->MaxAmount)
|
if (probe->Amount < probe->MaxAmount)
|
||||||
{
|
{
|
||||||
probe->Amount += static_cast<AAmmo*>(probe->GetDefault())->BackpackAmount;
|
int amount = static_cast<AAmmo*>(probe->GetDefault())->BackpackAmount;
|
||||||
|
// extra ammo in baby mode and nightmare mode
|
||||||
|
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
|
||||||
|
{
|
||||||
|
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
|
||||||
|
amount <<= 1;
|
||||||
|
else
|
||||||
|
amount += amount >> 1;
|
||||||
|
}
|
||||||
|
probe->Amount += amount;
|
||||||
if (probe->Amount > probe->MaxAmount)
|
if (probe->Amount > probe->MaxAmount)
|
||||||
{
|
{
|
||||||
probe->Amount = probe->MaxAmount;
|
probe->Amount = probe->MaxAmount;
|
||||||
|
|
Loading…
Reference in a new issue