From d46ef935db7cc2644de37f9dbdf388a2cd73f2ee Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 27 Apr 2009 13:54:44 +0000 Subject: [PATCH] option -border in minimap git-svn-id: svn://svn.icculus.org/netradiant/trunk@343 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 3658516e..ab89ea9b 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -293,7 +293,7 @@ static void MiniMapSharpen(int y) } } -void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in) +void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in, float border) { vec3_t mins, maxs, extend; VectorCopy(mins_in, mins); @@ -315,8 +315,11 @@ void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in) maxs[1] += (extend[0] - extend[1]) * 0.5; } + /* border: amount of black area around the image */ + /* input: border, 1-2*border, border but we need border/(1-2*border) */ + VectorSubtract(maxs, mins, extend); - VectorScale(extend, 1.0 / 64.0, extend); + VectorScale(extend, border / (1 - 2 * border), extend); VectorSubtract(mins, extend, mins); VectorAdd(maxs, extend, maxs); @@ -505,6 +508,7 @@ int MiniMapBSPMain( int argc, char **argv ) char path[1024]; char parentpath[1024]; float minimapSharpen; + float border; byte *data3b, *p; float *q; int x, y; @@ -535,6 +539,7 @@ int MiniMapBSPMain( int argc, char **argv ) minimap.width = minimap.height = 512; minimap.samples = 1; minimap.sample_offsets = NULL; + border = 1/66.0; /* good default for Nexuiz */ /* process arguments */ for( i = 1; i < (argc - 1); i++ ) @@ -570,6 +575,12 @@ int MiniMapBSPMain( int argc, char **argv ) free(minimap.sample_offsets); minimap.sample_offsets = NULL; } + else if( !strcmp( argv[ i ], "-border" ) ) + { + border = atof(argv[i + 1]); + i++; + Sys_Printf( "Border set to %f\n", border ); + } else if( !strcmp( argv[ i ], "-o" ) ) { strcpy(minimapFilename, argv[i + 1]); @@ -589,7 +600,7 @@ int MiniMapBSPMain( int argc, char **argv ) } } - MiniMapMakeMinsMaxs(mins, maxs); + MiniMapMakeMinsMaxs(mins, maxs, border); if(!*minimapFilename) { -- 2.39.2