This commit is contained in:
Christoph Oelckers 2014-10-05 18:49:48 +02:00
commit 9fe2857dc1
14 changed files with 339 additions and 117 deletions

View File

@ -109,6 +109,9 @@ Note: All <bool> fields default to false unless mentioned otherwise.
clipmidtex = <bool>; // Line's mid textures are clipped to floor and ceiling.
wrapmidtex = <bool>; // Line's mid textures are wrapped.
midtex3d = <bool>; // Actors can walk on mid texture.
midtex3dimpassible = <bool>;// Used in conjuction with midtex3d - causes the mid
// texture to behave like an impassible line (projectiles
// pass through it).
checkswitchrange = <bool>; // Switches can only be activated when vertically reachable.
blockprojectiles = <bool>; // Line blocks all projectiles
blockuse = <bool>; // Line blocks all use actions

View File

@ -56,6 +56,13 @@ AActor *COPY_AAPTR(AActor *origin, int selector)
case AAPTR_TRACER: return origin->tracer;
case AAPTR_FRIENDPLAYER:
return origin->FriendPlayer ? AAPTR_RESOLVE_PLAYERNUM(origin->FriendPlayer - 1) : NULL;
case AAPTR_GET_LINETARGET:
{
AActor *gettarget = NULL;
P_BulletSlope(origin, &gettarget);
return gettarget;
}
}
}

View File

@ -36,12 +36,13 @@ enum AAPTR
AAPTR_PLAYER8 = 0x2000,
AAPTR_FRIENDPLAYER = 0x4000,
AAPTR_GET_LINETARGET = 0x8000,
AAPTR_PLAYER_SELECTORS =
AAPTR_PLAYER_GETTARGET|AAPTR_PLAYER_GETCONVERSATION,
AAPTR_GENERAL_SELECTORS =
AAPTR_TARGET|AAPTR_MASTER|AAPTR_TRACER|AAPTR_FRIENDPLAYER,
AAPTR_TARGET|AAPTR_MASTER|AAPTR_TRACER|AAPTR_FRIENDPLAYER|AAPTR_GET_LINETARGET,
AAPTR_STATIC_SELECTORS =
AAPTR_PLAYER1|AAPTR_PLAYER2|AAPTR_PLAYER3|AAPTR_PLAYER4|

View File

@ -162,6 +162,7 @@ enum ELineFlags
ML_BLOCKUSE = 0x02000000, // blocks all use actions through this line
ML_BLOCKSIGHT = 0x04000000, // blocks monster line of sight
ML_BLOCKHITSCAN = 0x08000000, // blocks hitscan attacks
ML_3DMIDTEX_IMPASS = 0x10000000, // [TP] if 3D midtex, behaves like a height-restricted ML_BLOCKING
};

View File

@ -299,6 +299,7 @@ xx(ACS_NamedExecuteWithResult)
xx(CallACS)
xx(Sqrt)
xx(CheckClass)
xx(IsPointerEqual)
// Various actor names which are used internally
xx(MapSpot)
@ -419,6 +420,7 @@ xx(Passuse)
xx(Repeatspecial)
xx(Conversation)
xx(Locknumber)
xx(Midtex3dimpassible)
xx(Playercross)
xx(Playeruse)

View File

@ -258,6 +258,13 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &open, bool restrict)
{
// [TP] Impassible-like 3dmidtextures do not block missiles
if ((linedef->flags & ML_3DMIDTEX_IMPASS)
&& (thing->flags & MF_MISSILE || thing->BounceFlags & BOUNCE_MBF))
{
return false;
}
fixed_t tt, tb;
open.abovemidtex = false;

View File

@ -4373,6 +4373,8 @@ enum EACSFunctions
ACSF_GetArmorInfo,
ACSF_DropInventory,
ACSF_PickActor,
ACSF_IsPointerEqual,
ACSF_CanRaiseActor,
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
@ -5630,6 +5632,42 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
}
break;
case ACSF_IsPointerEqual:
{
int tid1 = 0, tid2 = 0;
switch (argCount)
{
case 4: tid2 = args[3];
case 3: tid1 = args[2];
}
actor = SingleActorFromTID(tid1, activator);
AActor * actor2 = tid2 == tid1 ? actor : SingleActorFromTID(tid2, activator);
return COPY_AAPTR(actor, args[0]) == COPY_AAPTR(actor2, args[1]);
}
break;
case ACSF_CanRaiseActor:
if (argCount >= 1) {
if (args[0] == 0) {
actor = SingleActorFromTID(args[0], activator);
if (actor != NULL) {
return P_Thing_CanRaise(actor);
}
}
FActorIterator iterator(args[0]);
bool canraiseall = false;
while ((actor = iterator.Next()))
{
canraiseall = !P_Thing_CanRaise(actor) | canraiseall;
}
return !canraiseall;
}
break;
default:
break;
}

