]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
migrated a large number of #define MAX values to quakedef.h and added a
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Nov 2009 16:04:42 +0000 (16:04 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Nov 2009 16:04:42 +0000 (16:04 +0000)
#ifdef DP_SMALLMEMORY case which drops darkplaces-sdl from 42MB to 24MB
of reserved space (according to size command)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9467 d7cf8633-e32d-0410-b094-e92efae38249

31 files changed:
bspfile.h
cd_shared.c
cl_dyntexture.h
cl_gecko.h
cl_particles.c
cl_video.h
client.h
clvm_cmds.c
cmd.c
common.h
console.c
csprogs.c
cvar.c
gl_backend.h
gl_draw.c
gl_rmain.c
gl_rsurf.c
keys.c
menu.c
menu.h
model_shared.c
model_shared.h
quakedef.h
r_explosion.c
r_modules.c
r_shadow.c
render.h
server.h
snd_main.c
snd_main.h
svvm_cmds.c

index fe00b3254357890670b3f6737b23c65911780e86..648b294d4d978abe79a58a7ceb7a87fc4204a81d 100644 (file)
--- a/bspfile.h
+++ b/bspfile.h
@@ -19,13 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 
-#define        MAX_MAP_HULLS           16              // was 4
-#define        MAX_MAP_LEAFS           65536   // was 8192
-
-// key / value pair sizes
-
-#define        MAX_KEY         32
-#define        MAX_VALUE       1024
+#define MAX_MAP_HULLS 16 // Q1BSP has 4, Hexen2 Q1BSP has 8, MCBSP has 16
 
 //=============================================================================
 
index 7706e91c3c05e61eb672d80235621b726e2ed7e8..f00f66123aae8d245015acc4a5ee2ac87751b3af 100644 (file)
@@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "cdaudio.h"
 #include "sound.h"
 
-#define MAXTRACKS      256
-
 // Prototypes of the system dependent functions
 extern void CDAudio_SysEject (void);
 extern void CDAudio_SysCloseDoor (void);
@@ -50,7 +48,9 @@ static qboolean initialized = false;
 static qboolean enabled = false;
 static float cdvolume;
 typedef char filename_t[MAX_QPATH];
+#ifdef MAXTRACKS
 static filename_t remap[MAXTRACKS];
+#endif
 static unsigned char maxTrack;
 static int faketrack = -1;
 
@@ -156,6 +156,7 @@ void CDAudio_Play_byName (const char *trackname, qboolean looping)
        if(strspn(trackname, "0123456789") == strlen(trackname))
        {
                track = (unsigned char) atoi(trackname);
+#ifdef MAXTRACKS
                if(track > 0 && track < MAXTRACKS)
                        if(*remap[track])
                        {
@@ -183,6 +184,7 @@ void CDAudio_Play_byName (const char *trackname, qboolean looping)
                                        }
                                }
                        }
+#endif
        }
 
        if(strspn(trackname, "0123456789") == strlen(trackname))
