Added direct native entry points to a larger number of functions.

This commit is contained in:
Christoph Oelckers 2018-12-05 17:34:11 +01:00
parent a846ed391e
commit 6c9d0b166a
17 changed files with 1118 additions and 726 deletions

View file

@ -969,11 +969,6 @@ public:
}
}
double AccuracyFactor()
{
return 1. / (1 << (accuracy * 5 / 100));
}
void ClearInterpolation();
void Move(const DVector3 &vel)
@ -1288,12 +1283,6 @@ public:
return DamageVal == 0 && DamageFunc == nullptr;
}
void RestoreDamage()
{
DamageVal = GetDefault()->DamageVal;
DamageFunc = GetDefault()->DamageFunc;
}
FState *FindState (FName label) const
{
return GetClass()->FindState(1, &label);

View file

@ -63,3 +63,19 @@ inline double AActor::GetBobOffset(double ticfrac) const
return BobSin(FloatBobPhase + level.maptime + ticfrac) * FloatBobStrength;
}
inline double AActor::GetCameraHeight() const
{
return CameraHeight == INT_MIN ? Height / 2 : CameraHeight;
}
inline FDropItem *AActor::GetDropItems() const
{
return GetInfo()->DropItems;
}
inline double AActor::GetGravity() const
{
if (flags & MF_NOGRAVITY) return 0;
return level.gravity * Sector->gravity * Gravity * 0.00125;
}

View file

@ -286,13 +286,6 @@ int GetSpriteIndex(const char * spritename, bool add)
return (lastindex = (int)sprites.Push (temp));
}
DEFINE_ACTION_FUNCTION(AActor, GetSpriteIndex)
{
PARAM_PROLOGUE;
PARAM_NAME(sprt);
ACTION_RETURN_INT(GetSpriteIndex(sprt.GetChars(), false));
}
//==========================================================================
//
// Load alt HUD icons. This is meant to be an override of the item's own settings.
@ -574,13 +567,6 @@ PClassActor *PClassActor::GetReplacement(bool lookskill)
return rep;
}
DEFINE_ACTION_FUNCTION(AActor, GetReplacement)
{
PARAM_PROLOGUE;
PARAM_POINTER(c, PClassActor);
ACTION_RETURN_POINTER(c->GetReplacement());
}
//==========================================================================
//
// PClassActor :: GetReplacee
@ -624,13 +610,6 @@ PClassActor *PClassActor::GetReplacee(bool lookskill)
return rep;
}
DEFINE_ACTION_FUNCTION(AActor, GetReplacee)
{
PARAM_PROLOGUE;
PARAM_POINTER(c, PClassActor);
ACTION_RETURN_POINTER(c->GetReplacee());
}
//==========================================================================
//
// PClassActor :: SetDamageFactor

View file

@ -6039,7 +6039,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
// SoundVolume(int tid, int channel, fixed volume)
{
int chan = args[1];
float volume = ACSToFloat(args[2]);
double volume = ACSToDouble(args[2]);
if (args[0] == 0)
{

View file

@ -904,31 +904,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_CopyFriendliness)
return 0;
}
//==========================================================================
//
// Custom sound functions.
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_StopSound)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(slot);
S_StopSound(self, slot);
return 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_SoundVolume)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(channel);
PARAM_FLOAT(volume);
S_ChangeSoundVolume(self, channel, static_cast<float>(volume));
return 0;
}
//==========================================================================
//
// These come from a time when DECORATE constants did not exist yet and
@ -4931,7 +4906,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckBlock)
// If checking for dropoffs, set the z so we can have maximum flexibility.
// Otherwise, set origin and set it back after testing.
bool checker = false;
int checker = false;
if (flags & CBF_DROPOFF)
{
// Unfortunately, whenever P_CheckMove returned false, that means it could

View file

@ -23,4 +23,8 @@ struct FLineTraceData
ETraceResult HitType;
};
bool P_LineTrace(AActor *t1, DAngle angle, double distance,
DAngle pitch, int flags, double sz, double offsetforward,
double offsetside, FLineTraceData *outdata);
#endif

View file

@ -257,8 +257,8 @@ extern TArray<spechit_t> spechit;
extern TArray<spechit_t> portalhit;
bool P_TestMobjLocation (AActor *mobj);
bool P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL);
int P_TestMobjLocation (AActor *mobj);
int P_TestMobjZ (AActor *mobj, bool quick=true, AActor **pOnmobj = NULL);
bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly = false);
bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, bool actorsonly = false);
AActor *P_CheckOnmobj (AActor *thing);
@ -266,6 +266,7 @@ void P_FakeZMovement (AActor *mo);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL, bool missilecheck = false);
bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags);
bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags = 0);
void P_ApplyTorque(AActor *mo);
@ -358,6 +359,7 @@ void P_TraceBleed (int damage, AActor *target); // random direction version
bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec, const DVector3 &pos, bool checkabove = false, bool alert = true, bool force = false);
struct FRailParams
{
AActor *source = nullptr;
@ -409,6 +411,7 @@ enum
RADF_THRUSTZ = 16,
RADF_OLDRADIUSDAMAGE = 32
};
int P_GetRadiusDamage(AActor *self, AActor *thing, int damage, int distance, int fulldmgdistance, bool oldradiusdmg);
int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
FName damageType, int flags, int fulldamagedistance=0);