View File

@ -171,6 +171,7 @@ int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type);
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add, bool setbob);
void P_RemoveThing(AActor * actor);
bool P_Thing_Raise(AActor *thing);
bool P_Thing_CanRaise(AActor *thing);
const PClass *P_GetSpawnableType(int spawnnum);
//

View File

@ -445,6 +445,40 @@ bool P_Thing_Raise(AActor *thing)
return true;
}
bool P_Thing_CanRaise(AActor *thing)
{
FState * RaiseState = thing->GetRaiseState();
if (RaiseState == NULL)
{
return false;
}
AActor *info = thing->GetDefault();
// Check against real height and radius
int oldflags = thing->flags;
fixed_t oldheight = thing->height;
fixed_t oldradius = thing->radius;
thing->flags |= MF_SOLID;
thing->height = info->height;
thing->radius = info->radius;
bool check = P_CheckPosition (thing, thing->x, thing->y);
// Restore checked properties
thing->flags = oldflags;
thing->radius = oldradius;
thing->height = oldheight;
if (!check)
{
return false;
}
return true;
}
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add, bool setbob)
{
if (actor != NULL)

View File

@ -1030,11 +1030,16 @@ public:
Flag(ld->flags, ML_BLOCKHITSCAN, key);
continue;
// [Dusk] lock number
// [TP] Locks the special with a key
case NAME_Locknumber:
ld->locknumber = CheckInt(key);
continue;
// [TP] Causes a 3d midtex to behave like an impassible line
case NAME_Midtex3dimpassible:
Flag(ld->flags, ML_3DMIDTEX_IMPASS, key);
continue;
default:
break;
}
@ -1081,6 +1086,10 @@ public:
{
ld->args[1] = -FName(arg1str);
}
if ((ld->flags & ML_3DMIDTEX_IMPASS) && !(ld->flags & ML_3DMIDTEX)) // [TP]
{
Printf ("Line %d has midtex3dimpassible without midtex3d.\n", index);
}
}
//===========================================================================

View File

