mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-26 22:01:13 +00:00
42f3ccc602
- added a speed parameter to A_Lower and A_Raise in the process.
204 lines
5.6 KiB
Text
204 lines
5.6 KiB
Text
struct VisStyle
|
|
{
|
|
bool Invert;
|
|
float Alpha;
|
|
int RenderStyle;
|
|
}
|
|
|
|
class Inventory : Actor native
|
|
{
|
|
const BLINKTHRESHOLD = (4*32);
|
|
|
|
native Actor Owner; // Who owns this item? NULL if it's still a pickup.
|
|
native int Amount; // Amount of item this instance has
|
|
native int MaxAmount; // Max amount of item this instance can have
|
|
native int InterHubAmount; // Amount of item that can be kept between hubs or levels
|
|
native int RespawnTics; // Tics from pickup time to respawn time
|
|
native TextureID Icon; // Icon to show on status bar or HUD
|
|
native int DropTime; // Countdown after dropping
|
|
native Class<Actor> SpawnPointClass; // For respawning like Heretic's mace
|
|
native Class<Actor> PickupFlash; // actor to spawn as pickup flash
|
|
native Sound PickupSound;
|
|
native bool bPickupGood;
|
|
native bool bCreateCopyMoved;
|
|
native bool bInitEffectFailed;
|
|
|
|
Default
|
|
{
|
|
Inventory.Amount 1;
|
|
Inventory.MaxAmount 1;
|
|
Inventory.InterHubAmount 1;
|
|
Inventory.UseSound "misc/invuse";
|
|
Inventory.PickupSound "misc/i_pkup";
|
|
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG";
|
|
}
|
|
|
|
virtual native bool Use (bool pickup);
|
|
virtual native color GetBlend ();
|
|
virtual native bool HandlePickup(Inventory item);
|
|
virtual native Inventory CreateCopy(Actor other);
|
|
virtual native Inventory CreateTossable();
|
|
virtual native bool SpecialDropAction (Actor dropper);
|
|
virtual native String PickupMessage();
|
|
virtual native bool ShouldStay();
|
|
virtual native void PlayPickupSound(Actor user);
|
|
virtual native void AttachToOwner(Actor user);
|
|
virtual native void DetachFromOwner();
|
|
virtual native bool DrawPowerup(int x, int y);
|
|
virtual native void AbsorbDamage (int damage, Name damageType, out int newdamage);
|
|
|
|
native bool DoRespawn();
|
|
native bool GoAway();
|
|
native void GoAwayAndDie();
|
|
native void BecomeItem();
|
|
native void BecomePickup();
|
|
|
|
// 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)
|
|
{
|
|
HideDoomish:
|
|
TNT1 A 1050;
|
|
TNT1 A 0 A_RestoreSpecialPosition;
|
|
TNT1 A 1 A_RestoreSpecialDoomThing;
|
|
Stop;
|
|
HideSpecial:
|
|
ACLO E 1400;
|
|
ACLO A 0 A_RestoreSpecialPosition;
|
|
ACLO A 4 A_RestoreSpecialThing1;
|
|
ACLO BABCBCDC 4;
|
|
ACLO D 4 A_RestoreSpecialThing2;
|
|
Stop;
|
|
Held:
|
|
TNT1 A -1;
|
|
Stop;
|
|
HoldAndDestroy:
|
|
TNT1 A 1;
|
|
Stop;
|
|
}
|
|
|
|
// These are regular functions for the item itself.
|
|
|
|
//---------------------------------------------------------------------------
|
|
//
|
|
// PROC A_RestoreSpecialThing1
|
|
//
|
|
// Make a special thing visible again.
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
void A_RestoreSpecialThing1()
|
|
{
|
|
bInvisible = false;
|
|
if (DoRespawn ())
|
|
{
|
|
A_PlaySound ("misc/spawn", CHAN_VOICE);
|
|
}
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
//
|
|
// PROC A_RestoreSpecialThing2
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
void A_RestoreSpecialThing2()
|
|
{
|
|
bSpecial = true;
|
|
if (!Default.bNoGravity)
|
|
{
|
|
bNoGravity = false;
|
|
}
|
|
SetState (SpawnState);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
//
|
|
// PROC A_RestoreSpecialDoomThing
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
void A_RestoreSpecialDoomThing()
|
|
{
|
|
bInvisible = false;
|
|
bSpecial = true;
|
|
if (!Default.bNoGravity)
|
|
{
|
|
bNoGravity = false;
|
|
}
|
|
if (DoRespawn ())
|
|
{
|
|
SetState (SpawnState);
|
|
A_PlaySound ("misc/spawn", CHAN_VOICE);
|
|
Spawn ("ItemFog", Pos, ALLOW_REPLACE);
|
|
}
|
|
}
|
|
|
|
//===========================================================================
|
|
//
|
|
// AInventory :: DepleteOrDestroy
|
|
//
|
|
// If the item is depleted, just change its amount to 0, otherwise it's destroyed.
|
|
//
|
|
//===========================================================================
|
|
|
|
virtual void DepleteOrDestroy ()
|
|
{
|
|
// If it's not ammo or an internal armor, destroy it.
|
|
// Ammo needs to stick around, even when it's zero for the benefit
|
|
// of the weapons that use it and to maintain the maximum ammo
|
|
// amounts a backpack might have given.
|
|
// Armor shouldn't be removed because they only work properly when
|
|
// they are the last items in the inventory.
|
|
if (bKeepDepleted)
|
|
{
|
|
Amount = 0;
|
|
}
|
|
else
|
|
{
|
|
Destroy();
|
|
}
|
|
}
|
|
|
|
//===========================================================================
|
|
//
|
|
// AInventory :: Travelled
|
|
//
|
|
// Called when an item in somebody's inventory is carried over to another
|
|
// map, in case it needs to do special reinitialization.
|
|
//
|
|
//===========================================================================
|
|
|
|
virtual void Travelled() {}
|
|
|
|
//===========================================================================
|
|
//
|
|
// AInventory :: DoEffect
|
|
//
|
|
// Handles any effect an item might apply to its owner
|
|
// Normally only used by subclasses of Powerup
|
|
//
|
|
//===========================================================================
|
|
|
|
virtual void DoEffect() {}
|
|
|
|
virtual double GetSpeedFactor() { return 1; }
|
|
virtual bool GetNoTeleportFreeze() { return false; }
|
|
virtual void ModifyDamage(int damage, Name damageType, out int newdamage, bool passive) {}
|
|
virtual void AlterWeaponSprite(VisStyle vis, in out int changed) {}
|
|
virtual void OwnerDied() {}
|
|
|
|
}
|
|
|
|
class DehackedPickup : Inventory native
|
|
{
|
|
}
|
|
|
|
class FakeInventory : Inventory native
|
|
{
|
|
native bool Respawnable;
|
|
}
|