fix lots of CRLFs
authorRudolf Polzer <divverent@alientrap.org>
Sat, 17 Apr 2010 19:02:26 +0000 (21:02 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 17 Apr 2010 19:02:26 +0000 (21:02 +0200)
27 files changed:
.gitattributes
contrib/bkgrnd2d/bkgrnd2d.def
contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt
contrib/brushexport/brushexport.def
contrib/brushexport/plugin.h
contrib/shaderplug/shaderplug.cpp
contrib/shaderplug/shaderplug.def
contrib/shaderplug/shaderplug.h
contrib/sunplug/sunplug.cpp
contrib/sunplug/sunplug.def
contrib/sunplug/sunplug.h
generic_cpp.py
generic_h.py
libs/cmdlib/.cvswrappers
libs/jpeg6/.cvswrappers
libs/xml/xmltextags.cpp
libs/xml/xmltextags.h
setup/data/tools/plugins/bt/bt-el1.txt
setup/data/tools/plugins/bt/door-tex-trim.txt
setup/data/tools/plugins/bt/door-tex.txt
setup/data/tools/plugins/bt/tp_ent.txt
tools/quake2/qdata_heretic2/script1.rc
tools/quake3/q3map2/game_darkplaces.h
tools/quake3/q3map2/game_dq.h
tools/quake3/q3map2/game_prophecy.h
tools/quake3/q3map2/q3map2.rc
tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch

index edd30fd..67420ef 100644 (file)
@@ -95,8 +95,8 @@ makespr32 crlf=input
 *.mapinfo crlf=input
 *.m crlf=input
 *.md3 -crlf -diff
-*.md5anim crlf=input
-*.md5mesh crlf=input
+*.md5anim -crlf
+*.md5mesh -crlf
 *.mdl -crlf -diff
 *.med crlf=input
 *.mf crlf=input
@@ -124,7 +124,7 @@ PkgInfo crlf=input
 *.pm crlf=input
 *.png -crlf -diff
 POSITIONS -crlf -diff
-*.proj crlf=input
+*.proj -crlf
 *.properties crlf=input
 *.psd -crlf -diff
 *.py crlf=input
index 36c4457..fa90fdb 100644 (file)
@@ -1,8 +1,8 @@
-; bkgrnd2d.def : Declares the module parameters for the DLL.\r
-\r
-LIBRARY      "BKGRND2D"\r
-DESCRIPTION  'BKGRND2D Windows Dynamic Link Library'\r
-\r
-EXPORTS\r
-    ; Explicit exports can go here\r
-       Synapse_EnumerateInterfaces @1\r
+; bkgrnd2d.def : Declares the module parameters for the DLL.
+
+LIBRARY      "BKGRND2D"
+DESCRIPTION  'BKGRND2D Windows Dynamic Link Library'
+
+EXPORTS
+    ; Explicit exports can go here
+       Synapse_EnumerateInterfaces @1
index 6184245..c1e401c 100644 (file)
-November 25 2003\r
-bkgrnd2d v 0.25 beta for radiant 1.3.13\r
-by SCDS_reyalP (email hellsownpuppy@yahoo.com)\r
-\r
-WARNING:\r
-This is an beta release. It is provided with absolutely NO WARRANTY.\r
-If it turns your data to mush and melts your CPU, don't blame me.\r
-\r
-Overview:\r
-This little plugin allows you to display an image in the the gtkradiant 2d\r
-windows. This is useful for layout sketches, maps made from\r
-existing plans, building geometry based on photgraphs, viewing terrain\r
-alphamaps in relation to your terrain, and so on.\r
-\r
-Installation:\r
-extract the .dll and bitmaps into your gtkradiant/plugins directory, and\r
-restart radiant. Be sure to use directory names, to ensure the bitmaps go\r
-in your plugins/bitmaps directory.\r
-\r
-Uninstallation:\r
-Close radiant, delete the bkgrnd2d.dll from the plugins directory, and \r
-delete the bkgrnd2*.bmp files from the plugins/bitmaps directory.\r
-\r
-User Interface:\r
-- The plugin adds 4 buttons to the radiant plugin toolbar. The first 3\r
-  toggle the display of a background image in the specified view. The fourth\r
-  brings up a configuration dialog. The configuration dialog can also be\r
-  opened from the plugins menu.\r
-\r
-- If an image has not been loaded, or it's display size and location have\r
-  not been set, pushing one of the toggle buttons will bring up the dialog\r
-  with the corresponding page selected.\r
-\r
-- The configuration dialog is non-modal, meaning that you can leave it open\r
-  while you work in radiant. If it gets lost behind another window, clicking\r
-  on the configuration button will bring it to the forground.\r
-\r
-Usage:\r
-- bring up the configuration dialog.\r
-\r
-- Choose the "Browse..." button. This will prompt you for an image file.\r
-  The file *MUST* be inside your basegame directory (baseq3, main, etmain or\r
-  whatever your chosen game uses). The image must be in a format supported by\r
-  the game in use. For q3 based games this is truecolor .jpg, .tga and\r
-  sometimes .png. For q2 this is .wal\r
-\r
-- Use one of the following methods to set the size (in game units) that the\r
-  file is displayed. \r
-  1) select 1 or more brushes or entities and choose "from selection"\r
-     This will use the total dimensions off all selected brushes and entities\r
-        to size the image. \r
-  2) For the X/Y view only, choose 'Size to min/max keys' This will look in\r
-     the worldspawn entity for the keys mapcoordsmins and mapcoordsmaxs (also\r
-        used for ET tracemap generation and command map sizing) and use those\r
-        dimensions to size the image.\r
-\r
-- Use the toggle buttons to show or hide the loaded images. The buttons will\r
-  press or unpress whenever you click them, but an image will only be\r
-  displayed once you have successfully loaded a file and set its size/postion.\r
-\r
-- Set the opacity of the image using the slider in the configuration dialog.\r
-  \r
-- If any of these commands do not produce the expected results, there may be\r
-  an information in the radiant console. Please include this when reporting\r
-  bugs.\r
-\r
-\r
-Notes and limitations:\r
-- This plugin is compiled for GtkRadiant 1.3.13. It may or may not work with\r
-  later versions. It will *NOT* work with version 1.3.12 and below. If you\r
-  build from source (see below) you can build it for other versions.\r
-\r
-- As mentioned above, the image *MUST* be inside your basegame directory, or \r
-  another directory in which radiant looks for game files.\r
-\r
-- To prevent the image from being distorted, you should size it to the\r
-  original images aspect ratio. mapcoordsmaxs/mapcoordsmins and command maps\r
-  should always be square.\r
-\r
-- If you want a specific pixel to world unit relationship, you must arrange\r
-  that yourself.\r
-\r
-- On load, the image is converted to a texture whose dimensions are powers\r
-  of 2. If the original image dimensions are not powers of 2, some detail will\r
-  be lost due to resampling. If it is too large to fit on a single texture,\r
-  resolution is reduced.\r
-\r
-- radiants gamma and mipmap options are applied to the image.\r
-\r
-- If the image has an alpha channel, it will be included in the blending\r
-  process. 0 is transparent, 255 is opaque. .tga images are recommended if\r
-  you want to have an alpha channel.\r
-\r
-- since the plugin will only use true color files, you cannot use a terrain\r
-  indexmap (aka alphamap) or heightmap directly. You can of course, save a\r
-  copy of your indexmap in a 32 bit format.\r
-\r
-- There is no unload command.\r
-\r
-- You put the plugin in a game specific plugin directory, rather than the\r
-  radiant plugin directory. \r
-\r
-- You cannot set the image size with sub-unit precision.\r
-\r
-- Only win32 binaries are included.  The source is available from:\r
-  http://www.cyberonic.net/~gdevault/rfm/mapstuff/bkgrnd2d-b0.25-src.zip\r
-  If you want to use it on another platform you will need a buildable gtkradiant\r
-  source tree to build it. For any non-windows platform you will also have to\r
-  figure out the compile options. I suggest ripping those off from some other\r
-  plugin.\r
-\r
-TODO:\r
-- make file selection paterns match supported filetypes\r
-- large images without downsampling\r
-- bitmap and pcx support for indexmaps\r
-- automatic size from indexmapped entities\r
-- render under the grid instead of blending\r
-- mac/*nix support\r
-- remember/save/restore settings\r
-- texture options independant of radiant prefs\r
-- clean up icky code\r
-\r
-Changes from 0.1\r
-- all 2d views supported\r
-- new ui\r
-- file selection patterns, default directory improved\r
-\r
-Changes from 0.2\r
-- tooltips in dialog\r
-- various code cleanup\r
-\r
+November 25 2003
+bkgrnd2d v 0.25 beta for radiant 1.3.13
+by SCDS_reyalP (email hellsownpuppy@yahoo.com)
+
+WARNING:
+This is an beta release. It is provided with absolutely NO WARRANTY.
+If it turns your data to mush and melts your CPU, don't blame me.
+
+Overview:
+This little plugin allows you to display an image in the the gtkradiant 2d
+windows. This is useful for layout sketches, maps made from
+existing plans, building geometry based on photgraphs, viewing terrain
+alphamaps in relation to your terrain, and so on.
+
+Installation:
+extract the .dll and bitmaps into your gtkradiant/plugins directory, and
+restart radiant. Be sure to use directory names, to ensure the bitmaps go
+in your plugins/bitmaps directory.
+
+Uninstallation:
+Close radiant, delete the bkgrnd2d.dll from the plugins directory, and 
+delete the bkgrnd2*.bmp files from the plugins/bitmaps directory.
+
+User Interface:
+- The plugin adds 4 buttons to the radiant plugin toolbar. The first 3
+  toggle the display of a background image in the specified view. The fourth
+  brings up a configuration dialog. The configuration dialog can also be
+  opened from the plugins menu.
+
+- If an image has not been loaded, or it's display size and location have
+  not been set, pushing one of the toggle buttons will bring up the dialog
+  with the corresponding page selected.
+
+- The configuration dialog is non-modal, meaning that you can leave it open
+  while you work in radiant. If it gets lost behind another window, clicking
+  on the configuration button will bring it to the forground.
+
+Usage:
+- bring up the configuration dialog.
+
+- Choose the "Browse..." button. This will prompt you for an image file.
+  The file *MUST* be inside your basegame directory (baseq3, main, etmain or
+  whatever your chosen game uses). The image must be in a format supported by
+  the game in use. For q3 based games this is truecolor .jpg, .tga and
+  sometimes .png. For q2 this is .wal
+
+- Use one of the following methods to set the size (in game units) that the
+  file is displayed. 
+  1) select 1 or more brushes or entities and choose "from selection"
+     This will use the total dimensions off all selected brushes and entities
+        to size the image. 
+  2) For the X/Y view only, choose 'Size to min/max keys' This will look in
+     the worldspawn entity for the keys mapcoordsmins and mapcoordsmaxs (also
+        used for ET tracemap generation and command map sizing) and use those
+        dimensions to size the image.
+
+- Use the toggle buttons to show or hide the loaded images. The buttons will
+  press or unpress whenever you click them, but an image will only be
+  displayed once you have successfully loaded a file and set its size/postion.
+
+- Set the opacity of the image using the slider in the configuration dialog.
+  
+- If any of these commands do not produce the expected results, there may be
+  an information in the radiant console. Please include this when reporting
+  bugs.
+
+
+Notes and limitations:
+- This plugin is compiled for GtkRadiant 1.3.13. It may or may not work with
+  later versions. It will *NOT* work with version 1.3.12 and below. If you
+  build from source (see below) you can build it for other versions.
+
+- As mentioned above, the image *MUST* be inside your basegame directory, or 
+  another directory in which radiant looks for game files.
+
+- To prevent the image from being distorted, you should size it to the
+  original images aspect ratio. mapcoordsmaxs/mapcoordsmins and command maps
+  should always be square.
+
+- If you want a specific pixel to world unit relationship, you must arrange
+  that yourself.
+
+- On load, the image is converted to a texture whose dimensions are powers
+  of 2. If the original image dimensions are not powers of 2, some detail will
+  be lost due to resampling. If it is too large to fit on a single texture,
+  resolution is reduced.
+
+- radiants gamma and mipmap options are applied to the image.
+
+- If the image has an alpha channel, it will be included in the blending
+  process. 0 is transparent, 255 is opaque. .tga images are recommended if
+  you want to have an alpha channel.
+
+- since the plugin will only use true color files, you cannot use a terrain
+  indexmap (aka alphamap) or heightmap directly. You can of course, save a
+  copy of your indexmap in a 32 bit format.
+
+- There is no unload command.
+
+- You put the plugin in a game specific plugin directory, rather than the
+  radiant plugin directory. 
+
+- You cannot set the image size with sub-unit precision.
+
+- Only win32 binaries are included.  The source is available from:
+  http://www.cyberonic.net/~gdevault/rfm/mapstuff/bkgrnd2d-b0.25-src.zip
+  If you want to use it on another platform you will need a buildable gtkradiant
+  source tree to build it. For any non-windows platform you will also have to
+  figure out the compile options. I suggest ripping those off from some other
+  plugin.
+
+TODO:
+- make file selection paterns match supported filetypes
+- large images without downsampling
+- bitmap and pcx support for indexmaps
+- automatic size from indexmapped entities
+- render under the grid instead of blending
+- mac/*nix support
+- remember/save/restore settings
+- texture options independant of radiant prefs
+- clean up icky code
+
+Changes from 0.1
+- all 2d views supported
+- new ui
+- file selection patterns, default directory improved
+
+Changes from 0.2
+- tooltips in dialog
+- various code cleanup
+
index 44d97f3..2174016 100644 (file)
@@ -1,7 +1,7 @@
-; brushexport.def : Declares the module parameters for the DLL.\r
-\r
-LIBRARY      "BRUSHEXPORT"\r
-\r
-EXPORTS\r
-    ; Explicit exports can go here\r
-       Radiant_RegisterModules @1\r
+; brushexport.def : Declares the module parameters for the DLL.
+
+LIBRARY      "BRUSHEXPORT"
+
+EXPORTS
+    ; Explicit exports can go here
+       Radiant_RegisterModules @1
index 9939681..da0faa1 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
-Copyright (C) 2006, Thomas Nitschke.\r
-All Rights Reserved.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#if !defined(INCLUDED_BRUSH_EXPORT_H)\r
-#define INCLUDED_BRUSH_EXPORT_H\r
-\r
-#endif\r
+/*
+Copyright (C) 2006, Thomas Nitschke.
+All Rights Reserved.
+
+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 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
+*/
+
+#if !defined(INCLUDED_BRUSH_EXPORT_H)
+#define INCLUDED_BRUSH_EXPORT_H
+
+#endif
index facb382..6554790 100644 (file)
-/*\r
-Copyright (C) 2006, Stefan Greven.\r
-All Rights Reserved.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#include "shaderplug.h"\r
-\r
-#include "debugging/debugging.h"\r
-\r
-#include <string>\r
-#include <vector>\r
-#include "string/string.h"\r
-#include "modulesystem/singletonmodule.h"\r
-#include "stream/stringstream.h"\r
-#include "os/file.h"\r
-\r
-#include <gtk/gtk.h>\r
-\r
-#include "iplugin.h"\r
-#include "qerplugin.h"\r
-#include "ifilesystem.h"\r
-#include "iarchive.h"\r
-#include "ishaders.h"\r
-#include "iscriplib.h"\r
-\r
-#include "generic/callback.h"\r
-\r
-namespace {\r
-const char SHADERTAG_FILE[] = "shadertags.xml";\r
-}\r
-\r
-class ShaderPlugPluginDependencies : public GlobalRadiantModuleRef,\r
-                                     public GlobalFileSystemModuleRef,\r
-                                     public GlobalShadersModuleRef\r
-{\r
-public:\r
-  ShaderPlugPluginDependencies() :\r
-      GlobalShadersModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("shaders"))\r
-  {\r
-  }\r
-};\r
-\r
-namespace Shaderplug\r
-{\r
-  GtkWindow* g_window;\r
-\r
-  std::vector<const char*> archives;\r
-  std::set<std::string> shaders;\r
-  std::set<std::string> textures;\r
-\r
-  XmlTagBuilder TagBuilder;\r
-  void CreateTagFile();\r
-\r
-  const char* init(void* hApp, void* pMainWidget)\r
-  {\r
-    g_window = GTK_WINDOW(pMainWidget);\r
-    return "";\r
-  }\r
-  const char* getName()\r
-  {\r
-    return "ShaderPlug";\r
-  }\r
-  const char* getCommandList()\r
-  {\r
-    return "About;Create tag file";\r
-  }\r
-  const char* getCommandTitleList()\r
-  {\r
-    return "";\r
-  }\r
-  void dispatch(const char* command, float* vMin, float* vMax, bool bSingleBrush)\r
-  {\r
-    if(string_equal(command, "About"))\r
-    {\r
-      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), "Shaderplug (1.0)\n\n"\r
-                                        "by Shaderman (shaderman@gmx.net)",\r
-                                        "About",\r
-                                        eMB_OK,\r
-                                        eMB_ICONDEFAULT);\r
-    }\r
-    if(string_equal(command, "Create tag file"))\r
-    {\r
-      CreateTagFile();\r
-    }\r
-  }\r
-\r
-  void loadArchiveFile(const char* filename)\r
-  {\r
-    archives.push_back(filename);\r
-  }\r
-\r
-  typedef FreeCaller1<const char*, loadArchiveFile> LoadArchiveFileCaller;\r
-\r
-  void LoadTextureFile(const char* filename)\r
-  {\r
-    std::string s_filename = filename;\r
-\r
-    char buffer[256];\r
-    strcpy(buffer, "textures/");\r
-\r
-    // append filename without trailing file extension (.tga or .jpg for example)\r
-    strncat(buffer, filename, s_filename.length() - 4);\r
-\r
-    std::set<std::string>::iterator iter;\r
-    iter = shaders.find(buffer);\r
-\r
-    // a shader with this name already exists\r
-    if(iter == shaders.end())\r
-    {\r
-      textures.insert(buffer);\r
-    }\r
-  }\r
-\r
-  typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller;\r
-\r
-  void GetTextures(char* extension)\r
-  {\r
-    GlobalFileSystem().forEachFile("textures/", extension, LoadTextureFileCaller(), 0);\r
-  }\r
-\r
-  void LoadShaderList(const char* filename)\r
-  {\r
-    if(string_equal_prefix(filename, "textures/"))\r
-    {\r
-      shaders.insert(filename);\r
-    }\r
-  }\r
-\r
-  typedef FreeCaller1<const char*, LoadShaderList> LoadShaderListCaller;\r
-\r
-  void GetAllShaders()\r
-  {\r
-    GlobalShaderSystem().foreachShaderName(LoadShaderListCaller());\r
-  }\r
-\r
-  void GetArchiveList()\r
-  {\r
-    GlobalFileSystem().forEachArchive(LoadArchiveFileCaller());\r
-    globalOutputStream() << "Shaderplug: " << (const Unsigned)Shaderplug::archives.size() << " archives found.\n";\r
-  }\r
-\r
-  void CreateTagFile()\r
-  {\r
-    const char* shader_type = GlobalRadiant().getGameDescriptionKeyValue("shaders");\r
-\r
-    GetAllShaders();\r
-    globalOutputStream() << "Shaderplug: " << (const Unsigned)shaders.size() << " shaders found.\n";\r
-\r
-    if(string_equal(shader_type, "quake3"))\r
-    {\r
-      GetTextures("jpg");\r
-      GetTextures("tga");\r
-      GetTextures("png");\r
-\r
-      globalOutputStream() << "Shaderplug: " << (const Unsigned)textures.size() << " textures found.\n";\r
-    }\r
-\r
-    if(shaders.size() || textures.size() != 0)\r
-    {\r
-      globalOutputStream() << "Shaderplug: Creating XML tag file.\n";\r
-\r
-      TagBuilder.CreateXmlDocument();\r
-\r
-      std::set<std::string>::reverse_iterator r_iter;\r
-\r
-      for(r_iter = textures.rbegin(); r_iter != textures.rend(); ++r_iter)\r
-      {\r
-        TagBuilder.AddShaderNode(const_cast<char*>((*r_iter).c_str()), STOCK, TEXTURE);\r
-      }\r
-\r
-      for(r_iter = shaders.rbegin(); r_iter != shaders.rend(); ++r_iter)\r
-      {\r
-        TagBuilder.AddShaderNode(const_cast<char*>((*r_iter).c_str()), STOCK, SHADER);\r
-      }\r
-\r
-      // Get the tag file        \r
-      StringOutputStream tagFileStream(256);\r
-         tagFileStream << GlobalRadiant().getLocalRcPath() << SHADERTAG_FILE;\r
-      char* tagFile = tagFileStream.c_str();\r
-\r
-      char message[256];\r
-      strcpy(message, "Tag file saved to\n");\r
-      strcat(message, tagFile);\r
-      strcat(message, "\nPlease restart Radiant now.\n");\r
-\r
-      if(file_exists(tagFile))\r
-      {\r
-        EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window),\r
-            "WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",\r
-            eMB_NOYES,\r
-            eMB_ICONWARNING);\r
-\r
-        if(result == eIDYES)\r
-        {\r
-          TagBuilder.SaveXmlDoc(tagFile);\r
-          GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), message, "INFO", eMB_OK, eMB_ICONASTERISK);\r
-        }\r
-      } else {\r
-        TagBuilder.SaveXmlDoc(tagFile);\r
-        GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), message, "INFO", eMB_OK, eMB_ICONASTERISK);\r
-      }\r
-    } else {\r
-      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window),\r
-          "No shaders or textures found. No XML tag file created!\n"\r
-          "",\r
-          "ERROR",\r
-          eMB_OK,\r
-          eMB_ICONERROR);\r
-    }\r
-  }\r
-} // namespace\r
-\r
-class ShaderPluginModule\r
-{\r
-  _QERPluginTable m_plugin;\r
-public:\r
-  typedef _QERPluginTable Type;\r
-  STRING_CONSTANT(Name, "ShaderPlug");\r
-\r
-  ShaderPluginModule()\r
-  {\r
-    m_plugin.m_pfnQERPlug_Init = &Shaderplug::init;\r
-    m_plugin.m_pfnQERPlug_GetName = &Shaderplug::getName;\r
-    m_plugin.m_pfnQERPlug_GetCommandList = &Shaderplug::getCommandList;\r
-    m_plugin.m_pfnQERPlug_GetCommandTitleList = &Shaderplug::getCommandTitleList;\r
-    m_plugin.m_pfnQERPlug_Dispatch = &Shaderplug::dispatch;\r
-  }\r
-  _QERPluginTable* getTable()\r
-  {\r
-    return &m_plugin;\r
-  }\r
-};\r
-\r
-typedef SingletonModule<ShaderPluginModule, ShaderPlugPluginDependencies> SingletonShaderPluginModule;\r
-\r
-SingletonShaderPluginModule g_ShaderPluginModule;\r
-\r
-extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)\r
-{\r
-  initialiseModule(server);\r
-\r
-  g_ShaderPluginModule.selfRegister();\r
-}\r
-\r
-\r
-\r
-\r
+/*
+Copyright (C) 2006, Stefan Greven.
+All Rights Reserved.
+
+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 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
+*/
+
+#include "shaderplug.h"
+
+#include "debugging/debugging.h"
+
+#include <string>
+#include <vector>
+#include "string/string.h"
+#include "modulesystem/singletonmodule.h"
+#include "stream/stringstream.h"
+#include "os/file.h"
+
+#include <gtk/gtk.h>
+
+#include "iplugin.h"
+#include "qerplugin.h"
+#include "ifilesystem.h"
+#include "iarchive.h"
+#include "ishaders.h"
+#include "iscriplib.h"
+
+#include "generic/callback.h"
+
+namespace {
+const char SHADERTAG_FILE[] = "shadertags.xml";
+}
+
+class ShaderPlugPluginDependencies : public GlobalRadiantModuleRef,
+                                     public GlobalFileSystemModuleRef,
+                                     public GlobalShadersModuleRef
+{
+public:
+  ShaderPlugPluginDependencies() :
+      GlobalShadersModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("shaders"))
+  {
+  }
+};
+
+namespace Shaderplug
+{
+  GtkWindow* g_window;
+
+  std::vector<const char*> archives;
+  std::set<std::string> shaders;
+  std::set<std::string> textures;
+
+  XmlTagBuilder TagBuilder;
+  void CreateTagFile();
+
+  const char* init(void* hApp, void* pMainWidget)
+  {
+    g_window = GTK_WINDOW(pMainWidget);
+    return "";
+  }
+  const char* getName()
+  {
+    return "ShaderPlug";
+  }
+  const char* getCommandList()
+  {
+    return "About;Create tag file";
+  }
+  const char* getCommandTitleList()
+  {
+    return "";
+  }
+  void dispatch(const char* command, float* vMin, float* vMax, bool bSingleBrush)
+  {
+    if(string_equal(command, "About"))
+    {
+      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), "Shaderplug (1.0)\n\n"
+                                        "by Shaderman (shaderman@gmx.net)",
+                                        "About",
+                                        eMB_OK,
+                                        eMB_ICONDEFAULT);
+    }
+    if(string_equal(command, "Create tag file"))
+    {
+      CreateTagFile();
+    }
+  }
+
+  void loadArchiveFile(const char* filename)
+  {
+    archives.push_back(filename);
+  }
+
+  typedef FreeCaller1<const char*, loadArchiveFile> LoadArchiveFileCaller;
+
+  void LoadTextureFile(const char* filename)
+  {
+    std::string s_filename = filename;
+
+    char buffer[256];
+    strcpy(buffer, "textures/");
+
+    // append filename without trailing file extension (.tga or .jpg for example)
+    strncat(buffer, filename, s_filename.length() - 4);
+
+    std::set<std::string>::iterator iter;
+    iter = shaders.find(buffer);
+
+    // a shader with this name already exists
+    if(iter == shaders.end())
+    {
+      textures.insert(buffer);
+    }
+  }
+
+  typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller;
+
+  void GetTextures(char* extension)
+  {
+    GlobalFileSystem().forEachFile("textures/", extension, LoadTextureFileCaller(), 0);
+  }
+
+  void LoadShaderList(const char* filename)
+  {
+    if(string_equal_prefix(filename, "textures/"))
+    {
+      shaders.insert(filename);
+    }
+  }
+
+  typedef FreeCaller1<const char*, LoadShaderList> LoadShaderListCaller;
+
+  void GetAllShaders()
+  {
+    GlobalShaderSystem().foreachShaderName(LoadShaderListCaller());
+  }
+
+  void GetArchiveList()
+  {
+    GlobalFileSystem().forEachArchive(LoadArchiveFileCaller());
+    globalOutputStream() << "Shaderplug: " << (const Unsigned)Shaderplug::archives.size() << " archives found.\n";
+  }
+
+  void CreateTagFile()
+  {
+    const char* shader_type = GlobalRadiant().getGameDescriptionKeyValue("shaders");
+
+    GetAllShaders();
+    globalOutputStream() << "Shaderplug: " << (const Unsigned)shaders.size() << " shaders found.\n";
+
+    if(string_equal(shader_type, "quake3"))
+    {
+      GetTextures("jpg");
+      GetTextures("tga");
+      GetTextures("png");
+
+      globalOutputStream() << "Shaderplug: " << (const Unsigned)textures.size() << " textures found.\n";
+    }
+
+    if(shaders.size() || textures.size() != 0)
+    {
+      globalOutputStream() << "Shaderplug: Creating XML tag file.\n";
+
+      TagBuilder.CreateXmlDocument();
+
+      std::set<std::string>::reverse_iterator r_iter;
+
+      for(r_iter = textures.rbegin(); r_iter != textures.rend(); ++r_iter)
+      {
+        TagBuilder.AddShaderNode(const_cast<char*>((*r_iter).c_str()), STOCK, TEXTURE);
+      }
+
+      for(r_iter = shaders.rbegin(); r_iter != shaders.rend(); ++r_iter)
+      {
+        TagBuilder.AddShaderNode(const_cast<char*>((*r_iter).c_str()), STOCK, SHADER);
+      }
+
+      // Get the tag file        
+      StringOutputStream tagFileStream(256);
+         tagFileStream << GlobalRadiant().getLocalRcPath() << SHADERTAG_FILE;
+      char* tagFile = tagFileStream.c_str();
+
+      char message[256];
+      strcpy(message, "Tag file saved to\n");
+      strcat(message, tagFile);
+      strcat(message, "\nPlease restart Radiant now.\n");
+
+      if(file_exists(tagFile))
+      {
+        EMessageBoxReturn result = GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window),
+            "WARNING! A tag file already exists! Overwrite it?", "Overwrite tag file?",
+            eMB_NOYES,
+            eMB_ICONWARNING);
+
+        if(result == eIDYES)
+        {
+          TagBuilder.SaveXmlDoc(tagFile);
+          GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), message, "INFO", eMB_OK, eMB_ICONASTERISK);
+        }
+      } else {
+        TagBuilder.SaveXmlDoc(tagFile);
+        GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window), message, "INFO", eMB_OK, eMB_ICONASTERISK);
+      }
+    } else {
+      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_window),
+          "No shaders or textures found. No XML tag file created!\n"
+          "",
+          "ERROR",
+          eMB_OK,
+          eMB_ICONERROR);
+    }
+  }
+} // namespace
+
+class ShaderPluginModule
+{
+  _QERPluginTable m_plugin;
+public:
+  typedef _QERPluginTable Type;
+  STRING_CONSTANT(Name, "ShaderPlug");
+
+  ShaderPluginModule()
+  {
+    m_plugin.m_pfnQERPlug_Init = &Shaderplug::init;
+    m_plugin.m_pfnQERPlug_GetName = &Shaderplug::getName;
+    m_plugin.m_pfnQERPlug_GetCommandList = &Shaderplug::getCommandList;
+    m_plugin.m_pfnQERPlug_GetCommandTitleList = &Shaderplug::getCommandTitleList;
+    m_plugin.m_pfnQERPlug_Dispatch = &Shaderplug::dispatch;
+  }
+  _QERPluginTable* getTable()
+  {
+    return &m_plugin;
+  }
+};
+
+typedef SingletonModule<ShaderPluginModule, ShaderPlugPluginDependencies> SingletonShaderPluginModule;
+
+SingletonShaderPluginModule g_ShaderPluginModule;
+
+extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
+{
+  initialiseModule(server);
+
+  g_ShaderPluginModule.selfRegister();
+}
+
+
+
+
index be71ca5..a31ee3b 100644 (file)
@@ -1,7 +1,7 @@
-; shaderplug.def : Declares the module parameters for the DLL.\r
-\r
-LIBRARY      "SHADERPLUG"\r
-\r
-EXPORTS\r
-    ; Explicit exports can go here\r
-       Radiant_RegisterModules @1\r
+; shaderplug.def : Declares the module parameters for the DLL.
+
+LIBRARY      "SHADERPLUG"
+
+EXPORTS
+    ; Explicit exports can go here
+       Radiant_RegisterModules @1
index 4842cc2..7ee45fd 100644 (file)
@@ -1,27 +1,27 @@
-/*\r
-Copyright (C) 2006, Stefan Greven.\r
-All Rights Reserved.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#if !defined(INCLUDED_SHADERPLUG_H)\r
-#define INCLUDED_SHADERPLUG_H\r
-\r
-#include "xml/xmltextags.h"\r
-\r
-#endif\r
+/*
+Copyright (C) 2006, Stefan Greven.
+All Rights Reserved.
+
+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 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
+*/
+
+#if !defined(INCLUDED_SHADERPLUG_H)
+#define INCLUDED_SHADERPLUG_H
+
+#include "xml/xmltextags.h"
+
+#endif
index b3e33b1..fa00542 100644 (file)
-/*\r
-Sunplug plugin for GtkRadiant\r
-Copyright (C) 2004 Topsun\r
-Thanks to SPoG for help!\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-*/\r
-\r
-#include "sunplug.h"\r
-\r
-#include "debugging/debugging.h"\r
-\r
-#include "iplugin.h"\r
-\r
-#include "string/string.h"\r
-#include "modulesystem/singletonmodule.h"\r
-\r
-#include "iundo.h"       // declaration of undo system\r
-#include "ientity.h"     // declaration of entity system\r
-#include "iscenegraph.h" // declaration of datastructure of the map\r
-\r
-#include "scenelib.h"    // declaration of datastructure of the map\r
-#include "qerplugin.h"   // declaration to use other interfaces as a plugin\r
-\r
-#include <gtk/gtk.h>     // to display something with gtk (windows, buttons etc.), the whole package might not be necessary\r
-\r
-void about_plugin_window();\r
-void MapCoordinator();\r
-\r
-#ifndef _WIN32\r
-// linux itoa implementation\r
-char* itoa( int value, char* result, int base )\r
-{      \r
-       // check that the base if valid\r
-       if (base < 2 || base > 16)\r
-       {\r
-         *result = 0;\r
-         return result;\r
-       }\r
-       \r
-       char* out = result;\r
-       int quotient = value;\r
-       \r
-       do\r
-       {\r
-               *out = "0123456789abcdef"[abs(quotient % base)];\r
-               ++out;\r
-       \r
-               quotient /= base;\r
-       } while (quotient);\r
-       \r
-       // Only apply negative sign for base 10\r
-       if( value < 0 && base == 10)\r
-         *out++ = '-';\r
-       \r
-       std::reverse(result, out);\r
-       \r
-       *out = 0;\r
-       return result;\r
-}\r
-#endif\r
-\r
-typedef struct _mapcoord_setting_packet {\r
-  GtkSpinButton *spinner1, *spinner2, *spinner3, *spinner4;\r
-  Entity* worldspawn;\r
-} mapcoord_setting_packet;\r
-\r
-static int map_minX, map_maxX, map_minY, map_maxY;\r
-static int minX, maxX, minY, maxY;\r
-mapcoord_setting_packet msp;\r
-\r
-//  **************************\r
-// ** find entities by class **  from radiant/map.cpp\r
-//  **************************\r
-class EntityFindByClassname : public scene::Graph::Walker\r
-{\r
-  const char* m_name;\r
-  Entity*& m_entity;\r
-public:\r
-  EntityFindByClassname(const char* name, Entity*& entity) : m_name(name), m_entity(entity)\r
-  {\r
-    m_entity = 0;\r
-  }\r
-  bool pre(const scene::Path& path, scene::Instance& instance) const\r
-  {\r
-    if(m_entity == 0)\r
-    {\r
-      Entity* entity = Node_getEntity(path.top());\r
-      if(entity != 0\r
-        && string_equal(m_name, entity->getKeyValue("classname")))\r
-      {\r
-        m_entity = entity;\r
-      }\r
-    }\r
-    return true;\r
-  }\r
-};\r
-\r
-Entity* Scene_FindEntityByClass(const char* name)\r
-{\r
-  Entity* entity;\r
-  GlobalSceneGraph().traverse(EntityFindByClassname(name, entity));\r
-  return entity;\r
-}\r
-\r
-//  **************************\r
-// ** GTK callback functions **\r
-//  **************************\r
-\r
-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)\r
-{\r
-  /* If you return FALSE in the "delete_event" signal handler,\r
-   * GTK will emit the "destroy" signal. Returning TRUE means\r
-   * you don't want the window to be destroyed.\r
-   * This is useful for popping up 'are you sure you want to quit?'\r
-   * type dialogs. */\r
-\r
-  return FALSE;\r
-}\r
-\r
-// destroy widget if destroy signal is passed to widget\r
-static void destroy(GtkWidget *widget, gpointer data)\r
-{\r
-  gtk_widget_destroy(widget);\r
-}\r
-\r
-// function for close button to destroy the toplevel widget\r
-static void close_window(GtkWidget *widget, gpointer data)\r
-{\r
-  gtk_widget_destroy(gtk_widget_get_toplevel(widget));\r
-}\r
-\r
-// callback function to assign the optimal mapcoords to the spinboxes\r
-static void input_optimal(GtkWidget *widget, gpointer data)\r
-{\r
-  gtk_spin_button_set_value(msp.spinner1, minX);\r
-  gtk_spin_button_set_value(msp.spinner2, maxY);\r
-  gtk_spin_button_set_value(msp.spinner3, maxX);\r
-  gtk_spin_button_set_value(msp.spinner4, minY);\r
-}\r
-\r
-// Spinner return value function\r
-gint grab_int_value(GtkSpinButton *a_spinner, gpointer user_data) {\r
-  return gtk_spin_button_get_value_as_int(a_spinner);\r
-}\r
-\r
-// write the values of the Spinner-Boxes to the worldspawn\r
-static void set_coordinates(GtkWidget *widget, gpointer data)\r
-{\r
-  //Str str_min, str_max;\r
-  char buffer[10], str_min[20], str_max[20];\r
-\r
-  itoa(gtk_spin_button_get_value_as_int(msp.spinner1), str_min, 10);\r
-  itoa(gtk_spin_button_get_value_as_int(msp.spinner2), buffer, 10);\r
-  strcat(str_min, " ");\r
-  strcat(str_min, buffer);\r
-  msp.worldspawn->setKeyValue("mapcoordsmins", str_min);\r
-\r
-  itoa(gtk_spin_button_get_value_as_int(msp.spinner3), str_max, 10);\r
-  itoa(gtk_spin_button_get_value_as_int(msp.spinner4), buffer, 10);\r
-  strcat(str_max, " ");\r
-  strcat(str_max, buffer);\r
-  UndoableCommand undo("SunPlug.entitySetMapcoords");\r
-  msp.worldspawn->setKeyValue("mapcoordsmaxs", str_max);\r
-\r
-  close_window(widget, NULL);\r
-}\r
-\r
-class SunPlugPluginDependencies :\r
-  public GlobalRadiantModuleRef,    // basic class for all other module refs\r
-  public GlobalUndoModuleRef,       // used to say radiant that something has changed and to undo that\r
-  public GlobalSceneGraphModuleRef, // necessary to handle data in the mapfile (change, retrieve data)\r
-  public GlobalEntityModuleRef      // to access and modify the entities\r
-{\r
-public:\r
-  SunPlugPluginDependencies() :\r
-    GlobalEntityModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entities"))//,\r
-  {\r
-  }\r
-};\r
-\r
-//  *************************\r
-// ** standard plugin stuff **\r
-//  *************************\r
-namespace SunPlug\r
-{\r
-  GtkWindow* main_window;\r
-  char MenuList[100] = "";\r
-\r
-  const char* init(void* hApp, void* pMainWidget)\r
-  {\r
-    main_window = GTK_WINDOW(pMainWidget);\r
-    return "Initializing SunPlug for GTKRadiant";\r
-  }\r
-  const char* getName()\r
-  {\r
-    return "SunPlug"; // name that is shown in the menue\r
-  }\r
-  const char* getCommandList()\r
-  {\r
-    const char about[] = "About...";\r
-    const char etMapCoordinator[] = ";ET-MapCoordinator";\r
-\r
-    strcat(MenuList, about);\r
-    if (strncmp(GlobalRadiant().getGameName(), "etmain", 6) == 0) strcat(MenuList, etMapCoordinator);\r
-    return (const char*)MenuList;\r
-  }\r
-  const char* getCommandTitleList()\r
-  {\r
-    return "";\r
-  }\r
-  void dispatch(const char* command, float* vMin, float* vMax, bool bSingleBrush) // message processing\r
-  {\r
-    if(string_equal(command, "About..."))\r
-    {\r
-         about_plugin_window();\r
-       }\r
-    if(string_equal(command, "ET-MapCoordinator"))\r
-    {\r
-         MapCoordinator();\r
-    }\r
-  }\r
-} // namespace\r
-\r
-class SunPlugModule : public TypeSystemRef\r
-{\r
-  _QERPluginTable                      m_plugin;\r
-public:\r
-  typedef _QERPluginTable      Type;\r
-  STRING_CONSTANT(Name, "SunPlug");\r
-\r
-  SunPlugModule()\r
-  {\r
-       m_plugin.m_pfnQERPlug_Init = &SunPlug::init;\r
-       m_plugin.m_pfnQERPlug_GetName = &SunPlug::getName;\r
-       m_plugin.m_pfnQERPlug_GetCommandList = &SunPlug::getCommandList;\r
-       m_plugin.m_pfnQERPlug_GetCommandTitleList = &SunPlug::getCommandTitleList;\r
-       m_plugin.m_pfnQERPlug_Dispatch = &SunPlug::dispatch;\r
-  }\r
-  _QERPluginTable* getTable()\r
-  {\r
-    return &m_plugin;\r
-  }\r
-};\r
-\r
-typedef SingletonModule<SunPlugModule, SunPlugPluginDependencies> SingletonSunPlugModule;\r
-\r
-SingletonSunPlugModule g_SunPlugModule;\r
-\r
-\r
-extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)\r
-{\r
-  initialiseModule(server);\r
-\r
-  g_SunPlugModule.selfRegister();\r
-}\r
-\r
-//  ************\r
-// ** my stuff **\r
-//  ************\r
-\r
-// About dialog\r
-void about_plugin_window()\r
-{\r
-    GtkWidget *window, *vbox, *label, *button;\r
-\r
-    window = gtk_window_new(GTK_WINDOW_TOPLEVEL); // create a window\r
-    gtk_window_set_transient_for(GTK_WINDOW(window), SunPlug::main_window); // make the window to stay in front of the main window\r
-    g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); // connect the delete event\r
-    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // connect the destroy event for the window\r
-    gtk_window_set_title(GTK_WINDOW(window), "About SunPlug"); // set the title of the window for the window\r
-    gtk_window_set_resizable(GTK_WINDOW(window), FALSE); // don't let the user resize the window\r
-    gtk_window_set_modal(GTK_WINDOW(window), TRUE); // force the user not to do something with the other windows\r
-    gtk_container_set_border_width(GTK_CONTAINER(window), 10); // set the border of the window\r
-\r
-    vbox = gtk_vbox_new(FALSE, 10); // create a box to arrange new objects vertically\r
-    gtk_container_add(GTK_CONTAINER(window), vbox); // add the box to the window\r
-\r
-    label = gtk_label_new("SunPlug v1.0 for NetRadiant 1.5\nby Topsun"); // create a label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // text align left\r
-    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2); // insert the label in the box\r
-\r
-    button = gtk_button_new_with_label("OK"); // create a button with text\r
-    g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK (gtk_widget_destroy), window); // connect the click event to close the window\r
-    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert the button in the box\r
-\r
-    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); // center the window on screen\r
-\r
-    gtk_widget_show_all(window); // show the window and all subelements\r
-}\r
-\r
-// get the current bounding box and return the optimal coordinates\r
-void GetOptimalCoordinates(AABB *levelBoundingBox)\r
-{\r
-  int half_width, half_heigth, center_x, center_y;\r
-\r
-  half_width = levelBoundingBox->extents.x();\r
-  half_heigth = levelBoundingBox->extents.y();\r
-  center_x = levelBoundingBox->origin.x();\r
-  center_y = levelBoundingBox->origin.y();\r
-\r
-  if (half_width > 175 || half_heigth > 175) // the square must be at least 350x350 units\r
-  {\r
-    // the wider side is the indicator for the square\r
-    if (half_width >= half_heigth)\r
-    {\r
-         minX = center_x - half_width;\r
-      maxX = center_x + half_width;\r
-      minY = center_y - half_width;\r
-      maxY = center_y + half_width;\r
-    } else {\r
-      minX = center_x - half_heigth;\r
-      maxX = center_x + half_heigth;\r
-         minY = center_y - half_heigth;\r
-      maxY = center_y + half_heigth;\r
-    }\r
-  } else {\r
-    minX = center_x - 175;\r
-    maxX = center_x + 175;\r
-    minY = center_y - 175;\r
-    maxY = center_y + 175;\r
-  }\r
-}\r
-\r
-// MapCoordinator dialog window\r
-void MapCoordinator()\r
-{\r
-  GtkWidget *window, *vbox, *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;\r
-  GtkAdjustment *spinner_adj_MinX, *spinner_adj_MinY, *spinner_adj_MaxX, *spinner_adj_MaxY;\r
-  Entity *theWorldspawn = NULL;\r
-  const char *buffer;\r
-  char line[20];\r
-\r
-  // in any case we need a window to show the user what to do\r
-  window = gtk_window_new(GTK_WINDOW_TOPLEVEL); // create the window\r
-  gtk_window_set_transient_for(GTK_WINDOW(window), SunPlug::main_window); // make the window to stay in front of the main window\r
-  g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); // connect the delete event for the window\r
-  g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // connect the destroy event for the window\r
-  gtk_window_set_title(GTK_WINDOW(window), "ET-MapCoordinator"); // set the title of the window for the window\r
-  gtk_window_set_resizable(GTK_WINDOW(window), FALSE); // don't let the user resize the window\r
-  gtk_window_set_modal(GTK_WINDOW(window), TRUE); // force the user not to do something with the other windows\r
-  gtk_container_set_border_width(GTK_CONTAINER(window), 10); // set the border of the window\r
-\r
-  vbox = gtk_vbox_new(FALSE, 10); // create a box to arrange new objects vertically\r
-  gtk_container_add(GTK_CONTAINER(window), vbox); // add the box to the window\r
-\r
-  scene::Path path = makeReference(GlobalSceneGraph().root()); // get the path to the root element of the graph\r
-  scene::Instance* instance = GlobalSceneGraph().find(path); // find the instance to the given path\r
-  AABB levelBoundingBox = instance->worldAABB(); // get the bounding box of the level\r
-\r
-  theWorldspawn = Scene_FindEntityByClass("worldspawn"); // find the entity worldspawn\r
-  if (theWorldspawn != 0) { // need to have a worldspawn otherwise setting a value crashes the radiant\r
-    // next two if's: get the current values of the mapcoords\r
-    buffer = theWorldspawn->getKeyValue("mapcoordsmins"); // upper left corner\r
-       if (strlen(buffer) > 0) {\r
-      strncpy(line, buffer, 19);\r
-      map_minX = atoi(strtok(line, " ")); // minimum of x value\r
-      map_minY = atoi(strtok(NULL, " ")); // maximum of y value\r
-       } else {\r
-               map_minX = 0;\r
-               map_minY = 0;\r
-       }\r
-    buffer = theWorldspawn->getKeyValue("mapcoordsmaxs"); // lower right corner\r
-       if (strlen(buffer) > 0) {\r
-         strncpy(line, buffer, 19);\r
-      map_maxX = atoi(strtok(line, " ")); // maximum of x value\r
-      map_maxY = atoi(strtok(NULL, " ")); // minimum of y value\r
-       } else {\r
-               map_maxX = 0;\r
-               map_maxY = 0;\r
-       }\r
-\r
-    globalOutputStream() << "SunPlug: calculating optimal coordinates\n"; // write to console that we are calculating the coordinates\r
-    GetOptimalCoordinates(&levelBoundingBox); // calculate optimal mapcoords with the dimensions of the level bounding box\r
-    globalOutputStream() << "SunPlug: adviced mapcoordsmins=" << minX << " " << maxY << "\n"; // console info about mapcoordsmins\r
-    globalOutputStream() << "SunPlug: adviced mapcoordsmaxs=" << maxX << " " << minY << "\n"; // console info about mapcoordsmaxs\r
-\r
-    spinner_adj_MinX = (GtkAdjustment *)gtk_adjustment_new(map_minX, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of minimum x value\r
-    spinner_adj_MinY = (GtkAdjustment *)gtk_adjustment_new(map_minY, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of minimum y value\r
-    spinner_adj_MaxX = (GtkAdjustment *)gtk_adjustment_new(map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of maximum x value\r
-    spinner_adj_MaxY = (GtkAdjustment *)gtk_adjustment_new(map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of maximum y value\r
\r
-    button = gtk_button_new_with_label("Get optimal mapcoords"); // create button with text\r
-    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(input_optimal), NULL); // connect button with callback function\r
-    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert button into vbox\r
-\r
-    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 2); // insert separator into vbox\r
-\r
-    table = gtk_table_new(4, 3, TRUE); // create table\r
-    gtk_table_set_row_spacings(GTK_TABLE(table), 8); // set row spacings\r
-    gtk_table_set_col_spacings(GTK_TABLE(table), 8); // set column spacings\r
-    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 2); // insert table into vbox\r
-\r
-    label = gtk_label_new("x"); // create label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side\r
-    gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1); // insert label into table\r
-\r
-    label = gtk_label_new("y"); // create label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side\r
-    gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 0, 1); // insert label into table\r
-\r
-    label = gtk_label_new("mapcoordsmins"); // create label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side\r
-    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); // insert label into table\r
-\r
-    spinnerMinX = gtk_spin_button_new(spinner_adj_MinX, 1.0, 0); // create textbox wiht value spin, value and value range\r
-    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMinX, 1, 2, 1, 2); // insert spinbox into table\r
-\r
-    spinnerMinY = gtk_spin_button_new(spinner_adj_MinY, 1.0, 0); // create textbox wiht value spin, value and value range\r
-    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMinY, 2, 3, 1, 2); // insert spinbox into table\r
-\r
-    label = gtk_label_new("mapcoordsmaxs"); // create label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side\r
-    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); // insert label into table\r
-\r
-    spinnerMaxX = gtk_spin_button_new(spinner_adj_MaxX, 1.0, 0); // create textbox wiht value spin, value and value range\r
-    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMaxX, 1, 2, 2, 3); // insert spinbox into table\r
-\r
-    spinnerMaxY = gtk_spin_button_new(spinner_adj_MaxY, 1.0, 0); // create textbox wiht value spin, value and value range\r
-    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMaxY, 2, 3, 2, 3); // insert spinbox into table\r
-\r
-    // put the references to the spinboxes and the worldspawn into the global exchange\r
-    msp.spinner1 = GTK_SPIN_BUTTON(spinnerMinX);\r
-    msp.spinner2 = GTK_SPIN_BUTTON(spinnerMinY);\r
-    msp.spinner3 = GTK_SPIN_BUTTON(spinnerMaxX);\r
-    msp.spinner4 = GTK_SPIN_BUTTON(spinnerMaxY);\r
-    msp.worldspawn = theWorldspawn;\r
-\r
-    button = gtk_button_new_with_label("Set"); // create button with text\r
-    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_coordinates), NULL); // connect button with callback function\r
-    gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 3, 4); // insert button into table\r
-\r
-    button = gtk_button_new_with_label("Cancel"); // create button with text\r
-    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_window), NULL); // connect button with callback function\r
-    gtk_table_attach_defaults(GTK_TABLE(table), button, 2, 3, 3, 4); // insert button into table\r
-  } else {\r
-       globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console\r
-       \r
-       label = gtk_label_new("ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. "); // create a label\r
-    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // text align left\r
-    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2); // insert the label in the box\r
-\r
-    button = gtk_button_new_with_label("OK"); // create a button with text\r
-    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_window), NULL); // connect the click event to close the window\r
-    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert the button in the box\r
-  }\r
-\r
-  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); // center the window\r
-  gtk_widget_show_all(window); // show the window and all subelements\r
-}\r
+/*
+Sunplug plugin for GtkRadiant
+Copyright (C) 2004 Topsun
+Thanks to SPoG for help!
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "sunplug.h"
+
+#include "debugging/debugging.h"
+
+#include "iplugin.h"
+
+#include "string/string.h"
+#include "modulesystem/singletonmodule.h"
+
+#include "iundo.h"       // declaration of undo system
+#include "ientity.h"     // declaration of entity system
+#include "iscenegraph.h" // declaration of datastructure of the map
+
+#include "scenelib.h"    // declaration of datastructure of the map
+#include "qerplugin.h"   // declaration to use other interfaces as a plugin
+
+#include <gtk/gtk.h>     // to display something with gtk (windows, buttons etc.), the whole package might not be necessary
+
+void about_plugin_window();
+void MapCoordinator();
+
+#ifndef _WIN32
+// linux itoa implementation
+char* itoa( int value, char* result, int base )
+{      
+       // check that the base if valid
+       if (base < 2 || base > 16)
+       {
+         *result = 0;
+         return result;
+       }
+       
+       char* out = result;
+       int quotient = value;
+       
+       do
+       {
+               *out = "0123456789abcdef"[abs(quotient % base)];
+               ++out;
+       
+               quotient /= base;
+       } while (quotient);
+       
+       // Only apply negative sign for base 10
+       if( value < 0 && base == 10)
+         *out++ = '-';
+       
+       std::reverse(result, out);
+       
+       *out = 0;
+       return result;
+}
+#endif
+
+typedef struct _mapcoord_setting_packet {
+  GtkSpinButton *spinner1, *spinner2, *spinner3, *spinner4;
+  Entity* worldspawn;
+} mapcoord_setting_packet;
+
+static int map_minX, map_maxX, map_minY, map_maxY;
+static int minX, maxX, minY, maxY;
+mapcoord_setting_packet msp;
+
+//  **************************
+// ** find entities by class **  from radiant/map.cpp
+//  **************************
+class EntityFindByClassname : public scene::Graph::Walker
+{
+  const char* m_name;
+  Entity*& m_entity;
+public:
+  EntityFindByClassname(const char* name, Entity*& entity) : m_name(name), m_entity(entity)
+  {
+    m_entity = 0;
+  }
+  bool pre(const scene::Path& path, scene::Instance& instance) const
+  {
+    if(m_entity == 0)
+    {
+      Entity* entity = Node_getEntity(path.top());
+      if(entity != 0
+        && string_equal(m_name, entity->getKeyValue("classname")))
+      {
+        m_entity = entity;
+      }
+    }
+    return true;
+  }
+};
+
+Entity* Scene_FindEntityByClass(const char* name)
+{
+  Entity* entity;
+  GlobalSceneGraph().traverse(EntityFindByClassname(name, entity));
+  return entity;
+}
+
+//  **************************
+// ** GTK callback functions **
+//  **************************
+
+static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+  /* If you return FALSE in the "delete_event" signal handler,
+   * GTK will emit the "destroy" signal. Returning TRUE means
+   * you don't want the window to be destroyed.
+   * This is useful for popping up 'are you sure you want to quit?'
+   * type dialogs. */
+
+  return FALSE;
+}
+
+// destroy widget if destroy signal is passed to widget
+static void destroy(GtkWidget *widget, gpointer data)
+{
+  gtk_widget_destroy(widget);
+}
+
+// function for close button to destroy the toplevel widget
+static void close_window(GtkWidget *widget, gpointer data)
+{
+  gtk_widget_destroy(gtk_widget_get_toplevel(widget));
+}
+
+// callback function to assign the optimal mapcoords to the spinboxes
+static void input_optimal(GtkWidget *widget, gpointer data)
+{
+  gtk_spin_button_set_value(msp.spinner1, minX);
+  gtk_spin_button_set_value(msp.spinner2, maxY);
+  gtk_spin_button_set_value(msp.spinner3, maxX);
+  gtk_spin_button_set_value(msp.spinner4, minY);
+}
+
+// Spinner return value function
+gint grab_int_value(GtkSpinButton *a_spinner, gpointer user_data) {
+  return gtk_spin_button_get_value_as_int(a_spinner);
+}
+
+// write the values of the Spinner-Boxes to the worldspawn
+static void set_coordinates(GtkWidget *widget, gpointer data)
+{
+  //Str str_min, str_max;
+  char buffer[10], str_min[20], str_max[20];
+
+  itoa(gtk_spin_button_get_value_as_int(msp.spinner1), str_min, 10);
+  itoa(gtk_spin_button_get_value_as_int(msp.spinner2), buffer, 10);
+  strcat(str_min, " ");
+  strcat(str_min, buffer);
+  msp.worldspawn->setKeyValue("mapcoordsmins", str_min);
+
+  itoa(gtk_spin_button_get_value_as_int(msp.spinner3), str_max, 10);
+  itoa(gtk_spin_button_get_value_as_int(msp.spinner4), buffer, 10);
+  strcat(str_max, " ");
+  strcat(str_max, buffer);
+  UndoableCommand undo("SunPlug.entitySetMapcoords");
+  msp.worldspawn->setKeyValue("mapcoordsmaxs", str_max);
+
+  close_window(widget, NULL);
+}
+
+class SunPlugPluginDependencies :
+  public GlobalRadiantModuleRef,    // basic class for all other module refs
+  public GlobalUndoModuleRef,       // used to say radiant that something has changed and to undo that
+  public GlobalSceneGraphModuleRef, // necessary to handle data in the mapfile (change, retrieve data)
+  public GlobalEntityModuleRef      // to access and modify the entities
+{
+public:
+  SunPlugPluginDependencies() :
+    GlobalEntityModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entities"))//,
+  {
+  }
+};
+
+//  *************************
+// ** standard plugin stuff **
+//  *************************
+namespace SunPlug
+{
+  GtkWindow* main_window;
+  char MenuList[100] = "";
+
+  const char* init(void* hApp, void* pMainWidget)
+  {
+    main_window = GTK_WINDOW(pMainWidget);
+    return "Initializing SunPlug for GTKRadiant";
+  }
+  const char* getName()
+  {
+    return "SunPlug"; // name that is shown in the menue
+  }
+  const char* getCommandList()
+  {
+    const char about[] = "About...";
+    const char etMapCoordinator[] = ";ET-MapCoordinator";
+
+    strcat(MenuList, about);
+    if (strncmp(GlobalRadiant().getGameName(), "etmain", 6) == 0) strcat(MenuList, etMapCoordinator);
+    return (const char*)MenuList;
+  }
+  const char* getCommandTitleList()
+  {
+    return "";
+  }
+  void dispatch(const char* command, float* vMin, float* vMax, bool bSingleBrush) // message processing
+  {
+    if(string_equal(command, "About..."))
+    {
+         about_plugin_window();
+       }
+    if(string_equal(command, "ET-MapCoordinator"))
+    {
+         MapCoordinator();
+    }
+  }
+} // namespace
+
+class SunPlugModule : public TypeSystemRef
+{
+  _QERPluginTable                      m_plugin;
+public:
+  typedef _QERPluginTable      Type;
+  STRING_CONSTANT(Name, "SunPlug");
+
+  SunPlugModule()
+  {
+       m_plugin.m_pfnQERPlug_Init = &SunPlug::init;
+       m_plugin.m_pfnQERPlug_GetName = &SunPlug::getName;
+       m_plugin.m_pfnQERPlug_GetCommandList = &SunPlug::getCommandList;
+       m_plugin.m_pfnQERPlug_GetCommandTitleList = &SunPlug::getCommandTitleList;
+       m_plugin.m_pfnQERPlug_Dispatch = &SunPlug::dispatch;
+  }
+  _QERPluginTable* getTable()
+  {
+    return &m_plugin;
+  }
+};
+
+typedef SingletonModule<SunPlugModule, SunPlugPluginDependencies> SingletonSunPlugModule;
+
+SingletonSunPlugModule g_SunPlugModule;
+
+
+extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
+{
+  initialiseModule(server);
+
+  g_SunPlugModule.selfRegister();
+}
+
+//  ************
+// ** my stuff **
+//  ************
+
+// About dialog
+void about_plugin_window()
+{
+    GtkWidget *window, *vbox, *label, *button;
+
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL); // create a window
+    gtk_window_set_transient_for(GTK_WINDOW(window), SunPlug::main_window); // make the window to stay in front of the main window
+    g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); // connect the delete event
+    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // connect the destroy event for the window
+    gtk_window_set_title(GTK_WINDOW(window), "About SunPlug"); // set the title of the window for the window
+    gtk_window_set_resizable(GTK_WINDOW(window), FALSE); // don't let the user resize the window
+    gtk_window_set_modal(GTK_WINDOW(window), TRUE); // force the user not to do something with the other windows
+    gtk_container_set_border_width(GTK_CONTAINER(window), 10); // set the border of the window
+
+    vbox = gtk_vbox_new(FALSE, 10); // create a box to arrange new objects vertically
+    gtk_container_add(GTK_CONTAINER(window), vbox); // add the box to the window
+
+    label = gtk_label_new("SunPlug v1.0 for NetRadiant 1.5\nby Topsun"); // create a label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // text align left
+    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2); // insert the label in the box
+
+    button = gtk_button_new_with_label("OK"); // create a button with text
+    g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK (gtk_widget_destroy), window); // connect the click event to close the window
+    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert the button in the box
+
+    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); // center the window on screen
+
+    gtk_widget_show_all(window); // show the window and all subelements
+}
+
+// get the current bounding box and return the optimal coordinates
+void GetOptimalCoordinates(AABB *levelBoundingBox)
+{
+  int half_width, half_heigth, center_x, center_y;
+
+  half_width = levelBoundingBox->extents.x();
+  half_heigth = levelBoundingBox->extents.y();
+  center_x = levelBoundingBox->origin.x();
+  center_y = levelBoundingBox->origin.y();
+
+  if (half_width > 175 || half_heigth > 175) // the square must be at least 350x350 units
+  {
+    // the wider side is the indicator for the square
+    if (half_width >= half_heigth)
+    {
+         minX = center_x - half_width;
+      maxX = center_x + half_width;
+      minY = center_y - half_width;
+      maxY = center_y + half_width;
+    } else {
+      minX = center_x - half_heigth;
+      maxX = center_x + half_heigth;
+         minY = center_y - half_heigth;
+      maxY = center_y + half_heigth;
+    }
+  } else {
+    minX = center_x - 175;
+    maxX = center_x + 175;
+    minY = center_y - 175;
+    maxY = center_y + 175;
+  }
+}
+
+// MapCoordinator dialog window
+void MapCoordinator()
+{
+  GtkWidget *window, *vbox, *table, *label, *spinnerMinX, *spinnerMinY, *spinnerMaxX, *spinnerMaxY, *button;
+  GtkAdjustment *spinner_adj_MinX, *spinner_adj_MinY, *spinner_adj_MaxX, *spinner_adj_MaxY;
+  Entity *theWorldspawn = NULL;
+  const char *buffer;
+  char line[20];
+
+  // in any case we need a window to show the user what to do
+  window = gtk_window_new(GTK_WINDOW_TOPLEVEL); // create the window
+  gtk_window_set_transient_for(GTK_WINDOW(window), SunPlug::main_window); // make the window to stay in front of the main window
+  g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); // connect the delete event for the window
+  g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // connect the destroy event for the window
+  gtk_window_set_title(GTK_WINDOW(window), "ET-MapCoordinator"); // set the title of the window for the window
+  gtk_window_set_resizable(GTK_WINDOW(window), FALSE); // don't let the user resize the window
+  gtk_window_set_modal(GTK_WINDOW(window), TRUE); // force the user not to do something with the other windows
+  gtk_container_set_border_width(GTK_CONTAINER(window), 10); // set the border of the window
+
+  vbox = gtk_vbox_new(FALSE, 10); // create a box to arrange new objects vertically
+  gtk_container_add(GTK_CONTAINER(window), vbox); // add the box to the window
+
+  scene::Path path = makeReference(GlobalSceneGraph().root()); // get the path to the root element of the graph
+  scene::Instance* instance = GlobalSceneGraph().find(path); // find the instance to the given path
+  AABB levelBoundingBox = instance->worldAABB(); // get the bounding box of the level
+
+  theWorldspawn = Scene_FindEntityByClass("worldspawn"); // find the entity worldspawn
+  if (theWorldspawn != 0) { // need to have a worldspawn otherwise setting a value crashes the radiant
+    // next two if's: get the current values of the mapcoords
+    buffer = theWorldspawn->getKeyValue("mapcoordsmins"); // upper left corner
+       if (strlen(buffer) > 0) {
+      strncpy(line, buffer, 19);
+      map_minX = atoi(strtok(line, " ")); // minimum of x value
+      map_minY = atoi(strtok(NULL, " ")); // maximum of y value
+       } else {
+               map_minX = 0;
+               map_minY = 0;
+       }
+    buffer = theWorldspawn->getKeyValue("mapcoordsmaxs"); // lower right corner
+       if (strlen(buffer) > 0) {
+         strncpy(line, buffer, 19);
+      map_maxX = atoi(strtok(line, " ")); // maximum of x value
+      map_maxY = atoi(strtok(NULL, " ")); // minimum of y value
+       } else {
+               map_maxX = 0;
+               map_maxY = 0;
+       }
+
+    globalOutputStream() << "SunPlug: calculating optimal coordinates\n"; // write to console that we are calculating the coordinates
+    GetOptimalCoordinates(&levelBoundingBox); // calculate optimal mapcoords with the dimensions of the level bounding box
+    globalOutputStream() << "SunPlug: adviced mapcoordsmins=" << minX << " " << maxY << "\n"; // console info about mapcoordsmins
+    globalOutputStream() << "SunPlug: adviced mapcoordsmaxs=" << maxX << " " << minY << "\n"; // console info about mapcoordsmaxs
+
+    spinner_adj_MinX = (GtkAdjustment *)gtk_adjustment_new(map_minX, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of minimum x value
+    spinner_adj_MinY = (GtkAdjustment *)gtk_adjustment_new(map_minY, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of minimum y value
+    spinner_adj_MaxX = (GtkAdjustment *)gtk_adjustment_new(map_maxX, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of maximum x value
+    spinner_adj_MaxY = (GtkAdjustment *)gtk_adjustment_new(map_maxY, -65536.0, 65536.0, 1.0, 5.0, 0); // create adjustment for value and range of maximum y value
+    button = gtk_button_new_with_label("Get optimal mapcoords"); // create button with text
+    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(input_optimal), NULL); // connect button with callback function
+    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert button into vbox
+
+    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 2); // insert separator into vbox
+
+    table = gtk_table_new(4, 3, TRUE); // create table
+    gtk_table_set_row_spacings(GTK_TABLE(table), 8); // set row spacings
+    gtk_table_set_col_spacings(GTK_TABLE(table), 8); // set column spacings
+    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 2); // insert table into vbox
+
+    label = gtk_label_new("x"); // create label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side
+    gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1); // insert label into table
+
+    label = gtk_label_new("y"); // create label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side
+    gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 0, 1); // insert label into table
+
+    label = gtk_label_new("mapcoordsmins"); // create label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side
+    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); // insert label into table
+
+    spinnerMinX = gtk_spin_button_new(spinner_adj_MinX, 1.0, 0); // create textbox wiht value spin, value and value range
+    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMinX, 1, 2, 1, 2); // insert spinbox into table
+
+    spinnerMinY = gtk_spin_button_new(spinner_adj_MinY, 1.0, 0); // create textbox wiht value spin, value and value range
+    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMinY, 2, 3, 1, 2); // insert spinbox into table
+
+    label = gtk_label_new("mapcoordsmaxs"); // create label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // align text to the left side
+    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); // insert label into table
+
+    spinnerMaxX = gtk_spin_button_new(spinner_adj_MaxX, 1.0, 0); // create textbox wiht value spin, value and value range
+    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMaxX, 1, 2, 2, 3); // insert spinbox into table
+
+    spinnerMaxY = gtk_spin_button_new(spinner_adj_MaxY, 1.0, 0); // create textbox wiht value spin, value and value range
+    gtk_table_attach_defaults(GTK_TABLE(table), spinnerMaxY, 2, 3, 2, 3); // insert spinbox into table
+
+    // put the references to the spinboxes and the worldspawn into the global exchange
+    msp.spinner1 = GTK_SPIN_BUTTON(spinnerMinX);
+    msp.spinner2 = GTK_SPIN_BUTTON(spinnerMinY);
+    msp.spinner3 = GTK_SPIN_BUTTON(spinnerMaxX);
+    msp.spinner4 = GTK_SPIN_BUTTON(spinnerMaxY);
+    msp.worldspawn = theWorldspawn;
+
+    button = gtk_button_new_with_label("Set"); // create button with text
+    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_coordinates), NULL); // connect button with callback function
+    gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 3, 4); // insert button into table
+
+    button = gtk_button_new_with_label("Cancel"); // create button with text
+    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_window), NULL); // connect button with callback function
+    gtk_table_attach_defaults(GTK_TABLE(table), button, 2, 3, 3, 4); // insert button into table
+  } else {
+       globalOutputStream() << "SunPlug: no worldspawn found!\n"; // output error to console
+       
+       label = gtk_label_new("ERROR: No worldspawn was found in the map!\nIn order to use this tool the map must have at least one brush in the worldspawn. "); // create a label
+    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); // text align left
+    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 2); // insert the label in the box
+
+    button = gtk_button_new_with_label("OK"); // create a button with text
+    g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(close_window), NULL); // connect the click event to close the window
+    gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2); // insert the button in the box
+  }
+
+  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); // center the window
+  gtk_widget_show_all(window); // show the window and all subelements
+}
index 6d26077..1f1dfb1 100644 (file)
@@ -1,7 +1,7 @@
-; sunplug.def : Declares the module parameters for the DLL.\r
-\r
-LIBRARY      "SUNPLUG"\r
-\r
-EXPORTS\r
-    ; Explicit exports can go here\r
-       Radiant_RegisterModules @1\r
+; sunplug.def : Declares the module parameters for the DLL.
+
+LIBRARY      "SUNPLUG"
+
+EXPORTS
+    ; Explicit exports can go here
+       Radiant_RegisterModules @1
index 9649a74..fafdc89 100644 (file)
@@ -1,25 +1,25 @@
-/*\r
-Sunplug plugin for GtkRadiant\r
-Copyright (C) 2004 Topsun\r
-Thanks to SPoG for help!\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-*/\r
-\r
-#ifndef _PLUGIN_SUNPLUG_\r
-  #define _PLUGIN_SUNPLUG_\r
-\r
-\r
-#endif // _PLUGIN_SUNPLUG_\r
+/*
+Sunplug plugin for GtkRadiant
+Copyright (C) 2004 Topsun
+Thanks to SPoG for help!
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef _PLUGIN_SUNPLUG_
+  #define _PLUGIN_SUNPLUG_
+
+
+#endif // _PLUGIN_SUNPLUG_
index 44c78d3..62d51ed 100644 (file)
@@ -1,40 +1,40 @@
-# Copyright (C) 2001-2006 William Joseph.\r
-# For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-# \r
-# This file is part of GtkRadiant.\r
-# \r
-# GtkRadiant is free software; you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation; either version 2 of the License, or\r
-# (at your option) any later version.\r
-# \r
-# GtkRadiant is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with GtkRadiant; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-\r
-import os\r
-import sys\r
-\r
-def svnAddText(filename):\r
-  os.system("svn add " + filename);\r
-  os.system("svn ps svn:eol-style native " + filename);\r
-\r
-def createCPPTemplate(filename, name):\r
-  file = open(filename, "wt")\r
-  file.write("\n")\r
-  file.write("#include \"" + name + ".h\"\n")\r
-  file.write("\n")\r
-  file.close()\r
-\r
-if __name__ == "__main__":\r
-  name = sys.argv[1]\r
-  location = sys.argv[2]\r
-  filename = os.path.join(location, name + ".cpp")\r
-  createCPPTemplate(filename, name)\r
-  svnAddText(filename)\r
+# Copyright (C) 2001-2006 William Joseph.
+# For a list of contributors, see the accompanying CONTRIBUTORS file.
+# 
+# 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 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
+
+
+import os
+import sys
+
+def svnAddText(filename):
+  os.system("svn add " + filename);
+  os.system("svn ps svn:eol-style native " + filename);
+
+def createCPPTemplate(filename, name):
+  file = open(filename, "wt")
+  file.write("\n")
+  file.write("#include \"" + name + ".h\"\n")
+  file.write("\n")
+  file.close()
+
+if __name__ == "__main__":
+  name = sys.argv[1]
+  location = sys.argv[2]
+  filename = os.path.join(location, name + ".cpp")
+  createCPPTemplate(filename, name)
+  svnAddText(filename)
index 337f3b0..9f8b7e9 100644 (file)
@@ -1,41 +1,41 @@
-# Copyright (C) 2001-2006 William Joseph.\r
-# For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-# \r
-# This file is part of GtkRadiant.\r
-# \r
-# GtkRadiant is free software; you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation; either version 2 of the License, or\r
-# (at your option) any later version.\r
-# \r
-# GtkRadiant is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU General Public License\r
-# along with GtkRadiant; if not, write to the Free Software\r
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-\r
-import os\r
-import sys\r
-\r
-def svnAddText(filename):\r
-  os.system("svn add " + filename);\r
-  os.system("svn ps svn:eol-style native " + filename);\r
-\r
-def createHeaderTemplate(filename, name):\r
-  file = open(filename, "wt")\r
-  file.write("\n")\r
-  file.write("#if !defined(_INCLUDED_" + name.upper() + "_H_)\n")\r
-  file.write("#define _INCLUDED_" + name.upper() + "_H_\n")\r
-  file.write("\n")\r
-  file.write("#endif\n")\r
-\r
-if __name__ == "__main__":\r
-  name = sys.argv[1]\r
-  location = sys.argv[2]\r
-  filename = os.path.join(location, name + ".h")\r
-  createHeaderTemplate(filename, name)\r
-  svnAddText(filename)\r
+# Copyright (C) 2001-2006 William Joseph.
+# For a list of contributors, see the accompanying CONTRIBUTORS file.
+# 
+# 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 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
+
+
+import os
+import sys
+
+def svnAddText(filename):
+  os.system("svn add " + filename);
+  os.system("svn ps svn:eol-style native " + filename);
+
+def createHeaderTemplate(filename, name):
+  file = open(filename, "wt")
+  file.write("\n")
+  file.write("#if !defined(_INCLUDED_" + name.upper() + "_H_)\n")
+  file.write("#define _INCLUDED_" + name.upper() + "_H_\n")
+  file.write("\n")
+  file.write("#endif\n")
+
+if __name__ == "__main__":
+  name = sys.argv[1]
+  location = sys.argv[2]
+  filename = os.path.join(location, name + ".h")
+  createHeaderTemplate(filename, name)
+  svnAddText(filename)
index cdfd6d4..ed97d40 100644 (file)
@@ -1,3 +1,3 @@
-*.dsp  -m 'COPY' -k 'b'\r
-*.dsw  -m 'COPY' -k 'b'\r
-*.scc  -m 'COPY' -k 'b'\r
+*.dsp  -m 'COPY' -k 'b'
+*.dsw  -m 'COPY' -k 'b'
+*.scc  -m 'COPY' -k 'b'
index cdfd6d4..ed97d40 100644 (file)
@@ -1,3 +1,3 @@
-*.dsp  -m 'COPY' -k 'b'\r
-*.dsw  -m 'COPY' -k 'b'\r
-*.scc  -m 'COPY' -k 'b'\r
+*.dsp  -m 'COPY' -k 'b'
+*.dsw  -m 'COPY' -k 'b'
+*.scc  -m 'COPY' -k 'b'
index 4ab2c6c..c30f986 100644 (file)
-/*\r
-Copyright (C) 2006, Stefan Greven.\r
-All Rights Reserved.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#include "xmltextags.h"\r
-\r
-#include <string>\r
-\r
-#include "qerplugin.h"\r
-#include "stream/stringstream.h"\r
-\r
-XmlTagBuilder::XmlTagBuilder()\r
-{\r
-}\r
-\r
-XmlTagBuilder::~XmlTagBuilder()\r
-{\r
-  // clean up\r
-  xmlFreeDoc(doc);\r
-  xmlXPathFreeContext(context);\r
-}\r
-\r
-bool XmlTagBuilder::CreateXmlDocument()\r
-{\r
-  /* Creates an XML file\r
-\r
-     returns TRUE if the file was created successfully or FALSE when failed\r
-  */\r
-\r
-  xmlTextWriterPtr writer;\r
-\r
-  writer = xmlNewTextWriterDoc(&doc, 0);\r
-\r
-  // begin a new UTF-8 formatted xml document\r
-  xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);\r
-\r
-  // create the root node with stock and custom elements\r
-  xmlTextWriterStartElement(writer, (xmlChar*)"root");\r
-  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");\r
-  xmlTextWriterStartElement(writer, (xmlChar*)"stock");\r
-  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");\r
-  xmlTextWriterEndElement(writer);\r
-  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");\r
-  xmlTextWriterStartElement(writer, (xmlChar*)"custom");\r
-  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");\r
-  xmlTextWriterEndElement(writer);\r
-  xmlTextWriterWriteString(writer, (xmlChar*)"\n");\r
-  xmlTextWriterEndElement(writer);\r
-\r
-  // end of the xml document\r
-  xmlTextWriterEndDocument(writer);\r
-  xmlFreeTextWriter(writer);\r
-\r
-  if(!doc)\r
-  {\r
-    return false;\r
-  } else {\r
-    context = xmlXPathNewContext(doc);\r
-       return true;\r
-  }\r
-}\r
-\r
-bool XmlTagBuilder::OpenXmlDoc(const char* file, const char* savefile)\r
-{\r
-  /* Reads a XML document from a file\r
-\r
-     returns TRUE if the document was read successfully or FALSE when failed\r
-  */\r
-\r
-  if(savefile)\r
-    m_savefilename = savefile;\r
-  else\r
-    m_savefilename = file;\r
-    \r
-  doc = xmlParseFile(file);    // TODO error checking!\r
-\r
-  if(!doc)\r
-  {\r
-    return false;\r
-  } else {\r
-    context = xmlXPathNewContext(doc);\r
-       return true;\r
-  }\r
-}\r
-\r
-bool XmlTagBuilder::SaveXmlDoc(void)\r
-{\r
-       return SaveXmlDoc(m_savefilename.c_str());\r
-}\r
-\r
-bool XmlTagBuilder::SaveXmlDoc(const char* file)\r
-{\r
-  /* Writes the XML document\r
-\r
-     returns TRUE if the document was saved successfully or FALSE when saving failed\r
-  */\r
-  \r
-  xmlSaveNoEmptyTags = 1;\r
-\r
-  if(xmlSaveFile(file, doc) != -1)\r
-  {\r
-    return true;\r
-  }\r
-  return false;\r
-}\r
-\r
-bool XmlTagBuilder::AddShaderNode(const char* shader, TextureType textureType, NodeShaderType nodeShaderType)\r
-{\r
-  /* Adds a shader node\r
-\r
-     char* shader - the name of the shader or texture (without trailing .tga or something)\r
-\r
-     returns TRUE if the node was added successfully or FALSE when failed\r
-  */\r
-\r
-  xmlNodeSetPtr nodePtr = NULL;\r
-  xmlXPathObjectPtr xpathPtr = NULL;\r
-  \r
-  switch(textureType)\r
-  {\r
-    case STOCK:\r
-      xpathPtr = XpathEval("/root/stock");\r
-      break;\r
-    case CUSTOM:\r
-      xpathPtr = XpathEval("/root/custom");\r
-  };\r
-  \r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-    return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlNodePtr newnode, newtext;\r
-    xmlNodePtr nodeParent = nodePtr->nodeTab[0];\r
-\r
-    // create a new node and set the node attribute (shader path)\r
-    switch(nodeShaderType)\r
-    {\r
-      case SHADER:\r
-        newnode = xmlNewNode(NULL, (xmlChar*)"shader");\r
-        break;\r
-      case TEXTURE:\r
-        newnode = xmlNewNode(NULL, (xmlChar*)"texture");\r
-      };\r
-\r
-      newnode = xmlDocCopyNode(newnode, doc, 1);\r
-      xmlSetProp(newnode, (xmlChar*)"path", (xmlChar*)shader);\r
-      xmlNodeSetContent(newnode, (xmlChar*)"\n    ");\r
-\r
-      if(nodePtr->nodeTab[0]->children->next == NULL)   // there are no shaders yet\r
-      {\r
-        // add spaces\r
-        newtext = xmlNewText((xmlChar*)"  ");\r
-        xmlAddChild(nodeParent->children, newtext);\r
-\r
-        // add the new node\r
-        xmlAddNextSibling(nodeParent->children, newnode);\r
-\r
-        // append a new line\r
-        newtext = xmlNewText((xmlChar*)"\n  ");\r
-        xmlAddNextSibling(nodeParent->children->next, newtext);\r
-      } else {\r
-        // add the node\r
-        xmlAddNextSibling(nodeParent->children, newnode);\r
-\r
-        // append a new line and spaces\r
-        newtext = xmlNewText((xmlChar*)"\n    ");\r
-        xmlAddNextSibling(nodeParent->children->next, newtext);\r
-      }\r
-      \r
-      xmlXPathFreeObject(xpathPtr);\r
-      return true;\r
-  } else {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return false;\r
-  }\r
-}\r
-\r
-bool XmlTagBuilder::DeleteShaderNode(const char* shader)\r
-{\r
-  /* Deletes a shader node\r
-\r
-     char* shader - the name of the shader or texture (without trailing .tga or something)\r
-\r
-     returns TRUE if the node was deleted successfully or FALSE when failed\r
-  */\r
-\r
-  char buffer[256];\r
-  char* expression = GetTagsXpathExpression(buffer, shader, EMPTY);\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  \r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-       nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlNodePtr ptrContent = nodePtr->nodeTab[0];\r
-    xmlNodePtr ptrWhitespace = nodePtr->nodeTab[0]->prev;\r
-\r
-    // delete the node\r
-    xmlUnlinkNode(ptrContent);\r
-    xmlFreeNode(ptrContent);\r
-\r
-    // delete leading whitespace node\r
-    xmlUnlinkNode(ptrWhitespace);\r
-    xmlFreeNode(ptrWhitespace);\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return true;\r
-  }\r
-  xmlXPathFreeObject(xpathPtr);\r
-  return false;\r
-}\r
-\r
-bool XmlTagBuilder::CheckShaderTag(const char* shader)\r
-{\r
-  /* Checks whether there exists an entry for a shader/texture with at least one tag\r
-\r
-     char* shader  - the name of the shader or texture (without trailing .tga or something)\r
-\r
-     returns TRUE if the shader is already stored in the XML tag file and has at least one tag\r
-  */\r
-\r
-  // build the XPath expression to search for\r
-  char buffer[256];\r
-  strcpy(buffer, "/root/*/*[@path='");\r
-  strcat(buffer, shader);\r
-  strcat(buffer, "']");\r
-\r
-  char* expression = buffer;\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return true;\r
-  } else {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return false;\r
-  }\r
-}\r
-\r
-bool XmlTagBuilder::CheckShaderTag(const char* shader, const char* content)\r
-{\r
-  /* Checks whether a tag with content already exists\r
-\r
-     char* shader  - the name of the shader or texture (without trailing .tga or something)\r
-     char* content - the node content (a tag name)\r
-\r
-     returns TRUE if the tag with content already exists or FALSE if not\r
-  */\r
-\r
-  // build the XPath expression to search for\r
-  // example expression: "/stock/*[@path='textures/alpha/barb_wire'][child::tag='Alpha']";\r
-\r
-  char buffer[256];\r
-  strcpy(buffer, "/root/*/*[@path='");\r
-  strcat(buffer, shader);\r
-  strcat(buffer, "'][child::tag='");\r
-  strcat(buffer, content);\r
-  strcat(buffer, "']");\r
-\r
-  char* expression = buffer;\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return true;\r
-  } else {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return false;\r
-  }\r
-}\r
-\r
-bool XmlTagBuilder::AddShaderTag(const char* shader, const char* content, NodeTagType nodeTagType)\r
-{\r
-  /* Adds a tag node to an existing shader/texture node if there's no tag with the same content yet\r
-\r
-     char* shader  - the name of the shader or texture (without trailing .tga or something)\r
-     char* content - the node content (a tag name)\r
-\r
-     returns TRUE if the node was added successfully or FALSE when failed\r
-  */\r
-\r
-  // build the XPath expression\r
-  char buffer[256];\r
-  char* expression = GetTagsXpathExpression(buffer, shader, EMPTY);\r
-  \r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr)) // node was found\r
-  {\r
-    xmlNodePtr newnode = xmlNewNode(NULL, (xmlChar*)"tag");\r
-    xmlNodePtr nodeParent = nodePtr->nodeTab[0];\r
-    newnode = xmlDocCopyNode(newnode, doc, 1);\r
-    xmlNodeSetContent(newnode, (xmlChar*)content);\r
-\r
-    if(nodePtr->nodeTab[0]->children->next == NULL)    // shader node has NO children\r
-    {\r
-      // add spaces\r
-      xmlNodePtr newtext = xmlNewText((xmlChar*)"  ");\r
-      xmlAddChild(nodeParent->children, newtext);\r
-\r
-      // add new node\r
-      xmlAddNextSibling(nodeParent->children, newnode);\r
-\r
-      // append a new line + spaces\r
-      newtext = xmlNewText((xmlChar*)"\n    ");\r
-      xmlAddNextSibling(nodeParent->children->next, newtext);\r
-    } else { // shader node has children already - the new node will be the first sibling\r
-      xmlAddNextSibling(nodeParent->children, newnode);\r
-         xmlNodePtr newtext = xmlNewText((xmlChar*)"\n      ");\r
-      xmlAddNextSibling(nodeParent->children->next, newtext);\r
-    }\r
-       xmlXPathFreeObject(xpathPtr);\r
-    return true;\r
-  } else {\r
-    xmlXPathFreeObject(xpathPtr);\r
-    return false;\r
-  }\r
-}\r
-\r
-//int XmlTagBuilder::RenameShaderTag(const char* oldtag, const char* newtag)\r
-int XmlTagBuilder::RenameShaderTag(const char* oldtag, CopiedString newtag)\r
-{\r
-  /* Replaces tag node contents\r
-\r
-     char* oldtag - the <tag></tag> node content that sould be changed\r
-     char* newtag - the new <tag></tag> node content\r
-\r
-     returns the number of renamed shaders\r
-  */\r
-\r
-  int num = 0;\r
-\r
-  // build the XPath expression\r
-  char expression[256];\r
-  strcpy(expression, "/root/*/*[child::tag='");\r
-  strcat(expression, oldtag);\r
-  strcat(expression, "']/*");\r
-\r
-  xmlXPathObjectPtr result = xmlXPathEvalExpression((xmlChar*)expression, context);\r
-  if(!result)\r
-    return 0;\r
-  xmlNodeSetPtr nodePtr = result->nodesetval;\r
-\r
-  for(int i = 0; i < nodePtr->nodeNr; i++)\r
-  {\r
-    xmlNodePtr ptrContent = nodePtr->nodeTab[i];\r
-    char* content = (char*)xmlNodeGetContent(ptrContent);\r
-\r
-    if(strcmp(content, oldtag) == 0)   // found a node with old content?\r
-    {\r
-      xmlNodeSetContent(ptrContent, (xmlChar*)newtag.c_str());\r
-      num++;\r
-    }\r
-  }\r
-\r
-  SaveXmlDoc();\r
-  xmlXPathFreeObject(result);// CHANGED\r
-  return num;\r
-}\r
-\r
-bool XmlTagBuilder::DeleteShaderTag(const char* shader, const char* tag)\r
-{\r
-  /* Deletes a child node of a shader\r
-\r
-     char* shader  - the name of the shader or texture (without trailing .tga or something)\r
-     char* tag     - the tag being deleted\r
-\r
-     returns TRUE if the node was deleted successfully or FALSE when failed\r
-  */\r
-\r
-  char buffer[256];\r
-  char* expression = GetTagsXpathExpression(buffer, shader, TAG);\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return false;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    for(int i = 0; i < nodePtr->nodeNr; i++)\r
-    {\r
-      xmlNodePtr ptrContent = nodePtr->nodeTab[i];\r
-      char* content = (char*)(xmlChar*)xmlNodeGetContent(ptrContent);\r
-\r
-      if(strcmp(content, tag) == 0)    // find the node\r
-      {\r
-        xmlNodePtr ptrWhitespace = nodePtr->nodeTab[i]->prev;\r
-        // delete the node\r
-        xmlUnlinkNode(ptrContent);\r
-        xmlFreeNode(ptrContent);\r
-\r
-        // delete leading whitespace node\r
-        xmlUnlinkNode(ptrWhitespace);\r
-        xmlFreeNode(ptrWhitespace);\r
-        xmlXPathFreeObject(xpathPtr);\r
-        return true;\r
-      }\r
-    }\r
-  }\r
-  xmlXPathFreeObject(xpathPtr);\r
-  return false;\r
-}\r
-\r
-bool XmlTagBuilder::DeleteTag(const char* tag)\r
-{\r
-  /* Deletes a tag from all shaders\r
-\r
-     char* tag - the tag being deleted from all shaders\r
-\r
-     returns TRUE if the tag was deleted successfully or FALSE when failed\r
-  */\r
-\r
-  char expression[256];\r
-  strcpy(expression, "/root/*/*[child::tag='");\r
-  strcat(expression, tag);\r
-  strcat(expression, "']");\r
-\r
-  std::set<CopiedString> dellist;\r
-  TagSearch(expression, dellist);\r
-  std::set<CopiedString>::iterator iter;\r
-\r
-  for(iter = dellist.begin(); iter != dellist.end(); iter++)\r
-  {\r
-    DeleteShaderTag(iter->c_str(), tag);\r
-  }\r
-  SaveXmlDoc();\r
-\r
-  return true;\r
-}\r
-\r
-void XmlTagBuilder::GetShaderTags(const char* shader, std::vector<CopiedString>& tags)\r
-{\r
-  /* Gets the tags from a shader\r
-\r
-     char* shader - the name of the shader\r
-\r
-     returns a vector containing the tags\r
-  */\r
-\r
-  char* expression;\r
-\r
-  if(shader == NULL)   // get all tags from all shaders\r
-  {\r
-    expression = "/root/*/*/tag";\r
-  } else {\r
-    char buffer[256];\r
-    expression = GetTagsXpathExpression(buffer, shader, TAG);\r
-  }\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    for(int i = 0; i < nodePtr->nodeNr; i++)\r
-    {\r
-      tags.push_back((CopiedString)(char*)xmlNodeGetContent(nodePtr->nodeTab[i]));\r
-    }\r
-  }\r
-  xmlXPathFreeObject(xpathPtr);\r
-}\r
-\r
-void XmlTagBuilder::GetUntagged(std::set<CopiedString>& shaders)\r
-{\r
-  /* Gets all textures and shaders listed in the xml file that don't have any tag\r
-\r
-     returns a set containing the shaders (with path)\r
-  */\r
-\r
-  char* expression = "/root/*/*[not(child::tag)]";\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return;\r
\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlNodePtr ptr;\r
-\r
-    for(int i = 0; i < nodePtr->nodeNr; i++)\r
-    {\r
-      ptr = nodePtr->nodeTab[i];\r
-         shaders.insert((char*)xmlGetProp(ptr, (xmlChar*)"path"));\r
-    }\r
-  }\r
-  \r
-  xmlXPathFreeObject(xpathPtr);\r
-}\r
-\r
-void XmlTagBuilder::GetAllTags(std::set<CopiedString>& tags)\r
-{\r
-  /* Gets a list of all tags that are used (assigned to any shader)\r
-\r
-     returns a set containing all used tags\r
-  */\r
-\r
-  char* expression = "/root/*/*/tag";\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return;\r
\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    for(int i = 0; i < nodePtr->nodeNr; i++)\r
-    {\r
-      tags.insert((CopiedString)(char*)xmlNodeGetContent(nodePtr->nodeTab[i]));\r
-    }\r
-  }\r
-  \r
-  xmlXPathFreeObject(xpathPtr);\r
-}\r
-\r
-void XmlTagBuilder::TagSearch(const char* expression, std::set<CopiedString>& paths)\r
-{\r
-  /* Searches shaders by tags\r
-\r
-     char* expression - the XPath expression to search\r
-\r
-     returns a set containing the found shaders\r
-  */\r
-\r
-  xmlXPathObjectPtr xpathPtr = XpathEval(expression);\r
-  xmlNodeSetPtr nodePtr;\r
-  if(xpathPtr)\r
-    nodePtr = xpathPtr->nodesetval;\r
-  else\r
-       return;\r
-\r
-  if(!xmlXPathNodeSetIsEmpty(nodePtr))\r
-  {\r
-    xmlNodePtr ptr;\r
-    xmlChar* xmlattrib;\r
-    for(int i = 0; i < nodePtr->nodeNr; i++)\r
-    {\r
-      ptr = nodePtr->nodeTab[i];\r
-      xmlattrib = xmlGetProp(ptr, (xmlChar*)"path");\r
-         paths.insert((CopiedString)(char*)xmlattrib);\r
-    }\r
-  }\r
-  xmlXPathFreeObject(xpathPtr);\r
-}\r
-\r
+/*
+Copyright (C) 2006, Stefan Greven.
+All Rights Reserved.
+
+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 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
+*/
+
+#include "xmltextags.h"
+
+#include <string>
+
+#include "qerplugin.h"
+#include "stream/stringstream.h"
+
+XmlTagBuilder::XmlTagBuilder()
+{
+}
+
+XmlTagBuilder::~XmlTagBuilder()
+{
+  // clean up
+  xmlFreeDoc(doc);
+  xmlXPathFreeContext(context);
+}
+
+bool XmlTagBuilder::CreateXmlDocument()
+{
+  /* Creates an XML file
+
+     returns TRUE if the file was created successfully or FALSE when failed
+  */
+
+  xmlTextWriterPtr writer;
+
+  writer = xmlNewTextWriterDoc(&doc, 0);
+
+  // begin a new UTF-8 formatted xml document
+  xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);
+
+  // create the root node with stock and custom elements
+  xmlTextWriterStartElement(writer, (xmlChar*)"root");
+  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");
+  xmlTextWriterStartElement(writer, (xmlChar*)"stock");
+  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");
+  xmlTextWriterEndElement(writer);
+  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");
+  xmlTextWriterStartElement(writer, (xmlChar*)"custom");
+  xmlTextWriterWriteString(writer, (xmlChar*)"\n  ");
+  xmlTextWriterEndElement(writer);
+  xmlTextWriterWriteString(writer, (xmlChar*)"\n");
+  xmlTextWriterEndElement(writer);
+
+  // end of the xml document
+  xmlTextWriterEndDocument(writer);
+  xmlFreeTextWriter(writer);
+
+  if(!doc)
+  {
+    return false;
+  } else {
+    context = xmlXPathNewContext(doc);
+       return true;
+  }
+}
+
+bool XmlTagBuilder::OpenXmlDoc(const char* file, const char* savefile)
+{
+  /* Reads a XML document from a file
+
+     returns TRUE if the document was read successfully or FALSE when failed
+  */
+
+  if(savefile)
+    m_savefilename = savefile;
+  else
+    m_savefilename = file;
+    
+  doc = xmlParseFile(file);    // TODO error checking!
+
+  if(!doc)
+  {
+    return false;
+  } else {
+    context = xmlXPathNewContext(doc);
+       return true;
+  }
+}
+
+bool XmlTagBuilder::SaveXmlDoc(void)
+{
+       return SaveXmlDoc(m_savefilename.c_str());
+}
+
+bool XmlTagBuilder::SaveXmlDoc(const char* file)
+{
+  /* Writes the XML document
+
+     returns TRUE if the document was saved successfully or FALSE when saving failed
+  */
+  
+  xmlSaveNoEmptyTags = 1;
+
+  if(xmlSaveFile(file, doc) != -1)
+  {
+    return true;
+  }
+  return false;
+}
+
+bool XmlTagBuilder::AddShaderNode(const char* shader, TextureType textureType, NodeShaderType nodeShaderType)
+{
+  /* Adds a shader node
+
+     char* shader - the name of the shader or texture (without trailing .tga or something)
+
+     returns TRUE if the node was added successfully or FALSE when failed
+  */
+
+  xmlNodeSetPtr nodePtr = NULL;
+  xmlXPathObjectPtr xpathPtr = NULL;
+  
+  switch(textureType)
+  {
+    case STOCK:
+      xpathPtr = XpathEval("/root/stock");
+      break;
+    case CUSTOM:
+      xpathPtr = XpathEval("/root/custom");
+  };
+  
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+    return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlNodePtr newnode, newtext;
+    xmlNodePtr nodeParent = nodePtr->nodeTab[0];
+
+    // create a new node and set the node attribute (shader path)
+    switch(nodeShaderType)
+    {
+      case SHADER:
+        newnode = xmlNewNode(NULL, (xmlChar*)"shader");
+        break;
+      case TEXTURE:
+        newnode = xmlNewNode(NULL, (xmlChar*)"texture");
+      };
+
+      newnode = xmlDocCopyNode(newnode, doc, 1);
+      xmlSetProp(newnode, (xmlChar*)"path", (xmlChar*)shader);
+      xmlNodeSetContent(newnode, (xmlChar*)"\n    ");
+
+      if(nodePtr->nodeTab[0]->children->next == NULL)   // there are no shaders yet
+      {
+        // add spaces
+        newtext = xmlNewText((xmlChar*)"  ");
+        xmlAddChild(nodeParent->children, newtext);
+
+        // add the new node
+        xmlAddNextSibling(nodeParent->children, newnode);
+
+        // append a new line
+        newtext = xmlNewText((xmlChar*)"\n  ");
+        xmlAddNextSibling(nodeParent->children->next, newtext);
+      } else {
+        // add the node
+        xmlAddNextSibling(nodeParent->children, newnode);
+
+        // append a new line and spaces
+        newtext = xmlNewText((xmlChar*)"\n    ");
+        xmlAddNextSibling(nodeParent->children->next, newtext);
+      }
+      
+      xmlXPathFreeObject(xpathPtr);
+      return true;
+  } else {
+    xmlXPathFreeObject(xpathPtr);
+    return false;
+  }
+}
+
+bool XmlTagBuilder::DeleteShaderNode(const char* shader)
+{
+  /* Deletes a shader node
+
+     char* shader - the name of the shader or texture (without trailing .tga or something)
+
+     returns TRUE if the node was deleted successfully or FALSE when failed
+  */
+
+  char buffer[256];
+  char* expression = GetTagsXpathExpression(buffer, shader, EMPTY);
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+       nodePtr = xpathPtr->nodesetval;
+  else
+       return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlNodePtr ptrContent = nodePtr->nodeTab[0];
+    xmlNodePtr ptrWhitespace = nodePtr->nodeTab[0]->prev;
+
+    // delete the node
+    xmlUnlinkNode(ptrContent);
+    xmlFreeNode(ptrContent);
+
+    // delete leading whitespace node
+    xmlUnlinkNode(ptrWhitespace);
+    xmlFreeNode(ptrWhitespace);
+    xmlXPathFreeObject(xpathPtr);
+    return true;
+  }
+  xmlXPathFreeObject(xpathPtr);
+  return false;
+}
+
+bool XmlTagBuilder::CheckShaderTag(const char* shader)
+{
+  /* Checks whether there exists an entry for a shader/texture with at least one tag
+
+     char* shader  - the name of the shader or texture (without trailing .tga or something)
+
+     returns TRUE if the shader is already stored in the XML tag file and has at least one tag
+  */
+
+  // build the XPath expression to search for
+  char buffer[256];
+  strcpy(buffer, "/root/*/*[@path='");
+  strcat(buffer, shader);
+  strcat(buffer, "']");
+
+  char* expression = buffer;
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlXPathFreeObject(xpathPtr);
+    return true;
+  } else {
+    xmlXPathFreeObject(xpathPtr);
+    return false;
+  }
+}
+
+bool XmlTagBuilder::CheckShaderTag(const char* shader, const char* content)
+{
+  /* Checks whether a tag with content already exists
+
+     char* shader  - the name of the shader or texture (without trailing .tga or something)
+     char* content - the node content (a tag name)
+
+     returns TRUE if the tag with content already exists or FALSE if not
+  */
+
+  // build the XPath expression to search for
+  // example expression: "/stock/*[@path='textures/alpha/barb_wire'][child::tag='Alpha']";
+
+  char buffer[256];
+  strcpy(buffer, "/root/*/*[@path='");
+  strcat(buffer, shader);
+  strcat(buffer, "'][child::tag='");
+  strcat(buffer, content);
+  strcat(buffer, "']");
+
+  char* expression = buffer;
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlXPathFreeObject(xpathPtr);
+    return true;
+  } else {
+    xmlXPathFreeObject(xpathPtr);
+    return false;
+  }
+}
+
+bool XmlTagBuilder::AddShaderTag(const char* shader, const char* content, NodeTagType nodeTagType)
+{
+  /* Adds a tag node to an existing shader/texture node if there's no tag with the same content yet
+
+     char* shader  - the name of the shader or texture (without trailing .tga or something)
+     char* content - the node content (a tag name)
+
+     returns TRUE if the node was added successfully or FALSE when failed
+  */
+
+  // build the XPath expression
+  char buffer[256];
+  char* expression = GetTagsXpathExpression(buffer, shader, EMPTY);
+  
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr)) // node was found
+  {
+    xmlNodePtr newnode = xmlNewNode(NULL, (xmlChar*)"tag");
+    xmlNodePtr nodeParent = nodePtr->nodeTab[0];
+    newnode = xmlDocCopyNode(newnode, doc, 1);
+    xmlNodeSetContent(newnode, (xmlChar*)content);
+
+    if(nodePtr->nodeTab[0]->children->next == NULL)    // shader node has NO children
+    {
+      // add spaces
+      xmlNodePtr newtext = xmlNewText((xmlChar*)"  ");
+      xmlAddChild(nodeParent->children, newtext);
+
+      // add new node
+      xmlAddNextSibling(nodeParent->children, newnode);
+
+      // append a new line + spaces
+      newtext = xmlNewText((xmlChar*)"\n    ");
+      xmlAddNextSibling(nodeParent->children->next, newtext);
+    } else { // shader node has children already - the new node will be the first sibling
+      xmlAddNextSibling(nodeParent->children, newnode);
+         xmlNodePtr newtext = xmlNewText((xmlChar*)"\n      ");
+      xmlAddNextSibling(nodeParent->children->next, newtext);
+    }
+       xmlXPathFreeObject(xpathPtr);
+    return true;
+  } else {
+    xmlXPathFreeObject(xpathPtr);
+    return false;
+  }
+}
+
+//int XmlTagBuilder::RenameShaderTag(const char* oldtag, const char* newtag)
+int XmlTagBuilder::RenameShaderTag(const char* oldtag, CopiedString newtag)
+{
+  /* Replaces tag node contents
+
+     char* oldtag - the <tag></tag> node content that sould be changed
+     char* newtag - the new <tag></tag> node content
+
+     returns the number of renamed shaders
+  */
+
+  int num = 0;
+
+  // build the XPath expression
+  char expression[256];
+  strcpy(expression, "/root/*/*[child::tag='");
+  strcat(expression, oldtag);
+  strcat(expression, "']/*");
+
+  xmlXPathObjectPtr result = xmlXPathEvalExpression((xmlChar*)expression, context);
+  if(!result)
+    return 0;
+  xmlNodeSetPtr nodePtr = result->nodesetval;
+
+  for(int i = 0; i < nodePtr->nodeNr; i++)
+  {
+    xmlNodePtr ptrContent = nodePtr->nodeTab[i];
+    char* content = (char*)xmlNodeGetContent(ptrContent);
+
+    if(strcmp(content, oldtag) == 0)   // found a node with old content?
+    {
+      xmlNodeSetContent(ptrContent, (xmlChar*)newtag.c_str());
+      num++;
+    }
+  }
+
+  SaveXmlDoc();
+  xmlXPathFreeObject(result);// CHANGED
+  return num;
+}
+
+bool XmlTagBuilder::DeleteShaderTag(const char* shader, const char* tag)
+{
+  /* Deletes a child node of a shader
+
+     char* shader  - the name of the shader or texture (without trailing .tga or something)
+     char* tag     - the tag being deleted
+
+     returns TRUE if the node was deleted successfully or FALSE when failed
+  */
+
+  char buffer[256];
+  char* expression = GetTagsXpathExpression(buffer, shader, TAG);
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return false;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    for(int i = 0; i < nodePtr->nodeNr; i++)
+    {
+      xmlNodePtr ptrContent = nodePtr->nodeTab[i];
+      char* content = (char*)(xmlChar*)xmlNodeGetContent(ptrContent);
+
+      if(strcmp(content, tag) == 0)    // find the node
+      {
+        xmlNodePtr ptrWhitespace = nodePtr->nodeTab[i]->prev;
+        // delete the node
+        xmlUnlinkNode(ptrContent);
+        xmlFreeNode(ptrContent);
+
+        // delete leading whitespace node
+        xmlUnlinkNode(ptrWhitespace);
+        xmlFreeNode(ptrWhitespace);
+        xmlXPathFreeObject(xpathPtr);
+        return true;
+      }
+    }
+  }
+  xmlXPathFreeObject(xpathPtr);
+  return false;
+}
+
+bool XmlTagBuilder::DeleteTag(const char* tag)
+{
+  /* Deletes a tag from all shaders
+
+     char* tag - the tag being deleted from all shaders
+
+     returns TRUE if the tag was deleted successfully or FALSE when failed
+  */
+
+  char expression[256];
+  strcpy(expression, "/root/*/*[child::tag='");
+  strcat(expression, tag);
+  strcat(expression, "']");
+
+  std::set<CopiedString> dellist;
+  TagSearch(expression, dellist);
+  std::set<CopiedString>::iterator iter;
+
+  for(iter = dellist.begin(); iter != dellist.end(); iter++)
+  {
+    DeleteShaderTag(iter->c_str(), tag);
+  }
+  SaveXmlDoc();
+
+  return true;
+}
+
+void XmlTagBuilder::GetShaderTags(const char* shader, std::vector<CopiedString>& tags)
+{
+  /* Gets the tags from a shader
+
+     char* shader - the name of the shader
+
+     returns a vector containing the tags
+  */
+
+  char* expression;
+
+  if(shader == NULL)   // get all tags from all shaders
+  {
+    expression = "/root/*/*/tag";
+  } else {
+    char buffer[256];
+    expression = GetTagsXpathExpression(buffer, shader, TAG);
+  }
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    for(int i = 0; i < nodePtr->nodeNr; i++)
+    {
+      tags.push_back((CopiedString)(char*)xmlNodeGetContent(nodePtr->nodeTab[i]));
+    }
+  }
+  xmlXPathFreeObject(xpathPtr);
+}
+
+void XmlTagBuilder::GetUntagged(std::set<CopiedString>& shaders)
+{
+  /* Gets all textures and shaders listed in the xml file that don't have any tag
+
+     returns a set containing the shaders (with path)
+  */
+
+  char* expression = "/root/*/*[not(child::tag)]";
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return;
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlNodePtr ptr;
+
+    for(int i = 0; i < nodePtr->nodeNr; i++)
+    {
+      ptr = nodePtr->nodeTab[i];
+         shaders.insert((char*)xmlGetProp(ptr, (xmlChar*)"path"));
+    }
+  }
+  
+  xmlXPathFreeObject(xpathPtr);
+}
+
+void XmlTagBuilder::GetAllTags(std::set<CopiedString>& tags)
+{
+  /* Gets a list of all tags that are used (assigned to any shader)
+
+     returns a set containing all used tags
+  */
+
+  char* expression = "/root/*/*/tag";
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return;
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    for(int i = 0; i < nodePtr->nodeNr; i++)
+    {
+      tags.insert((CopiedString)(char*)xmlNodeGetContent(nodePtr->nodeTab[i]));
+    }
+  }
+  
+  xmlXPathFreeObject(xpathPtr);
+}
+
+void XmlTagBuilder::TagSearch(const char* expression, std::set<CopiedString>& paths)
+{
+  /* Searches shaders by tags
+
+     char* expression - the XPath expression to search
+
+     returns a set containing the found shaders
+  */
+
+  xmlXPathObjectPtr xpathPtr = XpathEval(expression);
+  xmlNodeSetPtr nodePtr;
+  if(xpathPtr)
+    nodePtr = xpathPtr->nodesetval;
+  else
+       return;
+
+  if(!xmlXPathNodeSetIsEmpty(nodePtr))
+  {
+    xmlNodePtr ptr;
+    xmlChar* xmlattrib;
+    for(int i = 0; i < nodePtr->nodeNr; i++)
+    {
+      ptr = nodePtr->nodeTab[i];
+      xmlattrib = xmlGetProp(ptr, (xmlChar*)"path");
+         paths.insert((CopiedString)(char*)xmlattrib);
+    }
+  }
+  xmlXPathFreeObject(xpathPtr);
+}
+
index 047fbd7..afbc4bd 100644 (file)
-/*\r
-Copyright (C) 2006, Stefan Greven.\r
-All Rights Reserved.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#if !defined(INCLUDED_XMLTEXTAGS_H)\r
-#define INCLUDED_XMLTEXTAGS_H\r
-\r
-#include <set>\r
-#include <string/string.h>\r
-#include <vector>\r
-\r
-#include "iscriplib.h"\r
-\r
-#include <libxml/xpath.h>\r
-#include <libxml/xmlwriter.h>\r
-\r
-enum NodeTagType\r
-{\r
-  TAG,\r
-  EMPTY\r
-};\r
-\r
-enum NodeShaderType\r
-{\r
-  SHADER,\r
-  TEXTURE\r
-};\r
-\r
-enum TextureType\r
-{\r
-  STOCK,\r
-  CUSTOM\r
-};\r
-\r
-class XmlTagBuilder\r
-{\r
-private:\r
-  CopiedString m_savefilename;\r
-  xmlDocPtr doc;\r
-  xmlXPathContextPtr context;\r
-  xmlNodeSetPtr nodePtr;\r
-\r
-  xmlXPathObjectPtr XpathEval(const char* queryString)\r
-  {\r
-       xmlChar* expression = (xmlChar*)queryString;\r
-       xmlXPathObjectPtr result = xmlXPathEvalExpression(expression, context);\r
-       return result;\r
-  };\r
-\r
-  char* GetTagsXpathExpression(char* buffer, const char* shader, NodeTagType nodeTagType)\r
-  {\r
-       strcpy(buffer, "/root/*/*[@path='");\r
-       strcat(buffer, shader);\r
-       \r
-       switch(nodeTagType)\r
-       {\r
-       case TAG:\r
-               strcat(buffer, "']/tag");\r
-               break;\r
-       case EMPTY:\r
-               strcat(buffer, "']");\r
-       };\r
-\r
-       return buffer;\r
-  }\r
-\r
-public:\r
-  XmlTagBuilder();\r
-  ~XmlTagBuilder();\r
-\r
-  bool CreateXmlDocument();\r
-  bool OpenXmlDoc(const char* file, const char* savefile = 0);\r
-  bool SaveXmlDoc(const char* file);\r
-  bool SaveXmlDoc(void);\r
-  bool AddShaderNode(const char* shader, TextureType textureType, NodeShaderType nodeShaderType);\r
-  bool DeleteShaderNode(const char* shader);\r
-  bool CheckShaderTag(const char* shader);\r
-  bool CheckShaderTag(const char* shader, const char* content);\r
-  bool AddShaderTag(const char* shader, const char* content, NodeTagType nodeTagType);\r
-  bool DeleteTag(const char* tag);\r
-  int RenameShaderTag(const char* oldtag, CopiedString newtag);\r
-  bool DeleteShaderTag(const char* shader, const char* tag);\r
-  void GetShaderTags(const char* shader, std::vector<CopiedString>& tags);\r
-  void GetUntagged(std::set<CopiedString>& shaders);\r
-  void GetAllTags(std::set<CopiedString>& tags);\r
-  void TagSearch(const char* expression, std::set<CopiedString>& paths);\r
-};\r
-\r
-#endif\r
+/*
+Copyright (C) 2006, Stefan Greven.
+All Rights Reserved.
+
+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 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
+*/
+
+#if !defined(INCLUDED_XMLTEXTAGS_H)
+#define INCLUDED_XMLTEXTAGS_H
+
+#include <set>
+#include <string/string.h>
+#include <vector>
+
+#include "iscriplib.h"
+
+#include <libxml/xpath.h>
+#include <libxml/xmlwriter.h>
+
+enum NodeTagType
+{
+  TAG,
+  EMPTY
+};
+
+enum NodeShaderType
+{
+  SHADER,
+  TEXTURE
+};
+
+enum TextureType
+{
+  STOCK,
+  CUSTOM
+};
+
+class XmlTagBuilder
+{
+private:
+  CopiedString m_savefilename;
+  xmlDocPtr doc;
+  xmlXPathContextPtr context;
+  xmlNodeSetPtr nodePtr;
+
+  xmlXPathObjectPtr XpathEval(const char* queryString)
+  {
+       xmlChar* expression = (xmlChar*)queryString;
+       xmlXPathObjectPtr result = xmlXPathEvalExpression(expression, context);
+       return result;
+  };
+
+  char* GetTagsXpathExpression(char* buffer, const char* shader, NodeTagType nodeTagType)
+  {
+       strcpy(buffer, "/root/*/*[@path='");
+       strcat(buffer, shader);
+       
+       switch(nodeTagType)
+       {
+       case TAG:
+               strcat(buffer, "']/tag");
+               break;
+       case EMPTY:
+               strcat(buffer, "']");
+       };
+
+       return buffer;
+  }
+
+public:
+  XmlTagBuilder();
+  ~XmlTagBuilder();
+
+  bool CreateXmlDocument();
+  bool OpenXmlDoc(const char* file, const char* savefile = 0);
+  bool SaveXmlDoc(const char* file);
+  bool SaveXmlDoc(void);
+  bool AddShaderNode(const char* shader, TextureType textureType, NodeShaderType nodeShaderType);
+  bool DeleteShaderNode(const char* shader);
+  bool CheckShaderTag(const char* shader);
+  bool CheckShaderTag(const char* shader, const char* content);
+  bool AddShaderTag(const char* shader, const char* content, NodeTagType nodeTagType);
+  bool DeleteTag(const char* tag);
+  int RenameShaderTag(const char* oldtag, CopiedString newtag);
+  bool DeleteShaderTag(const char* shader, const char* tag);
+  void GetShaderTags(const char* shader, std::vector<CopiedString>& tags);
+  void GetUntagged(std::set<CopiedString>& shaders);
+  void GetAllTags(std::set<CopiedString>& tags);
+  void TagSearch(const char* expression, std::set<CopiedString>& paths);
+};
+
+#endif
index ccac5e6..f6485f9 100644 (file)
@@ -1,17 +1,17 @@
-common/areaportal\r
-common/clip\r
-common/clusterportal\r
-common/cushion\r
-common/donotenter\r
-common/full_clip\r
-common/hint\r
-common/missileclip\r
-common/nodraw\r
-common/nodrawnonsolid\r
-common/nodrop\r
-common/noimpact\r
-common/origin\r
-common/trigger\r
-common/weapclip\r
-liquid\r
+common/areaportal
+common/clip
+common/clusterportal
+common/cushion
+common/donotenter
+common/full_clip
+common/hint
+common/missileclip
+common/nodraw
+common/nodrawnonsolid
+common/nodrop
+common/noimpact
+common/origin
+common/trigger
+common/weapclip
+liquid
 fog
