2006-02-24 04:48:15 +00:00
|
|
|
#ifndef __A_PICKUPS_H__
|
|
|
|
#define __A_PICKUPS_H__
|
|
|
|
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
2008-06-15 02:25:09 +00:00
|
|
|
#include "s_sound.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define NUM_WEAPON_SLOTS 10
|
|
|
|
|
2008-06-01 07:52:33 +00:00
|
|
|
class player_t;
|
2006-02-24 04:48:15 +00:00
|
|
|
class FConfigFile;
|
|
|
|
class AWeapon;
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassWeapon;
|
|
|
|
class PClassPlayerPawn;
|
2011-07-06 13:00:51 +00:00
|
|
|
struct visstyle_t;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class FWeaponSlot
|
|
|
|
{
|
|
|
|
public:
|
2009-03-12 03:54:23 +00:00
|
|
|
FWeaponSlot() { Clear(); }
|
|
|
|
FWeaponSlot(const FWeaponSlot &other) { Weapons = other.Weapons; }
|
2009-02-20 00:53:25 +00:00
|
|
|
FWeaponSlot &operator= (const FWeaponSlot &other) { Weapons = other.Weapons; return *this; }
|
|
|
|
void Clear() { Weapons.Clear(); }
|
2006-02-24 04:48:15 +00:00
|
|
|
bool AddWeapon (const char *type);
|
2010-03-25 20:38:00 +00:00
|
|
|
bool AddWeapon (PClassWeapon *type);
|
2009-02-20 00:53:25 +00:00
|
|
|
void AddWeaponList (const char *list, bool clear);
|
2010-05-30 07:47:08 +00:00
|
|
|
AWeapon *PickWeapon (player_t *player, bool checkammo = false);
|
2009-03-12 03:54:23 +00:00
|
|
|
int Size () const { return (int)Weapons.Size(); }
|
2010-03-25 20:38:00 +00:00
|
|
|
int LocateWeapon (PClassWeapon *type);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
inline PClassWeapon *GetWeapon (int index) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-20 00:53:25 +00:00
|
|
|
if ((unsigned)index < Weapons.Size())
|
|
|
|
{
|
|
|
|
return Weapons[index].Type;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
friend struct FWeaponSlots;
|
|
|
|
|
|
|
|
private:
|
2009-02-20 00:53:25 +00:00
|
|
|
struct WeaponInfo
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
PClassWeapon *Type;
|
2009-02-20 00:53:25 +00:00
|
|
|
fixed_t Position;
|
|
|
|
};
|
|
|
|
void SetInitialPositions();
|
|
|
|
void Sort();
|
|
|
|
TArray<WeaponInfo> Weapons;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
// FWeaponSlots::AddDefaultWeapon return codes
|
|
|
|
enum ESlotDef
|
|
|
|
{
|
|
|
|
SLOTDEF_Exists, // Weapon was already assigned a slot
|
|
|
|
SLOTDEF_Added, // Weapon was successfully added
|
|
|
|
SLOTDEF_Full // The specifed slot was full
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FWeaponSlots
|
|
|
|
{
|
2009-03-12 03:54:23 +00:00
|
|
|
FWeaponSlots() { Clear(); }
|
|
|
|
FWeaponSlots(const FWeaponSlots &other);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
FWeaponSlot Slots[NUM_WEAPON_SLOTS];
|
|
|
|
|
2009-02-20 00:53:25 +00:00
|
|
|
AWeapon *PickNextWeapon (player_t *player);
|
|
|
|
AWeapon *PickPrevWeapon (player_t *player);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void Clear ();
|
2010-03-25 20:38:00 +00:00
|
|
|
bool LocateWeapon (PClassWeapon *type, int *const slot, int *const index);
|
|
|
|
ESlotDef AddDefaultWeapon (int slot, PClassWeapon *type);
|
2009-02-20 00:53:25 +00:00
|
|
|
void AddExtraWeapons();
|
2009-04-04 17:46:33 +00:00
|
|
|
void SetFromGameInfo();
|
2010-03-25 20:38:00 +00:00
|
|
|
void SetFromPlayer(PClassPlayerPawn *type);
|
|
|
|
void StandardSetup(PClassPlayerPawn *type);
|
2010-03-24 02:49:37 +00:00
|
|
|
void LocalSetup(PClassActor *type);
|
2012-03-22 22:29:25 +00:00
|
|
|
void SendDifferences(int playernum, const FWeaponSlots &other);
|
2009-02-20 00:53:25 +00:00
|
|
|
int RestoreSlots (FConfigFile *config, const char *section);
|
2009-02-20 22:28:48 +00:00
|
|
|
void PrintSettings();
|
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
void AddSlot(int slot, PClassWeapon *type, bool feedback);
|
|
|
|
void AddSlotDefault(int slot, PClassWeapon *type, bool feedback);
|
2009-02-20 22:28:48 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2009-03-12 03:54:23 +00:00
|
|
|
void P_PlaybackKeyConfWeapons(FWeaponSlots *slots);
|
2010-03-25 20:38:00 +00:00
|
|
|
void Net_WriteWeapon(PClassWeapon *type);
|
|
|
|
PClassWeapon *Net_ReadWeapon(BYTE **stream);
|
2009-02-24 05:58:59 +00:00
|
|
|
|
|
|
|
void P_SetupWeapons_ntohton();
|
|
|
|
void P_WriteDemoWeaponsChunk(BYTE **demo);
|
|
|
|
void P_ReadDemoWeaponsChunk(BYTE **demo);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
/* 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
|
2010-12-16 08:21:38 +00:00
|
|
|
IF_UNDROPPABLE = 1<<5, // Item cannot be removed unless done explicitly with RemoveInventory
|
2006-02-24 04:48:15 +00:00
|
|
|
IF_INVBAR = 1<<6, // Item appears in the inventory bar
|
|
|
|
IF_HUBPOWER = 1<<7, // Powerup is kept when moving in a hub
|
2010-12-16 08:21:38 +00:00
|
|
|
IF_UNTOSSABLE = 1<<8, // The player cannot manually drop the item
|
2008-03-01 16:59:17 +00:00
|
|
|
IF_ADDITIVETIME = 1<<9, // when picked up while another item is active, time is added instead of replaced.
|
2006-02-24 04:48:15 +00:00
|
|
|
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
|
2006-05-03 14:54:48 +00:00
|
|
|
IF_BIGPOWERUP = 1<<12, // Affected by RESPAWN_SUPER dmflag
|
2007-03-07 02:24:24 +00:00
|
|
|
IF_KEEPDEPLETED = 1<<13, // Items with this flag are retained even when they run out.
|
2007-07-28 12:38:10 +00:00
|
|
|
IF_IGNORESKILL = 1<<14, // Ignores any skill related multiplicators when giving this item.
|
2008-04-12 15:31:18 +00:00
|
|
|
IF_CREATECOPYMOVED = 1<<15, // CreateCopy changed the owner (copy's Owner field holds new owner).
|
2008-06-15 03:46:04 +00:00
|
|
|
IF_INITEFFECTFAILED = 1<<16, // CreateCopy tried to activate a powerup and activation failed (can happen with PowerMorph)
|
2008-09-12 01:12:40 +00:00
|
|
|
IF_NOATTENPICKUPSOUND = 1<<17, // Play pickup sound with ATTN_NONE
|
2009-06-07 20:10:05 +00:00
|
|
|
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
|
2012-07-08 02:45:46 +00:00
|
|
|
IF_RESTRICTABSOLUTELY = 1<<19, // RestrictedTo and ForbiddenTo do not allow pickup in any form by other classes
|
2012-10-11 04:12:35 +00:00
|
|
|
IF_NEVERRESPAWN = 1<<20, // Never, ever respawns
|
2013-02-19 02:27:41 +00:00
|
|
|
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassInventory : public PClassActor
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassInventory, PClassActor)
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
PClassInventory();
|
|
|
|
|
|
|
|
FString PickupMessage;
|
|
|
|
int GiveQuest; // Optionally give one of the quest items.
|
|
|
|
FTextureID AltHUDIcon;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class AInventory : public AActor
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(AInventory, AActor, PClassInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
|
|
|
virtual void Touch (AActor *toucher);
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
|
2012-08-22 23:51:23 +00:00
|
|
|
virtual void MarkPrecacheSounds() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual void BeginPlay ();
|
|
|
|
virtual void Destroy ();
|
|
|
|
virtual void Tick ();
|
|
|
|
virtual bool ShouldRespawn ();
|
|
|
|
virtual bool ShouldStay ();
|
|
|
|
virtual void Hide ();
|
2009-02-06 00:16:57 +00:00
|
|
|
bool CallTryPickup (AActor *toucher, AActor **toucher_return = NULL);
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual void DoPickupSpecial (AActor *toucher);
|
|
|
|
virtual bool SpecialDropAction (AActor *dropper);
|
|
|
|
virtual bool DrawPowerup (int x, int y);
|
2007-01-12 15:24:10 +00:00
|
|
|
virtual void DoEffect ();
|
2013-04-16 17:55:17 +00:00
|
|
|
virtual bool Grind(bool items);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual const char *PickupMessage ();
|
|
|
|
virtual void PlayPickupSound (AActor *toucher);
|
|
|
|
|
2008-08-03 19:10:48 +00:00
|
|
|
bool DoRespawn ();
|
2008-03-12 02:56:11 +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.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AActor> Owner; // Who owns this item? NULL if it's still a pickup.
|
2006-02-24 04:48:15 +00:00
|
|
|
int Amount; // Amount of item this instance has
|
|
|
|
int MaxAmount; // Max amount of item this instance can have
|
2009-08-02 15:54:34 +00:00
|
|
|
int InterHubAmount; // Amount of item that can be kept between hubs or levels
|
2006-02-24 04:48:15 +00:00
|
|
|
int RespawnTics; // Tics from pickup time to respawn time
|
2009-01-25 01:52:38 +00:00
|
|
|
FTextureID Icon; // Icon to show on status bar or HUD
|
2006-02-24 04:48:15 +00:00
|
|
|
int DropTime; // Countdown after dropping
|
2008-08-03 19:10:48 +00:00
|
|
|
const PClass *SpawnPointClass; // For respawning like Heretic's mace
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
DWORD ItemFlags;
|
2010-03-25 20:38:00 +00:00
|
|
|
PClassActor *PickupFlash; // actor to spawn as pickup flash
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-06-15 02:25:09 +00:00
|
|
|
FSoundIDNoInit PickupSound;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual void BecomeItem ();
|
|
|
|
virtual void BecomePickup ();
|
|
|
|
virtual void AttachToOwner (AActor *other);
|
|
|
|
virtual void DetachFromOwner ();
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual AInventory *CreateTossable ();
|
|
|
|
virtual bool GoAway ();
|
|
|
|
virtual void GoAwayAndDie ();
|
|
|
|
virtual bool HandlePickup (AInventory *item);
|
|
|
|
virtual bool Use (bool pickup);
|
|
|
|
virtual void Travelled ();
|
2006-06-18 04:10:47 +00:00
|
|
|
virtual void OwnerDied ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-10-31 14:53:21 +00:00
|
|
|
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
2007-05-10 22:22:38 +00:00
|
|
|
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive);
|
2007-05-12 11:14:09 +00:00
|
|
|
virtual fixed_t GetSpeedFactor();
|
2011-07-06 13:00:51 +00:00
|
|
|
virtual int AlterWeaponSprite (visstyle_t *vis);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual PalEntry GetBlend ();
|
|
|
|
|
2006-05-07 00:27:22 +00:00
|
|
|
protected:
|
2008-09-13 22:08:41 +00:00
|
|
|
virtual bool TryPickup (AActor *&toucher);
|
2011-09-23 08:23:51 +00:00
|
|
|
virtual bool TryPickupRestricted (AActor *&toucher);
|
|
|
|
bool CanPickup(AActor * toucher);
|
2006-05-07 00:27:22 +00:00
|
|
|
void GiveQuest(AActor * toucher);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
|
|
|
static int StaticLastMessageTic;
|
|
|
|
static const char *StaticLastMessage;
|
|
|
|
};
|
|
|
|
|
|
|
|
// CustomInventory: Supports the Use, Pickup, and Drop states from 96x
|
|
|
|
class ACustomInventory : public AInventory
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (ACustomInventory, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
|
2006-03-03 03:57:01 +00:00
|
|
|
// This is used when an inventory item's use state sequence is executed.
|
2007-01-20 14:27:44 +00:00
|
|
|
bool CallStateChain (AActor *actor, FState *state);
|
2006-03-03 03:57:01 +00:00
|
|
|
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
bool Use (bool pickup);
|
|
|
|
bool SpecialDropAction (AActor *dropper);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Ammo: Something a weapon needs to operate
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassAmmo : public PClassInventory
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassAmmo, PClassInventory)
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
PClassAmmo();
|
|
|
|
|
|
|
|
int DropAmount; // Specifies the amount for a dropped ammo item.
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class AAmmo : public AInventory
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(AAmmo, AInventory, PClassAmmo)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
AInventory *CreateCopy (AActor *other);
|
|
|
|
bool HandlePickup (AInventory *item);
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *GetParentAmmo () const;
|
2008-01-15 04:57:25 +00:00
|
|
|
AInventory *CreateTossable ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
int BackpackAmount, BackpackMaxAmount;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A weapon is just that.
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassWeapon : public PClassInventory
|
2009-02-20 00:53:25 +00:00
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS(PClassWeapon, PClassInventory);
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
PClassWeapon();
|
|
|
|
|
|
|
|
int SlotNumber;
|
|
|
|
fixed_t SlotPriority;
|
2009-02-20 00:53:25 +00:00
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class AWeapon : public AInventory
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(AWeapon, AInventory, PClassWeapon)
|
2006-02-24 04:48:15 +00:00
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
|
|
|
DWORD WeaponFlags;
|
2010-03-25 20:38:00 +00:00
|
|
|
PClassAmmo *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
|
2006-02-24 04:48:15 +00:00
|
|
|
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
|
|
|
|
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
|
|
|
|
int AmmoUse1, AmmoUse2; // How much ammo to use with each shot
|
|
|
|
int Kickback;
|
|
|
|
fixed_t YAdjust; // For viewing the weapon fullscreen
|
2008-06-15 02:25:09 +00:00
|
|
|
FSoundIDNoInit UpSound, ReadySound; // Sounds when coming up and idle
|
2010-03-25 20:38:00 +00:00
|
|
|
PClassWeapon *SisterWeaponType; // Another weapon to pick up with this one
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *ProjectileType; // Projectile used by primary attack
|
|
|
|
PClassActor *AltProjectileType; // Projectile used by alternate attack
|
2006-02-24 04:48:15 +00:00
|
|
|
int SelectionOrder; // Lower-numbered weapons get picked first
|
2013-03-24 02:25:12 +00:00
|
|
|
int MinSelAmmo1, MinSelAmmo2; // Ignore in BestWeapon() if inadequate ammo
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t MoveCombatDist; // Used by bots, but do they *really* need it?
|
2008-06-22 09:13:19 +00:00
|
|
|
int ReloadCounter; // For A_CheckForReload
|
2012-05-02 20:58:29 +00:00
|
|
|
int BobStyle; // [XA] Bobbing style. Defines type of bobbing (e.g. Normal, Alpha)
|
|
|
|
fixed_t BobSpeed; // [XA] Bobbing speed. Defines how quickly a weapon bobs.
|
|
|
|
fixed_t BobRangeX, BobRangeY; // [XA] Bobbing range. Defines how far a weapon bobs in either direction.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// In-inventory instance variables
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AAmmo> Ammo1, Ammo2;
|
|
|
|
TObjPtr<AWeapon> SisterWeapon;
|
2009-06-30 19:20:39 +00:00
|
|
|
float FOVScale;
|
2009-07-01 02:00:36 +00:00
|
|
|
int Crosshair; // 0 to use player's crosshair
|
|
|
|
bool GivenAsMorphWeapon;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool bAltFire; // Set when this weapon's alternate fire is used.
|
|
|
|
|
2012-08-22 23:51:23 +00:00
|
|
|
virtual void MarkPrecacheSounds() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
virtual bool ShouldStay ();
|
|
|
|
virtual void AttachToOwner (AActor *other);
|
|
|
|
virtual bool HandlePickup (AInventory *item);
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual AInventory *CreateTossable ();
|
2008-09-13 22:08:41 +00:00
|
|
|
virtual bool TryPickup (AActor *&toucher);
|
2011-09-23 08:23:51 +00:00
|
|
|
virtual bool TryPickupRestricted (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual bool PickupForAmmo (AWeapon *ownedWeapon);
|
|
|
|
virtual bool Use (bool pickup);
|
2008-07-05 10:31:36 +00:00
|
|
|
virtual void Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual FState *GetUpState ();
|
|
|
|
virtual FState *GetDownState ();
|
|
|
|
virtual FState *GetReadyState ();
|
2006-10-31 14:53:21 +00:00
|
|
|
virtual FState *GetAtkState (bool hold);
|
|
|
|
virtual FState *GetAltAtkState (bool hold);
|
2012-04-07 13:07:25 +00:00
|
|
|
virtual FState *GetRelState ();
|
|
|
|
virtual FState *GetZoomState ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual void PostMorphWeapon ();
|
|
|
|
virtual void EndPowerup ();
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PrimaryFire,
|
|
|
|
AltFire,
|
|
|
|
EitherFire
|
|
|
|
};
|
2012-04-07 11:33:35 +00:00
|
|
|
bool CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo=false, int ammocount = -1);
|
|
|
|
bool DepleteAmmo (bool altFire, bool checkEnough=true, int ammouse = -1);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2012-05-02 20:58:29 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
BobNormal,
|
|
|
|
BobInverse,
|
|
|
|
BobAlpha,
|
|
|
|
BobInverseAlpha,
|
|
|
|
BobSmooth,
|
|
|
|
BobInverseSmooth
|
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
2010-03-24 02:49:37 +00:00
|
|
|
AAmmo *AddAmmo (AActor *other, PClassActor *ammotype, int amount);
|
2007-07-28 12:38:10 +00:00
|
|
|
bool AddExistingAmmo (AAmmo *ammo, int amount);
|
2010-03-25 20:38:00 +00:00
|
|
|
AWeapon *AddWeapon (PClassWeapon *weapon);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
WIF_NOAUTOFIRE = 0x00000001, // weapon does not autofire
|
|
|
|
WIF_READYSNDHALF = 0x00000002, // ready sound is played ~1/2 the time
|
|
|
|
WIF_DONTBOB = 0x00000004, // don't bob the weapon
|
|
|
|
WIF_AXEBLOOD = 0x00000008, // weapon makes axe blood on impact (Hexen only)
|
|
|
|
WIF_NOALERT = 0x00000010, // weapon does not alert monsters
|
|
|
|
WIF_AMMO_OPTIONAL = 0x00000020, // weapon can use ammo but does not require it
|
|
|
|
WIF_ALT_AMMO_OPTIONAL = 0x00000040, // alternate fire can use ammo but does not require it
|
|
|
|
WIF_PRIMARY_USES_BOTH = 0x00000080, // primary fire uses both ammo
|
|
|
|
WIF_ALT_USES_BOTH = 0x00000100, // alternate fire uses both ammo
|
|
|
|
WIF_WIMPY_WEAPON = 0x00000200, // change away when ammo for another weapon is replenished
|
|
|
|
WIF_POWERED_UP = 0x00000400, // this is a tome-of-power'ed version of its sister
|
2009-05-31 22:14:23 +00:00
|
|
|
WIF_AMMO_CHECKBOTH = 0x00000800, // check for both primary and secondary fire before switching it off
|
2007-01-22 22:15:50 +00:00
|
|
|
WIF_NO_AUTO_SWITCH = 0x00001000, // never switch to this weapon when it's picked up
|
2009-06-09 17:13:03 +00:00
|
|
|
WIF_STAFF2_KICKBACK = 0x00002000, // the powered-up Heretic staff has special kickback
|
|
|
|
WIF_NOAUTOAIM = 0x00004000, // this weapon never uses autoaim (useful for ballistic projectiles)
|
2009-09-16 21:03:09 +00:00
|
|
|
WIF_MELEEWEAPON = 0x00008000, // melee weapon. Used by bots and monster AI.
|
2012-04-07 11:33:35 +00:00
|
|
|
WIF_DEHAMMO = 0x00010000, // Uses Doom's original amount of ammo for the respective attack functions so that old DEHACKED patches work as intended.
|
|
|
|
// AmmoUse1 will be set to the first attack's ammo use so that checking for empty weapons still works
|
2009-06-09 17:13:03 +00:00
|
|
|
WIF_CHEATNOTWEAPON = 0x08000000, // Give cheat considers this not a weapon (used by Sigil)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Flags used only by bot AI:
|
|
|
|
|
|
|
|
WIF_BOT_REACTION_SKILL_THING = 1<<31, // I don't understand this
|
|
|
|
WIF_BOT_EXPLOSIVE = 1<<30, // weapon fires an explosive
|
|
|
|
WIF_BOT_BFG = 1<<28, // this is a BFG
|
|
|
|
};
|
|
|
|
|
2013-05-02 00:24:53 +00:00
|
|
|
class AWeaponGiver : public AWeapon
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(AWeaponGiver, AWeapon)
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool TryPickup(AActor *&toucher);
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
|
|
|
|
fixed_t DropAmmoFactor;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Health is some item that gives the player health when picked up.
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassHealth : public PClassInventory
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassHealth, PClassInventory)
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
PClassHealth();
|
|
|
|
|
|
|
|
FString LowHealthMessage;
|
|
|
|
int LowHealth;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class AHealth : public AInventory
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(AHealth, AInventory, PClassHealth)
|
2006-06-17 20:29:41 +00:00
|
|
|
|
|
|
|
int PrevHealth;
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
virtual bool TryPickup (AActor *&other);
|
2006-06-17 20:29:41 +00:00
|
|
|
virtual const char *PickupMessage ();
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// HealthPickup is some item that gives the player health when used.
|
|
|
|
class AHealthPickup : public AInventory
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (AHealthPickup, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2009-02-28 21:38:20 +00:00
|
|
|
int autousemode;
|
|
|
|
|
|
|
|
virtual void Serialize (FArchive &arc);
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual AInventory *CreateTossable ();
|
|
|
|
virtual bool HandlePickup (AInventory *item);
|
|
|
|
virtual bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Armor absorbs some damage for the player.
|
|
|
|
class AArmor : public AInventory
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (AArmor, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Basic armor absorbs a specific percent of the damage. You should
|
|
|
|
// never pickup a BasicArmor. Instead, you pickup a BasicArmorPickup
|
|
|
|
// or BasicArmorBonus and those gives you BasicArmor when it activates.
|
|
|
|
class ABasicArmor : public AArmor
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (ABasicArmor, AArmor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
virtual void Tick ();
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual bool HandlePickup (AInventory *item);
|
2006-10-31 14:53:21 +00:00
|
|
|
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
int AbsorbCount;
|
2006-02-24 04:48:15 +00:00
|
|
|
fixed_t SavePercent;
|
2008-12-06 10:22:37 +00:00
|
|
|
int MaxAbsorb;
|
|
|
|
int MaxFullAbsorb;
|
2006-12-25 13:43:11 +00:00
|
|
|
int BonusCount;
|
2009-06-05 20:23:47 +00:00
|
|
|
FNameNoInit ArmorType;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// BasicArmorPickup replaces the armor you have.
|
|
|
|
class ABasicArmorPickup : public AArmor
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (ABasicArmorPickup, AArmor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual bool Use (bool pickup);
|
|
|
|
|
|
|
|
fixed_t SavePercent;
|
2008-12-06 10:22:37 +00:00
|
|
|
int MaxAbsorb;
|
|
|
|
int MaxFullAbsorb;
|
2006-02-24 04:48:15 +00:00
|
|
|
int SaveAmount;
|
|
|
|
};
|
|
|
|
|
|
|
|
// BasicArmorBonus adds to the armor you have.
|
|
|
|
class ABasicArmorBonus : public AArmor
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (ABasicArmorBonus, AArmor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual bool Use (bool pickup);
|
|
|
|
|
|
|
|
fixed_t SavePercent; // The default, for when you don't already have armor
|
|
|
|
int MaxSaveAmount;
|
2008-12-06 10:22:37 +00:00
|
|
|
int MaxAbsorb;
|
|
|
|
int MaxFullAbsorb;
|
2006-02-24 04:48:15 +00:00
|
|
|
int SaveAmount;
|
2006-12-25 13:43:11 +00:00
|
|
|
int BonusCount;
|
|
|
|
int BonusMax;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Hexen armor consists of four separate armor types plus a conceptual armor
|
|
|
|
// type (the player himself) that work together as a single armor.
|
|
|
|
class AHexenArmor : public AArmor
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (AHexenArmor, AArmor)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
virtual AInventory *CreateCopy (AActor *other);
|
|
|
|
virtual AInventory *CreateTossable ();
|
|
|
|
virtual bool HandlePickup (AInventory *item);
|
2006-10-31 14:53:21 +00:00
|
|
|
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
fixed_t Slots[5];
|
|
|
|
fixed_t SlotsIncrement[4];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool AddArmorToSlot (AActor *actor, int slot, int amount);
|
|
|
|
};
|
|
|
|
|
|
|
|
// PuzzleItems work in conjunction with the UsePuzzleItem special
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassPuzzleItem : public PClassInventory
|
|
|
|
{
|
|
|
|
DECLARE_CLASS(PClassPuzzleItem, PClassInventory);
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
FString PuzzFailMessage;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class APuzzleItem : public AInventory
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(APuzzleItem, AInventory, PClassPuzzleItem)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
bool ShouldStay ();
|
|
|
|
bool Use (bool pickup);
|
|
|
|
bool HandlePickup (AInventory *item);
|
|
|
|
|
|
|
|
int PuzzleItemNumber;
|
|
|
|
};
|
|
|
|
|
|
|
|
// A MapRevealer reveals the whole map for the player who picks it up.
|
|
|
|
class AMapRevealer : public AInventory
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (AMapRevealer, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-09-13 22:08:41 +00:00
|
|
|
bool TryPickup (AActor *&toucher);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// A backpack gives you one clip of each ammo and doubles your
|
|
|
|
// normal maximum ammo amounts.
|
2007-04-28 09:06:32 +00:00
|
|
|
class ABackpackItem : public AInventory
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (ABackpackItem, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
bool HandlePickup (AInventory *item);
|
|
|
|
AInventory *CreateCopy (AActor *other);
|
|
|
|
AInventory *CreateTossable ();
|
|
|
|
void DetachFromOwner ();
|
|
|
|
|
|
|
|
bool bDepleted;
|
|
|
|
};
|
|
|
|
|
2009-09-14 19:44:14 +00:00
|
|
|
|
|
|
|
// A score item is picked up without being added to the inventory.
|
2009-09-16 15:57:08 +00:00
|
|
|
// It differs from FakeInventory by doing nothing more than increasing the player's score.
|
2009-09-14 19:44:14 +00:00
|
|
|
class AScoreItem : public AInventory
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (AScoreItem, AInventory)
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool TryPickup(AActor *&toucher);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif //__A_PICKUPS_H__
|