mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +00:00
- Added Gez's GetArmorType submission
SVN r1636 (trunk)
This commit is contained in:
parent
9d4c87c18f
commit
8c3a816428
8 changed files with 51 additions and 3 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,6 +379,7 @@ public:
|
|||
int MaxAbsorb;
|
||||
int MaxFullAbsorb;
|
||||
int BonusCount;
|
||||
FNameNoInit ArmorType;
|
||||
};
|
||||
|
||||
// BasicArmorPickup replaces the armor you have.
|
||||
|
|
|
@ -101,6 +101,9 @@ xx(ArtiSuperHealth)
|
|||
xx(MedicalKit)
|
||||
xx(MedPatch)
|
||||
|
||||
// Armor
|
||||
xx(BasicArmor)
|
||||
|
||||
// The Wings of Wrath
|
||||
xx(ArtiFly)
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Inventory> itemtype, int itemamount, state label);
|
||||
action native A_JumpIfArmorType(string Type, state label);
|
||||
action native A_GiveInventory(class<Inventory> itemtype, int amount = 0);
|
||||
action native A_TakeInventory(class<Inventory> itemtype, int amount = 0);
|
||||
action native A_SpawnItem(class<Actor> itemtype, float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false);
|
||||
|
|
Loading…
Reference in a new issue