From 83ce35b16a4cfa60ede97538dc2841ab1f72d0a5 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_darkplaces.h | 4 +++ tools/quake3/q3map2/game_dq.h | 4 +++ 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_prophecy.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 +++ 18 files changed, 100 insertions(+), 13 deletions(-) diff --git a/tools/quake3/q3map2/game_darkplaces.h b/tools/quake3/q3map2/game_darkplaces.h index ad0334a..026b0ba 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 f08fa2e..86a1909 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 4d06e37..9ee1e33 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 9b7d55c..b876894 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 d81b7f1..4ff0452 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 5f5b81d..338c018 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 59a0bc9..633b2a5 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 cd82649..7fa4412 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 6930552..5fedd57 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 76db0f8..4097a7e 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 f6c0647..91d9ca4 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 fafa708..ac11c79 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 2ab4205..caa13b5 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 d37e712..642caf8 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 a78bdc1..5332465 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 8c927d8..2025594 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 ab89ea9..9d56d89 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 f78f45f..3756b2e 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 */ -- 2.39.2