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"
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
#include "d_netinf.h"
|
|
|
|
|
|
|
|
//Added by MC:
|
|
|
|
#include "b_bot.h"
|
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
APMETA_BASE = 0x95000,
|
|
|
|
|
|
|
|
APMETA_DisplayName, // display name (used in menus etc.)
|
|
|
|
APMETA_SoundClass, // sound class
|
|
|
|
APMETA_ColorRange, // skin color range
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class player_s;
|
|
|
|
|
|
|
|
class APlayerPawn : public AActor
|
|
|
|
{
|
|
|
|
DECLARE_STATELESS_ACTOR (APlayerPawn, AActor)
|
- 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);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
virtual void PlayIdle ();
|
|
|
|
virtual void PlayRunning ();
|
|
|
|
virtual void ThrowPoisonBag ();
|
|
|
|
virtual void GiveDefaultInventory ();
|
|
|
|
virtual void TweakSpeeds (int &forwardmove, int &sidemove);
|
|
|
|
virtual bool DoHealingRadius (APlayerPawn *other);
|
|
|
|
virtual void MorphPlayerThink ();
|
|
|
|
virtual void ActivateMorphWeapon ();
|
2006-05-10 02:40:43 +00:00
|
|
|
virtual AWeapon *PickNewWeapon (const PClass *ammotype);
|
|
|
|
virtual AWeapon *BestWeapon (const PClass *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
|
|
|
|
2006-07-16 10:23:14 +00:00
|
|
|
void PlayAttacking ();
|
|
|
|
void PlayAttacking2 ();
|
2006-07-13 10:17:56 +00:00
|
|
|
const char *GetSoundClass ();
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2006-04-23 20:12:27 +00:00
|
|
|
virtual void SpecialInvulnerabilityHandling (EInvulState state, fixed_t * pAlpha=NULL);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void BeginPlay ();
|
|
|
|
void Die (AActor *source, AActor *inflictor);
|
|
|
|
|
2006-05-15 15:28:46 +00:00
|
|
|
int crouchsprite;
|
2006-07-13 10:17:56 +00:00
|
|
|
int MaxHealth;
|
- 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
|
|
|
AInventory *InvFirst; // first inventory item displayed on inventory bar
|
|
|
|
AInventory *InvSel; // selected inventory item
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
// [GRB] Player class properties
|
|
|
|
fixed_t JumpZ;
|
|
|
|
fixed_t ViewHeight;
|
|
|
|
fixed_t ForwardMove1, ForwardMove2;
|
|
|
|
fixed_t SideMove1, SideMove2;
|
|
|
|
int ScoreIcon;
|
|
|
|
int SpawnMask;
|
2006-08-31 00:16:12 +00:00
|
|
|
FNameNoInit MorphWeapon;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
int GetMaxHealth() const;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class APlayerChunk : public APlayerPawn
|
|
|
|
{
|
|
|
|
DECLARE_STATELESS_ACTOR (APlayerChunk, APlayerPawn)
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
{
|
|
|
|
CF_NOCLIP = 1, // No clipping, walk through barriers.
|
|
|
|
CF_GODMODE = 2, // No damage, no health loss.
|
|
|
|
CF_NOMOMENTUM = 4, // Not really a cheat, just a debug aid.
|
|
|
|
CF_NOTARGET = 8, // [RH] Monsters don't target
|
|
|
|
CF_FLY = 16, // [RH] Flying player
|
|
|
|
CF_CHASECAM = 32, // [RH] Put camera behind player
|
|
|
|
CF_FROZEN = 64, // [RH] Don't let the player move
|
|
|
|
CF_REVERTPLEASE = 128, // [RH] Stick camera in player's head if (s)he moves
|
|
|
|
CF_STEPLEFT = 512, // [RH] Play left footstep sound next time
|
|
|
|
CF_FRIGHTENING = 1024, // [RH] Scare monsters away
|
|
|
|
CF_INSTANTWEAPSWITCH= 2048, // [RH] Switch weapons instantly
|
|
|
|
CF_TOTALLYFROZEN = 4096, // [RH] All players can do is press +use
|
|
|
|
CF_PREDICTING = 8192, // [RH] Player movement is being predicted
|
|
|
|
CF_WEAPONREADY = 16384,// [RH] Weapon is in the ready state, so bob it when walking
|
|
|
|
} cheat_t;
|
|
|
|
|
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
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PW_INVULNERABILITY = 1,
|
|
|
|
PW_INVISIBILITY = 2,
|
|
|
|
PW_INFRARED = 4,
|
|
|
|
|
|
|
|
// Powerups added in Heretic
|
|
|
|
PW_WEAPONLEVEL2 = 8,
|
|
|
|
PW_FLIGHT = 16,
|
|
|
|
|
|
|
|
// Powerups added in Hexen
|
|
|
|
PW_SPEED = 32,
|
|
|
|
PW_MINOTAUR = 64,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define WP_NOCHANGE ((AWeapon*)~0)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Extended player object info: player_t
|
|
|
|
//
|
|
|
|
class player_s
|
|
|
|
{
|
|
|
|
public:
|
2006-05-16 02:50:18 +00:00
|
|
|
player_s();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
void FixPointers (const DObject *obj, DObject *replacement);
|
|
|
|
|
|
|
|
void SetLogNumber (int num);
|
|
|
|
void SetLogText (const char *text);
|
|
|
|
|
|
|
|
APlayerPawn *mo;
|
|
|
|
BYTE playerstate;
|
|
|
|
ticcmd_t cmd;
|
|
|
|
|
|
|
|
userinfo_t userinfo; // [RH] who is this?
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *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.
|
|
|
|
fixed_t bob; // bounded/scaled total momentum
|
|
|
|
|
|
|
|
// killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
|
|
|
|
// mo->momx and mo->momy represent true momenta experienced by player.
|
|
|
|
// This only represents the thrust that the player applies himself.
|
|
|
|
// This avoids anomolies with such things as Boom ice and conveyors.
|
|
|
|
fixed_t momx, momy; // killough 10/98
|
|
|
|
|
|
|
|
bool centering;
|
2006-09-14 00:02:31 +00:00
|
|
|
BYTE turnticks;
|
2006-02-24 04:48:15 +00:00
|
|
|
short oldbuttons;
|
|
|
|
bool attackdown;
|
|
|
|
int health; // only used between levels, mo->health
|
|
|
|
// is used during levels
|
|
|
|
|
|
|
|
int inventorytics;
|
|
|
|
BYTE CurrentPlayerClass; // class # for this player instance
|
|
|
|
int pieces; // Fourth Weapon pieces
|
|
|
|
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
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
AWeapon *ReadyWeapon;
|
|
|
|
AWeapon *PendingWeapon; // WP_NOCHANGE if not changing
|
|
|
|
|
|
|
|
int cheats; // bit flags
|
|
|
|
BITFIELD Powers; // powers
|
|
|
|
short refire; // refired shots are less accurate
|
|
|
|
short inconsistant;
|
|
|
|
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
|
|
|
|
AActor *poisoner; // NULL for non-player actors
|
|
|
|
AActor *attacker; // who did damage (NULL for floors)
|
|
|
|
int extralight; // so gun flashes light up areas
|
|
|
|
int fixedcolormap; // can be set to REDCOLORMAP, etc.
|
|
|
|
pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc)
|
|
|
|
int morphTics; // player is a chicken/pig if > 0
|
|
|
|
AWeapon *PremorphWeapon; // ready weapon before morphing
|
|
|
|
int chickenPeck; // chicken peck countdown
|
|
|
|
int jumpTics; // delay the next jump for a moment
|
|
|
|
|
|
|
|
int respawn_time; // [RH] delay respawning until this tic
|
|
|
|
AActor *camera; // [RH] Whose eyes this player sees through
|
|
|
|
|
|
|
|
int air_finished; // [RH] Time when you start drowning
|
|
|
|
|
|
|
|
WORD accuracy, stamina; // [RH] Strife stats
|
|
|
|
|
|
|
|
//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)
|
|
|
|
AActor *dest; // Move Destination.
|
|
|
|
AActor *prev; // Previous move destination.
|
|
|
|
|
|
|
|
|
|
|
|
AActor *enemy; // The dead meat.
|
|
|
|
AActor *missile; // A threathing missile that got to be avoided.
|
|
|
|
AActor *mate; // Friend (used for grouping in templay or coop.
|
|
|
|
AActor *last_mate; // If bots mate dissapeared (not if died) that mate is
|
|
|
|
// pointed to by this. Allows bot to roam to it if
|
|
|
|
// necessary.
|
|
|
|
|
|
|
|
//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
|
|
|
|
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
|
|
|
|
|
|
|
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
|
|
|
}
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
int GetSpawnClass();
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef player_s player_t;
|
|
|
|
|
|
|
|
// Bookkeeping on players - state.
|
|
|
|
extern player_s players[MAXPLAYERS];
|
|
|
|
|
|
|
|
inline FArchive &operator<< (FArchive &arc, player_s *&p)
|
|
|
|
{
|
|
|
|
return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players));
|
|
|
|
}
|
|
|
|
|
2006-06-11 11:28:48 +00:00
|
|
|
void P_CheckPlayerSprites();
|
|
|
|
|
|
|
|
|
2006-05-14 14:30:13 +00:00
|
|
|
#define CROUCHSPEED (FRACUNIT/12)
|
2006-02-24 04:48:15 +00:00
|
|
|
#define MAX_DN_ANGLE 56 // Max looking down angle
|
|
|
|
#define MAX_UP_ANGLE 32 // Max looking up angle
|
|
|
|
|
2006-07-13 10:17:56 +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);
|
|
|
|
|
|
|
|
const PClass *Type;
|
|
|
|
DWORD Flags;
|
|
|
|
TArray<int> Skins;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern TArray<FPlayerClass> PlayerClasses;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif // __D_PLAYER_H__
|