mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- added 'player.flechettetype' property so that the appropriate flechette type can be set per player class.
- bumped savegame version for flechette type changes. SVN r3085 (trunk)
This commit is contained in:
parent
2b0262d111
commit
e90b86acce
9 changed files with 57 additions and 42 deletions
|
@ -137,6 +137,7 @@ public:
|
|||
int SpawnMask;
|
||||
FNameNoInit MorphWeapon;
|
||||
fixed_t AttackZOffset; // attack height, relative to player center
|
||||
const PClass *FlechetteType;
|
||||
|
||||
// [CW] Fades for when you are being damaged.
|
||||
PalEntry DamageFade;
|
||||
|
|
|
@ -455,6 +455,8 @@ CCMD (drop)
|
|||
}
|
||||
}
|
||||
|
||||
const PClass *GetFlechetteType(AActor *other);
|
||||
|
||||
CCMD (useflechette)
|
||||
{ // Select from one of arti_poisonbag1-3, whichever the player has
|
||||
static const ENamedName bagnames[3] =
|
||||
|
@ -463,22 +465,26 @@ CCMD (useflechette)
|
|||
NAME_ArtiPoisonBag2,
|
||||
NAME_ArtiPoisonBag3
|
||||
};
|
||||
int i, j;
|
||||
|
||||
if (who == NULL)
|
||||
return;
|
||||
|
||||
if (who->IsKindOf (PClass::FindClass (NAME_ClericPlayer)))
|
||||
i = 0;
|
||||
else if (who->IsKindOf (PClass::FindClass (NAME_MagePlayer)))
|
||||
i = 1;
|
||||
else
|
||||
i = 2;
|
||||
|
||||
for (j = 0; j < 3; ++j)
|
||||
const PClass *type = GetFlechetteType(who);
|
||||
if (type != NULL)
|
||||
{
|
||||
AInventory *item;
|
||||
if ( (item = who->FindInventory (bagnames[(i+j)%3])) )
|
||||
if ( (item = who->FindInventory (type) ))
|
||||
{
|
||||
SendItemUse = item;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The default flechette could not be found. Try all 3 types then.
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
AInventory *item;
|
||||
if ( (item = who->FindInventory (bagnames[j])) )
|
||||
{
|
||||
SendItemUse = item;
|
||||
break;
|
||||
|
|
|
@ -141,6 +141,27 @@ bool AArtiPoisonBag3::Use (bool pickup)
|
|||
return false;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// GetFlechetteType
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
const PClass *GetFlechetteType(AActor *other)
|
||||
{
|
||||
const PClass *spawntype = NULL;
|
||||
if (other->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
||||
{
|
||||
spawntype = static_cast<APlayerPawn*>(other)->FlechetteType;
|
||||
}
|
||||
if (spawntype == NULL)
|
||||
{
|
||||
// default fallback if nothing valid defined.
|
||||
spawntype = RUNTIME_CLASS(AArtiPoisonBag3);
|
||||
}
|
||||
return spawntype;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// AArtiPoisonBag :: HandlePickup
|
||||
|
@ -155,21 +176,7 @@ bool AArtiPoisonBag::HandlePickup (AInventory *item)
|
|||
return Super::HandlePickup (item);
|
||||
}
|
||||
|
||||
bool matched;
|
||||
|
||||
if (Owner->IsKindOf (PClass::FindClass(NAME_ClericPlayer)))
|
||||
{
|
||||
matched = (GetClass() == RUNTIME_CLASS(AArtiPoisonBag1));
|
||||
}
|
||||
else if (Owner->IsKindOf (PClass::FindClass(NAME_MagePlayer)))
|
||||
{
|
||||
matched = (GetClass() == RUNTIME_CLASS(AArtiPoisonBag2));
|
||||
}
|
||||
else
|
||||
{
|
||||
matched = (GetClass() == RUNTIME_CLASS(AArtiPoisonBag3));
|
||||
}
|
||||
if (matched)
|
||||
if (GetClass() == GetFlechetteType(Owner))
|
||||
{
|
||||
if (Amount < MaxAmount)
|
||||
{
|
||||
|
@ -204,20 +211,8 @@ AInventory *AArtiPoisonBag::CreateCopy (AActor *other)
|
|||
}
|
||||
|
||||
AInventory *copy;
|
||||
const PClass *spawntype;
|
||||
|
||||
if (other->IsKindOf (PClass::FindClass(NAME_ClericPlayer)))
|
||||
{
|
||||
spawntype = RUNTIME_CLASS(AArtiPoisonBag1);
|
||||
}
|
||||
else if (other->IsKindOf (PClass::FindClass(NAME_MagePlayer)))
|
||||
{
|
||||
spawntype = RUNTIME_CLASS(AArtiPoisonBag2);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawntype = RUNTIME_CLASS(AArtiPoisonBag3);
|
||||
}
|
||||
const PClass *spawntype = GetFlechetteType(other);
|
||||
copy = static_cast<AInventory *>(Spawn (spawntype, 0, 0, 0, NO_REPLACE));
|
||||
copy->Amount = Amount;
|
||||
copy->MaxAmount = MaxAmount;
|
||||
|
|
|
@ -432,7 +432,8 @@ void APlayerPawn::Serialize (FArchive &arc)
|
|||
<< InvSel
|
||||
<< MorphWeapon
|
||||
<< DamageFade
|
||||
<< PlayerFlags;
|
||||
<< PlayerFlags
|
||||
<< FlechetteType;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -601,11 +601,11 @@ DEFINE_PROPERTY(renderstyle, S, Actor)
|
|||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
static const char * renderstyles[]={
|
||||
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD", "SHADED", "SHADOW", NULL};
|
||||
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD","SHADED", NULL};
|
||||
|
||||
static const int renderstyle_values[]={
|
||||
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
|
||||
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded, STYLE_Shadow};
|
||||
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded};
|
||||
|
||||
// make this work for old style decorations, too.
|
||||
if (!strnicmp(str, "style_", 6)) str+=6;
|
||||
|
@ -2070,6 +2070,15 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, morphweapon, S, PlayerPawn)
|
|||
defaults->MorphWeapon = FName(z);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_CLASS_PROPERTY_PREFIX(player, flechettetype, S, PlayerPawn)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
defaults->FlechetteType = FindClassTentative(str, "ArtiPoisonBag");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
// SAVESIG should match SAVEVER.
|
||||
|
||||
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
||||
#define MINSAVEVER 3030
|
||||
#define MINSAVEVER 3085
|
||||
|
||||
#if SVN_REVISION_NUMBER < MINSAVEVER
|
||||
// If we don't know the current revision write something very high to ensure that
|
||||
|
|
|
@ -28,6 +28,7 @@ ACTOR ClericPlayer : PlayerPawn
|
|||
Player.WeaponSlot 2, CWeapStaff
|
||||
Player.WeaponSlot 3, CWeapFlame
|
||||
Player.WeaponSlot 4, CWeapWraithverge
|
||||
Player.FlechetteType "ArtiPoisonBag1"
|
||||
|
||||
Player.ColorRange 146, 163
|
||||
Player.Colorset 0, "Blue", 146, 163, 161
|
||||
|
|
|
@ -30,6 +30,7 @@ ACTOR MagePlayer : PlayerPawn
|
|||
Player.WeaponSlot 2, MWeapFrost
|
||||
Player.WeaponSlot 3, MWeapLightning
|
||||
Player.WeaponSlot 4, MWeapBloodscourge
|
||||
Player.FlechetteType "ArtiPoisonBag2"
|
||||
|
||||
Player.ColorRange 146, 163
|
||||
Player.Colorset 0, "Blue", 146, 163, 161
|
||||
|
|
|
@ -28,6 +28,7 @@ Actor PlayerPawn : Actor native
|
|||
Player.SoundClass "player"
|
||||
Player.DamageScreenColor "ff 00 00"
|
||||
Player.MugShotMaxHealth 0
|
||||
Player.FlechetteType "ArtiPoisonBag3"
|
||||
}
|
||||
|
||||
Actor PlayerChunk : PlayerPawn native
|
||||
|
|
Loading…
Reference in a new issue