mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- Added a function to get the actor's age in ticks.
This commit is contained in:
parent
a6dbfcf9c2
commit
56f76a141e
3 changed files with 21 additions and 0 deletions
|
@ -1035,6 +1035,8 @@ public:
|
|||
|
||||
// When was this actor spawned? (relative to the current level)
|
||||
int GetLevelSpawnTime() const;
|
||||
// How many ticks passed since this actor was spawned?
|
||||
int GetAge() const;
|
||||
|
||||
// info for drawing
|
||||
// NOTE: The first member variable *must* be snext.
|
||||
|
|
|
@ -8085,6 +8085,24 @@ DEFINE_ACTION_FUNCTION(AActor, GetLevelSpawnTime)
|
|||
ACTION_RETURN_INT(self->GetLevelSpawnTime());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// AActor :: GetAge
|
||||
//
|
||||
// Returns the number of ticks passed since this actor was spawned.
|
||||
//
|
||||
//==========================================================================
|
||||
int AActor::GetAge() const
|
||||
{
|
||||
return level.totaltime - SpawnTime;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, GetAge)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
ACTION_RETURN_INT(self->GetAge());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROP A_RestoreSpecialPosition
|
||||
|
|
|
@ -710,6 +710,7 @@ class Actor : Thinker native
|
|||
native clearscope double GetCameraHeight() const;
|
||||
native clearscope double GetGravity() const;
|
||||
native clearscope int GetLevelSpawnTime() const;
|
||||
native clearscope int GetAge() const;
|
||||
|
||||
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
||||
native void AddInventory(Inventory inv);
|
||||
|
|
Loading…
Reference in a new issue