View file

@ -112,69 +112,6 @@ TArray<spechit_t> spechit;
TArray<spechit_t> portalhit;
// FCheckPosition requires explicit contstruction and destruction when used in the VM
DEFINE_ACTION_FUNCTION(_FCheckPosition, _Constructor)
{
PARAM_SELF_STRUCT_PROLOGUE(FCheckPosition);
new(self) FCheckPosition;
return 0;
}
DEFINE_ACTION_FUNCTION(_FCheckPosition, _Destructor)
{
PARAM_SELF_STRUCT_PROLOGUE(FCheckPosition);
self->~FCheckPosition();
return 0;
}
DEFINE_ACTION_FUNCTION(_FCheckPosition, ClearLastRipped)
{
PARAM_SELF_STRUCT_PROLOGUE(FCheckPosition);
self->LastRipped.Clear();
return 0;
}
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
DEFINE_FIELD_NAMED_X(FCheckPosition, FCheckPosition, sector, cursector);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorz);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingz);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, dropoffz);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorpic);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorterrain);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floorsector);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingpic);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingsector);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, touchmidtex);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, abovemidtex);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, floatok);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, FromPMove);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, ceilingline);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, stepthing);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, DoRipping);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, portalstep);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, portalgroup);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, PushTime);
DEFINE_FIELD_X(FRailParams, FRailParams, source);
DEFINE_FIELD_X(FRailParams, FRailParams, damage);
DEFINE_FIELD_X(FRailParams, FRailParams, offset_xy);
DEFINE_FIELD_X(FRailParams, FRailParams, offset_z);
DEFINE_FIELD_X(FRailParams, FRailParams, color1);
DEFINE_FIELD_X(FRailParams, FRailParams, color2);
DEFINE_FIELD_X(FRailParams, FRailParams, maxdiff);
DEFINE_FIELD_X(FRailParams, FRailParams, flags);
DEFINE_FIELD_X(FRailParams, FRailParams, puff);
DEFINE_FIELD_X(FRailParams, FRailParams, angleoffset);
DEFINE_FIELD_X(FRailParams, FRailParams, pitchoffset);
DEFINE_FIELD_X(FRailParams, FRailParams, distance);
DEFINE_FIELD_X(FRailParams, FRailParams, duration);
DEFINE_FIELD_X(FRailParams, FRailParams, sparsity);
DEFINE_FIELD_X(FRailParams, FRailParams, drift);
DEFINE_FIELD_X(FRailParams, FRailParams, spawnclass);
DEFINE_FIELD_X(FRailParams, FRailParams, SpiralOffset);
DEFINE_FIELD_X(FRailParams, FRailParams, limit);
//==========================================================================
//
// CanCollideWith
@ -433,13 +370,6 @@ void P_FindFloorCeiling(AActor *actor, int flags)
}
}
DEFINE_ACTION_FUNCTION(AActor, FindFloorCeiling)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(flags);
P_FindFloorCeiling(self, flags);
return 0;
}
// Debug CCMD for checking errors in the MultiBlockLinesIterator (needs to be removed when this code is complete)
CCMD(ffcf)
@ -595,17 +525,6 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi
return true;
}
DEFINE_ACTION_FUNCTION(AActor, TeleportMove)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(telefrag);
PARAM_BOOL(modify);
ACTION_RETURN_BOOL(P_TeleportMove(self, DVector3(x, y, z), telefrag, modify));
}
//==========================================================================
//
// [RH] P_PlayerStartStomp
@ -812,22 +731,6 @@ double P_GetMoveFactor(const AActor *mo, double *frictionp)
return movefactor;
}
DEFINE_ACTION_FUNCTION(AActor, GetFriction)
{
PARAM_SELF_PROLOGUE(AActor);
double friction, movefactor = P_GetMoveFactor(self, &friction);
if (numret > 1)
{
numret = 2;
ret[1].SetFloat(movefactor);
}
if (numret > 0)
{
ret[0].SetFloat(friction);
}
return numret;
}
//==========================================================================
//
// Checks if the line intersects with the actor
@ -1973,23 +1876,6 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, bool actorsonly)
return P_CheckPosition(thing, pos, tm, actorsonly);
}
DEFINE_ACTION_FUNCTION(AActor, CheckPosition)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_BOOL(actorsonly);
PARAM_POINTER(tm, FCheckPosition);
if (tm)
{
ACTION_RETURN_BOOL(P_CheckPosition(self, DVector2(x, y), *tm, actorsonly));
}
else
{
ACTION_RETURN_BOOL(P_CheckPosition(self, DVector2(x, y), actorsonly));
}
}
//----------------------------------------------------------------------------
//
@ -2000,7 +1886,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckPosition)
//
//----------------------------------------------------------------------------
bool P_TestMobjLocation(AActor *mobj)
int P_TestMobjLocation(AActor *mobj)
{
ActorFlags flags;
@ -2019,12 +1905,6 @@ bool P_TestMobjLocation(AActor *mobj)
return false;
}
DEFINE_ACTION_FUNCTION(AActor, TestMobjLocation)
{
PARAM_SELF_PROLOGUE(AActor);
ACTION_RETURN_BOOL(P_TestMobjLocation(self));
}
//=============================================================================
//
// P_CheckOnmobj(AActor *thing)
@ -2035,7 +1915,7 @@ DEFINE_ACTION_FUNCTION(AActor, TestMobjLocation)
AActor *P_CheckOnmobj(AActor *thing)
{
double oldz;
bool good;
int good;
AActor *onmobj;
oldz = thing->Z();
@ -2052,12 +1932,12 @@ AActor *P_CheckOnmobj(AActor *thing)
//
//=============================================================================
bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
{
AActor *onmobj = NULL;
AActor *onmobj = nullptr;
if (pOnmobj) *pOnmobj = nullptr;
if (actor->flags & MF_NOCLIP)
{
if (pOnmobj) *pOnmobj = NULL;
return true;
}
@ -2133,25 +2013,6 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
return onmobj == NULL;
}
DEFINE_ACTION_FUNCTION(AActor, TestMobjZ)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_BOOL(quick);
AActor *on = nullptr;;
bool retv = P_TestMobjZ(self, quick, &on);
if (numret > 1)
{
numret = 2;
ret[1].SetObject(on);
}
if (numret > 0)
{
ret[0].SetInt(retv);
}
return numret;
}
//=============================================================================
//
@ -2384,9 +2245,8 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
else if (thing->Z() < tm.floorz)
{ // [RH] Check to make sure there's nothing in the way for the step up
double savedz = thing->Z();
bool good;
thing->SetZ(tm.floorz);
good = P_TestMobjZ(thing);
auto good = P_TestMobjZ(thing);
thing->SetZ(savedz);
if (!good)
{
@ -2786,24 +2646,6 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
return P_TryMove(thing, pos, dropoff, onfloor, tm, missilecheck);
}
DEFINE_ACTION_FUNCTION(AActor, TryMove)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_INT(dropoff);
PARAM_BOOL(missilecheck);
PARAM_POINTER(tm, FCheckPosition);
if (tm == nullptr)
{
ACTION_RETURN_BOOL(P_TryMove(self, DVector2(x, y), dropoff, nullptr, missilecheck));
}
else
{
ACTION_RETURN_BOOL(P_TryMove(self, DVector2(x, y), dropoff, nullptr, *tm, missilecheck));
}
}
//==========================================================================
//
@ -2812,7 +2654,7 @@ DEFINE_ACTION_FUNCTION(AActor, TryMove)
//
//==========================================================================
static bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags)
bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags)
{
double newz = thing->Z();
@ -2879,7 +2721,7 @@ static bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm,
{ // [RH] Check to make sure there's nothing in the way for the step up
double savedz = thing->Z();
thing->SetZ(newz = tm.floorz);
bool good = P_TestMobjZ(thing);
int good = P_TestMobjZ(thing);
thing->SetZ(savedz);
if (!good)
{
@ -2912,23 +2754,6 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
return P_CheckMove(thing, pos, tm, flags);
}
DEFINE_ACTION_FUNCTION(AActor, CheckMove)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_INT(flags);
PARAM_POINTER(tm, FCheckPosition);
if (tm == nullptr)
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), flags));
}
else
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), *tm, flags));
}
}
//==========================================================================
//
@ -3159,7 +2984,7 @@ void FSlide::SlideTraverse(const DVector2 &start, const DVector2 &end)
{ // [RH] Check to make sure there's nothing in the way for the step up
double savedz = slidemo->Z();
slidemo->SetZ(open.bottom);
bool good = P_TestMobjZ(slidemo);
int good = P_TestMobjZ(slidemo);
slidemo->SetZ(savedz);
if (!good)
{
@ -4503,19 +4328,6 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin
return result->linetarget ? result->pitch : t1->Angles.Pitch;
}
DEFINE_ACTION_FUNCTION(AActor, AimLineAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE(angle);
PARAM_FLOAT(distance);
PARAM_OUTPOINTER(pLineTarget, FTranslatedLineTarget);
PARAM_ANGLE(vrange);
PARAM_INT(flags);
PARAM_OBJECT(target, AActor);
PARAM_OBJECT(friender, AActor);
ACTION_RETURN_FLOAT(P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees);
}
//==========================================================================
//
// Helper stuff for P_LineAttack
@ -4910,29 +4722,6 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
}
}
DEFINE_ACTION_FUNCTION(AActor, LineAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE(angle);
PARAM_FLOAT(distance);
PARAM_ANGLE(pitch);
PARAM_INT(damage);
PARAM_NAME(damageType);
PARAM_CLASS(puffType, AActor);
PARAM_INT(flags);
PARAM_OUTPOINTER(victim, FTranslatedLineTarget);
PARAM_FLOAT(offsetz);
PARAM_FLOAT(offsetforward);
PARAM_FLOAT(offsetside);
int acdmg;
if (puffType == nullptr) puffType = PClass::FindActor("BulletPuff"); // P_LineAttack does not work without a puff to take info from.
auto puff = P_LineAttack(self, angle, distance, pitch, damage, damageType, puffType, flags, victim, &acdmg, offsetz, offsetforward, offsetside);
if (numret > 0) ret[0].SetObject(puff);
if (numret > 1) ret[1].SetInt(acdmg), numret = 2;
return numret;
}
//==========================================================================
//
// P_LineTrace
@ -5063,33 +4852,6 @@ bool P_LineTrace(AActor *t1, DAngle angle, double distance,
return ret;
}
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitActor);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitLine);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitSector);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, Hit3DFloor);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitTexture);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitLocation);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, Distance);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, NumPortals);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LineSide);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LinePart);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, SectorPlane);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitType);
DEFINE_ACTION_FUNCTION(AActor, LineTrace)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE(angle);
PARAM_FLOAT(distance);
PARAM_ANGLE(pitch);
PARAM_INT(flags);
PARAM_FLOAT(offsetz);
PARAM_FLOAT(offsetforward);
PARAM_FLOAT(offsetside);
PARAM_OUTPOINTER(data, FLineTraceData);
ACTION_RETURN_BOOL(P_LineTrace(self,angle,distance,pitch,flags,offsetz,offsetforward,offsetside,data));
}
//==========================================================================
//
// P_LinePickActor
@ -5226,17 +4988,6 @@ void P_TraceBleed(int damage, AActor *target, DAngle angle, DAngle pitch)
P_TraceBleed(damage, target->PosPlusZ(target->Height/2), target, angle, pitch);
}
DEFINE_ACTION_FUNCTION(AActor, TraceBleedAngle)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(damage);
PARAM_FLOAT(angle);
PARAM_FLOAT(pitch);
P_TraceBleed(damage, self, angle, pitch);
return 0;
}
//==========================================================================
//
@ -5284,16 +5035,6 @@ void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff)
P_TraceBleed(damage, t->linetarget->PosPlusZ(t->linetarget->Height/2), t->linetarget, t->angleFromSource, pitch);
}
DEFINE_ACTION_FUNCTION(_FTranslatedLineTarget, TraceBleed)
{
PARAM_SELF_STRUCT_PROLOGUE(FTranslatedLineTarget);
PARAM_INT(damage);
PARAM_OBJECT_NOT_NULL(missile, AActor);
P_TraceBleed(damage, self, missile);
return 0;
}
//==========================================================================
//
@ -5311,18 +5052,6 @@ void P_TraceBleed(int damage, AActor *target)
}
}
DEFINE_ACTION_FUNCTION(AActor, TraceBleed)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(damage);
PARAM_OBJECT(missile, AActor);
if (missile) P_TraceBleed(damage, self, missile);
else P_TraceBleed(damage, self);
return 0;
}
//==========================================================================
//
// [RH] Rail gun stuffage
@ -5597,15 +5326,6 @@ void P_RailAttack(FRailParams *p)
P_DrawRailTrail(source, rail_data.PortalHits, p->color1, p->color2, p->maxdiff, p->flags, p->spawnclass, angle, p->duration, p->sparsity, p->drift, p->SpiralOffset, pitch);
}
DEFINE_ACTION_FUNCTION(AActor, RailAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_POINTER(p, FRailParams);
p->source = self;
P_RailAttack(p);
return 0;
}
//==========================================================================
//
// [RH] P_AimCamera
@ -5957,13 +5677,6 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
return false;
}
DEFINE_ACTION_FUNCTION(AActor, UsePuzzleItem)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(puzznum);
ACTION_RETURN_BOOL(P_UsePuzzleItem(self, puzznum));
}
//==========================================================================
//
// RADIUS ATTACK
@ -5993,7 +5706,7 @@ CUSTOM_CVAR(Float, splashfactor, 1.f, CVAR_SERVERINFO)
// Used by anything without OLDRADIUSDMG flag
//==========================================================================
static double P_GetRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing, int bombdamage, int bombdistance, int fulldamagedistance, bool thingbombsource)
static double GetRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing, int bombdamage, int bombdistance, int fulldamagedistance, bool thingbombsource)
{
// [RH] New code. The bounding box only covers the
// height of the thing and not the height of the map.
@ -6070,7 +5783,7 @@ static double P_GetRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing
// based on XY distance.
//==========================================================================
static int P_GetOldRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing, int bombdamage, int bombdistance, int fulldamagedistance)
static int GetOldRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing, int bombdamage, int bombdistance, int fulldamagedistance)
{
const int ret = fromaction ? 0 : -1; // -1 is specifically for P_RadiusAttack; continue onto another actor.
double dx, dy, dist;
@ -6114,22 +5827,16 @@ static int P_GetOldRadiusDamage(bool fromaction, AActor *bombspot, AActor *thing
// damage and not taking into account any damage reduction.
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, GetRadiusDamage)
int P_GetRadiusDamage(AActor *self, AActor *thing, int damage, int distance, int fulldmgdistance, bool oldradiusdmg)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(thing, AActor);
PARAM_INT(damage);
PARAM_INT(distance);
PARAM_INT(fulldmgdistance);
PARAM_BOOL(oldradiusdmg);
if (!thing)
{
ACTION_RETURN_INT(0);
return 0;
}
else if (thing == self)
{ // No point in calculating falloff in this case since it is the bomb spot.
ACTION_RETURN_INT(damage);
return damage;
}
fulldmgdistance = clamp<int>(fulldmgdistance, 0, distance - 1);
@ -6139,10 +5846,10 @@ DEFINE_ACTION_FUNCTION(AActor, GetRadiusDamage)
distance = damage;
const int newdam = oldradiusdmg
? P_GetOldRadiusDamage(true, self, thing, damage, distance, fulldmgdistance)
: int(P_GetRadiusDamage(true, self, thing, damage, distance, fulldmgdistance, false));
? GetOldRadiusDamage(true, self, thing, damage, distance, fulldmgdistance)
: int(GetRadiusDamage(true, self, thing, damage, distance, fulldmgdistance, false));
ACTION_RETURN_INT(newdam);
return newdam;
}
//==========================================================================
@ -6206,7 +5913,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
// which can make them near impossible to hit with the new code.
if (((flags & RADF_NODAMAGE) || !((bombspot->flags5 | thing->flags5) & MF5_OLDRADIUSDMG)) && !(flags & RADF_OLDRADIUSDAMAGE))
{
double points = P_GetRadiusDamage(false, bombspot, thing, bombdamage, bombdistance, fulldamagedistance, bombsource == thing);
double points = GetRadiusDamage(false, bombspot, thing, bombdamage, bombdistance, fulldamagedistance, bombsource == thing);
double check = int(points) * bombdamage;
// points and bombdamage should be the same sign (the double cast of 'points' is needed to prevent overflows and incorrect values slipping through.)
if ((check > 0 || (check == 0 && bombspot->flags7 & MF7_FORCEZERORADIUSDMG)) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY))
@ -6264,7 +5971,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
else
{
// [RH] Old code just for barrels
int damage = P_GetOldRadiusDamage(false, bombspot, thing, bombdamage, bombdistance, fulldamagedistance);
int damage = GetOldRadiusDamage(false, bombspot, thing, bombdamage, bombdistance, fulldamagedistance);
if (damage < 0)
continue; // Sight check failed.
@ -6281,18 +5988,6 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
return count;
}
DEFINE_ACTION_FUNCTION(AActor, RadiusAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(bombsource, AActor);
PARAM_INT(bombdamage);
PARAM_INT(bombdistance);
PARAM_NAME(damagetype);
PARAM_INT(flags);
PARAM_INT(fulldamagedistance);
ACTION_RETURN_INT(P_RadiusAttack(self, bombsource, bombdamage, bombdistance, damagetype, flags, fulldamagedistance));
}
//==========================================================================
//
// SECTOR HEIGHT CHANGING

