- cleanup of the virtual function definitions for inventory items. Let's better use 'virtual' and 'override' everywhere to make sure that nothing gets overlooked.

- added call wrappers and script hooks for all relevant virtuals in AInventory.
- made GetSpeedFactor and GetNoTeleportFreeze entirely scripted because they are too trivial - also do them iteratively, just like HandlePickup, because it's just a better way to do this stuff.
This commit is contained in:
Christoph Oelckers 2016-11-30 15:54:01 +01:00
commit 8a50004f55
16 changed files with 390 additions and 245 deletions

View file

@ -32,7 +32,15 @@ class Inventory : Actor native
virtual native Inventory CreateTossable();
virtual native bool SpecialDropAction (Actor dropper);
virtual native String PickupMessage();
virtual native bool ShouldStay();
virtual native void DoEffect();
virtual native void PlayPickupSound(Actor user);
virtual native void AttachToOwner(Actor user);
virtual native void DetachFromOwner();
virtual double GetSpeedFactor() { return 1; }
virtual bool GetNoTeleportFreeze() { return false; }
native void GoAwayAndDie();
native void BecomeItem();
native void BecomePickup();
@ -42,7 +50,10 @@ class Inventory : Actor native
private native void A_RestoreSpecialThing1();
private native void A_RestoreSpecialThing2();
virtual native bool TryPickup(in out Actor toucher);
// In this case the caller function is more than a simple wrapper around the virtual method and
// is what must be actually called to pick up an item.
virtual protected native bool TryPickup(in out Actor toucher);
virtual protected native bool TryPickupRestricted(in out Actor toucher);
native bool, Actor CallTryPickup(Actor toucher);
States(Actor, Overlay, Weapon, Item)

View file

@ -22,6 +22,10 @@ class Powerup : Inventory native
native color BlendColor;
native Name Mode; // Meaning depends on powerup - used for Invulnerability and Invisibility
native double Strength; // Meaning depends on powerup - currently used only by Invisibility
// Note, that while this is an inventory flag, it only has meaning on an active powerup.
virtual bool GetNoTeleportFreeze() { return bNoTeleportFreeze; }
}
class PowerInvulnerable : Powerup native
@ -136,6 +140,8 @@ class PowerSpeed : Powerup native
Inventory.Icon "SPBOOT0";
+INVENTORY.NOTELEPORTFREEZE
}
override double GetSpeedFactor() { return Speed; }
}
// Player Speed Trail (used by the Speed Powerup) ----------------------------