2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

Merge branch 'master' into launcher_refactoring

This commit is contained in:
Lev 2017-05-03 20:41:14 +05:00 committed by GitHub
commit a6ebcc747c
48 changed files with 231 additions and 191 deletions

View File

@ -65,7 +65,7 @@ There are several software requirements for building rehlds:
</ol>
### Checking requirements
####JDK version
#### JDK version
Windows<pre>&gt; %JAVA_HOME%\bin\javac -version
javac 1.8.0_25
</pre>
@ -75,15 +75,15 @@ Linux
javac 1.7.0_65
</pre>
####Visual Studio
#### Visual Studio
Help -> About
####ICC
#### ICC
<pre>$ icc --version
icc (ICC) 15.0.1 20141023
</pre>
####GCC
#### GCC
<pre>$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
</pre>

View File

@ -16,12 +16,13 @@
#ifndef ENUMS_H
#define ENUMS_H
// Used as array indexer
typedef enum netsrc_s
{
NS_CLIENT,
NS_CLIENT = 0,
NS_SERVER,
NS_MULTICAST // xxxMO
NS_MULTICAST, // xxxMO
NS_MAX
} netsrc_t;
#endif

View File

@ -245,7 +245,7 @@ void CSys::Printf(char *fmt, ...)
ConsoleOutput(szText);
}
#define MAX_LINUX_CMDLINE 2048
const int MAX_LINUX_CMDLINE = 2048;
static char linuxCmdline[MAX_LINUX_CMDLINE];
char* BuildCmdLine(int argc, char **argv)

View File