@ -3671,65 +3671,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag)
}
}
//===========================================================================
//
// A_RemoveMaster
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_RemoveMaster)
{
if (self->master != NULL)
{
P_RemoveThing(self->master);
}
}
//===========================================================================
//
// A_RemoveChildren
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren)
{
TThinkerIterator<AActor> it;
AActor *mo;
ACTION_PARAM_START(1);
ACTION_PARAM_BOOL(removeall,0);
while ((mo = it.Next()) != NULL)
{
if (mo->master == self && (mo->health <= 0 || removeall))
{
P_RemoveThing(mo);
}
}
}
//===========================================================================
//
// A_RemoveSiblings
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings)
{
TThinkerIterator<AActor> it;
AActor *mo;
ACTION_PARAM_START(1);
ACTION_PARAM_BOOL(removeall,0);
if (self->master != NULL)
{
while ((mo = it.Next()) != NULL)
{
if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
{
P_RemoveThing(mo);
}
}
}
}
//===========================================================================
//
// A_RaiseMaster
@ -4889,6 +4830,7 @@ enum DMSS
DMSS_FOILINVUL = 1,
DMSS_AFFECTARMOR = 2,
DMSS_KILL = 4,
DMSS_NOFACTOR = 8,
};
static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageType, int flags)
@ -4903,15 +4845,29 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy
}
if (flags & DMSS_AFFECTARMOR)
{
P_DamageMobj(dmgtarget, self, self, amount, DamageType, DMG_FOILINVUL);
if (flags & DMSS_NOFACTOR)
{
P_DamageMobj(dmgtarget, self, self, amount, DamageType, DMG_FOILINVUL | DMG_NO_FACTOR);
}
else
{
P_DamageMobj(dmgtarget, self, self, amount, DamageType, DMG_FOILINVUL);
}
}
else
{
if (flags & DMSS_NOFACTOR)
{
P_DamageMobj(dmgtarget, self, self, amount, DamageType, DMG_FOILINVUL | DMG_NO_ARMOR | DMG_NO_FACTOR);
}
//[MC] DMG_FOILINVUL is needed for making the damage occur on the actor.
else
{
P_DamageMobj(dmgtarget, self, self, amount, DamageType, DMG_FOILINVUL | DMG_NO_ARMOR);
}
}
}
}
else if (amount < 0)
{
amount = -amount;
@ -5063,7 +5019,6 @@ static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags
}
//===========================================================================
//
// A_KillTarget(damagetype, int flags)
@ -5149,17 +5104,52 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillSiblings)
}
}
//===========================================================================
//
// DoRemove
//
//===========================================================================
enum RMVF_flags
{
RMVF_MISSILES = 1 << 0,
RMVF_NOMONSTERS = 1 << 1,
RMVF_MISC = 1 << 2,
RMVF_EVERYTHING = 1 << 3,
};
static void DoRemove(AActor *removetarget, int flags)
{
if ((flags & RMVF_EVERYTHING))
{
P_RemoveThing(removetarget);
}
if ((flags & RMVF_MISC) && !((removetarget->flags3 & MF3_ISMONSTER) && (removetarget->flags & MF_MISSILE)))
{
P_RemoveThing(removetarget);
}
if ((removetarget->flags3 & MF3_ISMONSTER) && !(flags & RMVF_NOMONSTERS))
{
P_RemoveThing(removetarget);
}
if ((removetarget->flags & MF_MISSILE) && (flags & RMVF_MISSILES))
{
P_RemoveThing(removetarget);
}
}
//===========================================================================
//
// A_RemoveTarget
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTarget)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTarget)
{
if (self->target != NULL)
ACTION_PARAM_START(1);
ACTION_PARAM_INT(flags, 0);
if (self->master != NULL)
{
P_RemoveThing(self->target);
DoRemove(self->target, flags);
}
}
@ -5168,10 +5158,94 @@ DEFINE_ACTION_FUNCTION(AActor, A_RemoveTarget)
// A_RemoveTracer
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTracer)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTracer)
{
if (self->tracer != NULL)
ACTION_PARAM_START(1);
ACTION_PARAM_INT(flags, 0);
if (self->master != NULL)
{
P_RemoveThing(self->tracer);
DoRemove(self->tracer, flags);
}
}
//===========================================================================
//
// A_RemoveMaster
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveMaster)
{
ACTION_PARAM_START(1);
ACTION_PARAM_INT(flags, 0);
if (self->master != NULL)
{
DoRemove(self->master, flags);
}
}
//===========================================================================
//
// A_RemoveChildren
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren)
{
TThinkerIterator<AActor> it;
AActor *mo;
ACTION_PARAM_START(2);
ACTION_PARAM_BOOL(removeall, 0);
ACTION_PARAM_INT(flags, 1);
while ((mo = it.Next()) != NULL)
{
if (mo->master == self && (mo->health <= 0 || removeall))
{
DoRemove(mo, flags);
}
}
}
//===========================================================================
//
// A_RemoveSiblings
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings)
{
TThinkerIterator<AActor> it;
AActor *mo;
ACTION_PARAM_START(2);
ACTION_PARAM_BOOL(removeall, 0);
ACTION_PARAM_INT(flags, 1);
if (self->master != NULL)
{
while ((mo = it.Next()) != NULL)
{
if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
{
DoRemove(mo, flags);
}
}
}
}
//===========================================================================
//
// A_Remove
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(removee, 0);
ACTION_PARAM_INT(flags, 1);
AActor *reference = COPY_AAPTR(self, removee);
if (reference != NULL)
{
DoRemove(reference, flags);
}
}

View File

@ -261,3 +261,36 @@ class FxGlobalFunctionCall_CheckClass : public FxGlobalFunctionCall
};
GLOBALFUNCTION_ADDER(CheckClass);
//==========================================================================
//
// Function: ispointerequal
//
//==========================================================================
class FxGlobalFunctionCall_IsPointerEqual : public FxGlobalFunctionCall
{
public:
GLOBALFUNCTION_DEFINE(IsPointerEqual);
FxExpression *Resolve(FCompileContext& ctx)
{
CHECKRESOLVED();
if (!ResolveArgs(ctx, 2, 2, true))
return NULL;
ValueType = VAL_Int;
return this;
}
ExpVal EvalExpression(AActor *self)
{
ExpVal ret;
ret.Type = VAL_Int;
ret.Int = COPY_AAPTR(self, (*ArgList)[0]->EvalExpression(self).GetInt()) == COPY_AAPTR(self, (*ArgList)[1]->EvalExpression(self).GetInt());
return ret;
}
};
GLOBALFUNCTION_ADDER(IsPointerEqual);