@@ -366,8 +368,10 @@ void CDAudio_Resume (void)
 static void CD_f (void)
 {
        const char *command;
+#ifdef MAXTRACKS
        int ret;
        int n;
+#endif
 
        command = Cmd_Argv (1);
 
@@ -391,8 +395,10 @@ static void CD_f (void)
        {
                enabled = true;
                CDAudio_Stop();
+#ifdef MAXTRACKS
                for (n = 0; n < MAXTRACKS; n++)
                        *remap[n] = 0; // empty string, that is, unremapped
+#endif
                CDAudio_GetAudioDiskInfo();
                return;
        }
@@ -406,6 +412,7 @@ static void CD_f (void)
 
        if (strcasecmp(command, "remap") == 0)
        {
+#ifdef MAXTRACKS
                ret = Cmd_Argc() - 2;
                if (ret <= 0)
                {
@@ -416,6 +423,7 @@ static void CD_f (void)
                }
                for (n = 1; n <= ret; n++)
                        strlcpy(remap[n], Cmd_Argv (n+1), sizeof(*remap));
+#endif
                return;
        }
 
@@ -535,7 +543,9 @@ void CDAudio_Update (void)
 
 int CDAudio_Init (void)
 {
+#ifdef MAXTRACKS
        int i;
+#endif
 
        if (cls.state == ca_dedicated)
                return -1;
@@ -546,8 +556,10 @@ int CDAudio_Init (void)
 
        CDAudio_SysInit();
 
+#ifdef MAXTRACKS
        for (i = 0; i < MAXTRACKS; i++)
                *remap[i] = 0;
+#endif
 
        Cvar_RegisterVariable(&cdaudio);
        Cvar_RegisterVariable(&cdaudioinitialized);
index 3b0a683470087a507d9cef1297ccb6ee2ccc4b28..29783cf6bb1d7c4979490411c3c73d15487e8932 100644 (file)
@@ -3,7 +3,6 @@
 #define CL_DYNTEXTURE_H\r
 \r
 #define CLDYNTEXTUREPREFIX                     "_dynamic/"\r
-#define MAX_DYNAMIC_TEXTURE_COUNT                      64\r
 \r
 // always path fully specified names to the dynamic texture functions! (ie. with the _dynamic/ prefix, etc.!)\r
 \r
index fd12e801ec8d085f5938453e568393ef59effdef..22ab2fa511fb858e712ef182e01bdee6ff0bbfe9 100644 (file)
@@ -6,7 +6,6 @@
 #include "cl_dyntexture.h"\r
 \r
 #define CLGECKOPREFIX                  CLDYNTEXTUREPREFIX "gecko/"\r
-#define MAX_GECKO_INSTANCES    16\r
 \r
 typedef enum clgecko_buttoneventtype_e {\r
        CLG_BET_DOWN,\r
index 4ee4690139c56c4435727a2ef5bd653f26f44905..70dc7cc52d506b0bcd5ded5be937645c525c3906 100644 (file)
@@ -120,10 +120,8 @@ typedef struct particleeffectinfo_s
 }
 particleeffectinfo_t;
 
-#define MAX_PARTICLEEFFECTNAME 256
 char particleeffectname[MAX_PARTICLEEFFECTNAME][64];
 
-#define MAX_PARTICLEEFFECTINFO 4096
 
 particleeffectinfo_t particleeffectinfo[MAX_PARTICLEEFFECTINFO];
 
@@ -169,7 +167,6 @@ int         ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
 
 //static int explosparkramp[8] = {0x4b0700, 0x6f0f00, 0x931f07, 0xb7330f, 0xcf632b, 0xe3974f, 0xffe7b5, 0xffffff};
 
-#define MAX_PARTICLETEXTURES 1024
 // particletexture_t is a rectangle in the particlefonttexture
 typedef struct particletexture_s
 {
index 05bf4a160cbca5f8fd5d64a73db3132cbe0be753..d98c0087d5179e7cd14ad3a85eb28e19c9e055a1 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "cl_dyntexture.h"
 
-#define MAXCLVIDEOS            64 + 1 // 1 video is reserved for the cinematic mode
 // yields DYNAMIC_TEXTURE_PATH_PREFIX CLVIDEOPREFIX video name for a path
 #define CLVIDEOPREFIX  CLDYNTEXTUREPREFIX "video/"
 #define CLTHRESHOLD            2.0
index c57c01775394e16de7dab6ac670301616b387626..ac5e866d4eae26906eb85fc99e2910dd8d859250 100644 (file)
--- a/client.h
+++ b/client.h
@@ -25,12 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "matrixlib.h"
 #include "snd_main.h"
 
-// LordHavoc: 256 dynamic lights
-#define MAX_DLIGHTS 256
-
-/// this is the maximum number of input packets that can be predicted
-#define CL_MAX_USERCMDS 128
-
 // flags for rtlight rendering
 #define LIGHTFLAG_NORMALMODE 1
 #define LIGHTFLAG_REALTIMEMODE 2
@@ -271,7 +265,7 @@ framegroupblend_t;
 // note: technically each framegroupblend can produce two of these, but that
 // never happens in practice because no one blends between more than 2
 // framegroups at once
-#define MAX_FRAMEBLENDS MAX_FRAMEGROUPBLENDS
+#define MAX_FRAMEBLENDS (MAX_FRAMEGROUPBLENDS * 2)
 typedef struct frameblend_s
 {
        int subframe;
@@ -477,9 +471,6 @@ typedef struct cshift_s
 
 #define        SIGNONS         4                       // signon messages to receive before connected
 
-#define        MAX_DEMOS               8
-#define        MAX_DEMONAME    16
-
 typedef enum cactive_e
 {
        ca_uninitialized,       // during early startup
@@ -1564,19 +1555,23 @@ r_refdef_view_t;
 
 typedef struct r_refdef_viewcache_s
 {
+       // updated by gl_main_newmap()
+       int maxentities;
+       int world_numclusters;
+       int world_numleafs;
+       int world_numsurfaces;
+
        // these properties are generated by R_View_Update()
 
        // which entities are currently visible for this viewpoint
        // (the used range is 0...r_refdef.scene.numentities)
-       unsigned char entityvisible[MAX_EDICTS];
+       unsigned char *entityvisible;
+
        // flag arrays used for visibility checking on world model
        // (all other entities have no per-surface/per-leaf visibility checks)
-       // TODO: dynamic resize according to r_refdef.scene.worldmodel->brush.num_clusters
-       unsigned char world_pvsbits[(32768+7)>>3]; // FIXME: buffer overflow on huge maps
-       // TODO: dynamic resize according to r_refdef.scene.worldmodel->brush.num_leafs
-       unsigned char world_leafvisible[32768]; // FIXME: buffer overflow on huge maps
-       // TODO: dynamic resize according to r_refdef.scene.worldmodel->num_surfaces
-       unsigned char world_surfacevisible[262144]; // FIXME: buffer overflow on huge maps
+       unsigned char *world_pvsbits;
+       unsigned char *world_leafvisible;
+       unsigned char *world_surfacevisible;
        // if true, the view is currently in a leaf without pvs data
        qboolean world_novis;
 }
@@ -1613,10 +1608,10 @@ typedef struct r_refdef_scene_s {
        int numlights;
 
        // intensities for light styles right now, controls rtlights
-       float rtlightstylevalue[256];   // float fraction of base light value
+       float rtlightstylevalue[MAX_LIGHTSTYLES];       // float fraction of base light value
        // 8.8bit fixed point intensities for light styles
        // controls intensity lightmap layers
-       unsigned short lightstylevalue[256];    // 8.8 fraction of base light value
+       unsigned short lightstylevalue[MAX_LIGHTSTYLES];        // 8.8 fraction of base light value
 
        float ambient;
 
index 82d63a16dd317bfeee17e42c8d426b2115c19f7f..6e6efed86c491d6584a214f7a0871dc9a47b36a2 100644 (file)
@@ -189,7 +189,7 @@ static void VM_CL_sound (void)
                return;
        }
 
-       S_StartSound(32768 + PRVM_NUM_FOR_EDICT(entity), channel, S_FindName(sample), entity->fields.client->origin, volume, attenuation);
+       S_StartSound(MAX_EDICTS + PRVM_NUM_FOR_EDICT(entity), channel, S_FindName(sample), entity->fields.client->origin, volume, attenuation);
 }
 
 // #483 void(vector origin, string sample, float volume, float attenuation) pointsound
@@ -219,8 +219,8 @@ static void VM_CL_pointsound(void)
                return;
        }
 
-       // Send World Entity as Entity to Play Sound (for CSQC, that is 32768)
-       S_StartSound(32768, 0, S_FindName(sample), org, volume, attenuation);
+       // Send World Entity as Entity to Play Sound (for CSQC, that is MAX_EDICTS)
+       S_StartSound(MAX_EDICTS, 0, S_FindName(sample), org, volume, attenuation);
 }
 
 // #14 entity() spawn
@@ -3594,8 +3594,8 @@ static void VM_CL_checkpvs (void)
 #if 1
        unsigned char *pvs;
 #else
-       static int fatpvsbytes;
-       static unsigned char fatpvs[MAX_MAP_LEAFS/8];
+       int fatpvsbytes;
+       unsigned char fatpvs[MAX_MAP_LEAFS/8];
 #endif
 
        VM_SAFEPARMCOUNT(2, VM_SV_checkpvs);
diff --git a/cmd.c b/cmd.c
index 3457a534062c3e92c1da72c5f16c163bfaec428c..db6acdb99072cd68c78ed7bbc4db2e98bed61583 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -21,17 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
-#define        MAX_ALIAS_NAME  32
-// this is the largest script file that can be executed in one step
-// LordHavoc: inreased this from 8192 to 32768
-// div0: increased this from 32k to 128k
-// div0: increased this from 128k to 640k which ought to be enough for anyone
-#define CMDBUFSIZE 655360
-// maximum number of parameters to a command
-#define        MAX_ARGS 80
-// maximum tokenizable commandline length (counting NUL terminations)
-#define CMD_TOKENIZELENGTH (MAX_INPUTLINE + MAX_ARGS)
-
 typedef struct cmdalias_s
 {
        struct cmdalias_s *next;
index cc5029ea24b2ac2c470ae3e80699d8510887c3bd..3b6058498b3a00f4c757e6063e519507c89544af 100644 (file)
--- a/common.h
+++ b/common.h
@@ -21,9 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef COMMON_H
 #define COMMON_H
 
-/// many buffers use this size
-#define MAX_INPUTLINE 16384
-
 
 /// MSVC has a different name for several standard functions
 #ifdef WIN32
index fc29e5f789742f22a297d8e6891c335508990222..2798199bcdf112020c086670a52a4416873532a9 100644 (file)
--- a/console.c
+++ b/console.c
@@ -28,9 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 float con_cursorspeed = 4;
 
-#define                CON_TEXTSIZE    1048576
-#define                CON_MAXLINES      16384
-
 // lines up from bottom to display
 int con_backscroll;
 
index 27b82992caf2350d029b2c00c75d5863543c306a..ba3861f466a3d42eaa0a63b24ee00082d7826866 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -986,7 +986,7 @@ qboolean CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out)
 
        // FIXME consider attachments here!
 
-       ed = PRVM_EDICT_NUM(entnum - 32768);
+       ed = PRVM_EDICT_NUM(entnum - MAX_EDICTS);
 
        if(!ed->priv.required->free)
        {
diff --git a/cvar.c b/cvar.c
index a6734b53adc892a02f8b97db9a1dcbe056488723..29e299e12a6d6bda8b170bc2bc007f3b9868f18c 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 char *cvar_dummy_description = "custom cvar";
 
 cvar_t *cvar_vars = NULL;
-cvar_t *cvar_hashtable[65536];
+cvar_t *cvar_hashtable[CVAR_HASHSIZE];
 char *cvar_null_string = "";
 
 /*
index e8113e21130cb08e6687c8a499e357d0792bc165..6332865b26900d940526eadc393e03c5d603580f 100644 (file)
@@ -3,7 +3,7 @@
 #define GL_BACKEND_H
 
 // how many texture units to track state on (backendunits/backendimageunits/backendarrayunits are limited to this value)
-#define MAX_TEXTUREUNITS 64
+#define MAX_TEXTUREUNITS 16
 
 #define POLYGONELEMENTS_MAXPOINTS 258
 extern int polygonelement3i[(POLYGONELEMENTS_MAXPOINTS-2)*3];
index f0a2c073bcafb8f906400816514785c8dad92e6d..ae8174710eb579ef769df3f0598159ae41ab02d8 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -37,8 +37,6 @@ extern cvar_t v_glslgamma;
 /* Support Routines */
 
 #define FONT_FILESIZE 13468
-#define MAX_CACHED_PICS 1024
-#define CACHEPICHASHSIZE 256
 static cachepic_t *cachepichash[CACHEPICHASHSIZE];
 static cachepic_t cachepics[MAX_CACHED_PICS];
 static int numcachepics;
index 34d05c0cb08f1ed4da81dcb547f5f470d718c909..3d4915b2c02029ec6c4e29c713da50ac2ed5ae91 100644 (file)
@@ -2854,8 +2854,40 @@ skinframe_t *R_SkinFrame_LoadMissing(void)
        return skinframe;
 }
 
+void R_Main_FreeViewCache(void)
+{
+       if (r_refdef.viewcache.entityvisible)
+               Mem_Free(r_refdef.viewcache.entityvisible);
+       if (r_refdef.viewcache.world_pvsbits)
+               Mem_Free(r_refdef.viewcache.world_pvsbits);
+       if (r_refdef.viewcache.world_leafvisible)
+               Mem_Free(r_refdef.viewcache.world_leafvisible);
+       if (r_refdef.viewcache.world_surfacevisible)
+               Mem_Free(r_refdef.viewcache.world_surfacevisible);
+       memset(&r_refdef.viewcache, 0, sizeof(r_refdef.viewcache));
+}
+
+void R_Main_AllocViewCache(void)
+{
+       memset(&r_refdef.viewcache, 0, sizeof(r_refdef.viewcache));
+       r_refdef.viewcache.maxentities = r_refdef.scene.maxentities;
+       if (r_refdef.viewcache.maxentities)
+               r_refdef.viewcache.entityvisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.maxentities);
+       if (cl.worldmodel)
+       {       
+               r_refdef.viewcache.world_numclusters = cl.worldmodel->brush.num_pvsclusters;
+               r_refdef.viewcache.world_numleafs = cl.worldmodel->brush.num_leafs;
+               r_refdef.viewcache.world_numsurfaces = cl.worldmodel->num_surfaces;
+               r_refdef.viewcache.world_pvsbits = Mem_Alloc(r_main_mempool, (r_refdef.viewcache.world_numclusters+7)>>3);
+               r_refdef.viewcache.world_leafvisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numleafs);
+               r_refdef.viewcache.world_surfacevisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numsurfaces);
+       }
+}
+
 void gl_main_start(void)
 {
+       R_Main_AllocViewCache();
+
        r_numqueries = 0;
        r_maxqueries = 0;
        memset(r_queries, 0, sizeof(r_queries));
@@ -2891,6 +2923,8 @@ void gl_main_start(void)
 extern rtexture_t *loadingscreentexture;
 void gl_main_shutdown(void)
 {
+       R_Main_FreeViewCache();
+
        if (r_maxqueries)
                qglDeleteQueriesARB(r_maxqueries, r_queries);
 
@@ -2951,6 +2985,8 @@ void gl_main_newmap(void)
                if (cl.worldmodel->brush.entities)
                        CL_ParseEntityLump(cl.worldmodel->brush.entities);
        }
+       R_Main_FreeViewCache();
+       R_Main_AllocViewCache();
 }
 
 void GL_Main_Init(void)
