]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
q3map2: generate unvanquished minimap sidecar file
authorThomas Debesse <dev@illwieckz.net>
Sun, 19 Apr 2020 09:49:36 +0000 (11:49 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sun, 19 Apr 2020 09:49:36 +0000 (11:49 +0200)
also enable the option for work-in-progress smokinguns port on dæmon

23 files changed:
tools/quake3/q3map2/game__null.h
tools/quake3/q3map2/game_darkplaces.h
tools/quake3/q3map2/game_dq.h
tools/quake3/q3map2/game_ef.h
tools/quake3/q3map2/game_etut.h
tools/quake3/q3map2/game_ja.h
tools/quake3/q3map2/game_jk2.h
tools/quake3/q3map2/game_nexuiz.h
tools/quake3/q3map2/game_prophecy.h
tools/quake3/q3map2/game_qfusion.h
tools/quake3/q3map2/game_quake3.h
tools/quake3/q3map2/game_quakelive.h
tools/quake3/q3map2/game_reaction.h
tools/quake3/q3map2/game_smokinguns.h
tools/quake3/q3map2/game_sof2.h
tools/quake3/q3map2/game_tenebrae.h
tools/quake3/q3map2/game_tremulous.h
tools/quake3/q3map2/game_unvanquished.h
tools/quake3/q3map2/game_wolf.h
tools/quake3/q3map2/game_wolfet.h
tools/quake3/q3map2/game_xonotic.h
tools/quake3/q3map2/minimap.c
tools/quake3/q3map2/q3map2.h

index a92544b28e607b3dd3d9a4fd0d0fea635712cfa9..a4a7441de5a34f776f8a40a8178db0d3b9f2ed9e 100644 (file)
@@ -84,6 +84,7 @@
        qfalse,         /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        NULL,           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        NULL,           /* bsp file prefix */
        0,              /* bsp file version */
        qfalse,         /* cod-style lump len/ofs order */
index 492dd2d2b3da211b8860e43780bd7c01988f429a..b697deb928fa900acd3ac0fc0f5014291b0830d5 100644 (file)
@@ -75,6 +75,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index b4963345e988bc8d5f057f5376108fcbadabe14d..66f1cd8378aa662ae8ff1b64275e814aef384839 100644 (file)
@@ -75,6 +75,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 03c9301f5e5b3456bbf0a165e995d6802865e772..bcb35b226a2fbecf4389f9c822c695648e710792 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index de7fad75952fef6ed0675be2706b82b6956f5b1a..f02fdb0a3f79dd0c593dda6e200cb55afc6244e1 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        47,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index cce3260af01a199aca87af67b12da06bdcd3f45c..6265ba3cacf3f8f34dddb21749f77f28a4a84dcb 100644 (file)
@@ -88,6 +88,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "RBSP",             /* bsp file prefix */
        1,                  /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index a667777d1446f4b0791cf740e93658a7edb48d1d..52e1c9932f80c37f1d5a3a1dae7582b75065f9cc 100644 (file)
@@ -85,6 +85,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "RBSP",             /* bsp file prefix */
        1,                  /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index b6fee7f9aa83433c08b30ebc5502364fedb6064c..d91b1ae6803bb45bbfc09ac05ec6c3f53bf4352b 100644 (file)
@@ -84,6 +84,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "../gfx/%s_mini.tga", /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 4a156a8fd45f3380d52ace495b23f5578be4a5d6..e446057ba7542a7969a7bc5e9866f5bb6b4eadcd 100644 (file)
@@ -75,6 +75,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 4950612997df2764df41228d4eaaa8357b598829..1348724bb1ea92fcb45099d464aa614ad5fb2da5 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "../minimaps/%s.tga", /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "FBSP",             /* bsp file prefix */
        1,                  /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 2b3302ab243c793dc906f0c62335291d0638919e..e20493a5928c86f99bd226a87c3fee552a8f2990 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index b4f876fb074068dba106cb0c9a2e38e798881e1b..d2995704376a3c39f7f30c7a37860dc142782f66 100644 (file)
@@ -97,6 +97,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        47,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 6163b391a106295c355e6e3dbf5ddf1368569e3a..8974556e0c2257c5d08831b95d74dccdc7e81e9c 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 296803cc540f7638afa9115f4e04931cd6701dee..6f6a59479c7d3cfcf3dbb26537a24a7558278ea0 100644 (file)
@@ -90,6 +90,7 @@ content and surface flags - also uses defines from game_quake3.h
        qtrue,                  /* minimap keep aspect */
        MINIMAP_MODE_WHITE,     /* minimap mode */
        "../minimaps/%s.tga",   /* minimap name format */
+       MINIMAP_SIDECAR_UNVANQUISHED, /* minimap sidecar format */
        "IBSP",                 /* bsp file prefix */
        46,                     /* bsp file version */
        qfalse,                 /* cod-style lump len/ofs order */
index fcceb0f96205244669a7589a1f00da6015766ff8..2ca335ace5a6863dc7fed8a8f495872b75b11367 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "RBSP",                 /* bsp file prefix */
        1,                      /* bsp file version */
        qfalse,                 /* cod-style lump len/ofs order */
index f9ba57ad264cdfe2807db87733cb148e9c7df259..debe6c1c796cf68f0fd8b4679da4ab92021013f0 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index a91b4c52b8d1e569f1077affed1f80becd971fe5..be0da88e26ef9b9aafe820d49b212ba18a1ce00c 100644 (file)
@@ -91,6 +91,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        46,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 20c935e613b58cd5562a91048458a158b0016206..b3cb4f572ddfbb150f4b2d9f4d6e88f9b46e9b8c 100644 (file)
@@ -93,6 +93,7 @@ game_t struct
        qtrue,                  /* minimap keep aspect */
        MINIMAP_MODE_WHITE,     /* minimap mode */
        "../minimaps/%s.tga",   /* minimap name format */
+       MINIMAP_SIDECAR_UNVANQUISHED, /* minimap sidecar format */
        "IBSP",                 /* bsp file prefix */
        46,                     /* bsp file version */
        qfalse,                 /* cod-style lump len/ofs order */
index a29fde2df2b0088f421042015f8dc70982609e65..81e2c22a21df0bfc2481d133518f25d6d1d11add 100644 (file)
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        47,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 46746c370b2b84120ef0633ebb84067465fae8ae..ee520627498649125a263162c4e8f07f830298ff 100644 (file)
@@ -87,6 +87,7 @@
        qtrue,              /* minimap keep aspect */
        MINIMAP_MODE_GRAY,  /* minimap mode */
        "%s.tga",           /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP",             /* bsp file prefix */
        47,                 /* bsp file version */
        qfalse,             /* cod-style lump len/ofs order */
index 5ffb30fbea6e83d69f15151ea41519dbc27a1de8..97ccff222d5ac7cbfccabd2032db83e9374d4c73 100644 (file)
@@ -84,6 +84,7 @@
        qtrue, /* minimap keep aspect */
        MINIMAP_MODE_GRAY, /* minimap mode */
        "../gfx/%s_mini.tga", /* minimap name format */
+       MINIMAP_SIDECAR_NONE, /* minimap sidecar format */
        "IBSP", /* bsp file prefix */
        46, /* bsp file version */
        qfalse, /* cod-style lump len/ofs order */
index 204e396c4cf2857095baab916e64bc756a92116b..7b582ee12787a9500f170099b800eba33a664ccf 100644 (file)
@@ -282,10 +282,9 @@ static void MiniMapBrightnessContrast( int y ){
        }
 }
 
