Skip to content

Commit

Permalink
Added direct native entry points to a larger number of functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Dec 5, 2018
1 parent a846ed3 commit 6c9d0b1
Show file tree
Hide file tree
Showing 17 changed files with 1,112 additions and 720 deletions.
11 changes: 0 additions & 11 deletions src/actor.h
Expand Up @@ -969,11 +969,6 @@ class AActor : public DThinker
}
}

double AccuracyFactor()
{
return 1. / (1 << (accuracy * 5 / 100));
}

void ClearInterpolation();

void Move(const DVector3 &vel)
Expand Down Expand Up @@ -1288,12 +1283,6 @@ class AActor : public DThinker
return DamageVal == 0 && DamageFunc == nullptr;
}

void RestoreDamage()
{
DamageVal = GetDefault()->DamageVal;
DamageFunc = GetDefault()->DamageFunc;
}

FState *FindState (FName label) const
{
return GetClass()->FindState(1, &label);
Expand Down
16 changes: 16 additions & 0 deletions src/actorinlines.h
Expand Up @@ -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;
}
21 changes: 0 additions & 21 deletions src/info.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/p_acs.cpp
Expand Up @@ -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)
{
Expand Down
27 changes: 1 addition & 26 deletions src/p_actionfunctions.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/p_linetracedata.h
Expand Up @@ -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
7 changes: 5 additions & 2 deletions src/p_local.h
Expand Up @@ -257,15 +257,16 @@ 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);
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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 6c9d0b1

Please sign in to comment.