index a7d91f1cc1b37fc074dde12523429aeb807531a6..3ba46ac84f83ad5a350034a68259e91fc2cca248 100644 (file)
@@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "r_shadow.h"
 #include "portals.h"
 
-#define MAX_LIGHTMAP_SIZE 256
-
 cvar_t r_ambient = {0, "r_ambient", "0", "brightens map, value is 0-128"};
 cvar_t r_lockpvs = {0, "r_lockpvs", "0", "disables pvs switching, allows you to walk around and inspect what is visible from a given location in the map (anything not visible from your current location will not be drawn)"};
 cvar_t r_lockvisibility = {0, "r_lockvisibility", "0", "disables visibility updates, allows you to walk around and inspect what is visible from a given viewpoint in the map (anything offscreen at the moment this is enabled will not be drawn)"};
diff --git a/keys.c b/keys.c
index 8f35831bfa207b826a3dfae4dd8b8786394ca50a..b4a40ed8a3d8d45b45f593780e336104e5738841 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -38,8 +38,6 @@ char          *keybindings[MAX_BINDMAPS][MAX_KEYS];
 int         history_line;
 char           history_savedline[MAX_INPUTLINE];
 conbuffer_t history;
-#define HIST_TEXTSIZE 262144
-#define HIST_MAXLINES 4096
 
 extern cvar_t  con_textsize;
 