-void MiniMapMakeMinsMaxs( vec3_t mins_in, vec3_t maxs_in, float border, qboolean keepaspect ){
-       vec3_t mins, maxs, extend;
-       VectorCopy( mins_in, mins );
-       VectorCopy( maxs_in, maxs );
+// modify maxs and mins in place, copy them before calling this!
+void MiniMapMakeMinsMaxs( vec3_t mins, vec3_t maxs, float border, qboolean keepaspect ){
+       vec3_t extend;
 
        // 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] );
@@ -601,7 +600,10 @@ int MiniMapBSPMain( int argc, char **argv ){
                }
        }
 
-       MiniMapMakeMinsMaxs( mins, maxs, border, keepaspect );
+       vec3_t mins_out, maxs_out;
+       VectorCopy( mins, mins_out );
+       VectorCopy( maxs, maxs_out );
+       MiniMapMakeMinsMaxs( mins_out, maxs_out, border, keepaspect );
 
        if ( !*minimapFilename ) {
                ExtractFileBase( source, basename );
@@ -773,6 +775,55 @@ int MiniMapBSPMain( int argc, char **argv ){
 
        Sys_Printf( " done.\n" );
 
+       switch ( game->miniMapSidecarFormat )
+       {
+               case MINIMAP_SIDECAR_UNVANQUISHED:
+               {
+                       char minimapPathWithoutExt[ 1024 ];
+                       char minimapSidecarFilename[ 1024 ];
+                       char *minimapSidecarExtension = ".minimap";
+                       char *minimapSidecarFormat = ""
+                               "{\n"
+                               "\tbackgroundColor 0.0 0.0 0.0 0.333\n"
+                               "\tzone {\n"
+                               "\t\tbounds 0 0 0 0 0 0\n"
+                               "\t\timage \"minimaps/%s\" %f %f %f %f\n"
+                               "\t}\n"
+                               "}\n";
+
+                       strcpy( minimapPathWithoutExt, minimapFilename );
+                       StripExtension( minimapPathWithoutExt );
+                       snprintf( minimapSidecarFilename,
+                               1024 - strlen(minimapSidecarExtension),
+                               "%s%s",
+                               minimapPathWithoutExt,
+                               minimapSidecarExtension );
+
+                       Sys_Printf( "Writing minimap sidecar to %s...", minimapSidecarFilename );
+
+                       FILE *file = fopen( minimapSidecarFilename, "w" );
+                       if ( file == NULL ) {
+                               Sys_FPrintf( SYS_WRN, "WARNING: Unable to open minimap sidecarr file %s for writing\n", minimapSidecarFilename );
+                               break;
+                       }
+
+                       fprintf( file,
+                               minimapSidecarFormat,
+                               basename,
+                               mins_out[0], mins_out[1],
+                               maxs_out[0], maxs_out[1] );
+
+                       fflush( file );
+                       fclose( file );
+
+                       Sys_Printf( " done.\n" );
+
+                       break;
+               }
+               case MINIMAP_SIDECAR_NONE:
+                       break;
+       }
+
        /* return to sender */
        return 0;
 }
index dfc971a92dd71d0912218a53e431e6d5c7421161..fecbf5f60a48180b15f8e3d912074741d539635c 100644 (file)
@@ -548,6 +548,13 @@ typedef enum
 }
 miniMapMode_t;
 
+typedef enum
+{
+       MINIMAP_SIDECAR_NONE,
+       MINIMAP_SIDECAR_UNVANQUISHED
+}
+miniMapSidecarFormat_t;
+
 typedef struct game_s
 {
        char                *arg;                           /* -game matches this */
@@ -584,6 +591,7 @@ typedef struct game_s
        qboolean miniMapKeepAspect;                         /* minimap keep aspect ratio by letterboxing */
        miniMapMode_t miniMapMode;                          /* minimap mode */
        char                *miniMapNameFormat;             /* minimap name format */
+       miniMapSidecarFormat_t miniMapSidecarFormat;        /* minimap sidecar format */
        char                *bspIdent;                      /* 4-letter bsp file prefix */
        int bspVersion;                                     /* bsp version to use */
        qboolean lumpSwap;                                  /* cod-style len/ofs order */