- Added 3 new properties and 3 functions to control them.

- Rippers will rip through anything with an equivalent ripper level, or if their level is between or on the min and max ranges.
- If no min or max is defined, it simply checks if the monster's ripper level is lower than the missiles.
- Functions: A_SetRipperLevel(int level), A_SetRipMin(int min), A_SetRipMax(int max)
- Properties: RipperLevel, RipLevelMin, and RipLevelMax.
- RipperLevel: Applicable to monsters and projectiles.
- RipLevelMin and RipLevelMax are only useful on monsters.
- By default, all are 0.
This commit is contained in:
MajorCooke 2014-12-30 19:59:31 -06:00
parent b5d0c5c357
commit 4ddfd0f46a
7 changed files with 97 additions and 2 deletions

View file

@ -985,6 +985,9 @@ public:
FNameNoInit DeathType;
const PClass *TeleFogSourceType;
const PClass *TeleFogDestType;
int RipperLevel;
int RipLevelMin;
int RipLevelMax;
FState *SpawnState;
FState *SeeState;

View file

@ -1207,7 +1207,17 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
{
return true;
}
if (tm.DoRipping && !(thing->flags5 & MF5_DONTRIP))
// Rippers will rip through anything with an equivalent ripper level,
// or if the missile's ripper level is within the min/max range,
// or if there's no min/max range and the missile's ripper level is
// >= the monster's, then let 'er rip!
bool ripmin = (thing->RipLevelMin != 0) ? true : false;
bool ripmax = (thing->RipLevelMax != 0) ? true : false;
if ((tm.DoRipping && !(thing->flags5 & MF5_DONTRIP)) &&
((!(ripmin) && !(ripmax) && (thing->RipperLevel <= tm.thing->RipperLevel)) ||
((thing->RipperLevel == tm.thing->RipperLevel) ||
(thing->RipLevelMin <= tm.thing->RipperLevel) &&
(thing->RipLevelMax >= tm.thing->RipperLevel))))
{
if (!(tm.thing->flags6 & MF6_NOBOSSRIP) || !(thing->flags2 & MF2_BOSS))
{

View file

@ -338,6 +338,13 @@ void AActor::Serialize (FArchive &arc)
arc << TeleFogSourceType
<< TeleFogDestType;
}
if (SaveVersion >= 4518)
{
arc << RipperLevel
<< RipLevelMin
<< RipLevelMax;
}
{
FString tagstr;
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;

View file

@ -5613,3 +5613,45 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
self->TeleFogDestType = temp;
}
}
//===========================================================================
//
// A_SetRipperLevel(int level)
//
// Sets the ripper level/requirement of the calling actor.
// Also sets the minimum and maximum levels to rip through.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel)
{
ACTION_PARAM_START(1);
ACTION_PARAM_INT(level, 0);
self->RipperLevel = level;
}
//===========================================================================
//
// A_SetRipMin(int min)
//
// Sets the ripper level/requirement of the calling actor.
// Also sets the minimum and maximum levels to rip through.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin)
{
ACTION_PARAM_START(1);
ACTION_PARAM_INT(min, 1);
self->RipLevelMin = min;
}
//===========================================================================
//
// A_SetRipMin(int min)
//
// Sets the ripper level/requirement of the calling actor.
// Also sets the minimum and maximum levels to rip through.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
{
ACTION_PARAM_START(1);
ACTION_PARAM_INT(max, 1);
self->RipLevelMax = max;
}

View file

@ -1436,6 +1436,33 @@ DEFINE_PROPERTY(telefogdesttype, S, Actor)
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(ripperlevel, I, Actor)
{
PROP_INT_PARM(id, 0);
defaults->RipperLevel = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(riplevelmin, I, Actor)
{
PROP_INT_PARM(id, 0);
defaults->RipLevelMin = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(riplevelmax, I, Actor)
{
PROP_INT_PARM(id, 0);
defaults->RipLevelMax = id;
}
//==========================================================================
//
// Special inventory properties

View file

@ -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 4517
#define SAVEVER 4518
#define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)

View file

@ -28,6 +28,9 @@ ACTOR Actor native //: Thinker
DeathType Normal
TeleFogSourceType "TeleportFog"
TeleFogDestType "TeleportFog"
RipperLevel 0
RipLevelMin 0
RipLevelMax 0
// Variables for the expression evaluator
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion
@ -321,6 +324,9 @@ ACTOR Actor native //: Thinker
action native A_TakeFromSiblings(class<Inventory> itemtype, int amount = 0);
action native A_SetTeleFog(name oldpos, name newpos);
action native A_SwapTeleFog();
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);
action native A_CheckSightOrRange(float distance, state label);
action native A_CheckRange(float distance, state label);