diff --git a/menu.c b/menu.c
index 06d164d098dd262026878f08d604bf5b1503a8a9..7dd5ddce6128506aff241195bf6a9ba01c64cf2c 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -812,7 +812,6 @@ static void M_SinglePlayer_Key (int key, int ascii)
 
 static int             load_cursor;            ///< 0 < load_cursor < MAX_SAVEGAMES
 
-#define        MAX_SAVEGAMES           12
 static char    m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
 static int             loadable[MAX_SAVEGAMES];
 
diff --git a/menu.h b/menu.h
index 5e8db63a4c4ac0af767e5305fc4a710376116a30..c1950fc2db58e544aed0b38d3197aab102932b16 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #define M_PROG_FILENAME "menu.dat"
 #define M_NAME "menu"
-#define M_MAX_EDICTS   32768 // hopefully won't have to increase this again anytime soon...
 
 enum m_state_e {
        m_none,
index 6ea5a859889fd9dd68b48a6686907b446259baee..13af108b2b30129a1051c9e7092ef407f4c0b572 100644 (file)
@@ -2266,7 +2266,7 @@ tag_weapon,
 tag_torso,
 */
        memset(word, 0, sizeof(word));
-       for (i = 0;i < MAX_SKINS && (data = text = (char *)FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true, NULL));i++)
+       for (i = 0;i < 256 && (data = text = (char *)FS_LoadFile(va("%s_%i.skin", loadmodel->name, i), tempmempool, true, NULL));i++)
        {
                // If it's the first file we parse
                if (skinfile == NULL)
index 4caa59e005d16abce0ae05a155aa2271c5adcfa3..d7de945620fe609d4671adb2b0f6be3c2928bc3c 100644 (file)
@@ -75,8 +75,6 @@ typedef struct skinframe_s
 }
 skinframe_t;
 
