Merge branch 'master' of https://github.com/rheit/zdoom into z_osx_refactor

This commit is contained in:
alexey.lysiuk 2014-12-31 11:17:45 +02:00
commit 2900f03fa1
7 changed files with 114 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

@ -887,6 +887,20 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
return true;
}
//==========================================================================
//
// Isolated to keep the code readable and fix the logic
//
//==========================================================================
static bool CheckRipLevel(AActor *victim, AActor *projectile)
{
if (victim->RipLevelMin > 0 && projectile->RipperLevel < victim->RipLevelMin) return false;
if (victim->RipLevelMax > 0 && projectile->RipperLevel > victim->RipLevelMax) return false;
return true;
}
//==========================================================================
//
// PIT_CheckThing
@ -1207,7 +1221,8 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
{
return true;
}
if (tm.DoRipping && !(thing->flags5 & MF5_DONTRIP))
if ((tm.DoRipping && !(thing->flags5 & MF5_DONTRIP)) && CheckRipLevel(thing, tm.thing))
{
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,45 @@ DEFINE_PROPERTY(telefogdesttype, S, Actor)
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(ripperlevel, I, Actor)
{
PROP_INT_PARM(id, 0);
if (id < 0)
{
I_Error ("RipperLevel must not be negative");
}
defaults->RipperLevel = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(riplevelmin, I, Actor)
{
PROP_INT_PARM(id, 0);
if (id < 0)
{
I_Error ("RipLevelMin must not be negative");
}
defaults->RipLevelMin = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(riplevelmax, I, Actor)
{
PROP_INT_PARM(id, 0);
if (id < 0)
{
I_Error ("RipLevelMax must not be negative");
}
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);