Skip to content

Commit

Permalink
Implemented 428 / 133 / Thing_Destroy(tid, reserved, sectortag)
Browse files Browse the repository at this point in the history
There are conflicting implementations between ZDoom and Hexen, and Eternity chooses the Hexen one where the thing is always gibbed regardless of second arg. It does use the ZDoom extension from the third arg however, the optional sector tag.
  • Loading branch information
ioan-chera committed Feb 24, 2016
1 parent 367d6c4 commit 44b706d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/ev_actions.cpp
Expand Up @@ -3124,5 +3124,17 @@ DEFINE_ACTION(EV_ActionDamageThingEx)
instance->args[0]);
}

//
// EV_ActionThingDestroy
//
// Implements Thing_Destroy(tid, reserved, sectortag)
// * ExtraData: 428
// * Hexen: 133
//
DEFINE_ACTION(EV_ActionThingDestroy)
{
return EV_ThingDestroy(instance->args[0], instance->args[2]);
}

// EOF

1 change: 1 addition & 0 deletions source/ev_actions.h
Expand Up @@ -205,6 +205,7 @@ DECLARE_ACTION(EV_ActionThrustThing);
DECLARE_ACTION(EV_ActionThrustThingZ);
DECLARE_ACTION(EV_ActionDamageThing);
DECLARE_ACTION(EV_ActionDamageThingEx); // Thing_Damage
DECLARE_ACTION(EV_ActionThingDestroy);
DECLARE_ACTION(EV_ActionParamPlatPerpetualRaise);
DECLARE_ACTION(EV_ActionParamPlatStop);
DECLARE_ACTION(EV_ActionParamPlatDWUS);
Expand Down
3 changes: 3 additions & 0 deletions source/ev_bindings.cpp
Expand Up @@ -1054,6 +1054,7 @@ PARAMLINE(ThrustThing);
PARAMLINE(ThrustThingZ);
PARAMLINE(DamageThing);
PARAMLINE(DamageThingEx); // Thing_Damage essentially
PARAMLINE(ThingDestroy);
PARAMLINE(ParamPlatPerpetualRaise);
PARAMLINE(ParamPlatStop);
PARAMLINE(ParamPlatDWUS);
Expand Down Expand Up @@ -1417,6 +1418,7 @@ ev_binding_t DOOMBindings[] =
LINESPECNAMED(425, ThrustThingZ, "ThrustThingZ")
LINESPECNAMED(426, DamageThing, "DamageThing")
LINESPECNAMED(427, DamageThingEx, "Thing_Damage")
LINESPECNAMED(428, ThingDestroy, "Thing_Destroy")
};

const size_t DOOMBindingsLen = earrlen(DOOMBindings);
Expand Down Expand Up @@ -1537,6 +1539,7 @@ ev_binding_t HexenBindings[] =
LINESPECNAMED(128, ThrustThingZ, "ThrustThingZ")
LINESPECNAMED(130, ThingActivate, "Thing_Activate")
LINESPECNAMED(131, ThingDeactivate, "Thing_Deactivate")
LINESPECNAMED(133, ThingDestroy, "Thing_Destroy")
LINESPECNAMED(134, ThingProjectile, "Thing_Projectile")
LINESPECNAMED(135, ThingSpawn, "Thing_Spawn")
LINESPECNAMED(136, ThingProjectileGravity, "Thing_ProjectileGravity")
Expand Down
1 change: 1 addition & 0 deletions source/p_spec.h
Expand Up @@ -1408,6 +1408,7 @@ int EV_ThingStop(Mobj *actor, int tid);
int EV_ThrustThing(Mobj *actor, int side, int byteangle, int speed, int tid);
int EV_ThrustThingZ(Mobj *actor, int tid, int speed, bool upDown, bool setAdd);
int EV_DamageThing(Mobj *actor, int damage, int mod, int tid);
int EV_ThingDestroy(int tid, int sectortag);


////////////////////////////////////////////////////////////////
Expand Down
22 changes: 22 additions & 0 deletions source/p_things.cpp
Expand Up @@ -28,6 +28,7 @@

#include "doomstat.h"
#include "d_gi.h"
#include "d_mod.h"
#include "ev_specials.h"
#include "p_inter.h"
#include "p_mobj.h"
Expand Down Expand Up @@ -377,6 +378,27 @@ int EV_DamageThing(Mobj *actor, int damage, int mod, int tid)
return success;
}

//
// EV_ThingDestroy
//
// Implements Thing_Destroy(tid, reserved, sectortag)
//
int EV_ThingDestroy(int tid, int sectortag)
{
Mobj *mobj = nullptr;
int success = 0;
while((mobj = P_FindMobjFromTID(tid, mobj, nullptr)))
{
if(mobj->flags & MF_SHOOTABLE &&
(!sectortag || mobj->subsector->sector->tag == sectortag))
{
P_DamageMobj(mobj, nullptr, nullptr, 10000, MOD_UNKNOWN);
success = 1;
}
}
return success;
}

//=============================================================================
//
// LevelActionThinker
Expand Down

0 comments on commit 44b706d

Please sign in to comment.