-#define MAX_SKINS 256
-
 struct md3vertex_s;
 struct trivertx_s;
 typedef struct texvecvertex_s
index f2353785045dd3a7c075cb2f4a478b506eadeac6..d27b54d634040dcf68f9bc8d8f674897616b790a 100644 (file)
@@ -55,30 +55,123 @@ extern char engineversion[128];
 
 #define MAX_NUM_ARGVS  50
 
+#ifdef DP_SMALLMEMORY
+#define        MAX_INPUTLINE                   1024
+#define        CON_TEXTSIZE                    16384
+#define        CON_MAXLINES                    256
+#define        HIST_TEXTSIZE                   2048
+#define        HIST_MAXLINES                   16
+#define        MAX_ALIAS_NAME                  32
+#define        CMDBUFSIZE                              8192
+#define        MAX_ARGS                                10
+
+#define        NET_MAXMESSAGE                  8192
+#define        MAX_PACKETFRAGMENT              1024
+#define        MAX_EDICTS                              4096
+#define        MAX_MODELS                              1024
+#define        MAX_SOUNDS                              1024
+#define        MAX_LIGHTSTYLES                 64
+#define        MAX_STYLESTRING                 16
+#define        MAX_SCOREBOARD                  32
+#define        MAX_SCOREBOARDNAME              64
+#define        MAX_USERINFO_STRING             196
+#define        MAX_SERVERINFO_STRING   512
+#define        MAX_LOCALINFO_STRING    1 // not actually used by DP servers
+#define        CL_MAX_USERCMDS                 32
+#define        CVAR_HASHSIZE                   1024
+#define        M_MAX_EDICTS                    4096
+#define        MAX_DEMOS                               8
+#define        MAX_DEMONAME                    16
+#define        MAX_SAVEGAMES                   12
+#define        SAVEGAME_COMMENT_LENGTH 39
+#define        MAX_CLIENTNETWORKEYES   1
+
+#define        MAX_WATERPLANES                 2
+#define        MAX_CUBEMAPS                    64
+//#define      MAX_EXPLOSIONS                  64
+#define        MAX_DLIGHTS                             16
+#define        MAX_CACHED_PICS                 128 // this is 144 bytes each (or 152 on 64bit)
+#define        CACHEPICHASHSIZE                256
+#define        MAX_PARTICLEEFFECTNAME  64
+#define        MAX_PARTICLEEFFECTINFO  256
+#define        MAX_PARTICLETEXTURES    96
+#define        MAXCLVIDEOS                             1
+#define        MAX_GECKO_INSTANCES             1
+#define        MAX_DYNAMIC_TEXTURE_COUNT       2
+#define        MAX_MAP_LEAFS                   8192
+
+//#define      MAXTRACKS                               256
+#define        MAX_DYNAMIC_CHANNELS    64
+#define        MAX_CHANNELS                    260
+#else
+#define        MAX_INPUTLINE                   16384 ///< maximum length of console commandline, QuakeC strings, and many other text processing buffers
+#define        CON_TEXTSIZE                    1048576 ///< max scrollback buffer characters in console
+#define        CON_MAXLINES                    16384 ///< max scrollback buffer lines in console
+#define        HIST_TEXTSIZE                   262144 ///< max command history buffer characters in console
+#define        HIST_MAXLINES                   4096 ///< max command history buffer lines in console
+#define        MAX_ALIAS_NAME                  32
+#define        CMDBUFSIZE                              655360 ///< maximum script size that can be loaded by the exec command (8192 in Quake)
+#define        MAX_ARGS                                80 ///< maximum number of parameters to a console command or alias
+
+#define        NET_MAXMESSAGE                  65536 ///< max reliable packet size (sent as multiple fragments of MAX_PACKETFRAGMENT)
+#define        MAX_PACKETFRAGMENT              1024 ///< max length of packet fragment
+#define        MAX_EDICTS                              32768 ///< max number of objects in game world at once (32768 protocol limit)
+#define        MAX_MODELS                              8192 ///< max number of models loaded at once (including during level transitions)
+#define        MAX_SOUNDS                              4096 ///< max number of sounds loaded at once
+#define        MAX_LIGHTSTYLES                 256 ///< max flickering light styles in level (note: affects savegame format)
+#define        MAX_STYLESTRING                 64 ///< max length of flicker pattern for light style
+#define        MAX_SCOREBOARD                  255 ///< max number of players in game at once (255 protocol limit)
+#define        MAX_SCOREBOARDNAME              64 ///< max length of player name in game
+#define        MAX_USERINFO_STRING             1280 ///< max length of infostring for PROTOCOL_QUAKEWORLD (196 in QuakeWorld)
+#define        MAX_SERVERINFO_STRING   1280 ///< max length of server infostring for PROTOCOL_QUAKEWORLD (512 in QuakeWorld)
+#define        MAX_LOCALINFO_STRING    32768 ///< max length of server-local infostring for PROTOCOL_QUAKEWORLD (32768 in QuakeWorld)
+#define        CL_MAX_USERCMDS                 128 ///< max number of predicted input packets in queue
+#define        CVAR_HASHSIZE                   65536 ///< number of hash buckets for accelerating cvar name lookups
+#define        M_MAX_EDICTS                    32768 ///< max objects in menu vm
+#define        MAX_DEMOS                               8 ///< max demos provided to demos command
+#define        MAX_DEMONAME                    16 ///< max demo name length for demos command
+#define        MAX_SAVEGAMES                   12 ///< max savegames listed in savegame menu
+#define        SAVEGAME_COMMENT_LENGTH 39 ///< max comment length of savegame in menu
+#define        MAX_CLIENTNETWORKEYES   1 ///< max number of locations that can be added to pvs when culling network entities
+
+#define        MAX_WATERPLANES                 16 ///< max number of water planes visible (each one causes additional view renders)
+#define        MAX_CUBEMAPS                    256 ///< max number of cubemap textures loaded for light filters
+#define        MAX_EXPLOSIONS                  64 ///< max number of explosion shell effects active at once (not particle related)
+#define        MAX_DLIGHTS                             256 ///< max number of dynamic lights (rocket flashes, etc) in scene at once
+#define        MAX_CACHED_PICS                 1024 ///< max number of 2D pics loaded at once
+#define        CACHEPICHASHSIZE                256 ///< number of hash buckets for accelerating 2D pic name lookups
+#define        MAX_PARTICLEEFFECTNAME  256 ///< maximum number of unique names of particle effects (for particleeffectnum)
+#define        MAX_PARTICLEEFFECTINFO  4096 ///< maximum number of unique particle effects (each name may associate with several of these)
+#define        MAX_PARTICLETEXTURES    1024 ///< maximum number of unique particle textures in the particle font
+#define        MAXCLVIDEOS                             65 ///< maximum number of video streams being played back at once (1 is reserved for the playvideo command)
+#define        MAX_GECKO_INSTANCES             16 ///< maximum number of web browser textures active at once
+#define        MAX_DYNAMIC_TEXTURE_COUNT       64 ///< maximum number of dynamic textures (web browsers, playvideo, etc)
+#define        MAX_MAP_LEAFS                   65536 ///< maximum number of BSP leafs in world (8192 in Quake)
+
+#define        MAXTRACKS                               256 ///< max CD track index
+// 0 to NUM_AMBIENTS - 1 = water, etc
+// NUM_AMBIENTS to NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS - 1 = normal entity sounds
+// NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS to total_channels = static sounds
+#define        MAX_DYNAMIC_CHANNELS    512
+#define        MAX_CHANNELS                    1028
+#endif
 
