Browse Source

lowmemory: prevent redefines

pull/2/head
mittorn 5 years ago
parent
commit
6953e829c4
  1. 4
      common/xash3d_types.h
  2. 3
      engine/client/cl_parse.c
  3. 5
      engine/common/common.h
  4. 4
      engine/common/net_ws.h
  5. 17
      engine/common/netchan.h
  6. 21
      engine/common/protocol.h

4
common/xash3d_types.h

@ -142,9 +142,9 @@ typedef void (*setpair_t)( const char *key, const void *value, void *buffer, voi @@ -142,9 +142,9 @@ typedef void (*setpair_t)( const char *key, const void *value, void *buffer, voi
// config strings are a general means of communication from
// the server to all connected clients.
// each config string can be at most CS_SIZE characters.
#if XASH_LOW_MEMORY == 0
#define MAX_QPATH 64 // max length of a game pathname
#if XASH_LOW_MEMORY == 2
#elif XASH_LOW_MEMORY == 2
#define MAX_QPATH 32 // should be enough for singleplayer
#elif XASH_LOW_MEMORY == 1
#define MAX_QPATH 48

3
engine/client/cl_parse.c

@ -2754,8 +2754,9 @@ void CL_LegacyUpdateUserinfo( sizebuf_t *msg ) @@ -2754,8 +2754,9 @@ void CL_LegacyUpdateUserinfo( sizebuf_t *msg )
}
else memset( player, 0, sizeof( *player ));
}
#if XASH_LOW_MEMORY == 0
#define MAX_LEGACY_RESOURCES 2048
#if XASH_LOW_MEMORY == 2
#elif XASH_LOW_MEMORY == 2
#define MAX_LEGACY_RESOURCES 1
#elif XASH_LOW_MEMORY == 1
#define MAX_LEGACY_RESOURCES 512

5
engine/common/common.h

@ -137,14 +137,15 @@ typedef enum @@ -137,14 +137,15 @@ typedef enum
#define CIN_MAIN 0
#define CIN_LOGO 1
#if XASH_LOW_MEMORY == 0
#define MAX_DECALS 512 // touching TE_DECAL messages, etc
#define MAX_STATIC_ENTITIES 3096 // static entities that moved on the client when level is spawn
#if XASH_LOW_MEMORY == 2
#elif 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_DECALS 512 // touching TE_DECAL messages, etc
#define MAX_STATIC_ENTITIES 128 // static entities that moved on the client when level is spawn
#endif

4
engine/common/net_ws.h

@ -29,8 +29,10 @@ typedef enum @@ -29,8 +29,10 @@ typedef enum
// Max length of a multicast message
#define MAX_MULTICAST 8192 // some mods spamming for rain effect
#if !XASH_LOW_MEMORY
#define MAX_INIT_MSG 0x20000 // max length of possible message
#if XASH_LOW_MEMORY
#else
#define MAX_INIT_MSG 0x8000
#endif
// net packets type

17
engine/common/netchan.h

@ -89,16 +89,25 @@ GNU General Public License for more details. @@ -89,16 +89,25 @@ GNU General Public License for more details.
#define NETSPLIT_HEADER_SIZE 18
#if XASH_LOW_MEMORY == 2
#undef MULTIPLAYER_BACKUP
#undef SINGLEPLAYER_BACKUP
#undef NUM_PACKET_ENTITIES
#undef MAX_CUSTOM_BASELINES
#undef NET_MAX_FRAGMENT
#define MULTIPLAYER_BACKUP 4 // breaks protocol in legacy mode, new protocol status unknown
#define SINGLEPLAYER_BACKUP 4
#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
#undef SINGLEPLAYER_BACKUP
#undef NUM_PACKET_ENTITIES
#undef MAX_CUSTOM_BASELINES
#undef NET_MAX_FRAGMENT
#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

21
engine/common/protocol.h

@ -183,6 +183,17 @@ GNU General Public License for more details. @@ -183,6 +183,17 @@ GNU General Public License for more details.
#define FRAGMENT_LOCAL_SIZE FRAGMENT_MAX_SIZE // local connection
#if XASH_LOW_MEMORY == 2
#undef MAX_VISIBLE_PACKET
#undef MAX_VISIBLE_PACKET_VIS_BYTES
#undef MAX_EVENTS
#undef MAX_SUPPORTED_MODELS
#undef MAX_MODELS
#undef MAX_SOUNDS
#undef MAX_CUSTOM
#undef MAX_DLIGHTS
#undef MAX_ELIGHTS
#undef MAX_RENDER_DECALS
#undef MAX_RESOURCES
// 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)
@ -202,6 +213,14 @@ GNU General Public License for more details. @@ -202,6 +213,14 @@ GNU General Public License for more details.
#define MAX_RENDER_DECALS 64 // max rendering decals per a level
#define MAX_RESOURCES 1024
#elif XASH_LOW_MEMORY == 1
#undef MAX_VISIBLE_PACKET
#undef MAX_VISIBLE_PACKET_VIS_BYTES
#undef MAX_EVENTS
#undef MAX_SUPPORTED_MODELS
#undef MAX_MODELS
#undef MAX_CUSTOM
#undef MAX_RENDER_DECALS
#undef MAX_RESOURCES
#define MAX_VISIBLE_PACKET 256
#define MAX_VISIBLE_PACKET_VIS_BYTES ((MAX_VISIBLE_PACKET + 7) / 8)
@ -212,7 +231,7 @@ GNU General Public License for more details. @@ -212,7 +231,7 @@ GNU General Public License for more details.
#define MAX_MODELS 1024
#define MAX_CUSTOM 512
#define MAX_RENDER_DECALS 128
#define MAX_RESOURCES 1024
#endif

Loading…
Cancel
Save