2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __D_PLAYER_H__
|
|
|
|
#define __D_PLAYER_H__
|
|
|
|
|
|
|
|
// Finally, for odd reasons, the player input
|
|
|
|
// is buffered within the player data struct,
|
|
|
|
// as commands per game tick.
|
|
|
|
#include "d_ticcmd.h"
|
2009-01-10 09:40:47 +00:00
|
|
|
#include "doomstat.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
|
|
|
|
// The player data structure depends on a number
|
|
|
|
// of other structs: items (internal inventory),
|
|
|
|
// animation states (closely tied to the sprites
|
|
|
|
// used to represent them, unfortunately).
|
|
|
|
#include "p_pspr.h"
|
|
|
|
|
|
|
|
// In addition, the player is just a special
|
|
|
|
// case of the generic moving object/actor.
|
|
|
|
#include "actor.h"
|
|
|
|
|
|
|
|
//Added by MC:
|
|
|
|
#include "b_bot.h"
|
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
class player_t;
|
|
|
|
|
2010-04-04 17:06:04 +00:00
|
|
|
// Standard pre-defined skin colors
|
|
|
|
struct FPlayerColorSet
|
|
|
|
{
|
2012-07-14 03:04:41 +00:00
|
|
|
struct ExtraRange
|
|
|
|
{
|
|
|
|
BYTE RangeStart, RangeEnd; // colors to remap
|
|
|
|
BYTE FirstColor, LastColor; // colors to map to
|
|
|
|
};
|
|
|
|
|
2010-04-04 17:06:04 +00:00
|
|
|
FName Name; // Name of this color
|
|
|
|
|
|
|
|
int Lump; // Lump to read the translation from, otherwise use next 2 fields
|
|
|
|
BYTE FirstColor, LastColor; // Describes the range of colors to use for the translation
|
|
|
|
|
|
|
|
BYTE RepresentativeColor; // A palette entry representative of this translation,
|
|
|
|
// for map arrows and status bar backgrounds and such
|
2012-07-14 03:04:41 +00:00
|
|
|
BYTE NumExtraRanges;
|
|
|
|
ExtraRange Extra[6];
|
2010-04-04 17:06:04 +00:00
|
|
|
};
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2010-04-04 17:06:04 +00:00
|
|
|
typedef TMap<int, FPlayerColorSet> FPlayerColorSetMap;
|
2012-10-17 04:24:54 +00:00
|
|
|
typedef TMap<FName, PalEntry> PainFlashList;
|
2010-04-04 17:06:04 +00:00
|
|
|
|
2010-03-25 20:38:00 +00:00
|
|
|
class PClassPlayerPawn : public PClassActor
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS(PClassPlayerPawn, PClassActor);
|
|
|
|
protected:
|
|
|
|
virtual void Derive(PClass *newclass);
|
|
|
|
public:
|
|
|
|
PClassPlayerPawn();
|
2010-04-04 17:06:04 +00:00
|
|
|
void EnumColorSets(TArray<int> *out);
|
|
|
|
FPlayerColorSet *GetColorSet(int setnum) { return ColorSets.CheckKey(setnum); }
|
2012-10-17 04:24:54 +00:00
|
|
|
void SetPainFlash(FName type, PalEntry color);
|
|
|
|
bool GetPainFlash(FName type, PalEntry *color) const;
|
2010-03-25 20:38:00 +00:00
|
|
|
|
|
|
|
FString DisplayName; // Display name (used in menus, etc.)
|
|
|
|
FString SoundClass; // Sound class
|
|
|
|
FString Face; // Doom status bar face (when used)
|
2012-07-14 03:04:41 +00:00
|
|
|
FString Portrait;
|
2010-03-25 20:38:00 +00:00
|
|
|
FString Slot[10];
|
|
|
|
FName InvulMode;
|
|
|
|
FName HealingRadiusType;
|
|
|
|
fixed_t HexenArmor[5];
|
|
|
|
BYTE ColorRangeStart; // Skin color range
|
|
|
|
BYTE ColorRangeEnd;
|
2010-04-04 17:06:04 +00:00
|
|
|
FPlayerColorSetMap ColorSets;
|
2012-10-17 04:24:54 +00:00
|
|
|
PainFlashList PainFlashes;
|
2006-07-13 10:17:56 +00:00
|
|
|
};
|
2012-07-14 03:04:41 +00:00
|
|
|
FString GetPrintableDisplayName(PClassPlayerPawn *cls);
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-06-01 07:52:33 +00:00
|
|
|
class player_t;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class APlayerPawn : public AActor
|
|
|
|
{
|
2010-03-25 20:38:00 +00:00
|
|
|
DECLARE_CLASS_WITH_META(APlayerPawn, AActor, PClassPlayerPawn)
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
HAS_OBJECT_POINTERS
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
virtual void Serialize (FArchive &arc);
|
|
|
|
|
2009-03-12 03:54:23 +00:00
|
|
|
virtual void PostBeginPlay();
|
2006-05-14 14:30:13 +00:00
|
|
|
virtual void Tick();
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual void AddInventory (AInventory *item);
|
|
|
|
virtual void RemoveInventory (AInventory *item);
|
|
|
|
virtual bool UseInventory (AInventory *item);
|
2012-08-22 23:46:47 +00:00
|
|
|
virtual void MarkPrecacheSounds () const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
virtual void PlayIdle ();
|
|
|
|
virtual void PlayRunning ();
|
|
|
|
virtual void ThrowPoisonBag ();
|
|
|
|
virtual void TweakSpeeds (int &forwardmove, int &sidemove);
|
|
|
|
virtual void MorphPlayerThink ();
|
|
|
|
virtual void ActivateMorphWeapon ();
|
2012-07-14 03:04:41 +00:00
|
|
|
AWeapon *PickNewWeapon (PClassAmmo *ammotype);
|
|
|
|
AWeapon *BestWeapon (PClassAmmo *ammotype);
|
|
|
|
void CheckWeaponSwitch(PClassAmmo *ammotype);
|
2006-06-18 04:10:47 +00:00
|
|
|
virtual void GiveDeathmatchInventory ();
|
|
|
|
virtual void FilterCoopRespawnInventory (APlayerPawn *oldplayer);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-03-13 03:18:06 +00:00
|
|
|
void SetupWeaponSlots ();
|
2007-01-12 15:24:10 +00:00
|
|
|
void GiveDefaultInventory ();
|
2006-07-16 10:23:14 +00:00
|
|
|
void PlayAttacking ();
|
|
|
|
void PlayAttacking2 ();
|
2012-08-22 23:46:47 +00:00
|
|
|
const char *GetSoundClass () const;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
enum EInvulState
|
|
|
|
{
|
|
|
|
INVUL_Start,
|
|
|
|
INVUL_Active,
|
2006-04-23 20:12:27 +00:00
|
|
|
INVUL_Stop,
|
|
|
|
INVUL_GetAlpha
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void BeginPlay ();
|
2012-05-13 07:54:44 +00:00
|
|
|
void Die (AActor *source, AActor *inflictor, int dmgflags);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-15 15:28:46 +00:00
|
|
|
int crouchsprite;
|
2006-07-13 10:17:56 +00:00
|
|
|
int MaxHealth;
|
2009-08-07 04:20:28 +00:00
|
|
|
int MugShotMaxHealth;
|
2007-01-12 15:24:10 +00:00
|
|
|
int RunHealth;
|
2009-06-30 23:23:12 +00:00
|
|
|
int PlayerFlags;
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar
|
|
|
|
TObjPtr<AInventory> InvSel; // selected inventory item
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
// [GRB] Player class properties
|
|
|
|
fixed_t JumpZ;
|
2012-08-14 03:24:59 +00:00
|
|
|
fixed_t GruntSpeed;
|
|
|
|
fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed;
|
2006-07-13 10:17:56 +00:00
|
|
|
fixed_t ViewHeight;
|
|
|
|
fixed_t ForwardMove1, ForwardMove2;
|
|
|
|
fixed_t SideMove1, SideMove2;
|
2008-06-15 18:36:26 +00:00
|
|
|
FTextureID ScoreIcon;
|
2006-07-13 10:17:56 +00:00
|
|
|
int SpawnMask;
|
2006-08-31 00:16:12 +00:00
|
|
|
FNameNoInit MorphWeapon;
|
2007-03-07 17:31:40 +00:00
|
|
|
fixed_t AttackZOffset; // attack height, relative to player center
|
2012-07-14 03:04:41 +00:00
|
|
|
PClassActor *FlechetteType;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-01-26 16:42:16 +00:00
|
|
|
// [CW] Fades for when you are being damaged.
|
2009-05-15 10:39:40 +00:00
|
|
|
PalEntry DamageFade;
|
2008-01-26 16:42:16 +00:00
|
|
|
|
2007-02-04 00:22:56 +00:00
|
|
|
bool UpdateWaterLevel (fixed_t oldz, bool splash);
|
2008-07-19 12:40:10 +00:00
|
|
|
bool ResetAirSupply (bool playgasp = true);
|
2007-02-04 00:22:56 +00:00
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
int GetMaxHealth() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class APlayerChunk : public APlayerPawn
|
|
|
|
{
|
2008-08-09 11:35:42 +00:00
|
|
|
DECLARE_CLASS (APlayerChunk, APlayerPawn)
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2009-06-30 23:23:12 +00:00
|
|
|
//
|
|
|
|
// PlayerPawn flags
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PPF_NOTHRUSTWHENINVUL = 1, // Attacks do not thrust the player if they are invulnerable.
|
2012-07-15 03:10:00 +00:00
|
|
|
PPF_CANSUPERMORPH = 2, // Being remorphed into this class can give you a Tome of Power
|
2013-04-19 02:24:20 +00:00
|
|
|
PPF_CROUCHABLEMORPH = 4, // This morphed player can crouch
|
2009-06-30 23:23:12 +00:00
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// Player states.
|
|
|
|
//
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PST_LIVE, // Playing or camping.
|
|
|
|
PST_DEAD, // Dead on the ground, view follows killer.
|
|
|
|
PST_REBORN, // Ready to restart/respawn???
|
|
|
|
PST_ENTER // [BC] Entered the game
|
|
|
|
} playerstate_t;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Player internal flags, for cheats and debug.
|
|
|
|
//
|
|
|
|
typedef enum
|
|
|
|
{
|
2008-03-04 00:56:22 +00:00
|
|
|
CF_NOCLIP = 1 << 0, // No clipping, walk through barriers.
|
|
|
|
CF_GODMODE = 1 << 1, // No damage, no health loss.
|
2009-06-30 20:57:51 +00:00
|
|
|
CF_NOVELOCITY = 1 << 2, // Not really a cheat, just a debug aid.
|
2008-03-04 00:56:22 +00:00
|
|
|
CF_NOTARGET = 1 << 3, // [RH] Monsters don't target
|
|
|
|
CF_FLY = 1 << 4, // [RH] Flying player
|
|
|
|
CF_CHASECAM = 1 << 5, // [RH] Put camera behind player
|
|
|
|
CF_FROZEN = 1 << 6, // [RH] Don't let the player move
|
|
|
|
CF_REVERTPLEASE = 1 << 7, // [RH] Stick camera in player's head if (s)he moves
|
|
|
|
CF_STEPLEFT = 1 << 9, // [RH] Play left footstep sound next time
|
|
|
|
CF_FRIGHTENING = 1 << 10, // [RH] Scare monsters away
|
|
|
|
CF_INSTANTWEAPSWITCH= 1 << 11, // [RH] Switch weapons instantly
|
|
|
|
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
|
|
|
|
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
|
|
|
|
CF_DRAIN = 1 << 16, // Player owns a drain powerup
|
2009-06-07 16:38:19 +00:00
|
|
|
CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;)
|
2008-03-04 00:56:22 +00:00
|
|
|
CF_REFLECTION = 1 << 19,
|
|
|
|
CF_PROSPERITY = 1 << 20,
|
2009-06-07 16:38:19 +00:00
|
|
|
CF_DOUBLEFIRINGSPEED= 1 << 21, // Player owns a double firing speed artifact
|
2008-03-04 00:56:22 +00:00
|
|
|
CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths.
|
2009-06-07 16:38:19 +00:00
|
|
|
CF_INFINITEAMMO = 1 << 23, // Player owns an infinite ammo artifact
|
2009-08-07 04:08:38 +00:00
|
|
|
CF_BUDDHA = 1 << 27, // [SP] Buddha mode - take damage, but don't die
|
2012-08-22 21:31:48 +00:00
|
|
|
CF_NOCLIP2 = 1 << 30, // [RH] More Quake-like noclip
|
2006-02-24 04:48:15 +00:00
|
|
|
} cheat_t;
|
|
|
|
|
2013-01-25 03:09:17 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WF_WEAPONREADY = 1 << 0, // [RH] Weapon is in the ready state and can fire its primary attack
|
|
|
|
WF_WEAPONBOBBING = 1 << 1, // [HW] Bob weapon while the player is moving
|
|
|
|
WF_WEAPONREADYALT = 1 << 2, // Weapon can fire its secondary attack
|
|
|
|
WF_WEAPONSWITCHOK = 1 << 3, // It is okay to switch away from this weapon
|
2013-02-05 02:27:35 +00:00
|
|
|
WF_DISABLESWITCH = 1 << 4, // Disable weapon switching completely
|
2013-01-25 03:09:17 +00:00
|
|
|
WF_WEAPONRELOADOK = 1 << 5, // [XA] Okay to reload this weapon.
|
|
|
|
WF_WEAPONZOOMOK = 1 << 6, // [XA] Okay to use weapon zoom function.
|
2013-02-22 02:42:42 +00:00
|
|
|
WF_REFIRESWITCHOK = 1 << 7, // Mirror WF_WEAPONSWITCHOK for A_ReFire
|
2013-01-25 03:09:17 +00:00
|
|
|
};
|
|
|
|
|
2006-05-26 04:38:22 +00:00
|
|
|
#define WPIECE1 1
|
|
|
|
#define WPIECE2 2
|
|
|
|
#define WPIECE3 4
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#define WP_NOCHANGE ((AWeapon*)~0)
|
|
|
|
|
2008-09-15 00:47:31 +00:00
|
|
|
|
|
|
|
#define MAXPLAYERNAME 15
|
|
|
|
|
2013-05-12 18:27:03 +00:00
|
|
|
// [GRB] Custom player classes
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PCF_NOMENU = 1, // Hide in new game menu
|
|
|
|
};
|
|
|
|
|
|
|
|
class FPlayerClass
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FPlayerClass ();
|
|
|
|
FPlayerClass (const FPlayerClass &other);
|
|
|
|
~FPlayerClass ();
|
|
|
|
|
|
|
|
bool CheckSkin (int skin);
|
|
|
|
|
2013-06-07 03:31:30 +00:00
|
|
|
PClassPlayerPawn *Type;
|
2013-05-12 18:27:03 +00:00
|
|
|
DWORD Flags;
|
|
|
|
TArray<int> Skins;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern TArray<FPlayerClass> PlayerClasses;
|
|
|
|
|
|
|
|
// User info (per-player copies of each CVAR_USERINFO cvar)
|
2008-09-15 00:47:31 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GENDER_MALE,
|
|
|
|
GENDER_FEMALE,
|
|
|
|
GENDER_NEUTER
|
|
|
|
};
|
|
|
|
|
2013-05-12 18:27:03 +00:00
|
|
|
struct userinfo_t : TMap<FName,FBaseCVar *>
|
2008-09-15 00:47:31 +00:00
|
|
|
{
|
2013-05-12 18:27:03 +00:00
|
|
|
int GetAimDist() const
|
|
|
|
{
|
|
|
|
if (dmflags2 & DF2_NOAUTOAIM)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
float aim = *static_cast<FFloatCVar *>(*CheckKey(NAME_Autoaim));
|
|
|
|
if (aim > 35 || aim < 0)
|
|
|
|
{
|
|
|
|
return ANGLE_1*35;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return xs_RoundToInt(fabs(aim * ANGLE_1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const char *GetName() const
|
|
|
|
{
|
|
|
|
return *static_cast<FStringCVar *>(*CheckKey(NAME_Name));
|
|
|
|
}
|
|
|
|
int GetTeam() const
|
|
|
|
{
|
|
|
|
return *static_cast<FIntCVar *>(*CheckKey(NAME_Team));
|
|
|
|
}
|
|
|
|
int GetColorSet() const
|
|
|
|
{
|
|
|
|
return *static_cast<FIntCVar *>(*CheckKey(NAME_ColorSet));
|
|
|
|
}
|
|
|
|
uint32 GetColor() const
|
|
|
|
{
|
|
|
|
return *static_cast<FColorCVar *>(*CheckKey(NAME_Color));
|
|
|
|
}
|
|
|
|
bool GetNeverSwitch() const
|
|
|
|
{
|
|
|
|
return *static_cast<FBoolCVar *>(*CheckKey(NAME_NeverSwitchOnPickup));
|
|
|
|
}
|
|
|
|
fixed_t GetMoveBob() const
|
|
|
|
{
|
|
|
|
return FLOAT2FIXED(*static_cast<FFloatCVar *>(*CheckKey(NAME_MoveBob)));
|
|
|
|
}
|
|
|
|
fixed_t GetStillBob() const
|
|
|
|
{
|
|
|
|
return FLOAT2FIXED(*static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob)));
|
|
|
|
}
|
|
|
|
int GetPlayerClassNum() const
|
|
|
|
{
|
|
|
|
return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass));
|
|
|
|
}
|
2013-06-07 03:31:30 +00:00
|
|
|
PClassPlayerPawn *GetPlayerClassType() const
|
2013-05-12 18:27:03 +00:00
|
|
|
{
|
|
|
|
return PlayerClasses[GetPlayerClassNum()].Type;
|
|
|
|
}
|
|
|
|
int GetSkin() const
|
|
|
|
{
|
|
|
|
return *static_cast<FIntCVar *>(*CheckKey(NAME_Skin));
|
|
|
|
}
|
|
|
|
int GetGender() const
|
|
|
|
{
|
|
|
|
return *static_cast<FIntCVar *>(*CheckKey(NAME_Gender));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset();
|
|
|
|
int TeamChanged(int team);
|
|
|
|
int SkinChanged(const char *skinname);
|
|
|
|
int SkinNumChanged(int skinnum);
|
|
|
|
int GenderChanged(const char *gendername);
|
|
|
|
int PlayerClassChanged(const char *classname);
|
|
|
|
int PlayerClassNumChanged(int classnum);
|
|
|
|
uint32 ColorChanged(const char *colorname);
|
|
|
|
uint32 ColorChanged(uint32 colorval);
|
|
|
|
int ColorSetChanged(int setnum);
|
2008-09-15 00:47:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
FArchive &operator<< (FArchive &arc, userinfo_t &info);
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// Extended player object info: player_t
|
|
|
|
//
|
2008-06-01 07:52:33 +00:00
|
|
|
class player_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-06-01 07:52:33 +00:00
|
|
|
player_t();
|
2006-05-16 02:50:18 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void Serialize (FArchive &arc);
|
2008-03-13 23:00:33 +00:00
|
|
|
size_t FixPointers (const DObject *obj, DObject *replacement);
|
2008-03-12 02:56:11 +00:00
|
|
|
size_t PropagateMark();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void SetLogNumber (int num);
|
|
|
|
void SetLogText (const char *text);
|
2011-12-14 00:16:19 +00:00
|
|
|
void SendPitchLimits() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
APlayerPawn *mo;
|
|
|
|
BYTE playerstate;
|
|
|
|
ticcmd_t cmd;
|
2008-09-13 02:55:45 +00:00
|
|
|
usercmd_t original_cmd;
|
|
|
|
DWORD original_oldbuttons;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
userinfo_t userinfo; // [RH] who is this?
|
|
|
|
|
2010-04-03 04:07:17 +00:00
|
|
|
PClassPlayerPawn *cls; // class of associated PlayerPawn
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
float DesiredFOV; // desired field of vision
|
|
|
|
float FOV; // current field of vision
|
|
|
|
fixed_t viewz; // focal origin above r.z
|
|
|
|
fixed_t viewheight; // base height above floor for viewz
|
|
|
|
fixed_t deltaviewheight; // squat speed.
|
2009-06-30 20:57:51 +00:00
|
|
|
fixed_t bob; // bounded/scaled total velocity
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
|
2009-06-30 20:57:51 +00:00
|
|
|
// mo->velx and mo->vely represent true velocity experienced by player.
|
2006-02-24 04:48:15 +00:00
|
|
|
// This only represents the thrust that the player applies himself.
|
2009-09-14 09:41:09 +00:00
|
|
|
// This avoids anomalies with such things as Boom ice and conveyors.
|
2009-06-30 20:57:51 +00:00
|
|
|
fixed_t velx, vely; // killough 10/98
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool centering;
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE turnticks;
|
2011-12-06 01:25:37 +00:00
|
|
|
|
2011-12-14 00:16:19 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
bool attackdown;
|
2009-12-25 11:09:56 +00:00
|
|
|
bool usedown;
|
2008-09-13 02:55:45 +00:00
|
|
|
DWORD oldbuttons;
|
2006-02-24 04:48:15 +00:00
|
|
|
int health; // only used between levels, mo->health
|
|
|
|
// is used during levels
|
|
|
|
|
|
|
|
int inventorytics;
|
|
|
|
BYTE CurrentPlayerClass; // class # for this player instance
|
|
|
|
bool backpack;
|
|
|
|
|
|
|
|
int frags[MAXPLAYERS]; // kills of other players
|
|
|
|
int fragcount; // [RH] Cumulative frags for this player
|
|
|
|
int lastkilltime; // [RH] For multikills
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE multicount;
|
|
|
|
BYTE spreecount; // [RH] Keep track of killing sprees
|
2013-01-25 03:09:17 +00:00
|
|
|
BYTE WeaponState;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
AWeapon *ReadyWeapon;
|
|
|
|
AWeapon *PendingWeapon; // WP_NOCHANGE if not changing
|
|
|
|
|
|
|
|
int cheats; // bit flags
|
2012-04-27 01:40:50 +00:00
|
|
|
int timefreezer; // Player has an active time freezer
|
2006-02-24 04:48:15 +00:00
|
|
|
short refire; // refired shots are less accurate
|
|
|
|
short inconsistant;
|
2013-05-25 22:01:26 +00:00
|
|
|
bool waiting;
|
2006-02-24 04:48:15 +00:00
|
|
|
int killcount, itemcount, secretcount; // for intermission
|
|
|
|
int damagecount, bonuscount;// for screen flashing
|
|
|
|
int hazardcount; // for delayed Strife damage
|
|
|
|
int poisoncount; // screen flash for poison damage
|
2012-03-23 20:57:10 +00:00
|
|
|
FName poisontype; // type of poison damage to apply
|
|
|
|
FName poisonpaintype; // type of Pain state to enter for poison damage
|
2008-06-16 07:10:08 +00:00
|
|
|
TObjPtr<AActor> poisoner; // NULL for non-player actors
|
|
|
|
TObjPtr<AActor> attacker; // who did damage (NULL for floors)
|
2006-02-24 04:48:15 +00:00
|
|
|
int extralight; // so gun flashes light up areas
|
2009-09-20 03:50:05 +00:00
|
|
|
short fixedcolormap; // can be set to REDCOLORMAP, etc.
|
|
|
|
short fixedlightlevel;
|
2006-02-24 04:48:15 +00:00
|
|
|
pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
|
|
|
|
int morphTics; // player is a chicken/pig if > 0
|
2010-09-16 03:14:32 +00:00
|
|
|
PClassPlayerPawn *MorphedPlayerClass; // [MH] (for SBARINFO) class # for this player instance when morphed
|
2008-04-08 08:53:42 +00:00
|
|
|
int MorphStyle; // which effects to apply for this player instance when morphed
|
2010-04-03 04:07:17 +00:00
|
|
|
PClassActor *MorphExitFlash; // flash to apply when demorphing (cache of value given to P_MorphPlayer)
|
2008-06-15 23:09:01 +00:00
|
|
|
TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing
|
2006-02-24 04:48:15 +00:00
|
|
|
int chickenPeck; // chicken peck countdown
|
|
|
|
int jumpTics; // delay the next jump for a moment
|
|
|
|
|
|
|
|
int respawn_time; // [RH] delay respawning until this tic
|
2008-06-16 07:10:08 +00:00
|
|
|
TObjPtr<AActor> camera; // [RH] Whose eyes this player sees through
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
int air_finished; // [RH] Time when you start drowning
|
|
|
|
|
2007-01-28 04:59:04 +00:00
|
|
|
FName LastDamageType; // [RH] For damage-specific pain and death sounds
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//Added by MC:
|
|
|
|
angle_t savedyaw;
|
|
|
|
int savedpitch;
|
|
|
|
|
|
|
|
angle_t angle; // The wanted angle that the bot try to get every tic.
|
|
|
|
// (used to get a smoth view movement)
|
2008-06-16 07:40:28 +00:00
|
|
|
TObjPtr<AActor> dest; // Move Destination.
|
2008-06-16 07:10:08 +00:00
|
|
|
TObjPtr<AActor> prev; // Previous move destination.
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2008-06-16 07:10:08 +00:00
|
|
|
TObjPtr<AActor> enemy; // The dead meat.
|
2011-12-06 01:25:37 +00:00
|
|
|
TObjPtr<AActor> missile; // A threatening missile that needs to be avoided.
|
|
|
|
TObjPtr<AActor> mate; // Friend (used for grouping in teamplay or coop).
|
|
|
|
TObjPtr<AActor> last_mate; // If bots mate disappeared (not if died) that mate is
|
2006-02-24 04:48:15 +00:00
|
|
|
// pointed to by this. Allows bot to roam to it if
|
|
|
|
// necessary.
|
|
|
|
|
2008-02-16 15:02:52 +00:00
|
|
|
bool settings_controller; // Player can control game settings.
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//Skills
|
|
|
|
struct botskill_t skill;
|
|
|
|
|
|
|
|
//Tickers
|
|
|
|
int t_active; // Open door, lower lift stuff, door must open and
|
|
|
|
// lift must go down before bot does anything
|
|
|
|
// radical like try a stuckmove
|
|
|
|
int t_respawn;
|
|
|
|
int t_strafe;
|
|
|
|
int t_react;
|
|
|
|
int t_fight;
|
|
|
|
int t_roam;
|
|
|
|
int t_rocket;
|
|
|
|
|
|
|
|
//Misc booleans
|
|
|
|
bool isbot;
|
|
|
|
bool first_shot; // Used for reaction skill.
|
|
|
|
bool sleft; // If false, strafe is right.
|
|
|
|
bool allround;
|
|
|
|
|
|
|
|
fixed_t oldx;
|
|
|
|
fixed_t oldy;
|
|
|
|
|
|
|
|
float BlendR; // [RH] Final blending values
|
|
|
|
float BlendG;
|
|
|
|
float BlendB;
|
|
|
|
float BlendA;
|
|
|
|
|
2006-05-11 04:00:58 +00:00
|
|
|
FString LogText; // [RH] Log for Strife
|
2006-04-11 16:27:41 +00:00
|
|
|
|
2011-12-06 01:25:37 +00:00
|
|
|
int MinPitch; // Viewpitch limits (negative is up, positive is down)
|
|
|
|
int MaxPitch;
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
SBYTE crouching;
|
|
|
|
SBYTE crouchdir;
|
2006-05-14 14:30:13 +00:00
|
|
|
fixed_t crouchfactor;
|
|
|
|
fixed_t crouchoffset;
|
|
|
|
fixed_t crouchviewdelta;
|
2006-04-11 16:27:41 +00:00
|
|
|
|
2009-02-20 22:28:48 +00:00
|
|
|
FWeaponSlots weapons;
|
|
|
|
|
2008-03-26 08:29:02 +00:00
|
|
|
// [CW] I moved these here for multiplayer conversation support.
|
2008-06-16 07:10:08 +00:00
|
|
|
TObjPtr<AActor> ConversationNPC, ConversationPC;
|
2008-03-26 08:29:02 +00:00
|
|
|
angle_t ConversationNPCAngle;
|
|
|
|
bool ConversationFaceTalker;
|
|
|
|
|
2006-04-11 16:27:41 +00:00
|
|
|
fixed_t GetDeltaViewHeight() const
|
|
|
|
{
|
2006-07-13 10:17:56 +00:00
|
|
|
return (mo->ViewHeight + crouchviewdelta - viewheight) >> 3;
|
2006-05-14 14:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Uncrouch()
|
|
|
|
{
|
|
|
|
crouchfactor = FRACUNIT;
|
|
|
|
crouchoffset = 0;
|
|
|
|
crouchdir = 0;
|
|
|
|
crouching = 0;
|
|
|
|
crouchviewdelta = 0;
|
2006-04-11 16:27:41 +00:00
|
|
|
}
|
2013-04-28 02:31:34 +00:00
|
|
|
|
|
|
|
bool CanCrouch() const
|
|
|
|
{
|
|
|
|
return morphTics == 0 || mo->PlayerFlags & PPF_CROUCHABLEMORPH;
|
|
|
|
}
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
int GetSpawnClass();
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Bookkeeping on players - state.
|
2008-06-01 07:52:33 +00:00
|
|
|
extern player_t players[MAXPLAYERS];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-07-06 14:20:54 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, player_t *&p);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-01-21 22:30:30 +00:00
|
|
|
void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley);
|
2006-06-11 11:28:48 +00:00
|
|
|
|
2012-06-09 04:15:56 +00:00
|
|
|
inline void AActor::SetFriendPlayer(player_t *player)
|
|
|
|
{
|
|
|
|
if (player == NULL)
|
|
|
|
{
|
|
|
|
FriendPlayer = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FriendPlayer = int(player - players) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-22 21:31:48 +00:00
|
|
|
inline bool AActor::IsNoClip2() const
|
|
|
|
{
|
|
|
|
if (player != NULL && player->mo == this)
|
|
|
|
{
|
|
|
|
return (player->cheats & CF_NOCLIP2) != 0;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2006-06-11 11:28:48 +00:00
|
|
|
|
2006-05-14 14:30:13 +00:00
|
|
|
#define CROUCHSPEED (FRACUNIT/12)
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2012-01-22 00:31:42 +00:00
|
|
|
bool P_IsPlayerTotallyFrozen(const player_t *player);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif // __D_PLAYER_H__
|