-#define        MAX_QPATH               128                     ///< max length of a quake game pathname
-#define        MAX_OSPATH              1024            ///< max length of a filesystem pathname
 
-#define        ON_EPSILON              0.1                     ///< point on plane side epsilon
+#define CMD_TOKENIZELENGTH (MAX_INPUTLINE + MAX_ARGS) ///< maximum tokenizable commandline length (counting trailing 0)
 
-#define MAX_PACKETFRAGMENT 1024                ///< max length of packet fragment
-#define NET_MAXMESSAGE 65536
-#define NET_MINRATE            1000 ///< limits "rate" and "sv_maxrate" cvars
 
-//
-// per-level limits
-//
-// LordHavoc: increased entity limit to 2048 from 600
-#define        MAX_EDICTS              32768           // FIXME: ouch! ouch! ouch!
-#define        MAX_LIGHTSTYLES 256                     // LordHavoc: increased from 64, NOTE special consideration is needed in savegames!
-// LordHavoc: increased model and sound limits from 256 and 256 to 4096 and 4096 (and added protocol extensions accordingly to break the 256 barrier)
-// div0: increased model limit to 8192
-#define        MAX_MODELS              8192
-#define        MAX_SOUNDS              4096
+#define        MAX_QPATH               128                     ///< max length of a quake game pathname
+#ifdef PATH_MAX
+#define        MAX_OSPATH              PATH_MAX
+#elif MAX_PATH
+#define        MAX_OSPATH              MAX_PATH
+#else
+#define        MAX_OSPATH              1024            ///< max length of a filesystem pathname
+#endif
 
