2016-03-01 15:47:10 +00:00
|
|
|
#ifndef __A_PICKUPS_H__
|
|
|
|
#define __A_PICKUPS_H__
|
|
|
|
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
|
|
|
|
#define NUM_WEAPON_SLOTS 10
|
|
|
|
|
|
|
|
class player_t;
|
|
|
|
class FConfigFile;
|
|
|
|
class PClassPlayerPawn;
|
|
|
|
struct visstyle_t;
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
/* Class definitions */
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
// A pickup is anything the player can pickup (i.e. weapons, ammo, powerups, etc)
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
IF_ACTIVATABLE = 1<<0, // can be activated
|
|
|
|
IF_ACTIVATED = 1<<1, // is currently activated
|
|
|
|
IF_PICKUPGOOD = 1<<2, // HandlePickup wants normal pickup FX to happen
|
|
|
|
IF_QUIET = 1<<3, // Don't give feedback when picking up
|
|
|
|
IF_AUTOACTIVATE = 1<<4, // Automatically activate item on pickup
|
|
|
|
IF_UNDROPPABLE = 1<<5, // Item cannot be removed unless done explicitly with RemoveInventory
|
|
|
|
IF_INVBAR = 1<<6, // Item appears in the inventory bar
|
|
|
|
IF_HUBPOWER = 1<<7, // Powerup is kept when moving in a hub
|
|
|
|
IF_UNTOSSABLE = 1<<8, // The player cannot manually drop the item
|
|
|
|
IF_ADDITIVETIME = 1<<9, // when picked up while another item is active, time is added instead of replaced.
|
|
|
|
IF_ALWAYSPICKUP = 1<<10, // For IF_AUTOACTIVATE, MaxAmount=0 items: Always "pick up", even if it doesn't do anything
|
|
|
|
IF_FANCYPICKUPSOUND = 1<<11, // Play pickup sound in "surround" mode
|
|
|
|
IF_BIGPOWERUP = 1<<12, // Affected by RESPAWN_SUPER dmflag
|
|
|
|
IF_KEEPDEPLETED = 1<<13, // Items with this flag are retained even when they run out.
|
|
|
|
IF_IGNORESKILL = 1<<14, // Ignores any skill related multiplicators when giving this item.
|
|
|
|
IF_CREATECOPYMOVED = 1<<15, // CreateCopy changed the owner (copy's Owner field holds new owner).
|
|
|
|
IF_INITEFFECTFAILED = 1<<16, // CreateCopy tried to activate a powerup and activation failed (can happen with PowerMorph)
|
|
|
|
IF_NOATTENPICKUPSOUND = 1<<17, // Play pickup sound with ATTN_NONE
|
|
|
|
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
|
|
|
|
IF_RESTRICTABSOLUTELY = 1<<19, // RestrictedTo and ForbiddenTo do not allow pickup in any form by other classes
|
|
|
|
IF_NEVERRESPAWN = 1<<20, // Never, ever respawns
|
|
|
|
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen
|
|
|
|
IF_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop)
|
|
|
|
IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag
|
|
|
|
IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper
|
|
|
|
IF_NOTELEPORTFREEZE = 1<<25, // does not 'freeze' the player right after teleporting.
|
2017-01-10 18:57:51 +00:00
|
|
|
IF_NOSCREENBLINK = 1<<26, // Does not blink the screen overlay when expiring.
|
2016-03-01 15:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class PClassInventory : public PClassActor
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassInventory, PClassActor)
|
|
|
|
public:
|
|
|
|
PClassInventory();
|
|
|
|
virtual void DeriveData(PClass *newclass);
|
2016-11-30 23:05:23 +00:00
|
|
|
virtual size_t PointerSubstitution(DObject *oldclass, DObject *newclass);
|
2016-10-12 18:42:41 +00:00
|
|
|
void Finalize(FStateDefinitions &statedef);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2017-01-19 19:56:31 +00:00
|
|
|
FString PickupMsg;
|
2016-03-01 15:47:10 +00:00
|
|
|
TArray<PClassPlayerPawn *> RestrictedToPlayerClass;
|
|
|
|
TArray<PClassPlayerPawn *> ForbiddenToPlayerClass;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AInventory : public AActor
|
|
|
|
{
|
|
|
|
DECLARE_CLASS_WITH_META(AInventory, AActor, PClassInventory)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
2016-09-19 17:14:30 +00:00
|
|
|
|
2017-02-07 17:12:38 +00:00
|
|
|
virtual void Finalize(FStateDefinitions &statedef) override;
|
2016-11-30 14:54:01 +00:00
|
|
|
virtual void Serialize(FSerializer &arc) override;
|
|
|
|
virtual void MarkPrecacheSounds() const override;
|
2017-01-12 21:49:18 +00:00
|
|
|
virtual void OnDestroy() override;
|
2016-11-30 14:54:01 +00:00
|
|
|
virtual void Tick() override;
|
|
|
|
virtual bool Grind(bool items) override;
|
|
|
|
|
2017-01-19 22:42:12 +00:00
|
|
|
bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function.
|
2016-11-30 14:54:01 +00:00
|
|
|
|
2017-01-19 22:42:12 +00:00
|
|
|
void DepleteOrDestroy (); // virtual on the script side.
|
|
|
|
bool CallUse(bool pickup); // virtual on the script side.
|
|
|
|
PalEntry CallGetBlend(); // virtual on the script side.
|
|
|
|
double GetSpeedFactor(); // virtual on the script side.
|
|
|
|
bool GetNoTeleportFreeze(); // virtual on the script side.
|
2016-11-30 14:54:01 +00:00
|
|
|
|
|
|
|
void BecomeItem ();
|
|
|
|
void BecomePickup ();
|
|
|
|
|
|
|
|
bool DoRespawn();
|
2017-01-19 22:42:12 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
AInventory *PrevItem(); // Returns the item preceding this one in the list.
|
|
|
|
AInventory *PrevInv(); // Returns the previous item with IF_INVBAR set.
|
|
|
|
AInventory *NextInv(); // Returns the next item with IF_INVBAR set.
|
|
|
|
|
|
|
|
TObjPtr<AActor> Owner; // Who owns this item? NULL if it's still a pickup.
|
|
|
|
int Amount; // Amount of item this instance has
|
|
|
|
int MaxAmount; // Max amount of item this instance can have
|
|
|
|
int InterHubAmount; // Amount of item that can be kept between hubs or levels
|
|
|
|
int RespawnTics; // Tics from pickup time to respawn time
|
|
|
|
FTextureID Icon; // Icon to show on status bar or HUD
|
|
|
|
int DropTime; // Countdown after dropping
|
2016-09-19 10:53:42 +00:00
|
|
|
PClassActor *SpawnPointClass; // For respawning like Heretic's mace
|
2017-02-08 15:57:48 +00:00
|
|
|
int GiveQuest; // Optionally give one of the quest items.
|
|
|
|
FTextureID AltHUDIcon;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DWORD ItemFlags;
|
|
|
|
PClassActor *PickupFlash; // actor to spawn as pickup flash
|
|
|
|
|
|
|
|
FSoundIDNoInit PickupSound;
|
|
|
|
};
|
|
|
|
|
2016-10-15 13:10:48 +00:00
|
|
|
class AStateProvider : public AInventory
|
|
|
|
{
|
2017-01-12 23:35:56 +00:00
|
|
|
DECLARE_CLASS (AStateProvider, AInventory)
|
2017-01-19 19:56:31 +00:00
|
|
|
public:
|
|
|
|
bool CallStateChain(AActor *actor, FState *state);
|
2016-10-15 13:10:48 +00:00
|
|
|
};
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
#endif //__A_PICKUPS_H__
|