\ No newline at end of file
index 5211a98..d52ef76 100644 (file)
@@ -1,5 +1,5 @@
-base_support/support1rust\r
-base_support/support1shiny\r
-base_support/support2rust\r
-base_support/wplat1_1\r
+base_support/support1rust
+base_support/support1shiny
+base_support/support2rust
+base_support/wplat1_1
 base_support/plate2_5
\ No newline at end of file
index 94b352f..6962998 100644 (file)
@@ -1,10 +1,10 @@
-base_door/shinymetaldoor\r
-base_door/shinymetaldoor_outside\r
-gothic_door/door02_bred\r
-gothic_door/door02_bred2_shiny\r
-gothic_door/door02_eblue2_shiny\r
-gothic_door/door02_i_ornate5_fin\r
-gothic_door/door02_j\r
-gothic_door/door02_j3\r
-gothic_door/door02_j4\r
+base_door/shinymetaldoor
+base_door/shinymetaldoor_outside
+gothic_door/door02_bred
+gothic_door/door02_bred2_shiny
+gothic_door/door02_eblue2_shiny
+gothic_door/door02_i_ornate5_fin
+gothic_door/door02_j
+gothic_door/door02_j3
+gothic_door/door02_j4
 gothic_door/door02_k2b
\ No newline at end of file
index 09488da..f0645b3 100644 (file)
@@ -1,14 +1,14 @@
-{\r
-       "entity" "misc_model"\r
-\r
-       "offset" "-16"\r
-\r
-       "model" "models/mapobjects/trees_sd/tree_a.md3"\r
-       "model" "models/mapobjects/trees_sd/tree_b.md3"\r
-       "model" "models/mapobjects/trees_sd/tree_c.md3"\r
-       "model" "models/mapobjects/trees_sd/tree_d.md3"\r
-\r
-       "pitch" "-5" "5"\r
-       "yaw" "0" "360"\r
-       "scale" "1" "1.3"\r
+{
+       "entity" "misc_model"
+
+       "offset" "-16"
+
+       "model" "models/mapobjects/trees_sd/tree_a.md3"
+       "model" "models/mapobjects/trees_sd/tree_b.md3"
+       "model" "models/mapobjects/trees_sd/tree_c.md3"
+       "model" "models/mapobjects/trees_sd/tree_d.md3"
+
+       "pitch" "-5" "5"
+       "yaw" "0" "360"
+       "scale" "1" "1.3"
 }
\ No newline at end of file
index 70e3691..7d05374 100644 (file)
-//Microsoft Developer Studio generated resource script.\r
-//\r
-#include "resource.h"\r
-\r
-#define APSTUDIO_READONLY_SYMBOLS\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 2 resource.\r
-//\r
-#include "afxres.h"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-#undef APSTUDIO_READONLY_SYMBOLS\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// English (U.S.) resources\r
-\r
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
-#ifdef _WIN32\r
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
-#pragma code_page(1252)\r
-#endif //_WIN32\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Icon\r
-//\r
-\r
-// Icon with lowest ID value placed first to ensure application icon\r
-// remains consistent on all systems.\r
-IDI_ICON1               ICON    DISCARDABLE     "icon1.ico"\r
-\r
-#ifdef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// TEXTINCLUDE\r
-//\r
-\r
-1 TEXTINCLUDE DISCARDABLE \r
-BEGIN\r
-    "resource.h\0"\r
-END\r
-\r
-2 TEXTINCLUDE DISCARDABLE \r
-BEGIN\r
-    "#include ""afxres.h""\r\n"\r
-    "\0"\r
-END\r
-\r
-3 TEXTINCLUDE DISCARDABLE \r
-BEGIN\r
-    "\r\n"\r
-    "\0"\r
-END\r
-\r
-#endif    // APSTUDIO_INVOKED\r
-\r
-\r
-#ifndef _MAC\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Version\r
-//\r
-\r
-VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 1,0,0,1\r
- PRODUCTVERSION 1,0,0,1\r
- FILEFLAGSMASK 0x3fL\r
-#ifdef _DEBUG\r
- FILEFLAGS 0x1L\r
-#else\r
- FILEFLAGS 0x0L\r
-#endif\r
- FILEOS 0x40004L\r
- FILETYPE 0x1L\r
- FILESUBTYPE 0x0L\r
-BEGIN\r
-    BLOCK "StringFileInfo"\r
-    BEGIN\r
-        BLOCK "040904b0"\r
-        BEGIN\r
-            VALUE "Comments", "Heavily modified from original ID tool\0"\r
-            VALUE "CompanyName", "Raven Software\0"\r
-            VALUE "FileDescription", "qdata\0"\r
-            VALUE "FileVersion", "2.0\0"\r
-            VALUE "InternalName", "qdata\0"\r
-            VALUE "LegalCopyright", "Copyright © 1998\0"\r
-            VALUE "OriginalFilename", "qdata.exe\0"\r
-            VALUE "ProductName", "Raven Software qdata\0"\r
-            VALUE "ProductVersion", "2.0\0"\r
-        END\r
-    END\r
-    BLOCK "VarFileInfo"\r
-    BEGIN\r
-        VALUE "Translation", 0x409, 1200\r
-    END\r
-END\r
-\r
-#endif    // !_MAC\r
-\r
-#endif    // English (U.S.) resources\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-\r
-#ifndef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 3 resource.\r
-//\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-#endif    // not APSTUDIO_INVOKED\r
-\r
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "icon1.ico"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "Heavily modified from original ID tool\0"
+            VALUE "CompanyName", "Raven Software\0"
+            VALUE "FileDescription", "qdata\0"
+            VALUE "FileVersion", "2.0\0"
+            VALUE "InternalName", "qdata\0"
+            VALUE "LegalCopyright", "Copyright © 1998\0"
+            VALUE "OriginalFilename", "qdata.exe\0"
+            VALUE "ProductName", "Raven Software qdata\0"
+            VALUE "ProductVersion", "2.0\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
index d6bae51..e91fdb7 100644 (file)
-/* -------------------------------------------------------------------------------\r
-\r
-Copyright (C) 1999-2006 Id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-----------------------------------------------------------------------------------\r
-\r
-This code has been altered significantly from its original form, to support\r
-several games based on the Quake III Arena engine, in the form of "Q3Map2."\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-\r
-\r
-/* marker */\r
-#ifndef GAME_DARKPLACES_H\r
-#define GAME_DARKPLACES_H\r
-\r
-/* content and surface flags get form quake3 */\r
-\r
-/* -------------------------------------------------------------------------------\r
-\r
-game_t struct\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-{\r
-       "darkplaces",           /* -game x */\r
-       "id1",                          /* default base game data dir */\r
-       ".darkplaces ",         /* unix home sub-dir */\r
-       "darkplaces",           /* magic path word */\r
-       "scripts",                      /* shader directory */\r
-       999,                            /* max lightmapped surface verts */\r
-       999,                            /* max surface verts */\r
-       6000,                           /* max surface indexes */\r
-       qfalse,                         /* flares */\r
-       "flareshader",          /* default flare shader */\r
-       qfalse,                         /* wolf lighting model? */\r
-       128,                            /* lightmap width/height */\r
-       1.0f,                           /* lightmap gamma */\r
-       200.0f,                         /* lightmap exposure */\r
-       1.0f,                           /* lightmap compensate */\r
-       0.3f,                           /* lightgrid scale */\r
-       0.6f,                           /* lightgrid ambient scale */\r
-       qfalse,                         /* light angle attenuation uses half-lambert curve */\r
-       qtrue,                          /* disable shader lightstyles hack */\r
-       qtrue,                          /* keep light entities on bsp */\r
-       4,                                      /* default patchMeta subdivisions tolerance */\r
-       qfalse,                         /* patch casting enabled */\r
-       qfalse,                         /* compile deluxemaps */\r
-       0,                                      /* deluxemaps default mode */\r
-       512,                /* minimap size */\r
-       1.0f,               /* minimap sharpener */\r
-       0.0f,               /* minimap border */\r
-       qtrue,              /* minimap keep aspect */\r
-       MINIMAP_MODE_GRAY,  /* minimap mode */\r
-       "%s.tga",           /* minimap name format */\r
-       "IBSP",                         /* bsp file prefix */\r
-       46,                                     /* bsp file version */\r
-       qfalse,                         /* cod-style lump len/ofs order */\r
-       LoadIBSPFile,           /* bsp load function */\r
-       WriteIBSPFile,          /* bsp write function */\r
-\r
-       {\r
-               /* name                         contentFlags                            contentFlagsClear                       surfaceFlags                            surfaceFlagsClear                       compileFlags                            compileFlagsClear */\r
-               \r
-               /* default */\r
-               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },\r
-               \r
-               \r
-               /* ydnar */\r
-               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },\r
-               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },\r
-               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },\r
-               \r
-               \r
-               /* compiler */\r
-               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },\r
-               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },\r
-               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },\r
-               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },\r
-               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },\r
-               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },\r
-               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },\r
-               \r
-               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },\r
-               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },\r
-               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               \r
-               \r
-               /* game */\r
-               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },\r
-               \r
-               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "water",                      Q_CONT_WATER,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "slime",                      Q_CONT_SLIME,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "lava",                       Q_CONT_LAVA,                            Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               \r
-               { "playerclip",         Q_CONT_PLAYERCLIP,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "monsterclip",        Q_CONT_MONSTERCLIP,                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },\r
-               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },\r
-               \r
-               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },\r
-               \r
-               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },\r
-               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },\r
-               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },\r
-               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },\r
-               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },\r
-               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },\r
-               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },\r
-               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },\r
-               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },\r
-               \r
-               \r
-               /* null */\r
-               { NULL, 0, 0, 0, 0, 0, 0 }\r
-       }\r
-}\r
-\r
-\r
-\r
-/* end marker */\r
-#endif\r
-\r
+/* -------------------------------------------------------------------------------
+
+Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+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 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
+
+----------------------------------------------------------------------------------
+
+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."
+
+------------------------------------------------------------------------------- */
+
+
+
+/* marker */
+#ifndef GAME_DARKPLACES_H
+#define GAME_DARKPLACES_H
+
+/* content and surface flags get form quake3 */
+
+/* -------------------------------------------------------------------------------
+
+game_t struct
+
+------------------------------------------------------------------------------- */
+
+{
+       "darkplaces",           /* -game x */
+       "id1",                          /* default base game data dir */
+       ".darkplaces ",         /* unix home sub-dir */
+       "darkplaces",           /* magic path word */
+       "scripts",                      /* shader directory */
+       999,                            /* 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 */
+       200.0f,                         /* lightmap exposure */
+       1.0f,                           /* lightmap compensate */
+       0.3f,                           /* lightgrid scale */
+       0.6f,                           /* lightgrid ambient scale */
+       qfalse,                         /* light angle attenuation uses half-lambert curve */
+       qtrue,                          /* disable shader lightstyles hack */
+       qtrue,                          /* keep light entities on bsp */
+       4,                                      /* 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_GRAY,  /* minimap mode */
+       "%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 */
+               
+               /* default */
+               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },
+               
+               
+               /* ydnar */
+               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },
+               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },
+               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },
+               
+               
+               /* compiler */
+               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },
+               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },
+               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },
+               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },
+               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },
+               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },
+               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },
+               
+               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },
+               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },
+               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               
+               
+               /* game */
+               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },
+               
+               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "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_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 },
+               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },
+               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },
+               
+               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },
+               
+               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },
+               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },
+               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },
+               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },
+               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },
+               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },
+               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },
+               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },
+               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },
+               
+               
+               /* null */
+               { NULL, 0, 0, 0, 0, 0, 0 }
+       }
+}
+
+
+
+/* end marker */
+#endif
+
index 1c42633..97d2d6d 100644 (file)
-/* -------------------------------------------------------------------------------\r
-\r
-Copyright (C) 1999-2006 Id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-----------------------------------------------------------------------------------\r
-\r
-This code has been altered significantly from its original form, to support\r
-several games based on the Quake III Arena engine, in the form of "Q3Map2."\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-\r
-\r
-/* marker */\r
-#ifndef GAME_DQ_H\r
-#define GAME_DQ_H\r
-\r
-/* content and surface flags get form quake3 */\r
-\r
-/* -------------------------------------------------------------------------------\r
-\r
-game_t struct\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-{\r
-       "dq",                           /* -game x */\r
-       "basedq",                       /* default base game data dir */\r
-       ".dq",                          /* unix home sub-dir */\r
-       "dq",                           /* magic path word */\r
-       "scripts",                      /* shader directory */\r
-       64,                                     /* max lightmapped surface verts */\r
-       999,                            /* max surface verts */\r
-       6000,                           /* max surface indexes */\r
-       qfalse,                         /* flares */\r
-       "flareshader",          /* default flare shader */\r
-       qfalse,                         /* wolf lighting model? */\r
-       128,                            /* lightmap width/height */\r
-       1.2f,                           /* lightmap gamma */\r
-       200.0f,                         /* lightmap exposure */\r
-       1.0f,                           /* lightmap compensate */\r
-       0.3f,                           /* lightgrid scale */\r
-       0.6f,                           /* lightgrid ambient scale */\r
-       qfalse,                         /* light angle attenuation uses half-lambert curve */\r
-       qtrue,                          /* disable shader lightstyles hack */\r
-       qtrue,                          /* keep light entities on bsp */\r
-       4,                                      /* default patchMeta subdivisions tolerance */\r
-       qtrue,                          /* patch casting enabled */\r
-       qtrue,                          /* compile deluxemaps */\r
-       1,                                      /* deluxemaps default mode */\r
-       512,                /* minimap size */\r
-       1.0f,               /* minimap sharpener */\r
-       0.0f,               /* minimap border */\r
-       qtrue,              /* minimap keep aspect */\r
-       MINIMAP_MODE_GRAY,  /* minimap mode */\r
-       "%s.tga",           /* minimap name format */\r
-       "IBSP",                         /* bsp file prefix */\r
-       46,                                     /* bsp file version */\r
-       qfalse,                         /* cod-style lump len/ofs order */\r
-       LoadIBSPFile,           /* bsp load function */\r
-       WriteIBSPFile,          /* bsp write function */\r
-\r
-       {\r
-               /* name                         contentFlags                            contentFlagsClear                       surfaceFlags                            surfaceFlagsClear                       compileFlags                            compileFlagsClear */\r
-               \r
-               /* default */\r
-               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },\r
-               \r
-               \r
-               /* ydnar */\r
-               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },\r
-               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },\r
-               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },\r
-               \r
-               \r
-               /* compiler */\r
-               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },\r
-               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },\r
-               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },\r
-               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },\r
-               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },\r
-               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },\r
-               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },\r
-               \r
-               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },\r
-               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },\r
-               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               \r
-               \r
-               /* game */\r
-               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },\r
-               \r
-               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "water",                      Q_CONT_WATER,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "slime",                      Q_CONT_SLIME,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "lava",                       Q_CONT_LAVA,                            Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               \r
-               { "playerclip",         Q_CONT_PLAYERCLIP,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "monsterclip",        Q_CONT_MONSTERCLIP,                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },\r
-               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },\r
-               \r
-               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },\r
-               \r
-               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },\r
-               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },\r
-               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },\r
-               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },\r
-               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },\r
-               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },\r
-               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },\r
-               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },\r
-               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },\r
-               \r
-               \r
-               /* null */\r
-               { NULL, 0, 0, 0, 0, 0, 0 }\r
-       }\r
-}\r
-\r
-\r
-\r
-/* end marker */\r
-#endif\r
-\r
+/* -------------------------------------------------------------------------------
+
+Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+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 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
+
+----------------------------------------------------------------------------------
+
+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."
+
+------------------------------------------------------------------------------- */
+
+
+
+/* marker */
+#ifndef GAME_DQ_H
+#define GAME_DQ_H
+
+/* content and surface flags get form quake3 */
+
+/* -------------------------------------------------------------------------------
+
+game_t struct
+
+------------------------------------------------------------------------------- */
+
+{
+       "dq",                           /* -game x */
+       "basedq",                       /* default base game data dir */
+       ".dq",                          /* unix home sub-dir */
+       "dq",                           /* 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.2f,                           /* lightmap gamma */
+       200.0f,                         /* lightmap exposure */
+       1.0f,                           /* lightmap compensate */
+       0.3f,                           /* lightgrid scale */
+       0.6f,                           /* lightgrid ambient scale */
+       qfalse,                         /* light angle attenuation uses half-lambert curve */
+       qtrue,                          /* disable shader lightstyles hack */
+       qtrue,                          /* keep light entities on bsp */
+       4,                                      /* default patchMeta subdivisions tolerance */
+       qtrue,                          /* patch casting enabled */
+       qtrue,                          /* compile deluxemaps */
+       1,                                      /* deluxemaps default mode */
+       512,                /* minimap size */
+       1.0f,               /* minimap sharpener */
+       0.0f,               /* minimap border */
+       qtrue,              /* minimap keep aspect */
+       MINIMAP_MODE_GRAY,  /* minimap mode */
+       "%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 */
+               
+               /* default */
+               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },
+               
+               
+               /* ydnar */
+               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },
+               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },
+               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },
+               
+               
+               /* compiler */
+               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },
+               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },
+               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },
+               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },
+               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },
+               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },
+               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },
+               
+               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },
+               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },
+               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               
+               
+               /* game */
+               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },
+               
+               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "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_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 },
+               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },
+               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },
+               
+               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },
+               
+               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },
+               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },
+               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },
+               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },
+               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },
+               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },
+               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },
+               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },
+               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },
+               
+               
+               /* null */
+               { NULL, 0, 0, 0, 0, 0, 0 }
+       }
+}
+
+
+
+/* end marker */
+#endif
+
index 704c997..60e299d 100644 (file)
-/* -------------------------------------------------------------------------------\r
-\r
-Copyright (C) 1999-2006 Id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-----------------------------------------------------------------------------------\r
-\r
-This code has been altered significantly from its original form, to support\r
-several games based on the Quake III Arena engine, in the form of "Q3Map2."\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-\r
-\r
-/* marker */\r
-#ifndef GAME_PROPHECY_H\r
-#define GAME_PROPHECY_H\r
-\r
-/* content and surface flags get form quake3 */\r
-\r
-/* -------------------------------------------------------------------------------\r
-\r
-game_t struct\r
-\r
-------------------------------------------------------------------------------- */\r
-\r
-{\r
-       "prophecy",                     /* -game x */\r
-       "base",                         /* default base game data dir */\r
-       ".prophecy",            /* unix home sub-dir */\r
-       "prophecy",                     /* magic path word */\r
-       "scripts",                      /* shader directory */\r
-       64,                                     /* max lightmapped surface verts */\r
-       999,                            /* max surface verts */\r
-       6000,                           /* max surface indexes */\r
-       qfalse,                         /* flares */\r
-       "flareshader",          /* default flare shader */\r
-       qfalse,                         /* wolf lighting model? */\r
-       128,                            /* lightmap width/height */\r
-       1.0f,                           /* lightmap gamma */\r
-       200.0f,                         /* lightmap exposure */\r
-       1.0f,                           /* lightmap compensate */\r
-       0.4f,                           /* lightgrid scale */\r
-       0.6f,                           /* lightgrid ambient scale */\r
-       qfalse,                         /* light angle attenuation uses half-lambert curve */\r
-       qtrue,                          /* disable shader lightstyles hack */\r
-       qtrue,                          /* keep light entities on bsp */\r
-       4,                                      /* default patchMeta subdivisions tolerance */\r
-       qtrue,                          /* patch casting enabled */\r
-       qtrue,                          /* compile deluxemaps */\r
-       0,                                      /* deluxemaps default mode */\r
-       512,                /* minimap size */\r
-       1.0f,               /* minimap sharpener */\r
-       0.0f,               /* minimap border */\r
-       qtrue,              /* minimap keep aspect */\r
-       MINIMAP_MODE_GRAY,  /* minimap mode */\r
-       "%s.tga",           /* minimap name format */\r
-       "IBSP",                         /* bsp file prefix */\r
-       46,                                     /* bsp file version */\r
-       qfalse,                         /* cod-style lump len/ofs order */\r
-       LoadIBSPFile,           /* bsp load function */\r
-       WriteIBSPFile,          /* bsp write function */\r
-\r
-       {\r
-               /* name                         contentFlags                            contentFlagsClear                       surfaceFlags                            surfaceFlagsClear                       compileFlags                            compileFlagsClear */\r
-               \r
-               /* default */\r
-               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },\r
-               \r
-               \r
-               /* ydnar */\r
-               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },\r
-               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },\r
-               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },\r
-               \r
-               \r
-               /* compiler */\r
-               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },\r
-               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },\r
-               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },\r
-               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },\r
-               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },\r
-               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },\r
-               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },\r
-               \r
-               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },\r
-               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },\r
-               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },\r
-               \r
-               \r
-               /* game */\r
-               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },\r
-               \r
-               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "water",                      Q_CONT_WATER,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "slime",                      Q_CONT_SLIME,                           Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               { "lava",                       Q_CONT_LAVA,                            Q_CONT_SOLID,                           0,                                                      0,                                                      C_LIQUID | C_TRANSLUCENT,       C_SOLID },\r
-               \r
-               { "playerclip",         Q_CONT_PLAYERCLIP,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "monsterclip",        Q_CONT_MONSTERCLIP,                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_DETAIL | C_TRANSLUCENT,       C_SOLID },\r
-               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },\r
-               \r
-               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },\r
-               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },\r
-               \r
-               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },\r
-               \r
-               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },\r
-               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },\r
-               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },\r
-               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },\r
-               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },\r
-               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },\r
-               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },\r
-               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },\r
-               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },\r
-               \r
-               \r
-               /* null */\r
-               { NULL, 0, 0, 0, 0, 0, 0 }\r
-       }\r
-}\r
-\r
-\r
-\r
-/* end marker */\r
-#endif\r
-\r
+/* -------------------------------------------------------------------------------
+
+Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+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 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
+
+----------------------------------------------------------------------------------
+
+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."
+
+------------------------------------------------------------------------------- */
+
+
+
+/* marker */
+#ifndef GAME_PROPHECY_H
+#define GAME_PROPHECY_H
+
+/* content and surface flags get form quake3 */
+
+/* -------------------------------------------------------------------------------
+
+game_t struct
+
+------------------------------------------------------------------------------- */
+
+{
+       "prophecy",                     /* -game x */
+       "base",                         /* default base game data dir */
+       ".prophecy",            /* unix home sub-dir */
+       "prophecy",                     /* 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 */
+       200.0f,                         /* lightmap exposure */
+       1.0f,                           /* lightmap compensate */
+       0.4f,                           /* lightgrid scale */
+       0.6f,                           /* lightgrid ambient scale */
+       qfalse,                         /* light angle attenuation uses half-lambert curve */
+       qtrue,                          /* disable shader lightstyles hack */
+       qtrue,                          /* keep light entities on bsp */
+       4,                                      /* default patchMeta subdivisions tolerance */
+       qtrue,                          /* patch casting enabled */
+       qtrue,                          /* compile deluxemaps */
+       0,                                      /* deluxemaps default mode */
+       512,                /* minimap size */
+       1.0f,               /* minimap sharpener */
+       0.0f,               /* minimap border */
+       qtrue,              /* minimap keep aspect */
+       MINIMAP_MODE_GRAY,  /* minimap mode */
+       "%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 */
+               
+               /* default */
+               { "default",            Q_CONT_SOLID,                           -1,                                                     0,                                                      -1,                                                     C_SOLID,                                        -1 },
+               
+               
+               /* ydnar */
+               { "lightgrid",          0,                                                      0,                                                      0,                                                      0,                                                      C_LIGHTGRID,                            0 },
+               { "antiportal",         0,                                                      0,                                                      0,                                                      0,                                                      C_ANTIPORTAL,                           0 },
+               { "skip",                       0,                                                      0,                                                      0,                                                      0,                                                      C_SKIP,                                         0 },
+               
+               
+               /* compiler */
+               { "origin",                     Q_CONT_ORIGIN,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_ORIGIN | C_TRANSLUCENT,       C_SOLID },
+               { "areaportal",         Q_CONT_AREAPORTAL,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_AREAPORTAL | C_TRANSLUCENT,   C_SOLID },
+               { "trans",                      Q_CONT_TRANSLUCENT,                     0,                                                      0,                                                      0,                                                      C_TRANSLUCENT,                          0 },
+               { "detail",                     Q_CONT_DETAIL,                          0,                                                      0,                                                      0,                                                      C_DETAIL,                                       0 },
+               { "structural",         Q_CONT_STRUCTURAL,                      0,                                                      0,                                                      0,                                                      C_STRUCTURAL,                           0 },
+               { "hint",                       0,                                                      0,                                                      Q_SURF_HINT,                            0,                                                      C_HINT,                                         0 },
+               { "nodraw",                     0,                                                      0,                                                      Q_SURF_NODRAW,                          0,                                                      C_NODRAW,                                       0 },
+               
+               { "alphashadow",        0,                                                      0,                                                      Q_SURF_ALPHASHADOW,                     0,                                                      C_ALPHASHADOW | C_TRANSLUCENT,  0 },
+               { "lightfilter",        0,                                                      0,                                                      Q_SURF_LIGHTFILTER,                     0,                                                      C_LIGHTFILTER | C_TRANSLUCENT,  0 },
+               { "nolightmap",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               { "pointlight",         0,                                                      0,                                                      Q_SURF_VERTEXLIT,                       0,                                                      C_VERTEXLIT,                            0 },
+               
+               
+               /* game */
+               { "nonsolid",           0,                                                      Q_CONT_SOLID,                           Q_SURF_NONSOLID,                        0,                                                      0,                                                      C_SOLID },
+               
+               { "trigger",            Q_CONT_TRIGGER,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "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_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 },
+               { "nodrop",                     Q_CONT_NODROP,                          Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "clusterportal",      Q_CONT_CLUSTERPORTAL,           Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "donotenter",         Q_CONT_DONOTENTER,                      Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               { "botclip",            Q_CONT_BOTCLIP,                         Q_CONT_SOLID,                           0,                                                      0,                                                      C_TRANSLUCENT,                          C_SOLID },
+               
+               { "fog",                        Q_CONT_FOG,                                     Q_CONT_SOLID,                           0,                                                      0,                                                      C_FOG,                                          C_SOLID },
+               { "sky",                        0,                                                      0,                                                      Q_SURF_SKY,                                     0,                                                      C_SKY,                                          0 },
+               
+               { "slick",                      0,                                                      0,                                                      Q_SURF_SLICK,                           0,                                                      0,                                                      0 },
+               
+               { "noimpact",           0,                                                      0,                                                      Q_SURF_NOIMPACT,                        0,                                                      0,                                                      0 },
+               { "nomarks",            0,                                                      0,                                                      Q_SURF_NOMARKS,                         0,                                                      C_NOMARKS,                                      0 },
+               { "ladder",                     0,                                                      0,                                                      Q_SURF_LADDER,                          0,                                                      0,                                                      0 },
+               { "nodamage",           0,                                                      0,                                                      Q_SURF_NODAMAGE,                        0,                                                      0,                                                      0 },
+               { "metalsteps",         0,                                                      0,                                                      Q_SURF_METALSTEPS,                      0,                                                      0,                                                      0 },
+               { "flesh",                      0,                                                      0,                                                      Q_SURF_FLESH,                           0,                                                      0,                                                      0 },
+               { "nosteps",            0,                                                      0,                                                      Q_SURF_NOSTEPS,                         0,                                                      0,                                                      0 },
+               { "nodlight",           0,                                                      0,                                                      Q_SURF_NODLIGHT,                        0,                                                      0,                                                      0 },
+               { "dust",                       0,                                                      0,                                                      Q_SURF_DUST,                            0,                                                      0,                                                      0 },
+               
+               
+               /* null */
+               { NULL, 0, 0, 0, 0, 0, 0 }
+       }
+}
+
+
+
+/* end marker */
+#endif
+
index 78cf7b3..bc12037 100644 (file)
@@ -1 +1 @@
-101                     ICON    DISCARDABLE     "q3map2.ico"\r
+101                     ICON    DISCARDABLE     "q3map2.ico"
index 47b5197..0df87e4 100644 (file)
@@ -1,8 +1,8 @@
-Index: light.c\r
-===================================================================\r
---- light.c    (revision 158)\r
-+++ light.c    (working copy)\r
-@@ -357,12 +365,13 @@\r
+Index: light.c
+===================================================================
+--- light.c    (revision 158)
++++ light.c    (working copy)
+@@ -357,12 +365,13 @@
                intensity *= scale;
                
                /* ydnar: get deviance and samples */