From 824fa1a557978d6b43a3297c0485c8a275da4ec8 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 25 Nov 2006 04:47:42 +0000 Subject: [PATCH] - Fixed: The backpack didn't give extra ammo in baby and nightmare modes. SVN r387 (trunk) --- docs/rh-log.txt | 1 + src/g_shared/a_pickups.cpp | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e5513148b..452c97bff 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ November 24, 2006 +- Fixed: The backpack didn't give extra ammo in baby and nightmare modes. - Fixed: When P_SpawnPlayer() calls DObject::PointerSubstitution() to redirect player pointers, it affects the bodyque too. That meant that in multiplayer games, once the bodyque filled up, anybody was in danger of diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index f7cee0d47..9ad552be8 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -1920,10 +1920,19 @@ AInventory *ABackpack::CreateCopy (AActor *other) ((AAmmo *)GetDefaultByType (type))->BackpackAmount > 0) { AAmmo *ammo = static_cast(other->FindInventory (type)); + int amount = static_cast(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) { // The player did not have the ammo. Add it. ammo = static_cast(Spawn (type, 0, 0, 0, NO_REPLACE)); - ammo->Amount = bDepleted ? 0 : ammo->BackpackAmount; + ammo->Amount = bDepleted ? 0 : amount; ammo->MaxAmount = ammo->BackpackMaxAmount; ammo->AttachToOwner (other); } @@ -1935,7 +1944,7 @@ AInventory *ABackpack::CreateCopy (AActor *other) } if (!bDepleted && ammo->Amount < ammo->MaxAmount) { - ammo->Amount += static_cast(ammo->GetDefault())->BackpackAmount; + ammo->Amount += amount; if (ammo->Amount > ammo->MaxAmount) { ammo->Amount = ammo->MaxAmount; @@ -1969,7 +1978,16 @@ bool ABackpack::HandlePickup (AInventory *item) { if (probe->Amount < probe->MaxAmount) { - probe->Amount += static_cast(probe->GetDefault())->BackpackAmount; + int amount = static_cast(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) { probe->Amount = probe->MaxAmount;