View file

@ -345,15 +345,6 @@ void AActor::UnlinkFromWorld (FLinkContext *ctx)
ClearRenderLineList();
}
DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_POINTER(ctx, FLinkContext);
self->UnlinkFromWorld(ctx); // fixme
return 0;
}
//==========================================================================
//
// If the thing is exactly on a line, move it into the sector
@ -564,14 +555,6 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
if (!spawningmapthing) UpdateRenderSectorList();
}
DEFINE_ACTION_FUNCTION(AActor, LinkToWorld)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_POINTER(ctx, FLinkContext);
self->LinkToWorld(ctx);
return 0;
}
void AActor::SetOrigin(double x, double y, double z, bool moving)
{
FLinkContext ctx;
@ -582,17 +565,6 @@ void AActor::SetOrigin(double x, double y, double z, bool moving)
if (!moving) ClearInterpolation();
}
DEFINE_ACTION_FUNCTION(AActor, SetOrigin)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(moving);
self->SetOrigin(x, y, z, moving);
return 0;
}
//===========================================================================
//
// FBlockNode - allows to link actors into multiple blocks in the blockmap
@ -1887,15 +1859,6 @@ AActor *P_RoughMonsterSearch(AActor *mo, int distance, bool onlyseekable, bool f
return P_BlockmapSearch(mo, distance, RoughBlockCheck, (void *)&info);
}
DEFINE_ACTION_FUNCTION(AActor, RoughMonsterSearch)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(distance);
PARAM_BOOL(onlyseekable);
PARAM_BOOL(frontonly);
ACTION_RETURN_OBJECT(P_RoughMonsterSearch(self, distance, onlyseekable, frontonly));
}
//==========================================================================
//
// [RH] LinkToWorldForMapThing

