diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index 23c72c8..d444140 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -241,6 +241,7 @@ typedef struct client_s uint32 m_VoiceStreams[2]; double m_lastvoicetime; int m_sendrescount; + qboolean m_bSentNewResponse; } client_t; enum diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 5b8a40d..4d0a74e 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -37,7 +37,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 9 +#define REHLDS_API_VERSION_MINOR 10 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index 7585d8d..da3768c 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -48,16 +48,22 @@ class IGameClient { public: virtual int GetId() = 0; + // false = client is free virtual bool IsActive() = 0; virtual void SetActive(bool active) = 0; + // false = don't send datagrams virtual bool IsSpawned() = 0; virtual void SetSpawned(bool spawned) = 0; + // The client's net connection virtual INetChan* GetNetChan() = 0; + // The datagram is written to after every frame, but only cleared + // when it is sent out to the client. It can be harmlessly overflowed virtual sizebuf_t* GetDatagram() = 0; + // EDICT_NUM(clientnum + 1) virtual edict_t* GetEdict() = 0; virtual USERID_t* GetNetworkUserID() = 0; @@ -67,15 +73,156 @@ public: virtual bool IsConnected() = 0; virtual void SetConnected(bool connected) = 0; + // Which other clients does this guy's voice stream go to? virtual uint32 GetVoiceStream(int stream_id) = 0; virtual void SetLastVoiceTime(double time) = 0; virtual double GetLastVoiceTime() = 0; + + // Does this client want to hear his own voice? virtual bool GetLoopback() = 0; virtual struct usercmd_s *GetLastCmd() = 0; + // This is spectator proxy (hltv) virtual bool IsProxy() = 0; virtual void SetProxy(bool proxy) = 0; + // This client is a fake player controlled by the game DLL + virtual bool IsFakeClient() = 0; + virtual void SetFakeClient(bool state) = 0; + + // On server, getting data + virtual bool IsFullyConnected() = 0; + virtual void SetFullyConnected(bool state) = 0; + + virtual bool IsUploading() = 0; + virtual void SetUploading(bool state) = 0; + + virtual bool IsHasUserMsgs() = 0; + virtual void SetHasUserMsgs(bool value) = 0; + + virtual bool HasForceUnmodified() = 0; + virtual void SetHasForceUnmodified(bool value) = 0; + + // Number of packets choked at the server because the client - server network channel + // is backlogged with too much data + virtual int GetChokeCount() = 0; + virtual void SetChokeCount(int count) = 0; + + // -1 = no compression. This is where the server is creating the compressed info from + virtual int GetDeltaSequence() = 0; + virtual void SetDeltaSequence(int value) = 0; + + // For filling in big drops + virtual void SetLastCmd(struct usercmd_s *ucmd) = 0; + + virtual double GetConnectTime() = 0; + virtual void SetConnectTime(double time) = 0; + + virtual double GetCmdTime() = 0; + virtual void SetCmdTime(double time) = 0; + + virtual double GetIgnoreCmdTime() = 0; + virtual void SetIgnoreCmdTime(double time) = 0; + + virtual float GetLatency() = 0; + virtual void SetLatency(float latency) = 0; + + virtual float GetPacketLoss() = 0; + virtual void SetPacketLoss(float packetLoss) = 0; + + virtual double GetLocalTime() = 0; + virtual void SetLocalTime(double time) = 0; + + virtual double GetSvTimeBase() = 0; + virtual void SetSvTimeBase(double time) = 0; + + // Or time of disconnect for zombies + virtual double GetConnectionStartedTime() = 0; + virtual void SetConnectionStartedTime(double time) = 0; + + // Time when we should send next world state update (datagram) + virtual double GetNextMessageTime() = 0; + virtual void SetNextMessageTime(double time) = 0; + + // Default time to wait for next message + virtual double GetNextMessageIntervalTime() = 0; + virtual void SetNextMessageIntervalTime(double time_interval) = 0; + + // false - only send messages if the client has sent one and the bandwidth is not choked + virtual bool GetSendMessageState() = 0; + virtual void SetSendMessageState(bool state) = 0; + + virtual bool GetSkipMessageState() = 0; + virtual void SetSkipMessageState(bool state) = 0; + + virtual bool GetSendInfoState() = 0; + virtual void SetSendInfoState(bool state) = 0; + + virtual float GetSendInfoTime() = 0; + virtual void SetSendInfoTime(float time) = 0; + + // updates can be deltad from here + virtual struct client_frame_s *GetFrames() = 0; + + // Per edict events + virtual struct event_state_s *GetEvents() = 0; + + // View Entity (camera or the client itself) svc_setview + virtual const edict_t *GetViewEntity() = 0; + virtual void SetViewEntity(const edict_t *entity) = 0; + + // Identifying number on server + virtual int GetUserID() = 0; + virtual void SetUserID(int iUserID) = 0; + + // name, etc (received from client) + virtual char *GetUserInfo() = 0; + + // MD5 hash is 32 hex #'s, plus trailing 0 + // Hashed CD Key (32 hex alphabetic chars + 0 terminator) + virtual char *GetHashedCDKey() = 0; + + virtual int GetTopColor() = 0; + virtual void SetTopColor(int color) = 0; + + virtual int GetBottomColor() = 0; + virtual void SetBottomColor(int color) = 0; + + virtual resource_t *GetResourcesOnHand() = 0; + virtual resource_t *GetResourcesNeeded() = 0; + + virtual FileHandle_t GetUploadFileHandle() = 0; + virtual void SetUploadFileHandle(FileHandle_t fhFile) = 0; + + virtual bool IsUploadDoneRegistering() = 0; + virtual void SetUploadDoneRegistering(bool state) = 0; + + virtual customization_t *GetCustomizationData() = 0; + + virtual int GetCRC32MapValue() = 0; + virtual void SetCRC32MapValue(int crcMapValue) = 0; + + // Perform client side prediction of weapon effects + // Determines that the client enabled prediction weapons and will be handled pfnGetWeaponData + virtual bool IsClientPredictingWeapons() = 0; + virtual void SetClientPredictingWeapons(bool state) = 0; + + // Perform server side lag compensation of player movement + // Determines that the client is requesting lag compensation + virtual bool IsClientLagCompensation() = 0; + virtual void SetClientLagCompensation(bool state) = 0; + + // Set on server (transmit to client) + virtual char *GetPhysInfo() = 0; + + virtual void SetVoiceStream(int stream_id, int value) = 0; + + virtual int GetSendResourceCount() = 0; + virtual void SetSendResourceCount(int count) = 0; + + virtual bool IsSentNewResponse() = 0; + virtual void SetSentNewResponse(bool state) = 0; + // this must be the last virtual function in class #ifdef REHLDS_SELF virtual client_t* GetClient() = 0; @@ -108,6 +255,12 @@ public: virtual client_t* GetClient_t(int id) = 0; virtual int GetIndexOfClient_t(client_t* client) = 0; virtual int GetMaxClientsLimit() = 0; + virtual client_t *GetNextClient_t(client_t *client) = 0; + virtual int GetSpawnCount() = 0; + virtual void SetSpawnCount(int count) = 0; + virtual struct server_log_s *GetLog() = 0; + virtual bool IsSecure() = 0; + virtual void SetSecure(bool value) = 0; }; class IRehldsServerData { @@ -134,4 +287,40 @@ public: virtual class ISteamGameServer *GetSteamGameServer() = 0; virtual struct netadr_s *GetNetFrom() = 0; virtual double GetOldTime() = 0; + + virtual void SetNetFrom(struct netadr_s *from) = 0; + virtual void SetWorldmapCrc(uint32 crcValue) = 0; + virtual void SetDecalNameNum(int num) = 0; + + virtual bool IsActive() = 0; + virtual void SetActive(bool state) = 0; + virtual bool IsPaused() = 0; + virtual void SetPaused(bool state) = 0; + virtual int GetLastIndexCheckInPVS() = 0; + virtual void SetLastIndexCheckInPVS(int id) = 0; + virtual double GetLastIndexCheckTimeInPVS() = 0; + virtual void SetLastIndexCheckTimeInPVS(double time) = 0; + virtual const char *GetOldName() = 0; + virtual void SetOldName(const char *name) = 0; + virtual const char *GetStartSpotName() = 0; + virtual void SetStartSpotName(const char *startspot) = 0; + virtual struct model_s *GetWorldModel() = 0; + virtual void SetWorldModel(struct model_s *model) = 0; + virtual struct consistency_s *GetConsistency(int index) = 0; + virtual struct model_s *GetModel(int index) = 0; + virtual struct event_s *GetEventPrecache(int index) = 0; + virtual struct entity_state_s *GetEntityBaseline(int index) = 0; + virtual struct extra_baselines_s *GetEntityInstanceBaselines() = 0; + virtual int GetNumGenericNames() = 0; + virtual void SetNumGenericNames(int num) = 0; + virtual int GetNumEdicts() = 0; + virtual void SetNumEdicts(int num_edicts) = 0; + virtual int GetMaxEdicts() = 0; + virtual void SetMaxEdicts(int max_edicts) = 0; + virtual edict_t *GetEdict(int index) = 0; + virtual server_state_t GetState() = 0; + virtual void SetState(server_state_t st) = 0; + virtual sizebuf_t *GetMulticastBuf() = 0; + virtual sizebuf_t *GetSpectatorBuf() = 0; + virtual sizebuf_t *GetSignonBuf() = 0; }; diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 2044938..fa07ac5 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -53,40 +53,40 @@ struct usercmd_s* EXT_FUNC CGameClient::GetLastCmd() bool EXT_FUNC CGameClient::IsActive() { - return m_pClient->active != 0; + return m_pClient->active != FALSE; } void EXT_FUNC CGameClient::SetActive(bool active) { - m_pClient->active = active ? 1 : 0; + m_pClient->active = active ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsSpawned() { - return m_pClient->spawned != 0; + return m_pClient->spawned != FALSE; } void EXT_FUNC CGameClient::SetSpawned(bool spawned) { - m_pClient->spawned = spawned ? 1 : 0; + m_pClient->spawned = spawned ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsProxy() { - return m_pClient->proxy != 0; + return m_pClient->proxy != FALSE; } void EXT_FUNC CGameClient::SetProxy(bool proxy) { - m_pClient->proxy = proxy ? 1 : 0; + m_pClient->proxy = proxy ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsConnected() { - return m_pClient->connected != 0; + return m_pClient->connected != FALSE; } void EXT_FUNC CGameClient::SetConnected(bool connected) { - m_pClient->connected = connected ? 1 : 0; + m_pClient->connected = connected ? TRUE : FALSE; } uint32 EXT_FUNC CGameClient::GetVoiceStream(int stream_id) { @@ -104,7 +104,7 @@ double EXT_FUNC CGameClient::GetLastVoiceTime() { } bool EXT_FUNC CGameClient::GetLoopback() { - return m_pClient->m_bLoopback != 0; + return m_pClient->m_bLoopback != FALSE; } INetChan* EXT_FUNC CGameClient::GetNetChan() @@ -137,6 +137,378 @@ client_t* EXT_FUNC CGameClient::GetClient() return m_pClient; } +bool EXT_FUNC CGameClient::IsFakeClient() +{ + return m_pClient->fakeclient; +} + +void EXT_FUNC CGameClient::SetFakeClient(bool state) +{ + m_pClient->fakeclient = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsFullyConnected() +{ + return m_pClient->fully_connected; +} + +void EXT_FUNC CGameClient::SetFullyConnected(bool state) +{ + m_pClient->fully_connected = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsUploading() +{ + return m_pClient->uploading != FALSE; +} + +void EXT_FUNC CGameClient::SetUploading(bool state) +{ + m_pClient->uploading = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsHasUserMsgs() +{ + return m_pClient->hasusrmsgs != FALSE; +} + +void EXT_FUNC CGameClient::SetHasUserMsgs(bool value) +{ + m_pClient->hasusrmsgs = value ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::HasForceUnmodified() +{ + return m_pClient->has_force_unmodified != FALSE; +} + +void EXT_FUNC CGameClient::SetHasForceUnmodified(bool value) +{ + m_pClient->has_force_unmodified = value ? TRUE : FALSE; +} + +int EXT_FUNC CGameClient::GetChokeCount() +{ + return m_pClient->chokecount; +} + +void EXT_FUNC CGameClient::SetChokeCount(int count) +{ + m_pClient->chokecount = count; +} + +int EXT_FUNC CGameClient::GetDeltaSequence() +{ + return m_pClient->delta_sequence; +} + +void EXT_FUNC CGameClient::SetDeltaSequence(int value) +{ + m_pClient->delta_sequence = value; +} + +void EXT_FUNC CGameClient::SetLastCmd(usercmd_t *ucmd) +{ + m_pClient->lastcmd = *ucmd; +} + +double EXT_FUNC CGameClient::GetConnectTime() +{ + return m_pClient->connecttime; +} + +void EXT_FUNC CGameClient::SetConnectTime(double time) +{ + m_pClient->connecttime = time; +} + +double EXT_FUNC CGameClient::GetCmdTime() +{ + return m_pClient->cmdtime; +} + +void EXT_FUNC CGameClient::SetCmdTime(double time) +{ + m_pClient->cmdtime = time; +} + +double EXT_FUNC CGameClient::GetIgnoreCmdTime() +{ + return m_pClient->ignorecmdtime; +} + +void EXT_FUNC CGameClient::SetIgnoreCmdTime(double time) +{ + m_pClient->ignorecmdtime = time; +} + +float EXT_FUNC CGameClient::GetLatency() +{ + return m_pClient->latency; +} + +void EXT_FUNC CGameClient::SetLatency(float latency) +{ + m_pClient->latency = latency; +} + +float EXT_FUNC CGameClient::GetPacketLoss() +{ + return m_pClient->packet_loss; +} + +void EXT_FUNC CGameClient::SetPacketLoss(float packetLoss) +{ + m_pClient->packet_loss = packetLoss; +} + +double EXT_FUNC CGameClient::GetLocalTime() +{ + return m_pClient->localtime; +} + +void EXT_FUNC CGameClient::SetLocalTime(double time) +{ + m_pClient->localtime = time; +} + +double EXT_FUNC CGameClient::GetSvTimeBase() +{ + return m_pClient->svtimebase; +} + +void EXT_FUNC CGameClient::SetSvTimeBase(double time) +{ + m_pClient->svtimebase = time; +} + +double EXT_FUNC CGameClient::GetConnectionStartedTime() +{ + return m_pClient->connection_started; +} + +void EXT_FUNC CGameClient::SetConnectionStartedTime(double time) +{ + m_pClient->connection_started = time; +} + +double EXT_FUNC CGameClient::GetNextMessageTime() +{ + return m_pClient->next_messagetime; +} + +void EXT_FUNC CGameClient::SetNextMessageTime(double time) +{ + m_pClient->next_messagetime = time; +} + +double EXT_FUNC CGameClient::GetNextMessageIntervalTime() +{ + return m_pClient->next_messageinterval; +} + +void EXT_FUNC CGameClient::SetNextMessageIntervalTime(double time_interval) +{ + m_pClient->next_messageinterval = time_interval; +} + +bool EXT_FUNC CGameClient::GetSendMessageState() +{ + return m_pClient->send_message != FALSE; +} + +void EXT_FUNC CGameClient::SetSendMessageState(bool state) +{ + m_pClient->send_message = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::GetSkipMessageState() +{ + return m_pClient->skip_message != FALSE; +} + +void EXT_FUNC CGameClient::SetSkipMessageState(bool state) +{ + m_pClient->skip_message = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::GetSendInfoState() +{ + return m_pClient->sendinfo != FALSE; +} + +void EXT_FUNC CGameClient::SetSendInfoState(bool state) +{ + m_pClient->sendinfo = state ? TRUE : FALSE; +} + +float EXT_FUNC CGameClient::GetSendInfoTime() +{ + return m_pClient->sendinfo_time; +} + +void EXT_FUNC CGameClient::SetSendInfoTime(float time) +{ + m_pClient->sendinfo_time = time; +} + +client_frame_t *EXT_FUNC CGameClient::GetFrames() +{ + return m_pClient->frames; +} + +event_state_t *EXT_FUNC CGameClient::GetEvents() +{ + return &m_pClient->events; +} + +const edict_t *EXT_FUNC CGameClient::GetViewEntity() +{ + return m_pClient->pViewEntity; +} + +void EXT_FUNC CGameClient::SetViewEntity(const edict_t *entity) +{ + m_pClient->pViewEntity = entity; +} + +int EXT_FUNC CGameClient::GetUserID() +{ + return m_pClient->userid; +} + +void EXT_FUNC CGameClient::SetUserID(int iUserID) +{ + m_pClient->userid = iUserID; +} + +char *EXT_FUNC CGameClient::GetUserInfo() +{ + return m_pClient->userinfo; +} + +char *EXT_FUNC CGameClient::GetHashedCDKey() +{ + return m_pClient->hashedcdkey; +} + +int EXT_FUNC CGameClient::GetTopColor() +{ + return m_pClient->topcolor; +} + +void EXT_FUNC CGameClient::SetTopColor(int color) +{ + m_pClient->topcolor = color; +} + +int EXT_FUNC CGameClient::GetBottomColor() +{ + return m_pClient->bottomcolor; +} + +void EXT_FUNC CGameClient::SetBottomColor(int color) +{ + m_pClient->bottomcolor = color; +} + +resource_t *EXT_FUNC CGameClient::GetResourcesOnHand() +{ + return &m_pClient->resourcesonhand; +} + +resource_t *EXT_FUNC CGameClient::GetResourcesNeeded() +{ + return &m_pClient->resourcesneeded; +} + +FileHandle_t EXT_FUNC CGameClient::GetUploadFileHandle() +{ + return m_pClient->upload; +} + +void EXT_FUNC CGameClient::SetUploadFileHandle(FileHandle_t fhFile) +{ + m_pClient->upload = fhFile; +} + +bool EXT_FUNC CGameClient::IsUploadDoneRegistering() +{ + return m_pClient->uploaddoneregistering != FALSE; +} + +void EXT_FUNC CGameClient::SetUploadDoneRegistering(bool state) +{ + m_pClient->uploaddoneregistering = state ? TRUE : FALSE; +} + +customization_t *EXT_FUNC CGameClient::GetCustomizationData() +{ + return &m_pClient->customdata; +} + +int EXT_FUNC CGameClient::GetCRC32MapValue() +{ + return m_pClient->crcValue; +} + +void EXT_FUNC CGameClient::SetCRC32MapValue(int crcMapValue) +{ + m_pClient->crcValue = crcMapValue; +} + +bool EXT_FUNC CGameClient::IsClientPredictingWeapons() +{ + return m_pClient->lw != FALSE; +} + +void EXT_FUNC CGameClient::SetClientPredictingWeapons(bool state) +{ + m_pClient->lw = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsClientLagCompensation() +{ + return m_pClient->lc != FALSE; +} + +void EXT_FUNC CGameClient::SetClientLagCompensation(bool state) +{ + m_pClient->lc = state ? TRUE : FALSE; +} + +char *EXT_FUNC CGameClient::GetPhysInfo() +{ + return m_pClient->physinfo; +} + +void EXT_FUNC CGameClient::SetVoiceStream(int stream_id, int value) +{ + if (stream_id < 0 || stream_id >= ARRAYSIZE(m_pClient->m_VoiceStreams)) + return; + + m_pClient->m_VoiceStreams[stream_id] = value; +} + +int EXT_FUNC CGameClient::GetSendResourceCount() +{ + return m_pClient->m_sendrescount; +} + +void EXT_FUNC CGameClient::SetSendResourceCount(int count) +{ + m_pClient->m_sendrescount = count; +} + +bool EXT_FUNC CGameClient::IsSentNewResponse() +{ + return m_pClient->m_bSentNewResponse != FALSE; +} + +void EXT_FUNC CGameClient::SetSentNewResponse(bool state) +{ + m_pClient->m_bSentNewResponse = state ? TRUE : FALSE; +} CNetChan::CNetChan(netchan_t* chan) { @@ -170,6 +542,36 @@ int EXT_FUNC CRehldsServerStatic::GetMaxClientsLimit() return g_psvs.maxclientslimit; } +client_t *EXT_FUNC CRehldsServerStatic::GetNextClient_t(client_t *client) +{ + return ++client; +} + +int EXT_FUNC CRehldsServerStatic::GetSpawnCount() +{ + return g_psvs.spawncount; +} + +void EXT_FUNC CRehldsServerStatic::SetSpawnCount(int count) +{ + g_psvs.spawncount = count; +} + +server_log_t *EXT_FUNC CRehldsServerStatic::GetLog() +{ + return &g_psvs.log; +} + +bool EXT_FUNC CRehldsServerStatic::IsSecure() +{ + return g_psvs.isSecure != FALSE; +} + +void EXT_FUNC CRehldsServerStatic::SetSecure(bool value) +{ + g_psvs.isSecure = value ? TRUE : FALSE; +} + bool EXT_FUNC CRehldsServerStatic::IsLogActive() { return g_psvs.log.active ? true : false; @@ -226,6 +628,10 @@ uint32 EXT_FUNC CRehldsServerData::GetWorldmapCrc() { return g_psv.worldmapCRC; } +void EXT_FUNC CRehldsServerData::SetWorldmapCrc(uint32 crcValue) { + g_psv.worldmapCRC = crcValue; +} + uint8* EXT_FUNC CRehldsServerData::GetClientDllMd5() { return g_psv.clientdllmd5; } @@ -254,6 +660,10 @@ int EXT_FUNC CRehldsServerData::GetDecalNameNum() { return sv_decalnamecount; } +void EXT_FUNC CRehldsServerData::SetDecalNameNum(int num) { + sv_decalnamecount = num; +} + double EXT_FUNC CRehldsServerData::GetTime() { return g_psv.time; } @@ -274,6 +684,178 @@ struct resource_s *EXT_FUNC CRehldsServerData::GetResource(int index) { #endif // REHLDS_FIXES } +bool EXT_FUNC CRehldsServerData::IsActive() +{ + return g_psv.active != FALSE; +} + +void EXT_FUNC CRehldsServerData::SetActive(bool state) +{ + g_psv.active = state ? TRUE : FALSE; +} + +bool EXT_FUNC CRehldsServerData::IsPaused() +{ + return g_psv.paused != FALSE; +} + +void EXT_FUNC CRehldsServerData::SetPaused(bool state) +{ + g_psv.paused = state ? TRUE : FALSE; +} + +int EXT_FUNC CRehldsServerData::GetLastIndexCheckInPVS() +{ + return g_psv.lastcheck; +} + +void EXT_FUNC CRehldsServerData::SetLastIndexCheckInPVS(int id) +{ + g_psv.lastcheck = id; +} + +double EXT_FUNC CRehldsServerData::GetLastIndexCheckTimeInPVS() +{ + return g_psv.lastchecktime; +} + +void EXT_FUNC CRehldsServerData::SetLastIndexCheckTimeInPVS(double time) +{ + g_psv.lastchecktime = time; +} + +const char *EXT_FUNC CRehldsServerData::GetOldName() +{ + return g_psv.oldname; +} + +void EXT_FUNC CRehldsServerData::SetOldName(const char *name) +{ + Q_strncpy(g_psv.oldname, name, ARRAYSIZE(g_psv.oldname) - 1); + g_psv.oldname[ARRAYSIZE(g_psv.oldname) - 1] = '\0'; +} + +const char *EXT_FUNC CRehldsServerData::GetStartSpotName() +{ + return g_psv.startspot; +} + +void EXT_FUNC CRehldsServerData::SetStartSpotName(const char *startspot) +{ + Q_strncpy(g_psv.startspot, startspot, ARRAYSIZE(g_psv.startspot) - 1); + g_psv.startspot[ARRAYSIZE(g_psv.startspot) - 1] = '\0'; +} + +model_t *EXT_FUNC CRehldsServerData::GetWorldModel() +{ + return g_psv.worldmodel; +} + +void EXT_FUNC CRehldsServerData::SetWorldModel(model_t *model) +{ + g_psv.worldmodel = model; +} + +consistency_t *EXT_FUNC CRehldsServerData::GetConsistency(int index) +{ + if (index < 0 || index >= MAX_CONSISTENCY_LIST) + return NULL; + + return &g_psv.consistency_list[index]; +} + +model_t *EXT_FUNC CRehldsServerData::GetModel(int index) +{ + if (index < 0 || index >= MAX_MODELS) + return NULL; + + return g_psv.models[index]; +} + +event_t *EXT_FUNC CRehldsServerData::GetEventPrecache(int index) +{ + if (index < 0 || index >= MAX_EVENTS) + return NULL; + + return &g_psv.event_precache[index]; +} + +entity_state_t *EXT_FUNC CRehldsServerData::GetEntityBaseline(int index) +{ + if (index < 0 || index >= g_psv.max_edicts) + return NULL; + + return &g_psv.baselines[index]; +} + +extra_baselines_t *EXT_FUNC CRehldsServerData::GetEntityInstanceBaselines() +{ + return g_psv.instance_baselines; +} + +int EXT_FUNC CRehldsServerData::GetNumGenericNames() +{ + return g_psv.num_generic_names; +} + +void EXT_FUNC CRehldsServerData::SetNumGenericNames(int num) +{ + g_psv.num_generic_names = num; +} + +int EXT_FUNC CRehldsServerData::GetNumEdicts() +{ + return g_psv.num_edicts; +} + +void EXT_FUNC CRehldsServerData::SetNumEdicts(int num_edicts) +{ + g_psv.num_edicts = num_edicts; +} + +int EXT_FUNC CRehldsServerData::GetMaxEdicts() +{ + return g_psv.max_edicts; +} + +void EXT_FUNC CRehldsServerData::SetMaxEdicts(int max_edicts) +{ + g_psv.max_edicts = max_edicts; +} + +edict_t *EXT_FUNC CRehldsServerData::GetEdict(int index) +{ + if (index < 0 || index >= g_psv.max_edicts) + return NULL; + + return &g_psv.edicts[index]; +} + +server_state_t EXT_FUNC CRehldsServerData::GetState() +{ + return g_psv.state; +} + +void EXT_FUNC CRehldsServerData::SetState(server_state_t st) +{ + g_psv.state = st; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetMulticastBuf() +{ + return &g_psv.multicast; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetSpectatorBuf() +{ + return &g_psv.spectator; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetSignonBuf() +{ + return &g_psv.signon; +} + void Rehlds_Interfaces_FreeClients() { if (g_GameClients == NULL) @@ -320,3 +902,7 @@ ISteamGameServer* EXT_FUNC CRehldsServerData::GetSteamGameServer() { netadr_t* EXT_FUNC CRehldsServerData::GetNetFrom() { return &net_from; } + +void EXT_FUNC CRehldsServerData::SetNetFrom(netadr_t *from) { + net_from = *from; +} diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index c22215f..5cf4dba 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -103,6 +103,143 @@ public: virtual client_t* GetClient(); + // This client is a fake player controlled by the game DLL + virtual bool IsFakeClient(); + virtual void SetFakeClient(bool state); + + // On server, getting data + virtual bool IsFullyConnected(); + virtual void SetFullyConnected(bool state); + + virtual bool IsUploading(); + virtual void SetUploading(bool state); + + virtual bool IsHasUserMsgs(); + virtual void SetHasUserMsgs(bool value); + + virtual bool HasForceUnmodified(); + virtual void SetHasForceUnmodified(bool value); + + // Number of packets choked at the server because the client - server network channel + // is backlogged with too much data + virtual int GetChokeCount(); + virtual void SetChokeCount(int count); + + // -1 = no compression. This is where the server is creating the compressed info from + virtual int GetDeltaSequence(); + virtual void SetDeltaSequence(int value); + + // For filling in big drops + virtual void SetLastCmd(struct usercmd_s *ucmd); + + virtual double GetConnectTime(); + virtual void SetConnectTime(double time); + + virtual double GetCmdTime(); + virtual void SetCmdTime(double time); + + virtual double GetIgnoreCmdTime(); + virtual void SetIgnoreCmdTime(double time); + + virtual float GetLatency(); + virtual void SetLatency(float latency); + + virtual float GetPacketLoss(); + virtual void SetPacketLoss(float packetLoss); + + virtual double GetLocalTime(); + virtual void SetLocalTime(double time); + + virtual double GetSvTimeBase(); + virtual void SetSvTimeBase(double time); + + // Or time of disconnect for zombies + virtual double GetConnectionStartedTime(); + virtual void SetConnectionStartedTime(double time); + + // Time when we should send next world state update (datagram) + virtual double GetNextMessageTime(); + virtual void SetNextMessageTime(double time); + + // Default time to wait for next message + virtual double GetNextMessageIntervalTime(); + virtual void SetNextMessageIntervalTime(double time_interval); + + // false - only send messages if the client has sent one and the bandwidth is not choked + virtual bool GetSendMessageState(); + virtual void SetSendMessageState(bool state); + + virtual bool GetSkipMessageState(); + virtual void SetSkipMessageState(bool state); + + virtual bool GetSendInfoState(); + virtual void SetSendInfoState(bool state); + + virtual float GetSendInfoTime(); + virtual void SetSendInfoTime(float time); + + // updates can be deltad from here + virtual struct client_frame_s *GetFrames(); + + // Per edict events + virtual struct event_state_s *GetEvents(); + + // View Entity (camera or the client itself) svc_setview + virtual const edict_t *GetViewEntity(); + virtual void SetViewEntity(const edict_t *entity); + + // Identifying number on server + virtual int GetUserID(); + virtual void SetUserID(int iUserID); + + // name, etc (received from client) + virtual char *GetUserInfo(); + + // MD5 hash is 32 hex #'s, plus trailing 0 + // Hashed CD Key (32 hex alphabetic chars + 0 terminator) + virtual char *GetHashedCDKey(); + + virtual int GetTopColor(); + virtual void SetTopColor(int color); + + virtual int GetBottomColor(); + virtual void SetBottomColor(int color); + + virtual resource_t *GetResourcesOnHand(); + virtual resource_t *GetResourcesNeeded(); + + virtual FileHandle_t GetUploadFileHandle(); + virtual void SetUploadFileHandle(FileHandle_t fhFile); + + virtual bool IsUploadDoneRegistering(); + virtual void SetUploadDoneRegistering(bool state); + + virtual customization_t *GetCustomizationData(); + + virtual int GetCRC32MapValue(); + virtual void SetCRC32MapValue(int crcMapValue); + + // Perform client side prediction of weapon effects + // Determines that the client enabled prediction weapons and will be handled pfnGetWeaponData + virtual bool IsClientPredictingWeapons(); + virtual void SetClientPredictingWeapons(bool state); + + // Perform server side lag compensation of player movement + // Determines that the client is requesting lag compensation + virtual bool IsClientLagCompensation(); + virtual void SetClientLagCompensation(bool state); + + // Set on server (transmit to client) + virtual char *GetPhysInfo(); + + virtual void SetVoiceStream(int stream_id, int value); + + virtual int GetSendResourceCount(); + virtual void SetSendResourceCount(int count); + + virtual bool IsSentNewResponse(); + virtual void SetSentNewResponse(bool state); + public: bool GetSpawnedOnce() const { return m_bSpawnedOnce; } void SetSpawnedOnce(bool spawned) { m_bSpawnedOnce = spawned; } @@ -125,6 +262,12 @@ public: virtual client_t* GetClient_t(int id); virtual int GetIndexOfClient_t(client_t* client); virtual int GetMaxClientsLimit(); + virtual client_t *GetNextClient_t(client_t *client); + virtual int GetSpawnCount(); + virtual void SetSpawnCount(int count); + virtual struct server_log_s *GetLog(); + virtual bool IsSecure(); + virtual void SetSecure(bool value); }; class CRehldsServerData : public IRehldsServerData { @@ -149,6 +292,42 @@ public: virtual ISteamGameServer *GetSteamGameServer(); virtual netadr_t *GetNetFrom(); virtual double GetOldTime(); + + virtual void SetNetFrom(struct netadr_s *from); + virtual void SetWorldmapCrc(uint32 crcValue); + virtual void SetDecalNameNum(int num); + + virtual bool IsActive(); + virtual void SetActive(bool state); + virtual bool IsPaused(); + virtual void SetPaused(bool state); + virtual int GetLastIndexCheckInPVS(); + virtual void SetLastIndexCheckInPVS(int id); + virtual double GetLastIndexCheckTimeInPVS(); + virtual void SetLastIndexCheckTimeInPVS(double time); + virtual const char *GetOldName(); + virtual void SetOldName(const char *name); + virtual const char *GetStartSpotName(); + virtual void SetStartSpotName(const char *startspot); + virtual struct model_s *GetWorldModel(); + virtual void SetWorldModel(struct model_s *model); + virtual struct consistency_s *GetConsistency(int index); + virtual struct model_s *GetModel(int index); + virtual struct event_s *GetEventPrecache(int index); + virtual struct entity_state_s *GetEntityBaseline(int index); + virtual struct extra_baselines_s *GetEntityInstanceBaselines(); + virtual int GetNumGenericNames(); + virtual void SetNumGenericNames(int num); + virtual int GetNumEdicts(); + virtual void SetNumEdicts(int num_edicts); + virtual int GetMaxEdicts(); + virtual void SetMaxEdicts(int max_edicts); + virtual edict_t *GetEdict(int index); + virtual server_state_t GetState(); + virtual void SetState(server_state_t st); + virtual sizebuf_t *GetMulticastBuf(); + virtual sizebuf_t *GetSpectatorBuf(); + virtual sizebuf_t *GetSignonBuf(); }; extern CGameClient** g_GameClients; diff --git a/rehlds/version/version.h b/rehlds/version/version.h index 43f4008..0a1f095 100644 --- a/rehlds/version/version.h +++ b/rehlds/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 3 -#define VERSION_MINOR 9 +#define VERSION_MINOR 10 #define VERSION_MAINTENANCE 0