mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-25 02:41:22 +00:00
allow not keeping aspect
git-svn-id: svn://svn.icculus.org/netradiant/trunk@345 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
parent
3ae3b20987
commit
597e5b5eeb
15 changed files with 41 additions and 13 deletions
|
@ -117,6 +117,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
46, /* bsp file version */
|
46, /* bsp file version */
|
||||||
|
|
|
@ -152,6 +152,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
47, /* bsp file version */
|
47, /* bsp file version */
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"RBSP", /* bsp file prefix */
|
"RBSP", /* bsp file prefix */
|
||||||
1, /* bsp file version */
|
1, /* bsp file version */
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"RBSP", /* bsp file prefix */
|
"RBSP", /* bsp file prefix */
|
||||||
1, /* bsp file version */
|
1, /* bsp file version */
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
1.0f/66.0f, /* minimap border */
|
1.0f/66.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"../gfx/%s_mini.tga", /* minimap name format */
|
"../gfx/%s_mini.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
46, /* bsp file version */
|
46, /* bsp file version */
|
||||||
|
|
|
@ -114,8 +114,9 @@
|
||||||
1.0f, /* lightmap gamma */
|
1.0f, /* lightmap gamma */
|
||||||
1.0f, /* lightmap compensate */
|
1.0f, /* lightmap compensate */
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
0.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qfalse, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"FBSP", /* bsp file prefix */
|
"FBSP", /* bsp file prefix */
|
||||||
1, /* bsp file version */
|
1, /* bsp file version */
|
||||||
|
|
|
@ -116,6 +116,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
46, /* bsp file version */
|
46, /* bsp file version */
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
47, /* bsp file version */
|
47, /* bsp file version */
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"RBSP", /* bsp file prefix */
|
"RBSP", /* bsp file prefix */
|
||||||
1, /* bsp file version */
|
1, /* bsp file version */
|
||||||
|
|
|
@ -116,6 +116,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
46, /* bsp file version */
|
46, /* bsp file version */
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
46, /* bsp file version */
|
46, /* bsp file version */
|
||||||
|
|
|
@ -133,6 +133,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
47, /* bsp file version */
|
47, /* bsp file version */
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
512, /* minimap size */
|
512, /* minimap size */
|
||||||
1.0f, /* minimap sharpener */
|
1.0f, /* minimap sharpener */
|
||||||
0.0f, /* minimap border */
|
0.0f, /* minimap border */
|
||||||
|
qtrue, /* minimap keep aspect */
|
||||||
"%s.tga", /* minimap name format */
|
"%s.tga", /* minimap name format */
|
||||||
"IBSP", /* bsp file prefix */
|
"IBSP", /* bsp file prefix */
|
||||||
47, /* bsp file version */
|
47, /* bsp file version */
|
||||||
|
|
|
@ -321,7 +321,7 @@ static void MiniMapSharpen(int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in, float border)
|
void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in, float border, qboolean keepaspect)
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs, extend;
|
vec3_t mins, maxs, extend;
|
||||||
VectorCopy(mins_in, mins);
|
VectorCopy(mins_in, mins);
|
||||||
|
@ -330,17 +330,19 @@ void MiniMapMakeMinsMaxs(vec3_t mins_in, vec3_t maxs_in, float border)
|
||||||
// line compatible to nexuiz mapinfo
|
// line compatible to nexuiz mapinfo
|
||||||
Sys_Printf("size %f %f %f %f %f %f\n", mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2]);
|
Sys_Printf("size %f %f %f %f %f %f\n", mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2]);
|
||||||
|
|
||||||
VectorSubtract(maxs, mins, extend);
|
if(keepaspect)
|
||||||
|
|
||||||
if(extend[1] > extend[0])
|
|
||||||
{
|
{
|
||||||
mins[0] -= (extend[1] - extend[0]) * 0.5;
|
VectorSubtract(maxs, mins, extend);
|
||||||
maxs[0] += (extend[1] - extend[0]) * 0.5;
|
if(extend[1] > extend[0])
|
||||||
}
|
{
|
||||||
else
|
mins[0] -= (extend[1] - extend[0]) * 0.5;
|
||||||
{
|
maxs[0] += (extend[1] - extend[0]) * 0.5;
|
||||||
mins[1] -= (extend[0] - extend[1]) * 0.5;
|
}
|
||||||
maxs[1] += (extend[0] - extend[1]) * 0.5;
|
else
|
||||||
|
{
|
||||||
|
mins[1] -= (extend[0] - extend[1]) * 0.5;
|
||||||
|
maxs[1] += (extend[0] - extend[1]) * 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* border: amount of black area around the image */
|
/* border: amount of black area around the image */
|
||||||
|
@ -563,6 +565,7 @@ int MiniMapBSPMain( int argc, char **argv )
|
||||||
int x, y;
|
int x, y;
|
||||||
int i;
|
int i;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
|
qboolean keepaspect;
|
||||||
|
|
||||||
/* arg checking */
|
/* arg checking */
|
||||||
if( argc < 2 )
|
if( argc < 2 )
|
||||||
|
@ -588,6 +591,7 @@ int MiniMapBSPMain( int argc, char **argv )
|
||||||
minimapSharpen = game->miniMapSharpen;
|
minimapSharpen = game->miniMapSharpen;
|
||||||
minimap.width = minimap.height = game->miniMapSize;
|
minimap.width = minimap.height = game->miniMapSize;
|
||||||
border = game->miniMapBorder;
|
border = game->miniMapBorder;
|
||||||
|
keepaspect = game->miniMapKeepAspect;
|
||||||
|
|
||||||
minimap.samples = 1;
|
minimap.samples = 1;
|
||||||
minimap.sample_offsets = NULL;
|
minimap.sample_offsets = NULL;
|
||||||
|
@ -632,6 +636,16 @@ int MiniMapBSPMain( int argc, char **argv )
|
||||||
i++;
|
i++;
|
||||||
Sys_Printf( "Border set to %f\n", border );
|
Sys_Printf( "Border set to %f\n", border );
|
||||||
}
|
}
|
||||||
|
else if( !strcmp( argv[ i ], "-keepaspect" ) )
|
||||||
|
{
|
||||||
|
keepaspect = qtrue;
|
||||||
|
Sys_Printf( "Keeping aspect ratio by letterboxing\n", border );
|
||||||
|
}
|
||||||
|
else if( !strcmp( argv[ i ], "-nokeepaspect" ) )
|
||||||
|
{
|
||||||
|
keepaspect = qfalse;
|
||||||
|
Sys_Printf( "Not keeping aspect ratio\n", border );
|
||||||
|
}
|
||||||
else if( !strcmp( argv[ i ], "-o" ) )
|
else if( !strcmp( argv[ i ], "-o" ) )
|
||||||
{
|
{
|
||||||
strcpy(minimapFilename, argv[i + 1]);
|
strcpy(minimapFilename, argv[i + 1]);
|
||||||
|
@ -651,7 +665,7 @@ int MiniMapBSPMain( int argc, char **argv )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MiniMapMakeMinsMaxs(mins, maxs, border);
|
MiniMapMakeMinsMaxs(mins, maxs, border, keepaspect);
|
||||||
|
|
||||||
if(!*minimapFilename)
|
if(!*minimapFilename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -569,6 +569,7 @@ typedef struct game_s
|
||||||
int miniMapSize; /* minimap size */
|
int miniMapSize; /* minimap size */
|
||||||
float miniMapSharpen; /* minimap sharpening coefficient */
|
float miniMapSharpen; /* minimap sharpening coefficient */
|
||||||
float miniMapBorder; /* minimap border amount */
|
float miniMapBorder; /* minimap border amount */
|
||||||
|
qboolean miniMapKeepAspect; /* minimap keep aspect ratio by letterboxing */
|
||||||
char *miniMapNameFormat; /* minimap name format */
|
char *miniMapNameFormat; /* minimap name format */
|
||||||
char *bspIdent; /* 4-letter bsp file prefix */
|
char *bspIdent; /* 4-letter bsp file prefix */
|
||||||
int bspVersion; /* bsp version to use */
|
int bspVersion; /* bsp version to use */
|
||||||
|
|
Loading…
Reference in a new issue