View file

@ -178,179 +178,6 @@ AActor::~AActor ()
// Use Destroy() instead.
}
DEFINE_FIELD(AActor, snext)
DEFINE_FIELD(AActor, player)
DEFINE_FIELD_NAMED(AActor, __Pos, pos)
DEFINE_FIELD_NAMED(AActor, __Pos.X, x)
DEFINE_FIELD_NAMED(AActor, __Pos.Y, y)
DEFINE_FIELD_NAMED(AActor, __Pos.Z, z)
DEFINE_FIELD(AActor, Prev)
DEFINE_FIELD(AActor, SpriteAngle)
DEFINE_FIELD(AActor, SpriteRotation)
DEFINE_FIELD(AActor, VisibleStartAngle)
DEFINE_FIELD(AActor, VisibleStartPitch)
DEFINE_FIELD(AActor, VisibleEndAngle)
DEFINE_FIELD(AActor, VisibleEndPitch)
DEFINE_FIELD_NAMED(AActor, Angles.Yaw, angle)
DEFINE_FIELD_NAMED(AActor, Angles.Pitch, pitch)
DEFINE_FIELD_NAMED(AActor, Angles.Roll, roll)
DEFINE_FIELD(AActor, Vel)
DEFINE_FIELD_NAMED(AActor, Vel.X, velx)
DEFINE_FIELD_NAMED(AActor, Vel.Y, vely)
DEFINE_FIELD_NAMED(AActor, Vel.Z, velz)
DEFINE_FIELD_NAMED(AActor, Vel.X, momx)
DEFINE_FIELD_NAMED(AActor, Vel.Y, momy)
DEFINE_FIELD_NAMED(AActor, Vel.Z, momz)
DEFINE_FIELD(AActor, Speed)
DEFINE_FIELD(AActor, FloatSpeed)
DEFINE_FIELD(AActor, sprite)
DEFINE_FIELD(AActor, frame)
DEFINE_FIELD(AActor, Scale)
DEFINE_FIELD_NAMED(AActor, Scale.X, scalex)
DEFINE_FIELD_NAMED(AActor, Scale.Y, scaley)
DEFINE_FIELD(AActor, RenderStyle)
DEFINE_FIELD(AActor, picnum)
DEFINE_FIELD(AActor, Alpha)
DEFINE_FIELD(AActor, fillcolor)
DEFINE_FIELD_NAMED(AActor, Sector, CurSector) // clashes with type 'sector'.
DEFINE_FIELD(AActor, subsector)
DEFINE_FIELD(AActor, ceilingz)
DEFINE_FIELD(AActor, floorz)
DEFINE_FIELD(AActor, dropoffz)
DEFINE_FIELD(AActor, floorsector)
DEFINE_FIELD(AActor, floorpic)
DEFINE_FIELD(AActor, floorterrain)
DEFINE_FIELD(AActor, ceilingsector)
DEFINE_FIELD(AActor, ceilingpic)
DEFINE_FIELD(AActor, Height)
DEFINE_FIELD(AActor, radius)
DEFINE_FIELD(AActor, renderradius)
DEFINE_FIELD(AActor, projectilepassheight)
DEFINE_FIELD(AActor, tics)
DEFINE_FIELD_NAMED(AActor, state, curstate) // clashes with type 'state'.
DEFINE_FIELD_NAMED(AActor, DamageVal, Damage) // name differs for historic reasons
DEFINE_FIELD(AActor, projectileKickback)
DEFINE_FIELD(AActor, VisibleToTeam)
DEFINE_FIELD(AActor, special1)
DEFINE_FIELD(AActor, special2)
DEFINE_FIELD(AActor, specialf1)
DEFINE_FIELD(AActor, specialf2)
DEFINE_FIELD(AActor, weaponspecial)
DEFINE_FIELD(AActor, health)
DEFINE_FIELD(AActor, movedir)
DEFINE_FIELD(AActor, visdir)
DEFINE_FIELD(AActor, movecount)
DEFINE_FIELD(AActor, strafecount)
DEFINE_FIELD(AActor, target)
DEFINE_FIELD(AActor, master)
DEFINE_FIELD(AActor, tracer)
DEFINE_FIELD(AActor, LastHeard)
DEFINE_FIELD(AActor, lastenemy)
DEFINE_FIELD(AActor, LastLookActor)
DEFINE_FIELD(AActor, reactiontime)
DEFINE_FIELD(AActor, threshold)
DEFINE_FIELD(AActor, DefThreshold)
DEFINE_FIELD(AActor, SpawnPoint)
DEFINE_FIELD(AActor, SpawnAngle)
DEFINE_FIELD(AActor, StartHealth)
DEFINE_FIELD(AActor, WeaveIndexXY)
DEFINE_FIELD(AActor, WeaveIndexZ)
DEFINE_FIELD(AActor, skillrespawncount)
DEFINE_FIELD(AActor, args)
DEFINE_FIELD(AActor, Mass)
DEFINE_FIELD(AActor, special)
DEFINE_FIELD(AActor, tid)
DEFINE_FIELD(AActor, TIDtoHate)
DEFINE_FIELD(AActor, waterlevel)
DEFINE_FIELD(AActor, Score)
DEFINE_FIELD(AActor, accuracy)
DEFINE_FIELD(AActor, stamina)
DEFINE_FIELD(AActor, meleerange)
DEFINE_FIELD(AActor, PainThreshold)
DEFINE_FIELD(AActor, Gravity)
DEFINE_FIELD(AActor, Floorclip)
DEFINE_FIELD(AActor, DamageType)
DEFINE_FIELD(AActor, DamageTypeReceived)
DEFINE_FIELD(AActor, FloatBobPhase)
DEFINE_FIELD(AActor, FloatBobStrength)
DEFINE_FIELD(AActor, RipperLevel)
DEFINE_FIELD(AActor, RipLevelMin)
DEFINE_FIELD(AActor, RipLevelMax)
DEFINE_FIELD(AActor, Species)
DEFINE_FIELD(AActor, alternative)
DEFINE_FIELD(AActor, goal)
DEFINE_FIELD(AActor, MinMissileChance)
DEFINE_FIELD(AActor, LastLookPlayerNumber)
DEFINE_FIELD(AActor, SpawnFlags)
DEFINE_FIELD(AActor, meleethreshold)
DEFINE_FIELD(AActor, maxtargetrange)
DEFINE_FIELD(AActor, bouncefactor)
DEFINE_FIELD(AActor, wallbouncefactor)
DEFINE_FIELD(AActor, bouncecount)
DEFINE_FIELD(AActor, Friction)
DEFINE_FIELD(AActor, FastChaseStrafeCount)
DEFINE_FIELD(AActor, pushfactor)
DEFINE_FIELD(AActor, lastpush)
DEFINE_FIELD(AActor, activationtype)
DEFINE_FIELD(AActor, lastbump)
DEFINE_FIELD(AActor, DesignatedTeam)
DEFINE_FIELD(AActor, BlockingMobj)
DEFINE_FIELD(AActor, BlockingLine)
DEFINE_FIELD(AActor, Blocking3DFloor)
DEFINE_FIELD(AActor, BlockingCeiling)
DEFINE_FIELD(AActor, BlockingFloor)
DEFINE_FIELD(AActor, PoisonDamage)
DEFINE_FIELD(AActor, PoisonDamageType)
DEFINE_FIELD(AActor, PoisonDuration)
DEFINE_FIELD(AActor, PoisonPeriod)
DEFINE_FIELD(AActor, PoisonDamageReceived)
DEFINE_FIELD(AActor, PoisonDamageTypeReceived)
DEFINE_FIELD(AActor, PoisonDurationReceived)
DEFINE_FIELD(AActor, PoisonPeriodReceived)
DEFINE_FIELD(AActor, Poisoner)
DEFINE_FIELD_NAMED(AActor, Inventory, Inv) // clashes with type 'Inventory'.
DEFINE_FIELD(AActor, smokecounter)
DEFINE_FIELD(AActor, FriendPlayer)
DEFINE_FIELD(AActor, Translation)
DEFINE_FIELD(AActor, AttackSound)
DEFINE_FIELD(AActor, DeathSound)
DEFINE_FIELD(AActor, SeeSound)
DEFINE_FIELD(AActor, PainSound)
DEFINE_FIELD(AActor, ActiveSound)
DEFINE_FIELD(AActor, UseSound)
DEFINE_FIELD(AActor, BounceSound)
DEFINE_FIELD(AActor, WallBounceSound)
DEFINE_FIELD(AActor, CrushPainSound)
DEFINE_FIELD(AActor, MaxDropOffHeight)
DEFINE_FIELD(AActor, MaxStepHeight)
DEFINE_FIELD(AActor, PainChance)
DEFINE_FIELD(AActor, PainType)
DEFINE_FIELD(AActor, DeathType)
DEFINE_FIELD(AActor, DamageFactor)
DEFINE_FIELD(AActor, DamageMultiply)
DEFINE_FIELD(AActor, TeleFogSourceType)
DEFINE_FIELD(AActor, TeleFogDestType)
DEFINE_FIELD(AActor, SpawnState)
DEFINE_FIELD(AActor, SeeState)
DEFINE_FIELD(AActor, MeleeState)
DEFINE_FIELD(AActor, MissileState)
DEFINE_FIELD(AActor, ConversationRoot)
DEFINE_FIELD(AActor, Conversation)
DEFINE_FIELD(AActor, DecalGenerator)
DEFINE_FIELD(AActor, fountaincolor)
DEFINE_FIELD(AActor, CameraHeight)
DEFINE_FIELD(AActor, CameraFOV)
DEFINE_FIELD(AActor, RadiusDamageFactor)
DEFINE_FIELD(AActor, SelfDamageFactor)
DEFINE_FIELD(AActor, StealthAlpha)
DEFINE_FIELD(AActor, WoundHealth)
DEFINE_FIELD(AActor, BloodColor)
DEFINE_FIELD(AActor, BloodTranslation)
DEFINE_FIELD(AActor, RenderHidden)
DEFINE_FIELD(AActor, RenderRequired)
DEFINE_FIELD(AActor, friendlyseeblocks)
DEFINE_FIELD(AActor, SpawnTime)
DEFINE_FIELD(AActor, InventoryID)
//==========================================================================
//
@ -7319,23 +7146,6 @@ int AActor::GetGibHealth() const
return -SpawnHealth();
}
double AActor::GetCameraHeight() const
{
return CameraHeight == INT_MIN ? Height / 2 : CameraHeight;
}
FDropItem *AActor::GetDropItems() const
{
return GetInfo()->DropItems;
}
double AActor::GetGravity() const
{
if (flags & MF_NOGRAVITY) return 0;
return level.gravity * Sector->gravity * Gravity * 0.00125;
}
// killough 11/98:
// Whether an object is "sentient" or not. Used for environmental influences.

