From f0eccb9d1541ea1fefcc82cdd02a0b7b2dc73fbe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Aug 2014 10:08:49 +0200 Subject: [PATCH] - BlueShadow's submission for keeping the max save amount of BasicArmorPickups around when picking up armor bonuses. --- src/g_shared/a_armor.cpp | 8 ++++++++ src/g_shared/a_pickups.h | 1 + src/p_acs.cpp | 4 ++++ src/version.h | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 6b90a6a78..a745197c2 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -25,6 +25,11 @@ void ABasicArmor::Serialize (FArchive &arc) { Super::Serialize (arc); arc << SavePercent << BonusCount << MaxAbsorb << MaxFullAbsorb << AbsorbCount << ArmorType; + + if (SaveVersion >= 4511) + { + arc << ActualSaveAmount; + } } //=========================================================================== @@ -69,6 +74,7 @@ AInventory *ABasicArmor::CreateCopy (AActor *other) copy->Icon = Icon; copy->BonusCount = BonusCount; copy->ArmorType = ArmorType; + copy->ActualSaveAmount = ActualSaveAmount; GoAwayAndDie (); return copy; } @@ -268,6 +274,7 @@ bool ABasicArmorPickup::Use (bool pickup) armor->MaxAbsorb = MaxAbsorb; armor->MaxFullAbsorb = MaxFullAbsorb; armor->ArmorType = this->GetClass()->TypeName; + armor->ActualSaveAmount = SaveAmount; return true; } @@ -360,6 +367,7 @@ bool ABasicArmorBonus::Use (bool pickup) armor->MaxAbsorb = MaxAbsorb; armor->ArmorType = this->GetClass()->TypeName; armor->MaxFullAbsorb = MaxFullAbsorb; + armor->ActualSaveAmount = MaxSaveAmount; } armor->Amount = MIN(armor->Amount + saveAmount, MaxSaveAmount + armor->BonusCount); diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 22d1e009f..72548776a 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -423,6 +423,7 @@ public: int MaxFullAbsorb; int BonusCount; FNameNoInit ArmorType; + int ActualSaveAmount; }; // BasicArmorPickup replaces the armor you have. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 1646ab7b7..e0967d400 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -128,6 +128,7 @@ enum ARMORINFO_SAVEPERCENT, ARMORINFO_MAXABSORB, ARMORINFO_MAXFULLABSORB, + ARMORINFO_ACTUALSAVEAMOUNT, }; struct CallReturn @@ -4858,6 +4859,9 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const case ARMORINFO_MAXFULLABSORB: return equippedarmor->MaxFullAbsorb; + case ARMORINFO_ACTUALSAVEAMOUNT: + return equippedarmor->ActualSaveAmount; + default: return 0; } diff --git a/src/version.h b/src/version.h index 6d24c3fe8..af376938c 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4510 +#define SAVEVER 4511 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)