-#define        SAVEGAME_COMMENT_LENGTH 39
+#define        ON_EPSILON              0.1                     ///< point on plane side epsilon
 
-#define        MAX_STYLESTRING 64
+#define        NET_MINRATE             1000 ///< limits "rate" and "sv_maxrate" cvars
 
 //
 // stats are integers communicated to the client by the server
@@ -228,17 +321,6 @@ extern char engineversion[128];
 
 //===========================================
 
-// LordHavoc: increased player limit from 16 to 255
-#define        MAX_SCOREBOARD          255
-// LordHavoc: increased name limit from 32 to 64 characters
-#define        MAX_SCOREBOARDNAME      64
-// infostring sizes used by QuakeWorld support
-// was 196
-#define MAX_USERINFO_STRING 1280
-// was 512
-#define MAX_SERVERINFO_STRING 1280
-#define MAX_LOCALINFO_STRING 32768
-
 #include "zone.h"
 #include "fs.h"
 #include "common.h"
index 2c1f72f7ef5a97f65729941e02716e1c44f19f7c..afb033da3ce00df5e2ad529ae7b660d9b32c0f02 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "quakedef.h"
 #include "cl_collision.h"
 
-#define MAX_EXPLOSIONS 64
+#ifdef MAX_EXPLOSIONS
 #define EXPLOSIONGRID 8
 #define EXPLOSIONVERTS ((EXPLOSIONGRID+1)*(EXPLOSIONGRID+1))
 #define EXPLOSIONTRIS (EXPLOSIONGRID*EXPLOSIONGRID*2)
@@ -53,8 +53,10 @@ static rtexture_t    *explosiontexture;
 static rtexture_t      *explosiontexturefog;
 
 static rtexturepool_t  *explosiontexturepool;
+#endif
 
 cvar_t r_explosionclip = {CVAR_SAVE, "r_explosionclip", "1", "enables collision detection for explosion shell (so that it flattens against walls and floors)"};
+#ifdef MAX_EXPLOSIONS
 static cvar_t r_drawexplosions = {0, "r_drawexplosions", "1", "enables rendering of explosion shells (see also cl_particles_explosions_shell)"};
 
 static void r_explosion_start(void)
@@ -118,9 +120,11 @@ static int R_ExplosionVert(int column, int row)
        explosionnoiseindex[i] = (row % EXPLOSIONGRID) * EXPLOSIONGRID + (column % EXPLOSIONGRID);
        return i;
 }
+#endif
 
 void R_Explosion_Init(void)
 {
+#ifdef MAX_EXPLOSIONS
        int i, x, y;
        i = 0;
        for (y = 0;y < EXPLOSIONGRID;y++)
@@ -138,14 +142,18 @@ void R_Explosion_Init(void)
                }
        }
 
+#endif
        Cvar_RegisterVariable(&r_explosionclip);
+#ifdef MAX_EXPLOSIONS
        Cvar_RegisterVariable(&r_drawexplosions);
 
        R_RegisterModule("R_Explosions", r_explosion_start, r_explosion_shutdown, r_explosion_newmap);
+#endif
 }
 
 void R_NewExplosion(const vec3_t org)
 {
+#ifdef MAX_EXPLOSIONS
        int i, j;
        float dist, n;
        explosion_t *e;
@@ -182,8 +190,10 @@ void R_NewExplosion(const vec3_t org)
                        break;
                }
        }
+#endif
 }
 
+#ifdef MAX_EXPLOSIONS
 static void R_DrawExplosion_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
 {
        int surfacelistindex = 0;
@@ -250,9 +260,11 @@ static void R_MoveExplosion(explosion_t *e)
                }
        }
 }
+#endif
 
 void R_DrawExplosions(void)
 {
+#ifdef MAX_EXPLOSIONS
        int i;
 
        if (!r_drawexplosions.integer)
@@ -269,5 +281,6 @@ void R_DrawExplosions(void)
        }
        while (numexplosions > 0 && explosion[i-1].alpha <= 0)
                numexplosions--;