@ -8,7 +8,7 @@
#include "enums.h"
#endif
#define MAX_ALIAS_NAME 32
const int MAX_ALIAS_NAME = 32;
typedef struct cmdalias_s
{

View File

@ -102,7 +102,7 @@ typedef struct module_s
#include "in_buttons.h"
#endif
#define CLDLL_INTERFACE_VERSION 7
const int CLDLL_INTERFACE_VERSION = 7;
extern void LoadSecurityModuleFromDisk(char * pszDllName);
extern void LoadSecurityModuleFromMemory( unsigned char * pCode, int nSize );

View File

@ -46,8 +46,8 @@
#include "model.h"
#include "kbutton.h"
#define MAX_SCOREBOARDNAME 32
#define MAX_DEMOS 32
const int MAX_SCOREBOARDNAME = 32;
const int MAX_DEMOS = 32;
typedef enum cactive_e
{

View File

@ -36,9 +36,9 @@
All command/alias names are case insensitive! Arguments not.
*/
#define MAX_CMD_BUFFER 16384
#define MAX_CMD_TOKENS 80
#define MAX_CMD_LINE 1024
const int MAX_CMD_BUFFER = 16384;
const int MAX_CMD_TOKENS = 80;
const int MAX_CMD_LINE = 1024;
/*

View File

@ -33,7 +33,7 @@
// Looks like no more than 8096 visibility leafs per world model
#define MODEL_MAX_PVS 1024
const int MODEL_MAX_PVS = 1024;
#ifdef HOOK_ENGINE

View File

@ -2798,7 +2798,7 @@ typedef struct
unsigned short wBitsPerSample;
} FormatChunk;
#define WAVE_HEADER_LENGTH 128
const int WAVE_HEADER_LENGTH = 128;
unsigned int EXT_FUNC COM_GetApproxWavePlayLength(const char *filepath)
{

View File

@ -28,7 +28,7 @@
#pragma once
#define MAX_CONSISTENCY_LIST 512
const int MAX_CONSISTENCY_LIST = 512;
typedef struct consistency_s
{

View File

@ -32,8 +32,8 @@
#include "cvardef.h"
#include "FileSystem.h"
#define MAX_CVAR_VALUE 1024
#define MAX_CVARLIST_FILES 100
const int MAX_CVAR_VALUE = 1024;
const int MAX_CVARLIST_FILES = 100;
#ifdef HOOK_ENGINE
#define cvar_vars (*pcvar_vars)

View File

@ -32,8 +32,9 @@
#include "model.h"
#include "wad.h"
#define MAX_DECALS 512
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
const int MAX_DECALS = 512;
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
typedef struct decalname_s
{

View File

@ -30,7 +30,7 @@
#include "maintypes.h"
#define DELTA_MAX_FIELDS 56 // 7*8
const int DELTA_MAX_FIELDS = 56; // 7*8
enum
{
@ -46,7 +46,7 @@ enum
DT_SIGNED = BIT(31) // sign modificator
};
#define FDT_MARK BIT(0) // Delta mark for sending
const int FDT_MARK = BIT(0); // Delta mark for sending
typedef struct delta_s delta_t;
typedef void(*encoder_t)(delta_t *, const unsigned char *, const unsigned char *);

View File

@ -30,8 +30,8 @@
#include "maintypes.h"
#define DELTAJIT_MAX_BLOCKS 32
#define DELTAJIT_MAX_FIELDS 56
const int DELTAJIT_MAX_BLOCKS = 32;
const int DELTAJIT_MAX_FIELDS = 56;
struct deltajit_field {
unsigned int id;

View File

@ -31,11 +31,11 @@
#include "userid.h"
#ifdef REHLDS_FIXES
#define MAX_IPFILTERS 4096
#define MAX_USERFILTERS 4096
const int MAX_IPFILTERS = 4096;
const int MAX_USERFILTERS = 4096;
#else
#define MAX_IPFILTERS 32768
#define MAX_USERFILTERS 32768
const int MAX_IPFILTERS = 32768;
const int MAX_USERFILTERS = 32768;
#endif // REHLDS_FIXES
typedef struct ipfilter_s

View File

@ -519,6 +519,16 @@ void SV_DropClient_internal(client_t *cl, qboolean crash, const char *string)
cl->connection_started = realtime;
cl->proxy = FALSE;
COM_ClearCustomizationList(&cl->customdata, FALSE);
#ifdef REHLDS_FIXES
if (cl->edict)
{
// Reset flags, leave FL_DORMANT used by CS
cl->edict->v.flags &= FL_DORMANT;
// Since the edict doesn't get deleted, fix it so it doesn't interfere.
cl->edict->v.takedamage = DAMAGE_NO; // don't attract autoaim
cl->edict->v.solid = SOLID_NOT;
}
#endif // REHLDS_FIXES
cl->edict = NULL;
Q_memset(cl->userinfo, 0, sizeof(cl->userinfo));
Q_memset(cl->physinfo, 0, sizeof(cl->physinfo));

View File

@ -34,7 +34,7 @@
#include "server.h"
#include "rehlds_api.h"
#define MAX_COMMAND_LINE_PARAMS 50
const int MAX_COMMAND_LINE_PARAMS = 50;
typedef struct quakeparms_s
{

View File

@ -2929,8 +2929,9 @@ void Host_VoiceRecordStop_f(void)
}
}
void Host_Crash_f(void)
NOXREF void Host_Crash_f(void)
{
NOXREFCHECK;
int *p = NULL;
*p = 0xffffffff;
}

View File

@ -31,17 +31,17 @@
#include "maintypes.h"
// Max key/value length (with a NULL char)
#define MAX_KV_LEN 127
const int MAX_KV_LEN = 127;
// Key + value + 2 x slash + NULL
#define MAX_INFO_STRING 256
const int MAX_INFO_STRING = 256;
#define INFO_MAX_BUFFER_VALUES 4
const int INFO_MAX_BUFFER_VALUES = 4;
#ifdef REHLDS_FIXES
#define MAX_LOCALINFO 4096
const int MAX_LOCALINFO = 4096;
#else
#define MAX_LOCALINFO MAX_INFO_STRING * 128
const int MAX_LOCALINFO = MAX_INFO_STRING * 128;
#endif // REHLDS_FIXES
const char *Info_ValueForKey(const char *s, const char *key);

View File

@ -30,7 +30,7 @@
#include "entity_state.h"
#define NUM_BASELINES 64
const int NUM_BASELINES = 64;
typedef struct extra_baselines_s
{

View File

@ -33,7 +33,8 @@
#include "commonmacros.h"
// header
#define STUDIO_VERSION 10
const int STUDIO_VERSION = 10;
#define IDSTUDIOHEADER MAKEID('I', 'D', 'S', 'T') // little-endian "IDST"
#define IDSEQGRPHEADER MAKEID('I', 'D', 'S', 'Q') // little-endian "IDSQ"

View File

@ -33,53 +33,53 @@
#include "enums.h"
#include "netadr.h"
#define PROTOCOL_VERSION 48
const int PROTOCOL_VERSION = 48;
// MAX_CHALLENGES is made large to prevent a denial
// of service attack that could cycle all of them
// out before legitimate users connected
#ifdef REHLDS_OPT_PEDANTIC
#define MAX_CHALLENGES 64
const int MAX_CHALLENGES = 64;
#else
#define MAX_CHALLENGES 1024
const int MAX_CHALLENGES = 1024;
#endif // REHLDS_OPT_PEDANTIC
// Client connection is initiated by requesting a challenge value
// the server sends this value back
#define S2C_CHALLENGE 'A' // + challenge value
const char S2C_CHALLENGE = 'A'; // + challenge value
// Send a userid, client remote address, is this server secure and engine build number
#define S2C_CONNECTION 'B'
const char S2C_CONNECTION = 'B';
// HLMaster rejected a server's connection because the server needs to be updated
#define M2S_REQUESTRESTART 'O'
const char M2S_REQUESTRESTART = 'O';
// send a log event as key value
#define S2A_LOGSTRING 'R'
const char S2A_LOGSTRING = 'R';
// Send a log string
#define S2A_LOGKEY 'S'
const char S2A_LOGKEY = 'S';
// Basic information about the server
#define A2S_INFO 'T'
const char A2S_INFO = 'T';
// Details about each player on the server
#define A2S_PLAYER 'U'
const char A2S_PLAYER = 'U';
// The rules the server is using
#define A2S_RULES 'V'
const char A2S_RULES = 'V';
// Another user is requesting a challenge value from this machine
#define A2A_GETCHALLENGE 'W' // Request challenge # from another machine
const char A2A_GETCHALLENGE = 'W'; // Request challenge # from another machine
// Generic Ping Request
#define A2A_PING 'i' // respond with an A2A_ACK
const char A2A_PING = 'i'; // respond with an A2A_ACK
// Generic Ack
#define A2A_ACK 'j' // general acknowledgement without info
const char A2A_ACK = 'j'; // general acknowledgement without info
// Challenge response from master
#define M2A_CHALLENGE 's' // + challenge value
const char M2A_CHALLENGE = 's'; // + challenge value
// 0 == regular, 1 == file stream
enum
@ -91,25 +91,25 @@ enum
};
// Flow control bytes per second limits
#define MAX_RATE 100000.0f
#define MIN_RATE 1000.0f
const float MAX_RATE = 100000.0f;
const float MIN_RATE = 1000.0f;
// Default data rate
#define DEFAULT_RATE (9999.0f)
const float DEFAULT_RATE = (9999.0f);
// NETWORKING INFO
// Max size of udp packet payload
#define MAX_UDP_PACKET 4010 // 9 bytes SPLITHEADER + 4000 payload?
const int MAX_UDP_PACKET = 4010; // 9 bytes SPLITHEADER + 4000 payload?
// Max length of a reliable message
#define MAX_MSGLEN 3990 // 10 reserved for fragheader?
const int MAX_MSGLEN = 3990; // 10 reserved for fragheader?
// Max length of unreliable message
#define MAX_DATAGRAM 4000
const int MAX_DATAGRAM = 4000;
// This is the packet payload without any header bytes (which are attached for actual sending)
#define NET_MAX_PAYLOAD 65536
const int NET_MAX_PAYLOAD = 65536;
// This is the payload plus any header info (excluding UDP header)
@ -135,7 +135,7 @@ enum
// bytes will be stripped by the networking channel layer
//#define NET_MAX_MESSAGE PAD_NUMBER( ( MAX_MSGLEN + HEADER_BYTES ), 16 )
// This is currently used value in the engine. TODO: define above gives 4016, check it why.
#define NET_MAX_MESSAGE 4037
const int NET_MAX_MESSAGE = 4037;
typedef enum svc_commands_e
@ -237,7 +237,7 @@ typedef struct flowstats_s
double time;
} flowstats_t;
#define MAX_LATENT 32
const int MAX_LATENT = 32;
typedef struct flow_s
{
@ -252,19 +252,20 @@ typedef struct flow_s
float avgkbytespersec;
} flow_t;
#define FRAGMENT_C2S_MIN_SIZE 16
#define FRAGMENT_S2C_MIN_SIZE 256
#define FRAGMENT_S2C_MAX_SIZE 1024
#define CLIENT_FRAGMENT_SIZE_ONCONNECT 128
#define CUSTOMIZATION_MAX_SIZE 20480
const int FRAGMENT_C2S_MIN_SIZE = 16;
const int FRAGMENT_S2C_MIN_SIZE = 256;
const int FRAGMENT_S2C_MAX_SIZE = 1024;
const int CLIENT_FRAGMENT_SIZE_ONCONNECT = 128;
const int CUSTOMIZATION_MAX_SIZE = 20480;
#ifndef REHLDS_FIXES
// Size of fragmentation buffer internal buffers
#define FRAGMENT_MAX_SIZE 1400
const int FRAGMENT_MAX_SIZE = 1400;
#define MAX_FRAGMENTS 25000
const int MAX_FRAGMENTS = 25000;
#else
#define FRAGMENT_MAX_SIZE 1024
const int FRAGMENT_MAX_SIZE = 1024;
// Client sends normal fragments only while connecting
#define MAX_NORMAL_FRAGMENTS (NET_MAX_PAYLOAD / CLIENT_FRAGMENT_SIZE_ONCONNECT)
@ -274,8 +275,8 @@ typedef struct flow_s
#define MAX_FILE_FRAGMENTS (CUSTOMIZATION_MAX_SIZE / FRAGMENT_C2S_MIN_SIZE)
#endif
#define UDP_HEADER_SIZE 28
#define MAX_RELIABLE_PAYLOAD 1200
const int UDP_HEADER_SIZE = 28;
const int MAX_RELIABLE_PAYLOAD = 1200;
#define MAKE_FRAGID(id,count) ( ( ( id & 0xffff ) << 16 ) | ( count & 0xffff ) )
#define FRAG_GETID(fragid) ( ( fragid >> 16 ) & 0xffff )

View File

@ -35,7 +35,7 @@ CRITICAL_SECTION net_cs;
qboolean net_thread_initialized;
loopback_t loopbacks[2];
packetlag_t g_pLagData[3]; // List of lag structures, if fakelag is set.
packetlag_t g_pLagData[NS_MAX]; // List of lag structures, if fakelag is set.
float gFakeLag;
int net_configured;
#ifdef _WIN32
@ -63,21 +63,21 @@ netadr_t in_from;
#endif
#ifndef HOOK_ENGINE
SOCKET ip_sockets[3] = { INV_SOCK, INV_SOCK, INV_SOCK };
SOCKET ip_sockets[NS_MAX] = { INV_SOCK, INV_SOCK, INV_SOCK };
#else
SOCKET ip_sockets[3];
SOCKET ip_sockets[NS_MAX];
#endif
#ifdef _WIN32
#ifndef HOOK_ENGINE
SOCKET ipx_sockets[3] = { INV_SOCK, INV_SOCK, INV_SOCK };
SOCKET ipx_sockets[NS_MAX] = { INV_SOCK, INV_SOCK, INV_SOCK };
#else
SOCKET ipx_sockets[3];
SOCKET ipx_sockets[NS_MAX];
#endif
#endif // _WIN32
LONGPACKET gNetSplit;
net_messages_t *messages[3];
net_messages_t *messages[NS_MAX];
net_messages_t *normalqueue;
//void *hNetThread;
//int32 dwNetThreadId;
@ -775,7 +775,7 @@ qboolean NET_LagPacket(qboolean newdata, netsrc_t sock, netadr_t *from, sizebuf_
packetlag_t *pPacket;
float curtime;
int ninterval;
static int losscount[3];
static int losscount[NS_MAX];
if (gFakeLag <= 0.0)
{
@ -784,7 +784,11 @@ qboolean NET_LagPacket(qboolean newdata, netsrc_t sock, netadr_t *from, sizebuf_
}
curtime = realtime;
#ifdef REHLDS_FIXES
if (newdata && data)
#else
if (newdata)
#endif
{
if (fakeloss.value != 0.0)
{
@ -1023,14 +1027,14 @@ qboolean NET_QueuePacket(netsrc_t sock)
if (ret == -1 || ret == MAX_UDP_PACKET)
{
return NET_LagPacket(0, sock, 0, 0);
return NET_LagPacket(FALSE, sock, NULL, NULL);
}
NET_TransferRawData(&in_message, buf, ret);
if (*(int32 *)in_message.data != NET_HEADER_FLAG_SPLITPACKET)
{
return NET_LagPacket(1, sock, &in_from, &in_message);
return NET_LagPacket(TRUE, sock, &in_from, &in_message);
}
if (in_message.cursize < 9)
@ -1087,7 +1091,7 @@ DLL_EXPORT int NET_Sleep_Timeout(void)
{
SOCKET number = 0;
for (int sock = 0; sock < 3; sock++)
for (int sock = 0; sock < NS_MAX; sock++)
{
SOCKET net_socket = ip_sockets[sock];
if (net_socket != INV_SOCK)
@ -1108,12 +1112,12 @@ DLL_EXPORT int NET_Sleep_Timeout(void)
number = net_socket;
}
#endif // _WIN32
}
res = select((int)(number + 1), &fdset, 0, 0, &tv);
}
res = select((int)(number + 1), &fdset, NULL, NULL, &tv);
}
else
{
res = select(0, 0, 0, 0, &tv);
res = select(0, NULL, NULL, NULL, &tv);
}
--numFrames;
return res;
@ -1128,7 +1132,7 @@ int NET_Sleep(void)
FD_ZERO(&fdset);
number = 0;
for (int sock = 0; sock < 3; sock++)
for (int sock = 0; sock < NS_MAX; sock++)
{
SOCKET net_socket = ip_sockets[sock];
if (net_socket != INV_SOCK)
@ -1154,7 +1158,7 @@ int NET_Sleep(void)
tv.tv_sec = 0;
tv.tv_usec = 20 * 1000;
return select((int)(number + 1), &fdset, 0, 0, net_sleepforever == 0 ? &tv : NULL);
return select((int)(number + 1), &fdset, NULL, NULL, net_sleepforever == 0 ? &tv : NULL);
}
void NET_StartThread(void)
@ -1249,7 +1253,7 @@ qboolean NET_GetPacket(netsrc_t sock)
NET_ThreadLock();
if (NET_GetLoopPacket(sock, &in_from, &in_message))
{
bret = NET_LagPacket(1, sock, &in_from, &in_message);
bret = NET_LagPacket(TRUE, sock, &in_from, &in_message);
}
else
{
@ -1257,11 +1261,11 @@ qboolean NET_GetPacket(netsrc_t sock)
{
bret = NET_QueuePacket(sock);
if (!bret)
bret = NET_LagPacket(0, sock, 0, 0);
bret = NET_LagPacket(FALSE, sock, NULL, NULL);
}
else
{
bret = NET_LagPacket(0, sock, 0, 0);
bret = NET_LagPacket(FALSE, sock, NULL, NULL);
}
}
@ -1306,7 +1310,7 @@ void NET_AllocateQueues(void)
void NET_FlushQueues(void)
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < NS_MAX; i++)
{
net_messages_t *p = messages[i];
while (p)
@ -1919,7 +1923,7 @@ void NET_Config(qboolean multiplayer)
{
NET_ThreadLock();
for (int sock = 0; sock < 3; sock++)
for (int sock = 0; sock < NS_MAX; sock++)
{
if (ip_sockets[sock] != INV_SOCK)
{
@ -2041,7 +2045,7 @@ void NET_Init(void)
in_message.flags = 0;
in_message.buffername = "in_message";
for (int i = 0; i < 3; i++)
for (int i = 0; i < NS_MAX; i++)
{
g_pLagData[i].pPrev = &g_pLagData[i];
g_pLagData[i].pNext = &g_pLagData[i];

View File

@ -46,15 +46,15 @@
#endif // _WIN32
#define MAX_ROUTEABLE_PACKET 1400
const int MAX_ROUTEABLE_PACKET = 1400;
#define SPLIT_SIZE (MAX_ROUTEABLE_PACKET - sizeof(SPLITPACKET))
// Create general message queues
#define NUM_MSG_QUEUES 40
#define MSG_QUEUE_SIZE 1536
const int NUM_MSG_QUEUES = 40;
const int MSG_QUEUE_SIZE = 1536;
#define NET_HEADER_FLAG_SPLITPACKET -2
const int NET_HEADER_FLAG_SPLITPACKET = -2;
typedef struct loopmsg_s
{
@ -62,7 +62,7 @@ typedef struct loopmsg_s
int datalen;
} loopmsg_t;
#define MAX_LOOPBACK 4
const int MAX_LOOPBACK = 4;
typedef struct loopback_s
{
@ -110,7 +110,7 @@ typedef struct SPLITPACKET_t
} SPLITPACKET;
#pragma pack(pop)
#define NET_WS_MAX_FRAGMENTS 5
const int NET_WS_MAX_FRAGMENTS = 5;
#ifdef HOOK_ENGINE
#define net_thread_initialized (*pnet_thread_initialized)

View File

@ -828,7 +828,7 @@ void EXT_FUNC PF_stuffcmd_I(edict_t *pEdict, const char *szFmt, ...)
Q_vsnprintf(szOut, sizeof(szOut), szFmt, argptr);
va_end(argptr);
szOut[1023] = 0;
szOut[sizeof(szOut) - 1] = 0;
if (entnum < 1 || entnum > g_psvs.maxclients)
{
Con_Printf("\n!!!\n\nStuffCmd: Some entity tried to stuff '%s' to console "
@ -977,6 +977,8 @@ int EXT_FUNC iGetIndex(const char *pszField)
IGETINDEX_CHECK_FIELD(noise3);
IGETINDEX_CHECK_FIELD(globalname);
#undef IGETINDEX_CHECK_FIELD
return -1;
}
@ -1017,8 +1019,6 @@ qboolean EXT_FUNC PR_IsEmptyString(const char *s)
int EXT_FUNC PF_precache_sound_I(const char *s)
{
int i;
if (!s)
Host_Error("%s: NULL pointer", __func__);
@ -1032,7 +1032,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
{
g_psv.sound_precache_hashedlookup_built = 0;
for (i = 0; i < MAX_SOUNDS; i++)
for (int i = 0; i < MAX_SOUNDS; i++)
{
if (!g_psv.sound_precache[i])
{
@ -1055,7 +1055,7 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
}
// precaching not enabled. check if already exists.
for (i = 0; i < MAX_SOUNDS; i++)
for (int i = 0; i < MAX_SOUNDS; i++)
{
if (g_psv.sound_precache[i] && !Q_stricmp(g_psv.sound_precache[i], s))
return i;
@ -1541,11 +1541,15 @@ int EXT_FUNC PF_precache_generic_I(const char *s)
int EXT_FUNC PF_IsMapValid_I(const char *mapname)
{
#ifdef REHLDS_FIXES
char cBuf[42];
if (!mapname || mapname[0] == '\0')
#else
char cBuf[260];
if (!mapname || Q_strlen(mapname) == 0)
#endif
return 0;
Q_snprintf(cBuf, sizeof(cBuf), "maps/%.32s.bsp", mapname);
return FS_FileExists(cBuf);
}
@ -1739,7 +1743,6 @@ void EXT_FUNC PF_aim_I(edict_t *ent, float speed, float *rgflReturn)
vec3_t dir;
vec3_t end;
vec3_t bestdir;
int j;
trace_t tr;
float dist;
float bestdist;
@ -1788,7 +1791,7 @@ void EXT_FUNC PF_aim_I(edict_t *ent, float speed, float *rgflReturn)
if (ent->v.team > 0 && ent->v.team == check->v.team)
continue;
for (j = 0; j < 3; j++)
for (int j = 0; j < 3; j++)
{
end[j] = (check->v.maxs[j] + check->v.mins[j]) * 0.75 + check->v.origin[j] + ent->v.view_ofs[j] * 0.0;
}
@ -2099,9 +2102,10 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin
gMsgOrigin[1] = pOrigin[1];
gMsgOrigin[2] = pOrigin[2];
}
#ifndef REHLDS_FIXES
//No idea why is it called here
//Host_IsSinglePlayerGame();
Host_IsSinglePlayerGame();
#endif
}
gMsgBuffer.flags = SIZEBUF_ALLOW_OVERFLOW;
@ -2357,11 +2361,13 @@ void SeedRandomNumberGenerator(void)
}
}
#define IA 16807
#define IM 2147483647
#define IQ 127773
#define IR 2836
#define NTAB 32
const int IA = 16807;
const int IM = 2147483647;
const int IQ = 127773;
const int IR = 2836;
const int NTAB = 32;
#define NDIV (1+(IM-1)/NTAB)
int32 ran1(void)
@ -2523,10 +2529,12 @@ const char* EXT_FUNC PF_GetPlayerAuthId(edict_t *e)
Q_strcpy(szAuthID[count], "BOT");
}
// AUTH_IDTYPE_LOCAL is handled inside SV_GetIDString(), no need to do it here
// else if (cl->network_userid.idtype == AUTH_IDTYPE_LOCAL)
// {
// Q_strcpy(szAuthID[count], "HLTV");
// }
#ifndef REHLDS_FIXES
else if (cl->network_userid.idtype == AUTH_IDTYPE_LOCAL)
{
Q_strcpy(szAuthID[count], "HLTV");
}
#endif
else
{
Q_snprintf(szAuthID[count], sizeof(szAuthID[count]) - 1, "%s", SV_GetClientIDString(cl));
@ -2560,7 +2568,7 @@ const char* EXT_FUNC PF_GetPhysicsInfoString(const edict_t *pClient)
int entnum = NUM_FOR_EDICT(pClient);
if (entnum < 1 || entnum > g_psvs.maxclients)
{
Con_Printf("tried to PF_GetPhysicsInfoString a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
return "";
}
@ -2573,7 +2581,7 @@ const char* EXT_FUNC PF_GetPhysicsKeyValue(const edict_t *pClient, const char *k
int entnum = NUM_FOR_EDICT(pClient);
if (entnum < 1 || entnum > g_psvs.maxclients)
{
Con_Printf("tried to PF_GetPhysicsKeyValue a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
return "";
}
@ -2585,7 +2593,7 @@ void EXT_FUNC PF_SetPhysicsKeyValue(const edict_t *pClient, const char *key, con
{
int entnum = NUM_FOR_EDICT(pClient);
if (entnum < 1 || entnum > g_psvs.maxclients)
Con_Printf("tried to PF_SetPhysicsKeyValue a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
client_t* client = &g_psvs.clients[entnum - 1];
Info_SetValueForKey(client->physinfo, key, value, MAX_INFO_STRING);
@ -2605,7 +2613,7 @@ int EXT_FUNC PF_CanSkipPlayer(const edict_t *pClient)
int entnum = NUM_FOR_EDICT(pClient);
if (entnum < 1 || entnum > g_psvs.maxclients)
{
Con_Printf("tried to PF_CanSkipPlayer a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
return 0;
}
@ -2698,7 +2706,7 @@ void EXT_FUNC PF_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_l
int c = NUM_FOR_EDICT(pClient);
if (c < 1 || c > g_psvs.maxclients)
{
Con_Printf("tried to PF_GetPlayerStats a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
return;
}
@ -2767,7 +2775,7 @@ void EXT_FUNC QueryClientCvarValue(const edict_t *player, const char *cvarName)
if (gNewDLLFunctions.pfnCvarValue)
gNewDLLFunctions.pfnCvarValue(player, "Bad Player");
Con_Printf("tried to QueryClientCvarValue a non-client\n");
Con_Printf("tried to %s a non-client\n", __func__);
return;
}
client_t *client = &g_psvs.clients[entnum - 1];
@ -2783,7 +2791,11 @@ void EXT_FUNC QueryClientCvarValue2(const edict_t *player, const char *cvarName,
if (gNewDLLFunctions.pfnCvarValue2)
gNewDLLFunctions.pfnCvarValue2(player, requestID, cvarName, "Bad Player");
#ifdef REHLDS_FIXES
Con_Printf("tried to %s a non-client\n", __func__);
#else
Con_Printf("tried to QueryClientCvarValue a non-client\n");
#endif
return;
}
client_t *client = &g_psvs.clients[entnum - 1];

View File

@ -458,7 +458,11 @@ void R_StudioCalcBonePosition(int frame, float s, mstudiobone_t *pbone, mstudioa
}
}
}
#ifdef REHLDS_FIXES
if (adj && pbone->bonecontroller[j] != -1)
#else
if (pbone->bonecontroller[j] != -1)
#endif
{
pos[j] += adj[pbone->bonecontroller[j]];
}
@ -1090,7 +1094,7 @@ int R_StudioComputeBounds(unsigned char *pBuffer, float *mins, float *maxs)
for (int f = 0; f < num_frames; ++f)
{
vec3_t bonepos;
R_StudioCalcBonePosition(f, 0.0, &pbones[bone], panim, 0, bonepos);
R_StudioCalcBonePosition(f, 0.0, &pbones[bone], panim, NULL, bonepos);
R_StudioBoundBone(bone_mins, bone_maxs, &bone_count, bonepos);
}
}

View File

@ -31,8 +31,8 @@
#include "maintypes.h"
// TODO: I think this defines must be in /common/
#define NUM_EDICTS 900
#define MAX_NAME 32
const int NUM_EDICTS = 900;
const int MAX_NAME = 32;
#include "custom_int.h"
#include "crc.h"
@ -54,9 +54,9 @@
#include "inst_baseline.h"
#include "net_ws.h"
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0f
#define DEFAULT_SOUND_PACKET_PITCH 100
const int DEFAULT_SOUND_PACKET_VOLUME = 255;
const float DEFAULT_SOUND_PACKET_ATTENUATION = 1.0f;
const int DEFAULT_SOUND_PACKET_PITCH = 100;
// Sound flags
enum
@ -82,10 +82,10 @@ enum
MSG_FL_ONE = BIT(7), // Send to single client
};
#define RESOURCE_INDEX_BITS 12
const int RESOURCE_INDEX_BITS = 12;
#ifdef REHLDS_FIXES
#define RESOURCE_MAX_COUNT (1 << RESOURCE_INDEX_BITS)
const int RESOURCE_MAX_COUNT = BIT(RESOURCE_INDEX_BITS);
#endif // REHLDS_FIXES
typedef enum redirect_e

View File

@ -31,7 +31,7 @@
#include "quakedef.h"
// max number of sentences in game. NOTE: this must match CVOXFILESENTENCEMAX in dlls\util.h!!!
#define CVOXFILESENTENCEMAX 1536
const int CVOXFILESENTENCEMAX = 1536;
typedef struct sfx_s
{

View File

@ -2011,7 +2011,7 @@ int EXT_FUNC SV_FinishCertificateCheck_internal(netadr_t *adr, int nAuthProtocol
const char *val = Info_ValueForKey(userinfo, "*hltv");
if (val[0] == 0 || Q_atoi(val) != 1)
if (val[0] == 0 || Q_atoi(val) != TYPE_PROXY)
{
SV_RejectConnection(adr, "Invalid CD Key.\n");
return 0;
@ -2254,10 +2254,10 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in
switch (Q_atoi(s))
{
case 0:
case TYPE_CLIENT:
return 1;
case 1:
case TYPE_PROXY:
SV_CountProxies(&proxies);
if (proxies >= sv_proxies.value && !bIsReconnecting)
{
@ -2266,7 +2266,7 @@ int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, in
}
return 1;
case 3:
case TYPE_COMMENTATOR:
SV_RejectConnection(adr, "Please connect to HLTV master proxy.\n");
return 0;
@ -2470,7 +2470,7 @@ void EXT_FUNC SV_ConnectClient_internal(void)
SV_RejectConnection(&adr, "Invalid validation type\n");
return;
}
if (Q_atoi(val) != 1)
if (Q_atoi(val) != TYPE_PROXY)
{
SV_RejectConnection(&adr, "Invalid validation type\n");
return;
@ -3239,8 +3239,8 @@ void SV_BeginRedirect(redirect_t rd, netadr_t *addr)
outputbuf[0] = 0;
}
#define MAX_RCON_FAILURES_STORAGE 32
#define MAX_RCON_FAILURES 20
const int MAX_RCON_FAILURES_STORAGE = 32;
const int MAX_RCON_FAILURES = 20;
typedef struct rcon_failure_s
{
@ -4329,8 +4329,12 @@ int SV_CreatePacketEntities_internal(sv_delta_t type, client_t *client, packet_e
else
newindex = 9999;
}
#ifdef REHLDS_FIXES
if (oldnum < oldmax && from)
#else
if (oldnum < oldmax)
#endif
oldindex = from->entities[oldnum].number;
else
oldindex = 9999;
@ -5051,7 +5055,7 @@ void SV_ExtractFromUserinfo(client_t *cl)
cl->lc = val[0] != 0 ? Q_atoi(val) != 0 : 0;
val = Info_ValueForKey(userinfo, "*hltv");
cl->proxy = val[0] != 0 ? Q_atoi(val) == 1 : 0;
cl->proxy = val[0] != 0 ? Q_atoi(val) == TYPE_PROXY : 0;
SV_CheckUpdateRate(&cl->next_messageinterval);
SV_CheckRate(cl);

View File

@ -31,7 +31,7 @@
#include "maintypes.h"
#include "server.h"
#define DI_NODIR -1
const int DI_NODIR = -1;
#ifdef HOOK_ENGINE

View File

@ -33,7 +33,7 @@
#include "world.h"
#include "pm_defs.h"
#define CMD_MAXBACKUP 64
const int CMD_MAXBACKUP = 64;
typedef struct command_s command_t;

View File

@ -619,15 +619,15 @@ double EXT_FUNC Sys_FloatTime(void)
double Sys_FloatTime(void)
{
static struct timespec start_time;
static bool bInitialized;
static bool bInitialized = false;
struct timespec now;
if ( !bInitialized )
{
bInitialized = 1;
clock_gettime(1, &start_time);
bInitialized = true;
clock_gettime(CLOCK_MONOTONIC, &start_time);
}
clock_gettime(1, &now);
clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec - start_time.tv_sec) + now.tv_nsec * 0.000000001;
}

View File

@ -52,7 +52,7 @@
#endif
#define MAX_DISCONNECT_REASON 256
const int MAX_DISCONNECT_REASON = 256;
#ifdef HOOK_ENGINE

View File

@ -524,10 +524,7 @@ int Sys_InitGame(char *lpOrgCmdLine, char *pBaseDir, void *pwnd, int bIsDedicate
ClientDLL_ActivateMouse();
char MessageText[512];
const char en_US[12];
Q_strcpy(en_US, "en_US.UTF-8");
en_US[16] = 0;
const char en_US[] = "en_US.UTF-8";
char *cat = setlocale(6, NULL);
if (!cat)

View File

@ -36,7 +36,8 @@
#include "engine_launcher_api.h"
#include "idedicatedexports.h"
#define FIFTEEN_MB (15 * 1024 * 1024)
const int FIFTEEN_MB = (15 * 1024 * 1024);
#define MINIMUM_WIN_MEMORY 0x0e00000
#define WARNING_MEMORY 0x0200000
#define MAXIMUM_WIN_MEMORY 0x8000000 // Ask for 128 MB max

View File

@ -31,7 +31,7 @@
#include "maintypes.h"
#include "wad.h"
#define MAX_MAP_TEXTURES 512
const int MAX_MAP_TEXTURES = 512;
typedef struct texlumpinfo_s
{

View File

@ -115,17 +115,19 @@ char* EXT_FUNC memfgets(unsigned char *pMemFile, int fileSize, int *pFilePos, ch
int IsComment(char *pText)
{
int length;
if (!pText)
{
return TRUE;
}
length = Q_strlen(pText);
if (length >= 2 && pText[0] == '/' && pText[1] == '/' || length <= 0)
#ifdef REHLDS_FIXES
if ((pText[0] == '/' && pText[1] == '/') || !pText[0])
return TRUE;
#else
int length = Q_strlen(pText);
if ((length >= 2 && pText[0] == '/' && pText[1] == '/') || length <= 0)
{
return TRUE;
}
}
#endif
return FALSE;
}

View File

@ -30,19 +30,19 @@
#include "maintypes.h"
#define DEMO_MESSAGE "__DEMOMESSAGE__"
#define NETWORK_MESSAGE1 "__NETMESSAGE__1"
#define NETWORK_MESSAGE2 "__NETMESSAGE__2"
#define NETWORK_MESSAGE3 "__NETMESSAGE__3"
#define NETWORK_MESSAGE4 "__NETMESSAGE__4"
static const char *DEMO_MESSAGE = "__DEMOMESSAGE__";
static const char *NETWORK_MESSAGE1 = "__NETMESSAGE__1";
static const char *NETWORK_MESSAGE2 = "__NETMESSAGE__2";
static const char *NETWORK_MESSAGE3 = "__NETMESSAGE__3";
static const char *NETWORK_MESSAGE4 = "__NETMESSAGE__4";
#define MAX_NETMESSAGE 4
const int MAX_NETMESSAGE = 4;
#define MSGFILE_NAME 0
#define MSGFILE_TEXT 1
const int MSGFILE_NAME = 0;
const int MSGFILE_TEXT = 1;
#define NAME_HEAP_SIZE 16384
#define MAX_MESSAGES 1000
const int NAME_HEAP_SIZE = 16384;
const int MAX_MESSAGES = 1000;
#ifdef HOOK_ENGINE

View File

@ -68,7 +68,7 @@ typedef struct wadlist_s
typedef struct wadlist_s wadlist_t;
typedef struct lumpinfo_s lumpinfo_t;
#define NUM_WADS 2
const int NUM_WADS = 2;
#ifdef HOOK_ENGINE
#define wads (*pwads)

View File

@ -46,7 +46,7 @@ all big things are allocated on the hunk.
*/
#define ZONEID 0x001d4a11
#define MINFRAGMENT 64
const int MINFRAGMENT = 64;
typedef struct memblock_s
{
@ -285,7 +285,7 @@ void Z_CheckHeap(void)
#ifndef Hunk_Functions_region
#define HUNK_NAME_LEN 64
const int HUNK_NAME_LEN = 64;
#define HUNK_SENTINEL 0x1df001ed
typedef struct hunk_s
@ -579,7 +579,7 @@ CACHE MEMORY
===============================================================================
*/
#define CACHE_NAME_LEN 64
const int CACHE_NAME_LEN = 64;
typedef struct cache_system_s
{
@ -1118,7 +1118,7 @@ NOXREF void Cache_Print_Models_And_Totals(void)
FS_Close(file);
}
#define MAX_SFX 1024
const int MAX_SFX = 1024;
NOXREF void Cache_Print_Sounds_And_Totals(void)
{

View File

@ -36,11 +36,11 @@ IBaseInterface* CreateFileSystemInterface(void);
InterfaceReg iface = InterfaceReg(CreateFileSystemInterface, "VFileSystem009");
#ifdef _WIN32
#define ORIGINAL_ENGINE_DLL_NAME "swds.dll"
#define ORIGINAL_FILESYSTEM_DLL_NAME "filesystem_stdio2.dll"
const char *ORIGINAL_ENGINE_DLL_NAME = "swds.dll";
const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.dll";
#else
#define ORIGINAL_ENGINE_DLL_NAME "engine_i486.so"
#define ORIGINAL_FILESYSTEM_DLL_NAME "filesystem_stdio2.so"
const char *ORIGINAL_ENGINE_DLL_NAME = "engine_i486.so";
const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.so";
#endif
CSysModule *g_pOriginalFileSystemModule = NULL;

View File

@ -32,7 +32,7 @@
#include "osconfig.h"
#define MAX_PATTERN 128
const int MAX_PATTERN = 128;
struct Section;

View File

@ -1,6 +1,6 @@
#include "precompiled.h"
#define REHLDS_DEBUG_MAX_EDICTS 2048
const int REHLDS_DEBUG_MAX_EDICTS = 2048;
uint32 calcFloatChecksum(uint32 crc, const float* pFloat) {
uint32 sVal = *reinterpret_cast<const uint32*>(pFloat);

View File

@ -28,7 +28,7 @@
#pragma once
#include "hookchains.h"
#define MAX_HOOKS_IN_CHAIN 19
const int MAX_HOOKS_IN_CHAIN = 19;
// Implementation for chains in modules
template<typename t_ret, typename ...t_args>

View File

@ -59,3 +59,4 @@
#include "rehlds_security.h"
#include "dlls/cdll_dll.h"
#include "hltv.h"

View File

@ -10,8 +10,8 @@
#include <iostream>
#include <fstream>
#define HOSTENT_DATA_MAX_ALIASES 10
#define HOSTENT_DATA_MAX_ADDRS 32
const int HOSTENT_DATA_MAX_ALIASES = 10;
const int HOSTENT_DATA_MAX_ADDRS = 32;
struct hostent_data_t {
char hostName[256];

View File

@ -1,8 +1,8 @@
#pragma once
#ifdef _WIN32
#define TESTPLAYER_FUNCTREE_DEPTH 8
#define TESTPLAYER_FUNCCALL_MAXSIZE 17000
const int TESTPLAYER_FUNCTREE_DEPTH = 8;
const int TESTPLAYER_FUNCCALL_MAXSIZE = 17000;
#include "osconfig.h"
#include "funccalls.h"

View File

@ -10,8 +10,8 @@
#include <fstream>
#include <unordered_map>
#define TESTSUITE_PROTOCOL_VERSION_MINOR 5
#define TESTSUITE_PROTOCOL_VERSION_MAJOR 0
const int TESTSUITE_PROTOCOL_VERSION_MINOR = 5;
const int TESTSUITE_PROTOCOL_VERSION_MAJOR = 0;
void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs);