]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
q3map2: make Smokin'Guns code not requiring a rebuild
authorThomas Debesse <dev@illwieckz.net>
Wed, 1 May 2019 14:16:52 +0000 (16:16 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 1 Jun 2019 21:08:17 +0000 (23:08 +0200)
Not only Smokin'Guns game can now use .tex sidecar file

27 files changed:
tools/quake3/CMakeLists.txt
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/light.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/vis.c
tools/quake3/q3map2/writebsp.c

index e0bb8989138233bfe67714c52bf336e50fe05fcd..7ba643bfdf7529f233845cecba214901fab3ca63 100644 (file)
@@ -49,6 +49,7 @@ set(q3map2_games
         q3map2/game_quake3.h
         q3map2/game_quakelive.h
         q3map2/game_reaction.h
+        q3map2/game_smokinguns.h
         q3map2/game_sof2.h
         q3map2/game_tenebrae.h
         q3map2/game_tremulous.h
index a8bbec9cf1351ac715c4ed04eef22638a73545c3..a92544b28e607b3dd3d9a4fd0d0fea635712cfa9 100644 (file)
@@ -58,6 +58,7 @@
        0,              /* max lightmapped surface verts */
        0,              /* max surface verts */
        0,              /* max surface indexes */
+       qfalse,         /* enable per shader prefix surface flags and .tex file */
        qfalse,         /* flares */
        NULL,           /* default flare shader */
        qfalse,         /* wolf lighting model? */
index 2f998d24ee3f9f9b619f3690a4d812ef217aeaed..492dd2d2b3da211b8860e43780bd7c01988f429a 100644 (file)
@@ -49,6 +49,7 @@
        999,                /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 4d691b4662f227146ef5d7d64566fffec8a01901..b4963345e988bc8d5f057f5376108fcbadabe14d 100644 (file)
@@ -49,6 +49,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 9ef109038e31a590302ea8b31929b3b2eb06c2d4..03c9301f5e5b3456bbf0a165e995d6802865e772 100644 (file)
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index f4303f2e63153470c2f3431d8d14567239c923f2..de7fad75952fef6ed0675be2706b82b6956f5b1a 100644 (file)
        1024,               /* max lightmapped surface verts */
        1024,               /* max surface verts */
        6144,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index b598a09662d2270dba8d336850c3cc296eea2549..cce3260af01a199aca87af67b12da06bdcd3f45c 100644 (file)
@@ -62,6 +62,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qtrue,              /* flares */
        "gfx/misc/flare",   /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 69c80edba4646785d069cd6e7ab6b5b44ee17416..a667777d1446f4b0791cf740e93658a7edb48d1d 100644 (file)
@@ -59,6 +59,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qtrue,              /* flares */
        "gfx/misc/flare",   /* default flare shader */
        qfalse,             /* wolf lighting model? */
index f299f4d182e3e9c53a4b689c9f0871edd44776da..b6fee7f9aa83433c08b30ebc5502364fedb6064c 100644 (file)
@@ -58,6 +58,7 @@
        999,                /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index a5e11cb73e76363156583fd07d5294c8cd1dd5d7..4a156a8fd45f3380d52ace495b23f5578be4a5d6 100644 (file)
@@ -49,6 +49,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 5cd5b0386648ffc7c493778cfddf107399b2fad4..4950612997df2764df41228d4eaaa8357b598829 100644 (file)
        65535,              /* max lightmapped surface verts */
        65535,              /* max surface verts */
        393210,             /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 66b402893110d35b55387213ab0be9f627fc2db7..2b3302ab243c793dc906f0c62335291d0638919e 100644 (file)
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 3f7a29daa659119121701e1b59164a702223e7b5..b4f876fb074068dba106cb0c9a2e38e798881e1b 100644 (file)
@@ -71,6 +71,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 2474274e73fbb9bf5a56d82637818e8a67b1e381..6163b391a106295c355e6e3dbf5ddf1368569e3a 100644 (file)
@@ -79,6 +79,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 78be8ba758b743d8de965b69e0b1034d8eb5ecbf..296803cc540f7638afa9115f4e04931cd6701dee 100644 (file)
@@ -1,30 +1,30 @@
 /* -------------------------------------------------------------------------------
 
-   Copyright (C) 1999-2007 id Software, Inc. and contributors.
-   For a list of contributors, see the accompanying CONTRIBUTORS file.
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
 
-   This file is part of GtkRadiant.
+This file is part of GtkRadiant.
 
-   GtkRadiant is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-   GtkRadiant is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with GtkRadiant; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-   ----------------------------------------------------------------------------------
+----------------------------------------------------------------------------------
 
-   This code has been altered significantly from its original form, to support
-   several games based on the Quake III Arena engine, in the form of "Q3Map2."
+This code has been altered significantly from its original form, to support
+several games based on the Quake III Arena engine, in the form of "Q3Map2."
 
-   ------------------------------------------------------------------------------- */
+------------------------------------------------------------------------------- */
 
 
 
 
 /* -------------------------------------------------------------------------------
 
-content and surface flags
+content and surface flags - also uses defines from game_quake3.h
 
 ------------------------------------------------------------------------------- */
 
 /* game flags */
 
-// Support content making dynamite explodes and molotov burns
-#define Q_CONT_EXPLOSIVE               2
-#define Q_CONT_FLAMMABLE               4
-#define Q_CONT_BURNING_SOLID   Q_CONT_SOLID|Q_CONT_EXPLOSIVE|Q_CONT_FLAMMABLE
+// support content making dynamite explodes and molotov burns
+#define SG_CONT_EXPLOSIVE              2
+#define SG_CONT_FLAMMABLE              4
+#define SG_CONT_BURNING_SOLID  (Q_CONT_SOLID | SG_CONT_EXPLOSIVE | SG_CONT_FLAMMABLE )
+
+// see q3map2.h for tex surface flags
 
 /* -------------------------------------------------------------------------------
 
@@ -54,25 +56,45 @@ content and surface flags
    ------------------------------------------------------------------------------- */
 
 {
-       "smokinguns",       /* -game x */
-       "smokinguns",       /* default base game data dir */
-       ".smokinguns",      /* unix home sub-dir */
-       "smokinguns",       /* magic path word */
-       "scripts",          /* shader directory */
-       64,                 /* max lightmapped surface verts */
-       999,                /* max surface verts */
-       6000,               /* max surface indexes */
-       qfalse,             /* flares */
-       "flareshader",      /* default flare shader */
-       qfalse,             /* wolf lighting model? */
-       128,                /* lightmap width/height */
-       1.0f,               /* lightmap gamma */
-       1.0f,               /* lightmap compensate */
-       "IBSP",             /* bsp file prefix */
-       46,                 /* bsp file version */
-       qfalse,             /* cod-style lump len/ofs order */
-       LoadIBSPFile,       /* bsp load function */
-       WriteIBSPFile,      /* bsp write function */
+       "smokinguns",           /* -game x */
+       "smokinguns",           /* default base game data dir */
+       ".smokinguns",          /* unix home sub-dir */
+       "smokinguns",           /* magic path word */
+       "scripts",              /* shader directory */
+       1048575,                /* max lightmapped surface verts */
+       1048575,                /* max surface verts */
+       1048575,                /* max surface indexes */
+       qtrue,                  /* enable per shader prefix surface flags and .tex file */
+       qfalse,                 /* flares */
+       "flareshader",          /* default flare shader */
+       qfalse,                 /* wolf lighting model? */
+       128,                    /* lightmap width/height */
+       1.0f,                   /* lightmap gamma */
+       qfalse,                 /* lightmap sRGB */
+       qfalse,                 /* texture sRGB */
+       qfalse,                 /* color sRGB */
+       0.0f,                   /* lightmap exposure */
+       1.0f,                   /* lightmap compensate */
+       1.0f,                   /* lightgrid scale */
+       1.0f,                   /* lightgrid ambient scale */
+       qfalse,                 /* light angle attenuation uses half-lambert curve */
+       qfalse,                 /* disable shader lightstyles hack */
+       qtrue,                  /* keep light entities on bsp */
+       8,                      /* default patchMeta subdivisions tolerance */
+       qfalse,                 /* patch casting enabled */
+       qfalse,                 /* compile deluxemaps */
+       0,                      /* deluxemaps default mode */
+       512,                    /* minimap size */
+       1.0f,                   /* minimap sharpener */
+       0.0f,                   /* minimap border */
+       qtrue,                  /* minimap keep aspect */
+       MINIMAP_MODE_WHITE,     /* minimap mode */
+       "../minimaps/%s.tga",   /* minimap name format */
+       "IBSP",                 /* bsp file prefix */
+       46,                     /* bsp file version */
+       qfalse,                 /* cod-style lump len/ofs order */
+       LoadIBSPFile,           /* bsp load function */
+       WriteIBSPFile,          /* bsp write function */
 
        {
                /* name                         contentFlags                            contentFlagsClear                       surfaceFlags                            surfaceFlagsClear                       compileFlags                            compileFlagsClear */
@@ -109,7 +131,7 @@ content and surface flags
 
                { "water",          Q_CONT_WATER,               Q_CONT_SOLID,               0,                          0,                          C_LIQUID | C_TRANSLUCENT,   C_SOLID },
                { "slime",          Q_CONT_SLIME,               Q_CONT_SOLID,               0,                          0,                          C_LIQUID | C_TRANSLUCENT,   C_SOLID },
-               { "lava",           Q_CONT_LAVA,                Q_CONT_BURNING_SOLID,       0,                          0,                          C_LIQUID | C_TRANSLUCENT,   C_SOLID },
+               { "lava",           Q_CONT_LAVA,                SG_CONT_BURNING_SOLID,      0,                          0,                          C_LIQUID | C_TRANSLUCENT,   C_SOLID },
 
                { "playerclip",     Q_CONT_PLAYERCLIP,          Q_CONT_SOLID,               0,                          0,                          C_DETAIL | C_TRANSLUCENT,   C_SOLID },
                { "monsterclip",    Q_CONT_MONSTERCLIP,         Q_CONT_SOLID,               0,                          0,                          C_DETAIL | C_TRANSLUCENT,   C_SOLID },
@@ -135,24 +157,22 @@ content and surface flags
                { "dust",           0,                          0,                          Q_SURF_DUST,                0,                          0,                          0 },
 
                /* materials */
-               { "metal",                      0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },
-               { "wood",                       0,                                                      0,                                                      Q_SURF_WOOD,                            0,                                                      0,                                                      0 },
-               { "cloth",                      0,                                                      0,                                                      Q_SURF_CLOTH,                           0,                                                      0,                                                      0 },
-               { "dirt",                       0,                                                      0,                                                      Q_SURF_DIRT,                            0,                                                      0,                                                      0 },
-               { "glass",                      0,                                                      0,                                                      Q_SURF_GLASS,                           0,                                                      0,                                                      0 },
-               { "plant",                      0,                                                      0,                                                      Q_SURF_PLANT,                           0,                                                      0,                                                      0 },
-               { "sand",                       0,                                                      0,                                                      Q_SURF_SAND,                            0,                                                      0,                                                      0 },
-               { "snow",                       0,                                                      0,                                                      Q_SURF_SNOW,                            0,                                                      0,                                                      0 },
-               { "stone",                      0,                                                      0,                                                      Q_SURF_STONE,                           0,                                                      0,                                                      0 },
-               { "water",                      0,                                                      0,                                                      Q_SURF_WATER,                           0,                                                      0,                                                      0 },
-               { "grass",                      0,                                                      0,                                                      Q_SURF_GRASS,                           0,                                                      0,                                                      0 }, 
+               { "metal",          0,                          0,                          TEX_SURF_METAL,        0,                          0,                          0 },
+               { "wood",           0,                          0,                          TEX_SURF_WOOD,              0,                          0,                          0 },
+               { "cloth",          0,                          0,                          TEX_SURF_CLOTH,             0,                          0,                          0 },
+               { "dirt",           0,                          0,                          TEX_SURF_DIRT,              0,                          0,                          0 },
+               { "glass",          0,                          0,                          TEX_SURF_GLASS,             0,                          0,                          0 },
+               { "plant",          0,                          0,                          TEX_SURF_PLANT,             0,                          0,                          0 },
+               { "sand",           0,                          0,                          TEX_SURF_SAND,              0,                          0,                          0 },
+               { "snow",           0,                          0,                          TEX_SURF_SNOW,              0,                          0,                          0 },
+               { "stone",          0,                          0,                          TEX_SURF_STONE,             0,                          0,                          0 },
+               { "water",          0,                          0,                          TEX_SURF_WATER,             0,                          0,                          0 },
+               { "grass",          0,                          0,                          TEX_SURF_GRASS,             0,                          0,                          0 }, 
 
                /* null */
                { NULL, 0, 0, 0, 0, 0, 0 }
        }
 }
 
-
-
 /* end marker */
 #endif
index 2e72270b0d636f64a7f9461e284d79e49beffd18..fcceb0f96205244669a7589a1f00da6015766ff8 100644 (file)
        64,                     /* max lightmapped surface verts */
        999,                    /* max surface verts */
        6000,                   /* max surface indexes */
+       qfalse,                 /* enable per shader prefix surface flags and .tex file */
        qtrue,                  /* flares */
        "gfx/misc/lens_flare",  /* default flare shader */
        qfalse,                 /* wolf lighting model? */
index 243f756c0ee1d6d068813880afe9ac4c2f9ee43c..f9ba57ad264cdfe2807db87733cb148e9c7df259 100644 (file)
        1024,               /* max lightmapped surface verts */
        1024,               /* max surface verts */
        6144,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 6853e61746f9b4ac7cf6428d96b91d73b4f445ea..a91b4c52b8d1e569f1077affed1f80becd971fe5 100644 (file)
@@ -65,6 +65,7 @@
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qfalse,             /* wolf lighting model? */
index 75d6804e52f3b056ddac01ae0209b5cc10d1a717..20c935e613b58cd5562a91048458a158b0016206 100644 (file)
@@ -67,6 +67,7 @@ game_t struct
        1048575,                /* max lightmapped surface verts */
        1048575,                /* max surface verts */
        1048575,                /* max surface indexes */
+       qfalse,                 /* enable per shader prefix surface flags and .tex file */
        qfalse,                 /* flares */
        "flareshader",          /* default flare shader */
        qfalse,                 /* wolf lighting model? */
index fcfd17ec964f65a877d118b9b496d3fd3f995a62..a29fde2df2b0088f421042015f8dc70982609e65 100644 (file)
        64,                 /* max lightmapped surface verts */
        999,                /* max surface verts */
        6000,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qtrue,              /* wolf lighting model? */
index c783b9a0805a89a4b3d7799171668c8ab2f57f1c..46746c370b2b84120ef0633ebb84067465fae8ae 100644 (file)
@@ -61,6 +61,7 @@
        1024,               /* max lightmapped surface verts */
        1024,               /* max surface verts */
        6144,               /* max surface indexes */
+       qfalse,             /* enable per shader prefix surface flags and .tex file */
        qfalse,             /* flares */
        "flareshader",      /* default flare shader */
        qtrue,              /* wolf lighting model? */
index b0ac53959b5f1a1691bad763da742fda6eb9e3b0..5ffb30fbea6e83d69f15151ea41519dbc27a1de8 100644 (file)
@@ -58,6 +58,7 @@
        1048575, /* max lightmapped surface verts */
        1048575, /* max surface verts */
        1048575, /* max surface indexes */
+       qfalse, /* enable per shader prefix surface flags and .tex file */
        qfalse, /* flares */
        "flareshader", /* default flare shader */
        qfalse, /* wolf lighting model? */
index 0f55316498019126637409ffb2b268ddb0da8a0b..6b60e7372c972b06e28a6e83ce18e551becd7a03 100644 (file)
@@ -2104,20 +2104,23 @@ void LightWorld( const char *BSPFilePath, qboolean fastAllocate ){
 
 
 
-#ifdef SMOKINGUNS
-//added by spoon to get back the changed surfaceflags
-void LoadSurfaceFlags(char *filename){
+/*
+   LoadSurfaceFlags()
+   added by spoon to get back the changed surfaceflags
+   from tex file
+*/
+
+void LoadSurfaceFlags( char *filename ) {
        int i;
 
-       for(i=0; i<numBSPShaders;i++){
-               shaderInfo_t    *si;
+       for( i = 0; i < numBSPShaders; i++ ) {
+               shaderInfo_t *si;
 
                si = ShaderInfoForShader( bspShaders[i].shader );
 
-               bspShaders[i].surfaceFlags = si->surfaceFlags;
+               bspShaders[ i ].surfaceFlags = si->surfaceFlags;
        }
 }
-#endif
 
 
 
index 0eec34429c6bf5b7404a9b7365a7c7d984a29984..90fc5d90f624641d70def6513081f940874ca75a 100644 (file)
@@ -276,10 +276,10 @@ int main( int argc, char **argv ){
        }
 
        /* ydnar: otherwise create a bsp */
-       else{
-#ifdef SMOKINGUNS
+       else {
+               /* used to write Smokin'Guns like tex file */
                compile_map = qtrue;
-#endif
+
                r = BSPMain( argc, argv );
        }
 
index 5593b86aff10b6b5ee59cf4a824f98cd836f9d51..38ee560a6bf4c4610c6ac7b86ab68185c533b16a 100644 (file)
 #define C_DETAIL                0x08000000  /* THIS MUST BE THE SAME AS IN RADIANT! */
 
 
-#ifdef SMOKINGUNS
-// new Smokin'Guns surface flags
-#define        Q_SURF_METAL                    0x00001000
-#define        Q_SURF_WOOD                             0x00080000
-#define        Q_SURF_CLOTH                    0x00100000
-#define Q_SURF_DIRT                            0x00200000
-#define        Q_SURF_GLASS                    0x00400000
-#define        Q_SURF_PLANT                    0x00800000
-#define Q_SURF_SAND                            0x01000000
-#define        Q_SURF_SNOW                             0x02000000
-#define        Q_SURF_STONE                    0x04000000
-#define        Q_SURF_WATER                    0x08000000
-#define        Q_SURF_GRASS                    0x10000000
-#define        Q_SURF_BREAKABLE                0x20000000
-#endif
+/* new tex surface flags, like Smokin'Guns */
+#define TEX_SURF_METAL             0x00001000
+#define TEX_SURF_WOOD              0x00080000
+#define TEX_SURF_CLOTH             0x00100000
+#define TEX_SURF_DIRT              0x00200000
+#define TEX_SURF_GLASS             0x00400000
+#define TEX_SURF_PLANT             0x00800000
+#define TEX_SURF_SAND              0x01000000
+#define TEX_SURF_SNOW              0x02000000
+#define TEX_SURF_STONE             0x04000000
+#define TEX_SURF_WATER             0x08000000
+#define TEX_SURF_GRASS             0x10000000
+#define TEX_SURF_BREAKABLE         0x20000000
 
 
 /* shadow flags */
@@ -562,6 +560,7 @@ typedef struct game_s
        int maxLMSurfaceVerts;                              /* default maximum meta surface verts */
        int maxSurfaceVerts;                                /* default maximum surface verts */
        int maxSurfaceIndexes;                              /* default maximum surface indexes (tris * 3) */
+       qboolean texFile;                                   /* enable per shader prefix surface flags and .tex file */
        qboolean emitFlares;                                /* when true, emit flare surfaces */
        char                *flareShader;                   /* default flare shader (MUST BE SET) */
        qboolean wolfLight;                                 /* when true, lights work like wolf q3map  */
@@ -1915,12 +1914,10 @@ void                        LoadBSPFile( const char *filename );
 void                        WriteBSPFile( const char *filename );
 void                        PrintBSPFileSizes( void );
 
-#ifdef SMOKINGUNS
-void                                           WriteTexFile(char *name);
-void                                           LoadSurfaceFlags(char *filename);
-int                                                    GetSurfaceParm(const char *tex);
-void                                           RestoreSurfaceFlags(char *filename);
-#endif
+void                        WriteTexFile( char *name );
+void                        LoadSurfaceFlags( char *filename );
+int                         GetSurfaceParm( const char *tex );
+void                        RestoreSurfaceFlags( char *filename );
 
 epair_t                     *ParseEPair( void );
 void                        ParseEntities( void );
@@ -2001,10 +1998,8 @@ Q_EXTERN game_t games[]
                                                                #include "game_qfusion.h"   /* qfusion game */
        ,
                                                                #include "game_reaction.h" /* must be after game_quake3.h */
-#ifdef SMOKINGUNS
        ,
-                                                               #include "game_smokinguns.h" /* Smokin'Guns */
-#endif
+                                                               #include "game_smokinguns.h" /* must be after game_quake3.h */
        ,
                                                                #include "game_darkplaces.h"    /* vortex: darkplaces q1 engine */
        ,
@@ -2572,10 +2567,8 @@ Q_EXTERN bspFog_t bspFogs[ MAX_MAP_FOGS ];
 Q_EXTERN int numBSPAds Q_ASSIGN( 0 );
 Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ];
 
-#ifdef SMOKINGUNS
-// Smokin'Guns globals
-Q_EXTERN qboolean                      compile_map;
-#endif
+// Used for tex file support, Smokin'Guns globals
+Q_EXTERN qboolean compile_map;
 
 #define AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def ) \
        do \
index 66a46addaf038e58c8c1ce1520505da7a6b4dbc1..7623590b53086fe4ba2b4655520f28cf3b746f44 100644 (file)
@@ -1181,13 +1181,15 @@ int VisMain( int argc, char **argv ){
        Sys_Printf( "Loading %s\n", source );
        LoadBSPFile( source );
 
-#ifdef SMOKINGUNS
-       StripExtension (source);
-       strcat (source, ".tex");
-       LoadSurfaceFlags(source);
-       StripExtension (source);
-       strcat (source, ".bsp");
-#endif
+       if ( game->texFile )
+       {
+               // smokinguns-like tex file
+               StripExtension( source );
+               strcat( source, ".tex" );
+               LoadSurfaceFlags( source );
+               StripExtension( source );
+               strcat( source, ".bsp" );
+       }
 
        /* load the portal file */
        if (!portalFilePath[0]) {
@@ -1231,11 +1233,13 @@ int VisMain( int argc, char **argv ){
                remove( portalFilePath );
        }
 
-#ifdef SMOKINGUNS
-       StripExtension (source);
-       WriteTexFile(source);
-       DefaultExtension (source, ".bsp");
-#endif
+       if ( game->texFile )
+       {
+               // smokinguns-like tex file
+               StripExtension( source );
+               WriteTexFile( source );
+               DefaultExtension( source, ".bsp" );
+       }
 
        /* write the bsp file */
        Sys_Printf( "Writing %s\n", source );
index 9cfa577baeb8459de4e28c3aae6e6feaf9b6a7ab..3fbed1cc64dfb25a1f4a705baf50e9e22aa1d53c 100644 (file)
@@ -36,8 +36,7 @@
 /* dependencies */
 #include "q3map2.h"
 
-#ifdef SMOKINGUNS
-#define NUM_PREFIXINFO 11 //very important
+
 
 //prefixInfo-stats
 typedef struct {
@@ -45,21 +44,22 @@ typedef struct {
        int             surfaceFlags;
 } prefixInfo_t;
 
-
 static prefixInfo_t prefixInfo[] = {
-       { "metal",      Q_SURF_METAL},
-       { "wood",       Q_SURF_WOOD},
-       { "cloth",      Q_SURF_CLOTH},
-       { "dirt",       Q_SURF_DIRT},
-       { "glass",      Q_SURF_GLASS},
-       { "plant",      Q_SURF_PLANT},
-       { "sand",       Q_SURF_SAND},
-       { "snow",       Q_SURF_SNOW},
-       { "stone",      Q_SURF_STONE},
-       { "water",      Q_SURF_WATER},
-       { "grass",      Q_SURF_GRASS},
+       { "metal",      TEX_SURF_METAL},
+       { "wood",       TEX_SURF_WOOD},
+       { "cloth",      TEX_SURF_CLOTH},
+       { "dirt",       TEX_SURF_DIRT},
+       { "glass",      TEX_SURF_GLASS},
+       { "plant",      TEX_SURF_PLANT},
+       { "sand",       TEX_SURF_SAND},
+       { "snow",       TEX_SURF_SNOW},
+       { "stone",      TEX_SURF_STONE},
+       { "water",      TEX_SURF_WATER},
+       { "grass",      TEX_SURF_GRASS},
 };
 
+#define NUM_PREFIXINFO 11 /* very important */
+
 //Added by Spoon to recognize surfaceparms by shadernames
 int GetSurfaceParm(const char *tex){
        char surf[MAX_QPATH], tex2[MAX_QPATH];
@@ -67,7 +67,7 @@ int GetSurfaceParm(const char *tex){
 
        strcpy(tex2, tex);
 
-       //find last dir
+       /* find last dir */
        for(i = 0; i < 64 && tex2[i] != '\0'; i++){
                if(tex2[i] == '\\' || tex2[i] == '/')
                        j=i+1;
@@ -81,7 +81,7 @@ int GetSurfaceParm(const char *tex){
        }
        surf[i] = '\0';
 
-       //Sys_Printf("%s\n", surf);
+       /* Sys_Printf("%s\n", surf); */
 
        for(i=0; i < NUM_PREFIXINFO; i++){
                if(!Q_stricmp(surf, prefixInfo[i].name)){
@@ -90,7 +90,6 @@ int GetSurfaceParm(const char *tex){
        }
        return 0;
 }
-#endif
 
 
 
@@ -112,15 +111,17 @@ int EmitShader( const char *shader, int *contentFlags, int *surfaceFlags ){
        /* try to find an existing shader */
        for ( i = 0; i < numBSPShaders; i++ )
        {
-               /* ydnar: handle custom surface/content flags */
-#ifndef SMOKINGUNS
-               if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) {
-                       continue;
-               }
-               if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) {
-                       continue;
+               /* if not Smokin'Guns like tex file */
+               if ( !game->texFile )
+               {
+                       /* ydnar: handle custom surface/content flags */
+                       if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) {
+                               continue;
+                       }
+                       if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) {
+                               continue;
+                       }
                }
-#endif
 
                /* compare name */
                if ( !Q_stricmp( shader, bspShaders[ i ].shader ) ) {
@@ -137,20 +138,26 @@ int EmitShader( const char *shader, int *contentFlags, int *surfaceFlags ){
        numBSPShaders++;
        strcpy( bspShaders[ i ].shader, shader );
        bspShaders[ i ].surfaceFlags = si->surfaceFlags;
-#ifdef SMOKINGUNS
-       bspShaders[ i ].surfaceFlags |= GetSurfaceParm(si->shader);
-#endif
-       bspShaders[ i ].contentFlags = si->contentFlags;
 
-       /* handle custom content/surface flags */
-#ifndef SMOKINGUNS
-       if ( surfaceFlags != NULL ) {
-               bspShaders[ i ].surfaceFlags = *surfaceFlags;
+       if ( game->texFile )
+       {
+               /* Smokin'Guns like tex file */
+               bspShaders[ i ].surfaceFlags |= GetSurfaceParm(si->shader);
        }
-       if ( contentFlags != NULL ) {
-               bspShaders[ i ].contentFlags = *contentFlags;
+
+       bspShaders[ i ].contentFlags = si->contentFlags;
+
+       /* if not Smokin'Guns like tex file */
+       if ( !game->texFile )
+       {
+               /* handle custom content/surface flags */
+               if ( surfaceFlags != NULL ) {
+                       bspShaders[ i ].surfaceFlags = *surfaceFlags;
+               }
+               if ( contentFlags != NULL ) {
+                       bspShaders[ i ].contentFlags = *contentFlags;
+               }
        }
-#endif
 
        /* recursively emit any damage shaders */
        if ( si->damageShader != NULL && si->damageShader[ 0 ] != '\0' ) {
@@ -458,60 +465,76 @@ void BeginBSPFile( void ){
 
 
 
-#ifdef SMOKINGUNS
-//added by spoon to get back the changed surfaceflags
-void RestoreSurfaceFlags(char *filename){
+/*
+   RestoreSurfaceFlags()
+   read Smokin'Guns like tex file
+   added by spoon to get back the changed surfaceflags
+ */
+
+void RestoreSurfaceFlags( char *filename ) {
        int i;
-       FILE    *texfile;
-       int             surfaceFlags[MAX_MAP_DRAW_SURFS];
-       int             numTexInfos;
+       FILE *texfile;
+       int surfaceFlags[ MAX_MAP_DRAW_SURFS ];
+       int numTexInfos;
+
+       /* first parse the tex file */
+       texfile = fopen( filename, "r" );
 
-       //first parse the tex-file
-       texfile = fopen(filename, "r");
-       if(texfile){
-               fscanf( texfile, "TEXFILE\n%i\n", &numTexInfos);
-               //Sys_Printf("%i\n", numTexInfos);
+       if ( texfile ) {
+               fscanf( texfile, "TEXFILE\n%i\n", &numTexInfos );
 
-               for(i=0; i<numTexInfos; i++){
+               /* Sys_Printf( "%i\n", numTexInfos ); */
+
+               for ( i = 0; i < numTexInfos; i++ ) {
                        vec3_t color;
-                       fscanf( texfile, "%i %f %f %f\n", &surfaceFlags[i],
-                               &color[0], &color[1], &color[2]);
-                       bspShaders[i].surfaceFlags = surfaceFlags[i];
-                       //Sys_Printf("%i\n", surfaceFlags[i]);
+
+                       fscanf( texfile, "%i %f %f %f\n", &surfaceFlags[ i ],
+                               &color[ 0 ], &color[ 1 ], &color[ 2 ]);
+
+                       bspShaders[ i ].surfaceFlags = surfaceFlags[ i ];
+
+                       /* Sys_Printf( "%i\n", surfaceFlags[ i ] ); */
                }
-       } else
+       } else {
                Sys_Printf("couldn't find %s not tex-file is now writed without surfaceFlags!\n", filename);
+       }
 }
 
-void WriteTexFile( char* name){
-       FILE                    *texfile;
-       char                    filename[1024];
-       int                             i;
 
-       sprintf (filename, "%s.tex", name);
 
-       if(!compile_map){
-               RestoreSurfaceFlags(filename);
+/*
+   WriteTexFile()
+   write Smokin'Guns like tex file
+   added by spoon
+ */
+
+void WriteTexFile( char* filename ) {
+       FILE *texfile;
+       int i;
+
+       if ( !compile_map ) {
+               RestoreSurfaceFlags( filename );
        }
 
-       Sys_Printf("Writing %s ...\n", filename);
-       texfile = fopen (filename, "w");
+       Sys_Printf( "Writing %s ...\n", filename );
 
-       fprintf( texfile, "TEXFILE\n");
+       texfile = fopen ( filename, "w" );
 
-       fprintf( texfile, "%i\n", numBSPShaders);
-       for ( i = 0 ; i < numBSPShaders ; i++ ) {
-               shaderInfo_t    *se = ShaderInfoForShader(bspShaders[i].shader);
+       fprintf( texfile, "TEXFILE\n" );
+
+       fprintf( texfile, "%i\n", numBSPShaders );
 
-               fprintf( texfile, "\n%i %f %f %f", bspShaders[i].surfaceFlags,
-                       se->color[0], se->color[1], se->color[2]);
+       for ( i = 0 ; i < numBSPShaders ; i++ ) {
+               shaderInfo_t *se = ShaderInfoForShader( bspShaders[ i ].shader );
 
+               fprintf( texfile, "\n%i %f %f %f", bspShaders[ i ].surfaceFlags,
+                       se->color[ 0 ], se->color[ 1 ], se->color[ 2 ] );
 
-               bspShaders[i].surfaceFlags = i;
+               bspShaders[ i ].surfaceFlags = i;
        }
-       fclose(texfile);
+
+       fclose( texfile );
 }
-#endif
 
 
 
@@ -533,10 +556,16 @@ void EndBSPFile( qboolean do_write, const char *BSPFilePath, const char *surface
                /* write the surface extra file */
                WriteSurfaceExtraFile( surfaceFilePath );
 
-#ifdef SMOKINGUNS
-               //only create tex file if it is the first compile
-               WriteTexFile (source);
-#endif
+               if ( game->texFile )
+               {
+                       char basename[ 1024 ];  
+                       char filename[ 1024 ];
+                       strncpy( basename, BSPFilePath, sizeof(basename) );
+                       sprintf( filename, "%s.tex", basename );
+
+                       /* only create tex file if it is the first compile */
+                       WriteTexFile( filename );
+               }
 
                /* write the bsp */
                Sys_Printf( "Writing %s\n", BSPFilePath );