+#endif
 }
 
index 91221fc3923bc971b162135917c2d7e91e6803c7..8021ade76fb46312c98e327eda819731a6ca02d7 100644 (file)
@@ -1,7 +1,7 @@
 
 #include "quakedef.h"
 
-#define MAXRENDERMODULES 64
+#define MAXRENDERMODULES 20
 
 typedef struct rendermodule_s
 {
index 03e064440070b3b1bf7f07ba36b8a08bb018a6f3..9dd9214960736986fecd9bfdb53acc720994e607 100644 (file)
@@ -345,7 +345,6 @@ typedef struct cubemapinfo_s
 }
 cubemapinfo_t;
 
-#define MAX_CUBEMAPS 256
 static int numcubemaps;
 static cubemapinfo_t cubemaps[MAX_CUBEMAPS];
 
index 85e228504368b5c573379c202f76d9c45913c718..d6bef5dd7bf032454471a117573d2178ac19a538 100644 (file)
--- a/render.h
+++ b/render.h
@@ -451,13 +451,11 @@ typedef struct r_waterstate_waterplane_s
        rtexture_t *texture_reflection;
        mplane_t plane;
        int materialflags; // combined flags of all water surfaces on this plane
-       unsigned char pvsbits[(32768+7)>>3]; // FIXME: buffer overflow on huge maps
+       unsigned char pvsbits[(MAX_MAP_LEAFS+7)>>3]; // FIXME: buffer overflow on huge maps
        qboolean pvsvalid;
 }
 r_waterstate_waterplane_t;
 
-#define MAX_WATERPLANES 16
-
 typedef struct r_waterstate_s
 {
        qboolean enabled;
index 06543a55271c2650fddf53003dd7daae9abd6995..2faca6306d6e2d64d3d1a135683fd7141e4bf806 100644 (file)
--- a/server.h
+++ b/server.h
@@ -68,8 +68,6 @@ typedef struct server_connectfloodaddress_s
 }
 server_connectfloodaddress_t;
 
-#define MAX_CLIENTNETWORKEYES 256
-
 typedef struct server_s
 {
        /// false if only a net client
index 540a7f9e7c8f140e0978eedc5aaf277b68f0c902..2ade24b49f5ecd1f6628111e8b219994b2749fee 100644 (file)
@@ -1239,13 +1239,13 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
        // update sound origin if we know about the entity
        if (ch->entnum > 0 && cls.state == ca_connected && cl_gameplayfix_soundsmovewithentities.integer)
        {
-               if (ch->entnum >= 32768)
+               if (ch->entnum >= MAX_EDICTS)
                {
                        //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl.entities[ch->entnum].state_current.origin[0], cl.entities[ch->entnum].state_current.origin[1], cl.entities[ch->entnum].state_current.origin[2]);
 
-                       if (ch->entnum > 32768)
+                       if (ch->entnum > MAX_EDICTS)
                                if (!CL_VM_GetEntitySoundOrigin(ch->entnum, ch->origin))
-                                       ch->entnum = 32768; // entity was removed, disown sound
+                                       ch->entnum = MAX_EDICTS; // entity was removed, disown sound
                }
                else if (cl.entities[ch->entnum].state_current.active)
                {
@@ -1264,7 +1264,7 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                mastervol *= snd_staticvolume.value;
        else if(!(ch->flags & CHANNELFLAG_FULLVOLUME)) // same as SND_PaintChannel uses
        {
-               if(ch->entnum >= 32768)
+               if(ch->entnum >= MAX_EDICTS)
                {
                        switch(ch->entchannel)
                        {
index 07cc6e114afe269b2b9b160fd06c621d3858fd31..771205ae2e1e56854d514b5f163354c9283570e7 100644 (file)
@@ -110,12 +110,6 @@ struct snd_fetcher_s
        snd_fetcher_getfmt_t    getfmt;
 };
 
-// 0 to NUM_AMBIENTS - 1 = water, etc
-// NUM_AMBIENTS to NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS - 1 = normal entity sounds
-// NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS to total_channels = static sounds
-#define        MAX_DYNAMIC_CHANNELS    512
-#define        MAX_CHANNELS                    1028
-
 extern unsigned int total_channels;
 extern channel_t channels[MAX_CHANNELS];
 
index 030bb92bf3bdc6ff478ea24f78de3cce97de2dd7..ce61e9f5debbbf5029412f8189e8839dcabd9af7 100644 (file)
@@ -819,8 +819,8 @@ static void VM_SV_checkpvs (void)
 #if 1
        unsigned char *pvs;
 #else
-       static int fatpvsbytes;
-       static unsigned char fatpvs[MAX_MAP_LEAFS/8];
+       int fatpvsbytes;
+       unsigned char fatpvs[MAX_MAP_LEAFS/8];
 #endif
 
        VM_SAFEPARMCOUNT(2, VM_SV_checkpvs);