29 #ifndef __GAME_LOCAL_H__
30 #define __GAME_LOCAL_H__
40 #define LAGO_IMG_WIDTH 64
41 #define LAGO_IMG_HEIGHT 64
43 #define LAGO_HEIGHT 44
44 #define LAGO_MATERIAL "textures/sfx/lagometer"
45 #define LAGO_IMAGE "textures/sfx/lagometer.tga"
48 #ifndef ASYNC_WRITE_PVS
49 #define ASYNC_WRITE_PVS 0
52 #ifdef ID_DEBUG_UNINITIALIZED_MEMORY
54 #define private public
55 #define protected public
62 #define GAME_VERSION "baseDOOM-1"
81 #define MAX_CLIENTS 32
82 #define GENTITYNUM_BITS 12
83 #define MAX_GENTITIES (1<<GENTITYNUM_BITS)
84 #define ENTITYNUM_NONE (MAX_GENTITIES-1)
85 #define ENTITYNUM_WORLD (MAX_GENTITIES-2)
86 #define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
219 template<
class type >
251 void Set(
int t,
int pt,
int ms,
int f,
int rct ) { time =
t; previousTime = pt; msec = ms; framenum =
f; realClientTime = rct; };
252 void Get(
int& t,
int& pt,
int& ms,
int& f,
int& rct ) { t = time; pt = previousTime; ms = msec; f = framenum; rct = realClientTime; };
255 void Increment() { framenum++; previousTime = time; time += msec; realClientTime = time; };
262 SLOWMO_STATE_RAMPDOWN
344 bool portalSkyActive;
346 void SetPortalSkyEnt(
idEntity *ent );
347 bool IsPortalSkyAcive();
352 slowmoState_t slowmoState;
355 bool quickSlowmoReset;
362 void ComputeSlowMsec();
363 void RunTimeGroup2();
365 void ResetSlowTimeVars();
366 void QuickSlowmoReset();
377 virtual void Init(
void );
394 virtual bool Draw(
int clientNum );
407 virtual void ClientReadSnapshot(
int clientNum,
int sequence,
const int gameFrame,
const int gameTime,
const int dupeUsercmds,
const int aheadOfServer,
const idBitMsg &msg );
413 virtual void SwitchTeam(
int clientNum,
int team );
447 bool CheatsOk(
bool requirePlayer = true );
474 void CalcFov(
float base_fov,
float &fov_x,
float &fov_y )
const;
581 int teamCurrentInitialSpot[2];
650 template<
class type >
655 template<
class type >
660 template<
class type >
665 template<
class type >
675 template<
class type >
679 if (
id == spawnId ) {
689 template<
class type >
694 template<
class type >
703 template<
class type >
734 #define MASK_ALL (-1)
735 #define MASK_SOLID (CONTENTS_SOLID)
736 #define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY)
737 #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY)
738 #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP)
739 #define MASK_WATER (CONTENTS_WATER)
740 #define MASK_OPAQUE (CONTENTS_OPAQUE)
741 #define MASK_SHOT_RENDERMODEL (CONTENTS_SOLID|CONTENTS_RENDERMODEL)
742 #define MASK_SHOT_BOUNDINGBOX (CONTENTS_SOLID|CONTENTS_BODY)
745 #define DEFAULT_GRAVITY_STRING "1066"
idPlayer * GetLocalPlayer() const
virtual void ServerWriteInitialReliableMessages(int clientNum)
virtual void GetBestGameType(const char *map, const char *gametype, char buf[MAX_STRING_CHARS])=0
void LocalMapRestart(void)
idStaticList< idEntity *, MAX_GENTITIES > initialSpots
void RandomizeInitialSpawns(void)
virtual void HandleMainMenuCommands(const char *menuCommand, idUserInterface *gui)
GLsizei const GLfloat * value
void RadiusPushClipModel(const idVec3 &origin, const float push, const idClipModel *clipModel)
const idDict * FindEntityDefDict(const char *name, bool makeDefault=true) const
static const int INITIAL_SPAWN_COUNT
void Restore(idRestoreGame *savefile)
idLinkList< idEntity > activeEntities
const int MAX_GLOBAL_SHADER_PARMS
void Tokenize(idStrList &out, const char *in)
virtual bool Draw(int clientNum)
void Printf(const char *fmt,...) const id_attribute((format(printf
virtual void ServerClientConnect(int clientNum, const char *guid)
type * GetEntity(void) const
const int MAX_EVENT_PARAM_SIZE
idPlayer * GetClientByCmdArgs(const idCmdArgs &args) const
GLenum GLsizei GLenum format
idSmokeParticles * smokeParticles
void WriteGameStateToSnapshot(idBitMsgDelta &msg) const
void MapClear(bool clearClients)
int GetSpawnId(const idEntity *ent) const
virtual escReply_t HandleESC(idUserInterface **gui)
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
virtual void SpawnPlayer(int clientNum)
int ClientRemapDecl(declType_t type, int index)
idEntity * FindEntity(const char *name) const
int spawnIds[MAX_GENTITIES]
void RadiusDamage(const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignoreDamage, idEntity *ignorePush, const char *damageDefName, float dmgPower=1.0f)
void SetupPlayerPVS(void)
void gameError(const char *fmt,...)
void void void void DWarning(const char *fmt,...) const id_attribute((format(printf
virtual const idDict * GetUserInfo(int clientNum)
void InitAsyncNetwork(void)
virtual bool ClientApplySnapshot(int clientNum, int sequence)
idLocationEntity ** locationEntities
GLint GLint GLsizei GLsizei GLsizei depth
void FreeSnapshotsOlderThanSequence(int clientNum, int sequence)
virtual const idDict * SetUserInfo(int clientNum, const idDict &userInfo, bool isClient, bool canModify)
void BloodSplat(const idVec3 &origin, const idVec3 &dir, float size, const char *material)
int GetNextClientNum(int current) const
GLuint GLuint GLsizei GLenum type
void void ServerProcessEntityNetworkEventQueue(void)
void UpdateLagometer(int aheadOfServer, int dupeUsercmds)
virtual void SetLocalClient(int clientNum)
byte paramsBuf[MAX_EVENT_PARAM_SIZE]
idLinkList< idEntity > snapshotEntities
void NetworkEventWarning(const entityNetEvent_t *event, const char *fmt,...) id_attribute((format(printf
idActor * GetAlertEntity(void)
void Free(entityNetEvent_t *event)
idSoundWorld * gameSoundWorld
idList< idAAS * > aasList
void SetGlobalMaterial(const idMaterial *mat)
idBlockAlloc< entityState_t, 256 > entityStateAllocator
const char * GetMapName(void) const
void InitLocalClient(int clientNum)
virtual bool InitFromSaveGame(const char *mapName, idRenderWorld *renderWorld, idSoundWorld *soundWorld, idFile *saveGameFile)
struct entityNetEvent_s * prev
int numEntitiesToDeactivate
idLocationEntity * LocationForPoint(const idVec3 &point)
void SetGibTime(int _time)
idEntity * SpawnEntityType(const idTypeInfo &classdef, const idDict *args=NULL, bool bIsClientReadSnapshot=false)
virtual void InitFromNewMap(const char *mapName, idRenderWorld *renderWorld, idSoundWorld *soundWorld, bool isServer, bool isClient, int randSeed)
void void void Warning(const char *fmt,...) const id_attribute((format(printf
virtual const idDict & GetPersistentPlayerInfo(int clientNum)
static void MapRestart_f(const idCmdArgs &args)
void GetShakeSounds(const idDict *dict)
void SetPortalState(qhandle_t portal, int blockingBits)
void KillBox(idEntity *ent, bool catch_teleport=false)
void ClientProcessEntityNetworkEventQueue(void)
int ServerRemapDecl(int clientNum, declType_t type, int index)
void CallFrameCommand(idEntity *ent, const function_t *frameCommand)
idEntity * FindTraceEntity(idVec3 start, idVec3 end, const idTypeInfo &c, const idEntity *skip) const
idAAS * GetAAS(int num) const
byte stateBuf[MAX_ENTITY_STATE_SIZE]
virtual void ServerClientBegin(int clientNum)
bool InhibitEntitySpawn(idDict &spawnArgs)
bool SpawnEntityDef(const idDict &args, idEntity **ent=NULL, bool setDefaults=true)
idGameError(const char *text)
virtual bool ServerApplySnapshot(int clientNum, int sequence)
const int MAX_ENTITY_STATE_SIZE
void InitScriptForMap(void)
void UnregisterEntity(idEntity *ent)
virtual void SwitchTeam(int clientNum, int team)
const idVec3 DEFAULT_GRAVITY_VEC3(0, 0,-DEFAULT_GRAVITY)
bool InPlayerConnectedArea(idEntity *ent) const
idCamera * GetCamera(void) const
virtual void SetPersistentPlayerInfo(int clientNum, const idDict &playerInfo)
static const char * sufaceTypeNames[MAX_SURFACE_TYPES]
idThread * frameCommandThread
virtual void ThrottleUserInfo(void)
virtual void SetServerInfo(const idDict &serverInfo)
void void DPrintf(const char *fmt,...) const id_attribute((format(printf
entityNetEvent_t * Dequeue(void)
void ServerSendChatMessage(int to, const char *name, const char *text)
GLsizei GLsizei GLenum GLenum const GLvoid * data
int GetSpawnId(void) const
void RadiusPush(const idVec3 &origin, const float radius, const float push, const idEntity *inflictor, const idEntity *ignore, float inflictorScale, const bool quake)
const idVec3 & GetGravity(void) const
pvsHandle_t playerConnectedAreas
virtual allowReply_t ServerAllowClient(int numClients, const char *IP, const char *guid, const char *password, char reason[MAX_STRING_CHARS])
idDict persistentLevelInfo
void ServerSendDeclRemapToClient(int clientNum, declType_t type, int index)
void ShutdownAsyncNetwork(void)
void RemoveAllAASObstacles(void)
virtual void ServerClientDisconnect(int clientNum)
virtual idUserInterface * StartMenu(void)
int EntitiesWithinRadius(const idVec3 org, float radius, idEntity **entityList, int maxCount) const
idMapFile * GetLevelMap(void)
struct entityNetEvent_s * next
void AddEntityToHash(const char *name, idEntity *ent)
gameState_t GameState(void) const
virtual void ClientProcessReliableMessage(int clientNum, const idBitMsg &msg)
void AlertAI(idEntity *ent)
struct entityNetEvent_s entityNetEvent_t
entityNetEvent_t * RemoveLast(void)
idStaticList< spawnSpot_t, MAX_GENTITIES > spawnSpots
const int ENTITY_PVS_SIZE
static int BitsForInteger(int i)
virtual const char * HandleGuiCommands(const char *menuCommand)
bool InPlayerPVS(idEntity *ent) const
idLinkList< idEntity > spawnedEntities
void RegisterEntity(idEntity *ent)
idRenderWorld * gameRenderWorld
entityNetEvent_t * Alloc()
void WriteInt(const int value)
virtual void CacheDictionaryMedia(const idDict *dict)
entityState_t * clientEntityStates[MAX_CLIENTS][MAX_GENTITIES]
int GetTargets(const idDict &args, idList< idEntityPtr< idEntity > > &list, const char *ref) const
const idMaterial * GetGlobalMaterial()
void SortActiveEntityList(void)
void ClientShowSnapshot(int clientNum) const
byte lagometer[LAGO_IMG_HEIGHT][LAGO_IMG_WIDTH][4]
idEntity * entities[MAX_GENTITIES]
idDict userInfo[MAX_CLIENTS]
virtual void ClientReadSnapshot(int clientNum, int sequence, const int gameFrame, const int gameTime, const int dupeUsercmds, const int aheadOfServer, const idBitMsg &msg)
idPlayer * GetClientByName(const char *name) const
idPlayer * GetClientByNum(int current) const
aasHandle_t AddAASObstacle(const idBounds &bounds)
void CalcFov(float base_fov, float &fov_x, float &fov_y) const
struct entityState_s * next
idEntity * GetTraceEntity(const trace_t &trace) const
void CallObjectFrameCommand(idEntity *ent, const char *frameCommand)
float globalShaderParms[MAX_GLOBAL_SHADER_PARMS]
void SetAASAreaState(const idBounds &bounds, const int areaContents, bool closed)
void SetCamera(idCamera *cam)
const float DEFAULT_GRAVITY
virtual gameReturn_t ClientPrediction(int clientNum, const usercmd_t *clientCmds, bool lastPredictFrame)
static void NextMap_f(const idCmdArgs &args)
bool ApplySnapshot(int clientNum, int sequence)
idEntityPtr< idActor > lastAIAlertEntity
void ProjectDecal(const idVec3 &origin, const idVec3 &dir, float depth, bool parallel, float size, const char *material, float angle=0)
void InitClientDeclRemap(int clientNum)
idList< int > clientDeclRemap[MAX_CLIENTS][DECL_MAX_TYPES]
idEditEntities * editEntities
void InitConsoleCommands(void)
usercmd_t usercmds[MAX_CLIENTS]
void void void void void void LoadMap(const char *mapName, int randseed)
virtual void ServerWriteSnapshot(int clientNum, int sequence, idBitMsg &msg, byte *clientInPVS, int numPVSClients)
struct entityState_s entityState_t
int GetEntityNum(void) const
void SpawnMapEntities(void)
void Save(idSaveGame *savefile) const
idEventQueue savedEventQueue
const int MAX_GAME_MESSAGE_SIZE
entityState_t * firstEntityState
const int CINEMATIC_SKIP_DELAY
bool RequirementMet(idEntity *activator, const idStr &requires, int removeItem)
int clientPVS[MAX_CLIENTS][ENTITY_PVS_SIZE]
void ReadGameStateFromSnapshot(const idBitMsgDelta &msg)
void UpdateServerInfoFlags(void)
entityNetEvent_t * Start(void)
pvsHandle_t GetClientPVS(idPlayer *player, pvsType_t type)
idDict persistentPlayerInfo[MAX_CLIENTS]
idBlockAlloc< snapshot_t, 64 > snapshotAllocator
bool CheatsOk(bool requirePlayer=true)
snapshot_t * clientSnapshots[MAX_CLIENTS]
virtual void GetMapLoadingGUI(char gui[MAX_STRING_CHARS])
const int NUM_RENDER_PORTAL_BITS
virtual bool DownloadRequest(const char *IP, const char *guid, const char *paks, char urls[MAX_STRING_CHARS])
virtual void SaveGame(idFile *saveGameFile)
virtual void MapShutdown(void)
static void ArgCompletion_EntityName(const idCmdArgs &args, void(*callback)(const char *s))
virtual int GetTimeGroupTime(int timeGroup)=0
const idDeclEntityDef * FindEntityDef(const char *name, bool makeDefault=true) const
virtual void ServerProcessReliableMessage(int clientNum, const idBitMsg &msg)
void SaveEntityNetworkEvent(const idEntity *ent, int event, const idBitMsg *msg)
bool RemoveEntityFromHash(const char *name, idEntity *ent)
const int MAX_SURFACE_TYPES
idEntityPtr< idEntity > lastGUIEnt
struct snapshot_s snapshot_t
idCVar password("password","", CVAR_GAME|CVAR_NOCHEAT,"client password used when connecting")
idEntityPtr< type > & operator=(type *ent)
idAnimManager animationLib
virtual void SelectTimeGroup(int timeGroup)=0
virtual gameReturn_t RunFrame(const usercmd_t *clientCmds)
const idMaterial * globalMaterial
void RemoveAASObstacle(const aasHandle_t handle)
idEntity * SelectInitialSpawnPoint(idPlayer *player)
virtual void Shutdown(void)
void ShutdownConsoleCommands(void)
void Enqueue(entityNetEvent_t *event, outOfOrderBehaviour_t oooBehaviour)
idBlockAlloc< entityNetEvent_t, 32 > eventAllocator
static int sortSpawnPoints(const void *ptr1, const void *ptr2)
virtual void GetClientStats(int clientNum, char *data, const int len)
idEntity * FindEntityUsingDef(idEntity *from, const char *match) const