lowmemory: tune XASH_LOW_MEMORY=1 not breaking multiplayer

This commit is contained in:
mittorn 2019-11-04 19:58:45 +07:00
parent d6f8112860
commit 0e7013eeb0
6 changed files with 36 additions and 9 deletions

View File

@ -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

View File

@ -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 )
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 );

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.
#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