X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fquake3%2Fq3map2%2Fq3map2.h;h=29e1c79101fc9cf2e5f725cae093630dbe219e3e;hb=cf6c8123ddb53e065d96951871ac957c462c2445;hp=8c97255490cad4036fd4fb45000d86d6c18d9455;hpb=3aca84b7e55ab6d79b30bb6b2ad5d97cfd8fde30;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 8c972554..29e1c791 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -35,11 +35,14 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2." /* version */ -#define Q3MAP_VERSION "2.5.17-div0" +#ifndef Q3MAP_VERSION +#error no Q3MAP_VERSION defined +#endif #define Q3MAP_MOTD "Your map saw the pretty lights from q3map2's BFG" + /* ------------------------------------------------------------------------------- dependencies @@ -302,20 +305,13 @@ abstracted bsp file #define MAX_LIGHTMAP_SHADERS 256 /* ok to increase these at the expense of more memory */ -#define MAX_MAP_MODELS 0x400 -#define MAX_MAP_BRUSHES 0x10000 #define MAX_MAP_ENTITIES 0x1000 //% 0x800 /* ydnar */ #define MAX_MAP_ENTSTRING 0x80000 //% 0x40000 /* ydnar */ -#define MAX_MAP_SHADERS 0x800 //% 0x400 /* ydnar */ #define MAX_MAP_AREAS 0x100 /* MAX_MAP_AREA_BYTES in q_shared must match! */ #define MAX_MAP_FOGS 30 //& 0x100 /* RBSP (32 - world fog - goggles) */ #define MAX_MAP_PLANES 0x200000 //% 0x20000 /* ydnar for md */ -#define MAX_MAP_NODES 0x20000 -#define MAX_MAP_BRUSHSIDES 0x100000 //% 0x20000 /* ydnar */ #define MAX_MAP_LEAFS 0x20000 -#define MAX_MAP_LEAFFACES 0x100000 //% 0x20000 /* ydnar */ -#define MAX_MAP_LEAFBRUSHES 0x40000 #define MAX_MAP_PORTALS 0x20000 #define MAX_MAP_LIGHTING 0x800000 #define MAX_MAP_LIGHTGRID 0x100000 //% 0x800000 /* ydnar: set to points, not bytes */ @@ -1425,7 +1421,7 @@ rawGridPoint_t; typedef struct surfaceInfo_s { - bspModel_t *model; + int modelindex; shaderInfo_t *si; rawLightmap_t *lm; int parentSurfaceNum, childSurfaceNum; @@ -1794,6 +1790,7 @@ void SwapBlock( int *block, int size ); int GetLumpElements( bspHeader_t *header, int lump, int size ); void *GetLump( bspHeader_t *header, int lump ); int CopyLump( bspHeader_t *header, int lump, void *dest, int size ); +int CopyLump_Allocate( bspHeader_t *header, int lump, void **dest, int size, int *allocationVariable ); void AddLump( FILE *file, bspHeader_t *header, int lumpNum, const void *data, int length ); void LoadBSPFile( const char *filename ); @@ -2121,6 +2118,7 @@ Q_EXTERN qboolean noCollapse Q_ASSIGN( qfalse ); Q_EXTERN qboolean exportLightmaps Q_ASSIGN( qfalse ); Q_EXTERN qboolean externalLightmaps Q_ASSIGN( qfalse ); Q_EXTERN int lmCustomSize Q_ASSIGN( LIGHTMAP_WIDTH ); +Q_EXTERN char * lmCustomDir Q_ASSIGN( NULL ); Q_EXTERN qboolean dirty Q_ASSIGN( qfalse ); Q_EXTERN qboolean dirtDebug Q_ASSIGN( qfalse ); @@ -2305,10 +2303,12 @@ Q_EXTERN int numBSPEntities Q_ASSIGN( 0 ); Q_EXTERN entity_t entities[ MAX_MAP_ENTITIES ]; Q_EXTERN int numBSPModels Q_ASSIGN( 0 ); -Q_EXTERN bspModel_t bspModels[ MAX_MAP_MODELS ]; +Q_EXTERN int allocatedBSPModels Q_ASSIGN( 0 ); +Q_EXTERN bspModel_t* bspModels Q_ASSIGN(NULL); Q_EXTERN int numBSPShaders Q_ASSIGN( 0 ); -Q_EXTERN bspShader_t bspShaders[ MAX_MAP_MODELS ]; +Q_EXTERN int allocatedBSPShaders Q_ASSIGN( 0 ); +Q_EXTERN bspShader_t* bspShaders Q_ASSIGN(0); Q_EXTERN int bspEntDataSize Q_ASSIGN( 0 ); Q_EXTERN char bspEntData[ MAX_MAP_ENTSTRING ]; @@ -2320,19 +2320,24 @@ Q_EXTERN int numBSPPlanes Q_ASSIGN( 0 ); Q_EXTERN bspPlane_t bspPlanes[ MAX_MAP_PLANES ]; Q_EXTERN int numBSPNodes Q_ASSIGN( 0 ); -Q_EXTERN bspNode_t bspNodes[ MAX_MAP_NODES ]; +Q_EXTERN int allocatedBSPNodes Q_ASSIGN( 0 ); +Q_EXTERN bspNode_t* bspNodes Q_ASSIGN(NULL); Q_EXTERN int numBSPLeafSurfaces Q_ASSIGN( 0 ); -Q_EXTERN int bspLeafSurfaces[ MAX_MAP_LEAFFACES ]; +Q_EXTERN int allocatedBSPLeafSurfaces Q_ASSIGN( 0 ); +Q_EXTERN int* bspLeafSurfaces Q_ASSIGN(NULL); Q_EXTERN int numBSPLeafBrushes Q_ASSIGN( 0 ); -Q_EXTERN int bspLeafBrushes[ MAX_MAP_LEAFBRUSHES ]; +Q_EXTERN int allocatedBSPLeafBrushes Q_ASSIGN( 0 ); +Q_EXTERN int* bspLeafBrushes Q_ASSIGN(NULL); Q_EXTERN int numBSPBrushes Q_ASSIGN( 0 ); -Q_EXTERN bspBrush_t bspBrushes[ MAX_MAP_BRUSHES ]; +Q_EXTERN int allocatedBSPBrushes Q_ASSIGN( 0 ); +Q_EXTERN bspBrush_t* bspBrushes Q_ASSIGN(NULL); Q_EXTERN int numBSPBrushSides Q_ASSIGN( 0 ); -Q_EXTERN bspBrushSide_t bspBrushSides[ MAX_MAP_BRUSHSIDES ]; +Q_EXTERN int allocatedBSPBrushSides Q_ASSIGN( 0 ); +Q_EXTERN bspBrushSide_t* bspBrushSides Q_ASSIGN(NULL); Q_EXTERN int numBSPLightBytes Q_ASSIGN( 0 ); Q_EXTERN byte *bspLightBytes Q_ASSIGN( NULL ); @@ -2361,5 +2366,27 @@ Q_EXTERN bspFog_t bspFogs[ MAX_MAP_FOGS ]; Q_EXTERN int numBSPAds Q_ASSIGN( 0 ); Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ]; +#define AUTOEXPAND_BY_REALLOC(ptr, reqitem, allocated, def) \ + do \ + { \ + if(reqitem >= allocated) \ + { \ + if(allocated == 0) \ + allocated = def; \ + while(reqitem >= allocated && allocated) \ + allocated *= 2; \ + if(!allocated || allocated > 2147483647 / sizeof(*ptr)) \ + { \ + Error(#ptr " over 2 GB"); \ + } \ + ptr = realloc(ptr, sizeof(*ptr) * allocated); \ + if(!ptr) \ + Error(#ptr " out of memory"); \ + } \ + } \ + while(0) + +#define AUTOEXPAND_BY_REALLOC_BSP(suffix, def) AUTOEXPAND_BY_REALLOC(bsp##suffix, numBSP##suffix, allocatedBSP##suffix, def) + /* end marker */ #endif