From 54ccfc9f180845560040c0e0f17afb545fe928f7 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 17 Apr 2010 21:02:26 +0200 Subject: [PATCH] fix lots of CRLFs --- .gitattributes | 6 +- contrib/bkgrnd2d/bkgrnd2d.def | 16 +- contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt | 262 ++-- contrib/brushexport/brushexport.def | 14 +- contrib/brushexport/plugin.h | 50 +- contrib/shaderplug/shaderplug.cpp | 526 ++++---- contrib/shaderplug/shaderplug.def | 14 +- contrib/shaderplug/shaderplug.h | 54 +- contrib/sunplug/sunplug.cpp | 924 ++++++------- contrib/sunplug/sunplug.def | 14 +- contrib/sunplug/sunplug.h | 50 +- generic_cpp.py | 80 +- generic_h.py | 82 +- libs/cmdlib/.cvswrappers | 6 +- libs/jpeg6/.cvswrappers | 6 +- libs/xml/xmltextags.cpp | 1194 ++++++++--------- libs/xml/xmltextags.h | 212 +-- setup/data/tools/plugins/bt/bt-el1.txt | 32 +- setup/data/tools/plugins/bt/door-tex-trim.txt | 8 +- setup/data/tools/plugins/bt/door-tex.txt | 18 +- setup/data/tools/plugins/bt/tp_ent.txt | 26 +- tools/quake2/qdata_heretic2/script1.rc | 230 ++-- tools/quake3/q3map2/game_darkplaces.h | 300 ++--- tools/quake3/q3map2/game_dq.h | 300 ++--- tools/quake3/q3map2/game_prophecy.h | 300 ++--- tools/quake3/q3map2/q3map2.rc | 2 +- .../q3map2_fsr_svn158.patch | 10 +- 27 files changed, 2368 insertions(+), 2368 deletions(-) diff --git a/.gitattributes b/.gitattributes index edd30fd..67420ef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/contrib/bkgrnd2d/bkgrnd2d.def b/contrib/bkgrnd2d/bkgrnd2d.def index 36c4457..fa90fdb 100644 --- a/contrib/bkgrnd2d/bkgrnd2d.def +++ b/contrib/bkgrnd2d/bkgrnd2d.def @@ -1,8 +1,8 @@ -; 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 +; 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 diff --git a/contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt b/contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt index 6184245..c1e401c 100644 --- a/contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt +++ b/contrib/bkgrnd2d/readme_bkgrnd2d-b0.25.txt @@ -1,131 +1,131 @@ -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 - +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 + diff --git a/contrib/brushexport/brushexport.def b/contrib/brushexport/brushexport.def index 44d97f3..2174016 100644 --- a/contrib/brushexport/brushexport.def +++ b/contrib/brushexport/brushexport.def @@ -1,7 +1,7 @@ -; brushexport.def : Declares the module parameters for the DLL. - -LIBRARY "BRUSHEXPORT" - -EXPORTS - ; Explicit exports can go here - Radiant_RegisterModules @1 +; brushexport.def : Declares the module parameters for the DLL. + +LIBRARY "BRUSHEXPORT" + +EXPORTS + ; Explicit exports can go here + Radiant_RegisterModules @1 diff --git a/contrib/brushexport/plugin.h b/contrib/brushexport/plugin.h index 9939681..da0faa1 100644 --- a/contrib/brushexport/plugin.h +++ b/contrib/brushexport/plugin.h @@ -1,25 +1,25 @@ -/* -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 +/* +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 diff --git a/contrib/shaderplug/shaderplug.cpp b/contrib/shaderplug/shaderplug.cpp index facb382..6554790 100644 --- a/contrib/shaderplug/shaderplug.cpp +++ b/contrib/shaderplug/shaderplug.cpp @@ -1,263 +1,263 @@ -/* -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 -#include -#include "string/string.h" -#include "modulesystem/singletonmodule.h" -#include "stream/stringstream.h" -#include "os/file.h" - -#include - -#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 archives; - std::set shaders; - std::set 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 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::iterator iter; - iter = shaders.find(buffer); - - // a shader with this name already exists - if(iter == shaders.end()) - { - textures.insert(buffer); - } - } - - typedef FreeCaller1 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 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::reverse_iterator r_iter; - - for(r_iter = textures.rbegin(); r_iter != textures.rend(); ++r_iter) - { - TagBuilder.AddShaderNode(const_cast((*r_iter).c_str()), STOCK, TEXTURE); - } - - for(r_iter = shaders.rbegin(); r_iter != shaders.rend(); ++r_iter) - { - TagBuilder.AddShaderNode(const_cast((*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 SingletonShaderPluginModule; - -SingletonShaderPluginModule g_ShaderPluginModule; - -extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server) -{ - initialiseModule(server); - - g_ShaderPluginModule.selfRegister(); -} - - - - +/* +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 +#include +#include "string/string.h" +#include "modulesystem/singletonmodule.h" +#include "stream/stringstream.h" +#include "os/file.h" + +#include + +#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 archives; + std::set shaders; + std::set 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 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::iterator iter; + iter = shaders.find(buffer); + + // a shader with this name already exists + if(iter == shaders.end()) + { + textures.insert(buffer); + } + } + + typedef FreeCaller1 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 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::reverse_iterator r_iter; + + for(r_iter = textures.rbegin(); r_iter != textures.rend(); ++r_iter) + { + TagBuilder.AddShaderNode(const_cast((*r_iter).c_str()), STOCK, TEXTURE); + } + + for(r_iter = shaders.rbegin(); r_iter != shaders.rend(); ++r_iter) + { + TagBuilder.AddShaderNode(const_cast((*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 SingletonShaderPluginModule; + +SingletonShaderPluginModule g_ShaderPluginModule; + +extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server) +{ + initialiseModule(server); + + g_ShaderPluginModule.selfRegister(); +} + + + + diff --git a/contrib/shaderplug/shaderplug.def b/contrib/shaderplug/shaderplug.def index be71ca5..a31ee3b 100644 --- a/contrib/shaderplug/shaderplug.def +++ b/contrib/shaderplug/shaderplug.def @@ -1,7 +1,7 @@ -; shaderplug.def : Declares the module parameters for the DLL. - -LIBRARY "SHADERPLUG" - -EXPORTS - ; Explicit exports can go here - Radiant_RegisterModules @1 +; shaderplug.def : Declares the module parameters for the DLL. + +LIBRARY "SHADERPLUG" + +EXPORTS + ; Explicit exports can go here + Radiant_RegisterModules @1 diff --git a/contrib/shaderplug/shaderplug.h b/contrib/shaderplug/shaderplug.h index 4842cc2..7ee45fd 100644 --- a/contrib/shaderplug/shaderplug.h +++ b/contrib/shaderplug/shaderplug.h @@ -1,27 +1,27 @@ -/* -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 +/* +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 diff --git a/contrib/sunplug/sunplug.cpp b/contrib/sunplug/sunplug.cpp index b3e33b1..fa00542 100644 --- a/contrib/sunplug/sunplug.cpp +++ b/contrib/sunplug/sunplug.cpp @@ -1,462 +1,462 @@ -/* -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 // 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 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 -} +/* +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 // 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 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 +} diff --git a/contrib/sunplug/sunplug.def b/contrib/sunplug/sunplug.def index 6d26077..1f1dfb1 100644 --- a/contrib/sunplug/sunplug.def +++ b/contrib/sunplug/sunplug.def @@ -1,7 +1,7 @@ -; sunplug.def : Declares the module parameters for the DLL. - -LIBRARY "SUNPLUG" - -EXPORTS - ; Explicit exports can go here - Radiant_RegisterModules @1 +; sunplug.def : Declares the module parameters for the DLL. + +LIBRARY "SUNPLUG" + +EXPORTS + ; Explicit exports can go here + Radiant_RegisterModules @1 diff --git a/contrib/sunplug/sunplug.h b/contrib/sunplug/sunplug.h index 9649a74..fafdc89 100644 --- a/contrib/sunplug/sunplug.h +++ b/contrib/sunplug/sunplug.h @@ -1,25 +1,25 @@ -/* -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_ +/* +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_ diff --git a/generic_cpp.py b/generic_cpp.py index 44c78d3..62d51ed 100644 --- a/generic_cpp.py +++ b/generic_cpp.py @@ -1,40 +1,40 @@ -# 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) +# 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) diff --git a/generic_h.py b/generic_h.py index 337f3b0..9f8b7e9 100644 --- a/generic_h.py +++ b/generic_h.py @@ -1,41 +1,41 @@ -# 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) +# 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) diff --git a/libs/cmdlib/.cvswrappers b/libs/cmdlib/.cvswrappers index cdfd6d4..ed97d40 100644 --- a/libs/cmdlib/.cvswrappers +++ b/libs/cmdlib/.cvswrappers @@ -1,3 +1,3 @@ -*.dsp -m 'COPY' -k 'b' -*.dsw -m 'COPY' -k 'b' -*.scc -m 'COPY' -k 'b' +*.dsp -m 'COPY' -k 'b' +*.dsw -m 'COPY' -k 'b' +*.scc -m 'COPY' -k 'b' diff --git a/libs/jpeg6/.cvswrappers b/libs/jpeg6/.cvswrappers index cdfd6d4..ed97d40 100644 --- a/libs/jpeg6/.cvswrappers +++ b/libs/jpeg6/.cvswrappers @@ -1,3 +1,3 @@ -*.dsp -m 'COPY' -k 'b' -*.dsw -m 'COPY' -k 'b' -*.scc -m 'COPY' -k 'b' +*.dsp -m 'COPY' -k 'b' +*.dsw -m 'COPY' -k 'b' +*.scc -m 'COPY' -k 'b' diff --git a/libs/xml/xmltextags.cpp b/libs/xml/xmltextags.cpp index 4ab2c6c..c30f986 100644 --- a/libs/xml/xmltextags.cpp +++ b/libs/xml/xmltextags.cpp @@ -1,597 +1,597 @@ -/* -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 - -#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 node content that sould be changed - char* newtag - the new 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 dellist; - TagSearch(expression, dellist); - std::set::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& 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& 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& 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& 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); -} - +/* +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 + +#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 node content that sould be changed + char* newtag - the new 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 dellist; + TagSearch(expression, dellist); + std::set::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& 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& 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& 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& 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); +} + diff --git a/libs/xml/xmltextags.h b/libs/xml/xmltextags.h index 047fbd7..afbc4bd 100644 --- a/libs/xml/xmltextags.h +++ b/libs/xml/xmltextags.h @@ -1,106 +1,106 @@ -/* -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 -#include -#include - -#include "iscriplib.h" - -#include -#include - -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& tags); - void GetUntagged(std::set& shaders); - void GetAllTags(std::set& tags); - void TagSearch(const char* expression, std::set& paths); -}; - -#endif +/* +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 +#include +#include + +#include "iscriplib.h" + +#include +#include + +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& tags); + void GetUntagged(std::set& shaders); + void GetAllTags(std::set& tags); + void TagSearch(const char* expression, std::set& paths); +}; + +#endif diff --git a/setup/data/tools/plugins/bt/bt-el1.txt b/setup/data/tools/plugins/bt/bt-el1.txt index ccac5e6..f6485f9 100644 --- a/setup/data/tools/plugins/bt/bt-el1.txt +++ b/setup/data/tools/plugins/bt/bt-el1.txt @@ -1,17 +1,17 @@ -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 +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 diff --git a/setup/data/tools/plugins/bt/door-tex-trim.txt b/setup/data/tools/plugins/bt/door-tex-trim.txt index 5211a98..d52ef76 100644 --- a/setup/data/tools/plugins/bt/door-tex-trim.txt +++ b/setup/data/tools/plugins/bt/door-tex-trim.txt @@ -1,5 +1,5 @@ -base_support/support1rust -base_support/support1shiny -base_support/support2rust -base_support/wplat1_1 +base_support/support1rust +base_support/support1shiny +base_support/support2rust +base_support/wplat1_1 base_support/plate2_5 \ No newline at end of file diff --git a/setup/data/tools/plugins/bt/door-tex.txt b/setup/data/tools/plugins/bt/door-tex.txt index 94b352f..6962998 100644 --- a/setup/data/tools/plugins/bt/door-tex.txt +++ b/setup/data/tools/plugins/bt/door-tex.txt @@ -1,10 +1,10 @@ -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 +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 diff --git a/setup/data/tools/plugins/bt/tp_ent.txt b/setup/data/tools/plugins/bt/tp_ent.txt index 09488da..f0645b3 100644 --- a/setup/data/tools/plugins/bt/tp_ent.txt +++ b/setup/data/tools/plugins/bt/tp_ent.txt @@ -1,14 +1,14 @@ -{ - "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" +{ + "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 diff --git a/tools/quake2/qdata_heretic2/script1.rc b/tools/quake2/qdata_heretic2/script1.rc index 70e3691..7d05374 100644 --- a/tools/quake2/qdata_heretic2/script1.rc +++ b/tools/quake2/qdata_heretic2/script1.rc @@ -1,115 +1,115 @@ -//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 - +//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 + diff --git a/tools/quake3/q3map2/game_darkplaces.h b/tools/quake3/q3map2/game_darkplaces.h index d6bae51..e91fdb7 100644 --- a/tools/quake3/q3map2/game_darkplaces.h +++ b/tools/quake3/q3map2/game_darkplaces.h @@ -1,150 +1,150 @@ -/* ------------------------------------------------------------------------------- - -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 - +/* ------------------------------------------------------------------------------- + +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 + diff --git a/tools/quake3/q3map2/game_dq.h b/tools/quake3/q3map2/game_dq.h index 1c42633..97d2d6d 100644 --- a/tools/quake3/q3map2/game_dq.h +++ b/tools/quake3/q3map2/game_dq.h @@ -1,150 +1,150 @@ -/* ------------------------------------------------------------------------------- - -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 - +/* ------------------------------------------------------------------------------- + +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 + diff --git a/tools/quake3/q3map2/game_prophecy.h b/tools/quake3/q3map2/game_prophecy.h index 704c997..60e299d 100644 --- a/tools/quake3/q3map2/game_prophecy.h +++ b/tools/quake3/q3map2/game_prophecy.h @@ -1,150 +1,150 @@ -/* ------------------------------------------------------------------------------- - -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 - +/* ------------------------------------------------------------------------------- + +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 + diff --git a/tools/quake3/q3map2/q3map2.rc b/tools/quake3/q3map2/q3map2.rc index 78cf7b3..bc12037 100644 --- a/tools/quake3/q3map2/q3map2.rc +++ b/tools/quake3/q3map2/q3map2.rc @@ -1 +1 @@ -101 ICON DISCARDABLE "q3map2.ico" +101 ICON DISCARDABLE "q3map2.ico" diff --git a/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch b/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch index 47b5197..0df87e4 100644 --- a/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch +++ b/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch @@ -1,8 +1,8 @@ -Index: light.c -=================================================================== ---- light.c (revision 158) -+++ light.c (working copy) -@@ -357,12 +365,13 @@ +Index: light.c +=================================================================== +--- light.c (revision 158) ++++ light.c (working copy) +@@ -357,12 +365,13 @@ intensity *= scale; /* ydnar: get deviance and samples */ -- 2.39.2