From 451f88efd71157a5abe2c679efb08cf3afc5f188 Mon Sep 17 00:00:00 2001 From: germangar Date: Wed, 2 Jun 2021 12:16:44 +0200 Subject: [PATCH 1/2] Fix: Do not ignore game descriptor value for maxLMSurfaceVerts and keepLights Use unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes Fix: Out of bounds value at qfusion.h --- tools/quake3/q3map2/bsp.cpp | 2 ++ tools/quake3/q3map2/game_qfusion.h | 2 +- tools/quake3/q3map2/q3map2.h | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index 2bd8d896..494b6de6 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -698,11 +698,13 @@ int BSPMain( int argc, char **argv ){ strClear( tempSource ); /* set standard game flags */ + maxLMSurfaceVerts = game->maxLMSurfaceVerts; maxSurfaceVerts = game->maxSurfaceVerts; maxSurfaceIndexes = game->maxSurfaceIndexes; emitFlares = game->emitFlares; texturesRGB = game->texturesRGB; colorsRGB = game->colorsRGB; + keepLights = game->keepLights; /* process arguments */ for ( i = 1; i < ( argc - 1 ); i++ ) diff --git a/tools/quake3/q3map2/game_qfusion.h b/tools/quake3/q3map2/game_qfusion.h index 07f026fc..8c93737c 100644 --- a/tools/quake3/q3map2/game_qfusion.h +++ b/tools/quake3/q3map2/game_qfusion.h @@ -110,7 +110,7 @@ "scripts", /* shader directory */ 65535, /* max lightmapped surface verts */ 65535, /* max surface verts */ - 393210, /* max surface indexes */ + 65535, /* max surface indexes */ false, /* flares */ "flareshader", /* default flare shader */ false, /* wolf lighting model? */ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 10f0f951..93191359 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -454,9 +454,9 @@ struct game_t const char *homeBasePath; /* home sub-dir on unix */ const char *magic; /* magic word for figuring out base path */ const char *shaderPath; /* shader directory */ - int maxLMSurfaceVerts; /* default maximum meta surface verts */ - int maxSurfaceVerts; /* default maximum surface verts */ - int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */ + unsigned int maxLMSurfaceVerts; /* default maximum meta surface verts */ + unsigned int maxSurfaceVerts; /* default maximum surface verts */ + unsigned int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */ bool emitFlares; /* when true, emit flare surfaces */ const char *flareShader; /* default flare shader (MUST BE SET) */ bool wolfLight; /* when true, lights work like wolf q3map */ @@ -2030,9 +2030,9 @@ Q_EXTERN bool nocmdline Q_ASSIGN( false ); Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */ -Q_EXTERN int maxLMSurfaceVerts Q_ASSIGN( 64 ); /* ydnar */ -Q_EXTERN int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */ -Q_EXTERN int maxSurfaceIndexes Q_ASSIGN( 6000 ); /* ydnar */ +Q_EXTERN unsigned int maxLMSurfaceVerts Q_ASSIGN( 64 ); /* ydnar */ +Q_EXTERN unsigned int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */ +Q_EXTERN unsigned int maxSurfaceIndexes Q_ASSIGN( 6000 ); /* ydnar */ Q_EXTERN float npDegrees Q_ASSIGN( 0.0f ); /* ydnar: nonplanar degrees */ Q_EXTERN int bevelSnap Q_ASSIGN( 0 ); /* ydnar: bevel plane snap */ Q_EXTERN int texRange Q_ASSIGN( 0 ); From 3b9b05d40edab674fa7eefc70850579a73f72cce Mon Sep 17 00:00:00 2001 From: germangar Date: Thu, 3 Jun 2021 22:28:29 +0200 Subject: [PATCH 2/2] Undo changing to unsigned int for maxLMSurfaceVerts, maxSurfaceVerts and maxSurfaceIndexes. Restore qfusion.h long value --- tools/quake3/q3map2/game_qfusion.h | 2 +- tools/quake3/q3map2/q3map2.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/quake3/q3map2/game_qfusion.h b/tools/quake3/q3map2/game_qfusion.h index 8c93737c..07f026fc 100644 --- a/tools/quake3/q3map2/game_qfusion.h +++ b/tools/quake3/q3map2/game_qfusion.h @@ -110,7 +110,7 @@ "scripts", /* shader directory */ 65535, /* max lightmapped surface verts */ 65535, /* max surface verts */ - 65535, /* max surface indexes */ + 393210, /* max surface indexes */ false, /* flares */ "flareshader", /* default flare shader */ false, /* wolf lighting model? */ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 93191359..10f0f951 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -454,9 +454,9 @@ struct game_t const char *homeBasePath; /* home sub-dir on unix */ const char *magic; /* magic word for figuring out base path */ const char *shaderPath; /* shader directory */ - unsigned int maxLMSurfaceVerts; /* default maximum meta surface verts */ - unsigned int maxSurfaceVerts; /* default maximum surface verts */ - unsigned int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */ + int maxLMSurfaceVerts; /* default maximum meta surface verts */ + int maxSurfaceVerts; /* default maximum surface verts */ + int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */ bool emitFlares; /* when true, emit flare surfaces */ const char *flareShader; /* default flare shader (MUST BE SET) */ bool wolfLight; /* when true, lights work like wolf q3map */ @@ -2030,9 +2030,9 @@ Q_EXTERN bool nocmdline Q_ASSIGN( false ); Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */ -Q_EXTERN unsigned int maxLMSurfaceVerts Q_ASSIGN( 64 ); /* ydnar */ -Q_EXTERN unsigned int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */ -Q_EXTERN unsigned int maxSurfaceIndexes Q_ASSIGN( 6000 ); /* ydnar */ +Q_EXTERN int maxLMSurfaceVerts Q_ASSIGN( 64 ); /* ydnar */ +Q_EXTERN int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */ +Q_EXTERN int maxSurfaceIndexes Q_ASSIGN( 6000 ); /* ydnar */ Q_EXTERN float npDegrees Q_ASSIGN( 0.0f ); /* ydnar: nonplanar degrees */ Q_EXTERN int bevelSnap Q_ASSIGN( 0 ); /* ydnar: bevel plane snap */ Q_EXTERN int texRange Q_ASSIGN( 0 );