View file

@ -936,14 +936,6 @@ done:
return res;
}
DEFINE_ACTION_FUNCTION(AActor, CheckSight)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(target, AActor);
PARAM_INT(flags);
ACTION_RETURN_BOOL(P_CheckSight(self, target, flags));
}
ADD_STAT (sight)
{
FString out;

View file

@ -614,16 +614,6 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu
level.found_secrets++;
}
DEFINE_ACTION_FUNCTION(AActor, GiveSecret)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_BOOL(printmessage);
PARAM_BOOL(playsound);
P_GiveSecret(self, printmessage, playsound, -1);
return 0;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret)
{
PARAM_PROLOGUE;

View file

@ -1813,8 +1813,9 @@ void S_RelinkSound (AActor *from, AActor *to)
//
//==========================================================================
bool S_ChangeSoundVolume(AActor *actor, int channel, float volume)
bool S_ChangeSoundVolume(AActor *actor, int channel, double dvolume)
{
float volume = float(dvolume);
// don't let volume get out of bounds
if (volume < 0.0)
volume = 0.0;

View file

@ -307,7 +307,7 @@ bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id);
bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id);
// Change a playing sound's volume
bool S_ChangeSoundVolume(AActor *actor, int channel, float volume);
bool S_ChangeSoundVolume(AActor *actor, int channel, double volume);
// Moves all sounds from one mobj to another
void S_RelinkSound (AActor *from, AActor *to);

View file

@ -592,6 +592,9 @@ struct DirectNativeDesc
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); }
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); }
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); }
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); }
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); }
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12), TP(13)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13)) : Ptr(reinterpret_cast<void*>(func)) { ValidateType<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); VP(13); }
#undef TP
#undef VP

File diff suppressed because it is too large Load diff

View file

@ -764,7 +764,11 @@ class Actor : Thinker native
return level.totaltime - SpawnTime;
}
double AccuracyFactor()
{
return 1. / (1 << (accuracy * 5 / 100));
}
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
@ -773,8 +777,7 @@ class Actor : Thinker native
native Inventory GiveInventoryType(class<Inventory> itemtype);
native void ObtainInventory(Actor other);
native bool UsePuzzleItem(int PuzzleItemType);
native float AccuracyFactor();
action native void SetCamera(Actor cam, bool revert = false);
native bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0);