From: divverent Date: Mon, 27 Apr 2009 14:58:50 +0000 (+0000) Subject: make minimap parameters game dependent X-Git-Tag: svn-r421~76 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=83ce35b16a4cfa60ede97538dc2841ab1f72d0a5;p=xonotic%2Fnetradiant.git make minimap parameters game dependent git-svn-id: svn://svn.icculus.org/netradiant/trunk@344 61c419a2-8eb2-4b30-bcec-8cead039b335 --- diff --git a/tools/quake3/q3map2/game_darkplaces.h b/tools/quake3/q3map2/game_darkplaces.h index ad0334a1..026b0ba2 100644 --- a/tools/quake3/q3map2/game_darkplaces.h +++ b/tools/quake3/q3map2/game_darkplaces.h @@ -64,6 +64,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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_dq.h b/tools/quake3/q3map2/game_dq.h index f08fa2ef..86a1909c 100644 --- a/tools/quake3/q3map2/game_dq.h +++ b/tools/quake3/q3map2/game_dq.h @@ -64,6 +64,10 @@ game_t struct qtrue, /* patch casting enabled */ qtrue, /* compile deluxemaps */ 1, /* deluxemaps default mode */ + 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_ef.h b/tools/quake3/q3map2/game_ef.h index 4d06e37b..9ee1e33d 100644 --- a/tools/quake3/q3map2/game_ef.h +++ b/tools/quake3/q3map2/game_ef.h @@ -123,6 +123,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 9b7d55cd..b876894b 100644 --- a/tools/quake3/q3map2/game_etut.h +++ b/tools/quake3/q3map2/game_etut.h @@ -158,6 +158,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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_ja.h b/tools/quake3/q3map2/game_ja.h index d81b7f17..4ff04520 100644 --- a/tools/quake3/q3map2/game_ja.h +++ b/tools/quake3/q3map2/game_ja.h @@ -77,6 +77,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 5f5b81de..338c018c 100644 --- a/tools/quake3/q3map2/game_jk2.h +++ b/tools/quake3/q3map2/game_jk2.h @@ -74,6 +74,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 59a0bc94..633b2a52 100644 --- a/tools/quake3/q3map2/game_nexuiz.h +++ b/tools/quake3/q3map2/game_nexuiz.h @@ -73,6 +73,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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_prophecy.h b/tools/quake3/q3map2/game_prophecy.h index cd82649b..7fa4412c 100644 --- a/tools/quake3/q3map2/game_prophecy.h +++ b/tools/quake3/q3map2/game_prophecy.h @@ -64,6 +64,10 @@ game_t struct qtrue, /* patch casting enabled */ qtrue, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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_qfusion.h b/tools/quake3/q3map2/game_qfusion.h index 69305525..5fedd571 100644 --- a/tools/quake3/q3map2/game_qfusion.h +++ b/tools/quake3/q3map2/game_qfusion.h @@ -125,6 +125,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 76db0f8b..4097a7e8 100644 --- a/tools/quake3/q3map2/game_quake3.h +++ b/tools/quake3/q3map2/game_quake3.h @@ -122,6 +122,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 f6c0647f..91d9ca4b 100644 --- a/tools/quake3/q3map2/game_quakelive.h +++ b/tools/quake3/q3map2/game_quakelive.h @@ -74,6 +74,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 fafa7084..ac11c792 100644 --- a/tools/quake3/q3map2/game_sof2.h +++ b/tools/quake3/q3map2/game_sof2.h @@ -149,6 +149,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 2ab4205e..caa13b50 100644 --- a/tools/quake3/q3map2/game_tenebrae.h +++ b/tools/quake3/q3map2/game_tenebrae.h @@ -122,6 +122,10 @@ game_t struct qfalse, /* patch casting enabled */ qtrue, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 d37e7127..642caf8f 100644 --- a/tools/quake3/q3map2/game_tremulous.h +++ b/tools/quake3/q3map2/game_tremulous.h @@ -80,6 +80,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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 a78bdc1a..53324659 100644 --- a/tools/quake3/q3map2/game_wolf.h +++ b/tools/quake3/q3map2/game_wolf.h @@ -139,6 +139,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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_wolfet.h b/tools/quake3/q3map2/game_wolfet.h index 8c927d88..20255946 100644 --- a/tools/quake3/q3map2/game_wolfet.h +++ b/tools/quake3/q3map2/game_wolfet.h @@ -76,6 +76,10 @@ game_t struct qfalse, /* patch casting enabled */ qfalse, /* compile deluxemaps */ 0, /* deluxemaps default mode */ + 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/main.c b/tools/quake3/q3map2/main.c index ab89ea9b..9d56d895 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -338,9 +338,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; @@ -434,7 +433,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" ); @@ -501,12 +500,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; @@ -534,12 +555,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++ ) @@ -606,12 +629,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 f78f45f2..3756b2e5 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -561,6 +561,10 @@ typedef struct game_s qboolean patchShadows; /* patch casting enabled */ qboolean deluxeMap; /* compile deluxemaps */ int deluxeMode; /* deluxemap mode (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */ + 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 */