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 */
1.0f, /* lightmap gamma */
1.0f, /* lightmap compensate */
512, /* minimap size */
1.0f, /* minimap sharpener */
0.0f, /* minimap border */
"%s.tga", /* minimap name format */
"IBSP", /* bsp file prefix */
46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */

View File

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

View File

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

View File

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

View File

@ -64,6 +64,10 @@
128, /* lightmap width/height */
1.0f, /* lightmap gamma */
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 */
46, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -366,9 +366,8 @@ determines solid non-sky brushes in the world
void MiniMapSetupBrushes( void )
{
int i, j, b, compileFlags;
int i, b, compileFlags;
bspBrush_t *brush;
bspBrushSide_t *side;
bspShader_t *shader;
shaderInfo_t *si;
@ -462,7 +461,7 @@ qboolean MiniMapEvaluateSampleOffsets(int *bestj, int *bestk, float *bestval)
void MiniMapMakeSampleOffsets()
{
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" );
@ -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 )
{
char minimapFilename[1024];
char basename[1024];
char path[1024];
char parentpath[1024];
char relativeMinimapFilename[1024];
float minimapSharpen;
float border;
byte *data3b, *p;
@ -562,12 +583,14 @@ int MiniMapBSPMain( int argc, char **argv )
minimap.model = &bspModels[0];
VectorCopy(minimap.model->mins, mins);
VectorCopy(minimap.model->maxs, maxs);
*minimapFilename = 0;
minimapSharpen = 1;
minimap.width = minimap.height = 512;
minimapSharpen = game->miniMapSharpen;
minimap.width = minimap.height = game->miniMapSize;
border = game->miniMapBorder;
minimap.samples = 1;
minimap.sample_offsets = NULL;
border = 1/66.0; /* good default for Nexuiz */
/* process arguments */
for( i = 1; i < (argc - 1); i++ )
@ -634,12 +657,8 @@ int MiniMapBSPMain( int argc, char **argv )
{
ExtractFileBase(source, basename);
ExtractFilePath(source, path);
if(*path)
path[strlen(path)-1] = 0;
ExtractFilePath(path, parentpath);
sprintf(minimapFilename, "%sgfx", parentpath);
Q_mkdir(minimapFilename);
sprintf(minimapFilename, "%sgfx/%s_mini.tga", parentpath, basename);
sprintf(relativeMinimapFilename, game->miniMapNameFormat, basename);
MergeRelativePath(minimapFilename, path, relativeMinimapFilename);
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 */
float lightmapGamma; /* default lightmap gamma */
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 */
int bspVersion; /* bsp version to use */
qboolean lumpSwap; /* cod-style len/ofs order */