From 3ae3b209876c2ed0adc1fa82887d7876c23a9502 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 27 Apr 2009 14:58:50 +0000 Subject: [PATCH] make minimap parameters game dependent git-svn-id: svn://svn.icculus.org/netradiant/trunk@344 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/game_ef.h | 4 +++ tools/quake3/q3map2/game_etut.h | 4 +++ tools/quake3/q3map2/game_ja.h | 4 +++ tools/quake3/q3map2/game_jk2.h | 4 +++ tools/quake3/q3map2/game_nexuiz.h | 4 +++ tools/quake3/q3map2/game_qfusion.h | 4 +++ tools/quake3/q3map2/game_quake3.h | 4 +++ tools/quake3/q3map2/game_quakelive.h | 4 +++ tools/quake3/q3map2/game_sof2.h | 4 +++ tools/quake3/q3map2/game_tenebrae.h | 4 +++ tools/quake3/q3map2/game_tremulous.h | 4 +++ tools/quake3/q3map2/game_wolf.h | 4 +++ tools/quake3/q3map2/game_wolfet.h | 4 +++ tools/quake3/q3map2/main.c | 45 ++++++++++++++++++++-------- tools/quake3/q3map2/q3map2.h | 4 +++ 15 files changed, 88 insertions(+), 13 deletions(-) diff --git a/tools/quake3/q3map2/game_ef.h b/tools/quake3/q3map2/game_ef.h index efce240d..e77194d2 100644 --- a/tools/quake3/q3map2/game_ef.h +++ b/tools/quake3/q3map2/game_ef.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_etut.h b/tools/quake3/q3map2/game_etut.h index 9482dd54..7244a27b 100644 --- a/tools/quake3/q3map2/game_etut.h +++ b/tools/quake3/q3map2/game_etut.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_ja.h b/tools/quake3/q3map2/game_ja.h index d9d4311d..d8450067 100644 --- a/tools/quake3/q3map2/game_ja.h +++ b/tools/quake3/q3map2/game_ja.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_jk2.h b/tools/quake3/q3map2/game_jk2.h index a990339f..ce8c4ba8 100644 --- a/tools/quake3/q3map2/game_jk2.h +++ b/tools/quake3/q3map2/game_jk2.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_nexuiz.h b/tools/quake3/q3map2/game_nexuiz.h index a11cd2f3..186b47ae 100644 --- a/tools/quake3/q3map2/game_nexuiz.h +++ b/tools/quake3/q3map2/game_nexuiz.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_qfusion.h b/tools/quake3/q3map2/game_qfusion.h index b17f9fa8..a61bb521 100644 --- a/tools/quake3/q3map2/game_qfusion.h +++ b/tools/quake3/q3map2/game_qfusion.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_quake3.h b/tools/quake3/q3map2/game_quake3.h index 2ffdc246..19856df6 100644 --- a/tools/quake3/q3map2/game_quake3.h +++ b/tools/quake3/q3map2/game_quake3.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_quakelive.h b/tools/quake3/q3map2/game_quakelive.h index ad014252..f22e28d1 100644 --- a/tools/quake3/q3map2/game_quakelive.h +++ b/tools/quake3/q3map2/game_quakelive.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_sof2.h b/tools/quake3/q3map2/game_sof2.h index 4c957714..cb620b26 100644 --- a/tools/quake3/q3map2/game_sof2.h +++ b/tools/quake3/q3map2/game_sof2.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_tenebrae.h b/tools/quake3/q3map2/game_tenebrae.h index c76d45de..84f7d508 100644 --- a/tools/quake3/q3map2/game_tenebrae.h +++ b/tools/quake3/q3map2/game_tenebrae.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_tremulous.h b/tools/quake3/q3map2/game_tremulous.h index 87601baa..f0013e56 100644 --- a/tools/quake3/q3map2/game_tremulous.h +++ b/tools/quake3/q3map2/game_tremulous.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_wolf.h b/tools/quake3/q3map2/game_wolf.h index 5d600612..9e1c7c02 100644 --- a/tools/quake3/q3map2/game_wolf.h +++ b/tools/quake3/q3map2/game_wolf.h @@ -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 */ diff --git a/tools/quake3/q3map2/game_wolfet.h b/tools/quake3/q3map2/game_wolfet.h index fbcb6966..5fbd4d0e 100644 --- a/tools/quake3/q3map2/game_wolfet.h +++ b/tools/quake3/q3map2/game_wolfet.h @@ -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 */ diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 57193800..7b910c88 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -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); } diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index abfc262e..2c074443 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -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 */