mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- moved AInventory::DoRespawn fully to the script side.
This commit is contained in:
parent
3922f817fb
commit
bc1990b6d7
5 changed files with 31 additions and 32 deletions
|
@ -225,35 +225,6 @@ AInventory *AInventory::NextInv ()
|
|||
return item;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: DoRespawn
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AInventory::DoRespawn ()
|
||||
{
|
||||
if (SpawnPointClass != NULL)
|
||||
{
|
||||
AActor *spot = NULL;
|
||||
DSpotState *state = DSpotState::GetSpotState();
|
||||
|
||||
if (state != NULL) spot = state->GetRandomSpot(SpawnPointClass);
|
||||
if (spot != NULL)
|
||||
{
|
||||
SetOrigin (spot->Pos(), false);
|
||||
SetZ(floorz);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, DoRespawn)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AInventory);
|
||||
ACTION_RETURN_BOOL(self->DoRespawn());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: CallTryPickup
|
||||
|
|
|
@ -75,8 +75,6 @@ public:
|
|||
|
||||
void DepleteOrDestroy (); // virtual on the script side.
|
||||
|
||||
bool DoRespawn();
|
||||
|
||||
AInventory *PrevInv(); // Returns the previous item with IF_INVBAR set.
|
||||
AInventory *NextInv(); // Returns the next item with IF_INVBAR set.
|
||||
|
||||
|
|
|
@ -368,6 +368,13 @@ ASpecialSpot *DSpotState::GetRandomSpot(PClassActor *type, bool onlyonce)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSpotState, GetRandomSpot)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSpotState);
|
||||
PARAM_CLASS(type, AActor);
|
||||
PARAM_BOOL(onlyonce);
|
||||
ACTION_RETURN_POINTER(self->GetRandomSpot(type, onlyonce));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -599,6 +599,7 @@ class SpotState : Object native
|
|||
native static SpotState GetSpotState();
|
||||
native SpecialSpot GetNextInList(class<Actor> type, int skipcounter);
|
||||
native SpecialSpot GetSpotWithMinMaxDistance(Class<Actor> type, double x, double y, double mindist, double maxdist);
|
||||
native SpecialSpot GetRandomSpot(class<Actor> type, bool onlyonce);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ class Inventory : Actor native
|
|||
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG";
|
||||
}
|
||||
|
||||
native bool DoRespawn();
|
||||
native static void PrintPickupMessage (bool localview, String str);
|
||||
|
||||
States(Actor)
|
||||
|
@ -169,6 +168,29 @@ class Inventory : Actor native
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: DoRespawn
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool DoRespawn ()
|
||||
{
|
||||
if (SpawnPointClass != NULL)
|
||||
{
|
||||
Actor spot = NULL;
|
||||
let state = SpotState.GetSpotState();
|
||||
|
||||
if (state != NULL) spot = state.GetRandomSpot(SpawnPointClass, false);
|
||||
if (spot != NULL)
|
||||
{
|
||||
SetOrigin (spot.Pos, false);
|
||||
SetZ(floorz);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: Grind
|
||||
|
|
Loading…
Reference in a new issue