make minimap parameters game dependent

git-svn-id: svn://svn.icculus.org/netradiant/trunk@344 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
divverent 2009-04-27 14:58:50 +00:00 committed by Thomas Debesse
parent e5d5b5a866
commit 3ae3b20987
15 changed files with 88 additions and 13 deletions

View file

@ -114,6 +114,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
46, /* bsp file version */ 46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -149,6 +149,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
2.2f, /* lightmap gamma */ 2.2f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
47, /* bsp file version */ 47, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -68,6 +68,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"RBSP", /* bsp file prefix */ "RBSP", /* bsp file prefix */
1, /* bsp file version */ 1, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -65,6 +65,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"RBSP", /* bsp file prefix */ "RBSP", /* bsp file prefix */
1, /* bsp file version */ 1, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -64,6 +64,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
1.0f/66.0f, /* minimap border */
"../gfx/%s_mini.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
46, /* bsp file version */ 46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -113,6 +113,10 @@
512, /* lightmap width/height */ 512, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"FBSP", /* bsp file prefix */ "FBSP", /* bsp file prefix */
1, /* bsp file version */ 1, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -113,6 +113,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
46, /* bsp file version */ 46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -77,6 +77,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
47, /* bsp file version */ 47, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -140,6 +140,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"RBSP", /* bsp file prefix */ "RBSP", /* bsp file prefix */
1, /* bsp file version */ 1, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -113,6 +113,10 @@
512, /* lightmap width/height */ 512, /* lightmap width/height */
2.0f, /* lightmap gamma */ 2.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
46, /* bsp file version */ 46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -71,6 +71,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
46, /* bsp file version */ 46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -130,6 +130,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
47, /* bsp file version */ 47, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -67,6 +67,10 @@
128, /* lightmap width/height */ 128, /* lightmap width/height */
1.0f, /* lightmap gamma */ 1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */ 1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */ "IBSP", /* bsp file prefix */
47, /* bsp file version */ 47, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */ qfalse, /* cod-style lump len/ofs order */

View file

@ -366,9 +366,8 @@ determines solid non-sky brushes in the world
void MiniMapSetupBrushes( void ) void MiniMapSetupBrushes( void )
{ {
int i, j, b, compileFlags; int i, b, compileFlags;
bspBrush_t *brush; bspBrush_t *brush;
bspBrushSide_t *side;
bspShader_t *shader; bspShader_t *shader;
shaderInfo_t *si; shaderInfo_t *si;
@ -462,7 +461,7 @@ qboolean MiniMapEvaluateSampleOffsets(int *bestj, int *bestk, float *bestval)
void MiniMapMakeSampleOffsets() void MiniMapMakeSampleOffsets()
{ {
int i, j, k, jj, kk; int i, j, k, jj, kk;
float val, valj, valk, dx, dy, sx, sy, rx, ry; float val, valj, valk, sx, sy, rx, ry;
Sys_Printf( "Generating good sample offsets (this may take a while)...\n" ); Sys_Printf( "Generating good sample offsets (this may take a while)...\n" );
@ -529,12 +528,34 @@ void MiniMapMakeSampleOffsets()
} }
} }
void MergeRelativePath(char *out, const char *absolute, const char *relative)
{
const char *endpos = absolute + strlen(absolute);
while(endpos != absolute && (endpos[-1] == '/' || endpos[-1] == '\\'))
--endpos;
while(relative[0] == '.' && relative[1] == '.' && (relative[2] == '/' || relative[2] == '\\'))
{
relative += 3;
while(endpos != absolute)
{
--endpos;
if(*endpos == '/' || *endpos == '\\')
break;
}
while(endpos != absolute && (endpos[-1] == '/' || endpos[-1] == '\\'))
--endpos;
}
memcpy(out, absolute, endpos - absolute);
out[endpos - absolute] = '/';
strcpy(out + (endpos - absolute + 1), relative);
}
int MiniMapBSPMain( int argc, char **argv ) int MiniMapBSPMain( int argc, char **argv )
{ {
char minimapFilename[1024]; char minimapFilename[1024];
char basename[1024]; char basename[1024];
char path[1024]; char path[1024];
char parentpath[1024]; char relativeMinimapFilename[1024];
float minimapSharpen; float minimapSharpen;
float border; float border;
byte *data3b, *p; byte *data3b, *p;
@ -562,12 +583,14 @@ int MiniMapBSPMain( int argc, char **argv )
minimap.model = &bspModels[0]; minimap.model = &bspModels[0];
VectorCopy(minimap.model->mins, mins); VectorCopy(minimap.model->mins, mins);
VectorCopy(minimap.model->maxs, maxs); VectorCopy(minimap.model->maxs, maxs);
*minimapFilename = 0; *minimapFilename = 0;
minimapSharpen = 1; minimapSharpen = game->miniMapSharpen;
minimap.width = minimap.height = 512; minimap.width = minimap.height = game->miniMapSize;
border = game->miniMapBorder;
minimap.samples = 1; minimap.samples = 1;
minimap.sample_offsets = NULL; minimap.sample_offsets = NULL;
border = 1/66.0; /* good default for Nexuiz */
/* process arguments */ /* process arguments */
for( i = 1; i < (argc - 1); i++ ) for( i = 1; i < (argc - 1); i++ )
@ -634,12 +657,8 @@ int MiniMapBSPMain( int argc, char **argv )
{ {
ExtractFileBase(source, basename); ExtractFileBase(source, basename);
ExtractFilePath(source, path); ExtractFilePath(source, path);
if(*path) sprintf(relativeMinimapFilename, game->miniMapNameFormat, basename);
path[strlen(path)-1] = 0; MergeRelativePath(minimapFilename, path, relativeMinimapFilename);
ExtractFilePath(path, parentpath);
sprintf(minimapFilename, "%sgfx", parentpath);
Q_mkdir(minimapFilename);
sprintf(minimapFilename, "%sgfx/%s_mini.tga", parentpath, basename);
Sys_Printf("Output file name automatically set to %s\n", minimapFilename); Sys_Printf("Output file name automatically set to %s\n", minimapFilename);
} }

View file

@ -566,6 +566,10 @@ typedef struct game_s
int lightmapSize; /* bsp lightmap width/height */ int lightmapSize; /* bsp lightmap width/height */
float lightmapGamma; /* default lightmap gamma */ float lightmapGamma; /* default lightmap gamma */
float lightmapCompensate; /* default lightmap compensate value */ float lightmapCompensate; /* default lightmap compensate value */
int miniMapSize; /* minimap size */
float miniMapSharpen; /* minimap sharpening coefficient */
float miniMapBorder; /* minimap border amount */
char *miniMapNameFormat; /* minimap name format */
char *bspIdent; /* 4-letter bsp file prefix */ char *bspIdent; /* 4-letter bsp file prefix */
int bspVersion; /* bsp version to use */ int bspVersion; /* bsp version to use */
qboolean lumpSwap; /* cod-style len/ofs order */ qboolean lumpSwap; /* cod-style len/ofs order */