2017-11-11 17:17:49 +01:00
|
|
|
#ifndef GRAVGUNMOD_H
|
|
|
|
#define GRAVGUNMOD_H
|
|
|
|
|
|
|
|
|
|
|
|
extern cvar_t cvar_allow_gravgun;
|
|
|
|
extern cvar_t cvar_allow_ar2;
|
|
|
|
extern cvar_t cvar_ar2_mp5;
|
|
|
|
extern cvar_t cvar_ar2_bullets;
|
|
|
|
extern cvar_t cvar_ar2_balls;
|
2018-08-23 22:01:36 +02:00
|
|
|
extern cvar_t cvar_allow_bigcock;
|
|
|
|
extern cvar_t cvar_allow_gateofbabylon;
|
2017-11-11 17:17:49 +01:00
|
|
|
extern cvar_t cvar_wresptime;
|
|
|
|
extern cvar_t cvar_iresptime;
|
|
|
|
|
|
|
|
extern cvar_t cvar_gibtime;
|
|
|
|
extern cvar_t cvar_hgibcount;
|
|
|
|
extern cvar_t cvar_agibcount;
|
|
|
|
|
|
|
|
extern cvar_t mp_spectator;
|
|
|
|
extern cvar_t mp_fixhornetbug;
|
|
|
|
extern cvar_t mp_checkentities;
|
2018-07-28 23:03:48 +02:00
|
|
|
extern cvar_t mp_touchmenu;
|
2018-08-14 15:46:18 +02:00
|
|
|
extern cvar_t mp_fixsavetime;
|
2017-11-11 17:17:49 +01:00
|
|
|
|
2018-08-05 20:38:34 +02:00
|
|
|
// distance clipping (client.cpp)
|
2018-08-07 21:33:48 +02:00
|
|
|
// useful for open world
|
2018-08-05 20:38:34 +02:00
|
|
|
extern cvar_t mp_serverdistclip;
|
|
|
|
extern cvar_t mp_maxbmodeldist;
|
|
|
|
extern cvar_t mp_maxtrashdist;
|
|
|
|
extern cvar_t mp_maxwaterdist;
|
2018-08-07 20:19:27 +02:00
|
|
|
extern cvar_t mp_maxmonsterdist;
|
2018-08-05 20:38:34 +02:00
|
|
|
extern cvar_t mp_maxotherdist;
|
2018-08-08 10:29:10 +02:00
|
|
|
extern cvar_t mp_enttools_checkmodels;
|
2018-08-07 21:33:48 +02:00
|
|
|
|
|
|
|
// tempentity clipping
|
|
|
|
// if enabled, ignores PVS, so use only on open world
|
2018-08-07 19:28:23 +02:00
|
|
|
extern cvar_t mp_servercliptents;
|
|
|
|
extern cvar_t mp_maxtentdist;
|
2018-08-05 20:38:34 +02:00
|
|
|
|
2018-08-07 21:33:48 +02:00
|
|
|
// control decals count from server
|
|
|
|
// decals is unuseful on sandbox servers
|
|
|
|
// 100 instancs of single bmodel with 100 decals
|
|
|
|
// will cause in 10000 decals in frame
|
|
|
|
// r_decals limit does not cover it because it
|
|
|
|
// only limit decal count on different models
|
|
|
|
|
|
|
|
extern cvar_t mp_maxdecals;
|
|
|
|
|
2017-11-11 17:17:49 +01:00
|
|
|
void GGM_RegisterCVars( void );
|
2018-10-08 18:15:41 +02:00
|
|
|
#define GC_COMMON (1<<0)
|
|
|
|
#define GC_ENTTOOLS (1<<1)
|
|
|
|
void Ent_RunGC( int flags, const char *userid, const char *pattern = NULL );
|
2018-08-03 19:35:22 +02:00
|
|
|
bool Q_stricmpext( const char *pattern, const char *text );
|
2017-11-11 22:29:47 +01:00
|
|
|
class CBasePlayer;
|
|
|
|
void GGM_ClientPutinServer(edict_t *pEntity , CBasePlayer *pPlayer);
|
|
|
|
void GGM_ClientFirstSpawn(CBasePlayer *pPlayer );
|
|
|
|
const char *GGM_GetPlayerID( edict_t *player );
|
|
|
|
edict_t *GGM_PlayerByID( const char *id );
|
2018-07-29 11:43:58 +02:00
|
|
|
void GGM_Say( edict_t *pEntity );
|
2018-10-13 18:37:52 +02:00
|
|
|
bool GGM_ClientCommand( CBasePlayer *player, const char *pCmd );
|
2018-08-01 19:22:03 +02:00
|
|
|
void GGM_InitialMenus( CBasePlayer *pPlayer );
|
|
|
|
void GGM_CvarValue2( const edict_t *pEnt, int requestID, const char *cvarName, const char *value );
|
|
|
|
|
2017-11-11 22:29:47 +01:00
|
|
|
enum PlayerState
|
|
|
|
{
|
|
|
|
STATE_UNINITIALIZED = 0,
|
|
|
|
STATE_CONNECTED,
|
|
|
|
STATE_SPECTATOR_BEGIN,
|
|
|
|
STATE_SPAWNED,
|
|
|
|
STATE_SPECTATOR,
|
|
|
|
STATE_POINT_SELECT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum PlayerMenuState
|
|
|
|
{
|
|
|
|
MENUSTATE_NONE = 0,
|
|
|
|
MENUSTATE_COOPMENU,
|
|
|
|
MENUSTATE_COOPMENU_SPEC,
|
|
|
|
MENUSTATE_CHECKPOINT,
|
|
|
|
MENUSTATE_GLOBAL,
|
|
|
|
MENUSTATE_LOCAL_CONFIRM
|
|
|
|
};
|
|
|
|
|
2018-07-28 23:03:48 +02:00
|
|
|
|
|
|
|
class GGM_PlayerMenu
|
|
|
|
{
|
|
|
|
struct GGM_MenuItem
|
|
|
|
{
|
|
|
|
char command[256];
|
|
|
|
char name[32];
|
|
|
|
} m_items[5];
|
|
|
|
int m_iCount;
|
|
|
|
char m_sTitle[32];
|
2018-07-31 06:12:50 +02:00
|
|
|
bool m_fShow;
|
2018-07-28 23:03:48 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
CBasePlayer *pPlayer;
|
|
|
|
bool MenuSelect( int select );
|
2018-07-29 21:07:40 +02:00
|
|
|
GGM_PlayerMenu &SetTitle( const char *title );
|
2018-07-31 06:12:50 +02:00
|
|
|
GGM_PlayerMenu &New( const char *title, bool force = true );
|
2018-07-28 23:03:48 +02:00
|
|
|
GGM_PlayerMenu &Add( const char *name, const char *command );
|
2018-08-01 14:42:46 +02:00
|
|
|
GGM_PlayerMenu &Clear( void );
|
2018-07-28 23:03:48 +02:00
|
|
|
void Show();
|
|
|
|
};
|
|
|
|
|
2018-10-17 11:32:23 +02:00
|
|
|
// full player map-independed position data
|
|
|
|
struct GGMPosition
|
|
|
|
{
|
|
|
|
Vector vecOrigin;
|
|
|
|
Vector vecAngles;
|
|
|
|
char mapName[32];
|
|
|
|
char trainGlobal[32];
|
|
|
|
Vector vecTrainOffset;
|
|
|
|
Vector vecTrainAngles;
|
|
|
|
bool fDuck;
|
|
|
|
};
|
2018-10-14 19:01:20 +02:00
|
|
|
|
2018-10-17 11:32:23 +02:00
|
|
|
// login records are persistent
|
2018-10-13 18:37:52 +02:00
|
|
|
struct GGMLogin
|
|
|
|
{
|
|
|
|
struct GGMLogin *pNext;
|
2018-10-14 19:01:20 +02:00
|
|
|
struct {
|
2018-10-13 18:37:52 +02:00
|
|
|
char uid[33];
|
|
|
|
char name[32];
|
2018-10-14 19:01:20 +02:00
|
|
|
} f;
|
2018-10-13 18:37:52 +02:00
|
|
|
struct GGMPlayerState *pState;
|
|
|
|
};
|
|
|
|
|
|
|
|
// registration and game stats
|
|
|
|
// saved on every change to separate file
|
|
|
|
// but only for registered users
|
|
|
|
struct GGMPersist
|
|
|
|
{
|
2018-10-15 06:23:12 +02:00
|
|
|
|
2018-10-13 18:37:52 +02:00
|
|
|
/// todo:salt/hash
|
|
|
|
char password[33];
|
|
|
|
};
|
|
|
|
|
|
|
|
// complete player state
|
|
|
|
// saved on save request, but kept in runtime
|
|
|
|
struct GGMTempState
|
|
|
|
{
|
|
|
|
float flHealth;
|
|
|
|
float flBattery;
|
|
|
|
int iFrags;
|
|
|
|
int iDeaths;
|
|
|
|
char rgWeapons[MAX_WEAPONS][32];// weapon names
|
|
|
|
char rgiClip[MAX_WEAPONS];// ammo names
|
|
|
|
int rgAmmo[MAX_AMMO_SLOTS];// ammo quantities
|
|
|
|
char WeaponName[32];
|
2018-10-17 11:32:23 +02:00
|
|
|
GGMPosition pos;
|
2018-10-13 18:37:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GGMPlayerState
|
|
|
|
{
|
|
|
|
struct GGMPlayerState *pNext;
|
|
|
|
struct GGMPersist p;
|
|
|
|
struct GGMTempState t;
|
2018-10-15 06:23:12 +02:00
|
|
|
bool fRegistered;
|
2018-10-14 19:01:20 +02:00
|
|
|
bool fNeedWrite;
|
2018-10-15 06:23:12 +02:00
|
|
|
// uid or nickname
|
|
|
|
char uid[33];
|
2018-10-13 18:37:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-11 22:29:47 +01:00
|
|
|
struct GGMData
|
|
|
|
{
|
2018-10-31 08:25:03 +01:00
|
|
|
float flSpawnTime;
|
|
|
|
PlayerState iState;
|
|
|
|
bool fTouchMenu;
|
|
|
|
int iLocalConfirm;
|
|
|
|
float flEntScore;
|
|
|
|
float flEntTime;
|
2018-07-28 23:03:48 +02:00
|
|
|
GGM_PlayerMenu menu;
|
2018-10-31 08:25:03 +01:00
|
|
|
bool fTouchLoading;
|
2018-10-13 18:37:52 +02:00
|
|
|
struct GGMPlayerState *pState;
|
2018-10-31 08:25:03 +01:00
|
|
|
char fRegisterInput[32];
|
2017-11-11 22:29:47 +01:00
|
|
|
};
|
2017-11-11 17:17:49 +01:00
|
|
|
|
2018-10-13 18:37:52 +02:00
|
|
|
struct GGMPlayerState *GGM_GetState(const char *uid, const char *name);
|
|
|
|
bool GGM_RestoreState( CBasePlayer *pPlayer );
|
2018-10-21 03:21:58 +02:00
|
|
|
bool GGM_RestorePosition( CBasePlayer *pPlayer, struct GGMPosition *pos );
|
|
|
|
void GGM_SavePosition( CBasePlayer *pPlayer, struct GGMPosition *pos );
|
2018-10-13 18:37:52 +02:00
|
|
|
void GGM_SaveState( CBasePlayer *pPlayer );
|
|
|
|
bool GGM_PlayerSpawn( CBasePlayer *pPlayer );
|
2018-10-14 19:01:20 +02:00
|
|
|
const char *GGM_GetAuthID( CBasePlayer *pPlayer );
|
2018-10-19 00:30:42 +02:00
|
|
|
void GGM_ServerActivate( void );
|
2018-10-24 23:51:23 +02:00
|
|
|
void COOP_SetupLandmarkTransition( const char *szNextMap, const char *szNextSpot, Vector vecLandmarkOffset, struct GGMPosition *pPos );
|
2018-10-27 08:06:53 +02:00
|
|
|
void GGM_ClearLists( void );
|
2017-11-11 17:17:49 +01:00
|
|
|
#endif // GRAVGUNMOD_H
|
|
|
|
|