mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 00:21:34 +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, PickupFlash)
|
||||||
DEFINE_FIELD(AInventory, PickupSound)
|
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
|
// AInventory :: Serialize
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AInventory : public AActor
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void Serialize(FSerializer &arc) override;
|
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.
|
TObjPtr<AActor*> Owner; // Who owns this item? NULL if it's still a pickup.
|
||||||
int Amount; // Amount of item this instance has
|
int Amount; // Amount of item this instance has
|
||||||
|
|
|
@ -1013,6 +1013,7 @@ xx(FOVScale)
|
||||||
xx(YAdjust)
|
xx(YAdjust)
|
||||||
xx(Crosshair)
|
xx(Crosshair)
|
||||||
xx(WeaponFlags)
|
xx(WeaponFlags)
|
||||||
|
xx(DropTime)
|
||||||
|
|
||||||
xx(BlueCard)
|
xx(BlueCard)
|
||||||
xx(YellowCard)
|
xx(YellowCard)
|
||||||
|
|
|
@ -49,6 +49,45 @@ class Inventory : Actor native
|
||||||
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG";
|
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);
|
native static void PrintPickupMessage (bool localview, String str);
|
||||||
|
|
||||||
States(Actor)
|
States(Actor)
|
||||||
|
|
Loading…
Reference in a new issue