View File

@ -234,9 +234,9 @@ ACTOR Actor native //: Thinker
action native A_ChangeFlag(string flagname, bool value);
action native A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
action native A_JumpIf(bool expression, state label);
action native A_RemoveMaster();
action native A_RemoveChildren(bool removeall = false);
action native A_RemoveSiblings(bool removeall = false);
action native A_RemoveMaster(int flags = 0);
action native A_RemoveChildren(bool removeall = false, int flags = 0);
action native A_RemoveSiblings(bool removeall = false, int flags = 0);
action native A_KillMaster(name damagetype = "none", int flags = 0);
action native A_KillChildren(name damagetype = "none", int flags = 0);
action native A_KillSiblings(name damagetype = "none", int flags = 0);
@ -309,8 +309,9 @@ ACTOR Actor native //: Thinker
action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0);
action native A_KillTarget(name damagetype = "none", int flags = 0);
action native A_KillTracer(name damagetype = "none", int flags = 0);
action native A_RemoveTarget();
action native A_RemoveTracer();
action native A_RemoveTarget(int flags = 0);
action native A_RemoveTracer(int flags = 0);
action native A_Remove(int removee, int flags = 0);
action native A_CheckSightOrRange(float distance, state label);
action native A_CheckRange(float distance, state label);

View File

@ -279,24 +279,25 @@ Const Int BLOCKF_USE = 128;
// Pointer constants, bitfield-enabled
Const Int AAPTR_DEFAULT = 0;
Const Int AAPTR_NULL = 1;
Const Int AAPTR_TARGET = 2;
Const Int AAPTR_MASTER = 4;
Const Int AAPTR_TRACER = 8;
Const Int AAPTR_NULL = 0x1;
Const Int AAPTR_TARGET = 0x2;
Const Int AAPTR_MASTER = 0x4;
Const Int AAPTR_TRACER = 0x8;
Const Int AAPTR_PLAYER_GETTARGET = 16;
Const Int AAPTR_PLAYER_GETCONVERSATION = 32;
Const Int AAPTR_PLAYER_GETTARGET = 0x10;
Const Int AAPTR_PLAYER_GETCONVERSATION = 0x20;
Const Int AAPTR_PLAYER1 = 64;
Const Int AAPTR_PLAYER2 = 128;
Const Int AAPTR_PLAYER3 = 256;
Const Int AAPTR_PLAYER4 = 512;
Const Int AAPTR_PLAYER5 = 1024;
Const Int AAPTR_PLAYER6 = 2048;
Const Int AAPTR_PLAYER7 = 4096;
Const Int AAPTR_PLAYER8 = 8192;
Const Int AAPTR_PLAYER1 = 0x40;
Const Int AAPTR_PLAYER2 = 0x80;
Const Int AAPTR_PLAYER3 = 0x100;
Const Int AAPTR_PLAYER4 = 0x200;
Const Int AAPTR_PLAYER5 = 0x400;
Const Int AAPTR_PLAYER6 = 0x800;
Const Int AAPTR_PLAYER7 = 0x1000;
Const Int AAPTR_PLAYER8 = 0x2000;
Const Int AAPTR_FRIENDPLAYER = 16384;
Const Int AAPTR_FRIENDPLAYER = 0x4000;
Const Int AAPTR_LINETARGET = 0x8000;
// Pointer operation flags
@ -374,12 +375,22 @@ const int KILS_NOMONSTERS = 4;
const int DMSS_FOILINVUL = 1;
const int DMSS_AFFECTARMOR = 2;
const int DMSS_KILL = 4;
const int DMSS_NOFACTOR = 8;
// Flags for A_AlertMonsters
const int AMF_TARGETEMITTER = 1;
const int AMF_TARGETNONPLAYER = 2;
const int AMF_EMITFROMTARGET = 4;
// Flags for A_Remove*
enum
{
RMVF_MISSILES = 1 << 0,
RMVF_NOMONSTERS = 1 << 1,
RMVF_MISC = 1 << 2,
RMVF_EVERYTHING = 1 << 3
};
// This is only here to provide one global variable for testing.
native int testglobalvar;