diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 381269a9b..aac863aa2 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ -June 2, 2009 +June 5, 2009 (Changes by Graf Zahl) +- Added Gez's GetArmorType submission + +June 2, 2009 - Swapped snes_spc out for the full Game Music Emu library. June 2, 2009 (Changes by Graf Zahl) diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 47c15536b..61605f86f 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -22,7 +22,7 @@ IMPLEMENT_CLASS (AHexenArmor) void ABasicArmor::Serialize (FArchive &arc) { Super::Serialize (arc); - arc << SavePercent << BonusCount << MaxAbsorb << MaxFullAbsorb << AbsorbCount; + arc << SavePercent << BonusCount << MaxAbsorb << MaxFullAbsorb << AbsorbCount << ArmorType; } //=========================================================================== @@ -77,6 +77,7 @@ AInventory *ABasicArmor::CreateCopy (AActor *other) copy->MaxAmount = MaxAmount; copy->Icon = Icon; copy->BonusCount = BonusCount; + copy->ArmorType = ArmorType; GoAwayAndDie (); return copy; } @@ -237,6 +238,7 @@ bool ABasicArmorPickup::Use (bool pickup) armor->Icon = Icon; armor->MaxAbsorb = MaxAbsorb; armor->MaxFullAbsorb = MaxFullAbsorb; + armor->ArmorType = this->GetClass()->TypeName; return true; } @@ -320,6 +322,7 @@ bool ABasicArmorBonus::Use (bool pickup) armor->Icon = Icon; armor->SavePercent = SavePercent; armor->MaxAbsorb = MaxAbsorb; + armor->ArmorType = this->GetClass()->TypeName; armor->MaxFullAbsorb = MaxFullAbsorb; } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 620db6549..bea7be533 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -379,6 +379,7 @@ public: int MaxAbsorb; int MaxFullAbsorb; int BonusCount; + FNameNoInit ArmorType; }; // BasicArmorPickup replaces the armor you have. diff --git a/src/namedef.h b/src/namedef.h index bb8f9e177..ee6f4f207 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -101,6 +101,9 @@ xx(ArtiSuperHealth) xx(MedicalKit) xx(MedPatch) +// Armor +xx(BasicArmor) + // The Wings of Wrath xx(ArtiFly) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index f02a2f5e1..93aa5bb07 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -72,6 +72,8 @@ #include "m_png.h" #include "p_setup.h" +#include "g_shared/a_pickups.h" + extern FILE *Logfile; FRandom pr_acs ("ACS"); @@ -2799,6 +2801,7 @@ enum EACSFunctions ACSF_GetAirSupply, ACSF_SetAirSupply, ACSF_SetSkyScrollSpeed, + ACSF_GetArmorType, }; int DLevelScript::SideFromID(int id, int side) @@ -2942,6 +2945,21 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) return 1; } + case ACSF_GetArmorType: + { + if (args[1] < 0 || args[1] >= MAXPLAYERS || !playeringame[args[1]]) + { + return 0; + } + else + { + FName p(FBehavior::StaticLookupString(args[0])); + ABasicArmor * armor = (ABasicArmor *) players[args[1]].mo->FindInventory(NAME_BasicArmor); + if (armor->ArmorType == p) return 1; + } + return 0; + } + default: break; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index aad3b29ba..157dcde53 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -524,6 +524,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) DoJumpIfInventory(self->target, PUSH_PARAMINFO); } +//========================================================================== +// +// State jump function +// +//========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) +{ + ACTION_PARAM_START(3); + ACTION_PARAM_NAME(Type, 0); + ACTION_PARAM_STATE(JumpOffset, 1); + + ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains! + + ABasicArmor * armor = (ABasicArmor *) self->FindInventory(NAME_BasicArmor); + + if (armor && armor->ArmorType == Type) + ACTION_JUMP(JumpOffset); +} + //========================================================================== // // Parameterized version of A_Explode diff --git a/src/version.h b/src/version.h index 999d2446a..b2a16d8c5 100644 --- a/src/version.h +++ b/src/version.h @@ -75,7 +75,7 @@ // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 1619 +#define MINSAVEVER 1636 #if SVN_REVISION_NUMBER < MINSAVEVER // Never write a savegame with a version lower than what we need diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 4dbe55477..42aea63f6 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -175,6 +175,7 @@ ACTOR Actor native //: Thinker action native A_JumpIfHealthLower(int health, state label); action native A_JumpIfCloser(float distance, state label); action native A_JumpIfInventory(class itemtype, int itemamount, state label); + action native A_JumpIfArmorType(string Type, state label); action native A_GiveInventory(class itemtype, int amount = 0); action native A_TakeInventory(class itemtype, int amount = 0); action native A_SpawnItem(class itemtype, float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false);