Browse Source

lowmemory: tune XASH_LOW_MEMORY=1 not breaking multiplayer

pull/2/head
mittorn 5 years ago
parent
commit
0e7013eeb0
  1. 4
      common/xash3d_types.h
  2. 12
      engine/client/cl_parse.c
  3. 2
      engine/common/common.h
  4. 2
      engine/common/net_ws.h
  5. 5
      engine/common/netchan.h
  6. 20
      engine/common/protocol.h

4
common/xash3d_types.h

@ -145,7 +145,9 @@ typedef void (*setpair_t)( const char *key, const void *value, void *buffer, voi @@ -145,7 +145,9 @@ typedef void (*setpair_t)( const char *key, const void *value, void *buffer, voi
#define MAX_QPATH 64 // max length of a game pathname
#if XASH_LOW_MEMORY == 2
#define MAX_QPATH 32
#define MAX_QPATH 32 // should be enough for singleplayer
#elif XASH_LOW_MEMORY == 1
#define MAX_QPATH 48
#endif
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define CS_SIZE 64 // size of one config string

12
engine/client/cl_parse.c

@ -2754,8 +2754,11 @@ void CL_LegacyUpdateUserinfo( sizebuf_t *msg ) @@ -2754,8 +2754,11 @@ void CL_LegacyUpdateUserinfo( sizebuf_t *msg )
}
else memset( player, 0, sizeof( *player ));
}
#define MAX_LEGACY_RESOURCES 2048
#if XASH_LOW_MEMORY == 2
#define MAX_RESOURCES 64
#define MAX_LEGACY_RESOURCES 1
#elif XASH_LOW_MEMORY == 1
#define MAX_LEGACY_RESOURCES 512
#endif
/*
==============
@ -2770,13 +2773,16 @@ void CL_LegacyParseResourceList( sizebuf_t *msg ) @@ -2770,13 +2773,16 @@ void CL_LegacyParseResourceList( sizebuf_t *msg )
static struct
{
int rescount;
int restype[MAX_RESOURCES];
char resnames[MAX_RESOURCES][MAX_QPATH];
int restype[MAX_LEGACY_RESOURCES];
char resnames[MAX_LEGACY_RESOURCES][MAX_QPATH];
} reslist;
memset( &reslist, 0, sizeof( reslist ));
reslist.rescount = MSG_ReadWord( msg ) - 1;
if( reslist.rescount > MAX_LEGACY_RESOURCES )
Host_Error("MAX_RESOURCES reached\n");
for( i = 0; i < reslist.rescount; i++ )
{
reslist.restype[i] = MSG_ReadWord( msg );

2
engine/common/common.h

@ -144,6 +144,8 @@ typedef enum @@ -144,6 +144,8 @@ typedef enum
#if XASH_LOW_MEMORY == 2
#define MAX_DECALS 256 // touching TE_DECAL messages, etc
#define MAX_STATIC_ENTITIES 32 // static entities that moved on the client when level is spawn
#elif XASH_LOW_MEMORY == 1
#define MAX_STATIC_ENTITIES 128 // static entities that moved on the client when level is spawn
#endif
// filesystem flags

2
engine/common/net_ws.h

@ -30,7 +30,7 @@ typedef enum @@ -30,7 +30,7 @@ typedef enum
#define MAX_MULTICAST 8192 // some mods spamming for rain effect
#define MAX_INIT_MSG 0x20000 // max length of possible message
#if XASH_LOW_MEMORY == 2
#if XASH_LOW_MEMORY
#define MAX_INIT_MSG 0x8000
#endif
// net packets type

5
engine/common/netchan.h

@ -94,6 +94,11 @@ GNU General Public License for more details. @@ -94,6 +94,11 @@ GNU General Public License for more details.
#define NUM_PACKET_ENTITIES 32
#define MAX_CUSTOM_BASELINES 8
#define NET_MAX_FRAGMENT 32768
#elif XASH_LOW_MEMORY == 1
#define SINGLEPLAYER_BACKUP 4
#define NUM_PACKET_ENTITIES 64
#define MAX_CUSTOM_BASELINES 8
#define NET_MAX_FRAGMENT 32768
#endif
typedef struct netsplit_chain_packet_s

20
engine/common/protocol.h

@ -183,7 +183,7 @@ GNU General Public License for more details. @@ -183,7 +183,7 @@ GNU General Public License for more details.
#define FRAGMENT_LOCAL_SIZE FRAGMENT_MAX_SIZE // local connection
#if XASH_LOW_MEMORY == 2
// memory reduced protocol, not for use in multiplayer
// memory reduced protocol, not for use in multiplayer (but still compatible)
#define MAX_VISIBLE_PACKET 128
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
@ -194,16 +194,28 @@ GNU General Public License for more details. @@ -194,16 +194,28 @@ GNU General Public License for more details.
#define MAX_MODELS 512
#define MAX_SOUNDS 512 // do not change MAX_SOUND_BITS
#define MAX_SOUNDS_NONSENTENCE 2048
#define MAX_SOUNDS 512
#define MAX_CUSTOM 32
#define MAX_DLIGHTS 16 // dynamic lights (rendered per one frame)
#define MAX_ELIGHTS 32 // entity only point lights
#define MAX_RENDER_DECALS 64 // max rendering decals per a level
#define MAX_RESOURCES 1024
#elif XASH_LOW_MEMORY == 1
#define MAX_VISIBLE_PACKET 256
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
#define MAX_EVENTS 128
#define MAX_SUPPORTED_MODELS 1024
#define MAX_MODELS 1024
#define MAX_CUSTOM 512
#define MAX_RESOURCES 1024
#endif
// Quake1 Protocol
#define PROTOCOL_VERSION_QUAKE 15

Loading…
Cancel
Save