mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- scriptified AInventory::Tick.
This was the last bit of code standing in the way of making AInventory a fully scripted class. All that's left to sort out is some variable accesses - the vast majority of them in SBARINFO.
This commit is contained in:
parent
d88d173b38
commit
807df33e1a
4 changed files with 41 additions and 43 deletions
|
@ -75,48 +75,6 @@ DEFINE_FIELD(AInventory, SpawnPointClass)
|
|||
DEFINE_FIELD(AInventory, PickupFlash)
|
||||
DEFINE_FIELD(AInventory, PickupSound)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: Tick
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AInventory::Tick ()
|
||||
{
|
||||
if (Owner == NULL)
|
||||
{
|
||||
// AActor::Tick is only handling interaction with the world
|
||||
// and we don't want that for owned inventory items.
|
||||
Super::Tick ();
|
||||
}
|
||||
else if (tics != -1) // ... but at least we have to advance the states
|
||||
{
|
||||
tics--;
|
||||
|
||||
// you can cycle through multiple states in a tic
|
||||
// [RH] Use <= 0 instead of == 0 so that spawnstates
|
||||
// of 0 tics work as expected.
|
||||
if (tics <= 0)
|
||||
{
|
||||
assert (state != NULL);
|
||||
if (state == NULL)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
if (!SetState (state->GetNextState()))
|
||||
return; // freed itself
|
||||
}
|
||||
}
|
||||
if (DropTime)
|
||||
{
|
||||
if (--DropTime == 0)
|
||||
{
|
||||
flags |= GetDefault()->flags & (MF_SPECIAL|MF_SOLID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: Serialize
|
||||
|
|
|
@ -71,7 +71,7 @@ class AInventory : public AActor
|
|||
public:
|
||||
|
||||
virtual void Serialize(FSerializer &arc) override;
|
||||
virtual void Tick() override;
|
||||
//virtual void Tick() override;
|
||||
|
||||
TObjPtr<AActor*> Owner; // Who owns this item? NULL if it's still a pickup.
|
||||
int Amount; // Amount of item this instance has
|
||||
|
|
|
@ -1013,6 +1013,7 @@ xx(FOVScale)
|
|||
xx(YAdjust)
|
||||
xx(Crosshair)
|
||||
xx(WeaponFlags)
|
||||
xx(DropTime)
|
||||
|
||||
xx(BlueCard)
|
||||
xx(YellowCard)
|
||||
|
|
|
@ -49,6 +49,45 @@ class Inventory : Actor native
|
|||
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG";
|
||||
}
|
||||
|
||||
//native override void Tick();
|
||||
|
||||
override void Tick()
|
||||
{
|
||||
if (Owner == null)
|
||||
{
|
||||
// AActor::Tick is only handling interaction with the world
|
||||
// and we don't want that for owned inventory items.
|
||||
Super.Tick();
|
||||
}
|
||||
else if (tics != -1) // ... but at least we have to advance the states
|
||||
{
|
||||
tics--;
|
||||
|
||||
// you can cycle through multiple states in a tic
|
||||
// [RH] Use <= 0 instead of == 0 so that spawnstates
|
||||
// of 0 tics work as expected.
|
||||
if (tics <= 0)
|
||||
{
|
||||
if (curstate == null)
|
||||
{
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
if (!SetState (curstate.NextState))
|
||||
return; // freed itself
|
||||
}
|
||||
}
|
||||
if (DropTime)
|
||||
{
|
||||
if (--DropTime == 0)
|
||||
{
|
||||
bSpecial = default.bSpecial;
|
||||
bSolid = default.bSolid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
native static void PrintPickupMessage (bool localview, String str);
|
||||
|
||||
States(Actor)
|
||||
|
|
Loading…
Reference in a new issue